diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/client.js b/client.js index 2dd93879..89bfc123 100644 --- a/client.js +++ b/client.js @@ -10,6 +10,7 @@ var common = require('./lib/common') var HTTPTracker = require('./lib/http-tracker') // empty object in browser var UDPTracker = require('./lib/udp-tracker') // empty object in browser var WebSocketTracker = require('./lib/websocket-tracker') +var jsFlowTracker = require('./lib/jsflow-tracker') inherits(Client, EventEmitter) @@ -29,6 +30,7 @@ inherits(Client, EventEmitter) */ function Client (peerId, port, torrent, opts) { var self = this + console.log("New Tracker Client created."); if (!(self instanceof Client)) return new Client(peerId, port, torrent, opts) EventEmitter.call(self) if (!opts) opts = {} @@ -62,6 +64,8 @@ function Client (peerId, port, torrent, opts) { .map(function (announceUrl) { var protocol = url.parse(announceUrl).protocol + console.log('protocol: ', protocol); + if ((protocol === 'http:' || protocol === 'https:') && typeof HTTPTracker === 'function') { return new HTTPTracker(self, announceUrl, trackerOpts) @@ -69,6 +73,8 @@ function Client (peerId, port, torrent, opts) { return new UDPTracker(self, announceUrl, trackerOpts) } else if ((protocol === 'ws:' || protocol === 'wss:') && webrtcSupport) { return new WebSocketTracker(self, announceUrl, trackerOpts) + } else if ((protocol === 'jsflow:') && webrtcSupport) { + return new jsFlowTracker(self, announceUrl, trackerOpts) } return null }) diff --git a/lib/jsFlow.js b/lib/jsFlow.js new file mode 100644 index 00000000..5a32d380 --- /dev/null +++ b/lib/jsFlow.js @@ -0,0 +1,498 @@ + +var crypto = require('crypto'); +var WebSocket = require('ws'); + +/** @const */ var JSFLOWERR = 2; +/** @const */ var JSFLOWWARN = 1; +/** @const */ var JSFLOWGREAT = 3; + +//Helper +var httpPostHelper = function(url, data, success, fail) { + jsFlow.sysLog('Making HTTP request to url ' + url); + + var http = new XMLHttpRequest(); + http.open("POST", url, true); + http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); + + http.onreadystatechange = function() {//Call a function when the state changes. + if(http.readyState == 4 && http.status == 200) { + success && success(http.responseText); + } + else if(http.readyState == 4 && http.status >= 300) { + console.log('http request error', http.responseText, data); + fail && fail(http.responseText); + } + } + + http.send(data); +} + +/** + * @class + * @author Magnus Lundstedt + */ +var jsFlow = { + bridgeURL: 'https://ws.jsflow.com:443/auth/', + readyState: false, + reconnectFlag: true, + retryCounter: 1, + retryBackoff: 100, + eventHandlerMap: {}, + channelPresenceHandlerMap: {}, + buffert: new Array(), + queue: false, + transmitInterval: 10, + optionParams: {'sessionAuthURL':null, 'defaultChannels':null, 'userId':null, 'debugMsg': null}, + debugMsg: false, + sessionAuthURL: null, + defaultChannels: [], + userId: null, + clientSecret: null, + singletonCreated: false, + socket: null, + logger: {0: 'debug', 1: 'warn', 2: 'error', 3: 'info'}, + color: ['black', 'orange', 'red', 'green'], + + /** + * Callback when connection to server is ready. Overload with your custom callback. + * @callback + */ + onFlowReady: function() {jsFlow.sysLog('No onFlowReady handler set', JSFLOWWARN);}, + + /** + * Callback when connection to server is closed. Overload with your custom callback. + * @callback + */ + onFlowClosed: function() {jsFlow.sysLog('No onFlowClosed handler set', JSFLOWWARN);}, + + /** + * Callback when recieved a generated username during login. Overload with your custsom callback. + * @callback + * @param {string} userId - The generated username. + */ + onRecievedUserId: function(userId) {jsFlow.sysLog('No onRecievedUserId handler set', JSFLOWWARN);}, + + /** + * Callback on successful channel subscribe. Overload with your custsom callback. + * @callback + * @param {string} channelId - The channel that was subscribed. + */ + onSubscribed: function(channelId) {jsFlow.sysLog('No onSubscribed handler set. Channel: ' + channelId, JSFLOWWARN);}, + + /** + * Callback on successful channel unsubscribe. Overload with your custsom callback. + * @callback + * @param {string} channelId - The channel that was unsubscribed. + */ + onUnsubscribed: function(channelId) {jsFlow.sysLog('No onUnsubscribed handler set. Channel: ' + channelId, JSFLOWWARN);}, + + /** + * Callback on authentication error. Overload with your custsom callback. + * @callback + * @param {string} message - Description of the error. + */ + onAuthError: function(message) {jsFlow.sysLog('Authentication error. Description: ' + JSON.stringify(message), JSFLOWERR);}, + + /** + * Run the jsflow api, will begin authentication and during the process call relevant callbacks. + * @param {string} publicApiKey - Your public API key. + * @param {Array} - options - Array of configuration parameters {'sessionAuthURL':null, 'defaultChannels':null, 'userId':null, 'debugMsg': null}. + */ + run : function(publicApiKey, options) { + if(this.singletonCreated) { + if(this.debugMsg) jsFlow.sysLog('Multiple calls to jsFlow.run()', JSFLOWWARN); + return; + } + this.singletonCreated = true; + + for(key in options) { + if(key in this.optionParams) + this[key] = options[key]; + else + if(this.debugMsg) jsFlow.sysLog('Invalid configuration key: '+key, JSFLOWERR); + } + + this.connect(publicApiKey); + }, + + /** + * Graceful close of websocket connection and API reconnect functions. + */ + close : function() { + for(key in this.optionParams) { + this[key] = null; + } + + this.singletonCreated = false; + this.reconnectFlag = false; + jsFlow.socket.close(); + }, + + /** + * Subscribe to a channel. + * @param {string} channelId - Channel to subscribe (fewer than 256 bytes). + */ + subscribe : function(channelId) { + var message = { "command" : "subscribe", + "channel_id" : channelId }; + jsFlow.socket.send(JSON.stringify(message)); + this.defaultChannels.push(channelId); + }, + + /** + * Unsubscribe to a channel. + * @param {string} channelId - Channel to unsubscribe (fewer than 256 bytes). + */ + unsubscribe: function(channelId) { + var message = { "command" : "unsubscribe", + "channel_id" : channelId }; + this.send(message); + index = this.defaultChannels.indexOf(channelId); + while(index > -1) { + this.defaultChannels.splice(index,1); + index = this.defaultChannels.indexOf(channelId); + } + }, + + /** + * Send a message to a user. + * @param {string} userId - Id of user to message (alphanumeric only, fewer than 256 bytes). + * @param {string} payload - Raw javascript object to transmit (not JSON). + * @param {string} trigger - Trigger to be used on the recieving side to process this message. + */ + messageUser: function(userId, payload, trigger) { + payload = JSON.stringify(payload); //TODO: Add encrypt of data + + if(this.sessionAuthURL == null) + if(this.debugMsg) jsFlow.sysLog("No response URL set, this is required for elevated privileges to post to users.", JSFLOWWARN) + var message = { "command" : "message_user", + "user_id" : userId, + "payload" : payload, + "trigger" : trigger, + "digest" : this.digest(payload,userId,trigger)}; + + this.send(message); + }, + + /** + * Send a message to a channel. + * @param {string} channelId - Id of channel to message (fewer than 256 bytes). + * @param {string} payload - Raw javascript object to transmit (not JSON). + * @param {string} trigger - Trigger to be used on the recieving side to process this message. + */ + messageChannel: function(channelId, payload, trigger) { + payload = JSON.stringify(payload); //TODO: Add encrypt of data + + if(this.sessionAuthURL == null) + if(this.debugMsg) jsFlow.sysLog("No response URL set, this is required for elevated privileges to post to channels.", JSFLOWWARN) + //payload['mChannelId'] = channelId + var message = { "command" : "message_channel", + "channel_id" : channelId, + "payload" : payload, + "trigger" : trigger, + "digest" : this.digest(payload,channelId,trigger)}; + + this.send(message); + }, + + /** + * Add handler for trigger. + * @param {string} trigger - Trigger to add a handler for. Alphanumeric, no spaces. + * @param {string} handlerFunction - (payload, from, [channel_id]) Handler to be called when processing messages with this trigger. Multiple handlers can be assigned for each trigger. When called, payload will contain the javascript object (not JSON), from will contain userId of sender and channel_id will contain the channel_id used to relay the message (if it was recieved through a channel) + */ + addHandler : function (trigger, handlerFunction) { + if(!(trigger in this.eventHandlerMap)) + this.eventHandlerMap[trigger] = new Array(); + this.eventHandlerMap[trigger].push(handlerFunction); + }, + + /** + * Add handler for channel presence. + * @param {string} channelId - Channel to add presence handler for. + * @param {string} handlerFunction - (userId, userInChannel, channelId) Handler to be called when processing presence events + */ + setPresenceHandler : function (channelId, handlerFunction) { + this.channelPresenceHandlerMap[channelId] = handlerFunction; + }, + + /** + * Remove handler for channel presence. + * @param {string} channelId - Channel to remove presence handler for. + */ + removePresenceHandler : function (channelId) { + delete this.channelPresenceHandlerMap[channelId]; + }, + + connect : function(public_api_key) { + if(this.debugMsg) jsFlow.sysLog('Authentication request..', JSFLOWGREAT); + + this.retryCounter++; + var self = this; + + var url = this.bridgeURL+(public_api_key || '')+'/'+encodeURIComponent(this.userId || ''); + + httpPostHelper(url, '', function(response) { + var message = JSON.parse(response); + + if(message.response == 'ok') { + self.userId = message.user_id; + try { + self.onRecievedUserId(message.user_id); + } + catch(exception){ + if(self.debugMsg) jsFlow.sysLog('Error executing onRecievedUserId. ' + exception, JSFLOWERR); + } + + if(jsFlow.sessionAuthURL != null) { + if(self.debugMsg) jsFlow.sysLog('Requesting challenge-response from ' + self.sessionAuthURL); + var responseParams = {}; + responseParams.user_id = message.user_id; + responseParams.challenge = message.challenge; + + httpPostHelper(jsFlow.sessionAuthURL, 'user_id='+message.user_id+'&challenge='+message.challenge, function(responseData) { + var response = JSON.parse(responseData); + self.clientSecret = crypto.createHash('sha1').update(message.challenge+response['digest']).digest('hex'); + self.wsConnect('ws://'+message['host']+':'+message['port']+'/flow/',message['user_id'],public_api_key,message['challenge_id'],response['digest']); + }) + + } + else { + self.wsConnect('ws://'+message['host']+':'+message['port']+'/flow/',message['user_id'],public_api_key); + } + } + else { + try { + self.onAuthError(message); + } + catch(exception) { + if(self.debugMsg) jsFlow.sysLog('Error executing onAuthError. ' + exception, JSFLOWERR) + } + } + + }, function(error) { + self.reconnect(public_api_key); + }); + + }, + wsConnect : function(host,user_id,public_api_key,challenge_id,digest) { + try { + if(challenge_id !== undefined) + var url = host+public_api_key+'/'+encodeURIComponent(user_id)+'/'+challenge_id+'/'+digest; + else + var url = host+public_api_key+'/'+encodeURIComponent(user_id) + if(this.debugMsg) jsFlow.sysLog('Connecting to: '+url) + jsFlow.socket = new WebSocket(url); + + var self = this; + + jsFlow.socket.onopen = function () { + //Will not do anything, waiting for server to initiate next step + } + + //Special jQuery hack to maintain reference to "this" object in callbacks + //var wrappedFunc = $.proxy(this.mainHandler, this); + jsFlow.socket.onmessage = this.mainHandler.bind(this); + + //var wrappedFunc2 = $.proxy(this.flowUnready, this); + jsFlow.socket.onclose = function () { + this.flowUnready(public_api_key); + }.bind(this); + } + catch(exception) { + if(this.debugMsg) jsFlow.sysLog('Error on wsConnect. '+exception); + } + }, + reconnect : function(public_api_key) { + if(this.reconnectFlag == true){ + retryIn = this.retryBackoff * this.retryCounter * this.retryCounter +1; + retryIn *= (Math.random()+0.5) + if(this.debugMsg) jsFlow.sysLog('Connection to system failed. Retry in: ' + Math.floor(retryIn), JSFLOWWARN); + setTimeout(function(){ + jsFlow.connect(public_api_key); + }, retryIn); + } + else + if(this.debugMsg) jsFlow.sysLog('Will not retry since close() was called.', JSFLOWGREAT) + }, + sendFromBuffert : function() { + if(this.buffert.length > 0) + { + if(this.readyState) { + msg = this.buffert.pop(); + try { + message = JSON.stringify(msg); + jsFlow.socket.send(message); + if(this.debugMsg) jsFlow.sysLog("Sending message: " + message); + } + catch (exception) { + if(this.debugMsg) jsFlow.sysLog("Warning, can't send data: " + message + ". " + exception, JSFLOWWARN); + } + if(this.buffert.length > 0) { + setTimeout(this.sendFromBuffert.bind(this), this.transmitInterval); + } + else { + setTimeout(this.noQueue.bind(this), this.transmitInterval) + } + } + else { + setTimeout(this.sendFromBuffert.bind(this), this.transmitInterval) + } + } + }, + noQueue : function() { + if(this.buffert.length == 0) + this.queue = false; //No longer send messages from queue only + else + this.sendFromBuffert(); + }, + send : function(message) { + //Add message to message buffert + this.buffert.unshift(message); + if(!this.queue) { //If there is no messages in queue, send now + this.sendFromBuffert(); + this.queue = true; //Only process messages from queue + } + else + if(this.debugMsg) if(this.buffert.length > 0) jsFlow.sysLog("Message is put on the send queue. Buffert length: " + this.buffert.length, JSFLOWWARN) + }, + _subscribe : function(channelId) { + var message = { "command" : "subscribe", + "channel_id" : channelId }; + jsFlow.socket.send(JSON.stringify(message)); + }, + _unsubscribe: function(channelId) { + var message = { "command" : "unsubscribe", + "channel_id" : channelId }; + this.send(message); + }, + register : function() { + var message = { "command" : "register" }; + jsFlow.socket.send(JSON.stringify(message)); + }, + digest: function(payload, id, trigger) { + return ""+crypto.createHash('sha1').update(this.userId + this.clientSecret + payload + id + trigger).digest('hex'); + }, + flowReady : function() { + //Subscribe to all default channels + if(typeof this.defaultChannels == 'string') + this.defaultChannels = [this.defaultChannels]; + for(var i = 0; i < this.defaultChannels.length; i++){ + this._subscribe(this.defaultChannels[i]); + } + + //TODO: If there are messages in the buffer, go through them and recalculate the digest ! + if(this.buffert.length > 0) { + for(var i = 0; i < this.buffert.length; i++){ + if(this.buffert[i]["command"] == 'message_user') + this.buffert[i]["digest"] = this.digest(this.buffert[i]["payload"], + this.buffert[i]["user_id"], + this.buffert[i]["trigger"]); + else if(this.buffert[i]["command"] == 'message_channel') + this.buffert[i]["digest"] = this.digest(this.buffert[i]["payload"], + this.buffert[i]["channel_id"], + this.buffert[i]["trigger"]); + } + this.queue = true; + } + else + this.queue = false; + + this.readyState = true; + this.retryCounter = 1; + try { + this.onFlowReady(); + } + catch(exception){ + if(this.debugMsg) jsFlow.sysLog('Error executing onFlowReady. ' + exception, JSFLOWERR) + } + if(this.debugMsg) jsFlow.sysLog('Websocket connection to jsFlow server established!', JSFLOWGREAT) + }, + flowUnready : function(public_api_key) { + this.readyState = false; + this.queue = false; + try { + this.onFlowClosed(); + } + catch(exception) { + if(this.debugMsg) jsFlow.sysLog('Error executing onFlowClosed. ' + exception, JSFLOWERR) + } + this.reconnect(public_api_key); + }, + mainHandler : function(messageEvent) { + try { + var message = JSON.parse(messageEvent.data); + //Manage responses + if(this.debugMsg) jsFlow.sysLog("Processing Message: " + messageEvent.data); + + //TODO: MAKE THIS A SWITCH CASE instead + if(message['response'] == 'message_sent') { + //TODO: Add developer defined callback to be processed when message has been delivered? + if(typeof message['delta'] != 'undefined') + this.transmitInterval = 10 + Math.round(message['delta']); + else + this.transmitInterval = 10; + } + else if(message['response'] == 'ready') { + this.register(); + } + else if(message['response'] == 'registered') { + this.flowReady(); + } + else if(message['response'] == 'subscribed') { + try { + this.onSubscribed(message['channel_id']); + } + catch(exception){ + if(this.debugMsg) jsFlow.sysLog('Error executing onSubscribed. ' + exception, JSFLOWERR); + } + } + else if(message['response'] == 'unsubscribed') { + try { + this.onUnsubscribed(message['channel_id']); + } + catch(exception){ + if(this.debugMsg) jsFlow.sysLog('Error executing onSubscribed. ' + exception, JSFLOWERR); + } + } + else if(message['response'] == 'error'){ + if(this.debugMsg) jsFlow.sysLog('Error recieved from server: ' + messageEvent.data, JSFLOWERR); + } + else if(message['userInChannel'] == true){ + if(this.debugMsg) jsFlow.sysLog('Calling presence handlers for channel (user joined): ' + message['channel_id']); + if(message['channel_id'] in this.channelPresenceHandlerMap) + this.channelPresenceHandlerMap[message['channel_id']](message['from'], message['userInChannel'], message['channel_id']); + } + else if(message['userInChannel'] == false){ + if(this.debugMsg) jsFlow.sysLog('Calling presence handlers for channel (user left): ' + message['channel_id']); + if(message['channel_id'] in this.channelPresenceHandlerMap) + this.channelPresenceHandlerMap[message['channel_id']](message['from'], message['userInChannel'], message['channel_id']); + } + else { + var handled = 0; + for(handler in this.eventHandlerMap[message['trigger']]){ + try { + var payload = JSON.parse(message['payload']); //TODO: Add decrypt of data + this.eventHandlerMap[message['trigger']][handler](payload, message['from'], message['channel_id']); + handled = 1; + } + catch(exception){ + jsFlow.sysLog('Error executing a handler for trigger "'+message['trigger']+'". ' + exception, JSFLOWERR); + } + } + if(handled == 0) { + if(this.debugMsg) jsFlow.sysLog('No handler found for message: ' + messageEvent.data, JSFLOWWARN); + } + } + } + catch(exception) { + if(this.debugMsg) jsFlow.sysLog('Error parsing message. ' + exception, JSFLOWERR) + } + }, + sysLog: function(message, level) { + // (console[this.logger[level||0]] || console.log) ('jsFlow: %c ' + message, 'color: '+this.color[level||0]); + console.log('jsFlow: ', message); + } +} + + +module.exports = jsFlow; \ No newline at end of file diff --git a/lib/jsflow-tracker.js b/lib/jsflow-tracker.js new file mode 100644 index 00000000..d4e06146 --- /dev/null +++ b/lib/jsflow-tracker.js @@ -0,0 +1,260 @@ +module.exports = jsFlowTracker + +var debug = require('debug')('bittorrent-tracker:websocket-tracker') +var EventEmitter = require('events').EventEmitter +var hat = require('hat') +var inherits = require('inherits') +var jsFlow = require('./jsFlow') +var Peer = require('simple-peer') +//var Peer = require('jsflow-peer') // No changes needed.. :) + + +function jsFlowTracker (client, announceUrl, opts) { + console.log('jsFlowTracker constructor is now running') + var self=this + EventEmitter.call(self) + + self.client = client + self.storeIce = [] + self._opts = opts + self._announceUrl = announceUrl + self._peers = {} // peers (peer id -> peer) + self._intervalMs = self.client._intervalMs // use client interval initially + self._interval = null + + console.log(self); + + jsFlow.onRecievedUserId = function(userId) { + console.log('userId', userId); + self._peerID = userId; + }; + + // Starts jsFlow and handles the user ID + jsFlow.run("31bc728296d8da7e14e132k",{sessionAuthURL: 'http://corslabs.com/jsflow', + debugMsg: true}); + + jsFlow.addHandler('list', self._onData.bind(self)) // These messages are only sent by the TRACKER + + //Handlers for peer-2-peer WebRTC signalling using jsFlow + jsFlow.addHandler('webrtc_offer', self._onWebRtcOffer.bind(self)) // only sent from other PEERS + jsFlow.addHandler('webrtc_answer', self._onWebRtcAnswer.bind(self)) // only sent from other PEERS + jsFlow.addHandler('webrtc_ice', self._onWebRtcIce.bind(self)) // only sent from other PEERS +} + +jsFlowTracker.prototype.announce = function(opts){ + var self=this + opts.info_hash = self.client._infoHash.toString('base64') + opts.peer_id = self._peerId + opts.trackerid = 'tracker' + + self._sendAnnounce(opts) +} + +jsFlowTracker.prototype.setInterval= function (intervalMs) { + var self = this + clearInterval(self._interval) + + self._intervalMs = intervalMs + if (intervalMs) { + // HACK + var update = self.announce.bind(self, self.client._defaultAnnounceOpts()) + self._interval = setInterval(update, self._intervalMs) + } +} + +jsFlowTracker.prototype._onData = function (payload, from) { + console.log('Got Data from Tracker!!', payload, from); + + var self = this + if (!(typeof payload === 'object' && payload !== null)) { + return self.client.emit('warning', new Error('Invalid tracker response')) + } + + if (payload.info_hash !== self.client._infoHash.toString('base64')) { + return self.client.emit('warning', new Error('Invalid tracker response')) + } + + var failure = payload['failure reason'] + if (failure) return self.client.emit('warning', new Error(failure)) + + var warning = payload['warning message'] + if (warning) self.client.emit('warning', new Error(warning)) + + var interval = payload.interval || payload['min interval'] + if (interval && self._intervalMs !== 0) { //TODO: Fix so tracker can set interval (now defaults to 30 min) + //&& !self._opts.interval + //if(interval) { // ALWAYS use the interval recommended by tracker + self.setInterval(interval) + } + + var trackerId = payload['tracker id'] + if (trackerId) { + // If absent, do not discard previous trackerId value + self._trackerId = trackerId + } + + if (payload.complete) { + self.client.emit('update', { + announce: self._announceUrl, + complete: payload.complete, + incomplete: payload.incomplete + }) + } + + // Handle received peers + if (Array.isArray(payload.peers)) { + payload.peers.forEach(function (peerInfo) { //For all peers we receive - Open a WebRTC peer connection + + var peerId = peerInfo.peerId; + + if (!self._peers[peerId]) { + + console.log('Will handle connection for peer: ', peerId); + + var peer = self._peers[peerId] = new Peer({ + initiator: true, + trickle: true, + config: self.client._rtcConfig, + wrtc: self.client._wrtc + }) + peer.id = peerId + peer.on('close', function () { + console.info('Peer connection destroyed, will remove from list of peers!') + delete self._peers[from] + }) + + peer.on('signal', function (signalObject) { + console.log('GOT SIGNAL, expecting offer/ice', signalObject); + if(signalObject.candidate) { // The signalling is for ICE + console.log('We have an ice candidate!') + var params = { + info_hash: self.client._infoHash.toString('base64'), + peer_id: self._peerID, + candidate: signalObject.candidate + } + jsFlow.messageUser(peerId, params, 'webrtc_ice'); + } + else { // The signalling is for an OFFER + offer = signalObject; + console.log('We got an offer', offer) + var params = { + info_hash: self.client._infoHash.toString('base64'), + peer_id: self._peerID, + offer: offer + } + + jsFlow.messageUser(peerId, params, 'webrtc_offer'); + } + }) + + } else { + console.log("Ignore peer, connection already exists.") + } + }) + }; +} + +jsFlowTracker.prototype._onWebRtcOffer = function (payload, from) { + var self = this + if(!self._peers[from]) { //Verify we haven't already received an offer from this user + var peer = self._peers[from] = new Peer({ + trickle: true, + config: self.client._rtcConfig, + wrtc: self.client._wrtc + }) + peer.id = from + peer.on('close', function () { + console.info('Peer connection destroyed, will remove from list of peers!') + delete self._peers[from] + }) + + peer.on('signal', function (signalObject) { + console.log('GOT SIGNAL, expecting answer/ice', signalObject); + if(signalObject.candidate) { // The signalling is for ICE + var params = { + info_hash: self.client._infoHash.toString('base64'), + peer_id: self._peerID, + candidate: signalObject.candidate + } + + jsFlow.messageUser(from, params, 'webrtc_ice'); + } + else { // The signalling is for an ANSWER + answer = signalObject; + var params = { + info_hash: self.client._infoHash.toString('base64'), + peer_id: self._peerID, + answer: answer + } + + jsFlow.messageUser(from, params, 'webrtc_answer'); + } + }) + + peer.signal(payload.offer) + if (peer.readyForIce) { + processStoredCandidates(self,from) + } + + self.client.emit('peer', peer) + } + else { + console.error('Already have peer connection with user: ' + from); + // Test if this works + self.client.emit('peer', peer) + } +} + +jsFlowTracker.prototype._onWebRtcAnswer = function (payload, from) { + var self = this + var peer = self._peers[from] + if(peer) { + peer.id = from + peer.signal(payload.answer) + self.client.emit('peer', peer) + if (peer.readyForIce) { + processStoredCandidates(self,from) + } + } + else { + console.error('Got answer on peer connection that does not exist, from user: ' + from); + } +} + +jsFlowTracker.prototype._onWebRtcIce = function (payload, from) { + var self = this + console.log('Hello user, are you ready for ice?') + var peer = self._peers[from] + + if (peer.readyForIce) { + + console.log('WILL ADD ICE CANDIDATE!!!'); + + if(peer) { + if(payload.candidate) { + peer.signal(payload) + } + } + else { + console.error('Candidate did not exist as expected in payload', payload); + } + } + else { + console.error('Candidate refers to a peer not yet created. Buffering ICE!', payload); + self.storeIce.push(payload) + } + +} + +jsFlowTracker.prototype._sendAnnounce = function (params) { + var self = this + jsFlow.messageUser(params.trackerid, params, 'announce') +} + +function processStoredCandidates (tracker, from) { + console.log("Processing stored candidates.") + var peer = tracker._peers[from] + tracker.storeIce.forEach(function(payload){ + peer.signal(payload) + }) +} diff --git a/node_modules/.bin/parse-torrent b/node_modules/.bin/parse-torrent new file mode 120000 index 00000000..e7c72785 --- /dev/null +++ b/node_modules/.bin/parse-torrent @@ -0,0 +1 @@ +../parse-torrent/bin/cmd.js \ No newline at end of file diff --git a/node_modules/.bin/standard b/node_modules/.bin/standard new file mode 120000 index 00000000..13c5e693 --- /dev/null +++ b/node_modules/.bin/standard @@ -0,0 +1 @@ +../standard/bin/cmd.js \ No newline at end of file diff --git a/node_modules/.bin/tape b/node_modules/.bin/tape new file mode 120000 index 00000000..dc4bc234 --- /dev/null +++ b/node_modules/.bin/tape @@ -0,0 +1 @@ +../tape/bin/tape \ No newline at end of file diff --git a/node_modules/bencode/.travis.yml b/node_modules/bencode/.travis.yml new file mode 100644 index 00000000..fca8ef01 --- /dev/null +++ b/node_modules/bencode/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.10 + - 0.11 diff --git a/node_modules/bencode/AUTHORS b/node_modules/bencode/AUTHORS new file mode 100644 index 00000000..1a1ceb2b --- /dev/null +++ b/node_modules/bencode/AUTHORS @@ -0,0 +1,2 @@ +Mark Schmale +Jonas Hermsmeier \ No newline at end of file diff --git a/node_modules/bencode/CHANGES.md b/node_modules/bencode/CHANGES.md new file mode 100644 index 00000000..bd2c8a3a --- /dev/null +++ b/node_modules/bencode/CHANGES.md @@ -0,0 +1,33 @@ +## Upcoming + + - decode() now throws if it encounters invalid input + +## 0.4.3 + * improved performance a lot + * dropped support for de- and encoding floats to respect the spec + + *note:* node-bencode will still decodes stuff like "i42.23e" but will cast the + result to an interger + +## 0.4.2 + * bugfix: sort dictionary keys to follow the spec + +## 0.4.1 + * bugfix: number decoding was kinda broken + +## 0.4.0 + * fixed problems with multibyte strings + * some performance improvements + * improved code quality + +## 0.3.0 + * #decode() accepts a encoding as its second paramtere + +## 0.2.0 + * complete rewrite, @jhermsmeier joins the team + +## 0.1.0 + * added encoding + +## 0.0.1 +First version, decoding only diff --git a/node_modules/bencode/CONTRIBUTORS b/node_modules/bencode/CONTRIBUTORS new file mode 100644 index 00000000..687529d3 --- /dev/null +++ b/node_modules/bencode/CONTRIBUTORS @@ -0,0 +1,5 @@ +# Just a plain list of people who contributed to this project. +# People who are already listed in AUTHORS are not listed again. + +Conrad Pankoff +Patrick Williams diff --git a/node_modules/bencode/LICENSE.md b/node_modules/bencode/LICENSE.md new file mode 100644 index 00000000..451cea44 --- /dev/null +++ b/node_modules/bencode/LICENSE.md @@ -0,0 +1,23 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2010 Mark Schmale + +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. \ No newline at end of file diff --git a/node_modules/bencode/Makefile b/node_modules/bencode/Makefile new file mode 100644 index 00000000..2e242dd9 --- /dev/null +++ b/node_modules/bencode/Makefile @@ -0,0 +1,21 @@ + +.PHONY: all test benchmark + +browserify: bencode.js lib/*.js + mkdir -p dist + browserify bencode.js -s bencode -o dist/bencode.js + +# TODO: thats not how it should behave! +browser-test: bencode.js lib/*.js test/*.js + mkdir -p dist + browserify test/*.test.js -o dist/tests.js + echo "" > dist/test.html + # open dist/test.html in your browser now + +test: + npm test + +benchmark: + npm run-script bench + +all: browserify test diff --git a/node_modules/bencode/README.md b/node_modules/bencode/README.md new file mode 100644 index 00000000..5bbcd8f0 --- /dev/null +++ b/node_modules/bencode/README.md @@ -0,0 +1,155 @@ +# Bencode +[![npm](http://img.shields.io/npm/v/bencode.svg?style=flat)](https://npmjs.com/bencode) +[![npm downloads](http://img.shields.io/npm/dm/bencode.svg?style=flat)](https://npmjs.com/bencode) +[![build status](http://img.shields.io/travis/themasch/node-bencode.svg?style=flat)](https://travis-ci.org/themasch/node-bencode) + +A node library for encoding and decoding bencoded data, +according to the [BitTorrent specification](http://www.bittorrent.org/beps/bep_0003.html). + +## Index + +- [About BEncoding](#about-bencoding) +- [Installation](#install-with-npm) +- [Performance](#performance) +- [Usage](#usage) +- [API](#api) + +## About BEncoding + +from [Wikipedia](https://en.wikipedia.org/wiki/Bencoding): + +Bencode (pronounced like B encode) is the encoding used by the peer-to-peer +file sharing system BitTorrent for storing and transmitting loosely structured data. + +It supports four different types of values: +- byte strings +- integers +- lists +- dictionaries + +Bencoding is most commonly used in torrent files. +These metadata files are simply bencoded dictionaries. + +## Install with [npm](http://npmjs.org) + +``` +npm install bencode +``` + +## Performance + +### encode +``` +19,235 op/s » bencode + 9,684 op/s » bencoding +11,988 op/s » dht_bencode + 8,946 op/s » bncode +18,744 op/s » dht +``` + +### decode +``` +33,786 op/s » bencode +55,040 op/s » bencoding +40,872 op/s » dht_bencode + 2,533 op/s » bncode +30,292 op/s » dht +``` + +*Benchmarks run on an 1.8 GHz Intel Core i5 with io.js 1.0.4* + +To run the benchmarks simply use + +``` +npm run bench +``` + +## Usage + +```javascript +var bencode = require( 'bencode' ) +``` + +You can also use node-bencode with browserify to be able to use it in a lot of modern browsers. + +[![testling results](https://ci.testling.com/themasch/node-bencode.png)](https://ci.testling.com/themasch/node-bencode) + +### Encoding + +```javascript + +var data = { + string: 'Hello World', + integer: 12345, + dict: { + key: 'This is a string within a dictionary' + }, + list: [ 1, 2, 3, 4, 'string', 5, {} ] +} + +var result = bencode.encode( data ) + +``` + +#### Output + +``` +d4:dictd3:key36:This is a string within a dictionarye7:integeri12345e4:listli1ei2ei3ei4e6:stringi5edee6:string11:Hello Worlde +``` + +### Decoding + +```javascript +var data = new Buffer( 'd6:string11:Hello World7:integeri12345e4:dictd3:key36:This is a string within a dictionarye4:litli1ei2ei3ei4e6:stringi5edeee' ) +var result = bencode.decode( data ) +``` + +#### Output + +```javascript +{ + string: , + integer: 12345, + dict: { + key: + }, + list: [ 1, 2, 3, 4, , 5, {} ] +} +``` + +Automagically convert bytestrings to strings: + +```javascript +var result = bencode.decode( data, 'utf8' ) +``` + +#### Output + +```javascript +{ + string: 'Hello World', + integer: 12345, + dict: { + key: 'This is a string within a dictionary' + }, + list: [ 1, 2, 3, 4, 'string', 5, {} ] +} +``` + +## API + +### bencode.encode( *data* ) + +> `Buffer` | `Array` | `String` | `Object` | `Number` __data__ + +Returns `Buffer` + +### bencode.decode( *data*, *encoding* ) + +> `Buffer` __data__ +> `String` __encoding__ + +If `encoding` is set, bytestrings are +automatically converted to strings. + +Returns `Object` | `Array` | `Buffer` | `String` | `Number` diff --git a/node_modules/bencode/benchmark/buffer-vs-string.js b/node_modules/bencode/benchmark/buffer-vs-string.js new file mode 100644 index 00000000..090777b2 --- /dev/null +++ b/node_modules/bencode/benchmark/buffer-vs-string.js @@ -0,0 +1,12 @@ +var bencode = require('../') +var buf = require('fs').readFileSync(__dirname + '/test.torrent'); +var str = buf.toString('ascii'); + +suite('buffer vs string', function() { + bench('buffer', function() { + bencode.decode(buf); + }) + bench('string', function() { + bencode.decode(str); + }) +}) diff --git a/node_modules/bencode/benchmark/decode.js b/node_modules/bencode/benchmark/decode.js new file mode 100644 index 00000000..54e75e4a --- /dev/null +++ b/node_modules/bencode/benchmark/decode.js @@ -0,0 +1,44 @@ +var fs = require( 'fs' ) + +var bencode = require( '../' ) +var bencoding = require( 'bencoding' ) +var dht_bencode = require( 'dht-bencode' ) +var bncode = require( 'bncode' ) +var dht = require( 'dht.js/lib/dht/bencode' ) + +var buffer = fs.readFileSync( __dirname + '/test.torrent' ) + +suite('decode to buffer', function() { + bench('bencode', function() { + bencode.decode( buffer ) + }) + bench('bencoding', function() { + var v = bencoding.decode( buffer ) + }) + bench('dht_bencode', function() { + dht_bencode.bdecode( buffer ) + }) + bench('bncode', function() { + bncode.decode( buffer ) + }) + bench('dht', function() { + dht.decode( buffer ) + }) +}) + +suite('decode to utf8', function() { + bench('bencode', function() { + bencode.decode( buffer, 'utf8' ) + }) +}) +suite('decode to ascii', function() { + bench('bencode', function() { + bencode.decode( buffer, 'ascii' ) + }) +}) +suite('decode to binary', function() { + bench('bencode', function() { + bencode.decode( buffer, 'ascii' ) + }) +}) + diff --git a/node_modules/bencode/benchmark/encode.js b/node_modules/bencode/benchmark/encode.js new file mode 100644 index 00000000..95a3aac2 --- /dev/null +++ b/node_modules/bencode/benchmark/encode.js @@ -0,0 +1,83 @@ +var fs = require( 'fs' ) + +var bencode = require( '../' ) +var bencoding = require( 'bencoding' ) +var dht_bencode = require( 'dht-bencode' ) +var bncode = require( 'bncode' ) +var dht = require( 'dht.js/lib/dht/bencode' ) + +var buffer = fs.readFileSync( __dirname + '/test.torrent' ) +var object = bencode.decode( buffer ) +var object_utf8 = bencode.decode( buffer, 'utf8' ) +var object_ascii = bencode.decode( buffer, 'ascii' ) +var object_binary = bencode.decode( buffer, 'binary' ) + +suite('encode buffer', function() { + bench('bencode', function() { + bencode.encode( object ) + }) + bench('bencoding', function() { + bencoding.encode( object ) + }) + bench('dht_bencode', function() { + dht_bencode.bencode( object ) + }) + bench('bncode', function() { + bncode.encode( object ) + }) + bench('dht', function() { + dht.encode( object ) + }) +}) + +suite('encode utf8', function() { + bench('bencode', function() { + bencode.encode( object_utf8 ) + }) + bench('bencoding', function() { + bencoding.encode( object_utf8 ) + }) + bench('dht_bencode', function() { + dht_bencode.bencode( object_utf8 ) + }) + bench('bncode', function() { + bncode.encode( object_utf8 ) + }) + bench('dht', function() { + dht.encode( object_utf8 ) + }) +}) +suite('encode ascii', function() { + bench('bencode', function() { + bencode.encode( object_ascii ) + }) + bench('bencoding', function() { + bencoding.encode( object_ascii ) + }) + bench('dht_bencode', function() { + dht_bencode.bencode( object_ascii ) + }) + bench('bncode', function() { + bncode.encode( object_ascii ) + }) + bench('dht', function() { + dht.encode( object_ascii ) + }) +}) +suite('encode binary', function() { + bench('bencode', function() { + bencode.encode( object_binary ) + }) + bench('bencoding', function() { + bencoding.encode( object_binary ) + }) + bench('dht_bencode', function() { + dht_bencode.bencode( object_binary ) + }) + bench('bncode', function() { + bncode.encode( object_binary ) + }) + bench('dht', function() { + dht.encode( object_binary ) + }) +}) diff --git a/node_modules/bencode/benchmark/test.torrent b/node_modules/bencode/benchmark/test.torrent new file mode 100644 index 00000000..8d128c12 Binary files /dev/null and b/node_modules/bencode/benchmark/test.torrent differ diff --git a/node_modules/bencode/bencode.js b/node_modules/bencode/bencode.js new file mode 100644 index 00000000..7dafb4ba --- /dev/null +++ b/node_modules/bencode/bencode.js @@ -0,0 +1,4 @@ +module.exports = { + encode: require( './lib/encode' ), + decode: require( './lib/decode' ) +} diff --git a/node_modules/bencode/lib/decode.js b/node_modules/bencode/lib/decode.js new file mode 100644 index 00000000..5dde6c31 --- /dev/null +++ b/node_modules/bencode/lib/decode.js @@ -0,0 +1,116 @@ +var Dict = require("./dict") + +/** + * Decodes bencoded data. + * + * @param {Buffer} data + * @param {String} encoding + * @return {Object|Array|Buffer|String|Number} + */ +function decode( data, encoding ) { + + decode.position = 0 + decode.encoding = encoding || null + + decode.data = !( Buffer.isBuffer(data) ) + ? new Buffer( data ) + : data + + return decode.next() + +} + +decode.position = 0 +decode.data = null +decode.encoding = null + +decode.next = function() { + + switch( decode.data[decode.position] ) { + case 0x64: return decode.dictionary(); break + case 0x6C: return decode.list(); break + case 0x69: return decode.integer(); break + default: return decode.bytes(); break + } + +} + +decode.find = function( chr ) { + + var i = decode.position + var c = decode.data.length + var d = decode.data + + while( i < c ) { + if( d[i] === chr ) + return i + i++ + } + + throw new Error( + 'Invalid data: Missing delimiter "' + + String.fromCharCode( chr ) + '" [0x' + + chr.toString( 16 ) + ']' + ) + +} + +decode.dictionary = function() { + + decode.position++ + + var dict = new Dict() + + while( decode.data[decode.position] !== 0x65 ) { + dict.binarySet(decode.bytes(), decode.next()) + } + + decode.position++ + + return dict + +} + +decode.list = function() { + + decode.position++ + + var lst = [] + + while( decode.data[decode.position] !== 0x65 ) { + lst.push( decode.next() ) + } + + decode.position++ + + return lst + +} + +decode.integer = function() { + + var end = decode.find( 0x65 ) + var number = decode.data.toString( 'ascii', decode.position + 1, end ) + + decode.position += end + 1 - decode.position + + return parseInt( number, 10 ) + +} + +decode.bytes = function() { + + var sep = decode.find( 0x3A ) + var length = parseInt( decode.data.toString( 'ascii', decode.position, sep ), 10 ) + var end = ++sep + length + + decode.position = end + + return decode.encoding + ? decode.data.toString( decode.encoding, sep, end ) + : decode.data.slice( sep, end ) + +} + +// Exports +module.exports = decode diff --git a/node_modules/bencode/lib/dict.js b/node_modules/bencode/lib/dict.js new file mode 100644 index 00000000..5aea2e8a --- /dev/null +++ b/node_modules/bencode/lib/dict.js @@ -0,0 +1,16 @@ +var Dict = module.exports = function Dict() { + Object.defineProperty(this, "_keys", { + enumerable: false, + value: [], + }) +} + +Dict.prototype.binaryKeys = function binaryKeys() { + return this._keys.slice() +} + +Dict.prototype.binarySet = function binarySet(key, value) { + this._keys.push(key) + + this[key] = value +} diff --git a/node_modules/bencode/lib/encode.js b/node_modules/bencode/lib/encode.js new file mode 100644 index 00000000..2cb2eea0 --- /dev/null +++ b/node_modules/bencode/lib/encode.js @@ -0,0 +1,101 @@ +/** + * Encodes data in bencode. + * + * @param {Buffer|Array|String|Object|Number} data + * @return {Buffer} + */ +function encode( data ) { + var buffers = [] + encode._encode( buffers, data ) + return Buffer.concat( buffers ) +} + +encode._floatConversionDetected = false + +encode._encode = function( buffers, data ) { + + if( Buffer.isBuffer(data) ) { + buffers.push(new Buffer(data.length + ':')) + buffers.push(data) + return; + } + + switch( typeof data ) { + case 'string': + encode.bytes( buffers, data ) + break + case 'number': + encode.number( buffers, data ) + break + case 'object': + data.constructor === Array + ? encode.list( buffers, data ) + : encode.dict( buffers, data ) + break + } + +} + +var buff_e = new Buffer('e') + , buff_d = new Buffer('d') + , buff_l = new Buffer('l') + +encode.bytes = function( buffers, data ) { + + buffers.push( new Buffer(Buffer.byteLength( data ) + ':' + data) ) +} + +encode.number = function( buffers, data ) { + var maxLo = 0x80000000 + var hi = ( data / maxLo ) << 0 + var lo = ( data % maxLo ) << 0 + var val = hi * maxLo + lo + + buffers.push( new Buffer( 'i' + val + 'e' )) + + if( val !== data && !encode._floatConversionDetected ) { + encode._floatConversionDetected = true + console.warn( + 'WARNING: Possible data corruption detected with value "'+data+'":', + 'Bencoding only defines support for integers, value was converted to "'+val+'"' + ) + console.trace() + } + +} + +encode.dict = function( buffers, data ) { + + buffers.push( buff_d ) + + var j = 0 + var k + // fix for issue #13 - sorted dicts + var keys = Object.keys( data ).sort() + var kl = keys.length + + for( ; j < kl ; j++) { + k=keys[j] + encode.bytes( buffers, k ) + encode._encode( buffers, data[k] ) + } + + buffers.push( buff_e ) +} + +encode.list = function( buffers, data ) { + + var i = 0, j = 1 + var c = data.length + buffers.push( buff_l ) + + for( ; i < c; i++ ) { + encode._encode( buffers, data[i] ) + } + + buffers.push( buff_e ) + +} + +// Expose +module.exports = encode diff --git a/node_modules/bencode/package.json b/node_modules/bencode/package.json new file mode 100644 index 00000000..2af469c0 --- /dev/null +++ b/node_modules/bencode/package.json @@ -0,0 +1,86 @@ +{ + "name": "bencode", + "version": "0.7.0", + "license": "MIT", + "description": "Bencode de/encoder", + "keywords": [ + "torrent", + "bittorrent", + "bencode", + "bdecode", + "bencoding" + ], + "contributors": [ + { + "name": "Mark Schmale", + "email": "masch@masch.it", + "url": "http://masch.it/" + }, + { + "name": "Jonas Hermsmeier", + "email": "jonas@hojoki.com" + } + ], + "main": "bencode.js", + "devDependencies": { + "bencoding": "latest", + "bncode": "latest", + "dht-bencode": "latest", + "dht.js": "latest", + "matcha": "~0.6.0", + "tap-spec": "~2.2.0", + "tape": "~3.5.0" + }, + "scripts": { + "test": "node node_modules/.bin/tape test/*.test.js | node node_modules/.bin/tap-spec", + "bench": "node node_modules/.bin/matcha benchmark/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/themasch/node-bencode.git" + }, + "bugs": { + "url": "https://github.com/themasch/node-bencode/issues" + }, + "testling": { + "files": "test/*.test.js", + "browsers": [ + "ie/6..latest", + "chrome/22..latest", + "firefox/16..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6..latest", + "ipad/6..latest", + "android-browser/latest" + ] + }, + "gitHead": "2b3548b98e3f74efe16dec1436f82debf5ccc22b", + "homepage": "https://github.com/themasch/node-bencode", + "_id": "bencode@0.7.0", + "_shasum": "811ed647c0118945e41bb4bbbdea9a2c78a17083", + "_from": "bencode@0.7.0", + "_npmVersion": "2.4.1", + "_nodeVersion": "1.0.4", + "_npmUser": { + "name": "jhermsmeier", + "email": "jhermsmeier@gmail.com" + }, + "maintainers": [ + { + "name": "masch", + "email": "ma.schmale@googlemail.com" + }, + { + "name": "jhermsmeier", + "email": "jhermsmeier@gmail.com" + } + ], + "dist": { + "shasum": "811ed647c0118945e41bb4bbbdea9a2c78a17083", + "tarball": "http://registry.npmjs.org/bencode/-/bencode-0.7.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bencode/-/bencode-0.7.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/bencode/test/data.js b/node_modules/bencode/test/data.js new file mode 100644 index 00000000..cc11c847 --- /dev/null +++ b/node_modules/bencode/test/data.js @@ -0,0 +1,7 @@ +module.exports = { + //binKeyData: new Buffer("ZDU6ZmlsZXNkMjA6N7VVuuCjmp5LoM+n15a5iM/XJHdkODpjb21wbGV0ZWkwZTEwOmRvd25sb2FkZWRpMTBlMTA6aW5jb21wbGV0ZWkwZWVlZQ==", 'base64') + binKeyData: new Buffer('ZDU6ZmlsZXNkMzY6N++/vVXvv73go5rvv71L77+9z6fXlu+/ve+/ve+/ve+/vSR3ZDg6Y29tcGxldGVpMGUxMDpkb3dubG9hZGVkaTEwZTEwOmluY29tcGxldGVpMGVlZWU=', 'base64') + , binKeyName: new Buffer("N++/vVXvv73go5rvv71L77+9z6fXlu+/ve+/ve+/ve+/vSR3", 'base64') + , binStringData: new Buffer('w7bCsXNkZg==', 'base64') + , binResultData: new Buffer('NzrDtsKxc2Rm', 'base64') +} diff --git a/node_modules/bencode/test/decode.buffer.test.js b/node_modules/bencode/test/decode.buffer.test.js new file mode 100644 index 00000000..d308e468 --- /dev/null +++ b/node_modules/bencode/test/decode.buffer.test.js @@ -0,0 +1,85 @@ +var test = require('tape').test +var bencode = require('./lib.js') +var data = require('./data.js') + +test("bencode#decode(x)", function(t) { + + t.test('should be able to decode an integer', function(t) { + t.plan(2) + t.equal(bencode.decode('i123e'), 123); + t.equal(bencode.decode('i-123e'), -123); + }) + + t.test('should be able to decode a float (as int)', function(t) { + t.plan(2) + t.equal(bencode.decode('i12.3e'), 12); + t.equal(bencode.decode('i-12.3e'), -12); + }) + + t.test('should be able to decode a string', function(t) { + t.plan(2) + t.deepEqual(bencode.decode('5:asdfe'), new Buffer('asdfe')); + t.deepEqual(bencode.decode(data.binResultData.toString()), data.binStringData); + }) + + t.test('should be able to decode "binary keys"', function(t) { + t.plan(1) + t.ok(bencode.decode(data.binKeyData).files.hasOwnProperty(data.binKeyName)); + }) + + t.test('should be able to decode a dictionary', function(t) { + t.plan(3) + t.deepEqual( + bencode.decode( 'd3:cow3:moo4:spam4:eggse' ), + { + cow: new Buffer('moo'), + spam: new Buffer('eggs') + } + ) + t.deepEqual( + bencode.decode( 'd4:spaml1:a1:bee' ), + { spam: [ + new Buffer('a'), + new Buffer('b') + ] } + ) + t.deepEqual( + bencode.decode( 'd9:publisher3:bob17:publisher-webpage15:www.example.com18:publisher.location4:homee'), + { + 'publisher': new Buffer('bob'), + 'publisher-webpage': new Buffer('www.example.com'), + 'publisher.location': new Buffer('home') + } + ) + }); + + t.test('should be able to decode a list', function(t) { + t.plan(1) + t.deepEqual( + bencode.decode( 'l4:spam4:eggse'), + [ new Buffer('spam'), + new Buffer('eggs') ] + ) + }) + t.test('should return the correct type', function(t) { + t.plan(1) + t.ok(Buffer.isBuffer(bencode.decode('4:öö'))); + }) + t.test('should be able to decode stuff in dicts (issue #12)', function(t) { + t.plan(4) + var someData = { + string: 'Hello World', + integer: 12345, + dict: { + key: 'This is a string within a dictionary' + }, + list: [ 1, 2, 3, 4, 'string', 5, {} ] + } + var result = bencode.encode( someData ) + var dat = bencode.decode ( result ) + t.equal(dat.integer, 12345) + t.deepEqual(dat.string, new Buffer("Hello World")) + t.deepEqual(dat.dict.key, new Buffer("This is a string within a dictionary")) + t.deepEqual(dat.list, [1, 2, 3, 4, new Buffer('string'), 5, {}]) + }) +}) diff --git a/node_modules/bencode/test/decode.utf8.test.js b/node_modules/bencode/test/decode.utf8.test.js new file mode 100644 index 00000000..bb50ab66 --- /dev/null +++ b/node_modules/bencode/test/decode.utf8.test.js @@ -0,0 +1,79 @@ +var test = require('tape').test +var bencode = require('./lib.js') +var data = require('./data.js') + +test("bencode#decode(x, 'uft8')", function(t) { + t.test('should be able to decode an integer', function(t) { + t.plan(2) + t.equal(bencode.decode('i123e', 'utf8'), 123) + t.equal(bencode.decode('i-123e', 'utf8'), -123) + }) + t.test('should be able to decode a float (as int)', function(t) { + t.plan(2) + t.equal(bencode.decode('i12.3e', 'utf8'), 12) + t.equal(bencode.decode('i-12.3e', 'utf8'), -12) + }) + t.test('should be able to decode a string', function(t) { + t.plan(2) + t.equal(bencode.decode('5:asdfe', 'utf8'), 'asdfe') + t.deepEqual(bencode.decode(data.binResultData.toString(), 'utf8'), data.binStringData.toString()); + }) + t.test('should be able to decode "binary keys"', function(t) { + t.plan(1) + var decoded = bencode.decode(data.binKeyData, 'utf8') + t.ok(decoded.files.hasOwnProperty(data.binKeyName.toString('utf8'))) + }) + + t.test('should be able to decode a dictionary', function(t) { + t.plan(3) + t.deepEqual( + bencode.decode( 'd3:cow3:moo4:spam4:eggse', 'utf8' ), + { + cow: 'moo', + spam: 'eggs' + } + ) + t.deepEqual( + bencode.decode( 'd4:spaml1:a1:bee', 'utf8' ), + { spam: [ 'a', 'b' ] } + ) + t.deepEqual( + bencode.decode( 'd9:publisher3:bob17:publisher-webpage15:www.example.com18:publisher.location4:homee', 'utf8' ), + { + 'publisher': 'bob', + 'publisher-webpage': 'www.example.com', + 'publisher.location': 'home' + } + ) + }) + + t.test('should be able to decode a list', function(t) { + t.plan(1) + t.deepEqual( + bencode.decode( 'l4:spam4:eggse', 'utf8' ), + [ 'spam', 'eggs' ] + ) + }) + t.test('should return the correct type', function(t) { + t.plan(1) + t.ok(typeof(bencode.decode('4:öö', 'utf8')) === 'string') + }) + + t.test('should be able to decode stuff in dicts (issue #12)', function(t) { + t.plan(4) + var someData = { + string: 'Hello World', + integer: 12345, + dict: { + key: 'This is a string within a dictionary' + }, + list: [ 1, 2, 3, 4, 'string', 5, {} ] + } + var result = bencode.encode( someData ) + var dat = bencode.decode ( result, 'utf8' ) + t.equal(dat.integer, 12345) + t.deepEqual(dat.string, "Hello World") + t.deepEqual(dat.dict.key, "This is a string within a dictionary") + t.deepEqual(dat.list, [1, 2, 3, 4, 'string', 5, {}]) + }) +}) diff --git a/node_modules/bencode/test/encode.test.js b/node_modules/bencode/test/encode.test.js new file mode 100644 index 00000000..3fd3e5da --- /dev/null +++ b/node_modules/bencode/test/encode.test.js @@ -0,0 +1,119 @@ +var test = require('tape').test +var bencode = require('./lib.js') +var data = require('./data.js') + +test('bencode#encode()', function(t) { + + // prevent the warning showing up in the test + bencode.encode._floatConversionDetected = true + + t.test('should always return a Buffer', function(t) { + t.plan(5) + t.ok(Buffer.isBuffer(bencode.encode({})), "its a buffer for empty dicts") + t.ok(Buffer.isBuffer(bencode.encode("test")), "its a buffer for strings") + t.ok(Buffer.isBuffer(bencode.encode([3, 2])), "its a buffer for lists") + t.ok(Buffer.isBuffer(bencode.encode({"a": "b", 3: 6})), "its a buffer for big dicts") + t.ok(Buffer.isBuffer(bencode.encode(123)), "its a buffer for numbers") + }) + + t.test('should sort dictionaries', function(t) { + t.plan(1) + var data = { string: 'Hello World', integer: 12345 } + t.equal(bencode.encode(data).toString(), "d7:integeri12345e6:string11:Hello Worlde") + }) + + t.test('should force keys to be strings', function(t) { + t.plan(1) + var data = { + 12: 'Hello World', + 34: 12345, + } + t.equal(bencode.encode(data).toString(), "d2:1211:Hello World2:34i12345ee") + }) + + t.test('should be able to encode a positive integer', function(t) { + t.plan(1) + t.equal(bencode.encode(123).toString(), 'i123e') + }) + t.test('should be able to encode a negative integer', function(t) { + t.plan(1) + t.equal(bencode.encode(-123).toString(), 'i-123e') + }) + t.test('should be able to encode a positive float (as int)', function(t) { + t.plan(1) + t.equal(bencode.encode(123.5).toString(), 'i123e') + }) + t.test('should be able to encode a negative float (as int)', function(t) { + t.plan(1) + t.equal(bencode.encode(-123.5).toString(), 'i-123e') + }) + + t.test('should be able to safely encode numbers between -/+ 2 ^ 53 (as ints)', function(t) { + var JAVASCRIPT_INT_BITS = 53 + var MAX_JAVASCRIPT_INT = Math.pow(2, JAVASCRIPT_INT_BITS) + + t.plan((JAVASCRIPT_INT_BITS-1) * 6 + 3) + t.equal(bencode.encode(0).toString(), 'i' + 0 + 'e') + + for (var exp = 1; exp < JAVASCRIPT_INT_BITS; ++exp) { + var val = Math.pow(2, exp) + // try the positive and negative + t.equal(bencode.encode(val).toString(), 'i' + val + 'e') + t.equal(bencode.encode(-val).toString(), 'i-' + val + 'e') + + // try the value, one above and one below, both positive and negative + var above = val + 1 + var below = val - 1 + + t.equal(bencode.encode(above).toString(), 'i' + above + 'e') + t.equal(bencode.encode(-above).toString(), 'i-' + above + 'e') + + t.equal(bencode.encode(below).toString(), 'i' + below + 'e') + t.equal(bencode.encode(-below).toString(), 'i-' + below + 'e') + } + t.equal(bencode.encode(MAX_JAVASCRIPT_INT).toString(), 'i' + MAX_JAVASCRIPT_INT + 'e') + t.equal(bencode.encode(-MAX_JAVASCRIPT_INT).toString(), 'i-' + MAX_JAVASCRIPT_INT + 'e') + }) + t.test('should be able to encode a previously problematice 64 bit int', function(t) { + t.plan(1) + t.equal(bencode.encode(2433088826).toString(), 'i' + 2433088826 + 'e') + }) + t.test('should be able to encode a negative 64 bit int', function(t) { + t.plan(1) + t.equal(bencode.encode(-0xffffffff).toString(), 'i-' + 0xffffffff + 'e') + }) + t.test('should be able to encode a positive 64 bit float (as int)', function(t) { + t.plan(1) + t.equal(bencode.encode(0xffffffff + 0.5).toString(), 'i' + 0xffffffff + 'e') + }) + t.test('should be able to encode a negative 64 bit float (as int)', function(t) { + t.plan(1) + t.equal(bencode.encode(-0xffffffff - 0.5).toString(), 'i-' + 0xffffffff + 'e') + }) + t.test('should be able to encode a string', function(t) { + t.plan(2) + t.equal(bencode.encode("asdf").toString(), '4:asdf') + t.equal(bencode.encode(":asdf:").toString(), '6::asdf:') + }) + t.test('should be able to encode a unicode string', function(t) { + t.plan(2) + t.deepEqual(bencode.encode(data.binStringData.toString()), data.binResultData) + t.deepEqual(bencode.encode(data.binStringData.toString()), data.binResultData) + }) + t.test('should be able to encode a buffer', function(t) { + t.plan(2) + t.equal(bencode.encode(new Buffer("asdf")).toString(), '4:asdf') + t.equal(bencode.encode(new Buffer(":asdf:")).toString(), '6::asdf:') + }) + t.test('should be able to encode an array', function(t) { + t.plan(2) + t.equal(bencode.encode([32, 12]).toString(), 'li32ei12ee') + t.equal(bencode.encode([":asdf:"]).toString(), 'l6::asdf:e') + }) + t.test('should be able to encode an object', function(t) { + t.plan(3) + t.equal(bencode.encode({"a": "bc"}).toString(), 'd1:a2:bce') + t.equal(bencode.encode({"a": "45", "b": 45}).toString(), 'd1:a2:451:bi45ee') + t.equal(bencode.encode({"a": new Buffer("bc")}).toString(), 'd1:a2:bce') + }) +}) diff --git a/node_modules/bencode/test/lib.js b/node_modules/bencode/test/lib.js new file mode 100644 index 00000000..fb9e342d --- /dev/null +++ b/node_modules/bencode/test/lib.js @@ -0,0 +1,3 @@ +module.exports = require('../bencode.js'); +//module.exports.decode = module.exports.bdecode +//module.exports.encode = module.exports.bencode diff --git a/node_modules/bencode/test/mocha.opts b/node_modules/bencode/test/mocha.opts new file mode 100644 index 00000000..5ada47be --- /dev/null +++ b/node_modules/bencode/test/mocha.opts @@ -0,0 +1 @@ +--reporter spec diff --git a/node_modules/bencode/test/specifications.md b/node_modules/bencode/test/specifications.md new file mode 100644 index 00000000..39050c6c --- /dev/null +++ b/node_modules/bencode/test/specifications.md @@ -0,0 +1,8 @@ +_Strings_ are length-prefixed base ten followed by a colon and the string. For example 4:spam corresponds to 'spam'. + +_Integers_ are represented by an 'i' followed by the number in base 10 followed by an 'e'. For example i3e corresponds to 3 and i-3e corresponds to -3. Integers have no size limitation. i-0e is invalid. All encodings with a leading zero, such as i03e, are invalid, other than i0e, which of course corresponds to 0. + +_Lists_ are encoded as an 'l' followed by their elements (also bencoded) followed by an 'e'. For example l4:spam4:eggse corresponds to ['spam', 'eggs']. + +_Dictionaries_ are encoded as a 'd' followed by a list of alternating keys and their corresponding values followed by an 'e'. For example, d3:cow3:moo4:spam4:eggse corresponds to {'cow': 'moo', 'spam': 'eggs'} and d4:spaml1:a1:bee corresponds to {'spam': ['a', 'b']}. +Keys must be strings and appear in sorted order (sorted as raw strings, not alphanumerics). diff --git a/node_modules/bn.js/.jscsrc b/node_modules/bn.js/.jscsrc new file mode 100644 index 00000000..dbaae205 --- /dev/null +++ b/node_modules/bn.js/.jscsrc @@ -0,0 +1,46 @@ +{ + "disallowKeywordsOnNewLine": [ "else" ], + "disallowMixedSpacesAndTabs": true, + "disallowMultipleLineStrings": true, + "disallowMultipleVarDecl": true, + "disallowNewlineBeforeBlockStatements": true, + "disallowQuotedKeysInObjects": true, + "disallowSpaceAfterObjectKeys": true, + "disallowSpaceAfterPrefixUnaryOperators": true, + "disallowSpaceBeforePostfixUnaryOperators": true, + "disallowSpacesInCallExpression": true, + "disallowTrailingComma": true, + "disallowTrailingWhitespace": true, + "disallowYodaConditions": true, + + "requireCommaBeforeLineBreak": true, + "requireOperatorBeforeLineBreak": true, + "requireSpaceAfterBinaryOperators": true, + "requireSpaceAfterKeywords": [ "if", "for", "while", "else", "try", "catch" ], + "requireSpaceAfterLineComment": true, + "requireSpaceBeforeBinaryOperators": true, + "requireSpaceBeforeBlockStatements": true, + "requireSpaceBeforeKeywords": [ "else", "catch" ], + "requireSpaceBeforeObjectValues": true, + "requireSpaceBetweenArguments": true, + "requireSpacesInAnonymousFunctionExpression": { + "beforeOpeningCurlyBrace": true + }, + "requireSpacesInFunctionDeclaration": { + "beforeOpeningCurlyBrace": true + }, + "requireSpacesInFunctionExpression": { + "beforeOpeningCurlyBrace": true + }, + "requireSpacesInConditionalExpression": true, + "requireSpacesInForStatement": true, + "requireSpacesInsideArrayBrackets": "all", + "requireSpacesInsideObjectBrackets": "all", + "requireDotNotation": true, + + "maximumLineLength": 80, + "validateIndentation": 2, + "validateLineBreaks": "LF", + "validateParameterSeparator": ", ", + "validateQuoteMarks": "'" +} diff --git a/node_modules/bn.js/.jshintrc b/node_modules/bn.js/.jshintrc new file mode 100644 index 00000000..87f72f9a --- /dev/null +++ b/node_modules/bn.js/.jshintrc @@ -0,0 +1,89 @@ +{ + // JSHint Default Configuration File (as on JSHint website) + // See http://jshint.com/docs/ for more details + + "maxerr" : 50, // {int} Maximum error before stopping + + // Enforcing + "bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.) + "camelcase" : true, // true: Identifiers must be in camelCase + "curly" : false, // true: Require {} for every new block or scope + "eqeqeq" : true, // true: Require triple equals (===) for comparison + "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() + "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. + "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` + "indent" : 2, // {int} Number of spaces to use for indentation + "latedef" : true, // true: Require variables/functions to be defined before being used + "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` + "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` + "noempty" : false, // true: Prohibit use of empty blocks + "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. + "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) + "plusplus" : false, // true: Prohibit use of `++` & `--` + "quotmark" : "single", // Quotation mark consistency: + // false : do nothing (default) + // true : ensure whatever is used is consistent + // "single" : require single quotes + // "double" : require double quotes + "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) + "unused" : true, // true: Require all defined variables be used + "strict" : true, // true: Requires all functions run in ES5 Strict Mode + "maxparams" : false, // {int} Max number of formal params allowed per function + "maxdepth" : 3, // {int} Max depth of nested blocks (within functions) + "maxstatements" : false, // {int} Max number statements per function + "maxcomplexity" : false, // {int} Max cyclomatic complexity per function + "maxlen" : false, // {int} Max number of characters per line + + // Relaxing + "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) + "boss" : false, // true: Tolerate assignments where comparisons would be expected + "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // true: Tolerate use of `== null` + "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) + "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`) + "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) + // (ex: `for each`, multiple try/catch, function expression…) + "evil" : false, // true: Tolerate use of `eval` and `new Function()` + "expr" : false, // true: Tolerate `ExpressionStatement` as Programs + "funcscope" : false, // true: Tolerate defining variables inside control statements + "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') + "iterator" : false, // true: Tolerate using the `__iterator__` property + "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block + "laxbreak" : false, // true: Tolerate possibly unsafe line breakings + "laxcomma" : false, // true: Tolerate comma-first style coding + "loopfunc" : false, // true: Tolerate functions being defined in loops + "multistr" : false, // true: Tolerate multi-line strings + "noyield" : false, // true: Tolerate generator functions with no yield statement in them. + "notypeof" : false, // true: Tolerate invalid typeof operator values + "proto" : false, // true: Tolerate using the `__proto__` property + "scripturl" : false, // true: Tolerate script-targeted URLs + "shadow" : true, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` + "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation + "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` + "validthis" : false, // true: Tolerate using this in a non-constructor function + + // Environments + "browser" : true, // Web Browser (window, document, etc) + "browserify" : true, // Browserify (node.js code in the browser) + "couch" : false, // CouchDB + "devel" : true, // Development/debugging (alert, confirm, etc) + "dojo" : false, // Dojo Toolkit + "jasmine" : false, // Jasmine + "jquery" : false, // jQuery + "mocha" : true, // Mocha + "mootools" : false, // MooTools + "node" : true, // Node.js + "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) + "prototypejs" : false, // Prototype and Scriptaculous + "qunit" : false, // QUnit + "rhino" : false, // Rhino + "shelljs" : false, // ShellJS + "worker" : false, // Web Workers + "wsh" : false, // Windows Scripting Host + "yui" : false, // Yahoo User Interface + + // Custom Globals + "globals" : { + "module": true + } // additional predefined global variables +} diff --git a/node_modules/bn.js/.npmignore b/node_modules/bn.js/.npmignore new file mode 100644 index 00000000..6d1eebbd --- /dev/null +++ b/node_modules/bn.js/.npmignore @@ -0,0 +1,6 @@ +benchmarks/ +coverage/ +node_modules/ +npm-debug.log +1.js +logo.png diff --git a/node_modules/bn.js/.travis.yml b/node_modules/bn.js/.travis.yml new file mode 100644 index 00000000..92a990f6 --- /dev/null +++ b/node_modules/bn.js/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.11" +branches: + only: + - master diff --git a/node_modules/bn.js/1.patch b/node_modules/bn.js/1.patch new file mode 100644 index 00000000..e80ee8c2 --- /dev/null +++ b/node_modules/bn.js/1.patch @@ -0,0 +1,3640 @@ +From f26e6ec81a999b09c626e5138f04b59abb1f5025 Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Tue, 9 Dec 2014 04:27:17 +0300 +Subject: [PATCH 01/12] First scratches FFT + +--- + lib/bn.js | 269 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 266 insertions(+), 3 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index 2e990f6..9b9b857 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -883,15 +883,270 @@ BN.prototype._bigMulTo = function _bigMulTo(num, out) { + return out.strip(); + }; + ++ ++function Complex(r, i) { ++ this.r = r; ++ this.i = i; ++ ++ //this._norm(); ++} ++ ++// private ++function _iaddC(rhs) { ++ this.r += rhs.r; ++ this.i += rhs.i; ++ ++ //this._norm(); ++ ++ return this; ++} ++ ++function _addC(rhs) { ++ var t = new Complex(this.r, this.i); ++ t.iadd(rhs); ++ return t; ++} ++ ++function _isubC(rhs) { ++ this.r -= rhs.r; ++ this.i -= rhs.i ++ ++ //this._norm(); ++ ++ return this; ++} ++ ++function _subC(rhs) { ++ var t = new Complex(this.r, this.i); ++ t.isub(rhs); ++ return t; ++} ++ ++function _iconjC() { ++ this.i *= -1; ++ return this; ++} ++ ++function _imulC(rhs) { ++ var r = this.r * rhs.r - this.i * rhs.i, ++ i = this.r * rhs.i + this.i * rhs.r; ++ ++ this.r = r; ++ this.i = i; ++ ++ //this._norm(); ++ ++ return this; ++} ++ ++function _mulC(rhs) { ++ var t = new Complex(this.r, this.i); ++ t.imul(rhs); ++ return t; ++} ++ ++function _cloneC() { ++ return new Complex(this.r, this.i); ++} ++ ++Complex.prototype.mul = _mulC; ++Complex.prototype.imul = _imulC; ++Complex.prototype.add = _addC; ++Complex.prototype.iadd = _iaddC; ++Complex.prototype.sub = _subC; ++Complex.prototype.isub = _isubC; ++Complex.prototype.iconj = _iconjC; ++Complex.prototype.clone = _cloneC; ++ ++Complex.prototype._isZero = function (v) { ++ return Math.abs(v) < 1.e-12; ++} ++ ++Complex.prototype._norm = function () { ++ //if (this._isZero(this.r)) this.r = 0; ++ //if (this._isZero(this.i)) this.i = 0; ++} ++ ++Complex.ZERO = new Complex(0, 0); ++ ++// _FFT(this.words, thisWFT, w, N, 0); ++function _FFT(ws, p, s, tws, tp, r, N) { ++ if (N === 1) { ++ tws[tp] = ws[p]; ++ //console.log("p/tp/ws/tws :", p, tp, ws, tws); ++ } else { ++ var hN = N / 2 >> 0; ++ ++ var rr = r.mul(r); ++ ++ var s_ = 2 * s + 1; ++ ++ //console.log("-- FFT -- # ", N); ++ //console.log("-- R -- ", r); ++ ++ //console.log("-- RR -- # ", rr); ++ ++ _FFT(ws, p, s_, tws, tp, rr, hN); // even ++ _FFT(ws, p + s + 1, s_, tws, tp + hN, rr, hN); // odd ++ ++ var r_ = r.clone(); ++ ++ for (var i = 0; i < hN; ++i) { ++ var e = tws[tp + i]; ++ var o = tws[tp + i + hN].clone(); ++ ++ //console.log("tp + i, tp + i + hN, tws | ", tp + i, tp + i + hN, tws) ++ //console.log("r_, o, e, (o * r_)", r_, o, e, o.mul(r_)); ++ ++ o.imul(r_); ++ ++ tws[tp + i] = e.add(o); ++ tws[tp + i + hN] = e.sub(o); ++ ++ r_.imul(r); ++ ++ //console.log("tws | ", tws) ++ } ++ } ++} ++ ++var π = 3.14159265359; ++ ++function _guess(n, m) { ++ var N = (n < m ? n : m) | 1, odd = N & 1; ++ var i = 0; ++ for (; N; N = N / 2 >> 0) { ++ i++; ++ } ++ ++ return (1 << i + odd) ++} ++ ++function _iconjugate(ws, N) { ++ if (N > 1) { ++ for (var i = 0; i < N / 2; ++i) { ++ var t = ws[i]; ++ ws[i] = ws[N - i - 1]; ++ ws[N - i - 1] = t; ++ ++ ws[i].i *= -1; ++ ws[N - i - 1].i *= -1; ++ } ++ } ++ ++ return ws; ++} ++ ++function _inormalize(ws, N) { ++ var carry = 0; ++ for (var i = 0; i < N / 2; ++i) { ++ ++ //var n = (((ws[2 * i + 1].r / N + .5) >> 0) << 13) ++ // + ((ws[2 * i].r / N + .5) >> 0) ++ // + carry; ++ ++ //if ((Math.round(ws[2 * i + 1].r / N) << 13) !== (Math.round(ws[2 * i + 1].r / N) * 0x2000)) { ++ // console.log(1 << 13, 1 * 0x2000); ++ // console.log(Math.round(ws[2 * i + 1].r / N), ((Math.round(ws[2 * i + 1].r / N)) << 7), (Math.round(ws[2 * i + 1].r / N) * 0x2000)); ++ // assert((Math.round(ws[2 * i + 1].r / N) << 13) === (Math.round(ws[2 * i + 1].r / N) * 0x2000), "WAAAAAT"); ++ //} ++ ++ ++ //assert(Math.abs(ws[2 * i].i) < N && Math.abs(ws[2 * i + 1].i) < N) ++ ++ var n = (Math.round(ws[2 * i + 1].r / N) * 0x2000) ++ + Math.round(ws[2 * i].r / N) ++ + carry; ++ ++ //console.log( ++ // n.toString(16), ++ // carry.toString(16), ++ // (n & 0x3ffffff).toString(16) ++ // ); ++ ++ ws[i] = n & 0x3ffffff; ++ ++ if (n < 0x4000000) { ++ carry = 0; ++ } else { ++ carry = Math.floor(n / 0x4000000); ++ } ++ } ++ ++ return ws; ++} ++ ++function _iconvertToC(ws, N) { ++ var cws = new Array(N); ++ for (var i = 0; i < N / 2; i++) { ++ var w = ws[i] || 0; ++ ++ cws[2 * i] = new Complex(w & 0x1fff, 0); ++ cws[2 * i + 1] = new Complex(w >>> 13, 0); ++ } ++ return cws; ++} ++ + BN.prototype.mulTo = function mulTo(num, out) { + var res; +- if (this.length + num.length < 63) +- res = this._smallMulTo(num, out); +- else ++ //if (this.length + num.length < 63) ++ // res = this._smallMulTo(num, out); ++ //else + res = this._bigMulTo(num, out); ++ // res = this._bigMulToF(num, out); + return res; + }; + ++BN.prototype.mulToF = function mulToF(num, out) { ++ var res; ++ //if (this.length + num.length < 63) ++ // res = this._smallMulTo(num, out); ++ //else ++ res = this._bigMulToF(num, out); ++ return res; ++}; ++ ++BN.prototype._bigMulToF = function _bigMulToF(num, out) { ++ out.sign = num.sign !== this.sign; ++ out.length = this.length + num.length; ++ ++ var N = 2 * _guess(this.length, num.length); ++ ++ var w = new Complex(Math.cos(2 * π / N), Math.sin(2 * π / N)); ++ ++ //console.log("-- W -- ", w); ++ ++ var thisWFT = new Array(N), ++ numWFT = new Array(N), ++ //multWFT = new Array(N), ++ multW = new Array(N); ++ ++ //console.log("A, B: ", this, num); ++ ++ _FFT(_iconvertToC(this.words, N), 0, 0, thisWFT, 0, w, N); ++ _FFT(_iconvertToC(num.words, N), 0, 0, numWFT, 0, w, N); ++ ++ for (var i = 0; i < N; ++i) { ++ //multWFT[i] = thisWFT[i].mul(numWFT[i]); ++ thisWFT[i].imul(numWFT[i]); ++ } ++ ++ //console.log("-- MULF -- ", multWFT); ++ ++ //_FFT(_iconjugate(multWFT, N), 0, 0, multW, 0, w, N); ++ _FFT(_iconjugate(thisWFT, N), 0, 0, multW, 0, w, N); ++ ++ //console.log(multW); ++ ++ multW = _inormalize(_iconjugate(multW, N), N); ++ ++ out.words = multW; ++ ++ //console.log("-- MUL -- ", multW); ++ ++ return out.strip(); ++}; ++ + // Multiply `this` by `num` + BN.prototype.mul = function mul(num) { + var out = new BN(null); +@@ -899,6 +1154,14 @@ BN.prototype.mul = function mul(num) { + return this.mulTo(num, out); + }; + ++// Multiply employing FFT ++BN.prototype.mulf = function mulf(num) { ++ var out = new BN(null); ++ //out.words = new Array(this.length + num.length); ++ out.words = null; ++ return this.mulToF(num, out); ++}; ++ + // In-place Multiplication + BN.prototype.imul = function imul(num) { + if (this.cmpn(0) === 0 || num.cmpn(0) === 0) { + +From 21f40777824dfdc61c93a009e82c25c30d0615ed Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Fri, 12 Dec 2014 00:25:08 +0300 +Subject: [PATCH 02/12] Continuous probing + +--- + benchmarks/index.js | 78 +++++++++++ + lib/bn.js | 378 ++++++++++++++++++++++++++++++++++++++++++++++++++-- + test/_fft.js | 43 ++++++ + 3 files changed, 486 insertions(+), 13 deletions(-) + create mode 100644 test/_fft.js + +diff --git a/benchmarks/index.js b/benchmarks/index.js +index b8cb23d..64b61d9 100644 +--- a/benchmarks/index.js ++++ b/benchmarks/index.js +@@ -59,6 +59,72 @@ if (/fast/i.test(process.argv[3])) { + var a1 = new bn('012345678901234567890123456789012345678901234567890', 10); + var b1 = new bn('213509123601923760129376102397651203958123402314875', 10); + ++var a1x = new bn( 'a899c59999bf877d96442d284359783bdc64b5f878b688fe' + ++ '51407f0526e616553ad0aaaac4d5bed3046f10a1faaf42bb' + ++ '2342dc4b7908eea0c46e4c4576897675c2bfdc4467870d3d' + ++ 'cd90adaed4359237a4bc6924bfb99aa6bf5f5ede15b574ea' + ++ 'e977eac096f3c67d09bda574c6306c6123fa89d2f086b8dc' + ++ 'ff92bc570c18d83fe6c810ccfd22ce4c749ef5e6ead3fffe' + ++ 'c63d95e0e3fde1df9db6a35fa1d107058f37e41957769199' + ++ 'd945dd7a373622c65f0af3fd9eb1ddc5c764bbfaf7a3dc37' + ++ '2548e683b970dac4aa4b9869080d2376c9adecebb84e172c' + ++ '09aeeb25fb8df23e60033260c4f8aac6b8b98ab894b1fb84' + ++ 'ebb83c0fb2081c3f3eee07f44e24d8fabf76f19ed167b0d7' + ++ 'ff971565aa4efa3625fce5a43ceeaa3eebb3ce88a00f597f' + ++ '048c69292b38dba2103ecdd5ec4ccfe3b2d87fa6202f334b' + ++ 'c1cab83b608dfc875b650b69f2c7e23c0b2b4adf149a6100' + ++ 'db1b6dbad4679ecb1ea95eafaba3bd00db11c2134f5a8686' + ++ '358b8b2ab49a1b2e85e1e45caeac5cd4dc0b3b5fffba8871' + ++ '1c6baf399edd48dad5e5c313702737a6dbdcede80ca358e5' + ++ '1d1c4fe42e8948a084403f61baed38aa9a1a5ce2918e9f33' + ++ '100050a430b47bc592995606440272a4994677577a6aaa1b' + ++ 'a101045dbec5a4e9566dab5445d1af3ed19519f07ac4e2a8' + ++ 'bd0a84b01978f203a9125a0be020f71fab56c2c9e344d4f4' + ++ '12d53d3cd8eb74ca5122002e931e3cb0bd4b7492436be17a' + ++ 'd7ebe27148671f59432c36d8c56eb762655711cfc8471f70' + ++ '83a8b7283bcb3b1b1d47d37c23d030288cfcef05fbdb4e16' + ++ '652ee03ee7b77056a808cd700bc3d9ef826eca9a59be959c' + ++ '947c865d6b372a1ca2d503d7df6d7611b12111665438475a' + ++ '1c64145849b3da8c2d343410df892d958db232617f9896f1' + ++ 'de95b8b5a47132be80dd65298c7f2047858409bf762dbc05' + ++ 'a62ca392ac40cfb8201a0607a2cae07d99a307625f2b2d04' + ++ 'fe83fbd3ab53602263410f143b73d5b46fc761882e78c782' + ++ 'd2c36e716a770a7aefaf7f76cea872db7bffefdbc4c2f9e0' + ++ '39c19adac915e7a63dcb8c8c78c113f29a3e0bc10e100ce0', 16); ++ ++var b1x = new bn( '3bf836229c7dd874fe37c1790d201e82ed8e192ed61571ca' + ++ '7285264974eb2a0171f3747b2fc23969a916cbd21e14f7e2' + ++ 'f0d72dcd2247affba926f9e7bb99944cb5609aed85e71b89' + ++ 'e89d2651550cb5bd8281bd3144066af78f194032aa777739' + ++ 'cccb7862a1af401f99f7e5c693f25ddce2dedd9686633820' + ++ 'd28d0f5ed0c6b5a094f5fe6170b8e2cbc9dff118398baee6' + ++ 'e895a6301cb6e881b3cae749a5bdf5c56fc897ff68bc73f2' + ++ '4811bb108b882872bade1f147d886a415cda2b93dd90190c' + ++ 'be5c2dd53fe78add5960e97f58ff2506afe437f4cf4c912a' + ++ '397c1a2139ac6207d3ab76e6b7ffd23bb6866dd7f87a9ae5' + ++ '578789084ff2d06ea0d30156d7a10496e8ebe094f5703539' + ++ '730f5fdbebc066de417be82c99c7da59953071f49da7878d' + ++ 'a588775ff2a7f0084de390f009f372af75cdeba292b08ea8' + ++ '4bd13a87e1ca678f9ad148145f7cef3620d69a891be46fbb' + ++ 'cad858e2401ec0fd72abdea2f643e6d0197b7646fbb83220' + ++ '0f4cf7a7f6a7559f9fb0d0f1680822af9dbd8dec4cd1b5e1' + ++ '7bc799e902d9fe746ddf41da3b7020350d3600347398999a' + ++ 'baf75d53e03ad2ee17de8a2032f1008c6c2e6618b62f225b' + ++ 'a2f350179445debe68500fcbb6cae970a9920e321b468b74' + ++ '5fb524fb88abbcacdca121d737c44d30724227a99745c209' + ++ 'b970d1ff93bbc9f28b01b4e714d6c9cbd9ea032d4e964d8e' + ++ '8fff01db095160c20b7646d9fcd314c4bc11bcc232aeccc0' + ++ 'fbedccbc786951025597522eef283e3f56b44561a0765783' + ++ '420128638c257e54b972a76e4261892d81222b3e2039c61a' + ++ 'ab8408fcaac3d634f848ab3ee65ea1bd13c6cd75d2e78060' + ++ 'e13cf67fbef8de66d2049e26c0541c679fff3e6afc290efe' + ++ '875c213df9678e4a7ec484bc87dae5f0a1c26d7583e38941' + ++ 'b7c68b004d4df8b004b666f9448aac1cc3ea21461f41ea5d' + ++ 'd0f7a9e6161cfe0f58bcfd304bdc11d78c2e9d542e86c0b5' + ++ '6985cc83f693f686eaac17411a8247bf62f5ccc7782349b5' + ++ 'cc1f20e312fa2acc0197154d1bfee507e8db77e8f2732f2d' + ++ '641440ccf248e8643b2bd1e1f9e8239356ab91098fcb431d', 16); ++ + var a2 = new bignum('012345678901234567890123456789012345678901234567890', 10); + var b2 = new bignum('213509123601923760129376102397651203958123402314875', 10); + +@@ -205,6 +271,9 @@ add('mul', { + 'bn.js': function() { + a1.mul(b1); + }, ++ 'bn.js[FFT]': function() { ++ a1.mulf(b1); ++ } + 'bignum': function() { + a2.mul(b2); + }, +@@ -222,6 +291,15 @@ add('mul', { + } + }); + ++add('mul-jumbo', { ++ 'bn.js': function() { ++ a1x.mul(b1x); ++ }, ++ 'bn.js[FFT]': function() { ++ a1x.mulf(b1x); ++ } ++}); ++ + add('sqr', { + 'bn.js': function() { + a1.mul(a1); +diff --git a/lib/bn.js b/lib/bn.js +index 9b9b857..c803573 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -958,16 +958,14 @@ Complex.prototype.isub = _isubC; + Complex.prototype.iconj = _iconjC; + Complex.prototype.clone = _cloneC; + +-Complex.prototype._isZero = function (v) { +- return Math.abs(v) < 1.e-12; +-} ++//Complex.prototype._isZero = function (v) { ++// return Math.abs(v) < 1.e-12; ++//} + +-Complex.prototype._norm = function () { ++//Complex.prototype._norm = function () { + //if (this._isZero(this.r)) this.r = 0; + //if (this._isZero(this.i)) this.i = 0; +-} +- +-Complex.ZERO = new Complex(0, 0); ++//} + + // _FFT(this.words, thisWFT, w, N, 0); + function _FFT(ws, p, s, tws, tp, r, N) { +@@ -1003,6 +1001,11 @@ function _FFT(ws, p, s, tws, tp, r, N) { + tws[tp + i] = e.add(o); + tws[tp + i + hN] = e.sub(o); + ++ //console.log(tws); ++ ++ assert(tws[tp + i].r < (0x4000000 * 0x4000000 * 2)) ++ assert(tws[tp + i + hN].r < (0x4000000 * 0x4000000 * 2)) ++ + r_.imul(r); + + //console.log("tws | ", tws) +@@ -1010,6 +1013,63 @@ function _FFT(ws, p, s, tws, tp, r, N) { + } + } + ++ ++function _FFTL(ws, p, s, tws, tp, r, N) { ++ //if (N === 1) { ++ // tws[tp] = ws[p]; ++ // //console.log("p/tp/ws/tws :", p, tp, ws, tws); ++ //} else { ++ // var hN = N / 2 >> 0; ++ // ++ // var rr = r.mul(r); ++ // ++ // var s_ = 2 * s + 1; ++ // ++ // //console.log("-- FFT -- # ", N); ++ // //console.log("-- R -- ", r); ++ // ++ // //console.log("-- RR -- # ", rr); ++ // ++ // _FFT(ws, p, s_, tws, tp, rr, hN); // even ++ // _FFT(ws, p + s + 1, s_, tws, tp + hN, rr, hN); // odd ++ // ++ // var r_ = r.clone(); ++ // ++ // for (var i = 0; i < hN; ++i) { ++ // var e = tws[tp + i]; ++ // var o = tws[tp + i + hN].clone(); ++ // ++ // //console.log("tp + i, tp + i + hN, tws | ", tp + i, tp + i + hN, tws) ++ // //console.log("r_, o, e, (o * r_)", r_, o, e, o.mul(r_)); ++ // ++ // o.imul(r_); ++ // ++ // tws[tp + i] = e.add(o); ++ // tws[tp + i + hN] = e.sub(o); ++ // ++ // r_.imul(r); ++ // ++ // //console.log("tws | ", tws) ++ // } ++ //} ++ ++ var hN = N / 2 >> 0; ++ ++ for (var i = 0; i < hN; i++) { ++ tws[2 * i] = ws[i]; ++ tws[2 * i + 1] = ws[i + hN]; ++ } ++ ++ var p = 0; ++ ++ for (var l = 1; l < N + 1; l << 1, p = 0) { ++ for (var j = p; j < p + l; ++j, p += l) { ++ var e = tws[j]; ++ var o = tws[j + l].clone(); ++ } ++ } ++} ++ + var π = 3.14159265359; + + function _guess(n, m) { +@@ -1037,7 +1097,7 @@ function _iconjugate(ws, N) { + return ws; + } + +-function _inormalize(ws, N) { ++function _inormalize13(ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; ++i) { + +@@ -1051,8 +1111,11 @@ function _inormalize(ws, N) { + // assert((Math.round(ws[2 * i + 1].r / N) << 13) === (Math.round(ws[2 * i + 1].r / N) * 0x2000), "WAAAAAT"); + //} + +- + //assert(Math.abs(ws[2 * i].i) < N && Math.abs(ws[2 * i + 1].i) < N) ++ // ++ //var n = (Math.round(ws[2 * i + 1].r / N) * 0x2000) ++ // + Math.round(ws[2 * i].r / N) ++ // + carry; + + var n = (Math.round(ws[2 * i + 1].r / N) * 0x2000) + + Math.round(ws[2 * i].r / N) +@@ -1076,7 +1139,170 @@ function _inormalize(ws, N) { + return ws; + } + +-function _iconvertToC(ws, N) { ++function _inormalize20(ws, N) { ++ ++ var carry = 0; ++ var seek = 0; ++ ++ for (var j = 0; j < N; ++j) { ++ ws[j] = Math.round(ws[j].r / N); ++ } ++ ++ for (var i = 0; i < N; ++i) { ++ //var w = (((ws[2 * i + 1].r / N + .5) >> 0) << 13) ++ // + ((ws[2 * i].r / N + .5) >> 0) ++ // + carry; ++ ++ //if ((Math.round(ws[2 * i + 1].r / N) << 13) !== (Math.round(ws[2 * i + 1].r / N) * 0x2000)) { ++ // console.log(1 << 13, 1 * 0x2000); ++ // console.log(Math.round(ws[2 * i + 1].r / N), ((Math.round(ws[2 * i + 1].r / N)) << 7), (Math.round(ws[2 * i + 1].r / N) * 0x2000)); ++ // assert((Math.round(ws[2 * i + 1].r / N) << 13) === (Math.round(ws[2 * i + 1].r / N) * 0x2000), "WAAAAAT"); ++ //} ++ ++ //assert(Math.abs(ws[2 * i].i) < N && Math.abs(ws[2 * i + 1].i) < N) ++ ++ //var w = ws[i]; ++ // ++ //assert(w < (0x4000000 * 0x4000000)) ++ // ++ //console.log("Before ", w, w & 0x3ffffff, carry); ++ // ++ //if (i + 1 < N) { ++ // w += ((ws[i + 1] + 0.5) & 0x3ffffff) * 0x100000; ++ // ++ // ws[i + 1] &= 0x4000000; ++ //} ++ // ++ //w += carry; ++ // ++ //ws[i] = w & 0x3ffffff; ++ // ++ //carry = Math.floor(w / 0x4000000); ++ // ++ //console.log("After ", w, w & 0x3ffffff, carry); ++ ++ var w = ws[i]; ++ ++ //console.log(w, carry, (w & 0x3ffffff)); ++ ++ var j = i; ++ ++ //if (w < 0x4000000) ++ { ++ var pseek = seek; ++ seek += 26 - 20; ++ ++ if (seek > 20) { ++ if (i < N - 1) { ++ w += ws[i + 1] * 0x100000 / (1 << pseek) ++ ++ // !!! ++ ++i; ++ ++ seek -= 20; ++ ++ var d = 1 << seek; ++ ++ w += (ws[i + 1] & (d - 1)) * (1 << 26 - seek); ++ ws[i + 1] /= d; ++ } ++ } ++ else ++ { ++ var pd = 1 << (pseek); ++ var d = 1 << (seek); ++ ++ //console.log("D, W, WS[i+1]x ", d, w, (ws[i + 1] & (d - 1)) * 0x100000 / pd) ++ ++ w += (ws[i + 1] & (d - 1)) * 0x100000 / pd; ++ ws[i + 1] /= d; ++ } ++ } ++ ++ //console.log(w, w & 0x3ffffff, carry) ++ ++ assert(w < 0x4000000 * 0x4000000) ++ assert(carry < 0x4000000 * 0x4000000) ++ ++ w += carry; ++ ++ //console.log(w, w & 0x3ffffff, carry) ++ ++ ws[j] = w & 0x3ffffff; ++ ++ carry = Math.floor(w / 0x4000000); ++ } ++ ++ return ws; ++} ++ ++function _inormalize18(ws, N) { ++ ++ var carry = 0; ++ var seek = 0; ++ ++ for (var j = 0; j < N; ++j) { ++ ws[j] = Math.round(ws[j].r / N); ++ } ++ ++ for (var i = 0; i < N; ++i) { ++ var w = ws[i]; ++ ++ //console.log(w, carry, (w & 0x3ffffff)); ++ ++ var j = i; ++ ++ //if (w < 0x4000000) ++ { ++ var pseek = seek; ++ seek += 26 - 18; ++ ++ if (seek > 18) { ++ if (i < N - 1) { ++ w += ws[i + 1] * 0x40000 / (1 << pseek) ++ ++ // !!! ++ ++i; ++ ++ seek -= 18; ++ ++ var d = 1 << seek; ++ ++ w += (ws[i + 1] & (d - 1)) * (1 << 26 - seek); ++ ws[i + 1] /= d; ++ } ++ } ++ else ++ { ++ var pd = 1 << (pseek); ++ var d = 1 << (seek); ++ ++ //console.log("D, W, WS[i+1]x ", d, w, (ws[i + 1] & (d - 1)) * 0x100000 / pd) ++ ++ w += (ws[i + 1] & (d - 1)) * 0x40000 / pd; ++ ws[i + 1] /= d; ++ } ++ } ++ ++ //console.log(w, w & 0x3ffffff, carry) ++ ++ assert(w < 0x4000000 * 0x4000000) ++ assert(carry < 0x4000000 * 0x4000000) ++ ++ w += carry; ++ ++ //console.log(w, w & 0x3ffffff, carry) ++ ++ ws[j] = w & 0x3ffffff; ++ ++ carry = Math.floor(w / 0x4000000); ++ } ++ ++ return ws; ++} ++ ++ ++function _iconvertToC13(ws, N) { + var cws = new Array(N); + for (var i = 0; i < N / 2; i++) { + var w = ws[i] || 0; +@@ -1087,6 +1313,125 @@ function _iconvertToC(ws, N) { + return cws; + } + ++function _iconvertToC20(ws, N) { ++ var cws = new Array(N); ++ ++ for (var i = 0, j = 0, seek = 20; i < N; ++i) { ++ var w = ws[i] || 0; ++ var l = 26; ++ ++ while (l > 0) { ++ cws[j] = cws[j] || 0; ++ ++ if (seek >= l) { ++ cws[j] += w << (20 - seek); ++ ++ seek -= l; ++ if (seek === 0) seek = 20; ++ l = 0; ++ } else { ++ cws[j] += (w & ((1 << seek) - 1)) << (20 - seek); ++ w /= 1 << seek; ++ ++ ++j; ++ l -= seek; ++ seek = 20; ++ } ++ } ++ } ++ ++ for (i = 0; i < N; ++i) { ++ cws[i] = new Complex(cws[i], 0); ++ } ++ ++ return cws; ++} ++ ++function _iconvertToC18(ws, N) { ++ var cws = new Array(N); ++ ++ for (var i = 0, j = 0, seek = 18; i < N; ++i) { ++ var w = ws[i] || 0; ++ var l = 26; ++ ++ while (l > 0) { ++ cws[j] = cws[j] || 0; ++ ++ if (seek >= l) { ++ cws[j] += w << (18 - seek); ++ ++ seek -= l; ++ if (seek === 0) seek = 18; ++ l = 0; ++ } else { ++ cws[j] += (w & ((1 << seek) - 1)) << (18 - seek); ++ w /= 1 << seek; ++ ++ ++j; ++ l -= seek; ++ seek = 18; ++ } ++ } ++ } ++ ++ for (i = 0; i < N; ++i) { ++ cws[i] = new Complex(cws[i], 0); ++ } ++ ++ return cws; ++} ++ ++function _iconvertTo13(ws, N) { ++ var cws = new Array(N); ++ var carry = 0; ++ ++ var i = 0; ++ for (i = 0; i < N; ++i) { ++ ws[i] = Math.round(ws[i].r / N); ++ } ++ ++ i = 0; ++ for (var j = 0; true; ++j) { ++ ++ if (carry < 0x2000) { ++ if (i === N) ++ break; ++ ++ carry += ws[i]; ++ i++; ++ } ++ ++ var lo = carry & 0x1fff; // Here we don't care about overflow, since ++ // since overflow may only "screw" (trim) high-order ++ // bits, while we're particularly interested in low-order ones ++ ++ //console.log(carry, lo) ++ ++ carry = carry / 0x2000; // Since shift would trigger conversion from ++ // float (64) to int (32) ++ ++ cws[j] = lo; ++ } ++ ++ //for (var i = 0; i < N; i++) { ++ // carry += Math.round(ws[i].r / N); ++ // ++ // ++ // var lo = carry & 0x1fff; // Here we don't care about overflow, since ++ // // since overflow may only "screw" (trim) high-order ++ // // bits, while we're particularly interested in low-order ones ++ // ++ // console.log(carry, lo) ++ // ++ // carry = carry / 0x2000; // Since shift would trigger conversion from ++ // // float (64) to int (32) ++ // ++ // cws[i] = lo; ++ //} ++ ++ return cws; ++} ++ + BN.prototype.mulTo = function mulTo(num, out) { + var res; + //if (this.length + num.length < 63) +@@ -1111,6 +1456,7 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + out.length = this.length + num.length; + + var N = 2 * _guess(this.length, num.length); ++ //var N = _guess(this.length * 1.3, num.length * 1.3); + + var w = new Complex(Math.cos(2 * π / N), Math.sin(2 * π / N)); + +@@ -1123,8 +1469,12 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + + //console.log("A, B: ", this, num); + +- _FFT(_iconvertToC(this.words, N), 0, 0, thisWFT, 0, w, N); +- _FFT(_iconvertToC(num.words, N), 0, 0, numWFT, 0, w, N); ++ _FFT(_iconvertToC13(this.words, N), 0, 0, thisWFT, 0, w, N); ++ _FFT(_iconvertToC13(num.words, N), 0, 0, numWFT, 0, w, N); ++ //_FFT(_iconvertToC20(this.words, N), 0, 0, thisWFT, 0, w, N); ++ //_FFT(_iconvertToC20(num.words, N), 0, 0, numWFT, 0, w, N); ++ //_FFT(_iconvertToC18(this.words, N), 0, 0, thisWFT, 0, w, N); ++ //_FFT(_iconvertToC18(num.words, N), 0, 0, numWFT, 0, w, N); + + for (var i = 0; i < N; ++i) { + //multWFT[i] = thisWFT[i].mul(numWFT[i]); +@@ -1138,7 +1488,9 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + + //console.log(multW); + +- multW = _inormalize(_iconjugate(multW, N), N); ++ multW = _inormalize13(_iconjugate(multW, N), N); ++ //multW = _inormalize20(_iconjugate(multW, N), N); ++ //multW = _inormalize18(_iconjugate(multW, N), N); + + out.words = multW; + +diff --git a/test/_fft.js b/test/_fft.js +new file mode 100644 +index 0000000..78c5233 +--- /dev/null ++++ b/test/_fft.js +@@ -0,0 +1,43 @@ ++var BN = require("../lib/bn.js").BN ++var fixtures = require("./fixtures.js") ++ ++//var a = new BN("1"); ++//var b = new BN("1"); ++ ++//var a = new BN("123"); ++//var b = new BN("123"); ++ ++//var a = new BN("123456"); ++//var b = new BN("123456"); ++ ++//var a = new BN("12345690"); ++//var b = new BN("1234560"); ++ ++//var a = new BN("123456900"); ++//var b = new BN("12345601"); ++ ++//var a = new BN("123456789"); ++//var b = new BN("123456780"); ++ ++//var a = new BN("123456789"); ++//var b = new BN("123456789"); ++ ++//var a = new BN( ++// '13f29a3e0bc10e100ce0', 16); ++//var b = a.clone(); ++ ++ ++var a = new BN(fixtures.dhGroups.p17.q, 16); ++var b = a.clone(); ++var qs = fixtures.dhGroups.p17.qs; ++ ++var c = a.mulf(b); ++var c_ = a.mul(b); ++ ++//console.log(c.words); ++console.log(c); ++console.log("------") ++//console.log(c_.words); ++console.log(c_); ++ ++//assert(c === new BN(2)) + +From 47297ab0ccfc9e66b37dd53a86b7fcb09c17db63 Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Sun, 14 Dec 2014 19:51:28 +0300 +Subject: [PATCH 03/12] Unrolled recursion + +--- + lib/bn.js | 141 +++++++++++++++++++++++++++++++++++------------------------ + test/_fft.js | 10 ++++- + 2 files changed, 93 insertions(+), 58 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index c803573..d173a6d 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -1003,8 +1003,8 @@ function _FFT(ws, p, s, tws, tp, r, N) { + + //console.log(tws); + +- assert(tws[tp + i].r < (0x4000000 * 0x4000000 * 2)) +- assert(tws[tp + i + hN].r < (0x4000000 * 0x4000000 * 2)) ++ //assert(tws[tp + i].r < (0x4000000 * 0x4000000 * 2)) ++ //assert(tws[tp + i + hN].r < (0x4000000 * 0x4000000 * 2)) + + r_.imul(r); + +@@ -1013,73 +1013,98 @@ function _FFT(ws, p, s, tws, tp, r, N) { + } + } + ++var π = 3.14159265359; + +-function _FFTL(ws, p, s, tws, tp, r, N) { +- //if (N === 1) { +- // tws[tp] = ws[p]; +- // //console.log("p/tp/ws/tws :", p, tp, ws, tws); +- //} else { +- // var hN = N / 2 >> 0; +- // +- // var rr = r.mul(r); +- // +- // var s_ = 2 * s + 1; +- // +- // //console.log("-- FFT -- # ", N); +- // //console.log("-- R -- ", r); +- // +- // //console.log("-- RR -- # ", rr); +- // +- // _FFT(ws, p, s_, tws, tp, rr, hN); // even +- // _FFT(ws, p + s + 1, s_, tws, tp + hN, rr, hN); // odd +- // +- // var r_ = r.clone(); +- // +- // for (var i = 0; i < hN; ++i) { +- // var e = tws[tp + i]; +- // var o = tws[tp + i + hN].clone(); +- // +- // //console.log("tp + i, tp + i + hN, tws | ", tp + i, tp + i + hN, tws) +- // //console.log("r_, o, e, (o * r_)", r_, o, e, o.mul(r_)); +- // +- // o.imul(r_); +- // +- // tws[tp + i] = e.add(o); +- // tws[tp + i + hN] = e.sub(o); +- // +- // r_.imul(r); +- // +- // //console.log("tws | ", tws) +- // } ++ ++function _FFTL(ws, _, __, tws, ___, ____, N, rbt) { ++ //var hN = N / 2 >> 0; ++ ++ //for (var j = 0; j < 2; ++j) ++ //for (var i = 0, hhN = hN >> 1, dN = hN; i < hhN; ++i, dN >>= 1) { ++ // tws[2 * i] = ws[dN + j]; ++ // tws[2 * i + 1] = ws[dN + j + ]; + //} + +- var hN = N / 2 >> 0; ++ //console.log("XXXXX") ++ //console.log("WS, TWS", ws, tws) + +- for (var i = 0; i < hN; i++) { +- tws[2 * i] = ws[i]; +- tws[2 * i + 1] = ws[i + hN]; +- } ++ _permuteTo(rbt, ws, tws, N); ++ ++ var hN = N >>> 1; ++ ++ for (var s = 1; s < N; s <<= 1) { ++ var l = s << 1; ++ var r = new Complex(Math.cos(2 * π / l), Math.sin(2 * π / l)); ++ ++ for (var p = 0; p < N; p += l) { ++ var r_ = r.clone(); ++ ++ for (var j = 0; j < s; ++j) { ++ var e = tws[p + j]; ++ var o = tws[p + j + s].clone(); ++ ++ o.imul(r_); + +- var p = 0; ++ tws[p + j] = e.add(o); ++ tws[p + j + s] = e.sub(o) + +- for (var l = 1; l < N + 1; l << 1, p = 0) { +- for (var j = p; j < p + l; ++j, p += l) { +- var e = tws[j]; +- var o = tws[j + l].clone(); ++ //assert(tws[p + j].r < (0x4000000 * 0x4000000 * 2)) ++ //assert(tws[p + j + s].r < (0x4000000 * 0x4000000 * 2)) ++ ++ if (j !== l) r_.imul(r); ++ } + } ++ ++ //console.log(tws) + } + } + +-var π = 3.14159265359; ++function _makeRBT(N) { ++ var t = new Array(N); ++ var l = (Math.log(N) / Math.log(2)) >> 0; ++ for (var i = 0; i < N; ++i) { ++ t[i] = _revbin(i, l, N); ++ } ++ ++ return t; ++} ++ ++function _permuteTo(rbt, ws, tws, N) { ++ //var l = (Math.log(N) / Math.log(2)) >> 0; ++ for (var i = 0; i < N; ++i) { ++ //var r = _revbin(i, l, N); ++ //console.log("REVBIN: ", i, r) ++ //if (r > i) { ++ // var t = ws[i]; ++ // ws[i] = ws[r]; ++ // ws[r] = t; ++ //} ++ tws[i] = ws[rbt[i]]; ++ } ++} ++ ++function _revbin(x, l, N) { ++ if (x === 0 || x === N - 1) ++ return x; ++ ++ var rb = 0; ++ for (var i = 0; i < l; ++i) { ++ rb |= (x & 1) << (l - i - 1); ++ x >>= 1; ++ } ++ ++ return rb; ++} ++ + + function _guess(n, m) { +- var N = (n < m ? n : m) | 1, odd = N & 1; ++ var N = Math.max(m, n) | 1, odd = N & 1; + var i = 0; +- for (; N; N = N / 2 >> 0) { ++ while (N = N / 2 >> 0) { + i++; + } + +- return (1 << i + odd) ++ return (1 << i + 1 + odd) + } + + function _iconjugate(ws, N) { +@@ -1469,8 +1494,12 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + + //console.log("A, B: ", this, num); + +- _FFT(_iconvertToC13(this.words, N), 0, 0, thisWFT, 0, w, N); +- _FFT(_iconvertToC13(num.words, N), 0, 0, numWFT, 0, w, N); ++ var rbt = _makeRBT(N); ++ ++ //_FFT(_iconvertToC13(this.words, N), 0, 0, thisWFT, 0, w, N); ++ //_FFT(_iconvertToC13(num.words, N), 0, 0, numWFT, 0, w, N); ++ _FFTL(_iconvertToC13(this.words, N), 0, 0, thisWFT, 0, w, N, rbt); ++ _FFTL(_iconvertToC13(num.words, N), 0, 0, numWFT, 0, w, N, rbt); + //_FFT(_iconvertToC20(this.words, N), 0, 0, thisWFT, 0, w, N); + //_FFT(_iconvertToC20(num.words, N), 0, 0, numWFT, 0, w, N); + //_FFT(_iconvertToC18(this.words, N), 0, 0, thisWFT, 0, w, N); +@@ -1484,7 +1513,7 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + //console.log("-- MULF -- ", multWFT); + + //_FFT(_iconjugate(multWFT, N), 0, 0, multW, 0, w, N); +- _FFT(_iconjugate(thisWFT, N), 0, 0, multW, 0, w, N); ++ _FFTL(_iconjugate(thisWFT, N), 0, 0, multW, 0, w, N, rbt); + + //console.log(multW); + +diff --git a/test/_fft.js b/test/_fft.js +index 78c5233..40237ed 100644 +--- a/test/_fft.js ++++ b/test/_fft.js +@@ -4,9 +4,15 @@ var fixtures = require("./fixtures.js") + //var a = new BN("1"); + //var b = new BN("1"); + ++//var a = new BN("2"); ++//var b = new BN("13"); ++ + //var a = new BN("123"); + //var b = new BN("123"); + ++//var a = new BN("12345"); ++//var b = new BN("1"); ++ + //var a = new BN("123456"); + //var b = new BN("123456"); + +@@ -16,8 +22,8 @@ var fixtures = require("./fixtures.js") + //var a = new BN("123456900"); + //var b = new BN("12345601"); + +-//var a = new BN("123456789"); +-//var b = new BN("123456780"); ++//var a = new BN("0x2000", 16); ++//var b = new BN("12345678"); + + //var a = new BN("123456789"); + //var b = new BN("123456789"); + +From c5570b41d7b8b4b72439ea4a5e1100b715b55d2e Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Sun, 14 Dec 2014 21:04:28 +0300 +Subject: [PATCH 04/12] Remastered FFT to purge any object creation (except + arrays) + +--- + lib/bn.js | 299 ++++++++++++++++++++++++++++++++++++++++++++++---------------- + 1 file changed, 221 insertions(+), 78 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index d173a6d..460a3bd 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -1016,7 +1016,7 @@ function _FFT(ws, p, s, tws, tp, r, N) { + var π = 3.14159265359; + + +-function _FFTL(ws, _, __, tws, ___, ____, N, rbt) { ++function _FFTL(rws, iws, _, __, rtws, itws, ___, ____, N, rbt) { + //var hN = N / 2 >> 0; + + //for (var j = 0; j < 2; ++j) +@@ -1028,30 +1028,57 @@ function _FFTL(ws, _, __, tws, ___, ____, N, rbt) { + //console.log("XXXXX") + //console.log("WS, TWS", ws, tws) + +- _permuteTo(rbt, ws, tws, N); +- +- var hN = N >>> 1; ++ _permuteTo(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; +- var r = new Complex(Math.cos(2 * π / l), Math.sin(2 * π / l)); ++ ++ var rtwdf = Math.cos(2 * π / l); ++ var itwdf = Math.sin(2 * π / l); + + for (var p = 0; p < N; p += l) { +- var r_ = r.clone(); ++ var rtwdf_ = rtwdf; ++ var itwdf_ = itwdf; + + for (var j = 0; j < s; ++j) { +- var e = tws[p + j]; +- var o = tws[p + j + s].clone(); + +- o.imul(r_); ++ //var e = tws[p + j]; ++ ++ var re = rtws[p + j]; ++ var ie = itws[p + j]; ++ ++ //var o = tws[p + j + s].clone(); ++ ++ var ro = rtws[p + j + s]; ++ var io = itws[p + j + s]; ++ ++ //o.imul(r_); ++ ++ var rx = rtwdf_ * ro - itwdf_ * io; ++ ++ io = rtwdf_ * io + itwdf_ * ro; ++ ro = rx; + +- tws[p + j] = e.add(o); +- tws[p + j + s] = e.sub(o) ++ //tws[p + j] = e.add(o); ++ ++ rtws[p + j] = re + ro; ++ itws[p + j] = ie + io; ++ ++ //tws[p + j + s] = e.sub(o) ++ ++ rtws[p + j + s] = re - ro; ++ itws[p + j + s] = ie - io; + + //assert(tws[p + j].r < (0x4000000 * 0x4000000 * 2)) + //assert(tws[p + j + s].r < (0x4000000 * 0x4000000 * 2)) + +- if (j !== l) r_.imul(r); ++ if (j !== l) { ++ //r_.imul(r); ++ var rx = rtwdf * rtwdf_ - itwdf * itwdf_; ++ ++ itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; ++ rtwdf_ = rx; ++ } + } + } + +@@ -1060,7 +1087,7 @@ function _FFTL(ws, _, __, tws, ___, ____, N, rbt) { + } + + function _makeRBT(N) { +- var t = new Array(N); ++ var t = new Int32Array(N); + var l = (Math.log(N) / Math.log(2)) >> 0; + for (var i = 0; i < N; ++i) { + t[i] = _revbin(i, l, N); +@@ -1069,7 +1096,7 @@ function _makeRBT(N) { + return t; + } + +-function _permuteTo(rbt, ws, tws, N) { ++function _permuteTo(rbt, rws, iws, rtws, itws, N) { + //var l = (Math.log(N) / Math.log(2)) >> 0; + for (var i = 0; i < N; ++i) { + //var r = _revbin(i, l, N); +@@ -1079,7 +1106,8 @@ function _permuteTo(rbt, ws, tws, N) { + // ws[i] = ws[r]; + // ws[r] = t; + //} +- tws[i] = ws[rbt[i]]; ++ rtws[i] = rws[rbt[i]]; ++ itws[i] = iws[rbt[i]]; + } + } + +@@ -1122,6 +1150,22 @@ function _iconjugate(ws, N) { + return ws; + } + ++function _iconjugateX(rws, iws, N) { ++ if (N > 1) { ++ for (var i = 0; i < N / 2; ++i) { ++ var t = rws[i]; ++ ++ rws[i] = rws[N - i - 1]; ++ rws[N - i - 1] = t; ++ ++ t = iws[i]; ++ ++ iws[i] = -iws[N - i - 1]; ++ iws[N - i - 1] = -t; ++ } ++ } ++} ++ + function _inormalize13(ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; ++i) { +@@ -1164,6 +1208,49 @@ function _inormalize13(ws, N) { + return ws; + } + ++ ++function _inormalize13X(ws, N) { ++ var carry = 0; ++ for (var i = 0; i < N / 2; ++i) { ++ ++ //var n = (((ws[2 * i + 1].r / N + .5) >> 0) << 13) ++ // + ((ws[2 * i].r / N + .5) >> 0) ++ // + carry; ++ ++ //if ((Math.round(ws[2 * i + 1].r / N) << 13) !== (Math.round(ws[2 * i + 1].r / N) * 0x2000)) { ++ // console.log(1 << 13, 1 * 0x2000); ++ // console.log(Math.round(ws[2 * i + 1].r / N), ((Math.round(ws[2 * i + 1].r / N)) << 7), (Math.round(ws[2 * i + 1].r / N) * 0x2000)); ++ // assert((Math.round(ws[2 * i + 1].r / N) << 13) === (Math.round(ws[2 * i + 1].r / N) * 0x2000), "WAAAAAT"); ++ //} ++ ++ //assert(Math.abs(ws[2 * i].i) < N && Math.abs(ws[2 * i + 1].i) < N) ++ // ++ //var n = (Math.round(ws[2 * i + 1].r / N) * 0x2000) ++ // + Math.round(ws[2 * i].r / N) ++ // + carry; ++ ++ var n = (Math.round(ws[2 * i + 1] / N) * 0x2000) ++ + Math.round(ws[2 * i] / N) ++ + carry; ++ ++ //console.log( ++ // n.toString(16), ++ // carry.toString(16), ++ // (n & 0x3ffffff).toString(16) ++ // ); ++ ++ ws[i] = n & 0x3ffffff; ++ ++ if (n < 0x4000000) { ++ carry = 0; ++ } else { ++ carry = Math.floor(n / 0x4000000); ++ } ++ } ++ ++ return ws; ++} ++ + function _inormalize20(ws, N) { + + var carry = 0; +@@ -1338,6 +1425,18 @@ function _iconvertToC13(ws, N) { + return cws; + } + ++function _iconvertTo13(ws, rws, iws, N) { ++ for (var i = 0; i < N / 2; i++) { ++ var w = ws[i] | 0; ++ ++ rws[2 * i] = w & 0x1fff; ++ iws[2 * i] = 0; ++ ++ rws[2 * i + 1] = w >>> 13; ++ iws[2 * i + 1] = 0; ++ } ++} ++ + function _iconvertToC20(ws, N) { + var cws = new Array(N); + +@@ -1406,56 +1505,56 @@ function _iconvertToC18(ws, N) { + return cws; + } + +-function _iconvertTo13(ws, N) { +- var cws = new Array(N); +- var carry = 0; +- +- var i = 0; +- for (i = 0; i < N; ++i) { +- ws[i] = Math.round(ws[i].r / N); +- } +- +- i = 0; +- for (var j = 0; true; ++j) { +- +- if (carry < 0x2000) { +- if (i === N) +- break; +- +- carry += ws[i]; +- i++; +- } +- +- var lo = carry & 0x1fff; // Here we don't care about overflow, since +- // since overflow may only "screw" (trim) high-order +- // bits, while we're particularly interested in low-order ones +- +- //console.log(carry, lo) +- +- carry = carry / 0x2000; // Since shift would trigger conversion from +- // float (64) to int (32) +- +- cws[j] = lo; +- } +- +- //for (var i = 0; i < N; i++) { +- // carry += Math.round(ws[i].r / N); +- // +- // +- // var lo = carry & 0x1fff; // Here we don't care about overflow, since +- // // since overflow may only "screw" (trim) high-order +- // // bits, while we're particularly interested in low-order ones +- // +- // console.log(carry, lo) +- // +- // carry = carry / 0x2000; // Since shift would trigger conversion from +- // // float (64) to int (32) +- // +- // cws[i] = lo; +- //} +- +- return cws; +-} ++//function _iconvertTo13(ws, N) { ++// var cws = new Array(N); ++// var carry = 0; ++// ++// var i = 0; ++// for (i = 0; i < N; ++i) { ++// ws[i] = Math.round(ws[i].r / N); ++// } ++// ++// i = 0; ++// for (var j = 0; true; ++j) { ++// ++// if (carry < 0x2000) { ++// if (i === N) ++// break; ++// ++// carry += ws[i]; ++// i++; ++// } ++// ++// var lo = carry & 0x1fff; // Here we don't care about overflow, since ++// // since overflow may only "screw" (trim) high-order ++// // bits, while we're particularly interested in low-order ones ++// ++// //console.log(carry, lo) ++// ++// carry = carry / 0x2000; // Since shift would trigger conversion from ++// // float (64) to int (32) ++// ++// cws[j] = lo; ++// } ++// ++// //for (var i = 0; i < N; i++) { ++// // carry += Math.round(ws[i].r / N); ++// // ++// // ++// // var lo = carry & 0x1fff; // Here we don't care about overflow, since ++// // // since overflow may only "screw" (trim) high-order ++// // // bits, while we're particularly interested in low-order ones ++// // ++// // console.log(carry, lo) ++// // ++// // carry = carry / 0x2000; // Since shift would trigger conversion from ++// // // float (64) to int (32) ++// // ++// // cws[i] = lo; ++// //} ++// ++// return cws; ++//} + + BN.prototype.mulTo = function mulTo(num, out) { + var res; +@@ -1483,14 +1582,14 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + var N = 2 * _guess(this.length, num.length); + //var N = _guess(this.length * 1.3, num.length * 1.3); + +- var w = new Complex(Math.cos(2 * π / N), Math.sin(2 * π / N)); ++ //var w = new Complex(Math.cos(2 * π / N), Math.sin(2 * π / N)); + + //console.log("-- W -- ", w); + +- var thisWFT = new Array(N), +- numWFT = new Array(N), +- //multWFT = new Array(N), +- multW = new Array(N); ++ //var thisWFT = new Array(N), ++ // numWFT = new Array(N), ++ // //multWFT = new Array(N), ++ // multW = new Array(N); + + //console.log("A, B: ", this, num); + +@@ -1498,36 +1597,80 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + + //_FFT(_iconvertToC13(this.words, N), 0, 0, thisWFT, 0, w, N); + //_FFT(_iconvertToC13(num.words, N), 0, 0, numWFT, 0, w, N); +- _FFTL(_iconvertToC13(this.words, N), 0, 0, thisWFT, 0, w, N, rbt); +- _FFTL(_iconvertToC13(num.words, N), 0, 0, numWFT, 0, w, N, rbt); + //_FFT(_iconvertToC20(this.words, N), 0, 0, thisWFT, 0, w, N); + //_FFT(_iconvertToC20(num.words, N), 0, 0, numWFT, 0, w, N); + //_FFT(_iconvertToC18(this.words, N), 0, 0, thisWFT, 0, w, N); + //_FFT(_iconvertToC18(num.words, N), 0, 0, numWFT, 0, w, N); + ++ var rThisWs = new Array(N), ++ iThisWs = new Array(N), ++ rThisWsT = new Array(N), // T for Transformed ++ iThisWsT = new Array(N), ++ ++ rNumWs = new Array(N), ++ iNumWs = new Array(N), ++ rNumWsT = new Array(N), ++ iNumWsT = new Array(N), ++ ++ rMultWs = new Array(N), ++ iMultWs = new Array(N); ++ ++ _iconvertTo13(this.words, rThisWs, iThisWs, N); ++ _iconvertTo13(num.words, rNumWs, iNumWs, N); ++ ++ _FFTL(rThisWs, iThisWs, 0, 0, rThisWsT, iThisWsT, 0, 0, N, rbt); ++ ++ //console.log("X[R/I] Vanilla", _toArray(rThisWs), _toArray(iThisWs)) ++ //console.log("X[R/I] Transformed", _toArray(rThisWsT), _toArray(iThisWsT)) ++ ++ _FFTL(rNumWs, iNumWs, 0, 0, rNumWsT, iNumWsT, 0, 0, N, rbt); ++ ++ //console.log("Y[R/I] Vanilla", _toArray(rNumWs), _toArray(iNumWs)) ++ //console.log("Y[R/I] Transformed", _toArray(rNumWsT), _toArray(iNumWsT)) ++ + for (var i = 0; i < N; ++i) { +- //multWFT[i] = thisWFT[i].mul(numWFT[i]); +- thisWFT[i].imul(numWFT[i]); ++ //thisWFT[i].imul(numWFT[i]); ++ var rx = rThisWsT[i] * rNumWsT[i] - iThisWsT[i] * iNumWsT[i]; ++ ++ iThisWsT[i] = rThisWsT[i] * iNumWsT[i] + iThisWsT[i] * rNumWsT[i] ++ rThisWsT[i] = rx; + } + ++ //console.log("X * Y[R/I] Transformed", _toArray(rThisWsT), _toArray(iThisWsT)) ++ + //console.log("-- MULF -- ", multWFT); + + //_FFT(_iconjugate(multWFT, N), 0, 0, multW, 0, w, N); +- _FFTL(_iconjugate(thisWFT, N), 0, 0, multW, 0, w, N, rbt); + +- //console.log(multW); ++ _iconjugateX(rThisWsT, iThisWsT, N); ++ ++ //console.log("X * Y[R/I] Transformed Conjugated", _toArray(rThisWsT), _toArray(iThisWsT)) ++ ++ _FFTL(rThisWsT, iThisWsT, 0, 0, rMultWs, iMultWs, 0, 0, N, rbt); ++ ++ //console.log("X * Y[R/I] Inverse FFT", _toArray(rMultWs), _toArray(iMultWs)) ++ ++ _iconjugateX(rMultWs, iMultWs, N); ++ ++ _inormalize13X(rMultWs, N); ++ ++ //console.log("X * Y[R/I] Conjugated Normalized", _toArray(rMultWs), _toArray(iMultWs)) + +- multW = _inormalize13(_iconjugate(multW, N), N); + //multW = _inormalize20(_iconjugate(multW, N), N); + //multW = _inormalize18(_iconjugate(multW, N), N); + +- out.words = multW; ++ out.words = _toArray(rMultWs); + + //console.log("-- MUL -- ", multW); + + return out.strip(); + }; + ++function _toArray(f64a) { ++ return [].slice.call(f64a); ++} ++ ++ + // Multiply `this` by `num` + BN.prototype.mul = function mul(num) { + var out = new BN(null); + +From 6dde038bb6100b4aa972c1ab22825dfefbfa1a3e Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Sun, 14 Dec 2014 22:23:59 +0300 +Subject: [PATCH 05/12] Vanished some more absurd + +--- + lib/bn.js | 39 +++++++++++++++++---------------------- + 1 file changed, 17 insertions(+), 22 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index 460a3bd..36beb6d 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -1087,7 +1087,7 @@ function _FFTL(rws, iws, _, __, rtws, itws, ___, ____, N, rbt) { + } + + function _makeRBT(N) { +- var t = new Int32Array(N); ++ var t = new Array(N); + var l = (Math.log(N) / Math.log(2)) >> 0; + for (var i = 0; i < N; ++i) { + t[i] = _revbin(i, l, N); +@@ -1125,7 +1125,7 @@ function _revbin(x, l, N) { + } + + +-function _guess(n, m) { ++function _guess13(n, m) { + var N = Math.max(m, n) | 1, odd = N & 1; + var i = 0; + while (N = N / 2 >> 0) { +@@ -1425,15 +1425,12 @@ function _iconvertToC13(ws, N) { + return cws; + } + +-function _iconvertTo13(ws, rws, iws, N) { ++function _iconvertTo13(ws, rws, N) { + for (var i = 0; i < N / 2; i++) { + var w = ws[i] | 0; + +- rws[2 * i] = w & 0x1fff; +- iws[2 * i] = 0; +- +- rws[2 * i + 1] = w >>> 13; +- iws[2 * i + 1] = 0; ++ rws[2 * i] = w & 0x1fff; ++ rws[2 * i + 1] = w >>> 13; + } + } + +@@ -1579,8 +1576,8 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + +- var N = 2 * _guess(this.length, num.length); +- //var N = _guess(this.length * 1.3, num.length * 1.3); ++ var N = 2 * _guess13(this.length, num.length); ++ //var N = _guess13(this.length * 1.3, num.length * 1.3); + + //var w = new Complex(Math.cos(2 * π / N), Math.sin(2 * π / N)); + +@@ -1602,28 +1599,30 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + //_FFT(_iconvertToC18(this.words, N), 0, 0, thisWFT, 0, w, N); + //_FFT(_iconvertToC18(num.words, N), 0, 0, numWFT, 0, w, N); + +- var rThisWs = new Array(N), +- iThisWs = new Array(N), ++ var zeroes = new Array(N), ++ rThisWs = new Array(N), + rThisWsT = new Array(N), // T for Transformed + iThisWsT = new Array(N), + + rNumWs = new Array(N), +- iNumWs = new Array(N), + rNumWsT = new Array(N), + iNumWsT = new Array(N), + + rMultWs = new Array(N), + iMultWs = new Array(N); + +- _iconvertTo13(this.words, rThisWs, iThisWs, N); +- _iconvertTo13(num.words, rNumWs, iNumWs, N); ++ for (var i = 0; i < N; ++i) ++ zeroes[i] = 0; ++ ++ _iconvertTo13(this.words, rThisWs, N); ++ _iconvertTo13(num.words, rNumWs, N); + +- _FFTL(rThisWs, iThisWs, 0, 0, rThisWsT, iThisWsT, 0, 0, N, rbt); ++ _FFTL(rThisWs, zeroes, 0, 0, rThisWsT, iThisWsT, 0, 0, N, rbt); + + //console.log("X[R/I] Vanilla", _toArray(rThisWs), _toArray(iThisWs)) + //console.log("X[R/I] Transformed", _toArray(rThisWsT), _toArray(iThisWsT)) + +- _FFTL(rNumWs, iNumWs, 0, 0, rNumWsT, iNumWsT, 0, 0, N, rbt); ++ _FFTL(rNumWs, zeroes, 0, 0, rNumWsT, iNumWsT, 0, 0, N, rbt); + + //console.log("Y[R/I] Vanilla", _toArray(rNumWs), _toArray(iNumWs)) + //console.log("Y[R/I] Transformed", _toArray(rNumWsT), _toArray(iNumWsT)) +@@ -1659,17 +1658,13 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + //multW = _inormalize20(_iconjugate(multW, N), N); + //multW = _inormalize18(_iconjugate(multW, N), N); + +- out.words = _toArray(rMultWs); ++ out.words = rMultWs; + + //console.log("-- MUL -- ", multW); + + return out.strip(); + }; + +-function _toArray(f64a) { +- return [].slice.call(f64a); +-} +- + + // Multiply `this` by `num` + BN.prototype.mul = function mul(num) { + +From 4af09f26ad1d4904496d9b92e1b207971ca6d819 Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Sun, 14 Dec 2014 22:43:01 +0300 +Subject: [PATCH 06/12] Vapourized yet another array + +--- + lib/bn.js | 26 ++++++++++++++++---------- + 1 file changed, 16 insertions(+), 10 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index 36beb6d..60953fc 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -1572,6 +1572,7 @@ BN.prototype.mulToF = function mulToF(num, out) { + return res; + }; + ++ + BN.prototype._bigMulToF = function _bigMulToF(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; +@@ -1599,7 +1600,8 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + //_FFT(_iconvertToC18(this.words, N), 0, 0, thisWFT, 0, w, N); + //_FFT(_iconvertToC18(num.words, N), 0, 0, numWFT, 0, w, N); + +- var zeroes = new Array(N), ++ var ph = _makePlaceHolderA(N), ++ + rThisWs = new Array(N), + rThisWsT = new Array(N), // T for Transformed + iThisWsT = new Array(N), +@@ -1608,21 +1610,17 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + rNumWsT = new Array(N), + iNumWsT = new Array(N), + +- rMultWs = new Array(N), +- iMultWs = new Array(N); +- +- for (var i = 0; i < N; ++i) +- zeroes[i] = 0; ++ rMultWs = new Array(N); + + _iconvertTo13(this.words, rThisWs, N); + _iconvertTo13(num.words, rNumWs, N); + +- _FFTL(rThisWs, zeroes, 0, 0, rThisWsT, iThisWsT, 0, 0, N, rbt); ++ _FFTL(rThisWs, ph, 0, 0, rThisWsT, iThisWsT, 0, 0, N, rbt); + + //console.log("X[R/I] Vanilla", _toArray(rThisWs), _toArray(iThisWs)) + //console.log("X[R/I] Transformed", _toArray(rThisWsT), _toArray(iThisWsT)) + +- _FFTL(rNumWs, zeroes, 0, 0, rNumWsT, iNumWsT, 0, 0, N, rbt); ++ _FFTL(rNumWs, ph, 0, 0, rNumWsT, iNumWsT, 0, 0, N, rbt); + + //console.log("Y[R/I] Vanilla", _toArray(rNumWs), _toArray(iNumWs)) + //console.log("Y[R/I] Transformed", _toArray(rNumWsT), _toArray(iNumWsT)) +@@ -1645,11 +1643,11 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + + //console.log("X * Y[R/I] Transformed Conjugated", _toArray(rThisWsT), _toArray(iThisWsT)) + +- _FFTL(rThisWsT, iThisWsT, 0, 0, rMultWs, iMultWs, 0, 0, N, rbt); ++ _FFTL(rThisWsT, iThisWsT, 0, 0, rMultWs, ph, 0, 0, N, rbt); + + //console.log("X * Y[R/I] Inverse FFT", _toArray(rMultWs), _toArray(iMultWs)) + +- _iconjugateX(rMultWs, iMultWs, N); ++ _iconjugateX(rMultWs, ph, N); + + _inormalize13X(rMultWs, N); + +@@ -1665,6 +1663,14 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + return out.strip(); + }; + ++function _makePlaceHolderA(N) { ++ var ph = new Array(N); ++ for (var i = 0; i < N; ++i) ++ ph[i] = 0; ++ ++ return ph; ++} ++ + + // Multiply `this` by `num` + BN.prototype.mul = function mul(num) { + +From 393e6b3d41b4b260de8354937c1061de822aee47 Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Sun, 14 Dec 2014 22:46:07 +0300 +Subject: [PATCH 07/12] Cleaned up + +--- + benchmarks/index.js | 181 +++++++++------ + lib/bn.js | 639 +++------------------------------------------------- + test/_fft.js | 49 ---- + 3 files changed, 143 insertions(+), 726 deletions(-) + delete mode 100644 test/_fft.js + +diff --git a/benchmarks/index.js b/benchmarks/index.js +index 64b61d9..75e0f0c 100644 +--- a/benchmarks/index.js ++++ b/benchmarks/index.js +@@ -56,90 +56,120 @@ if (/fast/i.test(process.argv[3])) { + benchmark.options.minTime = 1; + } + ++var aj = 'a899c59999bf877d96442d284359783bdc64b5f878b688fe' + ++ '51407f0526e616553ad0aaaac4d5bed3046f10a1faaf42bb' + ++ '2342dc4b7908eea0c46e4c4576897675c2bfdc4467870d3d' + ++ 'cd90adaed4359237a4bc6924bfb99aa6bf5f5ede15b574ea' + ++ 'e977eac096f3c67d09bda574c6306c6123fa89d2f086b8dc' + ++ 'ff92bc570c18d83fe6c810ccfd22ce4c749ef5e6ead3fffe' + ++ 'c63d95e0e3fde1df9db6a35fa1d107058f37e41957769199' + ++ 'd945dd7a373622c65f0af3fd9eb1ddc5c764bbfaf7a3dc37' + ++ '2548e683b970dac4aa4b9869080d2376c9adecebb84e172c' + ++ '09aeeb25fb8df23e60033260c4f8aac6b8b98ab894b1fb84' + ++ 'ebb83c0fb2081c3f3eee07f44e24d8fabf76f19ed167b0d7' + ++ 'ff971565aa4efa3625fce5a43ceeaa3eebb3ce88a00f597f' + ++ '048c69292b38dba2103ecdd5ec4ccfe3b2d87fa6202f334b' + ++ 'c1cab83b608dfc875b650b69f2c7e23c0b2b4adf149a6100' + ++ 'db1b6dbad4679ecb1ea95eafaba3bd00db11c2134f5a8686' + ++ '358b8b2ab49a1b2e85e1e45caeac5cd4dc0b3b5fffba8871' + ++ '1c6baf399edd48dad5e5c313702737a6dbdcede80ca358e5' + ++ '1d1c4fe42e8948a084403f61baed38aa9a1a5ce2918e9f33' + ++ '100050a430b47bc592995606440272a4994677577a6aaa1b' + ++ 'a101045dbec5a4e9566dab5445d1af3ed19519f07ac4e2a8' + ++ 'bd0a84b01978f203a9125a0be020f71fab56c2c9e344d4f4' + ++ '12d53d3cd8eb74ca5122002e931e3cb0bd4b7492436be17a' + ++ 'd7ebe27148671f59432c36d8c56eb762655711cfc8471f70' + ++ '83a8b7283bcb3b1b1d47d37c23d030288cfcef05fbdb4e16' + ++ '652ee03ee7b77056a808cd700bc3d9ef826eca9a59be959c' + ++ '947c865d6b372a1ca2d503d7df6d7611b12111665438475a' + ++ '1c64145849b3da8c2d343410df892d958db232617f9896f1' + ++ 'de95b8b5a47132be80dd65298c7f2047858409bf762dbc05' + ++ 'a62ca392ac40cfb8201a0607a2cae07d99a307625f2b2d04' + ++ 'fe83fbd3ab53602263410f143b73d5b46fc761882e78c782' + ++ 'd2c36e716a770a7aefaf7f76cea872db7bffefdbc4c2f9e0' + ++ '39c19adac915e7a63dcb8c8c78c113f29a3e0bc10e100ce0'; ++ ++var bj = '3bf836229c7dd874fe37c1790d201e82ed8e192ed61571ca' + ++ '7285264974eb2a0171f3747b2fc23969a916cbd21e14f7e2' + ++ 'f0d72dcd2247affba926f9e7bb99944cb5609aed85e71b89' + ++ 'e89d2651550cb5bd8281bd3144066af78f194032aa777739' + ++ 'cccb7862a1af401f99f7e5c693f25ddce2dedd9686633820' + ++ 'd28d0f5ed0c6b5a094f5fe6170b8e2cbc9dff118398baee6' + ++ 'e895a6301cb6e881b3cae749a5bdf5c56fc897ff68bc73f2' + ++ '4811bb108b882872bade1f147d886a415cda2b93dd90190c' + ++ 'be5c2dd53fe78add5960e97f58ff2506afe437f4cf4c912a' + ++ '397c1a2139ac6207d3ab76e6b7ffd23bb6866dd7f87a9ae5' + ++ '578789084ff2d06ea0d30156d7a10496e8ebe094f5703539' + ++ '730f5fdbebc066de417be82c99c7da59953071f49da7878d' + ++ 'a588775ff2a7f0084de390f009f372af75cdeba292b08ea8' + ++ '4bd13a87e1ca678f9ad148145f7cef3620d69a891be46fbb' + ++ 'cad858e2401ec0fd72abdea2f643e6d0197b7646fbb83220' + ++ '0f4cf7a7f6a7559f9fb0d0f1680822af9dbd8dec4cd1b5e1' + ++ '7bc799e902d9fe746ddf41da3b7020350d3600347398999a' + ++ 'baf75d53e03ad2ee17de8a2032f1008c6c2e6618b62f225b' + ++ 'a2f350179445debe68500fcbb6cae970a9920e321b468b74' + ++ '5fb524fb88abbcacdca121d737c44d30724227a99745c209' + ++ 'b970d1ff93bbc9f28b01b4e714d6c9cbd9ea032d4e964d8e' + ++ '8fff01db095160c20b7646d9fcd314c4bc11bcc232aeccc0' + ++ 'fbedccbc786951025597522eef283e3f56b44561a0765783' + ++ '420128638c257e54b972a76e4261892d81222b3e2039c61a' + ++ 'ab8408fcaac3d634f848ab3ee65ea1bd13c6cd75d2e78060' + ++ 'e13cf67fbef8de66d2049e26c0541c679fff3e6afc290efe' + ++ '875c213df9678e4a7ec484bc87dae5f0a1c26d7583e38941' + ++ 'b7c68b004d4df8b004b666f9448aac1cc3ea21461f41ea5d' + ++ 'd0f7a9e6161cfe0f58bcfd304bdc11d78c2e9d542e86c0b5' + ++ '6985cc83f693f686eaac17411a8247bf62f5ccc7782349b5' + ++ 'cc1f20e312fa2acc0197154d1bfee507e8db77e8f2732f2d' + ++ '641440ccf248e8643b2bd1e1f9e8239356ab91098fcb431d'; ++ ++// BN ++ + var a1 = new bn('012345678901234567890123456789012345678901234567890', 10); + var b1 = new bn('213509123601923760129376102397651203958123402314875', 10); + +-var a1x = new bn( 'a899c59999bf877d96442d284359783bdc64b5f878b688fe' + +- '51407f0526e616553ad0aaaac4d5bed3046f10a1faaf42bb' + +- '2342dc4b7908eea0c46e4c4576897675c2bfdc4467870d3d' + +- 'cd90adaed4359237a4bc6924bfb99aa6bf5f5ede15b574ea' + +- 'e977eac096f3c67d09bda574c6306c6123fa89d2f086b8dc' + +- 'ff92bc570c18d83fe6c810ccfd22ce4c749ef5e6ead3fffe' + +- 'c63d95e0e3fde1df9db6a35fa1d107058f37e41957769199' + +- 'd945dd7a373622c65f0af3fd9eb1ddc5c764bbfaf7a3dc37' + +- '2548e683b970dac4aa4b9869080d2376c9adecebb84e172c' + +- '09aeeb25fb8df23e60033260c4f8aac6b8b98ab894b1fb84' + +- 'ebb83c0fb2081c3f3eee07f44e24d8fabf76f19ed167b0d7' + +- 'ff971565aa4efa3625fce5a43ceeaa3eebb3ce88a00f597f' + +- '048c69292b38dba2103ecdd5ec4ccfe3b2d87fa6202f334b' + +- 'c1cab83b608dfc875b650b69f2c7e23c0b2b4adf149a6100' + +- 'db1b6dbad4679ecb1ea95eafaba3bd00db11c2134f5a8686' + +- '358b8b2ab49a1b2e85e1e45caeac5cd4dc0b3b5fffba8871' + +- '1c6baf399edd48dad5e5c313702737a6dbdcede80ca358e5' + +- '1d1c4fe42e8948a084403f61baed38aa9a1a5ce2918e9f33' + +- '100050a430b47bc592995606440272a4994677577a6aaa1b' + +- 'a101045dbec5a4e9566dab5445d1af3ed19519f07ac4e2a8' + +- 'bd0a84b01978f203a9125a0be020f71fab56c2c9e344d4f4' + +- '12d53d3cd8eb74ca5122002e931e3cb0bd4b7492436be17a' + +- 'd7ebe27148671f59432c36d8c56eb762655711cfc8471f70' + +- '83a8b7283bcb3b1b1d47d37c23d030288cfcef05fbdb4e16' + +- '652ee03ee7b77056a808cd700bc3d9ef826eca9a59be959c' + +- '947c865d6b372a1ca2d503d7df6d7611b12111665438475a' + +- '1c64145849b3da8c2d343410df892d958db232617f9896f1' + +- 'de95b8b5a47132be80dd65298c7f2047858409bf762dbc05' + +- 'a62ca392ac40cfb8201a0607a2cae07d99a307625f2b2d04' + +- 'fe83fbd3ab53602263410f143b73d5b46fc761882e78c782' + +- 'd2c36e716a770a7aefaf7f76cea872db7bffefdbc4c2f9e0' + +- '39c19adac915e7a63dcb8c8c78c113f29a3e0bc10e100ce0', 16); +- +-var b1x = new bn( '3bf836229c7dd874fe37c1790d201e82ed8e192ed61571ca' + +- '7285264974eb2a0171f3747b2fc23969a916cbd21e14f7e2' + +- 'f0d72dcd2247affba926f9e7bb99944cb5609aed85e71b89' + +- 'e89d2651550cb5bd8281bd3144066af78f194032aa777739' + +- 'cccb7862a1af401f99f7e5c693f25ddce2dedd9686633820' + +- 'd28d0f5ed0c6b5a094f5fe6170b8e2cbc9dff118398baee6' + +- 'e895a6301cb6e881b3cae749a5bdf5c56fc897ff68bc73f2' + +- '4811bb108b882872bade1f147d886a415cda2b93dd90190c' + +- 'be5c2dd53fe78add5960e97f58ff2506afe437f4cf4c912a' + +- '397c1a2139ac6207d3ab76e6b7ffd23bb6866dd7f87a9ae5' + +- '578789084ff2d06ea0d30156d7a10496e8ebe094f5703539' + +- '730f5fdbebc066de417be82c99c7da59953071f49da7878d' + +- 'a588775ff2a7f0084de390f009f372af75cdeba292b08ea8' + +- '4bd13a87e1ca678f9ad148145f7cef3620d69a891be46fbb' + +- 'cad858e2401ec0fd72abdea2f643e6d0197b7646fbb83220' + +- '0f4cf7a7f6a7559f9fb0d0f1680822af9dbd8dec4cd1b5e1' + +- '7bc799e902d9fe746ddf41da3b7020350d3600347398999a' + +- 'baf75d53e03ad2ee17de8a2032f1008c6c2e6618b62f225b' + +- 'a2f350179445debe68500fcbb6cae970a9920e321b468b74' + +- '5fb524fb88abbcacdca121d737c44d30724227a99745c209' + +- 'b970d1ff93bbc9f28b01b4e714d6c9cbd9ea032d4e964d8e' + +- '8fff01db095160c20b7646d9fcd314c4bc11bcc232aeccc0' + +- 'fbedccbc786951025597522eef283e3f56b44561a0765783' + +- '420128638c257e54b972a76e4261892d81222b3e2039c61a' + +- 'ab8408fcaac3d634f848ab3ee65ea1bd13c6cd75d2e78060' + +- 'e13cf67fbef8de66d2049e26c0541c679fff3e6afc290efe' + +- '875c213df9678e4a7ec484bc87dae5f0a1c26d7583e38941' + +- 'b7c68b004d4df8b004b666f9448aac1cc3ea21461f41ea5d' + +- 'd0f7a9e6161cfe0f58bcfd304bdc11d78c2e9d542e86c0b5' + +- '6985cc83f693f686eaac17411a8247bf62f5ccc7782349b5' + +- 'cc1f20e312fa2acc0197154d1bfee507e8db77e8f2732f2d' + +- '641440ccf248e8643b2bd1e1f9e8239356ab91098fcb431d', 16); ++var a1j = new bn(aj, 16); ++var b1j = new bn(bj, 16); ++ ++// bignum + + var a2 = new bignum('012345678901234567890123456789012345678901234567890', 10); + var b2 = new bignum('213509123601923760129376102397651203958123402314875', 10); + ++var a2j = new bignum(aj, 16); ++var b2j = new bignum(bj, 16); ++ ++// bigi ++ + var a4 = new bigi('012345678901234567890123456789012345678901234567890', 10); + var b4 = new bigi('213509123601923760129376102397651203958123402314875', 10); + ++var a4j = new bigi(aj, 16); ++var b4j = new bigi(bj, 16); ++ ++// sjcl ++ + var a5 = new sjcl(a1.toString(16)); + var b5 = new sjcl(b1.toString(16)); + ++var a5j = new sjcl(aj); ++var b5j = new sjcl(bj); ++ ++// BigInteger ++ + var a6 = new BigInteger('012345678901234567890123456789012345678901234567890', 10); + var b6 = new BigInteger('213509123601923760129376102397651203958123402314875', 10); + ++var a6j = new BigInteger(aj, 16); ++var b6j = new BigInteger(bj, 16); ++ ++// SilentMattBigInteger ++ + var a8 = SilentMattBigInteger.parse('012345678901234567890123456789012345678901234567890', 10); + var b8 = SilentMattBigInteger.parse('213509123601923760129376102397651203958123402314875', 10); + ++var a8j = SilentMattBigInteger.parse(aj, 16); ++var b8j = SilentMattBigInteger.parse(aj, 16); ++ + var as1 = a1.mul(a1).iaddn(0x2adbeef); + var as2 = a2.mul(a2).add(0x2adbeef); + var as4 = a4.multiply(a4).add(bigi.valueOf(0x2adbeef)); +@@ -273,7 +303,7 @@ add('mul', { + }, + 'bn.js[FFT]': function() { + a1.mulf(b1); +- } ++ }, + 'bignum': function() { + a2.mul(b2); + }, +@@ -293,10 +323,25 @@ add('mul', { + + add('mul-jumbo', { + 'bn.js': function() { +- a1x.mul(b1x); ++ a1j.mul(b1j); + }, + 'bn.js[FFT]': function() { +- a1x.mulf(b1x); ++ a1j.mulf(b1j); ++ }, ++ 'bignum': function() { ++ a2j.mul(b2j); ++ }, ++ 'bigi': function() { ++ a4j.multiply(b4j); ++ }, ++ 'sjcl': function() { ++ a5j.mul(b5j); ++ }, ++ 'yaffle': function() { ++ a6j.multiply(b6j); ++ }, ++ 'silentmatt-biginteger': function() { ++ a8j.multiply(b8j); + } + }); + +diff --git a/lib/bn.js b/lib/bn.js +index 60953fc..c1aaedd 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -883,151 +883,24 @@ BN.prototype._bigMulTo = function _bigMulTo(num, out) { + return out.strip(); + }; + ++BN.prototype.mulTo = function mulTo(num, out) { ++ var res; ++ var len = this.length + num.length; ++ if (len < 63) ++ res = this._smallMulTo(num, out); ++ else if (len < 1024) ++ res = this._bigMulTo(num, out); ++ else ++ res = this._bigMulToF(num, out); ++ return res; ++}; + +-function Complex(r, i) { +- this.r = r; +- this.i = i; +- +- //this._norm(); +-} +- +-// private +-function _iaddC(rhs) { +- this.r += rhs.r; +- this.i += rhs.i; +- +- //this._norm(); +- +- return this; +-} +- +-function _addC(rhs) { +- var t = new Complex(this.r, this.i); +- t.iadd(rhs); +- return t; +-} +- +-function _isubC(rhs) { +- this.r -= rhs.r; +- this.i -= rhs.i +- +- //this._norm(); +- +- return this; +-} +- +-function _subC(rhs) { +- var t = new Complex(this.r, this.i); +- t.isub(rhs); +- return t; +-} +- +-function _iconjC() { +- this.i *= -1; +- return this; +-} +- +-function _imulC(rhs) { +- var r = this.r * rhs.r - this.i * rhs.i, +- i = this.r * rhs.i + this.i * rhs.r; +- +- this.r = r; +- this.i = i; +- +- //this._norm(); +- +- return this; +-} +- +-function _mulC(rhs) { +- var t = new Complex(this.r, this.i); +- t.imul(rhs); +- return t; +-} +- +-function _cloneC() { +- return new Complex(this.r, this.i); +-} +- +-Complex.prototype.mul = _mulC; +-Complex.prototype.imul = _imulC; +-Complex.prototype.add = _addC; +-Complex.prototype.iadd = _iaddC; +-Complex.prototype.sub = _subC; +-Complex.prototype.isub = _isubC; +-Complex.prototype.iconj = _iconjC; +-Complex.prototype.clone = _cloneC; +- +-//Complex.prototype._isZero = function (v) { +-// return Math.abs(v) < 1.e-12; +-//} +- +-//Complex.prototype._norm = function () { +- //if (this._isZero(this.r)) this.r = 0; +- //if (this._isZero(this.i)) this.i = 0; +-//} +- +-// _FFT(this.words, thisWFT, w, N, 0); +-function _FFT(ws, p, s, tws, tp, r, N) { +- if (N === 1) { +- tws[tp] = ws[p]; +- //console.log("p/tp/ws/tws :", p, tp, ws, tws); +- } else { +- var hN = N / 2 >> 0; +- +- var rr = r.mul(r); +- +- var s_ = 2 * s + 1; +- +- //console.log("-- FFT -- # ", N); +- //console.log("-- R -- ", r); +- +- //console.log("-- RR -- # ", rr); +- +- _FFT(ws, p, s_, tws, tp, rr, hN); // even +- _FFT(ws, p + s + 1, s_, tws, tp + hN, rr, hN); // odd +- +- var r_ = r.clone(); +- +- for (var i = 0; i < hN; ++i) { +- var e = tws[tp + i]; +- var o = tws[tp + i + hN].clone(); +- +- //console.log("tp + i, tp + i + hN, tws | ", tp + i, tp + i + hN, tws) +- //console.log("r_, o, e, (o * r_)", r_, o, e, o.mul(r_)); +- +- o.imul(r_); +- +- tws[tp + i] = e.add(o); +- tws[tp + i + hN] = e.sub(o); +- +- //console.log(tws); +- +- //assert(tws[tp + i].r < (0x4000000 * 0x4000000 * 2)) +- //assert(tws[tp + i + hN].r < (0x4000000 * 0x4000000 * 2)) +- +- r_.imul(r); + +- //console.log("tws | ", tws) +- } +- } +-} ++// Private + + var π = 3.14159265359; + +- +-function _FFTL(rws, iws, _, __, rtws, itws, ___, ____, N, rbt) { +- //var hN = N / 2 >> 0; +- +- //for (var j = 0; j < 2; ++j) +- //for (var i = 0, hhN = hN >> 1, dN = hN; i < hhN; ++i, dN >>= 1) { +- // tws[2 * i] = ws[dN + j]; +- // tws[2 * i + 1] = ws[dN + j + ]; +- //} +- +- //console.log("XXXXX") +- //console.log("WS, TWS", ws, tws) +- ++function _FFTL(rws, iws, rtws, itws, N, rbt) { + _permuteTo(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { +@@ -1042,38 +915,24 @@ function _FFTL(rws, iws, _, __, rtws, itws, ___, ____, N, rbt) { + + for (var j = 0; j < s; ++j) { + +- //var e = tws[p + j]; +- + var re = rtws[p + j]; + var ie = itws[p + j]; + +- //var o = tws[p + j + s].clone(); +- + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + +- //o.imul(r_); +- + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + +- //tws[p + j] = e.add(o); +- + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + +- //tws[p + j + s] = e.sub(o) +- + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + +- //assert(tws[p + j].r < (0x4000000 * 0x4000000 * 2)) +- //assert(tws[p + j + s].r < (0x4000000 * 0x4000000 * 2)) +- + if (j !== l) { +- //r_.imul(r); + var rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; +@@ -1081,8 +940,6 @@ function _FFTL(rws, iws, _, __, rtws, itws, ___, ____, N, rbt) { + } + } + } +- +- //console.log(tws) + } + } + +@@ -1097,15 +954,7 @@ function _makeRBT(N) { + } + + function _permuteTo(rbt, rws, iws, rtws, itws, N) { +- //var l = (Math.log(N) / Math.log(2)) >> 0; + for (var i = 0; i < N; ++i) { +- //var r = _revbin(i, l, N); +- //console.log("REVBIN: ", i, r) +- //if (r > i) { +- // var t = ws[i]; +- // ws[i] = ws[r]; +- // ws[r] = t; +- //} + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } +@@ -1135,22 +984,7 @@ function _guess13(n, m) { + return (1 << i + 1 + odd) + } + +-function _iconjugate(ws, N) { +- if (N > 1) { +- for (var i = 0; i < N / 2; ++i) { +- var t = ws[i]; +- ws[i] = ws[N - i - 1]; +- ws[N - i - 1] = t; +- +- ws[i].i *= -1; +- ws[N - i - 1].i *= -1; +- } +- } +- +- return ws; +-} +- +-function _iconjugateX(rws, iws, N) { ++function _iconjugate(rws, iws, N) { + if (N > 1) { + for (var i = 0; i < N / 2; ++i) { + var t = rws[i]; +@@ -1169,262 +1003,22 @@ function _iconjugateX(rws, iws, N) { + function _inormalize13(ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; ++i) { +- +- //var n = (((ws[2 * i + 1].r / N + .5) >> 0) << 13) +- // + ((ws[2 * i].r / N + .5) >> 0) +- // + carry; +- +- //if ((Math.round(ws[2 * i + 1].r / N) << 13) !== (Math.round(ws[2 * i + 1].r / N) * 0x2000)) { +- // console.log(1 << 13, 1 * 0x2000); +- // console.log(Math.round(ws[2 * i + 1].r / N), ((Math.round(ws[2 * i + 1].r / N)) << 7), (Math.round(ws[2 * i + 1].r / N) * 0x2000)); +- // assert((Math.round(ws[2 * i + 1].r / N) << 13) === (Math.round(ws[2 * i + 1].r / N) * 0x2000), "WAAAAAT"); +- //} +- +- //assert(Math.abs(ws[2 * i].i) < N && Math.abs(ws[2 * i + 1].i) < N) +- // +- //var n = (Math.round(ws[2 * i + 1].r / N) * 0x2000) +- // + Math.round(ws[2 * i].r / N) +- // + carry; +- +- var n = (Math.round(ws[2 * i + 1].r / N) * 0x2000) +- + Math.round(ws[2 * i].r / N) +- + carry; +- +- //console.log( +- // n.toString(16), +- // carry.toString(16), +- // (n & 0x3ffffff).toString(16) +- // ); +- +- ws[i] = n & 0x3ffffff; +- +- if (n < 0x4000000) { +- carry = 0; +- } else { +- carry = Math.floor(n / 0x4000000); +- } +- } +- +- return ws; +-} +- +- +-function _inormalize13X(ws, N) { +- var carry = 0; +- for (var i = 0; i < N / 2; ++i) { +- +- //var n = (((ws[2 * i + 1].r / N + .5) >> 0) << 13) +- // + ((ws[2 * i].r / N + .5) >> 0) +- // + carry; +- +- //if ((Math.round(ws[2 * i + 1].r / N) << 13) !== (Math.round(ws[2 * i + 1].r / N) * 0x2000)) { +- // console.log(1 << 13, 1 * 0x2000); +- // console.log(Math.round(ws[2 * i + 1].r / N), ((Math.round(ws[2 * i + 1].r / N)) << 7), (Math.round(ws[2 * i + 1].r / N) * 0x2000)); +- // assert((Math.round(ws[2 * i + 1].r / N) << 13) === (Math.round(ws[2 * i + 1].r / N) * 0x2000), "WAAAAAT"); +- //} +- +- //assert(Math.abs(ws[2 * i].i) < N && Math.abs(ws[2 * i + 1].i) < N) +- // +- //var n = (Math.round(ws[2 * i + 1].r / N) * 0x2000) +- // + Math.round(ws[2 * i].r / N) +- // + carry; +- +- var n = (Math.round(ws[2 * i + 1] / N) * 0x2000) ++ var w = (Math.round(ws[2 * i + 1] / N) * 0x2000) + + Math.round(ws[2 * i] / N) + + carry; + +- //console.log( +- // n.toString(16), +- // carry.toString(16), +- // (n & 0x3ffffff).toString(16) +- // ); ++ ws[i] = w & 0x3ffffff; + +- ws[i] = n & 0x3ffffff; +- +- if (n < 0x4000000) { ++ if (w < 0x4000000) { + carry = 0; + } else { +- carry = Math.floor(n / 0x4000000); ++ carry = Math.floor(w / 0x4000000); + } + } + + return ws; + } + +-function _inormalize20(ws, N) { +- +- var carry = 0; +- var seek = 0; +- +- for (var j = 0; j < N; ++j) { +- ws[j] = Math.round(ws[j].r / N); +- } +- +- for (var i = 0; i < N; ++i) { +- //var w = (((ws[2 * i + 1].r / N + .5) >> 0) << 13) +- // + ((ws[2 * i].r / N + .5) >> 0) +- // + carry; +- +- //if ((Math.round(ws[2 * i + 1].r / N) << 13) !== (Math.round(ws[2 * i + 1].r / N) * 0x2000)) { +- // console.log(1 << 13, 1 * 0x2000); +- // console.log(Math.round(ws[2 * i + 1].r / N), ((Math.round(ws[2 * i + 1].r / N)) << 7), (Math.round(ws[2 * i + 1].r / N) * 0x2000)); +- // assert((Math.round(ws[2 * i + 1].r / N) << 13) === (Math.round(ws[2 * i + 1].r / N) * 0x2000), "WAAAAAT"); +- //} +- +- //assert(Math.abs(ws[2 * i].i) < N && Math.abs(ws[2 * i + 1].i) < N) +- +- //var w = ws[i]; +- // +- //assert(w < (0x4000000 * 0x4000000)) +- // +- //console.log("Before ", w, w & 0x3ffffff, carry); +- // +- //if (i + 1 < N) { +- // w += ((ws[i + 1] + 0.5) & 0x3ffffff) * 0x100000; +- // +- // ws[i + 1] &= 0x4000000; +- //} +- // +- //w += carry; +- // +- //ws[i] = w & 0x3ffffff; +- // +- //carry = Math.floor(w / 0x4000000); +- // +- //console.log("After ", w, w & 0x3ffffff, carry); +- +- var w = ws[i]; +- +- //console.log(w, carry, (w & 0x3ffffff)); +- +- var j = i; +- +- //if (w < 0x4000000) +- { +- var pseek = seek; +- seek += 26 - 20; +- +- if (seek > 20) { +- if (i < N - 1) { +- w += ws[i + 1] * 0x100000 / (1 << pseek) +- +- // !!! +- ++i; +- +- seek -= 20; +- +- var d = 1 << seek; +- +- w += (ws[i + 1] & (d - 1)) * (1 << 26 - seek); +- ws[i + 1] /= d; +- } +- } +- else +- { +- var pd = 1 << (pseek); +- var d = 1 << (seek); +- +- //console.log("D, W, WS[i+1]x ", d, w, (ws[i + 1] & (d - 1)) * 0x100000 / pd) +- +- w += (ws[i + 1] & (d - 1)) * 0x100000 / pd; +- ws[i + 1] /= d; +- } +- } +- +- //console.log(w, w & 0x3ffffff, carry) +- +- assert(w < 0x4000000 * 0x4000000) +- assert(carry < 0x4000000 * 0x4000000) +- +- w += carry; +- +- //console.log(w, w & 0x3ffffff, carry) +- +- ws[j] = w & 0x3ffffff; +- +- carry = Math.floor(w / 0x4000000); +- } +- +- return ws; +-} +- +-function _inormalize18(ws, N) { +- +- var carry = 0; +- var seek = 0; +- +- for (var j = 0; j < N; ++j) { +- ws[j] = Math.round(ws[j].r / N); +- } +- +- for (var i = 0; i < N; ++i) { +- var w = ws[i]; +- +- //console.log(w, carry, (w & 0x3ffffff)); +- +- var j = i; +- +- //if (w < 0x4000000) +- { +- var pseek = seek; +- seek += 26 - 18; +- +- if (seek > 18) { +- if (i < N - 1) { +- w += ws[i + 1] * 0x40000 / (1 << pseek) +- +- // !!! +- ++i; +- +- seek -= 18; +- +- var d = 1 << seek; +- +- w += (ws[i + 1] & (d - 1)) * (1 << 26 - seek); +- ws[i + 1] /= d; +- } +- } +- else +- { +- var pd = 1 << (pseek); +- var d = 1 << (seek); +- +- //console.log("D, W, WS[i+1]x ", d, w, (ws[i + 1] & (d - 1)) * 0x100000 / pd) +- +- w += (ws[i + 1] & (d - 1)) * 0x40000 / pd; +- ws[i + 1] /= d; +- } +- } +- +- //console.log(w, w & 0x3ffffff, carry) +- +- assert(w < 0x4000000 * 0x4000000) +- assert(carry < 0x4000000 * 0x4000000) +- +- w += carry; +- +- //console.log(w, w & 0x3ffffff, carry) +- +- ws[j] = w & 0x3ffffff; +- +- carry = Math.floor(w / 0x4000000); +- } +- +- return ws; +-} +- +- +-function _iconvertToC13(ws, N) { +- var cws = new Array(N); +- for (var i = 0; i < N / 2; i++) { +- var w = ws[i] || 0; +- +- cws[2 * i] = new Complex(w & 0x1fff, 0); +- cws[2 * i + 1] = new Complex(w >>> 13, 0); +- } +- return cws; +-} +- + function _iconvertTo13(ws, rws, N) { + for (var i = 0; i < N / 2; i++) { + var w = ws[i] | 0; +@@ -1434,135 +1028,14 @@ function _iconvertTo13(ws, rws, N) { + } + } + +-function _iconvertToC20(ws, N) { +- var cws = new Array(N); +- +- for (var i = 0, j = 0, seek = 20; i < N; ++i) { +- var w = ws[i] || 0; +- var l = 26; +- +- while (l > 0) { +- cws[j] = cws[j] || 0; +- +- if (seek >= l) { +- cws[j] += w << (20 - seek); +- +- seek -= l; +- if (seek === 0) seek = 20; +- l = 0; +- } else { +- cws[j] += (w & ((1 << seek) - 1)) << (20 - seek); +- w /= 1 << seek; +- +- ++j; +- l -= seek; +- seek = 20; +- } +- } +- } +- +- for (i = 0; i < N; ++i) { +- cws[i] = new Complex(cws[i], 0); +- } +- +- return cws; +-} +- +-function _iconvertToC18(ws, N) { +- var cws = new Array(N); +- +- for (var i = 0, j = 0, seek = 18; i < N; ++i) { +- var w = ws[i] || 0; +- var l = 26; +- +- while (l > 0) { +- cws[j] = cws[j] || 0; +- +- if (seek >= l) { +- cws[j] += w << (18 - seek); +- +- seek -= l; +- if (seek === 0) seek = 18; +- l = 0; +- } else { +- cws[j] += (w & ((1 << seek) - 1)) << (18 - seek); +- w /= 1 << seek; +- +- ++j; +- l -= seek; +- seek = 18; +- } +- } +- } +- +- for (i = 0; i < N; ++i) { +- cws[i] = new Complex(cws[i], 0); +- } ++function _makePlaceHolderA(N) { ++ var ph = new Array(N); ++ for (var i = 0; i < N; ++i) ++ ph[i] = 0; + +- return cws; ++ return ph; + } + +-//function _iconvertTo13(ws, N) { +-// var cws = new Array(N); +-// var carry = 0; +-// +-// var i = 0; +-// for (i = 0; i < N; ++i) { +-// ws[i] = Math.round(ws[i].r / N); +-// } +-// +-// i = 0; +-// for (var j = 0; true; ++j) { +-// +-// if (carry < 0x2000) { +-// if (i === N) +-// break; +-// +-// carry += ws[i]; +-// i++; +-// } +-// +-// var lo = carry & 0x1fff; // Here we don't care about overflow, since +-// // since overflow may only "screw" (trim) high-order +-// // bits, while we're particularly interested in low-order ones +-// +-// //console.log(carry, lo) +-// +-// carry = carry / 0x2000; // Since shift would trigger conversion from +-// // float (64) to int (32) +-// +-// cws[j] = lo; +-// } +-// +-// //for (var i = 0; i < N; i++) { +-// // carry += Math.round(ws[i].r / N); +-// // +-// // +-// // var lo = carry & 0x1fff; // Here we don't care about overflow, since +-// // // since overflow may only "screw" (trim) high-order +-// // // bits, while we're particularly interested in low-order ones +-// // +-// // console.log(carry, lo) +-// // +-// // carry = carry / 0x2000; // Since shift would trigger conversion from +-// // // float (64) to int (32) +-// // +-// // cws[i] = lo; +-// //} +-// +-// return cws; +-//} +- +-BN.prototype.mulTo = function mulTo(num, out) { +- var res; +- //if (this.length + num.length < 63) +- // res = this._smallMulTo(num, out); +- //else +- res = this._bigMulTo(num, out); +- // res = this._bigMulToF(num, out); +- return res; +-}; +- + BN.prototype.mulToF = function mulToF(num, out) { + var res; + //if (this.length + num.length < 63) +@@ -1578,29 +1051,10 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + out.length = this.length + num.length; + + var N = 2 * _guess13(this.length, num.length); +- //var N = _guess13(this.length * 1.3, num.length * 1.3); +- +- //var w = new Complex(Math.cos(2 * π / N), Math.sin(2 * π / N)); +- +- //console.log("-- W -- ", w); +- +- //var thisWFT = new Array(N), +- // numWFT = new Array(N), +- // //multWFT = new Array(N), +- // multW = new Array(N); +- +- //console.log("A, B: ", this, num); + + var rbt = _makeRBT(N); + +- //_FFT(_iconvertToC13(this.words, N), 0, 0, thisWFT, 0, w, N); +- //_FFT(_iconvertToC13(num.words, N), 0, 0, numWFT, 0, w, N); +- //_FFT(_iconvertToC20(this.words, N), 0, 0, thisWFT, 0, w, N); +- //_FFT(_iconvertToC20(num.words, N), 0, 0, numWFT, 0, w, N); +- //_FFT(_iconvertToC18(this.words, N), 0, 0, thisWFT, 0, w, N); +- //_FFT(_iconvertToC18(num.words, N), 0, 0, numWFT, 0, w, N); +- +- var ph = _makePlaceHolderA(N), ++ var _ = _makePlaceHolderA(N), + + rThisWs = new Array(N), + rThisWsT = new Array(N), // T for Transformed +@@ -1615,62 +1069,29 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + _iconvertTo13(this.words, rThisWs, N); + _iconvertTo13(num.words, rNumWs, N); + +- _FFTL(rThisWs, ph, 0, 0, rThisWsT, iThisWsT, 0, 0, N, rbt); +- +- //console.log("X[R/I] Vanilla", _toArray(rThisWs), _toArray(iThisWs)) +- //console.log("X[R/I] Transformed", _toArray(rThisWsT), _toArray(iThisWsT)) +- +- _FFTL(rNumWs, ph, 0, 0, rNumWsT, iNumWsT, 0, 0, N, rbt); +- +- //console.log("Y[R/I] Vanilla", _toArray(rNumWs), _toArray(iNumWs)) +- //console.log("Y[R/I] Transformed", _toArray(rNumWsT), _toArray(iNumWsT)) ++ _FFTL(rThisWs, _, rThisWsT, iThisWsT, N, rbt); ++ _FFTL(rNumWs, _, rNumWsT, iNumWsT, N, rbt); + + for (var i = 0; i < N; ++i) { +- //thisWFT[i].imul(numWFT[i]); + var rx = rThisWsT[i] * rNumWsT[i] - iThisWsT[i] * iNumWsT[i]; + + iThisWsT[i] = rThisWsT[i] * iNumWsT[i] + iThisWsT[i] * rNumWsT[i] + rThisWsT[i] = rx; + } + +- //console.log("X * Y[R/I] Transformed", _toArray(rThisWsT), _toArray(iThisWsT)) +- +- //console.log("-- MULF -- ", multWFT); +- +- //_FFT(_iconjugate(multWFT, N), 0, 0, multW, 0, w, N); ++ _iconjugate(rThisWsT, iThisWsT, N); + +- _iconjugateX(rThisWsT, iThisWsT, N); ++ _FFTL(rThisWsT, iThisWsT, rMultWs, _, N, rbt); + +- //console.log("X * Y[R/I] Transformed Conjugated", _toArray(rThisWsT), _toArray(iThisWsT)) ++ _iconjugate(rMultWs, _, N); + +- _FFTL(rThisWsT, iThisWsT, 0, 0, rMultWs, ph, 0, 0, N, rbt); +- +- //console.log("X * Y[R/I] Inverse FFT", _toArray(rMultWs), _toArray(iMultWs)) +- +- _iconjugateX(rMultWs, ph, N); +- +- _inormalize13X(rMultWs, N); +- +- //console.log("X * Y[R/I] Conjugated Normalized", _toArray(rMultWs), _toArray(iMultWs)) +- +- //multW = _inormalize20(_iconjugate(multW, N), N); +- //multW = _inormalize18(_iconjugate(multW, N), N); ++ _inormalize13(rMultWs, N); + + out.words = rMultWs; + +- //console.log("-- MUL -- ", multW); +- + return out.strip(); + }; + +-function _makePlaceHolderA(N) { +- var ph = new Array(N); +- for (var i = 0; i < N; ++i) +- ph[i] = 0; +- +- return ph; +-} +- + + // Multiply `this` by `num` + BN.prototype.mul = function mul(num) { +diff --git a/test/_fft.js b/test/_fft.js +deleted file mode 100644 +index 40237ed..0000000 +--- a/test/_fft.js ++++ /dev/null +@@ -1,49 +0,0 @@ +-var BN = require("../lib/bn.js").BN +-var fixtures = require("./fixtures.js") +- +-//var a = new BN("1"); +-//var b = new BN("1"); +- +-//var a = new BN("2"); +-//var b = new BN("13"); +- +-//var a = new BN("123"); +-//var b = new BN("123"); +- +-//var a = new BN("12345"); +-//var b = new BN("1"); +- +-//var a = new BN("123456"); +-//var b = new BN("123456"); +- +-//var a = new BN("12345690"); +-//var b = new BN("1234560"); +- +-//var a = new BN("123456900"); +-//var b = new BN("12345601"); +- +-//var a = new BN("0x2000", 16); +-//var b = new BN("12345678"); +- +-//var a = new BN("123456789"); +-//var b = new BN("123456789"); +- +-//var a = new BN( +-// '13f29a3e0bc10e100ce0', 16); +-//var b = a.clone(); +- +- +-var a = new BN(fixtures.dhGroups.p17.q, 16); +-var b = a.clone(); +-var qs = fixtures.dhGroups.p17.qs; +- +-var c = a.mulf(b); +-var c_ = a.mul(b); +- +-//console.log(c.words); +-console.log(c); +-console.log("------") +-//console.log(c_.words); +-console.log(c_); +- +-//assert(c === new BN(2)) + +From 955d90d26efa344490afa0daabf582c1517037da Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Tue, 16 Dec 2014 02:26:35 +0300 +Subject: [PATCH 08/12] Tidying up + +--- + lib/bn.js | 65 +++++++++++++++++++++++++++++---------------------------------- + 1 file changed, 30 insertions(+), 35 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index c1aaedd..745641c 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -898,22 +898,20 @@ BN.prototype.mulTo = function mulTo(num, out) { + + // Private + +-var π = 3.14159265359; +- + function _FFTL(rws, iws, rtws, itws, N, rbt) { + _permuteTo(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { +- var l = s << 1; ++ var l = s << 1; + +- var rtwdf = Math.cos(2 * π / l); +- var itwdf = Math.sin(2 * π / l); ++ var rtwdf = Math.cos(2 * Math.PI / l); ++ var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + +- for (var j = 0; j < s; ++j) { ++ for (var j = 0; j < s; j++) { + + var re = rtws[p + j]; + var ie = itws[p + j]; +@@ -946,7 +944,7 @@ function _FFTL(rws, iws, rtws, itws, N, rbt) { + function _makeRBT(N) { + var t = new Array(N); + var l = (Math.log(N) / Math.log(2)) >> 0; +- for (var i = 0; i < N; ++i) { ++ for (var i = 0; i < N; i++) { + t[i] = _revbin(i, l, N); + } + +@@ -954,7 +952,7 @@ function _makeRBT(N) { + } + + function _permuteTo(rbt, rws, iws, rtws, itws, N) { +- for (var i = 0; i < N; ++i) { ++ for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } +@@ -965,7 +963,7 @@ function _revbin(x, l, N) { + return x; + + var rb = 0; +- for (var i = 0; i < l; ++i) { ++ for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } +@@ -986,33 +984,33 @@ function _guess13(n, m) { + + function _iconjugate(rws, iws, N) { + if (N > 1) { +- for (var i = 0; i < N / 2; ++i) { ++ for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + +- rws[i] = rws[N - i - 1]; +- rws[N - i - 1] = t; ++ rws[i] = rws[N - i - 1]; ++ rws[N - i - 1] = t; + + t = iws[i]; + +- iws[i] = -iws[N - i - 1]; +- iws[N - i - 1] = -t; ++ iws[i] = -iws[N - i - 1]; ++ iws[N - i - 1] = -t; + } + } + } + + function _inormalize13(ws, N) { + var carry = 0; +- for (var i = 0; i < N / 2; ++i) { +- var w = (Math.round(ws[2 * i + 1] / N) * 0x2000) +- + Math.round(ws[2 * i] / N) +- + carry; ++ for (var i = 0; i < N / 2; i++) { ++ var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + ++ Math.round(ws[2 * i] / N) + ++ carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { +- carry = Math.floor(w / 0x4000000); ++ carry = w / 0x4000000 | 0; + } + } + +@@ -1023,14 +1021,14 @@ function _iconvertTo13(ws, rws, N) { + for (var i = 0; i < N / 2; i++) { + var w = ws[i] | 0; + +- rws[2 * i] = w & 0x1fff; +- rws[2 * i + 1] = w >>> 13; ++ rws[2 * i] = w & 0x1fff; ++ rws[2 * i + 1] = w >>> 13; + } + } + + function _makePlaceHolderA(N) { + var ph = new Array(N); +- for (var i = 0; i < N; ++i) ++ for (var i = 0; i < N; i++) + ph[i] = 0; + + return ph; +@@ -1038,10 +1036,7 @@ function _makePlaceHolderA(N) { + + BN.prototype.mulToF = function mulToF(num, out) { + var res; +- //if (this.length + num.length < 63) +- // res = this._smallMulTo(num, out); +- //else +- res = this._bigMulToF(num, out); ++ res = this._bigMulToF(num, out); + return res; + }; + +@@ -1054,17 +1049,17 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + + var rbt = _makeRBT(N); + +- var _ = _makePlaceHolderA(N), ++ var _ = _makePlaceHolderA(N), + +- rThisWs = new Array(N), +- rThisWsT = new Array(N), // T for Transformed +- iThisWsT = new Array(N), ++ rThisWs = new Array(N), ++ rThisWsT = new Array(N), // T for Transformed ++ iThisWsT = new Array(N), + +- rNumWs = new Array(N), +- rNumWsT = new Array(N), +- iNumWsT = new Array(N), ++ rNumWs = new Array(N), ++ rNumWsT = new Array(N), ++ iNumWsT = new Array(N), + +- rMultWs = new Array(N); ++ rMultWs = new Array(N); + + _iconvertTo13(this.words, rThisWs, N); + _iconvertTo13(num.words, rNumWs, N); +@@ -1072,7 +1067,7 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + _FFTL(rThisWs, _, rThisWsT, iThisWsT, N, rbt); + _FFTL(rNumWs, _, rNumWsT, iNumWsT, N, rbt); + +- for (var i = 0; i < N; ++i) { ++ for (var i = 0; i < N; i++) { + var rx = rThisWsT[i] * rNumWsT[i] - iThisWsT[i] * iNumWsT[i]; + + iThisWsT[i] = rThisWsT[i] * iNumWsT[i] + iThisWsT[i] * rNumWsT[i] + +From 22f4a713b509e7166d05ee800de5dff863a3bd7c Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Fri, 19 Dec 2014 20:48:02 +0300 +Subject: [PATCH 09/12] Extracted FFT multiplier as class; Minor cosmetic fixes + +--- + lib/bn.js | 158 ++++++++++++++++++++++++++++++++------------------------------ + 1 file changed, 81 insertions(+), 77 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index 745641c..285a08d 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -898,8 +898,43 @@ BN.prototype.mulTo = function mulTo(num, out) { + + // Private + +-function _FFTL(rws, iws, rtws, itws, N, rbt) { +- _permuteTo(rbt, rws, iws, rtws, itws, N); ++var FFTM = function (x, y) { ++ this.x = x; ++ this.y = y; ++} ++ ++FFTM.prototype.make_rbt = function (N) { ++ var t = new Array(N); ++ var l = (Math.log(N) / Math.log(2)) >> 0; ++ for (var i = 0; i < N; i++) { ++ t[i] = this.revbin(i, l, N); ++ } ++ ++ return t; ++} ++ ++FFTM.prototype.revbin = function (x, l, N) { ++ if (x === 0 || x === N - 1) ++ return x; ++ ++ var rb = 0; ++ for (var i = 0; i < l; i++) { ++ rb |= (x & 1) << (l - i - 1); ++ x >>= 1; ++ } ++ ++ return rb; ++} ++ ++FFTM.prototype.permute = function (rbt, rws, iws, rtws, itws, N) { ++ for (var i = 0; i < N; i++) { ++ rtws[i] = rws[rbt[i]]; ++ itws[i] = iws[rbt[i]]; ++ } ++} ++ ++FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) { ++ this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; +@@ -931,7 +966,7 @@ function _FFTL(rws, iws, rtws, itws, N, rbt) { + itws[p + j + s] = ie - io; + + if (j !== l) { +- var rx = rtwdf * rtwdf_ - itwdf * itwdf_; ++ rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; +@@ -941,48 +976,18 @@ function _FFTL(rws, iws, rtws, itws, N, rbt) { + } + } + +-function _makeRBT(N) { +- var t = new Array(N); +- var l = (Math.log(N) / Math.log(2)) >> 0; +- for (var i = 0; i < N; i++) { +- t[i] = _revbin(i, l, N); +- } +- +- return t; +-} +- +-function _permuteTo(rbt, rws, iws, rtws, itws, N) { +- for (var i = 0; i < N; i++) { +- rtws[i] = rws[rbt[i]]; +- itws[i] = iws[rbt[i]]; +- } +-} +- +-function _revbin(x, l, N) { +- if (x === 0 || x === N - 1) +- return x; +- +- var rb = 0; +- for (var i = 0; i < l; i++) { +- rb |= (x & 1) << (l - i - 1); +- x >>= 1; +- } +- +- return rb; +-} +- +- +-function _guess13(n, m) { +- var N = Math.max(m, n) | 1, odd = N & 1; ++FFTM.prototype.guess_len_13b = function (n, m) { ++ var N = Math.max(m, n) | 1; ++ var odd = N & 1; + var i = 0; + while (N = N / 2 >> 0) { + i++; + } + +- return (1 << i + 1 + odd) ++ return 1 << i + 1 + odd; + } + +-function _iconjugate(rws, iws, N) { ++FFTM.prototype.conjugate = function (rws, iws, N) { + if (N > 1) { + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; +@@ -998,7 +1003,7 @@ function _iconjugate(rws, iws, N) { + } + } + +-function _inormalize13(ws, N) { ++FFTM.prototype.normalize_13b = function (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + +@@ -1017,7 +1022,7 @@ function _inormalize13(ws, N) { + return ws; + } + +-function _iconvertTo13(ws, rws, N) { ++FFTM.prototype.convert_13b = function (ws, rws, N) { + for (var i = 0; i < N / 2; i++) { + var w = ws[i] | 0; + +@@ -1026,46 +1031,39 @@ function _iconvertTo13(ws, rws, N) { + } + } + +-function _makePlaceHolderA(N) { +- var ph = new Array(N); +- for (var i = 0; i < N; i++) +- ph[i] = 0; ++FFTM.prototype.mulp = function () { ++ function stub(N) { ++ var ph = new Array(N); ++ for (var i = 0; i < N; i++) ++ ph[i] = 0; + +- return ph; +-} ++ return ph; ++ } + +-BN.prototype.mulToF = function mulToF(num, out) { +- var res; +- res = this._bigMulToF(num, out); +- return res; +-}; ++ var x = this.x; ++ var y = this.y; + ++ var N = 2 * this.guess_len_13b(x.length, y.length); + +-BN.prototype._bigMulToF = function _bigMulToF(num, out) { +- out.sign = num.sign !== this.sign; +- out.length = this.length + num.length; ++ var rbt = this.make_rbt(N); + +- var N = 2 * _guess13(this.length, num.length); ++ var _ = stub(N), + +- var rbt = _makeRBT(N); ++ rThisWs = new Array(N), ++ rThisWsT = new Array(N), // T for Transformed ++ iThisWsT = new Array(N), + +- var _ = _makePlaceHolderA(N), ++ rNumWs = new Array(N), ++ rNumWsT = new Array(N), ++ iNumWsT = new Array(N), + +- rThisWs = new Array(N), +- rThisWsT = new Array(N), // T for Transformed +- iThisWsT = new Array(N), ++ rMultWs = new Array(N); + +- rNumWs = new Array(N), +- rNumWsT = new Array(N), +- iNumWsT = new Array(N), ++ this.convert_13b(x.words, rThisWs, N); ++ this.convert_13b(y.words, rNumWs, N); + +- rMultWs = new Array(N); +- +- _iconvertTo13(this.words, rThisWs, N); +- _iconvertTo13(num.words, rNumWs, N); +- +- _FFTL(rThisWs, _, rThisWsT, iThisWsT, N, rbt); +- _FFTL(rNumWs, _, rNumWsT, iNumWsT, N, rbt); ++ this.transform(rThisWs, _, rThisWsT, iThisWsT, N, rbt); ++ this.transform(rNumWs, _, rNumWsT, iNumWsT, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rThisWsT[i] * rNumWsT[i] - iThisWsT[i] * iNumWsT[i]; +@@ -1074,15 +1072,22 @@ BN.prototype._bigMulToF = function _bigMulToF(num, out) { + rThisWsT[i] = rx; + } + +- _iconjugate(rThisWsT, iThisWsT, N); ++ this.conjugate(rThisWsT, iThisWsT, N); ++ ++ this.transform(rThisWsT, iThisWsT, rMultWs, _, N, rbt); ++ ++ this.conjugate(rMultWs, _, N); + +- _FFTL(rThisWsT, iThisWsT, rMultWs, _, N, rbt); ++ this.normalize_13b(rMultWs, N); + +- _iconjugate(rMultWs, _, N); ++ return rMultWs; ++} + +- _inormalize13(rMultWs, N); ++BN.prototype._bigMulToF = function _bigMulToF(num, out) { ++ out.sign = num.sign !== this.sign; ++ out.length = this.length + num.length; + +- out.words = rMultWs; ++ out.words = (new FFTM(this, num)).mulp(); + + return out.strip(); + }; +@@ -1098,9 +1103,8 @@ BN.prototype.mul = function mul(num) { + // Multiply employing FFT + BN.prototype.mulf = function mulf(num) { + var out = new BN(null); +- //out.words = new Array(this.length + num.length); + out.words = null; +- return this.mulToF(num, out); ++ return this._bigMulToF(num, out); + }; + + // In-place Multiplication + +From c51b380a9acb25b1c09cb805ec708e836e921a00 Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Sun, 11 Jan 2015 06:12:05 +0300 +Subject: [PATCH 10/12] Minor style fixes + +--- + lib/bn.js | 36 ++++++++++++++++++------------------ + 1 file changed, 18 insertions(+), 18 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index 285a08d..7705741 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -898,12 +898,12 @@ BN.prototype.mulTo = function mulTo(num, out) { + + // Private + +-var FFTM = function (x, y) { ++function FFTM(x, y) { + this.x = x; + this.y = y; + } + +-FFTM.prototype.make_rbt = function (N) { ++FFTM.prototype.makeRBT = function makeRBT(N) { + var t = new Array(N); + var l = (Math.log(N) / Math.log(2)) >> 0; + for (var i = 0; i < N; i++) { +@@ -913,7 +913,7 @@ FFTM.prototype.make_rbt = function (N) { + return t; + } + +-FFTM.prototype.revbin = function (x, l, N) { ++FFTM.prototype.revbin = function revbin(x, l, N) { + if (x === 0 || x === N - 1) + return x; + +@@ -926,14 +926,14 @@ FFTM.prototype.revbin = function (x, l, N) { + return rb; + } + +-FFTM.prototype.permute = function (rbt, rws, iws, rtws, itws, N) { ++FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + } + +-FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) { ++FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { +@@ -947,7 +947,6 @@ FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) { + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { +- + var re = rtws[p + j]; + var ie = itws[p + j]; + +@@ -976,7 +975,7 @@ FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) { + } + } + +-FFTM.prototype.guess_len_13b = function (n, m) { ++FFTM.prototype.guessLen13b = function guessLen13b(n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; +@@ -988,18 +987,19 @@ FFTM.prototype.guess_len_13b = function (n, m) { + } + + FFTM.prototype.conjugate = function (rws, iws, N) { +- if (N > 1) { +- for (var i = 0; i < N / 2; i++) { +- var t = rws[i]; ++ if (N <= 1) ++ return; + +- rws[i] = rws[N - i - 1]; +- rws[N - i - 1] = t; ++ for (var i = 0; i < N / 2; i++) { ++ var t = rws[i]; + +- t = iws[i]; ++ rws[i] = rws[N - i - 1]; ++ rws[N - i - 1] = t; + +- iws[i] = -iws[N - i - 1]; +- iws[N - i - 1] = -t; +- } ++ t = iws[i]; ++ ++ iws[i] = -iws[N - i - 1]; ++ iws[N - i - 1] = -t; + } + } + +@@ -1043,9 +1043,9 @@ FFTM.prototype.mulp = function () { + var x = this.x; + var y = this.y; + +- var N = 2 * this.guess_len_13b(x.length, y.length); ++ var N = 2 * this.guessLen13b(x.length, y.length); + +- var rbt = this.make_rbt(N); ++ var rbt = this.makeRBT(N); + + var _ = stub(N), + + +From 72f5498499baec7b4052550892ca52caff33d21c Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Mon, 12 Jan 2015 17:21:43 +0300 +Subject: [PATCH 11/12] Continuous style fixes + +--- + lib/bn.js | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index 7705741..7081948 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -905,7 +905,7 @@ function FFTM(x, y) { + + FFTM.prototype.makeRBT = function makeRBT(N) { + var t = new Array(N); +- var l = (Math.log(N) / Math.log(2)) >> 0; ++ var l = (Math.log(N) / Math.log(2)) | 0; + for (var i = 0; i < N; i++) { + t[i] = this.revbin(i, l, N); + } +@@ -979,7 +979,7 @@ FFTM.prototype.guessLen13b = function guessLen13b(n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; +- while (N = N / 2 >> 0) { ++ while (N = N / 2 | 0) { + i++; + } + +@@ -1003,7 +1003,7 @@ FFTM.prototype.conjugate = function (rws, iws, N) { + } + } + +-FFTM.prototype.normalize_13b = function (ws, N) { ++FFTM.prototype.normalize13b = function (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + +@@ -1022,7 +1022,7 @@ FFTM.prototype.normalize_13b = function (ws, N) { + return ws; + } + +-FFTM.prototype.convert_13b = function (ws, rws, N) { ++FFTM.prototype.convert13b = function (ws, rws, N) { + for (var i = 0; i < N / 2; i++) { + var w = ws[i] | 0; + +@@ -1059,8 +1059,8 @@ FFTM.prototype.mulp = function () { + + rMultWs = new Array(N); + +- this.convert_13b(x.words, rThisWs, N); +- this.convert_13b(y.words, rNumWs, N); ++ this.convert13b(x.words, rThisWs, N); ++ this.convert13b(y.words, rNumWs, N); + + this.transform(rThisWs, _, rThisWsT, iThisWsT, N, rbt); + this.transform(rNumWs, _, rNumWsT, iNumWsT, N, rbt); +@@ -1078,7 +1078,7 @@ FFTM.prototype.mulp = function () { + + this.conjugate(rMultWs, _, N); + +- this.normalize_13b(rMultWs, N); ++ this.normalize13b(rMultWs, N); + + return rMultWs; + } +@@ -1086,7 +1086,6 @@ FFTM.prototype.mulp = function () { + BN.prototype._bigMulToF = function _bigMulToF(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; +- + out.words = (new FFTM(this, num)).mulp(); + + return out.strip(); +@@ -1103,7 +1102,6 @@ BN.prototype.mul = function mul(num) { + // Multiply employing FFT + BN.prototype.mulf = function mulf(num) { + var out = new BN(null); +- out.words = null; + return this._bigMulToF(num, out); + }; + + +From b3b5d959b6cb9dd2f8fc270fe8a64b9a54151d1c Mon Sep 17 00:00:00 2001 +From: Alexey Kudinkin +Date: Mon, 9 Feb 2015 23:43:13 +0300 +Subject: [PATCH 12/12] Sligthly refurbished overall style; Fixed lint issues + +--- + lib/bn.js | 63 +++++++++++++++++++++++++++++++-------------------------------- + 1 file changed, 31 insertions(+), 32 deletions(-) + +diff --git a/lib/bn.js b/lib/bn.js +index 7081948..5b553e4 100644 +--- a/lib/bn.js ++++ b/lib/bn.js +@@ -911,7 +911,7 @@ FFTM.prototype.makeRBT = function makeRBT(N) { + } + + return t; +-} ++}; + + FFTM.prototype.revbin = function revbin(x, l, N) { + if (x === 0 || x === N - 1) +@@ -924,14 +924,14 @@ FFTM.prototype.revbin = function revbin(x, l, N) { + } + + return rb; +-} ++}; + + FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } +-} ++}; + + FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); +@@ -964,6 +964,7 @@ FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) { + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + ++ /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + +@@ -973,18 +974,18 @@ FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) { + } + } + } +-} ++}; + + FFTM.prototype.guessLen13b = function guessLen13b(n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; +- while (N = N / 2 | 0) { ++ for (N = N / 2 | 0; N; N = N / 2 | 0) { + i++; + } + + return 1 << i + 1 + odd; +-} ++}; + + FFTM.prototype.conjugate = function (rws, iws, N) { + if (N <= 1) +@@ -1001,7 +1002,7 @@ FFTM.prototype.conjugate = function (rws, iws, N) { + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } +-} ++}; + + FFTM.prototype.normalize13b = function (ws, N) { + var carry = 0; +@@ -1020,7 +1021,7 @@ FFTM.prototype.normalize13b = function (ws, N) { + } + + return ws; +-} ++}; + + FFTM.prototype.convert13b = function (ws, rws, N) { + for (var i = 0; i < N / 2; i++) { +@@ -1029,7 +1030,7 @@ FFTM.prototype.convert13b = function (ws, rws, N) { + rws[2 * i] = w & 0x1fff; + rws[2 * i + 1] = w >>> 13; + } +-} ++}; + + FFTM.prototype.mulp = function () { + function stub(N) { +@@ -1047,47 +1048,45 @@ FFTM.prototype.mulp = function () { + + var rbt = this.makeRBT(N); + +- var _ = stub(N), ++ var _ = stub(N); + +- rThisWs = new Array(N), +- rThisWsT = new Array(N), // T for Transformed +- iThisWsT = new Array(N), ++ var rws = new Array(N); ++ var rwst = new Array(N); ++ var iwst = new Array(N); + +- rNumWs = new Array(N), +- rNumWsT = new Array(N), +- iNumWsT = new Array(N), ++ var nrws = new Array(N); ++ var nrwst = new Array(N); ++ var niwst = new Array(N); + +- rMultWs = new Array(N); ++ var rmws = new Array(N); + +- this.convert13b(x.words, rThisWs, N); +- this.convert13b(y.words, rNumWs, N); ++ this.convert13b(x.words, rws, N); ++ this.convert13b(y.words, nrws, N); + +- this.transform(rThisWs, _, rThisWsT, iThisWsT, N, rbt); +- this.transform(rNumWs, _, rNumWsT, iNumWsT, N, rbt); ++ this.transform(rws, _, rwst, iwst, N, rbt); ++ this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { +- var rx = rThisWsT[i] * rNumWsT[i] - iThisWsT[i] * iNumWsT[i]; +- +- iThisWsT[i] = rThisWsT[i] * iNumWsT[i] + iThisWsT[i] * rNumWsT[i] +- rThisWsT[i] = rx; ++ var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; ++ iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; ++ rwst[i] = rx; + } + +- this.conjugate(rThisWsT, iThisWsT, N); ++ this.conjugate(rwst, iwst, N); + +- this.transform(rThisWsT, iThisWsT, rMultWs, _, N, rbt); ++ this.transform(rwst, iwst, rmws, _, N, rbt); + +- this.conjugate(rMultWs, _, N); ++ this.conjugate(rmws, _, N); + +- this.normalize13b(rMultWs, N); ++ this.normalize13b(rmws, N); + +- return rMultWs; +-} ++ return rmws; ++}; + + BN.prototype._bigMulToF = function _bigMulToF(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + out.words = (new FFTM(this, num)).mulp(); +- + return out.strip(); + }; + diff --git a/node_modules/bn.js/README.md b/node_modules/bn.js/README.md new file mode 100644 index 00000000..936b05e2 --- /dev/null +++ b/node_modules/bn.js/README.md @@ -0,0 +1,127 @@ +# bn.js + +> BigNum in pure javascript + +[![Build Status](https://secure.travis-ci.org/indutny/bn.js.png)](http://travis-ci.org/indutny/bn.js) + +## Install +`npm install --save bn.js` + +## API + +```js +const BN = require('bn.js'); + +// Numbers +new BN(12345); // +new BN(0x4123456); // + +// Strings +new BN('FF', 16); // +new BN('1A6B765D8CDF', 16); // + +// Big endian +new BN([1,2,3,4]); // +new BN([1,2,3,4]).toArray().join(','); // + +// Little endian +new BN([1,2,3], 10, 'le'); // +new BN([1,2,3,4], 10, 'le'); // + +// bitLength +new BN(0x123456).bitLength(); // +new BN('123456789', 16).bitLength(); // + +// zeroBits +new BN('11000', 2).zeroBits(); // 3 + +// iaddn +new BN(-100).sign; // true +new BN(100).sign; // false + +// isubn +new BN(-100).isubn(200) // + +// add +new BN(14).add(new BN(26)); // + +// mul +new BN(0x1001).mul(new BN(0x1234)); // + +// div +new BN('-69527932928').div(new BN('16974594')); // + +// mod +new BN('10').mod(new BN(256)); // + +// divRound +new BN(9).divRound(new BN(20)).toString(10); // + +// abs +new BN(0x1001).abs(); // + +// modn +new BN('10', 16).modn(256); // + +// idivn +new BN('10', 16).idivn(3); // + +// shl +new BN('69527932928').shln(13); // + +// shrn +new BN('69527932928').shrn(13); // + +// bincn +new BN(0xffffff).bincn(1); // + +// imaskn +new BN('123456789', 16).imaskn(4); // + +// gcd +new BN(-18).gcd(new BN(12)); // + +// iand +(new BN('1', 2) +.iand(new BN('1000000000000000000000000000000000000001', 2)) +.toString(2); // '1' + +// ior +new BN('1', 2) +.ior(new BN('1000000000000000000000000000000000000000', 2)); +// + +// ixor +new BN('1', 2) +.ixor(new BN('11001100110011001100110011001100', 2)); +// + +// setn +new BN(0).setn(2, true); // + +``` + +## LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2015. + +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/node_modules/bn.js/lib/bn.js b/node_modules/bn.js/lib/bn.js new file mode 100644 index 00000000..abe164c5 --- /dev/null +++ b/node_modules/bn.js/lib/bn.js @@ -0,0 +1,2290 @@ +(function (module, exports) { + +'use strict'; + +// Utils + +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} + +// Could use `inherits` module, but don't want to move from single file +// architecture yet. +function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; +} + +// BN + +function BN(number, base, endian) { + // May be `new BN(bn)` ? + if (number !== null && + typeof number === 'object' && + Array.isArray(number.words)) { + return number; + } + + this.sign = false; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + if (number !== null) + this._init(number || 0, base || 10, endian || 'be'); +} +if (typeof module === 'object') + module.exports = BN; +else + exports.BN = BN; + +BN.BN = BN; +BN.wordSize = 26; + +BN.prototype._init = function init(number, base, endian) { + if (typeof number === 'number') { + if (number < 0) { + this.sign = true; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + return; + } else if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + if (base === 'hex') + base = 16; + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') + start++; + + if (base === 16) + this._parseHex(number, start); + else + this._parseBase(number, base, start); + + if (number[0] === '-') + this.sign = true; + + this.strip(); +}; + +BN.prototype._initArray = function _initArray(number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [ 0 ]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + var off = 0; + if (endian === 'be') { + for (var i = number.length - 1, j = 0; i >= 0; i -= 3) { + var w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (var i = 0, j = 0; i < number.length; i += 3) { + var w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); +}; + +function parseHex(str, start, end) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r <<= 4; + + // 'a' - 'f' + if (c >= 49 && c <= 54) + r |= c - 49 + 0xa; + + // 'A' - 'F' + else if (c >= 17 && c <= 22) + r |= c - 17 + 0xa; + + // '0' - '9' + else + r |= c & 0xf; + } + return r; +} + +BN.prototype._parseHex = function _parseHex(number, start) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + // Scan 24-bit chunks and add them to the number + var off = 0; + for (var i = number.length - 6, j = 0; i >= start; i -= 6) { + var w = parseHex(number, i, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + if (i + 6 !== start) { + var w = parseHex(number, start, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + } + this.strip(); +}; + +function parseBase(str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) + r += c - 49 + 0xa; + + // 'A' + else if (c >= 17) + r += c - 17 + 0xa; + + // '0' - '9' + else + r += c; + } + return r; +} + +BN.prototype._parseBase = function _parseBase(number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) + limbLen++; + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } + + if (mod !== 0) { + var pow = 1; + var word = parseBase(number, i, number.length, base); + + for (var i = 0; i < mod; i++) + pow *= base; + this.imuln(pow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } +}; + +BN.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + dest.words[i] = this.words[i]; + dest.length = this.length; + dest.sign = this.sign; + dest.red = this.red; +}; + +BN.prototype.clone = function clone() { + var r = new BN(null); + this.copy(r); + return r; +}; + +// Remove leading `0` from `this` +BN.prototype.strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) + this.length--; + return this._normSign(); +}; + +BN.prototype._normSign = function _normSign() { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) + this.sign = false; + return this; +}; + +BN.prototype.inspect = function inspect() { + return (this.red ? ''; +}; + +/* + +var zeros = []; +var groupSizes = []; +var groupBases = []; + +var s = ''; +var i = -1; +while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; +} +groupSizes[0] = 0; +groupSizes[1] = 0; +groupBases[0] = 0; +groupBases[1] = 0; +var base = 2 - 1; +while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; +} + +*/ + +var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' +]; + +var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +]; + +var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 +]; + +BN.prototype.toString = function toString(base, padding) { + base = base || 10; + if (base === 16 || base === 'hex') { + var out = ''; + var off = 0; + var padding = padding | 0 || 1; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) + out = zeros[6 - word.length] + word + out; + else + out = word + out; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) + out = carry.toString(16) + out; + while (out.length % padding !== 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + var out = ''; + var c = this.clone(); + c.sign = false; + while (c.cmpn(0) !== 0) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (c.cmpn(0) !== 0) + out = zeros[groupSize - r.length] + r + out; + else + out = r + out; + } + if (this.cmpn(0) === 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else { + assert(false, 'Base should be between 2 and 36'); + } +}; + +BN.prototype.toJSON = function toJSON() { + return this.toString(16); +}; + +BN.prototype.toArray = function toArray() { + this.strip(); + var res = new Array(this.byteLength()); + res[0] = 0; + + var q = this.clone(); + for (var i = 0; q.cmpn(0) !== 0; i++) { + var b = q.andln(0xff); + q.ishrn(8); + + // Assume big-endian + res[res.length - i - 1] = b; + } + + return res; +}; + +if (Math.clz32) { + BN.prototype._countBits = function _countBits(w) { + return 32 - Math.clz32(w); + }; +} else { + BN.prototype._countBits = function _countBits(w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; +} + +BN.prototype._zeroBits = function _zeroBits(w) { + // Short-cut + if (w === 0) + return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) + r++; + return r; +}; + +// Return number of used bits in a BN +BN.prototype.bitLength = function bitLength() { + var hi = 0; + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; +}; + +// Number of trailing zero bits +BN.prototype.zeroBits = function zeroBits() { + if (this.cmpn(0) === 0) + return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) + break; + } + return r; +}; + +BN.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); +}; + +// Return negative clone of `this` +BN.prototype.neg = function neg() { + if (this.cmpn(0) === 0) + return this.clone(); + + var r = this.clone(); + r.sign = !this.sign; + return r; +}; + + +// Or `num` with `this` in-place +BN.prototype.ior = function ior(num) { + this.sign = this.sign || num.sign; + + while (this.length < num.length) + this.words[this.length++] = 0; + + for (var i = 0; i < num.length; i++) + this.words[i] = this.words[i] | num.words[i]; + + return this.strip(); +}; + + +// Or `num` with `this` +BN.prototype.or = function or(num) { + if (this.length > num.length) + return this.clone().ior(num); + else + return num.clone().ior(this); +}; + + +// And `num` with `this` in-place +BN.prototype.iand = function iand(num) { + this.sign = this.sign && num.sign; + + // b = min-length(num, this) + var b; + if (this.length > num.length) + b = num; + else + b = this; + + for (var i = 0; i < b.length; i++) + this.words[i] = this.words[i] & num.words[i]; + + this.length = b.length; + + return this.strip(); +}; + + +// And `num` with `this` +BN.prototype.and = function and(num) { + if (this.length > num.length) + return this.clone().iand(num); + else + return num.clone().iand(this); +}; + + +// Xor `num` with `this` in-place +BN.prototype.ixor = function ixor(num) { + this.sign = this.sign || num.sign; + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) + this.words[i] = a.words[i] ^ b.words[i]; + + if (this !== a) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + + this.length = a.length; + + return this.strip(); +}; + + +// Xor `num` with `this` +BN.prototype.xor = function xor(num) { + if (this.length > num.length) + return this.clone().ixor(num); + else + return num.clone().ixor(this); +}; + + +// Set `bit` of `this` +BN.prototype.setn = function setn(bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + while (this.length <= off) + this.words[this.length++] = 0; + + if (val) + this.words[off] = this.words[off] | (1 << wbit); + else + this.words[off] = this.words[off] & ~(1 << wbit); + + return this.strip(); +}; + + +// Add `num` to `this` in-place +BN.prototype.iadd = function iadd(num) { + // negative + positive + if (this.sign && !num.sign) { + this.sign = false; + var r = this.isub(num); + this.sign = !this.sign; + return this._normSign(); + + // positive + negative + } else if (!this.sign && num.sign) { + num.sign = false; + var r = this.isub(num); + num.sign = true; + return r._normSign(); + } + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] + b.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) + this.words[i] = a.words[i]; + } + + return this; +}; + +// Add `num` to `this` +BN.prototype.add = function add(num) { + if (num.sign && !this.sign) { + num.sign = false; + var res = this.sub(num); + num.sign = true; + return res; + } else if (!num.sign && this.sign) { + this.sign = false; + var res = num.sub(this); + this.sign = true; + return res; + } + + if (this.length > num.length) + return this.clone().iadd(num); + else + return num.clone().iadd(this); +}; + +// Subtract `num` from `this` in-place +BN.prototype.isub = function isub(num) { + // this - (-num) = this + num + if (num.sign) { + num.sign = false; + var r = this.iadd(num); + num.sign = true; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.sign) { + this.sign = false; + this.iadd(num); + this.sign = true; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.sign = false; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a; + var b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] - b.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + this.length = Math.max(this.length, i); + + if (a !== this) + this.sign = true; + + return this.strip(); +}; + +// Subtract `num` from `this` +BN.prototype.sub = function sub(num) { + return this.clone().isub(num); +}; + +/* +// NOTE: This could be potentionally used to generate loop-less multiplications +function _genCombMulTo(alen, blen) { + var len = alen + blen - 1; + var src = [ + 'var a = this.words, b = num.words, o = out.words, c = 0, w, ' + + 'mask = 0x3ffffff, shift = 0x4000000;', + 'out.length = ' + len + ';' + ]; + for (var k = 0; k < len; k++) { + var minJ = Math.max(0, k - alen + 1); + var maxJ = Math.min(k, blen - 1); + + for (var j = minJ; j <= maxJ; j++) { + var i = k - j; + var mul = 'a[' + i + '] * b[' + j + ']'; + + if (j === minJ) { + src.push('w = ' + mul + ' + c;'); + src.push('c = (w / shift) | 0;'); + } else { + src.push('w += ' + mul + ';'); + src.push('c += (w / shift) | 0;'); + } + src.push('w &= mask;'); + } + src.push('o[' + k + '] = w;'); + } + src.push('if (c !== 0) {', + ' o[' + k + '] = c;', + ' out.length++;', + '}', + 'return out;'); + + return src.join('\n'); +} +*/ + +BN.prototype._smallMulTo = function _smallMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + } + out.words[k] = rword; + carry = ncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype._bigMulTo = function _bigMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype.mulTo = function mulTo(num, out) { + var res; + if (this.length + num.length < 63) + res = this._smallMulTo(num, out); + else + res = this._bigMulTo(num, out); + return res; +}; + +// Multiply `this` by `num` +BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); +}; + +// In-place Multiplication +BN.prototype.imul = function imul(num) { + if (this.cmpn(0) === 0 || num.cmpn(0) === 0) { + this.words[0] = 0; + this.length = 1; + return this; + } + + var tlen = this.length; + var nlen = num.length; + + this.sign = num.sign !== this.sign; + this.length = this.length + num.length; + this.words[this.length - 1] = 0; + + for (var k = this.length - 2; k >= 0; k--) { + // Sum all words with the same `i + j = k` and accumulate `carry`, + // note that carry could be >= 0x3ffffff + var carry = 0; + var rword = 0; + var maxJ = Math.min(k, nlen - 1); + for (var j = Math.max(0, k - tlen + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i]; + var b = num.words[j]; + var r = a * b; + + var lo = r & 0x3ffffff; + carry += (r / 0x4000000) | 0; + lo += rword; + rword = lo & 0x3ffffff; + carry += lo >>> 26; + } + this.words[k] = rword; + this.words[k + 1] += carry; + carry = 0; + } + + // Propagate overflows + var carry = 0; + for (var i = 1; i < this.length; i++) { + var w = this.words[i] + carry; + this.words[i] = w & 0x3ffffff; + carry = w >>> 26; + } + + return this.strip(); +}; + +BN.prototype.imuln = function imuln(num) { + assert(typeof num === 'number'); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i] * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; +}; + +// `this` * `this` +BN.prototype.sqr = function sqr() { + return this.mul(this); +}; + +// `this` * `this` in-place +BN.prototype.isqr = function isqr() { + return this.mul(this); +}; + +// Shift-left in-place +BN.prototype.ishln = function ishln(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + + if (r !== 0) { + var carry = 0; + for (var i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = (this.words[i] - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (var i = this.length - 1; i >= 0; i--) + this.words[i + s] = this.words[i]; + for (var i = 0; i < s; i++) + this.words[i] = 0; + this.length += s; + } + + return this.strip(); +}; + +// Shift-right in-place +// NOTE: `hint` is a lowest bit before trailing zeroes +// NOTE: if `extended` is present - it will be filled with destroyed bits +BN.prototype.ishrn = function ishrn(bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) + h = (hint - (hint % 26)) / 26; + else + h = 0; + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) + maskedWords.words[i] = this.words[i]; + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (var i = 0; i < this.length; i++) + this.words[i] = this.words[i + s]; + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (var i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i]; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) + maskedWords.words[maskedWords.length++] = carry; + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + this.strip(); + + return this; +}; + +// Shift-left +BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); +}; + +// Shift-right +BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); +}; + +// Test if n bit is set +BN.prototype.testn = function testn(bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + return false; + } + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); +}; + +// Return only lowers bits of number (in-place) +BN.prototype.imaskn = function imaskn(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(!this.sign, 'imaskn works only with positive numbers'); + + if (r !== 0) + s++; + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); +}; + +// Return only lowers bits of number +BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); +}; + +// Add plain number `num` to `this` +BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.isubn(-num); + + // Possible sign change + if (this.sign) { + if (this.length === 1 && this.words[0] < num) { + this.words[0] = num - this.words[0]; + this.sign = false; + return this; + } + + this.sign = false; + this.isubn(num); + this.sign = true; + return this; + } + + // Add without checks + return this._iaddn(num); +}; + +BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) + this.words[i + 1] = 1; + else + this.words[i + 1]++; + } + this.length = Math.max(this.length, i + 1); + + return this; +}; + +// Subtract plain number `num` from `this` +BN.prototype.isubn = function isubn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.iaddn(-num); + + if (this.sign) { + this.sign = false; + this.iaddn(num); + this.sign = true; + return this; + } + + this.words[0] -= num; + + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + + return this.strip(); +}; + +BN.prototype.addn = function addn(num) { + return this.clone().iaddn(num); +}; + +BN.prototype.subn = function subn(num) { + return this.clone().isubn(num); +}; + +BN.prototype.iabs = function iabs() { + this.sign = false; + + return this; +}; + +BN.prototype.abs = function abs() { + return this.clone().iabs(); +}; + +BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) { + // Bigger storage is needed + var len = num.length + shift; + var i; + if (this.words.length < len) { + var t = new Array(len); + for (var i = 0; i < this.length; i++) + t[i] = this.words[i]; + this.words = t; + } else { + i = this.length; + } + + // Zeroify rest + this.length = Math.max(this.length, len); + for (; i < this.length; i++) + this.words[i] = 0; + + var carry = 0; + for (var i = 0; i < num.length; i++) { + var w = this.words[i + shift] + carry; + var right = num.words[i] * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + var w = this.words[i + shift] + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) + return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (var i = 0; i < this.length; i++) { + var w = -this.words[i] + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.sign = true; + + return this.strip(); +}; + +BN.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1]; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.shln(shift); + a.ishln(shift); + bhi = b.words[b.length - 1]; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) + q.words[i] = 0; + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (!diff.sign) { + a = diff; + if (q) + q.words[m] = 1; + } + + for (var j = m - 1; j >= 0; j--) { + var qj = a.words[b.length + j] * 0x4000000 + a.words[b.length + j - 1]; + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.sign) { + qj--; + a.sign = false; + a._ishlnsubmul(b, 1, j); + if (a.cmpn(0) !== 0) + a.sign = !a.sign; + } + if (q) + q.words[j] = qj; + } + if (q) + q.strip(); + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) + a.ishrn(shift); + return { div: q ? q : null, mod: a }; +}; + +BN.prototype.divmod = function divmod(num, mode) { + assert(num.cmpn(0) !== 0); + + if (this.sign && !num.sign) { + var res = this.neg().divmod(num, mode); + var div; + var mod; + if (mode !== 'mod') + div = res.div.neg(); + if (mode !== 'div') + mod = res.mod.cmpn(0) === 0 ? res.mod : num.sub(res.mod); + return { + div: div, + mod: mod + }; + } else if (!this.sign && num.sign) { + var res = this.divmod(num.neg(), mode); + var div; + if (mode !== 'mod') + div = res.div.neg(); + return { div: div, mod: res.mod }; + } else if (this.sign && num.sign) { + return this.neg().divmod(num.neg(), mode); + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) + return { div: new BN(0), mod: this }; + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') + return { div: this.divn(num.words[0]), mod: null }; + else if (mode === 'mod') + return { div: null, mod: new BN(this.modn(num.words[0])) }; + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); +}; + +// Find `this` / `num` +BN.prototype.div = function div(num) { + return this.divmod(num, 'div').div; +}; + +// Find `this` % `num` +BN.prototype.mod = function mod(num) { + return this.divmod(num, 'mod').mod; +}; + +// Find Round(`this` / `num`) +BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.cmpn(0) === 0) + return dm.div; + + var mod = dm.div.sign ? dm.mod.isub(num) : dm.mod; + + var half = num.shrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) + return dm.div; + + // Round up + return dm.div.sign ? dm.div.isubn(1) : dm.div.iaddn(1); +}; + +BN.prototype.modn = function modn(num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) + acc = (p * acc + this.words[i]) % num; + + return acc; +}; + +// In-place division by number +BN.prototype.idivn = function idivn(num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = this.words[i] + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); +}; + +BN.prototype.divn = function divn(num) { + return this.clone().idivn(num); +}; + +BN.prototype.egcd = function egcd(p) { + assert(!p.sign); + assert(p.cmpn(0) !== 0); + + var x = this; + var y = p.clone(); + + if (x.sign) + x = x.mod(p); + else + x = x.clone(); + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.ishrn(1); + y.ishrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (x.cmpn(0) !== 0) { + while (x.isEven()) { + x.ishrn(1); + if (A.isEven() && B.isEven()) { + A.ishrn(1); + B.ishrn(1); + } else { + A.iadd(yp).ishrn(1); + B.isub(xp).ishrn(1); + } + } + + while (y.isEven()) { + y.ishrn(1); + if (C.isEven() && D.isEven()) { + C.ishrn(1); + D.ishrn(1); + } else { + C.iadd(yp).ishrn(1); + D.isub(xp).ishrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.ishln(g) + }; +}; + +// This is reduced incarnation of the binary EEA +// above, designated to invert members of the +// _prime_ fields F(p) at a maximal speed +BN.prototype._invmp = function _invmp(p) { + assert(!p.sign); + assert(p.cmpn(0) !== 0); + + var a = this; + var b = p.clone(); + + if (a.sign) + a = a.mod(p); + else + a = a.clone(); + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + while (a.isEven()) { + a.ishrn(1); + if (x1.isEven()) + x1.ishrn(1); + else + x1.iadd(delta).ishrn(1); + } + while (b.isEven()) { + b.ishrn(1); + if (x2.isEven()) + x2.ishrn(1); + else + x2.iadd(delta).ishrn(1); + } + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + if (a.cmpn(1) === 0) + return x1; + else + return x2; +}; + +BN.prototype.gcd = function gcd(num) { + if (this.cmpn(0) === 0) + return num.clone(); + if (num.cmpn(0) === 0) + return this.clone(); + + var a = this.clone(); + var b = num.clone(); + a.sign = false; + b.sign = false; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.ishrn(1); + b.ishrn(1); + } + + do { + while (a.isEven()) + a.ishrn(1); + while (b.isEven()) + b.ishrn(1); + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.ishln(shift); +}; + +// Invert number in the field F(num) +BN.prototype.invm = function invm(num) { + return this.egcd(num).a.mod(num); +}; + +BN.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; +}; + +BN.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; +}; + +// And first word and num +BN.prototype.andln = function andln(num) { + return this.words[0] & num; +}; + +// Increment at the bit position in-line +BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + for (var i = this.length; i < s + 1; i++) + this.words[i] = 0; + this.words[s] |= q; + this.length = s + 1; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i]; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; +}; + +BN.prototype.cmpn = function cmpn(num) { + var sign = num < 0; + if (sign) + num = -num; + + if (this.sign && !sign) + return -1; + else if (!this.sign && sign) + return 1; + + num &= 0x3ffffff; + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + var w = this.words[0]; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.sign) + res = -res; + return res; +}; + +// Compare two numbers and return: +// 1 - if `this` > `num` +// 0 - if `this` == `num` +// -1 - if `this` < `num` +BN.prototype.cmp = function cmp(num) { + if (this.sign && !num.sign) + return -1; + else if (!this.sign && num.sign) + return 1; + + var res = this.ucmp(num); + if (this.sign) + return -res; + else + return res; +}; + +// Unsigned comparison +BN.prototype.ucmp = function ucmp(num) { + // At this point both numbers have the same sign + if (this.length > num.length) + return 1; + else if (this.length < num.length) + return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i]; + var b = num.words[i]; + + if (a === b) + continue; + if (a < b) + res = -1; + else if (a > b) + res = 1; + break; + } + return res; +}; + +// +// A reduce context, could be using montgomery or something better, depending +// on the `m` itself. +// +BN.red = function red(num) { + return new Red(num); +}; + +BN.prototype.toRed = function toRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(!this.sign, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); +}; + +BN.prototype.fromRed = function fromRed() { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); +}; + +BN.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; +}; + +BN.prototype.forceRed = function forceRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); +}; + +BN.prototype.redAdd = function redAdd(num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); +}; + +BN.prototype.redIAdd = function redIAdd(num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); +}; + +BN.prototype.redSub = function redSub(num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); +}; + +BN.prototype.redISub = function redISub(num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); +}; + +BN.prototype.redShl = function redShl(num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); +}; + +BN.prototype.redMul = function redMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); +}; + +BN.prototype.redIMul = function redIMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); +}; + +BN.prototype.redSqr = function redSqr() { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); +}; + +BN.prototype.redISqr = function redISqr() { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); +}; + +// Square root over p +BN.prototype.redSqrt = function redSqrt() { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); +}; + +BN.prototype.redInvm = function redInvm() { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); +}; + +// Return negative clone of `this` % `red modulo` +BN.prototype.redNeg = function redNeg() { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); +}; + +BN.prototype.redPow = function redPow(num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); +}; + +// Prime numbers with efficient reduction +var primes = { + k256: null, + p224: null, + p192: null, + p25519: null +}; + +// Pseudo-Mersenne prime +function MPrime(name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).ishln(this.n).isub(this.p); + + this.tmp = this._tmp(); +} + +MPrime.prototype._tmp = function _tmp() { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; +}; + +MPrime.prototype.ireduce = function ireduce(num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + r.strip(); + } + + return r; +}; + +MPrime.prototype.split = function split(input, out) { + input.ishrn(this.n, 0, out); +}; + +MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); +}; + +function K256() { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); +} +inherits(K256, MPrime); + +K256.prototype.split = function split(input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) + output.words[i] = input.words[i]; + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (var i = 10; i < input.length; i++) { + var next = input.words[i]; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + input.words[i - 10] = prev >>> 22; + input.length -= 9; +}; + +K256.prototype.imulK = function imulK(num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var hi; + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i]; + hi = w * 0x40; + lo += w * 0x3d1; + hi += (lo / 0x4000000) | 0; + lo &= 0x3ffffff; + + num.words[i] = lo; + + lo = hi; + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) + num.length--; + } + return num; +}; + +function P224() { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); +} +inherits(P224, MPrime); + +function P192() { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); +} +inherits(P192, MPrime); + +function P25519() { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); +} +inherits(P25519, MPrime); + +P25519.prototype.imulK = function imulK(num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = num.words[i] * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) + num.words[num.length++] = carry; + return num; +}; + +// Exported mostly for testing purposes, use plain name instead +BN._prime = function prime(name) { + // Cached version of prime + if (primes[name]) + return primes[name]; + + var prime; + if (name === 'k256') + prime = new K256(); + else if (name === 'p224') + prime = new P224(); + else if (name === 'p192') + prime = new P192(); + else if (name === 'p25519') + prime = new P25519(); + else + throw new Error('Unknown prime ' + name); + primes[name] = prime; + + return prime; +}; + +// +// Base reduction engine +// +function Red(m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + this.m = m; + this.prime = null; + } +} + +Red.prototype._verify1 = function _verify1(a) { + assert(!a.sign, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); +}; + +Red.prototype._verify2 = function _verify2(a, b) { + assert(!a.sign && !b.sign, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); +}; + +Red.prototype.imod = function imod(a) { + if (this.prime) + return this.prime.ireduce(a)._forceRed(this); + return a.mod(this.m)._forceRed(this); +}; + +Red.prototype.neg = function neg(a) { + var r = a.clone(); + r.sign = !r.sign; + return r.iadd(this.m)._forceRed(this); +}; + +Red.prototype.add = function add(a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res._forceRed(this); +}; + +Red.prototype.iadd = function iadd(a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res; +}; + +Red.prototype.sub = function sub(a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res._forceRed(this); +}; + +Red.prototype.isub = function isub(a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res; +}; + +Red.prototype.shl = function shl(a, num) { + this._verify1(a); + return this.imod(a.shln(num)); +}; + +Red.prototype.imul = function imul(a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); +}; + +Red.prototype.mul = function mul(a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); +}; + +Red.prototype.isqr = function isqr(a) { + return this.imul(a, a); +}; + +Red.prototype.sqr = function sqr(a) { + return this.mul(a, a); +}; + +Red.prototype.sqrt = function sqrt(a) { + if (a.cmpn(0) === 0) + return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).ishrn(2); + var r = this.pow(a, pow); + return r; + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (q.cmpn(0) !== 0 && q.andln(1) === 0) { + s++; + q.ishrn(1); + } + assert(q.cmpn(0) !== 0); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).ishrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + while (this.pow(z, lpow).cmp(nOne) !== 0) + z.redIAdd(nOne); + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).ishrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) + tmp = tmp.redSqr(); + assert(i < m); + var b = this.pow(c, new BN(1).ishln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; +}; + +Red.prototype.invm = function invm(a) { + var inv = a._invmp(this.m); + if (inv.sign) { + inv.sign = false; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } +}; + +Red.prototype.pow = function pow(a, num) { + var w = []; + + if (num.cmpn(0) === 0) + return new BN(1); + + var q = num.clone(); + + while (q.cmpn(0) !== 0) { + w.push(q.andln(1)); + q.ishrn(1); + } + + // Skip leading zeroes + var res = a; + for (var i = 0; i < w.length; i++, res = this.sqr(res)) + if (w[i] !== 0) + break; + + if (++i < w.length) { + for (var q = this.sqr(res); i < w.length; i++, q = this.sqr(q)) { + if (w[i] === 0) + continue; + res = this.mul(res, q); + } + } + + return res; +}; + +Red.prototype.convertTo = function convertTo(num) { + var r = num.mod(this.m); + if (r === num) + return r.clone(); + else + return r; +}; + +Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; +}; + +// +// Montgomery method engine +// + +BN.mont = function mont(num) { + return new Mont(num); +}; + +function Mont(m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) + this.shift += 26 - (this.shift % 26); + this.r = new BN(1).ishln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv.sign = true; + this.minv = this.minv.mod(this.r); +} +inherits(Mont, Red); + +Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.shln(this.shift)); +}; + +Mont.prototype.convertFrom = function convertFrom(num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; +}; + +Mont.prototype.imul = function imul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.mul = function mul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) + return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.invm = function invm(a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); +}; + +})(typeof module === 'undefined' || module, this); diff --git a/node_modules/bn.js/package.json b/node_modules/bn.js/package.json new file mode 100644 index 00000000..e5a1e613 --- /dev/null +++ b/node_modules/bn.js/package.json @@ -0,0 +1,57 @@ +{ + "name": "bn.js", + "version": "2.0.5", + "description": "Big number implementation in pure javascript", + "main": "lib/bn.js", + "scripts": { + "test": "jscs lib/*.js test/*.js && jshint lib/*.js && mocha --reporter=spec test/*-test.js" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/indutny/bn.js.git" + }, + "keywords": [ + "BN", + "BigNum", + "Big number", + "Modulo", + "Montgomery" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/bn.js/issues" + }, + "homepage": "https://github.com/indutny/bn.js", + "devDependencies": { + "istanbul": "^0.3.5", + "jscs": "^1.11.1", + "jshint": "^2.6.0", + "mocha": "^2.1.0" + }, + "gitHead": "d6cc9c154bbab0a3a269ffcf0518a468fd508ab7", + "_id": "bn.js@2.0.5", + "_shasum": "5f4b12a26ec4eb8ac895a9349980a254cfd3eb65", + "_from": "bn.js@2.0.5", + "_npmVersion": "2.9.0", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "5f4b12a26ec4eb8ac895a9349980a254cfd3eb65", + "tarball": "http://registry.npmjs.org/bn.js/-/bn.js-2.0.5.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bn.js/-/bn.js-2.0.5.tgz" +} diff --git a/node_modules/bn.js/test/arithmetic-test.js b/node_modules/bn.js/test/arithmetic-test.js new file mode 100644 index 00000000..24fb4cac --- /dev/null +++ b/node_modules/bn.js/test/arithmetic-test.js @@ -0,0 +1,395 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN.js/Arithmetic', function() { + describe('.add()', function() { + it('should add numbers', function() { + assert.equal(new BN(14).add(new BN(26)).toString(16), '28'); + var k = new BN(0x1234); + var r = k; + for (var i = 0; i < 257; i++) + r = r.add(k); + assert.equal(r.toString(16), '125868'); + }); + + it('should handle carry properly (in-place)', function() { + var k = new BN('abcdefabcdefabcdef', 16); + var r = new BN('deadbeef', 16); + for (var i = 0; i < 257; i++) + r.iadd(k); + assert.equal(r.toString(16), 'ac79bd9b79be7a277bde'); + }); + + it('should properly do positive + negative', function() { + var a = new BN('abcd', 16); + var b = new BN('-abce', 16); + + assert.equal(a.iadd(b).toString(16), '-1'); + + var a = new BN('abcd', 16); + var b = new BN('-abce', 16); + + assert.equal(a.add(b).toString(16), '-1'); + assert.equal(b.add(a).toString(16), '-1'); + }); + }); + + describe('.iaddn()', function() { + it('should allow a sign change', function() { + var a = new BN(-100); + assert.equal(a.sign, true); + + a.iaddn(200); + + assert.equal(a.sign, false); + assert.equal(a.toString(), '100'); + }); + + it('should add negative number', function() { + var a = new BN(-100); + assert.equal(a.sign, true); + + a.iaddn(-200); + + assert.equal(a.toString(), '-300'); + }); + + it('should allow neg + pos with big number', function() { + var a = new BN('-1000000000', 10); + assert.equal(a.sign, true); + + a.iaddn(200); + + assert.equal(a.toString(), '-999999800'); + }); + + it('should carry limb', function() { + var a = new BN('3ffffff', 16); + + assert.equal(a.iaddn(1).toString(16), '4000000'); + }); + }); + + describe('.sub()', function() { + it('should subtract small numbers', function() { + assert.equal(new BN(26).sub(new BN(14)).toString(16), 'c'); + assert.equal(new BN(14).sub(new BN(26)).toString(16), '-c'); + assert.equal(new BN(26).sub(new BN(26)).toString(16), '0'); + assert.equal(new BN(-26).sub(new BN(26)).toString(16), '-34'); + }); + + var a = new BN( + '31ff3c61db2db84b9823d320907a573f6ad37c437abe458b1802cda041d6384' + + 'a7d8daef41395491e2', + 16); + var b = new BN( + '6f0e4d9f1d6071c183677f601af9305721c91d31b0bbbae8fb790000', + 16); + var r = new BN( + '31ff3c61db2db84b9823d3208989726578fd75276287cd9516533a9acfb9a67' + + '76281f34583ddb91e2', + 16); + + it('should subtract big numbers', function() { + assert.equal(a.sub(b).cmp(r), 0); + }); + + it('should subtract numbers in place', function() { + assert.equal(b.clone().isub(a).neg().cmp(r), 0); + }); + + it('should subtract with carry', function() { + // Carry and copy + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(a.isub(b).toString(16), '-fffffffedcbb'); + + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(b.isub(a).toString(16), 'fffffffedcbb'); + }); + }); + + describe('.isubn()', function() { + it('should subtract negative number', function() { + var r = new BN( + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b', 16); + assert.equal(r.isubn(-1).toString(16), + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681c'); + }); + + it('should work for positive numbers', function() { + var a = new BN(-100); + assert.equal(a.sign, true); + + a.isubn(200); + assert.equal(a.sign, true); + assert.equal(a.toString(), '-300'); + }); + + it('should not allow a sign change', function() { + var a = new BN(-100); + assert.equal(a.sign, true); + + a.isubn(-200); + assert.equal(a.sign, false); + assert.equal(a.toString(), '100'); + }); + }); + + describe('.mul()', function() { + it('should multiply numbers of different signs', function() { + assert.equal(new BN(0x1001).mul(new BN(0x1234)).toString(16), + '1235234'); + assert.equal(new BN(-0x1001).mul(new BN(0x1234)).toString(16), + '-1235234'); + assert.equal(new BN(-0x1001).mul(new BN(-0x1234)).toString(16), + '1235234'); + }); + + it('should multiply with carry', function() { + var n = new BN(0x1001); + var r = n; + for (var i = 0; i < 4; i++) + r = r.mul(n); + assert.equal(r.toString(16), + '100500a00a005001'); + }); + + it('should correctly multiply big numbers', function() { + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal( + n.mul(n).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40'); + assert.equal( + n.mul(n).mul(n).toString(16), + '1b888e01a06e974017a28a5b4da436169761c9730b7aeedf75fc60f687b' + + '46e0cf2cb11667f795d5569482640fe5f628939467a01a612b02350' + + '0d0161e9730279a7561043af6197798e41b7432458463e64fa81158' + + '907322dc330562697d0d600'); + }); + + it('should multiply neg number on 0', function() { + assert.equal( + new BN('-100000000000').mul(new BN('3').div(new BN('4'))).toString(16), + '0' + ); + }); + + it('should regress mul big numbers', function() { + var q = fixtures.dhGroups.p17.q; + var qs = fixtures.dhGroups.p17.qs; + + var q = new BN(q, 16); + assert.equal(q.sqr().toString(16), qs); + assert.equal(q.isqr().toString(16), qs); + }); + }); + + describe('.imul()', function() { + it('should multiply numbers in-place', function() { + var a = new BN('abcdef01234567890abcd', 16); + var b = new BN('deadbeefa551edebabba8', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + + var a = new BN('abcdef01234567890abcd214a25123f512361e6d236', 16); + var b = new BN('deadbeefa551edebabba8121234fd21bac0341324dd', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + }); + + it('should multiply by 0', function() { + var a = new BN('abcdef01234567890abcd', 16); + var b = new BN('0', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + }); + }); + + describe('.div()', function() { + it('should divide numbers', function() { + assert.equal(new BN('10').div(new BN(256)).toString(16), + '0'); + assert.equal(new BN('69527932928').div(new BN('16974594')).toString(16), + 'fff'); + assert.equal(new BN('-69527932928').div(new BN('16974594')).toString(16), + '-fff'); + + var b = new BN( + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40', + 16); + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal(b.div(n).toString(16), n.toString(16)); + + assert.equal(new BN('1').div(new BN('-5')).toString(10), '0'); + }); + + it('should not fail on regression after moving to _wordDiv', function() { + // Regression after moving to word div + var p = new BN( + 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f', + 16); + var a = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16); + var as = a.sqr(); + assert.equal( + as.div(p).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729e58090b9'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.div(p).toString(16), + 'ffffffff00000002000000000000000000000001000000000000000000000001'); + }); + }); + + describe('.idivn()', function() { + it('should divide numbers in-place', function() { + assert.equal(new BN('10', 16).idivn(3).toString(16), '5'); + assert.equal(new BN('12', 16).idivn(3).toString(16), '6'); + assert.equal(new BN('10000000000000000').idivn(3).toString(10), + '3333333333333333'); + assert.equal( + new BN('100000000000000000000000000000').idivn(3).toString(10), + '33333333333333333333333333333'); + + var t = new BN(3); + assert.equal( + new BN('12345678901234567890123456', 16).idivn(3).toString(16), + new BN('12345678901234567890123456', 16).div(t).toString(16)); + }); + }); + + describe('.divRound()', function() { + it('should divide numbers with rounding', function() { + assert.equal(new BN(9).divRound(new BN(20)).toString(10), + '0'); + assert.equal(new BN(10).divRound(new BN(20)).toString(10), + '1'); + assert.equal(new BN(150).divRound(new BN(20)).toString(10), + '8'); + assert.equal(new BN(149).divRound(new BN(20)).toString(10), + '7'); + assert.equal(new BN(149).divRound(new BN(17)).toString(10), + '9'); + assert.equal(new BN(144).divRound(new BN(17)).toString(10), + '8'); + assert.equal(new BN(-144).divRound(new BN(17)).toString(10), + '-8'); + }); + + it('should return 1 on exact division', function() { + assert.equal(new BN(144).divRound(new BN(144)).toString(10), '1'); + }); + }); + + describe('.mod()', function() { + it('should mod numbers', function() { + assert.equal(new BN('10').mod(new BN(256)).toString(16), + 'a'); + assert.equal(new BN('69527932928').mod(new BN('16974594')).toString(16), + '102f302'); + assert.equal(new BN('-69527932928').mod(new BN('16974594')).toString(16), + '1000'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.mod(p).toString(16), + '0'); + }); + + it('should properly carry the sign inside division', function() { + var a = new BN('945304eb96065b2a98b57a48a06ae28d285a71b5', 'hex'); + var b = new BN( + 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe', + 'hex'); + + assert.equal(a.mul(b).mod(a).cmpn(0), 0); + }); + }); + + describe('.modn()', function() { + it('should act like .mod() on small numbers', function() { + assert.equal(new BN('10', 16).modn(256).toString(16), '10'); + assert.equal(new BN('100', 16).modn(256).toString(16), '0'); + assert.equal(new BN('1001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(257).toString(16), + new BN('100000000001', 16).mod(new BN(257)).toString(16)); + assert.equal(new BN('123456789012', 16).modn(3).toString(16), + new BN('123456789012', 16).mod(new BN(3)).toString(16)); + }); + }); + + describe('.abs()', function() { + it('should return absolute value', function() { + assert.equal(new BN(0x1001).abs().toString(), '4097'); + assert.equal(new BN(-0x1001).abs().toString(), '4097'); + assert.equal(new BN('ffffffff', 16).abs().toString(), '4294967295'); + }) + }); + + describe('.invm()', function() { + it('should invert relatively-prime numbers', function() { + var p = new BN(257); + var a = new BN(3); + var b = a.invm(p); + assert.equal(a.mul(b).mod(p).toString(16), '1'); + + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var a = new BN('deadbeef', 16); + var b = a.invm(p192); + assert.equal(a.mul(b).mod(p192).toString(16), '1'); + + // Even base + var phi = new BN('872d9b030ba368706b68932cf07a0e0c', 16); + var e = new BN(65537); + var d = e.invm(phi); + assert.equal(e.mul(d).mod(phi).toString(16), '1'); + + // Even base (take #2) + var a = new BN('5'); + var b = new BN('6'); + var r = a.invm(b); + assert.equal(r.mul(a).mod(b).toString(16), '1'); + }); + }); + + describe('.gcd()', function() { + it('should return GCD', function() { + assert.equal(new BN(3).gcd(new BN(2)).toString(16), '1'); + assert.equal(new BN(18).gcd(new BN(12)).toString(16), '6'); + assert.equal(new BN(-18).gcd(new BN(12)).toString(16), '6'); + }); + }); +}); diff --git a/node_modules/bn.js/test/binary-test.js b/node_modules/bn.js/test/binary-test.js new file mode 100644 index 00000000..9a0673a2 --- /dev/null +++ b/node_modules/bn.js/test/binary-test.js @@ -0,0 +1,182 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN.js/Binary', function() { + describe('.shl()', function() { + it('should shl numbers', function() { + assert.equal(new BN('69527932928').shln(13).toString(16), + '2060602000000'); + assert.equal(new BN('69527932928').shln(45).toString(16), + '206060200000000000000'); + }); + }); + + describe('.shr()', function() { + it('should shr numbers', function() { + assert.equal(new BN('69527932928').shrn(13).toString(16), + '818180'); + assert.equal(new BN('69527932928').shrn(17).toString(16), + '81818'); + assert.equal(new BN('69527932928').shrn(256).toString(16), + '0'); + }); + }); + + describe('.bincn()', function() { + it('should increment bit', function() { + assert.equal(new BN(0).bincn(1).toString(16), '2'); + assert.equal(new BN(2).bincn(1).toString(16), '4'); + assert.equal(new BN(2).bincn(1).bincn(1).toString(16), + new BN(2).bincn(2).toString(16)); + assert.equal(new BN(0xffffff).bincn(1).toString(16), '1000001'); + }); + }); + + describe('.imaskn()', function() { + it('should mask bits in-place', function() { + assert.equal(new BN(0).imaskn(1).toString(16), '0'); + assert.equal(new BN(3).imaskn(1).toString(16), '1'); + assert.equal(new BN('123456789', 16).imaskn(4).toString(16), '9'); + assert.equal(new BN('123456789', 16).imaskn(16).toString(16), '6789'); + assert.equal(new BN('123456789', 16).imaskn(28).toString(16), '3456789'); + }); + }); + + describe('.testn()', function() { + it('should support test specific bit', function() { + [ + 'ff', + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' + ].forEach(function(hex) { + var bn = new BN(hex, 16) + var bl = bn.bitLength() + + for (var i = 0; i < bl; ++i) { + assert.equal(bn.testn(i), true); + } + + // test off the end + assert.equal(bn.testn(bl), false); + }) + + var xbits = '01111001010111001001000100011101' + + '11010011101100011000111001011101' + + '10010100111000000001011000111101' + + '01011111001111100100011110000010' + + '01011010100111010001010011000100' + + '01101001011110100001001111100110' + + '001110010111'; + + var x = new BN( + '23478905234580795234378912401239784125643978256123048348957342' + ) + for (var i = 0; i < x.bitLength(); ++i) { + assert.equal(x.testn(i), (xbits.charAt(i) === '1'), 'Failed @ bit ' + i) + } + }); + + it('should have short-cuts', function() { + var x = new BN('abcd', 16); + assert(!x.testn(128)); + }); + }); + + describe('.and()', function() { + it('should and numbers', function() { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .and(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + }); + + it('should and numbers of different limb-length', function() { + assert.equal( + new BN('abcd0000ffff', 16) + .and(new BN('abcd', 16)).toString(16), + 'abcd'); + }); + }); + + describe('.iand()', function() { + it('should iand numbers', function() { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .iand(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + assert.equal(new BN('1000000000000000000000000000000000000001', 2) + .iand(new BN('1', 2)) + .toString(2), '1') + assert.equal(new BN('1', 2) + .iand(new BN('1000000000000000000000000000000000000001', 2)) + .toString(2), '1') + }); + }); + + describe('.or()', function() { + it('should or numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .or(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + }); + + it('should or numbers of different limb-length', function() { + assert.equal( + new BN('abcd00000000', 16) + .or(new BN('abcd', 16)).toString(16), + 'abcd0000abcd'); + }); + }); + + describe('.ior()', function() { + it('should ior numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .ior(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + assert.equal(new BN('1000000000000000000000000000000000000000', 2) + .ior(new BN('1', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + assert.equal(new BN('1', 2) + .ior(new BN('1000000000000000000000000000000000000000', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + }); + }); + + describe('.xor()', function() { + it('should xor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .xor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + }); + }); + + describe('.ixor()', function() { + it('should ixor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1', 2)) + .toString(2), '11001100110011001100110011001101'); + assert.equal(new BN('1', 2) + .ixor(new BN('11001100110011001100110011001100', 2)) + .toString(2), '11001100110011001100110011001101'); + }); + + it('should and numbers of different limb-length', function() { + assert.equal( + new BN('abcd0000ffff', 16) + .xor(new BN('abcd', 16)).toString(16), + 'abcd00005432'); + }); + }); + + describe('.setn()', function() { + it('should allow single bits to be set', function () { + assert.equal(new BN(0).setn(2, true).toString(2), '100'); + assert.equal(new BN(0).setn(27, true).toString(2), + '1000000000000000000000000000'); + assert.equal(new BN('1000000000000000000000000001', 2).setn(27, false) + .toString(2), '1'); + assert.equal(new BN('101', 2).setn(2, false).toString(2), '1'); + }); + }); +}); diff --git a/node_modules/bn.js/test/constructor-test.js b/node_modules/bn.js/test/constructor-test.js new file mode 100644 index 00000000..c9b46a94 --- /dev/null +++ b/node_modules/bn.js/test/constructor-test.js @@ -0,0 +1,119 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN.js/Constructor', function() { + describe('with Smi input', function() { + it('should accept one limb number', function() { + assert.equal(new BN(12345).toString(16), '3039'); + }); + + it('should accept two-limb number', function() { + assert.equal(new BN(0x4123456).toString(16), '4123456'); + }); + + it('should accept 52 bits of precision', function() { + var num = Math.pow(2, 52); + assert.equal(new BN(num, 10).toString(10), num.toString(10)); + }); + + it('should accept max safe integer', function() { + var num = Math.pow(2, 53) - 1; + assert.equal(new BN(num, 10).toString(10), num.toString(10)); + }); + + it('should not accept an unsafe integer', function() { + var num = Math.pow(2, 53); + assert.throws(function() { new BN(num, 10); }); + }); + + }); + + describe('with String input', function() { + it('should accept base-16', function() { + assert.equal(new BN('1A6B765D8CDF', 16).toString(16), '1a6b765d8cdf'); + assert.equal(new BN('1A6B765D8CDF', 16).toString(), '29048849665247'); + }); + + it('should accept base-hex', function() { + assert.equal(new BN('FF', 'hex').toString(), '255'); + }); + + it('should accept base-16 with spaces', function() { + var num = 'a89c e5af8724 c0a23e0e 0ff77500'; + assert.equal(new BN(num, 16).toString(16), num.replace(/ /g, '')); + }); + + it('should accept long base-16', function() { + var num = '123456789abcdef123456789abcdef123456789abcdef'; + assert.equal(new BN(num, 16).toString(16), num); + }); + + it('should accept positive base-10', function() { + assert.equal(new BN('10654321').toString(), '10654321'); + assert.equal(new BN('29048849665247').toString(16), '1a6b765d8cdf'); + }); + + it('should accept negative base-10', function() { + assert.equal(new BN('-29048849665247').toString(16), '-1a6b765d8cdf'); + }); + + it('should accept long base-10', function() { + var num = '10000000000000000'; + assert.equal(new BN(num).toString(10), num); + }); + + it('should accept base-2', function() { + var base2 = '11111111111111111111111111111111111111111111111111111'; + assert.equal(new BN(base2, 2).toString(2), base2); + }); + + it('should accept base-36', function() { + var base36 = 'zzZzzzZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'; + assert.equal(new BN(base36, 36).toString(36), base36.toLowerCase()); + }); + + it('should not overflow limbs during base-10', function() { + var num = '65820182292848241686198767302293' + + '20890292528855852623664389292032'; + assert(new BN(num).words[0] < 0x4000000); + }); + }); + + describe('with Array input', function() { + it('should not fail on empty array', function() { + assert.equal(new BN([ ]).toString(16), '0'); + }); + + it('should import/export big endian', function() { + assert.equal(new BN([ 1, 2, 3 ]).toString(16), '10203'); + assert.equal(new BN([ 1, 2, 3, 4 ]).toString(16), '1020304'); + assert.equal(new BN([ 1, 2, 3, 4, 5 ]).toString(16), '102030405'); + assert.equal(new BN([ 1, 2, 3, 4, 5, 6, 7, 8 ]).toString(16), + '102030405060708'); + assert.equal(new BN([ 1, 2, 3, 4 ]).toArray().join(','), '1,2,3,4'); + assert.equal(new BN([ 1, 2, 3, 4, 5, 6, 7, 8 ]).toArray().join(','), + '1,2,3,4,5,6,7,8'); + }); + + it('should import little endian', function() { + assert.equal(new BN([ 1, 2, 3 ], 10, 'le').toString(16), '30201'); + assert.equal(new BN([ 1, 2, 3, 4 ], 10, 'le').toString(16), '4030201'); + assert.equal(new BN([ 1, 2, 3, 4, 5 ], 10, 'le').toString(16), + '504030201'); + assert.equal(new BN([ 1, 2, 3, 4, 5, 6, 7, 8 ], 'le').toString(16), + '807060504030201'); + }); + + it('should import big endian with implicit base', function() { + assert.equal(new BN([ 1, 2, 3, 4, 5 ], 'le').toString(16), '504030201'); + }); + }); + + describe('with BN input', function() { + it('should clone BN', function() { + var num = new BN(12345); + assert.equal(new BN(num).toString(10), '12345'); + }); + }); +}); diff --git a/node_modules/bn.js/test/fixtures.js b/node_modules/bn.js/test/fixtures.js new file mode 100644 index 00000000..29442d92 --- /dev/null +++ b/node_modules/bn.js/test/fixtures.js @@ -0,0 +1,264 @@ +exports.dhGroups = { + p16: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199' + + 'ffffffffffffffff', + priv: '6d5923e6449122cbbcc1b96093e0b7e4fd3e469f58daddae' + + '53b49b20664f4132675df9ce98ae0cfdcac0f4181ccb643b' + + '625f98104dcf6f7d8e81961e2cab4b5014895260cb977c7d' + + '2f981f8532fb5da60b3676dfe57f293f05d525866053ac7e' + + '65abfd19241146e92e64f309a97ef3b529af4d6189fa416c' + + '9e1a816c3bdf88e5edf48fbd8233ef9038bb46faa95122c0' + + '5a426be72039639cd2d53d37254b3d258960dcb33c255ede' + + '20e9d7b4b123c8b4f4b986f53cdd510d042166f7dd7dca98' + + '7c39ab36381ba30a5fdd027eb6128d2ef8e5802a2194d422' + + 'b05fe6e1cb4817789b923d8636c1ec4b7601c90da3ddc178' + + '52f59217ae070d87f2e75cbfb6ff92430ad26a71c8373452' + + 'ae1cc5c93350e2d7b87e0acfeba401aaf518580937bf0b6c' + + '341f8c49165a47e49ce50853989d07171c00f43dcddddf72' + + '94fb9c3f4e1124e98ef656b797ef48974ddcd43a21fa06d0' + + '565ae8ce494747ce9e0ea0166e76eb45279e5c6471db7df8' + + 'cc88764be29666de9c545e72da36da2f7a352fb17bdeb982' + + 'a6dc0193ec4bf00b2e533efd6cd4d46e6fb237b775615576' + + 'dd6c7c7bbc087a25e6909d1ebc6e5b38e5c8472c0fc429c6' + + 'f17da1838cbcd9bbef57c5b5522fd6053e62ba21fe97c826' + + 'd3889d0cc17e5fa00b54d8d9f0f46fb523698af965950f4b' + + '941369e180f0aece3870d9335f2301db251595d173902cad' + + '394eaa6ffef8be6c', + pub: 'd53703b7340bc89bfc47176d351e5cf86d5a18d9662eca3c' + + '9759c83b6ccda8859649a5866524d77f79e501db923416ca' + + '2636243836d3e6df752defc0fb19cc386e3ae48ad647753f' + + 'bf415e2612f8a9fd01efe7aca249589590c7e6a0332630bb' + + '29c5b3501265d720213790556f0f1d114a9e2071be3620bd' + + '4ee1e8bb96689ac9e226f0a4203025f0267adc273a43582b' + + '00b70b490343529eaec4dcff140773cd6654658517f51193' + + '13f21f0a8e04fe7d7b21ffeca85ff8f87c42bb8d9cb13a72' + + 'c00e9c6e9dfcedda0777af951cc8ccab90d35e915e707d8e' + + '4c2aca219547dd78e9a1a0730accdc9ad0b854e51edd1e91' + + '4756760bab156ca6e3cb9c625cf0870def34e9ac2e552800' + + 'd6ce506d43dbbc75acfa0c8d8fb12daa3c783fb726f187d5' + + '58131779239c912d389d0511e0f3a81969d12aeee670e48f' + + 'ba41f7ed9f10705543689c2506b976a8ffabed45e33795b0' + + '1df4f6b993a33d1deab1316a67419afa31fbb6fdd252ee8c' + + '7c7d1d016c44e3fcf6b41898d7f206aa33760b505e4eff2e' + + 'c624bc7fe636b1d59e45d6f904fc391419f13d1f0cdb5b6c' + + '2378b09434159917dde709f8a6b5dc30994d056e3f964371' + + '11587ac7af0a442b8367a7bd940f752ddabf31cf01171e24' + + 'd78df136e9681cd974ce4f858a5fb6efd3234a91857bb52d' + + '9e7b414a8bc66db4b5a73bbeccfb6eb764b4f0cbf0375136' + + 'b024b04e698d54a5' + }, + p17: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934028492' + + '36c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bd' + + 'f8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831' + + '179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1b' + + 'db7f1447e6cc254b332051512bd7af426fb8f401378cd2bf' + + '5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6' + + 'd55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f3' + + '23a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aa' + + 'cc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be328' + + '06a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55c' + + 'da56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee' + + '12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff', + priv: '6017f2bc23e1caff5b0a8b4e1fc72422b5204415787801dc' + + '025762b8dbb98ab57603aaaa27c4e6bdf742b4a1726b9375' + + 'a8ca3cf07771779589831d8bd18ddeb79c43e7e77d433950' + + 'e652e49df35b11fa09644874d71d62fdaffb580816c2c88c' + + '2c4a2eefd4a660360316741b05a15a2e37f236692ad3c463' + + 'fff559938fc6b77176e84e1bb47fb41af691c5eb7bb81bd8' + + 'c918f52625a1128f754b08f5a1403b84667231c4dfe07ed4' + + '326234c113931ce606037e960f35a2dfdec38a5f057884d3' + + '0af8fab3be39c1eeb390205fd65982191fc21d5aa30ddf51' + + 'a8e1c58c0c19fc4b4a7380ea9e836aaf671c90c29bc4bcc7' + + '813811aa436a7a9005de9b507957c56a9caa1351b6efc620' + + '7225a18f6e97f830fb6a8c4f03b82f4611e67ab9497b9271' + + 'd6ac252793cc3e5538990dbd894d2dbc2d152801937d9f74' + + 'da4b741b50b4d40e4c75e2ac163f7b397fd555648b249f97' + + 'ffe58ffb6d096aa84534c4c5729cff137759bd34e80db4ab' + + '47e2b9c52064e7f0bf677f72ac9e5d0c6606943683f9d12f' + + '180cf065a5cb8ec3179a874f358847a907f8471d15f1e728' + + '7023249d6d13c82da52628654438f47b8b5cdf4761fbf6ad' + + '9219eceac657dbd06cf2ab776ad4c968f81c3d039367f0a4' + + 'd77c7ec4435c27b6c147071665100063b5666e06eb2fb2cc' + + '3159ba34bc98ca346342195f6f1fb053ddc3bc1873564d40' + + '1c6738cdf764d6e1ff25ca5926f80102ea6593c17170966b' + + 'b5d7352dd7fb821230237ea3ebed1f920feaadbd21be295a' + + '69f2083deae9c5cdf5f4830eb04b7c1f80cc61c17232d79f' + + '7ecc2cc462a7965f804001c89982734e5abba2d31df1b012' + + '152c6b226dff34510b54be8c2cd68d795def66c57a3abfb6' + + '896f1d139e633417f8c694764974d268f46ece3a8d6616ea' + + 'a592144be48ee1e0a1595d3e5edfede5b27cec6c48ceb2ff' + + 'b42cb44275851b0ebf87dfc9aa2d0cb0805e9454b051dfe8' + + 'a29fadd82491a4b4c23f2d06ba45483ab59976da1433c9ce' + + '500164b957a04cf62dd67595319b512fc4b998424d1164dd' + + 'bbe5d1a0f7257cbb04ec9b5ed92079a1502d98725023ecb2', + pub: '3bf836229c7dd874fe37c1790d201e82ed8e192ed61571ca' + + '7285264974eb2a0171f3747b2fc23969a916cbd21e14f7e2' + + 'f0d72dcd2247affba926f9e7bb99944cb5609aed85e71b89' + + 'e89d2651550cb5bd8281bd3144066af78f194032aa777739' + + 'cccb7862a1af401f99f7e5c693f25ddce2dedd9686633820' + + 'd28d0f5ed0c6b5a094f5fe6170b8e2cbc9dff118398baee6' + + 'e895a6301cb6e881b3cae749a5bdf5c56fc897ff68bc73f2' + + '4811bb108b882872bade1f147d886a415cda2b93dd90190c' + + 'be5c2dd53fe78add5960e97f58ff2506afe437f4cf4c912a' + + '397c1a2139ac6207d3ab76e6b7ffd23bb6866dd7f87a9ae5' + + '578789084ff2d06ea0d30156d7a10496e8ebe094f5703539' + + '730f5fdbebc066de417be82c99c7da59953071f49da7878d' + + 'a588775ff2a7f0084de390f009f372af75cdeba292b08ea8' + + '4bd13a87e1ca678f9ad148145f7cef3620d69a891be46fbb' + + 'cad858e2401ec0fd72abdea2f643e6d0197b7646fbb83220' + + '0f4cf7a7f6a7559f9fb0d0f1680822af9dbd8dec4cd1b5e1' + + '7bc799e902d9fe746ddf41da3b7020350d3600347398999a' + + 'baf75d53e03ad2ee17de8a2032f1008c6c2e6618b62f225b' + + 'a2f350179445debe68500fcbb6cae970a9920e321b468b74' + + '5fb524fb88abbcacdca121d737c44d30724227a99745c209' + + 'b970d1ff93bbc9f28b01b4e714d6c9cbd9ea032d4e964d8e' + + '8fff01db095160c20b7646d9fcd314c4bc11bcc232aeccc0' + + 'fbedccbc786951025597522eef283e3f56b44561a0765783' + + '420128638c257e54b972a76e4261892d81222b3e2039c61a' + + 'ab8408fcaac3d634f848ab3ee65ea1bd13c6cd75d2e78060' + + 'e13cf67fbef8de66d2049e26c0541c679fff3e6afc290efe' + + '875c213df9678e4a7ec484bc87dae5f0a1c26d7583e38941' + + 'b7c68b004d4df8b004b666f9448aac1cc3ea21461f41ea5d' + + 'd0f7a9e6161cfe0f58bcfd304bdc11d78c2e9d542e86c0b5' + + '6985cc83f693f686eaac17411a8247bf62f5ccc7782349b5' + + 'cc1f20e312fa2acc0197154d1bfee507e8db77e8f2732f2d' + + '641440ccf248e8643b2bd1e1f9e8239356ab91098fcb431d', + q: 'a899c59999bf877d96442d284359783bdc64b5f878b688fe' + + '51407f0526e616553ad0aaaac4d5bed3046f10a1faaf42bb' + + '2342dc4b7908eea0c46e4c4576897675c2bfdc4467870d3d' + + 'cd90adaed4359237a4bc6924bfb99aa6bf5f5ede15b574ea' + + 'e977eac096f3c67d09bda574c6306c6123fa89d2f086b8dc' + + 'ff92bc570c18d83fe6c810ccfd22ce4c749ef5e6ead3fffe' + + 'c63d95e0e3fde1df9db6a35fa1d107058f37e41957769199' + + 'd945dd7a373622c65f0af3fd9eb1ddc5c764bbfaf7a3dc37' + + '2548e683b970dac4aa4b9869080d2376c9adecebb84e172c' + + '09aeeb25fb8df23e60033260c4f8aac6b8b98ab894b1fb84' + + 'ebb83c0fb2081c3f3eee07f44e24d8fabf76f19ed167b0d7' + + 'ff971565aa4efa3625fce5a43ceeaa3eebb3ce88a00f597f' + + '048c69292b38dba2103ecdd5ec4ccfe3b2d87fa6202f334b' + + 'c1cab83b608dfc875b650b69f2c7e23c0b2b4adf149a6100' + + 'db1b6dbad4679ecb1ea95eafaba3bd00db11c2134f5a8686' + + '358b8b2ab49a1b2e85e1e45caeac5cd4dc0b3b5fffba8871' + + '1c6baf399edd48dad5e5c313702737a6dbdcede80ca358e5' + + '1d1c4fe42e8948a084403f61baed38aa9a1a5ce2918e9f33' + + '100050a430b47bc592995606440272a4994677577a6aaa1b' + + 'a101045dbec5a4e9566dab5445d1af3ed19519f07ac4e2a8' + + 'bd0a84b01978f203a9125a0be020f71fab56c2c9e344d4f4' + + '12d53d3cd8eb74ca5122002e931e3cb0bd4b7492436be17a' + + 'd7ebe27148671f59432c36d8c56eb762655711cfc8471f70' + + '83a8b7283bcb3b1b1d47d37c23d030288cfcef05fbdb4e16' + + '652ee03ee7b77056a808cd700bc3d9ef826eca9a59be959c' + + '947c865d6b372a1ca2d503d7df6d7611b12111665438475a' + + '1c64145849b3da8c2d343410df892d958db232617f9896f1' + + 'de95b8b5a47132be80dd65298c7f2047858409bf762dbc05' + + 'a62ca392ac40cfb8201a0607a2cae07d99a307625f2b2d04' + + 'fe83fbd3ab53602263410f143b73d5b46fc761882e78c782' + + 'd2c36e716a770a7aefaf7f76cea872db7bffefdbc4c2f9e0' + + '39c19adac915e7a63dcb8c8c78c113f29a3e0bc10e100ce0', + qs: '6f0a2fb763eaeb8eb324d564f03d4a55fdcd709e5f1b65e9' + + '5702b0141182f9f945d71bc3e64a7dfdae7482a7dd5a4e58' + + 'bc38f78de2013f2c468a621f08536969d2c8d011bb3bc259' + + '2124692c91140a5472cad224acdacdeae5751dadfdf068b8' + + '77bfa7374694c6a7be159fc3d24ff9eeeecaf62580427ad8' + + '622d48c51a1c4b1701d768c79d8c819776e096d2694107a2' + + 'f3ec0c32224795b59d32894834039dacb369280afb221bc0' + + '90570a93cf409889b818bb30cccee98b2aa26dbba0f28499' + + '08e1a3cd43fa1f1fb71049e5c77c3724d74dc351d9989057' + + '37bbda3805bd6b1293da8774410fb66e3194e18cdb304dd9' + + 'a0b59b583dcbc9fc045ac9d56aea5cfc9f8a0b95da1e11b7' + + '574d1f976e45fe12294997fac66ca0b83fc056183549e850' + + 'a11413cc4abbe39a211e8c8cbf82f2a23266b3c10ab9e286' + + '07a1b6088909cddff856e1eb6b2cde8bdac53fa939827736' + + 'ca1b892f6c95899613442bd02dbdb747f02487718e2d3f22' + + 'f73734d29767ed8d0e346d0c4098b6fdcb4df7d0c4d29603' + + '5bffe80d6c65ae0a1b814150d349096baaf950f2caf298d2' + + 'b292a1d48cf82b10734fe8cedfa16914076dfe3e9b51337b' + + 'ed28ea1e6824bb717b641ca0e526e175d3e5ed7892aebab0' + + 'f207562cc938a821e2956107c09b6ce4049adddcd0b7505d' + + '49ae6c69a20122461102d465d93dc03db026be54c303613a' + + 'b8e5ce3fd4f65d0b6162ff740a0bf5469ffd442d8c509cd2' + + '3b40dab90f6776ca17fc0678774bd6eee1fa85ababa52ec1' + + 'a15031eb677c6c488661dddd8b83d6031fe294489ded5f08' + + '8ad1689a14baeae7e688afa3033899c81f58de39b392ca94' + + 'af6f15a46f19fa95c06f9493c8b96a9be25e78b9ea35013b' + + 'caa76de6303939299d07426a88a334278fc3d0d9fa71373e' + + 'be51d3c1076ab93a11d3d0d703366ff8cde4c11261d488e5' + + '60a2bdf3bfe2476032294800d6a4a39d306e65c6d7d8d66e' + + '5ec63eee94531e83a9bddc458a2b508285c0ee10b7bd94da' + + '2815a0c5bd5b2e15cbe66355e42f5af8955cdfc0b3a4996d' + + '288db1f4b32b15643b18193e378cb7491f3c3951cdd044b1' + + 'a519571bffac2da986f5f1d506c66530a55f70751e24fa8e' + + 'd83ac2347f4069fb561a5565e78c6f0207da24e889a93a96' + + '65f717d9fe8a2938a09ab5f81be7ccecf466c0397fc15a57' + + '469939793f302739765773c256a3ca55d0548afd117a7cae' + + '98ca7e0d749a130c7b743d376848e255f8fdbe4cb4480b63' + + 'cd2c015d1020cf095d175f3ca9dcdfbaf1b2a6e6468eee4c' + + 'c750f2132a77f376bd9782b9d0ff4da98621b898e251a263' + + '4301ba2214a8c430b2f7a79dbbfd6d7ff6e9b0c137b025ff' + + '587c0bf912f0b19d4fff96b1ecd2ca990c89b386055c60f2' + + '3b94214bd55096f17a7b2c0fa12b333235101cd6f28a128c' + + '782e8a72671adadebbd073ded30bd7f09fb693565dcf0bf3' + + '090c21d13e5b0989dd8956f18f17f4f69449a13549c9d80a' + + '77e5e61b5aeeee9528634100e7bc390672f0ded1ca53555b' + + 'abddbcf700b9da6192255bddf50a76b709fbed251dce4c7e' + + '1ca36b85d1e97c1bc9d38c887a5adf140f9eeef674c31422' + + 'e65f63cae719f8c1324e42fa5fd8500899ef5aa3f9856aa7' + + 'ce10c85600a040343204f36bfeab8cfa6e9deb8a2edd2a8e' + + '018d00c7c9fa3a251ad0f57183c37e6377797653f382ec7a' + + '2b0145e16d3c856bc3634b46d90d7198aff12aff88a30e34' + + 'e2bfaf62705f3382576a9d3eeb0829fca2387b5b654af46e' + + '5cf6316fb57d59e5ea6c369061ac64d99671b0e516529dd5' + + 'd9c48ea0503e55fee090d36c5ea8b5954f6fcc0060794e1c' + + 'b7bc24aa1e5c0142fd4ce6e8fd5aa92a7bf84317ea9e1642' + + 'b6995bac6705adf93cbce72433ed0871139970d640f67b78' + + 'e63a7a6d849db2567df69ac7d79f8c62664ac221df228289' + + 'd0a4f9ebd9acb4f87d49da64e51a619fd3f3baccbd9feb12' + + '5abe0cc2c8d17ed1d8546da2b6c641f4d3020a5f9b9f26ac' + + '16546c2d61385505612275ea344c2bbf1ce890023738f715' + + '5e9eba6a071678c8ebd009c328c3eb643679de86e69a9fa5' + + '67a9e146030ff03d546310a0a568c5ba0070e0da22f2cef8' + + '54714b04d399bbc8fd261f9e8efcd0e83bdbc3f5cfb2d024' + + '3e398478cc598e000124eb8858f9df8f52946c2a1ca5c400' + } +}; diff --git a/node_modules/bn.js/test/pummel/dh-group-test.js b/node_modules/bn.js/test/pummel/dh-group-test.js new file mode 100644 index 00000000..dd6481f0 --- /dev/null +++ b/node_modules/bn.js/test/pummel/dh-group-test.js @@ -0,0 +1,21 @@ +var assert = require('assert'); +var BN = require('../../').BN; +var fixtures = require('../fixtures'); + +describe('BN.js/Slow DH test', function() { + var groups = fixtures.dhGroups; + Object.keys(groups).forEach(function(name) { + it('should match public key for ' + name + ' group', function() { + var group = groups[name]; + + this.timeout(3600 * 1000); + + var base = new BN(2); + var mont = BN.red(new BN(group.prime, 16)); + var priv = new BN(group.priv, 16); + var multed = base.toRed(mont).redPow(priv).fromRed(); + var actual = new Buffer(multed.toArray()); + assert.equal(actual.toString('hex'), group.pub); + }); + }); +}); diff --git a/node_modules/bn.js/test/red-test.js b/node_modules/bn.js/test/red-test.js new file mode 100644 index 00000000..b043ba9b --- /dev/null +++ b/node_modules/bn.js/test/red-test.js @@ -0,0 +1,158 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN.js/Reduction context', function() { + function testMethod(name, fn) { + describe(name + ' method', function() { + it('should support add, iadd, sub, isub operations', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(123).toRed(m); + var b = new BN(231).toRed(m); + + assert.equal(a.redAdd(b).fromRed().toString(10), '97'); + assert.equal(a.redSub(b).fromRed().toString(10), '149'); + assert.equal(b.redSub(a).fromRed().toString(10), '108'); + + assert.equal(a.clone().redIAdd(b).fromRed().toString(10), '97'); + assert.equal(a.clone().redISub(b).fromRed().toString(10), '149'); + assert.equal(b.clone().redISub(a).fromRed().toString(10), '108'); + }); + + it('should support pow and mul operations', function() { + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p192); + var a = new BN(123); + var b = new BN(231); + var c = a.toRed(m).redMul(b.toRed(m)).fromRed(); + assert(c.cmp(a.mul(b).mod(p192)) === 0); + + assert.equal(a.toRed(m).redPow(new BN(3)).fromRed() + .cmp(a.sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(4)).fromRed() + .cmp(a.sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(8)).fromRed() + .cmp(a.sqr().sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(9)).fromRed() + .cmp(a.sqr().sqr().sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(17)).fromRed() + .cmp(a.sqr().sqr().sqr().sqr().mul(a)), 0); + }); + + it('should sqrtm numbers', function() { + var p = new BN(263); + var m = fn(p); + var q = new BN(11).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + var q = new BN(13).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + // Tonelli-shanks + var p = new BN(13); + var m = fn(p); + var q = new BN(10).toRed(m); + assert.equal(q.redSqrt().fromRed().toString(10), '7'); + }); + + it('should invm numbers', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(3).toRed(m); + var b = a.redInvm(p); + assert.equal(a.redMul(b).fromRed().toString(16), '1'); + }); + + it('should imul numbers', function() { + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + + var a = new BN('deadbeefabbadead', 16); + var b = new BN('abbadeadbeefdead', 16); + var c = a.mul(b).mod(p); + + assert.equal(a.toRed(m).redIMul(b.toRed(m)).fromRed().toString(16), + c.toString(16)); + }); + + it('should pow(base, 0) == 1', function() { + var base = new BN(256).toRed( BN.red('k256')); + var exponent = new BN(0); + var result = base.redPow(exponent); + assert.equal(result.toString(), '1'); + }); + + it('should reduce when converting to red', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(5).toRed(m); + + assert.doesNotThrow(function() { + var b = a.redISub(new BN(512).toRed(m)); + b.redISub(new BN(512).toRed(m)); + }); + }); + }); + } + + testMethod('Plain', BN.red); + testMethod('Montgomery', BN.mont); + + describe('Pseudo-Mersenne Primes', function() { + it('should reduce numbers mod k256', function() { + var p = BN._prime('k256'); + + assert.equal(p.ireduce(new BN(0xdead)).toString(16), 'dead'); + assert.equal(p.ireduce(new BN('deadbeef', 16)).toString(16), 'deadbeef'); + + var num = new BN('fedcba9876543210fedcba9876543210dead' + + 'fedcba9876543210fedcba9876543210dead', + 16); + var exp = num.mod(p.p).toString(16); + assert.equal(p.ireduce(num).toString(16), exp); + + var regr = new BN('f7e46df64c1815962bf7bc9c56128798' + + '3f4fcef9cb1979573163b477eab93959' + + '335dfb29ef07a4d835d22aa3b6797760' + + '70a8b8f59ba73d56d01a79af9', + 16); + var exp = regr.mod(p.p).toString(16); + assert.equal(p.ireduce(regr).toString(16), exp); + }); + + it('should not fail to invm number mod k256', function() { + var regr2 = new BN( + '6c150c4aa9a8cf1934485d40674d4a7cd494675537bda36d49405c5d2c6f496f', 16); + regr2 = regr2.toRed(BN.red('k256')); + assert.equal(regr2.redInvm().redMul(regr2).fromRed().cmpn(1), 0); + }); + + it('should correctly square the number', function() { + var p = BN._prime('k256').p; + var red = BN.red('k256'); + + var n = new BN('9cd8cb48c3281596139f147c1364a3ed' + + 'e88d3f310fdb0eb98c924e599ca1b3c9', + 16); + var expected = n.sqr().mod(p); + var actual = n.toRed(red).redSqr().fromRed(); + + assert.equal(actual.toString(16), expected.toString(16)); + }); + }); +}); diff --git a/node_modules/bn.js/test/utils-test.js b/node_modules/bn.js/test/utils-test.js new file mode 100644 index 00000000..c033aa7c --- /dev/null +++ b/node_modules/bn.js/test/utils-test.js @@ -0,0 +1,80 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN.js/Utils', function() { + describe('.toString()', function() { + describe('hex padding', function() { + it('should have length of 8 from leading 15', function() { + var a = new BN('ffb9602', 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 8); + }); + + it('should have length of 8 from leading zero', function() { + var a = new BN('fb9604', 16); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 8 from leading zeros', function() { + var a = new BN(0); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 64 from leading 15', function() { + var a = new BN( + 'ffb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 64); + }); + + it('should have length of 64 from leading zero', function() { + var a = new BN( + 'fb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 64), 'hex'); + assert.equal(a.toString('hex', 64).length, 64); + }); + }); + }); + + describe('.bitLength()', function() { + it('should return proper bitLength', function() { + assert.equal(new BN(0).bitLength(), 0); + assert.equal(new BN(0x1).bitLength(), 1); + assert.equal(new BN(0x2).bitLength(), 2); + assert.equal(new BN(0x3).bitLength(), 2); + assert.equal(new BN(0x4).bitLength(), 3); + assert.equal(new BN(0x8).bitLength(), 4); + assert.equal(new BN(0x10).bitLength(), 5); + assert.equal(new BN(0x100).bitLength(), 9); + assert.equal(new BN(0x123456).bitLength(), 21); + assert.equal(new BN('123456789', 16).bitLength(), 33); + assert.equal(new BN('8023456789', 16).bitLength(), 40); + }); + }); + + describe('.zeroBits()', function() { + it('should return proper zeroBits', function() { + assert.equal(new BN(0).zeroBits(), 0); + assert.equal(new BN(0x1).zeroBits(), 0); + assert.equal(new BN(0x2).zeroBits(), 1); + assert.equal(new BN(0x3).zeroBits(), 0); + assert.equal(new BN(0x4).zeroBits(), 2); + assert.equal(new BN(0x8).zeroBits(), 3); + assert.equal(new BN(0x10).zeroBits(), 4); + assert.equal(new BN(0x100).zeroBits(), 8); + assert.equal(new BN(0x1000000).zeroBits(), 24); + assert.equal(new BN(0x123456).zeroBits(), 1); + }); + }); + + describe('.toJSON', function() { + it('should return hex string', function() { + assert.equal(new BN(0x123).toJSON(), '123'); + }); + }); +}); diff --git a/node_modules/buffer-equal/.travis.yml b/node_modules/buffer-equal/.travis.yml new file mode 100644 index 00000000..dad2273c --- /dev/null +++ b/node_modules/buffer-equal/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.8 + - "0.10" diff --git a/node_modules/buffer-equal/README.markdown b/node_modules/buffer-equal/README.markdown new file mode 100644 index 00000000..8c062fd0 --- /dev/null +++ b/node_modules/buffer-equal/README.markdown @@ -0,0 +1,62 @@ +buffer-equal +============ + +Return whether two buffers are equal. + +[![build status](https://secure.travis-ci.org/substack/node-buffer-equal.png)](http://travis-ci.org/substack/node-buffer-equal) + +example +======= + +``` js +var bufferEqual = require('buffer-equal'); + +console.dir(bufferEqual( + new Buffer([253,254,255]), + new Buffer([253,254,255]) +)); +console.dir(bufferEqual( + new Buffer('abc'), + new Buffer('abcd') +)); +console.dir(bufferEqual( + new Buffer('abc'), + 'abc' +)); +``` + +output: + +``` +true +false +undefined +``` + +methods +======= + +``` js +var bufferEqual = require('buffer-equal') +``` + +bufferEqual(a, b) +----------------- + +Return whether the two buffers `a` and `b` are equal. + +If `a` or `b` is not a buffer, return `undefined`. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install buffer-equal +``` + +license +======= + +MIT diff --git a/node_modules/buffer-equal/example/eq.js b/node_modules/buffer-equal/example/eq.js new file mode 100644 index 00000000..1eb05095 --- /dev/null +++ b/node_modules/buffer-equal/example/eq.js @@ -0,0 +1,14 @@ +var bufferEqual = require('../'); + +console.dir(bufferEqual( + new Buffer([253,254,255]), + new Buffer([253,254,255]) +)); +console.dir(bufferEqual( + new Buffer('abc'), + new Buffer('abcd') +)); +console.dir(bufferEqual( + new Buffer('abc'), + 'abc' +)); diff --git a/node_modules/buffer-equal/index.js b/node_modules/buffer-equal/index.js new file mode 100644 index 00000000..e640d4e2 --- /dev/null +++ b/node_modules/buffer-equal/index.js @@ -0,0 +1,14 @@ +var Buffer = require('buffer').Buffer; // for use with browserify + +module.exports = function (a, b) { + if (!Buffer.isBuffer(a)) return undefined; + if (!Buffer.isBuffer(b)) return undefined; + if (typeof a.equals === 'function') return a.equals(b); + if (a.length !== b.length) return false; + + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + + return true; +}; diff --git a/node_modules/buffer-equal/package.json b/node_modules/buffer-equal/package.json new file mode 100644 index 00000000..ac4aadf1 --- /dev/null +++ b/node_modules/buffer-equal/package.json @@ -0,0 +1,57 @@ +{ + "name": "buffer-equal", + "description": "return whether two buffers are equal", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-buffer-equal.git" + }, + "main": "index.js", + "keywords": [ + "buffer", + "equal" + ], + "directories": { + "example": "example", + "test": "test" + }, + "scripts": { + "test": "tap test/*.js" + }, + "devDependencies": { + "tap": "0.2.4" + }, + "engines": { + "node": ">=0.4.0" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/node-buffer-equal/issues" + }, + "homepage": "https://github.com/substack/node-buffer-equal", + "_id": "buffer-equal@0.0.1", + "dist": { + "shasum": "91bc74b11ea405bc916bc6aa908faafa5b4aac4b", + "tarball": "http://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz" + }, + "_from": "buffer-equal@0.0.1", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "91bc74b11ea405bc916bc6aa908faafa5b4aac4b", + "_resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/buffer-equal/test/eq.js b/node_modules/buffer-equal/test/eq.js new file mode 100644 index 00000000..3d340062 --- /dev/null +++ b/node_modules/buffer-equal/test/eq.js @@ -0,0 +1,35 @@ +var bufferEqual = require('../'); +var test = require('tap').test; + +test('equal', function (t) { + var eq = bufferEqual( + new Buffer([253,254,255]), + new Buffer([253,254,255]) + ); + t.strictEqual(eq, true); + t.end(); +}); + +test('not equal', function (t) { + var eq = bufferEqual( + new Buffer('abc'), + new Buffer('abcd') + ); + t.strictEqual(eq, false); + t.end(); +}); + +test('not equal not buffer', function (t) { + var eq = bufferEqual( + new Buffer('abc'), + 'abc' + ); + t.strictEqual(eq, undefined); + t.end(); +}); + +test('equal not buffer', function (t) { + var eq = bufferEqual('abc', 'abc'); + t.strictEqual(eq, undefined); + t.end(); +}); diff --git a/node_modules/compact2string/.npmignore b/node_modules/compact2string/.npmignore new file mode 100644 index 00000000..ba2a97b5 --- /dev/null +++ b/node_modules/compact2string/.npmignore @@ -0,0 +1,2 @@ +node_modules +coverage diff --git a/node_modules/compact2string/.travis.yml b/node_modules/compact2string/.travis.yml new file mode 100644 index 00000000..269eb2f9 --- /dev/null +++ b/node_modules/compact2string/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: + - "0.11" + - "0.10" + - "0.8" + - "0.6" +before_install: + - npm conf set strict-ssl false +script: + - npm run travis-test +after_script: + - npm run report-coverage diff --git a/node_modules/compact2string/README.md b/node_modules/compact2string/README.md new file mode 100644 index 00000000..dbc93268 --- /dev/null +++ b/node_modules/compact2string/README.md @@ -0,0 +1,51 @@ +# compact2string + +Convert bittorrent's [compact](http://wiki.theory.org/BitTorrent_Tracker_Protocol#Peer_Dictionary_Format) ip/host binary returned by Trackers to 'hostname:port' string. + +[![Build Status](https://travis-ci.org/bencevans/node-compact2string.png?branch=master)](https://travis-ci.org/bencevans/node-compact2string) +[![Coverage Status](https://coveralls.io/repos/bencevans/node-compact2string/badge.png?branch=master)](https://coveralls.io/r/bencevans/node-compact2string?branch=master) +[![Dependency Status](https://david-dm.org/bencevans/node-compact2string.png)](https://david-dm.org/bencevans/node-compact2string) + +[![browser support](https://ci.testling.com/bencevans/node-compact2string.png) +](https://ci.testling.com/bencevans/node-compact2string) + +Need the reverse of this? Checkout https://github.com/feross/string2compact + +## Installation + +```npm install compact2string``` + +## Usage + +### Single compact2string + +```javascript +var compact2string = require("compact2string"); +var Buffer = require("buffer").Buffer; +var ipport = compact2string(new Buffer("0A0A0A05FF80", "hex")); +console.log(ipport); +``` + +=> ```"10.10.10.5:65408" ``` + +```javascript +ipport = compact2string(new Buffer("2a03288021109f07faceb00c000000010050", "hex")); +console.log(ipport); +``` + +=> ```"[2a03:2880:2110:9f07:face:b00c::1]:80" ``` + +### Multiple in same buffer + +```javascript +var hostports = compact2string.multi(new Buffer("0A0A0A05008064383a636f6d", "hex")); +console.log(hostports); +``` + +=> ```[ '10.10.10.5:128', '100.56.58.99:28525' ]``` + +IPv6 version: `compact2string.multi6()` + +## Licence + +(MIT Licence) diff --git a/node_modules/compact2string/examples/basic.js b/node_modules/compact2string/examples/basic.js new file mode 100644 index 00000000..6c901230 --- /dev/null +++ b/node_modules/compact2string/examples/basic.js @@ -0,0 +1,6 @@ +var compact2string = require("../"); +var Buffer = require("buffer").Buffer; + +var iphost = compact2string(new Buffer("0A0A0A05FF80", "hex")); + +console.log(iphost); \ No newline at end of file diff --git a/node_modules/compact2string/examples/multi.js b/node_modules/compact2string/examples/multi.js new file mode 100644 index 00000000..9c90d421 --- /dev/null +++ b/node_modules/compact2string/examples/multi.js @@ -0,0 +1,5 @@ +var compact2string = require("../"); +var Buffer = require("buffer").Buffer; + +var ipports = compact2string.multi(new Buffer("0A0A0A05008064383a636f6d", "hex")); +console.log(ipports); \ No newline at end of file diff --git a/node_modules/compact2string/index.js b/node_modules/compact2string/index.js new file mode 100644 index 00000000..92531d06 --- /dev/null +++ b/node_modules/compact2string/index.js @@ -0,0 +1,42 @@ +var ipaddr = require('ipaddr.js'); + +module.exports = compact2string = function (buf) { + switch(buf.length) { + case 6: + return buf[0] + "." + buf[1] + "." + buf[2] + "." + buf[3] + ":" + buf.readUInt16BE(4); + break; + case 18: + var hexGroups = []; + for(var i = 0; i < 8; i++) { + hexGroups.push(buf.readUInt16BE(i * 2).toString(16)); + } + var host = ipaddr.parse(hexGroups.join(":")).toString(); + return "[" + host + "]:" + buf.readUInt16BE(16); + default: + throw new Error("Invalid Compact IP/PORT, It should contain 6 or 18 bytes"); + } +}; + +compact2string.multi = function (buf) { + if(buf.length % 6 !== 0) + throw new Error("buf length isn't multiple of compact IP/PORTs (6 bytes)"); + + var output = []; + for (var i = 0; i <= buf.length - 1; i = i + 6) { + output.push(compact2string(buf.slice(i, i + 6))); + } + + return output; +}; + +compact2string.multi6 = function (buf) { + if(buf.length % 18 !== 0) + throw new Error("buf length isn't multiple of compact IP6/PORTs (18 bytes)"); + + var output = []; + for (var i = 0; i <= buf.length - 1; i = i + 18) { + output.push(compact2string(buf.slice(i, i + 18))); + } + + return output; +}; diff --git a/node_modules/compact2string/node_modules/ipaddr.js/.npmignore b/node_modules/compact2string/node_modules/ipaddr.js/.npmignore new file mode 100644 index 00000000..7a1537ba --- /dev/null +++ b/node_modules/compact2string/node_modules/ipaddr.js/.npmignore @@ -0,0 +1,2 @@ +.idea +node_modules diff --git a/node_modules/compact2string/node_modules/ipaddr.js/Cakefile b/node_modules/compact2string/node_modules/ipaddr.js/Cakefile new file mode 100644 index 00000000..7fd355a7 --- /dev/null +++ b/node_modules/compact2string/node_modules/ipaddr.js/Cakefile @@ -0,0 +1,18 @@ +fs = require 'fs' +CoffeeScript = require 'coffee-script' +nodeunit = require 'nodeunit' +UglifyJS = require 'uglify-js' + +task 'build', 'build the JavaScript files from CoffeeScript source', build = (cb) -> + source = fs.readFileSync 'src/ipaddr.coffee' + fs.writeFileSync 'lib/ipaddr.js', CoffeeScript.compile source.toString() + + invoke 'test' + invoke 'compress' + +task 'test', 'run the bundled tests', (cb) -> + nodeunit.reporters.default.run ['test'] + +task 'compress', 'uglify the resulting javascript', (cb) -> + result = UglifyJS.minify('lib/ipaddr.js') + fs.writeFileSync('ipaddr.min.js', result.code) diff --git a/node_modules/compact2string/node_modules/ipaddr.js/LICENSE b/node_modules/compact2string/node_modules/ipaddr.js/LICENSE new file mode 100644 index 00000000..3493f0df --- /dev/null +++ b/node_modules/compact2string/node_modules/ipaddr.js/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2011 Peter Zotov + +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. \ No newline at end of file diff --git a/node_modules/compact2string/node_modules/ipaddr.js/README.md b/node_modules/compact2string/node_modules/ipaddr.js/README.md new file mode 100644 index 00000000..c596e7e3 --- /dev/null +++ b/node_modules/compact2string/node_modules/ipaddr.js/README.md @@ -0,0 +1,161 @@ +# ipaddr.js — an IPv6 and IPv4 address manipulation library + +ipaddr.js is a small (1.9K minified and gzipped) library for manipulating +IP addresses in JavaScript environments. It runs on both CommonJS runtimes +(e.g. [nodejs]) and in a web browser. + +ipaddr.js allows you to verify and parse string representation of an IP +address, match it against a CIDR range or range list, determine if it falls +into some reserved ranges (examples include loopback and private ranges), +and convert between IPv4 and IPv4-mapped IPv6 addresses. + +[nodejs]: http://nodejs.org + +## Installation + +`npm install ipaddr.js` + +## API + +ipaddr.js defines one object in the global scope: `ipaddr`. In CommonJS, +it is exported from the module: + +```js +var ipaddr = require('ipaddr.js'); +``` + +The API consists of several global methods and two classes: ipaddr.IPv6 and ipaddr.IPv4. + +### Global methods + +There are three global methods defined: `ipaddr.isValid`, `ipaddr.parse` and +`ipaddr.process`. All of them receive a string as a single parameter. + +The `ipaddr.isValid` method returns `true` if the address is a valid IPv4 or +IPv6 address, and `false` otherwise. It does not throw any exceptions. + +The `ipaddr.parse` method returns an object representing the IP address, +or throws an `Error` if the passed string is not a valid representation of an +IP address. + +The `ipaddr.process` method works just like the `ipaddr.parse` one, but it +automatically converts IPv4-mapped IPv6 addresses to their IPv4 couterparts +before returning. It is useful when you have a Node.js instance listening +on an IPv6 socket, and the `net.ivp6.bindv6only` sysctl parameter (or its +equivalent on non-Linux OS) is set to 0. In this case, you can accept IPv4 +connections on your IPv6-only socket, but the remote address will be mangled. +Use `ipaddr.process` method to automatically demangle it. + +### Object representation + +Parsing methods return an object which descends from `ipaddr.IPv6` or +`ipaddr.IPv4`. These objects share some properties, but most of them differ. + +#### Shared properties + +One can determine the type of address by calling `addr.kind()`. It will return +either `"ipv6"` or `"ipv4"`. + +An address can be converted back to its string representation with `addr.toString()`. +Note that this method: + * does not return the original string used to create the object (in fact, there is + no way of getting that string) + * returns a compact representation (when it is applicable) + +A `match(range, bits)` method can be used to check if the address falls into a +certain CIDR range. +Note that an address can be (obviously) matched only against an address of the same type. + +For example: + +```js +var addr = ipaddr.parse("2001:db8:1234::1"); +var range = ipaddr.parse("2001:db8::"); + +addr.match(range, 32); // => true +``` + +Alternatively, `match` can also be called as `match([range, bits])`. In this way, +it can be used together with the `parseCIDR(string)` method, which parses an IP +address together with a CIDR range. + +For example: + +```js +var addr = ipaddr.parse("2001:db8:1234::1"); + +addr.match(ipaddr.parseCIDR("2001:db8::/32")); // => true +``` + +A `range()` method returns one of predefined names for several special ranges defined +by IP protocols. The exact names (and their respective CIDR ranges) can be looked up +in the source: [IPv6 ranges] and [IPv4 ranges]. Some common ones include `"unicast"` +(the default one) and `"reserved"`. + +You can match against your own range list by using +`ipaddr.subnetMatch(address, rangeList, defaultName)` method. It can work with both +IPv6 and IPv4 addresses, and accepts a name-to-subnet map as the range list. For example: + +```js +var rangeList = { + documentationOnly: [ ipaddr.parse('2001:db8::'), 32 ], + tunnelProviders: [ + [ ipaddr.parse('2001:470::'), 32 ], // he.net + [ ipaddr.parse('2001:5c0::'), 32 ] // freenet6 + ] +}; +ipaddr.subnetMatch(ipaddr.parse('2001:470:8:66::1'), rangeList, 'unknown'); // => "he.net" +``` + +The addresses can be converted to their byte representation with `toByteArray()`. +(Actually, JavaScript mostly does not know about byte buffers. They are emulated with +arrays of numbers, each in range of 0..255.) + +```js +var bytes = ipaddr.parse('2a00:1450:8007::68').toByteArray(); // ipv6.google.com +bytes // => [42, 0x00, 0x14, 0x50, 0x80, 0x07, 0x00, , 0x00, 0x68 ] +``` + +The `ipaddr.IPv4` and `ipaddr.IPv6` objects have some methods defined, too. All of them +have the same interface for both protocols, and are similar to global methods. + +`ipaddr.IPvX.isValid(string)` can be used to check if the string is a valid address +for particular protocol, and `ipaddr.IPvX.parse(string)` is the error-throwing parser. + +[IPv6 ranges]: https://github.com/whitequark/ipaddr.js/blob/master/src/ipaddr.coffee#L186 +[IPv4 ranges]: https://github.com/whitequark/ipaddr.js/blob/master/src/ipaddr.coffee#L71 + +#### IPv6 properties + +Sometimes you will want to convert IPv6 not to a compact string representation (with +the `::` substitution); the `toNormalizedString()` method will return an address where +all zeroes are explicit. + +For example: + +```js +var addr = ipaddr.parse("2001:0db8::0001"); +addr.toString(); // => "2001:db8::1" +addr.toNormalizedString(); // => "2001:db8:0:0:0:0:0:1" +``` + +The `isIPv4MappedAddress()` method will return `true` if this address is an IPv4-mapped +one, and `toIPv4Address()` will return an IPv4 object address. + +To access the underlying binary representation of the address, use `addr.parts`. + +```js +var addr = ipaddr.parse("2001:db8:10::1234:DEAD"); +addr.parts // => [0x2001, 0xdb8, 0x10, 0, 0, 0, 0x1234, 0xdead] +``` + +#### IPv4 properties + +`toIPv4MappedAddress()` will return a corresponding IPv4-mapped IPv6 address. + +To access the underlying representation of the address, use `addr.octets`. + +```js +var addr = ipaddr.parse("192.168.1.1"); +addr.octets // => [192, 168, 1, 1] +``` diff --git a/node_modules/compact2string/node_modules/ipaddr.js/ipaddr.min.js b/node_modules/compact2string/node_modules/ipaddr.js/ipaddr.min.js new file mode 100644 index 00000000..9e2800de --- /dev/null +++ b/node_modules/compact2string/node_modules/ipaddr.js/ipaddr.min.js @@ -0,0 +1 @@ +(function(){var r,t,e,n,i,o,a,s;t={},s=this,"undefined"!=typeof module&&null!==module&&module.exports?module.exports=t:s.ipaddr=t,a=function(r,t,e,n){var i,o;if(r.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");for(i=0;n>0;){if(o=e-n,0>o&&(o=0),r[i]>>o!==t[i]>>o)return!1;n-=e,i+=1}return!0},t.subnetMatch=function(r,t,e){var n,i,o,a,s;null==e&&(e="unicast");for(n in t)for(i=t[n],"[object Array]"!==toString.call(i[0])&&(i=[i]),a=0,s=i.length;s>a;a++)if(o=i[a],r.match.apply(r,o))return n;return e},t.IPv4=function(){function r(r){var t,e,n;if(4!==r.length)throw new Error("ipaddr: ipv4 octet count should be 4");for(e=0,n=r.length;n>e;e++)if(t=r[e],!(t>=0&&255>=t))throw new Error("ipaddr: ipv4 octet is a byte");this.octets=r}return r.prototype.kind=function(){return"ipv4"},r.prototype.toString=function(){return this.octets.join(".")},r.prototype.toByteArray=function(){return this.octets.slice(0)},r.prototype.match=function(r,t){var e;if(void 0===t&&(e=r,r=e[0],t=e[1]),"ipv4"!==r.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return a(this.octets,r.octets,8,t)},r.prototype.SpecialRanges={unspecified:[[new r([0,0,0,0]),8]],broadcast:[[new r([255,255,255,255]),32]],multicast:[[new r([224,0,0,0]),4]],linkLocal:[[new r([169,254,0,0]),16]],loopback:[[new r([127,0,0,0]),8]],"private":[[new r([10,0,0,0]),8],[new r([172,16,0,0]),12],[new r([192,168,0,0]),16]],reserved:[[new r([192,0,0,0]),24],[new r([192,0,2,0]),24],[new r([192,88,99,0]),24],[new r([198,51,100,0]),24],[new r([203,0,113,0]),24],[new r([240,0,0,0]),4]]},r.prototype.range=function(){return t.subnetMatch(this,this.SpecialRanges)},r.prototype.toIPv4MappedAddress=function(){return t.IPv6.parse("::ffff:"+this.toString())},r}(),e="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp("^"+e+"\\."+e+"\\."+e+"\\."+e+"$","i"),longValue:new RegExp("^"+e+"$","i")},t.IPv4.parser=function(r){var t,e,i,o,a;if(e=function(r){return"0"===r[0]&&"x"!==r[1]?parseInt(r,8):parseInt(r)},t=r.match(n.fourOctet))return function(){var r,n,o,a;for(o=t.slice(1,6),a=[],r=0,n=o.length;n>r;r++)i=o[r],a.push(e(i));return a}();if(t=r.match(n.longValue)){if(a=e(t[1]),a>4294967295||0>a)throw new Error("ipaddr: address outside defined range");return function(){var r,t;for(t=[],o=r=0;24>=r;o=r+=8)t.push(a>>o&255);return t}().reverse()}return null},t.IPv6=function(){function r(r){var t,e,n;if(8!==r.length)throw new Error("ipaddr: ipv6 part count should be 8");for(e=0,n=r.length;n>e;e++)if(t=r[e],!(t>=0&&65535>=t))throw new Error("ipaddr: ipv6 part should fit to two octets");this.parts=r}return r.prototype.kind=function(){return"ipv6"},r.prototype.toString=function(){var r,t,e,n,i,o,a;for(i=function(){var r,e,n,i;for(n=this.parts,i=[],r=0,e=n.length;e>r;r++)t=n[r],i.push(t.toString(16));return i}.call(this),r=[],e=function(t){return r.push(t)},n=0,o=0,a=i.length;a>o;o++)switch(t=i[o],n){case 0:e("0"===t?"":t),n=1;break;case 1:"0"===t?n=2:e(t);break;case 2:"0"!==t&&(e(""),e(t),n=3);break;case 3:e(t)}return 2===n&&(e(""),e("")),r.join(":")},r.prototype.toByteArray=function(){var r,t,e,n,i;for(r=[],i=this.parts,e=0,n=i.length;n>e;e++)t=i[e],r.push(t>>8),r.push(255&t);return r},r.prototype.toNormalizedString=function(){var r;return function(){var t,e,n,i;for(n=this.parts,i=[],t=0,e=n.length;e>t;t++)r=n[t],i.push(r.toString(16));return i}.call(this).join(":")},r.prototype.match=function(r,t){var e;if(void 0===t&&(e=r,r=e[0],t=e[1]),"ipv6"!==r.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return a(this.parts,r.parts,16,t)},r.prototype.SpecialRanges={unspecified:[new r([0,0,0,0,0,0,0,0]),128],linkLocal:[new r([65152,0,0,0,0,0,0,0]),10],multicast:[new r([65280,0,0,0,0,0,0,0]),8],loopback:[new r([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new r([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new r([0,0,0,0,0,65535,0,0]),96],rfc6145:[new r([0,0,0,0,65535,0,0,0]),96],rfc6052:[new r([100,65435,0,0,0,0,0,0]),96],"6to4":[new r([8194,0,0,0,0,0,0,0]),16],teredo:[new r([8193,0,0,0,0,0,0,0]),32],reserved:[[new r([8193,3512,0,0,0,0,0,0]),32]]},r.prototype.range=function(){return t.subnetMatch(this,this.SpecialRanges)},r.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},r.prototype.toIPv4Address=function(){var r,e,n;if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");return n=this.parts.slice(-2),r=n[0],e=n[1],new t.IPv4([r>>8,255&r,e>>8,255&e])},r}(),i="(?:[0-9a-f]+::?)+",o={"native":new RegExp("^(::)?("+i+")?([0-9a-f]+)?(::)?$","i"),transitional:new RegExp("^((?:"+i+")|(?:::)(?:"+i+")?)"+(""+e+"\\."+e+"\\."+e+"\\."+e+"$"),"i")},r=function(r,t){var e,n,i,o,a;if(r.indexOf("::")!==r.lastIndexOf("::"))return null;for(e=0,n=-1;(n=r.indexOf(":",n+1))>=0;)e++;if(":"===r[0]&&e--,":"===r[r.length-1]&&e--,e>t)return null;for(a=t-e,o=":";a--;)o+="0:";return r=r.replace("::",o),":"===r[0]&&(r=r.slice(1)),":"===r[r.length-1]&&(r=r.slice(0,-1)),function(){var t,e,n,o;for(n=r.split(":"),o=[],t=0,e=n.length;e>t;t++)i=n[t],o.push(parseInt(i,16));return o}()},t.IPv6.parser=function(t){var e,n;return t.match(o["native"])?r(t,8):(e=t.match(o.transitional))&&(n=r(e[1].slice(0,-1),6))?(n.push(parseInt(e[2])<<8|parseInt(e[3])),n.push(parseInt(e[4])<<8|parseInt(e[5])),n):null},t.IPv4.isIPv4=t.IPv6.isIPv6=function(r){return null!==this.parser(r)},t.IPv4.isValid=t.IPv6.isValid=function(r){var t;try{return new this(this.parser(r)),!0}catch(e){return t=e,!1}},t.IPv4.parse=t.IPv6.parse=function(r){var t;if(t=this.parser(r),null===t)throw new Error("ipaddr: string is not formatted like ip address");return new this(t)},t.IPv4.parseCIDR=t.IPv6.parseCIDR=function(r){var t;if(t=r.match(/^(.+)\/(\d+)$/))return[this.parse(t[1]),parseInt(t[2])];throw new Error("ipaddr: string is not formatted like a CIDR range")},t.isValid=function(r){return t.IPv6.isValid(r)||t.IPv4.isValid(r)},t.parse=function(r){if(t.IPv6.isValid(r))return t.IPv6.parse(r);if(t.IPv4.isValid(r))return t.IPv4.parse(r);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},t.parseCIDR=function(r){var e;try{return t.IPv6.parseCIDR(r)}catch(n){e=n;try{return t.IPv4.parseCIDR(r)}catch(n){throw e=n,new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},t.process=function(r){var t;return t=this.parse(r),"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t}}).call(this); \ No newline at end of file diff --git a/node_modules/compact2string/node_modules/ipaddr.js/lib/ipaddr.js b/node_modules/compact2string/node_modules/ipaddr.js/lib/ipaddr.js new file mode 100644 index 00000000..5d99e084 --- /dev/null +++ b/node_modules/compact2string/node_modules/ipaddr.js/lib/ipaddr.js @@ -0,0 +1,439 @@ +(function() { + var expandIPv6, ipaddr, ipv4Part, ipv4Regexes, ipv6Part, ipv6Regexes, matchCIDR, root; + + ipaddr = {}; + + root = this; + + if ((typeof module !== "undefined" && module !== null) && module.exports) { + module.exports = ipaddr; + } else { + root['ipaddr'] = ipaddr; + } + + matchCIDR = function(first, second, partSize, cidrBits) { + var part, shift; + if (first.length !== second.length) { + throw new Error("ipaddr: cannot match CIDR for objects with different lengths"); + } + part = 0; + while (cidrBits > 0) { + shift = partSize - cidrBits; + if (shift < 0) { + shift = 0; + } + if (first[part] >> shift !== second[part] >> shift) { + return false; + } + cidrBits -= partSize; + part += 1; + } + return true; + }; + + ipaddr.subnetMatch = function(address, rangeList, defaultName) { + var rangeName, rangeSubnets, subnet, _i, _len; + if (defaultName == null) { + defaultName = 'unicast'; + } + for (rangeName in rangeList) { + rangeSubnets = rangeList[rangeName]; + if (toString.call(rangeSubnets[0]) !== '[object Array]') { + rangeSubnets = [rangeSubnets]; + } + for (_i = 0, _len = rangeSubnets.length; _i < _len; _i++) { + subnet = rangeSubnets[_i]; + if (address.match.apply(address, subnet)) { + return rangeName; + } + } + } + return defaultName; + }; + + ipaddr.IPv4 = (function() { + function IPv4(octets) { + var octet, _i, _len; + if (octets.length !== 4) { + throw new Error("ipaddr: ipv4 octet count should be 4"); + } + for (_i = 0, _len = octets.length; _i < _len; _i++) { + octet = octets[_i]; + if (!((0 <= octet && octet <= 255))) { + throw new Error("ipaddr: ipv4 octet is a byte"); + } + } + this.octets = octets; + } + + IPv4.prototype.kind = function() { + return 'ipv4'; + }; + + IPv4.prototype.toString = function() { + return this.octets.join("."); + }; + + IPv4.prototype.toByteArray = function() { + return this.octets.slice(0); + }; + + IPv4.prototype.match = function(other, cidrRange) { + var _ref; + if (cidrRange === void 0) { + _ref = other, other = _ref[0], cidrRange = _ref[1]; + } + if (other.kind() !== 'ipv4') { + throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one"); + } + return matchCIDR(this.octets, other.octets, 8, cidrRange); + }; + + IPv4.prototype.SpecialRanges = { + unspecified: [[new IPv4([0, 0, 0, 0]), 8]], + broadcast: [[new IPv4([255, 255, 255, 255]), 32]], + multicast: [[new IPv4([224, 0, 0, 0]), 4]], + linkLocal: [[new IPv4([169, 254, 0, 0]), 16]], + loopback: [[new IPv4([127, 0, 0, 0]), 8]], + "private": [[new IPv4([10, 0, 0, 0]), 8], [new IPv4([172, 16, 0, 0]), 12], [new IPv4([192, 168, 0, 0]), 16]], + reserved: [[new IPv4([192, 0, 0, 0]), 24], [new IPv4([192, 0, 2, 0]), 24], [new IPv4([192, 88, 99, 0]), 24], [new IPv4([198, 51, 100, 0]), 24], [new IPv4([203, 0, 113, 0]), 24], [new IPv4([240, 0, 0, 0]), 4]] + }; + + IPv4.prototype.range = function() { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + + IPv4.prototype.toIPv4MappedAddress = function() { + return ipaddr.IPv6.parse("::ffff:" + (this.toString())); + }; + + return IPv4; + + })(); + + ipv4Part = "(0?\\d+|0x[a-f0-9]+)"; + + ipv4Regexes = { + fourOctet: new RegExp("^" + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "$", 'i'), + longValue: new RegExp("^" + ipv4Part + "$", 'i') + }; + + ipaddr.IPv4.parser = function(string) { + var match, parseIntAuto, part, shift, value; + parseIntAuto = function(string) { + if (string[0] === "0" && string[1] !== "x") { + return parseInt(string, 8); + } else { + return parseInt(string); + } + }; + if (match = string.match(ipv4Regexes.fourOctet)) { + return (function() { + var _i, _len, _ref, _results; + _ref = match.slice(1, 6); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + _results.push(parseIntAuto(part)); + } + return _results; + })(); + } else if (match = string.match(ipv4Regexes.longValue)) { + value = parseIntAuto(match[1]); + if (value > 0xffffffff || value < 0) { + throw new Error("ipaddr: address outside defined range"); + } + return ((function() { + var _i, _results; + _results = []; + for (shift = _i = 0; _i <= 24; shift = _i += 8) { + _results.push((value >> shift) & 0xff); + } + return _results; + })()).reverse(); + } else { + return null; + } + }; + + ipaddr.IPv6 = (function() { + function IPv6(parts) { + var part, _i, _len; + if (parts.length !== 8) { + throw new Error("ipaddr: ipv6 part count should be 8"); + } + for (_i = 0, _len = parts.length; _i < _len; _i++) { + part = parts[_i]; + if (!((0 <= part && part <= 0xffff))) { + throw new Error("ipaddr: ipv6 part should fit to two octets"); + } + } + this.parts = parts; + } + + IPv6.prototype.kind = function() { + return 'ipv6'; + }; + + IPv6.prototype.toString = function() { + var compactStringParts, part, pushPart, state, stringParts, _i, _len; + stringParts = (function() { + var _i, _len, _ref, _results; + _ref = this.parts; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + _results.push(part.toString(16)); + } + return _results; + }).call(this); + compactStringParts = []; + pushPart = function(part) { + return compactStringParts.push(part); + }; + state = 0; + for (_i = 0, _len = stringParts.length; _i < _len; _i++) { + part = stringParts[_i]; + switch (state) { + case 0: + if (part === '0') { + pushPart(''); + } else { + pushPart(part); + } + state = 1; + break; + case 1: + if (part === '0') { + state = 2; + } else { + pushPart(part); + } + break; + case 2: + if (part !== '0') { + pushPart(''); + pushPart(part); + state = 3; + } + break; + case 3: + pushPart(part); + } + } + if (state === 2) { + pushPart(''); + pushPart(''); + } + return compactStringParts.join(":"); + }; + + IPv6.prototype.toByteArray = function() { + var bytes, part, _i, _len, _ref; + bytes = []; + _ref = this.parts; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + bytes.push(part >> 8); + bytes.push(part & 0xff); + } + return bytes; + }; + + IPv6.prototype.toNormalizedString = function() { + var part; + return ((function() { + var _i, _len, _ref, _results; + _ref = this.parts; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + _results.push(part.toString(16)); + } + return _results; + }).call(this)).join(":"); + }; + + IPv6.prototype.match = function(other, cidrRange) { + var _ref; + if (cidrRange === void 0) { + _ref = other, other = _ref[0], cidrRange = _ref[1]; + } + if (other.kind() !== 'ipv6') { + throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one"); + } + return matchCIDR(this.parts, other.parts, 16, cidrRange); + }; + + IPv6.prototype.SpecialRanges = { + unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128], + linkLocal: [new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10], + multicast: [new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8], + loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128], + uniqueLocal: [new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7], + ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96], + rfc6145: [new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96], + rfc6052: [new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96], + '6to4': [new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16], + teredo: [new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32], + reserved: [[new IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32]] + }; + + IPv6.prototype.range = function() { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + + IPv6.prototype.isIPv4MappedAddress = function() { + return this.range() === 'ipv4Mapped'; + }; + + IPv6.prototype.toIPv4Address = function() { + var high, low, _ref; + if (!this.isIPv4MappedAddress()) { + throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4"); + } + _ref = this.parts.slice(-2), high = _ref[0], low = _ref[1]; + return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff]); + }; + + return IPv6; + + })(); + + ipv6Part = "(?:[0-9a-f]+::?)+"; + + ipv6Regexes = { + "native": new RegExp("^(::)?(" + ipv6Part + ")?([0-9a-f]+)?(::)?$", 'i'), + transitional: new RegExp(("^((?:" + ipv6Part + ")|(?:::)(?:" + ipv6Part + ")?)") + ("" + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "$"), 'i') + }; + + expandIPv6 = function(string, parts) { + var colonCount, lastColon, part, replacement, replacementCount; + if (string.indexOf('::') !== string.lastIndexOf('::')) { + return null; + } + colonCount = 0; + lastColon = -1; + while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) { + colonCount++; + } + if (string[0] === ':') { + colonCount--; + } + if (string[string.length - 1] === ':') { + colonCount--; + } + if (colonCount > parts) { + return null; + } + replacementCount = parts - colonCount; + replacement = ':'; + while (replacementCount--) { + replacement += '0:'; + } + string = string.replace('::', replacement); + if (string[0] === ':') { + string = string.slice(1); + } + if (string[string.length - 1] === ':') { + string = string.slice(0, -1); + } + return (function() { + var _i, _len, _ref, _results; + _ref = string.split(":"); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + _results.push(parseInt(part, 16)); + } + return _results; + })(); + }; + + ipaddr.IPv6.parser = function(string) { + var match, parts; + if (string.match(ipv6Regexes['native'])) { + return expandIPv6(string, 8); + } else if (match = string.match(ipv6Regexes['transitional'])) { + parts = expandIPv6(match[1].slice(0, -1), 6); + if (parts) { + parts.push(parseInt(match[2]) << 8 | parseInt(match[3])); + parts.push(parseInt(match[4]) << 8 | parseInt(match[5])); + return parts; + } + } + return null; + }; + + ipaddr.IPv4.isIPv4 = ipaddr.IPv6.isIPv6 = function(string) { + return this.parser(string) !== null; + }; + + ipaddr.IPv4.isValid = ipaddr.IPv6.isValid = function(string) { + var e; + try { + new this(this.parser(string)); + return true; + } catch (_error) { + e = _error; + return false; + } + }; + + ipaddr.IPv4.parse = ipaddr.IPv6.parse = function(string) { + var parts; + parts = this.parser(string); + if (parts === null) { + throw new Error("ipaddr: string is not formatted like ip address"); + } + return new this(parts); + }; + + ipaddr.IPv4.parseCIDR = ipaddr.IPv6.parseCIDR = function(string) { + var match; + if (match = string.match(/^(.+)\/(\d+)$/)) { + return [this.parse(match[1]), parseInt(match[2])]; + } + throw new Error("ipaddr: string is not formatted like a CIDR range"); + }; + + ipaddr.isValid = function(string) { + return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string); + }; + + ipaddr.parse = function(string) { + if (ipaddr.IPv6.isValid(string)) { + return ipaddr.IPv6.parse(string); + } else if (ipaddr.IPv4.isValid(string)) { + return ipaddr.IPv4.parse(string); + } else { + throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format"); + } + }; + + ipaddr.parseCIDR = function(string) { + var e; + try { + return ipaddr.IPv6.parseCIDR(string); + } catch (_error) { + e = _error; + try { + return ipaddr.IPv4.parseCIDR(string); + } catch (_error) { + e = _error; + throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format"); + } + } + }; + + ipaddr.process = function(string) { + var addr; + addr = this.parse(string); + if (addr.kind() === 'ipv6' && addr.isIPv4MappedAddress()) { + return addr.toIPv4Address(); + } else { + return addr; + } + }; + +}).call(this); diff --git a/node_modules/compact2string/node_modules/ipaddr.js/package.json b/node_modules/compact2string/node_modules/ipaddr.js/package.json new file mode 100644 index 00000000..311d8d33 --- /dev/null +++ b/node_modules/compact2string/node_modules/ipaddr.js/package.json @@ -0,0 +1,60 @@ +{ + "name": "ipaddr.js", + "description": "A library for manipulating IPv4 and IPv6 addresses in JavaScript.", + "version": "1.0.1", + "author": { + "name": "Peter Zotov", + "email": "whitequark@whitequark.org" + }, + "directories": { + "lib": "./lib" + }, + "dependencies": {}, + "devDependencies": { + "coffee-script": "~1.6", + "nodeunit": "~0.5.3", + "uglify-js": "latest" + }, + "scripts": { + "test": "cake build test" + }, + "keywords": [ + "ip", + "ipv4", + "ipv6" + ], + "repository": { + "type": "git", + "url": "git://github.com/whitequark/ipaddr.js" + }, + "main": "./lib/ipaddr", + "engines": { + "node": ">= 0.2.5" + }, + "license": "MIT", + "gitHead": "0a5a26d9317a58d67047e7f32b5b1bbe7f2f7fbf", + "bugs": { + "url": "https://github.com/whitequark/ipaddr.js/issues" + }, + "_id": "ipaddr.js@1.0.1", + "_shasum": "5f38801dc73e0400fc7076386f6ed5215fbd8f95", + "_from": "ipaddr.js@>=1.0.1 <2.0.0", + "_npmVersion": "1.4.21", + "_npmUser": { + "name": "whitequark", + "email": "whitequark@whitequark.org" + }, + "maintainers": [ + { + "name": "whitequark", + "email": "whitequark@whitequark.org" + } + ], + "dist": { + "shasum": "5f38801dc73e0400fc7076386f6ed5215fbd8f95", + "tarball": "http://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.0.1.tgz", + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/whitequark/ipaddr.js" +} diff --git a/node_modules/compact2string/node_modules/ipaddr.js/src/ipaddr.coffee b/node_modules/compact2string/node_modules/ipaddr.js/src/ipaddr.coffee new file mode 100644 index 00000000..0a48080f --- /dev/null +++ b/node_modules/compact2string/node_modules/ipaddr.js/src/ipaddr.coffee @@ -0,0 +1,374 @@ +# Define the main object +ipaddr = {} + +root = this + +# Export for both the CommonJS and browser-like environment +if module? && module.exports + module.exports = ipaddr +else + root['ipaddr'] = ipaddr + +# A generic CIDR (Classless Inter-Domain Routing) RFC1518 range matcher. +matchCIDR = (first, second, partSize, cidrBits) -> + if first.length != second.length + throw new Error "ipaddr: cannot match CIDR for objects with different lengths" + + part = 0 + while cidrBits > 0 + shift = partSize - cidrBits + shift = 0 if shift < 0 + + if first[part] >> shift != second[part] >> shift + return false + + cidrBits -= partSize + part += 1 + + return true + +# An utility function to ease named range matching. See examples below. +ipaddr.subnetMatch = (address, rangeList, defaultName='unicast') -> + for rangeName, rangeSubnets of rangeList + # ECMA5 Array.isArray isn't available everywhere + if toString.call(rangeSubnets[0]) != '[object Array]' + rangeSubnets = [ rangeSubnets ] + + for subnet in rangeSubnets + return rangeName if address.match.apply(address, subnet) + + return defaultName + +# An IPv4 address (RFC791). +class ipaddr.IPv4 + # Constructs a new IPv4 address from an array of four octets. + # Verifies the input. + constructor: (octets) -> + if octets.length != 4 + throw new Error "ipaddr: ipv4 octet count should be 4" + + for octet in octets + if !(0 <= octet <= 255) + throw new Error "ipaddr: ipv4 octet is a byte" + + @octets = octets + + # The 'kind' method exists on both IPv4 and IPv6 classes. + kind: -> + return 'ipv4' + + # Returns the address in convenient, decimal-dotted format. + toString: -> + return @octets.join "." + + # Returns an array of byte-sized values in network order + toByteArray: -> + return @octets.slice(0) # octets.clone + + # Checks if this address matches other one within given CIDR range. + match: (other, cidrRange) -> + if cidrRange == undefined + [other, cidrRange] = other + + if other.kind() != 'ipv4' + throw new Error "ipaddr: cannot match ipv4 address with non-ipv4 one" + + return matchCIDR(this.octets, other.octets, 8, cidrRange) + + # Special IPv4 address ranges. + SpecialRanges: + unspecified: [ + [ new IPv4([0, 0, 0, 0]), 8 ] + ] + broadcast: [ + [ new IPv4([255, 255, 255, 255]), 32 ] + ] + multicast: [ # RFC3171 + [ new IPv4([224, 0, 0, 0]), 4 ] + ] + linkLocal: [ # RFC3927 + [ new IPv4([169, 254, 0, 0]), 16 ] + ] + loopback: [ # RFC5735 + [ new IPv4([127, 0, 0, 0]), 8 ] + ] + private: [ # RFC1918 + [ new IPv4([10, 0, 0, 0]), 8 ] + [ new IPv4([172, 16, 0, 0]), 12 ] + [ new IPv4([192, 168, 0, 0]), 16 ] + ] + reserved: [ # Reserved and testing-only ranges; RFCs 5735, 5737, 2544, 1700 + [ new IPv4([192, 0, 0, 0]), 24 ] + [ new IPv4([192, 0, 2, 0]), 24 ] + [ new IPv4([192, 88, 99, 0]), 24 ] + [ new IPv4([198, 51, 100, 0]), 24 ] + [ new IPv4([203, 0, 113, 0]), 24 ] + [ new IPv4([240, 0, 0, 0]), 4 ] + ] + + # Checks if the address corresponds to one of the special ranges. + range: -> + return ipaddr.subnetMatch(this, @SpecialRanges) + + # Convrets this IPv4 address to an IPv4-mapped IPv6 address. + toIPv4MappedAddress: -> + return ipaddr.IPv6.parse "::ffff:#{@toString()}" + +# A list of regular expressions that match arbitrary IPv4 addresses, +# for which a number of weird notations exist. +# Note that an address like 0010.0xa5.1.1 is considered legal. +ipv4Part = "(0?\\d+|0x[a-f0-9]+)" +ipv4Regexes = + fourOctet: new RegExp "^#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}$", 'i' + longValue: new RegExp "^#{ipv4Part}$", 'i' + +# Classful variants (like a.b, where a is an octet, and b is a 24-bit +# value representing last three octets; this corresponds to a class C +# address) are omitted due to classless nature of modern Internet. +ipaddr.IPv4.parser = (string) -> + parseIntAuto = (string) -> + if string[0] == "0" && string[1] != "x" + parseInt(string, 8) + else + parseInt(string) + + # parseInt recognizes all that octal & hexadecimal weirdness for us + if match = string.match(ipv4Regexes.fourOctet) + return (parseIntAuto(part) for part in match[1..5]) + else if match = string.match(ipv4Regexes.longValue) + value = parseIntAuto(match[1]) + if value > 0xffffffff || value < 0 + throw new Error "ipaddr: address outside defined range" + return ((value >> shift) & 0xff for shift in [0..24] by 8).reverse() + else + return null + +# An IPv6 address (RFC2460) +class ipaddr.IPv6 + # Constructs an IPv6 address from an array of eight 16-bit parts. + # Throws an error if the input is invalid. + constructor: (parts) -> + if parts.length != 8 + throw new Error "ipaddr: ipv6 part count should be 8" + + for part in parts + if !(0 <= part <= 0xffff) + throw new Error "ipaddr: ipv6 part should fit to two octets" + + @parts = parts + + # The 'kind' method exists on both IPv4 and IPv6 classes. + kind: -> + return 'ipv6' + + # Returns the address in compact, human-readable format like + # 2001:db8:8:66::1 + toString: -> + stringParts = (part.toString(16) for part in @parts) + + compactStringParts = [] + pushPart = (part) -> compactStringParts.push part + + state = 0 + for part in stringParts + switch state + when 0 + if part == '0' + pushPart('') + else + pushPart(part) + + state = 1 + when 1 + if part == '0' + state = 2 + else + pushPart(part) + when 2 + unless part == '0' + pushPart('') + pushPart(part) + state = 3 + when 3 + pushPart(part) + + if state == 2 + pushPart('') + pushPart('') + + return compactStringParts.join ":" + + # Returns an array of byte-sized values in network order + toByteArray: -> + bytes = [] + for part in @parts + bytes.push(part >> 8) + bytes.push(part & 0xff) + + return bytes + + # Returns the address in expanded format with all zeroes included, like + # 2001:db8:8:66:0:0:0:1 + toNormalizedString: -> + return (part.toString(16) for part in @parts).join ":" + + # Checks if this address matches other one within given CIDR range. + match: (other, cidrRange) -> + if cidrRange == undefined + [other, cidrRange] = other + + if other.kind() != 'ipv6' + throw new Error "ipaddr: cannot match ipv6 address with non-ipv6 one" + + return matchCIDR(this.parts, other.parts, 16, cidrRange) + + # Special IPv6 ranges + SpecialRanges: + unspecified: [ new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128 ] # RFC4291, here and after + linkLocal: [ new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10 ] + multicast: [ new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8 ] + loopback: [ new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128 ] + uniqueLocal: [ new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7 ] + ipv4Mapped: [ new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96 ] + rfc6145: [ new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96 ] # RFC6145 + rfc6052: [ new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96 ] # RFC6052 + '6to4': [ new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16 ] # RFC3056 + teredo: [ new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32 ] # RFC6052, RFC6146 + reserved: [ + [ new IPv6([ 0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32 ] # RFC4291 + ] + + # Checks if the address corresponds to one of the special ranges. + range: -> + return ipaddr.subnetMatch(this, @SpecialRanges) + + # Checks if this address is an IPv4-mapped IPv6 address. + isIPv4MappedAddress: -> + return @range() == 'ipv4Mapped' + + # Converts this address to IPv4 address if it is an IPv4-mapped IPv6 address. + # Throws an error otherwise. + toIPv4Address: -> + unless @isIPv4MappedAddress() + throw new Error "ipaddr: trying to convert a generic ipv6 address to ipv4" + + [high, low] = @parts[-2..-1] + + return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff]) + +# IPv6-matching regular expressions. +# For IPv6, the task is simpler: it is enough to match the colon-delimited +# hexadecimal IPv6 and a transitional variant with dotted-decimal IPv4 at +# the end. +ipv6Part = "(?:[0-9a-f]+::?)+" +ipv6Regexes = + native: new RegExp "^(::)?(#{ipv6Part})?([0-9a-f]+)?(::)?$", 'i' + transitional: new RegExp "^((?:#{ipv6Part})|(?:::)(?:#{ipv6Part})?)" + + "#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}$", 'i' + +# Expand :: in an IPv6 address or address part consisting of `parts` groups. +expandIPv6 = (string, parts) -> + # More than one '::' means invalid adddress + if string.indexOf('::') != string.lastIndexOf('::') + return null + + # How many parts do we already have? + colonCount = 0 + lastColon = -1 + while (lastColon = string.indexOf(':', lastColon + 1)) >= 0 + colonCount++ + + # 0::0 is two parts more than :: + colonCount-- if string[0] == ':' + colonCount-- if string[string.length-1] == ':' + + # The following loop would hang if colonCount > parts + if colonCount > parts + return null + + # replacement = ':' + '0:' * (parts - colonCount) + replacementCount = parts - colonCount + replacement = ':' + while replacementCount-- + replacement += '0:' + + # Insert the missing zeroes + string = string.replace('::', replacement) + + # Trim any garbage which may be hanging around if :: was at the edge in + # the source string + string = string[1..-1] if string[0] == ':' + string = string[0..-2] if string[string.length-1] == ':' + + return (parseInt(part, 16) for part in string.split(":")) + +# Parse an IPv6 address. +ipaddr.IPv6.parser = (string) -> + if string.match(ipv6Regexes['native']) + return expandIPv6(string, 8) + + else if match = string.match(ipv6Regexes['transitional']) + parts = expandIPv6(match[1][0..-2], 6) + if parts + parts.push(parseInt(match[2]) << 8 | parseInt(match[3])) + parts.push(parseInt(match[4]) << 8 | parseInt(match[5])) + return parts + + return null + +# Checks if a given string is formatted like IPv4/IPv6 address. +ipaddr.IPv4.isIPv4 = ipaddr.IPv6.isIPv6 = (string) -> + return @parser(string) != null + +# Checks if a given string is a valid IPv4/IPv6 address. +ipaddr.IPv4.isValid = ipaddr.IPv6.isValid = (string) -> + try + new this(@parser(string)) + return true + catch e + return false + +# Tries to parse and validate a string with IPv4/IPv6 address. +# Throws an error if it fails. +ipaddr.IPv4.parse = ipaddr.IPv6.parse = (string) -> + parts = @parser(string) + if parts == null + throw new Error "ipaddr: string is not formatted like ip address" + + return new this(parts) + +ipaddr.IPv4.parseCIDR = ipaddr.IPv6.parseCIDR = (string) -> + if match = string.match(/^(.+)\/(\d+)$/) + return [@parse(match[1]), parseInt(match[2])] + + throw new Error "ipaddr: string is not formatted like a CIDR range" + +# Checks if the address is valid IP address +ipaddr.isValid = (string) -> + return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string) + +# Try to parse an address and throw an error if it is impossible +ipaddr.parse = (string) -> + if ipaddr.IPv6.isValid(string) + return ipaddr.IPv6.parse(string) + else if ipaddr.IPv4.isValid(string) + return ipaddr.IPv4.parse(string) + else + throw new Error "ipaddr: the address has neither IPv6 nor IPv4 format" + +ipaddr.parseCIDR = (string) -> + try + return ipaddr.IPv6.parseCIDR(string) + catch e + try + return ipaddr.IPv4.parseCIDR(string) + catch e + throw new Error "ipaddr: the address has neither IPv6 nor IPv4 CIDR format" + +# Parse an address and return plain IPv4 address if it is an IPv4-mapped address +ipaddr.process = (string) -> + addr = @parse(string) + if addr.kind() == 'ipv6' && addr.isIPv4MappedAddress() + return addr.toIPv4Address() + else + return addr diff --git a/node_modules/compact2string/node_modules/ipaddr.js/test/ipaddr.test.coffee b/node_modules/compact2string/node_modules/ipaddr.js/test/ipaddr.test.coffee new file mode 100644 index 00000000..361561e7 --- /dev/null +++ b/node_modules/compact2string/node_modules/ipaddr.js/test/ipaddr.test.coffee @@ -0,0 +1,262 @@ +ipaddr = require '../lib/ipaddr' + +module.exports = + 'should define main classes': (test) -> + test.ok(ipaddr.IPv4?, 'defines IPv4 class') + test.ok(ipaddr.IPv6?, 'defines IPv6 class') + test.done() + + 'can construct IPv4 from octets': (test) -> + test.doesNotThrow -> + new ipaddr.IPv4([192, 168, 1, 2]) + test.done() + + 'refuses to construct invalid IPv4': (test) -> + test.throws -> + new ipaddr.IPv4([300, 1, 2, 3]) + test.throws -> + new ipaddr.IPv4([8, 8, 8]) + test.done() + + 'converts IPv4 to string correctly': (test) -> + addr = new ipaddr.IPv4([192, 168, 1, 1]) + test.equal(addr.toString(), '192.168.1.1') + test.done() + + 'returns correct kind for IPv4': (test) -> + addr = new ipaddr.IPv4([1, 2, 3, 4]) + test.equal(addr.kind(), 'ipv4') + test.done() + + 'allows to access IPv4 octets': (test) -> + addr = new ipaddr.IPv4([42, 0, 0, 0]) + test.equal(addr.octets[0], 42) + test.done() + + 'checks IPv4 address format': (test) -> + test.equal(ipaddr.IPv4.isIPv4('192.168.007.0xa'), true) + test.equal(ipaddr.IPv4.isIPv4('1024.0.0.1'), true) + test.equal(ipaddr.IPv4.isIPv4('8.0xa.wtf.6'), false) + test.done() + + 'validates IPv4 addresses': (test) -> + test.equal(ipaddr.IPv4.isValid('192.168.007.0xa'), true) + test.equal(ipaddr.IPv4.isValid('1024.0.0.1'), false) + test.equal(ipaddr.IPv4.isValid('8.0xa.wtf.6'), false) + test.done() + + 'parses IPv4 in several weird formats': (test) -> + test.deepEqual(ipaddr.IPv4.parse('192.168.1.1').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('0xc0.168.1.1').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('192.0250.1.1').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('0xc0a80101').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('030052000401').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('3232235777').octets, [192, 168, 1, 1]) + test.done() + + 'barfs at invalid IPv4': (test) -> + test.throws -> + ipaddr.IPv4.parse('10.0.0.wtf') + test.done() + + 'matches IPv4 CIDR correctly': (test) -> + addr = new ipaddr.IPv4([10, 5, 0, 1]) + test.equal(addr.match(ipaddr.IPv4.parse('0.0.0.0'), 0), true) + test.equal(addr.match(ipaddr.IPv4.parse('11.0.0.0'), 8), false) + test.equal(addr.match(ipaddr.IPv4.parse('10.0.0.0'), 8), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.0.0.1'), 8), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.0.0.10'), 8), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.5.5.0'), 16), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.4.5.0'), 16), false) + test.equal(addr.match(ipaddr.IPv4.parse('10.4.5.0'), 15), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.5.0.2'), 32), false) + test.equal(addr.match(addr, 32), true) + test.done() + + 'parses IPv4 CIDR correctly': (test) -> + addr = new ipaddr.IPv4([10, 5, 0, 1]) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('0.0.0.0/0')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('11.0.0.0/8')), false) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.0.0.0/8')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.0.0.1/8')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.0.0.10/8')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.5.5.0/16')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.4.5.0/16')), false) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.4.5.0/15')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.5.0.2/32')), false) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.5.0.1/32')), true) + test.throws -> + ipaddr.IPv4.parseCIDR('10.5.0.1') + test.done() + + 'detects reserved IPv4 networks': (test) -> + test.equal(ipaddr.IPv4.parse('0.0.0.0').range(), 'unspecified') + test.equal(ipaddr.IPv4.parse('0.1.0.0').range(), 'unspecified') + test.equal(ipaddr.IPv4.parse('10.1.0.1').range(), 'private') + test.equal(ipaddr.IPv4.parse('192.168.2.1').range(), 'private') + test.equal(ipaddr.IPv4.parse('224.100.0.1').range(), 'multicast') + test.equal(ipaddr.IPv4.parse('169.254.15.0').range(), 'linkLocal') + test.equal(ipaddr.IPv4.parse('127.1.1.1').range(), 'loopback') + test.equal(ipaddr.IPv4.parse('255.255.255.255').range(), 'broadcast') + test.equal(ipaddr.IPv4.parse('240.1.2.3').range(), 'reserved') + test.equal(ipaddr.IPv4.parse('8.8.8.8').range(), 'unicast') + test.done() + + 'can construct IPv6 from parts': (test) -> + test.doesNotThrow -> + new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1]) + test.done() + + 'refuses to construct invalid IPv6': (test) -> + test.throws -> + new ipaddr.IPv6([0xfffff, 0, 0, 0, 0, 0, 0, 1]) + test.throws -> + new ipaddr.IPv6([0xfffff, 0, 0, 0, 0, 0, 1]) + test.done() + + 'converts IPv6 to string correctly': (test) -> + addr = new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1]) + test.equal(addr.toNormalizedString(), '2001:db8:f53a:0:0:0:0:1') + test.equal(addr.toString(), '2001:db8:f53a::1') + test.equal(new ipaddr.IPv6([0, 0, 0, 0, 0, 0, 0, 1]).toString(), '::1') + test.equal(new ipaddr.IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]).toString(), '2001:db8::') + test.done() + + 'returns correct kind for IPv6': (test) -> + addr = new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1]) + test.equal(addr.kind(), 'ipv6') + test.done() + + 'allows to access IPv6 address parts': (test) -> + addr = new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 42, 0, 1]) + test.equal(addr.parts[5], 42) + test.done() + + 'checks IPv6 address format': (test) -> + test.equal(ipaddr.IPv6.isIPv6('2001:db8:F53A::1'), true) + test.equal(ipaddr.IPv6.isIPv6('200001::1'), true) + test.equal(ipaddr.IPv6.isIPv6('::ffff:192.168.1.1'), true) + test.equal(ipaddr.IPv6.isIPv6('::ffff:300.168.1.1'), true) + test.equal(ipaddr.IPv6.isIPv6('::ffff:300.168.1.1:0'), false) + test.equal(ipaddr.IPv6.isIPv6('fe80::wtf'), false) + test.done() + + 'validates IPv6 addresses': (test) -> + test.equal(ipaddr.IPv6.isValid('2001:db8:F53A::1'), true) + test.equal(ipaddr.IPv6.isValid('200001::1'), false) + test.equal(ipaddr.IPv6.isValid('::ffff:192.168.1.1'), true) + test.equal(ipaddr.IPv6.isValid('::ffff:300.168.1.1'), false) + test.equal(ipaddr.IPv6.isValid('::ffff:300.168.1.1:0'), false) + test.equal(ipaddr.IPv6.isValid('2001:db8::F53A::1'), false) + test.equal(ipaddr.IPv6.isValid('fe80::wtf'), false) + test.done() + + 'parses IPv6 in different formats': (test) -> + test.deepEqual(ipaddr.IPv6.parse('2001:db8:F53A:0:0:0:0:1').parts, [0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1]) + test.deepEqual(ipaddr.IPv6.parse('fe80::10').parts, [0xfe80, 0, 0, 0, 0, 0, 0, 0x10]) + test.deepEqual(ipaddr.IPv6.parse('2001:db8:F53A::').parts, [0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 0]) + test.deepEqual(ipaddr.IPv6.parse('::1').parts, [0, 0, 0, 0, 0, 0, 0, 1]) + test.deepEqual(ipaddr.IPv6.parse('::').parts, [0, 0, 0, 0, 0, 0, 0, 0]) + test.done() + + 'barfs at invalid IPv6': (test) -> + test.throws -> + ipaddr.IPv6.parse('fe80::0::1') + test.done() + + 'matches IPv6 CIDR correctly': (test) -> + addr = ipaddr.IPv6.parse('2001:db8:f53a::1') + test.equal(addr.match(ipaddr.IPv6.parse('::'), 0), true) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f53a::1:1'), 64), true) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f53b::1:1'), 48), false) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f531::1:1'), 44), true) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f500::1'), 40), true) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db9:f500::1'), 40), false) + test.equal(addr.match(addr, 128), true) + test.done() + + 'parses IPv6 CIDR correctly': (test) -> + addr = ipaddr.IPv6.parse('2001:db8:f53a::1') + test.equal(addr.match(ipaddr.IPv6.parseCIDR('::/0')), true) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f53a::1:1/64')), true) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f53b::1:1/48')), false) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f531::1:1/44')), true) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f500::1/40')), true) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db9:f500::1/40')), false) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f53a::1/128')), true) + test.throws -> + ipaddr.IPv6.parseCIDR('2001:db8:f53a::1') + test.done() + + 'converts between IPv4-mapped IPv6 addresses and IPv4 addresses': (test) -> + addr = ipaddr.IPv4.parse('77.88.21.11') + mapped = addr.toIPv4MappedAddress() + test.deepEqual(mapped.parts, [0, 0, 0, 0, 0, 0xffff, 0x4d58, 0x150b]) + test.deepEqual(mapped.toIPv4Address().octets, addr.octets) + test.done() + + 'refuses to convert non-IPv4-mapped IPv6 address to IPv4 address': (test) -> + test.throws -> + ipaddr.IPv6.parse('2001:db8::1').toIPv4Address() + test.done() + + 'detects reserved IPv6 networks': (test) -> + test.equal(ipaddr.IPv6.parse('::').range(), 'unspecified') + test.equal(ipaddr.IPv6.parse('fe80::1234:5678:abcd:0123').range(), 'linkLocal') + test.equal(ipaddr.IPv6.parse('ff00::1234').range(), 'multicast') + test.equal(ipaddr.IPv6.parse('::1').range(), 'loopback') + test.equal(ipaddr.IPv6.parse('fc00::').range(), 'uniqueLocal') + test.equal(ipaddr.IPv6.parse('::ffff:192.168.1.10').range(), 'ipv4Mapped') + test.equal(ipaddr.IPv6.parse('::ffff:0:192.168.1.10').range(), 'rfc6145') + test.equal(ipaddr.IPv6.parse('64:ff9b::1234').range(), 'rfc6052') + test.equal(ipaddr.IPv6.parse('2002:1f63:45e8::1').range(), '6to4') + test.equal(ipaddr.IPv6.parse('2001::4242').range(), 'teredo') + test.equal(ipaddr.IPv6.parse('2001:db8::3210').range(), 'reserved') + test.equal(ipaddr.IPv6.parse('2001:470:8:66::1').range(), 'unicast') + test.done() + + 'is able to determine IP address type': (test) -> + test.equal(ipaddr.parse('8.8.8.8').kind(), 'ipv4') + test.equal(ipaddr.parse('2001:db8:3312::1').kind(), 'ipv6') + test.done() + + 'throws an error if tried to parse an invalid address': (test) -> + test.throws -> + ipaddr.parse('::some.nonsense') + test.done() + + 'correctly processes IPv4-mapped addresses': (test) -> + test.equal(ipaddr.process('8.8.8.8').kind(), 'ipv4') + test.equal(ipaddr.process('2001:db8:3312::1').kind(), 'ipv6') + test.equal(ipaddr.process('::ffff:192.168.1.1').kind(), 'ipv4') + test.done() + + 'correctly converts IPv6 and IPv4 addresses to byte arrays': (test) -> + test.deepEqual(ipaddr.parse('1.2.3.4').toByteArray(), + [0x1, 0x2, 0x3, 0x4]); + # Fuck yeah. The first byte of Google's IPv6 address is 42. 42! + test.deepEqual(ipaddr.parse('2a00:1450:8007::68').toByteArray(), + [42, 0x00, 0x14, 0x50, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68 ]) + test.done() + + 'correctly parses 1 as an IPv4 address': (test) -> + test.equal(ipaddr.IPv6.isValid('1'), false) + test.equal(ipaddr.IPv4.isValid('1'), true) + test.deepEqual(new ipaddr.IPv4([0, 0, 0, 1]), ipaddr.parse('1')) + test.done() + + 'correctly detects IPv4 and IPv6 CIDR addresses': (test) -> + test.deepEqual([ipaddr.IPv6.parse('fc00::'), 64], + ipaddr.parseCIDR('fc00::/64')) + test.deepEqual([ipaddr.IPv4.parse('1.2.3.4'), 5], + ipaddr.parseCIDR('1.2.3.4/5')) + test.done() + + 'does not consider a very large or very small number a valid IP address': (test) -> + test.equal(ipaddr.isValid('4999999999'), false) + test.equal(ipaddr.isValid('-1'), false) + test.done() + + 'does not hang on ::8:8:8:8:8:8:8:8:8': (test) -> + test.equal(ipaddr.IPv6.isValid('::8:8:8:8:8:8:8:8:8'), false) + test.done() diff --git a/node_modules/compact2string/package.json b/node_modules/compact2string/package.json new file mode 100644 index 00000000..94fe7468 --- /dev/null +++ b/node_modules/compact2string/package.json @@ -0,0 +1,74 @@ +{ + "name": "compact2string", + "version": "1.4.0", + "description": "Convert BitTorrent compact hostname & port buffer to a string 'hostname:port'", + "main": "index.js", + "scripts": { + "test": "./node_modules/mocha/bin/mocha -R spec", + "travis-test": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec", + "report-coverage": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls" + }, + "repository": { + "type": "git", + "url": "https://github.com/bencevans/node-compact2string.git" + }, + "bugs": { + "url": "https://github.com/bencevans/node-compact2string/issues" + }, + "keywords": [ + "torrent", + "compact", + "tracker", + "bittorrent", + "binary", + "convert" + ], + "author": { + "name": "Ben Evans", + "email": "ben@bensbit.co.uk", + "url": "http://bensbit.co.uk" + }, + "license": "BSD", + "devDependencies": { + "mocha": "~1.7.4", + "istanbul": "~0.1.44", + "coveralls": "~2.3.0" + }, + "dependencies": { + "ipaddr.js": ">= 0.1.5" + }, + "testling": { + "harness": "mocha-bdd", + "files": "test.js", + "browsers": [ + "ie/9..latest", + "chrome/25..latest", + "firefox/20..latest", + "safari/6..latest", + "opera/15.0..latest" + ] + }, + "gitHead": "c80e7a2fd2e9d76439d2de2a8a285ae4fd833213", + "homepage": "https://github.com/bencevans/node-compact2string", + "_id": "compact2string@1.4.0", + "_shasum": "a99cd96ea000525684b269683ae2222d6eea7b49", + "_from": "compact2string@1.4.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "bencevans", + "email": "ben@bensbit.co.uk" + }, + "maintainers": [ + { + "name": "bencevans", + "email": "ben@bensbit.co.uk" + } + ], + "dist": { + "shasum": "a99cd96ea000525684b269683ae2222d6eea7b49", + "tarball": "http://registry.npmjs.org/compact2string/-/compact2string-1.4.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/compact2string/-/compact2string-1.4.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/compact2string/test.js b/node_modules/compact2string/test.js new file mode 100644 index 00000000..9d3c9ace --- /dev/null +++ b/node_modules/compact2string/test.js @@ -0,0 +1,44 @@ +var assert = require('assert'); +var compact2string = require('./'); + +describe('compact2string', function() { + + it('should return expected IPv4 address', function() { + assert.equal('10.10.10.5:65408', compact2string(new Buffer("0A0A0A05FF80", "hex"))); + }); + it('should return expected IPv6 address', function() { + assert.equal('[2a03:2880:2110:9f07:face:b00c::1]:80', compact2string(new Buffer("2a03288021109f07faceb00c000000010050", "hex"))); + }); + + it('should throw an error if the buffer length isn\'t 6 or 18', function() { + assert.throws(function() { + compact2string(new Buffer("0A0A0A05", "hex")); + }, /should contain 6 or 18 bytes/); + }); +}); + +describe('compact2string.multi', function() { + it('should return expected multi', function() { + assert.deepEqual([ '10.10.10.5:128', '100.56.58.99:28525' ], compact2string.multi(new Buffer("0A0A0A05008064383a636f6d", "hex"))); + }); + + it('should throw an error if the buffer isn\'t a multiple of 6', function() { + assert.throws(function() { + compact2string.multi(new Buffer("0A0A0A05050505", "hex")); + }, /multiple of/); + }); + +}); + +describe('compact2string.multi6', function() { + it('should return expected multi6', function() { + assert.deepEqual([ '[2a03:2880:2110:9f07:face:b00c::1]:80', '[2a00:1450:4008:801::1010]:443' ], compact2string.multi6(new Buffer("2a03288021109f07faceb00c0000000100502a00145040080801000000000000101001bb", "hex"))); + }); + + it('should throw an error if the buffer isn\'t a multiple of 18', function() { + assert.throws(function() { + compact2string.multi6(new Buffer("0A0A0A050505050A0A0A050505050A0A0A05050505", "hex")); + }, /multiple of/); + }); + +}); diff --git a/node_modules/crypto-browserify/.npmignore b/node_modules/crypto-browserify/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/crypto-browserify/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/crypto-browserify/.travis.yml b/node_modules/crypto-browserify/.travis.yml new file mode 100644 index 00000000..737e0350 --- /dev/null +++ b/node_modules/crypto-browserify/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "0.10" + - "0.11" + - "0.12" + - "iojs" \ No newline at end of file diff --git a/node_modules/crypto-browserify/LICENSE b/node_modules/crypto-browserify/LICENSE new file mode 100644 index 00000000..8abb57d6 --- /dev/null +++ b/node_modules/crypto-browserify/LICENSE @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2013 Dominic Tarr + +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. \ No newline at end of file diff --git a/node_modules/crypto-browserify/example/bundle.js b/node_modules/crypto-browserify/example/bundle.js new file mode 100644 index 00000000..02698cc7 --- /dev/null +++ b/node_modules/crypto-browserify/example/bundle.js @@ -0,0 +1,637 @@ +var require = function (file, cwd) { + var resolved = require.resolve(file, cwd || '/'); + var mod = require.modules[resolved]; + if (!mod) throw new Error( + 'Failed to resolve module ' + file + ', tried ' + resolved + ); + var res = mod._cached ? mod._cached : mod(); + return res; +} + +require.paths = []; +require.modules = {}; +require.extensions = [".js",".coffee"]; + +require._core = { + 'assert': true, + 'events': true, + 'fs': true, + 'path': true, + 'vm': true +}; + +require.resolve = (function () { + return function (x, cwd) { + if (!cwd) cwd = '/'; + + if (require._core[x]) return x; + var path = require.modules.path(); + cwd = path.resolve('/', cwd); + var y = cwd || '/'; + + if (x.match(/^(?:\.\.?\/|\/)/)) { + var m = loadAsFileSync(path.resolve(y, x)) + || loadAsDirectorySync(path.resolve(y, x)); + if (m) return m; + } + + var n = loadNodeModulesSync(x, y); + if (n) return n; + + throw new Error("Cannot find module '" + x + "'"); + + function loadAsFileSync (x) { + if (require.modules[x]) { + return x; + } + + for (var i = 0; i < require.extensions.length; i++) { + var ext = require.extensions[i]; + if (require.modules[x + ext]) return x + ext; + } + } + + function loadAsDirectorySync (x) { + x = x.replace(/\/+$/, ''); + var pkgfile = x + '/package.json'; + if (require.modules[pkgfile]) { + var pkg = require.modules[pkgfile](); + var b = pkg.browserify; + if (typeof b === 'object' && b.main) { + var m = loadAsFileSync(path.resolve(x, b.main)); + if (m) return m; + } + else if (typeof b === 'string') { + var m = loadAsFileSync(path.resolve(x, b)); + if (m) return m; + } + else if (pkg.main) { + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + } + } + + return loadAsFileSync(x + '/index'); + } + + function loadNodeModulesSync (x, start) { + var dirs = nodeModulesPathsSync(start); + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + var m = loadAsFileSync(dir + '/' + x); + if (m) return m; + var n = loadAsDirectorySync(dir + '/' + x); + if (n) return n; + } + + var m = loadAsFileSync(x); + if (m) return m; + } + + function nodeModulesPathsSync (start) { + var parts; + if (start === '/') parts = [ '' ]; + else parts = path.normalize(start).split('/'); + + var dirs = []; + for (var i = parts.length - 1; i >= 0; i--) { + if (parts[i] === 'node_modules') continue; + var dir = parts.slice(0, i + 1).join('/') + '/node_modules'; + dirs.push(dir); + } + + return dirs; + } + }; +})(); + +require.alias = function (from, to) { + var path = require.modules.path(); + var res = null; + try { + res = require.resolve(from + '/package.json', '/'); + } + catch (err) { + res = require.resolve(from, '/'); + } + var basedir = path.dirname(res); + + var keys = (Object.keys || function (obj) { + var res = []; + for (var key in obj) res.push(key) + return res; + })(require.modules); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (key.slice(0, basedir.length + 1) === basedir + '/') { + var f = key.slice(basedir.length); + require.modules[to + f] = require.modules[basedir + f]; + } + else if (key === basedir) { + require.modules[to] = require.modules[basedir]; + } + } +}; + +require.define = function (filename, fn) { + var dirname = require._core[filename] + ? '' + : require.modules.path().dirname(filename) + ; + + var require_ = function (file) { + return require(file, dirname) + }; + require_.resolve = function (name) { + return require.resolve(name, dirname); + }; + require_.modules = require.modules; + require_.define = require.define; + var module_ = { exports : {} }; + + require.modules[filename] = function () { + require.modules[filename]._cached = module_.exports; + fn.call( + module_.exports, + require_, + module_, + module_.exports, + dirname, + filename + ); + require.modules[filename]._cached = module_.exports; + return module_.exports; + }; +}; + +if (typeof process === 'undefined') process = {}; + +if (!process.nextTick) process.nextTick = (function () { + var queue = []; + var canPost = typeof window !== 'undefined' + && window.postMessage && window.addEventListener + ; + + if (canPost) { + window.addEventListener('message', function (ev) { + if (ev.source === window && ev.data === 'browserify-tick') { + ev.stopPropagation(); + if (queue.length > 0) { + var fn = queue.shift(); + fn(); + } + } + }, true); + } + + return function (fn) { + if (canPost) { + queue.push(fn); + window.postMessage('browserify-tick', '*'); + } + else setTimeout(fn, 0); + }; +})(); + +if (!process.title) process.title = 'browser'; + +if (!process.binding) process.binding = function (name) { + if (name === 'evals') return require('vm') + else throw new Error('No such module') +}; + +if (!process.cwd) process.cwd = function () { return '.' }; + +if (!process.env) process.env = {}; +if (!process.argv) process.argv = []; + +require.define("path", function (require, module, exports, __dirname, __filename) { +function filter (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + if (fn(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length; i >= 0; i--) { + var last = parts[i]; + if (last == '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Regex to split a filename into [*, dir, basename, ext] +// posix version +var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { +var resolvedPath = '', + resolvedAbsolute = false; + +for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) + ? arguments[i] + : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string' || !path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; +} + +// At this point the path should be resolved to a full absolute path, but +// handle relative paths to be safe (might happen when process.cwd() fails) + +// Normalize the path +resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function(path) { +var isAbsolute = path.charAt(0) === '/', + trailingSlash = path.slice(-1) === '/'; + +// Normalize the path +path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + + +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + return p && typeof p === 'string'; + }).join('/')); +}; + + +exports.dirname = function(path) { + var dir = splitPathRe.exec(path)[1] || ''; + var isWindows = false; + if (!dir) { + // No dirname + return '.'; + } else if (dir.length === 1 || + (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) { + // It is just a slash or a drive letter with a slash + return dir; + } else { + // It is a full dirname, strip trailing slash + return dir.substring(0, dir.length - 1); + } +}; + + +exports.basename = function(path, ext) { + var f = splitPathRe.exec(path)[2] || ''; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPathRe.exec(path)[3] || ''; +}; + +}); + +require.define("crypto", function (require, module, exports, __dirname, __filename) { +module.exports = require("crypto-browserify") +}); + +require.define("/node_modules/crypto-browserify/package.json", function (require, module, exports, __dirname, __filename) { +module.exports = {} +}); + +require.define("/node_modules/crypto-browserify/index.js", function (require, module, exports, __dirname, __filename) { +var sha = require('./sha') + +var algorithms = { + sha1: { + hex: sha.hex_sha1, + binary: sha.b64_sha1, + ascii: sha.str_sha1 + } +} + +function error () { + var m = [].slice.call(arguments).join(' ') + throw new Error([ + m, + 'we accept pull requests', + 'http://github.com/dominictarr/crypto-browserify' + ].join('\n')) +} + +exports.createHash = function (alg) { + alg = alg || 'sha1' + if(!algorithms[alg]) + error('algorithm:', alg, 'is not yet supported') + var s = '' + _alg = algorithms[alg] + return { + update: function (data) { + s += data + return this + }, + digest: function (enc) { + enc = enc || 'binary' + var fn + if(!(fn = _alg[enc])) + error('encoding:', enc , 'is not yet supported for algorithm', alg) + var r = fn(s) + s = null //not meant to use the hash after you've called digest. + return r + } + } +} +// the least I can do is make error messages for the rest of the node.js/crypto api. +;['createCredentials' +, 'createHmac' +, 'createCypher' +, 'createCypheriv' +, 'createDecipher' +, 'createDecipheriv' +, 'createSign' +, 'createVerify' +, 'createDeffieHellman', +, 'pbkdf2', +, 'randomBytes' ].forEach(function (name) { + exports[name] = function () { + error('sorry,', name, 'is not implemented yet') + } +}) + +}); + +require.define("/node_modules/crypto-browserify/sha.js", function (require, module, exports, __dirname, __filename) { +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. + */ + +exports.hex_sha1 = hex_sha1; +exports.b64_sha1 = b64_sha1; +exports.str_sha1 = str_sha1; +exports.hex_hmac_sha1 = hex_hmac_sha1; +exports.b64_hmac_sha1 = b64_hmac_sha1; +exports.str_hmac_sha1 = str_hmac_sha1; + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ + +/* + * These are the functions you'll usually want to call + * They take string arguments and return either hex or base-64 encoded strings + */ +function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));} +function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));} +function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));} +function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));} +function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));} +function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));} + +/* + * Perform a simple self-test to see if the VM is working + */ +function sha1_vm_test() +{ + return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d"; +} + +/* + * Calculate the SHA-1 of an array of big-endian words, and a bit length + */ +function core_sha1(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << (24 - len % 32); + x[((len + 64 >> 9) << 4) + 15] = len; + + var w = Array(80); + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + var e = -1009589776; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + var olde = e; + + for(var j = 0; j < 80; j++) + { + if(j < 16) w[j] = x[i + j]; + else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); + var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), + safe_add(safe_add(e, w[j]), sha1_kt(j))); + e = d; + d = c; + c = rol(b, 30); + b = a; + a = t; + } + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + e = safe_add(e, olde); + } + return Array(a, b, c, d, e); + +} + +/* + * Perform the appropriate triplet combination function for the current + * iteration + */ +function sha1_ft(t, b, c, d) +{ + if(t < 20) return (b & c) | ((~b) & d); + if(t < 40) return b ^ c ^ d; + if(t < 60) return (b & c) | (b & d) | (c & d); + return b ^ c ^ d; +} + +/* + * Determine the appropriate additive constant for the current iteration + */ +function sha1_kt(t) +{ + return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : + (t < 60) ? -1894007588 : -899497514; +} + +/* + * Calculate the HMAC-SHA1 of a key and some data + */ +function core_hmac_sha1(key, data) +{ + var bkey = str2binb(key); + if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); + return core_sha1(opad.concat(hash), 512 + 160); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert an 8-bit or 16-bit string to an array of big-endian words + * In 8-bit function, characters >255 have their hi-byte silently ignored. + */ +function str2binb(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + for(var i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32); + return bin; +} + +/* + * Convert an array of big-endian words to a string + */ +function binb2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + for(var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask); + return str; +} + +/* + * Convert an array of big-endian words to a hex string. + */ +function binb2hex(binarray) +{ + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i++) + { + str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + + hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); + } + return str; +} + +/* + * Convert an array of big-endian words to a base-64 string + */ +function binb2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i += 3) + { + var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} + + +}); + +require.define("/test.js", function (require, module, exports, __dirname, __filename) { + var crypto = require('crypto') +var abc = crypto.createHash('sha1').update('abc').digest('hex') +console.log(abc) +//require('hello').inlineCall().call2() + +}); +require("/test.js"); diff --git a/node_modules/crypto-browserify/example/index.html b/node_modules/crypto-browserify/example/index.html new file mode 100644 index 00000000..9d55c6d7 --- /dev/null +++ b/node_modules/crypto-browserify/example/index.html @@ -0,0 +1,12 @@ + + + + +
+  require('crypto').createHash('sha1').update('abc').digest('hex') == ''
+  
+ + + diff --git a/node_modules/crypto-browserify/example/test.js b/node_modules/crypto-browserify/example/test.js new file mode 100644 index 00000000..f1b0e4a9 --- /dev/null +++ b/node_modules/crypto-browserify/example/test.js @@ -0,0 +1,4 @@ +var crypto = require('crypto') +var abc = crypto.createHash('sha1').update('abc').digest('hex') +console.log(abc) +//require('hello').inlineCall().call2() diff --git a/node_modules/crypto-browserify/index.js b/node_modules/crypto-browserify/index.js new file mode 100644 index 00000000..67908ba9 --- /dev/null +++ b/node_modules/crypto-browserify/index.js @@ -0,0 +1,79 @@ +'use strict'; + +exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes') + +exports.createHash = exports.Hash = require('create-hash') + +exports.createHmac = exports.Hmac = require('create-hmac') + +var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(Object.keys(require('browserify-sign/algos'))) +exports.getHashes = function () { + return hashes; +} + +var p = require('pbkdf2') +exports.pbkdf2 = p.pbkdf2 +exports.pbkdf2Sync = p.pbkdf2Sync + +var aes = require('browserify-aes'); +[ + 'Cipher', + 'createCipher', + 'Cipheriv', + 'createCipheriv', + 'Decipher', + 'createDecipher', + 'Decipheriv', + 'createDecipheriv', + 'getCiphers', + 'listCiphers' +].forEach(function (key) { + exports[key] = aes[key]; +}) + +var dh = require('diffie-hellman'); +[ + 'DiffieHellmanGroup', + 'createDiffieHellmanGroup', + 'getDiffieHellman', + 'createDiffieHellman', + 'DiffieHellman' +].forEach(function (key) { + exports[key] = dh[key]; +}) + +var sign = require('browserify-sign'); +[ + 'createSign', + 'Sign', + 'createVerify', + 'Verify' +].forEach(function (key) { + exports[key] = sign[key]; +}) + +exports.createECDH = require('create-ecdh') + +var publicEncrypt = require('public-encrypt'); + +[ + 'publicEncrypt', + 'privateEncrypt', + 'publicDecrypt', + 'privateDecrypt' +].forEach(function (key) { + exports[key] = publicEncrypt[key]; +}) + +// the least I can do is make error messages for the rest of the node.js/crypto api. +;[ + 'createCredentials' +].forEach(function (name) { + exports[name] = function () { + throw new Error([ + 'sorry, ' + name + ' is not implemented yet', + 'we accept pull requests', + 'https://github.com/crypto-browserify/crypto-browserify' + ].join('\n')); + } +}) diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/.jshintrc b/node_modules/crypto-browserify/node_modules/browserify-aes/.jshintrc new file mode 100644 index 00000000..2d7234ee --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/.jshintrc @@ -0,0 +1,36 @@ +{ + "predef": { + "document": true, + "window": true, + "FeldmanENV": true, + "google": true, + "MarkerClusterer": true + }, + "browser" : true, + "node": true, + "boss" : true, + "curly": true, + "debug": false, + "devel": true, + "esnext": true, + "eqeqeq": true, + "evil": true, + "forin": false, + "immed": false, + "laxbreak": false, + "newcap": true, + "noarg": true, + "noempty": false, + "nonew": false, + "nomen": false, + "onevar": false, + "plusplus": false, + "regexp": false, + "undef": true, + "sub": true, + "strict": false, + "white": false, + "eqnull": true, + "esnext": true, + "unused": true +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/.travis.yml b/node_modules/crypto-browserify/node_modules/browserify-aes/.travis.yml new file mode 100644 index 00000000..18ae2d89 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.11" + - "0.10" diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/EVP_BytesToKey.js b/node_modules/crypto-browserify/node_modules/browserify-aes/EVP_BytesToKey.js new file mode 100644 index 00000000..c55cbe33 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/EVP_BytesToKey.js @@ -0,0 +1,62 @@ +var md5 = require('create-hash/md5'); +module.exports = EVP_BytesToKey; +function EVP_BytesToKey(password, keyLen, ivLen) { + if (!Buffer.isBuffer(password)) { + password = new Buffer(password, 'binary'); + } + keyLen = keyLen/8; + ivLen = ivLen || 0; + var ki = 0; + var ii = 0; + var key = new Buffer(keyLen); + var iv = new Buffer(ivLen); + var addmd = 0; + var md_buf; + var i; + var bufs = []; + while (true) { + if(addmd++ > 0) { + bufs.push(md_buf); + } + bufs.push(password); + md_buf = md5(Buffer.concat(bufs)); + bufs = []; + i = 0; + if(keyLen > 0) { + while(true) { + if(keyLen === 0) { + break; + } + if(i === md_buf.length) { + break; + } + key[ki++] = md_buf[i]; + keyLen--; + i++; + } + } + if(ivLen > 0 && i !== md_buf.length) { + while(true) { + if(ivLen === 0) { + break; + } + if(i === md_buf.length) { + break; + } + iv[ii++] = md_buf[i]; + ivLen--; + i++; + } + } + if(keyLen === 0 && ivLen === 0) { + break; + } + } + for(i=0;i uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x; + return ret; +} +function scrub_vec(v) { + var i, _i, _ref; + for (i = _i = 0, _ref = v.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { + v[i] = 0; + } + return false; +} + +function Global() { + var i; + this.SBOX = []; + this.INV_SBOX = []; + this.SUB_MIX = (function() { + var _i, _results; + _results = []; + for (i = _i = 0; _i < 4; i = ++_i) { + _results.push([]); + } + return _results; + })(); + this.INV_SUB_MIX = (function() { + var _i, _results; + _results = []; + for (i = _i = 0; _i < 4; i = ++_i) { + _results.push([]); + } + return _results; + })(); + this.init(); + this.RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; +} + +Global.prototype.init = function() { + var d, i, sx, t, x, x2, x4, x8, xi, _i; + d = (function() { + var _i, _results; + _results = []; + for (i = _i = 0; _i < 256; i = ++_i) { + if (i < 128) { + _results.push(i << 1); + } else { + _results.push((i << 1) ^ 0x11b); + } + } + return _results; + })(); + x = 0; + xi = 0; + for (i = _i = 0; _i < 256; i = ++_i) { + sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; + this.SBOX[x] = sx; + this.INV_SBOX[sx] = x; + x2 = d[x]; + x4 = d[x2]; + x8 = d[x4]; + t = (d[sx] * 0x101) ^ (sx * 0x1010100); + this.SUB_MIX[0][x] = (t << 24) | (t >>> 8); + this.SUB_MIX[1][x] = (t << 16) | (t >>> 16); + this.SUB_MIX[2][x] = (t << 8) | (t >>> 24); + this.SUB_MIX[3][x] = t; + t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); + this.INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8); + this.INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16); + this.INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24); + this.INV_SUB_MIX[3][sx] = t; + if (x === 0) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + return true; +}; + +var G = new Global(); + + +AES.blockSize = 4 * 4; + +AES.prototype.blockSize = AES.blockSize; + +AES.keySize = 256 / 8; + +AES.prototype.keySize = AES.keySize; + + function bufferToArray(buf) { + var len = buf.length/4; + var out = new Array(len); + var i = -1; + while (++i < len) { + out[i] = buf.readUInt32BE(i * 4); + } + return out; + } +function AES(key) { + this._key = bufferToArray(key); + this._doReset(); +} + +AES.prototype._doReset = function() { + var invKsRow, keySize, keyWords, ksRow, ksRows, t, _i, _j; + keyWords = this._key; + keySize = keyWords.length; + this._nRounds = keySize + 6; + ksRows = (this._nRounds + 1) * 4; + this._keySchedule = []; + for (ksRow = _i = 0; 0 <= ksRows ? _i < ksRows : _i > ksRows; ksRow = 0 <= ksRows ? ++_i : --_i) { + this._keySchedule[ksRow] = ksRow < keySize ? keyWords[ksRow] : (t = this._keySchedule[ksRow - 1], (ksRow % keySize) === 0 ? (t = (t << 8) | (t >>> 24), t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff], t ^= G.RCON[(ksRow / keySize) | 0] << 24) : keySize > 6 && ksRow % keySize === 4 ? t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff] : void 0, this._keySchedule[ksRow - keySize] ^ t); + } + this._invKeySchedule = []; + for (invKsRow = _j = 0; 0 <= ksRows ? _j < ksRows : _j > ksRows; invKsRow = 0 <= ksRows ? ++_j : --_j) { + ksRow = ksRows - invKsRow; + t = this._keySchedule[ksRow - (invKsRow % 4 ? 0 : 4)]; + this._invKeySchedule[invKsRow] = invKsRow < 4 || ksRow <= 4 ? t : G.INV_SUB_MIX[0][G.SBOX[t >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[(t >>> 16) & 0xff]] ^ G.INV_SUB_MIX[2][G.SBOX[(t >>> 8) & 0xff]] ^ G.INV_SUB_MIX[3][G.SBOX[t & 0xff]]; + } + return true; +}; + +AES.prototype.encryptBlock = function(M) { + M = bufferToArray(new Buffer(M)); + var out = this._doCryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX); + var buf = new Buffer(16); + buf.writeUInt32BE(out[0], 0); + buf.writeUInt32BE(out[1], 4); + buf.writeUInt32BE(out[2], 8); + buf.writeUInt32BE(out[3], 12); + return buf; +}; + +AES.prototype.decryptBlock = function(M) { + M = bufferToArray(new Buffer(M)); + var temp = [M[3], M[1]]; + M[1] = temp[0]; + M[3] = temp[1]; + var out = this._doCryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX); + var buf = new Buffer(16); + buf.writeUInt32BE(out[0], 0); + buf.writeUInt32BE(out[3], 4); + buf.writeUInt32BE(out[2], 8); + buf.writeUInt32BE(out[1], 12); + return buf; +}; + +AES.prototype.scrub = function() { + scrub_vec(this._keySchedule); + scrub_vec(this._invKeySchedule); + scrub_vec(this._key); +}; + +AES.prototype._doCryptBlock = function(M, keySchedule, SUB_MIX, SBOX) { + var ksRow, round, s0, s1, s2, s3, t0, t1, t2, t3, _i, _ref; + + s0 = M[0] ^ keySchedule[0]; + s1 = M[1] ^ keySchedule[1]; + s2 = M[2] ^ keySchedule[2]; + s3 = M[3] ^ keySchedule[3]; + ksRow = 4; + for (round = _i = 1, _ref = this._nRounds; 1 <= _ref ? _i < _ref : _i > _ref; round = 1 <= _ref ? ++_i : --_i) { + t0 = SUB_MIX[0][s0 >>> 24] ^ SUB_MIX[1][(s1 >>> 16) & 0xff] ^ SUB_MIX[2][(s2 >>> 8) & 0xff] ^ SUB_MIX[3][s3 & 0xff] ^ keySchedule[ksRow++]; + t1 = SUB_MIX[0][s1 >>> 24] ^ SUB_MIX[1][(s2 >>> 16) & 0xff] ^ SUB_MIX[2][(s3 >>> 8) & 0xff] ^ SUB_MIX[3][s0 & 0xff] ^ keySchedule[ksRow++]; + t2 = SUB_MIX[0][s2 >>> 24] ^ SUB_MIX[1][(s3 >>> 16) & 0xff] ^ SUB_MIX[2][(s0 >>> 8) & 0xff] ^ SUB_MIX[3][s1 & 0xff] ^ keySchedule[ksRow++]; + t3 = SUB_MIX[0][s3 >>> 24] ^ SUB_MIX[1][(s0 >>> 16) & 0xff] ^ SUB_MIX[2][(s1 >>> 8) & 0xff] ^ SUB_MIX[3][s2 & 0xff] ^ keySchedule[ksRow++]; + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } + t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; + return [ + fixup_uint32(t0), + fixup_uint32(t1), + fixup_uint32(t2), + fixup_uint32(t3) + ]; + +}; + + + + + exports.AES = AES; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/authCipher.js b/node_modules/crypto-browserify/node_modules/browserify-aes/authCipher.js new file mode 100644 index 00000000..dc1b9933 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/authCipher.js @@ -0,0 +1,99 @@ +var aes = require('./aes'); +var Transform = require('./cipherBase'); +var inherits = require('inherits'); +var GHASH = require('./ghash'); +var xor = require('./xor'); +inherits(StreamCipher, Transform); +module.exports = StreamCipher; + +function StreamCipher(mode, key, iv, decrypt) { + if (!(this instanceof StreamCipher)) { + return new StreamCipher(mode, key, iv); + } + Transform.call(this); + this._finID = Buffer.concat([iv, new Buffer([0, 0, 0, 1])]); + iv = Buffer.concat([iv, new Buffer([0, 0, 0, 2])]); + this._cipher = new aes.AES(key); + this._prev = new Buffer(iv.length); + this._cache = new Buffer(''); + this._secCache = new Buffer(''); + this._decrypt = decrypt; + this._alen = 0; + this._len = 0; + iv.copy(this._prev); + this._mode = mode; + var h = new Buffer(4); + h.fill(0); + this._ghash = new GHASH(this._cipher.encryptBlock(h)); + this._authTag = null; + this._called = false; +} +StreamCipher.prototype._update = function (chunk) { + if (!this._called && this._alen) { + var rump = 16 - (this._alen % 16); + if (rump <16) { + rump = new Buffer(rump); + rump.fill(0); + this._ghash.update(rump); + } + } + this._called = true; + var out = this._mode.encrypt(this, chunk); + if (this._decrypt) { + this._ghash.update(chunk); + } else { + this._ghash.update(out); + } + this._len += chunk.length; + return out; +}; +StreamCipher.prototype._final = function () { + if (this._decrypt && !this._authTag) { + throw new Error('Unsupported state or unable to authenticate data'); + } + var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID)); + if (this._decrypt) { + if (xorTest(tag, this._authTag)) { + throw new Error('Unsupported state or unable to authenticate data'); + } + } else { + this._authTag = tag; + } + this._cipher.scrub(); +}; +StreamCipher.prototype.getAuthTag = function getAuthTag () { + if (!this._decrypt && Buffer.isBuffer(this._authTag)) { + return this._authTag; + } else { + throw new Error('Attempting to get auth tag in unsupported state'); + } +}; +StreamCipher.prototype.setAuthTag = function setAuthTag (tag) { + if (this._decrypt) { + this._authTag = tag; + } else { + throw new Error('Attempting to set auth tag in unsupported state'); + } +}; +StreamCipher.prototype.setAAD = function setAAD (buf) { + if (!this._called) { + this._ghash.update(buf); + this._alen += buf.length; + } else { + throw new Error('Attempting to set AAD in unsupported state'); + } +}; +function xorTest(a, b) { + var out = 0; + if (a.length !== b.length) { + out++; + } + var len = Math.min(a.length, b.length); + var i = -1; + while (++i < len) { + out += (a[i] ^ b[i]); + } + return out; +} + + diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/browser.js b/node_modules/crypto-browserify/node_modules/browserify-aes/browser.js new file mode 100644 index 00000000..e9cbf4bd --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/browser.js @@ -0,0 +1,11 @@ +var ciphers = require('./encrypter'); +exports.createCipher = exports.Cipher = ciphers.createCipher; +exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv; +var deciphers = require('./decrypter'); +exports.createDecipher = exports.Decipher = deciphers.createDecipher; +exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv; +var modes = require('./modes'); +function getCiphers () { + return Object.keys(modes); +} +exports.listCiphers = exports.getCiphers = getCiphers; diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js b/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js new file mode 100644 index 00000000..0983a729 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/cipherBase.js @@ -0,0 +1,37 @@ +var Transform = require('stream').Transform; +var inherits = require('inherits'); + +module.exports = CipherBase; +inherits(CipherBase, Transform); +function CipherBase() { + Transform.call(this); +} +CipherBase.prototype.update = function (data, inputEnc, outputEnc) { + if (typeof data === 'string') { + data = new Buffer(data, inputEnc); + } + var outData = this._update(data); + if (outputEnc) { + outData = outData.toString(outputEnc); + } + return outData; +}; +CipherBase.prototype._transform = function (data, _, next) { + this.push(this._update(data)); + next(); +}; +CipherBase.prototype._flush = function (next) { + try { + this.push(this._final()); + } catch(e) { + return next(e); + } + next(); +}; +CipherBase.prototype.final = function (outputEnc) { + var outData = this._final() || new Buffer(''); + if (outputEnc) { + outData = outData.toString(outputEnc); + } + return outData; +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/decrypter.js b/node_modules/crypto-browserify/node_modules/browserify-aes/decrypter.js new file mode 100644 index 00000000..4942b4d3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/decrypter.js @@ -0,0 +1,137 @@ +var aes = require('./aes'); +var Transform = require('./cipherBase'); +var inherits = require('inherits'); +var modes = require('./modes'); +var StreamCipher = require('./streamCipher'); +var AuthCipher = require('./authCipher'); +var ebtk = require('./EVP_BytesToKey'); + +inherits(Decipher, Transform); +function Decipher(mode, key, iv) { + if (!(this instanceof Decipher)) { + return new Decipher(mode, key, iv); + } + Transform.call(this); + this._cache = new Splitter(); + this._last = void 0; + this._cipher = new aes.AES(key); + this._prev = new Buffer(iv.length); + iv.copy(this._prev); + this._mode = mode; + this._autopadding = true; +} +Decipher.prototype._update = function (data) { + this._cache.add(data); + var chunk; + var thing; + var out = []; + while ((chunk = this._cache.get(this._autopadding))) { + thing = this._mode.decrypt(this, chunk); + out.push(thing); + } + return Buffer.concat(out); +}; +Decipher.prototype._final = function () { + var chunk = this._cache.flush(); + if (this._autopadding) { + return unpad(this._mode.decrypt(this, chunk)); + } else if (chunk) { + throw new Error('data not multiple of block length'); + } +}; +Decipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo; +}; +function Splitter() { + if (!(this instanceof Splitter)) { + return new Splitter(); + } + this.cache = new Buffer(''); +} +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]); +}; + +Splitter.prototype.get = function (autoPadding) { + var out; + if (autoPadding) { + if (this.cache.length > 16) { + out = this.cache.slice(0, 16); + this.cache = this.cache.slice(16); + return out; + } + } else { + if (this.cache.length >= 16) { + out = this.cache.slice(0, 16); + this.cache = this.cache.slice(16); + return out; + } + } + return null; +}; +Splitter.prototype.flush = function () { + if (this.cache.length) { + return this.cache; + } +}; +function unpad(last) { + var padded = last[15]; + var i = -1; + while (++i < padded) { + if (last[(i + (16 - padded))] !== padded) { + throw new Error('unable to decrypt data'); + } + } + if (padded === 16) { + return; + } + return last.slice(0, 16 - padded); +} + +var modelist = { + ECB: require('./modes/ecb'), + CBC: require('./modes/cbc'), + CFB: require('./modes/cfb'), + CFB8: require('./modes/cfb8'), + CFB1: require('./modes/cfb1'), + OFB: require('./modes/ofb'), + CTR: require('./modes/ctr'), + GCM: require('./modes/ctr') +}; + + +function createDecipheriv(suite, password, iv) { + var config = modes[suite.toLowerCase()]; + if (!config) { + throw new TypeError('invalid suite type'); + } + if (typeof iv === 'string') { + iv = new Buffer(iv); + } + if (typeof password === 'string') { + password = new Buffer(password); + } + if (password.length !== config.key/8) { + throw new TypeError('invalid key length ' + password.length); + } + if (iv.length !== config.iv) { + throw new TypeError('invalid iv length ' + iv.length); + } + if (config.type === 'stream') { + return new StreamCipher(modelist[config.mode], password, iv, true); + } else if (config.type === 'auth') { + return new AuthCipher(modelist[config.mode], password, iv, true); + } + return new Decipher(modelist[config.mode], password, iv); +} + +function createDecipher (suite, password) { + var config = modes[suite.toLowerCase()]; + if (!config) { + throw new TypeError('invalid suite type'); + } + var keys = ebtk(password, config.key, config.iv); + return createDecipheriv(suite, keys.key, keys.iv); +} +exports.createDecipher = createDecipher; +exports.createDecipheriv = createDecipheriv; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/encrypter.js b/node_modules/crypto-browserify/node_modules/browserify-aes/encrypter.js new file mode 100644 index 00000000..4212b3eb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/encrypter.js @@ -0,0 +1,121 @@ +var aes = require('./aes'); +var Transform = require('./cipherBase'); +var inherits = require('inherits'); +var modes = require('./modes'); +var ebtk = require('./EVP_BytesToKey'); +var StreamCipher = require('./streamCipher'); +var AuthCipher = require('./authCipher'); +inherits(Cipher, Transform); +function Cipher(mode, key, iv) { + if (!(this instanceof Cipher)) { + return new Cipher(mode, key, iv); + } + Transform.call(this); + this._cache = new Splitter(); + this._cipher = new aes.AES(key); + this._prev = new Buffer(iv.length); + iv.copy(this._prev); + this._mode = mode; + this._autopadding = true; +} +Cipher.prototype._update = function (data) { + this._cache.add(data); + var chunk; + var thing; + var out = []; + while ((chunk = this._cache.get())) { + thing = this._mode.encrypt(this, chunk); + out.push(thing); + } + return Buffer.concat(out); +}; +Cipher.prototype._final = function () { + var chunk = this._cache.flush(); + if (this._autopadding) { + chunk = this._mode.encrypt(this, chunk); + this._cipher.scrub(); + return chunk; + } else if (chunk.toString('hex') !== '10101010101010101010101010101010') { + this._cipher.scrub(); + throw new Error('data not multiple of block length'); + } +}; +Cipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo; +}; + +function Splitter() { + if (!(this instanceof Splitter)) { + return new Splitter(); + } + this.cache = new Buffer(''); +} +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]); +}; + +Splitter.prototype.get = function () { + if (this.cache.length > 15) { + var out = this.cache.slice(0, 16); + this.cache = this.cache.slice(16); + return out; + } + return null; +}; +Splitter.prototype.flush = function () { + var len = 16 - this.cache.length; + var padBuff = new Buffer(len); + + var i = -1; + while (++i < len) { + padBuff.writeUInt8(len, i); + } + var out = Buffer.concat([this.cache, padBuff]); + return out; +}; +var modelist = { + ECB: require('./modes/ecb'), + CBC: require('./modes/cbc'), + CFB: require('./modes/cfb'), + CFB8: require('./modes/cfb8'), + CFB1: require('./modes/cfb1'), + OFB: require('./modes/ofb'), + CTR: require('./modes/ctr'), + GCM: require('./modes/ctr') +}; + +function createCipheriv(suite, password, iv) { + var config = modes[suite.toLowerCase()]; + if (!config) { + throw new TypeError('invalid suite type'); + } + if (typeof iv === 'string') { + iv = new Buffer(iv); + } + if (typeof password === 'string') { + password = new Buffer(password); + } + if (password.length !== config.key/8) { + throw new TypeError('invalid key length ' + password.length); + } + if (iv.length !== config.iv) { + throw new TypeError('invalid iv length ' + iv.length); + } + if (config.type === 'stream') { + return new StreamCipher(modelist[config.mode], password, iv); + } else if (config.type === 'auth') { + return new AuthCipher(modelist[config.mode], password, iv); + } + return new Cipher(modelist[config.mode], password, iv); +} +function createCipher (suite, password) { + var config = modes[suite.toLowerCase()]; + if (!config) { + throw new TypeError('invalid suite type'); + } + var keys = ebtk(password, config.key, config.iv); + return createCipheriv(suite, keys.key, keys.iv); +} + +exports.createCipheriv = createCipheriv; +exports.createCipher = createCipher; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/ghash.js b/node_modules/crypto-browserify/node_modules/browserify-aes/ghash.js new file mode 100644 index 00000000..5499d337 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/ghash.js @@ -0,0 +1,98 @@ +var zeros = new Buffer(16); +zeros.fill(0); +module.exports = GHASH; +function GHASH(key){ + this.h = key; + this.state = new Buffer(16); + this.state.fill(0); + this.cache = new Buffer(''); +} +// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html +// by Juho Vähä-Herttua +GHASH.prototype.ghash = function (block) { + var i = -1; + while (++i < block.length) { + this.state[i] ^= block[i]; + } + this._multiply(); +}; + +GHASH.prototype._multiply = function () { + var Vi = toArray(this.h); + var Zi = [0, 0, 0, 0]; + var j, xi, lsb_Vi; + var i = -1; + while (++i < 128) { + xi = (this.state[~~(i/8)] & (1 << (7-i%8))) !== 0; + if (xi) { + // Z_i+1 = Z_i ^ V_i + Zi = xor(Zi, Vi); + } + + // Store the value of LSB(V_i) + lsb_Vi = (Vi[3] & 1) !== 0; + + // V_i+1 = V_i >> 1 + for (j=3; j>0; j--) { + Vi[j] = (Vi[j] >>> 1) | ((Vi[j-1]&1) << 31); + } + Vi[0] = Vi[0] >>> 1; + + // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R + if (lsb_Vi) { + Vi[0] = Vi[0] ^ (0xe1 << 24); + } + } + this.state = fromArray(Zi); +}; +GHASH.prototype.update = function (buf) { + this.cache = Buffer.concat([this.cache, buf]); + var chunk; + while (this.cache.length >= 16) { + chunk = this.cache.slice(0, 16); + this.cache = this.cache.slice(16); + this.ghash(chunk); + } +}; +GHASH.prototype.final = function (abl, bl) { + if (this.cache.length) { + this.ghash(Buffer.concat([this.cache, zeros], 16)); + } + this.ghash(fromArray([ + 0, abl, + 0, bl + ])); + return this.state; +}; + +function toArray(buf) { + return [ + buf.readUInt32BE(0), + buf.readUInt32BE(4), + buf.readUInt32BE(8), + buf.readUInt32BE(12) + ]; +} +function fromArray(out) { + out = out.map(fixup_uint32); + var buf = new Buffer(16); + buf.writeUInt32BE(out[0], 0); + buf.writeUInt32BE(out[1], 4); + buf.writeUInt32BE(out[2], 8); + buf.writeUInt32BE(out[3], 12); + return buf; +} +var uint_max = Math.pow(2, 32); +function fixup_uint32(x) { + var ret, x_pos; + ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x; + return ret; +} +function xor(a, b) { + return [ + a[0] ^ b[0], + a[1] ^ b[1], + a[2] ^ b[2], + a[3] ^ b[3], + ]; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/index.js b/node_modules/crypto-browserify/node_modules/browserify-aes/index.js new file mode 100644 index 00000000..320ce820 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/index.js @@ -0,0 +1,7 @@ +var crypto = require('crypto'); + +exports.createCipher = exports.Cipher = crypto.createCipher; +exports.createCipheriv = exports.Cipheriv = crypto.createCipheriv; +exports.createDecipher = exports.Decipher = crypto.createDecipher; +exports.createDecipheriv = exports.Decipheriv = crypto.createDecipheriv; +exports.listCiphers = exports.getCiphers = crypto.getCiphers; diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js b/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js new file mode 100644 index 00000000..a19c54e6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/modes.js @@ -0,0 +1,171 @@ +exports['aes-128-ecb'] = { + cipher: 'AES', + key: 128, + iv: 0, + mode: 'ECB', + type: 'block' +}; +exports['aes-192-ecb'] = { + cipher: 'AES', + key: 192, + iv: 0, + mode: 'ECB', + type: 'block' +}; +exports['aes-256-ecb'] = { + cipher: 'AES', + key: 256, + iv: 0, + mode: 'ECB', + type: 'block' +}; +exports['aes-128-cbc'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CBC', + type: 'block' +}; +exports['aes-192-cbc'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CBC', + type: 'block' +}; +exports['aes-256-cbc'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CBC', + type: 'block' +}; +exports['aes128'] = exports['aes-128-cbc']; +exports['aes192'] = exports['aes-192-cbc']; +exports['aes256'] = exports['aes-256-cbc']; +exports['aes-128-cfb'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CFB', + type: 'stream' +}; +exports['aes-192-cfb'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CFB', + type: 'stream' +}; +exports['aes-256-cfb'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CFB', + type: 'stream' +}; +exports['aes-128-cfb8'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CFB8', + type: 'stream' +}; +exports['aes-192-cfb8'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CFB8', + type: 'stream' +}; +exports['aes-256-cfb8'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CFB8', + type: 'stream' +}; +exports['aes-128-cfb1'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CFB1', + type: 'stream' +}; +exports['aes-192-cfb1'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CFB1', + type: 'stream' +}; +exports['aes-256-cfb1'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CFB1', + type: 'stream' +}; +exports['aes-128-ofb'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'OFB', + type: 'stream' +}; +exports['aes-192-ofb'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'OFB', + type: 'stream' +}; +exports['aes-256-ofb'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'OFB', + type: 'stream' +}; +exports['aes-128-ctr'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CTR', + type: 'stream' +}; +exports['aes-192-ctr'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CTR', + type: 'stream' +}; +exports['aes-256-ctr'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CTR', + type: 'stream' +}; +exports['aes-128-gcm'] = { + cipher: 'AES', + key: 128, + iv: 12, + mode: 'GCM', + type: 'auth' +}; +exports['aes-192-gcm'] = { + cipher: 'AES', + key: 192, + iv: 12, + mode: 'GCM', + type: 'auth' +}; +exports['aes-256-gcm'] = { + cipher: 'AES', + key: 256, + iv: 12, + mode: 'GCM', + type: 'auth' +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cbc.js b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cbc.js new file mode 100644 index 00000000..bdc3cbc6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cbc.js @@ -0,0 +1,12 @@ +var xor = require('../xor'); +exports.encrypt = function (self, block) { + var data = xor(block, self._prev); + self._prev = self._cipher.encryptBlock(data); + return self._prev; +}; +exports.decrypt = function (self, block) { + var pad = self._prev; + self._prev = block; + var out = self._cipher.decryptBlock(block); + return xor(out, pad); +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb.js b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb.js new file mode 100644 index 00000000..13712b46 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb.js @@ -0,0 +1,27 @@ +var xor = require('../xor'); +exports.encrypt = function (self, data, decrypt) { + var out = new Buffer(''); + var len; + while (data.length) { + if (self._cache.length === 0) { + self._cache = self._cipher.encryptBlock(self._prev); + self._prev = new Buffer(''); + } + if (self._cache.length <= data.length) { + len = self._cache.length; + out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]); + data = data.slice(len); + } else { + out = Buffer.concat([out, encryptStart(self, data, decrypt)]); + break; + } + } + return out; +}; +function encryptStart(self, data, decrypt) { + var len = data.length; + var out = xor(data, self._cache); + self._cache = self._cache.slice(len); + self._prev = Buffer.concat([self._prev, decrypt?data:out]); + return out; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb1.js b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb1.js new file mode 100644 index 00000000..3bad04f1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb1.js @@ -0,0 +1,35 @@ + +function encryptByte(self, byte, decrypt) { + var pad; + var i = -1; + var len = 8; + var out = 0; + var bit, value; + while (++i < len) { + pad = self._cipher.encryptBlock(self._prev); + bit = (byte & (1 << (7-i))) ? 0x80:0; + value = pad[0] ^ bit; + out += ((value&0x80) >> (i%8)); + self._prev = shiftIn(self._prev, decrypt?bit:value); + } + return out; +} +exports.encrypt = function (self, chunk, decrypt) { + var len = chunk.length; + var out = new Buffer(len); + var i = -1; + while (++i < len) { + out[i] = encryptByte(self, chunk[i], decrypt); + } + return out; +}; +function shiftIn(buffer, value) { + var len = buffer.length; + var i = -1; + var out = new Buffer(buffer.length); + buffer = Buffer.concat([buffer, new Buffer([value])]); + while(++i < len) { + out[i] = buffer[i]<<1 | buffer[i+1]>>(7); + } + return out; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb8.js b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb8.js new file mode 100644 index 00000000..31ac52c0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/cfb8.js @@ -0,0 +1,15 @@ +function encryptByte(self, byte, decrypt) { + var pad = self._cipher.encryptBlock(self._prev); + var out = pad[0] ^ byte; + self._prev = Buffer.concat([self._prev.slice(1), new Buffer([decrypt?byte:out])]); + return out; +} +exports.encrypt = function (self, chunk, decrypt) { + var len = chunk.length; + var out = new Buffer(len); + var i = -1; + while (++i < len) { + out[i] = encryptByte(self, chunk[i], decrypt); + } + return out; +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ctr.js b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ctr.js new file mode 100644 index 00000000..b345b0ed --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ctr.js @@ -0,0 +1,28 @@ +var xor = require('../xor'); +function getBlock(self) { + var out = self._cipher.encryptBlock(self._prev); + incr32(self._prev); + return out; +} +exports.encrypt = function (self, chunk) { + while (self._cache.length < chunk.length) { + self._cache = Buffer.concat([self._cache, getBlock(self)]); + } + var pad = self._cache.slice(0, chunk.length); + self._cache = self._cache.slice(chunk.length); + return xor(chunk, pad); +}; +function incr32(iv) { + var len = iv.length; + var item; + while (len--) { + item = iv.readUInt8(len); + if (item === 255) { + iv.writeUInt8(0, len); + } else { + item++; + iv.writeUInt8(item, len); + break; + } + } +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ecb.js b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ecb.js new file mode 100644 index 00000000..1cef5155 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ecb.js @@ -0,0 +1,6 @@ +exports.encrypt = function (self, block) { + return self._cipher.encryptBlock(block); +}; +exports.decrypt = function (self, block) { + return self._cipher.decryptBlock(block); +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ofb.js b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ofb.js new file mode 100644 index 00000000..43efc5a6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/modes/ofb.js @@ -0,0 +1,13 @@ +var xor = require('../xor'); +function getBlock(self) { + self._prev = self._cipher.encryptBlock(self._prev); + return self._prev; +} +exports.encrypt = function (self, chunk) { + while (self._cache.length < chunk.length) { + self._cache = Buffer.concat([self._cache, getBlock(self)]); + } + var pad = self._cache.slice(0, chunk.length); + self._cache = self._cache.slice(chunk.length); + return xor(chunk, pad); +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/package.json b/node_modules/crypto-browserify/node_modules/browserify-aes/package.json new file mode 100644 index 00000000..cb4997c1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/package.json @@ -0,0 +1,70 @@ +{ + "name": "browserify-aes", + "version": "1.0.0", + "description": "aes, for browserify", + "browser": "browser.js", + "main": "index.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "node test/index.js|tspec" + }, + "repository": { + "type": "git", + "url": "git://github.com/crypto-browserify/browserify-aes.git" + }, + "keywords": [ + "aes", + "crypto", + "browserify" + ], + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/browserify-aes/issues" + }, + "homepage": "https://github.com/crypto-browserify/browserify-aes", + "dependencies": { + "create-hash": "^1.1.0", + "inherits": "^2.0.1" + }, + "devDependencies": { + "tape": "^3.0.0", + "tap-spec": "^1.0.0" + }, + "gitHead": "67c90814f512df1ef2330a2156c24dc854fa99a5", + "_id": "browserify-aes@1.0.0", + "_shasum": "582efc30561166f89855fcdc945b686919848b62", + "_from": "browserify-aes@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jp", + "email": "jprichardson@gmail.com" + } + ], + "dist": { + "shasum": "582efc30561166f89855fcdc945b686919848b62", + "tarball": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.0.tgz" + }, + "_resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/populateFixtures.js b/node_modules/crypto-browserify/node_modules/browserify-aes/populateFixtures.js new file mode 100644 index 00000000..c8a733bd --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/populateFixtures.js @@ -0,0 +1,25 @@ +var modes = require('./modes'); +var fixtures = require('./test/fixtures.json'); +var crypto = require('crypto'); +var types = ['aes-128-cfb1','aes-192-cfb1','aes-256-cfb1']; +var ebtk = require('./EVP_BytesToKey'); +var fs = require('fs'); + +fixtures.forEach(function (fixture) { + types.forEach(function (cipher) { + var suite = crypto.createCipher(cipher, new Buffer(fixture.password)); + var buf = new Buffer(''); + buf = Buffer.concat([buf, suite.update(new Buffer(fixture.text))]); + buf = Buffer.concat([buf, suite.final()]); + fixture.results.ciphers[cipher] = buf.toString('hex'); + if (modes[cipher].mode === 'ECB') { + return; + } + var suite2 = crypto.createCipheriv(cipher, ebtk(crypto, fixture.password, modes[cipher].key).key, new Buffer(fixture.iv, 'hex')); + var buf2 = new Buffer(''); + buf2 = Buffer.concat([buf2, suite2.update(new Buffer(fixture.text))]); + buf2 = Buffer.concat([buf2, suite2.final()]); + fixture.results.cipherivs[cipher] = buf2.toString('hex'); + }); +}); +fs.writeFileSync('./test/fixturesNew.json', JSON.stringify(fixtures, false, 4)); \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/readme.md b/node_modules/crypto-browserify/node_modules/browserify-aes/readme.md new file mode 100644 index 00000000..1d7b0855 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/readme.md @@ -0,0 +1,18 @@ +browserify-aes +==== + +[![Build Status](https://travis-ci.org/crypto-browserify/browserify-aes.svg)](https://travis-ci.org/crypto-browserify/browserify-aes) + +Node style aes for use in the browser. Implements: + + - createCipher + - createCipheriv + - createDecipher + - createDecipheriv + - getCiphers + +In node.js, the `crypto` implementation is used, in browsers it falls back to a pure JavaScript implementation. + +Much of this library has been taken from the aes implementation in [triplesec](https://github.com/keybase/triplesec), a partial derivation of [crypto-js](https://code.google.com/p/crypto-js/). + +`EVP_BytesToKey` is a straight up port of the same function from OpenSSL as there is literally no documenation on it beyond it using 'undocumented extensions' for longer keys. diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/streamCipher.js b/node_modules/crypto-browserify/node_modules/browserify-aes/streamCipher.js new file mode 100644 index 00000000..9d1929da --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/streamCipher.js @@ -0,0 +1,25 @@ +var aes = require('./aes'); +var Transform = require('./cipherBase'); +var inherits = require('inherits'); + +inherits(StreamCipher, Transform); +module.exports = StreamCipher; +function StreamCipher(mode, key, iv, decrypt) { + if (!(this instanceof StreamCipher)) { + return new StreamCipher(mode, key, iv); + } + Transform.call(this); + this._cipher = new aes.AES(key); + this._prev = new Buffer(iv.length); + this._cache = new Buffer(''); + this._secCache = new Buffer(''); + this._decrypt = decrypt; + iv.copy(this._prev); + this._mode = mode; +} +StreamCipher.prototype._update = function (chunk) { + return this._mode.encrypt(this, chunk, this._decrypt); +}; +StreamCipher.prototype._final = function () { + this._cipher.scrub(); +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/test/fixtures.json b/node_modules/crypto-browserify/node_modules/browserify-aes/test/fixtures.json new file mode 100644 index 00000000..48b98418 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/test/fixtures.json @@ -0,0 +1,457 @@ +[ + { + "text": "text", + "password": "password", + "iv": "c23dfaac5808546fb17ff807f0763ff2", + "results": { + "ciphers": { + "aes-128-ecb": "73e5049e015775a058cc6d69adadfb20", + "aes-192-ecb": "e78286b30e6c2a58dcf9a3558298bf27", + "aes-256-ecb": "af2e250870be1d8b85a053dca58428a9", + "aes-128-cbc": "ab6d044a021986b9cb2ab2d11641b23f", + "aes-192-cbc": "83fb920306c2d7f0c5ceb5dc7272357e", + "aes-256-cbc": "138839b0499e9bce8731bf0b9861b60c", + "aes128": "ab6d044a021986b9cb2ab2d11641b23f", + "aes192": "83fb920306c2d7f0c5ceb5dc7272357e", + "aes256": "138839b0499e9bce8731bf0b9861b60c", + "aes-128-cfb": "6f60e632", + "aes-192-cfb": "7e595268", + "aes-256-cfb": "df60cff2", + "aes-128-ofb": "6f60e632", + "aes-192-ofb": "7e595268", + "aes-256-ofb": "df60cff2", + "aes-128-ctr": "6f60e632", + "aes-192-ctr": "7e595268", + "aes-256-ctr": "df60cff2", + "aes-128-cfb8": "6f128b6c", + "aes-192-cfb8": "7ecdcd88", + "aes-256-cfb8": "df6a89af", + "aes-128-cfb1": "1558e90e", + "aes-192-cfb1": "0b111fbf", + "aes-256-cfb1": "b63042ad" + }, + "cipherivs": { + "aes-128-cbc": "f7407490d4cc14c7a0c026cbe19fb350", + "aes-192-cbc": "87ed62214972949ed913b612a319ee1f", + "aes-256-cbc": "ad3e265d8c7375c2941850fcf59337e9", + "aes128": "f7407490d4cc14c7a0c026cbe19fb350", + "aes192": "87ed62214972949ed913b612a319ee1f", + "aes256": "ad3e265d8c7375c2941850fcf59337e9", + "aes-128-cfb": "e914ee82", + "aes-192-cfb": "3620077c", + "aes-256-cfb": "9e495087", + "aes-128-ofb": "e914ee82", + "aes-192-ofb": "3620077c", + "aes-256-ofb": "9e495087", + "aes-128-ctr": "e914ee82", + "aes-192-ctr": "3620077c", + "aes-256-ctr": "9e495087", + "aes-128-gcm": "265acbb0", + "aes-192-gcm": "39c211e5", + "aes-256-gcm": "ffc91d0e", + "aes-128-cfb8": "e991ac85", + "aes-192-cfb8": "36e72b98", + "aes-256-cfb8": "9ea3993b", + "aes-128-cfb1": "fb9d59cd", + "aes-192-cfb1": "5928ce49", + "aes-256-cfb1": "e77b9555" + } + }, + "aad": "calvin", + "authtag": { + "aes-128-gcm": "cd9752d7719746f5aecdb2086421a890", + "aes-192-gcm": "5f12847627262e0503eed9b26ec31d7e", + "aes-256-gcm": "1405b12c87d1a694e742c97f0e1336bb" + } + }, + { + "text": "I am by birth a Genevese, and my family is one of the most distinguished of that republic. My ancestors had been for many years counsellors and syndics, and my father had filled several public situations with honour and reputation. He was respected by all who knew him for his integrity and indefatigable attention to public business. He passed his younger days perpetually occupied by the affairs of his country; a variety of circumstances had prevented his marrying early, nor was it until the decline of life that he became a husband and the father of a family.", + "password": "password", + "iv": "52c1fc0fdeb71a27866886d015a6b425", + "results": { + "ciphers": { + "aes-128-ecb": "d379e1348c94ed429b0e3b7450067b7e3697f810ccfe699f657043d9a55ec6cc018bf5caad8e0bb113929f20e2b94dfbc31c1966aebe85f4193dbdd54d1a250c9416a0615af9325ce58bbbfcb45a247ac9a2b3a88f7216eda04fd4ccd1b6d15d9f9bc88f5f71c885aab86297bebad85b81595f58f5694eb2f688aba40b25c9fc66117e6abd0e305a2eb0369fa909c4ecd0b734507cf365dda81fba7ae8f20b6679cfc850eb7f5003e433b8758d288a0aef12c7d6bca34ef68ddfadb59bc7c28b5e6226de27c28e2e0203ce3f799a0849abd1d8ddbf12a38d66c132d8976b7e42c98254a69b833c295167e9fe433bd4facb90a7930df2aedac8fb89e9e9971b93fef2c3bbfc9681a8d1ab74d08b47717fcea757f19b281acda9526c43be54a2d45f1d713976e784f8b589024ce5ec79a52b14ca2fbf111e06a85fb50c1c327cbbde7e7557096945a32c721aee58323941c5d813e4286d095115ba79c01a5462b2f6d94a15d95886021594ce13eca214b77eab89ac0af68a3009c89c3f28cccad1117e06040e35c01347fbdea5c629e060b19ed569217c7c19da24c8709877ae2b1d73080c80d27b55393d088a856bebf9ea21cb7155f563c0e93508b93b8b5c70dd994d0afa83a7d4a60344d3d03a31acd1f13393d2a07c21b8bc877e7993bbc91519a651fda1376224aa5cf5cf4d45b9c1311e52d572671ef5b596641c6579d14c5341a04390c61039b6f6ea62d1b43d669a7a4e9e37290d7e0f46e9635763c4c980141d9225d058a2bb21202e27a8d8595620efdea2aa4334b69e4a0cbe649b", + "aes-192-ecb": "d715500f675edecb4d7ff2f8cb2d977041995fd2a56701025add45adc6ef298ebd05549ccb50ca6c98456c34e431c029954754d835bc74f076eadbb3917efb8eb2ac9082dafb1bcbcf0d1d39b2f22be41c7ce132206344523f651db3c006485323e3fc3229d9cdaa554b3dfd3c061a1710f0f73579d35df36ba6c50f42d775d3a7ed32dd96c72356daf30c0ea51dd0f40ea11db85f7622fb5c497af3d40c2961693f2fd775c569a8a960a30da9aa1feb912aa163a2bced5eceeb6c8d835070858cb5a07f3132146362259f84078cb0bc9a1c70d7b2b97bd22e3772c91c1138de3fd0b2691b3d5b170961a1f5738a3ffe746f9f6788194685046e5c69798da74f9f016ed6a82a3ead268a151ed298d0bcb1a56130b20bdf7cceaaad932ed2a9cc78f195c644c5fd1e55ab83147ee079e343241bc36356297da09ea195c1cb66f1b913aec3966eee2a5dc0f7de359c8bddbbd9a5287ea47ade1d089c8aa50a3faf88bfd4909c0904e55e6731b9b2ddc84be20f27ec27348ab040d8bcdf1d722733eaddb1b846a9b7e1645355cddb3ad03b152864a8a925b45695b97a2792d4f6e5141f9d08eef6d98831f1d531a0f6caa22da3229ab2ca9b310df615dbc173e049bd0c84d3877f0cbe833cec21d92fe868e75903086b0d9a6fa1ca86607eb343ab99bf3766b83a868ff97af09e63fed5999269a52f2911678202188b206253ab32825e9780f7aaa4b835394879d161b4f36b7e37408fd6dae36b6b10c3352fdc875c4dcadb703217da8b0b653acf619a0e683db45436e6df8568f7a41764ebb146", + "aes-256-ecb": "1b51469347dbcea6c5dc267e42e67fa19df5b81e50d7c7a9a180f6aa945c897e58368082a84304a4194277b22ee6a988bed15faaecd78dde0d4d16a70822af72b30b53f2708db732a073377f01a9a414c25c8ce08701a46af9a87c6a912838044dbe95092828796d97ece33b594d6079c2db32762043736877b3a662cae61f47d96e24527efddef6ddc44068facaebc7baf9a615350cebb38d6493bad6b97bb79ad8afcd2e982efb30011760b1894435fb9f8188b8124f5bd43aacd5fd60e6ebcfd5696a83b70bf97e12980567b0cafeac825b6a8f625b539c1bf64dd3baa4c8534412562e0473ca59ab14f6fd98282727090c0a4d4351a694cab064d135003cf58a05b1290aa06a1de55308485617e2b4b688a7e968be7fd6c582aa7d203fcd2cae2a5d5d537c8de4efb5795ddee3d84a2949b7a034836bfe699b0fd8b375e18802e1731b519945e3f4437ff89b8ceaac1357a35265fdae05e446a9e1390e5a44bcf2e07b6f8c4d4de20dacb377cb2612fcfb73304884682d22fcca36afdff138e2a56c8da4cf37fe0b28a705816c9636bdd70723c79f390f32e26fef5604d5efcc77babc83dfb3aa7e9bd7e4daba00547926df615e15d7cd86876a83fc81ab9afb879a1c98ab1ffdc33ab558a633b507343f55e8e87dfc43d5d0ce37d76390b06b723edaa119c3855ed7792b357cd99b14fa6f473201ad989aebc6834d1b0f7f48954e2d57827cef6888cba1c59313b9e21f9430b5c2153bed4a6b0f89aed23441534ef0387b2cd74399be5548660b81d7ee40025b228970993bf300faeebc", + "aes-128-cbc": "17403e6b8b30dc3dfe833edaf2af3cc20493766db8adee6a6775fd66b69acdd8d42c32fef9f8cf401ca6876bf7d2b36ebced41f58f9655c434a03162547e4998551de77a34dc7184bdb49b04fa672ec07ab9d843c9c58575c2637fe236973657f97a45075cb1ff8d18c87b5044c0f62d7962c559daab347da875ed21a87f73df4f2b3586ef21c1e068b8edd8727b139fa78fb86c43f25f9eedce21462fd2abba36179c1b29ce82b7f925e81f4c4138a309aa8adaa4f0f07a3749c2da4bb05b0ad9d56920771369ba32850c311f42ea0cc90e4dd087958d7cd53f3e631b7086357cc33169e337db6994fc63e6c36aa1fb7a99b540cb6b300b333a0e41b9706a0fdf1729beded242a93b83f207e4c1fad9cfcd0a400a1611339c542bedc62a91b8f31de9ef21493449852e7a0ccf12989e86c30e6de7d0d33694b7e59fd232f7d216b04b3b49c63713a6ee72db4cd9e0636efed3de7b164bfd032825351a8efa5d15994749c2ca41cdfce49a59227445e574846097b295d0330e6f4806b8d2af220c8d83c5b71c8295af116ac9fc945c26cf71eeab0ceaa9da1ce1466f764682a3b85709a7aac67c0c265120cff66c465ccb6bec9dba4c2acca729fdd9407d2823ca30038f057ed2fcf5c795397d6e761fdc08cb554b30f93c6c0647a67a79da500811ababa154342cabd1cd610b4e46ce45e1c9b86a15dc2f119495e8c431c96c2fa8471f3ffab6d070bab41649e3f146f00f9a6b20213fc902a97635e00e73f7f26c7e3fbf15e764dfb92f0a65c2991ab97f9cc81720723b2c477e69b3d87aa2", + "aes-192-cbc": "9a79675d33a12c5fd5144d89752cf8591f0b595165b023800679b10ab59035b9df70f29e76e399ec30b2264178c3777c14550edad5860e1ef8f96ce3202f5208eb4316b066d911e4c89d1473cbe349a4aab7c87fb27f3e79a50925bc253aeacf61537fecf915d0b86558646d3beebb2e01eeb0a4d2d7152fef36a788c062453bd413bde5a5c5570f7b78721314699728f602e7e01397cbf8acf04c0a40df1a4a5e66ee42fba9a965bee4e2af3c92bef47dd6e330099263eba40cffc0717c37aeefa07ccbed4d3f6ce2e08c4c32146c8b072f887344a27cc92170d9ba9adc8528877b9a8909d818ae5d72d75c285eeba6bc9a5e03c5a776d5d3a6715782a3d15276adb30c7e2aec601eac8e93c82e4cc203c077c96b57a4c9b0d1aaf2ee12172f85de69c2445e7201278e2769a77d5903cb25c5811ae389675816f8666f49b94ac09c2a5130ad23359fd7023b41b488e401a86beab1fa4ad78a3bbde7b67fb78d59c4fd696e7e2170dd02d39253378c205639541b48f8ab4da29b09a58d4cc1c3eb9edcc99d54005957d7e2785159d16fc71846cc2dcfaf595ca451bb122d5b21e1bb08234b6997f345534cdc7240123401650db5a41638d8601a2a7b6bd7ee12303c050668b0a6f1dc91a2f006a4e0ab5c89c7785d8a541793fbf2566928165ae693c70a8295e460e7580dca60242882004d540aa845e86d3c1534d3aedfb508ae91d97e31656615eb72c5dca78fa7d449867e3ef5eadf2bc74dfe1613d08e67ba7ab0e1c50d7f7caaa65b9009e93d21eda34bb688a56f756fbbb88eb0252061", + "aes-256-cbc": "e61484b76c26d646d10783110cad453244353988d80f0fe34e9c5991b75acccc08863d2f6ea0c9c9a69362566dfbeb98fea8029681bb8698895a02ed9887a90786ba168f594552805d41a8616aaef0a5b50c259a23b803f7cd24b2ad97e5f4b745f46643074818d946dc42fa0a9d6e1da1256818be90118a643b281971bbc12260de04d3256ceb11e87917712c1bdc0512f104a00ff5d5e2bdc532ba42035787c83b64ecbdb1b860058938241efdcc43ef62be6cbae85e582d9d5e846603909d9a9bf1019909c15d4cf36ebdfb7dd4666ae84c06568e531f50e59ba9b924cca3d46f76ab1d88324d0cecd25589d73d2488f434bc56e0abd8c6e0e389bbea3a88c8990ddf830106f746b4f6916667e3ade50267ed1a543239ad3fa75906c1fc4509147893517798acd3f15eef97b590cb67d0f8322398ce7371aca5247b7d0079897eeb8273604663152843cdae06f6c38ead2a60dfe86287489eb1a6a9cb48e9cb8abe0885b84dc276d3405e0528c49b14461ab2797d0cc0da6ee9aeef69e7ee585abccf4493d6a180454d29ec78790d513b430393a22793092efd63d58d684a6f429ed43a9ae72e8489d793bcd8d821a7bc693c2e75493a51788482f73030579c6f04c6f54e7ffee6b1f3d4b64379e89670530cbf16ad0b2b21afeafda636105edb94f9e6075665bb6f012d566bf468ed3372bf0e1f13917ac3c33cbc8979e559056b870b474c65cbd5aea2a1947b2b8f5719d2366da5ca91c82aa371d8f5c0e849dbf56ab7f4a69049ac8b118990da7a6394e1b7113b89f8f262681d063160", + "aes128": "17403e6b8b30dc3dfe833edaf2af3cc20493766db8adee6a6775fd66b69acdd8d42c32fef9f8cf401ca6876bf7d2b36ebced41f58f9655c434a03162547e4998551de77a34dc7184bdb49b04fa672ec07ab9d843c9c58575c2637fe236973657f97a45075cb1ff8d18c87b5044c0f62d7962c559daab347da875ed21a87f73df4f2b3586ef21c1e068b8edd8727b139fa78fb86c43f25f9eedce21462fd2abba36179c1b29ce82b7f925e81f4c4138a309aa8adaa4f0f07a3749c2da4bb05b0ad9d56920771369ba32850c311f42ea0cc90e4dd087958d7cd53f3e631b7086357cc33169e337db6994fc63e6c36aa1fb7a99b540cb6b300b333a0e41b9706a0fdf1729beded242a93b83f207e4c1fad9cfcd0a400a1611339c542bedc62a91b8f31de9ef21493449852e7a0ccf12989e86c30e6de7d0d33694b7e59fd232f7d216b04b3b49c63713a6ee72db4cd9e0636efed3de7b164bfd032825351a8efa5d15994749c2ca41cdfce49a59227445e574846097b295d0330e6f4806b8d2af220c8d83c5b71c8295af116ac9fc945c26cf71eeab0ceaa9da1ce1466f764682a3b85709a7aac67c0c265120cff66c465ccb6bec9dba4c2acca729fdd9407d2823ca30038f057ed2fcf5c795397d6e761fdc08cb554b30f93c6c0647a67a79da500811ababa154342cabd1cd610b4e46ce45e1c9b86a15dc2f119495e8c431c96c2fa8471f3ffab6d070bab41649e3f146f00f9a6b20213fc902a97635e00e73f7f26c7e3fbf15e764dfb92f0a65c2991ab97f9cc81720723b2c477e69b3d87aa2", + "aes192": "9a79675d33a12c5fd5144d89752cf8591f0b595165b023800679b10ab59035b9df70f29e76e399ec30b2264178c3777c14550edad5860e1ef8f96ce3202f5208eb4316b066d911e4c89d1473cbe349a4aab7c87fb27f3e79a50925bc253aeacf61537fecf915d0b86558646d3beebb2e01eeb0a4d2d7152fef36a788c062453bd413bde5a5c5570f7b78721314699728f602e7e01397cbf8acf04c0a40df1a4a5e66ee42fba9a965bee4e2af3c92bef47dd6e330099263eba40cffc0717c37aeefa07ccbed4d3f6ce2e08c4c32146c8b072f887344a27cc92170d9ba9adc8528877b9a8909d818ae5d72d75c285eeba6bc9a5e03c5a776d5d3a6715782a3d15276adb30c7e2aec601eac8e93c82e4cc203c077c96b57a4c9b0d1aaf2ee12172f85de69c2445e7201278e2769a77d5903cb25c5811ae389675816f8666f49b94ac09c2a5130ad23359fd7023b41b488e401a86beab1fa4ad78a3bbde7b67fb78d59c4fd696e7e2170dd02d39253378c205639541b48f8ab4da29b09a58d4cc1c3eb9edcc99d54005957d7e2785159d16fc71846cc2dcfaf595ca451bb122d5b21e1bb08234b6997f345534cdc7240123401650db5a41638d8601a2a7b6bd7ee12303c050668b0a6f1dc91a2f006a4e0ab5c89c7785d8a541793fbf2566928165ae693c70a8295e460e7580dca60242882004d540aa845e86d3c1534d3aedfb508ae91d97e31656615eb72c5dca78fa7d449867e3ef5eadf2bc74dfe1613d08e67ba7ab0e1c50d7f7caaa65b9009e93d21eda34bb688a56f756fbbb88eb0252061", + "aes256": "e61484b76c26d646d10783110cad453244353988d80f0fe34e9c5991b75acccc08863d2f6ea0c9c9a69362566dfbeb98fea8029681bb8698895a02ed9887a90786ba168f594552805d41a8616aaef0a5b50c259a23b803f7cd24b2ad97e5f4b745f46643074818d946dc42fa0a9d6e1da1256818be90118a643b281971bbc12260de04d3256ceb11e87917712c1bdc0512f104a00ff5d5e2bdc532ba42035787c83b64ecbdb1b860058938241efdcc43ef62be6cbae85e582d9d5e846603909d9a9bf1019909c15d4cf36ebdfb7dd4666ae84c06568e531f50e59ba9b924cca3d46f76ab1d88324d0cecd25589d73d2488f434bc56e0abd8c6e0e389bbea3a88c8990ddf830106f746b4f6916667e3ade50267ed1a543239ad3fa75906c1fc4509147893517798acd3f15eef97b590cb67d0f8322398ce7371aca5247b7d0079897eeb8273604663152843cdae06f6c38ead2a60dfe86287489eb1a6a9cb48e9cb8abe0885b84dc276d3405e0528c49b14461ab2797d0cc0da6ee9aeef69e7ee585abccf4493d6a180454d29ec78790d513b430393a22793092efd63d58d684a6f429ed43a9ae72e8489d793bcd8d821a7bc693c2e75493a51788482f73030579c6f04c6f54e7ffee6b1f3d4b64379e89670530cbf16ad0b2b21afeafda636105edb94f9e6075665bb6f012d566bf468ed3372bf0e1f13917ac3c33cbc8979e559056b870b474c65cbd5aea2a1947b2b8f5719d2366da5ca91c82aa371d8f5c0e849dbf56ab7f4a69049ac8b118990da7a6394e1b7113b89f8f262681d063160", + "aes-128-cfb": "5225ff2b15584561697dcf84b17f68b72018561895e734cccedafb3c03929f4a1bc2d201e6b990f8debdc4b1228d43e4b89ab30797aa1b28dddf658bdc31ac2ba79229db43db926abdd94c50b6fd7b168ac4ab9ddde316cbe3e659de632bc9db56beff0f6c6b19e73c675ce9101ae2a6e86644dc66661b3f2253a6e6571d905a11971bce0f83877c0406d678cbce7f0876412bbac6faedcce9b95dcbfb5aa94fc610c4307e9d43f7a2c4ebbdce72d272ba8b7bc78f202bf376acf26d3557dd990c56ff80be5e0e8459f558d0b069ee569ea75287a1ebe74f11e912ea2d9cb68d9d72bacd4313e44602f7b8a514866df628f1b91dea859ce5f02a1388e7d1ae4047c2d94d6e64ae2a155c20cfc9720b000ae4885abc9d4b982c15f6a35a743c760bc757426d760e343fbec1f949d5ae8f84ca424ff8807a6e36ee43beb355394ec6a6174bc40d6bc0e9469c895c7d2beb7fa496b6c73ea8c2e943ee6dda983d1215a0009506bd917946536cfba285706682aaed8b476b54230c22c797ce30e86585026cffd58cd92df6772551a26e35fcd4ca1d9ab3ac99dedc6957da9666d5486b58365c0358eab9178bddf88c81d8c4d65192e5332bad0b6eeed079511b035588309511fd0fe2c30bb0c539864faca48a1d0d44768b394aa1a2787a33b954072c39b675437e720a86d4b007a0e73b088548a866dfd66da8c37d7664b8ef0d4ba80d60a3c96cce138f4953310a9d404788d57ab4f9523d3396122b948d33a44778ec1c63fc6c0671772a08394c0b96eb45c77769da137b", + "aes-192-cfb": "431c4b713428cfc419ea2917b318efb47ccd70c259bfa69d6b6e591e12a811626722ef3ee2bf3215a74004a47395e09c62e4e58e9bba52765cf17814ea8e17545db49ef6a99b347b31a87fbabdd3a5d6266b5e567cd39f32e03f70d004c08e07f68e1057a7e230217b502b1c957ff2568f1dc6ebd957e514f77b120b2df4a3eb082c0f5492d76c57543aee46955658404c641438edc25d9a41ceb1e9e4bc3c952358b776ad696e51bb18451394c106455599933e50ac17d8011b37853535385a8e9dfe9dde74b83c2980511a31e02106e41aff550229afa242c7ea4dc1b251b0983de149ed3dbcf7ff33cc56352f38beb2498580a3f6afdf7ec32fe389a9703d37dba751bde8ea5fe6d4d5a8e1c9185130783880a5329462daed84e9b828ad1e3cbb9869aa882d24aa21f9e73a4ad67222b283be52bd83de7d850060fb973d18964ad6890bc797563d94aee463c79d3278e5c0babdfa3c08fa069d45729a7b22d2a5b84196ee42006eb33f2fb70273ed0c761f12a0601278ccc4f58975dfccb359fcca18471a5067c2b59dd7dc16107c03a2a4c2781210eff68fded527816e00c6090d3847c10316cc8f937c82f35d5f01b6b8bbfd90f7a6e13d14363d193c40a62eb32cf054953502dfe3196ab2adae91ee07c5e08de4f7d69252deed38bf064a32ac6ce24ddb3db46c39aedce5b26bed42890858ce10ca5481bb7c8e78fb8701836fc7fb5997203436e9c5ea6edc0b6770b42d2247582bbd7d5422df46e45d37e3b140e2cdb1a2dc75f78eef2f60f47e08027ce1e424", + "aes-256-cfb": "e225d6eb312195de58f18d155953985d9abcda4baa27503ff1963ee8aa733781a9f8bd10480af779eb637c6248c5e35929c39e75d2fa0ecfb993c6eb6c3ad339d9145079e77e9f809ceffaaada4d8992ee74a86835ef2cf6a1cfbe2389414b880d39b940a486b8937897c17f87cb80e3411a5478a6e51a593fe74fd9ff64a6376f10d259e27e2a2d7a0835abf6a240587665c5172bb19f0635e0d7918b1c8420785f03ee4835bae213a16ed6719e41ac9273ae1e94105e7dbad369acb14441e1cc2ab94d3f0eb210ac19dd6fbb84396672d92322b483ba482263ecd153f42894735c08fb03cb0512e1bfe361798ab032fa9b55f0d274fb3389187a5183de86037e4f11fd595d817ac3c6ff066a9e152e43cf0d24ee6fac12898119411423657d2bc7ee3c20946854ad3f3fba6ca0f503139a345f085641747fd31328778058c6a0624de2e109e5a0e6c3b1a94cf23ed7c5726a0849c3cabb929ef9b2a45aa5f98b4f9ae085a9239206bccf0ffd0d3c1c6ac34ad0d07b77cef4bc6e2fb1c0077dd7efb09f43bc054d9e0ade1746ebf97719ba85ed56afbbb87df6bb5080c50a3a4424d40f25d8576388122498dedbf193c5b9f0f841d3888597349a27394d09d5b49c205eecd6a3971cd42937468be4e2d76f53f42cfb794b94b0b55afdab35cea5fd233808fd815322209be13668bf98ac9127d5118240feed5673f05d1f17d0e100c3497e5bfa50d39e83cca3bc263fef65925414d4e76875d6601cf9514624ec3441fa14be3814c7d1649558add6bab7d7577c225a26", + "aes-128-ofb": "5225ff2b15584561697dcf84b17f68b79360ced0b4f824b01735cafce0d2ec40f0e53a3a2dc6e3e00fdf4f48b4b96259b4b6562c1fa5243e830635f37009143c79d8d0725c667d5648ff0518659864fc13e599d212184581af0a3a336f964e9d74cdd9c5dfce4ff52933e66044f599e76c411322ff339d2aa6aec0fe61b3e68edf1cea0579c5ad95255a4d421e7793c52aac072841b63ed7e42ccd54cc7d343b6e0487f9db501154f1ae5b167382b24baba97cbcd8dc895b8373f534e364a1d43e4d88b62877bbe2c7f13262a021a7b5636fa928ea71467a9dd9dbd690daea36702213f9ce67b091b2f3b10f93187f670d43eee45c1ac05e3e131de062b0a3e075a2d61f4447e57010503541c46a26560f804b671b4b4d6e702b281a3cfe433a25fe7b9f7a473f387ecf0c1adad8a3866772fbf36d4ff451c3d519b68e04e7d8d722907b770c1d07745a85ee69aa2e82cc48d90638b5971091956a59ffc92e99f57880d7ba306f83b3d46763a650f0d43e5b637c57e35c7454ab27642f22be3915a8e7271e5e9f8f1f4aae5f1b03e60ef42e9df770114317951c12877b138750dc88998a378db2b982580d2c91a0e79dea8541415bbc1695e2511fddcb11b31fbd15a42454a6752f931d660af290c4a33a34526cef7ffdf1ff37c8ce4fab4430f9e7ab0b24b4a10a8cf0acf3cedce71222c91617a69fc53204128e09877fa5f8edb1f160dfd8ad8c2db6887b74bd316bf6f6a3c841b3958f925e13d5515b074ff26040f01d2f6b55968d12f28394909c7a3a35d1396586", + "aes-192-ofb": "431c4b713428cfc419ea2917b318efb4ce84e949bfcfeeecb3b6cbd7f1cad51845bae93ae11b102a79f80ddaebde0dae0e8182d8ba18933b2009e8236db3a8b1089d2bc0d2c18dcab0553f9fc68ecfc337a9dd30e28a9da51769cd14204d65723173f0cbcd06ce09712469f6956e71b658f12caad50350fe3f022ea9f1418e582bd344f67c436e8e62378fa1f9acc33455c3c812a7e95c44c6296d5fadc31a3ec7555fee50dd785ee686f9260929a80876c4768311be45dbc28908d781fa2988129d66bbbc4956b77b71c2c097adb1bf3d34d0fe593b13f139f7109828dd7c159efc49b2f2c4e2f5a6975425e96cf1c144dece8abfd213fa7e5e064b458b9fa4a087ddde51516013988d31551220916c331fe39eefb84a089e03335e48d1c65cf4849aa26f01b46521e35acc8b49e2fbabae91da77e31f6f42090a29c0070d8bde7312486bbb49fa57ed103b32f21c4e6ba947d59ede8aafc229841819bc39d902bea80015590fb7ab26fb16adbea57f0c83782a13cea041711000e2898646bafd8e87b245beeb70462e868660cfab3cfe1b9dfc879113088dbfabf53c0ebf349be66c6b248bf49ecc9953c47055778fe2b021d831349cd64f11b3a9594062ff15294dcc8a8b8b5036a218e3242bd9df540f9bb18b4d256e7a4785c5e64fb5a1e50cca01cca402fe36bdcfe09444bd63012a1fe8c53c9d0b41baac1f76bd2173b3f86d1c3b0cae6d1a8652a56282155fb215cdea2ab66661a214d6651c1dd76d62f1f2c9032de9397f522647177bc89bd84a2f43b46b2b", + "aes-256-ofb": "e225d6eb312195de58f18d155953985d9164e437e3e4faabd64390984e64c29459edfc68ad14bf6f1d1b7fde3d8f72c0c7ebf8d9ff4f8d086b1f28b0605b41b8d6bc26fcb5cc9bf53f9517960d7bc1b3c54f1721da5c60c7b438d1223bcc14f473247e1e15e14847cc1c1c0681085d7c17a17d831234b36010abf84c43c5c9a4c197a3bade4563eb3aa7920bff71fcb7c1956cd79c902273b9e1b109e371cd1c370fb0a22eacd2a37386293af9b018ae65bc5c8fe9a3c8fee5d512bfb7ca9e36420bbbf9b8aac4f5f4c7bc452ce307cc10886be8cf67c0fe1172127dc346b6f9a90233bc25d27e13e316c4af8ddf601f5aba8c6697c47e829aa3cbc5717f6881f7f4f7fbd352984bdaf125612bc7795ffaed8d32eaad9c46b2f7f1abf940d6a5a31b5d9870fb8ac332bc0ab7669401e1c6283c7b67558cfb5ab9ff8e8ae5a29e7d618f78c1d883d63a56dd54f230bbdea470a21f917735141a643bb9999c8ce7a27e6e4d3d13975f144831bd7c5da4a6b9dddb57058355e3102c4d089bcbbbfdcb87fccf0e75a83e0dff68edc89bdcbca52dde3d383f4aed8bb16eb0287c200b6ae3e5d8846ad088bc6f1e2e0fed73efe835ea4495d8bfc7d6805c3e38275eb02e55317eb045285c9d74c2193509caaad3a5cea13715617c5e3a7031edcf0b287888d5260cee94413ab35afbb2890422f8afee74268c162ca1c1a7a764f292604b0022ece76a68392172f5a3f8382cc6d4a61e6fa566d96c1d33ccb5cd013afe091dfa5b39fcf241d6be3e12ab7ff40d621e0cab36f8d7", + "aes-128-ctr": "5225ff2b15584561697dcf84b17f68b79b7f4c7a47cc4144b54407abc57db110b7db69e3b8893fbbcb9e744b4a0aa998059f5f3c344161c5723aa5bd088cd3829a1621c3f53cd737989aa3ef3175d00407f39099386efda624f8e58be9638db46bbdf5d37c43ef33de20ad61d5d49c367e5ef062af6f43bc1f155fbc06517a53004a150870ef223d99a549f38980f3ed1263151232d2d7c8e86f67ad060e94f266c760574a74bf02ff888f94f070743d3ac0a9bdb1c292e0523d42e21d79b7dd2f7bfcd38f888dabe72c5cd0fa1dbda6dce74b58c4d37f9ab24678cf885b3ebef41122ed49c1a3b11498263a5952531a582e71562a07e11e3353b78809f09ee0ffc3a61b2f53178c6c2a681e374f031a9182e54815a63d1f307698c9cc3d3f34bfed068e29b73820f3965b079a201a5a2316cdd7d80f893083339cf14f452fc1a499ee257eb8413b7ab44b9be7ce66cda3d8babead114d0771d2a732dba24db4d9ba0bd6b45df61c8d030fd69b5e38e123178d0d37294875702152ce25890a1db0131f03b421e86b778e953cecb09d815a262d9d1382388ceaa951968de2fcc378745083e82f307e6477ce5df7859f88ca0422235886afbdb750c73b41fbb2fdd6f4b33563aba6f44ed6d38d19d03a91c6ae3802c267d27a4a9a5347eab5e12d5a9eaa1e8e74a9f2340098808c830f28b613cf5d40aae21b89aee982dbd614c88dbebd75d40b7aa77285d7bdc8beded4fd69155cf6490d0cf6b8409270dffa30227085572a00b4514d5b5f718c0ddffa5d87a2b2db16af", + "aes-192-ctr": "431c4b713428cfc419ea2917b318efb41bf8cb811eaeead3362533cd5229b41853d96c922d73a6e897bcb5dcdfb7137831779de9ca787649f19fcf11ab5f5ae69f0eeb8b3ef40b6e6a1a3392d04e5d9ba4c94eea3b23ef5b30b918527256bff67927ea85c63e1e90bf22320248fa3237268d199f2c64aa00a7a1a09ed59cbfcd6346736ec2ded6fbc307743652950a78b4e96a137e65af7f1ea3f7f4a907f72db6031b8cb7e6911c0207d39888e0ab80d73764448602d609636ea47517fd327599fefc83e5f0e8600ad55aad962769a0cd088494f5f99ce125114e335bc1b8f7f6c3280a2a89b56fdd5e1b5fed8482194530ad5d4f08a75c901ea8fb0ece3d6854e20b480fdddbf3b558f967958f8942931a238b576aee688ecd41afea0dffe883ce22d670a247983eb16e6430877c562324dcb71a24a8ac168bbd2ee57820f7f6a79beaf77d5fbf11fb932062275700624bba3100f59fe37f6d607983c2cb794ba40e928dbad1424d3b2029e623f7bcdb3d7de0ef7a502da6cf3da901f4eb0bb6d5a29ac821470e76a6717f683ed29d7b6ad3ddc60460489f6a7692a76a47bdd50b75036088c3620e298caac1b61ff3aa225f7f551a876ca73304ff7aa205dcdaa3987805f64aa567ab66722b9d855c72fb2ac3c022b7cc17dccca14ee926215395229b892acb09da4b25f7e1de81199122c1bf98bd9a05c5e2f9498479e337f2b85b1d659b74c4009a01d15e2edc3c8a9b7e05a1bd951375f4cce2e8823b242e3a872646c532b195d834648938638f48bcf42b4ed3ce", + "aes-256-ctr": "e225d6eb312195de58f18d155953985d7e56d913eeb52220e5ea21ad7e47c8979c0fae1f8b0d3739d2a20ac5109cbc730cee35593a91190a9c7ca229ebffd8beb9e59e203b3e08ca069add3e1a02566a1e4c6193dbcc28e5c8a86324e82e5a330eb33f83511ff1904ce82be6834de714e950c624a6e5867274d9b66809518c1d0907fc40d070b53d9b137bf6519b5a5b3853a104a457f46e1c5fec893889b169042675cb0d07e83d0f528658580695e13b016f7cdc88175b3292c30db50942760be17680f4ab2893e1c11bd83ec5b5ae946ed1b41e7625bde9ba49c8ddcb1ff258237dc6a05b8b8db5b44a87991ffb4ef3e0b7ebc1fbc146c1b27b831f4acdda9cad9c2782b3c8ad2a1295dcbfa913fc0d4c9f44e0f5c0a44decaa029132256a542bfd2ad2080ed76c560a910f8747f0c099a739b464af551e3db3824971796c63d7ce4be902bdd5daec0863480d3a02bb0bc893236f1ff50cd866964481a15b82bab56329281da28f37a29729260371250003757f1b81f0d9d48bab816ea19d994993d34e9fe2935d2193ce09047b63f520131a9e70ef15c5e01e67fc26aea562e640072b7d2398e16831fae8827b5e48ed739248da3e03946ba0a0bf98c43f241aeef8d31237b32730178c4381a132a2da0fd63820669d20d7dae71579f9e858f67d2486a513ae28798d031066a250ab0701e2c0acc1245626e6e1fe004c52d9ebe90f52f58f834ead668fdd30bdcc909f1b5ac5dd909695ea3a52ea3818ea20c43eee018b271861f33200999697d55bdb0fa4d4b221", + "aes-128-cfb8": "529f6a93a87e9282a8cee5ea2dc566e6184766c1940fcb74a93fe2b9970c034908998f9c0e1c5f02ca5ac7e8a435b2e78f28e779060c3d9ecdfb100737f093cf95224cbc8118fd0ba5aed3a330c3845f9ff2c4014e5f73ef817bd48c912b97aeef03d1fd2a82aabc43cf0b7a05e328b02b881d2b0641349eccc7b46378ddac39e2945a2faf146a9ae0d9ad4f20887f617360b5929e7a83443a95ba146f257bf41f4d75a89414c1876e984017d1c640580e8741418f92497c91bac7f606a31368797c5739980a7a921aa863ea077ab059e11505f399a02e1daad9fcff1e56e5a535be4a40affe9587ed81fd37dbdcb72175cf5da452dac9ffb6773f9211928657821e0f67c66326556ffa4fa7e39fce9470da65820431b26804b98c66dd43d3c95d53ed28c21e77afcecd73596d6f27a3ef100704bd5575bf729d865a0f5624317e34debb5285bdf0d1cf5d3ab0ea408d326d08d4fd5f26b1bd4718d86f886230605b5f085dc555ffa5b51be653ca11e0f4377610ca63aa023377ddd2e3d2a0637c4639b3d31db361fbe206c0325ca084d3586e879e25ea05ce79b6fee7872c78fcde47075793f46c1440ea24c5d9d4ca19c5aefeeb0863d9c8e2455195bbf132f98e35eedb076189b9a1f1c215f5cba18c63b376f95c4b0bc956d450030083e5981e2e36c8063fcc4d4eb2d36a6f4d49fc23141928ef97ac8430c8d90714cfb24faed9a64fd1cb540874de383582a8bc2419a9947365a1a8b34345416a4510ab156687024532ef1a0f7e41a8c39ced8ec314fbd8459dac", + "aes-192-cfb8": "43aa99335142d82be551a5b2b42a8bc407b299c2b7ba31dcc119141f586192138532db869b24c8b416bd26e28fd60a2ad53ebf2e2ba6573353016103f86534d656d0b1f686cb3122af9eee887af82bca45b85d796ce40ece7050e0c67430e6533500c5aa2989cf582deea1fb024ea6bcc6655f254f2fe83593b004a4f237dc995dd77499eec4fec800efc4a835d511f0f366eaf0556865c807ba0640e2f64d4ff658f2c77d24bd95659dad345ccd776cd7d59e52a49e99f6f8a51a5072897541ee9e79d929e8b7346c0ce9bc431dd3b21be405f91d3bf37984fca5bf4f22c230740a84ca57ae3fb87d0efe4506ce455722112015e3ef6da03b21e09ae11484b3b448d4284decdd0c400e321e1ae761be8b7b6062169c5c4256047a54e2faf1feb5a11b46529f2851f427b07b90c101392f4b5abe49582da9e402f3ec068fa6914bb3da8be2d964230ef59abdf9c29b0ff89717414de62f1b8eb5e08a19c4656630134b183c14faa464b57a6b13764b18e30b4578c8118ef92c773a5fd51aeabfba7d7ba9cebe5d14f500cf350e15fbbefe24558106afa34b450c871e2973ba42c53ac4616987800b9ad88e3ed40bd5864bde69fb1e4ecb415e760d045f116f7da48cbcec4487f6942c7bf8676c29afda2119c34446a23b2a867951046d85f04337c8642c18f3686e269959cdf22f86b358e577a3a418ce7822f41b4c572c517f813f8dd371808966d7120e7add0cc35c591d82098f74ad5b8005b6ed7ddd7f46a2808a0628a2cdf324c17958c5644cb940760699bfaaed", + "aes-256-cfb8": "e2bac21078256547dbfee82fbb8b2aa88fc980acfedce0a585ab608086582887b841d80fce3b2814a3adf5a0e701534b3511c56f0276535f18246b1cf838dd865bfd7c4372783f97a6d21f2a4b5b5a7f3ec4b465719a6a1eeacc3f076d6b6c7694479880e7e7947eeb24f96f7d99f64ce5e4ba8abfc1e23a389463164cfa391239e86b94f1447a9be8479780d4d370cbf220c4e314190bb0ad1d2afae7815a4ee9c8f788236602561b308c29d5f5a97701c799fd9f8d366c8145d0b8a712a4fcd550aa8e2943ffa72817ff22c29b19c97bc99596558f4bde9eed2de6a7ac520f0069222583d7e28ee2f518b3cd074170dc9ea508037bdd2132c1bc89fe168a13affb95817583656259fabe974e1310875433497c181b62d57985374956b202c06fb9f797d2861b528817326bc0e12b392928b51a8834890378b1605311f1f018be5bb2c68d3fd4e08cb596be62eea1591ed22e16f3cc59b543cc0850d0385c7c05c55ee4176d54d3c5f81ba9f8fa526464819d4260141aee1bee88d1617d36b8d89ea683cfd73d95d81318297906525e6d7b6597082b082a499f096fe4b613e6fe2bbb57c1a19fa778771c60a9f9f50b7b58725a410a406fa387d5343c8b7b09afd6a169775663aedfbb70443a682172ed50fdef0af54a1806cd93148a26d4a6ea21ad08a3078e4ca27161fd1d71ba1a6b3e85e67ae1290a3439f382ef3fd8fbf281f1bf9ae2dc5cd4e8ed3da578bbfd74f4a34242dcab16700447dc433c058cb27e0235c647d20245680ce3d509b7697adf7a5a966f17", + "aes-128-cfb1": "2f4108ec5804041b632360b8dfaf9b0f7114748f7edde636dceddefe7547f49bfe49176096eba8c45988e3fa45939b296fdfd52e7454f25198936de5da002c4011a7ec914a2a2f8dd0017370aff718880ade5fc2466e54c75287ac10f178177c97d66e9cb9f49d2b384e0112db174422bc42bfb1e59ef1986a26f4f5645cd5c8a3c910283e61c5c6df505ac6aff51a04dd16e423676e49fe4e10c9528ce0119836912c369d98b67edc6f0cd3b1ec963d7d959792610aa4340e94c6e2dfa6f5edcb8bbd95aca0fcc56057ba47137476d458e19118c30194307095ed94946a56f9846d215d2104592f3a75217b8bf0de82c94c091dec2cfd6fe91498a8632935ad5771347a205d0ef5d30cf92bfb550ef0019159649f6256cd88b654a01adb98fdcddb8a757bed5a98783dd1e2b275084d3b2b6cef6394e6a41cba2a269f4ea0ebad1362976ed3d08b0ba9cfb7df70bf1f7f673aac1f3d3b791a645b14eb63eb8ee1618eaacdb7f5cca16fe165ec5e7878be50499d188a3782adb240948aac43a8ee7d9414086e413c470fc7084477ebd71560386d010b16fdd72a813ed81f775fdd172cda98daeac9fa02c0f4971f09cac7364b70b086689eb6c9a4087c896f3b5f7ec26bf9b19ba6ea7a2cf341e73c9da9ced3ef22bedaefb6133209019112ac2b594c4a1487afdc36d077a6064450b7d6750c2855acb1269656e1d36123c62eb3ab9f901e20cadfc83e59c5e74c5fe991dffec1dc1ebe5ee78717b0048c22567df8d6ad8dca255b068e86df054af9932fbf1d4c6666b2", + "aes-192-cfb1": "39d86056f90656ac852ad93dca4bf36e02cd74f9628cfb21350c551120ab9e24eb5eddba28a1a70c4ac62f920ea89318ac17fae686c34fda60e7d3c1369426fb135d1131b47b75b143c0ea92be457db5b697942ee49f98790abb409f62d3acbc753562b73d331503fbdef7742cdb01c567270151f4b46ad6ce652ffb15322f9249421ada548c9e54a14159731591b8a0e73c62f009c2ee0a96d370a5616ac2fb209baea6fa66ed6e01608097c58eff053c4b2caf25f13df6817ddaee780c413299a36faddda1cb75df68eeef110c5c08d6daf3136c546074dda9c4267d84c9579acbe4acbb455fec70a4428dc56eb3861bc3c0bd639cbde6f6ad116de2efcf1b40a77a42e53d29eb4d2eb822c9fddce5f6289c8e57ab582ea1e59ebd3c4c76dd71cf0c20aa844d851f6e80bbe153877e12587fa7cff28c46ed9dc7944b98af49b5fa52f36ae0ec26f86ea26718d0378795336d1f16118b969a9db256e8c77743fd436e692ab9ba3206035caba8716eb9ec577c6f3e4def3bfbb562296c20954cc5cb323b435efd4a5ce5dbefedc513f58f8b773a68c7a7ae1bebfff599c677d421f4e4d76008778154feb074629bd85aac11e8b4edc295da8fff589e373430719d488a5f673411e2e0a6fd931deede753361b0946f887424446805286793732b39a9bd0c2ae866cc7d320fb8bb388e070b502a057f93a3aa0747f295f38520f329d6f34d00e94bad2c118f8abccafdd9b5d4a3edbae5dadf94e28d12716b01660ab40e3695fa60e8afd30ab12c6cb71d086c62ee7d1737", + "aes-256-cfb1": "8f4893d4fa7a874cdb25899462539a4d74502ff1b5191b09e6806b4e9505360d9e7670b8f4ce017290d4d7719c5690e25d06bcd93d8096f8c4ab336267f4e1e77073902c7fa0811053525e4180a213af42ecb3f5456ad9235c5ddb0ba76898b67648fe1fff3042f36205bc4f33e519e2dd20d6ddd9b921e5dff7d3252fbf29a9b3381a88aa8f4699667110bb06465bb03c066d312b3d842e1800ee4d1d94d189424e19801183d05cc2301c2dcada681f7789b560e31ffa8f84b238009238e01e283966bcfc10336fa3778c5130b7e0019e837c7296d53f8cdd953fcd42e6d93a8ddcc681f93663c4db70acea0b9168c5f6ab90876b17ffce667c971903f65060d8f1ba3364a47a6663f6405195aaa56e61f7860b4c44fa86ac5d12e0c79e96bf91577cf87486e14a713377819e10ca6073be970510b46b22c187ec7b8f68a9ea437b95fe4d017028905c0fa1058debe68a3c72a9fe1463dd63f9649aa110189e1bacef9d5fe206266c74811341e23feab0fb5d69598353c3f2eae78ff20ad3e240201dd8b5325498a1f66faf5ac6b06e4f2c47b7566aaaf1e113c6ee06535fb9fb20aca0523ac440f6ae2105ec6233bba7d07c619620f654f97128327aa333f1ed9e3aef960603dee4a8ae357e4a216fed15e16557f78110dfb5101bf46577c6c7ca2c9644f37b7f1e65048827f1d4506fa7df587cd1ce86603b904e64d78b16e985bffe3cef8831e3adcd0c79cf95531bf9fcd7a072cd012420f6901db33b3e8ece3c063ab4e49026a5a1ae14b3ef097db6910a3f140e" + }, + "cipherivs": { + "aes-128-cbc": "772b4d8e20a224a6ec0392b1fc6569693accb2709509ba265ddf5aafaecc11d77016a69e70255b7d7a5ddf7ad4d87511aa12ab987115ca157f1b9d9c3583339576e81f66cd716dfe0c561bfdff14eb842f05859c69da073759c5706da8afffc951b7dfd3c689e6cb8cc32426846f375043fe519872ec27796f6ad9cd588b800206ff4115198341c321198689f5d83e5f8e60c7c6e9dfe06dc17697dc058888a1180601ae2932ff8cfa9e15546422db6b74b05fb7e79ccc143b41cb7e8b4ede73a1f11da476bf89f106e655171848ec0ccf9c94ae3e858d06acc06712d54ab8a3791a67fb61c6a85620d87998af61c386d3f977099340c6624ccb7b9751035ae060611a7fc06dc1f5064d504803e90dc4f24d7c901547356213e09173de8dd764b798a93ab29f82b1c9385278560b049b593558755baee885f9eeac724b82359ffaad68b8d99856d71744ec39deb1e7b6e3874f455adba96aa642e1b4944e544d970546122bfd22ea9b72339c1a7d0d292a116bfb0d3d1a5cd7990709bb49a953881bebcec3f0ae6b17367af55a81e16b157dad0197c6a1dde70721d6e01e53d7e9dfb7c1e8cecade21bba03678b3ac6c2df8cf85ad090bb7e59c713c8a75d37decb280fd85d32164ce93e2b39c5e56292c7bfab6bb354ee7bd34e5ecc04fd1e9e8c8fadc13e4df58cf8e278041b625369d7adc4d3dd8242be4a43094ad1d801fb725915e432edbcf1ca19c460c2b335386304c651a09f46e69016509750274d055ded2c13adc180273eaf82e5c07053d2e7ed29e751f04891ea66d79544c68ec", + "aes-192-cbc": "ba1d241268647886d3b9103013959edd378dccdc1f158f84ed560ca88c0c4a7863c13c914b0059d217ab32482168745225f78879c6d658653bd17277b6d9bac6cdce37dcd8dcb94b01fdebe358c33277f32d2989eb2970e434f653fc28e60dbb4fb9a14e14d5f38c30081c2e9d1a8ab145551257c448e24c91dd1adb99fc46ebcb633d4c8b3f91835bbbf9085cfb1a2f034a51c609f095c1a813fca49192e7f64cb959c664e24759f77c21c05faa90ce4c222ae6d87bf51b770c2888b7e0f059a7f06c4622e104dde2b8ffd447e6c0cff1a44cb9d54a1a16f5a90e97e4dccb5a7e135406ad0632f61a6b1750a335ba5b187c032750d41ab98f75e1327267092a6fc594e1971690d5c63b867d61236f432284079ec79899afac2564fad047937cb270fcae1d0dced5a9665044814109a27bd0d35b6dd7f0177ef8580ba3078cb1b706e553ff08e0ed47d4b2930ae918ce4747ccc0bf74e8a6a6811f1e1b29c3e658a5dc497f65ffdb3733ac009e7a15ce74a8c5d404ff8912190e8b1f03f13ecc304ce1904165d90177674ad2410e1d925b4319396940e961f507952788eace2e184d822e9818a1e776e3ea49a50bcbe60e9883d4c538eed3a3a584999f7ec0108207f26826b2a4dbcfdd64901d9173bf8199dd13227902af561447aa12037e875ed47d0e0518c1836c2f676d5c454862f525183f9ca50bce15de150ac12e3168882767ce5a2f2f431d3021ec21122c3e900b53ec9949c5c254d9ee8f86ed5eb6347e65b495367ca11c471ee2f9f02e73674861ce55f889675534d6fb57459135", + "aes-256-cbc": "4bd525802cd2ed487bbfad28a81764d381b7c83291edb366c73cca3167e19760a5023fa52821dfd44d22e314583c842659aba2d23e3118756a302426699415d88d6cf7eac4ea53a01e7ba1e9251ecc62d5ded26bf4b5420b19d1e96bce7453122ace17cc0621995429436693c584cfffc66d27a0d00419b499e672b2813730cbf97d142c68ac5f52e08632c4f76c6f8b9a0140429d731e996c17e3dca3d6b07af330c4189ed6eecd338b28c989736011cd2b8704ad43e5604f3655e86cfb6a3788a508f01896cb468926cf79be1a665e435d2d54844597575292b989a81f424a4f2190bcb829aadfbeddecc97d18b595c87d534706d3e5c3d5e76eb59bc2815fd55e70b1672ae510d1011f613671d4303e36668aeaa3ea4ee42f1c14018b5f70ca455d6a1bc5231f5afccab64a147af2a175ea16d54b2f789243186f9e0be9d29cd29e5fbcd8f1ec32453e2df77b387ce4a833df580cdd158276d48f4c2e7e18ca6ef0e447f79c7877e3bbc0661512c93e004cdc93e94458cd78f0e1b96d910abf35955c073c2d84a3ad32d6de24d6d4071dc609acbcc8aecb3912f15991a1c89c1a75a75ad53016191050ddb0cce49752fa426a346016c36fc8790fe803496a23876bd36e970786d949ee87df1f34644d8d1318603e4637e3b4a922f3e4249958cc3a741a8003fec74719d35cf184617593356e083ca4a27c30f5b388089e0a858984c4152f3030b9f0a6c25c7388cc22db210798dc5d00230081e465a1c88a8fae186f3ef7aa9c5c2b9e472c1622ba9958ed85fe94160ac071da3b285cdfe0", + "aes128": "772b4d8e20a224a6ec0392b1fc6569693accb2709509ba265ddf5aafaecc11d77016a69e70255b7d7a5ddf7ad4d87511aa12ab987115ca157f1b9d9c3583339576e81f66cd716dfe0c561bfdff14eb842f05859c69da073759c5706da8afffc951b7dfd3c689e6cb8cc32426846f375043fe519872ec27796f6ad9cd588b800206ff4115198341c321198689f5d83e5f8e60c7c6e9dfe06dc17697dc058888a1180601ae2932ff8cfa9e15546422db6b74b05fb7e79ccc143b41cb7e8b4ede73a1f11da476bf89f106e655171848ec0ccf9c94ae3e858d06acc06712d54ab8a3791a67fb61c6a85620d87998af61c386d3f977099340c6624ccb7b9751035ae060611a7fc06dc1f5064d504803e90dc4f24d7c901547356213e09173de8dd764b798a93ab29f82b1c9385278560b049b593558755baee885f9eeac724b82359ffaad68b8d99856d71744ec39deb1e7b6e3874f455adba96aa642e1b4944e544d970546122bfd22ea9b72339c1a7d0d292a116bfb0d3d1a5cd7990709bb49a953881bebcec3f0ae6b17367af55a81e16b157dad0197c6a1dde70721d6e01e53d7e9dfb7c1e8cecade21bba03678b3ac6c2df8cf85ad090bb7e59c713c8a75d37decb280fd85d32164ce93e2b39c5e56292c7bfab6bb354ee7bd34e5ecc04fd1e9e8c8fadc13e4df58cf8e278041b625369d7adc4d3dd8242be4a43094ad1d801fb725915e432edbcf1ca19c460c2b335386304c651a09f46e69016509750274d055ded2c13adc180273eaf82e5c07053d2e7ed29e751f04891ea66d79544c68ec", + "aes192": "ba1d241268647886d3b9103013959edd378dccdc1f158f84ed560ca88c0c4a7863c13c914b0059d217ab32482168745225f78879c6d658653bd17277b6d9bac6cdce37dcd8dcb94b01fdebe358c33277f32d2989eb2970e434f653fc28e60dbb4fb9a14e14d5f38c30081c2e9d1a8ab145551257c448e24c91dd1adb99fc46ebcb633d4c8b3f91835bbbf9085cfb1a2f034a51c609f095c1a813fca49192e7f64cb959c664e24759f77c21c05faa90ce4c222ae6d87bf51b770c2888b7e0f059a7f06c4622e104dde2b8ffd447e6c0cff1a44cb9d54a1a16f5a90e97e4dccb5a7e135406ad0632f61a6b1750a335ba5b187c032750d41ab98f75e1327267092a6fc594e1971690d5c63b867d61236f432284079ec79899afac2564fad047937cb270fcae1d0dced5a9665044814109a27bd0d35b6dd7f0177ef8580ba3078cb1b706e553ff08e0ed47d4b2930ae918ce4747ccc0bf74e8a6a6811f1e1b29c3e658a5dc497f65ffdb3733ac009e7a15ce74a8c5d404ff8912190e8b1f03f13ecc304ce1904165d90177674ad2410e1d925b4319396940e961f507952788eace2e184d822e9818a1e776e3ea49a50bcbe60e9883d4c538eed3a3a584999f7ec0108207f26826b2a4dbcfdd64901d9173bf8199dd13227902af561447aa12037e875ed47d0e0518c1836c2f676d5c454862f525183f9ca50bce15de150ac12e3168882767ce5a2f2f431d3021ec21122c3e900b53ec9949c5c254d9ee8f86ed5eb6347e65b495367ca11c471ee2f9f02e73674861ce55f889675534d6fb57459135", + "aes256": "4bd525802cd2ed487bbfad28a81764d381b7c83291edb366c73cca3167e19760a5023fa52821dfd44d22e314583c842659aba2d23e3118756a302426699415d88d6cf7eac4ea53a01e7ba1e9251ecc62d5ded26bf4b5420b19d1e96bce7453122ace17cc0621995429436693c584cfffc66d27a0d00419b499e672b2813730cbf97d142c68ac5f52e08632c4f76c6f8b9a0140429d731e996c17e3dca3d6b07af330c4189ed6eecd338b28c989736011cd2b8704ad43e5604f3655e86cfb6a3788a508f01896cb468926cf79be1a665e435d2d54844597575292b989a81f424a4f2190bcb829aadfbeddecc97d18b595c87d534706d3e5c3d5e76eb59bc2815fd55e70b1672ae510d1011f613671d4303e36668aeaa3ea4ee42f1c14018b5f70ca455d6a1bc5231f5afccab64a147af2a175ea16d54b2f789243186f9e0be9d29cd29e5fbcd8f1ec32453e2df77b387ce4a833df580cdd158276d48f4c2e7e18ca6ef0e447f79c7877e3bbc0661512c93e004cdc93e94458cd78f0e1b96d910abf35955c073c2d84a3ad32d6de24d6d4071dc609acbcc8aecb3912f15991a1c89c1a75a75ad53016191050ddb0cce49752fa426a346016c36fc8790fe803496a23876bd36e970786d949ee87df1f34644d8d1318603e4637e3b4a922f3e4249958cc3a741a8003fec74719d35cf184617593356e083ca4a27c30f5b388089e0a858984c4152f3030b9f0a6c25c7388cc22db210798dc5d00230081e465a1c88a8fae186f3ef7aa9c5c2b9e472c1622ba9958ed85fe94160ac071da3b285cdfe0", + "aes-128-cfb": "0304a8ae497c46305a87df178b39538be455205fd10d1828ecaad1939fdb385352c904b5b18fd89fe5a18ecd09ac677fbad2261d4693e4dd9e6d880d390f1eadb4bee741b9616c24f0b5aad321e26f0164829411db3e4da23eebe6f2e2aff49b2b62719bbbbdc6b9b8f03093b1ed4b35b3d1bf2f51b1b7859fb6f31b1e8bf722900ead0497594a96c8686da60100c349caa3a814a322c775604875d2d6fb0db51a539d4d0d52b312fa5c9d6e8816b78b16c0a8909c80096e2744d54d7505e7d375d3373d007bdbf2ecc60d9b0fe70ffd1937ae32c59925770530778c96bbbb198ccb5d526d47b775a3882c52f06901280bd79c42adf7aa6a8b2a2128ed6d5f792b61ab08c3037e5a6d19863ed4a84ce061ef9b0da5eefbb91feffbea775016deb9fa3e956c670a81891e8a337af201a308356e906625bdc57367e9cde5b228db26c5c305bd35b299aa8ee6b23dad128fd57dd33fe5e9c2665cd12d3475b30ceab7f25c8c7d3c1f926550ad37f1082b14002ea5a85783fb2f7acbfb7700b6dc2ee1c44233f29942fff2e1771fd0892a8197664c48716a1d4f4ea2f4540f76356e61ebb088acda8a3f3ec1c21aa6fb3197fb1693ce6208e519c9cfbb4a84804c7045b088fb5cd9eb596674e817a361eb7268e3fcbbe6d16d2dd5283b07fb874f5c7625cde806d66b6a59847d2ca40fedce04aab70599f870fa4238d77da8f4140a1679376a92ee7949bf8e42858882d4b04a15f0c84a2591f244889b8278e79259f21434f402950465f1b2882a11511ebb95e10d941431bd", + "aes-192-cfb": "35f1e120808e87537835e1cce77e65736fd163fc25dca73c86a9e1a7d49a66be47d2fc9c307faac6691cf12816a8166f2053a5728007a85535694b4dc9f0337e9b17e4c1e9ced6c5c58a1b747e2765a54141e864a2c9500b3d96d7f861b2259f777cd74dffe2f5def6cae7969384a163b7adf61fd6cdb05cf9d10bda269c91f5cfcbc325cc50f1fb3424af848d4308b3103223e4757b01b87f1408c6608fd4a401da33d1c1199271d757f8d9b7a5e58924ef76914c34f2fb35a86b2707b50bae259f3fb7bad9991cb2dd3e33ade251ac52052d87fb9415921d35a5d223a4385d384a33b27276307b35795c3de1b14be81001373c0a2a0ee6c52a5c70e695e30a2cb46ba8363beda90181e6010ab5426f663feecbc94f57869cdb6f75299f696deb2471019379db29fd67065db9c557a0880862fcb2c7418a1804289be9bf01cba6a3562731dd7c15b473359009df4bcc367c85d44dbefd6e5d585377b71f6f27b90556a75afe19b575eb3b2f329dca7ea3a48ce3f848f35aa4c5977924fa0ee76d2140d43e0918093f17728983880c83bc4aa23f2710ac4671de83734b0a904acc0df93718ad74017eca9cac94ef2f23a44e7be169366d5de44992af57275fe2e73b8ac05f9fe551635b99afeb6aea7cb551cf7c5ab0ed3d88e1a340f8e505dc64a91c9ffd04820daaf2ceaf8b876400256d1cc82ee18ae6b1f05b6ae27ba311009623bfe190a98e226263cf11ee35b1b64095b845ad50517e597fa590efef70a82cb99546d6037302c5cc6a1b325877a1bc898b91bae4", + "aes-256-cfb": "831ec789aecaa6fd45e28074bea498ffb82b9c36faf042949fda04f02cee48f0a4a3e0db27e6fa4297c4d715885dc54bcb341d13de8a20985eaaad64fff240e068cc62dbacb9698e98d33b6a3d22ce16e6c178f6999441f55f434f95a988e5db92a96ecb1815e68f1b26f777faa98b95fcd91905ee8a26efe62a4069080eec24a82eaf22f2256cb4a2d714309e0bc69f580e20d8ddabcd67a3c859531c9b9190b23068e4729d5647c2b959084ae976c9bf284d0b9299e638c3afa5cf3b97c03a78cc9bde27ea1107513fd7b9cbe085726a06fa301cc63a3aa30ba962fc63ff00199899500f20d59f0f2b0eb5e8948497f74348cf899824bcee19c2e60b6f75e0b9733e19574f011d5480ff2eb0fa5501246fe2d55db83767397037988b9c1d530588e2e61153cf919e80167a869a24c060d7ed868c0e8ef88b5ce815ce6bd441012365f0db6a48177cc7e908dce11790ca3a599ecd4516ba4fffe8df82d88b332b281025ca9f11b12b8f47f40b7efc272b711140141fbef0ee49f9abf12e7f1d3df516b649f7af5641f2320b57450ec1b73c574ea025402e7df26d60b4cf9e9a6ed1496cd06e0b5dc39e45b42698cf6fbc76f4957c7d03eee50275ee53a78b8bb5e52b914450a0fc61343f6aad71f115a872295c4b1345b58b83df239fa7313cd4ca5b3db3ed6042bf8306e7c76fbdad5b10305f03878cfc7c1e5340465283984f1744be9a3454f101709f7e5a60d74af3161af50345502c6011ebb5dc7be7487098179d7281ea07dd9e1e9baf1f528e0810ca02688761", + "aes-128-ofb": "0304a8ae497c46305a87df178b39538ba663b35f244b9d3b3c0ff196bdd8c205c0e805a07ab677ce669f38a6a14a377752d405506fdfb2419251adf9a707a0749f3732bdd728b571c9242a91f803b6cba0acb2c76b23a382c7093724b71a3911aa37544db5222290442ab987aadc556f63f00de8745895ea878a0aff3c6e8c794ecafcc9b300882cbc3c7cac954fae148cb674f3aaf188406fcf93f80467a6a1bcaf0209593ab0b8c059a070b84eadd4ecd98e685f67ee8b6261b09d66967d2adfceed3902c79b10d16bece5b6fb3eae5056dbb92dab53118df93cd9fdd4283be1ebfd0de2c82d007df22829345079746f6b6703ada45addbb03e4c307b8118e182db42fb4c6aea093c55156c9dfb3075d41f85c7ef1bc74c4b51df338474aba66fed1daa14cfa1b37d3a2d6dedc7ca3db308582d0eaf32022a1e098a734674864657460e20d621615b4910fbab0c7bda8176d1dcf8611dc33311a521518e8d99b51d8201bbd4db2a90b4aa6a1be9e1f9ca7a04a3a7e0f7ea1c035a232f4c9d2b901463970b109418a93f2ea49e3269c3285fd189e85349b1a4fc81cfe132b108648ef56322cbd688890495e0b9378cbe398e067775901dd4ce8bf8e198ac026fe53f1ad61a7064744442592f79d2ba90d05c9ed1f2a1fdce114aaac77765617f3a5e941e2b23ede3924c79d503079215d36f1ac087dafe6773b7898fcf3f0d2d4c18798dc265d400088497298a64d8ce41c3f603f1c0626bc6fd57f2128af3ef0e51f8bd707396408730071c6df8c9d547dd2c63be712", + "aes-192-ofb": "35f1e120808e87537835e1cce77e6573ca589636935296ac5e65ca5ef0dbb3a14367483e97709739e42a1a14cdc8c8fc65117bb7eb71fd989379a6ec55ce1913ef13e23f64cda6fe196ac5e83fad4ed03870b7b5db8dd9c024436592eb2efedf6172de8ad06ca7d96ecceb53ea52c57ebaa92136c12bd29962979d8b6bc21c32e4c5ba19bf2f48a3dbe23621ef29afc241d0ff9cce3b771f492f704ef842fa28fc50b54b2560a81b9b1370a947925195ccc9a165184ca9c680c7e66ca42df1a82a5bd74bf7d641603165dcbcf3f59ee8e21e258b6c784d77e27a28d2142dbcfddd155bfe0737827efa9bd3c10868088c678ec7c6d7657066052b8b23fb62f1c53433f15a099f9b8c05e6b424ceb0ce03eb77d629aa83624656145f533ef590e48ce1004a6d93d51b7fb17825b9d4afcb37788eecff4194d2aa2967f69e0ba905dc87f70e4803a1f2360f3df6a0234f77834e941d32b04e2938ffcb67bb29c1df50a9d89b1b95837007910d75b9e0facb4f06d1719f922c934ef8d3a11eaa7ba3d9dbd38355afa37df01a58b7e8c8c5d6791d2c1c1689aac2c52d753e6524422e80497f621279f536aca7b9565217ce5b7a0acc8c67cf68be052b7ea491c1a83ac12d592692248e7845d4bebc8cd9cf93e7e251d26ec61ae683dcd7014ac852ef4c0a180e1639f7ffe0a730950ca672cfe5ecf3d874a0deb62d19cc6f2d40539e1ce12ce45999bcb1067f77df7cbdbf99766138d04007471f22f41d5d0f8b779726d9459fd0a874b9c48c0829671211177e2714632499cd", + "aes-256-ofb": "831ec789aecaa6fd45e28074bea498ffd18388fa47fa74443b375df6b84ae7893e68769ea5f345a1f2607ae0e107580a7ad9845baa4d58f2c88ba8c2d704c66c33e6ba13979d4131b0ae2700a379d3f8d1c58c485ab3198a5946374fcff536d3a4c8f84207609c3e7dd4f0feec180dcc34e1c4691f52dba052800f64dc30c2263c57487cbe2233ea09f3c52668e3eef132113655c5a27eab3a7a93916cf8f430066fe3f2fd206dc8475868994deec10497023cc2b91411325447ccaf676df858a8b25c0384ee75579546bdac462a80f953129be4cf211cd330c5c22cf583aed1ea50cb3c184f406e93441960ffca1edcabb1c2767a0cec7ff5cb6dcde2dddc9c0f7a7ed86b2864e92f5e840b92d723dddee70e6511bd97683202fa3b1552ad0ae1cced3f914d925d5219df2bdb1490389f4a66dacddb4d7c9aa0a12918ad39637c4e6dd2f9359592495468937531e2cda8e1e6c6be70d7c071573c8d84c5830dcec4682e19401eaac560e0f9d9d1c7b2647be56a6a824fac9fa95ca50517b64d199c4ce5bafa960113d4bceaa4ae7c1281869a58ecd3f3f66aa5b1d69d5d41e0ea7b059337e9e44c6e4995253218eafcbff7f3e6132aee870611eb0fe2b8110d46792ca846894f5367c549627eccf46b35e642f7afd9fe45e9855c8ccdd509b34d8dc2d8b5384b9fe96432d4e5ba73ec5406b3a83d09bea8597f3454f5931ff1d19080ab6088989e26cceca8e210f7307502a7c8dce669a5529381e423a37da3af07fcb031f4a00629121a8acf9116d1bb017fd214e596", + "aes-128-ctr": "0304a8ae497c46305a87df178b39538b09256d77a2ab6ce7b73a1a9336c9eaf03f7c70d3528161c3ce37f321cdd41f9622f56b49ac805f8d9421544ff33d25813308932adbdb4bdd94fa466600fc494f4c13e09427e8fedbe26b68f60234ab6abafd384ed3de1e05a8f95775b6016d35d7787130313917cac6de8ddac5ec58fc5d42cd51499c6805bc3a7156d4afa998e9e48c4b40f00920d3a75fef6d6dc2750f400c27de06316e2de7b6e97d2e5bfc0f523a6b5d77504f547a7ed82947e0a490336d8256801eb71fac82bc57a6fa709fa5c3070ce5f4be2e8a0367ce65e4c870fea15793d80a28617e013ecb38140a37e6c753b63594ad4c4c8aaffc90aa407cf887fcb67884fbe3f3cc331b9dfef69fb8a93b55544981cfd5574a9d52dd4108d70c518953705a87f812efd3eea777a280f201828c70b5539ddee60d116d01f647db51c61822b2b37c4fc0a0439ba594cdd409272f01d3b33cd38156560924368b0c3c9b5bfc752f9ade31c36c929ee534b68cbc56bb795b2ff9117917eba5976d0feed466d2daf03d9d3ecd7c862b27a5ed0e74cf58696fc29c7d148b5956770b37c0922fb2d45a6fb3d6131bf8f6694d25f6bc0d6f743a5e196da77ccd66d3b2fc140c38ad05a207a8f3c8345949bc39c488fe0b812809f66750a030492d5797f3dde8c6e1b781c3651f880e4b8351a0d4bf3f88e296d687e5f2875681cf5636b691317cb77c3ca14b3485f3ee8707f724d92951ca83fdcc15d778055273d0e69fe5692a17adbe74878607e7b263e2b5a2ce92e264", + "aes-192-ctr": "35f1e120808e87537835e1cce77e657378c5b5b41bfaf9cb2ca1bb7e3af77dc34c145f5cae8038baca491a3b679c8d842f1db36b9acd457b7add1641948406a04f6002008c123829b3768fab2ae2699d717c43ac5bdf751585520835639a38f41f7e63c9de078a8e0f7459c18a7186154a6150a766dd4d94cb96505a62529d23d0ab69529c59496b8192175c69974c9902f48fc9837209541c7a41e74120ab55f53278db8f2d70473472af150a078e0ee39bf5b3f24d2e403984243ccf308ed2a4c542adb5d4d280a2b39680c53775bebdb47fc78fa4363d8c5d6ef329c3da20923ba8ff5ba34a5ee381549a6ccc1b93b5ce03c54212739ae6bf4ad488b696bed5390fbc12f8f4a3338da43f6b830c5452e106aa0821d679e261cc7cd47a20f55248f487e46c6d9148f647b6f23a3903f7694022bfccab9d5bdd8f6ceb12f712b33a0eb14249a49b8aa5ce8e8834720d53b07041edf7cc359317e27466dd60cb27f82472135f49b6f6fa9544d697d33b5b99d984390d2806d40e027ffa9c21774894d6fcd830c6c27aa4b1ba5b18da02ae3f10a4e85d9f5c5faf424c5dce2c1171ee43e14e3fc3863a7389d025abf38668537a1c8e449857a8bb230c48d6b5e5c82977af6e3f43d0f6564baef012e577f40394ccb4d6a64a63fc119cb7b26764e706aa4c5f5254343b17a1a8eb1fe7ad836f6b953cd9a8f840210bdbe9883d07ccf585b7ae55760cd075b7cd92c34430924590cff4215c5446c8f321d360123ea5ac07d73cf9a2f43338ff7ae0b7016f719f73f1f7aaa2", + "aes-256-ctr": "831ec789aecaa6fd45e28074bea498ffb909b2072fbfdd7985423e2d70c395a4224e7bcc3745f25c4bc4829bc8ec677c218deb67517c9d089abed424a9da9fe67c61ef8b2502b95b4e74b99f73eded3e7601edd78e37092520ffefcc7d365bbfb3c2e03a0b846453242f26a420800ca22e7712afeff63782578bc053b17305e8dbc4eb2374f53bab365b25f24f7d147179a10b04cae992bd55304f449e91b131351ffd46007c3d94292ff94b3a4f6e254f7ea202fe15353ad4af36a7c8ef873332733435e847a8c95405fb80da8e63b6552de521c63e00eb090931f5661f28a487de228d0592bfe1143e8991bcfcdb7b034dc49cc2dc66246ffcbb856fda52ab503f94f203509166052f754f86d973c423a2abd473277ac29cef18d9f537d3963a5f902e9c52b20ffba55a2fe5f646640abf17a04e41501d463cb2e94c19637c31c0240a0f6db14315705941ecd4963b2ce027799fb182031a92098dc3796969e56f4e711edf9a36e92c953c81a0183a5bc8d169a02788216c27518c6acfa2a680d8ddd72babb1231cb7e55216f49d66cea99f93202fdf4e3690ac4e3bcd0d41076beced8f0ea27111ad934d93ec29b4fdeb432d4b312271d615630842188a745e62302f40add725fef8c2cc2df9cef7b55e60cc9ec8db7ee379958741c5e03c854369e5907e1e2cb01c30e3e815d703ee9122508d313007328381b986a0b97fc4e1a57f3c54a1055a9ba8328e5a8a4c90326e9c90b0f4ae83578b45357260de29b8ad02bb69042b0205d8bb1bd38bbcbdc4920e88d250", + "aes-128-gcm": "5b40dbf68e41f9ad5f866d091add301b568f36d2f8af4255d006226e1a1fb11c753aa8b598552211f893f0ebb689bf3f90529f03ad708ba50c4a8bde434358cfcb31f0cd3e6d420309f02b75d5e9c428eac5dda9301b64fdc2fcbe7aee0bc6ccc004a38695e321c0cf1a349d7c3778b146a14ea414486b2cd8e484d85ff368a49bd353b07eef54843501c5da15d903430e9832809f605a6f4f746f3152f247352eb4eedd64da7f4d92db15c064b2c7f8934e1aef2650f8a88af205fd9504e2c331a042eab4ff3e6652b0011eb5d3841a6426cfdc788fd496591eda050231b3523da964cce1471acc5df1ffd41c8f7a25849b25e15b61575aa146e8de8df7c63df91d565f93cbdc3a377e387ca29a6ce391dd75dc425e0f17d30dd5183cf3224ae3571aaacccea4339081163f98016949abd78dd7a963fc61a1ea78aeaa710c0982edf6dc090614fd0ff76581a97be1da96bf8f24b43504b0b1e8e0a1dc77d67edd6b2522d95ddafb5b2bcd6082670a1f236cc7cf3c0f75f51db0ff63c1ea2eaee822f2385fdcd867feeea1ffa032b147489b9098e58d84254935e28cf698b0b34ea5bfb5a5e7592efdbf1aeb904a729b1785adc3af79493168a548fb03dd1f9fe0cc48b3ac7f6d29383a293912a7085232aa6d151c3e3d030f58f349f3f0ffa68d1bc38fb35c4eca8b8978dbfe4c042ef937edcf91461421bcff260b54e1cb5036447f0613cd37d1d4ccd67bbfec6cbb46ebf2457d782418c0d3b79730456b9a73fa755e98af038887c83e75b6009316cc4aaa404a055d", + "aes-192-gcm": "9dfc5fc3fe3d57a282e6b29ab01563cf220c2fd944625a6bdf0c99f6fc4321cc7b41fb526e039cee334077cb54622b088bae12f4e7ad1b7780efc2b3ebcb31414cefcf2a1af75758ef013c6cfb2d3449afe85171e66399b45317fece10f15a92a9bd5c9aee943150de761c7ada89e69a0e88cef44b93b5282d982571d7a71d10192364a2b341b3eda6b202b2c24eff456138899c49e8c7f31354d2991bb99024957af80678bb48d9caeaea47cb2730fa2d4c35734700fb31d40a4ab7b89668bfa877e914ebdea7794f15d117f923d22cdd8857bd66af2cdeab4c5a0e13568447453294d662894e6c729b49d6f94cab61af5086caa1e431c8e4842b3a45ef45dacd2391efda0556d77bb9a3a960e868c71dfdfb7f68cfde0a78bba78892db493b01862d8728cd3c7b7700d587295e7a4962d957b0c98aa540d554a3ee732cd50d7822ba709d6010dd36db57fbf140d85cfb41c314dd82163281ba96adb9076752861b5f21de88f4c09d16c2984aa3d9c261a08e8204765d2a4e80778968b9ea73cb61c6892d30a0153104518ebe76dc56da00cc610237aa12ad9a107747bad581d3cf8f910eaee5e849d1ba042c10e318fcbd88e074a9184b969b2e24e0367c25089c31b11b65a814f8d3096317466a70d9235dd7e5816db162f5399c295c9b77e7cc055160837fb861b06b454c4f8250bb7e5a916c6b61f16ce5f81b280e5b7728651034319a22eaec71649dd1689f51ea22b0280f196976f297bfe6cac78067a6146e4fde4864a6cae3cf93ad6f7f9362829d5ef938bb", + "aes-256-gcm": "743610df0ee25bc4fad4ff3786491472d0bb1f2440f5b213ee3b161d238edb1f83ff7302b3a24a7b60aab549ca17b7015372886b7047cbc559a12b7a752ed7269579440a0d9f426e03f7c06a4b8877a190bdc0a89379ebf8a0dde7b3f05d0e2c1f03ce40507a522458b9a8a4a8f3bea206d66e68ce2e09316018ad81de8971cc56e0e5d76842406bc31bd8c7e599c48d14d80508192b1a916c575c4591da778f09d4066cb4d0c760e1959040cdc57b9e144ced2ebc0407b69eade13c31fcfb7fe80b55c3a86bd0212e71d3d3fae3f460de5b5bbea32901c4f75f9b536bfb3fc2f0911da1ec4a9ed0c3daa1910844d95892b61364cea8b195e3f41694f9cdea26d36fc227593e3c0d4854edbd1a9d84ba13c34df6d08dfeaa18b923d5a2cd67308c480302a67e0eb19e97d99196f5db45c4f23e3535b80f690eb130dbdcd23f5d535ef86851c9555c17907ac8e6ecf3df141da63da48d2d17834aa90476948ab3766f1b82bdc1b677e06583f2f73f19e7a51658bc7335d2831064eca3bbc66b09762159d2c9991a694a4cb6a83331c02ccd0739e9feb45599a80a7b20c6af886f4966956c9bbb7add23a55da205380fdca26f21f2b68537d3f643e12d720359c83ba39e6f8056dea5e2dbd64f4ec530da74d5ffcdbba2ded72cf918462086b96370651bb72554c79b5b6fbc130fc5b166b1a76821596fc3d3ac2f300322aa3064ddefcad7e57ca44a832e15fab6081b9cd570fd74376b0b312ace848db26ae88576c5f987f76146da0716d7a4502b0bf7a63c59621cbf9c", + "aes-128-cfb8": "03616c5f554e6d1dab4b35f4f9ba541506251dfe18acf6f8325577b1b42d95835a58cde2d7832842c4c0e1bbe072ae0cd36e013907aec89cdb6e878ada05a9f110dd2ba88130920723002fa7ce016ebc9e3ba9dd9bc2726cc84d825aba105e1ec1ee3761745c77ee3bae8a46c2d9b9e91a36f59fb9b1c685c4958556400da1ce6d91160a333f01183cf669e6f79dadcf12044687bd0c805be39cff1e9b25dbd5a39971a22abe957eb6bd142f57ca521263233e925644fefbc1b567787c771c96fddf4f2a310cb9999bbcde9dd245e20e20199a426152b69c48921ae4f7335c16e01c19b2009e54545ede8c5aaa1fc6083d0d71ed6747eab8deb97322ce01319d3a3791f918c625e20e410d9fb8b4ebe709ddda6ac9bf3eade3cff2c1908ba8f128139aba436d7504bdbf2640ba7c664280afa43abf468b019c9471f3210cc6e8ff7b3c265c347cc94414855d4ff19d09cb7472e1551e3968aa57e4058d9f5c4ca8c70e761cbca49e9df0aa008fd88631721f10360eed603322ac5ad66091c33cceac35c99cb6838613d3d05030f1b150d14fe7161fd370adf210c2c25bb00de354cba0ec9f3827c20e0d3fffeca618d6400c7aa7dbcf17b2d1343e2eab48a3e7eb764bb054821c6869596046fa2affbc57c6def18e1734040a3068536a8e373494e63d41697606d7234575ae894de34231b1d056b2825fe56e350dbaf4ea605ee8213eb0e5bf846aa7fceda6ac05289adcdfb150d4c54729706359671bc684cd3451912c30c109c948d05dbb404cb7a92a54094586d764", + "aes-192-cfb8": "35f18cf0a3c354134e392bfb21c454eb1e465d62e3b47f6f4362008e95e46c1082da73c3653152be05d3a96ec0e43c878b094aaa6c5a93b01ec4fafa27cf87bcce3cc14dbcb0b21a4e0b9cc8fe06b302f167c40ea0a4ec4a4583d2d23710c974609ea71084ad3554ae61e4a8a9f8d3493c41b7941d43d1db9d857555051229711ecfd398b1b9e208abd7d8ab9bcb25f3bb0615f8144da6a2f0700c2f448e811c4873a2cd7fb3b54f068a8696152758ab7f7dd3bfaef3d1b06b560667d9ca758a47cb490658f78b81a9b868103d0c01149c094e4d8a4fcd5acb9256936b9fe63f604599d77fb5e6dfe67dd22f34425acbc002932cdc2fb34749f19226d4f89d75c4972c0274f276d45d979be8337dc758de3b6c57be780420e92af73d1ad595185bfc533d62b9147735d69295b2cd750a348195102c1dff4368f586eab8a1ee3a0b0edae95f85db3a0345bbd5308d0f82f653ff355e3fd3f5ba0023849725b8887473350923775d54b80b42fa804e4f35df12dc0d973cae75badce0894e0fdd233136bc3a4737b19e9d5e20771653323da5bb63c8501919054d163a0bfb6eb829ff07542d06655740b9cf3717004827b60829649db8b35fc074a2ac6000aa5a2e24a69820dce274f5d4e30fedc187b48cab691fa7e8f36f7f070419240639e82643f4549ffa682b6363b2387ff0900761ee7c7c2b86b6af2d0ffb3a541bf7447c8b5eccd3468a0fbd065dfd62afc232279300d2d2491ba784ccb8c2c2c7a72eec00345e537ac92cad953163dbd860b1f5fe666563ed79b4", + "aes-256-cfb8": "83904729f4ee79e04a931d3fd9f44b33092471a7c5818baf2910dd354a59eb218aca0d1595ae0c5f10e8648bbbe16fff6f84b0887b9291d3c688085b19ea736766b8d9fe1393fa5a234efdbe6223e6e00d460950c877726e90529a611c922bf94df399560f0528dc848332a60322ead63ef085359e325aebd71d63c80d000d72856472ff5ff1194740e47dda13e6b8c9330ed7688013a084937ecbb2dd0e942751d16951b12970d4336a2eed5bfea09a89c208bd57322c47ccee88cad39a69b2a9c5847c6f8999376c6c5b57790aca99f9e413b82aa5229a617babb57a37b750f38ac2d9f5127d97b3d2902b59e667273ec34dd9a51988e3210ce9217f2d02ceec3c5bc3e5d47ba5ff3cdd3499ddfcd348a9cfd9551d4eeaa55309ba90fb4e3c79419bf94861c70a2f2ed76d7e19258b935fc691858b6ef607e076ef4e6c6f2e82f50231a23b4fddb56640c5db8b278e6dbfb5220862b972d60bc2087867c6c9cdc2a25085a320ae4eee5829c31cb6f558a28b134e6af5839411e818e6f8ce1bf7cf66b2a3ed9cb4b435d043951158670f61ee601da6c2200a6f9ff7dea53b5ed4f0a806f14258f517073cedfa3fb581beb7a56ef4f3c466cd28f4fff7a814e92555acee0ada4475dbc8b4e246ee17aeb291e100ea5e5379fbb199e158b986dcbe375b0f2ff21a168d09760fd24f8fef08a6b591bc828c337f76568f17f11ba7dc48bf3379f84e5d6c2681bf2f60add2c3e1def3de322c88ad7e68e68ba377c899bd6099b3578f72c681198d1454eb6924fb41f069a151", + "aes-128-cfb1": "0439ff30298fdadbf67a55a110dcec5d02dcaeccf9f03538879aaf861da5b8741a1f091a1c92150722341c1a58b03036507741c1f958a3c78d9bbbd9e85ab637e6a2c678547e7f1504144099a631ca87b4f855f01d85af2475f4f86a29a3f54ad57911b4d824878f067f800954c2d8a29a7399d7ded4ddca1f86fbeecb720311dc13952266ccf92a986c1a4cbc05d9b8aa69da3b1ba3a48fbb5131cbbbeb03cf9510c624ac913c9c915bb30f58825ef0602c803dbee9b87aaa5decec5460d77c9c81395b179bcaf9b1385f15f48bcd0eb607c004e88d277062dfcce9798e1a506817edad4294580d3036196df3c39f8194590c5be26536cec83f7591422029ca9b4347114bdd96472f9aea47dac9e27577ca328c42dae07e58e23c8ad5040095ff978e14ec04cd36baccf94c99e7b363bbd2c609ec1d756b01aff0efbd92b519bafd8d83b19f91c8e4abee0a23999fac373b478059b34077bc08bf3004232134b9af64d87e152922e28157f2abb2629e328e635f6122208123a97be602e71a68a2d9385b81e66bf05cecaabeb38232ad8b0a681e541d515d08fe9228f968ac843c5cf89113bda2c6d195ff33c322dc12f4177443f5a666f5192119576bd9ef0d80675a9b678a2c36be788518c43d871516d9ec84b2bd8ca3d5cf9e4f489efb0b35c87063b2c28fc54cbc43dc6c8f6dba3f79e157fe1c94a7a8201437d9ec33be49342337f4ba20177d7dc88893ed62b2bcb5ff16aea8a9c5ce7224272108622138638f95808cc8af2181e567f9165f5eab25bcf578cc5f", + "aes-192-cfb1": "23cd583203fedc69777da0e8033ce5860fcd73b633a090f1401b42c615a280a4eaefb8ed2f62fcebd738a669b3ebb25c6a1b867c29fe2508d621686aca43bfe497c7d642976fe26693ba17911e7a4a3cc61c03f177cd67fe7fd49dbfb57aa9e07190652ce2ee745cc79f3403513b58d513b80f9653ad34863566323c8e1a6e2e1c0d42ada8dd423d516d168e7a6a958fb9f8a1248f7a05cff32e1d99986805a4ee4e822c9155a4b991c3a06e73f3c8222416f84d324e88e5fcfd1f6f0fcc5483462573e4ef80e4e3c28e412aa5c25f8ed950c18638fc1f26e2b8b71aa4d006fc8d8578979b5e87a3aed13a4e0507b37c31412871d5233c9539d5327e0fb0f4df5a77acde2071f8e1384a53b0c081d3271a6a192452219987cbce3266abcf672bc29d1ab560acf8d40053f9a47286fb0dd33d3a7491b3073afc751609bfbb8e930f113f92e5a373b85ad156829e4c2031df9278a47d5e857eed324c5827adade949628149fe2824cedbf6d221d4cb5ff303acf0334db833b8455e083b86bc215fa60f37268737af3bb28b76174353e3e80e8d2f3e03c4f8bba3ee28841540411ba2a203cb3329c937fd1130b6110b678255c07dcf1a3f5ae3817e0fea925aad7e089a2165031a383759bb4aaa447c4e0984526e28e3823c9915fae4d1a80d9c3c70f4fd145513160411616caa0e5d87e50a471a91a1c3edb7fd2a5cf586c358cf8c70766c3ea6b21abafaa438c6cd150384361fa97a39fecca9f71650c1dbec6e6a813067c8cc1b94aafc28e07cd8fb2c8cd21c0d3ee215", + "aes-256-cfb1": "feb3b856206c919dff35a5c10747c4541525eb3acfceaac5e3142abfd62aa83fd73c4b272d848b5dd29481ef806587980b7d37d2f4734804e55264fa0086c38cfa189d93aacf5f02c22b7660f813bae8ab5351ec7b43d71d7d2b21292c59e5eb59bf49e1e00d97e91dfb78ce579c25a8f5787cdeb51a8669f01f8ab8477a384131fb1294d2a7ab12aa7ff6631afa54c4c84d8c1942e46af4905d28d6c44ffd36c82bad4a0fcb8647922d5c557882c9178d97cf231d686a49871697daf44f01096f0f67f8524086d1d5092a9bdc9c626889ee596a8f14f27abb4400d426515fbcdd20e846b80cba07d3cee03aa1363f062a8b8a8bdbb12a8a49561aa221a6e81ac6cb22354e636a3385ef7bb35dac3894b91e62da576dd903029fbd4098533d341266bd7f10c9fda5c3b965a3f83dbf0053b0f3a6fc810074b92552443c06f04fb5235031a68a43ac856cf32549a447c84e370c306c2ae1a98851ead258918900f7321ab4aec78fe68b6ec2a19e3f2d71194443f227ddede56f91c1fee8db8040f99f04562edf5bb65967b223cae4423472d1a8d981e3ef9543eeb00af54eeac535f01e135d47bee122876b6f1f0aab9456360aa604dcd5732dfa946c196b60da7fcd4fed4fc0a110dd3ca7fab0ba711d4e679e59206968ecdc8e8d52af897acf1b1117052513ef4734c6dc320681472087b0d94f6b0e6eadd0b60e5e6733b28fef0d120c27cc2013c4df23b94ee2135ae688f23031c44a1893687c18afc457d1a46a56295c4dced26afd9556bae8cddede206011f3e94d" + } + }, + "aad": "fdfe32b59b3d2d2b85dfbb680babe590ec162058988561b0a869e58505df", + "authtag": { + "aes-128-gcm": "f856f31f89b1330659c23002e06d73e7", + "aes-192-gcm": "a149e211df65731305f61762107d9c1c", + "aes-256-gcm": "69bb4d3b34632ec108e0f6d41e010aa5" + } + }, + { + "text": "te\u00000xt", + "password": "pass\u00000word", + "iv": "7cea48c266460aaca3a48a5c2bc59a4a", + "results": { + "ciphers": { + "aes-128-ecb": "0263a36d5e768133ffc3c5c425ea8748", + "aes-192-ecb": "580d1d0fb8cd90ad16f999cda24d0eeb", + "aes-256-ecb": "4676a01580b9c9f4bd108fdbe49b9155", + "aes-128-cbc": "3141a23b60758eec9e6bda24cad914ae", + "aes-192-cbc": "6e5696c139c01d69773a5391310de2ff", + "aes-256-cbc": "185a9f2225cb2319e862aa7b4720fed5", + "aes128": "3141a23b60758eec9e6bda24cad914ae", + "aes192": "6e5696c139c01d69773a5391310de2ff", + "aes256": "185a9f2225cb2319e862aa7b4720fed5", + "aes-128-cfb": "5afc1eadf2fb", + "aes-192-cfb": "30a3f27b7709", + "aes-256-cfb": "9266e13911f6", + "aes-128-ofb": "5afc1eadf2fb", + "aes-192-ofb": "30a3f27b7709", + "aes-256-ofb": "9266e13911f6", + "aes-128-ctr": "5afc1eadf2fb", + "aes-192-ctr": "30a3f27b7709", + "aes-256-ctr": "9266e13911f6", + "aes-128-cfb8": "5a84723375e1", + "aes-192-cfb8": "30564296fd50", + "aes-256-cfb8": "92c85dec2d1f", + "aes-128-cfb1": "38ba0b1df443", + "aes-192-cfb1": "3077bb383628", + "aes-256-cfb1": "b40c617a96f4" + }, + "cipherivs": { + "aes-128-cbc": "c9f85747bd44921917d9266f7d7253b3", + "aes-192-cbc": "6e70ebaaff28349608f56498fd959ce5", + "aes-256-cbc": "d6a6ee4a29a679aca37d6b3e2f0be7e8", + "aes128": "c9f85747bd44921917d9266f7d7253b3", + "aes192": "6e70ebaaff28349608f56498fd959ce5", + "aes256": "d6a6ee4a29a679aca37d6b3e2f0be7e8", + "aes-128-cfb": "5b5d3c47f2ac", + "aes-192-cfb": "64809bc44b10", + "aes-256-cfb": "9205f2d6c23b", + "aes-128-ofb": "5b5d3c47f2ac", + "aes-192-ofb": "64809bc44b10", + "aes-256-ofb": "9205f2d6c23b", + "aes-128-ctr": "5b5d3c47f2ac", + "aes-192-ctr": "64809bc44b10", + "aes-256-ctr": "9205f2d6c23b", + "aes-128-gcm": "649c5507cde1", + "aes-192-gcm": "5239ea645cb6", + "aes-256-gcm": "a1702685be71", + "aes-128-cfb8": "5b31df27c3b7", + "aes-192-cfb8": "64e465c2dced", + "aes-256-cfb8": "9285862e89b9", + "aes-128-cfb1": "15450661a91b", + "aes-192-cfb1": "63667c3b3500", + "aes-256-cfb1": "a7d8bae0ee48" + } + }, + "aad": "48221a601f6da68625580fa7d56fb44f", + "authtag": { + "aes-128-gcm": "4b733a96b107050c93acdcbb4df4315a", + "aes-192-gcm": "14eed33237b36219c66cfcba504da0a5", + "aes-256-gcm": "f29edfbedf6fd640075b091c6eddd774" + } + }, + { + "text": "abcdefghijklmnop", + "password": "I am by birth a Genevese, and my family is one of the most distinguished of that republic. My ancestors had been for many years counsellors and syndics, and my father had filled several public situations with honour and reputation. He was respected by all who knew him for his integrity and indefatigable attention to public business. He passed his younger days perpetually occupied by the affairs of his country; a variety of circumstances had prevented his marrying early, nor was it until the decline of life that he became a husband and the father of a family.", + "iv": "3af6efa0dc312dd60e7858460a5fc423", + "results": { + "ciphers": { + "aes-128-ecb": "0fc3183e19f1e9a42f2f468d469be1effd4f8c6e8298586e223da88b2d13beef", + "aes-192-ecb": "84bccef9fc8b8c62d0ce7af663d2ef68bce45c975754970b7e4bb0c8154d7ffd", + "aes-256-ecb": "70c07e30fa84a8a5a3279af564e093393ca18f36827ae78a3df3f44e56db025b", + "aes-128-cbc": "69260f6a155f0aa159248533425308108cfcf3322b079495337bfba733edaaf9", + "aes-192-cbc": "421f392130c54bbefd158ebf7a2dfbdfe4e3a60bc1d6ca7938572dcb566bf138", + "aes-256-cbc": "664d1b94ece9c943085d5ea4a30cbe339838f3b675dc6b6ba5f8023738d9e144", + "aes128": "69260f6a155f0aa159248533425308108cfcf3322b079495337bfba733edaaf9", + "aes192": "421f392130c54bbefd158ebf7a2dfbdfe4e3a60bc1d6ca7938572dcb566bf138", + "aes256": "664d1b94ece9c943085d5ea4a30cbe339838f3b675dc6b6ba5f8023738d9e144", + "aes-128-cfb": "7e09b31f9ac9adea39976b33fdac6abd", + "aes-192-cfb": "4d8ded889a7b6188942c253a68b7af09", + "aes-256-cfb": "ad31744277697cdddfc361ecb2233d6d", + "aes-128-ofb": "7e09b31f9ac9adea39976b33fdac6abd", + "aes-192-ofb": "4d8ded889a7b6188942c253a68b7af09", + "aes-256-ofb": "ad31744277697cdddfc361ecb2233d6d", + "aes-128-ctr": "7e09b31f9ac9adea39976b33fdac6abd", + "aes-192-ctr": "4d8ded889a7b6188942c253a68b7af09", + "aes-256-ctr": "ad31744277697cdddfc361ecb2233d6d", + "aes-128-cfb8": "7eca20cffafad81d933d08f1e32e224a", + "aes-192-cfb8": "4df90aa3bdc7e9b3d9ac52afc4b4a988", + "aes-256-cfb8": "add3a45e8063bfafc3fc99a1dd441ee3", + "aes-128-cfb1": "3356fcab528e002612aafc4a73bfb618", + "aes-192-cfb1": "320c454611590235f725d87522cb3d6c", + "aes-256-cfb1": "d2a8bf0b59fbe17f219a6544715311eb" + }, + "cipherivs": { + "aes-128-cbc": "98e1b648e99996a2dff688b8418cd173fc2d2b809ff8659e45291ed92f7741f2", + "aes-192-cbc": "615eab15470e067b3cb1d34c1d0ac670371abd52c6d24b7114a04231d6846b63", + "aes-256-cbc": "7fce06852a9f19a946833b950d2e0f7fb89dd1889581165c350ccbe1f2360685", + "aes128": "98e1b648e99996a2dff688b8418cd173fc2d2b809ff8659e45291ed92f7741f2", + "aes192": "615eab15470e067b3cb1d34c1d0ac670371abd52c6d24b7114a04231d6846b63", + "aes256": "7fce06852a9f19a946833b950d2e0f7fb89dd1889581165c350ccbe1f2360685", + "aes-128-cfb": "34adb0e5b44d764af0808eff9745d704", + "aes-192-cfb": "957ea1bcb6d9a139d5153623813db192", + "aes-256-cfb": "7ce64552d7320552347e2d3af0830ca0", + "aes-128-ofb": "34adb0e5b44d764af0808eff9745d704", + "aes-192-ofb": "957ea1bcb6d9a139d5153623813db192", + "aes-256-ofb": "7ce64552d7320552347e2d3af0830ca0", + "aes-128-ctr": "34adb0e5b44d764af0808eff9745d704", + "aes-192-ctr": "957ea1bcb6d9a139d5153623813db192", + "aes-256-ctr": "7ce64552d7320552347e2d3af0830ca0", + "aes-128-gcm": "805adfa669bfc28f7a70cb4c182f88a4", + "aes-192-gcm": "85c67323b51b771db6e6dc6f94e071c3", + "aes-256-gcm": "60ab90ab11fc38539c4882d1ce04748b", + "aes-128-cfb8": "34930201271a5024ec10fde3d80326e3", + "aes-192-cfb8": "95f1ef34baa3fa7034606b13f1c202ee", + "aes-256-cfb8": "7cb057cdf20b800ea9c67a17a51015e7", + "aes-128-cfb1": "4d35b5511e8aff571961faa4407e8f9b", + "aes-192-cfb1": "97b3cf0ad36abe8c78d59e2c380f29a0", + "aes-256-cfb1": "567d7375364237bf9a0982678104fbc2" + } + }, + "aad": "f6bf5b6bb5ee1b", + "authtag": { + "aes-128-gcm": "a1b6a1eb59fa46b25b29be41ea2ccee8", + "aes-192-gcm": "f7151ce9217f96f6472caa08677eaa8c", + "aes-256-gcm": "94765e8761e86f826fce4202a96103a9" + } + }, + { + "text": "abcdefghijklmnopq", + "password": "(づ。◕‿‿◕。)づ", + "iv": "a55512ab58cefe5e8e30cb4aa4fb9e48", + "results": { + "ciphers": { + "aes-128-ecb": "d99f94ca395a7fd07f88e84fcd77eff9f849143bf298459fcbf0702131070d54", + "aes-192-ecb": "12417f16c49b25a35b5a120ae89cfcf80cef2be7295afe8e974e31e263055fc6", + "aes-256-ecb": "ae854bc9ecb1a89acab38b4ce2f3555af7ae4069af7ed305d665a913786f2ef5", + "aes-128-cbc": "3294feaaef04a0fa15bf2485301594fb1de6c201f936fc9308070ccf69f30fcd", + "aes-192-cbc": "555c521eb3f309be1130cb92e0601e8239bd49b20ddb868bda3c13c04ee5b082", + "aes-256-cbc": "161455bf919792f95ac914496f47784c590d42ed00e25414720ecc77fc094fe6", + "aes128": "3294feaaef04a0fa15bf2485301594fb1de6c201f936fc9308070ccf69f30fcd", + "aes192": "555c521eb3f309be1130cb92e0601e8239bd49b20ddb868bda3c13c04ee5b082", + "aes256": "161455bf919792f95ac914496f47784c590d42ed00e25414720ecc77fc094fe6", + "aes-128-cfb": "facb6cdc767f419c4ea03c256bac19979b", + "aes-192-cfb": "34aafbec0b57819744ba53b5d481a9b52a", + "aes-256-cfb": "13b4a117b97c730cd4195cd447005c6d3f", + "aes-128-ofb": "facb6cdc767f419c4ea03c256bac1997e4", + "aes-192-ofb": "34aafbec0b57819744ba53b5d481a9b5cb", + "aes-256-ofb": "13b4a117b97c730cd4195cd447005c6d48", + "aes-128-ctr": "facb6cdc767f419c4ea03c256bac1997a6", + "aes-192-ctr": "34aafbec0b57819744ba53b5d481a9b5fb", + "aes-256-ctr": "13b4a117b97c730cd4195cd447005c6df7", + "aes-128-cfb8": "fa80f881a1737bf079bf88573b8a7cbd67", + "aes-192-cfb8": "34da30743ff61880cc507c34018ad9ed5e", + "aes-256-cfb8": "138b94edac657d6d267a3146e192972ac8", + "aes-128-cfb1": "9157785456d30a23255243b187991fed86", + "aes-192-cfb1": "5da97eb59b8647c819b6aa9d7f3951bb6a", + "aes-256-cfb1": "4e7bdba3bbfb4d0a3de36879b2e714cbd4" + }, + "cipherivs": { + "aes-128-cbc": "ca7451a2b66305ea1a1793d5417b0b3c4d477abb2a42e08bbcc3ecae51cc1e1a", + "aes-192-cbc": "c3a33e105583fe7efd2302c6e79355108a9507ef487dff92a3eb18fef7dade5b", + "aes-256-cbc": "4ba2f481b6f30a74268d08ae153f39ad3dbfa4ece13ea16e8a56b0efc5df026e", + "aes128": "ca7451a2b66305ea1a1793d5417b0b3c4d477abb2a42e08bbcc3ecae51cc1e1a", + "aes192": "c3a33e105583fe7efd2302c6e79355108a9507ef487dff92a3eb18fef7dade5b", + "aes256": "4ba2f481b6f30a74268d08ae153f39ad3dbfa4ece13ea16e8a56b0efc5df026e", + "aes-128-cfb": "7af8f9e6715c1a95f27021ca5e43fe7e96", + "aes-192-cfb": "4c3a98af7e03e16563c1636a26d3508eda", + "aes-256-cfb": "6892cdc900665063523fb9b4940b2c111a", + "aes-128-ofb": "7af8f9e6715c1a95f27021ca5e43fe7e48", + "aes-192-ofb": "4c3a98af7e03e16563c1636a26d3508e41", + "aes-256-ofb": "6892cdc900665063523fb9b4940b2c11b0", + "aes-128-ctr": "7af8f9e6715c1a95f27021ca5e43fe7e05", + "aes-192-ctr": "4c3a98af7e03e16563c1636a26d3508e46", + "aes-256-ctr": "6892cdc900665063523fb9b4940b2c11e6", + "aes-128-gcm": "5b37aa3bb8fcba7dd9d8f3525d06455d5c", + "aes-192-gcm": "5a184c0d697e3147ce5dea377670b38f4d", + "aes-256-gcm": "d13327c3a244fb8a2f349f1505811adfa8", + "aes-128-cfb8": "7a69b6bc89e77d3dab2f3540843bd38110", + "aes-192-cfb8": "4c7632497d75f833b5f5e3a488f575ccb8", + "aes-256-cfb8": "685c731c42ebc72bd7f383800d669b3925", + "aes-128-cfb1": "4949e647f5e8771bc6c5b1d6819a870d3c", + "aes-192-cfb1": "5adc60d434310dc056f4ed3be5ce833126", + "aes-256-cfb1": "7ae6cb7a0d6b809c74c51d64d9e27a73e2" + } + }, + "aad": "950d79f5d8481ba511069b6444cb4f85faebe54c84a3dd89b0b1aa9e78ca0a7824309d423af773893084482db47ee132ade0981ca1e3a46868ada087fab5f60d87", + "authtag": { + "aes-128-gcm": "2fc30ffae7130b2d90d9ae83c5e1c50b", + "aes-192-gcm": "c33b5960ba9a6d0078f3fa52089d88eb", + "aes-256-gcm": "fbc18b1cdb10be8eb28bf4d4a76b1991" + } + }, + { + "text": "abcdefghijklmno", + "password": "Ѱζ༼ᴼل͜ᴼ༽ᶘѰ", + "iv": "9d5c638078f9b110d03d9fc5f082eaae", + "results": { + "ciphers": { + "aes-128-ecb": "9454756f6b6405bd675ca68e1b428bc6", + "aes-192-ecb": "b0e46cff0b4f9879c2076306db07799b", + "aes-256-ecb": "99daedaf9bcca861e35253316be4ab57", + "aes-128-cbc": "aa1822f4394c2121014d77544682395c", + "aes-192-cbc": "7d937c3182ce33b51f9f7d34482042de", + "aes-256-cbc": "8f25a9f28db8f672adc91354652306cc", + "aes128": "aa1822f4394c2121014d77544682395c", + "aes192": "7d937c3182ce33b51f9f7d34482042de", + "aes256": "8f25a9f28db8f672adc91354652306cc", + "aes-128-cfb": "e51979ccd953c85c1c62cd3e064197", + "aes-192-cfb": "4e7906adbde09e88c2ea4ee5e6e645", + "aes-256-cfb": "f39fb153dead5bac4926ac4c1f69a9", + "aes-128-ofb": "e51979ccd953c85c1c62cd3e064197", + "aes-192-ofb": "4e7906adbde09e88c2ea4ee5e6e645", + "aes-256-ofb": "f39fb153dead5bac4926ac4c1f69a9", + "aes-128-ctr": "e51979ccd953c85c1c62cd3e064197", + "aes-192-ctr": "4e7906adbde09e88c2ea4ee5e6e645", + "aes-256-ctr": "f39fb153dead5bac4926ac4c1f69a9", + "aes-128-cfb8": "e5347feb965aa39a0d874c99d8a726", + "aes-192-cfb8": "4efc39d2fe06a67c3f372f9b8dc350", + "aes-256-cfb8": "f33c26fc8d5a0882f45d5fa0e0f63c", + "aes-128-cfb1": "b12776b80a76d8e64d7b12b8118afc", + "aes-192-cfb1": "309d627009c68fef00b759aa4e00f0", + "aes-256-cfb1": "9e85b8b520ecbb86fd57ed42c1d746" + }, + "cipherivs": { + "aes-128-cbc": "af45c639b04747b2eaf310b52c51dfeb", + "aes-192-cbc": "c767360bcd75d774a4b89719fc2589b5", + "aes-256-cbc": "8bfb71ae015f795c20c41d403b2ba973", + "aes128": "af45c639b04747b2eaf310b52c51dfeb", + "aes192": "c767360bcd75d774a4b89719fc2589b5", + "aes256": "8bfb71ae015f795c20c41d403b2ba973", + "aes-128-cfb": "a0f218d4ca8260b99c321ce17cee51", + "aes-192-cfb": "59206a4c437279d2bb397f55d23236", + "aes-256-cfb": "24fcfa77fd9ab62df106f9ad36d62b", + "aes-128-ofb": "a0f218d4ca8260b99c321ce17cee51", + "aes-192-ofb": "59206a4c437279d2bb397f55d23236", + "aes-256-ofb": "24fcfa77fd9ab62df106f9ad36d62b", + "aes-128-ctr": "a0f218d4ca8260b99c321ce17cee51", + "aes-192-ctr": "59206a4c437279d2bb397f55d23236", + "aes-256-ctr": "24fcfa77fd9ab62df106f9ad36d62b", + "aes-128-gcm": "b3298f7197b41a83d50b3dc95b9eb7", + "aes-192-gcm": "6137327d7d1d90df5118547f234741", + "aes-256-gcm": "e18b9b20b654f0430ed291cd0374be", + "aes-128-cfb8": "a06dc7aac4501ac73ec6a3924b8764", + "aes-192-cfb8": "596ce6982e4bd49ec6566c593a791d", + "aes-256-cfb8": "247d8b1932ec6e8714a8a3a77b7396", + "aes-128-cfb1": "c2caf14db9b96e64ff9f48515c2aa8", + "aes-192-cfb1": "4a6c8428e61ac496b26c5ad0deb89c", + "aes-256-cfb1": "3f3492cb1b18c962ea94da3bc5cf53" + } + }, + "aad": "25f5dec376996cd7bea422bb", + "authtag": { + "aes-128-gcm": "9b39a1c53e5ec8b327a353375bd2daf6", + "aes-192-gcm": "f073f0a06ca07c0409ed09b43abe77a6", + "aes-256-gcm": "acd7ced603ce6be2ff7020587dbad6cb" + } + }, + { + "text": "Chapter 24\n\nMy present situation was one in which all voluntary thought was\nswallowed up and lost. I was hurried away by fury; revenge alone\nendowed me with strength and composure; it moulded my feelings and\nallowed me to be calculating and calm at periods when otherwise\ndelirium or death would have been my portion.\n\nMy first resolution was to quit Geneva forever; my country, which, when\nI was happy and beloved, was dear to me, now, in my adversity, became\nhateful. I provided myself with a sum of money, together with a few\njewels which had belonged to my mother, and departed. And now my\nwanderings began which are to cease but with life. I have traversed a\nvast portion of the earth and have endured all the hardships which\ntravellers in deserts and barbarous countries are wont to meet. How I\nhave lived I hardly know; many times have I stretched my failing limbs\nupon the sandy plain and prayed for death. But revenge kept me alive;\nI dared not die and leave my adversary in being.\n\nWhen I quitted Geneva my first labour was to gain some clue by which I\nmight trace the steps of my fiendish enemy. But my plan was unsettled,\nand I wandered many hours round the confines of the town, uncertain\nwhat path I should pursue. As night approached I found myself at the\nentrance of the cemetery where William, Elizabeth, and my father\nreposed. I entered it and approached the tomb which marked their\ngraves. Everything was silent except the leaves of the trees, which\nwere gently agitated by the wind; the night was nearly dark, and the\nscene would have been solemn and affecting even to an uninterested\nobserver. The spirits of the departed seemed to flit around and to\ncast a shadow, which was felt but not seen, around the head of the\nmourner.\n\nThe deep grief which this scene had at first excited quickly gave way\nto rage and despair. They were dead, and I lived; their murderer also\nlived, and to destroy him I must drag out my weary existence. I knelt\non the grass and kissed the earth and with quivering lips exclaimed,\n\"By the sacred earth on which I kneel, by the shades that wander near\nme, by the deep and eternal grief that I feel, I swear; and by thee, O\nNight, and the spirits that preside over thee, to pursue the daemon who\ncaused this misery, until he or I shall perish in mortal conflict. For\nthis purpose I will preserve my life; to execute this dear revenge will\nI again behold the sun and tread the green herbage of earth, which\notherwise should vanish from my eyes forever. And I call on you,\nspirits of the dead, and on you, wandering ministers of vengeance, to\naid and conduct me in my work. Let the cursed and hellish monster\ndrink deep of agony; let him feel the despair that now torments me.\" I\nhad begun my adjuration with solemnity and an awe which almost assured\nme that the shades of my murdered friends heard and approved my\ndevotion, but the furies possessed me as I concluded, and rage choked\nmy utterance.", + "password": "correcthorsebatterystaple", + "iv": "fffffffffffffffffffffffffffffffa", + "results": { + "ciphers": { + "aes-128-ecb": "3a26d4ef5bbd252db047a44b069b0825bc07bc991df37d46727851c0150eda57592b6f989b703a59021088bdfd2d151de8bccacb5cc5f253d80778d793d28bc0a8fea24c25cce635e048ef3b15375e0b0c3a36efef025ad8e8171cc22093781e79a16cc072ed66e29eac9dbb4349585fd8f5ac2eeebd9942ac56d40167100e609e704aeca20b8626a33a4db770d580bde2723bca489acd0a6c36df86d4bd00b93001861b7e23483d52a9bb8d96c04798fa7aeba42a791d94183727a43bc8f2a82378d32f527dd5c198c3425bba5453acf558fc8af29c34fb8b48bd27dfb1caf0542569793147c381dd79be409dd5be9cb3488837b7895b2b17fde4df09e83c9df52abbca26898ad6776d43276e9a9ac6bf7c8a3cc8cceef0e04647fab1d0b378b94af4422771f2de97a900e718497eb2da303a789f480e37631b3eff54acd7b0f49039fdeb130ce925e6ba7bed4be2cc7bf71e990702e5e65c95617170f1aa7bbfa623afe5fd29e2766ea97568dec9c930400dcd2d861301b1a77c7d8c05dd943a7dcedd2199c30b3c45550b6bbcc8fa92220b9f5bef5119388a2f44456a710555ab15402347447350776fb1eb3b142ec971920357100631dbf901b853959424486671c78fac5e0a2efaff1e3db6eb73e285ebabd3a6d744a6faa7ddaaeab3f9b88f2b6c77641f3fa7f93c68174bd1fabea11884e900e83230e394a37966010c5df1118251f48d8772ad926f6708500f7bf1b945ecdd5904c818c3bd8ae24c344926fe968a58b01954f5242f2a47855a3cd70f4a85ddbc0088355ef426c9a5b2adaf13d38aa1dfb9fb76d6b390d0c4bb72130e5b5f2a37b66815efce751b19c076bf8747dc368746bfb3af84c287d3eb4c8927ffac8b5934744f1f834e9ad9d553a6cb4a1b36017cb692d2055081150a8df16c60543831b8a7ee6cbc14511936c92bf2ce4bc88aa673bf61c96456b936ceef82692b1b68eefe02feeefd2a8bb707272cbe780e41107c4aa6c8efad95e110efdbfddbe9be6005d28dcec8b9f1093376d5fa554d1f37c13cac2fefd853e7454d91d9a8a7eda7abc65fcc1857cbd4659134b9bbe1ed0de655eb530158d1de5d2d5c85ee7366898333c00d398c3a7eda1e93da584258c03c8c48292914e92f695191cbcbaba14bdd1633b3bbed1854565bb56393f3667067aa3972e46a8791b4d37917cd1170940a8990387b5cb12559775a166ce9f76d520ddbd657bb97d844098864e63d76438be488d255804cc999a1aa1ec2eee5009a9f752f157a16c9385c55eec55a09c418be72881bd77b9a86f902b9cbfe4ec702425a69c71a1ef58416a6aff6d0f3f342fddd93cf290b9d7fe2122c6bd0750e247cc4340f4409b1320dbd710d6f1d4d1bf6c6dd10d8d5f6291bfa7ad0a67527c3a0b78005790dd0d221fc38b8bed1ed43daebb9dab3278cb1008356ecad6758dde5cdb3697a8cc3391045c931ddedeec566f57d876ed43b7a90d00f7ceda9573dd63dd239e014469bd323063ae0e57ac832e31fc2bbec52435ad19b8df90bf5a7aa6c9253757feafd4af6122b1d3f9335bdcbd5910bd6d357c771f718b12e8068dc4a99a4dded17ded7fce914e9507f43e7d61595ce7d40846df5ec597d3d5534fd101356b34aed0fbfbc09dc2f41e6c1d307b39af2271838801d5be23c1bb39476ff4d245acc554bc52285ccc165adc83ddb197fbfefd8f14223ea7532692910ab0b6a5db6e26cb4dbd0bc66730b6f1a39c0867ad7a33d10b139babf70f3c2646ea67c03c4f276d34b963bdbb51922c901cabe07e8ef2f2c5390c204c5752ef41ab1ace7099744e697803095336535f8b32e710965c6d6e5210a1a5bc02c21d43788e0e87bfc198fccd9a2e1b9cf817ce62ee4dd2a84529d0a5d351052aae12d9f7eb16851bbe028282d8c5da8560bbbb55a561bf2b53ce863cadf6a61d923d04f846390818fdeeba33d1436a850ca5191d0ecbaae5010733f6775bc306e9c94f27de2e7dc48c8b52ae91e52ad6c67e0d3aa314bfbcfc9d399716b91438f6f93c21665e4b9b81699e25f558cb31fcf7eb9c39a89da6ba31c1eb2d315b1acfbdeacc8d26518e3a2a26cac26bd66b80e849ecc42742c12a783113810a8566c3085061ebafc72357cc15432fa234bc30db0280ef896de0147e8aed97f20c8f9e74cc45222d302b71e3ba05c3271d86be8106b24b0fc5cb5ca7b86efab97f9cc8699a893d7d0a745a01ede3b74b03cbc64486cff44c8d614cb9b12fca16cbdcfe171a018b3c4441f2346a9f3564bb60a1c358fa99d29def7320395fd6bac23ac1d88147bcf52a0aa7f8527a70c8ecef788211c62a99c5212421a863f4d3360c57c39460cbf21dc9a92cec3865561267790bce1f4b8df36fe7e1c8b9e6a247aaf6e9aeff14cd717fe1ca80548c84d0c1c4dd6b1cc5a1c45849ab43f7d2910c7a643e85a3200cc5ebffd7314900b602983a4e6a48c0e60a47560dfa38bd7c190bd0b7bf9329c404ca46a70581185a963e2d9c2da15238def62fd8d65acb65be20ee5ba394c23d4ef97059af505f53582d92aa5e7f2a185531cb4e0c8b1baaa8677ba51c305252d050567943f5d8563d4103753d0fb1f268efcbe6d6779c4eb3ccb1e588948e770ef013df0e0840c459545d18ad4de68aef82a71f9a2fe4710ede4eb261c6a88858b60c92e375c6ad27ac98d6caecfcdac8581bfd6f9467be89fabb5cb689d5e97c5aec17e47306d4809bf2f834272c13c22158ac9bffea298d31a16a18d92c92e1b53bd91d29ed7a2def7f686051391229b196e5ad182efded9287338b7f48f4acd3d538dd490c93d976ce16030cbae0f0d8e8fd2615ba10ad9a33f7fd5206bdb8e51c5e6d8a73d33a4821cbcb5728dccd6e0e5965f17772eda839228ff01f1cd1f78336bc8e1f87bd476054f1164285ad47f13e691b89d97eef84fe31bd3097cbafbbfd772d63afbb0e732cc0f905500b1819e3e8baf9b3383cc1545ce44d183c2b2960bb422c48dfad74c7c3d1278a397d44dc5732a6a41f76f3eddd122251cf48875316da8a70c210aefad241f7453e1f4f1c5f1f45939fa2affd8c1803251fbebcbf64d1fff696c7bbbee9cb66d6d280964f5532b56a9ce533132cc80a2539aa775bd3aa26bdf85183eac37db46997bf8cd4360389a57f53ecb06af437f5c8c68c4f645c93d3f283719a132318f6b8f97740da5ebb7ace6223565f7da96a168c5d78ea81148110c135bba495fbc3ee73f4a8f584143db9099435e62958c9ac173107de4e68ecfdc2357912470faf44400cc27f00f439cdd9baae904513def863363c31980abed69e6a0f5014eaa152d4d8ea9d33cbebf5e39d9ad1dbe5549e0e59e1ef6a029fcbcb09c3ef42b99957623468a4acfddedc40e145fa0260492d4f0ee554fe2504f58bb3647d6ae1fa17730c90ce466051696611ca1d08b6c500f4ac7321de2becd634dfc9ae53c8c52c11e9f09c20806faf34295d582a7c001a4d9c411654a51ced857848a18e816e96313640359e8d6178bc7c2471ad0f2ce035c74814c2b2aa4c3ff70f5d7afd6655a47a8f9ebc3e40a3d6b359c2cd683614c041aa901cedbc50132c7a13354ac93e977ca7e1360ab565702f8a49b329d8ccba734804a45c8b10254daf90c8e7a5a0105c444adae6472ac27b1657f06d780fc42d9b2be08368dd8055f004f207816976a3940f1d39c517ef0b1d6042c3ab7e936f54edfd3ca5a63935b1a952c4561279dcf0fda37673d70570c8f3580d3b58af29cd5cce9419d7359e7ab3af880a92beee4bcebbb47a2d3e63ef92c9fe31125933f9cec9aea0cea3a01444cd3e590d24edfa00bf6149c8b16efb2853702fee9d09d10132bf1846cf96777a1e577ac5e45f963ed743dbd2e79b57912356c2c0d00388dbb1221ef834df3a61ce9f9f12bce4d8ecec393164af2daab521a10d8b2ee70eacd09364ff8ffa64400ea8a3fbda0ff387f7e9a9217bc21a4aba8a63e849075aa72d9f42b1e5bd1d4c52985416f5362a889a489ce6596dea96ef52c653cb0198a98fd7878f7895a4c1f335af57bb0e62b03c33f0d100bdd700f8e6c989d9d8d123a4c61381f450e58c53fe4a0badb44e83728087d2d180423882b856b76a859e5c1244bc2eb9cd85274411f07743a8324ff2c5541b4211ca77d54ea15267b30", + "aes-192-ecb": "261cedff969d7ac4a22a20426175becb16f14f005492dd1d7543af848273106efb639d267f15d7a8196a00578b3669c9940d2484e52c8eed22e366090cfc84c79eb7d451f960b92687a428893ad54bf9dd4dff166799e4b0790fbc41465e1239cbdd2914f9851ca144d5a99a2754ec3a29689b1024138ed3ee8d015ea347270e2b546dae460afa86a733ae61463d040a80554f8de34307c99247de32714907b808f0457dc8d479ef6a55b7831982421d2d3369c7cfe4bbb49aa6f86f53d7e0b58c0335cc6df7ff829f6e4c95dabab86b5fa7e8a68797b61bb0a60c5759b051c7eb4fb85dd1c32a76aef7509f1c7b88d5c1fcbf007bd0676f5535848c0349ed241f04cf0b62d0fae6b7ca2a8b171b4239434086c56150055413c8113829591ee00d33dd8f112d85a7c4f1ecd6dd85e37a179d20802486c420cf53ea5f14256c0652efd34fda5833311581355ada7594ce35be7d32b2d1c941c57909630e8ba2d49878a71eccf7a5e8ca7b295a014acc15ffd91aadaa83ec9460e029e420dbbfc6d6fb14387436bead5510197563b850af66b692f52afd71926443a8cf3982322ab467db6a914eb588efa6287e96cc396e3a932e1827a12984f4a1440529d422eeaae068e889bc0cd9326d411cd4de36639fc50b6ceda2b298fe1672adeb3ee719b64c3fc3be27b847340c62c5f7ce636441e0a70d8cbb1ec096ef1cf816d3dcda7c321c18a08021faad44c2fefa3d1658b03920acec7829c14a11552c5f55d2e11f5486748c7f5ac86b07cd6685a059e2bbcc74b228a13b74f3e79606abc22099c589b8fbd8c22cf5fb685c8f8d64b4f85b6869437d5aa13ebde4af64ddf5662c2f518c75f61b9514e286f47f991775414fda357d0caeaf4149146e07c2872d1239a8a02697c2fe3d8de31bb500d3a3b924fce79f3537c11a22f3659344f151e170f9af0e7a7b9b8359ebf0af0f2d2515b4726dc7d7361da5ea3553e526202c663ce98f10e08c40a39d88ce741083b5e31ed45a0c72842cff646b9df34ce462f05c2bdcf7b681eff3afc550b73d326d57aa9b9cdbc838422a670b8ae190efea0b1e2d67bdf975eb9fe8f26ce8ea1b967ae3826c35d0f13be24678af3a2c7df4bfca925071a4a6ea4a306f3d3bd535f5ec6aca69af9e565fc77fc0b8914f0ba335a13096fa1ceb79f23e01f9f34029af66ad0b3533d339ab82a53beadea11020ddc8a0c9026fdd1b35ef7eb257b7c7896fb50f980e8deabfcf7340b83fb7b950e1cabbfb01e07e6a4117937baf0843c80be62f1e42750d12987fb4d6496e5871e6907cbb322af0551b8ffee71676c259deabb890a60af461a581fee45effce7098ee5d893922045a754c735eaf3c098cc49a302a623a7d3c4492248c760c88b93a0d74ca42de26f0978f8e1bf12084326017b8279d55853c248ee548cbd7e83d982c21ec1894982660e4c818daffc3de2aec0392db955428f6c35cce4eab0d1751a9ac9b54ecf31c2b767940895c847594ca77ae583ec9783237ab2d05458c947d9f96f52ae70d8c2320a89a3393d64a43cf429d04f89276259db646df9fdc60c6bb03aa9eb98b97912309778f8f4ad7186e28bbf2b6bcde67788b55597d9dd3dfe1e89462487a2fce08381a800aa276fbc7e6d4fc331ef08cc9eb6abfd7476fbb2dc2c81e9956e3249f13a190a0323b64391b6adb77d53b821027cc288fc1bd0121a62cd93edb72819fdf02f1eea4c6e94a3583a2047e229c9e2ceb0be1a02940a3e6f620e4eb854b183350e460da88218b203c0d259f7468785858268ee6098769d774249b9083ae0deeaa387a55326d6bf5b73ae339b809c67c8f4807b0486ffd224859eb414036c88c262d302c2cc2856046e5ebc79f21723ac2a2c5690329a7ab7f4fe518160ec9774b4cac3c4b9a5e24743c3d6f838457ef0bbf2d2a273237157d3a053929269729c007a51f8bbd4461c5b3701381b0dae2d9b7ed5da833994d2cd83959ec46ee0d578e07e96419a72d5df5dd21990d6f7a3560ae7ae54d1ff3cb70f62dd50d0b8e75404bdd2b8ac3cca51a6e85bf6bfc693bc365a89ee65c498ebdd3dcc7d32593616ac42dc7e0e582fd8c8524bca09b0cd2e8e2d4f03c8642e11a26b25ffe9000d2148a21cfdec351a0969eef5f9cd9d13a3c2cbc88036c4c57fa6dbfa11ffe0b859e26de901cf0f2b9843c4f933c1b9a68c5abaea635db34db507a77ac9db28bf930f30144b7445053e740c8368904e62700bd84d523ea90e3f7adbb109c5cf2511a479961adcbe240e26267bf51ea87b7817573463898e2ba5e40cf8fb495271b6eaaae0e96e45cfee2b1bf96a8821bbeea08f50a2f39c6e773c95098f4184aa2be4c07e5c760f8d64368225abfb42f6bd9492b788725b05e6ec67145ea6502acc22fe43743a0552374c4d0e6b2d37d72e42815a67eea2bf1c6de035274155e4ffa41153d74ab012b33f132cb5bc726499caf84d9827404591188e7635728fab4a2fdb59d910027d64ccbd21cba56361c2bf04eeab3b9cd5ca709dd63854677c095132fef14eaafeaf18766534c67d627c25824a49127077f054d99d08c9d86965a8ec8a46c5f6522b18d4ae1a5c95364a5da99b7c82c4cd05af49eaf106212970b44a4ef597f917a89c48744555cebe79339d3660359158a658403e5e00233b5ac9452246117ac2a63e167f6f3775c9a45a6856f1bfb914e769d5426f49be619b9b1988335059717c9aab953d8f438822663fe5668e7f11f95d907a4ec55c24f6104a084dffded2613973aab54eafdf2f5910d51ec268ff88a3967e643a295f572c09b6c0b89f4124a801e2ef26659b6e45ba74363f972e6af604a7c0b33bb0d97e777cdee4542ebc2b4f3315237dd0b77ae15fc4c3c405ccda33baafcfd936505395f5f6bcdbb6ccfa4064ac2516175f1a82262e65baeeb14f07d234982602ec0493e5410a3675649f0abdaa979b5d810ac627097e7c3ed42b0cc301f01f7dd76c8fcf01399c7709dee1af7c9686b6a3e8c25078d01d309c3742d70d11de0fdc431555814cfb12433e4ecdb0ff778beda3ad1f61ec32330f9e49b9f2ea13fcad82f7bd28416b37fd1b7cec3ce1dd7d52baf80c6f52dd64bed33da0b296f8740bb87f88d472ac56c59d84c6a70984450f5ee116c8690690c3aff555fae83e481ef76442b290a12640ae14a13e750c6f83a44deccc1ec1111fb85bd7ebcf4027670d20581865dd3966e22a5a3c6841f4ec284c796568b402e236f346f66a8e12e6c5096d9f8660521ba005b8ba68c3bc68ae8d514cf64f814c3e7bf5bafcd4c78ab0b290709d0d850e11bb0f4bf595a44300ad517b03571bbe7b1536b75a95850fed7e8ba7e8014f1e1b7b33a993b6e537e85f750ff92c49ebdc9681d6cfed8d34d0c61a8a9829e32ffbfa1c6e21c75a42747e530e3b5c0ddf16c6c7c7ead29bcbdd0d7f381a3d75703aceaadf8e18c9cd93c8b10dc50a18cc33c6b43a076b49638bb3716486db18bc50384d76aba6bb34a7e6489820c132bef7d5be6573cf1d522f81c0d814ba6d260cc0976069997b8e772f13a8eabcd126e2e5cfd4820b4f5053ee9f6ecd1d885b88550215fcbc68abc5c29c7e3eb8b779eab4e57fcdf97a5dd9ca46e69919b7874a19ea46e0096276f94b83049fe7298c960c959e30d842ec6edcf32a2625b2636e9ff60e13434c2db2b98d62c699a29580fae32dc4024457823db28316af4529fd2dd30df234dbbcd0c282ecbb1d83c281ee22a69a69e5ed92fc73803e2c0714dfecc829a7c57960fa246a425cf45590342691919693b4444536a72577f174467b2b3e33db4f3eb29501f331c76d2645711bdc9cc71234a4df011b98e8123b42f916c443f38d5d1df8f77ea1c2b5844d0ac7b56326e923dd5181f13e1b2de3e5e3b0447ace5f9eee6d44752ee0f3b644d238989fb3871a81677bde499f7886e5a5e7ef3131c63aa03d352761ee414cef9baf2798395db797bce251993a91491dfe4f77b5250b703d8bd352100b98d03e2da8d657a29f1c84045292f533cbc0348e1ed025052af5548c06df3123497e1a3146b03d845d753899c254de57b803dd22216564c9996e2533372f0a9dd60310eb9e5e9ddd87494792cd2a5fe403bcb2d00696c4920fd0462492b0f8cc1269f4222308aef7820444d68a5f742", + "aes-256-ecb": "2865cb5105d1405ae5406f94533a2801e3bcf961615de779997e9a374abb0b5e16289d709031077a1913ff47f543205a89627a5bfb9b31548041adbf628bb61f2dad705eac6c1341a2c768610d080b30de8a9725782ebe1b5c76ec6e962685286b3bde90874cf86eced6ed4106fb94cd525a1ab51b5325e1392954d04098d818152031ecd3a747f19006d1996ac4f26575852e90d43f7a64faef652c427b729623114512b9fc37ec04851a3dfff7e501e983a03b0d431d1a22da17bf5714dba09de7370800c2f144509663b982a322a6c1987944024837a472a6087db3d07904c9270304ede29a1a6b10b0f5c57e970bb44c9c9b1fc3283931dc5b0991c87cb2547d5a14cf2b12dfb6dcc64f5d81d1dc1dc754ee89f4c87df42e7b35bcb728ee4195f9e10dbf19e51abf0fd131f3758c0b52d7774ffc124f876983fa56b75835c305f263a0dac5d3591356d7c8408b141b51148d9c35eb117d3ca9aea8829a17a6c09452060ab6bbf8ed33079364bb85f7ca03a46d064f9a370b3f1a9e4a2f9f28fd062b11df6460b18026b75be3984e0c8dbd1598ea3a5e3e908fd201fb8793c448275d326112c25d2639a7431ab22a12d49f5cfdfab033477bcbdeb0d0fda08b1a74c0a4bee163e6c59bfd2a3bd275d1ea8e3708094f50acebd0e40b1c06c8660e5b88f67fac573c3d9ce3ef8717eea424a7d86215968c84b45f832a4fec29a8f3e57d44c79c872349b9ce3933fd15c6ab7fab9425731da50fb38dc1b7e2198f89b7813e506b0f0cdf50e1777788ee1902f4697c5e1d83b2dfc40a13730c34be2f98e0ee7151d337c8112fe086e3fd61afad3cf2fafd9021f0e65b97b023a3909231b729dc4cb280625ffc23a80ebd884ab4a62b3477d2ba0b45ccedb0b53bdcf4e5109d7a1b5a5b1a9b652fb1a35a169ce8c4fc1073a4a654fc3f2b0874a1e7c393b9f76290f2bae8788154a652ade8fe5c4983bc7aa32ada45ebb8ec8fe14fb68ccf495a0f8eadf770b2bd11c20b10a1bbbb4a7aad5707bb1fad69f9ca88291f6c1518d0c82af94d39acf3ab5a7ab06b117a78187628a68ffe4c959d47de2c688bddc5e4816794f41d125ed198b7f54a6c41b65b52e680272010305d9cba275d5ce5ee7dfe0384f8609086f0229646c8b465601c1392faa1740950df46ee4ac48c43007d2dca30cc35e2f7a2cb35ed035b5cef3b8ebd417b72cd7f0689013970521ba987568223978e25adb479c91bc50c9b7399bbfa6e3357f223359babbacce2d1f45c7e4a8978d77bab6af22c417710f51d1783631d6388ea5fee8b55fb1b70055327aa0d3b51dc3a215fbe11d8b5acf6b49af33e570f11620286c4bb69f2e1f4aed11cf7f2388c9192fae4da8028679370d815c91d66734ddc52ec5c8cfb085b9023a75bfb45f1a27853ca6e03aa97363eeac381afcffdb49b5d85a6f33fdba830c93fe91b921307a2968ea32faa7ae9585064a1d2ba2e474d3a011c7c2383769e187513e7f876277543a133f554f9b56b7a5da60fa6dd37d192313fd7ad528a1c6872e2cb105c752ee974bcea755eb09c6d9aac6473e0cd62eb10c69e19260b86b481d922ed139be332888a925c8f75a56b04b32b9a9c303c887062260cee054a7386e481f6a888cae023c93a759a2722d230c36a3b71c53371dd557074b7cebf39101078f0725846283c6294109ad83305f7522e1a319a280efa0c1dd0b6588a42a001d5958be56df99b4b0f595c1a80c6d82bc2704de68882997f664460cdd27a7ef90cf2949bff67d4c9702564feda94e8851454cb0dddd071f46467af8329d866e536eeb0e80c1454287abfcbb75cd38f38c89a1cae012526e2392951aa423781f69f1a39186c00039a1d5b4f75757bb6926ebbfa82e21c88218a402adfb96574f9d0ecdeb575516b9ec08b3d38b647ffd79708ad7930fb13731458b806e1b01d3259c41efe40e3af0cf7cbc1583a7dddd88e9fedea0b59ba819b2c4c840806d3f0e88f811cd4a6c7836975341b3d4daac1defff6dd9c1ecd9c0213720e62ab2b930a94ecb085aaedfd57e3de7d2bebaef73fad91b9fe98e81458edb2f035468ad93868bea0d37ca3a0e535d396ae5a3f30448884f58800ffc4666c10bddd2dd62c45bc2774eb0f7ceef33e358972369766a8e52f6337a5086856d12e3c82a57f869d4984aa0e5138e22d7730acf1314a7f49f5b86d9e443071ee6f5edb6aa0158745b9539be062f6ce628305a3c8095873dcabb1e8305232c202b41028448f01034ccb75af1adabf1c69806ed20c88f012acdbf2aae24c1573ecf58759830e3ae23f6aaa7d545ec7ebf176fb1a20e00d2da283230cd877f0015328b51f2abf818be1f6c48766aa5bdfe3a9f918b67c977d7b0eedf0662f85c6e4e35c9ceb0af3caae791fba4d9efd49d6b57aafa6f6f4b8e497135ce969ad5e32182f44394d273876757772f267006b540b66a9e37541c3d81dd26f89ae91f39554ba060dbcb731d87547c4d4c0d4749c6187ebcababab0ed5c1f81eda949e5fc20b61b65b1cbc4c06479968037202ac553021cfef2f2e3a09e0a217c652b575674e53a0fd634ad8afa9a8199e6bd8d706fa69e82d837f4e29da2c6ab42ee8c4deb690413eb8edf2d50b723e3ae99742886dcfe04f44ace3cd7f4ed883852a22549becdd3b03ace4f22555e6b65d9e3d885c07b88ce0d14078f3cb2155fb63c41bcb38e29b0d5015e6e496cf1cc3aae74720b04f1f34b6f894c2074e5c3821d810e65754c76e34fb09cc49ee662b40371005dac54f7c321e0a9d1a194ca59366149dd0b72641be17f20cea6f93f7cfe5dddf70bf582138a8ac01cac58a966f57be9d7833bd9d72c634b02de580465143392d4015fa9fed315d09000b24d47a07ae0c997a0e6cd827424a32e4e715701a5fde287a72d7662f0b2bd5f9f09475845bb587707b241344c55a66a1653175bcc755232751f16496a7f0938537ddd179cc95d3a2ff069fdabef6866093c8915539a3e6213469cd7069433235e68c5ad6f848c94f79f9c8ac53ea98c4996b87418dd67807e2cc8427f1421586fdc91db3969fad04a542f2e3e20bbee39c5e77ca1cae23e1a386cfa89cef0c751bc15df472156bf4bd68a7c6982c157d9ddcc05a7c36706cc630a019327938093d8c460c103a923c5bdce68c06e21c697254d0ef6e484ee7ac81ece0b567c75e28c200b330f8c8881d58ae2d0b91f2e0a8817a2c7b74934a0ee714dba8801e265303e7c892aed132c3aed8dc57f895ff4ef4957fdfa7d1f14401272aaab113e654ce49d8f6d742561feb3a76ebc67a315d9a51e3c613c24b60f79654c07696248ca323a7117f7295db5c95085b888fdc158b3059f1d39692bbd79f57d2f718d0fa40d91cccc88ea4518259ea4b4f0211c49fc47fab33d82a1d4f6858b356c252333835bf6920f4e9e06d88d27784a0dfd4026e824647173778e173e710dbf57759a716a2885d280b1d2c331fa5490a52d2f3daac9fc3703d46a633193db4ed51eab435cf2a40d6b0ce7ab1e1ff76bb02c1a0eb708b47971e9d1400405eacf88199a9fa22151c177d278eded07437bc616531fbe8992c93d98a40947f742f1e55220c466b0b5989f14e0951b4fc77123ad3523cd83cfadf62b4a0bce22b8a58a8f4c1612362bdb61f6ea2c00a5ff1e431488a219ae48960a9462ee39a56b3fc7144977cfdce0f7f1660d78a7c16ce8ba59767a70b8e64ea499cd3c3a042f491686656601417435bca37fb238e9733f59027ac44ca35bfbc76be5a7e94ddd0c5eb83197c5928e1910755c07f26ec77b22664df9055598152517215fa8f2c20bb818b02995fabf2d6a25d9efcc2520bea33c516da197a11817072742f3adcec6489aad87b486a8b8f24ded0a2fed0102b4a087473abf1a3c7babb76724a064a91ef01510f46c03bb0b33fa86ddd09fd4770c7f35b041d5d6e4d35ac9e9a4b41fcd93b3b0fcb2d1cf65f90d350422c41828a4356ed2764781828d5ea7d4f8f35cfd43f8f348b63014f910a51bceffe06a4946ff12f89365924dcf1cc4709f0602178a8c0f3585e1437fb53d19e97dbd2dc6c5eb430d1d0d5b40cc27e8bae1a120e3e13b5732f41827bbfed2010965efa2f40ee081f65f781ebc71100699d27416eb29c933b8774e219ef970b8ba7df0c8aeec7bb42f", + "aes-128-cbc": "1162e95b41a0a54f2b709dad747ae93fe22616db32b01eba17dce0cbbf865167e9e1f12e1669cc762a89ce19478f473c3ee783349ce89fd6087521cf9fc1671a3ee9aa4d3223b8de34af9572408760409d4c0b478cc0dfdc7f2bacd931ee9719640ba127f73d4d28b162a58dab58257a0de0c71b2a56850f3477a7fb51bec31a682225cb0543e11b838820be5f4ff0d3800d1b6669a8b33bad5bff5fc498b63605466ce4142197e3c373e3696c4566861f2ee3061b7379cf11ff1508d6bedcd41ff49877ebe6ddc6d398d257bee26cda487de797b12937a96baf4291ae1f9c9b03833e07ae0cb0535be85fa9a5cf50a405c64e899f79c241929eef09b440bfddec3a2cd2aa58f04cdceb74a392d208bf07487d1a37191a88dace6d3e6bd557de30093e72ae5be0c87dee46efba702af9ec779cf97a88ce12dde2b31b035867f2c1ebec3ab612b1332a22a16a237880f0575d521fb93e8eb6c9fdcfa0abcb57d6cdd27677ee879c371abd7e598a883450f4baf0531c879f5168bb9f27ee5bf10fd4e19f8ef176bb0304110e85c8c1884b529e95f4d062620cf67f287c651d56ad4d7976008e4ef57d225336922dbda0f09dd46b0aa48f5e12d9da58da588a2620502b57653641430d8f8a5c40f3e165935fe91e32cfafcbd529f4dc183c3d0e01a96b926d0d70c32fc717fc997e14fc254b74c082a986681aeb604956ebeadccdd235e3f622c1cfbb096bcf32dc1516f3a7f46ca8439abdd018c05e42dfe9447a6c5d6d2b3794697840694fc0bcda6bf6cd3a573d5f289725daaa16c970f05103da09f2c8b219e0db033b5a456c0d04d78bb87df8dbf228a01d005d8a0aeb110b4c652648075c9dd555e567162677536f3391106cf2ffa243ff976ee3044a62a7e4e899823df42a9d0227b86921d073b33639288443a82c41bcddf332272169473560bd38b8a4a740b2e16dbecc0d4ffb4b88f39a7ed7ab5ee1219a8451273b50c7ef5051602e36a0421c28723dac7fd5f625d2db11cef5676a6912c66c630c5c047a1f35ab4d9ae202e98670637a95a9833074f6727031cbb1fbfd2557871a73d052161fe861fb630e49218bea36d02dff64d53cf58ae7644a420da0587c554bb71b4f0e65e3d693d7f9cff9a7b7a4f7d8257ff4ff73d644398e1f918260866e13d20ac7c2847f4b65a5647964519cac605feeaac9728386c399e85a82b3fd2f05cfabe01b6fec09f2c2fbacc5449cdbcc71c11cf62d7f82ed2b11cf23d66d30272fc82706a12f0c9a51836486b2250b646daec77055f2f9131dba3d8c5eb26fc49edb20b39aa4fed44e8e64b948d6a9f227f413add5dbc4c465f752f9005b922e5dec31b0e717fd4cd3d667a536f90cb4669774c079206f218acdaa5b6a761fee7dfca087940adedc4f33687b71e8470b111b3a792b153d968ec4d8ab8b93595b5c1196e02c4a1305f0da916badef779e1c1933041eeca60a3a13a4eb3652c73aba390e1cc831552017b396f512666c558c55a760b86b24f7dac7f1eafeddc74b134569738b98ef4a0d67bff9448580c51299386251c246c471cadf90c3ad7443811ac83a4bb489da835385373bb0014fe190009bb34391f9020c1834ebbdabe9f759f9c9ed85c688a346233ff8f7a8e720adc88f12bbc66527e2ecfe4071ce1a515f29ccb81e2721c02c3c468a46c038ad383f5d4f9282e28336fa106b326a3dd0812cebcc189a8fb9428e6cf6fc6e50e9cc1ec76016becd868142f8a4471858df60e1d7ca490df72c74505fc0334f9779d34c6a3fb86f2859cd89aed007abcf156418b311965e1018656274a67c21e18841a2544d341f6b7fb239aa6e916c23c5f4df8ee79bcfdae4b5a776bf7bffb861aeb704a5120a464d8a247b5bbba27ca64de9f751da4af26ca8eeff72a5347cb098f2ccf78ab0d3c28c63559d0f0696e2fed6d85de00882f8efb652398c8f930617153091895dfb0b006b89f737977e533cdfdfc476166f4f6d178aebac8de9c232ecdee289d9a5ee5f71520265e598e8edb8a7b4de0cde04ae01227a4cff341044092a4eab99f759a8bbfe26f561071dc13b7f30b10a95767d7db306c19f569d1b55af00efb222c7b42e38868242fe9810f728b494f39e7ecc5797feaebf9699f3f805f2d36faae1c12eb7fbcbd65f44239a28ce91898f0232724bedde1b12d5e1e3e6774347ba5a2cba4db7714afcc8145446bb2bac0c69426e1561e96fe91c63efeb49f652b7bb7d514df0e0bff31aa0687b22de9712cfb1a525bee982d9daa569c7a5c2bb863434319fa99ca6ec0eae35baff5dc8403e76167499e54cff39c7e386cae95e851a4239c5f20242ccce5116e65ac5977f2815dffe21e87134f1036facd19cc9615221f040f6d0bab47d08752997e8869d70e0177fb34e7e88e2a043b9b0036a2bf0a63b7019b27293bc74ea46fe504ce17d40e2000c4e4dd8c628b50b6879c92ff5769cef2973fd2aec11f867250223c18b68b9925f90772fb527666a10ee48e3e4c4f0338e430d08698e17e6fefc3c1430d83714f2b7dc47481549f4624eab9c4b43153a47ebcfc201bd938803de36d90cba01d1783ed59767557027ede1256f5b5f0c4be16085e3eb3d85e829dd4c92a08b0a7ee02e99ab84ff4caf6b4a443c0c6104a135c581820ea7f8c46dad0967dc172645d3e6a1bbf0676881e8f035ffbc4ed897037321a582a4ce72bd693bea9b59ef244707e7a8510d8fcc18962a179c85ae9c4291fc2397e66bb3c5a69c6f5a4d8bbcee012bcc6386a52ee5fbcafb2a45be2acb1722ecc997dd47a56f055ff009f521c96cad585531911dcbff52074cd540dfcad1f54ce6c26613aa1e4bc3b1d7793e0184fb018e54c1f28d515dd8d2bf5a1a989d7cf03173bc0f846ab497b08a3110f09e9058b59e3ed34ce6ae3024258dbb41c92f82f507f9fa6d752714272d404ee428bd657cfde50cc52276cf60c42aa247c017ffe636743b4bcc656287be26eddc82e39a61e6cc4a4bd0817874723453b227763c475820af7868be569e8006b257d6ba99c02bdcf1ff2c27e0a5ea69a569220679a22f0e936a2c7e365cee9b4859764ba34e24dee7f3fbd20dcebb13d3c644503f2f11e0a61fd89a91e0e3965a8bc35abded365ff70575c8c4b10cfe7fd7a638d0d5a20ec590c1fbfbc891a724fd53ccd0f6f23db00d20e880530a9fb4d7fc1ee7e03572becea46c96a5dce96614b1dabf4c94bb63aaf2ab4e45fb1b99b4e55a46cb078b044875a8214f1685c20f67941186d75a342383be4f0f787eda50cc0fe254d341a0fe220792149b00507c8351633cdee9f36ac136f96c7aadb294b2ae03738e4fb545c2d6dce7ef0d87db74b6056a02168a561fcdf98c958a6bae06e95e8664afb14f404db03868a2857cfc8bf831a1188db52b3ae7fdf4cd13a056082260af991efe02d29e67ed9aa58df9ab9b2cd829f6ef2bd3559c294b5b8a2aabcc6d7cc221fd78f9cdd9fc936b2f4783b6aad0b50b4daa481876e1589ef4a996404a24f665792688a7d6d15c54084a8de507f64de136d87a2bb2dc0781850a90e0ae420d501aa4fafea83636b60255a31719faf57b5acad9e28ca9da97a0dd7ee7467317314f853e3e3ccbbe12d5d23120b2b0bfbb5ae2a26f1eb2aac40f27794fbf08f20ba4d8a00cb232aba485eef26da2521ad4d8568f1285a862c341bcf562fb1e11bda23baf8962ffe49eb14d5b8f807cb768eaff9ec894b9d1682bfc56919c48d5018464181466e301c8fce5ebd7b4f94f44e95f977e92601edb5e706fc9bb08165583ccea88c9f0ce716367e8ca6c8f689316612d461ca0f2afcd64e36cd15aa0ba30de029ca3b85d9f2b49e3a99dbcbaab007d56f83171740f0c690a3355100f4e03bb8bc67224f3fdbe19d01668e550404810f011447e9f412d2aa0aa36df21eb0a733bcb3991ec2682b0e48bf0bc0c63da52ec9e0a5375ca009c28008f9c1969f1315cd41259ae13656b4032802e465c06404d3540df8ad44f7f9d931977b470a26c19d519baed994cb68af9a6bea4b73dfbf1be63c16a5c4891bc3d6f38197e1ea38b2c75a3bbe2149d1b204a5544c7d7650a648d755ebdb18dec718239895d85372973edb32d8d7c19287229f6d0cfb30e7916037670290c98940c428820a5d912418d6e10a0c0ec48a2", + "aes-192-cbc": "bb91cf3f54169d975b34ed1fb80b672baeaf507467fda51e314ba8c26c2f9c5f486bfa9e9ab716f48c39bfb79bceed297b65dc25ce4a60ce7bf4e114fe9d26f3e7cf271691923fff0494f8b538218f08c60ac0be7f1b83549f62ac469581c4c9e55a9cf9546141a87fe2e7169022e766673c8e1dec28783bdf1213eceda87e2978421454be7b07d9904baec26eb2eb600484d6a30a5a0f8ae06b50a8e5a8cd63fcb65de9f0b99cde70af06993dfe7047c3d6394396f2a090a41fe6426f19720021b48ba04c856711cbb4ca952b77cd62e6cd1ae8d36c2b3e892f9c9a3484ee1fa0c31571681f2ad3fc8add40f4dbdc4d0410610fc4d9ab1d189c076496345a2a54c135b99479f51b643bdeb145432b827e4a5410a3a7f8a442afbca92e1e56a8c741778657751678f5188a27f3a636bf3d44aba5c3503100b37c33e3ef265e99d61cb9cec75000ec30241e181622630e499e4cc6b0839ed087a8f703f932fb11c13060806d1070ba9122b34755bd9f3b5e4bf6ae768d693f12f769b139bd8e434eae1c033edf04d7f082862ff31def965fd9926f11026c4f4cddf5a642a61cc9a60eefdc101c994d96d8c943d87903f775fb2e27342ec54a89b610aeccec785264c8ef4b4e18a55dbbe6c336a9e7297fe432344af03fbbc842b1fef2b1c0acf2df800f6f2aa7cc103ae8c0677a7e024975aff9200ff8870f8630b25fc9891199f6360576f2bff0cc15423f226a784b14df8ddb3d29a281d6381069b7ec05ecb512121ab094763cbb492e631ef82f4ffe065342e9556362ab3cc49cb106fa5651860b35574ebc47cf260424ccf90d2d2503455d9792551c72c6df90276f7d7991eeea1fbf1e7fea24613e09922bfafeb9d38619724a3861e233fdf63cf28c76afa04b303eb47cee30a7a3f681cb0e48b91e863266257f300f0d62a931a0a95780d94805f57a03908b299b856db8dd510636b0c855ea2bedc7a02c635346ab9782bf3977d307bf92841ab2b4425c7f7c9c159f67d7879d6b1c82f9476ceaef71c7b366062b9e368879d84466a0d508023fd275fc8190c09d807dea157a0e5b31b97c5af10d8ebd15e8c336881a0bff33e5e5c9044cf914cbe30cf01785152c918a60131351a0b0dc36941e5a0e12e03ceb4a6f731202e203e990723f7bd4b6c7095db3892a8cea6196c838a5d345670868ab6ec1b2728966549587a931790cf71c20bd30e60aee1e421aac8c9a6c83f82ca4e28472e38542cfda2c5338ed964910e5c3936e25d5740120a5130c68bcab4e3e48b9cff7aa6dc64bcf6b2f6232fc63c927426d863adfb18655728578dcdc97cb7d2ec8690b06fd4d11110becb191c8eaa8e669c5f28f14cac9ee348dc9e754717eb0a23bd6e2a3f817362cf6f8dd11073ada99bb40f0bdba8ca16ed1666022cd73f60be5fe530fc0e71128b4321c2f244d14f6f2eb2023d388803a1b05e64f748bb05db76f1fcbd23b7de0e52ef028a073890be2987dad6b6893a4b9e378c3a5169246aa48cbf6adb98d0bbb56e438c1f645a0bbfff8099588f0c80d537fa451a1959dbd6b87d0f99507afc4f41cb407c7556d221594082c008f70ee4254b9ac19d5c4f7f586d71664be74e9f35d5013dd237b82192ed0ff1f81be21ccf6d8190ab23d7ffc9f6ae04c2d16f1718ae8798f51d977fbea395272d954d038b78cc06df9ea2b133e6b664a53f846f9a9943869d70104688a432f4c395867dfa5b6f94409ed75a1229e9b39e5e43d4ad123d61cd0b2a7de3329d505078421e5a6f4cc46fc1737b8e05b030e877a445bffdfacd47b84bf21420b41e997c799fdb3e78d587f54ba94a63aa0e833d4432b7e1606e1c0b098837a42d082d592bd49ea4ea98d3ebaa14a09154e77763fa2d5a712bbf81d3be4d16dc12b6896c9d580bb2da4e9875ee9f59d5afed66d3616c6e9aa41cd83e1a6b681f326008bcbb791a9d1d3d28510c901e7651d708cd6081c7822dfe6d0fa44923cfe2a70329e0d4b4ca3394c1127d30a91cf6ae826380e10d4452992747bb6a4d37cfa4b94521f96d413efbe6126b377d8278231a1432abc2327c372e616f60493c23f05502b3ab3dd8a6e9df01e73ca6f409123fad121dea58a522ea42d420a6ac9a4fc60d40d5be4b50510d5322120b14d5e2161d76f126a77d33184e45df24b39041cde06917365653149e85475e7d2e5b3834689d105178b373587a4e11956726ebcabcb99ff8645146893eaa20481b5f4acbc9747fcede05ca9e9bec1fa8bde611ef18b994fce1228f5623575ef274007bd9407d8049ae45324acbcd095aca3e9c252f04fdc9c73494939afc17424ab4cbf9327cdc6034eade163a301cf4e90a09d33f1400bdf618dbc4ea29e8c223aea5ef304990888c38e3e68263a341771ec8f4684ee60eb30f694bc822531f6e87a010cafece80112ff559406e90f6581971820e0a6f61fa3477e499d2485e18cd477078bf12f4d99b849707f9dd8f52c3a4238f8603d23eb4955467e681251ae2cf47de01ebad15d8ca56692301e7a5774c36737054103f335455f66f8eed80c4e47df0a048ba908664a605c090452ea297b3c4dcad4753774f51ca470c094c4af5d4705173e21a987dec57586d4cf3fc4b92764375714ad0b58922e80214ba42e46ef8d58bc5eb8ffc1ede9b62112953ffdc700d35b617495906442fb9f5b2648f1edc1346c75566bb17c56597d795b152f797f0b133784c104ee647479cbc8967a0c1dbb5fc4e72cbf0f8ce07030fc322ba9f410933fb7d4b673c43a5c009c47f2525a3674a16dbf07e8b79095eb15107c2eb4371c51af71c6966d5d44fa7e921ccd0a7aba02946ef8c4cd0c5a6396ec8d54cb3bd72380a8292590d650f65f6d827be50838e0a59a64ba731e620b19fe9e33ab3984f25f08e922d1f9e3aaf77c719da77735697f0526bd93ae1283920bd2e8ad89b22590a73f1ec60094de4e1dc118b4d0dd014b9cb2cc0b570766e5b88302b0f2010dd58dabe6b056978d51f6dfcaa71a14914113e539ba438bc102443fadfa8f7e8491d1630c81cfc28de80175f1fefb80f2fbdcaf4660143c05be097e5f443b9e975731dbb599486be878ba1015f14db8187052a623ce76442139348e370a6d08d722f29529b599553fe40b65d64c3ac1f4607efc9f1f4e872a748a435e70d3c843def099d448e0831d977a7e450f869669a3d49774c46f82a0275a0146c32e4e7be2181de9ac73485807c4e3518c561ecc1139201758270786659736735e49da2304f4fd2767e0eb0c66c764b1013b204dac0c1927abd6ed76a2961eb00680f83a401e5c951cb4918c7e9b34a18315ff3c2eac497dba2e90962098c9fa24dc6bfc68e6baee14f9a15097f60a6eea262130dcb873e87eea6d3c2dcd2f804d5786aaa17cef20765138069c78139dc4f699f631a4029b3936b8e71d451e22ab9b72a6804632378591d3fdce11516239f6709f1908e78783bb06a981cd35006352a8d94d2242016b9033add6d1bf9b3331013294413a2a56cc772ea6344e144bb50f00407397de538de9f61c038f236b71da28696771831bba6e3a60b1fcce821502ba0d3e78a93760aca407395b19197349f28b0512f73432d7830b2cd5e877ead479b9179192c02e14a48c12fe015f0c137fdfd56e4899acd5a30d42b88e51de06c7d1b1e0d73d681e8b9ba2e85d8e85e83dd09c414da3464d19837fe8dc44aafb2d08b8749abe630e679f5e983b2ee4743cf7e79390d640ea4edf071154a3dfd9a553c5f4c53a980f19c4fb7764f37dbd7c312cbf9563a24a387d20c7c591e3b5712831fa7636b2a1d5ebce51a6b322197bfee3cee93026eddbca4abc0ef02beedbf8eb73c69f4d873cda8936ed0433ee5ddb156cfb47e50ca31db8e7e2d0e014db60d2257eeefa47e7fa69f206ff62eade550c7c66c892e4d054878ce2dc46923bdae19b86d57d5301b12ce24dc8230bea2157b2270079e8cec6e75f693365a09ef5816dee04eab30ed7d4d7331af4a8f229417cce851dc4e9d585640bcaeac46198c000c53e1bae194746f0a79106342dcbc37dd2447cd93e6cb0fb25bfcaf9882cc11d0d2e5e2ee60850505941403188015192e2eb1e23adb14250f3424ecb9aff85469a2f02cf6243e20224bf19678bd7de16663a93d4ab86163f17bc313cb97b", + "aes-256-cbc": "f54ba887fb5bc0e38011a0e7445cc56b4aad153ac6230f0fcc292788b4535441fc03bcbf9f0494fb77f96d7517e0c25d3a25a89b84b107afd3e9e7671e4a8c115aa000faa682377b16b9cf8df569e570409d7de1887cf9bb89193aa7ab891f1648721fbc21f198050b3d4e047537a560e8200be35a894c59dd2fe3ae3a794be55222b358e9bf914c32eac63eeccda649e7963b76dcb5fddc2835d0fd8729e7a017950cffeb50c02a3c539f7945df313af8b37b8af5a56c1626a69e19526ed6028e8e0bda2dc0ab9e7640ae0f9d125a4aec49d53d651e35ff636d27e136fd7ce2ee3d28e6be88f15351e6424012591c0e8199b3d1e83e46273a041530d8728bfb4e28c6c4e85993ce85483d2dee0c7a386100b3874e7125fa36d5dd0e8f71e8fcd6e17ca5178d1e3315aed27f636f571500799ac27f4ead39ad8b1edd54f9d9926f9592ab981cf90d73ff2ec91d63c0a4e6667b691f3ad5dab11d471be3b381ed41d8d3de4084e40ac189ad53bb37a38c428cd9353c83ed6274b24b412e5f2077a62dad3a282f2c84349569b8736ad2750b7eebf844b12e40017c13c64653b96a4736e2e74bffe217674883b78f526e80b4644515b99a5f99f223ec74e1157d199c8e57d6c1f76a023e59f0a2b663fb7e6b17e0da2a3b8c292c475bb512acd76b4d97f785ba2a83064949b82f141cd492ee6db0c3234731299efc004ac6df8a752639031aaa9104d0c999d0e733ae18bb0f1626b605cd6a0635e0516575d984fc4e273de7e6b398f3f315a0031258992e59835d7296d3c54aa5497459412b9a5b52cf0b0c4b19978d3d60bf4e0c26587f564298d2b917238a9f6baa1e8804c3949857ebd9309dcf31260e794862d87cc100ab4d66aba2cc1b3d2291b7a926a9f72b2040925a58f967870b69df6b009f4830fcdff9c40466426d972de3b1c9d721767269a76e44e1d0d30580ab5cc47f851843a629cc9d5f9d0f1afec35cc49915fa4f7c447c36de38c126a3cdd1735906a4f7e4c452d16a19494c158e7c46c77d6f0f890faa8536a78815b25b544eef61e516e8dbdbd88e479e35890e1d1898bc7f9cb3b3cb35b29c0cfc9c1d66c54b845f81d22794780465da1087fdc997a9ee5672f92bf0b38d8d3e5310d121e0bcb8331fd93498c43ee7506cc16d194fee7d583242b096f83247d0972705d1b3bb5bd800596c22ad623673d348a2fec3284557760c1e6d07fe3a269ae4a6a6fac6c93969777d67c6de52f3433160d08f70d43e00ab2ea62770bc52f83bf060ae8dc748225fb66e9d23c07cb74d8e671e922c2634ff4d284d01693b366378aa6cbda0296b3828be578be60c4b37832dda4b8f86b943f77fc42dfdde65193d71b26bbbf91ee479408592ac86a347b4ac068d77dbb8702fe89d58ac75038409e357cf8b4db82fa148ec6c8daf25e9ebaee57579572f497b1da783eca255ee8ae0485a465455c2435aab98b8c559e9b3fc72720fe47c02ca76c068e54f287debb9b9c80cc6fe63ea9da42ee9a0552983d0161dc281e55f26b762ce5c0db5a019560b32e58b249e32fd6bbf25634c2a115966c136199b9ffba10cb948ccb144642ef64cabad21bbe12509104b4b093e9e25e6081854240c988fdb2fd1cf3d9f89fa83cf60cfb1bb8ee9085a1f3daec6bae9913f8ac40aec60d403c47db27f40c64c58f4375c09f06c4cf47486c77eb63db6ce702e58190b2afc758b81c9a8a3958627d8f95bf6d3db756aa35978d4e7633af2f2874e7c1a2a9f30d35f2a3f88b58f62baa64c931ddf12736641bc25d7ed6938218d5958ee4727ae850ed91a71d71a492b2cb54167ef43ee1fd4e1049f8e9a1789a87ba77607109eb64977cc0561ed4d46588d46284a4ba730886d4064ca77ccdeb4c4ced9e186c78075cdabdb549b333d6671dc966d32ebad204c96a412499725571491c47aa80d519d2f48d51ef1c292d9cdc9f08719ade9c8a1ad51a9932815174035a9f82e62b131e44c92c4415a99a394c29083b748e23b0d05a9c1733db3bf598293d5d501f68ae0f1710253ed48123f294154e2b9b88f9033d4cc1d61739150d656ab9ec79e55067bb22d9ff05cb5c3988237fa1f4e92d311ac813c0ee33ae25dc244a392d1b9a19bb9076711f807107a27c7db59b4fc078a5d4dcef82d0ee3b62ed5f000426ceb5eded4fcab1f15935d23951e8122cb23d078c6db2f546219aea13f17c837f84c7cc4f83042db70760bbc0a2d5a70f9af04ac38e3b18240e520584ceb489937ebf609c2961cc165083f94b59be2875b9b8fb83300efeda3d85ad533719513119f835f09b5bda3c9050c9e8cd5a67432e5fedf7498850c324f8a0e5941e45ce7fe69fa06426ae8411d0843a68a61658777c4c6fb5a570f96bdec0a89adaa9cfd31128aea7c441d9a04e86ad20817eb64563553f056d9482b9259d6ccfbf40219a42c519ed9f9c3b1d418822605db08f9e914b8bb9812bd2f234b9272ccdf2bb2d9314469d0fe824534a85c4fdb6e0bb81130637ea1b953ff9ffa00b62f86065ba32ddb975198aac1e0a71f64b03152885f51bf758d7b03f1ceb587d424ca87a79762c66ff1c537b3b5abbdd38470a96a0c9e4a3f85160d2dc89b81e870fb7aab63831482028c1c70d4d221abd06f74d529178539307f2aedb432ba6f19ea5cb3c02cc22318cf2c2d9084fd694970c725a8773773c5fbaacdbf297134b495e8e0ee2e03fd3fdd2d25e4b77d7b2831c78fb5213bd6c7b32ca600eb524bf72119c894467069f5e0dc183d591f6ca8c13e0686760e4c37a7ed470f9e15673861cedf69b7af0712a067c08a3e2854d95c8e29553674f2837927d23bdb111c7bec80786e8c8778978f5cff9eb7565ce5e7ab7f91fb8c0733e575ffa07613732ac9eb994d0c6e37fc8765ba37d1dad6c38d2c88f92757ebcf5c637c40995766b753e9fe403e8015129f49469bae99101c696883300743de15201253d4d2574aecdfb91281967a0f61353c0d1b223cbde2447530e508fa64b87e53621f2b1fffbe322d9b1384418fd80912e7147b3234cc40a803048f13266131a09ae4c6bc51de64568e722377d37bb0a4584209f552cac149209f1f7299a47c68a76c14d7cb5eeb62b3da147b4d8ef7d2e4c6f6621d36c622c0633fc401ab5e20e9807ee68080532248f7cf3aa84ed6297de3da33b6c22476ef1a09c9603f87653cd29ae87f3ff2bf42fcac26c7a346077d321b527d63a8e0917eea5c00210885a666010ad049cd239326614ec47a2d6946293f1e305f27dc61f923c80b4393aa7fcf29c930eeffe0e7b0e66010d9f2be2314fbcb3b1c0585e897e2b8e0c96149576d17639b9c5c127b48a7d9487a99107e07ecc164a53f95ea9a01f5f577302feed514ae1f2e6e8c3449df48c7b47a96723d719be4ccc5fa19876dfd02134fd517e68830bcb8a4e60dd3af6dfb1b9a2b2f93c7c579c254d677c690446c4d63ac6d9b2910924e0908878475ccc0d057b24fa1d1663c2a5afb8e49458b30f63c6ba6d85ed1173dbdc6030f9ca2659f8541ace6e1ae5cf8d039f384382e07405b0bcc3a509f002fd234c4d8b03259e198ffc7ca2f445079e3518ca6d8bebba2ee87e4be24992258ba444b2daab73d0cf4e93650c9d1cc3a68b5edfdce3debfd42ff80868581121368b4a13e706795683f73021e1fc17124e89f5caf96960d55bc8597857c0f0c15cdd019af5cd5301a76df4049bfac6c6ce74239508e7d3e4badede7706953e484d4b591251aae0e2e18e847bc26067ea40eced7aa5bff0795efde073a5622d630b21d4b322718a1bf366651913f05ed56c5e44b9775841f91333a70a137389a3563726caed3309645a6de80d9fb9f779bff811ed295e754b238045f1c8e6b60b5f2524598cb5169ed1d92be26243864c79201c2d6fdba6f6a4f3dc73f651c9808db7631b3dc8a52bb594e17e7a72f5f510b5c8c6150e9be78fd24500ffcdb04d0cb324c39288d9fe9ef82f8678b121af069584cdb4e2727cc4865201ac3a5692092974ef6ce633bda3f2f60732f1042640849468203a447adf7fe68ef9eb6b102eb7e0c8fa67dbb56288e656c0d85eb6bb0ea9a25cd116e8af7e2ae4bd9867c220d7b0526ee2b33f9991da41c3b9fa6f6e4fd9d7b293d4ce7968ced329628262c890f24c58c8439869f9778", + "aes128": "1162e95b41a0a54f2b709dad747ae93fe22616db32b01eba17dce0cbbf865167e9e1f12e1669cc762a89ce19478f473c3ee783349ce89fd6087521cf9fc1671a3ee9aa4d3223b8de34af9572408760409d4c0b478cc0dfdc7f2bacd931ee9719640ba127f73d4d28b162a58dab58257a0de0c71b2a56850f3477a7fb51bec31a682225cb0543e11b838820be5f4ff0d3800d1b6669a8b33bad5bff5fc498b63605466ce4142197e3c373e3696c4566861f2ee3061b7379cf11ff1508d6bedcd41ff49877ebe6ddc6d398d257bee26cda487de797b12937a96baf4291ae1f9c9b03833e07ae0cb0535be85fa9a5cf50a405c64e899f79c241929eef09b440bfddec3a2cd2aa58f04cdceb74a392d208bf07487d1a37191a88dace6d3e6bd557de30093e72ae5be0c87dee46efba702af9ec779cf97a88ce12dde2b31b035867f2c1ebec3ab612b1332a22a16a237880f0575d521fb93e8eb6c9fdcfa0abcb57d6cdd27677ee879c371abd7e598a883450f4baf0531c879f5168bb9f27ee5bf10fd4e19f8ef176bb0304110e85c8c1884b529e95f4d062620cf67f287c651d56ad4d7976008e4ef57d225336922dbda0f09dd46b0aa48f5e12d9da58da588a2620502b57653641430d8f8a5c40f3e165935fe91e32cfafcbd529f4dc183c3d0e01a96b926d0d70c32fc717fc997e14fc254b74c082a986681aeb604956ebeadccdd235e3f622c1cfbb096bcf32dc1516f3a7f46ca8439abdd018c05e42dfe9447a6c5d6d2b3794697840694fc0bcda6bf6cd3a573d5f289725daaa16c970f05103da09f2c8b219e0db033b5a456c0d04d78bb87df8dbf228a01d005d8a0aeb110b4c652648075c9dd555e567162677536f3391106cf2ffa243ff976ee3044a62a7e4e899823df42a9d0227b86921d073b33639288443a82c41bcddf332272169473560bd38b8a4a740b2e16dbecc0d4ffb4b88f39a7ed7ab5ee1219a8451273b50c7ef5051602e36a0421c28723dac7fd5f625d2db11cef5676a6912c66c630c5c047a1f35ab4d9ae202e98670637a95a9833074f6727031cbb1fbfd2557871a73d052161fe861fb630e49218bea36d02dff64d53cf58ae7644a420da0587c554bb71b4f0e65e3d693d7f9cff9a7b7a4f7d8257ff4ff73d644398e1f918260866e13d20ac7c2847f4b65a5647964519cac605feeaac9728386c399e85a82b3fd2f05cfabe01b6fec09f2c2fbacc5449cdbcc71c11cf62d7f82ed2b11cf23d66d30272fc82706a12f0c9a51836486b2250b646daec77055f2f9131dba3d8c5eb26fc49edb20b39aa4fed44e8e64b948d6a9f227f413add5dbc4c465f752f9005b922e5dec31b0e717fd4cd3d667a536f90cb4669774c079206f218acdaa5b6a761fee7dfca087940adedc4f33687b71e8470b111b3a792b153d968ec4d8ab8b93595b5c1196e02c4a1305f0da916badef779e1c1933041eeca60a3a13a4eb3652c73aba390e1cc831552017b396f512666c558c55a760b86b24f7dac7f1eafeddc74b134569738b98ef4a0d67bff9448580c51299386251c246c471cadf90c3ad7443811ac83a4bb489da835385373bb0014fe190009bb34391f9020c1834ebbdabe9f759f9c9ed85c688a346233ff8f7a8e720adc88f12bbc66527e2ecfe4071ce1a515f29ccb81e2721c02c3c468a46c038ad383f5d4f9282e28336fa106b326a3dd0812cebcc189a8fb9428e6cf6fc6e50e9cc1ec76016becd868142f8a4471858df60e1d7ca490df72c74505fc0334f9779d34c6a3fb86f2859cd89aed007abcf156418b311965e1018656274a67c21e18841a2544d341f6b7fb239aa6e916c23c5f4df8ee79bcfdae4b5a776bf7bffb861aeb704a5120a464d8a247b5bbba27ca64de9f751da4af26ca8eeff72a5347cb098f2ccf78ab0d3c28c63559d0f0696e2fed6d85de00882f8efb652398c8f930617153091895dfb0b006b89f737977e533cdfdfc476166f4f6d178aebac8de9c232ecdee289d9a5ee5f71520265e598e8edb8a7b4de0cde04ae01227a4cff341044092a4eab99f759a8bbfe26f561071dc13b7f30b10a95767d7db306c19f569d1b55af00efb222c7b42e38868242fe9810f728b494f39e7ecc5797feaebf9699f3f805f2d36faae1c12eb7fbcbd65f44239a28ce91898f0232724bedde1b12d5e1e3e6774347ba5a2cba4db7714afcc8145446bb2bac0c69426e1561e96fe91c63efeb49f652b7bb7d514df0e0bff31aa0687b22de9712cfb1a525bee982d9daa569c7a5c2bb863434319fa99ca6ec0eae35baff5dc8403e76167499e54cff39c7e386cae95e851a4239c5f20242ccce5116e65ac5977f2815dffe21e87134f1036facd19cc9615221f040f6d0bab47d08752997e8869d70e0177fb34e7e88e2a043b9b0036a2bf0a63b7019b27293bc74ea46fe504ce17d40e2000c4e4dd8c628b50b6879c92ff5769cef2973fd2aec11f867250223c18b68b9925f90772fb527666a10ee48e3e4c4f0338e430d08698e17e6fefc3c1430d83714f2b7dc47481549f4624eab9c4b43153a47ebcfc201bd938803de36d90cba01d1783ed59767557027ede1256f5b5f0c4be16085e3eb3d85e829dd4c92a08b0a7ee02e99ab84ff4caf6b4a443c0c6104a135c581820ea7f8c46dad0967dc172645d3e6a1bbf0676881e8f035ffbc4ed897037321a582a4ce72bd693bea9b59ef244707e7a8510d8fcc18962a179c85ae9c4291fc2397e66bb3c5a69c6f5a4d8bbcee012bcc6386a52ee5fbcafb2a45be2acb1722ecc997dd47a56f055ff009f521c96cad585531911dcbff52074cd540dfcad1f54ce6c26613aa1e4bc3b1d7793e0184fb018e54c1f28d515dd8d2bf5a1a989d7cf03173bc0f846ab497b08a3110f09e9058b59e3ed34ce6ae3024258dbb41c92f82f507f9fa6d752714272d404ee428bd657cfde50cc52276cf60c42aa247c017ffe636743b4bcc656287be26eddc82e39a61e6cc4a4bd0817874723453b227763c475820af7868be569e8006b257d6ba99c02bdcf1ff2c27e0a5ea69a569220679a22f0e936a2c7e365cee9b4859764ba34e24dee7f3fbd20dcebb13d3c644503f2f11e0a61fd89a91e0e3965a8bc35abded365ff70575c8c4b10cfe7fd7a638d0d5a20ec590c1fbfbc891a724fd53ccd0f6f23db00d20e880530a9fb4d7fc1ee7e03572becea46c96a5dce96614b1dabf4c94bb63aaf2ab4e45fb1b99b4e55a46cb078b044875a8214f1685c20f67941186d75a342383be4f0f787eda50cc0fe254d341a0fe220792149b00507c8351633cdee9f36ac136f96c7aadb294b2ae03738e4fb545c2d6dce7ef0d87db74b6056a02168a561fcdf98c958a6bae06e95e8664afb14f404db03868a2857cfc8bf831a1188db52b3ae7fdf4cd13a056082260af991efe02d29e67ed9aa58df9ab9b2cd829f6ef2bd3559c294b5b8a2aabcc6d7cc221fd78f9cdd9fc936b2f4783b6aad0b50b4daa481876e1589ef4a996404a24f665792688a7d6d15c54084a8de507f64de136d87a2bb2dc0781850a90e0ae420d501aa4fafea83636b60255a31719faf57b5acad9e28ca9da97a0dd7ee7467317314f853e3e3ccbbe12d5d23120b2b0bfbb5ae2a26f1eb2aac40f27794fbf08f20ba4d8a00cb232aba485eef26da2521ad4d8568f1285a862c341bcf562fb1e11bda23baf8962ffe49eb14d5b8f807cb768eaff9ec894b9d1682bfc56919c48d5018464181466e301c8fce5ebd7b4f94f44e95f977e92601edb5e706fc9bb08165583ccea88c9f0ce716367e8ca6c8f689316612d461ca0f2afcd64e36cd15aa0ba30de029ca3b85d9f2b49e3a99dbcbaab007d56f83171740f0c690a3355100f4e03bb8bc67224f3fdbe19d01668e550404810f011447e9f412d2aa0aa36df21eb0a733bcb3991ec2682b0e48bf0bc0c63da52ec9e0a5375ca009c28008f9c1969f1315cd41259ae13656b4032802e465c06404d3540df8ad44f7f9d931977b470a26c19d519baed994cb68af9a6bea4b73dfbf1be63c16a5c4891bc3d6f38197e1ea38b2c75a3bbe2149d1b204a5544c7d7650a648d755ebdb18dec718239895d85372973edb32d8d7c19287229f6d0cfb30e7916037670290c98940c428820a5d912418d6e10a0c0ec48a2", + "aes192": "bb91cf3f54169d975b34ed1fb80b672baeaf507467fda51e314ba8c26c2f9c5f486bfa9e9ab716f48c39bfb79bceed297b65dc25ce4a60ce7bf4e114fe9d26f3e7cf271691923fff0494f8b538218f08c60ac0be7f1b83549f62ac469581c4c9e55a9cf9546141a87fe2e7169022e766673c8e1dec28783bdf1213eceda87e2978421454be7b07d9904baec26eb2eb600484d6a30a5a0f8ae06b50a8e5a8cd63fcb65de9f0b99cde70af06993dfe7047c3d6394396f2a090a41fe6426f19720021b48ba04c856711cbb4ca952b77cd62e6cd1ae8d36c2b3e892f9c9a3484ee1fa0c31571681f2ad3fc8add40f4dbdc4d0410610fc4d9ab1d189c076496345a2a54c135b99479f51b643bdeb145432b827e4a5410a3a7f8a442afbca92e1e56a8c741778657751678f5188a27f3a636bf3d44aba5c3503100b37c33e3ef265e99d61cb9cec75000ec30241e181622630e499e4cc6b0839ed087a8f703f932fb11c13060806d1070ba9122b34755bd9f3b5e4bf6ae768d693f12f769b139bd8e434eae1c033edf04d7f082862ff31def965fd9926f11026c4f4cddf5a642a61cc9a60eefdc101c994d96d8c943d87903f775fb2e27342ec54a89b610aeccec785264c8ef4b4e18a55dbbe6c336a9e7297fe432344af03fbbc842b1fef2b1c0acf2df800f6f2aa7cc103ae8c0677a7e024975aff9200ff8870f8630b25fc9891199f6360576f2bff0cc15423f226a784b14df8ddb3d29a281d6381069b7ec05ecb512121ab094763cbb492e631ef82f4ffe065342e9556362ab3cc49cb106fa5651860b35574ebc47cf260424ccf90d2d2503455d9792551c72c6df90276f7d7991eeea1fbf1e7fea24613e09922bfafeb9d38619724a3861e233fdf63cf28c76afa04b303eb47cee30a7a3f681cb0e48b91e863266257f300f0d62a931a0a95780d94805f57a03908b299b856db8dd510636b0c855ea2bedc7a02c635346ab9782bf3977d307bf92841ab2b4425c7f7c9c159f67d7879d6b1c82f9476ceaef71c7b366062b9e368879d84466a0d508023fd275fc8190c09d807dea157a0e5b31b97c5af10d8ebd15e8c336881a0bff33e5e5c9044cf914cbe30cf01785152c918a60131351a0b0dc36941e5a0e12e03ceb4a6f731202e203e990723f7bd4b6c7095db3892a8cea6196c838a5d345670868ab6ec1b2728966549587a931790cf71c20bd30e60aee1e421aac8c9a6c83f82ca4e28472e38542cfda2c5338ed964910e5c3936e25d5740120a5130c68bcab4e3e48b9cff7aa6dc64bcf6b2f6232fc63c927426d863adfb18655728578dcdc97cb7d2ec8690b06fd4d11110becb191c8eaa8e669c5f28f14cac9ee348dc9e754717eb0a23bd6e2a3f817362cf6f8dd11073ada99bb40f0bdba8ca16ed1666022cd73f60be5fe530fc0e71128b4321c2f244d14f6f2eb2023d388803a1b05e64f748bb05db76f1fcbd23b7de0e52ef028a073890be2987dad6b6893a4b9e378c3a5169246aa48cbf6adb98d0bbb56e438c1f645a0bbfff8099588f0c80d537fa451a1959dbd6b87d0f99507afc4f41cb407c7556d221594082c008f70ee4254b9ac19d5c4f7f586d71664be74e9f35d5013dd237b82192ed0ff1f81be21ccf6d8190ab23d7ffc9f6ae04c2d16f1718ae8798f51d977fbea395272d954d038b78cc06df9ea2b133e6b664a53f846f9a9943869d70104688a432f4c395867dfa5b6f94409ed75a1229e9b39e5e43d4ad123d61cd0b2a7de3329d505078421e5a6f4cc46fc1737b8e05b030e877a445bffdfacd47b84bf21420b41e997c799fdb3e78d587f54ba94a63aa0e833d4432b7e1606e1c0b098837a42d082d592bd49ea4ea98d3ebaa14a09154e77763fa2d5a712bbf81d3be4d16dc12b6896c9d580bb2da4e9875ee9f59d5afed66d3616c6e9aa41cd83e1a6b681f326008bcbb791a9d1d3d28510c901e7651d708cd6081c7822dfe6d0fa44923cfe2a70329e0d4b4ca3394c1127d30a91cf6ae826380e10d4452992747bb6a4d37cfa4b94521f96d413efbe6126b377d8278231a1432abc2327c372e616f60493c23f05502b3ab3dd8a6e9df01e73ca6f409123fad121dea58a522ea42d420a6ac9a4fc60d40d5be4b50510d5322120b14d5e2161d76f126a77d33184e45df24b39041cde06917365653149e85475e7d2e5b3834689d105178b373587a4e11956726ebcabcb99ff8645146893eaa20481b5f4acbc9747fcede05ca9e9bec1fa8bde611ef18b994fce1228f5623575ef274007bd9407d8049ae45324acbcd095aca3e9c252f04fdc9c73494939afc17424ab4cbf9327cdc6034eade163a301cf4e90a09d33f1400bdf618dbc4ea29e8c223aea5ef304990888c38e3e68263a341771ec8f4684ee60eb30f694bc822531f6e87a010cafece80112ff559406e90f6581971820e0a6f61fa3477e499d2485e18cd477078bf12f4d99b849707f9dd8f52c3a4238f8603d23eb4955467e681251ae2cf47de01ebad15d8ca56692301e7a5774c36737054103f335455f66f8eed80c4e47df0a048ba908664a605c090452ea297b3c4dcad4753774f51ca470c094c4af5d4705173e21a987dec57586d4cf3fc4b92764375714ad0b58922e80214ba42e46ef8d58bc5eb8ffc1ede9b62112953ffdc700d35b617495906442fb9f5b2648f1edc1346c75566bb17c56597d795b152f797f0b133784c104ee647479cbc8967a0c1dbb5fc4e72cbf0f8ce07030fc322ba9f410933fb7d4b673c43a5c009c47f2525a3674a16dbf07e8b79095eb15107c2eb4371c51af71c6966d5d44fa7e921ccd0a7aba02946ef8c4cd0c5a6396ec8d54cb3bd72380a8292590d650f65f6d827be50838e0a59a64ba731e620b19fe9e33ab3984f25f08e922d1f9e3aaf77c719da77735697f0526bd93ae1283920bd2e8ad89b22590a73f1ec60094de4e1dc118b4d0dd014b9cb2cc0b570766e5b88302b0f2010dd58dabe6b056978d51f6dfcaa71a14914113e539ba438bc102443fadfa8f7e8491d1630c81cfc28de80175f1fefb80f2fbdcaf4660143c05be097e5f443b9e975731dbb599486be878ba1015f14db8187052a623ce76442139348e370a6d08d722f29529b599553fe40b65d64c3ac1f4607efc9f1f4e872a748a435e70d3c843def099d448e0831d977a7e450f869669a3d49774c46f82a0275a0146c32e4e7be2181de9ac73485807c4e3518c561ecc1139201758270786659736735e49da2304f4fd2767e0eb0c66c764b1013b204dac0c1927abd6ed76a2961eb00680f83a401e5c951cb4918c7e9b34a18315ff3c2eac497dba2e90962098c9fa24dc6bfc68e6baee14f9a15097f60a6eea262130dcb873e87eea6d3c2dcd2f804d5786aaa17cef20765138069c78139dc4f699f631a4029b3936b8e71d451e22ab9b72a6804632378591d3fdce11516239f6709f1908e78783bb06a981cd35006352a8d94d2242016b9033add6d1bf9b3331013294413a2a56cc772ea6344e144bb50f00407397de538de9f61c038f236b71da28696771831bba6e3a60b1fcce821502ba0d3e78a93760aca407395b19197349f28b0512f73432d7830b2cd5e877ead479b9179192c02e14a48c12fe015f0c137fdfd56e4899acd5a30d42b88e51de06c7d1b1e0d73d681e8b9ba2e85d8e85e83dd09c414da3464d19837fe8dc44aafb2d08b8749abe630e679f5e983b2ee4743cf7e79390d640ea4edf071154a3dfd9a553c5f4c53a980f19c4fb7764f37dbd7c312cbf9563a24a387d20c7c591e3b5712831fa7636b2a1d5ebce51a6b322197bfee3cee93026eddbca4abc0ef02beedbf8eb73c69f4d873cda8936ed0433ee5ddb156cfb47e50ca31db8e7e2d0e014db60d2257eeefa47e7fa69f206ff62eade550c7c66c892e4d054878ce2dc46923bdae19b86d57d5301b12ce24dc8230bea2157b2270079e8cec6e75f693365a09ef5816dee04eab30ed7d4d7331af4a8f229417cce851dc4e9d585640bcaeac46198c000c53e1bae194746f0a79106342dcbc37dd2447cd93e6cb0fb25bfcaf9882cc11d0d2e5e2ee60850505941403188015192e2eb1e23adb14250f3424ecb9aff85469a2f02cf6243e20224bf19678bd7de16663a93d4ab86163f17bc313cb97b", + "aes256": "f54ba887fb5bc0e38011a0e7445cc56b4aad153ac6230f0fcc292788b4535441fc03bcbf9f0494fb77f96d7517e0c25d3a25a89b84b107afd3e9e7671e4a8c115aa000faa682377b16b9cf8df569e570409d7de1887cf9bb89193aa7ab891f1648721fbc21f198050b3d4e047537a560e8200be35a894c59dd2fe3ae3a794be55222b358e9bf914c32eac63eeccda649e7963b76dcb5fddc2835d0fd8729e7a017950cffeb50c02a3c539f7945df313af8b37b8af5a56c1626a69e19526ed6028e8e0bda2dc0ab9e7640ae0f9d125a4aec49d53d651e35ff636d27e136fd7ce2ee3d28e6be88f15351e6424012591c0e8199b3d1e83e46273a041530d8728bfb4e28c6c4e85993ce85483d2dee0c7a386100b3874e7125fa36d5dd0e8f71e8fcd6e17ca5178d1e3315aed27f636f571500799ac27f4ead39ad8b1edd54f9d9926f9592ab981cf90d73ff2ec91d63c0a4e6667b691f3ad5dab11d471be3b381ed41d8d3de4084e40ac189ad53bb37a38c428cd9353c83ed6274b24b412e5f2077a62dad3a282f2c84349569b8736ad2750b7eebf844b12e40017c13c64653b96a4736e2e74bffe217674883b78f526e80b4644515b99a5f99f223ec74e1157d199c8e57d6c1f76a023e59f0a2b663fb7e6b17e0da2a3b8c292c475bb512acd76b4d97f785ba2a83064949b82f141cd492ee6db0c3234731299efc004ac6df8a752639031aaa9104d0c999d0e733ae18bb0f1626b605cd6a0635e0516575d984fc4e273de7e6b398f3f315a0031258992e59835d7296d3c54aa5497459412b9a5b52cf0b0c4b19978d3d60bf4e0c26587f564298d2b917238a9f6baa1e8804c3949857ebd9309dcf31260e794862d87cc100ab4d66aba2cc1b3d2291b7a926a9f72b2040925a58f967870b69df6b009f4830fcdff9c40466426d972de3b1c9d721767269a76e44e1d0d30580ab5cc47f851843a629cc9d5f9d0f1afec35cc49915fa4f7c447c36de38c126a3cdd1735906a4f7e4c452d16a19494c158e7c46c77d6f0f890faa8536a78815b25b544eef61e516e8dbdbd88e479e35890e1d1898bc7f9cb3b3cb35b29c0cfc9c1d66c54b845f81d22794780465da1087fdc997a9ee5672f92bf0b38d8d3e5310d121e0bcb8331fd93498c43ee7506cc16d194fee7d583242b096f83247d0972705d1b3bb5bd800596c22ad623673d348a2fec3284557760c1e6d07fe3a269ae4a6a6fac6c93969777d67c6de52f3433160d08f70d43e00ab2ea62770bc52f83bf060ae8dc748225fb66e9d23c07cb74d8e671e922c2634ff4d284d01693b366378aa6cbda0296b3828be578be60c4b37832dda4b8f86b943f77fc42dfdde65193d71b26bbbf91ee479408592ac86a347b4ac068d77dbb8702fe89d58ac75038409e357cf8b4db82fa148ec6c8daf25e9ebaee57579572f497b1da783eca255ee8ae0485a465455c2435aab98b8c559e9b3fc72720fe47c02ca76c068e54f287debb9b9c80cc6fe63ea9da42ee9a0552983d0161dc281e55f26b762ce5c0db5a019560b32e58b249e32fd6bbf25634c2a115966c136199b9ffba10cb948ccb144642ef64cabad21bbe12509104b4b093e9e25e6081854240c988fdb2fd1cf3d9f89fa83cf60cfb1bb8ee9085a1f3daec6bae9913f8ac40aec60d403c47db27f40c64c58f4375c09f06c4cf47486c77eb63db6ce702e58190b2afc758b81c9a8a3958627d8f95bf6d3db756aa35978d4e7633af2f2874e7c1a2a9f30d35f2a3f88b58f62baa64c931ddf12736641bc25d7ed6938218d5958ee4727ae850ed91a71d71a492b2cb54167ef43ee1fd4e1049f8e9a1789a87ba77607109eb64977cc0561ed4d46588d46284a4ba730886d4064ca77ccdeb4c4ced9e186c78075cdabdb549b333d6671dc966d32ebad204c96a412499725571491c47aa80d519d2f48d51ef1c292d9cdc9f08719ade9c8a1ad51a9932815174035a9f82e62b131e44c92c4415a99a394c29083b748e23b0d05a9c1733db3bf598293d5d501f68ae0f1710253ed48123f294154e2b9b88f9033d4cc1d61739150d656ab9ec79e55067bb22d9ff05cb5c3988237fa1f4e92d311ac813c0ee33ae25dc244a392d1b9a19bb9076711f807107a27c7db59b4fc078a5d4dcef82d0ee3b62ed5f000426ceb5eded4fcab1f15935d23951e8122cb23d078c6db2f546219aea13f17c837f84c7cc4f83042db70760bbc0a2d5a70f9af04ac38e3b18240e520584ceb489937ebf609c2961cc165083f94b59be2875b9b8fb83300efeda3d85ad533719513119f835f09b5bda3c9050c9e8cd5a67432e5fedf7498850c324f8a0e5941e45ce7fe69fa06426ae8411d0843a68a61658777c4c6fb5a570f96bdec0a89adaa9cfd31128aea7c441d9a04e86ad20817eb64563553f056d9482b9259d6ccfbf40219a42c519ed9f9c3b1d418822605db08f9e914b8bb9812bd2f234b9272ccdf2bb2d9314469d0fe824534a85c4fdb6e0bb81130637ea1b953ff9ffa00b62f86065ba32ddb975198aac1e0a71f64b03152885f51bf758d7b03f1ceb587d424ca87a79762c66ff1c537b3b5abbdd38470a96a0c9e4a3f85160d2dc89b81e870fb7aab63831482028c1c70d4d221abd06f74d529178539307f2aedb432ba6f19ea5cb3c02cc22318cf2c2d9084fd694970c725a8773773c5fbaacdbf297134b495e8e0ee2e03fd3fdd2d25e4b77d7b2831c78fb5213bd6c7b32ca600eb524bf72119c894467069f5e0dc183d591f6ca8c13e0686760e4c37a7ed470f9e15673861cedf69b7af0712a067c08a3e2854d95c8e29553674f2837927d23bdb111c7bec80786e8c8778978f5cff9eb7565ce5e7ab7f91fb8c0733e575ffa07613732ac9eb994d0c6e37fc8765ba37d1dad6c38d2c88f92757ebcf5c637c40995766b753e9fe403e8015129f49469bae99101c696883300743de15201253d4d2574aecdfb91281967a0f61353c0d1b223cbde2447530e508fa64b87e53621f2b1fffbe322d9b1384418fd80912e7147b3234cc40a803048f13266131a09ae4c6bc51de64568e722377d37bb0a4584209f552cac149209f1f7299a47c68a76c14d7cb5eeb62b3da147b4d8ef7d2e4c6f6621d36c622c0633fc401ab5e20e9807ee68080532248f7cf3aa84ed6297de3da33b6c22476ef1a09c9603f87653cd29ae87f3ff2bf42fcac26c7a346077d321b527d63a8e0917eea5c00210885a666010ad049cd239326614ec47a2d6946293f1e305f27dc61f923c80b4393aa7fcf29c930eeffe0e7b0e66010d9f2be2314fbcb3b1c0585e897e2b8e0c96149576d17639b9c5c127b48a7d9487a99107e07ecc164a53f95ea9a01f5f577302feed514ae1f2e6e8c3449df48c7b47a96723d719be4ccc5fa19876dfd02134fd517e68830bcb8a4e60dd3af6dfb1b9a2b2f93c7c579c254d677c690446c4d63ac6d9b2910924e0908878475ccc0d057b24fa1d1663c2a5afb8e49458b30f63c6ba6d85ed1173dbdc6030f9ca2659f8541ace6e1ae5cf8d039f384382e07405b0bcc3a509f002fd234c4d8b03259e198ffc7ca2f445079e3518ca6d8bebba2ee87e4be24992258ba444b2daab73d0cf4e93650c9d1cc3a68b5edfdce3debfd42ff80868581121368b4a13e706795683f73021e1fc17124e89f5caf96960d55bc8597857c0f0c15cdd019af5cd5301a76df4049bfac6c6ce74239508e7d3e4badede7706953e484d4b591251aae0e2e18e847bc26067ea40eced7aa5bff0795efde073a5622d630b21d4b322718a1bf366651913f05ed56c5e44b9775841f91333a70a137389a3563726caed3309645a6de80d9fb9f779bff811ed295e754b238045f1c8e6b60b5f2524598cb5169ed1d92be26243864c79201c2d6fdba6f6a4f3dc73f651c9808db7631b3dc8a52bb594e17e7a72f5f510b5c8c6150e9be78fd24500ffcdb04d0cb324c39288d9fe9ef82f8678b121af069584cdb4e2727cc4865201ac3a5692092974ef6ce633bda3f2f60732f1042640849468203a447adf7fe68ef9eb6b102eb7e0c8fa67dbb56288e656c0d85eb6bb0ea9a25cd116e8af7e2ae4bd9867c220d7b0526ee2b33f9991da41c3b9fa6f6e4fd9d7b293d4ce7968ced329628262c890f24c58c8439869f9778", + "aes-128-cfb": "5466db5b0d21a342e741fb6d29b54922ec83b1d7c6fe86727c068193081436cb5265c884621ecf54d5c52e4875d0f2c50eea876e0a83aa4cfd6a6fd8af48e95217fde1fed970642ab4e5be79cf8eb1fa929ff68135f3e562163bae09db92b11d15f692193f85f6f7b93ad1261b2949ec73c0ed9e71dafaafe94c9995f0227b21ea74552d607e8e5963196c728cd4ca7a37d322a4f6023f82dbbdf749c7c1b259705c38c9da94e0d8efc49ca707ddd7de5f8ba360d7389d276ad9810cfb7e4e797dccd3af57bbf9dd9a32935fa930b2c3f8bbbfac15e9fc2ac2b2447b254340a4e9c94457dbd2ca067086f4ffe2cba39b55dad3bffc35aa80efe52ce7b851188381f298d887760e40dc1886872f05a45b77965bac5ae30d09ec8f9a9b4e6892086b6a5ecc29eff379d49e0f0b89b4e8efb3e26579b9d467f78e643b844c113d21db4b7a126d2bc031b8b5836cac3e347856fc68b2a8d45f8d132ac2064a9b316a66f408169bbf43d609729855b3b19f4ac357ee518a64a92636762364b7e4da88e7d856ebeb323823e0d4375ee0bc28ea5237182a5f5f23e820379ddf187e9f58f368845395c48892b62c81ec986ff0eaa456829901eb6d6ccfb99614c99d4d905bf202f1ed851a09d928d91c2e5e93a30bcdf09ac88f53239886b96559a229d53c085afedc795022bf1a17393fbdd8c95111f9836b8608b95f48b0d2a13b64e7549e72e3c63bdafce567774b846c4d8911545e56e973c74d21efd004761feca3cc067b9f236a23b0913bd867384ef5e4e713c5d2bdabc09b7d3bc990b8a20d84ed6850561d5c024b1c8dfdc0a9fc45d40b7ef96b148dcd6e932ea51e8f8a7b6255a6d23fa138a777ace6a467a27eb223531533729ce1154c7f1b96bd2452317c4d6490ca1398a048cb79257ce6500e9af668d1565e004836db576a8441b8e523fe3ac02d749725a069f3dc07ec4b98cd489c1a1e74bd94592fab827f144580007ac69ae1f039a62e63ec80d7a077b22918296693d2ed54e7e5fc28173809366fa3cdc23ed5b607a774529f2a3d3fa12ae7bddf7f8b12e18b21d92274c002456a4c39eaf5b6b8deb14cbfdb5d9779675804325b06324014f853ae0ea88b30c31c7583bf209995f412515064e940da5ad088a7f39610ee4868a39a5efedfb169ddbe9fbc3b3b6993b90adb63a0b37ad78ad3671571340bb3a9ad36a58e529d8a3dcd76cbc60407bc4dbc48dd022a2abfc679b6ee710f8b1953969a9c1fee100ee90967b62483a2c1588bd73a405ab99c696547e53071b0a40971b67c2b6bd6ceafdc461b78a648433683607844cb7b32e118cd6bf82586a741b5b0e52691f507b1f2bf7037bef190c5d1f15cdcd33b2b48e44a7f5322a6cae527150731be762a9781e5e677b2770b49eea0339d65d826de8ec997d1c6e3f302c87f913ec18fd2ad27f8e4e8e2c5b6dfbc17470632cec9752c91e2ad6329e0aeb856bc3a15990a5fa2083636edba04ae4b856e8af2108bafaf47d1d44235cdc005432a513906971e656ba41e06f60dc9fad9c08bda8d6eb352f6175b04bff57f8547f01cb8ba2eebc657568b21898400e9b60ca628c8c0490f6abe1231cf2d508d0d9eac78715efa8eee5cdd7dab28fb0785ee7dce211f9af36599149f6b96121f3fbd50370f1e5f918f45f6e80c48f665804c0dae3c4404004a0c56704d390beb6aecd731834aad3f73959ee407dedf268f95737afb2617fc0a366f484f13ea4514916a754f0b5731d8824b33810f7fcb0488c053fcb863d4ead61b7fca5150a27de842d9a75c09f4273c735d02a969efab8fae835591d3f0fdd4eb9e24417dd41cba944abb0fbd8e5e3edbb11902be5341b01edc0a3341a7e716bd7ef986c8404413386f498f764752317e17647a243fae2e8aa02b229a9f8cebed0f3ece25a59ae0314708d8755b29f8bc3a12f2f73fa248f748147541f581f16bc683f4728f8a6deb608c72f67609324ed323ae134131c7acbc042128af14481f39760208eba6aacee8b390759b6eb83e099b6bf0b31703b2135514a9fb142c5cc65e0547a0f716c5aa75471d7bdf3ce8e9ef92ac3904533255e4db084495719a8044a52e631ab6c274672829f20e34d4a7d016bef62a91b2aafae0209a40ca7da399cdcec6ef2d09d0e0b64e2f90f91615199d5e94df71e37f43f52bdb65cca4c330145fd7d689b49acc369712b2fa2885a387fb20cc397e208869e77d7606cf91adb1efb767d16af1821e862a2fd6827968b91d9d4b1004cf7d21fb1e580c8f7b337e5f56d7856049b5d63569ab6c1c2e96797be7782479014e3a6d5a086c656a197ce5771e493b5a56956bb45ddd3a2090a05b3d52093fffd3b79dd30aaafb305d9e92609b82837e6970c29a3461fab197932cab77f2eec28cd3caf81d1a86547494131f61972fd060b93fa57c60b5a1561a56611ad5d3f820634551a7f30295128f75fc9a2764ba402166cc2782ed1e721e5ec8bd4cce088f96c13c39faf46c0280e42111a972321f034a7deccd67e92f233ba3e8e98e15acdcbd1b7cd6d54a200cb271752fd77fa8d856dfcdb3289ab18f84be355d9906fc22c4c30be4021b0e794d2e14b8ed334118f6f5b1828df7f4e326ec796d21b539ca53eaf78027d0bdbb0edb18dbe7f6295df95e1b36e3dd2e30d8e0865c7f0629485b9c9ca7c6c0d63e53fce7f701eee574c5d1cc60d776c590835a6e1b4c0d56290823ad49b2ca71f385ae7e32af2236070a7e152751fd030af5a1667498346a7b20b4247530d2d45e51e90d5e83b0c96c5120631418ea060c7c3c56950234e1d2b012875844ab8a87804b4fd2e0cb53fa206967eb3b3b38f577bdf62e8038684fa67e5734b8707be518ba96189552c3237a098705a5ba910dd83b3d1e8697836dd2834bde41ca0414cfad52af7ffadbf9e7b1f62f22b8e8865e290cf658816faaad48e17f32a31f5281b4599888a3f704e5f14dce088850595fb9134b403395b53751df9c9e666b652b53ca0eb50217b7e17bbe127e10b1acb44603793ee379d0f70307a7d74dbed8e1cd80450ea144f328182e0f2265cc0919e94e2648385ada73ccce31a27b28dfa0b7b8f4639cd61add55b79b9f69410e3a9959982c4287000bd66edadf97016d01a6249e304dbe46d989e45a77a7fbb7631e6d7c55afc7b2c02c9b5d531c5fb40d8c12f18552887d50a54d32249e894d22e8722567176f19f41f656897be5e2a4f2f47a07abe4bf344fbe911fa09169b7bb9513c6586e26ace17d244b3d23ec5c94d649b8a08d2fe850a938a868161b6c877e1ed32831d2b8824cb00e487e000275439603a168067a902a175d45a7bb074189ecb7fbcfff7823327efaa5146163dd6cb9e02ce3479a180f6be3723e310a8e0d89a63c79e843bba86fe89ca6866c649d1f06ce70bfdea0a7585b16cd4c1e211fe9d70fcf4bde9d60f4ce69ea188f1fd6a5c32c551b6f33e30932cfb3558d50170704d7f700eeacb4d324c8b512500699d41db9bc3b38b5a362bbbde6762aaa48048fcd60b271620a13d2ada8171eb5f184884900eceffa07e7b744146aaa9f7a15668b10e87c8341fcf7df01e0a1c9ab964a4d6f09d42be40621446429ff8a80874162a0e0b9cf1176473c5f8a83cebb2f087433afe481175e6bd4b05518a0d79c026b1e7a3bf683b2329e245ebcd8a22f3404d5581c167ec855b664c839eb92184ea5ff1c794559fef833f0acb0a52832efcfbb0c39bd06d0158491dcb3678c450ac1acc641d5b132c26ff7d9023e299a9e5f754c3c0b80933f2a29aa08ebb8a10d3915accbd230397e8509f51dde178ef0372cbf357540d15f1f25e05f92ed4008bd684e4d89957581ea939a3a1c19738d445295a048d7197e664930b6a61c15242169a1b031127d9965dca89feab3d1942feab0174f642d266125266654317f6d138e77e9fd408324603d5f61645b3360d105587d1cd9890ebc938acc861074464afaa7772d0659ba382ff341eac7f01d624c363912796fb3083601c8638f20ddd671a11a8c16fef0398d1c84f95eb894466062c5cf6eca1d98024b767edd7cbd0e60484f04b52f085c2592fdbc9abeb1d65f2bdaa957572a37c7842262b0dae7e2e9f515ad9d61c3235f2cdfb8285a1151eabccd10b0781154e555cb431f3f96addfc", + "aes-192-cfb": "7d9a02b92d507a8343eaf3a0e2a0ce29f9c80997123f0a6e5642073f63de69f6af9131d09fbebdb9ae57d955e0adfb39589fbd5d000ad2b536627aafcedf3619626ab060cc5b5e198bff358ea40ca763dc90bc72d63aa938f75289616b683b939b73b85794f941238c3a71b6e5125fe492ff7a7ffd53b5b7375c95e4437329af73bc420562471bf267c1aaab72c1546ff3a47a125beadd6af046fc0103e97864d2f4f5a1cb3c6ef1e886451eee2a67205bc905a51c4ef030be88059f01fc0f01211b19824c256da8a84231e460b9d05e405ca5b96f7c18d1b6da8060faef8a785c1ea4f801c5a0ddcbee02e771f5e3302e0da7e59c652884468bdae7a3bff22cfc9eb03be4dd576f9afb408b5f82dc9a78955d15dd4d9270699a3655a2d0f4b83f003d021c0fa260e79d665f97769efa7b2df681cc7f24e93f7d82d97634ffc9fd37200a2ec543b8302263dbc7fb4f9e46a9824ff28c8f4d21c00712990830dbeaded5b53677c0231bb47a87a0455321204c4bf9b18fc078bbc0aeb7f050dc0c484e23a17eb7aa29cf5338a6957d56162909e7a9685a78d0ffb2f2202af64d80a6b1cc9fc7771354a17d0a853cc26acaf577e3e82bb4a790f160a14384ca2ed7ef59e9edb0151b4e32af55b7f9d90e94527c991256b18948c7d4b0b621b1fbfe2ad9465376631c13c59dee2ff561e84d205cf3a7f031f79094c31db66a90291f33e6c51b74b2d6a35f9c8b6c8ee119b2fd427c89f8a0623ecb1bde64872f881185c2cfc6afe9584029a8be0e8791f85710583dbdef706ecfc442d594cab24b99639198c8317f0c3feccc68bf22c7d8aecffb891229f4e55dac47939f40c8a28c5520d2cb90d8efe53c017e5a3cb3c67bed554086c15a3c8db345134daeea49ba69d3942f9549a2036b5ef7e4aa6bd4d5cde3874084ccc8657e92f6312a324857c9d8c9d29fe0ef02bd0ede33aacf347d04f29d3fa0f6c1b3e5756d517c780b870176baa31f830fc58aac629725ae1f0db5bbf24509d8250693946656bb548dce196300af7684769fa895867d9c2c570844bcf0fc37f63bbbcad836b0f0294c8fea5e7bf7429b8b052ad77201f584154ea47cc94a5b3697aec1d0357c524cd6e5e48bae49bdfce40b24d35cd0e943a8dea84b4957882cdcbdbca83dcbb9ea46d5576386720d06f552d3cd67e659e0f183fd9e0dfd81f9cf6d1dbc41eada7ee9ed0ad857c046a5ecef1af2a370b425cf7a64bb0f1a3e0955c9ff28a5faa62e4c3a9c1f607f552626bc96c5d225d8b082787c8271b06be79b4205be37403ce3de387ed61f86afebca30a46f4076a67db247ce5e2316956962f6afc3325742d159bfc8f465e2b4a601f25568546132a26a302473300559ee2ad5ed92f32fda2649adfd41b6ac13173e166c58d8e444f2bfcfa3364d83a39a5629fe48e654d6eec106ff2da30dbd14a1150021af79e8120bf15e446c20a215eff3193473aa915669d9e27f6d8f8b8b6f4725cbc4ed1b4f601e5ace18afd4a3f3eca072975e1d6ae9dad97ba0d96396f1a6e880ae997cea5c86d716e4745beda9fc2b0acd1237a8e1c3b1b3482423e593d63414ccc2bdba266a96cd44de9df39ec6c69b5c33a60f8fad35d6c0ed4289be23b70f301d6334a5dd9d7c43b2f1c2d5c538a6bee6d80f43de36539ecf4e6daa9d852553598a7007ba266d813a4decba0e8d3477bcec979fa4623742afd573de8be59dd24f600a13d05df76ef6a8baed434e914f450031f47ecd9e8f7074fbad328624239ff5da8c6b78b8c52397c3e1cc1e89ed511ebb324520849e1182bc6660c45930dfe1c1e4e11094d2502444ba63d0b3fb37b8845c0d2b4bc0864735c73c61f86016c84b115f5d0f103cfc0cf49c0c18e1096ceb61d0fa465dcecab931d19ef8483e068389425d6367b9f857f93e4f97cd0732e25508ae500cbeaccd3396576d527d89ba21b4ddfbdd43111e173ded5410f0b62780981f4e2e5bb921ec029eead2f36e7268d86ee772ad269a1cb07210e54e7ac2014a8c4efb1b18e773aa5bd492dc158b951d05fe909f2fffae25731554047fe3f489a19318e991916659b13d4712105f2cdf0a6fc0f58d3cbfefa1e13be7d7a91a1c8b6d4a624487009696dcd7901ec98507bfcec1717a8b01e87489125590a5d8669b2828d7e41f5674a3a9ce7eda5c6f009826ae00a1ae049aa0de3c6f811e329cfb9f4e97089f82dda024b5b70994c0a68fd7fc647deea75cffcc3903da912b56a1e0c4ebf0b1b58dd1b0f78556db67cec933c50e29658b0487d1e8050c485e72663a261b9c44ef4af95fcb321f520d5d29e328cee28f7419e19d01acc197dc72a5700a05d0d55b9aaaadc9b11a2ba553bcc592b3d16daf6e6185609fb63106c3335a122f40b36af4a0361113885b25a83a1b6c03266a288f9d08be1f646a13a52d505fda88906a375935e2c0a212cdfb07cf62f1595cb65141307217cd0cbd9e1bfc93c409361e7841a72b9a1ff8db7ae2f4635c55c421ebf32c3c541aa97ec5cf8715cd97f1d45c9805d10df00ead4ee602b57c14b9334313a59a063d8de90c3c39ed75c56819f0da7df86b66cb38ef809dcfd51b586beca177c3c501bc5ff43ebe263b228a8ff92ef840aa0cc88820abe60572b7dd30c127da093f7b25cf8cb249524aa9b64215dad5da8e84f24395165857bdbb38e4eae5633efb28f344eb2678359f9b3efa9f4a44db0bb2886ab9e29a3ba7c02205d26bc274f62e6e65dad8edfc473538701e5e365b919cd5f2161c4c51f9d91c24ef9be7e9903afadf113ee9efe4c6fde8af4877143906bf4c73e342a50ecb6feb2de461164b5a430eca49141d660df579046126f7cc441f8bbb907136125fd3e6bba241b024d62126e418a4d257e4989b86a1feec9d1a82b10e0b1b41ce17cb1afbdf786c01593db222e14e11201ee9c3383d4edabb61a988d93a1e11756110cdbceb1db486ea096b40c03b9b1c0f0fc1a97de98fbbd155798a97390cf1cb3fd31d046477f6dd104e19f7eef14809c9bce6123daff693bf59156ee523a159ed2925aeae1b1872baf99f960ec2a1e13e6831f922510dabcc306384367046acaf2cd4b188f69be013c779e0cbd5393732c7440fa334cfea5ca83ef84d3002154076af6c154d344113eaa740eb8e813e4951892bc73e78abfaa7bdeaf105ae71e89aa5f4dd67a63d3a12e00bd618efb66ac8515f3524ece2ec579b5741ae9e984b341ff4694c9f4128bc1d59756549191f5f121f1e670597a76cdf2c671c5cf87d2c7816a32328e2c579b24d63aeff830779ab8fc951c4cb01a7283bcff72a49e70c1c8a5513e1daa5eedcae25c831a94a085be5530100c943055f0eecf58ed68de5a622cd305fa2e0d60f8e2c16050ef844c35c22d425b97b12ab33db05b09fc626a88f5f72a94c04ce51c4da5bce45fd15226acc689f9b1b52bcbb5148eeaa82a51edffcf2e9fe5b7f9e2b6fad6a6906aca833084d001a80cde8be8894dd3a1ef4a4fbe5eb20667564a9d9b449e0203f7897e27c10a97947e9f4027c1e2575e2d97be072cf4ba0f22044598de17d3245a31a51f5227292a924b8446a1659d9c8100256aa163ba5f4fa0941d79736aeedfe38bc9209b1ad779cf85024edd61a6b549c38e92cc09f2da762dcd1a8144dc9349c71fb1f4fa118c19c7517c587c3b3c7ad3abafe12787b5b2493d131347e0bc21ed5e6843e93979f4f94c79763c8e5b430dc93e54a507426e6514e7a5dcafca06aa969291d0d36d708a46c88601758da58b732addcee7507f33cd5ba12f294ea38d967b52e5964d3d9d5882d2de6f4def674ec65f2437b4c2903adf8228b3cce9907a6f188512c8071d86c330217424d07f89e4e7a2db04ac452a97be0879bf6fe0d95876f1772554cf3403edae336e0dcbac7909a50019c6d8a04888e0121af7a63c4c8ecf8e98cab100d07584d0e739ee89a16c5d10b4fc82e30ec84b6ee4a3e294bb675e38c8343cdb0430b851b3cd4b1a6d09d22b973f8efc58626614a58cd7b1b2b46c38ec97e13fa58c810263e56551295c5959113b85d3fadb6ed5c2ef70390c828207f5a73e2b326444a6716ffd68ec473af8c56b2fb732b7f751bb35d94184e397923203233c9082a5b8dd32f8e416147f0e6a903d721167e4e5843dd6438ed81c0b4", + "aes-256-cfb": "30ef1fd6e8d7e5c8c275a28721b3ec2dd353de0605ffe4b0a8b93fd52ec62533e347d0352cf2fcab4747ea574b8a2d48a290499f6484d0f8a67f847051daa337d0ba704197f39ba99225403817376c4ef8d9b49629926141fcf2130c65c9a1b8f25776ef1c6e7c071f1e662fdd3900ac87a340a2c34ec56ae62489f34db65adce1d5e671f7594ddadbe2672de86cc9c8447f5643e98c359696292bf6374aa563dd8475ebfb3f8a9ed11e85b34cdaaa292bd0826c3e57803e2c632cd7f1d790783ccc746bbb8bd99d75f0b06a99e17d4c9a7c6840565c8580dfd05a0028555b3f31326d75ae94c368a92bad6af430ed12021f13e44ffb96b205baec3e31e4879aa02c2df38f86c09b69a76bb20d5d94fb58091da22d107f6eaff26c2ba425d18ab416e5b32737e82537fe8af915baad499d59f11607604308310c56a7e267b261dcd7f2cc8a0b9e611b9cebceae6e33fd80ab5ebae93b35cd02320c7fb0d34bae0fb2959320f135564fce16c59e395b1d2ae0fe062026c70a95d73d72361bf200d544f1876ad1ec12b90f5abf54b42b34ca69362ae2e6392a9aead8795f17542ddc393a53d422a044fdbef55066f4ff9dcb1c0e98a4077c01801392e60ee37ad3f5ee1ad91854802274f0954ff35cac685a367bd324212c03f01aa5812427809c896c4a9ac592d2e8192fe424321794a0f4e925c2aac65285819f058c80a585241584bc63326d1457845817f89e0281d3af3762c5d1a761b6e9b41d2a56d3da2b491e4c177a5afcf48c73cf72d2561cd74a27a479cd4ba9ddc39077fff9a338e490793c2a2708ea6950d600ddb4f82130105f86ef379f0aac9be68fbd348af9a357c235562dad743e31dd15412f3770d03b027b95cc8a4085db237b4a7239c267b154cbf3471dd770099647c2c5a1a25dfa99b2d906ea2ccb5c537156e8e2e2c87765f7c4f898aa630614501ceee551944c5d6ff0a2d9973e0bd97049259d1b49260c191c7c92fe3ed533e5deaa110cdb1d24016c29b29f90bf6b59653ac1cf4cd394b4938aeb5883d5f6e581139d1c46921cbe8c3bc9fbbde156296a9052400951275bcd2f05f8c1916f8e420adab2bd3b5bbe334d1974730980b22fcb3e40b67c43d38bd614e46540c54ecb12ba46610cf42edd594758f311540f072631be43b34f152925ff9d4645d7ca34ff3dd3ff7564fc8e30eac458c25dcb0446e248ee19a511a4e87a453b1b88483688a2e2767d9a18beede47e57318369bfbdbc0e1cefe9df10378184874e21dec00fc76d695626589dc89e28a6609288a293356d2c245e2aef00882f290f629500c0eaa819c90ecf6786e16429b06a6b5c58a2fa1421eb07deb7f5213176c6afdd5904bd7c82eb9f2d48b8db52a9d4750bd4b27530b4ea3bc90dbb60af31aa2e63281219329e677867be48811a840bcb252afb1a373a5b5e9e0ceb53f2d95e470db7ddb3ee0215b9a1545c6ac101a3bd7b9a79841939c54807c80938efb4f60f7978a587af724fb62c8ff6d5bf8fd4ac82777c33b1224fb80f163fb1a6cdaa9a6e1c0ce023eddd337714f3dd128cf6e822363d7fafc971d7b0baf9830a84891a39262276ca8b6d8b5057735187c4c838b2e02d01c41cff2039d09214053f0f2a0122d07404c5e142b0a69492b0df296f66bc2bfb98116e8b6519dc8205bd0c96e9662e03434402a596b763c1e7fbf181003fea0ce375ff4c2aeca060acc74ac5b546c13c91d5ac58f23db34208d094d0e3920ed04e090bf9366d5f3ddc671c710fe5fcc78f68f4ffbb241ee0dc29b472473243b9f1e561a1ff343f5f953988366f64315037158cf0d6c79cf5d542b6df13e4e1da383493a13112f21fd2f0a3756101927f8970d7c70ce13fb6d4b2f04153163889adbd65e8030fc5a2c4a6b176e30e941a569d96db8815773d3d3f563dc779844b665d9224d875e054ebc8dfc584392b7de25a90820f65df5a53368908e0c76ae1dd81e2353dc43f49954dd8b16f6d2bb9082dbe44d6ec9177063b4fa390385bcd45782a5997351f8bc24d91f63a42924ba8ed1652ee9fbe1f8de718a43730075c81bbdffc2c2914a1b63b83bfaa0f4044549047410d07593d8a59b5acd2fa62afaa7ecab4f5b2e9ba75bd320c5dda98c1086609225d8bcdeed6e16fc59ba36de179c519326a461a3a4796a37b2211730d650b28734da311f2484c19fecf44fe3c72abcc085e17e57f8dc01c26143b4d9f61aca933043ce8ce57d6b495ea01ce42dabc31dee0a3cb906c2b1cd20101114af1e807823876bc170869b879b530c330a9fceb8ad993df2ee96472c5106ef5e89d116d21c2f482064be86f303ac9fc2c16b45db508998829b3e05b9e42b81009874fa9bcc176ea20cd929607ba54dfd933c9aa9e90c85c6eee04c98b3a24c967150fdb1605720873e88f83794df5a409e593cc52337ac97a7ca32807219ea0f58870dfde923060381ce290ac407f1696bf1928dbe325df5b6fc3cefe49727b91004da465d6bad2578402236b07a1210edc64eb0793ac58c2875476ce6fe105e5de42c58b39825f02a52ce0d17cf986c4c5cf354262c742d1aac90d5e420ed4c919117579467de46886cf5743bd3c1908ace7ff3d7807063f89347aabfc592ca5805da3c508e67a88f715e1531969850e6f2c2939e2f11f622784466cac3f67017cb7cbbc413deccfff3c3d39328ead5c103a8f660bb362f25a49011bf7aadfba22ceadcf37cace4feae6077be28256fbe82ff9b79ca9fc402c0094b098cf61bb8aa0ee0f37aaa58dd7851a3e3a16973dbd7a0bed4a658337888ae2f0d31757ef043703f50dc34ccc0a720a17967d8257925d2fbdc5e8e21b2cf9138f3008c2429436fbd97899bbb0e28f99e339e89389fff8c297c9fa5ea5b13f4b4d992ee87ea477c6b2478f9a4eb929124bcd36196776675e555de884731c53629ed079ed8832218733bdbe5f49cc8ac5ddc677991db258d6f12c567483c359137ec2740c4e26efe09173623503c74b87411c312d295a9976fdc3baa0f9840fcbd81dbf97028bc2102796c8e7887cd7087588a68e7f7658f7f340127ab8acf1e554a59db1c978406069023d095713506750dc5841d28527094ff9063f7ac48580de8c0f27860d7d794609931e5400629bc1e5db9ea85c72ced3780e4fc8e6ebf0566d6886385ef9580a40080df72b7a53c37676d845a0d376836c0b58a32e7a67420d4c497ad9517fd4aa8be82e6a62f220d260ac9b09502af2c75d7a277a06e51cbb5be67d5f4026a51694233f9137d8758a034f822d98cedb9aba719c68744ad233bbe3c2560a7c8f9d8da877d69f76e7351dd9a9ff3edb97d3797561aece5fe4d5b242e4baa2acfeacda3521f2cfe5e83b247f0cbd6fd652df88850b50a7b25378d5484209b5890b6be672be0384a0bb72ade6ff8e2a5c89898b9597f95c3dfd5ab23191af42467943f0187283cf4650d9ba915d67f9e9e17434907e08d1a4e89479563ca48599b32c07d5c077d4c9a2a917bd1c39dae9ba4027cdcbcda1656af1dc81469cda27fe5431a4d691c72064f7d047a1c89634ddd90c133340aa16969474710f7e1a5df47123a118e43841926c14991f3879367130319352cfb53eeb7712e837b12d8a2b25bea57fa9fcae424516b1364947a93dfe223a3376e160081d6f0fe0c127ea368df8f2dab430e2ff74257b04f587677c1f373b47615af582ff2445bba4b68611113fd1f3829b71c2686cceb1558c95ae1cb0df4ddf14f70e628961ee3f6f905e369bca082d1042834ed3f95925fd0d79f184cdf3e277ace3111985426ba114e887f270a963cbdbdf3830854efaa35c3a7a5ed7fab66951d84267ad80c115f69bd7dbc043bb0573ed80c3f0338dc70ada3c6ff2b8b03203657d962e97fb1e2c4a83fa0df2eda06837a56c7fe988b71d72f19a425c5c9c7cfbf82f73d6ae50ac07747a6e9ddbb6acc5434dd61de7a278f83b0529cf2bb145510c60bbc7e422874900e33d8ebe4a020b05b6792952929dcd133ce5e0e9a504d26e0ea138b8f4f069bcf5163e02294f61364d3a2a51b1c41d2893bb46899a938d745681a618d83b6dcb2a59bf11136810487fe6090ab561490aa6422e8e09d4e455409888323b8ff1bce3e0aad9870dbaf855b34d6acb0f0146c23e8606a36339a9b0a0", + "aes-128-ofb": "5466db5b0d21a342e741fb6d29b5492237f6a6fa2b58b1190b94a21710f0335d433508ba4c6a79f8258e604b66aa14997a7d3eca8482b95365bf36312f79d3e8f686a0ad2c95bd9a188cc4f59535d1b2129df407b072b27d8f5e99f2b5f67fa80c85bb3a25d8532a026342bb448af609cec73984ea1ab07322773ed6bb3ad184ec276f56bc836ec5f18a92b08e1b82a2788131a9cba358980377de75b3bd221401adcf927558921f6300ae6d606c3fabc058c42df2afd289dc2124e10b69deba1104637a74728b10e36e8bf685136d21a8fe9128db89a177ae7a942124cfe755c1991ab0231ef8e74a37d42b9fcd9d4afc28e4ad005fa4e1c4d62e09098f9dafbf8422510ef15a62fdec3ba75867081157b7361324b1b4113534ab0bd3ab1af9ca8f8a8cf34eeb92837fca3b25a23a31f1ef8260e24c1bac812aa82915180786fb1f792eba1a22f3dc1994e446ff63af49025e64cfb5b43e3df8e5c609be59b8061145e30f39cf24a1b29942f10c0d73c98e080d56fe1e5817ee2fcdf945759cb2835353478c17acef5e50997040c83050aa11e31b92d2f688ca51a3a6f3a27755d40485b245b66f44ddc58ac2216099ca70e8b9131bc7d3865ee93a4b95fe41bb4a8b33e12e5dfb8af30e7e71d1f1c552b8b25b2825ececb99ef4d534f61e748c5b7ed581183a4e8da708d6db0af0c6a45b66b5c2f25e478cd6e449c73526ee04e3634ee54f06182b89e3336892921aeb74810599b0bee40277850c48770162043051559f78bf1f6262617c506c382341413b783d92b568800914571419ee3f41ed186a08c729b391b92af5edaa6ea29194165b5027a19ce49e9a8f2f2a35aeb9af674a75ac10cc46a81cfdac32778e9f6adc1ea7f036ad0922c8483a725a85714e5d87747c58e840d6a59ab1b846ac18a62c72a407fca8b9dc77d18f50eed6dd284839c048eb074f38e03f0564a31bb5b546219a6804d479df09cbbbbdc1e852a4a72dc1468498d78c31e64cd284d555a109d87aedf4ca725e680e2840c3e64c1d1e67d01d9664dfedd1d2e0c679fd9a6dccc91ef6d8f11d2dfeb3bc18534280d38fac302e7cc9fb8c97d8971399a5cc0a1679b96af9e130fa01ba3948c75498dfc8b67888eab39808d5079dca6c92154db13e39eeb4b678a2355582e2b569c12c30ab7afabb94ea03ea74c2c30a14b9fd21403eebf9f67f7152e04000a336e3b2dfd8f466355d7568574e91a0ba945e5dee43179804286313e1d249d5f68def7b9eac5bf22cdc647955eb6cdf6ae8d6ef818121f8f603d988e37c1f651ac300316f1645630b2d07928678b0ed76bd9539a2da6db6ea226606020fadab3c525f846da336d1de1e8eae36998c29b5f1f8b683f833556e62d2915aacbd30cb7ced1a7bc96bddec875967e441b598f645ad6561fce1f9e5fc4738a7d8823d3dcd9c2e3304714586bf9ef0cec29e18444c01c7d6c836f4153ddcd96f296203d299110b48a47cdaa2aea4e27dceceaa154bab38d03b53b54a1442928fb9aec0054f3de631ffb900e51c30809267a6e0c1c229683c9dda98377fb0cb08699dd855dc82b8c06d9b06ad2d1773e732e755f13b3a8772f72d373f12e3c01a97f818c4ce68de578956d5d25aff69cf4281712013a021124dd6b223c3cfa1e9cce9e78baf7434043bf1af7a1940a9459ddcf6bc4236c8f16a8d6e9c422e364548b378da4e831a09a9651a4a535e079e1294ed5b825a89470ad44058527fc2082ec83317dd1e4c024a1af93a2edbe2876a298167256d70f50888eeb5fa4225bc5c3df975f4f22caa4729fc0c35b7f5e25163e9a165a531c5974ed074ad45d9fb3dfff5b2d38b8c01cb6235ea5c2c779368cd9cfe5c6b66a0bee896efdded54ca834adcdc27972eab41c48eae9143869ced32f6d77584a4f2f9dd586aaf9f21418f8b5b674aadb30f29070e713b790b9524ac871d55d0037de867e0245f4434ae344207641ae61da731d527cb6a6bab0f0bacf3a02f7aefa6afaaa6cc52226ed4b7b9f65e96986d31e2cc0225aa7f07bc7c02989ee0842580f728fc8f6337370ada58127c3137811a0bdf1fb3e5929fa688abccdaabfafa7c1ef858f4ee488b0f0aa436734d3fde5e037a30fc04f52234da16ecd67bf518f2009b9874b0ee8283be590e1cfe4693f303c6fb148120fdb22943efcd67ebb24a81db16085b2ed614c007ff4a977e4a5b91131c5e2b2feb1ba10cefbed7bd09f2c09fba3d403606c49a44d0ff3f37078ca455eb24745f905d2c7ba509853c79f02b6141d2bcae1cd560129cfd3c3ecbdfc909a8f9e9baed80ccd34472967a6eaa7facdce12641a977f9fba34e2f0316bee447e68dc354a8b8a827420826ec0e75d4d5dbbfc557405bd8a90884061e0c008233621e567fe34a764dc128a55a938bfc67a84024233c6dd1d86d67c7678c9ce6cb0a22d5c54bd53150f90b6d1845d7f8acdcef529f18ea6a60c43aed202aecf5f296b08445c093b3782b70d0607879d02e6434bb3e460f5c126fa6e4cb2c602400fe87312ab6e429150852cf9474e3abde1963f1f0c1e296ea6d58ac9c4c724a4f01f8c5481ddc8605a54477b4e49373b5a5981acff838a83a5bdc00b72c3e022456554fc393f1c2bc4879e31e0e88e891b69c9a46ba05e80b4edc65f1b297170d18320b89f267bfbc1d67f4232406e1eca37b3191ed46a424065e8536324df2b78c523e25114b708e2180e8b2f48d86fc613da29e856854d9f97566fa743f4db5fe9756060dc8592cf537dd781eff5923b847e5c397d84bf0f7770db861f71d7cff86aa62cf12415e885eb41dd734729d6384398231d03c08852bf015a520532a35dd44f7a208ee38ba77092f96d0efedf622d330e14da428d99699dd89786ce37d6906008d81ab8a344d11c372b9b54f3b4108af12dc340b0e987480588f4cd5dbbf6fbe5c1c9d51acf5cc456ad209d07471b002fcf5b55a8f502c744784fb81de46ace7de5100f6900714d7d0123023240b0815f6ed8f856c27833a842f5abf74601da0b2f5d6fb724eca27575c82751ab1beea8ea9908b481e4aa0e48b6dfe0c36235522f585a6cde6c448c51a313a574ee3a104834ad9452dbdba8fd23b990e2910d12fb51b647addece6ac6359f017bc1e3ea8f2214cdc73e312e38e4aef9ac497e9f3bdb0ba8cf0315f951c3b773987bed99701af4ff9c94c5bce37f901e21895dc2d51ad135694bd88212e734e97f1b43f789423753e1c18c9ae207671be9c49b6e46d90aa71d24291de9cbf10e6b04278caba1fc58a2d8a53b6c5e6d4f5f92a8b84c7aab5e33887addd3614d4cac2d7e860bf84b1c9a1bb54b583f771f98907ecd0e93fccfa5ac61e72e1af608ca97c6dbebff0d88a87dc618ec41dd67950826d4bbe3b6983fbe9767dd7b3f171bbdec632aae6105932b22f825606fc566337703b9be7957d1e3a04b37a8efa0c336fd6906f96b08a6211a64f25a4c3b4211d2b901c192b1767039136b50f0cf240ee15435755cbc64d8374ac2c69b64e58ce58efe9c252ffe28b78a5a619ff11e874d528bd1bff8be38d18c636841ead63b823c3b5ab40e2c7e73f6a3c54da719ee5814bfbc5f20a91243a79db8af94680a307c530d53b9f98065f1636e5a6193f71d4f2f41d9e8585821891dc92c92c3b6bf3f1b61ea499865f44bc80f62c3003077e37f5cfef60467bb6e2c38efbe60da9f06a35d303687bde2d9999796e563b27a29561108a06f5c58314ada4f010416e9dd93a7b358817358ae519eeafc984206960b0ed357421938305ed739fd089a115f85dbd23605ec6869cc9e3b89199bbf915e9421e8b4b59822667f75d6c30510d0de34a7baa2ede21d23ca55a05c20b3c960f49936e9a08d9dabbefcb557d844f9fd2a0c969f1e86555da410f050a11367b0a2c4197aa2a830e95c672759dc12424b539915e46f24d562bd32a5a9ff0fa6580de19af620702aab892ab254cd483560ca37b8149249aae3e250b4cd16964198514cd9a9bbd8a14bd94a5403584cd1d8e3193245a91e464579d60d58274dc9296ab7be86493ce13053d56dc7222f6a1e8809af60f25356e91accd7499a6fd63bf95a7dd719193338829bf9d902603d675ecfbd8b4ad8a6ad8c9e95edd489c3aa7badafef5a1bfe8ad7ef0e406c49dae8201e5a3", + "aes-192-ofb": "7d9a02b92d507a8343eaf3a0e2a0ce294215c608fc32f822fec057ea640e54501fe8c83e8c6647bf9fe01a7977f83dbe136090b8b4e55e59e3eb38c00454b7ece236e6217e41a1ce8641767646ff3c98dbf8a11736b2d5cad80c0e46a128f6d751ad090d25fc655fd3e2775e20e39d8dc3e9750d18e54c2b2cbde4794ee575f2ce2cc5cf5f15a5dd36ace73435a462da2bfd2052bbbc274c419628dd75c71f23836db6ff5acc125c3ee5e20a8f1c0ed97ed6f83e32ca03a9398c5684744f35d53d132ed2509b963d3a614c775fe60d888e61a6fe72586338539fc284da7ea04ab33f5172124aa1369dfc1144b04ed96f26e0ac1e10b68b57879ed3df7c3603d1db0b4f1939c533233be1c57c9c40268c130c1b3ae2430d6752041da4b50a75c8c6e69a8d851867127691b289e2778be86763dc5cf17ce80834ba8705e0cafd684832ec813256c569700349b835859aaea12ba40449b98338c1385f4b9b7d13297bed919a6be183bc8397115e51baef356010e66a97b5f9cd333f1048f1cf8e1eca63959d1cce9e1e80e25a6da862b09629824ed14c7fc185d0ef735363bf177e23b7f448d14c919890b9db053019527efb7aae26c7284dea2a6409bc0f2e55a58f0704b31ffab9439cd66e62718ae6d1a78cc5ab7c7d44990c67af047c8041a5282aaf11db8bb9bf34e1b163051556e331b23e65a4012a390b65980c933c9b169d1bef591f0ca363094cbbe8304acca14ac85687649df56f4cb2b33f96a189a38947ccfe7693fb70ea5ee1ed00dbebf4e0b5ebc73f2bd1b8671d2336653410305f4ce2c31e98f12fa6ff8ae819f1db2a43b163f0d125d3d59fc31a3be51fe63ebc74d8af6c02838942b4af948a3c87d173de223ac127aedf20834157e0f53f7da682406f88ef13469e31a735855a2e336b061152f18f6ff50c6c75e722715a250080ff0c9e8efa6c3ace233e6853f19ba57109455f84e73798fc04514ce8b8ae27695d17811e9355f8cffa9beaf63b002fae36462aee8586e1db068acba9d0072f17d2f6d9b9675559ff56498e6db3c20ce8359a88a027538512827aafccc42096c04500d63a028597f14e59dd72e43317b9622c50b0a2d2566f09086fff3596d8195695cd6cce8b0e7cd63f47a76d0949b69df6e8b09880a8e1d4d0445cc048ed1849ed186600f0f600f239e5a49226f4a89047a20e6fdbc3e669e56e475cf2d81d91471e58bfbbb283696c5ddb108e763be42fe808461db7f4254408812c7c5b1c989ffa54012cac9ee0d279734685a7cb050c7149ea0be3d55e8fd93164693c6a4b15abd028c8360a7263ba5ea9a527ad40ed28a97c082488668118b8f87f06f1e68052299e505826bcd285bed6dd0df8b7615ed1567d52794c7dc2e97e354a00661058f7c1c05ce33a7f3c67e1bb4b34e3a6e6a1b74bf8a66e41ba7192c2a7e5c2451f4247d1ed1969c6c0ca4a49d0618ef7c39086bb299432e115e0f69ab0b0efecec895232d5650f52012910a0bf35780240496f746d1ccb0a12a37e81ece41e9d36afd9f7f5c19d01ecc3736331eeac465612a560f947709a4ea25a91e480d377796930114ce9d2e732b786bdb350542f1467c4400911750b066214d08f32a03beed5d9c629c7fed4eea4fabfe028360728d10e93ea930e5a2ba1103864194b15b8a31efae4343054ba6992ab5a73954db8303eed4f7e51ab2e94a8c01501ed833ed904564ddbbe764f8883451cf93c922ac4508ac78298f3b790dcad3f6501b2da63659081e82b6775633087385554a6ed89773d442a50c9a0ca4eda98502287290599264839df67914ad813e17e99a94c77c27fcaaeaa48239954d90b875329db0fbfb16d3cb158977e755bc162cca7e855909a5e3865372d092ebe2e82fbd0961020807257cde1457e64e89db6799e3c08bc140e3e489bb8e06cf584d5a4651ab4c2ed5e7d322a2556f0b2af6e4d0c671f290ad83d745837f8d601e93ead03e8ccc63b9d631cfffca03e5a3c6283acffc93baebe7dac5736198f0a70b9e0f0cc66b09093fbfe3782e63f8055fa1e35a0e4e154c4e3a7bd33f895417e788c887b7c9358242ececaa68fd230f9ccdd132add01ec86e95ab1ec8039b71eaee2f5b5fc072f6897412bef2916f31d8e4aa772b3b5991f7af69931299727893920c3915dfd335d1d5a8fd25ba08789f5d58da4570d02bf09a3b3d20226d49e0a05d4c35f2c9878c65f3af71b8e6d92f88e34fd4f7bcee2fbb61dd0568eca3014b52955b9b2cee1fbd7d78fa354e0bfd084ee21636dbf0adc5f8957bf502369df8bc8f3ed959bbaf2a9147dade453f74cadb80ad1ba995be55e06fa85ba5ba163da5f8cd2af1df211295c43fb3bc72544de8e661f511520f78e1690996cf04e656aa941cec9c11df1901ffe28123b614a4d48df2a29551d2c3ca2f41346196e0514d8ac0461f88411c86dc369a6028705675f0b1ca29b89780c7c0c123ed10831b398b09651478dea72bce72a44debd12d7e294e3a5d295b4a19d9b5b0aac7876f9acbd008581c183cff9560656918a0814b8435754946b0ef92f312cc961cf9ad335de3795c06902a712b466e1ee74517de75584055ed359dee30943946dfc3eb8a377e4ed943358065a72b6f3c3e0ee987a3196339dc5a6f8a0a5b83bbf0d79f9aea49be6f2ddd45eed5ac7dc94487071dcf6eeb97351d2d56ec1a5af747b3ae18abc2e21768192d6cf89a595bde74455d631af5fc192696b3fe7e391e03019010e84b1bf265337a44efae3c83f1ff04f492faaf541bc152e1aafc54b3ca946fee69d3db93050696664d35148ea5b3dd215527dec0524dab05725c6e0e5fc7af3529acd7de5a10f1288336c459822eb79d0b1c7c617829401a592b30ca7cb6489b999ec05b145dc215bf4bf0cd0df1c7ea4e0d5f0201e35cdc5cbbdd9766d94f7945f67c27fa65d2673e92e7c302555b38f9f25a0ddc6842f448962b69a9c223a43f32b696f2a5f50a8f917e13923abe70f84859a6b886a33b0946d4aaa86e06758b4b7226fa96dbb43e5405bb67120cf23c827b19e2d256d9a9f9119c9b02be895acc0e2677f45f79c6c10816d0bdec3d77da8c1dc99f057447dd5ab24d75acd9fa87862100ad97f307659f3c46949b90cce7a70b8261accfcad3738713760a597698d35bf93e0d5a9124e3fe8d72fecd9aca6830945f70a2a1b5f4d33a7b0c9efbf6cc433fd22058a27efe6d8bb06711185f77cd5ab6c2256f6dda59ca74651f24971ceebf127b9fc5ee76a1eb2b1ad8ad66686452d14974e39fd4de585984103f139f31f930729d68f3a386e5f69cdd7009f10b11918a144f9ef98f8526ab44df810a914e9956209621aa93d79ce1b522cd9f037d1424e3864ed10e24656b1aabb79dfeb5fcae969c2be86e5be323e4416cfdc03040e16f3b1318967c3c9770e898e4f72e3d7f5c36224fc2dd8b65a4b253d3816ad4c2d032cbd2148a395cf62f45580d6abe59a514e810bf4fb5e78dceaae233b416d68cd015329b0d4a9dbaa0fc5e3a7c9ef5adfbb6daad89c503d9807df49ff9bab435b283d70b8869f73b69662ab64c9150e3ce14b0422d604dd3fde9451dfa3180306678d4ef9751b26733699b4c24b3989c767712ceaac98e0786c4c973a68dea2c2e133ac24064c3315145b050039aed0891c7eb6bd7315e3a05831170d19b17cf9e96faf63aed8d491523d84a39d58bd67cb3d3480cd30fda54fa84899630685a419268585ea85b64cc6fe087bcdabda9a4a0f98f332aa8c94d64c25bca3f2da844bcd0099078ab86a490079efd929e97e26413f8049df4af4305f66d573e57027e965cb3bd892e732ec62f297bf430cf2798b7312affd38d99364417dcf95ea7e6a19f530f2b111b8d787db2243826f4056938cb25b01f813064012a5bf36fa1e364ff9f6c7289a8b483aff6c505c07ffeb32a2ef60064e95eb3d9c02ce440733c70df0254bfb7745faa84609328e23954f01b2d2422b02a30da8d485ab8ac5f2aeb6a33d5cf45828491fcb356a803fa8bee16af539c765ad668d6bf36ae72054a4e0f2e7d25cf584e70a6c76e325ae653486878c3d2a3ae4350e46d7513104e4d222967c7c1398e3324eb6d6484d6f381f365f7fd206a3aaaacb91fe096751a9dee6ad49db4f8f834c2d778fb76a52104185", + "aes-256-ofb": "30ef1fd6e8d7e5c8c275a28721b3ec2df31e59e5da1a5dfea8d1bf3acd32f0e44e64adb6788aa725633929fa3661f227a77dcea7dbd70fcf25d58ba6260072431cd1bfbf70260f2ca49cb3556bf6efcf7a2254f0e88e5cd1f553b932bad37aaf8248632eb397f416d977b0de9ec4d322fefaee371f70a647dc5ccba8b653d1310b12e314025f582c0efc6d3adeb06ba9352b0a3823061b0500b87a9be4dea8488e32e67ef73a78a98d6a488a1c6c2b88eb4944f9057e6f8c833dc745b672e80a863b9372e1abdf3cfe9d86c2830ee632232e1ad83f12135ba961d6b90cacf1722b310a813de18e6932fe1391180a4b15486a21d15cd915c21637dafd55d8973e321231e109e678e2b48a2ac58768e9d243e24c90306cd836f7eafa36cb80c64fbe4ba5d0a57cb8576bf96120774819b693de685424e52a78a2fe8c6ea9fca039580bf313fb6c52fd990b971ef76f966b794f15c977df5e7ea27782ca7d76dc306e504bfa579bece1addea7241f58deba45f8e109d9b589efbc1704720c5950f5c8ae4b7d5f54cf30bb26e72f47392968e39347c7cb28fc1d530a8f08e031bbd7c071793408c51b213a5d2662f543fe005ee63cb66a8a758d2ef63568b6380f8eb7c3aea58d917be2ad478219fb61cdb41cef696da21c5c50cf1646aa4b8fdc86bfa9bcfc08841a43b1048c6c6763a84e718f154b49450ba00d82f4f645780d61a2465b7e387f91c75553e325f45cf212dd468db8f7332b532dda9e2c6a334905ad205749d7e04755ed53459cbe9f78fd85f73711f32e7f7629bf875b988d2587243e05fcbd4cf11e7ed1a3fd4731604f7389a7a35b5118cc210b1dcd0b5d4944bd175a6efc378c064edf36de9560553c1970f7f6ab1f21a76d404e4ade9f752a0324830f9d905a7dfa15fc712f3f2a53e64b0369323356a54bbd00ab5caf389aca68204278c281018d54f056973c462ef9cbc5837236927e5522afcb89ec55add7a87dbb059986bdc65d798a7baf7a95ddde7d67c65243149d06c1b21fb893d814665d84488ae89fc25ba34e95bfd2cb67a4aab256330c188d84e4ef2873245a4a49717a2c1087a9fd50f28e1ceb0fa1913885d42e373d8d8b621d4d92dd8eb8de00d039e230d8169d99592bf851f55e4315302d85eb2eea0bc62180f3e3cb2344a7c5c34e453fba2c4466380e6cc0565571126a37656788367d512f336bd359cfb2714fd0d17447aba50373e3f7aef3b0623cb52b635d04cf3703732fdaa5c7e1845d83bd8981603d19746dfd724eddbb1bde64f764559692db9375eaf28e29ba59ffa996bfa39c7d114c4c9b734e6cdf714ec6c2390a19b60c21e92022fa424284e1dfe29dd31390dea670fc5d6662a6332d373699e694ef2760585f6ce5a70d764b372e37ab956c52b760732e3ac2508e278d294247ef38deda340a04aeca1f21059e1f30612f4517242be2949f9edf6340aded77e80e0bbaf41983868ff29776cafc8d1931cf9c398ba0fabad40191672673c43daf82c8fac3e2fe5290426203b1e63d0597e8f1e99ee2c51ec6c460fa1dac6b3f3d0bf86db58e72e9a40d68117536a7ca4d6a4fb18d1170a6161034b1be884a19ccb3731564f782758c9150a936a123d7ed474fa74e6b895befaf0f0899c0aad6ee0c0d0b0362a8344eef388256f73578e0dd0660cbf2df1b42a7fa07ed70342a3db733be97332860f7edffbf7b1e701d6f736e2ca02686b6d68e94b5344e33b9431a59dbbf2b479dfd11edaa785b880628b52f3112e63a3e05843453bbce5e16d3bb44a4c2accd58e121e6c2c6db1d470fb28ca80ce9e181da03ca0ccb990920d14e2b885a1975b4607e3ed0c70f889fb91fb032f9e8ef4a779eb13191388e389ea0b120744aae86a8a26dad512f00ea4053ecb5ebe9bc70be334b78d2964720678dbcb55602466263c0dd0324709ffefa6adf121431318173d70076afde466cfa70d0607709950c6d7fa95342f9e08f33bd230cf0fa980ccbb40f0bc4d1b6b90ccdcbd7495eaf02d17505c30b7e84bb13020021e23b4326352370b1c8495df5bfc6680c12e426b1e34199818e8847b40b3a7106a16c9f8df6c47c91ec91b36113ea99faa39f70943318131cf2084e5216c4c770705cd68e31b46a9c11a3a0be362c5ec11d8b4f7601fce558534390e1c3ecee730af2e8afbf4ba6130a935569d8941c5782375736e158a81335e5e0ccc097aaab9d644ece5c638b2b633fb595551c39d1b2bbd83fff6dd676f8c92b09fea56d6a356db96b446368d53838b62cad1e7cd33412b8f895099e4963e0864b4e04a5bd10389f770b26dafac61dd953f99100acdfed9948b18ef860e7e4619ace15d326b93aeb7eb290fe3c47eae23c8b59b1b2ab7928ade8a985389be12d24cb219a9c528951ece225f9f75d872b049837424b05d5502196c4f454f883aaadbd4f09037291cb8d039aa61cea6a37c86957476a4bf3ca6816b6e20cbccb26bdd3e70f5561468c54cf91248e13fc60e95d45c6ef93026dd8f006b0d2e38f3ab8bb9d05d88df9f96efa307a4bc650100a01aa225a151e74f7b72c78b460357626ce07f27bef788c22f1d41792d4c53789b949ae68454fe952358590e751f0786d536c89848f5317b791f33acc53359c3ef05a3b80cbacfa1b32f3d87bbbddfedd4a1ffbd9ba293c172d77d03cd7cb07a1a2904f02765418126515b2714f9b0ec89d129ef270d6d19b6a6c1879bfcd002a6244dc8c73f67c6a07a33d8c917995ab24f3c98f9dd574ba9dba35a915d449a4ab2f8a1915665e3af9f7051ef3f398287591e7d1daac72f03c668eb8e9601808d7aeceb23b199f264d506bd020261ce4f83b29b034af86197ee84f8959c6ef14914b4f69b642ffed14e079b8ef06463a52a67f5f1acdbed58128fd3f2aa15ec0d30a0b2800ad2727beee80b822522d7db9e91c3399028ef40fbe9089e0154dd187e0a0587843714adf1eb3f5f73d8b781e25e2e42242a356896f7b4a715f32678a217f60ee3f0591df5ba50569f746e0485211ad119ab97abc6f2bf5c2893cc4d937e81930cec082aee79899bb0bce13f25b81b064d76116d48b28e34e07569aeb4a8aac2fd7cf6e8b30aab275fdc854119c8b9d1ed4bdd2e5cc421ea80282d028fbdf9eae7b2b47b3bd0556e005666e5586ae1cd14c75bcfc518fd15c32cabcded94afc1858cb834270b8ca67026cb0c3d5c69e4aa42aeb0fe442597152e7eeca4a36d8e399257a03c09879915c8bbca532500957667aa85b228f01d495894943ab5640319d3a73335bce21dbc9d07a0fcae36bc09c6e0fcde9ca48881d3630176ed0dc38da540cd88bdc685706082aa5e31749558d0d7a71348d4ac46d0248c0e2708c1451fd150c569e7dc0d35d59d32739b960fe26995fb7bb94f3f3412252b107e81e2932f3d0f5eb230ac3c985177c1d71b0f95b167d8bdee137f92e1324b5a47be01ff66edc777a29f12f622603037aa0f6d3ed2b62aba0cbabfa21f73caec180b45a93c3dbd2e5a96c8b7427d5dac280d7bbda94283ef198980d74a85fbb0e921f41c04e2bb368f86820c8d4a8d0c4982e1eed8db08560d00938d61efaabaaf107aa3c1d45992f45d23aeed68425827153b7ec00dcdfbca309a4b255e929c5d2ead074f5403a28e7b37d5bc964ed97696fe39867803e108d92dc1ff8f25ccdfc7fc0b3b725800a69baa5a5e03302c8e4ae036a8dc93b5e8c4de53f2c491354419e9f65a048b8e4483c5a9f02a0b993d4f87553eccb99908110cc6a7af8c70a58860375ffa9fa179b60dd3e35fee83378dadf4c4224668772c2ba7daec70820c21d658dd70c3c6c1003b6c2d92a6cdf02acf34eb3a4733daaf1a723efaaea424aee233f06b9882000a1905d5836a071398dc81a26e583b4f9773d359c5904d013df95599d91d379900c775cb1b1807151ca1aec59e47a0315f4c7714761d8b75862239d513d0408b09b25c7b5592d6d2f698988402d59dc9da8a50131307d6f5148ec01096e4f3395fe5ec56a2e5c96f6e8712d396fbfd9ec5ffc876fd5622e562dd824a45d780d5306399c2328a0f98338c5937f611c4a99d2ad6af2fc599d32a95dc5e26bf024cdae52b570b8415141434713cefe3e01035a07bd7b3beb1ab559653d3e59f2aac8caab97168ba80d29936d7c91", + "aes-128-ctr": "5466db5b0d21a342e741fb6d29b5492238dd30c6fe5237b0da0ace41af85a81c6f4787503774fdbafe5b4137aeaa5aa788ff0bbc6991b302df91f5d256430dfaa2fc200e28ad8a7488c6e3da063d3867971d78279a79a31aadcf3d2160744bf24385cd75ede1161df01781168878cd56cf99b39ce5a8e2ca345f689448bfb62926596bd995a719112d63caacec6614bd038e7584805c8b923caafe78589c081b30ae2443a04638b3003cbf56049055d484fc85071c080e4f0093ae8a69cb9e37df5c66c7264a57401e9c05dde7488241be1557cfe25a2cb505860b1adbd2caad0fea25a9ad0e9155c85729f2489bb9ae10eca124cb68b6080c2f89d5b727d3e60e5147d3aecbdfce5a620e03dad14ab9ca4604ab33373d5e0fa0336f96a288027833f5e465494543561adacca6c40ee215874fdb578abb7ecacaad58b1dd2bdb4c42b5f03d56831cc61f2a0c0ce4b7fbebae7e199751342ae85208e9d809c354740943f6d294dde6b59493afc32fb7e9366c34f7007d39513d301f886ca80b766cc8897daaff2301a6c646385d7dc155f2476826c3f747dd58df9c1534ec9de3d0a0d96ba767b38346dd638623cf691a55e19f91ca4a14989c91e928cdee09833bcc8ed426437ee4c55f7cadb61c0192f3a2b86140c356d6be087ab6d413b2d741c6e566efca0bf10bd57ad46f61743cd70bf8a386c72c2e71bd8bcfa17b5ffc551daffcb4f5e4d14bd4938b877a5d938f2ea19eecabafb10abf4c8b933daf325ba45f3de56a397ed1a2e3945c40ecccc233c3cc42b0ab86873c7205d41fdeb4ccb46e5fe626f6c1d019781bafde859a8b22f024bd2898212ca45541a908b9b7e2d307c106d0402c7213d309e306736eda785ba5dd1a27e9f6223de81823f09f6ce0a3a720d67f76dcebf1baa525c8e0f88476042d4082c0cf96fd09de657d86973321a81aa58eda0ef53f3e564b97fef64b0a4d848e7a51051051bdd2b95a343a2a344b3628dabe4bcd1ab11bba4f6bf32f3f44c8c1f6b838eabb06fa1caba8130733ff75b61396309eb6b4b6dafdbb0409455376b949ea2d32619933067181cbe6ec5bc7e79dc47bfa0ff434789cf299e4513befdeb8293482966227dec6cd8e55fb1b55db0d0fdf44c1cbb63cd83ca82748c84164495f60f9ea22a278537a4a8ad0aed1508cb80e5e18d4db7fe521bc1b39aa968f2de9190bc3cef77f60a9b2eb52e9491f5ff11a85d0fc00cef6560a4e715e4925b5b7e23414c7fee709c50f92305aa3b36c03cf689b20b8261d820bd586a00a6ca48eceb3d87d0331315650de19c3f461b8811c55523282288d80c2d03b78ee39d6f1152b308e062299e5abf9e1f303dd5209bb3faf931438557be94a05d39f7ca10bb80dac056db879420996cb0db490c7ffb3ff2a22945427c01f323c3f5789ef382926428b7cb4e0050224c5518c980050ce7e326d953fc8faf34ba274ddc031f5985075e1a1d4baa98cefdc95a1cb9364e5477e2b0e24444cbba4e8d2e320c18d541b65e9014782d45637b427140855ccc4ce72a0cdfaa922ee1b79cb7cf34c02061b458b752da1b27fa576513922324493d1ae5cd04f06f82cdd3aabf3ea3c8d5bade0214e1767ff793d73e4d516bc6aea545adbd82c585d9bfc80c670a17dfcd74ab8f5cac2181abff0b9e7a2d95d689422ce46de1a20d5aa5013c4655a7f869b34108eb5ec73f9881c89ae892aab26254919c8bb3efb37d42f7b86e32bf4b05eabe358df644a832ea259c1d01e8ba80e390b46fae647995efee1177fc8722e1dea6c6d3b39cd38eeeb8c08f2c866ada7080e7ca01add500d59b9ccdee1a0226562bc515838bbb120202210fd752e2ed2c7a0110824eec5202b32702b85c4c3b759499a062de6c34fdcba99642303f6920b9aa951ce08499b09693c991a54a19b9abd0bbbf56aa52330c7b285a0706e5af1d57b5c037b540bf03cfb6233bbcf5d18345d5403d674bf71189d126a68f4e38bfce19071c7dd196e3c87b43c9bced2abd111cf789054b171404b7f2f7495a1229574226f3d243dd9ce020e73321d6e21eeca2efb15d0ad7835d5ad66bc67e7b6c13626df246cdb461e683bedf3b20cfb3e1a3b4bd016ef93fdfca37fa74d9faa2bed7c5ccf54c166f08dfca038326b83df86f872d4028dd407731099d0fa921f35e97d4517b79b460be4d40b8953081ba205387ac97de64bd0970dfcb0ff5aa845240462b080679a32302ce41d15d8de84d8ae32e9bf2a64c2411207b859dc23c2ce8fb4c0933bc345228430f9271abc9f46bd096bba8390ba12d2fb1bc3529c1acf610973e52e0ed685f1a351b8737d05a4e5a58f0d08da24f5a24e6559ba498809405e239f1b9b997c43d9fd7fe7b54de173d84af10258586f77bcfbb508654aea8e5398911d48dfd730a83cf4a35cad78b8fce56944c9d647716121a735b76345a19d4b6391e043c00e2f981b5d9ceff608ea0b31ee157297a9aec1b127c611e4d24efa5d002fa48ab907f351f6fb0138664c2fca48c744d136bf04c02d6c1050dc02e10ecf45f7cf0916b845e5a3dcc9061f56b3f3ab7b8bc1222326634ed7ee9b37b5d2d22d0bfa1143bedf2d1492128731a04d24d81b3d66a115e862278071557611641099daf7af98a6606efb3db293164def0c849205b59715e004e12739944898e31352043d137d15ca4bf8640bb2bd0ad51161a60af639fd5156e614efb1bbbfc5a39f05b9aee8aca92e8526e5acb2c2df5b2b9d957634f019739a0cad3ac2140c2224777ea98f699c80bb2d58df9af2b02ccc0d8e440a73495284d6270f057a72d28d37a7322da34caf0aae997357d911b13e248a1de2107405dcf78478f91c68e1d4c4396174dc21a0261bb7de2b4d35725d9585db80bef58ee992e98b5627a566a51c478650ced3c83ed7638de73aca5bedfc11762c0b65dea67fe0b1d2c6ea89c5b131089fbee36a0d4b52094a5e0e51ddb14e47e714a67b967afeb43ed671ef0f2e630b4104064ac8c6ccb20c9b312d9fae476ebe08f8df0fa68872c23fda7dcbcabab9994835f4a86bf24eafb1b53c2bb818e89e9a87ccd6198f6b468fb45d21c39b61a3e21414788000b16e36fee7fc9056e285eee97266f1aace7aa1bcad84bd334bd3a7af4246b8ff0f7fdcee335a376c663c64ecc2d2743425804f6edd0a6e3dd5c2ddfbd737fb12c9f9220f16d36a1cc4c8a05d8afaf776cda4f46ad462d00158ac5227dddae82ac4ff958e964cc344f8c5797da876b8d8263f5c04e681d5209611b6b83435f72b2ce737759dda934c3041f242e1d62f5d5ad6ae000095c1a630d3dce8e24a7c15888bc9e48d1df6d284c2cf432a3e939caf5d9b643d03fd285986cdaa96c6166d0350827f9a105300de7b628b196b0f68e7ab6df2a4d32aba3de0db67dc8d5c9d818da1aa26ab1e864162ab3c21658b8f6febde885e41065f79c82fde682036c32e7a7cd7a3bf184cb01bcee06c7c13bc13f69a6ba70713ddc0f9baa9afd0ad183c0afc3495b48f6eb6eaedff607d13d06bdcab2f0209a73b91d4f0488711ce9039b6e8da03721bd952a75923b47142ddc7ec975dd730f4b813d29dc23689a747bde732ad6fa253007771c424ddc48a6a5ddb741b5c62bb9a77ffc665e3777fd8749b31ce441e743fa247c4d185f23e58e5f26453cdcacdce6e20c3cbc2dcb2a067877e6df902269d4326fb9acb81731b8e0e1b156672da426f6e6bc803d12ccf375f2b69d7c9bea8ac2c2b9c747edfc792934888699f5ddacd170c21015718a4cde9e7d03408bc84ffb844ebfc46c44588a16d0210156c445bd0aa25e439a7f2ca6c02663057a21304a282fcdb8c8d698fe8ea1c0482b0e7ac8d47e9036875729d1c50de8414302eaffba74a0ec1f0efb4025af6f2eec661906b677942b72726b433a14fbf76857351dee3d0a8b730dbb6e871abf47f3af640290a8ccadf9f4149480ce5d198d46afef4398223d72f9ec482201158861c5130b528e450c8bd4111729b1d7ddb6056c0d4e8b34c4ba8f9fbf713c371d9737c864d07e5559f6899fe96c3a7ba3b9d9267e8e47d36f98c1d253042c967ae5c9830295baab4db426380c4a39e3a3527c72a2e8ebc24e18098449fe0bb76c1de62386be220a7ad5d3316df22fb0e5b7490a7e543be28347f3e9900", + "aes-192-ctr": "7d9a02b92d507a8343eaf3a0e2a0ce29dcd920ffa28bb6a5db613522421da35d95b34aefa9059cb96dff474c2d1ac8ca640edec3d53a283f3e82d83ba77719daebbba6593de52c95cd7238e64b3d1dcdc8fb9e981320ffdac8f3e188ab79339ce11d499cd7c83d0063096f70704f3c8b52140dc6b8ee5de2f97a3cc5eb54c57db73dafe52025f53ea5a3a72eda1ca78d19c964b1a22e52570f9f98dd674e6e25a4095d24cf7573718e385664536325f7596794a2bb33a5b1c83612dedc93695d0d9a1a71bab6909d9466cd2f4b564d35caea523dad51472b565c175b0abd29cd9d964dfd09e5d0d645503d1602124194a1bb1b20af3792c86d13a293207b2f4d849fba569e4c3a11af98c242105b832e699b7cd9755943fe53b5dbb7a1c026e836d81e69d99c5856eea4bdcbc838972edd2c29b058213996cdd59bea2f157b2708c358ead74149ec375e1f3d18aeaa035184ba40d27ce52314d2f2a6fb905a9b4cc3d4ad2f802d4930136f8222b05242bf2f9986831df60da8b2dbe0e8583abdfe249d5366c0084d8695c25a6a210d5a075a0f171ee7e1cc6a064a3129e8c163043ba6baf89d3d14c63808a2d8048ad1fe9df2d9a98772b40b9e7609914d679a094bf566cdffdc3118a9f4bce58a5bfceaa5bbf34e869c550371704fceb3b9ab01435b1055b9e8696ae0684bb88d70b9c80fb3896b4f4b44d51cf12c5bfcfe49782fcce79423b9f885a9d9cc719204bf852bf028625e7a4c9b257b44bd77e37e698e0c8a53d5560e44d6a72ae011251d4daa1abf7aa85333b9af99ccdc404e0bbb2d55b1e36191838344614d8614a83d3e32d9fb5a6c3ceb99d971f7c2875accaa368d50ab4688ce3a4d89c25469c546f88d10217c0117ce3dac938bdf23f17d3d5b3d2680f28450a72ef9dd5637579c9037e3db8df411e09d09dbc7810a63af86f45320bca9c36977280e0f5c0ee2d3ae6d9cf977ff2b57d0afc70db05133037f47e35420e2b8881e54fb6da33b2d3f21fc94268faabe05c2fc534ddeb2a51a2976f71f2063418ce6d85a3c65420fc648cb00570ebaea595f6053d143f9822138b0fd529f4b139500861fc65f4b9db1a93adaf9d8e75d0d0daeacb8dfbeed9a2d7d55337e927f2cbb0d61103ece47f3834482967ea6b8d336a1a6e892b84d276802108e8f509f78dfe300f69cd8de1faa809b4bd8079a17e282a01f478f0c84e607c74f8d1f421d4abc23bd86796d194a38e1d98ff187fcd93102db97b16d24c5a2135e03137d969d25574c07668186b23e4de29b2fcedce3906e9256b4fb9f3ccc03a876f089b59c31753515f17d184c422e03a1bdfab6220130de9929546e694494eea999e5ffd715fb00f810b51a557b18504ea44e44f153e1922e604f9a46631b1f3c1d67f2a9f3145f4202964b379bc27b8e98bdd256c3520b931c80ede6e16465b0c866a8ba0a5405b99f9723ef5f7026e57eae91a26c101f70603e457998e73d4e2305447cd48a012c590c92b248498c0a0f85d1740054dba74516b13d5b35b5edd1d11174404a1bdaf5afc020150545ab517ee09fc14d9a44cecffe5baedd995422d8e0eafd1c55319cf30826d23bdd0989404274e4282d7858416d60b59c8491392a1c88beac978ec1d79580d7411becbfdd0f128904c3780287629c19025cc7b02b98399e5e683e070a4f39fa1ee31b6336af7f800143ec19ce0e7e30c51c8fbbfdb2c7333bdf851d5179ed69c311f0be561e59e8c6cc3374b63ede7b623416eab714da64f0b58067d1315895d2d4593ce184e06fdd1e0bca432d9b02804c89117990effcaa4e75ac5f596a9c83a4cee15de62c2ac97b930e5ac48293591305acdfb5dcc7409306e356f4dcb967a3a46bb8acbfc4a961a030b782679ddd034d0edf2206d9801fa9fb844e26d353b9ef5feed7a902bd404a2efb8c5e4d9533fb7b5d2bae66961145a2d218da8111190b6de909f37a4e59793914a429734844465cead6c3d6cf70ab42efd2e6ff879ee50fcf317609ef55bd81e54215928a98d0747023aa9b082cdddff6758d26d08d1aff74e47a45374c53a401a5b00c6d7ca888d3ddbc176eff64bd7e8200d14d19e7bdb09887e3674de450e82293e2e871893b17f0062adb783510ddbb37636263062f1aecb302c11ed97e79019f2e76b62e790042bf127940250b7e98fb0c959a41d2f6c6e642dd4598ee8d3249dc6614735e22027234f822bfa9753bced8059f0ca3a28933af4708c359f30f6573cf0f1b920d4b0c2ae19fddac83a76ee484555cf3a44bb92fa1ff7123f8b5fd4b5247b88168413ef6e5c40aed9697950551370821b69195b132f4602b6e64e0e285a8cb50b6ae0da5301caac745acc62d4901b7d31743f8c72915e1bb34adf690c1416e8c346a45f628bbac903ec1bd050065f6545e2a83bf69a1927518260fecfef1ded77700b4fc6ba56766241eae66411fe3a646a095be7e0761b33a96ee673957074370173371e00020f6337f178d0a8add983fdd6989999b239367bca314fed349998eaa2e5492d6709fcda07df94f5607112e56286cc90ea123e3d714107d749547efd345c7f8f785ed76e426f0c21faef0a0c43fe06c2562a0a27afffc2867bd7cbcf54398c095b1cb4466a63ff28d7ff6f2608471b52b9322862313ee7078410256a776e18253c08a6550c269122c506014479cf3a62e3a2cf3101353637b3aacb383640737492b8dc742aa8ab56c825ed67337175395426f2f2b33ada16b07bca776730bcf03599e5406e61e37962b4deb8e8f8eb3245c5841a5c8d3333e27c1ed2637b511f769fe86d1d98788a58f29c96de12ca64f9e5a6e3507eb72328ff16518066c832b2a496111ed3a3c830d5af6a74d2ca67830d6f27ba8a295144dd5d32020045260967c8301f2af7331d6279c9bd3593dcbbaa783c5ff5b485ab694b060580a5334a6aca53d7237497e08a5828920255e4154a3fbc27fe55744d8d9fdacc1eb21f3385644552a6845e33cf4bb9329fb72279bee36f9a19757ecc1cc39d7ae6d675340bdf57ce92657243e7f2a1d5f4e80f50df04683242efa135e259c7420471d083cb81401b389ca4ed6bc79c7ba9211bd24be63232bf4bc17323e000f21fa611801dffcd13a627a90a1d9baa993100f6f1ac618d6ed71dd202db8c00c9a5f90ef2f65565fd15a768b63ddd0b2b7257da4b5b5bc45b6e766a7b99acf2497bb64450fc92a3868ce98dd0c58ded652b3054c64b62c34899adf77ba54965e900f04729d870b270a60d68eb31929179dee206acc583107922aafb3c31867e33a3e403dc054ada0860237d233cbccfd185eac7934005ccbb11c1a39cbbe7a1a1666a148b41a36eb3c5e67da31787b6e90759031db0b3204cb1af1e7e703de308faa9ad3014a25fccdbcdfe2ca8c583b9e7cf29d392311b0cc1d97704c15d84e965826dac8de3e21527c8c2f4640c380a08d49d7a02b01aa91c54ccb2d2574ce3b12baee0237b1e228f54ad15805aae4420cafaf2a787a5a67fba234f5a5c103f0fd5ac3ec8614a8f6f0fbe82e8a0f2b517ef702694a8585fe504710d04f6d2d254b98f96634479f42bbb57f94fef6f44b284360b304d6883e8a14e794d88bfd90fc4f1136a968a3ce6aa4b65c8365c2eebccbc75a2b34b98c6cd781c7869a8b0ead6654ab5b33480f4aa360d37414ee404d4827892607a8b12bf4bf874ff38a96e38062044a0769e6652bf4e050fabf397600f683b604faedeaf67061caa55179d8ba1ffe58fef55ef07a214ca4fd5c0de6d9580d6e1fcc1c62e924a073bcf4fd1a419d8f6c9f496822b60619e77bc832658faeda2cc49d6c6840523b6c9d2782c52a674a684890ee187cf92c315f4123e89ed34acc379716b18a031c44950f8fc9edbcb1c5700610f2d47becd674be5a1565d746d87a1163f102ca476ad0c792dec031428d2cc8d0dfa548a332926c1a60b66f8428bca73153e3ea5416bbef1360ce0d1d18fd740e96dca8dd1fffac6ffdac5a58be35eda4bc007d5cc117d9eefd5984fb2a08e8b89193ec267b3d4de9c6f49143c6f93583895d43e3a9cd95ec842aa982f70b53c167178749f96ca27cb4b26db383601813e66116cf2059dbf5e15275f43a9014fd4af582c07182e06da5d8d1b31b40648c0cd77de48a07e536022f78d0f7", + "aes-256-ctr": "30ef1fd6e8d7e5c8c275a28721b3ec2dfead33873309daf748f935113b9f43c52821138c46419654eb23f17da80ccf3f070d0d211f4136509a93a8191d3941ea5c7f8432c68a99ac83202d92023fafe869fd614fe9ca357d0953479a835e363acdf2b4410b1480f15fa270be4b6aae4c52d83ea40255847d6150d2830cd041a9e56225eff769c16d57fcdb3364f43001b4ed01f82e3644014da1bce0501108021ab636bac5e450e0f02fd065ce588ab78324cc0706fd9aa8953aad9e62ddd21a758ab6f2ebe9f1236579fe55d245f0478753a1e00256d142468e2f9e3a765cfbecd077f2c8e73e7a7fbf214d629caea676bbeb54dc2fe806396fd2c76e7b94519e2a8d4848f0fff76015b05e1f54fc20e02e14bbfdffda6902d47b1b83a586f0b87adf7f9774fbefa06cff18c6783ef2f0f941b005ae0d69f08cf1b124a2c9d0a5dacd8293d3d322e5b510f10d78d3f574821bf18f60895812a11e7e493fafb7b1db46a28ad0a94e349db43311197fab39f1415256cd11848d2dcf41e4e860aa08c54c1d2baa3fc3c8df076152e6deb562c6a1ee4691b805f104122c21424accc518142c50bb38a96fc7d20caf40fa8aad7a602089828921eb10b81d4b6fca1682ff99133254813caa41aad48b3fec090808c950e8a6f9206aa24430467ec2356feb0d614f3bcc39a6036d90b4e60d21f2eb4935881421058b2309301e1e9268d86c73f61366882addb93a255677eebcad2e804474a6023fa38413faa0b39b7f9d3edc05dab15ce6dceebcea2f5e1e12120933f2b46467a172d91df9e43ae8a3728b083187e9da980ea0ddd17d01ea67191d1d311168232c6b82c5b99f4a87d74b549fa984bfe5fbbae7ac1d3152540442c1149baf6ed6179e1a00cb0a7a3adc7a4b450495be21571762ee7d8fbb18cc1760235310b088ae35293b104fc2e3500c855fffad48a4aa7ebc366168fe50767857d4a29868eec68d1b8a6e758a8997b2d174a5fbcd245bc44001037142807401b33a9c59e1225e4356739d88175c54afa3c3915af44740e503ad457a9e41c66fed69378c826a9bc4eded95ad10e1361f1dadf46ea6963d9cff8bf763457d9622c3f61f50292bf21fffe8e13e7fb7a072a8438f7e8d122afe55419150469db82022b80766c709e9a1574bfeea256eb22eb9701640f88317876311a235cf9b2c6877510f748a82232e518ad14dddb2cc3a1a0d571c661aae05ea0c846be560e2efd318452971fb769c72aad7158114d51f0b2b9a5e1e20ec1de18afae2dfdda0178a93d5626a864373ad66958802d2f4572d6df90f8ef0ae509f5c5be8c13af239bb4c94cba1d44c2c5accb012a40b7f20928c20ad889bfa080a43d3024d7cc3634d1f0a91db2a967ef3855912fa2186c8ef6ca1db8f54e1c1256b99b239289621948bebb00a9c1cd17b6e894ba64c1b842e8a391f32ea4364ed0d3b8748f1392c04d09d4385806607d4d690f4694395d6dd128531ffe40a8deedde36f6c53b62b5d7da8542e0092b65f9348a9ba988a52b13c00dda620392120439caa6dc2d1ef2dfeae45465a068c7c9a1486bc0e1eead3db55f436d45175fdf0026297da799081ce107e57c517abfca6a11012a09f4df3f31fa0b695bcfe9211f3c4344825e19a32b0cfb798dee23508e8911301a64c3ed360890fe180ec54473405dfc8a14621fc082169b6a839e1837f3feef57e61bf4abc7f4af284cccff66222f2bd7f76742a2d7a5bd80aba6ef8c6e72386b1fd112dc17e6b68e7222e582508a4c0c6216d91b857ba3d7bf52bc239d5daf8be480ceb564564d4b78cce222fa043130232835912d8632c2c3b20350e1c32bd857235d6124fcf96a1bc2d4ac46d744116a3926906ca3095f751adc13839b5a56d25ab3b3de30ee275991742daedf7b755be8555f220ad55590f377fbef22c05caa88e8cae92e5f7735b7de3ea39849a02238f56f96eb8247e30ae857b07af30712771ee0e5f8472d9e4829e33839a9f91ba6689757ef8c509e2221c9ba863d23c434bf7183129307e83378ca215afd38e3a058ee39a60e5330b7f6bccc548046a756683e20cf890218e5de743e9ecdc2cb3c20b9af95b124d9fa76b8c3ed31288f5a8a2e612b0c6f3441ceda5ed0fd4017535b4478866710fae29d28d3221e409b74cbdf9a59b9c00c19d86c83a4cdbc973b666410add9ee725dee1eefad510334beeb94e8d6d83a77466ce57e475c58de25476f95f2da4fe620e78aed65eb87aa210b1425281f82295f42e77f9d9ad6fe62e5c50745bf17efa445211ab888aa1a6160b71526dd6f389152395070a398e265adfe99a31916a8045e5ea0571a40ec552f560f58943b0e805c35fa55403907c31b3ec7de369ce723abbec19762a7c23a8bf9e09875746076b2ebd74894f9b75e8d8783ea31052db6281e6e97c2850c8bd46efefc698e3cf6962e3f15ce6a3023998a557ecdaaeee1db5d775abb454759950f12204b385d87ac8a3ec1a0cc7026116059cdecc77d237f3d29d53f4a0685c5eff04badef4480ce7a57c44b87034ab5f077f1781e81da8c608a15074e107298cdd5c85636414e6d98c0d905540e291a2e9b230b766907e04210dc54d647898edde2601517b5d0176dfa575869f6aef36d5a87129a0b896ffd30af438b481fa0667a4ba625295c3dbfb923e4a78ece678177696342885d3bb6a1cb83e619f4986920b6832dc061f8ea16cdcaaaf000f4d1fa6149da59a8cf3d4fc2defd815a2538aa4682183f8150bbc47597ceac49d0f3fe1970c7ec17bb8fc854f2a323f1284dcb24e007dfdff936506a3c5804f47555bcd06f7c4972767b516182f93c729287dc0578e7486cea33f9378d67d34b115b4fe405fd6ea52b0d4b877abe5318239eb0721ecc83fcd69a31e002be65c7068e92c370c9584e6d2a254086697a0700bf7266f53db4549f728aa302f9fdd0993ed2ec9f0df8f78ce67029f11e379ceeee256e0a8445cd343b28bbc0320d9fc0e6ec7baa3ff83fae21e65a9909e2b7a94eb0d8ea710b283ac702a43bb8d00eec011bddf35ddb917531af71300fe668d38b1f47d4aa946b282956595f83f234ebb8f744bd77218d3ef8d3a28b5a0e8bb76c377be15de478a93b0d7f6cb954e6075a2336d7928fdf67ba814127fbf6e58b17c16ca111c72ed20837b85436e152c011e6d7a036d7ec75ffb9c2292693830b654d95b9267bfec46b5f0f0d39a2c680cbce7c77b736ba99eb56d43833a5206c405f0a6deb553902a0796a346cd17fcd660cc14c6c5757bb37d1c4e493f0deb56d9b4771ce92d770114a87bf239b69d96361435ca09ebdd98949458424072a622deb842f5e6eca71b08b18477a94d8e7e22f1b993b8ff2c7f0a1ea405934846c957bde951c042d1880869463b66a1bde0b69d87a1104d91ed86f6424a8c0e06e173c93256ccab7d6a0f4455525d3e4313dd03e3fa02d8f0aaf6c790bd4d52a4f77e00e967393e1912cbd448f5629b5c22ec1028b9fd3171aa0188459dc0f12c479176e3cad7982808866b1375da6ff79cf34ead4981f25f3b8e160ce9b070475110abe8e554d61f4c3f210cf2187f58c83719707629d382f2020a9e71cfe0c96d251569eb473407f787adc762740f6938dd5a114b7ebbb763cba850744e3d371773ae581fb985f8b6a9f44f28797feaed42b658dc3847faac162b10607992501a66c746be61e18b48624d1c23ed625d09fbb3f5b7204eff35e66651e742e705bba1c02af4ddcd3f476e647845c94779adba1cf64aa3fdc40a64a87581514fcd81c3da3fa671650095bced5d76ff52dc663bcc531daf293b10b81bc1d7d5060a72b62a659c43e5cb44404214c91f2e9cdd112e00b0472509e7f57dcd3836a93c2204e3a02e87c4c0bd0d17a1e43e71a6299ab6a3bf4a69038db86e30ab53251559bd6e7a3745b0e5743046f1f2d00004d26d8c3d9056459ec70b0bf47f3eadfc17d6de65d87f92184a4f754b9b80c0b8c02bc4340822939efb255f77b00e63905db9ea0a1648afed4a4cd420aa14ea9ad86b8278391a4f1804fb4d6925a820b071e338eca4a62b2dd1bc03c29785c7b47c838f9b57528b7a011e4d5d783c8f719ff9be70b380a8dcc5ebf91251f73785be1eb286248b7609b54bd5ab9c9edb5400cab7566ad09985ba5043bc", + "aes-128-cfb8": "54bda9b40767ee6013b93b0c4ed194e0da8daf98cf927e330b967eaeca768a34af01eab8f2636bd6ab733b70607ba68a5e98395201790f54e10f51a2462f63f5e814330bfb309b74a044d3bdfad221ea90219bf5cb4a59864ca4e4eeccc0e702418813ccf043bbed69a1e51a574280244a0c90ae5d0d43e8bb8e117287bf33e2bd7e9380960fe60ca953a3ca839b7fc9ace27e20747edaac23db96e5f6b60c5506f8d875338657c2eb72788e0c3cee8cc2ed5fa9980b5859673b883404c12891e2c906171fb7a8a72a7c14108e36befc7120a322f6b917008933aebc538868625162453dd96458dd4c1a8cea71446d4ac8e5ee365e9250c149462bc01879e572935c91972cdf34013f49e6e3fb634e86f1fe96b5ff65083ed1fc9bf8e378b581d3d3ab8df5136a542dafea125755f12d0bffd42a003599a8cce83de3ae13df91d8218d69394e0af86a0b48e1b8b28b540e1e676986ef20548892dcdcfe75563f3de5e449d48fd9b8c728b56aead0a4aa0656fb76e898f506cd1a90e70a9421916938ae38232d21519091662c4d9f631539e377a720f87a5bdc95c56c1191584d976b22c0d311ccece913f904507f28fed17e489e172cb80573696d56a8d129bc2ea32e1b4d9f5fe25a9f9796d3e0ca835150f47200ec0f1f72ce01ffc01181356c20baed6844f117f54dc97e73eb71cdd4854e9492999d4569c793869a6d399962206d9f8960147386266cfda410d903aee22b81417b19c772553eddceafb102862620fc21091626b3b3744b945d1756031d1bbcf821cb17cf0ae324a3afc4ed1dc136d7e5212ce76f038cb72a6184e51fd83ef333e975fd811e6c75f98fffbbf257a6a3f239ed23ddc948f155837faf0576b700402c7fddc8e18af2169ecabc20e141f42a57896e2332663e5f0d8b4e47152b6eea792c360e2b437f6202fb23e2dc2ee2d1bb16ee2ae7330a19304d9df94d44cf8bd02944235217452b812da54329062a49378474ec087b9f9044d4a2624c89ceb303b8e5373d1825a48b47a78c78823edc3c934ead14e8f8e737956ef1759420c79dfb5318c9eff5f0f0365f02e8e9435dfa67d26a2ca1439650c8ee280f4a54b04aa2225f572b82185ebde9174ed4aa2a9093b5fe638cab1082e649d284a37eebb22f5d93c2298620160f3cc78220e18ff1138df9195074809c5672386bf66d828f278769e86abcbc3f8482b02efa799f29e837fea80d6d3a37682ee0f064db1a58caa4603d6617a444405832c7906f5781982a347d39c443d4c12779b4741eb5ddbc861ed417cb2c8ae4479d8aa7d6458fb8e4cac661d9077f6bdca3ab24ca1be064caaef6746e4b7ee83cad7d7e4a1a843dcbf6195996ffed49d8f28afadb63e6b47582840087e0e474c6aaa66848178999569176e344e9687a2dbf7391203ead59399f6cf1249d6d3a46f5993a2b7ec383d779967c289f2aac0032b6c5b4be0f238f13e0596bd48a47f886eb15b8c91655eb3c1f4f592c2b39a94442b371224366e6275932235ad6fceda28420f8384db67aae060e2efdf3028931888091e609063bb1d8b9220a500890b8d91ab8b5991c06d04a4cfe654501af25b79900be6ef931a0631ce94059ff740586c2c2bc134e6bddcde42cd427df5d696b3d60af49029ff7d67db6ad161301f9230293b5e4522ea996d2b236209153e2b0381119cb80c6e5e2a718511f0db1abb99a2948d5bfc306f39be7eb12394f6c9fecd06f68733340c67fe9e6e104862d49fd0626e39254fda95c7827a0038542127022cb4044b4cb26fb08859515632075a1574a970d7b4f8929cc2b8af1b31481f8eb9c40a2776ed04f2166f6bd19bee9d2282c503f19cb8ad5d516d51c0ffe3416b0b917daceb9a724a05f9c9757ed99ba582b5f507fb2164d6c69547edfe84ab0c898b14a6f55de8af292c5ac11abfb3497409f0d64adbf70d06ef09591ee821cb610dad34f7df6010686f91a3bf3bc6597b0848f2be332782618edd460652a295dd54068606784ec6bdbac3ae6981a395fb41cc30b3954fd9fd5174fd4e7fb19e3f06243d87836715c74b543ee2e7f3341dd0416d652bbb61096d49ea09208b8b8eae51b4647160465ee98371bc87710aab4a5d64b7d4b13964f28f7cecef9c28f6495fbb73f247c9f4c85b23e147ba90ea7e33a6be66cc4c209d24e4fc063afc85940fecf010ed3895d2714b44173d87375e841357fbb29e29cc377fd137903cb318092b78679e18ebc6fda430ac2cbceef8787fdfe5ad910be7c414cf4b35f6929c50132bf303b38bbbbc121c98c9a809a7b35e91c75f7463ecafeb2d85a5d0f0edaf7295f5632edb157eefdf94c0d6658f873ec12a7347eaba49fe8ac09d054cdeb8c5415d0e2784808ca2bb031591aaaaf859cc740d2ee205b254c021698fd5aa12b3edfc039318d928b852bcdc25f429b100da7a289f605f6b6c911bca6d79d619aeadd216beb5820a32e2a8e6da21057811343565420f861930a1f83c2bede05c85f1e2abee26d34f20cdc829681af0872d4de0969e6acd5052b4b031dbe67e0321c770276bbf0b70858eb65b06e32ceac223015ce2fef6f0ec499372e66c413d4f874edbf08f7793863adc3fae0508d5fce83fef2c9f4b142e5049b7ed2fc7e759b0a2ea84ed8ff0d7f246c53ef81d86d5c937c06473c0e332b130fd4f524899f0102a3d0830c9a09c29c23997bf2e661e274973a799533f4316ecc448047be6d672e387d29a23ad4f1c866dbb493182ad306e7af940d532647fefc54415a070e8ec67f8634325bf2d99b52cc335ff8c998acafab7f0a89229825eae049d2a9132f100598e6f609ab15d801dde82ef3340190801bbbf0d13504c1941763508edc9bf7da65676de15ff9e7978ed20bfa86a55a1806085ade76b32c8e22d268a19412a591c578743e3d1cac73ef5b0b3e346308bdbd9de92826713f7df6542005562a8ef97416b3fc0ae9b3fec8f4ef69daca34889e7b608c31b366bbeccbf39aa5ac6ad10c2d2c1d9f985e9a95b126d0789a4bef51c37b4e6d45bc5ae393702c227eca12a8ab2242812b5345cbb4b83ecaf0495a3e4404e800482cedbffa10bee8bbdf945cf49daaf7b526161540ddfc664cd0bd3f2e57a14c1be51d16515c1f501ed155eff2241b590112742c8747d11d6e0884803a55de5d0bfb5222d300f2512d3316861544f6af2719e51d135a82d1c54b8918ef25565a686d36e7f3582daa31a5678851a2a525110fa40e5a63af05e31522f5967505ee5b96fbde90e118daf39729c70c750e2f1b72ad0e8908bd7af1eba7f537c7873f7511d59cf0a711f2cfce9ea5b4ba6bb02edecfffde83518c502c972df4b638977241cf6ce3bd2216e358c5abbf1e01d56335e9495a62e75d180355156dd028387660a3b75db1ec56a97a8351bc5d66371fe22aaea3c3b42ecbbece2fa052fd3ca413ea1f087782d06b423b3c7660923c85db2b3f54d20b7d5ef3cb7d0680c525cefbee6ac7ee5651424d116d9ea884a06324878638ae4272c09c5581d96b483a16076e546b4f379bd7aa4ad15878e33e27fbf4b5be0310e975bee6fc79a44c6f3e8a5428af0787df9646bb1edf60641be7c2db2414b6443bd50827277dae0dc1e37234784abb4c63d8aa84fc6d40bdb630ba5718efd1907cf13b85fb0d9b739da3bfe212bc58aa8fda8d70f9d88a6ce5f55c52d23846ad6487ef69f591bdfe7f25c9570b5232b903d2a1bed792fd5e8796b405adcf009fe56fbb0ed1ce390b1ca13ebcf72364dbd84d38ab8954b69e13f324d7292bf5a4581d4ae7ae82bae94413faf89fd43daa12eabbbe47907420c81df98ee434db4c665a136e33fda1d1cbd489e8ef57b7a0ef911c1a20166c592f42911e32c35f07fd227eb509519d9593a79c9845419e79a805c3c4b445382174324ccd825170e30ecb80a3a2b6bb926bd32c9835a2abd4f4ebb2b16b7cb6bdba08808d27b0ecdb7468ec69e94e33b76c8f5a6c1ce3a48ce9cdcf6cd002e0e7f16ec00f6f63178795f515ce1ec87d32887acc1cdfaf3990bef42d114438e80f997a51f13b35c8d540962f6631e7c06361507559d0ae089c704ebdd6209736d48292fe913d30f6d00a97e345f7eefb894588fc48fac8ad6000839e172505b262c137e3197329c0fa94d4e45dc4248999", + "aes-192-cfb8": "7dfa1a14515cec09ac5ae9eabb474400d6fe9308c2decfdb542b5cbd76c4e62f25e69fc83ddc4a5ea26801d00f98eae43605e5966cde126447a04f9168b837b3358794a69c8d77e051cf5a0765348b892ecca423900d145e427beb2768bfb30e2ba8bd915748c4a188e3903b0fe2f4206d5f6b9b2f8df21c020ad4f438df015a3f76061a81f094c256b6696112be1e7102f1cd44a974ac1b557761769bd109da0ac2b20f7df4d2c0517e9b29d39b36eaeaf467a9c00011409e6d0ef1013e28b4def2828f56ebcccfb6bf2d063d6ce04d4f36bb7990cf9c929fb9b449809fbfad6d619efcab6cfd7e360c94c18d004b9f10e6d989acbe4eb87e4c4af46c52b4cd31bb7058809198e577aeef0a5269fe86cb19f66604af88e02585d89dc7313c335847228b6c946cc11278aaeb5c6cfd91c9fa853e3414967dc03d6760f0a488f0d25f7f359edcdb0af43dc06df948d1e248fb69e656876801fbb2799c074182b3642a783342927a41f66f9df7ad4e471f94df1dfe00d3407f956446f82ba3b37b520534df15e182274f8033e543e0f3088c07c79feea03408f290374037e354887403e26e5c6216a19f3e776f5bc0be7c417d0091f5696b5adefa4492ac1a309eb2ff3b0b01c34cd1a6b4e8258325bbff62c0af5e045676f93614864dffb5bfad84d51de7f70d8442997f67808a8f1986e63c9186077b48a93eff4b50a6fb07987282671ef4c6aacce2a1382cb059ac5739ef5169e318e92288f581bcbf048c8f7fd6dda48437b3ecdc0fe68ff74d22a2564a1d4896d63db3543eaf57c10c852c42b8d914a2090207a31ba8652f84bb370199e6c94e8689260cba17cbb5e76e97f6a4cf84002ff2b2fa74c6bc712efff2e89a131c3c6f207d68fb09de98c76724b3fa67e504345015e63e5dde0abd80d191dcb0c97f2e0e790a49742598a7670b7d89cfa5184299f33fab67f811a8901efeaf234a17bbe0879afdc5cbfcd560a9b15f0c3c5b53bfc703fa9bc8b50db955c345bfd3b3fb84673e8400c8719bffdd70bc0fb0c1c5013ccb92c31e72072caf2001d241f68af7b9dffe44ccd73927b063398d61c1d5f10170181bbc186135e26eb55c53f3b96d6b25c90333ecc5413ca7eb520d0815a1b3c5d3001e8c1a1db5d50a181180ac01f5c174a7e4bc7079fdb37fcf8137fb0913c392968a9a2fbf3a8f9a39133b6c8adc65f94cdaddb24ae3862efebde38fad0a9e8187e74d24a63aa064b25190bec3ef23e03d7e7fff27c06c95b90fb67383e20c7b45a059fe318d93ad6a9fdbedab6d6acc8b816dfa167b7f04942600f837bbabea3d669a4c1e9d32961a29e621d248f16a86c1bbf848f8e0c7a543a2c91d4cce0cb8e8f90533c3b03b19ef1c9d159c55624043035d481bda69f1c9a453a3d586eeb7bb2e4c6df52fe33a1ce8f3b88f33282d5d09a85db83540b2b21c104fd73522c2a4bbe5f9ced052429d0cdaf6cc13558b87b1c54ca66eaa2478cf862058c742909a47bdf098a0a745c93741961e0f662275f5300f6fbfd11caffd6e26ae28a9a772c6b45a944be9fde86973dd5ae18a49a7a6a9d466ce6a8ed3fe7b93fc64adcfeea3b4d8aac7f75a6dff635a3a2015faf16890f4531e6df7298d8284e9290bccc39791a3548382b3620cb668322972ea17697abdaf4b74ba692099d12931832300167eb746323f4b41c6fc9664c50fc90762091190c391dae903a42ab6630b42c558258fff9b08e4de65d9aa4999258ac950b24e1efd38d501cadb7c1e637fbe19b4ee360e7c1fc39075b970b1b109a921c2cafdb84c243dbaa3f6ecc2ae8b5ae8b6565bd396607118976dbb5a27b72d722eff42af66df64f9aaeb3c54204854f6195c4c89467afc336a6eefe68534fa5693a5fa66fadb0719b8b86fe24a8ce5efbdfb57bf77c98594c1b0c6984e8c82d31423495e05b59f069a98aec0b060b2be2b422030c5b319c39be20815ae5e8efe963f23fb25f2dd1859f8d9bff9569243f88ed4ec9227df741b8a5367428a8c7d1ec8d2fe600c6b8025272c7c560e8c829caf3430090a07ac0f406a06685435148b325d31f835228e3f8b881d20d0ea2496d6114d3cd76403fe8985c668b107b9d320dfebc80f3a26417114365bab8724bdc890bd29e7c27765c3337b25497cae535e15d21b50e6130e63f183d5866b5c3be335fe0073b6c709c67fa0ad240ba313d646a52cb1535ae00f6941b287faff43700923e7a6d348ffd544e3ef521c62e5bc8093047fc4143c3f75655cf5b7205962cee7000eb93fba4e7898969ecbf291cf7667e62bd4da59283a6c3a263f1d0f83746a5fd68f799636809432c1d23b6c6850b3e500cb61254c39e955a2b657e137caba90bf19d7d9ea9579220021a31ede0afc8363ac46251337ad176536c1ae35295871a41a74c3e07522de123c4cccd993e126e550484c7440e0840c1171d33304a2992c98603e54b541e25b0fe6ef633a4a019939daf21e6a38978bd3c5cddd298f84b90b4debcea1fa4e371baec3c0599baa2437840b26c6aec7274895d8240a0d8878f590035171dce3ba9b952c1775ef29913fba4c2c1c605427fe1c5e312e71d401889fc27c19980d7773c88efc3de3785d36a5fb8223485ce168cad75ece4c395ce46fe6a3933bf1fe4a842da095ebf5b31e0264b61c1d85220f36d72c54e96ccc31ab24406f203ade935c9f2e4f59fbf52f3e0841e3c692416b0455cd03fccb0faf4e5b92a3b8edeeb72bca1648eb7f093b3a677b8a3b61f3d5c965a3cb8b3c874bdb245f645da03ddec60eaab52c8374cd02dcb2ff9c806db9521772927b515a47c20c1cd274b49b992d54de3385a0e59e834569b766ab5f4dc4e60522fc206f7e5c3989248e98a2f8f5eea5ddd80e8e6e985917b5aafa556764d9dbd6737d03594271634a8d307b6e4365780fbb8f1650e82f73f54192abfaa8f3738d12ce2cfc8ec4676fac68fb8aace4604eb464e6411066c0b682d1da6e84b8319842db4b8f5635e906a897dbba5c0f2664d9dec2be5bb0c923e5f9e5d2bdf308603f8018b6c745821efea1a7925feafcec1988675649a03c68528a0190103191217f3368c5297dec5c909bdcd165c3289cf704643f59a7820c57b0058dd18dd9409aa4ce969fd5d9e9d8272ba45fdb521765a5e65ed38088680c55ae571fae2fc76224d46c41e21cf6e9cefc247062e696c3e53b4f7f5104a76649914cf6940c26f2ba6ecb1889bb81c8464ffaf3beb35fe366c75880947b76bd1b16569482a70188e9e7aaea840da8ebe7ccb4fb6cd67b78d0374109ccda81aa4f1608ed88552fd4605b2600c0581f2cdabebc02490f6c8b8287016a9d4d07433fcf51521d5ee1cd5bbabd12c0c73365a46879280ac531e27c58d6c0deccdc7a1c2897b8bc9ff6e7e16f2fb08b7d655061ccd3b7a3a9bf51f698f4ab12855670bc367150aca2ee51cb8918e996d5c6af172835a1b530b170d79e5eaaa725031f4d09c18ea5c92ff463b6e261b58d4cb06131ab439c34a91ccde8fbf3f7568d78b37855b0b325d9598b3b59ffb0d0d130a4e49f04c4e8ea1492dd8192882e317287065d2289f305f62a0414b5fbdd2cdca35249620860106b04faab554d1919f80e1f86de3336db1738af1da8f65703b042bb83dfa6189e8b14e34d1815fa46e246e96ebfaeaeb9b11703590cfd480aa4ef6eed9ff11e8ead86c8ca79d17780b65cffe91f6626d62ccc90a6d608bb74b2bb5a6e4e2a81b45bac2800c08cc0cb1da7806123e3a978b12bb7d4fe74a0faf2ffca3953bfc1c005645d00c48ec7bfc85d05f95e9079108975704c682dce2c88dab5d3d6593a523fc38f852dbccccbc95e97b48b14592e14944ba88100b8128d05256e3f7218207f2a542bdd4979cbba3ce49446f6bcef5e5d09172b1cef563a237a8d1474f70c1af7288f0b60fb31dd06b7c8d93f92caa1386a89d99191c663322310817bd38d42884c26987127b8387228a7b3b54a24f7727470ba4f8d644b7437352ea16ba7fd3aba80af64814663de983b7d3bf8b461963ddc0a56dbc413f59524d55f9391be7a8b74f7e28cd217b653cd50ed581e07936ab1b5e72c83cd8134f5a07953e655dbdaa3844b5be306ca62a8bebb812d2a66fd22916ad3a5c7fba4b7a931987d26b5eeeac2b26448088b8eb2d65612", + "aes-256-cfb8": "30ddc0270bf2459289b72dc06f5db17651ab8ec24174b158fe2d5f2c6ac1149e6f3da88c7cc10c6afa47f4065006c56e5bfdbee79915ee777562303d6e35d42101716ba1ed8280a6d9ee4b675dad8b5d2ac434288e6248f038c7c217719120fe739e9ee016a337d1e3402846e479d4228451141fb26b8e7e023f5b1901d78e37f98c6809bb1238ba31c6cb6390308ad2db35a27557e7acade96e1280700e205fd2d1214b6d973c1bed5a0571fb7b1e0e8873c9b8dcb34c300b47b51cd5a59345b3b3ec8649c9a1915dc6da07548e0f0f1e7ed028a1c1700e707bf021471b1436f95518d6a3041a99b056d7b432521c0532dab9de4147a22ee8d524cd1aba28407889f82c358b76e106b7f2d76b3af513f7aa75aae784baed56c0940e5cdaed455dc0b60aabed3788a88badd76c25257135243a06a682b41e75a736f70b5c3583d66f67da5ba8add4c1f594ff564a41fb92a6129df377462dd9277cc7bc6f08f7b918ff2cbc0aabe407bf73f2f053adb4ca24ad49716f1bda279d904fce297a327b0958a2b14e7e28cdb5e07c5e94d137d6b58f1fff3841578f0794c3963974d78f7ea108d8e1accd50c313194b435cc5db0bb678024a10932731112edc684c96628541d37d09b8364865eff54df61d6c65f4a06236214c053f555d675801789fd25f89478096347e1573d29673262e19b06feddb039a88d0c928e5fea2f807d31556231dd5c8235bcceab0f3b7e2a90c8e643cf11b66bd68dec8bf443618b6217e4827ca80366b92beeece8c130b6417d16ea992d9095d623ca777473895063f7c29629165f898e2d56609871be151b4686e8942e1ee28eb699ea32536f20840e2534b2f5183ac7c11b0416f68d8fd3b0a507f37257444148549457adadf95029c0623bed056f5164be678222470f0e559ea231d07e3ebd409cac4dade051925f7162bf1a7a8d3f08bcc17f2165da1fd0092ddc34d832572bab2062829bb62eaff03d7f6fe4c25abdfcbfac81817fe969e7a143f1608d3f1694523a346e172f01a8575f364cb54ad7909331028ff4c00e0280aed00e1a822394215aac761ae1eeaca9cc8bd07e62857e946226ae37f511d429bbb7db0aa9ba4f20313312f7096bbad045ea704882f66ab98bb69e010093edd3866dbeaa43281af2b677843608d084e5c6395890cc7fa023406f9bc4fa3f0a4b4784df9978bcad0c3d115c441686e0c1775cd13720112ca1bbeb009bbf00ab449737620b47dd126880380fa7ff1d174a64aa1ab03bd65ce6aacad6421070fe33ab3d6603272665b16064c5da432f3da72263fb4837a2f005cd9b68a8deccc2681ee76080add74f0045b4a3cbf81a42ac3ffddad4be0a7bf32d6d97050d08552cae5375b895eb95b21fd49e8d072a3b8c3590763dff9c83e623fe432f5acf11219ac2028a2724d78df88695477f135c019c7ce30a5462d67479654fe0850e3e4ef77ed1a070ff95f210a3db3232efa5bf40ca41bc53db60be370038ad483b48416ebad8ae384e49d052caf01b2a6d58374a072115d4f8e2f0f789655cc343f7ab86c67f64aadcbb5591865b3cc5dc182de2c045cb267eb3ebe9f0a25123c2517b0ba40636829da7213ada8e7927b3d4b277d9fc94d17140c8214777acea03fb0364f1f5f7ebbf2a73c5673ae289437519506c65e5bbda4e4329f0e0666fc37165948d85027794c183092d896970693e3fa9ddc24419acc602a90f28fb946544ecfe62e8059314b3d55d84d648f321163b36811c954479eb6b9315357b276a07b3593696c31874159646e4e82a60922021d3b70bde15883279b966ae1400d22858c00e9745758ee34cd707a5897ba2c700f92f1a5e349130f8407d72049d18e97242bad255737188936b76ea9e57a2b41636d0373005e8bc78b4fa621ef9bcca28666fba03691fa2c2c01bb4edd14bde9537e2ed7efbc2420a68e7225a2837345fcef424cdbe652a0cf2c3fa960e00a98023a2339b0fac1f6cd7522a1a8e81346e6243b56bcd4e86916174f69ee3c134215698c94a88c982f4af93acd7db229953970452aa0a914f4636f166200b3c968a7a5bcae2c0cbd42a73a47d24dce9b0ebb9ee1c484a7f77d61391871fd42dc9ff07f7d4f46b8739bcc585b6c8acd2e76b424525ef794aab757a133bab67bc63baeb3f116d8edf8a007be79bb44ec86963a29edd569f42afa40c810b982c073105c1d7aa7b8ab4a30fc2491ac89b7e15e9a74e72cbbafe4adeb5ba8d2d242cce3589009b71167a30e48d086aa3e9bd7d4d2ca30cb45a41fc6ad07a656195d71591719a4dcc628a46b86cf604f23f1300938c53f3c9a02c6769f736dc1a86e0c093ab540756b2cb340fb5dc83d7a5e68f5ddfa7c739eae409dacd01ee1f7c201be78b19df12fb7534dc1fde090c7d060b2cd81100cfe8cf07b4b8a1e679fb8afe0ace1acf602a306798bc32c431eaa1daf946253b9cf0b81c4aeb4759a7860e8dbd13e5e3c7c49a1cfa29d583f90499d408089d63b81927bd2457be6d1ff7d4769918041d0ea26483045af36de9edbc0c974af29aad2fa5b8cb2ac5dd0f1e4966bfc6aba54e17b024c9a43f06755056336ad2a066808ebdc0c91af7119a5c71d6c74018de365ae9553d87db6f23c17e0bd95a54adb774e3638f03ff27c35ebad243db23a5113b01163865ce9d0f075d5bf9ec9d128dec2ca16cf75614ca768d48a4a1fd3214727d5141443f078d693552b6f4cf07cbbf97e9f4689bb22936604c394d36f9bb51151878f5b4b8b5dfc1f33753fc4fa7ccc677d45294bcf3f9e32f29a94cb03d892000f6db142663acf10210c1ff3ae125d9b619a41ea565e79fc72b9c8165bf6894d880b40fef2f83ebec10a1305acf1db590cea3a77d347ac6d481bcf73b80af883b87bc4bb59410382a18666383eecbba2f501acc36596168de95a25280a34e47a0aa358e51f46bca305b660d834710eb3c0f97d6e78402fe9afeab15c1aabbea5b2964b5ceccde5e013814333b5d0447a593f348679ffedfe836c9dcaffac2c7e8cea44a697653d27f6c2db571b84737b2212402a98e7a271bda2551a74a5bbf115452d370a468f398fa0908c29f9facd2fcf000d1d79d9087a626b423cc5b4121bd804f7adbb77d5ef4c2cee72e7eccd281ad0188c47cb3815f2b5a13870ca16894802d0a253b810d9e9abb54fb59d38008da5f8eb58e4c5bb68724f1acc3fab7ab62d1f3bff5ed8b8246ca61591230d57c951bbf1f6fc13c251a3527975f4b957692683c8c5d57800861b971593819b62a79b00680bb748a3f9f192835711924107d2b5d0b612568893ae314641292ea525f8bddf56c95cc44d5ef177247da43a568ac10aaf2e6d30faa3548484d63451fb89cd73dc0a2517abcfda82afb7ce010dc5cde320dff37fb6ac44c4c54a88e6a69ef9c91fed2c076d1ff203019cb706272b3bc4800e82f1f92899d8234b015905080c2b77a527b9ec6127ea94698cff5bac2cb98c54d030b9c090cc77fb5dde32d08c29fa243f596742d4ac3e2d00979aeb5eed52cec5c75b3de2efc9a5a78944a50ac7b4430ce3f2ccef1bd51f6ea582f13dfa5109117f18f675662ba8774e61ad9d45ef39a5dff4bd1b5559daee8a733c167cafd82082302ea4db00362c893b9ecd03930a5aed391ff274e837be9eef45c3e96b9dbfb803645109eb4b8751fda9c161a9d8d99c53f3eed69ae157d4d64e8b1d6e16592acc2f9100afc44d98f9ca429517eacc36168528d7e14a386ab6cd874c3ccb12b5799be4c80ef385e3d2284df2343fdd1d94bd9e6872d7f64354e9d39ad229dff91589bbbe629805d294164297284cf16870d868c0a3ad09e0889c0df2aace5592e60f315d83c152534829ade45c063fb22a75a8dd2c65bdec25fb7e9f95c0e4982da20d3f85af0318955934d82b0c09d2053d19fba03fb5dcfd2ef7e0ca6b4c081eecbb77107b0a249adf93205de2a4ff857efc0ab72151011f5767318effd65055bf72a40b0efff43f645e20be34eeffe0e948bef9c21f40403dbee8983a49855758b05275bbaf20accd66f3b9fdc1654fc54fcea7287873478fc2ae721fd2fb585546bb7e1b076d42a48d923f95a8b3172846834c6e6576fb084ff5311bb0e62d967eae1b1092cccf4f9d15d2ff5de403f8d777cdc8035336ce44e7", + "aes-128-cfb1": "51972ba90574c0b919169d2430e5e0c3260a8269a58a69184b1c6b5d5a59c7c1caf18b07fd0956163663237a548b8c6dff7e4e410c7afc3e3026409e1376c35ca5d04c86a1f60098db0393e5df7e554e868d8ac659700a4c2c7972d4bef1cc0e7ed98362c3b9f29982e5521ad62f302abc8d6c0bd5214f488586fac2c7a4d9d943f23896b2a8d5c58435349097c2de6cced7913a2b5530ff17a2ff6278ca8644eee144bd118c39f9102d6e131cc583948f776acfd495637b3c2599fdcbe145e6249ae0a1fd2ba33663971388a7de2b36a6cc68f44fe3a93688eeeef181f76056473dc04698182db597e9acdb6cf0e7b09c4dfd26cce57b054bc680a5d6ef7590085cc20bf7360ece7e5dba690503abe1ffcf393ecd7a1a31e77964ebc196d5dcddaa7fef38d2887e8dda6cf5130383a28d44abb3fbda99299c47c0c7584ec709753036055fc4f2689958e56a748308a02e631c165d555e4277e3aa4552157779acf0164a3e2b8839b97d5cf76aa64893bc2626dd22c8bb73262852bb0ecb49bdf205edd65b9790c114af26f632ff31636754520d1876900f10bf3a26fa239c69cfd2c8627ff530f99d3329163aea485e48ac83ea4cc3eb9fdf204f129c4cc76f029ccdaf50b41087f4b8de9f1b7623f90790162eda272cad61850fcd025f41cd40ec09a98def22531a9fae8950591e34bb49f38439410ecbe92a007637640075f4a9ffd2e7bc7980f8aa0f95071ca67fc48c308b7bb2856508df0da8006fc2071b79723bd6c752e423dd19d3a202b1b5ee571038c9adce249a0448dc299488397c83beb16cd4bb62dc4c08c7a1fb584fee54467798215a88409004b1c3bd665a383a49cb77a9922b738fdf021910119e04f5a7980bc6988dfdda0e79d7da7bc7712c8bdf218aff5b569d48967abef4335f5e52348f6d8222d8cb107a589699382dffe51fff7cb832ae1f82312eb03535ad15a226170229ad435c572895bbbc56c307dbf38e2232e259f0b48cd7c5aaf4de35961ee5f9dfbcbc40ac5072043a547c22c08a321588c399ea4500502f67788520f0bca36f4c02d62bbefdfcd2ee3dbb8efa14a8d3b442fa8e3dce27d69fdf84052c05925f8bdda62f811f796a1f76c2f437df18e8d40b5cc94ebf5c2dcde5a848ec08156bc457ba85997583fb66ac1af255ae7d6a56dd2366bc67af66b9b01dc9b422332a54c59efccb10ca9b54bac20bdc2914fce0464bd866c80e3610539bf37e32f25ded292ac60a3e6afc3fceadfaa8e61023bcf6c1134b0ea121f68dc98480d758cafadb5b25beb342260db772b53aa938d750039566c03537716957646b113e8bf0e67dc3bfc2a70cf57936f06fcf84e3edd09d27528c735fbf1d9641c29000d5051f0ccaab6a03b5df1d322011e8e8dcd891b9e3167ed811b4098f1aa0ab9604f9b95bc8e153d1c3f1492afcf472a46a4e59333ae5505254ae0a9a5a9107f7b1839a619a5f9c414df79a22eb186d8b6b9ac5446c4d42b2fdde5670305af0e47cac5411226eb171c6aec65e3abde33cc98cef49af6dfb11881690d4f9c47c10dfb594b3e673ae661875d18afa289107e72d7cc232aebfbf75b40faa4890c425138ab0c91db8dba4ae6961230e4d33cd90d700289f096353c9591adba262b79180943356a387ce525dd7308a0ca8f0ea118c48e19e44407bd1f18ada1f7ed6a1187c871f6293fdf12c193a034e7c19e502e326567fff5b3acfc3ee26f596568ff6d82dcf26e990f811ba46285ba8a52458712cab8be6388a2bbb24d77ec92db350b1ab067d5a6d66491b8f8764abcfcfab9de0abdc344f35f0aa54d6a16bc88c0dac84c0d80ca2971654b8f97f55622e887f4b4d1088e990618507646dc629d8fb48033c0fb45571c1e591f2ead70bfcc58dba97fe0309ab0f6cf0f5e4507e06bfcaac4952f315f8109a3f9647b77e41ab478977c6d9b272328821e74a267a6f0a7901fd79f9466152b7c8cc01833eab97176153b0e2d0f1010f82aecb3848b641caf43c17b83aa656d5f6e13c219d6749ff21ec25992f6946fa47b91b0b06aa08fd58161ed029c04d96c75454f58dd16ea082796f0687d5768f6d3e91da90d353100bc572ee063751b42884bdef82793ddb2456b95a3480d3d73418b0704772ea240f2b4b0a40cb3d3608f58a4393af9ab7709789823b323081973ccb822ac427c513d542009cc19cd93974e01b7277fe5e14082ba29340425dbb33bb8fdca0cafdb30b88fbb97c58421b955e09477878c8545d9f290e915e036e209adc80e45450ce126bc02f2f688d8d0c4a9b228a0bb6457a6f0fca556499fa58ba8ce9fcbe4dab46f80fc49a008d1c393a5f98882f473a566b4917af0ce2b993e616ec336eccf4b5461525024d82a6d45714c4b60c6c172686f68f691e5dd07c9b4be2181db5bebe581f95aa992daa41f75059b5d9e328d082220a1e5f8a1dba5242c0e1461c4aca515ea280fb8b36ed187311dbe0b0fb3807df41bcb301e524fe3126f91b66576ba9f8a73dffe5524a47d8f3043810a5aec20571405808903b4685ad880913a9beeac795a6e05da2cb2f1c255e50e77d2c8b55e59e6d78ff892052c243a497f1fbb7444a005dd6ded7814a6a8f19aee4ff7e3a276b487be0992004742d67f4512018e79c83d59d49b9fb1a816d217f9a60d398a63435e1b898e76243c0a446bdc0ded102a7ac924cf8c172e6f00ee63b9eacda421d225e6c9e7e0b4fcd137368dc1fd4a6e138e53b8a1e85e5f5b98de6bdee536c7947bd46f86ec33cc0ed1c05201965ce2c8d0ab79430397d0ec26bda55dfa8c0ed8e67ab65cf842bf32daff0421f9fa7cfc2d425893d9e2b47456dfe1b37319d5162dcfadd05d50fa60843395c0528c94e92f1f1450a66d5523b3dd02e7d8eacd4485f87b17c3005f2f60f892ded3d89de453b71a9c0312adf7175eae95f6572a8dac34dcfa595d5aab06b2d9f3ad5c630b2ac9f1f7ef198f192cb62b292013d2f01b91ddc0197ccc6b33e9c9cd4adc55fdb3368c59bab4ec326e03dcd6c765a6777c1d3f7723668b4573a425c2e1d92bba133b4df596fe10a26011da35da17f141a8ce193ae6160e8e0a109134ac52117c68250039a023da25d5b9742885715f7f2a2d7ffd6fc684fc3e9dc3dcc7773918e04d3b6f26b5975716caeea50aaa864b09ef3d39dbe655010c5ff0ea560ce127532fe37f68f2055b5a5bc1402ad8219debefeddf6ab1436c021d5e4f5197a2fe1b79a620c01234d19afd690179ea5dfb1ca6509d1662ac156235661ab354b9b293ed3fc5aa9a9d0f0057b274d92a3aa5f2b0b25b9f440afd72bbd90195a9ffadd9ee6a7e57c84faa66a34dcee82f20cf3d81656ff06f89f5339f32206355cc3013382a612509effdf6022fa1d8204e03366f548bb5a87af02e67ef1416e961f6cbb94febdd8ca92d1d00df7dfa8ebafa8603bed61479bf0112bc37697ae0038a87c9d28bc09992c9dff3ecd0400c1466929da20fb4dab31e1c587600c00be69e7450787ae27edfe4519d9b1cdbb7ac21607ddaed986ebb837ad993bfdffcc8b036b9ab49e066bf691ee13bc540a56a350e0f073685c90d58827606030e8c5c7dd0d8abf3eadba4f7d07b8c392198da68dc3c726f833fbd113ed2caf09ddcd91c828b54c2539a38a6d6449691d95cdf8ac888ef0319838a377a4f667729cce1f23a92065b75bcd6f8e9be4a5aa59d0d7bff14b8224eba73440390429834483d069e3f4e7d75bf32b566713ab228d66c7dc991280a577ce948294026868b8e424087865043e7a79b83efc434c3ef34722f778d08ff57bae3a5f97e7c4998df2984f21696e0aff8880d6505e8bb9cfeb2c0734e8d2f2da7cddc8bd72ca404d860ec839302472655fb73a6015a85f30194c2e80a23e06238605326b29231d1f18f3ff152b9f4639df63ee41998cecd5b6f7fe9a7b2eafc8d8e3712c7b9723656019af0666ef7aa5fc11cdd91299f7e6f9bf45255a9eaceef263d05d2dc5e965059316dd875ba5708d283ca196b6b594f24cb189b4fb30254068f405c5b2cc283be93161fabb7f87ed44f6df543f2c0a4ddba206b1180dff0403ba7613f56d11ac0aba0cd00d9013e28908f36ca0644864a1221ca11c125f5bdc124574d50c382ca6253bf3c8d5282da88a2dd09219849c5ca344", + "aes-192-cfb1": "143f8cdf3a535a7e8785bd9d0e2e5b7c5435291b37ddfa02dcf53dfef24de0cb050c653519f29adda8eb2c4245f7ae52bd9e0552805f92ea2c4acdedcb41229c35de386d07e99e74e7dd4e239ec05f189c6b0d9955506d682d4143f9599c38720cac7268ec2f89a650236b694333f42d914dab0d4df299a3ceb8604ef06bc08d0f77df70b1ca853cfde2ad5fa522c05ab421e3f386ce7b94f3e1c71005d91d967251a49ead282ba6a2ce4f7c76c3eac182e2c57e96bdc33a71ee1856d9e40f404ea6a0853c0ab8abd5e874b73748352aa3e0f4c54b836c0a67ac6cb45325f929ed7dd27e263a62d4e9b00dce26da94c5ce8e222f5c2f8a6cd848540365da0b1e9ddda6ba8e9ab88cc48bc4bdf5aff8deacc9a9bf0aeec05751371a3e9d79f1a4813d4c38a8c832f3059d59c10a38a26fbd14e4e7c49b590c3ad21632af7490e2a4f854b3d06b1d58306775f0f8c9423afafc7076244b59c2652db3d30e4abfd3b7a536ebc199a3b2551500d7bdc3975d3b6edd05e59fcc6216c246a6c62759ccf41649557159ce3dfc5b01777c2abfe80d84c85b4c7590d77de0ef1d34b1723aea20d5d79bbcc0beb54330387375b851a7ea12ba815273bbba614e0be0f19c97013400e6904dccbfb77cd9b70a94ff4120846ff1a8be320f8bf8f97b7837686c6c78dc675b506d7270ae547ddcf01d2280eefbbd0b085fa1c078b2e26c379c13f447d74921f778d5d6fed2161a564675a81b445d2e9ba6043c0a51e476a0052cb22fb89c91620085fddcfb7e7f39f316adeac1f94b8359c1875eb33130f0a9fe0ba97e4ea485ddb49b5df7e8b9b2b5ad03484f5cc162f4d356fa06dc9e17af35ef4f2cff068b1f6eb22a71e353e7175e878f56e1dc53d965ae09ffacdd63341e69ac757cb85302650b2240be17f7a0e642749e027ab4f034b29efb9a841d17c207103c2f21555289e99d73ad98551d2851533695e250250cc769e188bf35d8599e9afe0dd14cf6f62da8d8e33eb09498dc475844e614a68e0081eda5c4b02a8184439e08570fc924d70e1d805fbd5fa627a1cc7e2d6edaaac085890a8085ce16e90440add56515db6adf03bc79547232fef9adf14033ddab83a40957dbc4e378723bfbd37f7f93c66e619f4556c546f67ddfbabc750505a0a0e14140a380f31411056a23b959a92a9b1baf98256ab5f16999751dac227e9260b58602fcff913d68b17f9c1ba821b314ee289d8c4374c2ef375ca6935e71d49c43e42caa63631aebc55202694cd08fb98cd7bfaba8e6b3eb96382c5275b5f57bb51f660e59c4bdeb4d15a802679fd0c4997331cfb40e404624a0bdcb88531071b3491684c6487bc81197a09c049a2a45bc474779113bef2b7e45ef7d01c9d6576b4de7fced3e0968e558ae5229d8f6dae67d6979c6b31ccdf9ad572dc15c61cbf2783fd737fc5c9e5ff0507ffbd61f05926682f24ca567bf3a236a9fa6fd0aa4df5119d5f5063c07fe43df8680a2c35931ddeabce9d1390c06dc0eef6718acb0f44889ac0473242028939053dba9958256f566b46ba8feb49e87bda202ead5668b84617d55a48cb914e2f5ed68f10e1693ad1636f48e3f72f85c62b0b7ea0d235306477f08331b7c3201113f4a88198e50acb0fd6a1897b176b2a79ffbcca29b42a6f6164269a9b24edc3ddbf6835555a9bc5a5ea6a5b612c32105d5de8389e36d398f2b8191906e56c21c6e11847cce1629af38228e6c4ba5bdb7bc8430d332d63281da2babb3c4a3ce6b1f04fdf799f3e285fbb34f3c30004602ade20f8a8271fa50d3c57d22cc887a05ffcd9bc71a8d4d0dcbab472f456997cf0753a2224f3a4d5b810d2150503ac3aa93ed2bf588528ef9719cc0fe5215656ab579797ca0af7def6ff9bd83b986383ea4f87ffbae865368036271a1cad9ca6f1c30553ab56275c12eb139104378943f0518102b9f42fc8aaa382def320b88016957e5005aca33a84d1edc92c90271f3ed7d1ce72d62f43666d547efcd2f3cf280b5638558f01b6578e065ccf271f0e77d7bf1a824af4bef58e5ab35ad82cef56f007d56a1bbc9d15deff7c6bbe67fb433a2d5e6f5d5c754a77b9574f60d2457fcb5caddfc6dc6fbff0678ecfeeb8352fbf843904afb8eb6006a613e138e83b778f24f5ed2054234273914edc8d63195eef6862de9c1ba956077238f77fa891c8b4bac56ff6bd49af5af178b6c28059e62922da66d37b6c908611df51edaf0611d29850c6867428d27d2a445d8e338dc7a0e0d8f69424e3f7440e5425b8f3a8dfc50fec8a465e154a3b0dc3fe116bfa26c67ea6cfe16e895d78fd0477239a6c1cebf265263821839bdffd58ba20155fb00ad53a0d1733f5731f3182d8a144f8cced60ddd924b44ce9d963ab4d00f656f190f6ad94179ffdd6c8078d56b2278d257bf518a231beea9c14e0d2338f986b38673069d1d78b922293891e319fbd1c3c3d0458324b8b307a82fac03a430c2faa149fad261d5f5328171edd338d4e061d0667b66dd5c8da454f75843b5c51b82e7b6338ff4c478b873ee07895b9a6afedba90a61a20496243eebde527cb6856d16ea95493966752356418914e67b77c0c53d7975f10899fb56c0a656cd702b837dee7055e5f7c6b2a7eb098494a36e1da8292c76e6a4c3e68952a732aa52a0ee5223485909a01da62e8b3d8b29368aa62dbe22aea6eb5b8b24276ac820b353ee748d361cf1462759c6082bb8cac361afb774eafe49edb384fe54340f6235c5a4558ed6b67a566433eebfcea3790c1476d8b281d6861c1a846a71c86d6129b80c9137ab45116e96e461e54f56f8916676c1aa2784809f9ecca68370afa33c722d71a866c19fb70f22cf2092750b3a92d891c68be9fc3b107830018ec6f4f5f73ada32970cb85f33e6caeed38521113f1e124a0edc7080494ea3df2992fd7646d7e52239552d76e0fb9a5684f97b1ab0bf63d6ba181776c0aa414e3d39983bfab9f402fd5f491010db5dd3e3710718f8597a3e77aeb644c5e1e87e1ec3f3a3f4867cebba3bfcd05669d779d876f6dbedb08c29b2c5dacb96211debdd18a24ca02e4069eb806b0aa3a2db3edb4923836b7fcb2201e39621bc1de27f7f3c98adcaf52823f2fcbea060098731cb9976494372493e8f6c17b5f3fbcb4dfb352f29ad3b3d7d00708ebfd6d959b1a078d557cc9b80776604436640ea89b9e1cad29bd2501b6f2bf3b9008962e4193df98008bcdfb498c5b0fde10ee8ca30c51d21e1e4b462996a84e8beb857c5803a04be6e71e4df75e320d78536bf6c4344a10d5fea875f5bcb90cd268ab7618bfbd3caeaccd284c6d33b7f673c4bb718ae3af256c03bbcaabed2acbb0fe1688b3d1d339e430896de74c5ecd3f71ee81abfb584dca3b532a1f50830958dc7327ad5c73add5aab294c34a8f0f7047416ecde77f170f4078bcfffb0eb303bfa0f11278bc603e7781df1c279785afbb7e30949341cc67c54c7086e7ee78d39037391bef40253664f389c113992cac0ae2f042ec41eacb7f09be03d16cc38dd86a18089338ab5f0b54ce3ec4cd93d097e8f0ff9c9c213d4cf31e305de76e37b37d87423a57dfc6112aa97f6292a45a59b71ccfa3b7400fa829cb30b478f26b28d15d09e2a2ad8c4cab330200e85cc811d0d0c5556818f1719660c8f3f92a64b0462d9d7606d270729a07570d9385ffd5254cd775b5c7af875c70212a5fe838c532c55361ce0b5981f92916d31701462cc5fbd0081017e533d246f92f3abc47d4d8f76b272c2210ad0a46c80d4fd67c3fb4e39c6318b333c28cb96d847086d60f9aff307ce486feca0c085dde35656d3d568e6f1865469e640fe23f27a37d843d479767a5bfa990e1d9344cda93620810c8bf727b9dc19f0cb489fcfdeb355a1ea4d53f4a8e524ed221f202b94650470301b0014d84b95c742b3e15e94a39aeb32375ea704ca01184ec81fc16e65e6c937479910071ac127de57508ebf67681924dde48fbac0eddbdfb673ffc91e63cdebbaf613d4747eb2fbb8a694fe33c353ca11bfc2cca3dfe07434647b46897e9181f11b6514c4707697a172156def0d34204cf5defd92979babddf14ff4b929b35e251238e0d39201ce36be6914ced42430b893768c7fb057cd8f263a4799cf345227e80151c05b21ef7d4892b1c944c5800b51", + "aes-256-cfb1": "5bf6a655b75909385c329e73fb8cb764c47cec757d12aa4cabac9052cf98f41b0b3f1399101d8219e53c4b2cefe08122b6074ea674e17f616f34652dcc733724cb69ad248e9780200b484ad6b0846a94c77477fa735f87ca1156049d1c4eb4b2043713b7bec692cce9efac2516fe1ae31b4fb9b104ecddb70f74604cd0a7ae0060197b22d01e49d39b12f1f681cc9394d087453aa7132a8a90f6307610cfdb0e60d82ecb9af373fbeb593585ffa9cfec307ef202338e4e88ac030c3c06a4538d96f93c966a3d01120bb42a37a67172cc6e6ea1835e48bdc9a0637c5524a656f129ca59d5209ee82d7aa070ea669ecbe6252b9d8221f5c46b7f14ec6de13e45595b1416ac5bd5559e76a7f684bce3b17ff892c4daebc390376e9b31c1bb4bb237426d257cb5ada26eb127d0c7fbcca07e6d3566aa539fe4f0416dee65e8c042f4d675f17f6a7fcce2e41e9a00c6b1db2de375f8e48987f1db954a4ae2a81ae61d501abcde3ea9b76ff3b1c4a06b111b07515c9f4ad4c338385498abcd9090c44ba14810d86bf20433203f46480d4905985ff82a9ca881ebaf5aca4d96661bcaf5fc1a03bcd48eb7e5ff82e995852bcc364f280f88682d6e33b4c42e9699fdd45a58dc5ff4155f6b46a282bcae4afaa12a64579de93e6c605517074539d8e1f69b300406e63c7895a600519d33f6383f67794fb7ac3c10e9661ee040d137c3579cbdb32abbb14ff35476b8356a8a92a0653d29fd2a14aee8b94609f3368e3c03499f5d27f9092047a078cf6f575bd3404b42375264a4338634188b9f89cf7fe1d57f0ee6dc82d77e76cbf85948197e4167f18a7895b16b9932bf0c86718f8d4375d457a20ecd8ff84756c59e79fe54300a79acfc71fb62d23206fd0fd4ef10f0a56ff7d9d1d8a2d2c86f0391c7d243f65f4772092744cc3df480288d7a2f94e2e8a43bf2bd6bb4d9c262dd50e76b64002f39f482826f26990ffa47d9e95f4df694f9c2636ac9742d44ae972b6d063e2d2b3c2a227d2603b51988c7c7124d156a60bf536205c4bbe50d3e4fad89da6e973d4f017acff4da5b9290ba653cfa40e3ac44ac74b243e8777039e97792bb46567ba00e69e4f31bd798fb4edbc5a769e4c724ce75b7186bd464b78fd63f1f358f998d67e4bf4b99966491ccdd73e688c5aeebb574ae0e78564099a7e05170cac7fff12345a230a9a1e5d9939a833b2e9f430a30ddde62b6d61c1e2164ab449f5c1bdac83203e9b46a90230acb2b1cdf3d4d23bffdc224985c3b898e58f4744e58503b763a273343660a54cfff7fe3c626deca8141093b2523ed9bf53100567f4002d7c518c375df04889d49b118b6a889fd570307e6641dd2beea22e0891a5de4544e0bbe6097231dcb687bcaeb28221a77e472e191a8b5c0d396deab502e981926db444696e85fbef52b94c12a6db85d07522be543c066cd56c3cfe8bcf1ee53e65dd7d54a58f76e90010c61499b71acb63740a644577b6323fe7d2a64a0c9b6aaa8b7b88bc3f2514aaaac8f3763c4264ff3b967acc841b9f3df9a84ada31940a6f645a124d8e49a5014a508e2de275ebaa93e2857145f3efb7033ca80e30de9e69804fb43344bc54145483ab3eb2623cc7f34aa6d4837bdcb7bde8cbc64aa2b63bacb12b6f3de116ce10eda5b07cb362618b5f9762e36784bc671abea9537ee9cff5f1678c61f659be7e25da84d6a47f880b7ed4ea49390c5151e7e12d1db512115f097735bc7a11762febc5527a997db872d9dbadab2045cda7acbfabc94f00f52a7d372557be932285419a5429f0cb77b4b2e1aefd9711addfdab655c12c5ec8044e4e8eae55c54c713bf43774631b58dc61c5f64a09473a6eb88c189c0131eda31264dba4131442471c065e1c5ab5dd950d0daa57976e51f486a1be7474d2b9df34bdd4e9f8ba1579c00a745894c2a6014583f8da29574dac88e189ededf6a93e39639279ad66010b342c35d1a14deb0afb67cea472a4f092b5250f1c6908dd473eb0fb29ce569279e0ea887b608eacd983e0964c11e5af050d31eaa0d755f3b306e38d9690d238fad999cce827847887826d2a3c5ac1859cb69003c8a1dc88dd0d7a00a2d54247bea715ae2821ee8113a00cb8a7a427d60cd3c24fbfa73997fc91a973a02bc30df0500ceba8e0254b86be1f9c37c8ec68042cbf8eea46968fc794322ab4d77a6f8f5c70d1bbe4fbe64efdfaa9d25beea4e8fb086de6b93111922bf731c350e4866e2b9ad11d464932b7c96fb1c9bd214508547d1988372d5083bdb5b496bb5c8bcb7576bf0c69c9dad4cdf1bf52116af7f60c98fb2c9d1a1c1b241dc8cb782c1b2eb10c09510a1b23a439410614054626bbcbb6925b61d7af1b9e0d08bfd3752e2edade8227bae24fbda1f20356af889e405c8226dbb5658450c159525bbd50147053cccf905ef75a05be996eb0afc1d795c5a6cb6bd400b56c5ee241bd0c093727d4dd4f5e07f497cca7829f0fbbb68a8499be73e922b5f07af6175e46cfb841ad893aa944866f06eeeae1c27b0fd8b8be673475b8e48249b2b77c82aeb8e1e23671f01e980deba8f700dcdc5d26085c870e2eeb87fa4f79c76ab4b830e98726a1abd9dd47b1dab6f20730e72fc1a0276524663acb8940f63adf52636a3e81fe6283f8475280ef138477eeff71d146002f453ab66dd4be5a14bf9ffe916d249d7ee8b6e4e8c0b4ac03e1c97a656fb70d2721bfbc6ff7813bbcf5390663ca0991523601bc2913901585207963cf57e09dc5af59e1ceb8101179399a7efe7ed163e4ada09c8644d37161ff86ff3ea59df2e3d8f3eb04c91574d4beffb4c174e86e750ac7299ef0da05ab74583aae5cac5175021c979cc70dfd2e4c6ab1f032ff7a080fe72ff1de55e4827f97b08b8b4d0e75f52d3a510ed4bf53a6e8b7fa7e17788223e571dd2b4652b0d1dac534a7f47016ebdde5258919086821340f2ad18e160c9db72e8958c8626cce9564bd0c6a9990c5e609841216c38724647ef13378da09a8a9916e01d35f8c0193bfc2694b9fb696eba3af0a46cc7cf59f2a34f9adfaee5ecd80fa0882917bf87fd402c52423f52faae5274003e43992b48a3095109d5b819939f31c8553b195d6097f9c605afeb5761b2e9d4add78af43915131257f650bd03b6d4b746a4c264122d2f39a2e853d21370ac51a20b31964d269fa11de26b5a7650d35d845f52db027c1a660b1eb047ab21dfd995342b0bf09cd4250ec31ae0cc2d95187cd4b4dec09aa61c141d84c6120d18af1fa2c1db81a84f2e7b1ec5bd86214ccd595815b795e33f3f098ea02e3706f4b4b0d21284a63ea882ccd660371f70303e6c6dafe51416610c6987b216f0f88ebb4dc096f6f81e174ded687bc28c7ba500f4c5bcd2360327439f64f3c26f0e6c2d47ffcdbbf8ea60053b581d906f51191e7fc657629f3e40ae94f45d5af9d22ee9fae969ae266280b1f34e8582b449f96c02557e25d497f177d74127927090ef246da2b200c9963edf894e975ba1bfe3e2f9d498a068de29b37aa914b8bacc9d4159050d229ac4dc5338f5cef3d7f2a1a3500db8f2c3117a2ceb80aef4061334e444254bba16f43cd544f19f9da40661eaaf7cdef7c21daa3b20cc0d60ef0f79ec53ebf8b234684f23b6e1cbb0e03cb86cebfc91595742165d7bf2841d6873ebbc8618568a353c8ac36b940758763f2a58efa8898b88587b819940d6bac576c4c3a8689d42ea64b69f30d6aaf0a2e3e876e2392d8d37929bca049d844fca994fd7e80ce05f6899b7017aa03f22fa7654783c2300c9320b4becb9e6d487d762b99f1d00fed5ad733d66744cb1741efb98ed2cd40409757eee4b11819aba970d25909c72c61cb5879876a88036cd9cd8be1d7fc9c65b1a23422e1a7f2eea7dea3a5658807e411ad9640441d3399e7489096ee3461f2568cce2a961b4207c0cf59466f698c3746aa4d2e4f44177ee07f1dae2a70c0dbf39da6bb63f2fe6268cad2a334b2375c0534f268afddcf449a475eda2634e8689cc8c8f29423cc970f8fe4324f26fb7901729a3607aa8d7b832a1f0a0706552a09e368c80709ac09ca339c58b69171fffc8a79b95881f7b2034b7448682c25d98968de5c7017f54065516c523eab8c02c46b7437211fac498244964ee77bf0b7c1a24d4459225f59c305a90" + }, + "cipherivs": { + "aes-128-cbc": "4b16076987e98c4f2be1bbd59da6dfc56a125ada454b579a09734bf8f283e8c97f90729612208d14628be57479ad16ad65aa0a9a434a79dbde14182a530bfc748dd6c43f8768027bb53c7ff548479720ad2b5c0f42b82070be9d4a6e608786185324bcbafa9fb457190b1c99ba055484cf1156d0ff043e740dd9d32d51acd82472bc89f93f15b631d10034f10d32dbc943bcfb846bf4b46eb4d45d73a84061b38244160bddcc70fcd2c960242d5ed8b7d52b376c052300f29f19b964d5ca8407ad203bee8a85bc03e108432b3c0786e795852e20f20b7392fb8302b694f3422437d18b11c4dcec05b6cdac2a4aa58b1b7b4ea917d12457926e886bfa0be98790571ae062531a5ee86a71a847b1c66b5e8bf0e5033e2dd57ea6492acfbbbc8cb06c9c219875f616b81213940be2321a5a492acd86c0b1056cb1cae3cb27bfd36be67b565744be5ccddee6a4445654a9fb64c8770406f692c86c40b029974f1e33a59c89738ecbc2dd120035129a8e282ea55ffa094c782143e458ce539ac1c0b95f61c7cc41b9dd57b9e138482649c84aef801096b983cd5b84f046ff6f1299a78b4c222df1e51e62b02d5b0ec186d28d5ba3b0851669bdccc691e05cd6bda41a6cb18a9772769705d1e6d0b06490567e837c4a2fad0f9ca46a1c22a14974c3fbbd255db1ddbf7588016d14f0d3574222fff0e4f5e5c87272d42362ca070c4cda30fd6ec974af6e31b95652e712dd50d964ffddfa96f90c6d1081713cf3663dd5dc5940c367c3581316661867a2ad6ef6269a2532f31edd3bab5180643fed0cd14a34ab91b1db6f1841c8733cb15d244b020583792e2f4cd721cb368a49a0c3f9e606a4eb0635b4023989478256d543062ae88edc708e689d6dbf33d33ba397efb51d334cc147c1507d09e09760aad19f66e90449cdf8c576aee2a1b50f118cfb3229fed688262026f67b4d0a07e509b2c025fae0d525c8082a5ca9962d641bad72cd0b0cd178f88f7f7749ce910d754eba06776ddc237a4c46007c9fb850ee868176ff457840638f211d4b249d91a9046d07ac3df5c7d9cf89c62cc5cb7f4575683bcd67c66f9b00dd1feb5314f1f6dbda7848f38263183b0e3fc4326e2ad25a08926cc3961ad66a282457fc85dda503663da7b92dab79b69455dae00f96f891b41d0f292ad773efaf00b57cb9465bb6bde044e56ebea20bab7063851e41c4ac36de78b02fe502aefc2646ca96a28c918bdc5db80c05479b4fe0ba28dba3710741359cd63a726a811ad96720682aa09904e056295a6ebb0bac8af61d347ffb0e875d6f4222d901796616980313d9ad5a24f5192e26b66af9ca330c46fd08829fed6af19d49acbd4206523b3a0e9c240719f0fb308f8f67638e8a2fc4a5319d282844aef2c3b1c1cb795d68ac28a32adb30e39d7c254c58510ff4d953a9e5d865c7d23b3b34c3b9e49d326a8193674e56b0d440b5135ccc3423b365dc05424ee8688068b3410d9ac1f05c479824d4dcac8033711a9241115ea648a65b6c5cf4eb67c2fafecb7966dabcd880b34e4b3981a165463a494445b325ddd1e35b9a0bc6a9f81408228cacc8fbe0f6db38ea196e1b091531d93245c99c425a6242635bebc1f8fbea2511199bc6f0674305e52cc7cfd08d67442b843cbb955540cdab2df58eedaf04a2fc26ea3e5eb61be1f88219b02ec60f20e9c5323ae4f766827d8963579413219a8212ec69e4f6cf81df3c927ecb3dd35b2e549d642f21549e01fa0a8c5e7accc7d389c678bc59d852ea3ac690247354cd2e00c2d3da69b8cb250ec86d8620e4820f8e316c0da0fa34cd601320d690be8e972cc36f55c54d1eb8cf2c70b026478b553f16c360d9f7fab1f22ba14aa236a32457ea9edd1426c375d3c6f7ad0c8a9ed8e7c0a8985f5ecd857b5e4dd330388966c7d51cb14ea40c22eeb994259dca45ae075b011cd127d43136fd043258f22e72b964951ebcb007a9298f9b8755f00599bdcc1182dbe8f331dfc674872a3d5b1fdb8d3ae0a9dd75495ea55acd38c1f3d60f3839e0575068ad1196e2ec24a0500de7dbdc80aa92d8a5e62ebe7d506cce7fff7707be338628b0daf782da67604f48221c9f8cb765860b5efcaaf753879d5519ba688887d8543c90552626ef18d8196897bab158a6113571d12d5d002f583fb18098782dc63d48c8e0dfe7205bd8cffc90805e14913ed4ce6874de6700e02526dc3cc42531da27b14df23b5b6c076bb0269251270fbf3e826f6059a9e3b52f4766d6898558930ac1bd288e4399f8671d6d107d20c645f8a8584cce9eb68b2e5c087f362567df0e61f094df5203599ad1af19cf502e3154b10a95ae47a6adab01a02169e8667d0003f3dda7b4c9615a726fc4a012bcb44c18826463fa9c140172815454f96ac22cb3c6596cbfafecc4b4a39ca3e0672e58d5177361095151e3bc25e26344e24e2da8586e1e2027ebb40ee1b45e3e77233993b961fd1df92667d797c3ddb12bca97f4b450ec548ada6df738643b8d22d24f483a25dfa5c6a4a29677af1e38869db3ef766979b6fa2e29d172987d25f68d3ef2f8f516a42ccd919975a8cae9bb322ddf921dda32ee9be4c36327e76dcb0a2fd1f7117febc5e0965dc7f39c5767d7e3eb73e3bac2038a08bd32848afaa02c930f710109b753916676e1da01cd24c213c784c75acfd7fc34f3f71baf48d77219ac85d5a6e13f41638f585f43d7a6916b24a031e1a9b6cbaf6cc72ee89fd6b21678945fcefd8bc2a12a50933cf8b678bdf8475ac80bf8dcfd54d2edfa3be8e3669ec57a6d04668219dd791b010dfada0d1de23915eace4e4782c79c15c14f700dd7df53224caf6143586f264b0e9e52e0e688975e7bed0dc8670bb3bb58e50e0f8e2af990d678ac885cc81eaa5d91262d390a17396c13a44e424d6c2b0a689d48af71fa82fd1f43c49e5b39536e97965dd83547d5c06e6c911daf1ed37d6e2d23cf6ee1c1f0ea4f5db1e4e1d52487d06efb24bf00f202df621dbf6ee9bc4c3ec3d522b24e461d45efda1c2f7ce119ee09453ba008180dab2023c4e84de9aee87a24ac5fc61d1e6fed4d9795286c427697258252f1072869e5734246e9bf4e12b9ef5487133639d886fc4a7cd07935c8e2902884202a777a55f4b34bf5c2d90c768750ad8da6b787deb382dec0b4c5e1480abc1043d9ac2dd93c5ef04ff097c9a9e49cc2914267b38619971ff4ef33cc2b55f60f70299de53cdbd8cfa49b8269c0cae9b82bf6a5b3d2d68e62005b47f65b471f165595442cb8621c663d57d1f3ac2f9a56d1717d582785be2c73a327e93b065e36015b6c90648081fe6c6f1ee4a33b31e89b8eaef44b571fb6edcf28713c0fd7d50d02d74175e23564b1761cc3ae85fd626ceafe3ebe3bef4b9c9e48c0bb8437415040044962461ce7897844a42e2897702f77632cc581a3b477636fc6380200d30daef1115ea62b5c490ad467bfa864d6c4510d55b8806a3623c1cde3994e365cfdf24e3978bfa66a70f1adad6b07b0d8c01438c55f4334d865332f52eae10937adc9e89fe024e8b047f762917e2414668c22e36db1da5f8fc7ea64a04df18250791fc9b48594c90a66d00f86092e7d2e3f23d68b058b3131b5412dc01ac87eca9e3db10c6e4bfa9da142e3df7f8c98af7182cef50d817fa46c16b7e660ddbbef429a6cbcc0b72b7e5668c1384299e922974eb63fd0b3ab2a6c7e035ad6a779ea3db75c20ed2fa76defaa77c51f618b599959a1fed405445d88f3f331b5a9de04495393efb812efd0baf3311cc68123701fb750085ed13ce01a1a797e06b9a137888e46c659d5824284b9178308e7df20ceb0130dfe14bdadb4f016ab39e08c8827ff4b696d13f3472d9262d3f50b5b3926e55a69ae4856a84e4d1dbfd68e1ac522a2afe5c1160061540ecdba14032f600340619e28c63de76c6a5304e0e38e7c96be99aa6136ca2a9a7a921116b6969fde2ccf909a87b5e6209d88bd345c7c7421a0712a517cbd0dfa632dd504757861d79b479a4b1d50341d77571b5c98f93af5f16722e4ffc81d2964caee4811f8ba068ad0441999c385424aadf7efe6cbbf44418f4f20ce35bff43e7273b4bbae61c166c5b6eccf6d0fef7f2d57095dd7ff6a8511465890c2b91c8fca80ddfa9b1f109e102758fc04d6c7d8edb62eeec4", + "aes-192-cbc": "004e1958cf15a4eac689da93f42b50161b574763cafc963d843145bae59b8c6b6ff7c823e4de4f1a331a365b2f7e1d20ead09ba5b59187f9fc72a77cc05584de719ae141144dfe4910acc6fe6ea02ec46298610fdc62cf0ea4ea2988214adfbda96f97f13c5a85859cd15f62192e93eb2880bb9454318402be131642179c34e10c501734f40a7f49778198a67f22764a644713c50909fba3fab54cdd21b6c706abf4e9a2e85d4f1e312f35673fa8f35b3ca223f52f839af791af1a83f3c8464edc4c747994e7c044ea690c711eef11859a23697e5ccc90b1a5419a1e48e313e301de2c0f5fd5a3a91eced4e7f94da500658d5dd6dc5f42ce2f9f4c2b56b190e89e1d00abda882c2e7a25a4dc4f694d6764ad580ebc2c5db28f8035b6361483ccab1b66dfcf05c285e06792f2fc86f57834cb99a4b6e1fd561d94d2157a34c1b0d26ce5a17d8b29aabbe7026775dfabe63da429ce03b60d3a7ddf8fa7d318e2211a472a657f907236b7bdd3c70eaa85fa8edb4585f7229fad0788b392cd5010c8fb762b3659bac0321ce6cb7db9a0367e5262c86e4a03c6e8a95b77d77135615f26f79e7120946c61373a6f7bbe2fada9e8b3753e8fe366c609f391bd4be2ac9689a1ada6dc02f80a3a71db6d02701cf0317e07b62bbd54168538420ceb20667c3e3734e6abe02a8f09aa2143b5898517b1cd1478a443cfdd5a98a30f9e669c68cbc8830a3f78581d88f93dc8c3a61f2dcc0f59ac01c0c3234850c05d8cc33bdc491260230312b4e8892272cf25ed19ba5e38b49336304ac16bf91c5d20a68c38934bfe76cdcb660321b72c8c0e83457f3b4c09c012ce7ac7a27bbe8cf6dc19bda4b91bbf86678592bf481a75d6e12efba11a8183631b820a62d9391d6707861675c4744868ee4b1c8f7d7281c28d9b8c5c765e4407bca45e0fb646655bd3c25185fab2a62746ab80e972633c58d8d46f2d0bf85e01d284e0258083d60c31013c317cc7e1b2f1b217928e7177842df67ed91b5d0a40deed9c91752b350b656308b8a65ccbfe5e929c8d3d8cb84001c4c03e893432f9430b5fafbc4ff6e981624264bba0cc780e702e25a3ea2621d80a0163220aeaf5b9595e9580c69a6c891e5630b1962f217fc61cafcd1f166f072bbeb8c6b3cdd142ef6c09f7591218a8678e10c41a8c006623ec7389774e889fe3c21e30091dce67c8ed3ae310d2cdeee146cc7988ec93e98fdff7847ccde28ef98085d966bf5a169d6af89e70952537d746c175ed43cf4c92a50b8529b5027b7c680fe8d14f4e736b4692d98175c44e2e07c28191a21388333fb7283509d1fdd551fdb2d6094edeff0ebb6b51567484e0d07a6e3173497c6ae22344f53e1b22078ce913f029b573570677ed476c2f56742b74b5c2f6fd24b60ed332a920a974b516f679e11a30a98cb226c3732d61585de2ce1808a49707a6d244d6e82601bd1b3a0705f55f1bd44144f79d74b6688db09961e0891ea28ac38b2af429b8ecf5769c6be832980bcc67571d05c9940f302e7e021385858e55b0ea2743325aadf141f032346d26faa0d7aae76396f2fbc69ee852e71acab1729b511d39c835319751fafff4e1280e6b25c24230767b37b4cea00493ff4e23e728106e7b04e7cfa202df73755208299bf838a34ff2934cbdf98643077380d6924cf043af65fffbd7bd675687088ef30c38084f6d38a59377035ab199a98a43036bd8f19c57c4b30669ca4e72f9aa62204896d841c12fca939def813ee65eb3a89ff027b382dad20154dac8dfc716e19a8e491324dc3eb02b8210198cd7ac148bb3ac56f1573709f5294948422b3653d10dc8493016bf15192609ff8a7bae287030924b50f0cbcade46636856fa71bb3ad21887357dadfa325b0f60c999510ea07bc61b3f5eceb51d922b67580d46bb3f7d1cb50e85a66ff3e141c74dad7f2c55ef14b6e698f4233c871ce4c7f002b1dbec67a0c27c854942ababc6a0bd4ac23efbf4fde93bd5b7e41069fe0d9f142effbc19280969793cbf384bc3a1eb229551197579bf7b9d7c575f47477d8f335f11081a60ace539dd704791f74257d00dbea3ba051236744cfe5c494ed099055e1999c6c909d20be7ed415a522163cd8b7bbe99f5bee0a3c0cb528fc173ce7394240f584a454764525abbc049ec4b6249195a3097857143eed9baab28d9f0ce9186931645b9fa3f0d6c3aa6e5d518383b69f9d425bb542aeac7081553c8e40de269c22a48df8cb79ac1bfc0e9d60e8bfc5a7901c81864fac7291edaa625ee775d33df135cf13b4b61286326bff29de8558bd3e6c29c710ae6cde1fd2c1335a80a851b8d2d7a015d8ebd53eb3b146afc90f645f380ef16a8b659b31fad51ad018d2a4cb40b4fb5dd6002ea3afccf32ac3f38ce6c6dbed8ade20738e1c586660efd571b664e07afc307704425301174ea12cf1f7689557c6547996a99c2c217bdc431329296c86343f2b5218d5810c92897213c195716931de7fc698e9f3cee35aa1d2618857a99630375e17058a1ac7be5cd9e022238b420e3866065c68a050785dffd6c462301263f4f1fa617ba38355f62b7fab0c16b28ee2812d34399e9bc43d415e038f11010c2e52861f04539beaef7f69b4ce1e622bf9936016c02879d7f40bd317666fcd4b32da224d7381af0eff2a2a14fda4772ecb42ee70b0b93f7cc087773496b41e7c3be091edeb1e970f25232a0cabf004492fc8e0914386708e287237b2026df5fc8363067a811b176e26d9fdca82724efbb6572979543993a46f122117eb4eb2443918cc1c4971f804f45fe069abea2e082c9ceb5dc5f623cb7743d654b94b3bb5e8f593689ec029a0be474a6bc4f361480aa255ffa8ce6da23ae542c18c8c4ecbff24077843f958fee59c7454f91fd6b92db5139b34db69ece2370e460a12f48407b3ecd6bb84e55eadaaf152eb46d6dc67c4fa31d2409e36fdf57e1a3fd3081e01c12f594956b08baaa5d06965efdbdbfa91e691040ac8b4b9ec8724f17ee1b36060d1b1a1a82861493f3f01f230e29824769b7494ada040f17c87b83061a06b0c54680b65a8cd8f67e37ff6eb2783bb57f946831bc4965e88eb06dc1a7ba4dbdc82b62e867a2786b67e2a7bf84a1da8d531f4af7feda9791dc6cfc17f3e3e02606198f708ba870fe91d72da1393fb4b7e6daa498f679d1b0047d0e3041edf23b82451c5f52e204d5235f38220c0765d5bf72e74465574cb8768a821d5a9c2f00eafd5edda4c208f2474edd884f0ebd70f9be343cd3d0c72e045b629f756031b054e9b28ca64f69540eef1df319a4f80a3a21f3e98424c5294f66e52d0a5dabda74f80fea4c23ccfb3ddfccb2d88cae84eccafb00825dd4ecea08a7708516739784d8ff7e2c2908968032672ca36c0651e1768f634473fccf01ed975d2adfa468ba97b925f3cf251d0544bc6610c7845b00ececc924770567b81eb3ee966b151a3383b4c36c5d4c6cafe8e879ad794747966994fde7407e892750d3f22cc2b5234cb85ff619f4b19a1feaca2a28a5f3a3f0f94208da9059d50f0b4d3bf66d366f8df7c0feaf6e2391c62694e667e38f084addf2b8368d05239ced089f12d3d13562ad8de61baa091a71062a54bcf6f59d21b5e4f7215449d58781d2e74c1c8689faea82969c78c89e2b396f9ece29ef6e56e2fdbda7d77717ed8c9c8deb4235f4e7e8ed534eb3029d1ae4aa5bb54400916c6d133d9df51338719cf4f3bffd8080643a90d8ebe44399d938f124d972d4d380f5e9a1d51bfc91d5eefafa50962dbba77964be03e7f8d5b502b4a4c3ee6e59aa7a938c6b1c2a7f6a1b89698ba4e21da12345697509ec5a166f7e2df79256e7325d1d64dc220ce6faa88dac473a02a942db9423b947f8e88a065f3ca08ffe44df111b0741393724ba54c33df34cd98c9ee1ab8026182a8718293dbfa1056d8aea93a709f7f1c832c5ba0b0eeb147d31a329a07af3952a52b665f5891f4f7f234663e9e177c8b65f6f31e02bdf51cf6945785d49d66e422bdab902422f88dc4b65581978a3504f3842a0aab5c5adc1a1434b7fb6c5c956c8c6db7f1178462c9c77e140f2cd9a602bf2f3746be044ba49f3d045ab2139395208173763f63109758d722ec58bdcc0a813e9dcb751411fb53e0bbb5fd9076970efc5c5e961a61d15f31b5e", + "aes-256-cbc": "d96d16b2f1274da4fe5c6bf779bf7d8eadd32347e0098a8b10dbeff2662c5e585e667228e3ae9c18142611bfa58a027344e5aac04900de3a2f612d15a9b06d04593d11df2be4361f49165c5422da022f67f82608e31e3b889e69f0f9ce682482f064dc7892c5a7fa639867d53f8512c6857a41e11d8639f21862ffcf4eca795e9c56b1eab4116705879cb286e49af3d711c41f0fd38c768d6ed2c1ff87a41744d96f605cb581a450f9bb67f8c0237dd8a1e9b4e2b071cdbfde7a0bbaf94bb80b1cd3c75645fca273c6d2f07db028067a1a7e657a334e1ce9ec305d2bd0e85a8566a3a5f9ab0f7ef3454719e6d2744b02a4e7ad54d719969414fdb66ac34568886659a33bc4c8260fc0f6d53e95c5ca6bafbbe30c4264dcc1056ce5093d17401c71fddc923fd7ab9c2304f3e11a312884c2217985f6170c936325b3f4e9fd7763c9d3c613010ae7afc90b169f9a4ef8e7de3785bab20bbeaf8e305ca8adf7251d08e0bb3245b1e2f346a9b2e91ce5d16620fe8efe1b41464bb81ac798c80470698b48336fa5bc1684dac58a4ce3c94b636e54aea792cfe2e20ca627ffda135336e898e1aad0aa082a362664d80c4e17a25c1a6e4036052f266f6982958d252833d31a677eabc99f73f19ca7ba1700d170e00e1810114b8cb66209ddef116201863a3269373de5e6bbc03120ad53343c0233df14a011cae858fddaaf27a98d1a223303d4a250e4d7bee43bac6389de58d9bbb9a255ed32a9c5251a44742a066e75f97d2a1c36c52ce6580a052c0c4513f97140fdb970fb803df7b8dd8aafd4b64b24d2e767c1bbc742b9e9f29e2e3c21770a20432857012fab51f2d6be43afbd64512df937a8534d024fb83ccfdc74423481a301c0337168655d19352b253681e6c71badeed2d82ef3733c133d5e156a2b6271ca4b7238d2453f79efa34f0f9ca8f751cd5ff3b77dd40f4a3295d94b97215ab0b336c4721a35e65a90e6c6fbaae73c02cb2f65d0bfb5581bce641506c7c4089f528d5bf79b79e67549042594c1898cf9957e02c69c037766b09b2a377f1c38da45343cf6c801361e7560a1958e0ebfe51bf69c1037c102aa9643921ddba02abc7c4b9ceb25769d2e1ec99387be54d1050d4896b41420c3ea665aa5839a4550aff247c55aadcdd735d7267747334446b751b81ce41cafeb93e1335b51962e4b78ee8dfa6a368580e99b6ca5a63ec7e01953e7976d32db57ea8234fe6fbde44c61d59bd3314363759dc1599d1af1729ed89ff290c3f1e090c2e0785b457efd033f1d71f7b1f77f9ed8f88e720344b4a3fc5a5f7025f7760d328b5cd5ab4765c912a82672dcc1fa85cd622f56c0862b956bb0a5e15559e8966534763ff7478ab6b9b88bc43eab68c22592d15cc0176a961d5294c8c46bb3e8045bac77227b35c336318185b32a1884b23ef3e32d9dba197146c2f72a4cce68939b160752247ce1066674a0ae8351b4e9494627cac97c6219790b7b2fc2eec6014f9ea8907692ec76579069d6161b1d5bfe1aa17de631c8fc4095105197606a25a532c59d246e0351953f2970db51ee7d84ba98b2185d9878d184bb55a425b644bc1aba60c5e798215e26a9f91738ca981bbe2a849406408d1c2cb4290e73244aa71d677ca0731125edc7869aade1a537e7a28f9c8439f367e1b03b16cec9d21411f084e361d52ebe269e851565eda4534a86cd3c80f8c87c78aad1eb62eaebf8a6b4dc9945eb21f231021a6f0fa612795249d6eaae499e3a6de06286c2d3e612b513125352f2426e0492f7dee32ba64d49334fd75f36d054cdf0c6556fa100db6f5b48b310948e595db4bd74aedf30b2cd8f8a22bc1897f9fe5ba9ac290ea0ce81f7c064e327ab9d23ac0e9ff2b0b436c127d70a8a8d166adf90c275bfe0f5680c2fbd64957ed79156655852294d8e111637caa2ab48aa34ab91708bcca3ef1688d3e5cad8206073c543360417cad4314505e25901af772523569c2a5a5510671dc9286e826905accb93643e5f992cc09630727af4f8a24017fa9338688e72a5b91da4355c92d02d1a15be92c006998b1dd5a4903bca2c8375e082a49e62a8316bc4410207ee6b6af1badc0cedac15d76f755cc5d4a06ff1b1d9e7289b0bac67bdc61c557c179f7b015746c8ef155fd5de0c0becddae93f9bcb6decf23dded430975e58062a421a146c8a7c938c0750dac8bc851722173da6be6d4f6678ab73351390ebeb90588f87f89f0367ba3dc04a28493e7d771c50504e031cacd99d417f3c17fe7e4c8e198cdc7edfcfaa86e7afa09d207126e66f0fe12467acae0e439c12e708650b6b02073bd8097c62f61e363207c5fa26761ba919a3c0ff2d13d1abf9e06f531c556d9b095e5503f78ec5659984d869c56ecf6bbec36f6a715b7f05d68f76a039dc3042b37147a13861f33d8633a615b8735ab6d96b71e58065d4038fdcfd662d4b715e9eb790d64d210d78b94c81b54302faa88c681423ea5060e4da46a21d9f833cd2c1892bf2c842fddc626e88d123847c90734c8c8edabcb230dfe6e2c8a31af2ce94d3afe05ab56f9b041dd47faf3dac0a6abd16ac7daf370620c071d044b14d8c14318845f41e93b2eea54511dba8648445ae3b21e8312fcee01f759e3991516265de82f6f8ebae0a6ad38902887019386e1a7c847622436951f7e4c450e5d7ef78dae32fa8075492b77f3ae9c19fca2fea66246ce1a5e236fff74c90b4be99d0c12edc45a1fb98a29dc93664af0ad557f4e3f295dc5d663b597c2a17f7c6bbd3a7fb1f27854d214850d4c37ed0929e3d34b8b3936f382f5c64b6b1d4501e084465c75329b519a16aff6dcac45b9310b955e47d1da1cb2ccebb957d8ff6d47f7a9883b10433b3b4aeccfeebbbb1447604b94097d5fee8f3d3c04b487698aa2a3b23fd2e6853394889d6dc4b25c75ed00d0110e66de7a0b64fb70195ba1da13e87864e67f30a17d501c8ae48cd3210a3f875ee042bc8adf7cd3c35c55a0290f59557bbeda10ca1dafba6d76f2694352d5842e862875178a235b7384b5806ec77db0277a5df83445d820d0bfb48364060111c8e240f9ac96f3ba608427f511058e8b690f0ab4dbf68037f7d9744cfdb8dda183392a9839fc49dcfd4a70916c7b90ba11c64d7e9510e85e48bb89819c8e8cc61e14a3689111e6c58fca2845a7bf2043ee9ea265be4002af42343bef7c8a887431c78cc05547205934f4fb5f8841794f06ad0849ed2a62fc46e3d910834f55aee43c2fb8d826e11fe5dafabccd8e2974e46c7073cc09915165b2da51b629299ef30a54e7fe51308f5f946266efdca28b337f0017908c0ffc54bb2329e532bf26c3c06f016716619da2e899137ff3e9feceeb86cd8e7aa7d90677d1cd2e68ca42a8a7a0ec5072ff021d015a593f49e8de30586275a1d36d73669588777744c6d9713edc2ee875287e7c64013d1fc7aab0fed501c5acc943cb4568530997254d55a6c97b6b1c3789b658ae715d3aa499992d1603e330e0591e1213a67f964fbd284c130e418ed52e7208a40803d73bc319dd64aa96c036b3a53912ab26378b1c053fa965bff14c1592e67be6513a01dae64318f1c04cabf2ee427a53e7175f99fc7c045629ec8bcd454065d723a7d66a6768ab587df9e2778db9290d738ab704d40aa2c94eefa4e17b1a35c47f1d1ce36e41aa5885bf8c18c42e0269f5d7cd0ff7a73232ebe7df27d42f06084751f5a787ad4ecd6b5616aabf31d5baa51cb576e96b2a48e0efc85c4f68a5313b2a0521be1d05ffc91ea46f7b3b6d44beecc2ab30251881bda3879772350e9dbfc7bad05013e40e50ddb793ce50b9b21782a70980386e5a2cac90fd5e58b6d95bba6942a9d42651c25bd558756a0ef12359ac6776711f889f2f88e4f783e312355b7f368480d25c698fdeb1fea87d4ca808db566417de11b560aaae1216898a6a28f6b54742d3f4b44fd25fe5e8d0c99d58adcd14d48ba7b6181c67a831434f676e587e312e2cf0f3be7904a08c1e10d86958e63b7cf97a655851c6e79c5bf373fa2c54b7afe2a751b5fe94c3b071a78f1bcaf0d1f8c78331f90e03fa6f76647a180fdc929c8426b499ef30d7ea59d376a8d7c5793d2f00483c362065054d0d849d4ede054f0a93f1c8a7ecb5d8796ac4b5e03b72b43ce7a5ec2c856978df0dd838", + "aes128": "4b16076987e98c4f2be1bbd59da6dfc56a125ada454b579a09734bf8f283e8c97f90729612208d14628be57479ad16ad65aa0a9a434a79dbde14182a530bfc748dd6c43f8768027bb53c7ff548479720ad2b5c0f42b82070be9d4a6e608786185324bcbafa9fb457190b1c99ba055484cf1156d0ff043e740dd9d32d51acd82472bc89f93f15b631d10034f10d32dbc943bcfb846bf4b46eb4d45d73a84061b38244160bddcc70fcd2c960242d5ed8b7d52b376c052300f29f19b964d5ca8407ad203bee8a85bc03e108432b3c0786e795852e20f20b7392fb8302b694f3422437d18b11c4dcec05b6cdac2a4aa58b1b7b4ea917d12457926e886bfa0be98790571ae062531a5ee86a71a847b1c66b5e8bf0e5033e2dd57ea6492acfbbbc8cb06c9c219875f616b81213940be2321a5a492acd86c0b1056cb1cae3cb27bfd36be67b565744be5ccddee6a4445654a9fb64c8770406f692c86c40b029974f1e33a59c89738ecbc2dd120035129a8e282ea55ffa094c782143e458ce539ac1c0b95f61c7cc41b9dd57b9e138482649c84aef801096b983cd5b84f046ff6f1299a78b4c222df1e51e62b02d5b0ec186d28d5ba3b0851669bdccc691e05cd6bda41a6cb18a9772769705d1e6d0b06490567e837c4a2fad0f9ca46a1c22a14974c3fbbd255db1ddbf7588016d14f0d3574222fff0e4f5e5c87272d42362ca070c4cda30fd6ec974af6e31b95652e712dd50d964ffddfa96f90c6d1081713cf3663dd5dc5940c367c3581316661867a2ad6ef6269a2532f31edd3bab5180643fed0cd14a34ab91b1db6f1841c8733cb15d244b020583792e2f4cd721cb368a49a0c3f9e606a4eb0635b4023989478256d543062ae88edc708e689d6dbf33d33ba397efb51d334cc147c1507d09e09760aad19f66e90449cdf8c576aee2a1b50f118cfb3229fed688262026f67b4d0a07e509b2c025fae0d525c8082a5ca9962d641bad72cd0b0cd178f88f7f7749ce910d754eba06776ddc237a4c46007c9fb850ee868176ff457840638f211d4b249d91a9046d07ac3df5c7d9cf89c62cc5cb7f4575683bcd67c66f9b00dd1feb5314f1f6dbda7848f38263183b0e3fc4326e2ad25a08926cc3961ad66a282457fc85dda503663da7b92dab79b69455dae00f96f891b41d0f292ad773efaf00b57cb9465bb6bde044e56ebea20bab7063851e41c4ac36de78b02fe502aefc2646ca96a28c918bdc5db80c05479b4fe0ba28dba3710741359cd63a726a811ad96720682aa09904e056295a6ebb0bac8af61d347ffb0e875d6f4222d901796616980313d9ad5a24f5192e26b66af9ca330c46fd08829fed6af19d49acbd4206523b3a0e9c240719f0fb308f8f67638e8a2fc4a5319d282844aef2c3b1c1cb795d68ac28a32adb30e39d7c254c58510ff4d953a9e5d865c7d23b3b34c3b9e49d326a8193674e56b0d440b5135ccc3423b365dc05424ee8688068b3410d9ac1f05c479824d4dcac8033711a9241115ea648a65b6c5cf4eb67c2fafecb7966dabcd880b34e4b3981a165463a494445b325ddd1e35b9a0bc6a9f81408228cacc8fbe0f6db38ea196e1b091531d93245c99c425a6242635bebc1f8fbea2511199bc6f0674305e52cc7cfd08d67442b843cbb955540cdab2df58eedaf04a2fc26ea3e5eb61be1f88219b02ec60f20e9c5323ae4f766827d8963579413219a8212ec69e4f6cf81df3c927ecb3dd35b2e549d642f21549e01fa0a8c5e7accc7d389c678bc59d852ea3ac690247354cd2e00c2d3da69b8cb250ec86d8620e4820f8e316c0da0fa34cd601320d690be8e972cc36f55c54d1eb8cf2c70b026478b553f16c360d9f7fab1f22ba14aa236a32457ea9edd1426c375d3c6f7ad0c8a9ed8e7c0a8985f5ecd857b5e4dd330388966c7d51cb14ea40c22eeb994259dca45ae075b011cd127d43136fd043258f22e72b964951ebcb007a9298f9b8755f00599bdcc1182dbe8f331dfc674872a3d5b1fdb8d3ae0a9dd75495ea55acd38c1f3d60f3839e0575068ad1196e2ec24a0500de7dbdc80aa92d8a5e62ebe7d506cce7fff7707be338628b0daf782da67604f48221c9f8cb765860b5efcaaf753879d5519ba688887d8543c90552626ef18d8196897bab158a6113571d12d5d002f583fb18098782dc63d48c8e0dfe7205bd8cffc90805e14913ed4ce6874de6700e02526dc3cc42531da27b14df23b5b6c076bb0269251270fbf3e826f6059a9e3b52f4766d6898558930ac1bd288e4399f8671d6d107d20c645f8a8584cce9eb68b2e5c087f362567df0e61f094df5203599ad1af19cf502e3154b10a95ae47a6adab01a02169e8667d0003f3dda7b4c9615a726fc4a012bcb44c18826463fa9c140172815454f96ac22cb3c6596cbfafecc4b4a39ca3e0672e58d5177361095151e3bc25e26344e24e2da8586e1e2027ebb40ee1b45e3e77233993b961fd1df92667d797c3ddb12bca97f4b450ec548ada6df738643b8d22d24f483a25dfa5c6a4a29677af1e38869db3ef766979b6fa2e29d172987d25f68d3ef2f8f516a42ccd919975a8cae9bb322ddf921dda32ee9be4c36327e76dcb0a2fd1f7117febc5e0965dc7f39c5767d7e3eb73e3bac2038a08bd32848afaa02c930f710109b753916676e1da01cd24c213c784c75acfd7fc34f3f71baf48d77219ac85d5a6e13f41638f585f43d7a6916b24a031e1a9b6cbaf6cc72ee89fd6b21678945fcefd8bc2a12a50933cf8b678bdf8475ac80bf8dcfd54d2edfa3be8e3669ec57a6d04668219dd791b010dfada0d1de23915eace4e4782c79c15c14f700dd7df53224caf6143586f264b0e9e52e0e688975e7bed0dc8670bb3bb58e50e0f8e2af990d678ac885cc81eaa5d91262d390a17396c13a44e424d6c2b0a689d48af71fa82fd1f43c49e5b39536e97965dd83547d5c06e6c911daf1ed37d6e2d23cf6ee1c1f0ea4f5db1e4e1d52487d06efb24bf00f202df621dbf6ee9bc4c3ec3d522b24e461d45efda1c2f7ce119ee09453ba008180dab2023c4e84de9aee87a24ac5fc61d1e6fed4d9795286c427697258252f1072869e5734246e9bf4e12b9ef5487133639d886fc4a7cd07935c8e2902884202a777a55f4b34bf5c2d90c768750ad8da6b787deb382dec0b4c5e1480abc1043d9ac2dd93c5ef04ff097c9a9e49cc2914267b38619971ff4ef33cc2b55f60f70299de53cdbd8cfa49b8269c0cae9b82bf6a5b3d2d68e62005b47f65b471f165595442cb8621c663d57d1f3ac2f9a56d1717d582785be2c73a327e93b065e36015b6c90648081fe6c6f1ee4a33b31e89b8eaef44b571fb6edcf28713c0fd7d50d02d74175e23564b1761cc3ae85fd626ceafe3ebe3bef4b9c9e48c0bb8437415040044962461ce7897844a42e2897702f77632cc581a3b477636fc6380200d30daef1115ea62b5c490ad467bfa864d6c4510d55b8806a3623c1cde3994e365cfdf24e3978bfa66a70f1adad6b07b0d8c01438c55f4334d865332f52eae10937adc9e89fe024e8b047f762917e2414668c22e36db1da5f8fc7ea64a04df18250791fc9b48594c90a66d00f86092e7d2e3f23d68b058b3131b5412dc01ac87eca9e3db10c6e4bfa9da142e3df7f8c98af7182cef50d817fa46c16b7e660ddbbef429a6cbcc0b72b7e5668c1384299e922974eb63fd0b3ab2a6c7e035ad6a779ea3db75c20ed2fa76defaa77c51f618b599959a1fed405445d88f3f331b5a9de04495393efb812efd0baf3311cc68123701fb750085ed13ce01a1a797e06b9a137888e46c659d5824284b9178308e7df20ceb0130dfe14bdadb4f016ab39e08c8827ff4b696d13f3472d9262d3f50b5b3926e55a69ae4856a84e4d1dbfd68e1ac522a2afe5c1160061540ecdba14032f600340619e28c63de76c6a5304e0e38e7c96be99aa6136ca2a9a7a921116b6969fde2ccf909a87b5e6209d88bd345c7c7421a0712a517cbd0dfa632dd504757861d79b479a4b1d50341d77571b5c98f93af5f16722e4ffc81d2964caee4811f8ba068ad0441999c385424aadf7efe6cbbf44418f4f20ce35bff43e7273b4bbae61c166c5b6eccf6d0fef7f2d57095dd7ff6a8511465890c2b91c8fca80ddfa9b1f109e102758fc04d6c7d8edb62eeec4", + "aes192": "004e1958cf15a4eac689da93f42b50161b574763cafc963d843145bae59b8c6b6ff7c823e4de4f1a331a365b2f7e1d20ead09ba5b59187f9fc72a77cc05584de719ae141144dfe4910acc6fe6ea02ec46298610fdc62cf0ea4ea2988214adfbda96f97f13c5a85859cd15f62192e93eb2880bb9454318402be131642179c34e10c501734f40a7f49778198a67f22764a644713c50909fba3fab54cdd21b6c706abf4e9a2e85d4f1e312f35673fa8f35b3ca223f52f839af791af1a83f3c8464edc4c747994e7c044ea690c711eef11859a23697e5ccc90b1a5419a1e48e313e301de2c0f5fd5a3a91eced4e7f94da500658d5dd6dc5f42ce2f9f4c2b56b190e89e1d00abda882c2e7a25a4dc4f694d6764ad580ebc2c5db28f8035b6361483ccab1b66dfcf05c285e06792f2fc86f57834cb99a4b6e1fd561d94d2157a34c1b0d26ce5a17d8b29aabbe7026775dfabe63da429ce03b60d3a7ddf8fa7d318e2211a472a657f907236b7bdd3c70eaa85fa8edb4585f7229fad0788b392cd5010c8fb762b3659bac0321ce6cb7db9a0367e5262c86e4a03c6e8a95b77d77135615f26f79e7120946c61373a6f7bbe2fada9e8b3753e8fe366c609f391bd4be2ac9689a1ada6dc02f80a3a71db6d02701cf0317e07b62bbd54168538420ceb20667c3e3734e6abe02a8f09aa2143b5898517b1cd1478a443cfdd5a98a30f9e669c68cbc8830a3f78581d88f93dc8c3a61f2dcc0f59ac01c0c3234850c05d8cc33bdc491260230312b4e8892272cf25ed19ba5e38b49336304ac16bf91c5d20a68c38934bfe76cdcb660321b72c8c0e83457f3b4c09c012ce7ac7a27bbe8cf6dc19bda4b91bbf86678592bf481a75d6e12efba11a8183631b820a62d9391d6707861675c4744868ee4b1c8f7d7281c28d9b8c5c765e4407bca45e0fb646655bd3c25185fab2a62746ab80e972633c58d8d46f2d0bf85e01d284e0258083d60c31013c317cc7e1b2f1b217928e7177842df67ed91b5d0a40deed9c91752b350b656308b8a65ccbfe5e929c8d3d8cb84001c4c03e893432f9430b5fafbc4ff6e981624264bba0cc780e702e25a3ea2621d80a0163220aeaf5b9595e9580c69a6c891e5630b1962f217fc61cafcd1f166f072bbeb8c6b3cdd142ef6c09f7591218a8678e10c41a8c006623ec7389774e889fe3c21e30091dce67c8ed3ae310d2cdeee146cc7988ec93e98fdff7847ccde28ef98085d966bf5a169d6af89e70952537d746c175ed43cf4c92a50b8529b5027b7c680fe8d14f4e736b4692d98175c44e2e07c28191a21388333fb7283509d1fdd551fdb2d6094edeff0ebb6b51567484e0d07a6e3173497c6ae22344f53e1b22078ce913f029b573570677ed476c2f56742b74b5c2f6fd24b60ed332a920a974b516f679e11a30a98cb226c3732d61585de2ce1808a49707a6d244d6e82601bd1b3a0705f55f1bd44144f79d74b6688db09961e0891ea28ac38b2af429b8ecf5769c6be832980bcc67571d05c9940f302e7e021385858e55b0ea2743325aadf141f032346d26faa0d7aae76396f2fbc69ee852e71acab1729b511d39c835319751fafff4e1280e6b25c24230767b37b4cea00493ff4e23e728106e7b04e7cfa202df73755208299bf838a34ff2934cbdf98643077380d6924cf043af65fffbd7bd675687088ef30c38084f6d38a59377035ab199a98a43036bd8f19c57c4b30669ca4e72f9aa62204896d841c12fca939def813ee65eb3a89ff027b382dad20154dac8dfc716e19a8e491324dc3eb02b8210198cd7ac148bb3ac56f1573709f5294948422b3653d10dc8493016bf15192609ff8a7bae287030924b50f0cbcade46636856fa71bb3ad21887357dadfa325b0f60c999510ea07bc61b3f5eceb51d922b67580d46bb3f7d1cb50e85a66ff3e141c74dad7f2c55ef14b6e698f4233c871ce4c7f002b1dbec67a0c27c854942ababc6a0bd4ac23efbf4fde93bd5b7e41069fe0d9f142effbc19280969793cbf384bc3a1eb229551197579bf7b9d7c575f47477d8f335f11081a60ace539dd704791f74257d00dbea3ba051236744cfe5c494ed099055e1999c6c909d20be7ed415a522163cd8b7bbe99f5bee0a3c0cb528fc173ce7394240f584a454764525abbc049ec4b6249195a3097857143eed9baab28d9f0ce9186931645b9fa3f0d6c3aa6e5d518383b69f9d425bb542aeac7081553c8e40de269c22a48df8cb79ac1bfc0e9d60e8bfc5a7901c81864fac7291edaa625ee775d33df135cf13b4b61286326bff29de8558bd3e6c29c710ae6cde1fd2c1335a80a851b8d2d7a015d8ebd53eb3b146afc90f645f380ef16a8b659b31fad51ad018d2a4cb40b4fb5dd6002ea3afccf32ac3f38ce6c6dbed8ade20738e1c586660efd571b664e07afc307704425301174ea12cf1f7689557c6547996a99c2c217bdc431329296c86343f2b5218d5810c92897213c195716931de7fc698e9f3cee35aa1d2618857a99630375e17058a1ac7be5cd9e022238b420e3866065c68a050785dffd6c462301263f4f1fa617ba38355f62b7fab0c16b28ee2812d34399e9bc43d415e038f11010c2e52861f04539beaef7f69b4ce1e622bf9936016c02879d7f40bd317666fcd4b32da224d7381af0eff2a2a14fda4772ecb42ee70b0b93f7cc087773496b41e7c3be091edeb1e970f25232a0cabf004492fc8e0914386708e287237b2026df5fc8363067a811b176e26d9fdca82724efbb6572979543993a46f122117eb4eb2443918cc1c4971f804f45fe069abea2e082c9ceb5dc5f623cb7743d654b94b3bb5e8f593689ec029a0be474a6bc4f361480aa255ffa8ce6da23ae542c18c8c4ecbff24077843f958fee59c7454f91fd6b92db5139b34db69ece2370e460a12f48407b3ecd6bb84e55eadaaf152eb46d6dc67c4fa31d2409e36fdf57e1a3fd3081e01c12f594956b08baaa5d06965efdbdbfa91e691040ac8b4b9ec8724f17ee1b36060d1b1a1a82861493f3f01f230e29824769b7494ada040f17c87b83061a06b0c54680b65a8cd8f67e37ff6eb2783bb57f946831bc4965e88eb06dc1a7ba4dbdc82b62e867a2786b67e2a7bf84a1da8d531f4af7feda9791dc6cfc17f3e3e02606198f708ba870fe91d72da1393fb4b7e6daa498f679d1b0047d0e3041edf23b82451c5f52e204d5235f38220c0765d5bf72e74465574cb8768a821d5a9c2f00eafd5edda4c208f2474edd884f0ebd70f9be343cd3d0c72e045b629f756031b054e9b28ca64f69540eef1df319a4f80a3a21f3e98424c5294f66e52d0a5dabda74f80fea4c23ccfb3ddfccb2d88cae84eccafb00825dd4ecea08a7708516739784d8ff7e2c2908968032672ca36c0651e1768f634473fccf01ed975d2adfa468ba97b925f3cf251d0544bc6610c7845b00ececc924770567b81eb3ee966b151a3383b4c36c5d4c6cafe8e879ad794747966994fde7407e892750d3f22cc2b5234cb85ff619f4b19a1feaca2a28a5f3a3f0f94208da9059d50f0b4d3bf66d366f8df7c0feaf6e2391c62694e667e38f084addf2b8368d05239ced089f12d3d13562ad8de61baa091a71062a54bcf6f59d21b5e4f7215449d58781d2e74c1c8689faea82969c78c89e2b396f9ece29ef6e56e2fdbda7d77717ed8c9c8deb4235f4e7e8ed534eb3029d1ae4aa5bb54400916c6d133d9df51338719cf4f3bffd8080643a90d8ebe44399d938f124d972d4d380f5e9a1d51bfc91d5eefafa50962dbba77964be03e7f8d5b502b4a4c3ee6e59aa7a938c6b1c2a7f6a1b89698ba4e21da12345697509ec5a166f7e2df79256e7325d1d64dc220ce6faa88dac473a02a942db9423b947f8e88a065f3ca08ffe44df111b0741393724ba54c33df34cd98c9ee1ab8026182a8718293dbfa1056d8aea93a709f7f1c832c5ba0b0eeb147d31a329a07af3952a52b665f5891f4f7f234663e9e177c8b65f6f31e02bdf51cf6945785d49d66e422bdab902422f88dc4b65581978a3504f3842a0aab5c5adc1a1434b7fb6c5c956c8c6db7f1178462c9c77e140f2cd9a602bf2f3746be044ba49f3d045ab2139395208173763f63109758d722ec58bdcc0a813e9dcb751411fb53e0bbb5fd9076970efc5c5e961a61d15f31b5e", + "aes256": "d96d16b2f1274da4fe5c6bf779bf7d8eadd32347e0098a8b10dbeff2662c5e585e667228e3ae9c18142611bfa58a027344e5aac04900de3a2f612d15a9b06d04593d11df2be4361f49165c5422da022f67f82608e31e3b889e69f0f9ce682482f064dc7892c5a7fa639867d53f8512c6857a41e11d8639f21862ffcf4eca795e9c56b1eab4116705879cb286e49af3d711c41f0fd38c768d6ed2c1ff87a41744d96f605cb581a450f9bb67f8c0237dd8a1e9b4e2b071cdbfde7a0bbaf94bb80b1cd3c75645fca273c6d2f07db028067a1a7e657a334e1ce9ec305d2bd0e85a8566a3a5f9ab0f7ef3454719e6d2744b02a4e7ad54d719969414fdb66ac34568886659a33bc4c8260fc0f6d53e95c5ca6bafbbe30c4264dcc1056ce5093d17401c71fddc923fd7ab9c2304f3e11a312884c2217985f6170c936325b3f4e9fd7763c9d3c613010ae7afc90b169f9a4ef8e7de3785bab20bbeaf8e305ca8adf7251d08e0bb3245b1e2f346a9b2e91ce5d16620fe8efe1b41464bb81ac798c80470698b48336fa5bc1684dac58a4ce3c94b636e54aea792cfe2e20ca627ffda135336e898e1aad0aa082a362664d80c4e17a25c1a6e4036052f266f6982958d252833d31a677eabc99f73f19ca7ba1700d170e00e1810114b8cb66209ddef116201863a3269373de5e6bbc03120ad53343c0233df14a011cae858fddaaf27a98d1a223303d4a250e4d7bee43bac6389de58d9bbb9a255ed32a9c5251a44742a066e75f97d2a1c36c52ce6580a052c0c4513f97140fdb970fb803df7b8dd8aafd4b64b24d2e767c1bbc742b9e9f29e2e3c21770a20432857012fab51f2d6be43afbd64512df937a8534d024fb83ccfdc74423481a301c0337168655d19352b253681e6c71badeed2d82ef3733c133d5e156a2b6271ca4b7238d2453f79efa34f0f9ca8f751cd5ff3b77dd40f4a3295d94b97215ab0b336c4721a35e65a90e6c6fbaae73c02cb2f65d0bfb5581bce641506c7c4089f528d5bf79b79e67549042594c1898cf9957e02c69c037766b09b2a377f1c38da45343cf6c801361e7560a1958e0ebfe51bf69c1037c102aa9643921ddba02abc7c4b9ceb25769d2e1ec99387be54d1050d4896b41420c3ea665aa5839a4550aff247c55aadcdd735d7267747334446b751b81ce41cafeb93e1335b51962e4b78ee8dfa6a368580e99b6ca5a63ec7e01953e7976d32db57ea8234fe6fbde44c61d59bd3314363759dc1599d1af1729ed89ff290c3f1e090c2e0785b457efd033f1d71f7b1f77f9ed8f88e720344b4a3fc5a5f7025f7760d328b5cd5ab4765c912a82672dcc1fa85cd622f56c0862b956bb0a5e15559e8966534763ff7478ab6b9b88bc43eab68c22592d15cc0176a961d5294c8c46bb3e8045bac77227b35c336318185b32a1884b23ef3e32d9dba197146c2f72a4cce68939b160752247ce1066674a0ae8351b4e9494627cac97c6219790b7b2fc2eec6014f9ea8907692ec76579069d6161b1d5bfe1aa17de631c8fc4095105197606a25a532c59d246e0351953f2970db51ee7d84ba98b2185d9878d184bb55a425b644bc1aba60c5e798215e26a9f91738ca981bbe2a849406408d1c2cb4290e73244aa71d677ca0731125edc7869aade1a537e7a28f9c8439f367e1b03b16cec9d21411f084e361d52ebe269e851565eda4534a86cd3c80f8c87c78aad1eb62eaebf8a6b4dc9945eb21f231021a6f0fa612795249d6eaae499e3a6de06286c2d3e612b513125352f2426e0492f7dee32ba64d49334fd75f36d054cdf0c6556fa100db6f5b48b310948e595db4bd74aedf30b2cd8f8a22bc1897f9fe5ba9ac290ea0ce81f7c064e327ab9d23ac0e9ff2b0b436c127d70a8a8d166adf90c275bfe0f5680c2fbd64957ed79156655852294d8e111637caa2ab48aa34ab91708bcca3ef1688d3e5cad8206073c543360417cad4314505e25901af772523569c2a5a5510671dc9286e826905accb93643e5f992cc09630727af4f8a24017fa9338688e72a5b91da4355c92d02d1a15be92c006998b1dd5a4903bca2c8375e082a49e62a8316bc4410207ee6b6af1badc0cedac15d76f755cc5d4a06ff1b1d9e7289b0bac67bdc61c557c179f7b015746c8ef155fd5de0c0becddae93f9bcb6decf23dded430975e58062a421a146c8a7c938c0750dac8bc851722173da6be6d4f6678ab73351390ebeb90588f87f89f0367ba3dc04a28493e7d771c50504e031cacd99d417f3c17fe7e4c8e198cdc7edfcfaa86e7afa09d207126e66f0fe12467acae0e439c12e708650b6b02073bd8097c62f61e363207c5fa26761ba919a3c0ff2d13d1abf9e06f531c556d9b095e5503f78ec5659984d869c56ecf6bbec36f6a715b7f05d68f76a039dc3042b37147a13861f33d8633a615b8735ab6d96b71e58065d4038fdcfd662d4b715e9eb790d64d210d78b94c81b54302faa88c681423ea5060e4da46a21d9f833cd2c1892bf2c842fddc626e88d123847c90734c8c8edabcb230dfe6e2c8a31af2ce94d3afe05ab56f9b041dd47faf3dac0a6abd16ac7daf370620c071d044b14d8c14318845f41e93b2eea54511dba8648445ae3b21e8312fcee01f759e3991516265de82f6f8ebae0a6ad38902887019386e1a7c847622436951f7e4c450e5d7ef78dae32fa8075492b77f3ae9c19fca2fea66246ce1a5e236fff74c90b4be99d0c12edc45a1fb98a29dc93664af0ad557f4e3f295dc5d663b597c2a17f7c6bbd3a7fb1f27854d214850d4c37ed0929e3d34b8b3936f382f5c64b6b1d4501e084465c75329b519a16aff6dcac45b9310b955e47d1da1cb2ccebb957d8ff6d47f7a9883b10433b3b4aeccfeebbbb1447604b94097d5fee8f3d3c04b487698aa2a3b23fd2e6853394889d6dc4b25c75ed00d0110e66de7a0b64fb70195ba1da13e87864e67f30a17d501c8ae48cd3210a3f875ee042bc8adf7cd3c35c55a0290f59557bbeda10ca1dafba6d76f2694352d5842e862875178a235b7384b5806ec77db0277a5df83445d820d0bfb48364060111c8e240f9ac96f3ba608427f511058e8b690f0ab4dbf68037f7d9744cfdb8dda183392a9839fc49dcfd4a70916c7b90ba11c64d7e9510e85e48bb89819c8e8cc61e14a3689111e6c58fca2845a7bf2043ee9ea265be4002af42343bef7c8a887431c78cc05547205934f4fb5f8841794f06ad0849ed2a62fc46e3d910834f55aee43c2fb8d826e11fe5dafabccd8e2974e46c7073cc09915165b2da51b629299ef30a54e7fe51308f5f946266efdca28b337f0017908c0ffc54bb2329e532bf26c3c06f016716619da2e899137ff3e9feceeb86cd8e7aa7d90677d1cd2e68ca42a8a7a0ec5072ff021d015a593f49e8de30586275a1d36d73669588777744c6d9713edc2ee875287e7c64013d1fc7aab0fed501c5acc943cb4568530997254d55a6c97b6b1c3789b658ae715d3aa499992d1603e330e0591e1213a67f964fbd284c130e418ed52e7208a40803d73bc319dd64aa96c036b3a53912ab26378b1c053fa965bff14c1592e67be6513a01dae64318f1c04cabf2ee427a53e7175f99fc7c045629ec8bcd454065d723a7d66a6768ab587df9e2778db9290d738ab704d40aa2c94eefa4e17b1a35c47f1d1ce36e41aa5885bf8c18c42e0269f5d7cd0ff7a73232ebe7df27d42f06084751f5a787ad4ecd6b5616aabf31d5baa51cb576e96b2a48e0efc85c4f68a5313b2a0521be1d05ffc91ea46f7b3b6d44beecc2ab30251881bda3879772350e9dbfc7bad05013e40e50ddb793ce50b9b21782a70980386e5a2cac90fd5e58b6d95bba6942a9d42651c25bd558756a0ef12359ac6776711f889f2f88e4f783e312355b7f368480d25c698fdeb1fea87d4ca808db566417de11b560aaae1216898a6a28f6b54742d3f4b44fd25fe5e8d0c99d58adcd14d48ba7b6181c67a831434f676e587e312e2cf0f3be7904a08c1e10d86958e63b7cf97a655851c6e79c5bf373fa2c54b7afe2a751b5fe94c3b071a78f1bcaf0d1f8c78331f90e03fa6f76647a180fdc929c8426b499ef30d7ea59d376a8d7c5793d2f00483c362065054d0d849d4ede054f0a93f1c8a7ecb5d8796ac4b5e03b72b43ce7a5ec2c856978df0dd838", + "aes-128-cfb": "8ecc1cc287e5e021fa0bc138f6163fd50a3725c398c5da4a551429c8d4a5c7d21c4da66d7132277b093f916ec6fb0ee2747e3d8073d5189df69610e1b2f019dce173d7c42d0715d77bb6609dd899f24221ec614330cfe8b59cb3c5d2bfb23808e5984e790c246854b02c89b04f75f8363bb1bb108a84b450bd8d42bc1650b74a6cac092b68995f44c08947da54ab4cae7a66aea393b33c35058debbf8cf5dd68bc715ce560c94a3565d4a194e519a279f9d2f8cf2da864b5806ce3e7db36ea72607aba291bd912df1cd638c634a1322b7dfebfbbdf842eb5164c5652809906a97c262e2243b56fedc788a79b6fcaad2936cd2e30af1c122687da5fe50e999db7b51ac2b529994d778703c69d794e0a818543b8743809768f5cb60f1f499c4bf9a9284df46bd1aa9021ac6ab3df43ae035db8b3340710ca272687e76a52ab0d85677e52d8f41a5bf84aac23abcb6782f18ec44700631b3879e8ee591d3141e62e840194e7fc25074457359fdb984237abd1d71664cb568b125a42db454735ee3212524ff0ebbcd5469cddcb524b91f8af687c3a63db99c446835efafecd898e98375403113e0b92f66192c621e02469b9cc8e636903d033760c9944d3eeadf55e060d897de32118ba4bc55a0ac1c5204220ccb432f3fb69357a9c8da6e06b0da3e8954678ea0daa2256cd2698c9b43b67b746fb064ddfdafd99e8a62e1fbe7dd6dfcab09f24d20d91cf47ec475286c148ef1938e7579f0260ab71346382f21afef3c17a9bbe51386ea3f381c6a873e1d792be571dd2f8eb8f5cb40439e3c2b4459f9dad0debbf8f7267e4cb5a72fb23c28654b28f2a9dfcd205274b2f20144a539f00ca2ad2930f7f0cd203373afb883797796e4cad29da2c792ebd5f4a6349c8a8d8fdf7a67a4fe52a5830c137a6a83945a92f7cb3242a807cc44b98a1c44ac1f2f99f03df16b54bd8187b68ea98ca721f9ca22f75d0a8e01a1799ada434c82de5d9375a40c06f7c7843e7950f0fd40ffbe3ada1901893e50050d1ebdc3bed72db08830733eeba8ed9c79f429d99f75592cfd95753056c64a892446b93adad70e80fa49074fb066d5ae38af19087a0395b7aaf58baacd29f8c58b1dc6c505a756b205bd137cee2bb52946b6dba9dd4a21d2f0bfee2d16629261eb2c37f96dc2fc158811161575ead564a09dcec6f7912f00c3a0ccbf86a6351a98a3d27337ccc60548e8d781ba2ec4a39f666f12baee53b90f1a45fa96c5db88781e1a9d39537d6c88582c92e4c7506409a3c69d3a8a80ed37d6c5a0a60703aa97adf56120c886ab190fe6d3a88148f6b28251103610c10670de89cfdbf26e4670f6ece1843e3cae77e651890978624f6882995dea84ed7cae8ac453f736c1227716c63189a11f0e00367a799cdbe8518ca3cca3b922b9775404f199520f0f90078d67bb6319775b95b1f0f824fd20625336f98f9cf95bd51b76b186c5c2921fe5e588f31be2a23476a1f42fe2180c06db2b316c821cb78b67bf3faebb974875e670474eceb1b428cf774c990ab9470db33229f8ba141b19dd49795005c3534b8bd842e107ef8fdd7a9d4372a91b79311db03b938064069793591b64cd94666aa31644b9e960c31e6a1f05889e0ad7706b395fec9799bcb02f4f60124852b48ea5ef26df1e1edcbf482865579ad204d643c6570ed426288c9b47c2c901a6909a5d80b82d7fd89db6606bc37bcd5db25e4709fd58686f0729c677786f5b01d74e58a02033f11fe9fd74479f0e86cd6fa9c139e0673eb47d5641407c80a50dd2228b58fff71597eec32806f6eca2e3fcf471d1f14573938415bd01a027c03e00fa2262ebd226f9a9e724fc33f0de64e401e54dfcf7933bdf64a239afcc86acd70f49729c97cdf67bca6ad90181c65286c888593cfe1365c8770b7b461fa81fd2ba33d243095aab8639c1b05cd182524dd3dce8a5adc1127f8bc6fa7d4b6e61c0eb5a39f8edd11cdbc267ef5a8b4123d021e9f0a3572eb83dedd7eb67a6e3cf0f474387fd142452800a7520ce6a4892f8957095e5230a79a2b9e3be659704224e64654b386f155b91a413dc114ee2a1edefdd8d81dd566e7fdca68a4dd05de76f9806f31f918f108757f4aa587e35b15936e32fd2019ed400a3f5c222502494c1c14cecc4295f6ebbe4fa6c23b6c8a6f0aa3d95769e972fee27313e71ab7afbabe24a62c82c8966b699e01193e895cdb06fefaee4e335216715c0fbb8bbc3679a9317d0fb8562a2c9e182c9a94ec839fcb9aaa419c7aea04aa9e02e19e570693e227d77343f2267d13fd6f2f2a8704e99e538e740c1912be78c0cf086a44a21450edcfe807c9a27531458fab8e0ae97a84006b403f5773d0e075215bd200a579fc08f2a7a1ce4f37b7d285ddb55b79e3a67d043abcf7e6e59aba5d85074074a492139fa9c81ed5bffb8c0086ad98debd147767a320b3df228c6a9c707dd806b3a3bed01012afa6c5c98f9fc91ead708449646c90b698c58482f12336bc1d68a729681c4e66bfe8c6f36fe6e2d91467215ada114d7ed7fee6717ad862b3f98e2059f3c825e6e05776d73d41efa95e414778b85865659e4185a9e9705b09d2a60ab874311e9d484271607c1a12d752d47ed9c5f420e94c56dca241c6fe3fb5b5b74ba68b3752dfe89b6441475e13d424bec7ddca3b6534d62c33bd3ef53d0839a67354138faa1883de486a185c8ced2ea86b3d7138fd1fd08324fb9a784b3191ef4cae2e8434141b634ef482371f17c6a7a2a9612a0c1f0d41305180c144ba32b01a8d7f9c7b4f0afd641e168c4688284f2db223f12bd1c7cafb2e2aa84b470314c3aecd8ecda1175fb10fcf11f0aae9f1a3fb694f62edd191d2d1fbe4b97274687842b218a2e5846a198e30f48f3f1e2d50df9dcfcff6639a0ff903d44d91c3d69f39fce32769570faf1770397e462cdb423f40beea47a050ae2aea113e293fdd2ee07e1f772ce4e13cc428a29ce98af9c398e08c23cf9fe2f49e114c5b0cc68473e46355d1d854b642d5b15b35d86c72a28972854664b1484acd5213222a1ebbc3a793cffa78cb287e0ae705ae19248a9ce9bcadbb4cd47761a18770493a6dcdc2c145b89458b67acb4153335b8657f9bd4f4654219b9c989ac5a2c272082bb4054501182f7b6ffbc693f7e047dd7a4f886f16ed33796770a8878ec601904df001cf7c1ab87bb1204b1b47176d1d874bae66d5870dc4da744d7262de99b5bc0ed51a477ceead61b5e3192aa51b6eb49eaad6b87407112a42edee4fee1cdbec897d0241d849ea545c5b67ce3e3fae985375c169391b7f25619866b70eea1ee98d57a82d040c0b61325df467ca364eee1e3c14c5c5b167350c9f5171ac4aa4dffbe52c8ee3cfdbd31b83cd22425505799be00a9885a80c25c0e8041562b749b40183533001d7f75343993f8be60110f91cfd564e987c8e4ab3aa40ed629dd70cfa6eba3ddbd573e30d6741eee018c5c35eaba4647f54e08572cee59163d917899a404dcec459f328de92f824bf8f6f2665db91161024e8ee19f83338a8caef3b6f3928693cd273a4bf6ea24ac725ad2da460464a77b3cef4a1b3adf6e2537cdbff1dcb2a4fb360cc335229f5cfef620c90e415d0d183c3b0d9864170f42073f80ed00533860f3bbf52f51c9891a3bdc85a60562fc76872759dd0b11daee9bc664cb7cabbd08de5a246e225796c13b4d6ea3a8d2f457e73ca86e3a054b9a2c9a99da66c22d78261c3f81632743b75fd1e3cb2b84a1b3dda621d6e1dd081286aa018f38d388f07dad740cba7d6aab62297eb7b0f6221eea79697316c1273eb1ea2760b56969c7c2e5e974dfdbb89b0e4a4345c466618b02643a688ae5995c29f6c0d9fb82a45722c0e5b5bdf0987a4e2c90413270b7120709876bc9edce15aab51bd751a911906cb630e9f8cc25a7ae3fec051dc1253806435210aea6c05ec14c105693970b19d729d5d97b4c12f4b3d8049db8a522f22eecefab4a3ac7b32d1ef39340663f1ddeac07a04b146a05914e60bd225e9699abd785741c39cf0c423bf3ee31db7568d912844d05db4fd320caf0a5ab6cbeb2c70c33ece5f5d5f388fcd00a80c05c6acc079b9ca6622f04f1642df2d48b446190cc1163fdfa8b360ba235d973381a29a5fe9b2c5236e75578611ce9660f0eeb267", + "aes-192-cfb": "20ba2943ba5830131d093d81a860ac1876bfd6871b126d8b182925deb3c1e8db709f9fa4b24b3824e0be8566c01a74f5c3e05d7a0e3703561eda689abed570db18d22c9552a3b12d6d3d929461411f4c3c2b50537735219240cca5a8b88452357e12d3d66b6af9b738f2c5bb5c9a7cccb23de1a8f2cb6ab74b290e4780d4854d486cacfe1f689689588e11fcf6948f2c39ef45ad5a9515e0c28c3462102a2c9a6c788110e781cae018a0b353e3d811660a25010748d75fbff0e70963a861023a80e0e08920fd3baa1e9b2c278c823332d15ad7a02c09941018ded2c834a7e98c715ae2dbb9436e7678dc8c71e2ccf3a19fbe14127600ad34929f0e2802d7dc5c2ec21621647b632543ff86818f04364b156bad6155aaebc04f44af328d8d66585ae53bafd4f5f562e2cdabbc9334def1ded5200dd73ebd5509ed225ab2dbe81ed3699771ab0c675af9f69f7b2f0ef7302b96ed2fe6d638cb72e39745687f6ccf55d0c928bbc829af53e92096ba57ebcd96c88c8816f0081b38597fecc45b20f817bc973262cb2177f91f55826253864c8360e9947a7667fa26eeb7e5e63e536026062bd1d7c75b4e30637c55069fa980949ff2f760e0d1b3b3336695613179bfab4e84fe91b94c2a83167acafcda77c403a6d4a68b4172ba74eda43a6b0409ac68a91ecf3b0e195a86a3c163a43fd7a64adb0f9b0fb1b691b9eab41c3ad11f90ba37aca51fd62de18637d255edc6fcd8778471d468a4e5ae2d290af76706da61aaa9012a37ea81a2059fe2e72dd399d6cc4e34d2f7147367279fbbf155581c16a9d2c5d7f1259d3969b04c5b728c12f20ebc444b31a470578c7399956c99882df0428421919344d31e0d852c5f6c08f8392c4dc5ef516b586abfbb72b5406115f1f2de545e8a961134e189db7c0b7b4a96a1116a4d69694009cd21060360f3cfba2025c7a71ec76d5d5e88b9a422966713a5f5816a1fe7c7a964199d794d0602f7136276eb490f5e8cfc8578a6af794d4784c8ed8a573d8302178269e44ca90dc52fc55d30556cd68abc9edfa084a432bf4eaa27e749c45b2190e2dff4241b76e0f0b4c6f54a1f7b17227807e95e443141fc0089e92f508cd665d1b2a03db210210586629d4de166ae1a581335bc246c1be519542a1845be351e19493a9d580680de9f565f9f4489f6ceabfc18c0386fa9ee988fb254c068e61f96e3b48045f7dc10bad3844f336c7ba31adb1cebcd70366e92be424612c9e1c90ba3df157f047b2ef5aaf89a4e49dfdf203fcefdb8f6f60925c7eeb683622dc521ca4df256e7405b35a6f412e66eee577f83c83e4d0056abdaf1f99b3118b086863814407e4c1f1750cc966094e3c014914ff481192a5cfb09fefa9ad11a381694ce36d065f42333a383bf59b348ba796c63fc5652620ef4e3c0c4722e575aebbab67e510701e8a26d868e1f4788f9fa6decc346ccda5aba9e5b9ba48a2eabb851aa85f3366bfdae6ed8a7bd53d97dc8b413dc6b7a9d7680bc481b82e06b8e0c3e7f10068182e3f6043827a15b13c3eef0724e7508aba0925128e35b778160d69417bde3282c95ab416ff403dff603e91a19c65456cf9ceb9f54bce84e7d6a7240957f7244fe213e17d3ae3ae1f334331b351490279f20ac6b10038bfdd30a1f5cf346fb22c697cb531d783146c94d0a45c359e261babb57e999c08524b4426aaa287c27b54f1bffc1498647e47e013607282bcd67875c6b29865f1386676342eaab1a342b0dfb6dd0a9e48ed40b7fcc95a9074a16d035d6ea0bbb5f3ba51a18571e974d2aa19dd21bb4937e78473c9231d1f1ebef4944e3919fb97f4f924bdd1494a269fcb036c3a8177ee7b0d5db1c4b6dafc3acf92caa91f28551a46f16beff25afca9f579aa6cf78a7ee817401b783b080dfa7682520a296428f25f74e01c36aac59b9695ee9ffc86b03d4fcc457437dc92e5c434bb681c0506c4d91fea8b488e7e7875e20e645e02f563d6c9b1416e8c8fbeeb494b49d76dfc4a4b85ed3f8742e2ff14bc889578afa28b2f4a88bc69483f99b9a9a850c9561de28678daefe06261fd18b67e838d66100a8bf72e44c49b04fdd94519978e912efffe565aaa558430545df8efb67d93e27b64a477dd6c7fe318fbd01c66008089687194b9e278192454e19693abb9fc53f8bdeac1bae9332576519243bc87926517a18fd6167baab7c22c0b86389ec0a67ef3e4150594ab1bacd5d92866b3d8d448dbf7d71b0fb883a974b258b44ec8c966839bae81d838be062aef06565c791443be8b97cea586545e81ca53e4db268d27afd853864990781d8aa22036d3a4b6db87dba990913cacf7044467be76d90aef2e3bc8c986043ec343ad51a0200c0b3286f4444a5b4e04bcdaed789d69facce1a341456ad8cea451c308838ccea44d1ea9272bd0c63d1fcdacd220c067297f573d88e47125879a8c2fda8cf893b468d2ccf7a7cefa7ad8467a6dbcc15e42da5229b93d051d6b645a0a68a46b8191393a2690dbd1a01aafc866b0fdedd470d6164f448808e2374b5904e5c90655b9fa0c07f81a727197bf91a8ab7dfe2f629fc6cf23e22f2489ce6bdc93a5d00bf4ec815a363ea3cb9af214a317ba21f523db7c524aff51da667f19a51696628a134dc3b6e588de7346ef47b8815e0f2eca830c83c3d88c522d36c7517061ebe75a6c656bfcfb7aa23fd99b8b573dd1474605ae4ae149d4b6fe7ecbe70b692947103eff0db6851ec2cf701f8ab816c4a4d9c40252ad93d93145f4c9deb32dcfd8d2dfce377641305be2f1d0cdab3dd7010577a96e5b1d32fba7d387b7ac2237ca346204c3f1e7dea9439d028050cfc60ad00ab7b8db053a7cf1b5f805d61f07988de9c04d16aea6502e0559b1f3a6f0a9c14e430a9fb64d84144145823d4bce24183d5208084aaeb9925b309657f74b2eaed95e0db78a11a159d10500460822b57d573f29bf9c29c688b3954ecd393c8bf2d891181358fe93a71a2bf1bcb2fa2a1948dbcc2ba089ff72da6fccc6c3c3e46ae6765f4f5092e714563661a178757f7f19df77eb86f343e57971357a06320e11fff020fe7f23e6d17e0f84838f2ee4026048201758678768bd57c9615fcf5c26d2044de124f4bc07a7a57b193f3aa983678e1f648839fe0bc186e729ed22b1a68ef53300656fcb64b977f4581f25911722381ca280a5641d519815782e6011887100b84be16889454208645c6d2db339f120291c6b02303c1eb1507122e0c88a27f150c3a95ddd10765857b5830b8980b3e7a0677035c39c77c85f48ad02759849e695bdb8fb60ede2ff50ee9406974b510b9577ad83c8b7fed24fc7df624d7b1ae93f9f392a9f344a64b367910789b82ecf6086cfa4122b8c3ebe2f64869577d4f463f9cf796b2e1a27fc7d947b255b19ae80bb23bd128ecd02e273d942e2cfd5471ac2acc156a1550bc2323a26804a0362ead65d727d8cad3882c076726253a423bc7f3213163e876615cd7cf3e58b2d38a017481c78d6c20a637b56e23ff6e48238fe3e626f8a879ffa57a3b06ecf04a9499c48e58e8f59e36f3bb65f0bad104f4a5a3d9da35a6abf2471d4f7c2677d208cbb41572d3ef414bb17d680c177020301ed66bbd59d2921c95bc08bfbe5bddc832887612261f03bde8890a4b5fffa968f063b0b23b9abe003d7c984400d750ae052bbcba71cb4958c5ed41e44162cd342ea099ee55bc1044038dad460c77f9d59811f05380f781819f75e486395c395d258f401dcb9c9e7b314f520f350fbf62950bee2b82d92bc457955c7a001719dfff69d5ed68b80c4315bfbf1f0bf1108e78c5d2840cb880f4935fe5848310fc143059fc5223eee0a6b6a903c1d16c7d64f79c7e68d6710c86795d7cfe2638bad2e89355189986e6ef8793e75a842ecd6a68196df1cfb494464d64838fbdd4338a79f40f6b6ae772a809c81d5437cf042c7d53ec208ade97714d3771225adc5387f61e93e1ba5f3afdbcde7a96ebd1e58e206723fe9cb5cd100c6f4231f41d9945375ff14a6f9a3c132ccf207372b390b511b49cb50c8865e0e76bd419e086f87e44824eddb5931a547e5ad85e108dc7c4183ef7b75fe8bbcf18eb10d3d1899e13dea66830d48c42c3693d0d81d726e62b90bcb49be470779ec8da7f99d0b57d6e93849d4a80aa5b", + "aes-256-cfb": "ada22f724d28d74dc5591a3ea915b9b4170c9a73f0c890767ae118d294296205f84f319ead930288c207213c097f49e74ed332c6b55c4b0a1a99f4f1e1809e0252cf52c6b2f8a2c88efb1c161d7b99a6f5ed981719bedd223b3ce785272a72ef00dc8f9d92da7936d3c24455e5088d224c8da86d4112e8d59eca8ac20b3f1f5affbcb375f6c7351e8863c2d3fbee0047bbbf907330f20372b98e3172c22775529146e5ef55db26f68a43c068afa176b494efc44db574868869fe1bdee2a72c317f9a8d1c9193acd68c726c229852821b338ce2fec7882312bb7758985f835429d986456c7ff316d1b4e85332a3fb7a0a80d60e36b92ec083f07f2bbb5a352e3007bdd9700e31ba861257900c4120ff17a60bca2746210751d62688f661786a7a23f579801b293b4e849426991b88bf56166eb1b5c104714f175077c8e3ad3971f0aec06617c3be025c29ead37020cd2f158a284ffe2262d25b39b2c90299acc6817f3725746502deb902b4eb330766ecda1997774bf9f71e067640436fe47424595df033c848f7e859dee792b3d92eda1cfe91d908504d5b5fa9df2eb2eb998e422ad8731023e7615defc9946c3144e7aeca924300c6fae71daa1ebc1a2cd0ed09c2d71945803b673b073de9421a370c8b61293f9230a22c0f2a3d19d1e480ebea59303ace98d8e715a10d3c75c16262cb045c8fb96c1a02dff30991a9d29642ea668cbe89256307df7b2f03dfb5848d8ba4a3d40dc9b711f621a352cdd7463b3f74550cea0a216659973e0a95acac28b62326ef78b38078dceee5b41f2f1dbe1f136c124835f89fe138194a1ef1108a2307a49f189ff301ae1476e455b870a31190bf28f3a615e5f163e447dc4b59c597995cde88bb941ae1f2ccc802e94576858b2e69fae880ad82d104b8dd9426cfffc43213b039f3753d238b86aaf396386ac132f3c6d749e9bb7162048e8b2e1b5a569c2ec4f45b0791c99198f493aa39b6ef1dfafdce28941134490aea11709af03ba07edc91b74e07b38d3231cb3d32f3c23e5f0fd0260ffe4c9f1b6d0ca0ac05dab0c9db5c2ac40e6bd530095735bee36b7670147bff67f27af561d69c4b19c009d9052ece041ab3a5d8fadaaab74906c26cea5bffa4405edffa5a1b2a8e8d95aae8e8d58095413db858cc93e08ca63c7910fa36c7f9f578808a964ee549fabac4d1e9ae8ccad0b107df54e593dc0ea93b17e21a7ed48d0f88486564dd6700d65516dc256edee34f129598a825e0ba14160ba80f0d7b3bac2072c1c9086c306732c0e8f8bbbc1d5aacd9cc3bf02c57f6e30e874c8038882b584bafc5f07e2fba2011fd2077dce02e5f12158a01de0509e025dc38b804bcd3b95906f08d4837146a00d31159fc28449b44bded86e10244af5b1a2eee91ec6ec40f8b855753a665d0bb55f1bf0bc1b3b37e0e28cedf85cacde8936b93c4bb67d5d7e136cc1814be3d6a551cbc828683b259c94469aa1f202376d01d4254351420c9d8a9323e4cc62aa53b3804d1175be57e5f9120dc093fbf7cbd8ed1e454a2ceaa217f3f542fdd436fc49e2486204f2b0103e2d1265e1cbf26b9188815859527e6808d798861885700cf1c874daedd2efdc17abb60f80171dde8fc53c19570656a9efff0afbae3a96045e3e77e75d558cbf9d54982cdbd977874c6feb1b18cac61e9f01d6d6b54d9f1b91d41877ce5085a08af3569a4bcae246c42b5bc114aedae2b3b80824a4b67e19f90c4a9a846efa92c1961c0f43bcc0e3e7ad9330165c425dfaa843197d636497938bab2993d60db81e555b9d65b86bb28757e444a624674244409030bec2496cfe6503cfecde1c27d790036e4d4e9ef915ba4a84e35eb3430fbe25d7daa1ad0b821045b33ad1e9742b13830c7cec17fbc33557fe08b0701e2d74bb61811e48fd412f1327401efa3edbef415f89c6cf8c0844f2ed2dad48f0a1144574ce7e4b0bb8acb0babf6701145cb039e1495c8a2a678976aee285163295ba5317073e45f60278d768e4958da6284683e1bc25088bd6bced76562634548d828a86f39318eec2e2d7cf3a5638b1e4008b3cfa55f44cda3a05e2948adba67be55163fcdd4e11bb3c451db6234092a8858893d64aac1d91c58097661db7fe07c59c54be8f10dedfc1644d2048319d73d7a8c106d39fabbe339180eb3ce6257f3133a564a295de6ab4cbf3d6d270c8ac6f76d80cf17fdc8a799497e40dcf446dacb3fdfb2fa918d5d65ae3a871937ee825523fe29783d18d3974a27eaf82d5cf8206d774f315c2f09e7eebb124fedcbbffdc807991696f16a5b05ddf7b3cc22a980775b01d93d9546f65951ae68be1ed59aa0918048d9f38c1c0116edef7e6d54f57d2f1c2ef8039846b3bb01c9c83bce8167aee9327fabeead141cc5322f81408dc987c8f72bc801fe03be16c91b3cd79011da4e9e545b74034094a436b16b5e72a3567651e61458c359b9031bc8d15d99afecfef067355f1ada68e333dc339b6fbbf5004e2672b871bdf099f1f1d19f99013c55611c341e7a0eaf19a66e9a511a889f62c06cc398733f2b55aa9bffae5fa4c8c927fb75f83a02dfc1fe0e8b3df1d4d46330e1a0ae89c678e4fdb83afe6d7a05f69ef75ed93ebbbb27f8cf57cff71533f2f25ae43dafc53f5a406e08efb8e753fdff793b43b71fb3224483c0381b4bc67d9cc29bd068e92999d0f59141f9285a9f50e0479f5532f7ee0c542940410c4b1368aed8fb67ca425ab5087db7cfffda7c831dfe3431503e5af3fcf9bf3890c9233b730fd1f895a413246a042182c811f3c55f2e395d2db1a2ebb9dfc066b710696c17338ba19725798a227cafb6ad717892cc42228f8ff64948d8ad100aa31bc556c66fbf9574d871f6f0e89865d55dee56c559af31d156515ef39d7489fc40ab91c2628d60d83bd77cdd6cfdb856ec804eafe4569b198a3a45d9119afd9187a034a791e5382d2e67f072b44c5f30e0be21af8bd85c4210670550713252a578093490d50e46f1a36950eaf71fa91d63fdfbc4e1c47ae9e9ba463abefa605e2ddc91bf0ea9836dc413dbb4d6e25a6ef788cd48e0402e12817170cb16c8b4accb145a787fa0c60ea9b856072c50593bd8a9ae9bd52fcd4680665d6389e32494d70012ec8c416418185f1a533deabd3b8b79f542256005457b6006a59f673a35b0eb8b7a4de38c2760f1058e99f4057a05f7f84b458ea25ebfffc092f99fe11f71ab43e0ec9bb8a5232ba7a48a998eefe6d8e9876c7f132fae6565ac49a503fbcf836f58ecadd843c60cc38f411c1c8eb9729ccb098f1bed194b1b5e5d4911259c72bd629c7e73a6dd50d2177e0d216a4627872c1635fd0b5e07f6ed3f8bdc63da6de73cfb26f2b7bfdd43a6109587f851bfd0394a7a7da7ea4b5c8e7e265160af3c00f25d7d3b27955b9f34b45a221cf52b3fc9b27a48239b90e0385b699140d1175cee0bd90100b7725c5ffb5668d4d1aa0f26696c2bcc8a828eaa2e320aa0335761dd9b39d380fe98945b1eb7d15c2d3b0bec6057aaccfd0ddc2b52b8077a18d7f76e4deb05049cc177b34fcd013cb0929bb2a63cfea369e7289f8f96c3624516a1220e17d44e624bf6b484c303d9867998255edbb0e2d781f5b3c0a0032fe8c29e0bebceb14d36a6e48db877af3a97b436e6dafa4675262332fa02a3cdd9d3bc6978c65de2e1decc62f156fc11b4f74dfe0ea9dbd6dec706378e1487e22da25a1126773cef5a0ac2ea826b408575ab0c4fac8bbb88ece72db523ce9efd87899008cce5e67ef9eeffe9fc857212b54130ba7e7186f337971ee0688a2f27e7aad75a614f0ff89e4a23bcb41f6a60d173853eb7dfaadf4a20c6a68cb51966b8d2d353ae0aa50b8c781888ca04041290a4841c13002395502abfb5e7b7314392cb769127587f9551195d24e5f6a03beda40d591906a67beee2c7afc84057a47e4d1eed38135aafc285555a2709c6ce02ac5f3356a9d05724f381ee62a008321577551263846cb5d910c33c2cb7cf83c63407decd111355eb48242df579e82e765b62f22454a0ab62ec0cc81749f7323276abd4870eb944b5ceec0c2b55509188e281b2b7abdc1a268dda897bc4d3eb760a361623c58b9ce7bdc666ea7b501c878658a5e9d8761596d1d386939fafebc5a30b678a49e486b2c3b4e4961a55ef", + "aes-128-ofb": "8ecc1cc287e5e021fa0bc138f6163fd5123e5de8cf300acc1a1127924f6073504580df056dde95c1d51fed7b387f08555115765310cfe960d439942bc4160623aa94908d9c42587b11636a3f11c9459ffda40939769d68363ab231aa17c4cd422b4473f73cd3e13e986b1292563abe5994b09e66cea6146e531a72754fe1428f1c37da06a5b2e209063652bc7b13c48cbc37db197bf9041e4f33fd682d70def139632750ac6bc45a1b9741881f3f39de14e385fd06bf11dfa98a031814bb5a4b8e0b3d6e8c7dc789292b566445c3f922368153701a5a4dfda76c0cb18f7e4ab760e354e6c3b2d61e93c49cfd63363af24637ea97cdeaf2a91b3c0d53296fd2700924a9ea7f4487ebaf2a1868a8986a9f898382b6fb8c1570d86969a6e38d24e63418e963503986db3665103aa60a4d3cd70e6a0511aa603b4318add3f1fe2e7a7a71ebc31af216947a368f4f50920d10081ac99afe4cc6ab167a503616d048238b9e50f2ddecb0dc0220191d1b6d8fdb8657e474f178d5dfb5f8f80bcc4e3aea3b79f83514b7cf41d0e14949d33dec1b6a95b6a084d2e6f38a24ab2e28e12b933327cbb16ff3412d5e8780604de31261328db4390cd4f1267c3351bd67d9dfa9a2de09703982b1b27976d3aae7bfde827598c1d74c581f99c7512eec4fdda22cbf2735c453f8ec86f778786d165fb972154c5d96be292a8f9fb109fa874c1feda293e643b2531b146ffcc62c2f9eb8b64290841d7e6699d9ea93ddb70ab4f4f6ddc6ea390c9c96517b5114623f29c7c4884eb86889c3dc8ab9456f5701d6f81b0eed66dfbb56005f282826b305a77902f754577c908bf2a96e43fbcd04d488b97562ae633a9fd9dcbbc70266265768a178bcd8a3acc5402faa27fca10dc84cf0a3faf7827a043ffe7b80c1d00a9209bbede338a42ea1370a9aa21bce518e4077577d60b206453539705ab913f2f6daad4d1e6b46c0b8b20d6d6a4756954f162a7c7dee3311a4561751fd31f753d8ffc5a407bda1cb27f502a22014c60b6ef1f63c094e80949ce8e16a0069cfcf069267c332b1d04aad7507f5710443c49feb7a2f93c191085bce96a8df6aaab1a0ce28de5f7e3b4b5cc075608213144fecc12e3c73954249b14326c01bf9ec1f515d5e5668a158f733e87b869bb3ef5ff36a9385c9f37c70ce779d8b94cebf135744959548b8099b22597bdc79f7945228f5113c5cc06da041a347826406d95856b06efa7d2c44faf535456a0cf78a1f4b39763cffb758b1bbdbca5f1b634e02f238d6efa4d7ce2693e51faca615cffb61e578ac45957c5a0e3f6d5dca28e6d115be14d28e27f56cfaf40858e771fb326863f69a6bf20d740c77803ce6f5f6e942c5ae4667f1a522c14fd8c03480eaea9693de31a1d87cd22475fa46378cd0c8d2521bf799f32f9f84cf49646d44688309bf856680fb552da7147ca8cb691ad0de55adbb75ad958ea799d68acddc61dde1f985056b5420be94c9c4a0df222e066851f1eb9919b1d87d669e602f68e5c368ee32f97265e671674e6cb546e5492790f5f309cd70154b0fe1368ad8283736824d6f957d4dd46cd5114f4bec0f7925475b2a7954c73a12c1052c1bed6902129e641153ad0a1543998f3bac3a9624818fc6d4a860054c27cc4db6331056bf5cb88541db312917d24ebef344c365e87c0e9f7414cc278dfcaeb2bee5ed89b1bc3e2e5cfe15cf5a93c220a9ee74492ebb0e1a6873d7f8bbd97209da31a33a53d4c5eb5a6ed09096d341a10f35556fb23b65f816b695b4ccc696defaaf2cf37cb39350be6827f788f28ae7e4f758acd4eb33ef7eb1d842f41b2e8dc08c24e78347da8d846b7f60dddbf80e3ae9ab43a24a2d111a30cac76ca2d85abdb66d9a518bdb12010bf42654e2331e256e07c7697536930d28c88d6c26d730958f2ccda78f44d5f10e1888e94f22bdae4892e8174908452d783376ab404cb4a7376922a9e84a0dc55226f5e7bc7a0c40667ff6a1f6284d19400085d3658fb6af4a05f5d179118c3b4608a46803433fe47676fa969f51944b28943ffcfbd458a191164e4096a9c312d86241ccefd2512cf16e79da2d18854b69c7e974fdfa63ed8a9cdabb7dff627269faf93e2cc364d3d1e83d80b104116d8bcba17467b7c2295c8fdfd75e2db75730d5645a415a522587f999076951a2dedcfffe124f56354b7005b08d5d91bacdd0f44359db12a4581d620958b4f86561f80f2a6a637ef20679ba3c1ec6f64680355644e87d03f3d6b829aea7fa36f6a691e0f1bfd656faa329e034cb9f438ea6cc089b662e02a41f9dc4ef48592489feec8fbee865dd96ecd1c759a28ba529db566b1396cacd3f366e9f358a149a9d25558a35d200e5568240aa6a8dd0d2fa08b35e788b41ab7b59a7c5c3ac781a2cf0abe2fa001d2cb45818f0d4bb546d3cc0883464fb25ad064d806f29b72857d849755ca3e86c049e311233cad8e3d59bcfc8fcae648ae10bdb1c3bc9e0199d9104a37fe66c2468131af046b22ca39d1a743fe85834e01f25e74e35d1edaac3194d36d849c7bfc645c4c6eb789debb940c1bc3527fbc9ce08c77d3b3188e966ad1a1776ca23c5fa440bc5ca8f8ec071d4e7bed649a626a4a95403abb7ce447ee80461f039b17d2c3ba88046406883173b32663e88e630e85fb765b1b6bc67b5d5f38de055920787c74e602284dc65b8b69a1e704b84274916a07d8cb5004b3d216e084ebeb315024ace144e18f7d7734c75effda28af5423f7fa01aba2b47f7ae91630c798bcd018fecbebb5046598bcfba6c3cc2073f50752bdb5cb02dd32af920351c1b7e514c368e49928727c563a866f968e20d843e4b2af267461eac153e8ee7554ed483c860bf6b42232bc8daeded250c0d6cae81b0a009f898f8da19b505344fb3e59c9999f45fd2c80ce4e9dadb76475b2c4ccd61f035f48c27140f354713454b9b398ee2977bc58132725cc98dd38aa82563f469fcccdfdc1bf80c890ea191c3b81bbf6852f6b63cec53c535d743992b3b97b1c71dc7185cde26fc080966aa6ae7f5629ac9b19a1a4ce1bdf5e761ead090a9708c9d5f1930f4e3c2e60e0574e11e49636ce1b372d8d2ce2cf4822d3d25af9fac9e03126cd4c27502e24ef1e08044e97bc642c37182c414f09af4cfa21ed81ffb3e9893f16716b60e685eaea9706ead6dad271b46fcf2fc612cc34e9f4a7fd65453239169ca7c0a8e12f6db38a299ac1e3a0da1f5437970e0812f51d448b43fb1d7d080302d0d582b0cfad7823272b082745553dc6302d3246e18888d84a74834ee235d01fdb98f49eb58ed8c9d58f0ba323d3dd10e7732c541668f2498c97eb2c9314e53273641c91eaa5814d2208ff000ac895818749b82128f24230a2cbc0547fd0dffc5bae205d3e3bc5675a268d0245003d226313db2a04f5aec1717424ebae3782ebb912a40c9d6123cc5f57002a50b42b50f91355c679e3dfbcab68a9497d088dc8342fd00c024e16d3f8c63122e953b3183c89cf5c7c17296316899d325fef9ab1c676d74a74f3f4b9de28399babedb505e8a38ad67d9c27e655b953222c4c115accf055e62fa30afbb0e3a3fc89ec12b353f92db74c6e5fda59fac63ce08926a3fabfdb095250446d63326cd161d92fd590b60498520dc575b755a2b1d88e9575e69cabd542daa30a7dff0039de47d30fb5a6f227adb87dbea5e49872eec6ac612b30b7e9032e81a9bcab04461310bb88d49795f80240fa1b645173111386c3399842a411641ee2cc5b4f580b841e91a90338668423412d00f61620f95b2e657c4262d2e259f56b8ab5611b8e7376ced46010d8f0d1c296694cd205a5389fcc751573b02c33d249bc75e7ca11cdf1efffe85a77646f95ad4694a173bee39af14212a6c57785e17544d6923e842acacadf1c5075338977c125108a215315dcdda3ed067e635f5faf24bc2e5db7bc82165d77e0b3a6d9812581c4b18cf0c6d6f7ac915b4d4da694d75a4e236c10d4fdd3f0ad1d80be50deb0bfc5bef03a2084c423c2f45aec3d76c49e8c458d9c925b4ee373867d7eb5fbe3aa1adc5f5271f0b38ac25e71479473225991f3e78b8628e4e146ecffd38d48d8cf5650a576c2f9fbf5317e41e51a560179dd836c466546aa074d45280050427a0ec1419eb035dbbb5c26bb5c4", + "aes-192-ofb": "20ba2943ba5830131d093d81a860ac18e8d03715806e354a89c3efe081337278278a16084310eefa7136fc0e4eb154da7de7948200fcb1700ef0d682d2db88554679b5ac9e390f738bcc9526b4110a1b3db5f7098d7cd6a630c322cd89225f9efa7cc1d6b7cf08db2418633451921690493f56c4c25a594418fa2cf992b7dd5eb218f5754a9ac1f6538fe0d3f7278a2092037c9cbc633f1af10f4939e9e7dcb991c2d487858cb6c61ee797e8e19aea04d46b8890d341397abf828c56ec447ff74a7010b22b3e8847929b289030b7c218594efa438433782dc7b43ec9e3d95b2870ee2d8283f1d5d8897dbc9f8451877ecad8313bf7c06acf68949cc04c007357ed99a3ab19b215b474331df59a5acb7dd340e99f38204e55d5d8673c3f75462ad1fd15f85eb08fca79bcf86685714c05aedf693139258b2c50249febb75d4c778438adf16e0cda2a5d7f214a1e23bdd41b49bfa09a9f003534c6fe465b101be3b779fa83f711815a8ac402fdd6cc71bddf488e7c70a54dee39e05c7967482ca44de5814e3361fa10dc6af2617b0eadda9a9eb0f01573c38962578f774421d04e4d532f5f703a9c002435fbd04d51862ad0bb0652b914196a103239f3b73be49b2dde0e86adb31805b5dc287f49156b30563effd006a0d860d4d3f7fab837276632e19f96c5797a3d94b1e38ee9a3542c08ca753f32f6e589621f8892c9af479367362e6d41980d2cb70d635930e23acdeaec8702c1b005dd61644eaad05bed1546b9ba3aa5905ab00b7b4719abf3d305fc24438db35731717e975f25c9fcab2bb03abb9957278630ed6047efdea6bbf979bd113ac0de4e35b65f899aa5a1b268713bb3375665e384514d900cc65696ad7a2c3632bf879230ece5d184cd9c4bad655aad4c40afd29d9d452c1c66e1ea2d4b96d32506ad267bca06ed493d2083572429c6a6abcef2d06f68be7ad75ff8c3173274c68a41f7d95fece27c02d94a465b33994908b1542c948addadbcbfea9ba6913af338bc451826d6092435e656344bd6fff2e1f0b2cd68b462808558228759cc4c9916fe40cb59c0b41d1c5ab12d93b757e9de998764dd123e9b0aa6bd93b298999cc77f05debeaa984e86c7cf7417d19d23568518ce48d2c5384403fb85467e92a8bf631d45c08edef06879ea776ade8d8c5dd700f5bc4d579a1f1196032a57c93ee992226c421c4a1550d330f543db599767abec3004532b7b713001e0d8ee6d10ac1b74562e8d28307b3e5e8f123b5cfdace634267f3da135e4c61ba09e769fd3e1475c04f44f69e66f8dfa72592f3f37e6d6a23915274fc78e91ffd1524404d0485885b460d41d8b1be88ca9ee9cdf5a642a82748217a0736118938fe49381ea6d04632a54b672c3697c595740408faa6a3fe5975bf370451662c0b18f791bcf6d3197e1511f4cc07310a4700454cc3d764a3d5394f82cebfcbafde08cd1bbe6866ed8177b67141b010042386dd64e775c3dea050a597c74f2f729413e97f00a942ea7a6de45cb8d8a7652b4f6fe428968e5a7cb5fc0ac2d8fc51d988fd24f4201800a136ad202540a541d769be41e012882893ed5ccf72779a87fc9ac3b067c6608a3ec179583470721fc042571be44ee914934eb19a86fcf1ed8d3988f5af0de2423a82627ea30e3aabb500c4f36e21b4b399d48a58e42b754f795584ada4c28f5359718ae4685e4ecb57ecd20e937afea27a0ee7b7bb58b2ef714b9a1f0a73b5fb3203a68ca6ed7024406ef6744d650fe97a8c25752ea8131a2994df7ea820ec5162544eed2490f43e437a322d0ede5e4f7565741bcd6cbbab9eca3e76d505fe87c3b64d67ab6dbf9ba0b430fac09756b0af000121a672fcd60ad1fbf52928c3dbc31bd61f57b5e3a199e8a5b184f435590f89929336dad1ad92e486e0e1b3e9b9fc06498163d24e7a4928741e12b31997ce1f55df6d39b894c1690062d3ecdf528811d5f32e71e1a492843aaf9f433685a383731b540b0041e12ba52513f8b38173af5b527dd9e59cda64dd396dd20ec3a71cf3dfe7c73b2d8eac205c4444de95b25500f2fde4c5a26c4e88be9b82875bc3ae905b611b7fd2cb0a690744bcf883d2ed460bedf5a3d7f33a88b60afe9f66a9596914d53b5e33e3130ff3fdeb27a3c38dad352955aa1dc88b9e0aaa36e95db30fb4326f3459dea6e31fd3b51bde2c0f073160db33f0eb0907aaf8aecf4a180154be5db4a26ed6733e45f4b1e9ce191e61e27eef44470e8c88723f0cae271c4d8f1916733f5b8a7f6809ce7fe3510d23084be924e23f36f2c6002e7be1582d33175946e9c9ed7e087a74b99c874e14faf2b16c086a3a631974d373ffc30f15bd6b8873eeb3f95d0cd2c808edcc7c8327227c56c07cb2408ebaa6e5a61d24d35022a3a239d88130009a807f873c9e8f2664728226e235012e68674f659489775b12beaebc0b64dd131bea0c7f6aaf9493dbaeb15f83e4d87ebb4a48e479dc6fdac7c201a68002770010c335a6857a20153a9932fff44f23e8849fbdec91f095373493acb4f6f7f1ef567636fe45623686a342d10fb4691be7f5e64dc0b181ebf1d565bf7d5fbedaffe8a87b8463f2084099ef8030201a0907ecd39d150f865c48c87552848d8b393b4dbe136175379fc2b82142cb3e3e2b398c0a89ae6fc62f56bca272e0679271c081e80a52a07528ae36170423b184180bc4f67ea0c377f71ec6e9fa4da7eb1d1dbfffd0400dd15b769935e4a8576f7bc52b5bf62f820d032b8c67d0251d68d07add40c5d2d7efafc45505be03b16ea2a132b40c8e0d2402ae19b21fcd81b59252db6ab10df6a5cd0198eb3831aa4ed7458cb1ae43227ed234e9d160be24181a66e0cd919cfeb8da6d9808559b4ee66900e1f88e713f0def6fe77d7916b4a51c88d1a34cc53471b791487e945dc4ca34161444e25163a7442289f204028b8a85756fdb4c1d99b0e1258736f945904dd79d83f089f65a6ac2640e0af9b38d063565ebc313d0a53b19f079590fdc3b63c5dcc8965fa439673a874b03f6bb6b8bb3d7df8f67c610c81ae7d51bc2074868b1a6b672863d93ce8adc1063730970085c69ec1b89aba98e52572eaf2f7bb69dff375c939fa658bd26b568f1c7cc8737cb4771e25bcdfc2c1f11bd5936881f182b67bf10b88b85b21b2be844f88629c3cfee65720806c6c1fb36c9c65ccbcfb2a9722f5991c29d30afdd1397af451ba50236bcde1694c2dfada68ae4e40224a32d899b87fb3a023df37eb3ad6cec612cace46c48489922e46098c318da7f7515c5fa80be0ae3ceed30b84b35222cb6800b5a4ae3242b1daee59e43cce4b432b4a0c3f0f2f69aefe1543a7efdd5b4e512fdc5ec35642ceabf3c046b2a2eb80744259e9373a081a95abbae50677c3ccd6b93c5cd348f0f4b9d8973c20be3949e890d4930544ef65d89fdfc9fc98966b79bfd6e79093e957b75365728827dc7c4a05a362f00028b0ec0a63276e097182f6f57873fe9847c2c7c362da228e2ed93d4b0514fead2dddd769aa722d651a55a45044303384124b7e458c0cdd6a396784f509826a9b6a30e7e07a652d820b26e82e1e288f5000554283a6f08450fdac2c454db189fe6569ff87836d7e53bc9f22eb80eb7c130cfcd6381bdf9cf0533a53c5a0a892747cb2c371330a1e43e683292651b841bca77496a7702c3024e3be06dba23fedb2e5ab3ceea91de6a67e828f9d83b2b2cc4847e7ea61b92a9ba9efec7ee3377246fd79d7fe141d5cf93a886d84e7b2fd65d6637490555632f9235998ea0278442363953b8d95be2ea8cd268fa7eec652371ac39e3e727ca323bac53e4f0d66dfa6a65ae60daa1d7a2acc48d10b6b42d20128242aded3f4c9425c9fa5e6315bf5a1d96d373c5926281b1522eeae5c2edc24efc78b48ecf542165002fc944a92abaead04baddf906deab3c708a0ffa68308fe1807707787f4a188de0542bb3453a40969f9f13f15a174d8ce8df1097b3228649a8393a4282d3c97349952ccc8a5c11e2dd4eff621f9af636b9217d4338c80fc9f3c0756f1e5d78b53c43871dfb74fcc69782140c0e24016d83c39b579c8763ca37d131ddf60203f97d0d92ec7ddd776d3e8431f14be1cbdd388585ddd02ee0cb74541f4b16d34288ab637e79294245fb6c691040606b9a8c72980d", + "aes-256-ofb": "ada22f724d28d74dc5591a3ea915b9b429cab5d0ec68588ba26102d97820a217169fb7cd9abe5213930d17c4d3d6ebcd44479fb15e3b54137c7bd484162c3041a597d91e6c28a21316798a0e4a2ce5e634285152cc88f0f62305e029ab06ed5c9f608698d50e203e925ac44c9ed25fb68d847a6cae8f41dcd41aca86bd9776f53958c7d4120c149388fc9010fd38cc21b7975168c0d9f7b4c2107892c633b6a93122817ebe56e63f264e229465577348d65634cd9bdaa5c3d8f1d4a37d4bfac89a8461d8cf657707b85c96a568bf097775d5de1d2e5db538e425a13aa8075dfb34f0e304a45de551a69147bc9ad7aa82352a19bd2b6493b9decb987c8cf085b606331b2f7e9ed267ea53f1440185e943348c3d6cd2c2fab4d407f81d9a2ed7ce46b5497d68fec181f06563e5a784c66aa4679276bb9f22c3cc95529ee04cb70910f72f8bfff1372b59fa4d1000897ff667f6160ad7ca420ed949d7b1d4904124e8dbbf09d15c5681e6b8b6028aac0a2866eec102d97cb217b6f8f521b4dbd1a28652a4529c044bd4fe2c1e6ef270bd7729bc3d546d981d6933062d62eeae3218c3bae527b65f30108d3d2455599064615107d5ee8a843d3ce66f4278d01d4c0f4856b88e9079a40439e259cf1f15f09a9a6e85bde6454c990cdf439a974ca38ffb3f7e7b1845d330138d0dee91ab744638bd6c97cd0b2622665c52c5f5abb0bda05ce4e6ee1a9863b11f490e77360dbd714ef5f309a588a35f3c32d3d0a566028c42fa365bd2cd8d5ce41a5569638346c258745fefdd524b2cf99e0b9a4440342e653dba248ead6d448989c9c4ba0c4a9d348af3659fd29b1e40b2efe60c08b44843fb74fcd697820bcb51c6bfa7c10d08a271844e8ee84b1b55f215d98cd00ddbac6d29de997bc3cc8733d97bb12fef242099ec69e8944f980f4c4b9cafc1b1b517343a26621237d34e68df0cf9255339a77047893057dcefc53cb5d582a7916c1d4d268ec3423af8f3b769d903c3a16b563756695088c37a1178b58c0233e7bec6cf2728c41451430ed5d9cd126215defc945a16c9b3ca1831fffd2a2ba6245fd9f4f6aa822f7101de782211f581b2102312eb83fce2b7b0ac03a33ea04cf7c2d85440fa36cbd455821bdd24363937ee50d8304bd9c7d796712ca96a45bc175a264270c14d41de6f62209cfee83fac776207084852780e55d03734625f2947f8f1396da09f3d57f815dce04281544792ebf407680aef2cd60c9992ff2f3d75574a12fd243b7436316813d7d720c38e05d41798be0f2417e574773d9a4dbe9b94eb8a9517b446e25a3d11655aeab1dcd3d3be0964430a1a6bfb20d8105c3e7eacafd3e999074eb00e283a60de90596882bafd38771f00d80c9bdecbeaa4b3d626c80d848d6ee90413ddb84f0758f28a8b29ee7f0c358d26b04c20812b42ce2655131b73b56fe9d2f3b2ed0360fd0fd58190b8306421189fd0a56bae44b8f2545fd9bedf3dab583b0a2edb81072141b48229db9cab9a1e9a2f3ac9103ab211f08416f8fb0521ecd5fe40b24d542f750c930b58561e96a1339fa0b3255d453039b15f17fcb6b36126c231fc2b0150b7fef06b3c0dc0417258717c62614203fd399ade040fbc0142722054018857eeebd7a20d89904762ff53672ae729af7adabd4c9ef4ef2cae0fd3ed966f448d546c5ba143c40225e0db3e8f180b6eaf4bf4c2ca4140ef6fc2fb13d52a6eb8e9e3a6b3e59659be7e2b4a968cf1d60141a207fc5d51bf291454fb044a169348d33327124a5865f587fb9aeed1f0ee1fac289bb577c24a93e59b8e9007065402ef13ead1e688543db7e6ab196ffa3b24a42a381f4d5cb0d5cd6c4d23ac55257bda3fb59af15bf467f5ca49ad5f3bb28eb8e13f187eaa35002b9ebb2152965d78ec1b4c6b436253ac2fd9a164a0f1d4bf9c58a03ead4f6da78c93d1961f12357392bfd007806f22a12de50469f5218f38d4a4992c24db3f4a3895a6d847f4535285ef3ffde65db3caf0276087f666f18cc7d26b67c9cf6a232c1317cc512e3b0bf0380303dee9055abb579662c9adfa953fba0c18d2923b8e5eeef2c277ffa4e16515bd434305ae40399dbb1618807feb65753f86d3d5e05ed0ae7646cdd534d9a0706cea2aff6bbff3d1c0b38504dcf9bea8eb61f2ed4842ceb0de8ed035711836523552e5c94ad92e5f02117b0dae3cf0eba70d6423488cef8ff988aeef96321edb958ce82e994286533ebb11a8d0fbcbe2d162293d4fac59a287069f954e08591d1de8b10bb6a6b5150bc55864cdaaaddc7572d19d0135234cbcd5fc451d6a12878330e35c0dd4fbc553f1c7de75060c9cfb3aac81a1ef1e0825ff214ebbd4808389ef01d12d2ec9494f3ce14aea72a3e0ce1de7a625dfc070a0225969aa6119b64cf0155d6b83e0108c2b1bc36ee39ce658efdb214d95b1c241009fafc72bd2620e6516cdd73b701a0e14ef321544e811791da17e786c3a153247e4271a7122619627ac894f5a17c8101cf45b579fdecbfea1a2300ee0357cd37219de749bfc1ef1e6cf11aff47cc75d1003868e8b00e5585ffd1d92810b8f59b82821f9e68675c045731f818cfc398023ce7d0c2425992c8c21a2a42be2e7e99707a53bdd0e45454547cbfb719731afe47e9157775954dc1aca014e8354deeea5c8590ce9d33beb2f9ec8c0b7d8dc0d4bb74b76ed1a7dafed18af4583f149c43ef8c8f87b0ef9223ed27ce4445bd4fad0bad57480a5366ac562b4a38594e473aaf0a64418f8c9268cf2fcafdbd072942640e205c77766b96ce7949eba46fe9b617ab35f8104215c87554f845fab9f222d44e2d3e67744f9eb1ed701bd669cd4fc7be1d445d28a4132a2d2bb27767e7c6ae93ba2fc9bdf776f2d0d6543b21c57592c7b9c9853788f4f06fc4234502d3ffbbffd43bc472865d677d0621101537cf59080f248c49e420ee42efe60180d8901e549b7c4ed326fac35f13f8123f836cd0f1d2041d6d29ee57d60446b9676e69301f3981638cc0681d07bd5eec69c34ca09e8d38d884e3dcb0b22d14cdb12525855a3944f39146066f49a505d6898386a6d43c33cf9c01b3ce8170560394fcc44ada963e1464e85f5bd2a2ff9faa676289fb141c6d289832962af9d6df3ff1cb8ce09fb545db678d76f89b60cd1a11b6c77a41d74ab071feefd8219188b007c5f4e03b0c3ba97fdf4ce0db6cdd3c22cd26db87e0bdde7627f69ce4eb254b79d71845bffaac3b0b26aecdb63bf2095317e80f59b3bda0e46173b72f9c1b0d67a7619c0029fcdfb900c03567f96b320a53a8df985156e8f8dfebad2bb32242a154eedcc08be5e62b340b6c3f67b8c0fe8f251807bc225d22a2224a534ab168e95f89cfdd3c2f590f0c9ee7198fa5097ef51cb6d8f98d4d91346c7016a4fc015f869836ae134fa028ef0871701ccf700af7be105e255fdffe418a86892fa4fedca5d9da6fde2cf4baf2a207cc8ab15e95dcf664f0bad77a4cf355518bc2e0acc44ab2b78d357121dd353e7a4d600089692bdf917fec495fa5709b08f11031b490d114c93e9009a780c16d94e78bf6d896d470bd20f4e07783c2169cc19c49433afb763743699524b9222a33adadd4c670e0855439f4cd2acc3e695abcaacfab77a2fce5f0bbc2305b8e095c774edead50e21ee0bb34b4e24488d9dabe23cedc49898a62420facaadc593dac2ccf7b1ad0b25f3f1bfab18dfb671b15075b964895f9aa881df9643f49eb0f3cb30a18e54547ca0e87103dc4f98a8a8651d72a8f6df0248707deada175078fea8133ba1526078fd26074d7e10cab62b503908df204969dca0673567a5ce652d7b2d880bfda2be5fb0624e09b65ec0133009b556886337bff838cacb2b76b30755c7310f1480555ddf61b603e8a84f29b97e40bce29212e77a99df7467ae7fb1f19fe74e5abddf0f536fc63ed64da98b04df8a45e53946c661bb344f799f8c69282dd1419511eda116d537112eaa5548d8187a6df6cf856ba4f1508d598c634f08b4e13b4bce5350a0f735c475b2724918fed5d797f62ecdeeb9fd5b2ed83d678969271741e795fa5cf5eccb90840a4503d357835ebab5f304a017603ca688686868fd4cd179641da82346c32bcb83da0c721638086972be961d7e364c06049ca546fc4f27c41add6a69b514bf", + "aes-128-ctr": "8ecc1cc287e5e021fa0bc138f6163fd5606452082ffdf1b9f4c656de8575a9281c92a5b8d8fb4200390dcc2ee19f4ece0f8641f9db68d83511e8e440498637d666149502774db005b743908accbd33c6bf8ed0bb62d902d34bc4effed598dd09f0439866c875b0cb5344bb6969362f33de483ca0d6f495566c7430657307686e4d3d7d7e0ab257c4dc3a194b393c73ee51fe4345fd2b7be06bff5387fa0bb5b920e4fc40530fb166523c7db6b306ed420bf5b8bfd0e7e98ba24785e14591c0caaea8b681290988d85597a842720c9b5e1cb4648760c684c4dbbebe69d80e71849c9b41abbfb32fdae45709185533113cd6f2d79092c26a3b5bdd3d5ab0ac0ed97b3194d2a06a57fe8bccb56ab834df145e5c154af9d8bb9f50e9a93d1f2f1df0795e6ef63aa6dd4ca4175e1bde128b448e227efda93c4b1af6356b50227a7e633873f0f7ffc84cd57396533085f767366b28144f680a1ddf8d108d46620ce4495f01e9457b9af7c974e44fc80ed140952170bce7c01f7afbc03195ac60c4af4617a82bd7f2557fa520f1ec2ee58cafe30f2c70e3509e6ea2a8519ffa9733c48a2d7ee55b8dae19a1366b1cbd9db2205e193b986a8d1d50ea597d62f1b2bd5afa2e4cda51419d8732ee92eb9476721debec5f55d09d554f05bfe30b66a9d20007ccc899e30ba4a25b8bf32fc3551388e81541f2b42f288bdf31b336f13a580329b1862aa50851e642ce65031c150f707f370d4ec3a6ac64dd07acc937fa69f2a80bb31d05bf00eb984a31f8874c5d13e287734d96992dd383805e5409401b07c3c519069390d5f54a225de7f96fa40ad4b23b690d95190d32daee0e8c73f60bddf7ac4e6f782b764a4649db4258f1c7fbfbd314fd3bcdd1d8c604b4ac87ef2d3d933f3c0e3bd49c3e807e7358066b95a8457495313cedbaaf7118ccc2cbfd48cfbe1a504d39b6de847575094a82a1cfc0589b972c0c876c3d2fdde87cd4be9c06ab556961ad37e292db22cd06f177f17948caf2ca84b2c0ceff876760d153b8c294e3cc252260e816807edd6c493cb2aad9592486e40aa9e142d3d74df5b9c785241a6df533b7b3406c4767dfa3b5d476ec07908afb0ff62b2b484eb647c269c7657ba73687ed838d1dd83b75fceeb43665531cd4d595d6da70047ed3df6e44e1015cefa1d44a4527cf821f2dc70085728114ba5850d4133789dfaf654ba5db887b93a40a7623d70b6f4d617147d05841012e2a76d4d572c2e3a9d1bd1268b8640a5c8e5184593598c0d5cc9a6390e8df40a0810436878f1d8e1f3314da2be2ec45823dab636d11a6cb70f9f3237c5ce32c8b5c6c2dfdd9385e807b007b29c1bf40a79ba4f371ed5b885700e05fcbc010e067f37bb822c05601062f3ce3ebc782cc78eb0fc740bf7c73e1229e7691e336d04c5e697ea0e08ecf743a3bbd5a5b56d4a2d99fa29eaa5d31a94aeae678e3db2cb79ca88c8699019bcdf9030ddd966b4e9c384cc17e8cb257d147c5123ffd8f56ae992102c3ec034608af98c6286580ea424248c7112554a2deda8131ecd21a47fe3b057b5bdeb71dea98b176ce110354545210f8fcf2c98f36b27ef1a3529a69a469fc8de179a8773bb8aa36211a8d0978fe1dcf1830c377a6e5126d417f63ef2d3c755cc142a0c21917dcc3544e8ede9cd6a905374c51053ee6a0e19d7f6492c229b0257fe5432b0442caba5d71be67e1aa1a3518989d7cf59afbd7425ad603f11bdb7cb9546984fd6c51b57eaa2a4417f0d86bdabcde303b5086a1f95c5b7ffc226aee99be39be563ffb00e8ea1025568490b65b0a5c4476f4f30605ea6a43a7a8fba3f06499aabd43da223e05d7dd0e3a8a2fd84996e9c785736080ae6a6140436379761980d5bade22cef040c8d029bb269c64c8e0fa63d865c8b596bcd1b7e4cb8d35aee9fa213a25db6ccea4c3c94ad8ca8322af28c958f50268488d889bdfca3d9c8a9b59f0f210a8de48e281b7be75a7bde08e1bb107df2bc57ecee5d5b7d8c3fcfe021bbf35c71e7fa199b85d374cb8f845d878ecd4ca4040e316abaece9f75fccc5d8667b17ec0d3de2bad404b4219a886654b747271706c17d524c36eb230fc6a3bf4b5bccdde0a882769d9c0a71254f81344b9c025d77e3d6c66340f1330c7f3a434bbf5c9d2ae58b334d020415de43eae755d535347a07410c93d64b72864ae1783c244150231a47a1a0f0274e118cbccf5e8912be442b66c6e29753048fd09ccfa8b216822c9f25b5609d9527ae9903741af0fa3da5f1e4b9926377428eb4b063b8690981273b7b6dcc4ec98545a59902a4ab1b897b7a5992e1fc86dab09f6e9cf81393b9202174cd0455afaffb807707e19de2b1ada6ff05f228a0a50ee59bda3cd0d195b92c8934b5fe69564c00a033d0aabdc4cbd0b38ad1fb6ba495ce42e36e690b6032196a650fda6e93892a331095e711d6896896225993cbe68080950a7820ea165709234f65b71ff62b55ea28b53e9cc254b74cc58247dec1332066b055a3cb052933e2133a611abecdbd906544ad66d4ee297679eea7672c24a50bd022cc79cdd2d6ea31a6e5fbcd6c5ff1940e4e2a0f3c17fb654ee41c9607972a90e456be169bf31b518dde880da7434ea0353ca70be7888b53f7ff738ca0070cefde46caaeef4b53671fddbc1bc1346e59060d95fc610fc27850047becf23a2cbf0e74a98b17a0d018d058caa162800dfa9b35eb4b7c19eebc5d158ab307d82f5575c80370a7d0ab9e780e6de930c87285278369bb027c1328a97fea55c03a91c1ec50afa82fdb90a08c9edb683a4e9222bc1d9df146cfce78368310f6bb7549de19c7afea8ee7f52f68b4d3f9729948605f14cf2bc345b2b066feb8291c2991663c9d16f8f434281f03043b3655bf5b89f1720d57d8126c48e0adafedea8c0ef17c17f5d8f9e5b0ac0e791687941ac8e822759c570f5b7dc81e09e9b94da2e2d6c6cf7132c9d75b643c9e0b1a4b4131e52aee78c23038270ceb7ccf08ea8265e7e64c71ceba5648df3813152d416805bbd8d98083f873731a6526aed02ed2fb275d5cd741123ad722a5a02805ddc2a0989349575a47eaeaef1f0cea9a289233dc12a6be85da7b8ef848ed88db95c0ccb6baae8ee60c7093046db7ea3640f6cd5c981426685073d1d59105dac15947c77d4c1fe0e7bd3ade0ba045257f9ad271df4969ca54a39873fc590dc83c292435d4c9f5135e9ff6114a485bb2f5616da820d5cee003f8406d3485e6137cae4782cf7e7b47f4453dfd45bc45249f690bd5a83c597661fdd522f20c8e1d2c7aed0180b7b1fb4121698e77629c9954dc07ca1b4e97d25b3cc0a28e36e8dcfe7ae209cf6c424d2d87f158ccf562893d40b6c71d1087d88792d9a875d24a7094ab1ccf0c36c0205b4c5e7b12266b838397756ff502c755573197b47fb4820b134409fc31a37e1319ac9088c67f8e22f2774758f52fa3482a1ab4b611c3ee223298d929f35ca8e94cdcae10c1564ef5c64ba66aca44983bc7324fcd2187d558a8d36688c4854c772572ebb5d02e8bd345960ef952973ce4759f279a092794ec95b20fd90b1ba5a7855b5ff840230288b1678e955612a9def2d712e2653d760466ddff17c52fcd2806d689e8a5355469432030b532de6c9c6dd4626e67d42c0c5102512ef15251bcd490fa9e4cb0398cc6cc7214fe2b1cd0318efcee1c5bfc2237ee6ed5268cd1ea1c95054f7c37dcbea4cb719f92dde316d319693eb4b7fa2eae1cfb0847ea544b4d72ef1c639213eedb9cef8400a47247d2886763b171341c09e0efa18b25a571de29f31443863ea6298bdd40f6a1f36b02f7fca09343d6f1b3d42f2bf7bf0d3eee06d9c53a9ddad506e396bc0749e49a34661b3045306bc8a7e40049eeb0af914b7435d3e35befc6594277359d566ca95bf21d61baa70ff6e139b1419556bbc5e5dc5af974bd7e8eea53fc47ba3a731cea9fa3121ec3e9e8354c98389cfe87ee265bb48268ad7ed272985939d7f36b909b03fe5f8e3e371bd6878b9374c0ad0b8fecd5f7c48e773160abb27282c85a86d481cf715d7c385d5143eb727292cecba47ab51f7f91e0115988921f91a66c1d79d3f5e16c84e1cb0480e181b8752425785bf7443b1698d7ca538eeaa95077f5d684b69f80f6781120ee5dd42d358f144c1ba", + "aes-192-ctr": "20ba2943ba5830131d093d81a860ac1820f2ee46ecef5baa6284c04a02099ccfafdbd607ce0479183297ba30bfb1e72b2bd8d28cce7a4f6b37c8eeccaa284b4c1211d4b5f20801e51fce83f44e8f84a6665e4692def15bbaf7bb05e9ed8c99f6f9f8c36c353fb394b845bfd33d560a5f63a0f341bbab72302fceb983956fcece8de41f3473618584301cc723a412127a84dabdf07e6b32822beae5f7b0eb6d4615870e38c00bea22f094532fd5828f6609e087e45090482d4c75864495269a66c750bc0c6d9c0cb438792645b2ebfa457b4fb4e2e3f7138f33fc1f2939d1e13b60c3770a9b69f4f19703a589b996d081c4732907f04d18c492551785d6a0e149200490c3d9a62f7e032871bbbe0ea4441e2dc219d232fca6d5183e1b650f36e4038d667d92b080acc50ee5e6494e46532e6e491ecd80c1bc3bd0a70859233a6b35c5fa4dd0ab369db3b79fc0bd684a8d8c8a671020c1e2999316586a61a2f6b2c61edee66dd322c822690336c63e8c269606f78414d93f0be051af725e01c4f63658ac0e2ab482bf633f43e6e7d626cf2e510137afc089ac60e856f995988d9b372ad11f0086dc176bc4e6c3047ebae4df9515f49eeeb0a3e76edd4a15fddbebc79663776f867adfc72dfbfe0da8e55719ebbb7d14be96f768428b66631ceeef8dcdb92404cceb7b6a45749649a89bac15b5a3ab4545593412fc8e59c2139e85b43e6644bc1bcd84d1b4886ce6e1a301e854ccf296bcf7f8483dde68a7159b80237e08e09ca157288e1ba3abe4f2ac40fe34f96a209bff49077fb766a5f94f3a8814c1f883c0e765c4a24793470de1ed538cd1d6e8ee69afc169c286da2d92ac0a77818d322be3832323195651567594d68dc75cea248f041dbfdde8b03a839e3c8ea7631c76ebba012ff145cbe8c24367e631add8a0c23ba70b7d9514a3f57ecc5fe15a0ed4c3ebeedef3663ec55b7fba1376fda6b92a36001ce4c7ea7aca952d8cfc4bb6955a666026cbdc3fb8db67397f5dc2da0e0d6ac1eebcd5585c21e0c8cc0c4216d6b308142987f360198150cab07ed0df834f8cf7b739a33b8655da3f6a9937dd2e562a7604f6c00d8442a792edb8d7f6d0615e0f20e524b7245752a130fd60594ced440f767348e378fb0857a8eb7b36df2e85e343dcd1744215521960ade7d3f4bb828b700106aa90db36193fa345c3ce2ac47ae2585b62c780a1e8bec384f5f6ea953bdb43ff41fd63ee849483cd0ac3e0604958904c328a16e45342fe3f2f3a4f29b768c76c58e3b4ed0e31b1480dafc34c53493f7bd8a0f4bd4c6ca646cdfb315ac65a57433c66abfe3a741aa8c101681c1163f87634dfd024290f2f8562f3b64e5511d55fa4350e330e17df31b01e2727189b692367f4fa68bd0cd192541b2c06e87b66c0083477ab270c2394d501070fdc50b93ae21e4bca37fc1370394fd2fb00aeb80b8db3d7a8e98dbdf9415419feea250bf4ef1d9e4c33d859a55c5e6d6e3c69e65f16f2a1605d6240c7157034e91d6e5e401e7ad555efb3409f3144c5bfbb8f9949ab049692d3b5b3fe6f013e929e42538aa65e12a550dbff01d204f1d34902921686ae3e387b546a2c78e7f21e18d4670a024159d43a40c99b9a9492b74471f503723683ad5cf354b5110bdd8cd41438c6b2d4072499fe5941c7c0afb4d99402873f9c41fe3104abc499f7cd99eff47e296ac5a4f6f3f2ba69849bb2650b6e4a546dda0743a4cb3fde68f544b87acffcb5ca61b4fde3c59bb9449adc0eaf9db712cb4a8cbc4fd37b95fa52d5771d945f680275a723c51579a5aa694f86bf85d57430b4abe66c9205fbf5bbbaf3b6429ce7db5eaa7c36d6cfa59fe9575cf827c921db58dbf66d91fb287f55dbf1118011817b4f2458ebbeeba156af14c197abc158383f9984c7f9fd600019b12ea5752bceb887f745bc6bb6cfa3e919cf38dea22863de14c956867e3593c683cb84f5ddc069e2fcc76f61b6a302a22efa9667bccd5c407be867eaf3cff6cb10223c116bb4a7e7146aa5da6b6a4fce1b2c014b43a0a53a92a64688f5a77af40eb81e41024df9f76d13e9bfc0f65ceb2a35f6ab1351fb905afe236244174260e8991d2cd0fc2a609d9a17f37426d234a3b1a29c35d8fbc8ee60f2986e8bf19d82075d796dac8ceeed452fde661c064ed9a206097aee4afa5ebbdf39697c384107ab89c39f91e587bfac205ab32177ee31e9b23daacb80d0a84d03a181375024896adc691297a9e8c2ac72c52e328a2e683639fa8e1a64876b33604f7d9d88d402dce0ca4fd6e8f8e1776f7ab3026157f61bcc96c20952121b8bc88e1bc2b4835a9aff0ea03ee7f7a2bc093c8083b0cd534a9c313d1069a0b726d6f7b1416e63d7a6c452073b394a01553791c27d627c5d77f073ea17d1cbb2fe47c9e6ec27deb06d727959c583f6d3ca867caa020c7e95b99d590e5020f9f24a8f9354d7815e5294d023d3cef7d90f4f757dd618279053d05201a0dc7cfa24435c43d2a2cefad45fcb38aab9c5bfeec66ed21fae16784136d0cca566c18dc318b342df8323996e62d3e4ac76a2714d25bf0827cf9694f1e0b46981e83ad5627885e6729c09465b96e513ba083c9ffabff828d74cfb31a6c729a3958bc8ff4576e05ad4a74c39df658888489f107fcd14ddf6e073d4e0f10e5db56ea5fb4ccaa95b8038222f8c76cafecfde495e8d81ebeb25ff7f2568fc7faded1fffa39456cf829fbdd07cac1854d8eff0aab065f95f84005e0e7a9021b121a80524311de42b592dd21446f6210a15ef205188d5cc65ab1364c96fa9a36c9b9d3029136f0bff2f1d54af8a5d90ae0d0dd97bfbd19a0b94b88938ec379bcdac86b5e4ba6d8834d76925be97cf5b81c0f242cf8d4b5f5004fadf58eb0594f8cbeaba9c1f084f34b6b77e3d51f592b54339eb1ad104dd62c453abe5bcf2d21ae1e6d3796c0b8cc0cc71923eef23b5c037d7cc05bc9289b40f38fdcf68e270054170d90c8890a07c651a71a8f7a680cfefde2403d3f7dc48c30b45af106a4b12244f34c09483befdd6daad472b392b2322140ee3623717dc996a636984986e50a3ee92bc3e823d9c637067c0ef59ef3dadb4d5e85831298689589a351ebce97b6456eb0f823ce76c081614477b3bbad2f2fc0daf7fa4ee307970b1133e35d7a28e16542aa5f09d2307c61c82ac5d577f1390442963a439f923dd947f005de7c50abf1827c8a40a69e6b731b80d468ca6d1dfb0c7676af7ae161556d7ec15ce6c123d46f2f74156c318b5b277caa6c756de481a92ff1a5798313521a24ad2626d273c3ff281375c73be83718a21a3373e4d789c503216ebe03bb40172630b1eb2ddd82c1f857e4d9d46b4a23f341cf761ce76a6ed86406c9d94a259513b2b8810136058d7715343b002413cdf5f6c346ab78a0e8bda79afa55ba263e814de1cf3c047ad47e1c1994fe32d9abcd7d182a6de893cf7bb8828eb1258e55ee4071ba4d31b71d0c0ad7494c6244536403008c7d4593e03fdf9c359fe5c841155f205ed1d469a24fabf9cf749019d9fa8373c583b8794bd5ce94f8f9177796d59a51421f51a77b2001a18c3dccdc29606b591a6eb87329a2ce7e185b8923420dec249637058c7fce6ce858924d10ceed830eb26d31eb953056a39619407f932e79bd6aa0468e79cbd50b98b1684687b9b7ff4856c3479f67d702e8dc36f5b9ff58db9e32040545dac344984b1c2a5981f3a9f347af9e2b8a240c2c67a0e03fd6a64c52d6fbfd102f756910486aabee7227910218c9d245f49811d2ce2e9a4feefeaae1c8b94236c3fb7f7137f64814097e2daf200bc07863d68c790346b54b6a55fc5108dc341d7183bd2cd6b8e4edfe63c9c168769258d79fb362965c2e58eda0f5e99daf29c030f84354365a7b6ff44b9873afafc33306846a4a52a3f2c8d369e3872df49c4cf73b89721bf4c568b1bc05dea6272a97789610198d91b8b3e16ca8ff72ac1884d7973557610339797a946c6378765b1e4148df45299043eff76628e99d0b74b47bc3bff4d2363bc713c1be62e46bb9cfa4053a8040bab9f4d84a1ab9a374904599a11615c1e1436a1f3e2ddf916b5abae4d6af03b97261ff29270f0b8b8b7a47f7ecc2c702dd6ebfddd39eaf9ce229c12d68ea2cb647fe268e0132d39eeab5e9d05fc", + "aes-256-ctr": "ada22f724d28d74dc5591a3ea915b9b45a3efa301064ce54819adb110fe0a05a796ea18881cadcd4f4dc86800ee8813919f23a2f496773b310c7932443a7fbb1b864736ee637c6e3d6d735d7120b5524b216bca5566a06bd113903106cc58ca4d02348089a82aaa8b1436ee8604bcad05993b77bef85a62d0482687416d331c213550c1a922323014440b1d98e3409cdda6dc14e576e0d4733d36ee9ca3423c12ea7ea14d27b169be73a7f20f20601537fff42fb9028280cf50512fe0fec0cd27e95bcfe55dff70f68d8c07f2a9fada664b1b2b4d0050ad2d6695d4b11154e2a1426a7bac2ceb56fc4d9dc52ffd76501fee618cb41a38522858ee5e90ba9402bc00988bbe7a9b0cc2bdc3ab73fbfdb70833d099654aa312ff0f3864d8c23e54f1dcaed35ef75134b53dc7e9ab5321c331cc52996d36279ae251e93cddc1732f6e5bfdd6d8b0efe14a8d11832fb202a6a523f21cfae836a6251c2d6273054e5f30665f785f2ebd45c318be73a32c1b30138a33605ebb6b37d69202eaec8979debb910e31b0b4af2989f1031bb6c19011f0d8811ebaafd782cf6c0a69fb0360f00e1581d9bc53d77727e02190848033a09b1f7cd80735d80a50d2635cf95fc9efb5e2657fc40bdfe827937ec1d542c36b4f168354f351a9c50001b50e3d23bc1ffbde297fabab9825c333c215bb1e418fe2728cf1e7e690350af716b69ae302392302d720228d978ea1c75f7ccb0ffb1a8e74ac0e30da5f33e678db8451baa33be8a567583902bb3bd9fa7c3dd513cd1619fd2ba193917ba48b0fb7b8d5c2c1b0f5027a7888f02281626d9fbc9b77dd89fea6995dfe1c33045dd7d037ca18995998cbf0c0b26df19754bae4cd739cc09152171f9fe035693b165b14ef9dba66e9de2a71975ef957f7cacbf98773f5ba840b27354510039ff12a957ff1ae2e113079079571de307ecca6d838e6d2986e678fd20f9a20d5cff27baf28ed55e951de7254a75fc0aa79093a7bb0fbbe21b568b219189f75b565f2dda14e242da8fadb4bf4f10bf79fc8cc7b2a62e01068fa2cbea7fafff3f1e764a8c55b1fa762aef2de882b14b748684870347ee4d59b94eb235e03891c620f97277f43cf599d6e87d3f895af1b4ae4bb7ac7844cac0b3c10667203e1f58365bee89b66be43db98099b34479b9ae942cab2333256811c1ac72ad2d82d0b15a66e5c8d6d30dfa44926e88fc997da6c4005c9b941b79e3497f25276c8ee04071c4658ed1a1e20d7326205a88d95f28abe7504dcd8457fad17ad5379a4dbbcabe88cb4f83a57aa920973933834edd318eff8d4d4083365b66364e029db16c984106ae5cd1b0fa55aa24414de563233b1f258d6ffd27ce776107d1a709adc30095c86596d79fe66d9525389fe4737da104cad031444aceb575fe5c30b108d32fa513d51c58d65609a7ada2df6c8ea8c7bc3386d51cf52b197fab414d5bbbafa0154b4dc46aa3effc68c82778661b92872538b7eb304c42a449d05f67b7a52be0d7f492de54ffc4b7cd7d70c23d26b0e943a68d260a4b9229103aa563fdfd32bb6abdd4b7a7082f05435862fd7d036418ffb5a8d67c7d448ad4973053a1bba11cce64da52668669c19d19a004490b27f1fadf76ad7049bfe3eb7d7ef93b8855cf181bacc6d24524452e5344e8f44350425aba6aaac32b52d352900485b9d6bcb6ce237456d8fc6f8770e15c63cfd09f99f47c94cbdce604328ffbd8bbb1da7854bdd8713612ffd03c6715c82a2b252bf0ccf762f305b747f5983f49a7381f954ce721c0f0f329843aee889658ab63b7212da7331a50e0dcfe03ac31ba81e708cbcf648864f20774cbc5a8954286c68177625d52f54f2e4b3a58ba0991e13a6c92d850082e2e2f9a59a30b9e26060c388133445977607239fcb99fda4f419a8be7b84f8fc47ab4f613501b164ea03a13d06fd80b0d3074655c9669df1952be15c5d7a3eba98fc49ac0aad5a16f857dc4e3fb8d2584cc7845a3a0b00148ec690943c988681a637ed2142b792a09443a6370caed238439d2a6c2dd87a853bae6d3b64106ffff8e243155e33f15469265e34aedcdecb1f347c21bf98519e61337b2000320c4383f6a81cf2caca8ba674d51875ccfc71ed30dc9faeedce40c5fa913df530c0952a98efae81f8aeb9e71c661811fc9e9f108f7f90a87200e2cdc9709651e0bcfe43c51c99fe905d9d58e7b5ac521503d89ad3ef6be91bd3214eee3bedaeec9caddea192cd17e054db449dc4c5fda0500820eedec0db78dce64bccaf156c54766d864284757077028cc8db14077662e48c3ae9fe49003e1661df66b414b19e93538102643edd27020c86745829ccb410527e1df9da1ad4c7b0eeb579746f402dd91f4788b55e0cec5ed86ab322c373619fa0a0e106656aa6c48ff931feb85ca0ba756795e3b2df9cb205824d43eee62f72178f9f8a46c4a072cd907e15089aa8fd7a334de7eff4d77e4da344ede84614b7859a52ff5be36cd39ddec01bd9ec64893666d3dfcdbbf42d494eb0e4e46caf7ecf030a6b0c3827d4ab6eef25cb57ab040cea43e1cf40fcfc687d5b7af75cd0f95c90669b31e3626701fc265f4b62266fae9f2eecd6f7517d0e483ac362325ede703427ce42e77ff17ef63905d9ebaff418ed67425b00e2fbf21a080c54ca30abfbf6ffdfffad00270625b962abd3fb13a0c08c58229f84adef27ee3ef0a3b592309c44b19d43eeac960dbb3d1a99c7413375ed2ccc18b13a582fe1379276ed2ff41e69bac1a733d209ec8535ea76badfcece3da75053a5d69bd6202d198bd5327975bb9a6f31cd30ae5a09d1318af531b60ba1283cb65475a1ec47c1058a719a8663a8975fe2bb9c37fe300bc6a43b26c040f6a8397051bcb239dc08eef271dc5125a7dcaf3f04a871d077787616b60065ad90db31030340fe60ddc18b442abcd9db495671836498d4b0152a4bfdbd1d977eef9bf95b73824d0b17ec29f8591b08932824dc3ff1d147dc146b1ed6723ccc27b715ca60d9f99aaf73adf977854e10c48a0454be3e58702c4b0e01e8fc421e06669d2c5b621442fd36806195d573e7e7566d895aaf1725d7568c0b688729b89c364982772e9a9bef54aa5f0774e96da924fe54580c4153ca307ab220c639d6d479343a2d5248ca98e8be56d096791677a5a8cc3d47a906c7f369174450de9b98e5d1f976f29266097ec3e8922aeb1abac34cc162a1b779af8eb455894878ce200cd526dea9fb122c907e08b3dc47e43639483fa5f4cd96ce2ee151cbd2f40beba1cdf855db6c54e60243305f9560f06233cb86cf8b06772b9fd473609c207a93f548f55ff7b81bc6983c3ba01f951a531da4348bf3ab9787d29ee50c87447e0e739c4dcc23a85d3fd7fdf8cfe7083688eaaf4cc5e973e7d309bc1041d14966551b2a92d4bad127ee680b4f29169085869fabeb5278100e203a379c0f24d112286ea677ffd6893f617719e2a0dc61ff471065a663e708e4b975d2b5bb76ed53a3bf1ba64606f0917557fb03e3c76aac300098d1844f82f2d51d61b04c88fc40cf39af453f781ee3a98ebd1bd5117ac901968d989b7ff7bb865494875d3b1fb7b106106a9b1ba6d95f02dd976b8e93794d51c5fdd265a446a95acb539f20349a136d1c488cad197d2706de1f5b80dabef7d4dee868aa0d2d45f8f61b7fcf682e5d5c544048175d4e2e7a4006c194fdb1281900fff8508c3c1984bce295a2ab51bd747df8626a98664a2ebb449b25046aa76ce19440a3cbbbf6a359b0e095a36ccb6c46d2af216c1aa2fd8fbb9293c95e846da4184480b833237d206705ab24db4eb8a10c14fcdf22d094a8c24e0d66fea593ea9220e624610a7bf5f497cb50ad52b9a9e76c61931596cf287055e4bc2b0d944f2930c7e0580a29043683b4c3596cbc0d0ec095759354c91b20e55a497d33c3f300ae5bc48d18bf7bf359b30e93da7343076bf0ae61d3870a705b828920b6402b6dbc34f7e0fd735be3dc30c4a96a63cdbf7736b6c2df78765b5c5e1d874d0e0ae2922aff0e1026d096310a7813f6ed45a3b8a6a53f77c1c825325b6458c82e7865842bb39de3e35f867fdd198ed3cac7183286ddf46a4ee541eeed06393f8c1f27d063f2422b98101ab9e0bd455a631b0a6283cffabd4270db724b1ed46df397424", + "aes-128-gcm": "7900570231a4e405c8910d3ba09a2e93b7740eb90b12a833b14337e9801abea379ce7a75cf9ce1be79738734ffd4bcc3e1080f51ba6caa97a47a72df907820efa4054956c487dc1ae1bd1693e81499680077d51205a084306d70e680a40a7655895277c23ebc77fc7f7a4314802e4509d5cf483752bb9b7404cb8bdf3972ab11a0cc48803220a9ae8cd178cb1bd33311153394f08a338e32f4cf3f68763c73ed1883b0f25052af73ddb94333772688c51737f48ad12318648600743cbac1690c91af7392cd0adc2cb8e09d41ee1cea02f25157edaaddb4ae4bcd3c060bc6d905e2ebadb6a1b0b5aa1bc12917887c810807ea89009143bd0e812badee1108d3f8c831b75ad0f9d9a1f313b867cf843be6bd6dd7c596dbebf64ff571b6d37e2a227ca6e23adac02c8dfd0be67c12d89e932d22a7e91019ea98022148ea0b155926243edbce12d6254d94ac31fba67e4e6accd23d0fb024a397313009298d66e89f0080496d8d3611273c770dc8f4a5d128acaf821b0788b4f4d70317dfe45ca3de9d1a46d78d59f4b0522c7076b59ae1fb2eaca9682f1ee03c89bbe5af93755dd4f75594925171e3ae1e5601fbff5a4dd597cb60dbf28e00bba8f0d599a05ca77a83d52a4aabaa3b9c12db26693164044abe51ff7a09b28f5ef29f1124162169649f6e3c1db450a97cfc6b6c161dc2d8e5a4a55b5c472750aa4b1ab0a1786cadec9ee385d7346050140a29b1e44ccb38d12281806de9177bc459571d1326ede8475c96bc73f5a86f35e156c96188531fea0332a00a3aa19a268ad2db28ff940ac1915d4ccc3608ca38c0d179b8b7d3a357fa179777c205e1ce9dc7cc10511c5b6e9ae8f3cbac5e45768b3e0fef1e5cd230b5c4a88358459a8a37bb0cb9eb6d60435275318c1d945383e1fe97e601a6615b5bd55f2a90163003d86c9ff254934b3afbbd239c498c625bc6e670a83a366f96e762c7c5cc66c7351f988341f45dd54f49f0a5eb3df9087a7e9e504b92af6d8a185625d1bf6ae089d3d0b41f8984b3408be18c1b70814c391566d5059519e7bb2c374f4591753fe5d0c55278ff3513f081305ad5b055bd8d485ca2f6a10b23fc96dc1ed45267f9023217919eddc0483fdbd8a23acc1f590754f650f4c0b88dd451f027bacbc60deb9974656be81299dc904817b8de8bc08fb67fb2b6bdaacad4c853a254afa12fa1f0fd67c9d6abb6e79048b2cc6b8d974c61ac3ef323510ea383765c9e2067160be44badd4117a89e83d0244c6a87a2d89a6adae0cb0da82de8d54952d0ff320b55cadafa92015c218e3697b7fa61844f5637e094aba23e857ea971747213dc63996dc0d6a9e7157677d07f5d92438f18c50d999e341288172806a72f79b61fde245b379757f8dd0f796c3cc5ccadcb19bc0de3af8335e94b50f88ede0fc835f3fa4f7bbe2fdf614b4b50bc3b5603b5a4712f6925e987d661cae61ed3ac1449f19aaf0a3b4969a4eb5d89f0c761cdbc26ca2a809cdd625ca036aeaa721f6d24305db3a02853d7c579440ff603eed78a80238ca4a6c6eedc98039df13c5f13f437f723bee4704cfc6be7338e9599033af85fa57136ca640c4dc6f5eecf85b38c67c32f9e634cb78d804470f06fa8b7c27ddf7b83401b8a4322ce86fbf1f077bdd80590487aea5777eab3ed9c5eeed09823a2df7b8cbfa7af62e125a39f74022f5ce3a0d04c9a5c7b7e0a85492ee86bd504ffde2b76baa825515c476df864c2ec69c27547551f27411f10bf4e5128946aa82a79737d0ff2518f70e964496019c1810b2bc99683b77512928edf62fb0ad2c9d94189286500f2a817274411161156e370b3b6a75364d2cbdc0ae2fd6a7b5c241b81b44b0778c2601bc5c199c3a673ad91b7112ba459d32e7894656c1388604e3aaf6a72cf0d3a230e60096f96e2a226fa54880f80f463b3dac6d2173b31dee34691a71a0914bbb2b8c5f6ce334bf9ece3126bae95ce108d3507a3577b0590aba8d3cf5fdbb1831257f9fb326c44d51a49ad242dfe613566be9c6d17e05ef59c525fbf02b8f668fbc91a1db2d4c4ee538a36ad08cf6358b7d1b7159de8ea3de2c38324aa4c52c0d5653bf04dea3dc0b5c3efda0b7a9eacd44228d2410336a7c0f8351a29d2c1ebfcd900676e9c48aa3766bf95b739d0d9d61d861d2eca7a3979f099874bf81e74f1690802b1562010d369ea355706df24acad56c28e921bff5d95de26b0dfa4205e5220ce8ed9917fa8e4f9d3f838bcb5a42d4def31f3b94fe384acd88da5eeda437484ce1d04243baa6a8e859e6bc1cc4cbeddccb141b79eadd183eef6404b79551b7715744650965246b88ed7418ee636cc41591bc6aaaddb755127a2a704edec93db6f711a002c6ad952d8c85b4d503e5f5785cb4b3511f33fef2eb1b2044458e8cb3f982bca2c9ccd1dd1bef2eb36b07880e6e9ddd09676d9e6cfd56ae82bae2537d564f98d943be32eb8b77bd64a86f53521456b412d8c3ffc2c7cd964d63e19ee2d9973b87204f8b8b225d35e46fa1dc2a8cd3a79ce3b2727df60253cff426424449a310a407453a7a4d9d0f23dd10e20e6a6ebede6bf7dd0279f48b2045848161735aef6942e68c6bc22dc561ae5d731c9d3463d2432b16ebd4d6542e7014000ad4851cbf24e65dc4b613af42c683857c4062fdbde44591d5e373ee8fae2230d94e519b3b04bee7322b94dd91143df23a7a053f68016f1fa525127f747d6dc5120aa3f2e040767d2a0429259d2ed6b3ae976d8bac6549c665ffb50574abfeb948be39f21e4161764cf19bf56dfdcbbd9cf97ca9d30655f37b734ebeacf01ede407449dd9f4d7557d410691d8ece6c5fae8d0add7209a2ed9c53f800bc1ad4e6dbfdd8fa829b8cf43c20158aa06687087146fa6ab900974b9995eb78ec730d34a5a806c9c231669687cdab0fa969d2f037ac36aac2f343c99473408dd38109cd665367e208ebff056221600432df1723b81fd0430a5335b13bd86dc094f94349cc46b0e39abd29cac44ad8b2ad1686be38fa4c6681ca9970c5f38363abde49b99ebba75551bb888e5498ebf55978882b58fd509660cb1ca343424b479a1a7003994bc382afb28d8b07f209c859707e4efbd77fb57c324546c34eed76166c89555633ed4eade7bccdceb30c77543c08efb42d9295b087942d8cdc3eba715916b73ae22e02608e423f2e441eb804f2891ae20a44bc112d8310ab7bbd7015091eaec8c63af3ebf819ada35c54cb7d66cffaa4f6c1ec6ac34eccb23abbc9cd30db286c9de82a5e4b4601d5e74866113f2429d2e65ba1ec063265204bd75d352e2b7833518c79a5d7dbe2d76ee61a473b515b2530fb5989fa6ddd9b083e64ce0484c8b96384353893e3aa37656bbfec952081c992cebd5813dc9efddd5b650d336f53a5f607cd749d772dc72941e7a2c3d436e00d88778f0f0b3fa7067f9dd8f0c8f7a77df82bc7f47c31e711650f674e3dd79e2464edecd93700c56b9c8d06fdf38fd03bc48c1d2cc023062a57b5c71fbe90a2903b592345af9c043296ccd542499641664c224c13b790e3adafedfa9ae14fd9798f936e82de21b6ce9a14d083f9daed7f012c3a4ab15472be95acb60e5b8e9a85d24365fa4cadc4f2a6485db9620e124c20e0967678fcf0debfaa27aef563c67a1a75b369412966051097119f40c59cd48be69d928e5ceaea24c2fff6124894fb2999b70c571bec96ead4581c9d79a36df9078c1ac9bc2c90aa039387d0adc6b52edd65bd09e66bc63b5814558b5c91b32e749ad22c5847fd0fe07ea99ba6467953f9f228d61cf3dc2c2693a82e2bd594f8dfeaf76fa7384085f7c1f508f1e187002c6c8d5dcac8473afe49702a1ef528f344f372323b2ad5dd739fe3228c7aeea715b0893bff4d020c5f03645d8c4eed3a48fe5981331e8a334c1f53876b2ea8aa091fc865c01ae821224d28e0a2cb232f524e79b6576b1860f8cf0cf235629c7bad0581301782f82feff1196ed19dc82c2c93e8af2dc2e06790fc6c283ace3301ac147c2fb37714169220ae15e247570f22dc269f46c73ea73d285437d34bd2640861120ff3ad26650d39fa9e5eaaf1ae7f3c5db688fe90585b1eed49e1eae65d02a469ee4ca98efe20855f369b1597fe6af1aee1dbdcd6570ebf3c57d3ed26d26dd83be657b397609260", + "aes-192-gcm": "71877f4afe1808b64822bc063291574ceec04a95882b8039541bd4742936a46c469c8241d2aff5fbc3833b134ce6b5933fc2cf8c2a4302b2ba3927dddff30ed497914769d653e9cb2470f178311bda074cee9dfa94fb2003b3612b533ca25783ab9567f122629462c431d9453d3b4fff769565019becc7228dbc8f97e23618715f121b547cd1b17a5128640c06b7e9b015be5019bbd33533d0b8e02fb6afa1c9ac319b649bd483ff434d1ec60a86aa8f21ebc7a9003a7eb76723740b1b54b199b36870fd6facd69356b6757d868ecfa646918507b5ac2f27c646f27db0b994cd76da3c1c72cbf00addd69f6d17751c7c668c05d91f80a818fe333a8e1383ef3420af21c51c88b6cec7326ff61e9fa44775467245cebed884cc3ce54dfbb716c825f333ebf381c8d0810a16945f7d01eb1180a3b5fcd54a0ba5cf594261051b61a316c5288f77090ba2e044fa657d8eb3294e19692c728e909ff55e08c1fac2902e0cc1d4da2f9ceadd7f60ce33160d1b1fad94fbfc9913917e87e636bf49ce2c6fe283d08509949e3f6d0b0bc9bb4c5b9d79181028ca8301de80816e676b296fc991d93e62c02f66b0f3c91ee2e2d2d699d47aa6f3bf871731f648e2113531a900c7a382519ee8e0a317a09ec5d325396316de420455c54f3dcbb48c0be2e8fc58de1cb276b1ae8a7dc7c65c9bfaab7b9cae2b56510f195c81a28d0d512247ae30d1e91bb80d9237941bab67857cd58dcbf5f5eab1ec01e93c768552403d16336dd3b9345c0b63771aebc892d577eac82fa71949de2330a7fcc9334f8fdd24c96d0d2a40cdfe7ba336d5f716f64f510fbe34bb82eea8a3f819caba0c0f4d95b70c9c69cd76b4d73ec5f13078ba0e36c17b424e776feca2717c3d40434d57a2d53539d902083e4ad04046c2f151ac53bd43b209d77a43cfbe3dfd27c214ec28aa0ef5069f98891a21ef7f0c8c6efb1c2a202cc6b6469469ed917c41292a7f09615b0bb3e3804cf0f5f057a9c8a398013c58ada9b29b946b89e305789b61c6d4410b003809462d34322c2aed4a3fd5ea0ee2804ba1208be55eac67e1c4512389d042b7e5990eda776a1cbbc679b398b84a04950c4314ea96eaa3a13bcf6530b4db39a07453b21e3668424c11b53a78270df26f636b9807db75876612c5ec1b0e819fb2f68c285d1e821a65f12d065c1e09f6f529d3d0192a0c58b2aad513601dae29336768511a8e40f0731b3b39e8cd7eb33701d11fb1d223bfde029cf97a13b9d130cced20a0ba4118f761eda6412c2c9234c80d46445e15aedd791bc7200cbec7b6a6f93f8073d620acad3a85705318c3c19316a457614e838b75340eb29a3103188bf8c6f27837f85efe9e5c2efdb2082bfc4bbf2393b6a9755822d834acb7fc1fe7e34e6d67729e48a42172978b338c521a79f44a3030fbc8b17a940836b8da2013751cb4ff6a57bcc752af419da33bf44a3ccd941ece9ea4691b4f20fa8f0ab423f052cdd6a41ee49c2a6f9b15275e785ddec20f60236cacd9911bc73c8a9b4e0688d6dc056ac485d83b9fd11ff89bfd2201b0d791a2de903159cbbbd392eb1779f3ffe70d92afac5d6983551588d447d66681949072ec99bcf6fa688e766bd209de4081f903bc89b29d0d1f8ad16aa758390271b670536d786d8e905e9228858d34bb0e6d50eae07c4e79a542595e02535079bcd43a4f5338f91a864fd24049e9150e1c10afddcba0a937602d65abbc583beec64b5aed14cde6204ffd6857917342b1209d7c41ce5d1046a5e953551674e7d51806f8e3c8bc03a414b84c73d5b095ec353f8687f7817918d6f61f6f7db076ecf7dbd9bbbcc5583d44e6b757a9c174c5add0c0907c7dbc20c857bcea79970b25c3693ace581651072aa83f88760fa7f04d69a7e3d51154b6c0b91301f30d33fc6d5134f7cc6c0c7488b717b5623c64144b6f11ebb0c5ec9d70ab937241be8c96a3d39d97c8e076fd3b88ca7367a71a9d1a49c3cf8870386adfad6cc3c635d9cdd47cce7fe5c3c58d2191791d3858517372a6ef9a6131fef64158769d5ee4162386a72fbc18b425105db4c8fabd9a29c70806aef46862f3dd9f2c0516d2e3551405c1c7f652dae6ce901d04b8b2f2da8874c4b4823d7ebebf8f41652fb2ee4d70d0f690b5b6e56d05602fa0ba4cc00d3e301bfe73567d9f8dd6f6957d4b4ea66f8e22d7aa38562ff3203fc1b1bec3e12b30b017e7427acefb401c863b93235e314b3b3ff59c9e8a0c0393bdd3d82f57d7474df40b0ddf15a9cf3f4d8c4c6a2b76f36f4a2b6b90025d3269f3202ef521adae51bd0df0068d8cb7cdc0b5cf1a5010e8850965e5b4e7a4120b0190063f1fb4d9d2d7cfacd75c27f9ff2221b72148e1de60b056c2cd2525acde3bf937863cfa3c9003df5c22a11806f2409de7be71cd3c42ba7723b0b81d2b48a22833dbc23e0a0ca2e0fc1108c70c7501d81ad9b35f1e27845f9101168b3f2a67ed96e531114c868f39723471dbd41a3203323e954ea6993729723021e9ccac13b3ff0211bef3fe49c6338dbad23b15f59c46fd39e34167f6475bfca67bed155b04b2f7657323a5f15483ae88ca6adcbd59f559e921d14a880542ec9347654786152445b5c44e5a83f36d5ec8c6477c201084caf238f8b276a156fa537dbd700c02e9822072982b589fe758936174f9da45ab9e9454346db13a020cb9c8bc36f2e0f561a56aff8363323366f2a0dd80b186be3f68ef8fe45880af93dc902bf83f6b2480cff3ffcb1b93ad2e5ade7e0f9c9ce7d3175b44ed3ec0868fbf32c79ccafadfec1c4d3457de8edaaeeaa5e7b834476438a7df754cb3863bd03200cd0c11d8e3b935238bd88f08a0511997757f8b7fa8e3e669f4070e16b1d558d2400c7d3a5ef8b1e7b75ce2bfb5583e12b704dcd94f50d33503a8910139709aa4385df9f068539be058781fa5a33b0cc813f58ad3e043d10780b35bf6f6ffe78c9aa1bf7051211b4f7eb16293148c51d3997956815db1066c22fc1a9f86dca014d0353967ee140cd3797a6e261ecfb56b15811151c77af23ed6076ad7b1492714bdde02933fa2b0ff098138d86fd26f49985a8c92baf0f86f32cabc7da3313470ccdd2d22dfc504aeb170225ee1aac8ab6613cdb0c3e531bb74585080d12b107a9ec342f021e7c0511ffb209b508fa6f0ad3d3a1ce4bc2df4b32b42e4ef6b8fde63d516f3184d0e292421f07ce0b28a3d0deb1070b60a70d5a71c2e129e82d90e2b73f7fed63a3eeadb387fc3fabc37113064b2e66025e02f9c3612df92eae2b63bc76a0fd4742845a2391c4d735fa62aadebc81e346dd2494a98341cd618a10172161a6718dc7a2cfcc21cb17e120e25f58c3dcb9942b59d40472143d5736aa4815e535e3112865e796474ea9dff37f7254d757f05a6acc158c7a89b6b9a1bbf5ee1c1e53a72cf584141b9208755f9377202964a457910048d2f74e90ca1ef297c6d8a2979f713bab8117d72ea24e185eee574a88e8b6302640846667371969f9d995816e7585a385744fc94a1daf5725dabfe80d0d9d9f5dc43b884c3ba32932fd0d065a3f29b2c77599be85b8f8ebf39b35cfdd245f1d005c54ec085e58151aa5ddca5c4078f9238b2d842be4e0cfa8a112b17ab1256139e20bc937c4306af883f7dd1e2543aea931ae25329bb90a9ffec66e0928cd80441a7dad0ca9b7f8574f4c9f02a1bcba2c7cf6ad6ee4dc997d9be0716978681ee6fc140a8b4e4b341b06df732790fad7de2fb5e1bcc89de38c5face0aca3a2d136bebb87f1a8b619ac8ee1bef5aa17e14409f86c43bcfb04f62222a8408c4bd22ad00ee655791d894982f61640fda8618a869a0c2b16b64ad787f8088a01fab72846d7a6a2a68b8f00fb219b1148003282ca5595b88c449a7d4e93b372406a086cf655201d3f899fbf2ef1d6d8f839cc2b1d57b7c227d65abdbf6b23fcda5343747017fd4783e670b044dc6e53d3ad352e9177bc115427a7fe7f8c92f0bd6c71119267015054c7b82640e7fd7421cce9971468d6a942ca35e26fe5c84479f67e33775a6e64b2ab7e831ee5a3f1601d7492132d59b8696b793f52fed36f681b03aac7c52c177a069ed663f8b4737bee4cc60759ddf6052ae6d2e95157ac453cf3683e2581d0f0f1ed4e4de84431563d3b5694bc7bf09aeb747f3", + "aes-256-gcm": "76a318375e0ed9359c519be2e811f77dca42a04a0ac7f101448ecb8f3a036d639bdc50dbbc038c2fddcef450c70963db62adc1dc7b0b62de6d2899a84b2842b469881653bd48de8b57fbaa7730ef163883ce92ee426a6cd719f8dfe2e2debdae71caab6bedc937431a2aaa9209a7833312c57efddbead66f3c373b8dedd3a6a98e86b8e90f99743fd02eddc5c56d605bf13c4c7339cc62048862a8dab23c78eb6b47b1753b620e709a838ab6144ac091ac5d9aef33e9b69dca0f22d4b44bf2b4b0eff4f3d4dfebd825921ab4340042486c55e553714d72c41d723da56667178fe46ad341f5c47091b2f4211a6316fa4b1019be68db96d1ecff199b44433766783c11ad8920cdf80b57035bd81430e308d821df61a194f93ba843e843ca67ab471d9bbcf02d93261f75b246e642a21a7327895ad922b883010b1101d66ee00d552e091fb757a70fbf5c98303c3320a4c4368cd75fa337c0d88a7898ee79029141403f47dba73e89ec9acfc70f7c75713c9dd1402320e1d78175c5f2d0e01461a481028cbbfaa18a4fd3cef7af02285a39f1e2b72f30c3d735188cb34512c548b9064bee5541c46cf3e1554606f259cafb6fcd38a60c70fd7da845a1af66b9f5a935d11c2ef9a0de83932d3260a7629475ff9967bf92796105f82ea9416d82b1695704280135cf77de74b7830800eee7f1a4492cd039a587d4925c3b66096b7d47ab7dea20de4d1fe6c78eab42157da45cc43208ca59af09548c3f055b30c724f564e7c8c9945fe81dc101864ecc140f0a1b9d855af59bd6f4706e70aea87dea611e5a0a717d786d15ee6d4d425da2a947650b7886080042ff664ee039add9bf6e8568ccbc4aa1fc59b8795000b1f12505f8706e49ff1f1b04b86bd109499da34b65f62e2136880f1fd1000ef647c64181dea6077b4853f6be5b673fb11c94ee1a10cfcfd7429e25183be9ccd38851ab3209f4e7657e05d236d470cfef9a6f7fc6f168caf995ba69359d0967c4d70c22c6165d8104c686edc39f07d802788d53f8fb0e10a7ad34ea70bc24b458cb9428239bd095e588610de1069e0d8225dd373d6fe5ab7231e6028f310a0824d78dc1aca363f5887561f5b02c09cdb20381b6dcbc9e555ea98134fbb80c758d8945455015a5744936a46ef3a45c41207d2e4ea0fab8a99c94e2df6caf58fe192b17364fcc048980923c4e70b6815786a24b893273d647e84c190364629d32fe1d92852c64e210272361194e013952d0341c99942ae5476bf60468b315088fc00d71eb4a6e92f1cc4d69c888a4c6a8e23ff411b941ff934e66f9cfb9a0728501bd33cb0a769663740534b6f5b7f66c6b28577cef3a7b239bca4ef82f604a9b8f7f5aa346060bad6e4fd8d17a3e1306c1dc6df54b8edc9c9e039e6d6d90861985daed2bf0755a1e1ff41b50fc542d415a6bfdb8e3b70b878afcc81e851546c7c3a89bc13d6138527725a26bf9d3109e9c1455d137fc81257e0a3adda8f5b30e437973afb3e8738e30c767f260126036b9a8fc66e9cb42bada42c6e0dd3bddeeed3c8561f90a6922eb253fe27c19296916b9966494129f45094205f076f85f0a061c971f82c570aa12625758febc1be976bb0177b123b9c0c0fc6861522ab70869618f9cf867e8db12ba00d463d765b91e119dc9f6f31306353d21642188dde9abb236d62b6b2dcc62552ccddcfc0d7d71e0ed44b0e9d191163399869d1c89cdefd99312e86d781a6c270aa1917c7afd9a20b694ed41ef519578434cbba901d28343754d0e9bc56fd5a9600e5eb93945947b7c932d9d423bf77af335048595af3f3b39d4e05b42ad3562614ba3cb459b7e9e5b444aa4cbe27109e8324a423f0ae59a1b801d2b66b37212d6730bf65fe3d3abe59663055b7f4afef480e62e455b7a1bacb335bab2248d2e0dd0405deb776bbbc699d7e35bb00d603266c6cea5fd6b0b9d274244c19fb4ad12ed5caa62a07fe1bb46da76803c59ec532c0844dcb9b4554a5eca2543f6a76eca0881bb6f2446791dac4ecfce26016e71dc931cabce5ea32b4563765caf24afe3db32237885fd909f3e11801f9bdd7d8ab8399a93a085cf905c57f5883d994cd40da410d8d40c26258e641b2f31ecf22a2aa7f2ebe03685a5ff3d68f584038803599e856cd4510d670e72296208878a907aee283593c24e9c24c0aa6d34e290dd5ee546dbc5e21f42515debf1207f4ecc7d708ae53c0230b2dedb391c1cf9ae33be413156001f08c4e3120c681b47b7889930512cdc44710afbd4a21b21a8a7877d960ab031a2a0b984de1c299fd0dcc3f0612ce543e4d515cd2837e307cfbf7263b302f4645c0508175fee90de23c3995215a122264dc610888f7f2024d3c2c0ed1b452e52748aaedd280ed9648d395a44acfff1c3e2c81ef5ffbc70281118cde732ebd55f426d1ba01314a39710200072616510755512a6b2e0113c5dcbb6e2871e214bba8ed9f7d4a53852ee091a41fd3883e51cd0573d405a22f660cb49978ab898e4aec5e6a858ed01c9948a8b0ac688cbeb80d9b6cf1ce661713e75c0d38073327f6b5e31ba93b80cb1e2737e91209a1163b26a1a0a8cbaaeb7d2d58ecb632a391b53eb6c2b3857e2e681459db9b2c9089f3fd3365dc7b510d486c9cb03d8c6338895d5102e5414150d608bba9fdae8414adee26f1672e6ac4e9814862f8382edb1905285c768c929751d1339ea62cd94b07ca04599abed124aff683d155f2caa5aa95ab3ade3af472b18d0246160eb1190569f094dc3d39b39214e22af3ad76ec6b53a083755d5a577f63bd7f3907708ef5f5ca78155b4100dce729fbb36e7e24d199af4fff32953bc7d184e7d6974b791c2407220a5d26f8681f712e6e87869af74cef9bef296b9fcfdcf124a7ed5fa235863de47e5f11c4db5b76f44884f832b1da2bdf31552ef36e5d2c64eb2e5563d0ac84dcaaea254929a5e5777252ffc1f0bd7adecd7d0b5f480d78e7debc22b8c76152882d34034100f0932115aff664cfee7b9d27c48bc2968906a1670c57781d1e1d9f1e0fd9a72732e6985dc5321dacad58f87e829d296dbf2625837b5b82f9929db73f9692a662860f886f81593502285838b54796534c24dd32771879d2c5284f2931cb716cd13d864982e616d8b4c0d51bba88627ec612b27a08d3fd4d0f713c3d8e91f52a34defcb6937acfb6d7708a5864d7557929f0c7c162337f055c2d2f89fa44c21cc62a14e0e84b3ecc4e21c180be44f2227db9c8ed1ff72cca3ae7bce67460d0d6dff88e6bdecbec80077b2e0ba52bbe1ff7a9490acce9c8c07167faa29b19874ca6975a1fd96ad80688c759b1e93f3847b09c4cf201e68ccfbd878ee15ffbeb037a9046b061fea483f530867e6786af8d6db051bb78d7ae8cee3ee7e29eb8bbf38781b61ee743eed193798b86a9a0a71aa9bbf4d9c99757b1b3178733625fe97e558c01d3a3bfcdc46a18350be9a23b781409a2c98bb1981f287b9d995b1e4391292a7aa9fe089a982a1937596b9483b320b33fb8d7e97687922e5b40b06bb1e46c2528d8c0b3eca26ab2544e8f3704b7cdb4bc481d19eaa3bd0cac369341c6cc50d90d8c2a97d847ffa9870dc059a359ec621928838295c0e5a3c11d0ea07a3a35b85ccb894f09f7d3f26e7425b9473c3a938b176c07929daba0c951b2b9fa7e2c897e043d725d733af50f2f4686369b1a243d7ec33133923fc17e5dbe770dc8195fb10f26c08df3f25138ffba1e33a0f0d4da59134791146df6f5c6bdeeffb47aa7264eca24a57d9a041b213b17950951588c2b83787c3966c8659aeb8acd666fd23cbcb1ef239809e138c5a2c2daf7e0ca9d1bc34bc4f823a2f13abf4dc76609c61238084f771cb640c0786d55568fe6c4514bb9a07c15be82fe5d15d3b445f83088959ef68d48a05bf05bcceaa69cce2de783ad7345511799bce950220ad5846070daeb867091d7bc3f026af175e16f2d8aa056fc1eb327d9924ad420082f2d83ef53e7effb580638a896ba7eaf172e94c13f3fce2ac45ce869df95425ce61469866ceab01debdaf5537ddf1816f9ef07d82eb3e244f50dfa40549448d1fd0a915deca8e0d19475acaecc6a786dbe8606fdda18f31e96df060f0c6f9361de4b8e64cec336ce36f240404429a1bde9a0f935a37bae6428f97a86c63", + "aes-128-cfb8": "8e452c6596becf9c76fdf37dfc161e8099f5cee740afdef2095ba23b3d95b03b917d32155396242df630601822d2369478552faf5d3a374b135a69753389e3b478654b163dd0e7230a50b1f15bb0e33c8129e5a6fb72c025f839c2983e82da5be91945b78ec2a6ae0af3d89150bea272c66c2054470938a24c93c52057ba0c782ac464143ee56d72398a8f405a42038d1b85679b668c4ba9314d6c92a2eed1659fd386e0a0ee6e29cdbfed5937c3c6d65fa1e3061118f84f30407a66a6e9f8d0cb6d79a7eec89937e9ffc112ff684dd87a8e3f61295615b960fe2717069790a7e1d4fc959e40840dcf32f68ba2c22fc278070ac2d8f276f8808519d3dd976a746a745a1ed525a8dd181a6e9c908e2119568a2be68b35b0257ac8cef8741ccdc209364bc386ef3ad1b16eca36c5d9c993c4b38aa36fb28b5d90fc9f9dceda8fb15dccf346e69a64d28a0ffe18d827d26d227b912a95ea9da5ebabdf8174c51e6149c9576d8b34721319052497a6151bd93579c8fe87c18ed27a7b904fbd9a08afb94c770732c1f8ebc158528af9fa2916cde8d63ff539af12e3ffa67186dce30bfcaa7a8c435ddb08b7c4022b9d1bbf21b461036107b52feb8e2cf783e9619165ee99f68e3c51643c578c0be671e35171b76fb816fca57c4620e6f25b5f309c0f60cf5affac62c83f645f6bf52fb288b98b31c3e4635b6f8b1fcfe80a1930dbddc3f2bacea9d74ea3cbdd3686633d8cbb21603a2dc919ab5d7938c9f9489a20264c39857d8895819d549c0b1a0549ace4edb55604dce89e0ad3d7bafec0e0c306043d6439a0e65d436e1bc1f1a689c7b3c7bdbd7f1d34d1d826ca75c5e02835695296c059f49f4b7d22f17b519f8fc723ea450578c6a5ce86b8c608611f9300df104ceb4f1cd39067e232d7c4978aeb7db11ee758f59ce6f487d5c7539ff500319620a9828af88adde7cc2e9f078c8ea9b006095a730c80928cc3361dea24915b3a0affc77f17ba9dbe4369d4e652cf33abb272b43bd777dd7949d5572eeba3d8da2c695cb059420d4269fb1e846bc699d48964aa26e656b442e0e914f2ce61c7e7ab50a3d72679a425f8a400554b65d7e17e4bb5e25b6db497841839557af19e1b19493ff70568dafb093a6a85b07ef096fb2d418df02267c0969e5a1468e8b0f248d85d44384770aae0bd137d7b6c269022a5068abd2adf6664448f12035689002327e536180db1a716b29f462d023d9c322fbc8ec223ad0b8f8a8f230f99e4fd49fb0fb3e6bbf124d8dcd8729b388819a490000e486433cfbfcb54de4f5cfb12c6a1470396f7a95c7ea98eed29b21547e9a9458036eb34d25407192ccbe93caa1194b16d62cc95573945f1db1cf91da96ff26ead775264832789468a105759e97381e7f3843742bf4e460d7a56e00d06960685144e890e170b8d72733ae4a77a131bb1eb221465b802f5fe36d47fe88ae95d11f2962d796b23a0e75553ae344ed9d9808a18a5692aebb9430292d0d97501a09186616971aecf71cd0a7cd0ac6cd7a6964839fb0a7efaa131bfb9cc446d4be85b6b7a7cc8423228c35d0b4225fd736f11ab09df575566c340e60e22ecd019691a39192596cc9031260fc26118b75aa7a589216e137f7a60f9ae2da622de5f4097b13113621961938a36ec5ec04c9811d0f2243378300fb035a2c6ce51f46da9877afecab213183381d5f75cd4cb73f50b2559642121b3db470eb6722eb034aac743cb0dc1546159068e98bece42586ef953207a42a992f3efce7c5925b1c027cda4203bd9459cd4a3156e3401ec234779e6d83eeedc1a526b77f2fe750273145f88ca837b111abc2fd12f890699ddc64b872b7719ac7b2600611c99cfc9a8cb048b64e577b96c049db1aa408bfae55a738d699bc378cc2b466540a655ccc87eda892e5672264cc8ee12c20c7c606f4051491804492c04671ae198a6d75b4cbcbe4dcb84418627480e6fe775eaada724179a2301ac4a11baf912866c63ee4b32d9761b646bfb22ccbb0ccdbb78a503b3a1a4218cc99cba2b5da8c6753237f063ada34c39ff83e22843082a399dfdf663a37b818e21873e17492f32e79f38d3b12b01b882f97321bca8721bf6d2aba01b8b26b10792db7b4c6862670d51fdfd4cc0a327294529ee1bcdb5b681698844871641e876bb177466464c825dc08374fe3ecd99d55b67c4efae08431028f1e4a2a4b1c340ebb7a43ce0236cadc50a8cf93de12577ac674fcf59fa3192eb31b28626c8b166d31176f6961b4112248a7dfecc09ba1659c3ca3ac0ee91b3505f77ffee6526ba69609b4a617b6ba3a95c5f2a6b605782e41a6789cfe4413199244dd2123682772075624b32a5843ee0d0c7ac1777cb57ac824f2e67bbfa0b50ed1eedf3c35e5816af3de00f5b10e87f8da23089ebd5ce5ab94f5f77ebc1fbc8b89404d0970f119e81b467a3d49a99b3db26fa3710a4a2688692cb391826391b0e07a901eec33c001dafae53d4c4bd09a030f4299ab05d8e1f79997de43a81937419f3eed2a06eaa12752465c784c6e0d0967be480dff6d5652b3db2f436a44ffc5ca3d71fde8fce87a67f61464278c70636103a00027d97a57900ddd004fa5ff9051845a4f46557d6bbe9694f21169ff07c2e2638f1c62a815274a9a7fd6f83fc02293a0fa7757d70db50b4e9650133984c28079c60be1d8bd179afcc2e1bee55b35a267d57aefa7ac6c1a3271757a736b1bc8f90a356bd9cc24ac5ac3aceb2a6edd55553f2ef2813f913d514cc585596d6b49a505da80c083e0ee75821e077c374b577468e704045019d5249b6b23059ca2d49d02ec61255bd1464994bbdd187289988fddbf46671ac5ec980fbdab40c2510b19e8f8e657f66dd6d86585fba010610b24363b792882ecc75783f74e030617a2d4ad8fcaf03a6664c21b2687901189d2f6fa5563d7312d8580043ca3e05a95fffd7735225bf5a3a6e9a4ef8aa99ef29dc6a64ae6a94b52d93014f7d6ae55467fdec1b575634b118f3b48eec79c47867c9425706dd816bdce9f7d341b9c45204b9a1704a77cd78b091fc6d65487aba54262a102ecec1e4cbf26b4bc938b145ce5f781fabccd01e867ff2c6287d78656bb2d24ae05e1a37a94becfe3b9f0b89dcfda342c44b80bc8f19f72e07fc909d89f9e5f3481162cd7395f613c4dcb94eeefa465b010b44f57bf0962ecfb03192105699a6d233fceffd0efe714787a6ced621d80cca1c32155a7d1b3af64e5e950a5ae43f0630c33e6f4746c5c9b8b7dcd56205d8aaeb87837d83b7f604fba9c702c9dc72958e817322b497ccc67732a74b368834e704faf24329fc0ea9c8feb09ec54b67b446a44d386fd04065cc260786c9344e0182e10f41f30d4bb67860eb2111178498d19b7a74414da22475fc9a04240a44adec107613d49f098711c5163abb3c9216b58da456b3531874590c1d35fd0a3f4faba3d72d8251de5af5067b37e84cd33f95284fd1a08c0d1e82332de7bbb8712d5d79f7feb9aac467c092624494ae45183084abfed4773092967d697242c53b2a664eff23c6a662eb870244dbe50bcf172257c4a06009f0ccabe528afb48aab43600173bcaac88cbb5d0bc50154d06525b63de4eb3d740baafd371ea8fd7bc3262942f08e3a2b8c5a637ff09dba07987aff49477eb96c9d85a5aa7de54a9a77f0a11a2b1351ce1ec42f4000556726f3df05a09667ced29ec3d284c9466346e66d6b6e2a4aa3d87f25c945b109e2f28ce5f75a547e407c886458b71a86b8d674b4be9fbd772fff36104308cdbb086d8da7f92b47b3d8fcb9c4a040edb40d8bf4886ed49b4136b760c76ea81e17d9838bd406477792da07727faf62fc6f3039e0343c7fe1627d0c15f97cac54f9aae7466ff529863f267ac6b7a6e717d6cbf6c0331363432b0f05a3a5cc1543451b8e79484db4bdb836921ba987d9d2d76554d8b851f7c8c2f9d7ab498203827ba45691e6d862f39cd09d165ecb8dc1fdf6ead8711bac28c791e578364cfd1abb951e538ad05a4098ee0d550aff72855a1f68b284c727a361acd7c60f122e8184a82dc06c14061b6907bae4265055ddd380581318dd1107b312ad7f0cc1175f2e17c79a11b9ba1f0b3f9eac97517f62ee48310311c886c02192eb276109487bb9fc3f69acf939b9f5b43eec", + "aes-192-cfb8": "20f989de4cbd56037efe464018ddd12a97cdef1e4ce9ff71be1369516bb0848b56d8e1c90295e15fcec24cc9f1e793be49e2de962feebb6ca8bca2c9bdbd26d385282f202203db3cc77be728a6d2d551b26bee137dae99cae2f3f56511ba5602d17ba20a9f9f997b2dc072747448178ad46150ae6c0e3e9573d048668aa404f9fdfda80cc0c56a4165e6cdc8a8d72d3bec08edc04476e6d10bd4de4b51acfdd864c64b47a7252df7f9ff0eb2fc3b0c6bdbe60868c0951d54506e46ab8c2ce6c565c4819f1c7dde29c37ca2ab726b1bf95a2fa178fca7f550b2666397feea80cca742927b3a14ffb3ae488710d7a5c6188d39e798438a0d7c6707d7f0a2111bd7959f7237786c7c31f25052aec16fb37aab1fcd3ced4acf91ce6a103ef9626b9e52937dc83a20346757820e5e6f6cf0a0eb9017232c8f3717d61695b4b9bf2ee72e514adfcc5333a1a09ac95e55e56c1143be16c8624a80e72dc680362cc5b30095651c42a33bdc347355af40c4add545045a3aeef1be4d6a3ac0f181810541b3a6c82b7c5a6db20e677e66c87195e3d24d862f887d2808619898c04c66650f10b8294e8c6e46065810e9458c4845c9299d3563554480dea83f3fe1354f56510262e6524443ed2a59fc966a6b61055a93d0faee282455b6b47335a7b2cbacdd8d6e8bbd388e663f96e37758986e07ed11103c9b84ae370a3a3d1b3c6cc404dac1c22964d74fe056eb3039d64268e832352455e0d137b044a1264775b6304f2cf4475a8023adbeec62bb96ea3b42f13285c1a7f57e01186d2d1f939d243ef0e58521f0f1b344648f752f430621da4cb1e74118bbbb94b92bd48d6320073936834083325bbc504b7c40a1c2de692de7834f46592a2f05e94135f4137724e5a082927e7f19c95483d5c30343da9a8686563c2cd1ad590dd0dbd3204f3d8bf73dc51d72e1ac56532bf3dd8b7921409eed1bb6257456880b292b16bbe2ae32d6860caeb586da99b0152d6ac159b3bd017f17630754f089c62c8481df6bd743986cfad295e7e8cf7495c00a80f0efefc377a4a55ffe273932a8e40e097c9df43708a22c0e323a973f9d56b71cbd44eabc971563d461c009181ac4e862412df53b591b4dbe901aef4a9025c266e37c269815713cc6c7b07613e119c8bd1293ea7b70bce4226efba00de736c5aa3e202bf007f0f9d46c8a85694c780cb002bffd0f88952c4791d4ac17d7ef8f6ab29942b1cb890aa618bfd34e9e877fe897d58848dc3a1e4b4b8cd349bc5d54049cc053d68c50d80139adfd4c063616c6c821cec34f6ae7f62b7ac4d117407d664c4cfd790c405a221dd3efdd47f36167259588670411c71dc8d845a29cc61953153d8a6168d6a6cea162e1fb350138f306d4365d7824a0559d92a84906207c9bd9fba5faca7d8994fb961f221fae1112400117f36dbf8fb91ab008c2b3ab6f267f58a2e62f945ab5c0bb3f8500fd18fcd0e123e4f1b23ab79c38adc405ae21446df1f19475ca88f4633b9f15d289d8a7df5b08d838a0d8b4ce8655cb61455ee5c4862a8c7d790e759079454a9a968b32322d09f0fee6f00f211d9c30b8736783be561603615bb73d248e123910b38282e6291fb44adfb6f5c9d1e2f2433665cbfbe4c24f99380faab0fd362fd76fbae0c6b1809897d9cc8f18c7f11db802f6a52004435e172b2d8ecc9205afa4537087a1a00a88a40ef73745d540b7ad3ff5b49fb334248c41e6ed3a75e3c1c237b82f5f6a85dac5a953804a50fef4206c9b46e5fb024f4e0c4bd83b424674dc621372228a929c7297e12b7e0fc187d088a665b38f8054f081ac857e6cfd8703dbe32b6457db66829a426e47ada78847a592f559b46db8ab1f90c74509c1ab6f31776db6bcfcccbe12d57395685b23cfa24014db8b1a7cfdd8e33c7475a3cfdcfef6f071157488cc7f30bbb5acacfb5c989e675eadbf5dae822ce9a0c568a013ead01fba40a8dfbac710b37745ab43a10200f663312420773f9751c1c9802b16e689adc494d0710aeb65d0e691f809c078a968f11d50548ba2f06cc73c706678c3f91f9bad53025abe5e1e8deb5206fe672bc4592ba47935229a28716335160e9c958afcd821742830c4174aebce5e228de16011a5be6abbfdf36d98766a423c66ff9b796086022fe6447f527154872ed94cc6165d5bc749b981029c164d61762c1b58652ed1c93491d40b9ed3b832a80f389b4293eb99c08417dd985ca01413f1489b57cba08a139574c8c82117bb6567b3683f0395f719be17518809665211b266ededd4a9bb21a065c4fd5c2bdccdd1e6537ff034fea6ad4e823d6b0d81b17992aa9c4f44a0e177443bb8e2f406ab9e3e6e4b6ed3079ce49df8fdec976b24cfeca023528da2b9fa6e988047ecf7cf3bded454c2ea5c40cf3a9700aa1d2196d08cdd9947977dbb0a837cb83d1003fa780de4921fdf81369265cd1d3b1bc8939d416f2b400da56a732e4e099aa13cf0458256aa56e2c39fda4bf8919f2e7b1c7e07e8d830a7fac2f30ddeecd731c1e5683a79d62855b61f096e1a16b18812499bd5f1f43fa5d20792abe2e910faef4b412a25a4e84dd0867f5f0395b8d93aee6fb055b9264b73f3a1f9304efd2ed7f57466482ef538f56f6fd8ea8929640daf6b3487b5d8eca835c50eb5eda14d8b8e5fea6845829f2f0694827bfbb2a1a35ee20473048ea3c21a7113a526633cb4e1d96dfcd38b4e22331d63c240b698db1c3d94dbd5d845a81aa24f6b61817176939a6087f9c3a7f7b992cd5e3d068000e286481c0dac0b64bb1a90cd5a2f08cff8d8c34c3d8f7d954a79b08d531b418c338700a4f9b6dd8dfe565dd676e3e2245c71b8ab6ce6a503f049f8ea21ff8de433fcdd29c684466859fd1905e5925a99160dabc45c13709eb6d34c900463b14bb3d58b709c6b15b466f8799b1746e4172c676531fcef04323bdd3c3348d1b7ddfe16a9041d65821594d3ee4fb6804b9f35560c81584d9d06629a3ab82d1d52c15c70012a75bd7b80aa8767453fb751705c9c4e3e56473671c02859e6b6210ca5adb5cdbc3c2a333c6381a0006b87b4be12d03c3f9d2ea0de3cf159954b03badf80fee3cde0424465588503c06fe831c7ce9127148bc0e7bbc73c1d7950428088631e606b62ee3c40427b250c4ef22c86f77fd70854eeb258e7f6dda2fca97aa4a9dd739c60a88d960eecaedb78adcdfa18a28b05f6fdd6d807fd95ffef453740bb5e0655de119ac60d1f06e8e775d94e4daa70566744c2aa5be0ee13b854cb314218d4f34ac9d7870347a9a6db54cb6ec9c71be62948e951536c0d239dc862a270223edf26221a42e0dda7d7311371bc71ed15583b53b74106dde7ee4f856b2c71e62d2ee1bb868aeed12b3dcdbf0b7a072a82e57cfe6e8982d928869ab4f5045a3e2083c2807dc6fd3cffef10ccd596cca11bf436b552e2414875bb8e633b6d2ec3d1cdacfbeddb489a938e8a2cf51f2e1e6c8490846ef49d4aede872a0514255928ad5ea64c1d35c6b89cdeb612da42b2569e27982e988689157228e2bc7cfa3e94df584fc3fb8a35ceba6dc1af8ede4369ad28657e364c0df1f61191d939ae335d914a0d7e56c386319eea06aff7dc3220457a7551588b2c0af671ca103dee73e5b5f88b6a5401a6d6393ee6b5ef1db07de00e8a473b18983e64121b6a245dd8b59ee2f331a072faf5c22af17215240aa686ce7b1321830ed99a730229a4d503597ea246742b165e16a0d8db8a3272c46d55148f8762d56776f5dd8fa478df2c231c4f9a8b9ce1c341f8d2931b87993b9fa2ce6646f738e88045f536bddbad517f8d40c6d948766dfd9dbe3c0eb71637e9a249e6b37cc85cf441a919c462cd9f0bf1751302f491354765839920a8326997d6429a0241cdaafc1ed813b132244e6ae897ece4639d69be80030634df3449a9e24886c313b5996eb8af8009680c96a33d5235771d4da65ad6dee80478f4074c945c4e8a7b1f7acc1d5fbc5bd9e36bee2db672f462f21fa9931b4b83e6a58d7930c3150b0f0f86dca49e2dbd14f8a62e515d7169bd49557afdf03ca03189305723e7a89d4748c50fb4a724f30498ebcaacf1b030f785b2e6556d00c9159cc971637c37528c64ec7dab0b9a841e62052a8b694b8814793c376cfe1b11bfdca5b076bc8f87ff464", + "aes-256-cfb8": "adb18be54fdd842ffe42548e8d4c61f6a0b1865f13faa8093d44750e555cda0d8f09dde86270ddec8a252e229b8ee5c17621541320ec6079a30e15eaf6474595c4dfb9384fa0100c89f8099729cb656805663ce5f35c5cd40fcdaedb09c82da69862b41ecca94573d8edc5c620e19278dbbc73d822e0094116bd4dcb8bfe1f2f2a1cf4ee9545c9f18aad5ad26b3344533d660db09c836aa02ce258d5a0db2d2c52246fe65a2e2528257e96cc211fda09494cc77bab48dbbefa17cf224d819d65de554941b3d75c970c1e3a2a705c8029b7bd4591312ad4c458e37a791ad359bbf686d7e1f086704889ea69a597c468620d524551f478c1878b0043289cbb45e3643cd7ef57383f5e1725fc07a12e294d550455ee3c51e36b9a33c4900ac28e02fddb46103c9a45797c4a937de9c850a9fdd37db2a42ae0342ec0b5ae2af8e7de72f389b1d25b174de856b52d94f9af1f6c723c0512b5ccde503e410e1d1954547810950f5f8770bbcf4563d67d0cf085e7ce0ebe927e0fa3c4d88feb4857264bc68a21245bfc59f369ab99120d0563469fc088c09423b10fa083cef2418d9b4c71247112b091a5b3f81b11061d9d8adb66db9ae58ea05b60d7ab96566c1048c5ae0c0b8ded4d9b80e1345af5d4391d4e7970d36e1532852e9b0bba4ccd7c16c5f3d1fbe18fbafec4d66d7f540d750e4163ee500ae3b3d98be44f26622d0d40f8af3473d781efc5536d20a5eef44314a3b074e86d1888272fc647ea519522a6b6f13c2bcc674fba481b58c74efad36754e5c5d3ef344f3098aba9f19503d933fe4f5ee00a53a3d83b5eada80352793ea5db3898bf80c2bc2a3ad1d08cd46f61708c4f50d331e679f1d6d833cd17b5eed201cf73a4d6f557c1fbb174b0f8bf3cf2281f547133bda34954cec82e1aab4bbfdf0ab280debc7847633bbb84b8e1c1b74325a2932c99637ad32fda1b393cd557eb8cfad1220dc5b081b809d3b15c15aa48be32da9e65de4835df07844b3ed0f2ede9b25e940e38fbd768ecc2f7a825a6e146d27b9d79c6e46944468d9e70b25ac1a6b1c4bd92b6d30d2c3a58be1b1cf5fbf87f0e74b27dac05de25c159dc623cefcbee95af5341b1457b7e9e7e6005489000bd23ccfea096bb7241014140a1c20bf5a0e0eecd4e25096c1e46fa1f688677404c75488c988027dcbdb6c30faa677b3fc3686c52557252166b706c9385021636d5311de02984f666d1d3793b171e527c13123de2c53e870b62f7074556766f33be30f7560e68aa5b5b94d165ed0f9677ca4d42f615da5a666e32d3f33a9a3ed29c7ac26b99d5e08a090f1fa668a31af9435698a2df6d90794d5f438838cc79029caecf63b81211168ee29117c588f31f3bfa53ec5e3605206cdf7e1ed8418270e604632c1e079e4282ccd989fbab719a26f23e5917f2dfbed61e7e8c9788ed3cbf8e4b29c0010decae7b207fa8b4b66a50c11605d756c2af721c0cf7bb89627ae015f6b39e4bfd4d5fdcf85d29cfda44df04cd41e353f5e813d5c2ec4ef337847924719f979210399eef0c0b1d9ebc519fa180ccce3f2e8970142127c8dbc4b60a90f879c2bab7815364d22de59be6d6cb2c11c6b4f5a4ca03e366d805c3cc800aee819cd419c6b848fa9eef13598a2f12dd42777e8c0fa1db98ae926c9969598592e818d3ec3dc439aa284c01066ac880c5495a6e7a4d3d0525e37b8aec5b104a6309f801ecf71aff6bf20d2ca79634917ba5b8d32e8ac598085073ded0e6e4595c425397a9bd908e538fbd1f78eb012f053d065f7a71b92e1a8e4e2fc968e8df4cad9b0ce98a09daaac4331328cc9293cecdc2c820bef962979e16c2d7b72bd24735b8a8009a635aaa1c58f7e2c6d7ddba444a5012f22985b5c4f20ae4f5a01e3f5350141e59e7b0e1050c313a40d2c4ca0485c4341c44aef138881c853afea749923a9ed202c0c00c9d56d9e34064ee48b23ac577739ede22c19b34b4ee8da13c07919a97a2ab0c04633d0047797d53d9e154abcb8eef9aa75fe75975a6b738d40e975e398496385e89834f7916d82de643ed50f7f19bd8c60214f00f81d5797f210f4f6c046bed9b8da6531a6b0d20be4271d87d66f350ac7855dad49f4ea198fb6791af956cd71be4eea2cc0f61bf008054e5f5c9d4b0faeba776eb2f9e5df9a5380c059ab109d71c6f307896ea388a3187435ef7186f1dafaf900ed70ff0922441c5fe83183b85fa4bbf597fb0fa261dd8dcd139a390e1a51f44a4804b7231f85474399d25dc7b7fce12344d743a17a7f747b44b1cbf247ec1dc2c189767f8979aebb7cc8e29e1b5b251363160bb6a8e854d4e18882a3ce3172728069217a2e2d684d9bfa5f2ed0809125121b34b14534d4fb80b6b4dcb17a27631bf3bbce2d251019a9b5297f0f22987ffd91c8acd1857a4c3f2378f87faf8043c3a851722eb027291ac070c2fa55a8cde602a62f93e8f921975674308f5d9e54c34eacb09b6448c5277cbc947826567e7149f9b90cd25d46c9528a9d7a2147c7dce1617c1071ad0c897615f0939f955a44d1bd85d067dce7d89e28fab6aefd210a4ce39df5dddae46faaefc97899ba385a42ec5a14c3d044aedce07ff5235b54e61a938546d63130b25d57009bea0b58e8e477faef60d84628496eb929c2ddc59bf39e1d0262d5e9289c2b3fdccbbdd6996042e6ef039805fa7b237d34d7dd2a63d7e3a623aac39c7dccf82a9f5fe90e26569cc5483a2d03f09a372b9dce0e3ff339f1931f2c1afe6a5040d44bde5f0077af80f7172154b7011b1359029c1d94e83b804343c56b29daa13cf74dce90ec4d5b6c1d563c85dd266d130f9b72eea5f80d8b996c0aeb3a95b4dfdb53e71979243f74a65db202da897a2bd01986847f7f656e4f96ade8216e06357bf4972d8420e304bca1cc179d4de79de133bb3c8130194716986c9aba7a15054b8402182588fa32fddd17bdceae29c8344dfafcbcf0c612a2c7a626935d172ef9380905cbf52d3cb570be39fbbd456dffd0d425df7e5de37ebc3e89484b2b61bdea9b5cbd2d4c0b00444057d4380367c8ca1bc64469db299567234cb7681d96fc9ab202db2cf1b1c7869a63d6b339d3b217107e63bd7b086ee5882e0f741d46b1e155b84087c7bb8d7922c3bc3917bb18c894b8dcbdcee10bd6b9df5dcee22760b2c0f40cf7842c99841f55d1effcffb6b24700338c8343b4305ca985018d7fd1ba2591a782ad98ca34cd536ef78e61c636da3309b4372de0e445153e6af0277bab15ed6d59a9930c06d9f4ca05e4e10d3fe9735e63d5b045ffa56c2df6c0b329f1716ca75424fbaa552e3b6f74ad6817923e8ff0d1d5932896a8dc90d6d70f591b9959ec699b8ab7945753cfaab6644273cfbba78fd828292dba1bfbadbd15b6a5e67c7e51f2d8e7ef320b65fd854e6a6cc506492adc9e9f8a5f0d5075d36ed30192bbf9757b25dccd1f965ccd132adc0304e7465fee40e839cbf2e88b49dd3a5e65604f0a29a605d71aa187c20f26c9c28088a71f6501e69128953a80dd52a94fa4834010085eba8e3a472d2a698c95c7de289d1b02efdaffeb2fc539b717f8986f8cd0434547d4abe7f3b2af2f2d99db376983fc84044aa7f032b875a207d61ba2ca25daad7b5bdae79f3ee82d9af4c76e54dd2b6a68c35f9b92cb168e75bebcd7a6f759fc1d31ee3e6205b9a85facfd00fb138940e69fc283c2eaba2a8fec4b5beebee1ca6e5c7c023048e55e600aa3bf8d2dde5b7e605f404ed91810381ea6dde76e89325ccf4667925720f45d77ea17a87d5b126373af9e631a89e66a6f25bc8237ffb17de11ac6e10b333e72f2ce51e7363885bcf88a8a7759be864252fa4df02291c8fd9e5cddc5d1c6a5349f87298370f629bb6ceb7205bfe90f0866ce303312cf1250468e579243ac36b41ee0e4f15b12988a3af8df32998101771af448e24a8f01f3558554cad4a357042d005353753e1017ca418566440ee1cc63da0800aa47778864d5c884729bdfa8c40357a5da20f55de6575cfa3f92b69f17e7a4875bf1b3af2dffd1327a6d534a1eb546f501954a0c79d4dcf6148533e982e8ca409a8846c6aba008b0cef674cf367ea732aad0ef467ba61d89b2b2904dca7f9409322786ce84cc4e99bceab5de5895ccc89ed5e42be7c300b4a338b6634778902", + "aes-128-cfb1": "9ac3ffc130741e1008dbe579131c9f6425663d516a26c1858bd11c90eefc31f698a8d4887f13112f1466a7a640ab2073fe53d4917d650e382dac5e3f1b3c1af3472074855bef815e1ea621a9c337d5a7cf73475bec1e0974ec2337d50dfa27ecfca1bbfa391d80404039289ed6eb049cbfe5f69062ef98b9174b2091b98d92a8172ff38ed2e8b44d0a4c6f6f0dfc022990814f3cbbd71a7b53d32decd1a2fa4663ce2559a60c50235262a14f1d580ad07840cef8b443498f342daba4f23539af294bbbd9c35c6d6350de269198f90b1ad232488a1a85b787724e05692cd5703068a36732bb35923d8e2522faa4000b98987e182fb74dc6adee584b0ce0a79a48b1dc1843b1e3071a41fcdc09f53e5f0e426655464c7e96ace867b5d1f5870c94ed9a4417c93c917aa531b6905b0bc13453f0c4ba6414acdb5eb4362c647570d317667071e5e81348075e3a69286f48bdb8e1fce8931854ef817873fcfd11fcc73510d845232a8d7c465232e5367d27cdd8fe69a119f8cbd5ccf5c55405fc489e8db3889e87f2f346209f2c9bc1817feea79d69743a3f23afc39a0ad011b3e0c7bcecd369416a90385936f3ed5bb8e77c8e224409f1a28f5bbc486d66b430e9413dc03199fa58936ef5e953563f41ed7a9cd7e67e47a716edfc7e723786dc0fe0c7930e60a4c3008d2e0e608ee103ee24c16d6b5d8877fc0b794efc4de58cde0ce4d2ef85e0ee3dc47faca3d4ad1dcdf1fe26735e4cfdb6d69b223f42850c62e94c844de95eada2ea84091603a6536a431e2574c37c3c8f85d6048e2fa29b7683afe75c3acab595245f3091a195d404c868e72dd2139648abe2dc9ed2739e83312cdb01de79095e685f887394c11e7a4d85f3f32c889a6121b400e34f7739d3e8b6c59e4c9324ab818053e8f7a92449170f0742be940458365a4bc3c113066b299bda92b415a2a3c9093965f657ebb55c504d712cbb96bbaf42e0b6c5c20813653223ce2e47fa5b416da8ad2848b7daf0ec321a6fd99de8a4d5cb04035ca171f7fecc934985d326f911ab283d1f5102beb2ca79f161a47fbaaaa717805f78c5da3eb5af3b57ebc2e3726286cb17e764afb85a268427c474f10ee73c83c894786752e6355b0ecf8dc2076eb1f05a8ea1a545bdb7c8eda8543191b62aff517cfb67b6c678b8f4f482599e0c02cc7458b6a799db28c4bfcbefe103ad0dd882e318744f22d121cc234235ec2ba3d13081e0211e9070a8d125fc164bceb7cfc0fea553ea0a59e41dbfcd5aa62c13859183bc8b2b459f34b93f71ee770d862356849498c1a264630f5d578ee4b4ea99db6b9cd199e709c7ab6d3ea080e3e85a4294ecabacf857d0afb9771b6d5f8ea0dcb7410f87066c1bcfb36cd435c32eb202973b143ac4305ebed431cfc1940a49a9865a791eae5f346705ed2fe6efc63adc46ff640cf80a94961d33effdbfd747fc3f6b9d05c45f9400b9dae8e802379f15883033ee6a5626537b0c3195579ab243a8daefa19afe4306104b1c991884868decb7529bbafc3cfdaa724417b7e5cdd84f617c0e9f8f8276f3d689b5447963a53d047d814bc75bdf66cf876b83482ad5ae49b13282edaafe4a0d62e17c5e61d83b333fefd3f35fd7d395d84e4757bba12084d5b3b6a92babf646701bed9e227cbd82b6583577df42129f088543b9e143c14a69980b74cb3e7e8dce245cad33732355527617131c022277f5f9f685c475fb13cc760c94010ee135bdf6b1b2226e752cd570f31ed09133652d03183d211ed98f18cb88a9485106b77d6815f0681e643bfb57454b2622ca95a72e27d1e1018fe0ffac597badccb8b569babf02fcc8f38868bbaa680da7ba8757467352bbbf449b4fe349f9030f5c48dbe057fe4ea493df3521d229bbf4ad9ebcf2de3d4b3c52857834b3760c01bfa70d8cb978bd1e591c18560ebe18e78f920e70be450c61c3f2f3e6bca40798c7b10ebcbd97db8c7bb0f143745bf5df5796eaa1387087368279038e773c0094ccf008b6ce7adf19a61e19dc9ee74d9cd79dd2e84988e0324bc0e4b3ece50d7138a34fb03c3ae4542c1f69ed312cb0ee506fef320701ceb75030761833606dcffe7f76e9fbeb0d91b02dc2c77a7e50e17ee72c56c21172c183d7edb9d72223338b48a06402424bc70427703dc36ac05e50962a419758af34346374fe694c442f729aa0247904925e6349adac560102e22fcb2c791b2c63d654076074f1c833d2636bf2f319ef3d428af300882d954627d3ea783b367ad183015b3094e2dcde5283fc0c6f56f3db09f986af6108816b22fc54b79ec026ddfcdc8359228827e73a995068a521ffa52a083cac1e5cc0bf1939582bab288db532456c6526d33a635f4ace2e05a94e200469b2a73fce69d6a6e1579970b4aaad9b3d2c4acd6dd706d3b2056ef82c00f52067ef3de6e06189763639f7771e81dc89100f8d682f042e30d77783616930430d54ca259a86e423e9fb663ea2d53faa751ba40dbe15696320f0e2097ec32ccf9e20a06c189f2811aa4823584e8f5c97c31edb7bcc177083929cb7936485922df83da08ade065242f9768573c6adf8118551a3de47fb493c58e7def8dc988e36ea8c8c971d3a9695de2623b2b45396cb77783de1a7256c3462cfa6b5d8769e1f81da7cd01142a8a93f166d62e72a00586afaac8066a28ef1a57cabca3aa3416edd198ed276b66dcd90f8ce7a19bb7ab8412b2633a275d070642bbef22a1d42744b6bc7ea3a42db3fb1099f65ceb1c139189d38872b3acc310df268d7659cc09bcf250172109101d116e416d66022ca9f5e70e1968357e8f9ebb30d19b0c0b713166bd965a046eee5936b1b0e46d1219c7fbdf19bcb126a1d3cc51c02981656d44c80949d1329f2b9be57827e29f806e47698d96b66e55b6cd71b7cacf61b462f43aea151e2bc1f63749651c34c496585f1d196125fa83cfa3a125b854bfc45338664f8067c4b4418141fae8f30d008affc1ead19366f5ab14bd1860ccbcace222d52ca241e1a1de0791feb7626a105e1be8536b98b3907d4661e1615d2c56f95758f28e599bb4e34b8d2e5c56914bfdb94e653010b4ff620d65623ee33577d4144b5a542327984495e573174b0c6fe77c4c009d4c07f63b6b65845253d5884637cb68f44fbb1f49157e0974be6f8c24bdbabfa29afae184548ce61716f54e0da168b34ecef60035e42c6bda928256d24404d195c3046a66a82beb0023453866986f84c30042c77fd1049531a243e1fd875d2d8e6996e432911d40473269e075b2699b04ad7d100d9b3699de612e683f850fbe9b09179037e6c2fd0d65a51f25542e3cb4a4c699923ba7758033aaf83c4e676e41843c0990d863258a9fdd0070ae54fd83a06200ded35cf9c3db8f2aee74efa70827623fa7d4ce21b6129363344f9d30ac81311026153b65b40af82e252979ab6339b0909bc6d543e7408c9c2163cd1771baeaf6edd84f8bc762e4e630bca65058ae0a7b7a1f2f50cf8d07cbdf798a5c77aaf2ec661c8c6f3baa84d64c1a1aee478b7da922f09386ceef6b0c0e224529b766826e700090a6014542251c5697ff7f2caaf12d941dcc9330814ebc9a113e35b230c8ff3a1b20e64c2fc375cbf4af443f10c8f4afa44a3c189fa722a8186c5fc9dc6cd8af9f9dac5b242b5dddf7f7736234f609ce79f54b1ef51aa05cf27706f22975c4cb3dd522fe3eb176267bf428ed7b61f3d5dc7f32eeb0416fa393e25527c5516c45747d41699a70d2a43fab8bc9588a0f60a25b7ed140a72dc7dba0dffc7da9625f65755e15deb58d7b1af59416eab22f4c95eb07541cfd329854db079d449bafa1179c117d0684a5e8c2ede512bf8d010926dc21c63d1ea08eb7372dcbfe992867beadc5cc4dfaeac8b1e74659e6ae05ee3d98a3d76efe1053f865b032a43f067f1876197edc57a01e9caef529d7a83e923aced84e4a8f9fe9a7a70d346e051939cbb3e7b58867744dfe119240350853039c82fda6071bc839f599475d4d30c0fdd82795ebe25f537ef8bac980100509b38c3e66e799b858a8452cf7d1b9875b410d9f06064ba9422a77575d0833c799f0fa837e88e884dcdda8592e08e32ab658b9ff92e1866ac207ed4fed1b5d94a1c4b347e216883461029a934ab92f005715620a68cf044f0073be2", + "aes-192-cfb1": "4fcd5b423adbdfc4966c971449a045db51c031a44b11439ebf26cc954348c942c131a95aa1687f00aec31f88cf0dca55e4305340ded0472242f77b2a98dafac517b8c616726be56af8764be5bb0a03e683b00f5f02e49880f964d0aac6e34db65e85d181a28ce2db9e1ca6b43bb450caac42c33706f312449b5544d62605df1064ac897415cefdb91d142638a4f20c3d56881ca77433b25daf57ea1a5662d892df1cbb6f8b665dd94bedf3b19f0872734482e9d88544c1eabe6959e35c5b5d49f6f0c942fb36bdd05ee43072adb484c14512a7b9e7e8d238daa0b930044249c43e3ee2b5ee96d9d537249641d5f37d2235946a1698ed724890b80c44c2a62c32ad69a73ebcf7110f55bbf048600092c8b7087bcba7752c4d799b766e9b77671f6f9e7a9a72088ad1d7102463a545b4545d8ad4136a65b589ad0f9b2f305576de2aa5f339033397b861f843c8471787b22b947c93a861bdf546ab997d12ed9ebd427908e32314ac5e116e79a00e0d0ce9f7ccaabfad96cc919cd9e30a3eb551ba90b47217ddff8f414db6bf4b868928ea3e2264172dd74ba9fc28fd301ce7d19e1dd68b6bdc2004ca7d1cfe99ba5346469a9a15f38f2ba2bf3b83046d2eb5cd822ab01410bfd13bd6cd6231eb5fab3ed68a840922d6ee7af458a11321233774821190abf68b43714b4d8ebb2bb8fb6c2be59f755de4d0c1383360cb8591f5a2f300461ed70c4fa5c21ad1c23c8118b48c9d8370fe2f849c9ab0302a60dcc1722e4388b5cc527f2b183253e3202feec32fbdee1fb9071f419a81f38358c515d0369d1755c9f85d5051646d8dde81254694122d01a5aaf25b957e87e569a93161394fa62cb161aace0da96d0eb75491476bc10d6aadac81890ba9be03337b5fb4fb8023e9a68e26e2f0607a990fc5b9e07cdaa16fea287298d44a84a9c9ef1c1e4107901e8be1398c8265c1081e7dc8bad8eeb01064b3f1ffe07357e61342c022b0e25e5df188c091d6bc7bee96a64be8d227c34fc88692b3295f85b0d8dac91844f98548befece965e465ec80009c3d3b515dc6b528ae5922a8637699f312f51deb6080a4262bb3d2eba40abf4375c6c7cdd5a033519a1e42a3ba63064227e309492ff447e8b4cfd645d2370f50feda1d6e23bd841b3c4ce92428660f251a158c59e93599ef3ae3def1358224c45afedab87d5da52d49fd456e828301f25a0e18ec56f5d7f729b3540d5cd0c16e4ccfb3cc6be975cf013f2a0d4b8e14d7b17b57a22645e5ac97da8ddb65e24e47dbe6aa8bf2832967f7e22a4334c634193cb07b275aad27d3fc282dc52504871b35751ec9d6e71ade719f1f5bb1320da1d7ea2e067876b30cc6be57ee80025caca1e2e5cbda3a165296f5d40ecfbd78142f79f1ecbf5bc1f40dc5d307a76da0f92b408d9db811ca43622ae1da368c7555da2b99484c0ae4d6db2d924f29ff68ac3276d65f32e878891e52b12a912e5b480658c1e2203c0469970a8f20b16758fc953ce139d40eec691c74875382e9dfd040fe8b67cb59c969aa24d2567329eb85727a33023644674fa9d1384dee8677c52f5cba8009199d06736d223e576668eb224a6daf5c4780a49c218070803455906069d2a00084d7aae22c9378c5b90f85ee0869d94bd75c736f5bd1d969d8ba4ca24ed39ad8ed74fbbb2d68867017b3c286bfdc67797d9b48bbd5c8506555d125facebb1c54544ab3d8a608a5f3f657b573b85f4e57ff9acac9f35b22207f1d431f4f2206dcbb959b4e73712f35f42bea03296014711cd788a7dbb8bfbf29537a146e09b65eff9953bbc4c6cc6245d9c364c930777eae3173d91744526ebad35163f491f55e53134fa79763b88fcb2b986c2ebe6396ece40c2fc5f14201588d2d8b16bf03a538fc7c7670f1afb7719a4202579f201c2873773f5bb3a36edc185ec3ec2205e96f5f8a54fd43148446c34d16aef0c2bea347316af16ba439e5b09bb8e13235dbb4d3cd609067d282738c99b1bb2afa0fb50538534341ae9ec839c5179f0eb4f05c4bb40265036132771cb589d5e3242199039d4f3fe82fe083660d67f7c90ea6362fc3005fa31f2da2226e0e196758176e3c654b7ae75e3fa8889cac474db30e6b1c84db0dec46e2a0444206cdd6cc2cf401d9b8ac85246644d947ba4766193e2536a7792a35447b064b80e3e597765043f3ee1b71813926f27342ad3afca285f14558daf23c76e125fbd4e97e785318c4a662738aab767e9d44bf70c05e78b70ddee2e7e2cd02690e6b4095165e4a5a1332f1de54f67418e0babe9d505beb5953516dbc84bd9581e6438ca664c2b4be1612b09882c6b156c69390865e89abc5213a1a9c55268b1450be7e848a1a8b55bd7b8d30563ef1ce65b37f21aaaae1b88d03e54940b612327ccbadf5d55b89e31e3ac0d8bdbb6a006fc2623fafeca22ca15e728b64233e8e8c4206c72fda462c02ccbf5c1b3bb2b69cc3153c55a9485d58dc281881ce9576794f323852eaf41efec9c7475dba7e2bb6c4c971ecb265f62dd1708f2eaf320836e3b92ecb2c99195fbb3d10dbc54aaaab632e3f8db21ac9eaefda4fc92c5b351705220d4c98eefd9da8ab225750e279e4a0fe6c0d8d833d837d7a919a06468093d3ab4d97a35fa520c2b3e5fe2f6739113828a55d523de8b47bfb1d4da6ad4d4f252d657ef6cdbb5cb7e72da215915b0dad5ca4a4f9d4b11d72d25dc38e9ce1caf944244387607523695119fcbfe83aeb28ee3ef3f3ad97d558eb1d9101044d644363fcdc36857c56df065c21a1b03aedc3217da1cd27d3e4c2242980845c8f81b3fd1595b16b9591af8efd0f69951ff4daee96a65010d21a731fce89d6c1f39bc264b14d72ec7e0e5babc61155422066d895e8dce14c07db72e24ec1aba51e3635c4bb98a6b47f4234803283da5b24df9ca7f8d0eb3aeed9e49a61b1f267db1f062d1410010421b8104e50469233958c5974ceb324cfc10df4517e64cf7778217a927e78de03017c1b1cf602b0d16be2d1a415e2d0fec08f40df2067155623b7b25bb9557e4865b1078998096feb334f1341332b1fad81c0f5b1cf51ee5e31214b3f93bd41075ecaaf976f0424e3d648763f9487420ffb2676405291c7aafafb0fb99a80e835eb286e079c6bd60dfc87153aaaa1be79254c2971c1f9c1f6e65fbbc6086ef4b25b390fd7ed08b9b39769b684767322da8377ecc957397310678099ec3fee3bf634c86238b262c7587da842882f43aebd2ac646a4d9f689ef8211b0ad443fdb1abb4e96510e239b84ed24b704fcea70aae21e1ae44a3f4f35f40d5339a2a6bbff49b9e48a0cbdb3152971da8deec5c16b55e65c29c2861a5420327c5903da0284cb9a7ce27f732b3f8aa92e39e79e4863437f403c205e5068989eedf0388011bdf2c0840f3bf11c9020ec612c6b7bf68f53d05d0cf1bf9f3db65a4538fb727dc805cb27e152e8debfd24a15c57d9a03c0201331cccb68c8c25847359eadea986afd362bb915a62ccf2735f0db6879b32c935ae7b032db10523af580ae64b1629dac13bec9e47a4207b3b968a4a6af0307ae1d5cd7aa823607dcd7184b11ec5a6a1eda2064f6b27ba454bac819ac4460314d2260e817edd537b14563f470d7df51f014b8ed4a8b22e1022a7ab563de27cfdd6aa8cd0289fff9e8946f2c456710857afda8eec65046e5600099e6b478865861480e658a5463a758fb88c15c9a98b73ea06647961c614ca52fe8f8d2f4cce6762ee54de7e2ba0fb79d4cd97c13f1bdfc125072d57d170b3cbe715c4e54dd75d59ad32d3645694e3e1e7b8c0595b37b61939a4b331e750cab84e3c7e7277dfd070da686d3ddc6e5c195e8ac0e5585635e92b43cf8c5a4cdf5fc1d63b668ec3bed956f064d2fc3d77ca2ba351235ecbe180068fa19d91c2eef5fdcfe4cb49f78f674edf8492acba8133086d4bc2ae0ed3447fcd8aa9068a52250a3c40a424e12993c6b7ead850f7b315d28780886b1c3002ea615dd824eb893174728edb64aa4d3d56bec14f997b359ffedef40b403954c934250ad53ca449fd7d4351eea17f9b2c2ce46740d1ba8b92cb0316aafc4ef22dde54781b7bdcc9c2520b7b34f286109a09871da54657742322a460eef7ef635714a7388ce0a974d8006976ef0b809e23428a97ec8fdc75089d8e7290", + "aes-256-cfb1": "d35b46a4c859012482af4b417d2f7643edfa393097030fa010a39fe5047d581f167ad8325c90c1731d36e4e6297ff9f79ce9ea98987921af8d2934cfd47b9eb081996088771889e8a880f4fd80f0ca6c5493e2b1238923f14ed41320ebf8fabadbae88d18e17e0dba0be62e38275a25cbe93bf031c01126c60c23e29e3128c020a80f8dab21dce731430b563bd23ceaadf12b02b10b83c9cee437b1aad38633ec5a7441c8db670ef0ccfeeb69ecc82ce6a67c83358f084c73a4c4750e26e6944a58a9797d100d91fad92b4024d27665593282c7f4059ae28bbea320df1ebb9898c7ce3677e7e67f088adfabe1fd09cf79881ad64dd549bc04f924db5af2d1ef7f6e5b47f1fc3f8c87e7e82577499452ca9daac7e3f012dcd3199f2983eeecd5e504402c1c64f4c8f895c3262ba2831a15a258ed31e7ae92d271ea24a82c1fe064335e540128e3bb21a3ae265d6b729f4949bf24ad90b6fe61704452dd97be091e8fdc22b28c5b2c5451d27e93426e0f147681368579797ccf50c73dc130aff7fd7e4aea5b743a7b06a2a405ea7fb4609522dcde3fa1ca5a46bd2b03c66cf4af5b50ddd3ca47326ce2087ef388220d0fe2889bc72d32fe5f7c3270e429421f5b6c013c9ad137f94dbe1a7526bd54c12e07035af338851e364ef08f9a103142aab8f7f4be6cf2883a899fe018390813ca8465ee30bbdd5508578323b3fe5cf6daf3a5cc9597607018db84cc7ee770f70982de72718a20711dea200027815ec4c1825ea1862fb18b7a55a09002df7fae7668016adb9950fcbff1859973c444cdb3075f1afc65c5636e3137827fdcd91a69c54f04b2a607bf4d6c781463425a5aefdbe8a7c0575b12f43bbda4dec67e597fc87660d702ccd62a809ea8fa5bdf03933f5c7af3da8b3437d592596208439ad752a9a42b5730c8cc29024fdb60cc16a2fad08a0935dc8ee4e4529b74d1021e0942b588497252120cf50d658cad17b3332df97f390ff25deafed5ce07860e8336fa17875975fc609533e7c630310aac1182b052c509729451f4489f992cbd0a8ecb6b7ebc594e806335d3fcf7ddcbec72bffb8dd2b8af7a4f6d4aa0a88b84486a7270eca3ccccc72cce9f6298b8c146879857f3f1baa76b892ee9df89c0d7a865fa2b5dcd1d402feeac7865bca38db1258e7b8fd1583ab3363206e28be79fb3e4d996a9066ec8e0ff9859e15f3e6217542d57bb4922c0b40bdd4e57339dbc99fd6eaf597ba06fbe46e73bec4d3f7f4b164d24472f2a0196f0c9d9ad9ee9ecacda812c815167a348035587d2ef1cf781c814937c9f365a625b534669d36a586096028a144cd564d3163468b3c530cc7d201691dbbe346fdcd1ba3eedf2b133550652913254fc385a277597c5c02b81ed4bdeda4db0ad43e25b01aa03338eabdf83ab9e46b121f96c01e7ccbe50110cfadb9b8f0ab960d01fd71f73f71a883bf16be9eadd8702ade30a7569535f1378bbe4d7098cfb50171818149398580d5b32720304bc1372a0e1f547428922751b2a2ef19c138381607cf9b9487970fa8659ec9454523b7c19c544089e331b21e7b010e9f30e2267d4ccb2867cbeccc962b98f6e4c3f79b30de82fa4d4a1a338282e5184fbd37056c57bd45617fa075aef13db315fd99044baf898fe8371806d587a77e0e4a46d694cdd4e6023862f691993e72f90d1b2fef4e4c76908b82b1dbe499afb158c1f22594df1832927f5924743f0d68a3ebb19cac9b499add0490bfce163094dc78fc8e55e6eb48822bdd119c9ea0a0f0a4fd200cbca966e491f7a7347849e31e82cd8a3f9f0772810bc524d5411565cf428c9f77088e75621be42e1d05f21cff83b72600583930e0b2e9980a5f5550945ea6e1bd47123f6f99d2e9088f00b50c35371072eebfb418dba4f9075716fc5c1d1861069f627b3134e268ee70a8adceb6f402b15c38270c0478afcbaed51e11b4e0b83f7a478960d66337c4cd01834ee531a122aae52cdebb0dcf1bf77115d0a811f8bba743580b83b3aa75b0487117a7af55935a0987591e8ddde96d86dc7c9244bab198e72691c518b5baaec546d2032d3cccf4fd2d585be50934e3a1d8b2a08da9cf21a0cbcda48e0046159f881fcf2d5df7e93465d2214a23063962ee3fd691368adfd938b7a00421fc9ea0129035adfb13dde6562a348de8b3c49d4b8c18516c67bec249de110e32530219c9645ce7e988b6ff02fd43ff0df890193a3a6b65dc08c7e09c39050ba799b11472967c8214817f689b2155755e4785a9b1c5cd8ccd9334f2c75607e6a2747d6dd80edcc8f5b90d70a658e691750d2f9967d9fa20ab70857910c1deebabedb8a8e3f4a6002a97375f05a496961146928a1a28dcdb95f3e8c14632a755232a2cc827749c1b2e1ce6e4d6d5c49ce974275b667962ee770fe24050520b9e318e8a6a6a2ed29a882041e5a17931365e4aa585c5e8da3b7e4b5f9d85698eb4c0fbaded2c46c71b519485a851971b5ea4a4a1df1f846f8ec63a6cd868834fe469d7e6a31ff35bec0abae3f6f51ced5b05ecbe9a950914f661061d95982176ee144aae952f5e9293a37b769d38239e5e812e3a70142bcbcd322680c909dd558ec41d61c967f8efe597faec0074ef7a49331af1ecca9c269790394625c65304390443953b35bafa69e5b0f9318f7b806a1cd88085ada9c81f9be79a0108755e86e299b48b56a611f303ad74d074646e5dff654538767a6f04994497609433277224f46eb02cfaf849f671678d351aebaa20b4d1442b860b539f4b2a802d0c19a7c2b944466d7473c8217397d15e15d3364b67566ab5a1580e1fb6f6d9b54120596cd8aac7c13e8fc1e23cd540abd60c5b27c87d3dde46f3930c8f86b65bad46b661f626a5f9089844c6319a6d255143f479157f1fc81f8304e0337ce73c808f68c8a5e86896b06c759710d1ada5d4575d1f3c94fa5852cf369eb06154331b6f389622e55ba841d80c584ff55ae1b9b5f85ad30af84335d26ee15ebbcc2a66e372d9807582f0395ace5f8e664f343db6d11a97a939cbec73124c81cf61a529075c1b69ec4f6acad7a0d325810b4ac1257e8aa9b97b45fb99a15f2cc6ff2e4ba53811357471ab3a1904505958b9d94462197121a343ecae139ea577a73fb5b0614442934268bd56a64282d9a797d2cbf0d49fb3c538074da2192ca2361a9c2df61076c08c9b63ee24e635ad17727e520c9b4c90a6f0cae312cfae8212e2910cbcbe563feeec3948a89499392f9d05666f579cbd9a0a23e40a3436d92cd603944bc6d37e5ff54ea1a1766bf75231fa9dde362a08fe64d2ceaa26f01a95900aa57d57ea69ff08f85b5b7874282930354d5ecca6077e39d693d123ea94687fc9fb7577f5ccef8e5d609c20dfa366ee366022ff3530c34cfd886e395e8f619b59d374d1dbd97399f88ce832245c09d5d3a5c37f3b4e82efb52a85c1224295b7234233f1ae0f2c84dea5003b769484db1f2f68f8cdf5c6730bda78c21c6d56ae95609e53823e3bc969b445df1ac85e4c64ff3bc59fdc8c3d0038dad4e7a1b83c33eaf62153323ab0830f10b88808357040e7a31dc852adba08478d0454b9c382dee19d880858379bee65fe7c4eee5da1148c8bb511c7c77ccafe3fd502362250047e874ca44901cfbe8977d1704b3d98567ca030357dd45a4eb99bc5f96bba637ee593ea3d95d28b5abcfc958d6a1c4b1b9cac7b5109ce6b2c29ad539c66f43a10b855c62d4ab93d022611b834b4e26e37ebea376da1bd8bc872beb335e57b56b41a234539a7979854a7db0fafe582eecda9f0dda0f5244b345f8721711a103774086674e9e1e897ce26faf7b5f22dd782b27503d81767d372527d80123517e15b57cf3a65b6172e4807f4494b450c32513e562f71fa3b1ebc5c30818825b56e1b3a3e736282d4328aa2799cf6dbcff4b38baf2c86a24854c238d4f18386edbe5339240f0e38b762236e2ee930d0d07219c953ba11023853c048886376a603fb78214845af729ddf56d7198dc3ed87ae9fe836d6d0debb38100a284983ba6b8058a7fba861f7dbb221541b6219424ad20bda2a784b26b0e0b1cc76218be6c0eb16e432f9f5deb4358c4335914e527d5e95b73b29531a298b3a8566064ce817fcd6e14cacdf15298237035afe691f73a72e81c6197447" + } + }, + "aad": "6312bc1a31a878b4b2ef1df84c9b1c42", + "authtag": { + "aes-128-gcm": "18df427e45e9daf7ac9bc6b80fbc9d91", + "aes-192-gcm": "f349e362a080131c428cfd623b6d8eb1", + "aes-256-gcm": "d3a6450ab9b9d2d7cec85556216c3d81" + } + } +] \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/test/index.js b/node_modules/crypto-browserify/node_modules/browserify-aes/test/index.js new file mode 100644 index 00000000..3c9d8eee --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/test/index.js @@ -0,0 +1,512 @@ +var test = require('tape'); +var fixtures = require('./fixtures.json'); +var _crypto = require('crypto'); +var crypto = require('../browser.js'); +var modes = require('../modes'); +var types = Object.keys(modes); +var ebtk = require('../EVP_BytesToKey'); +function isGCM(cipher) { + return modes[cipher].mode === 'GCM'; +} +function isNode10() { + return process.version && process.version.split('.').length === 3 && parseInt(process.version.split('.')[1], 10) <= 10; +} +fixtures.forEach(function (fixture, i) { + //var ciphers = fixture.results.ciphers = {}; + types.forEach(function (cipher) { + if (isGCM(cipher)) { + return; + } + test('fixture ' + i + ' ' + cipher, function (t) { + t.plan(1); + var suite = crypto.createCipher(cipher, new Buffer(fixture.password)); + var buf = new Buffer(''); + suite.on('data', function (d) { + buf = Buffer.concat([buf, d]); + }); + suite.on('error', function (e) { + console.log(e); + }); + suite.on("end", function () { + // console.log(fixture.text); + // decriptNoPadding(cipher, new Buffer(fixture.password), buf.toString('hex'), 'a'); + // decriptNoPadding(cipher, new Buffer(fixture.password), fixture.results.ciphers[cipher], 'b'); + t.equals(buf.toString('hex'), fixture.results.ciphers[cipher]); + }); + suite.write(new Buffer(fixture.text)); + suite.end(); + }); + test('fixture ' + i + ' ' + cipher + '-legacy', function (t) { + t.plan(3); + var suite = crypto.createCipher(cipher, new Buffer(fixture.password)); + var buf = new Buffer(''); + var suite2 = _crypto.createCipher(cipher, new Buffer(fixture.password)); + var buf2 = new Buffer(''); + var inbuf = new Buffer(fixture.text); + var mid = ~~(inbuf.length/2); + buf = Buffer.concat([buf, suite.update(inbuf.slice(0, mid))]); + buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(0, mid))]); + t.equals(buf.toString('hex'), buf2.toString('hex'), 'intermediate'); + buf = Buffer.concat([buf, suite.update(inbuf.slice(mid))]); + buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(mid))]); + t.equals(buf.toString('hex'), buf2.toString('hex'), 'intermediate 2'); + buf = Buffer.concat([buf, suite.final()]); + buf2 = Buffer.concat([buf2, suite2.final()]); + t.equals(buf.toString('hex'), buf2.toString('hex'), 'final'); + }); + test('fixture ' + i + ' ' + cipher + '-decrypt', function (t) { + t.plan(1); + var suite = crypto.createDecipher(cipher, new Buffer(fixture.password)); + var buf = new Buffer(''); + suite.on('data', function (d) { + buf = Buffer.concat([buf, d]); + }); + suite.on('error', function (e) { + console.log(e); + }); + suite.on("end", function () { + // console.log(fixture.text); + // decriptNoPadding(cipher, new Buffer(fixture.password), buf.toString('hex'), 'a'); + // decriptNoPadding(cipher, new Buffer(fixture.password), fixture.results.ciphers[cipher], 'b'); + t.equals(buf.toString('utf8'), fixture.text); + }); + suite.write(new Buffer(fixture.results.ciphers[cipher], 'hex')); + suite.end(); + }); + test('fixture ' + i + ' ' + cipher + '-decrypt-legacy', function (t) { + t.plan(4); + var suite = crypto.createDecipher(cipher, new Buffer(fixture.password)); + var buf = new Buffer(''); + var suite2 = _crypto.createDecipher(cipher, new Buffer(fixture.password)); + var buf2 = new Buffer(''); + var inbuf = new Buffer(fixture.results.ciphers[cipher], 'hex'); + var mid = ~~(inbuf.length/2); + buf = Buffer.concat([buf, suite.update(inbuf.slice(0, mid))]); + buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(0, mid))]); + t.equals(buf.toString('utf8'), buf2.toString('utf8'), 'intermediate'); + buf = Buffer.concat([buf, suite.update(inbuf.slice(mid))]); + buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(mid))]); + t.equals(buf.toString('utf8'), buf2.toString('utf8'), 'intermediate 2'); + buf = Buffer.concat([buf, suite.final()]); + buf2 = Buffer.concat([buf2, suite2.final()]); + t.equals(buf.toString('utf8'), fixture.text); + t.equals(buf.toString('utf8'), buf2.toString('utf8'), 'final'); + }); + //var cipherivs = fixture.results.cipherivs = {}; + + types.forEach(function (cipher) { + if (modes[cipher].mode === 'ECB') { + return; + } + if (isGCM(cipher) && isNode10()) { + return; + } + test('fixture ' + i + ' ' + cipher + '-iv', function (t) { + if (isGCM(cipher)) { + t.plan(4); + } else { + t.plan(2); + } + var suite = crypto.createCipheriv(cipher, ebtk(fixture.password, modes[cipher].key).key, isGCM(cipher) ? (new Buffer(fixture.iv, 'hex').slice(0, 12)) : (new Buffer(fixture.iv, 'hex'))); + var suite2 = _crypto.createCipheriv(cipher, ebtk(fixture.password, modes[cipher].key).key, isGCM(cipher) ? (new Buffer(fixture.iv, 'hex').slice(0, 12)) : (new Buffer(fixture.iv, 'hex'))); + var buf = new Buffer(''); + var buf2 = new Buffer(''); + suite.on('data', function (d) { + buf = Buffer.concat([buf, d]); + }); + suite.on('error', function (e) { + console.log(e); + }); + suite2.on('data', function (d) { + buf2 = Buffer.concat([buf2, d]); + }); + suite2.on('error', function (e) { + console.log(e); + }); + suite.on("end", function () { + t.equals(buf.toString('hex'), fixture.results.cipherivs[cipher], 'vs fixture'); + t.equals(buf.toString('hex'), buf2.toString('hex'), 'vs node'); + if (isGCM(cipher)) { + t.equals(suite.getAuthTag().toString('hex'), fixture.authtag[cipher], 'authtag vs fixture'); + t.equals(suite.getAuthTag().toString('hex'), suite2.getAuthTag().toString('hex'), 'authtag vs node'); + } + }); + if (isGCM(cipher)) { + suite.setAAD(new Buffer(fixture.aad, 'hex')); + suite2.setAAD(new Buffer(fixture.aad, 'hex')); + } + suite2.write(new Buffer(fixture.text)); + suite2.end(); + suite.write(new Buffer(fixture.text)); + suite.end(); + }); + + test('fixture ' + i + ' ' + cipher + '-legacy-iv', function (t) { + if (isGCM(cipher)) { + t.plan(6); + } else { + t.plan(4); + } + var suite = crypto.createCipheriv(cipher, ebtk(fixture.password, modes[cipher].key).key, isGCM(cipher) ? (new Buffer(fixture.iv, 'hex').slice(0, 12)) : (new Buffer(fixture.iv, 'hex'))); + var suite2 = _crypto.createCipheriv(cipher, ebtk(fixture.password, modes[cipher].key).key, isGCM(cipher) ? (new Buffer(fixture.iv, 'hex').slice(0, 12)) : (new Buffer(fixture.iv, 'hex'))); + var buf = new Buffer(''); + var buf2 = new Buffer(''); + var inbuf = new Buffer(fixture.text); + var mid = ~~(inbuf.length/2); + if (isGCM(cipher)) { + suite.setAAD(new Buffer(fixture.aad, 'hex')); + suite2.setAAD(new Buffer(fixture.aad, 'hex')); + } + buf = Buffer.concat([buf, suite.update(inbuf.slice(0, mid))]); + buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(0, mid))]); + t.equals(buf.toString('hex'), buf2.toString('hex'), 'intermediate'); + buf = Buffer.concat([buf, suite.update(inbuf.slice(mid))]); + buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(mid))]); + t.equals(buf.toString('hex'), buf2.toString('hex'), 'intermediate 2'); + buf = Buffer.concat([buf, suite.final()]); + buf2 = Buffer.concat([buf2, suite2.final()]); + t.equals(buf.toString('hex'), fixture.results.cipherivs[cipher]); + t.equals(buf.toString('hex'), buf2.toString('hex'), 'final'); + if (isGCM(cipher)) { + t.equals(suite.getAuthTag().toString('hex'), fixture.authtag[cipher], 'authtag vs fixture'); + t.equals(suite.getAuthTag().toString('hex'), suite2.getAuthTag().toString('hex'), 'authtag vs node'); + } + }); + test('fixture ' + i + ' ' + cipher + '-iv-decrypt', function (t) { + t.plan(2); + var suite = crypto.createDecipheriv(cipher, ebtk(fixture.password, modes[cipher].key).key, isGCM(cipher) ? (new Buffer(fixture.iv, 'hex').slice(0, 12)) : (new Buffer(fixture.iv, 'hex'))); + var buf = new Buffer(''); + var suite2 = _crypto.createDecipheriv(cipher, ebtk(fixture.password, modes[cipher].key).key, isGCM(cipher) ? (new Buffer(fixture.iv, 'hex').slice(0, 12)) : (new Buffer(fixture.iv, 'hex'))); + var buf2 = new Buffer(''); + suite.on('data', function (d) { + buf = Buffer.concat([buf, d]); + }); + suite.on('error', function (e) { + t.notOk(e); + }); + suite2.on('data', function (d) { + buf2 = Buffer.concat([buf2, d]); + }); + suite2.on('error', function (e) { + t.notOk(e); + }); + suite.on("end", function () { + t.equals(buf.toString('utf8'), fixture.text, 'correct text vs fixture'); + t.equals(buf.toString('utf8'), buf2.toString('utf8'), 'correct text vs node'); + }); + if (isGCM(cipher)) { + suite.setAuthTag(new Buffer(fixture.authtag[cipher], 'hex')); + suite2.setAuthTag(new Buffer(fixture.authtag[cipher], 'hex')); + suite.setAAD(new Buffer(fixture.aad, 'hex')); + suite2.setAAD(new Buffer(fixture.aad, 'hex')); + } + + suite2.write(new Buffer(fixture.results.cipherivs[cipher], 'hex')); + suite.write(new Buffer(fixture.results.cipherivs[cipher], 'hex')); + suite2.end(); + suite.end(); + }); + test('fixture ' + i + ' ' + cipher + '-decrypt-legacy', function (t) { + t.plan(4); + var suite = crypto.createDecipheriv(cipher, ebtk(fixture.password, modes[cipher].key).key, isGCM(cipher) ? (new Buffer(fixture.iv, 'hex').slice(0, 12)) : (new Buffer(fixture.iv, 'hex'))); + var buf = new Buffer(''); + var suite2 = _crypto.createDecipheriv(cipher, ebtk(fixture.password, modes[cipher].key).key, isGCM(cipher) ? (new Buffer(fixture.iv, 'hex').slice(0, 12)) : (new Buffer(fixture.iv, 'hex'))); + var buf2 = new Buffer(''); + var inbuf = new Buffer(fixture.results.cipherivs[cipher], 'hex'); + var mid = ~~(inbuf.length/2); + if (isGCM(cipher)) { + suite.setAAD(new Buffer(fixture.aad, 'hex')); + suite2.setAAD(new Buffer(fixture.aad, 'hex')); + suite.setAuthTag(new Buffer(fixture.authtag[cipher], 'hex')); + suite2.setAuthTag(new Buffer(fixture.authtag[cipher], 'hex')); + } + buf = Buffer.concat([buf, suite.update(inbuf.slice(0, mid))]); + buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(0, mid))]); + + t.equals(buf.toString('utf8'), buf2.toString('utf8'), 'intermediate'); + buf = Buffer.concat([buf, suite.update(inbuf.slice(mid))]); + buf2 = Buffer.concat([buf2, suite2.update(inbuf.slice(mid))]); + t.equals(buf.toString('utf8'), buf2.toString('utf8'), 'intermediate 2'); + buf = Buffer.concat([buf, suite.final()]); + buf2 = Buffer.concat([buf2, suite2.final()]); + t.equals(buf.toString('utf8'), fixture.text); + t.equals(buf.toString('utf8'), buf2.toString('utf8'), 'final'); + }); + }); + }); +}); + +if (!isNode10()) { + test('node tests', function (t) { + var TEST_CASES = [ + { algo: 'aes-128-gcm', key: '6970787039613669314d623455536234', + iv: '583673497131313748307652', plain: 'Hello World!', + ct: '4BE13896F64DFA2C2D0F2C76', + tag: '272B422F62EB545EAA15B5FF84092447', tampered: false }, + { algo: 'aes-128-gcm', key: '6970787039613669314d623455536234', + iv: '583673497131313748307652', plain: 'Hello World!', + ct: '4BE13896F64DFA2C2D0F2C76', aad: '000000FF', + tag: 'BA2479F66275665A88CB7B15F43EB005', tampered: false }, + { algo: 'aes-128-gcm', key: '6970787039613669314d623455536234', + iv: '583673497131313748307652', plain: 'Hello World!', + ct: '4BE13596F64DFA2C2D0FAC76', + tag: '272B422F62EB545EAA15B5FF84092447', tampered: true }, + { algo: 'aes-256-gcm', key: '337a54767a7233703637564336316a6d56353472495975313534357834546c59', + iv: '36306950306836764a6f4561', plain: 'Hello node.js world!', + ct: '58E62CFE7B1D274111A82267EBB93866E72B6C2A', + tag: '9BB44F663BADABACAE9720881FB1EC7A', tampered: false }, + { algo: 'aes-256-gcm', key: '337a54767a7233703637564336316a6d56353472495975313534357834546c59', + iv: '36306950306836764a6f4561', plain: 'Hello node.js world!', + ct: '58E62CFF7B1D274011A82267EBB93866E72B6C2B', + tag: '9BB44F663BADABACAE9720881FB1EC7A', tampered: true }, + { algo: 'aes-192-gcm', key: '1ed2233fa2223ef5d7df08546049406c7305220bca40d4c9', + iv: '0e1791e9db3bd21a9122c416', plain: 'Hello node.js world!', + password: 'very bad password', aad: '63616c76696e', + ct: 'DDA53A4059AA17B88756984995F7BBA3C636CC44', + tag: 'D2A35E5C611E5E3D2258360241C5B045', tampered: false } +]; + +var ciphers = Object.keys(modes); +function testIt(i) { + t.test('test case ' + i, function (t) { + var test = TEST_CASES[i]; + + if (ciphers.indexOf(test.algo) == -1) { + console.log('skipping unsupported ' + test.algo + ' test'); + return; + } + + (function() { + var encrypt = crypto.createCipheriv(test.algo, + new Buffer(test.key, 'hex'), new Buffer(test.iv, 'hex')); + if (test.aad) + encrypt.setAAD(new Buffer(test.aad, 'hex')); + var hex = encrypt.update(test.plain, 'ascii', 'hex'); + hex += encrypt.final('hex'); + var auth_tag = encrypt.getAuthTag(); + // only test basic encryption run if output is marked as tampered. + if (!test.tampered) { + t.equal(hex.toUpperCase(), test.ct); + t.equal(auth_tag.toString('hex').toUpperCase(), test.tag); + } + })(); + + (function() { + var decrypt = crypto.createDecipheriv(test.algo, + new Buffer(test.key, 'hex'), new Buffer(test.iv, 'hex')); + decrypt.setAuthTag(new Buffer(test.tag, 'hex')); + if (test.aad) + decrypt.setAAD(new Buffer(test.aad, 'hex')); + var msg = decrypt.update(test.ct, 'hex', 'ascii'); + if (!test.tampered) { + msg += decrypt.final('ascii'); + t.equal(msg, test.plain); + } else { + // assert that final throws if input data could not be verified! + t.throws(function() { decrypt.final('ascii'); }, / auth/); + } + })(); + + (function() { + if (!test.password) return; + var encrypt = crypto.createCipher(test.algo, test.password); + if (test.aad) + encrypt.setAAD(new Buffer(test.aad, 'hex')); + var hex = encrypt.update(test.plain, 'ascii', 'hex'); + hex += encrypt.final('hex'); + var auth_tag = encrypt.getAuthTag(); + // only test basic encryption run if output is marked as tampered. + if (!test.tampered) { + t.equal(hex.toUpperCase(), test.ct); + t.equal(auth_tag.toString('hex').toUpperCase(), test.tag); + } + })(); + + (function() { + if (!test.password) return; + var decrypt = crypto.createDecipher(test.algo, test.password); + decrypt.setAuthTag(new Buffer(test.tag, 'hex')); + if (test.aad) + decrypt.setAAD(new Buffer(test.aad, 'hex')); + var msg = decrypt.update(test.ct, 'hex', 'ascii'); + if (!test.tampered) { + msg += decrypt.final('ascii'); + t.equal(msg, test.plain); + } else { + // assert that final throws if input data could not be verified! + t.throws(function() { decrypt.final('ascii'); }, / auth/); + } + })(); + + // after normal operation, test some incorrect ways of calling the API: + // it's most certainly enough to run these tests with one algorithm only. + + if (i > 0) { + t.end(); + return; + } + + (function() { + // non-authenticating mode: + var encrypt = crypto.createCipheriv('aes-128-cbc', + 'ipxp9a6i1Mb4USb4', '6fKjEjR3Vl30EUYC'); + encrypt.update('blah', 'ascii'); + encrypt.final(); + t.throws(function() { encrypt.getAuthTag(); }); + t.throws(function() { + encrypt.setAAD(new Buffer('123', 'ascii')); }); + })(); + + (function() { + // trying to get tag before inputting all data: + var encrypt = crypto.createCipheriv(test.algo, + new Buffer(test.key, 'hex'), new Buffer(test.iv, 'hex')); + encrypt.update('blah', 'ascii'); + t.throws(function() { encrypt.getAuthTag(); }, / state/); + })(); + + (function() { + // trying to set tag on encryption object: + var encrypt = crypto.createCipheriv(test.algo, + new Buffer(test.key, 'hex'), new Buffer(test.iv, 'hex')); + t.throws(function() { + encrypt.setAuthTag(new Buffer(test.tag, 'hex')); }, / state/); + })(); + + (function() { + // trying to read tag from decryption object: + var decrypt = crypto.createDecipheriv(test.algo, + new Buffer(test.key, 'hex'), new Buffer(test.iv, 'hex')); + t.throws(function() { decrypt.getAuthTag(); }, / state/); + })(); + t.end(); + }); +} +for (var i in TEST_CASES) { + testIt(i); + +} +}); +} +function corectPaddingWords(padding, result) { + test('correct padding ' + padding.toString('hex'), function (t) { + t.plan(1); + var block1 = new Buffer(16); + block1.fill(4); + result = block1.toString('hex') + result.toString('hex'); + var cipher = _crypto.createCipher('aes128', new Buffer('password')); + cipher.setAutoPadding(false); + var decipher = crypto.createDecipher('aes128', new Buffer('password')); + var out = new Buffer(''); + out = Buffer.concat([out, cipher.update(block1)]); + out = Buffer.concat([out, cipher.update(padding)]); + var deciphered = decipher.update(out); + deciphered = Buffer.concat([deciphered, decipher.final()]); + t.equals(deciphered.toString('hex'), result); + }); +} + +var sixteens = new Buffer(16); +sixteens.fill(16); +corectPaddingWords(sixteens, new Buffer('')); +var fifteens = new Buffer(16); +fifteens.fill(15); +fifteens[0] = 5; +corectPaddingWords(fifteens, new Buffer([5])); +var one = _crypto.randomBytes(16); +one[15] = 1; +corectPaddingWords(one, one.slice(0, -1)); +function incorectPaddingthrows(padding) { + test('incorrect padding ' + padding.toString('hex'), function (t) { + t.plan(2); + var block1 = new Buffer(16); + block1.fill(4); + var cipher = crypto.createCipher('aes128', new Buffer('password')); + cipher.setAutoPadding(false); + var decipher = crypto.createDecipher('aes128', new Buffer('password')); + var decipher2 = _crypto.createDecipher('aes128', new Buffer('password')); + var out = new Buffer(''); + out = Buffer.concat([out, cipher.update(block1)]); + out = Buffer.concat([out, cipher.update(padding)]); + decipher.update(out); + decipher2.update(out); + t.throws(function () { + decipher.final(); + }, 'mine'); + t.throws(function () { + decipher2.final(); + }, 'node'); + }); +} +function incorectPaddingDoesNotThrow(padding) { + test('stream incorrect padding ' + padding.toString('hex'), function (t) { + t.plan(2); + var block1 = new Buffer(16); + block1.fill(4); + var cipher = crypto.createCipher('aes128', new Buffer('password')); + cipher.setAutoPadding(false); + var decipher = crypto.createDecipher('aes128', new Buffer('password')); + var decipher2 = _crypto.createDecipher('aes128', new Buffer('password')); + cipher.pipe(decipher); + cipher.pipe(decipher2); + cipher.write(block1); + cipher.write(padding); + decipher.on('error', function (e) { + t.ok(e, 'mine'); + }); + decipher2.on('error', function (e) { + t.ok(e, 'node'); + }); + cipher.end(); + }); +} +var sixteens2 = new Buffer(16); +sixteens2.fill(16); +sixteens2[3] = 5; +incorectPaddingthrows(sixteens2); +incorectPaddingDoesNotThrow(sixteens2); +var fifteens2 = new Buffer(16); +fifteens2.fill(15); +fifteens2[0] = 5; +fifteens2[1] = 6; +incorectPaddingthrows(fifteens2); +incorectPaddingDoesNotThrow(fifteens2); +var two = _crypto.randomBytes(16); +two[15] = 2; +two[14] = 1; +incorectPaddingthrows(two); +incorectPaddingDoesNotThrow(two); +test('autopadding false decipher', function (t) { + t.plan(2); + var mycipher = crypto.createCipher('AES-128-ECB', new Buffer('password')); + var nodecipher = _crypto.createCipher('AES-128-ECB', new Buffer('password')); + var myEnc = mycipher.final(); + var nodeEnc = nodecipher.final(); + t.equals(myEnc.toString('hex'), nodeEnc.toString('hex'), 'same encryption'); + var decipher = crypto.createDecipher('aes-128-ecb', new Buffer('password')); + decipher.setAutoPadding(false); + var decipher2 = _crypto.createDecipher('aes-128-ecb', new Buffer('password')); + decipher2.setAutoPadding(false); + t.equals(decipher.update(myEnc).toString('hex'), decipher2.update(nodeEnc).toString('hex'), 'same decryption'); +}); + +test('autopadding false cipher throws', function (t) { + t.plan(2); + var mycipher = crypto.createCipher('aes-128-ecb', new Buffer('password')); + mycipher.setAutoPadding(false); + var nodecipher = _crypto.createCipher('aes-128-ecb', new Buffer('password')); + nodecipher.setAutoPadding(false); + mycipher.update('foo'); + nodecipher.update('foo'); + t.throws(function () { + mycipher.final(); + }, 'mine'); + t.throws(function () { + nodecipher.final(); + }, 'node'); +}); + +test('getCiphers works', function (t) { + t.plan(1); + t.ok(crypto.getCiphers().length, 'get some ciphers'); +}) \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js b/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js new file mode 100644 index 00000000..f504ea8b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-aes/xor.js @@ -0,0 +1,10 @@ +module.exports = xor; +function xor(a, b) { + var len = Math.min(a.length, b.length); + var out = new Buffer(len); + var i = -1; + while (++i < len) { + out.writeUInt8(a[i] ^ b[i], i); + } + return out; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/.jshintrc b/node_modules/crypto-browserify/node_modules/browserify-sign/.jshintrc new file mode 100644 index 00000000..2c5a439c --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/.jshintrc @@ -0,0 +1,27 @@ +{ + "asi": true, + "browser": true, + "devel": true, + "eqeqeq": true, + "eqnull": true, + "esnext": true, + "expr": true, + "globals": { + "chrome": false, + "FileList": false + }, + "globalstrict": true, + "immed": true, + "latedef": "nofunc", + "laxbreak": true, + "loopfunc": true, + "newcap": true, + "noarg": true, + "node": true, + "predef": [ + "escape", + "unescape" + ], + "strict": false, + "undef": "nofunc" +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/.npmignore b/node_modules/crypto-browserify/node_modules/browserify-sign/.npmignore new file mode 100644 index 00000000..93f13619 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/.npmignore @@ -0,0 +1,2 @@ +node_modules +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/.travis.yml b/node_modules/crypto-browserify/node_modules/browserify-sign/.travis.yml new file mode 100644 index 00000000..737e0350 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "0.10" + - "0.11" + - "0.12" + - "iojs" \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/algos.js b/node_modules/crypto-browserify/node_modules/browserify-sign/algos.js new file mode 100644 index 00000000..b4bc0984 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/algos.js @@ -0,0 +1,71 @@ +'use strict' +exports['RSA-SHA224'] = exports.sha224WithRSAEncryption = { + sign: 'rsa', + hash: 'sha224', + id: new Buffer('302d300d06096086480165030402040500041c', 'hex') +} +exports['RSA-SHA256'] = exports.sha256WithRSAEncryption = { + sign: 'rsa', + hash: 'sha256', + id: new Buffer('3031300d060960864801650304020105000420', 'hex') +} +exports['RSA-SHA384'] = exports.sha384WithRSAEncryption = { + sign: 'rsa', + hash: 'sha384', + id: new Buffer('3041300d060960864801650304020205000430', 'hex') +} +exports['RSA-SHA512'] = exports.sha512WithRSAEncryption = { + sign: 'rsa', + hash: 'sha512', + id: new Buffer('3051300d060960864801650304020305000440', 'hex') +} +exports['RSA-SHA1'] = { + sign: 'rsa', + hash: 'sha1', + id: new Buffer('3021300906052b0e03021a05000414', 'hex') +} +exports['ecdsa-with-SHA1'] = { + sign: 'ecdsa', + hash: 'sha1', + id: new Buffer('', 'hex') +} +exports.DSA = exports['DSA-SHA1'] = exports['DSA-SHA'] = { + sign: 'dsa', + hash: 'sha1', + id: new Buffer('', 'hex') +} +exports['DSA-SHA224'] = exports['DSA-WITH-SHA224'] = { + sign: 'dsa', + hash: 'sha224', + id: new Buffer('', 'hex') +} +exports['DSA-SHA256'] = exports['DSA-WITH-SHA256'] = { + sign: 'dsa', + hash: 'sha256', + id: new Buffer('', 'hex') +} +exports['DSA-SHA384'] = exports['DSA-WITH-SHA384'] = { + sign: 'dsa', + hash: 'sha384', + id: new Buffer('', 'hex') +} +exports['DSA-SHA512'] = exports['DSA-WITH-SHA512'] = { + sign: 'dsa', + hash: 'sha512', + id: new Buffer('', 'hex') +} +exports['DSA-RIPEMD160'] = { + sign: 'dsa', + hash: 'rmd160', + id: new Buffer('', 'hex') +} +exports['RSA-RIPEMD160'] = exports.ripemd160WithRSA = { + sign: 'rsa', + hash: 'rmd160', + id: new Buffer('3021300906052b2403020105000414', 'hex') +} +exports['RSA-MD5'] = exports.md5WithRSAEncryption = { + sign: 'rsa', + hash: 'md5', + id: new Buffer('3020300c06082a864886f70d020505000410', 'hex') +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/algos.json b/node_modules/crypto-browserify/node_modules/browserify-sign/algos.json new file mode 100644 index 00000000..88254555 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/algos.json @@ -0,0 +1,15 @@ +{ + "sha1":"da39a3ee 5e6b4b0d 3255bfef 95601890 afd80709", + + "sha224":"d14a028c 2a3a2bc9 476102bb 288234c4 15a2b01f 828ea62a c5b3e42f", + + "sha256": "e3b0c442 98fc1c14 9afbf4c8 996fb924 27ae41e4 649b934c a495991b 7852b855", + + "sha384": "38b060a7 51ac9638 4cd9327e b1b1e36a 21fdb711 14be0743 4c0cc7bf 63f6e1da 274edebf e76f65fb d51ad2f1 4898b95b", + + "sha512": "cf83e135 7eefb8bd f1542850 d66d8007 d620e405 0b5715dc 83f4a921 d36ce9ce 47d0d13c 5d85f2b0 ff8318d2 877eec2f 63b931bd 47417a81 a538327a f927da3e", + + "sha512/224": "6ed0dd02 806fa89e 25de060c 19d3ac86 cabb87d6 a0ddd05c 333b84f4", + + "sha512/256": "c672b8d1 ef56ed28 ab87c362 2c511406 9bdd3ad7 b8f97374 98d0c01e cef0967a" +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/browser.js b/node_modules/crypto-browserify/node_modules/browserify-sign/browser.js new file mode 100644 index 00000000..f3dd423f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/browser.js @@ -0,0 +1,93 @@ +'use strict' +var sign = require('./sign') +var verify = require('./verify') +var stream = require('stream') +var inherits = require('inherits') +var _algos = require('./algos') +var createHash = require('create-hash') +var algos = {} +Object.keys(_algos).forEach(function (key) { + algos[key] = algos[key.toLowerCase()] = _algos[key] +}) + +exports.createSign = exports.Sign = createSign + +function createSign (algorithm) { + return new Sign(algorithm) +} + +exports.createVerify = exports.Verify = createVerify + +function createVerify (algorithm) { + return new Verify(algorithm) +} + +inherits(Sign, stream.Writable) + +function Sign (algorithm) { + stream.Writable.call(this) + var data = algos[algorithm] + if (!data) + throw new Error('Unknown message digest') + + this._hashType = data.hash + this._hash = createHash(data.hash) + this._tag = data.id + this._signType = data.sign +} + +Sign.prototype._write = function _write (data, _, done) { + this._hash.update(data) + done() +} + +Sign.prototype.update = function update (data, enc) { + if (typeof data === 'string') + data = new Buffer(data, enc) + this._hash.update(data) + return this +} + +Sign.prototype.sign = function signMethod (key, enc) { + this.end() + var hash = this._hash.digest() + var sig = sign(Buffer.concat([this._tag, hash]), key, this._hashType, this._signType) + if (enc) { + sig = sig.toString(enc) + } + return sig +} + +inherits(Verify, stream.Writable) +function Verify (algorithm) { + stream.Writable.call(this) + var data = algos[algorithm] + if (!data) + throw new Error('Unknown message digest') + + this._hash = createHash(data.hash) + this._tag = data.id + this._signType = data.sign +} + +Verify.prototype._write = function _write (data, _, done) { + this._hash.update(data) + done() +} + +Verify.prototype.update = function update (data, enc) { + if (typeof data === 'string') + data = new Buffer(data, enc) + + this._hash.update(data) + return this +} + +Verify.prototype.verify = function verifyMethod (key, sig, enc) { + this.end() + var hash = this._hash.digest() + if (typeof sig === 'string') + sig = new Buffer(sig, enc) + + return verify(sig, Buffer.concat([this._tag, hash]), key, this._signType) +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/curves.js b/node_modules/crypto-browserify/node_modules/browserify-sign/curves.js new file mode 100644 index 00000000..edb31a44 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/curves.js @@ -0,0 +1,8 @@ +'use strict' +exports['1.3.132.0.10'] = 'secp256k1' + +exports['1.3.132.0.33'] = 'p224' + +exports['1.2.840.10045.3.1.1'] = 'p192' + +exports['1.2.840.10045.3.1.7'] = 'p256' diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/ec.param b/node_modules/crypto-browserify/node_modules/browserify-sign/ec.param new file mode 100644 index 00000000..9728ddda --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/ec.param @@ -0,0 +1,3 @@ +-----BEGIN EC PARAMETERS----- +BgUrgQQAIQ== +-----END EC PARAMETERS----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/index.js new file mode 100644 index 00000000..dafa0bc3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/index.js @@ -0,0 +1,7 @@ +var crypto = require('crypto') + +exports.createSign = crypto.createSign +exports.Sign = crypto.Sign + +exports.createVerify = crypto.createVerify +exports.Verify = crypto.Verify diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/.jshintrc b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/.jshintrc new file mode 100644 index 00000000..add7282d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/.jshintrc @@ -0,0 +1,89 @@ +{ + // JSHint Default Configuration File (as on JSHint website) + // See http://jshint.com/docs/ for more details + + "maxerr" : 50, // {int} Maximum error before stopping + + // Enforcing + "bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.) + "camelcase" : true, // true: Identifiers must be in camelCase + "curly" : false, // true: Require {} for every new block or scope + "eqeqeq" : true, // true: Require triple equals (===) for comparison + "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() + "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. + "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` + "indent" : 2, // {int} Number of spaces to use for indentation + "latedef" : false, // true: Require variables/functions to be defined before being used + "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` + "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` + "noempty" : false, // true: Prohibit use of empty blocks + "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. + "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) + "plusplus" : false, // true: Prohibit use of `++` & `--` + "quotmark" : "single", // Quotation mark consistency: + // false : do nothing (default) + // true : ensure whatever is used is consistent + // "single" : require single quotes + // "double" : require double quotes + "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) + "unused" : true, // true: Require all defined variables be used + "strict" : true, // true: Requires all functions run in ES5 Strict Mode + "maxparams" : false, // {int} Max number of formal params allowed per function + "maxdepth" : false, // {int} Max depth of nested blocks (within functions) + "maxstatements" : false, // {int} Max number statements per function + "maxcomplexity" : false, // {int} Max cyclomatic complexity per function + "maxlen" : false, // {int} Max number of characters per line + + // Relaxing + "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) + "boss" : false, // true: Tolerate assignments where comparisons would be expected + "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // true: Tolerate use of `== null` + "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) + "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`) + "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) + // (ex: `for each`, multiple try/catch, function expression…) + "evil" : false, // true: Tolerate use of `eval` and `new Function()` + "expr" : false, // true: Tolerate `ExpressionStatement` as Programs + "funcscope" : false, // true: Tolerate defining variables inside control statements + "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') + "iterator" : false, // true: Tolerate using the `__iterator__` property + "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block + "laxbreak" : false, // true: Tolerate possibly unsafe line breakings + "laxcomma" : false, // true: Tolerate comma-first style coding + "loopfunc" : false, // true: Tolerate functions being defined in loops + "multistr" : false, // true: Tolerate multi-line strings + "noyield" : false, // true: Tolerate generator functions with no yield statement in them. + "notypeof" : false, // true: Tolerate invalid typeof operator values + "proto" : false, // true: Tolerate using the `__proto__` property + "scripturl" : false, // true: Tolerate script-targeted URLs + "shadow" : true, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` + "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation + "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` + "validthis" : false, // true: Tolerate using this in a non-constructor function + + // Environments + "browser" : true, // Web Browser (window, document, etc) + "browserify" : false, // Browserify (node.js code in the browser) + "couch" : false, // CouchDB + "devel" : true, // Development/debugging (alert, confirm, etc) + "dojo" : false, // Dojo Toolkit + "jasmine" : false, // Jasmine + "jquery" : false, // jQuery + "mocha" : true, // Mocha + "mootools" : false, // MooTools + "node" : false, // Node.js + "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) + "prototypejs" : false, // Prototype and Scriptaculous + "qunit" : false, // QUnit + "rhino" : false, // Rhino + "shelljs" : false, // ShellJS + "worker" : false, // Web Workers + "wsh" : false, // Windows Scripting Host + "yui" : false, // Yahoo User Interface + + // Custom Globals + "globals" : { + "module": true + } // additional predefined global variables +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/.npmignore b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/.npmignore new file mode 100644 index 00000000..bfd1047d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/.npmignore @@ -0,0 +1,3 @@ +benchmarks/ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/.travis.yml b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/.travis.yml new file mode 100644 index 00000000..92a990f6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.11" +branches: + only: + - master diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/README.md b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/README.md new file mode 100644 index 00000000..3d970712 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/README.md @@ -0,0 +1,28 @@ +# bn.js [![Build Status](https://secure.travis-ci.org/indutny/bn.js.png)](http://travis-ci.org/indutny/bn.js) + +Just a bike-shed. + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2015. + +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/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js new file mode 100644 index 00000000..7ed21368 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/lib/bn.js @@ -0,0 +1,2133 @@ +(function(module, exports) { + +'use strict'; + +// Utils + +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} + +// Could use `inherits` module, but don't want to move from single file +// architecture yet. +function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; +} + +// BN + +function BN(number, base, endian) { + // May be `new BN(bn)` ? + if (number !== null && + typeof number === 'object' && + Array.isArray(number.words)) { + return number; + } + + this.sign = false; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + if (number !== null) + this._init(number || 0, base || 10, endian || 'be'); +} +if (typeof module === 'object') + module.exports = BN; +else + exports.BN = BN; + +BN.BN = BN; +BN.wordSize = 26; + +BN.prototype._init = function init(number, base, endian) { + if (typeof number === 'number') { + if (number < 0) { + this.sign = true; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } + return; + } else if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + if (base === 'hex') + base = 16; + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') + start++; + + if (base === 16) + this._parseHex(number, start); + else + this._parseBase(number, base, start); + + if (number[0] === '-') + this.sign = true; + + this.strip(); +}; + +BN.prototype._initArray = function _initArray(number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + var off = 0; + if (endian === 'be') { + for (var i = number.length - 1, j = 0; i >= 0; i -= 3) { + var w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (var i = 0, j = 0; i < number.length; i += 3) { + var w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); +}; + +function parseHex(str, start, end) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r <<= 4; + + // 'a' - 'f' + if (c >= 49 && c <= 54) + r |= c - 49 + 0xa; + + // 'A' - 'F' + else if (c >= 17 && c <= 22) + r |= c - 17 + 0xa; + + // '0' - '9' + else + r |= c & 0xf; + } + return r; +} + +BN.prototype._parseHex = function _parseHex(number, start) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + // Scan 24-bit chunks and add them to the number + var off = 0; + for (var i = number.length - 6, j = 0; i >= start; i -= 6) { + var w = parseHex(number, i, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + if (i + 6 !== start) { + var w = parseHex(number, start, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + } + this.strip(); +}; + +function parseBase(str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) + r += c - 49 + 0xa; + + // 'A' + else if (c >= 17) + r += c - 17 + 0xa; + + // '0' - '9' + else + r += c; + } + return r; +} + +BN.prototype._parseBase = function _parseBase(number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) + limbLen++; + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } + + if (mod !== 0) { + var pow = 1; + var word = parseBase(number, i, number.length, base); + + for (var i = 0; i < mod; i++) + pow *= base; + this.imuln(pow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } +}; + +BN.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + dest.words[i] = this.words[i]; + dest.length = this.length; + dest.sign = this.sign; + dest.red = this.red; +}; + +BN.prototype.clone = function clone() { + var r = new BN(null); + this.copy(r); + return r; +}; + +// Remove leading `0` from `this` +BN.prototype.strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) + this.length--; + return this._normSign(); +}; + +BN.prototype._normSign = function _normSign() { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) + this.sign = false; + return this; +}; + +BN.prototype.inspect = function inspect() { + return (this.red ? ''; +}; + +/* + +var zeros = []; +var groupSizes = []; +var groupBases = []; + +var s = ''; +var i = -1; +while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; +} +groupSizes[0] = 0; +groupSizes[1] = 0; +groupBases[0] = 0; +groupBases[1] = 0; +var base = 2 - 1; +while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; +} + +*/ + +var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' +]; + +var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +]; + +var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 +]; + +BN.prototype.toString = function toString(base, padding) { + base = base || 10; + if (base === 16 || base === 'hex') { + var out = ''; + var off = 0; + var padding = padding | 0 || 1; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) + out = zeros[6 - word.length] + word + out; + else + out = word + out; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) + out = carry.toString(16) + out; + while (out.length % padding !== 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + var out = ''; + var c = this.clone(); + c.sign = false; + while (c.cmpn(0) !== 0) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (c.cmpn(0) !== 0) + out = zeros[groupSize - r.length] + r + out; + else + out = r + out; + } + if (this.cmpn(0) === 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else { + assert(false, 'Base should be between 2 and 36'); + } +}; + +BN.prototype.toJSON = function toJSON() { + return this.toString(16); +}; + +BN.prototype.toArray = function toArray() { + this.strip(); + var res = new Array(this.byteLength()); + res[0] = 0; + + var q = this.clone(); + for (var i = 0; q.cmpn(0) !== 0; i++) { + var b = q.andln(0xff); + q.ishrn(8); + + // Assume big-endian + res[res.length - i - 1] = b; + } + + return res; +}; + +/* +function genCountBits(bits) { + var arr = []; + + for (var i = bits - 1; i >= 0; i--) { + var bit = '0x' + (1 << i).toString(16); + arr.push('w >= ' + bit + ' ? ' + (i + 1)); + } + + return new Function('w', 'return ' + arr.join(' :\n') + ' :\n0;'); +}; + +BN.prototype._countBits = genCountBits(26); +*/ + +// Sadly chrome apps could not contain `new Function()` calls +BN.prototype._countBits = function _countBits(w) { + return w >= 0x2000000 ? 26 : + w >= 0x1000000 ? 25 : + w >= 0x800000 ? 24 : + w >= 0x400000 ? 23 : + w >= 0x200000 ? 22 : + w >= 0x100000 ? 21 : + w >= 0x80000 ? 20 : + w >= 0x40000 ? 19 : + w >= 0x20000 ? 18 : + w >= 0x10000 ? 17 : + w >= 0x8000 ? 16 : + w >= 0x4000 ? 15 : + w >= 0x2000 ? 14 : + w >= 0x1000 ? 13 : + w >= 0x800 ? 12 : + w >= 0x400 ? 11 : + w >= 0x200 ? 10 : + w >= 0x100 ? 9 : + w >= 0x80 ? 8 : + w >= 0x40 ? 7 : + w >= 0x20 ? 6 : + w >= 0x10 ? 5 : + w >= 0x8 ? 4 : + w >= 0x4 ? 3 : + w >= 0x2 ? 2 : + w >= 0x1 ? 1 : + 0; +}; + +// Return number of used bits in a BN +BN.prototype.bitLength = function bitLength() { + var hi = 0; + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; +}; + +BN.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); +}; + +// Return negative clone of `this` +BN.prototype.neg = function neg() { + if (this.cmpn(0) === 0) + return this.clone(); + + var r = this.clone(); + r.sign = !this.sign; + return r; +}; + + +// Or `num` with `this` in-place +BN.prototype.ior = function ior(num) { + this.sign = this.sign || num.sign; + + while (this.length < num.length) + this.words[this.length++] = 0; + + for (var i = 0; i < num.length; i++) + this.words[i] = this.words[i] | num.words[i]; + + return this.strip(); +}; + + +// Or `num` with `this` +BN.prototype.or = function or(num) { + if (this.length > num.length) + return this.clone().ior(num); + else + return num.clone().ior(this); +}; + + +// And `num` with `this` in-place +BN.prototype.iand = function iand(num) { + this.sign = this.sign && num.sign; + + // b = min-length(num, this) + var b; + if (this.length > num.length) + b = num; + else + b = this; + + for (var i = 0; i < b.length; i++) + this.words[i] = this.words[i] & num.words[i]; + + this.length = b.length; + + return this.strip(); +}; + + +// And `num` with `this` +BN.prototype.and = function and(num) { + if (this.length > num.length) + return this.clone().iand(num); + else + return num.clone().iand(this); +}; + + +// Xor `num` with `this` in-place +BN.prototype.ixor = function ixor(num) { + this.sign = this.sign || num.sign; + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) + this.words[i] = a.words[i] ^ b.words[i]; + + if (this !== a) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + + this.length = a.length; + + return this.strip(); +}; + + +// Xor `num` with `this` +BN.prototype.xor = function xor(num) { + if (this.length > num.length) + return this.clone().ixor(num); + else + return num.clone().ixor(this); +}; + + +// Set `bit` of `this` +BN.prototype.setn = function setn(bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + while (this.length <= off) + this.words[this.length++] = 0; + + if (val) + this.words[off] = this.words[off] | (1 << wbit); + else + this.words[off] = this.words[off] & ~(1 << wbit); + + return this.strip(); +}; + + +// Add `num` to `this` in-place +BN.prototype.iadd = function iadd(num) { + // negative + positive + if (this.sign && !num.sign) { + this.sign = false; + var r = this.isub(num); + this.sign = !this.sign; + return this._normSign(); + + // positive + negative + } else if (!this.sign && num.sign) { + num.sign = false; + var r = this.isub(num); + num.sign = true; + return r._normSign(); + } + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] + b.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) + this.words[i] = a.words[i]; + } + + return this; +}; + +// Add `num` to `this` +BN.prototype.add = function add(num) { + if (num.sign && !this.sign) { + num.sign = false; + var res = this.sub(num); + num.sign = true; + return res; + } else if (!num.sign && this.sign) { + this.sign = false; + var res = num.sub(this); + this.sign = true; + return res; + } + + if (this.length > num.length) + return this.clone().iadd(num); + else + return num.clone().iadd(this); +}; + +// Subtract `num` from `this` in-place +BN.prototype.isub = function isub(num) { + // this - (-num) = this + num + if (num.sign) { + num.sign = false; + var r = this.iadd(num); + num.sign = true; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.sign) { + this.sign = false; + this.iadd(num); + this.sign = true; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.sign = false; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a; + var b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] - b.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + this.length = Math.max(this.length, i); + + if (a !== this) + this.sign = true; + + return this.strip(); +}; + +// Subtract `num` from `this` +BN.prototype.sub = function sub(num) { + return this.clone().isub(num); +}; + +/* +// NOTE: This could be potentionally used to generate loop-less multiplications +function _genCombMulTo(alen, blen) { + var len = alen + blen - 1; + var src = [ + 'var a = this.words, b = num.words, o = out.words, c = 0, w, ' + + 'mask = 0x3ffffff, shift = 0x4000000;', + 'out.length = ' + len + ';' + ]; + for (var k = 0; k < len; k++) { + var minJ = Math.max(0, k - alen + 1); + var maxJ = Math.min(k, blen - 1); + + for (var j = minJ; j <= maxJ; j++) { + var i = k - j; + var mul = 'a[' + i + '] * b[' + j + ']'; + + if (j === minJ) { + src.push('w = ' + mul + ' + c;'); + src.push('c = (w / shift) | 0;'); + } else { + src.push('w += ' + mul + ';'); + src.push('c += (w / shift) | 0;'); + } + src.push('w &= mask;'); + } + src.push('o[' + k + '] = w;'); + } + src.push('if (c !== 0) {', + ' o[' + k + '] = c;', + ' out.length++;', + '}', + 'return out;'); + + return src.join('\n'); +} +*/ + +BN.prototype._smallMulTo = function _smallMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + } + out.words[k] = rword; + carry = ncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype._bigMulTo = function _bigMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype.mulTo = function mulTo(num, out) { + var res; + if (this.length + num.length < 63) + res = this._smallMulTo(num, out); + else + res = this._bigMulTo(num, out); + return res; +}; + +// Multiply `this` by `num` +BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); +}; + +// In-place Multiplication +BN.prototype.imul = function imul(num) { + if (this.cmpn(0) === 0 || num.cmpn(0) === 0) { + this.words[0] = 0; + this.length = 1; + return this; + } + + var tlen = this.length; + var nlen = num.length; + + this.sign = num.sign !== this.sign; + this.length = this.length + num.length; + this.words[this.length - 1] = 0; + + for (var k = this.length - 2; k >= 0; k--) { + // Sum all words with the same `i + j = k` and accumulate `carry`, + // note that carry could be >= 0x3ffffff + var carry = 0; + var rword = 0; + var maxJ = Math.min(k, nlen - 1); + for (var j = Math.max(0, k - tlen + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i]; + var b = num.words[j]; + var r = a * b; + + var lo = r & 0x3ffffff; + carry += (r / 0x4000000) | 0; + lo += rword; + rword = lo & 0x3ffffff; + carry += lo >>> 26; + } + this.words[k] = rword; + this.words[k + 1] += carry; + carry = 0; + } + + // Propagate overflows + var carry = 0; + for (var i = 1; i < this.length; i++) { + var w = this.words[i] + carry; + this.words[i] = w & 0x3ffffff; + carry = w >>> 26; + } + + return this.strip(); +}; + +BN.prototype.imuln = function imuln(num) { + assert(typeof num === 'number'); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i] * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; +}; + +// `this` * `this` +BN.prototype.sqr = function sqr() { + return this.mul(this); +}; + +// `this` * `this` in-place +BN.prototype.isqr = function isqr() { + return this.mul(this); +}; + +// Shift-left in-place +BN.prototype.ishln = function ishln(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + + if (r !== 0) { + var carry = 0; + for (var i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = (this.words[i] - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (var i = this.length - 1; i >= 0; i--) + this.words[i + s] = this.words[i]; + for (var i = 0; i < s; i++) + this.words[i] = 0; + this.length += s; + } + + return this.strip(); +}; + +// Shift-right in-place +// NOTE: `hint` is a lowest bit before trailing zeroes +// NOTE: if `extended` is true - { lo: ..., hi: } object will be returned +BN.prototype.ishrn = function ishrn(bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + if (hint) + hint = (hint - (hint % 26)) / 26; + else + hint = 0; + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + hint -= s; + hint = Math.max(0, hint); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) + maskedWords.words[i] = this.words[i]; + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (var i = 0; i < this.length; i++) + this.words[i] = this.words[i + s]; + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (var i = this.length - 1; i >= 0 && (carry !== 0 || i >= hint); i--) { + var word = this.words[i]; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) + maskedWords.words[maskedWords.length++] = carry; + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + this.strip(); + if (extended) + return { hi: this, lo: maskedWords }; + + return this; +}; + +// Shift-left +BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); +}; + +// Shift-right +BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); +}; + +// Test if n bit is set +BN.prototype.testn = function testn(bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + return false; + } + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); +}; + +// Return only lowers bits of number (in-place) +BN.prototype.imaskn = function imaskn(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(!this.sign, 'imaskn works only with positive numbers'); + + if (r !== 0) + s++; + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); +}; + +// Return only lowers bits of number +BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); +}; + +// Add plain number `num` to `this` +BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.isubn(-num); + + // Possible sign change + if (this.sign) { + if (this.length === 1 && this.words[0] < num) { + this.words[0] = num - this.words[0]; + this.sign = false; + return this; + } + + this.sign = false; + this.isubn(num); + this.sign = true; + return this; + } + + // Add without checks + return this._iaddn(num); +}; + +BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) + this.words[i + 1] = 1; + else + this.words[i + 1]++; + } + this.length = Math.max(this.length, i + 1); + + return this; +}; + +// Subtract plain number `num` from `this` +BN.prototype.isubn = function isubn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.iaddn(-num); + + if (this.sign) { + this.sign = false; + this.iaddn(num); + this.sign = true; + return this; + } + + this.words[0] -= num; + + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + + return this.strip(); +}; + +BN.prototype.addn = function addn(num) { + return this.clone().iaddn(num); +}; + +BN.prototype.subn = function subn(num) { + return this.clone().isubn(num); +}; + +BN.prototype.iabs = function iabs() { + this.sign = false; + + return this; +}; + +BN.prototype.abs = function abs() { + return this.clone().iabs(); +}; + +BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) { + // Bigger storage is needed + var len = num.length + shift; + var i; + if (this.words.length < len) { + var t = new Array(len); + for (var i = 0; i < this.length; i++) + t[i] = this.words[i]; + this.words = t; + } else { + i = this.length; + } + + // Zeroify rest + this.length = Math.max(this.length, len); + for (; i < this.length; i++) + this.words[i] = 0; + + var carry = 0; + for (var i = 0; i < num.length; i++) { + var w = this.words[i + shift] + carry; + var right = num.words[i] * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + var w = this.words[i + shift] + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) + return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (var i = 0; i < this.length; i++) { + var w = -this.words[i] + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.sign = true; + + return this.strip(); +}; + +BN.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1]; + for (var shift = 0; bhi < 0x2000000; shift++) + bhi <<= 1; + if (shift !== 0) { + b = b.shln(shift); + a.ishln(shift); + bhi = b.words[b.length - 1]; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) + q.words[i] = 0; + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (!diff.sign) { + a = diff; + if (q) + q.words[m] = 1; + } + + for (var j = m - 1; j >= 0; j--) { + var qj = a.words[b.length + j] * 0x4000000 + a.words[b.length + j - 1]; + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.sign) { + qj--; + a.sign = false; + a._ishlnsubmul(b, 1, j); + a.sign = !a.sign; + } + if (q) + q.words[j] = qj; + } + if (q) + q.strip(); + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) + a.ishrn(shift); + return { div: q ? q : null, mod: a }; +}; + +BN.prototype.divmod = function divmod(num, mode) { + assert(num.cmpn(0) !== 0); + + if (this.sign && !num.sign) { + var res = this.neg().divmod(num, mode); + var div; + var mod; + if (mode !== 'mod') + div = res.div.neg(); + if (mode !== 'div') + mod = res.mod.cmpn(0) === 0 ? res.mod : num.sub(res.mod); + return { + div: div, + mod: mod + }; + } else if (!this.sign && num.sign) { + var res = this.divmod(num.neg(), mode); + var div; + if (mode !== 'mod') + div = res.div.neg(); + return { div: div, mod: res.mod }; + } else if (this.sign && num.sign) { + return this.neg().divmod(num.neg(), mode); + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) + return { div: new BN(0), mod: this }; + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') + return { div: this.divn(num.words[0]), mod: null }; + else if (mode === 'mod') + return { div: null, mod: new BN(this.modn(num.words[0])) }; + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); +}; + +// Find `this` / `num` +BN.prototype.div = function div(num) { + return this.divmod(num, 'div').div; +}; + +// Find `this` % `num` +BN.prototype.mod = function mod(num) { + return this.divmod(num, 'mod').mod; +}; + +// Find Round(`this` / `num`) +BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.cmpn(0) === 0) + return dm.div; + + var mod = dm.div.sign ? dm.mod.isub(num) : dm.mod; + + var half = num.shrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) + return dm.div; + + // Round up + return dm.div.sign ? dm.div.isubn(1) : dm.div.iaddn(1); +}; + +BN.prototype.modn = function modn(num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) + acc = (p * acc + this.words[i]) % num; + + return acc; +}; + +// In-place division by number +BN.prototype.idivn = function idivn(num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = this.words[i] + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); +}; + +BN.prototype.divn = function divn(num) { + return this.clone().idivn(num); +}; + +BN.prototype._egcd = function _egcd(x1, p) { + assert(!p.sign); + assert(p.cmpn(0) !== 0); + + var a = this; + var b = p.clone(); + + if (a.sign) + a = a.mod(p); + else + a = a.clone(); + + var x2 = new BN(0); + while (b.isEven()) + b.ishrn(1); + var delta = b.clone(); + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + while (a.isEven()) { + a.ishrn(1); + if (x1.isEven()) + x1.ishrn(1); + else + x1.iadd(delta).ishrn(1); + } + while (b.isEven()) { + b.ishrn(1); + if (x2.isEven()) + x2.ishrn(1); + else + x2.iadd(delta).ishrn(1); + } + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + if (a.cmpn(1) === 0) + return x1; + else + return x2; +}; + +BN.prototype.gcd = function gcd(num) { + if (this.cmpn(0) === 0) + return num.clone(); + if (num.cmpn(0) === 0) + return this.clone(); + + var a = this.clone(); + var b = num.clone(); + a.sign = false; + b.sign = false; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.ishrn(1); + b.ishrn(1); + } + + while (a.isEven()) + a.ishrn(1); + + do { + while (b.isEven()) + b.ishrn(1); + + // Swap `a` and `b` to make `a` always bigger than `b` + if (a.cmp(b) < 0) { + var t = a; + a = b; + b = t; + } + a.isub(a.div(b).mul(b)); + } while (a.cmpn(0) !== 0 && b.cmpn(0) !== 0); + if (a.cmpn(0) === 0) + return b.ishln(shift); + else + return a.ishln(shift); +}; + +// Invert number in the field F(num) +BN.prototype.invm = function invm(num) { + return this._egcd(new BN(1), num).mod(num); +}; + +BN.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; +}; + +BN.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; +}; + +// And first word and num +BN.prototype.andln = function andln(num) { + return this.words[0] & num; +}; + +// Increment at the bit position in-line +BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + for (var i = this.length; i < s + 1; i++) + this.words[i] = 0; + this.words[s] |= q; + this.length = s + 1; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i]; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; +}; + +BN.prototype.cmpn = function cmpn(num) { + var sign = num < 0; + if (sign) + num = -num; + + if (this.sign && !sign) + return -1; + else if (!this.sign && sign) + return 1; + + num &= 0x3ffffff; + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + var w = this.words[0]; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.sign) + res = -res; + return res; +}; + +// Compare two numbers and return: +// 1 - if `this` > `num` +// 0 - if `this` == `num` +// -1 - if `this` < `num` +BN.prototype.cmp = function cmp(num) { + if (this.sign && !num.sign) + return -1; + else if (!this.sign && num.sign) + return 1; + + var res = this.ucmp(num); + if (this.sign) + return -res; + else + return res; +}; + +// Unsigned comparison +BN.prototype.ucmp = function ucmp(num) { + // At this point both numbers have the same sign + if (this.length > num.length) + return 1; + else if (this.length < num.length) + return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i]; + var b = num.words[i]; + + if (a === b) + continue; + if (a < b) + res = -1; + else if (a > b) + res = 1; + break; + } + return res; +}; + +// +// A reduce context, could be using montgomery or something better, depending +// on the `m` itself. +// +BN.red = function red(num) { + return new Red(num); +}; + +BN.prototype.toRed = function toRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(!this.sign, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); +}; + +BN.prototype.fromRed = function fromRed() { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); +}; + +BN.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; +}; + +BN.prototype.forceRed = function forceRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); +}; + +BN.prototype.redAdd = function redAdd(num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); +}; + +BN.prototype.redIAdd = function redIAdd(num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); +}; + +BN.prototype.redSub = function redSub(num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); +}; + +BN.prototype.redISub = function redISub(num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); +}; + +BN.prototype.redShl = function redShl(num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); +}; + +BN.prototype.redMul = function redMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); +}; + +BN.prototype.redIMul = function redIMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); +}; + +BN.prototype.redSqr = function redSqr() { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); +}; + +BN.prototype.redISqr = function redISqr() { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); +}; + +// Square root over p +BN.prototype.redSqrt = function redSqrt() { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); +}; + +BN.prototype.redInvm = function redInvm() { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); +}; + +// Return negative clone of `this` % `red modulo` +BN.prototype.redNeg = function redNeg() { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); +}; + +BN.prototype.redPow = function redPow(num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); +}; + +// Prime numbers with efficient reduction +var primes = { + k256: null, + p224: null, + p192: null, + p25519: null +}; + +// Pseudo-Mersenne prime +function MPrime(name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).ishln(this.n).isub(this.p); + + this.tmp = this._tmp(); +} + +MPrime.prototype._tmp = function _tmp() { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; +}; + +MPrime.prototype.ireduce = function ireduce(num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + var pair = r.ishrn(this.n, 0, this.tmp); + r = this.imulK(pair.hi); + r = r.iadd(pair.lo); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.cmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + r.strip(); + } + + return r; +}; + +MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); +}; + +function K256() { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); +} +inherits(K256, MPrime); + +K256.prototype.imulK = function imulK(num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var hi; + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i]; + hi = w * 0x40; + lo += w * 0x3d1; + hi += (lo / 0x4000000) | 0; + lo &= 0x3ffffff; + + num.words[i] = lo; + + lo = hi; + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) + num.length--; + } + return num; +}; + +function P224() { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); +} +inherits(P224, MPrime); + +function P192() { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); +} +inherits(P192, MPrime); + +function P25519() { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); +} +inherits(P25519, MPrime); + +P25519.prototype.imulK = function imulK(num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = num.words[i] * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) + num.words[num.length++] = carry; + return num; +}; + +// Exported mostly for testing purposes, use plain name instead +BN._prime = function prime(name) { + // Cached version of prime + if (primes[name]) + return primes[name]; + + var prime; + if (name === 'k256') + prime = new K256(); + else if (name === 'p224') + prime = new P224(); + else if (name === 'p192') + prime = new P192(); + else if (name === 'p25519') + prime = new P25519(); + else + throw new Error('Unknown prime ' + name); + primes[name] = prime; + + return prime; +}; + +// +// Base reduction engine +// +function Red(m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + this.m = m; + this.prime = null; + } +} + +Red.prototype._verify1 = function _verify1(a) { + assert(!a.sign, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); +}; + +Red.prototype._verify2 = function _verify2(a, b) { + assert(!a.sign && !b.sign, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); +}; + +Red.prototype.imod = function imod(a) { + if (this.prime) + return this.prime.ireduce(a)._forceRed(this); + return a.mod(this.m)._forceRed(this); +}; + +Red.prototype.neg = function neg(a) { + var r = a.clone(); + r.sign = !r.sign; + return r.iadd(this.m)._forceRed(this); +}; + +Red.prototype.add = function add(a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res._forceRed(this); +}; + +Red.prototype.iadd = function iadd(a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res; +}; + +Red.prototype.sub = function sub(a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res._forceRed(this); +}; + +Red.prototype.isub = function isub(a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res; +}; + +Red.prototype.shl = function shl(a, num) { + this._verify1(a); + return this.imod(a.shln(num)); +}; + +Red.prototype.imul = function imul(a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); +}; + +Red.prototype.mul = function mul(a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); +}; + +Red.prototype.isqr = function isqr(a) { + return this.imul(a, a); +}; + +Red.prototype.sqr = function sqr(a) { + return this.mul(a, a); +}; + +Red.prototype.sqrt = function sqrt(a) { + if (a.cmpn(0) === 0) + return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).ishrn(2); + var r = this.pow(a, pow); + return r; + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (q.cmpn(0) !== 0 && q.andln(1) === 0) { + s++; + q.ishrn(1); + } + assert(q.cmpn(0) !== 0); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).ishrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + while (this.pow(z, lpow).cmp(nOne) !== 0) + z.redIAdd(nOne); + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).ishrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) + tmp = tmp.redSqr(); + assert(i < m); + var b = this.pow(c, new BN(1).ishln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; +}; + +Red.prototype.invm = function invm(a) { + var inv = a._egcd(new BN(1), this.m); + if (inv.sign) { + inv.sign = false; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } +}; + +Red.prototype.pow = function pow(a, num) { + var w = []; + var q = num.clone(); + while (q.cmpn(0) !== 0) { + w.push(q.andln(1)); + q.ishrn(1); + } + + // Skip leading zeroes + var res = a; + for (var i = 0; i < w.length; i++, res = this.sqr(res)) + if (w[i] !== 0) + break; + + if (++i < w.length) { + for (var q = this.sqr(res); i < w.length; i++, q = this.sqr(q)) { + if (w[i] === 0) + continue; + res = this.mul(res, q); + } + } + + return res; +}; + +Red.prototype.convertTo = function convertTo(num) { + return num.clone(); +}; + +Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; +}; + +// +// Montgomery method engine +// + +BN.mont = function mont(num) { + return new Mont(num); +}; + +function Mont(m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) + this.shift += 26 - (this.shift % 26); + this.r = new BN(1).ishln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r.invm(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv.sign = true; + this.minv = this.minv.mod(this.r); +} +inherits(Mont, Red); + +Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.shln(this.shift)); +}; + +Mont.prototype.convertFrom = function convertFrom(num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; +}; + +Mont.prototype.imul = function imul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.mul = function mul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) + return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.invm = function invm(a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a.invm(this.m).mul(this.r2)); + return res._forceRed(this); +}; + +})(typeof module === 'undefined' || module, this); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/package.json new file mode 100644 index 00000000..37475efb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/package.json @@ -0,0 +1,56 @@ +{ + "name": "bn.js", + "version": "1.3.0", + "description": "Big number implementation in pure javascript", + "main": "lib/bn.js", + "scripts": { + "test": "jshint lib/*.js && mocha --reporter=spec test/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/bn.js" + }, + "keywords": [ + "BN", + "BigNum", + "Big number", + "Modulo", + "Montgomery" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/bn.js/issues" + }, + "homepage": "https://github.com/indutny/bn.js", + "devDependencies": { + "jshint": "^2.6.0", + "mocha": "^2.1.0" + }, + "gitHead": "3d156a29566f2172b39ebcc0ec00cc3af4c205f8", + "_id": "bn.js@1.3.0", + "_shasum": "0db4cbf96f8f23b742f5bcb9d1aa7a9994a05e83", + "_from": "bn.js@>=1.0.0 <2.0.0", + "_npmVersion": "2.4.1", + "_nodeVersion": "1.1.0", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "0db4cbf96f8f23b742f5bcb9d1aa7a9994a05e83", + "tarball": "http://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/bn-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/bn-test.js new file mode 100644 index 00000000..c53ac5f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/bn-test.js @@ -0,0 +1,506 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN', function() { + it('should work with Number input', function() { + assert.equal(new BN(12345).toString(16), '3039'); + assert.equal(new BN(0x4123456).toString(16), '4123456'); + }); + + it('should work with String input', function() { + assert.equal(new BN('29048849665247').toString(16), + '1a6b765d8cdf'); + assert.equal(new BN('-29048849665247').toString(16), + '-1a6b765d8cdf'); + assert.equal(new BN('1A6B765D8CDF', 16).toString(16), + '1a6b765d8cdf'); + assert.equal(new BN('FF', 16).toString(), '255'); + assert.equal(new BN('1A6B765D8CDF', 16).toString(), + '29048849665247'); + assert.equal(new BN('a89c e5af8724 c0a23e0e 0ff77500', 16).toString(16), + 'a89ce5af8724c0a23e0e0ff77500'); + assert.equal(new BN('123456789abcdef123456789abcdef123456789abcdef', + 16).toString(16), + '123456789abcdef123456789abcdef123456789abcdef'); + assert.equal(new BN('10654321').toString(), '10654321'); + assert.equal(new BN('10000000000000000').toString(10), + '10000000000000000'); + var base2 = '11111111111111111111111111111111111111111111111111111'; + assert.equal(new BN(base2, 2).toString(2), base2); + var base36 = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'; + assert.equal(new BN(base36, 36).toString(36), base36); + + assert( + new BN('6582018229284824168619876730229320890292528855852623664389292032') + .words[0] < 0x4000000); + }); + + it('should import/export big endian', function() { + assert.equal(new BN([1,2,3]).toString(16), '10203'); + assert.equal(new BN([1,2,3,4]).toString(16), '1020304'); + assert.equal(new BN([1,2,3,4,5]).toString(16), '102030405'); + assert.equal(new BN([1,2,3,4,5,6,7,8]).toString(16), '102030405060708'); + assert.equal(new BN([1,2,3,4]).toArray().join(','), '1,2,3,4'); + assert.equal(new BN([1,2,3,4,5,6,7,8]).toArray().join(','), + '1,2,3,4,5,6,7,8'); + }); + + it('should import little endian', function() { + assert.equal(new BN([1,2,3], 10, 'le').toString(16), '30201'); + assert.equal(new BN([1,2,3,4], 10, 'le').toString(16), '4030201'); + assert.equal(new BN([1,2,3,4,5], 10, 'le').toString(16), '504030201'); + assert.equal(new BN([1,2,3,4,5,6,7,8], 10, 'le').toString(16), '807060504030201'); + }); + + it('should return proper bitLength', function() { + assert.equal(new BN(0).bitLength(), 0); + assert.equal(new BN(0x1).bitLength(), 1); + assert.equal(new BN(0x2).bitLength(), 2); + assert.equal(new BN(0x3).bitLength(), 2); + assert.equal(new BN(0x4).bitLength(), 3); + assert.equal(new BN(0x8).bitLength(), 4); + assert.equal(new BN(0x10).bitLength(), 5); + assert.equal(new BN(0x100).bitLength(), 9); + assert.equal(new BN(0x123456).bitLength(), 21); + assert.equal(new BN('123456789', 16).bitLength(), 33); + assert.equal(new BN('8023456789', 16).bitLength(), 40); + }); + + it('should add numbers', function() { + assert.equal(new BN(14).add(new BN(26)).toString(16), '28'); + var k = new BN(0x1234); + var r = k; + for (var i = 0; i < 257; i++) + r = r.add(k); + assert.equal(r.toString(16), '125868'); + + var k = new BN('abcdefabcdefabcdef', 16); + var r = new BN('deadbeef', 16); + for (var i = 0; i < 257; i++) + r.iadd(k); + assert.equal(r.toString(16), 'ac79bd9b79be7a277bde'); + }); + + describe('hex padding', function(){ + it('should have length of 8 from leading 15', function(){ + var a = new BN('ffb9602', 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 8); + }); + + it('should have length of 8 from leading zero', function(){ + var a = new BN('fb9604', 16); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 8 from leading zeros', function(){ + var a = new BN(0); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 64 from leading 15', function(){ + var a = new BN( + 'ffb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 64); + }); + + it('should have length of 64 from leading zero', function(){ + var a = new BN( + 'fb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 64), 'hex'); + assert.equal(a.toString('hex', 64).length, 64); + }); + }); + + describe('iaddn', function() { + it('should allow a sign change', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.iaddn(200) + + assert.equal(a.sign, false) + assert.equal(a.toString(), '100') + }) + }) + + it('should subtract numbers', function() { + assert.equal(new BN(14).sub(new BN(26)).toString(16), '-c'); + assert.equal(new BN(26).sub(new BN(14)).toString(16), 'c'); + assert.equal(new BN(26).sub(new BN(26)).toString(16), '0'); + assert.equal(new BN(-26).sub(new BN(26)).toString(16), '-34'); + + var a = new BN( + '31ff3c61db2db84b9823d320907a573f6ad37c437abe458b1802cda041d6384' + + 'a7d8daef41395491e2', + 16); + var b = new BN( + '6f0e4d9f1d6071c183677f601af9305721c91d31b0bbbae8fb790000', + 16); + var r = new BN( + '31ff3c61db2db84b9823d3208989726578fd75276287cd9516533a9acfb9a67' + + '76281f34583ddb91e2', + 16); + assert.equal(a.sub(b).cmp(r), 0); + + // In-place + assert.equal(b.clone().isub(a).neg().cmp(r), 0); + + var r = b.sub(new BN(14)); + assert.equal(b.clone().isubn(14).cmp(r), 0); + + var r = new BN( + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b', 16); + assert.equal(r.isubn(-1).toString(16), + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681c'); + + // Carry and copy + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(a.isub(b).toString(16), '-fffffffedcbb'); + + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(b.isub(a).toString(16), 'fffffffedcbb'); + }); + + describe('isubn', function() { + it('should work for positive numbers', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.isubn(200) + assert.equal(a.sign, true) + assert.equal(a.toString(), '-300') + }) + + it('should not allow a sign change', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.isubn(-200); + assert.equal(a.sign, false) + assert.equal(a.toString(), '100') + }) + }) + + it('should mul numbers', function() { + assert.equal(new BN(0x1001).mul(new BN(0x1234)).toString(16), + '1235234'); + assert.equal(new BN(-0x1001).mul(new BN(0x1234)).toString(16), + '-1235234'); + assert.equal(new BN(-0x1001).mul(new BN(-0x1234)).toString(16), + '1235234'); + var n = new BN(0x1001); + var r = n; + for (var i = 0; i < 4; i++) + r = r.mul(n); + assert.equal(r.toString(16), + '100500a00a005001'); + + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal(n.mul(n).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40'); + assert.equal(n.mul(n).mul(n).toString(16), + '1b888e01a06e974017a28a5b4da436169761c9730b7aeedf75fc60f687b' + + '46e0cf2cb11667f795d5569482640fe5f628939467a01a612b02350' + + '0d0161e9730279a7561043af6197798e41b7432458463e64fa81158' + + '907322dc330562697d0d600'); + + assert.equal( + new BN('-100000000000').mul(new BN('3').div(new BN('4'))).toString(16), + '0' + ); + }); + + it('should regress mul big numbers', function() { + var q = fixtures.dhGroups.p17.q; + var qs = fixtures.dhGroups.p17.qs; + + var q = new BN(q, 16); + assert.equal(q.sqr().toString(16), qs); + }); + + it('should imul numbers', function() { + var a = new BN('abcdef01234567890abcd', 16); + var b = new BN('deadbeefa551edebabba8', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + + var a = new BN('abcdef01234567890abcd214a25123f512361e6d236', 16); + var b = new BN('deadbeefa551edebabba8121234fd21bac0341324dd', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + }); + + it('should div numbers', function() { + assert.equal(new BN('10').div(new BN(256)).toString(16), + '0'); + assert.equal(new BN('69527932928').div(new BN('16974594')).toString(16), + 'fff'); + assert.equal(new BN('-69527932928').div(new BN('16974594')).toString(16), + '-fff'); + + var b = new BN( + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40', + 16); + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal(b.div(n).toString(16), n.toString(16)); + + assert.equal(new BN('1').div(new BN('-5')).toString(10), '0'); + + // Regression after moving to word div + var p = new BN( + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + 16); + var a = new BN( + '79be667e f9dcbbac 55a06295 ce870b07 029bfcdb 2dce28d9 59f2815b 16f81798', + 16); + var as = a.sqr(); + assert.equal( + as.div(p).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729e58090b9'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.div(p).toString(16), + 'ffffffff00000002000000000000000000000001000000000000000000000001'); + }); + + it('should mod numbers', function() { + assert.equal(new BN('10').mod(new BN(256)).toString(16), + 'a'); + assert.equal(new BN('69527932928').mod(new BN('16974594')).toString(16), + '102f302'); + assert.equal(new BN('-69527932928').mod(new BN('16974594')).toString(16), + '1000'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.mod(p).toString(16), + '0'); + }); + + it('should divRound numbers', function() { + assert.equal(new BN(9).divRound(new BN(20)).toString(10), + '0'); + assert.equal(new BN(10).divRound(new BN(20)).toString(10), + '1'); + assert.equal(new BN(150).divRound(new BN(20)).toString(10), + '8'); + assert.equal(new BN(149).divRound(new BN(20)).toString(10), + '7'); + assert.equal(new BN(149).divRound(new BN(17)).toString(10), + '9'); + assert.equal(new BN(144).divRound(new BN(17)).toString(10), + '8'); + assert.equal(new BN(-144).divRound(new BN(17)).toString(10), + '-8'); + }); + + it('should absolute numbers', function() { + assert.equal(new BN(0x1001).abs().toString(), '4097'); + assert.equal(new BN(-0x1001).abs().toString(), '4097'); + assert.equal(new BN('ffffffff', 16).abs().toString(), '4294967295'); + }) + + it('should modn numbers', function() { + assert.equal(new BN('10', 16).modn(256).toString(16), '10'); + assert.equal(new BN('100', 16).modn(256).toString(16), '0'); + assert.equal(new BN('1001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(257).toString(16), + new BN('100000000001', 16).mod(new BN(257)).toString(16)); + assert.equal(new BN('123456789012', 16).modn(3).toString(16), + new BN('123456789012', 16).mod(new BN(3)).toString(16)); + }); + + it('should idivn numbers', function() { + assert.equal(new BN('10', 16).idivn(3).toString(16), '5'); + assert.equal(new BN('12', 16).idivn(3).toString(16), '6'); + assert.equal(new BN('10000000000000000').idivn(3).toString(10), + '3333333333333333'); + assert.equal(new BN('100000000000000000000000000000').idivn(3).toString(10), + '33333333333333333333333333333'); + + var t = new BN(3); + assert.equal(new BN('12345678901234567890123456', 16).idivn(3).toString(16), + new BN('12345678901234567890123456', 16).div(t).toString(16)); + }); + + it('should shl numbers', function() { + assert.equal(new BN('69527932928').shln(13).toString(16), + '2060602000000'); + assert.equal(new BN('69527932928').shln(45).toString(16), + '206060200000000000000'); + }); + + it('should shr numbers', function() { + assert.equal(new BN('69527932928').shrn(13).toString(16), + '818180'); + assert.equal(new BN('69527932928').shrn(17).toString(16), + '81818'); + assert.equal(new BN('69527932928').shrn(256).toString(16), + '0'); + }); + + it('should invm numbers', function() { + var p = new BN(257); + var a = new BN(3); + var b = a.invm(p); + assert.equal(a.mul(b).mod(p).toString(16), '1'); + + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var a = new BN('deadbeef', 16); + var b = a.invm(p192); + assert.equal(a.mul(b).mod(p192).toString(16), '1'); + + // Even base + var phi = new BN('872d9b030ba368706b68932cf07a0e0c', 16); + var e = new BN(65537); + var d = e.invm(phi); + assert.equal(e.mul(d).mod(phi).toString(16), '1'); + }); + + it('should support bincn', function() { + assert.equal(new BN(0).bincn(1).toString(16), '2'); + assert.equal(new BN(2).bincn(1).toString(16), '4'); + assert.equal(new BN(2).bincn(1).bincn(1).toString(16), + new BN(2).bincn(2).toString(16)); + assert.equal(new BN(0xffffff).bincn(1).toString(16), '1000001'); + }); + + it('should support imaskn', function() { + assert.equal(new BN(0).imaskn(1).toString(16), '0'); + assert.equal(new BN(3).imaskn(1).toString(16), '1'); + assert.equal(new BN('123456789', 16).imaskn(4).toString(16), '9'); + assert.equal(new BN('123456789', 16).imaskn(16).toString(16), '6789'); + assert.equal(new BN('123456789', 16).imaskn(28).toString(16), '3456789'); + }); + + it('should support testn', function() { + [ + 'ff', + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' + ].forEach(function(hex) { + var bn = new BN(hex, 16) + var bl = bn.bitLength() + + for (var i = 0; i < bl; ++i) { + assert.equal(bn.testn(i), true); + } + + // test off the end + assert.equal(bn.testn(bl), false); + }) + + var xbits = [ + '01111001010111001001000100011101110100111011000110001110010111011001010', + '01110000000010110001111010101111100111110010001111000001001011010100111', + '01000101001100010001101001011110100001001111100110001110010111' + ].join('') + + var x = new BN( + '23478905234580795234378912401239784125643978256123048348957342' + ) + for (var i = 0; i < x.bitLength(); ++i) { + assert.equal(x.testn(i), (xbits.charAt(i) === '1'), 'Failed @ bit ' + i) + } + }); + + it('should support gcd', function() { + assert.equal(new BN(3).gcd(new BN(2)).toString(16), '1'); + assert.equal(new BN(18).gcd(new BN(12)).toString(16), '6'); + assert.equal(new BN(-18).gcd(new BN(12)).toString(16), '6'); + }); + + it('should and numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .and(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + }); + it('should iand numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .iand(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + assert.equal(new BN('1000000000000000000000000000000000000001', 2) + .iand(new BN('1', 2)) + .toString(2), '1') + assert.equal(new BN('1', 2) + .iand(new BN('1000000000000000000000000000000000000001', 2)) + .toString(2), '1') + }); + it('should or numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .or(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + }); + it('should ior numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .ior(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + assert.equal(new BN('1000000000000000000000000000000000000000', 2) + .ior(new BN('1', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + assert.equal(new BN('1', 2) + .ior(new BN('1000000000000000000000000000000000000000', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + }); + it('should xor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .xor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + }); + it('should ixor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1', 2)) + .toString(2), '11001100110011001100110011001101'); + assert.equal(new BN('1', 2) + .ixor(new BN('11001100110011001100110011001100', 2)) + .toString(2), '11001100110011001100110011001101'); + }); + + it('should allow single bits to be set', function () { + assert.equal(new BN(0).setn(2, true).toString(2), '100'); + assert.equal(new BN(0).setn(27, true).toString(2), + '1000000000000000000000000000'); + assert.equal(new BN('1000000000000000000000000001', 2).setn(27, false) + .toString(2), '1'); + assert.equal(new BN('101', 2).setn(2, false).toString(2), '1'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/fixtures.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/fixtures.js new file mode 100644 index 00000000..29442d92 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/fixtures.js @@ -0,0 +1,264 @@ +exports.dhGroups = { + p16: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199' + + 'ffffffffffffffff', + priv: '6d5923e6449122cbbcc1b96093e0b7e4fd3e469f58daddae' + + '53b49b20664f4132675df9ce98ae0cfdcac0f4181ccb643b' + + '625f98104dcf6f7d8e81961e2cab4b5014895260cb977c7d' + + '2f981f8532fb5da60b3676dfe57f293f05d525866053ac7e' + + '65abfd19241146e92e64f309a97ef3b529af4d6189fa416c' + + '9e1a816c3bdf88e5edf48fbd8233ef9038bb46faa95122c0' + + '5a426be72039639cd2d53d37254b3d258960dcb33c255ede' + + '20e9d7b4b123c8b4f4b986f53cdd510d042166f7dd7dca98' + + '7c39ab36381ba30a5fdd027eb6128d2ef8e5802a2194d422' + + 'b05fe6e1cb4817789b923d8636c1ec4b7601c90da3ddc178' + + '52f59217ae070d87f2e75cbfb6ff92430ad26a71c8373452' + + 'ae1cc5c93350e2d7b87e0acfeba401aaf518580937bf0b6c' + + '341f8c49165a47e49ce50853989d07171c00f43dcddddf72' + + '94fb9c3f4e1124e98ef656b797ef48974ddcd43a21fa06d0' + + '565ae8ce494747ce9e0ea0166e76eb45279e5c6471db7df8' + + 'cc88764be29666de9c545e72da36da2f7a352fb17bdeb982' + + 'a6dc0193ec4bf00b2e533efd6cd4d46e6fb237b775615576' + + 'dd6c7c7bbc087a25e6909d1ebc6e5b38e5c8472c0fc429c6' + + 'f17da1838cbcd9bbef57c5b5522fd6053e62ba21fe97c826' + + 'd3889d0cc17e5fa00b54d8d9f0f46fb523698af965950f4b' + + '941369e180f0aece3870d9335f2301db251595d173902cad' + + '394eaa6ffef8be6c', + pub: 'd53703b7340bc89bfc47176d351e5cf86d5a18d9662eca3c' + + '9759c83b6ccda8859649a5866524d77f79e501db923416ca' + + '2636243836d3e6df752defc0fb19cc386e3ae48ad647753f' + + 'bf415e2612f8a9fd01efe7aca249589590c7e6a0332630bb' + + '29c5b3501265d720213790556f0f1d114a9e2071be3620bd' + + '4ee1e8bb96689ac9e226f0a4203025f0267adc273a43582b' + + '00b70b490343529eaec4dcff140773cd6654658517f51193' + + '13f21f0a8e04fe7d7b21ffeca85ff8f87c42bb8d9cb13a72' + + 'c00e9c6e9dfcedda0777af951cc8ccab90d35e915e707d8e' + + '4c2aca219547dd78e9a1a0730accdc9ad0b854e51edd1e91' + + '4756760bab156ca6e3cb9c625cf0870def34e9ac2e552800' + + 'd6ce506d43dbbc75acfa0c8d8fb12daa3c783fb726f187d5' + + '58131779239c912d389d0511e0f3a81969d12aeee670e48f' + + 'ba41f7ed9f10705543689c2506b976a8ffabed45e33795b0' + + '1df4f6b993a33d1deab1316a67419afa31fbb6fdd252ee8c' + + '7c7d1d016c44e3fcf6b41898d7f206aa33760b505e4eff2e' + + 'c624bc7fe636b1d59e45d6f904fc391419f13d1f0cdb5b6c' + + '2378b09434159917dde709f8a6b5dc30994d056e3f964371' + + '11587ac7af0a442b8367a7bd940f752ddabf31cf01171e24' + + 'd78df136e9681cd974ce4f858a5fb6efd3234a91857bb52d' + + '9e7b414a8bc66db4b5a73bbeccfb6eb764b4f0cbf0375136' + + 'b024b04e698d54a5' + }, + p17: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934028492' + + '36c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bd' + + 'f8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831' + + '179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1b' + + 'db7f1447e6cc254b332051512bd7af426fb8f401378cd2bf' + + '5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6' + + 'd55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f3' + + '23a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aa' + + 'cc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be328' + + '06a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55c' + + 'da56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee' + + '12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff', + priv: '6017f2bc23e1caff5b0a8b4e1fc72422b5204415787801dc' + + '025762b8dbb98ab57603aaaa27c4e6bdf742b4a1726b9375' + + 'a8ca3cf07771779589831d8bd18ddeb79c43e7e77d433950' + + 'e652e49df35b11fa09644874d71d62fdaffb580816c2c88c' + + '2c4a2eefd4a660360316741b05a15a2e37f236692ad3c463' + + 'fff559938fc6b77176e84e1bb47fb41af691c5eb7bb81bd8' + + 'c918f52625a1128f754b08f5a1403b84667231c4dfe07ed4' + + '326234c113931ce606037e960f35a2dfdec38a5f057884d3' + + '0af8fab3be39c1eeb390205fd65982191fc21d5aa30ddf51' + + 'a8e1c58c0c19fc4b4a7380ea9e836aaf671c90c29bc4bcc7' + + '813811aa436a7a9005de9b507957c56a9caa1351b6efc620' + + '7225a18f6e97f830fb6a8c4f03b82f4611e67ab9497b9271' + + 'd6ac252793cc3e5538990dbd894d2dbc2d152801937d9f74' + + 'da4b741b50b4d40e4c75e2ac163f7b397fd555648b249f97' + + 'ffe58ffb6d096aa84534c4c5729cff137759bd34e80db4ab' + + '47e2b9c52064e7f0bf677f72ac9e5d0c6606943683f9d12f' + + '180cf065a5cb8ec3179a874f358847a907f8471d15f1e728' + + '7023249d6d13c82da52628654438f47b8b5cdf4761fbf6ad' + + '9219eceac657dbd06cf2ab776ad4c968f81c3d039367f0a4' + + 'd77c7ec4435c27b6c147071665100063b5666e06eb2fb2cc' + + '3159ba34bc98ca346342195f6f1fb053ddc3bc1873564d40' + + '1c6738cdf764d6e1ff25ca5926f80102ea6593c17170966b' + + 'b5d7352dd7fb821230237ea3ebed1f920feaadbd21be295a' + + '69f2083deae9c5cdf5f4830eb04b7c1f80cc61c17232d79f' + + '7ecc2cc462a7965f804001c89982734e5abba2d31df1b012' + + '152c6b226dff34510b54be8c2cd68d795def66c57a3abfb6' + + '896f1d139e633417f8c694764974d268f46ece3a8d6616ea' + + 'a592144be48ee1e0a1595d3e5edfede5b27cec6c48ceb2ff' + + 'b42cb44275851b0ebf87dfc9aa2d0cb0805e9454b051dfe8' + + 'a29fadd82491a4b4c23f2d06ba45483ab59976da1433c9ce' + + '500164b957a04cf62dd67595319b512fc4b998424d1164dd' + + 'bbe5d1a0f7257cbb04ec9b5ed92079a1502d98725023ecb2', + pub: '3bf836229c7dd874fe37c1790d201e82ed8e192ed61571ca' + + '7285264974eb2a0171f3747b2fc23969a916cbd21e14f7e2' + + 'f0d72dcd2247affba926f9e7bb99944cb5609aed85e71b89' + + 'e89d2651550cb5bd8281bd3144066af78f194032aa777739' + + 'cccb7862a1af401f99f7e5c693f25ddce2dedd9686633820' + + 'd28d0f5ed0c6b5a094f5fe6170b8e2cbc9dff118398baee6' + + 'e895a6301cb6e881b3cae749a5bdf5c56fc897ff68bc73f2' + + '4811bb108b882872bade1f147d886a415cda2b93dd90190c' + + 'be5c2dd53fe78add5960e97f58ff2506afe437f4cf4c912a' + + '397c1a2139ac6207d3ab76e6b7ffd23bb6866dd7f87a9ae5' + + '578789084ff2d06ea0d30156d7a10496e8ebe094f5703539' + + '730f5fdbebc066de417be82c99c7da59953071f49da7878d' + + 'a588775ff2a7f0084de390f009f372af75cdeba292b08ea8' + + '4bd13a87e1ca678f9ad148145f7cef3620d69a891be46fbb' + + 'cad858e2401ec0fd72abdea2f643e6d0197b7646fbb83220' + + '0f4cf7a7f6a7559f9fb0d0f1680822af9dbd8dec4cd1b5e1' + + '7bc799e902d9fe746ddf41da3b7020350d3600347398999a' + + 'baf75d53e03ad2ee17de8a2032f1008c6c2e6618b62f225b' + + 'a2f350179445debe68500fcbb6cae970a9920e321b468b74' + + '5fb524fb88abbcacdca121d737c44d30724227a99745c209' + + 'b970d1ff93bbc9f28b01b4e714d6c9cbd9ea032d4e964d8e' + + '8fff01db095160c20b7646d9fcd314c4bc11bcc232aeccc0' + + 'fbedccbc786951025597522eef283e3f56b44561a0765783' + + '420128638c257e54b972a76e4261892d81222b3e2039c61a' + + 'ab8408fcaac3d634f848ab3ee65ea1bd13c6cd75d2e78060' + + 'e13cf67fbef8de66d2049e26c0541c679fff3e6afc290efe' + + '875c213df9678e4a7ec484bc87dae5f0a1c26d7583e38941' + + 'b7c68b004d4df8b004b666f9448aac1cc3ea21461f41ea5d' + + 'd0f7a9e6161cfe0f58bcfd304bdc11d78c2e9d542e86c0b5' + + '6985cc83f693f686eaac17411a8247bf62f5ccc7782349b5' + + 'cc1f20e312fa2acc0197154d1bfee507e8db77e8f2732f2d' + + '641440ccf248e8643b2bd1e1f9e8239356ab91098fcb431d', + q: 'a899c59999bf877d96442d284359783bdc64b5f878b688fe' + + '51407f0526e616553ad0aaaac4d5bed3046f10a1faaf42bb' + + '2342dc4b7908eea0c46e4c4576897675c2bfdc4467870d3d' + + 'cd90adaed4359237a4bc6924bfb99aa6bf5f5ede15b574ea' + + 'e977eac096f3c67d09bda574c6306c6123fa89d2f086b8dc' + + 'ff92bc570c18d83fe6c810ccfd22ce4c749ef5e6ead3fffe' + + 'c63d95e0e3fde1df9db6a35fa1d107058f37e41957769199' + + 'd945dd7a373622c65f0af3fd9eb1ddc5c764bbfaf7a3dc37' + + '2548e683b970dac4aa4b9869080d2376c9adecebb84e172c' + + '09aeeb25fb8df23e60033260c4f8aac6b8b98ab894b1fb84' + + 'ebb83c0fb2081c3f3eee07f44e24d8fabf76f19ed167b0d7' + + 'ff971565aa4efa3625fce5a43ceeaa3eebb3ce88a00f597f' + + '048c69292b38dba2103ecdd5ec4ccfe3b2d87fa6202f334b' + + 'c1cab83b608dfc875b650b69f2c7e23c0b2b4adf149a6100' + + 'db1b6dbad4679ecb1ea95eafaba3bd00db11c2134f5a8686' + + '358b8b2ab49a1b2e85e1e45caeac5cd4dc0b3b5fffba8871' + + '1c6baf399edd48dad5e5c313702737a6dbdcede80ca358e5' + + '1d1c4fe42e8948a084403f61baed38aa9a1a5ce2918e9f33' + + '100050a430b47bc592995606440272a4994677577a6aaa1b' + + 'a101045dbec5a4e9566dab5445d1af3ed19519f07ac4e2a8' + + 'bd0a84b01978f203a9125a0be020f71fab56c2c9e344d4f4' + + '12d53d3cd8eb74ca5122002e931e3cb0bd4b7492436be17a' + + 'd7ebe27148671f59432c36d8c56eb762655711cfc8471f70' + + '83a8b7283bcb3b1b1d47d37c23d030288cfcef05fbdb4e16' + + '652ee03ee7b77056a808cd700bc3d9ef826eca9a59be959c' + + '947c865d6b372a1ca2d503d7df6d7611b12111665438475a' + + '1c64145849b3da8c2d343410df892d958db232617f9896f1' + + 'de95b8b5a47132be80dd65298c7f2047858409bf762dbc05' + + 'a62ca392ac40cfb8201a0607a2cae07d99a307625f2b2d04' + + 'fe83fbd3ab53602263410f143b73d5b46fc761882e78c782' + + 'd2c36e716a770a7aefaf7f76cea872db7bffefdbc4c2f9e0' + + '39c19adac915e7a63dcb8c8c78c113f29a3e0bc10e100ce0', + qs: '6f0a2fb763eaeb8eb324d564f03d4a55fdcd709e5f1b65e9' + + '5702b0141182f9f945d71bc3e64a7dfdae7482a7dd5a4e58' + + 'bc38f78de2013f2c468a621f08536969d2c8d011bb3bc259' + + '2124692c91140a5472cad224acdacdeae5751dadfdf068b8' + + '77bfa7374694c6a7be159fc3d24ff9eeeecaf62580427ad8' + + '622d48c51a1c4b1701d768c79d8c819776e096d2694107a2' + + 'f3ec0c32224795b59d32894834039dacb369280afb221bc0' + + '90570a93cf409889b818bb30cccee98b2aa26dbba0f28499' + + '08e1a3cd43fa1f1fb71049e5c77c3724d74dc351d9989057' + + '37bbda3805bd6b1293da8774410fb66e3194e18cdb304dd9' + + 'a0b59b583dcbc9fc045ac9d56aea5cfc9f8a0b95da1e11b7' + + '574d1f976e45fe12294997fac66ca0b83fc056183549e850' + + 'a11413cc4abbe39a211e8c8cbf82f2a23266b3c10ab9e286' + + '07a1b6088909cddff856e1eb6b2cde8bdac53fa939827736' + + 'ca1b892f6c95899613442bd02dbdb747f02487718e2d3f22' + + 'f73734d29767ed8d0e346d0c4098b6fdcb4df7d0c4d29603' + + '5bffe80d6c65ae0a1b814150d349096baaf950f2caf298d2' + + 'b292a1d48cf82b10734fe8cedfa16914076dfe3e9b51337b' + + 'ed28ea1e6824bb717b641ca0e526e175d3e5ed7892aebab0' + + 'f207562cc938a821e2956107c09b6ce4049adddcd0b7505d' + + '49ae6c69a20122461102d465d93dc03db026be54c303613a' + + 'b8e5ce3fd4f65d0b6162ff740a0bf5469ffd442d8c509cd2' + + '3b40dab90f6776ca17fc0678774bd6eee1fa85ababa52ec1' + + 'a15031eb677c6c488661dddd8b83d6031fe294489ded5f08' + + '8ad1689a14baeae7e688afa3033899c81f58de39b392ca94' + + 'af6f15a46f19fa95c06f9493c8b96a9be25e78b9ea35013b' + + 'caa76de6303939299d07426a88a334278fc3d0d9fa71373e' + + 'be51d3c1076ab93a11d3d0d703366ff8cde4c11261d488e5' + + '60a2bdf3bfe2476032294800d6a4a39d306e65c6d7d8d66e' + + '5ec63eee94531e83a9bddc458a2b508285c0ee10b7bd94da' + + '2815a0c5bd5b2e15cbe66355e42f5af8955cdfc0b3a4996d' + + '288db1f4b32b15643b18193e378cb7491f3c3951cdd044b1' + + 'a519571bffac2da986f5f1d506c66530a55f70751e24fa8e' + + 'd83ac2347f4069fb561a5565e78c6f0207da24e889a93a96' + + '65f717d9fe8a2938a09ab5f81be7ccecf466c0397fc15a57' + + '469939793f302739765773c256a3ca55d0548afd117a7cae' + + '98ca7e0d749a130c7b743d376848e255f8fdbe4cb4480b63' + + 'cd2c015d1020cf095d175f3ca9dcdfbaf1b2a6e6468eee4c' + + 'c750f2132a77f376bd9782b9d0ff4da98621b898e251a263' + + '4301ba2214a8c430b2f7a79dbbfd6d7ff6e9b0c137b025ff' + + '587c0bf912f0b19d4fff96b1ecd2ca990c89b386055c60f2' + + '3b94214bd55096f17a7b2c0fa12b333235101cd6f28a128c' + + '782e8a72671adadebbd073ded30bd7f09fb693565dcf0bf3' + + '090c21d13e5b0989dd8956f18f17f4f69449a13549c9d80a' + + '77e5e61b5aeeee9528634100e7bc390672f0ded1ca53555b' + + 'abddbcf700b9da6192255bddf50a76b709fbed251dce4c7e' + + '1ca36b85d1e97c1bc9d38c887a5adf140f9eeef674c31422' + + 'e65f63cae719f8c1324e42fa5fd8500899ef5aa3f9856aa7' + + 'ce10c85600a040343204f36bfeab8cfa6e9deb8a2edd2a8e' + + '018d00c7c9fa3a251ad0f57183c37e6377797653f382ec7a' + + '2b0145e16d3c856bc3634b46d90d7198aff12aff88a30e34' + + 'e2bfaf62705f3382576a9d3eeb0829fca2387b5b654af46e' + + '5cf6316fb57d59e5ea6c369061ac64d99671b0e516529dd5' + + 'd9c48ea0503e55fee090d36c5ea8b5954f6fcc0060794e1c' + + 'b7bc24aa1e5c0142fd4ce6e8fd5aa92a7bf84317ea9e1642' + + 'b6995bac6705adf93cbce72433ed0871139970d640f67b78' + + 'e63a7a6d849db2567df69ac7d79f8c62664ac221df228289' + + 'd0a4f9ebd9acb4f87d49da64e51a619fd3f3baccbd9feb12' + + '5abe0cc2c8d17ed1d8546da2b6c641f4d3020a5f9b9f26ac' + + '16546c2d61385505612275ea344c2bbf1ce890023738f715' + + '5e9eba6a071678c8ebd009c328c3eb643679de86e69a9fa5' + + '67a9e146030ff03d546310a0a568c5ba0070e0da22f2cef8' + + '54714b04d399bbc8fd261f9e8efcd0e83bdbc3f5cfb2d024' + + '3e398478cc598e000124eb8858f9df8f52946c2a1ca5c400' + } +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/pummel/dh-group-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/pummel/dh-group-test.js new file mode 100644 index 00000000..dd6481f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/pummel/dh-group-test.js @@ -0,0 +1,21 @@ +var assert = require('assert'); +var BN = require('../../').BN; +var fixtures = require('../fixtures'); + +describe('BN.js/Slow DH test', function() { + var groups = fixtures.dhGroups; + Object.keys(groups).forEach(function(name) { + it('should match public key for ' + name + ' group', function() { + var group = groups[name]; + + this.timeout(3600 * 1000); + + var base = new BN(2); + var mont = BN.red(new BN(group.prime, 16)); + var priv = new BN(group.priv, 16); + var multed = base.toRed(mont).redPow(priv).fromRed(); + var actual = new Buffer(multed.toArray()); + assert.equal(actual.toString('hex'), group.pub); + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/red-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/red-test.js new file mode 100644 index 00000000..474679ca --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/bn.js/test/red-test.js @@ -0,0 +1,140 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN.js/Reduction context', function() { + function testMethod(name, fn) { + describe(name + ' method', function() { + it('should support add, iadd, sub, isub operations', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(123).toRed(m); + var b = new BN(231).toRed(m); + + assert.equal(a.redAdd(b).fromRed().toString(10), '97'); + assert.equal(a.redSub(b).fromRed().toString(10), '149'); + assert.equal(b.redSub(a).fromRed().toString(10), '108'); + + assert.equal(a.clone().redIAdd(b).fromRed().toString(10), '97'); + assert.equal(a.clone().redISub(b).fromRed().toString(10), '149'); + assert.equal(b.clone().redISub(a).fromRed().toString(10), '108'); + }); + + it('should support pow and mul operations', function() { + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p192); + var a = new BN(123); + var b = new BN(231); + var c = a.toRed(m).redMul(b.toRed(m)).fromRed(); + assert(c.cmp(a.mul(b).mod(p192)) === 0); + + assert.equal(a.toRed(m).redPow(new BN(3)).fromRed() + .cmp(a.sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(4)).fromRed() + .cmp(a.sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(8)).fromRed() + .cmp(a.sqr().sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(9)).fromRed() + .cmp(a.sqr().sqr().sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(17)).fromRed() + .cmp(a.sqr().sqr().sqr().sqr().mul(a)), 0); + }); + + it('should sqrtm numbers', function() { + var p = new BN(263); + var m = fn(p); + var q = new BN(11).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + var q = new BN(13).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + // Tonelli-shanks + var p = new BN(13); + var m = fn(p); + var q = new BN(10).toRed(m); + assert.equal(q.redSqrt().fromRed().toString(10), '7'); + }); + + it('should invm numbers', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(3).toRed(m); + var b = a.redInvm(p); + assert.equal(a.redMul(b).fromRed().toString(16), '1'); + }); + + it('should imul numbers', function() { + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + + var a = new BN('deadbeefabbadead', 16); + var b = new BN('abbadeadbeefdead', 16); + var c = a.mul(b).mod(p); + + assert.equal(a.toRed(m).redIMul(b.toRed(m)).fromRed().toString(16), + c.toString(16)); + }); + }); + } + + testMethod('Plain', BN.red); + testMethod('Montgomery', BN.mont); + + describe('Pseudo-Mersenne Primes', function() { + it('should reduce numbers mod k256', function() { + var p = BN._prime('k256'); + + assert.equal(p.ireduce(new BN(0xdead)).toString(16), 'dead'); + assert.equal(p.ireduce(new BN('deadbeef', 16)).toString(16), 'deadbeef'); + + var num = new BN('fedcba9876543210fedcba9876543210dead' + + 'fedcba9876543210fedcba9876543210dead', + 16); + var exp = num.mod(p.p).toString(16); + assert.equal(p.ireduce(num).toString(16), exp); + + var regr = new BN('f7e46df64c1815962bf7bc9c56128798' + + '3f4fcef9cb1979573163b477eab93959' + + '335dfb29ef07a4d835d22aa3b6797760' + + '70a8b8f59ba73d56d01a79af9', + 16); + var exp = regr.mod(p.p).toString(16); + assert.equal(p.ireduce(regr).toString(16), exp); + }); + + it('should not fail to invm number mod k256', function() { + var regr2 = new BN( + '6c150c4aa9a8cf1934485d40674d4a7cd494675537bda36d49405c5d2c6f496f', 16); + regr2 = regr2.toRed(BN.red('k256')); + assert.equal(regr2.redInvm().redMul(regr2).fromRed().cmpn(1), 0); + }); + + it('should correctly square the number', function() { + var p = BN._prime('k256').p; + var red = BN.red('k256'); + + var n = new BN('9cd8cb48c3281596139f147c1364a3ed' + + 'e88d3f310fdb0eb98c924e599ca1b3c9', + 16); + var expected = n.sqr().mod(p); + var actual = n.toRed(red).redSqr().fromRed(); + + assert.equal(actual.toString(16), expected.toString(16)); + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/.travis.yml b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/.travis.yml new file mode 100644 index 00000000..20229620 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.11" \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/index.js new file mode 100644 index 00000000..17a169b4 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/index.js @@ -0,0 +1,46 @@ +var bn = require('bn.js'); +var randomBytes = require('randombytes'); +module.exports = crt; +function blind(priv) { + var r = getr(priv); + var blinder = r.toRed(bn.mont(priv.modulus)) + .redPow(new bn(priv.publicExponent)).fromRed(); + return { + blinder: blinder, + unblinder:r.invm(priv.modulus) + }; +} +function crt(msg, priv) { + var blinds = blind(priv); + var len = priv.modulus.byteLength(); + var mod = bn.mont(priv.modulus); + var blinded = new bn(msg).mul(blinds.blinder).mod(priv.modulus); + var c1 = blinded.toRed(bn.mont(priv.prime1)); + var c2 = blinded.toRed(bn.mont(priv.prime2)); + var qinv = priv.coefficient; + var p = priv.prime1; + var q = priv.prime2; + var m1 = c1.redPow(priv.exponent1); + var m2 = c2.redPow(priv.exponent2); + m1 = m1.fromRed(); + m2 = m2.fromRed(); + var h = m1.isub(m2).imul(qinv).mod(p); + h.imul(q); + m2.iadd(h); + var out = new Buffer(m2.imul(blinds.unblinder).mod(priv.modulus).toArray()); + if (out.length < len) { + var prefix = new Buffer(len - out.length); + prefix.fill(0); + out = Buffer.concat([prefix, out], len); + } + return out; +} +crt.getr = getr; +function getr(priv) { + var len = priv.modulus.byteLength(); + var r = new bn(randomBytes(len)); + while (r.cmp(priv.modulus) >= 0 || !r.mod(priv.prime1) || !r.mod(priv.prime2)) { + r = new bn(randomBytes(len)); + } + return r; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/package.json new file mode 100644 index 00000000..b153ad87 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/package.json @@ -0,0 +1,67 @@ +{ + "name": "browserify-rsa", + "version": "2.0.0", + "description": "browserify-rsa ==== [![Build Status](https://travis-ci.org/calvinmetcalf/browserify-rsa.svg)](https://travis-ci.org/calvinmetcalf/browserify-rsa)", + "main": "index.js", + "scripts": { + "test": "node test.js | tspec" + }, + "author": "", + "license": "MIT", + "dependencies": { + "bn.js": "^1.0.0", + "randombytes": "^2.0.1" + }, + "repository": { + "type": "git", + "url": "git@github.com:calvinmetcalf/browserify-rsa.git" + }, + "devDependencies": { + "tap-spec": "^2.1.2", + "tape": "^3.0.3", + "parse-asn1": "^3.0.0" + }, + "gitHead": "f0f7efebf5a0dce46cec9f396f21e215328a0c88", + "bugs": { + "url": "https://github.com/calvinmetcalf/browserify-rsa/issues" + }, + "homepage": "https://github.com/calvinmetcalf/browserify-rsa", + "_id": "browserify-rsa@2.0.0", + "_shasum": "b3e4f6d03a07db4408bfd9dbc0fef323bfe1bdcb", + "_from": "browserify-rsa@>=2.0.0 <3.0.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "1.0.4", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "b3e4f6d03a07db4408bfd9dbc0fef323bfe1bdcb", + "tarball": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-2.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-2.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/readme.md b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/readme.md new file mode 100644 index 00000000..1fb50acc --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/readme.md @@ -0,0 +1,10 @@ +browserify-rsa +==== +[![Build Status](https://travis-ci.org/calvinmetcalf/browserify-rsa.svg)](https://travis-ci.org/calvinmetcalf/browserify-rsa) + +RSA private decryption/signing using chinese remainder and blinding. + +API +==== + +Give it a message as a buffer, a private key (as decoded by https://www.npmjs.com/package/parse-asn1) and a crypto object (aka `require('crypto')`, this is because we use it in browserify crypto and don't want to create a circular dependency) \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/test.js new file mode 100644 index 00000000..c0f15963 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/browserify-rsa/test.js @@ -0,0 +1,53 @@ +var keys = [ + new Buffer('2d2d2d2d2d424547494e2050524956415445204b45592d2d2d2d2d0a4d494943647749424144414e42676b71686b6947397730424151454641415343416d457767674a6441674541416f4742414b756c55545a3842317163635a38630a44585247535930386757384b764c6c63787878474334675a484e543343425546386e3552344b453330615a79595a2f727473515a7530356a755a4a78614a30710a6d62653735646c5135642b586339424d586551672f4d70545a773554414e374f4964475959704642652b31504c5a367745666a6b59724d714d55636671324c710a68544c64416276424a6e755263595a4c716d42654f51384654724b7241674d4241414543675945416e6b485262455055332f57495353517250333669794362320a532f53425a774b6b7a6d764372427844576850654473777039632f324a593736724e57664c7a793869586755473857557a76486a653631516833676d42634b650a62556154476c34567938486131594241446f3552665272646d3046453474766776752f546b7146717042425a7765753534323835686b357a6c47376e2f4437590a646e4e58557075354d6c4e623578336757306b43515144554c2f2f637763585578592f6576614a50346a53652b5a7745515a6f2b7a58524c695055756c426f560a6177323843564d757864677771416f315831494b65665065556166375251753867434b61526e704775457558416b45417a785a54664d6d766d435544496577340a35476b36624b3236355851576468636769713235346c7042474f596d446a397943453779412b7a6d415351774d73585464514f6931684f434579725875534a350a632b2b4544514a4146683357726e7a6f455042797559584d6d45543874534652574d51357670674e716833686148523562346755433268786169756e43424e4c0a315270565939416f55694479774763472f5350683933436e4b42336e69774a42414b503741747369665a6756587469697a4234614d5468546a565961535a727a0a44304b6739447548796c706b4443686d467537375447724e55516741567559746668622f6252626c56612f4630684a3465514854334a554351425654363874620a4f6752556b30615039744333303231564e383258362b6b6c6f7753514e386f425058382b546644575355696c702f2b6a3234486b792b5a3239446f3779522f520a7175746e4c39324376426c564c56343d0a2d2d2d2d2d454e442050524956415445204b45592d2d2d2d2d0a', 'hex'), + new Buffer('2d2d2d2d2d424547494e205253412050524956415445204b45592d2d2d2d2d0a4d4949435641494241414a2f4f77737762466f2f757943386c7447662f794131412b6756354947646e4167506255534933477a624843412b782b544c472f744c0a76625277337231736d7070592f6a6b6b70695657314572534d754e307569787035676237385a39724831587057623557576770335761592f3945484d6a4d644f0a6b512f394c565a7652766c2f4d2f4669366f77502b712b616d4a493142456a454359666268474c33726d6c5664713471586334305177494441514142416e38490a565a3042506f414f68794633334b464d4878793872323866735667784a5559674d334e715167647634664661774359586a684a7a3964755535594a47464a474a0a57554765486c6b7959466c70693466336d377459374a61776d51555742304d4e536f4b48493363674458342f7466424e386e692b634f3065536f5235637a42590a4573414842553437703161774e46414877642b5a457576394834526d4d6e37703237397251547470416b4148334e7173322f7672524632635a554e34664958660a347848735142427955617947713861334a305547615346577636387a54554b466865727239755a6f744e70374e4a346a425869415277307138646f63585547310a416b4148676d4f4b486f4f5274416d696b71706d46454a5a4f7473584d614c43496d3445737a506f356369596f4c4d42635669743039416469516c74375a4a4c0a445930327376553162306167435a39376b446b6d48446b58416b414361384d394a454c7544732f502f76494759446b4d566174494666573662574630326546470a746157774d71436353457357766277307871597433346a5552704e62436a6d4379515677596641772f2b544c68503964416b414677526a64776a77333771706a0a646467316d4e697533376237737746786d6b694d4f585a5278614e4e736662353641313452704e337a6f6233516447557962476f644d494b5446626d552f6c750a436a71417861664a416b41473279663652576277464957664d7974375759436830566147424363677935373441696e566965456f335a5a7946664336332b786d0a33756f614e7934694c6f4a763447436a7155427a335a666356614f2f444457470a2d2d2d2d2d454e44205253412050524956415445204b45592d2d2d2d2d0a', 'hex'), + new Buffer('2d2d2d2d2d424547494e205253412050524956415445204b45592d2d2d2d2d0a4d4949456a77494241414b422f6779376d6a615767506546645659445a5752434139424e69763370506230657332372b464b593068737a4c614f7734374578430a744157704473483438545841667948425977424c67756179666b344c4749757078622b43474d62526f337845703043626659314a62793236543976476a5243310a666f484444554a4738347561526279487161663469367a74346756522b786c4145496a6b614641414b38634f6f58415431435671474c4c6c6a554363684c38500a6a61486a2f7972695a2f53377264776c49334c6e41427877776d4c726d522f7637315774706d4f2f614e47384e2b31706f2b5177616768546b79513539452f5a0a7641754f6b4657486f6b32712f523650594161326a645a397a696d3046714f502b6e6b5161454452624246426d4271547635664647666b32577341664b662f520a47302f5646642b5a654d353235315465547658483639356e6c53476175566c3941674d42414145436766344c725748592f6c35346f7554685a577676627275670a70667a36734a583267396c3779586d576c455773504543566f2f375355627059467074364f5a7939397a53672b494b624771574b6664686f4b725477495674430a4c30595a304e6c6d646e414e53497a30726f785147375a786b4c352b764853772f506d443978345577662b437a38684154436d4e42763171633630646b7975570a34434c71653732716154695657526f4f316961675167684e634c6f6f36765379363545784c614344545068613779753276773468465a705769456a57346478660a7246644c696978353242433836596c416c784d452f724c6738494a5676696c62796f39615764586d784f6155544c527636506b4644312f6756647738563951720a534c4e39466c4b326b6b6a695830647a6f6962765a7733744d6e74337979644178305838372b734d5256616843316270336b56507a3448793045575834514a2f0a504d33317647697549546b324e43643531445874314c746e324f503546614a536d4361456a6830586b5534716f7559796a585774384275364254436c327675610a466730556a6939432b496b504c6d61554d624d494f7761546b386357714c74685378734c6537304a354f6b477267664b554d2f772b4248483150742f506a7a6a0a432b2b6c306b6946614f5644566141563947704c504c43426f4b2f50433952622f72784d4d6f43434e774a2f4e5a756564496e793277334c4d69693737682f540a7a53766572674e47686a5936526e7661386c4c584a36646c726b6350417970733367577778716a344e5230542b474d3062445550564c62374d303758563753580a7637564a476d35324a625247774d3173732b72385854544e656d65476b2b5752784737546774734d715947584c66423851786b2f66352f4d63633030546c38750a7758464e7366784a786d7436416273547233673336774a2f49684f6e69627a3941642b6e63686c426e4e3351655733434b48717a61523138766f717674566d320a6b4a66484b31357072482f7353476d786d6945476772434a545a78744462614e434f372f56426a6e4b756455554968434177734c747571302f7a7562397641640a384731736366497076357161534e7a6d4b6f5838624f77417276725336775037794b726354737557496c484438724a5649374945446e516f5470354738664b310a68774a2f4d4968384d35763072356455594576366f494a5747636c65364148314a6d73503557496166677137325a32323838704863434648774e59384467394a0a3736517377564c6e556850546c6d6d33454f4f50474574616d32694144357230416679746c62346c624e6f51736a32737a65584f4e4458422b366f7565616a680a564e454c55723848635350356c677a525a6a4a57366146497a6a394c44526d516e55414f6a475358564f517445774a2f4d43515a374e2f763464494b654452410a3864385545785a332b674748756d7a697a7447524a30745172795a483250616b50354937562b316c377145556e4a3263336d462b65317634314570394c4376680a627a72504b773964786831386734622b37624d707357506e7372614b6836697078633761614f615a5630447867657a347a635a753050316f6c4f30634e334b4d0a6e784a305064733352386241684e43446453324a5a61527035513d3d0a2d2d2d2d2d454e44205253412050524956415445204b45592d2d2d2d2d0a', 'hex') +]; +var parseKey = require('parse-asn1'); +var privs = keys.map(parseKey); +var crt = require('./'); +var crypto = require('crypto'); +var test = require('tape'); +var constants = require('constants'); +var bn = require('bn.js'); +function testIt(priv, run) { + test('r is coprime with n ' + (run + 1), function (t) { + var len = 30; + t.plan(len); + var i = 0; + while(i++ < len) { + var r = crt.getr(priv); + t.equals(r.gcd(priv.modulus).toString(), '1', 'are coprime run ' + i); + } + }); +} +privs.forEach(testIt); + +function testMessage(key, run) { + var len = 40; + var i = 0; + while (len--) { + test('round trip key ' + (run + 1) + ' run ' + (++i), function (t) { + t.plan(1); + var priv = parseKey(key); + var len = priv.modulus.byteLength(); + var r = new bn(crypto.randomBytes(len)); + while (r.cmp(priv.modulus) >= 0) { + r = new bn(crypto.randomBytes(len)); + } + var buf = new Buffer(r.toArray()); + if (buf.byteLength < priv.modulus.byteLength()) { + var tmp = new Buffer(priv.modulus.byteLength() - buf.byteLength); + tmp.fill(0); + buf = Buffer.concat([tmp, buf]); + } + var nodeEncrypt = crypto.privateDecrypt({ + padding: constants.RSA_NO_PADDING, + key: key + }, buf).toString('hex'); + var myEncrypt = crt(buf, priv).toString('hex'); + t.equals(nodeEncrypt, myEncrypt, 'equal encrypts'); + }); + } +} +keys.forEach(testMessage); \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/.npmignore b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/.npmignore new file mode 100644 index 00000000..07f1e72f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/.npmignore @@ -0,0 +1,6 @@ +benchmarks/ +node_modules/ +dist/*.js +npm-debug.log +1.js +v8.log diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/.travis.yml b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/.travis.yml new file mode 100644 index 00000000..92a990f6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.11" +branches: + only: + - master diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/Makefile b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/Makefile new file mode 100644 index 00000000..ff49cf60 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/Makefile @@ -0,0 +1,12 @@ +BROWSERIFY ?= ./node_modules/.bin/browserify +UGLIFY ?= ./node_modules/.bin/uglifyjs + +all: dist/elliptic.js dist/elliptic.min.js + +dist/elliptic.js: lib/elliptic.js + $(BROWSERIFY) --standalone ellipticjs $< -o $@ + +dist/elliptic.min.js: dist/elliptic.js + $(UGLIFY) --compress --mangle < $< > $@ + +.PHONY: all diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/README.md b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/README.md new file mode 100644 index 00000000..4adff926 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/README.md @@ -0,0 +1,140 @@ +# Elliptic [![Build Status](https://secure.travis-ci.org/indutny/elliptic.png)](http://travis-ci.org/indutny/elliptic) + +Fast elliptic-curve cryptography in a plain javascript implementation. + +NOTE: Please take a look at http://safecurves.cr.yp.to/ before choosing a curve +for your cryptography operations. + +## Incentive + +ECC is much slower than regular RSA cryptography, the JS implementations are +even more slower. + +## Benchmarks + +```bash +$ node benchmarks/index.js +Benchmarking: sign +elliptic#sign x 262 ops/sec ±0.51% (177 runs sampled) +eccjs#sign x 55.91 ops/sec ±0.90% (144 runs sampled) +------------------------ +Fastest is elliptic#sign +======================== +Benchmarking: verify +elliptic#verify x 113 ops/sec ±0.50% (166 runs sampled) +eccjs#verify x 48.56 ops/sec ±0.36% (125 runs sampled) +------------------------ +Fastest is elliptic#verify +======================== +Benchmarking: gen +elliptic#gen x 294 ops/sec ±0.43% (176 runs sampled) +eccjs#gen x 62.25 ops/sec ±0.63% (129 runs sampled) +------------------------ +Fastest is elliptic#gen +======================== +Benchmarking: ecdh +elliptic#ecdh x 136 ops/sec ±0.85% (156 runs sampled) +------------------------ +Fastest is elliptic#ecdh +======================== +``` + +## API + +### ECDSA + +```javascript +var EC = require('elliptic').ec; + +// Create and initialize EC context +// (better do it once and reuse it) +var ec = new EC('secp256k1'); + +// Generate keys +var key = ec.genKeyPair(); + +// Sign message (must be an array, or it'll be treated as a hex sequence) +var msg = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; +var signature = key.sign(msg); + +// Export DER encoded signature in Array +var derSign = signature.toDER(); + +// Verify signature +console.log(key.verify(msg, derSign)); +``` + +### ECDH + +```javascript +// Generate keys +var key1 = ec.genKeyPair(); +var key2 = ec.genKeyPair(); + +var shared1 = key1.derive(key2.getPublic()); +var shared2 = key2.derive(key1.getPublic()); + +console.log('Both shared secrets are BN instances'); +console.log(shared1.toString(16)); +console.log(shared2.toString(16)); +``` + +NOTE: `.derive()` returns a [BN][1] instance. + +## Supported curves + +Elliptic.js support following curve types: + +* Short Weierstrass +* Montgomery +* Edwards +* Twisted Edwards + +Following curve 'presets' are embedded into the library: + +* `secp256k1` +* `p192` +* `p224` +* `p256` +* `curve25519` +* `ed25519` + +NOTE: That `curve25519` could not be used for ECDSA, use `ed25519` instead. + +### Implementation details + +ECDSA is using deterministic `k` value generation as per [RFC6979][0]. Most of +the curve operations are performed on non-affine coordinates (either projective +or extended), various windowing techniques are used for different cases. + +All operations are performed in reduction context using [bn.js][1], hashing is +provided by [hash.js][2] + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2014. + +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. + +[0]: http://tools.ietf.org/html/rfc6979 +[1]: https://github.com/indutny/bn.js +[2]: https://github.com/indutny/hash.js diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/dist/.gitkeep b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/dist/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js new file mode 100644 index 00000000..55654e83 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic.js @@ -0,0 +1,11 @@ +var elliptic = exports; + +elliptic.version = require('../package.json').version; +elliptic.utils = require('./elliptic/utils'); +elliptic.rand = require('brorand'); +elliptic.hmacDRBG = require('./elliptic/hmac-drbg'); +elliptic.curve = require('./elliptic/curve'); +elliptic.curves = require('./elliptic/curves'); + +// Protocols +elliptic.ec = require('./elliptic/ec'); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/base.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/base.js new file mode 100644 index 00000000..53afe17d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/base.js @@ -0,0 +1,302 @@ +var bn = require('bn.js'); +var elliptic = require('../../elliptic'); + +var getNAF = elliptic.utils.getNAF; +var getJSF = elliptic.utils.getJSF; +var assert = elliptic.utils.assert; + +function BaseCurve(type, conf) { + this.type = type; + this.p = new bn(conf.p, 16); + + // Use Montgomery, when there is no fast reduction for the prime + this.red = conf.prime ? bn.red(conf.prime) : bn.mont(this.p); + + // Useful for many curves + this.zero = new bn(0).toRed(this.red); + this.one = new bn(1).toRed(this.red); + this.two = new bn(2).toRed(this.red); + + // Curve configuration, optional + this.n = conf.n && new bn(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + + // Temporary arrays + this._wnafT1 = new Array(4); + this._wnafT2 = new Array(4); + this._wnafT3 = new Array(4); + this._wnafT4 = new Array(4); +} +module.exports = BaseCurve; + +BaseCurve.prototype.point = function point() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype.validate = function validate(point) { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { + var doubles = p._getDoubles(); + + var naf = getNAF(k, 1); + var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); + I /= 3; + + // Translate into more windowed form + var repr = []; + for (var j = 0; j < naf.length; j += doubles.step) { + var nafW = 0; + for (var k = j + doubles.step - 1; k >= j; k--) + nafW = (nafW << 1) + naf[k]; + repr.push(nafW); + } + + var a = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + for (var i = I; i > 0; i--) { + for (var j = 0; j < repr.length; j++) { + var nafW = repr[j]; + if (nafW === i) + b = b.mixedAdd(doubles.points[j]); + else if (nafW === -i) + b = b.mixedAdd(doubles.points[j].neg()); + } + a = a.add(b); + } + return a.toP(); +}; + +BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; + + // Precompute window + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + + // Get NAF form + var naf = getNAF(k, w); + + // Add `this`*(N+1) for every w-NAF index + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + // Count zeroes + for (var k = 0; i >= 0 && naf[i] === 0; i--) + k++; + if (i >= 0) + k++; + acc = acc.dblp(k); + + if (i < 0) + break; + var z = naf[i]; + assert(z !== 0); + if (p.type === 'affine') { + // J +- P + if (z > 0) + acc = acc.mixedAdd(wnd[(z - 1) >> 1]); + else + acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); + } else { + // J +- J + if (z > 0) + acc = acc.add(wnd[(z - 1) >> 1]); + else + acc = acc.add(wnd[(-z - 1) >> 1].neg()); + } + } + return p.type === 'affine' ? acc.toP() : acc; +}; + +BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, + points, + coeffs, + len) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; + + // Fill all arrays + var max = 0; + for (var i = 0; i < len; i++) { + var p = points[i]; + var nafPoints = p._getNAFPoints(defW); + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; + } + + // Comb small window NAFs + for (var i = len - 1; i >= 1; i -= 2) { + var a = i - 1; + var b = i; + if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { + naf[a] = getNAF(coeffs[a], wndWidth[a]); + naf[b] = getNAF(coeffs[b], wndWidth[b]); + max = Math.max(naf[a].length, max); + max = Math.max(naf[b].length, max); + continue; + } + + var comb = [ + points[a], /* 1 */ + null, /* 3 */ + null, /* 5 */ + points[b] /* 7 */ + ]; + + // Try to avoid Projective points, if possible + if (points[a].y.cmp(points[b].y) === 0) { + comb[1] = points[a].add(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].add(points[b].neg()); + } else { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } + + var index = [ + -3, /* -1 -1 */ + -1, /* -1 0 */ + -5, /* -1 1 */ + -7, /* 0 -1 */ + 0, /* 0 0 */ + 7, /* 0 1 */ + 5, /* 1 -1 */ + 1, /* 1 0 */ + 3 /* 1 1 */ + ]; + + var jsf = getJSF(coeffs[a], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a] = new Array(max); + naf[b] = new Array(max); + for (var j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + + naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a] = comb; + } + } + + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + for (var i = max; i >= 0; i--) { + var k = 0; + + while (i >= 0) { + var zero = true; + for (var j = 0; j < len; j++) { + tmp[j] = naf[j][i] | 0; + if (tmp[j] !== 0) + zero = false; + } + if (!zero) + break; + k++; + i--; + } + if (i >= 0) + k++; + acc = acc.dblp(k); + if (i < 0) + break; + + for (var j = 0; j < len; j++) { + var z = tmp[j]; + var p; + if (z === 0) + continue; + else if (z > 0) + p = wnd[j][(z - 1) >> 1]; + else if (z < 0) + p = wnd[j][(-z - 1) >> 1].neg(); + + if (p.type === 'affine') + acc = acc.mixedAdd(p); + else + acc = acc.add(p); + } + } + // Zeroify references + for (var i = 0; i < len; i++) + wnd[i] = null; + return acc.toP(); +}; + +BaseCurve.BasePoint = BasePoint; + +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} + +BasePoint.prototype.validate = function validate() { + return this.curve.validate(this); +}; + +BasePoint.prototype.precompute = function precompute(power, _beta) { + if (this.precomputed) + return this; + + var precomputed = { + doubles: null, + naf: null, + beta: null + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + + return this; +}; + +BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + + var doubles = [ this ]; + var acc = this; + for (var i = 0; i < power; i += step) { + for (var j = 0; j < step; j++) + acc = acc.dbl(); + doubles.push(acc); + } + return { + step: step, + points: doubles + }; +}; + +BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + + var res = [ this ]; + var max = (1 << wnd) - 1; + var dbl = max === 1 ? null : this.dbl(); + for (var i = 1; i < max; i++) + res[i] = res[i - 1].add(dbl); + return { + wnd: wnd, + points: res + }; +}; + +BasePoint.prototype._getBeta = function _getBeta() { + return null; +}; + +BasePoint.prototype.dblp = function dblp(k) { + var r = this; + for (var i = 0; i < k; i++) + r = r.dbl(); + return r; +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/edwards.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/edwards.js new file mode 100644 index 00000000..85905b37 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/edwards.js @@ -0,0 +1,361 @@ +var curve = require('../curve'); +var elliptic = require('../../elliptic'); +var bn = require('bn.js'); +var inherits = require('inherits'); +var Base = curve.base; + +var getNAF = elliptic.utils.getNAF; +var assert = elliptic.utils.assert; + +function EdwardsCurve(conf) { + // NOTE: Important as we are creating point in Base.call() + this.twisted = conf.a != 1; + this.mOneA = this.twisted && conf.a == -1; + this.extended = this.mOneA; + + Base.call(this, 'mont', conf); + + this.a = new bn(conf.a, 16).mod(this.red.m).toRed(this.red); + this.c = new bn(conf.c, 16).toRed(this.red); + this.c2 = this.c.redSqr(); + this.d = new bn(conf.d, 16).toRed(this.red); + this.dd = this.d.redAdd(this.d); + + assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); + this.oneC = conf.c == 1; +} +inherits(EdwardsCurve, Base); +module.exports = EdwardsCurve; + +EdwardsCurve.prototype._mulA = function _mulA(num) { + if (this.mOneA) + return num.redNeg(); + else + return this.a.redMul(num); +}; + +EdwardsCurve.prototype._mulC = function _mulC(num) { + if (this.oneC) + return num; + else + return this.c.redMul(num); +}; + +EdwardsCurve.prototype.point = function point(x, y, z, t) { + return new Point(this, x, y, z, t); +}; + +// Just for compatibility with Short curve +EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { + return this.point(x, y, z, t); +}; + +EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +EdwardsCurve.prototype.pointFromX = function pointFromX(odd, x) { + x = new bn(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var x2 = x.redSqr(); + var rhs = this.c2.redSub(this.a.redMul(x2)); + var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); + + var y = rhs.redMul(lhs.redInvm()).redSqrt(); + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y, curve.one); +}; + +EdwardsCurve.prototype.validate = function validate(point) { + if (point.isInfinity()) + return true; + + // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2) + point.normalize(); + + var x2 = point.x.redSqr(); + var y2 = point.y.redSqr(); + var lhs = x2.redMul(this.a).redAdd(y2); + var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); + + return lhs.cmp(rhs) === 0; +}; + +function Point(curve, x, y, z, t) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && y === null && z === null) { + this.x = this.curve.zero; + this.y = this.curve.one; + this.z = this.curve.one; + this.t = this.curve.zero; + this.zOne = true; + } else { + this.x = new bn(x, 16); + this.y = new bn(y, 16); + this.z = z ? new bn(z, 16) : this.curve.one; + this.t = t && new bn(t, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + if (this.t && !this.t.red) + this.t = this.t.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; + + // Use extended coordinates + if (this.curve.extended && !this.t) { + this.t = this.x.redMul(this.y); + if (!this.zOne) + this.t = this.t.redMul(this.z.redInvm()); + } + } +} +inherits(Point, Base.BasePoint); + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1], obj[2]); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.x.cmpn(0) === 0 && + this.y.cmp(this.z) === 0; +}; + +Point.prototype._extDbl = function _extDbl() { + // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-dbl-2008-hwcd + // 4M + 4S + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = 2 * Z1^2 + var c = this.z.redSqr(); + c = c.redIAdd(c); + // D = a * A + var d = this.curve._mulA(a); + // E = (X1 + Y1)^2 - A - B + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + // G = D + B + var g = d.redAdd(b); + // F = G - C + var f = g.redSub(c); + // H = D - B + var h = d.redSub(b); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projDbl = function _projDbl() { + // http://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#doubling-dbl-2008-bbjlp + // http://hyperelliptic.org/EFD/g1p/auto-edwards-projective.html#doubling-dbl-2007-bl + // and others + // Generally 3M + 4S or 2M + 4S + + // B = (X1 + Y1)^2 + var b = this.x.redAdd(this.y).redSqr(); + // C = X1^2 + var c = this.x.redSqr(); + // D = Y1^2 + var d = this.y.redSqr(); + + if (this.curve.twisted) { + // E = a * C + var e = this.curve._mulA(c); + // F = E + D + var f = e.redAdd(d); + if (this.zOne) { + // X3 = (B - C - D) * (F - 2) + var nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + // Y3 = F * (E - D) + var ny = f.redMul(e.redSub(d)); + // Z3 = F^2 - 2 * F + var nz = f.redSqr().redSub(f).redSub(f); + } else { + // H = Z1^2 + var h = this.z.redSqr(); + // J = F - 2 * H + var j = f.redSub(h).redISub(h); + // X3 = (B-C-D)*J + var nx = b.redSub(c).redISub(d).redMul(j); + // Y3 = F * (E - D) + var ny = f.redMul(e.redSub(d)); + // Z3 = F * J + var nz = f.redMul(j); + } + } else { + // E = C + D + var e = c.redAdd(d); + // H = (c * Z1)^2 + var h = this.curve._mulC(redMul(this.z)).redSqr(); + // J = E - 2 * H + var j = e.redSub(h).redSub(h); + // X3 = c * (B - E) * J + var nx = this.curve._mulC(b.redISub(e)).redMul(j); + // Y3 = c * E * (C - D) + var ny = this.curve._mulC(e).redMul(c.redISub(d)); + // Z3 = E * J + var nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + // Double in extended coordinates + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); +}; + +Point.prototype._extAdd = function _extAdd(p) { + // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3 + // 8M + + // A = (Y1 - X1) * (Y2 - X2) + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + // B = (Y1 + X1) * (Y2 + X2) + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + // C = T1 * k * T2 + var c = this.t.redMul(this.curve.dd).redMul(p.t); + // D = Z1 * 2 * Z2 + var d = this.z.redMul(p.z.redAdd(p.z)); + // E = B - A + var e = b.redSub(a); + // F = D - C + var f = d.redSub(c); + // G = D + C + var g = d.redAdd(c); + // H = B + A + var h = b.redAdd(a); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projAdd = function _projAdd(p) { + // http://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#addition-add-2008-bbjlp + // http://hyperelliptic.org/EFD/g1p/auto-edwards-projective.html#addition-add-2007-bl + // 10M + 1S + + // A = Z1 * Z2 + var a = this.z.redMul(p.z); + // B = A^2 + var b = a.redSqr(); + // C = X1 * X2 + var c = this.x.redMul(p.x); + // D = Y1 * Y2 + var d = this.y.redMul(p.y); + // E = d * C * D + var e = this.curve.d.redMul(c).redMul(d); + // F = B - E + var f = b.redSub(e); + // G = B + E + var g = b.redAdd(e); + // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D) + var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); + var nx = a.redMul(f).redMul(tmp); + if (this.curve.twisted) { + // Y3 = A * G * (D - a * C) + var ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + // Z3 = F * G + var nz = f.redMul(g); + } else { + // Y3 = A * G * (D - C) + var ny = a.redMul(g).redMul(d.redSub(c)); + // Z3 = c * F * G + var nz = this.curve._mulC(f).redMul(g); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.add = function add(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + + if (this.curve.extended) + return this._extAdd(p); + else + return this._projAdd(p); +}; + +Point.prototype.mul = function mul(k) { + if (this.precomputed && this.precomputed.doubles) + return this.curve._fixedNafMul(this, k); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2); +}; + +Point.prototype.normalize = function normalize() { + if (this.zOne) + return this; + + // Normalize coordinates + var zi = this.z.redInvm(); + this.x = this.x.redMul(zi); + this.y = this.y.redMul(zi); + if (this.t) + this.t = this.t.redMul(zi); + this.z = this.curve.one; + this.zOne = true; + return this; +}; + +Point.prototype.neg = function neg() { + return this.curve.point(this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg()); +}; + +Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + this.normalize(); + return this.y.fromRed(); +}; + +// Compatibility with BaseCurve +Point.prototype.toP = Point.prototype.normalize; +Point.prototype.mixedAdd = Point.prototype.add; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js new file mode 100644 index 00000000..4ea180cc --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/index.js @@ -0,0 +1,6 @@ +var curve = exports; + +curve.base = require('./base'); +curve.short = require('./short'); +curve.mont = require('./mont'); +curve.edwards = require('./edwards'); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/mont.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/mont.js new file mode 100644 index 00000000..903d2711 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/mont.js @@ -0,0 +1,163 @@ +var curve = require('../curve'); +var elliptic = require('../../elliptic'); +var bn = require('bn.js'); +var inherits = require('inherits'); +var Base = curve.base; + +var getNAF = elliptic.utils.getNAF; +var assert = elliptic.utils.assert; + +function MontCurve(conf) { + Base.call(this, 'mont', conf); + + this.a = new bn(conf.a, 16).toRed(this.red); + this.b = new bn(conf.b, 16).toRed(this.red); + this.i4 = new bn(4).toRed(this.red).redInvm(); + this.two = new bn(2).toRed(this.red); + this.a24 = this.i4.redMul(this.a.redAdd(this.two)); +} +inherits(MontCurve, Base); +module.exports = MontCurve; + +MontCurve.prototype.point = function point(x, z) { + return new Point(this, x, z); +}; + +MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +} + +MontCurve.prototype.validate = function validate(point) { + var x = point.normalize().x; + var x2 = x.redSqr(); + var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); + var y = rhs.redSqrt(); + + return y.redSqr().cmp(rhs) === 0; +}; + +function Point(curve, x, z) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && z === null) { + this.x = this.curve.one; + this.z = this.curve.zero; + } else { + this.x = new bn(x, 16); + this.z = new bn(z, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + } +} +inherits(Point, Base.BasePoint); + +Point.prototype.precompute = function precompute() { + // No-op +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1] || curve.one); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + +Point.prototype.dbl = function dbl() { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3 + // 2M + 2S + 4A + + // A = X1 + Z1 + var a = this.x.redAdd(this.z); + // AA = A^2 + var aa = a.redSqr(); + // B = X1 - Z1 + var b = this.x.redSub(this.z); + // BB = B^2 + var bb = b.redSqr(); + // C = AA - BB + var c = aa.redSub(bb); + // X3 = AA * BB + var nx = aa.redMul(bb); + // Z3 = C * (BB + A24 * C) + var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); + return this.curve.point(nx, nz); +}; + +Point.prototype.add = function add(p) { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.diffAdd = function diffAdd(p, diff) { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3 + // 4M + 2S + 6A + + // A = X2 + Z2 + var a = this.x.redAdd(this.z); + // B = X2 - Z2 + var b = this.x.redSub(this.z); + // C = X3 + Z3 + var c = p.x.redAdd(p.z); + // D = X3 - Z3 + var d = p.x.redSub(p.z); + // DA = D * A + var da = d.redMul(a); + // CB = C * B + var cb = c.redMul(b); + // X5 = Z1 * (DA + CB)^2 + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + // Z5 = X1 * (DA - CB)^2 + var nz = diff.x.redMul(da.redISub(cb).redSqr()); + return this.curve.point(nx, nz); +}; + +Point.prototype.mul = function mul(k) { + var t = k.clone(); + var a = this; // (N / 2) * Q + Q + var b = this.curve.point(null, null); // (N / 2) * Q + var c = this; // Q + + for (var bits = []; t.cmpn(0) !== 0; t.ishrn(1)) + bits.push(t.andln(1)); + + for (var i = bits.length - 1; i >= 0; i--) { + if (bits[i] === 0) { + // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q + a = a.diffAdd(b, c); + // N * Q = 2 * ((N / 2) * Q + Q)) + b = b.dbl(); + } else { + // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q) + b = a.diffAdd(b, c); + // N * Q + Q = 2 * ((N / 2) * Q + Q) + a = a.dbl(); + } + } + return b; +}; + +Point.prototype.mulAdd = function mulAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.normalize = function normalize() { + this.x = this.x.redMul(this.z.redInvm()); + this.z = this.curve.one; + return this; +}; + +Point.prototype.getX = function getX() { + // Normalize coordinates + this.normalize(); + + return this.x.fromRed(); +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/short.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/short.js new file mode 100644 index 00000000..0cd45a54 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curve/short.js @@ -0,0 +1,896 @@ +var curve = require('../curve'); +var elliptic = require('../../elliptic'); +var bn = require('bn.js'); +var inherits = require('inherits'); +var Base = curve.base; + +var getNAF = elliptic.utils.getNAF; +var assert = elliptic.utils.assert; + +function ShortCurve(conf) { + Base.call(this, 'short', conf); + + this.a = new bn(conf.a, 16).toRed(this.red); + this.b = new bn(conf.b, 16).toRed(this.red); + this.tinv = this.two.redInvm(); + + this.zeroA = this.a.fromRed().cmpn(0) === 0; + this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; + + // If the curve is endomorphic, precalculate beta and lambda + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); +} +inherits(ShortCurve, Base); +module.exports = ShortCurve; + +ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + // No efficient endomorphism + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + + // Compute beta and lambda, that lambda * P = (beta * Px; Py) + var beta; + var lambda; + if (conf.beta) { + beta = new bn(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + // Choose the smallest beta + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new bn(conf.lambda, 16); + } else { + // Choose the lambda that is matching selected beta + var lambdas = this._getEndoRoots(this.n); + if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { + lambda = lambdas[0]; + } else { + lambda = lambdas[1]; + assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + + // Get basis vectors, used for balanced length-two representation + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new bn(vec.a, 16), + b: new bn(vec.b, 16), + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + + return { + beta: beta, + lambda: lambda, + basis: basis + }; +}; + +ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + // Find roots of for x^2 + x + 1 in F + // Root = (-1 +- Sqrt(-3)) / 2 + // + var red = num === this.p ? this.red : bn.mont(num); + var tinv = new bn(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + var one = new bn(1).toRed(red); + + var s = new bn(3).toRed(red).redNeg().redSqrt().redMul(tinv); + + var l1 = ntinv.redAdd(s).fromRed(); + var l2 = ntinv.redSub(s).fromRed(); + return [ l1, l2 ]; +}; + +ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { + // aprxSqrt >= sqrt(this.n) + var aprxSqrt = this.n.shrn(Math.floor(this.n.bitLength() / 2)); + + // 3.74 + // Run EGCD, until r(L + 1) < aprxSqrt + var u = lambda; + var v = this.n.clone(); + var x1 = new bn(1); + var y1 = new bn(0); + var x2 = new bn(0); + var y2 = new bn(1); + + // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) + var a0; + var b0; + // First vector + var a1; + var b1; + // Second vector + var a2; + var b2; + + var prevR; + var i = 0; + while (u.cmpn(0) !== 0) { + var q = v.div(u); + var r = v.sub(q.mul(u)); + var x = x2.sub(q.mul(x1)); + var y = y2.sub(q.mul(y1)); + + if (!a1 && r.cmp(aprxSqrt) < 0) { + a0 = prevR.neg(); + b0 = x1; + a1 = r.neg(); + b1 = x; + } else if (a1 && ++i === 2) { + break; + } + prevR = r; + + v = u; + u = r; + x2 = x1; + x1 = x; + y2 = y1; + y1 = y; + } + a2 = r.neg(); + b2 = x; + + var len1 = a1.sqr().add(b1.sqr()); + var len2 = a2.sqr().add(b2.sqr()); + if (len2.cmp(len1) >= 0) { + a2 = a0; + b2 = b0; + } + + // Normalize signs + if (a1.sign) { + a1 = a1.neg(); + b1 = b1.neg(); + } + if (a2.sign) { + a2 = a2.neg(); + b2 = b2.neg(); + } + + return [ + { a: a1, b: b1 }, + { a: a2, b: b2 } + ]; +}; + +ShortCurve.prototype._endoSplit = function _endoSplit(k) { + var basis = this.endo.basis; + var v1 = basis[0]; + var v2 = basis[1]; + + var c1 = v2.b.mul(k).divRound(this.n); + var c2 = v1.b.neg().mul(k).divRound(this.n); + + var p1 = c1.mul(v1.a); + var p2 = c2.mul(v2.a); + var q1 = c1.mul(v1.b); + var q2 = c2.mul(v2.b); + + // Calculate answer + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1: k1, k2: k2 }; +}; + +ShortCurve.prototype.point = function point(x, y, isRed) { + return new Point(this, x, y, isRed); +}; + +ShortCurve.prototype.pointFromX = function pointFromX(odd, x) { + x = new bn(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); + var y = y2.redSqrt(); + + // XXX Is there any way to tell if the number is odd without converting it + // to non-red form? + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +ShortCurve.prototype.jpoint = function jpoint(x, y, z) { + return new JPoint(this, x, y, z); +}; + +ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { + return Point.fromJSON(this, obj, red); +}; + +ShortCurve.prototype.validate = function validate(point) { + if (point.inf) + return true; + + var x = point.x; + var y = point.y; + + var ax = this.a.redMul(x); + var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); + return y.redSqr().redISub(rhs).cmpn(0) === 0; +}; + +ShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs) { + var npoints = this._endoWnafT1; + var ncoeffs = this._endoWnafT2; + for (var i = 0; i < points.length; i++) { + var split = this._endoSplit(coeffs[i]); + var p = points[i]; + var beta = p._getBeta(); + + if (split.k1.sign) { + split.k1.sign = !split.k1.sign; + p = p.neg(true); + } + if (split.k2.sign) { + split.k2.sign = !split.k2.sign; + beta = beta.neg(true); + } + + npoints[i * 2] = p; + npoints[i * 2 + 1] = beta; + ncoeffs[i * 2] = split.k1; + ncoeffs[i * 2 + 1] = split.k2; + } + var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2); + + // Clean-up references to points and coefficients + for (var j = 0; j < i * 2; j++) { + npoints[j] = null; + ncoeffs[j] = null; + } + return res; +}; + +function Point(curve, x, y, isRed) { + Base.BasePoint.call(this, curve, 'affine'); + if (x === null && y === null) { + this.x = null; + this.y = null; + this.inf = true; + } else { + this.x = new bn(x, 16); + this.y = new bn(y, 16); + // Force redgomery representation when loading from JSON + if (isRed) { + this.x.forceRed(this.curve.red); + this.y.forceRed(this.curve.red); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + this.inf = false; + } +} +inherits(Point, Base.BasePoint); + +Point.prototype._getBeta = function _getBeta() { + if (!this.curve.endo) + return; + + var pre = this.precomputed; + if (pre && pre.beta) + return pre.beta; + + var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (pre) { + var curve = this.curve; + function endoMul(p) { + return curve.point(p.x.redMul(curve.endo.beta), p.y); + } + pre.beta = beta; + beta.precomputed = { + beta: null, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(endoMul) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(endoMul) + } + }; + } + return beta; +}; + +Point.prototype.toJSON = function toJSON() { + if (!this.precomputed) + return [ this.x, this.y ]; + + return [ this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1) + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1) + } + }]; +}; + +Point.fromJSON = function fromJSON(curve, obj, red) { + if (typeof obj === 'string') + obj = JSON.parse(obj); + var res = curve.point(obj[0], obj[1], red); + if (!obj[2]) + return res; + + function obj2point(obj) { + return curve.point(obj[0], obj[1], red); + } + + var pre = obj[2]; + res.precomputed = { + beta: null, + doubles: pre.doubles && { + step: pre.doubles.step, + points: [ res ].concat(pre.doubles.points.map(obj2point)) + }, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: [ res ].concat(pre.naf.points.map(obj2point)) + } + }; + return res; +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + return this.inf; +}; + +Point.prototype.add = function add(p) { + // O + P = P + if (this.inf) + return p; + + // P + O = P + if (p.inf) + return this; + + // P + P = 2P + if (this.eq(p)) + return this.dbl(); + + // P + (-P) = O + if (this.neg().eq(p)) + return this.curve.point(null, null); + + // P + Q = O + if (this.x.cmp(p.x) === 0) + return this.curve.point(null, null); + + var c = this.y.redSub(p.y); + if (c.cmpn(0) !== 0) + c = c.redMul(this.x.redSub(p.x).redInvm()); + var nx = c.redSqr().redISub(this.x).redISub(p.x); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.dbl = function dbl() { + if (this.inf) + return this; + + // 2P = O + var ys1 = this.y.redAdd(this.y); + if (ys1.cmpn(0) === 0) + return this.curve.point(null, null); + + var a = this.curve.a; + + var x2 = this.x.redSqr(); + var dyinv = ys1.redInvm(); + var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); + + var nx = c.redSqr().redISub(this.x.redAdd(this.x)); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.getX = function getX() { + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + return this.y.fromRed(); +}; + +Point.prototype.mul = function mul(k) { + k = new bn(k, 16); + + if (this.precomputed && this.precomputed.doubles) + return this.curve._fixedNafMul(this, k); + else if (this.curve.endo) + return this.curve._endoWnafMulAdd([ this ], [ k ]); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2); +}; + +Point.prototype.eq = function eq(p) { + return this === p || + this.inf === p.inf && + (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); +}; + +Point.prototype.neg = function neg(_precompute) { + if (this.inf) + return this; + + var res = this.curve.point(this.x, this.y.redNeg()); + if (_precompute && this.precomputed) { + var pre = this.precomputed; + function negate(p) { + return p.neg(); + } + res.precomputed = { + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(negate) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(negate) + } + }; + } + return res; +}; + +Point.prototype.toJ = function toJ() { + if (this.inf) + return this.curve.jpoint(null, null, null); + + var res = this.curve.jpoint(this.x, this.y, this.curve.one); + return res; +}; + +function JPoint(curve, x, y, z) { + Base.BasePoint.call(this, curve, 'jacobian'); + if (x === null && y === null && z === null) { + this.x = this.curve.one; + this.y = this.curve.one; + this.z = new bn(0); + } else { + this.x = new bn(x, 16); + this.y = new bn(y, 16); + this.z = new bn(z, 16); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + + this.zOne = this.z === this.curve.one; +} +inherits(JPoint, Base.BasePoint); + +JPoint.prototype.toP = function toP() { + if (this.isInfinity()) + return this.curve.point(null, null); + + var zinv = this.z.redInvm(); + var zinv2 = zinv.redSqr(); + var ax = this.x.redMul(zinv2); + var ay = this.y.redMul(zinv2).redMul(zinv); + + return this.curve.point(ax, ay); +}; + +JPoint.prototype.neg = function neg() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); +}; + +JPoint.prototype.add = function add(p) { + // O + P = P + if (this.isInfinity()) + return p; + + // P + O = P + if (p.isInfinity()) + return this; + + // 12M + 4S + 7A + var pz2 = p.z.redSqr(); + var z2 = this.z.redSqr(); + var u1 = this.x.redMul(pz2); + var u2 = p.x.redMul(z2); + var s1 = this.y.redMul(pz2.redMul(p.z)); + var s2 = p.y.redMul(z2.redMul(this.z)); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(p.z).redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mixedAdd = function mixedAdd(p) { + // O + P = P + if (this.isInfinity()) + return p.toJ(); + + // P + O = P + if (p.isInfinity()) + return this; + + // 8M + 3S + 7A + var z2 = this.z.redSqr(); + var u1 = this.x; + var u2 = p.x.redMul(z2); + var s1 = this.y; + var s2 = p.y.redMul(z2).redMul(this.z); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.dblp = function dblp(pow) { + if (pow === 0) + return this; + if (this.isInfinity()) + return this; + if (!pow) + return this.dbl(); + + if (this.curve.zeroA || this.curve.threeA) { + var r = this; + for (var i = 0; i < pow; i++) + r = r.dbl(); + return r; + } + + // 1M + 2S + 1A + N * (4S + 5M + 8A) + // N = 1 => 6M + 6S + 9A + var a = this.curve.a; + var tinv = this.curve.tinv; + + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + // Reuse results + var jyd = jy.redAdd(jy); + for (var i = 0; i < pow; i++) { + var jx2 = jx.redSqr(); + var jyd2 = jyd.redSqr(); + var jyd4 = jyd2.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var t1 = jx.redMul(jyd2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var dny = c.redMul(t2); + dny = dny.redIAdd(dny).redISub(jyd4); + var nz = jyd.redMul(jz); + if (i + 1 < pow) + jz4 = jz4.redMul(jyd4); + + jx = nx; + jz = nz; + jyd = dny; + } + + return this.curve.jpoint(jx, jyd.redMul(tinv), jz); +}; + +JPoint.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + if (this.curve.zeroA) + return this._zeroDbl(); + else if (this.curve.threeA) + return this._threeDbl(); + else + return this._dbl(); +}; + +JPoint.prototype._zeroDbl = function _zeroDbl() { + // Z = 1 + if (this.zOne) { + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl + // 1M + 5S + 14A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // T = M ^ 2 - 2*S + var t = m.redSqr().redISub(s).redISub(s); + + // 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + + // X3 = T + var nx = t; + // Y3 = M * (S - T) - 8 * YYYY + var ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2*Y1 + var nz = this.y.redAdd(this.y); + } else { + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l + // 2M + 5S + 13A + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = B^2 + var c = b.redSqr(); + // D = 2 * ((X1 + B)^2 - A - C) + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + // E = 3 * A + var e = a.redAdd(a).redIAdd(a); + // F = E^2 + var f = e.redSqr(); + + // 8 * C + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + + // X3 = F - 2 * D + var nx = f.redISub(d).redISub(d); + // Y3 = E * (D - X3) - 8 * C + var ny = e.redMul(d.redISub(nx)).redISub(c8); + // Z3 = 2 * Y1 * Z1 + var nz = this.y.redMul(this.z); + nz = nz.redIAdd(nz); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._threeDbl = function _threeDbl() { + // Z = 1 + if (this.zOne) { + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-mdbl-2007-bl + // 1M + 5S + 15A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + // T = M^2 - 2 * S + var t = m.redSqr().redISub(s).redISub(s); + // X3 = T + var nx = t; + // Y3 = M * (S - T) - 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + var ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2 * Y1 + var nz = this.y.redAdd(this.y); + } else { + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b + // 3M + 5S + + // delta = Z1^2 + var delta = this.z.redSqr(); + // gamma = Y1^2 + var gamma = this.y.redSqr(); + // beta = X1 * gamma + var beta = this.x.redMul(gamma); + // alpha = 3 * (X1 - delta) * (X1 + delta) + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + // X3 = alpha^2 - 8 * beta + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + var nx = alpha.redSqr().redISub(beta8); + // Z3 = (Y1 + Z1)^2 - gamma - delta + var nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 + var ggamma8 = gamma.redSqr(); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + var ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._dbl = function _dbl() { + var a = this.curve.a; + var tinv = this.curve.tinv; + + // 4M + 6S + 10A + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + var jx2 = jx.redSqr(); + var jy2 = jy.redSqr(); + + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var jxd4 = jx.redAdd(jx); + jxd4 = jxd4.redIAdd(jxd4); + var t1 = jxd4.redMul(jy2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + + var jyd8 = jy2.redSqr(); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + var ny = c.redMul(t2).redISub(jyd8); + var nz = jy.redAdd(jy).redMul(jz); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.trpl = function trpl() { + if (!this.curve.zeroA) + return this.dbl().add(this); + + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl + // 5M + 10S + ... + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // ZZ = Z1^2 + var zz = this.z.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // M = 3 * XX + a * ZZ2; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // MM = M^2 + var mm = m.redSqr(); + // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM + var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + e = e.redIAdd(e); + e = e.redAdd(e).redIAdd(e); + e = e.redISub(mm); + // EE = E^2 + var ee = e.redSqr(); + // T = 16*YYYY + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + // U = (M + E)^2 - MM - EE - T + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + // X3 = 4 * (X1 * EE - 4 * YY * U) + var yyu4 = yy.redMul(u); + yyu4 = yyu4.redIAdd(yyu4); + yyu4 = yyu4.redIAdd(yyu4); + var nx = this.x.redMul(ee).redISub(yyu4); + nx = nx.redIAdd(nx); + nx = nx.redIAdd(nx); + // Y3 = 8 * Y1 * (U * (T - U) - E * EE) + var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + // Z3 = (Z1 + E)^2 - ZZ - EE + var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mul = function mul(k, kbase) { + k = new bn(k, kbase); + + return this.curve._wnafMul(this, k); +}; + +JPoint.prototype.eq = function eq(p) { + if (p.type === 'affine') + return this.eq(p.toJ()); + + if (this === p) + return true; + + // x1 * z2^2 == x2 * z1^2 + var z2 = this.z.redSqr(); + var pz2 = p.z.redSqr(); + if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) + return false; + + // y1 * z2^3 == y2 * z1^3 + var z3 = z2.redMul(this.z); + var pz3 = pz2.redMul(p.z); + return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; +}; + +JPoint.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +JPoint.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curves.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curves.js new file mode 100644 index 00000000..539d8a57 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/curves.js @@ -0,0 +1,928 @@ +var curves = exports; + +var hash = require('hash.js'); +var bn = require('bn.js'); +var elliptic = require('../elliptic'); + +var assert = elliptic.utils.assert; + +function PresetCurve(options) { + if (options.type === 'short') + this.curve = new elliptic.curve.short(options); + else if (options.type === 'edwards') + this.curve = new elliptic.curve.edwards(options); + else + this.curve = new elliptic.curve.mont(options); + this.g = this.curve.g; + this.n = this.curve.n; + this.hash = options.hash; + + assert(this.g.validate(), 'Invalid curve'); + assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); +} +curves.PresetCurve = PresetCurve; + +function defineCurve(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve + }); + return curve; + } + }); +} + +defineCurve('p192', { + type: 'short', + prime: 'p192', + p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', + b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', + n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', + hash: hash.sha256, + gRed: false, + g: [ + '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', + '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811' + ], +}); + +defineCurve('p224', { + type: 'short', + prime: 'p224', + p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', + b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', + n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', + hash: hash.sha256, + gRed: false, + g: [ + 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', + 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34' + ], +}); + +defineCurve('p256', { + type: 'short', + prime: null, + p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', + a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', + b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', + n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', + hash: hash.sha256, + gRed: false, + g: [ + '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', + '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5' + ], +}); + +defineCurve('curve25519', { + type: 'mont', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '76d06', + b: '0', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '9' + ] +}); + +defineCurve('ed25519', { + type: 'edwards', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '-1', + c: '1', + // -121665 * (121666^(-1)) (mod P) + d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', + + // 4/5 + '6666666666666666666666666666666666666666666666666666666666666658' + ] +}); + +defineCurve('secp256k1', { + type: 'short', + prime: 'k256', + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', + h: '1', + hash: hash.sha256, + + // Precomputed endomorphism + beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', + lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', + basis: [ + { + a: '3086d221a7d46bcde86c90e49284eb15', + b: '-e4437ed6010e88286f547fa90abfe4c3' + }, + { + a: '114ca50f7a8e2f3f657c1108d9d44cfd8', + b: '3086d221a7d46bcde86c90e49284eb15' + } + ], + + gRed: false, + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', + { + 'doubles': { + 'step': 4, + 'points': [ + [ + 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a', + 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821' + ], + [ + '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508', + '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf' + ], + [ + '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739', + 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695' + ], + [ + '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640', + '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9' + ], + [ + '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c', + '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36' + ], + [ + '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda', + '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f' + ], + [ + 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa', + '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999' + ], + [ + '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0', + 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09' + ], + [ + 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d', + '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d' + ], + [ + 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d', + 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088' + ], + [ + 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1', + '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d' + ], + [ + '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0', + '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8' + ], + [ + '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047', + '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a' + ], + [ + '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862', + '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453' + ], + [ + '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7', + '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160' + ], + [ + '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd', + '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0' + ], + [ + '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83', + '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6' + ], + [ + '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a', + '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589' + ], + [ + '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8', + 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17' + ], + [ + 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d', + '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda' + ], + [ + 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725', + '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd' + ], + [ + '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754', + '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2' + ], + [ + '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c', + '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6' + ], + [ + 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6', + '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f' + ], + [ + '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39', + 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01' + ], + [ + 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891', + '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3' + ], + [ + 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b', + 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f' + ], + [ + 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03', + '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7' + ], + [ + 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d', + 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78' + ], + [ + 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070', + '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1' + ], + [ + '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4', + 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150' + ], + [ + '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da', + '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82' + ], + [ + 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11', + '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc' + ], + [ + '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e', + 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b' + ], + [ + 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41', + '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51' + ], + [ + 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef', + '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45' + ], + [ + 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8', + 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120' + ], + [ + '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d', + '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84' + ], + [ + '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96', + '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d' + ], + [ + '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd', + 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d' + ], + [ + '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5', + '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8' + ], + [ + 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266', + '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8' + ], + [ + '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71', + '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac' + ], + [ + '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac', + 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f' + ], + [ + '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751', + '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962' + ], + [ + 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e', + '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907' + ], + [ + '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241', + 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec' + ], + [ + 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3', + 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d' + ], + [ + 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f', + '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414' + ], + [ + '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19', + 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd' + ], + [ + '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be', + 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0' + ], + [ + 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9', + '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811' + ], + [ + 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2', + '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1' + ], + [ + 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13', + '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c' + ], + [ + '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c', + 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73' + ], + [ + '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba', + '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd' + ], + [ + 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151', + 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405' + ], + [ + '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073', + 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589' + ], + [ + '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458', + '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e' + ], + [ + '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b', + '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27' + ], + [ + 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366', + 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1' + ], + [ + '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa', + '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482' + ], + [ + '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0', + '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945' + ], + [ + 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787', + '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573' + ], + [ + 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e', + 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82' + ] + ] + }, + 'naf': { + 'wnd': 7, + 'points': [ + [ + 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9', + '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672' + ], + [ + '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4', + 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6' + ], + [ + '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc', + '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da' + ], + [ + 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe', + 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37' + ], + [ + '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb', + 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b' + ], + [ + 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8', + 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81' + ], + [ + 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e', + '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58' + ], + [ + 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34', + '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77' + ], + [ + '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c', + '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a' + ], + [ + '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5', + '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c' + ], + [ + '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f', + '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67' + ], + [ + '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714', + '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402' + ], + [ + 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729', + 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55' + ], + [ + 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db', + '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482' + ], + [ + '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4', + 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82' + ], + [ + '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5', + 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396' + ], + [ + '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479', + '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49' + ], + [ + '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d', + '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf' + ], + [ + '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f', + '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a' + ], + [ + '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb', + 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7' + ], + [ + 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9', + 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933' + ], + [ + '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963', + '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a' + ], + [ + '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74', + '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6' + ], + [ + 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530', + 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37' + ], + [ + '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b', + '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e' + ], + [ + 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247', + 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6' + ], + [ + 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1', + 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476' + ], + [ + '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120', + '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40' + ], + [ + '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435', + '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61' + ], + [ + '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18', + '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683' + ], + [ + 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8', + '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5' + ], + [ + '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb', + '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b' + ], + [ + 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f', + '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417' + ], + [ + '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143', + 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868' + ], + [ + '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba', + 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a' + ], + [ + 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45', + 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6' + ], + [ + '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a', + '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996' + ], + [ + '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e', + 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e' + ], + [ + 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8', + 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d' + ], + [ + '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c', + '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2' + ], + [ + '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519', + 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e' + ], + [ + '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab', + '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437' + ], + [ + '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca', + 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311' + ], + [ + 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf', + '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4' + ], + [ + '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610', + '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575' + ], + [ + '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4', + 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d' + ], + [ + '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c', + 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d' + ], + [ + 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940', + 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629' + ], + [ + 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980', + 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06' + ], + [ + '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3', + '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374' + ], + [ + '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf', + '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee' + ], + [ + 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63', + '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1' + ], + [ + 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448', + 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b' + ], + [ + '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf', + '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661' + ], + [ + '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5', + '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6' + ], + [ + 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6', + '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e' + ], + [ + '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5', + '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d' + ], + [ + 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99', + 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc' + ], + [ + '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51', + 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4' + ], + [ + '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5', + '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c' + ], + [ + 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5', + '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b' + ], + [ + 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997', + '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913' + ], + [ + '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881', + '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154' + ], + [ + '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5', + '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865' + ], + [ + '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66', + 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc' + ], + [ + '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726', + 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224' + ], + [ + '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede', + '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e' + ], + [ + '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94', + '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6' + ], + [ + '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31', + '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511' + ], + [ + '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51', + 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b' + ], + [ + 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252', + 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2' + ], + [ + '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5', + 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c' + ], + [ + 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b', + '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3' + ], + [ + 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4', + '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d' + ], + [ + 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f', + '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700' + ], + [ + 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889', + '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4' + ], + [ + '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246', + 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196' + ], + [ + '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984', + '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4' + ], + [ + '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a', + 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257' + ], + [ + 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030', + 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13' + ], + [ + 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197', + '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096' + ], + [ + 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593', + 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38' + ], + [ + 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef', + '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f' + ], + [ + '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38', + '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448' + ], + [ + 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a', + '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a' + ], + [ + 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111', + '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4' + ], + [ + '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502', + '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437' + ], + [ + '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea', + 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7' + ], + [ + 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26', + '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d' + ], + [ + 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986', + '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a' + ], + [ + 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e', + '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54' + ], + [ + '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4', + '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77' + ], + [ + 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda', + 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517' + ], + [ + '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859', + 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10' + ], + [ + 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f', + 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125' + ], + [ + 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c', + '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e' + ], + [ + '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942', + 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1' + ], + [ + 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a', + '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2' + ], + [ + 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80', + '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423' + ], + [ + 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d', + '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8' + ], + [ + '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1', + 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758' + ], + [ + '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63', + 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375' + ], + [ + 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352', + '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d' + ], + [ + '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193', + 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec' + ], + [ + '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00', + '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0' + ], + [ + '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58', + 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c' + ], + [ + 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7', + 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4' + ], + [ + '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8', + 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f' + ], + [ + '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e', + '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649' + ], + [ + '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d', + 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826' + ], + [ + '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b', + '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5' + ], + [ + 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f', + 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87' + ], + [ + '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6', + '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b' + ], + [ + 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297', + '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc' + ], + [ + '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a', + '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c' + ], + [ + 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c', + 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f' + ], + [ + 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52', + '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a' + ], + [ + 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb', + 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46' + ], + [ + '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065', + 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f' + ], + [ + '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917', + '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03' + ], + [ + '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9', + 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08' + ], + [ + '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3', + '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8' + ], + [ + '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57', + '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373' + ], + [ + '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66', + 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3' + ], + [ + '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8', + '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8' + ], + [ + '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721', + '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1' + ], + [ + '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180', + '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9' + ] + ] + } + } + ] +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/der.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/der.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/index.js new file mode 100644 index 00000000..a70f571a --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/index.js @@ -0,0 +1,151 @@ +var bn = require('bn.js'); +var elliptic = require('../../elliptic'); +var utils = elliptic.utils; +var assert = utils.assert; + +var KeyPair = require('./key'); +var Signature = require('./signature'); + +function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + + // Shortcut `elliptic.ec(curve-name)` + if (typeof options === 'string') { + assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options); + + options = elliptic.curves[options]; + } + + // Shortcut for `elliptic.ec(elliptic.curves.curveName)` + if (options instanceof elliptic.curves.PresetCurve) + options = { curve: options }; + + this.curve = options.curve.curve; + this.n = this.curve.n; + this.nh = this.n.shrn(1); + this.g = this.curve.g; + + // Point on curve + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + + // Hash for function for DRBG + this.hash = options.hash || options.curve.hash; +} +module.exports = EC; + +EC.prototype.keyPair = function keyPair(priv, pub) { + return new KeyPair(this, priv, pub); +}; + +EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + + // Instantiate Hmac_DRBG + var drbg = new elliptic.hmacDRBG({ + hash: this.hash, + pers: options.pers, + entropy: options.entropy || elliptic.rand(this.hash.hmacStrength), + nonce: this.n.toArray() + }); + + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new bn(2)); + do { + var priv = new bn(drbg.generate(bytes)); + if (priv.cmp(ns2) > 0) + continue; + + priv.iaddn(1); + return this.keyPair(priv); + } while (true); +}; + +EC.prototype._truncateToN = function truncateToN(msg, truncOnly) { + var delta = msg.byteLength() * 8 - this.n.bitLength(); + if (delta > 0) + msg = msg.shrn(delta); + if (!truncOnly && msg.cmp(this.n) >= 0) + return msg.sub(this.n); + else + return msg; +}; + +EC.prototype.sign = function sign(msg, key, options) { + key = this.keyPair(key, 'hex'); + msg = this._truncateToN(new bn(msg, 16)); + if (!options) + options = {}; + + // Zero-extend key to provide enough entropy + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray(); + for (var i = bkey.length; i < 21; i++) + bkey.unshift(0); + + // Zero-extend nonce to have the same byte size as N + var nonce = msg.toArray(); + for (var i = nonce.length; i < bytes; i++) + nonce.unshift(0); + + // Instantiate Hmac_DRBG + var drbg = new elliptic.hmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce: nonce + }); + + // Number of bytes to generate + var ns1 = this.n.sub(new bn(1)); + do { + var k = new bn(drbg.generate(this.n.byteLength())); + k = this._truncateToN(k, true); + if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) + continue; + + var kp = this.g.mul(k); + if (kp.isInfinity()) + continue; + + var r = kp.getX().mod(this.n); + if (r.cmpn(0) === 0) + continue; + + var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)).mod(this.n); + if (s.cmpn(0) === 0) + continue; + + // Use complement of `s`, if it is > `n / 2` + if (options.canonical && s.cmp(this.nh) > 0) + s = this.n.sub(s); + + return new Signature(r, s); + } while (true); +}; + +EC.prototype.verify = function verify(msg, signature, key) { + msg = this._truncateToN(new bn(msg, 16)); + key = this.keyPair(key, 'hex'); + signature = new Signature(signature, 'hex'); + + // Perform primitive values validation + var r = signature.r; + var s = signature.s; + if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) + return false; + if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) + return false; + + // Validate signature + var sinv = s.invm(this.n); + var u1 = sinv.mul(msg).mod(this.n); + var u2 = sinv.mul(r).mod(this.n); + + var p = this.g.mulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + return p.getX().mod(this.n).cmp(r) === 0; +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/key.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/key.js new file mode 100644 index 00000000..396a73a0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/key.js @@ -0,0 +1,144 @@ +var bn = require('bn.js'); + +var elliptic = require('../../elliptic'); +var utils = elliptic.utils; +var assert = utils.assert; + +function KeyPair(ec, priv, pub) { + if (priv instanceof KeyPair) + return priv; + if (pub instanceof KeyPair) + return pub; + + if (!priv) { + priv = pub; + pub = null; + } + if (priv !== null && typeof priv === 'object') { + if (priv.x) { + // KeyPair(public) + pub = priv; + priv = null; + } else if (priv.priv || priv.pub) { + // KeyPair({ priv: ..., pub: ... }) + pub = priv.pub; + priv = priv.priv; + } + } + + this.ec = ec; + this.priv = null; + this.pub = null; + + // KeyPair(public, 'hex') + if (this._importPublicHex(priv, pub)) + return; + + if (pub === 'hex') + pub = null; + + // KeyPair(priv, pub) + if (priv) + this._importPrivate(priv); + if (pub) + this._importPublic(pub); +} +module.exports = KeyPair; + +KeyPair.prototype.validate = function validate() { + var pub = this.getPublic(); + + if (pub.isInfinity()) + return { result: false, reason: 'Invalid public key' }; + if (!pub.validate()) + return { result: false, reason: 'Public key is not a point' }; + if (!pub.mul(this.ec.curve.n).isInfinity()) + return { result: false, reason: 'Public key * N != O' }; + + return { result: true, reason: null }; +}; + +KeyPair.prototype.getPublic = function getPublic(compact, enc) { + if (!this.pub) + this.pub = this.ec.g.mul(this.priv); + + // compact is optional argument + if (typeof compact === 'string') { + enc = compact; + compact = null; + } + + if (!enc) + return this.pub; + + var len = this.ec.curve.p.byteLength(); + var x = this.pub.getX().toArray(); + + for (var i = x.length; i < len; i++) + x.unshift(0); + + if (compact) { + var res = [ this.pub.getY().isEven() ? 0x02 : 0x03 ].concat(x); + } else { + var y = this.pub.getY().toArray(); + for (var i = y.length; i < len; i++) + y.unshift(0); + var res = [ 0x04 ].concat(x, y); + } + return utils.encode(res, enc); +}; + +KeyPair.prototype.getPrivate = function getPrivate(enc) { + if (enc === 'hex') + return this.priv.toString(16, 2); + else + return this.priv; +}; + +KeyPair.prototype._importPrivate = function _importPrivate(key) { + this.priv = new bn(key, 16); + + // Ensure that the priv won't be bigger than n, otherwise we may fail + // in fixed multiplication method + this.priv = this.priv.mod(this.ec.curve.n); +}; + +KeyPair.prototype._importPublic = function _importPublic(key) { + this.pub = this.ec.curve.point(key.x, key.y); +}; + +KeyPair.prototype._importPublicHex = function _importPublic(key, enc) { + key = utils.toArray(key, enc); + var len = this.ec.curve.p.byteLength(); + if (key[0] === 0x04 && key.length - 1 === 2 * len) { + this.pub = this.ec.curve.point( + key.slice(1, 1 + len), + key.slice(1 + len, 1 + 2 * len)); + } else if ((key[0] === 0x02 || key[0] === 0x03) && key.length - 1 === len) { + this.pub = this.ec.curve.pointFromX(key[0] === 0x03, + key.slice(1, 1 +len)); + } else { + return false; + } + + return true; +}; + +// ECDH +KeyPair.prototype.derive = function derive(pub) { + return pub.mul(this.priv).getX(); +}; + +// ECDSA +KeyPair.prototype.sign = function sign(msg) { + return this.ec.sign(msg, this); +}; + +KeyPair.prototype.verify = function verify(msg, signature) { + return this.ec.verify(msg, signature, this); +}; + +KeyPair.prototype.inspect = function inspect() { + return ''; +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/signature.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/signature.js new file mode 100644 index 00000000..a55b802d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/ec/signature.js @@ -0,0 +1,63 @@ +var bn = require('bn.js'); + +var elliptic = require('../../elliptic'); +var utils = elliptic.utils; +var assert = utils.assert; + +function Signature(r, s) { + if (r instanceof Signature) + return r; + + if (this._importDER(r, s)) + return; + + assert(r && s, 'Signature without r or s'); + this.r = new bn(r, 16); + this.s = new bn(s, 16); +} +module.exports = Signature; + +Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + if (data.length < 6 || data[0] !== 0x30 || data[2] !== 0x02) + return false; + var total = data[1]; + if (1 + total > data.length) + return false; + var rlen = data[3]; + // Short length notation + if (rlen >= 0x80) + return false; + if (4 + rlen + 2 >= data.length) + return false; + if (data[4 + rlen] !== 0x02) + return false; + var slen = data[5 + rlen]; + // Short length notation + if (slen >= 0x80) + return false; + if (4 + rlen + 2 + slen > data.length) + return false; + + this.r = new bn(data.slice(4, 4 + rlen)); + this.s = new bn(data.slice(4 + rlen + 2, 4 + rlen + 2 + slen)); + + return true; +}; + +Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + + // Pad values + if (r[0] & 0x80) + r = [ 0 ].concat(r); + // Pad values + if (s[0] & 0x80) + s = [ 0 ].concat(s); + + var total = r.length + s.length + 4; + var res = [ 0x30, total, 0x02, r.length ]; + res = res.concat(r, [ 0x02, s.length ], s); + return utils.encode(res, enc); +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/hmac-drbg.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/hmac-drbg.js new file mode 100644 index 00000000..4b748653 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/hmac-drbg.js @@ -0,0 +1,112 @@ +var hash = require('hash.js'); +var elliptic = require('../elliptic'); +var utils = elliptic.utils; +var assert = utils.assert; + +function HmacDRBG(options) { + if (!(this instanceof HmacDRBG)) + return new HmacDRBG(options); + this.hash = options.hash; + this.predResist = !!options.predResist; + + this.outLen = this.hash.outSize; + this.minEntropy = options.minEntropy || this.hash.hmacStrength; + + this.reseed = null; + this.reseedInterval = null; + this.K = null; + this.V = null; + + var entropy = utils.toArray(options.entropy, options.entropyEnc); + var nonce = utils.toArray(options.nonce, options.nonceEnc); + var pers = utils.toArray(options.pers, options.persEnc); + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + this._init(entropy, nonce, pers); +} +module.exports = HmacDRBG; + +HmacDRBG.prototype._init = function init(entropy, nonce, pers) { + var seed = entropy.concat(nonce).concat(pers); + + this.K = new Array(this.outLen / 8); + this.V = new Array(this.outLen / 8); + for (var i = 0; i < this.V.length; i++) { + this.K[i] = 0x00; + this.V[i] = 0x01; + } + + this._update(seed); + this.reseed = 1; + this.reseedInterval = 0x1000000000000; // 2^48 +}; + +HmacDRBG.prototype._hmac = function hmac() { + return new hash.hmac(this.hash, this.K); +}; + +HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac() + .update(this.V) + .update([ 0x00 ]); + if (seed) + kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) + return; + + this.K = this._hmac() + .update(this.V) + .update([ 0x01 ]) + .update(seed) + .digest(); + this.V = this._hmac().update(this.V).digest(); +}; + +HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + // Optional entropy enc + if (typeof entropyEnc !== 'string') { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + + entropy = utils.toBuffer(entropy, entropyEnc); + add = utils.toBuffer(add, addEnc); + + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + + this._update(entropy.concat(add || [])); + this.reseed = 1; +}; + +HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { + if (this.reseed > this.reseedInterval) + throw new Error('Reseed is required'); + + // Optional encoding + if (typeof enc !== 'string') { + addEnc = add; + add = enc; + enc = null; + } + + // Optional additional data + if (add) { + add = utils.toArray(add, addEnc); + this._update(add); + } + + var temp = []; + while (temp.length < len) { + this.V = this._hmac().update(this.V).digest(); + temp = temp.concat(this.V); + } + + var res = temp.slice(0, len); + this._update(add); + this.reseed++; + return utils.encode(res, enc); +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/utils.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/utils.js new file mode 100644 index 00000000..f8de2d15 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/lib/elliptic/utils.js @@ -0,0 +1,150 @@ +var bn = require('bn.js'); + +var utils = exports; + +utils.assert = function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +}; + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === 'string') { + if (!enc) { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + } + return res; +} +utils.toArray = toArray; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +utils.toHex = toHex; + +utils.encode = function encode(arr, enc) { + if (enc === 'hex') + return toHex(arr); + else + return arr; +}; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +utils.zero2 = zero2; + +// Represent num in a w-NAF form +function getNAF(num, w) { + var naf = []; + var ws = 1 << (w + 1); + var k = num.clone(); + while (k.cmpn(1) >= 0) { + var z; + if (k.isOdd()) { + var mod = k.andln(ws - 1); + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + naf.push(z); + + // Optimization, shift by word if possible + var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1; + for (var i = 1; i < shift; i++) + naf.push(0); + k.ishrn(shift); + } + + return naf; +} +utils.getNAF = getNAF; + +// Represent k1, k2 in a Joint Sparse Form +function getJSF(k1, k2) { + var jsf = [ + [], + [] + ]; + + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + + // First phase + var m14 = (k1.andln(3) + d1) & 3; + var m24 = (k2.andln(3) + d2) & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + var m8 = (k1.andln(7) + d1) & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + var m8 = (k2.andln(7) + d2) & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + + // Second phase + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.ishrn(1); + k2.ishrn(1); + } + + return jsf; +} +utils.getJSF = getJSF; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/.npmignore b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/.npmignore new file mode 100644 index 00000000..1ca95717 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/README.md b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/README.md new file mode 100644 index 00000000..f80437d1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/README.md @@ -0,0 +1,26 @@ +# Brorand + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2014. + +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/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js new file mode 100644 index 00000000..436f040e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/index.js @@ -0,0 +1,57 @@ +var r; + +module.exports = function rand(len) { + if (!r) + r = new Rand(null); + + return r.generate(len); +}; + +function Rand(rand) { + this.rand = rand; +} +module.exports.Rand = Rand; + +Rand.prototype.generate = function generate(len) { + return this._rand(len); +}; + +if (typeof window === 'object') { + if (window.crypto && window.crypto.getRandomValues) { + // Modern browsers + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + window.crypto.getRandomValues(arr); + return arr; + }; + } else if (window.msCrypto && window.msCrypto.getRandomValues) { + // IE + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + window.msCrypto.getRandomValues(arr); + return arr; + }; + } else { + // Old junk + Rand.prototype._rand = function() { + throw new Error('Not implemented yet'); + }; + } +} else { + // Node.js or Web worker + try { + var crypto = require('cry' + 'pto'); + + Rand.prototype._rand = function _rand(n) { + return crypto.randomBytes(n); + }; + } catch (e) { + // Emulate crypto API using randy + Rand.prototype._rand = function _rand(n) { + var res = new Uint8Array(n); + for (var i = 0; i < res.length; i++) + res[i] = this.rand.getByte(); + return res; + }; + } +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/package.json new file mode 100644 index 00000000..99f64349 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/package.json @@ -0,0 +1,54 @@ +{ + "name": "brorand", + "version": "1.0.5", + "description": "Random number generator for browsers and node.js", + "main": "index.js", + "scripts": { + "test": "mocha --reporter=spec test/**/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/brorand" + }, + "keywords": [ + "Random", + "RNG", + "browser", + "crypto" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/brorand/issues" + }, + "homepage": "https://github.com/indutny/brorand", + "devDependencies": { + "mocha": "^2.0.1" + }, + "gitHead": "571027e0ffa1119c720bcdb8aa9c987f63beb5a6", + "_id": "brorand@1.0.5", + "_shasum": "07b54ca30286abd1718a0e2a830803efdc9bfa04", + "_from": "brorand@>=1.0.1 <2.0.0", + "_npmVersion": "2.1.6", + "_nodeVersion": "0.10.33", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "07b54ca30286abd1718a0e2a830803efdc9bfa04", + "tarball": "http://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/test/api-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/test/api-test.js new file mode 100644 index 00000000..b6c876d3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/brorand/test/api-test.js @@ -0,0 +1,8 @@ +var brorand = require('../'); +var assert = require('assert'); + +describe('Brorand', function() { + it('should generate random numbers', function() { + assert.equal(brorand(100).length, 100); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/.npmignore b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/.npmignore new file mode 100644 index 00000000..1ca95717 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/.travis.yml b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/.travis.yml new file mode 100644 index 00000000..92a990f6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.11" +branches: + only: + - master diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/README.md b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/README.md new file mode 100644 index 00000000..63107cbe --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/README.md @@ -0,0 +1,28 @@ +# hash.js [![Build Status](https://secure.travis-ci.org/indutny/hash.js.png)](http://travis-ci.org/indutny/hash.js) + +Just a bike-shed. + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2014. + +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/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js new file mode 100644 index 00000000..f59b6730 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash.js @@ -0,0 +1,15 @@ +var hash = exports; + +hash.utils = require('./hash/utils'); +hash.common = require('./hash/common'); +hash.sha = require('./hash/sha'); +hash.ripemd = require('./hash/ripemd'); +hash.hmac = require('./hash/hmac'); + +// Proxy hash functions to the main object +hash.sha1 = hash.sha.sha1; +hash.sha256 = hash.sha.sha256; +hash.sha224 = hash.sha.sha224; +hash.sha384 = hash.sha.sha384; +hash.sha512 = hash.sha.sha512; +hash.ripemd160 = hash.ripemd.ripemd160; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js new file mode 100644 index 00000000..a052c55f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js @@ -0,0 +1,91 @@ +var hash = require('../hash'); +var utils = hash.utils; +var assert = utils.assert; + +function BlockHash() { + this.pending = null; + this.pendingTotal = 0; + this.blockSize = this.constructor.blockSize; + this.outSize = this.constructor.outSize; + this.hmacStrength = this.constructor.hmacStrength; + this.padLength = this.constructor.padLength / 8; + this.endian = 'big'; + + this._delta8 = this.blockSize / 8; + this._delta32 = this.blockSize / 32; +} +exports.BlockHash = BlockHash; + +BlockHash.prototype.update = function update(msg, enc) { + // Convert message to array, pad it, and join into 32bit blocks + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + + // Enough data, try updating + if (this.pending.length >= this._delta8) { + msg = this.pending; + + // Process pending data in blocks + var r = msg.length % this._delta8; + this.pending = msg.slice(msg.length - r, msg.length); + if (this.pending.length === 0) + this.pending = null; + + msg = utils.join32(msg, 0, msg.length - r, this.endian); + for (var i = 0; i < msg.length; i += this._delta32) + this._update(msg, i, i + this._delta32); + } + + return this; +}; + +BlockHash.prototype.digest = function digest(enc) { + this.update(this._pad()); + assert(this.pending === null); + + return this._digest(enc); +}; + +BlockHash.prototype._pad = function pad() { + var len = this.pendingTotal; + var bytes = this._delta8; + var k = bytes - ((len + this.padLength) % bytes); + var res = new Array(k + this.padLength); + res[0] = 0x80; + for (var i = 1; i < k; i++) + res[i] = 0; + + // Append length + len <<= 3; + if (this.endian === 'big') { + for (var t = 8; t < this.padLength; t++) + res[i++] = 0; + + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = (len >>> 24) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = len & 0xff; + } else { + res[i++] = len & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 24) & 0xff; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + + for (var t = 8; t < this.padLength; t++) + res[i++] = 0; + } + + return res; +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js new file mode 100644 index 00000000..3a3da972 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js @@ -0,0 +1,48 @@ +var hmac = exports; + +var hash = require('../hash'); +var utils = hash.utils; +var assert = utils.assert; + +function Hmac(hash, key, enc) { + if (!(this instanceof Hmac)) + return new Hmac(hash, key, enc); + this.Hash = hash; + this.blockSize = hash.blockSize / 8; + this.outSize = hash.outSize / 8; + this.inner = null; + this.outer = null; + + this._init(utils.toArray(key, enc)); +} +module.exports = Hmac; + +Hmac.prototype._init = function init(key) { + // Shorten key, if needed + if (key.length > this.blockSize) + key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); + + // Add padding to key + for (var i = key.length; i < this.blockSize; i++) + key.push(0); + + for (var i = 0; i < key.length; i++) + key[i] ^= 0x36; + this.inner = new this.Hash().update(key); + + // 0x36 ^ 0x5c = 0x6a + for (var i = 0; i < key.length; i++) + key[i] ^= 0x6a; + this.outer = new this.Hash().update(key); +}; + +Hmac.prototype.update = function update(msg, enc) { + this.inner.update(msg, enc); + return this; +}; + +Hmac.prototype.digest = function digest(enc) { + this.outer.update(this.inner.digest()); + return this.outer.digest(enc); +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js new file mode 100644 index 00000000..8eb28f49 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js @@ -0,0 +1,144 @@ +var hash = require('../hash'); +var utils = hash.utils; + +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_3 = utils.sum32_3; +var sum32_4 = utils.sum32_4; +var BlockHash = hash.common.BlockHash; + +function RIPEMD160() { + if (!(this instanceof RIPEMD160)) + return new RIPEMD160(); + + BlockHash.call(this); + + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; + this.endian = 'little'; +} +utils.inherits(RIPEMD160, BlockHash); +exports.ripemd160 = RIPEMD160; + +RIPEMD160.blockSize = 512; +RIPEMD160.outSize = 160; +RIPEMD160.hmacStrength = 192; +RIPEMD160.padLength = 64; + +RIPEMD160.prototype._update = function update(msg, start) { + var A = this.h[0]; + var B = this.h[1]; + var C = this.h[2]; + var D = this.h[3]; + var E = this.h[4]; + var Ah = A; + var Bh = B; + var Ch = C; + var Dh = D; + var Eh = E; + for (var j = 0; j < 80; j++) { + var T = sum32( + rotl32( + sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), + s[j]), + E); + A = E; + E = D; + D = rotl32(C, 10); + C = B; + B = T; + T = sum32( + rotl32( + sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), + sh[j]), + Eh); + Ah = Eh; + Eh = Dh; + Dh = rotl32(Ch, 10); + Ch = Bh; + Bh = T; + } + T = sum32_3(this.h[1], C, Dh); + this.h[1] = sum32_3(this.h[2], D, Eh); + this.h[2] = sum32_3(this.h[3], E, Ah); + this.h[3] = sum32_3(this.h[4], A, Bh); + this.h[4] = sum32_3(this.h[0], B, Ch); + this.h[0] = T; +}; + +RIPEMD160.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'little'); + else + return utils.split32(this.h, 'little'); +}; + +function f(j, x, y, z) { + if (j <= 15) + return x ^ y ^ z; + else if (j <= 31) + return (x & y) | ((~x) & z); + else if (j <= 47) + return (x | (~y)) ^ z; + else if (j <= 63) + return (x & z) | (y & (~z)); + else + return x ^ (y | (~z)); +} + +function K(j) { + if (j <= 15) + return 0x00000000; + else if (j <= 31) + return 0x5a827999; + else if (j <= 47) + return 0x6ed9eba1; + else if (j <= 63) + return 0x8f1bbcdc; + else + return 0xa953fd4e; +} + +function Kh(j) { + if (j <= 15) + return 0x50a28be6; + else if (j <= 31) + return 0x5c4dd124; + else if (j <= 47) + return 0x6d703ef3; + else if (j <= 63) + return 0x7a6d76e9; + else + return 0x00000000; +} + +var r = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, +]; + +var rh = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +]; + +var s = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6, +]; + +var sh = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +]; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js new file mode 100644 index 00000000..a7837aad --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js @@ -0,0 +1,564 @@ +var hash = require('../hash'); +var utils = hash.utils; +var assert = utils.assert; + +var rotr32 = utils.rotr32; +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_4 = utils.sum32_4; +var sum32_5 = utils.sum32_5; +var rotr64_hi = utils.rotr64_hi; +var rotr64_lo = utils.rotr64_lo; +var shr64_hi = utils.shr64_hi; +var shr64_lo = utils.shr64_lo; +var sum64 = utils.sum64; +var sum64_hi = utils.sum64_hi; +var sum64_lo = utils.sum64_lo; +var sum64_4_hi = utils.sum64_4_hi; +var sum64_4_lo = utils.sum64_4_lo; +var sum64_5_hi = utils.sum64_5_hi; +var sum64_5_lo = utils.sum64_5_lo; +var BlockHash = hash.common.BlockHash; + +var sha256_K = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]; + +var sha512_K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; + +var sha1_K = [ + 0x5A827999, 0x6ED9EBA1, + 0x8F1BBCDC, 0xCA62C1D6 +]; + +function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + + BlockHash.call(this); + this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ]; + this.k = sha256_K; + this.W = new Array(64); +} +utils.inherits(SHA256, BlockHash); +exports.sha256 = SHA256; + +SHA256.blockSize = 512; +SHA256.outSize = 256; +SHA256.hmacStrength = 192; +SHA256.padLength = 64; + +SHA256.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + for (; i < W.length; i++) + W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + var f = this.h[5]; + var g = this.h[6]; + var h = this.h[7]; + + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i++) { + var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); + var T2 = sum32(s0_256(a), maj32(a, b, c)); + h = g; + g = f; + f = e; + e = sum32(d, T1); + d = c; + c = b; + b = a; + a = sum32(T1, T2); + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); + this.h[5] = sum32(this.h[5], f); + this.h[6] = sum32(this.h[6], g); + this.h[7] = sum32(this.h[7], h); +}; + +SHA256.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); + + SHA256.call(this); + this.h = [ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; +} +utils.inherits(SHA224, SHA256); +exports.sha224 = SHA224; + +SHA224.blockSize = 512; +SHA224.outSize = 224; +SHA224.hmacStrength = 192; +SHA224.padLength = 64; + +SHA224.prototype._digest = function digest(enc) { + // Just truncate output + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 7), 'big'); + else + return utils.split32(this.h.slice(0, 7), 'big'); +}; + +function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + + BlockHash.call(this); + this.h = [ 0x6a09e667, 0xf3bcc908, + 0xbb67ae85, 0x84caa73b, + 0x3c6ef372, 0xfe94f82b, + 0xa54ff53a, 0x5f1d36f1, + 0x510e527f, 0xade682d1, + 0x9b05688c, 0x2b3e6c1f, + 0x1f83d9ab, 0xfb41bd6b, + 0x5be0cd19, 0x137e2179 ]; + this.k = sha512_K; + this.W = new Array(160); +} +utils.inherits(SHA512, BlockHash); +exports.sha512 = SHA512; + +SHA512.blockSize = 1024; +SHA512.outSize = 512; +SHA512.hmacStrength = 192; +SHA512.padLength = 128; + +SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { + var W = this.W; + + // 32 x 32bit words + for (var i = 0; i < 32; i++) + W[i] = msg[start + i]; + for (; i < W.length; i += 2) { + var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; // i - 7 + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; // i - 16 + var c3_lo = W[i - 31]; + + W[i] = sum64_4_hi(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + W[i + 1] = sum64_4_lo(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + } +}; + +SHA512.prototype._update = function _update(msg, start) { + this._prepareBlock(msg, start); + + var W = this.W; + + var ah = this.h[0]; + var al = this.h[1]; + var bh = this.h[2]; + var bl = this.h[3]; + var ch = this.h[4]; + var cl = this.h[5]; + var dh = this.h[6]; + var dl = this.h[7]; + var eh = this.h[8]; + var el = this.h[9]; + var fh = this.h[10]; + var fl = this.h[11]; + var gh = this.h[12]; + var gl = this.h[13]; + var hh = this.h[14]; + var hl = this.h[15]; + + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i += 2) { + var c0_hi = hh; + var c0_lo = hl; + var c1_hi = s1_512_hi(eh, el); + var c1_lo = s1_512_lo(eh, el); + var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); + var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); + var c3_hi = this.k[i]; + var c3_lo = this.k[i + 1]; + var c4_hi = W[i]; + var c4_lo = W[i + 1]; + + var T1_hi = sum64_5_hi(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + var T1_lo = sum64_5_lo(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + + var c0_hi = s0_512_hi(ah, al); + var c0_lo = s0_512_lo(ah, al); + var c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); + var c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); + + var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); + var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); + + hh = gh; + hl = gl; + + gh = fh; + gl = fl; + + fh = eh; + fl = el; + + eh = sum64_hi(dh, dl, T1_hi, T1_lo); + el = sum64_lo(dl, dl, T1_hi, T1_lo); + + dh = ch; + dl = cl; + + ch = bh; + cl = bl; + + bh = ah; + bl = al; + + ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); + al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); + } + + sum64(this.h, 0, ah, al); + sum64(this.h, 2, bh, bl); + sum64(this.h, 4, ch, cl); + sum64(this.h, 6, dh, dl); + sum64(this.h, 8, eh, el); + sum64(this.h, 10, fh, fl); + sum64(this.h, 12, gh, gl); + sum64(this.h, 14, hh, hl); +}; + +SHA512.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); + + SHA512.call(this); + this.h = [ 0xcbbb9d5d, 0xc1059ed8, + 0x629a292a, 0x367cd507, + 0x9159015a, 0x3070dd17, + 0x152fecd8, 0xf70e5939, + 0x67332667, 0xffc00b31, + 0x8eb44a87, 0x68581511, + 0xdb0c2e0d, 0x64f98fa7, + 0x47b5481d, 0xbefa4fa4 ]; +} +utils.inherits(SHA384, SHA512); +exports.sha384 = SHA384; + +SHA384.blockSize = 1024; +SHA384.outSize = 384; +SHA384.hmacStrength = 192; +SHA384.padLength = 128; + +SHA384.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 12), 'big'); + else + return utils.split32(this.h.slice(0, 12), 'big'); +}; + +function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + + BlockHash.call(this); + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, + 0x10325476, 0xc3d2e1f0 ]; + this.W = new Array(80); +} + +utils.inherits(SHA1, BlockHash); +exports.sha1 = SHA1; + +SHA1.blockSize = 512; +SHA1.outSize = 160; +SHA1.hmacStrength = 80; +SHA1.padLength = 64; + +SHA1.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + + for(; i < W.length; i++) + W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + + for (var i = 0; i < W.length; i++) { + var s = ~~(i / 20); + var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); + e = d; + d = c; + c = rotl32(b, 30); + b = a; + a = t; + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); +}; + +SHA1.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function ch32(x, y, z) { + return (x & y) ^ ((~x) & z); +} + +function maj32(x, y, z) { + return (x & y) ^ (x & z) ^ (y & z); +} + +function p32(x, y, z) { + return x ^ y ^ z; +} + +function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); +} + +function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); +} + +function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); +} + +function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); +} + +function ft_1(s, x, y, z) { + if (s === 0) + return ch32(x, y, z); + if (s === 1 || s === 3) + return p32(x, y, z); + if (s === 2) + return maj32(x, y, z); +} + +function ch64_hi(xh, xl, yh, yl, zh, zl) { + var r = (xh & yh) ^ ((~xh) & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ ((~xl) & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_hi(xh, xl, yh, yl, zh, zl) { + var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); // 34 + var c2_hi = rotr64_hi(xl, xh, 7); // 39 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); // 34 + var c2_lo = rotr64_lo(xl, xh, 7); // 39 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 14); + var c1_hi = rotr64_hi(xh, xl, 18); + var c2_hi = rotr64_hi(xl, xh, 9); // 41 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 14); + var c1_lo = rotr64_lo(xh, xl, 18); + var c2_lo = rotr64_lo(xl, xh, 9); // 41 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 1); + var c1_hi = rotr64_hi(xh, xl, 8); + var c2_hi = shr64_hi(xh, xl, 7); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 1); + var c1_lo = rotr64_lo(xh, xl, 8); + var c2_lo = shr64_lo(xh, xl, 7); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); // 61 + var c2_hi = shr64_hi(xh, xl, 6); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); // 61 + var c2_lo = shr64_lo(xh, xl, 6); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js new file mode 100644 index 00000000..00ed5fb4 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js @@ -0,0 +1,257 @@ +var utils = exports; +var inherits = require('inherits'); + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === 'string') { + if (!enc) { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + } + return res; +} +utils.toArray = toArray; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +utils.toHex = toHex; + +function htonl(w) { + var res = (w >>> 24) | + ((w >>> 8) & 0xff00) | + ((w << 8) & 0xff0000) | + ((w & 0xff) << 24); + return res >>> 0; +} +utils.htonl = htonl; + +function toHex32(msg, endian) { + var res = ''; + for (var i = 0; i < msg.length; i++) { + var w = msg[i]; + if (endian === 'little') + w = htonl(w); + res += zero8(w.toString(16)); + } + return res; +} +utils.toHex32 = toHex32; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +utils.zero2 = zero2; + +function zero8(word) { + if (word.length === 7) + return '0' + word; + else if (word.length === 6) + return '00' + word; + else if (word.length === 5) + return '000' + word; + else if (word.length === 4) + return '0000' + word; + else if (word.length === 3) + return '00000' + word; + else if (word.length === 2) + return '000000' + word; + else if (word.length === 1) + return '0000000' + word; + else + return word; +} +utils.zero8 = zero8; + +function join32(msg, start, end, endian) { + var len = end - start; + assert(len % 4 === 0); + var res = new Array(len / 4); + for (var i = 0, k = start; i < res.length; i++, k += 4) { + var w; + if (endian === 'big') + w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; + else + w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; + res[i] = w >>> 0; + } + return res; +} +utils.join32 = join32; + +function split32(msg, endian) { + var res = new Array(msg.length * 4); + for (var i = 0, k = 0; i < msg.length; i++, k += 4) { + var m = msg[i]; + if (endian === 'big') { + res[k] = m >>> 24; + res[k + 1] = (m >>> 16) & 0xff; + res[k + 2] = (m >>> 8) & 0xff; + res[k + 3] = m & 0xff; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = (m >>> 16) & 0xff; + res[k + 1] = (m >>> 8) & 0xff; + res[k] = m & 0xff; + } + } + return res; +} +utils.split32 = split32; + +function rotr32(w, b) { + return (w >>> b) | (w << (32 - b)); +} +utils.rotr32 = rotr32; + +function rotl32(w, b) { + return (w << b) | (w >>> (32 - b)); +} +utils.rotl32 = rotl32; + +function sum32(a, b) { + return (a + b) >>> 0; +} +utils.sum32 = sum32; + +function sum32_3(a, b, c) { + return (a + b + c) >>> 0; +} +utils.sum32_3 = sum32_3; + +function sum32_4(a, b, c, d) { + return (a + b + c + d) >>> 0; +} +utils.sum32_4 = sum32_4; + +function sum32_5(a, b, c, d, e) { + return (a + b + c + d + e) >>> 0; +} +utils.sum32_5 = sum32_5; + +function assert(cond, msg) { + if (!cond) + throw new Error(msg || 'Assertion failed'); +} +utils.assert = assert; + +utils.inherits = inherits; + +function sum64(buf, pos, ah, al) { + var bh = buf[pos]; + var bl = buf[pos + 1]; + + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + buf[pos] = hi >>> 0; + buf[pos + 1] = lo; +} +exports.sum64 = sum64; + +function sum64_hi(ah, al, bh, bl) { + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + return hi >>> 0; +}; +exports.sum64_hi = sum64_hi; + +function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; +}; +exports.sum64_lo = sum64_lo; + +function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + + var hi = ah + bh + ch + dh + carry; + return hi >>> 0; +}; +exports.sum64_4_hi = sum64_4_hi; + +function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { + var lo = al + bl + cl + dl; + return lo >>> 0; +}; +exports.sum64_4_lo = sum64_4_lo; + +function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + lo = (lo + el) >>> 0; + carry += lo < el ? 1 : 0; + + var hi = ah + bh + ch + dh + eh + carry; + return hi >>> 0; +}; +exports.sum64_5_hi = sum64_5_hi; + +function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var lo = al + bl + cl + dl + el; + + return lo >>> 0; +}; +exports.sum64_5_lo = sum64_5_lo; + +function rotr64_hi(ah, al, num) { + var r = (al << (32 - num)) | (ah >>> num); + return r >>> 0; +}; +exports.rotr64_hi = rotr64_hi; + +function rotr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +}; +exports.rotr64_lo = rotr64_lo; + +function shr64_hi(ah, al, num) { + return ah >>> num; +}; +exports.shr64_hi = shr64_hi; + +function shr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +}; +exports.shr64_lo = shr64_lo; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/package.json new file mode 100644 index 00000000..6e50268d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/package.json @@ -0,0 +1,56 @@ +{ + "name": "hash.js", + "version": "1.0.2", + "description": "Various hash functions that could be run by both browser and node", + "main": "lib/hash.js", + "scripts": { + "test": "mocha --reporter=spec test/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/hash.js" + }, + "keywords": [ + "hash", + "sha256", + "sha224", + "hmac" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/hash.js/issues" + }, + "homepage": "https://github.com/indutny/hash.js", + "dependencies": { + "inherits": "^2.0.1" + }, + "devDependencies": { + "mocha": "^1.18.2" + }, + "gitHead": "9a85e099dbf05531e1c3956c7f205405f6bfc13c", + "_id": "hash.js@1.0.2", + "_shasum": "bc7d601f4e0d05a32f3526d11fe39f7a5eb8c187", + "_from": "hash.js@>=1.0.0 <2.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "bc7d601f4e0d05a32f3526d11fe39f7a5eb8c187", + "tarball": "http://registry.npmjs.org/hash.js/-/hash.js-1.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/test/hash-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/test/hash-test.js new file mode 100644 index 00000000..97347a27 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/test/hash-test.js @@ -0,0 +1,119 @@ +var assert = require('assert'); +var hash = require('../'); + +describe('Hash', function() { + function test(fn, cases) { + for (var i = 0; i < cases.length; i++) { + var msg = cases[i][0]; + var res = cases[i][1]; + var enc = cases[i][2]; + + var dgst = fn().update(msg, enc).digest('hex'); + assert.equal(dgst, res); + + // Split message + var dgst = fn().update(msg.slice(0, 2), enc) + .update(msg.slice(2), enc) + .digest('hex'); + assert.equal(dgst, res); + } + } + + it('should support sha256', function() { + assert.equal(hash.sha256.blockSize, 512); + assert.equal(hash.sha256.outSize, 256); + + test(hash.sha256, [ + [ 'abc', + 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' ], + [ 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', + '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1' ], + [ 'deadbeef', + '5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953', + 'hex' ], + ]); + }); + + it('should support sha224', function() { + assert.equal(hash.sha224.blockSize, 512); + assert.equal(hash.sha224.outSize, 224); + + test(hash.sha224, [ + [ 'abc', + '23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7' ], + [ 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', + '75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525' ], + [ 'deadbeef', + '55b9eee5f60cc362ddc07676f620372611e22272f60fdbec94f243f8', + 'hex' ], + ]); + }); + + it('should support ripemd160', function() { + assert.equal(hash.ripemd160.blockSize, 512); + assert.equal(hash.ripemd160.outSize, 160); + + test(hash.ripemd160, [ + [ '', '9c1185a5c5e9fc54612808977ee8f548b2258d31'], + [ 'abc', + '8eb208f7e05d987a9b044a8e98c6b087f15a0bfc' ], + [ 'message digest', + '5d0689ef49d2fae572b881b123a85ffa21595f36' ], + [ 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', + '12a053384a9c0c88e405a06c27dcf49ada62eb2b' ], + [ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', + 'b0e20b6e3116640286ed3a87a5713079b21f5189' ], + ]); + }); + + it('should support sha1', function() { + assert.equal(hash.sha1.blockSize, 512); + assert.equal(hash.sha1.outSize, 160); + + test(hash.sha1, [ + [ '', + 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ], + [ 'abc', + 'a9993e364706816aba3e25717850c26c9cd0d89d' ], + [ 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', + '84983e441c3bd26ebaae4aa1f95129e5e54670f1' ], + [ 'deadbeef', + 'd78f8bb992a56a597f6c7a1fb918bb78271367eb', + 'hex' ], + ]); + }); + + it('should support sha512', function() { + assert.equal(hash.sha512.blockSize, 1024); + assert.equal(hash.sha512.outSize, 512); + + test(hash.sha512, [ + [ 'abc', + 'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a' + + '2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f' + ], + [ 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn' + + 'hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', + '8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018' + + '501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909' + ] + ]); + }); + + it('should support sha384', function() { + assert.equal(hash.sha384.blockSize, 1024); + assert.equal(hash.sha384.outSize, 384); + + test(hash.sha384, [ + [ 'abc', + 'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed' + + '8086072ba1e7cc2358baeca134c825a7' + ], + [ 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn' + + 'hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', + '09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712' + + 'fcc7c71a557e2db966c3e9fa91746039' + ] + ]); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/test/hmac-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/test/hmac-test.js new file mode 100644 index 00000000..0a9647ee --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/node_modules/hash.js/test/hmac-test.js @@ -0,0 +1,59 @@ +var assert = require('assert'); +var hash = require('../'); +var utils = hash.utils; + +describe('Hmac', function() { + describe('mixed test vector', function() { + test({ + name: 'nist 1', + key: '00010203 04050607 08090A0B 0C0D0E0F' + + '10111213 14151617 18191A1B 1C1D1E1F 20212223 24252627' + + '28292A2B 2C2D2E2F 30313233 34353637 38393A3B 3C3D3E3F', + msg: 'Sample message for keylen=blocklen', + res: '8bb9a1db9806f20df7f77b82138c7914d174d59e13dc4d0169c9057b133e1d62' + }); + test({ + name: 'nist 2', + key: '00010203 04050607' + + '08090A0B 0C0D0E0F 10111213 14151617 18191A1B 1C1D1E1F', + msg: 'Sample message for keylen=1.0.0 <2.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "d180376b66a17d74995c837796362ac4d22aefe3", + "tarball": "http://registry.npmjs.org/elliptic/-/elliptic-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/api-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/api-test.js new file mode 100644 index 00000000..855b32ea --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/api-test.js @@ -0,0 +1,17 @@ +var assert = require('assert'); +var elliptic = require('../'); + +describe('EC API', function() { + it('should instantiate with valid curve (secp256k1)', function() { + var ec = new elliptic.ec('secp256k1'); + + assert(ec); + assert(typeof(ec) == "object"); + }); + + it('should throw error with invalid curve', function() { + assert.throws(function(){ + var ec = new elliptic.ec('nonexistent-curve'); + }, Error); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/curve-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/curve-test.js new file mode 100644 index 00000000..401494be --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/curve-test.js @@ -0,0 +1,145 @@ +var assert = require('assert'); +var bn = require('bn.js'); +var elliptic = require('../'); + +describe('Curve', function() { + it('should work with example curve', function() { + var curve = new elliptic.curve.short({ + p: '1d', + a: '4', + b: '14' + }); + + var p = curve.point('18', '16'); + assert(p.validate()); + assert(p.dbl().validate()); + assert(p.dbl().add(p).validate()); + assert(p.dbl().add(p.dbl()).validate()); + assert(p.dbl().add(p.dbl()).eq(p.add(p).add(p).add(p))); + }); + + it('should work with secp112k1', function() { + var curve = new elliptic.curve.short({ + p: 'db7c 2abf62e3 5e668076 bead208b', + a: 'db7c 2abf62e3 5e668076 bead2088', + b: '659e f8ba0439 16eede89 11702b22' + }); + + var p = curve.point( + '0948 7239995a 5ee76b55 f9c2f098', + 'a89c e5af8724 c0a23e0e 0ff77500'); + assert(p.validate()); + assert(p.dbl().validate()); + }); + + it('should work with secp256k1', function() { + var curve = new elliptic.curve.short({ + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ' + + 'fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe ' + + 'baaedce6 af48a03b bfd25e8c d0364141', + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8' + ] + }); + + var p = curve.point( + '79be667e f9dcbbac 55a06295 ce870b07 029bfcdb 2dce28d9 59f2815b 16f81798', + '483ada77 26a3c465 5da4fbfc 0e1108a8 fd17b448 a6855419 9c47d08f fb10d4b8' + ); + assert(p.validate()); + assert(p.dbl().validate()); + assert(p.toJ().dbl().toP().validate()); + assert(p.mul(new bn('79be667e f9dcbbac 55a06295 ce870b07', 16)).validate()); + + var j = p.toJ(); + assert(j.trpl().eq(j.dbl().add(j))); + + // Endomorphism test + assert(curve.endo); + assert.equal( + curve.endo.beta.fromRed().toString(16), + '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'); + assert.equal( + curve.endo.lambda.toString(16), + '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72'); + + var k = new bn('1234567890123456789012345678901234', 16); + var split = curve._endoSplit(k); + assert.equal( + split.k1.add(split.k2.mul(curve.endo.lambda)).mod(curve.n).toString(16), + k.toString(16)); + }); + + it('should compute this problematic secp256k1 multiplication', function() { + var curve = elliptic.curves.secp256k1.curve; + var g1 = curve.g; // precomputed g + assert(g1.precomputed); + var g2 = curve.point(g1.getX(), g1.getY()); // not precomputed g + assert(!g2.precomputed); + var a = new bn('6d1229a6b24c2e775c062870ad26bc261051e0198c67203167273c7c62538846', 16); + var p1 = g1.mul(a); + var p2 = g2.mul(a); + assert(p1.eq(p2)); + }); + + it('should not fail on secp256k1 regression', function() { + var curve = elliptic.curves.secp256k1.curve; + var k1 = new bn('32efeba414cd0c830aed727749e816a01c471831536fd2fce28c56b54f5a3bb1', 16); + var k2 = new bn('5f2e49b5d64e53f9811545434706cde4de528af97bfd49fde1f6cf792ee37a8c', 16); + + var p1 = curve.g.mul(k1); + var p2 = curve.g.mul(k2); + + // 2 + 2 + 1 = 2 + 1 + 2 + var two = p2.dbl(); + var five = two.dbl().add(p2); + var three = two.add(p2); + var maybeFive = three.add(two); + + assert(maybeFive.eq(five)); + + p1 = p1.mul(k2); + p2 = p2.mul(k1); + + assert(p1.validate()); + assert(p2.validate()); + assert(p1.eq(p2)); + }); + + it('should correctly double the affine point on secp256k1', function() { + var bad = { + x: '026a2073b1ef6fab47ace18e60e728a05180a82755bbcec9a0abc08ad9f7a3d4', + y: '9cd8cb48c3281596139f147c1364a3ede88d3f310fdb0eb98c924e599ca1b3c9', + z: 'd78587ad45e4102f48b54b5d85598296e069ce6085002e169c6bad78ddc6d9bd' + }; + + var good = { + x: 'e7789226739ac2eb3c7ccb2a9a910066beeed86cdb4e0f8a7fee8eeb29dc7016', + y: '4b76b191fd6d47d07828ea965e275b76d0e3e0196cd5056d38384fbb819f9fcb', + z: 'cbf8d99056618ba132d6145b904eee1ce566e0feedb9595139c45f84e90cfa7d' + }; + + var curve = elliptic.curves.secp256k1.curve; + bad = curve.jpoint(bad.x, bad.y, bad.z); + good = curve.jpoint(good.x, good.y, good.z); + + // They are the same points + assert(bad.add(good.neg()).isInfinity()); + + // But doubling borks them out + assert(bad.dbl().add(good.dbl().neg()).isInfinity()); + }); + + it('should store precomputed values correctly on negation', function() { + var curve = elliptic.curves.secp256k1.curve; + var p = curve.g.mul('2'); + p.precompute(); + var neg = p.neg(true); + var neg2 = neg.neg(true); + assert(p.eq(neg2)); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/ecdh-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/ecdh-test.js new file mode 100644 index 00000000..13d1a9ad --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/ecdh-test.js @@ -0,0 +1,21 @@ +var assert = require('assert'); +var elliptic = require('../'); +var hash = require('hash.js'); + +describe('ECDH', function() { + function test(name) { + it('should work with ' + name + ' curve', function() { + var ecdh = new elliptic.ec(name); + var s1 = ecdh.genKeyPair(); + var s2 = ecdh.genKeyPair(); + var sh1 = s1.derive(s2.getPublic()); + var sh2 = s2.derive(s1.getPublic()); + + assert.equal(sh1.toString(16), sh2.toString(16)); + }); + } + + test('curve25519'); + test('ed25519'); + test('secp256k1'); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/ecdsa-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/ecdsa-test.js new file mode 100644 index 00000000..71c36cd0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/ecdsa-test.js @@ -0,0 +1,210 @@ +var assert = require('assert'); +var elliptic = require('../'); +var hash = require('hash.js'); + +describe('ECDSA', function() { + function test(name) { + it('should work with ' + name + ' curve', function() { + var curve = elliptic.curves[name]; + assert(curve); + + var ecdsa = new elliptic.ec(curve); + var keys = ecdsa.genKeyPair({ + entropy: [ + 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 + ] + }); + var msg = 'deadbeef'; + + // Get keys out of pair + assert(keys.getPublic().x && keys.getPublic().y); + assert(keys.getPrivate().length > 0); + assert.equal(keys.getPrivate('hex').length, 64); + assert(keys.getPublic('hex').length > 0); + assert(keys.getPrivate('hex').length > 0); + assert(keys.validate().result); + + // Sign and verify + var signature = ecdsa.sign(msg, keys); + assert(ecdsa.verify(msg, signature, keys), 'Normal verify'); + + // Sign and verify on key + var signature = keys.sign(msg); + assert(keys.verify(msg, signature), 'On-key verify'); + + // Load private key from hex + var keys = ecdsa.keyPair(keys.getPrivate('hex'), 'hex'); + var signature = ecdsa.sign(msg, keys); + assert(ecdsa.verify(msg, signature, keys), 'hex-private verify'); + + // Load public key from compact hex + var keys = ecdsa.keyPair(keys.getPublic(true, 'hex'), 'hex'); + + // Load public key from hex + var keys = ecdsa.keyPair(keys.getPublic('hex'), 'hex'); + + // DER encoding + var dsign = signature.toDER('hex'); + assert(ecdsa.verify(msg, dsign, keys), 'hex-DER encoded verify'); + var dsign = signature.toDER(); + assert(ecdsa.verify(msg, dsign, keys), 'DER encoded verify'); + + // Wrong public key + var keys = ecdsa.genKeyPair(); + assert(!ecdsa.verify(msg, signature, keys), 'Wrong key verify'); + + // Invalid private key + var keys = ecdsa.keyPair(keys.getPrivate('hex') + keys.getPrivate('hex'), + 'hex'); + assert(!ecdsa.verify(msg, signature, keys), 'Wrong key verify'); + }); + } + test('secp256k1'); + test('ed25519'); + + describe('RFC6979 vector', function() { + function test(opt) { + opt.cases.forEach(function(c) { + var ecdsa = elliptic.ec({ + curve: opt.curve, + hash: c.hash + }); + var descr = 'should not fail on "' + opt.name + '" ' + + 'and hash ' + c.hash.name + ' on "' + c.message + '"'; + it(descr, function() { + var dgst = c.hash().update(c.message).digest(); + var sign = ecdsa.sign(dgst, opt.key); + assert.equal(sign.r.toString(16), c.r); + assert.equal(sign.s.toString(16), c.s); + assert.ok(ecdsa.keyPair(opt.pub).validate().result, + 'Invalid public key'); + assert.ok(ecdsa.verify(dgst, sign, opt.pub), + 'Invalid signature'); + }); + }); + } + + test({ + name: 'ECDSA, 192 Bits (Prime Field)', + curve: elliptic.curves.p192, + key: '6fab034934e4c0fc9ae67f5b5659a9d7d1fefd187ee09fd4', + pub: { + x: 'ac2c77f529f91689fea0ea5efec7f210d8eea0b9e047ed56', + y: '3bc723e57670bd4887ebc732c523063d0a7c957bc97c1c43' + }, + cases: [ + { + message: 'sample', + hash: hash.sha224, + r: 'a1f00dad97aeec91c95585f36200c65f3c01812aa60378f5', + s: 'e07ec1304c7c6c9debbe980b9692668f81d4de7922a0f97a' + }, + { + message: 'sample', + hash: hash.sha256, + r: '4b0b8ce98a92866a2820e20aa6b75b56382e0f9bfd5ecb55', + s: 'ccdb006926ea9565cbadc840829d8c384e06de1f1e381b85' + }, + { + message: 'test', + hash: hash.sha224, + r: '6945a1c1d1b2206b8145548f633bb61cef04891baf26ed34', + s: 'b7fb7fdfc339c0b9bd61a9f5a8eaf9be58fc5cba2cb15293' + }, + { + message: 'test', + hash: hash.sha256, + r: '3a718bd8b4926c3b52ee6bbe67ef79b18cb6eb62b1ad97ae', + s: '5662e6848a4a19b1f1ae2f72acd4b8bbe50f1eac65d9124f' + } + ], + }); + + test({ + name: 'ECDSA, 224 Bits (Prime Field)', + curve: elliptic.curves.p224, + key: 'f220266e1105bfe3083e03ec7a3a654651f45e37167e88600bf257c1', + pub: { + x: '00cf08da5ad719e42707fa431292dea11244d64fc51610d94b130d6c', + y: 'eeab6f3debe455e3dbf85416f7030cbd94f34f2d6f232c69f3c1385a' + }, + cases: [ + { + message: 'sample', + hash: hash.sha224, + r: '1cdfe6662dde1e4a1ec4cdedf6a1f5a2fb7fbd9145c12113e6abfd3e', + s: 'a6694fd7718a21053f225d3f46197ca699d45006c06f871808f43ebc' + }, + { + message: 'sample', + hash: hash.sha256, + r: '61aa3da010e8e8406c656bc477a7a7189895e7e840cdfe8ff42307ba', + s: 'bc814050dab5d23770879494f9e0a680dc1af7161991bde692b10101' + }, + { + message: 'test', + hash: hash.sha224, + r: 'c441ce8e261ded634e4cf84910e4c5d1d22c5cf3b732bb204dbef019', + s: '902f42847a63bdc5f6046ada114953120f99442d76510150f372a3f4' + }, + { + message: 'test', + hash: hash.sha256, + r: 'ad04dde87b84747a243a631ea47a1ba6d1faa059149ad2440de6fba6', + s: '178d49b1ae90e3d8b629be3db5683915f4e8c99fdf6e666cf37adcfd' + } + ], + }); + + test({ + name: 'ECDSA, 256 Bits (Prime Field)', + curve: elliptic.curves.p256, + key: 'c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721', + pub: { + x: '60fed4ba255a9d31c961eb74c6356d68c049b8923b61fa6ce669622e60f29fb6', + y: '7903fe1008b8bc99a41ae9e95628bc64f2f1b20c2d7e9f5177a3c294d4462299' + }, + cases: [ + { + message: 'sample', + hash: hash.sha224, + r: '53b2fff5d1752b2c689df257c04c40a587fababb3f6fc2702f1343af7ca9aa3f', + s: 'b9afb64fdc03dc1a131c7d2386d11e349f070aa432a4acc918bea988bf75c74c' + }, + { + message: 'sample', + hash: hash.sha256, + r: 'efd48b2aacb6a8fd1140dd9cd45e81d69d2c877b56aaf991c34d0ea84eaf3716', + s: 'f7cb1c942d657c41d436c7a1b6e29f65f3e900dbb9aff4064dc4ab2f843acda8' + }, + { + message: 'test', + hash: hash.sha224, + r: 'c37edb6f0ae79d47c3c27e962fa269bb4f441770357e114ee511f662ec34a692', + s: 'c820053a05791e521fcaad6042d40aea1d6b1a540138558f47d0719800e18f2d' + }, + { + message: 'test', + hash: hash.sha256, + r: 'f1abb023518351cd71d881567b1ea663ed3efcf6c5132b354f28d3b0b7d38367', + s: '19f4113742a2b14bd25926b49c649155f267e60d3814b4c0cc84250e46f0083' + } + ], + }); + }); + + it('should deterministically generate private key', function() { + var curve = elliptic.curves.secp256k1; + assert(curve); + + var ecdsa = new elliptic.ec(curve); + var keys = ecdsa.genKeyPair({ + pers: 'my.pers.string', + entropy: hash.sha256().update('hello world').digest() + }); + assert.equal( + keys.getPrivate('hex'), + '6160edb2b218b7f1394b9ca8eb65a72831032a1f2f3dc2d99291c2f7950ed887'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/hmac-drbg-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/hmac-drbg-test.js new file mode 100644 index 00000000..23f56992 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/elliptic/test/hmac-drbg-test.js @@ -0,0 +1,344 @@ +var assert = require('assert'); +var elliptic = require('../'); +var utils = elliptic.utils; +var hash = require('hash.js'); + +describe('Hmac_DRBG', function() { + it('should support hmac-drbg-sha256', function() { + function doDrbg(opt) { + var drbg = elliptic.hmacDRBG({ + hash: hash.sha256, + entropy: opt.entropy, + nonce: opt.nonce, + pers: opt.pers + }); + return drbg.generate(opt.size, 'hex'); + } + + var test = [ + { + entropy: 'totally random0123456789', + nonce: 'secret nonce', + pers: 'my drbg', + size: 32, + res: '018ec5f8e08c41e5ac974eb129ac297c5388ee1864324fa13d9b15cf98d9a157' + }, + { + entropy: 'totally random0123456789', + nonce: 'secret nonce', + pers: null, + size: 32, + res: 'ed5d61ecf0ef38258e62f03bbb49f19f2cd07ba5145a840d83b134d5963b3633' + }, + ]; + for (var i = 0; i < test.length; i++) + assert.equal(doDrbg(test[i]), test[i].res); + }); + + describe('NIST vector', function() { + function test(opt) { + it('should not fail at ' + opt.name, function() { + var drbg = elliptic.hmacDRBG({ + hash: hash.sha256, + entropy: opt.entropy, + entropyEnc: 'hex', + nonce: opt.nonce, + nonceEnc: 'hex', + pers: opt.pers, + persEnc: 'hex' + }); + + for (var i = 0; i < opt.add.length; i++) { + var last = drbg.generate(opt.expected.length / 2, + 'hex', + opt.add[i], + 'hex'); + } + assert.equal(last, opt.expected); + }); + } + + var vector = function() {/* + COUNT = 0 + EntropyInput = ca851911349384bffe89de1cbdc46e6831e44d34a4fb935ee285dd14b71a7488 + Nonce = 659ba96c601dc69fc902940805ec0ca8 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = e528e9abf2dece54d47c7e75e5fe302149f817ea9fb4bee6f4199697d04d5b89d54fbb978a15b5c443c9ec21036d2460b6f73ebad0dc2aba6e624abf07745bc107694bb7547bb0995f70de25d6b29e2d3011bb19d27676c07162c8b5ccde0668961df86803482cb37ed6d5c0bb8d50cf1f50d476aa0458bdaba806f48be9dcb8 + + COUNT = 1 + EntropyInput = 79737479ba4e7642a221fcfd1b820b134e9e3540a35bb48ffae29c20f5418ea3 + Nonce = 3593259c092bef4129bc2c6c9e19f343 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = cf5ad5984f9e43917aa9087380dac46e410ddc8a7731859c84e9d0f31bd43655b924159413e2293b17610f211e09f770f172b8fb693a35b85d3b9e5e63b1dc252ac0e115002e9bedfb4b5b6fd43f33b8e0eafb2d072e1a6fee1f159df9b51e6c8da737e60d5032dd30544ec51558c6f080bdbdab1de8a939e961e06b5f1aca37 + + COUNT = 2 + EntropyInput = b340907445b97a8b589264de4a17c0bea11bb53ad72f9f33297f05d2879d898d + Nonce = 65cb27735d83c0708f72684ea58f7ee5 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 75183aaaf3574bc68003352ad655d0e9ce9dd17552723b47fab0e84ef903694a32987eeddbdc48efd24195dbdac8a46ba2d972f5808f23a869e71343140361f58b243e62722088fe10a98e43372d252b144e00c89c215a76a121734bdc485486f65c0b16b8963524a3a70e6f38f169c12f6cbdd169dd48fe4421a235847a23ff + + COUNT = 3 + EntropyInput = 8e159f60060a7d6a7e6fe7c9f769c30b98acb1240b25e7ee33f1da834c0858e7 + Nonce = c39d35052201bdcce4e127a04f04d644 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 62910a77213967ea93d6457e255af51fc79d49629af2fccd81840cdfbb4910991f50a477cbd29edd8a47c4fec9d141f50dfde7c4d8fcab473eff3cc2ee9e7cc90871f180777a97841597b0dd7e779eff9784b9cc33689fd7d48c0dcd341515ac8fecf5c55a6327aea8d58f97220b7462373e84e3b7417a57e80ce946d6120db5 + + COUNT = 4 + EntropyInput = 74755f196305f7fb6689b2fe6835dc1d81484fc481a6b8087f649a1952f4df6a + Nonce = c36387a544a5f2b78007651a7b74b749 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = b2896f3af4375dab67e8062d82c1a005ef4ed119d13a9f18371b1b873774418684805fd659bfd69964f83a5cfe08667ddad672cafd16befffa9faed49865214f703951b443e6dca22edb636f3308380144b9333de4bcb0735710e4d9266786342fc53babe7bdbe3c01a3addb7f23c63ce2834729fabbd419b47beceb4a460236 + + COUNT = 5 + EntropyInput = 4b222718f56a3260b3c2625a4cf80950b7d6c1250f170bd5c28b118abdf23b2f + Nonce = 7aed52d0016fcaef0b6492bc40bbe0e9 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = a6da029b3665cd39fd50a54c553f99fed3626f4902ffe322dc51f0670dfe8742ed48415cf04bbad5ed3b23b18b7892d170a7dcf3ef8052d5717cb0c1a8b3010d9a9ea5de70ae5356249c0e098946030c46d9d3d209864539444374d8fbcae068e1d6548fa59e6562e6b2d1acbda8da0318c23752ebc9be0c1c1c5b3cf66dd967 + + COUNT = 6 + EntropyInput = b512633f27fb182a076917e39888ba3ff35d23c3742eb8f3c635a044163768e0 + Nonce = e2c39b84629a3de5c301db5643af1c21 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = fb931d0d0194a97b48d5d4c231fdad5c61aedf1c3a55ac24983ecbf38487b1c93396c6b86ff3920cfa8c77e0146de835ea5809676e702dee6a78100da9aa43d8ec0bf5720befa71f82193205ac2ea403e8d7e0e6270b366dc4200be26afd9f63b7e79286a35c688c57cbff55ac747d4c28bb80a2b2097b3b62ea439950d75dff + + COUNT = 7 + EntropyInput = aae3ffc8605a975befefcea0a7a286642bc3b95fb37bd0eb0585a4cabf8b3d1e + Nonce = 9504c3c0c4310c1c0746a036c91d9034 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 2819bd3b0d216dad59ddd6c354c4518153a2b04374b07c49e64a8e4d055575dfbc9a8fcde68bd257ff1ba5c6000564b46d6dd7ecd9c5d684fd757df62d85211575d3562d7814008ab5c8bc00e7b5a649eae2318665b55d762de36eba00c2906c0e0ec8706edb493e51ca5eb4b9f015dc932f262f52a86b11c41e9a6d5b3bd431 + + COUNT = 8 + EntropyInput = b9475210b79b87180e746df704b3cbc7bf8424750e416a7fbb5ce3ef25a82cc6 + Nonce = 24baf03599c10df6ef44065d715a93f7 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = ae12d784f796183c50db5a1a283aa35ed9a2b685dacea97c596ff8c294906d1b1305ba1f80254eb062b874a8dfffa3378c809ab2869aa51a4e6a489692284a25038908a347342175c38401193b8afc498077e10522bec5c70882b7f760ea5946870bd9fc72961eedbe8bff4fd58c7cc1589bb4f369ed0d3bf26c5bbc62e0b2b2 + + COUNT = 9 + EntropyInput = 27838eb44ceccb4e36210703ebf38f659bc39dd3277cd76b7a9bcd6bc964b628 + Nonce = 39cfe0210db2e7b0eb52a387476e7ea1 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = e5e72a53605d2aaa67832f97536445ab774dd9bff7f13a0d11fd27bf6593bfb52309f2d4f09d147192199ea584503181de87002f4ee085c7dc18bf32ce5315647a3708e6f404d6588c92b2dda599c131aa350d18c747b33dc8eda15cf40e95263d1231e1b4b68f8d829f86054d49cfdb1b8d96ab0465110569c8583a424a099a + + COUNT = 10 + EntropyInput = d7129e4f47008ad60c9b5d081ff4ca8eb821a6e4deb91608bf4e2647835373a5 + Nonce = a72882773f78c2fc4878295840a53012 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 0cbf48585c5de9183b7ff76557f8fc9ebcfdfde07e588a8641156f61b7952725bbee954f87e9b937513b16bba0f2e523d095114658e00f0f3772175acfcb3240a01de631c19c5a834c94cc58d04a6837f0d2782fa53d2f9f65178ee9c837222494c799e64c60406069bd319549b889fa00a0032dd7ba5b1cc9edbf58de82bfcd + + COUNT = 11 + EntropyInput = 67fe5e300c513371976c80de4b20d4473889c9f1214bce718bc32d1da3ab7532 + Nonce = e256d88497738a33923aa003a8d7845c + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = b44660d64ef7bcebc7a1ab71f8407a02285c7592d755ae6766059e894f694373ed9c776c0cfc8594413eefb400ed427e158d687e28da3ecc205e0f7370fb089676bbb0fa591ec8d916c3d5f18a3eb4a417120705f3e2198154cd60648dbfcfc901242e15711cacd501b2c2826abe870ba32da785ed6f1fdc68f203d1ab43a64f + + COUNT = 12 + EntropyInput = de8142541255c46d66efc6173b0fe3ffaf5936c897a3ce2e9d5835616aafa2cb + Nonce = d01f9002c407127bc3297a561d89b81d + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 64d1020929d74716446d8a4e17205d0756b5264867811aa24d0d0da8644db25d5cde474143c57d12482f6bf0f31d10af9d1da4eb6d701bdd605a8db74fb4e77f79aaa9e450afda50b18d19fae68f03db1d7b5f1738d2fdce9ad3ee9461b58ee242daf7a1d72c45c9213eca34e14810a9fca5208d5c56d8066bab1586f1513de7 + + COUNT = 13 + EntropyInput = 4a8e0bd90bdb12f7748ad5f147b115d7385bb1b06aee7d8b76136a25d779bcb7 + Nonce = 7f3cce4af8c8ce3c45bdf23c6b181a00 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 320c7ca4bbeb7af977bc054f604b5086a3f237aa5501658112f3e7a33d2231f5536d2c85c1dad9d9b0bf7f619c81be4854661626839c8c10ae7fdc0c0b571be34b58d66da553676167b00e7d8e49f416aacb2926c6eb2c66ec98bffae20864cf92496db15e3b09e530b7b9648be8d3916b3c20a3a779bec7d66da63396849aaf + + COUNT = 14 + EntropyInput = 451ed024bc4b95f1025b14ec3616f5e42e80824541dc795a2f07500f92adc665 + Nonce = 2f28e6ee8de5879db1eccd58c994e5f0 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 3fb637085ab75f4e95655faae95885166a5fbb423bb03dbf0543be063bcd48799c4f05d4e522634d9275fe02e1edd920e26d9accd43709cb0d8f6e50aa54a5f3bdd618be23cf73ef736ed0ef7524b0d14d5bef8c8aec1cf1ed3e1c38a808b35e61a44078127c7cb3a8fd7addfa50fcf3ff3bc6d6bc355d5436fe9b71eb44f7fd + + COUNT = 0 + EntropyInput = d3cc4d1acf3dde0c4bd2290d262337042dc632948223d3a2eaab87da44295fbd + Nonce = 0109b0e729f457328aa18569a9224921 + PersonalizationString = + AdditionalInput = 3c311848183c9a212a26f27f8c6647e40375e466a0857cc39c4e47575d53f1f6 + AdditionalInput = fcb9abd19ccfbccef88c9c39bfb3dd7b1c12266c9808992e305bc3cff566e4e4 + ReturnedBits = 9c7b758b212cd0fcecd5daa489821712e3cdea4467b560ef5ddc24ab47749a1f1ffdbbb118f4e62fcfca3371b8fbfc5b0646b83e06bfbbab5fac30ea09ea2bc76f1ea568c9be0444b2cc90517b20ca825f2d0eccd88e7175538b85d90ab390183ca6395535d34473af6b5a5b88f5a59ee7561573337ea819da0dcc3573a22974 + + COUNT = 1 + EntropyInput = f97a3cfd91faa046b9e61b9493d436c4931f604b22f1081521b3419151e8ff06 + Nonce = 11f3a7d43595357d58120bd1e2dd8aed + PersonalizationString = + AdditionalInput = 517289afe444a0fe5ed1a41dbbb5eb17150079bdd31e29cf2ff30034d8268e3b + AdditionalInput = 88028d29ef80b4e6f0fe12f91d7449fe75062682e89c571440c0c9b52c42a6e0 + ReturnedBits = c6871cff0824fe55ea7689a52229886730450e5d362da5bf590dcf9acd67fed4cb32107df5d03969a66b1f6494fdf5d63d5b4d0d34ea7399a07d0116126d0d518c7c55ba46e12f62efc8fe28a51c9d428e6d371d7397ab319fc73ded4722e5b4f30004032a6128df5e7497ecf82ca7b0a50e867ef6728a4f509a8c859087039c + + COUNT = 2 + EntropyInput = 0f2f23d64f481cabec7abb01db3aabf125c3173a044b9bf26844300b69dcac8b + Nonce = 9a5ae13232b43aa19cfe8d7958b4b590 + PersonalizationString = + AdditionalInput = ec4c7a62acab73385f567da10e892ff395a0929f959231a5628188ce0c26e818 + AdditionalInput = 6b97b8c6b6bb8935e676c410c17caa8042aa3145f856d0a32b641e4ae5298648 + ReturnedBits = 7480a361058bd9afa3db82c9d7586e42269102013f6ec5c269b6d05f17987847748684766b44918fd4b65e1648622fc0e0954178b0279dfc9fa99b66c6f53e51c4860131e9e0644287a4afe4ca8e480417e070db68008a97c3397e4b320b5d1a1d7e1d18a95cfedd7d1e74997052bf649d132deb9ec53aae7dafdab55e6dae93 + + COUNT = 3 + EntropyInput = 53c56660c78481be9c63284e005fcc14fbc7fb27732c9bf1366d01a426765a31 + Nonce = dc7a14d0eb5b0b3534e717a0b3c64614 + PersonalizationString = + AdditionalInput = 3aa848706ecb877f5bedf4ffc332d57c22e08747a47e75cff6f0fd1316861c95 + AdditionalInput = 9a401afa739b8f752fddacd291e0b854f5eff4a55b515e20cb319852189d3722 + ReturnedBits = 5c0eb420e0bf41ce9323e815310e4e8303cd677a8a8b023f31f0d79f0ca15aeb636099a369fd074d69889865eac1b72ab3cbfebdb8cf460b00072802e2ec648b1349a5303be4ccaadd729f1a9ea17482fd026aaeb93f1602bc1404b9853adde40d6c34b844cf148bc088941ecfc1642c8c0b9778e45f3b07e06e21ee2c9e0300 + + COUNT = 4 + EntropyInput = f63c804404902db334c54bb298fc271a21d7acd9f770278e089775710bf4fdd7 + Nonce = 3e45009ea9cb2a36ba1aa4bf39178200 + PersonalizationString = + AdditionalInput = d165a13dc8cc43f3f0952c3f5d3de4136954d983683d4a3e6d2dc4c89bf23423 + AdditionalInput = 75106bc86d0336df85097f6af8e80e2da59046a03fa65b06706b8bbc7ffc6785 + ReturnedBits = 6363139bba32c22a0f5cd23ca6d437b5669b7d432f786b8af445471bee0b2d24c9d5f2f93717cbe00d1f010cc3b9c515fc9f7336d53d4d26ba5c0d76a90186663c8582eb739c7b6578a3328bf68dc2cec2cd89b3a90201f6993adcc854df0f5c6974d0f5570765a15fe03dbce28942dd2fd16ba2027e68abac83926969349af8 + + COUNT = 5 + EntropyInput = 2aaca9147da66c176615726b69e3e851cc3537f5f279fe7344233d8e44cfc99d + Nonce = 4e171f080af9a6081bee9f183ac9e340 + PersonalizationString = + AdditionalInput = d75a2a6eb66c3833e50f5ec3d2e434cf791448d618026d0c360806d120ded669 + AdditionalInput = b643b74c15b37612e6577ed7ca2a4c67a78d560af9eb50a4108fca742e87b8d6 + ReturnedBits = 501dcdc977f4ba856f24eaa4968b374bebb3166b280334cb510232c31ebffde10fa47b7840ef3fe3b77725c2272d3a1d4219baf23e0290c622271edcced58838cf428f0517425d2e19e0d8c89377eecfc378245f283236fafa466c914b99672ceafab369e8889a0c866d8bd639db9fb797254262c6fd44cfa9045ad6340a60ef + + COUNT = 6 + EntropyInput = a2e4cd48a5cf918d6f55942d95fcb4e8465cdc4f77b7c52b6fae5b16a25ca306 + Nonce = bef036716440db6e6d333d9d760b7ca8 + PersonalizationString = + AdditionalInput = bfa591c7287f3f931168f95e38869441d1f9a11035ad8ea625bb61b9ea17591c + AdditionalInput = c00c735463bca215adc372cb892b05e939bf669583341c06d4e31d0e5b363a37 + ReturnedBits = e7d136af69926a5421d4266ee0420fd729f2a4f7c295d3c966bdfa05268180b508b8a2852d1b3a06fd2ab3e13c54005123ef319f42d0c6d3a575e6e7e1496cb28aacadbcf83740fba8f35fcee04bb2ed8a51db3d3362b01094a62fb57e33c99a432f29fce6676cffbbcc05107e794e75e44a02d5e6d9d748c5fbff00a0178d65 + + COUNT = 7 + EntropyInput = 95a67771cba69011a79776e713145d309edae56fad5fd6d41d83eaff89df6e5e + Nonce = be5b5164e31ecc51ba6f7c3c5199eb33 + PersonalizationString = + AdditionalInput = 065f693b229a7c4fd373cd15b3807552dd9bf98c5485cef361949d4e7d774b53 + AdditionalInput = 9afb62406f0e812c4f156d58b19a656c904813c1b4a45a0029ae7f50731f8014 + ReturnedBits = f61b61a6e79a41183e8ed6647899d2dc85cdaf5c3abf5c7f3bf37685946dc28f4923dc842f2d4326bd6ce0d50a84cb3ba869d72a36e246910eba6512ba36cd7ed3a5437c9245b00a344308c792b668b458d3c3e16dee2fbec41867da31084d46d8ec168de2148ef64fc5b72069abf5a6ada1ead2b7146bb793ff1c9c3690fa56 + + COUNT = 8 + EntropyInput = a459e1815cbca4514ec8094d5ab2414a557ba6fe10e613c345338d0521e4bf90 + Nonce = 62221392e2552e76cd0d36df6e6068eb + PersonalizationString = + AdditionalInput = 0a3642b02b23b3ef62c701a63401124022f5b896de86dab6e6c7451497aa1dcc + AdditionalInput = c80514865901371c45ba92d9f95d50bb7c9dd1768cb3dfbc45b968da94965c6e + ReturnedBits = 464e6977b8adaef307c9623e41c357013249c9ffd77f405f3925cebb69f151ce8fbb6a277164002aee7858fc224f6499042aa1e6322deee9a5d133c31d640e12a7487c731ba03ad866a24675badb1d79220c40be689f79c2a0be93cb4dada3e0eac4ab140cb91998b6f11953e68f2319b050c40f71c34de9905ae41b2de1c2f6 + + COUNT = 9 + EntropyInput = 252c2cad613e002478162861880979ee4e323025eebb6fb2e0aa9f200e28e0a1 + Nonce = d001bc9a8f2c8c242e4369df0c191989 + PersonalizationString = + AdditionalInput = 9bcfc61cb2bc000034bb3db980eb47c76fb5ecdd40553eff113368d639b947fd + AdditionalInput = 8b0565c767c2610ee0014582e9fbecb96e173005b60e9581503a6dca5637a26e + ReturnedBits = e96c15fe8a60692b0a7d67171e0195ff6e1c87aab844221e71700d1bbee75feea695f6a740c9760bbe0e812ecf4061d8f0955bc0195e18c4fd1516ebca50ba6a6db86881737dbab8321707675479b87611db6af2c97ea361a5484555ead454defb1a64335de964fc803d40f3a6f057893d2afc25725754f4f00abc51920743dc + + COUNT = 10 + EntropyInput = 8be0ca6adc8b3870c9d69d6021bc1f1d8eb9e649073d35ee6c5aa0b7e56ad8a5 + Nonce = 9d1265f7d51fdb65377f1e6edd6ae0e4 + PersonalizationString = + AdditionalInput = da86167ac997c406bb7979f423986a84ec6614d6caa7afc10aff0699a9b2cf7f + AdditionalInput = e4baa3c555950b53e2bfdba480cb4c94b59381bac1e33947e0c22e838a9534cf + ReturnedBits = 64384ecc4ea6b458efc227ca697eac5510092265520c0a0d8a0ccf9ed3ca9d58074671188c6a7ad16d0b050cdc072c125d7298d3a31d9f044a9ee40da0089a84fea28cc7f05f1716db952fad29a0e779635cb7a912a959be67be2f0a4170aace2981802e2ff6467e5b46f0ffbff3b42ba5935fd553c82482ac266acf1cd247d7 + + COUNT = 11 + EntropyInput = d43a75b6adf26d60322284cb12ac38327792442aa8f040f60a2f331b33ac4a8f + Nonce = 0682f8b091f811afacaacaec9b04d279 + PersonalizationString = + AdditionalInput = 7fd3b8f512940da7de5d80199d9a7b42670c04a945775a3dba869546cbb9bc65 + AdditionalInput = 2575db20bc7aafc2a90a5dabab760db851d754777bc9f05616af1858b24ff3da + ReturnedBits = 0da7a8dc73c163014bf0841913d3067806456bbca6d5de92b85534c6545467313648d71ef17c923d090dc92cff8d4d1a9a2bb63e001dc2e8ab1a597999be3d6cf70ff63fee9985801395fbd4f4990430c4259fcae4fa1fcd73dc3187ccc102d04af7c07532885e5a226fc42809c48f22eecf4f6ab996ae4fcb144786957d9f41 + + COUNT = 12 + EntropyInput = 64352f236af5d32067a529a8fd05ba00a338c9de306371a0b00c36e610a48d18 + Nonce = df99ed2c7608c870624b962a5dc68acd + PersonalizationString = + AdditionalInput = da416335e7aaf60cf3d06fb438735ce796aad09034f8969c8f8c3f81e32fef24 + AdditionalInput = a28c07c21a2297311adf172c19e83ca0a87731bdffb80548978d2d1cd82cf8a3 + ReturnedBits = 132b9f25868729e3853d3c51f99a3b5fae6d4204bea70890daf62e042b776a526c8fb831b80a6d5d3f153237df1fd39b6fd9137963f5516d9cdd4e3f9195c46e9972c15d3edc6606e3368bde1594977fb88d0ca6e6f5f3d057ccadc7d7dab77dfc42658a1e972aa446b20d418286386a52dfc1c714d2ac548713268b0b709729 + + COUNT = 13 + EntropyInput = 282f4d2e05a2cd30e9087f5633089389449f04bac11df718c90bb351cd3653a5 + Nonce = 90a7daf3c0de9ea286081efc4a684dfb + PersonalizationString = + AdditionalInput = 2630b4ccc7271cc379cb580b0aaede3d3aa8c1c7ba002cf791f0752c3d739007 + AdditionalInput = c31d69de499f1017be44e3d4fa77ecebc6a9b9934749fcf136f267b29115d2cc + ReturnedBits = c899094520e0197c37b91dd50778e20a5b950decfb308d39f1db709447ae48f6101d9abe63a783fbb830eec1d359a5f61a2013728966d349213ee96382614aa4135058a967627183810c6622a2158cababe3b8ab99169c89e362108bf5955b4ffc47440f87e4bad0d36bc738e737e072e64d8842e7619f1be0af1141f05afe2d + + COUNT = 14 + EntropyInput = 13c752b9e745ce77bbc7c0dbda982313d3fe66f903e83ebd8dbe4ff0c11380e9 + Nonce = f1a533095d6174164bd7c82532464ae7 + PersonalizationString = + AdditionalInput = 4f53db89b9ba7fc00767bc751fb8f3c103fe0f76acd6d5c7891ab15b2b7cf67c + AdditionalInput = 582c2a7d34679088cca6bd28723c99aac07db46c332dc0153d1673256903b446 + ReturnedBits = 6311f4c0c4cd1f86bd48349abb9eb930d4f63df5e5f7217d1d1b91a71d8a6938b0ad2b3e897bd7e3d8703db125fab30e03464fad41e5ddf5bf9aeeb5161b244468cfb26a9d956931a5412c97d64188b0da1bd907819c686f39af82e91cfeef0cbffb5d1e229e383bed26d06412988640706815a6e820796876f416653e464961 + */}.toString().replace(/^function.*\/\*|\*\/}/g, '').split(/\n\n/g); + + vector.forEach(function(item) { + var lines = item.split(/\n/g); + var opt = null; + for (var i = 0; i < lines.length; i++) { + var line = lines[i].trim(); + + var match = line.match( + /(COUNT|Entropy|Non|Per|Add|Ret)\w*\s*=\s*([\w\d]*)/ + ); + if (!match) + continue; + + var key = match[1]; + var value = match[2] || null; + if (key === 'COUNT') { + opt = { + name: value, + entropy: null, + nonce: null, + pers: null, + add: [], + expected: null + }; + } else if (key === 'Entropy') { + opt.entropy = value; + } else if (key === 'Non') { + opt.nonce = value; + } else if (key === 'Per') { + opt.pers = value; + } else if (key === 'Add') { + if (value && opt.add.length === 0) + opt.name += ' with additional data'; + opt.add.push(value); + } else if (key === 'Ret') { + opt.expected = value; + test(opt); + opt = null; + } + } + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/EVP_BytesToKey.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/EVP_BytesToKey.js new file mode 100644 index 00000000..fc298d9d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/EVP_BytesToKey.js @@ -0,0 +1,39 @@ +var createHash = require('create-hash'); +module.exports = function evp(password, salt, keyLen) { + keyLen = keyLen/8; + var ki = 0; + var ii = 0; + var key = new Buffer(keyLen); + var addmd = 0; + var md, md_buf; + var i; + while (true) { + md = createHash('md5'); + if(addmd++ > 0) { + md.update(md_buf); + } + md.update(password); + md.update(salt); + md_buf = md.digest(); + i = 0; + if(keyLen > 0) { + while(true) { + if(keyLen === 0) { + break; + } + if(i === md_buf.length) { + break; + } + key[ki++] = md_buf[i++]; + keyLen--; + } + } + if(keyLen === 0) { + break; + } + } + for(i=0;i + + + Code coverage report for All files + + + + + + + +
+

Code coverage report for All files

+

+ + Statements: 92.07% (151 / 164)      + + + Branches: 86.84% (33 / 38)      + + + Functions: 68.18% (15 / 22)      + + + Lines: 92.07% (151 / 164)      + + Ignored: none      +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
parseASN1/92.07%(151 / 164)86.84%(33 / 38)68.18%(15 / 22)92.07%(151 / 164)
+
+
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/EVP_BytesToKey.js.html b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/EVP_BytesToKey.js.html new file mode 100644 index 00000000..177a59c6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/EVP_BytesToKey.js.html @@ -0,0 +1,436 @@ + + + + Code coverage report for parseASN1/EVP_BytesToKey.js + + + + + + + +
+

Code coverage report for parseASN1/EVP_BytesToKey.js

+

+ + Statements: 100% (29 / 29)      + + + Branches: 90% (9 / 10)      + + + Functions: 100% (1 / 1)      + + + Lines: 100% (29 / 29)      + + Ignored: none      +

+
All files » parseASN1/ » EVP_BytesToKey.js
+
+
+

+
+
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 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39  +1 +3 +3 +3 +3 +3 +3 +3 +3 +5 +5 +2 +  +5 +5 +5 +5 +5 +5 +77 +3 +  +74 +2 +  +72 +72 +  +  +5 +3 +  +  +3 +48 +  +3 + 
 
+module.exports = function evp(crypto, password, salt, keyLen) {
+  keyLen = keyLen/8;
+  var ki = 0;
+  var ii = 0;
+  var key = new Buffer(keyLen);
+  var addmd = 0;
+  var md, md_buf;
+  var i;
+  while (true) {
+    md = crypto.createHash('md5');
+    if(addmd++ > 0) {
+       md.update(md_buf);
+    }
+    md.update(password);
+    md.update(salt);
+    md_buf = md.digest();
+    i = 0;
+    Eif(keyLen > 0) {
+      while(true) {
+        if(keyLen === 0) {
+          break;
+        }
+        if(i === md_buf.length) {
+          break;
+        }
+        key[ki++] = md_buf[i++];
+        keyLen--;
+       }
+    }
+   if(keyLen === 0) {
+      break;
+    }
+  }
+  for(i=0;i<md_buf.length;i++) {
+    md_buf[i] = 0;
+  }
+  return key;
+};
+ +
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/asn1.js.html b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/asn1.js.html new file mode 100644 index 00000000..cbcf8451 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/asn1.js.html @@ -0,0 +1,859 @@ + + + + Code coverage report for parseASN1/asn1.js + + + + + + + +
+

Code coverage report for parseASN1/asn1.js

+

+ + Statements: 85.11% (40 / 47)      + + + Branches: 100% (0 / 0)      + + + Functions: 58.82% (10 / 17)      + + + Lines: 85.11% (40 / 47)      + + Ignored: none      +

+
All files » parseASN1/ » asn1.js
+
+
+

+
+
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 +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 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180  +  +  +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 +  +  +  +  +  + 
// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
+// Fedor, you are amazing.
+ 
+var asn1 = require('asn1.js');
+ 
+var RSAPrivateKey = asn1.define('RSAPrivateKey', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('modulus').int(),
+    this.key('publicExponent').int(),
+    this.key('privateExponent').int(),
+    this.key('prime1').int(),
+    this.key('prime2').int(),
+    this.key('exponent1').int(),
+    this.key('exponent2').int(),
+    this.key('coefficient').int()
+  );
+});
+exports.RSAPrivateKey = RSAPrivateKey;
+ 
+var RSAPublicKey = asn1.define('RSAPublicKey', function() {
+  this.seq().obj(
+    this.key('modulus').int(),
+    this.key('publicExponent').int()
+  );
+});
+exports.RSAPublicKey = RSAPublicKey;
+ 
+var PublicKey = asn1.define('SubjectPublicKeyInfo', function() {
+  this.seq().obj(
+    this.key('algorithm').use(AlgorithmIdentifier),
+    this.key('subjectPublicKey').bitstr()
+  );
+});
+exports.PublicKey = PublicKey;
+var ECPublicKey =  asn1.define('ECPublicKey', function() {
+  this.seq().obj(
+    this.key('algorithm').seq().obj(
+      this.key('id').objid(),
+      this.key('curve').objid()
+    ),
+    this.key('subjectPrivateKey').bitstr()
+  );
+});
+exports.ECPublicKey = ECPublicKey;
+var ECPrivateWrap =  asn1.define('ECPrivateWrap', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('algorithm').seq().obj(
+      this.key('id').objid(),
+      this.key('curve').objid()
+    ),
+    this.key('subjectPrivateKey').octstr()
+  );
+});
+exports.ECPrivateWrap = ECPrivateWrap;
+ 
+var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function() {
+  this.seq().obj(
+    this.key('algorithm').objid(),
+    this.key('none').null_().optional(),
+    this.key('curve').objid().optional(),
+    this.key('params').seq().obj(
+        this.key('p').int(),
+        this.key('q').int(),
+        this.key('g').int()
+      ).optional()
+  );
+});
+ 
+var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('algorithm').use(AlgorithmIdentifier),
+    this.key('subjectPrivateKey').octstr()
+  );
+});
+exports.PrivateKey = PrivateKeyInfo;
+var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function() {
+  this.seq().obj(
+    this.key('algorithm').seq().obj(
+      this.key('id').objid(),
+      this.key('decrypt').seq().obj(
+        this.key('kde').seq().obj(
+          this.key('id').objid(),
+          this.key('kdeparams').seq().obj(
+            this.key('salt').octstr(),
+            this.key('iters').int()
+          )
+        ),
+        this.key('cipher').seq().obj(
+          this.key('algo').objid(),
+          this.key('iv').octstr()
+        )
+      )
+    ),
+    this.key('subjectPrivateKey').octstr()
+  );
+});
+var dsaParams = asn1.define('dsaParams', function() {
+  this.seq().obj(
+    this.key('algorithm').objid(),
+    this.key('parameters').seq().obj(
+        this.key('p').int(),
+        this.key('q').int(),
+        this.key('g').int()
+      )
+  );
+});
+exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;
+var DSAPublicKey = asn1.define('DSAPublicKey', function() {
+  this.seq().obj(
+    this.key('algorithm').use(dsaParams),
+    this.key('subjectPublicKey').bitstr()
+  );
+});
+exports.DSAPublicKey = DSAPublicKey;
+var DSAPrivateWrap =  asn1.define('DSAPrivateWrap', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('algorithm').seq().obj(
+      this.key('id').objid(),
+      this.key('parameters').seq().obj(
+        this.key('p').int(),
+        this.key('q').int(),
+        this.key('g').int()
+      )
+    ),
+    this.key('subjectPrivateKey').octstr()
+  );
+});
+exports.DSAPrivateWrap = DSAPrivateWrap;
+var DSAPrivateKey = asn1.define('DSAPrivateKey', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('p').int(),
+    this.key('q').int(),
+    this.key('g').int(),
+    this.key('pub_key').int(),
+    this.key('priv_key').int()
+  );
+});
+exports.DSAPrivateKey = DSAPrivateKey;
+ 
+exports.DSAparam = asn1.define('DSAparam', function () {
+  this.int();
+});
+var ECPrivateKey = asn1.define('ECPrivateKey', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('privateKey').octstr(),
+    this.key('parameters').optional().explicit(0).use(ECParameters),
+    this.key('publicKey').optional().explicit(1).bitstr()
+  );
+});
+exports.ECPrivateKey = ECPrivateKey;
+var ECParameters = asn1.define('ECParameters', function() {
+  this.choice({
+    namedCurve: this.objid()
+  });
+});
+ 
+var ECPrivateKey2 = asn1.define('ECPrivateKey2', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('privateKey').octstr(),
+    this.key('publicKey').seq().obj(
+      this.key('key').bitstr()
+    )
+  );
+});
+exports.ECPrivateKey2 = ECPrivateKey2;
+ 
+exports.signature = asn1.define('signature', function() {
+  this.seq().obj(
+    this.key('r').int(),
+    this.key('s').int()
+  );
+});
+ 
+ +
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/fixProc.js.html b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/fixProc.js.html new file mode 100644 index 00000000..e9001b01 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/fixProc.js.html @@ -0,0 +1,427 @@ + + + + Code coverage report for parseASN1/fixProc.js + + + + + + + +
+

Code coverage report for parseASN1/fixProc.js

+

+ + Statements: 100% (28 / 28)      + + + Branches: 100% (4 / 4)      + + + Functions: 100% (2 / 2)      + + + Lines: 100% (28 / 28)      + + Ignored: none      +

+
All files » parseASN1/ » fixProc.js
+
+
+

+
+
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 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +361 +1 +1 +1 +7 +7 +7 +4 +  +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +  +  +1 +3 +3 +48 +3 +3 +  +  +45 +45 +  +  +3 + 
var findProc = /Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m;
+var startRegex = /^-----BEGIN (.*)-----\n/;
+var evp = require('./EVP_BytesToKey');
+module.exports = function (okey, password, crypto) {
+  var key = okey.toString();
+  var match = key.match(findProc);
+  if (!match) {
+    return okey;
+  }
+  var suite = 'aes' + match[1];
+  var iv = new Buffer(match[2], 'hex');
+  var cipherText = new Buffer(match[3].replace(/\n\r?/g, ''), 'base64');
+  var cipherKey = evp(crypto, password, iv.slice(0,8), parseInt(match[1]));
+  var out = [];
+  var cipher = crypto.createDecipheriv(suite, cipherKey, iv);
+  out.push(cipher.update(cipherText));
+  out.push(cipher.final());
+  var decrypted = Buffer.concat(out).toString('base64');
+  var tag = key.match(startRegex)[1];
+  return '-----BEGIN ' + tag + "-----\n" + wrap(decrypted) + "\n" + '-----END ' + tag + "-----\n";
+};
+// http://stackoverflow.com/a/7033705
+function wrap(str) {
+  var chunks = [];
+  while (str) {
+    if (str.length < 64) {
+      chunks.push(str);
+      break;
+    }
+    else {
+      chunks.push(str.slice(0, 64));
+      str = str.slice(64);
+    }
+  }
+  return chunks.join("\n");
+}
+ +
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.html b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.html new file mode 100644 index 00000000..529ca97d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.html @@ -0,0 +1,389 @@ + + + + Code coverage report for parseASN1/ + + + + + + + +
+

Code coverage report for parseASN1/

+

+ + Statements: 92.07% (151 / 164)      + + + Branches: 86.84% (33 / 38)      + + + Functions: 68.18% (15 / 22)      + + + Lines: 92.07% (151 / 164)      + + Ignored: none      +

+
All files » parseASN1/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
EVP_BytesToKey.js100%(29 / 29)90%(9 / 10)100%(1 / 1)100%(29 / 29)
asn1.js85.11%(40 / 47)100%(0 / 0)58.82%(10 / 17)85.11%(40 / 47)
fixProc.js100%(28 / 28)100%(4 / 4)100%(2 / 2)100%(28 / 28)
index.js90%(54 / 60)83.33%(20 / 24)100%(2 / 2)90%(54 / 60)
+
+
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.js.html b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.js.html new file mode 100644 index 00000000..f9fbb816 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.js.html @@ -0,0 +1,622 @@ + + + + Code coverage report for parseASN1/index.js + + + + + + + +
+

Code coverage report for parseASN1/index.js

+

+ + Statements: 90% (54 / 60)      + + + Branches: 83.33% (20 / 24)      + + + Functions: 100% (2 / 2)      + + + Lines: 90% (54 / 60)      + + Ignored: none      +

+
All files » parseASN1/ » index.js
+
+
+

+
+
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 +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 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +1011 +1 +1 +1 +1 +  +1 +26 +26 +7 +7 +  +26 +  +  +26 +7 +  +26 +26 +26 +26 +26 +  +11 +11 +11 +  +5 +  +2 +2 +  +  +  +  +4 +4 +  +  +  +  +  +  +  +4 +4 +  +  +6 +6 +6 +  +3 +  +1 +  +  +  +  +2 +2 +  +  +  +  +  +  +  +2 +  +4 +  +2 +  +  +  +  +1 +1 +  +  +  +  +  +  +1 +1 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 + 
var pemstrip = require('pemstrip');
+var asn1 = require('./asn1');
+var aesid = require('./aesid.json');
+var fixProc = require('./fixProc');
+module.exports = parseKeys;
+ 
+function parseKeys(buffer, crypto) {
+  var password;
+  if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
+    password = buffer.passphrase;
+    buffer = buffer.key;
+  }
+  Iif (typeof buffer === 'string') {
+    buffer = new Buffer(buffer);
+  }
+  if (password) {
+    buffer = fixProc(buffer, password, crypto);
+  }
+  var stripped = pemstrip.strip(buffer);
+  var type = stripped.tag;
+  var data = new Buffer(stripped.base64, 'base64');
+  var subtype,ndata;
+  switch (type) {
+    case 'PUBLIC KEY':
+      ndata = asn1.PublicKey.decode(data, 'der');
+      subtype = ndata.algorithm.algorithm.join('.');
+      switch(subtype) {
+        case '1.2.840.113549.1.1.1':
+          return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der');
+        case '1.2.840.10045.2.1':
+        ndata.subjectPrivateKey = ndata.subjectPublicKey;
+          return {
+            type: 'ec',
+            data:  ndata
+          };
+        case '1.2.840.10040.4.1':
+          ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der');
+          return {
+            type: 'dsa',
+            data: ndata.algorithm.params
+          };
+        default: throw new Error('unknown key id ' +  subtype);
+      }
+      throw new Error('unknown key type ' +  type);
+    case 'ENCRYPTED PRIVATE KEY':
+      data = asn1.EncryptedPrivateKey.decode(data, 'der');
+      data = decrypt(crypto, data, password);
+      //falling through
+    case 'PRIVATE KEY':
+      ndata = asn1.PrivateKey.decode(data, 'der');
+      subtype = ndata.algorithm.algorithm.join('.');
+      switch(subtype) {
+        case '1.2.840.113549.1.1.1':
+          return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der');
+        case '1.2.840.10045.2.1':
+          return {
+            curve: ndata.algorithm.curve,
+            privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
+          };
+        case '1.2.840.10040.4.1':
+          ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der');
+          return {
+            type: 'dsa',
+            params: ndata.algorithm.params
+          };
+        default: throw new Error('unknown key id ' +  subtype);
+      }
+      throw new Error('unknown key type ' +  type);
+    case 'RSA PUBLIC KEY':
+      return asn1.RSAPublicKey.decode(data, 'der');
+    case 'RSA PRIVATE KEY':
+      return asn1.RSAPrivateKey.decode(data, 'der');
+    case 'DSA PRIVATE KEY':
+      return {
+        type: 'dsa',
+        params: asn1.DSAPrivateKey.decode(data, 'der')
+      };
+    case 'EC PRIVATE KEY':
+      data = asn1.ECPrivateKey.decode(data, 'der');
+      return {
+        curve: data.parameters.value,
+        privateKey: data.privateKey
+      };
+    default: throw new Error('unknown key type ' +  type);
+  }
+}
+parseKeys.signature = asn1.signature;
+function decrypt(crypto, data, password) {
+  var salt = data.algorithm.decrypt.kde.kdeparams.salt;
+  var iters = data.algorithm.decrypt.kde.kdeparams.iters;
+  var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')];
+  var iv = data.algorithm.decrypt.cipher.iv;
+  var cipherText = data.subjectPrivateKey;
+  var keylen = parseInt(algo.split('-')[1], 10)/8;
+  var key = crypto.pbkdf2Sync(password, salt, iters, keylen);
+  var cipher = crypto.createDecipheriv(algo, key, iv);
+  var out = [];
+  out.push(cipher.update(cipherText));
+  out.push(cipher.final());
+  return Buffer.concat(out);
+}
+ +
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/prettify.css b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/prettify.css new file mode 100644 index 00000000..b317a7cd --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/prettify.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/prettify.js new file mode 100644 index 00000000..ef51e038 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov.info b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov.info new file mode 100644 index 00000000..beea3126 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/coverage/lcov.info @@ -0,0 +1,282 @@ +TN: +SF:/Users/cmetcalf/projects/parseASN1/index.js +FN:7,parseKeys +FN:88,decrypt +FNF:2 +FNH:2 +FNDA:26,parseKeys +FNDA:4,decrypt +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,1 +DA:5,1 +DA:7,1 +DA:8,26 +DA:9,26 +DA:10,7 +DA:11,7 +DA:13,26 +DA:14,0 +DA:16,26 +DA:17,7 +DA:19,26 +DA:20,26 +DA:21,26 +DA:22,26 +DA:23,26 +DA:25,11 +DA:26,11 +DA:27,11 +DA:29,5 +DA:31,2 +DA:32,2 +DA:37,4 +DA:38,4 +DA:42,0 +DA:44,0 +DA:46,4 +DA:47,4 +DA:50,6 +DA:51,6 +DA:52,6 +DA:54,3 +DA:56,1 +DA:61,2 +DA:62,2 +DA:66,0 +DA:68,0 +DA:70,2 +DA:72,4 +DA:74,2 +DA:79,1 +DA:80,1 +DA:84,0 +DA:87,1 +DA:88,1 +DA:89,4 +DA:90,4 +DA:91,4 +DA:92,4 +DA:93,4 +DA:94,4 +DA:95,4 +DA:96,4 +DA:97,4 +DA:98,4 +DA:99,4 +DA:100,4 +LF:60 +LH:54 +BRDA:9,1,0,7 +BRDA:9,1,1,19 +BRDA:9,2,0,26 +BRDA:9,2,1,26 +BRDA:13,3,0,0 +BRDA:13,3,1,26 +BRDA:16,4,0,7 +BRDA:16,4,1,19 +BRDA:23,5,0,11 +BRDA:23,5,1,4 +BRDA:23,5,2,6 +BRDA:23,5,3,2 +BRDA:23,5,4,4 +BRDA:23,5,5,2 +BRDA:23,5,6,1 +BRDA:23,5,7,0 +BRDA:27,6,0,5 +BRDA:27,6,1,2 +BRDA:27,6,2,4 +BRDA:27,6,3,0 +BRDA:52,7,0,3 +BRDA:52,7,1,1 +BRDA:52,7,2,2 +BRDA:52,7,3,0 +BRF:24 +BRH:20 +end_of_record +TN: +SF:/Users/cmetcalf/projects/parseASN1/asn1.js +FN:6,(anonymous_1) +FN:21,(anonymous_2) +FN:29,(anonymous_3) +FN:36,(anonymous_4) +FN:46,(anonymous_5) +FN:58,(anonymous_6) +FN:71,(anonymous_7) +FN:79,(anonymous_8) +FN:100,(anonymous_9) +FN:111,(anonymous_10) +FN:118,(anonymous_11) +FN:133,(anonymous_12) +FN:145,(anonymous_13) +FN:148,(anonymous_14) +FN:157,(anonymous_15) +FN:163,(anonymous_16) +FN:174,(anonymous_17) +FNF:17 +FNH:10 +FNDA:1,(anonymous_1) +FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:1,(anonymous_6) +FNDA:1,(anonymous_7) +FNDA:1,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:0,(anonymous_10) +FNDA:0,(anonymous_11) +FNDA:1,(anonymous_12) +FNDA:1,(anonymous_13) +FNDA:1,(anonymous_14) +FNDA:1,(anonymous_15) +FNDA:0,(anonymous_16) +FNDA:0,(anonymous_17) +DA:4,1 +DA:6,1 +DA:7,1 +DA:19,1 +DA:21,1 +DA:22,1 +DA:27,1 +DA:29,1 +DA:30,1 +DA:35,1 +DA:36,1 +DA:37,0 +DA:45,1 +DA:46,1 +DA:47,0 +DA:56,1 +DA:58,1 +DA:59,1 +DA:71,1 +DA:72,1 +DA:78,1 +DA:79,1 +DA:80,1 +DA:100,1 +DA:101,0 +DA:110,1 +DA:111,1 +DA:112,0 +DA:117,1 +DA:118,1 +DA:119,0 +DA:132,1 +DA:133,1 +DA:134,1 +DA:143,1 +DA:145,1 +DA:146,1 +DA:148,1 +DA:149,1 +DA:156,1 +DA:157,1 +DA:158,1 +DA:163,1 +DA:164,0 +DA:172,1 +DA:174,1 +DA:175,0 +LF:47 +LH:40 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Users/cmetcalf/projects/parseASN1/fixProc.js +FN:4,(anonymous_1) +FN:23,wrap +FNF:2 +FNH:2 +FNDA:7,(anonymous_1) +FNDA:3,wrap +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,1 +DA:5,7 +DA:6,7 +DA:7,7 +DA:8,4 +DA:10,3 +DA:11,3 +DA:12,3 +DA:13,3 +DA:14,3 +DA:15,3 +DA:16,3 +DA:17,3 +DA:18,3 +DA:19,3 +DA:20,3 +DA:23,1 +DA:24,3 +DA:25,3 +DA:26,48 +DA:27,3 +DA:28,3 +DA:31,45 +DA:32,45 +DA:35,3 +LF:28 +LH:28 +BRDA:7,1,0,4 +BRDA:7,1,1,3 +BRDA:26,2,0,3 +BRDA:26,2,1,45 +BRF:4 +BRH:4 +end_of_record +TN: +SF:/Users/cmetcalf/projects/parseASN1/EVP_BytesToKey.js +FN:2,evp +FNF:1 +FNH:1 +FNDA:3,evp +DA:2,1 +DA:3,3 +DA:4,3 +DA:5,3 +DA:6,3 +DA:7,3 +DA:8,3 +DA:9,3 +DA:10,3 +DA:11,5 +DA:12,5 +DA:13,2 +DA:15,5 +DA:16,5 +DA:17,5 +DA:18,5 +DA:19,5 +DA:20,5 +DA:21,77 +DA:22,3 +DA:24,74 +DA:25,2 +DA:27,72 +DA:28,72 +DA:31,5 +DA:32,3 +DA:35,3 +DA:36,48 +DA:38,3 +LF:29 +LH:29 +BRDA:12,1,0,2 +BRDA:12,1,1,3 +BRDA:19,2,0,5 +BRDA:19,2,1,0 +BRDA:21,3,0,3 +BRDA:21,3,1,74 +BRDA:24,4,0,2 +BRDA:24,4,1,72 +BRDA:31,5,0,3 +BRDA:31,5,1,2 +BRF:10 +BRH:9 +end_of_record diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/fixProc.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/fixProc.js new file mode 100644 index 00000000..b0a9f6dc --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/fixProc.js @@ -0,0 +1,45 @@ +// adapted from https://github.com/apatil/pemstrip +var findProc = /Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m; +var startRegex =/^-----BEGIN (.*) KEY-----\n/m; +var fullRegex = /^-----BEGIN (.*) KEY-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1 KEY-----$/m; +var evp = require('./EVP_BytesToKey'); +var ciphers = require('browserify-aes'); +module.exports = function (okey, password) { + var key = okey.toString(); + var match = key.match(findProc); + var decrypted; + if (!match) { + var match2 = key.match(fullRegex); + decrypted = new Buffer(match2[2].replace(/\n\r?/g, ''), 'base64'); + } else { + var suite = 'aes' + match[1]; + var iv = new Buffer(match[2], 'hex'); + var cipherText = new Buffer(match[3].replace(/\n\r?/g, ''), 'base64'); + var cipherKey = evp(password, iv.slice(0,8), parseInt(match[1])); + var out = []; + var cipher = ciphers.createDecipheriv(suite, cipherKey, iv); + out.push(cipher.update(cipherText)); + out.push(cipher.final()); + decrypted = Buffer.concat(out); + } + var tag = key.match(startRegex)[1] + ' KEY'; + return { + tag: tag, + data: decrypted + }; +}; +// http://stackoverflow.com/a/7033705 +function wrap(str) { + var chunks = []; + while (str) { + if (str.length < 64) { + chunks.push(str); + break; + } + else { + chunks.push(str.slice(0, 64)); + str = str.slice(64); + } + } + return chunks.join("\n"); +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/index.js new file mode 100644 index 00000000..309ac5db --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/index.js @@ -0,0 +1,101 @@ +var asn1 = require('./asn1'); +var aesid = require('./aesid.json'); +var fixProc = require('./fixProc'); +var ciphers = require('browserify-aes'); +var compat = require('pbkdf2-compat'); +module.exports = parseKeys; + +function parseKeys(buffer) { + var password; + if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) { + password = buffer.passphrase; + buffer = buffer.key; + } + if (typeof buffer === 'string') { + buffer = new Buffer(buffer); + } + + var stripped = fixProc(buffer, password); + + var type = stripped.tag; + var data = stripped.data; + var subtype,ndata; + switch (type) { + case 'PUBLIC KEY': + ndata = asn1.PublicKey.decode(data, 'der'); + subtype = ndata.algorithm.algorithm.join('.'); + switch(subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der'); + case '1.2.840.10045.2.1': + ndata.subjectPrivateKey = ndata.subjectPublicKey; + return { + type: 'ec', + data: ndata + }; + case '1.2.840.10040.4.1': + ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der'); + return { + type: 'dsa', + data: ndata.algorithm.params + }; + default: throw new Error('unknown key id ' + subtype); + } + throw new Error('unknown key type ' + type); + case 'ENCRYPTED PRIVATE KEY': + data = asn1.EncryptedPrivateKey.decode(data, 'der'); + data = decrypt(data, password); + //falling through + case 'PRIVATE KEY': + ndata = asn1.PrivateKey.decode(data, 'der'); + subtype = ndata.algorithm.algorithm.join('.'); + switch(subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der'); + case '1.2.840.10045.2.1': + return { + curve: ndata.algorithm.curve, + privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey + }; + case '1.2.840.10040.4.1': + ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der'); + return { + type: 'dsa', + params: ndata.algorithm.params + }; + default: throw new Error('unknown key id ' + subtype); + } + throw new Error('unknown key type ' + type); + case 'RSA PUBLIC KEY': + return asn1.RSAPublicKey.decode(data, 'der'); + case 'RSA PRIVATE KEY': + return asn1.RSAPrivateKey.decode(data, 'der'); + case 'DSA PRIVATE KEY': + return { + type: 'dsa', + params: asn1.DSAPrivateKey.decode(data, 'der') + }; + case 'EC PRIVATE KEY': + data = asn1.ECPrivateKey.decode(data, 'der'); + return { + curve: data.parameters.value, + privateKey: data.privateKey + }; + default: throw new Error('unknown key type ' + type); + } +} +parseKeys.signature = asn1.signature; +function decrypt(data, password) { + var salt = data.algorithm.decrypt.kde.kdeparams.salt; + var iters = data.algorithm.decrypt.kde.kdeparams.iters; + var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]; + var iv = data.algorithm.decrypt.cipher.iv; + var cipherText = data.subjectPrivateKey; + var keylen = parseInt(algo.split('-')[1], 10)/8; + var key = compat.pbkdf2Sync(password, salt, iters, keylen); + var cipher = ciphers.createDecipheriv(algo, key, iv); + var out = []; + out.push(cipher.update(cipherText)); + out.push(cipher.final()); + return Buffer.concat(out); +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/.npmignore b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/.npmignore new file mode 100644 index 00000000..1ca95717 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/README.md b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/README.md new file mode 100644 index 00000000..0c571b80 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/README.md @@ -0,0 +1,100 @@ +# ASN1.js + +ASN.1 DER Encoder/Decoder and DSL. + +## Example + +Define model: + +```javascript +var asn = require('asn1.js'); + +var Human = asn.define('Human', function() { + this.seq().obj( + this.key('firstName').octstr(), + this.key('lastName').octstr(), + this.key('age').int(), + this.key('gender').enum({ 0: 'male', 1: 'female' }), + this.key('bio').seqof(Bio) + ); +}); + +var Bio = asn.define('Bio', function() { + this.seq().obj( + this.key('time').gentime(), + this.key('description').octstr() + ); +}); +``` + +Encode data: + +```javascript +var output = Human.encode({ + firstName: 'Thomas', + lastName: 'Anderson', + age: 28, + gender: 'male', + bio: [ + { + time: +new Date('31 March 1999'), + description: 'freedom of mind' + } + ] +}, 'der'); +``` + +Decode data: + +```javascript +var human = Human.decode(output, 'der'); +console.log(human); +/* +{ firstName: , + lastName: , + age: 28, + gender: 'male', + bio: + [ { time: 922820400000, + description: } ] } +*/ +``` + +### Partial decode + +Its possible to parse data without stopping on first error. In order to do it, +you should call: + +```javascript +var human = Human.decode(output, 'der', { partial: true }); +console.log(human); +/* +{ result: { ... }, + errors: [ ... ] } +*/ +``` + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2013. + +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/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js new file mode 100644 index 00000000..02bbdc1d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js @@ -0,0 +1,9 @@ +var asn1 = exports; + +asn1.bignum = require('bn.js'); + +asn1.define = require('./asn1/api').define; +asn1.base = require('./asn1/base'); +asn1.constants = require('./asn1/constants'); +asn1.decoders = require('./asn1/decoders'); +asn1.encoders = require('./asn1/encoders'); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/api.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/api.js new file mode 100644 index 00000000..0e8a2018 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/api.js @@ -0,0 +1,59 @@ +var asn1 = require('../asn1'); +var inherits = require('inherits'); + +var api = exports; + +api.define = function define(name, body) { + return new Entity(name, body); +}; + +function Entity(name, body) { + this.name = name; + this.body = body; + + this.decoders = {}; + this.encoders = {}; +}; + +Entity.prototype._createNamed = function createNamed(base) { + var named; + try { + named = require('vm').runInThisContext( + '(function ' + this.name + '(entity) {\n' + + ' this._initNamed(entity);\n' + + '})' + ); + } catch (e) { + named = function (entity) { + this._initNamed(entity); + }; + } + inherits(named, base); + named.prototype._initNamed = function initnamed(entity) { + base.call(this, entity); + }; + + return new named(this); +}; + +Entity.prototype._getDecoder = function _getDecoder(enc) { + // Lazily create decoder + if (!this.decoders.hasOwnProperty(enc)) + this.decoders[enc] = this._createNamed(asn1.decoders[enc]); + return this.decoders[enc]; +}; + +Entity.prototype.decode = function decode(data, enc, options) { + return this._getDecoder(enc).decode(data, options); +}; + +Entity.prototype._getEncoder = function _getEncoder(enc) { + // Lazily create encoder + if (!this.encoders.hasOwnProperty(enc)) + this.encoders[enc] = this._createNamed(asn1.encoders[enc]); + return this.encoders[enc]; +}; + +Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) { + return this._getEncoder(enc).encode(data, reporter); +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/buffer.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/buffer.js new file mode 100644 index 00000000..7b1152f2 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/buffer.js @@ -0,0 +1,115 @@ +var inherits = require('inherits'); +var Reporter = require('../base').Reporter; +var Buffer = require('buffer').Buffer; + +function DecoderBuffer(base, options) { + Reporter.call(this, options); + if (!Buffer.isBuffer(base)) { + this.error('Input not Buffer'); + return; + } + + this.base = base; + this.offset = 0; + this.length = base.length; +} +inherits(DecoderBuffer, Reporter); +exports.DecoderBuffer = DecoderBuffer; + +DecoderBuffer.prototype.save = function save() { + return { offset: this.offset }; +}; + +DecoderBuffer.prototype.restore = function restore(save) { + // Return skipped data + var res = new DecoderBuffer(this.base); + res.offset = save.offset; + res.length = this.offset; + + this.offset = save.offset; + + return res; +}; + +DecoderBuffer.prototype.isEmpty = function isEmpty() { + return this.offset === this.length; +}; + +DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) { + if (this.offset + 1 <= this.length) + return this.base.readUInt8(this.offset++, true); + else + return this.error(fail || 'DecoderBuffer overrun'); +} + +DecoderBuffer.prototype.skip = function skip(bytes, fail) { + if (!(this.offset + bytes <= this.length)) + return this.error(fail || 'DecoderBuffer overrun'); + + var res = new DecoderBuffer(this.base); + + // Share reporter state + res._reporterState = this._reporterState; + + res.offset = this.offset; + res.length = this.offset + bytes; + this.offset += bytes; + return res; +} + +DecoderBuffer.prototype.raw = function raw(save) { + return this.base.slice(save ? save.offset : this.offset, this.length); +} + +function EncoderBuffer(value, reporter) { + if (Array.isArray(value)) { + this.length = 0; + this.value = value.map(function(item) { + if (!(item instanceof EncoderBuffer)) + item = new EncoderBuffer(item, reporter); + this.length += item.length; + return item; + }, this); + } else if (typeof value === 'number') { + if (!(0 <= value && value <= 0xff)) + return reporter.error('non-byte EncoderBuffer value'); + this.value = value; + this.length = 1; + } else if (typeof value === 'string') { + this.value = value; + this.length = Buffer.byteLength(value); + } else if (Buffer.isBuffer(value)) { + this.value = value; + this.length = value.length; + } else { + return reporter.error('Unsupported type: ' + typeof value); + } +} +exports.EncoderBuffer = EncoderBuffer; + +EncoderBuffer.prototype.join = function join(out, offset) { + if (!out) + out = new Buffer(this.length); + if (!offset) + offset = 0; + + if (this.length === 0) + return out; + + if (Array.isArray(this.value)) { + this.value.forEach(function(item) { + item.join(out, offset); + offset += item.length; + }); + } else { + if (typeof this.value === 'number') + out[offset] = this.value; + else if (typeof this.value === 'string') + out.write(this.value, offset); + else if (Buffer.isBuffer(this.value)) + this.value.copy(out, offset); + offset += this.length; + } + + return out; +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/index.js new file mode 100644 index 00000000..935abde0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/index.js @@ -0,0 +1,6 @@ +var base = exports; + +base.Reporter = require('./reporter').Reporter; +base.DecoderBuffer = require('./buffer').DecoderBuffer; +base.EncoderBuffer = require('./buffer').EncoderBuffer; +base.Node = require('./node'); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/node.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/node.js new file mode 100644 index 00000000..9c03beb5 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/node.js @@ -0,0 +1,575 @@ +var Reporter = require('../base').Reporter; +var EncoderBuffer = require('../base').EncoderBuffer; +var assert = require('minimalistic-assert'); + +// Supported tags +var tags = [ + 'seq', 'seqof', 'set', 'setof', 'octstr', 'bitstr', 'objid', 'bool', + 'gentime', 'utctime', 'null_', 'enum', 'int', 'ia5str' +]; + +// Public methods list +var methods = [ + 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice', + 'any' +].concat(tags); + +// Overrided methods list +var overrided = [ + '_peekTag', '_decodeTag', '_use', + '_decodeStr', '_decodeObjid', '_decodeTime', + '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList', + + '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime', + '_encodeNull', '_encodeInt', '_encodeBool' +]; + +function Node(enc, parent) { + var state = {}; + this._baseState = state; + + state.enc = enc; + + state.parent = parent || null; + state.children = null; + + // State + state.tag = null; + state.args = null; + state.reverseArgs = null; + state.choice = null; + state.optional = false; + state.any = false; + state.obj = false; + state.use = null; + state.useDecoder = null; + state.key = null; + state['default'] = null; + state.explicit = null; + state.implicit = null; + + // Should create new instance on each method + if (!state.parent) { + state.children = []; + this._wrap(); + } +} +module.exports = Node; + +var stateProps = [ + 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice', + 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', + 'implicit' +]; + +Node.prototype.clone = function clone() { + var state = this._baseState; + var cstate = {}; + stateProps.forEach(function(prop) { + cstate[prop] = state[prop]; + }); + var res = new this.constructor(cstate.parent); + res._baseState = cstate; + return res; +}; + +Node.prototype._wrap = function wrap() { + var state = this._baseState; + methods.forEach(function(method) { + this[method] = function _wrappedMethod() { + var clone = new this.constructor(this); + state.children.push(clone); + return clone[method].apply(clone, arguments); + }; + }, this); +}; + +Node.prototype._init = function init(body) { + var state = this._baseState; + + assert(state.parent === null); + body.call(this); + + // Filter children + state.children = state.children.filter(function(child) { + return child._baseState.parent === this; + }, this); + assert.equal(state.children.length, 1, 'Root node can have only one child'); +}; + +Node.prototype._useArgs = function useArgs(args) { + var state = this._baseState; + + // Filter children and args + var children = args.filter(function(arg) { + return arg instanceof this.constructor; + }, this); + args = args.filter(function(arg) { + return !(arg instanceof this.constructor); + }, this); + + if (children.length !== 0) { + assert(state.children === null); + state.children = children; + + // Replace parent to maintain backward link + children.forEach(function(child) { + child._baseState.parent = this; + }, this); + } + if (args.length !== 0) { + assert(state.args === null); + state.args = args; + state.reverseArgs = args.map(function(arg) { + if (typeof arg !== 'object' || arg.constructor !== Object) + return arg; + + var res = {}; + Object.keys(arg).forEach(function(key) { + if (key == (key | 0)) + key |= 0; + var value = arg[key]; + res[value] = key; + }); + return res; + }); + } +}; + +// +// Overrided methods +// + +overrided.forEach(function(method) { + Node.prototype[method] = function _overrided() { + var state = this._baseState; + throw new Error(method + ' not implemented for encoding: ' + state.enc); + }; +}); + +// +// Public methods +// + +tags.forEach(function(tag) { + Node.prototype[tag] = function _tagMethod() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + assert(state.tag === null); + state.tag = tag; + + this._useArgs(args); + + return this; + }; +}); + +Node.prototype.use = function use(item) { + var state = this._baseState; + + assert(state.use === null); + state.use = item; + + return this; +}; + +Node.prototype.optional = function optional() { + var state = this._baseState; + + state.optional = true; + + return this; +}; + +Node.prototype.def = function def(val) { + var state = this._baseState; + + assert(state['default'] === null); + state['default'] = val; + state.optional = true; + + return this; +}; + +Node.prototype.explicit = function explicit(num) { + var state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.explicit = num; + + return this; +}; + +Node.prototype.implicit = function implicit(num) { + var state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.implicit = num; + + return this; +}; + +Node.prototype.obj = function obj() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + state.obj = true; + + if (args.length !== 0) + this._useArgs(args); + + return this; +}; + +Node.prototype.key = function key(newKey) { + var state = this._baseState; + + assert(state.key === null); + state.key = newKey; + + return this; +}; + +Node.prototype.any = function any() { + var state = this._baseState; + + state.any = true; + + return this; +}; + +Node.prototype.choice = function choice(obj) { + var state = this._baseState; + + assert(state.choice === null); + state.choice = obj; + this._useArgs(Object.keys(obj).map(function(key) { + return obj[key]; + })); + + return this; +}; + +// +// Decoding +// + +Node.prototype._decode = function decode(input) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return input.wrapResult(state.children[0]._decode(input)); + + var result = state['default']; + var present = true; + + var prevKey; + if (state.key !== null) + prevKey = input.enterKey(state.key); + + // Check if tag is there + if (state.optional) { + present = this._peekTag( + input, + state.explicit !== null ? state.explicit : + state.implicit !== null ? state.implicit : + state.tag || 0 + ); + if (input.isError(present)) + return present; + } + + // Push object on stack + var prevObj; + if (state.obj && present) + prevObj = input.enterObject(); + + if (present) { + // Unwrap explicit values + if (state.explicit !== null) { + var explicit = this._decodeTag(input, state.explicit); + if (input.isError(explicit)) + return explicit; + input = explicit; + } + + // Unwrap implicit and normal values + if (state.use === null && state.choice === null) { + if (state.any) + var save = input.save(); + var body = this._decodeTag( + input, + state.implicit !== null ? state.implicit : state.tag, + state.any + ); + if (input.isError(body)) + return body; + + if (state.any) + result = input.raw(save); + else + input = body; + } + + // Select proper method for tag + if (state.any) + result = result; + else if (state.choice === null) + result = this._decodeGeneric(state.tag, input); + else + result = this._decodeChoice(input); + + if (input.isError(result)) + return result; + + // Decode children + if (!state.any && state.choice === null && state.children !== null) { + var fail = state.children.some(function decodeChildren(child) { + // NOTE: We are ignoring errors here, to let parser continue with other + // parts of encoded data + child._decode(input); + }); + if (fail) + return err; + } + } + + // Pop object + if (state.obj && present) + result = input.leaveObject(prevObj); + + // Set key + if (state.key !== null && (result !== null || present === true)) + input.leaveKey(prevKey, state.key, result); + + return result; +}; + +Node.prototype._decodeGeneric = function decodeGeneric(tag, input) { + var state = this._baseState; + + if (tag === 'seq' || tag === 'set') + return null; + if (tag === 'seqof' || tag === 'setof') + return this._decodeList(input, tag, state.args[0]); + else if (tag === 'octstr' || tag === 'bitstr' || tag === 'ia5str') + return this._decodeStr(input, tag); + else if (tag === 'objid' && state.args) + return this._decodeObjid(input, state.args[0], state.args[1]); + else if (tag === 'objid') + return this._decodeObjid(input, null, null); + else if (tag === 'gentime' || tag === 'utctime') + return this._decodeTime(input, tag); + else if (tag === 'null_') + return this._decodeNull(input); + else if (tag === 'bool') + return this._decodeBool(input); + else if (tag === 'int' || tag === 'enum') + return this._decodeInt(input, state.args && state.args[0]); + else if (state.use !== null) + return this._getUse(state.use, input._reporterState.obj)._decode(input); + else + return input.error('unknown tag: ' + tag); + + return null; +}; + +Node.prototype._getUse = function _getUse(entity, obj) { + + var state = this._baseState; + // Create altered use decoder if implicit is set + state.useDecoder = this._use(entity, obj); + assert(state.useDecoder._baseState.parent === null); + state.useDecoder = state.useDecoder._baseState.children[0]; + if (state.implicit !== state.useDecoder._baseState.implicit) { + state.useDecoder = state.useDecoder.clone(); + state.useDecoder._baseState.implicit = state.implicit; + } + return state.useDecoder; +}; + +Node.prototype._decodeChoice = function decodeChoice(input) { + var state = this._baseState; + var result = null; + var match = false; + + Object.keys(state.choice).some(function(key) { + var save = input.save(); + var node = state.choice[key]; + try { + var value = node._decode(input); + if (input.isError(value)) + return false; + + result = { type: key, value: value }; + match = true; + } catch (e) { + input.restore(save); + return false; + } + return true; + }, this); + + if (!match) + return input.error('Choice not matched'); + + return result; +}; + +// +// Encoding +// + +Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) { + return new EncoderBuffer(data, this.reporter); +}; + +Node.prototype._encode = function encode(data, reporter, parent) { + var state = this._baseState; + if (state['default'] !== null && state['default'] === data) + return; + + var result = this._encodeValue(data, reporter, parent); + if (result === undefined) + return; + + if (this._skipDefault(result, reporter, parent)) + return; + + return result; +}; + +Node.prototype._encodeValue = function encode(data, reporter, parent) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return state.children[0]._encode(data, reporter || new Reporter()); + + var result = null; + var present = true; + + // Set reporter to share it with a child class + this.reporter = reporter; + + // Check if data is there + if (state.optional && data === undefined) { + if (state['default'] !== null) + data = state['default'] + else + return; + } + + // For error reporting + var prevKey; + + // Encode children first + var content = null; + var primitive = false; + if (state.any) { + // Anything that was given is translated to buffer + result = this._createEncoderBuffer(data); + } else if (state.choice) { + result = this._encodeChoice(data, reporter); + } else if (state.children) { + content = state.children.map(function(child) { + if (child._baseState.tag === 'null_') + return child._encode(null, reporter, data); + + if (child._baseState.key === null) + return reporter.error('Child should have a key'); + var prevKey = reporter.enterKey(child._baseState.key); + + if (typeof data !== 'object') + return reporter.error('Child expected, but input is not object'); + + var res = child._encode(data[child._baseState.key], reporter, data); + reporter.leaveKey(prevKey); + + return res; + }, this).filter(function(child) { + return child; + }); + + content = this._createEncoderBuffer(content); + } else { + if (state.tag === 'seqof' || state.tag === 'setof') { + // TODO(indutny): this should be thrown on DSL level + if (!(state.args && state.args.length === 1)) + return reporter.error('Too many args for : ' + state.tag); + + if (!Array.isArray(data)) + return reporter.error('seqof/setof, but data is not Array'); + + var child = this.clone(); + child._baseState.implicit = null; + content = this._createEncoderBuffer(data.map(function(item) { + var state = this._baseState; + + return this._getUse(state.args[0], data)._encode(item, reporter); + }, child)); + } else if (state.use !== null) { + result = this._getUse(state.use, parent)._encode(data, reporter); + } else { + content = this._encodePrimitive(state.tag, data); + primitive = true; + } + } + + // Encode data itself + var result; + if (!state.any && state.choice === null) { + var tag = state.implicit !== null ? state.implicit : state.tag; + var cls = state.implicit === null ? 'universal' : 'context'; + + if (tag === null) { + if (state.use === null) + reporter.error('Tag could be ommited only for .use()'); + } else { + if (state.use === null) + result = this._encodeComposite(tag, primitive, cls, content); + } + } + + // Wrap in explicit + if (state.explicit !== null) + result = this._encodeComposite(state.explicit, false, 'context', result); + + return result; +}; + +Node.prototype._encodeChoice = function encodeChoice(data, reporter) { + var state = this._baseState; + + var node = state.choice[data.type]; + if (!node) { + assert( + false, + data.type + ' not found in ' + + JSON.stringify(Object.keys(state.choice))); + } + return node._encode(data.value, reporter); +}; + +Node.prototype._encodePrimitive = function encodePrimitive(tag, data) { + var state = this._baseState; + + if (tag === 'octstr' || tag === 'bitstr' || tag === 'ia5str') + return this._encodeStr(data, tag); + else if (tag === 'objid' && state.args) + return this._encodeObjid(data, state.reverseArgs[0], state.args[1]); + else if (tag === 'objid') + return this._encodeObjid(data, null, null); + else if (tag === 'gentime' || tag === 'utctime') + return this._encodeTime(data, tag); + else if (tag === 'null_') + return this._encodeNull(); + else if (tag === 'int' || tag === 'enum') + return this._encodeInt(data, state.args && state.reverseArgs[0]); + else if (tag === 'bool') + return this._encodeBool(data); + else + throw new Error('Unsupported tag: ' + tag); +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/reporter.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/reporter.js new file mode 100644 index 00000000..7f021907 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/reporter.js @@ -0,0 +1,89 @@ +var inherits = require('inherits'); + +function Reporter(options) { + this._reporterState = { + obj: null, + path: [], + options: options || {}, + errors: [] + }; +} +exports.Reporter = Reporter; + +Reporter.prototype.isError = function isError(obj) { + return obj instanceof ReporterError; +}; + +Reporter.prototype.enterKey = function enterKey(key) { + return this._reporterState.path.push(key); +}; + +Reporter.prototype.leaveKey = function leaveKey(index, key, value) { + var state = this._reporterState; + + state.path = state.path.slice(0, index - 1); + if (state.obj !== null) + state.obj[key] = value; +}; + +Reporter.prototype.enterObject = function enterObject() { + var state = this._reporterState; + + var prev = state.obj; + state.obj = {}; + return prev; +}; + +Reporter.prototype.leaveObject = function leaveObject(prev) { + var state = this._reporterState; + + var now = state.obj; + state.obj = prev; + return now; +}; + +Reporter.prototype.error = function error(msg) { + var err; + var state = this._reporterState; + + var inherited = msg instanceof ReporterError; + if (inherited) { + err = msg; + } else { + err = new ReporterError(state.path.map(function(elem) { + return '[' + JSON.stringify(elem) + ']'; + }).join(''), msg.message || msg, msg.stack); + } + + if (!state.options.partial) + throw err; + + if (!inherited) + state.errors.push(err); + + return err; +}; + +Reporter.prototype.wrapResult = function wrapResult(result) { + var state = this._reporterState; + if (!state.options.partial) + return result; + + return { + result: this.isError(result) ? null : result, + errors: state.errors + }; +}; + +function ReporterError(path, msg) { + this.path = path; + this.rethrow(msg); +}; +inherits(ReporterError, Error); + +ReporterError.prototype.rethrow = function rethrow(msg) { + this.message = msg + ' at: ' + (this.path || '(shallow)'); + Error.captureStackTrace(this, ReporterError); + + return this; +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/der.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/der.js new file mode 100644 index 00000000..907dd397 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/der.js @@ -0,0 +1,42 @@ +var constants = require('../constants'); + +exports.tagClass = { + 0: 'universal', + 1: 'application', + 2: 'context', + 3: 'private' +}; +exports.tagClassByName = constants._reverse(exports.tagClass); + +exports.tag = { + 0x00: 'end', + 0x01: 'bool', + 0x02: 'int', + 0x03: 'bitstr', + 0x04: 'octstr', + 0x05: 'null_', + 0x06: 'objid', + 0x07: 'objDesc', + 0x08: 'external', + 0x09: 'real', + 0x0a: 'enum', + 0x0b: 'embed', + 0x0c: 'utf8str', + 0x0d: 'relativeOid', + 0x10: 'seq', + 0x11: 'set', + 0x12: 'numstr', + 0x13: 'printstr', + 0x14: 't61str', + 0x15: 'videostr', + 0x16: 'ia5str', + 0x17: 'utctime', + 0x18: 'gentime', + 0x19: 'graphstr', + 0x1a: 'iso646str', + 0x1b: 'genstr', + 0x1c: 'unistr', + 0x1d: 'charstr', + 0x1e: 'bmpstr' +}; +exports.tagByName = constants._reverse(exports.tag); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/index.js new file mode 100644 index 00000000..c44e3251 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/index.js @@ -0,0 +1,19 @@ +var constants = exports; + +// Helper +constants._reverse = function reverse(map) { + var res = {}; + + Object.keys(map).forEach(function(key) { + // Convert key to integer if it is stringified + if ((key | 0) == key) + key = key | 0; + + var value = map[key]; + res[value] = key; + }); + + return res; +}; + +constants.der = require('./der'); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/der.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/der.js new file mode 100644 index 00000000..559600d3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/der.js @@ -0,0 +1,300 @@ +var inherits = require('inherits'); + +var asn1 = require('../../asn1'); +var base = asn1.base; +var bignum = asn1.bignum; + +// Import DER constants +var der = asn1.constants.der; + +function DERDecoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +}; +module.exports = DERDecoder; + +DERDecoder.prototype.decode = function decode(data, options) { + if (!(data instanceof base.DecoderBuffer)) + data = new base.DecoderBuffer(data, options); + + return this.tree._decode(data, options); +}; + +// Tree methods + +function DERNode(parent) { + base.Node.call(this, 'der', parent); +} +inherits(DERNode, base.Node); + +DERNode.prototype._peekTag = function peekTag(buffer, tag) { + if (buffer.isEmpty()) + return false; + + var state = buffer.save(); + var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + buffer.restore(state); + + return decodedTag.tag === tag || decodedTag.tagStr === tag; +}; + +DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) { + var decodedTag = derDecodeTag(buffer, + 'Failed to decode tag of "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + var len = derDecodeLen(buffer, + decodedTag.primitive, + 'Failed to get length of "' + tag + '"'); + + // Failure + if (buffer.isError(len)) + return len; + + if (!any && + decodedTag.tag !== tag && + decodedTag.tagStr !== tag && + decodedTag.tagStr + 'of' !== tag) { + return buffer.error('Failed to match tag: "' + tag + '"'); + } + + if (decodedTag.primitive || len !== null) + return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); + + // Indefinite length... find END tag + var state = buffer.start(); + var res = this._skipUntilEnd( + buffer, + 'Failed to skip indefinite length body: "' + this.tag + '"'); + if (buffer.isError(res)) + return res; + + return buffer.cut(state); +}; + +DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) { + while (true) { + var tag = derDecodeTag(buffer, fail); + if (buffer.isError(tag)) + return tag; + var len = derDecodeLen(buffer, tag.primitive, fail); + if (buffer.isError(len)) + return len; + + var res; + if (tag.primitive || len !== null) + res = buffer.skip(len) + else + res = this._skipUntilEnd(buffer, fail); + + // Failure + if (buffer.isError(res)) + return res; + + if (tag.tagStr === 'end') + break; + } +}; + +DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder) { + var result = []; + while (!buffer.isEmpty()) { + var possibleEnd = this._peekTag(buffer, 'end'); + if (buffer.isError(possibleEnd)) + return possibleEnd; + + var res = decoder.decode(buffer, 'der'); + if (buffer.isError(res) && possibleEnd) + break; + result.push(res); + } + return result; +}; + +DERNode.prototype._decodeStr = function decodeStr(buffer, tag) { + if (tag === 'octstr') { + return buffer.raw(); + } else if (tag === 'bitstr') { + var unused = buffer.readUInt8(); + if (buffer.isError(unused)) + return unused; + + return { unused: unused, data: buffer.raw() }; + } else if (tag === 'ia5str') { + return buffer.raw().toString(); + } else { + return this.error('Decoding of string type: ' + tag + ' unsupported'); + } +}; + +DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) { + var identifiers = []; + var ident = 0; + while (!buffer.isEmpty()) { + var subident = buffer.readUInt8(); + ident <<= 7; + ident |= subident & 0x7f; + if ((subident & 0x80) === 0) { + identifiers.push(ident); + ident = 0; + } + } + if (subident & 0x80) + identifiers.push(ident); + + var first = (identifiers[0] / 40) | 0; + var second = identifiers[0] % 40; + + if (relative) + result = identifiers; + else + result = [first, second].concat(identifiers.slice(1)); + + if (values) + result = values[result.join(' ')]; + + return result; +}; + +DERNode.prototype._decodeTime = function decodeTime(buffer, tag) { + var str = buffer.raw().toString(); + if (tag === 'gentime') { + var year = str.slice(0, 4) | 0; + var mon = str.slice(4, 6) | 0; + var day = str.slice(6, 8) | 0; + var hour = str.slice(8, 10) | 0; + var min = str.slice(10, 12) | 0; + var sec = str.slice(12, 14) | 0; + } else if (tag === 'utctime') { + var year = str.slice(0, 2) | 0; + var mon = str.slice(2, 4) | 0; + var day = str.slice(4, 6) | 0; + var hour = str.slice(6, 8) | 0; + var min = str.slice(8, 10) | 0; + var sec = str.slice(10, 12) | 0; + if (year < 70) + year = 2000 + year; + else + year = 1900 + year; + } else { + return this.error('Decoding ' + tag + ' time is not supported yet'); + } + + return Date.UTC(year, mon - 1, day, hour, min, sec, 0); +}; + +DERNode.prototype._decodeNull = function decodeNull(buffer) { + return null; +}; + +DERNode.prototype._decodeBool = function decodeBool(buffer) { + var res = buffer.readUInt8(); + if (buffer.isError(res)) + return res; + else + return res !== 0; +}; + +DERNode.prototype._decodeInt = function decodeInt(buffer, values) { + var res = 0; + + // Bigint, return as it is (assume big endian) + var raw = buffer.raw(); + if (raw.length > 3) + return new bignum(raw); + + while (!buffer.isEmpty()) { + res <<= 8; + var i = buffer.readUInt8(); + if (buffer.isError(i)) + return i; + res |= i; + } + + if (values) + res = values[res] || res; + + return res; +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getDecoder('der').tree; +}; + +// Utility methods + +function derDecodeTag(buf, fail) { + var tag = buf.readUInt8(fail); + if (buf.isError(tag)) + return tag; + + var cls = der.tagClass[tag >> 6]; + var primitive = (tag & 0x20) === 0; + + // Multi-octet tag - load + if ((tag & 0x1f) === 0x1f) { + var oct = tag; + tag = 0; + while ((oct & 0x80) === 0x80) { + oct = buf.readUInt8(fail); + if (buf.isError(oct)) + return oct; + + tag <<= 7; + tag |= oct & 0x7f; + } + } else { + tag &= 0x1f; + } + var tagStr = der.tag[tag]; + + return { + cls: cls, + primitive: primitive, + tag: tag, + tagStr: tagStr + }; +} + +function derDecodeLen(buf, primitive, fail) { + var len = buf.readUInt8(fail); + if (buf.isError(len)) + return len; + + // Indefinite form + if (!primitive && len === 0x80) + return null; + + // Definite form + if ((len & 0x80) === 0) { + // Short form + return len; + } + + // Long form + var num = len & 0x7f; + if (num >= 4) + return buf.error('length octect is too long'); + + len = 0; + for (var i = 0; i < num; i++) { + len <<= 8; + var j = buf.readUInt8(fail); + if (buf.isError(j)) + return j; + len |= j; + } + + return len; +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/index.js new file mode 100644 index 00000000..7f431cad --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/index.js @@ -0,0 +1,3 @@ +var decoders = exports; + +decoders.der = require('./der'); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js new file mode 100644 index 00000000..68ad4abe --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js @@ -0,0 +1,270 @@ +var inherits = require('inherits'); +var Buffer = require('buffer').Buffer; + +var asn1 = require('../../asn1'); +var base = asn1.base; +var bignum = asn1.bignum; + +// Import DER constants +var der = asn1.constants.der; + +function DEREncoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +}; +module.exports = DEREncoder; + +DEREncoder.prototype.encode = function encode(data, reporter) { + return this.tree._encode(data, reporter).join(); +}; + +// Tree methods + +function DERNode(parent) { + base.Node.call(this, 'der', parent); +} +inherits(DERNode, base.Node); + +DERNode.prototype._encodeComposite = function encodeComposite(tag, + primitive, + cls, + content) { + var encodedTag = encodeTag(tag, primitive, cls, this.reporter); + + // Short form + if (content.length < 0x80) { + var header = new Buffer(2); + header[0] = encodedTag; + header[1] = content.length; + return this._createEncoderBuffer([ header, content ]); + } + + // Long form + // Count octets required to store length + var lenOctets = 1; + for (var i = content.length; i >= 0x100; i >>= 8) + lenOctets++; + + var header = new Buffer(1 + 1 + lenOctets); + header[0] = encodedTag; + header[1] = 0x80 | lenOctets; + + for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) + header[i] = j & 0xff; + + return this._createEncoderBuffer([ header, content ]); +}; + +DERNode.prototype._encodeStr = function encodeStr(str, tag) { + if (tag === 'octstr') + return this._createEncoderBuffer(str); + else if (tag === 'bitstr') + return this._createEncoderBuffer([ str.unused | 0, str.data ]); + else if (tag === 'ia5str') + return this._createEncoderBuffer(str); + return this.reporter.error('Encoding of string type: ' + tag + + ' unsupported'); +}; + +DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) { + if (typeof id === 'string') { + if (!values) + return this.reporter.error('string objid given, but no values map found'); + if (!values.hasOwnProperty(id)) + return this.reporter.error('objid not found in values map'); + id = values[id].split(/\s+/g); + for (var i = 0; i < id.length; i++) + id[i] |= 0; + } else if (Array.isArray(id)) { + id = id.slice(); + } + + if (!Array.isArray(id)) { + return this.reporter.error('objid() should be either array or string, ' + + 'got: ' + JSON.stringify(id)); + } + + if (!relative) { + if (id[1] >= 40) + return this.reporter.error('Second objid identifier OOB'); + id.splice(0, 2, id[0] * 40 + id[1]); + } + + // Count number of octets + var size = 0; + for (var i = 0; i < id.length; i++) { + var ident = id[i]; + for (size++; ident >= 0x80; ident >>= 7) + size++; + } + + var objid = new Buffer(size); + var offset = objid.length - 1; + for (var i = id.length - 1; i >= 0; i--) { + var ident = id[i]; + objid[offset--] = ident & 0x7f; + while ((ident >>= 7) > 0) + objid[offset--] = 0x80 | (ident & 0x7f); + } + + return this._createEncoderBuffer(objid); +}; + +function two(num) { + if (num <= 10) + return '0' + num; + else + return num; +} + +DERNode.prototype._encodeTime = function encodeTime(time, tag) { + var str; + var date = new Date(time); + + if (tag === 'gentime') { + str = [ + date.getFullYear(), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else if (tag === 'utctime') { + str = [ + date.getFullYear() % 100, + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else { + this.reporter.error('Encoding ' + tag + ' time is not supported yet'); + } + + return this._encodeStr(str, 'octstr'); +}; + +DERNode.prototype._encodeNull = function encodeNull() { + return this._createEncoderBuffer(''); +}; + +DERNode.prototype._encodeInt = function encodeInt(num, values) { + if (typeof num === 'string') { + if (!values) + return this.reporter.error('String int or enum given, but no values map'); + if (!values.hasOwnProperty(num)) { + return this.reporter.error('Values map doesn\'t contain: ' + + JSON.stringify(num)); + } + num = values[num]; + } + + // Bignum, assume big endian + if (bignum !== null && num instanceof bignum) { + var numArray = num.toArray(); + if(num.sign === false && numArray[0] & 0x80) { + numArray.unshift(0); + } + num = new Buffer(numArray); + } + + if (Buffer.isBuffer(num)) { + var size = num.length; + if (num.length === 0) + size++; + + var out = new Buffer(size); + num.copy(out); + if (num.length === 0) + out[0] = 0 + return this._createEncoderBuffer(out); + } + + if (num < 0x80) + return this._createEncoderBuffer(num); + + if (num < 0x100) + return this._createEncoderBuffer([0, num]); + + var size = 1; + for (var i = num; i >= 0x100; i >>= 8) + size++; + + var out = new Array(size); + for (var i = out.length - 1; i >= 0; i--) { + out[i] = num & 0xff; + num >>= 8; + } + if(out[0] & 0x80) { + out.unshift(0); + } + + return this._createEncoderBuffer(new Buffer(out)); +}; + +DERNode.prototype._encodeBool = function encodeBool(value) { + return this._createEncoderBuffer(value ? 0xff : 0); +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getEncoder('der').tree; +}; + +DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) { + var state = this._baseState; + var i; + if (state['default'] === null) + return false; + + var data = dataBuffer.join(); + if (state.defaultBuffer === undefined) + state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join(); + + if (data.length !== state.defaultBuffer.length) + return false; + + for (i=0; i < data.length; i++) + if (data[i] !== state.defaultBuffer[i]) + return false; + + return true; +}; + +// Utility methods + +function encodeTag(tag, primitive, cls, reporter) { + var res; + + if (tag === 'seqof') + tag = 'seq'; + else if (tag === 'setof') + tag = 'set'; + + if (der.tagByName.hasOwnProperty(tag)) + res = der.tagByName[tag]; + else if (typeof tag === 'number' && (tag | 0) === tag) + res = tag; + else + return reporter.error('Unknown tag: ' + tag); + + if (res >= 0x1f) + return reporter.error('Multi-octet tag encoding unsupported'); + + if (!primitive) + res |= 0x20; + + res |= (der.tagClassByName[cls || 'universal'] << 6); + + return res; +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/index.js new file mode 100644 index 00000000..5b3cc38b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/index.js @@ -0,0 +1,3 @@ +var encoders = exports; + +encoders.der = require('./der'); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/index.js new file mode 100644 index 00000000..70b4ea5b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/index.js @@ -0,0 +1,11 @@ +module.exports = assert; + +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} + +assert.equal = function assertEqual(l, r, msg) { + if (l != r) + throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); +}; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/package.json new file mode 100644 index 00000000..078e9fe6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/package.json @@ -0,0 +1,42 @@ +{ + "name": "minimalistic-assert", + "version": "1.0.0", + "description": "minimalistic-assert ===", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/calvinmetcalf/minimalistic-assert.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/calvinmetcalf/minimalistic-assert/issues" + }, + "homepage": "https://github.com/calvinmetcalf/minimalistic-assert", + "gitHead": "21471ae03175986a30cd3f567ba0bfde5ab10b01", + "_id": "minimalistic-assert@1.0.0", + "_shasum": "702be2dda6b37f4836bcb3f5db56641b64a1d3d3", + "_from": "minimalistic-assert@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + } + ], + "dist": { + "shasum": "702be2dda6b37f4836bcb3f5db56641b64a1d3d3", + "tarball": "http://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/readme.md b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/readme.md new file mode 100644 index 00000000..2ca0d256 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/readme.md @@ -0,0 +1,4 @@ +minimalistic-assert +=== + +very minimalistic assert module. diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/package.json new file mode 100644 index 00000000..06313a9e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/package.json @@ -0,0 +1,63 @@ +{ + "name": "asn1.js", + "version": "1.0.4", + "description": "ASN.1 encoder and decoder", + "main": "lib/asn1.js", + "scripts": { + "test": "mocha --reporter spec test/*-test.js rfc/2560/test/*-test.js rfc/3280/test/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/asn1.js" + }, + "keywords": [ + "asn.1", + "der" + ], + "author": { + "name": "Fedor Indutny" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/asn1.js/issues" + }, + "homepage": "https://github.com/indutny/asn1.js", + "devDependencies": { + "mocha": "^1.14.0" + }, + "optionalDependencies": { + "bn.js": "^1.0.0" + }, + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "bn.js": "^1.0.0" + }, + "gitHead": "e93bdc43f5b529d3d4e2c0bc8df240e5a31fc304", + "_id": "asn1.js@1.0.4", + "_shasum": "adc547dc24775be40db2ae921d6c990c387b32a8", + "_from": "asn1.js@>=1.0.0 <2.0.0", + "_npmVersion": "2.7.5", + "_nodeVersion": "1.6.5", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "fedor.indutny", + "email": "fedor.indutny@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "adc547dc24775be40db2ae921d6c990c387b32a8", + "tarball": "http://registry.npmjs.org/asn1.js/-/asn1.js-1.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-1.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/index.js new file mode 100644 index 00000000..f7b988cf --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/index.js @@ -0,0 +1,110 @@ +try { + var asn1 = require('asn1.js'); + var rfc3280 = require('asn1.js-rfc3280'); +} catch (e) { + var asn1 = require('../' + '..'); + var rfc3280 = require('../' + '3280'); +} + +var OCSPResponse = asn1.define('OCSPResponse', function() { + this.seq().obj( + this.key('responseStatus').use(ResponseStatus), + this.key('responseBytes').optional().explicit(0).seq().obj( + this.key('responseType').objid({ + '1 3 6 1 5 5 7 48 1 1': 'id-pkix-ocsp-basic' + }), + this.key('response').octstr() + ) + ); +}); +exports.OCSPResponse = OCSPResponse; + +var ResponseStatus = asn1.define('ResponseStatus', function() { + this.enum({ + 0: 'successful', + 1: 'malformed_request', + 2: 'internal_error', + 3: 'try_later', + 5: 'sig_required', + 6: 'unauthorized' + }); +}); +exports.ResponseStatus = ResponseStatus; + +var BasicOCSPResponse = asn1.define('BasicOCSPResponse', function() { + this.seq().obj( + this.key('tbsResponseData').use(ResponseData), + this.key('signatureAlgorithm').use(rfc3280.AlgorithmIdentifier), + this.key('signature').bitstr(), + this.key('certs').optional().explicit(0).seqof(rfc3280.Certificate) + ); +}); +exports.BasicOCSPResponse = BasicOCSPResponse; + +var ResponseData = asn1.define('ResponseData', function() { + this.seq().obj( + this.key('version').def('v1').explicit(0).use(rfc3280.Version), + this.key('responderID').use(ResponderID), + this.key('producedAt').gentime(), + this.key('responses').seqof(SingleResponse), + this.key('responseExtensions').optional().explicit(0) + .use(rfc3280.Extensions) + ); +}); +exports.ResponseData = ResponseData; + +var ResponderID = asn1.define('ResponderId', function() { + this.choice({ + byName: this.explicit(1).use(rfc3280.Name), + byKey: this.explicit(2).use(KeyHash) + }); +}); +exports.ResponderID = ResponderID; + +var KeyHash = asn1.define('KeyHash', function() { + this.octstr(); +}); +exports.KeyHash = KeyHash; + +var SingleResponse = asn1.define('SingleResponse', function() { + this.seq().obj( + this.key('certId').use(CertID), + this.key('certStatus').use(CertStatus), + this.key('thisUpdate').gentime(), + this.key('nextUpdate').optional().explicit(0).gentime(), + this.key('singleExtensions').optional().explicit(1).use(Extensions) + ); +}); +exports.SingleResponse = SingleResponse; + +var CertStatus = asn1.define('CertStatus', function() { + this.choice({ + good: this.implicit(0).null_(), + revoked: this.implicit(1).use(RevokedInfo), + unknown: this.implicit(2).null_() + }); +}); +exports.CertStatus = CertStatus; + +var RevokedInfo = asn1.define('RevokedInfo', function() { + this.seq().obj( + this.key('revocationTime').gentime(), + this.key('revocationReason').optional().explicit(0).use(rfc3280.CRLReason) + ); +}); +exports.RevokedInfo = RevokedInfo; + +var CertID = asn1.define('CertID', function() { + this.seq().obj( + this.key('hashAlgorithm').use(rfc3280.AlgorithmIdentifier), + this.key('issuerNameHash').octstr(), + this.key('issuerKeyHash').octstr(), + this.key('serialNumber').use(rfc3280.CertificateSerialNumber) + ); +}); +exports.CertID = CertID; + +var Extensions = asn1.define('Extensions', function() { + this.any(); +}); +exports.Extensions = Extensions; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/package.json new file mode 100644 index 00000000..ec35860a --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/package.json @@ -0,0 +1,27 @@ +{ + "name": "asn1.js-rfc2560", + "version": "1.0.0", + "description": "RFC2560 structures for asn1.js", + "main": "index.js", + "repository": { + "type": "git", + "url": "git@github.com:indutny/asn1.js" + }, + "keywords": [ + "asn1", + "rfc2560", + "der" + ], + "author": "Fedor Indutny", + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/asn1.js/issues" + }, + "homepage": "https://github.com/indutny/asn1.js", + "dependencies": { + "asn1.js-rfc3280": "^1.0.0" + }, + "peerDependencies": { + "asn1.js": "^1.0.0" + } +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/test/basic-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/test/basic-test.js new file mode 100644 index 00000000..b8a60054 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/test/basic-test.js @@ -0,0 +1,50 @@ +var assert = require('assert'); +var rfc2560 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js RFC2560', function() { + it('should decode OCSP response', function() { + var data = new Buffer( + '308201d40a0100a08201cd308201c906092b0601050507300101048201ba308201b630' + + '819fa216041499e4405f6b145e3e05d9ddd36354fc62b8f700ac180f32303133313133' + + '303037343531305a30743072304a300906052b0e03021a050004140226ee2f5fa28108' + + '34dacc3380e680ace827f604041499e4405f6b145e3e05d9ddd36354fc62b8f700ac02' + + '1100bb4f9a31232b1ba52a0b77af481800588000180f32303133313133303037343531' + + '305aa011180f32303133313230343037343531305a300d06092a864886f70d01010505' + + '00038201010027813333c9b46845dfe3d0cb6b19c03929cdfc9181c1ce823929bb911a' + + 'd9de05721790fcccbab43f9fbdec1217ab8023156d07bbcc3555f25e9e472fbbb5e019' + + '2835efcdc71b3dbc5e5c4c5939fc7a610fc6521d4ed7d2b685a812fa1a3a129ea87873' + + '972be3be54618ba4a4d96090d7f9aaa5f70d4f07cf5cf3611d8a7b3adafe0b319459ed' + + '40d456773d5f45f04c773711d86cc41d274f771a31c10d30cd6f846b587524bfab2445' + + '4bbb4535cff46f6b341e50f26a242dd78e246c8dea0e2fabcac9582e000c138766f536' + + 'd7f7bab81247c294454e62b710b07126de4e09685818f694df5783eb66f384ce5977f1' + + '2721ff38c709f3ec580d22ff40818dd17f', + 'hex'); + + var res = rfc2560.OCSPResponse.decode(data, 'der'); + assert.equal(res.responseStatus, 'successful'); + assert.equal(res.responseBytes.responseType, 'id-pkix-ocsp-basic'); + + var basic = rfc2560.BasicOCSPResponse.decode( + res.responseBytes.response, + 'der' + ); + assert.equal(basic.tbsResponseData.version, 'v1'); + assert.equal(basic.tbsResponseData.producedAt, 1385797510000); + }); + + it('should encode/decode OCSP response', function() { + var encoded = rfc2560.OCSPResponse.encode({ + responseStatus: 'malformed_request', + responseBytes: { + responseType: 'id-pkix-ocsp-basic', + response: 'random-string' + } + }, 'der'); + var decoded = rfc2560.OCSPResponse.decode(encoded, 'der'); + assert.equal(decoded.responseStatus, 'malformed_request'); + assert.equal(decoded.responseBytes.responseType, 'id-pkix-ocsp-basic'); + assert.equal(decoded.responseBytes.response.toString(), 'random-string'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/index.js new file mode 100644 index 00000000..64f6ec3d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/index.js @@ -0,0 +1,152 @@ +try { + var asn1 = require('asn1.js'); +} catch (e) { + var asn1 = require('../' + '..'); +} + +var CRLReason = asn1.define('CRLReason', function() { + this.enum({ + 0: 'unspecified', + 1: 'keyCompromise', + 2: 'CACompromise', + 3: 'affiliationChanged', + 4: 'superseded', + 5: 'cessationOfOperation', + 6: 'certificateHold', + 8: 'removeFromCRL', + 9: 'privilegeWithdrawn', + 10: 'AACompromise' + }); +}); +exports.CRLReason = CRLReason; + +var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function() { + this.seq().obj( + this.key('algorithm').objid(), + this.key('parameters').optional().any() + ); +}); +exports.AlgorithmIdentifier = AlgorithmIdentifier; + +var Certificate = asn1.define('Certificate', function() { + this.seq().obj( + this.key('tbsCertificate').use(TBSCertificate), + this.key('signatureAlgorithm').use(AlgorithmIdentifier), + this.key('signature').bitstr() + ); +}); +exports.Certificate = Certificate; + +var TBSCertificate = asn1.define('TBSCertificate', function() { + this.seq().obj( + this.key('version').def('v1').explicit(0).use(Version), + this.key('serialNumber').use(CertificateSerialNumber), + this.key('signature').use(AlgorithmIdentifier), + this.key('issuer').use(Name), + this.key('validity').use(Validity), + this.key('subject').use(Name), + this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo), + + // TODO(indutny): validate that version is v2 or v3 + this.key('issuerUniqueID').optional().explicit(1).use(UniqueIdentifier), + this.key('subjectUniqueID').optional().explicit(2).use(UniqueIdentifier), + + // TODO(indutny): validate that version is v3 + this.key('extensions').optional().explicit(3).use(Extensions) + ); +}); +exports.TBSCertificate = TBSCertificate; + +var Version = asn1.define('Version', function() { + this.int({ + 0: 'v1', + 1: 'v2', + 2: 'v3' + }); +}); +exports.Version = Version; + +var CertificateSerialNumber = asn1.define('CertificateSerialNumber', + function() { + this.int(); +}); +exports.CertificateSerialNumber = CertificateSerialNumber; + +var Validity = asn1.define('Validity', function() { + this.seq().obj( + this.key('notBefore').use(Time), + this.key('notAfter').use(Time) + ); +}); +exports.Validity = Validity; + +var Time = asn1.define('Time', function() { + this.choice({ + utcTime: this.utctime(), + genTime: this.gentime() + }); +}); +exports.Time = Time; + +var UniqueIdentifier = asn1.define('UniqueIdentifier', function() { + this.bitstr(); +}); +exports.UniqueIdentifier = UniqueIdentifier; + +var SubjectPublicKeyInfo = asn1.define('SubjectPublicKeyInfo', function() { + this.seq().obj( + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPublicKey').bitstr() + ); +}); +exports.SubjectPublicKeyInfo = SubjectPublicKeyInfo; + +var Extensions = asn1.define('Extensions', function() { + this.seqof(Extension); +}); +exports.Extensions = Extensions; + +var Extension = asn1.define('Extension', function() { + this.seq().obj( + this.key('extnID').objid(), + this.key('critical').bool().def(false), + this.key('extnValue').octstr() + ); +}); +exports.Extension = Extension; + +var Name = asn1.define('Name', function() { + this.choice({ + rdn: this.use(RDNSequence) + }); +}); +exports.Name = Name; + +var RDNSequence = asn1.define('RDNSequence', function() { + this.seqof(RelativeDistinguishedName); +}); +exports.RDNSequence = RDNSequence; + +var RelativeDistinguishedName = asn1.define('RelativeDistinguishedName', + function() { + this.setof(AttributeTypeAndValue); +}); +exports.RelativeDistinguishedName = RelativeDistinguishedName; + +var AttributeTypeAndValue = asn1.define('AttributeTypeAndValue', function() { + this.seq().obj( + this.key('type').use(AttributeType), + this.key('value').use(AttributeValue) + ); +}); +exports.AttributeTypeAndValue = AttributeTypeAndValue; + +var AttributeType = asn1.define('AttributeType', function() { + this.objid(); +}); +exports.AttributeType = AttributeType; + +var AttributeValue = asn1.define('AttributeValue', function() { + this.any(); +}); +exports.AttributeValue = AttributeValue; diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/package.json new file mode 100644 index 00000000..df76d59f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/package.json @@ -0,0 +1,24 @@ +{ + "name": "asn1.js-rfc3280", + "version": "1.0.0", + "description": "RFC3280 structures for asn1.js", + "main": "index.js", + "repository": { + "type": "git", + "url": "git@github.com:indutny/asn1.js" + }, + "keywords": [ + "asn1", + "rfc3280", + "der" + ], + "author": "Fedor Indutny", + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/asn1.js/issues" + }, + "homepage": "https://github.com/indutny/asn1.js", + "peerDependencies": { + "asn1.js": "^1.0.0" + } +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/test/basic-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/test/basic-test.js new file mode 100644 index 00000000..128ddbb2 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/test/basic-test.js @@ -0,0 +1,54 @@ +var assert = require('assert'); +var asn1 = require('../../../'); +var rfc3280 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js RFC3280', function() { + it('should decode Certificate', function() { + var data = new Buffer( + '308204763082035ea0030201020208462e4256bb1194dc300d06092a864886f70d0101' + + '0505003049310b300906035504061302555331133011060355040a130a476f6f676c65' + + '20496e63312530230603550403131c476f6f676c6520496e7465726e65742041757468' + + '6f72697479204732301e170d3134303733303132303434305a170d3134313032383030' + + '303030305a3068310b30090603550406130255533113301106035504080c0a43616c69' + + '666f726e69613116301406035504070c0d4d6f756e7461696e20566965773113301106' + + '0355040a0c0a476f6f676c6520496e633117301506035504030c0e7777772e676f6f67' + + '6c652e636f6d30820122300d06092a864886f70d01010105000382010f003082010a02' + + '82010100b7894e02f9ba01e07889d670fd3618d6022efc96c9d9deae2e800aa19f4b17' + + '20c371b9996b2efc12fa191b60a92afe76e80e5d9d47280cbc46a4cd9cf454503fefcf' + + 'cd2e1c8b113a89bcd1f1427ae793bbd0d1e077bc963ff2ceb2b0c9ab68196fce1b2f40' + + '0dc77d6294a7c0d50ff104cf92ee837d5c484a3ba0ce76b9c018cf96545f7e27518232' + + '57874945f87b69bac902ce4b378746953c619db909e73fd2f5e2dd009c5c748ec22fcb' + + 'd6648fe60a5805e98ab8cd65ab0eb0772d7a19aefdc24c9a3933692ca695e7b493f8ac' + + '7aab8e5d1229f071cf08ac0b6c641704a74747faacfb857b68359fc1a98c777fb5eb3e' + + '9c90d6a13b78f42d6d797fd74f03c30203010001a38201413082013d301d0603551d25' + + '0416301406082b0601050507030106082b0601050507030230190603551d1104123010' + + '820e7777772e676f6f676c652e636f6d306806082b06010505070101045c305a302b06' + + '082b06010505073002861f687474703a2f2f706b692e676f6f676c652e636f6d2f4749' + + '4147322e637274302b06082b06010505073001861f687474703a2f2f636c69656e7473' + + '312e676f6f676c652e636f6d2f6f637370301d0603551d0e04160414e43d6cc20c12e9' + + '7c1920533676ef287737d8884a300c0603551d130101ff04023000301f0603551d2304' + + '18301680144add06161bbcf668b576f581b6bb621aba5a812f30170603551d20041030' + + '0e300c060a2b06010401d67902050130300603551d1f042930273025a023a021861f68' + + '7474703a2f2f706b692e676f6f676c652e636f6d2f47494147322e63726c300d06092a' + + '864886f70d010105050003820101002d5501bd33f7b6e06117e53ccf21703565f29ab7' + + '8642a771effa4369f32938b45f04208d88a1046ba0a726622e864143c8dac38392430d' + + 'fbea1b7d41c1e27dd43438a47d36c4a048de318be442abed5f60373687d01b7fefc43e' + + '0aacf620b11a69fb237aaa4dc33b97bc0eb39b1abe6902b1518253addda25037389c26' + + '0ef2808be7f702f47a6466d6f3b35764f088c94e0a2b9ee403602ae21cbad3fd8e873e' + + '9e817945a3d23fd2b35579cce19ea7f8815d166f3e46d53eed25ef391a912bb715af64' + + 'e43e124f98be487f9d222954a5bebc8d5ca384c7128c6dabffb11150a7d2a62ce565b8' + + 'a02a6c4c8ecfc7ac7065c1979cb8d50eabd5d36c72a5396e712e', + 'hex'); + + var res = rfc3280.Certificate.decode(data, 'der'); + + var tbs = res.tbsCertificate; + assert.equal(tbs.version, 'v3'); + assert.deepEqual(tbs.serialNumber, + new asn1.bignum('462e4256bb1194dc', 16)); + assert.equal(tbs.signature.algorithm.join('.'), + '1.2.840.113549.1.1.5'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/der-decode-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/der-decode-test.js new file mode 100644 index 00000000..a8983937 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/der-decode-test.js @@ -0,0 +1,60 @@ +var assert = require('assert'); +var asn1 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js DER decoder', function() { + it('should propagate implicit tag', function() { + var B = asn1.define('B', function() { + this.seq().obj( + this.key('b').octstr() + ); + }); + + var A = asn1.define('Bug', function() { + this.seq().obj( + this.key('a').implicit(0).use(B) + ); + }); + + var out = A.decode(new Buffer('300720050403313233', 'hex'), 'der'); + assert.equal(out.a.b.toString(), '123'); + }); + + it('should decode optional tag to undefined key', function() { + var A = asn1.define('A', function() { + this.seq().obj( + this.key('key').bool(), + this.optional().key('opt').bool() + ); + }); + var out = A.decode(new Buffer('30030101ff', 'hex'), 'der'); + assert.deepEqual(out, { 'key': true }); + }); + + it('should decode optional tag to default value', function() { + var A = asn1.define('A', function() { + this.seq().obj( + this.key('key').bool(), + this.optional().key('opt').octstr().def('default') + ); + }); + var out = A.decode(new Buffer('30030101ff', 'hex'), 'der'); + assert.deepEqual(out, { 'key': true, 'opt': 'default' }); + }); + + function test(name, model, inputHex, expected) { + it(name, function() { + var M = asn1.define('Model', model); + var decoded = M.decode(new Buffer(inputHex,'hex'), 'der'); + assert.deepEqual(decoded, expected); + }); + } + + test('should decode choice', function() { + this.choice({ + apple: this.bool(), + }); + }, '0101ff', { 'type': 'apple', 'value': true }); + +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/der-encode-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/der-encode-test.js new file mode 100644 index 00000000..f19e75ca --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/der-encode-test.js @@ -0,0 +1,71 @@ +var assert = require('assert'); +var asn1 = require('..'); +var BN = require('bn.js'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js DER encoder', function() { + /* + * Explicit value shold be wrapped with A0 | EXPLICIT tag + * this adds two more bytes to resulting buffer. + * */ + it('should code explicit tag as 0xA2', function() { + var E = asn1.define('E', function() { + this.explicit(2).octstr() + }); + + var encoded = E.encode('X', 'der'); + + // + assert.equal(encoded.toString('hex'), 'a203040158'); + assert.equal(encoded.length, 5); + }) + + function test(name, model_definition, model_value, der_expected) { + it(name, function() { + var Model, der_actual; + Model = asn1.define('Model', model_definition); + der_actual = Model.encode(model_value, 'der'); + assert.deepEqual(der_actual, new Buffer(der_expected,'hex')); + }); + } + + test('should encode choice', function() { + this.choice({ + apple: this.bool(), + }); + }, { type: 'apple', value: true }, '0101ff'); + + test('should encode implicit seqof', function() { + var Int = asn1.define('Int', function() { + this.int(); + }); + this.implicit(0).seqof(Int); + }, [ 1 ], 'A003020101' ); + + test('should encode explicit seqof', function() { + var Int = asn1.define('Int', function() { + this.int(); + }); + this.explicit(0).seqof(Int); + }, [ 1 ], 'A0053003020101' ); + + test('should encode BN(128) properly', function() { + this.int(); + }, new BN(128), '02020080'); + + test('should encode int 128 properly', function() { + this.int(); + }, 128, '02020080'); + + test('should encode 0x8011 properly', function() { + this.int(); + }, 0x8011, '0203008011'); + + test('should omit default value in DER', function() { + this.seq().obj( + this.key('required').def(false).bool(), + this.key('value').int() + ); + }, {required: false, value: 1}, '3003020101'); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/error-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/error-test.js new file mode 100644 index 00000000..35354826 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/error-test.js @@ -0,0 +1,199 @@ +var assert = require('assert'); +var asn1 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js error', function() { + describe('encoder', function() { + function test(name, model, input, expected) { + it('should support ' + name, function() { + var M = asn1.define('TestModel', model); + + var error; + assert.throws(function() { + try { + var encoded = M.encode(input, 'der'); + } catch (e) { + error = e; + throw e; + } + }); + + assert(expected.test(error.stack), + 'Failed to match, expected: ' + expected + ' got: ' + + JSON.stringify(error.stack)); + }); + } + + describe('primitives', function() { + test('int', function() { + this.int(); + }, 'hello', /no values map/i); + + test('enum', function() { + this.enum({ 0: 'hello', 1: 'world' }); + }, 'gosh', /contain: "gosh"/); + + test('objid', function() { + this.objid(); + }, 1, /objid\(\) should be either array or string, got: 1/); + }); + + describe('composite', function() { + test('shallow', function() { + this.seq().obj( + this.key('key').int() + ); + }, { key: 'hello' } , /map at: \["key"\]/i); + + test('deep and empty', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ) + ) + ); + }, { } , /input is not object at: \["a"\]\["b"\]/i); + + test('deep', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ) + ) + ); + }, { a: { b: { c: 'hello' } } } , /map at: \["a"\]\["b"\]\["c"\]/i); + + test('use', function() { + var S = asn1.define('S', function() { + this.seq().obj( + this.key('x').int() + ); + }); + + this.seq().obj( + this.key('a').seq().obj( + this.key('b').use(S) + ) + ); + }, { a: { b: { x: 'hello' } } } , /map at: \["a"\]\["b"\]\["x"\]/i); + }); + }); + + describe('decoder', function() { + function test(name, model, input, expected) { + it('should support ' + name, function() { + var M = asn1.define('TestModel', model); + + var error; + assert.throws(function() { + try { + var decoded = M.decode(new Buffer(input, 'hex'), 'der'); + } catch (e) { + error = e; + throw e; + } + }); + var partial = M.decode(new Buffer(input, 'hex'), 'der', { + partial: true + }); + + assert(expected.test(error.stack), + 'Failed to match, expected: ' + expected + ' got: ' + + JSON.stringify(error.stack)); + + assert.equal(partial.errors.length, 1); + assert(expected.test(partial.errors[0].stack), + 'Failed to match, expected: ' + expected + ' got: ' + + JSON.stringify(partial.errors[0].stack)); + }); + } + + describe('primitive', function() { + test('int', function() { + this.int(); + }, '2201', /body of: "int"/); + + test('int', function() { + this.int(); + }, '', /tag of "int"/); + }); + + describe('composite', function() { + test('shallow', function() { + this.seq().obj( + this.key('a').seq().obj() + ); + }, '30', /length of "seq"/); + + test('deep and empty', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ) + ) + ); + }, '300430023000', /tag of "int" at: \["a"\]\["b"\]\["c"\]/); + + test('deep and incomplete', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ) + ) + ); + }, '30053003300122', /length of "int" at: \["a"\]\["b"\]\["c"\]/); + }); + }); + + describe('partial decoder', function() { + function test(name, model, input, expectedObj, expectedErrs) { + it('should support ' + name, function() { + var M = asn1.define('TestModel', model); + + var decoded = M.decode(new Buffer(input, 'hex'), 'der', { + partial: true + }); + + assert.deepEqual(decoded.result, expectedObj); + + assert.equal(decoded.errors.length, expectedErrs.length); + expectedErrs.forEach(function(expected, i) { + assert(expected.test(decoded.errors[i].stack), + 'Failed to match, expected: ' + expected + ' got: ' + + JSON.stringify(decoded.errors[i].stack)); + }); + }); + } + + test('last key not present', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ), + this.key('d').int() + ) + ); + }, '30073005300022012e', { a: { b: {}, d: 46 } }, [ + /"int" at: \["a"\]\["b"\]\["c"\]/ + ]); + + test('first key not present', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ), + this.key('d').int() + ) + ); + }, '30073005300322012e', { a: { b: { c: 46 } } }, [ + /"int" at: \["a"\]\["d"\]/ + ]); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/ping-pong-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/ping-pong-test.js new file mode 100644 index 00000000..46518234 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/ping-pong-test.js @@ -0,0 +1,146 @@ +var assert = require('assert'); +var asn1 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js ping/pong', function() { + function test(name, model, input, expected) { + it('should support ' + name, function() { + var M = asn1.define('TestModel', model); + + var encoded = M.encode(input, 'der'); + var decoded = M.decode(encoded, 'der'); + assert.deepEqual(decoded, expected !== undefined ? expected : input); + }); + } + + describe('primitives', function() { + test('int', function() { + this.int(); + }, 0); + + test('bigint', function() { + this.int(); + }, new asn1.bignum('0102030405060708', 16)); + + test('enum', function() { + this.enum({ 0: 'hello', 1: 'world' }); + }, 'world'); + + test('octstr', function() { + this.octstr(); + }, new Buffer('hello')); + + test('bitstr', function() { + this.bitstr(); + }, { unused: 4, data: new Buffer('hello!') }); + + test('ia5str', function() { + this.ia5str(); + }, 'hello'); + + test('gentime', function() { + this.gentime(); + }, 1385921175000); + + test('utctime', function() { + this.utctime(); + }, 1385921175000); + + test('null', function() { + this.null_(); + }, null); + + test('objid', function() { + this.objid({ + '1 3 6 1 5 5 7 48 1 1': 'id-pkix-ocsp-basic' + }); + }, 'id-pkix-ocsp-basic'); + + test('true', function() { + this.bool(); + }, true); + + test('false', function() { + this.bool(); + }, false); + + test('any', function() { + this.any(); + }, new Buffer('02210081347a0d3d674aeeb563061d94a3aea5f6a7' + + 'c6dc153ea90a42c1ca41929ac1b9', 'hex')); + + test('default explicit', function() { + this.seq().obj( + this.key('version').def('v1').explicit(0).int({ + 0: 'v1', + 1: 'v2' + }) + ); + }, {}, {'version': 'v1'}); + + test('implicit', function() { + this.implicit(0).int({ + 0: 'v1', + 1: 'v2' + }); + }, 'v2', 'v2'); + }); + + describe('composite', function() { + test('2x int', function() { + this.seq().obj( + this.key('hello').int(), + this.key('world').int() + ); + }, { hello: 4, world: 2 }); + + test('enum', function() { + this.seq().obj( + this.key('hello').enum({ 0: 'world', 1: 'devs' }) + ); + }, { hello: 'devs' }); + + test('optionals', function() { + this.seq().obj( + this.key('hello').enum({ 0: 'world', 1: 'devs' }), + this.key('how').optional().def('are you').enum({ + 0: 'are you', + 1: 'are we?!' + }) + ); + }, { hello: 'devs', how: 'are we?!' }); + + test('optionals #2', function() { + this.seq().obj( + this.key('hello').enum({ 0: 'world', 1: 'devs' }), + this.key('how').optional().def('are you').enum({ + 0: 'are you', + 1: 'are we?!' + }) + ); + }, { hello: 'devs' }, { hello: 'devs', how: 'are you' }); + + test('optionals #3', function() { + this.seq().obj( + this.key('content').optional().int() + ); + }, {}, {}); + + test('seqof', function() { + var S = asn1.define('S', function() { + this.seq().obj( + this.key('a').def('b').int({ 0: 'a', 1: 'b' }), + this.key('c').def('d').int({ 2: 'c', 3: 'd' }) + ); + }); + this.seqof(S); + }, [{}, { a: 'a', c: 'c' }], [{ a: 'b', c: 'd' }, { a: 'a', c: 'c' }]); + + test('choice', function() { + this.choice({ + apple: this.bool() + }); + }, { type: 'apple', value: true }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/use-test.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/use-test.js new file mode 100644 index 00000000..e179fb4b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/asn1.js/test/use-test.js @@ -0,0 +1,126 @@ +var assert = require('assert'); +var asn1 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js models', function() { + describe('plain use', function() { + it('should encode submodel', function() { + var SubModel = asn1.define('SubModel', function() { + this.seq().obj( + this.key('b').octstr() + ); + }); + var Model = asn1.define('Model', function() { + this.seq().obj( + this.key('a').int(), + this.key('sub').use(SubModel) + ); + }); + + var data = {a: 1, sub: {b: new Buffer("XXX")}}; + var wire = Model.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300a02010130050403585858'); + var back = Model.decode(wire, 'der'); + assert.deepEqual(back, data); + }); + + it('should honour implicit tag from parent', function() { + var SubModel = asn1.define('SubModel', function() { + this.seq().obj( + this.key('x').octstr() + ) + }); + var Model = asn1.define('Model', function() { + this.seq().obj( + this.key('a').int(), + this.key('sub').use(SubModel).implicit(0) + ); + }); + + var data = {a: 1, sub: {x: new Buffer("123")}}; + var wire = Model.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300a020101a0050403313233'); + var back = Model.decode(wire, 'der'); + assert.deepEqual(back, data); + + }); + + it('should honour explicit tag from parent', function() { + var SubModel = asn1.define('SubModel', function() { + this.seq().obj( + this.key('x').octstr() + ) + }); + var Model = asn1.define('Model', function() { + this.seq().obj( + this.key('a').int(), + this.key('sub').use(SubModel).explicit(0) + ); + }); + + var data = {a: 1, sub: {x: new Buffer("123")}}; + var wire = Model.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300c020101a00730050403313233'); + var back = Model.decode(wire, 'der'); + assert.deepEqual(back, data); + + }); + + it('should get model with function call', function() { + var SubModel = asn1.define('SubModel', function() { + this.seq().obj( + this.key('x').octstr() + ) + }); + var Model = asn1.define('Model', function() { + this.seq().obj( + this.key('a').int(), + this.key('sub').use(function(obj) { + assert.equal(obj.a, 1); + return SubModel; + }) + ); + }); + + var data = {a: 1, sub: {x: new Buffer("123")}}; + var wire = Model.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300a02010130050403313233'); + var back = Model.decode(wire, 'der'); + assert.deepEqual(back, data); + + }); + + it('should support recursive submodels', function() { + var PlainSubModel = asn1.define('PlainSubModel', function() { + this.int(); + }); + var RecursiveModel = asn1.define('RecursiveModel', function() { + this.seq().obj( + this.key('plain').bool(), + this.key('content').use(function(obj) { + if(obj.plain) { + return PlainSubModel; + } else { + return RecursiveModel; + } + }) + ); + }); + + var data = { + 'plain': false, + 'content': { + 'plain': true, + 'content': 1 + } + }; + var wire = RecursiveModel.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300b01010030060101ff020101'); + var back = RecursiveModel.decode(wire, 'der'); + assert.deepEqual(back, data); + }); + + }); +}); + diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/.npmignore b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/.npmignore new file mode 100644 index 00000000..c2757b0e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/.npmignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Deployed apps should consider commenting this line out: +# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git +node_modules + +# build artifact +test/bundle.js \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/.travis.yml b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/.travis.yml new file mode 100644 index 00000000..73261dc6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/.travis.yml @@ -0,0 +1,13 @@ +language: node_js +before_install: + - "npm install npm -g" +node_js: + - "0.10" + - "0.11" + - "0.12" + - "iojs" +env: + - TEST_SUITE=test + - TEST_SUITE=coveralls + - TEST_SUITE=standard +script: "npm run-script $TEST_SUITE" diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/LICENSE b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/LICENSE new file mode 100644 index 00000000..a115b524 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Daniel Cousens + +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/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/README.md b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/README.md new file mode 100644 index 00000000..6c5e4f7d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/README.md @@ -0,0 +1,22 @@ +# pbkdf2-compat + +[![build status](https://secure.travis-ci.org/crypto-browserify/pbkdf2-compat.png)](http://travis-ci.org/crypto-browserify/pbkdf2-compat) +[![Coverage Status](https://img.shields.io/coveralls/crypto-browserify/pbkdf2-compat.svg)](https://coveralls.io/r/crypto-browserify/pbkdf2-compat) +[![Version](http://img.shields.io/npm/v/pbkdf2-compat.svg)](https://www.npmjs.org/package/pbkdf2-compat) + +This library provides the functionality of PBKDF2 with the ability to use any supported hashing algorithm returned from `crypto.getHashes()` + + +## Usage + +``` +var compat = require('pbkd2f-compat') +var derivedKey = compat.pbkdf2Sync('password', 'salt', 1, 32, 'sha512') + +... +``` + + +## Credits + +This module is a derivative of https://github.com/cryptocoinjs/pbkdf2-sha256/, so thanks to [JP Richardson](https://github.com/cryptocoinjs/pbkdf2-sha256/) for laying the ground work. diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/async-shim.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/async-shim.js new file mode 100644 index 00000000..1516e97b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/async-shim.js @@ -0,0 +1,7 @@ +var compat = require('./browser') + +process.on('message', function (m) { + var result = compat.pbkdf2Sync(new Buffer(m.password, 'hex'), new Buffer(m.salt, 'hex'), m.iterations, m.keylen, m.digest) + + process.send(result.toString('hex')) +}) diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/browser.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/browser.js new file mode 100644 index 00000000..a5090076 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/browser.js @@ -0,0 +1,78 @@ +var createHmac = require('create-hmac') + +exports.pbkdf2 = pbkdf2 +function pbkdf2 (password, salt, iterations, keylen, digest, callback) { + if (typeof digest === 'function') { + callback = digest + digest = undefined + } + + if (typeof callback !== 'function') { + throw new Error('No callback provided to pbkdf2') + } + + var result = pbkdf2Sync(password, salt, iterations, keylen, digest) + setTimeout(function () { + callback(undefined, result) + }) +} + +exports.pbkdf2Sync = pbkdf2Sync +function pbkdf2Sync (password, salt, iterations, keylen, digest) { + if (typeof iterations !== 'number') + throw new TypeError('Iterations not a number') + + if (iterations < 0) + throw new TypeError('Bad iterations') + + if (typeof keylen !== 'number') + throw new TypeError('Key length not a number') + + if (keylen < 0) + throw new TypeError('Bad key length') + + digest = digest || 'sha1' + + if (!Buffer.isBuffer(password)) password = new Buffer(password) + if (!Buffer.isBuffer(salt)) salt = new Buffer(salt) + + var hLen + var l = 1 + var DK = new Buffer(keylen) + var block1 = new Buffer(salt.length + 4) + salt.copy(block1, 0, 0, salt.length) + + var r + var T + + for (var i = 1; i <= l; i++) { + block1.writeUInt32BE(i, salt.length) + var U = createHmac(digest, password).update(block1).digest() + + if (!hLen) { + hLen = U.length + T = new Buffer(hLen) + l = Math.ceil(keylen / hLen) + r = keylen - (l - 1) * hLen + + if (keylen > (Math.pow(2, 32) - 1) * hLen) + throw new TypeError('keylen exceeds maximum length') + } + + U.copy(T, 0, 0, hLen) + + for (var j = 1; j < iterations; j++) { + U = createHmac(digest, password).update(U).digest() + + for (var k = 0; k < hLen; k++) { + T[k] ^= U[k] + } + } + + var destPos = (i - 1) * hLen + var len = (i === l ? r : hLen) + T.copy(DK, destPos, 0, len) + } + + return DK +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/index.js new file mode 100644 index 00000000..266d500b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/index.js @@ -0,0 +1,87 @@ +var crypto = require('crypto') +var fork = require('child_process').fork +var path = require('path') +var compat = require('./browser') + +function asyncPBKDF2 (password, salt, iterations, keylen, digest, callback) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number') + } + + if (iterations < 0) { + throw new TypeError('Bad iterations') + } + + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number') + } + + if (keylen < 0) { + throw new TypeError('Bad key length') + } + if (typeof password === 'string') + password = new Buffer(password) + + if (typeof salt === 'string') + salt = new Buffer(salt) + + var child = fork(path.resolve(__dirname, 'async-shim.js')) + + child.on('message', function (result) { + child.kill() + callback(null, new Buffer(result, 'hex')) + }).on('error', function (err) { + child.kill() + callback(err) + }) + + child.send({ + password: password.toString('hex'), + salt: salt.toString('hex'), + iterations: iterations, + keylen: keylen, + digest: digest + }) +} + +exports.pbkdf2Sync = function pbkdf2Sync (password, salt, iterations, keylen, digest) { + digest = digest || 'sha1' + + if (isNode10()) { + if (digest === 'sha1') { + return crypto.pbkdf2Sync(password, salt, iterations, keylen) + } else { + return compat.pbkdf2Sync(password, salt, iterations, keylen, digest) + } + } else { + return crypto.pbkdf2Sync(password, salt, iterations, keylen, digest) + } +} + +exports.pbkdf2 = function pbkdf2 (password, salt, iterations, keylen, digest, callback) { + if (typeof digest === 'function') { + callback = digest + digest = 'sha1' + } + + if (isNode10()) { + if (digest === 'sha1') { + return crypto.pbkdf2(password, salt, iterations, keylen, callback) + } else { + return asyncPBKDF2(password, salt, iterations, keylen, digest, callback) + } + } else { + return crypto.pbkdf2(password, salt, iterations, keylen, digest, callback) + } +} + +var sha1 = '0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164' +var isNode10Result + +function isNode10 () { + if (typeof isNode10Result === 'undefined') { + isNode10Result = crypto.pbkdf2Sync('password', 'salt', 1, 32, 'sha256').toString('hex') === sha1 + } + + return isNode10Result +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/package.json new file mode 100644 index 00000000..8a9e2b16 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/package.json @@ -0,0 +1,86 @@ +{ + "name": "pbkdf2-compat", + "version": "3.0.2", + "description": "This library provides the functionality of PBKDF2 with the ability to use any supported hashing algorithm returned from crypto.getHashes()", + "main": "./index.js", + "browser": "./browser.js", + "keywords": [ + "pbkdf2", + "kdf", + "salt", + "hash" + ], + "scripts": { + "coverage": "istanbul cover _mocha -- -t 20000 test/index.js", + "coveralls": "npm run coverage && coveralls < coverage/lcov.info", + "standard": "standard", + "test": "mocha --reporter list -t 20000 test/index.js", + "bundle-test": "browserify test/index.js > test/bundle.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/crypto-browserify/pbkdf2-compat.git" + }, + "author": { + "name": "Daniel Cousens" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/pbkdf2-compat/issues" + }, + "homepage": "https://github.com/crypto-browserify/pbkdf2-compat", + "devDependencies": { + "browserify": "^8.1.1", + "coveralls": "^2.11.2", + "istanbul": "^0.3.5", + "mocha": "^2.1.0", + "standard": "^1.3.0" + }, + "dependencies": { + "create-hmac": "^1.1.2" + }, + "standard": { + "ignore": [ + "test/**" + ] + }, + "gitHead": "c315c35d28accb2e8c7d3a65ca4111527c4a9c1e", + "_id": "pbkdf2-compat@3.0.2", + "_shasum": "0b207887e7d45467e9dd1027bbf1414e1f165291", + "_from": "pbkdf2-compat@>=3.0.0 <4.0.0", + "_npmVersion": "2.5.0", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "dcousens", + "email": "email@dcousens.com" + }, + "maintainers": [ + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "0b207887e7d45467e9dd1027bbf1414e1f165291", + "tarball": "http://registry.npmjs.org/pbkdf2-compat/-/pbkdf2-compat-3.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/pbkdf2-compat/-/pbkdf2-compat-3.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/fixtures.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/fixtures.json new file mode 100644 index 00000000..8e49c19f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/fixtures.json @@ -0,0 +1,138 @@ +{ + "valid": [ + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": 32, + "results": { + "sha1": "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164", + "sha256": "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b", + "sha512": "867f70cf1ade02cff3752599a3a53dc4af34c7a669815ae5d513554e1c8cf252", + "sha224": "3c198cbdb9464b7857966bd05b7bc92bc1cc4e6e63155d4e490557fd85989497", + "sha384": "c0e14f06e49e32d73f9f52ddf1d0c5c7191609233631dadd76a567db42b78676" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 2, + "dkLen": 32, + "results": { + "sha1": "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957cae93136266537a8d7bf4b76", + "sha256": "ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43", + "sha512": "e1d9c16aa681708a45f5c7c4e215ceb66e011a2e9f0040713f18aefdb866d53c", + "sha224": "93200ffa96c5776d38fa10abdf8f5bfc0054b9718513df472d2331d2d1e66a3f", + "sha384": "54f775c6d790f21930459162fc535dbf04a939185127016a04176a0730c6f1f4" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": 64, + "results": { + "sha1": "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164ac2e7a8e3f9d2e83ace57e0d50e5e1071367c179bc86c767fc3f78ddb561363f", + "sha256": "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b4dbf3a2f3dad3377264bb7b8e8330d4efc7451418617dabef683735361cdc18c", + "sha512": "867f70cf1ade02cff3752599a3a53dc4af34c7a669815ae5d513554e1c8cf252c02d470a285a0501bad999bfe943c08f050235d7d68b1da55e63f73b60a57fce", + "sha224": "3c198cbdb9464b7857966bd05b7bc92bc1cc4e6e63155d4e490557fd859894978ab846d52a1083ac610c36c2c5ea8ce4a024dd691064d5453bd17b15ea1ac194", + "sha384": "c0e14f06e49e32d73f9f52ddf1d0c5c7191609233631dadd76a567db42b78676b38fc800cc53ddb642f5c74442e62be44d727702213e3bb9223c53b767fbfb5d" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 2, + "dkLen": 64, + "results": { + "sha1": "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957cae93136266537a8d7bf4b76c51094cc1ae010b19923ddc4395cd064acb023ffd1edd5ef4be8ffe61426c28e", + "sha256": "ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43830651afcb5c862f0b249bd031f7a67520d136470f5ec271ece91c07773253d9", + "sha512": "e1d9c16aa681708a45f5c7c4e215ceb66e011a2e9f0040713f18aefdb866d53cf76cab2868a39b9f7840edce4fef5a82be67335c77a6068e04112754f27ccf4e", + "sha224": "93200ffa96c5776d38fa10abdf8f5bfc0054b9718513df472d2331d2d1e66a3f97b510224f700ce72581ffb10a1c99ec99a8cc1b951851a71f30d9265fccf912", + "sha384": "54f775c6d790f21930459162fc535dbf04a939185127016a04176a0730c6f1f4fb48832ad1261baadd2cedd50814b1c806ad1bbf43ebdc9d047904bf7ceafe1e" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 4096, + "dkLen": 32, + "results": { + "sha1": "4b007901b765489abead49d926f721d065a429c12e463f6c4cd79401085b03db", + "sha256": "c5e478d59288c841aa530db6845c4c8d962893a001ce4e11a4963873aa98134a", + "sha512": "d197b1b33db0143e018b12f3d1d1479e6cdebdcc97c5c0f87f6902e072f457b5", + "sha224": "218c453bf90635bd0a21a75d172703ff6108ef603f65bb821aedade1d6961683", + "sha384": "559726be38db125bc85ed7895f6e3cf574c7a01c080c3447db1e8a76764deb3c" + } + }, + { + "key": "passwordPASSWORDpassword", + "salt": "saltSALTsaltSALTsaltSALTsaltSALTsalt", + "iterations": 4096, + "dkLen": 40, + "results": { + "sha1": "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038b6b89a48612c5a25284e6605e12329", + "sha256": "348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9", + "sha512": "8c0511f4c6e597c6ac6315d8f0362e225f3c501495ba23b868c005174dc4ee71115b59f9e60cd953", + "sha224": "056c4ba438ded91fc14e0594e6f52b87e1f3690c0dc0fbc05784ed9a754ca780e6c017e80c8de278", + "sha384": "819143ad66df9a552559b9e131c52ae6c5c1b0eed18f4d283b8c5c9eaeb92b392c147cc2d2869d58" + } + }, + { + "key": "pass\u00000word", + "salt": "sa\u00000lt", + "iterations": 4096, + "dkLen": 16, + "results": { + "sha1": "345cbad979dfccb90cac5257bea6ea46", + "sha256": "1df6274d3c0bd2fc7f54fb46f149dda4", + "sha512": "336d14366099e8aac2c46c94a8f178d2", + "sha224": "0aca9ca9634db6ef4927931f633c6453", + "sha384": "b6ab6f8f6532fd9c5c30a79e1f93dcc6" + } + }, + { + "keyHex": "63ffeeddccbbaa", + "salt": "salt", + "iterations": 1, + "dkLen": 32, + "results": { + "sha1": "f6635023b135a57fb8caa89ef8ad93a29d9debb1b011e6e88bffbb212de7c01c", + "sha256": "dadd4a2638c1cf90a220777bc85d81859459513eb83063e3fce7d081490f259a", + "sha512": "f69de451247225a7b30cc47632899572bb980f500d7c606ac9b1c04f928a3488", + "sha224": "9cdee023b5d5e06ccd6c5467463e34fe461a7ed43977f8237f97b0bc7ebfd280", + "sha384": "25c72b6f0e052c883a9273a54cfd41fab86759fa3b33eb7920b923abaad62f99" + } + } + ], + "invalid": [ + { + "key": "password", + "salt": "salt", + "iterations": "NaN", + "dkLen": 16, + "exception": "Iterations not a number" + }, + { + "key": "password", + "salt": "salt", + "iterations": -1, + "dkLen": 16, + "exception": "Bad iterations" + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": "NaN", + "exception": "Key length not a number" + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": -1, + "exception": "Bad key length" + } + ] +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.html b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.html new file mode 100644 index 00000000..82363915 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.html @@ -0,0 +1,13 @@ + + +
+ + + \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.js new file mode 100644 index 00000000..67914b0f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.js @@ -0,0 +1,91 @@ +var assert = require('assert') +var compatNode = require('../') +var compatBrowser = require('../browser') +var fixtures = require('./fixtures') + +// SHA-1 vectors generated by Node.js +// SHA-256/SHA-512 test vectors from: +// https://stackoverflow.com/questions/5130513/pbkdf2-hmac-sha2-test-vectors +// https://stackoverflow.com/questions/15593184/pbkdf2-hmac-sha-512-test-vectors +function runTests(compat, name) { + describe(name, function () { + var algos = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512'] + describe('pbkdf2-compat', function() { + it('defaults to sha1 and handles buffers', function(done) { + compat.pbkdf2(new Buffer('password'), new Buffer('salt'), 1, 32, function (err, result) { + assert.equal(result.toString('hex'), "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164") + done() + }) + }) + + describe('pbkdf2', function() { + algos.forEach(function(algorithm) { + describe(algorithm, function() { + fixtures.valid.forEach(function(f) { + var key = f.key || new Buffer(f.keyHex, 'hex') + var expected = f.results[algorithm] + + it('encodes ' + key + '(' + f.salt + ') with ' + algorithm + ' to ' + expected, function(done) { + compat.pbkdf2(key, f.salt, f.iterations, f.dkLen, algorithm, function(err, result) { + assert.equal(result.toString('hex'), expected) + + done() + }) + }) + }) + + fixtures.invalid.forEach(function(f) { + it('should throw ' + f.exception, function() { + assert.throws(function() { + compat.pbkdf2(f.key, f.salt, f.iterations, f.dkLen, f.algo, function (){}) + }, new RegExp(f.exception)) + }) + }) + }) + }) + + it('should throw if no callback is provided', function() { + assert.throws(function() { + compat.pbkdf2('password', 'salt', 1, 32, 'sha1') + }, /No callback provided to pbkdf2/) + }) + }) + + describe('pbkdf2Sync', function() { + it('defaults to sha1', function() { + var result = compat.pbkdf2Sync('password', 'salt', 1, 32) + + assert.equal(result.toString('hex'), "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164") + }) + + algos.forEach(function(algorithm) { + describe(algorithm, function() { + fixtures.valid.forEach(function(f) { + var key = f.key || new Buffer(f.keyHex, 'hex') + var expected = f.results[algorithm] + + it('encodes ' + key + '(' + f.salt + ') with ' + algorithm + ' to ' + expected, function() { + var result = compat.pbkdf2Sync(key, f.salt, f.iterations, f.dkLen, algorithm) + + assert.equal(result.toString('hex'), expected) + }) + }) + + fixtures.invalid.forEach(function(f) { + it('should throw ' + f.exception, function() { + assert.throws(function() { + compat.pbkdf2Sync(f.key, f.salt, f.iterations, f.dkLen, f.algo) + }, new RegExp(f.exception)) + }) + }) + }) + }) + }) + }) + }) +} + +runTests(compatBrowser, 'JavaScript pbkdf2') +if (compatBrowser !== compatNode) { + runTests(compatNode, 'node pbkdf2') +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/package.json new file mode 100644 index 00000000..fd81fc35 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/package.json @@ -0,0 +1,67 @@ +{ + "name": "parse-asn1", + "version": "3.0.0", + "description": "parse-asn1 ===", + "main": "index.js", + "scripts": { + "test": "node ./test" + }, + "repository": { + "type": "git", + "url": "git://github.com/calvinmetcalf/parse-asn1.git" + }, + "author": "", + "license": "ISC", + "dependencies": { + "asn1.js": "^1.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "pbkdf2-compat": "^3.0.0" + }, + "devDependencies": { + "tape": "^3.4.0" + }, + "gitHead": "a6be135aec21fdc648d15f267381315821734a87", + "bugs": { + "url": "https://github.com/calvinmetcalf/parse-asn1/issues" + }, + "homepage": "https://github.com/calvinmetcalf/parse-asn1", + "_id": "parse-asn1@3.0.0", + "_shasum": "36ea30eb2ad99084e738e92801647910cdbf1ee4", + "_from": "parse-asn1@>=3.0.0 <4.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "36ea30eb2ad99084e738e92801647910cdbf1ee4", + "tarball": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-3.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-3.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/readme.md b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/readme.md new file mode 100644 index 00000000..c331b806 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/readme.md @@ -0,0 +1,4 @@ +parse-asn1 +=== + +utility library for parsing asn1 files for use with browserify-sign. \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/1024.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/1024.priv new file mode 100644 index 00000000..72062169 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/1024.priv @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKulUTZ8B1qccZ8c +DXRGSY08gW8KvLlcxxxGC4gZHNT3CBUF8n5R4KE30aZyYZ/rtsQZu05juZJxaJ0q +mbe75dlQ5d+Xc9BMXeQg/MpTZw5TAN7OIdGYYpFBe+1PLZ6wEfjkYrMqMUcfq2Lq +hTLdAbvBJnuRcYZLqmBeOQ8FTrKrAgMBAAECgYEAnkHRbEPU3/WISSQrP36iyCb2 +S/SBZwKkzmvCrBxDWhPeDswp9c/2JY76rNWfLzy8iXgUG8WUzvHje61Qh3gmBcKe +bUaTGl4Vy8Ha1YBADo5RfRrdm0FE4tvgvu/TkqFqpBBZweu54285hk5zlG7n/D7Y +dnNXUpu5MlNb5x3gW0kCQQDUL//cwcXUxY/evaJP4jSe+ZwEQZo+zXRLiPUulBoV +aw28CVMuxdgwqAo1X1IKefPeUaf7RQu8gCKaRnpGuEuXAkEAzxZTfMmvmCUDIew4 +5Gk6bK265XQWdhcgiq254lpBGOYmDj9yCE7yA+zmASQwMsXTdQOi1hOCEyrXuSJ5 +c++EDQJAFh3WrnzoEPByuYXMmET8tSFRWMQ5vpgNqh3haHR5b4gUC2hxaiunCBNL +1RpVY9AoUiDywGcG/SPh93CnKB3niwJBAKP7AtsifZgVXtiizB4aMThTjVYaSZrz +D0Kg9DuHylpkDChmFu77TGrNUQgAVuYtfhb/bRblVa/F0hJ4eQHT3JUCQBVT68tb +OgRUk0aP9tC3021VN82X6+klowSQN8oBPX8+TfDWSUilp/+j24Hky+Z29Do7yR/R +qutnL92CvBlVLV4= +-----END PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/1024.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/1024.pub new file mode 100644 index 00000000..2dba785d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/1024.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrpVE2fAdanHGfHA10RkmNPIFv +Cry5XMccRguIGRzU9wgVBfJ+UeChN9GmcmGf67bEGbtOY7mScWidKpm3u+XZUOXf +l3PQTF3kIPzKU2cOUwDeziHRmGKRQXvtTy2esBH45GKzKjFHH6ti6oUy3QG7wSZ7 +kXGGS6pgXjkPBU6yqwIDAQAB +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.1024.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.1024.priv new file mode 100644 index 00000000..1145b7d7 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.1024.priv @@ -0,0 +1,18 @@ +-----BEGIN DSA PARAMETERS----- +MIIBHgKBgQDdFg3WQmpOZxObxraIe4rrbUhrBw99fbnz99IvLj60sM/7Uk7eHYvp +UrPaJBIcjPy68BjV4ekDljuPpFoAorsLzyvVSHuNvN6I/bRGm1TCOjDFVe98Oz6k +XmI6pRfIF0TiIPXkel/sWIfBYa1lqdoW82h9FIjhbxVHrKGfvMEc9wIVAOzmJHec +s6yBm+nE3+OmpWFYj0ylAoGAYxO6mFSoIY7PDRyRzKJEnULSzYXd3FoMkPwDCd5I +ch/piIoAUIIQ542TL54GT9wuiCL+0D48qi9GWKasPZABfPQ008WOzmKzD8ncrUTd +a7pzvUvdmwldA4Aa5/5xSXwtpK+DDye7KPlu+oi1BF6uj4TgfeGr1uxouxC2WhBE +qH0= +-----END DSA PARAMETERS----- +-----BEGIN PRIVATE KEY----- +MIIBSwIBADCCASwGByqGSM44BAEwggEfAoGBAOY0KsTt5EpJ4LtlD3xRS5mDiGE1 +CMNp0S9X0sK8kP8Aps8iYwMLbZYglk18GCNnCk4SjbAnZHSB3kaIv6AKQc2J8W2Y +V5se3VhpKOFst7bqRtkGsl8uJtGlKTiXNclkv2jsKOrsBokSD1USGCECTNeMt3Og +ziRcZ1dS+djSOZ2nAhUAzB96SpxlAak+K/QLVJ+lDe5DcY0CgYEAtxX1/Hckvhlh +HQyKZWLQsDfZBILbhc+OLDpOyT6cJS/sJzfFIYZgK5M3rOS4OmzdYfJccQAuGq+T +VJQ3VcYOdbrIANJV8CDrn4jkkejTzJI6fCwAkPWOyxw8kbV1Hsoy6WLfSCHKpBUc +rogAqRGESqBVTawjyF/ECX667y/P49MEFgIUSeRVRgAXsLmeWR/V4Rh9Hex+9+s= +-----END PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.1024.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.1024.pub new file mode 100644 index 00000000..80a731ea --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.1024.pub @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtzCCASwGByqGSM44BAEwggEfAoGBAOY0KsTt5EpJ4LtlD3xRS5mDiGE1CMNp +0S9X0sK8kP8Aps8iYwMLbZYglk18GCNnCk4SjbAnZHSB3kaIv6AKQc2J8W2YV5se +3VhpKOFst7bqRtkGsl8uJtGlKTiXNclkv2jsKOrsBokSD1USGCECTNeMt3OgziRc +Z1dS+djSOZ2nAhUAzB96SpxlAak+K/QLVJ+lDe5DcY0CgYEAtxX1/HckvhlhHQyK +ZWLQsDfZBILbhc+OLDpOyT6cJS/sJzfFIYZgK5M3rOS4OmzdYfJccQAuGq+TVJQ3 +VcYOdbrIANJV8CDrn4jkkejTzJI6fCwAkPWOyxw8kbV1Hsoy6WLfSCHKpBUcrogA +qRGESqBVTawjyF/ECX667y/P49MDgYQAAoGAXYmxO4+52C1gBzh7GgTwNLJl7bLn +gOhKTFlKhT36VjMjeFfdXmBVBVbfUottKZby/gVX1IXT38PStB/dswbF45bGDdoS +zMFjYmHTtLtrU/4hReVtvb5MYmrPDFX58SwcSRRO/cH6WJPvfu4Aq0cJZA9Kb0B9 +5Wo18JxAqvPtTB8= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.2048.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.2048.priv new file mode 100644 index 00000000..2a77c2ee --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.2048.priv @@ -0,0 +1,20 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIDVQIBAAKCAQEA0jDs9lLWX//NXYE1kNKw4UiDVMHHEtTF1OzJvBJvUh3/xMlU +ic8mUpIMU5mt7BTjcijyLLl/TeNBcI/xDvWH3PAfCjP1CmNzOMHwU6wKA4Q20m5v +zjauVycd7loRm5h+1XyD2JL1KmQTzhIIRAmRTeXMnr8LAHidYfUKmzCOCCrnctlE +EOh1S6e7BFxQBRrlUxZF0LTjcAz31rrjIH6wKkYR4mnpGuI2vVJ+qHGmEhvq1hAb +DvP0GN0iofxHlIVqOlfXYCZO388ZabfcBOQG57tTofm8aS4pnXCgbok9wEYPgbU5 +n6fEvDGOOObQyY109hZZaDJmfygr5mmD0TIXrQIhAMVBhV4liqAN2MrT/+ZUH6hY ++DhTazzSNLIZKQ5gfd+1AoIBADqHGUVQa9pbwyjbzooeWdijUM9W5P7UUj1OjrA0 +HIkcx37qHiYOVFqHpbjDs3tbgRBxBX5zBpwuhywC/6OetDiqzDy7zZCV/YMn06d2 +ncW2Ctjp3KPl7of39+HgXXePgTdKcfkjH9upJQTko88rA4NWwZbHYeA3Lv7DcA11 +XY3+TQHcxMtxf/E6aePjANJBsJsQjYLy3WyUiS87jkgi0Bigjg/cD3Nel4LToCTR +JvQ4m3w3T4W0xL1+8nPjRZ2q0GgmxZzPfwALrwiSYMgGZC/ov43wqOs6WXs0NnpJ +moU4oxutC/uDvTZmJvRj77FINjK0ZA20jmNvWmTIeEm1Xn4CggEABeRpOymQS5IS +X+u9ya7C+P3MPIRGm4dcWPWgPpD1QcclNYLGnhRp7JazNsbbPMjnx1qtF+2qjfy9 +JDeWTAR8qfCNVmQHPAhJsJtV0C/V4PUii71FRNPVC3EAYbcBk8deMGoUg99cxSac +6MCxIIOxuUKWpw8XPlMVpuXc8+lIMTYCPeLGinmT4DQ573t0MS6U3Ck/987xjkH9 +sos7zcYn3vnjywDCxXMidC0eUK1rxAAuY7PL4vQiKwXq8kFtWiKAnns/Zm5LTjiZ +NrwlhNlU2wQVvyIcKaGfSRPheb69IbP+9qp5b7Xe7DNWdo48S0jl2KAFeZ91BnhM +TH6WPtMpjQIgOaTTn6xYK0kZvvH3lZXrzkjp4aNlNY65R0JAKKNsx3s= +-----END DSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.2048.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.2048.pub new file mode 100644 index 00000000..9f6cac1c --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/dsa.2048.pub @@ -0,0 +1,20 @@ +-----BEGIN PUBLIC KEY----- +MIIDRjCCAjkGByqGSM44BAEwggIsAoIBAQDSMOz2UtZf/81dgTWQ0rDhSINUwccS +1MXU7Mm8Em9SHf/EyVSJzyZSkgxTma3sFONyKPIsuX9N40Fwj/EO9Yfc8B8KM/UK +Y3M4wfBTrAoDhDbSbm/ONq5XJx3uWhGbmH7VfIPYkvUqZBPOEghECZFN5cyevwsA +eJ1h9QqbMI4IKudy2UQQ6HVLp7sEXFAFGuVTFkXQtONwDPfWuuMgfrAqRhHiaeka +4ja9Un6ocaYSG+rWEBsO8/QY3SKh/EeUhWo6V9dgJk7fzxlpt9wE5Abnu1Oh+bxp +LimdcKBuiT3ARg+BtTmfp8S8MY445tDJjXT2FlloMmZ/KCvmaYPRMhetAiEAxUGF +XiWKoA3YytP/5lQfqFj4OFNrPNI0shkpDmB937UCggEAOocZRVBr2lvDKNvOih5Z +2KNQz1bk/tRSPU6OsDQciRzHfuoeJg5UWoeluMOze1uBEHEFfnMGnC6HLAL/o560 +OKrMPLvNkJX9gyfTp3adxbYK2Onco+Xuh/f34eBdd4+BN0px+SMf26klBOSjzysD +g1bBlsdh4Dcu/sNwDXVdjf5NAdzEy3F/8Tpp4+MA0kGwmxCNgvLdbJSJLzuOSCLQ +GKCOD9wPc16XgtOgJNEm9DibfDdPhbTEvX7yc+NFnarQaCbFnM9/AAuvCJJgyAZk +L+i/jfCo6zpZezQ2ekmahTijG60L+4O9NmYm9GPvsUg2MrRkDbSOY29aZMh4SbVe +fgOCAQUAAoIBAAXkaTspkEuSEl/rvcmuwvj9zDyERpuHXFj1oD6Q9UHHJTWCxp4U +aeyWszbG2zzI58darRftqo38vSQ3lkwEfKnwjVZkBzwISbCbVdAv1eD1Iou9RUTT +1QtxAGG3AZPHXjBqFIPfXMUmnOjAsSCDsblClqcPFz5TFabl3PPpSDE2Aj3ixop5 +k+A0Oe97dDEulNwpP/fO8Y5B/bKLO83GJ97548sAwsVzInQtHlCta8QALmOzy+L0 +IisF6vJBbVoigJ57P2ZuS044mTa8JYTZVNsEFb8iHCmhn0kT4Xm+vSGz/vaqeW+1 +3uwzVnaOPEtI5digBXmfdQZ4TEx+lj7TKY0= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/ec.pass.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/ec.pass.priv new file mode 100644 index 00000000..bf1836d5 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/ec.pass.priv @@ -0,0 +1,7 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIHeMEkGCSqGSIb3DQEFDTA8MBsGCSqGSIb3DQEFDDAOBAi9LqZQx4JFXAICCAAw +HQYJYIZIAWUDBAECBBA+js1fG4Rv/yRN7oZvxbgyBIGQ/D4yj86M1x8lMsnAHQ/K +7/ryb/baDNHqN9LTZanEGBuyxgrTzt08SiL+h91yFGMoaly029K1VgEI8Lxu5Np/ +A+LK7ewh73ABzsbuxYdcXI+rKnrvLN9Tt6veDs4GlqTTsWwq5wF0C+6gaYRBXA74 +T1b6NykGh2UNL5U5pHZEYdOVLz+lRJL7gYqlweNHP/S3 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/ec.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/ec.priv new file mode 100644 index 00000000..25fffbd8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/ec.priv @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHQCAQEEIDF6Xv8Sv//wGUWD+c780ppGrU0QdZWCAzxAQPQX8r/uoAcGBSuBBAAK +oUQDQgAEIZeowDylls4K/wfBjO18bYo7gGx8nYQRija4e/qEMikOHJai7geeUreU +r5Xky/Ax7s2dGtegsPNsPgGe5MpQvg== +-----END EC PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/ec.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/ec.pub new file mode 100644 index 00000000..2e39e5bb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/ec.pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEIZeowDylls4K/wfBjO18bYo7gGx8nYQR +ija4e/qEMikOHJai7geeUreUr5Xky/Ax7s2dGtegsPNsPgGe5MpQvg== +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/index.js new file mode 100644 index 00000000..2f9a56f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/index.js @@ -0,0 +1,95 @@ +var test = require('tape'); +var fs = require('fs'); +var priv1024 = fs.readFileSync(__dirname + '/rsa.1024.priv'); +var parseKey = require('../'); +var crypto = require('crypto'); +var rsa1024 = { + private: fs.readFileSync(__dirname + '/rsa.1024.priv'), + public: fs.readFileSync(__dirname + '/rsa.1024.pub') +}; +var rsa2028 = { + private: fs.readFileSync(__dirname + '/rsa.2028.priv'), + public: fs.readFileSync(__dirname + '/rsa.2028.pub') +}; +var nonrsa1024 = { + private: fs.readFileSync(__dirname + '/1024.priv'), + public: fs.readFileSync(__dirname + '/1024.pub') +}; +var pass1024 = { + private: { + passphrase: 'fooo', + key:fs.readFileSync(__dirname + '/pass.1024.priv') + }, + public: fs.readFileSync(__dirname + '/pass.1024.pub') +}; +var ec = { + private: fs.readFileSync(__dirname + '/ec.priv'), + public: fs.readFileSync(__dirname + '/ec.pub') +}; +var ecpass = { + private: { + key: fs.readFileSync(__dirname + '/ec.pass.priv'), + passphrase: 'bard' + }, + public: fs.readFileSync(__dirname + '/ec.pub') +}; +var dsa = { + private: fs.readFileSync(__dirname + '/dsa.1024.priv'), + public: fs.readFileSync(__dirname + '/dsa.1024.pub') +}; +var dsa2 = { + private: fs.readFileSync(__dirname + '/dsa.2048.priv'), + public: fs.readFileSync(__dirname + '/dsa.2048.pub') +}; +var dsapass = { + private: { + key:fs.readFileSync(__dirname + '/pass.dsa.1024.priv'), + passphrase:'password' + }, + public: fs.readFileSync(__dirname + '/pass.dsa.1024.pub') +}; +var dsapass2 = { + private: { + key:fs.readFileSync(__dirname + '/pass2.dsa.1024.priv'), + passphrase:'password' + }, + public: fs.readFileSync(__dirname + '/pass2.dsa.1024.pub') +}; +var rsapass = { + private: { + key:fs.readFileSync(__dirname + '/pass.rsa.1024.priv'), + passphrase:'password' + }, + public: fs.readFileSync(__dirname + '/pass.rsa.1024.pub') +}; +var rsapass2 = { + private: { + key:fs.readFileSync(__dirname + '/pass.rsa.2028.priv'), + passphrase:'password' + }, + public: fs.readFileSync(__dirname + '/pass.rsa.2028.pub') +}; +var i = 0; +function testIt(keys) { + test('key ' + (++i), function (t){ + t.plan(2); + t.ok(parseKey(keys.public,crypto), 'public key'); + t.ok(parseKey(keys.private,crypto), 'private key'); + }); +} + + +testIt(dsa); +testIt(dsa2); +testIt(rsa1024); +testIt(ec); +testIt(rsa2028); +testIt(nonrsa1024); +testIt(ecpass); +testIt(dsapass); +testIt(dsapass2); +testIt(rsapass); +testIt(rsapass2); +testIt(pass1024); +testIt(pass1024); + diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.1024.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.1024.priv new file mode 100644 index 00000000..b9f38845 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.1024.priv @@ -0,0 +1,18 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIICzzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQIji3ZZ6JbsA4CAggA +MB0GCWCGSAFlAwQBFgQQC6MKblq8zyX90/KmgotsMQSCAoDghNf+yxPC/KRh7F3O +k0lMgtDkV+wCLDv7aBvUqy8Ry2zqFPIlfLb8XtSW943XEu6KUI13IZPEr8p9h1ve +Iye6L0g6uAgbFxBE2DwBBSI7mYr7lokr4v0k+inMKf4JeRdI9XWgwOILKTGf1vH7 +PhvBnqLhOg6BIOuF426qpiyYlmRda74d0Th4o6ZyhyMSzPI1XbWSg719Ew3N/tLe +OHdYl0eFrgNjq+xO4Ev+W7eNIh/XBMQtk9wo+mxeNdldRnX822HxTsL8fSSPs+9T +W5M/2EBTJMSsswSjZyFkq8ehtxovI2u0IBX1IiPulyUZLnSNPDV1eUVClK6rk+q1 +kVsfJhUr2qvIjNlQWlbEXQj4VwGtgl0++l8vdpj59MuN2J3Nx5TNMLjA6BYAa/tr +Bu928QoT7ET+SGx5XKCwKb5fwXmDlV5zZC4kZWTaF/d/Icvj5F+fDZuYFg1JOXNZ ++q2oA1qMYaHGX6lF3pbO84ebg1iwQTDM8iIqFeSMGUJTnk/3a7sqfaWQbEQwGb+X +fXnSTwkF+wO2rriPbFvWyzecWu67zDCP0ZWUgGb86sSJCM7xRGShESwCjOrb88F1 +5SZjyIqogrkc3IWiLH9gc5U8d86qoFjJnP6BfwYks1UIyXNGKfZTCqICpMphV+IS +b0N2jprjLTkWR6nxYGSH1bkKMs7x1M0FBLWWLAZqPn9X3pe6JwIBds04O6XjF0un +oxwDjcJdoxVs7PgRiM5d1Tubqu2zmpCCmXNiqi9B0+rV9/jHg9IA5gUfvYdCcEv+ +oAr90I+2+PuBFa9lgdbDV6DtZk4bSYluqamxVeLPg/vrewYfVfDv6jftfY1D0DEy +69H0 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.1024.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.1024.pub new file mode 100644 index 00000000..617e7fb1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.1024.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDSK/7i5BV0x+gmX16Wrm7kRkCZ +y1QUt6wiM2g+SAZTYR0381VnSMX2cv7CpN3499lZj1rL5S7YTaZZwX3RvU5fz56/ +eDX6ciL/PZsbclN2KdkMWYgmcb9J1zUeoMQ3cjfFUCdQZ/ZvDWa+wY2Zg8os2Bow +AoufHtYHm3eOly/cWwIDAQAB +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.dsa.1024.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.dsa.1024.priv new file mode 100644 index 00000000..aab5fc2f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.dsa.1024.priv @@ -0,0 +1,11 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBnzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQI1z4IJORFws4CAggA +MB0GCWCGSAFlAwQBAgQQq7f0CuKCTITfPS5Xax1H4wSCAVDFyIjYVXfBNe+BARqz +Tfo09y4vKkErOb7Sz4bQkAjRLjOXiUjM4eTNtivml8NqVrQTKAghN+ggxj416OD4 +oq6Ns7Ncbd4Xm5Ni8wrrWbJxVog6rAa/ioU0sfgRExYy/xE2Q9KkW+VE7SUwanwY +e81Od9qNM5KhZGM1yUSKa0JA6Xqb8dAqBo9rVt8DceumB9OP83xV3fLEimSZfR6p +slA1P/dTvKxwhpguQe4Z3OkzTzGCxyboqeRW1woNHKbxjzzSHcaki9SHQm3xpUW8 +hRAJd6OtDnLbkE9MnC+UcI3mjru1xfnR5MU7qG7e9nvOhEDVaDkiK3DbrSf0B0Bi +p1hyX1XsSXDewSEd/mlfMLdD8WecgUtl9ea7JzxY3/6R78yB951I5TmY45mp/v+N +tbxEv29B65UKf0ac7gVw4LNy8JF2ef/L/meEmBoIAE71f+8= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.dsa.1024.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.dsa.1024.pub new file mode 100644 index 00000000..80a731ea --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.dsa.1024.pub @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtzCCASwGByqGSM44BAEwggEfAoGBAOY0KsTt5EpJ4LtlD3xRS5mDiGE1CMNp +0S9X0sK8kP8Aps8iYwMLbZYglk18GCNnCk4SjbAnZHSB3kaIv6AKQc2J8W2YV5se +3VhpKOFst7bqRtkGsl8uJtGlKTiXNclkv2jsKOrsBokSD1USGCECTNeMt3OgziRc +Z1dS+djSOZ2nAhUAzB96SpxlAak+K/QLVJ+lDe5DcY0CgYEAtxX1/HckvhlhHQyK +ZWLQsDfZBILbhc+OLDpOyT6cJS/sJzfFIYZgK5M3rOS4OmzdYfJccQAuGq+TVJQ3 +VcYOdbrIANJV8CDrn4jkkejTzJI6fCwAkPWOyxw8kbV1Hsoy6WLfSCHKpBUcrogA +qRGESqBVTawjyF/ECX667y/P49MDgYQAAoGAXYmxO4+52C1gBzh7GgTwNLJl7bLn +gOhKTFlKhT36VjMjeFfdXmBVBVbfUottKZby/gVX1IXT38PStB/dswbF45bGDdoS +zMFjYmHTtLtrU/4hReVtvb5MYmrPDFX58SwcSRRO/cH6WJPvfu4Aq0cJZA9Kb0B9 +5Wo18JxAqvPtTB8= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.1024.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.1024.priv new file mode 100644 index 00000000..b67bd804 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.1024.priv @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-CBC,04D2D7882E0C474E07E542FE997D2A49 + +vfB5Gtm34n3SeI6JELjWiGw6O+j+tGR6Wbi3SNeAZkfSA8PTjei6PVHr+dGK5zMd +nTckd0EpxItqxEdtLK6GtBIa9KRd3cEbayHmyyybH2FC4STXJCUFBe2eb7ZKmnCl +RB5FcmAqExif+QOJwHnZw6DTzq+oGSwi9cSoy2qE62FgXkj8uKAYcBLONmsP1YQA +4zIub4bnEbIghL/swEB/HVS86FyMCsMXrHEOnSuUUBf/UfZFNypI6kVUNXlItnN1 +14eeRsBD37VkL7dAQPMx+Dwm7DbU07QWrVvzgmWlu3KqR0tRNA9e4a5f14XOYxgS +HZ+XVZK8iAd+76OnprlFtGDowDXGM0wUXPYq5j8WpKxNsVs2RV+S6U0gQLoSqNxt +We7UPWZufzEdjTUO8q9KhdGqFmJ53XIYClZf0bp148b+Bk3P+dN5TbmKQEfulScn +rTLTRo34fdTIAJr5BJh0OXGNs9rFlMJ9Nz4FwVTEB1DMerXtt9ICdhud9BktRhvq +axgoz+XA3LrBrlPPcrSCZyIYjZFydGSkzg439OyDEZ6+uRmc0qhWA4j6AgXx6gGR +NvvypoFVKvXqEq/2F+SVyyMGrm4xPmsr/HUBeE9SmuTzNzDfVAM/xerqIoR2szR0 +O0hwtOj4fk7//cd1CjFzd0JiF/SqMkHxkdbmIC9qlhshkWlQbvvhbefodYPuGxmj +L1TaPgX36OcrQSodzyWBN5tSmmX1Nmftcz7iwc4AKrqkdnM3sPS3SczsAjMWrjRr +7iYhdPQSZtxVCTjACU3h7scNAg9AU6l4YZrowR//J6U= +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.1024.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.1024.pub new file mode 100644 index 00000000..3506c331 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.1024.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGcMA0GCSqGSIb3DQEBAQUAA4GKADCBhgJ/OwswbFo/uyC8ltGf/yA1A+gV5IGd +nAgPbUSI3GzbHCA+x+TLG/tLvbRw3r1smppY/jkkpiVW1ErSMuN0uixp5gb78Z9r +H1XpWb5WWgp3WaY/9EHMjMdOkQ/9LVZvRvl/M/Fi6owP+q+amJI1BEjECYfbhGL3 +rmlVdq4qXc40QwIDAQAB +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.2028.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.2028.priv new file mode 100644 index 00000000..99e82135 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.2028.priv @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,7A6A055AD675947A657041422F06D439 + +HQdjzAKUuqqKhZHmpzzY/monfqFhiHnZ5c24jtR9fM4aQJXf/e1fz6MEhyIz6XON +sb4CnXZstnxUuVWDkHEu6KWQ/dKALgiDUuT+UdMawVoVPGdgyWZp35pQPWi3fT2V +XZn58YkG8bO3Y403eZPyhadOefD1VtuFuK6/f90jjzx6ZDnwveXpYgFV7Jy1/pFd +cLLMf07C+hbk416nX6UVipWe4GH+ADFom5ZCfAaUotM7n8i149dULNF4YYi2wP31 +1YaDH5vf1CqiaieDY7xLzpEixwJz6ZEg3gLXaUvz2MpF8owiGI3eP0g7voWp3xt4 +TQx/qDURlaXiaRriWdWtpKyW1MFuJ5+KdNtR1/kXr2BLPB/ZLwyqtynUy8ZYpb4+ +WIRYpUGeb//ZHGhlCH7CRMdABsal4wTwnzi9fW4Ax96ecJ2SlwCuKxwS7iEq2y1/ +FAfGwsE+XufHhme5p6XjKfiHx+zJMIB2NMkrm+wm4PbMTrGVnw5/41/r6XxOB8fe +iKi12Jth4dusc1vYGYfzKop9uEM6CZ6+Chqzb+Zyh/xUiZVlCX/BYnxr7yXUm9aR +PHQgxkn2Act8FgQB3Kgs3jCiCRIJrlsnybeWzQ3YO9TjC4MxygmmwODDBpsOKnEi +kXXS54+cZFjcsva4uJVwhAywRPVUkLzmTkH0tGiwCHjeQNECm+TLahkkEIXrVTb9 +c9creNXMgE6jVVz+R43HXsGvTcgMcBLyFRQJe2nVaj/dQ5JbF4uqNnQzRjAbD34K +uTpFaJ/kmlgcmeScRLnwaoYwFlmhSC+bK0dfY1Jr6AQRA6IDP7nIjqWNDCHNBB8r +Qj1v2KWoVQe3xNHaXhkbJPbA2DKlUIqffkBVtMKtt9KuG3Rccf3bVYAW6oid73/D +z7DMAF5G/OpVR8VbGh1WxXuR7zEVDUwpwsp9ek5dqN8BnBz1ppdZNIKqzszneckU +s2l/6mZBmgV1Nfy/cQU6U5s3S1Xc75UDQVLms3CIOpFTRIpecNTdfa31fYy/svy0 +M2lWTbCva0dOyuvMUhTgBL4I7Qa2dUMPXHMZatV5ooHYq/BZJA1r84C5cM5r+umE +2LLv/BlUr7RaQHhaKGn4Qhpzo5yRDE9mEqDpLVkbg8SxMsdf/pEF5/VyUwA9t8RT +fKVsInRd386tDqJSDbSFqKTvLztr/5YCyzZzvC2YB1voko/caOGd2d/G51Ij+bXU +xEN8U4fHDBsHwPUGb31uZUhTXpL37KiOqZmXFoH2usmuvx882XvyGcV0F4tstMaR +KLKzl2PwqzAYGFexLkYKMz0TYIeN6h3b86ETazPPU49nkaEU23Dx21J2Rb3UlH+I +lDQF3wuH1QlYiTnlcVa/Zu4QQg0/iP8ALkZ06mvn9e9mOtnA8gsh4B2oLqc19VLU +bcpv40dV1H3W9Lcx9B8JYUp0c/Oyno1D7Yj3tjGcwMKECmUpHi4kksehVo0/P933 +xmFmC6eyWYVdO9upvY/vKSB7b1dMt85iWr3gnMsSfRYc6jsbSxdjOPST46UsIzjx +wa1DS6+Bv5tiaC4uC6X+0tCAZo+UOQMYUbTGRR/7g/c= +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.2028.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.2028.pub new file mode 100644 index 00000000..655cc3a4 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass.rsa.2028.pub @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBHjANBgkqhkiG9w0BAQEFAAOCAQsAMIIBBgKB/gy7mjaWgPeFdVYDZWRCA9BN +iv3pPb0es27+FKY0hszLaOw47ExCtAWpDsH48TXAfyHBYwBLguayfk4LGIupxb+C +GMbRo3xEp0CbfY1Jby26T9vGjRC1foHDDUJG84uaRbyHqaf4i6zt4gVR+xlAEIjk +aFAAK8cOoXAT1CVqGLLljUCchL8PjaHj/yriZ/S7rdwlI3LnABxwwmLrmR/v71Wt +pmO/aNG8N+1po+QwaghTkyQ59E/ZvAuOkFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQ +aEDRbBFBmBqTv5fFGfk2WsAfKf/RG0/VFd+ZeM5251TeTvXH695nlSGauVl9AgMB +AAE= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass2.dsa.1024.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass2.dsa.1024.priv new file mode 100644 index 00000000..29e36734 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass2.dsa.1024.priv @@ -0,0 +1,15 @@ +-----BEGIN DSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,DC173C6DFD455EBE462A35D6AB9A603A + +FoC3sxbdUFJTaNtRpooMxaX2lcQRLUz8qcRhzDBn5a1kaMHp2JM3KlHK5aauybT4 +ilmlKJ9sSm8pFLAWPKbkczSgZ+X6p/51v4zaEJSebZ98p32kQk87XJQE7aYroxYV +UfM5PSOoKWilj+LZQQEXV10qDoYGrnbSdoNSxYW5V1a1aP+ua0EO7m9MUYkoLxi3 +SJ/s2h/5KM3TOz7d7DOZuSoNm+0n6YC4aqQnR3lmEtAXEYLQqLhH2Q3FTKTHwBQw +HgMBAzcXOS1YSw6Ekwh1eZamizrOEC4I6oZEHoUBqRfbsQ8tu77kDq2ovQSyn8Fp +SeE64m3GgZOYdfcDuNZ0ccmm3shBBfTfD9AwR+1thklKO3oaaLEHb6TmnkD79rEz +9WsiVxoN7vqqWdgoeyl7REOB6WLQp8kYS4FoRG0QB/ZS8Hs/Tf17QPnrQNiMkvP7 +sJSHmlaMKXjWXK0VoN94kfZKUXwkzLD1VXuXFCnUkznWU0tahYi06b8/SVXc6EG+ +0mzylckH7UnjOQfxSFAlZ+e/PiX80tcPakxYbk+f1Nv7L0NOyhrDv18KUbv9mEpV +Ysild1m7/QSF0u1qmjmGNQ== +-----END DSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass2.dsa.1024.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass2.dsa.1024.pub new file mode 100644 index 00000000..80a731ea --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/pass2.dsa.1024.pub @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtzCCASwGByqGSM44BAEwggEfAoGBAOY0KsTt5EpJ4LtlD3xRS5mDiGE1CMNp +0S9X0sK8kP8Aps8iYwMLbZYglk18GCNnCk4SjbAnZHSB3kaIv6AKQc2J8W2YV5se +3VhpKOFst7bqRtkGsl8uJtGlKTiXNclkv2jsKOrsBokSD1USGCECTNeMt3OgziRc +Z1dS+djSOZ2nAhUAzB96SpxlAak+K/QLVJ+lDe5DcY0CgYEAtxX1/HckvhlhHQyK +ZWLQsDfZBILbhc+OLDpOyT6cJS/sJzfFIYZgK5M3rOS4OmzdYfJccQAuGq+TVJQ3 +VcYOdbrIANJV8CDrn4jkkejTzJI6fCwAkPWOyxw8kbV1Hsoy6WLfSCHKpBUcrogA +qRGESqBVTawjyF/ECX667y/P49MDgYQAAoGAXYmxO4+52C1gBzh7GgTwNLJl7bLn +gOhKTFlKhT36VjMjeFfdXmBVBVbfUottKZby/gVX1IXT38PStB/dswbF45bGDdoS +zMFjYmHTtLtrU/4hReVtvb5MYmrPDFX58SwcSRRO/cH6WJPvfu4Aq0cJZA9Kb0B9 +5Wo18JxAqvPtTB8= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.1024.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.1024.priv new file mode 100644 index 00000000..d3b5fdab --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.1024.priv @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICVAIBAAJ/OwswbFo/uyC8ltGf/yA1A+gV5IGdnAgPbUSI3GzbHCA+x+TLG/tL +vbRw3r1smppY/jkkpiVW1ErSMuN0uixp5gb78Z9rH1XpWb5WWgp3WaY/9EHMjMdO +kQ/9LVZvRvl/M/Fi6owP+q+amJI1BEjECYfbhGL3rmlVdq4qXc40QwIDAQABAn8I +VZ0BPoAOhyF33KFMHxy8r28fsVgxJUYgM3NqQgdv4fFawCYXjhJz9duU5YJGFJGJ +WUGeHlkyYFlpi4f3m7tY7JawmQUWB0MNSoKHI3cgDX4/tfBN8ni+cO0eSoR5czBY +EsAHBU47p1awNFAHwd+ZEuv9H4RmMn7p279rQTtpAkAH3Nqs2/vrRF2cZUN4fIXf +4xHsQBByUayGq8a3J0UGaSFWv68zTUKFherr9uZotNp7NJ4jBXiARw0q8docXUG1 +AkAHgmOKHoORtAmikqpmFEJZOtsXMaLCIm4EszPo5ciYoLMBcVit09AdiQlt7ZJL +DY02svU1b0agCZ97kDkmHDkXAkACa8M9JELuDs/P/vIGYDkMVatIFfW6bWF02eFG +taWwMqCcSEsWvbw0xqYt34jURpNbCjmCyQVwYfAw/+TLhP9dAkAFwRjdwjw37qpj +ddg1mNiu37b7swFxmkiMOXZRxaNNsfb56A14RpN3zob3QdGUybGodMIKTFbmU/lu +CjqAxafJAkAG2yf6RWbwFIWfMyt7WYCh0VaGBCcgy574AinVieEo3ZZyFfC63+xm +3uoaNy4iLoJv4GCjqUBz3ZfcVaO/DDWG +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.1024.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.1024.pub new file mode 100644 index 00000000..7ba06369 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.1024.pub @@ -0,0 +1,5 @@ +-----BEGIN RSA PUBLIC KEY----- +MIGGAn87CzBsWj+7ILyW0Z//IDUD6BXkgZ2cCA9tRIjcbNscID7H5Msb+0u9tHDe +vWyamlj+OSSmJVbUStIy43S6LGnmBvvxn2sfVelZvlZaCndZpj/0QcyMx06RD/0t +Vm9G+X8z8WLqjA/6r5qYkjUESMQJh9uEYveuaVV2ripdzjRDAgMBAAE= +-----END RSA PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.2028.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.2028.priv new file mode 100644 index 00000000..10e651d8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.2028.priv @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEjwIBAAKB/gy7mjaWgPeFdVYDZWRCA9BNiv3pPb0es27+FKY0hszLaOw47ExC +tAWpDsH48TXAfyHBYwBLguayfk4LGIupxb+CGMbRo3xEp0CbfY1Jby26T9vGjRC1 +foHDDUJG84uaRbyHqaf4i6zt4gVR+xlAEIjkaFAAK8cOoXAT1CVqGLLljUCchL8P +jaHj/yriZ/S7rdwlI3LnABxwwmLrmR/v71WtpmO/aNG8N+1po+QwaghTkyQ59E/Z +vAuOkFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQaEDRbBFBmBqTv5fFGfk2WsAfKf/R +G0/VFd+ZeM5251TeTvXH695nlSGauVl9AgMBAAECgf4LrWHY/l54ouThZWvvbrug +pfz6sJX2g9l7yXmWlEWsPECVo/7SUbpYFpt6OZy99zSg+IKbGqWKfdhoKrTwIVtC +L0YZ0NlmdnANSIz0roxQG7ZxkL5+vHSw/PmD9x4Uwf+Cz8hATCmNBv1qc60dkyuW +4CLqe72qaTiVWRoO1iagQghNcLoo6vSy65ExLaCDTPha7yu2vw4hFZpWiEjW4dxf +rFdLiix52BC86YlAlxME/rLg8IJVvilbyo9aWdXmxOaUTLRv6PkFD1/gVdw8V9Qr +SLN9FlK2kkjiX0dzoibvZw3tMnt3yydAx0X87+sMRVahC1bp3kVPz4Hy0EWX4QJ/ +PM31vGiuITk2NCd51DXt1Ltn2OP5FaJSmCaEjh0XkU4qouYyjXWt8Bu6BTCl2vua +Fg0Uji9C+IkPLmaUMbMIOwaTk8cWqLthSxsLe70J5OkGrgfKUM/w+BHH1Pt/Pjzj +C++l0kiFaOVDVaAV9GpLPLCBoK/PC9Rb/rxMMoCCNwJ/NZuedIny2w3LMii77h/T +zSvergNGhjY6Rnva8lLXJ6dlrkcPAyps3gWwxqj4NR0T+GM0bDUPVLb7M07XV7SX +v7VJGm52JbRGwM1ss+r8XTTNemeGk+WRxG7TgtsMqYGXLfB8Qxk/f5/Mcc00Tl8u +wXFNsfxJxmt6AbsTr3g36wJ/IhOnibz9Ad+nchlBnN3QeW3CKHqzaR18voqvtVm2 +kJfHK15prH/sSGmxmiEGgrCJTZxtDbaNCO7/VBjnKudUUIhCAwsLtuq0/zub9vAd +8G1scfIpv5qaSNzmKoX8bOwArvrS6wP7yKrcTsuWIlHD8rJVI7IEDnQoTp5G8fK1 +hwJ/MIh8M5v0r5dUYEv6oIJWGcle6AH1JmsP5WIafgq72Z2288pHcCFHwNY8Dg9J +76QswVLnUhPTlmm3EOOPGEtam2iAD5r0Afytlb4lbNoQsj2szeXONDXB+6oueajh +VNELUr8HcSP5lgzRZjJW6aFIzj9LDRmQnUAOjGSXVOQtEwJ/MCQZ7N/v4dIKeDRA +8d8UExZ3+gGHumziztGRJ0tQryZH2PakP5I7V+1l7qEUnJ2c3mF+e1v41Ep9LCvh +bzrPKw9dxh18g4b+7bMpsWPnsraKh6ipxc7aaOaZV0Dxgez4zcZu0P1olO0cN3KM +nxJ0Pds3R8bAhNCDdS2JZaRp5Q== +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.2028.pub b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.2028.pub new file mode 100644 index 00000000..b36dca4d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/rsa.2028.pub @@ -0,0 +1,8 @@ +-----BEGIN RSA PUBLIC KEY----- +MIIBBgKB/gy7mjaWgPeFdVYDZWRCA9BNiv3pPb0es27+FKY0hszLaOw47ExCtAWp +DsH48TXAfyHBYwBLguayfk4LGIupxb+CGMbRo3xEp0CbfY1Jby26T9vGjRC1foHD +DUJG84uaRbyHqaf4i6zt4gVR+xlAEIjkaFAAK8cOoXAT1CVqGLLljUCchL8PjaHj +/yriZ/S7rdwlI3LnABxwwmLrmR/v71WtpmO/aNG8N+1po+QwaghTkyQ59E/ZvAuO +kFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQaEDRbBFBmBqTv5fFGfk2WsAfKf/RG0/V +Fd+ZeM5251TeTvXH695nlSGauVl9AgMBAAE= +-----END RSA PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/vector.js b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/vector.js new file mode 100644 index 00000000..164ced12 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/vector.js @@ -0,0 +1,7 @@ +module.exports = { + p : new Buffer('86F5CA03DCFEB225063FF830A0C769B9DD9D6153AD91D7CE27F787C43278B447E6533B86B18BED6E8A48B784A14C252C5BE0DBF60B86D6385BD2F12FB763ED8873ABFD3F5BA2E0A8C0A59082EAC056935E529DAF7C610467899C77ADEDFC846C881870B7B19B2B58F9BE0521A17002E3BDD6B86685EE90B3D9A1B02B782B1779', 'hex'), + q : new Buffer('996F967F6C8E388D9E28D01E205FBA957A5698B1', 'hex'), + g : new Buffer('07B0F92546150B62514BB771E2A0C0CE387F03BDA6C56B505209FF25FD3C133D89BBCD97E904E09114D9A7DEFDEADFC9078EA544D2E401AEECC40BB9FBBF78FD87995A10A1C27CB7789B594BA7EFB5C4326A9FE59A070E136DB77175464ADCA417BE5DCE2F40D10A46A3A3943F26AB7FD9C0398FF8C76EE0A56826A8A88F1DBD', 'hex'), + x : new Buffer('411602CB19A6CCC34494D79D98EF1E7ED5AF25F7', 'hex'), + y : new Buffer('5DF5E01DED31D0297E274E1691C192FE5868FEF9E19A84776454B100CF16F65392195A38B90523E2542EE61871C0440CB87C322FC4B4D2EC5E1E7EC766E1BE8D4CE935437DC11C3C8FD426338933EBFE739CB3465F4D3668C5E473508253B1E682F65CBDC4FAE93C2EA212390E54905A86E2223170B44EAA7DA5DD9FFCFB7F3B', 'hex') +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/vector.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/vector.priv new file mode 100644 index 00000000..178bd1e6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/vector.priv @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBugIBAAKBgQCG9coD3P6yJQY/+DCgx2m53Z1hU62R184n94fEMni0R+ZTO4ax +i+1uiki3hKFMJSxb4Nv2C4bWOFvS8S+3Y+2Ic6v9P1ui4KjApZCC6sBWk15Sna98 +YQRniZx3re38hGyIGHC3sZsrWPm+BSGhcALjvda4ZoXukLPZobAreCsXeQIVAJlv +ln9sjjiNnijQHiBfupV6VpixAoGAB7D5JUYVC2JRS7dx4qDAzjh/A72mxWtQUgn/ +Jf08Ez2Ju82X6QTgkRTZp9796t/JB46lRNLkAa7sxAu5+794/YeZWhChwny3eJtZ +S6fvtcQyap/lmgcOE223cXVGStykF75dzi9A0QpGo6OUPyarf9nAOY/4x27gpWgm +qKiPHb0CgYBd9eAd7THQKX4nThaRwZL+WGj++eGahHdkVLEAzxb2U5IZWji5BSPi +VC7mGHHARAy4fDIvxLTS7F4efsdm4b6NTOk1Q33BHDyP1CYziTPr/nOcs0ZfTTZo +xeRzUIJTseaC9ly9xPrpPC6iEjkOVJBahuIiMXC0Tqp9pd2f/Pt/OwIUQRYCyxmm +zMNElNedmO8eftWvJfc= +-----END DSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/vector2.priv b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/vector2.priv new file mode 100644 index 00000000..ef53f614 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/node_modules/parse-asn1/test/vector2.priv @@ -0,0 +1,19 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIDVQIBAAKCAQEAnbb7WVG2a7b+HhQPHSzlUCN0Fh/WU43xZIIYZC8LXEjI96Qa +rfoYcyS4dnT6GCKwDx7PgTaUPXxVdXJk5aGkT/4BLpk24AwdPpMQsBx9F5gF0wWL +Kp9Ltvlxa/5hF8a1s8xNm+NBEErUqArWyU4AX0uZPhTwketRdDvzMFDDjeI1Vn4b +NMPWpcDOqhoPNoITw9GYQ9C0sJ3Ln8ctOcjeQfG/FNS7RWPKKDcWIcrTMktqLTkh +Rb6/rHSIBSNvXKL+krhxzY+cNtMpK1UJyoyqd6Kt/Hv9d92m9xElp0Vv6hU+QzJW +oiYcagbtNpN5fnmV+tWqu8++PtonQeN1QEriWwIhAPLDEZN0znbJNWmQtGU3Shfy +P57TUIm9lp9hxt3pmYwfAoIBAFx/9rBvjxQ/6CiEM0k+R2nE2Yis5b4loOJICWcH +FsYT17DO5pMvj6p8RNLLJFI9pT++T27DWViS0apYxDKKBsRqFWYufqpwOh3s+Luy +0F2+LrlWwUKjOGYdEEYcDRNUcghQV/NJQwn/pzxhH3izKtu1dAw2HJ81vpCZfbIB +Ti71qmF4L1Kr64vWQyxN0Je8VCOyhdr7YNw2ToFh9KKjWso6ELHE0gPMdqRwozr9 +y92SlZhZq9i1bhclJS146sZucbqa4/HdJIcZmHQ5PNTYMhhoAGVHYOHjTAnk0VUX +n57A3ERz+Za9zm7tHKvti28Rb3rZz1Bd8PmY40qydRSw/+cCggEAZnCYxlRCbHjX ++CAerGwgPvAw1DYFAywvH6k35SN9vZSfNKCiVk/hJtyLcVxRQYAs4JecgkZGPEDm +tr2qJRP6YRcocWwuT9U7yVuJ5plJ2WUS6HO5yPjf1JnMMSiCVhreyzH2WOk0wMGX +8sTZawXLrWc4Hnt2iJHk2jhD0k2UzftRJum4vyHoNY7g4KMO8T/WpmTA3ONzH3+0 +mkhFpP2CVGh5cqLTglmcm6xODteZgZMHiRMDJVgTSXZBC4nSwXHRI6w1/ZdyGVl6p9FcGppCjlkZT3XHIevLz65EaWpJmvp04EKZ8TICZgFjjLh6t5GQ1KCYY +xXajuxlYck4mWvq3wIgacdUjCHQ3+prmlHJ6tTifDPTs/GAMW5byrkskz8OTbw= +-----END DSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/package.json b/node_modules/crypto-browserify/node_modules/browserify-sign/package.json new file mode 100644 index 00000000..1407ba49 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/package.json @@ -0,0 +1,72 @@ +{ + "name": "browserify-sign", + "version": "3.0.1", + "description": "browserify-sign [![Build Status](https://travis-ci.org/crypto-browserify/browserify-sign.svg)](https://travis-ci.org/crypto-browserify/browserify-sign) ===", + "main": "index.js", + "browser": "browser.js", + "scripts": { + "test": "node test/index.js | tspec" + }, + "repository": { + "type": "git", + "url": "git://github.com/crypto-browserify/browserify-sign.git" + }, + "author": "", + "license": "ISC", + "dependencies": { + "bn.js": "^1.0.0", + "browserify-rsa": "^2.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^1.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^3.0.0" + }, + "devDependencies": { + "tap-spec": "^1.0.1", + "tape": "^3.0.3" + }, + "gitHead": "7846def389d0de3ed38b3e0debe80533728cf751", + "bugs": { + "url": "https://github.com/crypto-browserify/browserify-sign/issues" + }, + "homepage": "https://github.com/crypto-browserify/browserify-sign", + "_id": "browserify-sign@3.0.1", + "_shasum": "e1bdf7ca50d575d22e57705c60b3033846dc96bf", + "_from": "browserify-sign@>=3.0.1 <4.0.0", + "_npmVersion": "2.7.0", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "e1bdf7ca50d575d22e57705c60b3033846dc96bf", + "tarball": "http://registry.npmjs.org/browserify-sign/-/browserify-sign-3.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-3.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/readme.md b/node_modules/crypto-browserify/node_modules/browserify-sign/readme.md new file mode 100644 index 00000000..cbfd51c6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/readme.md @@ -0,0 +1,18 @@ +browserify-sign [![Build Status](https://travis-ci.org/crypto-browserify/browserify-sign.svg)](https://travis-ci.org/crypto-browserify/browserify-sign) +=== + +a package to duplicate the functionality of node's crypto public key functions, much of this is based on [Fedor Indutny's](https://github.com/indutny) work on [tls.js](https://github.com/indutny/tls.js). + +# done + +- basic rsa signing and verifying with the right api + +# todo + +- ~~tests to make sure we actually did it~~ +- ~~chinese remainder theorom?~~ +- ~~eliptical curve signing~~ +- ~~publicEncrypt and privateDecrypt?~~ (out of scope) +- ~~other key encodings (non rss format public keys)~~ +- dsa keys? +- ~~keys with passwords~~ \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/sign.js b/node_modules/crypto-browserify/node_modules/browserify-sign/sign.js new file mode 100644 index 00000000..ec1244c7 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/sign.js @@ -0,0 +1,174 @@ +// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var parseKeys = require('parse-asn1') +var BN = require('bn.js') +var elliptic = require('elliptic') +var crt = require('browserify-rsa') +var createHmac = require('create-hmac') +var curves = require('./curves') + +module.exports = sign +function sign (hash, key, hashType, signType) { + var priv = parseKeys(key) + if (priv.curve) { + if (signType !== 'ecdsa') { + throw new Error('wrong public key type') + } + return ecSign(hash, priv) + } else if (priv.type === 'dsa') { + return dsaSign(hash, priv, hashType) + if (signType !== 'dsa') { + throw new Error('wrong public key type') + } + } else { + if (signType !== 'rsa') { + throw new Error('wrong public key type') + } + } + var len = priv.modulus.byteLength() + var pad = [ 0, 1 ] + while (hash.length + pad.length + 1 < len) { + pad.push(0xff) + } + pad.push(0x00) + var i = -1 + while (++i < hash.length) { + pad.push(hash[i]) + } + + var out = crt(pad, priv) + return out +} +function ecSign (hash, priv) { + var curveId = curves[priv.curve.join('.')] + if (!curveId) + throw new Error('unknown curve ' + priv.curve.join('.')) + + var curve = new elliptic.ec(curveId) + + var key = curve.genKeyPair() + key._importPrivate(priv.privateKey) + var out = key.sign(hash) + return new Buffer(out.toDER()) +} +function dsaSign (hash, priv, algo) { + var x = priv.params.priv_key + var p = priv.params.p + var q = priv.params.q + var montq = BN.mont(q) + var g = priv.params.g + var r = new BN(0) + var k + var H = bits2int(hash, q).mod(q) + var s = false + var kv = getKey(x, q, hash, algo) + while (s === false) { + k = makeKey(q, kv, algo) + r = makeR(g, k, p, q) + s = k.invm(q).imul(H.add(x.mul(r))).mod(q) + if (!s.cmpn(0)) { + s = false + r = new BN(0) + } + } + return toDER(r, s) +} +function toDER (r, s) { + r = r.toArray() + s = s.toArray() + + // Pad values + if (r[0] & 0x80) + r = [ 0 ].concat(r) + // Pad values + if (s[0] & 0x80) + s = [0].concat(s) + + var total = r.length + s.length + 4 + var res = [ 0x30, total, 0x02, r.length ] + res = res.concat(r, [ 0x02, s.length ], s) + return new Buffer(res) +} +module.exports.getKey = getKey +function getKey (x, q, hash, algo) { + x = new Buffer(x.toArray()) + if (x.length < q.byteLength()) { + var zeros = new Buffer(q.byteLength() - x.length) + zeros.fill(0) + x = Buffer.concat([zeros, x]) + } + var hlen = hash.length + var hbits = bits2octets(hash, q) + var v = new Buffer(hlen) + v.fill(1) + var k = new Buffer(hlen) + k.fill(0) + k = createHmac(algo, k) + .update(v) + .update(new Buffer([0])) + .update(x) + .update(hbits) + .digest() + v = createHmac(algo, k) + .update(v) + .digest() + k = createHmac(algo, k) + .update(v) + .update(new Buffer([1])) + .update(x) + .update(hbits) + .digest() + v = createHmac(algo, k) + .update(v) + .digest() + return { + k: k, + v: v + } +} +function bits2int (obits, q) { + var bits = new BN(obits) + var shift = (obits.length << 3) - q.bitLength() + if (shift > 0) { + bits.ishrn(shift) + } + return bits +} +function bits2octets (bits, q) { + bits = bits2int(bits, q) + bits = bits.mod(q) + var out = new Buffer(bits.toArray()) + if (out.length < q.byteLength()) { + var zeros = new Buffer(q.byteLength() - out.length) + zeros.fill(0) + out = Buffer.concat([zeros, out]) + } + return out +} +module.exports.makeKey = makeKey +function makeKey (q, kv, algo) { + var t + var k + while (true) { + t = new Buffer('') + while (t.length * 8 < q.bitLength()) { + kv.v = createHmac(algo, kv.k) + .update(kv.v) + .digest() + t = Buffer.concat([t, kv.v]) + } + k = bits2int(t, q) + kv.k = createHmac(algo, kv.k) + .update(kv.v) + .update(new Buffer([0])) + .digest() + kv.v = createHmac(algo, kv.k) + .update(kv.v) + .digest() + if (k.cmp(q) === -1) { + return k + } + } +} +function makeR (g, k, p, q) { + return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q) +} diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/test/fixtures.json b/node_modules/crypto-browserify/node_modules/browserify-sign/test/fixtures.json new file mode 100644 index 00000000..353f3db4 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/test/fixtures.json @@ -0,0 +1,587 @@ +{ + "valid": { + "ec": [ + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQnR6Q0NBU3dHQnlxR1NNNDRCQUV3Z2dFZkFvR0JBT1kwS3NUdDVFcEo0THRsRDN4UlM1bURpR0UxQ01OcAowUzlYMHNLOGtQOEFwczhpWXdNTGJaWWdsazE4R0NObkNrNFNqYkFuWkhTQjNrYUl2NkFLUWMySjhXMllWNXNlCjNWaHBLT0ZzdDdicVJ0a0dzbDh1SnRHbEtUaVhOY2xrdjJqc0tPcnNCb2tTRDFVU0dDRUNUTmVNdDNPZ3ppUmMKWjFkUytkalNPWjJuQWhVQXpCOTZTcHhsQWFrK0svUUxWSitsRGU1RGNZMENnWUVBdHhYMS9IY2t2aGxoSFF5SwpaV0xRc0RmWkJJTGJoYytPTERwT3lUNmNKUy9zSnpmRklZWmdLNU0zck9TNE9temRZZkpjY1FBdUdxK1RWSlEzClZjWU9kYnJJQU5KVjhDRHJuNGpra2VqVHpKSTZmQ3dBa1BXT3l4dzhrYlYxSHNveTZXTGZTQ0hLcEJVY3JvZ0EKcVJHRVNxQlZUYXdqeUYvRUNYNjY3eS9QNDlNRGdZUUFBb0dBWFlteE80KzUyQzFnQnpoN0dnVHdOTEpsN2JMbgpnT2hLVEZsS2hUMzZWak1qZUZmZFhtQlZCVmJmVW90dEtaYnkvZ1ZYMUlYVDM4UFN0Qi9kc3diRjQ1YkdEZG9TCnpNRmpZbUhUdEx0clUvNGhSZVZ0dmI1TVltclBERlg1OFN3Y1NSUk8vY0g2V0pQdmZ1NEFxMGNKWkE5S2IwQjkKNVdvMThKeEFxdlB0VEI4PQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUJTd0lCQURDQ0FTd0dCeXFHU000NEJBRXdnZ0VmQW9HQkFPWTBLc1R0NUVwSjRMdGxEM3hSUzVtRGlHRTEKQ01OcDBTOVgwc0s4a1A4QXBzOGlZd01MYlpZZ2xrMThHQ05uQ2s0U2piQW5aSFNCM2thSXY2QUtRYzJKOFcyWQpWNXNlM1ZocEtPRnN0N2JxUnRrR3NsOHVKdEdsS1RpWE5jbGt2MmpzS09yc0Jva1NEMVVTR0NFQ1ROZU10M09nCnppUmNaMWRTK2RqU09aMm5BaFVBekI5NlNweGxBYWsrSy9RTFZKK2xEZTVEY1kwQ2dZRUF0eFgxL0hja3ZobGgKSFF5S1pXTFFzRGZaQklMYmhjK09MRHBPeVQ2Y0pTL3NKemZGSVlaZ0s1TTNyT1M0T216ZFlmSmNjUUF1R3ErVApWSlEzVmNZT2RicklBTkpWOENEcm40amtrZWpUekpJNmZDd0FrUFdPeXh3OGtiVjFIc295NldMZlNDSEtwQlVjCnJvZ0FxUkdFU3FCVlRhd2p5Ri9FQ1g2Njd5L1A0OU1FRmdJVVNlUlZSZ0FYc0xtZVdSL1Y0Umg5SGV4Kzkrcz0KLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQo=", + "message": "dsa with 1024 keys", + "scheme": "DSA", + "signature": "302c0214349f8fba2479c0e9877f99249d4d27bc1b537d4d02140e55587749241658b3593b0f68f9a7d52a815060" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJRFJqQ0NBamtHQnlxR1NNNDRCQUV3Z2dJc0FvSUJBUURTTU96MlV0WmYvODFkZ1RXUTByRGhTSU5Vd2NjUwoxTVhVN01tOEVtOVNIZi9FeVZTSnp5WlNrZ3hUbWEzc0ZPTnlLUElzdVg5TjQwRndqL0VPOVlmYzhCOEtNL1VLClkzTTR3ZkJUckFvRGhEYlNibS9PTnE1WEp4M3VXaEdibUg3VmZJUFlrdlVxWkJQT0VnaEVDWkZONWN5ZXZ3c0EKZUoxaDlRcWJNSTRJS3VkeTJVUVE2SFZMcDdzRVhGQUZHdVZURmtYUXRPTndEUGZXdXVNZ2ZyQXFSaEhpYWVrYQo0amE5VW42b2NhWVNHK3JXRUJzTzgvUVkzU0toL0VlVWhXbzZWOWRnSms3Znp4bHB0OXdFNUFibnUxT2grYnhwCkxpbWRjS0J1aVQzQVJnK0J0VG1mcDhTOE1ZNDQ1dERKalhUMkZsbG9NbVovS0N2bWFZUFJNaGV0QWlFQXhVR0YKWGlXS29BM1l5dFAvNWxRZnFGajRPRk5yUE5JMHNoa3BEbUI5MzdVQ2dnRUFPb2NaUlZCcjJsdkRLTnZPaWg1WgoyS05RejFiay90UlNQVTZPc0RRY2lSekhmdW9lSmc1VVdvZWx1TU96ZTF1QkVIRUZmbk1HbkM2SExBTC9vNTYwCk9Lck1QTHZOa0pYOWd5ZlRwM2FkeGJZSzJPbmNvK1h1aC9mMzRlQmRkNCtCTjBweCtTTWYyNmtsQk9Tanp5c0QKZzFiQmxzZGg0RGN1L3NOd0RYVmRqZjVOQWR6RXkzRi84VHBwNCtNQTBrR3dteENOZ3ZMZGJKU0pMenVPU0NMUQpHS0NPRDl3UGMxNlhndE9nSk5FbTlEaWJmRGRQaGJURXZYN3ljK05GbmFyUWFDYkZuTTkvQUF1dkNKSmd5QVprCkwraS9qZkNvNnpwWmV6UTJla21haFRpakc2MEwrNE85Tm1ZbTlHUHZzVWcyTXJSa0RiU09ZMjlhWk1oNFNiVmUKZmdPQ0FRVUFBb0lCQUFYa2FUc3BrRXVTRWwvcnZjbXV3dmo5ekR5RVJwdUhYRmoxb0Q2UTlVSEhKVFdDeHA0VQphZXlXc3piRzJ6ekk1OGRhclJmdHFvMzh2U1EzbGt3RWZLbndqVlprQnp3SVNiQ2JWZEF2MWVEMUlvdTlSVVRUCjFRdHhBR0czQVpQSFhqQnFGSVBmWE1VbW5PakFzU0NEc2JsQ2xxY1BGejVURmFibDNQUHBTREUyQWozaXhvcDUKaytBME9lOTdkREV1bE53cFAvZk84WTVCL2JLTE84M0dKOTc1NDhzQXdzVnpJblF0SGxDdGE4UUFMbU96eStMMApJaXNGNnZKQmJWb2lnSjU3UDJadVMwNDRtVGE4SllUWlZOc0VGYjhpSENtaG4wa1Q0WG0rdlNHei92YXFlVysxCjN1d3pWbmFPUEV0STVkaWdCWG1mZFFaNFRFeCtsajdUS1kwPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBMGpEczlsTFdYLy9OWFlFMWtOS3c0VWlEVk1ISEV0VEYxT3pKdkJKdlVoMy94TWxVCmljOG1VcElNVTVtdDdCVGpjaWp5TExsL1RlTkJjSS94RHZXSDNQQWZDalAxQ21Oek9NSHdVNndLQTRRMjBtNXYKemphdVZ5Y2Q3bG9SbTVoKzFYeUQySkwxS21RVHpoSUlSQW1SVGVYTW5yOExBSGlkWWZVS216Q09DQ3JuY3RsRQpFT2gxUzZlN0JGeFFCUnJsVXhaRjBMVGpjQXozMXJyaklINndLa1lSNG1ucEd1STJ2VkorcUhHbUVodnExaEFiCkR2UDBHTjBpb2Z4SGxJVnFPbGZYWUNaTzM4OFphYmZjQk9RRzU3dFRvZm04YVM0cG5YQ2dib2s5d0VZUGdiVTUKbjZmRXZER09PT2JReVkxMDloWlphREptZnlncjVtbUQwVElYclFJaEFNVkJoVjRsaXFBTjJNclQvK1pVSDZoWQorRGhUYXp6U05MSVpLUTVnZmQrMUFvSUJBRHFIR1VWUWE5cGJ3eWpiem9vZVdkaWpVTTlXNVA3VVVqMU9qckEwCkhJa2N4MzdxSGlZT1ZGcUhwYmpEczN0YmdSQnhCWDV6QnB3dWh5d0MvNk9ldERpcXpEeTd6WkNWL1lNbjA2ZDIKbmNXMkN0anAzS1BsN29mMzkrSGdYWGVQZ1RkS2Nma2pIOXVwSlFUa284OHJBNE5Xd1piSFllQTNMdjdEY0ExMQpYWTMrVFFIY3hNdHhmL0U2YWVQakFOSkJzSnNRallMeTNXeVVpUzg3amtnaTBCaWdqZy9jRDNOZWw0TFRvQ1RSCkp2UTRtM3czVDRXMHhMMSs4blBqUloycTBHZ214WnpQZndBTHJ3aVNZTWdHWkMvb3Y0M3dxT3M2V1hzME5ucEoKbW9VNG94dXRDL3VEdlRabUp2Umo3N0ZJTmpLMFpBMjBqbU52V21USWVFbTFYbjRDZ2dFQUJlUnBPeW1RUzVJUwpYK3U5eWE3QytQM01QSVJHbTRkY1dQV2dQcEQxUWNjbE5ZTEduaFJwN0phek5zYmJQTWpueDFxdEYrMnFqZnk5CkpEZVdUQVI4cWZDTlZtUUhQQWhKc0p0VjBDL1Y0UFVpaTcxRlJOUFZDM0VBWWJjQms4ZGVNR29VZzk5Y3hTYWMKNk1DeElJT3h1VUtXcHc4WFBsTVZwdVhjOCtsSU1UWUNQZUxHaW5tVDREUTU3M3QwTVM2VTNDay85ODd4amtIOQpzb3M3emNZbjN2bmp5d0RDeFhNaWRDMGVVSzFyeEFBdVk3UEw0dlFpS3dYcThrRnRXaUtBbm5zL1ptNUxUamlaCk5yd2xoTmxVMndRVnZ5SWNLYUdmU1JQaGViNjlJYlArOXFwNWI3WGU3RE5XZG80OFMwamwyS0FGZVo5MUJuaE0KVEg2V1B0TXBqUUlnT2FUVG42eFlLMGtadnZIM2xaWHJ6a2pwNGFObE5ZNjVSMEpBS0tOc3gzcz0KLS0tLS1FTkQgRFNBIFBSSVZBVEUgS0VZLS0tLS0K", + "message": "dsa with 2048 keys", + "scheme": "DSA-SHA1", + "signature": "30450221008d357a2a055610fd1220dd3232611532484b53289b30f388d5f8cf22480f295302206918006763bf65eb9ce52e478942252bb3a3092208b2e781af046f91c33d4ee8" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUZZd0VBWUhLb1pJemowQ0FRWUZLNEVFQUFvRFFnQUVJWmVvd0R5bGxzNEsvd2ZCak8xOGJZbzdnR3g4bllRUgppamE0ZS9xRU1pa09ISmFpN2dlZVVyZVVyNVhreS9BeDdzMmRHdGVnc1BOc1BnR2U1TXBRdmc9PQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IUUNBUUVFSURGNlh2OFN2Ly93R1VXRCtjNzgwcHBHclUwUWRaV0NBenhBUVBRWDhyL3VvQWNHQlN1QkJBQUsKb1VRRFFnQUVJWmVvd0R5bGxzNEsvd2ZCak8xOGJZbzdnR3g4bllRUmlqYTRlL3FFTWlrT0hKYWk3Z2VlVXJlVQpyNVhreS9BeDdzMmRHdGVnc1BOc1BnR2U1TXBRdmc9PQotLS0tLUVORCBFQyBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "ecdsa with sha1", + "scheme": "ecdsa-with-SHA1", + "signature": "3044022054cd46c7a09d8399fcf1b67a34c192e548668e080d17df2504262ddd85fce0f4022032c6cb4cbe2ec14fee133fb6c0091bd11e3dff1322dc1d54907c678cde5d9d72" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUVrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRRURNZ0FFWFBFMExldVdhSVhyWXlPbGwvTDlwdlhTVTJJOQpvNHY5MTZUMWZMNzB6ZlNoUW45U09CQVhBNUdlQ3A2d3dNN1AKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBFQyBQQVJBTUVURVJTLS0tLS0KQmdncWhrak9QUU1CQVE9PQotLS0tLUVORCBFQyBQQVJBTUVURVJTLS0tLS0KLS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1GOENBUUVFR0kvYmg3bldaUVJBcDBBSXhCTnFzTVh6K0R3SlZLb00vYUFLQmdncWhrak9QUU1CQWFFMEF6SUEKQkZ6eE5DM3JsbWlGNjJNanBaZnkvYWIxMGxOaVBhT0wvZGVrOVh5KzlNMzBvVUovVWpnUUZ3T1JuZ3Flc01ETwp6dz09Ci0tLS0tRU5EIEVDIFBSSVZBVEUgS0VZLS0tLS0K", + "message": "ecdsa with p192 key with sha1", + "scheme": "ecdsa-with-SHA1", + "signature": "3035021900efbeca6b91be7cf2f8f4f3daaad1c6a711d4035e73f34e4f02183dfeb2996373f89925a8fb5265440d59940f5b26a2134a24" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUU0d0VBWUhLb1pJemowQ0FRWUZLNEVFQUNFRE9nQUVnZFdMVDZaSWJoUEd3M29wWC93WFVmUmdJMndTeDVJOApyUEY2N0lzZ1BKc1J4MjZYZG1zWFpLOXNhMnA4MWNVSzNXYkZ0bHF5SzhrPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBFQyBQQVJBTUVURVJTLS0tLS0KQmdVcmdRUUFJUT09Ci0tLS0tRU5EIEVDIFBBUkFNRVRFUlMtLS0tLQotLS0tLUJFR0lOIEVDIFBSSVZBVEUgS0VZLS0tLS0KTUdnQ0FRRUVIR1E5aGlhenluZ1J2SjJFYW5Ja2FyMG5YTnZXOG1pTUxKS3JGNjZnQndZRks0RUVBQ0doUEFNNgpBQVNCMVl0UHBraHVFOGJEZWlsZi9CZFI5R0FqYkJMSGtqeXM4WHJzaXlBOG14SEhicGQyYXhka3IyeHJhbnpWCnhRcmRac1cyV3JJcnlRPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=", + "message": "ecdsa with p224 key with sha1", + "scheme": "ecdsa-with-SHA1", + "signature": "303c021c610b419f91bda589850809825c24f46cefef202090b335fe0d0819e9021c3bb1943dc19d8291c4646d77164b6572a22a98c397e07d5fd9477a8a" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFWWpHaCtJdHJUL3Z1dWZ6MkRhYlZ3dmJEbDV1NgpqeWJLOVl1Qm56V0VHMllHREVPVTFma3NTcHo2YlVsWXV5Y0ZUMDcybzNuRHF4NXFSTG9XcHg4R2pnPT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBFQyBQQVJBTUVURVJTLS0tLS0KQmdncWhrak9QUU1CQnc9PQotLS0tLUVORCBFQyBQQVJBTUVURVJTLS0tLS0KLS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSU1hQXE4bktUM0lxVmFZODcxTUpTM3lZUDBYUER3RU1ON2R0UlR3U1FXaDBvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFWWpHaCtJdHJUL3Z1dWZ6MkRhYlZ3dmJEbDV1Nmp5Yks5WXVCbnpXRUcyWUdERU9VMWZrcwpTcHo2YlVsWXV5Y0ZUMDcybzNuRHF4NXFSTG9XcHg4R2pnPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=", + "message": "ecdsa with p256 key with sha1", + "scheme": "ecdsa-with-SHA1", + "signature": "3046022100d2e38f8cadd5df562b3630d79a76ce6ea0bc9944192c3752ca3ae58dc28770ff022100bd8aa43b5ba1b4942ee3f3cb0e28530fe1f471bd7726a02b01a8285f5f1e302a" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUZZd0VBWUhLb1pJemowQ0FRWUZLNEVFQUFvRFFnQUVJWmVvd0R5bGxzNEsvd2ZCak8xOGJZbzdnR3g4bllRUgppamE0ZS9xRU1pa09ISmFpN2dlZVVyZVVyNVhreS9BeDdzMmRHdGVnc1BOc1BnR2U1TXBRdmc9PQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUhlTUVrR0NTcUdTSWIzRFFFRkRUQThNQnNHQ1NxR1NJYjNEUUVGRERBT0JBaTlMcVpReDRKRlhBSUNDQUF3CkhRWUpZSVpJQVdVREJBRUNCQkEranMxZkc0UnYveVJON29adnhiZ3lCSUdRL0Q0eWo4Nk0xeDhsTXNuQUhRL0sKNy9yeWIvYmFETkhxTjlMVFphbkVHQnV5eGdyVHp0MDhTaUwraDkxeUZHTW9hbHkwMjlLMVZnRUk4THh1NU5wLwpBK0xLN2V3aDczQUJ6c2J1eFlkY1hJK3JLbnJ2TE45VHQ2dmVEczRHbHFUVHNXd3E1d0YwQys2Z2FZUkJYQTc0ClQxYjZOeWtHaDJVTkw1VTVwSFpFWWRPVkx6K2xSSkw3Z1lxbHdlTkhQL1MzCi0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "bard", + "message": "ecdsa with password", + "scheme": "ecdsa-with-SHA1", + "signature": "3045022065215e0e4a97326360a60cec101dbebf3227debbf8c33e02ec0a4a165923ee70022100e5b28646c58da87a203aad2dd97462d27a37c53210ae6cdc9fed6f65cf57f627" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQnR6Q0NBU3dHQnlxR1NNNDRCQUV3Z2dFZkFvR0JBT1kwS3NUdDVFcEo0THRsRDN4UlM1bURpR0UxQ01OcAowUzlYMHNLOGtQOEFwczhpWXdNTGJaWWdsazE4R0NObkNrNFNqYkFuWkhTQjNrYUl2NkFLUWMySjhXMllWNXNlCjNWaHBLT0ZzdDdicVJ0a0dzbDh1SnRHbEtUaVhOY2xrdjJqc0tPcnNCb2tTRDFVU0dDRUNUTmVNdDNPZ3ppUmMKWjFkUytkalNPWjJuQWhVQXpCOTZTcHhsQWFrK0svUUxWSitsRGU1RGNZMENnWUVBdHhYMS9IY2t2aGxoSFF5SwpaV0xRc0RmWkJJTGJoYytPTERwT3lUNmNKUy9zSnpmRklZWmdLNU0zck9TNE9temRZZkpjY1FBdUdxK1RWSlEzClZjWU9kYnJJQU5KVjhDRHJuNGpra2VqVHpKSTZmQ3dBa1BXT3l4dzhrYlYxSHNveTZXTGZTQ0hLcEJVY3JvZ0EKcVJHRVNxQlZUYXdqeUYvRUNYNjY3eS9QNDlNRGdZUUFBb0dBWFlteE80KzUyQzFnQnpoN0dnVHdOTEpsN2JMbgpnT2hLVEZsS2hUMzZWak1qZUZmZFhtQlZCVmJmVW90dEtaYnkvZ1ZYMUlYVDM4UFN0Qi9kc3diRjQ1YkdEZG9TCnpNRmpZbUhUdEx0clUvNGhSZVZ0dmI1TVltclBERlg1OFN3Y1NSUk8vY0g2V0pQdmZ1NEFxMGNKWkE5S2IwQjkKNVdvMThKeEFxdlB0VEI4PQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUlCbnpCSkJna3Foa2lHOXcwQkJRMHdQREFiQmdrcWhraUc5dzBCQlF3d0RnUUkxejRJSk9SRndzNENBZ2dBCk1CMEdDV0NHU0FGbEF3UUJBZ1FRcTdmMEN1S0NUSVRmUFM1WGF4MUg0d1NDQVZERnlJallWWGZCTmUrQkFScXoKVGZvMDl5NHZLa0VyT2I3U3o0YlFrQWpSTGpPWGlVak00ZVROdGl2bWw4TnFWclFUS0FnaE4rZ2d4ajQxNk9ENApvcTZOczdOY2JkNFhtNU5pOHdycldiSnhWb2c2ckFhL2lvVTBzZmdSRXhZeS94RTJROUtrVytWRTdTVXdhbndZCmU4MU9kOXFOTTVLaFpHTTF5VVNLYTBKQTZYcWI4ZEFxQm85clZ0OERjZXVtQjlPUDgzeFYzZkxFaW1TWmZSNnAKc2xBMVAvZFR2S3h3aHBndVFlNFozT2t6VHpHQ3h5Ym9xZVJXMXdvTkhLYnhqenpTSGNha2k5U0hRbTN4cFVXOApoUkFKZDZPdERuTGJrRTlNbkMrVWNJM21qcnUxeGZuUjVNVTdxRzdlOW52T2hFRFZhRGtpSzNEYnJTZjBCMEJpCnAxaHlYMVhzU1hEZXdTRWQvbWxmTUxkRDhXZWNnVXRsOWVhN0p6eFkzLzZSNzh5Qjk1MUk1VG1ZNDVtcC92K04KdGJ4RXYyOUI2NVVLZjBhYzdnVnc0TE55OEpGMmVmL0wvbWVFbUJvSUFFNzFmKzg9Ci0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "password", + "message": "dsa with 1024 keys and a password", + "scheme": "DSA-SHA", + "signature": "302d021500933278e5cdcc982c25d17fb32b25a514b57f0296021447f328bf49b8b55be83ed400c14fa726948c07db" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQnR6Q0NBU3dHQnlxR1NNNDRCQUV3Z2dFZkFvR0JBT1kwS3NUdDVFcEo0THRsRDN4UlM1bURpR0UxQ01OcAowUzlYMHNLOGtQOEFwczhpWXdNTGJaWWdsazE4R0NObkNrNFNqYkFuWkhTQjNrYUl2NkFLUWMySjhXMllWNXNlCjNWaHBLT0ZzdDdicVJ0a0dzbDh1SnRHbEtUaVhOY2xrdjJqc0tPcnNCb2tTRDFVU0dDRUNUTmVNdDNPZ3ppUmMKWjFkUytkalNPWjJuQWhVQXpCOTZTcHhsQWFrK0svUUxWSitsRGU1RGNZMENnWUVBdHhYMS9IY2t2aGxoSFF5SwpaV0xRc0RmWkJJTGJoYytPTERwT3lUNmNKUy9zSnpmRklZWmdLNU0zck9TNE9temRZZkpjY1FBdUdxK1RWSlEzClZjWU9kYnJJQU5KVjhDRHJuNGpra2VqVHpKSTZmQ3dBa1BXT3l4dzhrYlYxSHNveTZXTGZTQ0hLcEJVY3JvZ0EKcVJHRVNxQlZUYXdqeUYvRUNYNjY3eS9QNDlNRGdZUUFBb0dBWFlteE80KzUyQzFnQnpoN0dnVHdOTEpsN2JMbgpnT2hLVEZsS2hUMzZWak1qZUZmZFhtQlZCVmJmVW90dEtaYnkvZ1ZYMUlYVDM4UFN0Qi9kc3diRjQ1YkdEZG9TCnpNRmpZbUhUdEx0clUvNGhSZVZ0dmI1TVltclBERlg1OFN3Y1NSUk8vY0g2V0pQdmZ1NEFxMGNKWkE5S2IwQjkKNVdvMThKeEFxdlB0VEI4PQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMTI4LUNCQyxEQzE3M0M2REZENDU1RUJFNDYyQTM1RDZBQjlBNjAzQQoKRm9DM3N4YmRVRkpUYU50UnBvb014YVgybGNRUkxVejhxY1JoekRCbjVhMWthTUhwMkpNM0tsSEs1YWF1eWJUNAppbG1sS0o5c1NtOHBGTEFXUEtia2N6U2daK1g2cC81MXY0emFFSlNlYlo5OHAzMmtRazg3WEpRRTdhWXJveFlWClVmTTVQU09vS1dpbGorTFpRUUVYVjEwcURvWUdybmJTZG9OU3hZVzVWMWExYVArdWEwRU83bTlNVVlrb0x4aTMKU0ovczJoLzVLTTNUT3o3ZDdET1p1U29ObSswbjZZQzRhcVFuUjNsbUV0QVhFWUxRcUxoSDJRM0ZUS1RId0JRdwpIZ01CQXpjWE9TMVlTdzZFa3doMWVaYW1penJPRUM0STZvWkVIb1VCcVJmYnNROHR1NzdrRHEyb3ZRU3luOEZwClNlRTY0bTNHZ1pPWWRmY0R1TlowY2NtbTNzaEJCZlRmRDlBd1IrMXRoa2xLTzNvYWFMRUhiNlRtbmtENzlyRXoKOVdzaVZ4b043dnFxV2Rnb2V5bDdSRU9CNldMUXA4a1lTNEZvUkcwUUIvWlM4SHMvVGYxN1FQbnJRTmlNa3ZQNwpzSlNIbWxhTUtYaldYSzBWb045NGtmWktVWHdrekxEMVZYdVhGQ25Va3puV1UwdGFoWWkwNmI4L1NWWGM2RUcrCjBtenlsY2tIN1Vuak9RZnhTRkFsWitlL1BpWDgwdGNQYWt4WWJrK2YxTnY3TDBOT3lockR2MThLVWJ2OW1FcFYKWXNpbGQxbTcvUVNGMHUxcW1qbUdOUT09Ci0tLS0tRU5EIERTQSBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "password", + "message": "dsa with 1024 keys and a password variant", + "scheme": "DSA-SHA", + "signature": "302c02147e0eb669879a758df5b3efae631fe51052852434021472e7d838db4356f9d5d305c78dbda65711259bfa" + } + ], + "rsa": [ + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "message": "md5 with 1024 keys", + "scheme": "RSA-MD5", + "signature": "26c2db4e73210d9917b796e7ade6a41a1b4f16d2c8914fb285e0584275506152b779ff32caa834b5a7b3ca3956157cb06a9ae3cc43b676d4150544816eecefc1093baa3144f06f911abb84077b0ae4b8b6c4a4979c43e5c89cebe40c745527a41a5642a3d9120c0d4568b4c253881c1db00d7f99986edad1e9a2277af9377c" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "message": "md5 with 1024 keys", + "scheme": "RSA-MD5", + "signature": "26c2db4e73210d9917b796e7ade6a41a1b4f16d2c8914fb285e0584275506152b779ff32caa834b5a7b3ca3956157cb06a9ae3cc43b676d4150544816eecefc1093baa3144f06f911abb84077b0ae4b8b6c4a4979c43e5c89cebe40c745527a41a5642a3d9120c0d4568b4c253881c1db00d7f99986edad1e9a2277af9377c" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJCZ0tCL2d5N21qYVdnUGVGZFZZRFpXUkNBOUJOaXYzcFBiMGVzMjcrRktZMGhzekxhT3c0N0V4Q3RBV3AKRHNINDhUWEFmeUhCWXdCTGd1YXlmazRMR0l1cHhiK0NHTWJSbzN4RXAwQ2JmWTFKYnkyNlQ5dkdqUkMxZm9IRApEVUpHODR1YVJieUhxYWY0aTZ6dDRnVlIreGxBRUlqa2FGQUFLOGNPb1hBVDFDVnFHTExsalVDY2hMOFBqYUhqCi95cmlaL1M3cmR3bEkzTG5BQnh3d21Mcm1SL3Y3MVd0cG1PL2FORzhOKzFwbytRd2FnaFRreVE1OUUvWnZBdU8Ka0ZXSG9rMnEvUjZQWUFhMmpkWjl6aW0wRnFPUCtua1FhRURSYkJGQm1CcVR2NWZGR2ZrMldzQWZLZi9SRzAvVgpGZCtaZU01MjUxVGVUdlhINjk1bmxTR2F1Vmw5QWdNQkFBRT0KLS0tLS1FTkQgUlNBIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFandJQkFBS0IvZ3k3bWphV2dQZUZkVllEWldSQ0E5Qk5pdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDCnRBV3BEc0g0OFRYQWZ5SEJZd0JMZ3VheWZrNExHSXVweGIrQ0dNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzEKZm9IRERVSkc4NHVhUmJ5SHFhZjRpNnp0NGdWUit4bEFFSWprYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UApqYUhqL3lyaVovUzdyZHdsSTNMbkFCeHd3bUxybVIvdjcxV3RwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9aCnZBdU9rRldIb2sycS9SNlBZQWEyamRaOXppbTBGcU9QK25rUWFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1IKRzAvVkZkK1plTTUyNTFUZVR2WEg2OTVubFNHYXVWbDlBZ01CQUFFQ2dmNExyV0hZL2w1NG91VGhaV3Z2YnJ1ZwpwZno2c0pYMmc5bDd5WG1XbEVXc1BFQ1ZvLzdTVWJwWUZwdDZPWnk5OXpTZytJS2JHcVdLZmRob0tyVHdJVnRDCkwwWVowTmxtZG5BTlNJejByb3hRRzdaeGtMNSt2SFN3L1BtRDl4NFV3ZitDejhoQVRDbU5CdjFxYzYwZGt5dVcKNENMcWU3MnFhVGlWV1JvTzFpYWdRZ2hOY0xvbzZ2U3k2NUV4TGFDRFRQaGE3eXUydnc0aEZacFdpRWpXNGR4ZgpyRmRMaWl4NTJCQzg2WWxBbHhNRS9yTGc4SUpWdmlsYnlvOWFXZFhteE9hVVRMUnY2UGtGRDEvZ1ZkdzhWOVFyClNMTjlGbEsya2tqaVgwZHpvaWJ2WnczdE1udDN5eWRBeDBYODcrc01SVmFoQzFicDNrVlB6NEh5MEVXWDRRSi8KUE0zMXZHaXVJVGsyTkNkNTFEWHQxTHRuMk9QNUZhSlNtQ2FFamgwWGtVNHFvdVl5alhXdDhCdTZCVENsMnZ1YQpGZzBVamk5QytJa1BMbWFVTWJNSU93YVRrOGNXcUx0aFN4c0xlNzBKNU9rR3JnZktVTS93K0JISDFQdC9QanpqCkMrK2wwa2lGYU9WRFZhQVY5R3BMUExDQm9LL1BDOVJiL3J4TU1vQ0NOd0ovTlp1ZWRJbnkydzNMTWlpNzdoL1QKelN2ZXJnTkdoalk2Um52YThsTFhKNmRscmtjUEF5cHMzZ1d3eHFqNE5SMFQrR00wYkRVUFZMYjdNMDdYVjdTWAp2N1ZKR201MkpiUkd3TTFzcytyOFhUVE5lbWVHaytXUnhHN1RndHNNcVlHWExmQjhReGsvZjUvTWNjMDBUbDh1CndYRk5zZnhKeG10NkFic1RyM2czNndKL0loT25pYno5QWQrbmNobEJuTjNRZVczQ0tIcXphUjE4dm9xdnRWbTIKa0pmSEsxNXBySC9zU0dteG1pRUdnckNKVFp4dERiYU5DTzcvVkJqbkt1ZFVVSWhDQXdzTHR1cTAvenViOXZBZAo4RzFzY2ZJcHY1cWFTTnptS29YOGJPd0FydnJTNndQN3lLcmNUc3VXSWxIRDhySlZJN0lFRG5Rb1RwNUc4ZksxCmh3Si9NSWg4TTV2MHI1ZFVZRXY2b0lKV0djbGU2QUgxSm1zUDVXSWFmZ3E3MloyMjg4cEhjQ0ZId05ZOERnOUoKNzZRc3dWTG5VaFBUbG1tM0VPT1BHRXRhbTJpQUQ1cjBBZnl0bGI0bGJOb1FzajJzemVYT05EWEIrNm91ZWFqaApWTkVMVXI4SGNTUDVsZ3pSWmpKVzZhRkl6ajlMRFJtUW5VQU9qR1NYVk9RdEV3Si9NQ1FaN04vdjRkSUtlRFJBCjhkOFVFeFozK2dHSHVteml6dEdSSjB0UXJ5WkgyUGFrUDVJN1YrMWw3cUVVbkoyYzNtRitlMXY0MUVwOUxDdmgKYnpyUEt3OWR4aDE4ZzRiKzdiTXBzV1Buc3JhS2g2aXB4YzdhYU9hWlYwRHhnZXo0emNadTBQMW9sTzBjTjNLTQpueEowUGRzM1I4YkFoTkNEZFMySlphUnA1UT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "md5 with 2028 keys", + "scheme": "RSA-MD5", + "signature": "0b7dc9b050496e95d7749b5ff272f496350cbc92735dfd008d96c949d0bfb4b206cbf426c967a0ec2c23c025faeaa3a2b2d56338df45b0780ebfc3e6620cde9b3df7c1d4b3009a1a3a6e6a9cd4b6c1136343e4f56f282005433a012d4bd1a9ccb479be438e79db02c4431eb93d8a1532365446c1b95c5746e75a63ce51ddc7dbb1adb6be7db661821864b8a51872ed50ab9a4817fcbbfcba66f47014f0808b56137a778828bee8f2d9d1e2eca2d1411d137c74f8c18f5910210e0b4ba7830ba72905522a1fd37be07f9644702c1478a79de560bb73ef719928df552e682432b78b45c185b81a000bcc01ddf24d263d052fcca2f6138a2025027aac65f25a" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FDcnBWRTJmQWRhbkhHZkhBMTBSa21OUElGdgpDcnk1WE1jY1JndUlHUnpVOXdnVkJmSitVZUNoTjlHbWNtR2Y2N2JFR2J0T1k3bVNjV2lkS3BtM3UrWFpVT1hmCmwzUFFURjNrSVB6S1UyY09Vd0RlemlIUm1HS1JRWHZ0VHkyZXNCSDQ1R0t6S2pGSEg2dGk2b1V5M1FHN3dTWjcKa1hHR1M2cGdYamtQQlU2eXF3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUNkd0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQW1Fd2dnSmRBZ0VBQW9HQkFLdWxVVFo4QjFxY2NaOGMKRFhSR1NZMDhnVzhLdkxsY3h4eEdDNGdaSE5UM0NCVUY4bjVSNEtFMzBhWnlZWi9ydHNRWnUwNWp1Wkp4YUowcQptYmU3NWRsUTVkK1hjOUJNWGVRZy9NcFRadzVUQU43T0lkR1lZcEZCZSsxUExaNndFZmprWXJNcU1VY2ZxMkxxCmhUTGRBYnZCSm51UmNZWkxxbUJlT1E4RlRyS3JBZ01CQUFFQ2dZRUFua0hSYkVQVTMvV0lTU1FyUDM2aXlDYjIKUy9TQlp3S2t6bXZDckJ4RFdoUGVEc3dwOWMvMkpZNzZyTldmTHp5OGlYZ1VHOFdVenZIamU2MVFoM2dtQmNLZQpiVWFUR2w0Vnk4SGExWUJBRG81UmZScmRtMEZFNHR2Z3Z1L1RrcUZxcEJCWndldTU0Mjg1aGs1emxHN24vRDdZCmRuTlhVcHU1TWxOYjV4M2dXMGtDUVFEVUwvL2N3Y1hVeFkvZXZhSlA0alNlK1p3RVFabyt6WFJMaVBVdWxCb1YKYXcyOENWTXV4ZGd3cUFvMVgxSUtlZlBlVWFmN1JRdThnQ0thUm5wR3VFdVhBa0VBenhaVGZNbXZtQ1VESWV3NAo1R2s2YksyNjVYUVdkaGNnaXEyNTRscEJHT1ltRGo5eUNFN3lBK3ptQVNRd01zWFRkUU9pMWhPQ0V5clh1U0o1CmMrK0VEUUpBRmgzV3Juem9FUEJ5dVlYTW1FVDh0U0ZSV01RNXZwZ05xaDNoYUhSNWI0Z1VDMmh4YWl1bkNCTkwKMVJwVlk5QW9VaUR5d0djRy9TUGg5M0NuS0Izbml3SkJBS1A3QXRzaWZaZ1ZYdGlpekI0YU1UaFRqVllhU1pyegpEMEtnOUR1SHlscGtEQ2htRnU3N1RHck5VUWdBVnVZdGZoYi9iUmJsVmEvRjBoSjRlUUhUM0pVQ1FCVlQ2OHRiCk9nUlVrMGFQOXRDMzAyMVZOODJYNitrbG93U1FOOG9CUFg4K1RmRFdTVWlscC8rajI0SGt5K1oyOURvN3lSL1IKcXV0bkw5MkN2QmxWTFY0PQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "md5 with 1024 keys non-rsa key", + "scheme": "RSA-MD5", + "signature": "92188f81484ca6326c3091ffb8e2b613ee51280121c510d6c2dfa557dbc24fb68418e66ec90e457cc3f262fcc346f349e7a3a3a708f837564ed7b2152b666c49d96884948dc1cd89c2e6e6bb842904a5b554e6a9cbe49a458e7410d99836a6d80337c2192204bf69260da75cd959ee4600be6a18517546bf6094c57ab695ee12" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "message": "rmd160 with 2028 keys", + "scheme": "RSA-RIPEMD160", + "signature": "2f664527ebd0e9ac58bd2e710cf99db44d6ff8cbf78dfb909192e4a042ec0270c228e5e7009c2a6c705bbbced7bb516d9905c5e8819d3bc19043964ed43b5bf5369d9be4ebe0c32ff42b7f212c65e943fcddbf5e684f80b8d923e24b0da68fb9743ec1b56b7043240afe06b58d8c4394e82d7b23725f171ad15a4b90cf3f72" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJCZ0tCL2d5N21qYVdnUGVGZFZZRFpXUkNBOUJOaXYzcFBiMGVzMjcrRktZMGhzekxhT3c0N0V4Q3RBV3AKRHNINDhUWEFmeUhCWXdCTGd1YXlmazRMR0l1cHhiK0NHTWJSbzN4RXAwQ2JmWTFKYnkyNlQ5dkdqUkMxZm9IRApEVUpHODR1YVJieUhxYWY0aTZ6dDRnVlIreGxBRUlqa2FGQUFLOGNPb1hBVDFDVnFHTExsalVDY2hMOFBqYUhqCi95cmlaL1M3cmR3bEkzTG5BQnh3d21Mcm1SL3Y3MVd0cG1PL2FORzhOKzFwbytRd2FnaFRreVE1OUUvWnZBdU8Ka0ZXSG9rMnEvUjZQWUFhMmpkWjl6aW0wRnFPUCtua1FhRURSYkJGQm1CcVR2NWZGR2ZrMldzQWZLZi9SRzAvVgpGZCtaZU01MjUxVGVUdlhINjk1bmxTR2F1Vmw5QWdNQkFBRT0KLS0tLS1FTkQgUlNBIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFandJQkFBS0IvZ3k3bWphV2dQZUZkVllEWldSQ0E5Qk5pdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDCnRBV3BEc0g0OFRYQWZ5SEJZd0JMZ3VheWZrNExHSXVweGIrQ0dNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzEKZm9IRERVSkc4NHVhUmJ5SHFhZjRpNnp0NGdWUit4bEFFSWprYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UApqYUhqL3lyaVovUzdyZHdsSTNMbkFCeHd3bUxybVIvdjcxV3RwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9aCnZBdU9rRldIb2sycS9SNlBZQWEyamRaOXppbTBGcU9QK25rUWFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1IKRzAvVkZkK1plTTUyNTFUZVR2WEg2OTVubFNHYXVWbDlBZ01CQUFFQ2dmNExyV0hZL2w1NG91VGhaV3Z2YnJ1ZwpwZno2c0pYMmc5bDd5WG1XbEVXc1BFQ1ZvLzdTVWJwWUZwdDZPWnk5OXpTZytJS2JHcVdLZmRob0tyVHdJVnRDCkwwWVowTmxtZG5BTlNJejByb3hRRzdaeGtMNSt2SFN3L1BtRDl4NFV3ZitDejhoQVRDbU5CdjFxYzYwZGt5dVcKNENMcWU3MnFhVGlWV1JvTzFpYWdRZ2hOY0xvbzZ2U3k2NUV4TGFDRFRQaGE3eXUydnc0aEZacFdpRWpXNGR4ZgpyRmRMaWl4NTJCQzg2WWxBbHhNRS9yTGc4SUpWdmlsYnlvOWFXZFhteE9hVVRMUnY2UGtGRDEvZ1ZkdzhWOVFyClNMTjlGbEsya2tqaVgwZHpvaWJ2WnczdE1udDN5eWRBeDBYODcrc01SVmFoQzFicDNrVlB6NEh5MEVXWDRRSi8KUE0zMXZHaXVJVGsyTkNkNTFEWHQxTHRuMk9QNUZhSlNtQ2FFamgwWGtVNHFvdVl5alhXdDhCdTZCVENsMnZ1YQpGZzBVamk5QytJa1BMbWFVTWJNSU93YVRrOGNXcUx0aFN4c0xlNzBKNU9rR3JnZktVTS93K0JISDFQdC9QanpqCkMrK2wwa2lGYU9WRFZhQVY5R3BMUExDQm9LL1BDOVJiL3J4TU1vQ0NOd0ovTlp1ZWRJbnkydzNMTWlpNzdoL1QKelN2ZXJnTkdoalk2Um52YThsTFhKNmRscmtjUEF5cHMzZ1d3eHFqNE5SMFQrR00wYkRVUFZMYjdNMDdYVjdTWAp2N1ZKR201MkpiUkd3TTFzcytyOFhUVE5lbWVHaytXUnhHN1RndHNNcVlHWExmQjhReGsvZjUvTWNjMDBUbDh1CndYRk5zZnhKeG10NkFic1RyM2czNndKL0loT25pYno5QWQrbmNobEJuTjNRZVczQ0tIcXphUjE4dm9xdnRWbTIKa0pmSEsxNXBySC9zU0dteG1pRUdnckNKVFp4dERiYU5DTzcvVkJqbkt1ZFVVSWhDQXdzTHR1cTAvenViOXZBZAo4RzFzY2ZJcHY1cWFTTnptS29YOGJPd0FydnJTNndQN3lLcmNUc3VXSWxIRDhySlZJN0lFRG5Rb1RwNUc4ZksxCmh3Si9NSWg4TTV2MHI1ZFVZRXY2b0lKV0djbGU2QUgxSm1zUDVXSWFmZ3E3MloyMjg4cEhjQ0ZId05ZOERnOUoKNzZRc3dWTG5VaFBUbG1tM0VPT1BHRXRhbTJpQUQ1cjBBZnl0bGI0bGJOb1FzajJzemVYT05EWEIrNm91ZWFqaApWTkVMVXI4SGNTUDVsZ3pSWmpKVzZhRkl6ajlMRFJtUW5VQU9qR1NYVk9RdEV3Si9NQ1FaN04vdjRkSUtlRFJBCjhkOFVFeFozK2dHSHVteml6dEdSSjB0UXJ5WkgyUGFrUDVJN1YrMWw3cUVVbkoyYzNtRitlMXY0MUVwOUxDdmgKYnpyUEt3OWR4aDE4ZzRiKzdiTXBzV1Buc3JhS2g2aXB4YzdhYU9hWlYwRHhnZXo0emNadTBQMW9sTzBjTjNLTQpueEowUGRzM1I4YkFoTkNEZFMySlphUnA1UT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "rmd160 with 1024 keys", + "scheme": "RSA-RIPEMD160", + "signature": "02dcf2d4cd0f722b65f4909d19825ac4a3e09826d74146fd2aaa9f1043c3cdbba4a4f2fac862cc5bc959953656122f312143806919e1a85ba038cd258f8dce2bef23a42b27c2bdc9ef33b1c47a90d02e83615234cd9741b0890cca64f9f2247f6bf1bdf2dbfae128b2941e3a64e91826c9d359a5b2daccb3f17f64379a017277676c298c7defc22bff37876b666506e503552264cc66605e69fc5eaf8c0f0b7fbd62132a702bbd7547f12572d4a4ad8915720e6f27d180d3ed428f637fd46b443040cba230b065e81b4b623b99e280a615e02b3da8dc3e25546b21b6b3fa81a12241d052dfa297781bb6a7e5990df8add208b5c9ab6eae2db4ffb0eb5038" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FDcnBWRTJmQWRhbkhHZkhBMTBSa21OUElGdgpDcnk1WE1jY1JndUlHUnpVOXdnVkJmSitVZUNoTjlHbWNtR2Y2N2JFR2J0T1k3bVNjV2lkS3BtM3UrWFpVT1hmCmwzUFFURjNrSVB6S1UyY09Vd0RlemlIUm1HS1JRWHZ0VHkyZXNCSDQ1R0t6S2pGSEg2dGk2b1V5M1FHN3dTWjcKa1hHR1M2cGdYamtQQlU2eXF3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUNkd0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQW1Fd2dnSmRBZ0VBQW9HQkFLdWxVVFo4QjFxY2NaOGMKRFhSR1NZMDhnVzhLdkxsY3h4eEdDNGdaSE5UM0NCVUY4bjVSNEtFMzBhWnlZWi9ydHNRWnUwNWp1Wkp4YUowcQptYmU3NWRsUTVkK1hjOUJNWGVRZy9NcFRadzVUQU43T0lkR1lZcEZCZSsxUExaNndFZmprWXJNcU1VY2ZxMkxxCmhUTGRBYnZCSm51UmNZWkxxbUJlT1E4RlRyS3JBZ01CQUFFQ2dZRUFua0hSYkVQVTMvV0lTU1FyUDM2aXlDYjIKUy9TQlp3S2t6bXZDckJ4RFdoUGVEc3dwOWMvMkpZNzZyTldmTHp5OGlYZ1VHOFdVenZIamU2MVFoM2dtQmNLZQpiVWFUR2w0Vnk4SGExWUJBRG81UmZScmRtMEZFNHR2Z3Z1L1RrcUZxcEJCWndldTU0Mjg1aGs1emxHN24vRDdZCmRuTlhVcHU1TWxOYjV4M2dXMGtDUVFEVUwvL2N3Y1hVeFkvZXZhSlA0alNlK1p3RVFabyt6WFJMaVBVdWxCb1YKYXcyOENWTXV4ZGd3cUFvMVgxSUtlZlBlVWFmN1JRdThnQ0thUm5wR3VFdVhBa0VBenhaVGZNbXZtQ1VESWV3NAo1R2s2YksyNjVYUVdkaGNnaXEyNTRscEJHT1ltRGo5eUNFN3lBK3ptQVNRd01zWFRkUU9pMWhPQ0V5clh1U0o1CmMrK0VEUUpBRmgzV3Juem9FUEJ5dVlYTW1FVDh0U0ZSV01RNXZwZ05xaDNoYUhSNWI0Z1VDMmh4YWl1bkNCTkwKMVJwVlk5QW9VaUR5d0djRy9TUGg5M0NuS0Izbml3SkJBS1A3QXRzaWZaZ1ZYdGlpekI0YU1UaFRqVllhU1pyegpEMEtnOUR1SHlscGtEQ2htRnU3N1RHck5VUWdBVnVZdGZoYi9iUmJsVmEvRjBoSjRlUUhUM0pVQ1FCVlQ2OHRiCk9nUlVrMGFQOXRDMzAyMVZOODJYNitrbG93U1FOOG9CUFg4K1RmRFdTVWlscC8rajI0SGt5K1oyOURvN3lSL1IKcXV0bkw5MkN2QmxWTFY0PQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "rmd160 with 1024 keys non-rsa key", + "scheme": "RSA-RIPEMD160", + "signature": "2c6407d790759f4b635754bcadb7611c45c204e5b21a35b16540651ddb247cd78cf82bbb670a80788b62d337db062e75f49dbe0d53e1257576b6e34f1017081118b0c72a89bfabd4ab209e3caa7b2a869ccc464a136e1b6caf70ce6b79c53208666f957ec305fd45a4aa944f7e9da4bad125c0b980c1c7f520ccd18c158b24b4" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "message": "sha1 with 1024 keys", + "scheme": "RSA-SHA1", + "signature": "2418662bd49ed0545b532c5762399286e880c324abe23fd5f4b3b71ebc5248b8d999d3ee52fc9644a06944cc04a2dea107f8307b12b4688419d92fb144e195f1f170d3f2f3a2601d711c7ca3c57c66c65cd37c9ab182a8b508d2cb24471d4b22144da88ac6c653c98e24f770681f628584ddede33b34234fa5fcba8270acc5" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJCZ0tCL2d5N21qYVdnUGVGZFZZRFpXUkNBOUJOaXYzcFBiMGVzMjcrRktZMGhzekxhT3c0N0V4Q3RBV3AKRHNINDhUWEFmeUhCWXdCTGd1YXlmazRMR0l1cHhiK0NHTWJSbzN4RXAwQ2JmWTFKYnkyNlQ5dkdqUkMxZm9IRApEVUpHODR1YVJieUhxYWY0aTZ6dDRnVlIreGxBRUlqa2FGQUFLOGNPb1hBVDFDVnFHTExsalVDY2hMOFBqYUhqCi95cmlaL1M3cmR3bEkzTG5BQnh3d21Mcm1SL3Y3MVd0cG1PL2FORzhOKzFwbytRd2FnaFRreVE1OUUvWnZBdU8Ka0ZXSG9rMnEvUjZQWUFhMmpkWjl6aW0wRnFPUCtua1FhRURSYkJGQm1CcVR2NWZGR2ZrMldzQWZLZi9SRzAvVgpGZCtaZU01MjUxVGVUdlhINjk1bmxTR2F1Vmw5QWdNQkFBRT0KLS0tLS1FTkQgUlNBIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFandJQkFBS0IvZ3k3bWphV2dQZUZkVllEWldSQ0E5Qk5pdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDCnRBV3BEc0g0OFRYQWZ5SEJZd0JMZ3VheWZrNExHSXVweGIrQ0dNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzEKZm9IRERVSkc4NHVhUmJ5SHFhZjRpNnp0NGdWUit4bEFFSWprYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UApqYUhqL3lyaVovUzdyZHdsSTNMbkFCeHd3bUxybVIvdjcxV3RwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9aCnZBdU9rRldIb2sycS9SNlBZQWEyamRaOXppbTBGcU9QK25rUWFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1IKRzAvVkZkK1plTTUyNTFUZVR2WEg2OTVubFNHYXVWbDlBZ01CQUFFQ2dmNExyV0hZL2w1NG91VGhaV3Z2YnJ1ZwpwZno2c0pYMmc5bDd5WG1XbEVXc1BFQ1ZvLzdTVWJwWUZwdDZPWnk5OXpTZytJS2JHcVdLZmRob0tyVHdJVnRDCkwwWVowTmxtZG5BTlNJejByb3hRRzdaeGtMNSt2SFN3L1BtRDl4NFV3ZitDejhoQVRDbU5CdjFxYzYwZGt5dVcKNENMcWU3MnFhVGlWV1JvTzFpYWdRZ2hOY0xvbzZ2U3k2NUV4TGFDRFRQaGE3eXUydnc0aEZacFdpRWpXNGR4ZgpyRmRMaWl4NTJCQzg2WWxBbHhNRS9yTGc4SUpWdmlsYnlvOWFXZFhteE9hVVRMUnY2UGtGRDEvZ1ZkdzhWOVFyClNMTjlGbEsya2tqaVgwZHpvaWJ2WnczdE1udDN5eWRBeDBYODcrc01SVmFoQzFicDNrVlB6NEh5MEVXWDRRSi8KUE0zMXZHaXVJVGsyTkNkNTFEWHQxTHRuMk9QNUZhSlNtQ2FFamgwWGtVNHFvdVl5alhXdDhCdTZCVENsMnZ1YQpGZzBVamk5QytJa1BMbWFVTWJNSU93YVRrOGNXcUx0aFN4c0xlNzBKNU9rR3JnZktVTS93K0JISDFQdC9QanpqCkMrK2wwa2lGYU9WRFZhQVY5R3BMUExDQm9LL1BDOVJiL3J4TU1vQ0NOd0ovTlp1ZWRJbnkydzNMTWlpNzdoL1QKelN2ZXJnTkdoalk2Um52YThsTFhKNmRscmtjUEF5cHMzZ1d3eHFqNE5SMFQrR00wYkRVUFZMYjdNMDdYVjdTWAp2N1ZKR201MkpiUkd3TTFzcytyOFhUVE5lbWVHaytXUnhHN1RndHNNcVlHWExmQjhReGsvZjUvTWNjMDBUbDh1CndYRk5zZnhKeG10NkFic1RyM2czNndKL0loT25pYno5QWQrbmNobEJuTjNRZVczQ0tIcXphUjE4dm9xdnRWbTIKa0pmSEsxNXBySC9zU0dteG1pRUdnckNKVFp4dERiYU5DTzcvVkJqbkt1ZFVVSWhDQXdzTHR1cTAvenViOXZBZAo4RzFzY2ZJcHY1cWFTTnptS29YOGJPd0FydnJTNndQN3lLcmNUc3VXSWxIRDhySlZJN0lFRG5Rb1RwNUc4ZksxCmh3Si9NSWg4TTV2MHI1ZFVZRXY2b0lKV0djbGU2QUgxSm1zUDVXSWFmZ3E3MloyMjg4cEhjQ0ZId05ZOERnOUoKNzZRc3dWTG5VaFBUbG1tM0VPT1BHRXRhbTJpQUQ1cjBBZnl0bGI0bGJOb1FzajJzemVYT05EWEIrNm91ZWFqaApWTkVMVXI4SGNTUDVsZ3pSWmpKVzZhRkl6ajlMRFJtUW5VQU9qR1NYVk9RdEV3Si9NQ1FaN04vdjRkSUtlRFJBCjhkOFVFeFozK2dHSHVteml6dEdSSjB0UXJ5WkgyUGFrUDVJN1YrMWw3cUVVbkoyYzNtRitlMXY0MUVwOUxDdmgKYnpyUEt3OWR4aDE4ZzRiKzdiTXBzV1Buc3JhS2g2aXB4YzdhYU9hWlYwRHhnZXo0emNadTBQMW9sTzBjTjNLTQpueEowUGRzM1I4YkFoTkNEZFMySlphUnA1UT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "sha1 with 2028 keys", + "scheme": "RSA-SHA1", + "signature": "030bf2ad68ca379340c7f9584819fd03909a6bb2fd14be448525d29d9c29e0a4da805787a5b049cecd1ca77f83b2290202d0432afa7dce6ac4d0ca68e5eda441bfcbc79a9ecf82e926e83338651d0af0a98647509d48d5ad99b50d72bdadbe122b87beb12b5f9a62eac150eddee8fbc4ef76886a89596682f21355a232dc31fef77ca6c8e1dc2a2460c2c51a129ff5df13ac16ebe17ad942553ce54483027440ad14e9132c22e8163e2f630e7b66f8444e143086a0cc2643ed63828edddb94ae5fd85959446dce961ba2a45fc93e17b4570ae80cd49c77be1685d6c65d657ad1eeb5fbe744215d9ab39f1a21ac353f223587c7b2128bbebe78ebaea15c4d" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FDcnBWRTJmQWRhbkhHZkhBMTBSa21OUElGdgpDcnk1WE1jY1JndUlHUnpVOXdnVkJmSitVZUNoTjlHbWNtR2Y2N2JFR2J0T1k3bVNjV2lkS3BtM3UrWFpVT1hmCmwzUFFURjNrSVB6S1UyY09Vd0RlemlIUm1HS1JRWHZ0VHkyZXNCSDQ1R0t6S2pGSEg2dGk2b1V5M1FHN3dTWjcKa1hHR1M2cGdYamtQQlU2eXF3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUNkd0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQW1Fd2dnSmRBZ0VBQW9HQkFLdWxVVFo4QjFxY2NaOGMKRFhSR1NZMDhnVzhLdkxsY3h4eEdDNGdaSE5UM0NCVUY4bjVSNEtFMzBhWnlZWi9ydHNRWnUwNWp1Wkp4YUowcQptYmU3NWRsUTVkK1hjOUJNWGVRZy9NcFRadzVUQU43T0lkR1lZcEZCZSsxUExaNndFZmprWXJNcU1VY2ZxMkxxCmhUTGRBYnZCSm51UmNZWkxxbUJlT1E4RlRyS3JBZ01CQUFFQ2dZRUFua0hSYkVQVTMvV0lTU1FyUDM2aXlDYjIKUy9TQlp3S2t6bXZDckJ4RFdoUGVEc3dwOWMvMkpZNzZyTldmTHp5OGlYZ1VHOFdVenZIamU2MVFoM2dtQmNLZQpiVWFUR2w0Vnk4SGExWUJBRG81UmZScmRtMEZFNHR2Z3Z1L1RrcUZxcEJCWndldTU0Mjg1aGs1emxHN24vRDdZCmRuTlhVcHU1TWxOYjV4M2dXMGtDUVFEVUwvL2N3Y1hVeFkvZXZhSlA0alNlK1p3RVFabyt6WFJMaVBVdWxCb1YKYXcyOENWTXV4ZGd3cUFvMVgxSUtlZlBlVWFmN1JRdThnQ0thUm5wR3VFdVhBa0VBenhaVGZNbXZtQ1VESWV3NAo1R2s2YksyNjVYUVdkaGNnaXEyNTRscEJHT1ltRGo5eUNFN3lBK3ptQVNRd01zWFRkUU9pMWhPQ0V5clh1U0o1CmMrK0VEUUpBRmgzV3Juem9FUEJ5dVlYTW1FVDh0U0ZSV01RNXZwZ05xaDNoYUhSNWI0Z1VDMmh4YWl1bkNCTkwKMVJwVlk5QW9VaUR5d0djRy9TUGg5M0NuS0Izbml3SkJBS1A3QXRzaWZaZ1ZYdGlpekI0YU1UaFRqVllhU1pyegpEMEtnOUR1SHlscGtEQ2htRnU3N1RHck5VUWdBVnVZdGZoYi9iUmJsVmEvRjBoSjRlUUhUM0pVQ1FCVlQ2OHRiCk9nUlVrMGFQOXRDMzAyMVZOODJYNitrbG93U1FOOG9CUFg4K1RmRFdTVWlscC8rajI0SGt5K1oyOURvN3lSL1IKcXV0bkw5MkN2QmxWTFY0PQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "sha1 with 1024 keys non-rsa key", + "scheme": "RSA-SHA1", + "signature": "59382f176f35518f555deea9c351d1c2f7d08bb71abe884500fa761ac8bf581c5d1f215cffec5822d13f3ea4b4864b28b31b4118f324ac64c730bc41d3a343bf202afd2455ebc7d46d2c922be210bc3a6e9c9396086f15eeae7d7f127ba5683702085659483772902e19a8a3820557fac83568aba44da397b18e633204e566e6" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "message": "sha224 with 1024 keys", + "scheme": "RSA-SHA224", + "signature": "0f16795724d7d26c3685cbd7497afb9348cd0b8875f486973926df50034537aa1c2db409aac468324c00355edf83eeb6cc9404660b18f7771861b2d7d84d53e5ae11cd35030494e07d3264cee3c8a1afaafc0f23a40cfd24e683c5bd3b81fd9c9d403366a3cb9326e9938763fd60f89af28392ebfb0b33cd2a27bc66785fc9" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FDcnBWRTJmQWRhbkhHZkhBMTBSa21OUElGdgpDcnk1WE1jY1JndUlHUnpVOXdnVkJmSitVZUNoTjlHbWNtR2Y2N2JFR2J0T1k3bVNjV2lkS3BtM3UrWFpVT1hmCmwzUFFURjNrSVB6S1UyY09Vd0RlemlIUm1HS1JRWHZ0VHkyZXNCSDQ1R0t6S2pGSEg2dGk2b1V5M1FHN3dTWjcKa1hHR1M2cGdYamtQQlU2eXF3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUNkd0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQW1Fd2dnSmRBZ0VBQW9HQkFLdWxVVFo4QjFxY2NaOGMKRFhSR1NZMDhnVzhLdkxsY3h4eEdDNGdaSE5UM0NCVUY4bjVSNEtFMzBhWnlZWi9ydHNRWnUwNWp1Wkp4YUowcQptYmU3NWRsUTVkK1hjOUJNWGVRZy9NcFRadzVUQU43T0lkR1lZcEZCZSsxUExaNndFZmprWXJNcU1VY2ZxMkxxCmhUTGRBYnZCSm51UmNZWkxxbUJlT1E4RlRyS3JBZ01CQUFFQ2dZRUFua0hSYkVQVTMvV0lTU1FyUDM2aXlDYjIKUy9TQlp3S2t6bXZDckJ4RFdoUGVEc3dwOWMvMkpZNzZyTldmTHp5OGlYZ1VHOFdVenZIamU2MVFoM2dtQmNLZQpiVWFUR2w0Vnk4SGExWUJBRG81UmZScmRtMEZFNHR2Z3Z1L1RrcUZxcEJCWndldTU0Mjg1aGs1emxHN24vRDdZCmRuTlhVcHU1TWxOYjV4M2dXMGtDUVFEVUwvL2N3Y1hVeFkvZXZhSlA0alNlK1p3RVFabyt6WFJMaVBVdWxCb1YKYXcyOENWTXV4ZGd3cUFvMVgxSUtlZlBlVWFmN1JRdThnQ0thUm5wR3VFdVhBa0VBenhaVGZNbXZtQ1VESWV3NAo1R2s2YksyNjVYUVdkaGNnaXEyNTRscEJHT1ltRGo5eUNFN3lBK3ptQVNRd01zWFRkUU9pMWhPQ0V5clh1U0o1CmMrK0VEUUpBRmgzV3Juem9FUEJ5dVlYTW1FVDh0U0ZSV01RNXZwZ05xaDNoYUhSNWI0Z1VDMmh4YWl1bkNCTkwKMVJwVlk5QW9VaUR5d0djRy9TUGg5M0NuS0Izbml3SkJBS1A3QXRzaWZaZ1ZYdGlpekI0YU1UaFRqVllhU1pyegpEMEtnOUR1SHlscGtEQ2htRnU3N1RHck5VUWdBVnVZdGZoYi9iUmJsVmEvRjBoSjRlUUhUM0pVQ1FCVlQ2OHRiCk9nUlVrMGFQOXRDMzAyMVZOODJYNitrbG93U1FOOG9CUFg4K1RmRFdTVWlscC8rajI0SGt5K1oyOURvN3lSL1IKcXV0bkw5MkN2QmxWTFY0PQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "sha224 with 1024 keys non-rsa key", + "scheme": "RSA-SHA224", + "signature": "03e982e805b9484586c202fe1b30b10af1fd59d2fb01c3c815a8270c5352b7888726141f6cabd36c30262fdee6ae482f763ed1442eb9062a404533bf958032eeaffb2959982e9ff32b916d3e31f8f63ec201ba1d1a61f3b870973dad7083d9cc1328146843ea7737bbe6b697d8fd79a380fff3619b867130d5bf8d6e61ce34a8" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJCZ0tCL2d5N21qYVdnUGVGZFZZRFpXUkNBOUJOaXYzcFBiMGVzMjcrRktZMGhzekxhT3c0N0V4Q3RBV3AKRHNINDhUWEFmeUhCWXdCTGd1YXlmazRMR0l1cHhiK0NHTWJSbzN4RXAwQ2JmWTFKYnkyNlQ5dkdqUkMxZm9IRApEVUpHODR1YVJieUhxYWY0aTZ6dDRnVlIreGxBRUlqa2FGQUFLOGNPb1hBVDFDVnFHTExsalVDY2hMOFBqYUhqCi95cmlaL1M3cmR3bEkzTG5BQnh3d21Mcm1SL3Y3MVd0cG1PL2FORzhOKzFwbytRd2FnaFRreVE1OUUvWnZBdU8Ka0ZXSG9rMnEvUjZQWUFhMmpkWjl6aW0wRnFPUCtua1FhRURSYkJGQm1CcVR2NWZGR2ZrMldzQWZLZi9SRzAvVgpGZCtaZU01MjUxVGVUdlhINjk1bmxTR2F1Vmw5QWdNQkFBRT0KLS0tLS1FTkQgUlNBIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFandJQkFBS0IvZ3k3bWphV2dQZUZkVllEWldSQ0E5Qk5pdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDCnRBV3BEc0g0OFRYQWZ5SEJZd0JMZ3VheWZrNExHSXVweGIrQ0dNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzEKZm9IRERVSkc4NHVhUmJ5SHFhZjRpNnp0NGdWUit4bEFFSWprYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UApqYUhqL3lyaVovUzdyZHdsSTNMbkFCeHd3bUxybVIvdjcxV3RwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9aCnZBdU9rRldIb2sycS9SNlBZQWEyamRaOXppbTBGcU9QK25rUWFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1IKRzAvVkZkK1plTTUyNTFUZVR2WEg2OTVubFNHYXVWbDlBZ01CQUFFQ2dmNExyV0hZL2w1NG91VGhaV3Z2YnJ1ZwpwZno2c0pYMmc5bDd5WG1XbEVXc1BFQ1ZvLzdTVWJwWUZwdDZPWnk5OXpTZytJS2JHcVdLZmRob0tyVHdJVnRDCkwwWVowTmxtZG5BTlNJejByb3hRRzdaeGtMNSt2SFN3L1BtRDl4NFV3ZitDejhoQVRDbU5CdjFxYzYwZGt5dVcKNENMcWU3MnFhVGlWV1JvTzFpYWdRZ2hOY0xvbzZ2U3k2NUV4TGFDRFRQaGE3eXUydnc0aEZacFdpRWpXNGR4ZgpyRmRMaWl4NTJCQzg2WWxBbHhNRS9yTGc4SUpWdmlsYnlvOWFXZFhteE9hVVRMUnY2UGtGRDEvZ1ZkdzhWOVFyClNMTjlGbEsya2tqaVgwZHpvaWJ2WnczdE1udDN5eWRBeDBYODcrc01SVmFoQzFicDNrVlB6NEh5MEVXWDRRSi8KUE0zMXZHaXVJVGsyTkNkNTFEWHQxTHRuMk9QNUZhSlNtQ2FFamgwWGtVNHFvdVl5alhXdDhCdTZCVENsMnZ1YQpGZzBVamk5QytJa1BMbWFVTWJNSU93YVRrOGNXcUx0aFN4c0xlNzBKNU9rR3JnZktVTS93K0JISDFQdC9QanpqCkMrK2wwa2lGYU9WRFZhQVY5R3BMUExDQm9LL1BDOVJiL3J4TU1vQ0NOd0ovTlp1ZWRJbnkydzNMTWlpNzdoL1QKelN2ZXJnTkdoalk2Um52YThsTFhKNmRscmtjUEF5cHMzZ1d3eHFqNE5SMFQrR00wYkRVUFZMYjdNMDdYVjdTWAp2N1ZKR201MkpiUkd3TTFzcytyOFhUVE5lbWVHaytXUnhHN1RndHNNcVlHWExmQjhReGsvZjUvTWNjMDBUbDh1CndYRk5zZnhKeG10NkFic1RyM2czNndKL0loT25pYno5QWQrbmNobEJuTjNRZVczQ0tIcXphUjE4dm9xdnRWbTIKa0pmSEsxNXBySC9zU0dteG1pRUdnckNKVFp4dERiYU5DTzcvVkJqbkt1ZFVVSWhDQXdzTHR1cTAvenViOXZBZAo4RzFzY2ZJcHY1cWFTTnptS29YOGJPd0FydnJTNndQN3lLcmNUc3VXSWxIRDhySlZJN0lFRG5Rb1RwNUc4ZksxCmh3Si9NSWg4TTV2MHI1ZFVZRXY2b0lKV0djbGU2QUgxSm1zUDVXSWFmZ3E3MloyMjg4cEhjQ0ZId05ZOERnOUoKNzZRc3dWTG5VaFBUbG1tM0VPT1BHRXRhbTJpQUQ1cjBBZnl0bGI0bGJOb1FzajJzemVYT05EWEIrNm91ZWFqaApWTkVMVXI4SGNTUDVsZ3pSWmpKVzZhRkl6ajlMRFJtUW5VQU9qR1NYVk9RdEV3Si9NQ1FaN04vdjRkSUtlRFJBCjhkOFVFeFozK2dHSHVteml6dEdSSjB0UXJ5WkgyUGFrUDVJN1YrMWw3cUVVbkoyYzNtRitlMXY0MUVwOUxDdmgKYnpyUEt3OWR4aDE4ZzRiKzdiTXBzV1Buc3JhS2g2aXB4YzdhYU9hWlYwRHhnZXo0emNadTBQMW9sTzBjTjNLTQpueEowUGRzM1I4YkFoTkNEZFMySlphUnA1UT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "sha224 with 2028 keys", + "scheme": "RSA-SHA224", + "signature": "0488d132e8ffaa488336cae9cb53fb7819ad0c93c984b55384f336d784c491c2f4d8880fb133d15c6db17fd04d81b04ac7d5fa14ad70db735d7990face760ad18c3207d8cd0c8722382b28ab3347a904e14114e474a843387c638b5fe351f1f3fcbbb3d7e9abf20337a4696b021249cf2546f72855f3ee28985b9bc55e6cbad76d9f0cdf89c892137b837cf15dedf067df20a81abf4456adffa1d3d10a922bbdbb1c19144ab1bf0a2c0f427de012018ed3ed2de5cb160f6e66ae74889f3e37ce89ed88c049dd068fe85915ce9616f42b6ec0ca758085e4e8a319959dc4ff0e1d37707a0f8fc5d8fabb0f80bb12acc041c57a49e3891b2b823013ceac9c86" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "message": "SHA256 with 1024 keys", + "scheme": "RSA-SHA256", + "signature": "3257245feae10a45b7c379936eb8463537732cd43881dd15e8971fdae4dc0674868c093eee4f0bd32caf5128fe89e7b570b2450a0776285044658885ea39200377e967d653986d1cd542daa4670321d65462fb0ae0364b90fa3a8474d242c4e8faaef6d69b4fd8f3b209b4cbeef632410b28c70c1ece903cb6918a69d63229" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FDcnBWRTJmQWRhbkhHZkhBMTBSa21OUElGdgpDcnk1WE1jY1JndUlHUnpVOXdnVkJmSitVZUNoTjlHbWNtR2Y2N2JFR2J0T1k3bVNjV2lkS3BtM3UrWFpVT1hmCmwzUFFURjNrSVB6S1UyY09Vd0RlemlIUm1HS1JRWHZ0VHkyZXNCSDQ1R0t6S2pGSEg2dGk2b1V5M1FHN3dTWjcKa1hHR1M2cGdYamtQQlU2eXF3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUNkd0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQW1Fd2dnSmRBZ0VBQW9HQkFLdWxVVFo4QjFxY2NaOGMKRFhSR1NZMDhnVzhLdkxsY3h4eEdDNGdaSE5UM0NCVUY4bjVSNEtFMzBhWnlZWi9ydHNRWnUwNWp1Wkp4YUowcQptYmU3NWRsUTVkK1hjOUJNWGVRZy9NcFRadzVUQU43T0lkR1lZcEZCZSsxUExaNndFZmprWXJNcU1VY2ZxMkxxCmhUTGRBYnZCSm51UmNZWkxxbUJlT1E4RlRyS3JBZ01CQUFFQ2dZRUFua0hSYkVQVTMvV0lTU1FyUDM2aXlDYjIKUy9TQlp3S2t6bXZDckJ4RFdoUGVEc3dwOWMvMkpZNzZyTldmTHp5OGlYZ1VHOFdVenZIamU2MVFoM2dtQmNLZQpiVWFUR2w0Vnk4SGExWUJBRG81UmZScmRtMEZFNHR2Z3Z1L1RrcUZxcEJCWndldTU0Mjg1aGs1emxHN24vRDdZCmRuTlhVcHU1TWxOYjV4M2dXMGtDUVFEVUwvL2N3Y1hVeFkvZXZhSlA0alNlK1p3RVFabyt6WFJMaVBVdWxCb1YKYXcyOENWTXV4ZGd3cUFvMVgxSUtlZlBlVWFmN1JRdThnQ0thUm5wR3VFdVhBa0VBenhaVGZNbXZtQ1VESWV3NAo1R2s2YksyNjVYUVdkaGNnaXEyNTRscEJHT1ltRGo5eUNFN3lBK3ptQVNRd01zWFRkUU9pMWhPQ0V5clh1U0o1CmMrK0VEUUpBRmgzV3Juem9FUEJ5dVlYTW1FVDh0U0ZSV01RNXZwZ05xaDNoYUhSNWI0Z1VDMmh4YWl1bkNCTkwKMVJwVlk5QW9VaUR5d0djRy9TUGg5M0NuS0Izbml3SkJBS1A3QXRzaWZaZ1ZYdGlpekI0YU1UaFRqVllhU1pyegpEMEtnOUR1SHlscGtEQ2htRnU3N1RHck5VUWdBVnVZdGZoYi9iUmJsVmEvRjBoSjRlUUhUM0pVQ1FCVlQ2OHRiCk9nUlVrMGFQOXRDMzAyMVZOODJYNitrbG93U1FOOG9CUFg4K1RmRFdTVWlscC8rajI0SGt5K1oyOURvN3lSL1IKcXV0bkw5MkN2QmxWTFY0PQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "sha256 with 1024 keys non-rsa key", + "scheme": "RSA-SHA256", + "signature": "1d5bfbd329ec66c04a81c1eb43cc42e97c7aed8d2a6eb3ce1ea283be631190fa6ee76a79aa45ff039be57284ec2a2a031a7a8a91bd946e9c2ef048343bf971285b8ba198a5817ab2ab0d7c38a0f7e2a9066922ed4b54de4f50201c0929b9a96c8676904b015e7568b86ef26efec624023f233db7979404196393093277a6b9af" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJCZ0tCL2d5N21qYVdnUGVGZFZZRFpXUkNBOUJOaXYzcFBiMGVzMjcrRktZMGhzekxhT3c0N0V4Q3RBV3AKRHNINDhUWEFmeUhCWXdCTGd1YXlmazRMR0l1cHhiK0NHTWJSbzN4RXAwQ2JmWTFKYnkyNlQ5dkdqUkMxZm9IRApEVUpHODR1YVJieUhxYWY0aTZ6dDRnVlIreGxBRUlqa2FGQUFLOGNPb1hBVDFDVnFHTExsalVDY2hMOFBqYUhqCi95cmlaL1M3cmR3bEkzTG5BQnh3d21Mcm1SL3Y3MVd0cG1PL2FORzhOKzFwbytRd2FnaFRreVE1OUUvWnZBdU8Ka0ZXSG9rMnEvUjZQWUFhMmpkWjl6aW0wRnFPUCtua1FhRURSYkJGQm1CcVR2NWZGR2ZrMldzQWZLZi9SRzAvVgpGZCtaZU01MjUxVGVUdlhINjk1bmxTR2F1Vmw5QWdNQkFBRT0KLS0tLS1FTkQgUlNBIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFandJQkFBS0IvZ3k3bWphV2dQZUZkVllEWldSQ0E5Qk5pdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDCnRBV3BEc0g0OFRYQWZ5SEJZd0JMZ3VheWZrNExHSXVweGIrQ0dNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzEKZm9IRERVSkc4NHVhUmJ5SHFhZjRpNnp0NGdWUit4bEFFSWprYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UApqYUhqL3lyaVovUzdyZHdsSTNMbkFCeHd3bUxybVIvdjcxV3RwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9aCnZBdU9rRldIb2sycS9SNlBZQWEyamRaOXppbTBGcU9QK25rUWFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1IKRzAvVkZkK1plTTUyNTFUZVR2WEg2OTVubFNHYXVWbDlBZ01CQUFFQ2dmNExyV0hZL2w1NG91VGhaV3Z2YnJ1ZwpwZno2c0pYMmc5bDd5WG1XbEVXc1BFQ1ZvLzdTVWJwWUZwdDZPWnk5OXpTZytJS2JHcVdLZmRob0tyVHdJVnRDCkwwWVowTmxtZG5BTlNJejByb3hRRzdaeGtMNSt2SFN3L1BtRDl4NFV3ZitDejhoQVRDbU5CdjFxYzYwZGt5dVcKNENMcWU3MnFhVGlWV1JvTzFpYWdRZ2hOY0xvbzZ2U3k2NUV4TGFDRFRQaGE3eXUydnc0aEZacFdpRWpXNGR4ZgpyRmRMaWl4NTJCQzg2WWxBbHhNRS9yTGc4SUpWdmlsYnlvOWFXZFhteE9hVVRMUnY2UGtGRDEvZ1ZkdzhWOVFyClNMTjlGbEsya2tqaVgwZHpvaWJ2WnczdE1udDN5eWRBeDBYODcrc01SVmFoQzFicDNrVlB6NEh5MEVXWDRRSi8KUE0zMXZHaXVJVGsyTkNkNTFEWHQxTHRuMk9QNUZhSlNtQ2FFamgwWGtVNHFvdVl5alhXdDhCdTZCVENsMnZ1YQpGZzBVamk5QytJa1BMbWFVTWJNSU93YVRrOGNXcUx0aFN4c0xlNzBKNU9rR3JnZktVTS93K0JISDFQdC9QanpqCkMrK2wwa2lGYU9WRFZhQVY5R3BMUExDQm9LL1BDOVJiL3J4TU1vQ0NOd0ovTlp1ZWRJbnkydzNMTWlpNzdoL1QKelN2ZXJnTkdoalk2Um52YThsTFhKNmRscmtjUEF5cHMzZ1d3eHFqNE5SMFQrR00wYkRVUFZMYjdNMDdYVjdTWAp2N1ZKR201MkpiUkd3TTFzcytyOFhUVE5lbWVHaytXUnhHN1RndHNNcVlHWExmQjhReGsvZjUvTWNjMDBUbDh1CndYRk5zZnhKeG10NkFic1RyM2czNndKL0loT25pYno5QWQrbmNobEJuTjNRZVczQ0tIcXphUjE4dm9xdnRWbTIKa0pmSEsxNXBySC9zU0dteG1pRUdnckNKVFp4dERiYU5DTzcvVkJqbkt1ZFVVSWhDQXdzTHR1cTAvenViOXZBZAo4RzFzY2ZJcHY1cWFTTnptS29YOGJPd0FydnJTNndQN3lLcmNUc3VXSWxIRDhySlZJN0lFRG5Rb1RwNUc4ZksxCmh3Si9NSWg4TTV2MHI1ZFVZRXY2b0lKV0djbGU2QUgxSm1zUDVXSWFmZ3E3MloyMjg4cEhjQ0ZId05ZOERnOUoKNzZRc3dWTG5VaFBUbG1tM0VPT1BHRXRhbTJpQUQ1cjBBZnl0bGI0bGJOb1FzajJzemVYT05EWEIrNm91ZWFqaApWTkVMVXI4SGNTUDVsZ3pSWmpKVzZhRkl6ajlMRFJtUW5VQU9qR1NYVk9RdEV3Si9NQ1FaN04vdjRkSUtlRFJBCjhkOFVFeFozK2dHSHVteml6dEdSSjB0UXJ5WkgyUGFrUDVJN1YrMWw3cUVVbkoyYzNtRitlMXY0MUVwOUxDdmgKYnpyUEt3OWR4aDE4ZzRiKzdiTXBzV1Buc3JhS2g2aXB4YzdhYU9hWlYwRHhnZXo0emNadTBQMW9sTzBjTjNLTQpueEowUGRzM1I4YkFoTkNEZFMySlphUnA1UT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "SHA256 with 2028 keys", + "scheme": "RSA-SHA256", + "signature": "03095e1edc1b19f426aa667f1f5f9fa83362747cc15aa804b3a13b8f6a4809c13f38471c0e53926aba2d69602f62c83d5dd64e492754dad9a9d6a4f7cd722840b3aaf801139e1d626744578ce174fdd004f9c721cde77b1fd5f8169a4bcdef4279a0e20df44bd71478576a443819c31d5b5b4bd4bbc90ade67b63591fd9fa65a9bc09d0030fd3758c2cc33effc9901fd86859017c1480733097730316f4e6309e13b64ad22f7de76f9386cf4f166c47bc5ed9f77c27d67287393bae4a5c29a9250daea020191db6471eed52e5dd73772570cb11b3c33f0d971638aca15045d83613ae85ab10352237daa3d1d2b21f6d01360e7d7c6656f6c510c83e15a11" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "message": "SHA384 with 1024 keys", + "scheme": "RSA-SHA384", + "signature": "28f5125cb559c6ea4c4970235b906916422020a33ef4e74b179cf9aa19eab6ad2a52e5743473547b2ae500fd35e09e5d5bf5dfd8ecc6df026b1a01a10ad1fc8dc7955c8ebf9dc868ac00384fe18585d1dd4b02b83506a8cf3ff71a8b7a86ed7779fbf83f565467bff403f825af3df2699e4cf4cc90e2442e17a05957db7b86" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FDcnBWRTJmQWRhbkhHZkhBMTBSa21OUElGdgpDcnk1WE1jY1JndUlHUnpVOXdnVkJmSitVZUNoTjlHbWNtR2Y2N2JFR2J0T1k3bVNjV2lkS3BtM3UrWFpVT1hmCmwzUFFURjNrSVB6S1UyY09Vd0RlemlIUm1HS1JRWHZ0VHkyZXNCSDQ1R0t6S2pGSEg2dGk2b1V5M1FHN3dTWjcKa1hHR1M2cGdYamtQQlU2eXF3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUNkd0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQW1Fd2dnSmRBZ0VBQW9HQkFLdWxVVFo4QjFxY2NaOGMKRFhSR1NZMDhnVzhLdkxsY3h4eEdDNGdaSE5UM0NCVUY4bjVSNEtFMzBhWnlZWi9ydHNRWnUwNWp1Wkp4YUowcQptYmU3NWRsUTVkK1hjOUJNWGVRZy9NcFRadzVUQU43T0lkR1lZcEZCZSsxUExaNndFZmprWXJNcU1VY2ZxMkxxCmhUTGRBYnZCSm51UmNZWkxxbUJlT1E4RlRyS3JBZ01CQUFFQ2dZRUFua0hSYkVQVTMvV0lTU1FyUDM2aXlDYjIKUy9TQlp3S2t6bXZDckJ4RFdoUGVEc3dwOWMvMkpZNzZyTldmTHp5OGlYZ1VHOFdVenZIamU2MVFoM2dtQmNLZQpiVWFUR2w0Vnk4SGExWUJBRG81UmZScmRtMEZFNHR2Z3Z1L1RrcUZxcEJCWndldTU0Mjg1aGs1emxHN24vRDdZCmRuTlhVcHU1TWxOYjV4M2dXMGtDUVFEVUwvL2N3Y1hVeFkvZXZhSlA0alNlK1p3RVFabyt6WFJMaVBVdWxCb1YKYXcyOENWTXV4ZGd3cUFvMVgxSUtlZlBlVWFmN1JRdThnQ0thUm5wR3VFdVhBa0VBenhaVGZNbXZtQ1VESWV3NAo1R2s2YksyNjVYUVdkaGNnaXEyNTRscEJHT1ltRGo5eUNFN3lBK3ptQVNRd01zWFRkUU9pMWhPQ0V5clh1U0o1CmMrK0VEUUpBRmgzV3Juem9FUEJ5dVlYTW1FVDh0U0ZSV01RNXZwZ05xaDNoYUhSNWI0Z1VDMmh4YWl1bkNCTkwKMVJwVlk5QW9VaUR5d0djRy9TUGg5M0NuS0Izbml3SkJBS1A3QXRzaWZaZ1ZYdGlpekI0YU1UaFRqVllhU1pyegpEMEtnOUR1SHlscGtEQ2htRnU3N1RHck5VUWdBVnVZdGZoYi9iUmJsVmEvRjBoSjRlUUhUM0pVQ1FCVlQ2OHRiCk9nUlVrMGFQOXRDMzAyMVZOODJYNitrbG93U1FOOG9CUFg4K1RmRFdTVWlscC8rajI0SGt5K1oyOURvN3lSL1IKcXV0bkw5MkN2QmxWTFY0PQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "sha384 with 1024 keys non-rsa key", + "scheme": "RSA-SHA384", + "signature": "248f2349af0024005bfda6af9d47ecca56592146e356787d6784159145de020be57ca97d94638d0562ddeeb67b00c16a880d891a8a9b53b284fc68c0a2eb295212c7181291d1ecc6757db150bc34922495b1c75580fe9f1a33e4624e13799e2958ecfa366bdbb0b585be6f0267dcc8d498c29093060f72ca550078c94e3d1485" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJCZ0tCL2d5N21qYVdnUGVGZFZZRFpXUkNBOUJOaXYzcFBiMGVzMjcrRktZMGhzekxhT3c0N0V4Q3RBV3AKRHNINDhUWEFmeUhCWXdCTGd1YXlmazRMR0l1cHhiK0NHTWJSbzN4RXAwQ2JmWTFKYnkyNlQ5dkdqUkMxZm9IRApEVUpHODR1YVJieUhxYWY0aTZ6dDRnVlIreGxBRUlqa2FGQUFLOGNPb1hBVDFDVnFHTExsalVDY2hMOFBqYUhqCi95cmlaL1M3cmR3bEkzTG5BQnh3d21Mcm1SL3Y3MVd0cG1PL2FORzhOKzFwbytRd2FnaFRreVE1OUUvWnZBdU8Ka0ZXSG9rMnEvUjZQWUFhMmpkWjl6aW0wRnFPUCtua1FhRURSYkJGQm1CcVR2NWZGR2ZrMldzQWZLZi9SRzAvVgpGZCtaZU01MjUxVGVUdlhINjk1bmxTR2F1Vmw5QWdNQkFBRT0KLS0tLS1FTkQgUlNBIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFandJQkFBS0IvZ3k3bWphV2dQZUZkVllEWldSQ0E5Qk5pdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDCnRBV3BEc0g0OFRYQWZ5SEJZd0JMZ3VheWZrNExHSXVweGIrQ0dNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzEKZm9IRERVSkc4NHVhUmJ5SHFhZjRpNnp0NGdWUit4bEFFSWprYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UApqYUhqL3lyaVovUzdyZHdsSTNMbkFCeHd3bUxybVIvdjcxV3RwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9aCnZBdU9rRldIb2sycS9SNlBZQWEyamRaOXppbTBGcU9QK25rUWFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1IKRzAvVkZkK1plTTUyNTFUZVR2WEg2OTVubFNHYXVWbDlBZ01CQUFFQ2dmNExyV0hZL2w1NG91VGhaV3Z2YnJ1ZwpwZno2c0pYMmc5bDd5WG1XbEVXc1BFQ1ZvLzdTVWJwWUZwdDZPWnk5OXpTZytJS2JHcVdLZmRob0tyVHdJVnRDCkwwWVowTmxtZG5BTlNJejByb3hRRzdaeGtMNSt2SFN3L1BtRDl4NFV3ZitDejhoQVRDbU5CdjFxYzYwZGt5dVcKNENMcWU3MnFhVGlWV1JvTzFpYWdRZ2hOY0xvbzZ2U3k2NUV4TGFDRFRQaGE3eXUydnc0aEZacFdpRWpXNGR4ZgpyRmRMaWl4NTJCQzg2WWxBbHhNRS9yTGc4SUpWdmlsYnlvOWFXZFhteE9hVVRMUnY2UGtGRDEvZ1ZkdzhWOVFyClNMTjlGbEsya2tqaVgwZHpvaWJ2WnczdE1udDN5eWRBeDBYODcrc01SVmFoQzFicDNrVlB6NEh5MEVXWDRRSi8KUE0zMXZHaXVJVGsyTkNkNTFEWHQxTHRuMk9QNUZhSlNtQ2FFamgwWGtVNHFvdVl5alhXdDhCdTZCVENsMnZ1YQpGZzBVamk5QytJa1BMbWFVTWJNSU93YVRrOGNXcUx0aFN4c0xlNzBKNU9rR3JnZktVTS93K0JISDFQdC9QanpqCkMrK2wwa2lGYU9WRFZhQVY5R3BMUExDQm9LL1BDOVJiL3J4TU1vQ0NOd0ovTlp1ZWRJbnkydzNMTWlpNzdoL1QKelN2ZXJnTkdoalk2Um52YThsTFhKNmRscmtjUEF5cHMzZ1d3eHFqNE5SMFQrR00wYkRVUFZMYjdNMDdYVjdTWAp2N1ZKR201MkpiUkd3TTFzcytyOFhUVE5lbWVHaytXUnhHN1RndHNNcVlHWExmQjhReGsvZjUvTWNjMDBUbDh1CndYRk5zZnhKeG10NkFic1RyM2czNndKL0loT25pYno5QWQrbmNobEJuTjNRZVczQ0tIcXphUjE4dm9xdnRWbTIKa0pmSEsxNXBySC9zU0dteG1pRUdnckNKVFp4dERiYU5DTzcvVkJqbkt1ZFVVSWhDQXdzTHR1cTAvenViOXZBZAo4RzFzY2ZJcHY1cWFTTnptS29YOGJPd0FydnJTNndQN3lLcmNUc3VXSWxIRDhySlZJN0lFRG5Rb1RwNUc4ZksxCmh3Si9NSWg4TTV2MHI1ZFVZRXY2b0lKV0djbGU2QUgxSm1zUDVXSWFmZ3E3MloyMjg4cEhjQ0ZId05ZOERnOUoKNzZRc3dWTG5VaFBUbG1tM0VPT1BHRXRhbTJpQUQ1cjBBZnl0bGI0bGJOb1FzajJzemVYT05EWEIrNm91ZWFqaApWTkVMVXI4SGNTUDVsZ3pSWmpKVzZhRkl6ajlMRFJtUW5VQU9qR1NYVk9RdEV3Si9NQ1FaN04vdjRkSUtlRFJBCjhkOFVFeFozK2dHSHVteml6dEdSSjB0UXJ5WkgyUGFrUDVJN1YrMWw3cUVVbkoyYzNtRitlMXY0MUVwOUxDdmgKYnpyUEt3OWR4aDE4ZzRiKzdiTXBzV1Buc3JhS2g2aXB4YzdhYU9hWlYwRHhnZXo0emNadTBQMW9sTzBjTjNLTQpueEowUGRzM1I4YkFoTkNEZFMySlphUnA1UT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "SHA384 with 2028 keys", + "scheme": "RSA-SHA384", + "signature": "09f2771946fccd838a500e479099d98d724cd62dd62837ef4eaa9ff979320c6c92cae76f39312efbf3322ebe3c61756b7dc3fd39475ce0dc7d33371e106ac0b24d1f5b00de990aa2fc694c1793e379885e4c82b29118740728993457619fa42ca38b4555b777105fc29e9b6de9e5e2818c37fe51b9087d7ebe19c06a25c10dfc879e62189d4c0b65e58c017e6ff25c53ce072838b0758829319c91c3c03a53db0baccbb7920a088d5900a01fbde7c03001f71a57318c973dfa17d627f7bedf43fdad35ef8d180ddc81fe35e8646577a5c315b7c3eafefa3305373e3e4a284bd79c2310263aa93da7f785536fdc44ca3eddd9d1796d041e800b165ef2b42a" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "message": "SHA512 with 1024 keys", + "scheme": "RSA-SHA512", + "signature": "1f9f69082ab61be7a5528cef0190cfc25321bb9dabef8e5ea49236f660e3854ab5a0b841271eb5237c72f18e056d7b1a0923acbcd931569942a9827914a94d37d45da0b5ca4f5d94739fb42bd995c67dd013e26eee39471879a521399c7fddae668554f9e9962f85b79244d7f87f46c5db93d7b51a0c7f7ba653f9a583afc5" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FDcnBWRTJmQWRhbkhHZkhBMTBSa21OUElGdgpDcnk1WE1jY1JndUlHUnpVOXdnVkJmSitVZUNoTjlHbWNtR2Y2N2JFR2J0T1k3bVNjV2lkS3BtM3UrWFpVT1hmCmwzUFFURjNrSVB6S1UyY09Vd0RlemlIUm1HS1JRWHZ0VHkyZXNCSDQ1R0t6S2pGSEg2dGk2b1V5M1FHN3dTWjcKa1hHR1M2cGdYamtQQlU2eXF3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUNkd0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQW1Fd2dnSmRBZ0VBQW9HQkFLdWxVVFo4QjFxY2NaOGMKRFhSR1NZMDhnVzhLdkxsY3h4eEdDNGdaSE5UM0NCVUY4bjVSNEtFMzBhWnlZWi9ydHNRWnUwNWp1Wkp4YUowcQptYmU3NWRsUTVkK1hjOUJNWGVRZy9NcFRadzVUQU43T0lkR1lZcEZCZSsxUExaNndFZmprWXJNcU1VY2ZxMkxxCmhUTGRBYnZCSm51UmNZWkxxbUJlT1E4RlRyS3JBZ01CQUFFQ2dZRUFua0hSYkVQVTMvV0lTU1FyUDM2aXlDYjIKUy9TQlp3S2t6bXZDckJ4RFdoUGVEc3dwOWMvMkpZNzZyTldmTHp5OGlYZ1VHOFdVenZIamU2MVFoM2dtQmNLZQpiVWFUR2w0Vnk4SGExWUJBRG81UmZScmRtMEZFNHR2Z3Z1L1RrcUZxcEJCWndldTU0Mjg1aGs1emxHN24vRDdZCmRuTlhVcHU1TWxOYjV4M2dXMGtDUVFEVUwvL2N3Y1hVeFkvZXZhSlA0alNlK1p3RVFabyt6WFJMaVBVdWxCb1YKYXcyOENWTXV4ZGd3cUFvMVgxSUtlZlBlVWFmN1JRdThnQ0thUm5wR3VFdVhBa0VBenhaVGZNbXZtQ1VESWV3NAo1R2s2YksyNjVYUVdkaGNnaXEyNTRscEJHT1ltRGo5eUNFN3lBK3ptQVNRd01zWFRkUU9pMWhPQ0V5clh1U0o1CmMrK0VEUUpBRmgzV3Juem9FUEJ5dVlYTW1FVDh0U0ZSV01RNXZwZ05xaDNoYUhSNWI0Z1VDMmh4YWl1bkNCTkwKMVJwVlk5QW9VaUR5d0djRy9TUGg5M0NuS0Izbml3SkJBS1A3QXRzaWZaZ1ZYdGlpekI0YU1UaFRqVllhU1pyegpEMEtnOUR1SHlscGtEQ2htRnU3N1RHck5VUWdBVnVZdGZoYi9iUmJsVmEvRjBoSjRlUUhUM0pVQ1FCVlQ2OHRiCk9nUlVrMGFQOXRDMzAyMVZOODJYNitrbG93U1FOOG9CUFg4K1RmRFdTVWlscC8rajI0SGt5K1oyOURvN3lSL1IKcXV0bkw5MkN2QmxWTFY0PQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "sha512 with 1024 keys non-rsa key", + "scheme": "RSA-SHA512", + "signature": "1c98bda3350a7b849edefa961c73f76caf7432448ecf6fe440675e20524b3c3cbb8a2a92a3ba7016b2d9bbc8191dfc3fdc5332498c3e811e5174e580de0eb2e0ca48e0efabb7e07be808c0a8e6e3f974914c71fc0760136599151aa4edd8c387b366fff695edf06a2bb862ae9144a6c85dd0466b7579bf0c2e6b75e38c21c9f5" + }, + { + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJCZ0tCL2d5N21qYVdnUGVGZFZZRFpXUkNBOUJOaXYzcFBiMGVzMjcrRktZMGhzekxhT3c0N0V4Q3RBV3AKRHNINDhUWEFmeUhCWXdCTGd1YXlmazRMR0l1cHhiK0NHTWJSbzN4RXAwQ2JmWTFKYnkyNlQ5dkdqUkMxZm9IRApEVUpHODR1YVJieUhxYWY0aTZ6dDRnVlIreGxBRUlqa2FGQUFLOGNPb1hBVDFDVnFHTExsalVDY2hMOFBqYUhqCi95cmlaL1M3cmR3bEkzTG5BQnh3d21Mcm1SL3Y3MVd0cG1PL2FORzhOKzFwbytRd2FnaFRreVE1OUUvWnZBdU8Ka0ZXSG9rMnEvUjZQWUFhMmpkWjl6aW0wRnFPUCtua1FhRURSYkJGQm1CcVR2NWZGR2ZrMldzQWZLZi9SRzAvVgpGZCtaZU01MjUxVGVUdlhINjk1bmxTR2F1Vmw5QWdNQkFBRT0KLS0tLS1FTkQgUlNBIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFandJQkFBS0IvZ3k3bWphV2dQZUZkVllEWldSQ0E5Qk5pdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDCnRBV3BEc0g0OFRYQWZ5SEJZd0JMZ3VheWZrNExHSXVweGIrQ0dNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzEKZm9IRERVSkc4NHVhUmJ5SHFhZjRpNnp0NGdWUit4bEFFSWprYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UApqYUhqL3lyaVovUzdyZHdsSTNMbkFCeHd3bUxybVIvdjcxV3RwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9aCnZBdU9rRldIb2sycS9SNlBZQWEyamRaOXppbTBGcU9QK25rUWFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1IKRzAvVkZkK1plTTUyNTFUZVR2WEg2OTVubFNHYXVWbDlBZ01CQUFFQ2dmNExyV0hZL2w1NG91VGhaV3Z2YnJ1ZwpwZno2c0pYMmc5bDd5WG1XbEVXc1BFQ1ZvLzdTVWJwWUZwdDZPWnk5OXpTZytJS2JHcVdLZmRob0tyVHdJVnRDCkwwWVowTmxtZG5BTlNJejByb3hRRzdaeGtMNSt2SFN3L1BtRDl4NFV3ZitDejhoQVRDbU5CdjFxYzYwZGt5dVcKNENMcWU3MnFhVGlWV1JvTzFpYWdRZ2hOY0xvbzZ2U3k2NUV4TGFDRFRQaGE3eXUydnc0aEZacFdpRWpXNGR4ZgpyRmRMaWl4NTJCQzg2WWxBbHhNRS9yTGc4SUpWdmlsYnlvOWFXZFhteE9hVVRMUnY2UGtGRDEvZ1ZkdzhWOVFyClNMTjlGbEsya2tqaVgwZHpvaWJ2WnczdE1udDN5eWRBeDBYODcrc01SVmFoQzFicDNrVlB6NEh5MEVXWDRRSi8KUE0zMXZHaXVJVGsyTkNkNTFEWHQxTHRuMk9QNUZhSlNtQ2FFamgwWGtVNHFvdVl5alhXdDhCdTZCVENsMnZ1YQpGZzBVamk5QytJa1BMbWFVTWJNSU93YVRrOGNXcUx0aFN4c0xlNzBKNU9rR3JnZktVTS93K0JISDFQdC9QanpqCkMrK2wwa2lGYU9WRFZhQVY5R3BMUExDQm9LL1BDOVJiL3J4TU1vQ0NOd0ovTlp1ZWRJbnkydzNMTWlpNzdoL1QKelN2ZXJnTkdoalk2Um52YThsTFhKNmRscmtjUEF5cHMzZ1d3eHFqNE5SMFQrR00wYkRVUFZMYjdNMDdYVjdTWAp2N1ZKR201MkpiUkd3TTFzcytyOFhUVE5lbWVHaytXUnhHN1RndHNNcVlHWExmQjhReGsvZjUvTWNjMDBUbDh1CndYRk5zZnhKeG10NkFic1RyM2czNndKL0loT25pYno5QWQrbmNobEJuTjNRZVczQ0tIcXphUjE4dm9xdnRWbTIKa0pmSEsxNXBySC9zU0dteG1pRUdnckNKVFp4dERiYU5DTzcvVkJqbkt1ZFVVSWhDQXdzTHR1cTAvenViOXZBZAo4RzFzY2ZJcHY1cWFTTnptS29YOGJPd0FydnJTNndQN3lLcmNUc3VXSWxIRDhySlZJN0lFRG5Rb1RwNUc4ZksxCmh3Si9NSWg4TTV2MHI1ZFVZRXY2b0lKV0djbGU2QUgxSm1zUDVXSWFmZ3E3MloyMjg4cEhjQ0ZId05ZOERnOUoKNzZRc3dWTG5VaFBUbG1tM0VPT1BHRXRhbTJpQUQ1cjBBZnl0bGI0bGJOb1FzajJzemVYT05EWEIrNm91ZWFqaApWTkVMVXI4SGNTUDVsZ3pSWmpKVzZhRkl6ajlMRFJtUW5VQU9qR1NYVk9RdEV3Si9NQ1FaN04vdjRkSUtlRFJBCjhkOFVFeFozK2dHSHVteml6dEdSSjB0UXJ5WkgyUGFrUDVJN1YrMWw3cUVVbkoyYzNtRitlMXY0MUVwOUxDdmgKYnpyUEt3OWR4aDE4ZzRiKzdiTXBzV1Buc3JhS2g2aXB4YzdhYU9hWlYwRHhnZXo0emNadTBQMW9sTzBjTjNLTQpueEowUGRzM1I4YkFoTkNEZFMySlphUnA1UT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==", + "message": "SHA512 with 2028 keys", + "scheme": "RSA-SHA512", + "signature": "00aac211dfc1b5afd3467bc33cf1800aea7919494b79bbc014dc8de741c5193a78951b00851ee783a9025bc7ddb0873c8dff24024357e5e40aa94519d9ca2e7b1164dae22a4652b06a3ad6b1dd425909a145f9b884abb4807e8bc8b10f3a73cb21c88c9dd9a4c274f664571348fc0557bdf5345890842790b66ceee9db7eaa9e6bb60b3203ff4c613887ead6762abe9d771a0c88090428c448d8168d393618cf287c0eaacabb71337fc0277574a589a187a8c3484dea54b13099a14af64548f9d5f62b985b955943f49dce4ce85e9fbed072ad08a29491537cd924d9cd5486018e41ea3e72becd2dc9d4dc6b285b54e86e2c6304bdc89ddd277c11511dbb" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHY01BMEdDU3FHU0liM0RRRUJBUVVBQTRHS0FEQ0JoZ0ovT3dzd2JGby91eUM4bHRHZi95QTFBK2dWNUlHZApuQWdQYlVTSTNHemJIQ0EreCtUTEcvdEx2YlJ3M3Ixc21wcFkvamtrcGlWVzFFclNNdU4wdWl4cDVnYjc4WjlyCkgxWHBXYjVXV2dwM1dhWS85RUhNak1kT2tRLzlMVlp2UnZsL00vRmk2b3dQK3ErYW1KSTFCRWpFQ1lmYmhHTDMKcm1sVmRxNHFYYzQwUXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMTkyLUNCQywwNEQyRDc4ODJFMEM0NzRFMDdFNTQyRkU5OTdEMkE0OQoKdmZCNUd0bTM0bjNTZUk2SkVMaldpR3c2TytqK3RHUjZXYmkzU05lQVprZlNBOFBUamVpNlBWSHIrZEdLNXpNZApuVGNrZDBFcHhJdHF4RWR0TEs2R3RCSWE5S1JkM2NFYmF5SG15eXliSDJGQzRTVFhKQ1VGQmUyZWI3WkttbkNsClJCNUZjbUFxRXhpZitRT0p3SG5adzZEVHpxK29HU3dpOWNTb3kycUU2MkZnWGtqOHVLQVljQkxPTm1zUDFZUUEKNHpJdWI0Ym5FYklnaEwvc3dFQi9IVlM4NkZ5TUNzTVhySEVPblN1VVVCZi9VZlpGTnlwSTZrVlVOWGxJdG5OMQoxNGVlUnNCRDM3VmtMN2RBUVBNeCtEd203RGJVMDdRV3JWdnpnbVdsdTNLcVIwdFJOQTllNGE1ZjE0WE9ZeGdTCkhaK1hWWks4aUFkKzc2T25wcmxGdEdEb3dEWEdNMHdVWFBZcTVqOFdwS3hOc1ZzMlJWK1M2VTBnUUxvU3FOeHQKV2U3VVBXWnVmekVkalRVTzhxOUtoZEdxRm1KNTNYSVlDbFpmMGJwMTQ4YitCazNQK2RONVRibUtRRWZ1bFNjbgpyVExUUm8zNGZkVElBSnI1QkpoME9YR05zOXJGbE1KOU56NEZ3VlRFQjFETWVyWHR0OUlDZGh1ZDlCa3RSaHZxCmF4Z296K1hBM0xyQnJsUFBjclNDWnlJWWpaRnlkR1Nremc0MzlPeURFWjYrdVJtYzBxaFdBNGo2QWdYeDZnR1IKTnZ2eXBvRlZLdlhxRXEvMkYrU1Z5eU1Hcm00eFBtc3IvSFVCZUU5U211VHpOekRmVkFNL3hlcnFJb1Iyc3pSMApPMGh3dE9qNGZrNy8vY2QxQ2pGemQwSmlGL1NxTWtIeGtkYm1JQzlxbGhzaGtXbFFidnZoYmVmb2RZUHVHeG1qCkwxVGFQZ1gzNk9jclFTb2R6eVdCTjV0U21tWDFObWZ0Y3o3aXdjNEFLcnFrZG5NM3NQUzNTY3pzQWpNV3JqUnIKN2lZaGRQUVNadHhWQ1RqQUNVM2g3c2NOQWc5QVU2bDRZWnJvd1IvL0o2VT0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha1 with 1024 keys and password, variant", + "scheme": "RSA-SHA1", + "signature": "2208545e9535eaafeb464b4b403540fd8936787ff9cd081a43a4d6df1873b13a4bf80282b45c79244dd23b83b48c8be6aefa7d9e2a6a8f9e6ed8c7fc136d9edb3db2def60aa39a315137a9935f791e4f7b75926d43d237cc19a5db3070e282c8f16da79bdaa16981c30074f58e498b0ebea3724499e006c24fd28d7d8c5700" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQkhqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FRc0FNSUlCQmdLQi9neTdtamFXZ1BlRmRWWURaV1JDQTlCTgppdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDdEFXcERzSDQ4VFhBZnlIQll3QkxndWF5Zms0TEdJdXB4YitDCkdNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzFmb0hERFVKRzg0dWFSYnlIcWFmNGk2enQ0Z1ZSK3hsQUVJamsKYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UGphSGoveXJpWi9TN3Jkd2xJM0xuQUJ4d3dtTHJtUi92NzFXdApwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9adkF1T2tGV0hvazJxL1I2UFlBYTJqZFo5emltMEZxT1ArbmtRCmFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1JHMC9WRmQrWmVNNTI1MVRlVHZYSDY5NW5sU0dhdVZsOUFnTUIKQUFFPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMjU2LUNCQyw3QTZBMDU1QUQ2NzU5NDdBNjU3MDQxNDIyRjA2RDQzOQoKSFFkanpBS1V1cXFLaFpIbXB6elkvbW9uZnFGaGlIblo1YzI0anRSOWZNNGFRSlhmL2UxZno2TUVoeUl6NlhPTgpzYjRDblhac3RueFV1VldEa0hFdTZLV1EvZEtBTGdpRFV1VCtVZE1hd1ZvVlBHZGd5V1pwMzVwUVBXaTNmVDJWClhabjU4WWtHOGJPM1k0MDNlWlB5aGFkT2VmRDFWdHVGdUs2L2Y5MGpqeng2WkRud3ZlWHBZZ0ZWN0p5MS9wRmQKY0xMTWYwN0MraGJrNDE2blg2VVZpcFdlNEdIK0FERm9tNVpDZkFhVW90TTduOGkxNDlkVUxORjRZWWkyd1AzMQoxWWFESDV2ZjFDcWlhaWVEWTd4THpwRWl4d0p6NlpFZzNnTFhhVXZ6Mk1wRjhvd2lHSTNlUDBnN3ZvV3AzeHQ0ClRReC9xRFVSbGFYaWFScmlXZFd0cEt5VzFNRnVKNStLZE50UjEva1hyMkJMUEIvWkx3eXF0eW5VeThaWXBiNCsKV0lSWXBVR2ViLy9aSEdobENIN0NSTWRBQnNhbDR3VHduemk5Zlc0QXg5NmVjSjJTbHdDdUt4d1M3aUVxMnkxLwpGQWZHd3NFK1h1ZkhobWU1cDZYaktmaUh4K3pKTUlCMk5Na3JtK3dtNFBiTVRyR1ZudzUvNDEvcjZYeE9COGZlCmlLaTEySnRoNGR1c2MxdllHWWZ6S29wOXVFTTZDWjYrQ2hxemIrWnloL3hVaVpWbENYL0JZbnhyN3lYVW05YVIKUEhRZ3hrbjJBY3Q4RmdRQjNLZ3MzakNpQ1JJSnJsc255YmVXelEzWU85VGpDNE14eWdtbXdPRERCcHNPS25FaQprWFhTNTQrY1pGamNzdmE0dUpWd2hBeXdSUFZVa0x6bVRrSDB0R2l3Q0hqZVFORUNtK1RMYWhra0VJWHJWVGI5CmM5Y3JlTlhNZ0U2alZWeitSNDNIWHNHdlRjZ01jQkx5RlJRSmUyblZhai9kUTVKYkY0dXFOblF6UmpBYkQzNEsKdVRwRmFKL2ttbGdjbWVTY1JMbndhb1l3RmxtaFNDK2JLMGRmWTFKcjZBUVJBNklEUDduSWpxV05EQ0hOQkI4cgpRajF2MktXb1ZRZTN4TkhhWGhrYkpQYkEyREtsVUlxZmZrQlZ0TUt0dDlLdUczUmNjZjNiVllBVzZvaWQ3My9ECno3RE1BRjVHL09wVlI4VmJHaDFXeFh1Ujd6RVZEVXdwd3NwOWVrNWRxTjhCbkJ6MXBwZFpOSUtxenN6bmVja1UKczJsLzZtWkJtZ1YxTmZ5L2NRVTZVNXMzUzFYYzc1VURRVkxtczNDSU9wRlRSSXBlY05UZGZhMzFmWXkvc3Z5MApNMmxXVGJDdmEwZE95dXZNVWhUZ0JMNEk3UWEyZFVNUFhITVphdFY1b29IWXEvQlpKQTFyODRDNWNNNXIrdW1FCjJMTHYvQmxVcjdSYVFIaGFLR240UWhwem81eVJERTltRXFEcExWa2JnOFN4TXNkZi9wRUY1L1Z5VXdBOXQ4UlQKZktWc0luUmQzODZ0RHFKU0RiU0ZxS1R2THp0ci81WUN5elp6dkMyWUIxdm9rby9jYU9HZDJkL0c1MUlqK2JYVQp4RU44VTRmSERCc0h3UFVHYjMxdVpVaFRYcEwzN0tpT3FabVhGb0gydXNtdXZ4ODgyWHZ5R2NWMEY0dHN0TWFSCktMS3psMlB3cXpBWUdGZXhMa1lLTXowVFlJZU42aDNiODZFVGF6UFBVNDlua2FFVTIzRHgyMUoyUmIzVWxIK0kKbERRRjN3dUgxUWxZaVRubGNWYS9adTRRUWcwL2lQOEFMa1owNm12bjllOW1PdG5BOGdzaDRCMm9McWMxOVZMVQpiY3B2NDBkVjFIM1c5TGN4OUI4SllVcDBjL095bm8xRDdZajN0akdjd01LRUNtVXBIaTRra3NlaFZvMC9QOTMzCnhtRm1DNmV5V1lWZE85dXB2WS92S1NCN2IxZE10ODVpV3IzZ25Nc1NmUlljNmpzYlN4ZGpPUFNUNDZVc0l6angKd2ExRFM2K0J2NXRpYUM0dUM2WCswdENBWm8rVU9RTVlVYlRHUlIvN2cvYz0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha1 with 2024 keys and password, variant", + "scheme": "RSA-SHA1", + "signature": "032fd1fbca9632038b653322318181654f7ffc93557555f37c6f4d712727298218431abda7ef54606aeba0d6a62365ac43c60d03642106ce3a96082ad492886ac536b75e3b7024aaf2dc1feb9803218835a16525af0a63c0ec8117a07f05ebb824ab4477dcae44a40a4169685220cd3096e7b9985d5759ea1e6c0c1cb200d00a472f142288f8df5ca0776c65b7c062c141e5de81cda7b85629ece2528b026e5cfa72ede3c87e6aba748189b4c2aa95eb85eaa8e718d9701d4add794286a264361ba692822a325b1bf3242741302eb4468c220ee16855a0a31e11070fee3d35a1daf9a486fe9f0ebe424c3131c4bfd87ffd05b3dbc2882933abfcd6b6cde4" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHY01BMEdDU3FHU0liM0RRRUJBUVVBQTRHS0FEQ0JoZ0ovT3dzd2JGby91eUM4bHRHZi95QTFBK2dWNUlHZApuQWdQYlVTSTNHemJIQ0EreCtUTEcvdEx2YlJ3M3Ixc21wcFkvamtrcGlWVzFFclNNdU4wdWl4cDVnYjc4WjlyCkgxWHBXYjVXV2dwM1dhWS85RUhNak1kT2tRLzlMVlp2UnZsL00vRmk2b3dQK3ErYW1KSTFCRWpFQ1lmYmhHTDMKcm1sVmRxNHFYYzQwUXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMTkyLUNCQywwNEQyRDc4ODJFMEM0NzRFMDdFNTQyRkU5OTdEMkE0OQoKdmZCNUd0bTM0bjNTZUk2SkVMaldpR3c2TytqK3RHUjZXYmkzU05lQVprZlNBOFBUamVpNlBWSHIrZEdLNXpNZApuVGNrZDBFcHhJdHF4RWR0TEs2R3RCSWE5S1JkM2NFYmF5SG15eXliSDJGQzRTVFhKQ1VGQmUyZWI3WkttbkNsClJCNUZjbUFxRXhpZitRT0p3SG5adzZEVHpxK29HU3dpOWNTb3kycUU2MkZnWGtqOHVLQVljQkxPTm1zUDFZUUEKNHpJdWI0Ym5FYklnaEwvc3dFQi9IVlM4NkZ5TUNzTVhySEVPblN1VVVCZi9VZlpGTnlwSTZrVlVOWGxJdG5OMQoxNGVlUnNCRDM3VmtMN2RBUVBNeCtEd203RGJVMDdRV3JWdnpnbVdsdTNLcVIwdFJOQTllNGE1ZjE0WE9ZeGdTCkhaK1hWWks4aUFkKzc2T25wcmxGdEdEb3dEWEdNMHdVWFBZcTVqOFdwS3hOc1ZzMlJWK1M2VTBnUUxvU3FOeHQKV2U3VVBXWnVmekVkalRVTzhxOUtoZEdxRm1KNTNYSVlDbFpmMGJwMTQ4YitCazNQK2RONVRibUtRRWZ1bFNjbgpyVExUUm8zNGZkVElBSnI1QkpoME9YR05zOXJGbE1KOU56NEZ3VlRFQjFETWVyWHR0OUlDZGh1ZDlCa3RSaHZxCmF4Z296K1hBM0xyQnJsUFBjclNDWnlJWWpaRnlkR1Nremc0MzlPeURFWjYrdVJtYzBxaFdBNGo2QWdYeDZnR1IKTnZ2eXBvRlZLdlhxRXEvMkYrU1Z5eU1Hcm00eFBtc3IvSFVCZUU5U211VHpOekRmVkFNL3hlcnFJb1Iyc3pSMApPMGh3dE9qNGZrNy8vY2QxQ2pGemQwSmlGL1NxTWtIeGtkYm1JQzlxbGhzaGtXbFFidnZoYmVmb2RZUHVHeG1qCkwxVGFQZ1gzNk9jclFTb2R6eVdCTjV0U21tWDFObWZ0Y3o3aXdjNEFLcnFrZG5NM3NQUzNTY3pzQWpNV3JqUnIKN2lZaGRQUVNadHhWQ1RqQUNVM2g3c2NOQWc5QVU2bDRZWnJvd1IvL0o2VT0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha224 with 1024 keys and password, variant", + "scheme": "RSA-SHA224", + "signature": "396893f4cb3d464441ec75f5dcb6116d856254a0243276d58c0ea42c831d92e7570405c4cba46a29cfef540373cce770ba8733dc576e576d3a41c51fe725bb3cf59f8eeb82d366d4875d4fd577f3a4f98b0e53be322ef807414f675aeb20aff4d60557a224879ee1cb40cbacaad417ae39375ee267a8b20acfdf99cb28776c" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQkhqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FRc0FNSUlCQmdLQi9neTdtamFXZ1BlRmRWWURaV1JDQTlCTgppdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDdEFXcERzSDQ4VFhBZnlIQll3QkxndWF5Zms0TEdJdXB4YitDCkdNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzFmb0hERFVKRzg0dWFSYnlIcWFmNGk2enQ0Z1ZSK3hsQUVJamsKYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UGphSGoveXJpWi9TN3Jkd2xJM0xuQUJ4d3dtTHJtUi92NzFXdApwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9adkF1T2tGV0hvazJxL1I2UFlBYTJqZFo5emltMEZxT1ArbmtRCmFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1JHMC9WRmQrWmVNNTI1MVRlVHZYSDY5NW5sU0dhdVZsOUFnTUIKQUFFPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMjU2LUNCQyw3QTZBMDU1QUQ2NzU5NDdBNjU3MDQxNDIyRjA2RDQzOQoKSFFkanpBS1V1cXFLaFpIbXB6elkvbW9uZnFGaGlIblo1YzI0anRSOWZNNGFRSlhmL2UxZno2TUVoeUl6NlhPTgpzYjRDblhac3RueFV1VldEa0hFdTZLV1EvZEtBTGdpRFV1VCtVZE1hd1ZvVlBHZGd5V1pwMzVwUVBXaTNmVDJWClhabjU4WWtHOGJPM1k0MDNlWlB5aGFkT2VmRDFWdHVGdUs2L2Y5MGpqeng2WkRud3ZlWHBZZ0ZWN0p5MS9wRmQKY0xMTWYwN0MraGJrNDE2blg2VVZpcFdlNEdIK0FERm9tNVpDZkFhVW90TTduOGkxNDlkVUxORjRZWWkyd1AzMQoxWWFESDV2ZjFDcWlhaWVEWTd4THpwRWl4d0p6NlpFZzNnTFhhVXZ6Mk1wRjhvd2lHSTNlUDBnN3ZvV3AzeHQ0ClRReC9xRFVSbGFYaWFScmlXZFd0cEt5VzFNRnVKNStLZE50UjEva1hyMkJMUEIvWkx3eXF0eW5VeThaWXBiNCsKV0lSWXBVR2ViLy9aSEdobENIN0NSTWRBQnNhbDR3VHduemk5Zlc0QXg5NmVjSjJTbHdDdUt4d1M3aUVxMnkxLwpGQWZHd3NFK1h1ZkhobWU1cDZYaktmaUh4K3pKTUlCMk5Na3JtK3dtNFBiTVRyR1ZudzUvNDEvcjZYeE9COGZlCmlLaTEySnRoNGR1c2MxdllHWWZ6S29wOXVFTTZDWjYrQ2hxemIrWnloL3hVaVpWbENYL0JZbnhyN3lYVW05YVIKUEhRZ3hrbjJBY3Q4RmdRQjNLZ3MzakNpQ1JJSnJsc255YmVXelEzWU85VGpDNE14eWdtbXdPRERCcHNPS25FaQprWFhTNTQrY1pGamNzdmE0dUpWd2hBeXdSUFZVa0x6bVRrSDB0R2l3Q0hqZVFORUNtK1RMYWhra0VJWHJWVGI5CmM5Y3JlTlhNZ0U2alZWeitSNDNIWHNHdlRjZ01jQkx5RlJRSmUyblZhai9kUTVKYkY0dXFOblF6UmpBYkQzNEsKdVRwRmFKL2ttbGdjbWVTY1JMbndhb1l3RmxtaFNDK2JLMGRmWTFKcjZBUVJBNklEUDduSWpxV05EQ0hOQkI4cgpRajF2MktXb1ZRZTN4TkhhWGhrYkpQYkEyREtsVUlxZmZrQlZ0TUt0dDlLdUczUmNjZjNiVllBVzZvaWQ3My9ECno3RE1BRjVHL09wVlI4VmJHaDFXeFh1Ujd6RVZEVXdwd3NwOWVrNWRxTjhCbkJ6MXBwZFpOSUtxenN6bmVja1UKczJsLzZtWkJtZ1YxTmZ5L2NRVTZVNXMzUzFYYzc1VURRVkxtczNDSU9wRlRSSXBlY05UZGZhMzFmWXkvc3Z5MApNMmxXVGJDdmEwZE95dXZNVWhUZ0JMNEk3UWEyZFVNUFhITVphdFY1b29IWXEvQlpKQTFyODRDNWNNNXIrdW1FCjJMTHYvQmxVcjdSYVFIaGFLR240UWhwem81eVJERTltRXFEcExWa2JnOFN4TXNkZi9wRUY1L1Z5VXdBOXQ4UlQKZktWc0luUmQzODZ0RHFKU0RiU0ZxS1R2THp0ci81WUN5elp6dkMyWUIxdm9rby9jYU9HZDJkL0c1MUlqK2JYVQp4RU44VTRmSERCc0h3UFVHYjMxdVpVaFRYcEwzN0tpT3FabVhGb0gydXNtdXZ4ODgyWHZ5R2NWMEY0dHN0TWFSCktMS3psMlB3cXpBWUdGZXhMa1lLTXowVFlJZU42aDNiODZFVGF6UFBVNDlua2FFVTIzRHgyMUoyUmIzVWxIK0kKbERRRjN3dUgxUWxZaVRubGNWYS9adTRRUWcwL2lQOEFMa1owNm12bjllOW1PdG5BOGdzaDRCMm9McWMxOVZMVQpiY3B2NDBkVjFIM1c5TGN4OUI4SllVcDBjL095bm8xRDdZajN0akdjd01LRUNtVXBIaTRra3NlaFZvMC9QOTMzCnhtRm1DNmV5V1lWZE85dXB2WS92S1NCN2IxZE10ODVpV3IzZ25Nc1NmUlljNmpzYlN4ZGpPUFNUNDZVc0l6angKd2ExRFM2K0J2NXRpYUM0dUM2WCswdENBWm8rVU9RTVlVYlRHUlIvN2cvYz0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha224 with 2024 keys and password, variant", + "scheme": "RSA-SHA224", + "signature": "07485b248a0982fee043e712d078a2823aa83914f89eb30ad47a49497860bf8b4487333768f5b2eb43f155a8ebea7d192a9af92ba25721fda0c3c509e47c8775871b024ea3644f325b40375d09a3bb61c34e2eb323570723b91d701242f6c1a98bbbcef5bc02c70f18ab75857958befedf377e4ea2824033cfdf5afe18950677df4f0019e9080b963d50119f768526f503ef77d5720d565876b32595ea5b12cdcfe1337f5e9d55d82d459f19afce9f6c9357f9c303b3c1e6be91689de6152cb867b91c3fa1fef5db7cc17c271a5a722fcb536bd4cae4639eb29319bc78d0c576b9d499b38ca62e8a6b9ec3bb7ccb4c12c7a38b49ffba9c59bbf7616b8382" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHY01BMEdDU3FHU0liM0RRRUJBUVVBQTRHS0FEQ0JoZ0ovT3dzd2JGby91eUM4bHRHZi95QTFBK2dWNUlHZApuQWdQYlVTSTNHemJIQ0EreCtUTEcvdEx2YlJ3M3Ixc21wcFkvamtrcGlWVzFFclNNdU4wdWl4cDVnYjc4WjlyCkgxWHBXYjVXV2dwM1dhWS85RUhNak1kT2tRLzlMVlp2UnZsL00vRmk2b3dQK3ErYW1KSTFCRWpFQ1lmYmhHTDMKcm1sVmRxNHFYYzQwUXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMTkyLUNCQywwNEQyRDc4ODJFMEM0NzRFMDdFNTQyRkU5OTdEMkE0OQoKdmZCNUd0bTM0bjNTZUk2SkVMaldpR3c2TytqK3RHUjZXYmkzU05lQVprZlNBOFBUamVpNlBWSHIrZEdLNXpNZApuVGNrZDBFcHhJdHF4RWR0TEs2R3RCSWE5S1JkM2NFYmF5SG15eXliSDJGQzRTVFhKQ1VGQmUyZWI3WkttbkNsClJCNUZjbUFxRXhpZitRT0p3SG5adzZEVHpxK29HU3dpOWNTb3kycUU2MkZnWGtqOHVLQVljQkxPTm1zUDFZUUEKNHpJdWI0Ym5FYklnaEwvc3dFQi9IVlM4NkZ5TUNzTVhySEVPblN1VVVCZi9VZlpGTnlwSTZrVlVOWGxJdG5OMQoxNGVlUnNCRDM3VmtMN2RBUVBNeCtEd203RGJVMDdRV3JWdnpnbVdsdTNLcVIwdFJOQTllNGE1ZjE0WE9ZeGdTCkhaK1hWWks4aUFkKzc2T25wcmxGdEdEb3dEWEdNMHdVWFBZcTVqOFdwS3hOc1ZzMlJWK1M2VTBnUUxvU3FOeHQKV2U3VVBXWnVmekVkalRVTzhxOUtoZEdxRm1KNTNYSVlDbFpmMGJwMTQ4YitCazNQK2RONVRibUtRRWZ1bFNjbgpyVExUUm8zNGZkVElBSnI1QkpoME9YR05zOXJGbE1KOU56NEZ3VlRFQjFETWVyWHR0OUlDZGh1ZDlCa3RSaHZxCmF4Z296K1hBM0xyQnJsUFBjclNDWnlJWWpaRnlkR1Nremc0MzlPeURFWjYrdVJtYzBxaFdBNGo2QWdYeDZnR1IKTnZ2eXBvRlZLdlhxRXEvMkYrU1Z5eU1Hcm00eFBtc3IvSFVCZUU5U211VHpOekRmVkFNL3hlcnFJb1Iyc3pSMApPMGh3dE9qNGZrNy8vY2QxQ2pGemQwSmlGL1NxTWtIeGtkYm1JQzlxbGhzaGtXbFFidnZoYmVmb2RZUHVHeG1qCkwxVGFQZ1gzNk9jclFTb2R6eVdCTjV0U21tWDFObWZ0Y3o3aXdjNEFLcnFrZG5NM3NQUzNTY3pzQWpNV3JqUnIKN2lZaGRQUVNadHhWQ1RqQUNVM2g3c2NOQWc5QVU2bDRZWnJvd1IvL0o2VT0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha256 with 1024 keys and password, variant", + "scheme": "RSA-SHA256", + "signature": "22f9c7aa3526089785106cc95203e4d88f2e432b92830bcca8afb585c9a1b31ca1cc37db60035a3fa8ac599c8f03ace0505c8d65799466d54cf9216074103d1d3efeb8448af10fcc3ef8e820fa876b022f348c4a0964e118f81eb13bf318be2960a16345ddd86c930a4accb92f650ed43601c445448fc531146ea5657df27b" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQkhqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FRc0FNSUlCQmdLQi9neTdtamFXZ1BlRmRWWURaV1JDQTlCTgppdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDdEFXcERzSDQ4VFhBZnlIQll3QkxndWF5Zms0TEdJdXB4YitDCkdNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzFmb0hERFVKRzg0dWFSYnlIcWFmNGk2enQ0Z1ZSK3hsQUVJamsKYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UGphSGoveXJpWi9TN3Jkd2xJM0xuQUJ4d3dtTHJtUi92NzFXdApwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9adkF1T2tGV0hvazJxL1I2UFlBYTJqZFo5emltMEZxT1ArbmtRCmFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1JHMC9WRmQrWmVNNTI1MVRlVHZYSDY5NW5sU0dhdVZsOUFnTUIKQUFFPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMjU2LUNCQyw3QTZBMDU1QUQ2NzU5NDdBNjU3MDQxNDIyRjA2RDQzOQoKSFFkanpBS1V1cXFLaFpIbXB6elkvbW9uZnFGaGlIblo1YzI0anRSOWZNNGFRSlhmL2UxZno2TUVoeUl6NlhPTgpzYjRDblhac3RueFV1VldEa0hFdTZLV1EvZEtBTGdpRFV1VCtVZE1hd1ZvVlBHZGd5V1pwMzVwUVBXaTNmVDJWClhabjU4WWtHOGJPM1k0MDNlWlB5aGFkT2VmRDFWdHVGdUs2L2Y5MGpqeng2WkRud3ZlWHBZZ0ZWN0p5MS9wRmQKY0xMTWYwN0MraGJrNDE2blg2VVZpcFdlNEdIK0FERm9tNVpDZkFhVW90TTduOGkxNDlkVUxORjRZWWkyd1AzMQoxWWFESDV2ZjFDcWlhaWVEWTd4THpwRWl4d0p6NlpFZzNnTFhhVXZ6Mk1wRjhvd2lHSTNlUDBnN3ZvV3AzeHQ0ClRReC9xRFVSbGFYaWFScmlXZFd0cEt5VzFNRnVKNStLZE50UjEva1hyMkJMUEIvWkx3eXF0eW5VeThaWXBiNCsKV0lSWXBVR2ViLy9aSEdobENIN0NSTWRBQnNhbDR3VHduemk5Zlc0QXg5NmVjSjJTbHdDdUt4d1M3aUVxMnkxLwpGQWZHd3NFK1h1ZkhobWU1cDZYaktmaUh4K3pKTUlCMk5Na3JtK3dtNFBiTVRyR1ZudzUvNDEvcjZYeE9COGZlCmlLaTEySnRoNGR1c2MxdllHWWZ6S29wOXVFTTZDWjYrQ2hxemIrWnloL3hVaVpWbENYL0JZbnhyN3lYVW05YVIKUEhRZ3hrbjJBY3Q4RmdRQjNLZ3MzakNpQ1JJSnJsc255YmVXelEzWU85VGpDNE14eWdtbXdPRERCcHNPS25FaQprWFhTNTQrY1pGamNzdmE0dUpWd2hBeXdSUFZVa0x6bVRrSDB0R2l3Q0hqZVFORUNtK1RMYWhra0VJWHJWVGI5CmM5Y3JlTlhNZ0U2alZWeitSNDNIWHNHdlRjZ01jQkx5RlJRSmUyblZhai9kUTVKYkY0dXFOblF6UmpBYkQzNEsKdVRwRmFKL2ttbGdjbWVTY1JMbndhb1l3RmxtaFNDK2JLMGRmWTFKcjZBUVJBNklEUDduSWpxV05EQ0hOQkI4cgpRajF2MktXb1ZRZTN4TkhhWGhrYkpQYkEyREtsVUlxZmZrQlZ0TUt0dDlLdUczUmNjZjNiVllBVzZvaWQ3My9ECno3RE1BRjVHL09wVlI4VmJHaDFXeFh1Ujd6RVZEVXdwd3NwOWVrNWRxTjhCbkJ6MXBwZFpOSUtxenN6bmVja1UKczJsLzZtWkJtZ1YxTmZ5L2NRVTZVNXMzUzFYYzc1VURRVkxtczNDSU9wRlRSSXBlY05UZGZhMzFmWXkvc3Z5MApNMmxXVGJDdmEwZE95dXZNVWhUZ0JMNEk3UWEyZFVNUFhITVphdFY1b29IWXEvQlpKQTFyODRDNWNNNXIrdW1FCjJMTHYvQmxVcjdSYVFIaGFLR240UWhwem81eVJERTltRXFEcExWa2JnOFN4TXNkZi9wRUY1L1Z5VXdBOXQ4UlQKZktWc0luUmQzODZ0RHFKU0RiU0ZxS1R2THp0ci81WUN5elp6dkMyWUIxdm9rby9jYU9HZDJkL0c1MUlqK2JYVQp4RU44VTRmSERCc0h3UFVHYjMxdVpVaFRYcEwzN0tpT3FabVhGb0gydXNtdXZ4ODgyWHZ5R2NWMEY0dHN0TWFSCktMS3psMlB3cXpBWUdGZXhMa1lLTXowVFlJZU42aDNiODZFVGF6UFBVNDlua2FFVTIzRHgyMUoyUmIzVWxIK0kKbERRRjN3dUgxUWxZaVRubGNWYS9adTRRUWcwL2lQOEFMa1owNm12bjllOW1PdG5BOGdzaDRCMm9McWMxOVZMVQpiY3B2NDBkVjFIM1c5TGN4OUI4SllVcDBjL095bm8xRDdZajN0akdjd01LRUNtVXBIaTRra3NlaFZvMC9QOTMzCnhtRm1DNmV5V1lWZE85dXB2WS92S1NCN2IxZE10ODVpV3IzZ25Nc1NmUlljNmpzYlN4ZGpPUFNUNDZVc0l6angKd2ExRFM2K0J2NXRpYUM0dUM2WCswdENBWm8rVU9RTVlVYlRHUlIvN2cvYz0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha256 with 2024 keys and password, variant", + "scheme": "RSA-SHA256", + "signature": "03a9e6ccf3253b0200fe6ef9513e10aef7052c18724225e9f48ea9a4987e1dd1519b54c3326405c4d4c55bfbba13d2ebaf771d99faf8c52cb13e18ebff55f765b4bf3bd4ed138f2922f8be87c0c6587c8949a761b5485613949bab5beaa14d546444d8ed30905db58f0a56283ffe29ddf93a6673b945601abcf01a4b018c34818c25777d41ef0b0a1dd8efd217c1140ce12c59f24567640c3fa963a706744382c7b5504ad79f560e5c30e39ec712a43cf6591088ba780113817b53247c5b6062c81fa2690924a2820f32b5a0a6e2295a5f5e3cfa998f1479abdd97538a8bcfa0ba754ddcb3033c5e69be49a57aa5bd8ea23d423a1bd06966ba6f4aafbe76" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHY01BMEdDU3FHU0liM0RRRUJBUVVBQTRHS0FEQ0JoZ0ovT3dzd2JGby91eUM4bHRHZi95QTFBK2dWNUlHZApuQWdQYlVTSTNHemJIQ0EreCtUTEcvdEx2YlJ3M3Ixc21wcFkvamtrcGlWVzFFclNNdU4wdWl4cDVnYjc4WjlyCkgxWHBXYjVXV2dwM1dhWS85RUhNak1kT2tRLzlMVlp2UnZsL00vRmk2b3dQK3ErYW1KSTFCRWpFQ1lmYmhHTDMKcm1sVmRxNHFYYzQwUXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMTkyLUNCQywwNEQyRDc4ODJFMEM0NzRFMDdFNTQyRkU5OTdEMkE0OQoKdmZCNUd0bTM0bjNTZUk2SkVMaldpR3c2TytqK3RHUjZXYmkzU05lQVprZlNBOFBUamVpNlBWSHIrZEdLNXpNZApuVGNrZDBFcHhJdHF4RWR0TEs2R3RCSWE5S1JkM2NFYmF5SG15eXliSDJGQzRTVFhKQ1VGQmUyZWI3WkttbkNsClJCNUZjbUFxRXhpZitRT0p3SG5adzZEVHpxK29HU3dpOWNTb3kycUU2MkZnWGtqOHVLQVljQkxPTm1zUDFZUUEKNHpJdWI0Ym5FYklnaEwvc3dFQi9IVlM4NkZ5TUNzTVhySEVPblN1VVVCZi9VZlpGTnlwSTZrVlVOWGxJdG5OMQoxNGVlUnNCRDM3VmtMN2RBUVBNeCtEd203RGJVMDdRV3JWdnpnbVdsdTNLcVIwdFJOQTllNGE1ZjE0WE9ZeGdTCkhaK1hWWks4aUFkKzc2T25wcmxGdEdEb3dEWEdNMHdVWFBZcTVqOFdwS3hOc1ZzMlJWK1M2VTBnUUxvU3FOeHQKV2U3VVBXWnVmekVkalRVTzhxOUtoZEdxRm1KNTNYSVlDbFpmMGJwMTQ4YitCazNQK2RONVRibUtRRWZ1bFNjbgpyVExUUm8zNGZkVElBSnI1QkpoME9YR05zOXJGbE1KOU56NEZ3VlRFQjFETWVyWHR0OUlDZGh1ZDlCa3RSaHZxCmF4Z296K1hBM0xyQnJsUFBjclNDWnlJWWpaRnlkR1Nremc0MzlPeURFWjYrdVJtYzBxaFdBNGo2QWdYeDZnR1IKTnZ2eXBvRlZLdlhxRXEvMkYrU1Z5eU1Hcm00eFBtc3IvSFVCZUU5U211VHpOekRmVkFNL3hlcnFJb1Iyc3pSMApPMGh3dE9qNGZrNy8vY2QxQ2pGemQwSmlGL1NxTWtIeGtkYm1JQzlxbGhzaGtXbFFidnZoYmVmb2RZUHVHeG1qCkwxVGFQZ1gzNk9jclFTb2R6eVdCTjV0U21tWDFObWZ0Y3o3aXdjNEFLcnFrZG5NM3NQUzNTY3pzQWpNV3JqUnIKN2lZaGRQUVNadHhWQ1RqQUNVM2g3c2NOQWc5QVU2bDRZWnJvd1IvL0o2VT0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha384 with 1024 keys and password, variant", + "scheme": "RSA-SHA384", + "signature": "25ae78c57507c8d373fb2a0d1af5b80dfc17d60244c3290af8662d4b37d66a971168c46e0d925fb33760ad88ee889b9d904d18510fb4c8ffc3569bedb9bebd75b2c8ed7e1e2e5f1001c831626a3d8789a5165abfad92bcd863122257a49d08994fe35990f5986c8d00e435e04161d0146e522c95e5607f3a23e987f4140a7d" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQkhqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FRc0FNSUlCQmdLQi9neTdtamFXZ1BlRmRWWURaV1JDQTlCTgppdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDdEFXcERzSDQ4VFhBZnlIQll3QkxndWF5Zms0TEdJdXB4YitDCkdNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzFmb0hERFVKRzg0dWFSYnlIcWFmNGk2enQ0Z1ZSK3hsQUVJamsKYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UGphSGoveXJpWi9TN3Jkd2xJM0xuQUJ4d3dtTHJtUi92NzFXdApwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9adkF1T2tGV0hvazJxL1I2UFlBYTJqZFo5emltMEZxT1ArbmtRCmFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1JHMC9WRmQrWmVNNTI1MVRlVHZYSDY5NW5sU0dhdVZsOUFnTUIKQUFFPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMjU2LUNCQyw3QTZBMDU1QUQ2NzU5NDdBNjU3MDQxNDIyRjA2RDQzOQoKSFFkanpBS1V1cXFLaFpIbXB6elkvbW9uZnFGaGlIblo1YzI0anRSOWZNNGFRSlhmL2UxZno2TUVoeUl6NlhPTgpzYjRDblhac3RueFV1VldEa0hFdTZLV1EvZEtBTGdpRFV1VCtVZE1hd1ZvVlBHZGd5V1pwMzVwUVBXaTNmVDJWClhabjU4WWtHOGJPM1k0MDNlWlB5aGFkT2VmRDFWdHVGdUs2L2Y5MGpqeng2WkRud3ZlWHBZZ0ZWN0p5MS9wRmQKY0xMTWYwN0MraGJrNDE2blg2VVZpcFdlNEdIK0FERm9tNVpDZkFhVW90TTduOGkxNDlkVUxORjRZWWkyd1AzMQoxWWFESDV2ZjFDcWlhaWVEWTd4THpwRWl4d0p6NlpFZzNnTFhhVXZ6Mk1wRjhvd2lHSTNlUDBnN3ZvV3AzeHQ0ClRReC9xRFVSbGFYaWFScmlXZFd0cEt5VzFNRnVKNStLZE50UjEva1hyMkJMUEIvWkx3eXF0eW5VeThaWXBiNCsKV0lSWXBVR2ViLy9aSEdobENIN0NSTWRBQnNhbDR3VHduemk5Zlc0QXg5NmVjSjJTbHdDdUt4d1M3aUVxMnkxLwpGQWZHd3NFK1h1ZkhobWU1cDZYaktmaUh4K3pKTUlCMk5Na3JtK3dtNFBiTVRyR1ZudzUvNDEvcjZYeE9COGZlCmlLaTEySnRoNGR1c2MxdllHWWZ6S29wOXVFTTZDWjYrQ2hxemIrWnloL3hVaVpWbENYL0JZbnhyN3lYVW05YVIKUEhRZ3hrbjJBY3Q4RmdRQjNLZ3MzakNpQ1JJSnJsc255YmVXelEzWU85VGpDNE14eWdtbXdPRERCcHNPS25FaQprWFhTNTQrY1pGamNzdmE0dUpWd2hBeXdSUFZVa0x6bVRrSDB0R2l3Q0hqZVFORUNtK1RMYWhra0VJWHJWVGI5CmM5Y3JlTlhNZ0U2alZWeitSNDNIWHNHdlRjZ01jQkx5RlJRSmUyblZhai9kUTVKYkY0dXFOblF6UmpBYkQzNEsKdVRwRmFKL2ttbGdjbWVTY1JMbndhb1l3RmxtaFNDK2JLMGRmWTFKcjZBUVJBNklEUDduSWpxV05EQ0hOQkI4cgpRajF2MktXb1ZRZTN4TkhhWGhrYkpQYkEyREtsVUlxZmZrQlZ0TUt0dDlLdUczUmNjZjNiVllBVzZvaWQ3My9ECno3RE1BRjVHL09wVlI4VmJHaDFXeFh1Ujd6RVZEVXdwd3NwOWVrNWRxTjhCbkJ6MXBwZFpOSUtxenN6bmVja1UKczJsLzZtWkJtZ1YxTmZ5L2NRVTZVNXMzUzFYYzc1VURRVkxtczNDSU9wRlRSSXBlY05UZGZhMzFmWXkvc3Z5MApNMmxXVGJDdmEwZE95dXZNVWhUZ0JMNEk3UWEyZFVNUFhITVphdFY1b29IWXEvQlpKQTFyODRDNWNNNXIrdW1FCjJMTHYvQmxVcjdSYVFIaGFLR240UWhwem81eVJERTltRXFEcExWa2JnOFN4TXNkZi9wRUY1L1Z5VXdBOXQ4UlQKZktWc0luUmQzODZ0RHFKU0RiU0ZxS1R2THp0ci81WUN5elp6dkMyWUIxdm9rby9jYU9HZDJkL0c1MUlqK2JYVQp4RU44VTRmSERCc0h3UFVHYjMxdVpVaFRYcEwzN0tpT3FabVhGb0gydXNtdXZ4ODgyWHZ5R2NWMEY0dHN0TWFSCktMS3psMlB3cXpBWUdGZXhMa1lLTXowVFlJZU42aDNiODZFVGF6UFBVNDlua2FFVTIzRHgyMUoyUmIzVWxIK0kKbERRRjN3dUgxUWxZaVRubGNWYS9adTRRUWcwL2lQOEFMa1owNm12bjllOW1PdG5BOGdzaDRCMm9McWMxOVZMVQpiY3B2NDBkVjFIM1c5TGN4OUI4SllVcDBjL095bm8xRDdZajN0akdjd01LRUNtVXBIaTRra3NlaFZvMC9QOTMzCnhtRm1DNmV5V1lWZE85dXB2WS92S1NCN2IxZE10ODVpV3IzZ25Nc1NmUlljNmpzYlN4ZGpPUFNUNDZVc0l6angKd2ExRFM2K0J2NXRpYUM0dUM2WCswdENBWm8rVU9RTVlVYlRHUlIvN2cvYz0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha384 with 2024 keys and password, variant", + "scheme": "RSA-SHA384", + "signature": "05eb2dd2b2c0bc157283d7e41c36488f33d3c520d194a0655005b3f21147f5fb22b7319068a29ce8ee2c8f2fef4317f7eb4c94244e586183e4ec88f2fe39cbfc21491ee949cfefc4a2bf7525c6b892576f97201aa8fc3ddec3c642b857a53de611f52a20f6debfdbf866d1ab583c8edfe868043ce4b0139207f149b7d9a469f0ac0b4de17bd73fda20190961f9a754198f63a42ca4073501172b0025f9b3aaa95d445470671162b2808db9a0452b977781a95642cdcb6bda48fc1198b14863a5c9f37d921f413de0d4f62cb12cfe2f11620d3a3fb60d4dcb8755521654b02e75225fc3558467217f7ad104ad4712e579ee5a2c43369c8f26117f61da1f51" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHY01BMEdDU3FHU0liM0RRRUJBUVVBQTRHS0FEQ0JoZ0ovT3dzd2JGby91eUM4bHRHZi95QTFBK2dWNUlHZApuQWdQYlVTSTNHemJIQ0EreCtUTEcvdEx2YlJ3M3Ixc21wcFkvamtrcGlWVzFFclNNdU4wdWl4cDVnYjc4WjlyCkgxWHBXYjVXV2dwM1dhWS85RUhNak1kT2tRLzlMVlp2UnZsL00vRmk2b3dQK3ErYW1KSTFCRWpFQ1lmYmhHTDMKcm1sVmRxNHFYYzQwUXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMTkyLUNCQywwNEQyRDc4ODJFMEM0NzRFMDdFNTQyRkU5OTdEMkE0OQoKdmZCNUd0bTM0bjNTZUk2SkVMaldpR3c2TytqK3RHUjZXYmkzU05lQVprZlNBOFBUamVpNlBWSHIrZEdLNXpNZApuVGNrZDBFcHhJdHF4RWR0TEs2R3RCSWE5S1JkM2NFYmF5SG15eXliSDJGQzRTVFhKQ1VGQmUyZWI3WkttbkNsClJCNUZjbUFxRXhpZitRT0p3SG5adzZEVHpxK29HU3dpOWNTb3kycUU2MkZnWGtqOHVLQVljQkxPTm1zUDFZUUEKNHpJdWI0Ym5FYklnaEwvc3dFQi9IVlM4NkZ5TUNzTVhySEVPblN1VVVCZi9VZlpGTnlwSTZrVlVOWGxJdG5OMQoxNGVlUnNCRDM3VmtMN2RBUVBNeCtEd203RGJVMDdRV3JWdnpnbVdsdTNLcVIwdFJOQTllNGE1ZjE0WE9ZeGdTCkhaK1hWWks4aUFkKzc2T25wcmxGdEdEb3dEWEdNMHdVWFBZcTVqOFdwS3hOc1ZzMlJWK1M2VTBnUUxvU3FOeHQKV2U3VVBXWnVmekVkalRVTzhxOUtoZEdxRm1KNTNYSVlDbFpmMGJwMTQ4YitCazNQK2RONVRibUtRRWZ1bFNjbgpyVExUUm8zNGZkVElBSnI1QkpoME9YR05zOXJGbE1KOU56NEZ3VlRFQjFETWVyWHR0OUlDZGh1ZDlCa3RSaHZxCmF4Z296K1hBM0xyQnJsUFBjclNDWnlJWWpaRnlkR1Nremc0MzlPeURFWjYrdVJtYzBxaFdBNGo2QWdYeDZnR1IKTnZ2eXBvRlZLdlhxRXEvMkYrU1Z5eU1Hcm00eFBtc3IvSFVCZUU5U211VHpOekRmVkFNL3hlcnFJb1Iyc3pSMApPMGh3dE9qNGZrNy8vY2QxQ2pGemQwSmlGL1NxTWtIeGtkYm1JQzlxbGhzaGtXbFFidnZoYmVmb2RZUHVHeG1qCkwxVGFQZ1gzNk9jclFTb2R6eVdCTjV0U21tWDFObWZ0Y3o3aXdjNEFLcnFrZG5NM3NQUzNTY3pzQWpNV3JqUnIKN2lZaGRQUVNadHhWQ1RqQUNVM2g3c2NOQWc5QVU2bDRZWnJvd1IvL0o2VT0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha512 with 1024 keys and password, variant", + "scheme": "RSA-SHA512", + "signature": "2872276e948f2bf7d4656e857ea848f563cc2aa10b0bc23977f8432ec9a16b6cdb4ff6157347043f2b5baa74ee1e3ae26e9d8e01572debeceabe9fa1d525bd81b5bacc389e17146b70829f583cf00fc1cce23905b8578cd831181cc53dab9946b42ab05dbe9942322e8b88d2a6790756a7cc3d56d54df723b23d4db03f32a3" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQkhqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FRc0FNSUlCQmdLQi9neTdtamFXZ1BlRmRWWURaV1JDQTlCTgppdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDdEFXcERzSDQ4VFhBZnlIQll3QkxndWF5Zms0TEdJdXB4YitDCkdNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzFmb0hERFVKRzg0dWFSYnlIcWFmNGk2enQ0Z1ZSK3hsQUVJamsKYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UGphSGoveXJpWi9TN3Jkd2xJM0xuQUJ4d3dtTHJtUi92NzFXdApwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9adkF1T2tGV0hvazJxL1I2UFlBYTJqZFo5emltMEZxT1ArbmtRCmFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1JHMC9WRmQrWmVNNTI1MVRlVHZYSDY5NW5sU0dhdVZsOUFnTUIKQUFFPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMjU2LUNCQyw3QTZBMDU1QUQ2NzU5NDdBNjU3MDQxNDIyRjA2RDQzOQoKSFFkanpBS1V1cXFLaFpIbXB6elkvbW9uZnFGaGlIblo1YzI0anRSOWZNNGFRSlhmL2UxZno2TUVoeUl6NlhPTgpzYjRDblhac3RueFV1VldEa0hFdTZLV1EvZEtBTGdpRFV1VCtVZE1hd1ZvVlBHZGd5V1pwMzVwUVBXaTNmVDJWClhabjU4WWtHOGJPM1k0MDNlWlB5aGFkT2VmRDFWdHVGdUs2L2Y5MGpqeng2WkRud3ZlWHBZZ0ZWN0p5MS9wRmQKY0xMTWYwN0MraGJrNDE2blg2VVZpcFdlNEdIK0FERm9tNVpDZkFhVW90TTduOGkxNDlkVUxORjRZWWkyd1AzMQoxWWFESDV2ZjFDcWlhaWVEWTd4THpwRWl4d0p6NlpFZzNnTFhhVXZ6Mk1wRjhvd2lHSTNlUDBnN3ZvV3AzeHQ0ClRReC9xRFVSbGFYaWFScmlXZFd0cEt5VzFNRnVKNStLZE50UjEva1hyMkJMUEIvWkx3eXF0eW5VeThaWXBiNCsKV0lSWXBVR2ViLy9aSEdobENIN0NSTWRBQnNhbDR3VHduemk5Zlc0QXg5NmVjSjJTbHdDdUt4d1M3aUVxMnkxLwpGQWZHd3NFK1h1ZkhobWU1cDZYaktmaUh4K3pKTUlCMk5Na3JtK3dtNFBiTVRyR1ZudzUvNDEvcjZYeE9COGZlCmlLaTEySnRoNGR1c2MxdllHWWZ6S29wOXVFTTZDWjYrQ2hxemIrWnloL3hVaVpWbENYL0JZbnhyN3lYVW05YVIKUEhRZ3hrbjJBY3Q4RmdRQjNLZ3MzakNpQ1JJSnJsc255YmVXelEzWU85VGpDNE14eWdtbXdPRERCcHNPS25FaQprWFhTNTQrY1pGamNzdmE0dUpWd2hBeXdSUFZVa0x6bVRrSDB0R2l3Q0hqZVFORUNtK1RMYWhra0VJWHJWVGI5CmM5Y3JlTlhNZ0U2alZWeitSNDNIWHNHdlRjZ01jQkx5RlJRSmUyblZhai9kUTVKYkY0dXFOblF6UmpBYkQzNEsKdVRwRmFKL2ttbGdjbWVTY1JMbndhb1l3RmxtaFNDK2JLMGRmWTFKcjZBUVJBNklEUDduSWpxV05EQ0hOQkI4cgpRajF2MktXb1ZRZTN4TkhhWGhrYkpQYkEyREtsVUlxZmZrQlZ0TUt0dDlLdUczUmNjZjNiVllBVzZvaWQ3My9ECno3RE1BRjVHL09wVlI4VmJHaDFXeFh1Ujd6RVZEVXdwd3NwOWVrNWRxTjhCbkJ6MXBwZFpOSUtxenN6bmVja1UKczJsLzZtWkJtZ1YxTmZ5L2NRVTZVNXMzUzFYYzc1VURRVkxtczNDSU9wRlRSSXBlY05UZGZhMzFmWXkvc3Z5MApNMmxXVGJDdmEwZE95dXZNVWhUZ0JMNEk3UWEyZFVNUFhITVphdFY1b29IWXEvQlpKQTFyODRDNWNNNXIrdW1FCjJMTHYvQmxVcjdSYVFIaGFLR240UWhwem81eVJERTltRXFEcExWa2JnOFN4TXNkZi9wRUY1L1Z5VXdBOXQ4UlQKZktWc0luUmQzODZ0RHFKU0RiU0ZxS1R2THp0ci81WUN5elp6dkMyWUIxdm9rby9jYU9HZDJkL0c1MUlqK2JYVQp4RU44VTRmSERCc0h3UFVHYjMxdVpVaFRYcEwzN0tpT3FabVhGb0gydXNtdXZ4ODgyWHZ5R2NWMEY0dHN0TWFSCktMS3psMlB3cXpBWUdGZXhMa1lLTXowVFlJZU42aDNiODZFVGF6UFBVNDlua2FFVTIzRHgyMUoyUmIzVWxIK0kKbERRRjN3dUgxUWxZaVRubGNWYS9adTRRUWcwL2lQOEFMa1owNm12bjllOW1PdG5BOGdzaDRCMm9McWMxOVZMVQpiY3B2NDBkVjFIM1c5TGN4OUI4SllVcDBjL095bm8xRDdZajN0akdjd01LRUNtVXBIaTRra3NlaFZvMC9QOTMzCnhtRm1DNmV5V1lWZE85dXB2WS92S1NCN2IxZE10ODVpV3IzZ25Nc1NmUlljNmpzYlN4ZGpPUFNUNDZVc0l6angKd2ExRFM2K0J2NXRpYUM0dUM2WCswdENBWm8rVU9RTVlVYlRHUlIvN2cvYz0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "sha512 with 2024 keys and password, variant", + "scheme": "RSA-SHA512", + "signature": "08da77dece1d587e229584f7f485c1b93dd01d6b1563b1f57525a2baf2958da795147fb596624658e9c2a198549e6d38ba132784e02b4bf0db5891c6f0a314b1403e1d83ded6c622aba1106114815f81350879314bf4e6232d047582ca90cefc3463d642ffeb65c2ce6ca71754d17a97b747ddc6da3f429e33aaa62ba9cc0981f5806839df67db99bce889bfb50a44f3cf3dde1e870d182103748157ac0dcd3b18aff97dda9333621371ce1f6ccdb8bb8dff8ef970be9f147492db2eea19c7e353ac6d0e348e07bf3846f1f8bdb89560e1e7d6ffdf72b44c34b3894a6cb96985e5643c01d9df3d879a443d7b120bcfae78bfeca5a0147b8dbe17e5c5b8cb" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHY01BMEdDU3FHU0liM0RRRUJBUVVBQTRHS0FEQ0JoZ0ovT3dzd2JGby91eUM4bHRHZi95QTFBK2dWNUlHZApuQWdQYlVTSTNHemJIQ0EreCtUTEcvdEx2YlJ3M3Ixc21wcFkvamtrcGlWVzFFclNNdU4wdWl4cDVnYjc4WjlyCkgxWHBXYjVXV2dwM1dhWS85RUhNak1kT2tRLzlMVlp2UnZsL00vRmk2b3dQK3ErYW1KSTFCRWpFQ1lmYmhHTDMKcm1sVmRxNHFYYzQwUXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMTkyLUNCQywwNEQyRDc4ODJFMEM0NzRFMDdFNTQyRkU5OTdEMkE0OQoKdmZCNUd0bTM0bjNTZUk2SkVMaldpR3c2TytqK3RHUjZXYmkzU05lQVprZlNBOFBUamVpNlBWSHIrZEdLNXpNZApuVGNrZDBFcHhJdHF4RWR0TEs2R3RCSWE5S1JkM2NFYmF5SG15eXliSDJGQzRTVFhKQ1VGQmUyZWI3WkttbkNsClJCNUZjbUFxRXhpZitRT0p3SG5adzZEVHpxK29HU3dpOWNTb3kycUU2MkZnWGtqOHVLQVljQkxPTm1zUDFZUUEKNHpJdWI0Ym5FYklnaEwvc3dFQi9IVlM4NkZ5TUNzTVhySEVPblN1VVVCZi9VZlpGTnlwSTZrVlVOWGxJdG5OMQoxNGVlUnNCRDM3VmtMN2RBUVBNeCtEd203RGJVMDdRV3JWdnpnbVdsdTNLcVIwdFJOQTllNGE1ZjE0WE9ZeGdTCkhaK1hWWks4aUFkKzc2T25wcmxGdEdEb3dEWEdNMHdVWFBZcTVqOFdwS3hOc1ZzMlJWK1M2VTBnUUxvU3FOeHQKV2U3VVBXWnVmekVkalRVTzhxOUtoZEdxRm1KNTNYSVlDbFpmMGJwMTQ4YitCazNQK2RONVRibUtRRWZ1bFNjbgpyVExUUm8zNGZkVElBSnI1QkpoME9YR05zOXJGbE1KOU56NEZ3VlRFQjFETWVyWHR0OUlDZGh1ZDlCa3RSaHZxCmF4Z296K1hBM0xyQnJsUFBjclNDWnlJWWpaRnlkR1Nremc0MzlPeURFWjYrdVJtYzBxaFdBNGo2QWdYeDZnR1IKTnZ2eXBvRlZLdlhxRXEvMkYrU1Z5eU1Hcm00eFBtc3IvSFVCZUU5U211VHpOekRmVkFNL3hlcnFJb1Iyc3pSMApPMGh3dE9qNGZrNy8vY2QxQ2pGemQwSmlGL1NxTWtIeGtkYm1JQzlxbGhzaGtXbFFidnZoYmVmb2RZUHVHeG1qCkwxVGFQZ1gzNk9jclFTb2R6eVdCTjV0U21tWDFObWZ0Y3o3aXdjNEFLcnFrZG5NM3NQUzNTY3pzQWpNV3JqUnIKN2lZaGRQUVNadHhWQ1RqQUNVM2g3c2NOQWc5QVU2bDRZWnJvd1IvL0o2VT0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "rmd160 with 1024 keys and password, variant", + "scheme": "RSA-RIPEMD160", + "signature": "28b00d0b59d31da7f0719b7299c89669b691e55150427ee9b39e76ec06e17cdf33903e9d75d2196e7b61fbc5dfe4e9a374a872145ca0fb8dc25910b19fba61aaa196f1c28aa99efe636090b5778deeb42c3a15a57ca4d6008cb86b779b86526c62457e5e6ec16686143aafe2398bc493aef016d35fef974fa462dba26a84e6" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQkhqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FRc0FNSUlCQmdLQi9neTdtamFXZ1BlRmRWWURaV1JDQTlCTgppdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDdEFXcERzSDQ4VFhBZnlIQll3QkxndWF5Zms0TEdJdXB4YitDCkdNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzFmb0hERFVKRzg0dWFSYnlIcWFmNGk2enQ0Z1ZSK3hsQUVJamsKYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UGphSGoveXJpWi9TN3Jkd2xJM0xuQUJ4d3dtTHJtUi92NzFXdApwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9adkF1T2tGV0hvazJxL1I2UFlBYTJqZFo5emltMEZxT1ArbmtRCmFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1JHMC9WRmQrWmVNNTI1MVRlVHZYSDY5NW5sU0dhdVZsOUFnTUIKQUFFPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMjU2LUNCQyw3QTZBMDU1QUQ2NzU5NDdBNjU3MDQxNDIyRjA2RDQzOQoKSFFkanpBS1V1cXFLaFpIbXB6elkvbW9uZnFGaGlIblo1YzI0anRSOWZNNGFRSlhmL2UxZno2TUVoeUl6NlhPTgpzYjRDblhac3RueFV1VldEa0hFdTZLV1EvZEtBTGdpRFV1VCtVZE1hd1ZvVlBHZGd5V1pwMzVwUVBXaTNmVDJWClhabjU4WWtHOGJPM1k0MDNlWlB5aGFkT2VmRDFWdHVGdUs2L2Y5MGpqeng2WkRud3ZlWHBZZ0ZWN0p5MS9wRmQKY0xMTWYwN0MraGJrNDE2blg2VVZpcFdlNEdIK0FERm9tNVpDZkFhVW90TTduOGkxNDlkVUxORjRZWWkyd1AzMQoxWWFESDV2ZjFDcWlhaWVEWTd4THpwRWl4d0p6NlpFZzNnTFhhVXZ6Mk1wRjhvd2lHSTNlUDBnN3ZvV3AzeHQ0ClRReC9xRFVSbGFYaWFScmlXZFd0cEt5VzFNRnVKNStLZE50UjEva1hyMkJMUEIvWkx3eXF0eW5VeThaWXBiNCsKV0lSWXBVR2ViLy9aSEdobENIN0NSTWRBQnNhbDR3VHduemk5Zlc0QXg5NmVjSjJTbHdDdUt4d1M3aUVxMnkxLwpGQWZHd3NFK1h1ZkhobWU1cDZYaktmaUh4K3pKTUlCMk5Na3JtK3dtNFBiTVRyR1ZudzUvNDEvcjZYeE9COGZlCmlLaTEySnRoNGR1c2MxdllHWWZ6S29wOXVFTTZDWjYrQ2hxemIrWnloL3hVaVpWbENYL0JZbnhyN3lYVW05YVIKUEhRZ3hrbjJBY3Q4RmdRQjNLZ3MzakNpQ1JJSnJsc255YmVXelEzWU85VGpDNE14eWdtbXdPRERCcHNPS25FaQprWFhTNTQrY1pGamNzdmE0dUpWd2hBeXdSUFZVa0x6bVRrSDB0R2l3Q0hqZVFORUNtK1RMYWhra0VJWHJWVGI5CmM5Y3JlTlhNZ0U2alZWeitSNDNIWHNHdlRjZ01jQkx5RlJRSmUyblZhai9kUTVKYkY0dXFOblF6UmpBYkQzNEsKdVRwRmFKL2ttbGdjbWVTY1JMbndhb1l3RmxtaFNDK2JLMGRmWTFKcjZBUVJBNklEUDduSWpxV05EQ0hOQkI4cgpRajF2MktXb1ZRZTN4TkhhWGhrYkpQYkEyREtsVUlxZmZrQlZ0TUt0dDlLdUczUmNjZjNiVllBVzZvaWQ3My9ECno3RE1BRjVHL09wVlI4VmJHaDFXeFh1Ujd6RVZEVXdwd3NwOWVrNWRxTjhCbkJ6MXBwZFpOSUtxenN6bmVja1UKczJsLzZtWkJtZ1YxTmZ5L2NRVTZVNXMzUzFYYzc1VURRVkxtczNDSU9wRlRSSXBlY05UZGZhMzFmWXkvc3Z5MApNMmxXVGJDdmEwZE95dXZNVWhUZ0JMNEk3UWEyZFVNUFhITVphdFY1b29IWXEvQlpKQTFyODRDNWNNNXIrdW1FCjJMTHYvQmxVcjdSYVFIaGFLR240UWhwem81eVJERTltRXFEcExWa2JnOFN4TXNkZi9wRUY1L1Z5VXdBOXQ4UlQKZktWc0luUmQzODZ0RHFKU0RiU0ZxS1R2THp0ci81WUN5elp6dkMyWUIxdm9rby9jYU9HZDJkL0c1MUlqK2JYVQp4RU44VTRmSERCc0h3UFVHYjMxdVpVaFRYcEwzN0tpT3FabVhGb0gydXNtdXZ4ODgyWHZ5R2NWMEY0dHN0TWFSCktMS3psMlB3cXpBWUdGZXhMa1lLTXowVFlJZU42aDNiODZFVGF6UFBVNDlua2FFVTIzRHgyMUoyUmIzVWxIK0kKbERRRjN3dUgxUWxZaVRubGNWYS9adTRRUWcwL2lQOEFMa1owNm12bjllOW1PdG5BOGdzaDRCMm9McWMxOVZMVQpiY3B2NDBkVjFIM1c5TGN4OUI4SllVcDBjL095bm8xRDdZajN0akdjd01LRUNtVXBIaTRra3NlaFZvMC9QOTMzCnhtRm1DNmV5V1lWZE85dXB2WS92S1NCN2IxZE10ODVpV3IzZ25Nc1NmUlljNmpzYlN4ZGpPUFNUNDZVc0l6angKd2ExRFM2K0J2NXRpYUM0dUM2WCswdENBWm8rVU9RTVlVYlRHUlIvN2cvYz0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "rmd160 with 2024 keys and password, variant", + "scheme": "RSA-RIPEMD160", + "signature": "0313943380ae425f6d1fad52f0d19b546dd3b98c99f05816694f1506e914d88e3558c76d857380e02740ee3fc62d8ffdcfb9a87fb7ea0676583327707d3fbc39f487857e093fd54de835d8245f7bae2f410e9132c2c73bc31fb87fd06d97064efc0d7dda6303b5e912e9c6bfef767ec4b60b92a550c5169094d5785fd44bb405af99c9e9a68367c1686295da4f39c4eed672043d4116629ee7e2c0700e187913c1fdeb9244f1167880873137963c0135aa09c3c8c710c213eb54648b4ae5e54558ff254f9751efa2677a902418e5d49110980996f6d258e0a43441e8d1f6344502d689ddc0e847b983fefb5687344a9177f77b4e27685b0bdcc3458dd1eb" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHY01BMEdDU3FHU0liM0RRRUJBUVVBQTRHS0FEQ0JoZ0ovT3dzd2JGby91eUM4bHRHZi95QTFBK2dWNUlHZApuQWdQYlVTSTNHemJIQ0EreCtUTEcvdEx2YlJ3M3Ixc21wcFkvamtrcGlWVzFFclNNdU4wdWl4cDVnYjc4WjlyCkgxWHBXYjVXV2dwM1dhWS85RUhNak1kT2tRLzlMVlp2UnZsL00vRmk2b3dQK3ErYW1KSTFCRWpFQ1lmYmhHTDMKcm1sVmRxNHFYYzQwUXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMTkyLUNCQywwNEQyRDc4ODJFMEM0NzRFMDdFNTQyRkU5OTdEMkE0OQoKdmZCNUd0bTM0bjNTZUk2SkVMaldpR3c2TytqK3RHUjZXYmkzU05lQVprZlNBOFBUamVpNlBWSHIrZEdLNXpNZApuVGNrZDBFcHhJdHF4RWR0TEs2R3RCSWE5S1JkM2NFYmF5SG15eXliSDJGQzRTVFhKQ1VGQmUyZWI3WkttbkNsClJCNUZjbUFxRXhpZitRT0p3SG5adzZEVHpxK29HU3dpOWNTb3kycUU2MkZnWGtqOHVLQVljQkxPTm1zUDFZUUEKNHpJdWI0Ym5FYklnaEwvc3dFQi9IVlM4NkZ5TUNzTVhySEVPblN1VVVCZi9VZlpGTnlwSTZrVlVOWGxJdG5OMQoxNGVlUnNCRDM3VmtMN2RBUVBNeCtEd203RGJVMDdRV3JWdnpnbVdsdTNLcVIwdFJOQTllNGE1ZjE0WE9ZeGdTCkhaK1hWWks4aUFkKzc2T25wcmxGdEdEb3dEWEdNMHdVWFBZcTVqOFdwS3hOc1ZzMlJWK1M2VTBnUUxvU3FOeHQKV2U3VVBXWnVmekVkalRVTzhxOUtoZEdxRm1KNTNYSVlDbFpmMGJwMTQ4YitCazNQK2RONVRibUtRRWZ1bFNjbgpyVExUUm8zNGZkVElBSnI1QkpoME9YR05zOXJGbE1KOU56NEZ3VlRFQjFETWVyWHR0OUlDZGh1ZDlCa3RSaHZxCmF4Z296K1hBM0xyQnJsUFBjclNDWnlJWWpaRnlkR1Nremc0MzlPeURFWjYrdVJtYzBxaFdBNGo2QWdYeDZnR1IKTnZ2eXBvRlZLdlhxRXEvMkYrU1Z5eU1Hcm00eFBtc3IvSFVCZUU5U211VHpOekRmVkFNL3hlcnFJb1Iyc3pSMApPMGh3dE9qNGZrNy8vY2QxQ2pGemQwSmlGL1NxTWtIeGtkYm1JQzlxbGhzaGtXbFFidnZoYmVmb2RZUHVHeG1qCkwxVGFQZ1gzNk9jclFTb2R6eVdCTjV0U21tWDFObWZ0Y3o3aXdjNEFLcnFrZG5NM3NQUzNTY3pzQWpNV3JqUnIKN2lZaGRQUVNadHhWQ1RqQUNVM2g3c2NOQWc5QVU2bDRZWnJvd1IvL0o2VT0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "md5 with 1024 keys and password, variant", + "scheme": "RSA-MD5", + "signature": "30929c6320f9fa5b910123d4900c1c1723711ff9146052ee161ed3a33a4316ead3665cc4a12e89a6975cb63385bb425e462a1437148d519bfffad0c415330af996f1f3226d2c92e120c5fb468bfe06494909beda8566e90c2c90e19f92208eea793a80898f4849edbc3b2af4706a2aa0f99835eda34db6530f3e8d907712c4" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQkhqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FRc0FNSUlCQmdLQi9neTdtamFXZ1BlRmRWWURaV1JDQTlCTgppdjNwUGIwZXMyNytGS1kwaHN6TGFPdzQ3RXhDdEFXcERzSDQ4VFhBZnlIQll3QkxndWF5Zms0TEdJdXB4YitDCkdNYlJvM3hFcDBDYmZZMUpieTI2VDl2R2pSQzFmb0hERFVKRzg0dWFSYnlIcWFmNGk2enQ0Z1ZSK3hsQUVJamsKYUZBQUs4Y09vWEFUMUNWcUdMTGxqVUNjaEw4UGphSGoveXJpWi9TN3Jkd2xJM0xuQUJ4d3dtTHJtUi92NzFXdApwbU8vYU5HOE4rMXBvK1F3YWdoVGt5UTU5RS9adkF1T2tGV0hvazJxL1I2UFlBYTJqZFo5emltMEZxT1ArbmtRCmFFRFJiQkZCbUJxVHY1ZkZHZmsyV3NBZktmL1JHMC9WRmQrWmVNNTI1MVRlVHZYSDY5NW5sU0dhdVZsOUFnTUIKQUFFPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpQcm9jLVR5cGU6IDQsRU5DUllQVEVECkRFSy1JbmZvOiBBRVMtMjU2LUNCQyw3QTZBMDU1QUQ2NzU5NDdBNjU3MDQxNDIyRjA2RDQzOQoKSFFkanpBS1V1cXFLaFpIbXB6elkvbW9uZnFGaGlIblo1YzI0anRSOWZNNGFRSlhmL2UxZno2TUVoeUl6NlhPTgpzYjRDblhac3RueFV1VldEa0hFdTZLV1EvZEtBTGdpRFV1VCtVZE1hd1ZvVlBHZGd5V1pwMzVwUVBXaTNmVDJWClhabjU4WWtHOGJPM1k0MDNlWlB5aGFkT2VmRDFWdHVGdUs2L2Y5MGpqeng2WkRud3ZlWHBZZ0ZWN0p5MS9wRmQKY0xMTWYwN0MraGJrNDE2blg2VVZpcFdlNEdIK0FERm9tNVpDZkFhVW90TTduOGkxNDlkVUxORjRZWWkyd1AzMQoxWWFESDV2ZjFDcWlhaWVEWTd4THpwRWl4d0p6NlpFZzNnTFhhVXZ6Mk1wRjhvd2lHSTNlUDBnN3ZvV3AzeHQ0ClRReC9xRFVSbGFYaWFScmlXZFd0cEt5VzFNRnVKNStLZE50UjEva1hyMkJMUEIvWkx3eXF0eW5VeThaWXBiNCsKV0lSWXBVR2ViLy9aSEdobENIN0NSTWRBQnNhbDR3VHduemk5Zlc0QXg5NmVjSjJTbHdDdUt4d1M3aUVxMnkxLwpGQWZHd3NFK1h1ZkhobWU1cDZYaktmaUh4K3pKTUlCMk5Na3JtK3dtNFBiTVRyR1ZudzUvNDEvcjZYeE9COGZlCmlLaTEySnRoNGR1c2MxdllHWWZ6S29wOXVFTTZDWjYrQ2hxemIrWnloL3hVaVpWbENYL0JZbnhyN3lYVW05YVIKUEhRZ3hrbjJBY3Q4RmdRQjNLZ3MzakNpQ1JJSnJsc255YmVXelEzWU85VGpDNE14eWdtbXdPRERCcHNPS25FaQprWFhTNTQrY1pGamNzdmE0dUpWd2hBeXdSUFZVa0x6bVRrSDB0R2l3Q0hqZVFORUNtK1RMYWhra0VJWHJWVGI5CmM5Y3JlTlhNZ0U2alZWeitSNDNIWHNHdlRjZ01jQkx5RlJRSmUyblZhai9kUTVKYkY0dXFOblF6UmpBYkQzNEsKdVRwRmFKL2ttbGdjbWVTY1JMbndhb1l3RmxtaFNDK2JLMGRmWTFKcjZBUVJBNklEUDduSWpxV05EQ0hOQkI4cgpRajF2MktXb1ZRZTN4TkhhWGhrYkpQYkEyREtsVUlxZmZrQlZ0TUt0dDlLdUczUmNjZjNiVllBVzZvaWQ3My9ECno3RE1BRjVHL09wVlI4VmJHaDFXeFh1Ujd6RVZEVXdwd3NwOWVrNWRxTjhCbkJ6MXBwZFpOSUtxenN6bmVja1UKczJsLzZtWkJtZ1YxTmZ5L2NRVTZVNXMzUzFYYzc1VURRVkxtczNDSU9wRlRSSXBlY05UZGZhMzFmWXkvc3Z5MApNMmxXVGJDdmEwZE95dXZNVWhUZ0JMNEk3UWEyZFVNUFhITVphdFY1b29IWXEvQlpKQTFyODRDNWNNNXIrdW1FCjJMTHYvQmxVcjdSYVFIaGFLR240UWhwem81eVJERTltRXFEcExWa2JnOFN4TXNkZi9wRUY1L1Z5VXdBOXQ4UlQKZktWc0luUmQzODZ0RHFKU0RiU0ZxS1R2THp0ci81WUN5elp6dkMyWUIxdm9rby9jYU9HZDJkL0c1MUlqK2JYVQp4RU44VTRmSERCc0h3UFVHYjMxdVpVaFRYcEwzN0tpT3FabVhGb0gydXNtdXZ4ODgyWHZ5R2NWMEY0dHN0TWFSCktMS3psMlB3cXpBWUdGZXhMa1lLTXowVFlJZU42aDNiODZFVGF6UFBVNDlua2FFVTIzRHgyMUoyUmIzVWxIK0kKbERRRjN3dUgxUWxZaVRubGNWYS9adTRRUWcwL2lQOEFMa1owNm12bjllOW1PdG5BOGdzaDRCMm9McWMxOVZMVQpiY3B2NDBkVjFIM1c5TGN4OUI4SllVcDBjL095bm8xRDdZajN0akdjd01LRUNtVXBIaTRra3NlaFZvMC9QOTMzCnhtRm1DNmV5V1lWZE85dXB2WS92S1NCN2IxZE10ODVpV3IzZ25Nc1NmUlljNmpzYlN4ZGpPUFNUNDZVc0l6angKd2ExRFM2K0J2NXRpYUM0dUM2WCswdENBWm8rVU9RTVlVYlRHUlIvN2cvYz0KLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K", + "passphrase": "password", + "message": "md5 with 2024 keys and password, variant", + "scheme": "RSA-MD5", + "signature": "09b158e63c67a3859cf352c2bff5d435652069c6fa1df0ada840cf4566ddfbff600493f7c79602d62d081fc438eb06c3cc51fb818ff99aed448844428406c7dbca5afc4429ea8c51dfe0293e9e3bac4d34cce347a83813173acaea4590aaa8e7c9a0342f87d3c8c686c49a4f537710b17520d79a09ab1a00853b35afafa9ec66c19ecacd0746e919db3502317314d44ab14f645abe2cc93bcf1af1f19834aea31c553ee510b2c6c8e8fa0789c68b8a2d0d1ccae4125834d8a11674a718ac2f93ea5c1c06979b8e036a4f0a0e876e3298aea899b9179a795d09a0fb7b4df4bd71824941b493aedf8c18689cf96bad8f7aca9e52379d7082cac0db1b5f5122" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FEU0svN2k1QlYweCtnbVgxNldybTdrUmtDWgp5MVFVdDZ3aU0yZytTQVpUWVIwMzgxVm5TTVgyY3Y3Q3BOMzQ5OWxaajFyTDVTN1lUYVpad1gzUnZVNWZ6NTYvCmVEWDZjaUwvUFpzYmNsTjJLZGtNV1lnbWNiOUoxelVlb01RM2NqZkZVQ2RRWi9adkRXYSt3WTJaZzhvczJCb3cKQW91Zkh0WUhtM2VPbHkvY1d3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUlDenpCSkJna3Foa2lHOXcwQkJRMHdQREFiQmdrcWhraUc5dzBCQlF3d0RnUUlqaTNaWjZKYnNBNENBZ2dBCk1CMEdDV0NHU0FGbEF3UUJGZ1FRQzZNS2JscTh6eVg5MC9LbWdvdHNNUVNDQW9EZ2hOZit5eFBDL0tSaDdGM08KazBsTWd0RGtWK3dDTER2N2FCdlVxeThSeTJ6cUZQSWxmTGI4WHRTVzk0M1hFdTZLVUkxM0laUEVyOHA5aDF2ZQpJeWU2TDBnNnVBZ2JGeEJFMkR3QkJTSTdtWXI3bG9rcjR2MGsraW5NS2Y0SmVSZEk5WFdnd09JTEtUR2Yxdkg3ClBodkJucUxoT2c2QklPdUY0MjZxcGl5WWxtUmRhNzRkMFRoNG82WnloeU1TelBJMVhiV1NnNzE5RXczTi90TGUKT0hkWWwwZUZyZ05qcSt4TzRFditXN2VOSWgvWEJNUXRrOXdvK214ZU5kbGRSblg4MjJIeFRzTDhmU1NQcys5VApXNU0vMkVCVEpNU3Nzd1NqWnlGa3E4ZWh0eG92STJ1MElCWDFJaVB1bHlVWkxuU05QRFYxZVVWQ2xLNnJrK3ExCmtWc2ZKaFVyMnF2SWpObFFXbGJFWFFqNFZ3R3RnbDArK2w4dmRwajU5TXVOMkozTng1VE5NTGpBNkJZQWEvdHIKQnU5MjhRb1Q3RVQrU0d4NVhLQ3dLYjVmd1htRGxWNXpaQzRrWldUYUYvZC9JY3ZqNUYrZkRadVlGZzFKT1hOWgorcTJvQTFxTVlhSEdYNmxGM3BiTzg0ZWJnMWl3UVRETThpSXFGZVNNR1VKVG5rLzNhN3NxZmFXUWJFUXdHYitYCmZYblNUd2tGK3dPMnJyaVBiRnZXeXplY1d1Njd6RENQMFpXVWdHYjg2c1NKQ003eFJHU2hFU3dDak9yYjg4RjEKNVNaanlJcW9ncmtjM0lXaUxIOWdjNVU4ZDg2cW9GakpuUDZCZndZa3MxVUl5WE5HS2ZaVENxSUNwTXBoVitJUwpiME4yanByakxUa1dSNm54WUdTSDFia0tNczd4MU0wRkJMV1dMQVpxUG45WDNwZTZKd0lCZHMwNE82WGpGMHVuCm94d0RqY0pkb3hWczdQZ1JpTTVkMVR1YnF1MnptcENDbVhOaXFpOUIwK3JWOS9qSGc5SUE1Z1VmdllkQ2NFdisKb0FyOTBJKzIrUHVCRmE5bGdkYkRWNkR0Wms0YlNZbHVxYW14VmVMUGcvdnJld1lmVmZEdjZqZnRmWTFEMERFeQo2OUgwCi0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "fooo", + "message": "sha1 with 1024 keys and password", + "scheme": "RSA-SHA1", + "signature": "300e1fe8ff33074e1ebcf587057493dea84970ae657be52dde8277402c22fcc307035c6f02e95c45590d2ff686e1f9d703125c651b0aec19f2cc504f43fe2a2601aad67489e51a21c105e25b3da4fe76eef333235f3b23a3c57775e00b16e7b00bcd2778fd5a51d3f038083fb8d0e6751c57ba6509abebb7d94cafd5728214a9" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FEU0svN2k1QlYweCtnbVgxNldybTdrUmtDWgp5MVFVdDZ3aU0yZytTQVpUWVIwMzgxVm5TTVgyY3Y3Q3BOMzQ5OWxaajFyTDVTN1lUYVpad1gzUnZVNWZ6NTYvCmVEWDZjaUwvUFpzYmNsTjJLZGtNV1lnbWNiOUoxelVlb01RM2NqZkZVQ2RRWi9adkRXYSt3WTJaZzhvczJCb3cKQW91Zkh0WUhtM2VPbHkvY1d3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUlDenpCSkJna3Foa2lHOXcwQkJRMHdQREFiQmdrcWhraUc5dzBCQlF3d0RnUUlqaTNaWjZKYnNBNENBZ2dBCk1CMEdDV0NHU0FGbEF3UUJGZ1FRQzZNS2JscTh6eVg5MC9LbWdvdHNNUVNDQW9EZ2hOZit5eFBDL0tSaDdGM08KazBsTWd0RGtWK3dDTER2N2FCdlVxeThSeTJ6cUZQSWxmTGI4WHRTVzk0M1hFdTZLVUkxM0laUEVyOHA5aDF2ZQpJeWU2TDBnNnVBZ2JGeEJFMkR3QkJTSTdtWXI3bG9rcjR2MGsraW5NS2Y0SmVSZEk5WFdnd09JTEtUR2Yxdkg3ClBodkJucUxoT2c2QklPdUY0MjZxcGl5WWxtUmRhNzRkMFRoNG82WnloeU1TelBJMVhiV1NnNzE5RXczTi90TGUKT0hkWWwwZUZyZ05qcSt4TzRFditXN2VOSWgvWEJNUXRrOXdvK214ZU5kbGRSblg4MjJIeFRzTDhmU1NQcys5VApXNU0vMkVCVEpNU3Nzd1NqWnlGa3E4ZWh0eG92STJ1MElCWDFJaVB1bHlVWkxuU05QRFYxZVVWQ2xLNnJrK3ExCmtWc2ZKaFVyMnF2SWpObFFXbGJFWFFqNFZ3R3RnbDArK2w4dmRwajU5TXVOMkozTng1VE5NTGpBNkJZQWEvdHIKQnU5MjhRb1Q3RVQrU0d4NVhLQ3dLYjVmd1htRGxWNXpaQzRrWldUYUYvZC9JY3ZqNUYrZkRadVlGZzFKT1hOWgorcTJvQTFxTVlhSEdYNmxGM3BiTzg0ZWJnMWl3UVRETThpSXFGZVNNR1VKVG5rLzNhN3NxZmFXUWJFUXdHYitYCmZYblNUd2tGK3dPMnJyaVBiRnZXeXplY1d1Njd6RENQMFpXVWdHYjg2c1NKQ003eFJHU2hFU3dDak9yYjg4RjEKNVNaanlJcW9ncmtjM0lXaUxIOWdjNVU4ZDg2cW9GakpuUDZCZndZa3MxVUl5WE5HS2ZaVENxSUNwTXBoVitJUwpiME4yanByakxUa1dSNm54WUdTSDFia0tNczd4MU0wRkJMV1dMQVpxUG45WDNwZTZKd0lCZHMwNE82WGpGMHVuCm94d0RqY0pkb3hWczdQZ1JpTTVkMVR1YnF1MnptcENDbVhOaXFpOUIwK3JWOS9qSGc5SUE1Z1VmdllkQ2NFdisKb0FyOTBJKzIrUHVCRmE5bGdkYkRWNkR0Wms0YlNZbHVxYW14VmVMUGcvdnJld1lmVmZEdjZqZnRmWTFEMERFeQo2OUgwCi0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "fooo", + "message": "sha224 with 1024 keys and password", + "scheme": "RSA-SHA224", + "signature": "4704ceffc86a8ba28bb31ceb8a66a0d556866543ab6bb7b500058a1a00cae96c935e4134e1f822316ae0b9e7a6ef57a16a37d2a3cdbfdcdc34158c1bbdcbb408a92f481300777d5e23814a1307c9596618813bbc98c4a317af7995fed15ea21f756e67c7fad1552c4905d631e7eee469c4f6d2360aaea701bbff45e16ece4833" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FEU0svN2k1QlYweCtnbVgxNldybTdrUmtDWgp5MVFVdDZ3aU0yZytTQVpUWVIwMzgxVm5TTVgyY3Y3Q3BOMzQ5OWxaajFyTDVTN1lUYVpad1gzUnZVNWZ6NTYvCmVEWDZjaUwvUFpzYmNsTjJLZGtNV1lnbWNiOUoxelVlb01RM2NqZkZVQ2RRWi9adkRXYSt3WTJaZzhvczJCb3cKQW91Zkh0WUhtM2VPbHkvY1d3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUlDenpCSkJna3Foa2lHOXcwQkJRMHdQREFiQmdrcWhraUc5dzBCQlF3d0RnUUlqaTNaWjZKYnNBNENBZ2dBCk1CMEdDV0NHU0FGbEF3UUJGZ1FRQzZNS2JscTh6eVg5MC9LbWdvdHNNUVNDQW9EZ2hOZit5eFBDL0tSaDdGM08KazBsTWd0RGtWK3dDTER2N2FCdlVxeThSeTJ6cUZQSWxmTGI4WHRTVzk0M1hFdTZLVUkxM0laUEVyOHA5aDF2ZQpJeWU2TDBnNnVBZ2JGeEJFMkR3QkJTSTdtWXI3bG9rcjR2MGsraW5NS2Y0SmVSZEk5WFdnd09JTEtUR2Yxdkg3ClBodkJucUxoT2c2QklPdUY0MjZxcGl5WWxtUmRhNzRkMFRoNG82WnloeU1TelBJMVhiV1NnNzE5RXczTi90TGUKT0hkWWwwZUZyZ05qcSt4TzRFditXN2VOSWgvWEJNUXRrOXdvK214ZU5kbGRSblg4MjJIeFRzTDhmU1NQcys5VApXNU0vMkVCVEpNU3Nzd1NqWnlGa3E4ZWh0eG92STJ1MElCWDFJaVB1bHlVWkxuU05QRFYxZVVWQ2xLNnJrK3ExCmtWc2ZKaFVyMnF2SWpObFFXbGJFWFFqNFZ3R3RnbDArK2w4dmRwajU5TXVOMkozTng1VE5NTGpBNkJZQWEvdHIKQnU5MjhRb1Q3RVQrU0d4NVhLQ3dLYjVmd1htRGxWNXpaQzRrWldUYUYvZC9JY3ZqNUYrZkRadVlGZzFKT1hOWgorcTJvQTFxTVlhSEdYNmxGM3BiTzg0ZWJnMWl3UVRETThpSXFGZVNNR1VKVG5rLzNhN3NxZmFXUWJFUXdHYitYCmZYblNUd2tGK3dPMnJyaVBiRnZXeXplY1d1Njd6RENQMFpXVWdHYjg2c1NKQ003eFJHU2hFU3dDak9yYjg4RjEKNVNaanlJcW9ncmtjM0lXaUxIOWdjNVU4ZDg2cW9GakpuUDZCZndZa3MxVUl5WE5HS2ZaVENxSUNwTXBoVitJUwpiME4yanByakxUa1dSNm54WUdTSDFia0tNczd4MU0wRkJMV1dMQVpxUG45WDNwZTZKd0lCZHMwNE82WGpGMHVuCm94d0RqY0pkb3hWczdQZ1JpTTVkMVR1YnF1MnptcENDbVhOaXFpOUIwK3JWOS9qSGc5SUE1Z1VmdllkQ2NFdisKb0FyOTBJKzIrUHVCRmE5bGdkYkRWNkR0Wms0YlNZbHVxYW14VmVMUGcvdnJld1lmVmZEdjZqZnRmWTFEMERFeQo2OUgwCi0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "fooo", + "message": "sha256 with 1024 keys and password", + "scheme": "RSA-SHA256", + "signature": "4c39a4507f01306152de41ddbf96fddae2fa90f8036000303c74312494efae8b9d6349238efa62957549278d05510b7823f6b7ce1d8f733504dfbcb9f0ac721094f9499042f5bb5522f4131de476d9b6d68d41d6fb166fc51679bd64a60a32e202cc4063cfe262e43b896d98f6d119f86c163d1dd0d432252bd458c79064071f" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FEU0svN2k1QlYweCtnbVgxNldybTdrUmtDWgp5MVFVdDZ3aU0yZytTQVpUWVIwMzgxVm5TTVgyY3Y3Q3BOMzQ5OWxaajFyTDVTN1lUYVpad1gzUnZVNWZ6NTYvCmVEWDZjaUwvUFpzYmNsTjJLZGtNV1lnbWNiOUoxelVlb01RM2NqZkZVQ2RRWi9adkRXYSt3WTJaZzhvczJCb3cKQW91Zkh0WUhtM2VPbHkvY1d3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUlDenpCSkJna3Foa2lHOXcwQkJRMHdQREFiQmdrcWhraUc5dzBCQlF3d0RnUUlqaTNaWjZKYnNBNENBZ2dBCk1CMEdDV0NHU0FGbEF3UUJGZ1FRQzZNS2JscTh6eVg5MC9LbWdvdHNNUVNDQW9EZ2hOZit5eFBDL0tSaDdGM08KazBsTWd0RGtWK3dDTER2N2FCdlVxeThSeTJ6cUZQSWxmTGI4WHRTVzk0M1hFdTZLVUkxM0laUEVyOHA5aDF2ZQpJeWU2TDBnNnVBZ2JGeEJFMkR3QkJTSTdtWXI3bG9rcjR2MGsraW5NS2Y0SmVSZEk5WFdnd09JTEtUR2Yxdkg3ClBodkJucUxoT2c2QklPdUY0MjZxcGl5WWxtUmRhNzRkMFRoNG82WnloeU1TelBJMVhiV1NnNzE5RXczTi90TGUKT0hkWWwwZUZyZ05qcSt4TzRFditXN2VOSWgvWEJNUXRrOXdvK214ZU5kbGRSblg4MjJIeFRzTDhmU1NQcys5VApXNU0vMkVCVEpNU3Nzd1NqWnlGa3E4ZWh0eG92STJ1MElCWDFJaVB1bHlVWkxuU05QRFYxZVVWQ2xLNnJrK3ExCmtWc2ZKaFVyMnF2SWpObFFXbGJFWFFqNFZ3R3RnbDArK2w4dmRwajU5TXVOMkozTng1VE5NTGpBNkJZQWEvdHIKQnU5MjhRb1Q3RVQrU0d4NVhLQ3dLYjVmd1htRGxWNXpaQzRrWldUYUYvZC9JY3ZqNUYrZkRadVlGZzFKT1hOWgorcTJvQTFxTVlhSEdYNmxGM3BiTzg0ZWJnMWl3UVRETThpSXFGZVNNR1VKVG5rLzNhN3NxZmFXUWJFUXdHYitYCmZYblNUd2tGK3dPMnJyaVBiRnZXeXplY1d1Njd6RENQMFpXVWdHYjg2c1NKQ003eFJHU2hFU3dDak9yYjg4RjEKNVNaanlJcW9ncmtjM0lXaUxIOWdjNVU4ZDg2cW9GakpuUDZCZndZa3MxVUl5WE5HS2ZaVENxSUNwTXBoVitJUwpiME4yanByakxUa1dSNm54WUdTSDFia0tNczd4MU0wRkJMV1dMQVpxUG45WDNwZTZKd0lCZHMwNE82WGpGMHVuCm94d0RqY0pkb3hWczdQZ1JpTTVkMVR1YnF1MnptcENDbVhOaXFpOUIwK3JWOS9qSGc5SUE1Z1VmdllkQ2NFdisKb0FyOTBJKzIrUHVCRmE5bGdkYkRWNkR0Wms0YlNZbHVxYW14VmVMUGcvdnJld1lmVmZEdjZqZnRmWTFEMERFeQo2OUgwCi0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "fooo", + "message": "sha384 with 1024 keys and password", + "scheme": "RSA-SHA384", + "signature": "0a7a3d9834adfb9c8ecc732d648e6a6f004989ab5adac16fc4fb1b0d0a623936fbc867b0d15decaf777f2d3159d517ebd38bba8049cba0cc80dfa4c706c693757957c9cd20c38888bac0e6a38edb9998b30da9c3da057194009b3c9c1c292823b07704490e151c01fc55db39a2dcaead944c4698b51c53b11c250029a8a09e34" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FEU0svN2k1QlYweCtnbVgxNldybTdrUmtDWgp5MVFVdDZ3aU0yZytTQVpUWVIwMzgxVm5TTVgyY3Y3Q3BOMzQ5OWxaajFyTDVTN1lUYVpad1gzUnZVNWZ6NTYvCmVEWDZjaUwvUFpzYmNsTjJLZGtNV1lnbWNiOUoxelVlb01RM2NqZkZVQ2RRWi9adkRXYSt3WTJaZzhvczJCb3cKQW91Zkh0WUhtM2VPbHkvY1d3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUlDenpCSkJna3Foa2lHOXcwQkJRMHdQREFiQmdrcWhraUc5dzBCQlF3d0RnUUlqaTNaWjZKYnNBNENBZ2dBCk1CMEdDV0NHU0FGbEF3UUJGZ1FRQzZNS2JscTh6eVg5MC9LbWdvdHNNUVNDQW9EZ2hOZit5eFBDL0tSaDdGM08KazBsTWd0RGtWK3dDTER2N2FCdlVxeThSeTJ6cUZQSWxmTGI4WHRTVzk0M1hFdTZLVUkxM0laUEVyOHA5aDF2ZQpJeWU2TDBnNnVBZ2JGeEJFMkR3QkJTSTdtWXI3bG9rcjR2MGsraW5NS2Y0SmVSZEk5WFdnd09JTEtUR2Yxdkg3ClBodkJucUxoT2c2QklPdUY0MjZxcGl5WWxtUmRhNzRkMFRoNG82WnloeU1TelBJMVhiV1NnNzE5RXczTi90TGUKT0hkWWwwZUZyZ05qcSt4TzRFditXN2VOSWgvWEJNUXRrOXdvK214ZU5kbGRSblg4MjJIeFRzTDhmU1NQcys5VApXNU0vMkVCVEpNU3Nzd1NqWnlGa3E4ZWh0eG92STJ1MElCWDFJaVB1bHlVWkxuU05QRFYxZVVWQ2xLNnJrK3ExCmtWc2ZKaFVyMnF2SWpObFFXbGJFWFFqNFZ3R3RnbDArK2w4dmRwajU5TXVOMkozTng1VE5NTGpBNkJZQWEvdHIKQnU5MjhRb1Q3RVQrU0d4NVhLQ3dLYjVmd1htRGxWNXpaQzRrWldUYUYvZC9JY3ZqNUYrZkRadVlGZzFKT1hOWgorcTJvQTFxTVlhSEdYNmxGM3BiTzg0ZWJnMWl3UVRETThpSXFGZVNNR1VKVG5rLzNhN3NxZmFXUWJFUXdHYitYCmZYblNUd2tGK3dPMnJyaVBiRnZXeXplY1d1Njd6RENQMFpXVWdHYjg2c1NKQ003eFJHU2hFU3dDak9yYjg4RjEKNVNaanlJcW9ncmtjM0lXaUxIOWdjNVU4ZDg2cW9GakpuUDZCZndZa3MxVUl5WE5HS2ZaVENxSUNwTXBoVitJUwpiME4yanByakxUa1dSNm54WUdTSDFia0tNczd4MU0wRkJMV1dMQVpxUG45WDNwZTZKd0lCZHMwNE82WGpGMHVuCm94d0RqY0pkb3hWczdQZ1JpTTVkMVR1YnF1MnptcENDbVhOaXFpOUIwK3JWOS9qSGc5SUE1Z1VmdllkQ2NFdisKb0FyOTBJKzIrUHVCRmE5bGdkYkRWNkR0Wms0YlNZbHVxYW14VmVMUGcvdnJld1lmVmZEdjZqZnRmWTFEMERFeQo2OUgwCi0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "fooo", + "message": "sha512 with 1024 keys and password", + "scheme": "RSA-SHA512", + "signature": "440354501ed137bbcb3bf14e6e215603a42b1ff746f86d00046241e63cd20edc5acacaca1a9c1a40f7bcf23d9a7cafbf3da3378d758b60d2c9bc9664293de377e6b2f5b5908d3d13cc00226b31cb928d36b8940ced4b9cc1051a13717bc606fb33ac0cb27d75800fb7ad0d1d1a87e51e35f1c1b4e740c3c8c702e51c0b020f71" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FEU0svN2k1QlYweCtnbVgxNldybTdrUmtDWgp5MVFVdDZ3aU0yZytTQVpUWVIwMzgxVm5TTVgyY3Y3Q3BOMzQ5OWxaajFyTDVTN1lUYVpad1gzUnZVNWZ6NTYvCmVEWDZjaUwvUFpzYmNsTjJLZGtNV1lnbWNiOUoxelVlb01RM2NqZkZVQ2RRWi9adkRXYSt3WTJaZzhvczJCb3cKQW91Zkh0WUhtM2VPbHkvY1d3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUlDenpCSkJna3Foa2lHOXcwQkJRMHdQREFiQmdrcWhraUc5dzBCQlF3d0RnUUlqaTNaWjZKYnNBNENBZ2dBCk1CMEdDV0NHU0FGbEF3UUJGZ1FRQzZNS2JscTh6eVg5MC9LbWdvdHNNUVNDQW9EZ2hOZit5eFBDL0tSaDdGM08KazBsTWd0RGtWK3dDTER2N2FCdlVxeThSeTJ6cUZQSWxmTGI4WHRTVzk0M1hFdTZLVUkxM0laUEVyOHA5aDF2ZQpJeWU2TDBnNnVBZ2JGeEJFMkR3QkJTSTdtWXI3bG9rcjR2MGsraW5NS2Y0SmVSZEk5WFdnd09JTEtUR2Yxdkg3ClBodkJucUxoT2c2QklPdUY0MjZxcGl5WWxtUmRhNzRkMFRoNG82WnloeU1TelBJMVhiV1NnNzE5RXczTi90TGUKT0hkWWwwZUZyZ05qcSt4TzRFditXN2VOSWgvWEJNUXRrOXdvK214ZU5kbGRSblg4MjJIeFRzTDhmU1NQcys5VApXNU0vMkVCVEpNU3Nzd1NqWnlGa3E4ZWh0eG92STJ1MElCWDFJaVB1bHlVWkxuU05QRFYxZVVWQ2xLNnJrK3ExCmtWc2ZKaFVyMnF2SWpObFFXbGJFWFFqNFZ3R3RnbDArK2w4dmRwajU5TXVOMkozTng1VE5NTGpBNkJZQWEvdHIKQnU5MjhRb1Q3RVQrU0d4NVhLQ3dLYjVmd1htRGxWNXpaQzRrWldUYUYvZC9JY3ZqNUYrZkRadVlGZzFKT1hOWgorcTJvQTFxTVlhSEdYNmxGM3BiTzg0ZWJnMWl3UVRETThpSXFGZVNNR1VKVG5rLzNhN3NxZmFXUWJFUXdHYitYCmZYblNUd2tGK3dPMnJyaVBiRnZXeXplY1d1Njd6RENQMFpXVWdHYjg2c1NKQ003eFJHU2hFU3dDak9yYjg4RjEKNVNaanlJcW9ncmtjM0lXaUxIOWdjNVU4ZDg2cW9GakpuUDZCZndZa3MxVUl5WE5HS2ZaVENxSUNwTXBoVitJUwpiME4yanByakxUa1dSNm54WUdTSDFia0tNczd4MU0wRkJMV1dMQVpxUG45WDNwZTZKd0lCZHMwNE82WGpGMHVuCm94d0RqY0pkb3hWczdQZ1JpTTVkMVR1YnF1MnptcENDbVhOaXFpOUIwK3JWOS9qSGc5SUE1Z1VmdllkQ2NFdisKb0FyOTBJKzIrUHVCRmE5bGdkYkRWNkR0Wms0YlNZbHVxYW14VmVMUGcvdnJld1lmVmZEdjZqZnRmWTFEMERFeQo2OUgwCi0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "fooo", + "message": "rmd160 with 1024 keys and password", + "scheme": "RSA-RIPEMD160", + "signature": "7c8560067bd602204fb1180497f334c96c2d9df3066a3536cec28c001a6a148eb41c7c8489eb4cb09f41dd3fd7633e5d60b37d0c23c1161718216e2084b2e6a54e4f3a29c0c12b3f05a7703449b40a26cc21c5e543c7373c1460806b98eae824cca05dea450ede876b0e15c680fee922e856f882bbb33b4e65e71a9b86900595" + }, + { + "public": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FEU0svN2k1QlYweCtnbVgxNldybTdrUmtDWgp5MVFVdDZ3aU0yZytTQVpUWVIwMzgxVm5TTVgyY3Y3Q3BOMzQ5OWxaajFyTDVTN1lUYVpad1gzUnZVNWZ6NTYvCmVEWDZjaUwvUFpzYmNsTjJLZGtNV1lnbWNiOUoxelVlb01RM2NqZkZVQ2RRWi9adkRXYSt3WTJaZzhvczJCb3cKQW91Zkh0WUhtM2VPbHkvY1d3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=", + "private": "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUlDenpCSkJna3Foa2lHOXcwQkJRMHdQREFiQmdrcWhraUc5dzBCQlF3d0RnUUlqaTNaWjZKYnNBNENBZ2dBCk1CMEdDV0NHU0FGbEF3UUJGZ1FRQzZNS2JscTh6eVg5MC9LbWdvdHNNUVNDQW9EZ2hOZit5eFBDL0tSaDdGM08KazBsTWd0RGtWK3dDTER2N2FCdlVxeThSeTJ6cUZQSWxmTGI4WHRTVzk0M1hFdTZLVUkxM0laUEVyOHA5aDF2ZQpJeWU2TDBnNnVBZ2JGeEJFMkR3QkJTSTdtWXI3bG9rcjR2MGsraW5NS2Y0SmVSZEk5WFdnd09JTEtUR2Yxdkg3ClBodkJucUxoT2c2QklPdUY0MjZxcGl5WWxtUmRhNzRkMFRoNG82WnloeU1TelBJMVhiV1NnNzE5RXczTi90TGUKT0hkWWwwZUZyZ05qcSt4TzRFditXN2VOSWgvWEJNUXRrOXdvK214ZU5kbGRSblg4MjJIeFRzTDhmU1NQcys5VApXNU0vMkVCVEpNU3Nzd1NqWnlGa3E4ZWh0eG92STJ1MElCWDFJaVB1bHlVWkxuU05QRFYxZVVWQ2xLNnJrK3ExCmtWc2ZKaFVyMnF2SWpObFFXbGJFWFFqNFZ3R3RnbDArK2w4dmRwajU5TXVOMkozTng1VE5NTGpBNkJZQWEvdHIKQnU5MjhRb1Q3RVQrU0d4NVhLQ3dLYjVmd1htRGxWNXpaQzRrWldUYUYvZC9JY3ZqNUYrZkRadVlGZzFKT1hOWgorcTJvQTFxTVlhSEdYNmxGM3BiTzg0ZWJnMWl3UVRETThpSXFGZVNNR1VKVG5rLzNhN3NxZmFXUWJFUXdHYitYCmZYblNUd2tGK3dPMnJyaVBiRnZXeXplY1d1Njd6RENQMFpXVWdHYjg2c1NKQ003eFJHU2hFU3dDak9yYjg4RjEKNVNaanlJcW9ncmtjM0lXaUxIOWdjNVU4ZDg2cW9GakpuUDZCZndZa3MxVUl5WE5HS2ZaVENxSUNwTXBoVitJUwpiME4yanByakxUa1dSNm54WUdTSDFia0tNczd4MU0wRkJMV1dMQVpxUG45WDNwZTZKd0lCZHMwNE82WGpGMHVuCm94d0RqY0pkb3hWczdQZ1JpTTVkMVR1YnF1MnptcENDbVhOaXFpOUIwK3JWOS9qSGc5SUE1Z1VmdllkQ2NFdisKb0FyOTBJKzIrUHVCRmE5bGdkYkRWNkR0Wms0YlNZbHVxYW14VmVMUGcvdnJld1lmVmZEdjZqZnRmWTFEMERFeQo2OUgwCi0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==", + "passphrase": "fooo", + "message": "md5 with 1024 keys and password", + "scheme": "RSA-MD5", + "signature": "933843006e6ab220227ea3be763eb3f0aa5fabc0675729f5a899c71d9af75768c562ee803e38e5a83afd77e2eb9a0e49d05e8c643972d0dec5385fdea41e867e502e3b8b17f740deccf7e42dcd92ebc296814753da8f3120b5d3686571bc180ced12501287b01666b64ce5b2c393286c46577598eda4414149c248e4b29ca2e8" + } + ], + "kvectors": [ + { + "algo": "dsa-sha1", + "r": "2E1A0C2562B2912CAAF89186FB0F42001585DA55", + "s": "29EFB6B0AFF2D7A68EB70CA313022253B9A88DF5", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha1", + "r": "42AB2052FD43E123F0607F115052A67DCD9C5C77", + "s": "183916B0230D45B9931491D4C6B0BD2FB4AAF088", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + }, + { + "algo": "dsa-sha224", + "r": "4BC3B686AEA70145856814A6F1BB53346F02101E", + "s": "410697B92295D994D21EDD2F4ADA85566F6F94C1", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha224", + "r": "6868E9964E36C1689F6037F91F28D5F2C30610F2", + "s": "49CEC3ACDC83018C5BD2674ECAAD35B8CD22940F", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + }, + { + "algo": "dsa-sha256", + "r": "81F2F5850BE5BC123C43F71A3033E9384611C545", + "s": "4CDD914B65EB6C66A8AAAD27299BEE6B035F5E89", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha256", + "r": "22518C127299B0F6FDC9872B282B9E70D0790812", + "s": "6837EC18F150D55DE95B5E29BE7AF5D01E4FE160", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + }, + { + "algo": "dsa-sha384", + "r": "7F2108557EE0E3921BC1774F1CA9B410B4CE65A", + "s": "54DF70456C86FAC10FAB47C1949AB83F2C6F7595", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha384", + "r": "854CF929B58D73C3CBFDC421E8D5430CD6DB5E66", + "s": "91D0E0F53E22F898D158380676A871A157CDA622", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + }, + { + "algo": "dsa-sha512", + "r": "16C3491F9B8C3FBBDD5E7A7B667057F0D8EE8E1B", + "s": "2C36A127A7B89EDBB72E4FFBC71DABC7D4FC69C", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha512", + "r": "8EA47E475BA8AC6F2D821DA3BD212D11A3DEB9A0", + "s": "7C670C7AD72B6C050C109E1790008097125433E8", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlCdWdJQkFBS0JnUUNHOWNvRDNQNnlKUVkvK0RDZ3gybTUzWjFoVTYyUjE4NG45NGZFTW5pMFIrWlRPNGF4CmkrMXVpa2kzaEtGTUpTeGI0TnYyQzRiV09GdlM4UyszWSsySWM2djlQMXVpNEtqQXBaQ0M2c0JXazE1U25hOTgKWVFSbmlaeDNyZTM4aEd5SUdIQzNzWnNyV1BtK0JTR2hjQUxqdmRhNFpvWHVrTFBab2JBcmVDc1hlUUlWQUpsdgpsbjlzamppTm5palFIaUJmdXBWNlZwaXhBb0dBQjdENUpVWVZDMkpSUzdkeDRxREF6amgvQTcybXhXdFFVZ24vCkpmMDhFejJKdTgyWDZRVGdrUlRacDk3OTZ0L0pCNDZsUk5Ma0FhN3N4QXU1Kzc5NC9ZZVpXaENod255M2VKdFoKUzZmdnRjUXlhcC9sbWdjT0UyMjNjWFZHU3R5a0Y3NWR6aTlBMFFwR282T1VQeWFyZjluQU9ZLzR4MjdncFdnbQpxS2lQSGIwQ2dZQmQ5ZUFkN1RIUUtYNG5UaGFSd1pMK1dHaisrZUdhaEhka1ZMRUF6eGIyVTVJWldqaTVCU1BpClZDN21HSEhBUkF5NGZESXZ4TFRTN0Y0ZWZzZG00YjZOVE9rMVEzM0JIRHlQMUNZemlUUHIvbk9jczBaZlRUWm8KeGVSelVJSlRzZWFDOWx5OXhQcnBQQzZpRWprT1ZKQmFodUlpTVhDMFRxcDlwZDJmL1B0L093SVVRUllDeXhtbQp6TU5FbE5lZG1POGVmdFd2SmZjPQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + }, + { + "algo": "dsa-sha1", + "r": "3A1B2DBD7489D6ED7E608FD036C83AF396E290DBD602408E8677DAABD6E7445A", + "s": "D26FCBA19FA3E3058FFC02CA1596CDBB6E0D20CB37B06054F7E36DED0CDBBCCF", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha1", + "r": "C18270A93CFC6063F57A4DFA86024F700D980E4CF4E2CB65A504397273D98EA0", + "s": "414F22E5F31A8B6D33295C7539C1C1BA3A6160D7D68D50AC0D3A5BEAC2884FAA", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + }, + { + "algo": "dsa-sha224", + "r": "DC9F4DEADA8D8FF588E98FED0AB690FFCE858DC8C79376450EB6B76C24537E2C", + "s": "A65A9C3BC7BABE286B195D5DA68616DA8D47FA0097F36DD19F517327DC848CEC", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha224", + "r": "272ABA31572F6CC55E30BF616B7A265312018DD325BE031BE0CC82AA17870EA3", + "s": "E9CC286A52CCE201586722D36D1E917EB96A4EBDB47932F9576AC645B3A60806", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + }, + { + "algo": "dsa-sha256", + "r": "EACE8BDBBE353C432A795D9EC556C6D021F7A03F42C36E9BC87E4AC7932CC809", + "s": "7081E175455F9247B812B74583E9E94F9EA79BD640DC962533B0680793A38D53", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha256", + "r": "8190012A1969F9957D56FCCAAD223186F423398D58EF5B3CEFD5A4146A4476F0", + "s": "7452A53F7075D417B4B013B278D1BB8BBD21863F5E7B1CEE679CF2188E1AB19E", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + }, + { + "algo": "dsa-sha384", + "r": "B2DA945E91858834FD9BF616EBAC151EDBC4B45D27D0DD4A7F6A22739F45C00B", + "s": "19048B63D9FD6BCA1D9BAE3664E1BCB97F7276C306130969F63F38FA8319021B", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha384", + "r": "239E66DDBE8F8C230A3D071D601B6FFBDFB5901F94D444C6AF56F732BEB954BE", + "s": "6BD737513D5E72FE85D1C750E0F73921FE299B945AAD1C802F15C26A43D34961", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + }, + { + "algo": "dsa-sha512", + "r": "2016ED092DC5FB669B8EFB3D1F31A91EECB199879BE0CF78F02BA062CB4C942E", + "s": "D0C76F84B5F091E141572A639A4FB8C230807EEA7D55C8A154A224400AFF2351", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "sample" + }, + { + "algo": "dsa-sha512", + "r": "89EC4BB1400ECCFF8E7D9AA515CD1DE7803F2DAFF09693EE7FD1353E90A68307", + "s": "C9F0BDABCC0D880BB137A994CC7F3980CE91CC10FAF529FC46565B15CEA854E1", + "key": "LS0tLS1CRUdJTiBEU0EgUFJJVkFURSBLRVktLS0tLQpNSUlEVlFJQkFBS0NBUUVBbmJiN1dWRzJhN2IrSGhRUEhTemxVQ04wRmgvV1U0M3haSUlZWkM4TFhFakk5NlFhCnJmb1ljeVM0ZG5UNkdDS3dEeDdQZ1RhVVBYeFZkWEprNWFHa1QvNEJMcGsyNEF3ZFBwTVFzQng5RjVnRjB3V0wKS3A5THR2bHhhLzVoRjhhMXM4eE5tK05CRUVyVXFBcld5VTRBWDB1WlBoVHdrZXRSZER2ek1GRERqZUkxVm40YgpOTVBXcGNET3Fob1BOb0lUdzlHWVE5QzBzSjNMbjhjdE9jamVRZkcvRk5TN1JXUEtLRGNXSWNyVE1rdHFMVGtoClJiNi9ySFNJQlNOdlhLTCtrcmh4elkrY050TXBLMVVKeW95cWQ2S3QvSHY5ZDkybTl4RWxwMFZ2NmhVK1F6SlcKb2lZY2FnYnROcE41Zm5tVit0V3F1OCsrUHRvblFlTjFRRXJpV3dJaEFQTERFWk4wem5iSk5XbVF0R1UzU2hmeQpQNTdUVUltOWxwOWh4dDNwbVl3ZkFvSUJBRngvOXJCdmp4US82Q2lFTTBrK1IybkUyWWlzNWI0bG9PSklDV2NICkZzWVQxN0RPNXBNdmo2cDhSTkxMSkZJOXBUKytUMjdEV1ZpUzBhcFl4REtLQnNScUZXWXVmcXB3T2gzcytMdXkKMEYyK0xybFd3VUtqT0dZZEVFWWNEUk5VY2doUVYvTkpRd24vcHp4aEgzaXpLdHUxZEF3MkhKODF2cENaZmJJQgpUaTcxcW1GNEwxS3I2NHZXUXl4TjBKZThWQ095aGRyN1lOdzJUb0ZoOUtLaldzbzZFTEhFMGdQTWRxUndvenI5Cnk5MlNsWmhacTlpMWJoY2xKUzE0NnNadWNicWE0L0hkSkljWm1IUTVQTlRZTWhob0FHVkhZT0hqVEFuazBWVVgKbjU3QTNFUnorWmE5em03dEhLdnRpMjhSYjNyWnoxQmQ4UG1ZNDBxeWRSU3cvK2NDZ2dFQVpuQ1l4bFJDYkhqWAorQ0Flckd3Z1B2QXcxRFlGQXl3dkg2azM1U045dlpTZk5LQ2lWay9oSnR5TGNWeFJRWUFzNEplY2drWkdQRURtCnRyMnFKUlA2WVJjb2NXd3VUOVU3eVZ1SjVwbEoyV1VTNkhPNXlQamYxSm5NTVNpQ1ZocmV5ekgyV09rMHdNR1gKOHNUWmF3WExyV2M0SG50MmlKSGsyamhEMGsyVXpmdFJKdW00dnlIb05ZN2c0S01POFQvV3BtVEEzT056SDMrMApta2hGcFAyQ1ZHaDVjcUxUZ2xtY202eE9EdGVaZ1pNSGlSTURKVmdUU1haQkM0blN3WEhSSTZ3MS9aZHlHVmw2cDlGY0dwcENqbGtaVDNYSElldkx6NjVFYVdwSm12cDA0RUtaOFRJQ1pnRmpqTGg2dDVHUTFLQ1lZCnhYYWp1eGxZY2s0bVd2cTN3SWdhY2RVakNIUTMrcHJtbEhKNnRUaWZEUFRzL0dBTVc1Ynlya3NrejhPVGJ3PQotLS0tLUVORCBEU0EgUFJJVkFURSBLRVktLS0tLQo=", + "msg": "test" + } + ] + }, + "invalid": { + "verify": [ + { + "description": "invalid leading byte", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "message": "a valid message!", + "badHash": "0002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00302d300d06096086480165030402040500041ca7a557fb42827b5a709d6a855d114ff7b8c14b8abf4736bcec8f3e10", + "signature": "1e27d20b420f48dba20ea1f43c73e1925b64ec951b13176afca44dc445e97ebd4d435ee4744d18a811af7f21069e9de5166db995c178c54dc56ad5ed626b546b1b90d107653730a155ab020c9018169d34c80c5849e3d857a9f90b2d1e83381afffc0e240534a561f0ff31a53e4cd929a72b5f0ee7bfea00fe46928a6f345a", + "scheme": "RSA-SHA224" + }, + { + "description": "invalid ending bytes", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "message": "a valid message!", + "badHash": "0001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02302d300d06096086480165030402040500041ca7a557fb42827b5a709d6a855d114ff7b8c14b8abf4736bcec8f3e10", + "signature": "1fef83eadd558585ee4503b4a91c60dd38d237f65a444557a90b05ef1e120ac38e38d24c5b199ccb3327ed8d9e3680e0211c9edc5e2f20446f1d9a98131964cc946fa83f837ae95d80ba946fa1737f10513f254d043341fc1afb5838614bae9aa8ab84ac47bb3f2c79694393c3acffee47341fd1952baabfc41fd7312bdb30", + "scheme": "RSA-SHA224" + }, + { + "description": "missing f", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "message": "a valid message!", + "badHash": "0001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00302d300d06096086480165030402040500041ca7a557fb42827b5a709d6a855d114ff7b8c14b8abf4736bcec8f3e10", + "signature": "0188fa60dddebb849bc9f860ce67f9252c99f0b15d422070cb53be1ccd3786d27608cc58c6352ad1e4667b99b7caea6be321b0f8f6d6398dd9cac8f865212d27c8a29ddc47cba5fd5de513c8b0e8b9d4d93bac9f0726b282408cefcbda85a6f1c22c26db390c9a685e2ba18b7e5ccf0354aceddea444d3a00fb1c47911c1c6", + "scheme": "RSA-SHA224" + }, + { + "description": "missing f, extra data", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "message": "a valid message!", + "badHash": "0001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00302d300d06096086480165030402040500041ca7a557fb42827b5a709d6a855d114ff7b8c14b8abf4736bcec8f3e1000", + "signature": "03883cfb21e144fc9145cec4ae8aebc268632585fed725bd3960c04c84c26ff9be6aa6bd400ab15ab2118940d7b74193273affbee2ae5e5613a6231e1caacabbad5710cf66c52a92bd976a16b5dcea402ca7fe5c2df5217dbec6c4307abddc1c0d0e5b7502ba076bf0bc4952e36f7066a5a63cd345ca1526f40c64af3b9f7a", + "scheme": "RSA-SHA224" + }, + { + "description": "insufficient f's", + "private": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDVkFJQkFBSi9Pd3N3YkZvL3V5QzhsdEdmL3lBMUErZ1Y1SUdkbkFnUGJVU0kzR3piSENBK3grVExHL3RMCnZiUnczcjFzbXBwWS9qa2twaVZXMUVyU011TjB1aXhwNWdiNzhaOXJIMVhwV2I1V1dncDNXYVkvOUVITWpNZE8Ka1EvOUxWWnZSdmwvTS9GaTZvd1ArcSthbUpJMUJFakVDWWZiaEdMM3JtbFZkcTRxWGM0MFF3SURBUUFCQW44SQpWWjBCUG9BT2h5RjMzS0ZNSHh5OHIyOGZzVmd4SlVZZ00zTnFRZ2R2NGZGYXdDWVhqaEp6OWR1VTVZSkdGSkdKCldVR2VIbGt5WUZscGk0ZjNtN3RZN0phd21RVVdCME1OU29LSEkzY2dEWDQvdGZCTjhuaStjTzBlU29SNWN6QlkKRXNBSEJVNDdwMWF3TkZBSHdkK1pFdXY5SDRSbU1uN3AyNzlyUVR0cEFrQUgzTnFzMi92clJGMmNaVU40ZklYZgo0eEhzUUJCeVVheUdxOGEzSjBVR2FTRld2Njh6VFVLRmhlcnI5dVpvdE5wN05KNGpCWGlBUncwcThkb2NYVUcxCkFrQUhnbU9LSG9PUnRBbWlrcXBtRkVKWk90c1hNYUxDSW00RXN6UG81Y2lZb0xNQmNWaXQwOUFkaVFsdDdaSkwKRFkwMnN2VTFiMGFnQ1o5N2tEa21IRGtYQWtBQ2E4TTlKRUx1RHMvUC92SUdZRGtNVmF0SUZmVzZiV0YwMmVGRwp0YVd3TXFDY1NFc1d2YncweHFZdDM0alVScE5iQ2ptQ3lRVndZZkF3LytUTGhQOWRBa0FGd1JqZHdqdzM3cXBqCmRkZzFtTml1MzdiN3N3Rnhta2lNT1haUnhhTk5zZmI1NkExNFJwTjN6b2IzUWRHVXliR29kTUlLVEZibVUvbHUKQ2pxQXhhZkpBa0FHMnlmNlJXYndGSVdmTXl0N1dZQ2gwVmFHQkNjZ3k1NzRBaW5WaWVFbzNaWnlGZkM2Myt4bQozdW9hTnk0aUxvSnY0R0NqcVVCejNaZmNWYU8vRERXRwotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", + "public": "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JR0dBbjg3Q3pCc1dqKzdJTHlXMFovL0lEVUQ2QlhrZ1oyY0NBOXRSSWpjYk5zY0lEN0g1TXNiKzB1OXRIRGUKdld5YW1saitPU1NtSlZiVVN0SXk0M1M2TEdubUJ2dnhuMnNmVmVsWnZsWmFDbmRacGovMFFjeU14MDZSRC8wdApWbTlHK1g4ejhXTHFqQS82cjVxWWtqVUVTTVFKaDl1RVl2ZXVhVlYycmlwZHpqUkRBZ01CQUFFPQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==", + "message": "a valid message!", + "badHash": "0001ffffffffffffff00302d300d06096086480165030402040500041ca7a557fb42827b5a709d6a855d114ff7b8c14b8abf4736bcec8f3e1000", + "signature": "2ba5c1c2022828c5953693962407e5be3cdc9547513aac0009e9e21d51aec93d56016cc3a6a95b3e7c0d734926ab0d3657178ed7c6eb01a49c5519ebcedab97a2aee76bdb146c94367a69a4709521ed0abb4d3f667c5041fce9bf510e5cb62aa9e103003d7b458046810efab72ce9ca8384439386595c622842809bedf53be", + "scheme": "RSA-SHA224" + } + ] + } +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/test/index.js b/node_modules/crypto-browserify/node_modules/browserify-sign/test/index.js new file mode 100644 index 00000000..c7db1733 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/test/index.js @@ -0,0 +1,113 @@ +var asn1 = require('parse-asn1/asn1') +var crt = require('browserify-rsa') +var crypto = require('crypto') +var fixtures = require('./fixtures') +var myCrypto = require('../browser') +var nodeCrypto = require('crypto') +var parseKeys = require('parse-asn1') +var test = require('tape') + +function isNode10 () { + return process.version && process.version.split('.').length === 3 && parseInt(process.version.split('.')[0].slice(1), 10) < 1 && parseInt(process.version.split('.')[1], 10) <= 10 +} + +fixtures.valid.rsa.forEach(function (f) { + var message = new Buffer(f.message) + var pub = new Buffer(f.public, 'base64') + var priv + + if (f.passphrase) { + priv = { + key: new Buffer(f.private, 'base64'), + passphrase: f.passphrase + } + } else { + priv = new Buffer(f.private, 'base64') + } + + // skip passphrase tests in node 10 + if (f.passphrase && isNode10()) return + + test(f.message, function (t) { + t.plan(5) + + var mySign = myCrypto.createSign(f.scheme) + var nodeSign = nodeCrypto.createSign(f.scheme) + var mySig = mySign.update(message).sign(priv) + var nodeSig = nodeSign.update(message).sign(priv) + + t.equals(mySig.length, nodeSig.length, 'correct length') + t.equals(mySig.toString('hex'), nodeSig.toString('hex'), 'equal sigs') + t.equals(mySig.toString('hex'), f.signature) + + var myVer = myCrypto.createVerify(f.scheme) + var nodeVer = nodeCrypto.createVerify(f.scheme) + t.ok(nodeVer.update(message).verify(pub, mySig), 'node validate my sig') + t.ok(myVer.update(message).verify(pub, nodeSig), 'me validate node sig') + }) +}) + +fixtures.valid.ec.forEach(function (f) { + var message = new Buffer(f.message) + var pub = new Buffer(f.public, 'base64') + var priv + + if (f.passphrase) { + priv = { + key: new Buffer(f.private, 'base64'), + passphrase: f.passphrase + } + } else { + priv = new Buffer(f.private, 'base64') + } + + // skip passphrase tests in node 10 + if (f.passphrase && isNode10()) return + + test(f.message, function (t) { + t.plan(4) + + var nodeSign = nodeCrypto.createSign(f.scheme) + var mySign = myCrypto.createSign(f.scheme) + + var mySig = mySign.update(message).sign(priv) + var nodeSig = nodeSign.update(message).sign(priv) + t.notEqual(mySig.toString('hex'), nodeSig.toString('hex'), 'not equal sigs') + t.equals(mySig.toString('hex'), f.signature) + + var myVer = myCrypto.createVerify(f.scheme) + var nodeVer = nodeCrypto.createVerify(f.scheme) + t.ok(nodeVer.update(message).verify(pub, mySig), 'node validate my sig') + t.ok(myVer.update(message).verify(pub, nodeSig), 'me validate node sig') + }) +}) + +fixtures.valid.kvectors.forEach(function (f) { + test('kvector algo: ' + f.algo + ' key len: ' + f.key.length + ' msg: ' + f.msg, function (t) { + var key = new Buffer(f.key, 'base64') + + t.plan(2) + var sig = myCrypto.createSign(f.algo).update(f.msg).sign(key) + var rs = asn1.signature.decode(sig, 'der') + t.equals(rs.r.toString(16), f.r.toLowerCase(), 'r') + t.equals(rs.s.toString(16), f.s.toLowerCase(), 's') + }) +}) + +fixtures.invalid.verify.forEach(function (f) { + test(f.description, function (t) { + t.plan(2) + + var sign = new Buffer(f.signature, 'hex') + var pub = new Buffer(f.public, 'base64') + var message = new Buffer(f.message) + + t.notOk(nodeCrypto.createVerify(f.scheme) + .update(message) + .verify(pub, sign), 'node rejects it') + + t.notOk(myCrypto.createVerify(f.scheme) + .update(message) + .verify(pub, sign), 'We reject it') + }) +}) diff --git a/node_modules/crypto-browserify/node_modules/browserify-sign/verify.js b/node_modules/crypto-browserify/node_modules/browserify-sign/verify.js new file mode 100644 index 00000000..ee17a47f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/browserify-sign/verify.js @@ -0,0 +1,100 @@ +'use strict' +// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var parseKeys = require('parse-asn1') +var elliptic = require('elliptic') +var curves = require('./curves') +var BN = require('bn.js') +module.exports = verify + +function verify (sig, hash, key, signType) { + var pub = parseKeys(key) + if (pub.type === 'ec') { + if (signType !== 'ecdsa') { + throw new Error('wrong public key type') + } + return ecVerify(sig, hash, pub) + } else if (pub.type === 'dsa') { + if (signType !== 'dsa') { + throw new Error('wrong public key type') + } + return dsaVerify(sig, hash, pub) + } else { + if (signType !== 'rsa') { + throw new Error('wrong public key type') + } + } + var len = pub.modulus.byteLength() + var pad = [ 1 ] + var padNum = 0 + while (hash.length + pad.length + 2 < len) { + pad.push(0xff) + padNum++ + } + pad.push(0x00) + var i = -1 + while (++i < hash.length) { + pad.push(hash[i]) + } + pad = new Buffer(pad) + var red = BN.mont(pub.modulus) + sig = new BN(sig).toRed(red) + + sig = sig.redPow(new BN(pub.publicExponent)) + + sig = new Buffer(sig.fromRed().toArray()) + var out = 0 + if (padNum < 8) { + out = 1 + } + len = Math.min(sig.length, pad.length) + if (sig.length !== pad.length) { + out = 1 + } + + i = -1 + while (++i < len) { + out |= (sig[i] ^ pad[i]) + } + return out === 0 +} +function ecVerify (sig, hash, pub) { + var curveId = curves[pub.data.algorithm.curve.join('.')] + if (!curveId) + throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.')) + + var curve = new elliptic.ec(curveId) + + var pubkey = pub.data.subjectPrivateKey.data + return curve.verify(hash.toString('hex'), sig.toString('hex'), pubkey.toString('hex')) +} +function dsaVerify (sig, hash, pub) { + var p = pub.data.p + var q = pub.data.q + var g = pub.data.g + var y = pub.data.pub_key + var unpacked = parseKeys.signature.decode(sig, 'der') + var s = unpacked.s + var r = unpacked.r + checkValue(s, q) + checkValue(r, q) + var montq = BN.mont(q) + var montp = BN.mont(p) + var w = s.invm(q) + var v = g.toRed(montp) + .redPow(new BN(hash).mul(w).mod(q)) + .fromRed() + .mul( + y.toRed(montp) + .redPow(r.mul(w).mod(q)) + .fromRed() + ).mod(p).mod(q) + return !v.cmp(r) +} +function checkValue (b, q) { + if (b.cmpn(0) <= 0) { + throw new Error('invalid sig') + } + if (b.cmp(q) >= q) { + throw new Error('invalid sig') + } +} diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/.travis.yml b/node_modules/crypto-browserify/node_modules/create-ecdh/.travis.yml new file mode 100644 index 00000000..254335b2 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/.travis.yml @@ -0,0 +1,7 @@ +language: node_js + +node_js: + - "0.10" + - "0.11" + - "0.12" + - "iojs" \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/browser.js b/node_modules/crypto-browserify/node_modules/create-ecdh/browser.js new file mode 100644 index 00000000..41cfe10a --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/browser.js @@ -0,0 +1,116 @@ +var elliptic = require('elliptic'); +var BN = require('bn.js'); + +module.exports = function createECDH(curve) { + return new ECDH(curve); +}; + +var aliases = { + secp256k1: { + name: 'secp256k1', + byteLength: 32 + }, + secp224r1: { + name: 'p224', + byteLength: 28 + }, + prime256v1: { + name: 'p256', + byteLength: 32 + }, + prime192v1: { + name: 'p192', + byteLength: 24 + }, + ed25519: { + name: 'ed25519', + byteLength: 32 + } +}; + +aliases.p224 = aliases.secp224r1; +aliases.p256 = aliases.secp256r1 = aliases.prime256v1; +aliases.p192 = aliases.secp192r1 = aliases.prime192v1; + +function ECDH(curve) { + this.curveType = aliases[curve]; + if (!this.curveType ) { + this.curveType = { + name: curve + }; + } + this.curve = new elliptic.ec(this.curveType.name); + this.keys = void 0; +} + +ECDH.prototype.generateKeys = function (enc, format) { + this.keys = this.curve.genKeyPair(); + return this.getPublicKey(enc, format); +}; + +ECDH.prototype.computeSecret = function (other, inenc, enc) { + inenc = inenc || 'utf8'; + if (!Buffer.isBuffer(other)) { + other = new Buffer(other, inenc); + } + other = new BN(other); + other = other.toString(16); + var otherPub = this.curve.keyPair(other, 'hex').getPublic(); + var out = otherPub.mul(this.keys.getPrivate()).getX(); + return formatReturnValue(out, enc, this.curveType.byteLength); +}; + +ECDH.prototype.getPublicKey = function (enc, format) { + var key = this.keys.getPublic(format === 'compressed', true); + if (format === 'hybrid') { + if (key[key.length - 1] % 2) { + key[0] = 7; + } else { + key [0] = 6; + } + } + return formatReturnValue(key, enc); +}; + +ECDH.prototype.getPrivateKey = function (enc) { + return formatReturnValue(this.keys.getPrivate(), enc); +}; + +ECDH.prototype.setPublicKey = function (pub, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(pub)) { + pub = new Buffer(pub, enc); + } + var pkey = new BN(pub); + pkey = pkey.toArray(); + this.keys._importPublicHex(pkey); + return this; +}; + +ECDH.prototype.setPrivateKey = function (priv, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(priv)) { + priv = new Buffer(priv, enc); + } + var _priv = new BN(priv); + _priv = _priv.toString(16); + this.keys._importPrivate(_priv); + return this; +}; + +function formatReturnValue(bn, enc, len) { + if (!Array.isArray(bn)) { + bn = bn.toArray(); + } + var buf = new Buffer(bn); + if (len && buf.length < len) { + var zeros = new Buffer(len - buf.length); + zeros.fill(0); + buf = Buffer.concat([zeros, buf]); + } + if (!enc) { + return buf; + } else { + return buf.toString(enc); + } +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/index.js b/node_modules/crypto-browserify/node_modules/create-ecdh/index.js new file mode 100644 index 00000000..90857b7b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/index.js @@ -0,0 +1,3 @@ +var createECDH = require('crypto').createECDH; + +module.exports = createECDH || require('./browser'); \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/.jshintrc b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/.jshintrc new file mode 100644 index 00000000..add7282d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/.jshintrc @@ -0,0 +1,89 @@ +{ + // JSHint Default Configuration File (as on JSHint website) + // See http://jshint.com/docs/ for more details + + "maxerr" : 50, // {int} Maximum error before stopping + + // Enforcing + "bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.) + "camelcase" : true, // true: Identifiers must be in camelCase + "curly" : false, // true: Require {} for every new block or scope + "eqeqeq" : true, // true: Require triple equals (===) for comparison + "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() + "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. + "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` + "indent" : 2, // {int} Number of spaces to use for indentation + "latedef" : false, // true: Require variables/functions to be defined before being used + "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` + "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` + "noempty" : false, // true: Prohibit use of empty blocks + "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. + "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) + "plusplus" : false, // true: Prohibit use of `++` & `--` + "quotmark" : "single", // Quotation mark consistency: + // false : do nothing (default) + // true : ensure whatever is used is consistent + // "single" : require single quotes + // "double" : require double quotes + "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) + "unused" : true, // true: Require all defined variables be used + "strict" : true, // true: Requires all functions run in ES5 Strict Mode + "maxparams" : false, // {int} Max number of formal params allowed per function + "maxdepth" : false, // {int} Max depth of nested blocks (within functions) + "maxstatements" : false, // {int} Max number statements per function + "maxcomplexity" : false, // {int} Max cyclomatic complexity per function + "maxlen" : false, // {int} Max number of characters per line + + // Relaxing + "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) + "boss" : false, // true: Tolerate assignments where comparisons would be expected + "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // true: Tolerate use of `== null` + "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) + "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`) + "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) + // (ex: `for each`, multiple try/catch, function expression…) + "evil" : false, // true: Tolerate use of `eval` and `new Function()` + "expr" : false, // true: Tolerate `ExpressionStatement` as Programs + "funcscope" : false, // true: Tolerate defining variables inside control statements + "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') + "iterator" : false, // true: Tolerate using the `__iterator__` property + "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block + "laxbreak" : false, // true: Tolerate possibly unsafe line breakings + "laxcomma" : false, // true: Tolerate comma-first style coding + "loopfunc" : false, // true: Tolerate functions being defined in loops + "multistr" : false, // true: Tolerate multi-line strings + "noyield" : false, // true: Tolerate generator functions with no yield statement in them. + "notypeof" : false, // true: Tolerate invalid typeof operator values + "proto" : false, // true: Tolerate using the `__proto__` property + "scripturl" : false, // true: Tolerate script-targeted URLs + "shadow" : true, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` + "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation + "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` + "validthis" : false, // true: Tolerate using this in a non-constructor function + + // Environments + "browser" : true, // Web Browser (window, document, etc) + "browserify" : false, // Browserify (node.js code in the browser) + "couch" : false, // CouchDB + "devel" : true, // Development/debugging (alert, confirm, etc) + "dojo" : false, // Dojo Toolkit + "jasmine" : false, // Jasmine + "jquery" : false, // jQuery + "mocha" : true, // Mocha + "mootools" : false, // MooTools + "node" : false, // Node.js + "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) + "prototypejs" : false, // Prototype and Scriptaculous + "qunit" : false, // QUnit + "rhino" : false, // Rhino + "shelljs" : false, // ShellJS + "worker" : false, // Web Workers + "wsh" : false, // Windows Scripting Host + "yui" : false, // Yahoo User Interface + + // Custom Globals + "globals" : { + "module": true + } // additional predefined global variables +} diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/.npmignore b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/.npmignore new file mode 100644 index 00000000..bfd1047d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/.npmignore @@ -0,0 +1,3 @@ +benchmarks/ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/.travis.yml b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/.travis.yml new file mode 100644 index 00000000..92a990f6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.11" +branches: + only: + - master diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/README.md b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/README.md new file mode 100644 index 00000000..3d970712 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/README.md @@ -0,0 +1,28 @@ +# bn.js [![Build Status](https://secure.travis-ci.org/indutny/bn.js.png)](http://travis-ci.org/indutny/bn.js) + +Just a bike-shed. + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2015. + +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/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js new file mode 100644 index 00000000..7ed21368 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js @@ -0,0 +1,2133 @@ +(function(module, exports) { + +'use strict'; + +// Utils + +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} + +// Could use `inherits` module, but don't want to move from single file +// architecture yet. +function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; +} + +// BN + +function BN(number, base, endian) { + // May be `new BN(bn)` ? + if (number !== null && + typeof number === 'object' && + Array.isArray(number.words)) { + return number; + } + + this.sign = false; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + if (number !== null) + this._init(number || 0, base || 10, endian || 'be'); +} +if (typeof module === 'object') + module.exports = BN; +else + exports.BN = BN; + +BN.BN = BN; +BN.wordSize = 26; + +BN.prototype._init = function init(number, base, endian) { + if (typeof number === 'number') { + if (number < 0) { + this.sign = true; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } + return; + } else if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + if (base === 'hex') + base = 16; + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') + start++; + + if (base === 16) + this._parseHex(number, start); + else + this._parseBase(number, base, start); + + if (number[0] === '-') + this.sign = true; + + this.strip(); +}; + +BN.prototype._initArray = function _initArray(number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + var off = 0; + if (endian === 'be') { + for (var i = number.length - 1, j = 0; i >= 0; i -= 3) { + var w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (var i = 0, j = 0; i < number.length; i += 3) { + var w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); +}; + +function parseHex(str, start, end) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r <<= 4; + + // 'a' - 'f' + if (c >= 49 && c <= 54) + r |= c - 49 + 0xa; + + // 'A' - 'F' + else if (c >= 17 && c <= 22) + r |= c - 17 + 0xa; + + // '0' - '9' + else + r |= c & 0xf; + } + return r; +} + +BN.prototype._parseHex = function _parseHex(number, start) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + // Scan 24-bit chunks and add them to the number + var off = 0; + for (var i = number.length - 6, j = 0; i >= start; i -= 6) { + var w = parseHex(number, i, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + if (i + 6 !== start) { + var w = parseHex(number, start, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + } + this.strip(); +}; + +function parseBase(str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) + r += c - 49 + 0xa; + + // 'A' + else if (c >= 17) + r += c - 17 + 0xa; + + // '0' - '9' + else + r += c; + } + return r; +} + +BN.prototype._parseBase = function _parseBase(number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) + limbLen++; + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } + + if (mod !== 0) { + var pow = 1; + var word = parseBase(number, i, number.length, base); + + for (var i = 0; i < mod; i++) + pow *= base; + this.imuln(pow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } +}; + +BN.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + dest.words[i] = this.words[i]; + dest.length = this.length; + dest.sign = this.sign; + dest.red = this.red; +}; + +BN.prototype.clone = function clone() { + var r = new BN(null); + this.copy(r); + return r; +}; + +// Remove leading `0` from `this` +BN.prototype.strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) + this.length--; + return this._normSign(); +}; + +BN.prototype._normSign = function _normSign() { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) + this.sign = false; + return this; +}; + +BN.prototype.inspect = function inspect() { + return (this.red ? ''; +}; + +/* + +var zeros = []; +var groupSizes = []; +var groupBases = []; + +var s = ''; +var i = -1; +while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; +} +groupSizes[0] = 0; +groupSizes[1] = 0; +groupBases[0] = 0; +groupBases[1] = 0; +var base = 2 - 1; +while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; +} + +*/ + +var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' +]; + +var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +]; + +var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 +]; + +BN.prototype.toString = function toString(base, padding) { + base = base || 10; + if (base === 16 || base === 'hex') { + var out = ''; + var off = 0; + var padding = padding | 0 || 1; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) + out = zeros[6 - word.length] + word + out; + else + out = word + out; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) + out = carry.toString(16) + out; + while (out.length % padding !== 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + var out = ''; + var c = this.clone(); + c.sign = false; + while (c.cmpn(0) !== 0) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (c.cmpn(0) !== 0) + out = zeros[groupSize - r.length] + r + out; + else + out = r + out; + } + if (this.cmpn(0) === 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else { + assert(false, 'Base should be between 2 and 36'); + } +}; + +BN.prototype.toJSON = function toJSON() { + return this.toString(16); +}; + +BN.prototype.toArray = function toArray() { + this.strip(); + var res = new Array(this.byteLength()); + res[0] = 0; + + var q = this.clone(); + for (var i = 0; q.cmpn(0) !== 0; i++) { + var b = q.andln(0xff); + q.ishrn(8); + + // Assume big-endian + res[res.length - i - 1] = b; + } + + return res; +}; + +/* +function genCountBits(bits) { + var arr = []; + + for (var i = bits - 1; i >= 0; i--) { + var bit = '0x' + (1 << i).toString(16); + arr.push('w >= ' + bit + ' ? ' + (i + 1)); + } + + return new Function('w', 'return ' + arr.join(' :\n') + ' :\n0;'); +}; + +BN.prototype._countBits = genCountBits(26); +*/ + +// Sadly chrome apps could not contain `new Function()` calls +BN.prototype._countBits = function _countBits(w) { + return w >= 0x2000000 ? 26 : + w >= 0x1000000 ? 25 : + w >= 0x800000 ? 24 : + w >= 0x400000 ? 23 : + w >= 0x200000 ? 22 : + w >= 0x100000 ? 21 : + w >= 0x80000 ? 20 : + w >= 0x40000 ? 19 : + w >= 0x20000 ? 18 : + w >= 0x10000 ? 17 : + w >= 0x8000 ? 16 : + w >= 0x4000 ? 15 : + w >= 0x2000 ? 14 : + w >= 0x1000 ? 13 : + w >= 0x800 ? 12 : + w >= 0x400 ? 11 : + w >= 0x200 ? 10 : + w >= 0x100 ? 9 : + w >= 0x80 ? 8 : + w >= 0x40 ? 7 : + w >= 0x20 ? 6 : + w >= 0x10 ? 5 : + w >= 0x8 ? 4 : + w >= 0x4 ? 3 : + w >= 0x2 ? 2 : + w >= 0x1 ? 1 : + 0; +}; + +// Return number of used bits in a BN +BN.prototype.bitLength = function bitLength() { + var hi = 0; + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; +}; + +BN.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); +}; + +// Return negative clone of `this` +BN.prototype.neg = function neg() { + if (this.cmpn(0) === 0) + return this.clone(); + + var r = this.clone(); + r.sign = !this.sign; + return r; +}; + + +// Or `num` with `this` in-place +BN.prototype.ior = function ior(num) { + this.sign = this.sign || num.sign; + + while (this.length < num.length) + this.words[this.length++] = 0; + + for (var i = 0; i < num.length; i++) + this.words[i] = this.words[i] | num.words[i]; + + return this.strip(); +}; + + +// Or `num` with `this` +BN.prototype.or = function or(num) { + if (this.length > num.length) + return this.clone().ior(num); + else + return num.clone().ior(this); +}; + + +// And `num` with `this` in-place +BN.prototype.iand = function iand(num) { + this.sign = this.sign && num.sign; + + // b = min-length(num, this) + var b; + if (this.length > num.length) + b = num; + else + b = this; + + for (var i = 0; i < b.length; i++) + this.words[i] = this.words[i] & num.words[i]; + + this.length = b.length; + + return this.strip(); +}; + + +// And `num` with `this` +BN.prototype.and = function and(num) { + if (this.length > num.length) + return this.clone().iand(num); + else + return num.clone().iand(this); +}; + + +// Xor `num` with `this` in-place +BN.prototype.ixor = function ixor(num) { + this.sign = this.sign || num.sign; + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) + this.words[i] = a.words[i] ^ b.words[i]; + + if (this !== a) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + + this.length = a.length; + + return this.strip(); +}; + + +// Xor `num` with `this` +BN.prototype.xor = function xor(num) { + if (this.length > num.length) + return this.clone().ixor(num); + else + return num.clone().ixor(this); +}; + + +// Set `bit` of `this` +BN.prototype.setn = function setn(bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + while (this.length <= off) + this.words[this.length++] = 0; + + if (val) + this.words[off] = this.words[off] | (1 << wbit); + else + this.words[off] = this.words[off] & ~(1 << wbit); + + return this.strip(); +}; + + +// Add `num` to `this` in-place +BN.prototype.iadd = function iadd(num) { + // negative + positive + if (this.sign && !num.sign) { + this.sign = false; + var r = this.isub(num); + this.sign = !this.sign; + return this._normSign(); + + // positive + negative + } else if (!this.sign && num.sign) { + num.sign = false; + var r = this.isub(num); + num.sign = true; + return r._normSign(); + } + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] + b.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) + this.words[i] = a.words[i]; + } + + return this; +}; + +// Add `num` to `this` +BN.prototype.add = function add(num) { + if (num.sign && !this.sign) { + num.sign = false; + var res = this.sub(num); + num.sign = true; + return res; + } else if (!num.sign && this.sign) { + this.sign = false; + var res = num.sub(this); + this.sign = true; + return res; + } + + if (this.length > num.length) + return this.clone().iadd(num); + else + return num.clone().iadd(this); +}; + +// Subtract `num` from `this` in-place +BN.prototype.isub = function isub(num) { + // this - (-num) = this + num + if (num.sign) { + num.sign = false; + var r = this.iadd(num); + num.sign = true; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.sign) { + this.sign = false; + this.iadd(num); + this.sign = true; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.sign = false; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a; + var b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] - b.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + this.length = Math.max(this.length, i); + + if (a !== this) + this.sign = true; + + return this.strip(); +}; + +// Subtract `num` from `this` +BN.prototype.sub = function sub(num) { + return this.clone().isub(num); +}; + +/* +// NOTE: This could be potentionally used to generate loop-less multiplications +function _genCombMulTo(alen, blen) { + var len = alen + blen - 1; + var src = [ + 'var a = this.words, b = num.words, o = out.words, c = 0, w, ' + + 'mask = 0x3ffffff, shift = 0x4000000;', + 'out.length = ' + len + ';' + ]; + for (var k = 0; k < len; k++) { + var minJ = Math.max(0, k - alen + 1); + var maxJ = Math.min(k, blen - 1); + + for (var j = minJ; j <= maxJ; j++) { + var i = k - j; + var mul = 'a[' + i + '] * b[' + j + ']'; + + if (j === minJ) { + src.push('w = ' + mul + ' + c;'); + src.push('c = (w / shift) | 0;'); + } else { + src.push('w += ' + mul + ';'); + src.push('c += (w / shift) | 0;'); + } + src.push('w &= mask;'); + } + src.push('o[' + k + '] = w;'); + } + src.push('if (c !== 0) {', + ' o[' + k + '] = c;', + ' out.length++;', + '}', + 'return out;'); + + return src.join('\n'); +} +*/ + +BN.prototype._smallMulTo = function _smallMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + } + out.words[k] = rword; + carry = ncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype._bigMulTo = function _bigMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype.mulTo = function mulTo(num, out) { + var res; + if (this.length + num.length < 63) + res = this._smallMulTo(num, out); + else + res = this._bigMulTo(num, out); + return res; +}; + +// Multiply `this` by `num` +BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); +}; + +// In-place Multiplication +BN.prototype.imul = function imul(num) { + if (this.cmpn(0) === 0 || num.cmpn(0) === 0) { + this.words[0] = 0; + this.length = 1; + return this; + } + + var tlen = this.length; + var nlen = num.length; + + this.sign = num.sign !== this.sign; + this.length = this.length + num.length; + this.words[this.length - 1] = 0; + + for (var k = this.length - 2; k >= 0; k--) { + // Sum all words with the same `i + j = k` and accumulate `carry`, + // note that carry could be >= 0x3ffffff + var carry = 0; + var rword = 0; + var maxJ = Math.min(k, nlen - 1); + for (var j = Math.max(0, k - tlen + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i]; + var b = num.words[j]; + var r = a * b; + + var lo = r & 0x3ffffff; + carry += (r / 0x4000000) | 0; + lo += rword; + rword = lo & 0x3ffffff; + carry += lo >>> 26; + } + this.words[k] = rword; + this.words[k + 1] += carry; + carry = 0; + } + + // Propagate overflows + var carry = 0; + for (var i = 1; i < this.length; i++) { + var w = this.words[i] + carry; + this.words[i] = w & 0x3ffffff; + carry = w >>> 26; + } + + return this.strip(); +}; + +BN.prototype.imuln = function imuln(num) { + assert(typeof num === 'number'); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i] * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; +}; + +// `this` * `this` +BN.prototype.sqr = function sqr() { + return this.mul(this); +}; + +// `this` * `this` in-place +BN.prototype.isqr = function isqr() { + return this.mul(this); +}; + +// Shift-left in-place +BN.prototype.ishln = function ishln(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + + if (r !== 0) { + var carry = 0; + for (var i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = (this.words[i] - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (var i = this.length - 1; i >= 0; i--) + this.words[i + s] = this.words[i]; + for (var i = 0; i < s; i++) + this.words[i] = 0; + this.length += s; + } + + return this.strip(); +}; + +// Shift-right in-place +// NOTE: `hint` is a lowest bit before trailing zeroes +// NOTE: if `extended` is true - { lo: ..., hi: } object will be returned +BN.prototype.ishrn = function ishrn(bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + if (hint) + hint = (hint - (hint % 26)) / 26; + else + hint = 0; + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + hint -= s; + hint = Math.max(0, hint); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) + maskedWords.words[i] = this.words[i]; + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (var i = 0; i < this.length; i++) + this.words[i] = this.words[i + s]; + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (var i = this.length - 1; i >= 0 && (carry !== 0 || i >= hint); i--) { + var word = this.words[i]; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) + maskedWords.words[maskedWords.length++] = carry; + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + this.strip(); + if (extended) + return { hi: this, lo: maskedWords }; + + return this; +}; + +// Shift-left +BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); +}; + +// Shift-right +BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); +}; + +// Test if n bit is set +BN.prototype.testn = function testn(bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + return false; + } + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); +}; + +// Return only lowers bits of number (in-place) +BN.prototype.imaskn = function imaskn(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(!this.sign, 'imaskn works only with positive numbers'); + + if (r !== 0) + s++; + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); +}; + +// Return only lowers bits of number +BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); +}; + +// Add plain number `num` to `this` +BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.isubn(-num); + + // Possible sign change + if (this.sign) { + if (this.length === 1 && this.words[0] < num) { + this.words[0] = num - this.words[0]; + this.sign = false; + return this; + } + + this.sign = false; + this.isubn(num); + this.sign = true; + return this; + } + + // Add without checks + return this._iaddn(num); +}; + +BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) + this.words[i + 1] = 1; + else + this.words[i + 1]++; + } + this.length = Math.max(this.length, i + 1); + + return this; +}; + +// Subtract plain number `num` from `this` +BN.prototype.isubn = function isubn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.iaddn(-num); + + if (this.sign) { + this.sign = false; + this.iaddn(num); + this.sign = true; + return this; + } + + this.words[0] -= num; + + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + + return this.strip(); +}; + +BN.prototype.addn = function addn(num) { + return this.clone().iaddn(num); +}; + +BN.prototype.subn = function subn(num) { + return this.clone().isubn(num); +}; + +BN.prototype.iabs = function iabs() { + this.sign = false; + + return this; +}; + +BN.prototype.abs = function abs() { + return this.clone().iabs(); +}; + +BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) { + // Bigger storage is needed + var len = num.length + shift; + var i; + if (this.words.length < len) { + var t = new Array(len); + for (var i = 0; i < this.length; i++) + t[i] = this.words[i]; + this.words = t; + } else { + i = this.length; + } + + // Zeroify rest + this.length = Math.max(this.length, len); + for (; i < this.length; i++) + this.words[i] = 0; + + var carry = 0; + for (var i = 0; i < num.length; i++) { + var w = this.words[i + shift] + carry; + var right = num.words[i] * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + var w = this.words[i + shift] + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) + return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (var i = 0; i < this.length; i++) { + var w = -this.words[i] + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.sign = true; + + return this.strip(); +}; + +BN.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1]; + for (var shift = 0; bhi < 0x2000000; shift++) + bhi <<= 1; + if (shift !== 0) { + b = b.shln(shift); + a.ishln(shift); + bhi = b.words[b.length - 1]; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) + q.words[i] = 0; + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (!diff.sign) { + a = diff; + if (q) + q.words[m] = 1; + } + + for (var j = m - 1; j >= 0; j--) { + var qj = a.words[b.length + j] * 0x4000000 + a.words[b.length + j - 1]; + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.sign) { + qj--; + a.sign = false; + a._ishlnsubmul(b, 1, j); + a.sign = !a.sign; + } + if (q) + q.words[j] = qj; + } + if (q) + q.strip(); + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) + a.ishrn(shift); + return { div: q ? q : null, mod: a }; +}; + +BN.prototype.divmod = function divmod(num, mode) { + assert(num.cmpn(0) !== 0); + + if (this.sign && !num.sign) { + var res = this.neg().divmod(num, mode); + var div; + var mod; + if (mode !== 'mod') + div = res.div.neg(); + if (mode !== 'div') + mod = res.mod.cmpn(0) === 0 ? res.mod : num.sub(res.mod); + return { + div: div, + mod: mod + }; + } else if (!this.sign && num.sign) { + var res = this.divmod(num.neg(), mode); + var div; + if (mode !== 'mod') + div = res.div.neg(); + return { div: div, mod: res.mod }; + } else if (this.sign && num.sign) { + return this.neg().divmod(num.neg(), mode); + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) + return { div: new BN(0), mod: this }; + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') + return { div: this.divn(num.words[0]), mod: null }; + else if (mode === 'mod') + return { div: null, mod: new BN(this.modn(num.words[0])) }; + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); +}; + +// Find `this` / `num` +BN.prototype.div = function div(num) { + return this.divmod(num, 'div').div; +}; + +// Find `this` % `num` +BN.prototype.mod = function mod(num) { + return this.divmod(num, 'mod').mod; +}; + +// Find Round(`this` / `num`) +BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.cmpn(0) === 0) + return dm.div; + + var mod = dm.div.sign ? dm.mod.isub(num) : dm.mod; + + var half = num.shrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) + return dm.div; + + // Round up + return dm.div.sign ? dm.div.isubn(1) : dm.div.iaddn(1); +}; + +BN.prototype.modn = function modn(num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) + acc = (p * acc + this.words[i]) % num; + + return acc; +}; + +// In-place division by number +BN.prototype.idivn = function idivn(num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = this.words[i] + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); +}; + +BN.prototype.divn = function divn(num) { + return this.clone().idivn(num); +}; + +BN.prototype._egcd = function _egcd(x1, p) { + assert(!p.sign); + assert(p.cmpn(0) !== 0); + + var a = this; + var b = p.clone(); + + if (a.sign) + a = a.mod(p); + else + a = a.clone(); + + var x2 = new BN(0); + while (b.isEven()) + b.ishrn(1); + var delta = b.clone(); + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + while (a.isEven()) { + a.ishrn(1); + if (x1.isEven()) + x1.ishrn(1); + else + x1.iadd(delta).ishrn(1); + } + while (b.isEven()) { + b.ishrn(1); + if (x2.isEven()) + x2.ishrn(1); + else + x2.iadd(delta).ishrn(1); + } + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + if (a.cmpn(1) === 0) + return x1; + else + return x2; +}; + +BN.prototype.gcd = function gcd(num) { + if (this.cmpn(0) === 0) + return num.clone(); + if (num.cmpn(0) === 0) + return this.clone(); + + var a = this.clone(); + var b = num.clone(); + a.sign = false; + b.sign = false; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.ishrn(1); + b.ishrn(1); + } + + while (a.isEven()) + a.ishrn(1); + + do { + while (b.isEven()) + b.ishrn(1); + + // Swap `a` and `b` to make `a` always bigger than `b` + if (a.cmp(b) < 0) { + var t = a; + a = b; + b = t; + } + a.isub(a.div(b).mul(b)); + } while (a.cmpn(0) !== 0 && b.cmpn(0) !== 0); + if (a.cmpn(0) === 0) + return b.ishln(shift); + else + return a.ishln(shift); +}; + +// Invert number in the field F(num) +BN.prototype.invm = function invm(num) { + return this._egcd(new BN(1), num).mod(num); +}; + +BN.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; +}; + +BN.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; +}; + +// And first word and num +BN.prototype.andln = function andln(num) { + return this.words[0] & num; +}; + +// Increment at the bit position in-line +BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + for (var i = this.length; i < s + 1; i++) + this.words[i] = 0; + this.words[s] |= q; + this.length = s + 1; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i]; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; +}; + +BN.prototype.cmpn = function cmpn(num) { + var sign = num < 0; + if (sign) + num = -num; + + if (this.sign && !sign) + return -1; + else if (!this.sign && sign) + return 1; + + num &= 0x3ffffff; + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + var w = this.words[0]; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.sign) + res = -res; + return res; +}; + +// Compare two numbers and return: +// 1 - if `this` > `num` +// 0 - if `this` == `num` +// -1 - if `this` < `num` +BN.prototype.cmp = function cmp(num) { + if (this.sign && !num.sign) + return -1; + else if (!this.sign && num.sign) + return 1; + + var res = this.ucmp(num); + if (this.sign) + return -res; + else + return res; +}; + +// Unsigned comparison +BN.prototype.ucmp = function ucmp(num) { + // At this point both numbers have the same sign + if (this.length > num.length) + return 1; + else if (this.length < num.length) + return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i]; + var b = num.words[i]; + + if (a === b) + continue; + if (a < b) + res = -1; + else if (a > b) + res = 1; + break; + } + return res; +}; + +// +// A reduce context, could be using montgomery or something better, depending +// on the `m` itself. +// +BN.red = function red(num) { + return new Red(num); +}; + +BN.prototype.toRed = function toRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(!this.sign, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); +}; + +BN.prototype.fromRed = function fromRed() { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); +}; + +BN.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; +}; + +BN.prototype.forceRed = function forceRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); +}; + +BN.prototype.redAdd = function redAdd(num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); +}; + +BN.prototype.redIAdd = function redIAdd(num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); +}; + +BN.prototype.redSub = function redSub(num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); +}; + +BN.prototype.redISub = function redISub(num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); +}; + +BN.prototype.redShl = function redShl(num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); +}; + +BN.prototype.redMul = function redMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); +}; + +BN.prototype.redIMul = function redIMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); +}; + +BN.prototype.redSqr = function redSqr() { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); +}; + +BN.prototype.redISqr = function redISqr() { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); +}; + +// Square root over p +BN.prototype.redSqrt = function redSqrt() { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); +}; + +BN.prototype.redInvm = function redInvm() { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); +}; + +// Return negative clone of `this` % `red modulo` +BN.prototype.redNeg = function redNeg() { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); +}; + +BN.prototype.redPow = function redPow(num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); +}; + +// Prime numbers with efficient reduction +var primes = { + k256: null, + p224: null, + p192: null, + p25519: null +}; + +// Pseudo-Mersenne prime +function MPrime(name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).ishln(this.n).isub(this.p); + + this.tmp = this._tmp(); +} + +MPrime.prototype._tmp = function _tmp() { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; +}; + +MPrime.prototype.ireduce = function ireduce(num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + var pair = r.ishrn(this.n, 0, this.tmp); + r = this.imulK(pair.hi); + r = r.iadd(pair.lo); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.cmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + r.strip(); + } + + return r; +}; + +MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); +}; + +function K256() { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); +} +inherits(K256, MPrime); + +K256.prototype.imulK = function imulK(num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var hi; + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i]; + hi = w * 0x40; + lo += w * 0x3d1; + hi += (lo / 0x4000000) | 0; + lo &= 0x3ffffff; + + num.words[i] = lo; + + lo = hi; + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) + num.length--; + } + return num; +}; + +function P224() { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); +} +inherits(P224, MPrime); + +function P192() { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); +} +inherits(P192, MPrime); + +function P25519() { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); +} +inherits(P25519, MPrime); + +P25519.prototype.imulK = function imulK(num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = num.words[i] * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) + num.words[num.length++] = carry; + return num; +}; + +// Exported mostly for testing purposes, use plain name instead +BN._prime = function prime(name) { + // Cached version of prime + if (primes[name]) + return primes[name]; + + var prime; + if (name === 'k256') + prime = new K256(); + else if (name === 'p224') + prime = new P224(); + else if (name === 'p192') + prime = new P192(); + else if (name === 'p25519') + prime = new P25519(); + else + throw new Error('Unknown prime ' + name); + primes[name] = prime; + + return prime; +}; + +// +// Base reduction engine +// +function Red(m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + this.m = m; + this.prime = null; + } +} + +Red.prototype._verify1 = function _verify1(a) { + assert(!a.sign, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); +}; + +Red.prototype._verify2 = function _verify2(a, b) { + assert(!a.sign && !b.sign, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); +}; + +Red.prototype.imod = function imod(a) { + if (this.prime) + return this.prime.ireduce(a)._forceRed(this); + return a.mod(this.m)._forceRed(this); +}; + +Red.prototype.neg = function neg(a) { + var r = a.clone(); + r.sign = !r.sign; + return r.iadd(this.m)._forceRed(this); +}; + +Red.prototype.add = function add(a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res._forceRed(this); +}; + +Red.prototype.iadd = function iadd(a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res; +}; + +Red.prototype.sub = function sub(a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res._forceRed(this); +}; + +Red.prototype.isub = function isub(a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res; +}; + +Red.prototype.shl = function shl(a, num) { + this._verify1(a); + return this.imod(a.shln(num)); +}; + +Red.prototype.imul = function imul(a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); +}; + +Red.prototype.mul = function mul(a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); +}; + +Red.prototype.isqr = function isqr(a) { + return this.imul(a, a); +}; + +Red.prototype.sqr = function sqr(a) { + return this.mul(a, a); +}; + +Red.prototype.sqrt = function sqrt(a) { + if (a.cmpn(0) === 0) + return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).ishrn(2); + var r = this.pow(a, pow); + return r; + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (q.cmpn(0) !== 0 && q.andln(1) === 0) { + s++; + q.ishrn(1); + } + assert(q.cmpn(0) !== 0); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).ishrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + while (this.pow(z, lpow).cmp(nOne) !== 0) + z.redIAdd(nOne); + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).ishrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) + tmp = tmp.redSqr(); + assert(i < m); + var b = this.pow(c, new BN(1).ishln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; +}; + +Red.prototype.invm = function invm(a) { + var inv = a._egcd(new BN(1), this.m); + if (inv.sign) { + inv.sign = false; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } +}; + +Red.prototype.pow = function pow(a, num) { + var w = []; + var q = num.clone(); + while (q.cmpn(0) !== 0) { + w.push(q.andln(1)); + q.ishrn(1); + } + + // Skip leading zeroes + var res = a; + for (var i = 0; i < w.length; i++, res = this.sqr(res)) + if (w[i] !== 0) + break; + + if (++i < w.length) { + for (var q = this.sqr(res); i < w.length; i++, q = this.sqr(q)) { + if (w[i] === 0) + continue; + res = this.mul(res, q); + } + } + + return res; +}; + +Red.prototype.convertTo = function convertTo(num) { + return num.clone(); +}; + +Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; +}; + +// +// Montgomery method engine +// + +BN.mont = function mont(num) { + return new Mont(num); +}; + +function Mont(m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) + this.shift += 26 - (this.shift % 26); + this.r = new BN(1).ishln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r.invm(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv.sign = true; + this.minv = this.minv.mod(this.r); +} +inherits(Mont, Red); + +Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.shln(this.shift)); +}; + +Mont.prototype.convertFrom = function convertFrom(num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; +}; + +Mont.prototype.imul = function imul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.mul = function mul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) + return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.invm = function invm(a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a.invm(this.m).mul(this.r2)); + return res._forceRed(this); +}; + +})(typeof module === 'undefined' || module, this); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/package.json b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/package.json new file mode 100644 index 00000000..37475efb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/package.json @@ -0,0 +1,56 @@ +{ + "name": "bn.js", + "version": "1.3.0", + "description": "Big number implementation in pure javascript", + "main": "lib/bn.js", + "scripts": { + "test": "jshint lib/*.js && mocha --reporter=spec test/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/bn.js" + }, + "keywords": [ + "BN", + "BigNum", + "Big number", + "Modulo", + "Montgomery" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/bn.js/issues" + }, + "homepage": "https://github.com/indutny/bn.js", + "devDependencies": { + "jshint": "^2.6.0", + "mocha": "^2.1.0" + }, + "gitHead": "3d156a29566f2172b39ebcc0ec00cc3af4c205f8", + "_id": "bn.js@1.3.0", + "_shasum": "0db4cbf96f8f23b742f5bcb9d1aa7a9994a05e83", + "_from": "bn.js@>=1.0.0 <2.0.0", + "_npmVersion": "2.4.1", + "_nodeVersion": "1.1.0", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "0db4cbf96f8f23b742f5bcb9d1aa7a9994a05e83", + "tarball": "http://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/bn-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/bn-test.js new file mode 100644 index 00000000..c53ac5f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/bn-test.js @@ -0,0 +1,506 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN', function() { + it('should work with Number input', function() { + assert.equal(new BN(12345).toString(16), '3039'); + assert.equal(new BN(0x4123456).toString(16), '4123456'); + }); + + it('should work with String input', function() { + assert.equal(new BN('29048849665247').toString(16), + '1a6b765d8cdf'); + assert.equal(new BN('-29048849665247').toString(16), + '-1a6b765d8cdf'); + assert.equal(new BN('1A6B765D8CDF', 16).toString(16), + '1a6b765d8cdf'); + assert.equal(new BN('FF', 16).toString(), '255'); + assert.equal(new BN('1A6B765D8CDF', 16).toString(), + '29048849665247'); + assert.equal(new BN('a89c e5af8724 c0a23e0e 0ff77500', 16).toString(16), + 'a89ce5af8724c0a23e0e0ff77500'); + assert.equal(new BN('123456789abcdef123456789abcdef123456789abcdef', + 16).toString(16), + '123456789abcdef123456789abcdef123456789abcdef'); + assert.equal(new BN('10654321').toString(), '10654321'); + assert.equal(new BN('10000000000000000').toString(10), + '10000000000000000'); + var base2 = '11111111111111111111111111111111111111111111111111111'; + assert.equal(new BN(base2, 2).toString(2), base2); + var base36 = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'; + assert.equal(new BN(base36, 36).toString(36), base36); + + assert( + new BN('6582018229284824168619876730229320890292528855852623664389292032') + .words[0] < 0x4000000); + }); + + it('should import/export big endian', function() { + assert.equal(new BN([1,2,3]).toString(16), '10203'); + assert.equal(new BN([1,2,3,4]).toString(16), '1020304'); + assert.equal(new BN([1,2,3,4,5]).toString(16), '102030405'); + assert.equal(new BN([1,2,3,4,5,6,7,8]).toString(16), '102030405060708'); + assert.equal(new BN([1,2,3,4]).toArray().join(','), '1,2,3,4'); + assert.equal(new BN([1,2,3,4,5,6,7,8]).toArray().join(','), + '1,2,3,4,5,6,7,8'); + }); + + it('should import little endian', function() { + assert.equal(new BN([1,2,3], 10, 'le').toString(16), '30201'); + assert.equal(new BN([1,2,3,4], 10, 'le').toString(16), '4030201'); + assert.equal(new BN([1,2,3,4,5], 10, 'le').toString(16), '504030201'); + assert.equal(new BN([1,2,3,4,5,6,7,8], 10, 'le').toString(16), '807060504030201'); + }); + + it('should return proper bitLength', function() { + assert.equal(new BN(0).bitLength(), 0); + assert.equal(new BN(0x1).bitLength(), 1); + assert.equal(new BN(0x2).bitLength(), 2); + assert.equal(new BN(0x3).bitLength(), 2); + assert.equal(new BN(0x4).bitLength(), 3); + assert.equal(new BN(0x8).bitLength(), 4); + assert.equal(new BN(0x10).bitLength(), 5); + assert.equal(new BN(0x100).bitLength(), 9); + assert.equal(new BN(0x123456).bitLength(), 21); + assert.equal(new BN('123456789', 16).bitLength(), 33); + assert.equal(new BN('8023456789', 16).bitLength(), 40); + }); + + it('should add numbers', function() { + assert.equal(new BN(14).add(new BN(26)).toString(16), '28'); + var k = new BN(0x1234); + var r = k; + for (var i = 0; i < 257; i++) + r = r.add(k); + assert.equal(r.toString(16), '125868'); + + var k = new BN('abcdefabcdefabcdef', 16); + var r = new BN('deadbeef', 16); + for (var i = 0; i < 257; i++) + r.iadd(k); + assert.equal(r.toString(16), 'ac79bd9b79be7a277bde'); + }); + + describe('hex padding', function(){ + it('should have length of 8 from leading 15', function(){ + var a = new BN('ffb9602', 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 8); + }); + + it('should have length of 8 from leading zero', function(){ + var a = new BN('fb9604', 16); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 8 from leading zeros', function(){ + var a = new BN(0); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 64 from leading 15', function(){ + var a = new BN( + 'ffb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 64); + }); + + it('should have length of 64 from leading zero', function(){ + var a = new BN( + 'fb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 64), 'hex'); + assert.equal(a.toString('hex', 64).length, 64); + }); + }); + + describe('iaddn', function() { + it('should allow a sign change', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.iaddn(200) + + assert.equal(a.sign, false) + assert.equal(a.toString(), '100') + }) + }) + + it('should subtract numbers', function() { + assert.equal(new BN(14).sub(new BN(26)).toString(16), '-c'); + assert.equal(new BN(26).sub(new BN(14)).toString(16), 'c'); + assert.equal(new BN(26).sub(new BN(26)).toString(16), '0'); + assert.equal(new BN(-26).sub(new BN(26)).toString(16), '-34'); + + var a = new BN( + '31ff3c61db2db84b9823d320907a573f6ad37c437abe458b1802cda041d6384' + + 'a7d8daef41395491e2', + 16); + var b = new BN( + '6f0e4d9f1d6071c183677f601af9305721c91d31b0bbbae8fb790000', + 16); + var r = new BN( + '31ff3c61db2db84b9823d3208989726578fd75276287cd9516533a9acfb9a67' + + '76281f34583ddb91e2', + 16); + assert.equal(a.sub(b).cmp(r), 0); + + // In-place + assert.equal(b.clone().isub(a).neg().cmp(r), 0); + + var r = b.sub(new BN(14)); + assert.equal(b.clone().isubn(14).cmp(r), 0); + + var r = new BN( + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b', 16); + assert.equal(r.isubn(-1).toString(16), + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681c'); + + // Carry and copy + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(a.isub(b).toString(16), '-fffffffedcbb'); + + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(b.isub(a).toString(16), 'fffffffedcbb'); + }); + + describe('isubn', function() { + it('should work for positive numbers', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.isubn(200) + assert.equal(a.sign, true) + assert.equal(a.toString(), '-300') + }) + + it('should not allow a sign change', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.isubn(-200); + assert.equal(a.sign, false) + assert.equal(a.toString(), '100') + }) + }) + + it('should mul numbers', function() { + assert.equal(new BN(0x1001).mul(new BN(0x1234)).toString(16), + '1235234'); + assert.equal(new BN(-0x1001).mul(new BN(0x1234)).toString(16), + '-1235234'); + assert.equal(new BN(-0x1001).mul(new BN(-0x1234)).toString(16), + '1235234'); + var n = new BN(0x1001); + var r = n; + for (var i = 0; i < 4; i++) + r = r.mul(n); + assert.equal(r.toString(16), + '100500a00a005001'); + + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal(n.mul(n).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40'); + assert.equal(n.mul(n).mul(n).toString(16), + '1b888e01a06e974017a28a5b4da436169761c9730b7aeedf75fc60f687b' + + '46e0cf2cb11667f795d5569482640fe5f628939467a01a612b02350' + + '0d0161e9730279a7561043af6197798e41b7432458463e64fa81158' + + '907322dc330562697d0d600'); + + assert.equal( + new BN('-100000000000').mul(new BN('3').div(new BN('4'))).toString(16), + '0' + ); + }); + + it('should regress mul big numbers', function() { + var q = fixtures.dhGroups.p17.q; + var qs = fixtures.dhGroups.p17.qs; + + var q = new BN(q, 16); + assert.equal(q.sqr().toString(16), qs); + }); + + it('should imul numbers', function() { + var a = new BN('abcdef01234567890abcd', 16); + var b = new BN('deadbeefa551edebabba8', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + + var a = new BN('abcdef01234567890abcd214a25123f512361e6d236', 16); + var b = new BN('deadbeefa551edebabba8121234fd21bac0341324dd', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + }); + + it('should div numbers', function() { + assert.equal(new BN('10').div(new BN(256)).toString(16), + '0'); + assert.equal(new BN('69527932928').div(new BN('16974594')).toString(16), + 'fff'); + assert.equal(new BN('-69527932928').div(new BN('16974594')).toString(16), + '-fff'); + + var b = new BN( + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40', + 16); + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal(b.div(n).toString(16), n.toString(16)); + + assert.equal(new BN('1').div(new BN('-5')).toString(10), '0'); + + // Regression after moving to word div + var p = new BN( + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + 16); + var a = new BN( + '79be667e f9dcbbac 55a06295 ce870b07 029bfcdb 2dce28d9 59f2815b 16f81798', + 16); + var as = a.sqr(); + assert.equal( + as.div(p).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729e58090b9'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.div(p).toString(16), + 'ffffffff00000002000000000000000000000001000000000000000000000001'); + }); + + it('should mod numbers', function() { + assert.equal(new BN('10').mod(new BN(256)).toString(16), + 'a'); + assert.equal(new BN('69527932928').mod(new BN('16974594')).toString(16), + '102f302'); + assert.equal(new BN('-69527932928').mod(new BN('16974594')).toString(16), + '1000'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.mod(p).toString(16), + '0'); + }); + + it('should divRound numbers', function() { + assert.equal(new BN(9).divRound(new BN(20)).toString(10), + '0'); + assert.equal(new BN(10).divRound(new BN(20)).toString(10), + '1'); + assert.equal(new BN(150).divRound(new BN(20)).toString(10), + '8'); + assert.equal(new BN(149).divRound(new BN(20)).toString(10), + '7'); + assert.equal(new BN(149).divRound(new BN(17)).toString(10), + '9'); + assert.equal(new BN(144).divRound(new BN(17)).toString(10), + '8'); + assert.equal(new BN(-144).divRound(new BN(17)).toString(10), + '-8'); + }); + + it('should absolute numbers', function() { + assert.equal(new BN(0x1001).abs().toString(), '4097'); + assert.equal(new BN(-0x1001).abs().toString(), '4097'); + assert.equal(new BN('ffffffff', 16).abs().toString(), '4294967295'); + }) + + it('should modn numbers', function() { + assert.equal(new BN('10', 16).modn(256).toString(16), '10'); + assert.equal(new BN('100', 16).modn(256).toString(16), '0'); + assert.equal(new BN('1001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(257).toString(16), + new BN('100000000001', 16).mod(new BN(257)).toString(16)); + assert.equal(new BN('123456789012', 16).modn(3).toString(16), + new BN('123456789012', 16).mod(new BN(3)).toString(16)); + }); + + it('should idivn numbers', function() { + assert.equal(new BN('10', 16).idivn(3).toString(16), '5'); + assert.equal(new BN('12', 16).idivn(3).toString(16), '6'); + assert.equal(new BN('10000000000000000').idivn(3).toString(10), + '3333333333333333'); + assert.equal(new BN('100000000000000000000000000000').idivn(3).toString(10), + '33333333333333333333333333333'); + + var t = new BN(3); + assert.equal(new BN('12345678901234567890123456', 16).idivn(3).toString(16), + new BN('12345678901234567890123456', 16).div(t).toString(16)); + }); + + it('should shl numbers', function() { + assert.equal(new BN('69527932928').shln(13).toString(16), + '2060602000000'); + assert.equal(new BN('69527932928').shln(45).toString(16), + '206060200000000000000'); + }); + + it('should shr numbers', function() { + assert.equal(new BN('69527932928').shrn(13).toString(16), + '818180'); + assert.equal(new BN('69527932928').shrn(17).toString(16), + '81818'); + assert.equal(new BN('69527932928').shrn(256).toString(16), + '0'); + }); + + it('should invm numbers', function() { + var p = new BN(257); + var a = new BN(3); + var b = a.invm(p); + assert.equal(a.mul(b).mod(p).toString(16), '1'); + + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var a = new BN('deadbeef', 16); + var b = a.invm(p192); + assert.equal(a.mul(b).mod(p192).toString(16), '1'); + + // Even base + var phi = new BN('872d9b030ba368706b68932cf07a0e0c', 16); + var e = new BN(65537); + var d = e.invm(phi); + assert.equal(e.mul(d).mod(phi).toString(16), '1'); + }); + + it('should support bincn', function() { + assert.equal(new BN(0).bincn(1).toString(16), '2'); + assert.equal(new BN(2).bincn(1).toString(16), '4'); + assert.equal(new BN(2).bincn(1).bincn(1).toString(16), + new BN(2).bincn(2).toString(16)); + assert.equal(new BN(0xffffff).bincn(1).toString(16), '1000001'); + }); + + it('should support imaskn', function() { + assert.equal(new BN(0).imaskn(1).toString(16), '0'); + assert.equal(new BN(3).imaskn(1).toString(16), '1'); + assert.equal(new BN('123456789', 16).imaskn(4).toString(16), '9'); + assert.equal(new BN('123456789', 16).imaskn(16).toString(16), '6789'); + assert.equal(new BN('123456789', 16).imaskn(28).toString(16), '3456789'); + }); + + it('should support testn', function() { + [ + 'ff', + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' + ].forEach(function(hex) { + var bn = new BN(hex, 16) + var bl = bn.bitLength() + + for (var i = 0; i < bl; ++i) { + assert.equal(bn.testn(i), true); + } + + // test off the end + assert.equal(bn.testn(bl), false); + }) + + var xbits = [ + '01111001010111001001000100011101110100111011000110001110010111011001010', + '01110000000010110001111010101111100111110010001111000001001011010100111', + '01000101001100010001101001011110100001001111100110001110010111' + ].join('') + + var x = new BN( + '23478905234580795234378912401239784125643978256123048348957342' + ) + for (var i = 0; i < x.bitLength(); ++i) { + assert.equal(x.testn(i), (xbits.charAt(i) === '1'), 'Failed @ bit ' + i) + } + }); + + it('should support gcd', function() { + assert.equal(new BN(3).gcd(new BN(2)).toString(16), '1'); + assert.equal(new BN(18).gcd(new BN(12)).toString(16), '6'); + assert.equal(new BN(-18).gcd(new BN(12)).toString(16), '6'); + }); + + it('should and numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .and(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + }); + it('should iand numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .iand(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + assert.equal(new BN('1000000000000000000000000000000000000001', 2) + .iand(new BN('1', 2)) + .toString(2), '1') + assert.equal(new BN('1', 2) + .iand(new BN('1000000000000000000000000000000000000001', 2)) + .toString(2), '1') + }); + it('should or numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .or(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + }); + it('should ior numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .ior(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + assert.equal(new BN('1000000000000000000000000000000000000000', 2) + .ior(new BN('1', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + assert.equal(new BN('1', 2) + .ior(new BN('1000000000000000000000000000000000000000', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + }); + it('should xor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .xor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + }); + it('should ixor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1', 2)) + .toString(2), '11001100110011001100110011001101'); + assert.equal(new BN('1', 2) + .ixor(new BN('11001100110011001100110011001100', 2)) + .toString(2), '11001100110011001100110011001101'); + }); + + it('should allow single bits to be set', function () { + assert.equal(new BN(0).setn(2, true).toString(2), '100'); + assert.equal(new BN(0).setn(27, true).toString(2), + '1000000000000000000000000000'); + assert.equal(new BN('1000000000000000000000000001', 2).setn(27, false) + .toString(2), '1'); + assert.equal(new BN('101', 2).setn(2, false).toString(2), '1'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/fixtures.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/fixtures.js new file mode 100644 index 00000000..29442d92 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/fixtures.js @@ -0,0 +1,264 @@ +exports.dhGroups = { + p16: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199' + + 'ffffffffffffffff', + priv: '6d5923e6449122cbbcc1b96093e0b7e4fd3e469f58daddae' + + '53b49b20664f4132675df9ce98ae0cfdcac0f4181ccb643b' + + '625f98104dcf6f7d8e81961e2cab4b5014895260cb977c7d' + + '2f981f8532fb5da60b3676dfe57f293f05d525866053ac7e' + + '65abfd19241146e92e64f309a97ef3b529af4d6189fa416c' + + '9e1a816c3bdf88e5edf48fbd8233ef9038bb46faa95122c0' + + '5a426be72039639cd2d53d37254b3d258960dcb33c255ede' + + '20e9d7b4b123c8b4f4b986f53cdd510d042166f7dd7dca98' + + '7c39ab36381ba30a5fdd027eb6128d2ef8e5802a2194d422' + + 'b05fe6e1cb4817789b923d8636c1ec4b7601c90da3ddc178' + + '52f59217ae070d87f2e75cbfb6ff92430ad26a71c8373452' + + 'ae1cc5c93350e2d7b87e0acfeba401aaf518580937bf0b6c' + + '341f8c49165a47e49ce50853989d07171c00f43dcddddf72' + + '94fb9c3f4e1124e98ef656b797ef48974ddcd43a21fa06d0' + + '565ae8ce494747ce9e0ea0166e76eb45279e5c6471db7df8' + + 'cc88764be29666de9c545e72da36da2f7a352fb17bdeb982' + + 'a6dc0193ec4bf00b2e533efd6cd4d46e6fb237b775615576' + + 'dd6c7c7bbc087a25e6909d1ebc6e5b38e5c8472c0fc429c6' + + 'f17da1838cbcd9bbef57c5b5522fd6053e62ba21fe97c826' + + 'd3889d0cc17e5fa00b54d8d9f0f46fb523698af965950f4b' + + '941369e180f0aece3870d9335f2301db251595d173902cad' + + '394eaa6ffef8be6c', + pub: 'd53703b7340bc89bfc47176d351e5cf86d5a18d9662eca3c' + + '9759c83b6ccda8859649a5866524d77f79e501db923416ca' + + '2636243836d3e6df752defc0fb19cc386e3ae48ad647753f' + + 'bf415e2612f8a9fd01efe7aca249589590c7e6a0332630bb' + + '29c5b3501265d720213790556f0f1d114a9e2071be3620bd' + + '4ee1e8bb96689ac9e226f0a4203025f0267adc273a43582b' + + '00b70b490343529eaec4dcff140773cd6654658517f51193' + + '13f21f0a8e04fe7d7b21ffeca85ff8f87c42bb8d9cb13a72' + + 'c00e9c6e9dfcedda0777af951cc8ccab90d35e915e707d8e' + + '4c2aca219547dd78e9a1a0730accdc9ad0b854e51edd1e91' + + '4756760bab156ca6e3cb9c625cf0870def34e9ac2e552800' + + 'd6ce506d43dbbc75acfa0c8d8fb12daa3c783fb726f187d5' + + '58131779239c912d389d0511e0f3a81969d12aeee670e48f' + + 'ba41f7ed9f10705543689c2506b976a8ffabed45e33795b0' + + '1df4f6b993a33d1deab1316a67419afa31fbb6fdd252ee8c' + + '7c7d1d016c44e3fcf6b41898d7f206aa33760b505e4eff2e' + + 'c624bc7fe636b1d59e45d6f904fc391419f13d1f0cdb5b6c' + + '2378b09434159917dde709f8a6b5dc30994d056e3f964371' + + '11587ac7af0a442b8367a7bd940f752ddabf31cf01171e24' + + 'd78df136e9681cd974ce4f858a5fb6efd3234a91857bb52d' + + '9e7b414a8bc66db4b5a73bbeccfb6eb764b4f0cbf0375136' + + 'b024b04e698d54a5' + }, + p17: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934028492' + + '36c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bd' + + 'f8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831' + + '179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1b' + + 'db7f1447e6cc254b332051512bd7af426fb8f401378cd2bf' + + '5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6' + + 'd55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f3' + + '23a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aa' + + 'cc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be328' + + '06a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55c' + + 'da56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee' + + '12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff', + priv: '6017f2bc23e1caff5b0a8b4e1fc72422b5204415787801dc' + + '025762b8dbb98ab57603aaaa27c4e6bdf742b4a1726b9375' + + 'a8ca3cf07771779589831d8bd18ddeb79c43e7e77d433950' + + 'e652e49df35b11fa09644874d71d62fdaffb580816c2c88c' + + '2c4a2eefd4a660360316741b05a15a2e37f236692ad3c463' + + 'fff559938fc6b77176e84e1bb47fb41af691c5eb7bb81bd8' + + 'c918f52625a1128f754b08f5a1403b84667231c4dfe07ed4' + + '326234c113931ce606037e960f35a2dfdec38a5f057884d3' + + '0af8fab3be39c1eeb390205fd65982191fc21d5aa30ddf51' + + 'a8e1c58c0c19fc4b4a7380ea9e836aaf671c90c29bc4bcc7' + + '813811aa436a7a9005de9b507957c56a9caa1351b6efc620' + + '7225a18f6e97f830fb6a8c4f03b82f4611e67ab9497b9271' + + 'd6ac252793cc3e5538990dbd894d2dbc2d152801937d9f74' + + 'da4b741b50b4d40e4c75e2ac163f7b397fd555648b249f97' + + 'ffe58ffb6d096aa84534c4c5729cff137759bd34e80db4ab' + + '47e2b9c52064e7f0bf677f72ac9e5d0c6606943683f9d12f' + + '180cf065a5cb8ec3179a874f358847a907f8471d15f1e728' + + '7023249d6d13c82da52628654438f47b8b5cdf4761fbf6ad' + + '9219eceac657dbd06cf2ab776ad4c968f81c3d039367f0a4' + + 'd77c7ec4435c27b6c147071665100063b5666e06eb2fb2cc' + + '3159ba34bc98ca346342195f6f1fb053ddc3bc1873564d40' + + '1c6738cdf764d6e1ff25ca5926f80102ea6593c17170966b' + + 'b5d7352dd7fb821230237ea3ebed1f920feaadbd21be295a' + + '69f2083deae9c5cdf5f4830eb04b7c1f80cc61c17232d79f' + + '7ecc2cc462a7965f804001c89982734e5abba2d31df1b012' + + '152c6b226dff34510b54be8c2cd68d795def66c57a3abfb6' + + '896f1d139e633417f8c694764974d268f46ece3a8d6616ea' + + 'a592144be48ee1e0a1595d3e5edfede5b27cec6c48ceb2ff' + + 'b42cb44275851b0ebf87dfc9aa2d0cb0805e9454b051dfe8' + + 'a29fadd82491a4b4c23f2d06ba45483ab59976da1433c9ce' + + '500164b957a04cf62dd67595319b512fc4b998424d1164dd' + + 'bbe5d1a0f7257cbb04ec9b5ed92079a1502d98725023ecb2', + pub: '3bf836229c7dd874fe37c1790d201e82ed8e192ed61571ca' + + '7285264974eb2a0171f3747b2fc23969a916cbd21e14f7e2' + + 'f0d72dcd2247affba926f9e7bb99944cb5609aed85e71b89' + + 'e89d2651550cb5bd8281bd3144066af78f194032aa777739' + + 'cccb7862a1af401f99f7e5c693f25ddce2dedd9686633820' + + 'd28d0f5ed0c6b5a094f5fe6170b8e2cbc9dff118398baee6' + + 'e895a6301cb6e881b3cae749a5bdf5c56fc897ff68bc73f2' + + '4811bb108b882872bade1f147d886a415cda2b93dd90190c' + + 'be5c2dd53fe78add5960e97f58ff2506afe437f4cf4c912a' + + '397c1a2139ac6207d3ab76e6b7ffd23bb6866dd7f87a9ae5' + + '578789084ff2d06ea0d30156d7a10496e8ebe094f5703539' + + '730f5fdbebc066de417be82c99c7da59953071f49da7878d' + + 'a588775ff2a7f0084de390f009f372af75cdeba292b08ea8' + + '4bd13a87e1ca678f9ad148145f7cef3620d69a891be46fbb' + + 'cad858e2401ec0fd72abdea2f643e6d0197b7646fbb83220' + + '0f4cf7a7f6a7559f9fb0d0f1680822af9dbd8dec4cd1b5e1' + + '7bc799e902d9fe746ddf41da3b7020350d3600347398999a' + + 'baf75d53e03ad2ee17de8a2032f1008c6c2e6618b62f225b' + + 'a2f350179445debe68500fcbb6cae970a9920e321b468b74' + + '5fb524fb88abbcacdca121d737c44d30724227a99745c209' + + 'b970d1ff93bbc9f28b01b4e714d6c9cbd9ea032d4e964d8e' + + '8fff01db095160c20b7646d9fcd314c4bc11bcc232aeccc0' + + 'fbedccbc786951025597522eef283e3f56b44561a0765783' + + '420128638c257e54b972a76e4261892d81222b3e2039c61a' + + 'ab8408fcaac3d634f848ab3ee65ea1bd13c6cd75d2e78060' + + 'e13cf67fbef8de66d2049e26c0541c679fff3e6afc290efe' + + '875c213df9678e4a7ec484bc87dae5f0a1c26d7583e38941' + + 'b7c68b004d4df8b004b666f9448aac1cc3ea21461f41ea5d' + + 'd0f7a9e6161cfe0f58bcfd304bdc11d78c2e9d542e86c0b5' + + '6985cc83f693f686eaac17411a8247bf62f5ccc7782349b5' + + 'cc1f20e312fa2acc0197154d1bfee507e8db77e8f2732f2d' + + '641440ccf248e8643b2bd1e1f9e8239356ab91098fcb431d', + q: 'a899c59999bf877d96442d284359783bdc64b5f878b688fe' + + '51407f0526e616553ad0aaaac4d5bed3046f10a1faaf42bb' + + '2342dc4b7908eea0c46e4c4576897675c2bfdc4467870d3d' + + 'cd90adaed4359237a4bc6924bfb99aa6bf5f5ede15b574ea' + + 'e977eac096f3c67d09bda574c6306c6123fa89d2f086b8dc' + + 'ff92bc570c18d83fe6c810ccfd22ce4c749ef5e6ead3fffe' + + 'c63d95e0e3fde1df9db6a35fa1d107058f37e41957769199' + + 'd945dd7a373622c65f0af3fd9eb1ddc5c764bbfaf7a3dc37' + + '2548e683b970dac4aa4b9869080d2376c9adecebb84e172c' + + '09aeeb25fb8df23e60033260c4f8aac6b8b98ab894b1fb84' + + 'ebb83c0fb2081c3f3eee07f44e24d8fabf76f19ed167b0d7' + + 'ff971565aa4efa3625fce5a43ceeaa3eebb3ce88a00f597f' + + '048c69292b38dba2103ecdd5ec4ccfe3b2d87fa6202f334b' + + 'c1cab83b608dfc875b650b69f2c7e23c0b2b4adf149a6100' + + 'db1b6dbad4679ecb1ea95eafaba3bd00db11c2134f5a8686' + + '358b8b2ab49a1b2e85e1e45caeac5cd4dc0b3b5fffba8871' + + '1c6baf399edd48dad5e5c313702737a6dbdcede80ca358e5' + + '1d1c4fe42e8948a084403f61baed38aa9a1a5ce2918e9f33' + + '100050a430b47bc592995606440272a4994677577a6aaa1b' + + 'a101045dbec5a4e9566dab5445d1af3ed19519f07ac4e2a8' + + 'bd0a84b01978f203a9125a0be020f71fab56c2c9e344d4f4' + + '12d53d3cd8eb74ca5122002e931e3cb0bd4b7492436be17a' + + 'd7ebe27148671f59432c36d8c56eb762655711cfc8471f70' + + '83a8b7283bcb3b1b1d47d37c23d030288cfcef05fbdb4e16' + + '652ee03ee7b77056a808cd700bc3d9ef826eca9a59be959c' + + '947c865d6b372a1ca2d503d7df6d7611b12111665438475a' + + '1c64145849b3da8c2d343410df892d958db232617f9896f1' + + 'de95b8b5a47132be80dd65298c7f2047858409bf762dbc05' + + 'a62ca392ac40cfb8201a0607a2cae07d99a307625f2b2d04' + + 'fe83fbd3ab53602263410f143b73d5b46fc761882e78c782' + + 'd2c36e716a770a7aefaf7f76cea872db7bffefdbc4c2f9e0' + + '39c19adac915e7a63dcb8c8c78c113f29a3e0bc10e100ce0', + qs: '6f0a2fb763eaeb8eb324d564f03d4a55fdcd709e5f1b65e9' + + '5702b0141182f9f945d71bc3e64a7dfdae7482a7dd5a4e58' + + 'bc38f78de2013f2c468a621f08536969d2c8d011bb3bc259' + + '2124692c91140a5472cad224acdacdeae5751dadfdf068b8' + + '77bfa7374694c6a7be159fc3d24ff9eeeecaf62580427ad8' + + '622d48c51a1c4b1701d768c79d8c819776e096d2694107a2' + + 'f3ec0c32224795b59d32894834039dacb369280afb221bc0' + + '90570a93cf409889b818bb30cccee98b2aa26dbba0f28499' + + '08e1a3cd43fa1f1fb71049e5c77c3724d74dc351d9989057' + + '37bbda3805bd6b1293da8774410fb66e3194e18cdb304dd9' + + 'a0b59b583dcbc9fc045ac9d56aea5cfc9f8a0b95da1e11b7' + + '574d1f976e45fe12294997fac66ca0b83fc056183549e850' + + 'a11413cc4abbe39a211e8c8cbf82f2a23266b3c10ab9e286' + + '07a1b6088909cddff856e1eb6b2cde8bdac53fa939827736' + + 'ca1b892f6c95899613442bd02dbdb747f02487718e2d3f22' + + 'f73734d29767ed8d0e346d0c4098b6fdcb4df7d0c4d29603' + + '5bffe80d6c65ae0a1b814150d349096baaf950f2caf298d2' + + 'b292a1d48cf82b10734fe8cedfa16914076dfe3e9b51337b' + + 'ed28ea1e6824bb717b641ca0e526e175d3e5ed7892aebab0' + + 'f207562cc938a821e2956107c09b6ce4049adddcd0b7505d' + + '49ae6c69a20122461102d465d93dc03db026be54c303613a' + + 'b8e5ce3fd4f65d0b6162ff740a0bf5469ffd442d8c509cd2' + + '3b40dab90f6776ca17fc0678774bd6eee1fa85ababa52ec1' + + 'a15031eb677c6c488661dddd8b83d6031fe294489ded5f08' + + '8ad1689a14baeae7e688afa3033899c81f58de39b392ca94' + + 'af6f15a46f19fa95c06f9493c8b96a9be25e78b9ea35013b' + + 'caa76de6303939299d07426a88a334278fc3d0d9fa71373e' + + 'be51d3c1076ab93a11d3d0d703366ff8cde4c11261d488e5' + + '60a2bdf3bfe2476032294800d6a4a39d306e65c6d7d8d66e' + + '5ec63eee94531e83a9bddc458a2b508285c0ee10b7bd94da' + + '2815a0c5bd5b2e15cbe66355e42f5af8955cdfc0b3a4996d' + + '288db1f4b32b15643b18193e378cb7491f3c3951cdd044b1' + + 'a519571bffac2da986f5f1d506c66530a55f70751e24fa8e' + + 'd83ac2347f4069fb561a5565e78c6f0207da24e889a93a96' + + '65f717d9fe8a2938a09ab5f81be7ccecf466c0397fc15a57' + + '469939793f302739765773c256a3ca55d0548afd117a7cae' + + '98ca7e0d749a130c7b743d376848e255f8fdbe4cb4480b63' + + 'cd2c015d1020cf095d175f3ca9dcdfbaf1b2a6e6468eee4c' + + 'c750f2132a77f376bd9782b9d0ff4da98621b898e251a263' + + '4301ba2214a8c430b2f7a79dbbfd6d7ff6e9b0c137b025ff' + + '587c0bf912f0b19d4fff96b1ecd2ca990c89b386055c60f2' + + '3b94214bd55096f17a7b2c0fa12b333235101cd6f28a128c' + + '782e8a72671adadebbd073ded30bd7f09fb693565dcf0bf3' + + '090c21d13e5b0989dd8956f18f17f4f69449a13549c9d80a' + + '77e5e61b5aeeee9528634100e7bc390672f0ded1ca53555b' + + 'abddbcf700b9da6192255bddf50a76b709fbed251dce4c7e' + + '1ca36b85d1e97c1bc9d38c887a5adf140f9eeef674c31422' + + 'e65f63cae719f8c1324e42fa5fd8500899ef5aa3f9856aa7' + + 'ce10c85600a040343204f36bfeab8cfa6e9deb8a2edd2a8e' + + '018d00c7c9fa3a251ad0f57183c37e6377797653f382ec7a' + + '2b0145e16d3c856bc3634b46d90d7198aff12aff88a30e34' + + 'e2bfaf62705f3382576a9d3eeb0829fca2387b5b654af46e' + + '5cf6316fb57d59e5ea6c369061ac64d99671b0e516529dd5' + + 'd9c48ea0503e55fee090d36c5ea8b5954f6fcc0060794e1c' + + 'b7bc24aa1e5c0142fd4ce6e8fd5aa92a7bf84317ea9e1642' + + 'b6995bac6705adf93cbce72433ed0871139970d640f67b78' + + 'e63a7a6d849db2567df69ac7d79f8c62664ac221df228289' + + 'd0a4f9ebd9acb4f87d49da64e51a619fd3f3baccbd9feb12' + + '5abe0cc2c8d17ed1d8546da2b6c641f4d3020a5f9b9f26ac' + + '16546c2d61385505612275ea344c2bbf1ce890023738f715' + + '5e9eba6a071678c8ebd009c328c3eb643679de86e69a9fa5' + + '67a9e146030ff03d546310a0a568c5ba0070e0da22f2cef8' + + '54714b04d399bbc8fd261f9e8efcd0e83bdbc3f5cfb2d024' + + '3e398478cc598e000124eb8858f9df8f52946c2a1ca5c400' + } +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/pummel/dh-group-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/pummel/dh-group-test.js new file mode 100644 index 00000000..dd6481f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/pummel/dh-group-test.js @@ -0,0 +1,21 @@ +var assert = require('assert'); +var BN = require('../../').BN; +var fixtures = require('../fixtures'); + +describe('BN.js/Slow DH test', function() { + var groups = fixtures.dhGroups; + Object.keys(groups).forEach(function(name) { + it('should match public key for ' + name + ' group', function() { + var group = groups[name]; + + this.timeout(3600 * 1000); + + var base = new BN(2); + var mont = BN.red(new BN(group.prime, 16)); + var priv = new BN(group.priv, 16); + var multed = base.toRed(mont).redPow(priv).fromRed(); + var actual = new Buffer(multed.toArray()); + assert.equal(actual.toString('hex'), group.pub); + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/red-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/red-test.js new file mode 100644 index 00000000..474679ca --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/bn.js/test/red-test.js @@ -0,0 +1,140 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN.js/Reduction context', function() { + function testMethod(name, fn) { + describe(name + ' method', function() { + it('should support add, iadd, sub, isub operations', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(123).toRed(m); + var b = new BN(231).toRed(m); + + assert.equal(a.redAdd(b).fromRed().toString(10), '97'); + assert.equal(a.redSub(b).fromRed().toString(10), '149'); + assert.equal(b.redSub(a).fromRed().toString(10), '108'); + + assert.equal(a.clone().redIAdd(b).fromRed().toString(10), '97'); + assert.equal(a.clone().redISub(b).fromRed().toString(10), '149'); + assert.equal(b.clone().redISub(a).fromRed().toString(10), '108'); + }); + + it('should support pow and mul operations', function() { + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p192); + var a = new BN(123); + var b = new BN(231); + var c = a.toRed(m).redMul(b.toRed(m)).fromRed(); + assert(c.cmp(a.mul(b).mod(p192)) === 0); + + assert.equal(a.toRed(m).redPow(new BN(3)).fromRed() + .cmp(a.sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(4)).fromRed() + .cmp(a.sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(8)).fromRed() + .cmp(a.sqr().sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(9)).fromRed() + .cmp(a.sqr().sqr().sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(17)).fromRed() + .cmp(a.sqr().sqr().sqr().sqr().mul(a)), 0); + }); + + it('should sqrtm numbers', function() { + var p = new BN(263); + var m = fn(p); + var q = new BN(11).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + var q = new BN(13).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + // Tonelli-shanks + var p = new BN(13); + var m = fn(p); + var q = new BN(10).toRed(m); + assert.equal(q.redSqrt().fromRed().toString(10), '7'); + }); + + it('should invm numbers', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(3).toRed(m); + var b = a.redInvm(p); + assert.equal(a.redMul(b).fromRed().toString(16), '1'); + }); + + it('should imul numbers', function() { + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + + var a = new BN('deadbeefabbadead', 16); + var b = new BN('abbadeadbeefdead', 16); + var c = a.mul(b).mod(p); + + assert.equal(a.toRed(m).redIMul(b.toRed(m)).fromRed().toString(16), + c.toString(16)); + }); + }); + } + + testMethod('Plain', BN.red); + testMethod('Montgomery', BN.mont); + + describe('Pseudo-Mersenne Primes', function() { + it('should reduce numbers mod k256', function() { + var p = BN._prime('k256'); + + assert.equal(p.ireduce(new BN(0xdead)).toString(16), 'dead'); + assert.equal(p.ireduce(new BN('deadbeef', 16)).toString(16), 'deadbeef'); + + var num = new BN('fedcba9876543210fedcba9876543210dead' + + 'fedcba9876543210fedcba9876543210dead', + 16); + var exp = num.mod(p.p).toString(16); + assert.equal(p.ireduce(num).toString(16), exp); + + var regr = new BN('f7e46df64c1815962bf7bc9c56128798' + + '3f4fcef9cb1979573163b477eab93959' + + '335dfb29ef07a4d835d22aa3b6797760' + + '70a8b8f59ba73d56d01a79af9', + 16); + var exp = regr.mod(p.p).toString(16); + assert.equal(p.ireduce(regr).toString(16), exp); + }); + + it('should not fail to invm number mod k256', function() { + var regr2 = new BN( + '6c150c4aa9a8cf1934485d40674d4a7cd494675537bda36d49405c5d2c6f496f', 16); + regr2 = regr2.toRed(BN.red('k256')); + assert.equal(regr2.redInvm().redMul(regr2).fromRed().cmpn(1), 0); + }); + + it('should correctly square the number', function() { + var p = BN._prime('k256').p; + var red = BN.red('k256'); + + var n = new BN('9cd8cb48c3281596139f147c1364a3ed' + + 'e88d3f310fdb0eb98c924e599ca1b3c9', + 16); + var expected = n.sqr().mod(p); + var actual = n.toRed(red).redSqr().fromRed(); + + assert.equal(actual.toString(16), expected.toString(16)); + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/.npmignore b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/.npmignore new file mode 100644 index 00000000..07f1e72f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/.npmignore @@ -0,0 +1,6 @@ +benchmarks/ +node_modules/ +dist/*.js +npm-debug.log +1.js +v8.log diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/.travis.yml b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/.travis.yml new file mode 100644 index 00000000..92a990f6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.11" +branches: + only: + - master diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/Makefile b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/Makefile new file mode 100644 index 00000000..ff49cf60 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/Makefile @@ -0,0 +1,12 @@ +BROWSERIFY ?= ./node_modules/.bin/browserify +UGLIFY ?= ./node_modules/.bin/uglifyjs + +all: dist/elliptic.js dist/elliptic.min.js + +dist/elliptic.js: lib/elliptic.js + $(BROWSERIFY) --standalone ellipticjs $< -o $@ + +dist/elliptic.min.js: dist/elliptic.js + $(UGLIFY) --compress --mangle < $< > $@ + +.PHONY: all diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/README.md b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/README.md new file mode 100644 index 00000000..4adff926 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/README.md @@ -0,0 +1,140 @@ +# Elliptic [![Build Status](https://secure.travis-ci.org/indutny/elliptic.png)](http://travis-ci.org/indutny/elliptic) + +Fast elliptic-curve cryptography in a plain javascript implementation. + +NOTE: Please take a look at http://safecurves.cr.yp.to/ before choosing a curve +for your cryptography operations. + +## Incentive + +ECC is much slower than regular RSA cryptography, the JS implementations are +even more slower. + +## Benchmarks + +```bash +$ node benchmarks/index.js +Benchmarking: sign +elliptic#sign x 262 ops/sec ±0.51% (177 runs sampled) +eccjs#sign x 55.91 ops/sec ±0.90% (144 runs sampled) +------------------------ +Fastest is elliptic#sign +======================== +Benchmarking: verify +elliptic#verify x 113 ops/sec ±0.50% (166 runs sampled) +eccjs#verify x 48.56 ops/sec ±0.36% (125 runs sampled) +------------------------ +Fastest is elliptic#verify +======================== +Benchmarking: gen +elliptic#gen x 294 ops/sec ±0.43% (176 runs sampled) +eccjs#gen x 62.25 ops/sec ±0.63% (129 runs sampled) +------------------------ +Fastest is elliptic#gen +======================== +Benchmarking: ecdh +elliptic#ecdh x 136 ops/sec ±0.85% (156 runs sampled) +------------------------ +Fastest is elliptic#ecdh +======================== +``` + +## API + +### ECDSA + +```javascript +var EC = require('elliptic').ec; + +// Create and initialize EC context +// (better do it once and reuse it) +var ec = new EC('secp256k1'); + +// Generate keys +var key = ec.genKeyPair(); + +// Sign message (must be an array, or it'll be treated as a hex sequence) +var msg = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; +var signature = key.sign(msg); + +// Export DER encoded signature in Array +var derSign = signature.toDER(); + +// Verify signature +console.log(key.verify(msg, derSign)); +``` + +### ECDH + +```javascript +// Generate keys +var key1 = ec.genKeyPair(); +var key2 = ec.genKeyPair(); + +var shared1 = key1.derive(key2.getPublic()); +var shared2 = key2.derive(key1.getPublic()); + +console.log('Both shared secrets are BN instances'); +console.log(shared1.toString(16)); +console.log(shared2.toString(16)); +``` + +NOTE: `.derive()` returns a [BN][1] instance. + +## Supported curves + +Elliptic.js support following curve types: + +* Short Weierstrass +* Montgomery +* Edwards +* Twisted Edwards + +Following curve 'presets' are embedded into the library: + +* `secp256k1` +* `p192` +* `p224` +* `p256` +* `curve25519` +* `ed25519` + +NOTE: That `curve25519` could not be used for ECDSA, use `ed25519` instead. + +### Implementation details + +ECDSA is using deterministic `k` value generation as per [RFC6979][0]. Most of +the curve operations are performed on non-affine coordinates (either projective +or extended), various windowing techniques are used for different cases. + +All operations are performed in reduction context using [bn.js][1], hashing is +provided by [hash.js][2] + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2014. + +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. + +[0]: http://tools.ietf.org/html/rfc6979 +[1]: https://github.com/indutny/bn.js +[2]: https://github.com/indutny/hash.js diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/dist/.gitkeep b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/dist/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js new file mode 100644 index 00000000..55654e83 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic.js @@ -0,0 +1,11 @@ +var elliptic = exports; + +elliptic.version = require('../package.json').version; +elliptic.utils = require('./elliptic/utils'); +elliptic.rand = require('brorand'); +elliptic.hmacDRBG = require('./elliptic/hmac-drbg'); +elliptic.curve = require('./elliptic/curve'); +elliptic.curves = require('./elliptic/curves'); + +// Protocols +elliptic.ec = require('./elliptic/ec'); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/base.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/base.js new file mode 100644 index 00000000..53afe17d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/base.js @@ -0,0 +1,302 @@ +var bn = require('bn.js'); +var elliptic = require('../../elliptic'); + +var getNAF = elliptic.utils.getNAF; +var getJSF = elliptic.utils.getJSF; +var assert = elliptic.utils.assert; + +function BaseCurve(type, conf) { + this.type = type; + this.p = new bn(conf.p, 16); + + // Use Montgomery, when there is no fast reduction for the prime + this.red = conf.prime ? bn.red(conf.prime) : bn.mont(this.p); + + // Useful for many curves + this.zero = new bn(0).toRed(this.red); + this.one = new bn(1).toRed(this.red); + this.two = new bn(2).toRed(this.red); + + // Curve configuration, optional + this.n = conf.n && new bn(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + + // Temporary arrays + this._wnafT1 = new Array(4); + this._wnafT2 = new Array(4); + this._wnafT3 = new Array(4); + this._wnafT4 = new Array(4); +} +module.exports = BaseCurve; + +BaseCurve.prototype.point = function point() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype.validate = function validate(point) { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { + var doubles = p._getDoubles(); + + var naf = getNAF(k, 1); + var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); + I /= 3; + + // Translate into more windowed form + var repr = []; + for (var j = 0; j < naf.length; j += doubles.step) { + var nafW = 0; + for (var k = j + doubles.step - 1; k >= j; k--) + nafW = (nafW << 1) + naf[k]; + repr.push(nafW); + } + + var a = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + for (var i = I; i > 0; i--) { + for (var j = 0; j < repr.length; j++) { + var nafW = repr[j]; + if (nafW === i) + b = b.mixedAdd(doubles.points[j]); + else if (nafW === -i) + b = b.mixedAdd(doubles.points[j].neg()); + } + a = a.add(b); + } + return a.toP(); +}; + +BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; + + // Precompute window + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + + // Get NAF form + var naf = getNAF(k, w); + + // Add `this`*(N+1) for every w-NAF index + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + // Count zeroes + for (var k = 0; i >= 0 && naf[i] === 0; i--) + k++; + if (i >= 0) + k++; + acc = acc.dblp(k); + + if (i < 0) + break; + var z = naf[i]; + assert(z !== 0); + if (p.type === 'affine') { + // J +- P + if (z > 0) + acc = acc.mixedAdd(wnd[(z - 1) >> 1]); + else + acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); + } else { + // J +- J + if (z > 0) + acc = acc.add(wnd[(z - 1) >> 1]); + else + acc = acc.add(wnd[(-z - 1) >> 1].neg()); + } + } + return p.type === 'affine' ? acc.toP() : acc; +}; + +BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, + points, + coeffs, + len) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; + + // Fill all arrays + var max = 0; + for (var i = 0; i < len; i++) { + var p = points[i]; + var nafPoints = p._getNAFPoints(defW); + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; + } + + // Comb small window NAFs + for (var i = len - 1; i >= 1; i -= 2) { + var a = i - 1; + var b = i; + if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { + naf[a] = getNAF(coeffs[a], wndWidth[a]); + naf[b] = getNAF(coeffs[b], wndWidth[b]); + max = Math.max(naf[a].length, max); + max = Math.max(naf[b].length, max); + continue; + } + + var comb = [ + points[a], /* 1 */ + null, /* 3 */ + null, /* 5 */ + points[b] /* 7 */ + ]; + + // Try to avoid Projective points, if possible + if (points[a].y.cmp(points[b].y) === 0) { + comb[1] = points[a].add(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].add(points[b].neg()); + } else { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } + + var index = [ + -3, /* -1 -1 */ + -1, /* -1 0 */ + -5, /* -1 1 */ + -7, /* 0 -1 */ + 0, /* 0 0 */ + 7, /* 0 1 */ + 5, /* 1 -1 */ + 1, /* 1 0 */ + 3 /* 1 1 */ + ]; + + var jsf = getJSF(coeffs[a], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a] = new Array(max); + naf[b] = new Array(max); + for (var j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + + naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a] = comb; + } + } + + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + for (var i = max; i >= 0; i--) { + var k = 0; + + while (i >= 0) { + var zero = true; + for (var j = 0; j < len; j++) { + tmp[j] = naf[j][i] | 0; + if (tmp[j] !== 0) + zero = false; + } + if (!zero) + break; + k++; + i--; + } + if (i >= 0) + k++; + acc = acc.dblp(k); + if (i < 0) + break; + + for (var j = 0; j < len; j++) { + var z = tmp[j]; + var p; + if (z === 0) + continue; + else if (z > 0) + p = wnd[j][(z - 1) >> 1]; + else if (z < 0) + p = wnd[j][(-z - 1) >> 1].neg(); + + if (p.type === 'affine') + acc = acc.mixedAdd(p); + else + acc = acc.add(p); + } + } + // Zeroify references + for (var i = 0; i < len; i++) + wnd[i] = null; + return acc.toP(); +}; + +BaseCurve.BasePoint = BasePoint; + +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} + +BasePoint.prototype.validate = function validate() { + return this.curve.validate(this); +}; + +BasePoint.prototype.precompute = function precompute(power, _beta) { + if (this.precomputed) + return this; + + var precomputed = { + doubles: null, + naf: null, + beta: null + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + + return this; +}; + +BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + + var doubles = [ this ]; + var acc = this; + for (var i = 0; i < power; i += step) { + for (var j = 0; j < step; j++) + acc = acc.dbl(); + doubles.push(acc); + } + return { + step: step, + points: doubles + }; +}; + +BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + + var res = [ this ]; + var max = (1 << wnd) - 1; + var dbl = max === 1 ? null : this.dbl(); + for (var i = 1; i < max; i++) + res[i] = res[i - 1].add(dbl); + return { + wnd: wnd, + points: res + }; +}; + +BasePoint.prototype._getBeta = function _getBeta() { + return null; +}; + +BasePoint.prototype.dblp = function dblp(k) { + var r = this; + for (var i = 0; i < k; i++) + r = r.dbl(); + return r; +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/edwards.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/edwards.js new file mode 100644 index 00000000..85905b37 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/edwards.js @@ -0,0 +1,361 @@ +var curve = require('../curve'); +var elliptic = require('../../elliptic'); +var bn = require('bn.js'); +var inherits = require('inherits'); +var Base = curve.base; + +var getNAF = elliptic.utils.getNAF; +var assert = elliptic.utils.assert; + +function EdwardsCurve(conf) { + // NOTE: Important as we are creating point in Base.call() + this.twisted = conf.a != 1; + this.mOneA = this.twisted && conf.a == -1; + this.extended = this.mOneA; + + Base.call(this, 'mont', conf); + + this.a = new bn(conf.a, 16).mod(this.red.m).toRed(this.red); + this.c = new bn(conf.c, 16).toRed(this.red); + this.c2 = this.c.redSqr(); + this.d = new bn(conf.d, 16).toRed(this.red); + this.dd = this.d.redAdd(this.d); + + assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); + this.oneC = conf.c == 1; +} +inherits(EdwardsCurve, Base); +module.exports = EdwardsCurve; + +EdwardsCurve.prototype._mulA = function _mulA(num) { + if (this.mOneA) + return num.redNeg(); + else + return this.a.redMul(num); +}; + +EdwardsCurve.prototype._mulC = function _mulC(num) { + if (this.oneC) + return num; + else + return this.c.redMul(num); +}; + +EdwardsCurve.prototype.point = function point(x, y, z, t) { + return new Point(this, x, y, z, t); +}; + +// Just for compatibility with Short curve +EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { + return this.point(x, y, z, t); +}; + +EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +EdwardsCurve.prototype.pointFromX = function pointFromX(odd, x) { + x = new bn(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var x2 = x.redSqr(); + var rhs = this.c2.redSub(this.a.redMul(x2)); + var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); + + var y = rhs.redMul(lhs.redInvm()).redSqrt(); + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y, curve.one); +}; + +EdwardsCurve.prototype.validate = function validate(point) { + if (point.isInfinity()) + return true; + + // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2) + point.normalize(); + + var x2 = point.x.redSqr(); + var y2 = point.y.redSqr(); + var lhs = x2.redMul(this.a).redAdd(y2); + var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); + + return lhs.cmp(rhs) === 0; +}; + +function Point(curve, x, y, z, t) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && y === null && z === null) { + this.x = this.curve.zero; + this.y = this.curve.one; + this.z = this.curve.one; + this.t = this.curve.zero; + this.zOne = true; + } else { + this.x = new bn(x, 16); + this.y = new bn(y, 16); + this.z = z ? new bn(z, 16) : this.curve.one; + this.t = t && new bn(t, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + if (this.t && !this.t.red) + this.t = this.t.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; + + // Use extended coordinates + if (this.curve.extended && !this.t) { + this.t = this.x.redMul(this.y); + if (!this.zOne) + this.t = this.t.redMul(this.z.redInvm()); + } + } +} +inherits(Point, Base.BasePoint); + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1], obj[2]); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.x.cmpn(0) === 0 && + this.y.cmp(this.z) === 0; +}; + +Point.prototype._extDbl = function _extDbl() { + // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-dbl-2008-hwcd + // 4M + 4S + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = 2 * Z1^2 + var c = this.z.redSqr(); + c = c.redIAdd(c); + // D = a * A + var d = this.curve._mulA(a); + // E = (X1 + Y1)^2 - A - B + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + // G = D + B + var g = d.redAdd(b); + // F = G - C + var f = g.redSub(c); + // H = D - B + var h = d.redSub(b); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projDbl = function _projDbl() { + // http://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#doubling-dbl-2008-bbjlp + // http://hyperelliptic.org/EFD/g1p/auto-edwards-projective.html#doubling-dbl-2007-bl + // and others + // Generally 3M + 4S or 2M + 4S + + // B = (X1 + Y1)^2 + var b = this.x.redAdd(this.y).redSqr(); + // C = X1^2 + var c = this.x.redSqr(); + // D = Y1^2 + var d = this.y.redSqr(); + + if (this.curve.twisted) { + // E = a * C + var e = this.curve._mulA(c); + // F = E + D + var f = e.redAdd(d); + if (this.zOne) { + // X3 = (B - C - D) * (F - 2) + var nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + // Y3 = F * (E - D) + var ny = f.redMul(e.redSub(d)); + // Z3 = F^2 - 2 * F + var nz = f.redSqr().redSub(f).redSub(f); + } else { + // H = Z1^2 + var h = this.z.redSqr(); + // J = F - 2 * H + var j = f.redSub(h).redISub(h); + // X3 = (B-C-D)*J + var nx = b.redSub(c).redISub(d).redMul(j); + // Y3 = F * (E - D) + var ny = f.redMul(e.redSub(d)); + // Z3 = F * J + var nz = f.redMul(j); + } + } else { + // E = C + D + var e = c.redAdd(d); + // H = (c * Z1)^2 + var h = this.curve._mulC(redMul(this.z)).redSqr(); + // J = E - 2 * H + var j = e.redSub(h).redSub(h); + // X3 = c * (B - E) * J + var nx = this.curve._mulC(b.redISub(e)).redMul(j); + // Y3 = c * E * (C - D) + var ny = this.curve._mulC(e).redMul(c.redISub(d)); + // Z3 = E * J + var nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + // Double in extended coordinates + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); +}; + +Point.prototype._extAdd = function _extAdd(p) { + // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3 + // 8M + + // A = (Y1 - X1) * (Y2 - X2) + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + // B = (Y1 + X1) * (Y2 + X2) + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + // C = T1 * k * T2 + var c = this.t.redMul(this.curve.dd).redMul(p.t); + // D = Z1 * 2 * Z2 + var d = this.z.redMul(p.z.redAdd(p.z)); + // E = B - A + var e = b.redSub(a); + // F = D - C + var f = d.redSub(c); + // G = D + C + var g = d.redAdd(c); + // H = B + A + var h = b.redAdd(a); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projAdd = function _projAdd(p) { + // http://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#addition-add-2008-bbjlp + // http://hyperelliptic.org/EFD/g1p/auto-edwards-projective.html#addition-add-2007-bl + // 10M + 1S + + // A = Z1 * Z2 + var a = this.z.redMul(p.z); + // B = A^2 + var b = a.redSqr(); + // C = X1 * X2 + var c = this.x.redMul(p.x); + // D = Y1 * Y2 + var d = this.y.redMul(p.y); + // E = d * C * D + var e = this.curve.d.redMul(c).redMul(d); + // F = B - E + var f = b.redSub(e); + // G = B + E + var g = b.redAdd(e); + // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D) + var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); + var nx = a.redMul(f).redMul(tmp); + if (this.curve.twisted) { + // Y3 = A * G * (D - a * C) + var ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + // Z3 = F * G + var nz = f.redMul(g); + } else { + // Y3 = A * G * (D - C) + var ny = a.redMul(g).redMul(d.redSub(c)); + // Z3 = c * F * G + var nz = this.curve._mulC(f).redMul(g); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.add = function add(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + + if (this.curve.extended) + return this._extAdd(p); + else + return this._projAdd(p); +}; + +Point.prototype.mul = function mul(k) { + if (this.precomputed && this.precomputed.doubles) + return this.curve._fixedNafMul(this, k); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2); +}; + +Point.prototype.normalize = function normalize() { + if (this.zOne) + return this; + + // Normalize coordinates + var zi = this.z.redInvm(); + this.x = this.x.redMul(zi); + this.y = this.y.redMul(zi); + if (this.t) + this.t = this.t.redMul(zi); + this.z = this.curve.one; + this.zOne = true; + return this; +}; + +Point.prototype.neg = function neg() { + return this.curve.point(this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg()); +}; + +Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + this.normalize(); + return this.y.fromRed(); +}; + +// Compatibility with BaseCurve +Point.prototype.toP = Point.prototype.normalize; +Point.prototype.mixedAdd = Point.prototype.add; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js new file mode 100644 index 00000000..4ea180cc --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/index.js @@ -0,0 +1,6 @@ +var curve = exports; + +curve.base = require('./base'); +curve.short = require('./short'); +curve.mont = require('./mont'); +curve.edwards = require('./edwards'); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/mont.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/mont.js new file mode 100644 index 00000000..903d2711 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/mont.js @@ -0,0 +1,163 @@ +var curve = require('../curve'); +var elliptic = require('../../elliptic'); +var bn = require('bn.js'); +var inherits = require('inherits'); +var Base = curve.base; + +var getNAF = elliptic.utils.getNAF; +var assert = elliptic.utils.assert; + +function MontCurve(conf) { + Base.call(this, 'mont', conf); + + this.a = new bn(conf.a, 16).toRed(this.red); + this.b = new bn(conf.b, 16).toRed(this.red); + this.i4 = new bn(4).toRed(this.red).redInvm(); + this.two = new bn(2).toRed(this.red); + this.a24 = this.i4.redMul(this.a.redAdd(this.two)); +} +inherits(MontCurve, Base); +module.exports = MontCurve; + +MontCurve.prototype.point = function point(x, z) { + return new Point(this, x, z); +}; + +MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +} + +MontCurve.prototype.validate = function validate(point) { + var x = point.normalize().x; + var x2 = x.redSqr(); + var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); + var y = rhs.redSqrt(); + + return y.redSqr().cmp(rhs) === 0; +}; + +function Point(curve, x, z) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && z === null) { + this.x = this.curve.one; + this.z = this.curve.zero; + } else { + this.x = new bn(x, 16); + this.z = new bn(z, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + } +} +inherits(Point, Base.BasePoint); + +Point.prototype.precompute = function precompute() { + // No-op +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1] || curve.one); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + +Point.prototype.dbl = function dbl() { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3 + // 2M + 2S + 4A + + // A = X1 + Z1 + var a = this.x.redAdd(this.z); + // AA = A^2 + var aa = a.redSqr(); + // B = X1 - Z1 + var b = this.x.redSub(this.z); + // BB = B^2 + var bb = b.redSqr(); + // C = AA - BB + var c = aa.redSub(bb); + // X3 = AA * BB + var nx = aa.redMul(bb); + // Z3 = C * (BB + A24 * C) + var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); + return this.curve.point(nx, nz); +}; + +Point.prototype.add = function add(p) { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.diffAdd = function diffAdd(p, diff) { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3 + // 4M + 2S + 6A + + // A = X2 + Z2 + var a = this.x.redAdd(this.z); + // B = X2 - Z2 + var b = this.x.redSub(this.z); + // C = X3 + Z3 + var c = p.x.redAdd(p.z); + // D = X3 - Z3 + var d = p.x.redSub(p.z); + // DA = D * A + var da = d.redMul(a); + // CB = C * B + var cb = c.redMul(b); + // X5 = Z1 * (DA + CB)^2 + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + // Z5 = X1 * (DA - CB)^2 + var nz = diff.x.redMul(da.redISub(cb).redSqr()); + return this.curve.point(nx, nz); +}; + +Point.prototype.mul = function mul(k) { + var t = k.clone(); + var a = this; // (N / 2) * Q + Q + var b = this.curve.point(null, null); // (N / 2) * Q + var c = this; // Q + + for (var bits = []; t.cmpn(0) !== 0; t.ishrn(1)) + bits.push(t.andln(1)); + + for (var i = bits.length - 1; i >= 0; i--) { + if (bits[i] === 0) { + // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q + a = a.diffAdd(b, c); + // N * Q = 2 * ((N / 2) * Q + Q)) + b = b.dbl(); + } else { + // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q) + b = a.diffAdd(b, c); + // N * Q + Q = 2 * ((N / 2) * Q + Q) + a = a.dbl(); + } + } + return b; +}; + +Point.prototype.mulAdd = function mulAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.normalize = function normalize() { + this.x = this.x.redMul(this.z.redInvm()); + this.z = this.curve.one; + return this; +}; + +Point.prototype.getX = function getX() { + // Normalize coordinates + this.normalize(); + + return this.x.fromRed(); +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/short.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/short.js new file mode 100644 index 00000000..0cd45a54 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curve/short.js @@ -0,0 +1,896 @@ +var curve = require('../curve'); +var elliptic = require('../../elliptic'); +var bn = require('bn.js'); +var inherits = require('inherits'); +var Base = curve.base; + +var getNAF = elliptic.utils.getNAF; +var assert = elliptic.utils.assert; + +function ShortCurve(conf) { + Base.call(this, 'short', conf); + + this.a = new bn(conf.a, 16).toRed(this.red); + this.b = new bn(conf.b, 16).toRed(this.red); + this.tinv = this.two.redInvm(); + + this.zeroA = this.a.fromRed().cmpn(0) === 0; + this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; + + // If the curve is endomorphic, precalculate beta and lambda + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); +} +inherits(ShortCurve, Base); +module.exports = ShortCurve; + +ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + // No efficient endomorphism + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + + // Compute beta and lambda, that lambda * P = (beta * Px; Py) + var beta; + var lambda; + if (conf.beta) { + beta = new bn(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + // Choose the smallest beta + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new bn(conf.lambda, 16); + } else { + // Choose the lambda that is matching selected beta + var lambdas = this._getEndoRoots(this.n); + if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { + lambda = lambdas[0]; + } else { + lambda = lambdas[1]; + assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + + // Get basis vectors, used for balanced length-two representation + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new bn(vec.a, 16), + b: new bn(vec.b, 16), + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + + return { + beta: beta, + lambda: lambda, + basis: basis + }; +}; + +ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + // Find roots of for x^2 + x + 1 in F + // Root = (-1 +- Sqrt(-3)) / 2 + // + var red = num === this.p ? this.red : bn.mont(num); + var tinv = new bn(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + var one = new bn(1).toRed(red); + + var s = new bn(3).toRed(red).redNeg().redSqrt().redMul(tinv); + + var l1 = ntinv.redAdd(s).fromRed(); + var l2 = ntinv.redSub(s).fromRed(); + return [ l1, l2 ]; +}; + +ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { + // aprxSqrt >= sqrt(this.n) + var aprxSqrt = this.n.shrn(Math.floor(this.n.bitLength() / 2)); + + // 3.74 + // Run EGCD, until r(L + 1) < aprxSqrt + var u = lambda; + var v = this.n.clone(); + var x1 = new bn(1); + var y1 = new bn(0); + var x2 = new bn(0); + var y2 = new bn(1); + + // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) + var a0; + var b0; + // First vector + var a1; + var b1; + // Second vector + var a2; + var b2; + + var prevR; + var i = 0; + while (u.cmpn(0) !== 0) { + var q = v.div(u); + var r = v.sub(q.mul(u)); + var x = x2.sub(q.mul(x1)); + var y = y2.sub(q.mul(y1)); + + if (!a1 && r.cmp(aprxSqrt) < 0) { + a0 = prevR.neg(); + b0 = x1; + a1 = r.neg(); + b1 = x; + } else if (a1 && ++i === 2) { + break; + } + prevR = r; + + v = u; + u = r; + x2 = x1; + x1 = x; + y2 = y1; + y1 = y; + } + a2 = r.neg(); + b2 = x; + + var len1 = a1.sqr().add(b1.sqr()); + var len2 = a2.sqr().add(b2.sqr()); + if (len2.cmp(len1) >= 0) { + a2 = a0; + b2 = b0; + } + + // Normalize signs + if (a1.sign) { + a1 = a1.neg(); + b1 = b1.neg(); + } + if (a2.sign) { + a2 = a2.neg(); + b2 = b2.neg(); + } + + return [ + { a: a1, b: b1 }, + { a: a2, b: b2 } + ]; +}; + +ShortCurve.prototype._endoSplit = function _endoSplit(k) { + var basis = this.endo.basis; + var v1 = basis[0]; + var v2 = basis[1]; + + var c1 = v2.b.mul(k).divRound(this.n); + var c2 = v1.b.neg().mul(k).divRound(this.n); + + var p1 = c1.mul(v1.a); + var p2 = c2.mul(v2.a); + var q1 = c1.mul(v1.b); + var q2 = c2.mul(v2.b); + + // Calculate answer + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1: k1, k2: k2 }; +}; + +ShortCurve.prototype.point = function point(x, y, isRed) { + return new Point(this, x, y, isRed); +}; + +ShortCurve.prototype.pointFromX = function pointFromX(odd, x) { + x = new bn(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); + var y = y2.redSqrt(); + + // XXX Is there any way to tell if the number is odd without converting it + // to non-red form? + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +ShortCurve.prototype.jpoint = function jpoint(x, y, z) { + return new JPoint(this, x, y, z); +}; + +ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { + return Point.fromJSON(this, obj, red); +}; + +ShortCurve.prototype.validate = function validate(point) { + if (point.inf) + return true; + + var x = point.x; + var y = point.y; + + var ax = this.a.redMul(x); + var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); + return y.redSqr().redISub(rhs).cmpn(0) === 0; +}; + +ShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs) { + var npoints = this._endoWnafT1; + var ncoeffs = this._endoWnafT2; + for (var i = 0; i < points.length; i++) { + var split = this._endoSplit(coeffs[i]); + var p = points[i]; + var beta = p._getBeta(); + + if (split.k1.sign) { + split.k1.sign = !split.k1.sign; + p = p.neg(true); + } + if (split.k2.sign) { + split.k2.sign = !split.k2.sign; + beta = beta.neg(true); + } + + npoints[i * 2] = p; + npoints[i * 2 + 1] = beta; + ncoeffs[i * 2] = split.k1; + ncoeffs[i * 2 + 1] = split.k2; + } + var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2); + + // Clean-up references to points and coefficients + for (var j = 0; j < i * 2; j++) { + npoints[j] = null; + ncoeffs[j] = null; + } + return res; +}; + +function Point(curve, x, y, isRed) { + Base.BasePoint.call(this, curve, 'affine'); + if (x === null && y === null) { + this.x = null; + this.y = null; + this.inf = true; + } else { + this.x = new bn(x, 16); + this.y = new bn(y, 16); + // Force redgomery representation when loading from JSON + if (isRed) { + this.x.forceRed(this.curve.red); + this.y.forceRed(this.curve.red); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + this.inf = false; + } +} +inherits(Point, Base.BasePoint); + +Point.prototype._getBeta = function _getBeta() { + if (!this.curve.endo) + return; + + var pre = this.precomputed; + if (pre && pre.beta) + return pre.beta; + + var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (pre) { + var curve = this.curve; + function endoMul(p) { + return curve.point(p.x.redMul(curve.endo.beta), p.y); + } + pre.beta = beta; + beta.precomputed = { + beta: null, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(endoMul) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(endoMul) + } + }; + } + return beta; +}; + +Point.prototype.toJSON = function toJSON() { + if (!this.precomputed) + return [ this.x, this.y ]; + + return [ this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1) + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1) + } + }]; +}; + +Point.fromJSON = function fromJSON(curve, obj, red) { + if (typeof obj === 'string') + obj = JSON.parse(obj); + var res = curve.point(obj[0], obj[1], red); + if (!obj[2]) + return res; + + function obj2point(obj) { + return curve.point(obj[0], obj[1], red); + } + + var pre = obj[2]; + res.precomputed = { + beta: null, + doubles: pre.doubles && { + step: pre.doubles.step, + points: [ res ].concat(pre.doubles.points.map(obj2point)) + }, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: [ res ].concat(pre.naf.points.map(obj2point)) + } + }; + return res; +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + return this.inf; +}; + +Point.prototype.add = function add(p) { + // O + P = P + if (this.inf) + return p; + + // P + O = P + if (p.inf) + return this; + + // P + P = 2P + if (this.eq(p)) + return this.dbl(); + + // P + (-P) = O + if (this.neg().eq(p)) + return this.curve.point(null, null); + + // P + Q = O + if (this.x.cmp(p.x) === 0) + return this.curve.point(null, null); + + var c = this.y.redSub(p.y); + if (c.cmpn(0) !== 0) + c = c.redMul(this.x.redSub(p.x).redInvm()); + var nx = c.redSqr().redISub(this.x).redISub(p.x); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.dbl = function dbl() { + if (this.inf) + return this; + + // 2P = O + var ys1 = this.y.redAdd(this.y); + if (ys1.cmpn(0) === 0) + return this.curve.point(null, null); + + var a = this.curve.a; + + var x2 = this.x.redSqr(); + var dyinv = ys1.redInvm(); + var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); + + var nx = c.redSqr().redISub(this.x.redAdd(this.x)); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.getX = function getX() { + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + return this.y.fromRed(); +}; + +Point.prototype.mul = function mul(k) { + k = new bn(k, 16); + + if (this.precomputed && this.precomputed.doubles) + return this.curve._fixedNafMul(this, k); + else if (this.curve.endo) + return this.curve._endoWnafMulAdd([ this ], [ k ]); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2); +}; + +Point.prototype.eq = function eq(p) { + return this === p || + this.inf === p.inf && + (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); +}; + +Point.prototype.neg = function neg(_precompute) { + if (this.inf) + return this; + + var res = this.curve.point(this.x, this.y.redNeg()); + if (_precompute && this.precomputed) { + var pre = this.precomputed; + function negate(p) { + return p.neg(); + } + res.precomputed = { + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(negate) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(negate) + } + }; + } + return res; +}; + +Point.prototype.toJ = function toJ() { + if (this.inf) + return this.curve.jpoint(null, null, null); + + var res = this.curve.jpoint(this.x, this.y, this.curve.one); + return res; +}; + +function JPoint(curve, x, y, z) { + Base.BasePoint.call(this, curve, 'jacobian'); + if (x === null && y === null && z === null) { + this.x = this.curve.one; + this.y = this.curve.one; + this.z = new bn(0); + } else { + this.x = new bn(x, 16); + this.y = new bn(y, 16); + this.z = new bn(z, 16); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + + this.zOne = this.z === this.curve.one; +} +inherits(JPoint, Base.BasePoint); + +JPoint.prototype.toP = function toP() { + if (this.isInfinity()) + return this.curve.point(null, null); + + var zinv = this.z.redInvm(); + var zinv2 = zinv.redSqr(); + var ax = this.x.redMul(zinv2); + var ay = this.y.redMul(zinv2).redMul(zinv); + + return this.curve.point(ax, ay); +}; + +JPoint.prototype.neg = function neg() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); +}; + +JPoint.prototype.add = function add(p) { + // O + P = P + if (this.isInfinity()) + return p; + + // P + O = P + if (p.isInfinity()) + return this; + + // 12M + 4S + 7A + var pz2 = p.z.redSqr(); + var z2 = this.z.redSqr(); + var u1 = this.x.redMul(pz2); + var u2 = p.x.redMul(z2); + var s1 = this.y.redMul(pz2.redMul(p.z)); + var s2 = p.y.redMul(z2.redMul(this.z)); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(p.z).redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mixedAdd = function mixedAdd(p) { + // O + P = P + if (this.isInfinity()) + return p.toJ(); + + // P + O = P + if (p.isInfinity()) + return this; + + // 8M + 3S + 7A + var z2 = this.z.redSqr(); + var u1 = this.x; + var u2 = p.x.redMul(z2); + var s1 = this.y; + var s2 = p.y.redMul(z2).redMul(this.z); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.dblp = function dblp(pow) { + if (pow === 0) + return this; + if (this.isInfinity()) + return this; + if (!pow) + return this.dbl(); + + if (this.curve.zeroA || this.curve.threeA) { + var r = this; + for (var i = 0; i < pow; i++) + r = r.dbl(); + return r; + } + + // 1M + 2S + 1A + N * (4S + 5M + 8A) + // N = 1 => 6M + 6S + 9A + var a = this.curve.a; + var tinv = this.curve.tinv; + + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + // Reuse results + var jyd = jy.redAdd(jy); + for (var i = 0; i < pow; i++) { + var jx2 = jx.redSqr(); + var jyd2 = jyd.redSqr(); + var jyd4 = jyd2.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var t1 = jx.redMul(jyd2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var dny = c.redMul(t2); + dny = dny.redIAdd(dny).redISub(jyd4); + var nz = jyd.redMul(jz); + if (i + 1 < pow) + jz4 = jz4.redMul(jyd4); + + jx = nx; + jz = nz; + jyd = dny; + } + + return this.curve.jpoint(jx, jyd.redMul(tinv), jz); +}; + +JPoint.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + if (this.curve.zeroA) + return this._zeroDbl(); + else if (this.curve.threeA) + return this._threeDbl(); + else + return this._dbl(); +}; + +JPoint.prototype._zeroDbl = function _zeroDbl() { + // Z = 1 + if (this.zOne) { + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl + // 1M + 5S + 14A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // T = M ^ 2 - 2*S + var t = m.redSqr().redISub(s).redISub(s); + + // 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + + // X3 = T + var nx = t; + // Y3 = M * (S - T) - 8 * YYYY + var ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2*Y1 + var nz = this.y.redAdd(this.y); + } else { + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l + // 2M + 5S + 13A + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = B^2 + var c = b.redSqr(); + // D = 2 * ((X1 + B)^2 - A - C) + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + // E = 3 * A + var e = a.redAdd(a).redIAdd(a); + // F = E^2 + var f = e.redSqr(); + + // 8 * C + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + + // X3 = F - 2 * D + var nx = f.redISub(d).redISub(d); + // Y3 = E * (D - X3) - 8 * C + var ny = e.redMul(d.redISub(nx)).redISub(c8); + // Z3 = 2 * Y1 * Z1 + var nz = this.y.redMul(this.z); + nz = nz.redIAdd(nz); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._threeDbl = function _threeDbl() { + // Z = 1 + if (this.zOne) { + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-mdbl-2007-bl + // 1M + 5S + 15A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + // T = M^2 - 2 * S + var t = m.redSqr().redISub(s).redISub(s); + // X3 = T + var nx = t; + // Y3 = M * (S - T) - 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + var ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2 * Y1 + var nz = this.y.redAdd(this.y); + } else { + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b + // 3M + 5S + + // delta = Z1^2 + var delta = this.z.redSqr(); + // gamma = Y1^2 + var gamma = this.y.redSqr(); + // beta = X1 * gamma + var beta = this.x.redMul(gamma); + // alpha = 3 * (X1 - delta) * (X1 + delta) + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + // X3 = alpha^2 - 8 * beta + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + var nx = alpha.redSqr().redISub(beta8); + // Z3 = (Y1 + Z1)^2 - gamma - delta + var nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 + var ggamma8 = gamma.redSqr(); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + var ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._dbl = function _dbl() { + var a = this.curve.a; + var tinv = this.curve.tinv; + + // 4M + 6S + 10A + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + var jx2 = jx.redSqr(); + var jy2 = jy.redSqr(); + + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var jxd4 = jx.redAdd(jx); + jxd4 = jxd4.redIAdd(jxd4); + var t1 = jxd4.redMul(jy2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + + var jyd8 = jy2.redSqr(); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + var ny = c.redMul(t2).redISub(jyd8); + var nz = jy.redAdd(jy).redMul(jz); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.trpl = function trpl() { + if (!this.curve.zeroA) + return this.dbl().add(this); + + // http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl + // 5M + 10S + ... + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // ZZ = Z1^2 + var zz = this.z.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // M = 3 * XX + a * ZZ2; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // MM = M^2 + var mm = m.redSqr(); + // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM + var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + e = e.redIAdd(e); + e = e.redAdd(e).redIAdd(e); + e = e.redISub(mm); + // EE = E^2 + var ee = e.redSqr(); + // T = 16*YYYY + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + // U = (M + E)^2 - MM - EE - T + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + // X3 = 4 * (X1 * EE - 4 * YY * U) + var yyu4 = yy.redMul(u); + yyu4 = yyu4.redIAdd(yyu4); + yyu4 = yyu4.redIAdd(yyu4); + var nx = this.x.redMul(ee).redISub(yyu4); + nx = nx.redIAdd(nx); + nx = nx.redIAdd(nx); + // Y3 = 8 * Y1 * (U * (T - U) - E * EE) + var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + // Z3 = (Z1 + E)^2 - ZZ - EE + var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mul = function mul(k, kbase) { + k = new bn(k, kbase); + + return this.curve._wnafMul(this, k); +}; + +JPoint.prototype.eq = function eq(p) { + if (p.type === 'affine') + return this.eq(p.toJ()); + + if (this === p) + return true; + + // x1 * z2^2 == x2 * z1^2 + var z2 = this.z.redSqr(); + var pz2 = p.z.redSqr(); + if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) + return false; + + // y1 * z2^3 == y2 * z1^3 + var z3 = z2.redMul(this.z); + var pz3 = pz2.redMul(p.z); + return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; +}; + +JPoint.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +JPoint.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curves.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curves.js new file mode 100644 index 00000000..539d8a57 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/curves.js @@ -0,0 +1,928 @@ +var curves = exports; + +var hash = require('hash.js'); +var bn = require('bn.js'); +var elliptic = require('../elliptic'); + +var assert = elliptic.utils.assert; + +function PresetCurve(options) { + if (options.type === 'short') + this.curve = new elliptic.curve.short(options); + else if (options.type === 'edwards') + this.curve = new elliptic.curve.edwards(options); + else + this.curve = new elliptic.curve.mont(options); + this.g = this.curve.g; + this.n = this.curve.n; + this.hash = options.hash; + + assert(this.g.validate(), 'Invalid curve'); + assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); +} +curves.PresetCurve = PresetCurve; + +function defineCurve(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve + }); + return curve; + } + }); +} + +defineCurve('p192', { + type: 'short', + prime: 'p192', + p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', + b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', + n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', + hash: hash.sha256, + gRed: false, + g: [ + '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', + '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811' + ], +}); + +defineCurve('p224', { + type: 'short', + prime: 'p224', + p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', + b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', + n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', + hash: hash.sha256, + gRed: false, + g: [ + 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', + 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34' + ], +}); + +defineCurve('p256', { + type: 'short', + prime: null, + p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', + a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', + b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', + n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', + hash: hash.sha256, + gRed: false, + g: [ + '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', + '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5' + ], +}); + +defineCurve('curve25519', { + type: 'mont', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '76d06', + b: '0', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '9' + ] +}); + +defineCurve('ed25519', { + type: 'edwards', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '-1', + c: '1', + // -121665 * (121666^(-1)) (mod P) + d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', + + // 4/5 + '6666666666666666666666666666666666666666666666666666666666666658' + ] +}); + +defineCurve('secp256k1', { + type: 'short', + prime: 'k256', + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', + h: '1', + hash: hash.sha256, + + // Precomputed endomorphism + beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', + lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', + basis: [ + { + a: '3086d221a7d46bcde86c90e49284eb15', + b: '-e4437ed6010e88286f547fa90abfe4c3' + }, + { + a: '114ca50f7a8e2f3f657c1108d9d44cfd8', + b: '3086d221a7d46bcde86c90e49284eb15' + } + ], + + gRed: false, + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', + { + 'doubles': { + 'step': 4, + 'points': [ + [ + 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a', + 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821' + ], + [ + '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508', + '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf' + ], + [ + '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739', + 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695' + ], + [ + '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640', + '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9' + ], + [ + '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c', + '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36' + ], + [ + '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda', + '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f' + ], + [ + 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa', + '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999' + ], + [ + '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0', + 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09' + ], + [ + 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d', + '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d' + ], + [ + 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d', + 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088' + ], + [ + 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1', + '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d' + ], + [ + '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0', + '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8' + ], + [ + '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047', + '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a' + ], + [ + '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862', + '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453' + ], + [ + '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7', + '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160' + ], + [ + '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd', + '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0' + ], + [ + '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83', + '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6' + ], + [ + '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a', + '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589' + ], + [ + '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8', + 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17' + ], + [ + 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d', + '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda' + ], + [ + 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725', + '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd' + ], + [ + '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754', + '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2' + ], + [ + '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c', + '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6' + ], + [ + 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6', + '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f' + ], + [ + '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39', + 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01' + ], + [ + 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891', + '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3' + ], + [ + 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b', + 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f' + ], + [ + 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03', + '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7' + ], + [ + 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d', + 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78' + ], + [ + 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070', + '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1' + ], + [ + '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4', + 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150' + ], + [ + '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da', + '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82' + ], + [ + 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11', + '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc' + ], + [ + '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e', + 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b' + ], + [ + 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41', + '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51' + ], + [ + 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef', + '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45' + ], + [ + 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8', + 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120' + ], + [ + '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d', + '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84' + ], + [ + '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96', + '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d' + ], + [ + '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd', + 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d' + ], + [ + '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5', + '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8' + ], + [ + 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266', + '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8' + ], + [ + '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71', + '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac' + ], + [ + '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac', + 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f' + ], + [ + '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751', + '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962' + ], + [ + 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e', + '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907' + ], + [ + '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241', + 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec' + ], + [ + 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3', + 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d' + ], + [ + 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f', + '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414' + ], + [ + '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19', + 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd' + ], + [ + '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be', + 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0' + ], + [ + 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9', + '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811' + ], + [ + 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2', + '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1' + ], + [ + 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13', + '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c' + ], + [ + '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c', + 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73' + ], + [ + '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba', + '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd' + ], + [ + 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151', + 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405' + ], + [ + '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073', + 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589' + ], + [ + '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458', + '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e' + ], + [ + '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b', + '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27' + ], + [ + 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366', + 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1' + ], + [ + '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa', + '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482' + ], + [ + '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0', + '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945' + ], + [ + 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787', + '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573' + ], + [ + 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e', + 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82' + ] + ] + }, + 'naf': { + 'wnd': 7, + 'points': [ + [ + 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9', + '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672' + ], + [ + '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4', + 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6' + ], + [ + '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc', + '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da' + ], + [ + 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe', + 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37' + ], + [ + '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb', + 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b' + ], + [ + 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8', + 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81' + ], + [ + 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e', + '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58' + ], + [ + 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34', + '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77' + ], + [ + '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c', + '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a' + ], + [ + '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5', + '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c' + ], + [ + '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f', + '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67' + ], + [ + '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714', + '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402' + ], + [ + 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729', + 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55' + ], + [ + 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db', + '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482' + ], + [ + '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4', + 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82' + ], + [ + '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5', + 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396' + ], + [ + '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479', + '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49' + ], + [ + '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d', + '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf' + ], + [ + '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f', + '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a' + ], + [ + '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb', + 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7' + ], + [ + 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9', + 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933' + ], + [ + '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963', + '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a' + ], + [ + '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74', + '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6' + ], + [ + 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530', + 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37' + ], + [ + '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b', + '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e' + ], + [ + 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247', + 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6' + ], + [ + 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1', + 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476' + ], + [ + '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120', + '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40' + ], + [ + '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435', + '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61' + ], + [ + '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18', + '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683' + ], + [ + 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8', + '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5' + ], + [ + '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb', + '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b' + ], + [ + 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f', + '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417' + ], + [ + '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143', + 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868' + ], + [ + '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba', + 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a' + ], + [ + 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45', + 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6' + ], + [ + '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a', + '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996' + ], + [ + '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e', + 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e' + ], + [ + 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8', + 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d' + ], + [ + '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c', + '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2' + ], + [ + '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519', + 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e' + ], + [ + '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab', + '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437' + ], + [ + '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca', + 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311' + ], + [ + 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf', + '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4' + ], + [ + '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610', + '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575' + ], + [ + '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4', + 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d' + ], + [ + '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c', + 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d' + ], + [ + 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940', + 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629' + ], + [ + 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980', + 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06' + ], + [ + '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3', + '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374' + ], + [ + '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf', + '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee' + ], + [ + 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63', + '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1' + ], + [ + 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448', + 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b' + ], + [ + '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf', + '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661' + ], + [ + '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5', + '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6' + ], + [ + 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6', + '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e' + ], + [ + '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5', + '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d' + ], + [ + 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99', + 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc' + ], + [ + '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51', + 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4' + ], + [ + '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5', + '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c' + ], + [ + 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5', + '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b' + ], + [ + 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997', + '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913' + ], + [ + '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881', + '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154' + ], + [ + '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5', + '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865' + ], + [ + '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66', + 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc' + ], + [ + '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726', + 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224' + ], + [ + '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede', + '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e' + ], + [ + '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94', + '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6' + ], + [ + '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31', + '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511' + ], + [ + '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51', + 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b' + ], + [ + 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252', + 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2' + ], + [ + '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5', + 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c' + ], + [ + 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b', + '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3' + ], + [ + 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4', + '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d' + ], + [ + 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f', + '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700' + ], + [ + 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889', + '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4' + ], + [ + '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246', + 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196' + ], + [ + '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984', + '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4' + ], + [ + '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a', + 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257' + ], + [ + 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030', + 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13' + ], + [ + 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197', + '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096' + ], + [ + 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593', + 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38' + ], + [ + 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef', + '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f' + ], + [ + '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38', + '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448' + ], + [ + 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a', + '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a' + ], + [ + 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111', + '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4' + ], + [ + '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502', + '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437' + ], + [ + '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea', + 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7' + ], + [ + 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26', + '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d' + ], + [ + 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986', + '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a' + ], + [ + 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e', + '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54' + ], + [ + '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4', + '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77' + ], + [ + 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda', + 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517' + ], + [ + '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859', + 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10' + ], + [ + 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f', + 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125' + ], + [ + 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c', + '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e' + ], + [ + '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942', + 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1' + ], + [ + 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a', + '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2' + ], + [ + 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80', + '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423' + ], + [ + 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d', + '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8' + ], + [ + '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1', + 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758' + ], + [ + '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63', + 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375' + ], + [ + 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352', + '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d' + ], + [ + '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193', + 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec' + ], + [ + '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00', + '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0' + ], + [ + '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58', + 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c' + ], + [ + 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7', + 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4' + ], + [ + '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8', + 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f' + ], + [ + '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e', + '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649' + ], + [ + '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d', + 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826' + ], + [ + '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b', + '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5' + ], + [ + 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f', + 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87' + ], + [ + '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6', + '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b' + ], + [ + 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297', + '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc' + ], + [ + '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a', + '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c' + ], + [ + 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c', + 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f' + ], + [ + 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52', + '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a' + ], + [ + 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb', + 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46' + ], + [ + '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065', + 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f' + ], + [ + '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917', + '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03' + ], + [ + '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9', + 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08' + ], + [ + '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3', + '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8' + ], + [ + '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57', + '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373' + ], + [ + '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66', + 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3' + ], + [ + '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8', + '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8' + ], + [ + '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721', + '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1' + ], + [ + '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180', + '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9' + ] + ] + } + } + ] +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/der.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/der.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/index.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/index.js new file mode 100644 index 00000000..a70f571a --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/index.js @@ -0,0 +1,151 @@ +var bn = require('bn.js'); +var elliptic = require('../../elliptic'); +var utils = elliptic.utils; +var assert = utils.assert; + +var KeyPair = require('./key'); +var Signature = require('./signature'); + +function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + + // Shortcut `elliptic.ec(curve-name)` + if (typeof options === 'string') { + assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options); + + options = elliptic.curves[options]; + } + + // Shortcut for `elliptic.ec(elliptic.curves.curveName)` + if (options instanceof elliptic.curves.PresetCurve) + options = { curve: options }; + + this.curve = options.curve.curve; + this.n = this.curve.n; + this.nh = this.n.shrn(1); + this.g = this.curve.g; + + // Point on curve + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + + // Hash for function for DRBG + this.hash = options.hash || options.curve.hash; +} +module.exports = EC; + +EC.prototype.keyPair = function keyPair(priv, pub) { + return new KeyPair(this, priv, pub); +}; + +EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + + // Instantiate Hmac_DRBG + var drbg = new elliptic.hmacDRBG({ + hash: this.hash, + pers: options.pers, + entropy: options.entropy || elliptic.rand(this.hash.hmacStrength), + nonce: this.n.toArray() + }); + + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new bn(2)); + do { + var priv = new bn(drbg.generate(bytes)); + if (priv.cmp(ns2) > 0) + continue; + + priv.iaddn(1); + return this.keyPair(priv); + } while (true); +}; + +EC.prototype._truncateToN = function truncateToN(msg, truncOnly) { + var delta = msg.byteLength() * 8 - this.n.bitLength(); + if (delta > 0) + msg = msg.shrn(delta); + if (!truncOnly && msg.cmp(this.n) >= 0) + return msg.sub(this.n); + else + return msg; +}; + +EC.prototype.sign = function sign(msg, key, options) { + key = this.keyPair(key, 'hex'); + msg = this._truncateToN(new bn(msg, 16)); + if (!options) + options = {}; + + // Zero-extend key to provide enough entropy + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray(); + for (var i = bkey.length; i < 21; i++) + bkey.unshift(0); + + // Zero-extend nonce to have the same byte size as N + var nonce = msg.toArray(); + for (var i = nonce.length; i < bytes; i++) + nonce.unshift(0); + + // Instantiate Hmac_DRBG + var drbg = new elliptic.hmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce: nonce + }); + + // Number of bytes to generate + var ns1 = this.n.sub(new bn(1)); + do { + var k = new bn(drbg.generate(this.n.byteLength())); + k = this._truncateToN(k, true); + if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) + continue; + + var kp = this.g.mul(k); + if (kp.isInfinity()) + continue; + + var r = kp.getX().mod(this.n); + if (r.cmpn(0) === 0) + continue; + + var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)).mod(this.n); + if (s.cmpn(0) === 0) + continue; + + // Use complement of `s`, if it is > `n / 2` + if (options.canonical && s.cmp(this.nh) > 0) + s = this.n.sub(s); + + return new Signature(r, s); + } while (true); +}; + +EC.prototype.verify = function verify(msg, signature, key) { + msg = this._truncateToN(new bn(msg, 16)); + key = this.keyPair(key, 'hex'); + signature = new Signature(signature, 'hex'); + + // Perform primitive values validation + var r = signature.r; + var s = signature.s; + if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) + return false; + if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) + return false; + + // Validate signature + var sinv = s.invm(this.n); + var u1 = sinv.mul(msg).mod(this.n); + var u2 = sinv.mul(r).mod(this.n); + + var p = this.g.mulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + return p.getX().mod(this.n).cmp(r) === 0; +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/key.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/key.js new file mode 100644 index 00000000..396a73a0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/key.js @@ -0,0 +1,144 @@ +var bn = require('bn.js'); + +var elliptic = require('../../elliptic'); +var utils = elliptic.utils; +var assert = utils.assert; + +function KeyPair(ec, priv, pub) { + if (priv instanceof KeyPair) + return priv; + if (pub instanceof KeyPair) + return pub; + + if (!priv) { + priv = pub; + pub = null; + } + if (priv !== null && typeof priv === 'object') { + if (priv.x) { + // KeyPair(public) + pub = priv; + priv = null; + } else if (priv.priv || priv.pub) { + // KeyPair({ priv: ..., pub: ... }) + pub = priv.pub; + priv = priv.priv; + } + } + + this.ec = ec; + this.priv = null; + this.pub = null; + + // KeyPair(public, 'hex') + if (this._importPublicHex(priv, pub)) + return; + + if (pub === 'hex') + pub = null; + + // KeyPair(priv, pub) + if (priv) + this._importPrivate(priv); + if (pub) + this._importPublic(pub); +} +module.exports = KeyPair; + +KeyPair.prototype.validate = function validate() { + var pub = this.getPublic(); + + if (pub.isInfinity()) + return { result: false, reason: 'Invalid public key' }; + if (!pub.validate()) + return { result: false, reason: 'Public key is not a point' }; + if (!pub.mul(this.ec.curve.n).isInfinity()) + return { result: false, reason: 'Public key * N != O' }; + + return { result: true, reason: null }; +}; + +KeyPair.prototype.getPublic = function getPublic(compact, enc) { + if (!this.pub) + this.pub = this.ec.g.mul(this.priv); + + // compact is optional argument + if (typeof compact === 'string') { + enc = compact; + compact = null; + } + + if (!enc) + return this.pub; + + var len = this.ec.curve.p.byteLength(); + var x = this.pub.getX().toArray(); + + for (var i = x.length; i < len; i++) + x.unshift(0); + + if (compact) { + var res = [ this.pub.getY().isEven() ? 0x02 : 0x03 ].concat(x); + } else { + var y = this.pub.getY().toArray(); + for (var i = y.length; i < len; i++) + y.unshift(0); + var res = [ 0x04 ].concat(x, y); + } + return utils.encode(res, enc); +}; + +KeyPair.prototype.getPrivate = function getPrivate(enc) { + if (enc === 'hex') + return this.priv.toString(16, 2); + else + return this.priv; +}; + +KeyPair.prototype._importPrivate = function _importPrivate(key) { + this.priv = new bn(key, 16); + + // Ensure that the priv won't be bigger than n, otherwise we may fail + // in fixed multiplication method + this.priv = this.priv.mod(this.ec.curve.n); +}; + +KeyPair.prototype._importPublic = function _importPublic(key) { + this.pub = this.ec.curve.point(key.x, key.y); +}; + +KeyPair.prototype._importPublicHex = function _importPublic(key, enc) { + key = utils.toArray(key, enc); + var len = this.ec.curve.p.byteLength(); + if (key[0] === 0x04 && key.length - 1 === 2 * len) { + this.pub = this.ec.curve.point( + key.slice(1, 1 + len), + key.slice(1 + len, 1 + 2 * len)); + } else if ((key[0] === 0x02 || key[0] === 0x03) && key.length - 1 === len) { + this.pub = this.ec.curve.pointFromX(key[0] === 0x03, + key.slice(1, 1 +len)); + } else { + return false; + } + + return true; +}; + +// ECDH +KeyPair.prototype.derive = function derive(pub) { + return pub.mul(this.priv).getX(); +}; + +// ECDSA +KeyPair.prototype.sign = function sign(msg) { + return this.ec.sign(msg, this); +}; + +KeyPair.prototype.verify = function verify(msg, signature) { + return this.ec.verify(msg, signature, this); +}; + +KeyPair.prototype.inspect = function inspect() { + return ''; +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/signature.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/signature.js new file mode 100644 index 00000000..a55b802d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/ec/signature.js @@ -0,0 +1,63 @@ +var bn = require('bn.js'); + +var elliptic = require('../../elliptic'); +var utils = elliptic.utils; +var assert = utils.assert; + +function Signature(r, s) { + if (r instanceof Signature) + return r; + + if (this._importDER(r, s)) + return; + + assert(r && s, 'Signature without r or s'); + this.r = new bn(r, 16); + this.s = new bn(s, 16); +} +module.exports = Signature; + +Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + if (data.length < 6 || data[0] !== 0x30 || data[2] !== 0x02) + return false; + var total = data[1]; + if (1 + total > data.length) + return false; + var rlen = data[3]; + // Short length notation + if (rlen >= 0x80) + return false; + if (4 + rlen + 2 >= data.length) + return false; + if (data[4 + rlen] !== 0x02) + return false; + var slen = data[5 + rlen]; + // Short length notation + if (slen >= 0x80) + return false; + if (4 + rlen + 2 + slen > data.length) + return false; + + this.r = new bn(data.slice(4, 4 + rlen)); + this.s = new bn(data.slice(4 + rlen + 2, 4 + rlen + 2 + slen)); + + return true; +}; + +Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + + // Pad values + if (r[0] & 0x80) + r = [ 0 ].concat(r); + // Pad values + if (s[0] & 0x80) + s = [ 0 ].concat(s); + + var total = r.length + s.length + 4; + var res = [ 0x30, total, 0x02, r.length ]; + res = res.concat(r, [ 0x02, s.length ], s); + return utils.encode(res, enc); +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/hmac-drbg.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/hmac-drbg.js new file mode 100644 index 00000000..4b748653 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/hmac-drbg.js @@ -0,0 +1,112 @@ +var hash = require('hash.js'); +var elliptic = require('../elliptic'); +var utils = elliptic.utils; +var assert = utils.assert; + +function HmacDRBG(options) { + if (!(this instanceof HmacDRBG)) + return new HmacDRBG(options); + this.hash = options.hash; + this.predResist = !!options.predResist; + + this.outLen = this.hash.outSize; + this.minEntropy = options.minEntropy || this.hash.hmacStrength; + + this.reseed = null; + this.reseedInterval = null; + this.K = null; + this.V = null; + + var entropy = utils.toArray(options.entropy, options.entropyEnc); + var nonce = utils.toArray(options.nonce, options.nonceEnc); + var pers = utils.toArray(options.pers, options.persEnc); + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + this._init(entropy, nonce, pers); +} +module.exports = HmacDRBG; + +HmacDRBG.prototype._init = function init(entropy, nonce, pers) { + var seed = entropy.concat(nonce).concat(pers); + + this.K = new Array(this.outLen / 8); + this.V = new Array(this.outLen / 8); + for (var i = 0; i < this.V.length; i++) { + this.K[i] = 0x00; + this.V[i] = 0x01; + } + + this._update(seed); + this.reseed = 1; + this.reseedInterval = 0x1000000000000; // 2^48 +}; + +HmacDRBG.prototype._hmac = function hmac() { + return new hash.hmac(this.hash, this.K); +}; + +HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac() + .update(this.V) + .update([ 0x00 ]); + if (seed) + kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) + return; + + this.K = this._hmac() + .update(this.V) + .update([ 0x01 ]) + .update(seed) + .digest(); + this.V = this._hmac().update(this.V).digest(); +}; + +HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + // Optional entropy enc + if (typeof entropyEnc !== 'string') { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + + entropy = utils.toBuffer(entropy, entropyEnc); + add = utils.toBuffer(add, addEnc); + + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + + this._update(entropy.concat(add || [])); + this.reseed = 1; +}; + +HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { + if (this.reseed > this.reseedInterval) + throw new Error('Reseed is required'); + + // Optional encoding + if (typeof enc !== 'string') { + addEnc = add; + add = enc; + enc = null; + } + + // Optional additional data + if (add) { + add = utils.toArray(add, addEnc); + this._update(add); + } + + var temp = []; + while (temp.length < len) { + this.V = this._hmac().update(this.V).digest(); + temp = temp.concat(this.V); + } + + var res = temp.slice(0, len); + this._update(add); + this.reseed++; + return utils.encode(res, enc); +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/utils.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/utils.js new file mode 100644 index 00000000..f8de2d15 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/lib/elliptic/utils.js @@ -0,0 +1,150 @@ +var bn = require('bn.js'); + +var utils = exports; + +utils.assert = function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +}; + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === 'string') { + if (!enc) { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + } + return res; +} +utils.toArray = toArray; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +utils.toHex = toHex; + +utils.encode = function encode(arr, enc) { + if (enc === 'hex') + return toHex(arr); + else + return arr; +}; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +utils.zero2 = zero2; + +// Represent num in a w-NAF form +function getNAF(num, w) { + var naf = []; + var ws = 1 << (w + 1); + var k = num.clone(); + while (k.cmpn(1) >= 0) { + var z; + if (k.isOdd()) { + var mod = k.andln(ws - 1); + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + naf.push(z); + + // Optimization, shift by word if possible + var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1; + for (var i = 1; i < shift; i++) + naf.push(0); + k.ishrn(shift); + } + + return naf; +} +utils.getNAF = getNAF; + +// Represent k1, k2 in a Joint Sparse Form +function getJSF(k1, k2) { + var jsf = [ + [], + [] + ]; + + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + + // First phase + var m14 = (k1.andln(3) + d1) & 3; + var m24 = (k2.andln(3) + d2) & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + var m8 = (k1.andln(7) + d1) & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + var m8 = (k2.andln(7) + d2) & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + + // Second phase + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.ishrn(1); + k2.ishrn(1); + } + + return jsf; +} +utils.getJSF = getJSF; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/.npmignore b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/.npmignore new file mode 100644 index 00000000..1ca95717 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/README.md b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/README.md new file mode 100644 index 00000000..f80437d1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/README.md @@ -0,0 +1,26 @@ +# Brorand + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2014. + +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/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/index.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/index.js new file mode 100644 index 00000000..436f040e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/index.js @@ -0,0 +1,57 @@ +var r; + +module.exports = function rand(len) { + if (!r) + r = new Rand(null); + + return r.generate(len); +}; + +function Rand(rand) { + this.rand = rand; +} +module.exports.Rand = Rand; + +Rand.prototype.generate = function generate(len) { + return this._rand(len); +}; + +if (typeof window === 'object') { + if (window.crypto && window.crypto.getRandomValues) { + // Modern browsers + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + window.crypto.getRandomValues(arr); + return arr; + }; + } else if (window.msCrypto && window.msCrypto.getRandomValues) { + // IE + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + window.msCrypto.getRandomValues(arr); + return arr; + }; + } else { + // Old junk + Rand.prototype._rand = function() { + throw new Error('Not implemented yet'); + }; + } +} else { + // Node.js or Web worker + try { + var crypto = require('cry' + 'pto'); + + Rand.prototype._rand = function _rand(n) { + return crypto.randomBytes(n); + }; + } catch (e) { + // Emulate crypto API using randy + Rand.prototype._rand = function _rand(n) { + var res = new Uint8Array(n); + for (var i = 0; i < res.length; i++) + res[i] = this.rand.getByte(); + return res; + }; + } +} diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/package.json b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/package.json new file mode 100644 index 00000000..99f64349 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/package.json @@ -0,0 +1,54 @@ +{ + "name": "brorand", + "version": "1.0.5", + "description": "Random number generator for browsers and node.js", + "main": "index.js", + "scripts": { + "test": "mocha --reporter=spec test/**/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/brorand" + }, + "keywords": [ + "Random", + "RNG", + "browser", + "crypto" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/brorand/issues" + }, + "homepage": "https://github.com/indutny/brorand", + "devDependencies": { + "mocha": "^2.0.1" + }, + "gitHead": "571027e0ffa1119c720bcdb8aa9c987f63beb5a6", + "_id": "brorand@1.0.5", + "_shasum": "07b54ca30286abd1718a0e2a830803efdc9bfa04", + "_from": "brorand@>=1.0.1 <2.0.0", + "_npmVersion": "2.1.6", + "_nodeVersion": "0.10.33", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "07b54ca30286abd1718a0e2a830803efdc9bfa04", + "tarball": "http://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/test/api-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/test/api-test.js new file mode 100644 index 00000000..b6c876d3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/brorand/test/api-test.js @@ -0,0 +1,8 @@ +var brorand = require('../'); +var assert = require('assert'); + +describe('Brorand', function() { + it('should generate random numbers', function() { + assert.equal(brorand(100).length, 100); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/.npmignore b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/.npmignore new file mode 100644 index 00000000..1ca95717 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/.travis.yml b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/.travis.yml new file mode 100644 index 00000000..92a990f6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.11" +branches: + only: + - master diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/README.md b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/README.md new file mode 100644 index 00000000..63107cbe --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/README.md @@ -0,0 +1,28 @@ +# hash.js [![Build Status](https://secure.travis-ci.org/indutny/hash.js.png)](http://travis-ci.org/indutny/hash.js) + +Just a bike-shed. + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2014. + +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/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js new file mode 100644 index 00000000..f59b6730 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash.js @@ -0,0 +1,15 @@ +var hash = exports; + +hash.utils = require('./hash/utils'); +hash.common = require('./hash/common'); +hash.sha = require('./hash/sha'); +hash.ripemd = require('./hash/ripemd'); +hash.hmac = require('./hash/hmac'); + +// Proxy hash functions to the main object +hash.sha1 = hash.sha.sha1; +hash.sha256 = hash.sha.sha256; +hash.sha224 = hash.sha.sha224; +hash.sha384 = hash.sha.sha384; +hash.sha512 = hash.sha.sha512; +hash.ripemd160 = hash.ripemd.ripemd160; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js new file mode 100644 index 00000000..a052c55f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/common.js @@ -0,0 +1,91 @@ +var hash = require('../hash'); +var utils = hash.utils; +var assert = utils.assert; + +function BlockHash() { + this.pending = null; + this.pendingTotal = 0; + this.blockSize = this.constructor.blockSize; + this.outSize = this.constructor.outSize; + this.hmacStrength = this.constructor.hmacStrength; + this.padLength = this.constructor.padLength / 8; + this.endian = 'big'; + + this._delta8 = this.blockSize / 8; + this._delta32 = this.blockSize / 32; +} +exports.BlockHash = BlockHash; + +BlockHash.prototype.update = function update(msg, enc) { + // Convert message to array, pad it, and join into 32bit blocks + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + + // Enough data, try updating + if (this.pending.length >= this._delta8) { + msg = this.pending; + + // Process pending data in blocks + var r = msg.length % this._delta8; + this.pending = msg.slice(msg.length - r, msg.length); + if (this.pending.length === 0) + this.pending = null; + + msg = utils.join32(msg, 0, msg.length - r, this.endian); + for (var i = 0; i < msg.length; i += this._delta32) + this._update(msg, i, i + this._delta32); + } + + return this; +}; + +BlockHash.prototype.digest = function digest(enc) { + this.update(this._pad()); + assert(this.pending === null); + + return this._digest(enc); +}; + +BlockHash.prototype._pad = function pad() { + var len = this.pendingTotal; + var bytes = this._delta8; + var k = bytes - ((len + this.padLength) % bytes); + var res = new Array(k + this.padLength); + res[0] = 0x80; + for (var i = 1; i < k; i++) + res[i] = 0; + + // Append length + len <<= 3; + if (this.endian === 'big') { + for (var t = 8; t < this.padLength; t++) + res[i++] = 0; + + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = (len >>> 24) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = len & 0xff; + } else { + res[i++] = len & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 24) & 0xff; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + + for (var t = 8; t < this.padLength; t++) + res[i++] = 0; + } + + return res; +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js new file mode 100644 index 00000000..3a3da972 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/hmac.js @@ -0,0 +1,48 @@ +var hmac = exports; + +var hash = require('../hash'); +var utils = hash.utils; +var assert = utils.assert; + +function Hmac(hash, key, enc) { + if (!(this instanceof Hmac)) + return new Hmac(hash, key, enc); + this.Hash = hash; + this.blockSize = hash.blockSize / 8; + this.outSize = hash.outSize / 8; + this.inner = null; + this.outer = null; + + this._init(utils.toArray(key, enc)); +} +module.exports = Hmac; + +Hmac.prototype._init = function init(key) { + // Shorten key, if needed + if (key.length > this.blockSize) + key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); + + // Add padding to key + for (var i = key.length; i < this.blockSize; i++) + key.push(0); + + for (var i = 0; i < key.length; i++) + key[i] ^= 0x36; + this.inner = new this.Hash().update(key); + + // 0x36 ^ 0x5c = 0x6a + for (var i = 0; i < key.length; i++) + key[i] ^= 0x6a; + this.outer = new this.Hash().update(key); +}; + +Hmac.prototype.update = function update(msg, enc) { + this.inner.update(msg, enc); + return this; +}; + +Hmac.prototype.digest = function digest(enc) { + this.outer.update(this.inner.digest()); + return this.outer.digest(enc); +}; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js new file mode 100644 index 00000000..8eb28f49 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/ripemd.js @@ -0,0 +1,144 @@ +var hash = require('../hash'); +var utils = hash.utils; + +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_3 = utils.sum32_3; +var sum32_4 = utils.sum32_4; +var BlockHash = hash.common.BlockHash; + +function RIPEMD160() { + if (!(this instanceof RIPEMD160)) + return new RIPEMD160(); + + BlockHash.call(this); + + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; + this.endian = 'little'; +} +utils.inherits(RIPEMD160, BlockHash); +exports.ripemd160 = RIPEMD160; + +RIPEMD160.blockSize = 512; +RIPEMD160.outSize = 160; +RIPEMD160.hmacStrength = 192; +RIPEMD160.padLength = 64; + +RIPEMD160.prototype._update = function update(msg, start) { + var A = this.h[0]; + var B = this.h[1]; + var C = this.h[2]; + var D = this.h[3]; + var E = this.h[4]; + var Ah = A; + var Bh = B; + var Ch = C; + var Dh = D; + var Eh = E; + for (var j = 0; j < 80; j++) { + var T = sum32( + rotl32( + sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), + s[j]), + E); + A = E; + E = D; + D = rotl32(C, 10); + C = B; + B = T; + T = sum32( + rotl32( + sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), + sh[j]), + Eh); + Ah = Eh; + Eh = Dh; + Dh = rotl32(Ch, 10); + Ch = Bh; + Bh = T; + } + T = sum32_3(this.h[1], C, Dh); + this.h[1] = sum32_3(this.h[2], D, Eh); + this.h[2] = sum32_3(this.h[3], E, Ah); + this.h[3] = sum32_3(this.h[4], A, Bh); + this.h[4] = sum32_3(this.h[0], B, Ch); + this.h[0] = T; +}; + +RIPEMD160.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'little'); + else + return utils.split32(this.h, 'little'); +}; + +function f(j, x, y, z) { + if (j <= 15) + return x ^ y ^ z; + else if (j <= 31) + return (x & y) | ((~x) & z); + else if (j <= 47) + return (x | (~y)) ^ z; + else if (j <= 63) + return (x & z) | (y & (~z)); + else + return x ^ (y | (~z)); +} + +function K(j) { + if (j <= 15) + return 0x00000000; + else if (j <= 31) + return 0x5a827999; + else if (j <= 47) + return 0x6ed9eba1; + else if (j <= 63) + return 0x8f1bbcdc; + else + return 0xa953fd4e; +} + +function Kh(j) { + if (j <= 15) + return 0x50a28be6; + else if (j <= 31) + return 0x5c4dd124; + else if (j <= 47) + return 0x6d703ef3; + else if (j <= 63) + return 0x7a6d76e9; + else + return 0x00000000; +} + +var r = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, +]; + +var rh = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +]; + +var s = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6, +]; + +var sh = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +]; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js new file mode 100644 index 00000000..a7837aad --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/sha.js @@ -0,0 +1,564 @@ +var hash = require('../hash'); +var utils = hash.utils; +var assert = utils.assert; + +var rotr32 = utils.rotr32; +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_4 = utils.sum32_4; +var sum32_5 = utils.sum32_5; +var rotr64_hi = utils.rotr64_hi; +var rotr64_lo = utils.rotr64_lo; +var shr64_hi = utils.shr64_hi; +var shr64_lo = utils.shr64_lo; +var sum64 = utils.sum64; +var sum64_hi = utils.sum64_hi; +var sum64_lo = utils.sum64_lo; +var sum64_4_hi = utils.sum64_4_hi; +var sum64_4_lo = utils.sum64_4_lo; +var sum64_5_hi = utils.sum64_5_hi; +var sum64_5_lo = utils.sum64_5_lo; +var BlockHash = hash.common.BlockHash; + +var sha256_K = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]; + +var sha512_K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; + +var sha1_K = [ + 0x5A827999, 0x6ED9EBA1, + 0x8F1BBCDC, 0xCA62C1D6 +]; + +function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + + BlockHash.call(this); + this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ]; + this.k = sha256_K; + this.W = new Array(64); +} +utils.inherits(SHA256, BlockHash); +exports.sha256 = SHA256; + +SHA256.blockSize = 512; +SHA256.outSize = 256; +SHA256.hmacStrength = 192; +SHA256.padLength = 64; + +SHA256.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + for (; i < W.length; i++) + W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + var f = this.h[5]; + var g = this.h[6]; + var h = this.h[7]; + + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i++) { + var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); + var T2 = sum32(s0_256(a), maj32(a, b, c)); + h = g; + g = f; + f = e; + e = sum32(d, T1); + d = c; + c = b; + b = a; + a = sum32(T1, T2); + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); + this.h[5] = sum32(this.h[5], f); + this.h[6] = sum32(this.h[6], g); + this.h[7] = sum32(this.h[7], h); +}; + +SHA256.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); + + SHA256.call(this); + this.h = [ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; +} +utils.inherits(SHA224, SHA256); +exports.sha224 = SHA224; + +SHA224.blockSize = 512; +SHA224.outSize = 224; +SHA224.hmacStrength = 192; +SHA224.padLength = 64; + +SHA224.prototype._digest = function digest(enc) { + // Just truncate output + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 7), 'big'); + else + return utils.split32(this.h.slice(0, 7), 'big'); +}; + +function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + + BlockHash.call(this); + this.h = [ 0x6a09e667, 0xf3bcc908, + 0xbb67ae85, 0x84caa73b, + 0x3c6ef372, 0xfe94f82b, + 0xa54ff53a, 0x5f1d36f1, + 0x510e527f, 0xade682d1, + 0x9b05688c, 0x2b3e6c1f, + 0x1f83d9ab, 0xfb41bd6b, + 0x5be0cd19, 0x137e2179 ]; + this.k = sha512_K; + this.W = new Array(160); +} +utils.inherits(SHA512, BlockHash); +exports.sha512 = SHA512; + +SHA512.blockSize = 1024; +SHA512.outSize = 512; +SHA512.hmacStrength = 192; +SHA512.padLength = 128; + +SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { + var W = this.W; + + // 32 x 32bit words + for (var i = 0; i < 32; i++) + W[i] = msg[start + i]; + for (; i < W.length; i += 2) { + var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; // i - 7 + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; // i - 16 + var c3_lo = W[i - 31]; + + W[i] = sum64_4_hi(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + W[i + 1] = sum64_4_lo(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + } +}; + +SHA512.prototype._update = function _update(msg, start) { + this._prepareBlock(msg, start); + + var W = this.W; + + var ah = this.h[0]; + var al = this.h[1]; + var bh = this.h[2]; + var bl = this.h[3]; + var ch = this.h[4]; + var cl = this.h[5]; + var dh = this.h[6]; + var dl = this.h[7]; + var eh = this.h[8]; + var el = this.h[9]; + var fh = this.h[10]; + var fl = this.h[11]; + var gh = this.h[12]; + var gl = this.h[13]; + var hh = this.h[14]; + var hl = this.h[15]; + + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i += 2) { + var c0_hi = hh; + var c0_lo = hl; + var c1_hi = s1_512_hi(eh, el); + var c1_lo = s1_512_lo(eh, el); + var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); + var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); + var c3_hi = this.k[i]; + var c3_lo = this.k[i + 1]; + var c4_hi = W[i]; + var c4_lo = W[i + 1]; + + var T1_hi = sum64_5_hi(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + var T1_lo = sum64_5_lo(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + + var c0_hi = s0_512_hi(ah, al); + var c0_lo = s0_512_lo(ah, al); + var c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); + var c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); + + var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); + var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); + + hh = gh; + hl = gl; + + gh = fh; + gl = fl; + + fh = eh; + fl = el; + + eh = sum64_hi(dh, dl, T1_hi, T1_lo); + el = sum64_lo(dl, dl, T1_hi, T1_lo); + + dh = ch; + dl = cl; + + ch = bh; + cl = bl; + + bh = ah; + bl = al; + + ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); + al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); + } + + sum64(this.h, 0, ah, al); + sum64(this.h, 2, bh, bl); + sum64(this.h, 4, ch, cl); + sum64(this.h, 6, dh, dl); + sum64(this.h, 8, eh, el); + sum64(this.h, 10, fh, fl); + sum64(this.h, 12, gh, gl); + sum64(this.h, 14, hh, hl); +}; + +SHA512.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); + + SHA512.call(this); + this.h = [ 0xcbbb9d5d, 0xc1059ed8, + 0x629a292a, 0x367cd507, + 0x9159015a, 0x3070dd17, + 0x152fecd8, 0xf70e5939, + 0x67332667, 0xffc00b31, + 0x8eb44a87, 0x68581511, + 0xdb0c2e0d, 0x64f98fa7, + 0x47b5481d, 0xbefa4fa4 ]; +} +utils.inherits(SHA384, SHA512); +exports.sha384 = SHA384; + +SHA384.blockSize = 1024; +SHA384.outSize = 384; +SHA384.hmacStrength = 192; +SHA384.padLength = 128; + +SHA384.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 12), 'big'); + else + return utils.split32(this.h.slice(0, 12), 'big'); +}; + +function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + + BlockHash.call(this); + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, + 0x10325476, 0xc3d2e1f0 ]; + this.W = new Array(80); +} + +utils.inherits(SHA1, BlockHash); +exports.sha1 = SHA1; + +SHA1.blockSize = 512; +SHA1.outSize = 160; +SHA1.hmacStrength = 80; +SHA1.padLength = 64; + +SHA1.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + + for(; i < W.length; i++) + W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + + for (var i = 0; i < W.length; i++) { + var s = ~~(i / 20); + var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); + e = d; + d = c; + c = rotl32(b, 30); + b = a; + a = t; + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); +}; + +SHA1.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function ch32(x, y, z) { + return (x & y) ^ ((~x) & z); +} + +function maj32(x, y, z) { + return (x & y) ^ (x & z) ^ (y & z); +} + +function p32(x, y, z) { + return x ^ y ^ z; +} + +function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); +} + +function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); +} + +function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); +} + +function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); +} + +function ft_1(s, x, y, z) { + if (s === 0) + return ch32(x, y, z); + if (s === 1 || s === 3) + return p32(x, y, z); + if (s === 2) + return maj32(x, y, z); +} + +function ch64_hi(xh, xl, yh, yl, zh, zl) { + var r = (xh & yh) ^ ((~xh) & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ ((~xl) & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_hi(xh, xl, yh, yl, zh, zl) { + var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); // 34 + var c2_hi = rotr64_hi(xl, xh, 7); // 39 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); // 34 + var c2_lo = rotr64_lo(xl, xh, 7); // 39 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 14); + var c1_hi = rotr64_hi(xh, xl, 18); + var c2_hi = rotr64_hi(xl, xh, 9); // 41 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 14); + var c1_lo = rotr64_lo(xh, xl, 18); + var c2_lo = rotr64_lo(xl, xh, 9); // 41 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 1); + var c1_hi = rotr64_hi(xh, xl, 8); + var c2_hi = shr64_hi(xh, xl, 7); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 1); + var c1_lo = rotr64_lo(xh, xl, 8); + var c2_lo = shr64_lo(xh, xl, 7); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); // 61 + var c2_hi = shr64_hi(xh, xl, 6); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); // 61 + var c2_lo = shr64_lo(xh, xl, 6); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js new file mode 100644 index 00000000..00ed5fb4 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/lib/hash/utils.js @@ -0,0 +1,257 @@ +var utils = exports; +var inherits = require('inherits'); + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === 'string') { + if (!enc) { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + } + return res; +} +utils.toArray = toArray; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +utils.toHex = toHex; + +function htonl(w) { + var res = (w >>> 24) | + ((w >>> 8) & 0xff00) | + ((w << 8) & 0xff0000) | + ((w & 0xff) << 24); + return res >>> 0; +} +utils.htonl = htonl; + +function toHex32(msg, endian) { + var res = ''; + for (var i = 0; i < msg.length; i++) { + var w = msg[i]; + if (endian === 'little') + w = htonl(w); + res += zero8(w.toString(16)); + } + return res; +} +utils.toHex32 = toHex32; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +utils.zero2 = zero2; + +function zero8(word) { + if (word.length === 7) + return '0' + word; + else if (word.length === 6) + return '00' + word; + else if (word.length === 5) + return '000' + word; + else if (word.length === 4) + return '0000' + word; + else if (word.length === 3) + return '00000' + word; + else if (word.length === 2) + return '000000' + word; + else if (word.length === 1) + return '0000000' + word; + else + return word; +} +utils.zero8 = zero8; + +function join32(msg, start, end, endian) { + var len = end - start; + assert(len % 4 === 0); + var res = new Array(len / 4); + for (var i = 0, k = start; i < res.length; i++, k += 4) { + var w; + if (endian === 'big') + w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; + else + w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; + res[i] = w >>> 0; + } + return res; +} +utils.join32 = join32; + +function split32(msg, endian) { + var res = new Array(msg.length * 4); + for (var i = 0, k = 0; i < msg.length; i++, k += 4) { + var m = msg[i]; + if (endian === 'big') { + res[k] = m >>> 24; + res[k + 1] = (m >>> 16) & 0xff; + res[k + 2] = (m >>> 8) & 0xff; + res[k + 3] = m & 0xff; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = (m >>> 16) & 0xff; + res[k + 1] = (m >>> 8) & 0xff; + res[k] = m & 0xff; + } + } + return res; +} +utils.split32 = split32; + +function rotr32(w, b) { + return (w >>> b) | (w << (32 - b)); +} +utils.rotr32 = rotr32; + +function rotl32(w, b) { + return (w << b) | (w >>> (32 - b)); +} +utils.rotl32 = rotl32; + +function sum32(a, b) { + return (a + b) >>> 0; +} +utils.sum32 = sum32; + +function sum32_3(a, b, c) { + return (a + b + c) >>> 0; +} +utils.sum32_3 = sum32_3; + +function sum32_4(a, b, c, d) { + return (a + b + c + d) >>> 0; +} +utils.sum32_4 = sum32_4; + +function sum32_5(a, b, c, d, e) { + return (a + b + c + d + e) >>> 0; +} +utils.sum32_5 = sum32_5; + +function assert(cond, msg) { + if (!cond) + throw new Error(msg || 'Assertion failed'); +} +utils.assert = assert; + +utils.inherits = inherits; + +function sum64(buf, pos, ah, al) { + var bh = buf[pos]; + var bl = buf[pos + 1]; + + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + buf[pos] = hi >>> 0; + buf[pos + 1] = lo; +} +exports.sum64 = sum64; + +function sum64_hi(ah, al, bh, bl) { + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + return hi >>> 0; +}; +exports.sum64_hi = sum64_hi; + +function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; +}; +exports.sum64_lo = sum64_lo; + +function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + + var hi = ah + bh + ch + dh + carry; + return hi >>> 0; +}; +exports.sum64_4_hi = sum64_4_hi; + +function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { + var lo = al + bl + cl + dl; + return lo >>> 0; +}; +exports.sum64_4_lo = sum64_4_lo; + +function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + lo = (lo + el) >>> 0; + carry += lo < el ? 1 : 0; + + var hi = ah + bh + ch + dh + eh + carry; + return hi >>> 0; +}; +exports.sum64_5_hi = sum64_5_hi; + +function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var lo = al + bl + cl + dl + el; + + return lo >>> 0; +}; +exports.sum64_5_lo = sum64_5_lo; + +function rotr64_hi(ah, al, num) { + var r = (al << (32 - num)) | (ah >>> num); + return r >>> 0; +}; +exports.rotr64_hi = rotr64_hi; + +function rotr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +}; +exports.rotr64_lo = rotr64_lo; + +function shr64_hi(ah, al, num) { + return ah >>> num; +}; +exports.shr64_hi = shr64_hi; + +function shr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +}; +exports.shr64_lo = shr64_lo; diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/package.json b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/package.json new file mode 100644 index 00000000..6e50268d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/package.json @@ -0,0 +1,56 @@ +{ + "name": "hash.js", + "version": "1.0.2", + "description": "Various hash functions that could be run by both browser and node", + "main": "lib/hash.js", + "scripts": { + "test": "mocha --reporter=spec test/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/hash.js" + }, + "keywords": [ + "hash", + "sha256", + "sha224", + "hmac" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/hash.js/issues" + }, + "homepage": "https://github.com/indutny/hash.js", + "dependencies": { + "inherits": "^2.0.1" + }, + "devDependencies": { + "mocha": "^1.18.2" + }, + "gitHead": "9a85e099dbf05531e1c3956c7f205405f6bfc13c", + "_id": "hash.js@1.0.2", + "_shasum": "bc7d601f4e0d05a32f3526d11fe39f7a5eb8c187", + "_from": "hash.js@>=1.0.0 <2.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "bc7d601f4e0d05a32f3526d11fe39f7a5eb8c187", + "tarball": "http://registry.npmjs.org/hash.js/-/hash.js-1.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/test/hash-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/test/hash-test.js new file mode 100644 index 00000000..97347a27 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/test/hash-test.js @@ -0,0 +1,119 @@ +var assert = require('assert'); +var hash = require('../'); + +describe('Hash', function() { + function test(fn, cases) { + for (var i = 0; i < cases.length; i++) { + var msg = cases[i][0]; + var res = cases[i][1]; + var enc = cases[i][2]; + + var dgst = fn().update(msg, enc).digest('hex'); + assert.equal(dgst, res); + + // Split message + var dgst = fn().update(msg.slice(0, 2), enc) + .update(msg.slice(2), enc) + .digest('hex'); + assert.equal(dgst, res); + } + } + + it('should support sha256', function() { + assert.equal(hash.sha256.blockSize, 512); + assert.equal(hash.sha256.outSize, 256); + + test(hash.sha256, [ + [ 'abc', + 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' ], + [ 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', + '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1' ], + [ 'deadbeef', + '5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953', + 'hex' ], + ]); + }); + + it('should support sha224', function() { + assert.equal(hash.sha224.blockSize, 512); + assert.equal(hash.sha224.outSize, 224); + + test(hash.sha224, [ + [ 'abc', + '23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7' ], + [ 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', + '75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525' ], + [ 'deadbeef', + '55b9eee5f60cc362ddc07676f620372611e22272f60fdbec94f243f8', + 'hex' ], + ]); + }); + + it('should support ripemd160', function() { + assert.equal(hash.ripemd160.blockSize, 512); + assert.equal(hash.ripemd160.outSize, 160); + + test(hash.ripemd160, [ + [ '', '9c1185a5c5e9fc54612808977ee8f548b2258d31'], + [ 'abc', + '8eb208f7e05d987a9b044a8e98c6b087f15a0bfc' ], + [ 'message digest', + '5d0689ef49d2fae572b881b123a85ffa21595f36' ], + [ 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', + '12a053384a9c0c88e405a06c27dcf49ada62eb2b' ], + [ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', + 'b0e20b6e3116640286ed3a87a5713079b21f5189' ], + ]); + }); + + it('should support sha1', function() { + assert.equal(hash.sha1.blockSize, 512); + assert.equal(hash.sha1.outSize, 160); + + test(hash.sha1, [ + [ '', + 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ], + [ 'abc', + 'a9993e364706816aba3e25717850c26c9cd0d89d' ], + [ 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', + '84983e441c3bd26ebaae4aa1f95129e5e54670f1' ], + [ 'deadbeef', + 'd78f8bb992a56a597f6c7a1fb918bb78271367eb', + 'hex' ], + ]); + }); + + it('should support sha512', function() { + assert.equal(hash.sha512.blockSize, 1024); + assert.equal(hash.sha512.outSize, 512); + + test(hash.sha512, [ + [ 'abc', + 'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a' + + '2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f' + ], + [ 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn' + + 'hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', + '8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018' + + '501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909' + ] + ]); + }); + + it('should support sha384', function() { + assert.equal(hash.sha384.blockSize, 1024); + assert.equal(hash.sha384.outSize, 384); + + test(hash.sha384, [ + [ 'abc', + 'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed' + + '8086072ba1e7cc2358baeca134c825a7' + ], + [ 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn' + + 'hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', + '09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712' + + 'fcc7c71a557e2db966c3e9fa91746039' + ] + ]); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/test/hmac-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/test/hmac-test.js new file mode 100644 index 00000000..0a9647ee --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/node_modules/hash.js/test/hmac-test.js @@ -0,0 +1,59 @@ +var assert = require('assert'); +var hash = require('../'); +var utils = hash.utils; + +describe('Hmac', function() { + describe('mixed test vector', function() { + test({ + name: 'nist 1', + key: '00010203 04050607 08090A0B 0C0D0E0F' + + '10111213 14151617 18191A1B 1C1D1E1F 20212223 24252627' + + '28292A2B 2C2D2E2F 30313233 34353637 38393A3B 3C3D3E3F', + msg: 'Sample message for keylen=blocklen', + res: '8bb9a1db9806f20df7f77b82138c7914d174d59e13dc4d0169c9057b133e1d62' + }); + test({ + name: 'nist 2', + key: '00010203 04050607' + + '08090A0B 0C0D0E0F 10111213 14151617 18191A1B 1C1D1E1F', + msg: 'Sample message for keylen=1.0.0 <2.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "d180376b66a17d74995c837796362ac4d22aefe3", + "tarball": "http://registry.npmjs.org/elliptic/-/elliptic-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/api-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/api-test.js new file mode 100644 index 00000000..855b32ea --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/api-test.js @@ -0,0 +1,17 @@ +var assert = require('assert'); +var elliptic = require('../'); + +describe('EC API', function() { + it('should instantiate with valid curve (secp256k1)', function() { + var ec = new elliptic.ec('secp256k1'); + + assert(ec); + assert(typeof(ec) == "object"); + }); + + it('should throw error with invalid curve', function() { + assert.throws(function(){ + var ec = new elliptic.ec('nonexistent-curve'); + }, Error); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/curve-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/curve-test.js new file mode 100644 index 00000000..401494be --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/curve-test.js @@ -0,0 +1,145 @@ +var assert = require('assert'); +var bn = require('bn.js'); +var elliptic = require('../'); + +describe('Curve', function() { + it('should work with example curve', function() { + var curve = new elliptic.curve.short({ + p: '1d', + a: '4', + b: '14' + }); + + var p = curve.point('18', '16'); + assert(p.validate()); + assert(p.dbl().validate()); + assert(p.dbl().add(p).validate()); + assert(p.dbl().add(p.dbl()).validate()); + assert(p.dbl().add(p.dbl()).eq(p.add(p).add(p).add(p))); + }); + + it('should work with secp112k1', function() { + var curve = new elliptic.curve.short({ + p: 'db7c 2abf62e3 5e668076 bead208b', + a: 'db7c 2abf62e3 5e668076 bead2088', + b: '659e f8ba0439 16eede89 11702b22' + }); + + var p = curve.point( + '0948 7239995a 5ee76b55 f9c2f098', + 'a89c e5af8724 c0a23e0e 0ff77500'); + assert(p.validate()); + assert(p.dbl().validate()); + }); + + it('should work with secp256k1', function() { + var curve = new elliptic.curve.short({ + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ' + + 'fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe ' + + 'baaedce6 af48a03b bfd25e8c d0364141', + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8' + ] + }); + + var p = curve.point( + '79be667e f9dcbbac 55a06295 ce870b07 029bfcdb 2dce28d9 59f2815b 16f81798', + '483ada77 26a3c465 5da4fbfc 0e1108a8 fd17b448 a6855419 9c47d08f fb10d4b8' + ); + assert(p.validate()); + assert(p.dbl().validate()); + assert(p.toJ().dbl().toP().validate()); + assert(p.mul(new bn('79be667e f9dcbbac 55a06295 ce870b07', 16)).validate()); + + var j = p.toJ(); + assert(j.trpl().eq(j.dbl().add(j))); + + // Endomorphism test + assert(curve.endo); + assert.equal( + curve.endo.beta.fromRed().toString(16), + '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'); + assert.equal( + curve.endo.lambda.toString(16), + '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72'); + + var k = new bn('1234567890123456789012345678901234', 16); + var split = curve._endoSplit(k); + assert.equal( + split.k1.add(split.k2.mul(curve.endo.lambda)).mod(curve.n).toString(16), + k.toString(16)); + }); + + it('should compute this problematic secp256k1 multiplication', function() { + var curve = elliptic.curves.secp256k1.curve; + var g1 = curve.g; // precomputed g + assert(g1.precomputed); + var g2 = curve.point(g1.getX(), g1.getY()); // not precomputed g + assert(!g2.precomputed); + var a = new bn('6d1229a6b24c2e775c062870ad26bc261051e0198c67203167273c7c62538846', 16); + var p1 = g1.mul(a); + var p2 = g2.mul(a); + assert(p1.eq(p2)); + }); + + it('should not fail on secp256k1 regression', function() { + var curve = elliptic.curves.secp256k1.curve; + var k1 = new bn('32efeba414cd0c830aed727749e816a01c471831536fd2fce28c56b54f5a3bb1', 16); + var k2 = new bn('5f2e49b5d64e53f9811545434706cde4de528af97bfd49fde1f6cf792ee37a8c', 16); + + var p1 = curve.g.mul(k1); + var p2 = curve.g.mul(k2); + + // 2 + 2 + 1 = 2 + 1 + 2 + var two = p2.dbl(); + var five = two.dbl().add(p2); + var three = two.add(p2); + var maybeFive = three.add(two); + + assert(maybeFive.eq(five)); + + p1 = p1.mul(k2); + p2 = p2.mul(k1); + + assert(p1.validate()); + assert(p2.validate()); + assert(p1.eq(p2)); + }); + + it('should correctly double the affine point on secp256k1', function() { + var bad = { + x: '026a2073b1ef6fab47ace18e60e728a05180a82755bbcec9a0abc08ad9f7a3d4', + y: '9cd8cb48c3281596139f147c1364a3ede88d3f310fdb0eb98c924e599ca1b3c9', + z: 'd78587ad45e4102f48b54b5d85598296e069ce6085002e169c6bad78ddc6d9bd' + }; + + var good = { + x: 'e7789226739ac2eb3c7ccb2a9a910066beeed86cdb4e0f8a7fee8eeb29dc7016', + y: '4b76b191fd6d47d07828ea965e275b76d0e3e0196cd5056d38384fbb819f9fcb', + z: 'cbf8d99056618ba132d6145b904eee1ce566e0feedb9595139c45f84e90cfa7d' + }; + + var curve = elliptic.curves.secp256k1.curve; + bad = curve.jpoint(bad.x, bad.y, bad.z); + good = curve.jpoint(good.x, good.y, good.z); + + // They are the same points + assert(bad.add(good.neg()).isInfinity()); + + // But doubling borks them out + assert(bad.dbl().add(good.dbl().neg()).isInfinity()); + }); + + it('should store precomputed values correctly on negation', function() { + var curve = elliptic.curves.secp256k1.curve; + var p = curve.g.mul('2'); + p.precompute(); + var neg = p.neg(true); + var neg2 = neg.neg(true); + assert(p.eq(neg2)); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/ecdh-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/ecdh-test.js new file mode 100644 index 00000000..13d1a9ad --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/ecdh-test.js @@ -0,0 +1,21 @@ +var assert = require('assert'); +var elliptic = require('../'); +var hash = require('hash.js'); + +describe('ECDH', function() { + function test(name) { + it('should work with ' + name + ' curve', function() { + var ecdh = new elliptic.ec(name); + var s1 = ecdh.genKeyPair(); + var s2 = ecdh.genKeyPair(); + var sh1 = s1.derive(s2.getPublic()); + var sh2 = s2.derive(s1.getPublic()); + + assert.equal(sh1.toString(16), sh2.toString(16)); + }); + } + + test('curve25519'); + test('ed25519'); + test('secp256k1'); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/ecdsa-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/ecdsa-test.js new file mode 100644 index 00000000..71c36cd0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/ecdsa-test.js @@ -0,0 +1,210 @@ +var assert = require('assert'); +var elliptic = require('../'); +var hash = require('hash.js'); + +describe('ECDSA', function() { + function test(name) { + it('should work with ' + name + ' curve', function() { + var curve = elliptic.curves[name]; + assert(curve); + + var ecdsa = new elliptic.ec(curve); + var keys = ecdsa.genKeyPair({ + entropy: [ + 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 + ] + }); + var msg = 'deadbeef'; + + // Get keys out of pair + assert(keys.getPublic().x && keys.getPublic().y); + assert(keys.getPrivate().length > 0); + assert.equal(keys.getPrivate('hex').length, 64); + assert(keys.getPublic('hex').length > 0); + assert(keys.getPrivate('hex').length > 0); + assert(keys.validate().result); + + // Sign and verify + var signature = ecdsa.sign(msg, keys); + assert(ecdsa.verify(msg, signature, keys), 'Normal verify'); + + // Sign and verify on key + var signature = keys.sign(msg); + assert(keys.verify(msg, signature), 'On-key verify'); + + // Load private key from hex + var keys = ecdsa.keyPair(keys.getPrivate('hex'), 'hex'); + var signature = ecdsa.sign(msg, keys); + assert(ecdsa.verify(msg, signature, keys), 'hex-private verify'); + + // Load public key from compact hex + var keys = ecdsa.keyPair(keys.getPublic(true, 'hex'), 'hex'); + + // Load public key from hex + var keys = ecdsa.keyPair(keys.getPublic('hex'), 'hex'); + + // DER encoding + var dsign = signature.toDER('hex'); + assert(ecdsa.verify(msg, dsign, keys), 'hex-DER encoded verify'); + var dsign = signature.toDER(); + assert(ecdsa.verify(msg, dsign, keys), 'DER encoded verify'); + + // Wrong public key + var keys = ecdsa.genKeyPair(); + assert(!ecdsa.verify(msg, signature, keys), 'Wrong key verify'); + + // Invalid private key + var keys = ecdsa.keyPair(keys.getPrivate('hex') + keys.getPrivate('hex'), + 'hex'); + assert(!ecdsa.verify(msg, signature, keys), 'Wrong key verify'); + }); + } + test('secp256k1'); + test('ed25519'); + + describe('RFC6979 vector', function() { + function test(opt) { + opt.cases.forEach(function(c) { + var ecdsa = elliptic.ec({ + curve: opt.curve, + hash: c.hash + }); + var descr = 'should not fail on "' + opt.name + '" ' + + 'and hash ' + c.hash.name + ' on "' + c.message + '"'; + it(descr, function() { + var dgst = c.hash().update(c.message).digest(); + var sign = ecdsa.sign(dgst, opt.key); + assert.equal(sign.r.toString(16), c.r); + assert.equal(sign.s.toString(16), c.s); + assert.ok(ecdsa.keyPair(opt.pub).validate().result, + 'Invalid public key'); + assert.ok(ecdsa.verify(dgst, sign, opt.pub), + 'Invalid signature'); + }); + }); + } + + test({ + name: 'ECDSA, 192 Bits (Prime Field)', + curve: elliptic.curves.p192, + key: '6fab034934e4c0fc9ae67f5b5659a9d7d1fefd187ee09fd4', + pub: { + x: 'ac2c77f529f91689fea0ea5efec7f210d8eea0b9e047ed56', + y: '3bc723e57670bd4887ebc732c523063d0a7c957bc97c1c43' + }, + cases: [ + { + message: 'sample', + hash: hash.sha224, + r: 'a1f00dad97aeec91c95585f36200c65f3c01812aa60378f5', + s: 'e07ec1304c7c6c9debbe980b9692668f81d4de7922a0f97a' + }, + { + message: 'sample', + hash: hash.sha256, + r: '4b0b8ce98a92866a2820e20aa6b75b56382e0f9bfd5ecb55', + s: 'ccdb006926ea9565cbadc840829d8c384e06de1f1e381b85' + }, + { + message: 'test', + hash: hash.sha224, + r: '6945a1c1d1b2206b8145548f633bb61cef04891baf26ed34', + s: 'b7fb7fdfc339c0b9bd61a9f5a8eaf9be58fc5cba2cb15293' + }, + { + message: 'test', + hash: hash.sha256, + r: '3a718bd8b4926c3b52ee6bbe67ef79b18cb6eb62b1ad97ae', + s: '5662e6848a4a19b1f1ae2f72acd4b8bbe50f1eac65d9124f' + } + ], + }); + + test({ + name: 'ECDSA, 224 Bits (Prime Field)', + curve: elliptic.curves.p224, + key: 'f220266e1105bfe3083e03ec7a3a654651f45e37167e88600bf257c1', + pub: { + x: '00cf08da5ad719e42707fa431292dea11244d64fc51610d94b130d6c', + y: 'eeab6f3debe455e3dbf85416f7030cbd94f34f2d6f232c69f3c1385a' + }, + cases: [ + { + message: 'sample', + hash: hash.sha224, + r: '1cdfe6662dde1e4a1ec4cdedf6a1f5a2fb7fbd9145c12113e6abfd3e', + s: 'a6694fd7718a21053f225d3f46197ca699d45006c06f871808f43ebc' + }, + { + message: 'sample', + hash: hash.sha256, + r: '61aa3da010e8e8406c656bc477a7a7189895e7e840cdfe8ff42307ba', + s: 'bc814050dab5d23770879494f9e0a680dc1af7161991bde692b10101' + }, + { + message: 'test', + hash: hash.sha224, + r: 'c441ce8e261ded634e4cf84910e4c5d1d22c5cf3b732bb204dbef019', + s: '902f42847a63bdc5f6046ada114953120f99442d76510150f372a3f4' + }, + { + message: 'test', + hash: hash.sha256, + r: 'ad04dde87b84747a243a631ea47a1ba6d1faa059149ad2440de6fba6', + s: '178d49b1ae90e3d8b629be3db5683915f4e8c99fdf6e666cf37adcfd' + } + ], + }); + + test({ + name: 'ECDSA, 256 Bits (Prime Field)', + curve: elliptic.curves.p256, + key: 'c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721', + pub: { + x: '60fed4ba255a9d31c961eb74c6356d68c049b8923b61fa6ce669622e60f29fb6', + y: '7903fe1008b8bc99a41ae9e95628bc64f2f1b20c2d7e9f5177a3c294d4462299' + }, + cases: [ + { + message: 'sample', + hash: hash.sha224, + r: '53b2fff5d1752b2c689df257c04c40a587fababb3f6fc2702f1343af7ca9aa3f', + s: 'b9afb64fdc03dc1a131c7d2386d11e349f070aa432a4acc918bea988bf75c74c' + }, + { + message: 'sample', + hash: hash.sha256, + r: 'efd48b2aacb6a8fd1140dd9cd45e81d69d2c877b56aaf991c34d0ea84eaf3716', + s: 'f7cb1c942d657c41d436c7a1b6e29f65f3e900dbb9aff4064dc4ab2f843acda8' + }, + { + message: 'test', + hash: hash.sha224, + r: 'c37edb6f0ae79d47c3c27e962fa269bb4f441770357e114ee511f662ec34a692', + s: 'c820053a05791e521fcaad6042d40aea1d6b1a540138558f47d0719800e18f2d' + }, + { + message: 'test', + hash: hash.sha256, + r: 'f1abb023518351cd71d881567b1ea663ed3efcf6c5132b354f28d3b0b7d38367', + s: '19f4113742a2b14bd25926b49c649155f267e60d3814b4c0cc84250e46f0083' + } + ], + }); + }); + + it('should deterministically generate private key', function() { + var curve = elliptic.curves.secp256k1; + assert(curve); + + var ecdsa = new elliptic.ec(curve); + var keys = ecdsa.genKeyPair({ + pers: 'my.pers.string', + entropy: hash.sha256().update('hello world').digest() + }); + assert.equal( + keys.getPrivate('hex'), + '6160edb2b218b7f1394b9ca8eb65a72831032a1f2f3dc2d99291c2f7950ed887'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/hmac-drbg-test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/hmac-drbg-test.js new file mode 100644 index 00000000..23f56992 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/node_modules/elliptic/test/hmac-drbg-test.js @@ -0,0 +1,344 @@ +var assert = require('assert'); +var elliptic = require('../'); +var utils = elliptic.utils; +var hash = require('hash.js'); + +describe('Hmac_DRBG', function() { + it('should support hmac-drbg-sha256', function() { + function doDrbg(opt) { + var drbg = elliptic.hmacDRBG({ + hash: hash.sha256, + entropy: opt.entropy, + nonce: opt.nonce, + pers: opt.pers + }); + return drbg.generate(opt.size, 'hex'); + } + + var test = [ + { + entropy: 'totally random0123456789', + nonce: 'secret nonce', + pers: 'my drbg', + size: 32, + res: '018ec5f8e08c41e5ac974eb129ac297c5388ee1864324fa13d9b15cf98d9a157' + }, + { + entropy: 'totally random0123456789', + nonce: 'secret nonce', + pers: null, + size: 32, + res: 'ed5d61ecf0ef38258e62f03bbb49f19f2cd07ba5145a840d83b134d5963b3633' + }, + ]; + for (var i = 0; i < test.length; i++) + assert.equal(doDrbg(test[i]), test[i].res); + }); + + describe('NIST vector', function() { + function test(opt) { + it('should not fail at ' + opt.name, function() { + var drbg = elliptic.hmacDRBG({ + hash: hash.sha256, + entropy: opt.entropy, + entropyEnc: 'hex', + nonce: opt.nonce, + nonceEnc: 'hex', + pers: opt.pers, + persEnc: 'hex' + }); + + for (var i = 0; i < opt.add.length; i++) { + var last = drbg.generate(opt.expected.length / 2, + 'hex', + opt.add[i], + 'hex'); + } + assert.equal(last, opt.expected); + }); + } + + var vector = function() {/* + COUNT = 0 + EntropyInput = ca851911349384bffe89de1cbdc46e6831e44d34a4fb935ee285dd14b71a7488 + Nonce = 659ba96c601dc69fc902940805ec0ca8 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = e528e9abf2dece54d47c7e75e5fe302149f817ea9fb4bee6f4199697d04d5b89d54fbb978a15b5c443c9ec21036d2460b6f73ebad0dc2aba6e624abf07745bc107694bb7547bb0995f70de25d6b29e2d3011bb19d27676c07162c8b5ccde0668961df86803482cb37ed6d5c0bb8d50cf1f50d476aa0458bdaba806f48be9dcb8 + + COUNT = 1 + EntropyInput = 79737479ba4e7642a221fcfd1b820b134e9e3540a35bb48ffae29c20f5418ea3 + Nonce = 3593259c092bef4129bc2c6c9e19f343 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = cf5ad5984f9e43917aa9087380dac46e410ddc8a7731859c84e9d0f31bd43655b924159413e2293b17610f211e09f770f172b8fb693a35b85d3b9e5e63b1dc252ac0e115002e9bedfb4b5b6fd43f33b8e0eafb2d072e1a6fee1f159df9b51e6c8da737e60d5032dd30544ec51558c6f080bdbdab1de8a939e961e06b5f1aca37 + + COUNT = 2 + EntropyInput = b340907445b97a8b589264de4a17c0bea11bb53ad72f9f33297f05d2879d898d + Nonce = 65cb27735d83c0708f72684ea58f7ee5 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 75183aaaf3574bc68003352ad655d0e9ce9dd17552723b47fab0e84ef903694a32987eeddbdc48efd24195dbdac8a46ba2d972f5808f23a869e71343140361f58b243e62722088fe10a98e43372d252b144e00c89c215a76a121734bdc485486f65c0b16b8963524a3a70e6f38f169c12f6cbdd169dd48fe4421a235847a23ff + + COUNT = 3 + EntropyInput = 8e159f60060a7d6a7e6fe7c9f769c30b98acb1240b25e7ee33f1da834c0858e7 + Nonce = c39d35052201bdcce4e127a04f04d644 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 62910a77213967ea93d6457e255af51fc79d49629af2fccd81840cdfbb4910991f50a477cbd29edd8a47c4fec9d141f50dfde7c4d8fcab473eff3cc2ee9e7cc90871f180777a97841597b0dd7e779eff9784b9cc33689fd7d48c0dcd341515ac8fecf5c55a6327aea8d58f97220b7462373e84e3b7417a57e80ce946d6120db5 + + COUNT = 4 + EntropyInput = 74755f196305f7fb6689b2fe6835dc1d81484fc481a6b8087f649a1952f4df6a + Nonce = c36387a544a5f2b78007651a7b74b749 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = b2896f3af4375dab67e8062d82c1a005ef4ed119d13a9f18371b1b873774418684805fd659bfd69964f83a5cfe08667ddad672cafd16befffa9faed49865214f703951b443e6dca22edb636f3308380144b9333de4bcb0735710e4d9266786342fc53babe7bdbe3c01a3addb7f23c63ce2834729fabbd419b47beceb4a460236 + + COUNT = 5 + EntropyInput = 4b222718f56a3260b3c2625a4cf80950b7d6c1250f170bd5c28b118abdf23b2f + Nonce = 7aed52d0016fcaef0b6492bc40bbe0e9 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = a6da029b3665cd39fd50a54c553f99fed3626f4902ffe322dc51f0670dfe8742ed48415cf04bbad5ed3b23b18b7892d170a7dcf3ef8052d5717cb0c1a8b3010d9a9ea5de70ae5356249c0e098946030c46d9d3d209864539444374d8fbcae068e1d6548fa59e6562e6b2d1acbda8da0318c23752ebc9be0c1c1c5b3cf66dd967 + + COUNT = 6 + EntropyInput = b512633f27fb182a076917e39888ba3ff35d23c3742eb8f3c635a044163768e0 + Nonce = e2c39b84629a3de5c301db5643af1c21 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = fb931d0d0194a97b48d5d4c231fdad5c61aedf1c3a55ac24983ecbf38487b1c93396c6b86ff3920cfa8c77e0146de835ea5809676e702dee6a78100da9aa43d8ec0bf5720befa71f82193205ac2ea403e8d7e0e6270b366dc4200be26afd9f63b7e79286a35c688c57cbff55ac747d4c28bb80a2b2097b3b62ea439950d75dff + + COUNT = 7 + EntropyInput = aae3ffc8605a975befefcea0a7a286642bc3b95fb37bd0eb0585a4cabf8b3d1e + Nonce = 9504c3c0c4310c1c0746a036c91d9034 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 2819bd3b0d216dad59ddd6c354c4518153a2b04374b07c49e64a8e4d055575dfbc9a8fcde68bd257ff1ba5c6000564b46d6dd7ecd9c5d684fd757df62d85211575d3562d7814008ab5c8bc00e7b5a649eae2318665b55d762de36eba00c2906c0e0ec8706edb493e51ca5eb4b9f015dc932f262f52a86b11c41e9a6d5b3bd431 + + COUNT = 8 + EntropyInput = b9475210b79b87180e746df704b3cbc7bf8424750e416a7fbb5ce3ef25a82cc6 + Nonce = 24baf03599c10df6ef44065d715a93f7 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = ae12d784f796183c50db5a1a283aa35ed9a2b685dacea97c596ff8c294906d1b1305ba1f80254eb062b874a8dfffa3378c809ab2869aa51a4e6a489692284a25038908a347342175c38401193b8afc498077e10522bec5c70882b7f760ea5946870bd9fc72961eedbe8bff4fd58c7cc1589bb4f369ed0d3bf26c5bbc62e0b2b2 + + COUNT = 9 + EntropyInput = 27838eb44ceccb4e36210703ebf38f659bc39dd3277cd76b7a9bcd6bc964b628 + Nonce = 39cfe0210db2e7b0eb52a387476e7ea1 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = e5e72a53605d2aaa67832f97536445ab774dd9bff7f13a0d11fd27bf6593bfb52309f2d4f09d147192199ea584503181de87002f4ee085c7dc18bf32ce5315647a3708e6f404d6588c92b2dda599c131aa350d18c747b33dc8eda15cf40e95263d1231e1b4b68f8d829f86054d49cfdb1b8d96ab0465110569c8583a424a099a + + COUNT = 10 + EntropyInput = d7129e4f47008ad60c9b5d081ff4ca8eb821a6e4deb91608bf4e2647835373a5 + Nonce = a72882773f78c2fc4878295840a53012 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 0cbf48585c5de9183b7ff76557f8fc9ebcfdfde07e588a8641156f61b7952725bbee954f87e9b937513b16bba0f2e523d095114658e00f0f3772175acfcb3240a01de631c19c5a834c94cc58d04a6837f0d2782fa53d2f9f65178ee9c837222494c799e64c60406069bd319549b889fa00a0032dd7ba5b1cc9edbf58de82bfcd + + COUNT = 11 + EntropyInput = 67fe5e300c513371976c80de4b20d4473889c9f1214bce718bc32d1da3ab7532 + Nonce = e256d88497738a33923aa003a8d7845c + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = b44660d64ef7bcebc7a1ab71f8407a02285c7592d755ae6766059e894f694373ed9c776c0cfc8594413eefb400ed427e158d687e28da3ecc205e0f7370fb089676bbb0fa591ec8d916c3d5f18a3eb4a417120705f3e2198154cd60648dbfcfc901242e15711cacd501b2c2826abe870ba32da785ed6f1fdc68f203d1ab43a64f + + COUNT = 12 + EntropyInput = de8142541255c46d66efc6173b0fe3ffaf5936c897a3ce2e9d5835616aafa2cb + Nonce = d01f9002c407127bc3297a561d89b81d + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 64d1020929d74716446d8a4e17205d0756b5264867811aa24d0d0da8644db25d5cde474143c57d12482f6bf0f31d10af9d1da4eb6d701bdd605a8db74fb4e77f79aaa9e450afda50b18d19fae68f03db1d7b5f1738d2fdce9ad3ee9461b58ee242daf7a1d72c45c9213eca34e14810a9fca5208d5c56d8066bab1586f1513de7 + + COUNT = 13 + EntropyInput = 4a8e0bd90bdb12f7748ad5f147b115d7385bb1b06aee7d8b76136a25d779bcb7 + Nonce = 7f3cce4af8c8ce3c45bdf23c6b181a00 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 320c7ca4bbeb7af977bc054f604b5086a3f237aa5501658112f3e7a33d2231f5536d2c85c1dad9d9b0bf7f619c81be4854661626839c8c10ae7fdc0c0b571be34b58d66da553676167b00e7d8e49f416aacb2926c6eb2c66ec98bffae20864cf92496db15e3b09e530b7b9648be8d3916b3c20a3a779bec7d66da63396849aaf + + COUNT = 14 + EntropyInput = 451ed024bc4b95f1025b14ec3616f5e42e80824541dc795a2f07500f92adc665 + Nonce = 2f28e6ee8de5879db1eccd58c994e5f0 + PersonalizationString = + AdditionalInput = + AdditionalInput = + ReturnedBits = 3fb637085ab75f4e95655faae95885166a5fbb423bb03dbf0543be063bcd48799c4f05d4e522634d9275fe02e1edd920e26d9accd43709cb0d8f6e50aa54a5f3bdd618be23cf73ef736ed0ef7524b0d14d5bef8c8aec1cf1ed3e1c38a808b35e61a44078127c7cb3a8fd7addfa50fcf3ff3bc6d6bc355d5436fe9b71eb44f7fd + + COUNT = 0 + EntropyInput = d3cc4d1acf3dde0c4bd2290d262337042dc632948223d3a2eaab87da44295fbd + Nonce = 0109b0e729f457328aa18569a9224921 + PersonalizationString = + AdditionalInput = 3c311848183c9a212a26f27f8c6647e40375e466a0857cc39c4e47575d53f1f6 + AdditionalInput = fcb9abd19ccfbccef88c9c39bfb3dd7b1c12266c9808992e305bc3cff566e4e4 + ReturnedBits = 9c7b758b212cd0fcecd5daa489821712e3cdea4467b560ef5ddc24ab47749a1f1ffdbbb118f4e62fcfca3371b8fbfc5b0646b83e06bfbbab5fac30ea09ea2bc76f1ea568c9be0444b2cc90517b20ca825f2d0eccd88e7175538b85d90ab390183ca6395535d34473af6b5a5b88f5a59ee7561573337ea819da0dcc3573a22974 + + COUNT = 1 + EntropyInput = f97a3cfd91faa046b9e61b9493d436c4931f604b22f1081521b3419151e8ff06 + Nonce = 11f3a7d43595357d58120bd1e2dd8aed + PersonalizationString = + AdditionalInput = 517289afe444a0fe5ed1a41dbbb5eb17150079bdd31e29cf2ff30034d8268e3b + AdditionalInput = 88028d29ef80b4e6f0fe12f91d7449fe75062682e89c571440c0c9b52c42a6e0 + ReturnedBits = c6871cff0824fe55ea7689a52229886730450e5d362da5bf590dcf9acd67fed4cb32107df5d03969a66b1f6494fdf5d63d5b4d0d34ea7399a07d0116126d0d518c7c55ba46e12f62efc8fe28a51c9d428e6d371d7397ab319fc73ded4722e5b4f30004032a6128df5e7497ecf82ca7b0a50e867ef6728a4f509a8c859087039c + + COUNT = 2 + EntropyInput = 0f2f23d64f481cabec7abb01db3aabf125c3173a044b9bf26844300b69dcac8b + Nonce = 9a5ae13232b43aa19cfe8d7958b4b590 + PersonalizationString = + AdditionalInput = ec4c7a62acab73385f567da10e892ff395a0929f959231a5628188ce0c26e818 + AdditionalInput = 6b97b8c6b6bb8935e676c410c17caa8042aa3145f856d0a32b641e4ae5298648 + ReturnedBits = 7480a361058bd9afa3db82c9d7586e42269102013f6ec5c269b6d05f17987847748684766b44918fd4b65e1648622fc0e0954178b0279dfc9fa99b66c6f53e51c4860131e9e0644287a4afe4ca8e480417e070db68008a97c3397e4b320b5d1a1d7e1d18a95cfedd7d1e74997052bf649d132deb9ec53aae7dafdab55e6dae93 + + COUNT = 3 + EntropyInput = 53c56660c78481be9c63284e005fcc14fbc7fb27732c9bf1366d01a426765a31 + Nonce = dc7a14d0eb5b0b3534e717a0b3c64614 + PersonalizationString = + AdditionalInput = 3aa848706ecb877f5bedf4ffc332d57c22e08747a47e75cff6f0fd1316861c95 + AdditionalInput = 9a401afa739b8f752fddacd291e0b854f5eff4a55b515e20cb319852189d3722 + ReturnedBits = 5c0eb420e0bf41ce9323e815310e4e8303cd677a8a8b023f31f0d79f0ca15aeb636099a369fd074d69889865eac1b72ab3cbfebdb8cf460b00072802e2ec648b1349a5303be4ccaadd729f1a9ea17482fd026aaeb93f1602bc1404b9853adde40d6c34b844cf148bc088941ecfc1642c8c0b9778e45f3b07e06e21ee2c9e0300 + + COUNT = 4 + EntropyInput = f63c804404902db334c54bb298fc271a21d7acd9f770278e089775710bf4fdd7 + Nonce = 3e45009ea9cb2a36ba1aa4bf39178200 + PersonalizationString = + AdditionalInput = d165a13dc8cc43f3f0952c3f5d3de4136954d983683d4a3e6d2dc4c89bf23423 + AdditionalInput = 75106bc86d0336df85097f6af8e80e2da59046a03fa65b06706b8bbc7ffc6785 + ReturnedBits = 6363139bba32c22a0f5cd23ca6d437b5669b7d432f786b8af445471bee0b2d24c9d5f2f93717cbe00d1f010cc3b9c515fc9f7336d53d4d26ba5c0d76a90186663c8582eb739c7b6578a3328bf68dc2cec2cd89b3a90201f6993adcc854df0f5c6974d0f5570765a15fe03dbce28942dd2fd16ba2027e68abac83926969349af8 + + COUNT = 5 + EntropyInput = 2aaca9147da66c176615726b69e3e851cc3537f5f279fe7344233d8e44cfc99d + Nonce = 4e171f080af9a6081bee9f183ac9e340 + PersonalizationString = + AdditionalInput = d75a2a6eb66c3833e50f5ec3d2e434cf791448d618026d0c360806d120ded669 + AdditionalInput = b643b74c15b37612e6577ed7ca2a4c67a78d560af9eb50a4108fca742e87b8d6 + ReturnedBits = 501dcdc977f4ba856f24eaa4968b374bebb3166b280334cb510232c31ebffde10fa47b7840ef3fe3b77725c2272d3a1d4219baf23e0290c622271edcced58838cf428f0517425d2e19e0d8c89377eecfc378245f283236fafa466c914b99672ceafab369e8889a0c866d8bd639db9fb797254262c6fd44cfa9045ad6340a60ef + + COUNT = 6 + EntropyInput = a2e4cd48a5cf918d6f55942d95fcb4e8465cdc4f77b7c52b6fae5b16a25ca306 + Nonce = bef036716440db6e6d333d9d760b7ca8 + PersonalizationString = + AdditionalInput = bfa591c7287f3f931168f95e38869441d1f9a11035ad8ea625bb61b9ea17591c + AdditionalInput = c00c735463bca215adc372cb892b05e939bf669583341c06d4e31d0e5b363a37 + ReturnedBits = e7d136af69926a5421d4266ee0420fd729f2a4f7c295d3c966bdfa05268180b508b8a2852d1b3a06fd2ab3e13c54005123ef319f42d0c6d3a575e6e7e1496cb28aacadbcf83740fba8f35fcee04bb2ed8a51db3d3362b01094a62fb57e33c99a432f29fce6676cffbbcc05107e794e75e44a02d5e6d9d748c5fbff00a0178d65 + + COUNT = 7 + EntropyInput = 95a67771cba69011a79776e713145d309edae56fad5fd6d41d83eaff89df6e5e + Nonce = be5b5164e31ecc51ba6f7c3c5199eb33 + PersonalizationString = + AdditionalInput = 065f693b229a7c4fd373cd15b3807552dd9bf98c5485cef361949d4e7d774b53 + AdditionalInput = 9afb62406f0e812c4f156d58b19a656c904813c1b4a45a0029ae7f50731f8014 + ReturnedBits = f61b61a6e79a41183e8ed6647899d2dc85cdaf5c3abf5c7f3bf37685946dc28f4923dc842f2d4326bd6ce0d50a84cb3ba869d72a36e246910eba6512ba36cd7ed3a5437c9245b00a344308c792b668b458d3c3e16dee2fbec41867da31084d46d8ec168de2148ef64fc5b72069abf5a6ada1ead2b7146bb793ff1c9c3690fa56 + + COUNT = 8 + EntropyInput = a459e1815cbca4514ec8094d5ab2414a557ba6fe10e613c345338d0521e4bf90 + Nonce = 62221392e2552e76cd0d36df6e6068eb + PersonalizationString = + AdditionalInput = 0a3642b02b23b3ef62c701a63401124022f5b896de86dab6e6c7451497aa1dcc + AdditionalInput = c80514865901371c45ba92d9f95d50bb7c9dd1768cb3dfbc45b968da94965c6e + ReturnedBits = 464e6977b8adaef307c9623e41c357013249c9ffd77f405f3925cebb69f151ce8fbb6a277164002aee7858fc224f6499042aa1e6322deee9a5d133c31d640e12a7487c731ba03ad866a24675badb1d79220c40be689f79c2a0be93cb4dada3e0eac4ab140cb91998b6f11953e68f2319b050c40f71c34de9905ae41b2de1c2f6 + + COUNT = 9 + EntropyInput = 252c2cad613e002478162861880979ee4e323025eebb6fb2e0aa9f200e28e0a1 + Nonce = d001bc9a8f2c8c242e4369df0c191989 + PersonalizationString = + AdditionalInput = 9bcfc61cb2bc000034bb3db980eb47c76fb5ecdd40553eff113368d639b947fd + AdditionalInput = 8b0565c767c2610ee0014582e9fbecb96e173005b60e9581503a6dca5637a26e + ReturnedBits = e96c15fe8a60692b0a7d67171e0195ff6e1c87aab844221e71700d1bbee75feea695f6a740c9760bbe0e812ecf4061d8f0955bc0195e18c4fd1516ebca50ba6a6db86881737dbab8321707675479b87611db6af2c97ea361a5484555ead454defb1a64335de964fc803d40f3a6f057893d2afc25725754f4f00abc51920743dc + + COUNT = 10 + EntropyInput = 8be0ca6adc8b3870c9d69d6021bc1f1d8eb9e649073d35ee6c5aa0b7e56ad8a5 + Nonce = 9d1265f7d51fdb65377f1e6edd6ae0e4 + PersonalizationString = + AdditionalInput = da86167ac997c406bb7979f423986a84ec6614d6caa7afc10aff0699a9b2cf7f + AdditionalInput = e4baa3c555950b53e2bfdba480cb4c94b59381bac1e33947e0c22e838a9534cf + ReturnedBits = 64384ecc4ea6b458efc227ca697eac5510092265520c0a0d8a0ccf9ed3ca9d58074671188c6a7ad16d0b050cdc072c125d7298d3a31d9f044a9ee40da0089a84fea28cc7f05f1716db952fad29a0e779635cb7a912a959be67be2f0a4170aace2981802e2ff6467e5b46f0ffbff3b42ba5935fd553c82482ac266acf1cd247d7 + + COUNT = 11 + EntropyInput = d43a75b6adf26d60322284cb12ac38327792442aa8f040f60a2f331b33ac4a8f + Nonce = 0682f8b091f811afacaacaec9b04d279 + PersonalizationString = + AdditionalInput = 7fd3b8f512940da7de5d80199d9a7b42670c04a945775a3dba869546cbb9bc65 + AdditionalInput = 2575db20bc7aafc2a90a5dabab760db851d754777bc9f05616af1858b24ff3da + ReturnedBits = 0da7a8dc73c163014bf0841913d3067806456bbca6d5de92b85534c6545467313648d71ef17c923d090dc92cff8d4d1a9a2bb63e001dc2e8ab1a597999be3d6cf70ff63fee9985801395fbd4f4990430c4259fcae4fa1fcd73dc3187ccc102d04af7c07532885e5a226fc42809c48f22eecf4f6ab996ae4fcb144786957d9f41 + + COUNT = 12 + EntropyInput = 64352f236af5d32067a529a8fd05ba00a338c9de306371a0b00c36e610a48d18 + Nonce = df99ed2c7608c870624b962a5dc68acd + PersonalizationString = + AdditionalInput = da416335e7aaf60cf3d06fb438735ce796aad09034f8969c8f8c3f81e32fef24 + AdditionalInput = a28c07c21a2297311adf172c19e83ca0a87731bdffb80548978d2d1cd82cf8a3 + ReturnedBits = 132b9f25868729e3853d3c51f99a3b5fae6d4204bea70890daf62e042b776a526c8fb831b80a6d5d3f153237df1fd39b6fd9137963f5516d9cdd4e3f9195c46e9972c15d3edc6606e3368bde1594977fb88d0ca6e6f5f3d057ccadc7d7dab77dfc42658a1e972aa446b20d418286386a52dfc1c714d2ac548713268b0b709729 + + COUNT = 13 + EntropyInput = 282f4d2e05a2cd30e9087f5633089389449f04bac11df718c90bb351cd3653a5 + Nonce = 90a7daf3c0de9ea286081efc4a684dfb + PersonalizationString = + AdditionalInput = 2630b4ccc7271cc379cb580b0aaede3d3aa8c1c7ba002cf791f0752c3d739007 + AdditionalInput = c31d69de499f1017be44e3d4fa77ecebc6a9b9934749fcf136f267b29115d2cc + ReturnedBits = c899094520e0197c37b91dd50778e20a5b950decfb308d39f1db709447ae48f6101d9abe63a783fbb830eec1d359a5f61a2013728966d349213ee96382614aa4135058a967627183810c6622a2158cababe3b8ab99169c89e362108bf5955b4ffc47440f87e4bad0d36bc738e737e072e64d8842e7619f1be0af1141f05afe2d + + COUNT = 14 + EntropyInput = 13c752b9e745ce77bbc7c0dbda982313d3fe66f903e83ebd8dbe4ff0c11380e9 + Nonce = f1a533095d6174164bd7c82532464ae7 + PersonalizationString = + AdditionalInput = 4f53db89b9ba7fc00767bc751fb8f3c103fe0f76acd6d5c7891ab15b2b7cf67c + AdditionalInput = 582c2a7d34679088cca6bd28723c99aac07db46c332dc0153d1673256903b446 + ReturnedBits = 6311f4c0c4cd1f86bd48349abb9eb930d4f63df5e5f7217d1d1b91a71d8a6938b0ad2b3e897bd7e3d8703db125fab30e03464fad41e5ddf5bf9aeeb5161b244468cfb26a9d956931a5412c97d64188b0da1bd907819c686f39af82e91cfeef0cbffb5d1e229e383bed26d06412988640706815a6e820796876f416653e464961 + */}.toString().replace(/^function.*\/\*|\*\/}/g, '').split(/\n\n/g); + + vector.forEach(function(item) { + var lines = item.split(/\n/g); + var opt = null; + for (var i = 0; i < lines.length; i++) { + var line = lines[i].trim(); + + var match = line.match( + /(COUNT|Entropy|Non|Per|Add|Ret)\w*\s*=\s*([\w\d]*)/ + ); + if (!match) + continue; + + var key = match[1]; + var value = match[2] || null; + if (key === 'COUNT') { + opt = { + name: value, + entropy: null, + nonce: null, + pers: null, + add: [], + expected: null + }; + } else if (key === 'Entropy') { + opt.entropy = value; + } else if (key === 'Non') { + opt.nonce = value; + } else if (key === 'Per') { + opt.pers = value; + } else if (key === 'Add') { + if (value && opt.add.length === 0) + opt.name += ' with additional data'; + opt.add.push(value); + } else if (key === 'Ret') { + opt.expected = value; + test(opt); + opt = null; + } + } + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/package.json b/node_modules/crypto-browserify/node_modules/create-ecdh/package.json new file mode 100644 index 00000000..051e7f64 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/package.json @@ -0,0 +1,74 @@ +{ + "name": "create-ecdh", + "version": "2.0.0", + "description": "createECDH but browserifiable", + "main": "index.js", + "scripts": { + "test": "node test.js | tspec" + }, + "repository": { + "type": "git", + "url": "https://github.com/crypto-browserify/createECDH.git" + }, + "keywords": [ + "diffie", + "hellman", + "diffiehellman", + "ECDH" + ], + "author": { + "name": "Calvin Metcalf" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/createECDH/issues" + }, + "homepage": "https://github.com/crypto-browserify/createECDH", + "dependencies": { + "bn.js": "^1.0.0", + "elliptic": "^1.0.0" + }, + "devDependencies": { + "tap-spec": "^1.0.1", + "tape": "^3.0.1" + }, + "gitHead": "8f2d7e13c6621ba66bd79121ab4b8a67968f6476", + "_id": "create-ecdh@2.0.0", + "_shasum": "59a11dbd3af8de5acbc8d005b624ccf7136f2a78", + "_from": "create-ecdh@>=2.0.0 <3.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "1.2.0", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "59a11dbd3af8de5acbc8d005b624ccf7136f2a78", + "tarball": "http://registry.npmjs.org/create-ecdh/-/create-ecdh-2.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-2.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/readme.md b/node_modules/crypto-browserify/node_modules/create-ecdh/readme.md new file mode 100644 index 00000000..254bf03f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/readme.md @@ -0,0 +1,4 @@ +createECDH [![Build Status](https://travis-ci.org/crypto-browserify/createECDH.svg)](https://travis-ci.org/crypto-browserify/createECDH) +==== + +In io.js or node >= 0.11 this module is just a shortcut to crypto.createECDH. In node <= 0.11 or the browser this is a pure JavaScript implimentation, more specifically a wrapper around [elliptic](https://github.com/indutny/elliptic), to give it the same API as node. `secp256k1`, `secp224r1` (aka p-224), `prime256v1` (aka p-256, secp256r1), `prime192v1` (aka p-192, secp192r1) curves all work in both this library and node (though only the highlighted name will work in node). \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-ecdh/test.js b/node_modules/crypto-browserify/node_modules/create-ecdh/test.js new file mode 100644 index 00000000..bc0c058e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-ecdh/test.js @@ -0,0 +1,67 @@ +var test = require('tape'); +var nodeCrypto = require('./browser'); +var myCrypto = require('./browser'); + +var mods = [ + 'secp256k1', + 'secp224r1', + 'prime256v1', + 'prime192v1' +]; + +function run(i) { + mods.forEach(function (mod) { + test(mod + ' run ' + i + ' uncompressed', function (t){ + t.plan(2); + var dh1 = nodeCrypto(mod); + dh1.generateKeys(); + var dh2 = myCrypto(mod); + dh2.generateKeys(); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.notEquals(pubk1.toString('hex'), pubk2.toString('hex'), 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(pubk1).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + test(mod + ' run ' + i + ' compressed', function (t){ + t.plan(2); + var dh1 = nodeCrypto(mod); + dh1.generateKeys(); + var dh2 = myCrypto(mod); + dh2.generateKeys(); + var pubk1 = dh1.getPublicKey(null, 'compressed'); + var pubk2 = dh2.getPublicKey(null, 'compressed'); + t.notEquals(pubk1.toString('hex'), pubk2.toString('hex'), 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(pubk1).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + test(mod + ' run ' + i + ' set stuff', function (t){ + t.plan(5); + var dh1 = nodeCrypto(mod); + var dh2 = myCrypto(mod); + dh1.generateKeys(); + dh2.generateKeys(); + dh1.setPrivateKey(dh2.getPrivateKey()); + dh1.setPublicKey(dh2.getPublicKey()); + var priv1 = dh1.getPrivateKey('hex'); + var priv2 = dh2.getPrivateKey('hex'); + t.equals(priv1, priv2, 'same private key'); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.equals(pubk1.toString('hex'), pubk2.toString('hex'), 'same public keys, uncompressed'); + t.equals(dh1.getPublicKey('hex', 'compressed'), dh2.getPublicKey('hex', 'compressed'), 'same public keys compressed'); + t.equals(dh1.getPublicKey('hex', 'hybrid'), dh2.getPublicKey('hex', 'hybrid'), 'same public keys hybrid'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(pubk1).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + }); +} + + +var i = 0; +while (++i < 100) { + run(i); +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hash/.npmignore b/node_modules/crypto-browserify/node_modules/create-hash/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/crypto-browserify/node_modules/create-hash/.travis.yml b/node_modules/crypto-browserify/node_modules/create-hash/.travis.yml new file mode 100644 index 00000000..1416d607 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.10" + - "0.11" \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hash/browser.js b/node_modules/crypto-browserify/node_modules/create-hash/browser.js new file mode 100644 index 00000000..29673a84 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/browser.js @@ -0,0 +1,89 @@ +'use strict'; +var inherits = require('inherits') +var md5 = require('./md5') +var rmd160 = require('ripemd160') +var sha = require('sha.js') + +var Transform = require('stream').Transform + +function HashNoConstructor(hash) { + Transform.call(this) + + this._hash = hash + this.buffers = [] +} + +inherits(HashNoConstructor, Transform) + +HashNoConstructor.prototype._transform = function (data, _, next) { + this.buffers.push(data) + + next() +} + +HashNoConstructor.prototype._flush = function (next) { + this.push(this.digest()) + next() +} + +HashNoConstructor.prototype.update = function (data, enc) { + if (typeof data === 'string') { + data = new Buffer(data, enc) + } + + this.buffers.push(data) + return this +} + +HashNoConstructor.prototype.digest = function (enc) { + var buf = Buffer.concat(this.buffers) + var r = this._hash(buf) + this.buffers = null + + return enc ? r.toString(enc) : r +} + +function Hash(hash) { + Transform.call(this) + + this._hash = hash +} + +inherits(Hash, Transform) + +Hash.prototype._transform = function (data, enc, next) { + if (enc) data = new Buffer(data, enc) + + this._hash.update(data) + + next() +} + +Hash.prototype._flush = function (next) { + this.push(this._hash.digest()) + this._hash = null + + next() +} + +Hash.prototype.update = function (data, enc) { + if (typeof data === 'string') { + data = new Buffer(data, enc) + } + + this._hash.update(data) + return this +} + +Hash.prototype.digest = function (enc) { + var outData = this._hash.digest() + + return enc ? outData.toString(enc) : outData +} + +module.exports = function createHash (alg) { + if ('md5' === alg) return new HashNoConstructor(md5) + if ('rmd160' === alg) return new HashNoConstructor(rmd160) + + return new Hash(sha(alg)) +} diff --git a/node_modules/crypto-browserify/node_modules/create-hash/helpers.js b/node_modules/crypto-browserify/node_modules/create-hash/helpers.js new file mode 100644 index 00000000..33b463dc --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/helpers.js @@ -0,0 +1,34 @@ +'use strict'; +var intSize = 4; +var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0); +var chrsz = 8; + +function toArray(buf, bigEndian) { + if ((buf.length % intSize) !== 0) { + var len = buf.length + (intSize - (buf.length % intSize)); + buf = Buffer.concat([buf, zeroBuffer], len); + } + + var arr = []; + var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE; + for (var i = 0; i < buf.length; i += intSize) { + arr.push(fn.call(buf, i)); + } + return arr; +} + +function toBuffer(arr, size, bigEndian) { + var buf = new Buffer(size); + var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE; + for (var i = 0; i < arr.length; i++) { + fn.call(buf, arr[i], i * 4, true); + } + return buf; +} + +function hash(buf, fn, hashSize, bigEndian) { + if (!Buffer.isBuffer(buf)) buf = new Buffer(buf); + var arr = fn(toArray(buf, bigEndian), buf.length * chrsz); + return toBuffer(arr, hashSize, bigEndian); +} +exports.hash = hash; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hash/index.js b/node_modules/crypto-browserify/node_modules/create-hash/index.js new file mode 100644 index 00000000..9d2d26f8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/index.js @@ -0,0 +1 @@ +module.exports = require('crypto').createHash; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hash/md5.js b/node_modules/crypto-browserify/node_modules/create-hash/md5.js new file mode 100644 index 00000000..d2135f4d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/md5.js @@ -0,0 +1,156 @@ +'use strict'; +/* + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +var helpers = require('./helpers'); + +/* + * Calculate the MD5 of an array of little-endian words, and a bit length + */ +function core_md5(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << ((len) % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); + d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); + c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); + b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); + a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); + d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); + c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); + b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); + a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); + d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); + c = md5_ff(c, d, a, b, x[i+10], 17, -42063); + b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); + a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); + d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); + c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); + b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); + + a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); + d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); + c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); + b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); + a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); + d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); + c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); + b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); + a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); + d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); + c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); + b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); + a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); + d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); + c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); + b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); + + a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); + d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); + c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); + b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); + a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); + d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); + c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); + b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); + a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); + d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); + c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); + b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); + a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); + d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); + c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); + b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); + + a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); + d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); + c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); + b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); + a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); + d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); + c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); + b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); + a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); + d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); + c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); + b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); + a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); + d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); + c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); + b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + } + return Array(a, b, c, d); + +} + +/* + * These functions implement the four basic operations the algorithm uses. + */ +function md5_cmn(q, a, b, x, s, t) +{ + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); +} +function md5_ff(a, b, c, d, x, s, t) +{ + return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); +} +function md5_gg(a, b, c, d, x, s, t) +{ + return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); +} +function md5_hh(a, b, c, d, x, s, t) +{ + return md5_cmn(b ^ c ^ d, a, b, x, s, t); +} +function md5_ii(a, b, c, d, x, s, t) +{ + return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function bit_rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +module.exports = function md5(buf) { + return helpers.hash(buf, core_md5, 16); +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/.bin/sha.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/.bin/sha.js new file mode 120000 index 00000000..3c761051 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/.bin/sha.js @@ -0,0 +1 @@ +../sha.js/bin.js \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/.npmignore b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/.npmignore new file mode 100644 index 00000000..a091fb10 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/.npmignore @@ -0,0 +1,5 @@ +.gitignore +test/ +.DS_Store +.min-wd +Makefile diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/CHANGELOG.md b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/CHANGELOG.md new file mode 100644 index 00000000..9e1e6dfb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/CHANGELOG.md @@ -0,0 +1,36 @@ +1.0.1 / 2015-05-05 +------------------ +- standard formatting + +1.0.0 / 2015-01-14 +------------------ +- updated dev deps +- added more test fixtures +- updated readme with usage, testing, etc +- moved from https://github.com/cryptocoinjs/ripemd160 to https://github.com/crypto-browserify/ripemd160 + +0.2.1 / 2014-12-31 +------------------ +- made license clear in `package.json` +- deleted `Makefile`, moved targets to `package.json` +- removed `terst` for `assert` + +0.2.0 / 2014-03-09 +------------------ +* removed bower.json and component.json +* changed 4 spacing to 2 +* returns `Buffer` type now, input must be Array, Uint8Array, Buffer, or string +* remove deps: `convert-hex` and `convert-string` + +0.1.0 / 2013-11-20 +------------------ +* changed package name +* removed AMD support + +0.0.2 / 2013-11-06 +------------------ +* fixed component.json file + +0.0.1 / 2013-11-03 +------------------ +* initial release diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/README.md b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/README.md new file mode 100644 index 00000000..c09f50b1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/README.md @@ -0,0 +1,100 @@ +ripemd160 +========= + +JavaScript component to compute the RIPEMD-160 hash of strings or bytes. This hash is commonly used in crypto currencies +like Bitcoin. + +Usage +----- + +### Install + + npm install --save ripemd160 + + +### ripemd160(input) + +`input` should be either a `string`, `Buffer`, or an `Array`. It returns a `Buffer`. + +**example 1**: + +```js +var ripemd16 = require('ripemd160') + +var data = 'hello' +var result = ripemd160(data) +console.log(result.toString('hex')) +// => 108f07b8382412612c048d07d13f814118445acd +``` + +**example 2**: + +```js +var ripemd16 = require('ripemd160') + +var data = new Buffer('hello', 'utf8') +var result = ripemd160(data) +console.log(result.toString('hex')) +// => 108f07b8382412612c048d07d13f814118445acd +``` + + +#### Converting Buffers + +If you're not familiar with the Node.js ecosystem, type `Buffer` is a common way that a developer can pass around +binary data. `Buffer` also exists in the [Browserify](http://browserify.org/) environment. Converting to and from Buffers is very easy. + +##### To buffer + +```js +// from string +var buf = new Buffer('some string', 'utf8') + +// from hex string +var buf = new Buffer('3f5a4c22', 'hex') + +// from array +var buf = new Buffer([1, 2, 3, 4]) +``` + +#### From buffer + +```js +// to string +var str = buf.toString('utf8') + +// to hex string +var hex = buf.toString('hex') + +// to array +var arr = [].slice.call(buf) +``` + + +Testing +------- + +### Install dev deps: + + npm install --development + +### Test in Node.js: + + npm run test + +### Test in a Browser: + +Testing in the browser uses the excellent [Mochify](https://github.com/mantoni/mochify.js). Mochify can use either PhantomJS +or an actual browser. You must have Selenium installed if you want to use an actual browser. The easiest way is to +`npm install -g start-selenium` and then run `start-selenium`. + +Then run: + + npm run browser-test + + + +License +------- + +Licensed: BSD3-Clause diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/lib/ripemd160.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/lib/ripemd160.js new file mode 100644 index 00000000..a96ac5b3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/lib/ripemd160.js @@ -0,0 +1,210 @@ +/* +CryptoJS v3.1.2 +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +/** @preserve +(c) 2012 by Cédric Mesnil. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +// constants table +var zl = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +] + +var zr = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +] + +var sl = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +] + +var sr = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +] + +var hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E] +var hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000] + +function bytesToWords (bytes) { + var words = [] + for (var i = 0, b = 0; i < bytes.length; i++, b += 8) { + words[b >>> 5] |= bytes[i] << (24 - b % 32) + } + return words +} + +function wordsToBytes (words) { + var bytes = [] + for (var b = 0; b < words.length * 32; b += 8) { + bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF) + } + return bytes +} + +function processBlock (H, M, offset) { + // swap endian + for (var i = 0; i < 16; i++) { + var offset_i = offset + i + var M_offset_i = M[offset_i] + + // Swap + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ) + } + + // Working variables + var al, bl, cl, dl, el + var ar, br, cr, dr, er + + ar = al = H[0] + br = bl = H[1] + cr = cl = H[2] + dr = dl = H[3] + er = el = H[4] + + // computation + var t + for (i = 0; i < 80; i += 1) { + t = (al + M[offset + zl[i]]) | 0 + if (i < 16) { + t += f1(bl, cl, dl) + hl[0] + } else if (i < 32) { + t += f2(bl, cl, dl) + hl[1] + } else if (i < 48) { + t += f3(bl, cl, dl) + hl[2] + } else if (i < 64) { + t += f4(bl, cl, dl) + hl[3] + } else {// if (i<80) { + t += f5(bl, cl, dl) + hl[4] + } + t = t | 0 + t = rotl(t, sl[i]) + t = (t + el) | 0 + al = el + el = dl + dl = rotl(cl, 10) + cl = bl + bl = t + + t = (ar + M[offset + zr[i]]) | 0 + if (i < 16) { + t += f5(br, cr, dr) + hr[0] + } else if (i < 32) { + t += f4(br, cr, dr) + hr[1] + } else if (i < 48) { + t += f3(br, cr, dr) + hr[2] + } else if (i < 64) { + t += f2(br, cr, dr) + hr[3] + } else {// if (i<80) { + t += f1(br, cr, dr) + hr[4] + } + + t = t | 0 + t = rotl(t, sr[i]) + t = (t + er) | 0 + ar = er + er = dr + dr = rotl(cr, 10) + cr = br + br = t + } + + // intermediate hash value + t = (H[1] + cl + dr) | 0 + H[1] = (H[2] + dl + er) | 0 + H[2] = (H[3] + el + ar) | 0 + H[3] = (H[4] + al + br) | 0 + H[4] = (H[0] + bl + cr) | 0 + H[0] = t +} + +function f1 (x, y, z) { + return ((x) ^ (y) ^ (z)) +} + +function f2 (x, y, z) { + return (((x) & (y)) | ((~x) & (z))) +} + +function f3 (x, y, z) { + return (((x) | (~(y))) ^ (z)) +} + +function f4 (x, y, z) { + return (((x) & (z)) | ((y) & (~(z)))) +} + +function f5 (x, y, z) { + return ((x) ^ ((y) | (~(z)))) +} + +function rotl (x, n) { + return (x << n) | (x >>> (32 - n)) +} + +function ripemd160 (message) { + var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0] + + if (typeof message === 'string') { + message = new Buffer(message, 'utf8') + } + + var m = bytesToWords(message) + + var nBitsLeft = message.length * 8 + var nBitsTotal = message.length * 8 + + // Add padding + m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32) + m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | + (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) + ) + + for (var i = 0; i < m.length; i += 16) { + processBlock(H, m, i) + } + + // swap endian + for (i = 0; i < 5; i++) { + // shortcut + var H_i = H[i] + + // Swap + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00) + } + + var digestbytes = wordsToBytes(H) + return new Buffer(digestbytes) +} + +module.exports = ripemd160 diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/package.json b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/package.json new file mode 100644 index 00000000..6664a166 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/ripemd160/package.json @@ -0,0 +1,81 @@ +{ + "name": "ripemd160", + "version": "1.0.1", + "description": "Compute ripemd160 of bytes or strings.", + "keywords": [ + "string", + "strings", + "ripemd160", + "ripe160", + "bitcoin", + "bytes", + "cryptography" + ], + "license": "BSD-3-Clause", + "devDependencies": { + "mocha": "^2.1.0", + "mochify": "^2.1.1", + "standard": "3.x" + }, + "repository": { + "url": "https://github.com/crypto-browserify/ripemd160", + "type": "git" + }, + "main": "./lib/ripemd160.js", + "dependencies": {}, + "scripts": { + "test": "mocha test", + "browser-test": "mochify --wd -R spec" + }, + "gitHead": "42172c6527a55a24a9ee306996b4a8578d4780db", + "bugs": { + "url": "https://github.com/crypto-browserify/ripemd160/issues" + }, + "homepage": "https://github.com/crypto-browserify/ripemd160", + "_id": "ripemd160@1.0.1", + "_shasum": "93a4bbd4942bc574b69a8fa57c71de10ecca7d6e", + "_from": "ripemd160@>=1.0.0 <2.0.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + "maintainers": [ + { + "name": "vbuterin", + "email": "vbuterin@gmail.com" + }, + { + "name": "midnightlightning", + "email": "boydb@midnightdesign.ws" + }, + { + "name": "nadav", + "email": "npm@shesek.info" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + } + ], + "dist": { + "shasum": "93a4bbd4942bc574b69a8fa57c71de10ecca7d6e", + "tarball": "http://registry.npmjs.org/ripemd160/-/ripemd160-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/.npmignore b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/.travis.yml b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/.travis.yml new file mode 100644 index 00000000..7a589da3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.10" + diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/LICENSE b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/LICENSE new file mode 100644 index 00000000..92ba9d30 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2013-2014 sha.js contributors + +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/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/README.md b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/README.md new file mode 100644 index 00000000..d907b370 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/README.md @@ -0,0 +1,54 @@ +# sha.js + +Streamable SHA hashes in pure javascript. + +[![build status](https://secure.travis-ci.org/dominictarr/sha.js.png)](http://travis-ci.org/dominictarr/sha.js) + +[![testling badge](https://ci.testling.com/dominictarr/sha.js.png)](https://ci.testling.com/dominictarr/sha.js) + +## Example + +``` js +var createHash = require('sha.js') + +var sha256 = createHash('sha256') +var sha512 = createHash'sha512') + +var h = sha1.update('abc', 'utf8').digest('hex') +console.log(h) //ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad + +//LEGACY, do not use in new systems: +var sha0 = createHash('sha') +var sha1 = createHash('sha1') + + +``` + +## supported hashes + +sha.js currently implements: + + +* sha256 +* sha512 +* sha1 (legacy, no not use in new systems) +* sha (legacy, no not use in new systems) + +## Note + +Note, this doesn't actually implement a stream, but wrapping this in a stream is trivial. +but is does update incrementally, so you can hash things larger than ram, and also, since it reuses +the typedarrays, it uses a constant amount of memory (except when using base64 or utf8 encoding, +see code comments) + + +## Acknowledgements + +This work is derived from Paul Johnston's ["A JavaScript implementation of the Secure Hash Algorithm"] +(http://pajhome.org.uk/crypt/md5/sha1.html) + + + +## License + +MIT diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/bin.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/bin.js new file mode 100755 index 00000000..ef105f6c --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/bin.js @@ -0,0 +1,37 @@ +#! /usr/bin/env node + +var createHash = require('./browserify') + +var argv = process.argv.slice(2) + +if(/--help|-h/.test(argv[0])) return usage() + +function stream (alg, s) { + var start = Date.now() + var hash = createHash(alg || 'sha1') + s + .on('data', function (data) { + hash.update(data) + }) + .on('end', function (data) { + if(process.env.DEBUG) + return console.log(hash.digest('hex'), Date.now() - start) + console.log(hash.digest('hex')) + }) +} + +if(!process.stdin.isTTY) { + stream(argv[0], process.stdin) +} else if (argv.length) { + var filename = argv.pop() + var alg = argv.pop() + stream(alg, require('fs').createReadStream(filename)) +} else { + usage() +} + +function usage () { + console.error('sha.js [algorithm=sha1] [filename] # hash filename with algorithm') + console.error('input | sha.js [algorithm=sha1] # hash stdin with algorithm') + console.error('sha.js --help # display this message') +} diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js new file mode 100644 index 00000000..853ec06b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hash.js @@ -0,0 +1,69 @@ +//prototype class for hash functions +function Hash (blockSize, finalSize) { + this._block = new Buffer(blockSize) //new Uint32Array(blockSize/4) + this._finalSize = finalSize + this._blockSize = blockSize + this._len = 0 + this._s = 0 +} + +Hash.prototype.update = function (data, enc) { + if ("string" === typeof data) { + enc = enc || "utf8" + data = new Buffer(data, enc) + } + + var l = this._len += data.length + var s = this._s || 0 + var f = 0 + var buffer = this._block + + while (s < l) { + var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize)) + var ch = (t - f) + + for (var i = 0; i < ch; i++) { + buffer[(s % this._blockSize) + i] = data[i + f] + } + + s += ch + f += ch + + if ((s % this._blockSize) === 0) { + this._update(buffer) + } + } + this._s = s + + return this +} + +Hash.prototype.digest = function (enc) { + // Suppose the length of the message M, in bits, is l + var l = this._len * 8 + + // Append the bit 1 to the end of the message + this._block[this._len % this._blockSize] = 0x80 + + // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize + this._block.fill(0, this._len % this._blockSize + 1) + + if (l % (this._blockSize * 8) >= this._finalSize * 8) { + this._update(this._block) + this._block.fill(0) + } + + // to this append the block which is equal to the number l written in binary + // TODO: handle case where l is > Math.pow(2, 29) + this._block.writeInt32BE(l, this._blockSize - 4) + + var hash = this._update(this._block) || this._hash() + + return enc ? hash.toString(enc) : hash +} + +Hash.prototype._update = function () { + throw new Error('_update must be implemented by subclass') +} + +module.exports = Hash diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hexpp.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hexpp.js new file mode 100644 index 00000000..f6e52f3f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/hexpp.js @@ -0,0 +1,38 @@ + + +function toHex (buf, group, wrap, LE) { + buf = buf.buffer || buf + var s = '' + var l = buf.byteLength || buf.length + for(var i = 0; i < l ; i++) { + var byte = (i&0xfffffffc)|(!LE ? i%4 : 3 - i%4) + s = s + ((buf[byte]>>4).toString(16)) + + ((buf[byte]&0xf).toString(16)) + + (group-1==i%group ? ' ' : '') + + (wrap-1==i%wrap ? '\n' : '') + } + return s +} + +function reverseByteOrder(n) { + return ( + ((n << 24) & 0xff000000) + | ((n << 8) & 0x00ff0000) + | ((n >> 8) & 0x0000ff00) + | ((n >> 24) & 0x000000ff) + ) +} + +var hexpp = module.exports = function (buffer, opts) { + opts = opts || {} + opts.groups = opts.groups || 4 + opts.wrap = opts.wrap || 16 + return toHex(buffer, opts.groups, opts.wrap, opts.bigendian, opts.ints) +} + +hexpp.defaults = function (opts) { + return function (b) { + return hexpp(b, opts) + } +} + diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/index.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/index.js new file mode 100644 index 00000000..111d97b0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/index.js @@ -0,0 +1,13 @@ +var exports = module.exports = function (alg) { + var Alg = exports[alg.toLowerCase()] + if(!Alg) throw new Error(alg + ' is not supported (we accept pull requests)') + return new Alg() +} + + +exports.sha = require('./sha') +exports.sha1 = require('./sha1') +exports.sha224 = require('./sha224') +exports.sha256 = require('./sha256') +exports.sha384 = require('./sha384') +exports.sha512 = require('./sha512') diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/package.json b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/package.json new file mode 100644 index 00000000..bb9eb9e8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/package.json @@ -0,0 +1,62 @@ +{ + "name": "sha.js", + "description": "streaming sha1 hash in pure javascript", + "version": "2.4.0", + "homepage": "https://github.com/crypto-browserify/sha.js", + "repository": { + "type": "git", + "url": "git://github.com/crypto-browserify/sha.js.git" + }, + "dependencies": { + "inherits": "^2.0.1" + }, + "devDependencies": { + "buffer": "~2.3.2", + "hash-test-vectors": "^1.3.1", + "tape": "~2.3.2", + "typedarray": "0.0.6" + }, + "bin": { + "sha.js": "./bin.js" + }, + "scripts": { + "prepublish": "npm ls && npm test", + "test": "set -e; for t in test/*.js; do node $t; done;" + }, + "author": { + "name": "Dominic Tarr", + "email": "dominic.tarr@gmail.com", + "url": "dominictarr.com" + }, + "license": "MIT", + "gitHead": "196737d015aee6976b14d4636c2e62bf710e8a53", + "bugs": { + "url": "https://github.com/crypto-browserify/sha.js/issues" + }, + "_id": "sha.js@2.4.0", + "_shasum": "ba7f1a4fe312a88b90dab80f228ab24ef31a7ac3", + "_from": "sha.js@>=2.3.6 <3.0.0", + "_npmVersion": "2.4.1", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + "maintainers": [ + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + } + ], + "dist": { + "shasum": "ba7f1a4fe312a88b90dab80f228ab24ef31a7ac3", + "tarball": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha.js new file mode 100644 index 00000000..f7d7258a --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha.js @@ -0,0 +1,99 @@ +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined + * in FIPS PUB 180-1 + * This source code is derived from sha1.js of the same repository. + * The difference between SHA-0 and SHA-1 is just a bitwise rotate left + * operation was added. + */ + +var inherits = require('inherits') +var Hash = require('./hash') + +var W = new Array(80) + +function Sha() { + this.init() + this._w = W + + Hash.call(this, 64, 56) +} + +inherits(Sha, Hash) + +Sha.prototype.init = function () { + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 + + return this +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function rol(num, cnt) { + return (num << cnt) | (num >>> (32 - cnt)); +} + +Sha.prototype._update = function (M) { + var W = this._w + + var a = this._a + var b = this._b + var c = this._c + var d = this._d + var e = this._e + + var j = 0, k + + /* + * SHA-1 has a bitwise rotate left operation. But, SHA is not + * function calcW() { return rol(W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16], 1) } + */ + function calcW() { return W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16] } + function loop(w, f) { + W[j] = w + + var t = rol(a, 5) + f + e + w + k + + e = d + d = c + c = rol(b, 30) + b = a + a = t + j++ + } + + k = 1518500249 + while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d)) + while (j < 20) loop(calcW(), (b & c) | ((~b) & d)) + k = 1859775393 + while (j < 40) loop(calcW(), b ^ c ^ d) + k = -1894007588 + while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d)) + k = -899497514 + while (j < 80) loop(calcW(), b ^ c ^ d) + + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 +} + +Sha.prototype._hash = function () { + var H = new Buffer(20) + + H.writeInt32BE(this._a|0, 0) + H.writeInt32BE(this._b|0, 4) + H.writeInt32BE(this._c|0, 8) + H.writeInt32BE(this._d|0, 12) + H.writeInt32BE(this._e|0, 16) + + return H +} + +module.exports = Sha + diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha1.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha1.js new file mode 100644 index 00000000..42c2a8c3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha1.js @@ -0,0 +1,96 @@ +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. + */ + +var inherits = require('inherits') +var Hash = require('./hash') + +var W = new Array(80) + +function Sha1() { + this.init() + this._w = W + + Hash.call(this, 64, 56) +} + +inherits(Sha1, Hash) + +Sha1.prototype.init = function () { + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 + + return this +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function rol(num, cnt) { + return (num << cnt) | (num >>> (32 - cnt)); +} + +Sha1.prototype._update = function (M) { + var W = this._w + + var a = this._a + var b = this._b + var c = this._c + var d = this._d + var e = this._e + + var j = 0, k + + function calcW() { return rol(W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16], 1) } + function loop(w, f) { + W[j] = w + + var t = rol(a, 5) + f + e + w + k + + e = d + d = c + c = rol(b, 30) + b = a + a = t + j++ + } + + k = 1518500249 + while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d)) + while (j < 20) loop(calcW(), (b & c) | ((~b) & d)) + k = 1859775393 + while (j < 40) loop(calcW(), b ^ c ^ d) + k = -1894007588 + while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d)) + k = -899497514 + while (j < 80) loop(calcW(), b ^ c ^ d) + + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 +} + +Sha1.prototype._hash = function () { + var H = new Buffer(20) + + H.writeInt32BE(this._a|0, 0) + H.writeInt32BE(this._b|0, 4) + H.writeInt32BE(this._c|0, 8) + H.writeInt32BE(this._d|0, 12) + H.writeInt32BE(this._e|0, 16) + + return H +} + +module.exports = Sha1 + diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha224.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha224.js new file mode 100644 index 00000000..b8b4426d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha224.js @@ -0,0 +1,52 @@ +/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ + +var inherits = require('inherits') +var SHA256 = require('./sha256') +var Hash = require('./hash') + +var W = new Array(64) + +function Sha224() { + this.init() + + this._w = W // new Array(64) + + Hash.call(this, 64, 56) +} + +inherits(Sha224, SHA256) + +Sha224.prototype.init = function () { + this._a = 0xc1059ed8|0 + this._b = 0x367cd507|0 + this._c = 0x3070dd17|0 + this._d = 0xf70e5939|0 + this._e = 0xffc00b31|0 + this._f = 0x68581511|0 + this._g = 0x64f98fa7|0 + this._h = 0xbefa4fa4|0 + + return this +} + +Sha224.prototype._hash = function () { + var H = new Buffer(28) + + H.writeInt32BE(this._a, 0) + H.writeInt32BE(this._b, 4) + H.writeInt32BE(this._c, 8) + H.writeInt32BE(this._d, 12) + H.writeInt32BE(this._e, 16) + H.writeInt32BE(this._f, 20) + H.writeInt32BE(this._g, 24) + + return H +} + +module.exports = Sha224 diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha256.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha256.js new file mode 100644 index 00000000..5cdea6b4 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha256.js @@ -0,0 +1,149 @@ +/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ + +var inherits = require('inherits') +var Hash = require('./hash') + +var K = [ + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, + 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, + 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, + 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, + 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, + 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, + 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, + 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, + 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, + 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, + 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, + 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, + 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +] + +var W = new Array(64) + +function Sha256() { + this.init() + + this._w = W // new Array(64) + + Hash.call(this, 64, 56) +} + +inherits(Sha256, Hash) + +Sha256.prototype.init = function () { + this._a = 0x6a09e667|0 + this._b = 0xbb67ae85|0 + this._c = 0x3c6ef372|0 + this._d = 0xa54ff53a|0 + this._e = 0x510e527f|0 + this._f = 0x9b05688c|0 + this._g = 0x1f83d9ab|0 + this._h = 0x5be0cd19|0 + + return this +} + +function S (X, n) { + return (X >>> n) | (X << (32 - n)); +} + +function R (X, n) { + return (X >>> n); +} + +function Ch (x, y, z) { + return ((x & y) ^ ((~x) & z)); +} + +function Maj (x, y, z) { + return ((x & y) ^ (x & z) ^ (y & z)); +} + +function Sigma0256 (x) { + return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); +} + +function Sigma1256 (x) { + return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); +} + +function Gamma0256 (x) { + return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); +} + +function Gamma1256 (x) { + return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); +} + +Sha256.prototype._update = function(M) { + var W = this._w + + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 + var f = this._f | 0 + var g = this._g | 0 + var h = this._h | 0 + + var j = 0 + + function calcW() { return Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] } + function loop(w) { + W[j] = w + + var T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w + var T2 = Sigma0256(a) + Maj(a, b, c); + + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++ + } + + while (j < 16) loop(M.readInt32BE(j * 4)) + while (j < 64) loop(calcW()) + + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 + this._f = (f + this._f) | 0 + this._g = (g + this._g) | 0 + this._h = (h + this._h) | 0 +}; + +Sha256.prototype._hash = function () { + var H = new Buffer(32) + + H.writeInt32BE(this._a, 0) + H.writeInt32BE(this._b, 4) + H.writeInt32BE(this._c, 8) + H.writeInt32BE(this._d, 12) + H.writeInt32BE(this._e, 16) + H.writeInt32BE(this._f, 20) + H.writeInt32BE(this._g, 24) + H.writeInt32BE(this._h, 28) + + return H +} + +module.exports = Sha256 diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha384.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha384.js new file mode 100644 index 00000000..5966e5d8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha384.js @@ -0,0 +1,56 @@ +var inherits = require('inherits') +var SHA512 = require('./sha512'); +var Hash = require('./hash') + +var W = new Array(160) + +function Sha384() { + this.init() + this._w = W + + Hash.call(this, 128, 112) +} + +inherits(Sha384, SHA512) + +Sha384.prototype.init = function () { + this._a = 0xcbbb9d5d|0 + this._b = 0x629a292a|0 + this._c = 0x9159015a|0 + this._d = 0x152fecd8|0 + this._e = 0x67332667|0 + this._f = 0x8eb44a87|0 + this._g = 0xdb0c2e0d|0 + this._h = 0x47b5481d|0 + + this._al = 0xc1059ed8|0 + this._bl = 0x367cd507|0 + this._cl = 0x3070dd17|0 + this._dl = 0xf70e5939|0 + this._el = 0xffc00b31|0 + this._fl = 0x68581511|0 + this._gl = 0x64f98fa7|0 + this._hl = 0xbefa4fa4|0 + + return this +} + +Sha384.prototype._hash = function () { + var H = new Buffer(48) + + function writeInt64BE(h, l, offset) { + H.writeInt32BE(h, offset) + H.writeInt32BE(l, offset + 4) + } + + writeInt64BE(this._a, this._al, 0) + writeInt64BE(this._b, this._bl, 8) + writeInt64BE(this._c, this._cl, 16) + writeInt64BE(this._d, this._dl, 24) + writeInt64BE(this._e, this._el, 32) + writeInt64BE(this._f, this._fl, 40) + + return H +} + +module.exports = Sha384 diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha512.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha512.js new file mode 100644 index 00000000..0bfa0e0f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/sha512.js @@ -0,0 +1,245 @@ +var inherits = require('inherits') +var Hash = require('./hash') + +var K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +] + +var W = new Array(160) + +function Sha512() { + this.init() + this._w = W + + Hash.call(this, 128, 112) +} + +inherits(Sha512, Hash) + +Sha512.prototype.init = function () { + this._a = 0x6a09e667|0 + this._b = 0xbb67ae85|0 + this._c = 0x3c6ef372|0 + this._d = 0xa54ff53a|0 + this._e = 0x510e527f|0 + this._f = 0x9b05688c|0 + this._g = 0x1f83d9ab|0 + this._h = 0x5be0cd19|0 + + this._al = 0xf3bcc908|0 + this._bl = 0x84caa73b|0 + this._cl = 0xfe94f82b|0 + this._dl = 0x5f1d36f1|0 + this._el = 0xade682d1|0 + this._fl = 0x2b3e6c1f|0 + this._gl = 0xfb41bd6b|0 + this._hl = 0x137e2179|0 + + return this +} + +function S (X, Xl, n) { + return (X >>> n) | (Xl << (32 - n)) +} + +function Ch (x, y, z) { + return ((x & y) ^ ((~x) & z)); +} + +function Maj (x, y, z) { + return ((x & y) ^ (x & z) ^ (y & z)); +} + +Sha512.prototype._update = function(M) { + var W = this._w + + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 + var f = this._f | 0 + var g = this._g | 0 + var h = this._h | 0 + + var al = this._al | 0 + var bl = this._bl | 0 + var cl = this._cl | 0 + var dl = this._dl | 0 + var el = this._el | 0 + var fl = this._fl | 0 + var gl = this._gl | 0 + var hl = this._hl | 0 + + var i = 0, j = 0 + var Wi, Wil + function calcW() { + var x = W[j - 15*2] + var xl = W[j - 15*2 + 1] + var gamma0 = S(x, xl, 1) ^ S(x, xl, 8) ^ (x >>> 7) + var gamma0l = S(xl, x, 1) ^ S(xl, x, 8) ^ S(xl, x, 7) + + x = W[j - 2*2] + xl = W[j - 2*2 + 1] + var gamma1 = S(x, xl, 19) ^ S(xl, x, 29) ^ (x >>> 6) + var gamma1l = S(xl, x, 19) ^ S(x, xl, 29) ^ S(xl, x, 6) + + // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] + var Wi7 = W[j - 7*2] + var Wi7l = W[j - 7*2 + 1] + + var Wi16 = W[j - 16*2] + var Wi16l = W[j - 16*2 + 1] + + Wil = gamma0l + Wi7l + Wi = gamma0 + Wi7 + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0) + Wil = Wil + gamma1l + Wi = Wi + gamma1 + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0) + Wil = Wil + Wi16l + Wi = Wi + Wi16 + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0) + } + + function loop() { + W[j] = Wi + W[j + 1] = Wil + + var maj = Maj(a, b, c) + var majl = Maj(al, bl, cl) + + var sigma0h = S(a, al, 28) ^ S(al, a, 2) ^ S(al, a, 7) + var sigma0l = S(al, a, 28) ^ S(a, al, 2) ^ S(a, al, 7) + var sigma1h = S(e, el, 14) ^ S(e, el, 18) ^ S(el, e, 9) + var sigma1l = S(el, e, 14) ^ S(el, e, 18) ^ S(e, el, 9) + + // t1 = h + sigma1 + ch + K[i] + W[i] + var Ki = K[j] + var Kil = K[j + 1] + + var ch = Ch(e, f, g) + var chl = Ch(el, fl, gl) + + var t1l = hl + sigma1l + var t1 = h + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0) + t1l = t1l + chl + t1 = t1 + ch + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0) + t1l = t1l + Kil + t1 = t1 + Ki + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0) + t1l = t1l + Wil + t1 = t1 + Wi + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0) + + // t2 = sigma0 + maj + var t2l = sigma0l + majl + var t2 = sigma0h + maj + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0) + + h = g + hl = gl + g = f + gl = fl + f = e + fl = el + el = (dl + t1l) | 0 + e = (d + t1 + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0 + d = c + dl = cl + c = b + cl = bl + b = a + bl = al + al = (t1l + t2l) | 0 + a = (t1 + t2 + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0 + + i++ + j += 2 + } + + while (i < 16) { + Wi = M.readInt32BE(j * 4) + Wil = M.readInt32BE(j * 4 + 4) + + loop() + } + + while (i < 80) { + calcW() + loop() + } + + this._al = (this._al + al) | 0 + this._bl = (this._bl + bl) | 0 + this._cl = (this._cl + cl) | 0 + this._dl = (this._dl + dl) | 0 + this._el = (this._el + el) | 0 + this._fl = (this._fl + fl) | 0 + this._gl = (this._gl + gl) | 0 + this._hl = (this._hl + hl) | 0 + + this._a = (this._a + a + ((this._al >>> 0) < (al >>> 0) ? 1 : 0)) | 0 + this._b = (this._b + b + ((this._bl >>> 0) < (bl >>> 0) ? 1 : 0)) | 0 + this._c = (this._c + c + ((this._cl >>> 0) < (cl >>> 0) ? 1 : 0)) | 0 + this._d = (this._d + d + ((this._dl >>> 0) < (dl >>> 0) ? 1 : 0)) | 0 + this._e = (this._e + e + ((this._el >>> 0) < (el >>> 0) ? 1 : 0)) | 0 + this._f = (this._f + f + ((this._fl >>> 0) < (fl >>> 0) ? 1 : 0)) | 0 + this._g = (this._g + g + ((this._gl >>> 0) < (gl >>> 0) ? 1 : 0)) | 0 + this._h = (this._h + h + ((this._hl >>> 0) < (hl >>> 0) ? 1 : 0)) | 0 +} + +Sha512.prototype._hash = function () { + var H = new Buffer(64) + + function writeInt64BE(h, l, offset) { + H.writeInt32BE(h, offset) + H.writeInt32BE(l, offset + 4) + } + + writeInt64BE(this._a, this._al, 0) + writeInt64BE(this._b, this._bl, 8) + writeInt64BE(this._c, this._cl, 16) + writeInt64BE(this._d, this._dl, 24) + writeInt64BE(this._e, this._el, 32) + writeInt64BE(this._f, this._fl, 40) + writeInt64BE(this._g, this._gl, 48) + writeInt64BE(this._h, this._hl, 56) + + return H +} + +module.exports = Sha512 diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/test/hash.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/test/hash.js new file mode 100644 index 00000000..6a369cde --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/test/hash.js @@ -0,0 +1,95 @@ +var hexpp = require('../hexpp').defaults({bigendian: false}) +var tape = require('tape') +var Hash = require('../hash') + +var hex = '0A1B2C3D4E5F6G7H', hexbuf +function equal(t, a, b) { + t.equal(a.length, b.length) + for(var i = 0; i < a.length; i++) + t.equal(a[i], b[i]) +} + +var count16 = { + strings: ['0A1B2C3D4E5F6G7H'], + buffers: [ + hexbuf = new Buffer([ + 48, 65, 49, 66, 50, 67, 51, 68, + 52, 69, 53, 70, 54, 71, 55, 72 + ]), + new Buffer([ + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 128 + ]) + ] + } +var empty = { + strings: [''], + buffers: [ + new Buffer([ + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 + ]) + ] + } +var hh = 'abcdefhijklmnopq' + +var multi = { + strings: ['abcd', 'efhijk', 'lmnopq'], + buffers: [ + new Buffer('abcdefhijklmnopq', 'ascii'), + new Buffer([ + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 128 + ]) + ] + } + +var long = { + strings: [hex+hex], + buffers: [ + hexbuf, + hexbuf, + new Buffer([ + 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0 + ]) + ] + } + +function makeTest(name, data) { + tape(name, function (t) { + + var h = new Hash(16, 8) + var hash = new Buffer(20) + var n = 2 + var expected = data.buffers.slice() + //t.plan(expected.length + 1) + h._update = function (block) { + var e = expected.shift() + console.log('---block---') + console.log(hexpp(block), block.length) + console.log('---e---') + console.log(hexpp(e), block.length) + console.log(block) + equal(t, block, e) + if(n < 0) + throw new Error('expecting only 2 calls to _update') + + return hash + } + + data.strings.forEach(function (string) { + h.update(string, 'ascii') + }) + + equal(t, h.digest(), hash) + t.end() + + }) +} + +makeTest('Hash#update 1 in 1', count16) +makeTest('empty Hash#update', empty) +makeTest('Hash#update 1 in 3', multi) +makeTest('Hash#update 2 in 1', long) + diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/test/test.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/test/test.js new file mode 100644 index 00000000..bc2156fe --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/test/test.js @@ -0,0 +1,99 @@ + +var crypto = require('crypto') +var tape = require('tape') +var Sha1 = require('../').sha1 +var Uint32toHex = Sha1.Uint32toHex + +function generateCount (m) { + var s = '' + for(var i = 0; i < m/8; i++) { + console.log('GENERATE', i, Uint32toHex(i)) + s+=i + } + return s +} + +var inputs = [ + ['', 'ascii'], + ['abc', 'ascii'], + ['123', 'ascii'], + ['123456789abcdef123456789abcdef123456789abcdef123456789abcdef', 'ascii'], + ['123456789abcdef123456789abcdef123456789abcdef123456789abc', 'ascii'], + ['123456789abcdef123456789abcdef123456789abcdef123456789ab', 'ascii'], + ['0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde', 'ascii'], + ['0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef', 'ascii'], + ['foobarbaz', 'ascii'] +] + +tape("hash is the same as node's crypto", function (t) { + + inputs.forEach(function (v) { + var a = new Sha1().update(v[0], v[1]).digest('hex') + var e = crypto.createHash('sha1').update(v[0], v[1]).digest('hex') + console.log(a, '==', e) + t.equal(a, e) + }) + + t.end() + +}) + +tape('call update multiple times', function (t) { + var n = 1 + inputs.forEach(function (v) { + var hash = new Sha1() + var _hash = crypto.createHash('sha1') + for(var i = 0; i < v[0].length; i=(i+1)*2) { + var s = v[0].substring(i, (i+1)*2) + hash.update(s, v[1]) + _hash.update(s, v[1]) + } + var a = hash.digest('hex') + var e = _hash.digest('hex') + console.log(a, '==', e) + t.equal(a, e) + }) + t.end() +}) + + +tape('call update twice', function (t) { + + var _hash = crypto.createHash('sha1') + var hash = new Sha1() + + _hash.update('foo', 'ascii') + hash.update('foo', 'ascii') + + _hash.update('bar', 'ascii') + hash.update('bar', 'ascii') + + _hash.update('baz', 'ascii') + hash.update('baz', 'ascii') + + var a = hash.digest('hex') + var e = _hash.digest('hex') + + t.equal(a, e) + t.end() +}) + + +tape('hex encoding', function (t) { + var n = 1 + inputs.forEach(function (v) { + var hash = new Sha1() + var _hash = crypto.createHash('sha1') + for(var i = 0; i < v[0].length; i=(i+1)*2) { + var s = v[0].substring(i, (i+1)*2) + hash.update(new Buffer(s, 'ascii').toString('hex'), 'hex') + _hash.update(new Buffer(s, 'ascii').toString('hex'), 'hex') + } + var a = hash.digest('hex') + var e = _hash.digest('hex') + console.log(a, '==', e) + t.equal(a, e) + }) + t.end() +}) + diff --git a/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/test/vectors.js b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/test/vectors.js new file mode 100644 index 00000000..e1a65ba7 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/node_modules/sha.js/test/vectors.js @@ -0,0 +1,77 @@ + +var vectors = require('hash-test-vectors') +var tape = require('tape') +//var from = require('bops/typedarray/from') +var Buffer = require('buffer').Buffer +var hexpp = require('../hexpp') + +var createHash = require('../') + +function makeTest(alg, i, verbose) { + var v = vectors[i] + + tape(alg + ': NIST vector ' + i, function (t) { + if(verbose) { + console.log(v) + console.log('VECTOR', i) + console.log('INPUT', v.input) + console.log(hexpp(new Buffer(v.input, 'base64'))) + console.log(new Buffer(v.input, 'base64').toString('hex')) + } + var buf = new Buffer(v.input, 'base64') + t.equal(createHash(alg).update(buf).digest('hex'), v[alg]) + + i = ~~(buf.length / 2) + var buf1 = buf.slice(0, i) + var buf2 = buf.slice(i, buf.length) + + console.log(buf1.length, buf2.length, buf.length) + console.log(createHash(alg)._block.length) + + t.equal( + createHash(alg) + .update(buf1) + .update(buf2) + .digest('hex'), + v[alg] + ) + + var j, buf3 + + i = ~~(buf.length / 3) + j = ~~(buf.length * 2 / 3) + buf1 = buf.slice(0, i) + buf2 = buf.slice(i, j) + buf3 = buf.slice(j, buf.length) + + t.equal( + createHash(alg) + .update(buf1) + .update(buf2) + .update(buf3) + .digest('hex'), + v[alg] + ) + + setTimeout(function () { + //avoid "too much recursion" errors in tape in firefox + t.end() + }) + }) + +} + +if(process.argv[2]) + makeTest(process.argv[2], parseInt(process.argv[3]), true) +else + vectors.forEach(function (v, i) { + makeTest('sha', i) + makeTest('sha1', i) + makeTest('sha224', i) + makeTest('sha256', i) + makeTest('sha384', i) + makeTest('sha512', i) + }) + + + diff --git a/node_modules/crypto-browserify/node_modules/create-hash/package.json b/node_modules/crypto-browserify/node_modules/create-hash/package.json new file mode 100644 index 00000000..99ca0444 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/package.json @@ -0,0 +1,72 @@ +{ + "name": "create-hash", + "version": "1.1.1", + "description": "create hashes for browserify", + "browser": "browser.js", + "main": "index.js", + "scripts": { + "test": "node test.js | tspec" + }, + "repository": { + "type": "git", + "url": "git@github.com:crypto-browserify/createHash.git" + }, + "keywords": [ + "crypto" + ], + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/createHash/issues" + }, + "homepage": "https://github.com/crypto-browserify/createHash", + "devDependencies": { + "hash-test-vectors": "^1.3.2", + "tap-spec": "^2.1.2", + "tape": "^3.0.3" + }, + "dependencies": { + "inherits": "^2.0.1", + "ripemd160": "^1.0.0", + "sha.js": "^2.3.6" + }, + "gitHead": "dcc25f9e0b66d07fbf76d13e2616ea4c34cbcc90", + "_id": "create-hash@1.1.1", + "_shasum": "a55424f97b5369bfb2a97e53bd9b7a1aa6dd3a17", + "_from": "create-hash@>=1.1.0 <2.0.0", + "_npmVersion": "2.7.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "dcousens", + "email": "email@dcousens.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "a55424f97b5369bfb2a97e53bd9b7a1aa6dd3a17", + "tarball": "http://registry.npmjs.org/create-hash/-/create-hash-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/create-hash/readme.md b/node_modules/crypto-browserify/node_modules/create-hash/readme.md new file mode 100644 index 00000000..a4a68151 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/readme.md @@ -0,0 +1,19 @@ +create-hash +=== + +[![Build Status](https://travis-ci.org/crypto-browserify/createHash.svg)](https://travis-ci.org/crypto-browserify/createHash) + +Node style hashes for use in the browser, with native hash functions in node. Api is the same as hashes in node: + +```js +var createHash = require('create-hash'); +var hash = createHash('sha224'); +hash.update('synchronous write'); //optional encoding parameter +hash.digest();// synchronously get result with optional encoding parameter + +hash.write('write to it as a stream'); +hash.end();//remember it's a stream +hash.read();//only if you ended it as a stream though +``` + +To get the JavaScript version even in node do `require('create-hash/browser');` \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hash/test.js b/node_modules/crypto-browserify/node_modules/create-hash/test.js new file mode 100644 index 00000000..c326f152 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hash/test.js @@ -0,0 +1,37 @@ +var fs = require('fs') +var test = require('tape') + +var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'] +var encodings = [/*'binary',*/ 'hex', 'base64']; +var vectors = require('hash-test-vectors') + +var createHash = require('./browser') + +algorithms.forEach(function (algorithm) { + test('test ' + algorithm + ' against test vectors', function (t) { + vectors.forEach(function (obj, i) { + var input = new Buffer(obj.input, 'base64') + var node = obj[algorithm] + var js = createHash(algorithm).update(input).digest('hex') + t.equal(js, node, algorithm + '(testVector['+i+']) == ' + node) + }) + + encodings.forEach(function (encoding) { + vectors.forEach(function (obj, i) { + var input = new Buffer(obj.input, 'base64').toString(encoding) + var node = obj[algorithm] + var js = createHash(algorithm).update(input, encoding).digest('hex') + t.equal(js, node, algorithm + '(testVector['+i+'], '+encoding+') == ' + node) + }) + }); + vectors.forEach(function (obj, i) { + var input = new Buffer(obj.input, 'base64') + var node = obj[algorithm] + var hash = createHash(algorithm); + hash.end(input) + var js = hash.read().toString('hex') + t.equal(js, node, algorithm + '(testVector['+i+']) == ' + node) + }) + t.end() + }) +}); diff --git a/node_modules/crypto-browserify/node_modules/create-hmac/.travis.yml b/node_modules/crypto-browserify/node_modules/create-hmac/.travis.yml new file mode 100644 index 00000000..1416d607 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hmac/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.10" + - "0.11" \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hmac/browser.js b/node_modules/crypto-browserify/node_modules/create-hmac/browser.js new file mode 100644 index 00000000..ee7ca231 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hmac/browser.js @@ -0,0 +1,68 @@ +'use strict'; +var createHash = require('create-hash/browser'); +var inherits = require('inherits') + +var Transform = require('stream').Transform + +var ZEROS = new Buffer(128) +ZEROS.fill(0) + +function Hmac(alg, key) { + Transform.call(this) + + if (typeof key === 'string') { + key = new Buffer(key) + } + + var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 + + this._alg = alg + this._key = key + + if (key.length > blocksize) { + key = createHash(alg).update(key).digest() + + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize) + } + + var ipad = this._ipad = new Buffer(blocksize) + var opad = this._opad = new Buffer(blocksize) + + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36 + opad[i] = key[i] ^ 0x5C + } + + this._hash = createHash(alg).update(ipad) +} + +inherits(Hmac, Transform) + +Hmac.prototype.update = function (data, enc) { + this._hash.update(data, enc) + + return this +} + +Hmac.prototype._transform = function (data, _, next) { + this._hash.update(data) + + next() +} + +Hmac.prototype._flush = function (next) { + this.push(this.digest()) + + next() +} + +Hmac.prototype.digest = function (enc) { + var h = this._hash.digest() + + return createHash(this._alg).update(this._opad).update(h).digest(enc) +} + +module.exports = function createHmac(alg, key) { + return new Hmac(alg, key) +} diff --git a/node_modules/crypto-browserify/node_modules/create-hmac/index.js b/node_modules/crypto-browserify/node_modules/create-hmac/index.js new file mode 100644 index 00000000..220908ad --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hmac/index.js @@ -0,0 +1 @@ +module.exports = require('crypto').createHmac; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hmac/package.json b/node_modules/crypto-browserify/node_modules/create-hmac/package.json new file mode 100644 index 00000000..6f0143a2 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hmac/package.json @@ -0,0 +1,71 @@ +{ + "name": "create-hmac", + "version": "1.1.3", + "description": "node style hmacs in the browser", + "main": "index.js", + "scripts": { + "test": "node test.js | tspec" + }, + "repository": { + "type": "git", + "url": "https://github.com/crypto-browserify/createHmac.git" + }, + "keywords": [ + "crypto", + "hmac" + ], + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/createHmac/issues" + }, + "homepage": "https://github.com/crypto-browserify/createHmac", + "devDependencies": { + "hash-test-vectors": "^1.3.2", + "tap-spec": "^2.1.2", + "tape": "^3.0.3" + }, + "dependencies": { + "create-hash": "^1.1.0", + "inherits": "^2.0.1" + }, + "browser": "./browser.js", + "gitHead": "0db078774769487d9ede6951a56c4cffe3de1c14", + "_id": "create-hmac@1.1.3", + "_shasum": "29843e9c191ba412ab001bc55ac8b8b9ae54b670", + "_from": "create-hmac@>=1.1.0 <2.0.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "29843e9c191ba412ab001bc55ac8b8b9ae54b670", + "tarball": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/create-hmac/readme.md b/node_modules/crypto-browserify/node_modules/create-hmac/readme.md new file mode 100644 index 00000000..4e8bda4d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hmac/readme.md @@ -0,0 +1,19 @@ +create-hmac +=== + +[![Build Status](https://travis-ci.org/crypto-browserify/createHmac.svg)](https://travis-ci.org/crypto-browserify/createHmac) + +Node style hmacs for use in the browser, with native hmac functions in node. Api is the same as hmacs in node: + +```js +var createHmac = require('create-hmac'); +var hmac = createHmac('sha224', new Buffer("secret key")); +hmac.update('synchronous write'); //optional encoding parameter +hmac.digest();// synchronously get result with optional encoding parameter + +hmac.write('write to it as a stream'); +hmac.end();//remember it's a stream +hmac.read();//only if you ended it as a stream though +``` + +To get the JavaScript version even in node require `require('create-hmac/browser');` \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/create-hmac/test.js b/node_modules/crypto-browserify/node_modules/create-hmac/test.js new file mode 100644 index 00000000..1c012797 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/create-hmac/test.js @@ -0,0 +1,41 @@ +var test = require('tape') + +var algorithms = ['sha1', 'sha224','sha256', 'sha384', 'sha512', 'md5', 'rmd160'] +var formats = [undefined, 'base64', 'hex', 'binary'] + +var vectors = require('hash-test-vectors/hmac') +var createHmac = require('./browser') +algorithms.forEach(function (alg) { + vectors.forEach(function (input) { + var key = new Buffer(input.key, 'hex') + var inputBuffer = new Buffer(input.data, 'hex') + + formats.forEach(function (format) { + test('hmac(' + alg + ') w/ ' + input.data.slice(0, 6) + '... as ' + format, function (t) { + var hmac = createHmac(alg, key) + + var formattedInput = format ? inputBuffer.toString(format) : inputBuffer + hmac.update(formattedInput, format) + + var formattedOutput = hmac.digest(format) + var output = new Buffer(formattedOutput, format) + + var truncated = input.truncate ? output.slice(0, input.truncate) : output + t.equal(truncated.toString('hex'), input[alg]) + t.end() + }) + }) + }) + + vectors.forEach(function (input) { + test('hmac(' + alg + ') as stream w/ ' + input.data.slice(0, 6) + '...', function (t) { + var hmac = createHmac(alg, new Buffer(input.key, 'hex')) + hmac.end(input.data, 'hex') + + var output = hmac.read() + var truncated = input.truncate ? output.slice(0, input.truncate) : output + t.equal(truncated.toString('hex'), input[alg]) + t.end() + }) + }) +}) diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/.npmignore b/node_modules/crypto-browserify/node_modules/diffie-hellman/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/.travis.yml b/node_modules/crypto-browserify/node_modules/diffie-hellman/.travis.yml new file mode 100644 index 00000000..18ae2d89 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.11" + - "0.10" diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/browser.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/browser.js new file mode 100644 index 00000000..ba0d9038 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/browser.js @@ -0,0 +1,40 @@ +var generatePrime = require('./lib/generatePrime'); +var primes = require('./lib/primes'); + +var DH = require('./lib/dh'); + +function getDiffieHellman(mod) { + var prime = new Buffer(primes[mod].prime, 'hex'); + var gen = new Buffer(primes[mod].gen, 'hex'); + + return new DH(prime, gen); +} + +function createDiffieHellman(prime, enc, generator, genc) { + if (Buffer.isBuffer(enc) || (typeof enc === 'string' && ['hex', 'binary', 'base64'].indexOf(enc) === -1)) { + genc = generator; + generator = enc; + enc = undefined; + } + + enc = enc || 'binary'; + genc = genc || 'binary'; + generator = generator || new Buffer([2]); + + if (!Buffer.isBuffer(generator)) { + generator = new Buffer(generator, genc); + } + + if (typeof prime === 'number') { + return new DH(generatePrime(prime, generator), generator, true); + } + + if (!Buffer.isBuffer(prime)) { + prime = new Buffer(prime, enc); + } + + return new DH(prime, generator, true); +} + +exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman; +exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman; diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/index.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/index.js new file mode 100644 index 00000000..6a2b03d2 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/index.js @@ -0,0 +1,10 @@ +var crypto = require('crypto'); + +//getDiffieHellman +exports.DiffieHellmanGroup = crypto.DiffieHellmanGroup; +exports.createDiffieHellmanGroup = crypto.createDiffieHellmanGroup; +exports.getDiffieHellman = crypto.getDiffieHellman; + +//createDiffieHellman +exports.createDiffieHellman = crypto.createDiffieHellman; +exports.DiffieHellman = crypto.DiffieHellman; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/dh.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/dh.js new file mode 100644 index 00000000..ad7807b6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/dh.js @@ -0,0 +1,167 @@ +var BN = require('bn.js'); +var MillerRabin = require('miller-rabin'); +var millerRabin = new MillerRabin(); +var TWENTYFOUR = new BN(24); +var ELEVEN = new BN(11); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var primes = require('./generatePrime'); +var randomBytes = require('randombytes'); +module.exports = DH; + +function setPublicKey(pub, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(pub)) { + pub = new Buffer(pub, enc); + } + this._pub = new BN(pub); + return this; +} + +function setPrivateKey(priv, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(priv)) { + priv = new Buffer(priv, enc); + } + this._priv = new BN(priv); + return this; +} + +var primeCache = {}; +function checkPrime(prime, generator) { + var gen = generator.toString('hex'); + var hex = [gen, prime.toString(16)].join('_'); + if (hex in primeCache) { + return primeCache[hex]; + } + var error = 0; + + if (prime.isEven() || + !primes.simpleSieve || + !primes.fermatTest(prime) || + !millerRabin.test(prime)) { + //not a prime so +1 + error += 1; + + if (gen === '02' || gen === '05') { + // we'd be able to check the generator + // it would fail so +8 + error += 8; + } else { + //we wouldn't be able to test the generator + // so +4 + error += 4; + } + primeCache[hex] = error; + return error; + } + if (!millerRabin.test(prime.shrn(1))) { + //not a safe prime + error += 2; + } + var rem; + switch (gen) { + case '02': + if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) { + // unsuidable generator + error += 8; + } + break; + case '05': + rem = prime.mod(TEN); + if (rem.cmp(THREE) && rem.cmp(SEVEN)) { + // prime mod 10 needs to equal 3 or 7 + error += 8; + } + break; + default: + error += 4; + } + primeCache[hex] = error; + return error; +} + +function defineError (self, error) { + try { + Object.defineProperty(self, 'verifyError', { + enumerable: true, + value: error, + writable: false + }); + } catch(e) { + self.verifyError = error; + } +} +function DH(prime, generator, malleable) { + this.setGenerator(generator); + this.__prime = new BN(prime); + this._prime = BN.mont(this.__prime); + this._primeLen = prime.length; + this._pub = void 0; + this._priv = void 0; + + if (malleable) { + this.setPublicKey = setPublicKey; + this.setPrivateKey = setPrivateKey; + defineError(this, checkPrime(this.__prime, generator)); + } else { + defineError(this, 8); + } +} + +DH.prototype.generateKeys = function () { + if (!this._priv) { + this._priv = new BN(randomBytes(this._primeLen)); + } + this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(); + return this.getPublicKey(); +}; + +DH.prototype.computeSecret = function (other) { + other = new BN(other); + other = other.toRed(this._prime); + var secret = other.redPow(this._priv).fromRed(); + var out = new Buffer(secret.toArray()); + var prime = this.getPrime(); + if (out.length < prime.length) { + var front = new Buffer(prime.length - out.length); + front.fill(0); + out = Buffer.concat([front, out]); + } + return out; +}; + +DH.prototype.getPublicKey = function getPublicKey(enc) { + return formatReturnValue(this._pub, enc); +}; + +DH.prototype.getPrivateKey = function getPrivateKey(enc) { + return formatReturnValue(this._priv, enc); +}; + +DH.prototype.getPrime = function (enc) { + return formatReturnValue(this.__prime, enc); +}; + +DH.prototype.getGenerator = function (enc) { + return formatReturnValue(this._gen, enc); +}; + +DH.prototype.setGenerator = function (gen, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(gen)) { + gen = new Buffer(gen, enc); + } + this._gen = new BN(gen); + return this; +}; + +function formatReturnValue(bn, enc) { + var buf = new Buffer(bn.toArray()); + if (!enc) { + return buf; + } else { + return buf.toString(enc); + } +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/generatePrime.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/generatePrime.js new file mode 100644 index 00000000..248b5b1e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/generatePrime.js @@ -0,0 +1,132 @@ +var randomBytes = require('randombytes'); +module.exports = findPrime; +findPrime.simpleSieve = simpleSieve; +findPrime.fermatTest = fermatTest; +var BN = require('bn.js'); +var TWENTYFOUR = new BN(24); +var MillerRabin = require('miller-rabin'); +var millerRabin = new MillerRabin(); +var ONE = new BN(1); +var TWO = new BN(2); +var FIVE = new BN(5); +var SIXTEEN = new BN(16); +var EIGHT = new BN(8); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var ELEVEN = new BN(11); +var FOUR = new BN(4); +var TWELVE = new BN(12); +var primes = null; + +function _getPrimes() { + if (primes !== null) + return primes; + + var limit = 0x100000; + var res = []; + res[0] = 2; + for (var i = 1, k = 3; k < limit; k += 2) { + var sqrt = Math.ceil(Math.sqrt(k)); + for (var j = 0; j < i && res[j] <= sqrt; j++) + if (k % res[j] === 0) + break; + + if (i !== j && res[j] <= sqrt) + continue; + + res[i++] = k; + } + primes = res; + return res; +} + +function simpleSieve(p) { + var primes = _getPrimes(); + + for (var i = 0; i < primes.length; i++) + if (p.modn(primes[i]) === 0) { + if (p.cmpn(primes[i]) === 0) { + return true; + } else { + return false; + } + } + + return true; +} + +function fermatTest(p) { + var red = BN.mont(p); + return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0; +} + +function findPrime(bits, gen) { + if (bits < 16) { + // this is what openssl does + if (gen === 2 || gen === 5) { + return new BN([0x8c, 0x7b]); + } else { + return new BN([0x8c, 0x27]); + } + } + gen = new BN(gen); + var runs, comp; + function generateRandom(bits) { + runs = -1; + var out = new BN(randomBytes(Math.ceil(bits / 8))); + while (out.bitLength() > bits) { + out.ishrn(1); + } + if (out.isEven()) { + out.iadd(ONE); + } + if (!out.testn(1)) { + out.iadd(TWO); + } + if (!gen.cmp(TWO)) { + while (out.mod(TWENTYFOUR).cmp(ELEVEN)) { + out.iadd(FOUR); + } + comp = { + major: [TWENTYFOUR], + minor: [TWELVE] + }; + } else if (!gen.cmp(FIVE)) { + rem = out.mod(TEN); + while (rem.cmp(THREE)) { + out.iadd(FOUR); + rem = out.mod(TEN); + } + comp = { + major: [FOUR, SIXTEEN], + minor: [TWO, EIGHT] + }; + } else { + comp = { + major: [FOUR], + minor: [TWO] + }; + } + return out; + } + var num = generateRandom(bits); + + var n2 = num.shrn(1); + + while (true) { + while (num.bitLength() > bits) { + num = generateRandom(bits); + n2 = num.shrn(1); + } + runs++; + if (simpleSieve(n2) && simpleSieve(num) && + fermatTest(n2) && fermatTest(num) && + millerRabin.test(n2) && millerRabin.test(num)) { + return num; + } + num.iadd(comp.major[runs%comp.major.length]); + n2.iadd(comp.minor[runs%comp.minor.length]); + } + +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/primes.json b/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/primes.json new file mode 100644 index 00000000..9fef6c96 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/lib/primes.json @@ -0,0 +1,34 @@ +{ + "modp1": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff" + }, + "modp2": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff" + }, + "modp5": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff" + }, + "modp14": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff" + }, + "modp15": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff" + }, + "modp16": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff" + }, + "modp17": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff" + }, + "modp18": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff" + } +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/.jshintrc b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/.jshintrc new file mode 100644 index 00000000..add7282d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/.jshintrc @@ -0,0 +1,89 @@ +{ + // JSHint Default Configuration File (as on JSHint website) + // See http://jshint.com/docs/ for more details + + "maxerr" : 50, // {int} Maximum error before stopping + + // Enforcing + "bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.) + "camelcase" : true, // true: Identifiers must be in camelCase + "curly" : false, // true: Require {} for every new block or scope + "eqeqeq" : true, // true: Require triple equals (===) for comparison + "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() + "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. + "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` + "indent" : 2, // {int} Number of spaces to use for indentation + "latedef" : false, // true: Require variables/functions to be defined before being used + "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` + "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` + "noempty" : false, // true: Prohibit use of empty blocks + "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. + "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) + "plusplus" : false, // true: Prohibit use of `++` & `--` + "quotmark" : "single", // Quotation mark consistency: + // false : do nothing (default) + // true : ensure whatever is used is consistent + // "single" : require single quotes + // "double" : require double quotes + "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) + "unused" : true, // true: Require all defined variables be used + "strict" : true, // true: Requires all functions run in ES5 Strict Mode + "maxparams" : false, // {int} Max number of formal params allowed per function + "maxdepth" : false, // {int} Max depth of nested blocks (within functions) + "maxstatements" : false, // {int} Max number statements per function + "maxcomplexity" : false, // {int} Max cyclomatic complexity per function + "maxlen" : false, // {int} Max number of characters per line + + // Relaxing + "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) + "boss" : false, // true: Tolerate assignments where comparisons would be expected + "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // true: Tolerate use of `== null` + "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) + "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`) + "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) + // (ex: `for each`, multiple try/catch, function expression…) + "evil" : false, // true: Tolerate use of `eval` and `new Function()` + "expr" : false, // true: Tolerate `ExpressionStatement` as Programs + "funcscope" : false, // true: Tolerate defining variables inside control statements + "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') + "iterator" : false, // true: Tolerate using the `__iterator__` property + "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block + "laxbreak" : false, // true: Tolerate possibly unsafe line breakings + "laxcomma" : false, // true: Tolerate comma-first style coding + "loopfunc" : false, // true: Tolerate functions being defined in loops + "multistr" : false, // true: Tolerate multi-line strings + "noyield" : false, // true: Tolerate generator functions with no yield statement in them. + "notypeof" : false, // true: Tolerate invalid typeof operator values + "proto" : false, // true: Tolerate using the `__proto__` property + "scripturl" : false, // true: Tolerate script-targeted URLs + "shadow" : true, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` + "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation + "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` + "validthis" : false, // true: Tolerate using this in a non-constructor function + + // Environments + "browser" : true, // Web Browser (window, document, etc) + "browserify" : false, // Browserify (node.js code in the browser) + "couch" : false, // CouchDB + "devel" : true, // Development/debugging (alert, confirm, etc) + "dojo" : false, // Dojo Toolkit + "jasmine" : false, // Jasmine + "jquery" : false, // jQuery + "mocha" : true, // Mocha + "mootools" : false, // MooTools + "node" : false, // Node.js + "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) + "prototypejs" : false, // Prototype and Scriptaculous + "qunit" : false, // QUnit + "rhino" : false, // Rhino + "shelljs" : false, // ShellJS + "worker" : false, // Web Workers + "wsh" : false, // Windows Scripting Host + "yui" : false, // Yahoo User Interface + + // Custom Globals + "globals" : { + "module": true + } // additional predefined global variables +} diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/.npmignore b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/.npmignore new file mode 100644 index 00000000..bfd1047d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/.npmignore @@ -0,0 +1,3 @@ +benchmarks/ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/.travis.yml b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/.travis.yml new file mode 100644 index 00000000..92a990f6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.11" +branches: + only: + - master diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/README.md b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/README.md new file mode 100644 index 00000000..3d970712 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/README.md @@ -0,0 +1,28 @@ +# bn.js [![Build Status](https://secure.travis-ci.org/indutny/bn.js.png)](http://travis-ci.org/indutny/bn.js) + +Just a bike-shed. + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2015. + +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/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js new file mode 100644 index 00000000..7ed21368 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js @@ -0,0 +1,2133 @@ +(function(module, exports) { + +'use strict'; + +// Utils + +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} + +// Could use `inherits` module, but don't want to move from single file +// architecture yet. +function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; +} + +// BN + +function BN(number, base, endian) { + // May be `new BN(bn)` ? + if (number !== null && + typeof number === 'object' && + Array.isArray(number.words)) { + return number; + } + + this.sign = false; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + if (number !== null) + this._init(number || 0, base || 10, endian || 'be'); +} +if (typeof module === 'object') + module.exports = BN; +else + exports.BN = BN; + +BN.BN = BN; +BN.wordSize = 26; + +BN.prototype._init = function init(number, base, endian) { + if (typeof number === 'number') { + if (number < 0) { + this.sign = true; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } + return; + } else if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + if (base === 'hex') + base = 16; + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') + start++; + + if (base === 16) + this._parseHex(number, start); + else + this._parseBase(number, base, start); + + if (number[0] === '-') + this.sign = true; + + this.strip(); +}; + +BN.prototype._initArray = function _initArray(number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + var off = 0; + if (endian === 'be') { + for (var i = number.length - 1, j = 0; i >= 0; i -= 3) { + var w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (var i = 0, j = 0; i < number.length; i += 3) { + var w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); +}; + +function parseHex(str, start, end) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r <<= 4; + + // 'a' - 'f' + if (c >= 49 && c <= 54) + r |= c - 49 + 0xa; + + // 'A' - 'F' + else if (c >= 17 && c <= 22) + r |= c - 17 + 0xa; + + // '0' - '9' + else + r |= c & 0xf; + } + return r; +} + +BN.prototype._parseHex = function _parseHex(number, start) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + // Scan 24-bit chunks and add them to the number + var off = 0; + for (var i = number.length - 6, j = 0; i >= start; i -= 6) { + var w = parseHex(number, i, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + if (i + 6 !== start) { + var w = parseHex(number, start, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + } + this.strip(); +}; + +function parseBase(str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) + r += c - 49 + 0xa; + + // 'A' + else if (c >= 17) + r += c - 17 + 0xa; + + // '0' - '9' + else + r += c; + } + return r; +} + +BN.prototype._parseBase = function _parseBase(number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) + limbLen++; + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } + + if (mod !== 0) { + var pow = 1; + var word = parseBase(number, i, number.length, base); + + for (var i = 0; i < mod; i++) + pow *= base; + this.imuln(pow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } +}; + +BN.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + dest.words[i] = this.words[i]; + dest.length = this.length; + dest.sign = this.sign; + dest.red = this.red; +}; + +BN.prototype.clone = function clone() { + var r = new BN(null); + this.copy(r); + return r; +}; + +// Remove leading `0` from `this` +BN.prototype.strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) + this.length--; + return this._normSign(); +}; + +BN.prototype._normSign = function _normSign() { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) + this.sign = false; + return this; +}; + +BN.prototype.inspect = function inspect() { + return (this.red ? ''; +}; + +/* + +var zeros = []; +var groupSizes = []; +var groupBases = []; + +var s = ''; +var i = -1; +while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; +} +groupSizes[0] = 0; +groupSizes[1] = 0; +groupBases[0] = 0; +groupBases[1] = 0; +var base = 2 - 1; +while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; +} + +*/ + +var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' +]; + +var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +]; + +var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 +]; + +BN.prototype.toString = function toString(base, padding) { + base = base || 10; + if (base === 16 || base === 'hex') { + var out = ''; + var off = 0; + var padding = padding | 0 || 1; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) + out = zeros[6 - word.length] + word + out; + else + out = word + out; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) + out = carry.toString(16) + out; + while (out.length % padding !== 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + var out = ''; + var c = this.clone(); + c.sign = false; + while (c.cmpn(0) !== 0) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (c.cmpn(0) !== 0) + out = zeros[groupSize - r.length] + r + out; + else + out = r + out; + } + if (this.cmpn(0) === 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else { + assert(false, 'Base should be between 2 and 36'); + } +}; + +BN.prototype.toJSON = function toJSON() { + return this.toString(16); +}; + +BN.prototype.toArray = function toArray() { + this.strip(); + var res = new Array(this.byteLength()); + res[0] = 0; + + var q = this.clone(); + for (var i = 0; q.cmpn(0) !== 0; i++) { + var b = q.andln(0xff); + q.ishrn(8); + + // Assume big-endian + res[res.length - i - 1] = b; + } + + return res; +}; + +/* +function genCountBits(bits) { + var arr = []; + + for (var i = bits - 1; i >= 0; i--) { + var bit = '0x' + (1 << i).toString(16); + arr.push('w >= ' + bit + ' ? ' + (i + 1)); + } + + return new Function('w', 'return ' + arr.join(' :\n') + ' :\n0;'); +}; + +BN.prototype._countBits = genCountBits(26); +*/ + +// Sadly chrome apps could not contain `new Function()` calls +BN.prototype._countBits = function _countBits(w) { + return w >= 0x2000000 ? 26 : + w >= 0x1000000 ? 25 : + w >= 0x800000 ? 24 : + w >= 0x400000 ? 23 : + w >= 0x200000 ? 22 : + w >= 0x100000 ? 21 : + w >= 0x80000 ? 20 : + w >= 0x40000 ? 19 : + w >= 0x20000 ? 18 : + w >= 0x10000 ? 17 : + w >= 0x8000 ? 16 : + w >= 0x4000 ? 15 : + w >= 0x2000 ? 14 : + w >= 0x1000 ? 13 : + w >= 0x800 ? 12 : + w >= 0x400 ? 11 : + w >= 0x200 ? 10 : + w >= 0x100 ? 9 : + w >= 0x80 ? 8 : + w >= 0x40 ? 7 : + w >= 0x20 ? 6 : + w >= 0x10 ? 5 : + w >= 0x8 ? 4 : + w >= 0x4 ? 3 : + w >= 0x2 ? 2 : + w >= 0x1 ? 1 : + 0; +}; + +// Return number of used bits in a BN +BN.prototype.bitLength = function bitLength() { + var hi = 0; + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; +}; + +BN.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); +}; + +// Return negative clone of `this` +BN.prototype.neg = function neg() { + if (this.cmpn(0) === 0) + return this.clone(); + + var r = this.clone(); + r.sign = !this.sign; + return r; +}; + + +// Or `num` with `this` in-place +BN.prototype.ior = function ior(num) { + this.sign = this.sign || num.sign; + + while (this.length < num.length) + this.words[this.length++] = 0; + + for (var i = 0; i < num.length; i++) + this.words[i] = this.words[i] | num.words[i]; + + return this.strip(); +}; + + +// Or `num` with `this` +BN.prototype.or = function or(num) { + if (this.length > num.length) + return this.clone().ior(num); + else + return num.clone().ior(this); +}; + + +// And `num` with `this` in-place +BN.prototype.iand = function iand(num) { + this.sign = this.sign && num.sign; + + // b = min-length(num, this) + var b; + if (this.length > num.length) + b = num; + else + b = this; + + for (var i = 0; i < b.length; i++) + this.words[i] = this.words[i] & num.words[i]; + + this.length = b.length; + + return this.strip(); +}; + + +// And `num` with `this` +BN.prototype.and = function and(num) { + if (this.length > num.length) + return this.clone().iand(num); + else + return num.clone().iand(this); +}; + + +// Xor `num` with `this` in-place +BN.prototype.ixor = function ixor(num) { + this.sign = this.sign || num.sign; + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) + this.words[i] = a.words[i] ^ b.words[i]; + + if (this !== a) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + + this.length = a.length; + + return this.strip(); +}; + + +// Xor `num` with `this` +BN.prototype.xor = function xor(num) { + if (this.length > num.length) + return this.clone().ixor(num); + else + return num.clone().ixor(this); +}; + + +// Set `bit` of `this` +BN.prototype.setn = function setn(bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + while (this.length <= off) + this.words[this.length++] = 0; + + if (val) + this.words[off] = this.words[off] | (1 << wbit); + else + this.words[off] = this.words[off] & ~(1 << wbit); + + return this.strip(); +}; + + +// Add `num` to `this` in-place +BN.prototype.iadd = function iadd(num) { + // negative + positive + if (this.sign && !num.sign) { + this.sign = false; + var r = this.isub(num); + this.sign = !this.sign; + return this._normSign(); + + // positive + negative + } else if (!this.sign && num.sign) { + num.sign = false; + var r = this.isub(num); + num.sign = true; + return r._normSign(); + } + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] + b.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) + this.words[i] = a.words[i]; + } + + return this; +}; + +// Add `num` to `this` +BN.prototype.add = function add(num) { + if (num.sign && !this.sign) { + num.sign = false; + var res = this.sub(num); + num.sign = true; + return res; + } else if (!num.sign && this.sign) { + this.sign = false; + var res = num.sub(this); + this.sign = true; + return res; + } + + if (this.length > num.length) + return this.clone().iadd(num); + else + return num.clone().iadd(this); +}; + +// Subtract `num` from `this` in-place +BN.prototype.isub = function isub(num) { + // this - (-num) = this + num + if (num.sign) { + num.sign = false; + var r = this.iadd(num); + num.sign = true; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.sign) { + this.sign = false; + this.iadd(num); + this.sign = true; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.sign = false; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a; + var b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] - b.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + this.length = Math.max(this.length, i); + + if (a !== this) + this.sign = true; + + return this.strip(); +}; + +// Subtract `num` from `this` +BN.prototype.sub = function sub(num) { + return this.clone().isub(num); +}; + +/* +// NOTE: This could be potentionally used to generate loop-less multiplications +function _genCombMulTo(alen, blen) { + var len = alen + blen - 1; + var src = [ + 'var a = this.words, b = num.words, o = out.words, c = 0, w, ' + + 'mask = 0x3ffffff, shift = 0x4000000;', + 'out.length = ' + len + ';' + ]; + for (var k = 0; k < len; k++) { + var minJ = Math.max(0, k - alen + 1); + var maxJ = Math.min(k, blen - 1); + + for (var j = minJ; j <= maxJ; j++) { + var i = k - j; + var mul = 'a[' + i + '] * b[' + j + ']'; + + if (j === minJ) { + src.push('w = ' + mul + ' + c;'); + src.push('c = (w / shift) | 0;'); + } else { + src.push('w += ' + mul + ';'); + src.push('c += (w / shift) | 0;'); + } + src.push('w &= mask;'); + } + src.push('o[' + k + '] = w;'); + } + src.push('if (c !== 0) {', + ' o[' + k + '] = c;', + ' out.length++;', + '}', + 'return out;'); + + return src.join('\n'); +} +*/ + +BN.prototype._smallMulTo = function _smallMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + } + out.words[k] = rword; + carry = ncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype._bigMulTo = function _bigMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype.mulTo = function mulTo(num, out) { + var res; + if (this.length + num.length < 63) + res = this._smallMulTo(num, out); + else + res = this._bigMulTo(num, out); + return res; +}; + +// Multiply `this` by `num` +BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); +}; + +// In-place Multiplication +BN.prototype.imul = function imul(num) { + if (this.cmpn(0) === 0 || num.cmpn(0) === 0) { + this.words[0] = 0; + this.length = 1; + return this; + } + + var tlen = this.length; + var nlen = num.length; + + this.sign = num.sign !== this.sign; + this.length = this.length + num.length; + this.words[this.length - 1] = 0; + + for (var k = this.length - 2; k >= 0; k--) { + // Sum all words with the same `i + j = k` and accumulate `carry`, + // note that carry could be >= 0x3ffffff + var carry = 0; + var rword = 0; + var maxJ = Math.min(k, nlen - 1); + for (var j = Math.max(0, k - tlen + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i]; + var b = num.words[j]; + var r = a * b; + + var lo = r & 0x3ffffff; + carry += (r / 0x4000000) | 0; + lo += rword; + rword = lo & 0x3ffffff; + carry += lo >>> 26; + } + this.words[k] = rword; + this.words[k + 1] += carry; + carry = 0; + } + + // Propagate overflows + var carry = 0; + for (var i = 1; i < this.length; i++) { + var w = this.words[i] + carry; + this.words[i] = w & 0x3ffffff; + carry = w >>> 26; + } + + return this.strip(); +}; + +BN.prototype.imuln = function imuln(num) { + assert(typeof num === 'number'); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i] * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; +}; + +// `this` * `this` +BN.prototype.sqr = function sqr() { + return this.mul(this); +}; + +// `this` * `this` in-place +BN.prototype.isqr = function isqr() { + return this.mul(this); +}; + +// Shift-left in-place +BN.prototype.ishln = function ishln(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + + if (r !== 0) { + var carry = 0; + for (var i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = (this.words[i] - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (var i = this.length - 1; i >= 0; i--) + this.words[i + s] = this.words[i]; + for (var i = 0; i < s; i++) + this.words[i] = 0; + this.length += s; + } + + return this.strip(); +}; + +// Shift-right in-place +// NOTE: `hint` is a lowest bit before trailing zeroes +// NOTE: if `extended` is true - { lo: ..., hi: } object will be returned +BN.prototype.ishrn = function ishrn(bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + if (hint) + hint = (hint - (hint % 26)) / 26; + else + hint = 0; + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + hint -= s; + hint = Math.max(0, hint); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) + maskedWords.words[i] = this.words[i]; + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (var i = 0; i < this.length; i++) + this.words[i] = this.words[i + s]; + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (var i = this.length - 1; i >= 0 && (carry !== 0 || i >= hint); i--) { + var word = this.words[i]; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) + maskedWords.words[maskedWords.length++] = carry; + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + this.strip(); + if (extended) + return { hi: this, lo: maskedWords }; + + return this; +}; + +// Shift-left +BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); +}; + +// Shift-right +BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); +}; + +// Test if n bit is set +BN.prototype.testn = function testn(bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + return false; + } + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); +}; + +// Return only lowers bits of number (in-place) +BN.prototype.imaskn = function imaskn(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(!this.sign, 'imaskn works only with positive numbers'); + + if (r !== 0) + s++; + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); +}; + +// Return only lowers bits of number +BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); +}; + +// Add plain number `num` to `this` +BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.isubn(-num); + + // Possible sign change + if (this.sign) { + if (this.length === 1 && this.words[0] < num) { + this.words[0] = num - this.words[0]; + this.sign = false; + return this; + } + + this.sign = false; + this.isubn(num); + this.sign = true; + return this; + } + + // Add without checks + return this._iaddn(num); +}; + +BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) + this.words[i + 1] = 1; + else + this.words[i + 1]++; + } + this.length = Math.max(this.length, i + 1); + + return this; +}; + +// Subtract plain number `num` from `this` +BN.prototype.isubn = function isubn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.iaddn(-num); + + if (this.sign) { + this.sign = false; + this.iaddn(num); + this.sign = true; + return this; + } + + this.words[0] -= num; + + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + + return this.strip(); +}; + +BN.prototype.addn = function addn(num) { + return this.clone().iaddn(num); +}; + +BN.prototype.subn = function subn(num) { + return this.clone().isubn(num); +}; + +BN.prototype.iabs = function iabs() { + this.sign = false; + + return this; +}; + +BN.prototype.abs = function abs() { + return this.clone().iabs(); +}; + +BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) { + // Bigger storage is needed + var len = num.length + shift; + var i; + if (this.words.length < len) { + var t = new Array(len); + for (var i = 0; i < this.length; i++) + t[i] = this.words[i]; + this.words = t; + } else { + i = this.length; + } + + // Zeroify rest + this.length = Math.max(this.length, len); + for (; i < this.length; i++) + this.words[i] = 0; + + var carry = 0; + for (var i = 0; i < num.length; i++) { + var w = this.words[i + shift] + carry; + var right = num.words[i] * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + var w = this.words[i + shift] + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) + return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (var i = 0; i < this.length; i++) { + var w = -this.words[i] + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.sign = true; + + return this.strip(); +}; + +BN.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1]; + for (var shift = 0; bhi < 0x2000000; shift++) + bhi <<= 1; + if (shift !== 0) { + b = b.shln(shift); + a.ishln(shift); + bhi = b.words[b.length - 1]; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) + q.words[i] = 0; + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (!diff.sign) { + a = diff; + if (q) + q.words[m] = 1; + } + + for (var j = m - 1; j >= 0; j--) { + var qj = a.words[b.length + j] * 0x4000000 + a.words[b.length + j - 1]; + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.sign) { + qj--; + a.sign = false; + a._ishlnsubmul(b, 1, j); + a.sign = !a.sign; + } + if (q) + q.words[j] = qj; + } + if (q) + q.strip(); + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) + a.ishrn(shift); + return { div: q ? q : null, mod: a }; +}; + +BN.prototype.divmod = function divmod(num, mode) { + assert(num.cmpn(0) !== 0); + + if (this.sign && !num.sign) { + var res = this.neg().divmod(num, mode); + var div; + var mod; + if (mode !== 'mod') + div = res.div.neg(); + if (mode !== 'div') + mod = res.mod.cmpn(0) === 0 ? res.mod : num.sub(res.mod); + return { + div: div, + mod: mod + }; + } else if (!this.sign && num.sign) { + var res = this.divmod(num.neg(), mode); + var div; + if (mode !== 'mod') + div = res.div.neg(); + return { div: div, mod: res.mod }; + } else if (this.sign && num.sign) { + return this.neg().divmod(num.neg(), mode); + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) + return { div: new BN(0), mod: this }; + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') + return { div: this.divn(num.words[0]), mod: null }; + else if (mode === 'mod') + return { div: null, mod: new BN(this.modn(num.words[0])) }; + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); +}; + +// Find `this` / `num` +BN.prototype.div = function div(num) { + return this.divmod(num, 'div').div; +}; + +// Find `this` % `num` +BN.prototype.mod = function mod(num) { + return this.divmod(num, 'mod').mod; +}; + +// Find Round(`this` / `num`) +BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.cmpn(0) === 0) + return dm.div; + + var mod = dm.div.sign ? dm.mod.isub(num) : dm.mod; + + var half = num.shrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) + return dm.div; + + // Round up + return dm.div.sign ? dm.div.isubn(1) : dm.div.iaddn(1); +}; + +BN.prototype.modn = function modn(num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) + acc = (p * acc + this.words[i]) % num; + + return acc; +}; + +// In-place division by number +BN.prototype.idivn = function idivn(num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = this.words[i] + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); +}; + +BN.prototype.divn = function divn(num) { + return this.clone().idivn(num); +}; + +BN.prototype._egcd = function _egcd(x1, p) { + assert(!p.sign); + assert(p.cmpn(0) !== 0); + + var a = this; + var b = p.clone(); + + if (a.sign) + a = a.mod(p); + else + a = a.clone(); + + var x2 = new BN(0); + while (b.isEven()) + b.ishrn(1); + var delta = b.clone(); + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + while (a.isEven()) { + a.ishrn(1); + if (x1.isEven()) + x1.ishrn(1); + else + x1.iadd(delta).ishrn(1); + } + while (b.isEven()) { + b.ishrn(1); + if (x2.isEven()) + x2.ishrn(1); + else + x2.iadd(delta).ishrn(1); + } + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + if (a.cmpn(1) === 0) + return x1; + else + return x2; +}; + +BN.prototype.gcd = function gcd(num) { + if (this.cmpn(0) === 0) + return num.clone(); + if (num.cmpn(0) === 0) + return this.clone(); + + var a = this.clone(); + var b = num.clone(); + a.sign = false; + b.sign = false; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.ishrn(1); + b.ishrn(1); + } + + while (a.isEven()) + a.ishrn(1); + + do { + while (b.isEven()) + b.ishrn(1); + + // Swap `a` and `b` to make `a` always bigger than `b` + if (a.cmp(b) < 0) { + var t = a; + a = b; + b = t; + } + a.isub(a.div(b).mul(b)); + } while (a.cmpn(0) !== 0 && b.cmpn(0) !== 0); + if (a.cmpn(0) === 0) + return b.ishln(shift); + else + return a.ishln(shift); +}; + +// Invert number in the field F(num) +BN.prototype.invm = function invm(num) { + return this._egcd(new BN(1), num).mod(num); +}; + +BN.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; +}; + +BN.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; +}; + +// And first word and num +BN.prototype.andln = function andln(num) { + return this.words[0] & num; +}; + +// Increment at the bit position in-line +BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + for (var i = this.length; i < s + 1; i++) + this.words[i] = 0; + this.words[s] |= q; + this.length = s + 1; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i]; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; +}; + +BN.prototype.cmpn = function cmpn(num) { + var sign = num < 0; + if (sign) + num = -num; + + if (this.sign && !sign) + return -1; + else if (!this.sign && sign) + return 1; + + num &= 0x3ffffff; + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + var w = this.words[0]; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.sign) + res = -res; + return res; +}; + +// Compare two numbers and return: +// 1 - if `this` > `num` +// 0 - if `this` == `num` +// -1 - if `this` < `num` +BN.prototype.cmp = function cmp(num) { + if (this.sign && !num.sign) + return -1; + else if (!this.sign && num.sign) + return 1; + + var res = this.ucmp(num); + if (this.sign) + return -res; + else + return res; +}; + +// Unsigned comparison +BN.prototype.ucmp = function ucmp(num) { + // At this point both numbers have the same sign + if (this.length > num.length) + return 1; + else if (this.length < num.length) + return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i]; + var b = num.words[i]; + + if (a === b) + continue; + if (a < b) + res = -1; + else if (a > b) + res = 1; + break; + } + return res; +}; + +// +// A reduce context, could be using montgomery or something better, depending +// on the `m` itself. +// +BN.red = function red(num) { + return new Red(num); +}; + +BN.prototype.toRed = function toRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(!this.sign, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); +}; + +BN.prototype.fromRed = function fromRed() { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); +}; + +BN.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; +}; + +BN.prototype.forceRed = function forceRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); +}; + +BN.prototype.redAdd = function redAdd(num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); +}; + +BN.prototype.redIAdd = function redIAdd(num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); +}; + +BN.prototype.redSub = function redSub(num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); +}; + +BN.prototype.redISub = function redISub(num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); +}; + +BN.prototype.redShl = function redShl(num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); +}; + +BN.prototype.redMul = function redMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); +}; + +BN.prototype.redIMul = function redIMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); +}; + +BN.prototype.redSqr = function redSqr() { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); +}; + +BN.prototype.redISqr = function redISqr() { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); +}; + +// Square root over p +BN.prototype.redSqrt = function redSqrt() { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); +}; + +BN.prototype.redInvm = function redInvm() { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); +}; + +// Return negative clone of `this` % `red modulo` +BN.prototype.redNeg = function redNeg() { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); +}; + +BN.prototype.redPow = function redPow(num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); +}; + +// Prime numbers with efficient reduction +var primes = { + k256: null, + p224: null, + p192: null, + p25519: null +}; + +// Pseudo-Mersenne prime +function MPrime(name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).ishln(this.n).isub(this.p); + + this.tmp = this._tmp(); +} + +MPrime.prototype._tmp = function _tmp() { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; +}; + +MPrime.prototype.ireduce = function ireduce(num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + var pair = r.ishrn(this.n, 0, this.tmp); + r = this.imulK(pair.hi); + r = r.iadd(pair.lo); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.cmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + r.strip(); + } + + return r; +}; + +MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); +}; + +function K256() { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); +} +inherits(K256, MPrime); + +K256.prototype.imulK = function imulK(num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var hi; + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i]; + hi = w * 0x40; + lo += w * 0x3d1; + hi += (lo / 0x4000000) | 0; + lo &= 0x3ffffff; + + num.words[i] = lo; + + lo = hi; + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) + num.length--; + } + return num; +}; + +function P224() { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); +} +inherits(P224, MPrime); + +function P192() { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); +} +inherits(P192, MPrime); + +function P25519() { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); +} +inherits(P25519, MPrime); + +P25519.prototype.imulK = function imulK(num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = num.words[i] * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) + num.words[num.length++] = carry; + return num; +}; + +// Exported mostly for testing purposes, use plain name instead +BN._prime = function prime(name) { + // Cached version of prime + if (primes[name]) + return primes[name]; + + var prime; + if (name === 'k256') + prime = new K256(); + else if (name === 'p224') + prime = new P224(); + else if (name === 'p192') + prime = new P192(); + else if (name === 'p25519') + prime = new P25519(); + else + throw new Error('Unknown prime ' + name); + primes[name] = prime; + + return prime; +}; + +// +// Base reduction engine +// +function Red(m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + this.m = m; + this.prime = null; + } +} + +Red.prototype._verify1 = function _verify1(a) { + assert(!a.sign, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); +}; + +Red.prototype._verify2 = function _verify2(a, b) { + assert(!a.sign && !b.sign, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); +}; + +Red.prototype.imod = function imod(a) { + if (this.prime) + return this.prime.ireduce(a)._forceRed(this); + return a.mod(this.m)._forceRed(this); +}; + +Red.prototype.neg = function neg(a) { + var r = a.clone(); + r.sign = !r.sign; + return r.iadd(this.m)._forceRed(this); +}; + +Red.prototype.add = function add(a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res._forceRed(this); +}; + +Red.prototype.iadd = function iadd(a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res; +}; + +Red.prototype.sub = function sub(a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res._forceRed(this); +}; + +Red.prototype.isub = function isub(a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res; +}; + +Red.prototype.shl = function shl(a, num) { + this._verify1(a); + return this.imod(a.shln(num)); +}; + +Red.prototype.imul = function imul(a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); +}; + +Red.prototype.mul = function mul(a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); +}; + +Red.prototype.isqr = function isqr(a) { + return this.imul(a, a); +}; + +Red.prototype.sqr = function sqr(a) { + return this.mul(a, a); +}; + +Red.prototype.sqrt = function sqrt(a) { + if (a.cmpn(0) === 0) + return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).ishrn(2); + var r = this.pow(a, pow); + return r; + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (q.cmpn(0) !== 0 && q.andln(1) === 0) { + s++; + q.ishrn(1); + } + assert(q.cmpn(0) !== 0); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).ishrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + while (this.pow(z, lpow).cmp(nOne) !== 0) + z.redIAdd(nOne); + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).ishrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) + tmp = tmp.redSqr(); + assert(i < m); + var b = this.pow(c, new BN(1).ishln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; +}; + +Red.prototype.invm = function invm(a) { + var inv = a._egcd(new BN(1), this.m); + if (inv.sign) { + inv.sign = false; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } +}; + +Red.prototype.pow = function pow(a, num) { + var w = []; + var q = num.clone(); + while (q.cmpn(0) !== 0) { + w.push(q.andln(1)); + q.ishrn(1); + } + + // Skip leading zeroes + var res = a; + for (var i = 0; i < w.length; i++, res = this.sqr(res)) + if (w[i] !== 0) + break; + + if (++i < w.length) { + for (var q = this.sqr(res); i < w.length; i++, q = this.sqr(q)) { + if (w[i] === 0) + continue; + res = this.mul(res, q); + } + } + + return res; +}; + +Red.prototype.convertTo = function convertTo(num) { + return num.clone(); +}; + +Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; +}; + +// +// Montgomery method engine +// + +BN.mont = function mont(num) { + return new Mont(num); +}; + +function Mont(m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) + this.shift += 26 - (this.shift % 26); + this.r = new BN(1).ishln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r.invm(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv.sign = true; + this.minv = this.minv.mod(this.r); +} +inherits(Mont, Red); + +Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.shln(this.shift)); +}; + +Mont.prototype.convertFrom = function convertFrom(num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; +}; + +Mont.prototype.imul = function imul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.mul = function mul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) + return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.invm = function invm(a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a.invm(this.m).mul(this.r2)); + return res._forceRed(this); +}; + +})(typeof module === 'undefined' || module, this); diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/package.json b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/package.json new file mode 100644 index 00000000..37475efb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/package.json @@ -0,0 +1,56 @@ +{ + "name": "bn.js", + "version": "1.3.0", + "description": "Big number implementation in pure javascript", + "main": "lib/bn.js", + "scripts": { + "test": "jshint lib/*.js && mocha --reporter=spec test/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/bn.js" + }, + "keywords": [ + "BN", + "BigNum", + "Big number", + "Modulo", + "Montgomery" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/bn.js/issues" + }, + "homepage": "https://github.com/indutny/bn.js", + "devDependencies": { + "jshint": "^2.6.0", + "mocha": "^2.1.0" + }, + "gitHead": "3d156a29566f2172b39ebcc0ec00cc3af4c205f8", + "_id": "bn.js@1.3.0", + "_shasum": "0db4cbf96f8f23b742f5bcb9d1aa7a9994a05e83", + "_from": "bn.js@>=1.0.0 <2.0.0", + "_npmVersion": "2.4.1", + "_nodeVersion": "1.1.0", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "0db4cbf96f8f23b742f5bcb9d1aa7a9994a05e83", + "tarball": "http://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/bn-test.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/bn-test.js new file mode 100644 index 00000000..c53ac5f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/bn-test.js @@ -0,0 +1,506 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN', function() { + it('should work with Number input', function() { + assert.equal(new BN(12345).toString(16), '3039'); + assert.equal(new BN(0x4123456).toString(16), '4123456'); + }); + + it('should work with String input', function() { + assert.equal(new BN('29048849665247').toString(16), + '1a6b765d8cdf'); + assert.equal(new BN('-29048849665247').toString(16), + '-1a6b765d8cdf'); + assert.equal(new BN('1A6B765D8CDF', 16).toString(16), + '1a6b765d8cdf'); + assert.equal(new BN('FF', 16).toString(), '255'); + assert.equal(new BN('1A6B765D8CDF', 16).toString(), + '29048849665247'); + assert.equal(new BN('a89c e5af8724 c0a23e0e 0ff77500', 16).toString(16), + 'a89ce5af8724c0a23e0e0ff77500'); + assert.equal(new BN('123456789abcdef123456789abcdef123456789abcdef', + 16).toString(16), + '123456789abcdef123456789abcdef123456789abcdef'); + assert.equal(new BN('10654321').toString(), '10654321'); + assert.equal(new BN('10000000000000000').toString(10), + '10000000000000000'); + var base2 = '11111111111111111111111111111111111111111111111111111'; + assert.equal(new BN(base2, 2).toString(2), base2); + var base36 = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'; + assert.equal(new BN(base36, 36).toString(36), base36); + + assert( + new BN('6582018229284824168619876730229320890292528855852623664389292032') + .words[0] < 0x4000000); + }); + + it('should import/export big endian', function() { + assert.equal(new BN([1,2,3]).toString(16), '10203'); + assert.equal(new BN([1,2,3,4]).toString(16), '1020304'); + assert.equal(new BN([1,2,3,4,5]).toString(16), '102030405'); + assert.equal(new BN([1,2,3,4,5,6,7,8]).toString(16), '102030405060708'); + assert.equal(new BN([1,2,3,4]).toArray().join(','), '1,2,3,4'); + assert.equal(new BN([1,2,3,4,5,6,7,8]).toArray().join(','), + '1,2,3,4,5,6,7,8'); + }); + + it('should import little endian', function() { + assert.equal(new BN([1,2,3], 10, 'le').toString(16), '30201'); + assert.equal(new BN([1,2,3,4], 10, 'le').toString(16), '4030201'); + assert.equal(new BN([1,2,3,4,5], 10, 'le').toString(16), '504030201'); + assert.equal(new BN([1,2,3,4,5,6,7,8], 10, 'le').toString(16), '807060504030201'); + }); + + it('should return proper bitLength', function() { + assert.equal(new BN(0).bitLength(), 0); + assert.equal(new BN(0x1).bitLength(), 1); + assert.equal(new BN(0x2).bitLength(), 2); + assert.equal(new BN(0x3).bitLength(), 2); + assert.equal(new BN(0x4).bitLength(), 3); + assert.equal(new BN(0x8).bitLength(), 4); + assert.equal(new BN(0x10).bitLength(), 5); + assert.equal(new BN(0x100).bitLength(), 9); + assert.equal(new BN(0x123456).bitLength(), 21); + assert.equal(new BN('123456789', 16).bitLength(), 33); + assert.equal(new BN('8023456789', 16).bitLength(), 40); + }); + + it('should add numbers', function() { + assert.equal(new BN(14).add(new BN(26)).toString(16), '28'); + var k = new BN(0x1234); + var r = k; + for (var i = 0; i < 257; i++) + r = r.add(k); + assert.equal(r.toString(16), '125868'); + + var k = new BN('abcdefabcdefabcdef', 16); + var r = new BN('deadbeef', 16); + for (var i = 0; i < 257; i++) + r.iadd(k); + assert.equal(r.toString(16), 'ac79bd9b79be7a277bde'); + }); + + describe('hex padding', function(){ + it('should have length of 8 from leading 15', function(){ + var a = new BN('ffb9602', 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 8); + }); + + it('should have length of 8 from leading zero', function(){ + var a = new BN('fb9604', 16); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 8 from leading zeros', function(){ + var a = new BN(0); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 64 from leading 15', function(){ + var a = new BN( + 'ffb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 64); + }); + + it('should have length of 64 from leading zero', function(){ + var a = new BN( + 'fb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 64), 'hex'); + assert.equal(a.toString('hex', 64).length, 64); + }); + }); + + describe('iaddn', function() { + it('should allow a sign change', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.iaddn(200) + + assert.equal(a.sign, false) + assert.equal(a.toString(), '100') + }) + }) + + it('should subtract numbers', function() { + assert.equal(new BN(14).sub(new BN(26)).toString(16), '-c'); + assert.equal(new BN(26).sub(new BN(14)).toString(16), 'c'); + assert.equal(new BN(26).sub(new BN(26)).toString(16), '0'); + assert.equal(new BN(-26).sub(new BN(26)).toString(16), '-34'); + + var a = new BN( + '31ff3c61db2db84b9823d320907a573f6ad37c437abe458b1802cda041d6384' + + 'a7d8daef41395491e2', + 16); + var b = new BN( + '6f0e4d9f1d6071c183677f601af9305721c91d31b0bbbae8fb790000', + 16); + var r = new BN( + '31ff3c61db2db84b9823d3208989726578fd75276287cd9516533a9acfb9a67' + + '76281f34583ddb91e2', + 16); + assert.equal(a.sub(b).cmp(r), 0); + + // In-place + assert.equal(b.clone().isub(a).neg().cmp(r), 0); + + var r = b.sub(new BN(14)); + assert.equal(b.clone().isubn(14).cmp(r), 0); + + var r = new BN( + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b', 16); + assert.equal(r.isubn(-1).toString(16), + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681c'); + + // Carry and copy + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(a.isub(b).toString(16), '-fffffffedcbb'); + + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(b.isub(a).toString(16), 'fffffffedcbb'); + }); + + describe('isubn', function() { + it('should work for positive numbers', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.isubn(200) + assert.equal(a.sign, true) + assert.equal(a.toString(), '-300') + }) + + it('should not allow a sign change', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.isubn(-200); + assert.equal(a.sign, false) + assert.equal(a.toString(), '100') + }) + }) + + it('should mul numbers', function() { + assert.equal(new BN(0x1001).mul(new BN(0x1234)).toString(16), + '1235234'); + assert.equal(new BN(-0x1001).mul(new BN(0x1234)).toString(16), + '-1235234'); + assert.equal(new BN(-0x1001).mul(new BN(-0x1234)).toString(16), + '1235234'); + var n = new BN(0x1001); + var r = n; + for (var i = 0; i < 4; i++) + r = r.mul(n); + assert.equal(r.toString(16), + '100500a00a005001'); + + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal(n.mul(n).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40'); + assert.equal(n.mul(n).mul(n).toString(16), + '1b888e01a06e974017a28a5b4da436169761c9730b7aeedf75fc60f687b' + + '46e0cf2cb11667f795d5569482640fe5f628939467a01a612b02350' + + '0d0161e9730279a7561043af6197798e41b7432458463e64fa81158' + + '907322dc330562697d0d600'); + + assert.equal( + new BN('-100000000000').mul(new BN('3').div(new BN('4'))).toString(16), + '0' + ); + }); + + it('should regress mul big numbers', function() { + var q = fixtures.dhGroups.p17.q; + var qs = fixtures.dhGroups.p17.qs; + + var q = new BN(q, 16); + assert.equal(q.sqr().toString(16), qs); + }); + + it('should imul numbers', function() { + var a = new BN('abcdef01234567890abcd', 16); + var b = new BN('deadbeefa551edebabba8', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + + var a = new BN('abcdef01234567890abcd214a25123f512361e6d236', 16); + var b = new BN('deadbeefa551edebabba8121234fd21bac0341324dd', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + }); + + it('should div numbers', function() { + assert.equal(new BN('10').div(new BN(256)).toString(16), + '0'); + assert.equal(new BN('69527932928').div(new BN('16974594')).toString(16), + 'fff'); + assert.equal(new BN('-69527932928').div(new BN('16974594')).toString(16), + '-fff'); + + var b = new BN( + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40', + 16); + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal(b.div(n).toString(16), n.toString(16)); + + assert.equal(new BN('1').div(new BN('-5')).toString(10), '0'); + + // Regression after moving to word div + var p = new BN( + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + 16); + var a = new BN( + '79be667e f9dcbbac 55a06295 ce870b07 029bfcdb 2dce28d9 59f2815b 16f81798', + 16); + var as = a.sqr(); + assert.equal( + as.div(p).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729e58090b9'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.div(p).toString(16), + 'ffffffff00000002000000000000000000000001000000000000000000000001'); + }); + + it('should mod numbers', function() { + assert.equal(new BN('10').mod(new BN(256)).toString(16), + 'a'); + assert.equal(new BN('69527932928').mod(new BN('16974594')).toString(16), + '102f302'); + assert.equal(new BN('-69527932928').mod(new BN('16974594')).toString(16), + '1000'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.mod(p).toString(16), + '0'); + }); + + it('should divRound numbers', function() { + assert.equal(new BN(9).divRound(new BN(20)).toString(10), + '0'); + assert.equal(new BN(10).divRound(new BN(20)).toString(10), + '1'); + assert.equal(new BN(150).divRound(new BN(20)).toString(10), + '8'); + assert.equal(new BN(149).divRound(new BN(20)).toString(10), + '7'); + assert.equal(new BN(149).divRound(new BN(17)).toString(10), + '9'); + assert.equal(new BN(144).divRound(new BN(17)).toString(10), + '8'); + assert.equal(new BN(-144).divRound(new BN(17)).toString(10), + '-8'); + }); + + it('should absolute numbers', function() { + assert.equal(new BN(0x1001).abs().toString(), '4097'); + assert.equal(new BN(-0x1001).abs().toString(), '4097'); + assert.equal(new BN('ffffffff', 16).abs().toString(), '4294967295'); + }) + + it('should modn numbers', function() { + assert.equal(new BN('10', 16).modn(256).toString(16), '10'); + assert.equal(new BN('100', 16).modn(256).toString(16), '0'); + assert.equal(new BN('1001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(257).toString(16), + new BN('100000000001', 16).mod(new BN(257)).toString(16)); + assert.equal(new BN('123456789012', 16).modn(3).toString(16), + new BN('123456789012', 16).mod(new BN(3)).toString(16)); + }); + + it('should idivn numbers', function() { + assert.equal(new BN('10', 16).idivn(3).toString(16), '5'); + assert.equal(new BN('12', 16).idivn(3).toString(16), '6'); + assert.equal(new BN('10000000000000000').idivn(3).toString(10), + '3333333333333333'); + assert.equal(new BN('100000000000000000000000000000').idivn(3).toString(10), + '33333333333333333333333333333'); + + var t = new BN(3); + assert.equal(new BN('12345678901234567890123456', 16).idivn(3).toString(16), + new BN('12345678901234567890123456', 16).div(t).toString(16)); + }); + + it('should shl numbers', function() { + assert.equal(new BN('69527932928').shln(13).toString(16), + '2060602000000'); + assert.equal(new BN('69527932928').shln(45).toString(16), + '206060200000000000000'); + }); + + it('should shr numbers', function() { + assert.equal(new BN('69527932928').shrn(13).toString(16), + '818180'); + assert.equal(new BN('69527932928').shrn(17).toString(16), + '81818'); + assert.equal(new BN('69527932928').shrn(256).toString(16), + '0'); + }); + + it('should invm numbers', function() { + var p = new BN(257); + var a = new BN(3); + var b = a.invm(p); + assert.equal(a.mul(b).mod(p).toString(16), '1'); + + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var a = new BN('deadbeef', 16); + var b = a.invm(p192); + assert.equal(a.mul(b).mod(p192).toString(16), '1'); + + // Even base + var phi = new BN('872d9b030ba368706b68932cf07a0e0c', 16); + var e = new BN(65537); + var d = e.invm(phi); + assert.equal(e.mul(d).mod(phi).toString(16), '1'); + }); + + it('should support bincn', function() { + assert.equal(new BN(0).bincn(1).toString(16), '2'); + assert.equal(new BN(2).bincn(1).toString(16), '4'); + assert.equal(new BN(2).bincn(1).bincn(1).toString(16), + new BN(2).bincn(2).toString(16)); + assert.equal(new BN(0xffffff).bincn(1).toString(16), '1000001'); + }); + + it('should support imaskn', function() { + assert.equal(new BN(0).imaskn(1).toString(16), '0'); + assert.equal(new BN(3).imaskn(1).toString(16), '1'); + assert.equal(new BN('123456789', 16).imaskn(4).toString(16), '9'); + assert.equal(new BN('123456789', 16).imaskn(16).toString(16), '6789'); + assert.equal(new BN('123456789', 16).imaskn(28).toString(16), '3456789'); + }); + + it('should support testn', function() { + [ + 'ff', + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' + ].forEach(function(hex) { + var bn = new BN(hex, 16) + var bl = bn.bitLength() + + for (var i = 0; i < bl; ++i) { + assert.equal(bn.testn(i), true); + } + + // test off the end + assert.equal(bn.testn(bl), false); + }) + + var xbits = [ + '01111001010111001001000100011101110100111011000110001110010111011001010', + '01110000000010110001111010101111100111110010001111000001001011010100111', + '01000101001100010001101001011110100001001111100110001110010111' + ].join('') + + var x = new BN( + '23478905234580795234378912401239784125643978256123048348957342' + ) + for (var i = 0; i < x.bitLength(); ++i) { + assert.equal(x.testn(i), (xbits.charAt(i) === '1'), 'Failed @ bit ' + i) + } + }); + + it('should support gcd', function() { + assert.equal(new BN(3).gcd(new BN(2)).toString(16), '1'); + assert.equal(new BN(18).gcd(new BN(12)).toString(16), '6'); + assert.equal(new BN(-18).gcd(new BN(12)).toString(16), '6'); + }); + + it('should and numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .and(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + }); + it('should iand numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .iand(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + assert.equal(new BN('1000000000000000000000000000000000000001', 2) + .iand(new BN('1', 2)) + .toString(2), '1') + assert.equal(new BN('1', 2) + .iand(new BN('1000000000000000000000000000000000000001', 2)) + .toString(2), '1') + }); + it('should or numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .or(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + }); + it('should ior numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .ior(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + assert.equal(new BN('1000000000000000000000000000000000000000', 2) + .ior(new BN('1', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + assert.equal(new BN('1', 2) + .ior(new BN('1000000000000000000000000000000000000000', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + }); + it('should xor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .xor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + }); + it('should ixor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1', 2)) + .toString(2), '11001100110011001100110011001101'); + assert.equal(new BN('1', 2) + .ixor(new BN('11001100110011001100110011001100', 2)) + .toString(2), '11001100110011001100110011001101'); + }); + + it('should allow single bits to be set', function () { + assert.equal(new BN(0).setn(2, true).toString(2), '100'); + assert.equal(new BN(0).setn(27, true).toString(2), + '1000000000000000000000000000'); + assert.equal(new BN('1000000000000000000000000001', 2).setn(27, false) + .toString(2), '1'); + assert.equal(new BN('101', 2).setn(2, false).toString(2), '1'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/fixtures.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/fixtures.js new file mode 100644 index 00000000..29442d92 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/fixtures.js @@ -0,0 +1,264 @@ +exports.dhGroups = { + p16: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199' + + 'ffffffffffffffff', + priv: '6d5923e6449122cbbcc1b96093e0b7e4fd3e469f58daddae' + + '53b49b20664f4132675df9ce98ae0cfdcac0f4181ccb643b' + + '625f98104dcf6f7d8e81961e2cab4b5014895260cb977c7d' + + '2f981f8532fb5da60b3676dfe57f293f05d525866053ac7e' + + '65abfd19241146e92e64f309a97ef3b529af4d6189fa416c' + + '9e1a816c3bdf88e5edf48fbd8233ef9038bb46faa95122c0' + + '5a426be72039639cd2d53d37254b3d258960dcb33c255ede' + + '20e9d7b4b123c8b4f4b986f53cdd510d042166f7dd7dca98' + + '7c39ab36381ba30a5fdd027eb6128d2ef8e5802a2194d422' + + 'b05fe6e1cb4817789b923d8636c1ec4b7601c90da3ddc178' + + '52f59217ae070d87f2e75cbfb6ff92430ad26a71c8373452' + + 'ae1cc5c93350e2d7b87e0acfeba401aaf518580937bf0b6c' + + '341f8c49165a47e49ce50853989d07171c00f43dcddddf72' + + '94fb9c3f4e1124e98ef656b797ef48974ddcd43a21fa06d0' + + '565ae8ce494747ce9e0ea0166e76eb45279e5c6471db7df8' + + 'cc88764be29666de9c545e72da36da2f7a352fb17bdeb982' + + 'a6dc0193ec4bf00b2e533efd6cd4d46e6fb237b775615576' + + 'dd6c7c7bbc087a25e6909d1ebc6e5b38e5c8472c0fc429c6' + + 'f17da1838cbcd9bbef57c5b5522fd6053e62ba21fe97c826' + + 'd3889d0cc17e5fa00b54d8d9f0f46fb523698af965950f4b' + + '941369e180f0aece3870d9335f2301db251595d173902cad' + + '394eaa6ffef8be6c', + pub: 'd53703b7340bc89bfc47176d351e5cf86d5a18d9662eca3c' + + '9759c83b6ccda8859649a5866524d77f79e501db923416ca' + + '2636243836d3e6df752defc0fb19cc386e3ae48ad647753f' + + 'bf415e2612f8a9fd01efe7aca249589590c7e6a0332630bb' + + '29c5b3501265d720213790556f0f1d114a9e2071be3620bd' + + '4ee1e8bb96689ac9e226f0a4203025f0267adc273a43582b' + + '00b70b490343529eaec4dcff140773cd6654658517f51193' + + '13f21f0a8e04fe7d7b21ffeca85ff8f87c42bb8d9cb13a72' + + 'c00e9c6e9dfcedda0777af951cc8ccab90d35e915e707d8e' + + '4c2aca219547dd78e9a1a0730accdc9ad0b854e51edd1e91' + + '4756760bab156ca6e3cb9c625cf0870def34e9ac2e552800' + + 'd6ce506d43dbbc75acfa0c8d8fb12daa3c783fb726f187d5' + + '58131779239c912d389d0511e0f3a81969d12aeee670e48f' + + 'ba41f7ed9f10705543689c2506b976a8ffabed45e33795b0' + + '1df4f6b993a33d1deab1316a67419afa31fbb6fdd252ee8c' + + '7c7d1d016c44e3fcf6b41898d7f206aa33760b505e4eff2e' + + 'c624bc7fe636b1d59e45d6f904fc391419f13d1f0cdb5b6c' + + '2378b09434159917dde709f8a6b5dc30994d056e3f964371' + + '11587ac7af0a442b8367a7bd940f752ddabf31cf01171e24' + + 'd78df136e9681cd974ce4f858a5fb6efd3234a91857bb52d' + + '9e7b414a8bc66db4b5a73bbeccfb6eb764b4f0cbf0375136' + + 'b024b04e698d54a5' + }, + p17: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934028492' + + '36c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bd' + + 'f8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831' + + '179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1b' + + 'db7f1447e6cc254b332051512bd7af426fb8f401378cd2bf' + + '5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6' + + 'd55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f3' + + '23a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aa' + + 'cc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be328' + + '06a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55c' + + 'da56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee' + + '12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff', + priv: '6017f2bc23e1caff5b0a8b4e1fc72422b5204415787801dc' + + '025762b8dbb98ab57603aaaa27c4e6bdf742b4a1726b9375' + + 'a8ca3cf07771779589831d8bd18ddeb79c43e7e77d433950' + + 'e652e49df35b11fa09644874d71d62fdaffb580816c2c88c' + + '2c4a2eefd4a660360316741b05a15a2e37f236692ad3c463' + + 'fff559938fc6b77176e84e1bb47fb41af691c5eb7bb81bd8' + + 'c918f52625a1128f754b08f5a1403b84667231c4dfe07ed4' + + '326234c113931ce606037e960f35a2dfdec38a5f057884d3' + + '0af8fab3be39c1eeb390205fd65982191fc21d5aa30ddf51' + + 'a8e1c58c0c19fc4b4a7380ea9e836aaf671c90c29bc4bcc7' + + '813811aa436a7a9005de9b507957c56a9caa1351b6efc620' + + '7225a18f6e97f830fb6a8c4f03b82f4611e67ab9497b9271' + + 'd6ac252793cc3e5538990dbd894d2dbc2d152801937d9f74' + + 'da4b741b50b4d40e4c75e2ac163f7b397fd555648b249f97' + + 'ffe58ffb6d096aa84534c4c5729cff137759bd34e80db4ab' + + '47e2b9c52064e7f0bf677f72ac9e5d0c6606943683f9d12f' + + '180cf065a5cb8ec3179a874f358847a907f8471d15f1e728' + + '7023249d6d13c82da52628654438f47b8b5cdf4761fbf6ad' + + '9219eceac657dbd06cf2ab776ad4c968f81c3d039367f0a4' + + 'd77c7ec4435c27b6c147071665100063b5666e06eb2fb2cc' + + '3159ba34bc98ca346342195f6f1fb053ddc3bc1873564d40' + + '1c6738cdf764d6e1ff25ca5926f80102ea6593c17170966b' + + 'b5d7352dd7fb821230237ea3ebed1f920feaadbd21be295a' + + '69f2083deae9c5cdf5f4830eb04b7c1f80cc61c17232d79f' + + '7ecc2cc462a7965f804001c89982734e5abba2d31df1b012' + + '152c6b226dff34510b54be8c2cd68d795def66c57a3abfb6' + + '896f1d139e633417f8c694764974d268f46ece3a8d6616ea' + + 'a592144be48ee1e0a1595d3e5edfede5b27cec6c48ceb2ff' + + 'b42cb44275851b0ebf87dfc9aa2d0cb0805e9454b051dfe8' + + 'a29fadd82491a4b4c23f2d06ba45483ab59976da1433c9ce' + + '500164b957a04cf62dd67595319b512fc4b998424d1164dd' + + 'bbe5d1a0f7257cbb04ec9b5ed92079a1502d98725023ecb2', + pub: '3bf836229c7dd874fe37c1790d201e82ed8e192ed61571ca' + + '7285264974eb2a0171f3747b2fc23969a916cbd21e14f7e2' + + 'f0d72dcd2247affba926f9e7bb99944cb5609aed85e71b89' + + 'e89d2651550cb5bd8281bd3144066af78f194032aa777739' + + 'cccb7862a1af401f99f7e5c693f25ddce2dedd9686633820' + + 'd28d0f5ed0c6b5a094f5fe6170b8e2cbc9dff118398baee6' + + 'e895a6301cb6e881b3cae749a5bdf5c56fc897ff68bc73f2' + + '4811bb108b882872bade1f147d886a415cda2b93dd90190c' + + 'be5c2dd53fe78add5960e97f58ff2506afe437f4cf4c912a' + + '397c1a2139ac6207d3ab76e6b7ffd23bb6866dd7f87a9ae5' + + '578789084ff2d06ea0d30156d7a10496e8ebe094f5703539' + + '730f5fdbebc066de417be82c99c7da59953071f49da7878d' + + 'a588775ff2a7f0084de390f009f372af75cdeba292b08ea8' + + '4bd13a87e1ca678f9ad148145f7cef3620d69a891be46fbb' + + 'cad858e2401ec0fd72abdea2f643e6d0197b7646fbb83220' + + '0f4cf7a7f6a7559f9fb0d0f1680822af9dbd8dec4cd1b5e1' + + '7bc799e902d9fe746ddf41da3b7020350d3600347398999a' + + 'baf75d53e03ad2ee17de8a2032f1008c6c2e6618b62f225b' + + 'a2f350179445debe68500fcbb6cae970a9920e321b468b74' + + '5fb524fb88abbcacdca121d737c44d30724227a99745c209' + + 'b970d1ff93bbc9f28b01b4e714d6c9cbd9ea032d4e964d8e' + + '8fff01db095160c20b7646d9fcd314c4bc11bcc232aeccc0' + + 'fbedccbc786951025597522eef283e3f56b44561a0765783' + + '420128638c257e54b972a76e4261892d81222b3e2039c61a' + + 'ab8408fcaac3d634f848ab3ee65ea1bd13c6cd75d2e78060' + + 'e13cf67fbef8de66d2049e26c0541c679fff3e6afc290efe' + + '875c213df9678e4a7ec484bc87dae5f0a1c26d7583e38941' + + 'b7c68b004d4df8b004b666f9448aac1cc3ea21461f41ea5d' + + 'd0f7a9e6161cfe0f58bcfd304bdc11d78c2e9d542e86c0b5' + + '6985cc83f693f686eaac17411a8247bf62f5ccc7782349b5' + + 'cc1f20e312fa2acc0197154d1bfee507e8db77e8f2732f2d' + + '641440ccf248e8643b2bd1e1f9e8239356ab91098fcb431d', + q: 'a899c59999bf877d96442d284359783bdc64b5f878b688fe' + + '51407f0526e616553ad0aaaac4d5bed3046f10a1faaf42bb' + + '2342dc4b7908eea0c46e4c4576897675c2bfdc4467870d3d' + + 'cd90adaed4359237a4bc6924bfb99aa6bf5f5ede15b574ea' + + 'e977eac096f3c67d09bda574c6306c6123fa89d2f086b8dc' + + 'ff92bc570c18d83fe6c810ccfd22ce4c749ef5e6ead3fffe' + + 'c63d95e0e3fde1df9db6a35fa1d107058f37e41957769199' + + 'd945dd7a373622c65f0af3fd9eb1ddc5c764bbfaf7a3dc37' + + '2548e683b970dac4aa4b9869080d2376c9adecebb84e172c' + + '09aeeb25fb8df23e60033260c4f8aac6b8b98ab894b1fb84' + + 'ebb83c0fb2081c3f3eee07f44e24d8fabf76f19ed167b0d7' + + 'ff971565aa4efa3625fce5a43ceeaa3eebb3ce88a00f597f' + + '048c69292b38dba2103ecdd5ec4ccfe3b2d87fa6202f334b' + + 'c1cab83b608dfc875b650b69f2c7e23c0b2b4adf149a6100' + + 'db1b6dbad4679ecb1ea95eafaba3bd00db11c2134f5a8686' + + '358b8b2ab49a1b2e85e1e45caeac5cd4dc0b3b5fffba8871' + + '1c6baf399edd48dad5e5c313702737a6dbdcede80ca358e5' + + '1d1c4fe42e8948a084403f61baed38aa9a1a5ce2918e9f33' + + '100050a430b47bc592995606440272a4994677577a6aaa1b' + + 'a101045dbec5a4e9566dab5445d1af3ed19519f07ac4e2a8' + + 'bd0a84b01978f203a9125a0be020f71fab56c2c9e344d4f4' + + '12d53d3cd8eb74ca5122002e931e3cb0bd4b7492436be17a' + + 'd7ebe27148671f59432c36d8c56eb762655711cfc8471f70' + + '83a8b7283bcb3b1b1d47d37c23d030288cfcef05fbdb4e16' + + '652ee03ee7b77056a808cd700bc3d9ef826eca9a59be959c' + + '947c865d6b372a1ca2d503d7df6d7611b12111665438475a' + + '1c64145849b3da8c2d343410df892d958db232617f9896f1' + + 'de95b8b5a47132be80dd65298c7f2047858409bf762dbc05' + + 'a62ca392ac40cfb8201a0607a2cae07d99a307625f2b2d04' + + 'fe83fbd3ab53602263410f143b73d5b46fc761882e78c782' + + 'd2c36e716a770a7aefaf7f76cea872db7bffefdbc4c2f9e0' + + '39c19adac915e7a63dcb8c8c78c113f29a3e0bc10e100ce0', + qs: '6f0a2fb763eaeb8eb324d564f03d4a55fdcd709e5f1b65e9' + + '5702b0141182f9f945d71bc3e64a7dfdae7482a7dd5a4e58' + + 'bc38f78de2013f2c468a621f08536969d2c8d011bb3bc259' + + '2124692c91140a5472cad224acdacdeae5751dadfdf068b8' + + '77bfa7374694c6a7be159fc3d24ff9eeeecaf62580427ad8' + + '622d48c51a1c4b1701d768c79d8c819776e096d2694107a2' + + 'f3ec0c32224795b59d32894834039dacb369280afb221bc0' + + '90570a93cf409889b818bb30cccee98b2aa26dbba0f28499' + + '08e1a3cd43fa1f1fb71049e5c77c3724d74dc351d9989057' + + '37bbda3805bd6b1293da8774410fb66e3194e18cdb304dd9' + + 'a0b59b583dcbc9fc045ac9d56aea5cfc9f8a0b95da1e11b7' + + '574d1f976e45fe12294997fac66ca0b83fc056183549e850' + + 'a11413cc4abbe39a211e8c8cbf82f2a23266b3c10ab9e286' + + '07a1b6088909cddff856e1eb6b2cde8bdac53fa939827736' + + 'ca1b892f6c95899613442bd02dbdb747f02487718e2d3f22' + + 'f73734d29767ed8d0e346d0c4098b6fdcb4df7d0c4d29603' + + '5bffe80d6c65ae0a1b814150d349096baaf950f2caf298d2' + + 'b292a1d48cf82b10734fe8cedfa16914076dfe3e9b51337b' + + 'ed28ea1e6824bb717b641ca0e526e175d3e5ed7892aebab0' + + 'f207562cc938a821e2956107c09b6ce4049adddcd0b7505d' + + '49ae6c69a20122461102d465d93dc03db026be54c303613a' + + 'b8e5ce3fd4f65d0b6162ff740a0bf5469ffd442d8c509cd2' + + '3b40dab90f6776ca17fc0678774bd6eee1fa85ababa52ec1' + + 'a15031eb677c6c488661dddd8b83d6031fe294489ded5f08' + + '8ad1689a14baeae7e688afa3033899c81f58de39b392ca94' + + 'af6f15a46f19fa95c06f9493c8b96a9be25e78b9ea35013b' + + 'caa76de6303939299d07426a88a334278fc3d0d9fa71373e' + + 'be51d3c1076ab93a11d3d0d703366ff8cde4c11261d488e5' + + '60a2bdf3bfe2476032294800d6a4a39d306e65c6d7d8d66e' + + '5ec63eee94531e83a9bddc458a2b508285c0ee10b7bd94da' + + '2815a0c5bd5b2e15cbe66355e42f5af8955cdfc0b3a4996d' + + '288db1f4b32b15643b18193e378cb7491f3c3951cdd044b1' + + 'a519571bffac2da986f5f1d506c66530a55f70751e24fa8e' + + 'd83ac2347f4069fb561a5565e78c6f0207da24e889a93a96' + + '65f717d9fe8a2938a09ab5f81be7ccecf466c0397fc15a57' + + '469939793f302739765773c256a3ca55d0548afd117a7cae' + + '98ca7e0d749a130c7b743d376848e255f8fdbe4cb4480b63' + + 'cd2c015d1020cf095d175f3ca9dcdfbaf1b2a6e6468eee4c' + + 'c750f2132a77f376bd9782b9d0ff4da98621b898e251a263' + + '4301ba2214a8c430b2f7a79dbbfd6d7ff6e9b0c137b025ff' + + '587c0bf912f0b19d4fff96b1ecd2ca990c89b386055c60f2' + + '3b94214bd55096f17a7b2c0fa12b333235101cd6f28a128c' + + '782e8a72671adadebbd073ded30bd7f09fb693565dcf0bf3' + + '090c21d13e5b0989dd8956f18f17f4f69449a13549c9d80a' + + '77e5e61b5aeeee9528634100e7bc390672f0ded1ca53555b' + + 'abddbcf700b9da6192255bddf50a76b709fbed251dce4c7e' + + '1ca36b85d1e97c1bc9d38c887a5adf140f9eeef674c31422' + + 'e65f63cae719f8c1324e42fa5fd8500899ef5aa3f9856aa7' + + 'ce10c85600a040343204f36bfeab8cfa6e9deb8a2edd2a8e' + + '018d00c7c9fa3a251ad0f57183c37e6377797653f382ec7a' + + '2b0145e16d3c856bc3634b46d90d7198aff12aff88a30e34' + + 'e2bfaf62705f3382576a9d3eeb0829fca2387b5b654af46e' + + '5cf6316fb57d59e5ea6c369061ac64d99671b0e516529dd5' + + 'd9c48ea0503e55fee090d36c5ea8b5954f6fcc0060794e1c' + + 'b7bc24aa1e5c0142fd4ce6e8fd5aa92a7bf84317ea9e1642' + + 'b6995bac6705adf93cbce72433ed0871139970d640f67b78' + + 'e63a7a6d849db2567df69ac7d79f8c62664ac221df228289' + + 'd0a4f9ebd9acb4f87d49da64e51a619fd3f3baccbd9feb12' + + '5abe0cc2c8d17ed1d8546da2b6c641f4d3020a5f9b9f26ac' + + '16546c2d61385505612275ea344c2bbf1ce890023738f715' + + '5e9eba6a071678c8ebd009c328c3eb643679de86e69a9fa5' + + '67a9e146030ff03d546310a0a568c5ba0070e0da22f2cef8' + + '54714b04d399bbc8fd261f9e8efcd0e83bdbc3f5cfb2d024' + + '3e398478cc598e000124eb8858f9df8f52946c2a1ca5c400' + } +}; diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/pummel/dh-group-test.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/pummel/dh-group-test.js new file mode 100644 index 00000000..dd6481f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/pummel/dh-group-test.js @@ -0,0 +1,21 @@ +var assert = require('assert'); +var BN = require('../../').BN; +var fixtures = require('../fixtures'); + +describe('BN.js/Slow DH test', function() { + var groups = fixtures.dhGroups; + Object.keys(groups).forEach(function(name) { + it('should match public key for ' + name + ' group', function() { + var group = groups[name]; + + this.timeout(3600 * 1000); + + var base = new BN(2); + var mont = BN.red(new BN(group.prime, 16)); + var priv = new BN(group.priv, 16); + var multed = base.toRed(mont).redPow(priv).fromRed(); + var actual = new Buffer(multed.toArray()); + assert.equal(actual.toString('hex'), group.pub); + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/red-test.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/red-test.js new file mode 100644 index 00000000..474679ca --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/bn.js/test/red-test.js @@ -0,0 +1,140 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN.js/Reduction context', function() { + function testMethod(name, fn) { + describe(name + ' method', function() { + it('should support add, iadd, sub, isub operations', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(123).toRed(m); + var b = new BN(231).toRed(m); + + assert.equal(a.redAdd(b).fromRed().toString(10), '97'); + assert.equal(a.redSub(b).fromRed().toString(10), '149'); + assert.equal(b.redSub(a).fromRed().toString(10), '108'); + + assert.equal(a.clone().redIAdd(b).fromRed().toString(10), '97'); + assert.equal(a.clone().redISub(b).fromRed().toString(10), '149'); + assert.equal(b.clone().redISub(a).fromRed().toString(10), '108'); + }); + + it('should support pow and mul operations', function() { + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p192); + var a = new BN(123); + var b = new BN(231); + var c = a.toRed(m).redMul(b.toRed(m)).fromRed(); + assert(c.cmp(a.mul(b).mod(p192)) === 0); + + assert.equal(a.toRed(m).redPow(new BN(3)).fromRed() + .cmp(a.sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(4)).fromRed() + .cmp(a.sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(8)).fromRed() + .cmp(a.sqr().sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(9)).fromRed() + .cmp(a.sqr().sqr().sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(17)).fromRed() + .cmp(a.sqr().sqr().sqr().sqr().mul(a)), 0); + }); + + it('should sqrtm numbers', function() { + var p = new BN(263); + var m = fn(p); + var q = new BN(11).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + var q = new BN(13).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + // Tonelli-shanks + var p = new BN(13); + var m = fn(p); + var q = new BN(10).toRed(m); + assert.equal(q.redSqrt().fromRed().toString(10), '7'); + }); + + it('should invm numbers', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(3).toRed(m); + var b = a.redInvm(p); + assert.equal(a.redMul(b).fromRed().toString(16), '1'); + }); + + it('should imul numbers', function() { + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + + var a = new BN('deadbeefabbadead', 16); + var b = new BN('abbadeadbeefdead', 16); + var c = a.mul(b).mod(p); + + assert.equal(a.toRed(m).redIMul(b.toRed(m)).fromRed().toString(16), + c.toString(16)); + }); + }); + } + + testMethod('Plain', BN.red); + testMethod('Montgomery', BN.mont); + + describe('Pseudo-Mersenne Primes', function() { + it('should reduce numbers mod k256', function() { + var p = BN._prime('k256'); + + assert.equal(p.ireduce(new BN(0xdead)).toString(16), 'dead'); + assert.equal(p.ireduce(new BN('deadbeef', 16)).toString(16), 'deadbeef'); + + var num = new BN('fedcba9876543210fedcba9876543210dead' + + 'fedcba9876543210fedcba9876543210dead', + 16); + var exp = num.mod(p.p).toString(16); + assert.equal(p.ireduce(num).toString(16), exp); + + var regr = new BN('f7e46df64c1815962bf7bc9c56128798' + + '3f4fcef9cb1979573163b477eab93959' + + '335dfb29ef07a4d835d22aa3b6797760' + + '70a8b8f59ba73d56d01a79af9', + 16); + var exp = regr.mod(p.p).toString(16); + assert.equal(p.ireduce(regr).toString(16), exp); + }); + + it('should not fail to invm number mod k256', function() { + var regr2 = new BN( + '6c150c4aa9a8cf1934485d40674d4a7cd494675537bda36d49405c5d2c6f496f', 16); + regr2 = regr2.toRed(BN.red('k256')); + assert.equal(regr2.redInvm().redMul(regr2).fromRed().cmpn(1), 0); + }); + + it('should correctly square the number', function() { + var p = BN._prime('k256').p; + var red = BN.red('k256'); + + var n = new BN('9cd8cb48c3281596139f147c1364a3ed' + + 'e88d3f310fdb0eb98c924e599ca1b3c9', + 16); + var expected = n.sqr().mod(p); + var actual = n.toRed(red).redSqr().fromRed(); + + assert.equal(actual.toString(16), expected.toString(16)); + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/.npmignore b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/.npmignore new file mode 100644 index 00000000..1ca95717 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/README.md b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/README.md new file mode 100644 index 00000000..e9d76f67 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/README.md @@ -0,0 +1,26 @@ +# Miller-Rabin + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2014. + +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/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/lib/mr.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/lib/mr.js new file mode 100644 index 00000000..0d237d23 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/lib/mr.js @@ -0,0 +1,114 @@ +var bn = require('bn.js'); +var brorand = require('brorand'); + +function MillerRabin(rand) { + this.rand = rand || new brorand.Rand(); +} +module.exports = MillerRabin; + +MillerRabin.create = function create(rand) { + return new MillerRabin(rand); +}; + +MillerRabin.prototype._rand = function _rand(n) { + var len = n.bitLength(); + var buf = this.rand.generate(Math.ceil(len / 8)); + + // Set low bits + buf[0] |= 3; + + // Mask high bits + var mask = len & 0x7; + if (mask !== 0) + buf[buf.length - 1] >>= 7 - mask; + + return new bn(buf); +} + +MillerRabin.prototype.test = function test(n, k, cb) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); + + if (!k) + k = Math.max(1, (len / 48) | 0); + + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + var n2 = n1.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); + + var rn1 = n1.toRed(red); + + var prime = true; + for (; k > 0; k--) { + var a = this._rand(n2); + if (cb) + cb(a); + + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; + + for (var i = 1; i < s; i++) { + x = x.redSqr(); + + if (x.cmp(rone) === 0) + return false; + if (x.cmp(rn1) === 0) + break; + } + + if (i === s) + return false; + } + + return prime; +}; + +MillerRabin.prototype.getDivisor = function getDivisor(n, k) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); + + if (!k) + k = Math.max(1, (len / 48) | 0); + + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + var n2 = n1.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); + + var rn1 = n1.toRed(red); + + var prime = true; + for (; k > 0; k--) { + var a = this._rand(n2); + + var g = n.gcd(a); + if (g.cmpn(1) !== 0) + return g; + + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; + + for (var i = 1; i < s; i++) { + x = x.redSqr(); + + if (x.cmp(rone) === 0) + return x.fromRed().subn(1).gcd(n); + if (x.cmp(rn1) === 0) + break; + } + + if (i === s) { + x = x.redSqr(); + return x.fromRed().subn(1).gcd(n); + } + } + + return prime; +}; diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/.npmignore b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/.npmignore new file mode 100644 index 00000000..1ca95717 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/README.md b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/README.md new file mode 100644 index 00000000..f80437d1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/README.md @@ -0,0 +1,26 @@ +# Brorand + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2014. + +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/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/index.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/index.js new file mode 100644 index 00000000..436f040e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/index.js @@ -0,0 +1,57 @@ +var r; + +module.exports = function rand(len) { + if (!r) + r = new Rand(null); + + return r.generate(len); +}; + +function Rand(rand) { + this.rand = rand; +} +module.exports.Rand = Rand; + +Rand.prototype.generate = function generate(len) { + return this._rand(len); +}; + +if (typeof window === 'object') { + if (window.crypto && window.crypto.getRandomValues) { + // Modern browsers + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + window.crypto.getRandomValues(arr); + return arr; + }; + } else if (window.msCrypto && window.msCrypto.getRandomValues) { + // IE + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + window.msCrypto.getRandomValues(arr); + return arr; + }; + } else { + // Old junk + Rand.prototype._rand = function() { + throw new Error('Not implemented yet'); + }; + } +} else { + // Node.js or Web worker + try { + var crypto = require('cry' + 'pto'); + + Rand.prototype._rand = function _rand(n) { + return crypto.randomBytes(n); + }; + } catch (e) { + // Emulate crypto API using randy + Rand.prototype._rand = function _rand(n) { + var res = new Uint8Array(n); + for (var i = 0; i < res.length; i++) + res[i] = this.rand.getByte(); + return res; + }; + } +} diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/package.json b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/package.json new file mode 100644 index 00000000..99f64349 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/package.json @@ -0,0 +1,54 @@ +{ + "name": "brorand", + "version": "1.0.5", + "description": "Random number generator for browsers and node.js", + "main": "index.js", + "scripts": { + "test": "mocha --reporter=spec test/**/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/brorand" + }, + "keywords": [ + "Random", + "RNG", + "browser", + "crypto" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/brorand/issues" + }, + "homepage": "https://github.com/indutny/brorand", + "devDependencies": { + "mocha": "^2.0.1" + }, + "gitHead": "571027e0ffa1119c720bcdb8aa9c987f63beb5a6", + "_id": "brorand@1.0.5", + "_shasum": "07b54ca30286abd1718a0e2a830803efdc9bfa04", + "_from": "brorand@>=1.0.1 <2.0.0", + "_npmVersion": "2.1.6", + "_nodeVersion": "0.10.33", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "07b54ca30286abd1718a0e2a830803efdc9bfa04", + "tarball": "http://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/test/api-test.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/test/api-test.js new file mode 100644 index 00000000..b6c876d3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/node_modules/brorand/test/api-test.js @@ -0,0 +1,8 @@ +var brorand = require('../'); +var assert = require('assert'); + +describe('Brorand', function() { + it('should generate random numbers', function() { + assert.equal(brorand(100).length, 100); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/package.json b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/package.json new file mode 100644 index 00000000..f4248953 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/package.json @@ -0,0 +1,56 @@ +{ + "name": "miller-rabin", + "version": "1.1.5", + "description": "Miller Rabin algorithm for primality test", + "main": "lib/mr.js", + "scripts": { + "test": "mocha --reporter=spec test/**/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/miller-rabin" + }, + "keywords": [ + "prime", + "miller-rabin", + "bignumber" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/miller-rabin/issues" + }, + "homepage": "https://github.com/indutny/miller-rabin", + "devDependencies": { + "mocha": "^2.0.1" + }, + "dependencies": { + "bn.js": "^1.0.0", + "brorand": "^1.0.1" + }, + "gitHead": "9230dc7d45ba47a7a0a639a56f990ec741fcdd79", + "_id": "miller-rabin@1.1.5", + "_shasum": "41f506bed994b97e7c184a658ae107dad980526e", + "_from": "miller-rabin@>=1.1.2 <2.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "41f506bed994b97e7c184a658ae107dad980526e", + "tarball": "http://registry.npmjs.org/miller-rabin/-/miller-rabin-1.1.5.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-1.1.5.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/test/api-test.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/test/api-test.js new file mode 100644 index 00000000..dee094d9 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/node_modules/miller-rabin/test/api-test.js @@ -0,0 +1,18 @@ +var assert = require('assert'); +var mr = require('../').create(); +var bn = require('bn.js'); + +describe('Miller-Rabin', function() { + it('should test number for primality', function() { + assert(!mr.test(new bn(221))); + assert(mr.test(new bn(257))); + + var p = new bn('dba8191813fe8f51eaae1de70213aafede8f323f95f32cff' + + '8b64ebada275cfb18a446a0150e5fdaee246244c5f002ce0' + + 'aca97584be1745f2dd1eea2849c52aac8c4b5fb78a1c4da7' + + '052774338d3310a6e020c46168cb1f94014e9312511cc4fb' + + '79d695bb732449f0e015745b86bfa371dc6ca7386e9c7309' + + '5549c2e4b8002873', 16); + assert(mr.test(p)); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/package.json b/node_modules/crypto-browserify/node_modules/diffie-hellman/package.json new file mode 100644 index 00000000..728d4966 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/package.json @@ -0,0 +1,76 @@ +{ + "name": "diffie-hellman", + "version": "3.0.1", + "description": "pure js diffie-hellman", + "main": "index.js", + "browser": "browser.js", + "scripts": { + "test": "node test.js | tspec" + }, + "repository": { + "type": "git", + "url": "https://github.com/crypto-browserify/diffie-hellman.git" + }, + "keywords": [ + "diffie", + "hellman", + "diffiehellman", + "dh" + ], + "author": { + "name": "Calvin Metcalf" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/diffie-hellman/issues" + }, + "homepage": "https://github.com/crypto-browserify/diffie-hellman", + "dependencies": { + "bn.js": "^1.0.0", + "miller-rabin": "^1.1.2", + "randombytes": "^2.0.0" + }, + "devDependencies": { + "tap-spec": "^1.0.1", + "tape": "^3.0.1" + }, + "gitHead": "10bb57dbcc32100acf71adc4c8dd1137bc17a1e5", + "_id": "diffie-hellman@3.0.1", + "_shasum": "13be8fc4ad657278408cd796b554a93e586ed66a", + "_from": "diffie-hellman@>=3.0.1 <4.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "13be8fc4ad657278408cd796b554a93e586ed66a", + "tarball": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-3.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-3.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/readme.md b/node_modules/crypto-browserify/node_modules/diffie-hellman/readme.md new file mode 100644 index 00000000..2912d1aa --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/readme.md @@ -0,0 +1,4 @@ +diffie hellman [![Build Status](https://travis-ci.org/crypto-browserify/diffie-hellman.svg)](https://travis-ci.org/crypto-browserify/diffie-hellman) +==== + +pure js diffie-hellman, same api as node, most hard parts thanks to [bn.js](https://www.npmjs.org/package/bn.js) by [@indutny](https://github.com/indutny). In node just returns an object with `crypto.getDiffieHellman` and `crypto.getDiffieHellman` in the browser returns a shim. To require the pure JavaScript one in node `require('diffie-hellman/browser');`; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/diffie-hellman/test.js b/node_modules/crypto-browserify/node_modules/diffie-hellman/test.js new file mode 100644 index 00000000..2ef1326b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/diffie-hellman/test.js @@ -0,0 +1,131 @@ +var test = require('tape'); +var nodeCrypto = require('./'); +var myCrypto = require('./browser'); + +var mods = [ + 'modp1', 'modp2', 'modp5', 'modp14', 'modp15', 'modp16', 'modp17', 'modp18' +]; +function isNode10() { + return process.version && process.version.split('.').length === 3 && parseInt(process.version.split('.')[1], 10) <= 10; +} + var lens = [ + 2, 8, 16, 17, 18, 20, 21, 22, 64, 65, 128, 384, 512, 1024, + 192, 224, 256]; + var lens2 = [ + 16, 17, 18, 20, 21, 22,64, 65, 128]; +function run(i) { + mods.forEach(function (mod) { + test(mod + ' run ' + i, function (t){ + t.plan(5); + var dh1 = nodeCrypto.getDiffieHellman(mod); + var p1 = dh1.getPrime().toString('hex'); + dh1.generateKeys(); + var dh2 = myCrypto.getDiffieHellman(mod); + t.equals(typeof dh1.setPublicKey, typeof dh2.setPublicKey, 'same methods'); + t.equals(typeof dh1.setPrivateKey, typeof dh2.setPrivateKey, 'same methods'); + var p2 = dh2.getPrime().toString('hex'); + dh2.generateKeys(); + t.equals(p1, p2, 'equal primes'); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.notEquals(pubk1.toString('hex'), pubk2.toString('hex'), 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(pubk1).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + }); +} + + +function bylen(t, generator) { + return function (len){ + t.test('' + len, function (t) { + t.plan(6); + var dh2 = myCrypto.createDiffieHellman(len, generator); + var prime2 = dh2.getPrime(); + var p2 = prime2.toString('hex'); + var dh1 = nodeCrypto.createDiffieHellman(prime2, generator); + var p1 = dh1.getPrime().toString('hex'); + t.equals(typeof dh1.setPublicKey, typeof dh2.setPublicKey, 'same methods'); + t.equals(typeof dh1.setPrivateKey, typeof dh2.setPrivateKey, 'same methods'); + dh1.generateKeys(); + dh2.generateKeys(); + t.equals(p1, p2, 'equal primes'); + t.equals(dh1.getGenerator('hex'), dh2.getGenerator('hex'), 'equal generators'); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.notEquals(pubk1.toString('hex'), pubk2.toString('hex'), 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(dh1.getPublicKey()).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + }; +} +function bylen2(t) { + return function (len){ + t.test('' + len, function (t) { + t.plan(5); + var dh2 = nodeCrypto.createDiffieHellman(len); + var prime2 = dh2.getPrime(); + var p2 = prime2.toString('hex'); + var dh1 = myCrypto.createDiffieHellman(prime2); + var p1 = dh1.getPrime().toString('hex'); + dh1.generateKeys(); + dh2.generateKeys(); + t.equals(typeof dh1.setPublicKey, typeof dh2.setPublicKey, 'same methods'); + t.equals(typeof dh1.setPrivateKey, typeof dh2.setPrivateKey, 'same methods'); + t.equals(p1, p2, 'equal primes'); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.notEquals(pubk1.toString('hex'), pubk2.toString('hex'), 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(dh1.getPublicKey()).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + }; +} + +test('create primes gen 2', function (t) { + var f = bylen(t, new Buffer([2])); + lens2.forEach(f); +}); +if (!isNode10()) { + test('create primes gen 5', function (t) { + var f = bylen(t, new Buffer([5])); + lens2.forEach(f); + }); +} + +test('create primes other way', function (t) { + var f = bylen2(t); + lens.forEach(f); + }); +var i = 0; +while (++i < 2) { + run(i); +} +function isNode10() { + return process.version && process.version.split('.').length === 3 && parseInt(process.version.split('.')[1], 10) <= 10; +} +if (!isNode10()) { + test('check errors', function (t) { + t.plan(5); + var p1 = new Buffer('db10e7f61adcc193', 'hex'); + var p2 = new Buffer('db10e7f61adcc194', 'hex'); + var dh1 = myCrypto.createDiffieHellman(p1); + var dh2 = nodeCrypto.createDiffieHellman(p1); + t.equals(dh1.verifyError, dh2.verifyError, 'same error for good prime'); + dh1 = myCrypto.createDiffieHellman(p2); + dh2 = nodeCrypto.createDiffieHellman(p2); + t.equals(dh1.verifyError, dh2.verifyError, 'same error for bad prime'); + dh1 = myCrypto.createDiffieHellman(p2, new Buffer([7])); + dh2 = nodeCrypto.createDiffieHellman(p2, new Buffer([7])); + t.equals(dh1.verifyError, dh2.verifyError, 'same error for bad prime non testable generator'); + dh1 = myCrypto.createDiffieHellman(p1.toString('hex'), 'hex', new Buffer([5])); + dh2 = nodeCrypto.createDiffieHellman(p1.toString('hex'), 'hex', new Buffer([5])); + t.equals(dh1.verifyError, dh2.verifyError, 'same error for good prime wrong generator'); + dh1 = myCrypto.createDiffieHellman(p1, new Buffer([11]).toString('hex'), 'hex'); + dh2 = nodeCrypto.createDiffieHellman(p1, new Buffer([11]).toString('hex'), 'hex'); + t.equals(dh1.verifyError, dh2.verifyError, 'same error for good prime non testable generator'); + }); +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/inherits/LICENSE b/node_modules/crypto-browserify/node_modules/inherits/LICENSE new file mode 100644 index 00000000..dea3013d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/crypto-browserify/node_modules/inherits/README.md b/node_modules/crypto-browserify/node_modules/inherits/README.md new file mode 100644 index 00000000..b1c56658 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/crypto-browserify/node_modules/inherits/inherits.js b/node_modules/crypto-browserify/node_modules/inherits/inherits.js new file mode 100644 index 00000000..29f5e24f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/inherits/inherits.js @@ -0,0 +1 @@ +module.exports = require('util').inherits diff --git a/node_modules/crypto-browserify/node_modules/inherits/inherits_browser.js b/node_modules/crypto-browserify/node_modules/inherits/inherits_browser.js new file mode 100644 index 00000000..c1e78a75 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} diff --git a/node_modules/crypto-browserify/node_modules/inherits/package.json b/node_modules/crypto-browserify/node_modules/inherits/package.json new file mode 100644 index 00000000..005588b2 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/inherits/package.json @@ -0,0 +1,50 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.1", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits" + }, + "license": "ISC", + "scripts": { + "test": "node test" + }, + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "_id": "inherits@2.0.1", + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "_from": "inherits@>=2.0.1 <2.1.0", + "_npmVersion": "1.3.8", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/isaacs/inherits" +} diff --git a/node_modules/crypto-browserify/node_modules/inherits/test.js b/node_modules/crypto-browserify/node_modules/inherits/test.js new file mode 100644 index 00000000..fc53012d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/inherits/test.js @@ -0,0 +1,25 @@ +var inherits = require('./inherits.js') +var assert = require('assert') + +function test(c) { + assert(c.constructor === Child) + assert(c.constructor.super_ === Parent) + assert(Object.getPrototypeOf(c) === Child.prototype) + assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) + assert(c instanceof Child) + assert(c instanceof Parent) +} + +function Child() { + Parent.call(this) + test(this) +} + +function Parent() {} + +inherits(Child, Parent) + +var c = new Child +test(c) + +console.log('ok') diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/.npmignore b/node_modules/crypto-browserify/node_modules/pbkdf2/.npmignore new file mode 100644 index 00000000..c2757b0e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/.npmignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Deployed apps should consider commenting this line out: +# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git +node_modules + +# build artifact +test/bundle.js \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/.travis.yml b/node_modules/crypto-browserify/node_modules/pbkdf2/.travis.yml new file mode 100644 index 00000000..73261dc6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/.travis.yml @@ -0,0 +1,13 @@ +language: node_js +before_install: + - "npm install npm -g" +node_js: + - "0.10" + - "0.11" + - "0.12" + - "iojs" +env: + - TEST_SUITE=test + - TEST_SUITE=coveralls + - TEST_SUITE=standard +script: "npm run-script $TEST_SUITE" diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/LICENSE b/node_modules/crypto-browserify/node_modules/pbkdf2/LICENSE new file mode 100644 index 00000000..a115b524 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Daniel Cousens + +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/node_modules/crypto-browserify/node_modules/pbkdf2/README.md b/node_modules/crypto-browserify/node_modules/pbkdf2/README.md new file mode 100644 index 00000000..bb164f1f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/README.md @@ -0,0 +1,24 @@ +# pbkdf2 + +[![build status](https://secure.travis-ci.org/crypto-browserify/pbkdf2.png)](http://travis-ci.org/crypto-browserify/pbkdf2) +[![Coverage Status](https://img.shields.io/coveralls/crypto-browserify/pbkdf2.svg)](https://coveralls.io/r/crypto-browserify/pbkdf2) +[![Version](http://img.shields.io/npm/v/pbkdf2.svg)](https://www.npmjs.org/package/pbkdf2) + +This library provides the functionality of PBKDF2 with the ability to use any supported hashing algorithm returned from `crypto.getHashes()` + + +## Usage + +``` +var pbkd2f = require('pbkd2f') +var derivedKey = pbkd2f.pbkdf2Sync('password', 'salt', 1, 32, 'sha512') + +... +``` + + +## Credits + +This module is a derivative of https://github.com/cryptocoinjs/pbkdf2-sha256/, so thanks to [JP Richardson](https://github.com/cryptocoinjs/pbkdf2-sha256/) for laying the ground work. + +Thank you to [FangDun Cai](https://github.com/fundon) for donating the package name on npm, if you're looking for his previous module it is located at [fundon/pbkdf2](https://github.com/fundon/pbkdf2). \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/async-shim.js b/node_modules/crypto-browserify/node_modules/pbkdf2/async-shim.js new file mode 100644 index 00000000..d12a4a49 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/async-shim.js @@ -0,0 +1,19 @@ +var compat = require('./browser') + +process.on('message', function (m) { + try { + var result = compat.pbkdf2Sync(new Buffer(m.password, 'hex'), new Buffer(m.salt, 'hex'), m.iterations, m.keylen, m.digest) + + process.send({ + data: result.toString('hex'), + type: 'success' + }) + } catch (e) { + process.send({ + data: e && e.message, + type: 'fail' + }) + } finally { + process.exit() + } +}) diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/browser.js b/node_modules/crypto-browserify/node_modules/pbkdf2/browser.js new file mode 100644 index 00000000..32374508 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/browser.js @@ -0,0 +1,80 @@ +var createHmac = require('create-hmac') +var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs + +exports.pbkdf2 = pbkdf2 +function pbkdf2 (password, salt, iterations, keylen, digest, callback) { + if (typeof digest === 'function') { + callback = digest + digest = undefined + } + + if (typeof callback !== 'function') { + throw new Error('No callback provided to pbkdf2') + } + + var result = pbkdf2Sync(password, salt, iterations, keylen, digest) + setTimeout(function () { + callback(undefined, result) + }) +} + +exports.pbkdf2Sync = pbkdf2Sync +function pbkdf2Sync (password, salt, iterations, keylen, digest) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number') + } + + if (iterations < 0) { + throw new TypeError('Bad iterations') + } + + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number') + } + + if (keylen < 0 || keylen > MAX_ALLOC) { + throw new TypeError('Bad key length') + } + + digest = digest || 'sha1' + + if (!Buffer.isBuffer(password)) password = new Buffer(password, 'binary') + if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, 'binary') + + var hLen + var l = 1 + var DK = new Buffer(keylen) + var block1 = new Buffer(salt.length + 4) + salt.copy(block1, 0, 0, salt.length) + + var r + var T + + for (var i = 1; i <= l; i++) { + block1.writeUInt32BE(i, salt.length) + var U = createHmac(digest, password).update(block1).digest() + + if (!hLen) { + hLen = U.length + T = new Buffer(hLen) + l = Math.ceil(keylen / hLen) + r = keylen - (l - 1) * hLen + } + + U.copy(T, 0, 0, hLen) + + for (var j = 1; j < iterations; j++) { + U = createHmac(digest, password).update(U).digest() + + for (var k = 0; k < hLen; k++) { + T[k] ^= U[k] + } + } + + var destPos = (i - 1) * hLen + var len = (i === l ? r : hLen) + T.copy(DK, destPos, 0, len) + } + + return DK +} diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/index.js b/node_modules/crypto-browserify/node_modules/pbkdf2/index.js new file mode 100644 index 00000000..ad861190 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/index.js @@ -0,0 +1,92 @@ +var compat = require('./browser') +var crypto = require('crypto') +var fork = require('child_process').fork +var path = require('path') + +var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs + +function asyncPBKDF2 (password, salt, iterations, keylen, digest, callback) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number') + } + + if (iterations < 0) { + throw new TypeError('Bad iterations') + } + + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number') + } + + if (keylen < 0 || keylen > MAX_ALLOC) { + throw new TypeError('Bad key length') + } + + if (typeof password === 'string') { + password = new Buffer(password, 'binary') + } + + if (typeof salt === 'string') { + salt = new Buffer(salt, 'binary') + } + + var child = fork(path.resolve(__dirname, 'async-shim.js')) + + child.on('message', function (result) { + if (result.type === 'success') { + callback(null, new Buffer(result.data, 'hex')) + } else if (result.type === 'fail') { + callback(new TypeError(result.data)) + } + }) + + child.send({ + password: password.toString('hex'), + salt: salt.toString('hex'), + iterations: iterations, + keylen: keylen, + digest: digest + }) +} + +exports.pbkdf2Sync = function pbkdf2Sync (password, salt, iterations, keylen, digest) { + digest = digest || 'sha1' + + if (isNode10()) { + if (digest === 'sha1') { + return crypto.pbkdf2Sync(password, salt, iterations, keylen) + } else { + return compat.pbkdf2Sync(password, salt, iterations, keylen, digest) + } + } else { + return crypto.pbkdf2Sync(password, salt, iterations, keylen, digest) + } +} + +exports.pbkdf2 = function pbkdf2 (password, salt, iterations, keylen, digest, callback) { + if (typeof digest === 'function') { + callback = digest + digest = 'sha1' + } + + if (isNode10()) { + if (digest === 'sha1') { + return crypto.pbkdf2(password, salt, iterations, keylen, callback) + } else { + return asyncPBKDF2(password, salt, iterations, keylen, digest, callback) + } + } else { + return crypto.pbkdf2(password, salt, iterations, keylen, digest, callback) + } +} + +var sha1 = '0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164' +var isNode10Result + +function isNode10 () { + if (typeof isNode10Result === 'undefined') { + isNode10Result = crypto.pbkdf2Sync('password', 'salt', 1, 32, 'sha256').toString('hex') === sha1 + } + + return isNode10Result +} diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/package.json b/node_modules/crypto-browserify/node_modules/pbkdf2/package.json new file mode 100644 index 00000000..9371eeb7 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/package.json @@ -0,0 +1,90 @@ +{ + "name": "pbkdf2", + "version": "3.0.4", + "description": "This library provides the functionality of PBKDF2 with the ability to use any supported hashing algorithm returned from crypto.getHashes()", + "main": "./index.js", + "browser": "./browser.js", + "keywords": [ + "pbkdf2", + "kdf", + "salt", + "hash" + ], + "scripts": { + "coverage": "istanbul cover _mocha -- -t 20000 test/index.js", + "coveralls": "npm run coverage && coveralls < coverage/lcov.info", + "standard": "standard", + "test": "mocha --reporter list -t 20000 test/index.js", + "bundle-test": "browserify test/index.js > test/bundle.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/crypto-browserify/pbkdf2.git" + }, + "author": { + "name": "Daniel Cousens" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/pbkdf2/issues" + }, + "homepage": "https://github.com/crypto-browserify/pbkdf2", + "devDependencies": { + "browserify": "^8.1.1", + "coveralls": "^2.11.2", + "istanbul": "^0.3.5", + "mocha": "^2.1.0", + "standard": "^3.0.0" + }, + "dependencies": { + "create-hmac": "^1.1.2" + }, + "standard": { + "ignore": [ + "test/**" + ] + }, + "gitHead": "c9b595c784154e433995faf6cd81813aef29c713", + "_id": "pbkdf2@3.0.4", + "_shasum": "12c8bfaf920543786a85150b03f68d5f1aa982fc", + "_from": "pbkdf2@>=3.0.3 <4.0.0", + "_npmVersion": "2.7.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "dcousens", + "email": "email@dcousens.com" + }, + "maintainers": [ + { + "name": "fundon", + "email": "cfddream@gmail.com" + }, + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "12c8bfaf920543786a85150b03f68d5f1aa982fc", + "tarball": "http://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/test/fixtures.json b/node_modules/crypto-browserify/node_modules/pbkdf2/test/fixtures.json new file mode 100644 index 00000000..410bb753 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/test/fixtures.json @@ -0,0 +1,171 @@ +{ + "valid": [ + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": 32, + "results": { + "sha1": "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164", + "sha256": "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b", + "sha512": "867f70cf1ade02cff3752599a3a53dc4af34c7a669815ae5d513554e1c8cf252", + "sha224": "3c198cbdb9464b7857966bd05b7bc92bc1cc4e6e63155d4e490557fd85989497", + "sha384": "c0e14f06e49e32d73f9f52ddf1d0c5c7191609233631dadd76a567db42b78676" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 2, + "dkLen": 32, + "results": { + "sha1": "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957cae93136266537a8d7bf4b76", + "sha256": "ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43", + "sha512": "e1d9c16aa681708a45f5c7c4e215ceb66e011a2e9f0040713f18aefdb866d53c", + "sha224": "93200ffa96c5776d38fa10abdf8f5bfc0054b9718513df472d2331d2d1e66a3f", + "sha384": "54f775c6d790f21930459162fc535dbf04a939185127016a04176a0730c6f1f4" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": 64, + "results": { + "sha1": "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164ac2e7a8e3f9d2e83ace57e0d50e5e1071367c179bc86c767fc3f78ddb561363f", + "sha256": "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b4dbf3a2f3dad3377264bb7b8e8330d4efc7451418617dabef683735361cdc18c", + "sha512": "867f70cf1ade02cff3752599a3a53dc4af34c7a669815ae5d513554e1c8cf252c02d470a285a0501bad999bfe943c08f050235d7d68b1da55e63f73b60a57fce", + "sha224": "3c198cbdb9464b7857966bd05b7bc92bc1cc4e6e63155d4e490557fd859894978ab846d52a1083ac610c36c2c5ea8ce4a024dd691064d5453bd17b15ea1ac194", + "sha384": "c0e14f06e49e32d73f9f52ddf1d0c5c7191609233631dadd76a567db42b78676b38fc800cc53ddb642f5c74442e62be44d727702213e3bb9223c53b767fbfb5d" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 2, + "dkLen": 64, + "results": { + "sha1": "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957cae93136266537a8d7bf4b76c51094cc1ae010b19923ddc4395cd064acb023ffd1edd5ef4be8ffe61426c28e", + "sha256": "ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43830651afcb5c862f0b249bd031f7a67520d136470f5ec271ece91c07773253d9", + "sha512": "e1d9c16aa681708a45f5c7c4e215ceb66e011a2e9f0040713f18aefdb866d53cf76cab2868a39b9f7840edce4fef5a82be67335c77a6068e04112754f27ccf4e", + "sha224": "93200ffa96c5776d38fa10abdf8f5bfc0054b9718513df472d2331d2d1e66a3f97b510224f700ce72581ffb10a1c99ec99a8cc1b951851a71f30d9265fccf912", + "sha384": "54f775c6d790f21930459162fc535dbf04a939185127016a04176a0730c6f1f4fb48832ad1261baadd2cedd50814b1c806ad1bbf43ebdc9d047904bf7ceafe1e" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 4096, + "dkLen": 32, + "results": { + "sha1": "4b007901b765489abead49d926f721d065a429c12e463f6c4cd79401085b03db", + "sha256": "c5e478d59288c841aa530db6845c4c8d962893a001ce4e11a4963873aa98134a", + "sha512": "d197b1b33db0143e018b12f3d1d1479e6cdebdcc97c5c0f87f6902e072f457b5", + "sha224": "218c453bf90635bd0a21a75d172703ff6108ef603f65bb821aedade1d6961683", + "sha384": "559726be38db125bc85ed7895f6e3cf574c7a01c080c3447db1e8a76764deb3c" + } + }, + { + "key": "passwordPASSWORDpassword", + "salt": "saltSALTsaltSALTsaltSALTsaltSALTsalt", + "iterations": 4096, + "dkLen": 40, + "results": { + "sha1": "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038b6b89a48612c5a25284e6605e12329", + "sha256": "348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9", + "sha512": "8c0511f4c6e597c6ac6315d8f0362e225f3c501495ba23b868c005174dc4ee71115b59f9e60cd953", + "sha224": "056c4ba438ded91fc14e0594e6f52b87e1f3690c0dc0fbc05784ed9a754ca780e6c017e80c8de278", + "sha384": "819143ad66df9a552559b9e131c52ae6c5c1b0eed18f4d283b8c5c9eaeb92b392c147cc2d2869d58" + } + }, + { + "key": "pass\u00000word", + "salt": "sa\u00000lt", + "iterations": 4096, + "dkLen": 16, + "results": { + "sha1": "345cbad979dfccb90cac5257bea6ea46", + "sha256": "1df6274d3c0bd2fc7f54fb46f149dda4", + "sha512": "336d14366099e8aac2c46c94a8f178d2", + "sha224": "0aca9ca9634db6ef4927931f633c6453", + "sha384": "b6ab6f8f6532fd9c5c30a79e1f93dcc6" + } + }, + { + "keyHex": "63ffeeddccbbaa", + "salt": "salt", + "iterations": 1, + "dkLen": 32, + "results": { + "sha1": "f6635023b135a57fb8caa89ef8ad93a29d9debb1b011e6e88bffbb212de7c01c", + "sha256": "dadd4a2638c1cf90a220777bc85d81859459513eb83063e3fce7d081490f259a", + "sha512": "f69de451247225a7b30cc47632899572bb980f500d7c606ac9b1c04f928a3488", + "sha224": "9cdee023b5d5e06ccd6c5467463e34fe461a7ed43977f8237f97b0bc7ebfd280", + "sha384": "25c72b6f0e052c883a9273a54cfd41fab86759fa3b33eb7920b923abaad62f99" + } + }, + { + "key": "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about", + "saltHex": "6d6e656d6f6e6963e383a1e383bce38388e383abe382abe38299e3838fe38299e382a6e38299e382a1e381afe3829ae381afe38299e3818fe38299e3829de38299e381a1e381a1e38299e58d81e4babae58d81e889b2", + "iterations": 2048, + "dkLen": 64, + "results": { + "sha1": "7e042a2f41ba17e2235fbc794e22a150816b0f54a1dfe113919fccb7a056066a109385e538f183c92bad896ae8b7d8e0f4cd66df359c77c8c7785cd1001c9a2c", + "sha256": "0b57118f2b6b079d9371c94da3a8315c3ada87a1e819b40c4c4e90b36ff2d3c8fd7555538b5119ac4d3da7844aa4259d92f9dd2188e78ac33c4b08d8e6b5964b", + "sha512": "ba553eedefe76e67e2602dc20184c564010859faada929a090dd2c57aacb204ceefd15404ab50ef3e8dbeae5195aeae64b0def4d2eead1cdc728a33ced520ffd", + "sha224": "d76474c525616ce2a527d23df8d6f6fcc4251cc3535cae4e955810a51ead1ec6acbe9c9619187ca5a3c4fd636de5b5fe58d031714731290bbc081dbf0fcb8fc1", + "sha384": "15010450f456769467e834db7fa93dd9d353e8bb733b63b0621090f96599ac3316908eb64ac9366094f0787cd4bfb2fea25be41dc271a19309710db6144f9b34" + } + }, + { + "key": "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about", + "salt": "mnemonicメートルガバヴァぱばぐゞちぢ十人十色", + "iterations": 2048, + "dkLen": 64, + "results": { + "sha1": "d85d14adcb7bdb5d976160e504f520a98cf71aca4cd5fceadf37759743bd6e1d2ff78bdd4403552aef7658094384b341ede80fffd334182be076f9d988a0a40f", + "sha256": "b86b5b900c29ed2724359afd793e10ffc1eb0e7d6f624fc9c85b8ac1785d9a2f0575af52a2338e611f2e6cffdee544adfff6f3d4f43be2ba0e2bd7e917b38a14", + "sha512": "3a863fa00f2e97a83fa9b18805e0047a6282cbae0ff48438b33a14475771c52d05137daa12e364cb34d84547ac07568b801c5c7f8dd4baaeee18a67a5c6a3377", + "sha224": "95727793842437774ad9ae27b8154a6f37f208b75a03d3a4d4a2443422bb6bc85efcfa92aa4376926ea89a8f5a63118eecdb58c8ca28ab31007da79437e0a1ef", + "sha384": "1a7e02e8ba0e357269a55642024b85738b95238d6cdc49bc440204995aefeff499e22cba76d4c7e96b7d4a9596a70e744f53fa94f3547e7dc506fcaf16ceb4a2" + } + } + ], + "invalid": [ + { + "key": "password", + "salt": "salt", + "iterations": "NaN", + "dkLen": 16, + "exception": "Iterations not a number" + }, + { + "key": "password", + "salt": "salt", + "iterations": -1, + "dkLen": 16, + "exception": "Bad iterations" + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": "NaN", + "exception": "Key length not a number" + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": -1, + "exception": "Bad key length" + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": 4073741824, + "exception": "Bad key length" + } + ] +} diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/test/index.html b/node_modules/crypto-browserify/node_modules/pbkdf2/test/index.html new file mode 100644 index 00000000..82363915 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/test/index.html @@ -0,0 +1,13 @@ + + +
+ + + \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/pbkdf2/test/index.js b/node_modules/crypto-browserify/node_modules/pbkdf2/test/index.js new file mode 100644 index 00000000..de2363b0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/pbkdf2/test/index.js @@ -0,0 +1,93 @@ +var assert = require('assert') +var compatNode = require('../') +var compatBrowser = require('../browser') +var fixtures = require('./fixtures') + +// SHA-1 vectors generated by Node.js +// SHA-256/SHA-512 test vectors from: +// https://stackoverflow.com/questions/5130513/pbkdf2-hmac-sha2-test-vectors +// https://stackoverflow.com/questions/15593184/pbkdf2-hmac-sha-512-test-vectors +function runTests(compat, name) { + describe(name, function () { + var algos = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512'] + describe('pbkdf2-compat', function() { + it('defaults to sha1 and handles buffers', function(done) { + compat.pbkdf2(new Buffer('password'), new Buffer('salt'), 1, 32, function (err, result) { + assert.equal(result.toString('hex'), "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164") + done() + }) + }) + + describe('pbkdf2', function() { + algos.forEach(function(algorithm) { + describe(algorithm, function() { + fixtures.valid.forEach(function(f) { + var key = f.key || new Buffer(f.keyHex, 'hex') + var salt = f.salt || new Buffer(f.saltHex, 'hex') + var expected = f.results[algorithm] + + it('encodes ' + key + '(' + f.salt + ') with ' + algorithm + ' to ' + expected, function(done) { + compat.pbkdf2(key, salt, f.iterations, f.dkLen, algorithm, function(err, result) { + assert.equal(result.toString('hex'), expected) + + done() + }) + }) + }) + + fixtures.invalid.forEach(function(f) { + it('should throw ' + f.exception, function() { + assert.throws(function() { + compat.pbkdf2(f.key, f.salt, f.iterations, f.dkLen, f.algo, function (){}) + }, new RegExp(f.exception)) + }) + }) + }) + }) + + it('should throw if no callback is provided', function() { + assert.throws(function() { + compat.pbkdf2('password', 'salt', 1, 32, 'sha1') + }, /No callback provided to pbkdf2/) + }) + }) + + describe('pbkdf2Sync', function() { + it('defaults to sha1', function() { + var result = compat.pbkdf2Sync('password', 'salt', 1, 32) + + assert.equal(result.toString('hex'), "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164") + }) + + algos.forEach(function(algorithm) { + describe(algorithm, function() { + fixtures.valid.forEach(function(f) { + var key = f.key || new Buffer(f.keyHex, 'hex') + var salt = f.salt || new Buffer(f.saltHex, 'hex') + var expected = f.results[algorithm] + + it('encodes ' + key + '(' + f.salt + ') with ' + algorithm + ' to ' + expected, function() { + var result = compat.pbkdf2Sync(key, salt, f.iterations, f.dkLen, algorithm) + + assert.equal(result.toString('hex'), expected) + }) + }) + + fixtures.invalid.forEach(function(f) { + it('should throw ' + f.exception, function() { + assert.throws(function() { + compat.pbkdf2Sync(f.key, f.salt, f.iterations, f.dkLen, f.algo) + }, new RegExp(f.exception)) + }) + }) + }) + }) + }) + }) + }) +} + +runTests(compatBrowser, 'JavaScript pbkdf2') +if (compatBrowser !== compatNode) { + runTests(compatNode, 'node pbkdf2') +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/.travis.yml b/node_modules/crypto-browserify/node_modules/public-encrypt/.travis.yml new file mode 100644 index 00000000..1b726667 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "0.10" + - "0.11" + - "0.12" + - iojs \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/browser.js b/node_modules/crypto-browserify/node_modules/public-encrypt/browser.js new file mode 100644 index 00000000..0e4fabf1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/browser.js @@ -0,0 +1,10 @@ +exports.publicEncrypt = require('./publicEncrypt'); +exports.privateDecrypt = require('./privateDecrypt'); + +exports.privateEncrypt = function privateEncrypt(key, buf) { + return exports.publicEncrypt(key, buf, true); +}; + +exports.publicDecrypt = function publicDecrypt(key, buf) { + return exports.privateDecrypt(key, buf, true); +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/index.js new file mode 100644 index 00000000..bec688e1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/index.js @@ -0,0 +1,18 @@ +var crypto = require('crypto'); +if (typeof crypto.publicEncrypt !== 'function') { + crypto = require('./browser'); +} +exports.publicEncrypt = crypto.publicEncrypt; +exports.privateDecrypt = crypto.privateDecrypt; + +if (typeof crypto.privateEncrypt !== 'function') { + exports.privateEncrypt = require('./browser').privateEncrypt; +} else { + exports.privateEncrypt = crypto.privateEncrypt; +} + +if (typeof crypto.publicDecrypt !== 'function') { + exports.publicDecrypt = require('./browser').publicDecrypt; +} else { + exports.publicDecrypt = crypto.publicDecrypt; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/mgf.js b/node_modules/crypto-browserify/node_modules/public-encrypt/mgf.js new file mode 100644 index 00000000..ff727448 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/mgf.js @@ -0,0 +1,16 @@ +var createHash = require('create-hash'); +module.exports = function (seed, len) { + var t = new Buffer(''); + var i = 0, c; + while (t.length < len) { + c = i2ops(i++); + t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]); + } + return t.slice(0, len); +}; + +function i2ops(c) { + var out = new Buffer(4); + out.writeUInt32BE(c,0); + return out; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/.jshintrc b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/.jshintrc new file mode 100644 index 00000000..add7282d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/.jshintrc @@ -0,0 +1,89 @@ +{ + // JSHint Default Configuration File (as on JSHint website) + // See http://jshint.com/docs/ for more details + + "maxerr" : 50, // {int} Maximum error before stopping + + // Enforcing + "bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.) + "camelcase" : true, // true: Identifiers must be in camelCase + "curly" : false, // true: Require {} for every new block or scope + "eqeqeq" : true, // true: Require triple equals (===) for comparison + "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() + "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. + "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` + "indent" : 2, // {int} Number of spaces to use for indentation + "latedef" : false, // true: Require variables/functions to be defined before being used + "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` + "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` + "noempty" : false, // true: Prohibit use of empty blocks + "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. + "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) + "plusplus" : false, // true: Prohibit use of `++` & `--` + "quotmark" : "single", // Quotation mark consistency: + // false : do nothing (default) + // true : ensure whatever is used is consistent + // "single" : require single quotes + // "double" : require double quotes + "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) + "unused" : true, // true: Require all defined variables be used + "strict" : true, // true: Requires all functions run in ES5 Strict Mode + "maxparams" : false, // {int} Max number of formal params allowed per function + "maxdepth" : false, // {int} Max depth of nested blocks (within functions) + "maxstatements" : false, // {int} Max number statements per function + "maxcomplexity" : false, // {int} Max cyclomatic complexity per function + "maxlen" : false, // {int} Max number of characters per line + + // Relaxing + "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) + "boss" : false, // true: Tolerate assignments where comparisons would be expected + "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // true: Tolerate use of `== null` + "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) + "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`) + "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) + // (ex: `for each`, multiple try/catch, function expression…) + "evil" : false, // true: Tolerate use of `eval` and `new Function()` + "expr" : false, // true: Tolerate `ExpressionStatement` as Programs + "funcscope" : false, // true: Tolerate defining variables inside control statements + "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') + "iterator" : false, // true: Tolerate using the `__iterator__` property + "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block + "laxbreak" : false, // true: Tolerate possibly unsafe line breakings + "laxcomma" : false, // true: Tolerate comma-first style coding + "loopfunc" : false, // true: Tolerate functions being defined in loops + "multistr" : false, // true: Tolerate multi-line strings + "noyield" : false, // true: Tolerate generator functions with no yield statement in them. + "notypeof" : false, // true: Tolerate invalid typeof operator values + "proto" : false, // true: Tolerate using the `__proto__` property + "scripturl" : false, // true: Tolerate script-targeted URLs + "shadow" : true, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` + "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation + "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` + "validthis" : false, // true: Tolerate using this in a non-constructor function + + // Environments + "browser" : true, // Web Browser (window, document, etc) + "browserify" : false, // Browserify (node.js code in the browser) + "couch" : false, // CouchDB + "devel" : true, // Development/debugging (alert, confirm, etc) + "dojo" : false, // Dojo Toolkit + "jasmine" : false, // Jasmine + "jquery" : false, // jQuery + "mocha" : true, // Mocha + "mootools" : false, // MooTools + "node" : false, // Node.js + "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) + "prototypejs" : false, // Prototype and Scriptaculous + "qunit" : false, // QUnit + "rhino" : false, // Rhino + "shelljs" : false, // ShellJS + "worker" : false, // Web Workers + "wsh" : false, // Windows Scripting Host + "yui" : false, // Yahoo User Interface + + // Custom Globals + "globals" : { + "module": true + } // additional predefined global variables +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/.npmignore b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/.npmignore new file mode 100644 index 00000000..bfd1047d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/.npmignore @@ -0,0 +1,3 @@ +benchmarks/ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/.travis.yml b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/.travis.yml new file mode 100644 index 00000000..92a990f6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" + - "0.11" +branches: + only: + - master diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/README.md b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/README.md new file mode 100644 index 00000000..3d970712 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/README.md @@ -0,0 +1,28 @@ +# bn.js [![Build Status](https://secure.travis-ci.org/indutny/bn.js.png)](http://travis-ci.org/indutny/bn.js) + +Just a bike-shed. + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2015. + +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/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js new file mode 100644 index 00000000..7ed21368 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js @@ -0,0 +1,2133 @@ +(function(module, exports) { + +'use strict'; + +// Utils + +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} + +// Could use `inherits` module, but don't want to move from single file +// architecture yet. +function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; +} + +// BN + +function BN(number, base, endian) { + // May be `new BN(bn)` ? + if (number !== null && + typeof number === 'object' && + Array.isArray(number.words)) { + return number; + } + + this.sign = false; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + if (number !== null) + this._init(number || 0, base || 10, endian || 'be'); +} +if (typeof module === 'object') + module.exports = BN; +else + exports.BN = BN; + +BN.BN = BN; +BN.wordSize = 26; + +BN.prototype._init = function init(number, base, endian) { + if (typeof number === 'number') { + if (number < 0) { + this.sign = true; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } + return; + } else if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + if (base === 'hex') + base = 16; + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') + start++; + + if (base === 16) + this._parseHex(number, start); + else + this._parseBase(number, base, start); + + if (number[0] === '-') + this.sign = true; + + this.strip(); +}; + +BN.prototype._initArray = function _initArray(number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + var off = 0; + if (endian === 'be') { + for (var i = number.length - 1, j = 0; i >= 0; i -= 3) { + var w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (var i = 0, j = 0; i < number.length; i += 3) { + var w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); +}; + +function parseHex(str, start, end) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r <<= 4; + + // 'a' - 'f' + if (c >= 49 && c <= 54) + r |= c - 49 + 0xa; + + // 'A' - 'F' + else if (c >= 17 && c <= 22) + r |= c - 17 + 0xa; + + // '0' - '9' + else + r |= c & 0xf; + } + return r; +} + +BN.prototype._parseHex = function _parseHex(number, start) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + this.words[i] = 0; + + // Scan 24-bit chunks and add them to the number + var off = 0; + for (var i = number.length - 6, j = 0; i >= start; i -= 6) { + var w = parseHex(number, i, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + if (i + 6 !== start) { + var w = parseHex(number, start, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + } + this.strip(); +}; + +function parseBase(str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) + r += c - 49 + 0xa; + + // 'A' + else if (c >= 17) + r += c - 17 + 0xa; + + // '0' - '9' + else + r += c; + } + return r; +} + +BN.prototype._parseBase = function _parseBase(number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) + limbLen++; + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } + + if (mod !== 0) { + var pow = 1; + var word = parseBase(number, i, number.length, base); + + for (var i = 0; i < mod; i++) + pow *= base; + this.imuln(pow); + if (this.words[0] + word < 0x4000000) + this.words[0] += word; + else + this._iaddn(word); + } +}; + +BN.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) + dest.words[i] = this.words[i]; + dest.length = this.length; + dest.sign = this.sign; + dest.red = this.red; +}; + +BN.prototype.clone = function clone() { + var r = new BN(null); + this.copy(r); + return r; +}; + +// Remove leading `0` from `this` +BN.prototype.strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) + this.length--; + return this._normSign(); +}; + +BN.prototype._normSign = function _normSign() { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) + this.sign = false; + return this; +}; + +BN.prototype.inspect = function inspect() { + return (this.red ? ''; +}; + +/* + +var zeros = []; +var groupSizes = []; +var groupBases = []; + +var s = ''; +var i = -1; +while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; +} +groupSizes[0] = 0; +groupSizes[1] = 0; +groupBases[0] = 0; +groupBases[1] = 0; +var base = 2 - 1; +while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; +} + +*/ + +var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' +]; + +var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +]; + +var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 +]; + +BN.prototype.toString = function toString(base, padding) { + base = base || 10; + if (base === 16 || base === 'hex') { + var out = ''; + var off = 0; + var padding = padding | 0 || 1; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) + out = zeros[6 - word.length] + word + out; + else + out = word + out; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) + out = carry.toString(16) + out; + while (out.length % padding !== 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + var out = ''; + var c = this.clone(); + c.sign = false; + while (c.cmpn(0) !== 0) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (c.cmpn(0) !== 0) + out = zeros[groupSize - r.length] + r + out; + else + out = r + out; + } + if (this.cmpn(0) === 0) + out = '0' + out; + if (this.sign) + out = '-' + out; + return out; + } else { + assert(false, 'Base should be between 2 and 36'); + } +}; + +BN.prototype.toJSON = function toJSON() { + return this.toString(16); +}; + +BN.prototype.toArray = function toArray() { + this.strip(); + var res = new Array(this.byteLength()); + res[0] = 0; + + var q = this.clone(); + for (var i = 0; q.cmpn(0) !== 0; i++) { + var b = q.andln(0xff); + q.ishrn(8); + + // Assume big-endian + res[res.length - i - 1] = b; + } + + return res; +}; + +/* +function genCountBits(bits) { + var arr = []; + + for (var i = bits - 1; i >= 0; i--) { + var bit = '0x' + (1 << i).toString(16); + arr.push('w >= ' + bit + ' ? ' + (i + 1)); + } + + return new Function('w', 'return ' + arr.join(' :\n') + ' :\n0;'); +}; + +BN.prototype._countBits = genCountBits(26); +*/ + +// Sadly chrome apps could not contain `new Function()` calls +BN.prototype._countBits = function _countBits(w) { + return w >= 0x2000000 ? 26 : + w >= 0x1000000 ? 25 : + w >= 0x800000 ? 24 : + w >= 0x400000 ? 23 : + w >= 0x200000 ? 22 : + w >= 0x100000 ? 21 : + w >= 0x80000 ? 20 : + w >= 0x40000 ? 19 : + w >= 0x20000 ? 18 : + w >= 0x10000 ? 17 : + w >= 0x8000 ? 16 : + w >= 0x4000 ? 15 : + w >= 0x2000 ? 14 : + w >= 0x1000 ? 13 : + w >= 0x800 ? 12 : + w >= 0x400 ? 11 : + w >= 0x200 ? 10 : + w >= 0x100 ? 9 : + w >= 0x80 ? 8 : + w >= 0x40 ? 7 : + w >= 0x20 ? 6 : + w >= 0x10 ? 5 : + w >= 0x8 ? 4 : + w >= 0x4 ? 3 : + w >= 0x2 ? 2 : + w >= 0x1 ? 1 : + 0; +}; + +// Return number of used bits in a BN +BN.prototype.bitLength = function bitLength() { + var hi = 0; + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; +}; + +BN.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); +}; + +// Return negative clone of `this` +BN.prototype.neg = function neg() { + if (this.cmpn(0) === 0) + return this.clone(); + + var r = this.clone(); + r.sign = !this.sign; + return r; +}; + + +// Or `num` with `this` in-place +BN.prototype.ior = function ior(num) { + this.sign = this.sign || num.sign; + + while (this.length < num.length) + this.words[this.length++] = 0; + + for (var i = 0; i < num.length; i++) + this.words[i] = this.words[i] | num.words[i]; + + return this.strip(); +}; + + +// Or `num` with `this` +BN.prototype.or = function or(num) { + if (this.length > num.length) + return this.clone().ior(num); + else + return num.clone().ior(this); +}; + + +// And `num` with `this` in-place +BN.prototype.iand = function iand(num) { + this.sign = this.sign && num.sign; + + // b = min-length(num, this) + var b; + if (this.length > num.length) + b = num; + else + b = this; + + for (var i = 0; i < b.length; i++) + this.words[i] = this.words[i] & num.words[i]; + + this.length = b.length; + + return this.strip(); +}; + + +// And `num` with `this` +BN.prototype.and = function and(num) { + if (this.length > num.length) + return this.clone().iand(num); + else + return num.clone().iand(this); +}; + + +// Xor `num` with `this` in-place +BN.prototype.ixor = function ixor(num) { + this.sign = this.sign || num.sign; + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) + this.words[i] = a.words[i] ^ b.words[i]; + + if (this !== a) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + + this.length = a.length; + + return this.strip(); +}; + + +// Xor `num` with `this` +BN.prototype.xor = function xor(num) { + if (this.length > num.length) + return this.clone().ixor(num); + else + return num.clone().ixor(this); +}; + + +// Set `bit` of `this` +BN.prototype.setn = function setn(bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + while (this.length <= off) + this.words[this.length++] = 0; + + if (val) + this.words[off] = this.words[off] | (1 << wbit); + else + this.words[off] = this.words[off] & ~(1 << wbit); + + return this.strip(); +}; + + +// Add `num` to `this` in-place +BN.prototype.iadd = function iadd(num) { + // negative + positive + if (this.sign && !num.sign) { + this.sign = false; + var r = this.isub(num); + this.sign = !this.sign; + return this._normSign(); + + // positive + negative + } else if (!this.sign && num.sign) { + num.sign = false; + var r = this.isub(num); + num.sign = true; + return r._normSign(); + } + + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] + b.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) + this.words[i] = a.words[i]; + } + + return this; +}; + +// Add `num` to `this` +BN.prototype.add = function add(num) { + if (num.sign && !this.sign) { + num.sign = false; + var res = this.sub(num); + num.sign = true; + return res; + } else if (!num.sign && this.sign) { + this.sign = false; + var res = num.sub(this); + this.sign = true; + return res; + } + + if (this.length > num.length) + return this.clone().iadd(num); + else + return num.clone().iadd(this); +}; + +// Subtract `num` from `this` in-place +BN.prototype.isub = function isub(num) { + // this - (-num) = this + num + if (num.sign) { + num.sign = false; + var r = this.iadd(num); + num.sign = true; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.sign) { + this.sign = false; + this.iadd(num); + this.sign = true; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.sign = false; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a; + var b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + var r = a.words[i] - b.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + var r = a.words[i] + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) + for (; i < a.length; i++) + this.words[i] = a.words[i]; + this.length = Math.max(this.length, i); + + if (a !== this) + this.sign = true; + + return this.strip(); +}; + +// Subtract `num` from `this` +BN.prototype.sub = function sub(num) { + return this.clone().isub(num); +}; + +/* +// NOTE: This could be potentionally used to generate loop-less multiplications +function _genCombMulTo(alen, blen) { + var len = alen + blen - 1; + var src = [ + 'var a = this.words, b = num.words, o = out.words, c = 0, w, ' + + 'mask = 0x3ffffff, shift = 0x4000000;', + 'out.length = ' + len + ';' + ]; + for (var k = 0; k < len; k++) { + var minJ = Math.max(0, k - alen + 1); + var maxJ = Math.min(k, blen - 1); + + for (var j = minJ; j <= maxJ; j++) { + var i = k - j; + var mul = 'a[' + i + '] * b[' + j + ']'; + + if (j === minJ) { + src.push('w = ' + mul + ' + c;'); + src.push('c = (w / shift) | 0;'); + } else { + src.push('w += ' + mul + ';'); + src.push('c += (w / shift) | 0;'); + } + src.push('w &= mask;'); + } + src.push('o[' + k + '] = w;'); + } + src.push('if (c !== 0) {', + ' o[' + k + '] = c;', + ' out.length++;', + '}', + 'return out;'); + + return src.join('\n'); +} +*/ + +BN.prototype._smallMulTo = function _smallMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + } + out.words[k] = rword; + carry = ncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype._bigMulTo = function _bigMulTo(num, out) { + out.sign = num.sign !== this.sign; + out.length = this.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - this.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); +}; + +BN.prototype.mulTo = function mulTo(num, out) { + var res; + if (this.length + num.length < 63) + res = this._smallMulTo(num, out); + else + res = this._bigMulTo(num, out); + return res; +}; + +// Multiply `this` by `num` +BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); +}; + +// In-place Multiplication +BN.prototype.imul = function imul(num) { + if (this.cmpn(0) === 0 || num.cmpn(0) === 0) { + this.words[0] = 0; + this.length = 1; + return this; + } + + var tlen = this.length; + var nlen = num.length; + + this.sign = num.sign !== this.sign; + this.length = this.length + num.length; + this.words[this.length - 1] = 0; + + for (var k = this.length - 2; k >= 0; k--) { + // Sum all words with the same `i + j = k` and accumulate `carry`, + // note that carry could be >= 0x3ffffff + var carry = 0; + var rword = 0; + var maxJ = Math.min(k, nlen - 1); + for (var j = Math.max(0, k - tlen + 1); j <= maxJ; j++) { + var i = k - j; + var a = this.words[i]; + var b = num.words[j]; + var r = a * b; + + var lo = r & 0x3ffffff; + carry += (r / 0x4000000) | 0; + lo += rword; + rword = lo & 0x3ffffff; + carry += lo >>> 26; + } + this.words[k] = rword; + this.words[k + 1] += carry; + carry = 0; + } + + // Propagate overflows + var carry = 0; + for (var i = 1; i < this.length; i++) { + var w = this.words[i] + carry; + this.words[i] = w & 0x3ffffff; + carry = w >>> 26; + } + + return this.strip(); +}; + +BN.prototype.imuln = function imuln(num) { + assert(typeof num === 'number'); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i] * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; +}; + +// `this` * `this` +BN.prototype.sqr = function sqr() { + return this.mul(this); +}; + +// `this` * `this` in-place +BN.prototype.isqr = function isqr() { + return this.mul(this); +}; + +// Shift-left in-place +BN.prototype.ishln = function ishln(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + + if (r !== 0) { + var carry = 0; + for (var i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = (this.words[i] - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (var i = this.length - 1; i >= 0; i--) + this.words[i + s] = this.words[i]; + for (var i = 0; i < s; i++) + this.words[i] = 0; + this.length += s; + } + + return this.strip(); +}; + +// Shift-right in-place +// NOTE: `hint` is a lowest bit before trailing zeroes +// NOTE: if `extended` is true - { lo: ..., hi: } object will be returned +BN.prototype.ishrn = function ishrn(bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + if (hint) + hint = (hint - (hint % 26)) / 26; + else + hint = 0; + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + hint -= s; + hint = Math.max(0, hint); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) + maskedWords.words[i] = this.words[i]; + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (var i = 0; i < this.length; i++) + this.words[i] = this.words[i + s]; + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (var i = this.length - 1; i >= 0 && (carry !== 0 || i >= hint); i--) { + var word = this.words[i]; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) + maskedWords.words[maskedWords.length++] = carry; + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + this.strip(); + if (extended) + return { hi: this, lo: maskedWords }; + + return this; +}; + +// Shift-left +BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); +}; + +// Shift-right +BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); +}; + +// Test if n bit is set +BN.prototype.testn = function testn(bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + return false; + } + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); +}; + +// Return only lowers bits of number (in-place) +BN.prototype.imaskn = function imaskn(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(!this.sign, 'imaskn works only with positive numbers'); + + if (r !== 0) + s++; + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); +}; + +// Return only lowers bits of number +BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); +}; + +// Add plain number `num` to `this` +BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.isubn(-num); + + // Possible sign change + if (this.sign) { + if (this.length === 1 && this.words[0] < num) { + this.words[0] = num - this.words[0]; + this.sign = false; + return this; + } + + this.sign = false; + this.isubn(num); + this.sign = true; + return this; + } + + // Add without checks + return this._iaddn(num); +}; + +BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) + this.words[i + 1] = 1; + else + this.words[i + 1]++; + } + this.length = Math.max(this.length, i + 1); + + return this; +}; + +// Subtract plain number `num` from `this` +BN.prototype.isubn = function isubn(num) { + assert(typeof num === 'number'); + if (num < 0) + return this.iaddn(-num); + + if (this.sign) { + this.sign = false; + this.iaddn(num); + this.sign = true; + return this; + } + + this.words[0] -= num; + + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + + return this.strip(); +}; + +BN.prototype.addn = function addn(num) { + return this.clone().iaddn(num); +}; + +BN.prototype.subn = function subn(num) { + return this.clone().isubn(num); +}; + +BN.prototype.iabs = function iabs() { + this.sign = false; + + return this; +}; + +BN.prototype.abs = function abs() { + return this.clone().iabs(); +}; + +BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) { + // Bigger storage is needed + var len = num.length + shift; + var i; + if (this.words.length < len) { + var t = new Array(len); + for (var i = 0; i < this.length; i++) + t[i] = this.words[i]; + this.words = t; + } else { + i = this.length; + } + + // Zeroify rest + this.length = Math.max(this.length, len); + for (; i < this.length; i++) + this.words[i] = 0; + + var carry = 0; + for (var i = 0; i < num.length; i++) { + var w = this.words[i + shift] + carry; + var right = num.words[i] * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + var w = this.words[i + shift] + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) + return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (var i = 0; i < this.length; i++) { + var w = -this.words[i] + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.sign = true; + + return this.strip(); +}; + +BN.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1]; + for (var shift = 0; bhi < 0x2000000; shift++) + bhi <<= 1; + if (shift !== 0) { + b = b.shln(shift); + a.ishln(shift); + bhi = b.words[b.length - 1]; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) + q.words[i] = 0; + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (!diff.sign) { + a = diff; + if (q) + q.words[m] = 1; + } + + for (var j = m - 1; j >= 0; j--) { + var qj = a.words[b.length + j] * 0x4000000 + a.words[b.length + j - 1]; + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.sign) { + qj--; + a.sign = false; + a._ishlnsubmul(b, 1, j); + a.sign = !a.sign; + } + if (q) + q.words[j] = qj; + } + if (q) + q.strip(); + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) + a.ishrn(shift); + return { div: q ? q : null, mod: a }; +}; + +BN.prototype.divmod = function divmod(num, mode) { + assert(num.cmpn(0) !== 0); + + if (this.sign && !num.sign) { + var res = this.neg().divmod(num, mode); + var div; + var mod; + if (mode !== 'mod') + div = res.div.neg(); + if (mode !== 'div') + mod = res.mod.cmpn(0) === 0 ? res.mod : num.sub(res.mod); + return { + div: div, + mod: mod + }; + } else if (!this.sign && num.sign) { + var res = this.divmod(num.neg(), mode); + var div; + if (mode !== 'mod') + div = res.div.neg(); + return { div: div, mod: res.mod }; + } else if (this.sign && num.sign) { + return this.neg().divmod(num.neg(), mode); + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) + return { div: new BN(0), mod: this }; + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') + return { div: this.divn(num.words[0]), mod: null }; + else if (mode === 'mod') + return { div: null, mod: new BN(this.modn(num.words[0])) }; + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); +}; + +// Find `this` / `num` +BN.prototype.div = function div(num) { + return this.divmod(num, 'div').div; +}; + +// Find `this` % `num` +BN.prototype.mod = function mod(num) { + return this.divmod(num, 'mod').mod; +}; + +// Find Round(`this` / `num`) +BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.cmpn(0) === 0) + return dm.div; + + var mod = dm.div.sign ? dm.mod.isub(num) : dm.mod; + + var half = num.shrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) + return dm.div; + + // Round up + return dm.div.sign ? dm.div.isubn(1) : dm.div.iaddn(1); +}; + +BN.prototype.modn = function modn(num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) + acc = (p * acc + this.words[i]) % num; + + return acc; +}; + +// In-place division by number +BN.prototype.idivn = function idivn(num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = this.words[i] + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); +}; + +BN.prototype.divn = function divn(num) { + return this.clone().idivn(num); +}; + +BN.prototype._egcd = function _egcd(x1, p) { + assert(!p.sign); + assert(p.cmpn(0) !== 0); + + var a = this; + var b = p.clone(); + + if (a.sign) + a = a.mod(p); + else + a = a.clone(); + + var x2 = new BN(0); + while (b.isEven()) + b.ishrn(1); + var delta = b.clone(); + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + while (a.isEven()) { + a.ishrn(1); + if (x1.isEven()) + x1.ishrn(1); + else + x1.iadd(delta).ishrn(1); + } + while (b.isEven()) { + b.ishrn(1); + if (x2.isEven()) + x2.ishrn(1); + else + x2.iadd(delta).ishrn(1); + } + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + if (a.cmpn(1) === 0) + return x1; + else + return x2; +}; + +BN.prototype.gcd = function gcd(num) { + if (this.cmpn(0) === 0) + return num.clone(); + if (num.cmpn(0) === 0) + return this.clone(); + + var a = this.clone(); + var b = num.clone(); + a.sign = false; + b.sign = false; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.ishrn(1); + b.ishrn(1); + } + + while (a.isEven()) + a.ishrn(1); + + do { + while (b.isEven()) + b.ishrn(1); + + // Swap `a` and `b` to make `a` always bigger than `b` + if (a.cmp(b) < 0) { + var t = a; + a = b; + b = t; + } + a.isub(a.div(b).mul(b)); + } while (a.cmpn(0) !== 0 && b.cmpn(0) !== 0); + if (a.cmpn(0) === 0) + return b.ishln(shift); + else + return a.ishln(shift); +}; + +// Invert number in the field F(num) +BN.prototype.invm = function invm(num) { + return this._egcd(new BN(1), num).mod(num); +}; + +BN.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; +}; + +BN.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; +}; + +// And first word and num +BN.prototype.andln = function andln(num) { + return this.words[0] & num; +}; + +// Increment at the bit position in-line +BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + for (var i = this.length; i < s + 1; i++) + this.words[i] = 0; + this.words[s] |= q; + this.length = s + 1; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i]; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; +}; + +BN.prototype.cmpn = function cmpn(num) { + var sign = num < 0; + if (sign) + num = -num; + + if (this.sign && !sign) + return -1; + else if (!this.sign && sign) + return 1; + + num &= 0x3ffffff; + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + var w = this.words[0]; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.sign) + res = -res; + return res; +}; + +// Compare two numbers and return: +// 1 - if `this` > `num` +// 0 - if `this` == `num` +// -1 - if `this` < `num` +BN.prototype.cmp = function cmp(num) { + if (this.sign && !num.sign) + return -1; + else if (!this.sign && num.sign) + return 1; + + var res = this.ucmp(num); + if (this.sign) + return -res; + else + return res; +}; + +// Unsigned comparison +BN.prototype.ucmp = function ucmp(num) { + // At this point both numbers have the same sign + if (this.length > num.length) + return 1; + else if (this.length < num.length) + return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i]; + var b = num.words[i]; + + if (a === b) + continue; + if (a < b) + res = -1; + else if (a > b) + res = 1; + break; + } + return res; +}; + +// +// A reduce context, could be using montgomery or something better, depending +// on the `m` itself. +// +BN.red = function red(num) { + return new Red(num); +}; + +BN.prototype.toRed = function toRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(!this.sign, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); +}; + +BN.prototype.fromRed = function fromRed() { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); +}; + +BN.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; +}; + +BN.prototype.forceRed = function forceRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); +}; + +BN.prototype.redAdd = function redAdd(num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); +}; + +BN.prototype.redIAdd = function redIAdd(num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); +}; + +BN.prototype.redSub = function redSub(num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); +}; + +BN.prototype.redISub = function redISub(num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); +}; + +BN.prototype.redShl = function redShl(num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); +}; + +BN.prototype.redMul = function redMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); +}; + +BN.prototype.redIMul = function redIMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); +}; + +BN.prototype.redSqr = function redSqr() { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); +}; + +BN.prototype.redISqr = function redISqr() { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); +}; + +// Square root over p +BN.prototype.redSqrt = function redSqrt() { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); +}; + +BN.prototype.redInvm = function redInvm() { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); +}; + +// Return negative clone of `this` % `red modulo` +BN.prototype.redNeg = function redNeg() { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); +}; + +BN.prototype.redPow = function redPow(num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); +}; + +// Prime numbers with efficient reduction +var primes = { + k256: null, + p224: null, + p192: null, + p25519: null +}; + +// Pseudo-Mersenne prime +function MPrime(name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).ishln(this.n).isub(this.p); + + this.tmp = this._tmp(); +} + +MPrime.prototype._tmp = function _tmp() { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; +}; + +MPrime.prototype.ireduce = function ireduce(num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + var pair = r.ishrn(this.n, 0, this.tmp); + r = this.imulK(pair.hi); + r = r.iadd(pair.lo); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.cmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + r.strip(); + } + + return r; +}; + +MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); +}; + +function K256() { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); +} +inherits(K256, MPrime); + +K256.prototype.imulK = function imulK(num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var hi; + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i]; + hi = w * 0x40; + lo += w * 0x3d1; + hi += (lo / 0x4000000) | 0; + lo &= 0x3ffffff; + + num.words[i] = lo; + + lo = hi; + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) + num.length--; + } + return num; +}; + +function P224() { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); +} +inherits(P224, MPrime); + +function P192() { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); +} +inherits(P192, MPrime); + +function P25519() { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); +} +inherits(P25519, MPrime); + +P25519.prototype.imulK = function imulK(num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = num.words[i] * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) + num.words[num.length++] = carry; + return num; +}; + +// Exported mostly for testing purposes, use plain name instead +BN._prime = function prime(name) { + // Cached version of prime + if (primes[name]) + return primes[name]; + + var prime; + if (name === 'k256') + prime = new K256(); + else if (name === 'p224') + prime = new P224(); + else if (name === 'p192') + prime = new P192(); + else if (name === 'p25519') + prime = new P25519(); + else + throw new Error('Unknown prime ' + name); + primes[name] = prime; + + return prime; +}; + +// +// Base reduction engine +// +function Red(m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + this.m = m; + this.prime = null; + } +} + +Red.prototype._verify1 = function _verify1(a) { + assert(!a.sign, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); +}; + +Red.prototype._verify2 = function _verify2(a, b) { + assert(!a.sign && !b.sign, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); +}; + +Red.prototype.imod = function imod(a) { + if (this.prime) + return this.prime.ireduce(a)._forceRed(this); + return a.mod(this.m)._forceRed(this); +}; + +Red.prototype.neg = function neg(a) { + var r = a.clone(); + r.sign = !r.sign; + return r.iadd(this.m)._forceRed(this); +}; + +Red.prototype.add = function add(a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res._forceRed(this); +}; + +Red.prototype.iadd = function iadd(a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) + res.isub(this.m); + return res; +}; + +Red.prototype.sub = function sub(a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res._forceRed(this); +}; + +Red.prototype.isub = function isub(a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) + res.iadd(this.m); + return res; +}; + +Red.prototype.shl = function shl(a, num) { + this._verify1(a); + return this.imod(a.shln(num)); +}; + +Red.prototype.imul = function imul(a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); +}; + +Red.prototype.mul = function mul(a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); +}; + +Red.prototype.isqr = function isqr(a) { + return this.imul(a, a); +}; + +Red.prototype.sqr = function sqr(a) { + return this.mul(a, a); +}; + +Red.prototype.sqrt = function sqrt(a) { + if (a.cmpn(0) === 0) + return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).ishrn(2); + var r = this.pow(a, pow); + return r; + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (q.cmpn(0) !== 0 && q.andln(1) === 0) { + s++; + q.ishrn(1); + } + assert(q.cmpn(0) !== 0); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).ishrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + while (this.pow(z, lpow).cmp(nOne) !== 0) + z.redIAdd(nOne); + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).ishrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) + tmp = tmp.redSqr(); + assert(i < m); + var b = this.pow(c, new BN(1).ishln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; +}; + +Red.prototype.invm = function invm(a) { + var inv = a._egcd(new BN(1), this.m); + if (inv.sign) { + inv.sign = false; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } +}; + +Red.prototype.pow = function pow(a, num) { + var w = []; + var q = num.clone(); + while (q.cmpn(0) !== 0) { + w.push(q.andln(1)); + q.ishrn(1); + } + + // Skip leading zeroes + var res = a; + for (var i = 0; i < w.length; i++, res = this.sqr(res)) + if (w[i] !== 0) + break; + + if (++i < w.length) { + for (var q = this.sqr(res); i < w.length; i++, q = this.sqr(q)) { + if (w[i] === 0) + continue; + res = this.mul(res, q); + } + } + + return res; +}; + +Red.prototype.convertTo = function convertTo(num) { + return num.clone(); +}; + +Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; +}; + +// +// Montgomery method engine +// + +BN.mont = function mont(num) { + return new Mont(num); +}; + +function Mont(m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) + this.shift += 26 - (this.shift % 26); + this.r = new BN(1).ishln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r.invm(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv.sign = true; + this.minv = this.minv.mod(this.r); +} +inherits(Mont, Red); + +Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.shln(this.shift)); +}; + +Mont.prototype.convertFrom = function convertFrom(num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; +}; + +Mont.prototype.imul = function imul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.mul = function mul(a, b) { + if (a.cmpn(0) === 0 || b.cmpn(0) === 0) + return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).ishrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) + res = u.isub(this.m); + else if (u.cmpn(0) < 0) + res = u.iadd(this.m); + + return res._forceRed(this); +}; + +Mont.prototype.invm = function invm(a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a.invm(this.m).mul(this.r2)); + return res._forceRed(this); +}; + +})(typeof module === 'undefined' || module, this); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/package.json b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/package.json new file mode 100644 index 00000000..37475efb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/package.json @@ -0,0 +1,56 @@ +{ + "name": "bn.js", + "version": "1.3.0", + "description": "Big number implementation in pure javascript", + "main": "lib/bn.js", + "scripts": { + "test": "jshint lib/*.js && mocha --reporter=spec test/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/bn.js" + }, + "keywords": [ + "BN", + "BigNum", + "Big number", + "Modulo", + "Montgomery" + ], + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/bn.js/issues" + }, + "homepage": "https://github.com/indutny/bn.js", + "devDependencies": { + "jshint": "^2.6.0", + "mocha": "^2.1.0" + }, + "gitHead": "3d156a29566f2172b39ebcc0ec00cc3af4c205f8", + "_id": "bn.js@1.3.0", + "_shasum": "0db4cbf96f8f23b742f5bcb9d1aa7a9994a05e83", + "_from": "bn.js@>=1.0.0 <2.0.0", + "_npmVersion": "2.4.1", + "_nodeVersion": "1.1.0", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "0db4cbf96f8f23b742f5bcb9d1aa7a9994a05e83", + "tarball": "http://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/bn-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/bn-test.js new file mode 100644 index 00000000..c53ac5f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/bn-test.js @@ -0,0 +1,506 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN', function() { + it('should work with Number input', function() { + assert.equal(new BN(12345).toString(16), '3039'); + assert.equal(new BN(0x4123456).toString(16), '4123456'); + }); + + it('should work with String input', function() { + assert.equal(new BN('29048849665247').toString(16), + '1a6b765d8cdf'); + assert.equal(new BN('-29048849665247').toString(16), + '-1a6b765d8cdf'); + assert.equal(new BN('1A6B765D8CDF', 16).toString(16), + '1a6b765d8cdf'); + assert.equal(new BN('FF', 16).toString(), '255'); + assert.equal(new BN('1A6B765D8CDF', 16).toString(), + '29048849665247'); + assert.equal(new BN('a89c e5af8724 c0a23e0e 0ff77500', 16).toString(16), + 'a89ce5af8724c0a23e0e0ff77500'); + assert.equal(new BN('123456789abcdef123456789abcdef123456789abcdef', + 16).toString(16), + '123456789abcdef123456789abcdef123456789abcdef'); + assert.equal(new BN('10654321').toString(), '10654321'); + assert.equal(new BN('10000000000000000').toString(10), + '10000000000000000'); + var base2 = '11111111111111111111111111111111111111111111111111111'; + assert.equal(new BN(base2, 2).toString(2), base2); + var base36 = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'; + assert.equal(new BN(base36, 36).toString(36), base36); + + assert( + new BN('6582018229284824168619876730229320890292528855852623664389292032') + .words[0] < 0x4000000); + }); + + it('should import/export big endian', function() { + assert.equal(new BN([1,2,3]).toString(16), '10203'); + assert.equal(new BN([1,2,3,4]).toString(16), '1020304'); + assert.equal(new BN([1,2,3,4,5]).toString(16), '102030405'); + assert.equal(new BN([1,2,3,4,5,6,7,8]).toString(16), '102030405060708'); + assert.equal(new BN([1,2,3,4]).toArray().join(','), '1,2,3,4'); + assert.equal(new BN([1,2,3,4,5,6,7,8]).toArray().join(','), + '1,2,3,4,5,6,7,8'); + }); + + it('should import little endian', function() { + assert.equal(new BN([1,2,3], 10, 'le').toString(16), '30201'); + assert.equal(new BN([1,2,3,4], 10, 'le').toString(16), '4030201'); + assert.equal(new BN([1,2,3,4,5], 10, 'le').toString(16), '504030201'); + assert.equal(new BN([1,2,3,4,5,6,7,8], 10, 'le').toString(16), '807060504030201'); + }); + + it('should return proper bitLength', function() { + assert.equal(new BN(0).bitLength(), 0); + assert.equal(new BN(0x1).bitLength(), 1); + assert.equal(new BN(0x2).bitLength(), 2); + assert.equal(new BN(0x3).bitLength(), 2); + assert.equal(new BN(0x4).bitLength(), 3); + assert.equal(new BN(0x8).bitLength(), 4); + assert.equal(new BN(0x10).bitLength(), 5); + assert.equal(new BN(0x100).bitLength(), 9); + assert.equal(new BN(0x123456).bitLength(), 21); + assert.equal(new BN('123456789', 16).bitLength(), 33); + assert.equal(new BN('8023456789', 16).bitLength(), 40); + }); + + it('should add numbers', function() { + assert.equal(new BN(14).add(new BN(26)).toString(16), '28'); + var k = new BN(0x1234); + var r = k; + for (var i = 0; i < 257; i++) + r = r.add(k); + assert.equal(r.toString(16), '125868'); + + var k = new BN('abcdefabcdefabcdef', 16); + var r = new BN('deadbeef', 16); + for (var i = 0; i < 257; i++) + r.iadd(k); + assert.equal(r.toString(16), 'ac79bd9b79be7a277bde'); + }); + + describe('hex padding', function(){ + it('should have length of 8 from leading 15', function(){ + var a = new BN('ffb9602', 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 8); + }); + + it('should have length of 8 from leading zero', function(){ + var a = new BN('fb9604', 16); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 8 from leading zeros', function(){ + var a = new BN(0); + var b = new Buffer(a.toString('hex', 8), 'hex'); + assert.equal(a.toString('hex', 8).length, 8); + }); + + it('should have length of 64 from leading 15', function(){ + var a = new BN( + 'ffb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 2), 'hex'); + assert.equal(a.toString('hex', 2).length, 64); + }); + + it('should have length of 64 from leading zero', function(){ + var a = new BN( + 'fb96ff654e61130ba8422f0debca77a0ea74ae5ea8bca9b54ab64aabf01003', + 16); + var b = new Buffer(a.toString('hex', 64), 'hex'); + assert.equal(a.toString('hex', 64).length, 64); + }); + }); + + describe('iaddn', function() { + it('should allow a sign change', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.iaddn(200) + + assert.equal(a.sign, false) + assert.equal(a.toString(), '100') + }) + }) + + it('should subtract numbers', function() { + assert.equal(new BN(14).sub(new BN(26)).toString(16), '-c'); + assert.equal(new BN(26).sub(new BN(14)).toString(16), 'c'); + assert.equal(new BN(26).sub(new BN(26)).toString(16), '0'); + assert.equal(new BN(-26).sub(new BN(26)).toString(16), '-34'); + + var a = new BN( + '31ff3c61db2db84b9823d320907a573f6ad37c437abe458b1802cda041d6384' + + 'a7d8daef41395491e2', + 16); + var b = new BN( + '6f0e4d9f1d6071c183677f601af9305721c91d31b0bbbae8fb790000', + 16); + var r = new BN( + '31ff3c61db2db84b9823d3208989726578fd75276287cd9516533a9acfb9a67' + + '76281f34583ddb91e2', + 16); + assert.equal(a.sub(b).cmp(r), 0); + + // In-place + assert.equal(b.clone().isub(a).neg().cmp(r), 0); + + var r = b.sub(new BN(14)); + assert.equal(b.clone().isubn(14).cmp(r), 0); + + var r = new BN( + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b', 16); + assert.equal(r.isubn(-1).toString(16), + '7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681c'); + + // Carry and copy + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(a.isub(b).toString(16), '-fffffffedcbb'); + + var a = new BN('12345', 16); + var b = new BN('1000000000000', 16); + assert.equal(b.isub(a).toString(16), 'fffffffedcbb'); + }); + + describe('isubn', function() { + it('should work for positive numbers', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.isubn(200) + assert.equal(a.sign, true) + assert.equal(a.toString(), '-300') + }) + + it('should not allow a sign change', function() { + var a = new BN(-100) + assert.equal(a.sign, true) + + a.isubn(-200); + assert.equal(a.sign, false) + assert.equal(a.toString(), '100') + }) + }) + + it('should mul numbers', function() { + assert.equal(new BN(0x1001).mul(new BN(0x1234)).toString(16), + '1235234'); + assert.equal(new BN(-0x1001).mul(new BN(0x1234)).toString(16), + '-1235234'); + assert.equal(new BN(-0x1001).mul(new BN(-0x1234)).toString(16), + '1235234'); + var n = new BN(0x1001); + var r = n; + for (var i = 0; i < 4; i++) + r = r.mul(n); + assert.equal(r.toString(16), + '100500a00a005001'); + + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal(n.mul(n).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40'); + assert.equal(n.mul(n).mul(n).toString(16), + '1b888e01a06e974017a28a5b4da436169761c9730b7aeedf75fc60f687b' + + '46e0cf2cb11667f795d5569482640fe5f628939467a01a612b02350' + + '0d0161e9730279a7561043af6197798e41b7432458463e64fa81158' + + '907322dc330562697d0d600'); + + assert.equal( + new BN('-100000000000').mul(new BN('3').div(new BN('4'))).toString(16), + '0' + ); + }); + + it('should regress mul big numbers', function() { + var q = fixtures.dhGroups.p17.q; + var qs = fixtures.dhGroups.p17.qs; + + var q = new BN(q, 16); + assert.equal(q.sqr().toString(16), qs); + }); + + it('should imul numbers', function() { + var a = new BN('abcdef01234567890abcd', 16); + var b = new BN('deadbeefa551edebabba8', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + + var a = new BN('abcdef01234567890abcd214a25123f512361e6d236', 16); + var b = new BN('deadbeefa551edebabba8121234fd21bac0341324dd', 16); + var c = a.mul(b); + + assert.equal(a.imul(b).toString(16), c.toString(16)); + }); + + it('should div numbers', function() { + assert.equal(new BN('10').div(new BN(256)).toString(16), + '0'); + assert.equal(new BN('69527932928').div(new BN('16974594')).toString(16), + 'fff'); + assert.equal(new BN('-69527932928').div(new BN('16974594')).toString(16), + '-fff'); + + var b = new BN( + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729ab9' + + 'b055c3a9458e4ce3289560a38e08ba8175a9446ce14e608245ab3a9' + + '978a8bd8acaa40', + 16); + var n = new BN( + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 16 + ); + assert.equal(b.div(n).toString(16), n.toString(16)); + + assert.equal(new BN('1').div(new BN('-5')).toString(10), '0'); + + // Regression after moving to word div + var p = new BN( + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + 16); + var a = new BN( + '79be667e f9dcbbac 55a06295 ce870b07 029bfcdb 2dce28d9 59f2815b 16f81798', + 16); + var as = a.sqr(); + assert.equal( + as.div(p).toString(16), + '39e58a8055b6fb264b75ec8c646509784204ac15a8c24e05babc9729e58090b9'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.div(p).toString(16), + 'ffffffff00000002000000000000000000000001000000000000000000000001'); + }); + + it('should mod numbers', function() { + assert.equal(new BN('10').mod(new BN(256)).toString(16), + 'a'); + assert.equal(new BN('69527932928').mod(new BN('16974594')).toString(16), + '102f302'); + assert.equal(new BN('-69527932928').mod(new BN('16974594')).toString(16), + '1000'); + + var p = new BN( + 'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', + 16); + var a = new BN( + 'fffffffe00000003fffffffd0000000200000001fffffffe00000002ffffffff' + + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', + 16); + assert.equal( + a.mod(p).toString(16), + '0'); + }); + + it('should divRound numbers', function() { + assert.equal(new BN(9).divRound(new BN(20)).toString(10), + '0'); + assert.equal(new BN(10).divRound(new BN(20)).toString(10), + '1'); + assert.equal(new BN(150).divRound(new BN(20)).toString(10), + '8'); + assert.equal(new BN(149).divRound(new BN(20)).toString(10), + '7'); + assert.equal(new BN(149).divRound(new BN(17)).toString(10), + '9'); + assert.equal(new BN(144).divRound(new BN(17)).toString(10), + '8'); + assert.equal(new BN(-144).divRound(new BN(17)).toString(10), + '-8'); + }); + + it('should absolute numbers', function() { + assert.equal(new BN(0x1001).abs().toString(), '4097'); + assert.equal(new BN(-0x1001).abs().toString(), '4097'); + assert.equal(new BN('ffffffff', 16).abs().toString(), '4294967295'); + }) + + it('should modn numbers', function() { + assert.equal(new BN('10', 16).modn(256).toString(16), '10'); + assert.equal(new BN('100', 16).modn(256).toString(16), '0'); + assert.equal(new BN('1001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(256).toString(16), '1'); + assert.equal(new BN('100000000001', 16).modn(257).toString(16), + new BN('100000000001', 16).mod(new BN(257)).toString(16)); + assert.equal(new BN('123456789012', 16).modn(3).toString(16), + new BN('123456789012', 16).mod(new BN(3)).toString(16)); + }); + + it('should idivn numbers', function() { + assert.equal(new BN('10', 16).idivn(3).toString(16), '5'); + assert.equal(new BN('12', 16).idivn(3).toString(16), '6'); + assert.equal(new BN('10000000000000000').idivn(3).toString(10), + '3333333333333333'); + assert.equal(new BN('100000000000000000000000000000').idivn(3).toString(10), + '33333333333333333333333333333'); + + var t = new BN(3); + assert.equal(new BN('12345678901234567890123456', 16).idivn(3).toString(16), + new BN('12345678901234567890123456', 16).div(t).toString(16)); + }); + + it('should shl numbers', function() { + assert.equal(new BN('69527932928').shln(13).toString(16), + '2060602000000'); + assert.equal(new BN('69527932928').shln(45).toString(16), + '206060200000000000000'); + }); + + it('should shr numbers', function() { + assert.equal(new BN('69527932928').shrn(13).toString(16), + '818180'); + assert.equal(new BN('69527932928').shrn(17).toString(16), + '81818'); + assert.equal(new BN('69527932928').shrn(256).toString(16), + '0'); + }); + + it('should invm numbers', function() { + var p = new BN(257); + var a = new BN(3); + var b = a.invm(p); + assert.equal(a.mul(b).mod(p).toString(16), '1'); + + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var a = new BN('deadbeef', 16); + var b = a.invm(p192); + assert.equal(a.mul(b).mod(p192).toString(16), '1'); + + // Even base + var phi = new BN('872d9b030ba368706b68932cf07a0e0c', 16); + var e = new BN(65537); + var d = e.invm(phi); + assert.equal(e.mul(d).mod(phi).toString(16), '1'); + }); + + it('should support bincn', function() { + assert.equal(new BN(0).bincn(1).toString(16), '2'); + assert.equal(new BN(2).bincn(1).toString(16), '4'); + assert.equal(new BN(2).bincn(1).bincn(1).toString(16), + new BN(2).bincn(2).toString(16)); + assert.equal(new BN(0xffffff).bincn(1).toString(16), '1000001'); + }); + + it('should support imaskn', function() { + assert.equal(new BN(0).imaskn(1).toString(16), '0'); + assert.equal(new BN(3).imaskn(1).toString(16), '1'); + assert.equal(new BN('123456789', 16).imaskn(4).toString(16), '9'); + assert.equal(new BN('123456789', 16).imaskn(16).toString(16), '6789'); + assert.equal(new BN('123456789', 16).imaskn(28).toString(16), '3456789'); + }); + + it('should support testn', function() { + [ + 'ff', + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' + ].forEach(function(hex) { + var bn = new BN(hex, 16) + var bl = bn.bitLength() + + for (var i = 0; i < bl; ++i) { + assert.equal(bn.testn(i), true); + } + + // test off the end + assert.equal(bn.testn(bl), false); + }) + + var xbits = [ + '01111001010111001001000100011101110100111011000110001110010111011001010', + '01110000000010110001111010101111100111110010001111000001001011010100111', + '01000101001100010001101001011110100001001111100110001110010111' + ].join('') + + var x = new BN( + '23478905234580795234378912401239784125643978256123048348957342' + ) + for (var i = 0; i < x.bitLength(); ++i) { + assert.equal(x.testn(i), (xbits.charAt(i) === '1'), 'Failed @ bit ' + i) + } + }); + + it('should support gcd', function() { + assert.equal(new BN(3).gcd(new BN(2)).toString(16), '1'); + assert.equal(new BN(18).gcd(new BN(12)).toString(16), '6'); + assert.equal(new BN(-18).gcd(new BN(12)).toString(16), '6'); + }); + + it('should and numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .and(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + }); + it('should iand numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .iand(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '0'); + assert.equal(new BN('1000000000000000000000000000000000000001', 2) + .iand(new BN('1', 2)) + .toString(2), '1') + assert.equal(new BN('1', 2) + .iand(new BN('1000000000000000000000000000000000000001', 2)) + .toString(2), '1') + }); + it('should or numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .or(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + }); + it('should ior numbers', function () { + assert.equal(new BN('1010101010101010101010101010101010101010', 2) + .ior(new BN('101010101010101010101010101010101010101', 2)) + .toString(2), '1111111111111111111111111111111111111111'); + assert.equal(new BN('1000000000000000000000000000000000000000', 2) + .ior(new BN('1', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + assert.equal(new BN('1', 2) + .ior(new BN('1000000000000000000000000000000000000000', 2)) + .toString(2), '1000000000000000000000000000000000000001'); + }); + it('should xor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .xor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + }); + it('should ixor numbers', function () { + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1100110011001100110011001100110', 2)) + .toString(2), '10101010101010101010101010101010'); + assert.equal(new BN('11001100110011001100110011001100', 2) + .ixor(new BN('1', 2)) + .toString(2), '11001100110011001100110011001101'); + assert.equal(new BN('1', 2) + .ixor(new BN('11001100110011001100110011001100', 2)) + .toString(2), '11001100110011001100110011001101'); + }); + + it('should allow single bits to be set', function () { + assert.equal(new BN(0).setn(2, true).toString(2), '100'); + assert.equal(new BN(0).setn(27, true).toString(2), + '1000000000000000000000000000'); + assert.equal(new BN('1000000000000000000000000001', 2).setn(27, false) + .toString(2), '1'); + assert.equal(new BN('101', 2).setn(2, false).toString(2), '1'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/fixtures.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/fixtures.js new file mode 100644 index 00000000..29442d92 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/fixtures.js @@ -0,0 +1,264 @@ +exports.dhGroups = { + p16: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199' + + 'ffffffffffffffff', + priv: '6d5923e6449122cbbcc1b96093e0b7e4fd3e469f58daddae' + + '53b49b20664f4132675df9ce98ae0cfdcac0f4181ccb643b' + + '625f98104dcf6f7d8e81961e2cab4b5014895260cb977c7d' + + '2f981f8532fb5da60b3676dfe57f293f05d525866053ac7e' + + '65abfd19241146e92e64f309a97ef3b529af4d6189fa416c' + + '9e1a816c3bdf88e5edf48fbd8233ef9038bb46faa95122c0' + + '5a426be72039639cd2d53d37254b3d258960dcb33c255ede' + + '20e9d7b4b123c8b4f4b986f53cdd510d042166f7dd7dca98' + + '7c39ab36381ba30a5fdd027eb6128d2ef8e5802a2194d422' + + 'b05fe6e1cb4817789b923d8636c1ec4b7601c90da3ddc178' + + '52f59217ae070d87f2e75cbfb6ff92430ad26a71c8373452' + + 'ae1cc5c93350e2d7b87e0acfeba401aaf518580937bf0b6c' + + '341f8c49165a47e49ce50853989d07171c00f43dcddddf72' + + '94fb9c3f4e1124e98ef656b797ef48974ddcd43a21fa06d0' + + '565ae8ce494747ce9e0ea0166e76eb45279e5c6471db7df8' + + 'cc88764be29666de9c545e72da36da2f7a352fb17bdeb982' + + 'a6dc0193ec4bf00b2e533efd6cd4d46e6fb237b775615576' + + 'dd6c7c7bbc087a25e6909d1ebc6e5b38e5c8472c0fc429c6' + + 'f17da1838cbcd9bbef57c5b5522fd6053e62ba21fe97c826' + + 'd3889d0cc17e5fa00b54d8d9f0f46fb523698af965950f4b' + + '941369e180f0aece3870d9335f2301db251595d173902cad' + + '394eaa6ffef8be6c', + pub: 'd53703b7340bc89bfc47176d351e5cf86d5a18d9662eca3c' + + '9759c83b6ccda8859649a5866524d77f79e501db923416ca' + + '2636243836d3e6df752defc0fb19cc386e3ae48ad647753f' + + 'bf415e2612f8a9fd01efe7aca249589590c7e6a0332630bb' + + '29c5b3501265d720213790556f0f1d114a9e2071be3620bd' + + '4ee1e8bb96689ac9e226f0a4203025f0267adc273a43582b' + + '00b70b490343529eaec4dcff140773cd6654658517f51193' + + '13f21f0a8e04fe7d7b21ffeca85ff8f87c42bb8d9cb13a72' + + 'c00e9c6e9dfcedda0777af951cc8ccab90d35e915e707d8e' + + '4c2aca219547dd78e9a1a0730accdc9ad0b854e51edd1e91' + + '4756760bab156ca6e3cb9c625cf0870def34e9ac2e552800' + + 'd6ce506d43dbbc75acfa0c8d8fb12daa3c783fb726f187d5' + + '58131779239c912d389d0511e0f3a81969d12aeee670e48f' + + 'ba41f7ed9f10705543689c2506b976a8ffabed45e33795b0' + + '1df4f6b993a33d1deab1316a67419afa31fbb6fdd252ee8c' + + '7c7d1d016c44e3fcf6b41898d7f206aa33760b505e4eff2e' + + 'c624bc7fe636b1d59e45d6f904fc391419f13d1f0cdb5b6c' + + '2378b09434159917dde709f8a6b5dc30994d056e3f964371' + + '11587ac7af0a442b8367a7bd940f752ddabf31cf01171e24' + + 'd78df136e9681cd974ce4f858a5fb6efd3234a91857bb52d' + + '9e7b414a8bc66db4b5a73bbeccfb6eb764b4f0cbf0375136' + + 'b024b04e698d54a5' + }, + p17: { + prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd1' + + '29024e088a67cc74020bbea63b139b22514a08798e3404dd' + + 'ef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245' + + 'e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7ed' + + 'ee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3d' + + 'c2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f' + + '83655d23dca3ad961c62f356208552bb9ed529077096966d' + + '670c354e4abc9804f1746c08ca18217c32905e462e36ce3b' + + 'e39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9' + + 'de2bcbf6955817183995497cea956ae515d2261898fa0510' + + '15728e5a8aaac42dad33170d04507a33a85521abdf1cba64' + + 'ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7' + + 'abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6b' + + 'f12ffa06d98a0864d87602733ec86a64521f2b18177b200c' + + 'bbe117577a615d6c770988c0bad946e208e24fa074e5ab31' + + '43db5bfce0fd108e4b82d120a92108011a723c12a787e6d7' + + '88719a10bdba5b2699c327186af4e23c1a946834b6150bda' + + '2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6' + + '287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed' + + '1f612970cee2d7afb81bdd762170481cd0069127d5b05aa9' + + '93b4ea988d8fddc186ffb7dc90a6c08f4df435c934028492' + + '36c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bd' + + 'f8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831' + + '179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1b' + + 'db7f1447e6cc254b332051512bd7af426fb8f401378cd2bf' + + '5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6' + + 'd55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f3' + + '23a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aa' + + 'cc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be328' + + '06a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55c' + + 'da56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee' + + '12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff', + priv: '6017f2bc23e1caff5b0a8b4e1fc72422b5204415787801dc' + + '025762b8dbb98ab57603aaaa27c4e6bdf742b4a1726b9375' + + 'a8ca3cf07771779589831d8bd18ddeb79c43e7e77d433950' + + 'e652e49df35b11fa09644874d71d62fdaffb580816c2c88c' + + '2c4a2eefd4a660360316741b05a15a2e37f236692ad3c463' + + 'fff559938fc6b77176e84e1bb47fb41af691c5eb7bb81bd8' + + 'c918f52625a1128f754b08f5a1403b84667231c4dfe07ed4' + + '326234c113931ce606037e960f35a2dfdec38a5f057884d3' + + '0af8fab3be39c1eeb390205fd65982191fc21d5aa30ddf51' + + 'a8e1c58c0c19fc4b4a7380ea9e836aaf671c90c29bc4bcc7' + + '813811aa436a7a9005de9b507957c56a9caa1351b6efc620' + + '7225a18f6e97f830fb6a8c4f03b82f4611e67ab9497b9271' + + 'd6ac252793cc3e5538990dbd894d2dbc2d152801937d9f74' + + 'da4b741b50b4d40e4c75e2ac163f7b397fd555648b249f97' + + 'ffe58ffb6d096aa84534c4c5729cff137759bd34e80db4ab' + + '47e2b9c52064e7f0bf677f72ac9e5d0c6606943683f9d12f' + + '180cf065a5cb8ec3179a874f358847a907f8471d15f1e728' + + '7023249d6d13c82da52628654438f47b8b5cdf4761fbf6ad' + + '9219eceac657dbd06cf2ab776ad4c968f81c3d039367f0a4' + + 'd77c7ec4435c27b6c147071665100063b5666e06eb2fb2cc' + + '3159ba34bc98ca346342195f6f1fb053ddc3bc1873564d40' + + '1c6738cdf764d6e1ff25ca5926f80102ea6593c17170966b' + + 'b5d7352dd7fb821230237ea3ebed1f920feaadbd21be295a' + + '69f2083deae9c5cdf5f4830eb04b7c1f80cc61c17232d79f' + + '7ecc2cc462a7965f804001c89982734e5abba2d31df1b012' + + '152c6b226dff34510b54be8c2cd68d795def66c57a3abfb6' + + '896f1d139e633417f8c694764974d268f46ece3a8d6616ea' + + 'a592144be48ee1e0a1595d3e5edfede5b27cec6c48ceb2ff' + + 'b42cb44275851b0ebf87dfc9aa2d0cb0805e9454b051dfe8' + + 'a29fadd82491a4b4c23f2d06ba45483ab59976da1433c9ce' + + '500164b957a04cf62dd67595319b512fc4b998424d1164dd' + + 'bbe5d1a0f7257cbb04ec9b5ed92079a1502d98725023ecb2', + pub: '3bf836229c7dd874fe37c1790d201e82ed8e192ed61571ca' + + '7285264974eb2a0171f3747b2fc23969a916cbd21e14f7e2' + + 'f0d72dcd2247affba926f9e7bb99944cb5609aed85e71b89' + + 'e89d2651550cb5bd8281bd3144066af78f194032aa777739' + + 'cccb7862a1af401f99f7e5c693f25ddce2dedd9686633820' + + 'd28d0f5ed0c6b5a094f5fe6170b8e2cbc9dff118398baee6' + + 'e895a6301cb6e881b3cae749a5bdf5c56fc897ff68bc73f2' + + '4811bb108b882872bade1f147d886a415cda2b93dd90190c' + + 'be5c2dd53fe78add5960e97f58ff2506afe437f4cf4c912a' + + '397c1a2139ac6207d3ab76e6b7ffd23bb6866dd7f87a9ae5' + + '578789084ff2d06ea0d30156d7a10496e8ebe094f5703539' + + '730f5fdbebc066de417be82c99c7da59953071f49da7878d' + + 'a588775ff2a7f0084de390f009f372af75cdeba292b08ea8' + + '4bd13a87e1ca678f9ad148145f7cef3620d69a891be46fbb' + + 'cad858e2401ec0fd72abdea2f643e6d0197b7646fbb83220' + + '0f4cf7a7f6a7559f9fb0d0f1680822af9dbd8dec4cd1b5e1' + + '7bc799e902d9fe746ddf41da3b7020350d3600347398999a' + + 'baf75d53e03ad2ee17de8a2032f1008c6c2e6618b62f225b' + + 'a2f350179445debe68500fcbb6cae970a9920e321b468b74' + + '5fb524fb88abbcacdca121d737c44d30724227a99745c209' + + 'b970d1ff93bbc9f28b01b4e714d6c9cbd9ea032d4e964d8e' + + '8fff01db095160c20b7646d9fcd314c4bc11bcc232aeccc0' + + 'fbedccbc786951025597522eef283e3f56b44561a0765783' + + '420128638c257e54b972a76e4261892d81222b3e2039c61a' + + 'ab8408fcaac3d634f848ab3ee65ea1bd13c6cd75d2e78060' + + 'e13cf67fbef8de66d2049e26c0541c679fff3e6afc290efe' + + '875c213df9678e4a7ec484bc87dae5f0a1c26d7583e38941' + + 'b7c68b004d4df8b004b666f9448aac1cc3ea21461f41ea5d' + + 'd0f7a9e6161cfe0f58bcfd304bdc11d78c2e9d542e86c0b5' + + '6985cc83f693f686eaac17411a8247bf62f5ccc7782349b5' + + 'cc1f20e312fa2acc0197154d1bfee507e8db77e8f2732f2d' + + '641440ccf248e8643b2bd1e1f9e8239356ab91098fcb431d', + q: 'a899c59999bf877d96442d284359783bdc64b5f878b688fe' + + '51407f0526e616553ad0aaaac4d5bed3046f10a1faaf42bb' + + '2342dc4b7908eea0c46e4c4576897675c2bfdc4467870d3d' + + 'cd90adaed4359237a4bc6924bfb99aa6bf5f5ede15b574ea' + + 'e977eac096f3c67d09bda574c6306c6123fa89d2f086b8dc' + + 'ff92bc570c18d83fe6c810ccfd22ce4c749ef5e6ead3fffe' + + 'c63d95e0e3fde1df9db6a35fa1d107058f37e41957769199' + + 'd945dd7a373622c65f0af3fd9eb1ddc5c764bbfaf7a3dc37' + + '2548e683b970dac4aa4b9869080d2376c9adecebb84e172c' + + '09aeeb25fb8df23e60033260c4f8aac6b8b98ab894b1fb84' + + 'ebb83c0fb2081c3f3eee07f44e24d8fabf76f19ed167b0d7' + + 'ff971565aa4efa3625fce5a43ceeaa3eebb3ce88a00f597f' + + '048c69292b38dba2103ecdd5ec4ccfe3b2d87fa6202f334b' + + 'c1cab83b608dfc875b650b69f2c7e23c0b2b4adf149a6100' + + 'db1b6dbad4679ecb1ea95eafaba3bd00db11c2134f5a8686' + + '358b8b2ab49a1b2e85e1e45caeac5cd4dc0b3b5fffba8871' + + '1c6baf399edd48dad5e5c313702737a6dbdcede80ca358e5' + + '1d1c4fe42e8948a084403f61baed38aa9a1a5ce2918e9f33' + + '100050a430b47bc592995606440272a4994677577a6aaa1b' + + 'a101045dbec5a4e9566dab5445d1af3ed19519f07ac4e2a8' + + 'bd0a84b01978f203a9125a0be020f71fab56c2c9e344d4f4' + + '12d53d3cd8eb74ca5122002e931e3cb0bd4b7492436be17a' + + 'd7ebe27148671f59432c36d8c56eb762655711cfc8471f70' + + '83a8b7283bcb3b1b1d47d37c23d030288cfcef05fbdb4e16' + + '652ee03ee7b77056a808cd700bc3d9ef826eca9a59be959c' + + '947c865d6b372a1ca2d503d7df6d7611b12111665438475a' + + '1c64145849b3da8c2d343410df892d958db232617f9896f1' + + 'de95b8b5a47132be80dd65298c7f2047858409bf762dbc05' + + 'a62ca392ac40cfb8201a0607a2cae07d99a307625f2b2d04' + + 'fe83fbd3ab53602263410f143b73d5b46fc761882e78c782' + + 'd2c36e716a770a7aefaf7f76cea872db7bffefdbc4c2f9e0' + + '39c19adac915e7a63dcb8c8c78c113f29a3e0bc10e100ce0', + qs: '6f0a2fb763eaeb8eb324d564f03d4a55fdcd709e5f1b65e9' + + '5702b0141182f9f945d71bc3e64a7dfdae7482a7dd5a4e58' + + 'bc38f78de2013f2c468a621f08536969d2c8d011bb3bc259' + + '2124692c91140a5472cad224acdacdeae5751dadfdf068b8' + + '77bfa7374694c6a7be159fc3d24ff9eeeecaf62580427ad8' + + '622d48c51a1c4b1701d768c79d8c819776e096d2694107a2' + + 'f3ec0c32224795b59d32894834039dacb369280afb221bc0' + + '90570a93cf409889b818bb30cccee98b2aa26dbba0f28499' + + '08e1a3cd43fa1f1fb71049e5c77c3724d74dc351d9989057' + + '37bbda3805bd6b1293da8774410fb66e3194e18cdb304dd9' + + 'a0b59b583dcbc9fc045ac9d56aea5cfc9f8a0b95da1e11b7' + + '574d1f976e45fe12294997fac66ca0b83fc056183549e850' + + 'a11413cc4abbe39a211e8c8cbf82f2a23266b3c10ab9e286' + + '07a1b6088909cddff856e1eb6b2cde8bdac53fa939827736' + + 'ca1b892f6c95899613442bd02dbdb747f02487718e2d3f22' + + 'f73734d29767ed8d0e346d0c4098b6fdcb4df7d0c4d29603' + + '5bffe80d6c65ae0a1b814150d349096baaf950f2caf298d2' + + 'b292a1d48cf82b10734fe8cedfa16914076dfe3e9b51337b' + + 'ed28ea1e6824bb717b641ca0e526e175d3e5ed7892aebab0' + + 'f207562cc938a821e2956107c09b6ce4049adddcd0b7505d' + + '49ae6c69a20122461102d465d93dc03db026be54c303613a' + + 'b8e5ce3fd4f65d0b6162ff740a0bf5469ffd442d8c509cd2' + + '3b40dab90f6776ca17fc0678774bd6eee1fa85ababa52ec1' + + 'a15031eb677c6c488661dddd8b83d6031fe294489ded5f08' + + '8ad1689a14baeae7e688afa3033899c81f58de39b392ca94' + + 'af6f15a46f19fa95c06f9493c8b96a9be25e78b9ea35013b' + + 'caa76de6303939299d07426a88a334278fc3d0d9fa71373e' + + 'be51d3c1076ab93a11d3d0d703366ff8cde4c11261d488e5' + + '60a2bdf3bfe2476032294800d6a4a39d306e65c6d7d8d66e' + + '5ec63eee94531e83a9bddc458a2b508285c0ee10b7bd94da' + + '2815a0c5bd5b2e15cbe66355e42f5af8955cdfc0b3a4996d' + + '288db1f4b32b15643b18193e378cb7491f3c3951cdd044b1' + + 'a519571bffac2da986f5f1d506c66530a55f70751e24fa8e' + + 'd83ac2347f4069fb561a5565e78c6f0207da24e889a93a96' + + '65f717d9fe8a2938a09ab5f81be7ccecf466c0397fc15a57' + + '469939793f302739765773c256a3ca55d0548afd117a7cae' + + '98ca7e0d749a130c7b743d376848e255f8fdbe4cb4480b63' + + 'cd2c015d1020cf095d175f3ca9dcdfbaf1b2a6e6468eee4c' + + 'c750f2132a77f376bd9782b9d0ff4da98621b898e251a263' + + '4301ba2214a8c430b2f7a79dbbfd6d7ff6e9b0c137b025ff' + + '587c0bf912f0b19d4fff96b1ecd2ca990c89b386055c60f2' + + '3b94214bd55096f17a7b2c0fa12b333235101cd6f28a128c' + + '782e8a72671adadebbd073ded30bd7f09fb693565dcf0bf3' + + '090c21d13e5b0989dd8956f18f17f4f69449a13549c9d80a' + + '77e5e61b5aeeee9528634100e7bc390672f0ded1ca53555b' + + 'abddbcf700b9da6192255bddf50a76b709fbed251dce4c7e' + + '1ca36b85d1e97c1bc9d38c887a5adf140f9eeef674c31422' + + 'e65f63cae719f8c1324e42fa5fd8500899ef5aa3f9856aa7' + + 'ce10c85600a040343204f36bfeab8cfa6e9deb8a2edd2a8e' + + '018d00c7c9fa3a251ad0f57183c37e6377797653f382ec7a' + + '2b0145e16d3c856bc3634b46d90d7198aff12aff88a30e34' + + 'e2bfaf62705f3382576a9d3eeb0829fca2387b5b654af46e' + + '5cf6316fb57d59e5ea6c369061ac64d99671b0e516529dd5' + + 'd9c48ea0503e55fee090d36c5ea8b5954f6fcc0060794e1c' + + 'b7bc24aa1e5c0142fd4ce6e8fd5aa92a7bf84317ea9e1642' + + 'b6995bac6705adf93cbce72433ed0871139970d640f67b78' + + 'e63a7a6d849db2567df69ac7d79f8c62664ac221df228289' + + 'd0a4f9ebd9acb4f87d49da64e51a619fd3f3baccbd9feb12' + + '5abe0cc2c8d17ed1d8546da2b6c641f4d3020a5f9b9f26ac' + + '16546c2d61385505612275ea344c2bbf1ce890023738f715' + + '5e9eba6a071678c8ebd009c328c3eb643679de86e69a9fa5' + + '67a9e146030ff03d546310a0a568c5ba0070e0da22f2cef8' + + '54714b04d399bbc8fd261f9e8efcd0e83bdbc3f5cfb2d024' + + '3e398478cc598e000124eb8858f9df8f52946c2a1ca5c400' + } +}; diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/pummel/dh-group-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/pummel/dh-group-test.js new file mode 100644 index 00000000..dd6481f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/pummel/dh-group-test.js @@ -0,0 +1,21 @@ +var assert = require('assert'); +var BN = require('../../').BN; +var fixtures = require('../fixtures'); + +describe('BN.js/Slow DH test', function() { + var groups = fixtures.dhGroups; + Object.keys(groups).forEach(function(name) { + it('should match public key for ' + name + ' group', function() { + var group = groups[name]; + + this.timeout(3600 * 1000); + + var base = new BN(2); + var mont = BN.red(new BN(group.prime, 16)); + var priv = new BN(group.priv, 16); + var multed = base.toRed(mont).redPow(priv).fromRed(); + var actual = new Buffer(multed.toArray()); + assert.equal(actual.toString('hex'), group.pub); + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/red-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/red-test.js new file mode 100644 index 00000000..474679ca --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/bn.js/test/red-test.js @@ -0,0 +1,140 @@ +var assert = require('assert'); +var BN = require('../').BN; +var fixtures = require('./fixtures'); + +describe('BN.js/Reduction context', function() { + function testMethod(name, fn) { + describe(name + ' method', function() { + it('should support add, iadd, sub, isub operations', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(123).toRed(m); + var b = new BN(231).toRed(m); + + assert.equal(a.redAdd(b).fromRed().toString(10), '97'); + assert.equal(a.redSub(b).fromRed().toString(10), '149'); + assert.equal(b.redSub(a).fromRed().toString(10), '108'); + + assert.equal(a.clone().redIAdd(b).fromRed().toString(10), '97'); + assert.equal(a.clone().redISub(b).fromRed().toString(10), '149'); + assert.equal(b.clone().redISub(a).fromRed().toString(10), '108'); + }); + + it('should support pow and mul operations', function() { + var p192 = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p192); + var a = new BN(123); + var b = new BN(231); + var c = a.toRed(m).redMul(b.toRed(m)).fromRed(); + assert(c.cmp(a.mul(b).mod(p192)) === 0); + + assert.equal(a.toRed(m).redPow(new BN(3)).fromRed() + .cmp(a.sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(4)).fromRed() + .cmp(a.sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(8)).fromRed() + .cmp(a.sqr().sqr().sqr()), 0); + assert.equal(a.toRed(m).redPow(new BN(9)).fromRed() + .cmp(a.sqr().sqr().sqr().mul(a)), 0); + assert.equal(a.toRed(m).redPow(new BN(17)).fromRed() + .cmp(a.sqr().sqr().sqr().sqr().mul(a)), 0); + }); + + it('should sqrtm numbers', function() { + var p = new BN(263); + var m = fn(p); + var q = new BN(11).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + var q = new BN(13).toRed(m); + var qr = q.redSqrt(true, p); + assert.equal(qr.redSqr().cmp(q), 0); + var qr = q.redSqrt(false, p); + assert.equal(qr.redSqr().cmp(q), 0); + + // Tonelli-shanks + var p = new BN(13); + var m = fn(p); + var q = new BN(10).toRed(m); + assert.equal(q.redSqrt().fromRed().toString(10), '7'); + }); + + it('should invm numbers', function() { + var p = new BN(257); + var m = fn(p); + var a = new BN(3).toRed(m); + var b = a.redInvm(p); + assert.equal(a.redMul(b).fromRed().toString(16), '1'); + }); + + it('should imul numbers', function() { + var p = new BN( + 'fffffffffffffffffffffffffffffffeffffffffffffffff', + 16); + var m = fn(p); + + var a = new BN('deadbeefabbadead', 16); + var b = new BN('abbadeadbeefdead', 16); + var c = a.mul(b).mod(p); + + assert.equal(a.toRed(m).redIMul(b.toRed(m)).fromRed().toString(16), + c.toString(16)); + }); + }); + } + + testMethod('Plain', BN.red); + testMethod('Montgomery', BN.mont); + + describe('Pseudo-Mersenne Primes', function() { + it('should reduce numbers mod k256', function() { + var p = BN._prime('k256'); + + assert.equal(p.ireduce(new BN(0xdead)).toString(16), 'dead'); + assert.equal(p.ireduce(new BN('deadbeef', 16)).toString(16), 'deadbeef'); + + var num = new BN('fedcba9876543210fedcba9876543210dead' + + 'fedcba9876543210fedcba9876543210dead', + 16); + var exp = num.mod(p.p).toString(16); + assert.equal(p.ireduce(num).toString(16), exp); + + var regr = new BN('f7e46df64c1815962bf7bc9c56128798' + + '3f4fcef9cb1979573163b477eab93959' + + '335dfb29ef07a4d835d22aa3b6797760' + + '70a8b8f59ba73d56d01a79af9', + 16); + var exp = regr.mod(p.p).toString(16); + assert.equal(p.ireduce(regr).toString(16), exp); + }); + + it('should not fail to invm number mod k256', function() { + var regr2 = new BN( + '6c150c4aa9a8cf1934485d40674d4a7cd494675537bda36d49405c5d2c6f496f', 16); + regr2 = regr2.toRed(BN.red('k256')); + assert.equal(regr2.redInvm().redMul(regr2).fromRed().cmpn(1), 0); + }); + + it('should correctly square the number', function() { + var p = BN._prime('k256').p; + var red = BN.red('k256'); + + var n = new BN('9cd8cb48c3281596139f147c1364a3ed' + + 'e88d3f310fdb0eb98c924e599ca1b3c9', + 16); + var expected = n.sqr().mod(p); + var actual = n.toRed(red).redSqr().fromRed(); + + assert.equal(actual.toString(16), expected.toString(16)); + }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/.travis.yml b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/.travis.yml new file mode 100644 index 00000000..20229620 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.11" \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/index.js new file mode 100644 index 00000000..17a169b4 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/index.js @@ -0,0 +1,46 @@ +var bn = require('bn.js'); +var randomBytes = require('randombytes'); +module.exports = crt; +function blind(priv) { + var r = getr(priv); + var blinder = r.toRed(bn.mont(priv.modulus)) + .redPow(new bn(priv.publicExponent)).fromRed(); + return { + blinder: blinder, + unblinder:r.invm(priv.modulus) + }; +} +function crt(msg, priv) { + var blinds = blind(priv); + var len = priv.modulus.byteLength(); + var mod = bn.mont(priv.modulus); + var blinded = new bn(msg).mul(blinds.blinder).mod(priv.modulus); + var c1 = blinded.toRed(bn.mont(priv.prime1)); + var c2 = blinded.toRed(bn.mont(priv.prime2)); + var qinv = priv.coefficient; + var p = priv.prime1; + var q = priv.prime2; + var m1 = c1.redPow(priv.exponent1); + var m2 = c2.redPow(priv.exponent2); + m1 = m1.fromRed(); + m2 = m2.fromRed(); + var h = m1.isub(m2).imul(qinv).mod(p); + h.imul(q); + m2.iadd(h); + var out = new Buffer(m2.imul(blinds.unblinder).mod(priv.modulus).toArray()); + if (out.length < len) { + var prefix = new Buffer(len - out.length); + prefix.fill(0); + out = Buffer.concat([prefix, out], len); + } + return out; +} +crt.getr = getr; +function getr(priv) { + var len = priv.modulus.byteLength(); + var r = new bn(randomBytes(len)); + while (r.cmp(priv.modulus) >= 0 || !r.mod(priv.prime1) || !r.mod(priv.prime2)) { + r = new bn(randomBytes(len)); + } + return r; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/package.json b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/package.json new file mode 100644 index 00000000..b153ad87 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/package.json @@ -0,0 +1,67 @@ +{ + "name": "browserify-rsa", + "version": "2.0.0", + "description": "browserify-rsa ==== [![Build Status](https://travis-ci.org/calvinmetcalf/browserify-rsa.svg)](https://travis-ci.org/calvinmetcalf/browserify-rsa)", + "main": "index.js", + "scripts": { + "test": "node test.js | tspec" + }, + "author": "", + "license": "MIT", + "dependencies": { + "bn.js": "^1.0.0", + "randombytes": "^2.0.1" + }, + "repository": { + "type": "git", + "url": "git@github.com:calvinmetcalf/browserify-rsa.git" + }, + "devDependencies": { + "tap-spec": "^2.1.2", + "tape": "^3.0.3", + "parse-asn1": "^3.0.0" + }, + "gitHead": "f0f7efebf5a0dce46cec9f396f21e215328a0c88", + "bugs": { + "url": "https://github.com/calvinmetcalf/browserify-rsa/issues" + }, + "homepage": "https://github.com/calvinmetcalf/browserify-rsa", + "_id": "browserify-rsa@2.0.0", + "_shasum": "b3e4f6d03a07db4408bfd9dbc0fef323bfe1bdcb", + "_from": "browserify-rsa@>=2.0.0 <3.0.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "1.0.4", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "b3e4f6d03a07db4408bfd9dbc0fef323bfe1bdcb", + "tarball": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-2.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-2.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/readme.md b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/readme.md new file mode 100644 index 00000000..1fb50acc --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/readme.md @@ -0,0 +1,10 @@ +browserify-rsa +==== +[![Build Status](https://travis-ci.org/calvinmetcalf/browserify-rsa.svg)](https://travis-ci.org/calvinmetcalf/browserify-rsa) + +RSA private decryption/signing using chinese remainder and blinding. + +API +==== + +Give it a message as a buffer, a private key (as decoded by https://www.npmjs.com/package/parse-asn1) and a crypto object (aka `require('crypto')`, this is because we use it in browserify crypto and don't want to create a circular dependency) \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/test.js new file mode 100644 index 00000000..c0f15963 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/browserify-rsa/test.js @@ -0,0 +1,53 @@ +var keys = [ + new Buffer('2d2d2d2d2d424547494e2050524956415445204b45592d2d2d2d2d0a4d494943647749424144414e42676b71686b6947397730424151454641415343416d457767674a6441674541416f4742414b756c55545a3842317163635a38630a44585247535930386757384b764c6c63787878474334675a484e543343425546386e3552344b453330615a79595a2f727473515a7530356a755a4a78614a30710a6d62653735646c5135642b586339424d586551672f4d70545a773554414e374f4964475959704642652b31504c5a367745666a6b59724d714d55636671324c710a68544c64416276424a6e755263595a4c716d42654f51384654724b7241674d4241414543675945416e6b485262455055332f57495353517250333669794362320a532f53425a774b6b7a6d764372427844576850654473777039632f324a593736724e57664c7a793869586755473857557a76486a653631516833676d42634b650a62556154476c34567938486131594241446f3552665272646d3046453474766776752f546b7146717042425a7765753534323835686b357a6c47376e2f4437590a646e4e58557075354d6c4e623578336757306b43515144554c2f2f637763585578592f6576614a50346a53652b5a7745515a6f2b7a58524c695055756c426f560a6177323843564d757864677771416f315831494b65665065556166375251753867434b61526e704775457558416b45417a785a54664d6d766d435544496577340a35476b36624b3236355851576468636769713235346c7042474f596d446a397943453779412b7a6d415351774d73585464514f6931684f434579725875534a350a632b2b4544514a4146683357726e7a6f455042797559584d6d45543874534652574d51357670674e716833686148523562346755433268786169756e43424e4c0a315270565939416f55694479774763472f5350683933436e4b42336e69774a42414b503741747369665a6756587469697a4234614d5468546a565961535a727a0a44304b6739447548796c706b4443686d467537375447724e55516741567559746668622f6252626c56612f4630684a3465514854334a554351425654363874620a4f6752556b30615039744333303231564e383258362b6b6c6f7753514e386f425058382b546644575355696c702f2b6a3234486b792b5a3239446f3779522f520a7175746e4c39324376426c564c56343d0a2d2d2d2d2d454e442050524956415445204b45592d2d2d2d2d0a', 'hex'), + new Buffer('2d2d2d2d2d424547494e205253412050524956415445204b45592d2d2d2d2d0a4d4949435641494241414a2f4f77737762466f2f757943386c7447662f794131412b6756354947646e4167506255534933477a624843412b782b544c472f744c0a76625277337231736d7070592f6a6b6b70695657314572534d754e307569787035676237385a39724831587057623557576770335761592f3945484d6a4d644f0a6b512f394c565a7652766c2f4d2f4669366f77502b712b616d4a493142456a454359666268474c33726d6c5664713471586334305177494441514142416e38490a565a3042506f414f68794633334b464d4878793872323866735667784a5559674d334e715167647634664661774359586a684a7a3964755535594a47464a474a0a57554765486c6b7959466c70693466336d377459374a61776d51555742304d4e536f4b48493363674458342f7466424e386e692b634f3065536f5235637a42590a4573414842553437703161774e46414877642b5a457576394834526d4d6e37703237397251547470416b4148334e7173322f7672524632635a554e34664958660a347848735142427955617947713861334a305547615346577636387a54554b466865727239755a6f744e70374e4a346a425869415277307138646f63585547310a416b4148676d4f4b486f4f5274416d696b71706d46454a5a4f7473584d614c43496d3445737a506f356369596f4c4d42635669743039416469516c74375a4a4c0a445930327376553162306167435a39376b446b6d48446b58416b414361384d394a454c7544732f502f76494759446b4d566174494666573662574630326546470a746157774d71436353457357766277307871597433346a5552704e62436a6d4379515677596641772f2b544c68503964416b414677526a64776a77333771706a0a646467316d4e697533376237737746786d6b694d4f585a5278614e4e736662353641313452704e337a6f6233516447557962476f644d494b5446626d552f6c750a436a71417861664a416b41473279663652576277464957664d7974375759436830566147424363677935373441696e566965456f335a5a7946664336332b786d0a33756f614e7934694c6f4a763447436a7155427a335a666356614f2f444457470a2d2d2d2d2d454e44205253412050524956415445204b45592d2d2d2d2d0a', 'hex'), + new Buffer('2d2d2d2d2d424547494e205253412050524956415445204b45592d2d2d2d2d0a4d4949456a77494241414b422f6779376d6a615767506546645659445a5752434139424e69763370506230657332372b464b593068737a4c614f7734374578430a744157704473483438545841667948425977424c67756179666b344c4749757078622b43474d62526f337845703043626659314a62793236543976476a5243310a666f484444554a4738347561526279487161663469367a74346756522b786c4145496a6b614641414b38634f6f58415431435671474c4c6c6a554363684c38500a6a61486a2f7972695a2f53377264776c49334c6e41427877776d4c726d522f7637315774706d4f2f614e47384e2b31706f2b5177616768546b79513539452f5a0a7641754f6b4657486f6b32712f523650594161326a645a397a696d3046714f502b6e6b5161454452624246426d4271547635664647666b32577341664b662f520a47302f5646642b5a654d353235315465547658483639356e6c53476175566c3941674d42414145436766344c725748592f6c35346f7554685a577676627275670a70667a36734a583267396c3779586d576c455773504543566f2f375355627059467074364f5a7939397a53672b494b624771574b6664686f4b725477495674430a4c30595a304e6c6d646e414e53497a30726f785147375a786b4c352b764853772f506d443978345577662b437a38684154436d4e42763171633630646b7975570a34434c71653732716154695657526f4f316961675167684e634c6f6f36765379363545784c614344545068613779753276773468465a705769456a57346478660a7246644c696978353242433836596c416c784d452f724c6738494a5676696c62796f39615764586d784f6155544c527636506b4644312f6756647738563951720a534c4e39466c4b326b6b6a695830647a6f6962765a7733744d6e74337979644178305838372b734d5256616843316270336b56507a3448793045575834514a2f0a504d33317647697549546b324e43643531445874314c746e324f503546614a536d4361456a6830586b5534716f7559796a585774384275364254436c327675610a466730556a6939432b496b504c6d61554d624d494f7761546b386357714c74685378734c6537304a354f6b477267664b554d2f772b4248483150742f506a7a6a0a432b2b6c306b6946614f5644566141563947704c504c43426f4b2f50433952622f72784d4d6f43434e774a2f4e5a756564496e793277334c4d69693737682f540a7a53766572674e47686a5936526e7661386c4c584a36646c726b6350417970733367577778716a344e5230542b474d3062445550564c62374d303758563753580a7637564a476d35324a625247774d3173732b72385854544e656d65476b2b5752784737546774734d715947584c66423851786b2f66352f4d63633030546c38750a7758464e7366784a786d7436416273547233673336774a2f49684f6e69627a3941642b6e63686c426e4e3351655733434b48717a61523138766f717674566d320a6b4a66484b31357072482f7353476d786d6945476772434a545a78744462614e434f372f56426a6e4b756455554968434177734c747571302f7a7562397641640a384731736366497076357161534e7a6d4b6f5838624f77417276725336775037794b726354737557496c484438724a5649374945446e516f5470354738664b310a68774a2f4d4968384d35763072356455594576366f494a5747636c65364148314a6d73503557496166677137325a32323838704863434648774e59384467394a0a3736517377564c6e556850546c6d6d33454f4f50474574616d32694144357230416679746c62346c624e6f51736a32737a65584f4e4458422b366f7565616a680a564e454c55723848635350356c677a525a6a4a57366146497a6a394c44526d516e55414f6a475358564f517445774a2f4d43515a374e2f763464494b654452410a3864385545785a332b674748756d7a697a7447524a30745172795a483250616b50354937562b316c377145556e4a3263336d462b65317634314570394c4376680a627a72504b773964786831386734622b37624d707357506e7372614b6836697078633761614f615a5630447867657a347a635a753050316f6c4f30634e334b4d0a6e784a305064733352386241684e43446453324a5a61527035513d3d0a2d2d2d2d2d454e44205253412050524956415445204b45592d2d2d2d2d0a', 'hex') +]; +var parseKey = require('parse-asn1'); +var privs = keys.map(parseKey); +var crt = require('./'); +var crypto = require('crypto'); +var test = require('tape'); +var constants = require('constants'); +var bn = require('bn.js'); +function testIt(priv, run) { + test('r is coprime with n ' + (run + 1), function (t) { + var len = 30; + t.plan(len); + var i = 0; + while(i++ < len) { + var r = crt.getr(priv); + t.equals(r.gcd(priv.modulus).toString(), '1', 'are coprime run ' + i); + } + }); +} +privs.forEach(testIt); + +function testMessage(key, run) { + var len = 40; + var i = 0; + while (len--) { + test('round trip key ' + (run + 1) + ' run ' + (++i), function (t) { + t.plan(1); + var priv = parseKey(key); + var len = priv.modulus.byteLength(); + var r = new bn(crypto.randomBytes(len)); + while (r.cmp(priv.modulus) >= 0) { + r = new bn(crypto.randomBytes(len)); + } + var buf = new Buffer(r.toArray()); + if (buf.byteLength < priv.modulus.byteLength()) { + var tmp = new Buffer(priv.modulus.byteLength() - buf.byteLength); + tmp.fill(0); + buf = Buffer.concat([tmp, buf]); + } + var nodeEncrypt = crypto.privateDecrypt({ + padding: constants.RSA_NO_PADDING, + key: key + }, buf).toString('hex'); + var myEncrypt = crt(buf, priv).toString('hex'); + t.equals(nodeEncrypt, myEncrypt, 'equal encrypts'); + }); + } +} +keys.forEach(testMessage); \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/EVP_BytesToKey.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/EVP_BytesToKey.js new file mode 100644 index 00000000..fc298d9d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/EVP_BytesToKey.js @@ -0,0 +1,39 @@ +var createHash = require('create-hash'); +module.exports = function evp(password, salt, keyLen) { + keyLen = keyLen/8; + var ki = 0; + var ii = 0; + var key = new Buffer(keyLen); + var addmd = 0; + var md, md_buf; + var i; + while (true) { + md = createHash('md5'); + if(addmd++ > 0) { + md.update(md_buf); + } + md.update(password); + md.update(salt); + md_buf = md.digest(); + i = 0; + if(keyLen > 0) { + while(true) { + if(keyLen === 0) { + break; + } + if(i === md_buf.length) { + break; + } + key[ki++] = md_buf[i++]; + keyLen--; + } + } + if(keyLen === 0) { + break; + } + } + for(i=0;i + + + Code coverage report for All files + + + + + + + +
+

Code coverage report for All files

+

+ + Statements: 92.07% (151 / 164)      + + + Branches: 86.84% (33 / 38)      + + + Functions: 68.18% (15 / 22)      + + + Lines: 92.07% (151 / 164)      + + Ignored: none      +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
parseASN1/92.07%(151 / 164)86.84%(33 / 38)68.18%(15 / 22)92.07%(151 / 164)
+
+
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/EVP_BytesToKey.js.html b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/EVP_BytesToKey.js.html new file mode 100644 index 00000000..177a59c6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/EVP_BytesToKey.js.html @@ -0,0 +1,436 @@ + + + + Code coverage report for parseASN1/EVP_BytesToKey.js + + + + + + + +
+

Code coverage report for parseASN1/EVP_BytesToKey.js

+

+ + Statements: 100% (29 / 29)      + + + Branches: 90% (9 / 10)      + + + Functions: 100% (1 / 1)      + + + Lines: 100% (29 / 29)      + + Ignored: none      +

+
All files » parseASN1/ » EVP_BytesToKey.js
+
+
+

+
+
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 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39  +1 +3 +3 +3 +3 +3 +3 +3 +3 +5 +5 +2 +  +5 +5 +5 +5 +5 +5 +77 +3 +  +74 +2 +  +72 +72 +  +  +5 +3 +  +  +3 +48 +  +3 + 
 
+module.exports = function evp(crypto, password, salt, keyLen) {
+  keyLen = keyLen/8;
+  var ki = 0;
+  var ii = 0;
+  var key = new Buffer(keyLen);
+  var addmd = 0;
+  var md, md_buf;
+  var i;
+  while (true) {
+    md = crypto.createHash('md5');
+    if(addmd++ > 0) {
+       md.update(md_buf);
+    }
+    md.update(password);
+    md.update(salt);
+    md_buf = md.digest();
+    i = 0;
+    Eif(keyLen > 0) {
+      while(true) {
+        if(keyLen === 0) {
+          break;
+        }
+        if(i === md_buf.length) {
+          break;
+        }
+        key[ki++] = md_buf[i++];
+        keyLen--;
+       }
+    }
+   if(keyLen === 0) {
+      break;
+    }
+  }
+  for(i=0;i<md_buf.length;i++) {
+    md_buf[i] = 0;
+  }
+  return key;
+};
+ +
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/asn1.js.html b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/asn1.js.html new file mode 100644 index 00000000..cbcf8451 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/asn1.js.html @@ -0,0 +1,859 @@ + + + + Code coverage report for parseASN1/asn1.js + + + + + + + +
+

Code coverage report for parseASN1/asn1.js

+

+ + Statements: 85.11% (40 / 47)      + + + Branches: 100% (0 / 0)      + + + Functions: 58.82% (10 / 17)      + + + Lines: 85.11% (40 / 47)      + + Ignored: none      +

+
All files » parseASN1/ » asn1.js
+
+
+

+
+
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 +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 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180  +  +  +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 +  +  +  +  +  + 
// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
+// Fedor, you are amazing.
+ 
+var asn1 = require('asn1.js');
+ 
+var RSAPrivateKey = asn1.define('RSAPrivateKey', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('modulus').int(),
+    this.key('publicExponent').int(),
+    this.key('privateExponent').int(),
+    this.key('prime1').int(),
+    this.key('prime2').int(),
+    this.key('exponent1').int(),
+    this.key('exponent2').int(),
+    this.key('coefficient').int()
+  );
+});
+exports.RSAPrivateKey = RSAPrivateKey;
+ 
+var RSAPublicKey = asn1.define('RSAPublicKey', function() {
+  this.seq().obj(
+    this.key('modulus').int(),
+    this.key('publicExponent').int()
+  );
+});
+exports.RSAPublicKey = RSAPublicKey;
+ 
+var PublicKey = asn1.define('SubjectPublicKeyInfo', function() {
+  this.seq().obj(
+    this.key('algorithm').use(AlgorithmIdentifier),
+    this.key('subjectPublicKey').bitstr()
+  );
+});
+exports.PublicKey = PublicKey;
+var ECPublicKey =  asn1.define('ECPublicKey', function() {
+  this.seq().obj(
+    this.key('algorithm').seq().obj(
+      this.key('id').objid(),
+      this.key('curve').objid()
+    ),
+    this.key('subjectPrivateKey').bitstr()
+  );
+});
+exports.ECPublicKey = ECPublicKey;
+var ECPrivateWrap =  asn1.define('ECPrivateWrap', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('algorithm').seq().obj(
+      this.key('id').objid(),
+      this.key('curve').objid()
+    ),
+    this.key('subjectPrivateKey').octstr()
+  );
+});
+exports.ECPrivateWrap = ECPrivateWrap;
+ 
+var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function() {
+  this.seq().obj(
+    this.key('algorithm').objid(),
+    this.key('none').null_().optional(),
+    this.key('curve').objid().optional(),
+    this.key('params').seq().obj(
+        this.key('p').int(),
+        this.key('q').int(),
+        this.key('g').int()
+      ).optional()
+  );
+});
+ 
+var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('algorithm').use(AlgorithmIdentifier),
+    this.key('subjectPrivateKey').octstr()
+  );
+});
+exports.PrivateKey = PrivateKeyInfo;
+var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function() {
+  this.seq().obj(
+    this.key('algorithm').seq().obj(
+      this.key('id').objid(),
+      this.key('decrypt').seq().obj(
+        this.key('kde').seq().obj(
+          this.key('id').objid(),
+          this.key('kdeparams').seq().obj(
+            this.key('salt').octstr(),
+            this.key('iters').int()
+          )
+        ),
+        this.key('cipher').seq().obj(
+          this.key('algo').objid(),
+          this.key('iv').octstr()
+        )
+      )
+    ),
+    this.key('subjectPrivateKey').octstr()
+  );
+});
+var dsaParams = asn1.define('dsaParams', function() {
+  this.seq().obj(
+    this.key('algorithm').objid(),
+    this.key('parameters').seq().obj(
+        this.key('p').int(),
+        this.key('q').int(),
+        this.key('g').int()
+      )
+  );
+});
+exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;
+var DSAPublicKey = asn1.define('DSAPublicKey', function() {
+  this.seq().obj(
+    this.key('algorithm').use(dsaParams),
+    this.key('subjectPublicKey').bitstr()
+  );
+});
+exports.DSAPublicKey = DSAPublicKey;
+var DSAPrivateWrap =  asn1.define('DSAPrivateWrap', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('algorithm').seq().obj(
+      this.key('id').objid(),
+      this.key('parameters').seq().obj(
+        this.key('p').int(),
+        this.key('q').int(),
+        this.key('g').int()
+      )
+    ),
+    this.key('subjectPrivateKey').octstr()
+  );
+});
+exports.DSAPrivateWrap = DSAPrivateWrap;
+var DSAPrivateKey = asn1.define('DSAPrivateKey', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('p').int(),
+    this.key('q').int(),
+    this.key('g').int(),
+    this.key('pub_key').int(),
+    this.key('priv_key').int()
+  );
+});
+exports.DSAPrivateKey = DSAPrivateKey;
+ 
+exports.DSAparam = asn1.define('DSAparam', function () {
+  this.int();
+});
+var ECPrivateKey = asn1.define('ECPrivateKey', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('privateKey').octstr(),
+    this.key('parameters').optional().explicit(0).use(ECParameters),
+    this.key('publicKey').optional().explicit(1).bitstr()
+  );
+});
+exports.ECPrivateKey = ECPrivateKey;
+var ECParameters = asn1.define('ECParameters', function() {
+  this.choice({
+    namedCurve: this.objid()
+  });
+});
+ 
+var ECPrivateKey2 = asn1.define('ECPrivateKey2', function() {
+  this.seq().obj(
+    this.key('version').int(),
+    this.key('privateKey').octstr(),
+    this.key('publicKey').seq().obj(
+      this.key('key').bitstr()
+    )
+  );
+});
+exports.ECPrivateKey2 = ECPrivateKey2;
+ 
+exports.signature = asn1.define('signature', function() {
+  this.seq().obj(
+    this.key('r').int(),
+    this.key('s').int()
+  );
+});
+ 
+ +
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/fixProc.js.html b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/fixProc.js.html new file mode 100644 index 00000000..e9001b01 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/fixProc.js.html @@ -0,0 +1,427 @@ + + + + Code coverage report for parseASN1/fixProc.js + + + + + + + +
+

Code coverage report for parseASN1/fixProc.js

+

+ + Statements: 100% (28 / 28)      + + + Branches: 100% (4 / 4)      + + + Functions: 100% (2 / 2)      + + + Lines: 100% (28 / 28)      + + Ignored: none      +

+
All files » parseASN1/ » fixProc.js
+
+
+

+
+
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 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +361 +1 +1 +1 +7 +7 +7 +4 +  +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +  +  +1 +3 +3 +48 +3 +3 +  +  +45 +45 +  +  +3 + 
var findProc = /Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m;
+var startRegex = /^-----BEGIN (.*)-----\n/;
+var evp = require('./EVP_BytesToKey');
+module.exports = function (okey, password, crypto) {
+  var key = okey.toString();
+  var match = key.match(findProc);
+  if (!match) {
+    return okey;
+  }
+  var suite = 'aes' + match[1];
+  var iv = new Buffer(match[2], 'hex');
+  var cipherText = new Buffer(match[3].replace(/\n\r?/g, ''), 'base64');
+  var cipherKey = evp(crypto, password, iv.slice(0,8), parseInt(match[1]));
+  var out = [];
+  var cipher = crypto.createDecipheriv(suite, cipherKey, iv);
+  out.push(cipher.update(cipherText));
+  out.push(cipher.final());
+  var decrypted = Buffer.concat(out).toString('base64');
+  var tag = key.match(startRegex)[1];
+  return '-----BEGIN ' + tag + "-----\n" + wrap(decrypted) + "\n" + '-----END ' + tag + "-----\n";
+};
+// http://stackoverflow.com/a/7033705
+function wrap(str) {
+  var chunks = [];
+  while (str) {
+    if (str.length < 64) {
+      chunks.push(str);
+      break;
+    }
+    else {
+      chunks.push(str.slice(0, 64));
+      str = str.slice(64);
+    }
+  }
+  return chunks.join("\n");
+}
+ +
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.html b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.html new file mode 100644 index 00000000..529ca97d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.html @@ -0,0 +1,389 @@ + + + + Code coverage report for parseASN1/ + + + + + + + +
+

Code coverage report for parseASN1/

+

+ + Statements: 92.07% (151 / 164)      + + + Branches: 86.84% (33 / 38)      + + + Functions: 68.18% (15 / 22)      + + + Lines: 92.07% (151 / 164)      + + Ignored: none      +

+
All files » parseASN1/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
EVP_BytesToKey.js100%(29 / 29)90%(9 / 10)100%(1 / 1)100%(29 / 29)
asn1.js85.11%(40 / 47)100%(0 / 0)58.82%(10 / 17)85.11%(40 / 47)
fixProc.js100%(28 / 28)100%(4 / 4)100%(2 / 2)100%(28 / 28)
index.js90%(54 / 60)83.33%(20 / 24)100%(2 / 2)90%(54 / 60)
+
+
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.js.html b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.js.html new file mode 100644 index 00000000..f9fbb816 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/parseASN1/index.js.html @@ -0,0 +1,622 @@ + + + + Code coverage report for parseASN1/index.js + + + + + + + +
+

Code coverage report for parseASN1/index.js

+

+ + Statements: 90% (54 / 60)      + + + Branches: 83.33% (20 / 24)      + + + Functions: 100% (2 / 2)      + + + Lines: 90% (54 / 60)      + + Ignored: none      +

+
All files » parseASN1/ » index.js
+
+
+

+
+
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 +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 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +1011 +1 +1 +1 +1 +  +1 +26 +26 +7 +7 +  +26 +  +  +26 +7 +  +26 +26 +26 +26 +26 +  +11 +11 +11 +  +5 +  +2 +2 +  +  +  +  +4 +4 +  +  +  +  +  +  +  +4 +4 +  +  +6 +6 +6 +  +3 +  +1 +  +  +  +  +2 +2 +  +  +  +  +  +  +  +2 +  +4 +  +2 +  +  +  +  +1 +1 +  +  +  +  +  +  +1 +1 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 +4 + 
var pemstrip = require('pemstrip');
+var asn1 = require('./asn1');
+var aesid = require('./aesid.json');
+var fixProc = require('./fixProc');
+module.exports = parseKeys;
+ 
+function parseKeys(buffer, crypto) {
+  var password;
+  if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
+    password = buffer.passphrase;
+    buffer = buffer.key;
+  }
+  Iif (typeof buffer === 'string') {
+    buffer = new Buffer(buffer);
+  }
+  if (password) {
+    buffer = fixProc(buffer, password, crypto);
+  }
+  var stripped = pemstrip.strip(buffer);
+  var type = stripped.tag;
+  var data = new Buffer(stripped.base64, 'base64');
+  var subtype,ndata;
+  switch (type) {
+    case 'PUBLIC KEY':
+      ndata = asn1.PublicKey.decode(data, 'der');
+      subtype = ndata.algorithm.algorithm.join('.');
+      switch(subtype) {
+        case '1.2.840.113549.1.1.1':
+          return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der');
+        case '1.2.840.10045.2.1':
+        ndata.subjectPrivateKey = ndata.subjectPublicKey;
+          return {
+            type: 'ec',
+            data:  ndata
+          };
+        case '1.2.840.10040.4.1':
+          ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der');
+          return {
+            type: 'dsa',
+            data: ndata.algorithm.params
+          };
+        default: throw new Error('unknown key id ' +  subtype);
+      }
+      throw new Error('unknown key type ' +  type);
+    case 'ENCRYPTED PRIVATE KEY':
+      data = asn1.EncryptedPrivateKey.decode(data, 'der');
+      data = decrypt(crypto, data, password);
+      //falling through
+    case 'PRIVATE KEY':
+      ndata = asn1.PrivateKey.decode(data, 'der');
+      subtype = ndata.algorithm.algorithm.join('.');
+      switch(subtype) {
+        case '1.2.840.113549.1.1.1':
+          return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der');
+        case '1.2.840.10045.2.1':
+          return {
+            curve: ndata.algorithm.curve,
+            privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
+          };
+        case '1.2.840.10040.4.1':
+          ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der');
+          return {
+            type: 'dsa',
+            params: ndata.algorithm.params
+          };
+        default: throw new Error('unknown key id ' +  subtype);
+      }
+      throw new Error('unknown key type ' +  type);
+    case 'RSA PUBLIC KEY':
+      return asn1.RSAPublicKey.decode(data, 'der');
+    case 'RSA PRIVATE KEY':
+      return asn1.RSAPrivateKey.decode(data, 'der');
+    case 'DSA PRIVATE KEY':
+      return {
+        type: 'dsa',
+        params: asn1.DSAPrivateKey.decode(data, 'der')
+      };
+    case 'EC PRIVATE KEY':
+      data = asn1.ECPrivateKey.decode(data, 'der');
+      return {
+        curve: data.parameters.value,
+        privateKey: data.privateKey
+      };
+    default: throw new Error('unknown key type ' +  type);
+  }
+}
+parseKeys.signature = asn1.signature;
+function decrypt(crypto, data, password) {
+  var salt = data.algorithm.decrypt.kde.kdeparams.salt;
+  var iters = data.algorithm.decrypt.kde.kdeparams.iters;
+  var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')];
+  var iv = data.algorithm.decrypt.cipher.iv;
+  var cipherText = data.subjectPrivateKey;
+  var keylen = parseInt(algo.split('-')[1], 10)/8;
+  var key = crypto.pbkdf2Sync(password, salt, iters, keylen);
+  var cipher = crypto.createDecipheriv(algo, key, iv);
+  var out = [];
+  out.push(cipher.update(cipherText));
+  out.push(cipher.final());
+  return Buffer.concat(out);
+}
+ +
+ + + + + + + + diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/prettify.css b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/prettify.css new file mode 100644 index 00000000..b317a7cd --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/prettify.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/prettify.js new file mode 100644 index 00000000..ef51e038 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov.info b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov.info new file mode 100644 index 00000000..beea3126 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/coverage/lcov.info @@ -0,0 +1,282 @@ +TN: +SF:/Users/cmetcalf/projects/parseASN1/index.js +FN:7,parseKeys +FN:88,decrypt +FNF:2 +FNH:2 +FNDA:26,parseKeys +FNDA:4,decrypt +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,1 +DA:5,1 +DA:7,1 +DA:8,26 +DA:9,26 +DA:10,7 +DA:11,7 +DA:13,26 +DA:14,0 +DA:16,26 +DA:17,7 +DA:19,26 +DA:20,26 +DA:21,26 +DA:22,26 +DA:23,26 +DA:25,11 +DA:26,11 +DA:27,11 +DA:29,5 +DA:31,2 +DA:32,2 +DA:37,4 +DA:38,4 +DA:42,0 +DA:44,0 +DA:46,4 +DA:47,4 +DA:50,6 +DA:51,6 +DA:52,6 +DA:54,3 +DA:56,1 +DA:61,2 +DA:62,2 +DA:66,0 +DA:68,0 +DA:70,2 +DA:72,4 +DA:74,2 +DA:79,1 +DA:80,1 +DA:84,0 +DA:87,1 +DA:88,1 +DA:89,4 +DA:90,4 +DA:91,4 +DA:92,4 +DA:93,4 +DA:94,4 +DA:95,4 +DA:96,4 +DA:97,4 +DA:98,4 +DA:99,4 +DA:100,4 +LF:60 +LH:54 +BRDA:9,1,0,7 +BRDA:9,1,1,19 +BRDA:9,2,0,26 +BRDA:9,2,1,26 +BRDA:13,3,0,0 +BRDA:13,3,1,26 +BRDA:16,4,0,7 +BRDA:16,4,1,19 +BRDA:23,5,0,11 +BRDA:23,5,1,4 +BRDA:23,5,2,6 +BRDA:23,5,3,2 +BRDA:23,5,4,4 +BRDA:23,5,5,2 +BRDA:23,5,6,1 +BRDA:23,5,7,0 +BRDA:27,6,0,5 +BRDA:27,6,1,2 +BRDA:27,6,2,4 +BRDA:27,6,3,0 +BRDA:52,7,0,3 +BRDA:52,7,1,1 +BRDA:52,7,2,2 +BRDA:52,7,3,0 +BRF:24 +BRH:20 +end_of_record +TN: +SF:/Users/cmetcalf/projects/parseASN1/asn1.js +FN:6,(anonymous_1) +FN:21,(anonymous_2) +FN:29,(anonymous_3) +FN:36,(anonymous_4) +FN:46,(anonymous_5) +FN:58,(anonymous_6) +FN:71,(anonymous_7) +FN:79,(anonymous_8) +FN:100,(anonymous_9) +FN:111,(anonymous_10) +FN:118,(anonymous_11) +FN:133,(anonymous_12) +FN:145,(anonymous_13) +FN:148,(anonymous_14) +FN:157,(anonymous_15) +FN:163,(anonymous_16) +FN:174,(anonymous_17) +FNF:17 +FNH:10 +FNDA:1,(anonymous_1) +FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:1,(anonymous_6) +FNDA:1,(anonymous_7) +FNDA:1,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:0,(anonymous_10) +FNDA:0,(anonymous_11) +FNDA:1,(anonymous_12) +FNDA:1,(anonymous_13) +FNDA:1,(anonymous_14) +FNDA:1,(anonymous_15) +FNDA:0,(anonymous_16) +FNDA:0,(anonymous_17) +DA:4,1 +DA:6,1 +DA:7,1 +DA:19,1 +DA:21,1 +DA:22,1 +DA:27,1 +DA:29,1 +DA:30,1 +DA:35,1 +DA:36,1 +DA:37,0 +DA:45,1 +DA:46,1 +DA:47,0 +DA:56,1 +DA:58,1 +DA:59,1 +DA:71,1 +DA:72,1 +DA:78,1 +DA:79,1 +DA:80,1 +DA:100,1 +DA:101,0 +DA:110,1 +DA:111,1 +DA:112,0 +DA:117,1 +DA:118,1 +DA:119,0 +DA:132,1 +DA:133,1 +DA:134,1 +DA:143,1 +DA:145,1 +DA:146,1 +DA:148,1 +DA:149,1 +DA:156,1 +DA:157,1 +DA:158,1 +DA:163,1 +DA:164,0 +DA:172,1 +DA:174,1 +DA:175,0 +LF:47 +LH:40 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Users/cmetcalf/projects/parseASN1/fixProc.js +FN:4,(anonymous_1) +FN:23,wrap +FNF:2 +FNH:2 +FNDA:7,(anonymous_1) +FNDA:3,wrap +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,1 +DA:5,7 +DA:6,7 +DA:7,7 +DA:8,4 +DA:10,3 +DA:11,3 +DA:12,3 +DA:13,3 +DA:14,3 +DA:15,3 +DA:16,3 +DA:17,3 +DA:18,3 +DA:19,3 +DA:20,3 +DA:23,1 +DA:24,3 +DA:25,3 +DA:26,48 +DA:27,3 +DA:28,3 +DA:31,45 +DA:32,45 +DA:35,3 +LF:28 +LH:28 +BRDA:7,1,0,4 +BRDA:7,1,1,3 +BRDA:26,2,0,3 +BRDA:26,2,1,45 +BRF:4 +BRH:4 +end_of_record +TN: +SF:/Users/cmetcalf/projects/parseASN1/EVP_BytesToKey.js +FN:2,evp +FNF:1 +FNH:1 +FNDA:3,evp +DA:2,1 +DA:3,3 +DA:4,3 +DA:5,3 +DA:6,3 +DA:7,3 +DA:8,3 +DA:9,3 +DA:10,3 +DA:11,5 +DA:12,5 +DA:13,2 +DA:15,5 +DA:16,5 +DA:17,5 +DA:18,5 +DA:19,5 +DA:20,5 +DA:21,77 +DA:22,3 +DA:24,74 +DA:25,2 +DA:27,72 +DA:28,72 +DA:31,5 +DA:32,3 +DA:35,3 +DA:36,48 +DA:38,3 +LF:29 +LH:29 +BRDA:12,1,0,2 +BRDA:12,1,1,3 +BRDA:19,2,0,5 +BRDA:19,2,1,0 +BRDA:21,3,0,3 +BRDA:21,3,1,74 +BRDA:24,4,0,2 +BRDA:24,4,1,72 +BRDA:31,5,0,3 +BRDA:31,5,1,2 +BRF:10 +BRH:9 +end_of_record diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/fixProc.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/fixProc.js new file mode 100644 index 00000000..b0a9f6dc --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/fixProc.js @@ -0,0 +1,45 @@ +// adapted from https://github.com/apatil/pemstrip +var findProc = /Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m; +var startRegex =/^-----BEGIN (.*) KEY-----\n/m; +var fullRegex = /^-----BEGIN (.*) KEY-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1 KEY-----$/m; +var evp = require('./EVP_BytesToKey'); +var ciphers = require('browserify-aes'); +module.exports = function (okey, password) { + var key = okey.toString(); + var match = key.match(findProc); + var decrypted; + if (!match) { + var match2 = key.match(fullRegex); + decrypted = new Buffer(match2[2].replace(/\n\r?/g, ''), 'base64'); + } else { + var suite = 'aes' + match[1]; + var iv = new Buffer(match[2], 'hex'); + var cipherText = new Buffer(match[3].replace(/\n\r?/g, ''), 'base64'); + var cipherKey = evp(password, iv.slice(0,8), parseInt(match[1])); + var out = []; + var cipher = ciphers.createDecipheriv(suite, cipherKey, iv); + out.push(cipher.update(cipherText)); + out.push(cipher.final()); + decrypted = Buffer.concat(out); + } + var tag = key.match(startRegex)[1] + ' KEY'; + return { + tag: tag, + data: decrypted + }; +}; +// http://stackoverflow.com/a/7033705 +function wrap(str) { + var chunks = []; + while (str) { + if (str.length < 64) { + chunks.push(str); + break; + } + else { + chunks.push(str.slice(0, 64)); + str = str.slice(64); + } + } + return chunks.join("\n"); +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/index.js new file mode 100644 index 00000000..309ac5db --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/index.js @@ -0,0 +1,101 @@ +var asn1 = require('./asn1'); +var aesid = require('./aesid.json'); +var fixProc = require('./fixProc'); +var ciphers = require('browserify-aes'); +var compat = require('pbkdf2-compat'); +module.exports = parseKeys; + +function parseKeys(buffer) { + var password; + if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) { + password = buffer.passphrase; + buffer = buffer.key; + } + if (typeof buffer === 'string') { + buffer = new Buffer(buffer); + } + + var stripped = fixProc(buffer, password); + + var type = stripped.tag; + var data = stripped.data; + var subtype,ndata; + switch (type) { + case 'PUBLIC KEY': + ndata = asn1.PublicKey.decode(data, 'der'); + subtype = ndata.algorithm.algorithm.join('.'); + switch(subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der'); + case '1.2.840.10045.2.1': + ndata.subjectPrivateKey = ndata.subjectPublicKey; + return { + type: 'ec', + data: ndata + }; + case '1.2.840.10040.4.1': + ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der'); + return { + type: 'dsa', + data: ndata.algorithm.params + }; + default: throw new Error('unknown key id ' + subtype); + } + throw new Error('unknown key type ' + type); + case 'ENCRYPTED PRIVATE KEY': + data = asn1.EncryptedPrivateKey.decode(data, 'der'); + data = decrypt(data, password); + //falling through + case 'PRIVATE KEY': + ndata = asn1.PrivateKey.decode(data, 'der'); + subtype = ndata.algorithm.algorithm.join('.'); + switch(subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der'); + case '1.2.840.10045.2.1': + return { + curve: ndata.algorithm.curve, + privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey + }; + case '1.2.840.10040.4.1': + ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der'); + return { + type: 'dsa', + params: ndata.algorithm.params + }; + default: throw new Error('unknown key id ' + subtype); + } + throw new Error('unknown key type ' + type); + case 'RSA PUBLIC KEY': + return asn1.RSAPublicKey.decode(data, 'der'); + case 'RSA PRIVATE KEY': + return asn1.RSAPrivateKey.decode(data, 'der'); + case 'DSA PRIVATE KEY': + return { + type: 'dsa', + params: asn1.DSAPrivateKey.decode(data, 'der') + }; + case 'EC PRIVATE KEY': + data = asn1.ECPrivateKey.decode(data, 'der'); + return { + curve: data.parameters.value, + privateKey: data.privateKey + }; + default: throw new Error('unknown key type ' + type); + } +} +parseKeys.signature = asn1.signature; +function decrypt(data, password) { + var salt = data.algorithm.decrypt.kde.kdeparams.salt; + var iters = data.algorithm.decrypt.kde.kdeparams.iters; + var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]; + var iv = data.algorithm.decrypt.cipher.iv; + var cipherText = data.subjectPrivateKey; + var keylen = parseInt(algo.split('-')[1], 10)/8; + var key = compat.pbkdf2Sync(password, salt, iters, keylen); + var cipher = ciphers.createDecipheriv(algo, key, iv); + var out = []; + out.push(cipher.update(cipherText)); + out.push(cipher.final()); + return Buffer.concat(out); +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/.npmignore b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/.npmignore new file mode 100644 index 00000000..1ca95717 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/README.md b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/README.md new file mode 100644 index 00000000..0c571b80 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/README.md @@ -0,0 +1,100 @@ +# ASN1.js + +ASN.1 DER Encoder/Decoder and DSL. + +## Example + +Define model: + +```javascript +var asn = require('asn1.js'); + +var Human = asn.define('Human', function() { + this.seq().obj( + this.key('firstName').octstr(), + this.key('lastName').octstr(), + this.key('age').int(), + this.key('gender').enum({ 0: 'male', 1: 'female' }), + this.key('bio').seqof(Bio) + ); +}); + +var Bio = asn.define('Bio', function() { + this.seq().obj( + this.key('time').gentime(), + this.key('description').octstr() + ); +}); +``` + +Encode data: + +```javascript +var output = Human.encode({ + firstName: 'Thomas', + lastName: 'Anderson', + age: 28, + gender: 'male', + bio: [ + { + time: +new Date('31 March 1999'), + description: 'freedom of mind' + } + ] +}, 'der'); +``` + +Decode data: + +```javascript +var human = Human.decode(output, 'der'); +console.log(human); +/* +{ firstName: , + lastName: , + age: 28, + gender: 'male', + bio: + [ { time: 922820400000, + description: } ] } +*/ +``` + +### Partial decode + +Its possible to parse data without stopping on first error. In order to do it, +you should call: + +```javascript +var human = Human.decode(output, 'der', { partial: true }); +console.log(human); +/* +{ result: { ... }, + errors: [ ... ] } +*/ +``` + +#### LICENSE + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2013. + +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/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js new file mode 100644 index 00000000..02bbdc1d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1.js @@ -0,0 +1,9 @@ +var asn1 = exports; + +asn1.bignum = require('bn.js'); + +asn1.define = require('./asn1/api').define; +asn1.base = require('./asn1/base'); +asn1.constants = require('./asn1/constants'); +asn1.decoders = require('./asn1/decoders'); +asn1.encoders = require('./asn1/encoders'); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/api.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/api.js new file mode 100644 index 00000000..0e8a2018 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/api.js @@ -0,0 +1,59 @@ +var asn1 = require('../asn1'); +var inherits = require('inherits'); + +var api = exports; + +api.define = function define(name, body) { + return new Entity(name, body); +}; + +function Entity(name, body) { + this.name = name; + this.body = body; + + this.decoders = {}; + this.encoders = {}; +}; + +Entity.prototype._createNamed = function createNamed(base) { + var named; + try { + named = require('vm').runInThisContext( + '(function ' + this.name + '(entity) {\n' + + ' this._initNamed(entity);\n' + + '})' + ); + } catch (e) { + named = function (entity) { + this._initNamed(entity); + }; + } + inherits(named, base); + named.prototype._initNamed = function initnamed(entity) { + base.call(this, entity); + }; + + return new named(this); +}; + +Entity.prototype._getDecoder = function _getDecoder(enc) { + // Lazily create decoder + if (!this.decoders.hasOwnProperty(enc)) + this.decoders[enc] = this._createNamed(asn1.decoders[enc]); + return this.decoders[enc]; +}; + +Entity.prototype.decode = function decode(data, enc, options) { + return this._getDecoder(enc).decode(data, options); +}; + +Entity.prototype._getEncoder = function _getEncoder(enc) { + // Lazily create encoder + if (!this.encoders.hasOwnProperty(enc)) + this.encoders[enc] = this._createNamed(asn1.encoders[enc]); + return this.encoders[enc]; +}; + +Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) { + return this._getEncoder(enc).encode(data, reporter); +}; diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/buffer.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/buffer.js new file mode 100644 index 00000000..7b1152f2 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/buffer.js @@ -0,0 +1,115 @@ +var inherits = require('inherits'); +var Reporter = require('../base').Reporter; +var Buffer = require('buffer').Buffer; + +function DecoderBuffer(base, options) { + Reporter.call(this, options); + if (!Buffer.isBuffer(base)) { + this.error('Input not Buffer'); + return; + } + + this.base = base; + this.offset = 0; + this.length = base.length; +} +inherits(DecoderBuffer, Reporter); +exports.DecoderBuffer = DecoderBuffer; + +DecoderBuffer.prototype.save = function save() { + return { offset: this.offset }; +}; + +DecoderBuffer.prototype.restore = function restore(save) { + // Return skipped data + var res = new DecoderBuffer(this.base); + res.offset = save.offset; + res.length = this.offset; + + this.offset = save.offset; + + return res; +}; + +DecoderBuffer.prototype.isEmpty = function isEmpty() { + return this.offset === this.length; +}; + +DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) { + if (this.offset + 1 <= this.length) + return this.base.readUInt8(this.offset++, true); + else + return this.error(fail || 'DecoderBuffer overrun'); +} + +DecoderBuffer.prototype.skip = function skip(bytes, fail) { + if (!(this.offset + bytes <= this.length)) + return this.error(fail || 'DecoderBuffer overrun'); + + var res = new DecoderBuffer(this.base); + + // Share reporter state + res._reporterState = this._reporterState; + + res.offset = this.offset; + res.length = this.offset + bytes; + this.offset += bytes; + return res; +} + +DecoderBuffer.prototype.raw = function raw(save) { + return this.base.slice(save ? save.offset : this.offset, this.length); +} + +function EncoderBuffer(value, reporter) { + if (Array.isArray(value)) { + this.length = 0; + this.value = value.map(function(item) { + if (!(item instanceof EncoderBuffer)) + item = new EncoderBuffer(item, reporter); + this.length += item.length; + return item; + }, this); + } else if (typeof value === 'number') { + if (!(0 <= value && value <= 0xff)) + return reporter.error('non-byte EncoderBuffer value'); + this.value = value; + this.length = 1; + } else if (typeof value === 'string') { + this.value = value; + this.length = Buffer.byteLength(value); + } else if (Buffer.isBuffer(value)) { + this.value = value; + this.length = value.length; + } else { + return reporter.error('Unsupported type: ' + typeof value); + } +} +exports.EncoderBuffer = EncoderBuffer; + +EncoderBuffer.prototype.join = function join(out, offset) { + if (!out) + out = new Buffer(this.length); + if (!offset) + offset = 0; + + if (this.length === 0) + return out; + + if (Array.isArray(this.value)) { + this.value.forEach(function(item) { + item.join(out, offset); + offset += item.length; + }); + } else { + if (typeof this.value === 'number') + out[offset] = this.value; + else if (typeof this.value === 'string') + out.write(this.value, offset); + else if (Buffer.isBuffer(this.value)) + this.value.copy(out, offset); + offset += this.length; + } + + return out; +}; diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/index.js new file mode 100644 index 00000000..935abde0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/index.js @@ -0,0 +1,6 @@ +var base = exports; + +base.Reporter = require('./reporter').Reporter; +base.DecoderBuffer = require('./buffer').DecoderBuffer; +base.EncoderBuffer = require('./buffer').EncoderBuffer; +base.Node = require('./node'); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/node.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/node.js new file mode 100644 index 00000000..9c03beb5 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/node.js @@ -0,0 +1,575 @@ +var Reporter = require('../base').Reporter; +var EncoderBuffer = require('../base').EncoderBuffer; +var assert = require('minimalistic-assert'); + +// Supported tags +var tags = [ + 'seq', 'seqof', 'set', 'setof', 'octstr', 'bitstr', 'objid', 'bool', + 'gentime', 'utctime', 'null_', 'enum', 'int', 'ia5str' +]; + +// Public methods list +var methods = [ + 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice', + 'any' +].concat(tags); + +// Overrided methods list +var overrided = [ + '_peekTag', '_decodeTag', '_use', + '_decodeStr', '_decodeObjid', '_decodeTime', + '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList', + + '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime', + '_encodeNull', '_encodeInt', '_encodeBool' +]; + +function Node(enc, parent) { + var state = {}; + this._baseState = state; + + state.enc = enc; + + state.parent = parent || null; + state.children = null; + + // State + state.tag = null; + state.args = null; + state.reverseArgs = null; + state.choice = null; + state.optional = false; + state.any = false; + state.obj = false; + state.use = null; + state.useDecoder = null; + state.key = null; + state['default'] = null; + state.explicit = null; + state.implicit = null; + + // Should create new instance on each method + if (!state.parent) { + state.children = []; + this._wrap(); + } +} +module.exports = Node; + +var stateProps = [ + 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice', + 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', + 'implicit' +]; + +Node.prototype.clone = function clone() { + var state = this._baseState; + var cstate = {}; + stateProps.forEach(function(prop) { + cstate[prop] = state[prop]; + }); + var res = new this.constructor(cstate.parent); + res._baseState = cstate; + return res; +}; + +Node.prototype._wrap = function wrap() { + var state = this._baseState; + methods.forEach(function(method) { + this[method] = function _wrappedMethod() { + var clone = new this.constructor(this); + state.children.push(clone); + return clone[method].apply(clone, arguments); + }; + }, this); +}; + +Node.prototype._init = function init(body) { + var state = this._baseState; + + assert(state.parent === null); + body.call(this); + + // Filter children + state.children = state.children.filter(function(child) { + return child._baseState.parent === this; + }, this); + assert.equal(state.children.length, 1, 'Root node can have only one child'); +}; + +Node.prototype._useArgs = function useArgs(args) { + var state = this._baseState; + + // Filter children and args + var children = args.filter(function(arg) { + return arg instanceof this.constructor; + }, this); + args = args.filter(function(arg) { + return !(arg instanceof this.constructor); + }, this); + + if (children.length !== 0) { + assert(state.children === null); + state.children = children; + + // Replace parent to maintain backward link + children.forEach(function(child) { + child._baseState.parent = this; + }, this); + } + if (args.length !== 0) { + assert(state.args === null); + state.args = args; + state.reverseArgs = args.map(function(arg) { + if (typeof arg !== 'object' || arg.constructor !== Object) + return arg; + + var res = {}; + Object.keys(arg).forEach(function(key) { + if (key == (key | 0)) + key |= 0; + var value = arg[key]; + res[value] = key; + }); + return res; + }); + } +}; + +// +// Overrided methods +// + +overrided.forEach(function(method) { + Node.prototype[method] = function _overrided() { + var state = this._baseState; + throw new Error(method + ' not implemented for encoding: ' + state.enc); + }; +}); + +// +// Public methods +// + +tags.forEach(function(tag) { + Node.prototype[tag] = function _tagMethod() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + assert(state.tag === null); + state.tag = tag; + + this._useArgs(args); + + return this; + }; +}); + +Node.prototype.use = function use(item) { + var state = this._baseState; + + assert(state.use === null); + state.use = item; + + return this; +}; + +Node.prototype.optional = function optional() { + var state = this._baseState; + + state.optional = true; + + return this; +}; + +Node.prototype.def = function def(val) { + var state = this._baseState; + + assert(state['default'] === null); + state['default'] = val; + state.optional = true; + + return this; +}; + +Node.prototype.explicit = function explicit(num) { + var state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.explicit = num; + + return this; +}; + +Node.prototype.implicit = function implicit(num) { + var state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.implicit = num; + + return this; +}; + +Node.prototype.obj = function obj() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + state.obj = true; + + if (args.length !== 0) + this._useArgs(args); + + return this; +}; + +Node.prototype.key = function key(newKey) { + var state = this._baseState; + + assert(state.key === null); + state.key = newKey; + + return this; +}; + +Node.prototype.any = function any() { + var state = this._baseState; + + state.any = true; + + return this; +}; + +Node.prototype.choice = function choice(obj) { + var state = this._baseState; + + assert(state.choice === null); + state.choice = obj; + this._useArgs(Object.keys(obj).map(function(key) { + return obj[key]; + })); + + return this; +}; + +// +// Decoding +// + +Node.prototype._decode = function decode(input) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return input.wrapResult(state.children[0]._decode(input)); + + var result = state['default']; + var present = true; + + var prevKey; + if (state.key !== null) + prevKey = input.enterKey(state.key); + + // Check if tag is there + if (state.optional) { + present = this._peekTag( + input, + state.explicit !== null ? state.explicit : + state.implicit !== null ? state.implicit : + state.tag || 0 + ); + if (input.isError(present)) + return present; + } + + // Push object on stack + var prevObj; + if (state.obj && present) + prevObj = input.enterObject(); + + if (present) { + // Unwrap explicit values + if (state.explicit !== null) { + var explicit = this._decodeTag(input, state.explicit); + if (input.isError(explicit)) + return explicit; + input = explicit; + } + + // Unwrap implicit and normal values + if (state.use === null && state.choice === null) { + if (state.any) + var save = input.save(); + var body = this._decodeTag( + input, + state.implicit !== null ? state.implicit : state.tag, + state.any + ); + if (input.isError(body)) + return body; + + if (state.any) + result = input.raw(save); + else + input = body; + } + + // Select proper method for tag + if (state.any) + result = result; + else if (state.choice === null) + result = this._decodeGeneric(state.tag, input); + else + result = this._decodeChoice(input); + + if (input.isError(result)) + return result; + + // Decode children + if (!state.any && state.choice === null && state.children !== null) { + var fail = state.children.some(function decodeChildren(child) { + // NOTE: We are ignoring errors here, to let parser continue with other + // parts of encoded data + child._decode(input); + }); + if (fail) + return err; + } + } + + // Pop object + if (state.obj && present) + result = input.leaveObject(prevObj); + + // Set key + if (state.key !== null && (result !== null || present === true)) + input.leaveKey(prevKey, state.key, result); + + return result; +}; + +Node.prototype._decodeGeneric = function decodeGeneric(tag, input) { + var state = this._baseState; + + if (tag === 'seq' || tag === 'set') + return null; + if (tag === 'seqof' || tag === 'setof') + return this._decodeList(input, tag, state.args[0]); + else if (tag === 'octstr' || tag === 'bitstr' || tag === 'ia5str') + return this._decodeStr(input, tag); + else if (tag === 'objid' && state.args) + return this._decodeObjid(input, state.args[0], state.args[1]); + else if (tag === 'objid') + return this._decodeObjid(input, null, null); + else if (tag === 'gentime' || tag === 'utctime') + return this._decodeTime(input, tag); + else if (tag === 'null_') + return this._decodeNull(input); + else if (tag === 'bool') + return this._decodeBool(input); + else if (tag === 'int' || tag === 'enum') + return this._decodeInt(input, state.args && state.args[0]); + else if (state.use !== null) + return this._getUse(state.use, input._reporterState.obj)._decode(input); + else + return input.error('unknown tag: ' + tag); + + return null; +}; + +Node.prototype._getUse = function _getUse(entity, obj) { + + var state = this._baseState; + // Create altered use decoder if implicit is set + state.useDecoder = this._use(entity, obj); + assert(state.useDecoder._baseState.parent === null); + state.useDecoder = state.useDecoder._baseState.children[0]; + if (state.implicit !== state.useDecoder._baseState.implicit) { + state.useDecoder = state.useDecoder.clone(); + state.useDecoder._baseState.implicit = state.implicit; + } + return state.useDecoder; +}; + +Node.prototype._decodeChoice = function decodeChoice(input) { + var state = this._baseState; + var result = null; + var match = false; + + Object.keys(state.choice).some(function(key) { + var save = input.save(); + var node = state.choice[key]; + try { + var value = node._decode(input); + if (input.isError(value)) + return false; + + result = { type: key, value: value }; + match = true; + } catch (e) { + input.restore(save); + return false; + } + return true; + }, this); + + if (!match) + return input.error('Choice not matched'); + + return result; +}; + +// +// Encoding +// + +Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) { + return new EncoderBuffer(data, this.reporter); +}; + +Node.prototype._encode = function encode(data, reporter, parent) { + var state = this._baseState; + if (state['default'] !== null && state['default'] === data) + return; + + var result = this._encodeValue(data, reporter, parent); + if (result === undefined) + return; + + if (this._skipDefault(result, reporter, parent)) + return; + + return result; +}; + +Node.prototype._encodeValue = function encode(data, reporter, parent) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return state.children[0]._encode(data, reporter || new Reporter()); + + var result = null; + var present = true; + + // Set reporter to share it with a child class + this.reporter = reporter; + + // Check if data is there + if (state.optional && data === undefined) { + if (state['default'] !== null) + data = state['default'] + else + return; + } + + // For error reporting + var prevKey; + + // Encode children first + var content = null; + var primitive = false; + if (state.any) { + // Anything that was given is translated to buffer + result = this._createEncoderBuffer(data); + } else if (state.choice) { + result = this._encodeChoice(data, reporter); + } else if (state.children) { + content = state.children.map(function(child) { + if (child._baseState.tag === 'null_') + return child._encode(null, reporter, data); + + if (child._baseState.key === null) + return reporter.error('Child should have a key'); + var prevKey = reporter.enterKey(child._baseState.key); + + if (typeof data !== 'object') + return reporter.error('Child expected, but input is not object'); + + var res = child._encode(data[child._baseState.key], reporter, data); + reporter.leaveKey(prevKey); + + return res; + }, this).filter(function(child) { + return child; + }); + + content = this._createEncoderBuffer(content); + } else { + if (state.tag === 'seqof' || state.tag === 'setof') { + // TODO(indutny): this should be thrown on DSL level + if (!(state.args && state.args.length === 1)) + return reporter.error('Too many args for : ' + state.tag); + + if (!Array.isArray(data)) + return reporter.error('seqof/setof, but data is not Array'); + + var child = this.clone(); + child._baseState.implicit = null; + content = this._createEncoderBuffer(data.map(function(item) { + var state = this._baseState; + + return this._getUse(state.args[0], data)._encode(item, reporter); + }, child)); + } else if (state.use !== null) { + result = this._getUse(state.use, parent)._encode(data, reporter); + } else { + content = this._encodePrimitive(state.tag, data); + primitive = true; + } + } + + // Encode data itself + var result; + if (!state.any && state.choice === null) { + var tag = state.implicit !== null ? state.implicit : state.tag; + var cls = state.implicit === null ? 'universal' : 'context'; + + if (tag === null) { + if (state.use === null) + reporter.error('Tag could be ommited only for .use()'); + } else { + if (state.use === null) + result = this._encodeComposite(tag, primitive, cls, content); + } + } + + // Wrap in explicit + if (state.explicit !== null) + result = this._encodeComposite(state.explicit, false, 'context', result); + + return result; +}; + +Node.prototype._encodeChoice = function encodeChoice(data, reporter) { + var state = this._baseState; + + var node = state.choice[data.type]; + if (!node) { + assert( + false, + data.type + ' not found in ' + + JSON.stringify(Object.keys(state.choice))); + } + return node._encode(data.value, reporter); +}; + +Node.prototype._encodePrimitive = function encodePrimitive(tag, data) { + var state = this._baseState; + + if (tag === 'octstr' || tag === 'bitstr' || tag === 'ia5str') + return this._encodeStr(data, tag); + else if (tag === 'objid' && state.args) + return this._encodeObjid(data, state.reverseArgs[0], state.args[1]); + else if (tag === 'objid') + return this._encodeObjid(data, null, null); + else if (tag === 'gentime' || tag === 'utctime') + return this._encodeTime(data, tag); + else if (tag === 'null_') + return this._encodeNull(); + else if (tag === 'int' || tag === 'enum') + return this._encodeInt(data, state.args && state.reverseArgs[0]); + else if (tag === 'bool') + return this._encodeBool(data); + else + throw new Error('Unsupported tag: ' + tag); +}; diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/reporter.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/reporter.js new file mode 100644 index 00000000..7f021907 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/base/reporter.js @@ -0,0 +1,89 @@ +var inherits = require('inherits'); + +function Reporter(options) { + this._reporterState = { + obj: null, + path: [], + options: options || {}, + errors: [] + }; +} +exports.Reporter = Reporter; + +Reporter.prototype.isError = function isError(obj) { + return obj instanceof ReporterError; +}; + +Reporter.prototype.enterKey = function enterKey(key) { + return this._reporterState.path.push(key); +}; + +Reporter.prototype.leaveKey = function leaveKey(index, key, value) { + var state = this._reporterState; + + state.path = state.path.slice(0, index - 1); + if (state.obj !== null) + state.obj[key] = value; +}; + +Reporter.prototype.enterObject = function enterObject() { + var state = this._reporterState; + + var prev = state.obj; + state.obj = {}; + return prev; +}; + +Reporter.prototype.leaveObject = function leaveObject(prev) { + var state = this._reporterState; + + var now = state.obj; + state.obj = prev; + return now; +}; + +Reporter.prototype.error = function error(msg) { + var err; + var state = this._reporterState; + + var inherited = msg instanceof ReporterError; + if (inherited) { + err = msg; + } else { + err = new ReporterError(state.path.map(function(elem) { + return '[' + JSON.stringify(elem) + ']'; + }).join(''), msg.message || msg, msg.stack); + } + + if (!state.options.partial) + throw err; + + if (!inherited) + state.errors.push(err); + + return err; +}; + +Reporter.prototype.wrapResult = function wrapResult(result) { + var state = this._reporterState; + if (!state.options.partial) + return result; + + return { + result: this.isError(result) ? null : result, + errors: state.errors + }; +}; + +function ReporterError(path, msg) { + this.path = path; + this.rethrow(msg); +}; +inherits(ReporterError, Error); + +ReporterError.prototype.rethrow = function rethrow(msg) { + this.message = msg + ' at: ' + (this.path || '(shallow)'); + Error.captureStackTrace(this, ReporterError); + + return this; +}; diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/der.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/der.js new file mode 100644 index 00000000..907dd397 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/der.js @@ -0,0 +1,42 @@ +var constants = require('../constants'); + +exports.tagClass = { + 0: 'universal', + 1: 'application', + 2: 'context', + 3: 'private' +}; +exports.tagClassByName = constants._reverse(exports.tagClass); + +exports.tag = { + 0x00: 'end', + 0x01: 'bool', + 0x02: 'int', + 0x03: 'bitstr', + 0x04: 'octstr', + 0x05: 'null_', + 0x06: 'objid', + 0x07: 'objDesc', + 0x08: 'external', + 0x09: 'real', + 0x0a: 'enum', + 0x0b: 'embed', + 0x0c: 'utf8str', + 0x0d: 'relativeOid', + 0x10: 'seq', + 0x11: 'set', + 0x12: 'numstr', + 0x13: 'printstr', + 0x14: 't61str', + 0x15: 'videostr', + 0x16: 'ia5str', + 0x17: 'utctime', + 0x18: 'gentime', + 0x19: 'graphstr', + 0x1a: 'iso646str', + 0x1b: 'genstr', + 0x1c: 'unistr', + 0x1d: 'charstr', + 0x1e: 'bmpstr' +}; +exports.tagByName = constants._reverse(exports.tag); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/index.js new file mode 100644 index 00000000..c44e3251 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/constants/index.js @@ -0,0 +1,19 @@ +var constants = exports; + +// Helper +constants._reverse = function reverse(map) { + var res = {}; + + Object.keys(map).forEach(function(key) { + // Convert key to integer if it is stringified + if ((key | 0) == key) + key = key | 0; + + var value = map[key]; + res[value] = key; + }); + + return res; +}; + +constants.der = require('./der'); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/der.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/der.js new file mode 100644 index 00000000..559600d3 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/der.js @@ -0,0 +1,300 @@ +var inherits = require('inherits'); + +var asn1 = require('../../asn1'); +var base = asn1.base; +var bignum = asn1.bignum; + +// Import DER constants +var der = asn1.constants.der; + +function DERDecoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +}; +module.exports = DERDecoder; + +DERDecoder.prototype.decode = function decode(data, options) { + if (!(data instanceof base.DecoderBuffer)) + data = new base.DecoderBuffer(data, options); + + return this.tree._decode(data, options); +}; + +// Tree methods + +function DERNode(parent) { + base.Node.call(this, 'der', parent); +} +inherits(DERNode, base.Node); + +DERNode.prototype._peekTag = function peekTag(buffer, tag) { + if (buffer.isEmpty()) + return false; + + var state = buffer.save(); + var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + buffer.restore(state); + + return decodedTag.tag === tag || decodedTag.tagStr === tag; +}; + +DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) { + var decodedTag = derDecodeTag(buffer, + 'Failed to decode tag of "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + var len = derDecodeLen(buffer, + decodedTag.primitive, + 'Failed to get length of "' + tag + '"'); + + // Failure + if (buffer.isError(len)) + return len; + + if (!any && + decodedTag.tag !== tag && + decodedTag.tagStr !== tag && + decodedTag.tagStr + 'of' !== tag) { + return buffer.error('Failed to match tag: "' + tag + '"'); + } + + if (decodedTag.primitive || len !== null) + return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); + + // Indefinite length... find END tag + var state = buffer.start(); + var res = this._skipUntilEnd( + buffer, + 'Failed to skip indefinite length body: "' + this.tag + '"'); + if (buffer.isError(res)) + return res; + + return buffer.cut(state); +}; + +DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) { + while (true) { + var tag = derDecodeTag(buffer, fail); + if (buffer.isError(tag)) + return tag; + var len = derDecodeLen(buffer, tag.primitive, fail); + if (buffer.isError(len)) + return len; + + var res; + if (tag.primitive || len !== null) + res = buffer.skip(len) + else + res = this._skipUntilEnd(buffer, fail); + + // Failure + if (buffer.isError(res)) + return res; + + if (tag.tagStr === 'end') + break; + } +}; + +DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder) { + var result = []; + while (!buffer.isEmpty()) { + var possibleEnd = this._peekTag(buffer, 'end'); + if (buffer.isError(possibleEnd)) + return possibleEnd; + + var res = decoder.decode(buffer, 'der'); + if (buffer.isError(res) && possibleEnd) + break; + result.push(res); + } + return result; +}; + +DERNode.prototype._decodeStr = function decodeStr(buffer, tag) { + if (tag === 'octstr') { + return buffer.raw(); + } else if (tag === 'bitstr') { + var unused = buffer.readUInt8(); + if (buffer.isError(unused)) + return unused; + + return { unused: unused, data: buffer.raw() }; + } else if (tag === 'ia5str') { + return buffer.raw().toString(); + } else { + return this.error('Decoding of string type: ' + tag + ' unsupported'); + } +}; + +DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) { + var identifiers = []; + var ident = 0; + while (!buffer.isEmpty()) { + var subident = buffer.readUInt8(); + ident <<= 7; + ident |= subident & 0x7f; + if ((subident & 0x80) === 0) { + identifiers.push(ident); + ident = 0; + } + } + if (subident & 0x80) + identifiers.push(ident); + + var first = (identifiers[0] / 40) | 0; + var second = identifiers[0] % 40; + + if (relative) + result = identifiers; + else + result = [first, second].concat(identifiers.slice(1)); + + if (values) + result = values[result.join(' ')]; + + return result; +}; + +DERNode.prototype._decodeTime = function decodeTime(buffer, tag) { + var str = buffer.raw().toString(); + if (tag === 'gentime') { + var year = str.slice(0, 4) | 0; + var mon = str.slice(4, 6) | 0; + var day = str.slice(6, 8) | 0; + var hour = str.slice(8, 10) | 0; + var min = str.slice(10, 12) | 0; + var sec = str.slice(12, 14) | 0; + } else if (tag === 'utctime') { + var year = str.slice(0, 2) | 0; + var mon = str.slice(2, 4) | 0; + var day = str.slice(4, 6) | 0; + var hour = str.slice(6, 8) | 0; + var min = str.slice(8, 10) | 0; + var sec = str.slice(10, 12) | 0; + if (year < 70) + year = 2000 + year; + else + year = 1900 + year; + } else { + return this.error('Decoding ' + tag + ' time is not supported yet'); + } + + return Date.UTC(year, mon - 1, day, hour, min, sec, 0); +}; + +DERNode.prototype._decodeNull = function decodeNull(buffer) { + return null; +}; + +DERNode.prototype._decodeBool = function decodeBool(buffer) { + var res = buffer.readUInt8(); + if (buffer.isError(res)) + return res; + else + return res !== 0; +}; + +DERNode.prototype._decodeInt = function decodeInt(buffer, values) { + var res = 0; + + // Bigint, return as it is (assume big endian) + var raw = buffer.raw(); + if (raw.length > 3) + return new bignum(raw); + + while (!buffer.isEmpty()) { + res <<= 8; + var i = buffer.readUInt8(); + if (buffer.isError(i)) + return i; + res |= i; + } + + if (values) + res = values[res] || res; + + return res; +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getDecoder('der').tree; +}; + +// Utility methods + +function derDecodeTag(buf, fail) { + var tag = buf.readUInt8(fail); + if (buf.isError(tag)) + return tag; + + var cls = der.tagClass[tag >> 6]; + var primitive = (tag & 0x20) === 0; + + // Multi-octet tag - load + if ((tag & 0x1f) === 0x1f) { + var oct = tag; + tag = 0; + while ((oct & 0x80) === 0x80) { + oct = buf.readUInt8(fail); + if (buf.isError(oct)) + return oct; + + tag <<= 7; + tag |= oct & 0x7f; + } + } else { + tag &= 0x1f; + } + var tagStr = der.tag[tag]; + + return { + cls: cls, + primitive: primitive, + tag: tag, + tagStr: tagStr + }; +} + +function derDecodeLen(buf, primitive, fail) { + var len = buf.readUInt8(fail); + if (buf.isError(len)) + return len; + + // Indefinite form + if (!primitive && len === 0x80) + return null; + + // Definite form + if ((len & 0x80) === 0) { + // Short form + return len; + } + + // Long form + var num = len & 0x7f; + if (num >= 4) + return buf.error('length octect is too long'); + + len = 0; + for (var i = 0; i < num; i++) { + len <<= 8; + var j = buf.readUInt8(fail); + if (buf.isError(j)) + return j; + len |= j; + } + + return len; +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/index.js new file mode 100644 index 00000000..7f431cad --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/decoders/index.js @@ -0,0 +1,3 @@ +var decoders = exports; + +decoders.der = require('./der'); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js new file mode 100644 index 00000000..68ad4abe --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/der.js @@ -0,0 +1,270 @@ +var inherits = require('inherits'); +var Buffer = require('buffer').Buffer; + +var asn1 = require('../../asn1'); +var base = asn1.base; +var bignum = asn1.bignum; + +// Import DER constants +var der = asn1.constants.der; + +function DEREncoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +}; +module.exports = DEREncoder; + +DEREncoder.prototype.encode = function encode(data, reporter) { + return this.tree._encode(data, reporter).join(); +}; + +// Tree methods + +function DERNode(parent) { + base.Node.call(this, 'der', parent); +} +inherits(DERNode, base.Node); + +DERNode.prototype._encodeComposite = function encodeComposite(tag, + primitive, + cls, + content) { + var encodedTag = encodeTag(tag, primitive, cls, this.reporter); + + // Short form + if (content.length < 0x80) { + var header = new Buffer(2); + header[0] = encodedTag; + header[1] = content.length; + return this._createEncoderBuffer([ header, content ]); + } + + // Long form + // Count octets required to store length + var lenOctets = 1; + for (var i = content.length; i >= 0x100; i >>= 8) + lenOctets++; + + var header = new Buffer(1 + 1 + lenOctets); + header[0] = encodedTag; + header[1] = 0x80 | lenOctets; + + for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) + header[i] = j & 0xff; + + return this._createEncoderBuffer([ header, content ]); +}; + +DERNode.prototype._encodeStr = function encodeStr(str, tag) { + if (tag === 'octstr') + return this._createEncoderBuffer(str); + else if (tag === 'bitstr') + return this._createEncoderBuffer([ str.unused | 0, str.data ]); + else if (tag === 'ia5str') + return this._createEncoderBuffer(str); + return this.reporter.error('Encoding of string type: ' + tag + + ' unsupported'); +}; + +DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) { + if (typeof id === 'string') { + if (!values) + return this.reporter.error('string objid given, but no values map found'); + if (!values.hasOwnProperty(id)) + return this.reporter.error('objid not found in values map'); + id = values[id].split(/\s+/g); + for (var i = 0; i < id.length; i++) + id[i] |= 0; + } else if (Array.isArray(id)) { + id = id.slice(); + } + + if (!Array.isArray(id)) { + return this.reporter.error('objid() should be either array or string, ' + + 'got: ' + JSON.stringify(id)); + } + + if (!relative) { + if (id[1] >= 40) + return this.reporter.error('Second objid identifier OOB'); + id.splice(0, 2, id[0] * 40 + id[1]); + } + + // Count number of octets + var size = 0; + for (var i = 0; i < id.length; i++) { + var ident = id[i]; + for (size++; ident >= 0x80; ident >>= 7) + size++; + } + + var objid = new Buffer(size); + var offset = objid.length - 1; + for (var i = id.length - 1; i >= 0; i--) { + var ident = id[i]; + objid[offset--] = ident & 0x7f; + while ((ident >>= 7) > 0) + objid[offset--] = 0x80 | (ident & 0x7f); + } + + return this._createEncoderBuffer(objid); +}; + +function two(num) { + if (num <= 10) + return '0' + num; + else + return num; +} + +DERNode.prototype._encodeTime = function encodeTime(time, tag) { + var str; + var date = new Date(time); + + if (tag === 'gentime') { + str = [ + date.getFullYear(), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else if (tag === 'utctime') { + str = [ + date.getFullYear() % 100, + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else { + this.reporter.error('Encoding ' + tag + ' time is not supported yet'); + } + + return this._encodeStr(str, 'octstr'); +}; + +DERNode.prototype._encodeNull = function encodeNull() { + return this._createEncoderBuffer(''); +}; + +DERNode.prototype._encodeInt = function encodeInt(num, values) { + if (typeof num === 'string') { + if (!values) + return this.reporter.error('String int or enum given, but no values map'); + if (!values.hasOwnProperty(num)) { + return this.reporter.error('Values map doesn\'t contain: ' + + JSON.stringify(num)); + } + num = values[num]; + } + + // Bignum, assume big endian + if (bignum !== null && num instanceof bignum) { + var numArray = num.toArray(); + if(num.sign === false && numArray[0] & 0x80) { + numArray.unshift(0); + } + num = new Buffer(numArray); + } + + if (Buffer.isBuffer(num)) { + var size = num.length; + if (num.length === 0) + size++; + + var out = new Buffer(size); + num.copy(out); + if (num.length === 0) + out[0] = 0 + return this._createEncoderBuffer(out); + } + + if (num < 0x80) + return this._createEncoderBuffer(num); + + if (num < 0x100) + return this._createEncoderBuffer([0, num]); + + var size = 1; + for (var i = num; i >= 0x100; i >>= 8) + size++; + + var out = new Array(size); + for (var i = out.length - 1; i >= 0; i--) { + out[i] = num & 0xff; + num >>= 8; + } + if(out[0] & 0x80) { + out.unshift(0); + } + + return this._createEncoderBuffer(new Buffer(out)); +}; + +DERNode.prototype._encodeBool = function encodeBool(value) { + return this._createEncoderBuffer(value ? 0xff : 0); +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getEncoder('der').tree; +}; + +DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) { + var state = this._baseState; + var i; + if (state['default'] === null) + return false; + + var data = dataBuffer.join(); + if (state.defaultBuffer === undefined) + state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join(); + + if (data.length !== state.defaultBuffer.length) + return false; + + for (i=0; i < data.length; i++) + if (data[i] !== state.defaultBuffer[i]) + return false; + + return true; +}; + +// Utility methods + +function encodeTag(tag, primitive, cls, reporter) { + var res; + + if (tag === 'seqof') + tag = 'seq'; + else if (tag === 'setof') + tag = 'set'; + + if (der.tagByName.hasOwnProperty(tag)) + res = der.tagByName[tag]; + else if (typeof tag === 'number' && (tag | 0) === tag) + res = tag; + else + return reporter.error('Unknown tag: ' + tag); + + if (res >= 0x1f) + return reporter.error('Multi-octet tag encoding unsupported'); + + if (!primitive) + res |= 0x20; + + res |= (der.tagClassByName[cls || 'universal'] << 6); + + return res; +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/index.js new file mode 100644 index 00000000..5b3cc38b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/lib/asn1/encoders/index.js @@ -0,0 +1,3 @@ +var encoders = exports; + +encoders.der = require('./der'); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/index.js new file mode 100644 index 00000000..70b4ea5b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/index.js @@ -0,0 +1,11 @@ +module.exports = assert; + +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} + +assert.equal = function assertEqual(l, r, msg) { + if (l != r) + throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); +}; diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/package.json b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/package.json new file mode 100644 index 00000000..078e9fe6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/package.json @@ -0,0 +1,42 @@ +{ + "name": "minimalistic-assert", + "version": "1.0.0", + "description": "minimalistic-assert ===", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/calvinmetcalf/minimalistic-assert.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/calvinmetcalf/minimalistic-assert/issues" + }, + "homepage": "https://github.com/calvinmetcalf/minimalistic-assert", + "gitHead": "21471ae03175986a30cd3f567ba0bfde5ab10b01", + "_id": "minimalistic-assert@1.0.0", + "_shasum": "702be2dda6b37f4836bcb3f5db56641b64a1d3d3", + "_from": "minimalistic-assert@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + } + ], + "dist": { + "shasum": "702be2dda6b37f4836bcb3f5db56641b64a1d3d3", + "tarball": "http://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/readme.md b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/readme.md new file mode 100644 index 00000000..2ca0d256 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/readme.md @@ -0,0 +1,4 @@ +minimalistic-assert +=== + +very minimalistic assert module. diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/package.json b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/package.json new file mode 100644 index 00000000..06313a9e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/package.json @@ -0,0 +1,63 @@ +{ + "name": "asn1.js", + "version": "1.0.4", + "description": "ASN.1 encoder and decoder", + "main": "lib/asn1.js", + "scripts": { + "test": "mocha --reporter spec test/*-test.js rfc/2560/test/*-test.js rfc/3280/test/*-test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/asn1.js" + }, + "keywords": [ + "asn.1", + "der" + ], + "author": { + "name": "Fedor Indutny" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/asn1.js/issues" + }, + "homepage": "https://github.com/indutny/asn1.js", + "devDependencies": { + "mocha": "^1.14.0" + }, + "optionalDependencies": { + "bn.js": "^1.0.0" + }, + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "bn.js": "^1.0.0" + }, + "gitHead": "e93bdc43f5b529d3d4e2c0bc8df240e5a31fc304", + "_id": "asn1.js@1.0.4", + "_shasum": "adc547dc24775be40db2ae921d6c990c387b32a8", + "_from": "asn1.js@>=1.0.0 <2.0.0", + "_npmVersion": "2.7.5", + "_nodeVersion": "1.6.5", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "fedor.indutny", + "email": "fedor.indutny@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "adc547dc24775be40db2ae921d6c990c387b32a8", + "tarball": "http://registry.npmjs.org/asn1.js/-/asn1.js-1.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-1.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/index.js new file mode 100644 index 00000000..f7b988cf --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/index.js @@ -0,0 +1,110 @@ +try { + var asn1 = require('asn1.js'); + var rfc3280 = require('asn1.js-rfc3280'); +} catch (e) { + var asn1 = require('../' + '..'); + var rfc3280 = require('../' + '3280'); +} + +var OCSPResponse = asn1.define('OCSPResponse', function() { + this.seq().obj( + this.key('responseStatus').use(ResponseStatus), + this.key('responseBytes').optional().explicit(0).seq().obj( + this.key('responseType').objid({ + '1 3 6 1 5 5 7 48 1 1': 'id-pkix-ocsp-basic' + }), + this.key('response').octstr() + ) + ); +}); +exports.OCSPResponse = OCSPResponse; + +var ResponseStatus = asn1.define('ResponseStatus', function() { + this.enum({ + 0: 'successful', + 1: 'malformed_request', + 2: 'internal_error', + 3: 'try_later', + 5: 'sig_required', + 6: 'unauthorized' + }); +}); +exports.ResponseStatus = ResponseStatus; + +var BasicOCSPResponse = asn1.define('BasicOCSPResponse', function() { + this.seq().obj( + this.key('tbsResponseData').use(ResponseData), + this.key('signatureAlgorithm').use(rfc3280.AlgorithmIdentifier), + this.key('signature').bitstr(), + this.key('certs').optional().explicit(0).seqof(rfc3280.Certificate) + ); +}); +exports.BasicOCSPResponse = BasicOCSPResponse; + +var ResponseData = asn1.define('ResponseData', function() { + this.seq().obj( + this.key('version').def('v1').explicit(0).use(rfc3280.Version), + this.key('responderID').use(ResponderID), + this.key('producedAt').gentime(), + this.key('responses').seqof(SingleResponse), + this.key('responseExtensions').optional().explicit(0) + .use(rfc3280.Extensions) + ); +}); +exports.ResponseData = ResponseData; + +var ResponderID = asn1.define('ResponderId', function() { + this.choice({ + byName: this.explicit(1).use(rfc3280.Name), + byKey: this.explicit(2).use(KeyHash) + }); +}); +exports.ResponderID = ResponderID; + +var KeyHash = asn1.define('KeyHash', function() { + this.octstr(); +}); +exports.KeyHash = KeyHash; + +var SingleResponse = asn1.define('SingleResponse', function() { + this.seq().obj( + this.key('certId').use(CertID), + this.key('certStatus').use(CertStatus), + this.key('thisUpdate').gentime(), + this.key('nextUpdate').optional().explicit(0).gentime(), + this.key('singleExtensions').optional().explicit(1).use(Extensions) + ); +}); +exports.SingleResponse = SingleResponse; + +var CertStatus = asn1.define('CertStatus', function() { + this.choice({ + good: this.implicit(0).null_(), + revoked: this.implicit(1).use(RevokedInfo), + unknown: this.implicit(2).null_() + }); +}); +exports.CertStatus = CertStatus; + +var RevokedInfo = asn1.define('RevokedInfo', function() { + this.seq().obj( + this.key('revocationTime').gentime(), + this.key('revocationReason').optional().explicit(0).use(rfc3280.CRLReason) + ); +}); +exports.RevokedInfo = RevokedInfo; + +var CertID = asn1.define('CertID', function() { + this.seq().obj( + this.key('hashAlgorithm').use(rfc3280.AlgorithmIdentifier), + this.key('issuerNameHash').octstr(), + this.key('issuerKeyHash').octstr(), + this.key('serialNumber').use(rfc3280.CertificateSerialNumber) + ); +}); +exports.CertID = CertID; + +var Extensions = asn1.define('Extensions', function() { + this.any(); +}); +exports.Extensions = Extensions; diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/package.json b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/package.json new file mode 100644 index 00000000..ec35860a --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/package.json @@ -0,0 +1,27 @@ +{ + "name": "asn1.js-rfc2560", + "version": "1.0.0", + "description": "RFC2560 structures for asn1.js", + "main": "index.js", + "repository": { + "type": "git", + "url": "git@github.com:indutny/asn1.js" + }, + "keywords": [ + "asn1", + "rfc2560", + "der" + ], + "author": "Fedor Indutny", + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/asn1.js/issues" + }, + "homepage": "https://github.com/indutny/asn1.js", + "dependencies": { + "asn1.js-rfc3280": "^1.0.0" + }, + "peerDependencies": { + "asn1.js": "^1.0.0" + } +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/test/basic-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/test/basic-test.js new file mode 100644 index 00000000..b8a60054 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/test/basic-test.js @@ -0,0 +1,50 @@ +var assert = require('assert'); +var rfc2560 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js RFC2560', function() { + it('should decode OCSP response', function() { + var data = new Buffer( + '308201d40a0100a08201cd308201c906092b0601050507300101048201ba308201b630' + + '819fa216041499e4405f6b145e3e05d9ddd36354fc62b8f700ac180f32303133313133' + + '303037343531305a30743072304a300906052b0e03021a050004140226ee2f5fa28108' + + '34dacc3380e680ace827f604041499e4405f6b145e3e05d9ddd36354fc62b8f700ac02' + + '1100bb4f9a31232b1ba52a0b77af481800588000180f32303133313133303037343531' + + '305aa011180f32303133313230343037343531305a300d06092a864886f70d01010505' + + '00038201010027813333c9b46845dfe3d0cb6b19c03929cdfc9181c1ce823929bb911a' + + 'd9de05721790fcccbab43f9fbdec1217ab8023156d07bbcc3555f25e9e472fbbb5e019' + + '2835efcdc71b3dbc5e5c4c5939fc7a610fc6521d4ed7d2b685a812fa1a3a129ea87873' + + '972be3be54618ba4a4d96090d7f9aaa5f70d4f07cf5cf3611d8a7b3adafe0b319459ed' + + '40d456773d5f45f04c773711d86cc41d274f771a31c10d30cd6f846b587524bfab2445' + + '4bbb4535cff46f6b341e50f26a242dd78e246c8dea0e2fabcac9582e000c138766f536' + + 'd7f7bab81247c294454e62b710b07126de4e09685818f694df5783eb66f384ce5977f1' + + '2721ff38c709f3ec580d22ff40818dd17f', + 'hex'); + + var res = rfc2560.OCSPResponse.decode(data, 'der'); + assert.equal(res.responseStatus, 'successful'); + assert.equal(res.responseBytes.responseType, 'id-pkix-ocsp-basic'); + + var basic = rfc2560.BasicOCSPResponse.decode( + res.responseBytes.response, + 'der' + ); + assert.equal(basic.tbsResponseData.version, 'v1'); + assert.equal(basic.tbsResponseData.producedAt, 1385797510000); + }); + + it('should encode/decode OCSP response', function() { + var encoded = rfc2560.OCSPResponse.encode({ + responseStatus: 'malformed_request', + responseBytes: { + responseType: 'id-pkix-ocsp-basic', + response: 'random-string' + } + }, 'der'); + var decoded = rfc2560.OCSPResponse.decode(encoded, 'der'); + assert.equal(decoded.responseStatus, 'malformed_request'); + assert.equal(decoded.responseBytes.responseType, 'id-pkix-ocsp-basic'); + assert.equal(decoded.responseBytes.response.toString(), 'random-string'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/index.js new file mode 100644 index 00000000..64f6ec3d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/index.js @@ -0,0 +1,152 @@ +try { + var asn1 = require('asn1.js'); +} catch (e) { + var asn1 = require('../' + '..'); +} + +var CRLReason = asn1.define('CRLReason', function() { + this.enum({ + 0: 'unspecified', + 1: 'keyCompromise', + 2: 'CACompromise', + 3: 'affiliationChanged', + 4: 'superseded', + 5: 'cessationOfOperation', + 6: 'certificateHold', + 8: 'removeFromCRL', + 9: 'privilegeWithdrawn', + 10: 'AACompromise' + }); +}); +exports.CRLReason = CRLReason; + +var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function() { + this.seq().obj( + this.key('algorithm').objid(), + this.key('parameters').optional().any() + ); +}); +exports.AlgorithmIdentifier = AlgorithmIdentifier; + +var Certificate = asn1.define('Certificate', function() { + this.seq().obj( + this.key('tbsCertificate').use(TBSCertificate), + this.key('signatureAlgorithm').use(AlgorithmIdentifier), + this.key('signature').bitstr() + ); +}); +exports.Certificate = Certificate; + +var TBSCertificate = asn1.define('TBSCertificate', function() { + this.seq().obj( + this.key('version').def('v1').explicit(0).use(Version), + this.key('serialNumber').use(CertificateSerialNumber), + this.key('signature').use(AlgorithmIdentifier), + this.key('issuer').use(Name), + this.key('validity').use(Validity), + this.key('subject').use(Name), + this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo), + + // TODO(indutny): validate that version is v2 or v3 + this.key('issuerUniqueID').optional().explicit(1).use(UniqueIdentifier), + this.key('subjectUniqueID').optional().explicit(2).use(UniqueIdentifier), + + // TODO(indutny): validate that version is v3 + this.key('extensions').optional().explicit(3).use(Extensions) + ); +}); +exports.TBSCertificate = TBSCertificate; + +var Version = asn1.define('Version', function() { + this.int({ + 0: 'v1', + 1: 'v2', + 2: 'v3' + }); +}); +exports.Version = Version; + +var CertificateSerialNumber = asn1.define('CertificateSerialNumber', + function() { + this.int(); +}); +exports.CertificateSerialNumber = CertificateSerialNumber; + +var Validity = asn1.define('Validity', function() { + this.seq().obj( + this.key('notBefore').use(Time), + this.key('notAfter').use(Time) + ); +}); +exports.Validity = Validity; + +var Time = asn1.define('Time', function() { + this.choice({ + utcTime: this.utctime(), + genTime: this.gentime() + }); +}); +exports.Time = Time; + +var UniqueIdentifier = asn1.define('UniqueIdentifier', function() { + this.bitstr(); +}); +exports.UniqueIdentifier = UniqueIdentifier; + +var SubjectPublicKeyInfo = asn1.define('SubjectPublicKeyInfo', function() { + this.seq().obj( + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPublicKey').bitstr() + ); +}); +exports.SubjectPublicKeyInfo = SubjectPublicKeyInfo; + +var Extensions = asn1.define('Extensions', function() { + this.seqof(Extension); +}); +exports.Extensions = Extensions; + +var Extension = asn1.define('Extension', function() { + this.seq().obj( + this.key('extnID').objid(), + this.key('critical').bool().def(false), + this.key('extnValue').octstr() + ); +}); +exports.Extension = Extension; + +var Name = asn1.define('Name', function() { + this.choice({ + rdn: this.use(RDNSequence) + }); +}); +exports.Name = Name; + +var RDNSequence = asn1.define('RDNSequence', function() { + this.seqof(RelativeDistinguishedName); +}); +exports.RDNSequence = RDNSequence; + +var RelativeDistinguishedName = asn1.define('RelativeDistinguishedName', + function() { + this.setof(AttributeTypeAndValue); +}); +exports.RelativeDistinguishedName = RelativeDistinguishedName; + +var AttributeTypeAndValue = asn1.define('AttributeTypeAndValue', function() { + this.seq().obj( + this.key('type').use(AttributeType), + this.key('value').use(AttributeValue) + ); +}); +exports.AttributeTypeAndValue = AttributeTypeAndValue; + +var AttributeType = asn1.define('AttributeType', function() { + this.objid(); +}); +exports.AttributeType = AttributeType; + +var AttributeValue = asn1.define('AttributeValue', function() { + this.any(); +}); +exports.AttributeValue = AttributeValue; diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/package.json b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/package.json new file mode 100644 index 00000000..df76d59f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/package.json @@ -0,0 +1,24 @@ +{ + "name": "asn1.js-rfc3280", + "version": "1.0.0", + "description": "RFC3280 structures for asn1.js", + "main": "index.js", + "repository": { + "type": "git", + "url": "git@github.com:indutny/asn1.js" + }, + "keywords": [ + "asn1", + "rfc3280", + "der" + ], + "author": "Fedor Indutny", + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/asn1.js/issues" + }, + "homepage": "https://github.com/indutny/asn1.js", + "peerDependencies": { + "asn1.js": "^1.0.0" + } +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/test/basic-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/test/basic-test.js new file mode 100644 index 00000000..128ddbb2 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/3280/test/basic-test.js @@ -0,0 +1,54 @@ +var assert = require('assert'); +var asn1 = require('../../../'); +var rfc3280 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js RFC3280', function() { + it('should decode Certificate', function() { + var data = new Buffer( + '308204763082035ea0030201020208462e4256bb1194dc300d06092a864886f70d0101' + + '0505003049310b300906035504061302555331133011060355040a130a476f6f676c65' + + '20496e63312530230603550403131c476f6f676c6520496e7465726e65742041757468' + + '6f72697479204732301e170d3134303733303132303434305a170d3134313032383030' + + '303030305a3068310b30090603550406130255533113301106035504080c0a43616c69' + + '666f726e69613116301406035504070c0d4d6f756e7461696e20566965773113301106' + + '0355040a0c0a476f6f676c6520496e633117301506035504030c0e7777772e676f6f67' + + '6c652e636f6d30820122300d06092a864886f70d01010105000382010f003082010a02' + + '82010100b7894e02f9ba01e07889d670fd3618d6022efc96c9d9deae2e800aa19f4b17' + + '20c371b9996b2efc12fa191b60a92afe76e80e5d9d47280cbc46a4cd9cf454503fefcf' + + 'cd2e1c8b113a89bcd1f1427ae793bbd0d1e077bc963ff2ceb2b0c9ab68196fce1b2f40' + + '0dc77d6294a7c0d50ff104cf92ee837d5c484a3ba0ce76b9c018cf96545f7e27518232' + + '57874945f87b69bac902ce4b378746953c619db909e73fd2f5e2dd009c5c748ec22fcb' + + 'd6648fe60a5805e98ab8cd65ab0eb0772d7a19aefdc24c9a3933692ca695e7b493f8ac' + + '7aab8e5d1229f071cf08ac0b6c641704a74747faacfb857b68359fc1a98c777fb5eb3e' + + '9c90d6a13b78f42d6d797fd74f03c30203010001a38201413082013d301d0603551d25' + + '0416301406082b0601050507030106082b0601050507030230190603551d1104123010' + + '820e7777772e676f6f676c652e636f6d306806082b06010505070101045c305a302b06' + + '082b06010505073002861f687474703a2f2f706b692e676f6f676c652e636f6d2f4749' + + '4147322e637274302b06082b06010505073001861f687474703a2f2f636c69656e7473' + + '312e676f6f676c652e636f6d2f6f637370301d0603551d0e04160414e43d6cc20c12e9' + + '7c1920533676ef287737d8884a300c0603551d130101ff04023000301f0603551d2304' + + '18301680144add06161bbcf668b576f581b6bb621aba5a812f30170603551d20041030' + + '0e300c060a2b06010401d67902050130300603551d1f042930273025a023a021861f68' + + '7474703a2f2f706b692e676f6f676c652e636f6d2f47494147322e63726c300d06092a' + + '864886f70d010105050003820101002d5501bd33f7b6e06117e53ccf21703565f29ab7' + + '8642a771effa4369f32938b45f04208d88a1046ba0a726622e864143c8dac38392430d' + + 'fbea1b7d41c1e27dd43438a47d36c4a048de318be442abed5f60373687d01b7fefc43e' + + '0aacf620b11a69fb237aaa4dc33b97bc0eb39b1abe6902b1518253addda25037389c26' + + '0ef2808be7f702f47a6466d6f3b35764f088c94e0a2b9ee403602ae21cbad3fd8e873e' + + '9e817945a3d23fd2b35579cce19ea7f8815d166f3e46d53eed25ef391a912bb715af64' + + 'e43e124f98be487f9d222954a5bebc8d5ca384c7128c6dabffb11150a7d2a62ce565b8' + + 'a02a6c4c8ecfc7ac7065c1979cb8d50eabd5d36c72a5396e712e', + 'hex'); + + var res = rfc3280.Certificate.decode(data, 'der'); + + var tbs = res.tbsCertificate; + assert.equal(tbs.version, 'v3'); + assert.deepEqual(tbs.serialNumber, + new asn1.bignum('462e4256bb1194dc', 16)); + assert.equal(tbs.signature.algorithm.join('.'), + '1.2.840.113549.1.1.5'); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/der-decode-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/der-decode-test.js new file mode 100644 index 00000000..a8983937 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/der-decode-test.js @@ -0,0 +1,60 @@ +var assert = require('assert'); +var asn1 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js DER decoder', function() { + it('should propagate implicit tag', function() { + var B = asn1.define('B', function() { + this.seq().obj( + this.key('b').octstr() + ); + }); + + var A = asn1.define('Bug', function() { + this.seq().obj( + this.key('a').implicit(0).use(B) + ); + }); + + var out = A.decode(new Buffer('300720050403313233', 'hex'), 'der'); + assert.equal(out.a.b.toString(), '123'); + }); + + it('should decode optional tag to undefined key', function() { + var A = asn1.define('A', function() { + this.seq().obj( + this.key('key').bool(), + this.optional().key('opt').bool() + ); + }); + var out = A.decode(new Buffer('30030101ff', 'hex'), 'der'); + assert.deepEqual(out, { 'key': true }); + }); + + it('should decode optional tag to default value', function() { + var A = asn1.define('A', function() { + this.seq().obj( + this.key('key').bool(), + this.optional().key('opt').octstr().def('default') + ); + }); + var out = A.decode(new Buffer('30030101ff', 'hex'), 'der'); + assert.deepEqual(out, { 'key': true, 'opt': 'default' }); + }); + + function test(name, model, inputHex, expected) { + it(name, function() { + var M = asn1.define('Model', model); + var decoded = M.decode(new Buffer(inputHex,'hex'), 'der'); + assert.deepEqual(decoded, expected); + }); + } + + test('should decode choice', function() { + this.choice({ + apple: this.bool(), + }); + }, '0101ff', { 'type': 'apple', 'value': true }); + +}); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/der-encode-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/der-encode-test.js new file mode 100644 index 00000000..f19e75ca --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/der-encode-test.js @@ -0,0 +1,71 @@ +var assert = require('assert'); +var asn1 = require('..'); +var BN = require('bn.js'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js DER encoder', function() { + /* + * Explicit value shold be wrapped with A0 | EXPLICIT tag + * this adds two more bytes to resulting buffer. + * */ + it('should code explicit tag as 0xA2', function() { + var E = asn1.define('E', function() { + this.explicit(2).octstr() + }); + + var encoded = E.encode('X', 'der'); + + // + assert.equal(encoded.toString('hex'), 'a203040158'); + assert.equal(encoded.length, 5); + }) + + function test(name, model_definition, model_value, der_expected) { + it(name, function() { + var Model, der_actual; + Model = asn1.define('Model', model_definition); + der_actual = Model.encode(model_value, 'der'); + assert.deepEqual(der_actual, new Buffer(der_expected,'hex')); + }); + } + + test('should encode choice', function() { + this.choice({ + apple: this.bool(), + }); + }, { type: 'apple', value: true }, '0101ff'); + + test('should encode implicit seqof', function() { + var Int = asn1.define('Int', function() { + this.int(); + }); + this.implicit(0).seqof(Int); + }, [ 1 ], 'A003020101' ); + + test('should encode explicit seqof', function() { + var Int = asn1.define('Int', function() { + this.int(); + }); + this.explicit(0).seqof(Int); + }, [ 1 ], 'A0053003020101' ); + + test('should encode BN(128) properly', function() { + this.int(); + }, new BN(128), '02020080'); + + test('should encode int 128 properly', function() { + this.int(); + }, 128, '02020080'); + + test('should encode 0x8011 properly', function() { + this.int(); + }, 0x8011, '0203008011'); + + test('should omit default value in DER', function() { + this.seq().obj( + this.key('required').def(false).bool(), + this.key('value').int() + ); + }, {required: false, value: 1}, '3003020101'); +}); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/error-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/error-test.js new file mode 100644 index 00000000..35354826 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/error-test.js @@ -0,0 +1,199 @@ +var assert = require('assert'); +var asn1 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js error', function() { + describe('encoder', function() { + function test(name, model, input, expected) { + it('should support ' + name, function() { + var M = asn1.define('TestModel', model); + + var error; + assert.throws(function() { + try { + var encoded = M.encode(input, 'der'); + } catch (e) { + error = e; + throw e; + } + }); + + assert(expected.test(error.stack), + 'Failed to match, expected: ' + expected + ' got: ' + + JSON.stringify(error.stack)); + }); + } + + describe('primitives', function() { + test('int', function() { + this.int(); + }, 'hello', /no values map/i); + + test('enum', function() { + this.enum({ 0: 'hello', 1: 'world' }); + }, 'gosh', /contain: "gosh"/); + + test('objid', function() { + this.objid(); + }, 1, /objid\(\) should be either array or string, got: 1/); + }); + + describe('composite', function() { + test('shallow', function() { + this.seq().obj( + this.key('key').int() + ); + }, { key: 'hello' } , /map at: \["key"\]/i); + + test('deep and empty', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ) + ) + ); + }, { } , /input is not object at: \["a"\]\["b"\]/i); + + test('deep', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ) + ) + ); + }, { a: { b: { c: 'hello' } } } , /map at: \["a"\]\["b"\]\["c"\]/i); + + test('use', function() { + var S = asn1.define('S', function() { + this.seq().obj( + this.key('x').int() + ); + }); + + this.seq().obj( + this.key('a').seq().obj( + this.key('b').use(S) + ) + ); + }, { a: { b: { x: 'hello' } } } , /map at: \["a"\]\["b"\]\["x"\]/i); + }); + }); + + describe('decoder', function() { + function test(name, model, input, expected) { + it('should support ' + name, function() { + var M = asn1.define('TestModel', model); + + var error; + assert.throws(function() { + try { + var decoded = M.decode(new Buffer(input, 'hex'), 'der'); + } catch (e) { + error = e; + throw e; + } + }); + var partial = M.decode(new Buffer(input, 'hex'), 'der', { + partial: true + }); + + assert(expected.test(error.stack), + 'Failed to match, expected: ' + expected + ' got: ' + + JSON.stringify(error.stack)); + + assert.equal(partial.errors.length, 1); + assert(expected.test(partial.errors[0].stack), + 'Failed to match, expected: ' + expected + ' got: ' + + JSON.stringify(partial.errors[0].stack)); + }); + } + + describe('primitive', function() { + test('int', function() { + this.int(); + }, '2201', /body of: "int"/); + + test('int', function() { + this.int(); + }, '', /tag of "int"/); + }); + + describe('composite', function() { + test('shallow', function() { + this.seq().obj( + this.key('a').seq().obj() + ); + }, '30', /length of "seq"/); + + test('deep and empty', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ) + ) + ); + }, '300430023000', /tag of "int" at: \["a"\]\["b"\]\["c"\]/); + + test('deep and incomplete', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ) + ) + ); + }, '30053003300122', /length of "int" at: \["a"\]\["b"\]\["c"\]/); + }); + }); + + describe('partial decoder', function() { + function test(name, model, input, expectedObj, expectedErrs) { + it('should support ' + name, function() { + var M = asn1.define('TestModel', model); + + var decoded = M.decode(new Buffer(input, 'hex'), 'der', { + partial: true + }); + + assert.deepEqual(decoded.result, expectedObj); + + assert.equal(decoded.errors.length, expectedErrs.length); + expectedErrs.forEach(function(expected, i) { + assert(expected.test(decoded.errors[i].stack), + 'Failed to match, expected: ' + expected + ' got: ' + + JSON.stringify(decoded.errors[i].stack)); + }); + }); + } + + test('last key not present', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ), + this.key('d').int() + ) + ); + }, '30073005300022012e', { a: { b: {}, d: 46 } }, [ + /"int" at: \["a"\]\["b"\]\["c"\]/ + ]); + + test('first key not present', function() { + this.seq().obj( + this.key('a').seq().obj( + this.key('b').seq().obj( + this.key('c').int() + ), + this.key('d').int() + ) + ); + }, '30073005300322012e', { a: { b: { c: 46 } } }, [ + /"int" at: \["a"\]\["d"\]/ + ]); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/ping-pong-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/ping-pong-test.js new file mode 100644 index 00000000..46518234 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/ping-pong-test.js @@ -0,0 +1,146 @@ +var assert = require('assert'); +var asn1 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js ping/pong', function() { + function test(name, model, input, expected) { + it('should support ' + name, function() { + var M = asn1.define('TestModel', model); + + var encoded = M.encode(input, 'der'); + var decoded = M.decode(encoded, 'der'); + assert.deepEqual(decoded, expected !== undefined ? expected : input); + }); + } + + describe('primitives', function() { + test('int', function() { + this.int(); + }, 0); + + test('bigint', function() { + this.int(); + }, new asn1.bignum('0102030405060708', 16)); + + test('enum', function() { + this.enum({ 0: 'hello', 1: 'world' }); + }, 'world'); + + test('octstr', function() { + this.octstr(); + }, new Buffer('hello')); + + test('bitstr', function() { + this.bitstr(); + }, { unused: 4, data: new Buffer('hello!') }); + + test('ia5str', function() { + this.ia5str(); + }, 'hello'); + + test('gentime', function() { + this.gentime(); + }, 1385921175000); + + test('utctime', function() { + this.utctime(); + }, 1385921175000); + + test('null', function() { + this.null_(); + }, null); + + test('objid', function() { + this.objid({ + '1 3 6 1 5 5 7 48 1 1': 'id-pkix-ocsp-basic' + }); + }, 'id-pkix-ocsp-basic'); + + test('true', function() { + this.bool(); + }, true); + + test('false', function() { + this.bool(); + }, false); + + test('any', function() { + this.any(); + }, new Buffer('02210081347a0d3d674aeeb563061d94a3aea5f6a7' + + 'c6dc153ea90a42c1ca41929ac1b9', 'hex')); + + test('default explicit', function() { + this.seq().obj( + this.key('version').def('v1').explicit(0).int({ + 0: 'v1', + 1: 'v2' + }) + ); + }, {}, {'version': 'v1'}); + + test('implicit', function() { + this.implicit(0).int({ + 0: 'v1', + 1: 'v2' + }); + }, 'v2', 'v2'); + }); + + describe('composite', function() { + test('2x int', function() { + this.seq().obj( + this.key('hello').int(), + this.key('world').int() + ); + }, { hello: 4, world: 2 }); + + test('enum', function() { + this.seq().obj( + this.key('hello').enum({ 0: 'world', 1: 'devs' }) + ); + }, { hello: 'devs' }); + + test('optionals', function() { + this.seq().obj( + this.key('hello').enum({ 0: 'world', 1: 'devs' }), + this.key('how').optional().def('are you').enum({ + 0: 'are you', + 1: 'are we?!' + }) + ); + }, { hello: 'devs', how: 'are we?!' }); + + test('optionals #2', function() { + this.seq().obj( + this.key('hello').enum({ 0: 'world', 1: 'devs' }), + this.key('how').optional().def('are you').enum({ + 0: 'are you', + 1: 'are we?!' + }) + ); + }, { hello: 'devs' }, { hello: 'devs', how: 'are you' }); + + test('optionals #3', function() { + this.seq().obj( + this.key('content').optional().int() + ); + }, {}, {}); + + test('seqof', function() { + var S = asn1.define('S', function() { + this.seq().obj( + this.key('a').def('b').int({ 0: 'a', 1: 'b' }), + this.key('c').def('d').int({ 2: 'c', 3: 'd' }) + ); + }); + this.seqof(S); + }, [{}, { a: 'a', c: 'c' }], [{ a: 'b', c: 'd' }, { a: 'a', c: 'c' }]); + + test('choice', function() { + this.choice({ + apple: this.bool() + }); + }, { type: 'apple', value: true }); + }); +}); diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/use-test.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/use-test.js new file mode 100644 index 00000000..e179fb4b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/test/use-test.js @@ -0,0 +1,126 @@ +var assert = require('assert'); +var asn1 = require('..'); + +var Buffer = require('buffer').Buffer; + +describe('asn1.js models', function() { + describe('plain use', function() { + it('should encode submodel', function() { + var SubModel = asn1.define('SubModel', function() { + this.seq().obj( + this.key('b').octstr() + ); + }); + var Model = asn1.define('Model', function() { + this.seq().obj( + this.key('a').int(), + this.key('sub').use(SubModel) + ); + }); + + var data = {a: 1, sub: {b: new Buffer("XXX")}}; + var wire = Model.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300a02010130050403585858'); + var back = Model.decode(wire, 'der'); + assert.deepEqual(back, data); + }); + + it('should honour implicit tag from parent', function() { + var SubModel = asn1.define('SubModel', function() { + this.seq().obj( + this.key('x').octstr() + ) + }); + var Model = asn1.define('Model', function() { + this.seq().obj( + this.key('a').int(), + this.key('sub').use(SubModel).implicit(0) + ); + }); + + var data = {a: 1, sub: {x: new Buffer("123")}}; + var wire = Model.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300a020101a0050403313233'); + var back = Model.decode(wire, 'der'); + assert.deepEqual(back, data); + + }); + + it('should honour explicit tag from parent', function() { + var SubModel = asn1.define('SubModel', function() { + this.seq().obj( + this.key('x').octstr() + ) + }); + var Model = asn1.define('Model', function() { + this.seq().obj( + this.key('a').int(), + this.key('sub').use(SubModel).explicit(0) + ); + }); + + var data = {a: 1, sub: {x: new Buffer("123")}}; + var wire = Model.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300c020101a00730050403313233'); + var back = Model.decode(wire, 'der'); + assert.deepEqual(back, data); + + }); + + it('should get model with function call', function() { + var SubModel = asn1.define('SubModel', function() { + this.seq().obj( + this.key('x').octstr() + ) + }); + var Model = asn1.define('Model', function() { + this.seq().obj( + this.key('a').int(), + this.key('sub').use(function(obj) { + assert.equal(obj.a, 1); + return SubModel; + }) + ); + }); + + var data = {a: 1, sub: {x: new Buffer("123")}}; + var wire = Model.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300a02010130050403313233'); + var back = Model.decode(wire, 'der'); + assert.deepEqual(back, data); + + }); + + it('should support recursive submodels', function() { + var PlainSubModel = asn1.define('PlainSubModel', function() { + this.int(); + }); + var RecursiveModel = asn1.define('RecursiveModel', function() { + this.seq().obj( + this.key('plain').bool(), + this.key('content').use(function(obj) { + if(obj.plain) { + return PlainSubModel; + } else { + return RecursiveModel; + } + }) + ); + }); + + var data = { + 'plain': false, + 'content': { + 'plain': true, + 'content': 1 + } + }; + var wire = RecursiveModel.encode(data, 'der'); + assert.equal(wire.toString('hex'), '300b01010030060101ff020101'); + var back = RecursiveModel.decode(wire, 'der'); + assert.deepEqual(back, data); + }); + + }); +}); + diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/.npmignore b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/.npmignore new file mode 100644 index 00000000..c2757b0e --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/.npmignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Deployed apps should consider commenting this line out: +# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git +node_modules + +# build artifact +test/bundle.js \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/.travis.yml b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/.travis.yml new file mode 100644 index 00000000..73261dc6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/.travis.yml @@ -0,0 +1,13 @@ +language: node_js +before_install: + - "npm install npm -g" +node_js: + - "0.10" + - "0.11" + - "0.12" + - "iojs" +env: + - TEST_SUITE=test + - TEST_SUITE=coveralls + - TEST_SUITE=standard +script: "npm run-script $TEST_SUITE" diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/LICENSE b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/LICENSE new file mode 100644 index 00000000..a115b524 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Daniel Cousens + +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/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/README.md b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/README.md new file mode 100644 index 00000000..6c5e4f7d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/README.md @@ -0,0 +1,22 @@ +# pbkdf2-compat + +[![build status](https://secure.travis-ci.org/crypto-browserify/pbkdf2-compat.png)](http://travis-ci.org/crypto-browserify/pbkdf2-compat) +[![Coverage Status](https://img.shields.io/coveralls/crypto-browserify/pbkdf2-compat.svg)](https://coveralls.io/r/crypto-browserify/pbkdf2-compat) +[![Version](http://img.shields.io/npm/v/pbkdf2-compat.svg)](https://www.npmjs.org/package/pbkdf2-compat) + +This library provides the functionality of PBKDF2 with the ability to use any supported hashing algorithm returned from `crypto.getHashes()` + + +## Usage + +``` +var compat = require('pbkd2f-compat') +var derivedKey = compat.pbkdf2Sync('password', 'salt', 1, 32, 'sha512') + +... +``` + + +## Credits + +This module is a derivative of https://github.com/cryptocoinjs/pbkdf2-sha256/, so thanks to [JP Richardson](https://github.com/cryptocoinjs/pbkdf2-sha256/) for laying the ground work. diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/async-shim.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/async-shim.js new file mode 100644 index 00000000..1516e97b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/async-shim.js @@ -0,0 +1,7 @@ +var compat = require('./browser') + +process.on('message', function (m) { + var result = compat.pbkdf2Sync(new Buffer(m.password, 'hex'), new Buffer(m.salt, 'hex'), m.iterations, m.keylen, m.digest) + + process.send(result.toString('hex')) +}) diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/browser.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/browser.js new file mode 100644 index 00000000..a5090076 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/browser.js @@ -0,0 +1,78 @@ +var createHmac = require('create-hmac') + +exports.pbkdf2 = pbkdf2 +function pbkdf2 (password, salt, iterations, keylen, digest, callback) { + if (typeof digest === 'function') { + callback = digest + digest = undefined + } + + if (typeof callback !== 'function') { + throw new Error('No callback provided to pbkdf2') + } + + var result = pbkdf2Sync(password, salt, iterations, keylen, digest) + setTimeout(function () { + callback(undefined, result) + }) +} + +exports.pbkdf2Sync = pbkdf2Sync +function pbkdf2Sync (password, salt, iterations, keylen, digest) { + if (typeof iterations !== 'number') + throw new TypeError('Iterations not a number') + + if (iterations < 0) + throw new TypeError('Bad iterations') + + if (typeof keylen !== 'number') + throw new TypeError('Key length not a number') + + if (keylen < 0) + throw new TypeError('Bad key length') + + digest = digest || 'sha1' + + if (!Buffer.isBuffer(password)) password = new Buffer(password) + if (!Buffer.isBuffer(salt)) salt = new Buffer(salt) + + var hLen + var l = 1 + var DK = new Buffer(keylen) + var block1 = new Buffer(salt.length + 4) + salt.copy(block1, 0, 0, salt.length) + + var r + var T + + for (var i = 1; i <= l; i++) { + block1.writeUInt32BE(i, salt.length) + var U = createHmac(digest, password).update(block1).digest() + + if (!hLen) { + hLen = U.length + T = new Buffer(hLen) + l = Math.ceil(keylen / hLen) + r = keylen - (l - 1) * hLen + + if (keylen > (Math.pow(2, 32) - 1) * hLen) + throw new TypeError('keylen exceeds maximum length') + } + + U.copy(T, 0, 0, hLen) + + for (var j = 1; j < iterations; j++) { + U = createHmac(digest, password).update(U).digest() + + for (var k = 0; k < hLen; k++) { + T[k] ^= U[k] + } + } + + var destPos = (i - 1) * hLen + var len = (i === l ? r : hLen) + T.copy(DK, destPos, 0, len) + } + + return DK +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/index.js new file mode 100644 index 00000000..266d500b --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/index.js @@ -0,0 +1,87 @@ +var crypto = require('crypto') +var fork = require('child_process').fork +var path = require('path') +var compat = require('./browser') + +function asyncPBKDF2 (password, salt, iterations, keylen, digest, callback) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number') + } + + if (iterations < 0) { + throw new TypeError('Bad iterations') + } + + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number') + } + + if (keylen < 0) { + throw new TypeError('Bad key length') + } + if (typeof password === 'string') + password = new Buffer(password) + + if (typeof salt === 'string') + salt = new Buffer(salt) + + var child = fork(path.resolve(__dirname, 'async-shim.js')) + + child.on('message', function (result) { + child.kill() + callback(null, new Buffer(result, 'hex')) + }).on('error', function (err) { + child.kill() + callback(err) + }) + + child.send({ + password: password.toString('hex'), + salt: salt.toString('hex'), + iterations: iterations, + keylen: keylen, + digest: digest + }) +} + +exports.pbkdf2Sync = function pbkdf2Sync (password, salt, iterations, keylen, digest) { + digest = digest || 'sha1' + + if (isNode10()) { + if (digest === 'sha1') { + return crypto.pbkdf2Sync(password, salt, iterations, keylen) + } else { + return compat.pbkdf2Sync(password, salt, iterations, keylen, digest) + } + } else { + return crypto.pbkdf2Sync(password, salt, iterations, keylen, digest) + } +} + +exports.pbkdf2 = function pbkdf2 (password, salt, iterations, keylen, digest, callback) { + if (typeof digest === 'function') { + callback = digest + digest = 'sha1' + } + + if (isNode10()) { + if (digest === 'sha1') { + return crypto.pbkdf2(password, salt, iterations, keylen, callback) + } else { + return asyncPBKDF2(password, salt, iterations, keylen, digest, callback) + } + } else { + return crypto.pbkdf2(password, salt, iterations, keylen, digest, callback) + } +} + +var sha1 = '0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164' +var isNode10Result + +function isNode10 () { + if (typeof isNode10Result === 'undefined') { + isNode10Result = crypto.pbkdf2Sync('password', 'salt', 1, 32, 'sha256').toString('hex') === sha1 + } + + return isNode10Result +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/package.json b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/package.json new file mode 100644 index 00000000..8a9e2b16 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/package.json @@ -0,0 +1,86 @@ +{ + "name": "pbkdf2-compat", + "version": "3.0.2", + "description": "This library provides the functionality of PBKDF2 with the ability to use any supported hashing algorithm returned from crypto.getHashes()", + "main": "./index.js", + "browser": "./browser.js", + "keywords": [ + "pbkdf2", + "kdf", + "salt", + "hash" + ], + "scripts": { + "coverage": "istanbul cover _mocha -- -t 20000 test/index.js", + "coveralls": "npm run coverage && coveralls < coverage/lcov.info", + "standard": "standard", + "test": "mocha --reporter list -t 20000 test/index.js", + "bundle-test": "browserify test/index.js > test/bundle.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/crypto-browserify/pbkdf2-compat.git" + }, + "author": { + "name": "Daniel Cousens" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/pbkdf2-compat/issues" + }, + "homepage": "https://github.com/crypto-browserify/pbkdf2-compat", + "devDependencies": { + "browserify": "^8.1.1", + "coveralls": "^2.11.2", + "istanbul": "^0.3.5", + "mocha": "^2.1.0", + "standard": "^1.3.0" + }, + "dependencies": { + "create-hmac": "^1.1.2" + }, + "standard": { + "ignore": [ + "test/**" + ] + }, + "gitHead": "c315c35d28accb2e8c7d3a65ca4111527c4a9c1e", + "_id": "pbkdf2-compat@3.0.2", + "_shasum": "0b207887e7d45467e9dd1027bbf1414e1f165291", + "_from": "pbkdf2-compat@>=3.0.0 <4.0.0", + "_npmVersion": "2.5.0", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "dcousens", + "email": "email@dcousens.com" + }, + "maintainers": [ + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "0b207887e7d45467e9dd1027bbf1414e1f165291", + "tarball": "http://registry.npmjs.org/pbkdf2-compat/-/pbkdf2-compat-3.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/pbkdf2-compat/-/pbkdf2-compat-3.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/fixtures.json b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/fixtures.json new file mode 100644 index 00000000..8e49c19f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/fixtures.json @@ -0,0 +1,138 @@ +{ + "valid": [ + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": 32, + "results": { + "sha1": "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164", + "sha256": "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b", + "sha512": "867f70cf1ade02cff3752599a3a53dc4af34c7a669815ae5d513554e1c8cf252", + "sha224": "3c198cbdb9464b7857966bd05b7bc92bc1cc4e6e63155d4e490557fd85989497", + "sha384": "c0e14f06e49e32d73f9f52ddf1d0c5c7191609233631dadd76a567db42b78676" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 2, + "dkLen": 32, + "results": { + "sha1": "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957cae93136266537a8d7bf4b76", + "sha256": "ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43", + "sha512": "e1d9c16aa681708a45f5c7c4e215ceb66e011a2e9f0040713f18aefdb866d53c", + "sha224": "93200ffa96c5776d38fa10abdf8f5bfc0054b9718513df472d2331d2d1e66a3f", + "sha384": "54f775c6d790f21930459162fc535dbf04a939185127016a04176a0730c6f1f4" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": 64, + "results": { + "sha1": "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164ac2e7a8e3f9d2e83ace57e0d50e5e1071367c179bc86c767fc3f78ddb561363f", + "sha256": "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b4dbf3a2f3dad3377264bb7b8e8330d4efc7451418617dabef683735361cdc18c", + "sha512": "867f70cf1ade02cff3752599a3a53dc4af34c7a669815ae5d513554e1c8cf252c02d470a285a0501bad999bfe943c08f050235d7d68b1da55e63f73b60a57fce", + "sha224": "3c198cbdb9464b7857966bd05b7bc92bc1cc4e6e63155d4e490557fd859894978ab846d52a1083ac610c36c2c5ea8ce4a024dd691064d5453bd17b15ea1ac194", + "sha384": "c0e14f06e49e32d73f9f52ddf1d0c5c7191609233631dadd76a567db42b78676b38fc800cc53ddb642f5c74442e62be44d727702213e3bb9223c53b767fbfb5d" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 2, + "dkLen": 64, + "results": { + "sha1": "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957cae93136266537a8d7bf4b76c51094cc1ae010b19923ddc4395cd064acb023ffd1edd5ef4be8ffe61426c28e", + "sha256": "ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43830651afcb5c862f0b249bd031f7a67520d136470f5ec271ece91c07773253d9", + "sha512": "e1d9c16aa681708a45f5c7c4e215ceb66e011a2e9f0040713f18aefdb866d53cf76cab2868a39b9f7840edce4fef5a82be67335c77a6068e04112754f27ccf4e", + "sha224": "93200ffa96c5776d38fa10abdf8f5bfc0054b9718513df472d2331d2d1e66a3f97b510224f700ce72581ffb10a1c99ec99a8cc1b951851a71f30d9265fccf912", + "sha384": "54f775c6d790f21930459162fc535dbf04a939185127016a04176a0730c6f1f4fb48832ad1261baadd2cedd50814b1c806ad1bbf43ebdc9d047904bf7ceafe1e" + } + }, + { + "key": "password", + "salt": "salt", + "iterations": 4096, + "dkLen": 32, + "results": { + "sha1": "4b007901b765489abead49d926f721d065a429c12e463f6c4cd79401085b03db", + "sha256": "c5e478d59288c841aa530db6845c4c8d962893a001ce4e11a4963873aa98134a", + "sha512": "d197b1b33db0143e018b12f3d1d1479e6cdebdcc97c5c0f87f6902e072f457b5", + "sha224": "218c453bf90635bd0a21a75d172703ff6108ef603f65bb821aedade1d6961683", + "sha384": "559726be38db125bc85ed7895f6e3cf574c7a01c080c3447db1e8a76764deb3c" + } + }, + { + "key": "passwordPASSWORDpassword", + "salt": "saltSALTsaltSALTsaltSALTsaltSALTsalt", + "iterations": 4096, + "dkLen": 40, + "results": { + "sha1": "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038b6b89a48612c5a25284e6605e12329", + "sha256": "348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9", + "sha512": "8c0511f4c6e597c6ac6315d8f0362e225f3c501495ba23b868c005174dc4ee71115b59f9e60cd953", + "sha224": "056c4ba438ded91fc14e0594e6f52b87e1f3690c0dc0fbc05784ed9a754ca780e6c017e80c8de278", + "sha384": "819143ad66df9a552559b9e131c52ae6c5c1b0eed18f4d283b8c5c9eaeb92b392c147cc2d2869d58" + } + }, + { + "key": "pass\u00000word", + "salt": "sa\u00000lt", + "iterations": 4096, + "dkLen": 16, + "results": { + "sha1": "345cbad979dfccb90cac5257bea6ea46", + "sha256": "1df6274d3c0bd2fc7f54fb46f149dda4", + "sha512": "336d14366099e8aac2c46c94a8f178d2", + "sha224": "0aca9ca9634db6ef4927931f633c6453", + "sha384": "b6ab6f8f6532fd9c5c30a79e1f93dcc6" + } + }, + { + "keyHex": "63ffeeddccbbaa", + "salt": "salt", + "iterations": 1, + "dkLen": 32, + "results": { + "sha1": "f6635023b135a57fb8caa89ef8ad93a29d9debb1b011e6e88bffbb212de7c01c", + "sha256": "dadd4a2638c1cf90a220777bc85d81859459513eb83063e3fce7d081490f259a", + "sha512": "f69de451247225a7b30cc47632899572bb980f500d7c606ac9b1c04f928a3488", + "sha224": "9cdee023b5d5e06ccd6c5467463e34fe461a7ed43977f8237f97b0bc7ebfd280", + "sha384": "25c72b6f0e052c883a9273a54cfd41fab86759fa3b33eb7920b923abaad62f99" + } + } + ], + "invalid": [ + { + "key": "password", + "salt": "salt", + "iterations": "NaN", + "dkLen": 16, + "exception": "Iterations not a number" + }, + { + "key": "password", + "salt": "salt", + "iterations": -1, + "dkLen": 16, + "exception": "Bad iterations" + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": "NaN", + "exception": "Key length not a number" + }, + { + "key": "password", + "salt": "salt", + "iterations": 1, + "dkLen": -1, + "exception": "Bad key length" + } + ] +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.html b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.html new file mode 100644 index 00000000..82363915 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.html @@ -0,0 +1,13 @@ + + +
+ + + \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.js new file mode 100644 index 00000000..67914b0f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/pbkdf2-compat/test/index.js @@ -0,0 +1,91 @@ +var assert = require('assert') +var compatNode = require('../') +var compatBrowser = require('../browser') +var fixtures = require('./fixtures') + +// SHA-1 vectors generated by Node.js +// SHA-256/SHA-512 test vectors from: +// https://stackoverflow.com/questions/5130513/pbkdf2-hmac-sha2-test-vectors +// https://stackoverflow.com/questions/15593184/pbkdf2-hmac-sha-512-test-vectors +function runTests(compat, name) { + describe(name, function () { + var algos = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512'] + describe('pbkdf2-compat', function() { + it('defaults to sha1 and handles buffers', function(done) { + compat.pbkdf2(new Buffer('password'), new Buffer('salt'), 1, 32, function (err, result) { + assert.equal(result.toString('hex'), "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164") + done() + }) + }) + + describe('pbkdf2', function() { + algos.forEach(function(algorithm) { + describe(algorithm, function() { + fixtures.valid.forEach(function(f) { + var key = f.key || new Buffer(f.keyHex, 'hex') + var expected = f.results[algorithm] + + it('encodes ' + key + '(' + f.salt + ') with ' + algorithm + ' to ' + expected, function(done) { + compat.pbkdf2(key, f.salt, f.iterations, f.dkLen, algorithm, function(err, result) { + assert.equal(result.toString('hex'), expected) + + done() + }) + }) + }) + + fixtures.invalid.forEach(function(f) { + it('should throw ' + f.exception, function() { + assert.throws(function() { + compat.pbkdf2(f.key, f.salt, f.iterations, f.dkLen, f.algo, function (){}) + }, new RegExp(f.exception)) + }) + }) + }) + }) + + it('should throw if no callback is provided', function() { + assert.throws(function() { + compat.pbkdf2('password', 'salt', 1, 32, 'sha1') + }, /No callback provided to pbkdf2/) + }) + }) + + describe('pbkdf2Sync', function() { + it('defaults to sha1', function() { + var result = compat.pbkdf2Sync('password', 'salt', 1, 32) + + assert.equal(result.toString('hex'), "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164") + }) + + algos.forEach(function(algorithm) { + describe(algorithm, function() { + fixtures.valid.forEach(function(f) { + var key = f.key || new Buffer(f.keyHex, 'hex') + var expected = f.results[algorithm] + + it('encodes ' + key + '(' + f.salt + ') with ' + algorithm + ' to ' + expected, function() { + var result = compat.pbkdf2Sync(key, f.salt, f.iterations, f.dkLen, algorithm) + + assert.equal(result.toString('hex'), expected) + }) + }) + + fixtures.invalid.forEach(function(f) { + it('should throw ' + f.exception, function() { + assert.throws(function() { + compat.pbkdf2Sync(f.key, f.salt, f.iterations, f.dkLen, f.algo) + }, new RegExp(f.exception)) + }) + }) + }) + }) + }) + }) + }) +} + +runTests(compatBrowser, 'JavaScript pbkdf2') +if (compatBrowser !== compatNode) { + runTests(compatNode, 'node pbkdf2') +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/package.json b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/package.json new file mode 100644 index 00000000..fd81fc35 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/package.json @@ -0,0 +1,67 @@ +{ + "name": "parse-asn1", + "version": "3.0.0", + "description": "parse-asn1 ===", + "main": "index.js", + "scripts": { + "test": "node ./test" + }, + "repository": { + "type": "git", + "url": "git://github.com/calvinmetcalf/parse-asn1.git" + }, + "author": "", + "license": "ISC", + "dependencies": { + "asn1.js": "^1.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "pbkdf2-compat": "^3.0.0" + }, + "devDependencies": { + "tape": "^3.4.0" + }, + "gitHead": "a6be135aec21fdc648d15f267381315821734a87", + "bugs": { + "url": "https://github.com/calvinmetcalf/parse-asn1/issues" + }, + "homepage": "https://github.com/calvinmetcalf/parse-asn1", + "_id": "parse-asn1@3.0.0", + "_shasum": "36ea30eb2ad99084e738e92801647910cdbf1ee4", + "_from": "parse-asn1@>=3.0.0 <4.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "36ea30eb2ad99084e738e92801647910cdbf1ee4", + "tarball": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-3.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-3.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/readme.md b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/readme.md new file mode 100644 index 00000000..c331b806 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/readme.md @@ -0,0 +1,4 @@ +parse-asn1 +=== + +utility library for parsing asn1 files for use with browserify-sign. \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/1024.priv new file mode 100644 index 00000000..72062169 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/1024.priv @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKulUTZ8B1qccZ8c +DXRGSY08gW8KvLlcxxxGC4gZHNT3CBUF8n5R4KE30aZyYZ/rtsQZu05juZJxaJ0q +mbe75dlQ5d+Xc9BMXeQg/MpTZw5TAN7OIdGYYpFBe+1PLZ6wEfjkYrMqMUcfq2Lq +hTLdAbvBJnuRcYZLqmBeOQ8FTrKrAgMBAAECgYEAnkHRbEPU3/WISSQrP36iyCb2 +S/SBZwKkzmvCrBxDWhPeDswp9c/2JY76rNWfLzy8iXgUG8WUzvHje61Qh3gmBcKe +bUaTGl4Vy8Ha1YBADo5RfRrdm0FE4tvgvu/TkqFqpBBZweu54285hk5zlG7n/D7Y +dnNXUpu5MlNb5x3gW0kCQQDUL//cwcXUxY/evaJP4jSe+ZwEQZo+zXRLiPUulBoV +aw28CVMuxdgwqAo1X1IKefPeUaf7RQu8gCKaRnpGuEuXAkEAzxZTfMmvmCUDIew4 +5Gk6bK265XQWdhcgiq254lpBGOYmDj9yCE7yA+zmASQwMsXTdQOi1hOCEyrXuSJ5 +c++EDQJAFh3WrnzoEPByuYXMmET8tSFRWMQ5vpgNqh3haHR5b4gUC2hxaiunCBNL +1RpVY9AoUiDywGcG/SPh93CnKB3niwJBAKP7AtsifZgVXtiizB4aMThTjVYaSZrz +D0Kg9DuHylpkDChmFu77TGrNUQgAVuYtfhb/bRblVa/F0hJ4eQHT3JUCQBVT68tb +OgRUk0aP9tC3021VN82X6+klowSQN8oBPX8+TfDWSUilp/+j24Hky+Z29Do7yR/R +qutnL92CvBlVLV4= +-----END PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/1024.pub new file mode 100644 index 00000000..2dba785d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/1024.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrpVE2fAdanHGfHA10RkmNPIFv +Cry5XMccRguIGRzU9wgVBfJ+UeChN9GmcmGf67bEGbtOY7mScWidKpm3u+XZUOXf +l3PQTF3kIPzKU2cOUwDeziHRmGKRQXvtTy2esBH45GKzKjFHH6ti6oUy3QG7wSZ7 +kXGGS6pgXjkPBU6yqwIDAQAB +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.1024.priv new file mode 100644 index 00000000..1145b7d7 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.1024.priv @@ -0,0 +1,18 @@ +-----BEGIN DSA PARAMETERS----- +MIIBHgKBgQDdFg3WQmpOZxObxraIe4rrbUhrBw99fbnz99IvLj60sM/7Uk7eHYvp +UrPaJBIcjPy68BjV4ekDljuPpFoAorsLzyvVSHuNvN6I/bRGm1TCOjDFVe98Oz6k +XmI6pRfIF0TiIPXkel/sWIfBYa1lqdoW82h9FIjhbxVHrKGfvMEc9wIVAOzmJHec +s6yBm+nE3+OmpWFYj0ylAoGAYxO6mFSoIY7PDRyRzKJEnULSzYXd3FoMkPwDCd5I +ch/piIoAUIIQ542TL54GT9wuiCL+0D48qi9GWKasPZABfPQ008WOzmKzD8ncrUTd +a7pzvUvdmwldA4Aa5/5xSXwtpK+DDye7KPlu+oi1BF6uj4TgfeGr1uxouxC2WhBE +qH0= +-----END DSA PARAMETERS----- +-----BEGIN PRIVATE KEY----- +MIIBSwIBADCCASwGByqGSM44BAEwggEfAoGBAOY0KsTt5EpJ4LtlD3xRS5mDiGE1 +CMNp0S9X0sK8kP8Aps8iYwMLbZYglk18GCNnCk4SjbAnZHSB3kaIv6AKQc2J8W2Y +V5se3VhpKOFst7bqRtkGsl8uJtGlKTiXNclkv2jsKOrsBokSD1USGCECTNeMt3Og +ziRcZ1dS+djSOZ2nAhUAzB96SpxlAak+K/QLVJ+lDe5DcY0CgYEAtxX1/Hckvhlh +HQyKZWLQsDfZBILbhc+OLDpOyT6cJS/sJzfFIYZgK5M3rOS4OmzdYfJccQAuGq+T +VJQ3VcYOdbrIANJV8CDrn4jkkejTzJI6fCwAkPWOyxw8kbV1Hsoy6WLfSCHKpBUc +rogAqRGESqBVTawjyF/ECX667y/P49MEFgIUSeRVRgAXsLmeWR/V4Rh9Hex+9+s= +-----END PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.1024.pub new file mode 100644 index 00000000..80a731ea --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.1024.pub @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtzCCASwGByqGSM44BAEwggEfAoGBAOY0KsTt5EpJ4LtlD3xRS5mDiGE1CMNp +0S9X0sK8kP8Aps8iYwMLbZYglk18GCNnCk4SjbAnZHSB3kaIv6AKQc2J8W2YV5se +3VhpKOFst7bqRtkGsl8uJtGlKTiXNclkv2jsKOrsBokSD1USGCECTNeMt3OgziRc +Z1dS+djSOZ2nAhUAzB96SpxlAak+K/QLVJ+lDe5DcY0CgYEAtxX1/HckvhlhHQyK +ZWLQsDfZBILbhc+OLDpOyT6cJS/sJzfFIYZgK5M3rOS4OmzdYfJccQAuGq+TVJQ3 +VcYOdbrIANJV8CDrn4jkkejTzJI6fCwAkPWOyxw8kbV1Hsoy6WLfSCHKpBUcrogA +qRGESqBVTawjyF/ECX667y/P49MDgYQAAoGAXYmxO4+52C1gBzh7GgTwNLJl7bLn +gOhKTFlKhT36VjMjeFfdXmBVBVbfUottKZby/gVX1IXT38PStB/dswbF45bGDdoS +zMFjYmHTtLtrU/4hReVtvb5MYmrPDFX58SwcSRRO/cH6WJPvfu4Aq0cJZA9Kb0B9 +5Wo18JxAqvPtTB8= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.2048.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.2048.priv new file mode 100644 index 00000000..2a77c2ee --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.2048.priv @@ -0,0 +1,20 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIDVQIBAAKCAQEA0jDs9lLWX//NXYE1kNKw4UiDVMHHEtTF1OzJvBJvUh3/xMlU +ic8mUpIMU5mt7BTjcijyLLl/TeNBcI/xDvWH3PAfCjP1CmNzOMHwU6wKA4Q20m5v +zjauVycd7loRm5h+1XyD2JL1KmQTzhIIRAmRTeXMnr8LAHidYfUKmzCOCCrnctlE +EOh1S6e7BFxQBRrlUxZF0LTjcAz31rrjIH6wKkYR4mnpGuI2vVJ+qHGmEhvq1hAb +DvP0GN0iofxHlIVqOlfXYCZO388ZabfcBOQG57tTofm8aS4pnXCgbok9wEYPgbU5 +n6fEvDGOOObQyY109hZZaDJmfygr5mmD0TIXrQIhAMVBhV4liqAN2MrT/+ZUH6hY ++DhTazzSNLIZKQ5gfd+1AoIBADqHGUVQa9pbwyjbzooeWdijUM9W5P7UUj1OjrA0 +HIkcx37qHiYOVFqHpbjDs3tbgRBxBX5zBpwuhywC/6OetDiqzDy7zZCV/YMn06d2 +ncW2Ctjp3KPl7of39+HgXXePgTdKcfkjH9upJQTko88rA4NWwZbHYeA3Lv7DcA11 +XY3+TQHcxMtxf/E6aePjANJBsJsQjYLy3WyUiS87jkgi0Bigjg/cD3Nel4LToCTR +JvQ4m3w3T4W0xL1+8nPjRZ2q0GgmxZzPfwALrwiSYMgGZC/ov43wqOs6WXs0NnpJ +moU4oxutC/uDvTZmJvRj77FINjK0ZA20jmNvWmTIeEm1Xn4CggEABeRpOymQS5IS +X+u9ya7C+P3MPIRGm4dcWPWgPpD1QcclNYLGnhRp7JazNsbbPMjnx1qtF+2qjfy9 +JDeWTAR8qfCNVmQHPAhJsJtV0C/V4PUii71FRNPVC3EAYbcBk8deMGoUg99cxSac +6MCxIIOxuUKWpw8XPlMVpuXc8+lIMTYCPeLGinmT4DQ573t0MS6U3Ck/987xjkH9 +sos7zcYn3vnjywDCxXMidC0eUK1rxAAuY7PL4vQiKwXq8kFtWiKAnns/Zm5LTjiZ +NrwlhNlU2wQVvyIcKaGfSRPheb69IbP+9qp5b7Xe7DNWdo48S0jl2KAFeZ91BnhM +TH6WPtMpjQIgOaTTn6xYK0kZvvH3lZXrzkjp4aNlNY65R0JAKKNsx3s= +-----END DSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.2048.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.2048.pub new file mode 100644 index 00000000..9f6cac1c --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/dsa.2048.pub @@ -0,0 +1,20 @@ +-----BEGIN PUBLIC KEY----- +MIIDRjCCAjkGByqGSM44BAEwggIsAoIBAQDSMOz2UtZf/81dgTWQ0rDhSINUwccS +1MXU7Mm8Em9SHf/EyVSJzyZSkgxTma3sFONyKPIsuX9N40Fwj/EO9Yfc8B8KM/UK +Y3M4wfBTrAoDhDbSbm/ONq5XJx3uWhGbmH7VfIPYkvUqZBPOEghECZFN5cyevwsA +eJ1h9QqbMI4IKudy2UQQ6HVLp7sEXFAFGuVTFkXQtONwDPfWuuMgfrAqRhHiaeka +4ja9Un6ocaYSG+rWEBsO8/QY3SKh/EeUhWo6V9dgJk7fzxlpt9wE5Abnu1Oh+bxp +LimdcKBuiT3ARg+BtTmfp8S8MY445tDJjXT2FlloMmZ/KCvmaYPRMhetAiEAxUGF +XiWKoA3YytP/5lQfqFj4OFNrPNI0shkpDmB937UCggEAOocZRVBr2lvDKNvOih5Z +2KNQz1bk/tRSPU6OsDQciRzHfuoeJg5UWoeluMOze1uBEHEFfnMGnC6HLAL/o560 +OKrMPLvNkJX9gyfTp3adxbYK2Onco+Xuh/f34eBdd4+BN0px+SMf26klBOSjzysD +g1bBlsdh4Dcu/sNwDXVdjf5NAdzEy3F/8Tpp4+MA0kGwmxCNgvLdbJSJLzuOSCLQ +GKCOD9wPc16XgtOgJNEm9DibfDdPhbTEvX7yc+NFnarQaCbFnM9/AAuvCJJgyAZk +L+i/jfCo6zpZezQ2ekmahTijG60L+4O9NmYm9GPvsUg2MrRkDbSOY29aZMh4SbVe +fgOCAQUAAoIBAAXkaTspkEuSEl/rvcmuwvj9zDyERpuHXFj1oD6Q9UHHJTWCxp4U +aeyWszbG2zzI58darRftqo38vSQ3lkwEfKnwjVZkBzwISbCbVdAv1eD1Iou9RUTT +1QtxAGG3AZPHXjBqFIPfXMUmnOjAsSCDsblClqcPFz5TFabl3PPpSDE2Aj3ixop5 +k+A0Oe97dDEulNwpP/fO8Y5B/bKLO83GJ97548sAwsVzInQtHlCta8QALmOzy+L0 +IisF6vJBbVoigJ57P2ZuS044mTa8JYTZVNsEFb8iHCmhn0kT4Xm+vSGz/vaqeW+1 +3uwzVnaOPEtI5digBXmfdQZ4TEx+lj7TKY0= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/ec.pass.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/ec.pass.priv new file mode 100644 index 00000000..bf1836d5 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/ec.pass.priv @@ -0,0 +1,7 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIHeMEkGCSqGSIb3DQEFDTA8MBsGCSqGSIb3DQEFDDAOBAi9LqZQx4JFXAICCAAw +HQYJYIZIAWUDBAECBBA+js1fG4Rv/yRN7oZvxbgyBIGQ/D4yj86M1x8lMsnAHQ/K +7/ryb/baDNHqN9LTZanEGBuyxgrTzt08SiL+h91yFGMoaly029K1VgEI8Lxu5Np/ +A+LK7ewh73ABzsbuxYdcXI+rKnrvLN9Tt6veDs4GlqTTsWwq5wF0C+6gaYRBXA74 +T1b6NykGh2UNL5U5pHZEYdOVLz+lRJL7gYqlweNHP/S3 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/ec.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/ec.priv new file mode 100644 index 00000000..25fffbd8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/ec.priv @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHQCAQEEIDF6Xv8Sv//wGUWD+c780ppGrU0QdZWCAzxAQPQX8r/uoAcGBSuBBAAK +oUQDQgAEIZeowDylls4K/wfBjO18bYo7gGx8nYQRija4e/qEMikOHJai7geeUreU +r5Xky/Ax7s2dGtegsPNsPgGe5MpQvg== +-----END EC PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/ec.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/ec.pub new file mode 100644 index 00000000..2e39e5bb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/ec.pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEIZeowDylls4K/wfBjO18bYo7gGx8nYQR +ija4e/qEMikOHJai7geeUreUr5Xky/Ax7s2dGtegsPNsPgGe5MpQvg== +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/index.js new file mode 100644 index 00000000..2f9a56f0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/index.js @@ -0,0 +1,95 @@ +var test = require('tape'); +var fs = require('fs'); +var priv1024 = fs.readFileSync(__dirname + '/rsa.1024.priv'); +var parseKey = require('../'); +var crypto = require('crypto'); +var rsa1024 = { + private: fs.readFileSync(__dirname + '/rsa.1024.priv'), + public: fs.readFileSync(__dirname + '/rsa.1024.pub') +}; +var rsa2028 = { + private: fs.readFileSync(__dirname + '/rsa.2028.priv'), + public: fs.readFileSync(__dirname + '/rsa.2028.pub') +}; +var nonrsa1024 = { + private: fs.readFileSync(__dirname + '/1024.priv'), + public: fs.readFileSync(__dirname + '/1024.pub') +}; +var pass1024 = { + private: { + passphrase: 'fooo', + key:fs.readFileSync(__dirname + '/pass.1024.priv') + }, + public: fs.readFileSync(__dirname + '/pass.1024.pub') +}; +var ec = { + private: fs.readFileSync(__dirname + '/ec.priv'), + public: fs.readFileSync(__dirname + '/ec.pub') +}; +var ecpass = { + private: { + key: fs.readFileSync(__dirname + '/ec.pass.priv'), + passphrase: 'bard' + }, + public: fs.readFileSync(__dirname + '/ec.pub') +}; +var dsa = { + private: fs.readFileSync(__dirname + '/dsa.1024.priv'), + public: fs.readFileSync(__dirname + '/dsa.1024.pub') +}; +var dsa2 = { + private: fs.readFileSync(__dirname + '/dsa.2048.priv'), + public: fs.readFileSync(__dirname + '/dsa.2048.pub') +}; +var dsapass = { + private: { + key:fs.readFileSync(__dirname + '/pass.dsa.1024.priv'), + passphrase:'password' + }, + public: fs.readFileSync(__dirname + '/pass.dsa.1024.pub') +}; +var dsapass2 = { + private: { + key:fs.readFileSync(__dirname + '/pass2.dsa.1024.priv'), + passphrase:'password' + }, + public: fs.readFileSync(__dirname + '/pass2.dsa.1024.pub') +}; +var rsapass = { + private: { + key:fs.readFileSync(__dirname + '/pass.rsa.1024.priv'), + passphrase:'password' + }, + public: fs.readFileSync(__dirname + '/pass.rsa.1024.pub') +}; +var rsapass2 = { + private: { + key:fs.readFileSync(__dirname + '/pass.rsa.2028.priv'), + passphrase:'password' + }, + public: fs.readFileSync(__dirname + '/pass.rsa.2028.pub') +}; +var i = 0; +function testIt(keys) { + test('key ' + (++i), function (t){ + t.plan(2); + t.ok(parseKey(keys.public,crypto), 'public key'); + t.ok(parseKey(keys.private,crypto), 'private key'); + }); +} + + +testIt(dsa); +testIt(dsa2); +testIt(rsa1024); +testIt(ec); +testIt(rsa2028); +testIt(nonrsa1024); +testIt(ecpass); +testIt(dsapass); +testIt(dsapass2); +testIt(rsapass); +testIt(rsapass2); +testIt(pass1024); +testIt(pass1024); + diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.1024.priv new file mode 100644 index 00000000..b9f38845 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.1024.priv @@ -0,0 +1,18 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIICzzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQIji3ZZ6JbsA4CAggA +MB0GCWCGSAFlAwQBFgQQC6MKblq8zyX90/KmgotsMQSCAoDghNf+yxPC/KRh7F3O +k0lMgtDkV+wCLDv7aBvUqy8Ry2zqFPIlfLb8XtSW943XEu6KUI13IZPEr8p9h1ve +Iye6L0g6uAgbFxBE2DwBBSI7mYr7lokr4v0k+inMKf4JeRdI9XWgwOILKTGf1vH7 +PhvBnqLhOg6BIOuF426qpiyYlmRda74d0Th4o6ZyhyMSzPI1XbWSg719Ew3N/tLe +OHdYl0eFrgNjq+xO4Ev+W7eNIh/XBMQtk9wo+mxeNdldRnX822HxTsL8fSSPs+9T +W5M/2EBTJMSsswSjZyFkq8ehtxovI2u0IBX1IiPulyUZLnSNPDV1eUVClK6rk+q1 +kVsfJhUr2qvIjNlQWlbEXQj4VwGtgl0++l8vdpj59MuN2J3Nx5TNMLjA6BYAa/tr +Bu928QoT7ET+SGx5XKCwKb5fwXmDlV5zZC4kZWTaF/d/Icvj5F+fDZuYFg1JOXNZ ++q2oA1qMYaHGX6lF3pbO84ebg1iwQTDM8iIqFeSMGUJTnk/3a7sqfaWQbEQwGb+X +fXnSTwkF+wO2rriPbFvWyzecWu67zDCP0ZWUgGb86sSJCM7xRGShESwCjOrb88F1 +5SZjyIqogrkc3IWiLH9gc5U8d86qoFjJnP6BfwYks1UIyXNGKfZTCqICpMphV+IS +b0N2jprjLTkWR6nxYGSH1bkKMs7x1M0FBLWWLAZqPn9X3pe6JwIBds04O6XjF0un +oxwDjcJdoxVs7PgRiM5d1Tubqu2zmpCCmXNiqi9B0+rV9/jHg9IA5gUfvYdCcEv+ +oAr90I+2+PuBFa9lgdbDV6DtZk4bSYluqamxVeLPg/vrewYfVfDv6jftfY1D0DEy +69H0 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.1024.pub new file mode 100644 index 00000000..617e7fb1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.1024.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDSK/7i5BV0x+gmX16Wrm7kRkCZ +y1QUt6wiM2g+SAZTYR0381VnSMX2cv7CpN3499lZj1rL5S7YTaZZwX3RvU5fz56/ +eDX6ciL/PZsbclN2KdkMWYgmcb9J1zUeoMQ3cjfFUCdQZ/ZvDWa+wY2Zg8os2Bow +AoufHtYHm3eOly/cWwIDAQAB +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.dsa.1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.dsa.1024.priv new file mode 100644 index 00000000..aab5fc2f --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.dsa.1024.priv @@ -0,0 +1,11 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIBnzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQI1z4IJORFws4CAggA +MB0GCWCGSAFlAwQBAgQQq7f0CuKCTITfPS5Xax1H4wSCAVDFyIjYVXfBNe+BARqz +Tfo09y4vKkErOb7Sz4bQkAjRLjOXiUjM4eTNtivml8NqVrQTKAghN+ggxj416OD4 +oq6Ns7Ncbd4Xm5Ni8wrrWbJxVog6rAa/ioU0sfgRExYy/xE2Q9KkW+VE7SUwanwY +e81Od9qNM5KhZGM1yUSKa0JA6Xqb8dAqBo9rVt8DceumB9OP83xV3fLEimSZfR6p +slA1P/dTvKxwhpguQe4Z3OkzTzGCxyboqeRW1woNHKbxjzzSHcaki9SHQm3xpUW8 +hRAJd6OtDnLbkE9MnC+UcI3mjru1xfnR5MU7qG7e9nvOhEDVaDkiK3DbrSf0B0Bi +p1hyX1XsSXDewSEd/mlfMLdD8WecgUtl9ea7JzxY3/6R78yB951I5TmY45mp/v+N +tbxEv29B65UKf0ac7gVw4LNy8JF2ef/L/meEmBoIAE71f+8= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.dsa.1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.dsa.1024.pub new file mode 100644 index 00000000..80a731ea --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.dsa.1024.pub @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtzCCASwGByqGSM44BAEwggEfAoGBAOY0KsTt5EpJ4LtlD3xRS5mDiGE1CMNp +0S9X0sK8kP8Aps8iYwMLbZYglk18GCNnCk4SjbAnZHSB3kaIv6AKQc2J8W2YV5se +3VhpKOFst7bqRtkGsl8uJtGlKTiXNclkv2jsKOrsBokSD1USGCECTNeMt3OgziRc +Z1dS+djSOZ2nAhUAzB96SpxlAak+K/QLVJ+lDe5DcY0CgYEAtxX1/HckvhlhHQyK +ZWLQsDfZBILbhc+OLDpOyT6cJS/sJzfFIYZgK5M3rOS4OmzdYfJccQAuGq+TVJQ3 +VcYOdbrIANJV8CDrn4jkkejTzJI6fCwAkPWOyxw8kbV1Hsoy6WLfSCHKpBUcrogA +qRGESqBVTawjyF/ECX667y/P49MDgYQAAoGAXYmxO4+52C1gBzh7GgTwNLJl7bLn +gOhKTFlKhT36VjMjeFfdXmBVBVbfUottKZby/gVX1IXT38PStB/dswbF45bGDdoS +zMFjYmHTtLtrU/4hReVtvb5MYmrPDFX58SwcSRRO/cH6WJPvfu4Aq0cJZA9Kb0B9 +5Wo18JxAqvPtTB8= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.1024.priv new file mode 100644 index 00000000..b67bd804 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.1024.priv @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-CBC,04D2D7882E0C474E07E542FE997D2A49 + +vfB5Gtm34n3SeI6JELjWiGw6O+j+tGR6Wbi3SNeAZkfSA8PTjei6PVHr+dGK5zMd +nTckd0EpxItqxEdtLK6GtBIa9KRd3cEbayHmyyybH2FC4STXJCUFBe2eb7ZKmnCl +RB5FcmAqExif+QOJwHnZw6DTzq+oGSwi9cSoy2qE62FgXkj8uKAYcBLONmsP1YQA +4zIub4bnEbIghL/swEB/HVS86FyMCsMXrHEOnSuUUBf/UfZFNypI6kVUNXlItnN1 +14eeRsBD37VkL7dAQPMx+Dwm7DbU07QWrVvzgmWlu3KqR0tRNA9e4a5f14XOYxgS +HZ+XVZK8iAd+76OnprlFtGDowDXGM0wUXPYq5j8WpKxNsVs2RV+S6U0gQLoSqNxt +We7UPWZufzEdjTUO8q9KhdGqFmJ53XIYClZf0bp148b+Bk3P+dN5TbmKQEfulScn +rTLTRo34fdTIAJr5BJh0OXGNs9rFlMJ9Nz4FwVTEB1DMerXtt9ICdhud9BktRhvq +axgoz+XA3LrBrlPPcrSCZyIYjZFydGSkzg439OyDEZ6+uRmc0qhWA4j6AgXx6gGR +NvvypoFVKvXqEq/2F+SVyyMGrm4xPmsr/HUBeE9SmuTzNzDfVAM/xerqIoR2szR0 +O0hwtOj4fk7//cd1CjFzd0JiF/SqMkHxkdbmIC9qlhshkWlQbvvhbefodYPuGxmj +L1TaPgX36OcrQSodzyWBN5tSmmX1Nmftcz7iwc4AKrqkdnM3sPS3SczsAjMWrjRr +7iYhdPQSZtxVCTjACU3h7scNAg9AU6l4YZrowR//J6U= +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.1024.pub new file mode 100644 index 00000000..3506c331 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.1024.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGcMA0GCSqGSIb3DQEBAQUAA4GKADCBhgJ/OwswbFo/uyC8ltGf/yA1A+gV5IGd +nAgPbUSI3GzbHCA+x+TLG/tLvbRw3r1smppY/jkkpiVW1ErSMuN0uixp5gb78Z9r +H1XpWb5WWgp3WaY/9EHMjMdOkQ/9LVZvRvl/M/Fi6owP+q+amJI1BEjECYfbhGL3 +rmlVdq4qXc40QwIDAQAB +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.2028.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.2028.priv new file mode 100644 index 00000000..99e82135 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.2028.priv @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,7A6A055AD675947A657041422F06D439 + +HQdjzAKUuqqKhZHmpzzY/monfqFhiHnZ5c24jtR9fM4aQJXf/e1fz6MEhyIz6XON +sb4CnXZstnxUuVWDkHEu6KWQ/dKALgiDUuT+UdMawVoVPGdgyWZp35pQPWi3fT2V +XZn58YkG8bO3Y403eZPyhadOefD1VtuFuK6/f90jjzx6ZDnwveXpYgFV7Jy1/pFd +cLLMf07C+hbk416nX6UVipWe4GH+ADFom5ZCfAaUotM7n8i149dULNF4YYi2wP31 +1YaDH5vf1CqiaieDY7xLzpEixwJz6ZEg3gLXaUvz2MpF8owiGI3eP0g7voWp3xt4 +TQx/qDURlaXiaRriWdWtpKyW1MFuJ5+KdNtR1/kXr2BLPB/ZLwyqtynUy8ZYpb4+ +WIRYpUGeb//ZHGhlCH7CRMdABsal4wTwnzi9fW4Ax96ecJ2SlwCuKxwS7iEq2y1/ +FAfGwsE+XufHhme5p6XjKfiHx+zJMIB2NMkrm+wm4PbMTrGVnw5/41/r6XxOB8fe +iKi12Jth4dusc1vYGYfzKop9uEM6CZ6+Chqzb+Zyh/xUiZVlCX/BYnxr7yXUm9aR +PHQgxkn2Act8FgQB3Kgs3jCiCRIJrlsnybeWzQ3YO9TjC4MxygmmwODDBpsOKnEi +kXXS54+cZFjcsva4uJVwhAywRPVUkLzmTkH0tGiwCHjeQNECm+TLahkkEIXrVTb9 +c9creNXMgE6jVVz+R43HXsGvTcgMcBLyFRQJe2nVaj/dQ5JbF4uqNnQzRjAbD34K +uTpFaJ/kmlgcmeScRLnwaoYwFlmhSC+bK0dfY1Jr6AQRA6IDP7nIjqWNDCHNBB8r +Qj1v2KWoVQe3xNHaXhkbJPbA2DKlUIqffkBVtMKtt9KuG3Rccf3bVYAW6oid73/D +z7DMAF5G/OpVR8VbGh1WxXuR7zEVDUwpwsp9ek5dqN8BnBz1ppdZNIKqzszneckU +s2l/6mZBmgV1Nfy/cQU6U5s3S1Xc75UDQVLms3CIOpFTRIpecNTdfa31fYy/svy0 +M2lWTbCva0dOyuvMUhTgBL4I7Qa2dUMPXHMZatV5ooHYq/BZJA1r84C5cM5r+umE +2LLv/BlUr7RaQHhaKGn4Qhpzo5yRDE9mEqDpLVkbg8SxMsdf/pEF5/VyUwA9t8RT +fKVsInRd386tDqJSDbSFqKTvLztr/5YCyzZzvC2YB1voko/caOGd2d/G51Ij+bXU +xEN8U4fHDBsHwPUGb31uZUhTXpL37KiOqZmXFoH2usmuvx882XvyGcV0F4tstMaR +KLKzl2PwqzAYGFexLkYKMz0TYIeN6h3b86ETazPPU49nkaEU23Dx21J2Rb3UlH+I +lDQF3wuH1QlYiTnlcVa/Zu4QQg0/iP8ALkZ06mvn9e9mOtnA8gsh4B2oLqc19VLU +bcpv40dV1H3W9Lcx9B8JYUp0c/Oyno1D7Yj3tjGcwMKECmUpHi4kksehVo0/P933 +xmFmC6eyWYVdO9upvY/vKSB7b1dMt85iWr3gnMsSfRYc6jsbSxdjOPST46UsIzjx +wa1DS6+Bv5tiaC4uC6X+0tCAZo+UOQMYUbTGRR/7g/c= +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.2028.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.2028.pub new file mode 100644 index 00000000..655cc3a4 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass.rsa.2028.pub @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBHjANBgkqhkiG9w0BAQEFAAOCAQsAMIIBBgKB/gy7mjaWgPeFdVYDZWRCA9BN +iv3pPb0es27+FKY0hszLaOw47ExCtAWpDsH48TXAfyHBYwBLguayfk4LGIupxb+C +GMbRo3xEp0CbfY1Jby26T9vGjRC1foHDDUJG84uaRbyHqaf4i6zt4gVR+xlAEIjk +aFAAK8cOoXAT1CVqGLLljUCchL8PjaHj/yriZ/S7rdwlI3LnABxwwmLrmR/v71Wt +pmO/aNG8N+1po+QwaghTkyQ59E/ZvAuOkFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQ +aEDRbBFBmBqTv5fFGfk2WsAfKf/RG0/VFd+ZeM5251TeTvXH695nlSGauVl9AgMB +AAE= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass2.dsa.1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass2.dsa.1024.priv new file mode 100644 index 00000000..29e36734 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass2.dsa.1024.priv @@ -0,0 +1,15 @@ +-----BEGIN DSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,DC173C6DFD455EBE462A35D6AB9A603A + +FoC3sxbdUFJTaNtRpooMxaX2lcQRLUz8qcRhzDBn5a1kaMHp2JM3KlHK5aauybT4 +ilmlKJ9sSm8pFLAWPKbkczSgZ+X6p/51v4zaEJSebZ98p32kQk87XJQE7aYroxYV +UfM5PSOoKWilj+LZQQEXV10qDoYGrnbSdoNSxYW5V1a1aP+ua0EO7m9MUYkoLxi3 +SJ/s2h/5KM3TOz7d7DOZuSoNm+0n6YC4aqQnR3lmEtAXEYLQqLhH2Q3FTKTHwBQw +HgMBAzcXOS1YSw6Ekwh1eZamizrOEC4I6oZEHoUBqRfbsQ8tu77kDq2ovQSyn8Fp +SeE64m3GgZOYdfcDuNZ0ccmm3shBBfTfD9AwR+1thklKO3oaaLEHb6TmnkD79rEz +9WsiVxoN7vqqWdgoeyl7REOB6WLQp8kYS4FoRG0QB/ZS8Hs/Tf17QPnrQNiMkvP7 +sJSHmlaMKXjWXK0VoN94kfZKUXwkzLD1VXuXFCnUkznWU0tahYi06b8/SVXc6EG+ +0mzylckH7UnjOQfxSFAlZ+e/PiX80tcPakxYbk+f1Nv7L0NOyhrDv18KUbv9mEpV +Ysild1m7/QSF0u1qmjmGNQ== +-----END DSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass2.dsa.1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass2.dsa.1024.pub new file mode 100644 index 00000000..80a731ea --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/pass2.dsa.1024.pub @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtzCCASwGByqGSM44BAEwggEfAoGBAOY0KsTt5EpJ4LtlD3xRS5mDiGE1CMNp +0S9X0sK8kP8Aps8iYwMLbZYglk18GCNnCk4SjbAnZHSB3kaIv6AKQc2J8W2YV5se +3VhpKOFst7bqRtkGsl8uJtGlKTiXNclkv2jsKOrsBokSD1USGCECTNeMt3OgziRc +Z1dS+djSOZ2nAhUAzB96SpxlAak+K/QLVJ+lDe5DcY0CgYEAtxX1/HckvhlhHQyK +ZWLQsDfZBILbhc+OLDpOyT6cJS/sJzfFIYZgK5M3rOS4OmzdYfJccQAuGq+TVJQ3 +VcYOdbrIANJV8CDrn4jkkejTzJI6fCwAkPWOyxw8kbV1Hsoy6WLfSCHKpBUcrogA +qRGESqBVTawjyF/ECX667y/P49MDgYQAAoGAXYmxO4+52C1gBzh7GgTwNLJl7bLn +gOhKTFlKhT36VjMjeFfdXmBVBVbfUottKZby/gVX1IXT38PStB/dswbF45bGDdoS +zMFjYmHTtLtrU/4hReVtvb5MYmrPDFX58SwcSRRO/cH6WJPvfu4Aq0cJZA9Kb0B9 +5Wo18JxAqvPtTB8= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.1024.priv new file mode 100644 index 00000000..d3b5fdab --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.1024.priv @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICVAIBAAJ/OwswbFo/uyC8ltGf/yA1A+gV5IGdnAgPbUSI3GzbHCA+x+TLG/tL +vbRw3r1smppY/jkkpiVW1ErSMuN0uixp5gb78Z9rH1XpWb5WWgp3WaY/9EHMjMdO +kQ/9LVZvRvl/M/Fi6owP+q+amJI1BEjECYfbhGL3rmlVdq4qXc40QwIDAQABAn8I +VZ0BPoAOhyF33KFMHxy8r28fsVgxJUYgM3NqQgdv4fFawCYXjhJz9duU5YJGFJGJ +WUGeHlkyYFlpi4f3m7tY7JawmQUWB0MNSoKHI3cgDX4/tfBN8ni+cO0eSoR5czBY +EsAHBU47p1awNFAHwd+ZEuv9H4RmMn7p279rQTtpAkAH3Nqs2/vrRF2cZUN4fIXf +4xHsQBByUayGq8a3J0UGaSFWv68zTUKFherr9uZotNp7NJ4jBXiARw0q8docXUG1 +AkAHgmOKHoORtAmikqpmFEJZOtsXMaLCIm4EszPo5ciYoLMBcVit09AdiQlt7ZJL +DY02svU1b0agCZ97kDkmHDkXAkACa8M9JELuDs/P/vIGYDkMVatIFfW6bWF02eFG +taWwMqCcSEsWvbw0xqYt34jURpNbCjmCyQVwYfAw/+TLhP9dAkAFwRjdwjw37qpj +ddg1mNiu37b7swFxmkiMOXZRxaNNsfb56A14RpN3zob3QdGUybGodMIKTFbmU/lu +CjqAxafJAkAG2yf6RWbwFIWfMyt7WYCh0VaGBCcgy574AinVieEo3ZZyFfC63+xm +3uoaNy4iLoJv4GCjqUBz3ZfcVaO/DDWG +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.1024.pub new file mode 100644 index 00000000..7ba06369 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.1024.pub @@ -0,0 +1,5 @@ +-----BEGIN RSA PUBLIC KEY----- +MIGGAn87CzBsWj+7ILyW0Z//IDUD6BXkgZ2cCA9tRIjcbNscID7H5Msb+0u9tHDe +vWyamlj+OSSmJVbUStIy43S6LGnmBvvxn2sfVelZvlZaCndZpj/0QcyMx06RD/0t +Vm9G+X8z8WLqjA/6r5qYkjUESMQJh9uEYveuaVV2ripdzjRDAgMBAAE= +-----END RSA PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.2028.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.2028.priv new file mode 100644 index 00000000..10e651d8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.2028.priv @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEjwIBAAKB/gy7mjaWgPeFdVYDZWRCA9BNiv3pPb0es27+FKY0hszLaOw47ExC +tAWpDsH48TXAfyHBYwBLguayfk4LGIupxb+CGMbRo3xEp0CbfY1Jby26T9vGjRC1 +foHDDUJG84uaRbyHqaf4i6zt4gVR+xlAEIjkaFAAK8cOoXAT1CVqGLLljUCchL8P +jaHj/yriZ/S7rdwlI3LnABxwwmLrmR/v71WtpmO/aNG8N+1po+QwaghTkyQ59E/Z +vAuOkFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQaEDRbBFBmBqTv5fFGfk2WsAfKf/R +G0/VFd+ZeM5251TeTvXH695nlSGauVl9AgMBAAECgf4LrWHY/l54ouThZWvvbrug +pfz6sJX2g9l7yXmWlEWsPECVo/7SUbpYFpt6OZy99zSg+IKbGqWKfdhoKrTwIVtC +L0YZ0NlmdnANSIz0roxQG7ZxkL5+vHSw/PmD9x4Uwf+Cz8hATCmNBv1qc60dkyuW +4CLqe72qaTiVWRoO1iagQghNcLoo6vSy65ExLaCDTPha7yu2vw4hFZpWiEjW4dxf +rFdLiix52BC86YlAlxME/rLg8IJVvilbyo9aWdXmxOaUTLRv6PkFD1/gVdw8V9Qr +SLN9FlK2kkjiX0dzoibvZw3tMnt3yydAx0X87+sMRVahC1bp3kVPz4Hy0EWX4QJ/ +PM31vGiuITk2NCd51DXt1Ltn2OP5FaJSmCaEjh0XkU4qouYyjXWt8Bu6BTCl2vua +Fg0Uji9C+IkPLmaUMbMIOwaTk8cWqLthSxsLe70J5OkGrgfKUM/w+BHH1Pt/Pjzj +C++l0kiFaOVDVaAV9GpLPLCBoK/PC9Rb/rxMMoCCNwJ/NZuedIny2w3LMii77h/T +zSvergNGhjY6Rnva8lLXJ6dlrkcPAyps3gWwxqj4NR0T+GM0bDUPVLb7M07XV7SX +v7VJGm52JbRGwM1ss+r8XTTNemeGk+WRxG7TgtsMqYGXLfB8Qxk/f5/Mcc00Tl8u +wXFNsfxJxmt6AbsTr3g36wJ/IhOnibz9Ad+nchlBnN3QeW3CKHqzaR18voqvtVm2 +kJfHK15prH/sSGmxmiEGgrCJTZxtDbaNCO7/VBjnKudUUIhCAwsLtuq0/zub9vAd +8G1scfIpv5qaSNzmKoX8bOwArvrS6wP7yKrcTsuWIlHD8rJVI7IEDnQoTp5G8fK1 +hwJ/MIh8M5v0r5dUYEv6oIJWGcle6AH1JmsP5WIafgq72Z2288pHcCFHwNY8Dg9J +76QswVLnUhPTlmm3EOOPGEtam2iAD5r0Afytlb4lbNoQsj2szeXONDXB+6oueajh +VNELUr8HcSP5lgzRZjJW6aFIzj9LDRmQnUAOjGSXVOQtEwJ/MCQZ7N/v4dIKeDRA +8d8UExZ3+gGHumziztGRJ0tQryZH2PakP5I7V+1l7qEUnJ2c3mF+e1v41Ep9LCvh +bzrPKw9dxh18g4b+7bMpsWPnsraKh6ipxc7aaOaZV0Dxgez4zcZu0P1olO0cN3KM +nxJ0Pds3R8bAhNCDdS2JZaRp5Q== +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.2028.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.2028.pub new file mode 100644 index 00000000..b36dca4d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/rsa.2028.pub @@ -0,0 +1,8 @@ +-----BEGIN RSA PUBLIC KEY----- +MIIBBgKB/gy7mjaWgPeFdVYDZWRCA9BNiv3pPb0es27+FKY0hszLaOw47ExCtAWp +DsH48TXAfyHBYwBLguayfk4LGIupxb+CGMbRo3xEp0CbfY1Jby26T9vGjRC1foHD +DUJG84uaRbyHqaf4i6zt4gVR+xlAEIjkaFAAK8cOoXAT1CVqGLLljUCchL8PjaHj +/yriZ/S7rdwlI3LnABxwwmLrmR/v71WtpmO/aNG8N+1po+QwaghTkyQ59E/ZvAuO +kFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQaEDRbBFBmBqTv5fFGfk2WsAfKf/RG0/V +Fd+ZeM5251TeTvXH695nlSGauVl9AgMBAAE= +-----END RSA PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/vector.js b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/vector.js new file mode 100644 index 00000000..164ced12 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/vector.js @@ -0,0 +1,7 @@ +module.exports = { + p : new Buffer('86F5CA03DCFEB225063FF830A0C769B9DD9D6153AD91D7CE27F787C43278B447E6533B86B18BED6E8A48B784A14C252C5BE0DBF60B86D6385BD2F12FB763ED8873ABFD3F5BA2E0A8C0A59082EAC056935E529DAF7C610467899C77ADEDFC846C881870B7B19B2B58F9BE0521A17002E3BDD6B86685EE90B3D9A1B02B782B1779', 'hex'), + q : new Buffer('996F967F6C8E388D9E28D01E205FBA957A5698B1', 'hex'), + g : new Buffer('07B0F92546150B62514BB771E2A0C0CE387F03BDA6C56B505209FF25FD3C133D89BBCD97E904E09114D9A7DEFDEADFC9078EA544D2E401AEECC40BB9FBBF78FD87995A10A1C27CB7789B594BA7EFB5C4326A9FE59A070E136DB77175464ADCA417BE5DCE2F40D10A46A3A3943F26AB7FD9C0398FF8C76EE0A56826A8A88F1DBD', 'hex'), + x : new Buffer('411602CB19A6CCC34494D79D98EF1E7ED5AF25F7', 'hex'), + y : new Buffer('5DF5E01DED31D0297E274E1691C192FE5868FEF9E19A84776454B100CF16F65392195A38B90523E2542EE61871C0440CB87C322FC4B4D2EC5E1E7EC766E1BE8D4CE935437DC11C3C8FD426338933EBFE739CB3465F4D3668C5E473508253B1E682F65CBDC4FAE93C2EA212390E54905A86E2223170B44EAA7DA5DD9FFCFB7F3B', 'hex') +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/vector.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/vector.priv new file mode 100644 index 00000000..178bd1e6 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/vector.priv @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBugIBAAKBgQCG9coD3P6yJQY/+DCgx2m53Z1hU62R184n94fEMni0R+ZTO4ax +i+1uiki3hKFMJSxb4Nv2C4bWOFvS8S+3Y+2Ic6v9P1ui4KjApZCC6sBWk15Sna98 +YQRniZx3re38hGyIGHC3sZsrWPm+BSGhcALjvda4ZoXukLPZobAreCsXeQIVAJlv +ln9sjjiNnijQHiBfupV6VpixAoGAB7D5JUYVC2JRS7dx4qDAzjh/A72mxWtQUgn/ +Jf08Ez2Ju82X6QTgkRTZp9796t/JB46lRNLkAa7sxAu5+794/YeZWhChwny3eJtZ +S6fvtcQyap/lmgcOE223cXVGStykF75dzi9A0QpGo6OUPyarf9nAOY/4x27gpWgm +qKiPHb0CgYBd9eAd7THQKX4nThaRwZL+WGj++eGahHdkVLEAzxb2U5IZWji5BSPi +VC7mGHHARAy4fDIvxLTS7F4efsdm4b6NTOk1Q33BHDyP1CYziTPr/nOcs0ZfTTZo +xeRzUIJTseaC9ly9xPrpPC6iEjkOVJBahuIiMXC0Tqp9pd2f/Pt/OwIUQRYCyxmm +zMNElNedmO8eftWvJfc= +-----END DSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/vector2.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/vector2.priv new file mode 100644 index 00000000..ef53f614 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/test/vector2.priv @@ -0,0 +1,19 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIDVQIBAAKCAQEAnbb7WVG2a7b+HhQPHSzlUCN0Fh/WU43xZIIYZC8LXEjI96Qa +rfoYcyS4dnT6GCKwDx7PgTaUPXxVdXJk5aGkT/4BLpk24AwdPpMQsBx9F5gF0wWL +Kp9Ltvlxa/5hF8a1s8xNm+NBEErUqArWyU4AX0uZPhTwketRdDvzMFDDjeI1Vn4b +NMPWpcDOqhoPNoITw9GYQ9C0sJ3Ln8ctOcjeQfG/FNS7RWPKKDcWIcrTMktqLTkh +Rb6/rHSIBSNvXKL+krhxzY+cNtMpK1UJyoyqd6Kt/Hv9d92m9xElp0Vv6hU+QzJW +oiYcagbtNpN5fnmV+tWqu8++PtonQeN1QEriWwIhAPLDEZN0znbJNWmQtGU3Shfy +P57TUIm9lp9hxt3pmYwfAoIBAFx/9rBvjxQ/6CiEM0k+R2nE2Yis5b4loOJICWcH +FsYT17DO5pMvj6p8RNLLJFI9pT++T27DWViS0apYxDKKBsRqFWYufqpwOh3s+Luy +0F2+LrlWwUKjOGYdEEYcDRNUcghQV/NJQwn/pzxhH3izKtu1dAw2HJ81vpCZfbIB +Ti71qmF4L1Kr64vWQyxN0Je8VCOyhdr7YNw2ToFh9KKjWso6ELHE0gPMdqRwozr9 +y92SlZhZq9i1bhclJS146sZucbqa4/HdJIcZmHQ5PNTYMhhoAGVHYOHjTAnk0VUX +n57A3ERz+Za9zm7tHKvti28Rb3rZz1Bd8PmY40qydRSw/+cCggEAZnCYxlRCbHjX ++CAerGwgPvAw1DYFAywvH6k35SN9vZSfNKCiVk/hJtyLcVxRQYAs4JecgkZGPEDm +tr2qJRP6YRcocWwuT9U7yVuJ5plJ2WUS6HO5yPjf1JnMMSiCVhreyzH2WOk0wMGX +8sTZawXLrWc4Hnt2iJHk2jhD0k2UzftRJum4vyHoNY7g4KMO8T/WpmTA3ONzH3+0 +mkhFpP2CVGh5cqLTglmcm6xODteZgZMHiRMDJVgTSXZBC4nSwXHRI6w1/ZdyGVl6p9FcGppCjlkZT3XHIevLz65EaWpJmvp04EKZ8TICZgFjjLh6t5GQ1KCYY +xXajuxlYck4mWvq3wIgacdUjCHQ3+prmlHJ6tTifDPTs/GAMW5byrkskz8OTbw= +-----END DSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/package.json b/node_modules/crypto-browserify/node_modules/public-encrypt/package.json new file mode 100644 index 00000000..28f6de62 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/package.json @@ -0,0 +1,72 @@ +{ + "name": "public-encrypt", + "version": "2.0.0", + "description": "browserify version of publicEncrypt & privateDecrypt", + "main": "index.js", + "browser": "browser.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "node test/index.js | tspec" + }, + "repository": { + "type": "git", + "url": "https://github.com/crypto-browserify/publicEncrypt.git" + }, + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/publicEncrypt/issues" + }, + "homepage": "https://github.com/crypto-browserify/publicEncrypt", + "dependencies": { + "bn.js": "^1.0.0", + "browserify-rsa": "^2.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^3.0.0", + "randombytes": "^2.0.1" + }, + "devDependencies": { + "tape": "^3.0.3", + "tap-spec": "^2.1.2" + }, + "gitHead": "51e36739287358dd4e9d9272bfe1bed8ccb580eb", + "_id": "public-encrypt@2.0.0", + "_shasum": "9e49010bf021d33f6597c77abd939612a82767fc", + "_from": "public-encrypt@>=2.0.0 <3.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "9e49010bf021d33f6597c77abd939612a82767fc", + "tarball": "http://registry.npmjs.org/public-encrypt/-/public-encrypt-2.0.0.tgz" + }, + "_resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-2.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/privateDecrypt.js b/node_modules/crypto-browserify/node_modules/public-encrypt/privateDecrypt.js new file mode 100644 index 00000000..9047c0e0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/privateDecrypt.js @@ -0,0 +1,108 @@ +var parseKeys = require('parse-asn1'); +var mgf = require('./mgf'); +var xor = require('./xor'); +var bn = require('bn.js'); +var crt = require('browserify-rsa'); +var createHash = require('create-hash'); +var withPublic = require('./withPublic'); +module.exports = function privateDecrypt(private_key, enc, reverse) { + var padding; + if (private_key.padding) { + padding = private_key.padding; + } else if (reverse) { + padding = 1; + } else { + padding = 4; + } + + var key = parseKeys(private_key); + var k = key.modulus.byteLength(); + if (enc.length > k || new bn(enc).cmp(key.modulus) >= 0) { + throw new Error('decryption error'); + } + var msg; + if (reverse) { + msg = withPublic(new bn(enc), key); + } else { + msg = crt(enc, key); + } + var zBuffer = new Buffer(k - msg.length); + zBuffer.fill(0); + msg = Buffer.concat([zBuffer, msg], k); + if (padding === 4) { + return oaep(key, msg); + } else if (padding === 1) { + return pkcs1(key, msg, reverse); + } else if (padding === 3) { + return msg; + } else { + throw new Error('unknown padding'); + } +}; + +function oaep(key, msg){ + var n = key.modulus; + var k = key.modulus.byteLength(); + var mLen = msg.length; + var iHash = createHash('sha1').update(new Buffer('')).digest(); + var hLen = iHash.length; + var hLen2 = 2 * hLen; + if (msg[0] !== 0) { + throw new Error('decryption error'); + } + var maskedSeed = msg.slice(1, hLen + 1); + var maskedDb = msg.slice(hLen + 1); + var seed = xor(maskedSeed, mgf(maskedDb, hLen)); + var db = xor(maskedDb, mgf(seed, k - hLen - 1)); + if (compare(iHash, db.slice(0, hLen))) { + throw new Error('decryption error'); + } + var i = hLen; + while (db[i] === 0) { + i++; + } + if (db[i++] !== 1) { + throw new Error('decryption error'); + } + return db.slice(i); +} + +function pkcs1(key, msg, reverse){ + var p1 = msg.slice(0, 2); + var i = 2; + var status = 0; + while (msg[i++] !== 0) { + if (i >= msg.length) { + status++; + break; + } + } + var ps = msg.slice(2, i - 1); + var p2 = msg.slice(i - 1, i); + + if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)){ + status++; + } + if (ps.length < 8) { + status++; + } + if (status) { + throw new Error('decryption error'); + } + return msg.slice(i); +} +function compare(a, b){ + a = new Buffer(a); + b = new Buffer(b); + var dif = 0; + var len = a.length; + if (a.length !== b.length) { + dif++; + len = Math.min(a.length, b.length); + } + var i = -1; + while (++i < len) { + dif += (a[i] ^ b[i]); + } + return dif; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/publicEncrypt.js b/node_modules/crypto-browserify/node_modules/public-encrypt/publicEncrypt.js new file mode 100644 index 00000000..f1ce4046 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/publicEncrypt.js @@ -0,0 +1,95 @@ +var parseKeys = require('parse-asn1'); +var randomBytes = require('randombytes'); +var createHash = require('create-hash'); +var mgf = require('./mgf'); +var xor = require('./xor'); +var bn = require('bn.js'); +var withPublic = require('./withPublic'); +var crt = require('browserify-rsa'); + +var constants = { + RSA_PKCS1_OAEP_PADDING: 4, + RSA_PKCS1_PADDIN: 1, + RSA_NO_PADDING: 3 +}; + +module.exports = function publicEncrypt(public_key, msg, reverse) { + var padding; + if (public_key.padding) { + padding = public_key.padding; + } else if (reverse) { + padding = 1; + } else { + padding = 4; + } + var key = parseKeys(public_key); + var paddedMsg; + if (padding === 4) { + paddedMsg = oaep(key, msg); + } else if (padding === 1) { + paddedMsg = pkcs1(key, msg, reverse); + } else if (padding === 3) { + paddedMsg = new bn(msg); + if (paddedMsg.cmp(key.modulus) >= 0) { + throw new Error('data too long for modulus'); + } + } else { + throw new Error('unknown padding'); + } + if (reverse) { + return crt(paddedMsg, key); + } else { + return withPublic(paddedMsg, key); + } +}; + +function oaep(key, msg){ + var k = key.modulus.byteLength(); + var mLen = msg.length; + var iHash = createHash('sha1').update(new Buffer('')).digest(); + var hLen = iHash.length; + var hLen2 = 2 * hLen; + if (mLen > k - hLen2 - 2) { + throw new Error('message too long'); + } + var ps = new Buffer(k - mLen - hLen2 - 2); + ps.fill(0); + var dblen = k - hLen - 1; + var seed = randomBytes(hLen); + var maskedDb = xor(Buffer.concat([iHash, ps, new Buffer([1]), msg], dblen), mgf(seed, dblen)); + var maskedSeed = xor(seed, mgf(maskedDb, hLen)); + return new bn(Buffer.concat([new Buffer([0]), maskedSeed, maskedDb], k)); +} +function pkcs1(key, msg, reverse){ + var mLen = msg.length; + var k = key.modulus.byteLength(); + if (mLen > k - 11) { + throw new Error('message too long'); + } + var ps; + if (reverse) { + ps = new Buffer(k - mLen - 3); + ps.fill(0xff); + } else { + ps = nonZero(k - mLen - 3); + } + return new bn(Buffer.concat([new Buffer([0, reverse?1:2]), ps, new Buffer([0]), msg], k)); +} +function nonZero(len, crypto) { + var out = new Buffer(len); + var i = 0; + var cache = randomBytes(len*2); + var cur = 0; + var num; + while (i < len) { + if (cur === cache.length) { + cache = randomBytes(len*2); + cur = 0; + } + num = cache[cur++]; + if (num) { + out[i++] = num; + } + } + return out; +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/readme.md b/node_modules/crypto-browserify/node_modules/public-encrypt/readme.md new file mode 100644 index 00000000..47c69401 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/readme.md @@ -0,0 +1,6 @@ +publicEncrypt +=== + +[![Build Status](https://travis-ci.org/crypto-browserify/publicEncrypt.svg)](https://travis-ci.org/crypto-browserify/publicEncrypt) + +publicEncrypt/privateDecrypt for browserify \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/test/1024.priv new file mode 100644 index 00000000..72062169 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/1024.priv @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKulUTZ8B1qccZ8c +DXRGSY08gW8KvLlcxxxGC4gZHNT3CBUF8n5R4KE30aZyYZ/rtsQZu05juZJxaJ0q +mbe75dlQ5d+Xc9BMXeQg/MpTZw5TAN7OIdGYYpFBe+1PLZ6wEfjkYrMqMUcfq2Lq +hTLdAbvBJnuRcYZLqmBeOQ8FTrKrAgMBAAECgYEAnkHRbEPU3/WISSQrP36iyCb2 +S/SBZwKkzmvCrBxDWhPeDswp9c/2JY76rNWfLzy8iXgUG8WUzvHje61Qh3gmBcKe +bUaTGl4Vy8Ha1YBADo5RfRrdm0FE4tvgvu/TkqFqpBBZweu54285hk5zlG7n/D7Y +dnNXUpu5MlNb5x3gW0kCQQDUL//cwcXUxY/evaJP4jSe+ZwEQZo+zXRLiPUulBoV +aw28CVMuxdgwqAo1X1IKefPeUaf7RQu8gCKaRnpGuEuXAkEAzxZTfMmvmCUDIew4 +5Gk6bK265XQWdhcgiq254lpBGOYmDj9yCE7yA+zmASQwMsXTdQOi1hOCEyrXuSJ5 +c++EDQJAFh3WrnzoEPByuYXMmET8tSFRWMQ5vpgNqh3haHR5b4gUC2hxaiunCBNL +1RpVY9AoUiDywGcG/SPh93CnKB3niwJBAKP7AtsifZgVXtiizB4aMThTjVYaSZrz +D0Kg9DuHylpkDChmFu77TGrNUQgAVuYtfhb/bRblVa/F0hJ4eQHT3JUCQBVT68tb +OgRUk0aP9tC3021VN82X6+klowSQN8oBPX8+TfDWSUilp/+j24Hky+Z29Do7yR/R +qutnL92CvBlVLV4= +-----END PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/test/1024.pub new file mode 100644 index 00000000..2dba785d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/1024.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrpVE2fAdanHGfHA10RkmNPIFv +Cry5XMccRguIGRzU9wgVBfJ+UeChN9GmcmGf67bEGbtOY7mScWidKpm3u+XZUOXf +l3PQTF3kIPzKU2cOUwDeziHRmGKRQXvtTy2esBH45GKzKjFHH6ti6oUy3QG7wSZ7 +kXGGS6pgXjkPBU6yqwIDAQAB +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/ec.pass.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/test/ec.pass.priv new file mode 100644 index 00000000..bf1836d5 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/ec.pass.priv @@ -0,0 +1,7 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIHeMEkGCSqGSIb3DQEFDTA8MBsGCSqGSIb3DQEFDDAOBAi9LqZQx4JFXAICCAAw +HQYJYIZIAWUDBAECBBA+js1fG4Rv/yRN7oZvxbgyBIGQ/D4yj86M1x8lMsnAHQ/K +7/ryb/baDNHqN9LTZanEGBuyxgrTzt08SiL+h91yFGMoaly029K1VgEI8Lxu5Np/ +A+LK7ewh73ABzsbuxYdcXI+rKnrvLN9Tt6veDs4GlqTTsWwq5wF0C+6gaYRBXA74 +T1b6NykGh2UNL5U5pHZEYdOVLz+lRJL7gYqlweNHP/S3 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/ec.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/test/ec.priv new file mode 100644 index 00000000..25fffbd8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/ec.priv @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHQCAQEEIDF6Xv8Sv//wGUWD+c780ppGrU0QdZWCAzxAQPQX8r/uoAcGBSuBBAAK +oUQDQgAEIZeowDylls4K/wfBjO18bYo7gGx8nYQRija4e/qEMikOHJai7geeUreU +r5Xky/Ax7s2dGtegsPNsPgGe5MpQvg== +-----END EC PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/ec.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/test/ec.pub new file mode 100644 index 00000000..2e39e5bb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/ec.pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEIZeowDylls4K/wfBjO18bYo7gGx8nYQR +ija4e/qEMikOHJai7geeUreUr5Xky/Ax7s2dGtegsPNsPgGe5MpQvg== +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/index.js b/node_modules/crypto-browserify/node_modules/public-encrypt/test/index.js new file mode 100644 index 00000000..ea472b62 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/index.js @@ -0,0 +1,117 @@ +var test = require('tape'); +var fs = require('fs'); +var constants = require('constants'); +var parseKeys = require('parse-asn1'); +require('./nodeTests'); +var priv1024 = fs.readFileSync(__dirname + '/rsa.1024.priv'); +var rsa1024 = { + private: fs.readFileSync(__dirname + '/rsa.1024.priv'), + public: fs.readFileSync(__dirname + '/rsa.1024.pub') +}; +var rsa1024priv = { + private: fs.readFileSync(__dirname + '/rsa.1024.priv'), + public: fs.readFileSync(__dirname + '/rsa.1024.priv') +}; +var rsa1024 = { + private: fs.readFileSync(__dirname + '/rsa.1024.priv'), + public: fs.readFileSync(__dirname + '/rsa.1024.pub') +}; +var rsa2028 = { + private: fs.readFileSync(__dirname + '/rsa.2028.priv'), + public: fs.readFileSync(__dirname + '/rsa.2028.pub') +}; +var nonrsa1024 = { + private: fs.readFileSync(__dirname + '/1024.priv'), + public: fs.readFileSync(__dirname + '/1024.pub') +}; +var nonrsa1024str = { + private: fs.readFileSync(__dirname + '/1024.priv').toString(), + public: fs.readFileSync(__dirname + '/1024.pub').toString() +}; +var pass1024 = { + private: { + passphrase: 'fooo', + key:fs.readFileSync(__dirname + '/pass.1024.priv') + }, + public: fs.readFileSync(__dirname + '/pass.1024.pub') +}; +var pass2028 = { + private: { + passphrase: 'password', + key:fs.readFileSync(__dirname + '/rsa.pass.priv') + }, + public: fs.readFileSync(__dirname + '/rsa.pass.pub') +}; + +var nodeCrypto = require('../'); +var myCrypto = require('../browser'); +function _testIt(keys, message, t) { + var pub = keys.public; + var priv = keys.private; + t.test(message.toString(), function (t) { + t.plan(8); + + var myEnc = myCrypto.publicEncrypt(pub, message); + var nodeEnc = nodeCrypto.publicEncrypt(pub, message); + t.equals(myCrypto.privateDecrypt(priv, myEnc).toString('hex'), message.toString('hex'), 'my decrypter my message'); + t.equals(myCrypto.privateDecrypt(priv, nodeEnc).toString('hex'), message.toString('hex'), 'my decrypter node\'s message'); + t.equals(nodeCrypto.privateDecrypt(priv, myEnc).toString('hex'), message.toString('hex'), 'node decrypter my message'); + t.equals(nodeCrypto.privateDecrypt(priv, nodeEnc).toString('hex'), message.toString('hex'), 'node decrypter node\'s message'); + myEnc = myCrypto.privateEncrypt(priv, message); + nodeEnc = nodeCrypto.privateEncrypt(priv, message); + t.equals(myCrypto.publicDecrypt(pub, myEnc).toString('hex'), message.toString('hex'), 'reverse methods my decrypter my message'); + t.equals(myCrypto.publicDecrypt(pub, nodeEnc).toString('hex'), message.toString('hex'), 'reverse methods my decrypter node\'s message'); + t.equals(nodeCrypto.publicDecrypt(pub, myEnc).toString('hex'), message.toString('hex'), 'reverse methods node decrypter my message'); + t.equals(nodeCrypto.publicDecrypt(pub, nodeEnc).toString('hex'), message.toString('hex'), 'reverse methods node decrypter node\'s message'); + + }); +} +function testIt(keys, message, t) { + _testIt(keys, message, t); + _testIt(paddingObject(keys, 1), Buffer.concat([message, new Buffer(' with RSA_PKCS1_PADDING')]), t); + var parsedKey = parseKeys(keys.public); + var k = parsedKey.modulus.byteLength(); + var zBuf = new Buffer(k); + zBuf.fill(0); + var msg = Buffer.concat([zBuf, message, new Buffer(' with no padding')]).slice(-k); + _testIt(paddingObject(keys, 3), msg, t); +} +function paddingObject(keys, padding) { + return { + public: addPadding(keys.public, padding), + private: addPadding(keys.private, padding) + }; +} +function addPadding(key, padding) { + if (typeof key === 'string' || Buffer.isBuffer(key)) { + return { + key: key, + padding: padding + }; + } + var out = { + key: key.key, + padding:padding + }; + if ('passphrase' in key) { + out.passphrase = key.passphrase; + } + return out; +} +function testRun(i) { + test('run ' + i, function (t) { + testIt(rsa1024priv, new Buffer('1024 2 private keys'), t); + testIt(rsa1024, new Buffer('1024 keys'), t); + testIt(rsa2028, new Buffer('2028 keys'), t); + testIt(nonrsa1024, new Buffer('1024 keys non-rsa key'), t); + testIt(pass1024, new Buffer('1024 keys and password'), t); + testIt(nonrsa1024str, new Buffer('1024 keys non-rsa key as a string'), t); + testIt(pass2028, new Buffer('2028 rsa key with variant passwords'), t); + }); +} + +var i = 0; +var num = 20; +while (++i <= 20) { + testRun(i); +} diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/nodeTests.js b/node_modules/crypto-browserify/node_modules/public-encrypt/test/nodeTests.js new file mode 100644 index 00000000..f168e934 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/nodeTests.js @@ -0,0 +1,51 @@ +var crypto = require('../browser'); +var test = require('tape'); +var fs = require('fs'); + +// Test RSA encryption/decryption +test('node tests', function (t) { + var certPem = fs.readFileSync(__dirname + '/test_cert.pem', 'ascii'); + var keyPem = fs.readFileSync(__dirname + '/test_key.pem', 'ascii'); + var rsaPubPem = fs.readFileSync(__dirname + '/test_rsa_pubkey.pem', + 'ascii'); + var rsaKeyPem = fs.readFileSync(__dirname + '/test_rsa_privkey.pem', + 'ascii'); + var rsaKeyPemEncrypted = fs.readFileSync( + __dirname + '/test_rsa_privkey_encrypted.pem', 'ascii'); + var input = 'I AM THE WALRUS'; + var bufferToEncrypt = new Buffer(input); + + var encryptedBuffer = crypto.publicEncrypt(rsaPubPem, bufferToEncrypt); + + var decryptedBuffer = crypto.privateDecrypt(rsaKeyPem, encryptedBuffer); + t.equal(input, decryptedBuffer.toString()); + + var decryptedBufferWithPassword = crypto.privateDecrypt({ + key: rsaKeyPemEncrypted, + passphrase: 'password' + }, encryptedBuffer); + t.equal(input, decryptedBufferWithPassword.toString()); + + // encryptedBuffer = crypto.publicEncrypt(certPem, bufferToEncrypt); + + // decryptedBuffer = crypto.privateDecrypt(keyPem, encryptedBuffer); + // t.equal(input, decryptedBuffer.toString()); + + encryptedBuffer = crypto.publicEncrypt(keyPem, bufferToEncrypt); + + decryptedBuffer = crypto.privateDecrypt(keyPem, encryptedBuffer); + t.equal(input, decryptedBuffer.toString()); + + encryptedBuffer = crypto.privateEncrypt(keyPem, bufferToEncrypt); + + decryptedBuffer = crypto.publicDecrypt(keyPem, encryptedBuffer); + t.equal(input, decryptedBuffer.toString()); + + t.throws(function() { + crypto.privateDecrypt({ + key: rsaKeyPemEncrypted, + passphrase: 'wrong' + }, encryptedBuffer); + }); + t.end(); +}); \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/pass.1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/test/pass.1024.priv new file mode 100644 index 00000000..b9f38845 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/pass.1024.priv @@ -0,0 +1,18 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIICzzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQIji3ZZ6JbsA4CAggA +MB0GCWCGSAFlAwQBFgQQC6MKblq8zyX90/KmgotsMQSCAoDghNf+yxPC/KRh7F3O +k0lMgtDkV+wCLDv7aBvUqy8Ry2zqFPIlfLb8XtSW943XEu6KUI13IZPEr8p9h1ve +Iye6L0g6uAgbFxBE2DwBBSI7mYr7lokr4v0k+inMKf4JeRdI9XWgwOILKTGf1vH7 +PhvBnqLhOg6BIOuF426qpiyYlmRda74d0Th4o6ZyhyMSzPI1XbWSg719Ew3N/tLe +OHdYl0eFrgNjq+xO4Ev+W7eNIh/XBMQtk9wo+mxeNdldRnX822HxTsL8fSSPs+9T +W5M/2EBTJMSsswSjZyFkq8ehtxovI2u0IBX1IiPulyUZLnSNPDV1eUVClK6rk+q1 +kVsfJhUr2qvIjNlQWlbEXQj4VwGtgl0++l8vdpj59MuN2J3Nx5TNMLjA6BYAa/tr +Bu928QoT7ET+SGx5XKCwKb5fwXmDlV5zZC4kZWTaF/d/Icvj5F+fDZuYFg1JOXNZ ++q2oA1qMYaHGX6lF3pbO84ebg1iwQTDM8iIqFeSMGUJTnk/3a7sqfaWQbEQwGb+X +fXnSTwkF+wO2rriPbFvWyzecWu67zDCP0ZWUgGb86sSJCM7xRGShESwCjOrb88F1 +5SZjyIqogrkc3IWiLH9gc5U8d86qoFjJnP6BfwYks1UIyXNGKfZTCqICpMphV+IS +b0N2jprjLTkWR6nxYGSH1bkKMs7x1M0FBLWWLAZqPn9X3pe6JwIBds04O6XjF0un +oxwDjcJdoxVs7PgRiM5d1Tubqu2zmpCCmXNiqi9B0+rV9/jHg9IA5gUfvYdCcEv+ +oAr90I+2+PuBFa9lgdbDV6DtZk4bSYluqamxVeLPg/vrewYfVfDv6jftfY1D0DEy +69H0 +-----END ENCRYPTED PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/pass.1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/test/pass.1024.pub new file mode 100644 index 00000000..617e7fb1 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/pass.1024.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDSK/7i5BV0x+gmX16Wrm7kRkCZ +y1QUt6wiM2g+SAZTYR0381VnSMX2cv7CpN3499lZj1rL5S7YTaZZwX3RvU5fz56/ +eDX6ciL/PZsbclN2KdkMWYgmcb9J1zUeoMQ3cjfFUCdQZ/ZvDWa+wY2Zg8os2Bow +AoufHtYHm3eOly/cWwIDAQAB +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.1024.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.1024.priv new file mode 100644 index 00000000..d3b5fdab --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.1024.priv @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICVAIBAAJ/OwswbFo/uyC8ltGf/yA1A+gV5IGdnAgPbUSI3GzbHCA+x+TLG/tL +vbRw3r1smppY/jkkpiVW1ErSMuN0uixp5gb78Z9rH1XpWb5WWgp3WaY/9EHMjMdO +kQ/9LVZvRvl/M/Fi6owP+q+amJI1BEjECYfbhGL3rmlVdq4qXc40QwIDAQABAn8I +VZ0BPoAOhyF33KFMHxy8r28fsVgxJUYgM3NqQgdv4fFawCYXjhJz9duU5YJGFJGJ +WUGeHlkyYFlpi4f3m7tY7JawmQUWB0MNSoKHI3cgDX4/tfBN8ni+cO0eSoR5czBY +EsAHBU47p1awNFAHwd+ZEuv9H4RmMn7p279rQTtpAkAH3Nqs2/vrRF2cZUN4fIXf +4xHsQBByUayGq8a3J0UGaSFWv68zTUKFherr9uZotNp7NJ4jBXiARw0q8docXUG1 +AkAHgmOKHoORtAmikqpmFEJZOtsXMaLCIm4EszPo5ciYoLMBcVit09AdiQlt7ZJL +DY02svU1b0agCZ97kDkmHDkXAkACa8M9JELuDs/P/vIGYDkMVatIFfW6bWF02eFG +taWwMqCcSEsWvbw0xqYt34jURpNbCjmCyQVwYfAw/+TLhP9dAkAFwRjdwjw37qpj +ddg1mNiu37b7swFxmkiMOXZRxaNNsfb56A14RpN3zob3QdGUybGodMIKTFbmU/lu +CjqAxafJAkAG2yf6RWbwFIWfMyt7WYCh0VaGBCcgy574AinVieEo3ZZyFfC63+xm +3uoaNy4iLoJv4GCjqUBz3ZfcVaO/DDWG +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.1024.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.1024.pub new file mode 100644 index 00000000..7ba06369 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.1024.pub @@ -0,0 +1,5 @@ +-----BEGIN RSA PUBLIC KEY----- +MIGGAn87CzBsWj+7ILyW0Z//IDUD6BXkgZ2cCA9tRIjcbNscID7H5Msb+0u9tHDe +vWyamlj+OSSmJVbUStIy43S6LGnmBvvxn2sfVelZvlZaCndZpj/0QcyMx06RD/0t +Vm9G+X8z8WLqjA/6r5qYkjUESMQJh9uEYveuaVV2ripdzjRDAgMBAAE= +-----END RSA PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.2028.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.2028.priv new file mode 100644 index 00000000..10e651d8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.2028.priv @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEjwIBAAKB/gy7mjaWgPeFdVYDZWRCA9BNiv3pPb0es27+FKY0hszLaOw47ExC +tAWpDsH48TXAfyHBYwBLguayfk4LGIupxb+CGMbRo3xEp0CbfY1Jby26T9vGjRC1 +foHDDUJG84uaRbyHqaf4i6zt4gVR+xlAEIjkaFAAK8cOoXAT1CVqGLLljUCchL8P +jaHj/yriZ/S7rdwlI3LnABxwwmLrmR/v71WtpmO/aNG8N+1po+QwaghTkyQ59E/Z +vAuOkFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQaEDRbBFBmBqTv5fFGfk2WsAfKf/R +G0/VFd+ZeM5251TeTvXH695nlSGauVl9AgMBAAECgf4LrWHY/l54ouThZWvvbrug +pfz6sJX2g9l7yXmWlEWsPECVo/7SUbpYFpt6OZy99zSg+IKbGqWKfdhoKrTwIVtC +L0YZ0NlmdnANSIz0roxQG7ZxkL5+vHSw/PmD9x4Uwf+Cz8hATCmNBv1qc60dkyuW +4CLqe72qaTiVWRoO1iagQghNcLoo6vSy65ExLaCDTPha7yu2vw4hFZpWiEjW4dxf +rFdLiix52BC86YlAlxME/rLg8IJVvilbyo9aWdXmxOaUTLRv6PkFD1/gVdw8V9Qr +SLN9FlK2kkjiX0dzoibvZw3tMnt3yydAx0X87+sMRVahC1bp3kVPz4Hy0EWX4QJ/ +PM31vGiuITk2NCd51DXt1Ltn2OP5FaJSmCaEjh0XkU4qouYyjXWt8Bu6BTCl2vua +Fg0Uji9C+IkPLmaUMbMIOwaTk8cWqLthSxsLe70J5OkGrgfKUM/w+BHH1Pt/Pjzj +C++l0kiFaOVDVaAV9GpLPLCBoK/PC9Rb/rxMMoCCNwJ/NZuedIny2w3LMii77h/T +zSvergNGhjY6Rnva8lLXJ6dlrkcPAyps3gWwxqj4NR0T+GM0bDUPVLb7M07XV7SX +v7VJGm52JbRGwM1ss+r8XTTNemeGk+WRxG7TgtsMqYGXLfB8Qxk/f5/Mcc00Tl8u +wXFNsfxJxmt6AbsTr3g36wJ/IhOnibz9Ad+nchlBnN3QeW3CKHqzaR18voqvtVm2 +kJfHK15prH/sSGmxmiEGgrCJTZxtDbaNCO7/VBjnKudUUIhCAwsLtuq0/zub9vAd +8G1scfIpv5qaSNzmKoX8bOwArvrS6wP7yKrcTsuWIlHD8rJVI7IEDnQoTp5G8fK1 +hwJ/MIh8M5v0r5dUYEv6oIJWGcle6AH1JmsP5WIafgq72Z2288pHcCFHwNY8Dg9J +76QswVLnUhPTlmm3EOOPGEtam2iAD5r0Afytlb4lbNoQsj2szeXONDXB+6oueajh +VNELUr8HcSP5lgzRZjJW6aFIzj9LDRmQnUAOjGSXVOQtEwJ/MCQZ7N/v4dIKeDRA +8d8UExZ3+gGHumziztGRJ0tQryZH2PakP5I7V+1l7qEUnJ2c3mF+e1v41Ep9LCvh +bzrPKw9dxh18g4b+7bMpsWPnsraKh6ipxc7aaOaZV0Dxgez4zcZu0P1olO0cN3KM +nxJ0Pds3R8bAhNCDdS2JZaRp5Q== +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.2028.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.2028.pub new file mode 100644 index 00000000..b36dca4d --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.2028.pub @@ -0,0 +1,8 @@ +-----BEGIN RSA PUBLIC KEY----- +MIIBBgKB/gy7mjaWgPeFdVYDZWRCA9BNiv3pPb0es27+FKY0hszLaOw47ExCtAWp +DsH48TXAfyHBYwBLguayfk4LGIupxb+CGMbRo3xEp0CbfY1Jby26T9vGjRC1foHD +DUJG84uaRbyHqaf4i6zt4gVR+xlAEIjkaFAAK8cOoXAT1CVqGLLljUCchL8PjaHj +/yriZ/S7rdwlI3LnABxwwmLrmR/v71WtpmO/aNG8N+1po+QwaghTkyQ59E/ZvAuO +kFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQaEDRbBFBmBqTv5fFGfk2WsAfKf/RG0/V +Fd+ZeM5251TeTvXH695nlSGauVl9AgMBAAE= +-----END RSA PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.pass.priv b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.pass.priv new file mode 100644 index 00000000..99e82135 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.pass.priv @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,7A6A055AD675947A657041422F06D439 + +HQdjzAKUuqqKhZHmpzzY/monfqFhiHnZ5c24jtR9fM4aQJXf/e1fz6MEhyIz6XON +sb4CnXZstnxUuVWDkHEu6KWQ/dKALgiDUuT+UdMawVoVPGdgyWZp35pQPWi3fT2V +XZn58YkG8bO3Y403eZPyhadOefD1VtuFuK6/f90jjzx6ZDnwveXpYgFV7Jy1/pFd +cLLMf07C+hbk416nX6UVipWe4GH+ADFom5ZCfAaUotM7n8i149dULNF4YYi2wP31 +1YaDH5vf1CqiaieDY7xLzpEixwJz6ZEg3gLXaUvz2MpF8owiGI3eP0g7voWp3xt4 +TQx/qDURlaXiaRriWdWtpKyW1MFuJ5+KdNtR1/kXr2BLPB/ZLwyqtynUy8ZYpb4+ +WIRYpUGeb//ZHGhlCH7CRMdABsal4wTwnzi9fW4Ax96ecJ2SlwCuKxwS7iEq2y1/ +FAfGwsE+XufHhme5p6XjKfiHx+zJMIB2NMkrm+wm4PbMTrGVnw5/41/r6XxOB8fe +iKi12Jth4dusc1vYGYfzKop9uEM6CZ6+Chqzb+Zyh/xUiZVlCX/BYnxr7yXUm9aR +PHQgxkn2Act8FgQB3Kgs3jCiCRIJrlsnybeWzQ3YO9TjC4MxygmmwODDBpsOKnEi +kXXS54+cZFjcsva4uJVwhAywRPVUkLzmTkH0tGiwCHjeQNECm+TLahkkEIXrVTb9 +c9creNXMgE6jVVz+R43HXsGvTcgMcBLyFRQJe2nVaj/dQ5JbF4uqNnQzRjAbD34K +uTpFaJ/kmlgcmeScRLnwaoYwFlmhSC+bK0dfY1Jr6AQRA6IDP7nIjqWNDCHNBB8r +Qj1v2KWoVQe3xNHaXhkbJPbA2DKlUIqffkBVtMKtt9KuG3Rccf3bVYAW6oid73/D +z7DMAF5G/OpVR8VbGh1WxXuR7zEVDUwpwsp9ek5dqN8BnBz1ppdZNIKqzszneckU +s2l/6mZBmgV1Nfy/cQU6U5s3S1Xc75UDQVLms3CIOpFTRIpecNTdfa31fYy/svy0 +M2lWTbCva0dOyuvMUhTgBL4I7Qa2dUMPXHMZatV5ooHYq/BZJA1r84C5cM5r+umE +2LLv/BlUr7RaQHhaKGn4Qhpzo5yRDE9mEqDpLVkbg8SxMsdf/pEF5/VyUwA9t8RT +fKVsInRd386tDqJSDbSFqKTvLztr/5YCyzZzvC2YB1voko/caOGd2d/G51Ij+bXU +xEN8U4fHDBsHwPUGb31uZUhTXpL37KiOqZmXFoH2usmuvx882XvyGcV0F4tstMaR +KLKzl2PwqzAYGFexLkYKMz0TYIeN6h3b86ETazPPU49nkaEU23Dx21J2Rb3UlH+I +lDQF3wuH1QlYiTnlcVa/Zu4QQg0/iP8ALkZ06mvn9e9mOtnA8gsh4B2oLqc19VLU +bcpv40dV1H3W9Lcx9B8JYUp0c/Oyno1D7Yj3tjGcwMKECmUpHi4kksehVo0/P933 +xmFmC6eyWYVdO9upvY/vKSB7b1dMt85iWr3gnMsSfRYc6jsbSxdjOPST46UsIzjx +wa1DS6+Bv5tiaC4uC6X+0tCAZo+UOQMYUbTGRR/7g/c= +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.pass.pub b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.pass.pub new file mode 100644 index 00000000..655cc3a4 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/rsa.pass.pub @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBHjANBgkqhkiG9w0BAQEFAAOCAQsAMIIBBgKB/gy7mjaWgPeFdVYDZWRCA9BN +iv3pPb0es27+FKY0hszLaOw47ExCtAWpDsH48TXAfyHBYwBLguayfk4LGIupxb+C +GMbRo3xEp0CbfY1Jby26T9vGjRC1foHDDUJG84uaRbyHqaf4i6zt4gVR+xlAEIjk +aFAAK8cOoXAT1CVqGLLljUCchL8PjaHj/yriZ/S7rdwlI3LnABxwwmLrmR/v71Wt +pmO/aNG8N+1po+QwaghTkyQ59E/ZvAuOkFWHok2q/R6PYAa2jdZ9zim0FqOP+nkQ +aEDRbBFBmBqTv5fFGfk2WsAfKf/RG0/VFd+ZeM5251TeTvXH695nlSGauVl9AgMB +AAE= +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_cert.pem b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_cert.pem new file mode 100644 index 00000000..a3c1e4a0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_cert.pem @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDXDCCAsWgAwIBAgIJAKL0UG+mRkSPMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNV +BAYTAlVLMRQwEgYDVQQIEwtBY2tuYWNrIEx0ZDETMBEGA1UEBxMKUmh5cyBKb25l +czEQMA4GA1UEChMHbm9kZS5qczEdMBsGA1UECxMUVGVzdCBUTFMgQ2VydGlmaWNh +dGUxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wOTExMTEwOTUyMjJaFw0yOTExMDYw +OTUyMjJaMH0xCzAJBgNVBAYTAlVLMRQwEgYDVQQIEwtBY2tuYWNrIEx0ZDETMBEG +A1UEBxMKUmh5cyBKb25lczEQMA4GA1UEChMHbm9kZS5qczEdMBsGA1UECxMUVGVz +dCBUTFMgQ2VydGlmaWNhdGUxEjAQBgNVBAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEA8d8Hc6atq78Jt1HLp9agA/wpQfsFvkYUdZ1YsdvO +kL2janjwHQgMMCy/Njal3FUEW0OLPebKZUJ8L44JBXSlVxU4zyiiSOWld8EkTetR +AVT3WKQq3ud+cnxv7g8rGRQp1UHZwmdbZ1wEfAYq8QjYx6m1ciMgRo7DaDQhD29k +d+UCAwEAAaOB4zCB4DAdBgNVHQ4EFgQUL9miTJn+HKNuTmx/oMWlZP9cd4QwgbAG +A1UdIwSBqDCBpYAUL9miTJn+HKNuTmx/oMWlZP9cd4ShgYGkfzB9MQswCQYDVQQG +EwJVSzEUMBIGA1UECBMLQWNrbmFjayBMdGQxEzARBgNVBAcTClJoeXMgSm9uZXMx +EDAOBgNVBAoTB25vZGUuanMxHTAbBgNVBAsTFFRlc3QgVExTIENlcnRpZmljYXRl +MRIwEAYDVQQDEwlsb2NhbGhvc3SCCQCi9FBvpkZEjzAMBgNVHRMEBTADAQH/MA0G +CSqGSIb3DQEBBQUAA4GBADRXXA2xSUK5W1i3oLYWW6NEDVWkTQ9RveplyeS9MOkP +e7yPcpz0+O0ZDDrxR9chAiZ7fmdBBX1Tr+pIuCrG/Ud49SBqeS5aMJGVwiSd7o1n +dhU2Sz3Q60DwJEL1VenQHiVYlWWtqXBThe9ggqRPnCfsCRTP8qifKkjk45zWPcpN +-----END CERTIFICATE----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_key.pem b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_key.pem new file mode 100644 index 00000000..48fd93c9 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDx3wdzpq2rvwm3Ucun1qAD/ClB+wW+RhR1nVix286QvaNqePAd +CAwwLL82NqXcVQRbQ4s95splQnwvjgkFdKVXFTjPKKJI5aV3wSRN61EBVPdYpCre +535yfG/uDysZFCnVQdnCZ1tnXAR8BirxCNjHqbVyIyBGjsNoNCEPb2R35QIDAQAB +AoGBAJNem9C4ftrFNGtQ2DB0Udz7uDuucepkErUy4MbFsc947GfENjDKJXr42Kx0 +kYx09ImS1vUpeKpH3xiuhwqe7tm4FsCBg4TYqQle14oxxm7TNeBwwGC3OB7hiokb +aAjbPZ1hAuNs6ms3Ybvvj6Lmxzx42m8O5DXCG2/f+KMvaNUhAkEA/ekrOsWkNoW9 +2n3m+msdVuxeek4B87EoTOtzCXb1dybIZUVv4J48VAiM43hhZHWZck2boD/hhwjC +M5NWd4oY6QJBAPPcgBVNdNZSZ8hR4ogI4nzwWrQhl9MRbqqtfOn2TK/tjMv10ALg +lPmn3SaPSNRPKD2hoLbFuHFERlcS79pbCZ0CQQChX3PuIna/gDitiJ8oQLOg7xEM +wk9TRiDK4kl2lnhjhe6PDpaQN4E4F0cTuwqLAoLHtrNWIcOAQvzKMrYdu1MhAkBm +Et3qDMnjDAs05lGT72QeN90/mPAcASf5eTTYGahv21cb6IBxM+AnwAPpqAAsHhYR +9h13Y7uYbaOjvuF23LRhAkBoI9eaSMn+l81WXOVUHnzh3ZwB4GuTyxMXXNOhuiFd +0z4LKAMh99Z4xQmqSoEkXsfM4KPpfhYjF/bwIcP5gOei +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_rsa_privkey.pem b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_rsa_privkey.pem new file mode 100644 index 00000000..425518a0 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_rsa_privkey.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF +NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F +UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB +AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA +QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK +kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg +f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u +412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc +mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7 +kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA +gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW +G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI +7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA== +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_rsa_privkey_encrypted.pem b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_rsa_privkey_encrypted.pem new file mode 100644 index 00000000..08e76171 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_rsa_privkey_encrypted.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,9D916E00476DFF9E70FA4BA9E3A6CB0E + +oj0VC35ShSEqlfJ0rLGgkqJCyIK+mXSsa/X/xAur+lI/RVOVTWd7oQQGTdI/0rLX +PdQR02Na3X9Rptezh6J04PfMGeFysxdT6RpC+rkHRPVbN0F4TqxSNNXzkwK70+EF +dSuDMyVKv9YN4wWDf0g6VKe4ShAH/sqICQBrVyzWyYLvH/hwZmZZ1QEab6ylIKtb +EJunwu9BxVVA04bbuATKkKjJOqDn0fG8hb4bYbyD02dJwgLePzzn36F31kcBCEHI +tESlD3RsS+EtfpfgPkplXNOhqYzkD9auDb7Zy+ZwL20fjnJb75OSGu8gOg3KTljt +mApZOg0nJ5Jk9ATAdyzyVSFOM1Hhcw12ws06Dq9KRnXgO6bbuadLTFRDdvSYDFvD +ijUb+97UolQfYIXQMqXli3EIvHr7CTWe/3mpoDgK1mtr0+923Bm97XgE7KSr0L46 +n5QpNjCZf1vbXldNmW+TRifiJMgtVdS7x0N4vqDPNEe+FelVv3U4Pz3HIOtFuWLr +ZCxlgVxJY4IsyYlV0ItQjIv8fJiAyemZdO2lA9K6h0eEF+9Apr3i79JGWUi74p5D +Ooak4le0Va9O34f6FxCGn/a54A6bhKu24Ub/0gr/e4WRa7693euEdgIAZXhtMu2Z +taU5SKjjXPzjmRCM2kINHTCENlaU4oFzTmj3TYY/jdKyNP1bHa07NhlomladkIHK +GD6HaYkcbuwvh8hOPsopSwuS+NqjnGPq9Vv4ecBC+9veDEmpIE1iR6FK9Hjrre88 +kLoMQNmA+vuc8jG4/FIHM3SauQiR1ZJ6+zkz97kcmOf+X7LRaS4j6lfFR6qHiJ6y +-----END RSA PRIVATE KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_rsa_pubkey.pem b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_rsa_pubkey.pem new file mode 100644 index 00000000..b3bbf6cb --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/test/test_rsa_pubkey.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCFENGw33yGihy92pDjZQhl0C3 +6rPJj+CvfSC8+q28hxA161QFNUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6 +Z4UMR7EOcpfdUE9Hf3m/hs+FUR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJw +oYi+1hqp1fIekaxsyQIDAQAB +-----END PUBLIC KEY----- diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/withPublic.js b/node_modules/crypto-browserify/node_modules/public-encrypt/withPublic.js new file mode 100644 index 00000000..abdbe35c --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/withPublic.js @@ -0,0 +1,10 @@ +var bn = require('bn.js'); +function withPublic(paddedMsg, key) { + return new Buffer(paddedMsg + .toRed(bn.mont(key.modulus)) + .redPow(new bn(key.publicExponent)) + .fromRed() + .toArray()); +} + +module.exports = withPublic; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/public-encrypt/xor.js b/node_modules/crypto-browserify/node_modules/public-encrypt/xor.js new file mode 100644 index 00000000..aca81316 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/public-encrypt/xor.js @@ -0,0 +1,8 @@ +module.exports = function xor(a, b) { + var len = a.length; + var i = -1; + while (++i < len) { + a[i] ^= b[i]; + } + return a +}; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/randombytes/browser.js b/node_modules/crypto-browserify/node_modules/randombytes/browser.js new file mode 100644 index 00000000..1a6e3e3c --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/randombytes/browser.js @@ -0,0 +1,28 @@ +'use strict'; + +var crypto = global.crypto || global.msCrypto +if(crypto && crypto.getRandomValues) { + module.exports = randomBytes; +} else { + module.exports = oldBrowser; +} +function randomBytes(size, cb) { + var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array + /* This will not work in older browsers. + * See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues + */ + + crypto.getRandomValues(bytes); + if (typeof cb === 'function') { + return process.nextTick(function () { + cb(null, bytes); + }); + } + return bytes; +} +function oldBrowser() { + throw new Error( + 'secure random number generation not supported by this browser\n'+ + 'use chrome, FireFox or Internet Explorer 11' + ) +} diff --git a/node_modules/crypto-browserify/node_modules/randombytes/index.js b/node_modules/crypto-browserify/node_modules/randombytes/index.js new file mode 100644 index 00000000..ccdab3f8 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/randombytes/index.js @@ -0,0 +1 @@ +module.exports = require('crypto').randomBytes; \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/randombytes/package.json b/node_modules/crypto-browserify/node_modules/randombytes/package.json new file mode 100644 index 00000000..4287ae45 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/randombytes/package.json @@ -0,0 +1,63 @@ +{ + "name": "randombytes", + "version": "2.0.1", + "description": "random bytes from browserify stand alone", + "main": "index.js", + "scripts": { + "test": "node test.js | tspec" + }, + "repository": { + "type": "git", + "url": "git@github.com:crypto-browserify/randombytes.git" + }, + "keywords": [ + "crypto", + "random" + ], + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/crypto-browserify/randombytes/issues" + }, + "homepage": "https://github.com/crypto-browserify/randombytes", + "browser": "browser.js", + "devDependencies": { + "tap-spec": "^2.1.2", + "tape": "^3.0.3" + }, + "gitHead": "849c4a44af3275dd1fa5ae221e5e87304b43e165", + "_id": "randombytes@2.0.1", + "_shasum": "18f4a9ba0dd07bdb1580bc9156091fcf90eabc6f", + "_from": "randombytes@>=2.0.0 <3.0.0", + "_npmVersion": "2.2.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "dcousens", + "email": "email@dcousens.com" + }, + "maintainers": [ + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "jp", + "email": "jprichardson@gmail.com" + } + ], + "dist": { + "shasum": "18f4a9ba0dd07bdb1580bc9156091fcf90eabc6f", + "tarball": "http://registry.npmjs.org/randombytes/-/randombytes-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/node_modules/randombytes/readme.md b/node_modules/crypto-browserify/node_modules/randombytes/readme.md new file mode 100644 index 00000000..01e36fc7 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/randombytes/readme.md @@ -0,0 +1,12 @@ +randombytes +=== + +randombytes from node that works in the browser. In node you just get crypto.randomBytes, but in the browser it uses .crypto/msCrypto.getRandomValues + +```js +var randomBytes = require('randombytes'); +randomBytes(16);//get 16 random bytes +randomBytes(16, function (err, resp) { + // resp is 16 random bytes +}); +``` \ No newline at end of file diff --git a/node_modules/crypto-browserify/node_modules/randombytes/test.js b/node_modules/crypto-browserify/node_modules/randombytes/test.js new file mode 100644 index 00000000..5a6648c9 --- /dev/null +++ b/node_modules/crypto-browserify/node_modules/randombytes/test.js @@ -0,0 +1,33 @@ +var test = require("tape"); +var randomBytes = require('./'); + +test('sync', function (t) { + t.plan(3); + t.equals(randomBytes(3).length, 3, 'len: ' + 3); + t.equals(randomBytes(30).length, 30, 'len: ' + 30); + t.equals(randomBytes(300).length, 300, 'len: ' + 300); +}); +test('async', function (t) { + t.plan(3); + randomBytes(3, function (err, resp) { + t.equals(resp.length, 3, 'len: ' + 3); + }); + randomBytes(30, function (err, resp) { + t.equals(resp.length, 30, 'len: ' + 30); + }); + randomBytes(300, function (err, resp) { + t.equals(resp.length, 300, 'len: ' + 300); + }); +}); +if (process.browser) { + test('requesting to much throws', function (t) { + t.plan(1); + t.throws(randomBytes.bind(null, 65537)); + }); + test('requesting to much throws async', function (t) { + t.plan(1); + t.throws(randomBytes.bind(null, 65537, function () { + t.ok(false, 'should not get here'); + })); + }); +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/package.json b/node_modules/crypto-browserify/package.json new file mode 100644 index 00000000..7ba29e03 --- /dev/null +++ b/node_modules/crypto-browserify/package.json @@ -0,0 +1,85 @@ +{ + "author": { + "name": "Dominic Tarr", + "email": "dominic.tarr@gmail.com", + "url": "dominictarr.com" + }, + "name": "crypto-browserify", + "description": "implementation of crypto for the browser", + "version": "3.9.14", + "homepage": "https://github.com/crypto-browserify/crypto-browserify", + "repository": { + "type": "git", + "url": "git://github.com/crypto-browserify/crypto-browserify.git" + }, + "scripts": { + "test": "set -e; for t in test/node/*.js test/*.js; do node $t; done", + "prepublish": "npm ls && npm test" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "browserify-aes": "^1.0.0", + "browserify-sign": "^3.0.1", + "create-ecdh": "^2.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^3.0.1", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^2.0.0", + "randombytes": "^2.0.0" + }, + "devDependencies": { + "tape": "~2.3.2", + "hash-test-vectors": "~1.3.2" + }, + "optionalDependencies": {}, + "browser": { + "crypto": false + }, + "license": "MIT", + "gitHead": "7ac9b42974526f0b7fe1714c1dac970eb7c0ef3c", + "bugs": { + "url": "https://github.com/crypto-browserify/crypto-browserify/issues" + }, + "_id": "crypto-browserify@3.9.14", + "_shasum": "d69925252c845392714aed1460c54b56605314ab", + "_from": "crypto-browserify@3.9.14", + "_npmVersion": "2.7.0", + "_nodeVersion": "1.6.2", + "_npmUser": { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + "maintainers": [ + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + { + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" + }, + { + "name": "dcousens", + "email": "email@dcousens.com" + }, + { + "name": "jprichardson", + "email": "jprichardson@gmail.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "d69925252c845392714aed1460c54b56605314ab", + "tarball": "http://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.9.14.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.9.14.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/crypto-browserify/readme.markdown b/node_modules/crypto-browserify/readme.markdown new file mode 100644 index 00000000..336447ca --- /dev/null +++ b/node_modules/crypto-browserify/readme.markdown @@ -0,0 +1,49 @@ +# crypto-browserify + +A port of node's `crypto` module to the browser. + +[![travis](https://img.shields.io/travis/crypto-browserify/crypto-browserify/master.svg?style=flat)](https://travis-ci.org/crypto-browserify/crypto-browserify) + +The goal of this module is to reimplement node's crypto module, +in pure javascript so that it can run in the browser. + +Here is the subset that is currently implemented: + +* createHash (sha1, sha224, sha256, sha384, sha512, md5, rmd160) +* createHmac (sha1, sha224, sha256, sha384, sha512, md5, rmd160) +* pbkdf2 +* pbkdf2Sync +* randomBytes +* pseudoRandomBytes +* createCipher (aes) +* createDecipher (aes) +* createDiffieHellman +* createSign (rsa, ecdsa) +* createVerify (rsa, ecdsa) +* createECDH (secp256k1) +* publicEncrypt/privateDecrypt (rsa) + +## todo + +these features from node's `crypto` are still unimplemented. + +* createCredentials + +## contributions + +If you are interested in writing a feature, please implement as a new module, +which will be incorporated into crypto-browserify as a dependency. + +All deps must be compatible with node's crypto +(generate example inputs and outputs with node, +and save base64 strings inside JSON, so that tests can run in the browser. +see [sha.js](https://github.com/dominictarr/sha.js) + +Crypto is _extra serious_ so please do not hesitate to review the code, +and post comments if you do. + +## License + +MIT + + diff --git a/node_modules/crypto-browserify/test/aes.js b/node_modules/crypto-browserify/test/aes.js new file mode 100644 index 00000000..206ddd7d --- /dev/null +++ b/node_modules/crypto-browserify/test/aes.js @@ -0,0 +1,41 @@ +var test = require('tape'); +var crypto = require('browserify-aes/browser'); +var randomBytes = require('randombytes'); +test('ciphers', function (t) { + crypto.listCiphers().forEach(function (cipher) { + t.test(cipher, function (t) { + t.plan(1); + var data = randomBytes(562); + var password = randomBytes(20); + var crypter = crypto.createCipher(cipher, password); + var decrypter = crypto.createDecipher(cipher, password); + var out = []; + out.push(decrypter.update(crypter.update(data))); + out.push(decrypter.update(crypter.final())); + if (cipher.indexOf('gcm') > -1) { + decrypter.setAuthTag(crypter.getAuthTag()); + } + out.push(decrypter.final()); + t.equals(data.toString('hex'), Buffer.concat(out).toString('hex')); + }); + }); +}); +test('getCiphers', function (t) { + t.plan(1); + t.ok(crypto.getCiphers().length, 'get ciphers returns an array'); +}); +test('through crypto browserify works', function (t) { + t.plan(2); + var crypto = require('../'); + var cipher = 'aes-128-ctr'; + var data = randomBytes(562); + var password = randomBytes(20); + var crypter = crypto.createCipher(cipher, password); + var decrypter = crypto.createDecipher(cipher, password); + var out = []; + out.push(decrypter.update(crypter.update(data))); + out.push(decrypter.update(crypter.final())); + out.push(decrypter.final()); + t.equals(data.toString('hex'), Buffer.concat(out).toString('hex')); + t.ok(crypto.getCiphers().length, 'get ciphers returns an array'); +}); \ No newline at end of file diff --git a/node_modules/crypto-browserify/test/create-hash.js b/node_modules/crypto-browserify/test/create-hash.js new file mode 100644 index 00000000..6912ff7b --- /dev/null +++ b/node_modules/crypto-browserify/test/create-hash.js @@ -0,0 +1,41 @@ +var fs = require('fs') +var test = require('tape') + +var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'] +var encodings = [/*'binary',*/ 'hex', 'base64']; +var vectors = require('hash-test-vectors') +testLib('createHash in crypto-browserify',require('../').createHash); +testLib('create-hash/browser',require('create-hash/browser')); +function testLib(name, createHash) { + test(name, function (t){ + algorithms.forEach(function (algorithm) { + t.test('test ' + algorithm + ' against test vectors', function (t) { + vectors.forEach(function (obj, i) { + var input = new Buffer(obj.input, 'base64') + var node = obj[algorithm] + var js = createHash(algorithm).update(input).digest('hex') + t.equal(js, node, algorithm + '(testVector['+i+']) == ' + node) + }) + + encodings.forEach(function (encoding) { + vectors.forEach(function (obj, i) { + var input = new Buffer(obj.input, 'base64').toString(encoding) + var node = obj[algorithm] + var js = createHash(algorithm).update(input, encoding).digest('hex') + t.equal(js, node, algorithm + '(testVector['+i+'], '+encoding+') == ' + node) + }) + }); + vectors.forEach(function (obj, i) { + var input = new Buffer(obj.input, 'base64') + var node = obj[algorithm] + var hash = createHash(algorithm); + hash.end(input) + var js = hash.read().toString('hex') + t.equal(js, node, algorithm + '(testVector['+i+']) == ' + node) + }) + t.end() + }) + }); + + }); +} \ No newline at end of file diff --git a/node_modules/crypto-browserify/test/create-hmac.js b/node_modules/crypto-browserify/test/create-hmac.js new file mode 100644 index 00000000..814b5734 --- /dev/null +++ b/node_modules/crypto-browserify/test/create-hmac.js @@ -0,0 +1,39 @@ + +var test = require('tape') + +var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'] +var vectors = require('hash-test-vectors/hmac') +testLib('createHmac in crypto-browserify',require('../').createHmac); +testLib('create-hmac/browser',require('create-hmac/browser')); +function testLib(name, createHmac) { + test(name, function (t){ + algorithms.forEach(function (alg) { + + t.test('hmac('+alg+')', function (t) { + vectors.forEach(function (input, i) { + var output = createHmac(alg, new Buffer(input.key, 'hex')) + .update(input.data, 'hex').digest() + + output = input.truncate ? output.slice(0, input.truncate) : output + t.equal(output.toString('hex'), input[alg]) + }) + t.end() + }) + + t.test('hmac('+alg+')', function (t) { + vectors.forEach(function (input, i) { + var hmac = createHmac(alg, new Buffer(input.key, 'hex')) + + hmac.end(input.data, 'hex') + var output = hmac.read() + + output = input.truncate ? output.slice(0, input.truncate) : output + t.equal(output.toString('hex'), input[alg]) + }) + t.end() + }) + + }) + }) + +} diff --git a/node_modules/crypto-browserify/test/dh.js b/node_modules/crypto-browserify/test/dh.js new file mode 100644 index 00000000..8ce85d61 --- /dev/null +++ b/node_modules/crypto-browserify/test/dh.js @@ -0,0 +1,47 @@ +var test = require('tape'); +var crypto = require('diffie-hellman/browser'); +test('diffie-hellman mod groups', function (t) { + [ + 'modp1', 'modp2', 'modp5', 'modp14', 'modp15', 'modp16' + ].forEach(function (mod) { + t.test(mod, function (t){ + t.plan(3); + var dh1 = crypto.getDiffieHellman(mod); + var p1 = dh1.getPrime().toString('hex'); + dh1.generateKeys(); + var dh2 = crypto.getDiffieHellman(mod); + var p2 = dh2.getPrime().toString('hex'); + dh2.generateKeys(); + t.equals(p1, p2, 'equal primes'); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.notEquals(pubk1, pubk2, 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(dh1.getPublicKey()).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + }); +}); +test('diffie-hellman key lengths', function (t) { + [ + 64, 65, 192 + ].forEach(function (len) { + t.test('' + len, function (t){ + t.plan(3); + var dh2 = crypto.createDiffieHellman(len); + var prime2 = dh2.getPrime(); + var p2 = prime2.toString('hex'); + var dh1 = crypto.createDiffieHellman(prime2); + var p1 = dh1.getPrime().toString('hex'); + dh1.generateKeys(); + dh2.generateKeys(); + t.equals(p1, p2, 'equal primes'); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.notEquals(pubk1, pubk2, 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(dh1.getPublicKey()).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + }); +}); diff --git a/node_modules/crypto-browserify/test/ecdh.js b/node_modules/crypto-browserify/test/ecdh.js new file mode 100644 index 00000000..0a11e8eb --- /dev/null +++ b/node_modules/crypto-browserify/test/ecdh.js @@ -0,0 +1,59 @@ +var mods = [ + 'secp256k1', + 'secp224r1', + 'prime256v1', + 'prime192v1' +]; +var test = require('tape'); +var createECDH1 = require('../').createECDH; +var createECDH2 = require('create-ecdh/browser'); +test('createECDH', function (t) { +mods.forEach(function (mod) { + t.test(mod + ' uncompressed', function (t){ + t.plan(2); + var dh1 = createECDH1(mod); + dh1.generateKeys(); + var dh2 = createECDH2(mod); + dh2.generateKeys(); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.notEquals(pubk1.toString('hex'), pubk2.toString('hex'), 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(pubk1).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + t.test(mod + ' compressed', function (t){ + t.plan(2); + var dh1 = createECDH1(mod); + dh1.generateKeys(); + var dh2 = createECDH2(mod); + dh2.generateKeys(); + var pubk1 = dh1.getPublicKey(null, 'compressed'); + var pubk2 = dh2.getPublicKey(null, 'compressed'); + t.notEquals(pubk1.toString('hex'), pubk2.toString('hex'), 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(pubk1).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + t.test(mod + ' set stuff', function (t){ + t.plan(5); + var dh1 = createECDH1(mod); + var dh2 = createECDH2(mod); + dh1.generateKeys(); + dh2.generateKeys(); + dh1.setPrivateKey(dh2.getPrivateKey()); + dh1.setPublicKey(dh2.getPublicKey()); + var priv1 = dh1.getPrivateKey('hex'); + var priv2 = dh2.getPrivateKey('hex'); + t.equals(priv1, priv2, 'same private key'); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.equals(pubk1.toString('hex'), pubk2.toString('hex'), 'same public keys, uncompressed'); + t.equals(dh1.getPublicKey('hex', 'compressed'), dh2.getPublicKey('hex', 'compressed'), 'same public keys compressed'); + t.equals(dh1.getPublicKey('hex', 'hybrid'), dh2.getPublicKey('hex', 'hybrid'), 'same public keys hybrid'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(pubk1).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + }); +}); \ No newline at end of file diff --git a/node_modules/crypto-browserify/test/node/dh.js b/node_modules/crypto-browserify/test/node/dh.js new file mode 100644 index 00000000..139a9239 --- /dev/null +++ b/node_modules/crypto-browserify/test/node/dh.js @@ -0,0 +1,51 @@ +var test = require('tape'); +var cryptoB = require('../../'); +var crypto = require('crypto') + +test('diffie-hellman mod groups', function (t) { + [ + 'modp1', 'modp2', 'modp5', 'modp14', 'modp15', 'modp16' + ].forEach(function (mod) { + t.test(mod, function (t){ + t.plan(3); + var dh1 = cryptoB.getDiffieHellman(mod); + var p1 = dh1.getPrime().toString('hex'); + dh1.generateKeys(); + + var dh2 = crypto.getDiffieHellman(mod); + var p2 = dh2.getPrime().toString('hex'); + dh2.generateKeys(); + t.equals(p1, p2, 'equal primes'); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.notEquals(pubk1, pubk2, 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(pubk1).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + }); +}); + +test('diffie-hellman key lengths', function (t) { + [ + 64, 65, 192 + ].forEach(function (len) { + t.test('' + len, function (t){ + t.plan(3); + var dh2 = cryptoB.createDiffieHellman(len); + var prime2 = dh2.getPrime(); + var p2 = prime2.toString('hex'); + var dh1 = crypto.createDiffieHellman(prime2); + var p1 = dh1.getPrime().toString('hex'); + dh1.generateKeys(); + dh2.generateKeys(); + t.equals(p1, p2, 'equal primes'); + var pubk1 = dh1.getPublicKey(); + var pubk2 = dh2.getPublicKey(); + t.notEquals(pubk1, pubk2, 'diff public keys'); + var pub1 = dh1.computeSecret(pubk2).toString('hex'); + var pub2 = dh2.computeSecret(dh1.getPublicKey()).toString('hex'); + t.equals(pub1, pub2, 'equal secrets'); + }); + }); +}); diff --git a/node_modules/crypto-browserify/test/pbkdf2.js b/node_modules/crypto-browserify/test/pbkdf2.js new file mode 100644 index 00000000..c86dc87c --- /dev/null +++ b/node_modules/crypto-browserify/test/pbkdf2.js @@ -0,0 +1,23 @@ + +var tape = require('tape') +var crypto = require('pbkdf2/browser') + +var vectors = require('hash-test-vectors/pbkdf2') + +tape('pbkdf2', function (t) { + vectors.forEach(function (input) { + //skip inputs that will take way too long + if(input.iterations > 10000) return + + var key = crypto.pbkdf2Sync(input.password, input.salt, input.iterations, input.length) + + if(key.toString('hex') !== input.sha1) + console.log(input) + + t.equal(key.toString('hex'), input.sha1) + + + }) + + t.end() +}) diff --git a/node_modules/crypto-browserify/test/public-encrypt.js b/node_modules/crypto-browserify/test/public-encrypt.js new file mode 100644 index 00000000..927c0f59 --- /dev/null +++ b/node_modules/crypto-browserify/test/public-encrypt.js @@ -0,0 +1,37 @@ +var test = require('tape'); +var crypto1 = require('../'); +var rsa = { + "private": "2d2d2d2d2d424547494e205253412050524956415445204b45592d2d2d2d2d0a4d4949456a77494241414b422f6779376d6a615767506546645659445a5752434139424e69763370506230657332372b464b593068737a4c614f7734374578430a744157704473483438545841667948425977424c67756179666b344c4749757078622b43474d62526f337845703043626659314a62793236543976476a5243310a666f484444554a4738347561526279487161663469367a74346756522b786c4145496a6b614641414b38634f6f58415431435671474c4c6c6a554363684c38500a6a61486a2f7972695a2f53377264776c49334c6e41427877776d4c726d522f7637315774706d4f2f614e47384e2b31706f2b5177616768546b79513539452f5a0a7641754f6b4657486f6b32712f523650594161326a645a397a696d3046714f502b6e6b5161454452624246426d4271547635664647666b32577341664b662f520a47302f5646642b5a654d353235315465547658483639356e6c53476175566c3941674d42414145436766344c725748592f6c35346f7554685a577676627275670a70667a36734a583267396c3779586d576c455773504543566f2f375355627059467074364f5a7939397a53672b494b624771574b6664686f4b725477495674430a4c30595a304e6c6d646e414e53497a30726f785147375a786b4c352b764853772f506d443978345577662b437a38684154436d4e42763171633630646b7975570a34434c71653732716154695657526f4f316961675167684e634c6f6f36765379363545784c614344545068613779753276773468465a705769456a57346478660a7246644c696978353242433836596c416c784d452f724c6738494a5676696c62796f39615764586d784f6155544c527636506b4644312f6756647738563951720a534c4e39466c4b326b6b6a695830647a6f6962765a7733744d6e74337979644178305838372b734d5256616843316270336b56507a3448793045575834514a2f0a504d33317647697549546b324e43643531445874314c746e324f503546614a536d4361456a6830586b5534716f7559796a585774384275364254436c327675610a466730556a6939432b496b504c6d61554d624d494f7761546b386357714c74685378734c6537304a354f6b477267664b554d2f772b4248483150742f506a7a6a0a432b2b6c306b6946614f5644566141563947704c504c43426f4b2f50433952622f72784d4d6f43434e774a2f4e5a756564496e793277334c4d69693737682f540a7a53766572674e47686a5936526e7661386c4c584a36646c726b6350417970733367577778716a344e5230542b474d3062445550564c62374d303758563753580a7637564a476d35324a625247774d3173732b72385854544e656d65476b2b5752784737546774734d715947584c66423851786b2f66352f4d63633030546c38750a7758464e7366784a786d7436416273547233673336774a2f49684f6e69627a3941642b6e63686c426e4e3351655733434b48717a61523138766f717674566d320a6b4a66484b31357072482f7353476d786d6945476772434a545a78744462614e434f372f56426a6e4b756455554968434177734c747571302f7a7562397641640a384731736366497076357161534e7a6d4b6f5838624f77417276725336775037794b726354737557496c484438724a5649374945446e516f5470354738664b310a68774a2f4d4968384d35763072356455594576366f494a5747636c65364148314a6d73503557496166677137325a32323838704863434648774e59384467394a0a3736517377564c6e556850546c6d6d33454f4f50474574616d32694144357230416679746c62346c624e6f51736a32737a65584f4e4458422b366f7565616a680a564e454c55723848635350356c677a525a6a4a57366146497a6a394c44526d516e55414f6a475358564f517445774a2f4d43515a374e2f763464494b654452410a3864385545785a332b674748756d7a697a7447524a30745172795a483250616b50354937562b316c377145556e4a3263336d462b65317634314570394c4376680a627a72504b773964786831386734622b37624d707357506e7372614b6836697078633761614f615a5630447867657a347a635a753050316f6c4f30634e334b4d0a6e784a305064733352386241684e43446453324a5a61527035513d3d0a2d2d2d2d2d454e44205253412050524956415445204b45592d2d2d2d2d0a", + "public": "2d2d2d2d2d424547494e20525341205055424c4943204b45592d2d2d2d2d0a4d49494242674b422f6779376d6a615767506546645659445a5752434139424e69763370506230657332372b464b593068737a4c614f773437457843744157700a4473483438545841667948425977424c67756179666b344c4749757078622b43474d62526f337845703043626659314a62793236543976476a524331666f48440a44554a4738347561526279487161663469367a74346756522b786c4145496a6b614641414b38634f6f58415431435671474c4c6c6a554363684c38506a61486a0a2f7972695a2f53377264776c49334c6e41427877776d4c726d522f7637315774706d4f2f614e47384e2b31706f2b5177616768546b79513539452f5a7641754f0a6b4657486f6b32712f523650594161326a645a397a696d3046714f502b6e6b5161454452624246426d4271547635664647666b32577341664b662f5247302f560a46642b5a654d353235315465547658483639356e6c53476175566c3941674d424141453d0a2d2d2d2d2d454e4420525341205055424c4943204b45592d2d2d2d2d0a" +}; +var crypto2 = require('public-encrypt/browser'); +rsa.private = new Buffer(rsa.private, 'hex'); +rsa.public = new Buffer(rsa.public, 'hex'); +var encrypted = '0bcd6462ad7a563be2d42b0b73e0b0a163886304e7723b025f97605144fe1781e84acdc4031327d6bccd67fe13183e8fbdc8c5fe947b49d011ce3ebb08b11e83b87a77328ca57ee77cfdc78743b0749366643d7a21b2abcd4aa32dee9832938445540ee3007b7a70191c8dc9ff2ad76fe8dfaa5362d9d2c4b31a67b816d7b7970a293cb95bf3437a301bedb9f431b7075aa2f9df77b4385bea2a37982beda467260b384a58258b5eb4e36a0e0bf7dff83589636f5f97bf542084f0f76868c9f3f989a27fee5b8cd2bfee0bae1eae958df7c3184e5a40fda101196214f371606feca4330b221f30577804bbd4f61578a84e85dcd298849f509e630d275280'; +test('publicEncrypt/privateDecrypt', function (t) { + t.test('can decrypt', function (t) { + t.plan(2); + // note encryption is ranomized so can't test to see if they encrypt the same + t.equals(crypto1.privateDecrypt(rsa.private, new Buffer(encrypted, 'hex')).toString(), 'hello there I am a nice message', 'decrypt it properly'); + t.equals(crypto2.privateDecrypt(rsa.private, new Buffer(encrypted, 'hex')).toString(), 'hello there I am a nice message', 'decrypt it properly'); + + }); + t.test('can round trip', function (t) { + t.plan(2); + var msg = 'this is a message'; + // note encryption is ranomized so can't test to see if they encrypt the same + t.equals(crypto1.privateDecrypt(rsa.private, crypto2.publicEncrypt(rsa.public, new Buffer(msg))).toString(), msg, 'round trip it'); + t.equals(crypto2.privateDecrypt(rsa.private, crypto1.publicEncrypt(rsa.public, new Buffer(msg))).toString(), msg, 'round trip it'); + + }); +}); +test('privateEncrypt/publicDecrypt', function (t) { + t.test('can round trip', function (t) { + t.plan(2); + var msg = 'this is a message'; + // note encryption is ranomized so can't test to see if they encrypt the same + t.equals(crypto1.publicDecrypt(rsa.public, crypto2.privateEncrypt(rsa.private, new Buffer(msg))).toString(), msg, 'round trip it'); + t.equals(crypto2.publicDecrypt(rsa.public, crypto1.privateEncrypt(rsa.private, new Buffer(msg))).toString(), msg, 'round trip it'); + + }); +}); \ No newline at end of file diff --git a/node_modules/crypto-browserify/test/random-bytes.js b/node_modules/crypto-browserify/test/random-bytes.js new file mode 100644 index 00000000..0ee2f93a --- /dev/null +++ b/node_modules/crypto-browserify/test/random-bytes.js @@ -0,0 +1,62 @@ +var test = require('tape') +var crypto = require('../') +var randomBytes = require('randombytes') +var randomBytesFunctions = { + randomBytes: randomBytes, + pseudoRandomBytes: crypto.pseudoRandomBytes +} +for (var randomBytesName in randomBytesFunctions) { + // Both randomBytes and pseudoRandomBytes should provide the same interface + var randomBytes = randomBytesFunctions[randomBytesName]; + test('get error message', function (t) { + + try { + var b = randomBytes(10) + t.ok(Buffer.isBuffer(b)) + t.end() + } catch (err) { + t.ok(/not supported/.test(err.message), '"not supported" is in error message') + t.end() + } + + }) + + test(randomBytesName, function (t) { + t.plan(5); + t.equal(randomBytes(10).length, 10); + t.ok(Buffer.isBuffer(randomBytes(10))) + randomBytes(10, function(ex, bytes) { + t.error(ex); + t.equal(bytes.length, 10); + t.ok(Buffer.isBuffer(bytes)) + t.end(); + }); + }); + + test(randomBytesName + ' seem random', function (t) { + + var L = 1000 + var b = randomBytes(L) + + var mean = [].reduce.call(b, function (a, b) { return a + b}, 0) / L + + // test that the random numbers are plausably random. + // Math.random() will pass this, but this will catch + // terrible mistakes such as this blunder: + // https://github.com/dominictarr/crypto-browserify/commit/3267955e1df7edd1680e52aeede9a89506ed2464#commitcomment-7916835 + + // this doesn't check that the bytes are in a random *order* + // but it's better than nothing. + + var expected = 256/2 + var smean = Math.sqrt(mean) + //console.log doesn't work right on testling, *grumble grumble* + console.log(JSON.stringify([expected - smean, mean, expected + smean])) + t.ok(mean < expected + smean) + t.ok(mean > expected - smean) + + t.end() + + }) +} + diff --git a/node_modules/crypto-browserify/test/sign.js b/node_modules/crypto-browserify/test/sign.js new file mode 100644 index 00000000..39b0ef12 --- /dev/null +++ b/node_modules/crypto-browserify/test/sign.js @@ -0,0 +1,53 @@ +var test = require('tape'); +var nodeCrypto = require('../'); +var ourCrypto = require('browserify-sign/browser'); + +var rsa = { + "private": "2d2d2d2d2d424547494e205253412050524956415445204b45592d2d2d2d2d0a4d4949456a77494241414b422f6779376d6a615767506546645659445a5752434139424e69763370506230657332372b464b593068737a4c614f7734374578430a744157704473483438545841667948425977424c67756179666b344c4749757078622b43474d62526f337845703043626659314a62793236543976476a5243310a666f484444554a4738347561526279487161663469367a74346756522b786c4145496a6b614641414b38634f6f58415431435671474c4c6c6a554363684c38500a6a61486a2f7972695a2f53377264776c49334c6e41427877776d4c726d522f7637315774706d4f2f614e47384e2b31706f2b5177616768546b79513539452f5a0a7641754f6b4657486f6b32712f523650594161326a645a397a696d3046714f502b6e6b5161454452624246426d4271547635664647666b32577341664b662f520a47302f5646642b5a654d353235315465547658483639356e6c53476175566c3941674d42414145436766344c725748592f6c35346f7554685a577676627275670a70667a36734a583267396c3779586d576c455773504543566f2f375355627059467074364f5a7939397a53672b494b624771574b6664686f4b725477495674430a4c30595a304e6c6d646e414e53497a30726f785147375a786b4c352b764853772f506d443978345577662b437a38684154436d4e42763171633630646b7975570a34434c71653732716154695657526f4f316961675167684e634c6f6f36765379363545784c614344545068613779753276773468465a705769456a57346478660a7246644c696978353242433836596c416c784d452f724c6738494a5676696c62796f39615764586d784f6155544c527636506b4644312f6756647738563951720a534c4e39466c4b326b6b6a695830647a6f6962765a7733744d6e74337979644178305838372b734d5256616843316270336b56507a3448793045575834514a2f0a504d33317647697549546b324e43643531445874314c746e324f503546614a536d4361456a6830586b5534716f7559796a585774384275364254436c327675610a466730556a6939432b496b504c6d61554d624d494f7761546b386357714c74685378734c6537304a354f6b477267664b554d2f772b4248483150742f506a7a6a0a432b2b6c306b6946614f5644566141563947704c504c43426f4b2f50433952622f72784d4d6f43434e774a2f4e5a756564496e793277334c4d69693737682f540a7a53766572674e47686a5936526e7661386c4c584a36646c726b6350417970733367577778716a344e5230542b474d3062445550564c62374d303758563753580a7637564a476d35324a625247774d3173732b72385854544e656d65476b2b5752784737546774734d715947584c66423851786b2f66352f4d63633030546c38750a7758464e7366784a786d7436416273547233673336774a2f49684f6e69627a3941642b6e63686c426e4e3351655733434b48717a61523138766f717674566d320a6b4a66484b31357072482f7353476d786d6945476772434a545a78744462614e434f372f56426a6e4b756455554968434177734c747571302f7a7562397641640a384731736366497076357161534e7a6d4b6f5838624f77417276725336775037794b726354737557496c484438724a5649374945446e516f5470354738664b310a68774a2f4d4968384d35763072356455594576366f494a5747636c65364148314a6d73503557496166677137325a32323838704863434648774e59384467394a0a3736517377564c6e556850546c6d6d33454f4f50474574616d32694144357230416679746c62346c624e6f51736a32737a65584f4e4458422b366f7565616a680a564e454c55723848635350356c677a525a6a4a57366146497a6a394c44526d516e55414f6a475358564f517445774a2f4d43515a374e2f763464494b654452410a3864385545785a332b674748756d7a697a7447524a30745172795a483250616b50354937562b316c377145556e4a3263336d462b65317634314570394c4376680a627a72504b773964786831386734622b37624d707357506e7372614b6836697078633761614f615a5630447867657a347a635a753050316f6c4f30634e334b4d0a6e784a305064733352386241684e43446453324a5a61527035513d3d0a2d2d2d2d2d454e44205253412050524956415445204b45592d2d2d2d2d0a", + "public": "2d2d2d2d2d424547494e20525341205055424c4943204b45592d2d2d2d2d0a4d49494242674b422f6779376d6a615767506546645659445a5752434139424e69763370506230657332372b464b593068737a4c614f773437457843744157700a4473483438545841667948425977424c67756179666b344c4749757078622b43474d62526f337845703043626659314a62793236543976476a524331666f48440a44554a4738347561526279487161663469367a74346756522b786c4145496a6b614641414b38634f6f58415431435671474c4c6c6a554363684c38506a61486a0a2f7972695a2f53377264776c49334c6e41427877776d4c726d522f7637315774706d4f2f614e47384e2b31706f2b5177616768546b79513539452f5a7641754f0a6b4657486f6b32712f523650594161326a645a397a696d3046714f502b6e6b5161454452624246426d4271547635664647666b32577341664b662f5247302f560a46642b5a654d353235315465547658483639356e6c53476175566c3941674d424141453d0a2d2d2d2d2d454e4420525341205055424c4943204b45592d2d2d2d2d0a" +}; +var ec = { + "private": "2d2d2d2d2d424547494e2045432050524956415445204b45592d2d2d2d2d0a4d485143415145454944463658763853762f2f77475557442b6337383070704772553051645a5743417a78415150515838722f756f416347425375424241414b0a6f55514451674145495a656f7744796c6c73344b2f7766426a4f313862596f37674778386e595152696a6134652f71454d696b4f484a616937676565557265550a7235586b792f4178377332644774656773504e7350674765354d705176673d3d0a2d2d2d2d2d454e442045432050524956415445204b45592d2d2d2d2d0a", + "public": "2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d465977454159484b6f5a497a6a3043415159464b34454541416f4451674145495a656f7744796c6c73344b2f7766426a4f313862596f37674778386e5951520a696a6134652f71454d696b4f484a616937676565557265557235586b792f4178377332644774656773504e7350674765354d705176673d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d0a" +}; + +rsa.private = new Buffer(rsa.private, 'hex'); +rsa.public = new Buffer(rsa.public, 'hex'); +ec.private = new Buffer(ec.private, 'hex'); +ec.public = new Buffer(ec.public, 'hex'); +function testit(keys, message, scheme) { + var pub = keys.public; + var priv = keys.private; + test(message.toString(), function (t) { + t.test('js sign and verify', function (t) { + t.plan(t); + var mySign = ourCrypto.createSign(scheme); + var mySig = mySign.update(message).sign(priv); + var myVer = ourCrypto.createVerify(scheme); + t.ok(myVer.update(message).verify(pub, mySig), 'validates'); + }); + t.test('node sign and verify', function (t) { + t.plan(t); + var mySign = nodeCrypto.createSign(scheme); + var mySig = mySign.update(message).sign(priv); + var myVer = nodeCrypto.createVerify(scheme); + t.ok(myVer.update(message).verify(pub, mySig), 'validates'); + }); + t.test('node sign and js verify', function (t) { + t.plan(t); + var mySign = nodeCrypto.createSign(scheme); + var mySig = mySign.update(message).sign(priv); + var myVer = ourCrypto.createVerify(scheme); + t.ok(myVer.update(message).verify(pub, mySig), 'validates'); + }); + t.test('js sign and node verify', function (t) { + t.plan(t); + var mySign = ourCrypto.createSign(scheme); + var mySig = mySign.update(message).sign(priv); + var myVer = nodeCrypto.createVerify(scheme); + t.ok(myVer.update(message).verify(pub, mySig), 'validates'); + }); + }); +} +testit(rsa, new Buffer('rsa with sha256'), 'RSA-SHA256'); +testit(ec, new Buffer('ec with sha1'), 'ecdsa-with-SHA1'); diff --git a/node_modules/debug/.jshintrc b/node_modules/debug/.jshintrc new file mode 100644 index 00000000..299877f2 --- /dev/null +++ b/node_modules/debug/.jshintrc @@ -0,0 +1,3 @@ +{ + "laxbreak": true +} diff --git a/node_modules/debug/.npmignore b/node_modules/debug/.npmignore new file mode 100644 index 00000000..7e6163db --- /dev/null +++ b/node_modules/debug/.npmignore @@ -0,0 +1,6 @@ +support +test +examples +example +*.sock +dist diff --git a/node_modules/debug/History.md b/node_modules/debug/History.md new file mode 100644 index 00000000..854c9711 --- /dev/null +++ b/node_modules/debug/History.md @@ -0,0 +1,195 @@ + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/debug/Makefile b/node_modules/debug/Makefile new file mode 100644 index 00000000..5cf4a596 --- /dev/null +++ b/node_modules/debug/Makefile @@ -0,0 +1,36 @@ + +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# applications +NODE ?= $(shell which node) +NPM ?= $(NODE) $(shell which npm) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +all: dist/debug.js + +install: node_modules + +clean: + @rm -rf dist + +dist: + @mkdir -p $@ + +dist/debug.js: node_modules browser.js debug.js dist + @$(BROWSERIFY) \ + --standalone debug \ + . > $@ + +distclean: clean + @rm -rf node_modules + +node_modules: package.json + @NODE_ENV= $(NPM) install + @touch node_modules + +.PHONY: all install clean distclean diff --git a/node_modules/debug/Readme.md b/node_modules/debug/Readme.md new file mode 100644 index 00000000..b4f45e3c --- /dev/null +++ b/node_modules/debug/Readme.md @@ -0,0 +1,188 @@ +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +#### Windows note + + On Windows the environment variable is set using the `set` command. + + ```cmd + set DEBUG=*,-not_this + ``` + +Then, run the program to be debugged as usual. + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: + +```js +window.myDebug = require("debug"); +``` + + ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: + +```js +myDebug.enable("worker:*") +``` + + Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +#### Web Inspector Colors + + Colors are also enabled on "Web Inspectors" that understand the `%c` formatting + option. These are WebKit web inspectors, Firefox ([since version + 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) + and the Firebug plugin for Firefox (any version). + + Colored output looks something like: + + ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) + +### stderr vs stdout + +You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: + +Example _stdout.js_: + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +### Save debug output to a file + +You can save all debug statements to a file by piping them. + +Example: + +```bash +$ DEBUG_FD=3 node your-app.js 3> whatever.log +``` + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + +## License + +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +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/node_modules/debug/bower.json b/node_modules/debug/bower.json new file mode 100644 index 00000000..6af573ff --- /dev/null +++ b/node_modules/debug/bower.json @@ -0,0 +1,28 @@ +{ + "name": "visionmedia-debug", + "main": "dist/debug.js", + "version": "2.2.0", + "homepage": "https://github.com/visionmedia/debug", + "authors": [ + "TJ Holowaychuk " + ], + "description": "visionmedia-debug", + "moduleType": [ + "amd", + "es6", + "globals", + "node" + ], + "keywords": [ + "visionmedia", + "debug" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/debug/browser.js b/node_modules/debug/browser.js new file mode 100644 index 00000000..7c764522 --- /dev/null +++ b/node_modules/debug/browser.js @@ -0,0 +1,168 @@ + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + return JSON.stringify(v); +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} diff --git a/node_modules/debug/component.json b/node_modules/debug/component.json new file mode 100644 index 00000000..ca106372 --- /dev/null +++ b/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "2.2.0", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + } +} diff --git a/node_modules/debug/debug.js b/node_modules/debug/debug.js new file mode 100644 index 00000000..7571a860 --- /dev/null +++ b/node_modules/debug/debug.js @@ -0,0 +1,197 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() { + } + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/debug/node.js b/node_modules/debug/node.js new file mode 100644 index 00000000..1d392a81 --- /dev/null +++ b/node_modules/debug/node.js @@ -0,0 +1,209 @@ + +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); + if (0 === debugColors.length) { + return tty.isatty(fd); + } else { + return '0' !== debugColors + && 'no' !== debugColors + && 'false' !== debugColors + && 'disabled' !== debugColors; + } +} + +/** + * Map %o to `util.inspect()`, since Node doesn't do that out of the box. + */ + +var inspect = (4 === util.inspect.length ? + // node <= 0.8.x + function (v, colors) { + return util.inspect(v, void 0, void 0, colors); + } : + // node > 0.8.x + function (v, colors) { + return util.inspect(v, { colors: colors }); + } +); + +exports.formatters.o = function(v) { + return inspect(v, this.useColors) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + var name = this.namespace; + + if (useColors) { + var c = this.color; + + args[0] = ' \u001b[3' + c + ';1m' + name + ' ' + + '\u001b[0m' + + args[0] + '\u001b[3' + c + 'm' + + ' +' + exports.humanize(this.diff) + '\u001b[0m'; + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } + return args; +} + +/** + * Invokes `console.error()` with the specified arguments. + */ + +function log() { + return stream.write(util.format.apply(this, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = require('fs'); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = require('net'); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/node_modules/debug/node_modules/ms/.npmignore b/node_modules/debug/node_modules/ms/.npmignore new file mode 100644 index 00000000..d1aa0ce4 --- /dev/null +++ b/node_modules/debug/node_modules/ms/.npmignore @@ -0,0 +1,5 @@ +node_modules +test +History.md +Makefile +component.json diff --git a/node_modules/debug/node_modules/ms/History.md b/node_modules/debug/node_modules/ms/History.md new file mode 100644 index 00000000..32fdfc17 --- /dev/null +++ b/node_modules/debug/node_modules/ms/History.md @@ -0,0 +1,66 @@ + +0.7.1 / 2015-04-20 +================== + + * prevent extraordinary long inputs (@evilpacket) + * Fixed broken readme link + +0.7.0 / 2014-11-24 +================== + + * add time abbreviations, updated tests and readme for the new units + * fix example in the readme. + * add LICENSE file + +0.6.2 / 2013-12-05 +================== + + * Adding repository section to package.json to suppress warning from NPM. + +0.6.1 / 2013-05-10 +================== + + * fix singularization [visionmedia] + +0.6.0 / 2013-03-15 +================== + + * fix minutes + +0.5.1 / 2013-02-24 +================== + + * add component namespace + +0.5.0 / 2012-11-09 +================== + + * add short formatting as default and .long option + * add .license property to component.json + * add version to component.json + +0.4.0 / 2012-10-22 +================== + + * add rounding to fix crazy decimals + +0.3.0 / 2012-09-07 +================== + + * fix `ms()` [visionmedia] + +0.2.0 / 2012-09-03 +================== + + * add component.json [visionmedia] + * add days support [visionmedia] + * add hours support [visionmedia] + * add minutes support [visionmedia] + * add seconds support [visionmedia] + * add ms string support [visionmedia] + * refactor tests to facilitate ms(number) [visionmedia] + +0.1.0 / 2012-03-07 +================== + + * Initial release diff --git a/node_modules/debug/node_modules/ms/LICENSE b/node_modules/debug/node_modules/ms/LICENSE new file mode 100644 index 00000000..6c07561b --- /dev/null +++ b/node_modules/debug/node_modules/ms/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch + +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/node_modules/debug/node_modules/ms/README.md b/node_modules/debug/node_modules/ms/README.md new file mode 100644 index 00000000..9b4fd035 --- /dev/null +++ b/node_modules/debug/node_modules/ms/README.md @@ -0,0 +1,35 @@ +# ms.js: miliseconds conversion utility + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('100') // 100 +``` + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as +a number (e.g: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of +equivalent ms is returned. + +## License + +MIT diff --git a/node_modules/debug/node_modules/ms/index.js b/node_modules/debug/node_modules/ms/index.js new file mode 100644 index 00000000..4f927716 --- /dev/null +++ b/node_modules/debug/node_modules/ms/index.js @@ -0,0 +1,125 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/debug/node_modules/ms/package.json b/node_modules/debug/node_modules/ms/package.json new file mode 100644 index 00000000..b12c4a07 --- /dev/null +++ b/node_modules/debug/node_modules/ms/package.json @@ -0,0 +1,47 @@ +{ + "name": "ms", + "version": "0.7.1", + "description": "Tiny ms conversion utility", + "repository": { + "type": "git", + "url": "git://github.com/guille/ms.js.git" + }, + "main": "./index", + "devDependencies": { + "mocha": "*", + "expect.js": "*", + "serve": "*" + }, + "component": { + "scripts": { + "ms/index.js": "index.js" + } + }, + "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", + "bugs": { + "url": "https://github.com/guille/ms.js/issues" + }, + "homepage": "https://github.com/guille/ms.js", + "_id": "ms@0.7.1", + "scripts": {}, + "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "_from": "ms@0.7.1", + "_npmVersion": "2.7.5", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "dist": { + "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz" +} diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json new file mode 100644 index 00000000..d22f5cf7 --- /dev/null +++ b/node_modules/debug/package.json @@ -0,0 +1,72 @@ +{ + "name": "debug", + "version": "2.2.0", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + } + ], + "license": "MIT", + "dependencies": { + "ms": "0.7.1" + }, + "devDependencies": { + "browserify": "9.0.3", + "mocha": "*" + }, + "main": "./node.js", + "browser": "./browser.js", + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" + } + }, + "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@2.2.0", + "scripts": {}, + "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "_from": "debug@2.2.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "tarball": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz" +} diff --git a/node_modules/hat/README.markdown b/node_modules/hat/README.markdown new file mode 100644 index 00000000..2d72768f --- /dev/null +++ b/node_modules/hat/README.markdown @@ -0,0 +1,71 @@ +hat +=== + +Generate random IDs and avoid collisions. + +![hat](http://substack.net/images/hat.png) + +examples +======== + +hat +--- + +````javascript +var hat = require('hat'); + +var id = hat(); +console.log(id); +```` + +output: + +```` +0c82a54f22f775a3ed8b97b2dea74036 +```` + +rack +---- + +````javascript +var hat = require('hat'); +var rack = hat.rack(); + +console.log(rack()); +console.log(rack()); +```` + +output: + +```` +1c24171393dc5de04ffcb21f1182ab28 +fabe2323acc1b559dee43d4a1e16cbeb +```` + +methods +======= + +var hat = require('hat'); + +hat(bits=128, base=16) +---------------------- + +Generate a random ID string with `bits` of data in a `base`. + +Leading zeros are appended such that all outputs for a given number of bits have +equal length. + +var rack = hat.rack(bits=128, base=16, expandBy) +------------------------------------------------ + +Make a new hat rack. Call `rack()` repeatedly to generate new IDs which are +checked for collisions. + +If `expandBy` is specified, increment `bits` by this amount if too many +collisions occur. If `expandBy` isn't specified, `rack()` will throw if too many +collisions occur during generation. + +Optionally call `var id = rack(data)` to store `data` at the new ID. + +You can get the data out again with `rack.get(id)` and set the data with +`rack.set(id, value)`. diff --git a/node_modules/hat/example/hat.js b/node_modules/hat/example/hat.js new file mode 100644 index 00000000..53b29bcb --- /dev/null +++ b/node_modules/hat/example/hat.js @@ -0,0 +1,4 @@ +var hat = require('hat'); + +var id = hat(); +console.log(id); diff --git a/node_modules/hat/example/rack.js b/node_modules/hat/example/rack.js new file mode 100644 index 00000000..9b4efc0f --- /dev/null +++ b/node_modules/hat/example/rack.js @@ -0,0 +1,5 @@ +var hat = require('hat'); +var rack = hat.rack(); + +console.log(rack()); +console.log(rack()); diff --git a/node_modules/hat/index.js b/node_modules/hat/index.js new file mode 100644 index 00000000..5fe0c734 --- /dev/null +++ b/node_modules/hat/index.js @@ -0,0 +1,62 @@ +var hat = module.exports = function (bits, base) { + if (!base) base = 16; + if (bits === undefined) bits = 128; + if (bits <= 0) return '0'; + + var digits = Math.log(Math.pow(2, bits)) / Math.log(base); + for (var i = 2; digits === Infinity; i *= 2) { + digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i; + } + + var rem = digits - Math.floor(digits); + + var res = ''; + + for (var i = 0; i < Math.floor(digits); i++) { + var x = Math.floor(Math.random() * base).toString(base); + res = x + res; + } + + if (rem) { + var b = Math.pow(base, rem); + var x = Math.floor(Math.random() * b).toString(base); + res = x + res; + } + + var parsed = parseInt(res, base); + if (parsed !== Infinity && parsed >= Math.pow(2, bits)) { + return hat(bits, base) + } + else return res; +}; + +hat.rack = function (bits, base, expandBy) { + var fn = function (data) { + var iters = 0; + do { + if (iters ++ > 10) { + if (expandBy) bits += expandBy; + else throw new Error('too many ID collisions, use more bits') + } + + var id = hat(bits, base); + } while (Object.hasOwnProperty.call(hats, id)); + + hats[id] = data; + return id; + }; + var hats = fn.hats = {}; + + fn.get = function (id) { + return fn.hats[id]; + }; + + fn.set = function (id, value) { + fn.hats[id] = value; + return fn; + }; + + fn.bits = bits || 128; + fn.base = base || 16; + return fn; +}; diff --git a/node_modules/hat/package.json b/node_modules/hat/package.json new file mode 100644 index 00000000..2edae4bf --- /dev/null +++ b/node_modules/hat/package.json @@ -0,0 +1,66 @@ +{ + "name": "hat", + "version": "0.0.3", + "description": "generate random IDs and avoid collisions", + "main": "index.js", + "directories": { + "lib": ".", + "example": "example", + "test": "test" + }, + "devDependencies": { + "expresso": "0.7.x" + }, + "scripts": { + "test": "expresso" + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/node-hat.git" + }, + "keywords": [ + "id", + "uid", + "uuid", + "random", + "hat", + "rack", + "unique" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT/X11", + "engine": { + "node": ">=0.4" + }, + "_id": "hat@0.0.3", + "dependencies": {}, + "engines": { + "node": "*" + }, + "_engineSupported": true, + "_npmVersion": "1.0.10", + "_nodeVersion": "v0.5.0-pre", + "_defaultsLoaded": true, + "dist": { + "shasum": "bb014a9e64b3788aed8005917413d4ff3d502d8a", + "tarball": "http://registry.npmjs.org/hat/-/hat-0.0.3.tgz" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "bb014a9e64b3788aed8005917413d4ff3d502d8a", + "_resolved": "https://registry.npmjs.org/hat/-/hat-0.0.3.tgz", + "_from": "hat@0.0.3", + "bugs": { + "url": "https://github.com/substack/node-hat/issues" + }, + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/substack/node-hat" +} diff --git a/node_modules/hat/test/id.js b/node_modules/hat/test/id.js new file mode 100644 index 00000000..b8660ec2 --- /dev/null +++ b/node_modules/hat/test/id.js @@ -0,0 +1,49 @@ +var hat = require('../'); +var assert = require('assert'); + +function digits (bits, base) { + return Math.ceil( + Math.log(parseInt(Array(bits + 1).join('1'), 2) + ) / Math.log(base)); +} + +exports.lengths = function () { + for (var i = 0; i < 10; i++) { + assert.equal(hat(4).length, 1); + } + + for (var i = 0; i < 10; i++) { + assert.equal(hat(3).length, 1); + } + + (function () { + var d = digits(32, 16); + for (var i = 0; i < 10; i++) { + assert.equal(hat(32, 16).length, d); + assert.equal(hat(33, 16).length, d + 1); + } + })(); +}; + +exports.range = function () { + for (var base = 2; base < 32; base++) { + for (var bits = 0; bits < 256; bits += base) { + for (var k = 0; k < 10; k++) { + var id = hat(bits, base); + var iid = parseInt(id, base); + assert.ok(iid >= 0); + assert.ok(iid < Math.pow(2, bits)); + } + } + } +}; + +exports.big = function () { + var id = hat(1024); + assert.equal(id.length, 256); +}; + +exports.bigger = function () { + var id = hat(2048); + assert.equal(id.length, 512); +}; diff --git a/node_modules/hat/test/rack.js b/node_modules/hat/test/rack.js new file mode 100644 index 00000000..92b7ce8f --- /dev/null +++ b/node_modules/hat/test/rack.js @@ -0,0 +1,62 @@ +var hat = require('../'); +var assert = require('assert'); + +exports.rack = function () { + var rack = hat.rack(4); + var seen = {}; + for (var i = 0; i < 8; i++) { + var id = rack(); + assert.ok(!seen[id], 'seen this id'); + seen[id] = true; + + assert.ok(id.match(/^[0-9a-f]$/)); + } + + assert.throws(function () { + for (var i = 0; i < 10; i++) rack() + }); +}; + +exports.data = function () { + var rack = hat.rack(64); + var a = rack('a!'); + var b = rack("it's a b!") + var c = rack([ 'c', 'c', 'c' ]); + + assert.equal(rack.get(a), 'a!'); + assert.equal(rack.get(b), "it's a b!"); + assert.deepEqual(rack.get(c), [ 'c', 'c', 'c' ]); + + assert.equal(rack.hats[a], 'a!'); + assert.equal(rack.hats[b], "it's a b!"); + assert.deepEqual(rack.hats[c], [ 'c', 'c', 'c' ]); + + rack.set(a, 'AAA'); + assert.equal(rack.get(a), 'AAA'); +}; + +exports.expandBy = function () { + var rack = hat.rack(4, 16, 4); + var seen = {}; + + for (var i = 0; i < 8; i++) { + var id = rack(); + assert.ok(!seen[id], 'seen this id'); + seen[id] = true; + assert.ok(id.match(/^[0-9a-f]$/)); + } + + for (var i = 0; i < 8; i++) { + var id = rack(); + assert.ok(!seen[id], 'seen this id'); + seen[id] = true; + assert.ok(id.match(/^[0-9a-f]{1,2}$/)); + } + + for (var i = 0; i < 8; i++) { + var id = rack(); + assert.ok(!seen[id], 'seen this id'); + seen[id] = true; + assert.ok(id.match(/^[0-9a-f]{2}$/)); + } +}; diff --git a/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE new file mode 100644 index 00000000..dea3013d --- /dev/null +++ b/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/inherits/README.md b/node_modules/inherits/README.md new file mode 100644 index 00000000..b1c56658 --- /dev/null +++ b/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js new file mode 100644 index 00000000..29f5e24f --- /dev/null +++ b/node_modules/inherits/inherits.js @@ -0,0 +1 @@ +module.exports = require('util').inherits diff --git a/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js new file mode 100644 index 00000000..c1e78a75 --- /dev/null +++ b/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json new file mode 100644 index 00000000..e4b4ed53 --- /dev/null +++ b/node_modules/inherits/package.json @@ -0,0 +1,50 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.1", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits" + }, + "license": "ISC", + "scripts": { + "test": "node test" + }, + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "_id": "inherits@2.0.1", + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "_from": "inherits@2.0.1", + "_npmVersion": "1.3.8", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/isaacs/inherits" +} diff --git a/node_modules/inherits/test.js b/node_modules/inherits/test.js new file mode 100644 index 00000000..fc53012d --- /dev/null +++ b/node_modules/inherits/test.js @@ -0,0 +1,25 @@ +var inherits = require('./inherits.js') +var assert = require('assert') + +function test(c) { + assert(c.constructor === Child) + assert(c.constructor.super_ === Parent) + assert(Object.getPrototypeOf(c) === Child.prototype) + assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) + assert(c instanceof Child) + assert(c instanceof Parent) +} + +function Child() { + Parent.call(this) + test(this) +} + +function Parent() {} + +inherits(Child, Parent) + +var c = new Child +test(c) + +console.log('ok') diff --git a/node_modules/ip/.npmignore b/node_modules/ip/.npmignore new file mode 100644 index 00000000..1ca95717 --- /dev/null +++ b/node_modules/ip/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log diff --git a/node_modules/ip/README.md b/node_modules/ip/README.md new file mode 100644 index 00000000..40dac318 --- /dev/null +++ b/node_modules/ip/README.md @@ -0,0 +1,68 @@ +# IP +IP address utilities for node.js + +## Usage +Get your ip address, compare ip addresses, validate ip addresses, etc. + +``` +var ip = require('ip'); + +ip.address() // my ip address +ip.isEqual('::1', '::0:1'); // true +ip.toBuffer('127.0.0.1') // Buffer([127, 0, 0, 1]) +ip.toString(new Buffer([127, 0, 0, 1])) // 127.0.0.1 +ip.fromPrefixLen(24) // 255.255.255.0 +ip.mask('192.168.1.134', '255.255.255.0') // 192.168.1.0 +ip.cidr('192.168.1.134/26') // 192.168.1.128 +ip.not('255.255.255.0') // 0.0.0.255 +ip.or('192.168.1.134', '0.0.0.255') // 192.168.1.255 +ip.isPrivate('127.0.0.1') // true + +// operate on buffers in-place +var buf = new Buffer(128); +var offset = 64; +ip.toBuffer('127.0.0.1', buf, offset); // [127, 0, 0, 1] at offset 64 +ip.toString(buf, offset, 4); // '127.0.0.1' + +// subnet information +ip.subnet('192.168.1.134', '255.255.255.192') +// { networkAddress: '192.168.1.128', +// firstAddress: '192.168.1.129', +// lastAddress: '192.168.1.190', +// broadcastAddress: '192.168.1.191', +// subnetMask: '255.255.255.192', +// subnetMaskLength: 26, +// numHosts: 62, +// length: 64 } +ip.cidrSubnet('192.168.1.134/26') +// Same as previous. + +// ipv4 long conversion +ip.toLong('127.0.0.1'); // 2130706433 +ip.fromLong(2130706433); // '127.0.0.1' +``` + +### License + +This software is licensed under the MIT License. + +Copyright Fedor Indutny, 2012. + +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/node_modules/ip/lib/ip.js b/node_modules/ip/lib/ip.js new file mode 100644 index 00000000..d8ecd7dd --- /dev/null +++ b/node_modules/ip/lib/ip.js @@ -0,0 +1,380 @@ +var ip = exports, + Buffer = require('buffer').Buffer, + os = require('os'); + +ip.toBuffer = function toBuffer(ip, buff, offset) { + offset = ~~offset; + + var result; + + if (/^(\d{1,3}\.){3,3}\d{1,3}$/.test(ip)) { + result = buff || new Buffer(offset + 4); + ip.split(/\./g).map(function(byte) { + result[offset++] = parseInt(byte, 10) & 0xff; + }); + } else if (/^[a-f0-9:]+$/.test(ip)) { + var s = ip.split(/::/g, 2), + head = (s[0] || '').split(/:/g, 8), + tail = (s[1] || '').split(/:/g, 8); + + if (tail.length === 0) { + // xxxx:: + while (head.length < 8) head.push('0000'); + } else if (head.length === 0) { + // ::xxxx + while (tail.length < 8) tail.unshift('0000'); + } else { + // xxxx::xxxx + while (head.length + tail.length < 8) head.push('0000'); + } + + result = buff || new Buffer(offset + 16); + head.concat(tail).map(function(word) { + word = parseInt(word, 16); + result[offset++] = (word >> 8) & 0xff; + result[offset++] = word & 0xff; + }); + } else { + throw Error('Invalid ip address: ' + ip); + } + + return result; +}; + +ip.toString = function toString(buff, offset, length) { + offset = ~~offset; + length = length || (buff.length - offset); + + var result = []; + if (length === 4) { + // IPv4 + for (var i = 0; i < length; i++) { + result.push(buff[offset + i]); + } + result = result.join('.'); + } else if (length === 16) { + // IPv6 + for (var i = 0; i < length; i += 2) { + result.push(buff.readUInt16BE(offset + i).toString(16)); + } + result = result.join(':'); + result = result.replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3'); + result = result.replace(/:{3,4}/, '::'); + } + + return result; +}; + +ip.fromPrefixLen = function fromPrefixLen(prefixlen, family) { + if (prefixlen > 32) { + family = 'ipv6'; + } else { + family = _normalizeFamily(family); + } + + var len = 4; + if (family === 'ipv6') { + len = 16; + } + var buff = new Buffer(len); + + for (var i = 0, n = buff.length; i < n; ++i) { + var bits = 8; + if (prefixlen < 8) { + bits = prefixlen; + } + prefixlen -= bits; + + buff[i] = ~(0xff >> bits); + } + + return ip.toString(buff); +}; + +ip.mask = function mask(addr, mask) { + addr = ip.toBuffer(addr); + mask = ip.toBuffer(mask); + + var result = new Buffer(Math.max(addr.length, mask.length)); + + // Same protocol - do bitwise and + if (addr.length === mask.length) { + for (var i = 0; i < addr.length; i++) { + result[i] = addr[i] & mask[i]; + } + } else if (mask.length === 4) { + // IPv6 address and IPv4 mask + // (Mask low bits) + for (var i = 0; i < mask.length; i++) { + result[i] = addr[addr.length - 4 + i] & mask[i]; + } + } else { + // IPv6 mask and IPv4 addr + for (var i = 0; i < result.length - 6; i++) { + result[i] = 0; + } + + // ::ffff:ipv4 + result[10] = 0xff; + result[11] = 0xff; + for (var i = 0; i < addr.length; i++) { + result[i + 12] = addr[i] & mask[i + 12]; + } + } + + return ip.toString(result); +}; + +ip.cidr = function cidr(cidrString) { + var cidrParts = cidrString.split('/'); + + if (cidrParts.length != 2) + throw new Error('invalid CIDR subnet: ' + addr); + + var addr = cidrParts[0]; + var mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10)); + + return ip.mask(addr, mask); +} + +ip.subnet = function subnet(addr, mask) { + var networkAddress = ip.toLong(ip.mask(addr, mask)); + + // Calculate the mask's length. + var maskBuffer = ip.toBuffer(mask); + var maskLength = 0; + + for (var i = 0; i < maskBuffer.length; i++) { + if (maskBuffer[i] == 0xff) { + maskLength += 8; + } else { + var octet = maskBuffer[i] & 0xff; + while (octet) { + octet = (octet << 1) & 0xff; + maskLength++; + } + } + } + + var numberOfAddresses = Math.pow(2, 32 - maskLength); + + return { + networkAddress: ip.fromLong(networkAddress), + firstAddress: numberOfAddresses <= 2 ? + ip.fromLong(networkAddress) : + ip.fromLong(networkAddress + 1), + lastAddress: numberOfAddresses <= 2 ? + ip.fromLong(networkAddress + numberOfAddresses - 1) : + ip.fromLong(networkAddress + numberOfAddresses - 2), + broadcastAddress: ip.fromLong(networkAddress + numberOfAddresses - 1), + subnetMask: mask, + subnetMaskLength: maskLength, + numHosts: numberOfAddresses <= 2 ? + numberOfAddresses : numberOfAddresses - 2, + length: numberOfAddresses + }; +} + +ip.cidrSubnet = function cidrSubnet(cidrString) { + var cidrParts = cidrString.split('/'); + + if (cidrParts.length !== 2) + throw new Error('invalid CIDR subnet: ' + addr); + + var addr = cidrParts[0]; + var mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10)); + + return ip.subnet(addr, mask); +} + +ip.not = function not(addr) { + var buff = ip.toBuffer(addr); + for (var i = 0; i < buff.length; i++) { + buff[i] = 0xff ^ buff[i]; + } + return ip.toString(buff); +}; + +ip.or = function or(a, b) { + a = ip.toBuffer(a); + b = ip.toBuffer(b); + + // same protocol + if (a.length == b.length) { + for (var i = 0; i < a.length; ++i) { + a[i] |= b[i]; + } + return ip.toString(a); + + // mixed protocols + } else { + var buff = a; + var other = b; + if (b.length > a.length) { + buff = b; + other = a; + } + + var offset = buff.length - other.length; + for (var i = offset; i < buff.length; ++i) { + buff[i] |= other[i - offset]; + } + + return ip.toString(buff); + } +}; + +ip.isEqual = function isEqual(a, b) { + a = ip.toBuffer(a); + b = ip.toBuffer(b); + + // Same protocol + if (a.length === b.length) { + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; + } + + // Swap + if (b.length === 4) { + var t = b; + b = a; + a = t; + } + + // a - IPv4, b - IPv6 + for (var i = 0; i < 10; i++) { + if (b[i] !== 0) return false; + } + + var word = b.readUInt16BE(10); + if (word !== 0 && word !== 0xffff) return false; + + for (var i = 0; i < 4; i++) { + if (a[i] !== b[i + 12]) return false; + } + + return true; +}; + +ip.isPrivate = function isPrivate(addr) { + return addr.match(/^10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/) != null || + addr.match(/^192\.168\.([0-9]{1,3})\.([0-9]{1,3})/) != null || + addr.match( + /^172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})/) != null || + addr.match(/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/) != null || + addr.match(/^169\.254\.([0-9]{1,3})\.([0-9]{1,3})/) != null || + addr.match(/^fc00:/) != null || addr.match(/^fe80:/) != null || + addr.match(/^::1$/) != null || addr.match(/^::$/) != null; +}; + +ip.isPublic = function isPublic(addr) { + return !ip.isPrivate(addr); +} + +ip.isLoopback = function isLoopback(addr) { + return /^127\.0\.0\.1$/.test(addr) + || /^fe80::1$/.test(addr) + || /^::1$/.test(addr) + || /^::$/.test(addr); +}; + +ip.loopback = function loopback(family) { + // + // Default to `ipv4` + // + family = _normalizeFamily(family); + + if (family !== 'ipv4' && family !== 'ipv6') { + throw new Error('family must be ipv4 or ipv6'); + } + + return family === 'ipv4' + ? '127.0.0.1' + : 'fe80::1'; +}; + +// +// ### function address (name, family) +// #### @name {string|'public'|'private'} **Optional** Name or security +// of the network interface. +// #### @family {ipv4|ipv6} **Optional** IP family of the address (defaults +// to ipv4). +// +// Returns the address for the network interface on the current system with +// the specified `name`: +// * String: First `family` address of the interface. +// If not found see `undefined`. +// * 'public': the first public ip address of family. +// * 'private': the first private ip address of family. +// * undefined: First address with `ipv4` or loopback addres `127.0.0.1`. +// +ip.address = function address(name, family) { + var interfaces = os.networkInterfaces(), + all; + + // + // Default to `ipv4` + // + family = _normalizeFamily(family); + + // + // If a specific network interface has been named, + // return the address. + // + if (name && !~['public', 'private'].indexOf(name)) { + return interfaces[name].filter(function (details) { + details.family = details.family.toLowerCase(); + return details.family === family; + })[0].address; + } + + var all = Object.keys(interfaces).map(function (nic) { + // + // Note: name will only be `public` or `private` + // when this is called. + // + var addresses = interfaces[nic].filter(function (details) { + details.family = details.family.toLowerCase(); + if (details.family !== family || ip.isLoopback(details.address)) { + return false; + } + else if (!name) { + return true; + } + + return name === 'public' + ? !ip.isPrivate(details.address) + : ip.isPrivate(details.address) + }); + + return addresses.length + ? addresses[0].address + : undefined; + }).filter(Boolean); + + return !all.length + ? ip.loopback(family) + : all[0]; +}; + +ip.toLong = function toInt(ip){ + var ipl=0; + ip.split('.').forEach(function( octet ) { + ipl<<=8; + ipl+=parseInt(octet); + }); + return(ipl >>>0); +}; + +ip.fromLong = function fromInt(ipl){ + return ( (ipl>>>24) +'.' + + (ipl>>16 & 255) +'.' + + (ipl>>8 & 255) +'.' + + (ipl & 255) ); +}; + +function _normalizeFamily(family) { + return family ? family.toLowerCase() : 'ipv4'; +} diff --git a/node_modules/ip/package.json b/node_modules/ip/package.json new file mode 100644 index 00000000..dd39c293 --- /dev/null +++ b/node_modules/ip/package.json @@ -0,0 +1,54 @@ +{ + "name": "ip", + "version": "0.3.2", + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "homepage": "https://github.com/indutny/node-ip", + "repository": { + "type": "git", + "url": "http://github.com/indutny/node-ip.git" + }, + "main": "lib/ip", + "devDependencies": { + "mocha": "~1.3.2" + }, + "scripts": { + "test": "mocha --reporter spec test/*-test.js" + }, + "gitHead": "978e13d19531c9d9172044654df9dfb7ed116e45", + "description": "IP address utilities for node.js", + "bugs": { + "url": "https://github.com/indutny/node-ip/issues" + }, + "_id": "ip@0.3.2", + "_shasum": "7d5ed34326688b36b6ab81f1865ea8266c28f0db", + "_from": "ip@0.3.2", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "maintainers": [ + { + "name": "fedor.indutny", + "email": "fedor.indutny@gmail.com" + }, + { + "name": "mmalecki", + "email": "me@mmalecki.com" + }, + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "dist": { + "shasum": "7d5ed34326688b36b6ab81f1865ea8266c28f0db", + "tarball": "http://registry.npmjs.org/ip/-/ip-0.3.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ip/-/ip-0.3.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/ip/test/api-test.js b/node_modules/ip/test/api-test.js new file mode 100644 index 00000000..20295f87 --- /dev/null +++ b/node_modules/ip/test/api-test.js @@ -0,0 +1,355 @@ +var ip = require('..'), + assert = require('assert'), + net = require('net'), + os = require('os'); + +describe('IP library for node.js', function() { + describe('toBuffer()/toString() methods', function() { + it('should convert to buffer IPv4 address', function() { + var buf = ip.toBuffer('127.0.0.1'); + assert.equal(buf.toString('hex'), '7f000001'); + assert.equal(ip.toString(buf), '127.0.0.1'); + }); + + it('should convert to buffer IPv4 address in-place', function() { + var buf = new Buffer(128); + var offset = 64; + ip.toBuffer('127.0.0.1', buf, offset); + assert.equal(buf.toString('hex', offset, offset + 4), '7f000001'); + assert.equal(ip.toString(buf, offset, 4), '127.0.0.1'); + }); + + it('should convert to buffer IPv6 address', function() { + var buf = ip.toBuffer('::1'); + assert(/(00){15,15}01/.test(buf.toString('hex'))); + assert.equal(ip.toString(buf), '::1'); + assert.equal(ip.toString(ip.toBuffer('1::')), '1::'); + assert.equal(ip.toString(ip.toBuffer('abcd::dcba')), 'abcd::dcba'); + }); + + it('should convert to buffer IPv6 address in-place', function() { + var buf = new Buffer(128); + var offset = 64; + ip.toBuffer('::1', buf, offset); + assert(/(00){15,15}01/.test(buf.toString('hex', offset, offset + 16))); + assert.equal(ip.toString(buf, offset, 16), '::1'); + assert.equal(ip.toString(ip.toBuffer('1::', buf, offset), + offset, 16), '1::'); + assert.equal(ip.toString(ip.toBuffer('abcd::dcba', buf, offset), + offset, 16), 'abcd::dcba'); + }); + }); + + describe('fromPrefixLen() method', function() { + it('should create IPv4 mask', function() { + assert.equal(ip.fromPrefixLen(24), '255.255.255.0'); + }); + it('should create IPv6 mask', function() { + assert.equal(ip.fromPrefixLen(64), 'ffff:ffff:ffff:ffff::'); + }); + it('should create IPv6 mask explicitly', function() { + assert.equal(ip.fromPrefixLen(24, 'IPV6'), 'ffff:ff00::'); + }); + }); + + describe('not() method', function() { + it('should reverse bits in address', function() { + assert.equal(ip.not('255.255.255.0'), '0.0.0.255'); + }); + }); + + describe('or() method', function() { + it('should or bits in ipv4 addresses', function() { + assert.equal(ip.or('0.0.0.255', '192.168.1.10'), '192.168.1.255'); + }); + it('should or bits in ipv6 addresses', function() { + assert.equal(ip.or('::ff', '::abcd:dcba:abcd:dcba'), + '::abcd:dcba:abcd:dcff'); + }); + it('should or bits in mixed addresses', function() { + assert.equal(ip.or('0.0.0.255', '::abcd:dcba:abcd:dcba'), + '::abcd:dcba:abcd:dcff'); + }); + }); + + describe('mask() method', function() { + it('should mask bits in address', function() { + assert.equal(ip.mask('192.168.1.134', '255.255.255.0'), '192.168.1.0'); + assert.equal(ip.mask('192.168.1.134', '::ffff:ff00'), '::ffff:c0a8:100'); + }); + }); + + describe('subnet() method', function() { + // Test cases calculated with http://www.subnet-calculator.com/ + var ipv4Subnet = ip.subnet('192.168.1.134', '255.255.255.192'); + + it('should compute ipv4 network address', function() { + assert.equal(ipv4Subnet.networkAddress, '192.168.1.128'); + }); + + it('should compute ipv4 network\'s first address', function() { + assert.equal(ipv4Subnet.firstAddress, '192.168.1.129'); + }); + + it('should compute ipv4 network\'s last address', function() { + assert.equal(ipv4Subnet.lastAddress, '192.168.1.190'); + }); + + it('should compute ipv4 broadcast address', function() { + assert.equal(ipv4Subnet.broadcastAddress, '192.168.1.191'); + }); + + it('should compute ipv4 subnet number of addresses', function() { + assert.equal(ipv4Subnet.length, 64); + }); + + it('should compute ipv4 subnet number of addressable hosts', function() { + assert.equal(ipv4Subnet.numHosts, 62); + }); + + it('should compute ipv4 subnet mask', function() { + assert.equal(ipv4Subnet.subnetMask, '255.255.255.192'); + }); + + it('should compute ipv4 subnet mask\'s length', function() { + assert.equal(ipv4Subnet.subnetMaskLength, 26); + }); + }); + + describe('subnet() method with mask length 32', function() { + // Test cases calculated with http://www.subnet-calculator.com/ + var ipv4Subnet = ip.subnet('192.168.1.134', '255.255.255.255'); + it('should compute ipv4 network\'s first address', function() { + assert.equal(ipv4Subnet.firstAddress, '192.168.1.134'); + }); + + it('should compute ipv4 network\'s last address', function() { + assert.equal(ipv4Subnet.lastAddress, '192.168.1.134'); + }); + + it('should compute ipv4 subnet number of addressable hosts', function() { + assert.equal(ipv4Subnet.numHosts, 1); + }); + }); + + describe('subnet() method with mask length 31', function() { + // Test cases calculated with http://www.subnet-calculator.com/ + var ipv4Subnet = ip.subnet('192.168.1.134', '255.255.255.254'); + it('should compute ipv4 network\'s first address', function() { + assert.equal(ipv4Subnet.firstAddress, '192.168.1.134'); + }); + + it('should compute ipv4 network\'s last address', function() { + assert.equal(ipv4Subnet.lastAddress, '192.168.1.135'); + }); + + it('should compute ipv4 subnet number of addressable hosts', function() { + assert.equal(ipv4Subnet.numHosts, 2); + }); + }); + + describe('cidrSubnet() method', function() { + // Test cases calculated with http://www.subnet-calculator.com/ + var ipv4Subnet = ip.cidrSubnet('192.168.1.134/26'); + + it('should compute an ipv4 network address', function() { + assert.equal(ipv4Subnet.networkAddress, '192.168.1.128'); + }); + + it('should compute an ipv4 network\'s first address', function() { + assert.equal(ipv4Subnet.firstAddress, '192.168.1.129'); + }); + + it('should compute an ipv4 network\'s last address', function() { + assert.equal(ipv4Subnet.lastAddress, '192.168.1.190'); + }); + + it('should compute an ipv4 broadcast address', function() { + assert.equal(ipv4Subnet.broadcastAddress, '192.168.1.191'); + }); + + it('should compute an ipv4 subnet number of addresses', function() { + assert.equal(ipv4Subnet.length, 64); + }); + + it('should compute an ipv4 subnet number of addressable hosts', function() { + assert.equal(ipv4Subnet.numHosts, 62); + }); + + it('should compute an ipv4 subnet mask', function() { + assert.equal(ipv4Subnet.subnetMask, '255.255.255.192'); + }); + + it('should compute an ipv4 subnet mask\'s length', function() { + assert.equal(ipv4Subnet.subnetMaskLength, 26); + }); + }); + + describe('cidr() method', function() { + it('should mask address in CIDR notation', function() { + assert.equal(ip.cidr('192.168.1.134/26'), '192.168.1.128'); + assert.equal(ip.cidr('2607:f0d0:1002:51::4/56'), '2607:f0d0:1002::'); + }); + }); + + describe('isEqual() method', function() { + it('should check if addresses are equal', function() { + assert(ip.isEqual('127.0.0.1', '::7f00:1')); + assert(!ip.isEqual('127.0.0.1', '::7f00:2')); + assert(ip.isEqual('127.0.0.1', '::ffff:7f00:1')); + assert(!ip.isEqual('127.0.0.1', '::ffaf:7f00:1')); + }); + }); + + + describe('isPrivate() method', function() { + it('should check if an address is localhost', function() { + assert.equal(ip.isPrivate('127.0.0.1'), true); + }); + + it('should check if an address is from a 192.168.x.x network', function() { + assert.equal(ip.isPrivate('192.168.0.123'), true); + assert.equal(ip.isPrivate('192.168.122.123'), true); + assert.equal(ip.isPrivate('192.162.1.2'), false); + }); + + it('should check if an address is from a 172.16.x.x network', function() { + assert.equal(ip.isPrivate('172.16.0.5'), true); + assert.equal(ip.isPrivate('172.16.123.254'), true); + assert.equal(ip.isPrivate('171.16.0.5'), false); + assert.equal(ip.isPrivate('172.25.232.15'), true); + assert.equal(ip.isPrivate('172.15.0.5'), false); + assert.equal(ip.isPrivate('172.32.0.5'), false); + }); + + it('should check if an address is from a 169.254.x.x network', function() { + assert.equal(ip.isPrivate('169.254.2.3'), true); + assert.equal(ip.isPrivate('169.254.221.9'), true); + assert.equal(ip.isPrivate('168.254.2.3'), false); + }); + + it('should check if an address is from a 10.x.x.x network', function() { + assert.equal(ip.isPrivate('10.0.2.3'), true); + assert.equal(ip.isPrivate('10.1.23.45'), true); + assert.equal(ip.isPrivate('12.1.2.3'), false); + }); + + it('should check if an address is from a private IPv6 network', function() { + assert.equal(ip.isPrivate('fe80::f2de:f1ff:fe3f:307e'), true); + }); + + it('should check if an address is from the internet', function() { + assert.equal(ip.isPrivate('165.225.132.33'), false); // joyent.com + }); + + it('should check if an address is a loopback IPv6 address', function() { + assert.equal(ip.isPrivate('::'), true); + assert.equal(ip.isPrivate('::1'), true); + assert.equal(ip.isPrivate('fe80::1'), true); + }); + }); + + describe('loopback() method', function () { + describe('undefined', function () { + it('should respond with 127.0.0.1', function () { + assert.equal(ip.loopback(), '127.0.0.1') + }); + }); + + describe('ipv4', function () { + it('should respond with 127.0.0.1', function () { + assert.equal(ip.loopback('ipv4'), '127.0.0.1') + }); + }); + + describe('ipv6', function () { + it('should respond with fe80::1', function () { + assert.equal(ip.loopback('ipv6'), 'fe80::1') + }); + }); + }); + + describe('isLoopback() method', function () { + describe('127.0.0.1', function () { + it('should respond with true', function () { + assert.ok(ip.isLoopback('127.0.0.1')) + }); + }); + + describe('8.8.8.8', function () { + it('should respond with false', function () { + assert.equal(ip.isLoopback('8.8.8.8'), false); + }); + }); + + describe('fe80::1', function () { + it('should respond with true', function () { + assert.ok(ip.isLoopback('fe80::1')) + }); + }); + + describe('::1', function () { + it('should respond with true', function () { + assert.ok(ip.isLoopback('::1')) + }); + }); + + describe('::', function () { + it('should respond with true', function () { + assert.ok(ip.isLoopback('::')) + }); + }); + }); + + describe('address() method', function () { + describe('undefined', function () { + it('should respond with a private ip', function () { + assert.ok(ip.isPrivate(ip.address())); + }); + }); + + describe('private', function () { + [undefined, 'ipv4', 'ipv6'].forEach(function (family) { + describe(family, function () { + it('should respond with a private ip', function () { + assert.ok(ip.isPrivate(ip.address('private', family))); + }); + }); + }); + }); + + var interfaces = os.networkInterfaces(); + + Object.keys(interfaces).forEach(function (nic) { + describe(nic, function () { + [undefined, 'ipv4'].forEach(function (family) { + describe(family, function () { + it('should respond with an ipv4 address', function () { + assert.ok(net.isIPv4(ip.address(nic, family))); + }); + }); + }); + + describe('ipv6', function () { + it('should respond with an ipv6 address', function () { + assert.ok(net.isIPv6(ip.address(nic, 'ipv6'))); + }); + }) + }); + }); + }); + + describe('toLong() method', function(){ + it('should respond with a int', function(){ + assert.equal(ip.toLong('127.0.0.1'), 2130706433); + assert.equal(ip.toLong('255.255.255.255'), 4294967295); + }); + }); + + describe('fromLong() method', function(){ + it('should repond with ipv4 address', function(){ + assert.equal(ip.fromLong(2130706433), '127.0.0.1'); + assert.equal(ip.fromLong(4294967295), '255.255.255.255'); + }); + }) +}); diff --git a/node_modules/magnet-uri/.travis.yml b/node_modules/magnet-uri/.travis.yml new file mode 100644 index 00000000..65209dcd --- /dev/null +++ b/node_modules/magnet-uri/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: +- '0.10' +env: + global: + - secure: RDedoP0og9+2sz/AW4BPTIhhsEqaqlfGfMDDav4lC8cbPUK4U8FEifm8l0Vu6w2ooQuGX1/Kg8kSejkb28F2DbejwBu0Y7VIxbmYMLg7/EZ+dIknGIOsH/7TsLRwvZYMIvrl3J0br/vQvxdtgQ4r5iLEqoeqWfxGet42BHcSsIQ= + - secure: JUKHBqhELMeM1f4vuBaJse/fXdyNPOPnLQPQxp3dmwm36RH25CnB6REGp9aJ1LWmBGV2myNubBD/oXannKdLsRouoeITtdFQqlO0oPxoqBfNGIaJaOOYYweOTiYkVbGBtgs6TQWgRjklzgpk3aWIHb+hTG5hxGoCI/xrsBLCDuE= diff --git a/node_modules/magnet-uri/.zuul.yml b/node_modules/magnet-uri/.zuul.yml new file mode 100644 index 00000000..00fd8dd4 --- /dev/null +++ b/node_modules/magnet-uri/.zuul.yml @@ -0,0 +1,16 @@ +ui: tape +browsers: + - name: chrome + version: latest + - name: firefox + version: latest + - name: safari + version: latest + - name: ie + version: latest + - name: iphone + version: latest + - name: ipad + version: latest + - name: android + version: latest diff --git a/node_modules/magnet-uri/LICENSE b/node_modules/magnet-uri/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/magnet-uri/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/magnet-uri/README.md b/node_modules/magnet-uri/README.md new file mode 100644 index 00000000..2cf385e2 --- /dev/null +++ b/node_modules/magnet-uri/README.md @@ -0,0 +1,106 @@ +# magnet-uri [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] + +[travis-image]: https://img.shields.io/travis/feross/magnet-uri.svg?style=flat +[travis-url]: https://travis-ci.org/feross/magnet-uri +[npm-image]: https://img.shields.io/npm/v/magnet-uri.svg?style=flat +[npm-url]: https://npmjs.org/package/magnet-uri +[downloads-image]: https://img.shields.io/npm/dm/magnet-uri.svg?style=flat +[downloads-url]: https://npmjs.org/package/magnet-uri + +### Parse a magnet URI and return an object of keys/values. + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/magnet-uri.svg)](https://saucelabs.com/u/magnet-uri) + +Also works in the browser with [browserify](http://browserify.org/)! This module is used by [WebTorrent](http://webtorrent.io). + +## install + +``` +npm install magnet-uri +``` + +## usage + +### decode + +Parse a magnet URI and return an object of keys/values. + +```js +var magnet = require('magnet-uri') + +// "Leaves of Grass" by Walt Whitman +var uri = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337' + +var parsed = magnet.decode(uri) +console.log(parsed.dn) // "Leaves of Grass by Walt Whitman.epub" +console.log(parsed.infoHash) // "d2474e86c95b19b8bcfdb92bc12c9d44667cfa36" + +``` + +The `parsed` magnet link object looks like this: + +```js + { + "xt": "urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36", + "dn": "Leaves of Grass by Walt Whitman.epub", + "tr": [ + "udp://tracker.openbittorrent.com:80", + "udp://tracker.publicbt.com:80", + "udp://tracker.istole.it:6969", + "udp://tracker.ccc.de:80", + "udp://open.demonii.com:1337" + ], + + // added for convenience: + "infoHash": "d2474e86c95b19b8bcfdb92bc12c9d44667cfa36", + "name": "Leaves of Grass by Walt Whitman.epub", + "announce": [ + "udp://tracker.openbittorrent.com:80", + "udp://tracker.publicbt.com:80", + "udp://tracker.istole.it:6969", + "udp://tracker.ccc.de:80", + "udp://open.demonii.com:1337" + ] + } +``` + +### encode + +Convert an object of key/values into a magnet URI string. + +```js +var magnet = require('magnet-uri') + +var uri = magnet.encode({ + xt: [ + 'urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1', + 'urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY', + 'urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q' + ], + xl: '10826029', + dn: 'mediawiki-1.15.1.tar.gz', + tr: [ + 'udp://tracker.openbittorrent.com:80/announce' + ], + as: 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz', + xs: [ + 'http://cache.example.org/XRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5', + 'dchub://example.org' + ] +}) + +console.log(uri) // the magnet uri +``` + +The returned magnet uri will be: + +``` +magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&xl=10826029&dn=mediawiki-1.15.1.tar.gz&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&xs=dchub%3A%2F%2Fexample.org +``` + +You can also use convenience key names like `name` (`dn`), `infoHash` (`xt`), +`announce` (`tr`), `announceList` (`tr`), and `keywords` (`kt`). + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/magnet-uri/index.js b/node_modules/magnet-uri/index.js new file mode 100644 index 00000000..57472b81 --- /dev/null +++ b/node_modules/magnet-uri/index.js @@ -0,0 +1,130 @@ +module.exports = magnetURIDecode +module.exports.decode = magnetURIDecode +module.exports.encode = magnetURIEncode + +var base32 = require('thirty-two') +var extend = require('xtend') +var flatten = require('flatten') + +/** + * Parse a magnet URI and return an object of keys/values + * + * @param {string} uri + * @return {Object} parsed uri + */ +function magnetURIDecode (uri) { + var result = {} + var data = uri.split('magnet:?')[1] + + var params = (data && data.length >= 0) + ? data.split('&') + : [] + + params.forEach(function (param) { + var keyval = param.split('=') + + // This keyval is invalid, skip it + if (keyval.length !== 2) return + + var key = keyval[0] + var val = keyval[1] + + // Clean up torrent name + if (key === 'dn') val = decodeURIComponent(val).replace(/\+/g, ' ') + + // Address tracker (tr), exact source (xs), and acceptable source (as) are encoded + // URIs, so decode them + if (key === 'tr' || key === 'xs' || key === 'as' || key === 'ws') { + val = decodeURIComponent(val) + } + + // Return keywords as an array + if (key === 'kt') val = decodeURIComponent(val).split('+') + + // If there are repeated parameters, return an array of values + if (result[key]) { + if (Array.isArray(result[key])) { + result[key].push(val) + } else { + var old = result[key] + result[key] = [old, val] + } + } else { + result[key] = val + } + }) + + // Convenience properties for parity with `parse-torrent-file` module + var m + if (result.xt) { + var xts = Array.isArray(result.xt) ? result.xt : [ result.xt ] + xts.forEach(function (xt) { + if ((m = xt.match(/^urn:btih:(.{40})/))) { + result.infoHash = new Buffer(m[1], 'hex').toString('hex') + } else if ((m = xt.match(/^urn:btih:(.{32})/))) { + var decodedStr = base32.decode(m[1]) + result.infoHash = new Buffer(decodedStr, 'binary').toString('hex') + } + }) + } + + if (result.dn) result.name = result.dn + if (result.kt) result.keywords = result.kt + + if (typeof result.tr === 'string') result.announce = [ result.tr ] + else if (Array.isArray(result.tr)) result.announce = result.tr + else result.announce = [] + + result.announceList = result.announce.map(function (url) { + return [ url ] + }) + + result.urlList = [] + if (typeof result.as === 'string' || Array.isArray(result.as)) { + result.urlList = result.urlList.concat(result.as) + } + if (typeof result.ws === 'string' || Array.isArray(result.ws)) { + result.urlList = result.urlList.concat(result.ws) + } + + return result +} + +function magnetURIEncode (obj) { + obj = extend(obj) // clone obj, so we can mutate it + + // support official magnet key names and convenience names + // (example: `infoHash` for `xt`, `name` for `dn`) + if (obj.infoHash) obj.xt = 'urn:btih:' + obj.infoHash + if (obj.name) obj.dn = obj.name + if (obj.keywords) obj.kt = obj.keywords + if (obj.announce) obj.tr = obj.announce + if (obj.announceList) obj.tr = flatten(obj.announceList) + if (obj.urlList) { + obj.ws = flatten(obj.urlList) + delete obj.as + } + + var result = 'magnet:?' + Object.keys(obj) + .filter(function (key) { + return key.length === 2 + }) + .forEach(function (key, i) { + var values = Array.isArray(obj[key]) ? obj[key] : [ obj[key] ] + values.forEach(function (val, j) { + if ((i > 0 || j > 0) && (key !== 'kt' || j === 0)) result += '&' + + if (key === 'dn') val = encodeURIComponent(val).replace(/%20/g, '+') + if (key === 'tr' || key === 'xs' || key === 'as' || key === 'ws') { + val = encodeURIComponent(val) + } + if (key === 'kt') val = encodeURIComponent(val) + + if (key === 'kt' && j > 0) result += '+' + val + else result += key + '=' + val + }) + }) + + return result +} diff --git a/node_modules/magnet-uri/node_modules/flatten/README.md b/node_modules/magnet-uri/node_modules/flatten/README.md new file mode 100644 index 00000000..7b0a3b69 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/flatten/README.md @@ -0,0 +1,34 @@ +# flatten + +A tiny utility to flatten arrays of arrays (of arrays, etc., recursively, infinitely or to an optional depth) into a single array of non-arrays. + +## example: + +```js +> var flatten = require('flatten'); +undefined +> flatten([1, [2, 3], [4, 5, 6], [7, [8, 9]], 10]) +[ 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 ] +> flatten([1, [2, [3, [4, [5]]]]], 2) +[ 1, + 2, + 3, + [ 4, [ 5 ] ] ] +``` + +## install: + + npm install flatten + +## license: + +MIT/X11. diff --git a/node_modules/magnet-uri/node_modules/flatten/index.js b/node_modules/magnet-uri/node_modules/flatten/index.js new file mode 100644 index 00000000..2491baf8 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/flatten/index.js @@ -0,0 +1,16 @@ +module.exports = function flatten(list, depth) { + depth = (typeof depth == 'number') ? depth : Infinity; + + return _flatten(list, 1); + + function _flatten(list, d) { + return list.reduce(function (acc, item) { + if (Array.isArray(item) && d < depth) { + return acc.concat(_flatten(item, d + 1)); + } + else { + return acc.concat(item); + } + }, []); + } +}; diff --git a/node_modules/magnet-uri/node_modules/flatten/package.json b/node_modules/magnet-uri/node_modules/flatten/package.json new file mode 100644 index 00000000..2f4067de --- /dev/null +++ b/node_modules/magnet-uri/node_modules/flatten/package.json @@ -0,0 +1,52 @@ +{ + "author": { + "name": "Joshua Holbrook", + "email": "josh.holbrook@gmail.com", + "url": "http://jesusabdullah.net" + }, + "name": "flatten", + "description": "Flatten arbitrarily nested arrays into a non-nested list of non-array items", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/jesusabdullah/node-flatten.git" + }, + "main": "./index.js", + "scripts": { + "test": "node ./test.js" + }, + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "_npmUser": { + "name": "jesusabdullah", + "email": "josh.holbrook@gmail.com" + }, + "_id": "flatten@0.0.1", + "_engineSupported": true, + "_npmVersion": "1.1.21", + "_nodeVersion": "v0.6.18", + "_defaultsLoaded": true, + "dist": { + "shasum": "554440766da0a0d603999f433453f6c2fc6a75c1", + "tarball": "http://registry.npmjs.org/flatten/-/flatten-0.0.1.tgz" + }, + "maintainers": [ + { + "name": "jesusabdullah", + "email": "josh.holbrook@gmail.com" + } + ], + "directories": {}, + "_shasum": "554440766da0a0d603999f433453f6c2fc6a75c1", + "_resolved": "https://registry.npmjs.org/flatten/-/flatten-0.0.1.tgz", + "_from": "flatten@0.0.1", + "bugs": { + "url": "https://github.com/jesusabdullah/node-flatten/issues" + }, + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/jesusabdullah/node-flatten" +} diff --git a/node_modules/magnet-uri/node_modules/flatten/test.js b/node_modules/magnet-uri/node_modules/flatten/test.js new file mode 100644 index 00000000..077632b1 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/flatten/test.js @@ -0,0 +1,15 @@ +var flatten = require('./index'), + util = require('util'), + assert = require('assert'); + +[ + [ [1, 2, 3 ], [1, 2, 3] ], + [ ['a', ['b', ['c']]], ['a', 'b', 'c'] ], + [ [2, [4, 6], 8, [[10]]], [2, 4, 6, 8, 10] ], + [ [1, [2, [3, [4, [5]]]]], [1, 2, 3, [4, [5]]], 2 ] // depth of 2 +].forEach(function (t) { + assert.deepEqual(flatten(t[0], t[2]), t[1], + util.format('☠☠☠☠☠☠☠☠☠ `flatten(%j) !== %j` ☠☠☠☠☠☠☠☠☠', t[0], t[1]) + ); + console.log('✓ `flatten(%j) == %j`', t[0], t[1]); +}); diff --git a/node_modules/magnet-uri/node_modules/thirty-two/.npmignore b/node_modules/magnet-uri/node_modules/thirty-two/.npmignore new file mode 100644 index 00000000..3ee8de4c --- /dev/null +++ b/node_modules/magnet-uri/node_modules/thirty-two/.npmignore @@ -0,0 +1,4 @@ +*.kpf +*~ +\#* +node_modules diff --git a/node_modules/magnet-uri/node_modules/thirty-two/LICENSE.txt b/node_modules/magnet-uri/node_modules/thirty-two/LICENSE.txt new file mode 100644 index 00000000..364e7faa --- /dev/null +++ b/node_modules/magnet-uri/node_modules/thirty-two/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2011, Chris Umbel + +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. \ No newline at end of file diff --git a/node_modules/magnet-uri/node_modules/thirty-two/Makefile b/node_modules/magnet-uri/node_modules/thirty-two/Makefile new file mode 100644 index 00000000..60112303 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/thirty-two/Makefile @@ -0,0 +1,24 @@ +# Copyright (c) 2011, Chris Umbel + +# 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. + +SHELL := /bin/bash + +test: + jasmine-node spec/ diff --git a/node_modules/magnet-uri/node_modules/thirty-two/README.md b/node_modules/magnet-uri/node_modules/thirty-two/README.md new file mode 100644 index 00000000..fd81e38b --- /dev/null +++ b/node_modules/magnet-uri/node_modules/thirty-two/README.md @@ -0,0 +1,15 @@ +# thirty-two + +Implementation of RFC 3548 Base32 encoding/decoding for node. + +## Installation + + npm install thirty-two + +## Usage + + var base32 = require('thirty-two'); + base32.encode('node'); + // output: NZXWIZI= + base32.decode('NZXWIZI='); + //output: node diff --git a/node_modules/magnet-uri/node_modules/thirty-two/index.js b/node_modules/magnet-uri/node_modules/thirty-two/index.js new file mode 100644 index 00000000..28d6a19b --- /dev/null +++ b/node_modules/magnet-uri/node_modules/thirty-two/index.js @@ -0,0 +1,23 @@ +/* +Copyright (c) 2011, Chris Umbel + +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. +*/ + +module.exports = require('./lib/base32/'); diff --git a/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/index.js b/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/index.js new file mode 100644 index 00000000..8cb3e2fb --- /dev/null +++ b/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/index.js @@ -0,0 +1,26 @@ +/* +Copyright (c) 2011, Chris Umbel + +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. +*/ + +var base32 = require('./thirty-two'); + +exports.encode = base32.encode; +exports.decode = base32.decode; diff --git a/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/thirty-two.js b/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/thirty-two.js new file mode 100644 index 00000000..3e4dd6b8 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/thirty-two.js @@ -0,0 +1,125 @@ +/* +Copyright (c) 2011, Chris Umbel + +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. +*/ + +var charTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; +var byteTable = [ + 0xff, 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff +]; + +function quintetCount(buff) { + var quintets = Math.floor(buff.length / 5); + return buff.length % 5 == 0 ? quintets: quintets + 1; +} + +exports.encode = function(plain) { + var i = 0; + var j = 0; + var shiftIndex = 0; + var digit = 0; + var encoded = new Buffer(quintetCount(plain) * 8); + if(!Buffer.isBuffer(plain)){ + plain = new Buffer(plain); + } + + /* byte by byte isn't as pretty as quintet by quintet but tests a bit + faster. will have to revisit. */ + while(i < plain.length) { + var current = plain[i]; + + if(shiftIndex > 3) { + digit = current & (0xff >> shiftIndex); + shiftIndex = (shiftIndex + 5) % 8; + digit = (digit << shiftIndex) | ((i + 1 < plain.length) ? + plain[i + 1] : 0) >> (8 - shiftIndex); + i++; + } else { + digit = (current >> (8 - (shiftIndex + 5))) & 0x1f; + shiftIndex = (shiftIndex + 5) % 8; + if(shiftIndex == 0) i++; + } + + encoded[j] = charTable.charCodeAt(digit); + j++; + } + + for(i = j; i < encoded.length; i++) + encoded[i] = 0x3d; //'='.charCodeAt(0) + + return encoded; +}; + +exports.decode = function(encoded) { + var shiftIndex = 0; + var plainDigit = 0; + var plainChar; + var plainPos = 0; + if(!Buffer.isBuffer(encoded)){ + encoded = new Buffer(encoded); + } + var decoded = new Buffer(Math.ceil(encoded.length * 5 / 8)); + + /* byte by byte isn't as pretty as octet by octet but tests a bit + faster. will have to revisit. */ + for(var i = 0; i < encoded.length; i++) { + if(encoded[i] == 0x3d){ //'=' + break; + } + + var encodedByte = encoded[i] - 0x30; + + if(encodedByte < byteTable.length) { + plainDigit = byteTable[encodedByte]; + + if(shiftIndex <= 3) { + shiftIndex = (shiftIndex + 5) % 8; + + if(shiftIndex == 0) { + plainChar |= plainDigit; + decoded[plainPos] = plainChar; + plainPos++; + plainChar = 0; + } else { + plainChar |= 0xff & (plainDigit << (8 - shiftIndex)); + } + } else { + shiftIndex = (shiftIndex + 5) % 8; + plainChar |= 0xff & (plainDigit >>> shiftIndex); + decoded[plainPos] = plainChar; + plainPos++; + + plainChar = 0xff & (plainDigit << (8 - shiftIndex)); + } + } else { + throw new Error('Invalid input - it is not base32 encoded string'); + } + } + return decoded.slice(0, plainPos); +}; diff --git a/node_modules/magnet-uri/node_modules/thirty-two/package.json b/node_modules/magnet-uri/node_modules/thirty-two/package.json new file mode 100644 index 00000000..c93d0129 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/thirty-two/package.json @@ -0,0 +1,46 @@ +{ + "name": "thirty-two", + "description": "Implementation RFC 3548 Base32 encoding/decoding for node.", + "version": "0.0.2", + "engines": { + "node": ">=0.2.6" + }, + "author": { + "name": "Chris Umbel", + "email": "chris@chrisumbel.com" + }, + "keywords": [ + "base32", + "encoding" + ], + "main": "./lib/thirty-two/index.js", + "repository": { + "type": "git", + "url": "git://github.com/chrisumbel/thirty-two.git" + }, + "bugs": { + "url": "https://github.com/chrisumbel/thirty-two/issues" + }, + "homepage": "https://github.com/chrisumbel/thirty-two", + "_id": "thirty-two@0.0.2", + "_shasum": "4253e29d8cb058f0480267c5698c0e4927e54b6a", + "_from": "thirty-two@>=0.0.2 <0.0.3", + "_npmVersion": "1.4.9", + "_npmUser": { + "name": "chrisumbel", + "email": "chris@chrisumbel.com" + }, + "maintainers": [ + { + "name": "chrisumbel", + "email": "chris@chrisumbel.com" + } + ], + "dist": { + "shasum": "4253e29d8cb058f0480267c5698c0e4927e54b6a", + "tarball": "http://registry.npmjs.org/thirty-two/-/thirty-two-0.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/thirty-two/-/thirty-two-0.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/magnet-uri/node_modules/thirty-two/spec/thirty-two_spec.js b/node_modules/magnet-uri/node_modules/thirty-two/spec/thirty-two_spec.js new file mode 100644 index 00000000..a0e0c0a7 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/thirty-two/spec/thirty-two_spec.js @@ -0,0 +1,63 @@ +/* +Copyright (c) 2011, Chris Umbel + +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. +*/ +if(!expect){ + function expect(a){ + return { + toBe: function(b){ + require('assert').strictEqual(a, b); + } + }; + } +} +var base32 = require('../lib/thirty-two/'); + +describe('thirty-two', function() { + it('should encode', function() { + expect(base32.encode('a').toString()).toBe('ME======'); + expect(base32.encode('be').toString()).toBe('MJSQ===='); + expect(base32.encode('bee').toString()).toBe('MJSWK==='); + expect(base32.encode('beer').toString()).toBe('MJSWK4Q='); + expect(base32.encode('beers').toString()).toBe('MJSWK4TT'); + expect(base32.encode('beers 1').toString()).toBe('MJSWK4TTEAYQ===='); + expect(base32.encode('shockingly dismissed').toString()).toBe('ONUG6Y3LNFXGO3DZEBSGS43NNFZXGZLE'); + }); + + + it('should decode', function() { + expect(base32.decode('ME======').toString()).toBe('a'); + expect(base32.decode('MJSQ====').toString()).toBe('be'); + expect(base32.decode('ONXW4===').toString()).toBe('son'); + expect(base32.decode('MJSWK===').toString()).toBe('bee'); + expect(base32.decode('MJSWK4Q=').toString()).toBe('beer'); + expect(base32.decode('MJSWK4TT').toString()).toBe('beers'); + expect(base32.decode('mjswK4TT').toString()).toBe('beers'); + expect(base32.decode('MJSWK4TTN5XA====').toString()).toBe('beerson'); + expect(base32.decode('MJSWK4TTEAYQ====').toString()).toBe('beers 1'); + expect(base32.decode('ONUG6Y3LNFXGO3DZEBSGS43NNFZXGZLE').toString()).toBe('shockingly dismissed'); + }); + + it('should be binary safe', function() { + expect(base32.decode(base32.encode(new Buffer([0x00, 0xff, 0x88]))).toString('hex')).toBe('00ff88'); + expect(base32.encode(new Buffer("f61e1f998d69151de8334dbe753ab17ae831c13849a6aecd95d0a4e5dc25", 'hex')).toString()).toBe('6YPB7GMNNEKR32BTJW7HKOVRPLUDDQJYJGTK5TMV2CSOLXBF'); + expect(base32.decode('6YPB7GMNNEKR32BTJW7HKOVRPLUDDQJYJGTK5TMV2CSOLXBF').toString('hex')).toBe('f61e1f998d69151de8334dbe753ab17ae831c13849a6aecd95d0a4e5dc25'); + }); +}); diff --git a/node_modules/magnet-uri/node_modules/xtend/.jshintrc b/node_modules/magnet-uri/node_modules/xtend/.jshintrc new file mode 100644 index 00000000..77887b5f --- /dev/null +++ b/node_modules/magnet-uri/node_modules/xtend/.jshintrc @@ -0,0 +1,30 @@ +{ + "maxdepth": 4, + "maxstatements": 200, + "maxcomplexity": 12, + "maxlen": 80, + "maxparams": 5, + + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": false, + "noarg": true, + "noempty": true, + "nonew": true, + "undef": true, + "unused": "vars", + "trailing": true, + + "quotmark": true, + "expr": true, + "asi": true, + + "browser": false, + "esnext": true, + "devel": false, + "node": false, + "nonstandard": false, + + "predef": ["require", "module", "__dirname", "__filename"] +} diff --git a/node_modules/magnet-uri/node_modules/xtend/.npmignore b/node_modules/magnet-uri/node_modules/xtend/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/xtend/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/magnet-uri/node_modules/xtend/LICENCE b/node_modules/magnet-uri/node_modules/xtend/LICENCE new file mode 100644 index 00000000..1a14b437 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/xtend/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2012-2014 Raynos. + +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/node_modules/magnet-uri/node_modules/xtend/Makefile b/node_modules/magnet-uri/node_modules/xtend/Makefile new file mode 100644 index 00000000..d583fcf4 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/xtend/Makefile @@ -0,0 +1,4 @@ +browser: + node ./support/compile + +.PHONY: browser \ No newline at end of file diff --git a/node_modules/magnet-uri/node_modules/xtend/README.md b/node_modules/magnet-uri/node_modules/xtend/README.md new file mode 100644 index 00000000..093cb297 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/xtend/README.md @@ -0,0 +1,32 @@ +# xtend + +[![browser support][3]][4] + +[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) + +Extend like a boss + +xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence. + +## Examples + +```js +var extend = require("xtend") + +// extend returns a new object. Does not mutate arguments +var combination = extend({ + a: "a", + b: 'c' +}, { + b: "b" +}) +// { a: "a", b: "b" } +``` + +## Stability status: Locked + +## MIT Licenced + + + [3]: http://ci.testling.com/Raynos/xtend.png + [4]: http://ci.testling.com/Raynos/xtend diff --git a/node_modules/magnet-uri/node_modules/xtend/immutable.js b/node_modules/magnet-uri/node_modules/xtend/immutable.js new file mode 100644 index 00000000..5b760152 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/xtend/immutable.js @@ -0,0 +1,17 @@ +module.exports = extend + +function extend() { + var target = {} + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (source.hasOwnProperty(key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/magnet-uri/node_modules/xtend/mutable.js b/node_modules/magnet-uri/node_modules/xtend/mutable.js new file mode 100644 index 00000000..a34475eb --- /dev/null +++ b/node_modules/magnet-uri/node_modules/xtend/mutable.js @@ -0,0 +1,15 @@ +module.exports = extend + +function extend(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (source.hasOwnProperty(key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/magnet-uri/node_modules/xtend/package.json b/node_modules/magnet-uri/node_modules/xtend/package.json new file mode 100644 index 00000000..907a720d --- /dev/null +++ b/node_modules/magnet-uri/node_modules/xtend/package.json @@ -0,0 +1,88 @@ +{ + "name": "xtend", + "version": "4.0.0", + "description": "extend like a boss", + "keywords": [ + "extend", + "merge", + "options", + "opts", + "object", + "array" + ], + "author": { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + "repository": { + "type": "git", + "url": "git://github.com/Raynos/xtend.git" + }, + "main": "immutable", + "scripts": { + "test": "node test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.0" + }, + "homepage": "https://github.com/Raynos/xtend", + "contributors": [ + { + "name": "Jake Verbaten" + }, + { + "name": "Matt Esch" + } + ], + "bugs": { + "url": "https://github.com/Raynos/xtend/issues", + "email": "raynos2@gmail.com" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/raynos/xtend/raw/master/LICENSE" + } + ], + "testling": { + "files": "test.js", + "browsers": [ + "ie/7..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest" + ] + }, + "engines": { + "node": ">=0.4" + }, + "gitHead": "94a95d76154103290533b2c55ffa0fe4be16bfef", + "_id": "xtend@4.0.0", + "_shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "_from": "xtend@>=4.0.0 <5.0.0", + "_npmVersion": "1.4.15", + "_npmUser": { + "name": "raynos", + "email": "raynos2@gmail.com" + }, + "maintainers": [ + { + "name": "raynos", + "email": "raynos2@gmail.com" + } + ], + "dist": { + "shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "tarball": "http://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/magnet-uri/node_modules/xtend/test.js b/node_modules/magnet-uri/node_modules/xtend/test.js new file mode 100644 index 00000000..3369d796 --- /dev/null +++ b/node_modules/magnet-uri/node_modules/xtend/test.js @@ -0,0 +1,63 @@ +var test = require("tape") +var extend = require("./") +var mutableExtend = require("./mutable") + +test("merge", function(assert) { + var a = { a: "foo" } + var b = { b: "bar" } + + assert.deepEqual(extend(a, b), { a: "foo", b: "bar" }) + assert.end() +}) + +test("replace", function(assert) { + var a = { a: "foo" } + var b = { a: "bar" } + + assert.deepEqual(extend(a, b), { a: "bar" }) + assert.end() +}) + +test("undefined", function(assert) { + var a = { a: undefined } + var b = { b: "foo" } + + assert.deepEqual(extend(a, b), { a: undefined, b: "foo" }) + assert.deepEqual(extend(b, a), { a: undefined, b: "foo" }) + assert.end() +}) + +test("handle 0", function(assert) { + var a = { a: "default" } + var b = { a: 0 } + + assert.deepEqual(extend(a, b), { a: 0 }) + assert.deepEqual(extend(b, a), { a: "default" }) + assert.end() +}) + +test("is immutable", function (assert) { + var record = {} + + extend(record, { foo: "bar" }) + assert.equal(record.foo, undefined) + assert.end() +}) + +test("null as argument", function (assert) { + var a = { foo: "bar" } + var b = null + var c = void 0 + + assert.deepEqual(extend(b, a, c), { foo: "bar" }) + assert.end() +}) + +test("mutable", function (assert) { + var a = { foo: "bar" } + + mutableExtend(a, { bar: "baz" }) + + assert.equal(a.bar, "baz") + assert.end() +}) diff --git a/node_modules/magnet-uri/package.json b/node_modules/magnet-uri/package.json new file mode 100644 index 00000000..a0e5af3c --- /dev/null +++ b/node_modules/magnet-uri/package.json @@ -0,0 +1,72 @@ +{ + "name": "magnet-uri", + "description": "Parse a magnet URI and return an object of keys/values", + "version": "4.2.3", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/magnet-uri/issues" + }, + "dependencies": { + "flatten": "0.0.1", + "thirty-two": "^0.0.2", + "xtend": "^4.0.0" + }, + "devDependencies": { + "standard": "^3.1.2", + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "https://github.com/feross/magnet-uri", + "keywords": [ + "magnet", + "uri", + "urn", + "p2p", + "peer-to-peer", + "cryptolinks", + "bittorrent", + "webtorrent" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/magnet-uri.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "testling": { + "files": "test/*.js" + }, + "gitHead": "ab5a11bb2472713e175679c0854aaaf6ea4248bb", + "_id": "magnet-uri@4.2.3", + "_shasum": "79cc6d65a00bb5b7ef5c25ae60ebbb5d9a7681a8", + "_from": "magnet-uri@4.2.3", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "79cc6d65a00bb5b7ef5c25ae60ebbb5d9a7681a8", + "tarball": "http://registry.npmjs.org/magnet-uri/-/magnet-uri-4.2.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/magnet-uri/-/magnet-uri-4.2.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/magnet-uri/test/decode.js b/node_modules/magnet-uri/test/decode.js new file mode 100644 index 00000000..a35aea5e --- /dev/null +++ b/node_modules/magnet-uri/test/decode.js @@ -0,0 +1,128 @@ +var extend = require('xtend') +var magnet = require('../') +var test = require('tape') + +var leavesOfGrass = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337' + +var empty = { announce: [], announceList: [], urlList: [] } + +test('decode: valid magnet uris', function (t) { + var result = magnet(leavesOfGrass) + t.equal(result.xt, 'urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36') + t.equal(result.dn, 'Leaves of Grass by Walt Whitman.epub') + t.equal(result.infoHash, 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36') + var announce = [ + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.publicbt.com:80', + 'udp://tracker.istole.it:6969', + 'udp://tracker.ccc.de:80', + 'udp://open.demonii.com:1337' + ] + var announceList = [ + [ 'udp://tracker.openbittorrent.com:80' ], + [ 'udp://tracker.publicbt.com:80' ], + [ 'udp://tracker.istole.it:6969' ], + [ 'udp://tracker.ccc.de:80' ], + [ 'udp://open.demonii.com:1337' ] + ] + t.deepEqual(result.tr, announce) + t.deepEqual(result.announce, announce) + t.deepEqual(result.announceList, announceList) + + t.end() +}) + +test('decode: empty magnet URIs return empty object', function (t) { + var empty1 = '' + var empty2 = 'magnet:' + var empty3 = 'magnet:?' + + t.deepEqual(magnet(empty1), empty) + t.deepEqual(magnet(empty2), empty) + t.deepEqual(magnet(empty3), empty) + t.end() +}) + +test('empty string as keys is okay', function (t) { + var uri = 'magnet:?a=&b=&c=' + + t.deepEqual(magnet(uri), extend({ a: '', b: '', c: '' }, empty)) + t.end() +}) + +test('decode: invalid magnet URIs return empty object', function (t) { + var invalid1 = 'magnet:?xt=urn:btih:===' + var invalid2 = 'magnet:?xt' + var invalid3 = 'magnet:?xt=?dn=' + + t.deepEqual(magnet(invalid1), empty) + t.deepEqual(magnet(invalid2), empty) + t.deepEqual(magnet(invalid3), empty) + t.end() +}) + +test('decode: invalid magnet URIs return only valid keys (ignoring invalid ones)', function (t) { + var invalid1 = 'magnet:?a=a&===' + var invalid2 = 'magnet:?a==&b=b' + var invalid3 = 'magnet:?a=b=&c=c&d===' + + t.deepEqual(magnet(invalid1), extend({ a: 'a' }, empty)) + t.deepEqual(magnet(invalid2), extend({ b: 'b' }, empty)) + t.deepEqual(magnet(invalid3), extend({ c: 'c' }, empty)) + t.end() +}) + +test('decode: extracts 40-char hex BitTorrent info_hash', function (t) { + var result = magnet('magnet:?xt=urn:btih:aad050ee1bb22e196939547b134535824dabf0ce') + t.equal(result.infoHash, 'aad050ee1bb22e196939547b134535824dabf0ce') + t.end() +}) + +test('decode: extracts 32-char base32 BitTorrent info_hash', function (t) { + var result = magnet('magnet:?xt=urn:btih:64DZYZWMUAVLIWJUXGDIK4QGAAIN7SL6') + t.equal(result.infoHash, 'f7079c66cca02ab45934b9868572060010dfc97e') + t.end() +}) + +test('decode: extracts keywords', function (t) { + var result = magnet('magnet:?xt=urn:btih:64DZYZWMUAVLIWJUXGDIK4QGAAIN7SL6&kt=joe+blow+mp3') + t.deepEqual(result.keywords, ['joe', 'blow', 'mp3']) + t.end() +}) + +test('decode: complicated magnet uri (multiple xt params, and as, xs)', function (t) { + var result = magnet('magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&xl=10826029&dn=mediawiki-1.15.1.tar.gz&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&xs=dchub://example.org') + t.equal(result.infoHash, '81e177e2cc00943b29fcfc635457f575237293b0') + t.deepEqual(result.xt, [ + 'urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1', + 'urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY', + 'urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q' + ]) + t.equal(result.xl, '10826029') + t.equal(result.dn, 'mediawiki-1.15.1.tar.gz') + var announce = 'udp://tracker.openbittorrent.com:80/announce' + var announceList = [ + [ 'udp://tracker.openbittorrent.com:80/announce' ] + ] + t.equal(result.tr, announce) + t.deepEqual(result.announce, [ announce ]) + t.deepEqual(result.announceList, announceList) + t.equal(result.as, 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz') + t.deepEqual(result.urlList, [ 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz' ]) + t.deepEqual(result.xs, [ + 'http://cache.example.org/XRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5', + 'dchub://example.org' + ]) + t.end() +}) + +test('multiple as, ws params', function (t) { + var result = magnet('magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz1&ws=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz2&ws=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz3') + t.deepEqual(result.urlList, [ + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz', + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz1', + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz2', + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz3' + ]) + t.end() +}) diff --git a/node_modules/magnet-uri/test/encode.js b/node_modules/magnet-uri/test/encode.js new file mode 100644 index 00000000..f63f60ac --- /dev/null +++ b/node_modules/magnet-uri/test/encode.js @@ -0,0 +1,69 @@ +var magnet = require('../') +var test = require('tape') + +test('encode: complicated magnet uri (multiple xt params, and as, xs)', function (t) { + var uri = magnet.encode({ + xt: [ + 'urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1', + 'urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY', + 'urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q' + ], + xl: '10826029', + dn: 'mediawiki-1.15.1.tar.gz', + tr: [ + 'udp://tracker.openbittorrent.com:80/announce' + ], + as: 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz', + xs: [ + 'http://cache.example.org/XRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5', + 'dchub://example.org' + ] + }) + + t.equal(uri, 'magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&xl=10826029&dn=mediawiki-1.15.1.tar.gz&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&xs=dchub%3A%2F%2Fexample.org') + t.end() +}) + +test('encode: simple magnet uri using convenience names', function (t) { + var obj = { + xt: 'urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + dn: 'Leaves of Grass by Walt Whitman.epub', + name: 'Leaves of Grass by Walt Whitman.epub', + infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + tr: [ + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.publicbt.com:80', + 'udp://tracker.istole.it:6969', + 'udp://tracker.ccc.de:80', + 'udp://open.demonii.com:1337' + ], + announce: [ + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.publicbt.com:80', + 'udp://tracker.istole.it:6969', + 'udp://tracker.ccc.de:80', + 'udp://open.demonii.com:1337' + ], + announceList: [ + [ 'udp://tracker.openbittorrent.com:80' ], + [ 'udp://tracker.publicbt.com:80' ], + [ 'udp://tracker.istole.it:6969' ], + [ 'udp://tracker.ccc.de:80' ], + [ 'udp://open.demonii.com:1337' ] + ], + urlList: [ + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz' + ], + ws: 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz', + kt: [ 'hey', 'hey2' ], + keywords: [ 'hey', 'hey2' ] + } + + var result = magnet.encode(obj) + + t.equal(result, 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&ws=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&kt=hey+hey2') + + t.deepEqual(magnet.decode(result), obj) + + t.end() +}) diff --git a/node_modules/magnet-uri/vlc-log.txt b/node_modules/magnet-uri/vlc-log.txt new file mode 100644 index 00000000..05107d39 --- /dev/null +++ b/node_modules/magnet-uri/vlc-log.txt @@ -0,0 +1,2332 @@ +-- logger module started -- +main debug: VLC media player - 2.1.5 Rincewind +main debug: Copyright © 1996-2014 the VideoLAN team +main debug: revision 2.1.4-59-g5f258d5 +main debug: configured with ../extras/package/macosx/../../../configure '--prefix=/Users/fkuehne/Desktop/videolan/gits/vlc-2.1/release/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-audio' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-vout' '--disable-caca' '--disable-skins2' '--disable-xcb' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' '--build=x86_64-apple-darwin10' '--with-macosx-version-min=10.6' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CXX=xcrun clang++' 'OBJC=xcrun clang' +main debug: using interface module "logger" +main debug: looking for interface module matching "logger,none": 15 candidates +logger: using logger. +logger debug: opening logfile `vlc-log.txt' +-- logger module started -- +main debug: VLC media player - 2.1.5 Rincewind +main debug: Copyright © 1996-2014 the VideoLAN team +main debug: revision 2.1.4-59-g5f258d5 +main debug: configured with ../extras/package/macosx/../../../configure '--prefix=/Users/fkuehne/Desktop/videolan/gits/vlc-2.1/release/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-audio' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-vout' '--disable-caca' '--disable-skins2' '--disable-xcb' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' '--build=x86_64-apple-darwin10' '--with-macosx-version-min=10.6' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CXX=xcrun clang++' 'OBJC=xcrun clang' +main debug: using interface module "logger" +lua: Lua HTTP interface +main debug: Creating an input for 'Media Library' +main debug: Input is a meta file: disabling unneeded options +main debug: using timeshift granularity of 50 MiB, in path '/tmp' +main debug: `file/xspf-open:///Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' gives access `file' demux `xspf-open' path `/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' +main debug: creating demux: access='file' demux='xspf-open' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for access_demux module matching "file": 14 candidates +main debug: creating VLM +lua debug: Loaded /Applications/VLC.app/Contents/MacOS/share/lua/http/custom.lua +main debug: net: listening to * port 8080 +main debug: no access_demux modules matched +main debug: creating access 'file' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf', path='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for access module matching "file": 18 candidates +filesystem debug: opening file `/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: using access module "filesystem" +main debug: Using stream method for AStream* +main debug: starting pre-buffering +main debug: received first data after 0 ms +main debug: pre-buffering done 296 bytes in 0s - 11562 KiB/s +main debug: looking for stream_filter module matching "any": 9 candidates +main debug: no stream_filter modules matched +main debug: looking for stream_filter module matching "record": 9 candidates +main debug: using stream_filter module "record" +main debug: creating demux: access='file' demux='xspf-open' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for demux module matching "xspf-open": 63 candidates +playlist debug: using XSPF playlist reader +main debug: using demux module "playlist" +main debug: looking for meta reader module matching "any": 2 candidates +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/meta/reader +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader +main debug: no meta reader modules matched +main debug: `file/xspf-open:///Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' successfully opened +main debug: looking for xml reader module matching "any": 1 candidates +main debug: using xml reader module "xml" +playlist debug: parsed 0 tracks successfully +main debug: EOF reached +main debug: removing module "playlist" +main debug: removing module "record" +main debug: removing module "filesystem" +main debug: creating audio output +main debug: looking for audio output module matching "any": 4 candidates +auhal debug: found 2 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +main debug: restart requested (2) +main debug: using audio output module "auhal" +main debug: keeping audio output +main debug: adding item `http://localhost:8000/0' ( http://localhost:8000/0 ) +main debug: no fetch required for (null) (art currently (null)) +main debug: looking for interface module matching "hotkeys,none": 15 candidates +main debug: using interface module "hotkeys" +main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. +main debug: looking for interface module matching "any": 15 candidates +main debug: looking for services probe module matching "any": 5 candidates +main debug: no services probe modules matched +main debug: looking for extension module matching "any": 1 candidates +lua debug: Opening Lua Extension module +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/extensions +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/extensions +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac +lua debug: Scanning Lua script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac +lua debug: Script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac has the following capability flags: 0x5 +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/extensions +main debug: using extension module "lua" +macosx debug: Found 1 video capture devices +macosx debug: Found 1 audio capture devices +main debug: processing request item: http://localhost:8000/0, node: Playlist, skip: 0 +main debug: rebuilding array of current - root Playlist +main debug: rebuild done - 1 items, index 0 +main debug: starting playback of the new playlist item +main debug: resyncing on http://localhost:8000/0 +main debug: http://localhost:8000/0 is at 0 +main debug: creating new input thread +main debug: Creating an input for 'http://localhost:8000/0' +main debug: using timeshift granularity of 50 MiB, in path '/tmp' +main debug: `http://localhost:8000/0' gives access `http' demux `' path `localhost:8000/0' +main debug: creating demux: access='http' demux='' location='localhost:8000/0' file='(null)' +main debug: looking for access_demux module matching "http": 14 candidates +main debug: no access_demux modules matched +main debug: creating access 'http' location='localhost:8000/0', path='(null)' +main debug: looking for access module matching "http": 18 candidates +access_http debug: querying proxy for http://localhost:8000/0 +access_http debug: no proxy +access_http debug: http: server='localhost' port=8000 file='/0' +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +macosx debug: no optical media found +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=0,remaining=463357580 +access_http debug: this frame size=463357580 +access_http debug: Connection: close +main debug: using access module "access_http" +main debug: Using stream method for AStream* +main debug: starting pre-buffering +main debug: received first data after 0 ms +main debug: pre-buffering done 1024 bytes in 0s - 52631 KiB/s +main debug: looking for stream_filter module matching "any": 9 candidates +main debug: no stream_filter modules matched +main debug: looking for stream_filter module matching "record": 9 candidates +main debug: using stream_filter module "record" +main debug: creating demux: access='http' demux='' location='localhost:8000/0' file='(null)' +main debug: looking for demux module matching "any": 63 candidates +access_http debug: trying to seek to 462693989 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=462693989,remaining=663591 +access_http debug: this frame size=663591 +access_http debug: Connection: close +mp4 warning: unknown box type desc (incompletely loaded) +mp4 warning: MP4 plugin discarded (not fast-seekable) +access_http debug: trying to seek to 1536 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=1536,remaining=463356044 +access_http debug: this frame size=463356044 +access_http debug: Connection: close +ts debug: TS module discarded (lost sync) +mod debug: MOD validation failed (ext=) +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/playlist +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/playlist +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_streams.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_xml.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/appletrailers.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/bbc_co_uk.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/break.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/canalplus.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/cue.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/dailymotion.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/extreme.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/france2.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/googlevideo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/jamendo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/joox.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/katsomo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/koreus.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/lelombrik.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/liveleak.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metacafe.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metachannels.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mpora.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pinkbike.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pluzz.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/rockbox_fm_presets.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/soundcloud.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/vimeo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube_homepage.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/zapiks.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/playlist +avcodec debug: trying url: http://localhost:8000/0 +avcodec debug: detected format: mov,mp4,m4a,3gp,3g2,mj2 +access_http debug: trying to seek to 463357580 +access_http error: seek too far +access_http debug: trying to seek to 463357579 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: this frame size=1 +access_http debug: Connection: close +access_http debug: trying to seek to 48072 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=48072,remaining=463309508 +access_http debug: this frame size=463309508 +access_http debug: Connection: close +main debug: selecting program id=0 +avcodec debug: adding es: video codec = h264 (28) +avcodec debug: adding es: audio codec = mp4a (86018) +avcodec debug: AVFormat supported stream +avcodec debug: - format = mov,mp4,m4a,3gp,3g2,mj2 (QuickTime / MOV) +avcodec debug: - start time = 0 +avcodec debug: - duration = 888064000 +main debug: using demux module "avcodec" +main debug: looking for decoder module matching "any": 37 candidates +avcodec debug: trying to use direct rendering +avcodec debug: allowing 4 thread(s) for decoding +avcodec debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started +avcodec debug: using frame thread mode with 4 threads +main debug: using decoder module "avcodec" +main debug: looking for decoder module matching "any": 37 candidates +main debug: using decoder module "faad" +main debug: looking for meta reader module matching "any": 2 candidates +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/meta/reader +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader +main debug: no meta reader modules matched +main debug: `http://localhost:8000/0' successfully opened +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 2% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 6% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 10% +main debug: Buffering 12% +main debug: looking for text renderer module matching "any": 3 candidates +main debug: Buffering 12% +main debug: Buffering 14% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 23% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 27% +main debug: Buffering 29% +faad warning: decoded zero sample +main debug: Buffering 29% +main debug: Buffering 32% +main debug: Buffering 33% +freetype debug: looking for Arial Unicode MS +main debug: Buffering 33% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 57% +main debug: Buffering 58% +freetype debug: found /Library/Fonts/Arial Unicode.ttf +main debug: Buffering 58% +freetype debug: Using Arial Unicode MS as font from file /Library/Fonts/Arial Unicode.ttf +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +freetype debug: using fontsize: 2 +main debug: Buffering 75% +main debug: using text renderer module "freetype" +main debug: Buffering 78% +main debug: Buffering 79% +main debug: looking for video filter2 module matching "any": 54 candidates +main debug: Buffering 79% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 89% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 93% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 98% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1024 ms in 3 ms) +swscale debug: 32x32 chroma: YUVA -> 16x16 chroma: RGBA with scaling using Bicubic (good quality) +main debug: using video filter2 module "swscale" +main debug: looking for video filter2 module matching "any": 54 candidates +yuvp debug: YUVP to YUVA converter +main debug: using video filter2 module "yuvp" +main debug: Deinterlacing available +main debug: deinterlace 0, mode blend, is_needed 0 +main debug: Opening vout display wrapper +main debug: looking for vout display module matching "any": 5 candidates +main debug: looking for vout window nsobject module matching "any": 1 candidates +macosx debug: prevented sleep through IOKit (1805) +macosx debug: returning videoview with proposed position x=0, y=0, width=2048, height=872 +main debug: using vout window nsobject module "macosx" +macosx debug: toggle playlist from state: removed splitview 0, minimized view 0. Sender is 0x0, unhide video view 0 +macosx debug: toggle playlist to state: removed splitview 0, minimized view 0 +macosx debug: releasing old sleep blocker (1805) +macosx debug: prevented sleep through IOKit (1807) +main debug: VoutDisplayEvent 'resize' 2048x872 window +main debug: using vout display module "vout_macosx" +main debug: original format sz 2048x872, of (0,0), vsz 2048x872, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0 +main debug: removing module "freetype" +main debug: looking for text renderer module matching "any": 3 candidates +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +freetype debug: Using Arial Unicode MS as font from file /Library/Fonts/Arial Unicode.ttf +freetype debug: using fontsize: 2 +main debug: using text renderer module "freetype" +avcodec debug: using direct rendering +main debug: reusing audio output +main debug: VLC is looking for: 'f32l' 48000 Hz 3F2R/LFE frame=1 samples/24 bytes +auhal debug: attempting to use device 0 +auhal debug: using default audio device 38 +auhal debug: found 16 stream formats for stream id 39 +auhal debug: Audio device supports PCM mode only +main debug: VoutDisplayEvent 'resize' 2872x1622 window +main debug: End of video preroll +main debug: Received first picture +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +auhal debug: current format is: [44100.000000][mcpl][9][8][1][8][2][32] +auhal debug: layout of AUHAL has 2 channels +auhal debug: selected 2 physical channels for device output +auhal debug: VLC will output: Stereo +auhal debug: we set the AU format: [48000.000000][mcpl][9][8][1][8][2][32] +auhal debug: the actual set AU format is [48000.000000][mcpl][9][8][1][8][2][32] +auhal debug: analog output successfully opened +main debug: output 'f32l' 48000 Hz Stereo frame=1 samples/8 bytes +main debug: looking for audio volume module matching "any": 2 candidates +main debug: using audio volume module "float_mixer" +main debug: input 'f32l' 48000 Hz 3F2R/LFE frame=1 samples/24 bytes +main debug: looking for audio filter module matching "scaletempo": 14 candidates +scaletempo debug: format: 48000 rate, 6 nch, 4 bps, fl32 +scaletempo debug: params: 30 stride, 0.200 overlap, 14 search +scaletempo debug: 1.000 scale, 1440.000 stride_in, 1440 stride_out, 1152 standing, 288 overlap, 672 search, 2400 queue, fl32 mode +main debug: using audio filter module "scaletempo" +main debug: conversion: 'f32l'->'f32l' 48000 Hz->48000 Hz 3F2R/LFE->3F2R/LFE +main debug: conversion pipeline complete +main debug: conversion: 'f32l'->'f32l' 48000 Hz->48000 Hz 3F2R/LFE->Stereo +main debug: looking for audio converter module matching "any": 11 candidates +main debug: using audio converter module "simple_channel_mixer" +main debug: conversion pipeline complete +main debug: looking for audio resampler module matching "any": 2 candidates +main debug: using audio resampler module "ugly_resampler" +main debug: End of audio preroll +main debug: Decoder buffering done in 208 ms +main debug: VoutDisplayEvent 'resize' 2872x1622 window +main debug: VoutDisplayEvent 'resize' 2872x1622 window +main debug: VoutDisplayEvent 'resize' 2872x1626 window +main debug: VoutDisplayEvent 'resize' 2872x1626 window +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +main debug: VoutDisplayEvent 'resize' 2872x1626 window +main debug: VoutDisplayEvent 'resize' 2872x1634 window +main debug: VoutDisplayEvent 'resize' 2872x1634 window +main debug: VoutDisplayEvent 'resize' 2872x1634 window +main debug: VoutDisplayEvent 'resize' 2872x1638 window +main debug: VoutDisplayEvent 'resize' 2872x1638 window +avcodec warning: DEMUX_SET_POSITION: 208424910 +access_http debug: trying to seek to 92718985 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=92718985,remaining=370638595 +access_http debug: this frame size=370638595 +access_http debug: Connection: close +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 25% +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 44% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 49% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 53% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 57% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 61% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 74% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 78% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Stream buffering done (1002 ms in 89 ms) +main debug: Decoder buffering done in 9 ms +main warning: early picture skipped +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 208424910 +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 25% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 44% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 49% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 53% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 57% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 61% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 74% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 78% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Stream buffering done (1002 ms in 3 ms) +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 373 ms +main warning: picture is too late to be displayed (missing 79 ms) +main warning: picture is too late to be displayed (missing 38 ms) +main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1000 ms) +main error: ES_OUT_RESET_PCR called +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 2% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 6% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 10% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 23% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 27% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: End of audio preroll +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 77% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 81% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 85% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 89% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 98% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1026 ms in 4 ms) +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 41 ms +main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 4426 ms) +main error: ES_OUT_RESET_PCR called +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: End of audio preroll +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 18% +main debug: Buffering 18% +main debug: Buffering 18% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 98% +main debug: Buffering 98% +main debug: Buffering 98% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Stream buffering done (4439 ms in 14 ms) +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 23 ms +macosx debug: releasing sleep blocker (1807) +main warning: can't get output picture +avcodec warning: disabling direct rendering +main warning: early picture skipped +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 96036193 +access_http debug: trying to seek to 36732565 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=36732565,remaining=426625015 +access_http debug: this frame size=426625015 +access_http debug: Connection: close +avcodec debug: using direct rendering +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 18% +main debug: Buffering 18% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 98% +main debug: Buffering 98% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Stream buffering done (4438 ms in 17 ms) +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 523 ms +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main debug: discarded audio buffer +main debug: discarded audio buffer +main debug: discarded audio buffer +main debug: discarded audio buffer +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 96036193 +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 18% +main debug: Buffering 18% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 98% +main debug: Buffering 98% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Stream buffering done (4438 ms in 14 ms) +macosx debug: releasing old sleep blocker (1807) +macosx debug: prevented sleep through IOKit (1809) +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 500 ms +main warning: picture is too late to be displayed (missing 50 ms) +main debug: picture might be displayed late (missing 9 ms) +main warning: can't get output picture +avcodec warning: disabling direct rendering +main warning: early picture skipped +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 297701559 +access_http debug: trying to seek to 145084872 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=145084872,remaining=318272708 +access_http debug: this frame size=318272708 +access_http debug: Connection: close +macosx debug: Terminating +-- logger module stopped -- +-- logger module stopped -- +-- logger module started -- +main debug: VLC media player - 2.1.5 Rincewind +main debug: Copyright © 1996-2014 the VideoLAN team +main debug: revision 2.1.4-59-g5f258d5 +main debug: configured with ../extras/package/macosx/../../../configure '--prefix=/Users/fkuehne/Desktop/videolan/gits/vlc-2.1/release/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-audio' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-vout' '--disable-caca' '--disable-skins2' '--disable-xcb' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' '--build=x86_64-apple-darwin10' '--with-macosx-version-min=10.6' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CXX=xcrun clang++' 'OBJC=xcrun clang' +main debug: using interface module "logger" +main debug: looking for interface module matching "logger,none": 15 candidates +logger: using logger. +logger debug: opening logfile `vlc-log.txt' +-- logger module started -- +main debug: VLC media player - 2.1.5 Rincewind +main debug: Copyright © 1996-2014 the VideoLAN team +main debug: revision 2.1.4-59-g5f258d5 +main debug: configured with ../extras/package/macosx/../../../configure '--prefix=/Users/fkuehne/Desktop/videolan/gits/vlc-2.1/release/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-audio' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-vout' '--disable-caca' '--disable-skins2' '--disable-xcb' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' '--build=x86_64-apple-darwin10' '--with-macosx-version-min=10.6' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CXX=xcrun clang++' 'OBJC=xcrun clang' +main debug: using interface module "logger" +lua: Lua HTTP interface +main debug: Creating an input for 'Media Library' +main debug: creating VLM +lua debug: Loaded /Applications/VLC.app/Contents/MacOS/share/lua/http/custom.lua +main debug: net: listening to * port 8080 +main debug: Input is a meta file: disabling unneeded options +main debug: using timeshift granularity of 50 MiB, in path '/tmp' +main debug: `file/xspf-open:///Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' gives access `file' demux `xspf-open' path `/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' +main debug: creating demux: access='file' demux='xspf-open' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for access_demux module matching "file": 14 candidates +main debug: no access_demux modules matched +main debug: creating access 'file' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf', path='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for access module matching "file": 18 candidates +filesystem debug: opening file `/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: using access module "filesystem" +main debug: Using stream method for AStream* +main debug: starting pre-buffering +main debug: received first data after 0 ms +main debug: pre-buffering done 296 bytes in 0s - 13139 KiB/s +main debug: looking for stream_filter module matching "any": 9 candidates +main debug: no stream_filter modules matched +main debug: looking for stream_filter module matching "record": 9 candidates +main debug: using stream_filter module "record" +main debug: creating demux: access='file' demux='xspf-open' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for demux module matching "xspf-open": 63 candidates +playlist debug: using XSPF playlist reader +main debug: using demux module "playlist" +main debug: looking for meta reader module matching "any": 2 candidates +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/meta/reader +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader +main debug: no meta reader modules matched +main debug: `file/xspf-open:///Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' successfully opened +main debug: looking for xml reader module matching "any": 1 candidates +main debug: using xml reader module "xml" +playlist debug: parsed 0 tracks successfully +main debug: EOF reached +main debug: removing module "playlist" +main debug: removing module "record" +main debug: removing module "filesystem" +main debug: creating audio output +main debug: looking for audio output module matching "any": 4 candidates +auhal debug: found 2 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +main debug: restart requested (2) +main debug: using audio output module "auhal" +main debug: keeping audio output +main debug: adding item `http://localhost:8000/0' ( http://localhost:8000/0 ) +main debug: no fetch required for (null) (art currently (null)) +main debug: looking for interface module matching "hotkeys,none": 15 candidates +main debug: using interface module "hotkeys" +main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. +main debug: looking for interface module matching "any": 15 candidates +main debug: looking for services probe module matching "any": 5 candidates +main debug: no services probe modules matched +main debug: looking for extension module matching "any": 1 candidates +lua debug: Opening Lua Extension module +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/extensions +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/extensions +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac +lua debug: Scanning Lua script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac +lua debug: Script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac has the following capability flags: 0x5 +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/extensions +main debug: using extension module "lua" +macosx debug: Found 1 video capture devices +macosx debug: Found 1 audio capture devices +main debug: processing request item: http://localhost:8000/0, node: Playlist, skip: 0 +main debug: rebuilding array of current - root Playlist +main debug: rebuild done - 1 items, index 0 +main debug: starting playback of the new playlist item +main debug: resyncing on http://localhost:8000/0 +main debug: http://localhost:8000/0 is at 0 +main debug: creating new input thread +main debug: Creating an input for 'http://localhost:8000/0' +main debug: using timeshift granularity of 50 MiB, in path '/tmp' +main debug: `http://localhost:8000/0' gives access `http' demux `' path `localhost:8000/0' +main debug: creating demux: access='http' demux='' location='localhost:8000/0' file='(null)' +main debug: looking for access_demux module matching "http": 14 candidates +main debug: no access_demux modules matched +main debug: creating access 'http' location='localhost:8000/0', path='(null)' +main debug: looking for access module matching "http": 18 candidates +access_http debug: querying proxy for http://localhost:8000/0 +access_http debug: no proxy +access_http debug: http: server='localhost' port=8000 file='/0' +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +macosx debug: no optical media found +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=0,remaining=463357580 +access_http debug: this frame size=463357580 +access_http debug: Connection: close +main debug: using access module "access_http" +main debug: Using stream method for AStream* +main debug: starting pre-buffering +main debug: received first data after 0 ms +main debug: pre-buffering done 1024 bytes in 0s - 52631 KiB/s +main debug: looking for stream_filter module matching "any": 9 candidates +main debug: no stream_filter modules matched +main debug: looking for stream_filter module matching "record": 9 candidates +main debug: using stream_filter module "record" +main debug: creating demux: access='http' demux='' location='localhost:8000/0' file='(null)' +main debug: looking for demux module matching "any": 63 candidates +access_http debug: trying to seek to 462693989 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=462693989,remaining=663591 +access_http debug: this frame size=663591 +access_http debug: Connection: close +mp4 warning: unknown box type desc (incompletely loaded) +mp4 warning: MP4 plugin discarded (not fast-seekable) +access_http debug: trying to seek to 1536 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=1536,remaining=463356044 +access_http debug: this frame size=463356044 +access_http debug: Connection: close +ts debug: TS module discarded (lost sync) +mod debug: MOD validation failed (ext=) +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/playlist +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/playlist +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_streams.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_xml.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/appletrailers.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/bbc_co_uk.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/break.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/canalplus.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/cue.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/dailymotion.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/extreme.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/france2.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/googlevideo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/jamendo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/joox.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/katsomo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/koreus.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/lelombrik.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/liveleak.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metacafe.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metachannels.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mpora.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pinkbike.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pluzz.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/rockbox_fm_presets.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/soundcloud.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/vimeo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube_homepage.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/zapiks.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/playlist +avcodec debug: trying url: http://localhost:8000/0 +avcodec debug: detected format: mov,mp4,m4a,3gp,3g2,mj2 +access_http debug: trying to seek to 463357580 +access_http error: seek too far +access_http debug: trying to seek to 463357579 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: this frame size=1 +access_http debug: Connection: close +access_http debug: trying to seek to 48072 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=48072,remaining=463309508 +access_http debug: this frame size=463309508 +access_http debug: Connection: close +main debug: selecting program id=0 +avcodec debug: adding es: video codec = h264 (28) +avcodec debug: adding es: audio codec = mp4a (86018) +avcodec debug: AVFormat supported stream +avcodec debug: - format = mov,mp4,m4a,3gp,3g2,mj2 (QuickTime / MOV) +avcodec debug: - start time = 0 +avcodec debug: - duration = 888064000 +main debug: using demux module "avcodec" +main debug: looking for decoder module matching "any": 37 candidates +avcodec debug: trying to use direct rendering +avcodec debug: allowing 4 thread(s) for decoding +avcodec debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started +avcodec debug: using frame thread mode with 4 threads +main debug: using decoder module "avcodec" +main debug: looking for decoder module matching "any": 37 candidates +main debug: using decoder module "faad" +main debug: looking for meta reader module matching "any": 2 candidates +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/meta/reader +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader +main debug: no meta reader modules matched +main debug: `http://localhost:8000/0' successfully opened +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 2% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 6% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 10% +main debug: Buffering 12% +main debug: looking for text renderer module matching "any": 3 candidates +main debug: Buffering 12% +main debug: Buffering 14% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 23% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 27% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 32% +main debug: Buffering 33% +faad warning: decoded zero sample +main debug: Buffering 33% +freetype debug: looking for Arial Unicode MS +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +freetype debug: found /Library/Fonts/Arial Unicode.ttf +freetype debug: Using Arial Unicode MS as font from file /Library/Fonts/Arial Unicode.ttf +main debug: Buffering 75% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 87% +freetype debug: using fontsize: 2 +main debug: Buffering 87% +main debug: using text renderer module "freetype" +main debug: Buffering 89% +main debug: looking for video filter2 module matching "any": 54 candidates +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 93% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 98% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1024 ms in 2 ms) +swscale debug: 32x32 chroma: YUVA -> 16x16 chroma: RGBA with scaling using Bicubic (good quality) +main debug: using video filter2 module "swscale" +main debug: looking for video filter2 module matching "any": 54 candidates +yuvp debug: YUVP to YUVA converter +main debug: using video filter2 module "yuvp" +main debug: Deinterlacing available +main debug: deinterlace 0, mode blend, is_needed 0 +main debug: Opening vout display wrapper +main debug: looking for vout display module matching "any": 5 candidates +main debug: looking for vout window nsobject module matching "any": 1 candidates +macosx debug: prevented sleep through IOKit (1810) +macosx debug: returning videoview with proposed position x=0, y=0, width=2048, height=872 +main debug: using vout window nsobject module "macosx" +macosx debug: toggle playlist from state: removed splitview 0, minimized view 0. Sender is 0x0, unhide video view 0 +macosx debug: toggle playlist to state: removed splitview 0, minimized view 0 +macosx debug: releasing old sleep blocker (1810) +macosx debug: prevented sleep through IOKit (1812) +main debug: VoutDisplayEvent 'resize' 2048x872 window +main debug: using vout display module "vout_macosx" +main debug: original format sz 2048x872, of (0,0), vsz 2048x872, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0 +main debug: removing module "freetype" +main debug: looking for text renderer module matching "any": 3 candidates +freetype debug: looking for Arial Unicode MS +main debug: VoutDisplayEvent 'resize' 2872x1638 window +freetype debug: found /Library/Fonts/Arial Unicode.ttf +freetype debug: Using Arial Unicode MS as font from file /Library/Fonts/Arial Unicode.ttf +freetype debug: using fontsize: 2 +main debug: using text renderer module "freetype" +main debug: reusing audio output +avcodec debug: using direct rendering +main debug: VLC is looking for: 'f32l' 48000 Hz 3F2R/LFE frame=1 samples/24 bytes +auhal debug: attempting to use device 0 +auhal debug: using default audio device 38 +auhal debug: found 16 stream formats for stream id 39 +auhal debug: Audio device supports PCM mode only +main debug: End of video preroll +main debug: Received first picture +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +auhal debug: current format is: [44100.000000][mcpl][9][8][1][8][2][32] +auhal debug: layout of AUHAL has 2 channels +auhal debug: selected 2 physical channels for device output +auhal debug: VLC will output: Stereo +auhal debug: we set the AU format: [48000.000000][mcpl][9][8][1][8][2][32] +auhal debug: the actual set AU format is [48000.000000][mcpl][9][8][1][8][2][32] +auhal debug: analog output successfully opened +main debug: output 'f32l' 48000 Hz Stereo frame=1 samples/8 bytes +main debug: looking for audio volume module matching "any": 2 candidates +main debug: using audio volume module "float_mixer" +main debug: input 'f32l' 48000 Hz 3F2R/LFE frame=1 samples/24 bytes +main debug: looking for audio filter module matching "scaletempo": 14 candidates +scaletempo debug: format: 48000 rate, 6 nch, 4 bps, fl32 +scaletempo debug: params: 30 stride, 0.200 overlap, 14 search +scaletempo debug: 1.000 scale, 1440.000 stride_in, 1440 stride_out, 1152 standing, 288 overlap, 672 search, 2400 queue, fl32 mode +main debug: using audio filter module "scaletempo" +main debug: conversion: 'f32l'->'f32l' 48000 Hz->48000 Hz 3F2R/LFE->3F2R/LFE +main debug: conversion pipeline complete +main debug: conversion: 'f32l'->'f32l' 48000 Hz->48000 Hz 3F2R/LFE->Stereo +main debug: looking for audio converter module matching "any": 11 candidates +main debug: using audio converter module "simple_channel_mixer" +main debug: conversion pipeline complete +main debug: looking for audio resampler module matching "any": 2 candidates +main debug: using audio resampler module "ugly_resampler" +main debug: End of audio preroll +main debug: VoutDisplayEvent 'resize' 2872x1638 window +main debug: Decoder buffering done in 190 ms +main debug: VoutDisplayEvent 'resize' 2872x1638 window +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +avcodec warning: DEMUX_SET_POSITION: 405077764 +access_http debug: trying to seek to 208453228 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=208453228,remaining=254904352 +access_http debug: this frame size=254904352 +access_http debug: Connection: close +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: End of video preroll +main debug: Buffering 12% +main debug: Received first picture +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 22% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: End of audio preroll +main debug: Buffering 27% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 31% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 35% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 39% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 48% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 52% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 56% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 99% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1039 ms in 575 ms) +main debug: Decoder buffering done in 0 ms +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 405077764 +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 22% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 27% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 31% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 35% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 39% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 48% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 52% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 56% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 99% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1039 ms in 5 ms) +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 142 ms +main warning: picture is too late to be displayed (missing 96 ms) +main warning: picture is too late to be displayed (missing 54 ms) +main debug: picture might be displayed late (missing 13 ms) +main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1000 ms) +main error: ES_OUT_RESET_PCR called +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 2% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 6% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 10% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 23% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 28% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: End of audio preroll +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 77% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 81% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 85% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 89% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 98% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1026 ms in 2 ms) +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 36 ms +macosx debug: releasing sleep blocker (1812) +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 3 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: DevID: 60 DevName: HDMI +auhal debug: found 9 stream formats for stream id 61 +auhal debug: default device changed to 60 +auhal debug: default device actually changed, resetting aout +main debug: restart requested (2) +main debug: VoutDisplayEvent 'resize' 2872x1638 window +main debug: VoutDisplayEvent 'resize' 2872x1638 window +main debug: VoutDisplayEvent 'resize' 1436x819 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 2 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: default device changed to 38 +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 3 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: DevID: 64 DevName: HDMI +auhal debug: found 21 stream formats for stream id 65 +auhal debug: default device changed to 64 +auhal debug: default device actually changed, resetting aout +main debug: restart requested (2) +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 2 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: default device changed to 38 +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 3 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: DevID: 68 DevName: HDMI +auhal debug: found 21 stream formats for stream id 69 +auhal debug: default device changed to 68 +auhal debug: default device actually changed, resetting aout +main debug: restart requested (2) +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +macosx debug: Terminating +-- logger module stopped -- +-- logger module stopped -- diff --git a/node_modules/minimist/.travis.yml b/node_modules/minimist/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/minimist/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/minimist/LICENSE b/node_modules/minimist/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/minimist/example/parse.js b/node_modules/minimist/example/parse.js new file mode 100644 index 00000000..abff3e8e --- /dev/null +++ b/node_modules/minimist/example/parse.js @@ -0,0 +1,2 @@ +var argv = require('../')(process.argv.slice(2)); +console.dir(argv); diff --git a/node_modules/minimist/index.js b/node_modules/minimist/index.js new file mode 100644 index 00000000..185a0455 --- /dev/null +++ b/node_modules/minimist/index.js @@ -0,0 +1,219 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {}, unknownFn: null }; + + if (typeof opts['unknown'] === 'function') { + flags.unknownFn = opts['unknown']; + } + + if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { + flags.allBools = true; + } else { + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + flags.strings[aliases[key]] = true; + } + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function argDefined(key, arg) { + return (flags.allBools && /^--[^=]+$/.test(arg)) || + flags.strings[key] || flags.bools[key] || aliases[key]; + } + + function setArg (key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) return; + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + function setKey (obj, keys, value) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + if (o[key] === undefined) o[key] = {}; + o = o[key]; + }); + + var key = keys[keys.length - 1]; + if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + setArg(m[1], m[2], arg); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, next, arg); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next, arg) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2), arg); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, args[i+1], arg); + i++; + } + else if (args[i+1] && /true|false/.test(args[i+1])) { + setArg(key, args[i+1] === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } + else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + if (opts['--']) { + argv['--'] = new Array(); + notFlags.forEach(function(key) { + argv['--'].push(key); + }); + } + else { + notFlags.forEach(function(key) { + argv._.push(key); + }); + } + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +} + diff --git a/node_modules/minimist/package.json b/node_modules/minimist/package.json new file mode 100644 index 00000000..41c9c731 --- /dev/null +++ b/node_modules/minimist/package.json @@ -0,0 +1,71 @@ +{ + "name": "minimist", + "version": "1.1.1", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "covert": "^1.0.0", + "tap": "~0.4.0", + "tape": "^3.5.0" + }, + "scripts": { + "test": "tap test/*.js", + "coverage": "covert test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "gitHead": "bc9d1c466541eb52ae85e6682a4b809f4c32fe1f", + "bugs": { + "url": "https://github.com/substack/minimist/issues" + }, + "_id": "minimist@1.1.1", + "_shasum": "1bc2bc71658cdca5712475684363615b0b4f695b", + "_from": "minimist@1.1.1", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "dist": { + "shasum": "1bc2bc71658cdca5712475684363615b0b4f695b", + "tarball": "http://registry.npmjs.org/minimist/-/minimist-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/minimist/readme.markdown b/node_modules/minimist/readme.markdown new file mode 100644 index 00000000..30a74cf8 --- /dev/null +++ b/node_modules/minimist/readme.markdown @@ -0,0 +1,91 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist) + +[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist) + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.dir(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +``` +> require('./')('one two three -- four five --six'.split(' '), { '--': true }) +{ _: [ 'one', 'two', 'three' ], + '--': [ 'four', 'five', '--six' ] } +``` + +Note that with `opts['--']` set, parsing for arguments still stops after the +`--`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/node_modules/minimist/test/all_bool.js b/node_modules/minimist/test/all_bool.js new file mode 100644 index 00000000..ac835483 --- /dev/null +++ b/node_modules/minimist/test/all_bool.js @@ -0,0 +1,32 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean true (default all --args to boolean)', function (t) { + var argv = parse(['moo', '--honk', 'cow'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); + +test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { + var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + tacos: 'good', + p: 55, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); diff --git a/node_modules/minimist/test/bool.js b/node_modules/minimist/test/bool.js new file mode 100644 index 00000000..749e083c --- /dev/null +++ b/node_modules/minimist/test/bool.js @@ -0,0 +1,119 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false } + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { + boolean: ['x','y','z'] + }); + + t.deepEqual(argv, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ] + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + alias: { 'h': 'herp' }, + boolean: 'herp' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); diff --git a/node_modules/minimist/test/dash.js b/node_modules/minimist/test/dash.js new file mode 100644 index 00000000..5a4fa5be --- /dev/null +++ b/node_modules/minimist/test/dash.js @@ -0,0 +1,31 @@ +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(5); + t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); + t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); + t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); + t.deepEqual( + parse([ '-b', '-' ], { boolean: 'b' }), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + parse([ '-s', '-' ], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(3); + t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); +}); + +test('move arguments after the -- into their own `--` array', function(t) { + t.plan(1); + t.deepEqual( + parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }), + { name: 'John', _: [ 'before' ], '--': [ 'after' ] }); +}); diff --git a/node_modules/minimist/test/default_bool.js b/node_modules/minimist/test/default_bool.js new file mode 100644 index 00000000..780a3112 --- /dev/null +++ b/node_modules/minimist/test/default_bool.js @@ -0,0 +1,35 @@ +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true } + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false } + }); + t.equal(argv.somefalse, false); + t.end(); +}); + +test('boolean default to null', function (t) { + var argv = parse([], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, null); + var argv = parse(['--maybe'], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, true); + t.end(); + +}) diff --git a/node_modules/minimist/test/dotted.js b/node_modules/minimist/test/dotted.js new file mode 100644 index 00000000..d8b3e856 --- /dev/null +++ b/node_modules/minimist/test/dotted.js @@ -0,0 +1,22 @@ +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); + +test('dotted default with no alias', function (t) { + var argv = parse('', {default: {'a.b': 11}}); + t.equal(argv.a.b, 11); + t.end(); +}); diff --git a/node_modules/minimist/test/long.js b/node_modules/minimist/test/long.js new file mode 100644 index 00000000..5d3a1e09 --- /dev/null +++ b/node_modules/minimist/test/long.js @@ -0,0 +1,31 @@ +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse([ '--bool' ]), + { bool : true, _ : [] }, + 'long boolean' + ); + t.deepEqual( + parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture sp' + ); + t.deepEqual( + parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture eq' + ); + t.deepEqual( + parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures sp' + ); + t.deepEqual( + parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/node_modules/minimist/test/num.js b/node_modules/minimist/test/num.js new file mode 100644 index 00000000..2cc77f4d --- /dev/null +++ b/node_modules/minimist/test/num.js @@ -0,0 +1,36 @@ +var parse = require('../'); +var test = require('tape'); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789' + ]); + t.deepEqual(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ] + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('already a number', function (t) { + var argv = parse([ '-x', 1234, 789 ]); + t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); diff --git a/node_modules/minimist/test/parse.js b/node_modules/minimist/test/parse.js new file mode 100644 index 00000000..7b4a2a17 --- /dev/null +++ b/node_modules/minimist/test/parse.js @@ -0,0 +1,197 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse([ '--no-moo' ]), + { moo : false, _ : [] }, + 'no' + ); + t.deepEqual( + parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ] + } + ); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse([ '-t', 'moo' ], { boolean: 't' }); + t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: [ 't', 'verbose' ], + default: { verbose: true } + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = parse([ '-s', "X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse([ "--s=X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + t.end(); +}); + +test('strings' , function (t) { + var s = parse([ '-s', '0001234' ], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse([ '-x', '56' ], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([ ' ', ' ' ], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function(t) { + var s = parse([ '-s' ], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse([ '--str' ], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse([ '-art' ], { + string: [ 'a', 't' ] + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + + +test('string and alias', function(t) { + var x = parse([ '--str', '000123' ], { + string: 's', + alias: { s: 'str' } + }); + + t.equal(x.str, '000123'); + t.equal(typeof x.str, 'string'); + t.equal(x.s, '000123'); + t.equal(typeof x.s, 'string'); + + var y = parse([ '-s', '000123' ], { + string: 'str', + alias: { str: 's' } + }); + + t.equal(y.str, '000123'); + t.equal(typeof y.str, 'string'); + t.equal(y.s, '000123'); + t.equal(typeof y.s, 'string'); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [] } + ); + t.same( + parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: 'zoom' } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: [ 'zm', 'zoom' ] } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]); + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + } + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); diff --git a/node_modules/minimist/test/parse_modified.js b/node_modules/minimist/test/parse_modified.js new file mode 100644 index 00000000..ab620dc5 --- /dev/null +++ b/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,9 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = parse([ '-b', '123' ], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: [123] }); +}); diff --git a/node_modules/minimist/test/short.js b/node_modules/minimist/test/short.js new file mode 100644 index 00000000..d513a1c2 --- /dev/null +++ b/node_modules/minimist/test/short.js @@ -0,0 +1,67 @@ +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); + t.deepEqual( + parse([ '-123', '456' ]), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse([ '-b' ]), + { b : true, _ : [] }, + 'short boolean' + ); + t.deepEqual( + parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ] }, + 'bare' + ); + t.deepEqual( + parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [] }, + 'group' + ); + t.deepEqual( + parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [] }, + 'short group next' + ); + t.deepEqual( + parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [] }, + 'short capture' + ); + t.deepEqual( + parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); diff --git a/node_modules/minimist/test/stop_early.js b/node_modules/minimist/test/stop_early.js new file mode 100644 index 00000000..bdf9fbcb --- /dev/null +++ b/node_modules/minimist/test/stop_early.js @@ -0,0 +1,15 @@ +var parse = require('../'); +var test = require('tape'); + +test('stops parsing on the first non-option when stopEarly is set', function (t) { + var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { + stopEarly: true + }); + + t.deepEqual(argv, { + aaa: 'bbb', + _: ['ccc', '--ddd'] + }); + + t.end(); +}); diff --git a/node_modules/minimist/test/unknown.js b/node_modules/minimist/test/unknown.js new file mode 100644 index 00000000..462a36bd --- /dev/null +++ b/node_modules/minimist/test/unknown.js @@ -0,0 +1,102 @@ +var parse = require('../'); +var test = require('tape'); + +test('boolean and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'true', '--derp', 'true' ]; + var regular = [ '--herp', 'true', '-d', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('flag boolean true any double hyphen argument is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { + boolean: true, + unknown: unknownFn + }); + t.same(unknown, ['--tacos=good', 'cow', '-p']); + t.same(argv, { + honk: true, + _: [] + }); + t.end(); +}); + +test('string and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello', '--derp', 'goodbye' ]; + var regular = [ '--herp', 'hello', '-d', 'moon' ]; + var opts = { + alias: { h: 'herp' }, + string: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('default and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello' ]; + var regular = [ '--herp', 'hello' ]; + var opts = { + default: { 'h': 'bar' }, + alias: { 'h': 'herp' }, + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, []); + t.end(); + unknownFn(); // exercise fn for 100% coverage +}); + +test('value following -- is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '--bad', '--', 'good', 'arg' ]; + var opts = { + '--': true, + unknown: unknownFn + }; + var argv = parse(aliased, opts); + + t.same(unknown, ['--bad']); + t.same(argv, { + '--': ['good', 'arg'], + '_': [] + }) + t.end(); +}); diff --git a/node_modules/minimist/test/whitespace.js b/node_modules/minimist/test/whitespace.js new file mode 100644 index 00000000..8a52a58c --- /dev/null +++ b/node_modules/minimist/test/whitespace.js @@ -0,0 +1,8 @@ +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/node_modules/once/LICENSE b/node_modules/once/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/once/README.md b/node_modules/once/README.md new file mode 100644 index 00000000..a2981ea0 --- /dev/null +++ b/node_modules/once/README.md @@ -0,0 +1,51 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` diff --git a/node_modules/once/node_modules/wrappy/LICENSE b/node_modules/once/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/once/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/once/node_modules/wrappy/README.md b/node_modules/once/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/once/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/once/node_modules/wrappy/package.json b/node_modules/once/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/once/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/once/node_modules/wrappy/test/basic.js b/node_modules/once/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/once/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/once/node_modules/wrappy/wrappy.js b/node_modules/once/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/once/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/once/once.js b/node_modules/once/once.js new file mode 100644 index 00000000..2e1e721b --- /dev/null +++ b/node_modules/once/once.js @@ -0,0 +1,21 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} diff --git a/node_modules/once/package.json b/node_modules/once/package.json new file mode 100644 index 00000000..39887f83 --- /dev/null +++ b/node_modules/once/package.json @@ -0,0 +1,60 @@ +{ + "name": "once", + "version": "1.3.2", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "~0.3.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once.git" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "gitHead": "e35eed5a7867574e2bf2260a1ba23970958b22f2", + "bugs": { + "url": "https://github.com/isaacs/once/issues" + }, + "homepage": "https://github.com/isaacs/once#readme", + "_id": "once@1.3.2", + "_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "_from": "once@1.3.2", + "_npmVersion": "2.9.1", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "tarball": "http://registry.npmjs.org/once/-/once-1.3.2.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "_resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/once/test/once.js b/node_modules/once/test/once.js new file mode 100644 index 00000000..c618360d --- /dev/null +++ b/node_modules/once/test/once.js @@ -0,0 +1,23 @@ +var test = require('tap').test +var once = require('../once.js') + +test('once', function (t) { + var f = 0 + function fn (g) { + t.equal(f, 0) + f ++ + return f + g + this + } + fn.ownProperty = {} + var foo = once(fn) + t.equal(fn.ownProperty, foo.ownProperty) + t.notOk(foo.called) + for (var i = 0; i < 1E3; i++) { + t.same(f, i === 0 ? 0 : 1) + var g = foo.call(1, 1) + t.ok(foo.called) + t.same(g, 3) + t.same(f, 1) + } + t.end() +}) diff --git a/node_modules/parse-torrent/.travis.yml b/node_modules/parse-torrent/.travis.yml new file mode 100644 index 00000000..6426c2ec --- /dev/null +++ b/node_modules/parse-torrent/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - '0.10' +env: + global: + - secure: lLh4WEpXrERVSJlpDLA0PQ+wRG4ascs3oydkiGV3VQ0G5vTrsTzrCGy3ZTt9q9L28ThKGt5n9VIKOVFahNEM9AWuim/9scXo+bCMttlWctAudw/jtxhr1vZqPw+lb+ZVsWaexv+OgoVwzY12eVP+jh1iGr7M1PcmDh8ardDyGQ0= + - secure: DP949nTUjP1b92+Xq9JfWgaoVU7GWcWhLo6zuQpTv5Y06N6/677Z926SghysdA/OO8OYtHemPIc096oYIBKzK0Lhe772l7f/Lse81gJ78ggWaFrOGZWZ32KapWqVuOxn4OPXn8tBRPrvNN4ApB3I8gY/mfGkPfRnmOIfA2nDZrU= diff --git a/node_modules/parse-torrent/.zuul.yml b/node_modules/parse-torrent/.zuul.yml new file mode 100644 index 00000000..ce252299 --- /dev/null +++ b/node_modules/parse-torrent/.zuul.yml @@ -0,0 +1,10 @@ +ui: tape +browsers: + - name: chrome + version: 38..latest + - name: firefox + version: 33..latest + - name: safari + version: 7..latest + - name: ie + version: 11..latest diff --git a/node_modules/parse-torrent/LICENSE b/node_modules/parse-torrent/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/parse-torrent/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/parse-torrent/README.md b/node_modules/parse-torrent/README.md new file mode 100644 index 00000000..360b7b25 --- /dev/null +++ b/node_modules/parse-torrent/README.md @@ -0,0 +1,145 @@ +# parse-torrent [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] + +[travis-image]: https://img.shields.io/travis/feross/parse-torrent.svg?style=flat +[travis-url]: https://travis-ci.org/feross/parse-torrent +[npm-image]: https://img.shields.io/npm/v/parse-torrent.svg?style=flat +[npm-url]: https://npmjs.org/package/parse-torrent +[downloads-image]: https://img.shields.io/npm/dm/parse-torrent.svg?style=flat +[downloads-url]: https://npmjs.org/package/parse-torrent + +### Parse a torrent identifier (magnet uri, .torrent file, info hash) + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/parse-torrent.svg)](https://saucelabs.com/u/parse-torrent) + +Works in node and the browser (with [browserify](http://browserify.org/)). This module is used by [WebTorrent](http://webtorrent.io)! + +## install + +``` +npm install parse-torrent +``` + +## usage + +### parse + +The return value of `parseTorrent` will contain as much info as possible about the +torrent. The only property that is guaranteed to be present is `infoHash`. + +```js +var parseTorrent = require('parse-torrent') + +// info hash (as a hex string) +parseTorrent('d2474e86c95b19b8bcfdb92bc12c9d44667cfa36') +// { infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36' } + +// info hash (as a Buffer) +parseTorrent(new Buffer('d2474e86c95b19b8bcfdb92bc12c9d44667cfa36', 'hex')) +// { infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36' } + +// magnet uri (as a utf8 string) +parseTorrent('magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36') +// { xt: 'urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36', +// infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36' } + +// magnet uri with torrent name +parseTorrent('magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves%20of%20Grass%20by%20Walt%20Whitman.epub') +// { xt: 'urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36', +// dn: 'Leaves of Grass by Walt Whitman.epub', +// infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', +// name: 'Leaves of Grass by Walt Whitman.epub' } + +// magnet uri with trackers +parseTorrent('magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce') +// { xt: 'urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36', +// tr: 'http://tracker.thepiratebay.org/announce', +// infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', +// announce: [ 'http://tracker.thepiratebay.org/announce' ] } + +// .torrent file (as a Buffer) +parseTorrent(fs.readFileSync(__dirname + '/torrents/leaves.torrent')) +// { info: +// { length: 362017, +// name: , +// 'piece length': 16384, +// pieces: }, +// infoBuffer: , +// infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', +// name: 'Leaves of Grass by Walt Whitman.epub', +// private: false, +// created: Thu Aug 01 2013 06:27:46 GMT-0700 (PDT), +// comment: 'Downloaded from http://TheTorrent.org', +// announceList: +// [ [ 'http://tracker.thepiratebay.org/announce' ], +// [ 'udp://tracker.openbittorrent.com:80' ], +// [ 'udp://tracker.ccc.de:80' ], +// [ 'udp://tracker.publicbt.com:80' ], +// [ 'udp://fr33domtracker.h33t.com:3310/announce', +// 'http://tracker.bittorrent.am/announce' ] ], +// announce: +// [ 'http://tracker.thepiratebay.org/announce', +// 'udp://tracker.openbittorrent.com:80', +// 'udp://tracker.ccc.de:80', +// 'udp://tracker.publicbt.com:80', +// 'udp://fr33domtracker.h33t.com:3310/announce', +// 'http://tracker.bittorrent.am/announce' ], +// urlList: [], +// files: +// [ { path: 'Leaves of Grass by Walt Whitman.epub', +// name: 'Leaves of Grass by Walt Whitman.epub', +// length: 362017, +// offset: 0 } ], +// length: 362017, +// pieceLength: 16384, +// lastPieceLength: 1569, +// pieces: +// [ '1f9c3f59beec079715ec53324bde8569e4a0b4eb', +// 'ec42307d4ce5557b5d3964c5ef55d354cf4a6ecc', +// '7bf1bcaf79d11fa5e0be06593c8faafc0c2ba2cf', +// '76d71c5b01526b23007f9e9929beafc5151e6511', +// '0931a1b44c21bf1e68b9138f90495e690dbc55f5', +// '72e4c2944cbacf26e6b3ae8a7229d88aafa05f61', +// 'eaae6abf3f07cb6db9677cc6aded4dd3985e4586', +// '27567fa7639f065f71b18954304aca6366729e0b', +// '4773d77ae80caa96a524804dfe4b9bd3deaef999', +// 'c9dd51027467519d5eb2561ae2cc01467de5f643', +// '0a60bcba24797692efa8770d23df0a830d91cb35', +// 'b3407a88baa0590dc8c9aa6a120f274367dcd867', +// 'e88e8338c572a06e3c801b29f519df532b3e76f6', +// '70cf6aee53107f3d39378483f69cf80fa568b1ea', +// 'c53b506159e988d8bc16922d125d77d803d652c3', +// 'ca3070c16eed9172ab506d20e522ea3f1ab674b3', +// 'f923d76fe8f44ff32e372c3b376564c6fb5f0dbe', +// '52164f03629fd1322636babb2c014b7dae582da4', +// '1363965261e6ce12b43701f0a8c9ed1520a70eba', +// '004400a267765f6d3dd5c7beb5bd3c75f3df2a54', +// '560a61801147fa4ec7cf568e703acb04e5610a4d', +// '56dcc242d03293e9446cf5e457d8eb3d9588fd90', +// 'c698de9b0dad92980906c026d8c1408fa08fe4ec' ] } +``` + +### encode + +The reverse works too. To convert an object of keys/value to a magnet uri or .torrent file +buffer, use `toMagnetURI` and `toTorrentFile`. + +```js +var parseTorrent = require('parse-torrent') + +var uri = parseTorrent.toMagnetURI({ + infoHash: 'urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36' +}) +console.log(uri) // 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36' + +var buf = parseTorrent.toTorrentFile({ + info: { + /* ... */ + } +}) +console.log(buf) + +``` + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/parse-torrent/bin/cmd.js b/node_modules/parse-torrent/bin/cmd.js new file mode 100755 index 00000000..c2655b16 --- /dev/null +++ b/node_modules/parse-torrent/bin/cmd.js @@ -0,0 +1,45 @@ +#!/usr/bin/env node + +var fs = require('fs') +var parseTorrent = require('../') + +function usage () { + console.error('Usage: parse-torrent /path/to/torrent') + console.error(' parse-torrent magnet_uri') +} + +function error (err) { + if (err) console.error(err.message) + usage() +} + +var torrentId = process.argv[2] + +if (!torrentId) { + usage() + process.exit(1) +} + +var parsedTorrent +try { + parsedTorrent = parseTorrent(torrentId) +} catch (err1) { + var file + try { + file = fs.readFileSync(torrentId) + } catch (err2) { + error(err1) + process.exit(1) + } + try { + parsedTorrent = parseTorrent(file) + } catch (err2) { + error(err2) + process.exit(1) + } +} + +delete parsedTorrent.info +delete parsedTorrent.infoBuffer + +console.log(JSON.stringify(parsedTorrent, undefined, 2)) diff --git a/node_modules/parse-torrent/bundle.js b/node_modules/parse-torrent/bundle.js new file mode 100644 index 00000000..70f2937a --- /dev/null +++ b/node_modules/parse-torrent/bundle.js @@ -0,0 +1,7059 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0) { + // could this case even occur? + throw new Error("uneven number of keys and values B") + } + } + this.result = function () { + return stack + } + } + + var self = this, + ctx = new Context(), + smachine = new BdecodeSMachine(ctx.cb, ctx.cb_list, ctx.cb_dict, ctx.cb_end) + + this.result = function () { + if (!smachine.consistent()) { + throw new Error("not in consistent state. More bytes coming?") + } + return ctx.result() + } + + this.decode = function(buf, encoding) { + smachine.parse(buf, encoding) + } +} + +var Bencode = function(obj) { + var self = this + var to_encode = obj + var buffer = null + + switch (typeof (obj) ) { + case "string": + return encodeString(obj) + case "number": + return encodeNumber(obj) + break + case "object": + if (obj instanceof Array) { + return encodeList(obj) + } else if (Buffer.isBuffer(obj)) { + return encodeBuffer(obj) + } + + { + // assume it's a hash + return encodeDict(obj) + } + } + + function encodeString(obj) { + var blen = Buffer.byteLength(obj), + len = blen.toString(10), + buf = new Buffer(len.length + 1 + blen) + + buf.write(len, 0, "ascii") + buf.write(":", len.length, "ascii") + buf.write(obj, len.length+1, "utf8") + + return buf + } + + function encodeNumber(num) { + var n = num.toString(10), + buf = new Buffer(n.length+2) + + buf.write("i", 0) + buf.write(n, 1) + buf.write("e", n.length+1) + + return buf + } + + function encodeDict(obj) { + var func = function (obj, pos) { + var keys = Object.keys(obj).sort() + for (var i in keys) { + var key = Bencode(keys[i]), + val = Bencode(obj[keys[i]]) + ensure(key.length + val.length, pos) + key.copy(buffer, pos, 0) + pos += key.length + val.copy(buffer, pos, 0) + pos += val.length + } + return pos + } + return assemble(obj, "d", func) + } + + function encodeList(obj) { + var func = function(obj, pos) { + obj.forEach (function(o){ + var elem = Bencode(o) + + ensure(elem.length, pos) + elem.copy(buffer, pos, 0) + pos += elem.length + }) + return pos + } + return assemble(obj, "l", func) + } + + function encodeBuffer(obj) { + var len = obj.length.toString(10), + buf = new Buffer(len.length+1+obj.length); + + buf.write(len, 0, "ascii") + buf.write(":", len.length, "ascii") + obj.copy(buf, len.length+1, 0) + + return buf + } + + function assemble (obj, prefix, func) { + var pos = 0 + + ensure(1024, 0) + buffer.write(prefix, pos++) + + pos = func(obj, pos) + ensure(1, pos) + + buffer.write("e", pos++) + return buffer.slice(0, pos) + } + + function ensure (num, pos) { + if (!buffer) { + buffer = new Buffer(num) + } else { + if (buffer.length > num+pos+1) { + return + } else { + var buf2 = new Buffer(buffer.length + num) + buffer.copy(buf2, 0, 0) + buffer = buf2 + } + } + } +} + +function decode (buffer, encoding) { + var decoder = new Bdecode() + + decoder.decode(buffer, encoding) + return decoder.result()[0] +} + +function Stream (options) { + options = options || {}; + options.objectMode = true; + Transform.call(this, options); + this._decoder = new Bdecode() +} + +inherits(Stream, Transform); + +Stream.prototype._transform = function (chunk, encoding, callback) { + try { + this._decoder.decode(chunk, encoding) + callback(null); + } catch(err) { + callback(err); + } +} + +Stream.prototype._flush = function (callback) { + this.push(this._decoder.result()[0]); + callback(null); +} + +exports.encode = Bencode +exports.decoder = Bdecode +exports.decode = decode +exports.Stream = Stream + + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),require("buffer").Buffer) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"buffer":20,"stream":28,"util":36}],3:[function(require,module,exports){ +(function (global){ + + +(function () { + + // If we'e running in Node.JS, export a module. + if (typeof module !== 'undefined') { + module.exports = Rusha; + } + + // If we're running in a DOM context, export + // the Rusha object to toplevel. + if (typeof window !== 'undefined') { + window.Rusha = Rusha; + } + + // If we're running in a webworker, accept + // messages containing a jobid and a buffer + // or blob object, and return the hash result. + if (typeof FileReaderSync !== 'undefined') { + var reader = new FileReaderSync(), + hasher = new Rusha(4 * 1024 * 1024); + self.onmessage = function onMessage (event) { + var hash, data = event.data.data; + if (data instanceof Blob) { + try { + data = reader.readAsBinaryString(data); + } catch (e) { + self.postMessage({id: event.data.id, error: e.name}); + return; + } + } + hash = hasher.digest(data); + self.postMessage({id: event.data.id, hash: hash}); + }; + } + + // The Rusha object is a wrapper around the low-level RushaCore. + // It provides means of converting different inputs to the + // format accepted by RushaCore as well as other utility methods. + function Rusha (sizeHint) { + "use strict"; + + // Private object structure. + var self = {fill: 0}; + + // Calculate the length of buffer that the sha1 routine uses + // including the padding. + var padlen = function (len) { + return len + 1 + ((len ) % 64 < 56 ? 56 : 56 + 64) - (len ) % 64 + 8; + }; + + var padZeroes = function (bin, len) { + for (var i = len >> 2; i < bin.length; i++) bin[i] = 0; + }; + + var padData = function (bin, len) { + bin[len>>2] |= 0x80 << (24 - (len % 4 << 3)); + bin[(((len >> 2) + 2) & ~0x0f) + 15] = len << 3; + }; + + // Convert a binary string to a big-endian Int32Array using + // four characters per slot and pad it per the sha1 spec. + // A binary string is expected to only contain char codes < 256. + var convStr = function (str, bin, len) { + var i; + for (i = 0; i < len; i = i + 4 |0) { + bin[i>>2] = str.charCodeAt(i) << 24 | + str.charCodeAt(i+1) << 16 | + str.charCodeAt(i+2) << 8 | + str.charCodeAt(i+3); + } + }; + + // Convert a buffer or array to a big-endian Int32Array using + // four elements per slot and pad it per the sha1 spec. + // The buffer or array is expected to only contain elements < 256. + var convBuf = function (buf, bin, len) { + var i, m = len % 4, j = len - m; + for (i = 0; i < j; i = i + 4 |0) { + bin[i>>2] = buf[i] << 24 | + buf[i+1] << 16 | + buf[i+2] << 8 | + buf[i+3]; + } + switch (m) { + case 0: bin[j>>2] |= buf[j+3]; + case 3: bin[j>>2] |= buf[j+2] << 8; + case 2: bin[j>>2] |= buf[j+1] << 16; + case 1: bin[j>>2] |= buf[j] << 24; + } + }; + + // Convert general data to a big-endian Int32Array written on the + // heap and return it's length; + var conv = function (data, bin, len) { + if (typeof data === 'string') { + return convStr(data, bin, len); + } else if (data instanceof Array || (typeof global !== 'undefined' && + typeof global.Buffer !== 'undefined' && + global.Buffer.isBuffer(data))) { + return convBuf(data, bin, len); + } else if (data instanceof ArrayBuffer) { + return convBuf(new Uint8Array(data), bin, len); + } else if (data.buffer instanceof ArrayBuffer) { + return convBuf(new Uint8Array(data.buffer), bin, len); + } else { + throw new Error('Unsupported data type.'); + } + }; + + // Convert an ArrayBuffer into its hexadecimal string representation. + var hex = function (arrayBuffer) { + var i, x, hex_tab = "0123456789abcdef", res = [], binarray = new Uint8Array(arrayBuffer); + for (i = 0; i < binarray.length; i++) { + x = binarray[i]; + res[i] = hex_tab.charAt((x >> 4) & 0xF) + + hex_tab.charAt((x >> 0) & 0xF); + } + return res.join(''); + }; + + var nextPow2 = function (v) { + var p = 1; while (p < v) p = p << 1; return p; + }; + + // Resize the internal data structures to a new capacity. + var resize = function (size) { + self.sizeHint = size; + self.heap = new ArrayBuffer(nextPow2(padlen(size) + 320)); + self.core = RushaCore({Int32Array: Int32Array, DataView: DataView}, {}, self.heap); + }; + + // On initialize, resize the datastructures according + // to an optional size hint. + resize(sizeHint || 0); + + // Initialize and call the RushaCore, + // assuming an input buffer of length len * 4. + var coreCall = function (len) { + var h = new Int32Array(self.heap, len << 2, 5); + h[0] = 1732584193; + h[1] = -271733879; + h[2] = -1732584194; + h[3] = 271733878; + h[4] = -1009589776; + self.core.hash(len); + }; + + // Calculate the hash digest as an array of 5 32bit integers. + var rawDigest = this.rawDigest = function (str) { + var len = str.byteLength || str.length; + if (len > self.sizeHint) { + resize(len); + } + var view = new Int32Array(self.heap, 0, padlen(len) >> 2); + padZeroes(view, len); + conv(str, view, len); + padData(view, len); + coreCall(view.length); + var out = new Int32Array(5); + var arr = new DataView(out.buffer); + arr.setInt32(0, view[0], false); + arr.setInt32(4, view[1], false); + arr.setInt32(8, view[2], false); + arr.setInt32(12, view[3], false); + arr.setInt32(16, view[4], false); + return out; + }; + + // The digest and digestFrom* interface returns the hash digest + // as a hex string. + this.digest = this.digestFromString = + this.digestFromBuffer = this.digestFromArrayBuffer = + function (str) { + return hex(rawDigest(str).buffer); + }; + + }; + + // The low-level RushCore module provides the heart of Rusha, + // a high-speed sha1 implementation working on an Int32Array heap. + // At first glance, the implementation seems complicated, however + // with the SHA1 spec at hand, it is obvious this almost a textbook + // implementation that has a few functions hand-inlined and a few loops + // hand-unrolled. + function RushaCore (stdlib, foreign, heap) { + "use asm"; + + var H = new stdlib.Int32Array(heap); + + function hash (k) { + + k = k|0; + var i = 0, j = 0, + y0 = 0, z0 = 0, y1 = 0, z1 = 0, + y2 = 0, z2 = 0, y3 = 0, z3 = 0, + y4 = 0, z4 = 0, t0 = 0, t1 = 0; + + y0 = H[k+0<<2>>2]|0; + y1 = H[k+1<<2>>2]|0; + y2 = H[k+2<<2>>2]|0; + y3 = H[k+3<<2>>2]|0; + y4 = H[k+4<<2>>2]|0; + + for (i = 0; (i|0) < (k|0); i = i + 16 |0) { + + z0 = y0; + z1 = y1; + z2 = y2; + z3 = y3; + z4 = y4; + + + + + + + + + + + + + + for (j = 0; (j|0) < 16; j = j + 1 |0) { + t1 = H[i+j<<2>>2]|0; + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 & y2 | ~y1 & y3) |0) + ((t1 + y4 | 0) +1518500249 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[k+j<<2>>2] = t1; + } + + for (j = k + 16 |0; (j|0) < (k + 20 |0); j = j + 1 |0) { + t1 = (((H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) << 1 | (H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) >>> 31)); + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 & y2 | ~y1 & y3) |0) + ((t1 + y4 | 0) +1518500249 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[j<<2>>2] = t1; + } + + for (j = k + 20 |0; (j|0) < (k + 40 |0); j = j + 1 |0) { + t1 = (((H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) << 1 | (H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) >>> 31)); + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 ^ y2 ^ y3) |0) + ((t1 + y4 | 0) +1859775393 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[j<<2>>2] = t1; + } + + for (j = k + 40 |0; (j|0) < (k + 60 |0); j = j + 1 |0) { + t1 = (((H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) << 1 | (H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) >>> 31)); + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 & y2 | y1 & y3 | y2 & y3) |0) + ((t1 + y4 | 0) -1894007588 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[j<<2>>2] = t1; + } + + for (j = k + 60 |0; (j|0) < (k + 80 |0); j = j + 1 |0) { + t1 = (((H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) << 1 | (H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) >>> 31)); + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 ^ y2 ^ y3) |0) + ((t1 + y4 | 0) -899497514 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[j<<2>>2] = t1; + } + + y0 = y0 + z0 |0; + y1 = y1 + z1 |0; + y2 = y2 + z2 |0; + y3 = y3 + z3 |0; + y4 = y4 + z4 |0; + + } + + H[0] = y0; + H[1] = y1; + H[2] = y2; + H[3] = y3; + H[4] = y4; + + } + + return {hash: hash}; + + } + +})(); + + +}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],4:[function(require,module,exports){ +(function (process){ +var defined = require('defined'); +var createDefaultStream = require('./lib/default_stream'); +var Test = require('./lib/test'); +var createResult = require('./lib/results'); + +var canEmitExit = typeof process !== 'undefined' && process + && typeof process.on === 'function' +; +var canExit = typeof process !== 'undefined' && process + && typeof process.exit === 'function' +; + +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +exports = module.exports = (function () { + var harness; + var lazyLoad = function () { + if (!harness) harness = createExitHarness({ + autoclose: !canEmitExit + }); + + return harness.apply(this, arguments); + }; + + lazyLoad.only = function () { + if (!harness) harness = createExitHarness({ + autoclose: !canEmitExit + }); + + return harness.only.apply(this, arguments); + } + + return lazyLoad +})(); + +function createExitHarness (conf) { + if (!conf) conf = {}; + var harness = createHarness({ + autoclose: defined(conf.autoclose, false) + }); + + var stream = harness.createStream(); + var es = stream.pipe(createDefaultStream()); + if (canEmitExit) { + es.on('error', function (err) { harness._exitCode = 1 }); + } + + var ended = false; + stream.on('end', function () { ended = true }); + + if (conf.exit === false) return harness; + if (!canEmitExit || !canExit) return harness; + + var _error; + + process.on('uncaughtException', function (err) { + if (err && err.code === 'EPIPE' && err.errno === 'EPIPE' + && err.syscall === 'write') return; + + _error = err + + throw err + }) + + process.on('exit', function (code) { + if (_error) { + return + } + + if (!ended) { + for (var i = 0; i < harness._tests.length; i++) { + var t = harness._tests[i]; + t._exit(); + } + } + harness.close(); + process.exit(code || harness._exitCode); + }); + + return harness; +} + +exports.createHarness = createHarness; +exports.Test = Test; +exports.test = exports; // tap compat + +var exitInterval; + +function createHarness (conf_) { + if (!conf_) conf_ = {}; + var results = createResult(); + if (conf_.autoclose !== false) { + results.once('done', function () { results.close() }); + } + + var test = function (name, conf, cb) { + var t = new Test(name, conf, cb); + test._tests.push(t); + + (function inspectCode (st) { + st.on('test', function sub (st_) { + inspectCode(st_); + }); + st.on('result', function (r) { + if (!r.ok) test._exitCode = 1 + }); + })(t); + + results.push(t); + return t; + }; + + test._tests = []; + + test.createStream = function () { + return results.createStream(); + }; + + var only = false; + test.only = function (name) { + if (only) throw new Error('there can only be one only test'); + results.only(name); + only = true; + return test.apply(null, arguments); + }; + test._exitCode = 0; + + test.close = function () { results.close() }; + + return test; +} + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"./lib/default_stream":5,"./lib/results":6,"./lib/test":7,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"defined":11}],5:[function(require,module,exports){ +var through = require('through'); + +module.exports = function () { + var line = ''; + var stream = through(write, flush); + return stream; + + function write (buf) { + for (var i = 0; i < buf.length; i++) { + var c = typeof buf === 'string' + ? buf.charAt(i) + : String.fromCharCode(buf[i]) + ; + if (c === '\n') flush(); + else line += c; + } + } + + function flush () { + try { console.log(line); } + catch (e) { stream.emit('error', e) } + line = ''; + } +}; + +},{"through":17}],6:[function(require,module,exports){ +(function (process){ +var EventEmitter = require('events').EventEmitter; +var inherits = require('inherits'); +var json = typeof JSON === 'object' ? JSON : require('jsonify'); +var through = require('through'); +var resumer = require('resumer'); +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +module.exports = Results; +inherits(Results, EventEmitter); + +function Results () { + if (!(this instanceof Results)) return new Results; + this.count = 0; + this.fail = 0; + this.pass = 0; + this._stream = through(); + this.tests = []; +} + +Results.prototype.createStream = function () { + var self = this; + var output = resumer(); + output.queue('TAP version 13\n'); + + nextTick(function next() { + var t; + while (t = getNextTest(self)) { + t.run(); + if (!t.ended) return t.once('end', function(){ nextTick(next); }); + } + self.emit('done'); + }); + self._stream.pipe(output); + + return output; +}; + +Results.prototype.push = function (t) { + var self = this; + self.tests.push(t); + self._watch(t); +}; + +Results.prototype.only = function (name) { + if (this._only) { + self.count ++; + self.fail ++; + write('not ok ' + self.count + ' already called .only()\n'); + } + this._only = name; +}; + +Results.prototype._watch = function (t) { + var self = this; + var write = function (s) { self._stream.queue(s) }; + t.once('prerun', function () { + write('# ' + t.name + '\n'); + }); + + t.on('result', function (res) { + if (typeof res === 'string') { + write('# ' + res + '\n'); + return; + } + write(encodeResult(res, self.count + 1)); + self.count ++; + + if (res.ok) self.pass ++ + else self.fail ++ + }); + + t.on('test', function (st) { self._watch(st) }); +}; + +Results.prototype.close = function () { + var self = this; + if (self.closed) self._stream.emit('error', new Error('ALREADY CLOSED')); + self.closed = true; + var write = function (s) { self._stream.queue(s) }; + + write('\n1..' + self.count + '\n'); + write('# tests ' + self.count + '\n'); + write('# pass ' + self.pass + '\n'); + if (self.fail) write('# fail ' + self.fail + '\n') + else write('\n# ok\n') + + self._stream.queue(null); +}; + +function encodeResult (res, count) { + var output = ''; + output += (res.ok ? 'ok ' : 'not ok ') + count; + output += res.name ? ' ' + res.name.toString().replace(/\s+/g, ' ') : ''; + + if (res.skip) output += ' # SKIP'; + else if (res.todo) output += ' # TODO'; + + output += '\n'; + if (res.ok) return output; + + var outer = ' '; + var inner = outer + ' '; + output += outer + '---\n'; + output += inner + 'operator: ' + res.operator + '\n'; + + var ex = json.stringify(res.expected, getSerialize()) || ''; + var ac = json.stringify(res.actual, getSerialize()) || ''; + + if (Math.max(ex.length, ac.length) > 65) { + output += inner + 'expected:\n' + inner + ' ' + ex + '\n'; + output += inner + 'actual:\n' + inner + ' ' + ac + '\n'; + } + else { + output += inner + 'expected: ' + ex + '\n'; + output += inner + 'actual: ' + ac + '\n'; + } + if (res.at) { + output += inner + 'at: ' + res.at + '\n'; + } + if (res.operator === 'error' && res.actual && res.actual.stack) { + var lines = String(res.actual.stack).split('\n'); + output += inner + 'stack:\n'; + output += inner + ' ' + lines[0] + '\n'; + for (var i = 1; i < lines.length; i++) { + output += inner + lines[i] + '\n'; + } + } + + output += outer + '...\n'; + return output; +} + +function getSerialize () { + var seen = []; + + return function (key, value) { + var ret = value; + if (typeof value === 'object' && value) { + var found = false; + for (var i = 0; i < seen.length; i++) { + if (seen[i] === value) { + found = true + break; + } + } + + if (found) ret = '[Circular]' + else seen.push(value) + } + return ret; + }; +} + +function getNextTest(results) { + if (!results._only) { + return results.tests.shift(); + } + + do { + var t = results.tests.shift(); + if (!t) { + return null; + } + if (results._only === t.name) { + return t; + } + } while (results.tests.length !== 0) +} + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"events":23,"inherits":12,"jsonify":13,"resumer":16,"through":17}],7:[function(require,module,exports){ +(function (process,__dirname){ +var Stream = require('stream'); +var deepEqual = require('deep-equal'); +var defined = require('defined'); +var path = require('path'); +var inherits = require('util').inherits; +var EventEmitter = require('events').EventEmitter; + +module.exports = Test; + +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +inherits(Test, EventEmitter); + +function Test (name_, opts_, cb_) { + var self = this; + var name = '(anonymous)'; + var opts = {}; + var cb; + + for (var i = 0; i < arguments.length; i++) { + switch (typeof arguments[i]) { + case 'string': + name = arguments[i]; + break; + case 'object': + opts = arguments[i] || opts; + break; + case 'function': + cb = arguments[i]; + } + } + + this.readable = true; + this.name = name || '(anonymous)'; + this.assertCount = 0; + this.pendingCount = 0; + this._skip = opts.skip || false; + this._plan = undefined; + this._cb = cb; + this._progeny = []; + this._ok = true; +} + +Test.prototype.run = function () { + if (!this._cb || this._skip) { + return this.end(); + } + this.emit('prerun'); + try { + this._cb(this); + } + catch (err) { + this.error(err); + this.end(); + return; + } + this.emit('run'); +}; + +Test.prototype.test = function (name, opts, cb) { + var self = this; + var t = new Test(name, opts, cb); + this._progeny.push(t); + this.pendingCount++; + this.emit('test', t); + t.on('prerun', function () { + self.assertCount++; + }) + + if (!self._pendingAsserts()) { + nextTick(function () { + self.end(); + }); + } + + nextTick(function() { + if (!self._plan && self.pendingCount == self._progeny.length) { + self.end(); + } + }); +}; + +Test.prototype.comment = function (msg) { + this.emit('result', msg.trim().replace(/^#\s*/, '')); +}; + +Test.prototype.plan = function (n) { + this._plan = n; + this.emit('plan', n); +}; + +Test.prototype.end = function () { + var self = this; + + if (this._progeny.length) { + var t = this._progeny.shift(); + t.on('end', function () { + self.end(); + }); + t.run(); + return; + } + + if (!this.ended) this.emit('end'); + var pendingAsserts = this._pendingAsserts(); + if (!this._planError && this._plan !== undefined && pendingAsserts) { + this._planError = true; + this.fail('plan != count', { + expected : this._plan, + actual : this.assertCount + }); + } + this.ended = true; +}; + +Test.prototype._exit = function () { + if (this._plan !== undefined && + !this._planError && this.assertCount !== this._plan) { + this._planError = true; + this.fail('plan != count', { + expected : this._plan, + actual : this.assertCount, + exiting : true + }); + } + else if (!this.ended) { + this.fail('test exited without ending', { + exiting: true + }); + } +}; + +Test.prototype._pendingAsserts = function () { + if (this._plan === undefined) { + return 1; + } else { + return this._plan - + (this._progeny.length + this.assertCount); + } +} + +Test.prototype._assert = function assert (ok, opts) { + var self = this; + var extra = opts.extra || {}; + + var res = { + id : self.assertCount ++, + ok : Boolean(ok), + skip : defined(extra.skip, opts.skip), + name : defined(extra.message, opts.message, '(unnamed assert)'), + operator : defined(extra.operator, opts.operator), + actual : defined(extra.actual, opts.actual), + expected : defined(extra.expected, opts.expected) + }; + this._ok = Boolean(this._ok && ok); + + if (!ok) { + res.error = defined(extra.error, opts.error, new Error(res.name)); + } + + var e = new Error('exception'); + var err = (e.stack || '').split('\n'); + var dir = path.dirname(__dirname) + '/'; + + for (var i = 0; i < err.length; i++) { + var m = /^\s*\bat\s+(.+)/.exec(err[i]); + if (!m) continue; + + var s = m[1].split(/\s+/); + var filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[1]); + if (!filem) { + filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[3]); + + if (!filem) continue; + } + + if (filem[1].slice(0, dir.length) === dir) continue; + + res.functionName = s[0]; + res.file = filem[1]; + res.line = Number(filem[2]); + if (filem[3]) res.column = filem[3]; + + res.at = m[1]; + break; + } + + self.emit('result', res); + + var pendingAsserts = self._pendingAsserts(); + if (!pendingAsserts) { + if (extra.exiting) { + self.end(); + } else { + nextTick(function () { + self.end(); + }); + } + } + + if (!self._planError && pendingAsserts < 0) { + self._planError = true; + self.fail('plan != count', { + expected : self._plan, + actual : self._plan - pendingAsserts + }); + } +}; + +Test.prototype.fail = function (msg, extra) { + this._assert(false, { + message : msg, + operator : 'fail', + extra : extra + }); +}; + +Test.prototype.pass = function (msg, extra) { + this._assert(true, { + message : msg, + operator : 'pass', + extra : extra + }); +}; + +Test.prototype.skip = function (msg, extra) { + this._assert(true, { + message : msg, + operator : 'skip', + skip : true, + extra : extra + }); +}; + +Test.prototype.ok += Test.prototype['true'] += Test.prototype.assert += function (value, msg, extra) { + this._assert(value, { + message : msg, + operator : 'ok', + expected : true, + actual : value, + extra : extra + }); +}; + +Test.prototype.notOk += Test.prototype['false'] += Test.prototype.notok += function (value, msg, extra) { + this._assert(!value, { + message : msg, + operator : 'notOk', + expected : false, + actual : value, + extra : extra + }); +}; + +Test.prototype.error += Test.prototype.ifError += Test.prototype.ifErr += Test.prototype.iferror += function (err, msg, extra) { + this._assert(!err, { + message : defined(msg, String(err)), + operator : 'error', + actual : err, + extra : extra + }); +}; + +Test.prototype.equal += Test.prototype.equals += Test.prototype.isEqual += Test.prototype.is += Test.prototype.strictEqual += Test.prototype.strictEquals += function (a, b, msg, extra) { + this._assert(a === b, { + message : defined(msg, 'should be equal'), + operator : 'equal', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.notEqual += Test.prototype.notEquals += Test.prototype.notStrictEqual += Test.prototype.notStrictEquals += Test.prototype.isNotEqual += Test.prototype.isNot += Test.prototype.not += Test.prototype.doesNotEqual += Test.prototype.isInequal += function (a, b, msg, extra) { + this._assert(a !== b, { + message : defined(msg, 'should not be equal'), + operator : 'notEqual', + actual : a, + notExpected : b, + extra : extra + }); +}; + +Test.prototype.deepEqual += Test.prototype.deepEquals += Test.prototype.isEquivalent += Test.prototype.same += function (a, b, msg, extra) { + this._assert(deepEqual(a, b, { strict: true }), { + message : defined(msg, 'should be equivalent'), + operator : 'deepEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.deepLooseEqual += Test.prototype.looseEqual += Test.prototype.looseEquals += function (a, b, msg, extra) { + this._assert(deepEqual(a, b), { + message : defined(msg, 'should be equivalent'), + operator : 'deepLooseEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.notDeepEqual += Test.prototype.notEquivalent += Test.prototype.notDeeply += Test.prototype.notSame += Test.prototype.isNotDeepEqual += Test.prototype.isNotDeeply += Test.prototype.isNotEquivalent += Test.prototype.isInequivalent += function (a, b, msg, extra) { + this._assert(!deepEqual(a, b, { strict: true }), { + message : defined(msg, 'should not be equivalent'), + operator : 'notDeepEqual', + actual : a, + notExpected : b, + extra : extra + }); +}; + +Test.prototype.notDeepLooseEqual += Test.prototype.notLooseEqual += Test.prototype.notLooseEquals += function (a, b, msg, extra) { + this._assert(deepEqual(a, b), { + message : defined(msg, 'should be equivalent'), + operator : 'notDeepLooseEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype['throws'] = function (fn, expected, msg, extra) { + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + var caught = undefined; + try { + fn(); + } + catch (err) { + caught = { error : err }; + var message = err.message; + delete err.message; + err.message = message; + } + + var passed = caught; + + if (expected instanceof RegExp) { + passed = expected.test(caught && caught.error); + expected = String(expected); + } + + this._assert(passed, { + message : defined(msg, 'should throw'), + operator : 'throws', + actual : caught && caught.error, + expected : expected, + error: !passed && caught && caught.error, + extra : extra + }); +}; + +Test.prototype.doesNotThrow = function (fn, expected, msg, extra) { + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + var caught = undefined; + try { + fn(); + } + catch (err) { + caught = { error : err }; + } + this._assert(!caught, { + message : defined(msg, 'should not throw'), + operator : 'throws', + actual : caught && caught.error, + expected : expected, + error : caught && caught.error, + extra : extra + }); +}; + +// vim: set softtabstop=4 shiftwidth=4: + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/../node_modules/tape/lib") +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"deep-equal":8,"defined":11,"events":23,"path":26,"stream":28,"util":36}],8:[function(require,module,exports){ +var pSlice = Array.prototype.slice; +var objectKeys = require('./lib/keys.js'); +var isArguments = require('./lib/is_arguments.js'); + +var deepEqual = module.exports = function (actual, expected, opts) { + if (!opts) opts = {}; + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.3. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return opts.strict ? actual === expected : actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected, opts); + } +} + +function isUndefinedOrNull(value) { + return value === null || value === undefined; +} + +function isBuffer (x) { + if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; + if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { + return false; + } + if (x.length > 0 && typeof x[0] !== 'number') return false; + return true; +} + +function objEquiv(a, b, opts) { + var i, key; + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical 'prototype' property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return deepEqual(a, b, opts); + } + if (isBuffer(a)) { + if (!isBuffer(b)) { + return false; + } + if (a.length !== b.length) return false; + for (i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; + } + try { + var ka = objectKeys(a), + kb = objectKeys(b); + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!deepEqual(a[key], b[key], opts)) return false; + } + return true; +} + +},{"./lib/is_arguments.js":9,"./lib/keys.js":10}],9:[function(require,module,exports){ +var supportsArgumentsClass = (function(){ + return Object.prototype.toString.call(arguments) +})() == '[object Arguments]'; + +exports = module.exports = supportsArgumentsClass ? supported : unsupported; + +exports.supported = supported; +function supported(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +}; + +exports.unsupported = unsupported; +function unsupported(object){ + return object && + typeof object == 'object' && + typeof object.length == 'number' && + Object.prototype.hasOwnProperty.call(object, 'callee') && + !Object.prototype.propertyIsEnumerable.call(object, 'callee') || + false; +}; + +},{}],10:[function(require,module,exports){ +exports = module.exports = typeof Object.keys === 'function' + ? Object.keys : shim; + +exports.shim = shim; +function shim (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} + +},{}],11:[function(require,module,exports){ +module.exports = function () { + for (var i = 0; i < arguments.length; i++) { + if (arguments[i] !== undefined) return arguments[i]; + } +}; + +},{}],12:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} + +},{}],13:[function(require,module,exports){ +exports.parse = require('./lib/parse'); +exports.stringify = require('./lib/stringify'); + +},{"./lib/parse":14,"./lib/stringify":15}],14:[function(require,module,exports){ +var at, // The index of the current character + ch, // The current character + escapee = { + '"': '"', + '\\': '\\', + '/': '/', + b: '\b', + f: '\f', + n: '\n', + r: '\r', + t: '\t' + }, + text, + + error = function (m) { + // Call error when something is wrong. + throw { + name: 'SyntaxError', + message: m, + at: at, + text: text + }; + }, + + next = function (c) { + // If a c parameter is provided, verify that it matches the current character. + if (c && c !== ch) { + error("Expected '" + c + "' instead of '" + ch + "'"); + } + + // Get the next character. When there are no more characters, + // return the empty string. + + ch = text.charAt(at); + at += 1; + return ch; + }, + + number = function () { + // Parse a number value. + var number, + string = ''; + + if (ch === '-') { + string = '-'; + next('-'); + } + while (ch >= '0' && ch <= '9') { + string += ch; + next(); + } + if (ch === '.') { + string += '.'; + while (next() && ch >= '0' && ch <= '9') { + string += ch; + } + } + if (ch === 'e' || ch === 'E') { + string += ch; + next(); + if (ch === '-' || ch === '+') { + string += ch; + next(); + } + while (ch >= '0' && ch <= '9') { + string += ch; + next(); + } + } + number = +string; + if (!isFinite(number)) { + error("Bad number"); + } else { + return number; + } + }, + + string = function () { + // Parse a string value. + var hex, + i, + string = '', + uffff; + + // When parsing for string values, we must look for " and \ characters. + if (ch === '"') { + while (next()) { + if (ch === '"') { + next(); + return string; + } else if (ch === '\\') { + next(); + if (ch === 'u') { + uffff = 0; + for (i = 0; i < 4; i += 1) { + hex = parseInt(next(), 16); + if (!isFinite(hex)) { + break; + } + uffff = uffff * 16 + hex; + } + string += String.fromCharCode(uffff); + } else if (typeof escapee[ch] === 'string') { + string += escapee[ch]; + } else { + break; + } + } else { + string += ch; + } + } + } + error("Bad string"); + }, + + white = function () { + +// Skip whitespace. + + while (ch && ch <= ' ') { + next(); + } + }, + + word = function () { + +// true, false, or null. + + switch (ch) { + case 't': + next('t'); + next('r'); + next('u'); + next('e'); + return true; + case 'f': + next('f'); + next('a'); + next('l'); + next('s'); + next('e'); + return false; + case 'n': + next('n'); + next('u'); + next('l'); + next('l'); + return null; + } + error("Unexpected '" + ch + "'"); + }, + + value, // Place holder for the value function. + + array = function () { + +// Parse an array value. + + var array = []; + + if (ch === '[') { + next('['); + white(); + if (ch === ']') { + next(']'); + return array; // empty array + } + while (ch) { + array.push(value()); + white(); + if (ch === ']') { + next(']'); + return array; + } + next(','); + white(); + } + } + error("Bad array"); + }, + + object = function () { + +// Parse an object value. + + var key, + object = {}; + + if (ch === '{') { + next('{'); + white(); + if (ch === '}') { + next('}'); + return object; // empty object + } + while (ch) { + key = string(); + white(); + next(':'); + if (Object.hasOwnProperty.call(object, key)) { + error('Duplicate key "' + key + '"'); + } + object[key] = value(); + white(); + if (ch === '}') { + next('}'); + return object; + } + next(','); + white(); + } + } + error("Bad object"); + }; + +value = function () { + +// Parse a JSON value. It could be an object, an array, a string, a number, +// or a word. + + white(); + switch (ch) { + case '{': + return object(); + case '[': + return array(); + case '"': + return string(); + case '-': + return number(); + default: + return ch >= '0' && ch <= '9' ? number() : word(); + } +}; + +// Return the json_parse function. It will have access to all of the above +// functions and variables. + +module.exports = function (source, reviver) { + var result; + + text = source; + at = 0; + ch = ' '; + result = value(); + white(); + if (ch) { + error("Syntax error"); + } + + // If there is a reviver function, we recursively walk the new structure, + // passing each name/value pair to the reviver function for possible + // transformation, starting with a temporary root object that holds the result + // in an empty key. If there is not a reviver function, we simply return the + // result. + + return typeof reviver === 'function' ? (function walk(holder, key) { + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + }({'': result}, '')) : result; +}; + +},{}],15:[function(require,module,exports){ +var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + +function quote(string) { + // If the string contains no control characters, no quote characters, and no + // backslash characters, then we can safely slap some quotes around it. + // Otherwise we must also replace the offending characters with safe escape + // sequences. + + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' ? c : + '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; +} + +function str(key, holder) { + // Produce a string from holder[key]. + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + + // If the value has a toJSON method, call it to obtain a replacement value. + if (value && typeof value === 'object' && + typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + + // If we were called with a replacer function, then call the replacer to + // obtain a replacement value. + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + + // What happens next depends on the value's type. + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + // JSON numbers must be finite. Encode non-finite numbers as null. + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + // If the value is a boolean or null, convert it to a string. Note: + // typeof null does not produce 'null'. The case is included here in + // the remote chance that this gets fixed someday. + return String(value); + + case 'object': + if (!value) return 'null'; + gap += indent; + partial = []; + + // Array.isArray + if (Object.prototype.toString.apply(value) === '[object Array]') { + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + + // Join all of the elements together, separated with commas, and + // wrap them in brackets. + v = partial.length === 0 ? '[]' : gap ? + '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + + // If the replacer is an array, use it to select the members to be + // stringified. + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + else { + // Otherwise, iterate through all of the keys in the object. + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + + // Join all of the member texts together, separated with commas, + // and wrap them in braces. + + v = partial.length === 0 ? '{}' : gap ? + '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : + '{' + partial.join(',') + '}'; + gap = mind; + return v; + } +} + +module.exports = function (value, replacer, space) { + var i; + gap = ''; + indent = ''; + + // If the space parameter is a number, make an indent string containing that + // many spaces. + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + } + // If the space parameter is a string, it will be used as the indent string. + else if (typeof space === 'string') { + indent = space; + } + + // If there is a replacer, it must be a function or an array. + // Otherwise, throw an error. + rep = replacer; + if (replacer && typeof replacer !== 'function' + && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + + // Make a fake root object containing our value under the key of ''. + // Return the result of stringifying the value. + return str('', {'': value}); +}; + +},{}],16:[function(require,module,exports){ +(function (process){ +var through = require('through'); +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +module.exports = function (write, end) { + var tr = through(write, end); + tr.pause(); + var resume = tr.resume; + var pause = tr.pause; + var paused = false; + + tr.pause = function () { + paused = true; + return pause.apply(this, arguments); + }; + + tr.resume = function () { + paused = false; + return resume.apply(this, arguments); + }; + + nextTick(function () { + if (!paused) tr.resume(); + }); + + return tr; +}; + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"through":17}],17:[function(require,module,exports){ +(function (process){ +var Stream = require('stream') + +// through +// +// a stream that does nothing but re-emit the input. +// useful for aggregating a series of changing but not ending streams into one stream) + +exports = module.exports = through +through.through = through + +//create a readable writable stream. + +function through (write, end, opts) { + write = write || function (data) { this.queue(data) } + end = end || function () { this.queue(null) } + + var ended = false, destroyed = false, buffer = [], _ended = false + var stream = new Stream() + stream.readable = stream.writable = true + stream.paused = false + +// stream.autoPause = !(opts && opts.autoPause === false) + stream.autoDestroy = !(opts && opts.autoDestroy === false) + + stream.write = function (data) { + write.call(this, data) + return !stream.paused + } + + function drain() { + while(buffer.length && !stream.paused) { + var data = buffer.shift() + if(null === data) + return stream.emit('end') + else + stream.emit('data', data) + } + } + + stream.queue = stream.push = function (data) { +// console.error(ended) + if(_ended) return stream + if(data == null) _ended = true + buffer.push(data) + drain() + return stream + } + + //this will be registered as the first 'end' listener + //must call destroy next tick, to make sure we're after any + //stream piped from here. + //this is only a problem if end is not emitted synchronously. + //a nicer way to do this is to make sure this is the last listener for 'end' + + stream.on('end', function () { + stream.readable = false + if(!stream.writable && stream.autoDestroy) + process.nextTick(function () { + stream.destroy() + }) + }) + + function _end () { + stream.writable = false + end.call(stream) + if(!stream.readable && stream.autoDestroy) + stream.destroy() + } + + stream.end = function (data) { + if(ended) return + ended = true + if(arguments.length) stream.write(data) + _end() // will emit or queue + return stream + } + + stream.destroy = function () { + if(destroyed) return + destroyed = true + ended = true + buffer.length = 0 + stream.writable = stream.readable = false + stream.emit('close') + return stream + } + + stream.pause = function () { + if(stream.paused) return + stream.paused = true + return stream + } + + stream.resume = function () { + if(stream.paused) { + stream.paused = false + stream.emit('resume') + } + drain() + //may have become paused again, + //as drain emits 'data'. + if(!stream.paused) + stream.emit('drain') + return stream + } + return stream +} + + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"stream":28}],18:[function(require,module,exports){ +(function (Buffer){ +var fs = require('fs') +var parseTorrent = require('../') +var test = require('tape') + +var leaves = Buffer("ZDg6YW5ub3VuY2U0MDpodHRwOi8vdHJhY2tlci50aGVwaXJhdGViYXkub3JnL2Fubm91bmNlMTM6YW5ub3VuY2UtbGlzdGxsNDA6aHR0cDovL3RyYWNrZXIudGhlcGlyYXRlYmF5Lm9yZy9hbm5vdW5jZWVsMzU6dWRwOi8vdHJhY2tlci5vcGVuYml0dG9ycmVudC5jb206ODBlbDIzOnVkcDovL3RyYWNrZXIuY2NjLmRlOjgwZWwyOTp1ZHA6Ly90cmFja2VyLnB1YmxpY2J0LmNvbTo4MGVsNDM6dWRwOi8vZnIzM2RvbXRyYWNrZXIuaDMzdC5jb206MzMxMC9hbm5vdW5jZTM3Omh0dHA6Ly90cmFja2VyLmJpdHRvcnJlbnQuYW0vYW5ub3VuY2VlZTc6Y29tbWVudDM3OkRvd25sb2FkZWQgZnJvbSBodHRwOi8vVGhlVG9ycmVudC5vcmcxMDpjcmVhdGVkIGJ5MTM6dVRvcnJlbnQvMzMwMDEzOmNyZWF0aW9uIGRhdGVpMTM3NTM2MzY2NmU4OmVuY29kaW5nNTpVVEYtODQ6aW5mb2Q2Omxlbmd0aGkzNjIwMTdlNDpuYW1lMzY6TGVhdmVzIG9mIEdyYXNzIGJ5IFdhbHQgV2hpdG1hbi5lcHViMTI6cGllY2UgbGVuZ3RoaTE2Mzg0ZTY6cGllY2VzNDYwOh+cP1m+7AeXFexTMkvehWnkoLTr7EIwfUzlVXtdOWTF71XTVM9Kbsx78byvedEfpeC+Blk8j6r8DCuiz3bXHFsBUmsjAH+emSm+r8UVHmURCTGhtEwhvx5ouROPkEleaQ28VfVy5MKUTLrPJuazropyKdiKr6BfYequar8/B8ttuWd8xq3tTdOYXkWGJ1Z/p2OfBl9xsYlUMErKY2ZyngtHc9d66AyqlqUkgE3+S5vT3q75mcndUQJ0Z1GdXrJWGuLMAUZ95fZDCmC8uiR5dpLvqHcNI98Kgw2RyzWzQHqIuqBZDcjJqmoSDydDZ9zYZ+iOgzjFcqBuPIAbKfUZ31MrPnb2cM9q7lMQfz05N4SD9pz4D6VoserFO1BhWemI2LwWki0SXXfYA9ZSw8owcMFu7ZFyq1BtIOUi6j8atnSz+SPXb+j0T/MuNyw7N2VkxvtfDb5SFk8DYp/RMiY2urssAUt9rlgtpBNjllJh5s4StDcB8KjJ7RUgpw66AEQAomd2X2091ce+tb08dfPfKlRWCmGAEUf6TsfPVo5wOssE5WEKTVbcwkLQMpPpRGz15FfY6z2ViP2Qxpjemw2tkpgJBsAm2MFAj6CP5OxlZQ==","base64") +var pride = Buffer("ZDg6YW5ub3VuY2U0MDpodHRwOi8vdHJhY2tlci50aGVwaXJhdGViYXkub3JnL2Fubm91bmNlMTM6YW5ub3VuY2UtbGlzdGxsNDA6aHR0cDovL3RyYWNrZXIudGhlcGlyYXRlYmF5Lm9yZy9hbm5vdW5jZWVsMzU6dWRwOi8vdHJhY2tlci5vcGVuYml0dG9ycmVudC5jb206ODBlbDIzOnVkcDovL3RyYWNrZXIuY2NjLmRlOjgwZWwyOTp1ZHA6Ly90cmFja2VyLnB1YmxpY2J0LmNvbTo4MGVsMzI6aHR0cDovL3RyYWNrZXIudGZpbGUubWUvYW5ub3VuY2VlbDQwOmh0dHA6Ly90cmFja2VyLm1hcnNoeW9ubGluZS5uZXQvYW5ub3VuY2VlbDI5Omh0dHA6Ly90cmFja2VyLmV4LnVhL2Fubm91bmNlZWwyOTpodHRwOi8vaS5iYW5kaXRvLm9yZy9hbm5vdW5jZWVsNDM6aHR0cDovL2dyZWVubGlldHJhY2tlci5hcHBzcG90LmNvbS9hbm5vdW5jZWVsMzg6aHR0cDovL2V4b2R1cy5kZXN5bmMuY29tOjY5NjkvYW5ub3VuY2VlbDM5Omh0dHA6Ly9jYWx1LWF0cmFjay5hcHBzcG90LmNvbS9hbm5vdW5jZWVsNDg6aHR0cDovL2NhbHUtYXRyYWNrLmFwcHNwb3QuY29tLm55dWQubmV0L2Fubm91bmNlZWwzOTpodHRwOi8vYnQucG9sZXRyYWNrZXIub3JnOjI3MTAvYW5ub3VuY2VlbDQ0Omh0dHA6Ly9iaWdmb290MTk0Mi5zZWt0b3JpLm9yZzo2OTY5L2Fubm91bmNlZWw0NTpodHRwOi8vYW5ub3VuY2Uub3BlbnNoYXJpbmcub3JnOjI3MTAvYW5ub3VuY2VlbDM4Omh0dHA6Ly85NC4yMjguMTkyLjk4Lm55dWQubmV0L2Fubm91bmNlZWwzOTpodHRwOi8vYnQuY2FyZWxhbmQuY29tLmNuOjY5NjkvYW5ub3VuY2VlbDI4Omh0dHA6Ly9lMTgwLnBocDUuY3ovYW5ub3VuY2VlbDM4Omh0dHA6Ly9iZXRhLm15dHJhY2tlci5tZTo2OTY5L2Fubm91bmNlZWw0MjpodHRwOi8vdHJhY2tlci5tZXRpbjIuY29tLmJyOjY5NjkvYW5ub3VuY2VlbDQ0Omh0dHA6Ly90cmFja2VyMS53YXNhYmlpLmNvbS50dzo2OTY5L2Fubm91bmNlZWw0MzpodHRwOi8vcmV0cmFja2VyLnBlcm0uZXJ0ZWxlY29tLnJ1L2Fubm91bmNlZWwzNzpodHRwOi8vZnIzM2RvbS5oMzN0LmNvbTozMzEwL2Fubm91bmNlZWwzMzpodHRwOi8vZXhvZHVzLmRlc3luYy5jb20vYW5ub3VuY2VlbDM3Omh0dHA6Ly9idC5ldXRvcnJlbnRzLmNvbS9hbm5vdW5jZS5waHBlbDQxOmh0dHA6Ly9yZXRyYWNrZXIuaHEuZXJ0ZWxlY29tLnJ1L2Fubm91bmNlZWw0NDpodHRwOi8vYW5ub3VuY2UudG9ycmVudHNtZC5jb206ODA4MC9hbm5vdW5jZWVsNDg6aHR0cDovL2Fubm91bmNlLnRvcnJlbnRzbWQuY29tOjgwODAvYW5ub3VuY2UucGhwZWwzMzpodHRwOi8vd3d3LmgzM3QuY29tOjMzMTAvYW5ub3VuY2VlbDQxOmh0dHA6Ly90cmFja2VyLnlpZnktdG9ycmVudHMuY29tL2Fubm91bmNlZWw0NDpodHRwOi8vYW5ub3VuY2UudG9ycmVudHNtZC5jb206Njk2OS9hbm5vdW5jZWVsNDQ6aHR0cDovL2ZyMzNkb210cmFja2VyLmgzM3QuY29tOjMzMTAvYW5ub3VuY2VlZTc6Y29tbWVudDQ2OlRvcnJlbnQgZG93bmxvYWRlZCBmcm9tIGh0dHA6Ly90aGVwaXJhdGViYXkuc3gxMDpjcmVhdGVkIGJ5MTM6dVRvcnJlbnQvMzMwMDEzOmNyZWF0aW9uIGRhdGVpMTM3NDUxNDM5OWU4OmVuY29kaW5nNTpVVEYtODQ6aW5mb2Q1OmZpbGVzbGQ2Omxlbmd0aGk2OTA0NTBlNDpwYXRobDIzOlByaWRlX2FuZF9QcmVqdWRpY2UucGRmZWVkNjpsZW5ndGhpNDg3MDc2ZTQ6cGF0aGwyNDpQcmlkZV9hbmRfUHJlanVkaWNlLm1vYmllZWQ2Omxlbmd0aGkzMDUxNjRlNDpwYXRobDI0OlByaWRlIGFuZCBQcmVqdWRpY2UuZXB1YmVlZTQ6bmFtZTM0OlBSSURFIEFORCBQUkVKVURJQ0UgIC0gSmFuZSBBdXN0ZW4xMjpwaWVjZSBsZW5ndGhpMTYzODRlNjpwaWVjZXMxODIwOlblAtwGzo5rtDn34LrCfmmEK8icuNEtvXdbK4zAHgOxhDJwNDVTHajCQmz/z+vaIGNqvXHw9LR2fO6cQkXW+m/mlTeiDHrxhCoA4bVZnif4288BroGoPXeFOk9xM1sHXWKt90hJyFKewrxRjLu2futT+kCwtFWvM5QJv/UMq1je7MmJz/VmYP579v94dpxa170i5HHsg4YnXU2jth4RTfeSwC3DA4SXNAp6UbY6Fkam9bYoj+7cFcot5BFp2vdnv0dmoMSKWWaqzSFy9za+A9eWkamgpAc86+CVeBl7otyeWgzbOuoJTVuJGZ3JC8au6EBusqKkUQkqBYV6vF3Ka5raxIO3SOSFi6g4+VPRG8dppyuhSYGFoY5cx/cXlVXxwOXZjNNgdvC7sokdnmpHVhS25H30cjm8nHDiuU9itt5papHghPIfRxe73nXkdCIVsJ6C7YFY99PODZ1x0Uu1SRHuJgN4+yPB5uVEMY09FK2BZReklPxm5w4WMd/Jblt35ee7fG0FVwLI5gRlYcDUl0hjGdrJSPmk+AZQ6ghOJH9vmgupKXAW2kB4S3G5iI7tc4OVkOBL/VJc0RB4eaIAM7oUyQhrSNMXpv6j9vdEkWGa9q7UDcdz4kb5fcVG36VX1WPdyTr1vZDw/ehT/4iLBIKsS62cEK7ODTXsJifQFH1VXdUjU1KH8FuK3/L85BdlsmjABzIcuFjT29t0AXt04DrrGN3i5Dc5UQY270nQ0af/Ly7Q5+EaxFcG1filxGQrvvgCa8QPiu8EFMMrUvewqKu8FfTn4bWXBzhRUarQgvI5y/hWA8J3/KDh0EAZMaG1rEn2LzQ2n2/J43iAUIMBYMI/4gw05So8EO6x7zhSoyjlV+FeI7U9JxTVkU+eRIY6WNKik61HXIi6TsGtCQWZZplVDHTGc+93T1BH+4gfcOFVRgeJAuL9KqfL+q2DqQpJazztgZpIn74LX2NV7DyZrriBi0q26dWjHpP5ETEDUh0N+Cc0asOTyGLn9DG+9kyYe62s9sZJ9BX1M7SP1dZhba3SMFTLgz437HtTp8pe34JK6vQWxtkstdKKpxC3USJJcF4A2FXNTfTf2chDrrqUWXdTI+jWydhfaEsH8zAfR0a3FCYqcAy2qe915LljAWygGXKTtb0qwKv3pXGJQV7xZybQox7yJhtg4jmzSDzl0rc2rWzqIs1NTxIvjUsug4BMbe3JXTNPSZ/ejGv7V0xWkYkNKxW2/1wYqem5mCQ3RmPPZpcnrNv3ik67gQCopEOowlY0rRXI8KskN/4FPXiolQc+4gtMUZVW8iQ9X9ul5IIOisOkIZuHFe0rWEW7RaRgdhYwvzo4ZRiKj+vS1CTiyWNg7fez4qa3YDp5rFTnQcRyOayqQt2ajYlmCo7Afua/EhlLWuOfrkazSU4z+MXh9hsQ7t9pN02+/omeg7T1qEf127yVL2f/d9a+CC+W9XPkx2TvHw8vILhagGKfexX4gvcZ8WVjylcvhLR1M/okxpDCH4aLn+52uuG9aOQrw551WRY87ApUv36MfmffRyDypEJi2/ibuWniLoShT0a08h/XG5zW+G2y3rVn/nLtmPe8kId1gc9trRcGA4ayUDQjiHhCkCI6Hx+XU/HeiRFlu1KR96wijcmNnC+IATjbsmgoyc1VMW8YbA6ND3/09dlqh65aazFhidc/OtzLuozmMh5aZFbm+hFDHZyONlxcggLb1puNJD1jSOH3zhV8e9zW1iuwxp3/rUryXWHnQnusz7uks9fibm5n8+pUOvnA2NFwAr65aVFs+EySwAia3gSafiJ0PafuIpf7ypOk4zq8bwAHnxQyREKtSKSa9CzFB+83WvnuSEhze4H5BRw7vi5q2zLHJx/dC+6hkPoiriSTgIflxdhLanSEdrmWkLGqNy7V/loObfbV8gu8DqkXX7wrJzIz8rM4qbBM5ivVUH3KXshhNsuzqr7v76SPv/LTusXs8U/BYitb9TVAHB7Xu7XFM6sf8OirhVtwQtTjwjiVWqh9hMdlcA0vyNkI+I7Urg/fltUVfDBbKW5xEtwz5pqrOrbpRqR/o4nayLGEITiry9CFm3mL8Ur5x2IKTJpkx5Nvi4qHqjMQleyBZmgS10osp7RjyEgTuq5HFt9R5n7WXjniyxmr7LkwAU7vc3Thu2fMDj9W5SMYANAN4dMb5oWK2JEHEMdySZZ5qsPdqIDDIRBcaiKut8gNaWXKW4B7PqmEZ9PuQRpVW56NNNEkZIB1EUhssrgT7bRm4hV2fbO3oN0oXN7aN9v/0arWmujKVBARcxiLPKmDUJyNpGrFgK844lFvbl5BKeDF+e/grVVvCPxIaW4dNgeMSUvGfXhjvajoYeG8MEVRbXcDEshwJzyuiqA9uwfKdTO5aUBeKUc//wZfpYB80uiVPkhYmnfDZWUK","base64") +var leavesCorrupt = Buffer("ZDg6YW5ub3VuY2U0MDpodHRwOi8vdHJhY2tlci50aGVwaXJhdGViYXkub3JnL2Fubm91bmNlMTM6YW5ub3VuY2UtbGlzdGxsNDA6aHR0cDovL3RyYWNrZXIudGhlcGlyYXRlYmF5Lm9yZy9hbm5vdW5jZWVsMzU6dWRwOi8vdHJhY2tlci5vcGVuYml0dG9ycmVudC5jb206ODBlbDIzOnVkcDovL3RyYWNrZXIuY2NjLmRlOjgwZWwyOTp1ZHA6Ly90cmFja2VyLnB1YmxpY2J0LmNvbTo4MGVsNDM6dWRwOi8vZnIzM2RvbXRyYWNrZXIuaDMzdC5jb206MzMxMC9hbm5vdW5jZTM3Omh0dHA6Ly90cmFja2VyLmJpdHRvcnJlbnQuYW0vYW5ub3VuY2VlZTc6Y29tbWVudDM3OkRvd25sb2FkZWQgZnJvbSBodHRwOi8vVGhlVG9ycmVudC5vcmcxMDpjcmVhdGVkIGJ5MTM6dVRvcnJlbnQvMzMwMDEzOmNyZWF0aW9uIGRhdGVpMTM3NTM2MzY2NmU4OmVuY29kaW5nNTpVVEYtODQ6aW5mb2Q2Omxlbmd0aGkzNjIwMTdlMTI6cGllY2UgbGVuZ3RoaTE2Mzg0ZTY6cGllY2VzNDYwOh+cP1m+7AeXFexTMkvehWnkoLTr7EIwfUzlVXtdOWTF71XTVM9Kbsx78byvedEfpeC+Blk8j6r8DCuiz3bXHFsBUmsjAH+emSm+r8UVHmURCTGhtEwhvx5ouROPkEleaQ28VfVy5MKUTLrPJuazropyKdiKr6BfYequar8/B8ttuWd8xq3tTdOYXkWGJ1Z/p2OfBl9xsYlUMErKY2ZyngtHc9d66AyqlqUkgE3+S5vT3q75mcndUQJ0Z1GdXrJWGuLMAUZ95fZDDWC8uiR5dpLvqHcNI98Ngw2RyzWzQHqIuqBZDcjJqmoSDydDZ9zYZ+iOgzjFcqBuPIAbKfUZ31MrPnb2cM9q7lMQfz05N4SD9pz4D6VoserFO1BhWemI2LwWki0SXXfYA9ZSw8owcMFu7ZFyq1BtIOUi6j8atnSz+SPXb+j0T/MuNyw7N2VkxvtfDb5SFk8DYp/RMiY2urssAUt9rlgtpBNjllJh5s4StDcB8KjJ7RUgpw66AEQAomd2X2091ce+tb08dfPfKlRWDWGAEUf6TsfPVo5wOssE5WENTVbcwkLQMpPpRGz15FfY6z2ViP2Qxpjemw2tkpgJBsAm2MFAj6CP5OxlZQ==","base64") +window.leaves = leaves +var leavesParsed = { + infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + name: 'Leaves of Grass by Walt Whitman.epub', + private: false, + created: new Date('Thu Aug 01 2013 06:27:46 GMT-0700 (PDT)'), + announce: [ + 'http://tracker.thepiratebay.org/announce', + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.ccc.de:80', + 'udp://tracker.publicbt.com:80', + 'udp://fr33domtracker.h33t.com:3310/announce' + ], + files: [ + { + path: 'Leaves of Grass by Walt Whitman.epub', + name: 'Leaves of Grass by Walt Whitman.epub', + length: 362017, + offset: 0 + } + ], + pieceLength: 16384, + lastPieceLength: 1569, + pieces: [ + '1f9c3f59beec079715ec53324bde8569e4a0b4eb', + 'ec42307d4ce5557b5d3964c5ef55d354cf4a6ecc', + '7bf1bcaf79d11fa5e0be06593c8faafc0c2ba2cf', + '76d71c5b01526b23007f9e9929beafc5151e6511', + '0931a1b44c21bf1e68b9138f90495e690dbc55f5', + '72e4c2944cbacf26e6b3ae8a7229d88aafa05f61', + 'eaae6abf3f07cb6db9677cc6aded4dd3985e4586', + '27567fa7639f065f71b18954304aca6366729e0b', + '4773d77ae80caa96a524804dfe4b9bd3deaef999', + 'c9dd51027467519d5eb2561ae2cc01467de5f643', + '0a60bcba24797692efa8770d23df0a830d91cb35', + 'b3407a88baa0590dc8c9aa6a120f274367dcd867', + 'e88e8338c572a06e3c801b29f519df532b3e76f6', + '70cf6aee53107f3d39378483f69cf80fa568b1ea', + 'c53b506159e988d8bc16922d125d77d803d652c3', + 'ca3070c16eed9172ab506d20e522ea3f1ab674b3', + 'f923d76fe8f44ff32e372c3b376564c6fb5f0dbe', + '52164f03629fd1322636babb2c014b7dae582da4', + '1363965261e6ce12b43701f0a8c9ed1520a70eba', + '004400a267765f6d3dd5c7beb5bd3c75f3df2a54', + '560a61801147fa4ec7cf568e703acb04e5610a4d', + '56dcc242d03293e9446cf5e457d8eb3d9588fd90', + 'c698de9b0dad92980906c026d8c1408fa08fe4ec' + ] +} + +var prideParsed = { + infoHash: '455a2295b558ac64e0348fb0c61f433224484908', + name: 'PRIDE AND PREJUDICE - Jane Austen', + private: false, + created: new Date('Mon Jul 22 2013 10:33:19 GMT-0700 (PDT)'), + announce: [ + 'http://tracker.thepiratebay.org/announce', + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.ccc.de:80', + 'udp://tracker.publicbt.com:80', + 'http://tracker.tfile.me/announce', + 'http://tracker.marshyonline.net/announce', + 'http://tracker.ex.ua/announce', + 'http://i.bandito.org/announce', + 'http://greenlietracker.appspot.com/announce', + 'http://exodus.desync.com:6969/announce', + 'http://calu-atrack.appspot.com/announce', + 'http://calu-atrack.appspot.com.nyud.net/announce', + 'http://bt.poletracker.org:2710/announce', + 'http://bigfoot1942.sektori.org:6969/announce', + 'http://announce.opensharing.org:2710/announce', + 'http://94.228.192.98.nyud.net/announce', + 'http://bt.careland.com.cn:6969/announce', + 'http://e180.php5.cz/announce', + 'http://beta.mytracker.me:6969/announce', + 'http://tracker.metin2.com.br:6969/announce', + 'http://tracker1.wasabii.com.tw:6969/announce', + 'http://retracker.perm.ertelecom.ru/announce', + 'http://fr33dom.h33t.com:3310/announce', + 'http://exodus.desync.com/announce', + 'http://bt.eutorrents.com/announce.php', + 'http://retracker.hq.ertelecom.ru/announce', + 'http://announce.torrentsmd.com:8080/announce', + 'http://announce.torrentsmd.com:8080/announce.php', + 'http://www.h33t.com:3310/announce', + 'http://tracker.yify-torrents.com/announce', + 'http://announce.torrentsmd.com:6969/announce', + 'http://fr33domtracker.h33t.com:3310/announce' + ], + files: [ + { + path: 'PRIDE AND PREJUDICE - Jane Austen/Pride_and_Prejudice.pdf', + name: 'Pride_and_Prejudice.pdf', + length: 690450, + offset: 0 + }, + { + path: 'PRIDE AND PREJUDICE - Jane Austen/Pride_and_Prejudice.mobi', + name: 'Pride_and_Prejudice.mobi', + length: 487076, + offset: 690450 + }, + { + path: 'PRIDE AND PREJUDICE - Jane Austen/Pride and Prejudice.epub', + name: 'Pride and Prejudice.epub', + length: 305164, + offset: 1177526 + } + ], + pieceLength: 16384, + lastPieceLength: 8130, + pieces: [ + '56e502dc06ce8e6bb439f7e0bac27e69842bc89c', + 'b8d12dbd775b2b8cc01e03b18432703435531da8', + 'c2426cffcfebda20636abd71f0f4b4767cee9c42', + '45d6fa6fe69537a20c7af1842a00e1b5599e27f8', + 'dbcf01ae81a83d77853a4f71335b075d62adf748', + '49c8529ec2bc518cbbb67eeb53fa40b0b455af33', + '9409bff50cab58deecc989cff56660fe7bf6ff78', + '769c5ad7bd22e471ec8386275d4da3b61e114df7', + '92c02dc3038497340a7a51b63a1646a6f5b6288f', + 'eedc15ca2de41169daf767bf4766a0c48a5966aa', + 'cd2172f736be03d79691a9a0a4073cebe0957819', + '7ba2dc9e5a0cdb3aea094d5b89199dc90bc6aee8', + '406eb2a2a451092a05857abc5dca6b9adac483b7', + '48e4858ba838f953d11bc769a72ba1498185a18e', + '5cc7f7179555f1c0e5d98cd36076f0bbb2891d9e', + '6a475614b6e47df47239bc9c70e2b94f62b6de69', + '6a91e084f21f4717bbde75e4742215b09e82ed81', + '58f7d3ce0d9d71d14bb54911ee260378fb23c1e6', + 'e544318d3d14ad816517a494fc66e70e1631dfc9', + '6e5b77e5e7bb7c6d055702c8e6046561c0d49748', + '6319dac948f9a4f80650ea084e247f6f9a0ba929', + '7016da40784b71b9888eed73839590e04bfd525c', + 'd1107879a20033ba14c9086b48d317a6fea3f6f7', + '4491619af6aed40dc773e246f97dc546dfa557d5', + '63ddc93af5bd90f0fde853ff888b0482ac4bad9c', + '10aece0d35ec2627d0147d555dd523535287f05b', + '8adff2fce41765b268c007321cb858d3dbdb7401', + '7b74e03aeb18dde2e43739510636ef49d0d1a7ff', + '2f2ed0e7e11ac45706d5f8a5c4642bbef8026bc4', + '0f8aef0414c32b52f7b0a8abbc15f4e7e1b59707', + '385151aad082f239cbf85603c277fca0e1d04019', + '31a1b5ac49f62f34369f6fc9e3788050830160c2', + '3fe20c34e52a3c10eeb1ef3852a328e557e15e23', + 'b53d2714d5914f9e44863a58d2a293ad475c88ba', + '4ec1ad0905996699550c74c673ef774f5047fb88', + '1f70e15546078902e2fd2aa7cbfaad83a90a496b', + '3ced819a489fbe0b5f6355ec3c99aeb8818b4ab6', + 'e9d5a31e93f9113103521d0df827346ac393c862', + 'e7f431bef64c987badacf6c649f415f533b48fd5', + 'd6616dadd23054cb833e37ec7b53a7ca5edf824a', + 'eaf416c6d92cb5d28aa710b7512249705e00d855', + 'cd4df4dfd9c843aeba9459775323e8d6c9d85f68', + '4b07f3301f4746b714262a700cb6a9ef75e4b963', + '016ca0197293b5bd2ac0abf7a57189415ef16726', + 'd0a31ef2261b60e239b3483ce5d2b736ad6cea22', + 'cd4d4f122f8d4b2e83804c6dedc95d334f499fde', + '8c6bfb574c5691890d2b15b6ff5c18a9e9b99824', + '374663cf669727acdbf78a4ebb8100a8a443a8c2', + '5634ad15c8f0ab2437fe053d78a895073ee20b4c', + '519556f2243d5fdba5e4820e8ac3a4219b8715ed', + '2b5845bb45a460761630bf3a3865188a8febd2d4', + '24e2c96360edf7b3e2a6b7603a79ac54e741c472', + '39acaa42dd9a8d89660a8ec07ee6bf12194b5ae3', + '9fae46b3494e33f8c5e1f61b10eedf69374dbefe', + '899e83b4f5a847f5dbbc952f67ff77d6be082f96', + 'f573e4c764ef1f0f2f20b85a80629f7b15f882f7', + '19f16563ca572f84b47533fa24c690c21f868b9f', + 'ee76bae1bd68e42bc39e7559163cec0a54bf7e8c', + '7e67df4720f2a44262dbf89bb969e22e84a14f46', + 'b4f21fd71b9cd6f86db2deb567fe72ed98f7bc90', + '877581cf6dad17060386b250342388784290223a', + '1f1f9753f1de891165bb5291f7ac228dc98d9c2f', + '880138dbb26828c9cd55316f186c0e8d0f7ff4f5', + 'd96a87ae5a6b316189d73f3adccbba8ce6321e5a', + '6456e6fa11431d9c8e365c5c8202dbd69b8d243d', + '6348e1f7ce157c7bdcd6d62bb0c69dffad4af25d', + '61e7427baccfbba4b3d7e26e6e67f3ea543af9c0', + 'd8d17002beb969516cf84c92c0089ade049a7e22', + '743da7ee2297fbca93a4e33abc6f00079f143244', + '42ad48a49af42cc507ef375af9ee4848737b81f9', + '051c3bbe2e6adb32c7271fdd0beea190fa22ae24', + '938087e5c5d84b6a748476b99690b1aa372ed5fe', + '5a0e6df6d5f20bbc0ea9175fbc2b273233f2b338', + 'a9b04ce62bd5507dca5ec86136cbb3aabeefefa4', + '8fbff2d3bac5ecf14fc1622b5bf535401c1ed7bb', + 'b5c533ab1ff0e8ab855b7042d4e3c238955aa87d', + '84c765700d2fc8d908f88ed4ae0fdf96d5157c30', + '5b296e7112dc33e69aab3ab6e946a47fa389dac8', + 'b1842138abcbd0859b798bf14af9c7620a4c9a64', + 'c7936f8b8a87aa331095ec81666812d74a2ca7b4', + '63c84813baae4716df51e67ed65e39e2cb19abec', + 'b930014eef7374e1bb67cc0e3f56e5231800d00d', + 'e1d31be6858ad8910710c772499679aac3dda880', + 'c321105c6a22aeb7c80d6965ca5b807b3ea98467', + 'd3ee411a555b9e8d34d12464807511486cb2b813', + 'edb466e215767db3b7a0dd285cdeda37dbffd1aa', + 'd69ae8ca54101173188b3ca983509c8da46ac580', + 'af38e2516f6e5e4129e0c5f9efe0ad556f08fc48', + '696e1d36078c494bc67d7863bda8e861e1bc3045', + '516d770312c870273cae8aa03dbb07ca7533b969', + '405e29473fff065fa5807cd2e8953e48589a77c3' + ] +} + +test('parse single file torrent', function (t) { + t.doesNotThrow(function () { + parseTorrent(leaves) + }) + t.deepEquals(parseTorrent(leaves), leavesParsed) + t.end() +}) + +test('parse multiple file torrent', function (t) { + t.doesNotThrow(function () { + parseTorrent(pride) + }) + t.deepEquals(parseTorrent(pride), prideParsed) + t.end() +}) + +test('exception thrown when torrent file is missing `name` field', function (t) { + t.throws(function () { + parseTorrent(leavesCorrupt) + }) + t.end() +}) + +}).call(this,require("buffer").Buffer) +},{"../":1,"buffer":20,"fs":19,"tape":4}],19:[function(require,module,exports){ + +},{}],20:[function(require,module,exports){ +/** + * The buffer module from node.js, for the browser. + * + * Author: Feross Aboukhadijeh + * License: MIT + * + * `npm install buffer` + */ + +var base64 = require('base64-js') +var ieee754 = require('ieee754') + +exports.Buffer = Buffer +exports.SlowBuffer = Buffer +exports.INSPECT_MAX_BYTES = 50 +Buffer.poolSize = 8192 + +/** + * If `Buffer._useTypedArrays`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (compatible down to IE6) + */ +Buffer._useTypedArrays = (function () { + // Detect if browser supports Typed Arrays. Supported browsers are IE 10+, + // Firefox 4+, Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. + if (typeof Uint8Array === 'undefined' || typeof ArrayBuffer === 'undefined') + return false + + // Does the browser support adding properties to `Uint8Array` instances? If + // not, then that's the same as no `Uint8Array` support. We need to be able to + // add all the node Buffer API methods. + // Relevant Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=695438 + try { + var arr = new Uint8Array(0) + arr.foo = function () { return 42 } + return 42 === arr.foo() && + typeof arr.subarray === 'function' // Chrome 9-10 lack `subarray` + } catch (e) { + return false + } +})() + +/** + * Class: Buffer + * ============= + * + * The Buffer constructor returns instances of `Uint8Array` that are augmented + * with function properties for all the node `Buffer` API functions. We use + * `Uint8Array` so that square bracket notation works as expected -- it returns + * a single octet. + * + * By augmenting the instances, we can avoid modifying the `Uint8Array` + * prototype. + */ +function Buffer (subject, encoding, noZero) { + if (!(this instanceof Buffer)) + return new Buffer(subject, encoding, noZero) + + var type = typeof subject + + // Workaround: node's base64 implementation allows for non-padded strings + // while base64-js does not. + if (encoding === 'base64' && type === 'string') { + subject = stringtrim(subject) + while (subject.length % 4 !== 0) { + subject = subject + '=' + } + } + + // Find the length + var length + if (type === 'number') + length = coerce(subject) + else if (type === 'string') + length = Buffer.byteLength(subject, encoding) + else if (type === 'object') + length = coerce(subject.length) // Assume object is an array + else + throw new Error('First argument needs to be a number, array or string.') + + var buf + if (Buffer._useTypedArrays) { + // Preferred: Return an augmented `Uint8Array` instance for best performance + buf = augment(new Uint8Array(length)) + } else { + // Fallback: Return THIS instance of Buffer (created by `new`) + buf = this + buf.length = length + buf._isBuffer = true + } + + var i + if (Buffer._useTypedArrays && typeof Uint8Array === 'function' && + subject instanceof Uint8Array) { + // Speed optimization -- use set if we're copying from a Uint8Array + buf._set(subject) + } else if (isArrayish(subject)) { + // Treat array-ish objects as a byte array + for (i = 0; i < length; i++) { + if (Buffer.isBuffer(subject)) + buf[i] = subject.readUInt8(i) + else + buf[i] = subject[i] + } + } else if (type === 'string') { + buf.write(subject, 0, encoding) + } else if (type === 'number' && !Buffer._useTypedArrays && !noZero) { + for (i = 0; i < length; i++) { + buf[i] = 0 + } + } + + return buf +} + +// STATIC METHODS +// ============== + +Buffer.isEncoding = function (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'binary': + case 'base64': + case 'raw': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.isBuffer = function (b) { + return !!(b !== null && b !== undefined && b._isBuffer) +} + +Buffer.byteLength = function (str, encoding) { + var ret + str = str + '' + switch (encoding || 'utf8') { + case 'hex': + ret = str.length / 2 + break + case 'utf8': + case 'utf-8': + ret = utf8ToBytes(str).length + break + case 'ascii': + case 'binary': + case 'raw': + ret = str.length + break + case 'base64': + ret = base64ToBytes(str).length + break + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + ret = str.length * 2 + break + default: + throw new Error('Unknown encoding') + } + return ret +} + +Buffer.concat = function (list, totalLength) { + assert(isArray(list), 'Usage: Buffer.concat(list, [totalLength])\n' + + 'list should be an Array.') + + if (list.length === 0) { + return new Buffer(0) + } else if (list.length === 1) { + return list[0] + } + + var i + if (typeof totalLength !== 'number') { + totalLength = 0 + for (i = 0; i < list.length; i++) { + totalLength += list[i].length + } + } + + var buf = new Buffer(totalLength) + var pos = 0 + for (i = 0; i < list.length; i++) { + var item = list[i] + item.copy(buf, pos) + pos += item.length + } + return buf +} + +// BUFFER INSTANCE METHODS +// ======================= + +function _hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + var remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + // must be an even number of digits + var strLen = string.length + assert(strLen % 2 === 0, 'Invalid hex string') + + if (length > strLen / 2) { + length = strLen / 2 + } + for (var i = 0; i < length; i++) { + var byte = parseInt(string.substr(i * 2, 2), 16) + assert(!isNaN(byte), 'Invalid hex string') + buf[offset + i] = byte + } + Buffer._charsWritten = i * 2 + return i +} + +function _utf8Write (buf, string, offset, length) { + var charsWritten = Buffer._charsWritten = + blitBuffer(utf8ToBytes(string), buf, offset, length) + return charsWritten +} + +function _asciiWrite (buf, string, offset, length) { + var charsWritten = Buffer._charsWritten = + blitBuffer(asciiToBytes(string), buf, offset, length) + return charsWritten +} + +function _binaryWrite (buf, string, offset, length) { + return _asciiWrite(buf, string, offset, length) +} + +function _base64Write (buf, string, offset, length) { + var charsWritten = Buffer._charsWritten = + blitBuffer(base64ToBytes(string), buf, offset, length) + return charsWritten +} + +function _utf16leWrite (buf, string, offset, length) { + var charsWritten = Buffer._charsWritten = + blitBuffer(utf16leToBytes(string), buf, offset, length) + return charsWritten +} + +Buffer.prototype.write = function (string, offset, length, encoding) { + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length + length = undefined + } + } else { // legacy + var swap = encoding + encoding = offset + offset = length + length = swap + } + + offset = Number(offset) || 0 + var remaining = this.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + encoding = String(encoding || 'utf8').toLowerCase() + + var ret + switch (encoding) { + case 'hex': + ret = _hexWrite(this, string, offset, length) + break + case 'utf8': + case 'utf-8': + ret = _utf8Write(this, string, offset, length) + break + case 'ascii': + ret = _asciiWrite(this, string, offset, length) + break + case 'binary': + ret = _binaryWrite(this, string, offset, length) + break + case 'base64': + ret = _base64Write(this, string, offset, length) + break + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + ret = _utf16leWrite(this, string, offset, length) + break + default: + throw new Error('Unknown encoding') + } + return ret +} + +Buffer.prototype.toString = function (encoding, start, end) { + var self = this + + encoding = String(encoding || 'utf8').toLowerCase() + start = Number(start) || 0 + end = (end !== undefined) + ? Number(end) + : end = self.length + + // Fastpath empty strings + if (end === start) + return '' + + var ret + switch (encoding) { + case 'hex': + ret = _hexSlice(self, start, end) + break + case 'utf8': + case 'utf-8': + ret = _utf8Slice(self, start, end) + break + case 'ascii': + ret = _asciiSlice(self, start, end) + break + case 'binary': + ret = _binarySlice(self, start, end) + break + case 'base64': + ret = _base64Slice(self, start, end) + break + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + ret = _utf16leSlice(self, start, end) + break + default: + throw new Error('Unknown encoding') + } + return ret +} + +Buffer.prototype.toJSON = function () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function (target, target_start, start, end) { + var source = this + + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (!target_start) target_start = 0 + + // Copy 0 bytes; we're done + if (end === start) return + if (target.length === 0 || source.length === 0) return + + // Fatal error conditions + assert(end >= start, 'sourceEnd < sourceStart') + assert(target_start >= 0 && target_start < target.length, + 'targetStart out of bounds') + assert(start >= 0 && start < source.length, 'sourceStart out of bounds') + assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) + end = this.length + if (target.length - target_start < end - start) + end = target.length - target_start + start + + // copy! + for (var i = 0; i < end - start; i++) + target[i + target_start] = this[i + start] +} + +function _base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function _utf8Slice (buf, start, end) { + var res = '' + var tmp = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; i++) { + if (buf[i] <= 0x7F) { + res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i]) + tmp = '' + } else { + tmp += '%' + buf[i].toString(16) + } + } + + return res + decodeUtf8Char(tmp) +} + +function _asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; i++) + ret += String.fromCharCode(buf[i]) + return ret +} + +function _binarySlice (buf, start, end) { + return _asciiSlice(buf, start, end) +} + +function _hexSlice (buf, start, end) { + var len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + var out = '' + for (var i = start; i < end; i++) { + out += toHex(buf[i]) + } + return out +} + +function _utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end) + var res = '' + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i+1] * 256) + } + return res +} + +Buffer.prototype.slice = function (start, end) { + var len = this.length + start = clamp(start, len, 0) + end = clamp(end, len, len) + + if (Buffer._useTypedArrays) { + return augment(this.subarray(start, end)) + } else { + var sliceLen = end - start + var newBuf = new Buffer(sliceLen, undefined, true) + for (var i = 0; i < sliceLen; i++) { + newBuf[i] = this[i + start] + } + return newBuf + } +} + +// `get` will be removed in Node 0.13+ +Buffer.prototype.get = function (offset) { + console.log('.get() is deprecated. Access using array indexes instead.') + return this.readUInt8(offset) +} + +// `set` will be removed in Node 0.13+ +Buffer.prototype.set = function (v, offset) { + console.log('.set() is deprecated. Access using array indexes instead.') + return this.writeUInt8(v, offset) +} + +Buffer.prototype.readUInt8 = function (offset, noAssert) { + if (!noAssert) { + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset < this.length, 'Trying to read beyond buffer length') + } + + if (offset >= this.length) + return + + return this[offset] +} + +function _readUInt16 (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') + } + + var len = buf.length + if (offset >= len) + return + + var val + if (littleEndian) { + val = buf[offset] + if (offset + 1 < len) + val |= buf[offset + 1] << 8 + } else { + val = buf[offset] << 8 + if (offset + 1 < len) + val |= buf[offset + 1] + } + return val +} + +Buffer.prototype.readUInt16LE = function (offset, noAssert) { + return _readUInt16(this, offset, true, noAssert) +} + +Buffer.prototype.readUInt16BE = function (offset, noAssert) { + return _readUInt16(this, offset, false, noAssert) +} + +function _readUInt32 (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') + } + + var len = buf.length + if (offset >= len) + return + + var val + if (littleEndian) { + if (offset + 2 < len) + val = buf[offset + 2] << 16 + if (offset + 1 < len) + val |= buf[offset + 1] << 8 + val |= buf[offset] + if (offset + 3 < len) + val = val + (buf[offset + 3] << 24 >>> 0) + } else { + if (offset + 1 < len) + val = buf[offset + 1] << 16 + if (offset + 2 < len) + val |= buf[offset + 2] << 8 + if (offset + 3 < len) + val |= buf[offset + 3] + val = val + (buf[offset] << 24 >>> 0) + } + return val +} + +Buffer.prototype.readUInt32LE = function (offset, noAssert) { + return _readUInt32(this, offset, true, noAssert) +} + +Buffer.prototype.readUInt32BE = function (offset, noAssert) { + return _readUInt32(this, offset, false, noAssert) +} + +Buffer.prototype.readInt8 = function (offset, noAssert) { + if (!noAssert) { + assert(offset !== undefined && offset !== null, + 'missing offset') + assert(offset < this.length, 'Trying to read beyond buffer length') + } + + if (offset >= this.length) + return + + var neg = this[offset] & 0x80 + if (neg) + return (0xff - this[offset] + 1) * -1 + else + return this[offset] +} + +function _readInt16 (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') + } + + var len = buf.length + if (offset >= len) + return + + var val = _readUInt16(buf, offset, littleEndian, true) + var neg = val & 0x8000 + if (neg) + return (0xffff - val + 1) * -1 + else + return val +} + +Buffer.prototype.readInt16LE = function (offset, noAssert) { + return _readInt16(this, offset, true, noAssert) +} + +Buffer.prototype.readInt16BE = function (offset, noAssert) { + return _readInt16(this, offset, false, noAssert) +} + +function _readInt32 (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') + } + + var len = buf.length + if (offset >= len) + return + + var val = _readUInt32(buf, offset, littleEndian, true) + var neg = val & 0x80000000 + if (neg) + return (0xffffffff - val + 1) * -1 + else + return val +} + +Buffer.prototype.readInt32LE = function (offset, noAssert) { + return _readInt32(this, offset, true, noAssert) +} + +Buffer.prototype.readInt32BE = function (offset, noAssert) { + return _readInt32(this, offset, false, noAssert) +} + +function _readFloat (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') + } + + return ieee754.read(buf, offset, littleEndian, 23, 4) +} + +Buffer.prototype.readFloatLE = function (offset, noAssert) { + return _readFloat(this, offset, true, noAssert) +} + +Buffer.prototype.readFloatBE = function (offset, noAssert) { + return _readFloat(this, offset, false, noAssert) +} + +function _readDouble (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset + 7 < buf.length, 'Trying to read beyond buffer length') + } + + return ieee754.read(buf, offset, littleEndian, 52, 8) +} + +Buffer.prototype.readDoubleLE = function (offset, noAssert) { + return _readDouble(this, offset, true, noAssert) +} + +Buffer.prototype.readDoubleBE = function (offset, noAssert) { + return _readDouble(this, offset, false, noAssert) +} + +Buffer.prototype.writeUInt8 = function (value, offset, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset < this.length, 'trying to write beyond buffer length') + verifuint(value, 0xff) + } + + if (offset >= this.length) return + + this[offset] = value +} + +function _writeUInt16 (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 1 < buf.length, 'trying to write beyond buffer length') + verifuint(value, 0xffff) + } + + var len = buf.length + if (offset >= len) + return + + for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) { + buf[offset + i] = + (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> + (littleEndian ? i : 1 - i) * 8 + } +} + +Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) { + _writeUInt16(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) { + _writeUInt16(this, value, offset, false, noAssert) +} + +function _writeUInt32 (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'trying to write beyond buffer length') + verifuint(value, 0xffffffff) + } + + var len = buf.length + if (offset >= len) + return + + for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) { + buf[offset + i] = + (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff + } +} + +Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) { + _writeUInt32(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) { + _writeUInt32(this, value, offset, false, noAssert) +} + +Buffer.prototype.writeInt8 = function (value, offset, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset < this.length, 'Trying to write beyond buffer length') + verifsint(value, 0x7f, -0x80) + } + + if (offset >= this.length) + return + + if (value >= 0) + this.writeUInt8(value, offset, noAssert) + else + this.writeUInt8(0xff + value + 1, offset, noAssert) +} + +function _writeInt16 (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 1 < buf.length, 'Trying to write beyond buffer length') + verifsint(value, 0x7fff, -0x8000) + } + + var len = buf.length + if (offset >= len) + return + + if (value >= 0) + _writeUInt16(buf, value, offset, littleEndian, noAssert) + else + _writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert) +} + +Buffer.prototype.writeInt16LE = function (value, offset, noAssert) { + _writeInt16(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeInt16BE = function (value, offset, noAssert) { + _writeInt16(this, value, offset, false, noAssert) +} + +function _writeInt32 (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') + verifsint(value, 0x7fffffff, -0x80000000) + } + + var len = buf.length + if (offset >= len) + return + + if (value >= 0) + _writeUInt32(buf, value, offset, littleEndian, noAssert) + else + _writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert) +} + +Buffer.prototype.writeInt32LE = function (value, offset, noAssert) { + _writeInt32(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeInt32BE = function (value, offset, noAssert) { + _writeInt32(this, value, offset, false, noAssert) +} + +function _writeFloat (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') + verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + + var len = buf.length + if (offset >= len) + return + + ieee754.write(buf, value, offset, littleEndian, 23, 4) +} + +Buffer.prototype.writeFloatLE = function (value, offset, noAssert) { + _writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function (value, offset, noAssert) { + _writeFloat(this, value, offset, false, noAssert) +} + +function _writeDouble (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 7 < buf.length, + 'Trying to write beyond buffer length') + verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + + var len = buf.length + if (offset >= len) + return + + ieee754.write(buf, value, offset, littleEndian, 52, 8) +} + +Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) { + _writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) { + _writeDouble(this, value, offset, false, noAssert) +} + +// fill(value, start=0, end=buffer.length) +Buffer.prototype.fill = function (value, start, end) { + if (!value) value = 0 + if (!start) start = 0 + if (!end) end = this.length + + if (typeof value === 'string') { + value = value.charCodeAt(0) + } + + assert(typeof value === 'number' && !isNaN(value), 'value is not a number') + assert(end >= start, 'end < start') + + // Fill 0 bytes; we're done + if (end === start) return + if (this.length === 0) return + + assert(start >= 0 && start < this.length, 'start out of bounds') + assert(end >= 0 && end <= this.length, 'end out of bounds') + + for (var i = start; i < end; i++) { + this[i] = value + } +} + +Buffer.prototype.inspect = function () { + var out = [] + var len = this.length + for (var i = 0; i < len; i++) { + out[i] = toHex(this[i]) + if (i === exports.INSPECT_MAX_BYTES) { + out[i + 1] = '...' + break + } + } + return '' +} + +/** + * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance. + * Added in Node 0.12. Only available in browsers that support ArrayBuffer. + */ +Buffer.prototype.toArrayBuffer = function () { + if (typeof Uint8Array === 'function') { + if (Buffer._useTypedArrays) { + return (new Buffer(this)).buffer + } else { + var buf = new Uint8Array(this.length) + for (var i = 0, len = buf.length; i < len; i += 1) + buf[i] = this[i] + return buf.buffer + } + } else { + throw new Error('Buffer.toArrayBuffer not supported in this browser') + } +} + +// HELPER FUNCTIONS +// ================ + +function stringtrim (str) { + if (str.trim) return str.trim() + return str.replace(/^\s+|\s+$/g, '') +} + +var BP = Buffer.prototype + +/** + * Augment the Uint8Array *instance* (not the class!) with Buffer methods + */ +function augment (arr) { + arr._isBuffer = true + + // save reference to original Uint8Array get/set methods before overwriting + arr._get = arr.get + arr._set = arr.set + + // deprecated, will be removed in node 0.13+ + arr.get = BP.get + arr.set = BP.set + + arr.write = BP.write + arr.toString = BP.toString + arr.toLocaleString = BP.toString + arr.toJSON = BP.toJSON + arr.copy = BP.copy + arr.slice = BP.slice + arr.readUInt8 = BP.readUInt8 + arr.readUInt16LE = BP.readUInt16LE + arr.readUInt16BE = BP.readUInt16BE + arr.readUInt32LE = BP.readUInt32LE + arr.readUInt32BE = BP.readUInt32BE + arr.readInt8 = BP.readInt8 + arr.readInt16LE = BP.readInt16LE + arr.readInt16BE = BP.readInt16BE + arr.readInt32LE = BP.readInt32LE + arr.readInt32BE = BP.readInt32BE + arr.readFloatLE = BP.readFloatLE + arr.readFloatBE = BP.readFloatBE + arr.readDoubleLE = BP.readDoubleLE + arr.readDoubleBE = BP.readDoubleBE + arr.writeUInt8 = BP.writeUInt8 + arr.writeUInt16LE = BP.writeUInt16LE + arr.writeUInt16BE = BP.writeUInt16BE + arr.writeUInt32LE = BP.writeUInt32LE + arr.writeUInt32BE = BP.writeUInt32BE + arr.writeInt8 = BP.writeInt8 + arr.writeInt16LE = BP.writeInt16LE + arr.writeInt16BE = BP.writeInt16BE + arr.writeInt32LE = BP.writeInt32LE + arr.writeInt32BE = BP.writeInt32BE + arr.writeFloatLE = BP.writeFloatLE + arr.writeFloatBE = BP.writeFloatBE + arr.writeDoubleLE = BP.writeDoubleLE + arr.writeDoubleBE = BP.writeDoubleBE + arr.fill = BP.fill + arr.inspect = BP.inspect + arr.toArrayBuffer = BP.toArrayBuffer + + return arr +} + +// slice(start, end) +function clamp (index, len, defaultValue) { + if (typeof index !== 'number') return defaultValue + index = ~~index; // Coerce to integer. + if (index >= len) return len + if (index >= 0) return index + index += len + if (index >= 0) return index + return 0 +} + +function coerce (length) { + // Coerce length to a number (possibly NaN), round up + // in case it's fractional (e.g. 123.456) then do a + // double negate to coerce a NaN to 0. Easy, right? + length = ~~Math.ceil(+length) + return length < 0 ? 0 : length +} + +function isArray (subject) { + return (Array.isArray || function (subject) { + return Object.prototype.toString.call(subject) === '[object Array]' + })(subject) +} + +function isArrayish (subject) { + return isArray(subject) || Buffer.isBuffer(subject) || + subject && typeof subject === 'object' && + typeof subject.length === 'number' +} + +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) +} + +function utf8ToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; i++) { + var b = str.charCodeAt(i) + if (b <= 0x7F) + byteArray.push(str.charCodeAt(i)) + else { + var start = i + if (b >= 0xD800 && b <= 0xDFFF) i++ + var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%') + for (var j = 0; j < h.length; j++) + byteArray.push(parseInt(h[j], 16)) + } + } + return byteArray +} + +function asciiToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; i++) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; i++) { + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(str) +} + +function blitBuffer (src, dst, offset, length) { + var pos + for (var i = 0; i < length; i++) { + if ((i + offset >= dst.length) || (i >= src.length)) + break + dst[i + offset] = src[i] + } + return i +} + +function decodeUtf8Char (str) { + try { + return decodeURIComponent(str) + } catch (err) { + return String.fromCharCode(0xFFFD) // UTF 8 invalid char + } +} + +/* + * We have to make sure that the value is a valid integer. This means that it + * is non-negative. It has no fractional component and that it does not + * exceed the maximum allowed value. + */ +function verifuint (value, max) { + assert(typeof value === 'number', 'cannot write a non-number as a number') + assert(value >= 0, + 'specified a negative value for writing an unsigned value') + assert(value <= max, 'value is larger than maximum value for type') + assert(Math.floor(value) === value, 'value has a fractional component') +} + +function verifsint (value, max, min) { + assert(typeof value === 'number', 'cannot write a non-number as a number') + assert(value <= max, 'value larger than maximum allowed value') + assert(value >= min, 'value smaller than minimum allowed value') + assert(Math.floor(value) === value, 'value has a fractional component') +} + +function verifIEEE754 (value, max, min) { + assert(typeof value === 'number', 'cannot write a non-number as a number') + assert(value <= max, 'value larger than maximum allowed value') + assert(value >= min, 'value smaller than minimum allowed value') +} + +function assert (test, message) { + if (!test) throw new Error(message || 'Failed assertion') +} + +},{"base64-js":21,"ieee754":22}],21:[function(require,module,exports){ +var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + +;(function (exports) { + 'use strict'; + + var Arr = (typeof Uint8Array !== 'undefined') + ? Uint8Array + : Array + + var ZERO = '0'.charCodeAt(0) + var PLUS = '+'.charCodeAt(0) + var SLASH = '/'.charCodeAt(0) + var NUMBER = '0'.charCodeAt(0) + var LOWER = 'a'.charCodeAt(0) + var UPPER = 'A'.charCodeAt(0) + + function decode (elt) { + var code = elt.charCodeAt(0) + if (code === PLUS) + return 62 // '+' + if (code === SLASH) + return 63 // '/' + if (code < NUMBER) + return -1 //no match + if (code < NUMBER + 10) + return code - NUMBER + 26 + 26 + if (code < UPPER + 26) + return code - UPPER + if (code < LOWER + 26) + return code - LOWER + 26 + } + + function b64ToByteArray (b64) { + var i, j, l, tmp, placeHolders, arr + + if (b64.length % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // the number of equal signs (place holders) + // if there are two placeholders, than the two characters before it + // represent one byte + // if there is only one, then the three characters before it represent 2 bytes + // this is just a cheap hack to not do indexOf twice + var len = b64.length + placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0 + + // base64 is 4/3 + up to two characters of the original data + arr = new Arr(b64.length * 3 / 4 - placeHolders) + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? b64.length - 4 : b64.length + + var L = 0 + + function push (v) { + arr[L++] = v + } + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3)) + push((tmp & 0xFF0000) >> 16) + push((tmp & 0xFF00) >> 8) + push(tmp & 0xFF) + } + + if (placeHolders === 2) { + tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4) + push(tmp & 0xFF) + } else if (placeHolders === 1) { + tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2) + push((tmp >> 8) & 0xFF) + push(tmp & 0xFF) + } + + return arr + } + + function uint8ToBase64 (uint8) { + var i, + extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes + output = "", + temp, length + + function encode (num) { + return lookup.charAt(num) + } + + function tripletToBase64 (num) { + return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F) + } + + // go through the array every three bytes, we'll deal with trailing stuff later + for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { + temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) + output += tripletToBase64(temp) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + switch (extraBytes) { + case 1: + temp = uint8[uint8.length - 1] + output += encode(temp >> 2) + output += encode((temp << 4) & 0x3F) + output += '==' + break + case 2: + temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) + output += encode(temp >> 10) + output += encode((temp >> 4) & 0x3F) + output += encode((temp << 2) & 0x3F) + output += '=' + break + } + + return output + } + + module.exports.toByteArray = b64ToByteArray + module.exports.fromByteArray = uint8ToBase64 +}()) + +},{}],22:[function(require,module,exports){ +exports.read = function(buffer, offset, isLE, mLen, nBytes) { + var e, m, + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + nBits = -7, + i = isLE ? (nBytes - 1) : 0, + d = isLE ? -1 : 1, + s = buffer[offset + i]; + + i += d; + + e = s & ((1 << (-nBits)) - 1); + s >>= (-nBits); + nBits += eLen; + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); + + m = e & ((1 << (-nBits)) - 1); + e >>= (-nBits); + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity); + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); +}; + +exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c, + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), + i = isLE ? 0 : (nBytes - 1), + d = isLE ? 1 : -1, + s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; + + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); + + e = (e << mLen) | m; + eLen += mLen; + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); + + buffer[offset + i - d] |= s * 128; +}; + +},{}],23:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; + +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; + + if (!this._events) + this._events = {}; + + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } else { + throw TypeError('Uncaught, unspecified "error" event.'); + } + return false; + } + } + + handler = this._events[type]; + + if (isUndefined(handler)) + return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + len = arguments.length; + args = new Array(len - 1); + for (i = 1; i < len; i++) + args[i - 1] = arguments[i]; + handler.apply(this, args); + } + } else if (isObject(handler)) { + len = arguments.length; + args = new Array(len - 1); + for (i = 1; i < len; i++) + args[i - 1] = arguments[i]; + + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); + } + + return true; +}; + +EventEmitter.prototype.addListener = function(type, listener) { + var m; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events) + this._events = {}; + + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); + + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + var m; + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } + + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + console.trace(); + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) + return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); + + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + if (!this._events) + return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.listenerCount = function(emitter, type) { + var ret; + if (!emitter._events || !emitter._events[type]) + ret = 0; + else if (isFunction(emitter._events[type])) + ret = 1; + else + ret = emitter._events[type].length; + return ret; +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + +},{}],24:[function(require,module,exports){ +module.exports=require(12) +},{}],25:[function(require,module,exports){ +// shim for using process in browser + +var process = module.exports = {}; + +process.nextTick = (function () { + var canSetImmediate = typeof window !== 'undefined' + && window.setImmediate; + var canPost = typeof window !== 'undefined' + && window.postMessage && window.addEventListener + ; + + if (canSetImmediate) { + return function (f) { return window.setImmediate(f) }; + } + + if (canPost) { + var queue = []; + window.addEventListener('message', function (ev) { + var source = ev.source; + if ((source === window || source === null) && ev.data === 'process-tick') { + ev.stopPropagation(); + if (queue.length > 0) { + var fn = queue.shift(); + fn(); + } + } + }, true); + + return function nextTick(fn) { + queue.push(fn); + window.postMessage('process-tick', '*'); + }; + } + + return function nextTick(fn) { + setTimeout(fn, 0); + }; +})(); + +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +} + +// TODO(shtylman) +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; + +},{}],26:[function(require,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; + +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; + + +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } +; + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25}],27:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +module.exports = Duplex; +var inherits = require('inherits'); +var setImmediate = require('process/browser.js').nextTick; +var Readable = require('./readable.js'); +var Writable = require('./writable.js'); + +inherits(Duplex, Readable); + +Duplex.prototype.write = Writable.prototype.write; +Duplex.prototype.end = Writable.prototype.end; +Duplex.prototype._write = Writable.prototype._write; + +function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) + this.readable = false; + + if (options && options.writable === false) + this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) + this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) + return; + + // no more data can be written. + // But allow more writes to happen in this tick. + var self = this; + setImmediate(function () { + self.end(); + }); +} + +},{"./readable.js":31,"./writable.js":33,"inherits":24,"process/browser.js":29}],28:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +module.exports = Stream; + +var EE = require('events').EventEmitter; +var inherits = require('inherits'); + +inherits(Stream, EE); +Stream.Readable = require('./readable.js'); +Stream.Writable = require('./writable.js'); +Stream.Duplex = require('./duplex.js'); +Stream.Transform = require('./transform.js'); +Stream.PassThrough = require('./passthrough.js'); + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; + + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); +} + +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } + + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } + + dest.on('drain', ondrain); + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); + } + + + function onclose() { + if (didOnEnd) return; + didOnEnd = true; + + if (typeof dest.destroy === 'function') dest.destroy(); + } + + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } + + source.on('error', onerror); + dest.on('error', onerror); + + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); + + source.removeListener('end', onend); + source.removeListener('close', onclose); + + source.removeListener('error', onerror); + dest.removeListener('error', onerror); + + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); + } + + source.on('end', cleanup); + source.on('close', cleanup); + + dest.on('close', cleanup); + + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; + +},{"./duplex.js":27,"./passthrough.js":30,"./readable.js":31,"./transform.js":32,"./writable.js":33,"events":23,"inherits":24}],29:[function(require,module,exports){ +module.exports=require(25) +},{}],30:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +module.exports = PassThrough; + +var Transform = require('./transform.js'); +var inherits = require('inherits'); +inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); +}; + +},{"./transform.js":32,"inherits":24}],31:[function(require,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +module.exports = Readable; +Readable.ReadableState = ReadableState; + +var EE = require('events').EventEmitter; +var Stream = require('./index.js'); +var Buffer = require('buffer').Buffer; +var setImmediate = require('process/browser.js').nextTick; +var StringDecoder; + +var inherits = require('inherits'); +inherits(Readable, Stream); + +function ReadableState(options, stream) { + options = options || {}; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.buffer = []; + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = false; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // In streams that never have any data, and do push(null) right away, + // the consumer can miss the 'end' event if they do some I/O before + // consuming the stream. So, we don't emit('end') until some reading + // happens. + this.calledRead = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, becuase any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require('string_decoder').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + if (!(this instanceof Readable)) + return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + + if (typeof chunk === 'string' && !state.objectMode) { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = new Buffer(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function(chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null || chunk === undefined) { + state.reading = false; + if (!state.ended) + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var e = new Error('stream.unshift() after end event'); + stream.emit('error', e); + } else { + if (state.decoder && !addToFront && !encoding) + chunk = state.decoder.write(chunk); + + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) { + state.buffer.unshift(chunk); + } else { + state.reading = false; + state.buffer.push(chunk); + } + + if (state.needReadable) + emitReadable(stream); + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + + + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && + (state.needReadable || + state.length < state.highWaterMark || + state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require('string_decoder').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; +}; + +// Don't raise the hwm > 128MB +var MAX_HWM = 0x800000; +function roundUpToNextPowerOf2(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 + n--; + for (var p = 1; p < 32; p <<= 1) n |= n >> p; + n++; + } + return n; +} + +function howMuchToRead(n, state) { + if (state.length === 0 && state.ended) + return 0; + + if (state.objectMode) + return n === 0 ? 0 : 1; + + if (isNaN(n) || n === null) { + // only flow one buffer at a time + if (state.flowing && state.buffer.length) + return state.buffer[0].length; + else + return state.length; + } + + if (n <= 0) + return 0; + + // If we're asking for more than the target buffer level, + // then raise the water mark. Bump up to the next highest + // power of 2, to prevent increasing it excessively in tiny + // amounts. + if (n > state.highWaterMark) + state.highWaterMark = roundUpToNextPowerOf2(n); + + // don't have that much. return null, unless we've ended. + if (n > state.length) { + if (!state.ended) { + state.needReadable = true; + return 0; + } else + return state.length; + } + + return n; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function(n) { + var state = this._readableState; + state.calledRead = true; + var nOrig = n; + + if (typeof n !== 'number' || n > 0) + state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && + state.needReadable && + (state.length >= state.highWaterMark || state.ended)) { + emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + + // if we currently have less than the highWaterMark, then also read some + if (state.length - n <= state.highWaterMark) + doRead = true; + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) + doRead = false; + + if (doRead) { + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) + state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + } + + // If _read called its callback synchronously, then `reading` + // will be false, and we need to re-evaluate how much data we + // can return to the user. + if (doRead && !state.reading) + n = howMuchToRead(nOrig, state); + + var ret; + if (n > 0) + ret = fromList(n, state); + else + ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } + + state.length -= n; + + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (state.length === 0 && !state.ended) + state.needReadable = true; + + // If we happened to read() exactly the remaining amount in the + // buffer, and the EOF has been seen at this point, then make sure + // that we emit 'end' on the very next tick. + if (state.ended && !state.endEmitted && state.length === 0) + endReadable(this); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && + !state.objectMode && + !er) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + + +function onEofChunk(stream, state) { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // if we've ended and we have some data left, then emit + // 'readable' now to make sure it gets picked up. + if (state.length > 0) + emitReadable(stream); + else + endReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (state.emittedReadable) + return; + + state.emittedReadable = true; + if (state.sync) + setImmediate(function() { + emitReadable_(stream); + }); + else + emitReadable_(stream); +} + +function emitReadable_(stream) { + stream.emit('readable'); +} + + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + setImmediate(function() { + maybeReadMore_(stream, state); + }); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && + state.length < state.highWaterMark) { + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + else + len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function(n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && + dest !== process.stdout && + dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) + setImmediate(endFn); + else + src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + if (readable !== src) return; + cleanup(); + } + + function onend() { + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + function cleanup() { + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (!dest._writableState || dest._writableState.needDrain) + ondrain(); + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + // check for listeners before emit removes one-time listeners. + var errListeners = EE.listenerCount(dest, 'error'); + function onerror(er) { + unpipe(); + if (errListeners === 0 && EE.listenerCount(dest, 'error') === 0) + dest.emit('error', er); + } + dest.once('error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + // the handler that waits for readable events after all + // the data gets sucked out in flow. + // This would be easier to follow with a .once() handler + // in flow(), but that is too slow. + this.on('readable', pipeOnReadable); + + state.flowing = true; + setImmediate(function() { + flow(src); + }); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function() { + var dest = this; + var state = src._readableState; + state.awaitDrain--; + if (state.awaitDrain === 0) + flow(src); + }; +} + +function flow(src) { + var state = src._readableState; + var chunk; + state.awaitDrain = 0; + + function write(dest, i, list) { + var written = dest.write(chunk); + if (false === written) { + state.awaitDrain++; + } + } + + while (state.pipesCount && null !== (chunk = src.read())) { + + if (state.pipesCount === 1) + write(state.pipes, 0, null); + else + forEach(state.pipes, write); + + src.emit('data', chunk); + + // if anyone needs a drain, then we have to wait for that. + if (state.awaitDrain > 0) + return; + } + + // if every destination was unpiped, either before entering this + // function, or in the while loop, then stop flowing. + // + // NB: This is a pretty rare edge case. + if (state.pipesCount === 0) { + state.flowing = false; + + // if there were data event listeners added, then switch to old mode. + if (EE.listenerCount(src, 'data') > 0) + emitDataEvents(src); + return; + } + + // at this point, no one needed a drain, so we just ran out of data + // on the next readable event, start it over again. + state.ranOut = true; +} + +function pipeOnReadable() { + if (this._readableState.ranOut) { + this._readableState.ranOut = false; + flow(this); + } +} + + +Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) + return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) + return this; + + if (!dest) + dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); + state.flowing = false; + if (dest) + dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); + state.flowing = false; + + for (var i = 0; i < len; i++) + dests[i].emit('unpipe', this); + return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) + return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data' && !this._readableState.flowing) + emitDataEvents(this); + + if (ev === 'readable' && this.readable) { + var state = this._readableState; + if (!state.readableListening) { + state.readableListening = true; + state.emittedReadable = false; + state.needReadable = true; + if (!state.reading) { + this.read(0); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function() { + emitDataEvents(this); + this.read(0); + this.emit('resume'); +}; + +Readable.prototype.pause = function() { + emitDataEvents(this, true); + this.emit('pause'); +}; + +function emitDataEvents(stream, startPaused) { + var state = stream._readableState; + + if (state.flowing) { + // https://github.com/isaacs/readable-stream/issues/16 + throw new Error('Cannot switch to old mode now.'); + } + + var paused = startPaused || false; + var readable = false; + + // convert to an old-style stream. + stream.readable = true; + stream.pipe = Stream.prototype.pipe; + stream.on = stream.addListener = Stream.prototype.on; + + stream.on('readable', function() { + readable = true; + + var c; + while (!paused && (null !== (c = stream.read()))) + stream.emit('data', c); + + if (c === null) { + readable = false; + stream._readableState.needReadable = true; + } + }); + + stream.pause = function() { + paused = true; + this.emit('pause'); + }; + + stream.resume = function() { + paused = false; + if (readable) + setImmediate(function() { + stream.emit('readable'); + }); + else + this.read(0); + this.emit('resume'); + }; + + // now make it start, just in case it hadn't already. + stream.emit('readable'); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function(stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function() { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function(chunk) { + if (state.decoder) + chunk = state.decoder.write(chunk); + if (!chunk || !state.objectMode && !chunk.length) + return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (typeof stream[i] === 'function' && + typeof this[i] === 'undefined') { + this[i] = function(method) { return function() { + return stream[method].apply(stream, arguments); + }}(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function(ev) { + stream.on(ev, function (x) { + return self.emit.apply(self, ev, x); + }); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function(n) { + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + + + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +function fromList(n, state) { + var list = state.buffer; + var length = state.length; + var stringMode = !!state.decoder; + var objectMode = !!state.objectMode; + var ret; + + // nothing in the list, definitely empty. + if (list.length === 0) + return null; + + if (length === 0) + ret = null; + else if (objectMode) + ret = list.shift(); + else if (!n || n >= length) { + // read it all, truncate the array. + if (stringMode) + ret = list.join(''); + else + ret = Buffer.concat(list, length); + list.length = 0; + } else { + // read just some of it. + if (n < list[0].length) { + // just take a part of the first list item. + // slice is the same for buffers and strings. + var buf = list[0]; + ret = buf.slice(0, n); + list[0] = buf.slice(n); + } else if (n === list[0].length) { + // first list is a perfect match + ret = list.shift(); + } else { + // complex case. + // we have enough to cover it, but it spans past the first buffer. + if (stringMode) + ret = ''; + else + ret = new Buffer(n); + + var c = 0; + for (var i = 0, l = list.length; i < l && c < n; i++) { + var buf = list[0]; + var cpy = Math.min(n - c, buf.length); + + if (stringMode) + ret += buf.slice(0, cpy); + else + buf.copy(ret, c, 0, cpy); + + if (cpy < buf.length) + list[0] = buf.slice(cpy); + else + list.shift(); + + c += cpy; + } + } + } + + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) + throw new Error('endReadable called on non-empty stream'); + + if (!state.endEmitted && state.calledRead) { + state.ended = true; + setImmediate(function() { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } + }); + } +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf (xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"./index.js":28,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"buffer":20,"events":23,"inherits":24,"process/browser.js":29,"string_decoder":34}],32:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +module.exports = Transform; + +var Duplex = require('./duplex.js'); +var inherits = require('inherits'); +inherits(Transform, Duplex); + + +function TransformState(options, stream) { + this.afterTransform = function(er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) + return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (data !== null && data !== undefined) + stream.push(data); + + if (cb) + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + + +function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + + Duplex.call(this, options); + + var ts = this._transformState = new TransformState(options, this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + this.once('finish', function() { + if ('function' === typeof this._flush) + this._flush(function(er) { + done(stream, er); + }); + else + done(stream); + }); +} + +Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function(chunk, encoding, cb) { + throw new Error('not implemented'); +}; + +Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || + rs.needReadable || + rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function(n) { + var ts = this._transformState; + + if (ts.writechunk && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + + +function done(stream, er) { + if (er) + return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var rs = stream._readableState; + var ts = stream._transformState; + + if (ws.length) + throw new Error('calling transform done when ws.length != 0'); + + if (ts.transforming) + throw new Error('calling transform done when still transforming'); + + return stream.push(null); +} + +},{"./duplex.js":27,"inherits":24}],33:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, cb), and it'll handle all +// the drain event emission and buffering. + +module.exports = Writable; +Writable.WritableState = WritableState; + +var isUint8Array = typeof Uint8Array !== 'undefined' + ? function (x) { return x instanceof Uint8Array } + : function (x) { + return x && x.constructor && x.constructor.name === 'Uint8Array' + } +; +var isArrayBuffer = typeof ArrayBuffer !== 'undefined' + ? function (x) { return x instanceof ArrayBuffer } + : function (x) { + return x && x.constructor && x.constructor.name === 'ArrayBuffer' + } +; + +var inherits = require('inherits'); +var Stream = require('./index.js'); +var setImmediate = require('process/browser.js').nextTick; +var Buffer = require('buffer').Buffer; + +inherits(Writable, Stream); + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; +} + +function WritableState(options, stream) { + options = options || {}; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, becuase any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function(er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.buffer = []; +} + +function Writable(options) { + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Stream.Duplex)) + return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function() { + this.emit('error', new Error('Cannot pipe. Not readable.')); +}; + + +function writeAfterEnd(stream, state, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + setImmediate(function() { + cb(er); + }); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && + !state.objectMode) { + var er = new TypeError('Invalid non-string/buffer chunk'); + stream.emit('error', er); + setImmediate(function() { + cb(er); + }); + valid = false; + } + return valid; +} + +Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (!Buffer.isBuffer(chunk) && isUint8Array(chunk)) + chunk = new Buffer(chunk); + if (isArrayBuffer(chunk) && typeof Uint8Array !== 'undefined') + chunk = new Buffer(new Uint8Array(chunk)); + + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + else if (!encoding) + encoding = state.defaultEncoding; + + if (typeof cb !== 'function') + cb = function() {}; + + if (state.ended) + writeAfterEnd(this, state, cb); + else if (validChunk(this, state, chunk, cb)) + ret = writeOrBuffer(this, state, chunk, encoding, cb); + + return ret; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && + state.decodeStrings !== false && + typeof chunk === 'string') { + chunk = new Buffer(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + state.needDrain = !ret; + + if (state.writing) + state.buffer.push(new WriteReq(chunk, encoding, cb)); + else + doWrite(stream, state, len, chunk, encoding, cb); + + return ret; +} + +function doWrite(stream, state, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + if (sync) + setImmediate(function() { + cb(er); + }); + else + cb(er); + + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) + onwriteError(stream, state, sync, er, cb); + else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(stream, state); + + if (!finished && !state.bufferProcessing && state.buffer.length) + clearBuffer(stream, state); + + if (sync) { + setImmediate(function() { + afterWrite(stream, state, finished, cb); + }); + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + cb(); + if (finished) + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + + for (var c = 0; c < state.buffer.length; c++) { + var entry = state.buffer[c]; + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, len, chunk, encoding, cb); + + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + c++; + break; + } + } + + state.bufferProcessing = false; + if (c < state.buffer.length) + state.buffer = state.buffer.slice(c); + else + state.buffer.length = 0; +} + +Writable.prototype._write = function(chunk, encoding, cb) { + cb(new Error('not implemented')); +}; + +Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (typeof chunk !== 'undefined' && chunk !== null) + this.write(chunk, encoding); + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) + endWritable(this, state, cb); +}; + + +function needFinish(stream, state) { + return (state.ending && + state.length === 0 && + !state.finished && + !state.writing); +} + +function finishMaybe(stream, state) { + var need = needFinish(stream, state); + if (need) { + state.finished = true; + stream.emit('finish'); + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + setImmediate(cb); + else + stream.once('finish', cb); + } + state.ended = true; +} + +},{"./index.js":28,"buffer":20,"inherits":24,"process/browser.js":29}],34:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +var Buffer = require('buffer').Buffer; + +function assertEncoding(encoding) { + if (encoding && !Buffer.isEncoding(encoding)) { + throw new Error('Unknown encoding: ' + encoding); + } +} + +var StringDecoder = exports.StringDecoder = function(encoding) { + this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); + assertEncoding(encoding); + switch (this.encoding) { + case 'utf8': + // CESU-8 represents each of Surrogate Pair by 3-bytes + this.surrogateSize = 3; + break; + case 'ucs2': + case 'utf16le': + // UTF-16 represents each of Surrogate Pair by 2-bytes + this.surrogateSize = 2; + this.detectIncompleteChar = utf16DetectIncompleteChar; + break; + case 'base64': + // Base-64 stores 3 bytes in 4 chars, and pads the remainder. + this.surrogateSize = 3; + this.detectIncompleteChar = base64DetectIncompleteChar; + break; + default: + this.write = passThroughWrite; + return; + } + + this.charBuffer = new Buffer(6); + this.charReceived = 0; + this.charLength = 0; +}; + + +StringDecoder.prototype.write = function(buffer) { + var charStr = ''; + var offset = 0; + + // if our last write ended with an incomplete multibyte character + while (this.charLength) { + // determine how many remaining bytes this buffer has to offer for this char + var i = (buffer.length >= this.charLength - this.charReceived) ? + this.charLength - this.charReceived : + buffer.length; + + // add the new bytes to the char buffer + buffer.copy(this.charBuffer, this.charReceived, offset, i); + this.charReceived += (i - offset); + offset = i; + + if (this.charReceived < this.charLength) { + // still not enough chars in this buffer? wait for more ... + return ''; + } + + // get the character that was split + charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); + + // lead surrogate (D800-DBFF) is also the incomplete character + var charCode = charStr.charCodeAt(charStr.length - 1); + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + this.charLength += this.surrogateSize; + charStr = ''; + continue; + } + this.charReceived = this.charLength = 0; + + // if there are no more bytes in this buffer, just emit our char + if (i == buffer.length) return charStr; + + // otherwise cut off the characters end from the beginning of this buffer + buffer = buffer.slice(i, buffer.length); + break; + } + + var lenIncomplete = this.detectIncompleteChar(buffer); + + var end = buffer.length; + if (this.charLength) { + // buffer the incomplete character bytes we got + buffer.copy(this.charBuffer, 0, buffer.length - lenIncomplete, end); + this.charReceived = lenIncomplete; + end -= lenIncomplete; + } + + charStr += buffer.toString(this.encoding, 0, end); + + var end = charStr.length - 1; + var charCode = charStr.charCodeAt(end); + // lead surrogate (D800-DBFF) is also the incomplete character + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + var size = this.surrogateSize; + this.charLength += size; + this.charReceived += size; + this.charBuffer.copy(this.charBuffer, size, 0, size); + this.charBuffer.write(charStr.charAt(charStr.length - 1), this.encoding); + return charStr.substring(0, end); + } + + // or just emit the charStr + return charStr; +}; + +StringDecoder.prototype.detectIncompleteChar = function(buffer) { + // determine how many bytes we have to check at the end of this buffer + var i = (buffer.length >= 3) ? 3 : buffer.length; + + // Figure out if one of the last i bytes of our buffer announces an + // incomplete char. + for (; i > 0; i--) { + var c = buffer[buffer.length - i]; + + // See http://en.wikipedia.org/wiki/UTF-8#Description + + // 110XXXXX + if (i == 1 && c >> 5 == 0x06) { + this.charLength = 2; + break; + } + + // 1110XXXX + if (i <= 2 && c >> 4 == 0x0E) { + this.charLength = 3; + break; + } + + // 11110XXX + if (i <= 3 && c >> 3 == 0x1E) { + this.charLength = 4; + break; + } + } + + return i; +}; + +StringDecoder.prototype.end = function(buffer) { + var res = ''; + if (buffer && buffer.length) + res = this.write(buffer); + + if (this.charReceived) { + var cr = this.charReceived; + var buf = this.charBuffer; + var enc = this.encoding; + res += buf.slice(0, cr).toString(enc); + } + + return res; +}; + +function passThroughWrite(buffer) { + return buffer.toString(this.encoding); +} + +function utf16DetectIncompleteChar(buffer) { + var incomplete = this.charReceived = buffer.length % 2; + this.charLength = incomplete ? 2 : 0; + return incomplete; +} + +function base64DetectIncompleteChar(buffer) { + var incomplete = this.charReceived = buffer.length % 3; + this.charLength = incomplete ? 3 : 0; + return incomplete; +} + +},{"buffer":20}],35:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],36:[function(require,module,exports){ +(function (process,global){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + + +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + + if (process.noDeprecation === true) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +}; + + +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; + + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = require('./support/isBuffer'); + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = require('inherits'); + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":35,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"inherits":24}]},{},[18]) \ No newline at end of file diff --git a/node_modules/parse-torrent/index.js b/node_modules/parse-torrent/index.js new file mode 100644 index 00000000..411f75a7 --- /dev/null +++ b/node_modules/parse-torrent/index.js @@ -0,0 +1,32 @@ +var magnet = require('magnet-uri') +var parseTorrentFile = require('parse-torrent-file') + +/** + * Parse a torrent identifier (magnet uri, .torrent file, info hash) + * @param {string|Buffer|Object} torrentId + * @return {Object} + */ +module.exports = function parseTorrent (torrentId) { + var len = torrentId && torrentId.length + if (typeof torrentId === 'string' && /magnet:/.test(torrentId)) { + // magnet uri (string) + return magnet(torrentId) + } else if (typeof torrentId === 'string' && (len === 40 || len === 32)) { + // info hash (hex/base-32 string) + return magnet('magnet:?xt=urn:btih:' + torrentId) + } else if (Buffer.isBuffer(torrentId) && len === 20) { + // info hash (buffer) + return magnet('magnet:?xt=urn:btih:' + torrentId.toString('hex')) + } else if (Buffer.isBuffer(torrentId)) { + // .torrent file (buffer) + return parseTorrentFile(torrentId) // might throw + } else if (torrentId && torrentId.infoHash) { + // parsed torrent (from `parse-torrent`, `parse-torrent-file`, or `magnet-uri`) + return torrentId + } else { + throw new Error('Invalid torrent identifier') + } +} + +module.exports.toMagnetURI = magnet.encode +module.exports.toTorrentFile = parseTorrentFile.encode diff --git a/node_modules/parse-torrent/node_modules/.bin/parse-torrent-file b/node_modules/parse-torrent/node_modules/.bin/parse-torrent-file new file mode 120000 index 00000000..3eed0ad6 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/.bin/parse-torrent-file @@ -0,0 +1 @@ +../parse-torrent-file/bin/cmd.js \ No newline at end of file diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/.travis.yml b/node_modules/parse-torrent/node_modules/magnet-uri/.travis.yml new file mode 100644 index 00000000..65209dcd --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: +- '0.10' +env: + global: + - secure: RDedoP0og9+2sz/AW4BPTIhhsEqaqlfGfMDDav4lC8cbPUK4U8FEifm8l0Vu6w2ooQuGX1/Kg8kSejkb28F2DbejwBu0Y7VIxbmYMLg7/EZ+dIknGIOsH/7TsLRwvZYMIvrl3J0br/vQvxdtgQ4r5iLEqoeqWfxGet42BHcSsIQ= + - secure: JUKHBqhELMeM1f4vuBaJse/fXdyNPOPnLQPQxp3dmwm36RH25CnB6REGp9aJ1LWmBGV2myNubBD/oXannKdLsRouoeITtdFQqlO0oPxoqBfNGIaJaOOYYweOTiYkVbGBtgs6TQWgRjklzgpk3aWIHb+hTG5hxGoCI/xrsBLCDuE= diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/.zuul.yml b/node_modules/parse-torrent/node_modules/magnet-uri/.zuul.yml new file mode 100644 index 00000000..00fd8dd4 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/.zuul.yml @@ -0,0 +1,16 @@ +ui: tape +browsers: + - name: chrome + version: latest + - name: firefox + version: latest + - name: safari + version: latest + - name: ie + version: latest + - name: iphone + version: latest + - name: ipad + version: latest + - name: android + version: latest diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/LICENSE b/node_modules/parse-torrent/node_modules/magnet-uri/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/parse-torrent/node_modules/magnet-uri/README.md b/node_modules/parse-torrent/node_modules/magnet-uri/README.md new file mode 100644 index 00000000..2cf385e2 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/README.md @@ -0,0 +1,106 @@ +# magnet-uri [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] + +[travis-image]: https://img.shields.io/travis/feross/magnet-uri.svg?style=flat +[travis-url]: https://travis-ci.org/feross/magnet-uri +[npm-image]: https://img.shields.io/npm/v/magnet-uri.svg?style=flat +[npm-url]: https://npmjs.org/package/magnet-uri +[downloads-image]: https://img.shields.io/npm/dm/magnet-uri.svg?style=flat +[downloads-url]: https://npmjs.org/package/magnet-uri + +### Parse a magnet URI and return an object of keys/values. + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/magnet-uri.svg)](https://saucelabs.com/u/magnet-uri) + +Also works in the browser with [browserify](http://browserify.org/)! This module is used by [WebTorrent](http://webtorrent.io). + +## install + +``` +npm install magnet-uri +``` + +## usage + +### decode + +Parse a magnet URI and return an object of keys/values. + +```js +var magnet = require('magnet-uri') + +// "Leaves of Grass" by Walt Whitman +var uri = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337' + +var parsed = magnet.decode(uri) +console.log(parsed.dn) // "Leaves of Grass by Walt Whitman.epub" +console.log(parsed.infoHash) // "d2474e86c95b19b8bcfdb92bc12c9d44667cfa36" + +``` + +The `parsed` magnet link object looks like this: + +```js + { + "xt": "urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36", + "dn": "Leaves of Grass by Walt Whitman.epub", + "tr": [ + "udp://tracker.openbittorrent.com:80", + "udp://tracker.publicbt.com:80", + "udp://tracker.istole.it:6969", + "udp://tracker.ccc.de:80", + "udp://open.demonii.com:1337" + ], + + // added for convenience: + "infoHash": "d2474e86c95b19b8bcfdb92bc12c9d44667cfa36", + "name": "Leaves of Grass by Walt Whitman.epub", + "announce": [ + "udp://tracker.openbittorrent.com:80", + "udp://tracker.publicbt.com:80", + "udp://tracker.istole.it:6969", + "udp://tracker.ccc.de:80", + "udp://open.demonii.com:1337" + ] + } +``` + +### encode + +Convert an object of key/values into a magnet URI string. + +```js +var magnet = require('magnet-uri') + +var uri = magnet.encode({ + xt: [ + 'urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1', + 'urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY', + 'urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q' + ], + xl: '10826029', + dn: 'mediawiki-1.15.1.tar.gz', + tr: [ + 'udp://tracker.openbittorrent.com:80/announce' + ], + as: 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz', + xs: [ + 'http://cache.example.org/XRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5', + 'dchub://example.org' + ] +}) + +console.log(uri) // the magnet uri +``` + +The returned magnet uri will be: + +``` +magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&xl=10826029&dn=mediawiki-1.15.1.tar.gz&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&xs=dchub%3A%2F%2Fexample.org +``` + +You can also use convenience key names like `name` (`dn`), `infoHash` (`xt`), +`announce` (`tr`), `announceList` (`tr`), and `keywords` (`kt`). + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/index.js b/node_modules/parse-torrent/node_modules/magnet-uri/index.js new file mode 100644 index 00000000..57472b81 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/index.js @@ -0,0 +1,130 @@ +module.exports = magnetURIDecode +module.exports.decode = magnetURIDecode +module.exports.encode = magnetURIEncode + +var base32 = require('thirty-two') +var extend = require('xtend') +var flatten = require('flatten') + +/** + * Parse a magnet URI and return an object of keys/values + * + * @param {string} uri + * @return {Object} parsed uri + */ +function magnetURIDecode (uri) { + var result = {} + var data = uri.split('magnet:?')[1] + + var params = (data && data.length >= 0) + ? data.split('&') + : [] + + params.forEach(function (param) { + var keyval = param.split('=') + + // This keyval is invalid, skip it + if (keyval.length !== 2) return + + var key = keyval[0] + var val = keyval[1] + + // Clean up torrent name + if (key === 'dn') val = decodeURIComponent(val).replace(/\+/g, ' ') + + // Address tracker (tr), exact source (xs), and acceptable source (as) are encoded + // URIs, so decode them + if (key === 'tr' || key === 'xs' || key === 'as' || key === 'ws') { + val = decodeURIComponent(val) + } + + // Return keywords as an array + if (key === 'kt') val = decodeURIComponent(val).split('+') + + // If there are repeated parameters, return an array of values + if (result[key]) { + if (Array.isArray(result[key])) { + result[key].push(val) + } else { + var old = result[key] + result[key] = [old, val] + } + } else { + result[key] = val + } + }) + + // Convenience properties for parity with `parse-torrent-file` module + var m + if (result.xt) { + var xts = Array.isArray(result.xt) ? result.xt : [ result.xt ] + xts.forEach(function (xt) { + if ((m = xt.match(/^urn:btih:(.{40})/))) { + result.infoHash = new Buffer(m[1], 'hex').toString('hex') + } else if ((m = xt.match(/^urn:btih:(.{32})/))) { + var decodedStr = base32.decode(m[1]) + result.infoHash = new Buffer(decodedStr, 'binary').toString('hex') + } + }) + } + + if (result.dn) result.name = result.dn + if (result.kt) result.keywords = result.kt + + if (typeof result.tr === 'string') result.announce = [ result.tr ] + else if (Array.isArray(result.tr)) result.announce = result.tr + else result.announce = [] + + result.announceList = result.announce.map(function (url) { + return [ url ] + }) + + result.urlList = [] + if (typeof result.as === 'string' || Array.isArray(result.as)) { + result.urlList = result.urlList.concat(result.as) + } + if (typeof result.ws === 'string' || Array.isArray(result.ws)) { + result.urlList = result.urlList.concat(result.ws) + } + + return result +} + +function magnetURIEncode (obj) { + obj = extend(obj) // clone obj, so we can mutate it + + // support official magnet key names and convenience names + // (example: `infoHash` for `xt`, `name` for `dn`) + if (obj.infoHash) obj.xt = 'urn:btih:' + obj.infoHash + if (obj.name) obj.dn = obj.name + if (obj.keywords) obj.kt = obj.keywords + if (obj.announce) obj.tr = obj.announce + if (obj.announceList) obj.tr = flatten(obj.announceList) + if (obj.urlList) { + obj.ws = flatten(obj.urlList) + delete obj.as + } + + var result = 'magnet:?' + Object.keys(obj) + .filter(function (key) { + return key.length === 2 + }) + .forEach(function (key, i) { + var values = Array.isArray(obj[key]) ? obj[key] : [ obj[key] ] + values.forEach(function (val, j) { + if ((i > 0 || j > 0) && (key !== 'kt' || j === 0)) result += '&' + + if (key === 'dn') val = encodeURIComponent(val).replace(/%20/g, '+') + if (key === 'tr' || key === 'xs' || key === 'as' || key === 'ws') { + val = encodeURIComponent(val) + } + if (key === 'kt') val = encodeURIComponent(val) + + if (key === 'kt' && j > 0) result += '+' + val + else result += key + '=' + val + }) + }) + + return result +} diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/README.md b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/README.md new file mode 100644 index 00000000..7b0a3b69 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/README.md @@ -0,0 +1,34 @@ +# flatten + +A tiny utility to flatten arrays of arrays (of arrays, etc., recursively, infinitely or to an optional depth) into a single array of non-arrays. + +## example: + +```js +> var flatten = require('flatten'); +undefined +> flatten([1, [2, 3], [4, 5, 6], [7, [8, 9]], 10]) +[ 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 ] +> flatten([1, [2, [3, [4, [5]]]]], 2) +[ 1, + 2, + 3, + [ 4, [ 5 ] ] ] +``` + +## install: + + npm install flatten + +## license: + +MIT/X11. diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/index.js b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/index.js new file mode 100644 index 00000000..2491baf8 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/index.js @@ -0,0 +1,16 @@ +module.exports = function flatten(list, depth) { + depth = (typeof depth == 'number') ? depth : Infinity; + + return _flatten(list, 1); + + function _flatten(list, d) { + return list.reduce(function (acc, item) { + if (Array.isArray(item) && d < depth) { + return acc.concat(_flatten(item, d + 1)); + } + else { + return acc.concat(item); + } + }, []); + } +}; diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/package.json b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/package.json new file mode 100644 index 00000000..2f4067de --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/package.json @@ -0,0 +1,52 @@ +{ + "author": { + "name": "Joshua Holbrook", + "email": "josh.holbrook@gmail.com", + "url": "http://jesusabdullah.net" + }, + "name": "flatten", + "description": "Flatten arbitrarily nested arrays into a non-nested list of non-array items", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/jesusabdullah/node-flatten.git" + }, + "main": "./index.js", + "scripts": { + "test": "node ./test.js" + }, + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "_npmUser": { + "name": "jesusabdullah", + "email": "josh.holbrook@gmail.com" + }, + "_id": "flatten@0.0.1", + "_engineSupported": true, + "_npmVersion": "1.1.21", + "_nodeVersion": "v0.6.18", + "_defaultsLoaded": true, + "dist": { + "shasum": "554440766da0a0d603999f433453f6c2fc6a75c1", + "tarball": "http://registry.npmjs.org/flatten/-/flatten-0.0.1.tgz" + }, + "maintainers": [ + { + "name": "jesusabdullah", + "email": "josh.holbrook@gmail.com" + } + ], + "directories": {}, + "_shasum": "554440766da0a0d603999f433453f6c2fc6a75c1", + "_resolved": "https://registry.npmjs.org/flatten/-/flatten-0.0.1.tgz", + "_from": "flatten@0.0.1", + "bugs": { + "url": "https://github.com/jesusabdullah/node-flatten/issues" + }, + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/jesusabdullah/node-flatten" +} diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/test.js b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/test.js new file mode 100644 index 00000000..077632b1 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/flatten/test.js @@ -0,0 +1,15 @@ +var flatten = require('./index'), + util = require('util'), + assert = require('assert'); + +[ + [ [1, 2, 3 ], [1, 2, 3] ], + [ ['a', ['b', ['c']]], ['a', 'b', 'c'] ], + [ [2, [4, 6], 8, [[10]]], [2, 4, 6, 8, 10] ], + [ [1, [2, [3, [4, [5]]]]], [1, 2, 3, [4, [5]]], 2 ] // depth of 2 +].forEach(function (t) { + assert.deepEqual(flatten(t[0], t[2]), t[1], + util.format('☠☠☠☠☠☠☠☠☠ `flatten(%j) !== %j` ☠☠☠☠☠☠☠☠☠', t[0], t[1]) + ); + console.log('✓ `flatten(%j) == %j`', t[0], t[1]); +}); diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/.npmignore b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/.npmignore new file mode 100644 index 00000000..3ee8de4c --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/.npmignore @@ -0,0 +1,4 @@ +*.kpf +*~ +\#* +node_modules diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/LICENSE.txt b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/LICENSE.txt new file mode 100644 index 00000000..364e7faa --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2011, Chris Umbel + +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. \ No newline at end of file diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/Makefile b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/Makefile new file mode 100644 index 00000000..60112303 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/Makefile @@ -0,0 +1,24 @@ +# Copyright (c) 2011, Chris Umbel + +# 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. + +SHELL := /bin/bash + +test: + jasmine-node spec/ diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/README.md b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/README.md new file mode 100644 index 00000000..fd81e38b --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/README.md @@ -0,0 +1,15 @@ +# thirty-two + +Implementation of RFC 3548 Base32 encoding/decoding for node. + +## Installation + + npm install thirty-two + +## Usage + + var base32 = require('thirty-two'); + base32.encode('node'); + // output: NZXWIZI= + base32.decode('NZXWIZI='); + //output: node diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/index.js b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/index.js new file mode 100644 index 00000000..28d6a19b --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/index.js @@ -0,0 +1,23 @@ +/* +Copyright (c) 2011, Chris Umbel + +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. +*/ + +module.exports = require('./lib/base32/'); diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/index.js b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/index.js new file mode 100644 index 00000000..8cb3e2fb --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/index.js @@ -0,0 +1,26 @@ +/* +Copyright (c) 2011, Chris Umbel + +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. +*/ + +var base32 = require('./thirty-two'); + +exports.encode = base32.encode; +exports.decode = base32.decode; diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/thirty-two.js b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/thirty-two.js new file mode 100644 index 00000000..3e4dd6b8 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/lib/thirty-two/thirty-two.js @@ -0,0 +1,125 @@ +/* +Copyright (c) 2011, Chris Umbel + +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. +*/ + +var charTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; +var byteTable = [ + 0xff, 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff +]; + +function quintetCount(buff) { + var quintets = Math.floor(buff.length / 5); + return buff.length % 5 == 0 ? quintets: quintets + 1; +} + +exports.encode = function(plain) { + var i = 0; + var j = 0; + var shiftIndex = 0; + var digit = 0; + var encoded = new Buffer(quintetCount(plain) * 8); + if(!Buffer.isBuffer(plain)){ + plain = new Buffer(plain); + } + + /* byte by byte isn't as pretty as quintet by quintet but tests a bit + faster. will have to revisit. */ + while(i < plain.length) { + var current = plain[i]; + + if(shiftIndex > 3) { + digit = current & (0xff >> shiftIndex); + shiftIndex = (shiftIndex + 5) % 8; + digit = (digit << shiftIndex) | ((i + 1 < plain.length) ? + plain[i + 1] : 0) >> (8 - shiftIndex); + i++; + } else { + digit = (current >> (8 - (shiftIndex + 5))) & 0x1f; + shiftIndex = (shiftIndex + 5) % 8; + if(shiftIndex == 0) i++; + } + + encoded[j] = charTable.charCodeAt(digit); + j++; + } + + for(i = j; i < encoded.length; i++) + encoded[i] = 0x3d; //'='.charCodeAt(0) + + return encoded; +}; + +exports.decode = function(encoded) { + var shiftIndex = 0; + var plainDigit = 0; + var plainChar; + var plainPos = 0; + if(!Buffer.isBuffer(encoded)){ + encoded = new Buffer(encoded); + } + var decoded = new Buffer(Math.ceil(encoded.length * 5 / 8)); + + /* byte by byte isn't as pretty as octet by octet but tests a bit + faster. will have to revisit. */ + for(var i = 0; i < encoded.length; i++) { + if(encoded[i] == 0x3d){ //'=' + break; + } + + var encodedByte = encoded[i] - 0x30; + + if(encodedByte < byteTable.length) { + plainDigit = byteTable[encodedByte]; + + if(shiftIndex <= 3) { + shiftIndex = (shiftIndex + 5) % 8; + + if(shiftIndex == 0) { + plainChar |= plainDigit; + decoded[plainPos] = plainChar; + plainPos++; + plainChar = 0; + } else { + plainChar |= 0xff & (plainDigit << (8 - shiftIndex)); + } + } else { + shiftIndex = (shiftIndex + 5) % 8; + plainChar |= 0xff & (plainDigit >>> shiftIndex); + decoded[plainPos] = plainChar; + plainPos++; + + plainChar = 0xff & (plainDigit << (8 - shiftIndex)); + } + } else { + throw new Error('Invalid input - it is not base32 encoded string'); + } + } + return decoded.slice(0, plainPos); +}; diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/package.json b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/package.json new file mode 100644 index 00000000..c6184a49 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/package.json @@ -0,0 +1,47 @@ +{ + "name": "thirty-two", + "description": "Implementation RFC 3548 Base32 encoding/decoding for node.", + "version": "0.0.2", + "engines": { + "node": ">=0.2.6" + }, + "author": { + "name": "Chris Umbel", + "email": "chris@chrisumbel.com" + }, + "keywords": [ + "base32", + "encoding" + ], + "main": "./lib/thirty-two/index.js", + "repository": { + "type": "git", + "url": "git://github.com/chrisumbel/thirty-two.git" + }, + "bugs": { + "url": "https://github.com/chrisumbel/thirty-two/issues" + }, + "homepage": "https://github.com/chrisumbel/thirty-two", + "_id": "thirty-two@0.0.2", + "_shasum": "4253e29d8cb058f0480267c5698c0e4927e54b6a", + "_from": "thirty-two@>=0.0.2 <0.0.3", + "_npmVersion": "1.4.9", + "_npmUser": { + "name": "chrisumbel", + "email": "chris@chrisumbel.com" + }, + "maintainers": [ + { + "name": "chrisumbel", + "email": "chris@chrisumbel.com" + } + ], + "dist": { + "shasum": "4253e29d8cb058f0480267c5698c0e4927e54b6a", + "tarball": "http://registry.npmjs.org/thirty-two/-/thirty-two-0.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/thirty-two/-/thirty-two-0.0.2.tgz", + "readme": "ERROR: No README data found!", + "scripts": {} +} diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/spec/thirty-two_spec.js b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/spec/thirty-two_spec.js new file mode 100644 index 00000000..a0e0c0a7 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/thirty-two/spec/thirty-two_spec.js @@ -0,0 +1,63 @@ +/* +Copyright (c) 2011, Chris Umbel + +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. +*/ +if(!expect){ + function expect(a){ + return { + toBe: function(b){ + require('assert').strictEqual(a, b); + } + }; + } +} +var base32 = require('../lib/thirty-two/'); + +describe('thirty-two', function() { + it('should encode', function() { + expect(base32.encode('a').toString()).toBe('ME======'); + expect(base32.encode('be').toString()).toBe('MJSQ===='); + expect(base32.encode('bee').toString()).toBe('MJSWK==='); + expect(base32.encode('beer').toString()).toBe('MJSWK4Q='); + expect(base32.encode('beers').toString()).toBe('MJSWK4TT'); + expect(base32.encode('beers 1').toString()).toBe('MJSWK4TTEAYQ===='); + expect(base32.encode('shockingly dismissed').toString()).toBe('ONUG6Y3LNFXGO3DZEBSGS43NNFZXGZLE'); + }); + + + it('should decode', function() { + expect(base32.decode('ME======').toString()).toBe('a'); + expect(base32.decode('MJSQ====').toString()).toBe('be'); + expect(base32.decode('ONXW4===').toString()).toBe('son'); + expect(base32.decode('MJSWK===').toString()).toBe('bee'); + expect(base32.decode('MJSWK4Q=').toString()).toBe('beer'); + expect(base32.decode('MJSWK4TT').toString()).toBe('beers'); + expect(base32.decode('mjswK4TT').toString()).toBe('beers'); + expect(base32.decode('MJSWK4TTN5XA====').toString()).toBe('beerson'); + expect(base32.decode('MJSWK4TTEAYQ====').toString()).toBe('beers 1'); + expect(base32.decode('ONUG6Y3LNFXGO3DZEBSGS43NNFZXGZLE').toString()).toBe('shockingly dismissed'); + }); + + it('should be binary safe', function() { + expect(base32.decode(base32.encode(new Buffer([0x00, 0xff, 0x88]))).toString('hex')).toBe('00ff88'); + expect(base32.encode(new Buffer("f61e1f998d69151de8334dbe753ab17ae831c13849a6aecd95d0a4e5dc25", 'hex')).toString()).toBe('6YPB7GMNNEKR32BTJW7HKOVRPLUDDQJYJGTK5TMV2CSOLXBF'); + expect(base32.decode('6YPB7GMNNEKR32BTJW7HKOVRPLUDDQJYJGTK5TMV2CSOLXBF').toString('hex')).toBe('f61e1f998d69151de8334dbe753ab17ae831c13849a6aecd95d0a4e5dc25'); + }); +}); diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/.jshintrc b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/.jshintrc new file mode 100644 index 00000000..77887b5f --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/.jshintrc @@ -0,0 +1,30 @@ +{ + "maxdepth": 4, + "maxstatements": 200, + "maxcomplexity": 12, + "maxlen": 80, + "maxparams": 5, + + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": false, + "noarg": true, + "noempty": true, + "nonew": true, + "undef": true, + "unused": "vars", + "trailing": true, + + "quotmark": true, + "expr": true, + "asi": true, + + "browser": false, + "esnext": true, + "devel": false, + "node": false, + "nonstandard": false, + + "predef": ["require", "module", "__dirname", "__filename"] +} diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/.npmignore b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/LICENCE b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/LICENCE new file mode 100644 index 00000000..1a14b437 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2012-2014 Raynos. + +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/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/Makefile b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/Makefile new file mode 100644 index 00000000..d583fcf4 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/Makefile @@ -0,0 +1,4 @@ +browser: + node ./support/compile + +.PHONY: browser \ No newline at end of file diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/README.md b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/README.md new file mode 100644 index 00000000..093cb297 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/README.md @@ -0,0 +1,32 @@ +# xtend + +[![browser support][3]][4] + +[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) + +Extend like a boss + +xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence. + +## Examples + +```js +var extend = require("xtend") + +// extend returns a new object. Does not mutate arguments +var combination = extend({ + a: "a", + b: 'c' +}, { + b: "b" +}) +// { a: "a", b: "b" } +``` + +## Stability status: Locked + +## MIT Licenced + + + [3]: http://ci.testling.com/Raynos/xtend.png + [4]: http://ci.testling.com/Raynos/xtend diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/immutable.js b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/immutable.js new file mode 100644 index 00000000..5b760152 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/immutable.js @@ -0,0 +1,17 @@ +module.exports = extend + +function extend() { + var target = {} + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (source.hasOwnProperty(key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/mutable.js b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/mutable.js new file mode 100644 index 00000000..a34475eb --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/mutable.js @@ -0,0 +1,15 @@ +module.exports = extend + +function extend(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (source.hasOwnProperty(key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/package.json b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/package.json new file mode 100644 index 00000000..907a720d --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/package.json @@ -0,0 +1,88 @@ +{ + "name": "xtend", + "version": "4.0.0", + "description": "extend like a boss", + "keywords": [ + "extend", + "merge", + "options", + "opts", + "object", + "array" + ], + "author": { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + "repository": { + "type": "git", + "url": "git://github.com/Raynos/xtend.git" + }, + "main": "immutable", + "scripts": { + "test": "node test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.0" + }, + "homepage": "https://github.com/Raynos/xtend", + "contributors": [ + { + "name": "Jake Verbaten" + }, + { + "name": "Matt Esch" + } + ], + "bugs": { + "url": "https://github.com/Raynos/xtend/issues", + "email": "raynos2@gmail.com" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/raynos/xtend/raw/master/LICENSE" + } + ], + "testling": { + "files": "test.js", + "browsers": [ + "ie/7..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest" + ] + }, + "engines": { + "node": ">=0.4" + }, + "gitHead": "94a95d76154103290533b2c55ffa0fe4be16bfef", + "_id": "xtend@4.0.0", + "_shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "_from": "xtend@>=4.0.0 <5.0.0", + "_npmVersion": "1.4.15", + "_npmUser": { + "name": "raynos", + "email": "raynos2@gmail.com" + }, + "maintainers": [ + { + "name": "raynos", + "email": "raynos2@gmail.com" + } + ], + "dist": { + "shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "tarball": "http://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/test.js b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/test.js new file mode 100644 index 00000000..3369d796 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/node_modules/xtend/test.js @@ -0,0 +1,63 @@ +var test = require("tape") +var extend = require("./") +var mutableExtend = require("./mutable") + +test("merge", function(assert) { + var a = { a: "foo" } + var b = { b: "bar" } + + assert.deepEqual(extend(a, b), { a: "foo", b: "bar" }) + assert.end() +}) + +test("replace", function(assert) { + var a = { a: "foo" } + var b = { a: "bar" } + + assert.deepEqual(extend(a, b), { a: "bar" }) + assert.end() +}) + +test("undefined", function(assert) { + var a = { a: undefined } + var b = { b: "foo" } + + assert.deepEqual(extend(a, b), { a: undefined, b: "foo" }) + assert.deepEqual(extend(b, a), { a: undefined, b: "foo" }) + assert.end() +}) + +test("handle 0", function(assert) { + var a = { a: "default" } + var b = { a: 0 } + + assert.deepEqual(extend(a, b), { a: 0 }) + assert.deepEqual(extend(b, a), { a: "default" }) + assert.end() +}) + +test("is immutable", function (assert) { + var record = {} + + extend(record, { foo: "bar" }) + assert.equal(record.foo, undefined) + assert.end() +}) + +test("null as argument", function (assert) { + var a = { foo: "bar" } + var b = null + var c = void 0 + + assert.deepEqual(extend(b, a, c), { foo: "bar" }) + assert.end() +}) + +test("mutable", function (assert) { + var a = { foo: "bar" } + + mutableExtend(a, { bar: "baz" }) + + assert.equal(a.bar, "baz") + assert.end() +}) diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/package.json b/node_modules/parse-torrent/node_modules/magnet-uri/package.json new file mode 100644 index 00000000..b4aaf1f1 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/package.json @@ -0,0 +1,72 @@ +{ + "name": "magnet-uri", + "description": "Parse a magnet URI and return an object of keys/values", + "version": "4.2.3", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/magnet-uri/issues" + }, + "dependencies": { + "flatten": "0.0.1", + "thirty-two": "^0.0.2", + "xtend": "^4.0.0" + }, + "devDependencies": { + "standard": "^3.1.2", + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "https://github.com/feross/magnet-uri", + "keywords": [ + "magnet", + "uri", + "urn", + "p2p", + "peer-to-peer", + "cryptolinks", + "bittorrent", + "webtorrent" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/magnet-uri.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "testling": { + "files": "test/*.js" + }, + "gitHead": "ab5a11bb2472713e175679c0854aaaf6ea4248bb", + "_id": "magnet-uri@4.2.3", + "_shasum": "79cc6d65a00bb5b7ef5c25ae60ebbb5d9a7681a8", + "_from": "magnet-uri@>=4.0.0 <5.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "79cc6d65a00bb5b7ef5c25ae60ebbb5d9a7681a8", + "tarball": "http://registry.npmjs.org/magnet-uri/-/magnet-uri-4.2.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/magnet-uri/-/magnet-uri-4.2.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/test/decode.js b/node_modules/parse-torrent/node_modules/magnet-uri/test/decode.js new file mode 100644 index 00000000..a35aea5e --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/test/decode.js @@ -0,0 +1,128 @@ +var extend = require('xtend') +var magnet = require('../') +var test = require('tape') + +var leavesOfGrass = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337' + +var empty = { announce: [], announceList: [], urlList: [] } + +test('decode: valid magnet uris', function (t) { + var result = magnet(leavesOfGrass) + t.equal(result.xt, 'urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36') + t.equal(result.dn, 'Leaves of Grass by Walt Whitman.epub') + t.equal(result.infoHash, 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36') + var announce = [ + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.publicbt.com:80', + 'udp://tracker.istole.it:6969', + 'udp://tracker.ccc.de:80', + 'udp://open.demonii.com:1337' + ] + var announceList = [ + [ 'udp://tracker.openbittorrent.com:80' ], + [ 'udp://tracker.publicbt.com:80' ], + [ 'udp://tracker.istole.it:6969' ], + [ 'udp://tracker.ccc.de:80' ], + [ 'udp://open.demonii.com:1337' ] + ] + t.deepEqual(result.tr, announce) + t.deepEqual(result.announce, announce) + t.deepEqual(result.announceList, announceList) + + t.end() +}) + +test('decode: empty magnet URIs return empty object', function (t) { + var empty1 = '' + var empty2 = 'magnet:' + var empty3 = 'magnet:?' + + t.deepEqual(magnet(empty1), empty) + t.deepEqual(magnet(empty2), empty) + t.deepEqual(magnet(empty3), empty) + t.end() +}) + +test('empty string as keys is okay', function (t) { + var uri = 'magnet:?a=&b=&c=' + + t.deepEqual(magnet(uri), extend({ a: '', b: '', c: '' }, empty)) + t.end() +}) + +test('decode: invalid magnet URIs return empty object', function (t) { + var invalid1 = 'magnet:?xt=urn:btih:===' + var invalid2 = 'magnet:?xt' + var invalid3 = 'magnet:?xt=?dn=' + + t.deepEqual(magnet(invalid1), empty) + t.deepEqual(magnet(invalid2), empty) + t.deepEqual(magnet(invalid3), empty) + t.end() +}) + +test('decode: invalid magnet URIs return only valid keys (ignoring invalid ones)', function (t) { + var invalid1 = 'magnet:?a=a&===' + var invalid2 = 'magnet:?a==&b=b' + var invalid3 = 'magnet:?a=b=&c=c&d===' + + t.deepEqual(magnet(invalid1), extend({ a: 'a' }, empty)) + t.deepEqual(magnet(invalid2), extend({ b: 'b' }, empty)) + t.deepEqual(magnet(invalid3), extend({ c: 'c' }, empty)) + t.end() +}) + +test('decode: extracts 40-char hex BitTorrent info_hash', function (t) { + var result = magnet('magnet:?xt=urn:btih:aad050ee1bb22e196939547b134535824dabf0ce') + t.equal(result.infoHash, 'aad050ee1bb22e196939547b134535824dabf0ce') + t.end() +}) + +test('decode: extracts 32-char base32 BitTorrent info_hash', function (t) { + var result = magnet('magnet:?xt=urn:btih:64DZYZWMUAVLIWJUXGDIK4QGAAIN7SL6') + t.equal(result.infoHash, 'f7079c66cca02ab45934b9868572060010dfc97e') + t.end() +}) + +test('decode: extracts keywords', function (t) { + var result = magnet('magnet:?xt=urn:btih:64DZYZWMUAVLIWJUXGDIK4QGAAIN7SL6&kt=joe+blow+mp3') + t.deepEqual(result.keywords, ['joe', 'blow', 'mp3']) + t.end() +}) + +test('decode: complicated magnet uri (multiple xt params, and as, xs)', function (t) { + var result = magnet('magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&xl=10826029&dn=mediawiki-1.15.1.tar.gz&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&xs=dchub://example.org') + t.equal(result.infoHash, '81e177e2cc00943b29fcfc635457f575237293b0') + t.deepEqual(result.xt, [ + 'urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1', + 'urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY', + 'urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q' + ]) + t.equal(result.xl, '10826029') + t.equal(result.dn, 'mediawiki-1.15.1.tar.gz') + var announce = 'udp://tracker.openbittorrent.com:80/announce' + var announceList = [ + [ 'udp://tracker.openbittorrent.com:80/announce' ] + ] + t.equal(result.tr, announce) + t.deepEqual(result.announce, [ announce ]) + t.deepEqual(result.announceList, announceList) + t.equal(result.as, 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz') + t.deepEqual(result.urlList, [ 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz' ]) + t.deepEqual(result.xs, [ + 'http://cache.example.org/XRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5', + 'dchub://example.org' + ]) + t.end() +}) + +test('multiple as, ws params', function (t) { + var result = magnet('magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz1&ws=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz2&ws=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz3') + t.deepEqual(result.urlList, [ + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz', + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz1', + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz2', + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz3' + ]) + t.end() +}) diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/test/encode.js b/node_modules/parse-torrent/node_modules/magnet-uri/test/encode.js new file mode 100644 index 00000000..f63f60ac --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/test/encode.js @@ -0,0 +1,69 @@ +var magnet = require('../') +var test = require('tape') + +test('encode: complicated magnet uri (multiple xt params, and as, xs)', function (t) { + var uri = magnet.encode({ + xt: [ + 'urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1', + 'urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY', + 'urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q' + ], + xl: '10826029', + dn: 'mediawiki-1.15.1.tar.gz', + tr: [ + 'udp://tracker.openbittorrent.com:80/announce' + ], + as: 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz', + xs: [ + 'http://cache.example.org/XRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5', + 'dchub://example.org' + ] + }) + + t.equal(uri, 'magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&xl=10826029&dn=mediawiki-1.15.1.tar.gz&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&xs=dchub%3A%2F%2Fexample.org') + t.end() +}) + +test('encode: simple magnet uri using convenience names', function (t) { + var obj = { + xt: 'urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + dn: 'Leaves of Grass by Walt Whitman.epub', + name: 'Leaves of Grass by Walt Whitman.epub', + infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + tr: [ + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.publicbt.com:80', + 'udp://tracker.istole.it:6969', + 'udp://tracker.ccc.de:80', + 'udp://open.demonii.com:1337' + ], + announce: [ + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.publicbt.com:80', + 'udp://tracker.istole.it:6969', + 'udp://tracker.ccc.de:80', + 'udp://open.demonii.com:1337' + ], + announceList: [ + [ 'udp://tracker.openbittorrent.com:80' ], + [ 'udp://tracker.publicbt.com:80' ], + [ 'udp://tracker.istole.it:6969' ], + [ 'udp://tracker.ccc.de:80' ], + [ 'udp://open.demonii.com:1337' ] + ], + urlList: [ + 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz' + ], + ws: 'http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz', + kt: [ 'hey', 'hey2' ], + keywords: [ 'hey', 'hey2' ] + } + + var result = magnet.encode(obj) + + t.equal(result, 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&ws=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&kt=hey+hey2') + + t.deepEqual(magnet.decode(result), obj) + + t.end() +}) diff --git a/node_modules/parse-torrent/node_modules/magnet-uri/vlc-log.txt b/node_modules/parse-torrent/node_modules/magnet-uri/vlc-log.txt new file mode 100644 index 00000000..05107d39 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/magnet-uri/vlc-log.txt @@ -0,0 +1,2332 @@ +-- logger module started -- +main debug: VLC media player - 2.1.5 Rincewind +main debug: Copyright © 1996-2014 the VideoLAN team +main debug: revision 2.1.4-59-g5f258d5 +main debug: configured with ../extras/package/macosx/../../../configure '--prefix=/Users/fkuehne/Desktop/videolan/gits/vlc-2.1/release/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-audio' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-vout' '--disable-caca' '--disable-skins2' '--disable-xcb' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' '--build=x86_64-apple-darwin10' '--with-macosx-version-min=10.6' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CXX=xcrun clang++' 'OBJC=xcrun clang' +main debug: using interface module "logger" +main debug: looking for interface module matching "logger,none": 15 candidates +logger: using logger. +logger debug: opening logfile `vlc-log.txt' +-- logger module started -- +main debug: VLC media player - 2.1.5 Rincewind +main debug: Copyright © 1996-2014 the VideoLAN team +main debug: revision 2.1.4-59-g5f258d5 +main debug: configured with ../extras/package/macosx/../../../configure '--prefix=/Users/fkuehne/Desktop/videolan/gits/vlc-2.1/release/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-audio' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-vout' '--disable-caca' '--disable-skins2' '--disable-xcb' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' '--build=x86_64-apple-darwin10' '--with-macosx-version-min=10.6' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CXX=xcrun clang++' 'OBJC=xcrun clang' +main debug: using interface module "logger" +lua: Lua HTTP interface +main debug: Creating an input for 'Media Library' +main debug: Input is a meta file: disabling unneeded options +main debug: using timeshift granularity of 50 MiB, in path '/tmp' +main debug: `file/xspf-open:///Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' gives access `file' demux `xspf-open' path `/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' +main debug: creating demux: access='file' demux='xspf-open' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for access_demux module matching "file": 14 candidates +main debug: creating VLM +lua debug: Loaded /Applications/VLC.app/Contents/MacOS/share/lua/http/custom.lua +main debug: net: listening to * port 8080 +main debug: no access_demux modules matched +main debug: creating access 'file' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf', path='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for access module matching "file": 18 candidates +filesystem debug: opening file `/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: using access module "filesystem" +main debug: Using stream method for AStream* +main debug: starting pre-buffering +main debug: received first data after 0 ms +main debug: pre-buffering done 296 bytes in 0s - 11562 KiB/s +main debug: looking for stream_filter module matching "any": 9 candidates +main debug: no stream_filter modules matched +main debug: looking for stream_filter module matching "record": 9 candidates +main debug: using stream_filter module "record" +main debug: creating demux: access='file' demux='xspf-open' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for demux module matching "xspf-open": 63 candidates +playlist debug: using XSPF playlist reader +main debug: using demux module "playlist" +main debug: looking for meta reader module matching "any": 2 candidates +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/meta/reader +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader +main debug: no meta reader modules matched +main debug: `file/xspf-open:///Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' successfully opened +main debug: looking for xml reader module matching "any": 1 candidates +main debug: using xml reader module "xml" +playlist debug: parsed 0 tracks successfully +main debug: EOF reached +main debug: removing module "playlist" +main debug: removing module "record" +main debug: removing module "filesystem" +main debug: creating audio output +main debug: looking for audio output module matching "any": 4 candidates +auhal debug: found 2 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +main debug: restart requested (2) +main debug: using audio output module "auhal" +main debug: keeping audio output +main debug: adding item `http://localhost:8000/0' ( http://localhost:8000/0 ) +main debug: no fetch required for (null) (art currently (null)) +main debug: looking for interface module matching "hotkeys,none": 15 candidates +main debug: using interface module "hotkeys" +main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. +main debug: looking for interface module matching "any": 15 candidates +main debug: looking for services probe module matching "any": 5 candidates +main debug: no services probe modules matched +main debug: looking for extension module matching "any": 1 candidates +lua debug: Opening Lua Extension module +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/extensions +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/extensions +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac +lua debug: Scanning Lua script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac +lua debug: Script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac has the following capability flags: 0x5 +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/extensions +main debug: using extension module "lua" +macosx debug: Found 1 video capture devices +macosx debug: Found 1 audio capture devices +main debug: processing request item: http://localhost:8000/0, node: Playlist, skip: 0 +main debug: rebuilding array of current - root Playlist +main debug: rebuild done - 1 items, index 0 +main debug: starting playback of the new playlist item +main debug: resyncing on http://localhost:8000/0 +main debug: http://localhost:8000/0 is at 0 +main debug: creating new input thread +main debug: Creating an input for 'http://localhost:8000/0' +main debug: using timeshift granularity of 50 MiB, in path '/tmp' +main debug: `http://localhost:8000/0' gives access `http' demux `' path `localhost:8000/0' +main debug: creating demux: access='http' demux='' location='localhost:8000/0' file='(null)' +main debug: looking for access_demux module matching "http": 14 candidates +main debug: no access_demux modules matched +main debug: creating access 'http' location='localhost:8000/0', path='(null)' +main debug: looking for access module matching "http": 18 candidates +access_http debug: querying proxy for http://localhost:8000/0 +access_http debug: no proxy +access_http debug: http: server='localhost' port=8000 file='/0' +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +macosx debug: no optical media found +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=0,remaining=463357580 +access_http debug: this frame size=463357580 +access_http debug: Connection: close +main debug: using access module "access_http" +main debug: Using stream method for AStream* +main debug: starting pre-buffering +main debug: received first data after 0 ms +main debug: pre-buffering done 1024 bytes in 0s - 52631 KiB/s +main debug: looking for stream_filter module matching "any": 9 candidates +main debug: no stream_filter modules matched +main debug: looking for stream_filter module matching "record": 9 candidates +main debug: using stream_filter module "record" +main debug: creating demux: access='http' demux='' location='localhost:8000/0' file='(null)' +main debug: looking for demux module matching "any": 63 candidates +access_http debug: trying to seek to 462693989 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=462693989,remaining=663591 +access_http debug: this frame size=663591 +access_http debug: Connection: close +mp4 warning: unknown box type desc (incompletely loaded) +mp4 warning: MP4 plugin discarded (not fast-seekable) +access_http debug: trying to seek to 1536 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=1536,remaining=463356044 +access_http debug: this frame size=463356044 +access_http debug: Connection: close +ts debug: TS module discarded (lost sync) +mod debug: MOD validation failed (ext=) +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/playlist +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/playlist +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_streams.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_xml.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/appletrailers.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/bbc_co_uk.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/break.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/canalplus.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/cue.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/dailymotion.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/extreme.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/france2.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/googlevideo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/jamendo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/joox.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/katsomo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/koreus.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/lelombrik.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/liveleak.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metacafe.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metachannels.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mpora.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pinkbike.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pluzz.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/rockbox_fm_presets.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/soundcloud.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/vimeo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube_homepage.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/zapiks.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/playlist +avcodec debug: trying url: http://localhost:8000/0 +avcodec debug: detected format: mov,mp4,m4a,3gp,3g2,mj2 +access_http debug: trying to seek to 463357580 +access_http error: seek too far +access_http debug: trying to seek to 463357579 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: this frame size=1 +access_http debug: Connection: close +access_http debug: trying to seek to 48072 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=48072,remaining=463309508 +access_http debug: this frame size=463309508 +access_http debug: Connection: close +main debug: selecting program id=0 +avcodec debug: adding es: video codec = h264 (28) +avcodec debug: adding es: audio codec = mp4a (86018) +avcodec debug: AVFormat supported stream +avcodec debug: - format = mov,mp4,m4a,3gp,3g2,mj2 (QuickTime / MOV) +avcodec debug: - start time = 0 +avcodec debug: - duration = 888064000 +main debug: using demux module "avcodec" +main debug: looking for decoder module matching "any": 37 candidates +avcodec debug: trying to use direct rendering +avcodec debug: allowing 4 thread(s) for decoding +avcodec debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started +avcodec debug: using frame thread mode with 4 threads +main debug: using decoder module "avcodec" +main debug: looking for decoder module matching "any": 37 candidates +main debug: using decoder module "faad" +main debug: looking for meta reader module matching "any": 2 candidates +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/meta/reader +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader +main debug: no meta reader modules matched +main debug: `http://localhost:8000/0' successfully opened +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 2% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 6% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 10% +main debug: Buffering 12% +main debug: looking for text renderer module matching "any": 3 candidates +main debug: Buffering 12% +main debug: Buffering 14% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 23% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 27% +main debug: Buffering 29% +faad warning: decoded zero sample +main debug: Buffering 29% +main debug: Buffering 32% +main debug: Buffering 33% +freetype debug: looking for Arial Unicode MS +main debug: Buffering 33% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 57% +main debug: Buffering 58% +freetype debug: found /Library/Fonts/Arial Unicode.ttf +main debug: Buffering 58% +freetype debug: Using Arial Unicode MS as font from file /Library/Fonts/Arial Unicode.ttf +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +freetype debug: using fontsize: 2 +main debug: Buffering 75% +main debug: using text renderer module "freetype" +main debug: Buffering 78% +main debug: Buffering 79% +main debug: looking for video filter2 module matching "any": 54 candidates +main debug: Buffering 79% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 89% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 93% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 98% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1024 ms in 3 ms) +swscale debug: 32x32 chroma: YUVA -> 16x16 chroma: RGBA with scaling using Bicubic (good quality) +main debug: using video filter2 module "swscale" +main debug: looking for video filter2 module matching "any": 54 candidates +yuvp debug: YUVP to YUVA converter +main debug: using video filter2 module "yuvp" +main debug: Deinterlacing available +main debug: deinterlace 0, mode blend, is_needed 0 +main debug: Opening vout display wrapper +main debug: looking for vout display module matching "any": 5 candidates +main debug: looking for vout window nsobject module matching "any": 1 candidates +macosx debug: prevented sleep through IOKit (1805) +macosx debug: returning videoview with proposed position x=0, y=0, width=2048, height=872 +main debug: using vout window nsobject module "macosx" +macosx debug: toggle playlist from state: removed splitview 0, minimized view 0. Sender is 0x0, unhide video view 0 +macosx debug: toggle playlist to state: removed splitview 0, minimized view 0 +macosx debug: releasing old sleep blocker (1805) +macosx debug: prevented sleep through IOKit (1807) +main debug: VoutDisplayEvent 'resize' 2048x872 window +main debug: using vout display module "vout_macosx" +main debug: original format sz 2048x872, of (0,0), vsz 2048x872, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0 +main debug: removing module "freetype" +main debug: looking for text renderer module matching "any": 3 candidates +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +freetype debug: Using Arial Unicode MS as font from file /Library/Fonts/Arial Unicode.ttf +freetype debug: using fontsize: 2 +main debug: using text renderer module "freetype" +avcodec debug: using direct rendering +main debug: reusing audio output +main debug: VLC is looking for: 'f32l' 48000 Hz 3F2R/LFE frame=1 samples/24 bytes +auhal debug: attempting to use device 0 +auhal debug: using default audio device 38 +auhal debug: found 16 stream formats for stream id 39 +auhal debug: Audio device supports PCM mode only +main debug: VoutDisplayEvent 'resize' 2872x1622 window +main debug: End of video preroll +main debug: Received first picture +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +auhal debug: current format is: [44100.000000][mcpl][9][8][1][8][2][32] +auhal debug: layout of AUHAL has 2 channels +auhal debug: selected 2 physical channels for device output +auhal debug: VLC will output: Stereo +auhal debug: we set the AU format: [48000.000000][mcpl][9][8][1][8][2][32] +auhal debug: the actual set AU format is [48000.000000][mcpl][9][8][1][8][2][32] +auhal debug: analog output successfully opened +main debug: output 'f32l' 48000 Hz Stereo frame=1 samples/8 bytes +main debug: looking for audio volume module matching "any": 2 candidates +main debug: using audio volume module "float_mixer" +main debug: input 'f32l' 48000 Hz 3F2R/LFE frame=1 samples/24 bytes +main debug: looking for audio filter module matching "scaletempo": 14 candidates +scaletempo debug: format: 48000 rate, 6 nch, 4 bps, fl32 +scaletempo debug: params: 30 stride, 0.200 overlap, 14 search +scaletempo debug: 1.000 scale, 1440.000 stride_in, 1440 stride_out, 1152 standing, 288 overlap, 672 search, 2400 queue, fl32 mode +main debug: using audio filter module "scaletempo" +main debug: conversion: 'f32l'->'f32l' 48000 Hz->48000 Hz 3F2R/LFE->3F2R/LFE +main debug: conversion pipeline complete +main debug: conversion: 'f32l'->'f32l' 48000 Hz->48000 Hz 3F2R/LFE->Stereo +main debug: looking for audio converter module matching "any": 11 candidates +main debug: using audio converter module "simple_channel_mixer" +main debug: conversion pipeline complete +main debug: looking for audio resampler module matching "any": 2 candidates +main debug: using audio resampler module "ugly_resampler" +main debug: End of audio preroll +main debug: Decoder buffering done in 208 ms +main debug: VoutDisplayEvent 'resize' 2872x1622 window +main debug: VoutDisplayEvent 'resize' 2872x1622 window +main debug: VoutDisplayEvent 'resize' 2872x1626 window +main debug: VoutDisplayEvent 'resize' 2872x1626 window +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +main debug: VoutDisplayEvent 'resize' 2872x1626 window +main debug: VoutDisplayEvent 'resize' 2872x1634 window +main debug: VoutDisplayEvent 'resize' 2872x1634 window +main debug: VoutDisplayEvent 'resize' 2872x1634 window +main debug: VoutDisplayEvent 'resize' 2872x1638 window +main debug: VoutDisplayEvent 'resize' 2872x1638 window +avcodec warning: DEMUX_SET_POSITION: 208424910 +access_http debug: trying to seek to 92718985 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=92718985,remaining=370638595 +access_http debug: this frame size=370638595 +access_http debug: Connection: close +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 25% +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 44% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 49% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 53% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 57% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 61% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 74% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 78% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Stream buffering done (1002 ms in 89 ms) +main debug: Decoder buffering done in 9 ms +main warning: early picture skipped +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 208424910 +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 25% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 44% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 49% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 53% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 57% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 61% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 74% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 78% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Stream buffering done (1002 ms in 3 ms) +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 373 ms +main warning: picture is too late to be displayed (missing 79 ms) +main warning: picture is too late to be displayed (missing 38 ms) +main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1000 ms) +main error: ES_OUT_RESET_PCR called +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 2% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 6% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 10% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 23% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 27% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: End of audio preroll +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 77% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 81% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 85% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 89% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 98% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1026 ms in 4 ms) +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 41 ms +main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 4426 ms) +main error: ES_OUT_RESET_PCR called +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: End of audio preroll +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 18% +main debug: Buffering 18% +main debug: Buffering 18% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 98% +main debug: Buffering 98% +main debug: Buffering 98% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Stream buffering done (4439 ms in 14 ms) +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 23 ms +macosx debug: releasing sleep blocker (1807) +main warning: can't get output picture +avcodec warning: disabling direct rendering +main warning: early picture skipped +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 96036193 +access_http debug: trying to seek to 36732565 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=36732565,remaining=426625015 +access_http debug: this frame size=426625015 +access_http debug: Connection: close +avcodec debug: using direct rendering +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 18% +main debug: Buffering 18% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 98% +main debug: Buffering 98% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Stream buffering done (4438 ms in 17 ms) +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 523 ms +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main debug: discarded audio buffer +main debug: discarded audio buffer +main debug: discarded audio buffer +main debug: discarded audio buffer +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 96036193 +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 1% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 2% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 5% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 6% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 9% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 10% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 11% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 13% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 14% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 17% +main debug: Buffering 18% +main debug: Buffering 18% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 21% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 22% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 23% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 24% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 26% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 27% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 28% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 30% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 31% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 34% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 35% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 38% +main debug: Buffering 38% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 39% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 42% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 43% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 46% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 47% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 48% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 51% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 52% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 55% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 56% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 59% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 60% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 63% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 64% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 67% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 68% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 71% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 72% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 73% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 76% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 77% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 80% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 81% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 84% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 85% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 88% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 89% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 90% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 92% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 93% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 96% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 97% +main debug: Buffering 98% +main debug: Buffering 98% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Buffering 99% +main debug: Stream buffering done (4438 ms in 14 ms) +macosx debug: releasing old sleep blocker (1807) +macosx debug: prevented sleep through IOKit (1809) +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 500 ms +main warning: picture is too late to be displayed (missing 50 ms) +main debug: picture might be displayed late (missing 9 ms) +main warning: can't get output picture +avcodec warning: disabling direct rendering +main warning: early picture skipped +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 297701559 +access_http debug: trying to seek to 145084872 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=145084872,remaining=318272708 +access_http debug: this frame size=318272708 +access_http debug: Connection: close +macosx debug: Terminating +-- logger module stopped -- +-- logger module stopped -- +-- logger module started -- +main debug: VLC media player - 2.1.5 Rincewind +main debug: Copyright © 1996-2014 the VideoLAN team +main debug: revision 2.1.4-59-g5f258d5 +main debug: configured with ../extras/package/macosx/../../../configure '--prefix=/Users/fkuehne/Desktop/videolan/gits/vlc-2.1/release/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-audio' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-vout' '--disable-caca' '--disable-skins2' '--disable-xcb' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' '--build=x86_64-apple-darwin10' '--with-macosx-version-min=10.6' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CXX=xcrun clang++' 'OBJC=xcrun clang' +main debug: using interface module "logger" +main debug: looking for interface module matching "logger,none": 15 candidates +logger: using logger. +logger debug: opening logfile `vlc-log.txt' +-- logger module started -- +main debug: VLC media player - 2.1.5 Rincewind +main debug: Copyright © 1996-2014 the VideoLAN team +main debug: revision 2.1.4-59-g5f258d5 +main debug: configured with ../extras/package/macosx/../../../configure '--prefix=/Users/fkuehne/Desktop/videolan/gits/vlc-2.1/release/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-audio' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-vout' '--disable-caca' '--disable-skins2' '--disable-xcb' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' '--build=x86_64-apple-darwin10' '--with-macosx-version-min=10.6' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CXX=xcrun clang++' 'OBJC=xcrun clang' +main debug: using interface module "logger" +lua: Lua HTTP interface +main debug: Creating an input for 'Media Library' +main debug: creating VLM +lua debug: Loaded /Applications/VLC.app/Contents/MacOS/share/lua/http/custom.lua +main debug: net: listening to * port 8080 +main debug: Input is a meta file: disabling unneeded options +main debug: using timeshift granularity of 50 MiB, in path '/tmp' +main debug: `file/xspf-open:///Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' gives access `file' demux `xspf-open' path `/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' +main debug: creating demux: access='file' demux='xspf-open' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for access_demux module matching "file": 14 candidates +main debug: no access_demux modules matched +main debug: creating access 'file' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf', path='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for access module matching "file": 18 candidates +filesystem debug: opening file `/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: using access module "filesystem" +main debug: Using stream method for AStream* +main debug: starting pre-buffering +main debug: received first data after 0 ms +main debug: pre-buffering done 296 bytes in 0s - 13139 KiB/s +main debug: looking for stream_filter module matching "any": 9 candidates +main debug: no stream_filter modules matched +main debug: looking for stream_filter module matching "record": 9 candidates +main debug: using stream_filter module "record" +main debug: creating demux: access='file' demux='xspf-open' location='/Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/feross/Library/Application Support/org.videolan.vlc/ml.xspf' +main debug: looking for demux module matching "xspf-open": 63 candidates +playlist debug: using XSPF playlist reader +main debug: using demux module "playlist" +main debug: looking for meta reader module matching "any": 2 candidates +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/meta/reader +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader +main debug: no meta reader modules matched +main debug: `file/xspf-open:///Users/feross/Library/Application%20Support/org.videolan.vlc/ml.xspf' successfully opened +main debug: looking for xml reader module matching "any": 1 candidates +main debug: using xml reader module "xml" +playlist debug: parsed 0 tracks successfully +main debug: EOF reached +main debug: removing module "playlist" +main debug: removing module "record" +main debug: removing module "filesystem" +main debug: creating audio output +main debug: looking for audio output module matching "any": 4 candidates +auhal debug: found 2 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +main debug: restart requested (2) +main debug: using audio output module "auhal" +main debug: keeping audio output +main debug: adding item `http://localhost:8000/0' ( http://localhost:8000/0 ) +main debug: no fetch required for (null) (art currently (null)) +main debug: looking for interface module matching "hotkeys,none": 15 candidates +main debug: using interface module "hotkeys" +main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. +main debug: looking for interface module matching "any": 15 candidates +main debug: looking for services probe module matching "any": 5 candidates +main debug: no services probe modules matched +main debug: looking for extension module matching "any": 1 candidates +lua debug: Opening Lua Extension module +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/extensions +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/extensions +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac +lua debug: Scanning Lua script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac +lua debug: Script /Applications/VLC.app/Contents/MacOS/share/lua/extensions/VLSub.luac has the following capability flags: 0x5 +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/extensions +main debug: using extension module "lua" +macosx debug: Found 1 video capture devices +macosx debug: Found 1 audio capture devices +main debug: processing request item: http://localhost:8000/0, node: Playlist, skip: 0 +main debug: rebuilding array of current - root Playlist +main debug: rebuild done - 1 items, index 0 +main debug: starting playback of the new playlist item +main debug: resyncing on http://localhost:8000/0 +main debug: http://localhost:8000/0 is at 0 +main debug: creating new input thread +main debug: Creating an input for 'http://localhost:8000/0' +main debug: using timeshift granularity of 50 MiB, in path '/tmp' +main debug: `http://localhost:8000/0' gives access `http' demux `' path `localhost:8000/0' +main debug: creating demux: access='http' demux='' location='localhost:8000/0' file='(null)' +main debug: looking for access_demux module matching "http": 14 candidates +main debug: no access_demux modules matched +main debug: creating access 'http' location='localhost:8000/0', path='(null)' +main debug: looking for access module matching "http": 18 candidates +access_http debug: querying proxy for http://localhost:8000/0 +access_http debug: no proxy +access_http debug: http: server='localhost' port=8000 file='/0' +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +macosx debug: no optical media found +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=0,remaining=463357580 +access_http debug: this frame size=463357580 +access_http debug: Connection: close +main debug: using access module "access_http" +main debug: Using stream method for AStream* +main debug: starting pre-buffering +main debug: received first data after 0 ms +main debug: pre-buffering done 1024 bytes in 0s - 52631 KiB/s +main debug: looking for stream_filter module matching "any": 9 candidates +main debug: no stream_filter modules matched +main debug: looking for stream_filter module matching "record": 9 candidates +main debug: using stream_filter module "record" +main debug: creating demux: access='http' demux='' location='localhost:8000/0' file='(null)' +main debug: looking for demux module matching "any": 63 candidates +access_http debug: trying to seek to 462693989 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=462693989,remaining=663591 +access_http debug: this frame size=663591 +access_http debug: Connection: close +mp4 warning: unknown box type desc (incompletely loaded) +mp4 warning: MP4 plugin discarded (not fast-seekable) +access_http debug: trying to seek to 1536 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=1536,remaining=463356044 +access_http debug: this frame size=463356044 +access_http debug: Connection: close +ts debug: TS module discarded (lost sync) +mod debug: MOD validation failed (ext=) +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/playlist +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/playlist +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_streams.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_xml.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/appletrailers.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/bbc_co_uk.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/break.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/canalplus.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/cue.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/dailymotion.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/extreme.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/france2.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/googlevideo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/jamendo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/joox.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/katsomo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/koreus.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/lelombrik.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/liveleak.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metacafe.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metachannels.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mpora.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pinkbike.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pluzz.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/rockbox_fm_presets.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/soundcloud.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/vimeo.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube_homepage.luac +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/zapiks.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/playlist +avcodec debug: trying url: http://localhost:8000/0 +avcodec debug: detected format: mov,mp4,m4a,3gp,3g2,mj2 +access_http debug: trying to seek to 463357580 +access_http error: seek too far +access_http debug: trying to seek to 463357579 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: this frame size=1 +access_http debug: Connection: close +access_http debug: trying to seek to 48072 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=48072,remaining=463309508 +access_http debug: this frame size=463309508 +access_http debug: Connection: close +main debug: selecting program id=0 +avcodec debug: adding es: video codec = h264 (28) +avcodec debug: adding es: audio codec = mp4a (86018) +avcodec debug: AVFormat supported stream +avcodec debug: - format = mov,mp4,m4a,3gp,3g2,mj2 (QuickTime / MOV) +avcodec debug: - start time = 0 +avcodec debug: - duration = 888064000 +main debug: using demux module "avcodec" +main debug: looking for decoder module matching "any": 37 candidates +avcodec debug: trying to use direct rendering +avcodec debug: allowing 4 thread(s) for decoding +avcodec debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started +avcodec debug: using frame thread mode with 4 threads +main debug: using decoder module "avcodec" +main debug: looking for decoder module matching "any": 37 candidates +main debug: using decoder module "faad" +main debug: looking for meta reader module matching "any": 2 candidates +lua debug: Trying Lua scripts in /Users/feross/Library/Application Support/org.videolan.vlc/lua/meta/reader +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader +lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac +lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader +main debug: no meta reader modules matched +main debug: `http://localhost:8000/0' successfully opened +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 2% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 6% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 10% +main debug: Buffering 12% +main debug: looking for text renderer module matching "any": 3 candidates +main debug: Buffering 12% +main debug: Buffering 14% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 23% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 27% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 32% +main debug: Buffering 33% +faad warning: decoded zero sample +main debug: Buffering 33% +freetype debug: looking for Arial Unicode MS +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +freetype debug: found /Library/Fonts/Arial Unicode.ttf +freetype debug: Using Arial Unicode MS as font from file /Library/Fonts/Arial Unicode.ttf +main debug: Buffering 75% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 87% +freetype debug: using fontsize: 2 +main debug: Buffering 87% +main debug: using text renderer module "freetype" +main debug: Buffering 89% +main debug: looking for video filter2 module matching "any": 54 candidates +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 93% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 98% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1024 ms in 2 ms) +swscale debug: 32x32 chroma: YUVA -> 16x16 chroma: RGBA with scaling using Bicubic (good quality) +main debug: using video filter2 module "swscale" +main debug: looking for video filter2 module matching "any": 54 candidates +yuvp debug: YUVP to YUVA converter +main debug: using video filter2 module "yuvp" +main debug: Deinterlacing available +main debug: deinterlace 0, mode blend, is_needed 0 +main debug: Opening vout display wrapper +main debug: looking for vout display module matching "any": 5 candidates +main debug: looking for vout window nsobject module matching "any": 1 candidates +macosx debug: prevented sleep through IOKit (1810) +macosx debug: returning videoview with proposed position x=0, y=0, width=2048, height=872 +main debug: using vout window nsobject module "macosx" +macosx debug: toggle playlist from state: removed splitview 0, minimized view 0. Sender is 0x0, unhide video view 0 +macosx debug: toggle playlist to state: removed splitview 0, minimized view 0 +macosx debug: releasing old sleep blocker (1810) +macosx debug: prevented sleep through IOKit (1812) +main debug: VoutDisplayEvent 'resize' 2048x872 window +main debug: using vout display module "vout_macosx" +main debug: original format sz 2048x872, of (0,0), vsz 2048x872, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0 +main debug: removing module "freetype" +main debug: looking for text renderer module matching "any": 3 candidates +freetype debug: looking for Arial Unicode MS +main debug: VoutDisplayEvent 'resize' 2872x1638 window +freetype debug: found /Library/Fonts/Arial Unicode.ttf +freetype debug: Using Arial Unicode MS as font from file /Library/Fonts/Arial Unicode.ttf +freetype debug: using fontsize: 2 +main debug: using text renderer module "freetype" +main debug: reusing audio output +avcodec debug: using direct rendering +main debug: VLC is looking for: 'f32l' 48000 Hz 3F2R/LFE frame=1 samples/24 bytes +auhal debug: attempting to use device 0 +auhal debug: using default audio device 38 +auhal debug: found 16 stream formats for stream id 39 +auhal debug: Audio device supports PCM mode only +main debug: End of video preroll +main debug: Received first picture +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +auhal debug: current format is: [44100.000000][mcpl][9][8][1][8][2][32] +auhal debug: layout of AUHAL has 2 channels +auhal debug: selected 2 physical channels for device output +auhal debug: VLC will output: Stereo +auhal debug: we set the AU format: [48000.000000][mcpl][9][8][1][8][2][32] +auhal debug: the actual set AU format is [48000.000000][mcpl][9][8][1][8][2][32] +auhal debug: analog output successfully opened +main debug: output 'f32l' 48000 Hz Stereo frame=1 samples/8 bytes +main debug: looking for audio volume module matching "any": 2 candidates +main debug: using audio volume module "float_mixer" +main debug: input 'f32l' 48000 Hz 3F2R/LFE frame=1 samples/24 bytes +main debug: looking for audio filter module matching "scaletempo": 14 candidates +scaletempo debug: format: 48000 rate, 6 nch, 4 bps, fl32 +scaletempo debug: params: 30 stride, 0.200 overlap, 14 search +scaletempo debug: 1.000 scale, 1440.000 stride_in, 1440 stride_out, 1152 standing, 288 overlap, 672 search, 2400 queue, fl32 mode +main debug: using audio filter module "scaletempo" +main debug: conversion: 'f32l'->'f32l' 48000 Hz->48000 Hz 3F2R/LFE->3F2R/LFE +main debug: conversion pipeline complete +main debug: conversion: 'f32l'->'f32l' 48000 Hz->48000 Hz 3F2R/LFE->Stereo +main debug: looking for audio converter module matching "any": 11 candidates +main debug: using audio converter module "simple_channel_mixer" +main debug: conversion pipeline complete +main debug: looking for audio resampler module matching "any": 2 candidates +main debug: using audio resampler module "ugly_resampler" +main debug: End of audio preroll +main debug: VoutDisplayEvent 'resize' 2872x1638 window +main debug: Decoder buffering done in 190 ms +main debug: VoutDisplayEvent 'resize' 2872x1638 window +freetype debug: looking for Arial Unicode MS +freetype debug: found /Library/Fonts/Arial Unicode.ttf +avcodec warning: DEMUX_SET_POSITION: 405077764 +access_http debug: trying to seek to 208453228 +main debug: net: connecting to localhost port 8000 +main debug: connection succeeded (socket = 38) +access_http debug: protocol 'HTTP' answer code 206 +access_http debug: Content-Type: video/mp4 +access_http debug: stream size=463357580,pos=208453228,remaining=254904352 +access_http debug: this frame size=254904352 +access_http debug: Connection: close +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: End of video preroll +main debug: Buffering 12% +main debug: Received first picture +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 22% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: End of audio preroll +main debug: Buffering 27% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 31% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 35% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 39% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 48% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 52% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 56% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 99% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1039 ms in 575 ms) +main debug: Decoder buffering done in 0 ms +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main warning: early picture skipped +main debug: discarded audio buffer +avcodec warning: DEMUX_SET_POSITION: 405077764 +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 3% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 7% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 22% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 27% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 31% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 35% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: Buffering 39% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 44% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 48% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 52% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 56% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 61% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 65% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 69% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 75% +main debug: Buffering 78% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 82% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 86% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 99% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1039 ms in 5 ms) +main debug: End of audio preroll +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 142 ms +main warning: picture is too late to be displayed (missing 96 ms) +main warning: picture is too late to be displayed (missing 54 ms) +main debug: picture might be displayed late (missing 13 ms) +main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1000 ms) +main error: ES_OUT_RESET_PCR called +main debug: Buffering 0% +main debug: Buffering 0% +main debug: Buffering 2% +main debug: Buffering 4% +main debug: Buffering 4% +main debug: Buffering 6% +main debug: Buffering 8% +main debug: Buffering 8% +main debug: Buffering 10% +main debug: Buffering 12% +main debug: Buffering 12% +main debug: Buffering 15% +main debug: Buffering 16% +main debug: Buffering 16% +main debug: Buffering 19% +main debug: Buffering 20% +main debug: Buffering 20% +main debug: Buffering 23% +main debug: Buffering 25% +main debug: Buffering 25% +main debug: Buffering 28% +main debug: Buffering 29% +main debug: Buffering 29% +main debug: Buffering 32% +main debug: Buffering 33% +main debug: Buffering 33% +main debug: Buffering 36% +main debug: Buffering 37% +main debug: Buffering 37% +main debug: End of audio preroll +main debug: Buffering 40% +main debug: Buffering 41% +main debug: Buffering 41% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 45% +main debug: Buffering 49% +main debug: Buffering 50% +main debug: Buffering 50% +main debug: Buffering 53% +main debug: Buffering 54% +main debug: Buffering 54% +main debug: Buffering 57% +main debug: Buffering 58% +main debug: Buffering 58% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 62% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 66% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 70% +main debug: Buffering 74% +main debug: Buffering 75% +main debug: Buffering 77% +main debug: Buffering 79% +main debug: Buffering 79% +main debug: Buffering 81% +main debug: Buffering 83% +main debug: Buffering 83% +main debug: Buffering 85% +main debug: Buffering 87% +main debug: Buffering 87% +main debug: Buffering 89% +main debug: Buffering 91% +main debug: Buffering 91% +main debug: Buffering 94% +main debug: Buffering 95% +main debug: Buffering 95% +main debug: Buffering 98% +main debug: Buffering 100% +main debug: Buffering 100% +main debug: Stream buffering done (1026 ms in 2 ms) +main debug: End of video preroll +main debug: Received first picture +main debug: Decoder buffering done in 36 ms +macosx debug: releasing sleep blocker (1812) +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 3 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: DevID: 60 DevName: HDMI +auhal debug: found 9 stream formats for stream id 61 +auhal debug: default device changed to 60 +auhal debug: default device actually changed, resetting aout +main debug: restart requested (2) +main debug: VoutDisplayEvent 'resize' 2872x1638 window +main debug: VoutDisplayEvent 'resize' 2872x1638 window +main debug: VoutDisplayEvent 'resize' 1436x819 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 2 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: default device changed to 38 +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 3 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: DevID: 64 DevName: HDMI +auhal debug: found 21 stream formats for stream id 65 +auhal debug: default device changed to 64 +auhal debug: default device actually changed, resetting aout +main debug: restart requested (2) +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 2 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: default device changed to 38 +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 1272x542 window +auhal debug: audio device configuration changed, resetting cache +auhal debug: found 3 audio device(s) +auhal debug: DevID: 48 DevName: Built-in Microphone +auhal debug: this 'Built-in Microphone' is INPUT only. skipping... +auhal debug: DevID: 38 DevName: Built-in Output +auhal debug: found 16 stream formats for stream id 39 +auhal warning: could not set audio stream formats property callback on stream id 39, callback already set? [epon] +auhal debug: DevID: 68 DevName: HDMI +auhal debug: found 21 stream formats for stream id 69 +auhal debug: default device changed to 68 +auhal debug: default device actually changed, resetting aout +main debug: restart requested (2) +main debug: VoutDisplayEvent 'resize' 1272x542 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +main debug: VoutDisplayEvent 'resize' 636x271 window +macosx debug: Terminating +-- logger module stopped -- +-- logger module stopped -- diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/.travis.yml b/node_modules/parse-torrent/node_modules/parse-torrent-file/.travis.yml new file mode 100644 index 00000000..fc806827 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: +- '0.11' +env: + global: + - secure: eVC0YNr2CsyESygd7DagpW3RW4nyngxYFLnucpJMyinMjQ4JRHoC5uNpWJyRFB7RqdIvnk61kub5fNL/EsAG9Qa1A6HRTXB6hQ0H+Dj/vy1jcCK4vC/6kuw7jPe613oNq7AoJCymHRZVr/gnBkwxFedt2hdQGZ+6NO9qK0+m8ao= + - secure: AqmBy4fZMfDSrSpfshUQ7Y+DX6BpE5/fcWc/y6HLzKKm41L1N7DBnyjSup64FjUSN50WPy1TNuVG+IbBeY8NAe1HRan3G7SdeELqYr7zteGXV6DoL1CvYdWlg3ckBrTcfv3Jo+zscrWo4v9gMqSdrxdm66Ys/EBt0l7ta3qMNDg= diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/.zuul.yml b/node_modules/parse-torrent/node_modules/parse-torrent-file/.zuul.yml new file mode 100644 index 00000000..00fd8dd4 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/.zuul.yml @@ -0,0 +1,16 @@ +ui: tape +browsers: + - name: chrome + version: latest + - name: firefox + version: latest + - name: safari + version: latest + - name: ie + version: latest + - name: iphone + version: latest + - name: ipad + version: latest + - name: android + version: latest diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/LICENSE b/node_modules/parse-torrent/node_modules/parse-torrent-file/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/parse-torrent/node_modules/parse-torrent-file/README.md b/node_modules/parse-torrent/node_modules/parse-torrent-file/README.md new file mode 100644 index 00000000..8e7d0f3b --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/README.md @@ -0,0 +1,128 @@ +# parse-torrent-file +[![travis](https://img.shields.io/travis/feross/parse-torrent-file.svg?style=flat)](https://travis-ci.org/feross/parse-torrent-file) +[![npm](https://img.shields.io/npm/v/parse-torrent-file.svg?style=flat)](https://npmjs.org/package/parse-torrent-file) +[![downloads](https://img.shields.io/npm/dm/parse-torrent-file.svg?style=flat)](https://npmjs.org/package/parse-torrent-file) + +#### Parse a .torrent file and return an object of keys/values + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/parse-torrent-file.svg)](https://saucelabs.com/u/parse-torrent-file) + +Works in node and the browser (with [browserify](http://browserify.org/)). This module is +used by [WebTorrent](http://webtorrent.io)! + +## install + +``` +npm install parse-torrent-file +``` + +## usage + +```js +var parseTorrentFile = require('parse-torrent-file') + +var torrent = fs.readFileSync(__dirname + '/torrents/leaves.torrent') +var parsed +try { + parsed = parseTorrentFile(torrent) +} catch (e) { + // the torrent file was corrupt + console.error(e) +} + +console.log(parsed.name) // Prints "Leaves of Grass by Walt Whitman.epub" +``` + +The `parsed` torrent object looks like this: + +```js +{ + "infoHash": "d2474e86c95b19b8bcfdb92bc12c9d44667cfa36", + "name": "Leaves of Grass by Walt Whitman.epub", + "private": false, + "created": "2013-08-01T13:27:46.000Z", + "announceList": [ + [ + "http://tracker.thepiratebay.org/announce" + ], + [ + "udp://tracker.openbittorrent.com:80" + ], + [ + "udp://tracker.ccc.de:80" + ], + [ + "udp://tracker.publicbt.com:80" + ], + [ + "udp://fr33domtracker.h33t.com:3310/announce", + "http://tracker.bittorrent.am/announce" + ] + ], + "announce": [ + "http://tracker.thepiratebay.org/announce", + "udp://tracker.openbittorrent.com:80", + "udp://tracker.ccc.de:80", + "udp://tracker.publicbt.com:80", + "udp://fr33domtracker.h33t.com:3310/announce", + "http://tracker.bittorrent.am/announce" + ], + "urlList": [], + "files": [ + { + "path": "Leaves of Grass by Walt Whitman.epub", + "name": "Leaves of Grass by Walt Whitman.epub", + "length": 362017, + "offset": 0 + } + ], + "length": 362017, + "pieceLength": 16384, + "lastPieceLength": 1569, + "pieces": [ + "1f9c3f59beec079715ec53324bde8569e4a0b4eb", + "ec42307d4ce5557b5d3964c5ef55d354cf4a6ecc", + "7bf1bcaf79d11fa5e0be06593c8faafc0c2ba2cf", + "76d71c5b01526b23007f9e9929beafc5151e6511", + "0931a1b44c21bf1e68b9138f90495e690dbc55f5", + "72e4c2944cbacf26e6b3ae8a7229d88aafa05f61", + "eaae6abf3f07cb6db9677cc6aded4dd3985e4586", + "27567fa7639f065f71b18954304aca6366729e0b", + "4773d77ae80caa96a524804dfe4b9bd3deaef999", + "c9dd51027467519d5eb2561ae2cc01467de5f643", + "0a60bcba24797692efa8770d23df0a830d91cb35", + "b3407a88baa0590dc8c9aa6a120f274367dcd867", + "e88e8338c572a06e3c801b29f519df532b3e76f6", + "70cf6aee53107f3d39378483f69cf80fa568b1ea", + "c53b506159e988d8bc16922d125d77d803d652c3", + "ca3070c16eed9172ab506d20e522ea3f1ab674b3", + "f923d76fe8f44ff32e372c3b376564c6fb5f0dbe", + "52164f03629fd1322636babb2c014b7dae582da4", + "1363965261e6ce12b43701f0a8c9ed1520a70eba", + "004400a267765f6d3dd5c7beb5bd3c75f3df2a54", + "560a61801147fa4ec7cf568e703acb04e5610a4d", + "56dcc242d03293e9446cf5e457d8eb3d9588fd90", + "c698de9b0dad92980906c026d8c1408fa08fe4ec" + ] +} +``` + +To convert a parsed torrent back into a .torrent file buffer, call `parseTorrentFile.encode`. + +```js +var parseTorrentFile = require('parse-torrent-file') + +// parse a torrent +var parsed = parseTorrentFile(/* some buffer */) + +// convert parsed torrent back to a buffer +var buf = parseTorrentFile.encode(parsed) +``` + +## credit + +This was originally based on [read-torrent](https://www.npmjs.org/package/read-torrent) by [mafintosh](https://twitter.com/mafintosh). It's basically a pared-down version of that, but it works in the browser (so [WebTorrent](http://webtorrent.io) can use it), doesn't have huge npm dependencies like `request` (saving on file size), and it has tests. Thanks for publishing good modules, mafintosh! + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/bin/cmd.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/bin/cmd.js new file mode 100755 index 00000000..0a9bae28 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/bin/cmd.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node + +var fs = require('fs') +var parseTorrent = require('../') + +function usage () { + console.error('Usage: parse-torrent-file /path/to/torrent') +} + +var torrentPath = process.argv[2] + +if (!torrentPath) { + usage() + process.exit(-1) +} + +try { + var parsedTorrent = parseTorrent(fs.readFileSync(torrentPath)) +} catch (err) { + console.error(err.message + '\n') + usage() + process.exit(-1) +} + +delete parsedTorrent.info +delete parsedTorrent.infoBuffer + +console.log(JSON.stringify(parsedTorrent, undefined, 2)) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/bundle.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/bundle.js new file mode 100644 index 00000000..70f2937a --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/bundle.js @@ -0,0 +1,7059 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0) { + // could this case even occur? + throw new Error("uneven number of keys and values B") + } + } + this.result = function () { + return stack + } + } + + var self = this, + ctx = new Context(), + smachine = new BdecodeSMachine(ctx.cb, ctx.cb_list, ctx.cb_dict, ctx.cb_end) + + this.result = function () { + if (!smachine.consistent()) { + throw new Error("not in consistent state. More bytes coming?") + } + return ctx.result() + } + + this.decode = function(buf, encoding) { + smachine.parse(buf, encoding) + } +} + +var Bencode = function(obj) { + var self = this + var to_encode = obj + var buffer = null + + switch (typeof (obj) ) { + case "string": + return encodeString(obj) + case "number": + return encodeNumber(obj) + break + case "object": + if (obj instanceof Array) { + return encodeList(obj) + } else if (Buffer.isBuffer(obj)) { + return encodeBuffer(obj) + } + + { + // assume it's a hash + return encodeDict(obj) + } + } + + function encodeString(obj) { + var blen = Buffer.byteLength(obj), + len = blen.toString(10), + buf = new Buffer(len.length + 1 + blen) + + buf.write(len, 0, "ascii") + buf.write(":", len.length, "ascii") + buf.write(obj, len.length+1, "utf8") + + return buf + } + + function encodeNumber(num) { + var n = num.toString(10), + buf = new Buffer(n.length+2) + + buf.write("i", 0) + buf.write(n, 1) + buf.write("e", n.length+1) + + return buf + } + + function encodeDict(obj) { + var func = function (obj, pos) { + var keys = Object.keys(obj).sort() + for (var i in keys) { + var key = Bencode(keys[i]), + val = Bencode(obj[keys[i]]) + ensure(key.length + val.length, pos) + key.copy(buffer, pos, 0) + pos += key.length + val.copy(buffer, pos, 0) + pos += val.length + } + return pos + } + return assemble(obj, "d", func) + } + + function encodeList(obj) { + var func = function(obj, pos) { + obj.forEach (function(o){ + var elem = Bencode(o) + + ensure(elem.length, pos) + elem.copy(buffer, pos, 0) + pos += elem.length + }) + return pos + } + return assemble(obj, "l", func) + } + + function encodeBuffer(obj) { + var len = obj.length.toString(10), + buf = new Buffer(len.length+1+obj.length); + + buf.write(len, 0, "ascii") + buf.write(":", len.length, "ascii") + obj.copy(buf, len.length+1, 0) + + return buf + } + + function assemble (obj, prefix, func) { + var pos = 0 + + ensure(1024, 0) + buffer.write(prefix, pos++) + + pos = func(obj, pos) + ensure(1, pos) + + buffer.write("e", pos++) + return buffer.slice(0, pos) + } + + function ensure (num, pos) { + if (!buffer) { + buffer = new Buffer(num) + } else { + if (buffer.length > num+pos+1) { + return + } else { + var buf2 = new Buffer(buffer.length + num) + buffer.copy(buf2, 0, 0) + buffer = buf2 + } + } + } +} + +function decode (buffer, encoding) { + var decoder = new Bdecode() + + decoder.decode(buffer, encoding) + return decoder.result()[0] +} + +function Stream (options) { + options = options || {}; + options.objectMode = true; + Transform.call(this, options); + this._decoder = new Bdecode() +} + +inherits(Stream, Transform); + +Stream.prototype._transform = function (chunk, encoding, callback) { + try { + this._decoder.decode(chunk, encoding) + callback(null); + } catch(err) { + callback(err); + } +} + +Stream.prototype._flush = function (callback) { + this.push(this._decoder.result()[0]); + callback(null); +} + +exports.encode = Bencode +exports.decoder = Bdecode +exports.decode = decode +exports.Stream = Stream + + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),require("buffer").Buffer) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"buffer":20,"stream":28,"util":36}],3:[function(require,module,exports){ +(function (global){ + + +(function () { + + // If we'e running in Node.JS, export a module. + if (typeof module !== 'undefined') { + module.exports = Rusha; + } + + // If we're running in a DOM context, export + // the Rusha object to toplevel. + if (typeof window !== 'undefined') { + window.Rusha = Rusha; + } + + // If we're running in a webworker, accept + // messages containing a jobid and a buffer + // or blob object, and return the hash result. + if (typeof FileReaderSync !== 'undefined') { + var reader = new FileReaderSync(), + hasher = new Rusha(4 * 1024 * 1024); + self.onmessage = function onMessage (event) { + var hash, data = event.data.data; + if (data instanceof Blob) { + try { + data = reader.readAsBinaryString(data); + } catch (e) { + self.postMessage({id: event.data.id, error: e.name}); + return; + } + } + hash = hasher.digest(data); + self.postMessage({id: event.data.id, hash: hash}); + }; + } + + // The Rusha object is a wrapper around the low-level RushaCore. + // It provides means of converting different inputs to the + // format accepted by RushaCore as well as other utility methods. + function Rusha (sizeHint) { + "use strict"; + + // Private object structure. + var self = {fill: 0}; + + // Calculate the length of buffer that the sha1 routine uses + // including the padding. + var padlen = function (len) { + return len + 1 + ((len ) % 64 < 56 ? 56 : 56 + 64) - (len ) % 64 + 8; + }; + + var padZeroes = function (bin, len) { + for (var i = len >> 2; i < bin.length; i++) bin[i] = 0; + }; + + var padData = function (bin, len) { + bin[len>>2] |= 0x80 << (24 - (len % 4 << 3)); + bin[(((len >> 2) + 2) & ~0x0f) + 15] = len << 3; + }; + + // Convert a binary string to a big-endian Int32Array using + // four characters per slot and pad it per the sha1 spec. + // A binary string is expected to only contain char codes < 256. + var convStr = function (str, bin, len) { + var i; + for (i = 0; i < len; i = i + 4 |0) { + bin[i>>2] = str.charCodeAt(i) << 24 | + str.charCodeAt(i+1) << 16 | + str.charCodeAt(i+2) << 8 | + str.charCodeAt(i+3); + } + }; + + // Convert a buffer or array to a big-endian Int32Array using + // four elements per slot and pad it per the sha1 spec. + // The buffer or array is expected to only contain elements < 256. + var convBuf = function (buf, bin, len) { + var i, m = len % 4, j = len - m; + for (i = 0; i < j; i = i + 4 |0) { + bin[i>>2] = buf[i] << 24 | + buf[i+1] << 16 | + buf[i+2] << 8 | + buf[i+3]; + } + switch (m) { + case 0: bin[j>>2] |= buf[j+3]; + case 3: bin[j>>2] |= buf[j+2] << 8; + case 2: bin[j>>2] |= buf[j+1] << 16; + case 1: bin[j>>2] |= buf[j] << 24; + } + }; + + // Convert general data to a big-endian Int32Array written on the + // heap and return it's length; + var conv = function (data, bin, len) { + if (typeof data === 'string') { + return convStr(data, bin, len); + } else if (data instanceof Array || (typeof global !== 'undefined' && + typeof global.Buffer !== 'undefined' && + global.Buffer.isBuffer(data))) { + return convBuf(data, bin, len); + } else if (data instanceof ArrayBuffer) { + return convBuf(new Uint8Array(data), bin, len); + } else if (data.buffer instanceof ArrayBuffer) { + return convBuf(new Uint8Array(data.buffer), bin, len); + } else { + throw new Error('Unsupported data type.'); + } + }; + + // Convert an ArrayBuffer into its hexadecimal string representation. + var hex = function (arrayBuffer) { + var i, x, hex_tab = "0123456789abcdef", res = [], binarray = new Uint8Array(arrayBuffer); + for (i = 0; i < binarray.length; i++) { + x = binarray[i]; + res[i] = hex_tab.charAt((x >> 4) & 0xF) + + hex_tab.charAt((x >> 0) & 0xF); + } + return res.join(''); + }; + + var nextPow2 = function (v) { + var p = 1; while (p < v) p = p << 1; return p; + }; + + // Resize the internal data structures to a new capacity. + var resize = function (size) { + self.sizeHint = size; + self.heap = new ArrayBuffer(nextPow2(padlen(size) + 320)); + self.core = RushaCore({Int32Array: Int32Array, DataView: DataView}, {}, self.heap); + }; + + // On initialize, resize the datastructures according + // to an optional size hint. + resize(sizeHint || 0); + + // Initialize and call the RushaCore, + // assuming an input buffer of length len * 4. + var coreCall = function (len) { + var h = new Int32Array(self.heap, len << 2, 5); + h[0] = 1732584193; + h[1] = -271733879; + h[2] = -1732584194; + h[3] = 271733878; + h[4] = -1009589776; + self.core.hash(len); + }; + + // Calculate the hash digest as an array of 5 32bit integers. + var rawDigest = this.rawDigest = function (str) { + var len = str.byteLength || str.length; + if (len > self.sizeHint) { + resize(len); + } + var view = new Int32Array(self.heap, 0, padlen(len) >> 2); + padZeroes(view, len); + conv(str, view, len); + padData(view, len); + coreCall(view.length); + var out = new Int32Array(5); + var arr = new DataView(out.buffer); + arr.setInt32(0, view[0], false); + arr.setInt32(4, view[1], false); + arr.setInt32(8, view[2], false); + arr.setInt32(12, view[3], false); + arr.setInt32(16, view[4], false); + return out; + }; + + // The digest and digestFrom* interface returns the hash digest + // as a hex string. + this.digest = this.digestFromString = + this.digestFromBuffer = this.digestFromArrayBuffer = + function (str) { + return hex(rawDigest(str).buffer); + }; + + }; + + // The low-level RushCore module provides the heart of Rusha, + // a high-speed sha1 implementation working on an Int32Array heap. + // At first glance, the implementation seems complicated, however + // with the SHA1 spec at hand, it is obvious this almost a textbook + // implementation that has a few functions hand-inlined and a few loops + // hand-unrolled. + function RushaCore (stdlib, foreign, heap) { + "use asm"; + + var H = new stdlib.Int32Array(heap); + + function hash (k) { + + k = k|0; + var i = 0, j = 0, + y0 = 0, z0 = 0, y1 = 0, z1 = 0, + y2 = 0, z2 = 0, y3 = 0, z3 = 0, + y4 = 0, z4 = 0, t0 = 0, t1 = 0; + + y0 = H[k+0<<2>>2]|0; + y1 = H[k+1<<2>>2]|0; + y2 = H[k+2<<2>>2]|0; + y3 = H[k+3<<2>>2]|0; + y4 = H[k+4<<2>>2]|0; + + for (i = 0; (i|0) < (k|0); i = i + 16 |0) { + + z0 = y0; + z1 = y1; + z2 = y2; + z3 = y3; + z4 = y4; + + + + + + + + + + + + + + for (j = 0; (j|0) < 16; j = j + 1 |0) { + t1 = H[i+j<<2>>2]|0; + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 & y2 | ~y1 & y3) |0) + ((t1 + y4 | 0) +1518500249 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[k+j<<2>>2] = t1; + } + + for (j = k + 16 |0; (j|0) < (k + 20 |0); j = j + 1 |0) { + t1 = (((H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) << 1 | (H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) >>> 31)); + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 & y2 | ~y1 & y3) |0) + ((t1 + y4 | 0) +1518500249 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[j<<2>>2] = t1; + } + + for (j = k + 20 |0; (j|0) < (k + 40 |0); j = j + 1 |0) { + t1 = (((H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) << 1 | (H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) >>> 31)); + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 ^ y2 ^ y3) |0) + ((t1 + y4 | 0) +1859775393 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[j<<2>>2] = t1; + } + + for (j = k + 40 |0; (j|0) < (k + 60 |0); j = j + 1 |0) { + t1 = (((H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) << 1 | (H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) >>> 31)); + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 & y2 | y1 & y3 | y2 & y3) |0) + ((t1 + y4 | 0) -1894007588 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[j<<2>>2] = t1; + } + + for (j = k + 60 |0; (j|0) < (k + 80 |0); j = j + 1 |0) { + t1 = (((H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) << 1 | (H[j-3<<2>>2] ^ H[j-8<<2>>2] ^ H[j-14<<2>>2] ^ H[j-16<<2>>2]) >>> 31)); + t0 = ((((y0) << 5 | (y0) >>> 27) + (y1 ^ y2 ^ y3) |0) + ((t1 + y4 | 0) -899497514 |0) |0); + y4 = y3; y3 = y2; y2 = ((y1) << 30 | (y1) >>> 2); y1 = y0; y0 = t0; + H[j<<2>>2] = t1; + } + + y0 = y0 + z0 |0; + y1 = y1 + z1 |0; + y2 = y2 + z2 |0; + y3 = y3 + z3 |0; + y4 = y4 + z4 |0; + + } + + H[0] = y0; + H[1] = y1; + H[2] = y2; + H[3] = y3; + H[4] = y4; + + } + + return {hash: hash}; + + } + +})(); + + +}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],4:[function(require,module,exports){ +(function (process){ +var defined = require('defined'); +var createDefaultStream = require('./lib/default_stream'); +var Test = require('./lib/test'); +var createResult = require('./lib/results'); + +var canEmitExit = typeof process !== 'undefined' && process + && typeof process.on === 'function' +; +var canExit = typeof process !== 'undefined' && process + && typeof process.exit === 'function' +; + +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +exports = module.exports = (function () { + var harness; + var lazyLoad = function () { + if (!harness) harness = createExitHarness({ + autoclose: !canEmitExit + }); + + return harness.apply(this, arguments); + }; + + lazyLoad.only = function () { + if (!harness) harness = createExitHarness({ + autoclose: !canEmitExit + }); + + return harness.only.apply(this, arguments); + } + + return lazyLoad +})(); + +function createExitHarness (conf) { + if (!conf) conf = {}; + var harness = createHarness({ + autoclose: defined(conf.autoclose, false) + }); + + var stream = harness.createStream(); + var es = stream.pipe(createDefaultStream()); + if (canEmitExit) { + es.on('error', function (err) { harness._exitCode = 1 }); + } + + var ended = false; + stream.on('end', function () { ended = true }); + + if (conf.exit === false) return harness; + if (!canEmitExit || !canExit) return harness; + + var _error; + + process.on('uncaughtException', function (err) { + if (err && err.code === 'EPIPE' && err.errno === 'EPIPE' + && err.syscall === 'write') return; + + _error = err + + throw err + }) + + process.on('exit', function (code) { + if (_error) { + return + } + + if (!ended) { + for (var i = 0; i < harness._tests.length; i++) { + var t = harness._tests[i]; + t._exit(); + } + } + harness.close(); + process.exit(code || harness._exitCode); + }); + + return harness; +} + +exports.createHarness = createHarness; +exports.Test = Test; +exports.test = exports; // tap compat + +var exitInterval; + +function createHarness (conf_) { + if (!conf_) conf_ = {}; + var results = createResult(); + if (conf_.autoclose !== false) { + results.once('done', function () { results.close() }); + } + + var test = function (name, conf, cb) { + var t = new Test(name, conf, cb); + test._tests.push(t); + + (function inspectCode (st) { + st.on('test', function sub (st_) { + inspectCode(st_); + }); + st.on('result', function (r) { + if (!r.ok) test._exitCode = 1 + }); + })(t); + + results.push(t); + return t; + }; + + test._tests = []; + + test.createStream = function () { + return results.createStream(); + }; + + var only = false; + test.only = function (name) { + if (only) throw new Error('there can only be one only test'); + results.only(name); + only = true; + return test.apply(null, arguments); + }; + test._exitCode = 0; + + test.close = function () { results.close() }; + + return test; +} + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"./lib/default_stream":5,"./lib/results":6,"./lib/test":7,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"defined":11}],5:[function(require,module,exports){ +var through = require('through'); + +module.exports = function () { + var line = ''; + var stream = through(write, flush); + return stream; + + function write (buf) { + for (var i = 0; i < buf.length; i++) { + var c = typeof buf === 'string' + ? buf.charAt(i) + : String.fromCharCode(buf[i]) + ; + if (c === '\n') flush(); + else line += c; + } + } + + function flush () { + try { console.log(line); } + catch (e) { stream.emit('error', e) } + line = ''; + } +}; + +},{"through":17}],6:[function(require,module,exports){ +(function (process){ +var EventEmitter = require('events').EventEmitter; +var inherits = require('inherits'); +var json = typeof JSON === 'object' ? JSON : require('jsonify'); +var through = require('through'); +var resumer = require('resumer'); +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +module.exports = Results; +inherits(Results, EventEmitter); + +function Results () { + if (!(this instanceof Results)) return new Results; + this.count = 0; + this.fail = 0; + this.pass = 0; + this._stream = through(); + this.tests = []; +} + +Results.prototype.createStream = function () { + var self = this; + var output = resumer(); + output.queue('TAP version 13\n'); + + nextTick(function next() { + var t; + while (t = getNextTest(self)) { + t.run(); + if (!t.ended) return t.once('end', function(){ nextTick(next); }); + } + self.emit('done'); + }); + self._stream.pipe(output); + + return output; +}; + +Results.prototype.push = function (t) { + var self = this; + self.tests.push(t); + self._watch(t); +}; + +Results.prototype.only = function (name) { + if (this._only) { + self.count ++; + self.fail ++; + write('not ok ' + self.count + ' already called .only()\n'); + } + this._only = name; +}; + +Results.prototype._watch = function (t) { + var self = this; + var write = function (s) { self._stream.queue(s) }; + t.once('prerun', function () { + write('# ' + t.name + '\n'); + }); + + t.on('result', function (res) { + if (typeof res === 'string') { + write('# ' + res + '\n'); + return; + } + write(encodeResult(res, self.count + 1)); + self.count ++; + + if (res.ok) self.pass ++ + else self.fail ++ + }); + + t.on('test', function (st) { self._watch(st) }); +}; + +Results.prototype.close = function () { + var self = this; + if (self.closed) self._stream.emit('error', new Error('ALREADY CLOSED')); + self.closed = true; + var write = function (s) { self._stream.queue(s) }; + + write('\n1..' + self.count + '\n'); + write('# tests ' + self.count + '\n'); + write('# pass ' + self.pass + '\n'); + if (self.fail) write('# fail ' + self.fail + '\n') + else write('\n# ok\n') + + self._stream.queue(null); +}; + +function encodeResult (res, count) { + var output = ''; + output += (res.ok ? 'ok ' : 'not ok ') + count; + output += res.name ? ' ' + res.name.toString().replace(/\s+/g, ' ') : ''; + + if (res.skip) output += ' # SKIP'; + else if (res.todo) output += ' # TODO'; + + output += '\n'; + if (res.ok) return output; + + var outer = ' '; + var inner = outer + ' '; + output += outer + '---\n'; + output += inner + 'operator: ' + res.operator + '\n'; + + var ex = json.stringify(res.expected, getSerialize()) || ''; + var ac = json.stringify(res.actual, getSerialize()) || ''; + + if (Math.max(ex.length, ac.length) > 65) { + output += inner + 'expected:\n' + inner + ' ' + ex + '\n'; + output += inner + 'actual:\n' + inner + ' ' + ac + '\n'; + } + else { + output += inner + 'expected: ' + ex + '\n'; + output += inner + 'actual: ' + ac + '\n'; + } + if (res.at) { + output += inner + 'at: ' + res.at + '\n'; + } + if (res.operator === 'error' && res.actual && res.actual.stack) { + var lines = String(res.actual.stack).split('\n'); + output += inner + 'stack:\n'; + output += inner + ' ' + lines[0] + '\n'; + for (var i = 1; i < lines.length; i++) { + output += inner + lines[i] + '\n'; + } + } + + output += outer + '...\n'; + return output; +} + +function getSerialize () { + var seen = []; + + return function (key, value) { + var ret = value; + if (typeof value === 'object' && value) { + var found = false; + for (var i = 0; i < seen.length; i++) { + if (seen[i] === value) { + found = true + break; + } + } + + if (found) ret = '[Circular]' + else seen.push(value) + } + return ret; + }; +} + +function getNextTest(results) { + if (!results._only) { + return results.tests.shift(); + } + + do { + var t = results.tests.shift(); + if (!t) { + return null; + } + if (results._only === t.name) { + return t; + } + } while (results.tests.length !== 0) +} + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"events":23,"inherits":12,"jsonify":13,"resumer":16,"through":17}],7:[function(require,module,exports){ +(function (process,__dirname){ +var Stream = require('stream'); +var deepEqual = require('deep-equal'); +var defined = require('defined'); +var path = require('path'); +var inherits = require('util').inherits; +var EventEmitter = require('events').EventEmitter; + +module.exports = Test; + +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +inherits(Test, EventEmitter); + +function Test (name_, opts_, cb_) { + var self = this; + var name = '(anonymous)'; + var opts = {}; + var cb; + + for (var i = 0; i < arguments.length; i++) { + switch (typeof arguments[i]) { + case 'string': + name = arguments[i]; + break; + case 'object': + opts = arguments[i] || opts; + break; + case 'function': + cb = arguments[i]; + } + } + + this.readable = true; + this.name = name || '(anonymous)'; + this.assertCount = 0; + this.pendingCount = 0; + this._skip = opts.skip || false; + this._plan = undefined; + this._cb = cb; + this._progeny = []; + this._ok = true; +} + +Test.prototype.run = function () { + if (!this._cb || this._skip) { + return this.end(); + } + this.emit('prerun'); + try { + this._cb(this); + } + catch (err) { + this.error(err); + this.end(); + return; + } + this.emit('run'); +}; + +Test.prototype.test = function (name, opts, cb) { + var self = this; + var t = new Test(name, opts, cb); + this._progeny.push(t); + this.pendingCount++; + this.emit('test', t); + t.on('prerun', function () { + self.assertCount++; + }) + + if (!self._pendingAsserts()) { + nextTick(function () { + self.end(); + }); + } + + nextTick(function() { + if (!self._plan && self.pendingCount == self._progeny.length) { + self.end(); + } + }); +}; + +Test.prototype.comment = function (msg) { + this.emit('result', msg.trim().replace(/^#\s*/, '')); +}; + +Test.prototype.plan = function (n) { + this._plan = n; + this.emit('plan', n); +}; + +Test.prototype.end = function () { + var self = this; + + if (this._progeny.length) { + var t = this._progeny.shift(); + t.on('end', function () { + self.end(); + }); + t.run(); + return; + } + + if (!this.ended) this.emit('end'); + var pendingAsserts = this._pendingAsserts(); + if (!this._planError && this._plan !== undefined && pendingAsserts) { + this._planError = true; + this.fail('plan != count', { + expected : this._plan, + actual : this.assertCount + }); + } + this.ended = true; +}; + +Test.prototype._exit = function () { + if (this._plan !== undefined && + !this._planError && this.assertCount !== this._plan) { + this._planError = true; + this.fail('plan != count', { + expected : this._plan, + actual : this.assertCount, + exiting : true + }); + } + else if (!this.ended) { + this.fail('test exited without ending', { + exiting: true + }); + } +}; + +Test.prototype._pendingAsserts = function () { + if (this._plan === undefined) { + return 1; + } else { + return this._plan - + (this._progeny.length + this.assertCount); + } +} + +Test.prototype._assert = function assert (ok, opts) { + var self = this; + var extra = opts.extra || {}; + + var res = { + id : self.assertCount ++, + ok : Boolean(ok), + skip : defined(extra.skip, opts.skip), + name : defined(extra.message, opts.message, '(unnamed assert)'), + operator : defined(extra.operator, opts.operator), + actual : defined(extra.actual, opts.actual), + expected : defined(extra.expected, opts.expected) + }; + this._ok = Boolean(this._ok && ok); + + if (!ok) { + res.error = defined(extra.error, opts.error, new Error(res.name)); + } + + var e = new Error('exception'); + var err = (e.stack || '').split('\n'); + var dir = path.dirname(__dirname) + '/'; + + for (var i = 0; i < err.length; i++) { + var m = /^\s*\bat\s+(.+)/.exec(err[i]); + if (!m) continue; + + var s = m[1].split(/\s+/); + var filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[1]); + if (!filem) { + filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[3]); + + if (!filem) continue; + } + + if (filem[1].slice(0, dir.length) === dir) continue; + + res.functionName = s[0]; + res.file = filem[1]; + res.line = Number(filem[2]); + if (filem[3]) res.column = filem[3]; + + res.at = m[1]; + break; + } + + self.emit('result', res); + + var pendingAsserts = self._pendingAsserts(); + if (!pendingAsserts) { + if (extra.exiting) { + self.end(); + } else { + nextTick(function () { + self.end(); + }); + } + } + + if (!self._planError && pendingAsserts < 0) { + self._planError = true; + self.fail('plan != count', { + expected : self._plan, + actual : self._plan - pendingAsserts + }); + } +}; + +Test.prototype.fail = function (msg, extra) { + this._assert(false, { + message : msg, + operator : 'fail', + extra : extra + }); +}; + +Test.prototype.pass = function (msg, extra) { + this._assert(true, { + message : msg, + operator : 'pass', + extra : extra + }); +}; + +Test.prototype.skip = function (msg, extra) { + this._assert(true, { + message : msg, + operator : 'skip', + skip : true, + extra : extra + }); +}; + +Test.prototype.ok += Test.prototype['true'] += Test.prototype.assert += function (value, msg, extra) { + this._assert(value, { + message : msg, + operator : 'ok', + expected : true, + actual : value, + extra : extra + }); +}; + +Test.prototype.notOk += Test.prototype['false'] += Test.prototype.notok += function (value, msg, extra) { + this._assert(!value, { + message : msg, + operator : 'notOk', + expected : false, + actual : value, + extra : extra + }); +}; + +Test.prototype.error += Test.prototype.ifError += Test.prototype.ifErr += Test.prototype.iferror += function (err, msg, extra) { + this._assert(!err, { + message : defined(msg, String(err)), + operator : 'error', + actual : err, + extra : extra + }); +}; + +Test.prototype.equal += Test.prototype.equals += Test.prototype.isEqual += Test.prototype.is += Test.prototype.strictEqual += Test.prototype.strictEquals += function (a, b, msg, extra) { + this._assert(a === b, { + message : defined(msg, 'should be equal'), + operator : 'equal', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.notEqual += Test.prototype.notEquals += Test.prototype.notStrictEqual += Test.prototype.notStrictEquals += Test.prototype.isNotEqual += Test.prototype.isNot += Test.prototype.not += Test.prototype.doesNotEqual += Test.prototype.isInequal += function (a, b, msg, extra) { + this._assert(a !== b, { + message : defined(msg, 'should not be equal'), + operator : 'notEqual', + actual : a, + notExpected : b, + extra : extra + }); +}; + +Test.prototype.deepEqual += Test.prototype.deepEquals += Test.prototype.isEquivalent += Test.prototype.same += function (a, b, msg, extra) { + this._assert(deepEqual(a, b, { strict: true }), { + message : defined(msg, 'should be equivalent'), + operator : 'deepEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.deepLooseEqual += Test.prototype.looseEqual += Test.prototype.looseEquals += function (a, b, msg, extra) { + this._assert(deepEqual(a, b), { + message : defined(msg, 'should be equivalent'), + operator : 'deepLooseEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.notDeepEqual += Test.prototype.notEquivalent += Test.prototype.notDeeply += Test.prototype.notSame += Test.prototype.isNotDeepEqual += Test.prototype.isNotDeeply += Test.prototype.isNotEquivalent += Test.prototype.isInequivalent += function (a, b, msg, extra) { + this._assert(!deepEqual(a, b, { strict: true }), { + message : defined(msg, 'should not be equivalent'), + operator : 'notDeepEqual', + actual : a, + notExpected : b, + extra : extra + }); +}; + +Test.prototype.notDeepLooseEqual += Test.prototype.notLooseEqual += Test.prototype.notLooseEquals += function (a, b, msg, extra) { + this._assert(deepEqual(a, b), { + message : defined(msg, 'should be equivalent'), + operator : 'notDeepLooseEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype['throws'] = function (fn, expected, msg, extra) { + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + var caught = undefined; + try { + fn(); + } + catch (err) { + caught = { error : err }; + var message = err.message; + delete err.message; + err.message = message; + } + + var passed = caught; + + if (expected instanceof RegExp) { + passed = expected.test(caught && caught.error); + expected = String(expected); + } + + this._assert(passed, { + message : defined(msg, 'should throw'), + operator : 'throws', + actual : caught && caught.error, + expected : expected, + error: !passed && caught && caught.error, + extra : extra + }); +}; + +Test.prototype.doesNotThrow = function (fn, expected, msg, extra) { + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + var caught = undefined; + try { + fn(); + } + catch (err) { + caught = { error : err }; + } + this._assert(!caught, { + message : defined(msg, 'should not throw'), + operator : 'throws', + actual : caught && caught.error, + expected : expected, + error : caught && caught.error, + extra : extra + }); +}; + +// vim: set softtabstop=4 shiftwidth=4: + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/../node_modules/tape/lib") +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"deep-equal":8,"defined":11,"events":23,"path":26,"stream":28,"util":36}],8:[function(require,module,exports){ +var pSlice = Array.prototype.slice; +var objectKeys = require('./lib/keys.js'); +var isArguments = require('./lib/is_arguments.js'); + +var deepEqual = module.exports = function (actual, expected, opts) { + if (!opts) opts = {}; + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.3. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return opts.strict ? actual === expected : actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected, opts); + } +} + +function isUndefinedOrNull(value) { + return value === null || value === undefined; +} + +function isBuffer (x) { + if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; + if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { + return false; + } + if (x.length > 0 && typeof x[0] !== 'number') return false; + return true; +} + +function objEquiv(a, b, opts) { + var i, key; + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical 'prototype' property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return deepEqual(a, b, opts); + } + if (isBuffer(a)) { + if (!isBuffer(b)) { + return false; + } + if (a.length !== b.length) return false; + for (i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; + } + try { + var ka = objectKeys(a), + kb = objectKeys(b); + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!deepEqual(a[key], b[key], opts)) return false; + } + return true; +} + +},{"./lib/is_arguments.js":9,"./lib/keys.js":10}],9:[function(require,module,exports){ +var supportsArgumentsClass = (function(){ + return Object.prototype.toString.call(arguments) +})() == '[object Arguments]'; + +exports = module.exports = supportsArgumentsClass ? supported : unsupported; + +exports.supported = supported; +function supported(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +}; + +exports.unsupported = unsupported; +function unsupported(object){ + return object && + typeof object == 'object' && + typeof object.length == 'number' && + Object.prototype.hasOwnProperty.call(object, 'callee') && + !Object.prototype.propertyIsEnumerable.call(object, 'callee') || + false; +}; + +},{}],10:[function(require,module,exports){ +exports = module.exports = typeof Object.keys === 'function' + ? Object.keys : shim; + +exports.shim = shim; +function shim (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} + +},{}],11:[function(require,module,exports){ +module.exports = function () { + for (var i = 0; i < arguments.length; i++) { + if (arguments[i] !== undefined) return arguments[i]; + } +}; + +},{}],12:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} + +},{}],13:[function(require,module,exports){ +exports.parse = require('./lib/parse'); +exports.stringify = require('./lib/stringify'); + +},{"./lib/parse":14,"./lib/stringify":15}],14:[function(require,module,exports){ +var at, // The index of the current character + ch, // The current character + escapee = { + '"': '"', + '\\': '\\', + '/': '/', + b: '\b', + f: '\f', + n: '\n', + r: '\r', + t: '\t' + }, + text, + + error = function (m) { + // Call error when something is wrong. + throw { + name: 'SyntaxError', + message: m, + at: at, + text: text + }; + }, + + next = function (c) { + // If a c parameter is provided, verify that it matches the current character. + if (c && c !== ch) { + error("Expected '" + c + "' instead of '" + ch + "'"); + } + + // Get the next character. When there are no more characters, + // return the empty string. + + ch = text.charAt(at); + at += 1; + return ch; + }, + + number = function () { + // Parse a number value. + var number, + string = ''; + + if (ch === '-') { + string = '-'; + next('-'); + } + while (ch >= '0' && ch <= '9') { + string += ch; + next(); + } + if (ch === '.') { + string += '.'; + while (next() && ch >= '0' && ch <= '9') { + string += ch; + } + } + if (ch === 'e' || ch === 'E') { + string += ch; + next(); + if (ch === '-' || ch === '+') { + string += ch; + next(); + } + while (ch >= '0' && ch <= '9') { + string += ch; + next(); + } + } + number = +string; + if (!isFinite(number)) { + error("Bad number"); + } else { + return number; + } + }, + + string = function () { + // Parse a string value. + var hex, + i, + string = '', + uffff; + + // When parsing for string values, we must look for " and \ characters. + if (ch === '"') { + while (next()) { + if (ch === '"') { + next(); + return string; + } else if (ch === '\\') { + next(); + if (ch === 'u') { + uffff = 0; + for (i = 0; i < 4; i += 1) { + hex = parseInt(next(), 16); + if (!isFinite(hex)) { + break; + } + uffff = uffff * 16 + hex; + } + string += String.fromCharCode(uffff); + } else if (typeof escapee[ch] === 'string') { + string += escapee[ch]; + } else { + break; + } + } else { + string += ch; + } + } + } + error("Bad string"); + }, + + white = function () { + +// Skip whitespace. + + while (ch && ch <= ' ') { + next(); + } + }, + + word = function () { + +// true, false, or null. + + switch (ch) { + case 't': + next('t'); + next('r'); + next('u'); + next('e'); + return true; + case 'f': + next('f'); + next('a'); + next('l'); + next('s'); + next('e'); + return false; + case 'n': + next('n'); + next('u'); + next('l'); + next('l'); + return null; + } + error("Unexpected '" + ch + "'"); + }, + + value, // Place holder for the value function. + + array = function () { + +// Parse an array value. + + var array = []; + + if (ch === '[') { + next('['); + white(); + if (ch === ']') { + next(']'); + return array; // empty array + } + while (ch) { + array.push(value()); + white(); + if (ch === ']') { + next(']'); + return array; + } + next(','); + white(); + } + } + error("Bad array"); + }, + + object = function () { + +// Parse an object value. + + var key, + object = {}; + + if (ch === '{') { + next('{'); + white(); + if (ch === '}') { + next('}'); + return object; // empty object + } + while (ch) { + key = string(); + white(); + next(':'); + if (Object.hasOwnProperty.call(object, key)) { + error('Duplicate key "' + key + '"'); + } + object[key] = value(); + white(); + if (ch === '}') { + next('}'); + return object; + } + next(','); + white(); + } + } + error("Bad object"); + }; + +value = function () { + +// Parse a JSON value. It could be an object, an array, a string, a number, +// or a word. + + white(); + switch (ch) { + case '{': + return object(); + case '[': + return array(); + case '"': + return string(); + case '-': + return number(); + default: + return ch >= '0' && ch <= '9' ? number() : word(); + } +}; + +// Return the json_parse function. It will have access to all of the above +// functions and variables. + +module.exports = function (source, reviver) { + var result; + + text = source; + at = 0; + ch = ' '; + result = value(); + white(); + if (ch) { + error("Syntax error"); + } + + // If there is a reviver function, we recursively walk the new structure, + // passing each name/value pair to the reviver function for possible + // transformation, starting with a temporary root object that holds the result + // in an empty key. If there is not a reviver function, we simply return the + // result. + + return typeof reviver === 'function' ? (function walk(holder, key) { + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + }({'': result}, '')) : result; +}; + +},{}],15:[function(require,module,exports){ +var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + +function quote(string) { + // If the string contains no control characters, no quote characters, and no + // backslash characters, then we can safely slap some quotes around it. + // Otherwise we must also replace the offending characters with safe escape + // sequences. + + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' ? c : + '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; +} + +function str(key, holder) { + // Produce a string from holder[key]. + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + + // If the value has a toJSON method, call it to obtain a replacement value. + if (value && typeof value === 'object' && + typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + + // If we were called with a replacer function, then call the replacer to + // obtain a replacement value. + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + + // What happens next depends on the value's type. + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + // JSON numbers must be finite. Encode non-finite numbers as null. + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + // If the value is a boolean or null, convert it to a string. Note: + // typeof null does not produce 'null'. The case is included here in + // the remote chance that this gets fixed someday. + return String(value); + + case 'object': + if (!value) return 'null'; + gap += indent; + partial = []; + + // Array.isArray + if (Object.prototype.toString.apply(value) === '[object Array]') { + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + + // Join all of the elements together, separated with commas, and + // wrap them in brackets. + v = partial.length === 0 ? '[]' : gap ? + '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + + // If the replacer is an array, use it to select the members to be + // stringified. + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + else { + // Otherwise, iterate through all of the keys in the object. + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + + // Join all of the member texts together, separated with commas, + // and wrap them in braces. + + v = partial.length === 0 ? '{}' : gap ? + '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : + '{' + partial.join(',') + '}'; + gap = mind; + return v; + } +} + +module.exports = function (value, replacer, space) { + var i; + gap = ''; + indent = ''; + + // If the space parameter is a number, make an indent string containing that + // many spaces. + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + } + // If the space parameter is a string, it will be used as the indent string. + else if (typeof space === 'string') { + indent = space; + } + + // If there is a replacer, it must be a function or an array. + // Otherwise, throw an error. + rep = replacer; + if (replacer && typeof replacer !== 'function' + && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + + // Make a fake root object containing our value under the key of ''. + // Return the result of stringifying the value. + return str('', {'': value}); +}; + +},{}],16:[function(require,module,exports){ +(function (process){ +var through = require('through'); +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +module.exports = function (write, end) { + var tr = through(write, end); + tr.pause(); + var resume = tr.resume; + var pause = tr.pause; + var paused = false; + + tr.pause = function () { + paused = true; + return pause.apply(this, arguments); + }; + + tr.resume = function () { + paused = false; + return resume.apply(this, arguments); + }; + + nextTick(function () { + if (!paused) tr.resume(); + }); + + return tr; +}; + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"through":17}],17:[function(require,module,exports){ +(function (process){ +var Stream = require('stream') + +// through +// +// a stream that does nothing but re-emit the input. +// useful for aggregating a series of changing but not ending streams into one stream) + +exports = module.exports = through +through.through = through + +//create a readable writable stream. + +function through (write, end, opts) { + write = write || function (data) { this.queue(data) } + end = end || function () { this.queue(null) } + + var ended = false, destroyed = false, buffer = [], _ended = false + var stream = new Stream() + stream.readable = stream.writable = true + stream.paused = false + +// stream.autoPause = !(opts && opts.autoPause === false) + stream.autoDestroy = !(opts && opts.autoDestroy === false) + + stream.write = function (data) { + write.call(this, data) + return !stream.paused + } + + function drain() { + while(buffer.length && !stream.paused) { + var data = buffer.shift() + if(null === data) + return stream.emit('end') + else + stream.emit('data', data) + } + } + + stream.queue = stream.push = function (data) { +// console.error(ended) + if(_ended) return stream + if(data == null) _ended = true + buffer.push(data) + drain() + return stream + } + + //this will be registered as the first 'end' listener + //must call destroy next tick, to make sure we're after any + //stream piped from here. + //this is only a problem if end is not emitted synchronously. + //a nicer way to do this is to make sure this is the last listener for 'end' + + stream.on('end', function () { + stream.readable = false + if(!stream.writable && stream.autoDestroy) + process.nextTick(function () { + stream.destroy() + }) + }) + + function _end () { + stream.writable = false + end.call(stream) + if(!stream.readable && stream.autoDestroy) + stream.destroy() + } + + stream.end = function (data) { + if(ended) return + ended = true + if(arguments.length) stream.write(data) + _end() // will emit or queue + return stream + } + + stream.destroy = function () { + if(destroyed) return + destroyed = true + ended = true + buffer.length = 0 + stream.writable = stream.readable = false + stream.emit('close') + return stream + } + + stream.pause = function () { + if(stream.paused) return + stream.paused = true + return stream + } + + stream.resume = function () { + if(stream.paused) { + stream.paused = false + stream.emit('resume') + } + drain() + //may have become paused again, + //as drain emits 'data'. + if(!stream.paused) + stream.emit('drain') + return stream + } + return stream +} + + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"stream":28}],18:[function(require,module,exports){ +(function (Buffer){ +var fs = require('fs') +var parseTorrent = require('../') +var test = require('tape') + +var leaves = Buffer("ZDg6YW5ub3VuY2U0MDpodHRwOi8vdHJhY2tlci50aGVwaXJhdGViYXkub3JnL2Fubm91bmNlMTM6YW5ub3VuY2UtbGlzdGxsNDA6aHR0cDovL3RyYWNrZXIudGhlcGlyYXRlYmF5Lm9yZy9hbm5vdW5jZWVsMzU6dWRwOi8vdHJhY2tlci5vcGVuYml0dG9ycmVudC5jb206ODBlbDIzOnVkcDovL3RyYWNrZXIuY2NjLmRlOjgwZWwyOTp1ZHA6Ly90cmFja2VyLnB1YmxpY2J0LmNvbTo4MGVsNDM6dWRwOi8vZnIzM2RvbXRyYWNrZXIuaDMzdC5jb206MzMxMC9hbm5vdW5jZTM3Omh0dHA6Ly90cmFja2VyLmJpdHRvcnJlbnQuYW0vYW5ub3VuY2VlZTc6Y29tbWVudDM3OkRvd25sb2FkZWQgZnJvbSBodHRwOi8vVGhlVG9ycmVudC5vcmcxMDpjcmVhdGVkIGJ5MTM6dVRvcnJlbnQvMzMwMDEzOmNyZWF0aW9uIGRhdGVpMTM3NTM2MzY2NmU4OmVuY29kaW5nNTpVVEYtODQ6aW5mb2Q2Omxlbmd0aGkzNjIwMTdlNDpuYW1lMzY6TGVhdmVzIG9mIEdyYXNzIGJ5IFdhbHQgV2hpdG1hbi5lcHViMTI6cGllY2UgbGVuZ3RoaTE2Mzg0ZTY6cGllY2VzNDYwOh+cP1m+7AeXFexTMkvehWnkoLTr7EIwfUzlVXtdOWTF71XTVM9Kbsx78byvedEfpeC+Blk8j6r8DCuiz3bXHFsBUmsjAH+emSm+r8UVHmURCTGhtEwhvx5ouROPkEleaQ28VfVy5MKUTLrPJuazropyKdiKr6BfYequar8/B8ttuWd8xq3tTdOYXkWGJ1Z/p2OfBl9xsYlUMErKY2ZyngtHc9d66AyqlqUkgE3+S5vT3q75mcndUQJ0Z1GdXrJWGuLMAUZ95fZDCmC8uiR5dpLvqHcNI98Kgw2RyzWzQHqIuqBZDcjJqmoSDydDZ9zYZ+iOgzjFcqBuPIAbKfUZ31MrPnb2cM9q7lMQfz05N4SD9pz4D6VoserFO1BhWemI2LwWki0SXXfYA9ZSw8owcMFu7ZFyq1BtIOUi6j8atnSz+SPXb+j0T/MuNyw7N2VkxvtfDb5SFk8DYp/RMiY2urssAUt9rlgtpBNjllJh5s4StDcB8KjJ7RUgpw66AEQAomd2X2091ce+tb08dfPfKlRWCmGAEUf6TsfPVo5wOssE5WEKTVbcwkLQMpPpRGz15FfY6z2ViP2Qxpjemw2tkpgJBsAm2MFAj6CP5OxlZQ==","base64") +var pride = Buffer("ZDg6YW5ub3VuY2U0MDpodHRwOi8vdHJhY2tlci50aGVwaXJhdGViYXkub3JnL2Fubm91bmNlMTM6YW5ub3VuY2UtbGlzdGxsNDA6aHR0cDovL3RyYWNrZXIudGhlcGlyYXRlYmF5Lm9yZy9hbm5vdW5jZWVsMzU6dWRwOi8vdHJhY2tlci5vcGVuYml0dG9ycmVudC5jb206ODBlbDIzOnVkcDovL3RyYWNrZXIuY2NjLmRlOjgwZWwyOTp1ZHA6Ly90cmFja2VyLnB1YmxpY2J0LmNvbTo4MGVsMzI6aHR0cDovL3RyYWNrZXIudGZpbGUubWUvYW5ub3VuY2VlbDQwOmh0dHA6Ly90cmFja2VyLm1hcnNoeW9ubGluZS5uZXQvYW5ub3VuY2VlbDI5Omh0dHA6Ly90cmFja2VyLmV4LnVhL2Fubm91bmNlZWwyOTpodHRwOi8vaS5iYW5kaXRvLm9yZy9hbm5vdW5jZWVsNDM6aHR0cDovL2dyZWVubGlldHJhY2tlci5hcHBzcG90LmNvbS9hbm5vdW5jZWVsMzg6aHR0cDovL2V4b2R1cy5kZXN5bmMuY29tOjY5NjkvYW5ub3VuY2VlbDM5Omh0dHA6Ly9jYWx1LWF0cmFjay5hcHBzcG90LmNvbS9hbm5vdW5jZWVsNDg6aHR0cDovL2NhbHUtYXRyYWNrLmFwcHNwb3QuY29tLm55dWQubmV0L2Fubm91bmNlZWwzOTpodHRwOi8vYnQucG9sZXRyYWNrZXIub3JnOjI3MTAvYW5ub3VuY2VlbDQ0Omh0dHA6Ly9iaWdmb290MTk0Mi5zZWt0b3JpLm9yZzo2OTY5L2Fubm91bmNlZWw0NTpodHRwOi8vYW5ub3VuY2Uub3BlbnNoYXJpbmcub3JnOjI3MTAvYW5ub3VuY2VlbDM4Omh0dHA6Ly85NC4yMjguMTkyLjk4Lm55dWQubmV0L2Fubm91bmNlZWwzOTpodHRwOi8vYnQuY2FyZWxhbmQuY29tLmNuOjY5NjkvYW5ub3VuY2VlbDI4Omh0dHA6Ly9lMTgwLnBocDUuY3ovYW5ub3VuY2VlbDM4Omh0dHA6Ly9iZXRhLm15dHJhY2tlci5tZTo2OTY5L2Fubm91bmNlZWw0MjpodHRwOi8vdHJhY2tlci5tZXRpbjIuY29tLmJyOjY5NjkvYW5ub3VuY2VlbDQ0Omh0dHA6Ly90cmFja2VyMS53YXNhYmlpLmNvbS50dzo2OTY5L2Fubm91bmNlZWw0MzpodHRwOi8vcmV0cmFja2VyLnBlcm0uZXJ0ZWxlY29tLnJ1L2Fubm91bmNlZWwzNzpodHRwOi8vZnIzM2RvbS5oMzN0LmNvbTozMzEwL2Fubm91bmNlZWwzMzpodHRwOi8vZXhvZHVzLmRlc3luYy5jb20vYW5ub3VuY2VlbDM3Omh0dHA6Ly9idC5ldXRvcnJlbnRzLmNvbS9hbm5vdW5jZS5waHBlbDQxOmh0dHA6Ly9yZXRyYWNrZXIuaHEuZXJ0ZWxlY29tLnJ1L2Fubm91bmNlZWw0NDpodHRwOi8vYW5ub3VuY2UudG9ycmVudHNtZC5jb206ODA4MC9hbm5vdW5jZWVsNDg6aHR0cDovL2Fubm91bmNlLnRvcnJlbnRzbWQuY29tOjgwODAvYW5ub3VuY2UucGhwZWwzMzpodHRwOi8vd3d3LmgzM3QuY29tOjMzMTAvYW5ub3VuY2VlbDQxOmh0dHA6Ly90cmFja2VyLnlpZnktdG9ycmVudHMuY29tL2Fubm91bmNlZWw0NDpodHRwOi8vYW5ub3VuY2UudG9ycmVudHNtZC5jb206Njk2OS9hbm5vdW5jZWVsNDQ6aHR0cDovL2ZyMzNkb210cmFja2VyLmgzM3QuY29tOjMzMTAvYW5ub3VuY2VlZTc6Y29tbWVudDQ2OlRvcnJlbnQgZG93bmxvYWRlZCBmcm9tIGh0dHA6Ly90aGVwaXJhdGViYXkuc3gxMDpjcmVhdGVkIGJ5MTM6dVRvcnJlbnQvMzMwMDEzOmNyZWF0aW9uIGRhdGVpMTM3NDUxNDM5OWU4OmVuY29kaW5nNTpVVEYtODQ6aW5mb2Q1OmZpbGVzbGQ2Omxlbmd0aGk2OTA0NTBlNDpwYXRobDIzOlByaWRlX2FuZF9QcmVqdWRpY2UucGRmZWVkNjpsZW5ndGhpNDg3MDc2ZTQ6cGF0aGwyNDpQcmlkZV9hbmRfUHJlanVkaWNlLm1vYmllZWQ2Omxlbmd0aGkzMDUxNjRlNDpwYXRobDI0OlByaWRlIGFuZCBQcmVqdWRpY2UuZXB1YmVlZTQ6bmFtZTM0OlBSSURFIEFORCBQUkVKVURJQ0UgIC0gSmFuZSBBdXN0ZW4xMjpwaWVjZSBsZW5ndGhpMTYzODRlNjpwaWVjZXMxODIwOlblAtwGzo5rtDn34LrCfmmEK8icuNEtvXdbK4zAHgOxhDJwNDVTHajCQmz/z+vaIGNqvXHw9LR2fO6cQkXW+m/mlTeiDHrxhCoA4bVZnif4288BroGoPXeFOk9xM1sHXWKt90hJyFKewrxRjLu2futT+kCwtFWvM5QJv/UMq1je7MmJz/VmYP579v94dpxa170i5HHsg4YnXU2jth4RTfeSwC3DA4SXNAp6UbY6Fkam9bYoj+7cFcot5BFp2vdnv0dmoMSKWWaqzSFy9za+A9eWkamgpAc86+CVeBl7otyeWgzbOuoJTVuJGZ3JC8au6EBusqKkUQkqBYV6vF3Ka5raxIO3SOSFi6g4+VPRG8dppyuhSYGFoY5cx/cXlVXxwOXZjNNgdvC7sokdnmpHVhS25H30cjm8nHDiuU9itt5papHghPIfRxe73nXkdCIVsJ6C7YFY99PODZ1x0Uu1SRHuJgN4+yPB5uVEMY09FK2BZReklPxm5w4WMd/Jblt35ee7fG0FVwLI5gRlYcDUl0hjGdrJSPmk+AZQ6ghOJH9vmgupKXAW2kB4S3G5iI7tc4OVkOBL/VJc0RB4eaIAM7oUyQhrSNMXpv6j9vdEkWGa9q7UDcdz4kb5fcVG36VX1WPdyTr1vZDw/ehT/4iLBIKsS62cEK7ODTXsJifQFH1VXdUjU1KH8FuK3/L85BdlsmjABzIcuFjT29t0AXt04DrrGN3i5Dc5UQY270nQ0af/Ly7Q5+EaxFcG1filxGQrvvgCa8QPiu8EFMMrUvewqKu8FfTn4bWXBzhRUarQgvI5y/hWA8J3/KDh0EAZMaG1rEn2LzQ2n2/J43iAUIMBYMI/4gw05So8EO6x7zhSoyjlV+FeI7U9JxTVkU+eRIY6WNKik61HXIi6TsGtCQWZZplVDHTGc+93T1BH+4gfcOFVRgeJAuL9KqfL+q2DqQpJazztgZpIn74LX2NV7DyZrriBi0q26dWjHpP5ETEDUh0N+Cc0asOTyGLn9DG+9kyYe62s9sZJ9BX1M7SP1dZhba3SMFTLgz437HtTp8pe34JK6vQWxtkstdKKpxC3USJJcF4A2FXNTfTf2chDrrqUWXdTI+jWydhfaEsH8zAfR0a3FCYqcAy2qe915LljAWygGXKTtb0qwKv3pXGJQV7xZybQox7yJhtg4jmzSDzl0rc2rWzqIs1NTxIvjUsug4BMbe3JXTNPSZ/ejGv7V0xWkYkNKxW2/1wYqem5mCQ3RmPPZpcnrNv3ik67gQCopEOowlY0rRXI8KskN/4FPXiolQc+4gtMUZVW8iQ9X9ul5IIOisOkIZuHFe0rWEW7RaRgdhYwvzo4ZRiKj+vS1CTiyWNg7fez4qa3YDp5rFTnQcRyOayqQt2ajYlmCo7Afua/EhlLWuOfrkazSU4z+MXh9hsQ7t9pN02+/omeg7T1qEf127yVL2f/d9a+CC+W9XPkx2TvHw8vILhagGKfexX4gvcZ8WVjylcvhLR1M/okxpDCH4aLn+52uuG9aOQrw551WRY87ApUv36MfmffRyDypEJi2/ibuWniLoShT0a08h/XG5zW+G2y3rVn/nLtmPe8kId1gc9trRcGA4ayUDQjiHhCkCI6Hx+XU/HeiRFlu1KR96wijcmNnC+IATjbsmgoyc1VMW8YbA6ND3/09dlqh65aazFhidc/OtzLuozmMh5aZFbm+hFDHZyONlxcggLb1puNJD1jSOH3zhV8e9zW1iuwxp3/rUryXWHnQnusz7uks9fibm5n8+pUOvnA2NFwAr65aVFs+EySwAia3gSafiJ0PafuIpf7ypOk4zq8bwAHnxQyREKtSKSa9CzFB+83WvnuSEhze4H5BRw7vi5q2zLHJx/dC+6hkPoiriSTgIflxdhLanSEdrmWkLGqNy7V/loObfbV8gu8DqkXX7wrJzIz8rM4qbBM5ivVUH3KXshhNsuzqr7v76SPv/LTusXs8U/BYitb9TVAHB7Xu7XFM6sf8OirhVtwQtTjwjiVWqh9hMdlcA0vyNkI+I7Urg/fltUVfDBbKW5xEtwz5pqrOrbpRqR/o4nayLGEITiry9CFm3mL8Ur5x2IKTJpkx5Nvi4qHqjMQleyBZmgS10osp7RjyEgTuq5HFt9R5n7WXjniyxmr7LkwAU7vc3Thu2fMDj9W5SMYANAN4dMb5oWK2JEHEMdySZZ5qsPdqIDDIRBcaiKut8gNaWXKW4B7PqmEZ9PuQRpVW56NNNEkZIB1EUhssrgT7bRm4hV2fbO3oN0oXN7aN9v/0arWmujKVBARcxiLPKmDUJyNpGrFgK844lFvbl5BKeDF+e/grVVvCPxIaW4dNgeMSUvGfXhjvajoYeG8MEVRbXcDEshwJzyuiqA9uwfKdTO5aUBeKUc//wZfpYB80uiVPkhYmnfDZWUK","base64") +var leavesCorrupt = Buffer("ZDg6YW5ub3VuY2U0MDpodHRwOi8vdHJhY2tlci50aGVwaXJhdGViYXkub3JnL2Fubm91bmNlMTM6YW5ub3VuY2UtbGlzdGxsNDA6aHR0cDovL3RyYWNrZXIudGhlcGlyYXRlYmF5Lm9yZy9hbm5vdW5jZWVsMzU6dWRwOi8vdHJhY2tlci5vcGVuYml0dG9ycmVudC5jb206ODBlbDIzOnVkcDovL3RyYWNrZXIuY2NjLmRlOjgwZWwyOTp1ZHA6Ly90cmFja2VyLnB1YmxpY2J0LmNvbTo4MGVsNDM6dWRwOi8vZnIzM2RvbXRyYWNrZXIuaDMzdC5jb206MzMxMC9hbm5vdW5jZTM3Omh0dHA6Ly90cmFja2VyLmJpdHRvcnJlbnQuYW0vYW5ub3VuY2VlZTc6Y29tbWVudDM3OkRvd25sb2FkZWQgZnJvbSBodHRwOi8vVGhlVG9ycmVudC5vcmcxMDpjcmVhdGVkIGJ5MTM6dVRvcnJlbnQvMzMwMDEzOmNyZWF0aW9uIGRhdGVpMTM3NTM2MzY2NmU4OmVuY29kaW5nNTpVVEYtODQ6aW5mb2Q2Omxlbmd0aGkzNjIwMTdlMTI6cGllY2UgbGVuZ3RoaTE2Mzg0ZTY6cGllY2VzNDYwOh+cP1m+7AeXFexTMkvehWnkoLTr7EIwfUzlVXtdOWTF71XTVM9Kbsx78byvedEfpeC+Blk8j6r8DCuiz3bXHFsBUmsjAH+emSm+r8UVHmURCTGhtEwhvx5ouROPkEleaQ28VfVy5MKUTLrPJuazropyKdiKr6BfYequar8/B8ttuWd8xq3tTdOYXkWGJ1Z/p2OfBl9xsYlUMErKY2ZyngtHc9d66AyqlqUkgE3+S5vT3q75mcndUQJ0Z1GdXrJWGuLMAUZ95fZDDWC8uiR5dpLvqHcNI98Ngw2RyzWzQHqIuqBZDcjJqmoSDydDZ9zYZ+iOgzjFcqBuPIAbKfUZ31MrPnb2cM9q7lMQfz05N4SD9pz4D6VoserFO1BhWemI2LwWki0SXXfYA9ZSw8owcMFu7ZFyq1BtIOUi6j8atnSz+SPXb+j0T/MuNyw7N2VkxvtfDb5SFk8DYp/RMiY2urssAUt9rlgtpBNjllJh5s4StDcB8KjJ7RUgpw66AEQAomd2X2091ce+tb08dfPfKlRWDWGAEUf6TsfPVo5wOssE5WENTVbcwkLQMpPpRGz15FfY6z2ViP2Qxpjemw2tkpgJBsAm2MFAj6CP5OxlZQ==","base64") +window.leaves = leaves +var leavesParsed = { + infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + name: 'Leaves of Grass by Walt Whitman.epub', + private: false, + created: new Date('Thu Aug 01 2013 06:27:46 GMT-0700 (PDT)'), + announce: [ + 'http://tracker.thepiratebay.org/announce', + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.ccc.de:80', + 'udp://tracker.publicbt.com:80', + 'udp://fr33domtracker.h33t.com:3310/announce' + ], + files: [ + { + path: 'Leaves of Grass by Walt Whitman.epub', + name: 'Leaves of Grass by Walt Whitman.epub', + length: 362017, + offset: 0 + } + ], + pieceLength: 16384, + lastPieceLength: 1569, + pieces: [ + '1f9c3f59beec079715ec53324bde8569e4a0b4eb', + 'ec42307d4ce5557b5d3964c5ef55d354cf4a6ecc', + '7bf1bcaf79d11fa5e0be06593c8faafc0c2ba2cf', + '76d71c5b01526b23007f9e9929beafc5151e6511', + '0931a1b44c21bf1e68b9138f90495e690dbc55f5', + '72e4c2944cbacf26e6b3ae8a7229d88aafa05f61', + 'eaae6abf3f07cb6db9677cc6aded4dd3985e4586', + '27567fa7639f065f71b18954304aca6366729e0b', + '4773d77ae80caa96a524804dfe4b9bd3deaef999', + 'c9dd51027467519d5eb2561ae2cc01467de5f643', + '0a60bcba24797692efa8770d23df0a830d91cb35', + 'b3407a88baa0590dc8c9aa6a120f274367dcd867', + 'e88e8338c572a06e3c801b29f519df532b3e76f6', + '70cf6aee53107f3d39378483f69cf80fa568b1ea', + 'c53b506159e988d8bc16922d125d77d803d652c3', + 'ca3070c16eed9172ab506d20e522ea3f1ab674b3', + 'f923d76fe8f44ff32e372c3b376564c6fb5f0dbe', + '52164f03629fd1322636babb2c014b7dae582da4', + '1363965261e6ce12b43701f0a8c9ed1520a70eba', + '004400a267765f6d3dd5c7beb5bd3c75f3df2a54', + '560a61801147fa4ec7cf568e703acb04e5610a4d', + '56dcc242d03293e9446cf5e457d8eb3d9588fd90', + 'c698de9b0dad92980906c026d8c1408fa08fe4ec' + ] +} + +var prideParsed = { + infoHash: '455a2295b558ac64e0348fb0c61f433224484908', + name: 'PRIDE AND PREJUDICE - Jane Austen', + private: false, + created: new Date('Mon Jul 22 2013 10:33:19 GMT-0700 (PDT)'), + announce: [ + 'http://tracker.thepiratebay.org/announce', + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.ccc.de:80', + 'udp://tracker.publicbt.com:80', + 'http://tracker.tfile.me/announce', + 'http://tracker.marshyonline.net/announce', + 'http://tracker.ex.ua/announce', + 'http://i.bandito.org/announce', + 'http://greenlietracker.appspot.com/announce', + 'http://exodus.desync.com:6969/announce', + 'http://calu-atrack.appspot.com/announce', + 'http://calu-atrack.appspot.com.nyud.net/announce', + 'http://bt.poletracker.org:2710/announce', + 'http://bigfoot1942.sektori.org:6969/announce', + 'http://announce.opensharing.org:2710/announce', + 'http://94.228.192.98.nyud.net/announce', + 'http://bt.careland.com.cn:6969/announce', + 'http://e180.php5.cz/announce', + 'http://beta.mytracker.me:6969/announce', + 'http://tracker.metin2.com.br:6969/announce', + 'http://tracker1.wasabii.com.tw:6969/announce', + 'http://retracker.perm.ertelecom.ru/announce', + 'http://fr33dom.h33t.com:3310/announce', + 'http://exodus.desync.com/announce', + 'http://bt.eutorrents.com/announce.php', + 'http://retracker.hq.ertelecom.ru/announce', + 'http://announce.torrentsmd.com:8080/announce', + 'http://announce.torrentsmd.com:8080/announce.php', + 'http://www.h33t.com:3310/announce', + 'http://tracker.yify-torrents.com/announce', + 'http://announce.torrentsmd.com:6969/announce', + 'http://fr33domtracker.h33t.com:3310/announce' + ], + files: [ + { + path: 'PRIDE AND PREJUDICE - Jane Austen/Pride_and_Prejudice.pdf', + name: 'Pride_and_Prejudice.pdf', + length: 690450, + offset: 0 + }, + { + path: 'PRIDE AND PREJUDICE - Jane Austen/Pride_and_Prejudice.mobi', + name: 'Pride_and_Prejudice.mobi', + length: 487076, + offset: 690450 + }, + { + path: 'PRIDE AND PREJUDICE - Jane Austen/Pride and Prejudice.epub', + name: 'Pride and Prejudice.epub', + length: 305164, + offset: 1177526 + } + ], + pieceLength: 16384, + lastPieceLength: 8130, + pieces: [ + '56e502dc06ce8e6bb439f7e0bac27e69842bc89c', + 'b8d12dbd775b2b8cc01e03b18432703435531da8', + 'c2426cffcfebda20636abd71f0f4b4767cee9c42', + '45d6fa6fe69537a20c7af1842a00e1b5599e27f8', + 'dbcf01ae81a83d77853a4f71335b075d62adf748', + '49c8529ec2bc518cbbb67eeb53fa40b0b455af33', + '9409bff50cab58deecc989cff56660fe7bf6ff78', + '769c5ad7bd22e471ec8386275d4da3b61e114df7', + '92c02dc3038497340a7a51b63a1646a6f5b6288f', + 'eedc15ca2de41169daf767bf4766a0c48a5966aa', + 'cd2172f736be03d79691a9a0a4073cebe0957819', + '7ba2dc9e5a0cdb3aea094d5b89199dc90bc6aee8', + '406eb2a2a451092a05857abc5dca6b9adac483b7', + '48e4858ba838f953d11bc769a72ba1498185a18e', + '5cc7f7179555f1c0e5d98cd36076f0bbb2891d9e', + '6a475614b6e47df47239bc9c70e2b94f62b6de69', + '6a91e084f21f4717bbde75e4742215b09e82ed81', + '58f7d3ce0d9d71d14bb54911ee260378fb23c1e6', + 'e544318d3d14ad816517a494fc66e70e1631dfc9', + '6e5b77e5e7bb7c6d055702c8e6046561c0d49748', + '6319dac948f9a4f80650ea084e247f6f9a0ba929', + '7016da40784b71b9888eed73839590e04bfd525c', + 'd1107879a20033ba14c9086b48d317a6fea3f6f7', + '4491619af6aed40dc773e246f97dc546dfa557d5', + '63ddc93af5bd90f0fde853ff888b0482ac4bad9c', + '10aece0d35ec2627d0147d555dd523535287f05b', + '8adff2fce41765b268c007321cb858d3dbdb7401', + '7b74e03aeb18dde2e43739510636ef49d0d1a7ff', + '2f2ed0e7e11ac45706d5f8a5c4642bbef8026bc4', + '0f8aef0414c32b52f7b0a8abbc15f4e7e1b59707', + '385151aad082f239cbf85603c277fca0e1d04019', + '31a1b5ac49f62f34369f6fc9e3788050830160c2', + '3fe20c34e52a3c10eeb1ef3852a328e557e15e23', + 'b53d2714d5914f9e44863a58d2a293ad475c88ba', + '4ec1ad0905996699550c74c673ef774f5047fb88', + '1f70e15546078902e2fd2aa7cbfaad83a90a496b', + '3ced819a489fbe0b5f6355ec3c99aeb8818b4ab6', + 'e9d5a31e93f9113103521d0df827346ac393c862', + 'e7f431bef64c987badacf6c649f415f533b48fd5', + 'd6616dadd23054cb833e37ec7b53a7ca5edf824a', + 'eaf416c6d92cb5d28aa710b7512249705e00d855', + 'cd4df4dfd9c843aeba9459775323e8d6c9d85f68', + '4b07f3301f4746b714262a700cb6a9ef75e4b963', + '016ca0197293b5bd2ac0abf7a57189415ef16726', + 'd0a31ef2261b60e239b3483ce5d2b736ad6cea22', + 'cd4d4f122f8d4b2e83804c6dedc95d334f499fde', + '8c6bfb574c5691890d2b15b6ff5c18a9e9b99824', + '374663cf669727acdbf78a4ebb8100a8a443a8c2', + '5634ad15c8f0ab2437fe053d78a895073ee20b4c', + '519556f2243d5fdba5e4820e8ac3a4219b8715ed', + '2b5845bb45a460761630bf3a3865188a8febd2d4', + '24e2c96360edf7b3e2a6b7603a79ac54e741c472', + '39acaa42dd9a8d89660a8ec07ee6bf12194b5ae3', + '9fae46b3494e33f8c5e1f61b10eedf69374dbefe', + '899e83b4f5a847f5dbbc952f67ff77d6be082f96', + 'f573e4c764ef1f0f2f20b85a80629f7b15f882f7', + '19f16563ca572f84b47533fa24c690c21f868b9f', + 'ee76bae1bd68e42bc39e7559163cec0a54bf7e8c', + '7e67df4720f2a44262dbf89bb969e22e84a14f46', + 'b4f21fd71b9cd6f86db2deb567fe72ed98f7bc90', + '877581cf6dad17060386b250342388784290223a', + '1f1f9753f1de891165bb5291f7ac228dc98d9c2f', + '880138dbb26828c9cd55316f186c0e8d0f7ff4f5', + 'd96a87ae5a6b316189d73f3adccbba8ce6321e5a', + '6456e6fa11431d9c8e365c5c8202dbd69b8d243d', + '6348e1f7ce157c7bdcd6d62bb0c69dffad4af25d', + '61e7427baccfbba4b3d7e26e6e67f3ea543af9c0', + 'd8d17002beb969516cf84c92c0089ade049a7e22', + '743da7ee2297fbca93a4e33abc6f00079f143244', + '42ad48a49af42cc507ef375af9ee4848737b81f9', + '051c3bbe2e6adb32c7271fdd0beea190fa22ae24', + '938087e5c5d84b6a748476b99690b1aa372ed5fe', + '5a0e6df6d5f20bbc0ea9175fbc2b273233f2b338', + 'a9b04ce62bd5507dca5ec86136cbb3aabeefefa4', + '8fbff2d3bac5ecf14fc1622b5bf535401c1ed7bb', + 'b5c533ab1ff0e8ab855b7042d4e3c238955aa87d', + '84c765700d2fc8d908f88ed4ae0fdf96d5157c30', + '5b296e7112dc33e69aab3ab6e946a47fa389dac8', + 'b1842138abcbd0859b798bf14af9c7620a4c9a64', + 'c7936f8b8a87aa331095ec81666812d74a2ca7b4', + '63c84813baae4716df51e67ed65e39e2cb19abec', + 'b930014eef7374e1bb67cc0e3f56e5231800d00d', + 'e1d31be6858ad8910710c772499679aac3dda880', + 'c321105c6a22aeb7c80d6965ca5b807b3ea98467', + 'd3ee411a555b9e8d34d12464807511486cb2b813', + 'edb466e215767db3b7a0dd285cdeda37dbffd1aa', + 'd69ae8ca54101173188b3ca983509c8da46ac580', + 'af38e2516f6e5e4129e0c5f9efe0ad556f08fc48', + '696e1d36078c494bc67d7863bda8e861e1bc3045', + '516d770312c870273cae8aa03dbb07ca7533b969', + '405e29473fff065fa5807cd2e8953e48589a77c3' + ] +} + +test('parse single file torrent', function (t) { + t.doesNotThrow(function () { + parseTorrent(leaves) + }) + t.deepEquals(parseTorrent(leaves), leavesParsed) + t.end() +}) + +test('parse multiple file torrent', function (t) { + t.doesNotThrow(function () { + parseTorrent(pride) + }) + t.deepEquals(parseTorrent(pride), prideParsed) + t.end() +}) + +test('exception thrown when torrent file is missing `name` field', function (t) { + t.throws(function () { + parseTorrent(leavesCorrupt) + }) + t.end() +}) + +}).call(this,require("buffer").Buffer) +},{"../":1,"buffer":20,"fs":19,"tape":4}],19:[function(require,module,exports){ + +},{}],20:[function(require,module,exports){ +/** + * The buffer module from node.js, for the browser. + * + * Author: Feross Aboukhadijeh + * License: MIT + * + * `npm install buffer` + */ + +var base64 = require('base64-js') +var ieee754 = require('ieee754') + +exports.Buffer = Buffer +exports.SlowBuffer = Buffer +exports.INSPECT_MAX_BYTES = 50 +Buffer.poolSize = 8192 + +/** + * If `Buffer._useTypedArrays`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (compatible down to IE6) + */ +Buffer._useTypedArrays = (function () { + // Detect if browser supports Typed Arrays. Supported browsers are IE 10+, + // Firefox 4+, Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. + if (typeof Uint8Array === 'undefined' || typeof ArrayBuffer === 'undefined') + return false + + // Does the browser support adding properties to `Uint8Array` instances? If + // not, then that's the same as no `Uint8Array` support. We need to be able to + // add all the node Buffer API methods. + // Relevant Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=695438 + try { + var arr = new Uint8Array(0) + arr.foo = function () { return 42 } + return 42 === arr.foo() && + typeof arr.subarray === 'function' // Chrome 9-10 lack `subarray` + } catch (e) { + return false + } +})() + +/** + * Class: Buffer + * ============= + * + * The Buffer constructor returns instances of `Uint8Array` that are augmented + * with function properties for all the node `Buffer` API functions. We use + * `Uint8Array` so that square bracket notation works as expected -- it returns + * a single octet. + * + * By augmenting the instances, we can avoid modifying the `Uint8Array` + * prototype. + */ +function Buffer (subject, encoding, noZero) { + if (!(this instanceof Buffer)) + return new Buffer(subject, encoding, noZero) + + var type = typeof subject + + // Workaround: node's base64 implementation allows for non-padded strings + // while base64-js does not. + if (encoding === 'base64' && type === 'string') { + subject = stringtrim(subject) + while (subject.length % 4 !== 0) { + subject = subject + '=' + } + } + + // Find the length + var length + if (type === 'number') + length = coerce(subject) + else if (type === 'string') + length = Buffer.byteLength(subject, encoding) + else if (type === 'object') + length = coerce(subject.length) // Assume object is an array + else + throw new Error('First argument needs to be a number, array or string.') + + var buf + if (Buffer._useTypedArrays) { + // Preferred: Return an augmented `Uint8Array` instance for best performance + buf = augment(new Uint8Array(length)) + } else { + // Fallback: Return THIS instance of Buffer (created by `new`) + buf = this + buf.length = length + buf._isBuffer = true + } + + var i + if (Buffer._useTypedArrays && typeof Uint8Array === 'function' && + subject instanceof Uint8Array) { + // Speed optimization -- use set if we're copying from a Uint8Array + buf._set(subject) + } else if (isArrayish(subject)) { + // Treat array-ish objects as a byte array + for (i = 0; i < length; i++) { + if (Buffer.isBuffer(subject)) + buf[i] = subject.readUInt8(i) + else + buf[i] = subject[i] + } + } else if (type === 'string') { + buf.write(subject, 0, encoding) + } else if (type === 'number' && !Buffer._useTypedArrays && !noZero) { + for (i = 0; i < length; i++) { + buf[i] = 0 + } + } + + return buf +} + +// STATIC METHODS +// ============== + +Buffer.isEncoding = function (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'binary': + case 'base64': + case 'raw': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.isBuffer = function (b) { + return !!(b !== null && b !== undefined && b._isBuffer) +} + +Buffer.byteLength = function (str, encoding) { + var ret + str = str + '' + switch (encoding || 'utf8') { + case 'hex': + ret = str.length / 2 + break + case 'utf8': + case 'utf-8': + ret = utf8ToBytes(str).length + break + case 'ascii': + case 'binary': + case 'raw': + ret = str.length + break + case 'base64': + ret = base64ToBytes(str).length + break + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + ret = str.length * 2 + break + default: + throw new Error('Unknown encoding') + } + return ret +} + +Buffer.concat = function (list, totalLength) { + assert(isArray(list), 'Usage: Buffer.concat(list, [totalLength])\n' + + 'list should be an Array.') + + if (list.length === 0) { + return new Buffer(0) + } else if (list.length === 1) { + return list[0] + } + + var i + if (typeof totalLength !== 'number') { + totalLength = 0 + for (i = 0; i < list.length; i++) { + totalLength += list[i].length + } + } + + var buf = new Buffer(totalLength) + var pos = 0 + for (i = 0; i < list.length; i++) { + var item = list[i] + item.copy(buf, pos) + pos += item.length + } + return buf +} + +// BUFFER INSTANCE METHODS +// ======================= + +function _hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + var remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + // must be an even number of digits + var strLen = string.length + assert(strLen % 2 === 0, 'Invalid hex string') + + if (length > strLen / 2) { + length = strLen / 2 + } + for (var i = 0; i < length; i++) { + var byte = parseInt(string.substr(i * 2, 2), 16) + assert(!isNaN(byte), 'Invalid hex string') + buf[offset + i] = byte + } + Buffer._charsWritten = i * 2 + return i +} + +function _utf8Write (buf, string, offset, length) { + var charsWritten = Buffer._charsWritten = + blitBuffer(utf8ToBytes(string), buf, offset, length) + return charsWritten +} + +function _asciiWrite (buf, string, offset, length) { + var charsWritten = Buffer._charsWritten = + blitBuffer(asciiToBytes(string), buf, offset, length) + return charsWritten +} + +function _binaryWrite (buf, string, offset, length) { + return _asciiWrite(buf, string, offset, length) +} + +function _base64Write (buf, string, offset, length) { + var charsWritten = Buffer._charsWritten = + blitBuffer(base64ToBytes(string), buf, offset, length) + return charsWritten +} + +function _utf16leWrite (buf, string, offset, length) { + var charsWritten = Buffer._charsWritten = + blitBuffer(utf16leToBytes(string), buf, offset, length) + return charsWritten +} + +Buffer.prototype.write = function (string, offset, length, encoding) { + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length + length = undefined + } + } else { // legacy + var swap = encoding + encoding = offset + offset = length + length = swap + } + + offset = Number(offset) || 0 + var remaining = this.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + encoding = String(encoding || 'utf8').toLowerCase() + + var ret + switch (encoding) { + case 'hex': + ret = _hexWrite(this, string, offset, length) + break + case 'utf8': + case 'utf-8': + ret = _utf8Write(this, string, offset, length) + break + case 'ascii': + ret = _asciiWrite(this, string, offset, length) + break + case 'binary': + ret = _binaryWrite(this, string, offset, length) + break + case 'base64': + ret = _base64Write(this, string, offset, length) + break + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + ret = _utf16leWrite(this, string, offset, length) + break + default: + throw new Error('Unknown encoding') + } + return ret +} + +Buffer.prototype.toString = function (encoding, start, end) { + var self = this + + encoding = String(encoding || 'utf8').toLowerCase() + start = Number(start) || 0 + end = (end !== undefined) + ? Number(end) + : end = self.length + + // Fastpath empty strings + if (end === start) + return '' + + var ret + switch (encoding) { + case 'hex': + ret = _hexSlice(self, start, end) + break + case 'utf8': + case 'utf-8': + ret = _utf8Slice(self, start, end) + break + case 'ascii': + ret = _asciiSlice(self, start, end) + break + case 'binary': + ret = _binarySlice(self, start, end) + break + case 'base64': + ret = _base64Slice(self, start, end) + break + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + ret = _utf16leSlice(self, start, end) + break + default: + throw new Error('Unknown encoding') + } + return ret +} + +Buffer.prototype.toJSON = function () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function (target, target_start, start, end) { + var source = this + + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (!target_start) target_start = 0 + + // Copy 0 bytes; we're done + if (end === start) return + if (target.length === 0 || source.length === 0) return + + // Fatal error conditions + assert(end >= start, 'sourceEnd < sourceStart') + assert(target_start >= 0 && target_start < target.length, + 'targetStart out of bounds') + assert(start >= 0 && start < source.length, 'sourceStart out of bounds') + assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) + end = this.length + if (target.length - target_start < end - start) + end = target.length - target_start + start + + // copy! + for (var i = 0; i < end - start; i++) + target[i + target_start] = this[i + start] +} + +function _base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function _utf8Slice (buf, start, end) { + var res = '' + var tmp = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; i++) { + if (buf[i] <= 0x7F) { + res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i]) + tmp = '' + } else { + tmp += '%' + buf[i].toString(16) + } + } + + return res + decodeUtf8Char(tmp) +} + +function _asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; i++) + ret += String.fromCharCode(buf[i]) + return ret +} + +function _binarySlice (buf, start, end) { + return _asciiSlice(buf, start, end) +} + +function _hexSlice (buf, start, end) { + var len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + var out = '' + for (var i = start; i < end; i++) { + out += toHex(buf[i]) + } + return out +} + +function _utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end) + var res = '' + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i+1] * 256) + } + return res +} + +Buffer.prototype.slice = function (start, end) { + var len = this.length + start = clamp(start, len, 0) + end = clamp(end, len, len) + + if (Buffer._useTypedArrays) { + return augment(this.subarray(start, end)) + } else { + var sliceLen = end - start + var newBuf = new Buffer(sliceLen, undefined, true) + for (var i = 0; i < sliceLen; i++) { + newBuf[i] = this[i + start] + } + return newBuf + } +} + +// `get` will be removed in Node 0.13+ +Buffer.prototype.get = function (offset) { + console.log('.get() is deprecated. Access using array indexes instead.') + return this.readUInt8(offset) +} + +// `set` will be removed in Node 0.13+ +Buffer.prototype.set = function (v, offset) { + console.log('.set() is deprecated. Access using array indexes instead.') + return this.writeUInt8(v, offset) +} + +Buffer.prototype.readUInt8 = function (offset, noAssert) { + if (!noAssert) { + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset < this.length, 'Trying to read beyond buffer length') + } + + if (offset >= this.length) + return + + return this[offset] +} + +function _readUInt16 (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') + } + + var len = buf.length + if (offset >= len) + return + + var val + if (littleEndian) { + val = buf[offset] + if (offset + 1 < len) + val |= buf[offset + 1] << 8 + } else { + val = buf[offset] << 8 + if (offset + 1 < len) + val |= buf[offset + 1] + } + return val +} + +Buffer.prototype.readUInt16LE = function (offset, noAssert) { + return _readUInt16(this, offset, true, noAssert) +} + +Buffer.prototype.readUInt16BE = function (offset, noAssert) { + return _readUInt16(this, offset, false, noAssert) +} + +function _readUInt32 (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') + } + + var len = buf.length + if (offset >= len) + return + + var val + if (littleEndian) { + if (offset + 2 < len) + val = buf[offset + 2] << 16 + if (offset + 1 < len) + val |= buf[offset + 1] << 8 + val |= buf[offset] + if (offset + 3 < len) + val = val + (buf[offset + 3] << 24 >>> 0) + } else { + if (offset + 1 < len) + val = buf[offset + 1] << 16 + if (offset + 2 < len) + val |= buf[offset + 2] << 8 + if (offset + 3 < len) + val |= buf[offset + 3] + val = val + (buf[offset] << 24 >>> 0) + } + return val +} + +Buffer.prototype.readUInt32LE = function (offset, noAssert) { + return _readUInt32(this, offset, true, noAssert) +} + +Buffer.prototype.readUInt32BE = function (offset, noAssert) { + return _readUInt32(this, offset, false, noAssert) +} + +Buffer.prototype.readInt8 = function (offset, noAssert) { + if (!noAssert) { + assert(offset !== undefined && offset !== null, + 'missing offset') + assert(offset < this.length, 'Trying to read beyond buffer length') + } + + if (offset >= this.length) + return + + var neg = this[offset] & 0x80 + if (neg) + return (0xff - this[offset] + 1) * -1 + else + return this[offset] +} + +function _readInt16 (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') + } + + var len = buf.length + if (offset >= len) + return + + var val = _readUInt16(buf, offset, littleEndian, true) + var neg = val & 0x8000 + if (neg) + return (0xffff - val + 1) * -1 + else + return val +} + +Buffer.prototype.readInt16LE = function (offset, noAssert) { + return _readInt16(this, offset, true, noAssert) +} + +Buffer.prototype.readInt16BE = function (offset, noAssert) { + return _readInt16(this, offset, false, noAssert) +} + +function _readInt32 (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') + } + + var len = buf.length + if (offset >= len) + return + + var val = _readUInt32(buf, offset, littleEndian, true) + var neg = val & 0x80000000 + if (neg) + return (0xffffffff - val + 1) * -1 + else + return val +} + +Buffer.prototype.readInt32LE = function (offset, noAssert) { + return _readInt32(this, offset, true, noAssert) +} + +Buffer.prototype.readInt32BE = function (offset, noAssert) { + return _readInt32(this, offset, false, noAssert) +} + +function _readFloat (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') + } + + return ieee754.read(buf, offset, littleEndian, 23, 4) +} + +Buffer.prototype.readFloatLE = function (offset, noAssert) { + return _readFloat(this, offset, true, noAssert) +} + +Buffer.prototype.readFloatBE = function (offset, noAssert) { + return _readFloat(this, offset, false, noAssert) +} + +function _readDouble (buf, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset + 7 < buf.length, 'Trying to read beyond buffer length') + } + + return ieee754.read(buf, offset, littleEndian, 52, 8) +} + +Buffer.prototype.readDoubleLE = function (offset, noAssert) { + return _readDouble(this, offset, true, noAssert) +} + +Buffer.prototype.readDoubleBE = function (offset, noAssert) { + return _readDouble(this, offset, false, noAssert) +} + +Buffer.prototype.writeUInt8 = function (value, offset, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset < this.length, 'trying to write beyond buffer length') + verifuint(value, 0xff) + } + + if (offset >= this.length) return + + this[offset] = value +} + +function _writeUInt16 (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 1 < buf.length, 'trying to write beyond buffer length') + verifuint(value, 0xffff) + } + + var len = buf.length + if (offset >= len) + return + + for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) { + buf[offset + i] = + (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> + (littleEndian ? i : 1 - i) * 8 + } +} + +Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) { + _writeUInt16(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) { + _writeUInt16(this, value, offset, false, noAssert) +} + +function _writeUInt32 (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'trying to write beyond buffer length') + verifuint(value, 0xffffffff) + } + + var len = buf.length + if (offset >= len) + return + + for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) { + buf[offset + i] = + (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff + } +} + +Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) { + _writeUInt32(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) { + _writeUInt32(this, value, offset, false, noAssert) +} + +Buffer.prototype.writeInt8 = function (value, offset, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset < this.length, 'Trying to write beyond buffer length') + verifsint(value, 0x7f, -0x80) + } + + if (offset >= this.length) + return + + if (value >= 0) + this.writeUInt8(value, offset, noAssert) + else + this.writeUInt8(0xff + value + 1, offset, noAssert) +} + +function _writeInt16 (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 1 < buf.length, 'Trying to write beyond buffer length') + verifsint(value, 0x7fff, -0x8000) + } + + var len = buf.length + if (offset >= len) + return + + if (value >= 0) + _writeUInt16(buf, value, offset, littleEndian, noAssert) + else + _writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert) +} + +Buffer.prototype.writeInt16LE = function (value, offset, noAssert) { + _writeInt16(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeInt16BE = function (value, offset, noAssert) { + _writeInt16(this, value, offset, false, noAssert) +} + +function _writeInt32 (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') + verifsint(value, 0x7fffffff, -0x80000000) + } + + var len = buf.length + if (offset >= len) + return + + if (value >= 0) + _writeUInt32(buf, value, offset, littleEndian, noAssert) + else + _writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert) +} + +Buffer.prototype.writeInt32LE = function (value, offset, noAssert) { + _writeInt32(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeInt32BE = function (value, offset, noAssert) { + _writeInt32(this, value, offset, false, noAssert) +} + +function _writeFloat (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') + verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + + var len = buf.length + if (offset >= len) + return + + ieee754.write(buf, value, offset, littleEndian, 23, 4) +} + +Buffer.prototype.writeFloatLE = function (value, offset, noAssert) { + _writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function (value, offset, noAssert) { + _writeFloat(this, value, offset, false, noAssert) +} + +function _writeDouble (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + assert(value !== undefined && value !== null, 'missing value') + assert(typeof littleEndian === 'boolean', 'missing or invalid endian') + assert(offset !== undefined && offset !== null, 'missing offset') + assert(offset + 7 < buf.length, + 'Trying to write beyond buffer length') + verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + + var len = buf.length + if (offset >= len) + return + + ieee754.write(buf, value, offset, littleEndian, 52, 8) +} + +Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) { + _writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) { + _writeDouble(this, value, offset, false, noAssert) +} + +// fill(value, start=0, end=buffer.length) +Buffer.prototype.fill = function (value, start, end) { + if (!value) value = 0 + if (!start) start = 0 + if (!end) end = this.length + + if (typeof value === 'string') { + value = value.charCodeAt(0) + } + + assert(typeof value === 'number' && !isNaN(value), 'value is not a number') + assert(end >= start, 'end < start') + + // Fill 0 bytes; we're done + if (end === start) return + if (this.length === 0) return + + assert(start >= 0 && start < this.length, 'start out of bounds') + assert(end >= 0 && end <= this.length, 'end out of bounds') + + for (var i = start; i < end; i++) { + this[i] = value + } +} + +Buffer.prototype.inspect = function () { + var out = [] + var len = this.length + for (var i = 0; i < len; i++) { + out[i] = toHex(this[i]) + if (i === exports.INSPECT_MAX_BYTES) { + out[i + 1] = '...' + break + } + } + return '' +} + +/** + * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance. + * Added in Node 0.12. Only available in browsers that support ArrayBuffer. + */ +Buffer.prototype.toArrayBuffer = function () { + if (typeof Uint8Array === 'function') { + if (Buffer._useTypedArrays) { + return (new Buffer(this)).buffer + } else { + var buf = new Uint8Array(this.length) + for (var i = 0, len = buf.length; i < len; i += 1) + buf[i] = this[i] + return buf.buffer + } + } else { + throw new Error('Buffer.toArrayBuffer not supported in this browser') + } +} + +// HELPER FUNCTIONS +// ================ + +function stringtrim (str) { + if (str.trim) return str.trim() + return str.replace(/^\s+|\s+$/g, '') +} + +var BP = Buffer.prototype + +/** + * Augment the Uint8Array *instance* (not the class!) with Buffer methods + */ +function augment (arr) { + arr._isBuffer = true + + // save reference to original Uint8Array get/set methods before overwriting + arr._get = arr.get + arr._set = arr.set + + // deprecated, will be removed in node 0.13+ + arr.get = BP.get + arr.set = BP.set + + arr.write = BP.write + arr.toString = BP.toString + arr.toLocaleString = BP.toString + arr.toJSON = BP.toJSON + arr.copy = BP.copy + arr.slice = BP.slice + arr.readUInt8 = BP.readUInt8 + arr.readUInt16LE = BP.readUInt16LE + arr.readUInt16BE = BP.readUInt16BE + arr.readUInt32LE = BP.readUInt32LE + arr.readUInt32BE = BP.readUInt32BE + arr.readInt8 = BP.readInt8 + arr.readInt16LE = BP.readInt16LE + arr.readInt16BE = BP.readInt16BE + arr.readInt32LE = BP.readInt32LE + arr.readInt32BE = BP.readInt32BE + arr.readFloatLE = BP.readFloatLE + arr.readFloatBE = BP.readFloatBE + arr.readDoubleLE = BP.readDoubleLE + arr.readDoubleBE = BP.readDoubleBE + arr.writeUInt8 = BP.writeUInt8 + arr.writeUInt16LE = BP.writeUInt16LE + arr.writeUInt16BE = BP.writeUInt16BE + arr.writeUInt32LE = BP.writeUInt32LE + arr.writeUInt32BE = BP.writeUInt32BE + arr.writeInt8 = BP.writeInt8 + arr.writeInt16LE = BP.writeInt16LE + arr.writeInt16BE = BP.writeInt16BE + arr.writeInt32LE = BP.writeInt32LE + arr.writeInt32BE = BP.writeInt32BE + arr.writeFloatLE = BP.writeFloatLE + arr.writeFloatBE = BP.writeFloatBE + arr.writeDoubleLE = BP.writeDoubleLE + arr.writeDoubleBE = BP.writeDoubleBE + arr.fill = BP.fill + arr.inspect = BP.inspect + arr.toArrayBuffer = BP.toArrayBuffer + + return arr +} + +// slice(start, end) +function clamp (index, len, defaultValue) { + if (typeof index !== 'number') return defaultValue + index = ~~index; // Coerce to integer. + if (index >= len) return len + if (index >= 0) return index + index += len + if (index >= 0) return index + return 0 +} + +function coerce (length) { + // Coerce length to a number (possibly NaN), round up + // in case it's fractional (e.g. 123.456) then do a + // double negate to coerce a NaN to 0. Easy, right? + length = ~~Math.ceil(+length) + return length < 0 ? 0 : length +} + +function isArray (subject) { + return (Array.isArray || function (subject) { + return Object.prototype.toString.call(subject) === '[object Array]' + })(subject) +} + +function isArrayish (subject) { + return isArray(subject) || Buffer.isBuffer(subject) || + subject && typeof subject === 'object' && + typeof subject.length === 'number' +} + +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) +} + +function utf8ToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; i++) { + var b = str.charCodeAt(i) + if (b <= 0x7F) + byteArray.push(str.charCodeAt(i)) + else { + var start = i + if (b >= 0xD800 && b <= 0xDFFF) i++ + var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%') + for (var j = 0; j < h.length; j++) + byteArray.push(parseInt(h[j], 16)) + } + } + return byteArray +} + +function asciiToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; i++) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; i++) { + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(str) +} + +function blitBuffer (src, dst, offset, length) { + var pos + for (var i = 0; i < length; i++) { + if ((i + offset >= dst.length) || (i >= src.length)) + break + dst[i + offset] = src[i] + } + return i +} + +function decodeUtf8Char (str) { + try { + return decodeURIComponent(str) + } catch (err) { + return String.fromCharCode(0xFFFD) // UTF 8 invalid char + } +} + +/* + * We have to make sure that the value is a valid integer. This means that it + * is non-negative. It has no fractional component and that it does not + * exceed the maximum allowed value. + */ +function verifuint (value, max) { + assert(typeof value === 'number', 'cannot write a non-number as a number') + assert(value >= 0, + 'specified a negative value for writing an unsigned value') + assert(value <= max, 'value is larger than maximum value for type') + assert(Math.floor(value) === value, 'value has a fractional component') +} + +function verifsint (value, max, min) { + assert(typeof value === 'number', 'cannot write a non-number as a number') + assert(value <= max, 'value larger than maximum allowed value') + assert(value >= min, 'value smaller than minimum allowed value') + assert(Math.floor(value) === value, 'value has a fractional component') +} + +function verifIEEE754 (value, max, min) { + assert(typeof value === 'number', 'cannot write a non-number as a number') + assert(value <= max, 'value larger than maximum allowed value') + assert(value >= min, 'value smaller than minimum allowed value') +} + +function assert (test, message) { + if (!test) throw new Error(message || 'Failed assertion') +} + +},{"base64-js":21,"ieee754":22}],21:[function(require,module,exports){ +var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + +;(function (exports) { + 'use strict'; + + var Arr = (typeof Uint8Array !== 'undefined') + ? Uint8Array + : Array + + var ZERO = '0'.charCodeAt(0) + var PLUS = '+'.charCodeAt(0) + var SLASH = '/'.charCodeAt(0) + var NUMBER = '0'.charCodeAt(0) + var LOWER = 'a'.charCodeAt(0) + var UPPER = 'A'.charCodeAt(0) + + function decode (elt) { + var code = elt.charCodeAt(0) + if (code === PLUS) + return 62 // '+' + if (code === SLASH) + return 63 // '/' + if (code < NUMBER) + return -1 //no match + if (code < NUMBER + 10) + return code - NUMBER + 26 + 26 + if (code < UPPER + 26) + return code - UPPER + if (code < LOWER + 26) + return code - LOWER + 26 + } + + function b64ToByteArray (b64) { + var i, j, l, tmp, placeHolders, arr + + if (b64.length % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // the number of equal signs (place holders) + // if there are two placeholders, than the two characters before it + // represent one byte + // if there is only one, then the three characters before it represent 2 bytes + // this is just a cheap hack to not do indexOf twice + var len = b64.length + placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0 + + // base64 is 4/3 + up to two characters of the original data + arr = new Arr(b64.length * 3 / 4 - placeHolders) + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? b64.length - 4 : b64.length + + var L = 0 + + function push (v) { + arr[L++] = v + } + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3)) + push((tmp & 0xFF0000) >> 16) + push((tmp & 0xFF00) >> 8) + push(tmp & 0xFF) + } + + if (placeHolders === 2) { + tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4) + push(tmp & 0xFF) + } else if (placeHolders === 1) { + tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2) + push((tmp >> 8) & 0xFF) + push(tmp & 0xFF) + } + + return arr + } + + function uint8ToBase64 (uint8) { + var i, + extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes + output = "", + temp, length + + function encode (num) { + return lookup.charAt(num) + } + + function tripletToBase64 (num) { + return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F) + } + + // go through the array every three bytes, we'll deal with trailing stuff later + for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { + temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) + output += tripletToBase64(temp) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + switch (extraBytes) { + case 1: + temp = uint8[uint8.length - 1] + output += encode(temp >> 2) + output += encode((temp << 4) & 0x3F) + output += '==' + break + case 2: + temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) + output += encode(temp >> 10) + output += encode((temp >> 4) & 0x3F) + output += encode((temp << 2) & 0x3F) + output += '=' + break + } + + return output + } + + module.exports.toByteArray = b64ToByteArray + module.exports.fromByteArray = uint8ToBase64 +}()) + +},{}],22:[function(require,module,exports){ +exports.read = function(buffer, offset, isLE, mLen, nBytes) { + var e, m, + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + nBits = -7, + i = isLE ? (nBytes - 1) : 0, + d = isLE ? -1 : 1, + s = buffer[offset + i]; + + i += d; + + e = s & ((1 << (-nBits)) - 1); + s >>= (-nBits); + nBits += eLen; + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); + + m = e & ((1 << (-nBits)) - 1); + e >>= (-nBits); + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity); + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); +}; + +exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c, + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), + i = isLE ? 0 : (nBytes - 1), + d = isLE ? 1 : -1, + s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; + + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); + + e = (e << mLen) | m; + eLen += mLen; + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); + + buffer[offset + i - d] |= s * 128; +}; + +},{}],23:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; + +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; + + if (!this._events) + this._events = {}; + + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } else { + throw TypeError('Uncaught, unspecified "error" event.'); + } + return false; + } + } + + handler = this._events[type]; + + if (isUndefined(handler)) + return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + len = arguments.length; + args = new Array(len - 1); + for (i = 1; i < len; i++) + args[i - 1] = arguments[i]; + handler.apply(this, args); + } + } else if (isObject(handler)) { + len = arguments.length; + args = new Array(len - 1); + for (i = 1; i < len; i++) + args[i - 1] = arguments[i]; + + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); + } + + return true; +}; + +EventEmitter.prototype.addListener = function(type, listener) { + var m; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events) + this._events = {}; + + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); + + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + var m; + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } + + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + console.trace(); + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) + return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); + + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + if (!this._events) + return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.listenerCount = function(emitter, type) { + var ret; + if (!emitter._events || !emitter._events[type]) + ret = 0; + else if (isFunction(emitter._events[type])) + ret = 1; + else + ret = emitter._events[type].length; + return ret; +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + +},{}],24:[function(require,module,exports){ +module.exports=require(12) +},{}],25:[function(require,module,exports){ +// shim for using process in browser + +var process = module.exports = {}; + +process.nextTick = (function () { + var canSetImmediate = typeof window !== 'undefined' + && window.setImmediate; + var canPost = typeof window !== 'undefined' + && window.postMessage && window.addEventListener + ; + + if (canSetImmediate) { + return function (f) { return window.setImmediate(f) }; + } + + if (canPost) { + var queue = []; + window.addEventListener('message', function (ev) { + var source = ev.source; + if ((source === window || source === null) && ev.data === 'process-tick') { + ev.stopPropagation(); + if (queue.length > 0) { + var fn = queue.shift(); + fn(); + } + } + }, true); + + return function nextTick(fn) { + queue.push(fn); + window.postMessage('process-tick', '*'); + }; + } + + return function nextTick(fn) { + setTimeout(fn, 0); + }; +})(); + +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +} + +// TODO(shtylman) +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; + +},{}],26:[function(require,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; + +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; + + +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } +; + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25}],27:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +module.exports = Duplex; +var inherits = require('inherits'); +var setImmediate = require('process/browser.js').nextTick; +var Readable = require('./readable.js'); +var Writable = require('./writable.js'); + +inherits(Duplex, Readable); + +Duplex.prototype.write = Writable.prototype.write; +Duplex.prototype.end = Writable.prototype.end; +Duplex.prototype._write = Writable.prototype._write; + +function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) + this.readable = false; + + if (options && options.writable === false) + this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) + this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) + return; + + // no more data can be written. + // But allow more writes to happen in this tick. + var self = this; + setImmediate(function () { + self.end(); + }); +} + +},{"./readable.js":31,"./writable.js":33,"inherits":24,"process/browser.js":29}],28:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +module.exports = Stream; + +var EE = require('events').EventEmitter; +var inherits = require('inherits'); + +inherits(Stream, EE); +Stream.Readable = require('./readable.js'); +Stream.Writable = require('./writable.js'); +Stream.Duplex = require('./duplex.js'); +Stream.Transform = require('./transform.js'); +Stream.PassThrough = require('./passthrough.js'); + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; + + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); +} + +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } + + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } + + dest.on('drain', ondrain); + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); + } + + + function onclose() { + if (didOnEnd) return; + didOnEnd = true; + + if (typeof dest.destroy === 'function') dest.destroy(); + } + + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } + + source.on('error', onerror); + dest.on('error', onerror); + + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); + + source.removeListener('end', onend); + source.removeListener('close', onclose); + + source.removeListener('error', onerror); + dest.removeListener('error', onerror); + + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); + } + + source.on('end', cleanup); + source.on('close', cleanup); + + dest.on('close', cleanup); + + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; + +},{"./duplex.js":27,"./passthrough.js":30,"./readable.js":31,"./transform.js":32,"./writable.js":33,"events":23,"inherits":24}],29:[function(require,module,exports){ +module.exports=require(25) +},{}],30:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +module.exports = PassThrough; + +var Transform = require('./transform.js'); +var inherits = require('inherits'); +inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); +}; + +},{"./transform.js":32,"inherits":24}],31:[function(require,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +module.exports = Readable; +Readable.ReadableState = ReadableState; + +var EE = require('events').EventEmitter; +var Stream = require('./index.js'); +var Buffer = require('buffer').Buffer; +var setImmediate = require('process/browser.js').nextTick; +var StringDecoder; + +var inherits = require('inherits'); +inherits(Readable, Stream); + +function ReadableState(options, stream) { + options = options || {}; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.buffer = []; + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = false; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // In streams that never have any data, and do push(null) right away, + // the consumer can miss the 'end' event if they do some I/O before + // consuming the stream. So, we don't emit('end') until some reading + // happens. + this.calledRead = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, becuase any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require('string_decoder').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + if (!(this instanceof Readable)) + return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + + if (typeof chunk === 'string' && !state.objectMode) { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = new Buffer(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function(chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null || chunk === undefined) { + state.reading = false; + if (!state.ended) + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var e = new Error('stream.unshift() after end event'); + stream.emit('error', e); + } else { + if (state.decoder && !addToFront && !encoding) + chunk = state.decoder.write(chunk); + + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) { + state.buffer.unshift(chunk); + } else { + state.reading = false; + state.buffer.push(chunk); + } + + if (state.needReadable) + emitReadable(stream); + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + + + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && + (state.needReadable || + state.length < state.highWaterMark || + state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require('string_decoder').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; +}; + +// Don't raise the hwm > 128MB +var MAX_HWM = 0x800000; +function roundUpToNextPowerOf2(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 + n--; + for (var p = 1; p < 32; p <<= 1) n |= n >> p; + n++; + } + return n; +} + +function howMuchToRead(n, state) { + if (state.length === 0 && state.ended) + return 0; + + if (state.objectMode) + return n === 0 ? 0 : 1; + + if (isNaN(n) || n === null) { + // only flow one buffer at a time + if (state.flowing && state.buffer.length) + return state.buffer[0].length; + else + return state.length; + } + + if (n <= 0) + return 0; + + // If we're asking for more than the target buffer level, + // then raise the water mark. Bump up to the next highest + // power of 2, to prevent increasing it excessively in tiny + // amounts. + if (n > state.highWaterMark) + state.highWaterMark = roundUpToNextPowerOf2(n); + + // don't have that much. return null, unless we've ended. + if (n > state.length) { + if (!state.ended) { + state.needReadable = true; + return 0; + } else + return state.length; + } + + return n; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function(n) { + var state = this._readableState; + state.calledRead = true; + var nOrig = n; + + if (typeof n !== 'number' || n > 0) + state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && + state.needReadable && + (state.length >= state.highWaterMark || state.ended)) { + emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + + // if we currently have less than the highWaterMark, then also read some + if (state.length - n <= state.highWaterMark) + doRead = true; + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) + doRead = false; + + if (doRead) { + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) + state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + } + + // If _read called its callback synchronously, then `reading` + // will be false, and we need to re-evaluate how much data we + // can return to the user. + if (doRead && !state.reading) + n = howMuchToRead(nOrig, state); + + var ret; + if (n > 0) + ret = fromList(n, state); + else + ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } + + state.length -= n; + + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (state.length === 0 && !state.ended) + state.needReadable = true; + + // If we happened to read() exactly the remaining amount in the + // buffer, and the EOF has been seen at this point, then make sure + // that we emit 'end' on the very next tick. + if (state.ended && !state.endEmitted && state.length === 0) + endReadable(this); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && + !state.objectMode && + !er) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + + +function onEofChunk(stream, state) { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // if we've ended and we have some data left, then emit + // 'readable' now to make sure it gets picked up. + if (state.length > 0) + emitReadable(stream); + else + endReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (state.emittedReadable) + return; + + state.emittedReadable = true; + if (state.sync) + setImmediate(function() { + emitReadable_(stream); + }); + else + emitReadable_(stream); +} + +function emitReadable_(stream) { + stream.emit('readable'); +} + + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + setImmediate(function() { + maybeReadMore_(stream, state); + }); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && + state.length < state.highWaterMark) { + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + else + len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function(n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && + dest !== process.stdout && + dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) + setImmediate(endFn); + else + src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + if (readable !== src) return; + cleanup(); + } + + function onend() { + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + function cleanup() { + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (!dest._writableState || dest._writableState.needDrain) + ondrain(); + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + // check for listeners before emit removes one-time listeners. + var errListeners = EE.listenerCount(dest, 'error'); + function onerror(er) { + unpipe(); + if (errListeners === 0 && EE.listenerCount(dest, 'error') === 0) + dest.emit('error', er); + } + dest.once('error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + // the handler that waits for readable events after all + // the data gets sucked out in flow. + // This would be easier to follow with a .once() handler + // in flow(), but that is too slow. + this.on('readable', pipeOnReadable); + + state.flowing = true; + setImmediate(function() { + flow(src); + }); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function() { + var dest = this; + var state = src._readableState; + state.awaitDrain--; + if (state.awaitDrain === 0) + flow(src); + }; +} + +function flow(src) { + var state = src._readableState; + var chunk; + state.awaitDrain = 0; + + function write(dest, i, list) { + var written = dest.write(chunk); + if (false === written) { + state.awaitDrain++; + } + } + + while (state.pipesCount && null !== (chunk = src.read())) { + + if (state.pipesCount === 1) + write(state.pipes, 0, null); + else + forEach(state.pipes, write); + + src.emit('data', chunk); + + // if anyone needs a drain, then we have to wait for that. + if (state.awaitDrain > 0) + return; + } + + // if every destination was unpiped, either before entering this + // function, or in the while loop, then stop flowing. + // + // NB: This is a pretty rare edge case. + if (state.pipesCount === 0) { + state.flowing = false; + + // if there were data event listeners added, then switch to old mode. + if (EE.listenerCount(src, 'data') > 0) + emitDataEvents(src); + return; + } + + // at this point, no one needed a drain, so we just ran out of data + // on the next readable event, start it over again. + state.ranOut = true; +} + +function pipeOnReadable() { + if (this._readableState.ranOut) { + this._readableState.ranOut = false; + flow(this); + } +} + + +Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) + return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) + return this; + + if (!dest) + dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); + state.flowing = false; + if (dest) + dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); + state.flowing = false; + + for (var i = 0; i < len; i++) + dests[i].emit('unpipe', this); + return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) + return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data' && !this._readableState.flowing) + emitDataEvents(this); + + if (ev === 'readable' && this.readable) { + var state = this._readableState; + if (!state.readableListening) { + state.readableListening = true; + state.emittedReadable = false; + state.needReadable = true; + if (!state.reading) { + this.read(0); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function() { + emitDataEvents(this); + this.read(0); + this.emit('resume'); +}; + +Readable.prototype.pause = function() { + emitDataEvents(this, true); + this.emit('pause'); +}; + +function emitDataEvents(stream, startPaused) { + var state = stream._readableState; + + if (state.flowing) { + // https://github.com/isaacs/readable-stream/issues/16 + throw new Error('Cannot switch to old mode now.'); + } + + var paused = startPaused || false; + var readable = false; + + // convert to an old-style stream. + stream.readable = true; + stream.pipe = Stream.prototype.pipe; + stream.on = stream.addListener = Stream.prototype.on; + + stream.on('readable', function() { + readable = true; + + var c; + while (!paused && (null !== (c = stream.read()))) + stream.emit('data', c); + + if (c === null) { + readable = false; + stream._readableState.needReadable = true; + } + }); + + stream.pause = function() { + paused = true; + this.emit('pause'); + }; + + stream.resume = function() { + paused = false; + if (readable) + setImmediate(function() { + stream.emit('readable'); + }); + else + this.read(0); + this.emit('resume'); + }; + + // now make it start, just in case it hadn't already. + stream.emit('readable'); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function(stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function() { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function(chunk) { + if (state.decoder) + chunk = state.decoder.write(chunk); + if (!chunk || !state.objectMode && !chunk.length) + return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (typeof stream[i] === 'function' && + typeof this[i] === 'undefined') { + this[i] = function(method) { return function() { + return stream[method].apply(stream, arguments); + }}(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function(ev) { + stream.on(ev, function (x) { + return self.emit.apply(self, ev, x); + }); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function(n) { + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + + + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +function fromList(n, state) { + var list = state.buffer; + var length = state.length; + var stringMode = !!state.decoder; + var objectMode = !!state.objectMode; + var ret; + + // nothing in the list, definitely empty. + if (list.length === 0) + return null; + + if (length === 0) + ret = null; + else if (objectMode) + ret = list.shift(); + else if (!n || n >= length) { + // read it all, truncate the array. + if (stringMode) + ret = list.join(''); + else + ret = Buffer.concat(list, length); + list.length = 0; + } else { + // read just some of it. + if (n < list[0].length) { + // just take a part of the first list item. + // slice is the same for buffers and strings. + var buf = list[0]; + ret = buf.slice(0, n); + list[0] = buf.slice(n); + } else if (n === list[0].length) { + // first list is a perfect match + ret = list.shift(); + } else { + // complex case. + // we have enough to cover it, but it spans past the first buffer. + if (stringMode) + ret = ''; + else + ret = new Buffer(n); + + var c = 0; + for (var i = 0, l = list.length; i < l && c < n; i++) { + var buf = list[0]; + var cpy = Math.min(n - c, buf.length); + + if (stringMode) + ret += buf.slice(0, cpy); + else + buf.copy(ret, c, 0, cpy); + + if (cpy < buf.length) + list[0] = buf.slice(cpy); + else + list.shift(); + + c += cpy; + } + } + } + + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) + throw new Error('endReadable called on non-empty stream'); + + if (!state.endEmitted && state.calledRead) { + state.ended = true; + setImmediate(function() { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } + }); + } +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf (xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js")) +},{"./index.js":28,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"buffer":20,"events":23,"inherits":24,"process/browser.js":29,"string_decoder":34}],32:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +module.exports = Transform; + +var Duplex = require('./duplex.js'); +var inherits = require('inherits'); +inherits(Transform, Duplex); + + +function TransformState(options, stream) { + this.afterTransform = function(er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) + return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (data !== null && data !== undefined) + stream.push(data); + + if (cb) + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + + +function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + + Duplex.call(this, options); + + var ts = this._transformState = new TransformState(options, this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + this.once('finish', function() { + if ('function' === typeof this._flush) + this._flush(function(er) { + done(stream, er); + }); + else + done(stream); + }); +} + +Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function(chunk, encoding, cb) { + throw new Error('not implemented'); +}; + +Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || + rs.needReadable || + rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function(n) { + var ts = this._transformState; + + if (ts.writechunk && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + + +function done(stream, er) { + if (er) + return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var rs = stream._readableState; + var ts = stream._transformState; + + if (ws.length) + throw new Error('calling transform done when ws.length != 0'); + + if (ts.transforming) + throw new Error('calling transform done when still transforming'); + + return stream.push(null); +} + +},{"./duplex.js":27,"inherits":24}],33:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, cb), and it'll handle all +// the drain event emission and buffering. + +module.exports = Writable; +Writable.WritableState = WritableState; + +var isUint8Array = typeof Uint8Array !== 'undefined' + ? function (x) { return x instanceof Uint8Array } + : function (x) { + return x && x.constructor && x.constructor.name === 'Uint8Array' + } +; +var isArrayBuffer = typeof ArrayBuffer !== 'undefined' + ? function (x) { return x instanceof ArrayBuffer } + : function (x) { + return x && x.constructor && x.constructor.name === 'ArrayBuffer' + } +; + +var inherits = require('inherits'); +var Stream = require('./index.js'); +var setImmediate = require('process/browser.js').nextTick; +var Buffer = require('buffer').Buffer; + +inherits(Writable, Stream); + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; +} + +function WritableState(options, stream) { + options = options || {}; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, becuase any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function(er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.buffer = []; +} + +function Writable(options) { + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Stream.Duplex)) + return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function() { + this.emit('error', new Error('Cannot pipe. Not readable.')); +}; + + +function writeAfterEnd(stream, state, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + setImmediate(function() { + cb(er); + }); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && + !state.objectMode) { + var er = new TypeError('Invalid non-string/buffer chunk'); + stream.emit('error', er); + setImmediate(function() { + cb(er); + }); + valid = false; + } + return valid; +} + +Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (!Buffer.isBuffer(chunk) && isUint8Array(chunk)) + chunk = new Buffer(chunk); + if (isArrayBuffer(chunk) && typeof Uint8Array !== 'undefined') + chunk = new Buffer(new Uint8Array(chunk)); + + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + else if (!encoding) + encoding = state.defaultEncoding; + + if (typeof cb !== 'function') + cb = function() {}; + + if (state.ended) + writeAfterEnd(this, state, cb); + else if (validChunk(this, state, chunk, cb)) + ret = writeOrBuffer(this, state, chunk, encoding, cb); + + return ret; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && + state.decodeStrings !== false && + typeof chunk === 'string') { + chunk = new Buffer(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + state.needDrain = !ret; + + if (state.writing) + state.buffer.push(new WriteReq(chunk, encoding, cb)); + else + doWrite(stream, state, len, chunk, encoding, cb); + + return ret; +} + +function doWrite(stream, state, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + if (sync) + setImmediate(function() { + cb(er); + }); + else + cb(er); + + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) + onwriteError(stream, state, sync, er, cb); + else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(stream, state); + + if (!finished && !state.bufferProcessing && state.buffer.length) + clearBuffer(stream, state); + + if (sync) { + setImmediate(function() { + afterWrite(stream, state, finished, cb); + }); + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + cb(); + if (finished) + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + + for (var c = 0; c < state.buffer.length; c++) { + var entry = state.buffer[c]; + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, len, chunk, encoding, cb); + + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + c++; + break; + } + } + + state.bufferProcessing = false; + if (c < state.buffer.length) + state.buffer = state.buffer.slice(c); + else + state.buffer.length = 0; +} + +Writable.prototype._write = function(chunk, encoding, cb) { + cb(new Error('not implemented')); +}; + +Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (typeof chunk !== 'undefined' && chunk !== null) + this.write(chunk, encoding); + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) + endWritable(this, state, cb); +}; + + +function needFinish(stream, state) { + return (state.ending && + state.length === 0 && + !state.finished && + !state.writing); +} + +function finishMaybe(stream, state) { + var need = needFinish(stream, state); + if (need) { + state.finished = true; + stream.emit('finish'); + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + setImmediate(cb); + else + stream.once('finish', cb); + } + state.ended = true; +} + +},{"./index.js":28,"buffer":20,"inherits":24,"process/browser.js":29}],34:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +var Buffer = require('buffer').Buffer; + +function assertEncoding(encoding) { + if (encoding && !Buffer.isEncoding(encoding)) { + throw new Error('Unknown encoding: ' + encoding); + } +} + +var StringDecoder = exports.StringDecoder = function(encoding) { + this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); + assertEncoding(encoding); + switch (this.encoding) { + case 'utf8': + // CESU-8 represents each of Surrogate Pair by 3-bytes + this.surrogateSize = 3; + break; + case 'ucs2': + case 'utf16le': + // UTF-16 represents each of Surrogate Pair by 2-bytes + this.surrogateSize = 2; + this.detectIncompleteChar = utf16DetectIncompleteChar; + break; + case 'base64': + // Base-64 stores 3 bytes in 4 chars, and pads the remainder. + this.surrogateSize = 3; + this.detectIncompleteChar = base64DetectIncompleteChar; + break; + default: + this.write = passThroughWrite; + return; + } + + this.charBuffer = new Buffer(6); + this.charReceived = 0; + this.charLength = 0; +}; + + +StringDecoder.prototype.write = function(buffer) { + var charStr = ''; + var offset = 0; + + // if our last write ended with an incomplete multibyte character + while (this.charLength) { + // determine how many remaining bytes this buffer has to offer for this char + var i = (buffer.length >= this.charLength - this.charReceived) ? + this.charLength - this.charReceived : + buffer.length; + + // add the new bytes to the char buffer + buffer.copy(this.charBuffer, this.charReceived, offset, i); + this.charReceived += (i - offset); + offset = i; + + if (this.charReceived < this.charLength) { + // still not enough chars in this buffer? wait for more ... + return ''; + } + + // get the character that was split + charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); + + // lead surrogate (D800-DBFF) is also the incomplete character + var charCode = charStr.charCodeAt(charStr.length - 1); + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + this.charLength += this.surrogateSize; + charStr = ''; + continue; + } + this.charReceived = this.charLength = 0; + + // if there are no more bytes in this buffer, just emit our char + if (i == buffer.length) return charStr; + + // otherwise cut off the characters end from the beginning of this buffer + buffer = buffer.slice(i, buffer.length); + break; + } + + var lenIncomplete = this.detectIncompleteChar(buffer); + + var end = buffer.length; + if (this.charLength) { + // buffer the incomplete character bytes we got + buffer.copy(this.charBuffer, 0, buffer.length - lenIncomplete, end); + this.charReceived = lenIncomplete; + end -= lenIncomplete; + } + + charStr += buffer.toString(this.encoding, 0, end); + + var end = charStr.length - 1; + var charCode = charStr.charCodeAt(end); + // lead surrogate (D800-DBFF) is also the incomplete character + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + var size = this.surrogateSize; + this.charLength += size; + this.charReceived += size; + this.charBuffer.copy(this.charBuffer, size, 0, size); + this.charBuffer.write(charStr.charAt(charStr.length - 1), this.encoding); + return charStr.substring(0, end); + } + + // or just emit the charStr + return charStr; +}; + +StringDecoder.prototype.detectIncompleteChar = function(buffer) { + // determine how many bytes we have to check at the end of this buffer + var i = (buffer.length >= 3) ? 3 : buffer.length; + + // Figure out if one of the last i bytes of our buffer announces an + // incomplete char. + for (; i > 0; i--) { + var c = buffer[buffer.length - i]; + + // See http://en.wikipedia.org/wiki/UTF-8#Description + + // 110XXXXX + if (i == 1 && c >> 5 == 0x06) { + this.charLength = 2; + break; + } + + // 1110XXXX + if (i <= 2 && c >> 4 == 0x0E) { + this.charLength = 3; + break; + } + + // 11110XXX + if (i <= 3 && c >> 3 == 0x1E) { + this.charLength = 4; + break; + } + } + + return i; +}; + +StringDecoder.prototype.end = function(buffer) { + var res = ''; + if (buffer && buffer.length) + res = this.write(buffer); + + if (this.charReceived) { + var cr = this.charReceived; + var buf = this.charBuffer; + var enc = this.encoding; + res += buf.slice(0, cr).toString(enc); + } + + return res; +}; + +function passThroughWrite(buffer) { + return buffer.toString(this.encoding); +} + +function utf16DetectIncompleteChar(buffer) { + var incomplete = this.charReceived = buffer.length % 2; + this.charLength = incomplete ? 2 : 0; + return incomplete; +} + +function base64DetectIncompleteChar(buffer) { + var incomplete = this.charReceived = buffer.length % 3; + this.charLength = incomplete ? 3 : 0; + return incomplete; +} + +},{"buffer":20}],35:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],36:[function(require,module,exports){ +(function (process,global){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + + +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + + if (process.noDeprecation === true) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +}; + + +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; + + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = require('./support/isBuffer'); + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = require('inherits'); + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +}).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":35,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":25,"inherits":24}]},{},[18]) \ No newline at end of file diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/index.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/index.js new file mode 100644 index 00000000..881eb61b --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/index.js @@ -0,0 +1,145 @@ +module.exports = decodeTorrentFile +module.exports.decode = decodeTorrentFile +module.exports.encode = encodeTorrentFile + +var bencode = require('bencode') +var path = require('path') +var sha1 = require('simple-sha1') + +/** + * Parse a torrent. Throws an exception if the torrent is missing required fields. + * @param {Buffer|Object} torrent + * @return {Object} parsed torrent + */ +function decodeTorrentFile (torrent) { + if (Buffer.isBuffer(torrent)) { + torrent = bencode.decode(torrent) + } + + // sanity check + ensure(torrent.info, 'info') + ensure(torrent.info.name, 'info.name') + ensure(torrent.info['piece length'], 'info[\'piece length\']') + ensure(torrent.info.pieces, 'info.pieces') + + if (torrent.info.files) { + torrent.info.files.forEach(function (file) { + ensure(typeof file.length === 'number', 'info.files[0].length') + ensure(file.path, 'info.files[0].path') + }) + } else { + ensure(typeof torrent.info.length === 'number', 'info.length') + } + + var result = {} + result.info = torrent.info + result.infoBuffer = bencode.encode(torrent.info) + result.infoHash = sha1.sync(result.infoBuffer) + + result.name = torrent.info.name.toString() + result.private = !!torrent.info.private + + if (torrent['creation date']) result.created = new Date(torrent['creation date'] * 1000) + + if (Buffer.isBuffer(torrent.comment)) result.comment = torrent.comment.toString() + + // announce/announce-list may be missing if metadata fetched via ut_metadata extension + var announce = torrent['announce-list'] + if (!announce) { + if (torrent.announce) { + announce = [[torrent.announce]] + } else { + announce = [] + } + } + + result.announceList = announce.map(function (urls) { + return urls.map(function (url) { + return url.toString() + }) + }) + + result.announce = [].concat.apply([], result.announceList) + + // handle url-list (BEP19 / web seeding) + if (Buffer.isBuffer(torrent['url-list'])) { + // some clients set url-list to empty string + torrent['url-list'] = torrent['url-list'].length > 0 + ? [ torrent['url-list'] ] + : [] + } + result.urlList = (torrent['url-list'] || []).map(function (url) { + return url.toString() + }) + + var files = torrent.info.files || [torrent.info] + result.files = files.map(function (file, i) { + var parts = [].concat(file.name || result.name, file.path || []).map(function (p) { + return p.toString() + }) + return { + path: path.join.apply(null, [path.sep].concat(parts)).slice(1), + name: parts[parts.length - 1], + length: file.length, + offset: files.slice(0, i).reduce(sumLength, 0) + } + }) + + result.length = files.reduce(sumLength, 0) + + var lastFile = result.files[result.files.length - 1] + + result.pieceLength = torrent.info['piece length'] + result.lastPieceLength = ((lastFile.offset + lastFile.length) % result.pieceLength) || result.pieceLength + result.pieces = splitPieces(torrent.info.pieces) + + return result +} + +/** + * Convert a parsed torrent object back into a .torrent file buffer. + * @param {Object} parsed parsed torrent + * @return {Buffer} + */ +function encodeTorrentFile (parsed) { + var torrent = { + info: parsed.info + } + + if (parsed.announce && parsed.announce[0]) { + torrent.announce = parsed.announce[0] + } + + if (parsed.announceList) { + torrent['announce-list'] = parsed.announceList.map(function (urls) { + return urls.map(function (url) { + url = new Buffer(url, 'utf8') + if (!torrent.announce) { + torrent.announce = url + } + return url + }) + }) + } + + if (parsed.created) { + torrent['creation date'] = (parsed.created.getTime() / 1000) | 0 + } + return bencode.encode(torrent) +} + +function sumLength (sum, file) { + return sum + file.length +} + +function splitPieces (buf) { + var pieces = [] + for (var i = 0; i < buf.length; i += 20) { + pieces.push(buf.slice(i, i + 20).toString('hex')) + } + return pieces +} + +function ensure (bool, fieldName) { + if (!bool) throw new Error('Torrent is missing required field: ' + fieldName) +} diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/.travis.yml b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/.travis.yml new file mode 100644 index 00000000..fca8ef01 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.10 + - 0.11 diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/AUTHORS b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/AUTHORS new file mode 100644 index 00000000..1a1ceb2b --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/AUTHORS @@ -0,0 +1,2 @@ +Mark Schmale +Jonas Hermsmeier \ No newline at end of file diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/CHANGES.md b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/CHANGES.md new file mode 100644 index 00000000..bd2c8a3a --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/CHANGES.md @@ -0,0 +1,33 @@ +## Upcoming + + - decode() now throws if it encounters invalid input + +## 0.4.3 + * improved performance a lot + * dropped support for de- and encoding floats to respect the spec + + *note:* node-bencode will still decodes stuff like "i42.23e" but will cast the + result to an interger + +## 0.4.2 + * bugfix: sort dictionary keys to follow the spec + +## 0.4.1 + * bugfix: number decoding was kinda broken + +## 0.4.0 + * fixed problems with multibyte strings + * some performance improvements + * improved code quality + +## 0.3.0 + * #decode() accepts a encoding as its second paramtere + +## 0.2.0 + * complete rewrite, @jhermsmeier joins the team + +## 0.1.0 + * added encoding + +## 0.0.1 +First version, decoding only diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/CONTRIBUTORS b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/CONTRIBUTORS new file mode 100644 index 00000000..687529d3 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/CONTRIBUTORS @@ -0,0 +1,5 @@ +# Just a plain list of people who contributed to this project. +# People who are already listed in AUTHORS are not listed again. + +Conrad Pankoff +Patrick Williams diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/LICENSE.md b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/LICENSE.md new file mode 100644 index 00000000..451cea44 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/LICENSE.md @@ -0,0 +1,23 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2010 Mark Schmale + +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. \ No newline at end of file diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/Makefile b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/Makefile new file mode 100644 index 00000000..2e242dd9 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/Makefile @@ -0,0 +1,21 @@ + +.PHONY: all test benchmark + +browserify: bencode.js lib/*.js + mkdir -p dist + browserify bencode.js -s bencode -o dist/bencode.js + +# TODO: thats not how it should behave! +browser-test: bencode.js lib/*.js test/*.js + mkdir -p dist + browserify test/*.test.js -o dist/tests.js + echo "" > dist/test.html + # open dist/test.html in your browser now + +test: + npm test + +benchmark: + npm run-script bench + +all: browserify test diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/README.md b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/README.md new file mode 100644 index 00000000..5bbcd8f0 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/README.md @@ -0,0 +1,155 @@ +# Bencode +[![npm](http://img.shields.io/npm/v/bencode.svg?style=flat)](https://npmjs.com/bencode) +[![npm downloads](http://img.shields.io/npm/dm/bencode.svg?style=flat)](https://npmjs.com/bencode) +[![build status](http://img.shields.io/travis/themasch/node-bencode.svg?style=flat)](https://travis-ci.org/themasch/node-bencode) + +A node library for encoding and decoding bencoded data, +according to the [BitTorrent specification](http://www.bittorrent.org/beps/bep_0003.html). + +## Index + +- [About BEncoding](#about-bencoding) +- [Installation](#install-with-npm) +- [Performance](#performance) +- [Usage](#usage) +- [API](#api) + +## About BEncoding + +from [Wikipedia](https://en.wikipedia.org/wiki/Bencoding): + +Bencode (pronounced like B encode) is the encoding used by the peer-to-peer +file sharing system BitTorrent for storing and transmitting loosely structured data. + +It supports four different types of values: +- byte strings +- integers +- lists +- dictionaries + +Bencoding is most commonly used in torrent files. +These metadata files are simply bencoded dictionaries. + +## Install with [npm](http://npmjs.org) + +``` +npm install bencode +``` + +## Performance + +### encode +``` +19,235 op/s » bencode + 9,684 op/s » bencoding +11,988 op/s » dht_bencode + 8,946 op/s » bncode +18,744 op/s » dht +``` + +### decode +``` +33,786 op/s » bencode +55,040 op/s » bencoding +40,872 op/s » dht_bencode + 2,533 op/s » bncode +30,292 op/s » dht +``` + +*Benchmarks run on an 1.8 GHz Intel Core i5 with io.js 1.0.4* + +To run the benchmarks simply use + +``` +npm run bench +``` + +## Usage + +```javascript +var bencode = require( 'bencode' ) +``` + +You can also use node-bencode with browserify to be able to use it in a lot of modern browsers. + +[![testling results](https://ci.testling.com/themasch/node-bencode.png)](https://ci.testling.com/themasch/node-bencode) + +### Encoding + +```javascript + +var data = { + string: 'Hello World', + integer: 12345, + dict: { + key: 'This is a string within a dictionary' + }, + list: [ 1, 2, 3, 4, 'string', 5, {} ] +} + +var result = bencode.encode( data ) + +``` + +#### Output + +``` +d4:dictd3:key36:This is a string within a dictionarye7:integeri12345e4:listli1ei2ei3ei4e6:stringi5edee6:string11:Hello Worlde +``` + +### Decoding + +```javascript +var data = new Buffer( 'd6:string11:Hello World7:integeri12345e4:dictd3:key36:This is a string within a dictionarye4:litli1ei2ei3ei4e6:stringi5edeee' ) +var result = bencode.decode( data ) +``` + +#### Output + +```javascript +{ + string: , + integer: 12345, + dict: { + key: + }, + list: [ 1, 2, 3, 4, , 5, {} ] +} +``` + +Automagically convert bytestrings to strings: + +```javascript +var result = bencode.decode( data, 'utf8' ) +``` + +#### Output + +```javascript +{ + string: 'Hello World', + integer: 12345, + dict: { + key: 'This is a string within a dictionary' + }, + list: [ 1, 2, 3, 4, 'string', 5, {} ] +} +``` + +## API + +### bencode.encode( *data* ) + +> `Buffer` | `Array` | `String` | `Object` | `Number` __data__ + +Returns `Buffer` + +### bencode.decode( *data*, *encoding* ) + +> `Buffer` __data__ +> `String` __encoding__ + +If `encoding` is set, bytestrings are +automatically converted to strings. + +Returns `Object` | `Array` | `Buffer` | `String` | `Number` diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/buffer-vs-string.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/buffer-vs-string.js new file mode 100644 index 00000000..090777b2 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/buffer-vs-string.js @@ -0,0 +1,12 @@ +var bencode = require('../') +var buf = require('fs').readFileSync(__dirname + '/test.torrent'); +var str = buf.toString('ascii'); + +suite('buffer vs string', function() { + bench('buffer', function() { + bencode.decode(buf); + }) + bench('string', function() { + bencode.decode(str); + }) +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/decode.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/decode.js new file mode 100644 index 00000000..54e75e4a --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/decode.js @@ -0,0 +1,44 @@ +var fs = require( 'fs' ) + +var bencode = require( '../' ) +var bencoding = require( 'bencoding' ) +var dht_bencode = require( 'dht-bencode' ) +var bncode = require( 'bncode' ) +var dht = require( 'dht.js/lib/dht/bencode' ) + +var buffer = fs.readFileSync( __dirname + '/test.torrent' ) + +suite('decode to buffer', function() { + bench('bencode', function() { + bencode.decode( buffer ) + }) + bench('bencoding', function() { + var v = bencoding.decode( buffer ) + }) + bench('dht_bencode', function() { + dht_bencode.bdecode( buffer ) + }) + bench('bncode', function() { + bncode.decode( buffer ) + }) + bench('dht', function() { + dht.decode( buffer ) + }) +}) + +suite('decode to utf8', function() { + bench('bencode', function() { + bencode.decode( buffer, 'utf8' ) + }) +}) +suite('decode to ascii', function() { + bench('bencode', function() { + bencode.decode( buffer, 'ascii' ) + }) +}) +suite('decode to binary', function() { + bench('bencode', function() { + bencode.decode( buffer, 'ascii' ) + }) +}) + diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/encode.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/encode.js new file mode 100644 index 00000000..95a3aac2 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/encode.js @@ -0,0 +1,83 @@ +var fs = require( 'fs' ) + +var bencode = require( '../' ) +var bencoding = require( 'bencoding' ) +var dht_bencode = require( 'dht-bencode' ) +var bncode = require( 'bncode' ) +var dht = require( 'dht.js/lib/dht/bencode' ) + +var buffer = fs.readFileSync( __dirname + '/test.torrent' ) +var object = bencode.decode( buffer ) +var object_utf8 = bencode.decode( buffer, 'utf8' ) +var object_ascii = bencode.decode( buffer, 'ascii' ) +var object_binary = bencode.decode( buffer, 'binary' ) + +suite('encode buffer', function() { + bench('bencode', function() { + bencode.encode( object ) + }) + bench('bencoding', function() { + bencoding.encode( object ) + }) + bench('dht_bencode', function() { + dht_bencode.bencode( object ) + }) + bench('bncode', function() { + bncode.encode( object ) + }) + bench('dht', function() { + dht.encode( object ) + }) +}) + +suite('encode utf8', function() { + bench('bencode', function() { + bencode.encode( object_utf8 ) + }) + bench('bencoding', function() { + bencoding.encode( object_utf8 ) + }) + bench('dht_bencode', function() { + dht_bencode.bencode( object_utf8 ) + }) + bench('bncode', function() { + bncode.encode( object_utf8 ) + }) + bench('dht', function() { + dht.encode( object_utf8 ) + }) +}) +suite('encode ascii', function() { + bench('bencode', function() { + bencode.encode( object_ascii ) + }) + bench('bencoding', function() { + bencoding.encode( object_ascii ) + }) + bench('dht_bencode', function() { + dht_bencode.bencode( object_ascii ) + }) + bench('bncode', function() { + bncode.encode( object_ascii ) + }) + bench('dht', function() { + dht.encode( object_ascii ) + }) +}) +suite('encode binary', function() { + bench('bencode', function() { + bencode.encode( object_binary ) + }) + bench('bencoding', function() { + bencoding.encode( object_binary ) + }) + bench('dht_bencode', function() { + dht_bencode.bencode( object_binary ) + }) + bench('bncode', function() { + bncode.encode( object_binary ) + }) + bench('dht', function() { + dht.encode( object_binary ) + }) +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/test.torrent b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/test.torrent new file mode 100644 index 00000000..8d128c12 Binary files /dev/null and b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/benchmark/test.torrent differ diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/bencode.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/bencode.js new file mode 100644 index 00000000..7dafb4ba --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/bencode.js @@ -0,0 +1,4 @@ +module.exports = { + encode: require( './lib/encode' ), + decode: require( './lib/decode' ) +} diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/decode.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/decode.js new file mode 100644 index 00000000..5dde6c31 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/decode.js @@ -0,0 +1,116 @@ +var Dict = require("./dict") + +/** + * Decodes bencoded data. + * + * @param {Buffer} data + * @param {String} encoding + * @return {Object|Array|Buffer|String|Number} + */ +function decode( data, encoding ) { + + decode.position = 0 + decode.encoding = encoding || null + + decode.data = !( Buffer.isBuffer(data) ) + ? new Buffer( data ) + : data + + return decode.next() + +} + +decode.position = 0 +decode.data = null +decode.encoding = null + +decode.next = function() { + + switch( decode.data[decode.position] ) { + case 0x64: return decode.dictionary(); break + case 0x6C: return decode.list(); break + case 0x69: return decode.integer(); break + default: return decode.bytes(); break + } + +} + +decode.find = function( chr ) { + + var i = decode.position + var c = decode.data.length + var d = decode.data + + while( i < c ) { + if( d[i] === chr ) + return i + i++ + } + + throw new Error( + 'Invalid data: Missing delimiter "' + + String.fromCharCode( chr ) + '" [0x' + + chr.toString( 16 ) + ']' + ) + +} + +decode.dictionary = function() { + + decode.position++ + + var dict = new Dict() + + while( decode.data[decode.position] !== 0x65 ) { + dict.binarySet(decode.bytes(), decode.next()) + } + + decode.position++ + + return dict + +} + +decode.list = function() { + + decode.position++ + + var lst = [] + + while( decode.data[decode.position] !== 0x65 ) { + lst.push( decode.next() ) + } + + decode.position++ + + return lst + +} + +decode.integer = function() { + + var end = decode.find( 0x65 ) + var number = decode.data.toString( 'ascii', decode.position + 1, end ) + + decode.position += end + 1 - decode.position + + return parseInt( number, 10 ) + +} + +decode.bytes = function() { + + var sep = decode.find( 0x3A ) + var length = parseInt( decode.data.toString( 'ascii', decode.position, sep ), 10 ) + var end = ++sep + length + + decode.position = end + + return decode.encoding + ? decode.data.toString( decode.encoding, sep, end ) + : decode.data.slice( sep, end ) + +} + +// Exports +module.exports = decode diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/dict.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/dict.js new file mode 100644 index 00000000..5aea2e8a --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/dict.js @@ -0,0 +1,16 @@ +var Dict = module.exports = function Dict() { + Object.defineProperty(this, "_keys", { + enumerable: false, + value: [], + }) +} + +Dict.prototype.binaryKeys = function binaryKeys() { + return this._keys.slice() +} + +Dict.prototype.binarySet = function binarySet(key, value) { + this._keys.push(key) + + this[key] = value +} diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/encode.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/encode.js new file mode 100644 index 00000000..2cb2eea0 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/encode.js @@ -0,0 +1,101 @@ +/** + * Encodes data in bencode. + * + * @param {Buffer|Array|String|Object|Number} data + * @return {Buffer} + */ +function encode( data ) { + var buffers = [] + encode._encode( buffers, data ) + return Buffer.concat( buffers ) +} + +encode._floatConversionDetected = false + +encode._encode = function( buffers, data ) { + + if( Buffer.isBuffer(data) ) { + buffers.push(new Buffer(data.length + ':')) + buffers.push(data) + return; + } + + switch( typeof data ) { + case 'string': + encode.bytes( buffers, data ) + break + case 'number': + encode.number( buffers, data ) + break + case 'object': + data.constructor === Array + ? encode.list( buffers, data ) + : encode.dict( buffers, data ) + break + } + +} + +var buff_e = new Buffer('e') + , buff_d = new Buffer('d') + , buff_l = new Buffer('l') + +encode.bytes = function( buffers, data ) { + + buffers.push( new Buffer(Buffer.byteLength( data ) + ':' + data) ) +} + +encode.number = function( buffers, data ) { + var maxLo = 0x80000000 + var hi = ( data / maxLo ) << 0 + var lo = ( data % maxLo ) << 0 + var val = hi * maxLo + lo + + buffers.push( new Buffer( 'i' + val + 'e' )) + + if( val !== data && !encode._floatConversionDetected ) { + encode._floatConversionDetected = true + console.warn( + 'WARNING: Possible data corruption detected with value "'+data+'":', + 'Bencoding only defines support for integers, value was converted to "'+val+'"' + ) + console.trace() + } + +} + +encode.dict = function( buffers, data ) { + + buffers.push( buff_d ) + + var j = 0 + var k + // fix for issue #13 - sorted dicts + var keys = Object.keys( data ).sort() + var kl = keys.length + + for( ; j < kl ; j++) { + k=keys[j] + encode.bytes( buffers, k ) + encode._encode( buffers, data[k] ) + } + + buffers.push( buff_e ) +} + +encode.list = function( buffers, data ) { + + var i = 0, j = 1 + var c = data.length + buffers.push( buff_l ) + + for( ; i < c; i++ ) { + encode._encode( buffers, data[i] ) + } + + buffers.push( buff_e ) + +} + +// Expose +module.exports = encode diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/package.json b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/package.json new file mode 100644 index 00000000..5844e715 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/package.json @@ -0,0 +1,86 @@ +{ + "name": "bencode", + "version": "0.7.0", + "license": "MIT", + "description": "Bencode de/encoder", + "keywords": [ + "torrent", + "bittorrent", + "bencode", + "bdecode", + "bencoding" + ], + "contributors": [ + { + "name": "Mark Schmale", + "email": "masch@masch.it", + "url": "http://masch.it/" + }, + { + "name": "Jonas Hermsmeier", + "email": "jonas@hojoki.com" + } + ], + "main": "bencode.js", + "devDependencies": { + "bencoding": "latest", + "bncode": "latest", + "dht-bencode": "latest", + "dht.js": "latest", + "matcha": "~0.6.0", + "tap-spec": "~2.2.0", + "tape": "~3.5.0" + }, + "scripts": { + "test": "node node_modules/.bin/tape test/*.test.js | node node_modules/.bin/tap-spec", + "bench": "node node_modules/.bin/matcha benchmark/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/themasch/node-bencode.git" + }, + "bugs": { + "url": "https://github.com/themasch/node-bencode/issues" + }, + "testling": { + "files": "test/*.test.js", + "browsers": [ + "ie/6..latest", + "chrome/22..latest", + "firefox/16..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6..latest", + "ipad/6..latest", + "android-browser/latest" + ] + }, + "gitHead": "2b3548b98e3f74efe16dec1436f82debf5ccc22b", + "homepage": "https://github.com/themasch/node-bencode", + "_id": "bencode@0.7.0", + "_shasum": "811ed647c0118945e41bb4bbbdea9a2c78a17083", + "_from": "bencode@>=0.7.0 <0.8.0", + "_npmVersion": "2.4.1", + "_nodeVersion": "1.0.4", + "_npmUser": { + "name": "jhermsmeier", + "email": "jhermsmeier@gmail.com" + }, + "maintainers": [ + { + "name": "masch", + "email": "ma.schmale@googlemail.com" + }, + { + "name": "jhermsmeier", + "email": "jhermsmeier@gmail.com" + } + ], + "dist": { + "shasum": "811ed647c0118945e41bb4bbbdea9a2c78a17083", + "tarball": "http://registry.npmjs.org/bencode/-/bencode-0.7.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bencode/-/bencode-0.7.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/data.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/data.js new file mode 100644 index 00000000..cc11c847 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/data.js @@ -0,0 +1,7 @@ +module.exports = { + //binKeyData: new Buffer("ZDU6ZmlsZXNkMjA6N7VVuuCjmp5LoM+n15a5iM/XJHdkODpjb21wbGV0ZWkwZTEwOmRvd25sb2FkZWRpMTBlMTA6aW5jb21wbGV0ZWkwZWVlZQ==", 'base64') + binKeyData: new Buffer('ZDU6ZmlsZXNkMzY6N++/vVXvv73go5rvv71L77+9z6fXlu+/ve+/ve+/ve+/vSR3ZDg6Y29tcGxldGVpMGUxMDpkb3dubG9hZGVkaTEwZTEwOmluY29tcGxldGVpMGVlZWU=', 'base64') + , binKeyName: new Buffer("N++/vVXvv73go5rvv71L77+9z6fXlu+/ve+/ve+/ve+/vSR3", 'base64') + , binStringData: new Buffer('w7bCsXNkZg==', 'base64') + , binResultData: new Buffer('NzrDtsKxc2Rm', 'base64') +} diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/decode.buffer.test.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/decode.buffer.test.js new file mode 100644 index 00000000..d308e468 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/decode.buffer.test.js @@ -0,0 +1,85 @@ +var test = require('tape').test +var bencode = require('./lib.js') +var data = require('./data.js') + +test("bencode#decode(x)", function(t) { + + t.test('should be able to decode an integer', function(t) { + t.plan(2) + t.equal(bencode.decode('i123e'), 123); + t.equal(bencode.decode('i-123e'), -123); + }) + + t.test('should be able to decode a float (as int)', function(t) { + t.plan(2) + t.equal(bencode.decode('i12.3e'), 12); + t.equal(bencode.decode('i-12.3e'), -12); + }) + + t.test('should be able to decode a string', function(t) { + t.plan(2) + t.deepEqual(bencode.decode('5:asdfe'), new Buffer('asdfe')); + t.deepEqual(bencode.decode(data.binResultData.toString()), data.binStringData); + }) + + t.test('should be able to decode "binary keys"', function(t) { + t.plan(1) + t.ok(bencode.decode(data.binKeyData).files.hasOwnProperty(data.binKeyName)); + }) + + t.test('should be able to decode a dictionary', function(t) { + t.plan(3) + t.deepEqual( + bencode.decode( 'd3:cow3:moo4:spam4:eggse' ), + { + cow: new Buffer('moo'), + spam: new Buffer('eggs') + } + ) + t.deepEqual( + bencode.decode( 'd4:spaml1:a1:bee' ), + { spam: [ + new Buffer('a'), + new Buffer('b') + ] } + ) + t.deepEqual( + bencode.decode( 'd9:publisher3:bob17:publisher-webpage15:www.example.com18:publisher.location4:homee'), + { + 'publisher': new Buffer('bob'), + 'publisher-webpage': new Buffer('www.example.com'), + 'publisher.location': new Buffer('home') + } + ) + }); + + t.test('should be able to decode a list', function(t) { + t.plan(1) + t.deepEqual( + bencode.decode( 'l4:spam4:eggse'), + [ new Buffer('spam'), + new Buffer('eggs') ] + ) + }) + t.test('should return the correct type', function(t) { + t.plan(1) + t.ok(Buffer.isBuffer(bencode.decode('4:öö'))); + }) + t.test('should be able to decode stuff in dicts (issue #12)', function(t) { + t.plan(4) + var someData = { + string: 'Hello World', + integer: 12345, + dict: { + key: 'This is a string within a dictionary' + }, + list: [ 1, 2, 3, 4, 'string', 5, {} ] + } + var result = bencode.encode( someData ) + var dat = bencode.decode ( result ) + t.equal(dat.integer, 12345) + t.deepEqual(dat.string, new Buffer("Hello World")) + t.deepEqual(dat.dict.key, new Buffer("This is a string within a dictionary")) + t.deepEqual(dat.list, [1, 2, 3, 4, new Buffer('string'), 5, {}]) + }) +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/decode.utf8.test.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/decode.utf8.test.js new file mode 100644 index 00000000..bb50ab66 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/decode.utf8.test.js @@ -0,0 +1,79 @@ +var test = require('tape').test +var bencode = require('./lib.js') +var data = require('./data.js') + +test("bencode#decode(x, 'uft8')", function(t) { + t.test('should be able to decode an integer', function(t) { + t.plan(2) + t.equal(bencode.decode('i123e', 'utf8'), 123) + t.equal(bencode.decode('i-123e', 'utf8'), -123) + }) + t.test('should be able to decode a float (as int)', function(t) { + t.plan(2) + t.equal(bencode.decode('i12.3e', 'utf8'), 12) + t.equal(bencode.decode('i-12.3e', 'utf8'), -12) + }) + t.test('should be able to decode a string', function(t) { + t.plan(2) + t.equal(bencode.decode('5:asdfe', 'utf8'), 'asdfe') + t.deepEqual(bencode.decode(data.binResultData.toString(), 'utf8'), data.binStringData.toString()); + }) + t.test('should be able to decode "binary keys"', function(t) { + t.plan(1) + var decoded = bencode.decode(data.binKeyData, 'utf8') + t.ok(decoded.files.hasOwnProperty(data.binKeyName.toString('utf8'))) + }) + + t.test('should be able to decode a dictionary', function(t) { + t.plan(3) + t.deepEqual( + bencode.decode( 'd3:cow3:moo4:spam4:eggse', 'utf8' ), + { + cow: 'moo', + spam: 'eggs' + } + ) + t.deepEqual( + bencode.decode( 'd4:spaml1:a1:bee', 'utf8' ), + { spam: [ 'a', 'b' ] } + ) + t.deepEqual( + bencode.decode( 'd9:publisher3:bob17:publisher-webpage15:www.example.com18:publisher.location4:homee', 'utf8' ), + { + 'publisher': 'bob', + 'publisher-webpage': 'www.example.com', + 'publisher.location': 'home' + } + ) + }) + + t.test('should be able to decode a list', function(t) { + t.plan(1) + t.deepEqual( + bencode.decode( 'l4:spam4:eggse', 'utf8' ), + [ 'spam', 'eggs' ] + ) + }) + t.test('should return the correct type', function(t) { + t.plan(1) + t.ok(typeof(bencode.decode('4:öö', 'utf8')) === 'string') + }) + + t.test('should be able to decode stuff in dicts (issue #12)', function(t) { + t.plan(4) + var someData = { + string: 'Hello World', + integer: 12345, + dict: { + key: 'This is a string within a dictionary' + }, + list: [ 1, 2, 3, 4, 'string', 5, {} ] + } + var result = bencode.encode( someData ) + var dat = bencode.decode ( result, 'utf8' ) + t.equal(dat.integer, 12345) + t.deepEqual(dat.string, "Hello World") + t.deepEqual(dat.dict.key, "This is a string within a dictionary") + t.deepEqual(dat.list, [1, 2, 3, 4, 'string', 5, {}]) + }) +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/encode.test.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/encode.test.js new file mode 100644 index 00000000..3fd3e5da --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/encode.test.js @@ -0,0 +1,119 @@ +var test = require('tape').test +var bencode = require('./lib.js') +var data = require('./data.js') + +test('bencode#encode()', function(t) { + + // prevent the warning showing up in the test + bencode.encode._floatConversionDetected = true + + t.test('should always return a Buffer', function(t) { + t.plan(5) + t.ok(Buffer.isBuffer(bencode.encode({})), "its a buffer for empty dicts") + t.ok(Buffer.isBuffer(bencode.encode("test")), "its a buffer for strings") + t.ok(Buffer.isBuffer(bencode.encode([3, 2])), "its a buffer for lists") + t.ok(Buffer.isBuffer(bencode.encode({"a": "b", 3: 6})), "its a buffer for big dicts") + t.ok(Buffer.isBuffer(bencode.encode(123)), "its a buffer for numbers") + }) + + t.test('should sort dictionaries', function(t) { + t.plan(1) + var data = { string: 'Hello World', integer: 12345 } + t.equal(bencode.encode(data).toString(), "d7:integeri12345e6:string11:Hello Worlde") + }) + + t.test('should force keys to be strings', function(t) { + t.plan(1) + var data = { + 12: 'Hello World', + 34: 12345, + } + t.equal(bencode.encode(data).toString(), "d2:1211:Hello World2:34i12345ee") + }) + + t.test('should be able to encode a positive integer', function(t) { + t.plan(1) + t.equal(bencode.encode(123).toString(), 'i123e') + }) + t.test('should be able to encode a negative integer', function(t) { + t.plan(1) + t.equal(bencode.encode(-123).toString(), 'i-123e') + }) + t.test('should be able to encode a positive float (as int)', function(t) { + t.plan(1) + t.equal(bencode.encode(123.5).toString(), 'i123e') + }) + t.test('should be able to encode a negative float (as int)', function(t) { + t.plan(1) + t.equal(bencode.encode(-123.5).toString(), 'i-123e') + }) + + t.test('should be able to safely encode numbers between -/+ 2 ^ 53 (as ints)', function(t) { + var JAVASCRIPT_INT_BITS = 53 + var MAX_JAVASCRIPT_INT = Math.pow(2, JAVASCRIPT_INT_BITS) + + t.plan((JAVASCRIPT_INT_BITS-1) * 6 + 3) + t.equal(bencode.encode(0).toString(), 'i' + 0 + 'e') + + for (var exp = 1; exp < JAVASCRIPT_INT_BITS; ++exp) { + var val = Math.pow(2, exp) + // try the positive and negative + t.equal(bencode.encode(val).toString(), 'i' + val + 'e') + t.equal(bencode.encode(-val).toString(), 'i-' + val + 'e') + + // try the value, one above and one below, both positive and negative + var above = val + 1 + var below = val - 1 + + t.equal(bencode.encode(above).toString(), 'i' + above + 'e') + t.equal(bencode.encode(-above).toString(), 'i-' + above + 'e') + + t.equal(bencode.encode(below).toString(), 'i' + below + 'e') + t.equal(bencode.encode(-below).toString(), 'i-' + below + 'e') + } + t.equal(bencode.encode(MAX_JAVASCRIPT_INT).toString(), 'i' + MAX_JAVASCRIPT_INT + 'e') + t.equal(bencode.encode(-MAX_JAVASCRIPT_INT).toString(), 'i-' + MAX_JAVASCRIPT_INT + 'e') + }) + t.test('should be able to encode a previously problematice 64 bit int', function(t) { + t.plan(1) + t.equal(bencode.encode(2433088826).toString(), 'i' + 2433088826 + 'e') + }) + t.test('should be able to encode a negative 64 bit int', function(t) { + t.plan(1) + t.equal(bencode.encode(-0xffffffff).toString(), 'i-' + 0xffffffff + 'e') + }) + t.test('should be able to encode a positive 64 bit float (as int)', function(t) { + t.plan(1) + t.equal(bencode.encode(0xffffffff + 0.5).toString(), 'i' + 0xffffffff + 'e') + }) + t.test('should be able to encode a negative 64 bit float (as int)', function(t) { + t.plan(1) + t.equal(bencode.encode(-0xffffffff - 0.5).toString(), 'i-' + 0xffffffff + 'e') + }) + t.test('should be able to encode a string', function(t) { + t.plan(2) + t.equal(bencode.encode("asdf").toString(), '4:asdf') + t.equal(bencode.encode(":asdf:").toString(), '6::asdf:') + }) + t.test('should be able to encode a unicode string', function(t) { + t.plan(2) + t.deepEqual(bencode.encode(data.binStringData.toString()), data.binResultData) + t.deepEqual(bencode.encode(data.binStringData.toString()), data.binResultData) + }) + t.test('should be able to encode a buffer', function(t) { + t.plan(2) + t.equal(bencode.encode(new Buffer("asdf")).toString(), '4:asdf') + t.equal(bencode.encode(new Buffer(":asdf:")).toString(), '6::asdf:') + }) + t.test('should be able to encode an array', function(t) { + t.plan(2) + t.equal(bencode.encode([32, 12]).toString(), 'li32ei12ee') + t.equal(bencode.encode([":asdf:"]).toString(), 'l6::asdf:e') + }) + t.test('should be able to encode an object', function(t) { + t.plan(3) + t.equal(bencode.encode({"a": "bc"}).toString(), 'd1:a2:bce') + t.equal(bencode.encode({"a": "45", "b": 45}).toString(), 'd1:a2:451:bi45ee') + t.equal(bencode.encode({"a": new Buffer("bc")}).toString(), 'd1:a2:bce') + }) +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/lib.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/lib.js new file mode 100644 index 00000000..fb9e342d --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/lib.js @@ -0,0 +1,3 @@ +module.exports = require('../bencode.js'); +//module.exports.decode = module.exports.bdecode +//module.exports.encode = module.exports.bencode diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/mocha.opts b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/mocha.opts new file mode 100644 index 00000000..5ada47be --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/mocha.opts @@ -0,0 +1 @@ +--reporter spec diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/specifications.md b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/specifications.md new file mode 100644 index 00000000..39050c6c --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/bencode/test/specifications.md @@ -0,0 +1,8 @@ +_Strings_ are length-prefixed base ten followed by a colon and the string. For example 4:spam corresponds to 'spam'. + +_Integers_ are represented by an 'i' followed by the number in base 10 followed by an 'e'. For example i3e corresponds to 3 and i-3e corresponds to -3. Integers have no size limitation. i-0e is invalid. All encodings with a leading zero, such as i03e, are invalid, other than i0e, which of course corresponds to 0. + +_Lists_ are encoded as an 'l' followed by their elements (also bencoded) followed by an 'e'. For example l4:spam4:eggse corresponds to ['spam', 'eggs']. + +_Dictionaries_ are encoded as a 'd' followed by a list of alternating keys and their corresponding values followed by an 'e'. For example, d3:cow3:moo4:spam4:eggse corresponds to {'cow': 'moo', 'spam': 'eggs'} and d4:spaml1:a1:bee corresponds to {'spam': ['a', 'b']}. +Keys must be strings and appear in sorted order (sorted as raw strings, not alphanumerics). diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/.npmignore b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/.travis.yml b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/.travis.yml new file mode 100644 index 00000000..e571000c --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - '0.10' +env: + global: + - secure: gKa38FGijv9dNyCgNsbG4+iyAOKlkYFGTln8zvOlSa3x5rOf+skyuO91bv/CQ3NPCjVXZXXhOje2OqH1lwn3XpaFUpAwfL587waUkYdDndPCd6BCGU6IGEduEzaj5A5IbClDkOxKgZaKj9Uk12rVu+ye/DTVvZTIqz9//ZFkD50= + - secure: Gwpl/9A3NO2ehKxpgMqSd9YVPoNLMzjIBWfnUYfPxk0cbJbqCkGFaAr3DaZVgtOqnLQr6e3MWGudX8bNK0hfA3WLi6x7vBNw8Rt2180kl+YXTcQ+YKyeCvDmYchSvQIEgrY3q4Gz+43uGOW/xva7waH+LM8WqOp6n1uyUwIuddU= diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/.zuul.yml b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/.zuul.yml new file mode 100644 index 00000000..e5a96832 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/.zuul.yml @@ -0,0 +1,18 @@ +ui: tape +browsers: + - name: chrome + version: 37..latest + - name: firefox + version: 32..latest + - name: safari + version: 6..latest + - name: ie + version: 10 + - name: opera + version: 12..latest + - name: iphone + version: 7.1..latest + - name: ipad + version: 7.1..latest + - name: android + version: 4.4..latest diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/benchmark.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/benchmark.js new file mode 100644 index 00000000..e0599f59 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/benchmark.js @@ -0,0 +1,40 @@ +var benchmark = require('benchmark') +var gitsha1 = require('git-sha1') +var sha1 = require('./') + +var size = Math.pow(2, 24) +var buffer = new Buffer(size) + +benchmark.Suite() + .add('sha1', function () { + sha1(buffer, function () {}) + }) + .add('sha1.sync', function () { + sha1.sync(buffer) + }) + .add('git-sha1', function () { + gitsha1(buffer) + }) + .on('error', error) + .on('cycle', cycle) + .on('complete', complete) + .run({ async: true }) + +function error (e) { + console.error(e.target.error.stack) +} + +function cycle (e) { + console.log(String(e.target)) +} + +function complete () { + if (process.browser) { + var crypto = window.crypto || window.msCrypto || {} + var subtle = crypto.subtle || crypto.webkitSubtle + try { subtle.digest({ name: 'sha-1'}, new Uint8Array) } + catch (err) { subtle = false } + if (subtle) console.log('sha1 used WebCryptoAPI') + } + console.log('Fastest is ' + this.filter('fastest').pluck('name')) +} diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/browser.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/browser.js new file mode 100644 index 00000000..3fce4ffe --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/browser.js @@ -0,0 +1,57 @@ +var Rusha = require('rusha') + +var rusha = new Rusha +var crypto = window.crypto || window.msCrypto || {} +var subtle = crypto.subtle || crypto.webkitSubtle +var sha1sync = rusha.digest.bind(rusha) + +// Browsers throw if they lack support for an algorithm. +// Promise will be rejected on non-secure origins. (http://goo.gl/lq4gCo) +try { + subtle.digest({ name: 'sha-1' }, new Uint8Array).catch(function () { + subtle = false + }) +} catch (err) { subtle = false } + +function sha1 (buf, cb) { + if (!subtle) { + // Use Rusha + setTimeout(cb, 0, sha1sync(buf)) + return + } + + if (typeof buf === 'string') { + buf = uint8array(buf) + } + + subtle.digest({ name: 'sha-1' }, buf) + .then(function succeed (result) { + cb(hex(new Uint8Array(result))) + }, + function fail (error) { + cb(sha1sync(buf)) + }) +} + +function uint8array (s) { + var l = s.length + var array = new Uint8Array(l) + for (var i = 0; i < l; i++) { + array[i] = s.charCodeAt(i) + } + return array +} + +function hex (buf) { + var l = buf.length + var chars = [] + for (var i = 0; i < l; i++) { + var bite = buf[i] + chars.push((bite >>> 4).toString(16)) + chars.push((bite & 0x0f).toString(16)) + } + return chars.join('') +} + +module.exports = sha1 +module.exports.sync = sha1sync diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/example.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/example.js new file mode 100644 index 00000000..d6eda2a9 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/example.js @@ -0,0 +1,15 @@ +var sha1 = require('./') + +// Because the WebCryptoAPI uses Promises (shudder), +// you have to pass a callback if you want to take +// advantage of its mad-sick performance. + +sha1('hey there', function (hash) { + console.log('async:', hash) +}) + +// However, if you don’t mind always using Rusha in +// the browser, you can just call sha1.sync and be +// done with it. + +console.log('sync:', sha1.sync('hey there')) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/index.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/index.js new file mode 100644 index 00000000..8bc4ff8e --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/index.js @@ -0,0 +1,17 @@ +var crypto = require('crypto') + +function sha1 (buf, cb) { + var hash = sha1sync(buf) + process.nextTick(function () { + cb(hash) + }) +} + +function sha1sync (buf) { + return crypto.createHash('sha1') + .update(buf) + .digest('hex') +} + +module.exports = sha1 +module.exports.sync = sha1sync diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/.npmignore b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/.npmignore new file mode 100644 index 00000000..fa3f9348 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/.npmignore @@ -0,0 +1,5 @@ +examples +rusha.pp.js +component.json +node_modules +Makefile diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/.travis.yml b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/.travis.yml new file mode 100644 index 00000000..18ae2d89 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.11" + - "0.10" diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/Gruntfile.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/Gruntfile.js new file mode 100644 index 00000000..bc0e5444 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/Gruntfile.js @@ -0,0 +1,69 @@ +module.exports = function (grunt) { + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + sweetjs: { + options: { + readableNames: true + }, + build: { + src: '<%= pkg.name %>.sweet.js', + dest: '<%= pkg.name %>.js' + }, + }, + uglify: { + options: { + banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' + }, + build: { + src: '<%= pkg.name %>.js', + dest: '<%= pkg.name %>.min.js' + } + }, + mochaTest: { + test: { + options: { + reporter: 'spec', + require: 'coverage/blanket' + }, + src: ['test/test.js'], + }, + coverage: { + options: { + reporter: 'html-cov', + quiet: true, + captureFile: 'coverage/report.html' + }, + src: ['test/test.js'] + } + }, + connect: { server: { options: { base: "", port: 9999 } } }, + 'saucelabs-mocha': { + all: { + options: { + username: 'rusha', + urls: ['http://127.0.0.1:9999/test/test.html'], + build: process.env.CI_BUILD_NUMBER, + testname: 'Sauce Unit Test for Rusha', + browsers: [ + ["Windows 8", "firefox", 32], + ["Windows 8", "chrome", 37] + ] + } + } + } + }); + + grunt.loadNpmTasks('grunt-sweet.js'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-mocha-test'); + grunt.loadNpmTasks('grunt-contrib-connect'); + grunt.loadNpmTasks('grunt-saucelabs'); + + grunt.registerTask('test', ['sweetjs', 'mochaTest']); + + grunt.registerTask('test-saucelabs', ['sweetjs', 'connect', 'saucelabs-mocha']); + + grunt.registerTask('build', ['sweetjs', 'uglify']); + +}; \ No newline at end of file diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/LICENSE b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/LICENSE new file mode 100644 index 00000000..6fb72139 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-2014 Sam Rijs + +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/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/README.md b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/README.md new file mode 100644 index 00000000..d54c6823 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/README.md @@ -0,0 +1,69 @@ +# Rusha [![Build Status](https://travis-ci.org/srijs/rusha.png?branch=master)](https://travis-ci.org/srijs/rusha) +*A high-performance pure-javascript SHA1 implementation suitable for large binary data.* + +[![NPM](https://nodei.co/npm/rusha.png?downloads=true&downloadRank=true)](https://nodei.co/npm/rusha/) + +## Prologue: The Sad State of Javascript SHA1 implementations + +When we started experimenting with alternative upload technologies at [doctape](http://doctape.com) that required creating SHA1 hashes of the data locally on the client, it quickly became obvious that there were no performant pure-js implementations of SHA1 that worked correctly on binary data. + +Jeff Mott's [CryptoJS](http://code.google.com/p/crypto-js/) and Brian Turek's [jsSHA](http://caligatio.github.com/jsSHA/) were both hash functions that worked correctly on ASCII strings of a small size, but didn't scale to large data and/or didn't work correctly with binary data. + +(On a sidenode, as of now Tim Caswell's [Cifre](http://github.com/openpeer/cifre) actually works with large binary data, as opposed to previously statet.) + +By modifying Paul Johnston's [sha1.js](http://pajhome.org.uk/crypt/md5/sha1.html) slightly, it worked correctly on binary data but was unfortunately very slow, especially on V8. So a few days were invested on my side to implement a Johnston-inspired SHA1 hashing function with a heavy focus on performance. + +The result of this process is Rusha, a SHA1 hash function that works flawlessly on large amounts binary data, such as binary strings or ArrayBuffers returned by the HTML5 File API, and leverages the soon-to-be-landed-in-firefox [asm.js](http://asmjs.org/spec/latest/) with whose support its within *half of native speed*! + +## Installing + +### Node.JS + +There is really no point in doing this, since Node.JS already has a wonderful `crypto` module that is leveraging low-level hardware instructions to perform really nice. Your can see the comparison below in the benchmarks. + +Rusha is available on [npm](http://npmjs.org/) via `npm install rusha`. + +If you still want to do this, anyhow, just `require()` the `rusha.js` file, follow the instructions on _Using the Rusha Object_. + +### Browser + +Rusha is available on [bower](http://twitter.github.com/bower/) via `bower install rusha`. + +It is highly recommended to run CPU-intensive tasks in a [Web Worker](http://developer.mozilla.org/en-US/docs/DOM/Using_web_workers). To do so, just start a worker with `var worker = new Worker('rusha.js')` and start sending it jobs. Follow the instructions on _Using the Rusha Worker_. + +If you can't, for any reason, use Web Workers, include the `rusha.js` file in a ` + + + + diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/test/test.html b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/test/test.html new file mode 100644 index 00000000..6ffbdab8 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/test/test.html @@ -0,0 +1,41 @@ + + + + Mocha Tests + + + +
+ + + + + + + \ No newline at end of file diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/test/test.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/test/test.js new file mode 100644 index 00000000..8d53e8d1 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/node_modules/rusha/test/test.js @@ -0,0 +1,93 @@ +(function () { + 'use strict'; + + var assert, Rusha; + + if (typeof require === 'function') { + assert = require('assert'); + Rusha = require('../rusha.js'); + } else { + assert = {strictEqual: function (a, b) { if (a !== b) throw new Error('unequal'); }} + Rusha = window.Rusha; + } + + function assertBytesEqual(buffer1, buffer2) { + var v1 = new Int8Array(buffer1); + var v2 = new Int8Array(buffer2); + assert.strictEqual(v1.length, v2.length, 'Buffers do not have the same length'); + for (var i = 0; i < v1.length; i++) { + assert.strictEqual(v1[i], v2[i], 'Item at ' + i + ' differs: ' + v1[i] + ' vs ' + v2[i]); + } + } + + var r = new Rusha(); + + var abcString = 'abc'; + var abcBuffer; + var abcArray = [97, 98, 99]; + var abcArrayBuffer = new Int8Array(abcArray).buffer; + + if (typeof Buffer === 'function') { + abcBuffer = new Buffer('abc', 'ascii'); + } else { + abcBuffer = new Int8Array(abcArray); + } + + var abcHashedInt32Array = new Int32Array(new Int8Array([0xA9, 0x99, 0x3E, 0x36, 0x47, 0x06, 0x81, 0x6A, 0xBA, 0x3E, 0x25, 0x71, 0x78, 0x50, 0xC2, 0x6C, 0x9C, 0xD0, 0xD8, 0x9D]).buffer); + + describe('Rusha', function() { + describe('digest', function() { + it('returns hex string from string', function() { + assert.strictEqual('a9993e364706816aba3e25717850c26c9cd0d89d', r.digest(abcString)); + }); + it('returns hex string from buffer', function() { + assert.strictEqual('a9993e364706816aba3e25717850c26c9cd0d89d', r.digest(abcBuffer)); + }); + it('returns hex string from array', function() { + assert.strictEqual('a9993e364706816aba3e25717850c26c9cd0d89d', r.digest(abcArray)); + }); + it('returns hex string from ArrayBuffer', function() { + assert.strictEqual('a9993e364706816aba3e25717850c26c9cd0d89d', r.digest(abcArrayBuffer)); + }); + }); + + describe('digestFromString', function() { + it('returns hex string from string', function() { + assert.strictEqual('a9993e364706816aba3e25717850c26c9cd0d89d', r.digestFromString(abcString)); + }); + }); + + describe('digestFromBuffer', function() { + it('returns hex string from buffer', function() { + assert.strictEqual('a9993e364706816aba3e25717850c26c9cd0d89d', r.digest(abcBuffer)); + }); + it('returns hex string from array', function() { + assert.strictEqual('a9993e364706816aba3e25717850c26c9cd0d89d', r.digest(abcArray)); + }); + }); + + describe('digestFromArrayBuffer', function() { + it('returns hex string from ArrayBuffer', function() { + assert.strictEqual('a9993e364706816aba3e25717850c26c9cd0d89d', r.digest(abcArrayBuffer)); + }); + }); + + describe('rawDigest', function() { + it('returns a sliced Int32Array', function() { + assert.strictEqual(20, r.rawDigest(abcString).buffer.byteLength); + }); + it('returns Int32Array from string', function() { + assertBytesEqual(abcHashedInt32Array, r.rawDigest(abcString)); + }); + it('returns Int32Array from buffer', function() { + assertBytesEqual(abcHashedInt32Array, r.rawDigest(abcBuffer)); + }); + it('returns Int32Array from array', function() { + assertBytesEqual(abcHashedInt32Array, r.rawDigest(abcArray)); + }); + it('returns Int32Array from ArrayBuffer', function() { + assertBytesEqual(abcHashedInt32Array, r.rawDigest(abcArrayBuffer)); + }); + }); + }); +})(); diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/package.json b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/package.json new file mode 100644 index 00000000..2722a213 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/package.json @@ -0,0 +1,67 @@ +{ + "name": "simple-sha1", + "version": "2.0.7", + "description": "A simple api for generating sha1 hashes in node and the browser.", + "main": "index.js", + "browser": "browser.js", + "scripts": { + "test": "npm run test-node && npm run test-browser", + "test-local": "npm run test-node && npm run test-browser-local", + "test-node": "tape test/*.js", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "example": "beefy example.js", + "benchmark": "beefy benchmark.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:michaelrhodes/simple-sha1.git" + }, + "keywords": [ + "sha1", + "rusha", + "browser", + "node", + "browserify" + ], + "author": { + "name": "Michael Rhodes" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/michaelrhodes/simple-sha1/issues" + }, + "homepage": "https://github.com/michaelrhodes/simple-sha1", + "dependencies": { + "rusha": "^0.8.1" + }, + "devDependencies": { + "beefy": "^2.1.1", + "benchmark": "^1.0.0", + "git-sha1": "^0.1.2", + "tape": "^3.0.3", + "zuul": "^1.16.3" + }, + "gitHead": "f1f8b048f427a2ee7b598001324e8afd99ebb811", + "_id": "simple-sha1@2.0.7", + "_shasum": "765ef3f6a9ef4bf9b734e973cbd63a7a82f887b6", + "_from": "simple-sha1@>=2.0.0 <3.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "michaelrhodes", + "email": "spam@michaelrhod.es" + }, + "maintainers": [ + { + "name": "michaelrhodes", + "email": "spam@michaelrhod.es" + } + ], + "dist": { + "shasum": "765ef3f6a9ef4bf9b734e973cbd63a7a82f887b6", + "tarball": "http://registry.npmjs.org/simple-sha1/-/simple-sha1-2.0.7.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/simple-sha1/-/simple-sha1-2.0.7.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/readme.md b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/readme.md new file mode 100644 index 00000000..79e7eee3 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/readme.md @@ -0,0 +1,35 @@ +# simple-sha1 +simple-sha1 wraps three fast SHA1 implementations, and exposes a simple api for generating hashes in node ([crypto](http://nodejs.org/api/crypto.html)) and the browser ([WebCryptoAPI](http://www.w3.org/TR/WebCryptoAPI/) || [Rusha](https://github.com/srijs/rusha)). + +[![Build status](https://travis-ci.org/michaelrhodes/simple-sha1.png?branch=master)](https://travis-ci.org/michaelrhodes/simple-sha1) + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/simple-sha1.svg)](https://saucelabs.com/u/simple-sha1) + +## install +```sh +$ npm install simple-sha1 +``` + +## example +```js +var sha1 = require('simple-sha1') + +// Because the WebCryptoAPI uses Promises (shudder), +// you have to pass a callback if you want to take +// advantage of its mad-sick performance. + +sha1('hey there', function (hash) { + console.log(hash) + > 6b1c01703b68cf9b35ab049385900b5c428651b6 +}) + +// However, if you don’t mind always using Rusha in +// the browser, you can just call sha1.sync and be +// done with it. + +console.log(sha1.sync('hey there')) +> 6b1c01703b68cf9b35ab049385900b5c428651b6 +``` + +## license +[MIT](http://opensource.org/licenses/MIT) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/test/basic.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/test/basic.js new file mode 100644 index 00000000..50f5b556 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/node_modules/simple-sha1/test/basic.js @@ -0,0 +1,22 @@ +var sha1 = require('../') +var test = require('tape') + +test('sha1', function (t) { + t.plan(2) + // buffer + sha1(new Buffer('hey there'), function (hash) { + t.equal(hash, '6b1c01703b68cf9b35ab049385900b5c428651b6') + }) + // string + sha1('hey there', function (hash) { + t.equal(hash, '6b1c01703b68cf9b35ab049385900b5c428651b6') + }) +}) + +test('sha1.sync', function (t) { + // buffer + t.equal(sha1.sync(new Buffer('hey there')), '6b1c01703b68cf9b35ab049385900b5c428651b6') + // string + t.equal(sha1.sync('hey there'), '6b1c01703b68cf9b35ab049385900b5c428651b6') + t.end() +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/package.json b/node_modules/parse-torrent/node_modules/parse-torrent-file/package.json new file mode 100644 index 00000000..6d421fef --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/package.json @@ -0,0 +1,75 @@ +{ + "name": "parse-torrent-file", + "description": "Parse a .torrent file and return an object of keys/values", + "version": "2.1.4", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bin": { + "parse-torrent-file": "./bin/cmd.js" + }, + "bugs": { + "url": "https://github.com/feross/parse-torrent-file/issues" + }, + "dependencies": { + "bencode": "^0.7.0", + "simple-sha1": "^2.0.0" + }, + "devDependencies": { + "brfs": "^1.0.0", + "standard": "^3.3.0", + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "https://github.com/feross/parse-torrent-file", + "keywords": [ + "torrent", + "parse torrent", + "read torrent", + ".torrent", + "peer-to-peer", + "bittorrent", + "bittorrent", + "webtorrent" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/parse-torrent-file.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "testling": { + "files": "test/*.js" + }, + "gitHead": "835ae4aad6ae7ad56496725db3904da608b5b3ef", + "_id": "parse-torrent-file@2.1.4", + "_shasum": "32d4b6afde631420e5f415919a222b774b575707", + "_from": "parse-torrent-file@>=2.0.0 <3.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "32d4b6afde631420e5f415919a222b774b575707", + "tarball": "http://registry.npmjs.org/parse-torrent-file/-/parse-torrent-file-2.1.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/parse-torrent-file/-/parse-torrent-file-2.1.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/basic.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/basic.js new file mode 100644 index 00000000..36c5f559 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/basic.js @@ -0,0 +1,361 @@ +var bencode = require('bencode') +var fs = require('fs') +var parseTorrent = require('../') +var test = require('tape') + +var leaves = fs.readFileSync(__dirname + '/torrents/leaves.torrent') +var leavesMagnet = fs.readFileSync(__dirname + '/torrents/leaves-magnet.torrent') +var pride = fs.readFileSync(__dirname + '/torrents/pride.torrent') + +var leavesParsed = { + infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + name: 'Leaves of Grass by Walt Whitman.epub', + private: false, + created: new Date('Thu Aug 01 2013 06:27:46 GMT-0700 (PDT)'), + announce: [ + 'http://tracker.thepiratebay.org/announce', + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.ccc.de:80', + 'udp://tracker.publicbt.com:80', + 'udp://fr33domtracker.h33t.com:3310/announce', + 'http://tracker.bittorrent.am/announce' + ], + announceList: [ + ['http://tracker.thepiratebay.org/announce'], + ['udp://tracker.openbittorrent.com:80'], + ['udp://tracker.ccc.de:80'], + ['udp://tracker.publicbt.com:80'], + ['udp://fr33domtracker.h33t.com:3310/announce', 'http://tracker.bittorrent.am/announce'] + ], + comment: 'Downloaded from http://TheTorrent.org', + urlList: [], + files: [ + { + path: 'Leaves of Grass by Walt Whitman.epub', + name: 'Leaves of Grass by Walt Whitman.epub', + length: 362017, + offset: 0 + } + ], + length: 362017, + pieceLength: 16384, + lastPieceLength: 1569, + pieces: [ + '1f9c3f59beec079715ec53324bde8569e4a0b4eb', + 'ec42307d4ce5557b5d3964c5ef55d354cf4a6ecc', + '7bf1bcaf79d11fa5e0be06593c8faafc0c2ba2cf', + '76d71c5b01526b23007f9e9929beafc5151e6511', + '0931a1b44c21bf1e68b9138f90495e690dbc55f5', + '72e4c2944cbacf26e6b3ae8a7229d88aafa05f61', + 'eaae6abf3f07cb6db9677cc6aded4dd3985e4586', + '27567fa7639f065f71b18954304aca6366729e0b', + '4773d77ae80caa96a524804dfe4b9bd3deaef999', + 'c9dd51027467519d5eb2561ae2cc01467de5f643', + '0a60bcba24797692efa8770d23df0a830d91cb35', + 'b3407a88baa0590dc8c9aa6a120f274367dcd867', + 'e88e8338c572a06e3c801b29f519df532b3e76f6', + '70cf6aee53107f3d39378483f69cf80fa568b1ea', + 'c53b506159e988d8bc16922d125d77d803d652c3', + 'ca3070c16eed9172ab506d20e522ea3f1ab674b3', + 'f923d76fe8f44ff32e372c3b376564c6fb5f0dbe', + '52164f03629fd1322636babb2c014b7dae582da4', + '1363965261e6ce12b43701f0a8c9ed1520a70eba', + '004400a267765f6d3dd5c7beb5bd3c75f3df2a54', + '560a61801147fa4ec7cf568e703acb04e5610a4d', + '56dcc242d03293e9446cf5e457d8eb3d9588fd90', + 'c698de9b0dad92980906c026d8c1408fa08fe4ec' + ], + info: { + length: 362017, + name: new Buffer('TGVhdmVzIG9mIEdyYXNzIGJ5IFdhbHQgV2hpdG1hbi5lcHVi', 'base64'), + 'piece length': 16384, + pieces: new Buffer('H5w/Wb7sB5cV7FMyS96FaeSgtOvsQjB9TOVVe105ZMXvVdNUz0puzHvxvK950R+l4L4GWTyPqvwMK6LPdtccWwFSayMAf56ZKb6vxRUeZREJMaG0TCG/Hmi5E4+QSV5pDbxV9XLkwpRMus8m5rOuinIp2IqvoF9h6q5qvz8Hy225Z3zGre1N05heRYYnVn+nY58GX3GxiVQwSspjZnKeC0dz13roDKqWpSSATf5Lm9PervmZyd1RAnRnUZ1eslYa4swBRn3l9kMKYLy6JHl2ku+odw0j3wqDDZHLNbNAeoi6oFkNyMmqahIPJ0Nn3Nhn6I6DOMVyoG48gBsp9RnfUys+dvZwz2ruUxB/PTk3hIP2nPgPpWix6sU7UGFZ6YjYvBaSLRJdd9gD1lLDyjBwwW7tkXKrUG0g5SLqPxq2dLP5I9dv6PRP8y43LDs3ZWTG+18NvlIWTwNin9EyJja6uywBS32uWC2kE2OWUmHmzhK0NwHwqMntFSCnDroARACiZ3ZfbT3Vx761vTx1898qVFYKYYARR/pOx89WjnA6ywTlYQpNVtzCQtAyk+lEbPXkV9jrPZWI/ZDGmN6bDa2SmAkGwCbYwUCPoI/k7A==', 'base64') + }, + infoBuffer: new Buffer('ZDY6bGVuZ3RoaTM2MjAxN2U0Om5hbWUzNjpMZWF2ZXMgb2YgR3Jhc3MgYnkgV2FsdCBXaGl0bWFuLmVwdWIxMjpwaWVjZSBsZW5ndGhpMTYzODRlNjpwaWVjZXM0NjA6H5w/Wb7sB5cV7FMyS96FaeSgtOvsQjB9TOVVe105ZMXvVdNUz0puzHvxvK950R+l4L4GWTyPqvwMK6LPdtccWwFSayMAf56ZKb6vxRUeZREJMaG0TCG/Hmi5E4+QSV5pDbxV9XLkwpRMus8m5rOuinIp2IqvoF9h6q5qvz8Hy225Z3zGre1N05heRYYnVn+nY58GX3GxiVQwSspjZnKeC0dz13roDKqWpSSATf5Lm9PervmZyd1RAnRnUZ1eslYa4swBRn3l9kMKYLy6JHl2ku+odw0j3wqDDZHLNbNAeoi6oFkNyMmqahIPJ0Nn3Nhn6I6DOMVyoG48gBsp9RnfUys+dvZwz2ruUxB/PTk3hIP2nPgPpWix6sU7UGFZ6YjYvBaSLRJdd9gD1lLDyjBwwW7tkXKrUG0g5SLqPxq2dLP5I9dv6PRP8y43LDs3ZWTG+18NvlIWTwNin9EyJja6uywBS32uWC2kE2OWUmHmzhK0NwHwqMntFSCnDroARACiZ3ZfbT3Vx761vTx1898qVFYKYYARR/pOx89WjnA6ywTlYQpNVtzCQtAyk+lEbPXkV9jrPZWI/ZDGmN6bDa2SmAkGwCbYwUCPoI/k7GU=', 'base64') +} + +var leavesMagnetParsed = { + infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + name: 'Leaves of Grass by Walt Whitman.epub', + private: false, + announce: [], + announceList: [], + urlList: [], + files: [ + { + path: 'Leaves of Grass by Walt Whitman.epub', + name: 'Leaves of Grass by Walt Whitman.epub', + length: 362017, + offset: 0 + } + ], + length: 362017, + pieceLength: 16384, + lastPieceLength: 1569, + pieces: [ + '1f9c3f59beec079715ec53324bde8569e4a0b4eb', + 'ec42307d4ce5557b5d3964c5ef55d354cf4a6ecc', + '7bf1bcaf79d11fa5e0be06593c8faafc0c2ba2cf', + '76d71c5b01526b23007f9e9929beafc5151e6511', + '0931a1b44c21bf1e68b9138f90495e690dbc55f5', + '72e4c2944cbacf26e6b3ae8a7229d88aafa05f61', + 'eaae6abf3f07cb6db9677cc6aded4dd3985e4586', + '27567fa7639f065f71b18954304aca6366729e0b', + '4773d77ae80caa96a524804dfe4b9bd3deaef999', + 'c9dd51027467519d5eb2561ae2cc01467de5f643', + '0a60bcba24797692efa8770d23df0a830d91cb35', + 'b3407a88baa0590dc8c9aa6a120f274367dcd867', + 'e88e8338c572a06e3c801b29f519df532b3e76f6', + '70cf6aee53107f3d39378483f69cf80fa568b1ea', + 'c53b506159e988d8bc16922d125d77d803d652c3', + 'ca3070c16eed9172ab506d20e522ea3f1ab674b3', + 'f923d76fe8f44ff32e372c3b376564c6fb5f0dbe', + '52164f03629fd1322636babb2c014b7dae582da4', + '1363965261e6ce12b43701f0a8c9ed1520a70eba', + '004400a267765f6d3dd5c7beb5bd3c75f3df2a54', + '560a61801147fa4ec7cf568e703acb04e5610a4d', + '56dcc242d03293e9446cf5e457d8eb3d9588fd90', + 'c698de9b0dad92980906c026d8c1408fa08fe4ec' + ], + info: { + length: 362017, + name: new Buffer('TGVhdmVzIG9mIEdyYXNzIGJ5IFdhbHQgV2hpdG1hbi5lcHVi', 'base64'), + 'piece length': 16384, + pieces: new Buffer('H5w/Wb7sB5cV7FMyS96FaeSgtOvsQjB9TOVVe105ZMXvVdNUz0puzHvxvK950R+l4L4GWTyPqvwMK6LPdtccWwFSayMAf56ZKb6vxRUeZREJMaG0TCG/Hmi5E4+QSV5pDbxV9XLkwpRMus8m5rOuinIp2IqvoF9h6q5qvz8Hy225Z3zGre1N05heRYYnVn+nY58GX3GxiVQwSspjZnKeC0dz13roDKqWpSSATf5Lm9PervmZyd1RAnRnUZ1eslYa4swBRn3l9kMKYLy6JHl2ku+odw0j3wqDDZHLNbNAeoi6oFkNyMmqahIPJ0Nn3Nhn6I6DOMVyoG48gBsp9RnfUys+dvZwz2ruUxB/PTk3hIP2nPgPpWix6sU7UGFZ6YjYvBaSLRJdd9gD1lLDyjBwwW7tkXKrUG0g5SLqPxq2dLP5I9dv6PRP8y43LDs3ZWTG+18NvlIWTwNin9EyJja6uywBS32uWC2kE2OWUmHmzhK0NwHwqMntFSCnDroARACiZ3ZfbT3Vx761vTx1898qVFYKYYARR/pOx89WjnA6ywTlYQpNVtzCQtAyk+lEbPXkV9jrPZWI/ZDGmN6bDa2SmAkGwCbYwUCPoI/k7A==', 'base64') + }, + infoBuffer: new Buffer('ZDY6bGVuZ3RoaTM2MjAxN2U0Om5hbWUzNjpMZWF2ZXMgb2YgR3Jhc3MgYnkgV2FsdCBXaGl0bWFuLmVwdWIxMjpwaWVjZSBsZW5ndGhpMTYzODRlNjpwaWVjZXM0NjA6H5w/Wb7sB5cV7FMyS96FaeSgtOvsQjB9TOVVe105ZMXvVdNUz0puzHvxvK950R+l4L4GWTyPqvwMK6LPdtccWwFSayMAf56ZKb6vxRUeZREJMaG0TCG/Hmi5E4+QSV5pDbxV9XLkwpRMus8m5rOuinIp2IqvoF9h6q5qvz8Hy225Z3zGre1N05heRYYnVn+nY58GX3GxiVQwSspjZnKeC0dz13roDKqWpSSATf5Lm9PervmZyd1RAnRnUZ1eslYa4swBRn3l9kMKYLy6JHl2ku+odw0j3wqDDZHLNbNAeoi6oFkNyMmqahIPJ0Nn3Nhn6I6DOMVyoG48gBsp9RnfUys+dvZwz2ruUxB/PTk3hIP2nPgPpWix6sU7UGFZ6YjYvBaSLRJdd9gD1lLDyjBwwW7tkXKrUG0g5SLqPxq2dLP5I9dv6PRP8y43LDs3ZWTG+18NvlIWTwNin9EyJja6uywBS32uWC2kE2OWUmHmzhK0NwHwqMntFSCnDroARACiZ3ZfbT3Vx761vTx1898qVFYKYYARR/pOx89WjnA6ywTlYQpNVtzCQtAyk+lEbPXkV9jrPZWI/ZDGmN6bDa2SmAkGwCbYwUCPoI/k7GU=', 'base64') +} + +var prideParsed = { + infoHash: '455a2295b558ac64e0348fb0c61f433224484908', + name: 'PRIDE AND PREJUDICE - Jane Austen', + private: false, + created: new Date('Mon Jul 22 2013 10:33:19 GMT-0700 (PDT)'), + announce: [ + 'http://tracker.thepiratebay.org/announce', + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.ccc.de:80', + 'udp://tracker.publicbt.com:80', + 'http://tracker.tfile.me/announce', + 'http://tracker.marshyonline.net/announce', + 'http://tracker.ex.ua/announce', + 'http://i.bandito.org/announce', + 'http://greenlietracker.appspot.com/announce', + 'http://exodus.desync.com:6969/announce', + 'http://calu-atrack.appspot.com/announce', + 'http://calu-atrack.appspot.com.nyud.net/announce', + 'http://bt.poletracker.org:2710/announce', + 'http://bigfoot1942.sektori.org:6969/announce', + 'http://announce.opensharing.org:2710/announce', + 'http://94.228.192.98.nyud.net/announce', + 'http://bt.careland.com.cn:6969/announce', + 'http://e180.php5.cz/announce', + 'http://beta.mytracker.me:6969/announce', + 'http://tracker.metin2.com.br:6969/announce', + 'http://tracker1.wasabii.com.tw:6969/announce', + 'http://retracker.perm.ertelecom.ru/announce', + 'http://fr33dom.h33t.com:3310/announce', + 'http://exodus.desync.com/announce', + 'http://bt.eutorrents.com/announce.php', + 'http://retracker.hq.ertelecom.ru/announce', + 'http://announce.torrentsmd.com:8080/announce', + 'http://announce.torrentsmd.com:8080/announce.php', + 'http://www.h33t.com:3310/announce', + 'http://tracker.yify-torrents.com/announce', + 'http://announce.torrentsmd.com:6969/announce', + 'http://fr33domtracker.h33t.com:3310/announce' + ], + announceList: [ + ['http://tracker.thepiratebay.org/announce'], + ['udp://tracker.openbittorrent.com:80'], + ['udp://tracker.ccc.de:80'], + ['udp://tracker.publicbt.com:80'], + ['http://tracker.tfile.me/announce'], + ['http://tracker.marshyonline.net/announce'], + ['http://tracker.ex.ua/announce'], + ['http://i.bandito.org/announce'], + ['http://greenlietracker.appspot.com/announce'], + ['http://exodus.desync.com:6969/announce'], + ['http://calu-atrack.appspot.com/announce'], + ['http://calu-atrack.appspot.com.nyud.net/announce'], + ['http://bt.poletracker.org:2710/announce'], + ['http://bigfoot1942.sektori.org:6969/announce'], + ['http://announce.opensharing.org:2710/announce'], + ['http://94.228.192.98.nyud.net/announce'], + ['http://bt.careland.com.cn:6969/announce'], + ['http://e180.php5.cz/announce'], + ['http://beta.mytracker.me:6969/announce'], + ['http://tracker.metin2.com.br:6969/announce'], + ['http://tracker1.wasabii.com.tw:6969/announce'], + ['http://retracker.perm.ertelecom.ru/announce'], + ['http://fr33dom.h33t.com:3310/announce'], + ['http://exodus.desync.com/announce'], + ['http://bt.eutorrents.com/announce.php'], + ['http://retracker.hq.ertelecom.ru/announce'], + ['http://announce.torrentsmd.com:8080/announce'], + ['http://announce.torrentsmd.com:8080/announce.php'], + ['http://www.h33t.com:3310/announce'], + ['http://tracker.yify-torrents.com/announce'], + ['http://announce.torrentsmd.com:6969/announce'], + ['http://fr33domtracker.h33t.com:3310/announce'] + ], + comment: 'Torrent downloaded from http://thepiratebay.sx', + urlList: [], + files: [ + { + path: 'PRIDE AND PREJUDICE - Jane Austen/Pride_and_Prejudice.pdf', + name: 'Pride_and_Prejudice.pdf', + length: 690450, + offset: 0 + }, + { + path: 'PRIDE AND PREJUDICE - Jane Austen/Pride_and_Prejudice.mobi', + name: 'Pride_and_Prejudice.mobi', + length: 487076, + offset: 690450 + }, + { + path: 'PRIDE AND PREJUDICE - Jane Austen/Pride and Prejudice.epub', + name: 'Pride and Prejudice.epub', + length: 305164, + offset: 1177526 + } + ], + length: 1482690, + pieceLength: 16384, + lastPieceLength: 8130, + pieces: [ + '56e502dc06ce8e6bb439f7e0bac27e69842bc89c', + 'b8d12dbd775b2b8cc01e03b18432703435531da8', + 'c2426cffcfebda20636abd71f0f4b4767cee9c42', + '45d6fa6fe69537a20c7af1842a00e1b5599e27f8', + 'dbcf01ae81a83d77853a4f71335b075d62adf748', + '49c8529ec2bc518cbbb67eeb53fa40b0b455af33', + '9409bff50cab58deecc989cff56660fe7bf6ff78', + '769c5ad7bd22e471ec8386275d4da3b61e114df7', + '92c02dc3038497340a7a51b63a1646a6f5b6288f', + 'eedc15ca2de41169daf767bf4766a0c48a5966aa', + 'cd2172f736be03d79691a9a0a4073cebe0957819', + '7ba2dc9e5a0cdb3aea094d5b89199dc90bc6aee8', + '406eb2a2a451092a05857abc5dca6b9adac483b7', + '48e4858ba838f953d11bc769a72ba1498185a18e', + '5cc7f7179555f1c0e5d98cd36076f0bbb2891d9e', + '6a475614b6e47df47239bc9c70e2b94f62b6de69', + '6a91e084f21f4717bbde75e4742215b09e82ed81', + '58f7d3ce0d9d71d14bb54911ee260378fb23c1e6', + 'e544318d3d14ad816517a494fc66e70e1631dfc9', + '6e5b77e5e7bb7c6d055702c8e6046561c0d49748', + '6319dac948f9a4f80650ea084e247f6f9a0ba929', + '7016da40784b71b9888eed73839590e04bfd525c', + 'd1107879a20033ba14c9086b48d317a6fea3f6f7', + '4491619af6aed40dc773e246f97dc546dfa557d5', + '63ddc93af5bd90f0fde853ff888b0482ac4bad9c', + '10aece0d35ec2627d0147d555dd523535287f05b', + '8adff2fce41765b268c007321cb858d3dbdb7401', + '7b74e03aeb18dde2e43739510636ef49d0d1a7ff', + '2f2ed0e7e11ac45706d5f8a5c4642bbef8026bc4', + '0f8aef0414c32b52f7b0a8abbc15f4e7e1b59707', + '385151aad082f239cbf85603c277fca0e1d04019', + '31a1b5ac49f62f34369f6fc9e3788050830160c2', + '3fe20c34e52a3c10eeb1ef3852a328e557e15e23', + 'b53d2714d5914f9e44863a58d2a293ad475c88ba', + '4ec1ad0905996699550c74c673ef774f5047fb88', + '1f70e15546078902e2fd2aa7cbfaad83a90a496b', + '3ced819a489fbe0b5f6355ec3c99aeb8818b4ab6', + 'e9d5a31e93f9113103521d0df827346ac393c862', + 'e7f431bef64c987badacf6c649f415f533b48fd5', + 'd6616dadd23054cb833e37ec7b53a7ca5edf824a', + 'eaf416c6d92cb5d28aa710b7512249705e00d855', + 'cd4df4dfd9c843aeba9459775323e8d6c9d85f68', + '4b07f3301f4746b714262a700cb6a9ef75e4b963', + '016ca0197293b5bd2ac0abf7a57189415ef16726', + 'd0a31ef2261b60e239b3483ce5d2b736ad6cea22', + 'cd4d4f122f8d4b2e83804c6dedc95d334f499fde', + '8c6bfb574c5691890d2b15b6ff5c18a9e9b99824', + '374663cf669727acdbf78a4ebb8100a8a443a8c2', + '5634ad15c8f0ab2437fe053d78a895073ee20b4c', + '519556f2243d5fdba5e4820e8ac3a4219b8715ed', + '2b5845bb45a460761630bf3a3865188a8febd2d4', + '24e2c96360edf7b3e2a6b7603a79ac54e741c472', + '39acaa42dd9a8d89660a8ec07ee6bf12194b5ae3', + '9fae46b3494e33f8c5e1f61b10eedf69374dbefe', + '899e83b4f5a847f5dbbc952f67ff77d6be082f96', + 'f573e4c764ef1f0f2f20b85a80629f7b15f882f7', + '19f16563ca572f84b47533fa24c690c21f868b9f', + 'ee76bae1bd68e42bc39e7559163cec0a54bf7e8c', + '7e67df4720f2a44262dbf89bb969e22e84a14f46', + 'b4f21fd71b9cd6f86db2deb567fe72ed98f7bc90', + '877581cf6dad17060386b250342388784290223a', + '1f1f9753f1de891165bb5291f7ac228dc98d9c2f', + '880138dbb26828c9cd55316f186c0e8d0f7ff4f5', + 'd96a87ae5a6b316189d73f3adccbba8ce6321e5a', + '6456e6fa11431d9c8e365c5c8202dbd69b8d243d', + '6348e1f7ce157c7bdcd6d62bb0c69dffad4af25d', + '61e7427baccfbba4b3d7e26e6e67f3ea543af9c0', + 'd8d17002beb969516cf84c92c0089ade049a7e22', + '743da7ee2297fbca93a4e33abc6f00079f143244', + '42ad48a49af42cc507ef375af9ee4848737b81f9', + '051c3bbe2e6adb32c7271fdd0beea190fa22ae24', + '938087e5c5d84b6a748476b99690b1aa372ed5fe', + '5a0e6df6d5f20bbc0ea9175fbc2b273233f2b338', + 'a9b04ce62bd5507dca5ec86136cbb3aabeefefa4', + '8fbff2d3bac5ecf14fc1622b5bf535401c1ed7bb', + 'b5c533ab1ff0e8ab855b7042d4e3c238955aa87d', + '84c765700d2fc8d908f88ed4ae0fdf96d5157c30', + '5b296e7112dc33e69aab3ab6e946a47fa389dac8', + 'b1842138abcbd0859b798bf14af9c7620a4c9a64', + 'c7936f8b8a87aa331095ec81666812d74a2ca7b4', + '63c84813baae4716df51e67ed65e39e2cb19abec', + 'b930014eef7374e1bb67cc0e3f56e5231800d00d', + 'e1d31be6858ad8910710c772499679aac3dda880', + 'c321105c6a22aeb7c80d6965ca5b807b3ea98467', + 'd3ee411a555b9e8d34d12464807511486cb2b813', + 'edb466e215767db3b7a0dd285cdeda37dbffd1aa', + 'd69ae8ca54101173188b3ca983509c8da46ac580', + 'af38e2516f6e5e4129e0c5f9efe0ad556f08fc48', + '696e1d36078c494bc67d7863bda8e861e1bc3045', + '516d770312c870273cae8aa03dbb07ca7533b969', + '405e29473fff065fa5807cd2e8953e48589a77c3' + ], + info: { + files: [ + { + length: 690450, + path: [ new Buffer('Pride_and_Prejudice.pdf') ] + }, + { + length: 487076, + path: [ new Buffer('Pride_and_Prejudice.mobi') ] + }, + { + length: 305164, + path: [ new Buffer('Pride and Prejudice.epub') ] + } + ], + name: new Buffer('UFJJREUgQU5EIFBSRUpVRElDRSAgLSBKYW5lIEF1c3Rlbg==', 'base64'), + 'piece length': 16384, + pieces: new Buffer('VuUC3AbOjmu0OffgusJ+aYQryJy40S29d1srjMAeA7GEMnA0NVMdqMJCbP/P69ogY2q9cfD0tHZ87pxCRdb6b+aVN6IMevGEKgDhtVmeJ/jbzwGugag9d4U6T3EzWwddYq33SEnIUp7CvFGMu7Z+61P6QLC0Va8zlAm/9QyrWN7syYnP9WZg/nv2/3h2nFrXvSLkceyDhiddTaO2HhFN95LALcMDhJc0CnpRtjoWRqb1tiiP7twVyi3kEWna92e/R2agxIpZZqrNIXL3Nr4D15aRqaCkBzzr4JV4GXui3J5aDNs66glNW4kZnckLxq7oQG6yoqRRCSoFhXq8XcprmtrEg7dI5IWLqDj5U9Ebx2mnK6FJgYWhjlzH9xeVVfHA5dmM02B28LuyiR2eakdWFLbkffRyObyccOK5T2K23mlqkeCE8h9HF7vedeR0IhWwnoLtgVj3084NnXHRS7VJEe4mA3j7I8Hm5UQxjT0UrYFlF6SU/GbnDhYx38luW3fl57t8bQVXAsjmBGVhwNSXSGMZ2slI+aT4BlDqCE4kf2+aC6kpcBbaQHhLcbmIju1zg5WQ4Ev9UlzREHh5ogAzuhTJCGtI0xem/qP290SRYZr2rtQNx3PiRvl9xUbfpVfVY93JOvW9kPD96FP/iIsEgqxLrZwQrs4NNewmJ9AUfVVd1SNTUofwW4rf8vzkF2WyaMAHMhy4WNPb23QBe3TgOusY3eLkNzlRBjbvSdDRp/8vLtDn4RrEVwbV+KXEZCu++AJrxA+K7wQUwytS97Coq7wV9OfhtZcHOFFRqtCC8jnL+FYDwnf8oOHQQBkxobWsSfYvNDafb8njeIBQgwFgwj/iDDTlKjwQ7rHvOFKjKOVX4V4jtT0nFNWRT55EhjpY0qKTrUdciLpOwa0JBZlmmVUMdMZz73dPUEf7iB9w4VVGB4kC4v0qp8v6rYOpCklrPO2BmkifvgtfY1XsPJmuuIGLSrbp1aMek/kRMQNSHQ34JzRqw5PIYuf0Mb72TJh7raz2xkn0FfUztI/V1mFtrdIwVMuDPjfse1Onyl7fgkrq9BbG2Sy10oqnELdRIklwXgDYVc1N9N/ZyEOuupRZd1Mj6NbJ2F9oSwfzMB9HRrcUJipwDLap73XkuWMBbKAZcpO1vSrAq/elcYlBXvFnJtCjHvImG2DiObNIPOXStzatbOoizU1PEi+NSy6DgExt7cldM09Jn96Ma/tXTFaRiQ0rFbb/XBip6bmYJDdGY89mlyes2/eKTruBAKikQ6jCVjStFcjwqyQ3/gU9eKiVBz7iC0xRlVbyJD1f26Xkgg6Kw6Qhm4cV7StYRbtFpGB2FjC/OjhlGIqP69LUJOLJY2Dt97PiprdgOnmsVOdBxHI5rKpC3ZqNiWYKjsB+5r8SGUta45+uRrNJTjP4xeH2GxDu32k3Tb7+iZ6DtPWoR/XbvJUvZ/931r4IL5b1c+THZO8fDy8guFqAYp97FfiC9xnxZWPKVy+EtHUz+iTGkMIfhouf7na64b1o5CvDnnVZFjzsClS/fox+Z99HIPKkQmLb+Ju5aeIuhKFPRrTyH9cbnNb4bbLetWf+cu2Y97yQh3WBz22tFwYDhrJQNCOIeEKQIjofH5dT8d6JEWW7UpH3rCKNyY2cL4gBONuyaCjJzVUxbxhsDo0Pf/T12WqHrlprMWGJ1z863Mu6jOYyHlpkVub6EUMdnI42XFyCAtvWm40kPWNI4ffOFXx73NbWK7DGnf+tSvJdYedCe6zPu6Sz1+Jubmfz6lQ6+cDY0XACvrlpUWz4TJLACJreBJp+InQ9p+4il/vKk6TjOrxvAAefFDJEQq1IpJr0LMUH7zda+e5ISHN7gfkFHDu+LmrbMscnH90L7qGQ+iKuJJOAh+XF2EtqdIR2uZaQsao3LtX+Wg5t9tXyC7wOqRdfvCsnMjPyszipsEzmK9VQfcpeyGE2y7Oqvu/vpI+/8tO6xezxT8FiK1v1NUAcHte7tcUzqx/w6KuFW3BC1OPCOJVaqH2Ex2VwDS/I2Qj4jtSuD9+W1RV8MFspbnES3DPmmqs6tulGpH+jidrIsYQhOKvL0IWbeYvxSvnHYgpMmmTHk2+LioeqMxCV7IFmaBLXSiyntGPISBO6rkcW31HmftZeOeLLGavsuTABTu9zdOG7Z8wOP1blIxgA0A3h0xvmhYrYkQcQx3JJlnmqw92ogMMhEFxqIq63yA1pZcpbgHs+qYRn0+5BGlVbno000SRkgHURSGyyuBPttGbiFXZ9s7eg3Shc3to32//Rqtaa6MpUEBFzGIs8qYNQnI2kasWArzjiUW9uXkEp4MX57+CtVW8I/Ehpbh02B4xJS8Z9eGO9qOhh4bwwRVFtdwMSyHAnPK6KoD27B8p1M7lpQF4pRz//Bl+lgHzS6JU+SFiad8M=', 'base64') + }, + infoBuffer: new Buffer('ZDU6ZmlsZXNsZDY6bGVuZ3RoaTY5MDQ1MGU0OnBhdGhsMjM6UHJpZGVfYW5kX1ByZWp1ZGljZS5wZGZlZWQ2Omxlbmd0aGk0ODcwNzZlNDpwYXRobDI0OlByaWRlX2FuZF9QcmVqdWRpY2UubW9iaWVlZDY6bGVuZ3RoaTMwNTE2NGU0OnBhdGhsMjQ6UHJpZGUgYW5kIFByZWp1ZGljZS5lcHViZWVlNDpuYW1lMzQ6UFJJREUgQU5EIFBSRUpVRElDRSAgLSBKYW5lIEF1c3RlbjEyOnBpZWNlIGxlbmd0aGkxNjM4NGU2OnBpZWNlczE4MjA6VuUC3AbOjmu0OffgusJ+aYQryJy40S29d1srjMAeA7GEMnA0NVMdqMJCbP/P69ogY2q9cfD0tHZ87pxCRdb6b+aVN6IMevGEKgDhtVmeJ/jbzwGugag9d4U6T3EzWwddYq33SEnIUp7CvFGMu7Z+61P6QLC0Va8zlAm/9QyrWN7syYnP9WZg/nv2/3h2nFrXvSLkceyDhiddTaO2HhFN95LALcMDhJc0CnpRtjoWRqb1tiiP7twVyi3kEWna92e/R2agxIpZZqrNIXL3Nr4D15aRqaCkBzzr4JV4GXui3J5aDNs66glNW4kZnckLxq7oQG6yoqRRCSoFhXq8XcprmtrEg7dI5IWLqDj5U9Ebx2mnK6FJgYWhjlzH9xeVVfHA5dmM02B28LuyiR2eakdWFLbkffRyObyccOK5T2K23mlqkeCE8h9HF7vedeR0IhWwnoLtgVj3084NnXHRS7VJEe4mA3j7I8Hm5UQxjT0UrYFlF6SU/GbnDhYx38luW3fl57t8bQVXAsjmBGVhwNSXSGMZ2slI+aT4BlDqCE4kf2+aC6kpcBbaQHhLcbmIju1zg5WQ4Ev9UlzREHh5ogAzuhTJCGtI0xem/qP290SRYZr2rtQNx3PiRvl9xUbfpVfVY93JOvW9kPD96FP/iIsEgqxLrZwQrs4NNewmJ9AUfVVd1SNTUofwW4rf8vzkF2WyaMAHMhy4WNPb23QBe3TgOusY3eLkNzlRBjbvSdDRp/8vLtDn4RrEVwbV+KXEZCu++AJrxA+K7wQUwytS97Coq7wV9OfhtZcHOFFRqtCC8jnL+FYDwnf8oOHQQBkxobWsSfYvNDafb8njeIBQgwFgwj/iDDTlKjwQ7rHvOFKjKOVX4V4jtT0nFNWRT55EhjpY0qKTrUdciLpOwa0JBZlmmVUMdMZz73dPUEf7iB9w4VVGB4kC4v0qp8v6rYOpCklrPO2BmkifvgtfY1XsPJmuuIGLSrbp1aMek/kRMQNSHQ34JzRqw5PIYuf0Mb72TJh7raz2xkn0FfUztI/V1mFtrdIwVMuDPjfse1Onyl7fgkrq9BbG2Sy10oqnELdRIklwXgDYVc1N9N/ZyEOuupRZd1Mj6NbJ2F9oSwfzMB9HRrcUJipwDLap73XkuWMBbKAZcpO1vSrAq/elcYlBXvFnJtCjHvImG2DiObNIPOXStzatbOoizU1PEi+NSy6DgExt7cldM09Jn96Ma/tXTFaRiQ0rFbb/XBip6bmYJDdGY89mlyes2/eKTruBAKikQ6jCVjStFcjwqyQ3/gU9eKiVBz7iC0xRlVbyJD1f26Xkgg6Kw6Qhm4cV7StYRbtFpGB2FjC/OjhlGIqP69LUJOLJY2Dt97PiprdgOnmsVOdBxHI5rKpC3ZqNiWYKjsB+5r8SGUta45+uRrNJTjP4xeH2GxDu32k3Tb7+iZ6DtPWoR/XbvJUvZ/931r4IL5b1c+THZO8fDy8guFqAYp97FfiC9xnxZWPKVy+EtHUz+iTGkMIfhouf7na64b1o5CvDnnVZFjzsClS/fox+Z99HIPKkQmLb+Ju5aeIuhKFPRrTyH9cbnNb4bbLetWf+cu2Y97yQh3WBz22tFwYDhrJQNCOIeEKQIjofH5dT8d6JEWW7UpH3rCKNyY2cL4gBONuyaCjJzVUxbxhsDo0Pf/T12WqHrlprMWGJ1z863Mu6jOYyHlpkVub6EUMdnI42XFyCAtvWm40kPWNI4ffOFXx73NbWK7DGnf+tSvJdYedCe6zPu6Sz1+Jubmfz6lQ6+cDY0XACvrlpUWz4TJLACJreBJp+InQ9p+4il/vKk6TjOrxvAAefFDJEQq1IpJr0LMUH7zda+e5ISHN7gfkFHDu+LmrbMscnH90L7qGQ+iKuJJOAh+XF2EtqdIR2uZaQsao3LtX+Wg5t9tXyC7wOqRdfvCsnMjPyszipsEzmK9VQfcpeyGE2y7Oqvu/vpI+/8tO6xezxT8FiK1v1NUAcHte7tcUzqx/w6KuFW3BC1OPCOJVaqH2Ex2VwDS/I2Qj4jtSuD9+W1RV8MFspbnES3DPmmqs6tulGpH+jidrIsYQhOKvL0IWbeYvxSvnHYgpMmmTHk2+LioeqMxCV7IFmaBLXSiyntGPISBO6rkcW31HmftZeOeLLGavsuTABTu9zdOG7Z8wOP1blIxgA0A3h0xvmhYrYkQcQx3JJlnmqw92ogMMhEFxqIq63yA1pZcpbgHs+qYRn0+5BGlVbno000SRkgHURSGyyuBPttGbiFXZ9s7eg3Shc3to32//Rqtaa6MpUEBFzGIs8qYNQnI2kasWArzjiUW9uXkEp4MX57+CtVW8I/Ehpbh02B4xJS8Z9eGO9qOhh4bwwRVFtdwMSyHAnPK6KoD27B8p1M7lpQF4pRz//Bl+lgHzS6JU+SFiad8Nl', 'base64') +} + +test('parse single file torrent', function (t) { + t.deepEquals(parseTorrent(leaves), leavesParsed) + t.end() +}) + +test('parse "torrent" from magnet metadata protocol', function (t) { + t.deepEquals(parseTorrent(leavesMagnet), leavesMagnetParsed) + t.end() +}) + +test('parse multiple file torrent', function (t) { + t.deepEquals(parseTorrent(pride), prideParsed) + t.end() +}) + +test('parse torrent from object', function (t) { + var torrent = bencode.decode(pride) + t.deepEquals(parseTorrent(torrent), prideParsed) + t.end() +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/corrupt.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/corrupt.js new file mode 100644 index 00000000..8e9b058e --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/corrupt.js @@ -0,0 +1,12 @@ +var fs = require('fs') +var parseTorrent = require('../') +var test = require('tape') + +var leavesCorrupt = fs.readFileSync(__dirname + '/torrents/leaves-corrupt.torrent') + +test('exception thrown when torrent file is missing `name` field', function (t) { + t.throws(function () { + parseTorrent(leavesCorrupt) + }) + t.end() +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/empty-url-list.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/empty-url-list.js new file mode 100644 index 00000000..a8bea335 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/empty-url-list.js @@ -0,0 +1,11 @@ +var fs = require('fs') +var parseTorrent = require('../') +var test = require('tape') + +var leavesUrlList = fs.readFileSync(__dirname + '/torrents/leaves-empty-url-list.torrent') + +test('parse empty url-list', function (t) { + var torrent = parseTorrent(leavesUrlList) + t.deepEqual(torrent.urlList, []) + t.end() +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/encode.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/encode.js new file mode 100644 index 00000000..30b3ca0c --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/encode.js @@ -0,0 +1,18 @@ +var fs = require('fs') +var parseTorrent = require('../') +var test = require('tape') + +var leaves = fs.readFileSync(__dirname + '/torrents/leaves.torrent') + +test('encode', function (t) { + var parsedTorrent = parseTorrent(leaves) + var buf = parseTorrent.encode(parsedTorrent) + var doubleParsedTorrent = parseTorrent(buf) + + t.deepEqual(parsedTorrent.infoBuffer, doubleParsedTorrent.infoBuffer) + t.equal(parsedTorrent.created.getDate(), doubleParsedTorrent.created.getDate()) + t.deepEqual(parsedTorrent.announce, doubleParsedTorrent.announce) + t.deepEqual(parsedTorrent.announceList, doubleParsedTorrent.announceList) + + t.end() +}) diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/package.json b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/package.json new file mode 100644 index 00000000..ac999e19 --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/package.json @@ -0,0 +1,13 @@ +{ + "name": "test", + "version": "0.0.0", + "author": "Feross Aboukhadijeh (http://feross.org/)", + "browserify": { + "transform": ["brfs"] + }, + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "tape test/*.js" + } +} \ No newline at end of file diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-corrupt.torrent b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-corrupt.torrent new file mode 100644 index 00000000..666b409d Binary files /dev/null and b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-corrupt.torrent differ diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-empty-url-list.torrent b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-empty-url-list.torrent new file mode 100644 index 00000000..d6c2d8b2 Binary files /dev/null and b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-empty-url-list.torrent differ diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-magnet.torrent b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-magnet.torrent new file mode 100644 index 00000000..63586324 Binary files /dev/null and b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-magnet.torrent differ diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-url-list.torrent b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-url-list.torrent new file mode 100644 index 00000000..d424152b Binary files /dev/null and b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves-url-list.torrent differ diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves.torrent b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves.torrent new file mode 100644 index 00000000..f18e7c11 Binary files /dev/null and b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/leaves.torrent differ diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/pride.torrent b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/pride.torrent new file mode 100644 index 00000000..a9bf635d Binary files /dev/null and b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/torrents/pride.torrent differ diff --git a/node_modules/parse-torrent/node_modules/parse-torrent-file/test/webseed.js b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/webseed.js new file mode 100644 index 00000000..7bed866e --- /dev/null +++ b/node_modules/parse-torrent/node_modules/parse-torrent-file/test/webseed.js @@ -0,0 +1,11 @@ +var fs = require('fs') +var parseTorrent = require('../') +var test = require('tape') + +var leavesUrlList = fs.readFileSync(__dirname + '/torrents/leaves-url-list.torrent') + +test('parse url-list for webseed support', function (t) { + var torrent = parseTorrent(leavesUrlList) + t.deepEqual(torrent.urlList, [ 'http://www2.hn.psu.edu/faculty/jmanis/whitman/leaves-of-grass6x9.pdf' ]) + t.end() +}) diff --git a/node_modules/parse-torrent/package.json b/node_modules/parse-torrent/package.json new file mode 100644 index 00000000..1aff4090 --- /dev/null +++ b/node_modules/parse-torrent/package.json @@ -0,0 +1,74 @@ +{ + "name": "parse-torrent", + "description": "Parse a torrent identifier (magnet uri, .torrent file, info hash)", + "version": "4.1.0", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bin": { + "parse-torrent": "./bin/cmd.js" + }, + "bugs": { + "url": "https://github.com/feross/parse-torrent/issues" + }, + "dependencies": { + "magnet-uri": "^4.0.0", + "parse-torrent-file": "^2.0.0" + }, + "devDependencies": { + "brfs": "^1.0.0", + "standard": "^3.7.2", + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "https://github.com/feross/parse-torrent", + "keywords": [ + "torrent", + "parse torrent", + "read torrent", + ".torrent", + "peer-to-peer", + "bittorrent", + "webtorrent" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/parse-torrent.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "testling": { + "files": "test/*.js" + }, + "gitHead": "cb3e3d5ece96ca19e98d2bb7c0c643bc60fa0601", + "_id": "parse-torrent@4.1.0", + "_shasum": "a814bd8505e8b58e88eb8ff3e2daff5d19a711b7", + "_from": "parse-torrent@4.1.0", + "_npmVersion": "2.8.4", + "_nodeVersion": "1.8.1", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "a814bd8505e8b58e88eb8ff3e2daff5d19a711b7", + "tarball": "http://registry.npmjs.org/parse-torrent/-/parse-torrent-4.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/parse-torrent/-/parse-torrent-4.1.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/parse-torrent/test/basic.js b/node_modules/parse-torrent/test/basic.js new file mode 100644 index 00000000..ca07e25d --- /dev/null +++ b/node_modules/parse-torrent/test/basic.js @@ -0,0 +1,55 @@ +var fs = require('fs') +var parseTorrent = require('../') +var test = require('tape') + +var leaves = fs.readFileSync(__dirname + '/torrents/leaves.torrent') +var leavesParsed = parseTorrent(leaves) + +test('Test supported torrentInfo types', function (t) { + var parsed + + // info hash (as a hex string) + parsed = parseTorrent(leavesParsed.infoHash) + t.equal(parsed.infoHash, leavesParsed.infoHash) + t.equal(parsed.name, undefined) + t.deepEqual(parsed.announce, []) + + // info hash (as a Buffer) + parsed = parseTorrent(new Buffer(leavesParsed.infoHash, 'hex')) + t.equal(parsed.infoHash, leavesParsed.infoHash) + t.equal(parsed.name, undefined) + t.deepEqual(parsed.announce, []) + + // magnet uri (as a utf8 string) + var magnet = 'magnet:?xt=urn:btih:' + leavesParsed.infoHash + parsed = parseTorrent(magnet) + t.equal(parsed.infoHash, leavesParsed.infoHash) + t.equal(parsed.name, undefined) + t.deepEqual(parsed.announce, []) + + // magnet uri with name + parsed = parseTorrent(magnet + '&dn=' + encodeURIComponent(leavesParsed.name)) + t.equal(parsed.infoHash, leavesParsed.infoHash) + t.equal(parsed.name, leavesParsed.name) + t.deepEqual(parsed.announce, []) + + // magnet uri with trackers + parsed = parseTorrent(magnet + '&tr=' + encodeURIComponent(leavesParsed.announce[0])) + t.equal(parsed.infoHash, leavesParsed.infoHash) + t.equal(parsed.name, undefined) + t.deepEqual(parsed.announce, [ leavesParsed.announce[0] ]) + + // .torrent file (as a Buffer) + parsed = parseTorrent(leaves) + t.equal(parsed.infoHash, leavesParsed.infoHash) + t.equal(parsed.name, leavesParsed.name) + t.deepEqual(parsed.announce, leavesParsed.announce) + + // leavesParsed torrent (as an Object) + parsed = parseTorrent(leavesParsed) + t.equal(parsed.infoHash, leavesParsed.infoHash) + t.equal(parsed.name, leavesParsed.name) + t.deepEqual(parsed.announce, leavesParsed.announce) + + t.end() +}) diff --git a/node_modules/parse-torrent/test/package.json b/node_modules/parse-torrent/test/package.json new file mode 100644 index 00000000..3464324b --- /dev/null +++ b/node_modules/parse-torrent/test/package.json @@ -0,0 +1,7 @@ +{ + "name": "test", + "version": "0.0.0", + "browserify": { + "transform": ["brfs"] + } +} diff --git a/node_modules/parse-torrent/test/torrent-files.js b/node_modules/parse-torrent/test/torrent-files.js new file mode 100644 index 00000000..a17f1b8d --- /dev/null +++ b/node_modules/parse-torrent/test/torrent-files.js @@ -0,0 +1,104 @@ +var fs = require('fs') +var parseTorrent = require('../') +var test = require('tape') + +var leaves = fs.readFileSync(__dirname + '/torrents/leaves.torrent') +var leavesMagnet = fs.readFileSync(__dirname + '/torrents/leaves-magnet.torrent') +var pride = fs.readFileSync(__dirname + '/torrents/pride.torrent') +var leavesCorrupt = fs.readFileSync(__dirname + '/torrents/leaves-corrupt.torrent') +var leavesUrlList = fs.readFileSync(__dirname + '/torrents/leaves-url-list.torrent') + +var leavesParsed = { + infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + name: 'Leaves of Grass by Walt Whitman.epub', + announce: [ + 'http://tracker.thepiratebay.org/announce', + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.ccc.de:80', + 'udp://tracker.publicbt.com:80', + 'udp://fr33domtracker.h33t.com:3310/announce', + 'http://tracker.bittorrent.am/announce' + ] +} + +var leavesMagnetParsed = { + infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36', + name: 'Leaves of Grass by Walt Whitman.epub', + announce: [] +} + +var prideParsed = { + infoHash: '455a2295b558ac64e0348fb0c61f433224484908', + name: 'PRIDE AND PREJUDICE - Jane Austen', + announce: [ + 'http://tracker.thepiratebay.org/announce', + 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.ccc.de:80', + 'udp://tracker.publicbt.com:80', + 'http://tracker.tfile.me/announce', + 'http://tracker.marshyonline.net/announce', + 'http://tracker.ex.ua/announce', + 'http://i.bandito.org/announce', + 'http://greenlietracker.appspot.com/announce', + 'http://exodus.desync.com:6969/announce', + 'http://calu-atrack.appspot.com/announce', + 'http://calu-atrack.appspot.com.nyud.net/announce', + 'http://bt.poletracker.org:2710/announce', + 'http://bigfoot1942.sektori.org:6969/announce', + 'http://announce.opensharing.org:2710/announce', + 'http://94.228.192.98.nyud.net/announce', + 'http://bt.careland.com.cn:6969/announce', + 'http://e180.php5.cz/announce', + 'http://beta.mytracker.me:6969/announce', + 'http://tracker.metin2.com.br:6969/announce', + 'http://tracker1.wasabii.com.tw:6969/announce', + 'http://retracker.perm.ertelecom.ru/announce', + 'http://fr33dom.h33t.com:3310/announce', + 'http://exodus.desync.com/announce', + 'http://bt.eutorrents.com/announce.php', + 'http://retracker.hq.ertelecom.ru/announce', + 'http://announce.torrentsmd.com:8080/announce', + 'http://announce.torrentsmd.com:8080/announce.php', + 'http://www.h33t.com:3310/announce', + 'http://tracker.yify-torrents.com/announce', + 'http://announce.torrentsmd.com:6969/announce', + 'http://fr33domtracker.h33t.com:3310/announce' + ] +} + +test('parse single file torrent', function (t) { + var parsed = parseTorrent(leaves) + t.equal(parsed.infoHash, leavesParsed.infoHash) + t.equal(parsed.name, leavesParsed.name) + t.deepEquals(parsed.announce, leavesParsed.announce) + t.end() +}) + +test('parse "torrent" from magnet metadata protocol', function (t) { + var parsed = parseTorrent(leavesMagnet) + t.equal(parsed.infoHash, leavesMagnetParsed.infoHash) + t.equal(parsed.name, leavesMagnetParsed.name) + t.deepEquals(parsed.announce, leavesMagnetParsed.announce) + t.end() +}) + +test('parse multiple file torrent', function (t) { + var parsed = parseTorrent(pride) + t.equal(parsed.infoHash, prideParsed.infoHash) + t.equal(parsed.name, prideParsed.name) + t.deepEquals(parsed.announce, prideParsed.announce) + t.end() +}) + +test('torrent file missing `name` field throws', function (t) { + t.throws(function () { + parseTorrent(leavesCorrupt) + }) + t.end() +}) + +test('parse url-list for webseed support', function (t) { + var torrent = parseTorrent(leavesUrlList) + t.deepEqual(torrent.urlList, [ 'http://www2.hn.psu.edu/faculty/jmanis/whitman/leaves-of-grass6x9.pdf' ]) + t.end() +}) diff --git a/node_modules/parse-torrent/test/torrents/leaves-corrupt.torrent b/node_modules/parse-torrent/test/torrents/leaves-corrupt.torrent new file mode 100644 index 00000000..666b409d Binary files /dev/null and b/node_modules/parse-torrent/test/torrents/leaves-corrupt.torrent differ diff --git a/node_modules/parse-torrent/test/torrents/leaves-magnet.torrent b/node_modules/parse-torrent/test/torrents/leaves-magnet.torrent new file mode 100644 index 00000000..63586324 Binary files /dev/null and b/node_modules/parse-torrent/test/torrents/leaves-magnet.torrent differ diff --git a/node_modules/parse-torrent/test/torrents/leaves-url-list.torrent b/node_modules/parse-torrent/test/torrents/leaves-url-list.torrent new file mode 100644 index 00000000..d424152b Binary files /dev/null and b/node_modules/parse-torrent/test/torrents/leaves-url-list.torrent differ diff --git a/node_modules/parse-torrent/test/torrents/leaves.torrent b/node_modules/parse-torrent/test/torrents/leaves.torrent new file mode 100644 index 00000000..f18e7c11 Binary files /dev/null and b/node_modules/parse-torrent/test/torrents/leaves.torrent differ diff --git a/node_modules/parse-torrent/test/torrents/pride.torrent b/node_modules/parse-torrent/test/torrents/pride.torrent new file mode 100644 index 00000000..a9bf635d Binary files /dev/null and b/node_modules/parse-torrent/test/torrents/pride.torrent differ diff --git a/node_modules/run-series/.travis.yml b/node_modules/run-series/.travis.yml new file mode 100644 index 00000000..18ae2d89 --- /dev/null +++ b/node_modules/run-series/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.11" + - "0.10" diff --git a/node_modules/run-series/LICENSE b/node_modules/run-series/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/run-series/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/run-series/README.md b/node_modules/run-series/README.md new file mode 100644 index 00000000..2176cd77 --- /dev/null +++ b/node_modules/run-series/README.md @@ -0,0 +1,68 @@ +# run-series [![travis](https://img.shields.io/travis/feross/run-series.svg)](https://travis-ci.org/feross/run-series) [![npm](https://img.shields.io/npm/v/run-series.svg)](https://npmjs.org/package/run-series) [![npm](https://img.shields.io/npm/dm/run-series.svg)](https://npmjs.org/package/run-series) + +### Run an array of functions in series + +![series](https://raw.githubusercontent.com/feross/run-series/master/img.png) [![browser support](https://ci.testling.com/feross/run-series.png)](https://ci.testling.com/feross/run-series) + +### install + +``` +npm install run-series +``` + +### usage + +#### series(tasks, [callback]) + +Run the functions in the `tasks` array in series, each one running once the previous +function has completed. If any functions in the series pass an error to its callback, no +more functions are run, and `callback` is immediately called with the value of the error. +Otherwise, `callback` receives an array of results when `tasks` have completed. + +##### arguments + +- `tasks` - An array containing functions to run, each function is passed a +`callback(err, result)` which it must call on completion with an error `err` (which can +be `null`) and an optional result value. +- `callback(err, results)` - An optional callback to run once all the functions have +completed. This function gets a results array containing all the result arguments passed +to the task callbacks. + +##### example + +```js +var series = require('run-series') + +series([ + function (callback) { + // do some stuff ... + callback(null, 'one') + }, + function (callback) { + // do some stuff ... + callback(null, 'two') + } +], +// optional callback +function (err, results) { + // the results array will equal ['one','two'] +}) +``` + +This module is basically equavalent to +[`async.series`](https://github.com/caolan/async#seriestasks-callback), but it's +handy to just have the functions you need instead of the kitchen sink. Modularity! +Especially handy if you're serving to the browser and need to reduce your javascript +bundle size. + +Works great in the browser with [browserify](http://browserify.org/)! + +### see also + +- [run-auto](https://github.com/feross/run-auto) +- [run-parallel](https://github.com/feross/run-parallel) +- [run-waterfall](https://github.com/feross/run-waterfall) + +### license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/run-series/img.png b/node_modules/run-series/img.png new file mode 100644 index 00000000..86516cbd Binary files /dev/null and b/node_modules/run-series/img.png differ diff --git a/node_modules/run-series/index.js b/node_modules/run-series/index.js new file mode 100644 index 00000000..eb519b7b --- /dev/null +++ b/node_modules/run-series/index.js @@ -0,0 +1,22 @@ +var dezalgo = require('dezalgo') + +module.exports = function (tasks, cb) { + var current = 0 + var results = [] + if (cb) cb = dezalgo(cb) + + function done (err, result) { + results.push(result) + if (++current >= tasks.length || err) { + if (cb) cb(err, results) + } else { + tasks[current](done) + } + } + + if (tasks.length) { + tasks[0](done) + } else { + if (cb) cb(null, results) + } +} diff --git a/node_modules/run-series/node_modules/dezalgo/README.md b/node_modules/run-series/node_modules/dezalgo/README.md new file mode 100644 index 00000000..bdfc8ba8 --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/README.md @@ -0,0 +1,29 @@ +# dezalgo + +Contain async insanity so that the dark pony lord doesn't eat souls + +See [this blog +post](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony). + +## USAGE + +Pass a callback to `dezalgo` and it will ensure that it is *always* +called in a future tick, and never in this tick. + +```javascript +var dz = require('dezalgo') + +var cache = {} +function maybeSync(arg, cb) { + cb = dz(cb) + + // this will actually defer to nextTick + if (cache[arg]) cb(null, cache[arg]) + + fs.readFile(arg, function (er, data) { + // since this is *already* defered, it will call immediately + if (er) cb(er) + cb(null, cache[arg] = data) + }) +} +``` diff --git a/node_modules/run-series/node_modules/dezalgo/dezalgo.js b/node_modules/run-series/node_modules/dezalgo/dezalgo.js new file mode 100644 index 00000000..04fd3ba7 --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/dezalgo.js @@ -0,0 +1,22 @@ +var wrappy = require('wrappy') +module.exports = wrappy(dezalgo) + +var asap = require('asap') + +function dezalgo (cb) { + var sync = true + asap(function () { + sync = false + }) + + return function zalgoSafe() { + var args = arguments + var me = this + if (sync) + asap(function() { + cb.apply(me, args) + }) + else + cb.apply(me, args) + } +} diff --git a/node_modules/run-series/node_modules/dezalgo/node_modules/asap/LICENSE.md b/node_modules/run-series/node_modules/dezalgo/node_modules/asap/LICENSE.md new file mode 100644 index 00000000..5d98ad8f --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/node_modules/asap/LICENSE.md @@ -0,0 +1,20 @@ + +Copyright 2009–2013 Contributors. All rights reserved. +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/node_modules/run-series/node_modules/dezalgo/node_modules/asap/README.md b/node_modules/run-series/node_modules/dezalgo/node_modules/asap/README.md new file mode 100644 index 00000000..9a427597 --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/node_modules/asap/README.md @@ -0,0 +1,81 @@ + +# ASAP + +This `asap` CommonJS package contains a single `asap` module that +exports a single `asap` function that executes a function **as soon as +possible**. + +```javascript +asap(function () { + // ... +}); +``` + +More formally, ASAP provides a fast event queue that will execute tasks +until it is empty before yielding to the JavaScript engine's underlying +event-loop. When the event queue becomes non-empty, ASAP schedules a +flush event, preferring for that event to occur before the JavaScript +engine has an opportunity to perform IO tasks or rendering, thus making +the first task and subsequent tasks semantically indistinguishable. +ASAP uses a variety of techniques to preserve this invariant on +different versions of browsers and NodeJS. + +By design, ASAP can starve the event loop on the theory that, if there +is enough work to be done synchronously, albeit in separate events, long +enough to starve input or output, it is a strong indicator that the +program needs to push back on scheduling more work. + +Take care. ASAP can sustain infinite recursive calls indefinitely +without warning. This is behaviorally equivalent to an infinite loop. +It will not halt from a stack overflow, but it *will* chew through +memory (which is an oddity I cannot explain at this time). Just as with +infinite loops, you can monitor a Node process for this behavior with a +heart-beat signal. As with infinite loops, a very small amount of +caution goes a long way to avoiding problems. + +```javascript +function loop() { + asap(loop); +} +loop(); +``` + +ASAP is distinct from `setImmediate` in that it does not suffer the +overhead of returning a handle and being possible to cancel. For a +`setImmediate` shim, consider [setImmediate][]. + +[setImmediate]: https://github.com/noblejs/setimmediate + +If a task throws an exception, it will not interrupt the flushing of +high-priority tasks. The exception will be postponed to a later, +low-priority event to avoid slow-downs, when the underlying JavaScript +engine will treat it as it does any unhandled exception. + +## Heritage + +ASAP has been factored out of the [Q][] asynchronous promise library. +It originally had a naïve implementation in terms of `setTimeout`, but +[Malte Ubl][NonBlocking] provided an insight that `postMessage` might be +useful for creating a high-priority, no-delay event dispatch hack. +Since then, Internet Explorer proposed and implemented `setImmediate`. +Robert Kratić began contributing to Q by measuring the performance of +the internal implementation of `asap`, paying particular attention to +error recovery. Domenic, Robert, and I collectively settled on the +current strategy of unrolling the high-priority event queue internally +regardless of what strategy we used to dispatch the potentially +lower-priority flush event. Domenic went on to make ASAP cooperate with +NodeJS domains. + +[Q]: https://github.com/kriskowal/q +[NonBlocking]: http://www.nonblocking.io/2011/06/windownexttick.html + +For further reading, Nicholas Zakas provided a thorough article on [The +Case for setImmediate][NCZ]. + +[NCZ]: http://www.nczonline.net/blog/2013/07/09/the-case-for-setimmediate/ + +## License + +Copyright 2009-2013 by Contributors +MIT License (enclosed) + diff --git a/node_modules/run-series/node_modules/dezalgo/node_modules/asap/asap.js b/node_modules/run-series/node_modules/dezalgo/node_modules/asap/asap.js new file mode 100644 index 00000000..2f85516c --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/node_modules/asap/asap.js @@ -0,0 +1,113 @@ + +// Use the fastest possible means to execute a task in a future turn +// of the event loop. + +// linked list of tasks (single, with head node) +var head = {task: void 0, next: null}; +var tail = head; +var flushing = false; +var requestFlush = void 0; +var isNodeJS = false; + +function flush() { + /* jshint loopfunc: true */ + + while (head.next) { + head = head.next; + var task = head.task; + head.task = void 0; + var domain = head.domain; + + if (domain) { + head.domain = void 0; + domain.enter(); + } + + try { + task(); + + } catch (e) { + if (isNodeJS) { + // In node, uncaught exceptions are considered fatal errors. + // Re-throw them synchronously to interrupt flushing! + + // Ensure continuation if the uncaught exception is suppressed + // listening "uncaughtException" events (as domains does). + // Continue in next event to avoid tick recursion. + if (domain) { + domain.exit(); + } + setTimeout(flush, 0); + if (domain) { + domain.enter(); + } + + throw e; + + } else { + // In browsers, uncaught exceptions are not fatal. + // Re-throw them asynchronously to avoid slow-downs. + setTimeout(function() { + throw e; + }, 0); + } + } + + if (domain) { + domain.exit(); + } + } + + flushing = false; +} + +if (typeof process !== "undefined" && process.nextTick) { + // Node.js before 0.9. Note that some fake-Node environments, like the + // Mocha test runner, introduce a `process` global without a `nextTick`. + isNodeJS = true; + + requestFlush = function () { + process.nextTick(flush); + }; + +} else if (typeof setImmediate === "function") { + // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate + if (typeof window !== "undefined") { + requestFlush = setImmediate.bind(window, flush); + } else { + requestFlush = function () { + setImmediate(flush); + }; + } + +} else if (typeof MessageChannel !== "undefined") { + // modern browsers + // http://www.nonblocking.io/2011/06/windownexttick.html + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + requestFlush = function () { + channel.port2.postMessage(0); + }; + +} else { + // old browsers + requestFlush = function () { + setTimeout(flush, 0); + }; +} + +function asap(task) { + tail = tail.next = { + task: task, + domain: isNodeJS && process.domain, + next: null + }; + + if (!flushing) { + flushing = true; + requestFlush(); + } +}; + +module.exports = asap; + diff --git a/node_modules/run-series/node_modules/dezalgo/node_modules/asap/package.json b/node_modules/run-series/node_modules/dezalgo/node_modules/asap/package.json new file mode 100644 index 00000000..371fc1e7 --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/node_modules/asap/package.json @@ -0,0 +1,39 @@ +{ + "name": "asap", + "version": "1.0.0", + "description": "High-priority task queue for Node.js and browsers", + "keywords": [ + "event", + "task", + "queue" + ], + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/kriskowal/asap/raw/master/LICENSE.md" + } + ], + "main": "asap", + "_id": "asap@1.0.0", + "dist": { + "shasum": "b2a45da5fdfa20b0496fc3768cc27c12fa916a7d", + "tarball": "http://registry.npmjs.org/asap/-/asap-1.0.0.tgz" + }, + "_from": "asap@>=1.0.0 <2.0.0", + "_npmVersion": "1.2.15", + "_npmUser": { + "name": "kriskowal", + "email": "kris.kowal@cixar.com" + }, + "maintainers": [ + { + "name": "kriskowal", + "email": "kris.kowal@cixar.com" + } + ], + "directories": {}, + "_shasum": "b2a45da5fdfa20b0496fc3768cc27c12fa916a7d", + "_resolved": "https://registry.npmjs.org/asap/-/asap-1.0.0.tgz", + "readme": "ERROR: No README data found!", + "scripts": {} +} diff --git a/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/LICENSE b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/README.md b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/package.json b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/test/basic.js b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/wrappy.js b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/run-series/node_modules/dezalgo/package.json b/node_modules/run-series/node_modules/dezalgo/package.json new file mode 100644 index 00000000..67a97f20 --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/package.json @@ -0,0 +1,68 @@ +{ + "name": "dezalgo", + "version": "1.0.1", + "description": "Contain async insanity so that the dark pony lord doesn't eat souls", + "main": "dezalgo.js", + "directories": { + "test": "test" + }, + "dependencies": { + "asap": "^1.0.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^0.4.11" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/dezalgo" + }, + "keywords": [ + "async", + "zalgo", + "the dark pony", + "he comes", + "asynchrony of all holy and good", + "T̯̪ͅo̯͖̹ ̻̮̖̲͢i̥̖n̢͈͇̝͍v͏͉ok̭̬̝ͅe̞͍̩̫͍̩͝ ̩̮̖̟͇͉́t͔͔͎̗h͏̗̟e̘͉̰̦̠̞͓ ͕h͉̟͎̪̠̱͠ḭ̮̩v̺͉͇̩e̵͖-̺̪m͍i̜n̪̲̲̲̮d̷ ̢r̠̼̯̹̦̦͘ͅe͓̳͓̙p̺̗̫͙͘ͅr͔̰͜e̴͓̞s͉̩̩͟ͅe͏̣n͚͇̗̭̺͍tì͙̣n͏̖̥̗͎̰̪g̞͓̭̱̯̫̕ ̣̱͜ͅc̦̰̰̠̮͎͙̀hao̺̜̻͍͙ͅs͉͓̘.͎̼̺̼͕̹͘", + "̠̞̱̰I͖͇̝̻n̦̰͍̰̟v̤̺̫̳̭̼̗͘ò̹̟̩̩͚k̢̥̠͍͉̦̬i̖͓͔̮̱̻͘n̶̳͙̫͎g̖̯̣̲̪͉ ̞͎̗͕͚ͅt̲͕̘̺̯̗̦h̘̦̲̜̻e̳͎͉̬͙ ̴̞̪̲̥f̜̯͓͓̭̭͢e̱̘͔̮e̜̤l̺̱͖̯͓͙͈͢i̵̦̬͉͔̫͚͕n͉g̨͖̙̙̹̹̟̤ ͉̪o̞̠͍̪̰͙ͅf̬̲̺ ͔͕̲͕͕̲̕c̙͉h̝͔̩̙̕ͅa̲͖̻̗̹o̥̼̫s̝̖̜̝͚̫̟.̺͚ ̸̱̲W̶̥̣͖̦i͏̤̬̱̳̣ͅt͉h̗̪̪ ̷̱͚̹̪ǫ͕̗̣̳̦͎u̼̦͔̥̮̕ţ͖͎̻͔͉ ̴͎̩òr̹̰̖͉͈͝d̷̲̦̖͓e̲͓̠r", + "̧͚̜͓̰̭̭Ṯ̫̹̜̮̟̮͝h͚̘̩̘̖̰́e ̥̘͓͉͔͙̼N̟̜̣̘͔̪e̞̞̤͢z̰̖̘͇p̠͟e̺̱̣͍͙̝ṛ̘̬͔̙͇̠d͝ḭ̯̱̥̗̩a̛ͅn͏̦ ̷̥hi̥v̖̳̹͉̮̱͝e̹̪̘̖̰̟-̴͙͓͚̜̻mi̗̺̻͙̺ͅn̪̯͈d ͏̘͓̫̳ͅơ̹͔̳̖̣͓f͈̹̘ ͕ͅc̗̤̠̜̮̥̥h̡͍̩̭̫͚̱a̤͉̤͔͜os͕̤̼͍̲̀ͅ.̡̱ ̦Za̯̱̗̭͍̣͚l̗͉̰̤g͏̣̭̬̗̲͖ͅo̶̭̩̳̟͈.̪̦̰̳", + "H̴̱̦̗̬̣͓̺e̮ ͉̠̰̞͎̖͟ẁh̛̺̯ͅo̖̫͡ ̢Ẁa̡̗i̸t͖̣͉̀ş͔̯̩ ̤̦̮͇̞̦̲B͎̭͇̦̼e̢hin͏͙̟̪d̴̰͓̻̣̮͕ͅ T͖̮̕h͖e̘̺̰̙͘ ̥Ẁ̦͔̻͚a̞͖̪͉l̪̠̻̰̣̠l̲͎͞", + "Z̘͍̼͎̣͔͝Ą̲̜̱̱̹̤͇L̶̝̰̭͔G͍̖͍O̫͜ͅ!̼̤ͅ", + "H̝̪̜͓̀̌̂̒E̢̙̠̣ ̴̳͇̥̟̠͍̐C̹̓̑̐̆͝Ó̶̭͓̚M̬̼Ĕ̖̤͔͔̟̹̽̿̊ͥ̍ͫS̻̰̦̻̖̘̱̒ͪ͌̅͟" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/dezalgo/issues" + }, + "homepage": "https://github.com/npm/dezalgo", + "gitHead": "0a5eee75c179611f8b67f663015d68bb517e57d2", + "_id": "dezalgo@1.0.1", + "_shasum": "12bde135060807900d5a7aebb607c2abb7c76937", + "_from": "dezalgo@>=1.0.1 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "12bde135060807900d5a7aebb607c2abb7c76937", + "tarball": "http://registry.npmjs.org/dezalgo/-/dezalgo-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/run-series/node_modules/dezalgo/test/basic.js b/node_modules/run-series/node_modules/dezalgo/test/basic.js new file mode 100644 index 00000000..da09e724 --- /dev/null +++ b/node_modules/run-series/node_modules/dezalgo/test/basic.js @@ -0,0 +1,29 @@ +var test = require('tap').test +var dz = require('../dezalgo.js') + +test('the dark pony', function(t) { + + var n = 0 + function foo(i, cb) { + cb = dz(cb) + if (++n % 2) cb(true, i) + else process.nextTick(cb.bind(null, false, i)) + } + + var called = 0 + var order = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9] + var o = 0 + for (var i = 0; i < 10; i++) { + foo(i, function(cached, i) { + t.equal(i, order[o++]) + t.equal(i % 2, cached ? 0 : 1) + called++ + }) + t.equal(called, 0) + } + + setTimeout(function() { + t.equal(called, 10) + t.end() + }) +}) diff --git a/node_modules/run-series/package.json b/node_modules/run-series/package.json new file mode 100644 index 00000000..e9e28ba1 --- /dev/null +++ b/node_modules/run-series/package.json @@ -0,0 +1,79 @@ +{ + "name": "run-series", + "description": "Run an array of functions in series", + "version": "1.1.1", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/run-series/issues" + }, + "dependencies": { + "dezalgo": "^1.0.1" + }, + "devDependencies": { + "standard": "^3.2.0", + "tape": "^4.0.0" + }, + "homepage": "https://github.com/feross/run-series", + "keywords": [ + "series", + "async", + "function", + "callback", + "asynchronous", + "run", + "array", + "run series" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/run-series.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/9..latest", + "chrome/25..latest", + "chrome/canary", + "firefox/20..latest", + "firefox/nightly", + "safari/6..latest", + "opera/12..latest", + "opera/next", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "6fcddef35eea5c408c5f960c8fefc82aeffc4fd0", + "_id": "run-series@1.1.1", + "_shasum": "1ada4fcf63979aebdd852aea59149364dc0c37c0", + "_from": "run-series@1.1.1", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "1ada4fcf63979aebdd852aea59149364dc0c37c0", + "tarball": "http://registry.npmjs.org/run-series/-/run-series-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/run-series/test/basic.js b/node_modules/run-series/test/basic.js new file mode 100644 index 00000000..04479b6b --- /dev/null +++ b/node_modules/run-series/test/basic.js @@ -0,0 +1,71 @@ +var series = require('../') +var test = require('tape') + +test('functions run in series', function (t) { + t.plan(4) + + var tasks = [ + function (cb) { + t.pass('cb 1') + cb(null) + }, + function (cb) { + t.pass('cb 2') + cb(null) + }, + function (cb) { + t.pass('cb 3') + cb(null) + } + ] + + series(tasks, function (err) { + t.error(err) + }) +}) + +test('functions that return results', function (t) { + t.plan(4) + + var tasks = [ + function (cb) { + t.pass('cb 1') + cb(null, 1) + }, + function (cb) { + t.pass('cb 2') + cb(null, 2) + } + ] + + series(tasks, function (err, results) { + t.error(err) + t.deepEqual(results, [1, 2]) + }) +}) + +test('functions that return results preserve order', function (t) { + t.plan(4) + + var tasks = [ + function (cb) { + setTimeout(function () { + t.pass('cb 1') + cb(null, 1) + }, 200) + }, + function (cb) { + setTimeout(function () { + t.pass('cb 2') + cb(null, 2) + }, 100) + } + ] + + series(tasks, function (err, results) { + t.error(err) + + // 2 should be second, even though it gets returned first + t.deepEqual(results, [1, 2]) + }) +}) diff --git a/node_modules/run-series/test/empty-array.js b/node_modules/run-series/test/empty-array.js new file mode 100644 index 00000000..603a1818 --- /dev/null +++ b/node_modules/run-series/test/empty-array.js @@ -0,0 +1,16 @@ +var series = require('../') +var test = require('tape') + +test('empty tasks array', function (t) { + t.plan(1) + + series([], function (err) { + t.error(err) + }) +}) + +test('empty tasks array and no callback', function (t) { + series([]) + t.pass('did not throw') + t.end() +}) diff --git a/node_modules/run-series/test/error.js b/node_modules/run-series/test/error.js new file mode 100644 index 00000000..4eef69fb --- /dev/null +++ b/node_modules/run-series/test/error.js @@ -0,0 +1,23 @@ +var series = require('../') +var test = require('tape') + +test('functions that return errors', function (t) { + t.plan(2) + + var tasks = [ + function (cb) { + t.pass('cb 1') + cb(new Error('oops')) + }, + function (cb) { + setTimeout(function () { + t.fail('should not execute') + cb(null, 2) + }, 100) + } + ] + + series(tasks, function (err) { + t.ok(err instanceof Error) + }) +}) diff --git a/node_modules/run-series/test/no-callback.js b/node_modules/run-series/test/no-callback.js new file mode 100644 index 00000000..b5768711 --- /dev/null +++ b/node_modules/run-series/test/no-callback.js @@ -0,0 +1,19 @@ +var series = require('../') +var test = require('tape') + +test('no callback', function (t) { + t.plan(2) + + var tasks = [ + function (cb) { + t.pass('cb 1') + cb(null) + }, + function (cb) { + t.pass('cb 2') + cb(null) + } + ] + + series(tasks) +}) diff --git a/node_modules/simple-get/.travis.yml b/node_modules/simple-get/.travis.yml new file mode 100644 index 00000000..18ae2d89 --- /dev/null +++ b/node_modules/simple-get/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.11" + - "0.10" diff --git a/node_modules/simple-get/LICENSE b/node_modules/simple-get/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/simple-get/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/simple-get/README.md b/node_modules/simple-get/README.md new file mode 100644 index 00000000..7d50d63c --- /dev/null +++ b/node_modules/simple-get/README.md @@ -0,0 +1,112 @@ +# simple-get [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] + +[travis-image]: https://img.shields.io/travis/feross/simple-get.svg?style=flat +[travis-url]: https://travis-ci.org/feross/simple-get +[npm-image]: https://img.shields.io/npm/v/simple-get.svg?style=flat +[npm-url]: https://npmjs.org/package/simple-get +[downloads-image]: https://img.shields.io/npm/dm/simple-get.svg?style=flat +[downloads-url]: https://npmjs.org/package/simple-get + +### Simplest way to make http get requests + +## features + +This module is designed to be the lightest possible wrapper on top of node.js `http`, but supporting: + +- follows redirects +- automatically handles gzip/deflate responses +- supports HTTPS +- supports convenience `url` key so there's no need to use `url.parse` on the url when specifying options + +All this in < 100 lines of code. + +## install + +``` +npm install simple-get +``` + +## usage + +### simple GET request + +Doesn't get easier than this: + +```js +var get = require('simple-get') + +get('http://example.com', function (err, res) { + if (err) throw err + console.log(res.statusCode) // 200 + res.pipe(process.stdout) // `res` is a stream +}) +``` + +### even simpler GET request + +If you just want the data, and don't want to deal with streams: + +```js +var get = require('simple-get') + +get.concat('http://example.com', function (err, data, res) { + if (err) throw err + console.log(res.statusCode) // 200 + console.log(data) // 'this is the server response' +}) +``` + +### POST, PUT, PATCH, HEAD, DELETE support + +For `POST`, call `get.post` or use option `{ method: 'POST' }`. + +```js +var get = require('simple-get') + +var opts = { + url: 'http://example.com', + body: 'this is the POST body' +} +get.post(opts, function (err, res) { + if (err) throw err + res.pipe(process.stdout) // `res` is a stream +}) +``` + +A more complex example: + +```js +var get = require('simple-get') +var concat = require('concat-stream') + +get({ + url: 'http://example.com', + method: 'POST', + body: 'this is the POST body', + + // simple-get accepts all options that node.js `http` accepts + // See: http://nodejs.org/api/http.html#http_http_request_options_callback + headers: { + 'user-agent': 'my cool app' + } +}, function (err, res) { + if (err) throw err + + // All properties/methods from http.IncomingResponse are available, + // even if a gunzip/inflate transform stream was returned. + // See: http://nodejs.org/api/http.html#http_http_incomingmessage + res.setTimeout(10000) + console.log(res.headers) + + res.pipe(concat(function (data) { + // `data` is the decoded response, after it's been gunzipped or inflated + // (if applicable) + console.log('got the response: ' + data) + })) + +}) +``` + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/simple-get/index.js b/node_modules/simple-get/index.js new file mode 100644 index 00000000..50124b13 --- /dev/null +++ b/node_modules/simple-get/index.js @@ -0,0 +1,98 @@ +module.exports = simpleGet + +var http = require('http') +var https = require('https') +var once = require('once') +var url = require('url') +var zlib = require('zlib') + +function simpleGet (opts, cb) { + if (typeof opts === 'string') opts = { url: opts } + cb = once(cb) + + // Follow redirects + if (opts.maxRedirects === 0) { + cb(new Error('too many redirects')) + return + } + if (!opts.maxRedirects) opts.maxRedirects = 10 + + if (opts.url) parseOptsUrl(opts) + if (!opts.headers) opts.headers = {} + + var body = opts.body + opts.body = undefined + if (body && !opts.method) opts.method = 'POST' + + // Request gzip/deflate + var customAcceptEncoding = Object.keys(opts.headers).some(function (h) { + return h.toLowerCase() === 'accept-encoding' + }) + if (!customAcceptEncoding) opts.headers['accept-encoding'] = 'gzip, deflate' + + // Support http: and https: urls + var protocol = opts.protocol === 'https:' ? https : http + var req = protocol.request(opts, function (res) { + // Follow 3xx redirects + if (res.statusCode >= 300 && res.statusCode < 400 && 'location' in res.headers) { + opts.url = res.headers.location + parseOptsUrl(opts) + res.resume() // Discard response + opts.maxRedirects -= 1 + return simpleGet(opts, cb) + } + + // Support gzip/deflate + if (['gzip', 'deflate'].indexOf(res.headers['content-encoding']) !== -1) { + // Pipe the response through an unzip stream (gunzip, inflate) and wrap it so it + // looks like an `http.IncomingMessage`. + var stream = zlib.createUnzip() + res.pipe(stream) + res.on('close', function () { stream.emit('close') }) + stream.httpVersion = res.httpVersion + stream.headers = res.headers + stream.trailers = res.trailers + stream.setTimeout = res.setTimeout.bind(res) + stream.method = res.method + stream.url = res.url + stream.statusCode = res.statusCode + stream.socket = res.socket + cb(null, stream) + } else { + cb(null, res) + } + }) + req.on('error', cb) + req.end(body) + return req +} + +module.exports.concat = function (opts, cb) { + return simpleGet(opts, function (err, res) { + if (err) return cb(err) + var chunks = [] + res.on('data', function (chunk) { + chunks.push(chunk) + }) + res.on('end', function () { + cb(null, Buffer.concat(chunks), res) + }) + }) +} + +;['get', 'post', 'put', 'patch', 'head', 'delete'].forEach(function (method) { + module.exports[method] = function (opts, cb) { + if (typeof opts === 'string') opts = { url: opts } + opts.method = method.toUpperCase() + return simpleGet(opts, cb) + } +}) + +function parseOptsUrl (opts) { + var loc = url.parse(opts.url) + if (loc.hostname) opts.hostname = loc.hostname + if (loc.port) opts.port = loc.port + if (loc.protocol) opts.protocol = loc.protocol + opts.path = loc.path + delete opts.url +} diff --git a/node_modules/simple-get/node_modules/once/LICENSE b/node_modules/simple-get/node_modules/once/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/simple-get/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/simple-get/node_modules/once/README.md b/node_modules/simple-get/node_modules/once/README.md new file mode 100644 index 00000000..a2981ea0 --- /dev/null +++ b/node_modules/simple-get/node_modules/once/README.md @@ -0,0 +1,51 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` diff --git a/node_modules/simple-get/node_modules/once/node_modules/wrappy/LICENSE b/node_modules/simple-get/node_modules/once/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/simple-get/node_modules/once/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/simple-get/node_modules/once/node_modules/wrappy/README.md b/node_modules/simple-get/node_modules/once/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/simple-get/node_modules/once/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/simple-get/node_modules/once/node_modules/wrappy/package.json b/node_modules/simple-get/node_modules/once/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/simple-get/node_modules/once/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-get/node_modules/once/node_modules/wrappy/test/basic.js b/node_modules/simple-get/node_modules/once/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/simple-get/node_modules/once/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/simple-get/node_modules/once/node_modules/wrappy/wrappy.js b/node_modules/simple-get/node_modules/once/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/simple-get/node_modules/once/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/simple-get/node_modules/once/once.js b/node_modules/simple-get/node_modules/once/once.js new file mode 100644 index 00000000..2e1e721b --- /dev/null +++ b/node_modules/simple-get/node_modules/once/once.js @@ -0,0 +1,21 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} diff --git a/node_modules/simple-get/node_modules/once/package.json b/node_modules/simple-get/node_modules/once/package.json new file mode 100644 index 00000000..dc007787 --- /dev/null +++ b/node_modules/simple-get/node_modules/once/package.json @@ -0,0 +1,60 @@ +{ + "name": "once", + "version": "1.3.2", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "~0.3.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once.git" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "gitHead": "e35eed5a7867574e2bf2260a1ba23970958b22f2", + "bugs": { + "url": "https://github.com/isaacs/once/issues" + }, + "homepage": "https://github.com/isaacs/once#readme", + "_id": "once@1.3.2", + "_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "_from": "once@>=1.3.1 <2.0.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "tarball": "http://registry.npmjs.org/once/-/once-1.3.2.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "_resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-get/node_modules/once/test/once.js b/node_modules/simple-get/node_modules/once/test/once.js new file mode 100644 index 00000000..c618360d --- /dev/null +++ b/node_modules/simple-get/node_modules/once/test/once.js @@ -0,0 +1,23 @@ +var test = require('tap').test +var once = require('../once.js') + +test('once', function (t) { + var f = 0 + function fn (g) { + t.equal(f, 0) + f ++ + return f + g + this + } + fn.ownProperty = {} + var foo = once(fn) + t.equal(fn.ownProperty, foo.ownProperty) + t.notOk(foo.called) + for (var i = 0; i < 1E3; i++) { + t.same(f, i === 0 ? 0 : 1) + var g = foo.call(1, 1) + t.ok(foo.called) + t.same(g, 3) + t.same(f, 1) + } + t.end() +}) diff --git a/node_modules/simple-get/package.json b/node_modules/simple-get/package.json new file mode 100644 index 00000000..0837d205 --- /dev/null +++ b/node_modules/simple-get/package.json @@ -0,0 +1,72 @@ +{ + "name": "simple-get", + "description": "Simplest way to make http get requests. Supports HTTPS, redirects, gzip/deflate, streams in < 100 lines.", + "version": "1.3.3", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/simple-get/issues" + }, + "dependencies": { + "once": "^1.3.1" + }, + "devDependencies": { + "concat-stream": "^1.4.7", + "self-signed-https": "^1.0.5", + "standard": "^3.3.0", + "string-to-stream": "^1.0.0", + "tape": "^4.0.0" + }, + "homepage": "https://github.com/feross/simple-get", + "keywords": [ + "request", + "http", + "GET", + "get request", + "http.get", + "redirects", + "follow redirects", + "gzip", + "deflate", + "https", + "http-https", + "stream", + "simple request", + "simple get" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/simple-get.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + }, + "gitHead": "9d150846e370e1999598e351ca8f1a971ec065d6", + "_id": "simple-get@1.3.3", + "_shasum": "03e4102ff8372034dbc92c2630a78f8440dbf81a", + "_from": "simple-get@1.3.3", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "03e4102ff8372034dbc92c2630a78f8440dbf81a", + "tarball": "http://registry.npmjs.org/simple-get/-/simple-get-1.3.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/simple-get/-/simple-get-1.3.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-get/test/basic.js b/node_modules/simple-get/test/basic.js new file mode 100644 index 00000000..1d31a1d9 --- /dev/null +++ b/node_modules/simple-get/test/basic.js @@ -0,0 +1,340 @@ +var concat = require('concat-stream') +var http = require('http') +var get = require('../') +var selfSignedHttps = require('self-signed-https') +var str = require('string-to-stream') +var test = require('tape') +var zlib = require('zlib') + +// Allow self-signed certs +process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' + +test('simple get', function (t) { + t.plan(4) + + var server = http.createServer(function (req, res) { + t.equal(req.url, '/path') + res.statusCode = 200 + res.end('response') + }) + + server.listen(0, function () { + var port = server.address().port + get('http://localhost:' + port + '/path', function (err, res) { + t.error(err) + t.equal(res.statusCode, 200) + res.pipe(concat(function (data) { + t.equal(data.toString(), 'response') + server.close() + })) + }) + }) +}) + +test('follow redirects (up to 10)', function (t) { + t.plan(13) + + var num = 1 + var server = http.createServer(function (req, res) { + t.equal(req.url, '/' + num, 'visited /' + num) + num += 1 + + if (num <= 10) { + res.statusCode = 301 + res.setHeader('Location', '/' + num) + res.end() + } else { + res.statusCode = 200 + res.end('response') + } + }) + + server.listen(0, function () { + var port = server.address().port + get('http://localhost:' + port + '/1', function (err, res) { + t.error(err) + t.equal(res.statusCode, 200) + res.pipe(concat(function (data) { + t.equal(data.toString(), 'response') + server.close() + })) + }) + }) +}) + +test('follow redirects (11 is too many)', function (t) { + t.plan(11) + + var num = 1 + var server = http.createServer(function (req, res) { + t.equal(req.url, '/' + num, 'visited /' + num) + num += 1 + + res.statusCode = 301 + res.setHeader('Location', '/' + num) + res.end() + }) + + server.listen(0, function () { + var port = server.address().port + get('http://localhost:' + port + '/1', function (err) { + t.ok(err instanceof Error, 'got error') + server.close() + }) + }) +}) + +test('custom headers', function (t) { + t.plan(2) + + var server = http.createServer(function (req, res) { + t.equal(req.headers['custom-header'], 'custom-value') + res.statusCode = 200 + res.end('response') + }) + + server.listen(0, function () { + var port = server.address().port + get({ + url: 'http://localhost:' + port, + headers: { + 'custom-header': 'custom-value' + } + }, function (err, res) { + t.error(err) + res.resume() + server.close() + }) + }) +}) + +test('gzip response', function (t) { + t.plan(3) + + var server = http.createServer(function (req, res) { + res.statusCode = 200 + res.setHeader('content-encoding', 'gzip') + str('response').pipe(zlib.createGzip()).pipe(res) + }) + + server.listen(0, function () { + var port = server.address().port + get('http://localhost:' + port, function (err, res) { + t.error(err) + t.equal(res.statusCode, 200) // statusCode still works on gunzip stream + res.pipe(concat(function (data) { + t.equal(data.toString(), 'response') + server.close() + })) + }) + }) +}) + +test('deflate response', function (t) { + t.plan(3) + + var server = http.createServer(function (req, res) { + res.statusCode = 200 + res.setHeader('content-encoding', 'deflate') + str('response').pipe(zlib.createDeflate()).pipe(res) + }) + + server.listen(0, function () { + var port = server.address().port + get('http://localhost:' + port, function (err, res) { + t.error(err) + t.equal(res.statusCode, 200) // statusCode still works on inflate stream + res.pipe(concat(function (data) { + t.equal(data.toString(), 'response') + server.close() + })) + }) + }) +}) + +test('https', function (t) { + t.plan(4) + + var server = selfSignedHttps(function (req, res) { + t.equal(req.url, '/path') + res.statusCode = 200 + res.end('response') + }) + + server.listen(0, function () { + var port = server.address().port + get('https://localhost:' + port + '/path', function (err, res) { + t.error(err) + t.equal(res.statusCode, 200) + res.pipe(concat(function (data) { + t.equal(data.toString(), 'response') + server.close() + })) + }) + }) +}) + +test('redirect https to http', function (t) { + t.plan(5) + + var httpPort = null + var httpsPort = null + + var httpsServer = selfSignedHttps(function (req, res) { + t.equal(req.url, '/path1') + res.statusCode = 301 + res.setHeader('Location', 'http://localhost:' + httpPort + '/path2') + res.end() + }) + + var httpServer = http.createServer(function (req, res) { + t.equal(req.url, '/path2') + res.statusCode = 200 + res.end('response') + }) + + httpsServer.listen(0, function () { + httpsPort = httpsServer.address().port + httpServer.listen(0, function () { + httpPort = httpServer.address().port + get('https://localhost:' + httpsPort + '/path1', function (err, res) { + t.error(err) + t.equal(res.statusCode, 200) + res.pipe(concat(function (data) { + t.equal(data.toString(), 'response') + httpsServer.close() + httpServer.close() + })) + }) + }) + }) +}) + +test('redirect http to https', function (t) { + t.plan(5) + + var httpsPort = null + var httpPort = null + + var httpServer = http.createServer(function (req, res) { + t.equal(req.url, '/path1') + res.statusCode = 301 + res.setHeader('Location', 'https://localhost:' + httpsPort + '/path2') + res.end() + }) + + var httpsServer = selfSignedHttps(function (req, res) { + t.equal(req.url, '/path2') + res.statusCode = 200 + res.end('response') + }) + + httpServer.listen(0, function () { + httpPort = httpServer.address().port + httpsServer.listen(0, function () { + httpsPort = httpsServer.address().port + get('http://localhost:' + httpPort + '/path1', function (err, res) { + t.error(err) + t.equal(res.statusCode, 200) + res.pipe(concat(function (data) { + t.equal(data.toString(), 'response') + httpsServer.close() + httpServer.close() + })) + }) + }) + }) +}) + +test('post (text body)', function (t) { + t.plan(4) + + var server = http.createServer(function (req, res) { + t.equal(req.method, 'POST') + res.statusCode = 200 + req.pipe(res) + }) + + server.listen(0, function () { + var port = server.address().port + var opts = { + url: 'http://localhost:' + port, + body: 'this is the body' + } + get.post(opts, function (err, res) { + t.error(err) + t.equal(res.statusCode, 200) + res.pipe(concat(function (data) { + t.equal(data.toString(), 'this is the body') + server.close() + })) + }) + }) +}) + +test('post (buffer body)', function (t) { + t.plan(4) + + var server = http.createServer(function (req, res) { + t.equal(req.method, 'POST') + res.statusCode = 200 + req.pipe(res) + }) + + server.listen(0, function () { + var port = server.address().port + var opts = { + url: 'http://localhost:' + port, + body: new Buffer('this is the body') + } + get.post(opts, function (err, res) { + t.error(err) + t.equal(res.statusCode, 200) + res.pipe(concat(function (data) { + t.equal(data.toString(), 'this is the body') + server.close() + })) + }) + }) +}) + +test('get.concat', function (t) { + t.plan(4) + var server = http.createServer(function (req, res) { + res.statusCode = 200 + res.end('blah blah blah') + }) + + server.listen(0, function () { + var port = server.address().port + get.concat('http://localhost:' + port, function (err, data, res) { + t.error(err) + t.equal(res.statusCode, 200) + t.ok(Buffer.isBuffer(data), '`data` is type buffer') + t.equal(data.toString(), 'blah blah blah') + server.close() + }) + }) +}) + +test('access `req` object', function (t) { + t.plan(2) + + var server = http.createServer(function (req, res) { + res.statusCode = 200 + res.end('response') + }) + + server.listen(0, function () { + var port = server.address().port + var req = get('http://localhost:' + port, function (err, res) { + t.error(err) + res.resume() // discard data + server.close() + }) + + req.on('socket', function () { + t.pass('got `socket` event') + }) + }) +}) diff --git a/node_modules/simple-peer/.travis.yml b/node_modules/simple-peer/.travis.yml new file mode 100644 index 00000000..29f86f93 --- /dev/null +++ b/node_modules/simple-peer/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +sudo: false +node_js: + - '0.10' +env: + global: + - secure: nx+k8PyPPr5BAfJQf4eaKr4DZZoTe5Ef1MalZ97KRCEV87Tqwi/XwqNN4gEbpzUpKcVyc/Jasml1uOmCqFO93zSjUFUozjiO3C0R2BT6AL1XtslyORocA5zmMMwTj+rRux4y0fWFNTIpqp5pBPYdYd7VOpRIlcZjY0dddoZht+g= + - secure: USW/3KjJcPBeGe17mrjB5yjRqYdjZCTWALeC5dWGE9HIn10MR7kzPBYCG7+H4JYBXKKPljB8jzjAuTv9KzQLeTbPQsVKzEqLGhDo4wq1qmIg9BmaSZtMZgwoBQ7kV1xjbzG7jcy3xhIpXMc3kT/1HLv1XSMGcusXZ7izKhi/dc8= diff --git a/node_modules/simple-peer/.zuul.yml b/node_modules/simple-peer/.zuul.yml new file mode 100644 index 00000000..a71898c2 --- /dev/null +++ b/node_modules/simple-peer/.zuul.yml @@ -0,0 +1,6 @@ +ui: tape +browsers: + - name: chrome + version: latest + - name: firefox + version: latest diff --git a/node_modules/simple-peer/LICENSE b/node_modules/simple-peer/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/simple-peer/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/simple-peer/README.md b/node_modules/simple-peer/README.md new file mode 100644 index 00000000..14bf2c8e --- /dev/null +++ b/node_modules/simple-peer/README.md @@ -0,0 +1,369 @@ +# simple-peer [![travis](https://img.shields.io/travis/feross/simple-peer.svg?style=flat)](https://travis-ci.org/feross/simple-peer) [![npm](https://img.shields.io/npm/v/simple-peer.svg?style=flat)](https://npmjs.org/package/simple-peer) [![npm downloads](https://img.shields.io/npm/dm/simple-peer.svg?style=flat)](https://npmjs.org/package/simple-peer) + +#### Simple WebRTC video/voice and data channels. + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/feross-simple-peer.svg)](https://saucelabs.com/u/feross-simple-peer) + +## features + +- concise, **node.js style** API for [WebRTC](https://en.wikipedia.org/wiki/WebRTC) +- **works in node and the browser!** +- supports **video/voice streams** +- supports **data channel** + - text and binary data + - node.js [duplex stream](http://nodejs.org/api/stream.html) interface +- supports advanced options like: + - enable/disable [trickle ICE candidates](http://webrtchacks.com/trickle-ice/) + - manually set config and constraints options + +This module works in the browser with [browserify](http://browserify.org/). + +**Note:** If you're **NOT** using browserify, then use the included standalone file +`simplepeer.min.js`. This exports a `SimplePeer` constructor on `window`. + +## install + +``` +npm install simple-peer +``` + +## usage + +These examples create two peers in the same page. + +In a real-world application, the sender and receiver `Peer` instances would exist in +separate browsers. A "signaling server" (usually implemented with websockets) would be +used to exchange signaling data between the two browsers until a peer-to-peer connection +is established. + +### data channels + +```js +var SimplePeer = require('simple-peer') + +var peer1 = new SimplePeer({ initiator: true }) +var peer2 = new SimplePeer() + +peer1.on('signal', function (data) { + // when peer1 has signaling data, give it to peer2 + peer2.signal(data) +}) + +peer2.on('signal', function (data) { + // same as above, but in reverse + peer1.signal(data) +}) + +peer1.on('connect', function () { + // wait for 'connect' event before using the data channel + peer1.send('hey peer2, how is it going?') +}) + +peer2.on('data', function (data) { + // got a data channel message + console.log('got a message from peer1: ' + data) +}) +``` + +### video/voice + +Video/voice is also super simple! In this example, peer1 sends video to peer2. + +```js +var SimplePeer = require('simple-peer') + +// get video/voice stream +navigator.getUserMedia({ video: true, audio: true }, gotMedia, function () {}) + +function gotMedia (stream) { + var peer1 = new SimplePeer({ initiator: true, stream: stream }) + var peer2 = new SimplePeer() + + peer1.on('signal', function (data) { + peer2.signal(data) + }) + + peer2.on('signal', function (data) { + peer1.signal(data) + }) + + peer2.on('stream', function (stream) { + // got remote video stream, now let's show it in a video tag + var video = document.querySelector('video') + video.src = window.URL.createObjectURL(stream) + video.play() + }) +} +``` + +For two-way video, simply pass a `stream` option into both `Peer` constructors. Simple! + +### in node + +To use this library in node, pass in `opts.wrtc` as a parameter: + +```js +var SimplePeer = require('simple-peer') +var wrtc = require('wrtc') + +var peer1 = new SimplePeer({ initiator: true, wrtc: wrtc }) +var peer2 = new SimplePeer({ wrtc: wrtc }) +``` + +## production apps that use `simple-peer` + +- [Friends](https://github.com/moose-team/friends) - P2P chat powered by the web +- [ScreenCat](https://maxogden.github.io/screencat/) - screen sharing + remote collaboration app +- [WebCat](https://github.com/mafintosh/webcat) - P2P pipe across the web using Github private/public key for auth +- [Instant.io](https://instant.io) - Secure, anonymous, streaming file transfer +- [WebTorrent](http://webtorrent.io) - Streaming torrent client in the browser +- [PusherTC](http://pushertc.herokuapp.com) - Video chat with using Pusher. See [guide](http://blog.carbonfive.com/2014/10/16/webrtc-made-simple/). +- [lxjs-chat](https://github.com/feross/lxjs-chat) - Omegle-like video chat site [demo] +- *Your app here! - send a PR!* + +## api + +### `peer = new SimplePeer([opts])` + +Create a new WebRTC peer connection. + +A "data channel" for text/binary communication is always established, because it's cheap and often useful. For video/voice communication, pass the `stream` option. + +If `opts` is specified, then the default options (shown below) will be overridden. + +``` +{ + initiator: false, + stream: false, + config: { iceServers: [ { url: 'stun:23.21.150.121' } ] }, + constraints: {}, + channelName: '', + trickle: true, + wrtc: {} // RTCPeerConnection/RTCSessionDescription/RTCIceCandidate +} +``` + +The options do the following: + +- `initiator` - set to true if this is the initiating peer +- `stream` - if video/voice is desired, pass stream returned from `getUserMedia` +- `config` - custom webrtc configuration +- `constraints` - custom webrtc video/voice constaints +- `channelName` - custom webrtc data channel name +- `trickle` - set to `false` to disable [trickle ICE](http://webrtchacks.com/trickle-ice/) and get a single 'signal' event (slower) +- `wrtc` - custom webrtc implementation, mainly useful in node to specify in the [wrtc](https://npmjs.com/package/wrtc) package + +### `peer.signal(data)` + +Call this method whenever the remote peer emits a `peer.on('signal')` event. + +The `data` will be a `String` that encapsulates a webrtc offer, answer, or ice candidate. These messages help the peers to eventually establish a direct connection to each other. The contents of these strings are an implementation detail that can be ignored by the user of this module; simply pass the data from 'signal' events to the remote peer, call `peer.signal(data)`, and everything will just work. + +### `peer.send(data)` + +Send text/binary data to the remote peer. `data` can be any of several types: `String`, `Buffer` (see [buffer](https://github.com/feross/buffer)), `TypedArrayView` (`Uint8Array`, etc.), `ArrayBuffer`, or `Blob` (in browsers that support it). + +Other data types will be transformed with `JSON.stringify` before sending. This is handy +for sending object literals across like this: +`peer.send({ type: 'data', data: 'hi' })`. + +Note: If this method is called before the `peer.on('connect')` event has fired, then data +will be buffered. + +### `peer.destroy([onclose])` + +Destroy and cleanup this peer connection. + +If the optional `onclose` parameter is passed, then it will be registered as a listener on the 'close' event. + +### `Peer.WEBRTC_SUPPORT` + +Detect WebRTC support by checking this static property. + +```js +var Peer = require('simple-peer') + +if (Peer.WEBRTC_SUPPORT) { + // webrtc support! +} else { + // fallback +} +``` + +### duplex stream + +`Peer` objects are instances of `stream.Duplex`. The behave very similarly to a +`net.Socket` from the node core `net` module. The duplex stream reads/writes to the data +channel. + +```js +var peer = new Peer(opts) +// ... signaling ... +peer.write(new Buffer('hey')) +peer.on('data', function (chunk) { + console.log('got a chunk', chunk) +}) +``` + +## events + + +### `peer.on('signal', function (data) {})` + +Fired when the peer wants to send signaling data to the remote peer. + +**It is the responsibility of the application developer (that's you!) to get this data to the other peer.** This usually entails using a websocket signaling server. Then, simply call `peer.signal(data)` on the remote peer. + +### `peer.on('connect', function () {})` + +Fired when the peer connection and data channel are ready to use. + +### `peer.on('data', function (data) {})` + +Received a message from the remote peer (via the data channel). + +`data` will be either a `String` or a `Buffer/Uint8Array` (see [buffer](https://github.com/feross/buffer)). + +### `peer.on('stream', function (stream) {})` + +Received a remote video stream, which can be displayed in a video tag: + +```js +peer.on('stream', function (stream) { + var video = document.createElement('video') + video.src = window.URL.createObjectURL(stream) + document.body.appendChild(video) + video.play() +}) +``` + +### `peer.on('close', function () {})` + +Called when the peer connection has closed. + +### `peer.on('error', function (err) {})` + +Fired when a fatal error occurs. Usually, this means bad signaling data was received from the remote peer. + +`err` is an `Error` object. + +## connecting more than 2 peers? + +The simplest way to do that is to create a full-mesh topology. That means that every peer +opens a connection to every other peer. To illustrate: + +![full mesh topology](img/full-mesh.png) + +To broadcast a message, just iterate over all the peers and call `peer.send`. + +So, say you have 3 peers. Then, when a peer wants to send some data it must send it 2 +times, once to each of the other peers. So you're going to want to be a bit careful about +the size of the data you send. + +Full mesh topologies don't scale well when the number of peers is very large. The total +number of edges in the network will be ![full mesh formula](img/full-mesh-formula.png) +where `n` is the number of peers. + +For clarity, here is the code to connect 3 peers together: + +#### Peer 1 + +```js +// These are peer1's connections to peer2 and peer3 +var peer2 = new SimplePeer({ initiator: true }) +var peer3 = new SimplePeer({ initiator: true }) + +peer2.on('signal', function (data) { + // send this signaling data to peer2 somehow +}) + +peer2.on('connect', function () { + peer2.send('hi peer2, this is peer1') +}) + +peer2.on('data', function (data) { + console.log('got a message from peer2: ' + data) +}) + +peer3.on('signal', function (data) { + // send this signaling data to peer3 somehow +}) + +peer3.on('connect', function () { + peer3.send('hi peer3, this is peer1') +}) + +peer3.on('data', function (data) { + console.log('got a message from peer3: ' + data) +}) +``` + +#### Peer 2 + +```js +// These are peer2's connections to peer1 and peer3 +var peer1 = new SimplePeer() +var peer3 = new SimplePeer({ initiator: true }) + +peer1.on('signal', function (data) { + // send this signaling data to peer1 somehow +}) + +peer1.on('connect', function () { + peer1.send('hi peer1, this is peer2') +}) + +peer1.on('data', function (data) { + console.log('got a message from peer1: ' + data) +}) + +peer3.on('signal', function (data) { + // send this signaling data to peer3 somehow +}) + +peer3.on('connect', function () { + peer3.send('hi peer3, this is peer2') +}) + +peer3.on('data', function (data) { + console.log('got a message from peer3: ' + data) +}) +``` + +#### Peer 3 + +```js +// These are peer3's connections to peer1 and peer2 +var peer1 = new SimplePeer() +var peer2 = new SimplePeer() + +peer1.on('signal', function (data) { + // send this signaling data to peer1 somehow +}) + +peer1.on('connect', function () { + peer1.send('hi peer1, this is peer3') +}) + +peer1.on('data', function (data) { + console.log('got a message from peer1: ' + data) +}) + +peer2.on('signal', function (data) { + // send this signaling data to peer2 somehow +}) + +peer2.on('connect', function () { + peer2.send('hi peer2, this is peer3') +}) + +peer2.on('data', function (data) { + console.log('got a message from peer2: ' + data) +}) +``` + +[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard) + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/simple-peer/img/full-mesh-formula.png b/node_modules/simple-peer/img/full-mesh-formula.png new file mode 100644 index 00000000..c1d16d5b Binary files /dev/null and b/node_modules/simple-peer/img/full-mesh-formula.png differ diff --git a/node_modules/simple-peer/img/full-mesh.png b/node_modules/simple-peer/img/full-mesh.png new file mode 100644 index 00000000..7269ff33 Binary files /dev/null and b/node_modules/simple-peer/img/full-mesh.png differ diff --git a/node_modules/simple-peer/index.js b/node_modules/simple-peer/index.js new file mode 100644 index 00000000..ef593d10 --- /dev/null +++ b/node_modules/simple-peer/index.js @@ -0,0 +1,494 @@ +/* global Blob */ + +module.exports = Peer + +var debug = require('debug')('simple-peer') +var extend = require('xtend/mutable') +var hat = require('hat') +var inherits = require('inherits') +var isTypedArray = require('is-typedarray') +var once = require('once') +var stream = require('stream') +var toBuffer = require('typedarray-to-buffer') + +inherits(Peer, stream.Duplex) + +/** + * WebRTC peer connection. Same API as node core `net.Socket`, plus a few extra methods. + * Duplex stream. + * @param {Object} opts + */ +function Peer (opts) { + var self = this + if (!(self instanceof Peer)) return new Peer(opts) + if (!opts) opts = {} + + extend(self, { + initiator: false, + stream: false, + config: Peer.config, + constraints: Peer.constraints, + channelName: (opts && opts.initiator) ? hat(160) : null, + trickle: true, + allowHalfOpen: false, // duplex stream option + highWaterMark: 1024 * 1024 // duplex stream option + }, opts) + + stream.Duplex.call(self, opts) + + var wrtc = opts.wrtc || getBrowserRTC() + if (!wrtc && typeof window === 'undefined') { + throw new Error('Missing WebRTC support - You must supply ' + + '`opts.wrtc` in this environment') + } else if (!wrtc) { + throw new Error('Missing WebRTC support - is this a supported browser?') + } + self._wrtc = wrtc + + self._debug('new peer (initiator: %s)', self.initiator) + + self.destroyed = false + self.connected = false + + self.remoteAddress = undefined + self.remoteFamily = undefined + self.remotePort = undefined + self.localAddress = undefined + self.localPort = undefined + + self._pcReady = false + self._channelReady = false + self._iceComplete = false // ice candidate trickle done (got null candidate) + self._channel = null + + self._chunk = null + self._cb = null + self._interval + + self._pc = new (self._wrtc.RTCPeerConnection)(self.config, self.constraints) + self._pc.oniceconnectionstatechange = self._onIceConnectionStateChange.bind(self) + self._pc.onsignalingstatechange = self._onSignalingStateChange.bind(self) + self._pc.onicecandidate = self._onIceCandidate.bind(self) + + if (self.stream) self._pc.addStream(self.stream) + self._pc.onaddstream = self._onAddStream.bind(self) + + if (self.initiator) { + self._setupData({ channel: self._pc.createDataChannel(self.channelName) }) + self._pc.onnegotiationneeded = once(self._createOffer.bind(self)) + // Only Chrome triggers "negotiationneeded"; this is a workaround for other + // implementations + if (typeof window === 'undefined' || !window.webkitRTCPeerConnection) { + self._pc.onnegotiationneeded() + } + } else { + self._pc.ondatachannel = self._setupData.bind(self) + } + + self.on('finish', function () { + if (self.connected) { + // When local peer is finished writing, close connection to remote peer. + // Half open connections are currently not supported. + // Wait a bit before destroying so the datachannel flushes. + // TODO: is there a more reliable way to accomplish this? + setTimeout(function () { + self._destroy() + }, 100) + } else { + // If data channel is not connected when local peer is finished writing, wait until + // data is flushed to network at "connect" event. + // TODO: is there a more reliable way to accomplish this? + self.once('connect', function () { + setTimeout(function () { + self._destroy() + }, 100) + }) + } + }) +} + +Peer.WEBRTC_SUPPORT = !!getBrowserRTC() + +/** + * Expose config and constraints for overriding all Peer instances. Otherwise, just + * set opts.config and opts.constraints when constructing a Peer. + */ +Peer.config = { + iceServers: [ + { + url: 'stun:23.21.150.121', // deprecated, replaced by `urls` + urls: 'stun:23.21.150.121' + } + ] +} +Peer.constraints = {} + +Object.defineProperty(Peer.prototype, 'bufferSize', { + get: function () { + var self = this + return (self._channel && self._channel.bufferedAmount) || 0 + } +}) + +Peer.prototype.address = function () { + var self = this + return { port: self.localPort, family: 'IPv4', address: self.localAddress } +} + +Peer.prototype.signal = function (data) { + var self = this + if (self.destroyed) throw new Error('cannot signal after peer is destroyed') + if (typeof data === 'string') { + try { + data = JSON.parse(data) + } catch (err) { + data = {} + } + } + self._debug('signal()') + if (data.sdp) { + self._pc.setRemoteDescription(new (self._wrtc.RTCSessionDescription)(data), function () { + if (self._pc.remoteDescription.type === 'offer') self._createAnswer() + }, self._onError.bind(self)) + } + if (data.candidate) { + try { + self._pc.addIceCandidate( + new (self._wrtc.RTCIceCandidate)(data.candidate), noop, self._onError.bind(self) + ) + } catch (err) { + self._destroy(new Error('error adding candidate: ' + err.message)) + } + } + if (!data.sdp && !data.candidate) { + self._destroy(new Error('signal() called with invalid signal data')) + } +} + +Peer.prototype.send = function (chunk) { + var self = this + var len = chunk.length || chunk.byteLength || chunk.size + + // `wrtc` module doesn't accept node.js buffer + if (Buffer.isBuffer(chunk) && !isTypedArray.strict(chunk)) { + chunk = new Uint8Array(chunk) + } + + self._channel.send(chunk) + self._debug('write: %d bytes', len) +} + +Peer.prototype.destroy = function (onclose) { + var self = this + self._destroy(null, onclose) +} + +Peer.prototype._destroy = function (err, onclose) { + var self = this + if (self.destroyed) return + if (onclose) self.once('close', onclose) + + self._debug('destroy (error: %s)', err && err.message) + + self.destroyed = true + self.connected = false + self._pcReady = false + self._channelReady = false + + clearInterval(self._interval) + self._interval = null + self._chunk = null + self._cb = null + + if (self._pc) { + try { + self._pc.close() + } catch (err) {} + + self._pc.oniceconnectionstatechange = null + self._pc.onsignalingstatechange = null + self._pc.onicecandidate = null + } + + if (self._channel) { + try { + self._channel.close() + } catch (err) {} + + self._channel.onmessage = null + self._channel.onopen = null + self._channel.onclose = null + } + self._pc = null + self._channel = null + + self.readable = self.writable = false + + if (!self._readableState.ended) self.push(null) + if (!self._writableState.finished) self.end() + + if (err) self.emit('error', err) + self.emit('close') +} + +Peer.prototype._setupData = function (event) { + var self = this + self._channel = event.channel + self.channelName = self._channel.label + + self._channel.binaryType = 'arraybuffer' + self._channel.onmessage = self._onChannelMessage.bind(self) + self._channel.onopen = self._onChannelOpen.bind(self) + self._channel.onclose = self._onChannelClose.bind(self) +} + +Peer.prototype._read = function () {} + +/** + * Send text/binary data to the remote peer. + * @param {string|Buffer|TypedArrayView|ArrayBuffer|Blob} chunk + * @param {string} encoding + * @param {function} cb + */ +Peer.prototype._write = function (chunk, encoding, cb) { + var self = this + if (self.destroyed) return cb(new Error('cannot write after peer is destroyed')) + + if (!isTypedArray.strict(chunk) && !(chunk instanceof ArrayBuffer) && + !Buffer.isBuffer(chunk) && typeof chunk !== 'string' && + (typeof Blob === 'undefined' || !(chunk instanceof Blob))) { + chunk = JSON.stringify(chunk) + } + + if (self.connected) { + self.send(chunk) + if (self._channel.bufferedAmount) { + self._debug('start backpressure: bufferedAmount %d', self._channel.bufferedAmount) + self._cb = cb + } else { + cb(null) + } + } else { + self._debug('write before connect') + self._chunk = chunk + self._cb = cb + } +} + +Peer.prototype._createOffer = function () { + var self = this + if (self.destroyed) return + + self._pc.createOffer(function (offer) { + if (self.destroyed) return + speedHack(offer) + self._pc.setLocalDescription(offer, noop, self._onError.bind(self)) + var sendOffer = function () { + self._debug('signal') + self.emit('signal', self._pc.localDescription || offer) + } + if (self.trickle || self._iceComplete) sendOffer() + else self.once('_iceComplete', sendOffer) // wait for candidates + }, self._onError.bind(self), self.offerConstraints) +} + +Peer.prototype._createAnswer = function () { + var self = this + if (self.destroyed) return + + self._pc.createAnswer(function (answer) { + if (self.destroyed) return + speedHack(answer) + self._pc.setLocalDescription(answer, noop, self._onError.bind(self)) + var sendAnswer = function () { + self._debug('signal') + self.emit('signal', self._pc.localDescription || answer) + } + if (self.trickle || self._iceComplete) sendAnswer() + else self.once('_iceComplete', sendAnswer) + }, self._onError.bind(self), self.answerConstraints) +} + +Peer.prototype._onIceConnectionStateChange = function () { + var self = this + if (self.destroyed) return + var iceGatheringState = self._pc.iceGatheringState + var iceConnectionState = self._pc.iceConnectionState + self._debug('iceConnectionStateChange %s %s', iceGatheringState, iceConnectionState) + self.emit('iceConnectionStateChange', iceGatheringState, iceConnectionState) + if (iceConnectionState === 'connected' || iceConnectionState === 'completed') { + self._pcReady = true + self._maybeReady() + } + if (iceConnectionState === 'disconnected' || iceConnectionState === 'closed') { + self._destroy() + } +} + +Peer.prototype._maybeReady = function () { + var self = this + self._debug('maybeReady pc %s channel %s', self._pcReady, self._channelReady) + if (self.connected || self._connecting || !self._pcReady || !self._channelReady) return + self._connecting = true + + if (typeof window !== 'undefined' && !!window.mozRTCPeerConnection) { + self._pc.getStats(null, function (res) { + var items = [] + res.forEach(function (item) { + items.push(item) + }) + onStats(items) + }, self._onError.bind(self)) + } else { + self._pc.getStats(function (res) { + var items = [] + res.result().forEach(function (result) { + var item = {} + result.names().forEach(function (name) { + item[name] = result.stat(name) + }) + item.id = result.id + item.type = result.type + item.timestamp = result.timestamp + items.push(item) + }) + onStats(items) + }) + } + + function onStats (items) { + items.forEach(function (item) { + if (item.type === 'remotecandidate') { + self.remoteAddress = item.ipAddress + self.remoteFamily = 'IPv4' + self.remotePort = Number(item.portNumber) + self._debug( + 'connect remote: %s:%s (%s)', + self.remoteAddress, self.remotePort, self.remoteFamily + ) + } else if (item.type === 'localcandidate' && item.candidateType === 'host') { + self.localAddress = item.ipAddress + self.localPort = Number(item.portNumber) + self._debug('connect local: %s:%s', self.localAddress, self.localPort) + } + }) + + self._connecting = false + self.connected = true + + if (self._chunk) { + self.send(self._chunk) + self._chunk = null + self._debug('sent chunk from "write before connect"') + + var cb = self._cb + self._cb = null + cb(null) + } + + self._interval = setInterval(function () { + if (!self._cb || !self._channel || self._channel.bufferedAmount) return + self._debug('ending backpressure: bufferedAmount %d', self._channel.bufferedAmount) + var cb = self._cb + self._cb = null + cb(null) + }, 150) + if (self._interval.unref) self._interval.unref() + + self._debug('connect') + self.emit('connect') + } +} + +Peer.prototype._onSignalingStateChange = function () { + var self = this + if (self.destroyed) return + self._debug('signalingStateChange %s', self._pc.signalingState) + self.emit('signalingStateChange', self._pc.signalingState) +} + +Peer.prototype._onIceCandidate = function (event) { + var self = this + if (self.destroyed) return + if (event.candidate && self.trickle) { + self.emit('signal', { candidate: event.candidate }) + } else if (!event.candidate) { + self._iceComplete = true + self.emit('_iceComplete') + } +} + +Peer.prototype._onChannelMessage = function (event) { + var self = this + if (self.destroyed) return + var data = event.data + self._debug('read: %d bytes', data.byteLength || data.length) + + if (data instanceof ArrayBuffer) { + data = toBuffer(new Uint8Array(data)) + self.push(data) + } else { + try { + data = JSON.parse(data) + } catch (err) {} + self.emit('data', data) + } +} + +Peer.prototype._onChannelOpen = function () { + var self = this + if (self.connected || self.destroyed) return + self._debug('on channel open') + self._channelReady = true + self._maybeReady() +} + +Peer.prototype._onChannelClose = function () { + var self = this + if (self.destroyed) return + self._debug('on channel close') + self._destroy() +} + +Peer.prototype._onAddStream = function (event) { + var self = this + if (self.destroyed) return + self._debug('on add stream') + self.emit('stream', event.stream) +} + +Peer.prototype._onError = function (err) { + var self = this + if (self.destroyed) return + self._debug('error %s', err.message || err) + self._destroy(err) +} + +Peer.prototype._debug = function () { + var self = this + var args = [].slice.call(arguments) + var id = self.channelName && self.channelName.substring(0, 7) + args[0] = '[' + id + '] ' + args[0] + debug.apply(null, args) +} + +function getBrowserRTC () { + if (typeof window === 'undefined') return null + var wrtc = { + RTCPeerConnection: window.mozRTCPeerConnection || window.RTCPeerConnection || + window.webkitRTCPeerConnection, + RTCSessionDescription: window.mozRTCSessionDescription || + window.RTCSessionDescription || window.webkitRTCSessionDescription, + RTCIceCandidate: window.mozRTCIceCandidate || window.RTCIceCandidate || + window.webkitRTCIceCandidate + } + if (!wrtc.RTCPeerConnection) return null + return wrtc +} + +function speedHack (obj) { + var s = obj.sdp.split('b=AS:30') + if (s.length > 1) obj.sdp = s[0] + 'b=AS:1638400' + s[1] +} + +function noop () {} diff --git a/node_modules/simple-peer/node_modules/debug/.jshintrc b/node_modules/simple-peer/node_modules/debug/.jshintrc new file mode 100644 index 00000000..299877f2 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/.jshintrc @@ -0,0 +1,3 @@ +{ + "laxbreak": true +} diff --git a/node_modules/simple-peer/node_modules/debug/.npmignore b/node_modules/simple-peer/node_modules/debug/.npmignore new file mode 100644 index 00000000..7e6163db --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/.npmignore @@ -0,0 +1,6 @@ +support +test +examples +example +*.sock +dist diff --git a/node_modules/simple-peer/node_modules/debug/History.md b/node_modules/simple-peer/node_modules/debug/History.md new file mode 100644 index 00000000..854c9711 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/History.md @@ -0,0 +1,195 @@ + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/simple-peer/node_modules/debug/Makefile b/node_modules/simple-peer/node_modules/debug/Makefile new file mode 100644 index 00000000..5cf4a596 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/Makefile @@ -0,0 +1,36 @@ + +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# applications +NODE ?= $(shell which node) +NPM ?= $(NODE) $(shell which npm) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +all: dist/debug.js + +install: node_modules + +clean: + @rm -rf dist + +dist: + @mkdir -p $@ + +dist/debug.js: node_modules browser.js debug.js dist + @$(BROWSERIFY) \ + --standalone debug \ + . > $@ + +distclean: clean + @rm -rf node_modules + +node_modules: package.json + @NODE_ENV= $(NPM) install + @touch node_modules + +.PHONY: all install clean distclean diff --git a/node_modules/simple-peer/node_modules/debug/Readme.md b/node_modules/simple-peer/node_modules/debug/Readme.md new file mode 100644 index 00000000..b4f45e3c --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/Readme.md @@ -0,0 +1,188 @@ +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +#### Windows note + + On Windows the environment variable is set using the `set` command. + + ```cmd + set DEBUG=*,-not_this + ``` + +Then, run the program to be debugged as usual. + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: + +```js +window.myDebug = require("debug"); +``` + + ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: + +```js +myDebug.enable("worker:*") +``` + + Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +#### Web Inspector Colors + + Colors are also enabled on "Web Inspectors" that understand the `%c` formatting + option. These are WebKit web inspectors, Firefox ([since version + 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) + and the Firebug plugin for Firefox (any version). + + Colored output looks something like: + + ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) + +### stderr vs stdout + +You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: + +Example _stdout.js_: + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +### Save debug output to a file + +You can save all debug statements to a file by piping them. + +Example: + +```bash +$ DEBUG_FD=3 node your-app.js 3> whatever.log +``` + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + +## License + +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +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/node_modules/simple-peer/node_modules/debug/bower.json b/node_modules/simple-peer/node_modules/debug/bower.json new file mode 100644 index 00000000..6af573ff --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/bower.json @@ -0,0 +1,28 @@ +{ + "name": "visionmedia-debug", + "main": "dist/debug.js", + "version": "2.2.0", + "homepage": "https://github.com/visionmedia/debug", + "authors": [ + "TJ Holowaychuk " + ], + "description": "visionmedia-debug", + "moduleType": [ + "amd", + "es6", + "globals", + "node" + ], + "keywords": [ + "visionmedia", + "debug" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/simple-peer/node_modules/debug/browser.js b/node_modules/simple-peer/node_modules/debug/browser.js new file mode 100644 index 00000000..7c764522 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/browser.js @@ -0,0 +1,168 @@ + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + return JSON.stringify(v); +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} diff --git a/node_modules/simple-peer/node_modules/debug/component.json b/node_modules/simple-peer/node_modules/debug/component.json new file mode 100644 index 00000000..ca106372 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "2.2.0", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + } +} diff --git a/node_modules/simple-peer/node_modules/debug/debug.js b/node_modules/simple-peer/node_modules/debug/debug.js new file mode 100644 index 00000000..7571a860 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/debug.js @@ -0,0 +1,197 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() { + } + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/simple-peer/node_modules/debug/node.js b/node_modules/simple-peer/node_modules/debug/node.js new file mode 100644 index 00000000..1d392a81 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/node.js @@ -0,0 +1,209 @@ + +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); + if (0 === debugColors.length) { + return tty.isatty(fd); + } else { + return '0' !== debugColors + && 'no' !== debugColors + && 'false' !== debugColors + && 'disabled' !== debugColors; + } +} + +/** + * Map %o to `util.inspect()`, since Node doesn't do that out of the box. + */ + +var inspect = (4 === util.inspect.length ? + // node <= 0.8.x + function (v, colors) { + return util.inspect(v, void 0, void 0, colors); + } : + // node > 0.8.x + function (v, colors) { + return util.inspect(v, { colors: colors }); + } +); + +exports.formatters.o = function(v) { + return inspect(v, this.useColors) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + var name = this.namespace; + + if (useColors) { + var c = this.color; + + args[0] = ' \u001b[3' + c + ';1m' + name + ' ' + + '\u001b[0m' + + args[0] + '\u001b[3' + c + 'm' + + ' +' + exports.humanize(this.diff) + '\u001b[0m'; + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } + return args; +} + +/** + * Invokes `console.error()` with the specified arguments. + */ + +function log() { + return stream.write(util.format.apply(this, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = require('fs'); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = require('net'); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/node_modules/simple-peer/node_modules/debug/node_modules/ms/.npmignore b/node_modules/simple-peer/node_modules/debug/node_modules/ms/.npmignore new file mode 100644 index 00000000..d1aa0ce4 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/node_modules/ms/.npmignore @@ -0,0 +1,5 @@ +node_modules +test +History.md +Makefile +component.json diff --git a/node_modules/simple-peer/node_modules/debug/node_modules/ms/History.md b/node_modules/simple-peer/node_modules/debug/node_modules/ms/History.md new file mode 100644 index 00000000..32fdfc17 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/node_modules/ms/History.md @@ -0,0 +1,66 @@ + +0.7.1 / 2015-04-20 +================== + + * prevent extraordinary long inputs (@evilpacket) + * Fixed broken readme link + +0.7.0 / 2014-11-24 +================== + + * add time abbreviations, updated tests and readme for the new units + * fix example in the readme. + * add LICENSE file + +0.6.2 / 2013-12-05 +================== + + * Adding repository section to package.json to suppress warning from NPM. + +0.6.1 / 2013-05-10 +================== + + * fix singularization [visionmedia] + +0.6.0 / 2013-03-15 +================== + + * fix minutes + +0.5.1 / 2013-02-24 +================== + + * add component namespace + +0.5.0 / 2012-11-09 +================== + + * add short formatting as default and .long option + * add .license property to component.json + * add version to component.json + +0.4.0 / 2012-10-22 +================== + + * add rounding to fix crazy decimals + +0.3.0 / 2012-09-07 +================== + + * fix `ms()` [visionmedia] + +0.2.0 / 2012-09-03 +================== + + * add component.json [visionmedia] + * add days support [visionmedia] + * add hours support [visionmedia] + * add minutes support [visionmedia] + * add seconds support [visionmedia] + * add ms string support [visionmedia] + * refactor tests to facilitate ms(number) [visionmedia] + +0.1.0 / 2012-03-07 +================== + + * Initial release diff --git a/node_modules/simple-peer/node_modules/debug/node_modules/ms/LICENSE b/node_modules/simple-peer/node_modules/debug/node_modules/ms/LICENSE new file mode 100644 index 00000000..6c07561b --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/node_modules/ms/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch + +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/node_modules/simple-peer/node_modules/debug/node_modules/ms/README.md b/node_modules/simple-peer/node_modules/debug/node_modules/ms/README.md new file mode 100644 index 00000000..9b4fd035 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/node_modules/ms/README.md @@ -0,0 +1,35 @@ +# ms.js: miliseconds conversion utility + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('100') // 100 +``` + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as +a number (e.g: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of +equivalent ms is returned. + +## License + +MIT diff --git a/node_modules/simple-peer/node_modules/debug/node_modules/ms/index.js b/node_modules/simple-peer/node_modules/debug/node_modules/ms/index.js new file mode 100644 index 00000000..4f927716 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/node_modules/ms/index.js @@ -0,0 +1,125 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/simple-peer/node_modules/debug/node_modules/ms/package.json b/node_modules/simple-peer/node_modules/debug/node_modules/ms/package.json new file mode 100644 index 00000000..b12c4a07 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/node_modules/ms/package.json @@ -0,0 +1,47 @@ +{ + "name": "ms", + "version": "0.7.1", + "description": "Tiny ms conversion utility", + "repository": { + "type": "git", + "url": "git://github.com/guille/ms.js.git" + }, + "main": "./index", + "devDependencies": { + "mocha": "*", + "expect.js": "*", + "serve": "*" + }, + "component": { + "scripts": { + "ms/index.js": "index.js" + } + }, + "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", + "bugs": { + "url": "https://github.com/guille/ms.js/issues" + }, + "homepage": "https://github.com/guille/ms.js", + "_id": "ms@0.7.1", + "scripts": {}, + "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "_from": "ms@0.7.1", + "_npmVersion": "2.7.5", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "dist": { + "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz" +} diff --git a/node_modules/simple-peer/node_modules/debug/package.json b/node_modules/simple-peer/node_modules/debug/package.json new file mode 100644 index 00000000..665538e3 --- /dev/null +++ b/node_modules/simple-peer/node_modules/debug/package.json @@ -0,0 +1,73 @@ +{ + "name": "debug", + "version": "2.2.0", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + } + ], + "license": "MIT", + "dependencies": { + "ms": "0.7.1" + }, + "devDependencies": { + "browserify": "9.0.3", + "mocha": "*" + }, + "main": "./node.js", + "browser": "./browser.js", + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" + } + }, + "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@2.2.0", + "scripts": {}, + "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "_from": "debug@>=2.1.0 <3.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "tarball": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-peer/node_modules/hat/README.markdown b/node_modules/simple-peer/node_modules/hat/README.markdown new file mode 100644 index 00000000..2d72768f --- /dev/null +++ b/node_modules/simple-peer/node_modules/hat/README.markdown @@ -0,0 +1,71 @@ +hat +=== + +Generate random IDs and avoid collisions. + +![hat](http://substack.net/images/hat.png) + +examples +======== + +hat +--- + +````javascript +var hat = require('hat'); + +var id = hat(); +console.log(id); +```` + +output: + +```` +0c82a54f22f775a3ed8b97b2dea74036 +```` + +rack +---- + +````javascript +var hat = require('hat'); +var rack = hat.rack(); + +console.log(rack()); +console.log(rack()); +```` + +output: + +```` +1c24171393dc5de04ffcb21f1182ab28 +fabe2323acc1b559dee43d4a1e16cbeb +```` + +methods +======= + +var hat = require('hat'); + +hat(bits=128, base=16) +---------------------- + +Generate a random ID string with `bits` of data in a `base`. + +Leading zeros are appended such that all outputs for a given number of bits have +equal length. + +var rack = hat.rack(bits=128, base=16, expandBy) +------------------------------------------------ + +Make a new hat rack. Call `rack()` repeatedly to generate new IDs which are +checked for collisions. + +If `expandBy` is specified, increment `bits` by this amount if too many +collisions occur. If `expandBy` isn't specified, `rack()` will throw if too many +collisions occur during generation. + +Optionally call `var id = rack(data)` to store `data` at the new ID. + +You can get the data out again with `rack.get(id)` and set the data with +`rack.set(id, value)`. diff --git a/node_modules/simple-peer/node_modules/hat/example/hat.js b/node_modules/simple-peer/node_modules/hat/example/hat.js new file mode 100644 index 00000000..53b29bcb --- /dev/null +++ b/node_modules/simple-peer/node_modules/hat/example/hat.js @@ -0,0 +1,4 @@ +var hat = require('hat'); + +var id = hat(); +console.log(id); diff --git a/node_modules/simple-peer/node_modules/hat/example/rack.js b/node_modules/simple-peer/node_modules/hat/example/rack.js new file mode 100644 index 00000000..9b4efc0f --- /dev/null +++ b/node_modules/simple-peer/node_modules/hat/example/rack.js @@ -0,0 +1,5 @@ +var hat = require('hat'); +var rack = hat.rack(); + +console.log(rack()); +console.log(rack()); diff --git a/node_modules/simple-peer/node_modules/hat/index.js b/node_modules/simple-peer/node_modules/hat/index.js new file mode 100644 index 00000000..5fe0c734 --- /dev/null +++ b/node_modules/simple-peer/node_modules/hat/index.js @@ -0,0 +1,62 @@ +var hat = module.exports = function (bits, base) { + if (!base) base = 16; + if (bits === undefined) bits = 128; + if (bits <= 0) return '0'; + + var digits = Math.log(Math.pow(2, bits)) / Math.log(base); + for (var i = 2; digits === Infinity; i *= 2) { + digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i; + } + + var rem = digits - Math.floor(digits); + + var res = ''; + + for (var i = 0; i < Math.floor(digits); i++) { + var x = Math.floor(Math.random() * base).toString(base); + res = x + res; + } + + if (rem) { + var b = Math.pow(base, rem); + var x = Math.floor(Math.random() * b).toString(base); + res = x + res; + } + + var parsed = parseInt(res, base); + if (parsed !== Infinity && parsed >= Math.pow(2, bits)) { + return hat(bits, base) + } + else return res; +}; + +hat.rack = function (bits, base, expandBy) { + var fn = function (data) { + var iters = 0; + do { + if (iters ++ > 10) { + if (expandBy) bits += expandBy; + else throw new Error('too many ID collisions, use more bits') + } + + var id = hat(bits, base); + } while (Object.hasOwnProperty.call(hats, id)); + + hats[id] = data; + return id; + }; + var hats = fn.hats = {}; + + fn.get = function (id) { + return fn.hats[id]; + }; + + fn.set = function (id, value) { + fn.hats[id] = value; + return fn; + }; + + fn.bits = bits || 128; + fn.base = base || 16; + return fn; +}; diff --git a/node_modules/simple-peer/node_modules/hat/package.json b/node_modules/simple-peer/node_modules/hat/package.json new file mode 100644 index 00000000..2edae4bf --- /dev/null +++ b/node_modules/simple-peer/node_modules/hat/package.json @@ -0,0 +1,66 @@ +{ + "name": "hat", + "version": "0.0.3", + "description": "generate random IDs and avoid collisions", + "main": "index.js", + "directories": { + "lib": ".", + "example": "example", + "test": "test" + }, + "devDependencies": { + "expresso": "0.7.x" + }, + "scripts": { + "test": "expresso" + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/node-hat.git" + }, + "keywords": [ + "id", + "uid", + "uuid", + "random", + "hat", + "rack", + "unique" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT/X11", + "engine": { + "node": ">=0.4" + }, + "_id": "hat@0.0.3", + "dependencies": {}, + "engines": { + "node": "*" + }, + "_engineSupported": true, + "_npmVersion": "1.0.10", + "_nodeVersion": "v0.5.0-pre", + "_defaultsLoaded": true, + "dist": { + "shasum": "bb014a9e64b3788aed8005917413d4ff3d502d8a", + "tarball": "http://registry.npmjs.org/hat/-/hat-0.0.3.tgz" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "bb014a9e64b3788aed8005917413d4ff3d502d8a", + "_resolved": "https://registry.npmjs.org/hat/-/hat-0.0.3.tgz", + "_from": "hat@0.0.3", + "bugs": { + "url": "https://github.com/substack/node-hat/issues" + }, + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/substack/node-hat" +} diff --git a/node_modules/simple-peer/node_modules/hat/test/id.js b/node_modules/simple-peer/node_modules/hat/test/id.js new file mode 100644 index 00000000..b8660ec2 --- /dev/null +++ b/node_modules/simple-peer/node_modules/hat/test/id.js @@ -0,0 +1,49 @@ +var hat = require('../'); +var assert = require('assert'); + +function digits (bits, base) { + return Math.ceil( + Math.log(parseInt(Array(bits + 1).join('1'), 2) + ) / Math.log(base)); +} + +exports.lengths = function () { + for (var i = 0; i < 10; i++) { + assert.equal(hat(4).length, 1); + } + + for (var i = 0; i < 10; i++) { + assert.equal(hat(3).length, 1); + } + + (function () { + var d = digits(32, 16); + for (var i = 0; i < 10; i++) { + assert.equal(hat(32, 16).length, d); + assert.equal(hat(33, 16).length, d + 1); + } + })(); +}; + +exports.range = function () { + for (var base = 2; base < 32; base++) { + for (var bits = 0; bits < 256; bits += base) { + for (var k = 0; k < 10; k++) { + var id = hat(bits, base); + var iid = parseInt(id, base); + assert.ok(iid >= 0); + assert.ok(iid < Math.pow(2, bits)); + } + } + } +}; + +exports.big = function () { + var id = hat(1024); + assert.equal(id.length, 256); +}; + +exports.bigger = function () { + var id = hat(2048); + assert.equal(id.length, 512); +}; diff --git a/node_modules/simple-peer/node_modules/hat/test/rack.js b/node_modules/simple-peer/node_modules/hat/test/rack.js new file mode 100644 index 00000000..92b7ce8f --- /dev/null +++ b/node_modules/simple-peer/node_modules/hat/test/rack.js @@ -0,0 +1,62 @@ +var hat = require('../'); +var assert = require('assert'); + +exports.rack = function () { + var rack = hat.rack(4); + var seen = {}; + for (var i = 0; i < 8; i++) { + var id = rack(); + assert.ok(!seen[id], 'seen this id'); + seen[id] = true; + + assert.ok(id.match(/^[0-9a-f]$/)); + } + + assert.throws(function () { + for (var i = 0; i < 10; i++) rack() + }); +}; + +exports.data = function () { + var rack = hat.rack(64); + var a = rack('a!'); + var b = rack("it's a b!") + var c = rack([ 'c', 'c', 'c' ]); + + assert.equal(rack.get(a), 'a!'); + assert.equal(rack.get(b), "it's a b!"); + assert.deepEqual(rack.get(c), [ 'c', 'c', 'c' ]); + + assert.equal(rack.hats[a], 'a!'); + assert.equal(rack.hats[b], "it's a b!"); + assert.deepEqual(rack.hats[c], [ 'c', 'c', 'c' ]); + + rack.set(a, 'AAA'); + assert.equal(rack.get(a), 'AAA'); +}; + +exports.expandBy = function () { + var rack = hat.rack(4, 16, 4); + var seen = {}; + + for (var i = 0; i < 8; i++) { + var id = rack(); + assert.ok(!seen[id], 'seen this id'); + seen[id] = true; + assert.ok(id.match(/^[0-9a-f]$/)); + } + + for (var i = 0; i < 8; i++) { + var id = rack(); + assert.ok(!seen[id], 'seen this id'); + seen[id] = true; + assert.ok(id.match(/^[0-9a-f]{1,2}$/)); + } + + for (var i = 0; i < 8; i++) { + var id = rack(); + assert.ok(!seen[id], 'seen this id'); + seen[id] = true; + assert.ok(id.match(/^[0-9a-f]{2}$/)); + } +}; diff --git a/node_modules/simple-peer/node_modules/inherits/LICENSE b/node_modules/simple-peer/node_modules/inherits/LICENSE new file mode 100644 index 00000000..dea3013d --- /dev/null +++ b/node_modules/simple-peer/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/simple-peer/node_modules/inherits/README.md b/node_modules/simple-peer/node_modules/inherits/README.md new file mode 100644 index 00000000..b1c56658 --- /dev/null +++ b/node_modules/simple-peer/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/simple-peer/node_modules/inherits/inherits.js b/node_modules/simple-peer/node_modules/inherits/inherits.js new file mode 100644 index 00000000..29f5e24f --- /dev/null +++ b/node_modules/simple-peer/node_modules/inherits/inherits.js @@ -0,0 +1 @@ +module.exports = require('util').inherits diff --git a/node_modules/simple-peer/node_modules/inherits/inherits_browser.js b/node_modules/simple-peer/node_modules/inherits/inherits_browser.js new file mode 100644 index 00000000..c1e78a75 --- /dev/null +++ b/node_modules/simple-peer/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} diff --git a/node_modules/simple-peer/node_modules/inherits/package.json b/node_modules/simple-peer/node_modules/inherits/package.json new file mode 100644 index 00000000..005588b2 --- /dev/null +++ b/node_modules/simple-peer/node_modules/inherits/package.json @@ -0,0 +1,50 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.1", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits" + }, + "license": "ISC", + "scripts": { + "test": "node test" + }, + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "_id": "inherits@2.0.1", + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "_from": "inherits@>=2.0.1 <2.1.0", + "_npmVersion": "1.3.8", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/isaacs/inherits" +} diff --git a/node_modules/simple-peer/node_modules/inherits/test.js b/node_modules/simple-peer/node_modules/inherits/test.js new file mode 100644 index 00000000..fc53012d --- /dev/null +++ b/node_modules/simple-peer/node_modules/inherits/test.js @@ -0,0 +1,25 @@ +var inherits = require('./inherits.js') +var assert = require('assert') + +function test(c) { + assert(c.constructor === Child) + assert(c.constructor.super_ === Parent) + assert(Object.getPrototypeOf(c) === Child.prototype) + assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) + assert(c instanceof Child) + assert(c instanceof Parent) +} + +function Child() { + Parent.call(this) + test(this) +} + +function Parent() {} + +inherits(Child, Parent) + +var c = new Child +test(c) + +console.log('ok') diff --git a/node_modules/simple-peer/node_modules/is-typedarray/LICENSE.md b/node_modules/simple-peer/node_modules/is-typedarray/LICENSE.md new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/simple-peer/node_modules/is-typedarray/LICENSE.md @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/simple-peer/node_modules/is-typedarray/README.md b/node_modules/simple-peer/node_modules/is-typedarray/README.md new file mode 100644 index 00000000..27528639 --- /dev/null +++ b/node_modules/simple-peer/node_modules/is-typedarray/README.md @@ -0,0 +1,16 @@ +# is-typedarray [![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) + +Detect whether or not an object is a +[Typed Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays). + +## Usage + +[![NPM](https://nodei.co/npm/is-typedarray.png)](https://nodei.co/npm/is-typedarray/) + +### isTypedArray(array) + +Returns `true` when array is a Typed Array, and `false` when it is not. + +## License + +MIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details. diff --git a/node_modules/simple-peer/node_modules/is-typedarray/index.js b/node_modules/simple-peer/node_modules/is-typedarray/index.js new file mode 100644 index 00000000..0631b854 --- /dev/null +++ b/node_modules/simple-peer/node_modules/is-typedarray/index.js @@ -0,0 +1,39 @@ +module.exports = isTypedArray +isTypedArray.strict = isStrictTypedArray +isTypedArray.loose = isLooseTypedArray + +var toString = Object.prototype.toString +var names = { + '[object Int8Array]': true + , '[object Int16Array]': true + , '[object Int32Array]': true + , '[object Uint8Array]': true + , '[object Uint16Array]': true + , '[object Uint32Array]': true + , '[object Float32Array]': true + , '[object Float64Array]': true +} + +function isTypedArray(arr) { + return ( + isStrictTypedArray(arr) + || isLooseTypedArray(arr) + ) +} + +function isStrictTypedArray(arr) { + return ( + arr instanceof Int8Array + || arr instanceof Int16Array + || arr instanceof Int32Array + || arr instanceof Uint8Array + || arr instanceof Uint16Array + || arr instanceof Uint32Array + || arr instanceof Float32Array + || arr instanceof Float64Array + ) +} + +function isLooseTypedArray(arr) { + return names[toString.call(arr)] +} diff --git a/node_modules/simple-peer/node_modules/is-typedarray/package.json b/node_modules/simple-peer/node_modules/is-typedarray/package.json new file mode 100644 index 00000000..51485ec6 --- /dev/null +++ b/node_modules/simple-peer/node_modules/is-typedarray/package.json @@ -0,0 +1,55 @@ +{ + "name": "is-typedarray", + "version": "0.0.0", + "description": "Detect whether or not an object is a Typed Array", + "main": "index.js", + "scripts": { + "test": "node test" + }, + "author": { + "name": "Hugh Kennedy", + "email": "hughskennedy@gmail.com", + "url": "http://hughsk.io/" + }, + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "tape": "^2.13.1" + }, + "repository": { + "type": "git", + "url": "git://github.com/hughsk/is-typedarray.git" + }, + "keywords": [ + "typed", + "array", + "detect", + "is", + "util" + ], + "bugs": { + "url": "https://github.com/hughsk/is-typedarray/issues" + }, + "homepage": "https://github.com/hughsk/is-typedarray", + "_id": "is-typedarray@0.0.0", + "_shasum": "9e5c50a8bf17b3051b48c5e5b678440821f756f4", + "_from": "is-typedarray@0.0.0", + "_npmVersion": "1.4.10", + "_npmUser": { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + }, + "maintainers": [ + { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + } + ], + "dist": { + "shasum": "9e5c50a8bf17b3051b48c5e5b678440821f756f4", + "tarball": "http://registry.npmjs.org/is-typedarray/-/is-typedarray-0.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-0.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-peer/node_modules/is-typedarray/test.js b/node_modules/simple-peer/node_modules/is-typedarray/test.js new file mode 100644 index 00000000..b0c176fa --- /dev/null +++ b/node_modules/simple-peer/node_modules/is-typedarray/test.js @@ -0,0 +1,34 @@ +var test = require('tape') +var ista = require('./') + +test('strict', function(t) { + t.ok(ista.strict(new Int8Array), 'Int8Array') + t.ok(ista.strict(new Int16Array), 'Int16Array') + t.ok(ista.strict(new Int32Array), 'Int32Array') + t.ok(ista.strict(new Uint8Array), 'Uint8Array') + t.ok(ista.strict(new Uint16Array), 'Uint16Array') + t.ok(ista.strict(new Uint32Array), 'Uint32Array') + t.ok(ista.strict(new Float32Array), 'Float32Array') + t.ok(ista.strict(new Float64Array), 'Float64Array') + + t.ok(!ista.strict(new Array), 'Array') + t.ok(!ista.strict([]), '[]') + + t.end() +}) + +test('loose', function(t) { + t.ok(ista.loose(new Int8Array), 'Int8Array') + t.ok(ista.loose(new Int16Array), 'Int16Array') + t.ok(ista.loose(new Int32Array), 'Int32Array') + t.ok(ista.loose(new Uint8Array), 'Uint8Array') + t.ok(ista.loose(new Uint16Array), 'Uint16Array') + t.ok(ista.loose(new Uint32Array), 'Uint32Array') + t.ok(ista.loose(new Float32Array), 'Float32Array') + t.ok(ista.loose(new Float64Array), 'Float64Array') + + t.ok(!ista.loose(new Array), 'Array') + t.ok(!ista.loose([]), '[]') + + t.end() +}) diff --git a/node_modules/simple-peer/node_modules/once/LICENSE b/node_modules/simple-peer/node_modules/once/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/simple-peer/node_modules/once/README.md b/node_modules/simple-peer/node_modules/once/README.md new file mode 100644 index 00000000..a2981ea0 --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/README.md @@ -0,0 +1,51 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` diff --git a/node_modules/simple-peer/node_modules/once/node_modules/wrappy/LICENSE b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/simple-peer/node_modules/once/node_modules/wrappy/README.md b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/simple-peer/node_modules/once/node_modules/wrappy/package.json b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-peer/node_modules/once/node_modules/wrappy/test/basic.js b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/simple-peer/node_modules/once/node_modules/wrappy/wrappy.js b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/simple-peer/node_modules/once/once.js b/node_modules/simple-peer/node_modules/once/once.js new file mode 100644 index 00000000..2e1e721b --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/once.js @@ -0,0 +1,21 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} diff --git a/node_modules/simple-peer/node_modules/once/package.json b/node_modules/simple-peer/node_modules/once/package.json new file mode 100644 index 00000000..dc007787 --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/package.json @@ -0,0 +1,60 @@ +{ + "name": "once", + "version": "1.3.2", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "~0.3.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once.git" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "gitHead": "e35eed5a7867574e2bf2260a1ba23970958b22f2", + "bugs": { + "url": "https://github.com/isaacs/once/issues" + }, + "homepage": "https://github.com/isaacs/once#readme", + "_id": "once@1.3.2", + "_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "_from": "once@>=1.3.1 <2.0.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "tarball": "http://registry.npmjs.org/once/-/once-1.3.2.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "_resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-peer/node_modules/once/test/once.js b/node_modules/simple-peer/node_modules/once/test/once.js new file mode 100644 index 00000000..c618360d --- /dev/null +++ b/node_modules/simple-peer/node_modules/once/test/once.js @@ -0,0 +1,23 @@ +var test = require('tap').test +var once = require('../once.js') + +test('once', function (t) { + var f = 0 + function fn (g) { + t.equal(f, 0) + f ++ + return f + g + this + } + fn.ownProperty = {} + var foo = once(fn) + t.equal(fn.ownProperty, foo.ownProperty) + t.notOk(foo.called) + for (var i = 0; i < 1E3; i++) { + t.same(f, i === 0 ? 0 : 1) + var g = foo.call(1, 1) + t.ok(foo.called) + t.same(g, 3) + t.same(f, 1) + } + t.end() +}) diff --git a/node_modules/simple-peer/node_modules/typedarray-to-buffer/.travis.yml b/node_modules/simple-peer/node_modules/typedarray-to-buffer/.travis.yml new file mode 100644 index 00000000..b3da453e --- /dev/null +++ b/node_modules/simple-peer/node_modules/typedarray-to-buffer/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: +- '0.10' +env: + global: + - secure: i51rE9rZGHbcZWlL58j3H1qtL23OIV2r0X4TcQKNI3pw2mubdHFJmfPNNO19ItfReu8wwQMxOehKamwaNvqMiKWyHfn/QcThFQysqzgGZ6AgnUbYx9od6XFNDeWd1sVBf7QBAL07y7KWlYGWCwFwWjabSVySzQhEBdisPcskfkI= + - secure: BKq6/5z9LK3KDkTjs7BGeBZ1KsWgz+MsAXZ4P64NSeVGFaBdXU45+ww1mwxXFt5l22/mhyOQZfebQl+kGVqRSZ+DEgQeCymkNZ6CD8c6w6cLuOJXiXwuu/cDM2DD0tfGeu2YZC7yEikP7BqEFwH3D324rRzSGLF2RSAAwkOI7bE= diff --git a/node_modules/simple-peer/node_modules/typedarray-to-buffer/.zuul.yml b/node_modules/simple-peer/node_modules/typedarray-to-buffer/.zuul.yml new file mode 100644 index 00000000..da322928 --- /dev/null +++ b/node_modules/simple-peer/node_modules/typedarray-to-buffer/.zuul.yml @@ -0,0 +1,18 @@ +ui: tape +browsers: + - name: chrome + version: 26..latest + - name: firefox + version: 21..latest + - name: safari + version: 5..latest + - name: ie + version: 8..latest + - name: opera + version: 12..latest + - name: iphone + version: 5.0..latest + - name: ipad + version: 5.0..latest + - name: android + version: 4.0..latest diff --git a/node_modules/simple-peer/node_modules/typedarray-to-buffer/LICENSE b/node_modules/simple-peer/node_modules/typedarray-to-buffer/LICENSE new file mode 100644 index 00000000..0c068cee --- /dev/null +++ b/node_modules/simple-peer/node_modules/typedarray-to-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/simple-peer/node_modules/typedarray-to-buffer/README.md b/node_modules/simple-peer/node_modules/typedarray-to-buffer/README.md new file mode 100644 index 00000000..efcff699 --- /dev/null +++ b/node_modules/simple-peer/node_modules/typedarray-to-buffer/README.md @@ -0,0 +1,78 @@ +# typedarray-to-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][npm-url] + +#### Convert a typed array to a [Buffer](https://github.com/feross/buffer) without a copy. + +[![saucelabs][saucelabs-image]][saucelabs-url] + +[travis-image]: https://img.shields.io/travis/feross/typedarray-to-buffer.svg?style=flat +[travis-url]: https://travis-ci.org/feross/typedarray-to-buffer +[npm-image]: https://img.shields.io/npm/v/typedarray-to-buffer.svg?style=flat +[npm-url]: https://npmjs.org/package/typedarray-to-buffer +[downloads-image]: https://img.shields.io/npm/dm/typedarray-to-buffer.svg?style=flat +[saucelabs-image]: https://saucelabs.com/browser-matrix/typedarray-to-buffer.svg +[saucelabs-url]: https://saucelabs.com/u/typedarray-to-buffer + +Say you're using the ['buffer'](https://github.com/feross/buffer) module on npm, or +[browserify](http://browserify.org/) and you're working with lots of binary data. + +Unfortunately, sometimes the browser or someone else's API gives you an `ArrayBuffer` +or a typed array like `Uint8Array` to work with and you need to convert it to a +`Buffer`. What do you do? + +Of course: `new Buffer(uint8array)` + +But, alas, every time you do `new Buffer(uint8array)` **the entire array gets copied**. +The `Buffer` constructor does a copy; this is +defined by the [node docs](http://nodejs.org/api/buffer.html) and the 'buffer' module +matches the node API exactly. + +So, how can we avoid this expensive copy in +[performance critical applications](https://github.com/feross/buffer/issues/22)? + +***Simply use this module, of course!*** + +## install + +```bash +npm install typedarray-to-buffer +``` + +## usage + +To convert a typed array to a `Buffer` **without a copy**, do this: + +```js +var toBuffer = require('typedarray-to-buffer') + +var arr = new Uint8Array([1, 2, 3]) +arr = toBuffer(arr) + +// arr is a buffer now! + +arr.toString() // '\u0001\u0002\u0003' +arr.readUInt16BE(0) // 258 +``` + +## how it works + +If the browser supports typed arrays, then `toBuffer` will **augment the typed array** you +pass in with the `Buffer` methods and return it. See [how does Buffer +work?](https://github.com/feross/buffer#how-does-it-work) for more about how augmentation +works. + +This module uses the typed array's underlying `ArrayBuffer` to back the new `Buffer`. This +respects the "view" on the `ArrayBuffer`, i.e. `byteOffset` and `byteLength`. In other +words, if you do `toBuffer(new Uint32Array([1, 2, 3]))`, then the new `Buffer` will +contain `[1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0]`, **not** `[1, 2, 3]`. And it still doesn't +require a copy. + +If the browser doesn't support typed arrays, then `toBuffer` will create a new `Buffer` +object, copy the data into it, and return it. There's no simple performance optimization +we can do for old browsers. Oh well. + +If this module is used in node, then it will just call `new Buffer`. This is just for +the convenience of modules that work in both node and the browser. + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/simple-peer/node_modules/typedarray-to-buffer/index.js b/node_modules/simple-peer/node_modules/typedarray-to-buffer/index.js new file mode 100644 index 00000000..674d5133 --- /dev/null +++ b/node_modules/simple-peer/node_modules/typedarray-to-buffer/index.js @@ -0,0 +1,31 @@ +/** + * Convert a typed array to a Buffer without a copy + * + * Author: Feross Aboukhadijeh + * License: MIT + * + * `npm install typedarray-to-buffer` + */ + +var isTypedArray = require('is-typedarray').strict + +module.exports = function (arr) { + // If `Buffer` is the browser `buffer` module, and the browser supports typed arrays, + // then avoid a copy. Otherwise, create a `Buffer` with a copy. + var constructor = Buffer.TYPED_ARRAY_SUPPORT + ? Buffer._augment + : function (arr) { return new Buffer(arr) } + + if (arr instanceof Uint8Array) { + return constructor(arr) + } else if (arr instanceof ArrayBuffer) { + return constructor(new Uint8Array(arr)) + } else if (isTypedArray(arr)) { + // Use the typed array's underlying ArrayBuffer to back new Buffer. This respects + // the "view" on the ArrayBuffer, i.e. byteOffset and byteLength. No copy. + return constructor(new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength)) + } else { + // Unsupported type, just pass it through to the `Buffer` constructor. + return new Buffer(arr) + } +} diff --git a/node_modules/simple-peer/node_modules/typedarray-to-buffer/package.json b/node_modules/simple-peer/node_modules/typedarray-to-buffer/package.json new file mode 100644 index 00000000..b6bc2a11 --- /dev/null +++ b/node_modules/simple-peer/node_modules/typedarray-to-buffer/package.json @@ -0,0 +1,75 @@ +{ + "name": "typedarray-to-buffer", + "description": "Convert a typed array to a Buffer without a copy", + "version": "3.0.2", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/typedarray-to-buffer/issues" + }, + "dependencies": { + "is-typedarray": "0.0.0" + }, + "devDependencies": { + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "http://feross.org", + "keywords": [ + "buffer", + "typed array", + "convert", + "no copy", + "uint8array", + "uint16array", + "uint32array", + "int16array", + "int32array", + "float32array", + "float64array", + "browser", + "arraybuffer", + "dataview" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/typedarray-to-buffer.git" + }, + "scripts": { + "test": "npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "testling": { + "files": "test/*.js" + }, + "gitHead": "39dcf6abd075fe3aa516f9c62781c06cca0e60dd", + "_id": "typedarray-to-buffer@3.0.2", + "_shasum": "baded34efc36180e88b3294257651b82010d836e", + "_from": "typedarray-to-buffer@>=3.0.1 <4.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "baded34efc36180e88b3294257651b82010d836e", + "tarball": "http://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-peer/node_modules/typedarray-to-buffer/test/basic.js b/node_modules/simple-peer/node_modules/typedarray-to-buffer/test/basic.js new file mode 100644 index 00000000..d1aa9dee --- /dev/null +++ b/node_modules/simple-peer/node_modules/typedarray-to-buffer/test/basic.js @@ -0,0 +1,52 @@ +var test = require('tape') +var toBuffer = require('../') + +test('convert to buffer from Uint8Array', function (t) { + if (typeof Uint8Array !== 'undefined') { + var arr = new Uint8Array([1, 2, 3]) + arr = toBuffer(arr) + + t.deepEqual(arr, new Buffer([1, 2, 3]), 'contents equal') + t.ok(Buffer.isBuffer(arr), 'is buffer') + t.equal(arr.readUInt8(0), 1) + t.equal(arr.readUInt8(1), 2) + t.equal(arr.readUInt8(2), 3) + } else { + t.pass('browser lacks Uint8Array support, skip test') + } + t.end() +}) + +test('convert to buffer from another arrayview type (Uint32Array)', function (t) { + if (typeof Uint32Array !== 'undefined') { + var arr = new Uint32Array([1, 2, 3]) + arr = toBuffer(arr) + + t.deepEqual(arr, new Buffer([1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0]), 'contents equal') + t.ok(Buffer.isBuffer(arr), 'is buffer') + t.equal(arr.readUInt32LE(0), 1) + t.equal(arr.readUInt32LE(4), 2) + t.equal(arr.readUInt32LE(8), 3) + t.equal(arr instanceof Uint8Array, !!Buffer.TYPED_ARRAY_SUPPORT) + + } else { + t.pass('browser lacks Uint32Array support, skip test') + } + t.end() +}) + +test('convert to buffer from ArrayBuffer', function (t) { + if (typeof Uint32Array !== 'undefined') { + var arr = new Uint32Array([1, 2, 3]).subarray(1, 2) + arr = toBuffer(arr) + + t.deepEqual(arr, new Buffer([2, 0, 0, 0]), 'contents equal') + t.ok(Buffer.isBuffer(arr), 'is buffer') + t.equal(arr.readUInt32LE(0), 2) + t.equal(arr instanceof Uint8Array, !!Buffer.TYPED_ARRAY_SUPPORT) + + } else { + t.pass('browser lacks ArrayBuffer support, skip test') + } + t.end() +}) diff --git a/node_modules/simple-peer/node_modules/xtend/.jshintrc b/node_modules/simple-peer/node_modules/xtend/.jshintrc new file mode 100644 index 00000000..77887b5f --- /dev/null +++ b/node_modules/simple-peer/node_modules/xtend/.jshintrc @@ -0,0 +1,30 @@ +{ + "maxdepth": 4, + "maxstatements": 200, + "maxcomplexity": 12, + "maxlen": 80, + "maxparams": 5, + + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": false, + "noarg": true, + "noempty": true, + "nonew": true, + "undef": true, + "unused": "vars", + "trailing": true, + + "quotmark": true, + "expr": true, + "asi": true, + + "browser": false, + "esnext": true, + "devel": false, + "node": false, + "nonstandard": false, + + "predef": ["require", "module", "__dirname", "__filename"] +} diff --git a/node_modules/simple-peer/node_modules/xtend/.npmignore b/node_modules/simple-peer/node_modules/xtend/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/simple-peer/node_modules/xtend/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/simple-peer/node_modules/xtend/LICENCE b/node_modules/simple-peer/node_modules/xtend/LICENCE new file mode 100644 index 00000000..1a14b437 --- /dev/null +++ b/node_modules/simple-peer/node_modules/xtend/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2012-2014 Raynos. + +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/node_modules/simple-peer/node_modules/xtend/Makefile b/node_modules/simple-peer/node_modules/xtend/Makefile new file mode 100644 index 00000000..d583fcf4 --- /dev/null +++ b/node_modules/simple-peer/node_modules/xtend/Makefile @@ -0,0 +1,4 @@ +browser: + node ./support/compile + +.PHONY: browser \ No newline at end of file diff --git a/node_modules/simple-peer/node_modules/xtend/README.md b/node_modules/simple-peer/node_modules/xtend/README.md new file mode 100644 index 00000000..093cb297 --- /dev/null +++ b/node_modules/simple-peer/node_modules/xtend/README.md @@ -0,0 +1,32 @@ +# xtend + +[![browser support][3]][4] + +[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) + +Extend like a boss + +xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence. + +## Examples + +```js +var extend = require("xtend") + +// extend returns a new object. Does not mutate arguments +var combination = extend({ + a: "a", + b: 'c' +}, { + b: "b" +}) +// { a: "a", b: "b" } +``` + +## Stability status: Locked + +## MIT Licenced + + + [3]: http://ci.testling.com/Raynos/xtend.png + [4]: http://ci.testling.com/Raynos/xtend diff --git a/node_modules/simple-peer/node_modules/xtend/immutable.js b/node_modules/simple-peer/node_modules/xtend/immutable.js new file mode 100644 index 00000000..5b760152 --- /dev/null +++ b/node_modules/simple-peer/node_modules/xtend/immutable.js @@ -0,0 +1,17 @@ +module.exports = extend + +function extend() { + var target = {} + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (source.hasOwnProperty(key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/simple-peer/node_modules/xtend/mutable.js b/node_modules/simple-peer/node_modules/xtend/mutable.js new file mode 100644 index 00000000..a34475eb --- /dev/null +++ b/node_modules/simple-peer/node_modules/xtend/mutable.js @@ -0,0 +1,15 @@ +module.exports = extend + +function extend(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (source.hasOwnProperty(key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/simple-peer/node_modules/xtend/package.json b/node_modules/simple-peer/node_modules/xtend/package.json new file mode 100644 index 00000000..907a720d --- /dev/null +++ b/node_modules/simple-peer/node_modules/xtend/package.json @@ -0,0 +1,88 @@ +{ + "name": "xtend", + "version": "4.0.0", + "description": "extend like a boss", + "keywords": [ + "extend", + "merge", + "options", + "opts", + "object", + "array" + ], + "author": { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + "repository": { + "type": "git", + "url": "git://github.com/Raynos/xtend.git" + }, + "main": "immutable", + "scripts": { + "test": "node test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.0" + }, + "homepage": "https://github.com/Raynos/xtend", + "contributors": [ + { + "name": "Jake Verbaten" + }, + { + "name": "Matt Esch" + } + ], + "bugs": { + "url": "https://github.com/Raynos/xtend/issues", + "email": "raynos2@gmail.com" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/raynos/xtend/raw/master/LICENSE" + } + ], + "testling": { + "files": "test.js", + "browsers": [ + "ie/7..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest" + ] + }, + "engines": { + "node": ">=0.4" + }, + "gitHead": "94a95d76154103290533b2c55ffa0fe4be16bfef", + "_id": "xtend@4.0.0", + "_shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "_from": "xtend@>=4.0.0 <5.0.0", + "_npmVersion": "1.4.15", + "_npmUser": { + "name": "raynos", + "email": "raynos2@gmail.com" + }, + "maintainers": [ + { + "name": "raynos", + "email": "raynos2@gmail.com" + } + ], + "dist": { + "shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "tarball": "http://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-peer/node_modules/xtend/test.js b/node_modules/simple-peer/node_modules/xtend/test.js new file mode 100644 index 00000000..3369d796 --- /dev/null +++ b/node_modules/simple-peer/node_modules/xtend/test.js @@ -0,0 +1,63 @@ +var test = require("tape") +var extend = require("./") +var mutableExtend = require("./mutable") + +test("merge", function(assert) { + var a = { a: "foo" } + var b = { b: "bar" } + + assert.deepEqual(extend(a, b), { a: "foo", b: "bar" }) + assert.end() +}) + +test("replace", function(assert) { + var a = { a: "foo" } + var b = { a: "bar" } + + assert.deepEqual(extend(a, b), { a: "bar" }) + assert.end() +}) + +test("undefined", function(assert) { + var a = { a: undefined } + var b = { b: "foo" } + + assert.deepEqual(extend(a, b), { a: undefined, b: "foo" }) + assert.deepEqual(extend(b, a), { a: undefined, b: "foo" }) + assert.end() +}) + +test("handle 0", function(assert) { + var a = { a: "default" } + var b = { a: 0 } + + assert.deepEqual(extend(a, b), { a: 0 }) + assert.deepEqual(extend(b, a), { a: "default" }) + assert.end() +}) + +test("is immutable", function (assert) { + var record = {} + + extend(record, { foo: "bar" }) + assert.equal(record.foo, undefined) + assert.end() +}) + +test("null as argument", function (assert) { + var a = { foo: "bar" } + var b = null + var c = void 0 + + assert.deepEqual(extend(b, a, c), { foo: "bar" }) + assert.end() +}) + +test("mutable", function (assert) { + var a = { foo: "bar" } + + mutableExtend(a, { bar: "baz" }) + + assert.equal(a.bar, "baz") + assert.end() +}) diff --git a/node_modules/simple-peer/package.json b/node_modules/simple-peer/package.json new file mode 100644 index 00000000..e35b8f29 --- /dev/null +++ b/node_modules/simple-peer/package.json @@ -0,0 +1,90 @@ +{ + "name": "simple-peer", + "description": "Simple one-to-one WebRTC video/voice and data channels", + "version": "5.4.3", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "browser": { + "wrtc": false + }, + "bugs": { + "url": "https://github.com/feross/simple-peer/issues" + }, + "dependencies": { + "debug": "^2.1.0", + "hat": "0.0.3", + "inherits": "^2.0.1", + "is-typedarray": "0.0.0", + "once": "^1.3.1", + "typedarray-to-buffer": "^3.0.0", + "xtend": "^4.0.0" + }, + "devDependencies": { + "browserify": "^10.1.0", + "concat-stream": "^1.4.6", + "standard": "^3.1.2", + "string-to-stream": "^1.0.0", + "tape": "^4.0.0", + "uglify-js": "^2.4.15", + "wrtc": "0.0.x", + "zuul": "^3.0.0" + }, + "homepage": "http://webtorrent.io", + "keywords": [ + "webrtc", + "p2p", + "data channel", + "data channels", + "data", + "video", + "voice", + "peer", + "stream", + "peer-to-peer", + "data channel stream", + "webrtc stream", + "peer" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/simple-peer.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js", + "build": "browserify -s SimplePeer -r ./ | uglifyjs -m > simplepeer.min.js" + }, + "testling": { + "files": "test/*.js" + }, + "gitHead": "89ee2fd46f5d35cfc8d763de24b126a8cc4eacde", + "_id": "simple-peer@5.4.3", + "_shasum": "eec3e5b8a13cbb01c93da6ec1e8ba34dff5becbc", + "_from": "simple-peer@5.4.3", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "eec3e5b8a13cbb01c93da6ec1e8ba34dff5becbc", + "tarball": "http://registry.npmjs.org/simple-peer/-/simple-peer-5.4.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/simple-peer/-/simple-peer-5.4.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-peer/simplepeer.min.js b/node_modules/simple-peer/simplepeer.min.js new file mode 100644 index 00000000..ecee6a96 --- /dev/null +++ b/node_modules/simple-peer/simplepeer.min.js @@ -0,0 +1,3 @@ +(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.SimplePeer=e()}})(function(){var e,t,r;return function n(e,t,r){function i(o,s){if(!t[o]){if(!e[o]){var f=typeof require=="function"&&require;if(!s&&f)return f(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=t[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,n,e,t,r)}return t[o].exports}var a=typeof require=="function"&&require;for(var o=0;o1)return new f(e,arguments[1]);return new f(e)}this.length=0;this.parent=undefined;if(typeof e==="number"){return u(this,e)}if(typeof e==="string"){return c(this,e,arguments.length>1?arguments[1]:"utf8")}return l(this,e)}function u(e,t){e=b(e,t<0?0:m(t)|0);if(!f.TYPED_ARRAY_SUPPORT){for(var r=0;r>>1;if(r)e.parent=s;return e}function m(e){if(e>=o){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+o.toString(16)+" bytes")}return e|0}function w(e,t){if(!(this instanceof w))return new w(e,t);var r=new f(e,t);delete r.parent;return r}f.isBuffer=function Q(e){return!!(e!=null&&e._isBuffer)};f.compare=function V(e,t){if(!f.isBuffer(e)||!f.isBuffer(t)){throw new TypeError("Arguments must be Buffers")}if(e===t)return 0;var r=e.length;var n=t.length;var i=0;var a=Math.min(r,n);while(i>>1;case"utf8":case"utf-8":return J(e).length;case"base64":return X(e).length;default:return e.length}}f.byteLength=y;f.prototype.length=undefined;f.prototype.parent=undefined;f.prototype.toString=function te(e,t,r){var n=false;t=t|0;r=r===undefined||r===Infinity?this.length:r|0;if(!e)e="utf8";if(t<0)t=0;if(r>this.length)r=this.length;if(r<=t)return"";while(true){switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return k(this,t,r);case"binary":return B(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();n=true}}};f.prototype.equals=function re(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return true;return f.compare(this,e)===0};f.prototype.inspect=function ne(){var e="";var t=r.INSPECT_MAX_BYTES;if(this.length>0){e=this.toString("hex",0,t).match(/.{2}/g).join(" ");if(this.length>t)e+=" ... "}return""};f.prototype.compare=function ie(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return 0;return f.compare(this,e)};f.prototype.indexOf=function ae(e,t){if(t>2147483647)t=2147483647;else if(t<-2147483648)t=-2147483648;t>>=0;if(this.length===0)return-1;if(t>=this.length)return-1;if(t<0)t=Math.max(this.length+t,0);if(typeof e==="string"){if(e.length===0)return-1;return String.prototype.indexOf.call(this,e,t)}if(f.isBuffer(e)){return r(this,e,t)}if(typeof e==="number"){if(f.TYPED_ARRAY_SUPPORT&&Uint8Array.prototype.indexOf==="function"){return Uint8Array.prototype.indexOf.call(this,e,t)}return r(this,[e],t)}function r(e,t,r){var n=-1;for(var i=0;r+ii){n=i}}var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");if(n>a/2){n=a/2}for(var o=0;oa)r=a;if(e.length>0&&(r<0||t<0)||t>this.length){throw new RangeError("attempt to write outside buffer bounds")}if(!n)n="utf8";var o=false;for(;;){switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":return A(this,e,t,r);case"binary":return S(this,e,t,r);case"base64":return R(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase();o=true}}};f.prototype.toJSON=function ue(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(e,t,r){if(t===0&&r===e.length){return n.fromByteArray(e)}else{return n.fromByteArray(e.slice(t,r))}}function I(e,t,r){var n="";var i="";r=Math.min(e.length,r);for(var a=t;an)r=n;var i="";for(var a=t;ar){e=r}if(t<0){t+=r;if(t<0)t=0}else if(t>r){t=r}if(tr)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUIntLE=function le(e,t,r){e=e|0;t=t|0;if(!r)x(e,t,this.length);var n=this[e];var i=1;var a=0;while(++a0&&(i*=256)){n+=this[e+--t]*i}return n};f.prototype.readUInt8=function de(e,t){if(!t)x(e,1,this.length);return this[e]};f.prototype.readUInt16LE=function pe(e,t){if(!t)x(e,2,this.length);return this[e]|this[e+1]<<8};f.prototype.readUInt16BE=function ge(e,t){if(!t)x(e,2,this.length);return this[e]<<8|this[e+1]};f.prototype.readUInt32LE=function ve(e,t){if(!t)x(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};f.prototype.readUInt32BE=function be(e,t){if(!t)x(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};f.prototype.readIntLE=function me(e,t,r){e=e|0;t=t|0;if(!r)x(e,t,this.length);var n=this[e];var i=1;var a=0;while(++a=i)n-=Math.pow(2,8*t);return n};f.prototype.readIntBE=function we(e,t,r){e=e|0;t=t|0;if(!r)x(e,t,this.length);var n=t;var i=1;var a=this[e+--n];while(n>0&&(i*=256)){a+=this[e+--n]*i}i*=128;if(a>=i)a-=Math.pow(2,8*t);return a};f.prototype.readInt8=function ye(e,t){if(!t)x(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};f.prototype.readInt16LE=function _e(e,t){if(!t)x(e,2,this.length);var r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};f.prototype.readInt16BE=function Ee(e,t){if(!t)x(e,2,this.length);var r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};f.prototype.readInt32LE=function Ae(e,t){if(!t)x(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};f.prototype.readInt32BE=function Se(e,t){if(!t)x(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};f.prototype.readFloatLE=function Re(e,t){if(!t)x(e,4,this.length);return i.read(this,e,true,23,4)};f.prototype.readFloatBE=function Le(e,t){if(!t)x(e,4,this.length);return i.read(this,e,false,23,4)};f.prototype.readDoubleLE=function Ce(e,t){if(!t)x(e,8,this.length);return i.read(this,e,true,52,8)};f.prototype.readDoubleBE=function Ie(e,t){if(!t)x(e,8,this.length);return i.read(this,e,false,52,8)};function U(e,t,r,n,i,a){if(!f.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||te.length)throw new RangeError("index out of range")}f.prototype.writeUIntLE=function ke(e,t,r,n){e=+e;t=t|0;r=r|0;if(!n)U(this,e,t,r,Math.pow(2,8*r),0);var i=1;var a=0;this[t]=e&255;while(++a=0&&(a*=256)){this[t+i]=e/a&255}return t+r};f.prototype.writeUInt8=function Te(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,1,255,0);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);this[t]=e;return t+1};function j(e,t,r,n){if(t<0)t=65535+t+1;for(var i=0,a=Math.min(e.length-r,2);i>>(n?i:1-i)*8}}f.prototype.writeUInt16LE=function Me(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{j(this,e,t,true)}return t+2};f.prototype.writeUInt16BE=function xe(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{j(this,e,t,false)}return t+2};function P(e,t,r,n){if(t<0)t=4294967295+t+1;for(var i=0,a=Math.min(e.length-r,4);i>>(n?i:3-i)*8&255}}f.prototype.writeUInt32LE=function Ue(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,4,4294967295,0);if(f.TYPED_ARRAY_SUPPORT){this[t+3]=e>>>24;this[t+2]=e>>>16;this[t+1]=e>>>8;this[t]=e}else{P(this,e,t,true)}return t+4};f.prototype.writeUInt32BE=function je(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,4,4294967295,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>24;this[t+1]=e>>>16;this[t+2]=e>>>8;this[t+3]=e}else{P(this,e,t,false)}return t+4};f.prototype.writeIntLE=function Pe(e,t,r,n){e=+e;t=t|0;if(!n){var i=Math.pow(2,8*r-1);U(this,e,t,r,i-1,-i)}var a=0;var o=1;var s=e<0?1:0;this[t]=e&255;while(++a>0)-s&255}return t+r};f.prototype.writeIntBE=function De(e,t,r,n){e=+e;t=t|0;if(!n){var i=Math.pow(2,8*r-1);U(this,e,t,r,i-1,-i)}var a=r-1;var o=1;var s=e<0?1:0;this[t+a]=e&255;while(--a>=0&&(o*=256)){this[t+a]=(e/o>>0)-s&255}return t+r};f.prototype.writeInt8=function Oe(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,1,127,-128);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);if(e<0)e=255+e+1;this[t]=e;return t+1};f.prototype.writeInt16LE=function Ne(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{j(this,e,t,true)}return t+2};f.prototype.writeInt16BE=function Ye(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{j(this,e,t,false)}return t+2};f.prototype.writeInt32LE=function Fe(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,4,2147483647,-2147483648);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8;this[t+2]=e>>>16;this[t+3]=e>>>24}else{P(this,e,t,true)}return t+4};f.prototype.writeInt32BE=function We(e,t,r){e=+e;t=t|0;if(!r)U(this,e,t,4,2147483647,-2147483648);if(e<0)e=4294967295+e+1;if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>24;this[t+1]=e>>>16;this[t+2]=e>>>8;this[t+3]=e}else{P(this,e,t,false)}return t+4};function D(e,t,r,n,i,a){if(t>i||te.length)throw new RangeError("index out of range");if(r<0)throw new RangeError("index out of range")}function O(e,t,r,n,a){if(!a){D(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38)}i.write(e,t,r,n,23,4);return r+4}f.prototype.writeFloatLE=function ze(e,t,r){return O(this,e,t,true,r)};f.prototype.writeFloatBE=function qe(e,t,r){return O(this,e,t,false,r)};function N(e,t,r,n,a){if(!a){D(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308)}i.write(e,t,r,n,52,8);return r+8}f.prototype.writeDoubleLE=function Je(e,t,r){return N(this,e,t,true,r)};f.prototype.writeDoubleBE=function He(e,t,r){return N(this,e,t,false,r)};f.prototype.copy=function $e(e,t,r,n){if(!r)r=0;if(!n&&n!==0)n=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");if(n>this.length)n=this.length;if(e.length-t=this.length)throw new RangeError("start out of bounds");if(r<0||r>this.length)throw new RangeError("end out of bounds");var n;if(typeof e==="number"){for(n=t;n55295&&r<57344){if(i){if(r<56320){if((t-=3)>-1)a.push(239,191,189);i=r;continue}else{r=i-55296<<10|r-56320|65536;i=null}}else{if(r>56319){if((t-=3)>-1)a.push(239,191,189);continue}else if(o+1===n){if((t-=3)>-1)a.push(239,191,189);continue}else{i=r;continue}}}else if(i){if((t-=3)>-1)a.push(239,191,189);i=null}if(r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<2097152){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return a}function H(e){var t=[];for(var r=0;r>8;i=r%256;a.push(i);a.push(n)}return a}function X(e){return n.toByteArray(W(e))}function G(e,t,r,n){for(var i=0;i=t.length||i>=e.length)break;t[i+r]=e[i]}return i}function K(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}},{"base64-js":3,ieee754:4,"is-array":5}],3:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(e){"use strict";var t=typeof Uint8Array!=="undefined"?Uint8Array:Array;var r="+".charCodeAt(0);var i="/".charCodeAt(0);var a="0".charCodeAt(0);var o="a".charCodeAt(0);var s="A".charCodeAt(0);var f="-".charCodeAt(0);var u="_".charCodeAt(0);function c(e){var t=e.charCodeAt(0);if(t===r||t===f)return 62;if(t===i||t===u)return 63;if(t0){throw new Error("Invalid string. Length must be a multiple of 4")}var f=e.length;o="="===e.charAt(f-2)?2:"="===e.charAt(f-1)?1:0;s=new t(e.length*3/4-o);i=o>0?e.length-4:e.length;var u=0;function l(e){s[u++]=e}for(r=0,n=0;r>16);l((a&65280)>>8);l(a&255)}if(o===2){a=c(e.charAt(r))<<2|c(e.charAt(r+1))>>4;l(a&255)}else if(o===1){a=c(e.charAt(r))<<10|c(e.charAt(r+1))<<4|c(e.charAt(r+2))>>2;l(a>>8&255);l(a&255)}return s}function h(e){var t,r=e.length%3,i="",a,o;function s(e){return n.charAt(e)}function f(e){return s(e>>18&63)+s(e>>12&63)+s(e>>6&63)+s(e&63)}for(t=0,o=e.length-r;t>2);i+=s(a<<4&63);i+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1];i+=s(a>>10);i+=s(a>>4&63);i+=s(a<<2&63);i+="=";break}return i}e.toByteArray=l;e.fromByteArray=h})(typeof r==="undefined"?this.base64js={}:r)},{}],4:[function(e,t,r){r.read=function(e,t,r,n,i){var a,o,s=i*8-n-1,f=(1<>1,c=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];l+=h;a=d&(1<<-c)-1;d>>=-c;c+=s;for(;c>0;a=a*256+e[t+l],l+=h,c-=8){}o=a&(1<<-c)-1;a>>=-c;c+=n;for(;c>0;o=o*256+e[t+l],l+=h,c-=8){}if(a===0){a=1-u}else if(a===f){return o?NaN:(d?-1:1)*Infinity}else{o=o+Math.pow(2,n);a=a-u}return(d?-1:1)*o*Math.pow(2,a-n)};r.write=function(e,t,r,n,i,a){var o,s,f,u=a*8-i-1,c=(1<>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=n?1:-1,g=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){s=isNaN(t)?1:0;o=c}else{o=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-o))<1){o--;f*=2}if(o+l>=1){t+=h/f}else{t+=h*Math.pow(2,1-l)}if(t*f>=2){o++;f/=2}if(o+l>=c){s=0;o=c}else if(o+l>=1){s=(t*f-1)*Math.pow(2,i);o=o+l}else{s=t*Math.pow(2,l-1)*Math.pow(2,i);o=0}}for(;i>=8;e[r+d]=s&255,d+=p,s/=256,i-=8){}o=o<0;e[r+d]=o&255,d+=p,o/=256,u-=8){}e[r+d-p]|=g*128}},{}],5:[function(e,t,r){var n=Array.isArray;var i=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],6:[function(e,t,r){function n(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}t.exports=n;n.EventEmitter=n;n.prototype._events=undefined;n.prototype._maxListeners=undefined;n.defaultMaxListeners=10;n.prototype.setMaxListeners=function(e){if(!a(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");this._maxListeners=e;return this};n.prototype.emit=function(e){var t,r,n,a,f,u;if(!this._events)this._events={};if(e==="error"){if(!this._events.error||o(this._events.error)&&!this._events.error.length){t=arguments[1];if(t instanceof Error){throw t}throw TypeError('Uncaught, unspecified "error" event.')}}r=this._events[e];if(s(r))return false;if(i(r)){switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:n=arguments.length;a=new Array(n-1);for(f=1;f0&&this._events[e].length>r){this._events[e].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[e].length);if(typeof console.trace==="function"){console.trace()}}}return this};n.prototype.on=n.prototype.addListener;n.prototype.once=function(e,t){if(!i(t))throw TypeError("listener must be a function");var r=false;function n(){this.removeListener(e,n);if(!r){r=true;t.apply(this,arguments)}}n.listener=t;this.on(e,n);return this};n.prototype.removeListener=function(e,t){var r,n,a,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;r=this._events[e];a=r.length;n=-1;if(r===t||i(r.listener)&&r.listener===t){delete this._events[e];if(this._events.removeListener)this.emit("removeListener",e,t)}else if(o(r)){for(s=a;s-->0;){if(r[s]===t||r[s].listener&&r[s].listener===t){n=s;break}}if(n<0)return this;if(r.length===1){r.length=0;delete this._events[e]}else{r.splice(n,1)}if(this._events.removeListener)this.emit("removeListener",e,t)}return this};n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[e])delete this._events[e];return this}if(arguments.length===0){for(t in this._events){if(t==="removeListener")continue;this.removeAllListeners(t)}this.removeAllListeners("removeListener");this._events={};return this}r=this._events[e];if(i(r)){this.removeListener(e,r)}else{while(r.length)this.removeListener(e,r[r.length-1])}delete this._events[e];return this};n.prototype.listeners=function(e){var t;if(!this._events||!this._events[e])t=[];else if(i(this._events[e]))t=[this._events[e]];else t=this._events[e].slice();return t};n.listenerCount=function(e,t){var r;if(!e._events||!e._events[t])r=0;else if(i(e._events[t]))r=1;else r=e._events[t].length;return r};function i(e){return typeof e==="function"}function a(e){return typeof e==="number"}function o(e){return typeof e==="object"&&e!==null}function s(e){return e===void 0}},{}],7:[function(e,t,r){t.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],8:[function(e,t,r){var n=t.exports={};var i=[];var a=false;var o;var s=-1;function f(){a=false;if(o.length){i=o.concat(i)}else{s=-1}if(i.length){u()}}function u(){if(a){return}var e=setTimeout(f);a=true;var t=i.length;while(t){o=i;i=[];while(++s1){for(var r=1;r0){if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var o=new Error("stream.unshift() after end event");e.emit("error",o)}else{if(t.decoder&&!i&&!n)r=t.decoder.write(r);if(!i)t.reading=false;if(t.flowing&&t.length===0&&!t.sync){e.emit("data",r);e.read(0)}else{t.length+=t.objectMode?1:r.length;if(i)t.buffer.unshift(r);else t.buffer.push(r);if(t.needReadable)w(e)}_(e,t)}}else if(!i){t.reading=false}return d(t)}function d(e){return!e.ended&&(e.needReadable||e.length=p){e=p}else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function v(e,t){if(t.length===0&&t.ended)return 0;if(t.objectMode)return e===0?0:1;if(isNaN(e)||s.isNull(e)){if(t.flowing&&t.buffer.length)return t.buffer[0].length;else return t.length}if(e<=0)return 0;if(e>t.highWaterMark)t.highWaterMark=g(e);if(e>t.length){if(!t.ended){t.needReadable=true;return 0}else return t.length}return e}l.prototype.read=function(e){u("read",e);var t=this._readableState;var r=e;if(!s.isNumber(e)||e>0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){u("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)I(this);else w(this);return null}e=v(e,t);if(e===0&&t.ended){if(t.length===0)I(this);return null}var n=t.needReadable;u("need readable",n);if(t.length===0||t.length-e0)i=C(e,t);else i=null;if(s.isNull(i)){t.needReadable=true;e=0}t.length-=e;if(t.length===0&&!t.ended)t.needReadable=true;if(r!==e&&t.ended&&t.length===0)I(this);if(!s.isNull(i))this.emit("data",i);return i};function b(e,t){var r=null;if(!s.isBuffer(t)&&!s.isString(t)&&!s.isNullOrUndefined(t)&&!e.objectMode){r=new TypeError("Invalid non-string/buffer chunk")}return r}function m(e,t){if(t.decoder&&!t.ended){var r=t.decoder.end();if(r&&r.length){t.buffer.push(r);t.length+=t.objectMode?1:r.length}}t.ended=true; +w(e)}function w(e){var t=e._readableState;t.needReadable=false;if(!t.emittedReadable){u("emitReadable",t.flowing);t.emittedReadable=true;if(t.sync)r.nextTick(function(){y(e)});else y(e)}}function y(e){u("emit readable");e.emit("readable");L(e)}function _(e,t){if(!t.readingMore){t.readingMore=true;r.nextTick(function(){E(e,t)})}}function E(e,t){var r=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length=n){if(a)s=r.join("");else s=i.concat(r,n);r.length=0}else{if(e0)throw new Error("endReadable called on non-empty stream");if(!t.endEmitted){t.ended=true;r.nextTick(function(){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}})}}function k(e,t){for(var r=0,n=e.length;r1){var r=[];for(var n=0;n=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;e.copy(this.charBuffer,this.charReceived,0,r);this.charReceived+=r;if(this.charReceived=55296&&n<=56319){this.charLength+=this.surrogateSize;t="";continue}this.charReceived=this.charLength=0;if(e.length===0){return t}break}this.detectIncompleteChar(e);var i=e.length;if(this.charLength){e.copy(this.charBuffer,0,e.length-this.charReceived,i);i-=this.charReceived}t+=e.toString(this.encoding,0,i);var i=t.length-1;var n=t.charCodeAt(i);if(n>=55296&&n<=56319){var a=this.surrogateSize;this.charLength+=a;this.charReceived+=a;this.charBuffer.copy(this.charBuffer,a,0,a);e.copy(this.charBuffer,0,0,a);return t.substring(0,i)}return t};o.prototype.detectIncompleteChar=function(e){var t=e.length>=3?3:e.length;for(;t>0;t--){var r=e[e.length-t];if(t==1&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t};o.prototype.end=function(e){var t="";if(e&&e.length)t=this.write(e);if(this.charReceived){var r=this.charReceived;var n=this.charBuffer;var i=this.encoding;t+=n.slice(0,r).toString(i)}return t};function s(e){return e.toString(this.encoding)}function f(e){this.charReceived=e.length%2;this.charLength=this.charReceived?2:0}function u(e){this.charReceived=e.length%3;this.charLength=this.charReceived?3:0}},{buffer:2}],22:[function(e,t,r){r=t.exports=e("./debug");r.log=o;r.formatArgs=a;r.save=s;r.load=f;r.useColors=i;var n;if(typeof chrome!=="undefined"&&typeof chrome.storage!=="undefined")n=chrome.storage.local;else n=u();r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function i(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}r.formatters.j=function(e){return JSON.stringify(e)};function a(){var e=arguments;var t=this.useColors;e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff);if(!t)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0;var a=0;e[0].replace(/%[a-z%]/g,function(e){if("%%"===e)return;i++;if("%c"===e){a=i}});e.splice(a,0,n);return e}function o(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{if(null==e){n.removeItem("debug")}else{n.debug=e}}catch(t){}}function f(){var e;try{e=n.debug}catch(t){}return e}r.enable(f());function u(){try{return window.localStorage}catch(e){}}},{"./debug":23}],23:[function(e,t,r){r=t.exports=o;r.coerce=c;r.disable=f;r.enable=s;r.enabled=u;r.humanize=e("ms");r.names=[];r.skips=[];r.formatters={};var n=0;var i;function a(){return r.colors[n++%r.colors.length]}function o(e){function t(){}t.enabled=false;function n(){var e=n;var t=+new Date;var o=t-(i||t);e.diff=o;e.prev=i;e.curr=t;i=t;if(null==e.useColors)e.useColors=r.useColors();if(null==e.color&&e.useColors)e.color=a();var s=Array.prototype.slice.call(arguments);s[0]=r.coerce(s[0]);if("string"!==typeof s[0]){s=["%o"].concat(s)}var f=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,n){if(t==="%%")return t;f++;var i=r.formatters[n];if("function"===typeof i){var a=s[f];t=i.call(e,a);s.splice(f,1);f--}return t});if("function"===typeof r.formatArgs){s=r.formatArgs.apply(e,s)}var u=n.log||r.log||console.log.bind(console);u.apply(e,s)}n.enabled=true;var o=r.enabled(e)?n:t;o.namespace=e;return o}function s(e){r.save(e);var t=(e||"").split(/[\s,]+/);var n=t.length;for(var i=0;i=o)return Math.round(e/o)+"d";if(e>=a)return Math.round(e/a)+"h";if(e>=i)return Math.round(e/i)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}function c(e){return l(e,o,"day")||l(e,a,"hour")||l(e,i,"minute")||l(e,n,"second")||e+" ms"}function l(e,t,r){if(e=Math.pow(2,e)){return n(e,t)}else return o};n.rack=function(e,t,r){var i=function(i){var o=0;do{if(o++>10){if(r)e+=r;else throw new Error("too many ID collisions, use more bits")}var s=n(e,t)}while(Object.hasOwnProperty.call(a,s));a[s]=i;return s};var a=i.hats={};i.get=function(e){return i.hats[e]};i.set=function(e,t){i.hats[e]=t;return i};i.bits=e||128;i.base=t||16;return i}},{}],26:[function(e,t,r){if(typeof Object.create==="function"){t.exports=function n(e,t){e.super_=t;e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}else{t.exports=function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype;e.prototype=new r;e.prototype.constructor=e}}},{}],27:[function(e,t,r){t.exports=a;a.strict=o;a.loose=s;var n=Object.prototype.toString;var i={"[object Int8Array]":true,"[object Int16Array]":true,"[object Int32Array]":true,"[object Uint8Array]":true,"[object Uint16Array]":true,"[object Uint32Array]":true,"[object Float32Array]":true,"[object Float64Array]":true};function a(e){return o(e)||s(e)}function o(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return i[n.call(e)]}},{}],28:[function(e,t,r){t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach(function(t){r[t]=e[t]});return r;function r(){var t=new Array(arguments.length);for(var r=0;r1)e.sdp=t[0]+"b=AS:1638400"+t[1]}function p(){}}).call(this,e("buffer").Buffer)},{buffer:2,debug:22,hat:25,inherits:26,"is-typedarray":27,once:29,stream:20,"typedarray-to-buffer":30,"xtend/mutable":32}]},{},[])("/")}); diff --git a/node_modules/simple-peer/test/basic.js b/node_modules/simple-peer/test/basic.js new file mode 100644 index 00000000..24beb587 --- /dev/null +++ b/node_modules/simple-peer/test/basic.js @@ -0,0 +1,77 @@ +var Peer = require('../') +var test = require('tape') +var wrtc = typeof window === 'undefined' && require('wrtc') + +test('detect WebRTC support', function (t) { + t.equal(Peer.WEBRTC_SUPPORT, typeof window !== 'undefined', 'builtin webrtc support') + t.end() +}) + +test('signal event gets emitted', function (t) { + var peer = new Peer({ initiator: true, wrtc: wrtc }) + peer.once('signal', function () { + t.pass('got signal event') + peer.destroy() + t.end() + }) +}) + +test('data send/receive text', function (t) { + var peer1 = new Peer({ initiator: true, wrtc: wrtc }) + var peer2 = new Peer({ wrtc: wrtc }) + + var numSignal1 = 0 + peer1.on('signal', function (data) { + numSignal1 += 1 + peer2.signal(data) + }) + + var numSignal2 = 0 + peer2.on('signal', function (data) { + numSignal2 += 1 + peer1.signal(data) + }) + + peer1.on('connect', tryTest) + peer2.on('connect', tryTest) + + function tryTest () { + if (!peer1.connected || !peer2.connected) return + + t.ok(numSignal1 >= 1) + t.ok(numSignal2 >= 1) + t.equal(peer1.initiator, true, 'peer1 is initiator') + t.equal(peer2.initiator, false, 'peer2 is not initiator') + + t.equal(peer1.localAddress, peer2.remoteAddress) + t.equal(peer1.localPort, peer2.remotePort) + + t.equal(peer2.localAddress, peer1.remoteAddress) + t.equal(peer2.localPort, peer1.remotePort) + + t.ok(typeof peer1.remoteFamily === 'string') + t.ok(peer1.remoteFamily.indexOf('IPv') === 0) + t.ok(typeof peer2.remoteFamily === 'string') + t.ok(peer2.remoteFamily.indexOf('IPv') === 0) + + peer1.send('sup peer2') + peer2.on('data', function (data) { + t.equal(data, 'sup peer2', 'got correct message') + + peer2.send('sup peer1') + peer1.on('data', function (data) { + t.equal(data, 'sup peer1', 'got correct message') + + function tryDone () { + if (!peer1.connected && !peer2.connected) { + t.pass('both peers closed') + t.end() + } + } + + peer1.destroy(tryDone) + peer2.destroy(tryDone) + }) + }) + } +}) diff --git a/node_modules/simple-peer/test/binary.js b/node_modules/simple-peer/test/binary.js new file mode 100644 index 00000000..d8afac45 --- /dev/null +++ b/node_modules/simple-peer/test/binary.js @@ -0,0 +1,160 @@ +var Peer = require('../') +var test = require('tape') +var wrtc = typeof window === 'undefined' && require('wrtc') + +test('data send/receive Uint8Array', function (t) { + var peer1 = new Peer({ initiator: true, wrtc: wrtc }) + var peer2 = new Peer({ wrtc: wrtc }) + peer1.on('signal', function (data) { + peer2.signal(data) + }) + peer2.on('signal', function (data) { + peer1.signal(data) + }) + peer1.on('connect', tryTest) + peer2.on('connect', tryTest) + + function tryTest () { + if (!peer1.connected || !peer2.connected) return + + peer1.send(new Uint8Array([1, 2, 3])) + peer2.on('data', function (data) { + t.ok(Buffer.isBuffer(data), 'data is Buffer') + t.deepEqual(data, new Buffer([1, 2, 3]), 'got correct message') + + peer2.send(new Uint8Array([2, 3, 4])) + peer1.on('data', function (data) { + t.ok(Buffer.isBuffer(data), 'data is Buffer') + t.deepEqual(data, new Buffer([2, 3, 4]), 'got correct message') + + peer1.destroy(tryDone) + peer2.destroy(tryDone) + + function tryDone () { + if (!peer1.connected && !peer2.connected) { + t.pass('both peers closed') + t.end() + } + } + }) + }) + } +}) + +test('data send/receive Buffer', function (t) { + var peer1 = new Peer({ initiator: true, wrtc: wrtc }) + var peer2 = new Peer({ wrtc: wrtc }) + peer1.on('signal', function (data) { + peer2.signal(data) + }) + peer2.on('signal', function (data) { + peer1.signal(data) + }) + peer1.on('connect', tryTest) + peer2.on('connect', tryTest) + + function tryTest () { + if (!peer1.connected || peer2.connected) return + + peer1.send(new Buffer([1, 2, 3])) + peer2.on('data', function (data) { + t.ok(Buffer.isBuffer(data), 'data is Buffer') + t.deepEqual(data, new Buffer([1, 2, 3]), 'got correct message') + + peer2.send(new Buffer([2, 3, 4])) + peer1.on('data', function (data) { + t.ok(Buffer.isBuffer(data), 'data is Buffer') + t.deepEqual(data, new Buffer([2, 3, 4]), 'got correct message') + + peer1.destroy(tryDone) + peer2.destroy(tryDone) + + function tryDone () { + if (!peer1.connected && !peer2.connected) { + t.pass('both peers closed') + t.end() + } + } + }) + }) + } +}) + +// TODO: re-enable when Chrome supports channel.send(Blob) +// test('data send/receive Blob', function (t) { +// var peer1 = new Peer({ initiator: true, wrtc: wrtc }) +// var peer2 = new Peer({ wrtc: wrtc }) +// peer1.on('signal', function (data) { +// peer2.signal(data) +// }) +// peer2.on('signal', function (data) { +// peer1.signal(data) +// }) +// peer1.on('connect', tryTest) +// peer2.on('connect', tryTest) + +// function tryTest () { +// if (!peer1.connected || !peer2.connected) return + +// peer1.send(new Blob([ new Buffer([1, 2, 3]) ])) +// peer2.on('data', function (data) { +// t.ok(Buffer.isBuffer(data), 'data is Buffer') +// t.deepEqual(data, new Buffer([1, 2, 3]), 'got correct message') + +// peer2.send(new Blob([ new Buffer([2, 3, 4]) ])) +// peer1.on('data', function (data) { +// t.ok(Buffer.isBuffer(data), 'data is Buffer') +// t.deepEqual(data, new Buffer([2, 3, 4]), 'got correct message') + +// peer1.destroy(tryDone) +// peer2.destroy(tryDone) + +// function tryDone () { +// if (!peer1.connected && !peer2.connected) { +// t.pass('both peers closed') +// t.end() +// } +// } +// }) +// }) +// } +// }) + +test('data send/receive ArrayBuffer', function (t) { + var peer1 = new Peer({ initiator: true, wrtc: wrtc }) + var peer2 = new Peer({ wrtc: wrtc }) + peer1.on('signal', function (data) { + peer2.signal(data) + }) + peer2.on('signal', function (data) { + peer1.signal(data) + }) + peer1.on('connect', tryTest) + peer2.on('connect', tryTest) + + function tryTest () { + if (!peer1.connected || !peer2.connected) return + + peer1.send(new Uint8Array([1, 2, 3]).buffer) + peer2.on('data', function (data) { + t.ok(Buffer.isBuffer(data), 'data is Buffer') + t.deepEqual(data, new Buffer([1, 2, 3]), 'got correct message') + + peer2.send(new Uint8Array([2, 3, 4]).buffer) + peer1.on('data', function (data) { + t.ok(Buffer.isBuffer(data), 'data is Buffer') + t.deepEqual(data, new Buffer([2, 3, 4]), 'got correct message') + + peer1.destroy(tryDone) + peer2.destroy(tryDone) + + function tryDone () { + if (!peer1.connected && !peer2.connected) { + t.pass('both peers closed') + t.end() + } + } + }) + }) + } +}) diff --git a/node_modules/simple-peer/test/stream.js b/node_modules/simple-peer/test/stream.js new file mode 100644 index 00000000..a4006ba4 --- /dev/null +++ b/node_modules/simple-peer/test/stream.js @@ -0,0 +1,80 @@ +var str = require('string-to-stream') +var Peer = require('../') +var test = require('tape') +var wrtc = typeof window === 'undefined' && require('wrtc') + +test('duplex stream: send data before "connect" event', function (t) { + t.plan(9) + + var peer1 = new Peer({ initiator: true, wrtc: wrtc }) + var peer2 = new Peer({ wrtc: wrtc }) + peer1.on('signal', function (data) { if (!peer2.destroyed) peer2.signal(data) }) + peer2.on('signal', function (data) { if (!peer1.destroyed) peer1.signal(data) }) + + str('abc').pipe(peer1) + + peer1.on('data', function () { + t.fail('peer1 should not get data') + }) + peer1.on('finish', function () { + t.pass('got peer1 "finish"') + t.ok(peer1._writableState.finished) + }) + peer1.on('end', function () { + t.pass('got peer1 "end"') + t.ok(peer1._readableState.ended) + }) + + peer2.on('data', function (chunk) { + t.equal(chunk.toString(), 'abc', 'got correct message') + }) + peer2.on('finish', function () { + t.pass('got peer2 "finish"') + t.ok(peer2._writableState.finished) + }) + peer2.on('end', function () { + t.pass('got peer2 "end"') + t.ok(peer2._readableState.ended) + }) +}) + +test('duplex stream: send data one-way', function (t) { + t.plan(9) + + var peer1 = new Peer({ initiator: true, wrtc: wrtc }) + var peer2 = new Peer({ wrtc: wrtc }) + peer1.on('signal', function (data) { peer2.signal(data) }) + peer2.on('signal', function (data) { peer1.signal(data) }) + peer1.on('connect', tryTest) + peer2.on('connect', tryTest) + + function tryTest () { + if (!peer1.connected || !peer2.connected) return + + peer1.on('data', function () { + t.fail('peer1 should not get data') + }) + peer1.on('finish', function () { + t.pass('got peer1 "finish"') + t.ok(peer1._writableState.finished) + }) + peer1.on('end', function () { + t.pass('got peer1 "end"') + t.ok(peer1._readableState.ended) + }) + + peer2.on('data', function (chunk) { + t.equal(chunk.toString(), 'abc', 'got correct message') + }) + peer2.on('finish', function () { + t.pass('got peer2 "finish"') + t.ok(peer2._writableState.finished) + }) + peer2.on('end', function () { + t.pass('got peer2 "end"') + t.ok(peer2._readableState.ended) + }) + + str('abc').pipe(peer1) + } +}) diff --git a/node_modules/simple-peer/test/trickle.js b/node_modules/simple-peer/test/trickle.js new file mode 100644 index 00000000..8725f2d1 --- /dev/null +++ b/node_modules/simple-peer/test/trickle.js @@ -0,0 +1,150 @@ +var Peer = require('../') +var test = require('tape') +var wrtc = typeof window === 'undefined' && require('wrtc') + +test('disable trickle', function (t) { + var peer1 = new Peer({ initiator: true, trickle: false, wrtc: wrtc }) + var peer2 = new Peer({ trickle: false, wrtc: wrtc }) + + var numSignal1 = 0 + peer1.on('signal', function (data) { + numSignal1 += 1 + peer2.signal(data) + }) + + var numSignal2 = 0 + peer2.on('signal', function (data) { + numSignal2 += 1 + peer1.signal(data) + }) + + peer1.on('connect', tryTest) + peer2.on('connect', tryTest) + + function tryTest () { + if (!peer1.connected || !peer2.connected) return + + t.equal(numSignal1, 1, 'only one `signal` event') + t.equal(numSignal2, 1, 'only one `signal` event') + t.equal(peer1.initiator, true, 'peer1 is initiator') + t.equal(peer2.initiator, false, 'peer2 is not initiator') + + peer1.send('sup peer2') + peer2.on('data', function (data) { + t.equal(data, 'sup peer2', 'got correct message') + + peer2.send('sup peer1') + peer1.on('data', function (data) { + t.equal(data, 'sup peer1', 'got correct message') + + function tryDone () { + if (!peer1.connected && !peer2.connected) { + t.pass('both peers closed') + t.end() + } + } + + peer1.destroy(tryDone) + peer2.destroy(tryDone) + }) + }) + } +}) + +test('disable trickle (only initiator)', function (t) { + var peer1 = new Peer({ initiator: true, trickle: false, wrtc: wrtc }) + var peer2 = new Peer({ wrtc: wrtc }) + + var numSignal1 = 0 + peer1.on('signal', function (data) { + numSignal1 += 1 + peer2.signal(data) + }) + + var numSignal2 = 0 + peer2.on('signal', function (data) { + numSignal2 += 1 + peer1.signal(data) + }) + + peer1.on('connect', tryTest) + peer2.on('connect', tryTest) + + function tryTest () { + if (!peer1.connected || !peer2.connected) return + + t.equal(numSignal1, 1, 'only one `signal` event for initiator') + t.ok(numSignal2 >= 1, 'at least one `signal` event for receiver') + t.equal(peer1.initiator, true, 'peer1 is initiator') + t.equal(peer2.initiator, false, 'peer2 is not initiator') + + peer1.send('sup peer2') + peer2.on('data', function (data) { + t.equal(data, 'sup peer2', 'got correct message') + + peer2.send('sup peer1') + peer1.on('data', function (data) { + t.equal(data, 'sup peer1', 'got correct message') + + function tryDone () { + if (!peer1.connected && !peer2.connected) { + t.pass('both peers closed') + t.end() + } + } + + peer1.destroy(tryDone) + peer2.destroy(tryDone) + }) + }) + } +}) + +test('disable trickle (only receiver)', function (t) { + var peer1 = new Peer({ initiator: true, wrtc: wrtc }) + var peer2 = new Peer({ trickle: false, wrtc: wrtc }) + + var numSignal1 = 0 + peer1.on('signal', function (data) { + numSignal1 += 1 + peer2.signal(data) + }) + + var numSignal2 = 0 + peer2.on('signal', function (data) { + numSignal2 += 1 + peer1.signal(data) + }) + + peer1.on('connect', tryTest) + peer2.on('connect', tryTest) + + function tryTest () { + if (!peer1.connected || !peer2.connected) return + + t.ok(numSignal1 >= 1, 'at least one `signal` event for initiator') + t.equal(numSignal2, 1, 'only one `signal` event for receiver') + t.equal(peer1.initiator, true, 'peer1 is initiator') + t.equal(peer2.initiator, false, 'peer2 is not initiator') + + peer1.send('sup peer2') + peer2.on('data', function (data) { + t.equal(data, 'sup peer2', 'got correct message') + + peer2.send('sup peer1') + peer1.on('data', function (data) { + t.equal(data, 'sup peer1', 'got correct message') + + function tryDone () { + if (!peer1.connected && !peer2.connected) { + t.pass('both peers closed') + t.end() + } + } + + peer1.destroy(tryDone) + peer2.destroy(tryDone) + }) + }) + } +}) diff --git a/node_modules/simple-websocket/.travis.yml b/node_modules/simple-websocket/.travis.yml new file mode 100644 index 00000000..3eb88bf0 --- /dev/null +++ b/node_modules/simple-websocket/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" +env: + global: + - secure: bBPwnWpmIv7GcV8fOn1wmGgFUfiNPPwKQM3l7u9FSoPCAAzcalh12SpSFQjfDp4xu87h8QWhBo5eenUgZRTPo3DHXT63glh7A5/L15Hl0gMj0j4nimgToJ2oGbL3z4DoS8IRBz51khePJtFDdW62YNymbriKytKYc+GTbJhLsME= + - secure: FetJg1+VMCvOpZQJCPUg8KXtC4KwcC+jWQVFMPswJudFjRsUjf07Prk+WbwEVJVrVEwCiYz0z9XuaRhgYgVZFsao/nbj3wnVq+EX1fIn/VATIo5l9hVLwrYyuiPp+8HAPIKF6LaRwd5jjE7V4XYJbnLf3NG4hs6zjITQ6tlg/48= diff --git a/node_modules/simple-websocket/.zuul.yml b/node_modules/simple-websocket/.zuul.yml new file mode 100644 index 00000000..d0dda716 --- /dev/null +++ b/node_modules/simple-websocket/.zuul.yml @@ -0,0 +1,14 @@ +ui: tape +browsers: + - name: chrome + version: latest + - name: firefox + version: latest + - name: safari + version: latest + - name: iphone + version: latest + - name: ipad + version: latest + - name: android + version: latest diff --git a/node_modules/simple-websocket/LICENSE b/node_modules/simple-websocket/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/simple-websocket/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/simple-websocket/README.md b/node_modules/simple-websocket/README.md new file mode 100644 index 00000000..a55c4c36 --- /dev/null +++ b/node_modules/simple-websocket/README.md @@ -0,0 +1,108 @@ +# simple-websocket [![travis](https://img.shields.io/travis/feross/simple-websocket.svg)](https://travis-ci.org/feross/simple-websocket) [![npm](https://img.shields.io/npm/v/simple-websocket.svg)](https://npmjs.org/package/simple-websocket) + +#### Simple, EventEmitter API for WebSockets + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/simple-websocket.svg)](https://saucelabs.com/u/simple-websocket) + +## features + +- **super simple** API for working with WebSockets in the browser +- Uses `EventEmitter` interface +- supports **text and binary data** + +This module works in the browser with [browserify](http://browserify.org/), and it's used by [WebTorrent](http://webtorrent.io)! + +## install + +``` +npm install simple-websocket +``` + +## usage + +```js +var SimpleWebsocket = require('simple-websocket') + +var socket = new SimpleWebsocket('ws://echo.websocket.org') +socket.on('ready', function () { + // socket is connected! + socket.send('sup!') +}) + +socket.on('message', function (data) { + console.log('got message: ' + data) +}) +``` + +Note: If you're **NOT** using browserify, then use the standalone `simplewebsocket.bundle.js` +file included in this repo. This exports a `SimpleWebsocket` function on the `window`. + +## api + +### `socket = new SimpleWebsocket([opts])` + +Create a new WebSocket connection. + +If `opts` is specified, then the default options (shown below) will be overridden. + +``` +{ + reconnect: 5000 +} +``` + +The options do the following: + +- `reconnect` - If websocket encounters an error, reconnect after this timeout (in milliseconds). Set to `false` to disable automatic reconnect on error. + +### `socket.send(data)` + +Send text/binary data to the remote socket. `data` can be any of several types: `String`, `Buffer` (see [buffer](https://github.com/feross/buffer)), TypedArrayView (Uint8Array, etc.), or ArrayBuffer. + +Note: this method should not be called until the `sockt.on('ready')` event has fired. + +### `socket.destroy([onclose])` + +Destroy and cleanup this websocket connection. + +If the optional `onclose` paramter is passed, then it will be registered as a listener on the 'close' event. + + +## events + +### `socket.on('ready', function () {})` + +Fired when the websocket connection is ready to use. + +### `socket.on('message', function (data) {})` + +Received a message from the websocket server. + +`data` will be either a `String` or a `Buffer/Uint8Array` (see [buffer](https://github.com/feross/buffer)). + +### `socket.on('close', function () {})` + +Called when the websocket connection has closed. + +### `socket.on('error', function (err) {})` + +`err` is an `Error` object. + +Fired when a fatal error occurs. If the `reconnect` option is set to something truthy (defaults to `5000`), then this event will never get emitted because the socket will automatically reconnect on error. + +### `socket.on('warning', function (err) {})` + +`err` is an `Error` object. + +Fired when an error occurs but an auto-reconnect will be attempted. Thus, it's only a `warning`, not a full-fledged `error`. + +## real-world applications that use simple-websocket + +- [StudyNotes](http://www.apstudynotes.org) - Helping students learn faster and better +- [instant.io](https://github.com/feross/instant.io) - Secure, anonymous, streaming file transfer +- [lxjs-chat](https://github.com/feross/lxjs-chat) - Omegle chat clone +- \[ your application here - send a PR \] + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/simple-websocket/index.js b/node_modules/simple-websocket/index.js new file mode 100644 index 00000000..db3b6bc1 --- /dev/null +++ b/node_modules/simple-websocket/index.js @@ -0,0 +1,213 @@ +/* global Blob */ + +module.exports = Socket + +var debug = require('debug')('simple-websocket') +var inherits = require('inherits') +var isTypedArray = require('is-typedarray') +var stream = require('stream') +var toBuffer = require('typedarray-to-buffer') +var ws = require('ws') // websockets in node - will be empty object in browser + +var WebSocket = typeof window !== 'undefined' ? window.WebSocket : ws + +inherits(Socket, stream.Duplex) + +/** + * WebSocket. Same API as node core `net.Socket`. Duplex stream. + * @param {string} url websocket server url + * @param {Object} opts options to stream.Duplex + */ +function Socket (url, opts) { + var self = this + if (!(self instanceof Socket)) return new Socket(url, opts) + if (!opts) opts = {} + debug('new websocket: %s %o', url, opts) + + opts.allowHalfOpen = false + stream.Duplex.call(self, opts) + + self.url = url + self.connected = false + self.destroyed = false + + self._chunk = null + self._cb = null + self._interval = null + + self._ws = new WebSocket(self.url) + self._ws.binaryType = 'arraybuffer' + self._ws.onopen = self._onOpen.bind(self) + self._ws.onmessage = self._onMessage.bind(self) + self._ws.onclose = self._onClose.bind(self) + self._ws.onerror = self._onError.bind(self) + + self.on('finish', function () { + if (self.connected) { + // When stream is finished writing, close socket connection. Half open connections + // are currently not supported. + // Wait a bit before destroying so the socket flushes. + // TODO: is there a more reliable way to accomplish this? + setTimeout(function () { + self._destroy() + }, 100) + } else { + // If socket is not connected when stream is finished writing, wait until data is + // flushed to network at "connect" event. + // TODO: is there a more reliable way to accomplish this? + self.once('connect', function () { + setTimeout(function () { + self._destroy() + }, 100) + }) + } + }) + +} + +Socket.prototype.send = function (chunk) { + var self = this + var len = chunk.length || chunk.byteLength || chunk.size + self._ws.send(chunk) + debug('write: %d bytes', len) +} + +Socket.prototype.destroy = function (onclose) { + var self = this + self._destroy(null, onclose) +} + +Socket.prototype._destroy = function (err, onclose) { + var self = this + if (self.destroyed) return + if (onclose) self.once('close', onclose) + + debug('destroy (error: %s)', err && err.message) + + self.connected = false + self.destroyed = true + + clearInterval(self._interval) + self._interval = null + self._chunk = null + self._cb = null + + if (self._ws) { + try { + self._ws.close() + } catch (err) {} + + self._ws.onopen = null + self._ws.onmessage = null + self._ws.onclose = null + self._ws.onerror = null + } + self._ws = null + + this.readable = this.writable = false + + if (!self._readableState.ended) self.push(null) + if (!self._writableState.finished) self.end() + + if (err) self.emit('error', err) + self.emit('close') +} + +Socket.prototype._read = function () {} + +/** + * Send text/binary data to the WebSocket server. + * @param {string|Buffer|TypedArrayView|ArrayBuffer|Blob} chunk + * @param {string} encoding + * @param {function} cb + */ +Socket.prototype._write = function (chunk, encoding, cb) { + var self = this + if (self.destroyed) return cb(new Error('cannot write after socket is destroyed')) + + if (!isTypedArray.strict(chunk) && !(chunk instanceof ArrayBuffer) && + !Buffer.isBuffer(chunk) && typeof chunk !== 'string' && + (typeof Blob === 'undefined' || !(chunk instanceof Blob))) { + chunk = JSON.stringify(chunk) + } + + if (self.connected) { + self.send(chunk) + if (typeof ws !== 'function' && self._ws.bufferedAmount) { + debug('start backpressure: bufferedAmount %d', self._ws.bufferedAmount) + self._cb = cb + } else { + cb(null) + } + } else { + debug('write before connect') + self._chunk = chunk + self._cb = cb + } +} + +Socket.prototype._onMessage = function (event) { + var self = this + if (self.destroyed) return + var data = event.data + debug('read: %d bytes', data.byteLength || data.length) + + if (data instanceof ArrayBuffer) { + data = toBuffer(new Uint8Array(data)) + self.push(data) + } else if (Buffer.isBuffer(data)) { + self.push(data) + } else { + try { + data = JSON.parse(data) + } catch (err) {} + self.emit('data', data) + } +} + +Socket.prototype._onOpen = function () { + var self = this + if (self.connected || self.destroyed) return + self.connected = true + + if (self._chunk) { + self.send(self._chunk) + self._chunk = null + debug('sent chunk from "write before connect"') + + var cb = self._cb + self._cb = null + cb(null) + } + + // No backpressure in node. The `ws` module has a buggy `bufferedAmount` property. + // See: https://github.com/websockets/ws/issues/492 + if (typeof ws !== 'function') { + self._interval = setInterval(function () { + if (!self._cb || !self._ws || self._ws.bufferedAmount) return + debug('ending backpressure: bufferedAmount %d', self._ws.bufferedAmount) + var cb = self._cb + self._cb = null + cb(null) + }, 150) + if (self._interval.unref) self._interval.unref() + } + + debug('connect') + self.emit('connect') +} + +Socket.prototype._onClose = function () { + var self = this + if (self.destroyed) return + debug('on close') + self._destroy() +} + +Socket.prototype._onError = function () { + var self = this + if (self.destroyed) return + var err = new Error('connection error to ' + self.url) + debug('error: %s', err.message || err) + self._destroy(err) +} diff --git a/node_modules/simple-websocket/node_modules/debug/.jshintrc b/node_modules/simple-websocket/node_modules/debug/.jshintrc new file mode 100644 index 00000000..299877f2 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/.jshintrc @@ -0,0 +1,3 @@ +{ + "laxbreak": true +} diff --git a/node_modules/simple-websocket/node_modules/debug/.npmignore b/node_modules/simple-websocket/node_modules/debug/.npmignore new file mode 100644 index 00000000..7e6163db --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/.npmignore @@ -0,0 +1,6 @@ +support +test +examples +example +*.sock +dist diff --git a/node_modules/simple-websocket/node_modules/debug/History.md b/node_modules/simple-websocket/node_modules/debug/History.md new file mode 100644 index 00000000..854c9711 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/History.md @@ -0,0 +1,195 @@ + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/simple-websocket/node_modules/debug/Makefile b/node_modules/simple-websocket/node_modules/debug/Makefile new file mode 100644 index 00000000..5cf4a596 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/Makefile @@ -0,0 +1,36 @@ + +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# applications +NODE ?= $(shell which node) +NPM ?= $(NODE) $(shell which npm) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +all: dist/debug.js + +install: node_modules + +clean: + @rm -rf dist + +dist: + @mkdir -p $@ + +dist/debug.js: node_modules browser.js debug.js dist + @$(BROWSERIFY) \ + --standalone debug \ + . > $@ + +distclean: clean + @rm -rf node_modules + +node_modules: package.json + @NODE_ENV= $(NPM) install + @touch node_modules + +.PHONY: all install clean distclean diff --git a/node_modules/simple-websocket/node_modules/debug/Readme.md b/node_modules/simple-websocket/node_modules/debug/Readme.md new file mode 100644 index 00000000..b4f45e3c --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/Readme.md @@ -0,0 +1,188 @@ +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +#### Windows note + + On Windows the environment variable is set using the `set` command. + + ```cmd + set DEBUG=*,-not_this + ``` + +Then, run the program to be debugged as usual. + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: + +```js +window.myDebug = require("debug"); +``` + + ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: + +```js +myDebug.enable("worker:*") +``` + + Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +#### Web Inspector Colors + + Colors are also enabled on "Web Inspectors" that understand the `%c` formatting + option. These are WebKit web inspectors, Firefox ([since version + 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) + and the Firebug plugin for Firefox (any version). + + Colored output looks something like: + + ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) + +### stderr vs stdout + +You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: + +Example _stdout.js_: + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +### Save debug output to a file + +You can save all debug statements to a file by piping them. + +Example: + +```bash +$ DEBUG_FD=3 node your-app.js 3> whatever.log +``` + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + +## License + +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +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/node_modules/simple-websocket/node_modules/debug/bower.json b/node_modules/simple-websocket/node_modules/debug/bower.json new file mode 100644 index 00000000..6af573ff --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/bower.json @@ -0,0 +1,28 @@ +{ + "name": "visionmedia-debug", + "main": "dist/debug.js", + "version": "2.2.0", + "homepage": "https://github.com/visionmedia/debug", + "authors": [ + "TJ Holowaychuk " + ], + "description": "visionmedia-debug", + "moduleType": [ + "amd", + "es6", + "globals", + "node" + ], + "keywords": [ + "visionmedia", + "debug" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/simple-websocket/node_modules/debug/browser.js b/node_modules/simple-websocket/node_modules/debug/browser.js new file mode 100644 index 00000000..7c764522 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/browser.js @@ -0,0 +1,168 @@ + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + return JSON.stringify(v); +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} diff --git a/node_modules/simple-websocket/node_modules/debug/component.json b/node_modules/simple-websocket/node_modules/debug/component.json new file mode 100644 index 00000000..ca106372 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "2.2.0", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + } +} diff --git a/node_modules/simple-websocket/node_modules/debug/debug.js b/node_modules/simple-websocket/node_modules/debug/debug.js new file mode 100644 index 00000000..7571a860 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/debug.js @@ -0,0 +1,197 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() { + } + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/simple-websocket/node_modules/debug/node.js b/node_modules/simple-websocket/node_modules/debug/node.js new file mode 100644 index 00000000..1d392a81 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/node.js @@ -0,0 +1,209 @@ + +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); + if (0 === debugColors.length) { + return tty.isatty(fd); + } else { + return '0' !== debugColors + && 'no' !== debugColors + && 'false' !== debugColors + && 'disabled' !== debugColors; + } +} + +/** + * Map %o to `util.inspect()`, since Node doesn't do that out of the box. + */ + +var inspect = (4 === util.inspect.length ? + // node <= 0.8.x + function (v, colors) { + return util.inspect(v, void 0, void 0, colors); + } : + // node > 0.8.x + function (v, colors) { + return util.inspect(v, { colors: colors }); + } +); + +exports.formatters.o = function(v) { + return inspect(v, this.useColors) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + var name = this.namespace; + + if (useColors) { + var c = this.color; + + args[0] = ' \u001b[3' + c + ';1m' + name + ' ' + + '\u001b[0m' + + args[0] + '\u001b[3' + c + 'm' + + ' +' + exports.humanize(this.diff) + '\u001b[0m'; + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } + return args; +} + +/** + * Invokes `console.error()` with the specified arguments. + */ + +function log() { + return stream.write(util.format.apply(this, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = require('fs'); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = require('net'); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/node_modules/simple-websocket/node_modules/debug/node_modules/ms/.npmignore b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/.npmignore new file mode 100644 index 00000000..d1aa0ce4 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/.npmignore @@ -0,0 +1,5 @@ +node_modules +test +History.md +Makefile +component.json diff --git a/node_modules/simple-websocket/node_modules/debug/node_modules/ms/History.md b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/History.md new file mode 100644 index 00000000..32fdfc17 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/History.md @@ -0,0 +1,66 @@ + +0.7.1 / 2015-04-20 +================== + + * prevent extraordinary long inputs (@evilpacket) + * Fixed broken readme link + +0.7.0 / 2014-11-24 +================== + + * add time abbreviations, updated tests and readme for the new units + * fix example in the readme. + * add LICENSE file + +0.6.2 / 2013-12-05 +================== + + * Adding repository section to package.json to suppress warning from NPM. + +0.6.1 / 2013-05-10 +================== + + * fix singularization [visionmedia] + +0.6.0 / 2013-03-15 +================== + + * fix minutes + +0.5.1 / 2013-02-24 +================== + + * add component namespace + +0.5.0 / 2012-11-09 +================== + + * add short formatting as default and .long option + * add .license property to component.json + * add version to component.json + +0.4.0 / 2012-10-22 +================== + + * add rounding to fix crazy decimals + +0.3.0 / 2012-09-07 +================== + + * fix `ms()` [visionmedia] + +0.2.0 / 2012-09-03 +================== + + * add component.json [visionmedia] + * add days support [visionmedia] + * add hours support [visionmedia] + * add minutes support [visionmedia] + * add seconds support [visionmedia] + * add ms string support [visionmedia] + * refactor tests to facilitate ms(number) [visionmedia] + +0.1.0 / 2012-03-07 +================== + + * Initial release diff --git a/node_modules/simple-websocket/node_modules/debug/node_modules/ms/LICENSE b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/LICENSE new file mode 100644 index 00000000..6c07561b --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch + +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/node_modules/simple-websocket/node_modules/debug/node_modules/ms/README.md b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/README.md new file mode 100644 index 00000000..9b4fd035 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/README.md @@ -0,0 +1,35 @@ +# ms.js: miliseconds conversion utility + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('100') // 100 +``` + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as +a number (e.g: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of +equivalent ms is returned. + +## License + +MIT diff --git a/node_modules/simple-websocket/node_modules/debug/node_modules/ms/index.js b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/index.js new file mode 100644 index 00000000..4f927716 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/index.js @@ -0,0 +1,125 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/simple-websocket/node_modules/debug/node_modules/ms/package.json b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/package.json new file mode 100644 index 00000000..b12c4a07 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/node_modules/ms/package.json @@ -0,0 +1,47 @@ +{ + "name": "ms", + "version": "0.7.1", + "description": "Tiny ms conversion utility", + "repository": { + "type": "git", + "url": "git://github.com/guille/ms.js.git" + }, + "main": "./index", + "devDependencies": { + "mocha": "*", + "expect.js": "*", + "serve": "*" + }, + "component": { + "scripts": { + "ms/index.js": "index.js" + } + }, + "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", + "bugs": { + "url": "https://github.com/guille/ms.js/issues" + }, + "homepage": "https://github.com/guille/ms.js", + "_id": "ms@0.7.1", + "scripts": {}, + "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "_from": "ms@0.7.1", + "_npmVersion": "2.7.5", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "dist": { + "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz" +} diff --git a/node_modules/simple-websocket/node_modules/debug/package.json b/node_modules/simple-websocket/node_modules/debug/package.json new file mode 100644 index 00000000..665538e3 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/debug/package.json @@ -0,0 +1,73 @@ +{ + "name": "debug", + "version": "2.2.0", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + } + ], + "license": "MIT", + "dependencies": { + "ms": "0.7.1" + }, + "devDependencies": { + "browserify": "9.0.3", + "mocha": "*" + }, + "main": "./node.js", + "browser": "./browser.js", + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" + } + }, + "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@2.2.0", + "scripts": {}, + "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "_from": "debug@>=2.1.0 <3.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "tarball": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/inherits/LICENSE b/node_modules/simple-websocket/node_modules/inherits/LICENSE new file mode 100644 index 00000000..dea3013d --- /dev/null +++ b/node_modules/simple-websocket/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/simple-websocket/node_modules/inherits/README.md b/node_modules/simple-websocket/node_modules/inherits/README.md new file mode 100644 index 00000000..b1c56658 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/simple-websocket/node_modules/inherits/inherits.js b/node_modules/simple-websocket/node_modules/inherits/inherits.js new file mode 100644 index 00000000..29f5e24f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/inherits/inherits.js @@ -0,0 +1 @@ +module.exports = require('util').inherits diff --git a/node_modules/simple-websocket/node_modules/inherits/inherits_browser.js b/node_modules/simple-websocket/node_modules/inherits/inherits_browser.js new file mode 100644 index 00000000..c1e78a75 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} diff --git a/node_modules/simple-websocket/node_modules/inherits/package.json b/node_modules/simple-websocket/node_modules/inherits/package.json new file mode 100644 index 00000000..005588b2 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/inherits/package.json @@ -0,0 +1,50 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.1", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits" + }, + "license": "ISC", + "scripts": { + "test": "node test" + }, + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "_id": "inherits@2.0.1", + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "_from": "inherits@>=2.0.1 <2.1.0", + "_npmVersion": "1.3.8", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/isaacs/inherits" +} diff --git a/node_modules/simple-websocket/node_modules/inherits/test.js b/node_modules/simple-websocket/node_modules/inherits/test.js new file mode 100644 index 00000000..fc53012d --- /dev/null +++ b/node_modules/simple-websocket/node_modules/inherits/test.js @@ -0,0 +1,25 @@ +var inherits = require('./inherits.js') +var assert = require('assert') + +function test(c) { + assert(c.constructor === Child) + assert(c.constructor.super_ === Parent) + assert(Object.getPrototypeOf(c) === Child.prototype) + assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) + assert(c instanceof Child) + assert(c instanceof Parent) +} + +function Child() { + Parent.call(this) + test(this) +} + +function Parent() {} + +inherits(Child, Parent) + +var c = new Child +test(c) + +console.log('ok') diff --git a/node_modules/simple-websocket/node_modules/is-typedarray/LICENSE.md b/node_modules/simple-websocket/node_modules/is-typedarray/LICENSE.md new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/simple-websocket/node_modules/is-typedarray/LICENSE.md @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/simple-websocket/node_modules/is-typedarray/README.md b/node_modules/simple-websocket/node_modules/is-typedarray/README.md new file mode 100644 index 00000000..27528639 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/is-typedarray/README.md @@ -0,0 +1,16 @@ +# is-typedarray [![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) + +Detect whether or not an object is a +[Typed Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays). + +## Usage + +[![NPM](https://nodei.co/npm/is-typedarray.png)](https://nodei.co/npm/is-typedarray/) + +### isTypedArray(array) + +Returns `true` when array is a Typed Array, and `false` when it is not. + +## License + +MIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details. diff --git a/node_modules/simple-websocket/node_modules/is-typedarray/index.js b/node_modules/simple-websocket/node_modules/is-typedarray/index.js new file mode 100644 index 00000000..0631b854 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/is-typedarray/index.js @@ -0,0 +1,39 @@ +module.exports = isTypedArray +isTypedArray.strict = isStrictTypedArray +isTypedArray.loose = isLooseTypedArray + +var toString = Object.prototype.toString +var names = { + '[object Int8Array]': true + , '[object Int16Array]': true + , '[object Int32Array]': true + , '[object Uint8Array]': true + , '[object Uint16Array]': true + , '[object Uint32Array]': true + , '[object Float32Array]': true + , '[object Float64Array]': true +} + +function isTypedArray(arr) { + return ( + isStrictTypedArray(arr) + || isLooseTypedArray(arr) + ) +} + +function isStrictTypedArray(arr) { + return ( + arr instanceof Int8Array + || arr instanceof Int16Array + || arr instanceof Int32Array + || arr instanceof Uint8Array + || arr instanceof Uint16Array + || arr instanceof Uint32Array + || arr instanceof Float32Array + || arr instanceof Float64Array + ) +} + +function isLooseTypedArray(arr) { + return names[toString.call(arr)] +} diff --git a/node_modules/simple-websocket/node_modules/is-typedarray/package.json b/node_modules/simple-websocket/node_modules/is-typedarray/package.json new file mode 100644 index 00000000..51485ec6 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/is-typedarray/package.json @@ -0,0 +1,55 @@ +{ + "name": "is-typedarray", + "version": "0.0.0", + "description": "Detect whether or not an object is a Typed Array", + "main": "index.js", + "scripts": { + "test": "node test" + }, + "author": { + "name": "Hugh Kennedy", + "email": "hughskennedy@gmail.com", + "url": "http://hughsk.io/" + }, + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "tape": "^2.13.1" + }, + "repository": { + "type": "git", + "url": "git://github.com/hughsk/is-typedarray.git" + }, + "keywords": [ + "typed", + "array", + "detect", + "is", + "util" + ], + "bugs": { + "url": "https://github.com/hughsk/is-typedarray/issues" + }, + "homepage": "https://github.com/hughsk/is-typedarray", + "_id": "is-typedarray@0.0.0", + "_shasum": "9e5c50a8bf17b3051b48c5e5b678440821f756f4", + "_from": "is-typedarray@0.0.0", + "_npmVersion": "1.4.10", + "_npmUser": { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + }, + "maintainers": [ + { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + } + ], + "dist": { + "shasum": "9e5c50a8bf17b3051b48c5e5b678440821f756f4", + "tarball": "http://registry.npmjs.org/is-typedarray/-/is-typedarray-0.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-0.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/is-typedarray/test.js b/node_modules/simple-websocket/node_modules/is-typedarray/test.js new file mode 100644 index 00000000..b0c176fa --- /dev/null +++ b/node_modules/simple-websocket/node_modules/is-typedarray/test.js @@ -0,0 +1,34 @@ +var test = require('tape') +var ista = require('./') + +test('strict', function(t) { + t.ok(ista.strict(new Int8Array), 'Int8Array') + t.ok(ista.strict(new Int16Array), 'Int16Array') + t.ok(ista.strict(new Int32Array), 'Int32Array') + t.ok(ista.strict(new Uint8Array), 'Uint8Array') + t.ok(ista.strict(new Uint16Array), 'Uint16Array') + t.ok(ista.strict(new Uint32Array), 'Uint32Array') + t.ok(ista.strict(new Float32Array), 'Float32Array') + t.ok(ista.strict(new Float64Array), 'Float64Array') + + t.ok(!ista.strict(new Array), 'Array') + t.ok(!ista.strict([]), '[]') + + t.end() +}) + +test('loose', function(t) { + t.ok(ista.loose(new Int8Array), 'Int8Array') + t.ok(ista.loose(new Int16Array), 'Int16Array') + t.ok(ista.loose(new Int32Array), 'Int32Array') + t.ok(ista.loose(new Uint8Array), 'Uint8Array') + t.ok(ista.loose(new Uint16Array), 'Uint16Array') + t.ok(ista.loose(new Uint32Array), 'Uint32Array') + t.ok(ista.loose(new Float32Array), 'Float32Array') + t.ok(ista.loose(new Float64Array), 'Float64Array') + + t.ok(!ista.loose(new Array), 'Array') + t.ok(!ista.loose([]), '[]') + + t.end() +}) diff --git a/node_modules/simple-websocket/node_modules/typedarray-to-buffer/.travis.yml b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/.travis.yml new file mode 100644 index 00000000..b3da453e --- /dev/null +++ b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: +- '0.10' +env: + global: + - secure: i51rE9rZGHbcZWlL58j3H1qtL23OIV2r0X4TcQKNI3pw2mubdHFJmfPNNO19ItfReu8wwQMxOehKamwaNvqMiKWyHfn/QcThFQysqzgGZ6AgnUbYx9od6XFNDeWd1sVBf7QBAL07y7KWlYGWCwFwWjabSVySzQhEBdisPcskfkI= + - secure: BKq6/5z9LK3KDkTjs7BGeBZ1KsWgz+MsAXZ4P64NSeVGFaBdXU45+ww1mwxXFt5l22/mhyOQZfebQl+kGVqRSZ+DEgQeCymkNZ6CD8c6w6cLuOJXiXwuu/cDM2DD0tfGeu2YZC7yEikP7BqEFwH3D324rRzSGLF2RSAAwkOI7bE= diff --git a/node_modules/simple-websocket/node_modules/typedarray-to-buffer/.zuul.yml b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/.zuul.yml new file mode 100644 index 00000000..da322928 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/.zuul.yml @@ -0,0 +1,18 @@ +ui: tape +browsers: + - name: chrome + version: 26..latest + - name: firefox + version: 21..latest + - name: safari + version: 5..latest + - name: ie + version: 8..latest + - name: opera + version: 12..latest + - name: iphone + version: 5.0..latest + - name: ipad + version: 5.0..latest + - name: android + version: 4.0..latest diff --git a/node_modules/simple-websocket/node_modules/typedarray-to-buffer/LICENSE b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/LICENSE new file mode 100644 index 00000000..0c068cee --- /dev/null +++ b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/simple-websocket/node_modules/typedarray-to-buffer/README.md b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/README.md new file mode 100644 index 00000000..efcff699 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/README.md @@ -0,0 +1,78 @@ +# typedarray-to-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][npm-url] + +#### Convert a typed array to a [Buffer](https://github.com/feross/buffer) without a copy. + +[![saucelabs][saucelabs-image]][saucelabs-url] + +[travis-image]: https://img.shields.io/travis/feross/typedarray-to-buffer.svg?style=flat +[travis-url]: https://travis-ci.org/feross/typedarray-to-buffer +[npm-image]: https://img.shields.io/npm/v/typedarray-to-buffer.svg?style=flat +[npm-url]: https://npmjs.org/package/typedarray-to-buffer +[downloads-image]: https://img.shields.io/npm/dm/typedarray-to-buffer.svg?style=flat +[saucelabs-image]: https://saucelabs.com/browser-matrix/typedarray-to-buffer.svg +[saucelabs-url]: https://saucelabs.com/u/typedarray-to-buffer + +Say you're using the ['buffer'](https://github.com/feross/buffer) module on npm, or +[browserify](http://browserify.org/) and you're working with lots of binary data. + +Unfortunately, sometimes the browser or someone else's API gives you an `ArrayBuffer` +or a typed array like `Uint8Array` to work with and you need to convert it to a +`Buffer`. What do you do? + +Of course: `new Buffer(uint8array)` + +But, alas, every time you do `new Buffer(uint8array)` **the entire array gets copied**. +The `Buffer` constructor does a copy; this is +defined by the [node docs](http://nodejs.org/api/buffer.html) and the 'buffer' module +matches the node API exactly. + +So, how can we avoid this expensive copy in +[performance critical applications](https://github.com/feross/buffer/issues/22)? + +***Simply use this module, of course!*** + +## install + +```bash +npm install typedarray-to-buffer +``` + +## usage + +To convert a typed array to a `Buffer` **without a copy**, do this: + +```js +var toBuffer = require('typedarray-to-buffer') + +var arr = new Uint8Array([1, 2, 3]) +arr = toBuffer(arr) + +// arr is a buffer now! + +arr.toString() // '\u0001\u0002\u0003' +arr.readUInt16BE(0) // 258 +``` + +## how it works + +If the browser supports typed arrays, then `toBuffer` will **augment the typed array** you +pass in with the `Buffer` methods and return it. See [how does Buffer +work?](https://github.com/feross/buffer#how-does-it-work) for more about how augmentation +works. + +This module uses the typed array's underlying `ArrayBuffer` to back the new `Buffer`. This +respects the "view" on the `ArrayBuffer`, i.e. `byteOffset` and `byteLength`. In other +words, if you do `toBuffer(new Uint32Array([1, 2, 3]))`, then the new `Buffer` will +contain `[1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0]`, **not** `[1, 2, 3]`. And it still doesn't +require a copy. + +If the browser doesn't support typed arrays, then `toBuffer` will create a new `Buffer` +object, copy the data into it, and return it. There's no simple performance optimization +we can do for old browsers. Oh well. + +If this module is used in node, then it will just call `new Buffer`. This is just for +the convenience of modules that work in both node and the browser. + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/simple-websocket/node_modules/typedarray-to-buffer/index.js b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/index.js new file mode 100644 index 00000000..674d5133 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/index.js @@ -0,0 +1,31 @@ +/** + * Convert a typed array to a Buffer without a copy + * + * Author: Feross Aboukhadijeh + * License: MIT + * + * `npm install typedarray-to-buffer` + */ + +var isTypedArray = require('is-typedarray').strict + +module.exports = function (arr) { + // If `Buffer` is the browser `buffer` module, and the browser supports typed arrays, + // then avoid a copy. Otherwise, create a `Buffer` with a copy. + var constructor = Buffer.TYPED_ARRAY_SUPPORT + ? Buffer._augment + : function (arr) { return new Buffer(arr) } + + if (arr instanceof Uint8Array) { + return constructor(arr) + } else if (arr instanceof ArrayBuffer) { + return constructor(new Uint8Array(arr)) + } else if (isTypedArray(arr)) { + // Use the typed array's underlying ArrayBuffer to back new Buffer. This respects + // the "view" on the ArrayBuffer, i.e. byteOffset and byteLength. No copy. + return constructor(new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength)) + } else { + // Unsupported type, just pass it through to the `Buffer` constructor. + return new Buffer(arr) + } +} diff --git a/node_modules/simple-websocket/node_modules/typedarray-to-buffer/package.json b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/package.json new file mode 100644 index 00000000..b6bc2a11 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/package.json @@ -0,0 +1,75 @@ +{ + "name": "typedarray-to-buffer", + "description": "Convert a typed array to a Buffer without a copy", + "version": "3.0.2", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/typedarray-to-buffer/issues" + }, + "dependencies": { + "is-typedarray": "0.0.0" + }, + "devDependencies": { + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "http://feross.org", + "keywords": [ + "buffer", + "typed array", + "convert", + "no copy", + "uint8array", + "uint16array", + "uint32array", + "int16array", + "int32array", + "float32array", + "float64array", + "browser", + "arraybuffer", + "dataview" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/typedarray-to-buffer.git" + }, + "scripts": { + "test": "npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "testling": { + "files": "test/*.js" + }, + "gitHead": "39dcf6abd075fe3aa516f9c62781c06cca0e60dd", + "_id": "typedarray-to-buffer@3.0.2", + "_shasum": "baded34efc36180e88b3294257651b82010d836e", + "_from": "typedarray-to-buffer@>=3.0.1 <4.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "baded34efc36180e88b3294257651b82010d836e", + "tarball": "http://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/typedarray-to-buffer/test/basic.js b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/test/basic.js new file mode 100644 index 00000000..d1aa9dee --- /dev/null +++ b/node_modules/simple-websocket/node_modules/typedarray-to-buffer/test/basic.js @@ -0,0 +1,52 @@ +var test = require('tape') +var toBuffer = require('../') + +test('convert to buffer from Uint8Array', function (t) { + if (typeof Uint8Array !== 'undefined') { + var arr = new Uint8Array([1, 2, 3]) + arr = toBuffer(arr) + + t.deepEqual(arr, new Buffer([1, 2, 3]), 'contents equal') + t.ok(Buffer.isBuffer(arr), 'is buffer') + t.equal(arr.readUInt8(0), 1) + t.equal(arr.readUInt8(1), 2) + t.equal(arr.readUInt8(2), 3) + } else { + t.pass('browser lacks Uint8Array support, skip test') + } + t.end() +}) + +test('convert to buffer from another arrayview type (Uint32Array)', function (t) { + if (typeof Uint32Array !== 'undefined') { + var arr = new Uint32Array([1, 2, 3]) + arr = toBuffer(arr) + + t.deepEqual(arr, new Buffer([1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0]), 'contents equal') + t.ok(Buffer.isBuffer(arr), 'is buffer') + t.equal(arr.readUInt32LE(0), 1) + t.equal(arr.readUInt32LE(4), 2) + t.equal(arr.readUInt32LE(8), 3) + t.equal(arr instanceof Uint8Array, !!Buffer.TYPED_ARRAY_SUPPORT) + + } else { + t.pass('browser lacks Uint32Array support, skip test') + } + t.end() +}) + +test('convert to buffer from ArrayBuffer', function (t) { + if (typeof Uint32Array !== 'undefined') { + var arr = new Uint32Array([1, 2, 3]).subarray(1, 2) + arr = toBuffer(arr) + + t.deepEqual(arr, new Buffer([2, 0, 0, 0]), 'contents equal') + t.ok(Buffer.isBuffer(arr), 'is buffer') + t.equal(arr.readUInt32LE(0), 2) + t.equal(arr instanceof Uint8Array, !!Buffer.TYPED_ARRAY_SUPPORT) + + } else { + t.pass('browser lacks ArrayBuffer support, skip test') + } + t.end() +}) diff --git a/node_modules/simple-websocket/node_modules/ws/.npmignore b/node_modules/simple-websocket/node_modules/ws/.npmignore new file mode 100644 index 00000000..1eba800f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/.npmignore @@ -0,0 +1,11 @@ +npm-debug.log +node_modules +.*.swp +.lock-* +build + +bench +doc +examples +test + diff --git a/node_modules/simple-websocket/node_modules/ws/.travis.yml b/node_modules/simple-websocket/node_modules/ws/.travis.yml new file mode 100644 index 00000000..97358668 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +npm_args: --ws:native +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/simple-websocket/node_modules/ws/Makefile b/node_modules/simple-websocket/node_modules/ws/Makefile new file mode 100644 index 00000000..00f19fa0 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/Makefile @@ -0,0 +1,40 @@ +ALL_TESTS = $(shell find test/ -name '*.test.js') +ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') + +all: + node-gyp configure build + +clean: + node-gyp clean + +run-tests: + @./node_modules/.bin/mocha \ + -t 5000 \ + -s 2400 \ + $(TESTFLAGS) \ + $(TESTS) + +run-integrationtests: + @./node_modules/.bin/mocha \ + -t 5000 \ + -s 6000 \ + $(TESTFLAGS) \ + $(TESTS) + +test: + @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests + +integrationtest: + @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests + +benchmark: + @node bench/sender.benchmark.js + @node bench/parser.benchmark.js + +autobahn: + @NODE_PATH=lib node test/autobahn.js + +autobahn-server: + @NODE_PATH=lib node test/autobahn-server.js + +.PHONY: test diff --git a/node_modules/simple-websocket/node_modules/ws/README.md b/node_modules/simple-websocket/node_modules/ws/README.md new file mode 100644 index 00000000..fef2fe66 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/README.md @@ -0,0 +1,187 @@ +# ws: a node.js websocket library + +[![Build Status](https://travis-ci.org/einaros/ws.svg?branch=master)](https://travis-ci.org/einaros/ws) + +`ws` is a simple to use WebSocket implementation, up-to-date against RFC-6455, +and [probably the fastest WebSocket library for node.js][archive]. + +Passes the quite extensive Autobahn test suite. See http://einaros.github.com/ws +for the full reports. + +## Protocol support + +* **Hixie draft 76** (Old and deprecated, but still in use by Safari and Opera. + Added to ws version 0.4.2, but server only. Can be disabled by setting the + `disableHixie` option to true.) +* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) +* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`) + +### Installing + +``` +npm install --save ws +``` + +### Sending and receiving text data + +```js +var WebSocket = require('ws'); +var ws = new WebSocket('ws://www.host.com/path'); + +ws.on('open', function open() { + ws.send('something'); +}); + +ws.on('message', function(data, flags) { + // flags.binary will be set if a binary data is received. + // flags.masked will be set if the data was masked. +}); +``` + +### Sending binary data + +```js +var WebSocket = require('ws'); +var ws = new WebSocket('ws://www.host.com/path'); + +ws.on('open', function open() { + var array = new Float32Array(5); + + for (var i = 0; i < array.length; ++i) { + array[i] = i / 2; + } + + ws.send(array, { binary: true, mask: true }); +}); +``` + +Setting `mask`, as done for the send options above, will cause the data to be +masked according to the WebSocket protocol. The same option applies for text +data. + +### Server example + +```js +var WebSocketServer = require('ws').Server + , wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('message', function incoming(message) { + console.log('received: %s', message); + }); + + ws.send('something'); +}); +``` + +### Server sending broadcast data + +```js +var WebSocketServer = require('ws').Server + , wss = new WebSocketServer({ port: 8080 }); + +wss.broadcast = function broadcast(data) { + wss.clients.forEach(function each(client) { + client.send(data); + }); +}; +``` + +### Error handling best practices + +```js +// If the WebSocket is closed before the following send is attempted +ws.send('something'); + +// Errors (both immediate and async write errors) can be detected in an optional +// callback. The callback is also the only way of being notified that data has +// actually been sent. +ws.send('something', function ack(error) { + // if error is not defined, the send has been completed, + // otherwise the error object will indicate what failed. +}); + +// Immediate errors can also be handled with try/catch-blocks, but **note** that +// since sends are inherently asynchronous, socket write failures will *not* be +// captured when this technique is used. +try { ws.send('something'); } +catch (e) { /* handle error */ } +``` + +### echo.websocket.org demo + +```js +var WebSocket = require('ws'); +var ws = new WebSocket('ws://echo.websocket.org/', { + protocolVersion: 8, + origin: 'http://websocket.org' +}); + +ws.on('open', function open() { + console.log('connected'); + ws.send(Date.now().toString(), {mask: true}); +}); + +ws.on('close', function close() { + console.log('disconnected'); +}); + +ws.on('message', function message(data, flags) { + console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags); + + setTimeout(function timeout() { + ws.send(Date.now().toString(), {mask: true}); + }, 500); +}); +``` + +### Other examples + +For a full example with a browser client communicating with a ws server, see the +examples folder. + +Note that the usage together with Express 3.0 is quite different from Express +2.x. The difference is expressed in the two different serverstats-examples. + +Otherwise, see the test cases. + +### Running the tests + +``` +make test +``` + +## API Docs + +See the doc/ directory for Node.js-like docs for the ws classes. + +## Changelog + +We're using the GitHub `releases` for changelog entries. + +## License + +(The MIT License) + +Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com> + +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. + +[archive]: http://web.archive.org/web/20130314230536/http://hobbycoding.posterous.com/the-fastest-websocket-module-for-nodejs diff --git a/node_modules/simple-websocket/node_modules/ws/index.js b/node_modules/simple-websocket/node_modules/ws/index.js new file mode 100644 index 00000000..a7e8644b --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/index.js @@ -0,0 +1,49 @@ +'use strict'; + +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var WS = module.exports = require('./lib/WebSocket'); + +WS.Server = require('./lib/WebSocketServer'); +WS.Sender = require('./lib/Sender'); +WS.Receiver = require('./lib/Receiver'); + +/** + * Create a new WebSocket server. + * + * @param {Object} options Server options + * @param {Function} fn Optional connection listener. + * @returns {WS.Server} + * @api public + */ +WS.createServer = function createServer(options, fn) { + var server = new WS.Server(options); + + if (typeof fn === 'function') { + server.on('connection', fn); + } + + return server; +}; + +/** + * Create a new WebSocket connection. + * + * @param {String} address The URL/address we need to connect to. + * @param {Function} fn Open listener. + * @returns {WS} + * @api public + */ +WS.connect = WS.createConnection = function connect(address, fn) { + var client = new WS(address); + + if (typeof fn === 'function') { + client.on('open', fn); + } + + return client; +}; diff --git a/node_modules/simple-websocket/node_modules/ws/lib/BufferPool.js b/node_modules/simple-websocket/node_modules/ws/lib/BufferPool.js new file mode 100644 index 00000000..faf8637c --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/BufferPool.js @@ -0,0 +1,59 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util'); + +function BufferPool(initialSize, growStrategy, shrinkStrategy) { + if (typeof initialSize === 'function') { + shrinkStrategy = growStrategy; + growStrategy = initialSize; + initialSize = 0; + } + else if (typeof initialSize === 'undefined') { + initialSize = 0; + } + this._growStrategy = (growStrategy || function(db, size) { + return db.used + size; + }).bind(null, this); + this._shrinkStrategy = (shrinkStrategy || function(db) { + return initialSize; + }).bind(null, this); + this._buffer = initialSize ? new Buffer(initialSize) : null; + this._offset = 0; + this._used = 0; + this._changeFactor = 0; + this.__defineGetter__('size', function(){ + return this._buffer == null ? 0 : this._buffer.length; + }); + this.__defineGetter__('used', function(){ + return this._used; + }); +} + +BufferPool.prototype.get = function(length) { + if (this._buffer == null || this._offset + length > this._buffer.length) { + var newBuf = new Buffer(this._growStrategy(length)); + this._buffer = newBuf; + this._offset = 0; + } + this._used += length; + var buf = this._buffer.slice(this._offset, this._offset + length); + this._offset += length; + return buf; +} + +BufferPool.prototype.reset = function(forceNewBuffer) { + var len = this._shrinkStrategy(); + if (len < this.size) this._changeFactor -= 1; + if (forceNewBuffer || this._changeFactor < -2) { + this._changeFactor = 0; + this._buffer = len ? new Buffer(len) : null; + } + this._offset = 0; + this._used = 0; +} + +module.exports = BufferPool; diff --git a/node_modules/simple-websocket/node_modules/ws/lib/BufferUtil.fallback.js b/node_modules/simple-websocket/node_modules/ws/lib/BufferUtil.fallback.js new file mode 100644 index 00000000..508542c9 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/BufferUtil.fallback.js @@ -0,0 +1,47 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.BufferUtil = { + merge: function(mergedBuffer, buffers) { + var offset = 0; + for (var i = 0, l = buffers.length; i < l; ++i) { + var buf = buffers[i]; + buf.copy(mergedBuffer, offset); + offset += buf.length; + } + }, + mask: function(source, mask, output, offset, length) { + var maskNum = mask.readUInt32LE(0, true); + var i = 0; + for (; i < length - 3; i += 4) { + var num = maskNum ^ source.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + output.writeUInt32LE(num, offset + i, true); + } + switch (length % 4) { + case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; + case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; + case 1: output[offset + i] = source[i] ^ mask[0]; + case 0:; + } + }, + unmask: function(data, mask) { + var maskNum = mask.readUInt32LE(0, true); + var length = data.length; + var i = 0; + for (; i < length - 3; i += 4) { + var num = maskNum ^ data.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + data.writeUInt32LE(num, i, true); + } + switch (length % 4) { + case 3: data[i + 2] = data[i + 2] ^ mask[2]; + case 2: data[i + 1] = data[i + 1] ^ mask[1]; + case 1: data[i] = data[i] ^ mask[0]; + case 0:; + } + } +} diff --git a/node_modules/simple-websocket/node_modules/ws/lib/BufferUtil.js b/node_modules/simple-websocket/node_modules/ws/lib/BufferUtil.js new file mode 100644 index 00000000..18c69989 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/BufferUtil.js @@ -0,0 +1,13 @@ +'use strict'; + +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +try { + module.exports = require('bufferutil'); +} catch (e) { + module.exports = require('./BufferUtil.fallback'); +} diff --git a/node_modules/simple-websocket/node_modules/ws/lib/ErrorCodes.js b/node_modules/simple-websocket/node_modules/ws/lib/ErrorCodes.js new file mode 100644 index 00000000..55ebd529 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/ErrorCodes.js @@ -0,0 +1,24 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports = { + isValidErrorCode: function(code) { + return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || + (code >= 3000 && code <= 4999); + }, + 1000: 'normal', + 1001: 'going away', + 1002: 'protocol error', + 1003: 'unsupported data', + 1004: 'reserved', + 1005: 'reserved for extensions', + 1006: 'reserved for extensions', + 1007: 'inconsistent or invalid data', + 1008: 'policy violation', + 1009: 'message too big', + 1010: 'extension handshake missing', + 1011: 'an unexpected condition prevented the request from being fulfilled', +}; \ No newline at end of file diff --git a/node_modules/simple-websocket/node_modules/ws/lib/Extensions.js b/node_modules/simple-websocket/node_modules/ws/lib/Extensions.js new file mode 100644 index 00000000..a465ace2 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/Extensions.js @@ -0,0 +1,70 @@ + +var util = require('util'); + +/** + * Module exports. + */ + +exports.parse = parse; +exports.format = format; + +/** + * Parse extensions header value + */ + +function parse(value) { + value = value || ''; + + var extensions = {}; + + value.split(',').forEach(function(v) { + var params = v.split(';'); + var token = params.shift().trim(); + var paramsList = extensions[token] = extensions[token] || []; + var parsedParams = {}; + + params.forEach(function(param) { + var parts = param.trim().split('='); + var key = parts[0]; + var value = parts[1]; + if (typeof value === 'undefined') { + value = true; + } else { + // unquote value + if (value[0] === '"') { + value = value.slice(1); + } + if (value[value.length - 1] === '"') { + value = value.slice(0, value.length - 1); + } + } + (parsedParams[key] = parsedParams[key] || []).push(value); + }); + + paramsList.push(parsedParams); + }); + + return extensions; +} + +/** + * Format extensions header value + */ + +function format(value) { + return Object.keys(value).map(function(token) { + var paramsList = value[token]; + if (!util.isArray(paramsList)) { + paramsList = [paramsList]; + } + return paramsList.map(function(params) { + return [token].concat(Object.keys(params).map(function(k) { + var p = params[k]; + if (!util.isArray(p)) p = [p]; + return p.map(function(v) { + return v === true ? k : k + '=' + v; + }).join('; '); + })).join('; '); + }).join(', '); + }).join(', '); +} diff --git a/node_modules/simple-websocket/node_modules/ws/lib/PerMessageDeflate.js b/node_modules/simple-websocket/node_modules/ws/lib/PerMessageDeflate.js new file mode 100644 index 00000000..f7359779 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/PerMessageDeflate.js @@ -0,0 +1,289 @@ + +var zlib = require('zlib'); + +var AVAILABLE_WINDOW_BITS = [8, 9, 10, 11, 12, 13, 14, 15]; +var DEFAULT_WINDOW_BITS = 15; +var DEFAULT_MEM_LEVEL = 8; + +PerMessageDeflate.extensionName = 'permessage-deflate'; + +/** + * Per-message Compression Extensions implementation + */ + +function PerMessageDeflate(options, isServer) { + this._options = options || {}; + this._isServer = !!isServer; + this._inflate = null; + this._deflate = null; + this.params = null; +} + +/** + * Create extension parameters offer + * + * @api public + */ + +PerMessageDeflate.prototype.offer = function() { + var params = {}; + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + return params; +}; + +/** + * Accept extension offer + * + * @api public + */ + +PerMessageDeflate.prototype.accept = function(paramsList) { + paramsList = this.normalizeParams(paramsList); + + var params; + if (this._isServer) { + params = this.acceptAsServer(paramsList); + } else { + params = this.acceptAsClient(paramsList); + } + + this.params = params; + return params; +}; + +/** + * Accept extension offer from client + * + * @api private + */ + +PerMessageDeflate.prototype.acceptAsServer = function(paramsList) { + var accepted = {}; + var result = paramsList.some(function(params) { + accepted = {}; + if (this._options.serverNoContextTakeover === false && params.server_no_context_takeover) { + return; + } + if (this._options.serverMaxWindowBits === false && params.server_max_window_bits) { + return; + } + if (typeof this._options.serverMaxWindowBits === 'number' && + typeof params.server_max_window_bits === 'number' && + this._options.serverMaxWindowBits > params.server_max_window_bits) { + return; + } + if (typeof this._options.clientMaxWindowBits === 'number' && !params.client_max_window_bits) { + return; + } + + if (this._options.serverNoContextTakeover || params.server_no_context_takeover) { + accepted.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover !== false && params.client_no_context_takeover) { + accepted.client_no_context_takeover = true; + } + if (typeof this._options.serverMaxWindowBits === 'number') { + accepted.server_max_window_bits = this._options.serverMaxWindowBits; + } else if (typeof params.server_max_window_bits === 'number') { + accepted.server_max_window_bits = params.server_max_window_bits; + } + if (typeof this._options.clientMaxWindowBits === 'number') { + accepted.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits !== false && typeof params.client_max_window_bits === 'number') { + accepted.client_max_window_bits = params.client_max_window_bits; + } + return true; + }, this); + + if (!result) { + throw new Error('Doesn\'t support the offered configuration'); + } + + return accepted; +}; + +/** + * Accept extension response from server + * + * @api privaye + */ + +PerMessageDeflate.prototype.acceptAsClient = function(paramsList) { + var params = paramsList[0]; + if (this._options.clientNoContextTakeover != null) { + if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) { + throw new Error('Invalid value for "client_no_context_takeover"'); + } + } + if (this._options.clientMaxWindowBits != null) { + if (this._options.clientMaxWindowBits === false && params.client_max_window_bits) { + throw new Error('Invalid value for "client_max_window_bits"'); + } + if (typeof this._options.clientMaxWindowBits === 'number' && + (!params.client_max_window_bits || params.client_max_window_bits > this._options.clientMaxWindowBits)) { + throw new Error('Invalid value for "client_max_window_bits"'); + } + } + return params; +}; + +/** + * Normalize extensions parameters + * + * @api private + */ + +PerMessageDeflate.prototype.normalizeParams = function(paramsList) { + return paramsList.map(function(params) { + Object.keys(params).forEach(function(key) { + var value = params[key]; + if (value.length > 1) { + throw new Error('Multiple extension parameters for ' + key); + } + + value = value[0]; + + switch (key) { + case 'server_no_context_takeover': + case 'client_no_context_takeover': + if (value !== true) { + throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')'); + } + params[key] = true; + break; + case 'server_max_window_bits': + case 'client_max_window_bits': + if (typeof value === 'string') { + value = parseInt(value, 10); + if (!~AVAILABLE_WINDOW_BITS.indexOf(value)) { + throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')'); + } + } + if (!this._isServer && value === true) { + throw new Error('Missing extension parameter value for ' + key); + } + params[key] = value; + break; + default: + throw new Error('Not defined extension parameter (' + key + ')'); + } + }, this); + return params; + }, this); +}; + +/** + * Decompress message + * + * @api public + */ + +PerMessageDeflate.prototype.decompress = function (data, fin, callback) { + var endpoint = this._isServer ? 'client' : 'server'; + + if (!this._inflate) { + var maxWindowBits = this.params[endpoint + '_max_window_bits']; + this._inflate = zlib.createInflateRaw({ + windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS + }); + } + + var self = this; + var buffers = []; + + this._inflate.on('error', onError).on('data', onData); + this._inflate.write(data); + if (fin) { + this._inflate.write(new Buffer([0x00, 0x00, 0xff, 0xff])); + } + this._inflate.flush(function() { + cleanup(); + callback(null, Buffer.concat(buffers)); + }); + + function onError(err) { + cleanup(); + callback(err); + } + + function onData(data) { + buffers.push(data); + } + + function cleanup() { + self._inflate.removeListener('error', onError); + self._inflate.removeListener('data', onData); + if (fin && self.params[endpoint + '_no_context_takeover']) { + self._inflate = null; + } + } +}; + +/** + * Compress message + * + * @api public + */ + +PerMessageDeflate.prototype.compress = function (data, fin, callback) { + var endpoint = this._isServer ? 'server' : 'client'; + + if (!this._deflate) { + var maxWindowBits = this.params[endpoint + '_max_window_bits']; + this._deflate = zlib.createDeflateRaw({ + flush: zlib.Z_SYNC_FLUSH, + windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS, + memLevel: this._options.memLevel || DEFAULT_MEM_LEVEL + }); + } + + var self = this; + var buffers = []; + + this._deflate.on('error', onError).on('data', onData); + this._deflate.write(data); + this._deflate.flush(function() { + cleanup(); + var data = Buffer.concat(buffers); + if (fin) { + data = data.slice(0, data.length - 4); + } + callback(null, data); + }); + + function onError(err) { + cleanup(); + callback(err); + } + + function onData(data) { + buffers.push(data); + } + + function cleanup() { + self._deflate.removeListener('error', onError); + self._deflate.removeListener('data', onData); + if (fin && self.params[endpoint + '_no_context_takeover']) { + self._deflate = null; + } + } +}; + +module.exports = PerMessageDeflate; + diff --git a/node_modules/simple-websocket/node_modules/ws/lib/Receiver.hixie.js b/node_modules/simple-websocket/node_modules/ws/lib/Receiver.hixie.js new file mode 100644 index 00000000..a8e41c47 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/Receiver.hixie.js @@ -0,0 +1,180 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util'); + +/** + * State constants + */ + +var EMPTY = 0 + , BODY = 1; +var BINARYLENGTH = 2 + , BINARYBODY = 3; + +/** + * Hixie Receiver implementation + */ + +function Receiver () { + this.state = EMPTY; + this.buffers = []; + this.messageEnd = -1; + this.spanLength = 0; + this.dead = false; + + this.onerror = function() {}; + this.ontext = function() {}; + this.onbinary = function() {}; + this.onclose = function() {}; + this.onping = function() {}; + this.onpong = function() {}; +} + +module.exports = Receiver; + +/** + * Add new data to the parser. + * + * @api public + */ + +Receiver.prototype.add = function(data) { + var self = this; + function doAdd() { + if (self.state === EMPTY) { + if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) { + self.reset(); + self.onclose(); + return; + } + if (data[0] === 0x80) { + self.messageEnd = 0; + self.state = BINARYLENGTH; + data = data.slice(1); + } else { + + if (data[0] !== 0x00) { + self.error('payload must start with 0x00 byte', true); + return; + } + data = data.slice(1); + self.state = BODY; + + } + } + if (self.state === BINARYLENGTH) { + var i = 0; + while ((i < data.length) && (data[i] & 0x80)) { + self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); + ++i; + } + if (i < data.length) { + self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); + self.state = BINARYBODY; + ++i; + } + if (i > 0) + data = data.slice(i); + } + if (self.state === BINARYBODY) { + var dataleft = self.messageEnd - self.spanLength; + if (data.length >= dataleft) { + // consume the whole buffer to finish the frame + self.buffers.push(data); + self.spanLength += dataleft; + self.messageEnd = dataleft; + return self.parse(); + } + // frame's not done even if we consume it all + self.buffers.push(data); + self.spanLength += data.length; + return; + } + self.buffers.push(data); + if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) { + self.spanLength += self.messageEnd; + return self.parse(); + } + else self.spanLength += data.length; + } + while(data) data = doAdd(); +}; + +/** + * Releases all resources used by the receiver. + * + * @api public + */ + +Receiver.prototype.cleanup = function() { + this.dead = true; + this.state = EMPTY; + this.buffers = []; +}; + +/** + * Process buffered data. + * + * @api public + */ + +Receiver.prototype.parse = function() { + var output = new Buffer(this.spanLength); + var outputIndex = 0; + for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) { + var buffer = this.buffers[bi]; + buffer.copy(output, outputIndex); + outputIndex += buffer.length; + } + var lastBuffer = this.buffers[this.buffers.length - 1]; + if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd); + if (this.state !== BODY) --this.messageEnd; + var tail = null; + if (this.messageEnd < lastBuffer.length - 1) { + tail = lastBuffer.slice(this.messageEnd + 1); + } + this.reset(); + this.ontext(output.toString('utf8')); + return tail; +}; + +/** + * Handles an error + * + * @api private + */ + +Receiver.prototype.error = function (reason, terminate) { + this.reset(); + this.onerror(reason, terminate); + return this; +}; + +/** + * Reset parser state + * + * @api private + */ + +Receiver.prototype.reset = function (reason) { + if (this.dead) return; + this.state = EMPTY; + this.buffers = []; + this.messageEnd = -1; + this.spanLength = 0; +}; + +/** + * Internal api + */ + +function bufferIndex(buffer, byte) { + for (var i = 0, l = buffer.length; i < l; ++i) { + if (buffer[i] === byte) return i; + } + return -1; +} diff --git a/node_modules/simple-websocket/node_modules/ws/lib/Receiver.js b/node_modules/simple-websocket/node_modules/ws/lib/Receiver.js new file mode 100644 index 00000000..1ae1c4e8 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/Receiver.js @@ -0,0 +1,698 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util') + , Validation = require('./Validation').Validation + , ErrorCodes = require('./ErrorCodes') + , BufferPool = require('./BufferPool') + , bufferUtil = require('./BufferUtil').BufferUtil + , PerMessageDeflate = require('./PerMessageDeflate'); + +/** + * HyBi Receiver implementation + */ + +function Receiver (extensions) { + // memory pool for fragmented messages + var fragmentedPoolPrevUsed = -1; + this.fragmentedBufferPool = new BufferPool(1024, function(db, length) { + return db.used + length; + }, function(db) { + return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ? + (fragmentedPoolPrevUsed + db.used) / 2 : + db.used; + }); + + // memory pool for unfragmented messages + var unfragmentedPoolPrevUsed = -1; + this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) { + return db.used + length; + }, function(db) { + return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ? + (unfragmentedPoolPrevUsed + db.used) / 2 : + db.used; + }); + + this.extensions = extensions || {}; + this.state = { + activeFragmentedOperation: null, + lastFragment: false, + masked: false, + opcode: 0, + fragmentedOperation: false + }; + this.overflow = []; + this.headerBuffer = new Buffer(10); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + this.currentMessage = []; + this.messageHandlers = []; + this.expectHeader(2, this.processPacket); + this.dead = false; + this.processing = false; + + this.onerror = function() {}; + this.ontext = function() {}; + this.onbinary = function() {}; + this.onclose = function() {}; + this.onping = function() {}; + this.onpong = function() {}; +} + +module.exports = Receiver; + +/** + * Add new data to the parser. + * + * @api public + */ + +Receiver.prototype.add = function(data) { + var dataLength = data.length; + if (dataLength == 0) return; + if (this.expectBuffer == null) { + this.overflow.push(data); + return; + } + var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset); + fastCopy(toRead, data, this.expectBuffer, this.expectOffset); + this.expectOffset += toRead; + if (toRead < dataLength) { + this.overflow.push(data.slice(toRead)); + } + while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) { + var bufferForHandler = this.expectBuffer; + this.expectBuffer = null; + this.expectOffset = 0; + this.expectHandler.call(this, bufferForHandler); + } +}; + +/** + * Releases all resources used by the receiver. + * + * @api public + */ + +Receiver.prototype.cleanup = function() { + this.dead = true; + this.overflow = null; + this.headerBuffer = null; + this.expectBuffer = null; + this.expectHandler = null; + this.unfragmentedBufferPool = null; + this.fragmentedBufferPool = null; + this.state = null; + this.currentMessage = null; + this.onerror = null; + this.ontext = null; + this.onbinary = null; + this.onclose = null; + this.onping = null; + this.onpong = null; +}; + +/** + * Waits for a certain amount of header bytes to be available, then fires a callback. + * + * @api private + */ + +Receiver.prototype.expectHeader = function(length, handler) { + if (length == 0) { + handler(null); + return; + } + this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length); + this.expectHandler = handler; + var toRead = length; + while (toRead > 0 && this.overflow.length > 0) { + var fromOverflow = this.overflow.pop(); + if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); + var read = Math.min(fromOverflow.length, toRead); + fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); + this.expectOffset += read; + toRead -= read; + } +}; + +/** + * Waits for a certain amount of data bytes to be available, then fires a callback. + * + * @api private + */ + +Receiver.prototype.expectData = function(length, handler) { + if (length == 0) { + handler(null); + return; + } + this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation); + this.expectHandler = handler; + var toRead = length; + while (toRead > 0 && this.overflow.length > 0) { + var fromOverflow = this.overflow.pop(); + if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); + var read = Math.min(fromOverflow.length, toRead); + fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); + this.expectOffset += read; + toRead -= read; + } +}; + +/** + * Allocates memory from the buffer pool. + * + * @api private + */ + +Receiver.prototype.allocateFromPool = function(length, isFragmented) { + return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); +}; + +/** + * Start processing a new packet. + * + * @api private + */ + +Receiver.prototype.processPacket = function (data) { + if (this.extensions[PerMessageDeflate.extensionName]) { + if ((data[0] & 0x30) != 0) { + this.error('reserved fields (2, 3) must be empty', 1002); + return; + } + } else { + if ((data[0] & 0x70) != 0) { + this.error('reserved fields must be empty', 1002); + return; + } + } + this.state.lastFragment = (data[0] & 0x80) == 0x80; + this.state.masked = (data[1] & 0x80) == 0x80; + var compressed = (data[0] & 0x40) == 0x40; + var opcode = data[0] & 0xf; + if (opcode === 0) { + if (compressed) { + this.error('continuation frame cannot have the Per-message Compressed bits', 1002); + return; + } + // continuation frame + this.state.fragmentedOperation = true; + this.state.opcode = this.state.activeFragmentedOperation; + if (!(this.state.opcode == 1 || this.state.opcode == 2)) { + this.error('continuation frame cannot follow current opcode', 1002); + return; + } + } + else { + if (opcode < 3 && this.state.activeFragmentedOperation != null) { + this.error('data frames after the initial data frame must have opcode 0', 1002); + return; + } + if (opcode >= 8 && compressed) { + this.error('control frames cannot have the Per-message Compressed bits', 1002); + return; + } + this.state.compressed = compressed; + this.state.opcode = opcode; + if (this.state.lastFragment === false) { + this.state.fragmentedOperation = true; + this.state.activeFragmentedOperation = opcode; + } + else this.state.fragmentedOperation = false; + } + var handler = opcodes[this.state.opcode]; + if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002); + else { + handler.start.call(this, data); + } +}; + +/** + * Endprocessing a packet. + * + * @api private + */ + +Receiver.prototype.endPacket = function() { + if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true); + else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) { + // end current fragmented operation + this.state.activeFragmentedOperation = null; + } + this.state.lastFragment = false; + this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; + this.state.masked = false; + this.expectHeader(2, this.processPacket); +}; + +/** + * Reset the parser state. + * + * @api private + */ + +Receiver.prototype.reset = function() { + if (this.dead) return; + this.state = { + activeFragmentedOperation: null, + lastFragment: false, + masked: false, + opcode: 0, + fragmentedOperation: false + }; + this.fragmentedBufferPool.reset(true); + this.unfragmentedBufferPool.reset(true); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + this.overflow = []; + this.currentMessage = []; + this.messageHandlers = []; +}; + +/** + * Unmask received data. + * + * @api private + */ + +Receiver.prototype.unmask = function (mask, buf, binary) { + if (mask != null && buf != null) bufferUtil.unmask(buf, mask); + if (binary) return buf; + return buf != null ? buf.toString('utf8') : ''; +}; + +/** + * Concatenates a list of buffers. + * + * @api private + */ + +Receiver.prototype.concatBuffers = function(buffers) { + var length = 0; + for (var i = 0, l = buffers.length; i < l; ++i) length += buffers[i].length; + var mergedBuffer = new Buffer(length); + bufferUtil.merge(mergedBuffer, buffers); + return mergedBuffer; +}; + +/** + * Handles an error + * + * @api private + */ + +Receiver.prototype.error = function (reason, protocolErrorCode) { + this.reset(); + this.onerror(reason, protocolErrorCode); + return this; +}; + +/** + * Execute message handler buffers + * + * @api private + */ + +Receiver.prototype.flush = function() { + if (this.processing || this.dead) return; + + var handler = this.messageHandlers.shift(); + if (!handler) return; + + this.processing = true; + var self = this; + + handler(function() { + self.processing = false; + self.flush(); + }); +}; + +/** + * Apply extensions to message + * + * @api private + */ + +Receiver.prototype.applyExtensions = function(messageBuffer, fin, compressed, callback) { + var self = this; + if (compressed) { + this.extensions[PerMessageDeflate.extensionName].decompress(messageBuffer, fin, function(err, buffer) { + if (self.dead) return; + if (err) { + callback(new Error('invalid compressed data')); + return; + } + callback(null, buffer); + }); + } else { + callback(null, messageBuffer); + } +}; + +/** + * Buffer utilities + */ + +function readUInt16BE(start) { + return (this[start]<<8) + + this[start+1]; +} + +function readUInt32BE(start) { + return (this[start]<<24) + + (this[start+1]<<16) + + (this[start+2]<<8) + + this[start+3]; +} + +function fastCopy(length, srcBuffer, dstBuffer, dstOffset) { + switch (length) { + default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break; + case 16: dstBuffer[dstOffset+15] = srcBuffer[15]; + case 15: dstBuffer[dstOffset+14] = srcBuffer[14]; + case 14: dstBuffer[dstOffset+13] = srcBuffer[13]; + case 13: dstBuffer[dstOffset+12] = srcBuffer[12]; + case 12: dstBuffer[dstOffset+11] = srcBuffer[11]; + case 11: dstBuffer[dstOffset+10] = srcBuffer[10]; + case 10: dstBuffer[dstOffset+9] = srcBuffer[9]; + case 9: dstBuffer[dstOffset+8] = srcBuffer[8]; + case 8: dstBuffer[dstOffset+7] = srcBuffer[7]; + case 7: dstBuffer[dstOffset+6] = srcBuffer[6]; + case 6: dstBuffer[dstOffset+5] = srcBuffer[5]; + case 5: dstBuffer[dstOffset+4] = srcBuffer[4]; + case 4: dstBuffer[dstOffset+3] = srcBuffer[3]; + case 3: dstBuffer[dstOffset+2] = srcBuffer[2]; + case 2: dstBuffer[dstOffset+1] = srcBuffer[1]; + case 1: dstBuffer[dstOffset] = srcBuffer[0]; + } +} + +function clone(obj) { + var cloned = {}; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + cloned[k] = obj[k]; + } + } + return cloned; +} + +/** + * Opcode handlers + */ + +var opcodes = { + // text + '1': { + start: function(data) { + var self = this; + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['1'].getData.call(self, firstLength); + } + else if (firstLength == 126) { + self.expectHeader(2, function(data) { + opcodes['1'].getData.call(self, readUInt16BE.call(data, 0)); + }); + } + else if (firstLength == 127) { + self.expectHeader(8, function(data) { + if (readUInt32BE.call(data, 0) != 0) { + self.error('packets with length spanning more than 32 bit is currently not supported', 1008); + return; + } + opcodes['1'].getData.call(self, readUInt32BE.call(data, 4)); + }); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['1'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['1'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + var packet = this.unmask(mask, data, true) || new Buffer(0); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { + if (err) return self.error(err.message, 1007); + if (buffer != null) self.currentMessage.push(buffer); + + if (state.lastFragment) { + var messageBuffer = self.concatBuffers(self.currentMessage); + self.currentMessage = []; + if (!Validation.isValidUTF8(messageBuffer)) { + self.error('invalid utf8 sequence', 1007); + return; + } + self.ontext(messageBuffer.toString('utf8'), {masked: state.masked, buffer: messageBuffer}); + } + callback(); + }); + }); + this.flush(); + this.endPacket(); + } + }, + // binary + '2': { + start: function(data) { + var self = this; + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['2'].getData.call(self, firstLength); + } + else if (firstLength == 126) { + self.expectHeader(2, function(data) { + opcodes['2'].getData.call(self, readUInt16BE.call(data, 0)); + }); + } + else if (firstLength == 127) { + self.expectHeader(8, function(data) { + if (readUInt32BE.call(data, 0) != 0) { + self.error('packets with length spanning more than 32 bit is currently not supported', 1008); + return; + } + opcodes['2'].getData.call(self, readUInt32BE.call(data, 4, true)); + }); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['2'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['2'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + var packet = this.unmask(mask, data, true) || new Buffer(0); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { + if (err) return self.error(err.message, 1007); + if (buffer != null) self.currentMessage.push(buffer); + if (state.lastFragment) { + var messageBuffer = self.concatBuffers(self.currentMessage); + self.currentMessage = []; + self.onbinary(messageBuffer, {masked: state.masked, buffer: messageBuffer}); + } + callback(); + }); + }); + this.flush(); + this.endPacket(); + } + }, + // close + '8': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented close is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['8'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['8'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['8'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = self.unmask(mask, data, true); + + var state = clone(this.state); + this.messageHandlers.push(function() { + if (data && data.length == 1) { + self.error('close packets with data must be at least two bytes long', 1002); + return; + } + var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000; + if (!ErrorCodes.isValidErrorCode(code)) { + self.error('invalid error code', 1002); + return; + } + var message = ''; + if (data && data.length > 2) { + var messageBuffer = data.slice(2); + if (!Validation.isValidUTF8(messageBuffer)) { + self.error('invalid utf8 sequence', 1007); + return; + } + message = messageBuffer.toString('utf8'); + } + self.onclose(code, message, {masked: state.masked}); + self.reset(); + }); + this.flush(); + }, + }, + // ping + '9': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented ping is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['9'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['9'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['9'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = this.unmask(mask, data, true); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.onping(data, {masked: state.masked, binary: true}); + callback(); + }); + this.flush(); + this.endPacket(); + } + }, + // pong + '10': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented pong is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['10'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (this.state.masked) { + this.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['10'].finish.call(self, mask, data); + }); + }); + } + else { + this.expectData(length, function(data) { + opcodes['10'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = self.unmask(mask, data, true); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.onpong(data, {masked: state.masked, binary: true}); + callback(); + }); + this.flush(); + this.endPacket(); + } + } +} diff --git a/node_modules/simple-websocket/node_modules/ws/lib/Sender.hixie.js b/node_modules/simple-websocket/node_modules/ws/lib/Sender.hixie.js new file mode 100644 index 00000000..fd2fd250 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/Sender.hixie.js @@ -0,0 +1,120 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var events = require('events') + , util = require('util') + , EventEmitter = events.EventEmitter; + +/** + * Hixie Sender implementation + */ + +function Sender(socket) { + events.EventEmitter.call(this); + + this.socket = socket; + this.continuationFrame = false; + this.isClosed = false; +} + +module.exports = Sender; + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Sender, events.EventEmitter); + +/** + * Frames and writes data. + * + * @api public + */ + +Sender.prototype.send = function(data, options, cb) { + if (this.isClosed) return; + + var isString = typeof data == 'string' + , length = isString ? Buffer.byteLength(data) : data.length + , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes + , writeStartMarker = this.continuationFrame == false + , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin) + , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0)) + , offset = writeStartMarker ? 1 : 0; + + if (writeStartMarker) { + if (options && options.binary) { + buffer.write('\x80', 'binary'); + // assume length less than 2**14 bytes + if (lengthbytes > 1) + buffer.write(String.fromCharCode(128+length/128), offset++, 'binary'); + buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary'); + } else + buffer.write('\x00', 'binary'); + } + + if (isString) buffer.write(data, offset, 'utf8'); + else data.copy(buffer, offset, 0); + + if (writeEndMarker) { + if (options && options.binary) { + // sending binary, not writing end marker + } else + buffer.write('\xff', offset + length, 'binary'); + this.continuationFrame = false; + } + else this.continuationFrame = true; + + try { + this.socket.write(buffer, 'binary', cb); + } catch (e) { + this.error(e.toString()); + } +}; + +/** + * Sends a close instruction to the remote party. + * + * @api public + */ + +Sender.prototype.close = function(code, data, mask, cb) { + if (this.isClosed) return; + this.isClosed = true; + try { + if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary')); + this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb); + } catch (e) { + this.error(e.toString()); + } +}; + +/** + * Sends a ping message to the remote party. Not available for hixie. + * + * @api public + */ + +Sender.prototype.ping = function(data, options) {}; + +/** + * Sends a pong message to the remote party. Not available for hixie. + * + * @api public + */ + +Sender.prototype.pong = function(data, options) {}; + +/** + * Handles an error + * + * @api private + */ + +Sender.prototype.error = function (reason) { + this.emit('error', reason); + return this; +}; diff --git a/node_modules/simple-websocket/node_modules/ws/lib/Sender.js b/node_modules/simple-websocket/node_modules/ws/lib/Sender.js new file mode 100644 index 00000000..f3467480 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/Sender.js @@ -0,0 +1,309 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var events = require('events') + , util = require('util') + , EventEmitter = events.EventEmitter + , ErrorCodes = require('./ErrorCodes') + , bufferUtil = require('./BufferUtil').BufferUtil + , PerMessageDeflate = require('./PerMessageDeflate'); + +/** + * HyBi Sender implementation + */ + +function Sender(socket, extensions) { + events.EventEmitter.call(this); + + this._socket = socket; + this.extensions = extensions || {}; + this.firstFragment = true; + this.compress = false; + this.messageHandlers = []; + this.processing = false; +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Sender, events.EventEmitter); + +/** + * Sends a close instruction to the remote party. + * + * @api public + */ + +Sender.prototype.close = function(code, data, mask, cb) { + if (typeof code !== 'undefined') { + if (typeof code !== 'number' || + !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number'); + } + code = code || 1000; + var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0)); + writeUInt16BE.call(dataBuffer, code, 0); + if (dataBuffer.length > 2) dataBuffer.write(data, 2); + + var self = this; + this.messageHandlers.push(function(callback) { + self.frameAndSend(0x8, dataBuffer, true, mask); + callback(); + if (typeof cb == 'function') cb(); + }); + this.flush(); +}; + +/** + * Sends a ping message to the remote party. + * + * @api public + */ + +Sender.prototype.ping = function(data, options) { + var mask = options && options.mask; + var self = this; + this.messageHandlers.push(function(callback) { + self.frameAndSend(0x9, data || '', true, mask); + callback(); + }); + this.flush(); +}; + +/** + * Sends a pong message to the remote party. + * + * @api public + */ + +Sender.prototype.pong = function(data, options) { + var mask = options && options.mask; + var self = this; + this.messageHandlers.push(function(callback) { + self.frameAndSend(0xa, data || '', true, mask); + callback(); + }); + this.flush(); +}; + +/** + * Sends text or binary data to the remote party. + * + * @api public + */ + +Sender.prototype.send = function(data, options, cb) { + var finalFragment = options && options.fin === false ? false : true; + var mask = options && options.mask; + var compress = options && options.compress; + var opcode = options && options.binary ? 2 : 1; + if (this.firstFragment === false) { + opcode = 0; + compress = false; + } else { + this.firstFragment = false; + this.compress = compress; + } + if (finalFragment) this.firstFragment = true + + var compressFragment = this.compress; + + var self = this; + this.messageHandlers.push(function(callback) { + self.applyExtensions(data, finalFragment, compressFragment, function(err, data) { + if (err) { + if (typeof cb == 'function') cb(err); + else self.emit('error', err); + return; + } + self.frameAndSend(opcode, data, finalFragment, mask, compress, cb); + callback(); + }); + }); + this.flush(); +}; + +/** + * Frames and sends a piece of data according to the HyBi WebSocket protocol. + * + * @api private + */ + +Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, compressed, cb) { + var canModifyData = false; + + if (!data) { + try { + this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + return; + } + + if (!Buffer.isBuffer(data)) { + canModifyData = true; + if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) { + data = getArrayBuffer(data); + } else { + data = new Buffer(data); + } + } + + var dataLength = data.length + , dataOffset = maskData ? 6 : 2 + , secondByte = dataLength; + + if (dataLength >= 65536) { + dataOffset += 8; + secondByte = 127; + } + else if (dataLength > 125) { + dataOffset += 2; + secondByte = 126; + } + + var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData); + var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset; + var outputBuffer = new Buffer(totalLength); + outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode; + if (compressed) outputBuffer[0] |= 0x40; + + switch (secondByte) { + case 126: + writeUInt16BE.call(outputBuffer, dataLength, 2); + break; + case 127: + writeUInt32BE.call(outputBuffer, 0, 2); + writeUInt32BE.call(outputBuffer, dataLength, 6); + } + + if (maskData) { + outputBuffer[1] = secondByte | 0x80; + var mask = this._randomMask || (this._randomMask = getRandomMask()); + outputBuffer[dataOffset - 4] = mask[0]; + outputBuffer[dataOffset - 3] = mask[1]; + outputBuffer[dataOffset - 2] = mask[2]; + outputBuffer[dataOffset - 1] = mask[3]; + if (mergeBuffers) { + bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength); + try { + this._socket.write(outputBuffer, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + else { + bufferUtil.mask(data, mask, data, 0, dataLength); + try { + this._socket.write(outputBuffer, 'binary'); + this._socket.write(data, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + } + else { + outputBuffer[1] = secondByte; + if (mergeBuffers) { + data.copy(outputBuffer, dataOffset); + try { + this._socket.write(outputBuffer, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + else { + try { + this._socket.write(outputBuffer, 'binary'); + this._socket.write(data, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + } +}; + +/** + * Execute message handler buffers + * + * @api private + */ + +Sender.prototype.flush = function() { + if (this.processing) return; + + var handler = this.messageHandlers.shift(); + if (!handler) return; + + this.processing = true; + + var self = this; + + handler(function() { + self.processing = false; + self.flush(); + }); +}; + +/** + * Apply extensions to message + * + * @api private + */ + +Sender.prototype.applyExtensions = function(data, fin, compress, callback) { + if (compress && data) { + this.extensions[PerMessageDeflate.extensionName].compress(data, fin, callback); + } else { + callback(null, data); + } +}; + +module.exports = Sender; + +function writeUInt16BE(value, offset) { + this[offset] = (value & 0xff00)>>8; + this[offset+1] = value & 0xff; +} + +function writeUInt32BE(value, offset) { + this[offset] = (value & 0xff000000)>>24; + this[offset+1] = (value & 0xff0000)>>16; + this[offset+2] = (value & 0xff00)>>8; + this[offset+3] = value & 0xff; +} + +function getArrayBuffer(data) { + // data is either an ArrayBuffer or ArrayBufferView. + var array = new Uint8Array(data.buffer || data) + , l = data.byteLength || data.length + , o = data.byteOffset || 0 + , buffer = new Buffer(l); + for (var i = 0; i < l; ++i) { + buffer[i] = array[o+i]; + } + return buffer; +} + +function getRandomMask() { + return new Buffer([ + ~~(Math.random() * 255), + ~~(Math.random() * 255), + ~~(Math.random() * 255), + ~~(Math.random() * 255) + ]); +} diff --git a/node_modules/simple-websocket/node_modules/ws/lib/Validation.fallback.js b/node_modules/simple-websocket/node_modules/ws/lib/Validation.fallback.js new file mode 100644 index 00000000..2c7c4fd4 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/Validation.fallback.js @@ -0,0 +1,12 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.Validation = { + isValidUTF8: function(buffer) { + return true; + } +}; + diff --git a/node_modules/simple-websocket/node_modules/ws/lib/Validation.js b/node_modules/simple-websocket/node_modules/ws/lib/Validation.js new file mode 100644 index 00000000..0795fb7f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/Validation.js @@ -0,0 +1,13 @@ +'use strict'; + +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +try { + module.exports = require('utf-8-validate'); +} catch (e) { + module.exports = require('./Validation.fallback'); +} diff --git a/node_modules/simple-websocket/node_modules/ws/lib/WebSocket.js b/node_modules/simple-websocket/node_modules/ws/lib/WebSocket.js new file mode 100644 index 00000000..bc3f84ad --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/WebSocket.js @@ -0,0 +1,937 @@ +'use strict'; + +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var url = require('url') + , util = require('util') + , http = require('http') + , https = require('https') + , crypto = require('crypto') + , stream = require('stream') + , Ultron = require('ultron') + , Options = require('options') + , Sender = require('./Sender') + , Receiver = require('./Receiver') + , SenderHixie = require('./Sender.hixie') + , ReceiverHixie = require('./Receiver.hixie') + , Extensions = require('./Extensions') + , PerMessageDeflate = require('./PerMessageDeflate') + , EventEmitter = require('events').EventEmitter; + +/** + * Constants + */ + +// Default protocol version + +var protocolVersion = 13; + +// Close timeout + +var closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly + +/** + * WebSocket implementation + * + * @constructor + * @param {String} address Connection address. + * @param {String|Array} protocols WebSocket protocols. + * @param {Object} options Additional connection options. + * @api public + */ +function WebSocket(address, protocols, options) { + EventEmitter.call(this); + + if (protocols && !Array.isArray(protocols) && 'object' === typeof protocols) { + // accept the "options" Object as the 2nd argument + options = protocols; + protocols = null; + } + + if ('string' === typeof protocols) { + protocols = [ protocols ]; + } + + if (!Array.isArray(protocols)) { + protocols = []; + } + + this._socket = null; + this._ultron = null; + this._closeReceived = false; + this.bytesReceived = 0; + this.readyState = null; + this.supports = {}; + this.extensions = {}; + + if (Array.isArray(address)) { + initAsServerClient.apply(this, address.concat(options)); + } else { + initAsClient.apply(this, [address, protocols, options]); + } +} + +/** + * Inherits from EventEmitter. + */ +util.inherits(WebSocket, EventEmitter); + +/** + * Ready States + */ +["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function each(state, index) { + WebSocket.prototype[state] = WebSocket[state] = index; +}); + +/** + * Gracefully closes the connection, after sending a description message to the server + * + * @param {Object} data to be sent to the server + * @api public + */ +WebSocket.prototype.close = function close(code, data) { + if (this.readyState === WebSocket.CLOSED) return; + + if (this.readyState === WebSocket.CONNECTING) { + this.readyState = WebSocket.CLOSED; + return; + } + + if (this.readyState === WebSocket.CLOSING) { + if (this._closeReceived && this._isServer) { + this.terminate(); + } + return; + } + + var self = this; + try { + this.readyState = WebSocket.CLOSING; + this._closeCode = code; + this._closeMessage = data; + var mask = !this._isServer; + this._sender.close(code, data, mask, function(err) { + if (err) self.emit('error', err); + + if (self._closeReceived && self._isServer) { + self.terminate(); + } else { + // ensure that the connection is cleaned up even when no response of closing handshake. + clearTimeout(self._closeTimer); + self._closeTimer = setTimeout(cleanupWebsocketResources.bind(self, true), closeTimeout); + } + }); + } catch (e) { + this.emit('error', e); + } +}; + +/** + * Pause the client stream + * + * @api public + */ +WebSocket.prototype.pause = function pauser() { + if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); + + return this._socket.pause(); +}; + +/** + * Sends a ping + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean + * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open + * @api public + */ +WebSocket.prototype.ping = function ping(data, options, dontFailWhenClosed) { + if (this.readyState !== WebSocket.OPEN) { + if (dontFailWhenClosed === true) return; + throw new Error('not opened'); + } + + options = options || {}; + + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + + this._sender.ping(data, options); +}; + +/** + * Sends a pong + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean + * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open + * @api public + */ +WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) { + if (this.readyState !== WebSocket.OPEN) { + if (dontFailWhenClosed === true) return; + throw new Error('not opened'); + } + + options = options || {}; + + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + + this._sender.pong(data, options); +}; + +/** + * Resume the client stream + * + * @api public + */ +WebSocket.prototype.resume = function resume() { + if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); + + return this._socket.resume(); +}; + +/** + * Sends a piece of data + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean + * @param {function} Optional callback which is executed after the send completes + * @api public + */ + +WebSocket.prototype.send = function send(data, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + if (this.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else throw new Error('not opened'); + return; + } + + if (!data) data = ''; + if (this._queue) { + var self = this; + this._queue.push(function() { self.send(data, options, cb); }); + return; + } + + options = options || {}; + options.fin = true; + + if (typeof options.binary === 'undefined') { + options.binary = (data instanceof ArrayBuffer || data instanceof Buffer || + data instanceof Uint8Array || + data instanceof Uint16Array || + data instanceof Uint32Array || + data instanceof Int8Array || + data instanceof Int16Array || + data instanceof Int32Array || + data instanceof Float32Array || + data instanceof Float64Array); + } + + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + if (typeof options.compress === 'undefined') options.compress = true; + if (!this.extensions[PerMessageDeflate.extensionName]) { + options.compress = false; + } + + var readable = typeof stream.Readable === 'function' + ? stream.Readable + : stream.Stream; + + if (data instanceof readable) { + startQueue(this); + var self = this; + + sendStream(this, data, options, function send(error) { + process.nextTick(function tock() { + executeQueueSends(self); + }); + + if (typeof cb === 'function') cb(error); + }); + } else { + this._sender.send(data, options, cb); + } +}; + +/** + * Streams data through calls to a user supplied function + * + * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean + * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'. + * @api public + */ +WebSocket.prototype.stream = function stream(options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + var self = this; + + if (typeof cb !== 'function') throw new Error('callback must be provided'); + + if (this.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else throw new Error('not opened'); + return; + } + + if (this._queue) { + this._queue.push(function () { self.stream(options, cb); }); + return; + } + + options = options || {}; + + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + if (typeof options.compress === 'undefined') options.compress = true; + if (!this.extensions[PerMessageDeflate.extensionName]) { + options.compress = false; + } + + startQueue(this); + + function send(data, final) { + try { + if (self.readyState !== WebSocket.OPEN) throw new Error('not opened'); + options.fin = final === true; + self._sender.send(data, options); + if (!final) process.nextTick(cb.bind(null, null, send)); + else executeQueueSends(self); + } catch (e) { + if (typeof cb === 'function') cb(e); + else { + delete self._queue; + self.emit('error', e); + } + } + } + + process.nextTick(cb.bind(null, null, send)); +}; + +/** + * Immediately shuts down the connection + * + * @api public + */ +WebSocket.prototype.terminate = function terminate() { + if (this.readyState === WebSocket.CLOSED) return; + + if (this._socket) { + this.readyState = WebSocket.CLOSING; + + // End the connection + try { this._socket.end(); } + catch (e) { + // Socket error during end() call, so just destroy it right now + cleanupWebsocketResources.call(this, true); + return; + } + + // Add a timeout to ensure that the connection is completely + // cleaned up within 30 seconds, even if the clean close procedure + // fails for whatever reason + // First cleanup any pre-existing timeout from an earlier "terminate" call, + // if one exists. Otherwise terminate calls in quick succession will leak timeouts + // and hold the program open for `closeTimout` time. + if (this._closeTimer) { clearTimeout(this._closeTimer); } + this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout); + } else if (this.readyState === WebSocket.CONNECTING) { + cleanupWebsocketResources.call(this, true); + } +}; + +/** + * Expose bufferedAmount + * + * @api public + */ +Object.defineProperty(WebSocket.prototype, 'bufferedAmount', { + get: function get() { + var amount = 0; + if (this._socket) { + amount = this._socket.bufferSize || 0; + } + return amount; + } +}); + +/** + * Emulates the W3C Browser based WebSocket interface using function members. + * + * @see http://dev.w3.org/html5/websockets/#the-websocket-interface + * @api public + */ +['open', 'error', 'close', 'message'].forEach(function(method) { + Object.defineProperty(WebSocket.prototype, 'on' + method, { + /** + * Returns the current listener + * + * @returns {Mixed} the set function or undefined + * @api public + */ + get: function get() { + var listener = this.listeners(method)[0]; + return listener ? (listener._listener ? listener._listener : listener) : undefined; + }, + + /** + * Start listening for events + * + * @param {Function} listener the listener + * @returns {Mixed} the set function or undefined + * @api public + */ + set: function set(listener) { + this.removeAllListeners(method); + this.addEventListener(method, listener); + } + }); +}); + +/** + * Emulates the W3C Browser based WebSocket interface using addEventListener. + * + * @see https://developer.mozilla.org/en/DOM/element.addEventListener + * @see http://dev.w3.org/html5/websockets/#the-websocket-interface + * @api public + */ +WebSocket.prototype.addEventListener = function(method, listener) { + var target = this; + + function onMessage (data, flags) { + listener.call(target, new MessageEvent(data, flags.binary ? 'Binary' : 'Text', target)); + } + + function onClose (code, message) { + listener.call(target, new CloseEvent(code, message, target)); + } + + function onError (event) { + event.target = target; + listener.call(target, event); + } + + function onOpen () { + listener.call(target, new OpenEvent(target)); + } + + if (typeof listener === 'function') { + if (method === 'message') { + // store a reference so we can return the original function from the + // addEventListener hook + onMessage._listener = listener; + this.on(method, onMessage); + } else if (method === 'close') { + // store a reference so we can return the original function from the + // addEventListener hook + onClose._listener = listener; + this.on(method, onClose); + } else if (method === 'error') { + // store a reference so we can return the original function from the + // addEventListener hook + onError._listener = listener; + this.on(method, onError); + } else if (method === 'open') { + // store a reference so we can return the original function from the + // addEventListener hook + onOpen._listener = listener; + this.on(method, onOpen); + } else { + this.on(method, listener); + } + } +}; + +module.exports = WebSocket; + +/** + * W3C MessageEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @constructor + * @api private + */ +function MessageEvent(dataArg, typeArg, target) { + this.data = dataArg; + this.type = typeArg; + this.target = target; +} + +/** + * W3C CloseEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @constructor + * @api private + */ +function CloseEvent(code, reason, target) { + this.wasClean = (typeof code === 'undefined' || code === 1000); + this.code = code; + this.reason = reason; + this.target = target; +} + +/** + * W3C OpenEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @constructor + * @api private + */ +function OpenEvent(target) { + this.target = target; +} + +/** + * Entirely private apis, + * which may or may not be bound to a sepcific WebSocket instance. + */ +function initAsServerClient(req, socket, upgradeHead, options) { + options = new Options({ + protocolVersion: protocolVersion, + protocol: null, + extensions: {} + }).merge(options); + + // expose state properties + this.protocol = options.value.protocol; + this.protocolVersion = options.value.protocolVersion; + this.extensions = options.value.extensions; + this.supports.binary = (this.protocolVersion !== 'hixie-76'); + this.upgradeReq = req; + this.readyState = WebSocket.CONNECTING; + this._isServer = true; + + // establish connection + if (options.value.protocolVersion === 'hixie-76') { + establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead); + } else { + establishConnection.call(this, Receiver, Sender, socket, upgradeHead); + } +} + +function initAsClient(address, protocols, options) { + options = new Options({ + origin: null, + protocolVersion: protocolVersion, + host: null, + headers: null, + protocol: protocols.join(','), + agent: null, + + // ssl-related options + pfx: null, + key: null, + passphrase: null, + cert: null, + ca: null, + ciphers: null, + rejectUnauthorized: null, + perMessageDeflate: true + }).merge(options); + + if (options.value.protocolVersion !== 8 && options.value.protocolVersion !== 13) { + throw new Error('unsupported protocol version'); + } + + // verify URL and establish http class + var serverUrl = url.parse(address); + var isUnixSocket = serverUrl.protocol === 'ws+unix:'; + if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url'); + var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:'; + var httpObj = isSecure ? https : http; + var port = serverUrl.port || (isSecure ? 443 : 80); + var auth = serverUrl.auth; + + // prepare extensions + var extensionsOffer = {}; + var perMessageDeflate; + if (options.value.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate(typeof options.value.perMessageDeflate !== true ? options.value.perMessageDeflate : {}, false); + extensionsOffer[PerMessageDeflate.extensionName] = perMessageDeflate.offer(); + } + + // expose state properties + this._isServer = false; + this.url = address; + this.protocolVersion = options.value.protocolVersion; + this.supports.binary = (this.protocolVersion !== 'hixie-76'); + + // begin handshake + var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64'); + var shasum = crypto.createHash('sha1'); + shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'); + var expectedServerKey = shasum.digest('base64'); + + var agent = options.value.agent; + + var headerHost = serverUrl.hostname; + // Append port number to Host and Origin header, only if specified in the url + // and non-default + if (serverUrl.port) { + if ((isSecure && (port !== 443)) || (!isSecure && (port !== 80))){ + headerHost = headerHost + ':' + port; + } + } + + var requestOptions = { + port: port, + host: serverUrl.hostname, + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Host': headerHost, + 'Origin': headerHost, + 'Sec-WebSocket-Version': options.value.protocolVersion, + 'Sec-WebSocket-Key': key + } + }; + + // If we have basic auth. + if (auth) { + requestOptions.headers.Authorization = 'Basic ' + new Buffer(auth).toString('base64'); + } + + if (options.value.protocol) { + requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol; + } + + if (options.value.host) { + requestOptions.headers.Host = options.value.host; + } + + if (options.value.headers) { + for (var header in options.value.headers) { + if (options.value.headers.hasOwnProperty(header)) { + requestOptions.headers[header] = options.value.headers[header]; + } + } + } + + if (Object.keys(extensionsOffer).length) { + requestOptions.headers['Sec-WebSocket-Extensions'] = Extensions.format(extensionsOffer); + } + + if (options.isDefinedAndNonNull('pfx') + || options.isDefinedAndNonNull('key') + || options.isDefinedAndNonNull('passphrase') + || options.isDefinedAndNonNull('cert') + || options.isDefinedAndNonNull('ca') + || options.isDefinedAndNonNull('ciphers') + || options.isDefinedAndNonNull('rejectUnauthorized')) { + + if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx; + if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key; + if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase; + if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert; + if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca; + if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers; + if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized; + + if (!agent) { + // global agent ignores client side certificates + agent = new httpObj.Agent(requestOptions); + } + } + + requestOptions.path = serverUrl.path || '/'; + + if (agent) { + requestOptions.agent = agent; + } + + if (isUnixSocket) { + requestOptions.socketPath = serverUrl.pathname; + } + if (options.value.origin) { + if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin; + else requestOptions.headers.Origin = options.value.origin; + } + + var self = this; + var req = httpObj.request(requestOptions); + + req.on('error', function onerror(error) { + self.emit('error', error); + cleanupWebsocketResources.call(this, error); + }); + + req.once('response', function response(res) { + var error; + + if (!self.emit('unexpected-response', req, res)) { + error = new Error('unexpected server response (' + res.statusCode + ')'); + req.abort(); + self.emit('error', error); + } + + cleanupWebsocketResources.call(this, error); + }); + + req.once('upgrade', function upgrade(res, socket, upgradeHead) { + if (self.readyState === WebSocket.CLOSED) { + // client closed before server accepted connection + self.emit('close'); + self.removeAllListeners(); + socket.end(); + return; + } + + var serverKey = res.headers['sec-websocket-accept']; + if (typeof serverKey === 'undefined' || serverKey !== expectedServerKey) { + self.emit('error', 'invalid server key'); + self.removeAllListeners(); + socket.end(); + return; + } + + var serverProt = res.headers['sec-websocket-protocol']; + var protList = (options.value.protocol || "").split(/, */); + var protError = null; + + if (!options.value.protocol && serverProt) { + protError = 'server sent a subprotocol even though none requested'; + } else if (options.value.protocol && !serverProt) { + protError = 'server sent no subprotocol even though requested'; + } else if (serverProt && protList.indexOf(serverProt) === -1) { + protError = 'server responded with an invalid protocol'; + } + + if (protError) { + self.emit('error', protError); + self.removeAllListeners(); + socket.end(); + return; + } else if (serverProt) { + self.protocol = serverProt; + } + + var serverExtensions = Extensions.parse(res.headers['sec-websocket-extensions']); + if (perMessageDeflate && serverExtensions[PerMessageDeflate.extensionName]) { + try { + perMessageDeflate.accept(serverExtensions[PerMessageDeflate.extensionName]); + } catch (err) { + self.emit('error', 'invalid extension parameter'); + self.removeAllListeners(); + socket.end(); + return; + } + self.extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + + establishConnection.call(self, Receiver, Sender, socket, upgradeHead); + + // perform cleanup on http resources + req.removeAllListeners(); + req = null; + agent = null; + }); + + req.end(); + this.readyState = WebSocket.CONNECTING; +} + +function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) { + var ultron = this._ultron = new Ultron(socket); + this._socket = socket; + + socket.setTimeout(0); + socket.setNoDelay(true); + var self = this; + this._receiver = new ReceiverClass(this.extensions); + + // socket cleanup handlers + ultron.on('end', cleanupWebsocketResources.bind(this)); + ultron.on('close', cleanupWebsocketResources.bind(this)); + ultron.on('error', cleanupWebsocketResources.bind(this)); + + // ensure that the upgradeHead is added to the receiver + function firstHandler(data) { + if (self.readyState !== WebSocket.OPEN && self.readyState !== WebSocket.CLOSING) return; + + if (upgradeHead && upgradeHead.length > 0) { + self.bytesReceived += upgradeHead.length; + var head = upgradeHead; + upgradeHead = null; + self._receiver.add(head); + } + + dataHandler = realHandler; + + if (data) { + self.bytesReceived += data.length; + self._receiver.add(data); + } + } + + // subsequent packets are pushed straight to the receiver + function realHandler(data) { + if (data) self.bytesReceived += data.length; + self._receiver.add(data); + } + + var dataHandler = firstHandler; + + // if data was passed along with the http upgrade, + // this will schedule a push of that on to the receiver. + // this has to be done on next tick, since the caller + // hasn't had a chance to set event handlers on this client + // object yet. + process.nextTick(firstHandler); + + // receiver event handlers + self._receiver.ontext = function ontext(data, flags) { + flags = flags || {}; + + self.emit('message', data, flags); + }; + + self._receiver.onbinary = function onbinary(data, flags) { + flags = flags || {}; + + flags.binary = true; + self.emit('message', data, flags); + }; + + self._receiver.onping = function onping(data, flags) { + flags = flags || {}; + + self.pong(data, { + mask: !self._isServer, + binary: flags.binary === true + }, true); + + self.emit('ping', data, flags); + }; + + self._receiver.onpong = function onpong(data, flags) { + self.emit('pong', data, flags || {}); + }; + + self._receiver.onclose = function onclose(code, data, flags) { + flags = flags || {}; + + self._closeReceived = true; + self.close(code, data); + }; + + self._receiver.onerror = function onerror(reason, errorCode) { + // close the connection when the receiver reports a HyBi error code + self.close(typeof errorCode !== 'undefined' ? errorCode : 1002, ''); + self.emit('error', reason, errorCode); + }; + + // finalize the client + this._sender = new SenderClass(socket, this.extensions); + this._sender.on('error', function onerror(error) { + self.close(1002, ''); + self.emit('error', error); + }); + + this.readyState = WebSocket.OPEN; + this.emit('open'); + + ultron.on('data', dataHandler); +} + +function startQueue(instance) { + instance._queue = instance._queue || []; +} + +function executeQueueSends(instance) { + var queue = instance._queue; + if (typeof queue === 'undefined') return; + + delete instance._queue; + for (var i = 0, l = queue.length; i < l; ++i) { + queue[i](); + } +} + +function sendStream(instance, stream, options, cb) { + stream.on('data', function incoming(data) { + if (instance.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else { + delete instance._queue; + instance.emit('error', new Error('not opened')); + } + return; + } + + options.fin = false; + instance._sender.send(data, options); + }); + + stream.on('end', function end() { + if (instance.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else { + delete instance._queue; + instance.emit('error', new Error('not opened')); + } + return; + } + + options.fin = true; + instance._sender.send(null, options); + + if (typeof cb === 'function') cb(null); + }); +} + +function cleanupWebsocketResources(error) { + if (this.readyState === WebSocket.CLOSED) return; + + var emitClose = this.readyState !== WebSocket.CONNECTING; + this.readyState = WebSocket.CLOSED; + + clearTimeout(this._closeTimer); + this._closeTimer = null; + + if (emitClose) { + this.emit('close', this._closeCode || 1000, this._closeMessage || ''); + } + + if (this._socket) { + if (this._ultron) this._ultron.destroy(); + this._socket.on('error', function onerror() { + try { this.destroy(); } + catch (e) {} + }); + + try { + if (!error) this._socket.end(); + else this._socket.destroy(); + } catch (e) { /* Ignore termination errors */ } + + this._socket = null; + this._ultron = null; + } + + if (this._sender) { + this._sender.removeAllListeners(); + this._sender = null; + } + + if (this._receiver) { + this._receiver.cleanup(); + this._receiver = null; + } + + this.removeAllListeners(); + this.on('error', function onerror() {}); // catch all errors after this + delete this._queue; +} diff --git a/node_modules/simple-websocket/node_modules/ws/lib/WebSocketServer.js b/node_modules/simple-websocket/node_modules/ws/lib/WebSocketServer.js new file mode 100644 index 00000000..a2f3a618 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/WebSocketServer.js @@ -0,0 +1,501 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util') + , events = require('events') + , http = require('http') + , crypto = require('crypto') + , Options = require('options') + , WebSocket = require('./WebSocket') + , Extensions = require('./Extensions') + , PerMessageDeflate = require('./PerMessageDeflate') + , tls = require('tls') + , url = require('url'); + +/** + * WebSocket Server implementation + */ + +function WebSocketServer(options, callback) { + events.EventEmitter.call(this); + + options = new Options({ + host: '0.0.0.0', + port: null, + server: null, + verifyClient: null, + handleProtocols: null, + path: null, + noServer: false, + disableHixie: false, + clientTracking: true, + perMessageDeflate: true + }).merge(options); + + if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) { + throw new TypeError('`port` or a `server` must be provided'); + } + + var self = this; + + if (options.isDefinedAndNonNull('port')) { + this._server = http.createServer(function (req, res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('Not implemented'); + }); + this._server.listen(options.value.port, options.value.host, callback); + this._closeServer = function() { if (self._server) self._server.close(); }; + } + else if (options.value.server) { + this._server = options.value.server; + if (options.value.path) { + // take note of the path, to avoid collisions when multiple websocket servers are + // listening on the same http server + if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) { + throw new Error('two instances of WebSocketServer cannot listen on the same http server path'); + } + if (typeof this._server._webSocketPaths !== 'object') { + this._server._webSocketPaths = {}; + } + this._server._webSocketPaths[options.value.path] = 1; + } + } + if (this._server) this._server.once('listening', function() { self.emit('listening'); }); + + if (typeof this._server != 'undefined') { + this._server.on('error', function(error) { + self.emit('error', error) + }); + this._server.on('upgrade', function(req, socket, upgradeHead) { + //copy upgradeHead to avoid retention of large slab buffers used in node core + var head = new Buffer(upgradeHead.length); + upgradeHead.copy(head); + + self.handleUpgrade(req, socket, head, function(client) { + self.emit('connection'+req.url, client); + self.emit('connection', client); + }); + }); + } + + this.options = options.value; + this.path = options.value.path; + this.clients = []; +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(WebSocketServer, events.EventEmitter); + +/** + * Immediately shuts down the connection. + * + * @api public + */ + +WebSocketServer.prototype.close = function() { + // terminate all associated clients + var error = null; + try { + for (var i = 0, l = this.clients.length; i < l; ++i) { + this.clients[i].terminate(); + } + } + catch (e) { + error = e; + } + + // remove path descriptor, if any + if (this.path && this._server._webSocketPaths) { + delete this._server._webSocketPaths[this.path]; + if (Object.keys(this._server._webSocketPaths).length == 0) { + delete this._server._webSocketPaths; + } + } + + // close the http server if it was internally created + try { + if (typeof this._closeServer !== 'undefined') { + this._closeServer(); + } + } + finally { + delete this._server; + } + if (error) throw error; +} + +/** + * Handle a HTTP Upgrade request. + * + * @api public + */ + +WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) { + // check for wrong path + if (this.options.path) { + var u = url.parse(req.url); + if (u && u.pathname !== this.options.path) return; + } + + if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments); + else handleHybiUpgrade.apply(this, arguments); +} + +module.exports = WebSocketServer; + +/** + * Entirely private apis, + * which may or may not be bound to a sepcific WebSocket instance. + */ + +function handleHybiUpgrade(req, socket, upgradeHead, cb) { + // handle premature socket errors + var errorHandler = function() { + try { socket.destroy(); } catch (e) {} + } + socket.on('error', errorHandler); + + // verify key presence + if (!req.headers['sec-websocket-key']) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + // verify version + var version = parseInt(req.headers['sec-websocket-version']); + if ([8, 13].indexOf(version) === -1) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + // verify protocol + var protocols = req.headers['sec-websocket-protocol']; + + // verify client + var origin = version < 13 ? + req.headers['sec-websocket-origin'] : + req.headers['origin']; + + // handle extensions offer + var extensionsOffer = Extensions.parse(req.headers['sec-websocket-extensions']); + + // handler to call when the connection sequence completes + var self = this; + var completeHybiUpgrade2 = function(protocol) { + + // calc key + var key = req.headers['sec-websocket-key']; + var shasum = crypto.createHash('sha1'); + shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + key = shasum.digest('base64'); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: websocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Accept: ' + key + ]; + + if (typeof protocol != 'undefined') { + headers.push('Sec-WebSocket-Protocol: ' + protocol); + } + + var extensions = {}; + try { + extensions = acceptExtensions.call(self, extensionsOffer); + } catch (err) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + if (Object.keys(extensions).length) { + var serverExtensions = {}; + Object.keys(extensions).forEach(function(token) { + serverExtensions[token] = [extensions[token].params] + }); + headers.push('Sec-WebSocket-Extensions: ' + Extensions.format(serverExtensions)); + } + + // allows external modification/inspection of handshake headers + self.emit('headers', headers); + + socket.setTimeout(0); + socket.setNoDelay(true); + try { + socket.write(headers.concat('', '').join('\r\n')); + } + catch (e) { + // if the upgrade write fails, shut the connection down hard + try { socket.destroy(); } catch (e) {} + return; + } + + var client = new WebSocket([req, socket, upgradeHead], { + protocolVersion: version, + protocol: protocol, + extensions: extensions + }); + + if (self.options.clientTracking) { + self.clients.push(client); + client.on('close', function() { + var index = self.clients.indexOf(client); + if (index != -1) { + self.clients.splice(index, 1); + } + }); + } + + // signal upgrade complete + socket.removeListener('error', errorHandler); + cb(client); + } + + // optionally call external protocol selection handler before + // calling completeHybiUpgrade2 + var completeHybiUpgrade1 = function() { + // choose from the sub-protocols + if (typeof self.options.handleProtocols == 'function') { + var protList = (protocols || "").split(/, */); + var callbackCalled = false; + var res = self.options.handleProtocols(protList, function(result, protocol) { + callbackCalled = true; + if (!result) abortConnection(socket, 401, 'Unauthorized'); + else completeHybiUpgrade2(protocol); + }); + if (!callbackCalled) { + // the handleProtocols handler never called our callback + abortConnection(socket, 501, 'Could not process protocols'); + } + return; + } else { + if (typeof protocols !== 'undefined') { + completeHybiUpgrade2(protocols.split(/, */)[0]); + } + else { + completeHybiUpgrade2(); + } + } + } + + // optionally call external client verification handler + if (typeof this.options.verifyClient == 'function') { + var info = { + origin: origin, + secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', + req: req + }; + if (this.options.verifyClient.length == 2) { + this.options.verifyClient(info, function(result, code, name) { + if (typeof code === 'undefined') code = 401; + if (typeof name === 'undefined') name = http.STATUS_CODES[code]; + + if (!result) abortConnection(socket, code, name); + else completeHybiUpgrade1(); + }); + return; + } + else if (!this.options.verifyClient(info)) { + abortConnection(socket, 401, 'Unauthorized'); + return; + } + } + + completeHybiUpgrade1(); +} + +function handleHixieUpgrade(req, socket, upgradeHead, cb) { + // handle premature socket errors + var errorHandler = function() { + try { socket.destroy(); } catch (e) {} + } + socket.on('error', errorHandler); + + // bail if options prevent hixie + if (this.options.disableHixie) { + abortConnection(socket, 401, 'Hixie support disabled'); + return; + } + + // verify key presence + if (!req.headers['sec-websocket-key2']) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + var origin = req.headers['origin'] + , self = this; + + // setup handshake completion to run after client has been verified + var onClientVerified = function() { + var wshost; + if (!req.headers['x-forwarded-host']) + wshost = req.headers.host; + else + wshost = req.headers['x-forwarded-host']; + var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url + , protocol = req.headers['sec-websocket-protocol']; + + // handshake completion code to run once nonce has been successfully retrieved + var completeHandshake = function(nonce, rest) { + // calculate key + var k1 = req.headers['sec-websocket-key1'] + , k2 = req.headers['sec-websocket-key2'] + , md5 = crypto.createHash('md5'); + + [k1, k2].forEach(function (k) { + var n = parseInt(k.replace(/[^\d]/g, '')) + , spaces = k.replace(/[^ ]/g, '').length; + if (spaces === 0 || n % spaces !== 0){ + abortConnection(socket, 400, 'Bad Request'); + return; + } + n /= spaces; + md5.update(String.fromCharCode( + n >> 24 & 0xFF, + n >> 16 & 0xFF, + n >> 8 & 0xFF, + n & 0xFF)); + }); + md5.update(nonce.toString('binary')); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: WebSocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Location: ' + location + ]; + if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol); + if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin); + + socket.setTimeout(0); + socket.setNoDelay(true); + try { + // merge header and hash buffer + var headerBuffer = new Buffer(headers.concat('', '').join('\r\n')); + var hashBuffer = new Buffer(md5.digest('binary'), 'binary'); + var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length); + headerBuffer.copy(handshakeBuffer, 0); + hashBuffer.copy(handshakeBuffer, headerBuffer.length); + + // do a single write, which - upon success - causes a new client websocket to be setup + socket.write(handshakeBuffer, 'binary', function(err) { + if (err) return; // do not create client if an error happens + var client = new WebSocket([req, socket, rest], { + protocolVersion: 'hixie-76', + protocol: protocol + }); + if (self.options.clientTracking) { + self.clients.push(client); + client.on('close', function() { + var index = self.clients.indexOf(client); + if (index != -1) { + self.clients.splice(index, 1); + } + }); + } + + // signal upgrade complete + socket.removeListener('error', errorHandler); + cb(client); + }); + } + catch (e) { + try { socket.destroy(); } catch (e) {} + return; + } + } + + // retrieve nonce + var nonceLength = 8; + if (upgradeHead && upgradeHead.length >= nonceLength) { + var nonce = upgradeHead.slice(0, nonceLength); + var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null; + completeHandshake.call(self, nonce, rest); + } + else { + // nonce not present in upgradeHead, so we must wait for enough data + // data to arrive before continuing + var nonce = new Buffer(nonceLength); + upgradeHead.copy(nonce, 0); + var received = upgradeHead.length; + var rest = null; + var handler = function (data) { + var toRead = Math.min(data.length, nonceLength - received); + if (toRead === 0) return; + data.copy(nonce, received, 0, toRead); + received += toRead; + if (received == nonceLength) { + socket.removeListener('data', handler); + if (toRead < data.length) rest = data.slice(toRead); + completeHandshake.call(self, nonce, rest); + } + } + socket.on('data', handler); + } + } + + // verify client + if (typeof this.options.verifyClient == 'function') { + var info = { + origin: origin, + secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', + req: req + }; + if (this.options.verifyClient.length == 2) { + var self = this; + this.options.verifyClient(info, function(result, code, name) { + if (typeof code === 'undefined') code = 401; + if (typeof name === 'undefined') name = http.STATUS_CODES[code]; + + if (!result) abortConnection(socket, code, name); + else onClientVerified.apply(self); + }); + return; + } + else if (!this.options.verifyClient(info)) { + abortConnection(socket, 401, 'Unauthorized'); + return; + } + } + + // no client verification required + onClientVerified(); +} + +function acceptExtensions(offer) { + var extensions = {}; + var options = this.options.perMessageDeflate; + if (options && offer[PerMessageDeflate.extensionName]) { + var perMessageDeflate = new PerMessageDeflate(options !== true ? options : {}, true); + perMessageDeflate.accept(offer[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + return extensions; +} + +function abortConnection(socket, code, name) { + try { + var response = [ + 'HTTP/1.1 ' + code + ' ' + name, + 'Content-type: text/html' + ]; + socket.write(response.concat('', '').join('\r\n')); + } + catch (e) { /* ignore errors - we've aborted this connection */ } + finally { + // ensure that an early aborted connection is shut down completely + try { socket.destroy(); } catch (e) {} + } +} diff --git a/node_modules/simple-websocket/node_modules/ws/lib/browser.js b/node_modules/simple-websocket/node_modules/ws/lib/browser.js new file mode 100644 index 00000000..8d3a755c --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/lib/browser.js @@ -0,0 +1,43 @@ + +/** + * Module dependencies. + */ + +var global = (function() { return this; })(); + +/** + * WebSocket constructor. + */ + +var WebSocket = global.WebSocket || global.MozWebSocket; + +/** + * Module exports. + */ + +module.exports = WebSocket ? ws : null; + +/** + * WebSocket constructor. + * + * The third `opts` options object gets ignored in web browsers, since it's + * non-standard, and throws a TypeError if passed to the constructor. + * See: https://github.com/einaros/ws/issues/227 + * + * @param {String} uri + * @param {Array} protocols (optional) + * @param {Object) opts (optional) + * @api public + */ + +function ws(uri, protocols, opts) { + var instance; + if (protocols) { + instance = new WebSocket(uri, protocols); + } else { + instance = new WebSocket(uri); + } + return instance; +} + +if (WebSocket) ws.prototype = WebSocket.prototype; diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/.npmignore b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/.npmignore new file mode 100644 index 00000000..0c90f673 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/.npmignore @@ -0,0 +1,3 @@ +npm-debug.log +node_modules +build diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/binding.gyp b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/binding.gyp new file mode 100644 index 00000000..31f41a65 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/binding.gyp @@ -0,0 +1,10 @@ +{ + 'targets': [ + { + 'target_name': 'bufferutil', + 'include_dirs': ["> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_objc = CXX($(TOOLSET)) $@ +cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< + +quiet_cmd_objcxx = CXX($(TOOLSET)) $@ +cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# Commands for precompiled header files. +quiet_cmd_pch_c = CXX($(TOOLSET)) $@ +cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ +cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_m = CXX($(TOOLSET)) $@ +cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< +quiet_cmd_pch_mm = CXX($(TOOLSET)) $@ +cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# gyp-mac-tool is written next to the root Makefile by gyp. +# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd +# already. +quiet_cmd_mac_tool = MACTOOL $(4) $< +cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@" + +quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@ +cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) + +quiet_cmd_infoplist = INFOPLIST $@ +cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = rm -rf "$@" && cp -af "$<" "$@" + +quiet_cmd_alink = LIBTOOL-STATIC $@ +cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 2,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,bufferutil.target.mk)))),) + include bufferutil.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/sirip/Documents/dev/bittorrent-tracker/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/sirip/.node-gyp/0.12.1/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/sirip/.node-gyp/0.12.1" "-Dmodule_root_dir=/Users/sirip/Documents/dev/bittorrent-tracker/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil" binding.gyp +Makefile: $(srcdir)/../../../../../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../../../.node-gyp/0.12.1/common.gypi + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/bufferutil.node.d b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/bufferutil.node.d new file mode 100644 index 00000000..70d0a06f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/bufferutil.node.d @@ -0,0 +1 @@ +cmd_Release/bufferutil.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -bundle -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -o Release/bufferutil.node Release/obj.target/bufferutil/src/bufferutil.o -undefined dynamic_lookup diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d new file mode 100644 index 00000000..05eb3281 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d @@ -0,0 +1,37 @@ +cmd_Release/obj.target/bufferutil/src/bufferutil.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/sirip/.node-gyp/0.12.1/src -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include -I../node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw -c -o Release/obj.target/bufferutil/src/bufferutil.o ../src/bufferutil.cc +Release/obj.target/bufferutil/src/bufferutil.o: ../src/bufferutil.cc \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8.h \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8stdint.h \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8config.h \ + /Users/sirip/.node-gyp/0.12.1/src/node.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_version.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_buffer.h \ + /Users/sirip/.node-gyp/0.12.1/src/smalloc.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_object_wrap.h \ + ../node_modules/nan/nan.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-errno.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-version.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-unix.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-threadpool.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-darwin.h \ + ../node_modules/nan/nan_new.h \ + ../node_modules/nan/nan_implementation_12_inl.h +../src/bufferutil.cc: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8.h: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8stdint.h: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8config.h: +/Users/sirip/.node-gyp/0.12.1/src/node.h: +/Users/sirip/.node-gyp/0.12.1/src/node_version.h: +/Users/sirip/.node-gyp/0.12.1/src/node_buffer.h: +/Users/sirip/.node-gyp/0.12.1/src/smalloc.h: +/Users/sirip/.node-gyp/0.12.1/src/node_object_wrap.h: +../node_modules/nan/nan.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-errno.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-version.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-unix.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-threadpool.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-darwin.h: +../node_modules/nan/nan_new.h: +../node_modules/nan/nan_implementation_12_inl.h: diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/bufferutil.node b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/bufferutil.node new file mode 100755 index 00000000..5aa6e15e Binary files /dev/null and b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/bufferutil.node differ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/linker.lock b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/linker.lock new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/obj.target/bufferutil/src/bufferutil.o b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/obj.target/bufferutil/src/bufferutil.o new file mode 100644 index 00000000..e2478a2c Binary files /dev/null and b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/Release/obj.target/bufferutil/src/bufferutil.o differ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/binding.Makefile b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/binding.Makefile new file mode 100644 index 00000000..b532496b --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) bufferutil diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/bufferutil.target.mk b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/bufferutil.target.mk new file mode 100644 index 00000000..4fcdab91 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/bufferutil.target.mk @@ -0,0 +1,156 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := bufferutil +DEFS_Debug := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' \ + '-DDEBUG' \ + '-D_DEBUG' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -O0 \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Debug := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Debug := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Debug := + +INCS_Debug := \ + -I/Users/sirip/.node-gyp/0.12.1/src \ + -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include \ + -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +DEFS_Release := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' + +# Flags passed to all source files. +CFLAGS_Release := \ + -Os \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Release := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Release := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Release := + +INCS_Release := \ + -I/Users/sirip/.node-gyp/0.12.1/src \ + -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include \ + -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +OBJS := \ + $(obj).target/$(TARGET)/src/bufferutil.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Debug := \ + -Wl,-search_paths_first + +LDFLAGS_Release := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Release := \ + -Wl,-search_paths_first + +LIBS := \ + -undefined dynamic_lookup + +$(builddir)/bufferutil.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(builddir)/bufferutil.node: LIBS := $(LIBS) +$(builddir)/bufferutil.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE)) +$(builddir)/bufferutil.node: TOOLSET := $(TOOLSET) +$(builddir)/bufferutil.node: $(OBJS) FORCE_DO_CMD + $(call do_cmd,solink_module) + +all_deps += $(builddir)/bufferutil.node +# Add target alias +.PHONY: bufferutil +bufferutil: $(builddir)/bufferutil.node + +# Short alias for building this executable. +.PHONY: bufferutil.node +bufferutil.node: $(builddir)/bufferutil.node + +# Add executable to "all" target. +.PHONY: all +all: $(builddir)/bufferutil.node + diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/config.gypi b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/config.gypi new file mode 100644 index 00000000..0af2b6d8 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/config.gypi @@ -0,0 +1,129 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "clang": 1, + "host_arch": "x64", + "icu_small": "false", + "node_install_npm": "false", + "node_prefix": "/usr/local/Cellar/node/0.12.1", + "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_use_dtrace": "true", + "node_use_etw": "false", + "node_use_mdb": "false", + "node_use_openssl": "true", + "node_use_perfctr": "false", + "openssl_no_asm": 0, + "python": "/usr/local/opt/python/bin/python2.7", + "target_arch": "x64", + "uv_library": "static_library", + "uv_parent_path": "/deps/uv/", + "uv_use_dtrace": "true", + "v8_enable_gdbjit": 0, + "v8_enable_i18n_support": 0, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 0, + "v8_random_seed": 0, + "v8_use_snapshot": "true", + "want_separate_host_toolset": 0, + "nodedir": "/Users/sirip/.node-gyp/0.12.1", + "copy_dev_lib": "true", + "standalone_static_library": 1, + "save_dev": "", + "browser": "", + "viewer": "man", + "rollback": "true", + "usage": "", + "globalignorefile": "/usr/local/etc/npmignore", + "init_author_url": "", + "shell": "/bin/bash", + "parseable": "", + "shrinkwrap": "true", + "init_license": "ISC", + "if_present": "", + "cache_max": "Infinity", + "init_author_email": "", + "sign_git_tag": "", + "cert": "", + "git_tag_version": "true", + "local_address": "", + "long": "", + "fetch_retries": "2", + "npat": "", + "registry": "https://registry.npmjs.org/", + "key": "", + "message": "%s", + "versions": "", + "globalconfig": "/usr/local/etc/npmrc", + "always_auth": "", + "spin": "true", + "cache_lock_retries": "10", + "cafile": "", + "heading": "npm", + "fetch_retry_mintimeout": "10000", + "proprietary_attribs": "true", + "access": "", + "json": "", + "description": "true", + "engine_strict": "", + "https_proxy": "", + "init_module": "/Users/sirip/.npm-init.js", + "userconfig": "/Users/sirip/.npmrc", + "node_version": "0.12.1", + "user": "", + "editor": "vi", + "save": "", + "tag": "latest", + "global": "", + "optional": "true", + "bin_links": "true", + "force": "", + "searchopts": "", + "depth": "", + "rebuild_bundle": "true", + "searchsort": "name", + "unicode": "true", + "fetch_retry_maxtimeout": "60000", + "ca": "", + "save_prefix": "^", + "strict_ssl": "true", + "dev": "", + "fetch_retry_factor": "10", + "group": "20", + "save_exact": "", + "cache_lock_stale": "60000", + "version": "", + "cache_min": "10", + "cache": "/Users/sirip/.npm", + "searchexclude": "", + "color": "true", + "save_optional": "", + "user_agent": "npm/2.7.3 node/v0.12.1 darwin x64", + "ignore_scripts": "", + "cache_lock_wait": "10000", + "production": "", + "save_bundle": "", + "init_version": "1.0.0", + "umask": "0022", + "git": "git", + "init_author_name": "", + "scope": "", + "onload_script": "", + "tmp": "/var/folders/fd/838gnt9x47gd1ylq5_t46zwc0000gt/T", + "unsafe_perm": "true", + "prefix": "/usr/local", + "link": "" + } +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/gyp-mac-tool b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/gyp-mac-tool new file mode 100755 index 00000000..7abfed5f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/build/gyp-mac-tool @@ -0,0 +1,512 @@ +#!/usr/bin/env python +# Generated by gyp. Do not edit. +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions to perform Xcode-style build steps. + +These functions are executed via gyp-mac-tool when using the Makefile generator. +""" + +import fcntl +import fnmatch +import glob +import json +import os +import plistlib +import re +import shutil +import string +import subprocess +import sys +import tempfile + + +def main(args): + executor = MacTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class MacTool(object): + """This class performs all the Mac tooling steps. The methods can either be + executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like copy-info-plist to CopyInfoPlist""" + return name_string.title().replace('-', '') + + def ExecCopyBundleResource(self, source, dest): + """Copies a resource file to the bundle/Resources directory, performing any + necessary compilation on each resource.""" + extension = os.path.splitext(source)[1].lower() + if os.path.isdir(source): + # Copy tree. + # TODO(thakis): This copies file attributes like mtime, while the + # single-file branch below doesn't. This should probably be changed to + # be consistent with the single-file branch. + if os.path.exists(dest): + shutil.rmtree(dest) + shutil.copytree(source, dest) + elif extension == '.xib': + return self._CopyXIBFile(source, dest) + elif extension == '.storyboard': + return self._CopyXIBFile(source, dest) + elif extension == '.strings': + self._CopyStringsFile(source, dest) + else: + shutil.copy(source, dest) + + def _CopyXIBFile(self, source, dest): + """Compiles a XIB file with ibtool into a binary plist in the bundle.""" + + # ibtool sometimes crashes with relative paths. See crbug.com/314728. + base = os.path.dirname(os.path.realpath(__file__)) + if os.path.relpath(source): + source = os.path.join(base, source) + if os.path.relpath(dest): + dest = os.path.join(base, dest) + + args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices', + '--output-format', 'human-readable-text', '--compile', dest, source] + ibtool_section_re = re.compile(r'/\*.*\*/') + ibtool_re = re.compile(r'.*note:.*is clipping its content') + ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) + current_section_header = None + for line in ibtoolout.stdout: + if ibtool_section_re.match(line): + current_section_header = line + elif not ibtool_re.match(line): + if current_section_header: + sys.stdout.write(current_section_header) + current_section_header = None + sys.stdout.write(line) + return ibtoolout.returncode + + def _CopyStringsFile(self, source, dest): + """Copies a .strings file using iconv to reconvert the input into UTF-16.""" + input_code = self._DetectInputEncoding(source) or "UTF-8" + + # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call + # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints + # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing + # semicolon in dictionary. + # on invalid files. Do the same kind of validation. + import CoreFoundation + s = open(source, 'rb').read() + d = CoreFoundation.CFDataCreate(None, s, len(s)) + _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None) + if error: + return + + fp = open(dest, 'wb') + fp.write(s.decode(input_code).encode('UTF-16')) + fp.close() + + def _DetectInputEncoding(self, file_name): + """Reads the first few bytes from file_name and tries to guess the text + encoding. Returns None as a guess if it can't detect it.""" + fp = open(file_name, 'rb') + try: + header = fp.read(3) + except e: + fp.close() + return None + fp.close() + if header.startswith("\xFE\xFF"): + return "UTF-16" + elif header.startswith("\xFF\xFE"): + return "UTF-16" + elif header.startswith("\xEF\xBB\xBF"): + return "UTF-8" + else: + return None + + def ExecCopyInfoPlist(self, source, dest, *keys): + """Copies the |source| Info.plist to the destination directory |dest|.""" + # Read the source Info.plist into memory. + fd = open(source, 'r') + lines = fd.read() + fd.close() + + # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). + plist = plistlib.readPlistFromString(lines) + if keys: + plist = dict(plist.items() + json.loads(keys[0]).items()) + lines = plistlib.writePlistToString(plist) + + # Go through all the environment variables and replace them as variables in + # the file. + IDENT_RE = re.compile('[/\s]') + for key in os.environ: + if key.startswith('_'): + continue + evar = '${%s}' % key + evalue = os.environ[key] + lines = string.replace(lines, evar, evalue) + + # Xcode supports various suffices on environment variables, which are + # all undocumented. :rfc1034identifier is used in the standard project + # template these days, and :identifier was used earlier. They are used to + # convert non-url characters into things that look like valid urls -- + # except that the replacement character for :identifier, '_' isn't valid + # in a URL either -- oops, hence :rfc1034identifier was born. + evar = '${%s:identifier}' % key + evalue = IDENT_RE.sub('_', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + evar = '${%s:rfc1034identifier}' % key + evalue = IDENT_RE.sub('-', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + # Remove any keys with values that haven't been replaced. + lines = lines.split('\n') + for i in range(len(lines)): + if lines[i].strip().startswith("${"): + lines[i] = None + lines[i - 1] = None + lines = '\n'.join(filter(lambda x: x is not None, lines)) + + # Write out the file with variables replaced. + fd = open(dest, 'w') + fd.write(lines) + fd.close() + + # Now write out PkgInfo file now that the Info.plist file has been + # "compiled". + self._WritePkgInfo(dest) + + def _WritePkgInfo(self, info_plist): + """This writes the PkgInfo file from the data stored in Info.plist.""" + plist = plistlib.readPlist(info_plist) + if not plist: + return + + # Only create PkgInfo for executable types. + package_type = plist['CFBundlePackageType'] + if package_type != 'APPL': + return + + # The format of PkgInfo is eight characters, representing the bundle type + # and bundle signature, each four characters. If that is missing, four + # '?' characters are used instead. + signature_code = plist.get('CFBundleSignature', '????') + if len(signature_code) != 4: # Wrong length resets everything, too. + signature_code = '?' * 4 + + dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo') + fp = open(dest, 'w') + fp.write('%s%s' % (package_type, signature_code)) + fp.close() + + def ExecFlock(self, lockfile, *cmd_list): + """Emulates the most basic behavior of Linux's flock(1).""" + # Rely on exception handling to report errors. + fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) + fcntl.flock(fd, fcntl.LOCK_EX) + return subprocess.call(cmd_list) + + def ExecFilterLibtool(self, *cmd_list): + """Calls libtool and filters out '/path/to/libtool: file: foo.o has no + symbols'.""" + libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') + libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) + _, err = libtoolout.communicate() + for line in err.splitlines(): + if not libtool_re.match(line): + print >>sys.stderr, line + return libtoolout.returncode + + def ExecPackageFramework(self, framework, version): + """Takes a path to Something.framework and the Current version of that and + sets up all the symlinks.""" + # Find the name of the binary based on the part before the ".framework". + binary = os.path.basename(framework).split('.')[0] + + CURRENT = 'Current' + RESOURCES = 'Resources' + VERSIONS = 'Versions' + + if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)): + # Binary-less frameworks don't seem to contain symlinks (see e.g. + # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle). + return + + # Move into the framework directory to set the symlinks correctly. + pwd = os.getcwd() + os.chdir(framework) + + # Set up the Current version. + self._Relink(version, os.path.join(VERSIONS, CURRENT)) + + # Set up the root symlinks. + self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary) + self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES) + + # Back to where we were before! + os.chdir(pwd) + + def _Relink(self, dest, link): + """Creates a symlink to |dest| named |link|. If |link| already exists, + it is overwritten.""" + if os.path.lexists(link): + os.remove(link) + os.symlink(dest, link) + + def ExecCodeSignBundle(self, key, resource_rules, entitlements, provisioning): + """Code sign a bundle. + + This function tries to code sign an iOS bundle, following the same + algorithm as Xcode: + 1. copy ResourceRules.plist from the user or the SDK into the bundle, + 2. pick the provisioning profile that best match the bundle identifier, + and copy it into the bundle as embedded.mobileprovision, + 3. copy Entitlements.plist from user or SDK next to the bundle, + 4. code sign the bundle. + """ + resource_rules_path = self._InstallResourceRules(resource_rules) + substitutions, overrides = self._InstallProvisioningProfile( + provisioning, self._GetCFBundleIdentifier()) + entitlements_path = self._InstallEntitlements( + entitlements, substitutions, overrides) + subprocess.check_call([ + 'codesign', '--force', '--sign', key, '--resource-rules', + resource_rules_path, '--entitlements', entitlements_path, + os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['FULL_PRODUCT_NAME'])]) + + def _InstallResourceRules(self, resource_rules): + """Installs ResourceRules.plist from user or SDK into the bundle. + + Args: + resource_rules: string, optional, path to the ResourceRules.plist file + to use, default to "${SDKROOT}/ResourceRules.plist" + + Returns: + Path to the copy of ResourceRules.plist into the bundle. + """ + source_path = resource_rules + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'ResourceRules.plist') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], 'ResourceRules.plist') + shutil.copy2(source_path, target_path) + return target_path + + def _InstallProvisioningProfile(self, profile, bundle_identifier): + """Installs embedded.mobileprovision into the bundle. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple containing two dictionary: variables substitutions and values + to overrides when generating the entitlements file. + """ + source_path, provisioning_data, team_id = self._FindProvisioningProfile( + profile, bundle_identifier) + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'embedded.mobileprovision') + shutil.copy2(source_path, target_path) + substitutions = self._GetSubstitutions(bundle_identifier, team_id + '.') + return substitutions, provisioning_data['Entitlements'] + + def _FindProvisioningProfile(self, profile, bundle_identifier): + """Finds the .mobileprovision file to use for signing the bundle. + + Checks all the installed provisioning profiles (or if the user specified + the PROVISIONING_PROFILE variable, only consult it) and select the most + specific that correspond to the bundle identifier. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple of the path to the selected provisioning profile, the data of + the embedded plist in the provisioning profile and the team identifier + to use for code signing. + + Raises: + SystemExit: if no .mobileprovision can be used to sign the bundle. + """ + profiles_dir = os.path.join( + os.environ['HOME'], 'Library', 'MobileDevice', 'Provisioning Profiles') + if not os.path.isdir(profiles_dir): + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + provisioning_profiles = None + if profile: + profile_path = os.path.join(profiles_dir, profile + '.mobileprovision') + if os.path.exists(profile_path): + provisioning_profiles = [profile_path] + if not provisioning_profiles: + provisioning_profiles = glob.glob( + os.path.join(profiles_dir, '*.mobileprovision')) + valid_provisioning_profiles = {} + for profile_path in provisioning_profiles: + profile_data = self._LoadProvisioningProfile(profile_path) + app_id_pattern = profile_data.get( + 'Entitlements', {}).get('application-identifier', '') + for team_identifier in profile_data.get('TeamIdentifier', []): + app_id = '%s.%s' % (team_identifier, bundle_identifier) + if fnmatch.fnmatch(app_id, app_id_pattern): + valid_provisioning_profiles[app_id_pattern] = ( + profile_path, profile_data, team_identifier) + if not valid_provisioning_profiles: + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + # If the user has multiple provisioning profiles installed that can be + # used for ${bundle_identifier}, pick the most specific one (ie. the + # provisioning profile whose pattern is the longest). + selected_key = max(valid_provisioning_profiles, key=lambda v: len(v)) + return valid_provisioning_profiles[selected_key] + + def _LoadProvisioningProfile(self, profile_path): + """Extracts the plist embedded in a provisioning profile. + + Args: + profile_path: string, path to the .mobileprovision file + + Returns: + Content of the plist embedded in the provisioning profile as a dictionary. + """ + with tempfile.NamedTemporaryFile() as temp: + subprocess.check_call([ + 'security', 'cms', '-D', '-i', profile_path, '-o', temp.name]) + return self._LoadPlistMaybeBinary(temp.name) + + def _LoadPlistMaybeBinary(self, plist_path): + """Loads into a memory a plist possibly encoded in binary format. + + This is a wrapper around plistlib.readPlist that tries to convert the + plist to the XML format if it can't be parsed (assuming that it is in + the binary format). + + Args: + plist_path: string, path to a plist file, in XML or binary format + + Returns: + Content of the plist as a dictionary. + """ + try: + # First, try to read the file using plistlib that only supports XML, + # and if an exception is raised, convert a temporary copy to XML and + # load that copy. + return plistlib.readPlist(plist_path) + except: + pass + with tempfile.NamedTemporaryFile() as temp: + shutil.copy2(plist_path, temp.name) + subprocess.check_call(['plutil', '-convert', 'xml1', temp.name]) + return plistlib.readPlist(temp.name) + + def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix): + """Constructs a dictionary of variable substitutions for Entitlements.plist. + + Args: + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + app_identifier_prefix: string, value for AppIdentifierPrefix + + Returns: + Dictionary of substitutions to apply when generating Entitlements.plist. + """ + return { + 'CFBundleIdentifier': bundle_identifier, + 'AppIdentifierPrefix': app_identifier_prefix, + } + + def _GetCFBundleIdentifier(self): + """Extracts CFBundleIdentifier value from Info.plist in the bundle. + + Returns: + Value of CFBundleIdentifier in the Info.plist located in the bundle. + """ + info_plist_path = os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['INFOPLIST_PATH']) + info_plist_data = self._LoadPlistMaybeBinary(info_plist_path) + return info_plist_data['CFBundleIdentifier'] + + def _InstallEntitlements(self, entitlements, substitutions, overrides): + """Generates and install the ${BundleName}.xcent entitlements file. + + Expands variables "$(variable)" pattern in the source entitlements file, + add extra entitlements defined in the .mobileprovision file and the copy + the generated plist to "${BundlePath}.xcent". + + Args: + entitlements: string, optional, path to the Entitlements.plist template + to use, defaults to "${SDKROOT}/Entitlements.plist" + substitutions: dictionary, variable substitutions + overrides: dictionary, values to add to the entitlements + + Returns: + Path to the generated entitlements file. + """ + source_path = entitlements + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['PRODUCT_NAME'] + '.xcent') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], + 'Entitlements.plist') + shutil.copy2(source_path, target_path) + data = self._LoadPlistMaybeBinary(target_path) + data = self._ExpandVariables(data, substitutions) + if overrides: + for key in overrides: + if key not in data: + data[key] = overrides[key] + plistlib.writePlist(data, target_path) + return target_path + + def _ExpandVariables(self, data, substitutions): + """Expands variables "$(variable)" in data. + + Args: + data: object, can be either string, list or dictionary + substitutions: dictionary, variable substitutions to perform + + Returns: + Copy of data where each references to "$(variable)" has been replaced + by the corresponding value found in substitutions, or left intact if + the key was not found. + """ + if isinstance(data, str): + for key, value in substitutions.iteritems(): + data = data.replace('$(%s)' % key, value) + return data + if isinstance(data, list): + return [self._ExpandVariables(v, substitutions) for v in data] + if isinstance(data, dict): + return dict((k, self._ExpandVariables(data[k], + substitutions)) for k in data) + return data + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/fallback.js b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/fallback.js new file mode 100644 index 00000000..ef4658b0 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/fallback.js @@ -0,0 +1,52 @@ +'use strict'; + +/*! + * bufferutil: WebSocket buffer utils + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.BufferUtil = { + merge: function(mergedBuffer, buffers) { + var offset = 0; + + for (var i = 0, l = buffers.length; i < l; ++i) { + var buf = buffers[i]; + buf.copy(mergedBuffer, offset); + offset += buf.length; + } + }, + mask: function(source, mask, output, offset, length) { + var maskNum = mask.readUInt32LE(0, true); + var i = 0; + + for (; i < length - 3; i += 4) { + var num = maskNum ^ source.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + output.writeUInt32LE(num, offset + i, true); + } + + switch (length % 4) { + case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; + case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; + case 1: output[offset + i] = source[i] ^ mask[0]; + } + }, + unmask: function(data, mask) { + var maskNum = mask.readUInt32LE(0, true); + var length = data.length; + var i = 0; + + for (; i < length - 3; i += 4) { + var num = maskNum ^ data.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + data.writeUInt32LE(num, i, true); + } + + switch (length % 4) { + case 3: data[i + 2] = data[i + 2] ^ mask[2]; + case 2: data[i + 1] = data[i + 1] ^ mask[1]; + case 1: data[i] = data[i] ^ mask[0]; + } + } +}; diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/index.js b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/index.js new file mode 100644 index 00000000..00c607c6 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/index.js @@ -0,0 +1,7 @@ +'use strict'; + +try { + module.exports = require('bindings')('bufferutil'); +} catch (e) { + module.exports = require('./fallback'); +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/bindings/README.md b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/bindings/README.md new file mode 100644 index 00000000..585cf512 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/bindings/README.md @@ -0,0 +1,97 @@ +node-bindings +============= +### Helper module for loading your native module's .node file + +This is a helper module for authors of Node.js native addon modules. +It is basically the "swiss army knife" of `require()`ing your native module's +`.node` file. + +Throughout the course of Node's native addon history, addons have ended up being +compiled in a variety of different places, depending on which build tool and which +version of node was used. To make matters worse, now the _gyp_ build tool can +produce either a _Release_ or _Debug_ build, each being built into different +locations. + +This module checks _all_ the possible locations that a native addon would be built +at, and returns the first one that loads successfully. + + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install bindings +``` + +Or add it to the `"dependencies"` section of your _package.json_ file. + + +Example +------- + +`require()`ing the proper bindings file for the current node version, platform +and architecture is as simple as: + +``` js +var bindings = require('bindings')('binding.node') + +// Use your bindings defined in your C files +bindings.your_c_function() +``` + + +Nice Error Output +----------------- + +When the `.node` file could not be loaded, `node-bindings` throws an Error with +a nice error message telling you exactly what was tried. You can also check the +`err.tries` Array property. + +``` +Error: Could not load the bindings file. Tried: + → /Users/nrajlich/ref/build/binding.node + → /Users/nrajlich/ref/build/Debug/binding.node + → /Users/nrajlich/ref/build/Release/binding.node + → /Users/nrajlich/ref/out/Debug/binding.node + → /Users/nrajlich/ref/Debug/binding.node + → /Users/nrajlich/ref/out/Release/binding.node + → /Users/nrajlich/ref/Release/binding.node + → /Users/nrajlich/ref/build/default/binding.node + → /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node + at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13) + at Object. (/Users/nrajlich/ref/lib/ref.js:5:47) + at Module._compile (module.js:449:26) + at Object.Module._extensions..js (module.js:467:10) + at Module.load (module.js:356:32) + at Function.Module._load (module.js:312:12) + ... +``` + + +License +------- + +(The MIT License) + +Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> + +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/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/bindings/bindings.js b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/bindings/bindings.js new file mode 100644 index 00000000..93dcf85a --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/bindings/bindings.js @@ -0,0 +1,166 @@ + +/** + * Module dependencies. + */ + +var fs = require('fs') + , path = require('path') + , join = path.join + , dirname = path.dirname + , exists = fs.existsSync || path.existsSync + , defaults = { + arrow: process.env.NODE_BINDINGS_ARROW || ' → ' + , compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' + , platform: process.platform + , arch: process.arch + , version: process.versions.node + , bindings: 'bindings.node' + , try: [ + // node-gyp's linked version in the "build" dir + [ 'module_root', 'build', 'bindings' ] + // node-waf and gyp_addon (a.k.a node-gyp) + , [ 'module_root', 'build', 'Debug', 'bindings' ] + , [ 'module_root', 'build', 'Release', 'bindings' ] + // Debug files, for development (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Debug', 'bindings' ] + , [ 'module_root', 'Debug', 'bindings' ] + // Release files, but manually compiled (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Release', 'bindings' ] + , [ 'module_root', 'Release', 'bindings' ] + // Legacy from node-waf, node <= 0.4.x + , [ 'module_root', 'build', 'default', 'bindings' ] + // Production "Release" buildtype binary (meh...) + , [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ] + ] + } + +/** + * The main `bindings()` function loads the compiled bindings for a given module. + * It uses V8's Error API to determine the parent filename that this function is + * being invoked from, which is then used to find the root directory. + */ + +function bindings (opts) { + + // Argument surgery + if (typeof opts == 'string') { + opts = { bindings: opts } + } else if (!opts) { + opts = {} + } + opts.__proto__ = defaults + + // Get the module root + if (!opts.module_root) { + opts.module_root = exports.getRoot(exports.getFileName()) + } + + // Ensure the given bindings name ends with .node + if (path.extname(opts.bindings) != '.node') { + opts.bindings += '.node' + } + + var tries = [] + , i = 0 + , l = opts.try.length + , n + , b + , err + + for (; i=1.2.0 <1.3.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "TooTallNate", + "email": "nathan@tootallnate.net" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11", + "tarball": "http://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/.dntrc b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/.dntrc new file mode 100644 index 00000000..47971da6 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/.dntrc @@ -0,0 +1,30 @@ +## DNT config file +## see https://github.com/rvagg/dnt + +NODE_VERSIONS="\ + master \ + v0.11.13 \ + v0.10.30 \ + v0.10.29 \ + v0.10.28 \ + 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.8.28 \ + v0.8.27 \ + v0.8.26 \ + v0.8.24 \ +" +OUTPUT_PREFIX="nan-" +TEST_CMD=" \ + cd /dnt/ && \ + npm install && \ + node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild --directory test && \ + node_modules/.bin/tap --gc test/js/*-test.js \ +" + diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/CHANGELOG.md b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/CHANGELOG.md new file mode 100644 index 00000000..de0ac02a --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/CHANGELOG.md @@ -0,0 +1,265 @@ +# NAN ChangeLog + +**Version 1.6.2: current Node unstable: 0.11.16, Node stable: 0.10.36, io.js: 1.1.0** + +### 1.6.2 Feb 6 2015 + + - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 + +### 1.6.1 Jan 23 2015 + + - Build: version bump + +### 1.5.3 Jan 23 2015 + + - Build: repackage + +### 1.6.0 Jan 23 2015 + + - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af + - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 + - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 + +### 1.5.2 Jan 23 2015 + + - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 + - Bugfix: Readded missing String constructors 18d828f + - Bugfix: Add overload handling NanNew(..) 5ef813b + - Bugfix: Fix uv_work_cb versioning 997e4ae + - Bugfix: Add function factory and test 4eca89c + - Bugfix: Add object template factory and test cdcb951 + - Correctness: Lifted an io.js related typedef c9490be + - Correctness: Make explicit downcasts of String lengths 00074e6 + - Windows: Limit the scope of disabled warning C4530 83d7deb + +### 1.5.1 Jan 15 2015 + + - Build: version bump + +### 1.4.3 Jan 15 2015 + + - Build: version bump + +### 1.4.2 Jan 15 2015 + + - Feature: Support io.js 0dbc5e8 + +### 1.5.0 Jan 14 2015 + + - Feature: Support io.js b003843 + - Correctness: Improved NanNew internals 9cd4f6a + - Feature: Implement progress to NanAsyncWorker 8d6a160 + +### 1.4.1 Nov 8 2014 + + - Bugfix: Handle DEBUG definition correctly + - Bugfix: Accept int as Boolean + +### 1.4.0 Nov 1 2014 + + - Feature: Added NAN_GC_CALLBACK 6a5c245 + - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 + - Correctness: Added constness to references in NanHasInstance 02c61cd + - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 + - Windoze: Shut Visual Studio up when compiling 8d558c1 + - License: Switch to plain MIT from custom hacked MIT license 11de983 + - Build: Added test target to Makefile e232e46 + - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 + - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 + - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 + +### 1.3.0 Aug 2 2014 + + - Added NanNew(std::string) + - Added NanNew(std::string&) + - Added NanAsciiString helper class + - Added NanUtf8String helper class + - Added NanUcs2String helper class + - Deprecated NanRawString() + - Deprecated NanCString() + - Added NanGetIsolateData(v8::Isolate *isolate) + - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) + - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) + - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + +### 1.2.0 Jun 5 2014 + + - Add NanSetPrototypeTemplate + - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, + introduced _NanWeakCallbackDispatcher + - Removed -Wno-unused-local-typedefs from test builds + - Made test builds Windows compatible ('Sleep()') + +### 1.1.2 May 28 2014 + + - Release to fix more stuff-ups in 1.1.1 + +### 1.1.1 May 28 2014 + + - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 + +### 1.1.0 May 25 2014 + + - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead + - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), + (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, + v8::String::ExternalAsciiStringResource* + - Deprecate NanSymbol() + - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker + +### 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(v8::Handle value) for use in place of + v8::Local::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 ` 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) to NanThrowError(Handle) + - 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::Handle) + - 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 argument + - Added `NanNewBufferHandle` with single uint32_t argument + - Added `NanHasInstance(Persistent&, Handle)` + - Added `Local NanCallback#GetFunction()` + - Added `NanCallback#Call(int, Local[])` + - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/LICENSE.md b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/LICENSE.md new file mode 100644 index 00000000..95c2eb5f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/LICENSE.md @@ -0,0 +1,13 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2015 NAN contributors +----------------------------------- + +*NAN contributors listed at * + +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/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/appveyor.yml b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/appveyor.yml new file mode 100644 index 00000000..17771078 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/appveyor.yml @@ -0,0 +1,37 @@ +# http://www.appveyor.com/docs/appveyor-yml + +# Test against these versions of Io.js and Node.js. +environment: + matrix: + # node.js + - nodejs_version: "0.8" + - nodejs_version: "0.10" + - nodejs_version: "0.11" + # io.js + - nodejs_version: "1" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node 0.STABLE.latest + - ps: if($env:nodejs_version -eq "0.8") {Install-Product node $env:nodejs_version} + - ps: if($env:nodejs_version -ne "0.8") {Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)} + - IF NOT %nodejs_version% == 1 npm -g install npm + - IF NOT %nodejs_version% == 1 set PATH=%APPDATA%\npm;%PATH% + # Typical npm stuff. + - npm install + - IF %nodejs_version% == 0.8 node node_modules\node-gyp\bin\node-gyp.js rebuild --directory test + - IF NOT %nodejs_version% == 0.8 npm run rebuild-tests + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm test + +# Don't actually build. +build: off + +# Set build version format here instead of in the admin panel. +version: "{build}" diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/include_dirs.js b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/include_dirs.js new file mode 100644 index 00000000..4f1dfb41 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/include_dirs.js @@ -0,0 +1 @@ +console.log(require('path').relative('.', __dirname)); diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan.h b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan.h new file mode 100644 index 00000000..e95a3b3e --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan.h @@ -0,0 +1,2174 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors: + * - Rod Vagg + * - Benjamin Byholm + * - Trevor Norris + * - Nathan Rajlich + * - Brett Lawson + * - Ben Noordhuis + * - David Siegel + * + * MIT License + * + * Version 1.6.2: current Node unstable: 0.11.16, Node stable: 0.10.36, io.js: 1.1.0 + * + * See https://github.com/rvagg/nan for the latest update to this file + **********************************************************************************/ + +#ifndef NAN_H_ +#define NAN_H_ + +#include +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +#if defined(__GNUC__) && !(defined(DEBUG) && DEBUG) +# define NAN_INLINE inline __attribute__((always_inline)) +#elif defined(_MSC_VER) && !(defined(DEBUG) && DEBUG) +# define NAN_INLINE __forceinline +#else +# define NAN_INLINE inline +#endif + +#if defined(__GNUC__) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __declspec(deprecated) +#else +# define NAN_DEPRECATED +#endif + +#if (NODE_MODULE_VERSION < 12) +typedef v8::InvocationCallback NanFunctionCallback; +typedef v8::Script NanUnboundScript; +typedef v8::Script NanBoundScript; +#else +typedef v8::FunctionCallback NanFunctionCallback; +typedef v8::UnboundScript NanUnboundScript; +typedef v8::Script NanBoundScript; +#endif + +#if (NODE_MODULE_VERSION < 42) +typedef v8::String::ExternalAsciiStringResource + NanExternalOneByteStringResource; +#else // io.js v1.0.0 +typedef v8::String::ExternalOneByteStringResource + NanExternalOneByteStringResource; +#endif + +#include "nan_new.h" // NOLINT(build/include) + +// uv helpers +#ifdef UV_VERSION_MAJOR +#ifndef UV_VERSION_PATCH +#define UV_VERSION_PATCH 0 +#endif +#define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \ + (UV_VERSION_MINOR << 8) | \ + (UV_VERSION_PATCH)) +#else +#define NAUV_UVVERSION 0x000b00 +#endif + + +#if NAUV_UVVERSION < 0x000b17 +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async, int) +#else +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async) +#endif + +// some generic helpers + +template NAN_INLINE bool NanSetPointerSafe( + T *var + , T val +) { + if (var) { + *var = val; + return true; + } else { + return false; + } +} + +template NAN_INLINE T NanGetPointerSafe( + T *var + , T fallback = reinterpret_cast(0) +) { + if (var) { + return *var; + } else { + return fallback; + } +} + +NAN_INLINE bool NanBooleanOptionValue( + v8::Local optionsObj + , v8::Handle 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 optionsObj + , v8::Handle opt +) { + return NanBooleanOptionValue(optionsObj, opt, false); +} + +NAN_INLINE uint32_t NanUInt32OptionValue( + v8::Local optionsObj + , v8::Handle opt + , uint32_t def +) { + return !optionsObj.IsEmpty() + && optionsObj->Has(opt) + && optionsObj->Get(opt)->IsNumber() + ? optionsObj->Get(opt)->Uint32Value() + : def; +} + +template +v8::Local NanNew(v8::Handle); + +template +NAN_INLINE v8::Local _NanEnsureLocal(v8::Handle val) { + return NanNew(val); +} + +template +NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { + return val; +} + +/* io.js 1.0 */ +#if NODE_MODULE_VERSION >= 42 || NODE_VERSION_AT_LEAST(0, 11, 15) + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::Isolate::GetCurrent()->SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::Isolate::GetCurrent()->LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::Isolate::GetCurrent()->ContextDisposedNotification(); + } +#else + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::V8::SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::V8::SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::V8::SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::V8::IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::V8::LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::V8::ContextDisposedNotification(); + } +#endif + +#if (NODE_MODULE_VERSION > 0x000B) +// Node 0.11+ (0.11.12 and below won't compile with these) + +# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo& +# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args +# define _NAN_METHOD_RETURN_TYPE void + +# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +# define _NAN_GETTER_RETURN_TYPE void + +# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args +# define _NAN_SETTER_RETURN_TYPE void + +# define _NAN_PROPERTY_GETTER_ARGS_TYPE \ + const v8::PropertyCallbackInfo& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args +# define _NAN_INDEX_QUERY_RETURN_TYPE void + +# define NanScope() v8::HandleScope scope(v8::Isolate::GetCurrent()) +# define NanEscapableScope() \ + v8::EscapableHandleScope scope(v8::Isolate::GetCurrent()) + +# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) +# define NanLocker() v8::Locker locker(v8::Isolate::GetCurrent()) +# define NanUnlocker() v8::Unlocker unlocker(v8::Isolate::GetCurrent()) +# define NanReturnValue(value) return args.GetReturnValue().Set(value) +# define NanReturnUndefined() return +# define NanReturnHolder() NanReturnValue(args.Holder()) +# define NanReturnThis() NanReturnValue(args.This()) +# define NanReturnNull() return args.GetReturnValue().SetNull() +# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString() + +# define NanObjectWrapHandle(obj) obj->handle() + + NAN_INLINE v8::Local NanUndefined() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanNull() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanTrue() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanFalse() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE int NanAdjustExternalMemory(int bc) { + return static_cast( + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , const char *name + , v8::Handle value) { + templ->Set(v8::Isolate::GetCurrent(), name, value); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + NAN_INLINE v8::Local NanGetCurrentContext() { + return v8::Isolate::GetCurrent()->GetCurrentContext(); + } + + NAN_INLINE void* NanGetInternalFieldPointer( + v8::Handle object + , int index) { + return object->GetAlignedPointerFromInternalField(index); + } + + NAN_INLINE void NanSetInternalFieldPointer( + v8::Handle object + , int index + , void* value) { + object->SetAlignedPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) + + NAN_INLINE void NanAddGCEpilogueCallback( + v8::Isolate::GCEpilogueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); + } + + NAN_INLINE void NanRemoveGCEpilogueCallback( + v8::Isolate::GCEpilogueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); + } + + NAN_INLINE void NanAddGCPrologueCallback( + v8::Isolate::GCPrologueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); + } + + NAN_INLINE void NanRemoveGCPrologueCallback( + v8::Isolate::GCPrologueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); + } + + NAN_INLINE void NanGetHeapStatistics( + v8::HeapStatistics *heap_statistics) { + v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( + const char* data, int length = -1) { + return NanNew(data, length); + } + + template + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , v8::Handle obj) { + handle.Reset(v8::Isolate::GetCurrent(), obj); + } + + template + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , const v8::Persistent& obj) { + handle.Reset(v8::Isolate::GetCurrent(), obj); + } + + template + class _NanWeakCallbackData; + + template + struct _NanWeakCallbackInfo { + typedef void (*Callback)(const _NanWeakCallbackData& data); + NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) + : parameter(param), callback(cb) { + NanAssignPersistent(persistent, handle); + } + + NAN_INLINE ~_NanWeakCallbackInfo() { + persistent.Reset(); + } + + P* const parameter; + Callback const callback; + v8::Persistent persistent; + }; + + template + class _NanWeakCallbackData { + public: + NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) + : info_(info) { } + + NAN_INLINE v8::Local GetValue() const { + return NanNew(info_->persistent); + } + + NAN_INLINE P* GetParameter() const { return info_->parameter; } + + NAN_INLINE bool IsNearDeath() const { + return info_->persistent.IsNearDeath(); + } + + NAN_INLINE void Revive() const; + + NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { + return info_; + } + + NAN_DEPRECATED NAN_INLINE void Dispose() const { + } + + private: + _NanWeakCallbackInfo* info_; + }; + + template + static void _NanWeakCallbackDispatcher( + const v8::WeakCallbackData > &data) { + _NanWeakCallbackInfo *info = data.GetParameter(); + _NanWeakCallbackData wcbd(info); + info->callback(wcbd); + if (wcbd.IsNearDeath()) { + delete wcbd.GetCallbackInfo(); + } + } + + template + NAN_INLINE void _NanWeakCallbackData::Revive() const { + info_->persistent.SetWeak(info_, &_NanWeakCallbackDispatcher); + } + +template +NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( + v8::Handle handle + , P* parameter + , typename _NanWeakCallbackInfo::Callback callback) { + _NanWeakCallbackInfo *cbinfo = + new _NanWeakCallbackInfo(handle, parameter, callback); + cbinfo->persistent.SetWeak(cbinfo, &_NanWeakCallbackDispatcher); + return cbinfo; +} + +# define NAN_WEAK_CALLBACK(name) \ + template \ + static void name(const _NanWeakCallbackData &data) + +# define _NAN_ERROR(fun, errmsg) fun(NanNew(errmsg)) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + v8::Isolate::GetCurrent()->ThrowException(_NAN_ERROR(fun, errmsg)); \ + } while (0); + + NAN_INLINE v8::Local 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 error) { + NanScope(); + v8::Isolate::GetCurrent()->ThrowException(error); + } + + NAN_INLINE v8::Local NanError( + const char *msg + , const int errorNumber + ) { + v8::Local err = v8::Exception::Error(NanNew(msg)); + v8::Local obj = err.As(); + obj->Set(NanNew("code"), NanNew(errorNumber)); + return err; + } + + NAN_INLINE void NanThrowError( + const char *msg + , const int errorNumber + ) { + NanThrowError(NanError(msg, errorNumber)); + } + + NAN_INLINE v8::Local 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 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 NAN_INLINE void NanDisposePersistent( + v8::Persistent &handle + ) { + handle.Reset(); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + char *data + , size_t length + , node::smalloc::FreeCallback callback + , void *hint + ) { + return node::Buffer::New( + v8::Isolate::GetCurrent(), data, length, callback, hint); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + const char *data + , uint32_t size + ) { + return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); + } + + NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { + return node::Buffer::New(v8::Isolate::GetCurrent(), size); + } + + NAN_INLINE v8::Local NanBufferUse( + char* data + , uint32_t size + ) { + return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); + } + + NAN_INLINE bool NanHasInstance( + const v8::Persistent& function_template + , v8::Handle value + ) { + return NanNew(function_template)->HasInstance(value); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle() + ) { + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + return v8::Local::New( + isolate + , v8::Context::New(isolate, extensions, tmpl, obj) + ); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + v8::ScriptCompiler::Source source(s, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + ) { + v8::ScriptCompiler::Source source(s); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + NAN_INLINE v8::Local NanRunScript( + v8::Handle script + ) { + return script->BindToCurrentContext()->Run(); + } + + NAN_INLINE v8::Local NanRunScript( + v8::Handle script + ) { + return script->Run(); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle func + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv)); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle symbol + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv)); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , const char* method + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv)); + } + + template + NAN_INLINE void NanSetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(0, data); + } + + template + NAN_INLINE T *NanGetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData(0)); + } + + class NanAsciiString { + public: + NAN_INLINE explicit NanAsciiString(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new char[size + 1]; + size = toStr->WriteOneByte(reinterpret_cast(buf)); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanAsciiString() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanAsciiString(const NanAsciiString&); + void operator=(const NanAsciiString&); + + char *buf; + int size; + }; + + class NanUtf8String { + public: + NAN_INLINE explicit NanUtf8String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Utf8Length(); + buf = new char[size + 1]; + toStr->WriteUtf8(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanUtf8String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUtf8String(const NanUtf8String&); + void operator=(const NanUtf8String&); + + char *buf; + int size; + }; + + class NanUcs2String { + public: + NAN_INLINE explicit NanUcs2String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new uint16_t[size + 1]; + toStr->Write(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE uint16_t* operator*() { return buf; } + NAN_INLINE const uint16_t* operator*() const { return buf; } + + NAN_INLINE ~NanUcs2String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUcs2String(const NanUcs2String&); + void operator=(const NanUcs2String&); + + uint16_t *buf; + int size; + }; + +#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 + +# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo & +# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +# define _NAN_GETTER_RETURN_TYPE v8::Handle + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + + NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( + const char* data, int length = -1) { + return v8::String::NewSymbol(data, length); + } + +# 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 NanReturnHolder() NanReturnValue(args.Holder()) +# define NanReturnThis() NanReturnValue(args.This()) +# define NanReturnUndefined() return v8::Undefined() +# define NanReturnNull() return v8::Null() +# define NanReturnEmptyString() return v8::String::Empty() +# define NanObjectWrapHandle(obj) v8::Local::New(obj->handle_) + + NAN_INLINE v8::Local NanUndefined() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Undefined())); + } + + NAN_INLINE v8::Local NanNull() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Null())); + } + + NAN_INLINE v8::Local NanTrue() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::True())); + } + + NAN_INLINE v8::Local NanFalse() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::False())); + } + + NAN_INLINE int NanAdjustExternalMemory(int bc) { + return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , const char *name + , v8::Handle value) { + templ->Set(name, value); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + NAN_INLINE v8::Local NanGetCurrentContext() { + return v8::Context::GetCurrent(); + } + + NAN_INLINE void* NanGetInternalFieldPointer( + v8::Handle object + , int index) { + return object->GetPointerFromInternalField(index); + } + + NAN_INLINE void NanSetInternalFieldPointer( + v8::Handle object + , int index + , void* value) { + object->SetPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::GCType type, v8::GCCallbackFlags flags) + + 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 + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , v8::Handle obj) { + handle.Dispose(); + handle = v8::Persistent::New(obj); + } + + template + class _NanWeakCallbackData; + + template + struct _NanWeakCallbackInfo { + typedef void (*Callback)(const _NanWeakCallbackData &data); + NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) + : parameter(param) + , callback(cb) + , persistent(v8::Persistent::New(handle)) { } + + NAN_INLINE ~_NanWeakCallbackInfo() { + persistent.Dispose(); + persistent.Clear(); + } + + P* const parameter; + Callback const callback; + v8::Persistent persistent; + }; + + template + class _NanWeakCallbackData { + public: + NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) + : info_(info) { } + + NAN_INLINE v8::Local GetValue() const { + return NanNew(info_->persistent); + } + + NAN_INLINE P* GetParameter() const { return info_->parameter; } + + NAN_INLINE bool IsNearDeath() const { + return info_->persistent.IsNearDeath(); + } + + NAN_INLINE void Revive() const; + + NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { + return info_; + } + + NAN_DEPRECATED NAN_INLINE void Dispose() const { + } + + private: + _NanWeakCallbackInfo* info_; + }; + + template + static void _NanWeakPersistentDispatcher( + v8::Persistent object, void *data) { + _NanWeakCallbackInfo* info = + static_cast<_NanWeakCallbackInfo*>(data); + _NanWeakCallbackData wcbd(info); + info->callback(wcbd); + if (wcbd.IsNearDeath()) { + delete wcbd.GetCallbackInfo(); + } + } + + template + NAN_INLINE void _NanWeakCallbackData::Revive() const { + info_->persistent.MakeWeak( + info_ + , &_NanWeakPersistentDispatcher); + } + + template + NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( + v8::Handle handle + , P* parameter + , typename _NanWeakCallbackInfo::Callback callback) { + _NanWeakCallbackInfo *cbinfo = + new _NanWeakCallbackInfo(handle, parameter, callback); + cbinfo->persistent.MakeWeak( + cbinfo + , &_NanWeakPersistentDispatcher); + return cbinfo; + } + +# define NAN_WEAK_CALLBACK(name) \ + template \ + static void name(const _NanWeakCallbackData &data) + +# define _NAN_ERROR(fun, errmsg) \ + fun(v8::String::New(errmsg)) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + return v8::Local::New( \ + v8::ThrowException(_NAN_ERROR(fun, errmsg))); \ + } while (0); + + NAN_INLINE v8::Local NanError(const char* errmsg) { + return _NAN_ERROR(v8::Exception::Error, errmsg); + } + + NAN_INLINE v8::Local NanThrowError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::Error, errmsg); + } + + NAN_INLINE v8::Local NanThrowError( + v8::Handle error + ) { + NanScope(); + return v8::Local::New(v8::ThrowException(error)); + } + + NAN_INLINE v8::Local NanError( + const char *msg + , const int errorNumber + ) { + v8::Local err = v8::Exception::Error(v8::String::New(msg)); + v8::Local obj = err.As(); + obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber)); + return err; + } + + NAN_INLINE v8::Local NanThrowError( + const char *msg + , const int errorNumber + ) { + return NanThrowError(NanError(msg, errorNumber)); + } + + NAN_INLINE v8::Local NanTypeError(const char* errmsg) { + return _NAN_ERROR(v8::Exception::TypeError, errmsg); + } + + NAN_INLINE v8::Local NanThrowTypeError( + const char* errmsg + ) { + _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); + } + + NAN_INLINE v8::Local NanRangeError( + const char* errmsg + ) { + return _NAN_ERROR(v8::Exception::RangeError, errmsg); + } + + NAN_INLINE v8::Local NanThrowRangeError( + const char* errmsg + ) { + _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); + } + + template + NAN_INLINE void NanDisposePersistent( + v8::Persistent &handle) { // NOLINT(runtime/references) + handle.Dispose(); + handle.Clear(); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + char *data + , size_t length + , node::Buffer::free_callback callback + , void *hint + ) { + return NanNew( + node::Buffer::New(data, length, callback, hint)->handle_); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + const char *data + , uint32_t size + ) { +#if NODE_MODULE_VERSION >= 0x000B + return NanNew(node::Buffer::New(data, size)->handle_); +#else + return NanNew( + node::Buffer::New(const_cast(data), size)->handle_); +#endif + } + + NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { + return NanNew(node::Buffer::New(size)->handle_); + } + + NAN_INLINE void FreeData(char *data, void *hint) { + delete[] data; + } + + NAN_INLINE v8::Local NanBufferUse( + char* data + , uint32_t size + ) { + return NanNew( + node::Buffer::New(data, size, FreeData, NULL)->handle_); + } + + NAN_INLINE bool NanHasInstance( + const v8::Persistent& function_template + , v8::Handle value + ) { + return function_template->HasInstance(value); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle() + ) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = NanNew(ctx); + ctx.Dispose(); + return lctx; + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + return v8::Script::Compile(s, const_cast(&origin)); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + ) { + return v8::Script::Compile(s); + } + + NAN_INLINE v8::Local NanRunScript(v8::Handle script) { + return script->Run(); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle func + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, func, argc, argv)); +# else + v8::TryCatch try_catch; + v8::Local result = func->Call(target, argc, argv); + if (try_catch.HasCaught()) { + node::FatalException(try_catch); + } + return result; +# endif + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle symbol + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, symbol, argc, argv)); +# else + v8::Local callback = target->Get(symbol).As(); + return NanMakeCallback(target, callback, argc, argv); +# endif + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , const char* method + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, method, argc, argv)); +# else + return NanMakeCallback(target, NanNew(method), argc, argv); +# endif + } + + template + NAN_INLINE void NanSetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(data); + } + + template + NAN_INLINE T *NanGetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData()); + } + + class NanAsciiString { + public: + NAN_INLINE explicit NanAsciiString(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new char[size + 1]; + size = toStr->WriteAscii(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanAsciiString() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanAsciiString(const NanAsciiString&); + void operator=(const NanAsciiString&); + + char *buf; + int size; + }; + + class NanUtf8String { + public: + NAN_INLINE explicit NanUtf8String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Utf8Length(); + buf = new char[size + 1]; + toStr->WriteUtf8(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanUtf8String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUtf8String(const NanUtf8String&); + void operator=(const NanUtf8String&); + + char *buf; + int size; + }; + + class NanUcs2String { + public: + NAN_INLINE explicit NanUcs2String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new uint16_t[size + 1]; + toStr->Write(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE uint16_t* operator*() { return buf; } + NAN_INLINE const uint16_t* operator*() const { return buf; } + + NAN_INLINE ~NanUcs2String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUcs2String(const NanUcs2String&); + void operator=(const NanUcs2String&); + + uint16_t *buf; + int size; + }; + +#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 property \ + , _NAN_GETTER_ARGS) +#define NAN_SETTER(name) \ + _NAN_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local value \ + , _NAN_SETTER_ARGS) +#define NAN_PROPERTY_GETTER(name) \ + _NAN_PROPERTY_GETTER_RETURN_TYPE name( \ + v8::Local property \ + , _NAN_PROPERTY_GETTER_ARGS) +#define NAN_PROPERTY_SETTER(name) \ + _NAN_PROPERTY_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local 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 property \ + , _NAN_PROPERTY_DELETER_ARGS) +#define NAN_PROPERTY_QUERY(name) \ + _NAN_PROPERTY_QUERY_RETURN_TYPE name( \ + v8::Local 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 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 obj = NanNew(); + NanAssignPersistent(handle, obj); + } + + explicit NanCallback(const v8::Handle &fn) { + NanScope(); + v8::Local obj = NanNew(); + NanAssignPersistent(handle, obj); + SetFunction(fn); + } + + ~NanCallback() { + if (handle.IsEmpty()) return; + NanDisposePersistent(handle); + } + + NAN_INLINE void SetFunction(const v8::Handle &fn) { + NanScope(); + NanNew(handle)->Set(kCallbackIndex, fn); + } + + NAN_INLINE v8::Local GetFunction() const { + NanEscapableScope(); + return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex) + .As()); + } + + NAN_INLINE bool IsEmpty() const { + NanScope(); + return NanNew(handle)->Get(kCallbackIndex)->IsUndefined(); + } + + v8::Handle Call(int argc, v8::Handle argv[]) const { + NanEscapableScope(); +#if (NODE_MODULE_VERSION > 0x000B) // 0.11.12+ + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Local callback = NanNew(handle)-> + Get(kCallbackIndex).As(); + return NanEscapeScope(node::MakeCallback( + isolate + , isolate->GetCurrentContext()->Global() + , callback + , argc + , argv + )); +#else +#if NODE_VERSION_AT_LEAST(0, 8, 0) + v8::Local callback = handle-> + Get(kCallbackIndex).As(); + return NanEscapeScope(node::MakeCallback( + v8::Context::GetCurrent()->Global() + , callback + , argc + , argv + )); +#else + v8::Local callback = handle-> + Get(kCallbackIndex).As(); + return NanEscapeScope(NanMakeCallback( + v8::Context::GetCurrent()->Global(), callback, argc, argv)); +#endif +#endif + } + + private: + v8::Persistent handle; + static const uint32_t kCallbackIndex = 0; +}; + +/* abstract */ class NanAsyncWorker { + public: + explicit NanAsyncWorker(NanCallback *callback_) + : callback(callback_), errmsg_(NULL) { + request.data = this; + + NanScope(); + v8::Local obj = NanNew(); + 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, const v8::Local &obj) { + v8::Local handle = NanNew(persistentHandle); + handle->Set(NanNew(key), obj); + } + + v8::Local GetFromPersistent(const char *key) const { + NanEscapableScope(); + v8::Local handle = NanNew(persistentHandle); + return NanEscapeScope(handle->Get(NanNew(key)).As()); + } + + virtual void Execute() = 0; + + uv_work_t request; + + virtual void Destroy() { + delete this; + } + + protected: + v8::Persistent persistentHandle; + NanCallback *callback; + + virtual void HandleOKCallback() { + callback->Call(0, NULL); + } + + virtual void HandleErrorCallback() { + NanScope(); + + v8::Local argv[] = { + v8::Exception::Error(NanNew(ErrorMessage())) + }; + callback->Call(1, argv); + } + + void SetErrorMessage(const char *msg) { + if (errmsg_) { + delete[] errmsg_; + } + + size_t size = strlen(msg) + 1; + errmsg_ = new char[size]; + memcpy(errmsg_, msg, size); + } + + const char* ErrorMessage() const { + return errmsg_; + } + + private: + char *errmsg_; +}; + +/* abstract */ class NanAsyncProgressWorker : public NanAsyncWorker { + public: + explicit NanAsyncProgressWorker(NanCallback *callback_) + : NanAsyncWorker(callback_), asyncdata_(NULL), asyncsize_(0) { + async = new uv_async_t; + uv_async_init( + uv_default_loop() + , async + , AsyncProgress_ + ); + async->data = this; + + uv_mutex_init(&async_lock); + } + + virtual ~NanAsyncProgressWorker() { + uv_mutex_destroy(&async_lock); + + if (asyncdata_) { + delete[] asyncdata_; + } + } + + void WorkProgress() { + uv_mutex_lock(&async_lock); + char *data = asyncdata_; + size_t size = asyncsize_; + asyncdata_ = NULL; + uv_mutex_unlock(&async_lock); + + // Dont send progress events after we've already completed. + if (callback) { + HandleProgressCallback(data, size); + } + delete[] data; + } + + class ExecutionProgress { + friend class NanAsyncProgressWorker; + public: + // You could do fancy generics with templates here. + void Send(const char* data, size_t size) const { + that_->SendProgress_(data, size); + } + + private: + explicit ExecutionProgress(NanAsyncProgressWorker* that) : that_(that) {} + // Prohibit copying and assignment. + ExecutionProgress(const ExecutionProgress&); + void operator=(const ExecutionProgress&); + #if __cplusplus >= 201103L + // Prohibit C++11 move semantics. + ExecutionProgress(ExecutionProgress&&) = delete; + void operator=(ExecutionProgress&&) = delete; + #endif + NanAsyncProgressWorker* const that_; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void HandleProgressCallback(const char *data, size_t size) = 0; + + virtual void Destroy() { + uv_close(reinterpret_cast(async), AsyncClose_); + } + + private: + void Execute() /*final override*/ { + ExecutionProgress progress(this); + Execute(progress); + } + + void SendProgress_(const char *data, size_t size) { + char *new_data = new char[size]; + memcpy(new_data, data, size); + + uv_mutex_lock(&async_lock); + char *old_data = asyncdata_; + asyncdata_ = new_data; + asyncsize_ = size; + uv_mutex_unlock(&async_lock); + + if (old_data) { + delete[] old_data; + } + uv_async_send(async); + } + + NAN_INLINE static NAUV_WORK_CB(AsyncProgress_) { + NanAsyncProgressWorker *worker = + static_cast(async->data); + worker->WorkProgress(); + } + + NAN_INLINE static void AsyncClose_(uv_handle_t* handle) { + NanAsyncProgressWorker *worker = + static_cast(handle->data); + delete reinterpret_cast(handle); + delete worker; + } + + uv_async_t *async; + uv_mutex_t async_lock; + char *asyncdata_; + size_t asyncsize_; +}; + +NAN_INLINE void NanAsyncExecute (uv_work_t* req) { + NanAsyncWorker *worker = static_cast(req->data); + worker->Execute(); +} + +NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) { + NanAsyncWorker* worker = static_cast(req->data); + worker->WorkComplete(); + worker->Destroy(); +} + +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 +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 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 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(-1); +} + +template 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; +} + +namespace NanIntern { + +inline +NanExternalOneByteStringResource const* +GetExternalResource(v8::Local str) { +#if NODE_MODULE_VERSION < 42 + return str->GetExternalAsciiStringResource(); +#else // io.js v1.0.0 + return str->GetExternalOneByteStringResource(); +#endif +} + +inline +bool +IsExternal(v8::Local str) { +#if NODE_MODULE_VERSION < 42 + return str->IsExternalAscii(); +#else // io.js v1.0.0 + return str->IsExternalOneByte(); +#endif +} + +} // end of namespace NanIntern + +static bool _NanGetExternalParts( + v8::Handle val + , const char** data + , size_t* len +) { + if (node::Buffer::HasInstance(val)) { + *data = node::Buffer::Data(val.As()); + *len = node::Buffer::Length(val.As()); + return true; + } + + assert(val->IsString()); + v8::Local str = NanNew(val.As()); + + if (NanIntern::IsExternal(str)) { + const NanExternalOneByteStringResource* ext; + ext = NanIntern::GetExternalResource(str); + *data = ext->data(); + *len = ext->length(); + return true; + } + + if (str->IsExternal()) { + const v8::String::ExternalStringResource* ext; + ext = str->GetExternalStringResource(); + *data = reinterpret_cast(ext->data()); + *len = ext->length(); + return true; + } + + return false; +} + +namespace Nan { + enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; +} + +#if !NODE_VERSION_AT_LEAST(0, 10, 0) +# include "nan_string_bytes.h" // NOLINT(build/include) +#endif + +NAN_INLINE v8::Local NanEncode( + const void *buf, size_t len, enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION >= 42) + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + node::encoding node_enc = static_cast(encoding); + + if (encoding == Nan::UCS2) { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len / 2); + } else { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len + , node_enc); + } +#elif (NODE_MODULE_VERSION > 0x000B) + return node::Encode( + v8::Isolate::GetCurrent() + , buf, len + , static_cast(encoding)); +#else +# if NODE_VERSION_AT_LEAST(0, 10, 0) + return node::Encode(buf, len, static_cast(encoding)); +# else + return NanIntern::Encode(reinterpret_cast(buf), len, encoding); +# endif +#endif +} + +NAN_INLINE ssize_t NanDecodeBytes( + v8::Handle val, enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION > 0x000B) + return node::DecodeBytes( + v8::Isolate::GetCurrent() + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < 0x000B) + if (encoding == Nan::BUFFER) { + return node::DecodeBytes(val, node::BINARY); + } +# endif + return node::DecodeBytes(val, static_cast(encoding)); +#endif +} + +NAN_INLINE ssize_t NanDecodeWrite( + char *buf + , size_t len + , v8::Handle val + , enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION > 0x000B) + return node::DecodeWrite( + v8::Isolate::GetCurrent() + , buf + , len + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < 0x000B) + if (encoding == Nan::BUFFER) { + return node::DecodeWrite(buf, len, val, node::BINARY); + } +# endif + return node::DecodeWrite( + buf + , len + , val + , static_cast(encoding)); +#endif +} + +/* NAN_DEPRECATED */ NAN_INLINE void* _NanRawString( + v8::Handle 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(&data) + , &len); + + if (is_extern && !term_len) { + NanSetPointerSafe(datalen, len); + return data; + } + + v8::Local toStr = from->ToString(); + + char *to = static_cast(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( + datalen + , toStr->WriteAscii(to, 0, static_cast(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 somelen = toStr->Write(twobytebuf, 0, + static_cast(sz_ + term_len), flags); + + for (size_t i = 0; i < sz_ + term_len && i < somelen + term_len; i++) { + unsigned char *b = reinterpret_cast(&twobytebuf[i]); + to[i] = *b; + } + + NanSetPointerSafe(datalen, somelen); + + delete[] twobytebuf; + return to; + } +#else + NanSetPointerSafe( + datalen, + toStr->WriteOneByte( + reinterpret_cast(to) + , 0 + , static_cast(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( + datalen + , toStr->WriteUtf8(to, static_cast(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( + 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(to) + , 0 + , static_cast(sz_ + term_len) + , flags); + NanSetPointerSafe(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( + 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_DEPRECATED NAN_INLINE void* NanRawString( + v8::Handle from + , enum Nan::Encoding encoding + , size_t *datalen + , void *buf + , size_t buflen + , int flags +) { + return _NanRawString(from, encoding, datalen, buf, buflen, flags); +} + + +NAN_DEPRECATED NAN_INLINE char* NanCString( + v8::Handle from + , size_t *datalen + , char *buf = NULL + , size_t buflen = 0 + , int flags = v8::String::NO_OPTIONS +) { + return static_cast( + _NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags) + ); +} + +NAN_INLINE void NanSetPrototypeTemplate( + v8::Local templ + , const char *name + , v8::Handle value +) { + NanSetTemplate(templ->PrototypeTemplate(), name, value); +} + +NAN_INLINE void NanSetPrototypeTemplate( + v8::Local templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes +) { + NanSetTemplate(templ->PrototypeTemplate(), name, value, attributes); +} + +NAN_INLINE void NanSetInstanceTemplate( + v8::Local templ + , const char *name + , v8::Handle value +) { + NanSetTemplate(templ->InstanceTemplate(), name, value); +} + +NAN_INLINE void NanSetInstanceTemplate( + v8::Local templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes +) { + NanSetTemplate(templ->InstanceTemplate(), name, value, attributes); +} + +//=== Export ================================================================== + +inline +void +NanExport(v8::Handle target, const char * name, + NanFunctionCallback f) { + target->Set(NanNew(name), + NanNew(f)->GetFunction()); +} + +//=== Tap Reverse Binding ===================================================== + +struct NanTap { + explicit NanTap(v8::Handle t) : t_() { + NanAssignPersistent(t_, t->ToObject()); + } + + ~NanTap() { NanDisposePersistent(t_); } // not sure if neccessary + + inline void plan(int i) { + v8::Handle arg = NanNew(i); + NanMakeCallback(NanNew(t_), "plan", 1, &arg); + } + + inline void ok(bool isOk, const char * msg = NULL) { + v8::Handle args[2]; + args[0] = NanNew(isOk); + if (msg) args[1] = NanNew(msg); + NanMakeCallback(NanNew(t_), "ok", msg ? 2 : 1, args); + } + + private: + v8::Persistent t_; +}; + +#define NAN_STRINGIZE2(x) #x +#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) +#define NAN_TEST_EXPRESSION(expression) \ + ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression + +#define return_NanValue(v) NanReturnValue(v) +#define return_NanUndefined() NanReturnUndefined() +#define NAN_EXPORT(target, function) NanExport(target, #function, function) + +#endif // NAN_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_12_inl.h b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_12_inl.h new file mode 100644 index 00000000..ff63ec0c --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_12_inl.h @@ -0,0 +1,262 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_12_INL_H_ +#define NAN_IMPLEMENTATION_12_INL_H_ +//============================================================================== +// node v0.11 implementation +//============================================================================== + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +namespace NanIntern { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(v8::Isolate::GetCurrent(), length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(v8::Isolate::GetCurrent(), value); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Handle tmpl + , v8::Handle obj) { + return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj); +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(v8::Isolate::GetCurrent(), value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(v8::Isolate::GetCurrent(), value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data) { + return v8::Function::New( v8::Isolate::GetCurrent() + , callback + , data); +} + +//=== Function Template ======================================================== + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data + , v8::Handle signature) { + return v8::FunctionTemplate::New( v8::Isolate::GetCurrent() + , callback + , data + , signature); +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(v8::Isolate::GetCurrent(), value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New( v8::Isolate::GetCurrent() + , value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(v8::Isolate::GetCurrent(), value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(v8::Isolate::GetCurrent()); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(v8::Isolate::GetCurrent()); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Handle pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New( Factory::FTH receiver + , int argc + , Factory::FTH argv[]) { + return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), + value.data(), v8::String::kNormalString, static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint8_t * value, int length) { + return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +Factory::return_t +Factory::New(NanExternalOneByteStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Handle value) { + return v8::StringObject::New(value).As(); +} + +//=== Unbound Script =========================================================== + +Factory::return_t +Factory::New(v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +} // end of namespace NanIntern + +//=== Presistents and Handles ================================================== + +template +inline v8::Local NanNew(v8::Handle h) { + return v8::Local::New(v8::Isolate::GetCurrent(), h); +} + +template +inline v8::Local NanNew(v8::Persistent const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +#endif // NAN_IMPLEMENTATION_12_INL_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_pre_12_inl.h b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_pre_12_inl.h new file mode 100644 index 00000000..85dd2754 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_pre_12_inl.h @@ -0,0 +1,268 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_ +#define NAN_IMPLEMENTATION_PRE_12_INL_H_ + +#include + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# include +# pragma warning( default : 4530 ) +#else +# include +# include +#endif + +//============================================================================== +// node v0.10 implementation +//============================================================================== + +namespace NanIntern { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(value)->ToBoolean(); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Handle tmpl + , v8::Handle obj) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = v8::Local::New(ctx); + ctx.Dispose(); + return lctx; +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data) { + return Factory::New( callback + , data + , v8::Handle() + )->GetFunction(); +} + + +//=== FunctionTemplate ========================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data + , v8::Handle signature) { + // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find + // a way. Have at it though... + return v8::FunctionTemplate::New( callback + , data + , signature); +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New(value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Handle pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + return v8::Script::New(source); +} +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + return v8::Script::New(source, const_cast(&origin)); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New( Factory::FTH receiver + , int argc + , Factory::FTH argv[]) { + return v8::Signature::New(receiver, argc, argv); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::New( value.data(), static_cast(value.size())); +} + +inline +void +widenString(std::vector *ws, const uint8_t *s, int l = -1) { + size_t len = static_cast(l); + if (l < 0) { + len = strlen(reinterpret_cast(s)); + } + assert(len <= INT_MAX && "string too long"); + ws->resize(len); + std::copy(s, s + len, ws->begin()); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(const uint8_t * value, int length) { + std::vector wideString; + widenString(&wideString, value, length); + if (wideString.size() == 0) { + return v8::String::Empty(); + } else { + return v8::String::New(&wideString.front() + , static_cast(wideString.size())); + } +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(value); +} + +Factory::return_t +Factory::New(v8::String::ExternalAsciiStringResource * value) { + return v8::String::NewExternal(value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Handle value) { + return v8::StringObject::New(value).As(); +} + +} // end of namespace NanIntern + +//=== Presistents and Handles ================================================== + +template +inline v8::Local NanNew(v8::Handle h) { + return v8::Local::New(h); +} + +template +inline v8::Local NanNew(v8::Persistent const& p) { + return v8::Local::New(p); +} + +#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_new.h b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_new.h new file mode 100644 index 00000000..95b6b51e --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_new.h @@ -0,0 +1,329 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_NEW_H_ +#define NAN_NEW_H_ + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +namespace NanIntern { // scnr + +// TODO(agnat): Generalize +template v8::Local To(v8::Handle i); + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToInteger(); } + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToInt32(); } + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToUint32(); } + +template struct FactoryBase { typedef v8::Local return_t; }; + +template struct Factory; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(int length); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(void *value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( NanFunctionCallback callback + , v8::Handle data = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( NanFunctionCallback callback = NULL + , v8::Handle data = v8::Handle() + , v8::Handle signature = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template +struct IntegerFactory : FactoryBase { + typedef typename FactoryBase::return_t return_t; + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New( + v8::Handle pattern, v8::RegExp::Flags flags); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +template <> +struct Factory : FactoryBase { + typedef v8::Handle FTH; + static inline + return_t + New( FTH receiver = FTH(), int argc = 0, FTH argv[] = NULL ); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(const char *value, int length = -1); + static inline return_t New(const uint16_t *value, int length = -1); + static inline return_t New(std::string const& value); + + static inline return_t New(v8::String::ExternalStringResource * value); + static inline return_t New(NanExternalOneByteStringResource * value); + + // TODO(agnat): Deprecate. + static inline return_t New(const uint8_t * value, int length = -1); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(v8::Handle value); +}; + +} // end of namespace NanIntern + +#if (NODE_MODULE_VERSION >= 12) + +namespace NanIntern { + +template <> +struct Factory : FactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +} // end of namespace NanIntern + +# include "nan_implementation_12_inl.h" + +#else // NODE_MODULE_VERSION >= 12 + +# include "nan_implementation_pre_12_inl.h" + +#endif + +//=== API ====================================================================== + +template +typename NanIntern::Factory::return_t +NanNew() { + return NanIntern::Factory::New(); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0) { + return NanIntern::Factory::New(arg0); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1) { + return NanIntern::Factory::New(arg0, arg1); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1, A2 arg2) { + return NanIntern::Factory::New(arg0, arg1, arg2); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1, A2 arg2, A3 arg3) { + return NanIntern::Factory::New(arg0, arg1, arg2, arg3); +} + +// Note(agnat): When passing overloaded function pointers to template functions +// as generic arguments the compiler needs help in picking the right overload. +// These two functions handle NanNew and NanNew with +// all argument variations. + +// v8::Function and v8::FunctionTemplate with one or two arguments +template +typename NanIntern::Factory::return_t +NanNew( NanFunctionCallback callback + , v8::Handle data = v8::Handle()) { + return NanIntern::Factory::New(callback, data); +} + +// v8::Function and v8::FunctionTemplate with three arguments +template +typename NanIntern::Factory::return_t +NanNew( NanFunctionCallback callback + , v8::Handle data = v8::Handle() + , A2 a2 = A2()) { + return NanIntern::Factory::New(callback, data, a2); +} + +// Convenience + +template inline v8::Local NanNew(v8::Handle h); +template inline v8::Local NanNew(v8::Persistent const& p); + +inline +NanIntern::Factory::return_t +NanNew(bool value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(int32_t value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(uint32_t value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(double value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(std::string const& value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const char * value, int length) { + return NanNew(value, length); +} + +inline +NanIntern::Factory::return_t +NanNew(const char * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const uint8_t * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const uint16_t * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(v8::String::ExternalStringResource * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(NanExternalOneByteStringResource * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(v8::Handle pattern, v8::RegExp::Flags flags) { + return NanNew(pattern, flags); +} + +#endif // NAN_NEW_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_string_bytes.h b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_string_bytes.h new file mode 100644 index 00000000..9deecfbb --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_string_bytes.h @@ -0,0 +1,312 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +#ifndef NAN_STRING_BYTES_H_ +#define NAN_STRING_BYTES_H_ + +// Decodes a v8::Handle or Buffer to a raw char* + +#include +#include +#include +#include // memcpy +#include + +namespace NanIntern { + +using v8::Local; +using v8::Handle; +using v8::Object; +using v8::String; +using v8::Value; + + +//// Base 64 //// + +#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) + + + +//// Nan::HEX //// + +static bool contains_non_ascii_slow(const char* buf, size_t len) { + for (size_t i = 0; i < len; ++i) { + if (buf[i] & 0x80) return true; + } + return false; +} + + +static bool contains_non_ascii(const char* src, size_t len) { + if (len < 16) { + return contains_non_ascii_slow(src, len); + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned unaligned = reinterpret_cast(src) & align_mask; + + if (unaligned > 0) { + const unsigned n = bytes_per_word - unaligned; + if (contains_non_ascii_slow(src, n)) return true; + src += n; + len -= n; + } + + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = 0x8080808080808080ll; +#else + const uintptr_t mask = 0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + if (srcw[i] & mask) return true; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + if (contains_non_ascii_slow(src + offset, remainder)) return true; + } + + return false; +} + + +static void force_ascii_slow(const char* src, char* dst, size_t len) { + for (size_t i = 0; i < len; ++i) { + dst[i] = src[i] & 0x7f; + } +} + + +static void force_ascii(const char* src, char* dst, size_t len) { + if (len < 16) { + force_ascii_slow(src, dst, len); + return; + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned src_unalign = reinterpret_cast(src) & align_mask; + const unsigned dst_unalign = reinterpret_cast(dst) & align_mask; + + if (src_unalign > 0) { + if (src_unalign == dst_unalign) { + const unsigned unalign = bytes_per_word - src_unalign; + force_ascii_slow(src, dst, unalign); + src += unalign; + dst += unalign; + len -= src_unalign; + } else { + force_ascii_slow(src, dst, len); + return; + } + } + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = ~0x8080808080808080ll; +#else + const uintptr_t mask = ~0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + uintptr_t* dstw = reinterpret_cast(dst); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + dstw[i] = srcw[i] & mask; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + force_ascii_slow(src + offset, dst + offset, remainder); + } +} + + +static size_t base64_encode(const char* src, + size_t slen, + char* dst, + size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= base64_encoded_size(slen) && + "not enough space provided for base64 encode"); + + dlen = base64_encoded_size(slen); + + unsigned a; + unsigned b; + unsigned c; + unsigned i; + unsigned k; + unsigned n; + + static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + + i = 0; + k = 0; + n = slen / 3 * 3; + + while (i < n) { + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + c = src[i + 2] & 0xff; + + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; + dst[k + 3] = table[c & 0x3f]; + + i += 3; + k += 4; + } + + if (n != slen) { + switch (slen - n) { + case 1: + a = src[i + 0] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[(a & 3) << 4]; + dst[k + 2] = '='; + dst[k + 3] = '='; + break; + + case 2: + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[(b & 0x0f) << 2]; + dst[k + 3] = '='; + break; + } + } + + return dlen; +} + + +static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= slen * 2 && + "not enough space provided for hex encode"); + + dlen = slen * 2; + for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { + static const char hex[] = "0123456789abcdef"; + uint8_t val = static_cast(src[i]); + dst[k + 0] = hex[val >> 4]; + dst[k + 1] = hex[val & 15]; + } + + return dlen; +} + + + +static Local Encode(const char* buf, + size_t buflen, + enum Nan::Encoding encoding) { + assert(buflen <= node::Buffer::kMaxLength); + if (!buflen && encoding != Nan::BUFFER) + return NanNew(""); + + Local val; + switch (encoding) { + case Nan::BUFFER: + return NanNewBufferHandle(buf, buflen); + + case Nan::ASCII: + if (contains_non_ascii(buf, buflen)) { + char* out = new char[buflen]; + force_ascii(buf, out, buflen); + val = NanNew(out, buflen); + delete[] out; + } else { + val = NanNew(buf, buflen); + } + break; + + case Nan::UTF8: + val = NanNew(buf, buflen); + break; + + case Nan::BINARY: { + // TODO(isaacs) use ExternalTwoByteString? + const unsigned char *cbuf = reinterpret_cast(buf); + uint16_t * twobytebuf = new uint16_t[buflen]; + for (size_t i = 0; i < buflen; i++) { + // XXX is the following line platform independent? + twobytebuf[i] = cbuf[i]; + } + val = NanNew(twobytebuf, buflen); + delete[] twobytebuf; + break; + } + + case Nan::BASE64: { + size_t dlen = base64_encoded_size(buflen); + char* dst = new char[dlen]; + + size_t written = base64_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = NanNew(dst, dlen); + delete[] dst; + break; + } + + case Nan::UCS2: { + const uint16_t* data = reinterpret_cast(buf); + val = NanNew(data, buflen / 2); + break; + } + + case Nan::HEX: { + size_t dlen = buflen * 2; + char* dst = new char[dlen]; + size_t written = hex_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = NanNew(dst, dlen); + delete[] dst; + break; + } + + default: + assert(0 && "unknown encoding"); + break; + } + + return val; +} + +#undef base64_encoded_size + +} // namespace NanIntern + +#endif // NAN_STRING_BYTES_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/package.json b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/package.json new file mode 100644 index 00000000..02953f62 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/node_modules/nan/package.json @@ -0,0 +1,89 @@ +{ + "name": "nan", + "version": "1.6.2", + "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" + }, + "scripts": { + "test": "tap --gc test/js/*-test.js", + "rebuild-tests": "pangyp rebuild --directory test" + }, + "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" + }, + { + "name": "David Siegel", + "email": "david@artcom.de", + "url": "https://github.com/agnat" + } + ], + "devDependencies": { + "bindings": "~1.2.1", + "node-gyp": "~1.0.2", + "pangyp": "~2.0.1", + "tap": "~0.5.0", + "xtend": "~4.0.0" + }, + "license": "MIT", + "gitHead": "ab0e5eed8d4aa36111bf8f44cf75644ece327e98", + "bugs": { + "url": "https://github.com/rvagg/nan/issues" + }, + "homepage": "https://github.com/rvagg/nan", + "_id": "nan@1.6.2", + "_shasum": "2657d1c43b00f1e847e083832285b7d8f5ba8ec8", + "_from": "nan@>=1.6.0 <1.7.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + }, + "maintainers": [ + { + "name": "rvagg", + "email": "rod@vagg.org" + }, + { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + } + ], + "dist": { + "shasum": "2657d1c43b00f1e847e083832285b7d8f5ba8ec8", + "tarball": "http://registry.npmjs.org/nan/-/nan-1.6.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/nan/-/nan-1.6.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/package.json b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/package.json new file mode 100644 index 00000000..c958cf62 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/package.json @@ -0,0 +1,55 @@ +{ + "name": "bufferutil", + "version": "1.0.1", + "description": "WebSocket buffer utils", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "install": "node-gyp rebuild" + }, + "repository": { + "type": "git", + "url": "https://github.com/websockets/bufferutil" + }, + "keywords": [ + "bufferutil" + ], + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/websockets/bufferutil/issues" + }, + "homepage": "https://github.com/websockets/bufferutil", + "dependencies": { + "bindings": "1.2.x", + "nan": "1.6.x" + }, + "gypfile": true, + "gitHead": "3bbb6f23193fae7683b61e2cae1f85ede5fb4469", + "_id": "bufferutil@1.0.1", + "_shasum": "0c53a9ffe8d616c4e2df27d00b808f7a25501e3b", + "_from": "bufferutil@>=1.0.0 <1.1.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + }, + "maintainers": [ + { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + } + ], + "dist": { + "shasum": "0c53a9ffe8d616c4e2df27d00b808f7a25501e3b", + "tarball": "http://registry.npmjs.org/bufferutil/-/bufferutil-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/src/bufferutil.cc b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/src/bufferutil.cc new file mode 100644 index 00000000..bd6f368f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/bufferutil/src/bufferutil.cc @@ -0,0 +1,121 @@ +/*! + * bufferutil: WebSocket buffer utils + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nan.h" + +using namespace v8; +using namespace node; + +class BufferUtil : public ObjectWrap +{ +public: + + static void Initialize(v8::Handle target) + { + NanScope(); + Local t = NanNew(New); + t->InstanceTemplate()->SetInternalFieldCount(1); + NODE_SET_METHOD(t, "unmask", BufferUtil::Unmask); + NODE_SET_METHOD(t, "mask", BufferUtil::Mask); + NODE_SET_METHOD(t, "merge", BufferUtil::Merge); + target->Set(NanNew("BufferUtil"), t->GetFunction()); + } + +protected: + + static NAN_METHOD(New) + { + NanScope(); + BufferUtil* bufferUtil = new BufferUtil(); + bufferUtil->Wrap(args.This()); + NanReturnValue(args.This()); + } + + static NAN_METHOD(Merge) + { + NanScope(); + Local bufferObj = args[0]->ToObject(); + char* buffer = Buffer::Data(bufferObj); + Local array = Local::Cast(args[1]); + unsigned int arrayLength = array->Length(); + size_t offset = 0; + unsigned int i; + for (i = 0; i < arrayLength; ++i) { + Local src = array->Get(i)->ToObject(); + size_t length = Buffer::Length(src); + memcpy(buffer + offset, Buffer::Data(src), length); + offset += length; + } + NanReturnValue(NanTrue()); + } + + static NAN_METHOD(Unmask) + { + NanScope(); + Local buffer_obj = args[0]->ToObject(); + size_t length = Buffer::Length(buffer_obj); + Local mask_obj = args[1]->ToObject(); + unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); + unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); + size_t len32 = length / 4; + unsigned int i; + for (i = 0; i < len32; ++i) *(from + i) ^= *mask; + from += i; + switch (length % 4) { + case 3: *((unsigned char*)from+2) = *((unsigned char*)from+2) ^ ((unsigned char*)mask)[2]; + case 2: *((unsigned char*)from+1) = *((unsigned char*)from+1) ^ ((unsigned char*)mask)[1]; + case 1: *((unsigned char*)from ) = *((unsigned char*)from ) ^ ((unsigned char*)mask)[0]; + case 0:; + } + NanReturnValue(NanTrue()); + } + + static NAN_METHOD(Mask) + { + NanScope(); + Local buffer_obj = args[0]->ToObject(); + Local mask_obj = args[1]->ToObject(); + unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); + Local output_obj = args[2]->ToObject(); + unsigned int dataOffset = args[3]->Int32Value(); + unsigned int length = args[4]->Int32Value(); + unsigned int* to = (unsigned int*)(Buffer::Data(output_obj) + dataOffset); + unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); + unsigned int len32 = length / 4; + unsigned int i; + for (i = 0; i < len32; ++i) *(to + i) = *(from + i) ^ *mask; + to += i; + from += i; + switch (length % 4) { + case 3: *((unsigned char*)to+2) = *((unsigned char*)from+2) ^ *((unsigned char*)mask+2); + case 2: *((unsigned char*)to+1) = *((unsigned char*)from+1) ^ *((unsigned char*)mask+1); + case 1: *((unsigned char*)to ) = *((unsigned char*)from ) ^ *((unsigned char*)mask); + case 0:; + } + NanReturnValue(NanTrue()); + } +}; + +#if !NODE_VERSION_AT_LEAST(0,10,0) +extern "C" +#endif +void init (Handle target) +{ + NanScope(); + BufferUtil::Initialize(target); +} + +NODE_MODULE(bufferutil, init) + diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/options/.npmignore b/node_modules/simple-websocket/node_modules/ws/node_modules/options/.npmignore new file mode 100644 index 00000000..1b18fb39 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/options/.npmignore @@ -0,0 +1,7 @@ +npm-debug.log +node_modules +.*.swp +.lock-* +build/ + +test diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/options/Makefile b/node_modules/simple-websocket/node_modules/ws/node_modules/options/Makefile new file mode 100644 index 00000000..7496b6fc --- /dev/null +++ b/node_modules/simple-websocket/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/node_modules/simple-websocket/node_modules/ws/node_modules/options/README.md b/node_modules/simple-websocket/node_modules/ws/node_modules/options/README.md new file mode 100644 index 00000000..0dabc755 --- /dev/null +++ b/node_modules/simple-websocket/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 <einaros@gmail.com> + +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/node_modules/simple-websocket/node_modules/ws/node_modules/options/lib/options.js b/node_modules/simple-websocket/node_modules/ws/node_modules/options/lib/options.js new file mode 100644 index 00000000..4fc45e90 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/options/lib/options.js @@ -0,0 +1,86 @@ +/*! + * Copyright(c) 2011 Einar Otto Stangvik + * 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/node_modules/simple-websocket/node_modules/ws/node_modules/options/package.json b/node_modules/simple-websocket/node_modules/ws/node_modules/options/package.json new file mode 100644 index 00000000..7a62d8e3 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/options/package.json @@ -0,0 +1,51 @@ +{ + "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", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/.npmignore b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/.npmignore new file mode 100644 index 00000000..66210a2a --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/.npmignore @@ -0,0 +1,3 @@ +node_modules +coverage +.tern-port diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/.travis.yml b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/.travis.yml new file mode 100644 index 00000000..a6e97419 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/.travis.yml @@ -0,0 +1,17 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.11" +before_install: + - "npm install -g npm@1.4.x" +script: + - "npm run test-travis" +after_script: + - "npm install coveralls@2.11.x && cat coverage/lcov.info | coveralls" +notifications: + irc: + channels: + - "irc.freenode.org#unshift" + on_success: change + on_failure: change diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/README.md b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/README.md new file mode 100644 index 00000000..84fa3f23 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/README.md @@ -0,0 +1,97 @@ +# Ultron + +[![Made by unshift](https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square)](http://unshift.io)[![Version npm](http://img.shields.io/npm/v/ultron.svg?style=flat-square)](http://browsenpm.org/package/ultron)[![Build Status](http://img.shields.io/travis/unshiftio/ultron/master.svg?style=flat-square)](https://travis-ci.org/unshiftio/ultron)[![Dependencies](https://img.shields.io/david/unshiftio/ultron.svg?style=flat-square)](https://david-dm.org/unshiftio/ultron)[![Coverage Status](http://img.shields.io/coveralls/unshiftio/ultron/master.svg?style=flat-square)](https://coveralls.io/r/unshiftio/ultron?branch=master)[![IRC channel](http://img.shields.io/badge/IRC-irc.freenode.net%23unshift-00a8ff.svg?style=flat-square)](http://webchat.freenode.net/?channels=unshift) + +Ultron is a high-intelligence robot. It gathers intelligence so it can start +improving upon his rudimentary design. It will learn your event emitting +patterns and find ways to exterminate them. Allowing you to remove only the +event emitters that **you** assigned and not the ones that your users or +developers assigned. This can prevent race conditions, memory leaks and even file +descriptor leaks from ever happening as you won't remove clean up processes. + +## Installation + +The module is designed to be used in browsers using browserify and in Node.js. +You can install the module through the public npm registry by running the +following command in CLI: + +``` +npm install --save ultron +``` + +## Usage + +In all examples we assume that you've required the library as following: + +```js +'use strict'; + +var Ultron = require('ultron'); +``` + +Now that we've required the library we can construct our first `Ultron` instance. +The constructor requires one argument which should be the `EventEmitter` +instance that we need to operate upon. This can be the `EventEmitter` module +that ships with Node.js or `EventEmitter3` or anything else as long as it +follow the same API and internal structure as these 2. So with that in mind we +can create the instance: + +```js +// +// For the sake of this example we're going to construct an empty EventEmitter +// +var EventEmitter = require('events').EventEmitter; // or require('eventmitter3'); +var events = new EventEmitter(); + +var ultron = new Ultron(events); +``` + +You can now use the following API's from the Ultron instance: + +### Ultron.on + +Register a new event listener for the given event. It follows the exact same API +as `EventEmitter.on` but it will return itself instead of returning the +EventEmitter instance. If you are using EventEmitter3 it also supports the +context param: + +```js +ultron.on('event-name', handler, { custom: 'function context' }); +``` + +### Ultron.once + +Exactly the same as the [Ultron.on](#ultronon) but it only allows the execution +once. + +### Ultron.remove + +This is where all the magic happens and the safe removal starts. This function +accepts different argument styles: + +- No arguments, assume that all events need to be removed so it will work as + `removeAllListeners()` API. +- 1 argument, when it's a string it will be split on ` ` and `,` to create a + list of events that need to be cleared. +- Multiple arguments, we assume that they are all names of events that need to + be cleared. + +```js +ultron.remove('foo, bar baz'); // Removes foo, bar and baz. +ultron.remove('foo', 'bar', 'baz'); // Removes foo, bar and baz. +ultron.remove(); // Removes everything. +``` + +If you just want to remove a single event listener using a function reference +you can still use the EventEmitter's `removeListener(event, fn)` API: + +```js +function foo() {} + +ulton.on('foo', foo); +events.removeListener('foo', foo); +``` + +## License + +MIT diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/index.js b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/index.js new file mode 100644 index 00000000..f0e8113e --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/index.js @@ -0,0 +1,125 @@ +'use strict'; + +/** + * An auto incrementing id which we can use to create "unique" Ultron instances + * so we can track the event emitters that are added through the Ultron + * interface. + * + * @type {Number} + * @private + */ +var id = 0; + +/** + * Ultron is high-intelligence robot. It gathers intelligence so it can start improving + * upon his rudimentary design. It will learn from your EventEmitting patterns + * and exterminate them. + * + * @constructor + * @param {EventEmitter} ee EventEmitter instance we need to wrap. + * @api public + */ +function Ultron(ee) { + if (!(this instanceof Ultron)) return new Ultron(ee); + + this.id = id++; + this.ee = ee; +} + +/** + * Register a new EventListener for the given event. + * + * @param {String} event Name of the event. + * @param {Functon} fn Callback function. + * @param {Mixed} context The context of the function. + * @returns {Ultron} + * @api public + */ +Ultron.prototype.on = function on(event, fn, context) { + fn.__ultron = this.id; + this.ee.on(event, fn, context); + + return this; +}; +/** + * Add an EventListener that's only called once. + * + * @param {String} event Name of the event. + * @param {Function} fn Callback function. + * @param {Mixed} context The context of the function. + * @returns {Ultron} + * @api public + */ +Ultron.prototype.once = function once(event, fn, context) { + fn.__ultron = this.id; + this.ee.once(event, fn, context); + + return this; +}; + +/** + * Remove the listeners we assigned for the given event. + * + * @returns {Ultron} + * @api public + */ +Ultron.prototype.remove = function remove() { + var args = arguments + , event; + + // + // When no event names are provided we assume that we need to clear all the + // events that were assigned through us. + // + if (args.length === 1 && 'string' === typeof args[0]) { + args = args[0].split(/[, ]+/); + } else if (!args.length) { + args = []; + + for (event in this.ee._events) { + if (this.ee._events.hasOwnProperty(event)) { + args.push(event); + } + } + } + + for (var i = 0; i < args.length; i++) { + var listeners = this.ee.listeners(args[i]); + + for (var j = 0; j < listeners.length; j++) { + event = listeners[j]; + + if (event.listener) { + if (event.listener.__ultron !== this.id) continue; + delete event.listener.__ultron; + } else { + if (event.__ultron !== this.id) continue; + delete event.__ultron; + } + + this.ee.removeListener(args[i], event); + } + } + + return this; +}; + +/** + * Destroy the Ultron instance, remove all listeners and release all references. + * + * @returns {Boolean} + * @api public + */ +Ultron.prototype.destroy = function destroy() { + if (!this.ee) return false; + + this.remove(); + this.ee = null; + + return true; +}; + +// +// Expose the module. +// +module.exports = Ultron; diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/package.json b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/package.json new file mode 100644 index 00000000..e8829bba --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/package.json @@ -0,0 +1,68 @@ +{ + "name": "ultron", + "version": "1.0.1", + "description": "Ultron is high-intelligence robot. It gathers intel so it can start improving upon his rudimentary design", + "main": "index.js", + "scripts": { + "test": "mocha --reporter spec --ui bdd test.js", + "watch": "mocha --watch --reporter spec --ui bdd test.js", + "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter spec --ui bdd test.js", + "test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter spec --ui bdd test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/unshiftio/ultron" + }, + "keywords": [ + "Ultron", + "robot", + "gather", + "intelligence", + "event", + "events", + "eventemitter", + "emitter", + "cleanup" + ], + "author": { + "name": "Arnout Kazemier" + }, + "license": "MIT", + "devDependencies": { + "assume": "0.0.x", + "eventemitter3": "0.1.x", + "istanbul": "0.3.x", + "mocha": "2.0.x", + "pre-commit": "0.0.x" + }, + "bugs": { + "url": "https://github.com/unshiftio/ultron/issues" + }, + "homepage": "https://github.com/unshiftio/ultron", + "gitHead": "1aae6f07661ebb69a60c466ef50b9798cfb7f631", + "_id": "ultron@1.0.1", + "_shasum": "c9d8d86c9cf2823028eb45629ab725897dd65dc5", + "_from": "ultron@>=1.0.0 <1.1.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "V1", + "email": "info@3rd-Eden.com" + }, + "maintainers": [ + { + "name": "V1", + "email": "info@3rd-Eden.com" + }, + { + "name": "unshift", + "email": "npm@unshift.io" + } + ], + "dist": { + "shasum": "c9d8d86c9cf2823028eb45629ab725897dd65dc5", + "tarball": "http://registry.npmjs.org/ultron/-/ultron-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/test.js b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/test.js new file mode 100644 index 00000000..1fd4f1bb --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/ultron/test.js @@ -0,0 +1,327 @@ +/* istanbul ignore next */ +describe('Ultron', function () { + 'use strict'; + + var EventEmitter = require('eventemitter3') + , EE = require('events').EventEmitter + , assume = require('assume') + , Ultron = require('./') + , ultron + , ee; + + beforeEach(function () { + ee = new EventEmitter(); + ultron = new Ultron(ee); + }); + + afterEach(function () { + ultron.destroy(); + ee.removeAllListeners(); + }); + + it('is exposed as a function', function () { + assume(Ultron).is.a('function'); + }); + + it('can be initialized without the new keyword', function () { + assume(Ultron(ee)).is.instanceOf(Ultron); + }); + + it('assigns a unique id to every instance', function () { + for (var i = 0; i < 100; i++) { + assume(ultron.id).does.not.equal((new Ultron()).id); + } + }); + + it('allows removal through the event emitter', function () { + function foo() {} + function bar() {} + + ultron.on('foo', foo); + ultron.once('foo', bar); + + assume(foo.__ultron).equals(ultron.id); + assume(bar.__ultron).equals(ultron.id); + assume(ee.listeners('foo').length).equals(2); + + ee.removeListener('foo', foo); + assume(ee.listeners('foo').length).equals(1); + + ee.removeListener('foo', bar); + assume(ee.listeners('foo').length).equals(0); + }); + + describe('#on', function () { + it('assigns a listener', function () { + assume(ee.listeners('foo').length).equals(0); + + function foo() {} + + ultron.on('foo', foo); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0]).equals(foo); + }); + + it('tags the assigned function', function () { + assume(ee.listeners('foo').length).equals(0); + + ultron.on('foo', function () {}); + assume(ee.listeners('foo')[0].__ultron).equals(ultron.id); + }); + + it('also passes in the context', function (next) { + var context = 1313; + + ultron.on('foo', function (a, b, c) { + assume(a).equals('a'); + assume(b).equals('b'); + assume(c).equals('c'); + + assume(this).equals(context); + + next(); + }, context); + + ee.emit('foo', 'a', 'b', 'c'); + }); + + it('works with regular eventemitters as well', function (next) { + var ee = new EE() + , ultron = new Ultron(ee); + + ultron.on('foo', function (a, b, c) { + assume(a).equals('a'); + assume(b).equals('b'); + assume(c).equals('c'); + + next(); + }); + + ee.emit('foo', 'a', 'b', 'c'); + }); + }); + + describe('#once', function () { + it('assigns a listener', function () { + assume(ee.listeners('foo').length).equals(0); + + function foo() {} + ultron.once('foo', foo); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0]).equals(foo); + }); + + it('tags the assigned function', function () { + assume(ee.listeners('foo').length).equals(0); + + ultron.once('foo', function () {}); + assume(ee.listeners('foo')[0].__ultron).equals(ultron.id); + }); + + it('also passes in the context', function (next) { + var context = 1313; + + ultron.once('foo', function (a, b, c) { + assume(a).equals('a'); + assume(b).equals('b'); + assume(c).equals('c'); + + assume(this).equals(context); + + next(); + }, context); + + ee.emit('foo', 'a', 'b', 'c'); + ee.emit('foo', 'a', 'b', 'c'); // Ensure that we don't double execute + }); + + it('works with regular eventemitters as well', function (next) { + var ee = new EE() + , ultron = new Ultron(ee); + + ultron.once('foo', function (a, b, c) { + assume(a).equals('a'); + assume(b).equals('b'); + assume(c).equals('c'); + + next(); + }); + + ee.emit('foo', 'a', 'b', 'c'); + ee.emit('foo', 'a', 'b', 'c'); // Ensure that we don't double execute + }); + }); + + describe('#remove', function () { + it('removes only our assigned `on` listeners', function () { + function foo() {} + function bar() {} + + ee.on('foo', foo); + ultron.on('foo', bar); + assume(ee.listeners('foo').length).equals(2); + + ultron.remove('foo'); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0]).equals(foo); + }); + + it('removes our private __ultron references', function () { + function once() {} + function on() {} + + assume('__ultron' in once).is.false(); + assume('__ultron' in on).is.false(); + + ultron.on('foo', on); + ultron.once('bar', once); + + assume('__ultron' in once).is.true(); + assume('__ultron' in on).is.true(); + + ultron.remove('foo, bar'); + + assume('__ultron' in once).is.false(); + assume('__ultron' in on).is.false(); + + ultron.destroy(); + + ee = new EE(); + ultron = new Ultron(ee); + + assume('__ultron' in once).is.false(); + assume('__ultron' in on).is.false(); + + ultron.on('foo', on); + ultron.once('bar', once); + + assume('__ultron' in once).is.true(); + assume('__ultron' in on).is.true(); + + ultron.remove('foo, bar'); + + assume('__ultron' in once).is.false(); + assume('__ultron' in on).is.false(); + }); + + it('removes only our assigned `once` listeners', function () { + function foo() {} + function bar() {} + + ee.once('foo', foo); + ultron.once('foo', bar); + assume(ee.listeners('foo').length).equals(2); + + ultron.remove('foo'); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0]).equals(foo); + }); + + it('removes only our assigned `once` listeners from regular EE', function () { + var ee = new EE() + , ultron = new Ultron(ee); + + function foo() {} + function bar() {} + + ee.once('foo', foo); + ultron.once('foo', bar); + assume(ee.listeners('foo').length).equals(2); + + ultron.remove('foo'); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0].listener).equals(foo); + }); + + it('removes all assigned events if called without args', function () { + function foo() {} + function bar() {} + + ultron.on('foo', foo); + ultron.on('bar', bar); + + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('bar').length).equals(1); + + ultron.remove(); + + assume(ee.listeners('foo').length).equals(0); + assume(ee.listeners('bar').length).equals(0); + }); + + it('removes multiple listeners based on args', function () { + function foo() {} + function bar() {} + function baz() {} + + ultron.on('foo', foo); + ultron.on('bar', bar); + ultron.on('baz', baz); + + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('bar').length).equals(1); + assume(ee.listeners('baz').length).equals(1); + + ultron.remove('foo', 'bar'); + + assume(ee.listeners('foo').length).equals(0); + assume(ee.listeners('bar').length).equals(0); + assume(ee.listeners('baz').length).equals(1); + }); + + it('removes multiple listeners if first arg is seperated string', function () { + function foo() {} + function bar() {} + function baz() {} + + ultron.on('foo', foo); + ultron.on('bar', bar); + ultron.on('baz', baz); + + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('bar').length).equals(1); + assume(ee.listeners('baz').length).equals(1); + + ultron.remove('foo, bar'); + + assume(ee.listeners('foo').length).equals(0); + assume(ee.listeners('bar').length).equals(0); + assume(ee.listeners('baz').length).equals(1); + }); + }); + + describe('#destroy', function () { + it('removes all listeners', function () { + function foo() {} + function bar() {} + function baz() {} + + ultron.on('foo', foo); + ultron.on('bar', bar); + ultron.on('baz', baz); + + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('bar').length).equals(1); + assume(ee.listeners('baz').length).equals(1); + + ultron.destroy(); + + assume(ee.listeners('foo').length).equals(0); + assume(ee.listeners('bar').length).equals(0); + assume(ee.listeners('baz').length).equals(0); + }); + + it('removes the .ee reference', function () { + assume(ultron.ee).equals(ee); + ultron.destroy(); + assume(ultron.ee).equals(null); + }); + + it('returns booleans for state indication', function () { + assume(ultron.destroy()).is.true(); + assume(ultron.destroy()).is.false(); + assume(ultron.destroy()).is.false(); + assume(ultron.destroy()).is.false(); + }); + }); +}); diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/.npmignore b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/.npmignore new file mode 100644 index 00000000..0c90f673 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/.npmignore @@ -0,0 +1,3 @@ +npm-debug.log +node_modules +build diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/binding.gyp b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/binding.gyp new file mode 100644 index 00000000..2c5c8827 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/binding.gyp @@ -0,0 +1,10 @@ +{ + 'targets': [ + { + 'target_name': 'validation', + 'include_dirs': ["> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_objc = CXX($(TOOLSET)) $@ +cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< + +quiet_cmd_objcxx = CXX($(TOOLSET)) $@ +cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# Commands for precompiled header files. +quiet_cmd_pch_c = CXX($(TOOLSET)) $@ +cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ +cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_m = CXX($(TOOLSET)) $@ +cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< +quiet_cmd_pch_mm = CXX($(TOOLSET)) $@ +cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# gyp-mac-tool is written next to the root Makefile by gyp. +# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd +# already. +quiet_cmd_mac_tool = MACTOOL $(4) $< +cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@" + +quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@ +cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) + +quiet_cmd_infoplist = INFOPLIST $@ +cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = rm -rf "$@" && cp -af "$<" "$@" + +quiet_cmd_alink = LIBTOOL-STATIC $@ +cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 2,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,validation.target.mk)))),) + include validation.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/sirip/Documents/dev/bittorrent-tracker/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/sirip/.node-gyp/0.12.1/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/sirip/.node-gyp/0.12.1" "-Dmodule_root_dir=/Users/sirip/Documents/dev/bittorrent-tracker/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate" binding.gyp +Makefile: $(srcdir)/../../../../../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../../../.node-gyp/0.12.1/common.gypi + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/obj.target/validation/src/validation.o.d b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/obj.target/validation/src/validation.o.d new file mode 100644 index 00000000..8bf585f9 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/obj.target/validation/src/validation.o.d @@ -0,0 +1,37 @@ +cmd_Release/obj.target/validation/src/validation.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/sirip/.node-gyp/0.12.1/src -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include -I../node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/validation/src/validation.o.d.raw -c -o Release/obj.target/validation/src/validation.o ../src/validation.cc +Release/obj.target/validation/src/validation.o: ../src/validation.cc \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8.h \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8stdint.h \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8config.h \ + /Users/sirip/.node-gyp/0.12.1/src/node.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_version.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_buffer.h \ + /Users/sirip/.node-gyp/0.12.1/src/smalloc.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_object_wrap.h \ + ../node_modules/nan/nan.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-errno.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-version.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-unix.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-threadpool.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-darwin.h \ + ../node_modules/nan/nan_new.h \ + ../node_modules/nan/nan_implementation_12_inl.h +../src/validation.cc: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8.h: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8stdint.h: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8config.h: +/Users/sirip/.node-gyp/0.12.1/src/node.h: +/Users/sirip/.node-gyp/0.12.1/src/node_version.h: +/Users/sirip/.node-gyp/0.12.1/src/node_buffer.h: +/Users/sirip/.node-gyp/0.12.1/src/smalloc.h: +/Users/sirip/.node-gyp/0.12.1/src/node_object_wrap.h: +../node_modules/nan/nan.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-errno.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-version.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-unix.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-threadpool.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-darwin.h: +../node_modules/nan/nan_new.h: +../node_modules/nan/nan_implementation_12_inl.h: diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/validation.node.d b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/validation.node.d new file mode 100644 index 00000000..2f13adc8 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/validation.node.d @@ -0,0 +1 @@ +cmd_Release/validation.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -bundle -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -o Release/validation.node Release/obj.target/validation/src/validation.o -undefined dynamic_lookup diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/linker.lock b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/linker.lock new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/obj.target/validation/src/validation.o b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/obj.target/validation/src/validation.o new file mode 100644 index 00000000..d78236cf Binary files /dev/null and b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/obj.target/validation/src/validation.o differ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/validation.node b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/validation.node new file mode 100755 index 00000000..592aeb6c Binary files /dev/null and b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/Release/validation.node differ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/binding.Makefile b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/binding.Makefile new file mode 100644 index 00000000..c7aead96 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) validation diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/config.gypi b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/config.gypi new file mode 100644 index 00000000..0af2b6d8 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/config.gypi @@ -0,0 +1,129 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "clang": 1, + "host_arch": "x64", + "icu_small": "false", + "node_install_npm": "false", + "node_prefix": "/usr/local/Cellar/node/0.12.1", + "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_use_dtrace": "true", + "node_use_etw": "false", + "node_use_mdb": "false", + "node_use_openssl": "true", + "node_use_perfctr": "false", + "openssl_no_asm": 0, + "python": "/usr/local/opt/python/bin/python2.7", + "target_arch": "x64", + "uv_library": "static_library", + "uv_parent_path": "/deps/uv/", + "uv_use_dtrace": "true", + "v8_enable_gdbjit": 0, + "v8_enable_i18n_support": 0, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 0, + "v8_random_seed": 0, + "v8_use_snapshot": "true", + "want_separate_host_toolset": 0, + "nodedir": "/Users/sirip/.node-gyp/0.12.1", + "copy_dev_lib": "true", + "standalone_static_library": 1, + "save_dev": "", + "browser": "", + "viewer": "man", + "rollback": "true", + "usage": "", + "globalignorefile": "/usr/local/etc/npmignore", + "init_author_url": "", + "shell": "/bin/bash", + "parseable": "", + "shrinkwrap": "true", + "init_license": "ISC", + "if_present": "", + "cache_max": "Infinity", + "init_author_email": "", + "sign_git_tag": "", + "cert": "", + "git_tag_version": "true", + "local_address": "", + "long": "", + "fetch_retries": "2", + "npat": "", + "registry": "https://registry.npmjs.org/", + "key": "", + "message": "%s", + "versions": "", + "globalconfig": "/usr/local/etc/npmrc", + "always_auth": "", + "spin": "true", + "cache_lock_retries": "10", + "cafile": "", + "heading": "npm", + "fetch_retry_mintimeout": "10000", + "proprietary_attribs": "true", + "access": "", + "json": "", + "description": "true", + "engine_strict": "", + "https_proxy": "", + "init_module": "/Users/sirip/.npm-init.js", + "userconfig": "/Users/sirip/.npmrc", + "node_version": "0.12.1", + "user": "", + "editor": "vi", + "save": "", + "tag": "latest", + "global": "", + "optional": "true", + "bin_links": "true", + "force": "", + "searchopts": "", + "depth": "", + "rebuild_bundle": "true", + "searchsort": "name", + "unicode": "true", + "fetch_retry_maxtimeout": "60000", + "ca": "", + "save_prefix": "^", + "strict_ssl": "true", + "dev": "", + "fetch_retry_factor": "10", + "group": "20", + "save_exact": "", + "cache_lock_stale": "60000", + "version": "", + "cache_min": "10", + "cache": "/Users/sirip/.npm", + "searchexclude": "", + "color": "true", + "save_optional": "", + "user_agent": "npm/2.7.3 node/v0.12.1 darwin x64", + "ignore_scripts": "", + "cache_lock_wait": "10000", + "production": "", + "save_bundle": "", + "init_version": "1.0.0", + "umask": "0022", + "git": "git", + "init_author_name": "", + "scope": "", + "onload_script": "", + "tmp": "/var/folders/fd/838gnt9x47gd1ylq5_t46zwc0000gt/T", + "unsafe_perm": "true", + "prefix": "/usr/local", + "link": "" + } +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/gyp-mac-tool b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/gyp-mac-tool new file mode 100755 index 00000000..7abfed5f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/gyp-mac-tool @@ -0,0 +1,512 @@ +#!/usr/bin/env python +# Generated by gyp. Do not edit. +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions to perform Xcode-style build steps. + +These functions are executed via gyp-mac-tool when using the Makefile generator. +""" + +import fcntl +import fnmatch +import glob +import json +import os +import plistlib +import re +import shutil +import string +import subprocess +import sys +import tempfile + + +def main(args): + executor = MacTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class MacTool(object): + """This class performs all the Mac tooling steps. The methods can either be + executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like copy-info-plist to CopyInfoPlist""" + return name_string.title().replace('-', '') + + def ExecCopyBundleResource(self, source, dest): + """Copies a resource file to the bundle/Resources directory, performing any + necessary compilation on each resource.""" + extension = os.path.splitext(source)[1].lower() + if os.path.isdir(source): + # Copy tree. + # TODO(thakis): This copies file attributes like mtime, while the + # single-file branch below doesn't. This should probably be changed to + # be consistent with the single-file branch. + if os.path.exists(dest): + shutil.rmtree(dest) + shutil.copytree(source, dest) + elif extension == '.xib': + return self._CopyXIBFile(source, dest) + elif extension == '.storyboard': + return self._CopyXIBFile(source, dest) + elif extension == '.strings': + self._CopyStringsFile(source, dest) + else: + shutil.copy(source, dest) + + def _CopyXIBFile(self, source, dest): + """Compiles a XIB file with ibtool into a binary plist in the bundle.""" + + # ibtool sometimes crashes with relative paths. See crbug.com/314728. + base = os.path.dirname(os.path.realpath(__file__)) + if os.path.relpath(source): + source = os.path.join(base, source) + if os.path.relpath(dest): + dest = os.path.join(base, dest) + + args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices', + '--output-format', 'human-readable-text', '--compile', dest, source] + ibtool_section_re = re.compile(r'/\*.*\*/') + ibtool_re = re.compile(r'.*note:.*is clipping its content') + ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) + current_section_header = None + for line in ibtoolout.stdout: + if ibtool_section_re.match(line): + current_section_header = line + elif not ibtool_re.match(line): + if current_section_header: + sys.stdout.write(current_section_header) + current_section_header = None + sys.stdout.write(line) + return ibtoolout.returncode + + def _CopyStringsFile(self, source, dest): + """Copies a .strings file using iconv to reconvert the input into UTF-16.""" + input_code = self._DetectInputEncoding(source) or "UTF-8" + + # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call + # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints + # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing + # semicolon in dictionary. + # on invalid files. Do the same kind of validation. + import CoreFoundation + s = open(source, 'rb').read() + d = CoreFoundation.CFDataCreate(None, s, len(s)) + _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None) + if error: + return + + fp = open(dest, 'wb') + fp.write(s.decode(input_code).encode('UTF-16')) + fp.close() + + def _DetectInputEncoding(self, file_name): + """Reads the first few bytes from file_name and tries to guess the text + encoding. Returns None as a guess if it can't detect it.""" + fp = open(file_name, 'rb') + try: + header = fp.read(3) + except e: + fp.close() + return None + fp.close() + if header.startswith("\xFE\xFF"): + return "UTF-16" + elif header.startswith("\xFF\xFE"): + return "UTF-16" + elif header.startswith("\xEF\xBB\xBF"): + return "UTF-8" + else: + return None + + def ExecCopyInfoPlist(self, source, dest, *keys): + """Copies the |source| Info.plist to the destination directory |dest|.""" + # Read the source Info.plist into memory. + fd = open(source, 'r') + lines = fd.read() + fd.close() + + # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). + plist = plistlib.readPlistFromString(lines) + if keys: + plist = dict(plist.items() + json.loads(keys[0]).items()) + lines = plistlib.writePlistToString(plist) + + # Go through all the environment variables and replace them as variables in + # the file. + IDENT_RE = re.compile('[/\s]') + for key in os.environ: + if key.startswith('_'): + continue + evar = '${%s}' % key + evalue = os.environ[key] + lines = string.replace(lines, evar, evalue) + + # Xcode supports various suffices on environment variables, which are + # all undocumented. :rfc1034identifier is used in the standard project + # template these days, and :identifier was used earlier. They are used to + # convert non-url characters into things that look like valid urls -- + # except that the replacement character for :identifier, '_' isn't valid + # in a URL either -- oops, hence :rfc1034identifier was born. + evar = '${%s:identifier}' % key + evalue = IDENT_RE.sub('_', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + evar = '${%s:rfc1034identifier}' % key + evalue = IDENT_RE.sub('-', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + # Remove any keys with values that haven't been replaced. + lines = lines.split('\n') + for i in range(len(lines)): + if lines[i].strip().startswith("${"): + lines[i] = None + lines[i - 1] = None + lines = '\n'.join(filter(lambda x: x is not None, lines)) + + # Write out the file with variables replaced. + fd = open(dest, 'w') + fd.write(lines) + fd.close() + + # Now write out PkgInfo file now that the Info.plist file has been + # "compiled". + self._WritePkgInfo(dest) + + def _WritePkgInfo(self, info_plist): + """This writes the PkgInfo file from the data stored in Info.plist.""" + plist = plistlib.readPlist(info_plist) + if not plist: + return + + # Only create PkgInfo for executable types. + package_type = plist['CFBundlePackageType'] + if package_type != 'APPL': + return + + # The format of PkgInfo is eight characters, representing the bundle type + # and bundle signature, each four characters. If that is missing, four + # '?' characters are used instead. + signature_code = plist.get('CFBundleSignature', '????') + if len(signature_code) != 4: # Wrong length resets everything, too. + signature_code = '?' * 4 + + dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo') + fp = open(dest, 'w') + fp.write('%s%s' % (package_type, signature_code)) + fp.close() + + def ExecFlock(self, lockfile, *cmd_list): + """Emulates the most basic behavior of Linux's flock(1).""" + # Rely on exception handling to report errors. + fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) + fcntl.flock(fd, fcntl.LOCK_EX) + return subprocess.call(cmd_list) + + def ExecFilterLibtool(self, *cmd_list): + """Calls libtool and filters out '/path/to/libtool: file: foo.o has no + symbols'.""" + libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') + libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) + _, err = libtoolout.communicate() + for line in err.splitlines(): + if not libtool_re.match(line): + print >>sys.stderr, line + return libtoolout.returncode + + def ExecPackageFramework(self, framework, version): + """Takes a path to Something.framework and the Current version of that and + sets up all the symlinks.""" + # Find the name of the binary based on the part before the ".framework". + binary = os.path.basename(framework).split('.')[0] + + CURRENT = 'Current' + RESOURCES = 'Resources' + VERSIONS = 'Versions' + + if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)): + # Binary-less frameworks don't seem to contain symlinks (see e.g. + # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle). + return + + # Move into the framework directory to set the symlinks correctly. + pwd = os.getcwd() + os.chdir(framework) + + # Set up the Current version. + self._Relink(version, os.path.join(VERSIONS, CURRENT)) + + # Set up the root symlinks. + self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary) + self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES) + + # Back to where we were before! + os.chdir(pwd) + + def _Relink(self, dest, link): + """Creates a symlink to |dest| named |link|. If |link| already exists, + it is overwritten.""" + if os.path.lexists(link): + os.remove(link) + os.symlink(dest, link) + + def ExecCodeSignBundle(self, key, resource_rules, entitlements, provisioning): + """Code sign a bundle. + + This function tries to code sign an iOS bundle, following the same + algorithm as Xcode: + 1. copy ResourceRules.plist from the user or the SDK into the bundle, + 2. pick the provisioning profile that best match the bundle identifier, + and copy it into the bundle as embedded.mobileprovision, + 3. copy Entitlements.plist from user or SDK next to the bundle, + 4. code sign the bundle. + """ + resource_rules_path = self._InstallResourceRules(resource_rules) + substitutions, overrides = self._InstallProvisioningProfile( + provisioning, self._GetCFBundleIdentifier()) + entitlements_path = self._InstallEntitlements( + entitlements, substitutions, overrides) + subprocess.check_call([ + 'codesign', '--force', '--sign', key, '--resource-rules', + resource_rules_path, '--entitlements', entitlements_path, + os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['FULL_PRODUCT_NAME'])]) + + def _InstallResourceRules(self, resource_rules): + """Installs ResourceRules.plist from user or SDK into the bundle. + + Args: + resource_rules: string, optional, path to the ResourceRules.plist file + to use, default to "${SDKROOT}/ResourceRules.plist" + + Returns: + Path to the copy of ResourceRules.plist into the bundle. + """ + source_path = resource_rules + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'ResourceRules.plist') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], 'ResourceRules.plist') + shutil.copy2(source_path, target_path) + return target_path + + def _InstallProvisioningProfile(self, profile, bundle_identifier): + """Installs embedded.mobileprovision into the bundle. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple containing two dictionary: variables substitutions and values + to overrides when generating the entitlements file. + """ + source_path, provisioning_data, team_id = self._FindProvisioningProfile( + profile, bundle_identifier) + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'embedded.mobileprovision') + shutil.copy2(source_path, target_path) + substitutions = self._GetSubstitutions(bundle_identifier, team_id + '.') + return substitutions, provisioning_data['Entitlements'] + + def _FindProvisioningProfile(self, profile, bundle_identifier): + """Finds the .mobileprovision file to use for signing the bundle. + + Checks all the installed provisioning profiles (or if the user specified + the PROVISIONING_PROFILE variable, only consult it) and select the most + specific that correspond to the bundle identifier. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple of the path to the selected provisioning profile, the data of + the embedded plist in the provisioning profile and the team identifier + to use for code signing. + + Raises: + SystemExit: if no .mobileprovision can be used to sign the bundle. + """ + profiles_dir = os.path.join( + os.environ['HOME'], 'Library', 'MobileDevice', 'Provisioning Profiles') + if not os.path.isdir(profiles_dir): + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + provisioning_profiles = None + if profile: + profile_path = os.path.join(profiles_dir, profile + '.mobileprovision') + if os.path.exists(profile_path): + provisioning_profiles = [profile_path] + if not provisioning_profiles: + provisioning_profiles = glob.glob( + os.path.join(profiles_dir, '*.mobileprovision')) + valid_provisioning_profiles = {} + for profile_path in provisioning_profiles: + profile_data = self._LoadProvisioningProfile(profile_path) + app_id_pattern = profile_data.get( + 'Entitlements', {}).get('application-identifier', '') + for team_identifier in profile_data.get('TeamIdentifier', []): + app_id = '%s.%s' % (team_identifier, bundle_identifier) + if fnmatch.fnmatch(app_id, app_id_pattern): + valid_provisioning_profiles[app_id_pattern] = ( + profile_path, profile_data, team_identifier) + if not valid_provisioning_profiles: + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + # If the user has multiple provisioning profiles installed that can be + # used for ${bundle_identifier}, pick the most specific one (ie. the + # provisioning profile whose pattern is the longest). + selected_key = max(valid_provisioning_profiles, key=lambda v: len(v)) + return valid_provisioning_profiles[selected_key] + + def _LoadProvisioningProfile(self, profile_path): + """Extracts the plist embedded in a provisioning profile. + + Args: + profile_path: string, path to the .mobileprovision file + + Returns: + Content of the plist embedded in the provisioning profile as a dictionary. + """ + with tempfile.NamedTemporaryFile() as temp: + subprocess.check_call([ + 'security', 'cms', '-D', '-i', profile_path, '-o', temp.name]) + return self._LoadPlistMaybeBinary(temp.name) + + def _LoadPlistMaybeBinary(self, plist_path): + """Loads into a memory a plist possibly encoded in binary format. + + This is a wrapper around plistlib.readPlist that tries to convert the + plist to the XML format if it can't be parsed (assuming that it is in + the binary format). + + Args: + plist_path: string, path to a plist file, in XML or binary format + + Returns: + Content of the plist as a dictionary. + """ + try: + # First, try to read the file using plistlib that only supports XML, + # and if an exception is raised, convert a temporary copy to XML and + # load that copy. + return plistlib.readPlist(plist_path) + except: + pass + with tempfile.NamedTemporaryFile() as temp: + shutil.copy2(plist_path, temp.name) + subprocess.check_call(['plutil', '-convert', 'xml1', temp.name]) + return plistlib.readPlist(temp.name) + + def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix): + """Constructs a dictionary of variable substitutions for Entitlements.plist. + + Args: + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + app_identifier_prefix: string, value for AppIdentifierPrefix + + Returns: + Dictionary of substitutions to apply when generating Entitlements.plist. + """ + return { + 'CFBundleIdentifier': bundle_identifier, + 'AppIdentifierPrefix': app_identifier_prefix, + } + + def _GetCFBundleIdentifier(self): + """Extracts CFBundleIdentifier value from Info.plist in the bundle. + + Returns: + Value of CFBundleIdentifier in the Info.plist located in the bundle. + """ + info_plist_path = os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['INFOPLIST_PATH']) + info_plist_data = self._LoadPlistMaybeBinary(info_plist_path) + return info_plist_data['CFBundleIdentifier'] + + def _InstallEntitlements(self, entitlements, substitutions, overrides): + """Generates and install the ${BundleName}.xcent entitlements file. + + Expands variables "$(variable)" pattern in the source entitlements file, + add extra entitlements defined in the .mobileprovision file and the copy + the generated plist to "${BundlePath}.xcent". + + Args: + entitlements: string, optional, path to the Entitlements.plist template + to use, defaults to "${SDKROOT}/Entitlements.plist" + substitutions: dictionary, variable substitutions + overrides: dictionary, values to add to the entitlements + + Returns: + Path to the generated entitlements file. + """ + source_path = entitlements + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['PRODUCT_NAME'] + '.xcent') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], + 'Entitlements.plist') + shutil.copy2(source_path, target_path) + data = self._LoadPlistMaybeBinary(target_path) + data = self._ExpandVariables(data, substitutions) + if overrides: + for key in overrides: + if key not in data: + data[key] = overrides[key] + plistlib.writePlist(data, target_path) + return target_path + + def _ExpandVariables(self, data, substitutions): + """Expands variables "$(variable)" in data. + + Args: + data: object, can be either string, list or dictionary + substitutions: dictionary, variable substitutions to perform + + Returns: + Copy of data where each references to "$(variable)" has been replaced + by the corresponding value found in substitutions, or left intact if + the key was not found. + """ + if isinstance(data, str): + for key, value in substitutions.iteritems(): + data = data.replace('$(%s)' % key, value) + return data + if isinstance(data, list): + return [self._ExpandVariables(v, substitutions) for v in data] + if isinstance(data, dict): + return dict((k, self._ExpandVariables(data[k], + substitutions)) for k in data) + return data + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/validation.target.mk b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/validation.target.mk new file mode 100644 index 00000000..1d93186f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/build/validation.target.mk @@ -0,0 +1,156 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := validation +DEFS_Debug := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' \ + '-DDEBUG' \ + '-D_DEBUG' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -O0 \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Debug := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Debug := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Debug := + +INCS_Debug := \ + -I/Users/sirip/.node-gyp/0.12.1/src \ + -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include \ + -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +DEFS_Release := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' + +# Flags passed to all source files. +CFLAGS_Release := \ + -Os \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Release := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Release := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Release := + +INCS_Release := \ + -I/Users/sirip/.node-gyp/0.12.1/src \ + -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include \ + -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +OBJS := \ + $(obj).target/$(TARGET)/src/validation.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Debug := \ + -Wl,-search_paths_first + +LDFLAGS_Release := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Release := \ + -Wl,-search_paths_first + +LIBS := \ + -undefined dynamic_lookup + +$(builddir)/validation.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(builddir)/validation.node: LIBS := $(LIBS) +$(builddir)/validation.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE)) +$(builddir)/validation.node: TOOLSET := $(TOOLSET) +$(builddir)/validation.node: $(OBJS) FORCE_DO_CMD + $(call do_cmd,solink_module) + +all_deps += $(builddir)/validation.node +# Add target alias +.PHONY: validation +validation: $(builddir)/validation.node + +# Short alias for building this executable. +.PHONY: validation.node +validation.node: $(builddir)/validation.node + +# Add executable to "all" target. +.PHONY: all +all: $(builddir)/validation.node + diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/fallback.js b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/fallback.js new file mode 100644 index 00000000..f929d77e --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/fallback.js @@ -0,0 +1,13 @@ +'use strict'; + +/*! + * UTF-8 validate: UTF-8 validation for WebSockets. + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.Validation = { + isValidUTF8: function(buffer) { + return true; + } +}; diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/index.js b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/index.js new file mode 100644 index 00000000..e7bfde8e --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/index.js @@ -0,0 +1,7 @@ +'use strict'; + +try { + module.exports = require('bindings')('validation'); +} catch (e) { + module.exports = require('./fallback'); +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/README.md b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/README.md new file mode 100644 index 00000000..585cf512 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/README.md @@ -0,0 +1,97 @@ +node-bindings +============= +### Helper module for loading your native module's .node file + +This is a helper module for authors of Node.js native addon modules. +It is basically the "swiss army knife" of `require()`ing your native module's +`.node` file. + +Throughout the course of Node's native addon history, addons have ended up being +compiled in a variety of different places, depending on which build tool and which +version of node was used. To make matters worse, now the _gyp_ build tool can +produce either a _Release_ or _Debug_ build, each being built into different +locations. + +This module checks _all_ the possible locations that a native addon would be built +at, and returns the first one that loads successfully. + + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install bindings +``` + +Or add it to the `"dependencies"` section of your _package.json_ file. + + +Example +------- + +`require()`ing the proper bindings file for the current node version, platform +and architecture is as simple as: + +``` js +var bindings = require('bindings')('binding.node') + +// Use your bindings defined in your C files +bindings.your_c_function() +``` + + +Nice Error Output +----------------- + +When the `.node` file could not be loaded, `node-bindings` throws an Error with +a nice error message telling you exactly what was tried. You can also check the +`err.tries` Array property. + +``` +Error: Could not load the bindings file. Tried: + → /Users/nrajlich/ref/build/binding.node + → /Users/nrajlich/ref/build/Debug/binding.node + → /Users/nrajlich/ref/build/Release/binding.node + → /Users/nrajlich/ref/out/Debug/binding.node + → /Users/nrajlich/ref/Debug/binding.node + → /Users/nrajlich/ref/out/Release/binding.node + → /Users/nrajlich/ref/Release/binding.node + → /Users/nrajlich/ref/build/default/binding.node + → /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node + at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13) + at Object. (/Users/nrajlich/ref/lib/ref.js:5:47) + at Module._compile (module.js:449:26) + at Object.Module._extensions..js (module.js:467:10) + at Module.load (module.js:356:32) + at Function.Module._load (module.js:312:12) + ... +``` + + +License +------- + +(The MIT License) + +Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> + +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/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/bindings.js b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/bindings.js new file mode 100644 index 00000000..93dcf85a --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/bindings.js @@ -0,0 +1,166 @@ + +/** + * Module dependencies. + */ + +var fs = require('fs') + , path = require('path') + , join = path.join + , dirname = path.dirname + , exists = fs.existsSync || path.existsSync + , defaults = { + arrow: process.env.NODE_BINDINGS_ARROW || ' → ' + , compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' + , platform: process.platform + , arch: process.arch + , version: process.versions.node + , bindings: 'bindings.node' + , try: [ + // node-gyp's linked version in the "build" dir + [ 'module_root', 'build', 'bindings' ] + // node-waf and gyp_addon (a.k.a node-gyp) + , [ 'module_root', 'build', 'Debug', 'bindings' ] + , [ 'module_root', 'build', 'Release', 'bindings' ] + // Debug files, for development (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Debug', 'bindings' ] + , [ 'module_root', 'Debug', 'bindings' ] + // Release files, but manually compiled (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Release', 'bindings' ] + , [ 'module_root', 'Release', 'bindings' ] + // Legacy from node-waf, node <= 0.4.x + , [ 'module_root', 'build', 'default', 'bindings' ] + // Production "Release" buildtype binary (meh...) + , [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ] + ] + } + +/** + * The main `bindings()` function loads the compiled bindings for a given module. + * It uses V8's Error API to determine the parent filename that this function is + * being invoked from, which is then used to find the root directory. + */ + +function bindings (opts) { + + // Argument surgery + if (typeof opts == 'string') { + opts = { bindings: opts } + } else if (!opts) { + opts = {} + } + opts.__proto__ = defaults + + // Get the module root + if (!opts.module_root) { + opts.module_root = exports.getRoot(exports.getFileName()) + } + + // Ensure the given bindings name ends with .node + if (path.extname(opts.bindings) != '.node') { + opts.bindings += '.node' + } + + var tries = [] + , i = 0 + , l = opts.try.length + , n + , b + , err + + for (; i=1.2.0 <1.3.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "TooTallNate", + "email": "nathan@tootallnate.net" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11", + "tarball": "http://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/.dntrc b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/.dntrc new file mode 100644 index 00000000..47971da6 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/.dntrc @@ -0,0 +1,30 @@ +## DNT config file +## see https://github.com/rvagg/dnt + +NODE_VERSIONS="\ + master \ + v0.11.13 \ + v0.10.30 \ + v0.10.29 \ + v0.10.28 \ + 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.8.28 \ + v0.8.27 \ + v0.8.26 \ + v0.8.24 \ +" +OUTPUT_PREFIX="nan-" +TEST_CMD=" \ + cd /dnt/ && \ + npm install && \ + node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild --directory test && \ + node_modules/.bin/tap --gc test/js/*-test.js \ +" + diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/CHANGELOG.md b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/CHANGELOG.md new file mode 100644 index 00000000..de0ac02a --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/CHANGELOG.md @@ -0,0 +1,265 @@ +# NAN ChangeLog + +**Version 1.6.2: current Node unstable: 0.11.16, Node stable: 0.10.36, io.js: 1.1.0** + +### 1.6.2 Feb 6 2015 + + - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 + +### 1.6.1 Jan 23 2015 + + - Build: version bump + +### 1.5.3 Jan 23 2015 + + - Build: repackage + +### 1.6.0 Jan 23 2015 + + - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af + - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 + - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 + +### 1.5.2 Jan 23 2015 + + - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 + - Bugfix: Readded missing String constructors 18d828f + - Bugfix: Add overload handling NanNew(..) 5ef813b + - Bugfix: Fix uv_work_cb versioning 997e4ae + - Bugfix: Add function factory and test 4eca89c + - Bugfix: Add object template factory and test cdcb951 + - Correctness: Lifted an io.js related typedef c9490be + - Correctness: Make explicit downcasts of String lengths 00074e6 + - Windows: Limit the scope of disabled warning C4530 83d7deb + +### 1.5.1 Jan 15 2015 + + - Build: version bump + +### 1.4.3 Jan 15 2015 + + - Build: version bump + +### 1.4.2 Jan 15 2015 + + - Feature: Support io.js 0dbc5e8 + +### 1.5.0 Jan 14 2015 + + - Feature: Support io.js b003843 + - Correctness: Improved NanNew internals 9cd4f6a + - Feature: Implement progress to NanAsyncWorker 8d6a160 + +### 1.4.1 Nov 8 2014 + + - Bugfix: Handle DEBUG definition correctly + - Bugfix: Accept int as Boolean + +### 1.4.0 Nov 1 2014 + + - Feature: Added NAN_GC_CALLBACK 6a5c245 + - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 + - Correctness: Added constness to references in NanHasInstance 02c61cd + - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 + - Windoze: Shut Visual Studio up when compiling 8d558c1 + - License: Switch to plain MIT from custom hacked MIT license 11de983 + - Build: Added test target to Makefile e232e46 + - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 + - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 + - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 + +### 1.3.0 Aug 2 2014 + + - Added NanNew(std::string) + - Added NanNew(std::string&) + - Added NanAsciiString helper class + - Added NanUtf8String helper class + - Added NanUcs2String helper class + - Deprecated NanRawString() + - Deprecated NanCString() + - Added NanGetIsolateData(v8::Isolate *isolate) + - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) + - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) + - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + +### 1.2.0 Jun 5 2014 + + - Add NanSetPrototypeTemplate + - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, + introduced _NanWeakCallbackDispatcher + - Removed -Wno-unused-local-typedefs from test builds + - Made test builds Windows compatible ('Sleep()') + +### 1.1.2 May 28 2014 + + - Release to fix more stuff-ups in 1.1.1 + +### 1.1.1 May 28 2014 + + - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 + +### 1.1.0 May 25 2014 + + - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead + - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), + (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, + v8::String::ExternalAsciiStringResource* + - Deprecate NanSymbol() + - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker + +### 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(v8::Handle value) for use in place of + v8::Local::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 ` 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) to NanThrowError(Handle) + - 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::Handle) + - 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 argument + - Added `NanNewBufferHandle` with single uint32_t argument + - Added `NanHasInstance(Persistent&, Handle)` + - Added `Local NanCallback#GetFunction()` + - Added `NanCallback#Call(int, Local[])` + - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/LICENSE.md b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/LICENSE.md new file mode 100644 index 00000000..95c2eb5f --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/LICENSE.md @@ -0,0 +1,13 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2015 NAN contributors +----------------------------------- + +*NAN contributors listed at * + +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/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/appveyor.yml b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/appveyor.yml new file mode 100644 index 00000000..17771078 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/appveyor.yml @@ -0,0 +1,37 @@ +# http://www.appveyor.com/docs/appveyor-yml + +# Test against these versions of Io.js and Node.js. +environment: + matrix: + # node.js + - nodejs_version: "0.8" + - nodejs_version: "0.10" + - nodejs_version: "0.11" + # io.js + - nodejs_version: "1" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node 0.STABLE.latest + - ps: if($env:nodejs_version -eq "0.8") {Install-Product node $env:nodejs_version} + - ps: if($env:nodejs_version -ne "0.8") {Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)} + - IF NOT %nodejs_version% == 1 npm -g install npm + - IF NOT %nodejs_version% == 1 set PATH=%APPDATA%\npm;%PATH% + # Typical npm stuff. + - npm install + - IF %nodejs_version% == 0.8 node node_modules\node-gyp\bin\node-gyp.js rebuild --directory test + - IF NOT %nodejs_version% == 0.8 npm run rebuild-tests + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm test + +# Don't actually build. +build: off + +# Set build version format here instead of in the admin panel. +version: "{build}" diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/include_dirs.js b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/include_dirs.js new file mode 100644 index 00000000..4f1dfb41 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/include_dirs.js @@ -0,0 +1 @@ +console.log(require('path').relative('.', __dirname)); diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan.h b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan.h new file mode 100644 index 00000000..e95a3b3e --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan.h @@ -0,0 +1,2174 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors: + * - Rod Vagg + * - Benjamin Byholm + * - Trevor Norris + * - Nathan Rajlich + * - Brett Lawson + * - Ben Noordhuis + * - David Siegel + * + * MIT License + * + * Version 1.6.2: current Node unstable: 0.11.16, Node stable: 0.10.36, io.js: 1.1.0 + * + * See https://github.com/rvagg/nan for the latest update to this file + **********************************************************************************/ + +#ifndef NAN_H_ +#define NAN_H_ + +#include +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +#if defined(__GNUC__) && !(defined(DEBUG) && DEBUG) +# define NAN_INLINE inline __attribute__((always_inline)) +#elif defined(_MSC_VER) && !(defined(DEBUG) && DEBUG) +# define NAN_INLINE __forceinline +#else +# define NAN_INLINE inline +#endif + +#if defined(__GNUC__) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __declspec(deprecated) +#else +# define NAN_DEPRECATED +#endif + +#if (NODE_MODULE_VERSION < 12) +typedef v8::InvocationCallback NanFunctionCallback; +typedef v8::Script NanUnboundScript; +typedef v8::Script NanBoundScript; +#else +typedef v8::FunctionCallback NanFunctionCallback; +typedef v8::UnboundScript NanUnboundScript; +typedef v8::Script NanBoundScript; +#endif + +#if (NODE_MODULE_VERSION < 42) +typedef v8::String::ExternalAsciiStringResource + NanExternalOneByteStringResource; +#else // io.js v1.0.0 +typedef v8::String::ExternalOneByteStringResource + NanExternalOneByteStringResource; +#endif + +#include "nan_new.h" // NOLINT(build/include) + +// uv helpers +#ifdef UV_VERSION_MAJOR +#ifndef UV_VERSION_PATCH +#define UV_VERSION_PATCH 0 +#endif +#define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \ + (UV_VERSION_MINOR << 8) | \ + (UV_VERSION_PATCH)) +#else +#define NAUV_UVVERSION 0x000b00 +#endif + + +#if NAUV_UVVERSION < 0x000b17 +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async, int) +#else +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async) +#endif + +// some generic helpers + +template NAN_INLINE bool NanSetPointerSafe( + T *var + , T val +) { + if (var) { + *var = val; + return true; + } else { + return false; + } +} + +template NAN_INLINE T NanGetPointerSafe( + T *var + , T fallback = reinterpret_cast(0) +) { + if (var) { + return *var; + } else { + return fallback; + } +} + +NAN_INLINE bool NanBooleanOptionValue( + v8::Local optionsObj + , v8::Handle 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 optionsObj + , v8::Handle opt +) { + return NanBooleanOptionValue(optionsObj, opt, false); +} + +NAN_INLINE uint32_t NanUInt32OptionValue( + v8::Local optionsObj + , v8::Handle opt + , uint32_t def +) { + return !optionsObj.IsEmpty() + && optionsObj->Has(opt) + && optionsObj->Get(opt)->IsNumber() + ? optionsObj->Get(opt)->Uint32Value() + : def; +} + +template +v8::Local NanNew(v8::Handle); + +template +NAN_INLINE v8::Local _NanEnsureLocal(v8::Handle val) { + return NanNew(val); +} + +template +NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { + return val; +} + +/* io.js 1.0 */ +#if NODE_MODULE_VERSION >= 42 || NODE_VERSION_AT_LEAST(0, 11, 15) + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::Isolate::GetCurrent()->SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::Isolate::GetCurrent()->LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::Isolate::GetCurrent()->ContextDisposedNotification(); + } +#else + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::V8::SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::V8::SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::V8::SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::V8::IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::V8::LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::V8::ContextDisposedNotification(); + } +#endif + +#if (NODE_MODULE_VERSION > 0x000B) +// Node 0.11+ (0.11.12 and below won't compile with these) + +# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo& +# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args +# define _NAN_METHOD_RETURN_TYPE void + +# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +# define _NAN_GETTER_RETURN_TYPE void + +# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args +# define _NAN_SETTER_RETURN_TYPE void + +# define _NAN_PROPERTY_GETTER_ARGS_TYPE \ + const v8::PropertyCallbackInfo& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args +# define _NAN_INDEX_QUERY_RETURN_TYPE void + +# define NanScope() v8::HandleScope scope(v8::Isolate::GetCurrent()) +# define NanEscapableScope() \ + v8::EscapableHandleScope scope(v8::Isolate::GetCurrent()) + +# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) +# define NanLocker() v8::Locker locker(v8::Isolate::GetCurrent()) +# define NanUnlocker() v8::Unlocker unlocker(v8::Isolate::GetCurrent()) +# define NanReturnValue(value) return args.GetReturnValue().Set(value) +# define NanReturnUndefined() return +# define NanReturnHolder() NanReturnValue(args.Holder()) +# define NanReturnThis() NanReturnValue(args.This()) +# define NanReturnNull() return args.GetReturnValue().SetNull() +# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString() + +# define NanObjectWrapHandle(obj) obj->handle() + + NAN_INLINE v8::Local NanUndefined() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanNull() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanTrue() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanFalse() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE int NanAdjustExternalMemory(int bc) { + return static_cast( + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , const char *name + , v8::Handle value) { + templ->Set(v8::Isolate::GetCurrent(), name, value); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + NAN_INLINE v8::Local NanGetCurrentContext() { + return v8::Isolate::GetCurrent()->GetCurrentContext(); + } + + NAN_INLINE void* NanGetInternalFieldPointer( + v8::Handle object + , int index) { + return object->GetAlignedPointerFromInternalField(index); + } + + NAN_INLINE void NanSetInternalFieldPointer( + v8::Handle object + , int index + , void* value) { + object->SetAlignedPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) + + NAN_INLINE void NanAddGCEpilogueCallback( + v8::Isolate::GCEpilogueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); + } + + NAN_INLINE void NanRemoveGCEpilogueCallback( + v8::Isolate::GCEpilogueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); + } + + NAN_INLINE void NanAddGCPrologueCallback( + v8::Isolate::GCPrologueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); + } + + NAN_INLINE void NanRemoveGCPrologueCallback( + v8::Isolate::GCPrologueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); + } + + NAN_INLINE void NanGetHeapStatistics( + v8::HeapStatistics *heap_statistics) { + v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( + const char* data, int length = -1) { + return NanNew(data, length); + } + + template + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , v8::Handle obj) { + handle.Reset(v8::Isolate::GetCurrent(), obj); + } + + template + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , const v8::Persistent& obj) { + handle.Reset(v8::Isolate::GetCurrent(), obj); + } + + template + class _NanWeakCallbackData; + + template + struct _NanWeakCallbackInfo { + typedef void (*Callback)(const _NanWeakCallbackData& data); + NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) + : parameter(param), callback(cb) { + NanAssignPersistent(persistent, handle); + } + + NAN_INLINE ~_NanWeakCallbackInfo() { + persistent.Reset(); + } + + P* const parameter; + Callback const callback; + v8::Persistent persistent; + }; + + template + class _NanWeakCallbackData { + public: + NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) + : info_(info) { } + + NAN_INLINE v8::Local GetValue() const { + return NanNew(info_->persistent); + } + + NAN_INLINE P* GetParameter() const { return info_->parameter; } + + NAN_INLINE bool IsNearDeath() const { + return info_->persistent.IsNearDeath(); + } + + NAN_INLINE void Revive() const; + + NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { + return info_; + } + + NAN_DEPRECATED NAN_INLINE void Dispose() const { + } + + private: + _NanWeakCallbackInfo* info_; + }; + + template + static void _NanWeakCallbackDispatcher( + const v8::WeakCallbackData > &data) { + _NanWeakCallbackInfo *info = data.GetParameter(); + _NanWeakCallbackData wcbd(info); + info->callback(wcbd); + if (wcbd.IsNearDeath()) { + delete wcbd.GetCallbackInfo(); + } + } + + template + NAN_INLINE void _NanWeakCallbackData::Revive() const { + info_->persistent.SetWeak(info_, &_NanWeakCallbackDispatcher); + } + +template +NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( + v8::Handle handle + , P* parameter + , typename _NanWeakCallbackInfo::Callback callback) { + _NanWeakCallbackInfo *cbinfo = + new _NanWeakCallbackInfo(handle, parameter, callback); + cbinfo->persistent.SetWeak(cbinfo, &_NanWeakCallbackDispatcher); + return cbinfo; +} + +# define NAN_WEAK_CALLBACK(name) \ + template \ + static void name(const _NanWeakCallbackData &data) + +# define _NAN_ERROR(fun, errmsg) fun(NanNew(errmsg)) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + v8::Isolate::GetCurrent()->ThrowException(_NAN_ERROR(fun, errmsg)); \ + } while (0); + + NAN_INLINE v8::Local 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 error) { + NanScope(); + v8::Isolate::GetCurrent()->ThrowException(error); + } + + NAN_INLINE v8::Local NanError( + const char *msg + , const int errorNumber + ) { + v8::Local err = v8::Exception::Error(NanNew(msg)); + v8::Local obj = err.As(); + obj->Set(NanNew("code"), NanNew(errorNumber)); + return err; + } + + NAN_INLINE void NanThrowError( + const char *msg + , const int errorNumber + ) { + NanThrowError(NanError(msg, errorNumber)); + } + + NAN_INLINE v8::Local 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 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 NAN_INLINE void NanDisposePersistent( + v8::Persistent &handle + ) { + handle.Reset(); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + char *data + , size_t length + , node::smalloc::FreeCallback callback + , void *hint + ) { + return node::Buffer::New( + v8::Isolate::GetCurrent(), data, length, callback, hint); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + const char *data + , uint32_t size + ) { + return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); + } + + NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { + return node::Buffer::New(v8::Isolate::GetCurrent(), size); + } + + NAN_INLINE v8::Local NanBufferUse( + char* data + , uint32_t size + ) { + return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); + } + + NAN_INLINE bool NanHasInstance( + const v8::Persistent& function_template + , v8::Handle value + ) { + return NanNew(function_template)->HasInstance(value); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle() + ) { + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + return v8::Local::New( + isolate + , v8::Context::New(isolate, extensions, tmpl, obj) + ); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + v8::ScriptCompiler::Source source(s, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + ) { + v8::ScriptCompiler::Source source(s); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + NAN_INLINE v8::Local NanRunScript( + v8::Handle script + ) { + return script->BindToCurrentContext()->Run(); + } + + NAN_INLINE v8::Local NanRunScript( + v8::Handle script + ) { + return script->Run(); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle func + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv)); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle symbol + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv)); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , const char* method + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv)); + } + + template + NAN_INLINE void NanSetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(0, data); + } + + template + NAN_INLINE T *NanGetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData(0)); + } + + class NanAsciiString { + public: + NAN_INLINE explicit NanAsciiString(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new char[size + 1]; + size = toStr->WriteOneByte(reinterpret_cast(buf)); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanAsciiString() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanAsciiString(const NanAsciiString&); + void operator=(const NanAsciiString&); + + char *buf; + int size; + }; + + class NanUtf8String { + public: + NAN_INLINE explicit NanUtf8String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Utf8Length(); + buf = new char[size + 1]; + toStr->WriteUtf8(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanUtf8String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUtf8String(const NanUtf8String&); + void operator=(const NanUtf8String&); + + char *buf; + int size; + }; + + class NanUcs2String { + public: + NAN_INLINE explicit NanUcs2String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new uint16_t[size + 1]; + toStr->Write(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE uint16_t* operator*() { return buf; } + NAN_INLINE const uint16_t* operator*() const { return buf; } + + NAN_INLINE ~NanUcs2String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUcs2String(const NanUcs2String&); + void operator=(const NanUcs2String&); + + uint16_t *buf; + int size; + }; + +#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 + +# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo & +# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +# define _NAN_GETTER_RETURN_TYPE v8::Handle + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + + NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( + const char* data, int length = -1) { + return v8::String::NewSymbol(data, length); + } + +# 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 NanReturnHolder() NanReturnValue(args.Holder()) +# define NanReturnThis() NanReturnValue(args.This()) +# define NanReturnUndefined() return v8::Undefined() +# define NanReturnNull() return v8::Null() +# define NanReturnEmptyString() return v8::String::Empty() +# define NanObjectWrapHandle(obj) v8::Local::New(obj->handle_) + + NAN_INLINE v8::Local NanUndefined() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Undefined())); + } + + NAN_INLINE v8::Local NanNull() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Null())); + } + + NAN_INLINE v8::Local NanTrue() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::True())); + } + + NAN_INLINE v8::Local NanFalse() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::False())); + } + + NAN_INLINE int NanAdjustExternalMemory(int bc) { + return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , const char *name + , v8::Handle value) { + templ->Set(name, value); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + NAN_INLINE v8::Local NanGetCurrentContext() { + return v8::Context::GetCurrent(); + } + + NAN_INLINE void* NanGetInternalFieldPointer( + v8::Handle object + , int index) { + return object->GetPointerFromInternalField(index); + } + + NAN_INLINE void NanSetInternalFieldPointer( + v8::Handle object + , int index + , void* value) { + object->SetPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::GCType type, v8::GCCallbackFlags flags) + + 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 + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , v8::Handle obj) { + handle.Dispose(); + handle = v8::Persistent::New(obj); + } + + template + class _NanWeakCallbackData; + + template + struct _NanWeakCallbackInfo { + typedef void (*Callback)(const _NanWeakCallbackData &data); + NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) + : parameter(param) + , callback(cb) + , persistent(v8::Persistent::New(handle)) { } + + NAN_INLINE ~_NanWeakCallbackInfo() { + persistent.Dispose(); + persistent.Clear(); + } + + P* const parameter; + Callback const callback; + v8::Persistent persistent; + }; + + template + class _NanWeakCallbackData { + public: + NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) + : info_(info) { } + + NAN_INLINE v8::Local GetValue() const { + return NanNew(info_->persistent); + } + + NAN_INLINE P* GetParameter() const { return info_->parameter; } + + NAN_INLINE bool IsNearDeath() const { + return info_->persistent.IsNearDeath(); + } + + NAN_INLINE void Revive() const; + + NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { + return info_; + } + + NAN_DEPRECATED NAN_INLINE void Dispose() const { + } + + private: + _NanWeakCallbackInfo* info_; + }; + + template + static void _NanWeakPersistentDispatcher( + v8::Persistent object, void *data) { + _NanWeakCallbackInfo* info = + static_cast<_NanWeakCallbackInfo*>(data); + _NanWeakCallbackData wcbd(info); + info->callback(wcbd); + if (wcbd.IsNearDeath()) { + delete wcbd.GetCallbackInfo(); + } + } + + template + NAN_INLINE void _NanWeakCallbackData::Revive() const { + info_->persistent.MakeWeak( + info_ + , &_NanWeakPersistentDispatcher); + } + + template + NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( + v8::Handle handle + , P* parameter + , typename _NanWeakCallbackInfo::Callback callback) { + _NanWeakCallbackInfo *cbinfo = + new _NanWeakCallbackInfo(handle, parameter, callback); + cbinfo->persistent.MakeWeak( + cbinfo + , &_NanWeakPersistentDispatcher); + return cbinfo; + } + +# define NAN_WEAK_CALLBACK(name) \ + template \ + static void name(const _NanWeakCallbackData &data) + +# define _NAN_ERROR(fun, errmsg) \ + fun(v8::String::New(errmsg)) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + return v8::Local::New( \ + v8::ThrowException(_NAN_ERROR(fun, errmsg))); \ + } while (0); + + NAN_INLINE v8::Local NanError(const char* errmsg) { + return _NAN_ERROR(v8::Exception::Error, errmsg); + } + + NAN_INLINE v8::Local NanThrowError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::Error, errmsg); + } + + NAN_INLINE v8::Local NanThrowError( + v8::Handle error + ) { + NanScope(); + return v8::Local::New(v8::ThrowException(error)); + } + + NAN_INLINE v8::Local NanError( + const char *msg + , const int errorNumber + ) { + v8::Local err = v8::Exception::Error(v8::String::New(msg)); + v8::Local obj = err.As(); + obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber)); + return err; + } + + NAN_INLINE v8::Local NanThrowError( + const char *msg + , const int errorNumber + ) { + return NanThrowError(NanError(msg, errorNumber)); + } + + NAN_INLINE v8::Local NanTypeError(const char* errmsg) { + return _NAN_ERROR(v8::Exception::TypeError, errmsg); + } + + NAN_INLINE v8::Local NanThrowTypeError( + const char* errmsg + ) { + _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); + } + + NAN_INLINE v8::Local NanRangeError( + const char* errmsg + ) { + return _NAN_ERROR(v8::Exception::RangeError, errmsg); + } + + NAN_INLINE v8::Local NanThrowRangeError( + const char* errmsg + ) { + _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); + } + + template + NAN_INLINE void NanDisposePersistent( + v8::Persistent &handle) { // NOLINT(runtime/references) + handle.Dispose(); + handle.Clear(); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + char *data + , size_t length + , node::Buffer::free_callback callback + , void *hint + ) { + return NanNew( + node::Buffer::New(data, length, callback, hint)->handle_); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + const char *data + , uint32_t size + ) { +#if NODE_MODULE_VERSION >= 0x000B + return NanNew(node::Buffer::New(data, size)->handle_); +#else + return NanNew( + node::Buffer::New(const_cast(data), size)->handle_); +#endif + } + + NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { + return NanNew(node::Buffer::New(size)->handle_); + } + + NAN_INLINE void FreeData(char *data, void *hint) { + delete[] data; + } + + NAN_INLINE v8::Local NanBufferUse( + char* data + , uint32_t size + ) { + return NanNew( + node::Buffer::New(data, size, FreeData, NULL)->handle_); + } + + NAN_INLINE bool NanHasInstance( + const v8::Persistent& function_template + , v8::Handle value + ) { + return function_template->HasInstance(value); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle() + ) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = NanNew(ctx); + ctx.Dispose(); + return lctx; + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + return v8::Script::Compile(s, const_cast(&origin)); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + ) { + return v8::Script::Compile(s); + } + + NAN_INLINE v8::Local NanRunScript(v8::Handle script) { + return script->Run(); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle func + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, func, argc, argv)); +# else + v8::TryCatch try_catch; + v8::Local result = func->Call(target, argc, argv); + if (try_catch.HasCaught()) { + node::FatalException(try_catch); + } + return result; +# endif + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle symbol + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, symbol, argc, argv)); +# else + v8::Local callback = target->Get(symbol).As(); + return NanMakeCallback(target, callback, argc, argv); +# endif + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , const char* method + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, method, argc, argv)); +# else + return NanMakeCallback(target, NanNew(method), argc, argv); +# endif + } + + template + NAN_INLINE void NanSetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(data); + } + + template + NAN_INLINE T *NanGetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData()); + } + + class NanAsciiString { + public: + NAN_INLINE explicit NanAsciiString(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new char[size + 1]; + size = toStr->WriteAscii(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanAsciiString() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanAsciiString(const NanAsciiString&); + void operator=(const NanAsciiString&); + + char *buf; + int size; + }; + + class NanUtf8String { + public: + NAN_INLINE explicit NanUtf8String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Utf8Length(); + buf = new char[size + 1]; + toStr->WriteUtf8(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanUtf8String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUtf8String(const NanUtf8String&); + void operator=(const NanUtf8String&); + + char *buf; + int size; + }; + + class NanUcs2String { + public: + NAN_INLINE explicit NanUcs2String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new uint16_t[size + 1]; + toStr->Write(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE uint16_t* operator*() { return buf; } + NAN_INLINE const uint16_t* operator*() const { return buf; } + + NAN_INLINE ~NanUcs2String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUcs2String(const NanUcs2String&); + void operator=(const NanUcs2String&); + + uint16_t *buf; + int size; + }; + +#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 property \ + , _NAN_GETTER_ARGS) +#define NAN_SETTER(name) \ + _NAN_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local value \ + , _NAN_SETTER_ARGS) +#define NAN_PROPERTY_GETTER(name) \ + _NAN_PROPERTY_GETTER_RETURN_TYPE name( \ + v8::Local property \ + , _NAN_PROPERTY_GETTER_ARGS) +#define NAN_PROPERTY_SETTER(name) \ + _NAN_PROPERTY_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local 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 property \ + , _NAN_PROPERTY_DELETER_ARGS) +#define NAN_PROPERTY_QUERY(name) \ + _NAN_PROPERTY_QUERY_RETURN_TYPE name( \ + v8::Local 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 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 obj = NanNew(); + NanAssignPersistent(handle, obj); + } + + explicit NanCallback(const v8::Handle &fn) { + NanScope(); + v8::Local obj = NanNew(); + NanAssignPersistent(handle, obj); + SetFunction(fn); + } + + ~NanCallback() { + if (handle.IsEmpty()) return; + NanDisposePersistent(handle); + } + + NAN_INLINE void SetFunction(const v8::Handle &fn) { + NanScope(); + NanNew(handle)->Set(kCallbackIndex, fn); + } + + NAN_INLINE v8::Local GetFunction() const { + NanEscapableScope(); + return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex) + .As()); + } + + NAN_INLINE bool IsEmpty() const { + NanScope(); + return NanNew(handle)->Get(kCallbackIndex)->IsUndefined(); + } + + v8::Handle Call(int argc, v8::Handle argv[]) const { + NanEscapableScope(); +#if (NODE_MODULE_VERSION > 0x000B) // 0.11.12+ + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Local callback = NanNew(handle)-> + Get(kCallbackIndex).As(); + return NanEscapeScope(node::MakeCallback( + isolate + , isolate->GetCurrentContext()->Global() + , callback + , argc + , argv + )); +#else +#if NODE_VERSION_AT_LEAST(0, 8, 0) + v8::Local callback = handle-> + Get(kCallbackIndex).As(); + return NanEscapeScope(node::MakeCallback( + v8::Context::GetCurrent()->Global() + , callback + , argc + , argv + )); +#else + v8::Local callback = handle-> + Get(kCallbackIndex).As(); + return NanEscapeScope(NanMakeCallback( + v8::Context::GetCurrent()->Global(), callback, argc, argv)); +#endif +#endif + } + + private: + v8::Persistent handle; + static const uint32_t kCallbackIndex = 0; +}; + +/* abstract */ class NanAsyncWorker { + public: + explicit NanAsyncWorker(NanCallback *callback_) + : callback(callback_), errmsg_(NULL) { + request.data = this; + + NanScope(); + v8::Local obj = NanNew(); + 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, const v8::Local &obj) { + v8::Local handle = NanNew(persistentHandle); + handle->Set(NanNew(key), obj); + } + + v8::Local GetFromPersistent(const char *key) const { + NanEscapableScope(); + v8::Local handle = NanNew(persistentHandle); + return NanEscapeScope(handle->Get(NanNew(key)).As()); + } + + virtual void Execute() = 0; + + uv_work_t request; + + virtual void Destroy() { + delete this; + } + + protected: + v8::Persistent persistentHandle; + NanCallback *callback; + + virtual void HandleOKCallback() { + callback->Call(0, NULL); + } + + virtual void HandleErrorCallback() { + NanScope(); + + v8::Local argv[] = { + v8::Exception::Error(NanNew(ErrorMessage())) + }; + callback->Call(1, argv); + } + + void SetErrorMessage(const char *msg) { + if (errmsg_) { + delete[] errmsg_; + } + + size_t size = strlen(msg) + 1; + errmsg_ = new char[size]; + memcpy(errmsg_, msg, size); + } + + const char* ErrorMessage() const { + return errmsg_; + } + + private: + char *errmsg_; +}; + +/* abstract */ class NanAsyncProgressWorker : public NanAsyncWorker { + public: + explicit NanAsyncProgressWorker(NanCallback *callback_) + : NanAsyncWorker(callback_), asyncdata_(NULL), asyncsize_(0) { + async = new uv_async_t; + uv_async_init( + uv_default_loop() + , async + , AsyncProgress_ + ); + async->data = this; + + uv_mutex_init(&async_lock); + } + + virtual ~NanAsyncProgressWorker() { + uv_mutex_destroy(&async_lock); + + if (asyncdata_) { + delete[] asyncdata_; + } + } + + void WorkProgress() { + uv_mutex_lock(&async_lock); + char *data = asyncdata_; + size_t size = asyncsize_; + asyncdata_ = NULL; + uv_mutex_unlock(&async_lock); + + // Dont send progress events after we've already completed. + if (callback) { + HandleProgressCallback(data, size); + } + delete[] data; + } + + class ExecutionProgress { + friend class NanAsyncProgressWorker; + public: + // You could do fancy generics with templates here. + void Send(const char* data, size_t size) const { + that_->SendProgress_(data, size); + } + + private: + explicit ExecutionProgress(NanAsyncProgressWorker* that) : that_(that) {} + // Prohibit copying and assignment. + ExecutionProgress(const ExecutionProgress&); + void operator=(const ExecutionProgress&); + #if __cplusplus >= 201103L + // Prohibit C++11 move semantics. + ExecutionProgress(ExecutionProgress&&) = delete; + void operator=(ExecutionProgress&&) = delete; + #endif + NanAsyncProgressWorker* const that_; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void HandleProgressCallback(const char *data, size_t size) = 0; + + virtual void Destroy() { + uv_close(reinterpret_cast(async), AsyncClose_); + } + + private: + void Execute() /*final override*/ { + ExecutionProgress progress(this); + Execute(progress); + } + + void SendProgress_(const char *data, size_t size) { + char *new_data = new char[size]; + memcpy(new_data, data, size); + + uv_mutex_lock(&async_lock); + char *old_data = asyncdata_; + asyncdata_ = new_data; + asyncsize_ = size; + uv_mutex_unlock(&async_lock); + + if (old_data) { + delete[] old_data; + } + uv_async_send(async); + } + + NAN_INLINE static NAUV_WORK_CB(AsyncProgress_) { + NanAsyncProgressWorker *worker = + static_cast(async->data); + worker->WorkProgress(); + } + + NAN_INLINE static void AsyncClose_(uv_handle_t* handle) { + NanAsyncProgressWorker *worker = + static_cast(handle->data); + delete reinterpret_cast(handle); + delete worker; + } + + uv_async_t *async; + uv_mutex_t async_lock; + char *asyncdata_; + size_t asyncsize_; +}; + +NAN_INLINE void NanAsyncExecute (uv_work_t* req) { + NanAsyncWorker *worker = static_cast(req->data); + worker->Execute(); +} + +NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) { + NanAsyncWorker* worker = static_cast(req->data); + worker->WorkComplete(); + worker->Destroy(); +} + +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 +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 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 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(-1); +} + +template 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; +} + +namespace NanIntern { + +inline +NanExternalOneByteStringResource const* +GetExternalResource(v8::Local str) { +#if NODE_MODULE_VERSION < 42 + return str->GetExternalAsciiStringResource(); +#else // io.js v1.0.0 + return str->GetExternalOneByteStringResource(); +#endif +} + +inline +bool +IsExternal(v8::Local str) { +#if NODE_MODULE_VERSION < 42 + return str->IsExternalAscii(); +#else // io.js v1.0.0 + return str->IsExternalOneByte(); +#endif +} + +} // end of namespace NanIntern + +static bool _NanGetExternalParts( + v8::Handle val + , const char** data + , size_t* len +) { + if (node::Buffer::HasInstance(val)) { + *data = node::Buffer::Data(val.As()); + *len = node::Buffer::Length(val.As()); + return true; + } + + assert(val->IsString()); + v8::Local str = NanNew(val.As()); + + if (NanIntern::IsExternal(str)) { + const NanExternalOneByteStringResource* ext; + ext = NanIntern::GetExternalResource(str); + *data = ext->data(); + *len = ext->length(); + return true; + } + + if (str->IsExternal()) { + const v8::String::ExternalStringResource* ext; + ext = str->GetExternalStringResource(); + *data = reinterpret_cast(ext->data()); + *len = ext->length(); + return true; + } + + return false; +} + +namespace Nan { + enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; +} + +#if !NODE_VERSION_AT_LEAST(0, 10, 0) +# include "nan_string_bytes.h" // NOLINT(build/include) +#endif + +NAN_INLINE v8::Local NanEncode( + const void *buf, size_t len, enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION >= 42) + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + node::encoding node_enc = static_cast(encoding); + + if (encoding == Nan::UCS2) { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len / 2); + } else { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len + , node_enc); + } +#elif (NODE_MODULE_VERSION > 0x000B) + return node::Encode( + v8::Isolate::GetCurrent() + , buf, len + , static_cast(encoding)); +#else +# if NODE_VERSION_AT_LEAST(0, 10, 0) + return node::Encode(buf, len, static_cast(encoding)); +# else + return NanIntern::Encode(reinterpret_cast(buf), len, encoding); +# endif +#endif +} + +NAN_INLINE ssize_t NanDecodeBytes( + v8::Handle val, enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION > 0x000B) + return node::DecodeBytes( + v8::Isolate::GetCurrent() + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < 0x000B) + if (encoding == Nan::BUFFER) { + return node::DecodeBytes(val, node::BINARY); + } +# endif + return node::DecodeBytes(val, static_cast(encoding)); +#endif +} + +NAN_INLINE ssize_t NanDecodeWrite( + char *buf + , size_t len + , v8::Handle val + , enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION > 0x000B) + return node::DecodeWrite( + v8::Isolate::GetCurrent() + , buf + , len + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < 0x000B) + if (encoding == Nan::BUFFER) { + return node::DecodeWrite(buf, len, val, node::BINARY); + } +# endif + return node::DecodeWrite( + buf + , len + , val + , static_cast(encoding)); +#endif +} + +/* NAN_DEPRECATED */ NAN_INLINE void* _NanRawString( + v8::Handle 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(&data) + , &len); + + if (is_extern && !term_len) { + NanSetPointerSafe(datalen, len); + return data; + } + + v8::Local toStr = from->ToString(); + + char *to = static_cast(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( + datalen + , toStr->WriteAscii(to, 0, static_cast(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 somelen = toStr->Write(twobytebuf, 0, + static_cast(sz_ + term_len), flags); + + for (size_t i = 0; i < sz_ + term_len && i < somelen + term_len; i++) { + unsigned char *b = reinterpret_cast(&twobytebuf[i]); + to[i] = *b; + } + + NanSetPointerSafe(datalen, somelen); + + delete[] twobytebuf; + return to; + } +#else + NanSetPointerSafe( + datalen, + toStr->WriteOneByte( + reinterpret_cast(to) + , 0 + , static_cast(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( + datalen + , toStr->WriteUtf8(to, static_cast(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( + 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(to) + , 0 + , static_cast(sz_ + term_len) + , flags); + NanSetPointerSafe(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( + 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_DEPRECATED NAN_INLINE void* NanRawString( + v8::Handle from + , enum Nan::Encoding encoding + , size_t *datalen + , void *buf + , size_t buflen + , int flags +) { + return _NanRawString(from, encoding, datalen, buf, buflen, flags); +} + + +NAN_DEPRECATED NAN_INLINE char* NanCString( + v8::Handle from + , size_t *datalen + , char *buf = NULL + , size_t buflen = 0 + , int flags = v8::String::NO_OPTIONS +) { + return static_cast( + _NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags) + ); +} + +NAN_INLINE void NanSetPrototypeTemplate( + v8::Local templ + , const char *name + , v8::Handle value +) { + NanSetTemplate(templ->PrototypeTemplate(), name, value); +} + +NAN_INLINE void NanSetPrototypeTemplate( + v8::Local templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes +) { + NanSetTemplate(templ->PrototypeTemplate(), name, value, attributes); +} + +NAN_INLINE void NanSetInstanceTemplate( + v8::Local templ + , const char *name + , v8::Handle value +) { + NanSetTemplate(templ->InstanceTemplate(), name, value); +} + +NAN_INLINE void NanSetInstanceTemplate( + v8::Local templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes +) { + NanSetTemplate(templ->InstanceTemplate(), name, value, attributes); +} + +//=== Export ================================================================== + +inline +void +NanExport(v8::Handle target, const char * name, + NanFunctionCallback f) { + target->Set(NanNew(name), + NanNew(f)->GetFunction()); +} + +//=== Tap Reverse Binding ===================================================== + +struct NanTap { + explicit NanTap(v8::Handle t) : t_() { + NanAssignPersistent(t_, t->ToObject()); + } + + ~NanTap() { NanDisposePersistent(t_); } // not sure if neccessary + + inline void plan(int i) { + v8::Handle arg = NanNew(i); + NanMakeCallback(NanNew(t_), "plan", 1, &arg); + } + + inline void ok(bool isOk, const char * msg = NULL) { + v8::Handle args[2]; + args[0] = NanNew(isOk); + if (msg) args[1] = NanNew(msg); + NanMakeCallback(NanNew(t_), "ok", msg ? 2 : 1, args); + } + + private: + v8::Persistent t_; +}; + +#define NAN_STRINGIZE2(x) #x +#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) +#define NAN_TEST_EXPRESSION(expression) \ + ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression + +#define return_NanValue(v) NanReturnValue(v) +#define return_NanUndefined() NanReturnUndefined() +#define NAN_EXPORT(target, function) NanExport(target, #function, function) + +#endif // NAN_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_12_inl.h b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_12_inl.h new file mode 100644 index 00000000..ff63ec0c --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_12_inl.h @@ -0,0 +1,262 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_12_INL_H_ +#define NAN_IMPLEMENTATION_12_INL_H_ +//============================================================================== +// node v0.11 implementation +//============================================================================== + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +namespace NanIntern { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(v8::Isolate::GetCurrent(), length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(v8::Isolate::GetCurrent(), value); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Handle tmpl + , v8::Handle obj) { + return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj); +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(v8::Isolate::GetCurrent(), value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(v8::Isolate::GetCurrent(), value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data) { + return v8::Function::New( v8::Isolate::GetCurrent() + , callback + , data); +} + +//=== Function Template ======================================================== + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data + , v8::Handle signature) { + return v8::FunctionTemplate::New( v8::Isolate::GetCurrent() + , callback + , data + , signature); +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(v8::Isolate::GetCurrent(), value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New( v8::Isolate::GetCurrent() + , value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(v8::Isolate::GetCurrent(), value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(v8::Isolate::GetCurrent()); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(v8::Isolate::GetCurrent()); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Handle pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New( Factory::FTH receiver + , int argc + , Factory::FTH argv[]) { + return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), + value.data(), v8::String::kNormalString, static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint8_t * value, int length) { + return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +Factory::return_t +Factory::New(NanExternalOneByteStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Handle value) { + return v8::StringObject::New(value).As(); +} + +//=== Unbound Script =========================================================== + +Factory::return_t +Factory::New(v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +} // end of namespace NanIntern + +//=== Presistents and Handles ================================================== + +template +inline v8::Local NanNew(v8::Handle h) { + return v8::Local::New(v8::Isolate::GetCurrent(), h); +} + +template +inline v8::Local NanNew(v8::Persistent const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +#endif // NAN_IMPLEMENTATION_12_INL_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_pre_12_inl.h b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_pre_12_inl.h new file mode 100644 index 00000000..85dd2754 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_pre_12_inl.h @@ -0,0 +1,268 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_ +#define NAN_IMPLEMENTATION_PRE_12_INL_H_ + +#include + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# include +# pragma warning( default : 4530 ) +#else +# include +# include +#endif + +//============================================================================== +// node v0.10 implementation +//============================================================================== + +namespace NanIntern { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(value)->ToBoolean(); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Handle tmpl + , v8::Handle obj) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = v8::Local::New(ctx); + ctx.Dispose(); + return lctx; +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data) { + return Factory::New( callback + , data + , v8::Handle() + )->GetFunction(); +} + + +//=== FunctionTemplate ========================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data + , v8::Handle signature) { + // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find + // a way. Have at it though... + return v8::FunctionTemplate::New( callback + , data + , signature); +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New(value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Handle pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + return v8::Script::New(source); +} +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + return v8::Script::New(source, const_cast(&origin)); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New( Factory::FTH receiver + , int argc + , Factory::FTH argv[]) { + return v8::Signature::New(receiver, argc, argv); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::New( value.data(), static_cast(value.size())); +} + +inline +void +widenString(std::vector *ws, const uint8_t *s, int l = -1) { + size_t len = static_cast(l); + if (l < 0) { + len = strlen(reinterpret_cast(s)); + } + assert(len <= INT_MAX && "string too long"); + ws->resize(len); + std::copy(s, s + len, ws->begin()); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(const uint8_t * value, int length) { + std::vector wideString; + widenString(&wideString, value, length); + if (wideString.size() == 0) { + return v8::String::Empty(); + } else { + return v8::String::New(&wideString.front() + , static_cast(wideString.size())); + } +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(value); +} + +Factory::return_t +Factory::New(v8::String::ExternalAsciiStringResource * value) { + return v8::String::NewExternal(value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Handle value) { + return v8::StringObject::New(value).As(); +} + +} // end of namespace NanIntern + +//=== Presistents and Handles ================================================== + +template +inline v8::Local NanNew(v8::Handle h) { + return v8::Local::New(h); +} + +template +inline v8::Local NanNew(v8::Persistent const& p) { + return v8::Local::New(p); +} + +#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_new.h b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_new.h new file mode 100644 index 00000000..95b6b51e --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_new.h @@ -0,0 +1,329 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_NEW_H_ +#define NAN_NEW_H_ + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +namespace NanIntern { // scnr + +// TODO(agnat): Generalize +template v8::Local To(v8::Handle i); + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToInteger(); } + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToInt32(); } + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToUint32(); } + +template struct FactoryBase { typedef v8::Local return_t; }; + +template struct Factory; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(int length); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(void *value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( NanFunctionCallback callback + , v8::Handle data = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( NanFunctionCallback callback = NULL + , v8::Handle data = v8::Handle() + , v8::Handle signature = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template +struct IntegerFactory : FactoryBase { + typedef typename FactoryBase::return_t return_t; + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New( + v8::Handle pattern, v8::RegExp::Flags flags); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +template <> +struct Factory : FactoryBase { + typedef v8::Handle FTH; + static inline + return_t + New( FTH receiver = FTH(), int argc = 0, FTH argv[] = NULL ); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(const char *value, int length = -1); + static inline return_t New(const uint16_t *value, int length = -1); + static inline return_t New(std::string const& value); + + static inline return_t New(v8::String::ExternalStringResource * value); + static inline return_t New(NanExternalOneByteStringResource * value); + + // TODO(agnat): Deprecate. + static inline return_t New(const uint8_t * value, int length = -1); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(v8::Handle value); +}; + +} // end of namespace NanIntern + +#if (NODE_MODULE_VERSION >= 12) + +namespace NanIntern { + +template <> +struct Factory : FactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +} // end of namespace NanIntern + +# include "nan_implementation_12_inl.h" + +#else // NODE_MODULE_VERSION >= 12 + +# include "nan_implementation_pre_12_inl.h" + +#endif + +//=== API ====================================================================== + +template +typename NanIntern::Factory::return_t +NanNew() { + return NanIntern::Factory::New(); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0) { + return NanIntern::Factory::New(arg0); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1) { + return NanIntern::Factory::New(arg0, arg1); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1, A2 arg2) { + return NanIntern::Factory::New(arg0, arg1, arg2); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1, A2 arg2, A3 arg3) { + return NanIntern::Factory::New(arg0, arg1, arg2, arg3); +} + +// Note(agnat): When passing overloaded function pointers to template functions +// as generic arguments the compiler needs help in picking the right overload. +// These two functions handle NanNew and NanNew with +// all argument variations. + +// v8::Function and v8::FunctionTemplate with one or two arguments +template +typename NanIntern::Factory::return_t +NanNew( NanFunctionCallback callback + , v8::Handle data = v8::Handle()) { + return NanIntern::Factory::New(callback, data); +} + +// v8::Function and v8::FunctionTemplate with three arguments +template +typename NanIntern::Factory::return_t +NanNew( NanFunctionCallback callback + , v8::Handle data = v8::Handle() + , A2 a2 = A2()) { + return NanIntern::Factory::New(callback, data, a2); +} + +// Convenience + +template inline v8::Local NanNew(v8::Handle h); +template inline v8::Local NanNew(v8::Persistent const& p); + +inline +NanIntern::Factory::return_t +NanNew(bool value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(int32_t value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(uint32_t value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(double value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(std::string const& value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const char * value, int length) { + return NanNew(value, length); +} + +inline +NanIntern::Factory::return_t +NanNew(const char * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const uint8_t * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const uint16_t * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(v8::String::ExternalStringResource * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(NanExternalOneByteStringResource * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(v8::Handle pattern, v8::RegExp::Flags flags) { + return NanNew(pattern, flags); +} + +#endif // NAN_NEW_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_string_bytes.h b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_string_bytes.h new file mode 100644 index 00000000..9deecfbb --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_string_bytes.h @@ -0,0 +1,312 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +#ifndef NAN_STRING_BYTES_H_ +#define NAN_STRING_BYTES_H_ + +// Decodes a v8::Handle or Buffer to a raw char* + +#include +#include +#include +#include // memcpy +#include + +namespace NanIntern { + +using v8::Local; +using v8::Handle; +using v8::Object; +using v8::String; +using v8::Value; + + +//// Base 64 //// + +#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) + + + +//// Nan::HEX //// + +static bool contains_non_ascii_slow(const char* buf, size_t len) { + for (size_t i = 0; i < len; ++i) { + if (buf[i] & 0x80) return true; + } + return false; +} + + +static bool contains_non_ascii(const char* src, size_t len) { + if (len < 16) { + return contains_non_ascii_slow(src, len); + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned unaligned = reinterpret_cast(src) & align_mask; + + if (unaligned > 0) { + const unsigned n = bytes_per_word - unaligned; + if (contains_non_ascii_slow(src, n)) return true; + src += n; + len -= n; + } + + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = 0x8080808080808080ll; +#else + const uintptr_t mask = 0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + if (srcw[i] & mask) return true; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + if (contains_non_ascii_slow(src + offset, remainder)) return true; + } + + return false; +} + + +static void force_ascii_slow(const char* src, char* dst, size_t len) { + for (size_t i = 0; i < len; ++i) { + dst[i] = src[i] & 0x7f; + } +} + + +static void force_ascii(const char* src, char* dst, size_t len) { + if (len < 16) { + force_ascii_slow(src, dst, len); + return; + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned src_unalign = reinterpret_cast(src) & align_mask; + const unsigned dst_unalign = reinterpret_cast(dst) & align_mask; + + if (src_unalign > 0) { + if (src_unalign == dst_unalign) { + const unsigned unalign = bytes_per_word - src_unalign; + force_ascii_slow(src, dst, unalign); + src += unalign; + dst += unalign; + len -= src_unalign; + } else { + force_ascii_slow(src, dst, len); + return; + } + } + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = ~0x8080808080808080ll; +#else + const uintptr_t mask = ~0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + uintptr_t* dstw = reinterpret_cast(dst); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + dstw[i] = srcw[i] & mask; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + force_ascii_slow(src + offset, dst + offset, remainder); + } +} + + +static size_t base64_encode(const char* src, + size_t slen, + char* dst, + size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= base64_encoded_size(slen) && + "not enough space provided for base64 encode"); + + dlen = base64_encoded_size(slen); + + unsigned a; + unsigned b; + unsigned c; + unsigned i; + unsigned k; + unsigned n; + + static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + + i = 0; + k = 0; + n = slen / 3 * 3; + + while (i < n) { + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + c = src[i + 2] & 0xff; + + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; + dst[k + 3] = table[c & 0x3f]; + + i += 3; + k += 4; + } + + if (n != slen) { + switch (slen - n) { + case 1: + a = src[i + 0] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[(a & 3) << 4]; + dst[k + 2] = '='; + dst[k + 3] = '='; + break; + + case 2: + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[(b & 0x0f) << 2]; + dst[k + 3] = '='; + break; + } + } + + return dlen; +} + + +static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= slen * 2 && + "not enough space provided for hex encode"); + + dlen = slen * 2; + for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { + static const char hex[] = "0123456789abcdef"; + uint8_t val = static_cast(src[i]); + dst[k + 0] = hex[val >> 4]; + dst[k + 1] = hex[val & 15]; + } + + return dlen; +} + + + +static Local Encode(const char* buf, + size_t buflen, + enum Nan::Encoding encoding) { + assert(buflen <= node::Buffer::kMaxLength); + if (!buflen && encoding != Nan::BUFFER) + return NanNew(""); + + Local val; + switch (encoding) { + case Nan::BUFFER: + return NanNewBufferHandle(buf, buflen); + + case Nan::ASCII: + if (contains_non_ascii(buf, buflen)) { + char* out = new char[buflen]; + force_ascii(buf, out, buflen); + val = NanNew(out, buflen); + delete[] out; + } else { + val = NanNew(buf, buflen); + } + break; + + case Nan::UTF8: + val = NanNew(buf, buflen); + break; + + case Nan::BINARY: { + // TODO(isaacs) use ExternalTwoByteString? + const unsigned char *cbuf = reinterpret_cast(buf); + uint16_t * twobytebuf = new uint16_t[buflen]; + for (size_t i = 0; i < buflen; i++) { + // XXX is the following line platform independent? + twobytebuf[i] = cbuf[i]; + } + val = NanNew(twobytebuf, buflen); + delete[] twobytebuf; + break; + } + + case Nan::BASE64: { + size_t dlen = base64_encoded_size(buflen); + char* dst = new char[dlen]; + + size_t written = base64_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = NanNew(dst, dlen); + delete[] dst; + break; + } + + case Nan::UCS2: { + const uint16_t* data = reinterpret_cast(buf); + val = NanNew(data, buflen / 2); + break; + } + + case Nan::HEX: { + size_t dlen = buflen * 2; + char* dst = new char[dlen]; + size_t written = hex_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = NanNew(dst, dlen); + delete[] dst; + break; + } + + default: + assert(0 && "unknown encoding"); + break; + } + + return val; +} + +#undef base64_encoded_size + +} // namespace NanIntern + +#endif // NAN_STRING_BYTES_H_ diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/package.json b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/package.json new file mode 100644 index 00000000..02953f62 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/package.json @@ -0,0 +1,89 @@ +{ + "name": "nan", + "version": "1.6.2", + "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" + }, + "scripts": { + "test": "tap --gc test/js/*-test.js", + "rebuild-tests": "pangyp rebuild --directory test" + }, + "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" + }, + { + "name": "David Siegel", + "email": "david@artcom.de", + "url": "https://github.com/agnat" + } + ], + "devDependencies": { + "bindings": "~1.2.1", + "node-gyp": "~1.0.2", + "pangyp": "~2.0.1", + "tap": "~0.5.0", + "xtend": "~4.0.0" + }, + "license": "MIT", + "gitHead": "ab0e5eed8d4aa36111bf8f44cf75644ece327e98", + "bugs": { + "url": "https://github.com/rvagg/nan/issues" + }, + "homepage": "https://github.com/rvagg/nan", + "_id": "nan@1.6.2", + "_shasum": "2657d1c43b00f1e847e083832285b7d8f5ba8ec8", + "_from": "nan@>=1.6.0 <1.7.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + }, + "maintainers": [ + { + "name": "rvagg", + "email": "rod@vagg.org" + }, + { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + } + ], + "dist": { + "shasum": "2657d1c43b00f1e847e083832285b7d8f5ba8ec8", + "tarball": "http://registry.npmjs.org/nan/-/nan-1.6.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/nan/-/nan-1.6.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/package.json b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/package.json new file mode 100644 index 00000000..1898d9d3 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/package.json @@ -0,0 +1,63 @@ +{ + "name": "utf-8-validate", + "version": "1.0.1", + "description": "Validate UTF-8 for Web", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "install": "node-gyp rebuild" + }, + "repository": { + "type": "git", + "url": "https://github.com/websockets/utf-8-validate" + }, + "keywords": [ + "utf-8-validate" + ], + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/websockets/utf-8-validate/issues" + }, + "homepage": "https://github.com/websockets/utf-8-validate", + "dependencies": { + "bindings": "1.2.x", + "nan": "1.6.x" + }, + "gypfile": true, + "gitHead": "1c0a74c3f2a8bb9e5b14df235404faa3760abce3", + "_id": "utf-8-validate@1.0.1", + "_shasum": "d15eb67e28f6bb93c9401eeb7eac7030a183e8d1", + "_from": "utf-8-validate@>=1.0.0 <1.1.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + }, + "maintainers": [ + { + "name": "einaros", + "email": "einaros@gmail.com" + }, + { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + }, + { + "name": "v1", + "email": "info@3rd-Eden.com" + } + ], + "dist": { + "shasum": "d15eb67e28f6bb93c9401eeb7eac7030a183e8d1", + "tarball": "http://registry.npmjs.org/utf-8-validate/-/utf-8-validate-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/src/validation.cc b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/src/validation.cc new file mode 100644 index 00000000..264edcd7 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/node_modules/utf-8-validate/src/validation.cc @@ -0,0 +1,148 @@ +/*! + * UTF-8 validate: UTF-8 validation for WebSockets. + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "nan.h" + +using namespace v8; +using namespace node; + +#define UNI_SUR_HIGH_START (uint32_t) 0xD800 +#define UNI_SUR_LOW_END (uint32_t) 0xDFFF +#define UNI_REPLACEMENT_CHAR (uint32_t) 0x0000FFFD +#define UNI_MAX_LEGAL_UTF32 (uint32_t) 0x0010FFFF + +static const uint8_t trailingBytesForUTF8[256] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 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, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 +}; + +static const uint32_t offsetsFromUTF8[6] = { + 0x00000000, 0x00003080, 0x000E2080, + 0x03C82080, 0xFA082080, 0x82082080 +}; + +static int isLegalUTF8(const uint8_t *source, const int length) +{ + uint8_t a; + const uint8_t *srcptr = source+length; + switch (length) { + default: return 0; + /* Everything else falls through when "true"... */ + /* RFC3629 makes 5 & 6 bytes UTF-8 illegal + case 6: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; + case 5: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; */ + case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; + case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; + case 2: if ((a = (*--srcptr)) > 0xBF) return 0; + switch (*source) { + /* no fall-through in this inner switch */ + case 0xE0: if (a < 0xA0) return 0; break; + case 0xED: if (a > 0x9F) return 0; break; + case 0xF0: if (a < 0x90) return 0; break; + case 0xF4: if (a > 0x8F) return 0; break; + default: if (a < 0x80) return 0; + } + + case 1: if (*source >= 0x80 && *source < 0xC2) return 0; + } + if (*source > 0xF4) return 0; + return 1; +} + +int is_valid_utf8 (size_t len, char *value) +{ + /* is the string valid UTF-8? */ + for (unsigned int i = 0; i < len; i++) { + uint32_t ch = 0; + uint8_t extrabytes = trailingBytesForUTF8[(uint8_t) value[i]]; + + if (extrabytes + i >= len) + return 0; + + if (isLegalUTF8 ((uint8_t *) (value + i), extrabytes + 1) == 0) return 0; + + switch (extrabytes) { + case 5 : ch += (uint8_t) value[i++]; ch <<= 6; + case 4 : ch += (uint8_t) value[i++]; ch <<= 6; + case 3 : ch += (uint8_t) value[i++]; ch <<= 6; + case 2 : ch += (uint8_t) value[i++]; ch <<= 6; + case 1 : ch += (uint8_t) value[i++]; ch <<= 6; + case 0 : ch += (uint8_t) value[i]; + } + + ch -= offsetsFromUTF8[extrabytes]; + + if (ch <= UNI_MAX_LEGAL_UTF32) { + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) + return 0; + } else { + return 0; + } + } + + return 1; +} + +class Validation : public ObjectWrap +{ +public: + + static void Initialize(v8::Handle target) + { + NanScope(); + Local t = NanNew(New); + t->InstanceTemplate()->SetInternalFieldCount(1); + NODE_SET_METHOD(t, "isValidUTF8", Validation::IsValidUTF8); + target->Set(NanNew("Validation"), t->GetFunction()); + } + +protected: + + static NAN_METHOD(New) + { + NanScope(); + Validation* validation = new Validation(); + validation->Wrap(args.This()); + NanReturnValue(args.This()); + } + + static NAN_METHOD(IsValidUTF8) + { + NanScope(); + if (!Buffer::HasInstance(args[0])) { + return NanThrowTypeError("First argument needs to be a buffer"); + } + Local buffer_obj = args[0]->ToObject(); + char *buffer_data = Buffer::Data(buffer_obj); + size_t buffer_length = Buffer::Length(buffer_obj); + NanReturnValue(is_valid_utf8(buffer_length, buffer_data) == 1 ? NanTrue() : NanFalse()); + } +}; +#if !NODE_VERSION_AT_LEAST(0,10,0) +extern "C" +#endif +void init (Handle target) +{ + NanScope(); + Validation::Initialize(target); +} + +NODE_MODULE(validation, init) + diff --git a/node_modules/simple-websocket/node_modules/ws/package.json b/node_modules/simple-websocket/node_modules/ws/package.json new file mode 100644 index 00000000..243fb581 --- /dev/null +++ b/node_modules/simple-websocket/node_modules/ws/package.json @@ -0,0 +1,87 @@ +{ + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "name": "ws", + "description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455", + "version": "0.7.1", + "license": "MIT", + "keywords": [ + "Hixie", + "HyBi", + "Push", + "RFC-6455", + "WebSocket", + "WebSockets", + "real-time" + ], + "repository": { + "type": "git", + "url": "git://github.com/websockets/ws.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "options": ">=0.0.5", + "ultron": "1.0.x", + "bufferutil": "1.0.x", + "utf-8-validate": "1.0.x" + }, + "optionalDependencies": { + "bufferutil": "1.0.x", + "utf-8-validate": "1.0.x" + }, + "devDependencies": { + "ansi": "0.3.x", + "benchmark": "0.3.x", + "expect.js": "0.3.x", + "mocha": "2.0.x", + "should": "4.3.x", + "tinycolor": "0.0.x" + }, + "browser": "./lib/browser.js", + "component": { + "scripts": { + "ws/index.js": "./lib/browser.js" + } + }, + "gypfile": true, + "gitHead": "608df82a333de45905f05ca60f18a625b4c3293b", + "bugs": { + "url": "https://github.com/websockets/ws/issues" + }, + "homepage": "https://github.com/websockets/ws", + "_id": "ws@0.7.1", + "_shasum": "8f1c7864ca08081be3cd0ac330df0d29c5fcd0da", + "_from": "ws@>=0.7.1 <0.8.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + }, + "maintainers": [ + { + "name": "einaros", + "email": "einaros@gmail.com" + }, + { + "name": "v1", + "email": "info@3rd-Eden.com" + }, + { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + } + ], + "dist": { + "shasum": "8f1c7864ca08081be3cd0ac330df0d29c5fcd0da", + "tarball": "http://registry.npmjs.org/ws/-/ws-0.7.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ws/-/ws-0.7.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/package.json b/node_modules/simple-websocket/package.json new file mode 100644 index 00000000..72526ae6 --- /dev/null +++ b/node_modules/simple-websocket/package.json @@ -0,0 +1,83 @@ +{ + "name": "simple-websocket", + "description": "Simple, EventEmitter API for WebSockets (browser)", + "version": "2.1.3", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "browser": { + "ws": false + }, + "bugs": { + "url": "https://github.com/feross/simple-websocket/issues" + }, + "dependencies": { + "debug": "^2.1.3", + "inherits": "^2.0.1", + "is-typedarray": "0.0.0", + "typedarray-to-buffer": "^3.0.1", + "ws": "^0.7.1" + }, + "devDependencies": { + "browserify": "^10.1.0", + "standard": "^3.3.2", + "tape": "^4.0.0", + "uglify-js": "^2.4.15", + "zuul": "^3.0.0" + }, + "homepage": "https://github.com/feross/simple-websocket", + "keywords": [ + "websocket", + "socket", + "ws", + "simple", + "simple websocket", + "simple-websocket" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/simple-websocket.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js", + "build": "browserify -s SimpleWebsocket -r ./ | uglifyjs -c warnings=false -m > simplewebsocket.bundle.js" + }, + "standard": { + "ignore": [ + "simplewebsocket.bundle.js" + ] + }, + "testling": { + "files": "test/*.js" + }, + "gitHead": "0fed3b4b4efb9e9f8281f97dff6f8e8edd798d08", + "_id": "simple-websocket@2.1.3", + "_shasum": "d6625d205ef74ae1dca750362b6974597b50c338", + "_from": "simple-websocket@2.1.3", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "d6625d205ef74ae1dca750362b6974597b50c338", + "tarball": "http://registry.npmjs.org/simple-websocket/-/simple-websocket-2.1.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/simple-websocket/-/simple-websocket-2.1.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/simple-websocket/simplewebsocket.bundle.js b/node_modules/simple-websocket/simplewebsocket.bundle.js new file mode 100644 index 00000000..e9fc24dd --- /dev/null +++ b/node_modules/simple-websocket/simplewebsocket.bundle.js @@ -0,0 +1,2 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.SimpleWebsocket=e()}}(function(){return function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var h=r[s]={exports:{}};t[s][0].call(h.exports,function(e){var r=t[s][1][e];return i(r?r:e)},h,h.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s1?arguments[1]:"utf8"):s(this,e)):arguments.length>1?new n(e,arguments[1]):new n(e)}function i(e,t){if(e=l(e,0>t?0:0|d(t)),!n.TYPED_ARRAY_SUPPORT)for(var r=0;t>r;r++)e[r]=0;return e}function o(e,t,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|g(t,r);return e=l(e,n),e.write(t,r),e}function s(e,t){if(n.isBuffer(t))return a(e,t);if(H(t))return u(e,t);if(null==t)throw new TypeError("must start with number, buffer, array or string");return"undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer?f(e,t):t.length?h(e,t):c(e,t)}function a(e,t){var r=0|d(t.length);return e=l(e,r),t.copy(e,0,0,r),e}function u(e,t){var r=0|d(t.length);e=l(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function f(e,t){var r=0|d(t.length);e=l(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function h(e,t){var r=0|d(t.length);e=l(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function c(e,t){var r,n=0;"Buffer"===t.type&&H(t.data)&&(r=t.data,n=0|d(r.length)),e=l(e,n);for(var i=0;n>i;i+=1)e[i]=255&r[i];return e}function l(e,t){n.TYPED_ARRAY_SUPPORT?e=n._augment(new Uint8Array(t)):(e.length=t,e._isBuffer=!0);var r=0!==t&&t<=n.poolSize>>>1;return r&&(e.parent=X),e}function d(e){if(e>=$)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+$.toString(16)+" bytes");return 0|e}function p(e,t){if(!(this instanceof p))return new p(e,t);var r=new n(e,t);return delete r.parent,r}function g(e,t){if("string"!=typeof e&&(e=String(e)),0===e.length)return 0;switch(t||"utf8"){case"ascii":case"binary":case"raw":return e.length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e.length;case"hex":return e.length>>>1;case"utf8":case"utf-8":return D(e).length;case"base64":return F(e).length;default:return e.length}}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=t.length;if(o%2!==0)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;n>s;s++){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))throw new Error("Invalid hex string");e[r+s]=a}return s}function v(e,t,r,n){return W(D(t,e.length-r),e,r,n)}function w(e,t,r,n){return W(N(t),e,r,n)}function m(e,t,r,n){return w(e,t,r,n)}function y(e,t,r,n){return W(F(t),e,r,n)}function _(e,t,r,n){return W(Y(t,e.length-r),e,r,n)}function E(e,t,r){return q.fromByteArray(0===t&&r===e.length?e:e.slice(t,r))}function A(e,t,r){var n="",i="";r=Math.min(e.length,r);for(var o=t;r>o;o++)e[o]<=127?(n+=z(i)+String.fromCharCode(e[o]),i=""):i+="%"+e[o].toString(16);return n+z(i)}function L(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(127&e[i]);return n}function S(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(e[i]);return n}function R(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",o=t;r>o;o++)i+=O(e[o]);return i}function B(e,t,r){for(var n=e.slice(t,r),i="",o=0;oe)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function k(e,t,r,i,o,s){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>o||s>t)throw new RangeError("value is out of bounds");if(r+i>e.length)throw new RangeError("index out of range")}function x(e,t,r,n){0>t&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);o>i;i++)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function U(e,t,r,n){0>t&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);o>i;i++)e[r+i]=t>>>8*(n?i:3-i)&255}function M(e,t,r,n,i,o){if(t>i||o>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function T(e,t,r,n,i){return i||M(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,i){return i||M(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,r,n,52,8),r+8}function C(e){if(e=P(e).replace(K,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function P(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function O(e){return 16>e?"0"+e.toString(16):e.toString(16)}function D(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],s=0;n>s;s++){if(r=e.charCodeAt(s),r>55295&&57344>r){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(56320>r){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&((t-=3)>-1&&o.push(239,191,189),i=null);if(128>r){if((t-=1)<0)break;o.push(r)}else if(2048>r){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(2097152>r))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function N(e){for(var t=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function F(e){return q.toByteArray(C(e))}function W(e,t,r,n){for(var i=0;n>i&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}function z(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}var q=e("base64-js"),J=e("ieee754"),H=e("is-array");r.Buffer=n,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50,n.poolSize=8192;var $=1073741823,X={};n.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(r){return!1}}(),n.isBuffer=function(e){return!(null==e||!e._isBuffer)},n.compare=function(e,t){if(!n.isBuffer(e)||!n.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,o=0,s=Math.min(r,i);s>o&&e[o]===t[o];)++o;return o!==s&&(r=e[o],i=t[o]),i>r?-1:r>i?1:0},n.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},n.concat=function(e,t){if(!H(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new n(0);if(1===e.length)return e[0];var r;if(void 0===t)for(t=0,r=0;rt&&(t=0),r>this.length&&(r=this.length),t>=r)return"";for(;;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return L(this,t,r);case"binary":return S(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}},n.prototype.equals=function(e){if(!n.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===n.compare(this,e)},n.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},n.prototype.compare=function(e){if(!n.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:n.compare(this,e)},n.prototype.indexOf=function(e,t){function r(e,t,r){for(var n=-1,i=0;r+i2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,t);if(n.isBuffer(e))return r(this,e,t);if("number"==typeof e)return n.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):r(this,[e],t);throw new TypeError("val must be string, number or Buffer")},n.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},n.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},n.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=t,t=0|r,r=i}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return w(this,e,t,r);case"binary":return m(this,e,t,r);case"base64":return y(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},n.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),e>t&&(t=e);var i;if(n.TYPED_ARRAY_SUPPORT)i=n._augment(this.subarray(e,t));else{var o=t-e;i=new n(o,void 0);for(var s=0;o>s;s++)i[s]=this[s+e]}return i.length&&(i.parent=this.parent||this),i},n.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||I(e,t,this.length);for(var n=this[e],i=1,o=0;++o0&&(i*=256);)n+=this[e+--t]*i;return n},n.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},n.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},n.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},n.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},n.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},n.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||I(e,t,this.length);for(var n=this[e],i=1,o=0;++o=i&&(n-=Math.pow(2,8*t)),n},n.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||I(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},n.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},n.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},n.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},n.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),J.read(this,e,!0,23,4)},n.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),J.read(this,e,!1,23,4)},n.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),J.read(this,e,!0,52,8)},n.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),J.read(this,e,!1,52,8)},n.prototype.writeUIntLE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||k(this,e,t,r,Math.pow(2,8*r),0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},n.prototype.writeUInt8=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,1,255,0),n.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e,t+1},n.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},n.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):x(this,e,t,!1),t+2},n.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e):U(this,e,t,!0),t+4},n.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):U(this,e,t,!1),t+4},n.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);k(this,e,t,r,i-1,-i)}var o=0,s=1,a=0>e?1:0;for(this[t]=255&e;++o>0)-a&255;return t+r},n.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);k(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0>e?1:0;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=(e/s>>0)-a&255;return t+r},n.prototype.writeInt8=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,1,127,-128),n.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=e,t+1},n.prototype.writeInt16LE=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},n.prototype.writeInt16BE=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):x(this,e,t,!1),t+2},n.prototype.writeInt32LE=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,4,2147483647,-2147483648),n.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},n.prototype.writeInt32BE=function(e,t,r){return e=+e,t=0|t,r||k(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),n.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):U(this,e,t,!1),t+4},n.prototype.writeFloatLE=function(e,t,r){return T(this,e,t,!0,r)},n.prototype.writeFloatBE=function(e,t,r){return T(this,e,t,!1,r)},n.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},n.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},n.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&r>i&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>i)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-to||!n.TYPED_ARRAY_SUPPORT)for(var s=0;o>s;s++)e[s+t]=this[s+r];else e._set(this.subarray(r,r+o),t);return o},n.prototype.fill=function(e,t,r){if(e||(e=0),t||(t=0),r||(r=this.length),t>r)throw new RangeError("end < start");if(r!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof e)for(n=t;r>n;n++)this[n]=e;else{var i=D(e.toString()),o=i.length;for(n=t;r>n;n++)this[n]=i[n%o]}return this}},n.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(n.TYPED_ARRAY_SUPPORT)return new n(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;r>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var G=n.prototype;n._augment=function(e){return e.constructor=n,e._isBuffer=!0,e._set=e.set,e.get=G.get,e.set=G.set,e.write=G.write,e.toString=G.toString,e.toLocaleString=G.toString,e.toJSON=G.toJSON,e.equals=G.equals,e.compare=G.compare,e.indexOf=G.indexOf,e.copy=G.copy,e.slice=G.slice,e.readUIntLE=G.readUIntLE,e.readUIntBE=G.readUIntBE,e.readUInt8=G.readUInt8,e.readUInt16LE=G.readUInt16LE,e.readUInt16BE=G.readUInt16BE,e.readUInt32LE=G.readUInt32LE,e.readUInt32BE=G.readUInt32BE,e.readIntLE=G.readIntLE,e.readIntBE=G.readIntBE,e.readInt8=G.readInt8,e.readInt16LE=G.readInt16LE,e.readInt16BE=G.readInt16BE,e.readInt32LE=G.readInt32LE,e.readInt32BE=G.readInt32BE,e.readFloatLE=G.readFloatLE,e.readFloatBE=G.readFloatBE,e.readDoubleLE=G.readDoubleLE,e.readDoubleBE=G.readDoubleBE,e.writeUInt8=G.writeUInt8,e.writeUIntLE=G.writeUIntLE,e.writeUIntBE=G.writeUIntBE,e.writeUInt16LE=G.writeUInt16LE,e.writeUInt16BE=G.writeUInt16BE,e.writeUInt32LE=G.writeUInt32LE,e.writeUInt32BE=G.writeUInt32BE,e.writeIntLE=G.writeIntLE,e.writeIntBE=G.writeIntBE,e.writeInt8=G.writeInt8,e.writeInt16LE=G.writeInt16LE,e.writeInt16BE=G.writeInt16BE,e.writeInt32LE=G.writeInt32LE,e.writeInt32BE=G.writeInt32BE,e.writeFloatLE=G.writeFloatLE,e.writeFloatBE=G.writeFloatBE,e.writeDoubleLE=G.writeDoubleLE,e.writeDoubleBE=G.writeDoubleBE,e.fill=G.fill,e.inspect=G.inspect,e.toArrayBuffer=G.toArrayBuffer,e};var K=/[^+\/0-9A-z\-]/g},{"base64-js":3,ieee754:4,"is-array":5}],3:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===s||t===c?62:t===a||t===l?63:u>t?-1:u+10>t?t-u+26+26:h+26>t?t-h:f+26>t?t-f+26:void 0}function r(e){function r(e){f[c++]=e}var n,i,s,a,u,f;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var h=e.length;u="="===e.charAt(h-2)?2:"="===e.charAt(h-1)?1:0,f=new o(3*e.length/4-u),s=u>0?e.length-4:e.length;var c=0;for(n=0,i=0;s>n;n+=4,i+=3)a=t(e.charAt(n))<<18|t(e.charAt(n+1))<<12|t(e.charAt(n+2))<<6|t(e.charAt(n+3)),r((16711680&a)>>16),r((65280&a)>>8),r(255&a);return 2===u?(a=t(e.charAt(n))<<2|t(e.charAt(n+1))>>4,r(255&a)):1===u&&(a=t(e.charAt(n))<<10|t(e.charAt(n+1))<<4|t(e.charAt(n+2))>>2,r(a>>8&255),r(255&a)),f}function i(e){function t(e){return n.charAt(e)}function r(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var i,o,s,a=e.length%3,u="";for(i=0,s=e.length-a;s>i;i+=3)o=(e[i]<<16)+(e[i+1]<<8)+e[i+2],u+=r(o);switch(a){case 1:o=e[e.length-1],u+=t(o>>2),u+=t(o<<4&63),u+="==";break;case 2:o=(e[e.length-2]<<8)+e[e.length-1],u+=t(o>>10),u+=t(o>>4&63),u+=t(o<<2&63),u+="="}return u}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),a="/".charCodeAt(0),u="0".charCodeAt(0),f="a".charCodeAt(0),h="A".charCodeAt(0),c="-".charCodeAt(0),l="_".charCodeAt(0);e.toByteArray=r,e.fromByteArray=i}("undefined"==typeof r?this.base64js={}:r)},{}],4:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,h=-7,c=r?i-1:0,l=r?-1:1,d=e[t+c];for(c+=l,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+e[t+c],c+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+e[t+c],c+=l,h-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:(d?-1:1)*(1/0);s+=Math.pow(2,n),o-=f}return(d?-1:1)*s*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var s,a,u,f=8*o-i-1,h=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+c>=1?l/u:l*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(t*u-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;e[r+d]=255&s,d+=p,s/=256,f-=8);e[r+d-p]|=128*g}},{}],5:[function(e,t,r){var n=Array.isArray,i=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],6:[function(e,t,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,r,n,o,u,f;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],a(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(n=arguments.length,o=new Array(n-1),u=1;n>u;u++)o[u-1]=arguments[u];r.apply(this,o)}else if(s(r)){for(n=arguments.length,o=new Array(n-1),u=1;n>u;u++)o[u-1]=arguments[u];for(f=r.slice(),n=f.length,u=0;n>u;u++)f[u].apply(this,o)}return!0},n.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned){var r;r=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},n.prototype.removeListener=function(e,t){var r,n,o,a;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],o=r.length,n=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(a=o;a-->0;)if(r[a]===t||r[a].listener&&r[a].listener===t){n=a;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],i(r))this.removeListener(e,r);else for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var r;return r=e._events&&e._events[t]?i(e._events[t])?1:e._events[t].length:0}},{}],7:[function(e,t,r){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],8:[function(e,t,r){function n(){h=!1,a.length?f=a.concat(f):c=-1,f.length&&i()}function i(){if(!h){var e=setTimeout(n);h=!0;for(var t=f.length;t;){for(a=f,f=[];++c1)for(var r=1;rr;r++)t(e[r],r)}t.exports=n;var s=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},a=e("core-util-is");a.inherits=e("inherits");var u=e("./_stream_readable"),f=e("./_stream_writable");a.inherits(n,u),o(s(f.prototype),function(e){n.prototype[e]||(n.prototype[e]=f.prototype[e])})}).call(this,e("_process"))},{"./_stream_readable":12,"./_stream_writable":14,_process:8,"core-util-is":15,inherits:25}],11:[function(e,t,r){function n(e){return this instanceof n?void i.call(this,e):new n(e)}t.exports=n;var i=e("./_stream_transform"),o=e("core-util-is");o.inherits=e("inherits"),o.inherits(n,i),n.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":13,"core-util-is":15,inherits:25}],12:[function(e,t,r){(function(r){function n(t,r){var n=e("./_stream_duplex");t=t||{};var i=t.highWaterMark,o=t.objectMode?16:16384;this.highWaterMark=i||0===i?i:o,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!t.objectMode,r instanceof n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(I||(I=e("string_decoder/").StringDecoder),this.decoder=new I(t.encoding),this.encoding=t.encoding)}function i(t){e("./_stream_duplex");return this instanceof i?(this._readableState=new n(t,this),this.readable=!0,void R.call(this)):new i(t)}function o(e,t,r,n,i){var o=f(t,r);if(o)e.emit("error",o);else if(B.isNullOrUndefined(r))t.reading=!1,t.ended||h(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else!t.decoder||i||n||(r=t.decoder.write(r)),i||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&c(e)),d(e,t);else i||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=x)e=x;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||B.isNull(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var r=null;return B.isBuffer(t)||B.isString(t)||B.isNullOrUndefined(t)||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function h(e,t){if(t.decoder&&!t.ended){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,c(e)}function c(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(k("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?r.nextTick(function(){l(e)}):l(e))}function l(e){k("emit readable"),e.emit("readable"),w(e)}function d(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(function(){p(e,t)}))}function p(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=i)r=o?n.join(""):L.concat(n,i),n.length=0;else if(ef&&e>u;f++){var a=n[0],c=Math.min(e-u,a.length);o?r+=a.slice(0,c):a.copy(r,u,0,c),c0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,r.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function _(e,t){for(var r=0,n=e.length;n>r;r++)t(e[r],r)}function E(e,t){for(var r=0,n=e.length;n>r;r++)if(e[r]===t)return r;return-1}t.exports=i;var A=e("isarray"),L=e("buffer").Buffer;i.ReadableState=n;var S=e("events").EventEmitter;S.listenerCount||(S.listenerCount=function(e,t){return e.listeners(t).length});var R=e("stream"),B=e("core-util-is");B.inherits=e("inherits");var I,k=e("util");k=k&&k.debuglog?k.debuglog("stream"):function(){},B.inherits(i,R),i.prototype.push=function(e,t){var r=this._readableState;return B.isString(e)&&!r.objectMode&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=new L(e,t),t="")),o(this,r,e,t,!1)},i.prototype.unshift=function(e){var t=this._readableState;return o(this,t,e,"",!0)},i.prototype.setEncoding=function(t){return I||(I=e("string_decoder/").StringDecoder),this._readableState.decoder=new I(t),this._readableState.encoding=t,this};var x=8388608;i.prototype.read=function(e){k("read",e);var t=this._readableState,r=e;if((!B.isNumber(e)||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return k("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?y(this):c(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&y(this),null;var n=t.needReadable;k("need readable",n),(0===t.length||t.length-e0?m(e,t):null,B.isNull(i)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0), +r!==e&&t.ended&&0===t.length&&y(this),B.isNull(i)||this.emit("data",i),i},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function n(e){k("onunpipe"),e===c&&o()}function i(){k("onend"),e.end()}function o(){k("cleanup"),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("drain",b),e.removeListener("error",a),e.removeListener("unpipe",n),c.removeListener("end",i),c.removeListener("end",o),c.removeListener("data",s),!l.awaitDrain||e._writableState&&!e._writableState.needDrain||b()}function s(t){k("ondata");var r=e.write(t);!1===r&&(k("false write response, pause",c._readableState.awaitDrain),c._readableState.awaitDrain++,c.pause())}function a(t){k("onerror",t),h(),e.removeListener("error",a),0===S.listenerCount(e,"error")&&e.emit("error",t)}function u(){e.removeListener("finish",f),h()}function f(){k("onfinish"),e.removeListener("close",u),h()}function h(){k("unpipe"),c.unpipe(e)}var c=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=e;break;case 1:l.pipes=[l.pipes,e];break;default:l.pipes.push(e)}l.pipesCount+=1,k("pipe count=%d opts=%j",l.pipesCount,t);var d=(!t||t.end!==!1)&&e!==r.stdout&&e!==r.stderr,p=d?i:o;l.endEmitted?r.nextTick(p):c.once("end",p),e.on("unpipe",n);var b=g(c);return e.on("drain",b),c.on("data",s),e._events&&e._events.error?A(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",u),e.once("finish",f),e.emit("pipe",c),l.flowing||(k("pipe resume"),c.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;n>i;i++)r[i].emit("unpipe",this);return this}var i=E(t.pipes,e);return-1===i?this:(t.pipes.splice(i,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},i.prototype.on=function(e,t){var n=R.prototype.on.call(this,e,t);if("data"===e&&!1!==this._readableState.flowing&&this.resume(),"readable"===e&&this.readable){var i=this._readableState;if(!i.readableListening)if(i.readableListening=!0,i.emittedReadable=!1,i.needReadable=!0,i.reading)i.length&&c(this,i);else{var o=this;r.nextTick(function(){k("readable nexttick read 0"),o.read(0)})}}return n},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){var e=this._readableState;return e.flowing||(k("resume"),e.flowing=!0,e.reading||(k("resume read 0"),this.read(0)),b(this,e)),this},i.prototype.pause=function(){return k("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(k("pause"),this._readableState.flowing=!1,this.emit("pause")),this},i.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;e.on("end",function(){if(k("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&n.push(e)}n.push(null)}),e.on("data",function(i){if(k("wrapped data"),t.decoder&&(i=t.decoder.write(i)),i&&(t.objectMode||i.length)){var o=n.push(i);o||(r=!0,e.pause())}});for(var i in e)B.isFunction(e[i])&&B.isUndefined(this[i])&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var o=["error","close","destroy","pause","resume"];return _(o,function(t){e.on(t,n.emit.bind(n,t))}),n._read=function(t){k("wrapped _read",t),r&&(r=!1,e.resume())},n},i._fromList=m}).call(this,e("_process"))},{"./_stream_duplex":10,_process:8,buffer:2,"core-util-is":15,events:6,inherits:25,isarray:7,stream:20,"string_decoder/":21,util:1}],13:[function(e,t,r){function n(e,t){this.afterTransform=function(e,r){return i(t,e,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function i(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,u.isNullOrUndefined(r)||e.push(r),i&&i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length1){for(var r=[],n=0;n=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&56319>=n)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,n=t.charCodeAt(i);if(n>=55296&&56319>=n){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},f.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(2>=t&&r>>4==14){this.charLength=3;break}if(3>=t&&r>>3==30){this.charLength=4;break}}this.charReceived=t},f.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t}},{buffer:2}],22:[function(e,t,r){function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff),!t)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{null==e?f.removeItem("debug"):f.debug=e}catch(t){}}function a(){var e;try{e=f.debug}catch(t){}return e}function u(){try{return window.localStorage}catch(e){}}r=t.exports=e("./debug"),r.log=o,r.formatArgs=i,r.save=s,r.load=a,r.useColors=n;var f;f="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(e){return JSON.stringify(e)},r.enable(a())},{"./debug":23}],23:[function(e,t,r){function n(){return r.colors[h++%r.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(f||t);e.diff=o,e.prev=f,e.curr=t,f=t,null==e.useColors&&(e.useColors=r.useColors()),null==e.color&&e.useColors&&(e.color=n());var s=Array.prototype.slice.call(arguments);s[0]=r.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var a=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,n){if("%%"===t)return t;a++;var i=r.formatters[n];if("function"==typeof i){var o=s[a];t=i.call(e,o),s.splice(a,1),a--}return t}),"function"==typeof r.formatArgs&&(s=r.formatArgs.apply(e,s));var u=i.log||r.log||console.log.bind(console);u.apply(e,s)}t.enabled=!1,i.enabled=!0;var o=r.enabled(e)?i:t;return o.namespace=e,o}function o(e){r.save(e);for(var t=(e||"").split(/[\s,]+/),n=t.length,i=0;n>i;i++)t[i]&&(e=t[i].replace(/\*/g,".*?"),"-"===e[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))}function s(){r.enable("")}function a(e){var t,n;for(t=0,n=r.skips.length;n>t;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;n>t;t++)if(r.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}r=t.exports=i,r.coerce=u,r.disable=s,r.enable=o,r.enabled=a,r.humanize=e("ms"),r.names=[],r.skips=[],r.formatters={};var f,h=0},{ms:24}],24:[function(e,t,r){function n(e){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"days":case"day":case"d":return r*h;case"hours":case"hour":case"hrs":case"hr":case"h":return r*f;case"minutes":case"minute":case"mins":case"min":case"m":return r*u;case"seconds":case"second":case"secs":case"sec":case"s":return r*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}function i(e){return e>=h?Math.round(e/h)+"d":e>=f?Math.round(e/f)+"h":e>=u?Math.round(e/u)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function o(e){return s(e,h,"day")||s(e,f,"hour")||s(e,u,"minute")||s(e,a,"second")||e+" ms"}function s(e,t,r){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var a=1e3,u=60*a,f=60*u,h=24*f,c=365.25*h;t.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t["long"]?o(e):i(e)}},{}],25:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],26:[function(e,t,r){function n(e){return i(e)||o(e)}function i(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return a[s.call(e)]}t.exports=n,n.strict=i,n.loose=o;var s=Object.prototype.toString,a={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],27:[function(e,t,r){(function(r){var n=e("is-typedarray").strict;t.exports=function(e){var t=r.TYPED_ARRAY_SUPPORT?r._augment:function(e){return new r(e)};return e instanceof Uint8Array?t(e):e instanceof ArrayBuffer?t(new Uint8Array(e)):n(e)?t(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):new r(e)}}).call(this,e("buffer").Buffer)},{buffer:2,"is-typedarray":28}],28:[function(e,t,r){arguments[4][26][0].apply(r,arguments)},{dup:26}],"/":[function(e,t,r){(function(r){function n(e,t){var r=this;return r instanceof n?(t||(t={}),i("new websocket: %s %o",e,t),t.allowHalfOpen=!1,a.Duplex.call(r,t),r.url=e,r.connected=!1,r.destroyed=!1,r._chunk=null,r._cb=null,r._interval=null,r._ws=new h(r.url),r._ws.binaryType="arraybuffer",r._ws.onopen=r._onOpen.bind(r),r._ws.onmessage=r._onMessage.bind(r),r._ws.onclose=r._onClose.bind(r),r._ws.onerror=r._onError.bind(r),void r.on("finish",function(){r.connected?setTimeout(function(){r._destroy()},100):r.once("connect",function(){setTimeout(function(){r._destroy()},100)})})):new n(e,t)}t.exports=n;var i=e("debug")("simple-websocket"),o=e("inherits"),s=e("is-typedarray"),a=e("stream"),u=e("typedarray-to-buffer"),f=e("ws"),h="undefined"!=typeof window?window.WebSocket:f;o(n,a.Duplex),n.prototype.send=function(e){var t=this,r=e.length||e.byteLength||e.size;t._ws.send(e),i("write: %d bytes",r)},n.prototype.destroy=function(e){var t=this;t._destroy(null,e)},n.prototype._destroy=function(e,t){var r=this;if(!r.destroyed){if(t&&r.once("close",t),i("destroy (error: %s)",e&&e.message),r.connected=!1,r.destroyed=!0,clearInterval(r._interval),r._interval=null,r._chunk=null,r._cb=null,r._ws){try{r._ws.close()}catch(e){}r._ws.onopen=null,r._ws.onmessage=null,r._ws.onclose=null,r._ws.onerror=null}r._ws=null,this.readable=this.writable=!1,r._readableState.ended||r.push(null),r._writableState.finished||r.end(),e&&r.emit("error",e),r.emit("close")}},n.prototype._read=function(){},n.prototype._write=function(e,t,n){var o=this;return o.destroyed?n(new Error("cannot write after socket is destroyed")):(s.strict(e)||e instanceof ArrayBuffer||r.isBuffer(e)||"string"==typeof e||"undefined"!=typeof Blob&&e instanceof Blob||(e=JSON.stringify(e)),void(o.connected?(o.send(e),"function"!=typeof f&&o._ws.bufferedAmount?(i("start backpressure: bufferedAmount %d",o._ws.bufferedAmount),o._cb=n):n(null)):(i("write before connect"),o._chunk=e,o._cb=n)))},n.prototype._onMessage=function(e){var t=this;if(!t.destroyed){var n=e.data;if(i("read: %d bytes",n.byteLength||n.length),n instanceof ArrayBuffer)n=u(new Uint8Array(n)),t.push(n);else if(r.isBuffer(n))t.push(n);else{try{n=JSON.parse(n)}catch(o){}t.emit("data",n)}}},n.prototype._onOpen=function(){var e=this;if(!e.connected&&!e.destroyed){if(e.connected=!0,e._chunk){e.send(e._chunk),e._chunk=null,i('sent chunk from "write before connect"');var t=e._cb;e._cb=null,t(null)}"function"!=typeof f&&(e._interval=setInterval(function(){if(e._cb&&e._ws&&!e._ws.bufferedAmount){i("ending backpressure: bufferedAmount %d",e._ws.bufferedAmount);var t=e._cb;e._cb=null,t(null)}},150),e._interval.unref&&e._interval.unref()),i("connect"),e.emit("connect")}},n.prototype._onClose=function(){var e=this;e.destroyed||(i("on close"),e._destroy())},n.prototype._onError=function(){var e=this;if(!e.destroyed){var t=new Error("connection error to "+e.url);i("error: %s",t.message||t),e._destroy(t)}}}).call(this,e("buffer").Buffer)},{buffer:2,debug:22,inherits:25,"is-typedarray":26,stream:20,"typedarray-to-buffer":27,ws:1}]},{},[])("/")}); diff --git a/node_modules/simple-websocket/test/basic.js b/node_modules/simple-websocket/test/basic.js new file mode 100644 index 00000000..a74ac79f --- /dev/null +++ b/node_modules/simple-websocket/test/basic.js @@ -0,0 +1,75 @@ +var Socket = require('../') +var test = require('tape') + +var SOCKET_SERVER = 'wss://echo.websocket.org' + +test('echo string', function (t) { + t.plan(3) + + var socket = new Socket(SOCKET_SERVER) + socket.on('connect', function () { + t.pass('connect emitted') + socket.send('sup!') + socket.on('data', function (data) { + t.equal(data, 'sup!') + + socket.destroy(function () { + t.pass('destroyed socket') + }) + }) + }) +}) + +test('echo Uint8Array', function (t) { + t.plan(4) + + var socket = new Socket(SOCKET_SERVER) + socket.on('connect', function () { + t.pass('connect emitted') + socket.send(new Uint8Array([1, 2, 3])) + socket.on('data', function (data) { + t.ok(Buffer.isBuffer(data), 'data is Buffer') + t.deepEqual(data, new Buffer([1, 2, 3]), 'got correct data') + + socket.destroy(function () { + t.pass('destroyed socket') + }) + }) + }) +}) + +test('echo Buffer', function (t) { + t.plan(4) + + var socket = new Socket(SOCKET_SERVER) + socket.on('connect', function () { + t.pass('connect emitted') + socket.send(new Buffer([1, 2, 3])) + socket.on('data', function (data) { + t.ok(Buffer.isBuffer(data), 'data is Buffer') + t.deepEqual(data, new Buffer([1, 2, 3]), 'got correct data') + + socket.destroy(function () { + t.pass('destroyed socket') + }) + }) + }) +}) + +test('echo ArrayBuffer', function (t) { + t.plan(4) + + var socket = new Socket(SOCKET_SERVER) + socket.on('connect', function () { + t.pass('connect emitted') + socket.send(new Uint8Array([1, 2, 3]).buffer) + socket.on('data', function (data) { + t.ok(Buffer.isBuffer(data), 'data is Buffer') + t.deepEqual(data, new Buffer([1, 2, 3]), 'got correct data') + + socket.destroy(function () { + t.pass('destroyed socket') + }) + }) + }) +}) diff --git a/node_modules/simple-websocket/test/stream.js b/node_modules/simple-websocket/test/stream.js new file mode 100644 index 00000000..fccb8164 --- /dev/null +++ b/node_modules/simple-websocket/test/stream.js @@ -0,0 +1,48 @@ +var Socket = require('../') +var test = require('tape') + +var SOCKET_SERVER = 'wss://echo.websocket.org' + +test('duplex stream: send data before "connect" event', function (t) { + t.plan(6) + + var socket = new Socket(SOCKET_SERVER) + socket.write('abc') + + socket.on('data', function (chunk) { + t.ok(socket.connected) + t.equal(chunk.toString(), 'abc', 'got correct message') + socket.end() + }) + socket.on('finish', function () { + t.pass('got socket "finish"') + t.ok(socket._writableState.finished) + }) + socket.on('end', function () { + t.pass('got socket "end"') + t.ok(socket._readableState.ended) + }) +}) + +test('duplex stream: send data one-way', function (t) { + t.plan(6) + + var socket = new Socket(SOCKET_SERVER) + socket.on('connect', function () { + socket.write('abc') + }) + + socket.on('data', function (chunk) { + t.ok(socket.connected) + t.equal(chunk.toString(), 'abc', 'got correct message') + socket.end() + }) + socket.on('finish', function () { + t.pass('got socket "finish"') + t.ok(socket._writableState.finished) + }) + socket.on('end', function () { + t.pass('got socket "end"') + t.ok(socket._readableState.ended) + }) +}) diff --git a/node_modules/standard/.npmignore b/node_modules/standard/.npmignore new file mode 100644 index 00000000..92b2c45a --- /dev/null +++ b/node_modules/standard/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +tmp/ diff --git a/node_modules/standard/.travis.yml b/node_modules/standard/.travis.yml new file mode 100644 index 00000000..991d04b6 --- /dev/null +++ b/node_modules/standard/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - '0.10' + - '0.12' + - 'iojs' diff --git a/node_modules/standard/LICENSE b/node_modules/standard/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/standard/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/standard/README.md b/node_modules/standard/README.md new file mode 100644 index 00000000..3a83bbe6 --- /dev/null +++ b/node_modules/standard/README.md @@ -0,0 +1,299 @@ +# JavaScript Standard Style +[![travis][travis-image]][travis-url] +[![npm][npm-image]][npm-url] +[![downloads][downloads-image]][downloads-url] + +[travis-image]: https://img.shields.io/travis/feross/standard.svg?style=flat +[travis-url]: https://travis-ci.org/feross/standard +[npm-image]: https://img.shields.io/npm/v/standard.svg?style=flat +[npm-url]: https://npmjs.org/package/standard +[downloads-image]: https://img.shields.io/npm/dm/standard.svg?style=flat +[downloads-url]: https://npmjs.org/package/standard + +### One Style to Rule Them All + +No decisions to make. No `.eslintrc`, `.jshintrc`, or `.jscsrc` files to manage. It just +works. + +This module saves you (and others!) time in two ways: + +- **No configuration.** The easiest way to enforce consistent style in your + module/project. Just drop it in. +- **Catch style errors before they're submitted in PRs.** Saves precious code review time + by eliminating back-and-forth between maintainer and contributor. + +## Install + +```bash +npm install standard +``` + +## Rules + +- **2 spaces** – for indentation +- **Single quotes for strings** – except to avoid escaping +- **No unused variables** – this one catches *tons* of bugs! +- **No semicolons** – [It's][1] [fine.][2] [Really!][3] +- **Never start a line with `(` or `[`** + - This is the **only** gotcha with omitting semicolons – *automatically checked for you!* + - [More details][4] +- **Space after keywords** `if (condition) { ... }` +- **Space after function name** `function name (arg) { ... }` +- Name the context variable `self` – `var self = this` + - Accidental [`window.self`][5] usage is dissallowed (happens when `var self = this` is + omitted) +- Always use `===` instead of `==` – but `obj == null` is allowed to check `null || undefined`. +- Always handle the node.js `err` function parameter +- Always prefix browser globals with `window` – except `document` and `navigator` are okay + - Prevents accidental use of poorly-named browser globals like `open`, `length`, + `event`, and `name`. +- **And [more goodness][6]** – *give `standard` a try today!* + +[1]: http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding +[2]: http://inimino.org/~inimino/blog/javascript_semicolons +[3]: https://github.com/maxogden/messages/issues/18 +[4]: RULES.md#automatic-semicolon-insertion-asi +[5]: https://developer.mozilla.org/en-US/docs/Web/API/Window.self +[6]: RULES.md#javascript-standard-style + +To get a better idea, take a look at +[a sample file](https://github.com/feross/bittorrent-dht/blob/master/client.js) written +in JavaScript Standard Style, or check out some of +[the repositories](https://github.com/feross/standard/blob/master/test/clone.js) that use +`standard`. + +## Badge + +Use this in one of your projects? Include one of these badges in your readme to +let people know that your code is using the standard style. + +[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) + +```markdown +[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) +``` + +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) + +```markdown +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) +``` + +## Usage + +The easiest way to use JavaScript Standard Style to check your code is to install it +globally as a Node command line program. To do so, simply run the following command in +your terminal (flag `-g` installs `standard` globally on your system, omit it if you want +to install in the current working directory): + +```bash +npm install standard -g +``` + +After you've done that you should be able to use the `standard` program. The simplest use +case would be checking the style of all JavaScript files in the current working directory: + +``` +$ standard +Error: Use JavaScript Standard Style + lib/torrent.js:950:11: Expected '===' and instead saw '=='. +``` + +### Editor plugins + +First, install `standard`. Then, install the appropriate plugin for your editor: + +- **[Sublime Text](https://www.sublimetext.com/)** - Install + [Package Control](https://packagecontrol.io/), + [SublimeLinter](http://www.sublimelinter.com/en/latest/), and + [SublimeLinter-contrib-standard](https://packagecontrol.io/packages/SublimeLinter-contrib-standard). +- **[Atom](https://atom.io)** - Install [Linter](https://atom.io/packages/linter) + and [linter-js-standard](https://atom.io/packages/linter-js-standard). +- **[Vim](http://www.vim.org/)** - Install + [Syntastic](https://github.com/scrooloose/syntastic) and add + `let g:syntastic_javascript_checkers = ['standard']` to your `.vimrc`. + +### What you might do if you're clever + +1. Add it to `package.json` + + ```json + { + "name": "my-cool-package", + "devDependencies": { + "standard": "^3.0.0" + }, + "scripts": { + "test": "standard && node my-tests.js" + } + } + ``` + +2. Check style automatically when you run `npm test` + + ``` + $ npm test + Error: Use JavaScript Standard Style + lib/torrent.js:950:11: Expected '===' and instead saw '=='. + ``` + +3. Never give style feedback on a pull request again! + +## FAQ + +### Why would I use JavaScript Standard Style? + +The beauty of JavaScript Standard Style is that it's simple. No one wants to maintain +multiple hundred-line style configuration files for every module/project they work on. +Enough of this madness! + +This module saves you time in two ways: + +- **No configuration.** The easiest way to enforce consistent style in your + module/project. Just drop it in. +- **Catch style errors before they're submitted in PRs.** Saves precious code review time + by eliminating back-and-forth between maintainer and contributor. + +Adopting `standard` style means ranking the importance of code clarity and community +conventions higher than personal style. This might not make sense for 100% of projects and +development cultures, however open source can be a hostile place for newbies. Setting up +clear, automated contributor expectations makes a project healthier. + +### I disagree with rule X, can you change it? + +No. The the whole point of `standard` is to avoid [bikeshedding][bikeshedding] about +style. There are lots of debates online about tabs vs. spaces, etc. that will never be +resolved. These debates just distract from getting stuff done. At the end of the day you +have to 'just pick something', and that's the whole philosophy of `standard` -- its a +bunch of sensible 'just pick something' opinions. Hopefully, users see the value in that +over defending their own opinions. + +[bikeshedding]: https://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/misc.html#idp60694736 + +### But this isn't a real web standard! + +Of course it's not! The style laid out here is not affiliated with any official web +standards groups, which is why this repo is called `feross/standard` and not +`ECMA/standard`. + +The word "standard" has more meanings than just "web standard" :-) For example: + +- This module helps hold our code to a high *standard of quality*. +- This module ensures that new contributors follow some basic *style standards*. + +### Is there an automatic formatter? + +Yes! Just run `standard --format filename.js`. This uses +[Max Ogden][max]'s automatic formatter +[`standard-format`][standard-format], which can automatically +fix most code issues. + +While most issues can be fixed, some, like not handling errors in node-style callbacks, +must be fixed manually. + +[max]: https://github.com/maxogden +[standard-format]: https://github.com/maxogden/standard-format + +### How do I ignore files? + +The paths `node_modules/**`, `*.min.js`, `bundle.js`, `coverage/**`, and hidden +files/folders (beginning with `.`) are automatically excluded when looking for `.js` files +to style check. + +Sometimes you need to ignore additional folders or specific minfied files. To do that, add +a `standard.ignore` property to `package.json`: + +```json +"standard": { + "ignore": [ + "**/out/**", + "**/lib/select2/**", + "**/lib/ckeditor/**" + ] +} +``` + +### How do I hide a certain warning? + +In rare cases, you'll need to break a rule and hide the warning generated by `standard`. + +JavaScript Standard Style uses [`eslint`](http://eslint.org/) under-the-hood and you can +hide warnings as you normally would if you used `eslint` directly. + +To get verbose output (so you can find the particular rule name to ignore), run: + +```bash +$ standard --verbose +Error: Use JavaScript Standard Style + routes/error.js:20:36: 'file' was used before it was defined. (no-use-before-define) +``` + +Disable **all rules** on a specific line: + +```js +file = 'I know what I am doing' // eslint-disable-line +``` + +Or, disable **only** the `"no-use-before-define"` rule: + +```js +file = 'I know what I am doing' // eslint-disable-line no-use-before-define +``` + +Or, disable the `"no-use-before-define"` rule for **multiple lines**: + +```js +/*eslint-disable no-use-before-define */ +// offending code here... +// offending code here... +// offending code here... +/*eslint-enable no-use-before-define */ +``` + +### Can you make rule X configurable? + +No. Use `eslint` directly if you want to configure hundreds of options individually. + +Pro tip: Just use `standard` and move on. There are actual real problems that you could +spend your time solving! :P + +### What about Web Workers? + +Web workers have a magic global variable called `self`. In regular JS files, `standard` +won't let you use `self` directly, as it wants to prevent accidental use of +`window.self`. But `standard` has no way of knowing when you are in a `worker` and +therefore does not know when to allow usage of `self` directly. + +Until we figure out a better solution, we recommend adding this to the top of workers: + +``` +/* global self */ +``` + +This lets `standard` (as well as humans reading your code) know that `self` is a global +in web worker code. + +### Is there a Git `pre-commit` hook for `standard`? + +Funny you should ask! + +```sh +#!/bin/sh +# Ensure all javascript files staged for commit pass standard code style +git diff --name-only --cached --relative | grep '\.js$' | xargs standard +exit $? +``` + +Alternatively, [overcommit](https://github.com/brigade/overcommit) is a Git hook +manager that includes support for running `standard` as a Git pre-commit hook. +To enable this, add the following to your `.overcommit.yml` file: + +```yaml +PreCommit: + Standard: + enabled: true +``` + +## License + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/standard/RULES.md b/node_modules/standard/RULES.md new file mode 100644 index 00000000..0f51f32a --- /dev/null +++ b/node_modules/standard/RULES.md @@ -0,0 +1,84 @@ +# JavaScript Standard Style + +Right now, the best way to learn about `standard` is to just install it and give it a try +on your code. Over time, we hope to enumerate all the rules here. So far, only the most +important rules are listed here. Please send PRs! + +## High-Level Rules + +- **2 spaces** – for indentation +- **Single quotes for strings** – except to avoid escaping +- **No unused variables** – this one catches *tons* of bugs! +- **No semicolons** – [It's][1] [fine.][2] [Really!][3] +- **Never start a line with `(` or `[`** + - This is the **only** gotcha with omitting semicolons – *automatically checked for you!* +- **Space after keywords** `if (condition) { ... }` +- **Space after function name** `function name (arg) { ... }` +- Name the context variable `self` – `var self = this` + - Accidental [`window.self`][4] usage is dissallowed (happens when `var self = this` is + omitted) +- Always use `===` instead of `==` – but `obj == null` is allowed to check `null || undefined`. +- Always handle the node.js `err` function parameter +- Always prefix browser globals with `window` – except `document` and `navigator` are okay + - Prevents accidental use of poorly-named browser globals like `open`, `length`, + `event`, and `name`. + +## Automatic semicolon insertion (ASI) + +*Quoting from ["An Open Letter to JavaScript Leaders Regarding Semicolons"][1]:* + +In general, `\n` ends a statement unless: + 1. The statement has an unclosed paren, array literal, or object literal or ends in some + other way that is not a valid way to end a statement. (For instance, ending with `.` + or `,`.) + 2. The line is `--` or `++` (in which case it will decrement/increment the next token.) + 3. It is a `for()`, `while()`, `do`, `if()`, or `else`, and there is no `{` + 4. The next line starts with `[`, `(`, `+`, `*`, `/`, `-`, `,`, `.`, or some other + binary operator that can only be found between two tokens in a single expression. + +The first is pretty obvious. Even JSLint is ok with `\n` chars in JSON and parenthesized constructs, and with `var` statements that span multiple lines ending in `,`. + +The second is super weird. I’ve never seen a case (outside of these sorts of conversations) where you’d want to do write `i\n++\nj`, but, point of fact, that’s parsed as `i; ++j`, not `i++; j`. + +The third is well understood, if generally despised. `if (x)\ny()` is equivalent to `if (x) { y() }`. The construct doesn’t end until it reaches either a block, or a statement. + +`;` is a valid JavaScript statement, so `if(x);` is equivalent to `if(x){}` or, “If x, do nothing.” This is more commonly applied to loops where the loop check also is the update function. Unusual, but not unheard of. + +The fourth is generally the fud-inducing “oh noes, you need semicolons!” case. But, as it turns out, it’s quite easy to *prefix* those lines with semicolons if you don’t mean them to be continuations of the previous line. For example, instead of this: + +```js +foo(); +[1,2,3].forEach(bar); +``` + +you could do this: + +```js +foo() +;[1,2,3].forEach(bar) +``` + +The advantage is that the prefixes are easier to notice, once you are accustomed to never seeing lines starting with `(` or `[` without semis. + +*End quote from "An Open Letter to JavaScript Leaders Regarding Semicolons".* + +### Avoid clever short-hands + +Clever short-hands are discouraged, in favor of clear and readable expressions, whenever +possible. So, while this is allowed: + +```js +;[1,2,3].forEach(bar) +``` + +This is much preferred: + +```js +var nums = [1,2,3] +nums.forEach(bar) +``` + +[1]: http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding +[2]: http://inimino.org/~inimino/blog/javascript_semicolons +[3]: https://github.com/maxogden/messages/issues/18 +[4]: https://developer.mozilla.org/en-US/docs/Web/API/Window.self diff --git a/node_modules/standard/badge.png b/node_modules/standard/badge.png new file mode 100644 index 00000000..71f45c9c Binary files /dev/null and b/node_modules/standard/badge.png differ diff --git a/node_modules/standard/badge.svg b/node_modules/standard/badge.svg new file mode 100644 index 00000000..df099dc3 --- /dev/null +++ b/node_modules/standard/badge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/standard/bin/cmd.js b/node_modules/standard/bin/cmd.js new file mode 100755 index 00000000..48e50fe9 --- /dev/null +++ b/node_modules/standard/bin/cmd.js @@ -0,0 +1,129 @@ +#!/usr/bin/env node + +var fs = require('fs') +var minimist = require('minimist') +var standard = require('../') +var standardFormat = require('standard-format') +var stdin = require('get-stdin') + +var argv = minimist(process.argv.slice(2), { + alias: { + format: 'F', + help: 'h', + verbose: 'v' + }, + boolean: [ + 'format', + 'help', + 'stdin', + 'verbose', + 'version' + ] +}) + +// running `standard -` is equivalent to `standard --stdin` +if (argv._[0] === '-') { + argv.stdin = true + argv._.shift() +} + +if (argv.help) { + console.log(function () { + /* + standard - JavaScript Standard Style + + Usage: + standard [FILES...] + + If FILES is omitted, then all JavaScript source files (*.js, *.jsx) in the current + working directory are checked, recursively. + + Certain paths (node_modules/, .git/, coverage/, *.min.js, bundle.js) are + automatically excluded. + + Flags: + -F --format Automatically format code. (using standard-format) + -v, --verbose Show error codes. (so you can ignore specific rules) + --stdin Read file text from stdin. + --version Show current version. + -h, --help Show usage information. + + Readme: https://github.com/feross/standard + Report bugs: https://github.com/feross/standard/issues + + */ + }.toString().split(/\n/).slice(2, -2).join('\n')) + process.exit(0) +} + +if (argv.version) { + console.log(require('../package.json').version) + process.exit(0) +} + +if (argv.stdin) { + stdin(function (text) { + if (argv.format) { + text = standardFormat.transform(text) + process.stdout.write(text) + } + standard.lintText(text, onResult) + }) +} else { + var lintOpts = {} + if (argv.format) { + lintOpts._onFiles = function (files) { + files.forEach(function (file) { + var data = fs.readFileSync(file).toString() + fs.writeFileSync(file, standardFormat.transform(data)) + }) + } + } + standard.lintFiles(argv._, lintOpts, onResult) +} + +function onResult (err, result) { + if (err) return onError(err) + if (result.errorCount === 0) process.exit(0) + + console.error( + 'standard: Use JavaScript Standard Style ' + + '(https://github.com/feross/standard)' + ) + + result.results.forEach(function (result) { + result.messages.forEach(function (message) { + log( + ' %s:%d:%d: %s%s', + result.filePath, message.line || 0, message.column || 0, message.message, + argv.verbose ? ' (' + message.ruleId + ')' : '' + ) + }) + }) + + process.exit(1) +} + +function onError (err) { + console.error('standard: Unexpected linter output:\n') + console.error(err.stack || err.message || err) + console.error( + '\nIf you think this is a bug in `standard`, open an issue: ' + + 'https://github.com/feross/standard' + ) + process.exit(1) +} + +/** + * Print lint errors to stdout since this is expected output from `standard`. + * Note: When formatting code from stdin (`standard --stdin --format`), the transformed + * code is printed to stdout, so print lint errors to stderr in this case. + */ +function log () { + if (argv.stdin && argv.format) { + arguments[0] = 'standard: ' + arguments[0] + console.error.apply(console, arguments) + } else { + console.log.apply(console, arguments) + } +} diff --git a/node_modules/standard/index.js b/node_modules/standard/index.js new file mode 100644 index 00000000..e37ebff7 --- /dev/null +++ b/node_modules/standard/index.js @@ -0,0 +1,159 @@ +module.exports.lintText = lintText +module.exports.lintFiles = lintFiles + +var dezalgo = require('dezalgo') +var eslint = require('eslint') +var extend = require('xtend') +var findRoot = require('find-root') +// var fs = require('fs') +var glob = require('glob') +var parallel = require('run-parallel') +var path = require('path') +var uniq = require('uniq') + +var DEFAULT_PATTERNS = [ + '**/*.js', + '**/*.jsx' +] + +var DEFAULT_IGNORE_PATTERNS = [ + 'coverage/', + 'node_modules/', + '**/*.min.js', + '**/bundle.js' +] + +var ESLINT_CONFIG = { + configFile: path.join(__dirname, 'rc', '.eslintrc'), + useEslintrc: false +} + +/** + * Lint text to enforce JavaScript Standard Style. + * + * @param {string} text file text to lint + * @param {Object} opts options object + * @param {Array.} opts.ignore file globs to ignore (has sane defaults) + * @param {string} opts.cwd current working directory (default: process.cwd()) + * @param {function(Error, Object)} cb callback + */ +function lintText (text, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} + } + opts = parseOpts(opts) + cb = dezalgo(cb) + + var result + try { + result = new eslint.CLIEngine(ESLINT_CONFIG).executeOnText(text) + } catch (err) { + return cb(err) + } + return cb(null, result) +} + +/** + * Lint files to enforce JavaScript Standard Style. + * + * @param {Array.} files file globs to lint + * @param {Object} opts options object + * @param {Array.} opts.ignore file globs to ignore (has sane defaults) + * @param {string} opts.cwd current working directory (default: process.cwd()) + * @param {function(Error, Object)} cb callback + */ +function lintFiles (files, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} + } + opts = parseOpts(opts) + cb = dezalgo(cb) + + if (typeof files === 'string') files = [ files ] + if (files.length === 0) files = DEFAULT_PATTERNS + + // traverse filesystem + parallel(files.map(function (pattern) { + return function (cb) { + glob(pattern, { + cwd: opts.cwd, + ignore: opts.ignore, + nodir: true + }, cb) + } + }), function (err, results) { + if (err) return cb(err) + + // flatten nested arrays + var files = results.reduce(function (files, result) { + result.forEach(function (file) { + files.push(path.resolve(opts.cwd, file)) + }) + return files + }, []) + + // de-dupe + files = uniq(files) + + // undocumented – do not use (used by bin/cmd.js) + if (opts._onFiles) opts._onFiles(files) + + var result + try { + result = new eslint.CLIEngine(ESLINT_CONFIG).executeOnFiles(files) + } catch (err) { + return cb(err) + } + return cb(null, result) + }) +} + +function parseOpts (opts) { + if (!opts) opts = {} + opts = extend(opts) + + if (!opts.cwd) opts.cwd = process.cwd() + + // Add user ignore patterns to default ignore patterns + var ignore = (opts.ignore || []).concat(DEFAULT_IGNORE_PATTERNS) + + var root + try { + root = findRoot(opts.cwd) + } catch (e) {} + + if (root) { + // Add ignore patterns from the closest `package.json` + try { + var packageOpts = require(path.join(root, 'package.json')).standard + if (packageOpts) ignore = ignore.concat(packageOpts.ignore) + } catch (e) {} + + // Temporarily disabled until this is made more reliable + // Add ignore patterns from project root `.gitignore` + // try { + // var gitignore = fs.readFileSync(path.join(root, '.gitignore'), 'utf8') + // ignore = ignore.concat(gitignore.split(/\r?\n|\r/).filter(nonEmpty)) + // } catch (e) {} + } + + // Remove leading "current folder" prefix + ignore = ignore.map(function (pattern) { + return pattern.indexOf('./') === 0 ? pattern.slice(2) : pattern + }) + + // Allow "folder/" to ignore all sub-folders and files, a la .gitignore + opts.ignore = [] + ignore.forEach(function (pattern) { + opts.ignore.push(pattern) + opts.ignore.push(pattern + '/**') + }) + + return opts +} + +// function nonEmpty (line) { +// return line.trim() !== '' && line[0] !== '#' +// } diff --git a/node_modules/standard/node_modules/.bin/eslint b/node_modules/standard/node_modules/.bin/eslint new file mode 120000 index 00000000..810e4bcb --- /dev/null +++ b/node_modules/standard/node_modules/.bin/eslint @@ -0,0 +1 @@ +../eslint/bin/eslint.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/.bin/standard-format b/node_modules/standard/node_modules/.bin/standard-format new file mode 120000 index 00000000..6d676e0d --- /dev/null +++ b/node_modules/standard/node_modules/.bin/standard-format @@ -0,0 +1 @@ +../standard-format/bin.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/dezalgo/README.md b/node_modules/standard/node_modules/dezalgo/README.md new file mode 100644 index 00000000..bdfc8ba8 --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/README.md @@ -0,0 +1,29 @@ +# dezalgo + +Contain async insanity so that the dark pony lord doesn't eat souls + +See [this blog +post](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony). + +## USAGE + +Pass a callback to `dezalgo` and it will ensure that it is *always* +called in a future tick, and never in this tick. + +```javascript +var dz = require('dezalgo') + +var cache = {} +function maybeSync(arg, cb) { + cb = dz(cb) + + // this will actually defer to nextTick + if (cache[arg]) cb(null, cache[arg]) + + fs.readFile(arg, function (er, data) { + // since this is *already* defered, it will call immediately + if (er) cb(er) + cb(null, cache[arg] = data) + }) +} +``` diff --git a/node_modules/standard/node_modules/dezalgo/dezalgo.js b/node_modules/standard/node_modules/dezalgo/dezalgo.js new file mode 100644 index 00000000..04fd3ba7 --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/dezalgo.js @@ -0,0 +1,22 @@ +var wrappy = require('wrappy') +module.exports = wrappy(dezalgo) + +var asap = require('asap') + +function dezalgo (cb) { + var sync = true + asap(function () { + sync = false + }) + + return function zalgoSafe() { + var args = arguments + var me = this + if (sync) + asap(function() { + cb.apply(me, args) + }) + else + cb.apply(me, args) + } +} diff --git a/node_modules/standard/node_modules/dezalgo/node_modules/asap/LICENSE.md b/node_modules/standard/node_modules/dezalgo/node_modules/asap/LICENSE.md new file mode 100644 index 00000000..5d98ad8f --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/node_modules/asap/LICENSE.md @@ -0,0 +1,20 @@ + +Copyright 2009–2013 Contributors. All rights reserved. +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/node_modules/standard/node_modules/dezalgo/node_modules/asap/README.md b/node_modules/standard/node_modules/dezalgo/node_modules/asap/README.md new file mode 100644 index 00000000..9a427597 --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/node_modules/asap/README.md @@ -0,0 +1,81 @@ + +# ASAP + +This `asap` CommonJS package contains a single `asap` module that +exports a single `asap` function that executes a function **as soon as +possible**. + +```javascript +asap(function () { + // ... +}); +``` + +More formally, ASAP provides a fast event queue that will execute tasks +until it is empty before yielding to the JavaScript engine's underlying +event-loop. When the event queue becomes non-empty, ASAP schedules a +flush event, preferring for that event to occur before the JavaScript +engine has an opportunity to perform IO tasks or rendering, thus making +the first task and subsequent tasks semantically indistinguishable. +ASAP uses a variety of techniques to preserve this invariant on +different versions of browsers and NodeJS. + +By design, ASAP can starve the event loop on the theory that, if there +is enough work to be done synchronously, albeit in separate events, long +enough to starve input or output, it is a strong indicator that the +program needs to push back on scheduling more work. + +Take care. ASAP can sustain infinite recursive calls indefinitely +without warning. This is behaviorally equivalent to an infinite loop. +It will not halt from a stack overflow, but it *will* chew through +memory (which is an oddity I cannot explain at this time). Just as with +infinite loops, you can monitor a Node process for this behavior with a +heart-beat signal. As with infinite loops, a very small amount of +caution goes a long way to avoiding problems. + +```javascript +function loop() { + asap(loop); +} +loop(); +``` + +ASAP is distinct from `setImmediate` in that it does not suffer the +overhead of returning a handle and being possible to cancel. For a +`setImmediate` shim, consider [setImmediate][]. + +[setImmediate]: https://github.com/noblejs/setimmediate + +If a task throws an exception, it will not interrupt the flushing of +high-priority tasks. The exception will be postponed to a later, +low-priority event to avoid slow-downs, when the underlying JavaScript +engine will treat it as it does any unhandled exception. + +## Heritage + +ASAP has been factored out of the [Q][] asynchronous promise library. +It originally had a naïve implementation in terms of `setTimeout`, but +[Malte Ubl][NonBlocking] provided an insight that `postMessage` might be +useful for creating a high-priority, no-delay event dispatch hack. +Since then, Internet Explorer proposed and implemented `setImmediate`. +Robert Kratić began contributing to Q by measuring the performance of +the internal implementation of `asap`, paying particular attention to +error recovery. Domenic, Robert, and I collectively settled on the +current strategy of unrolling the high-priority event queue internally +regardless of what strategy we used to dispatch the potentially +lower-priority flush event. Domenic went on to make ASAP cooperate with +NodeJS domains. + +[Q]: https://github.com/kriskowal/q +[NonBlocking]: http://www.nonblocking.io/2011/06/windownexttick.html + +For further reading, Nicholas Zakas provided a thorough article on [The +Case for setImmediate][NCZ]. + +[NCZ]: http://www.nczonline.net/blog/2013/07/09/the-case-for-setimmediate/ + +## License + +Copyright 2009-2013 by Contributors +MIT License (enclosed) + diff --git a/node_modules/standard/node_modules/dezalgo/node_modules/asap/asap.js b/node_modules/standard/node_modules/dezalgo/node_modules/asap/asap.js new file mode 100644 index 00000000..2f85516c --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/node_modules/asap/asap.js @@ -0,0 +1,113 @@ + +// Use the fastest possible means to execute a task in a future turn +// of the event loop. + +// linked list of tasks (single, with head node) +var head = {task: void 0, next: null}; +var tail = head; +var flushing = false; +var requestFlush = void 0; +var isNodeJS = false; + +function flush() { + /* jshint loopfunc: true */ + + while (head.next) { + head = head.next; + var task = head.task; + head.task = void 0; + var domain = head.domain; + + if (domain) { + head.domain = void 0; + domain.enter(); + } + + try { + task(); + + } catch (e) { + if (isNodeJS) { + // In node, uncaught exceptions are considered fatal errors. + // Re-throw them synchronously to interrupt flushing! + + // Ensure continuation if the uncaught exception is suppressed + // listening "uncaughtException" events (as domains does). + // Continue in next event to avoid tick recursion. + if (domain) { + domain.exit(); + } + setTimeout(flush, 0); + if (domain) { + domain.enter(); + } + + throw e; + + } else { + // In browsers, uncaught exceptions are not fatal. + // Re-throw them asynchronously to avoid slow-downs. + setTimeout(function() { + throw e; + }, 0); + } + } + + if (domain) { + domain.exit(); + } + } + + flushing = false; +} + +if (typeof process !== "undefined" && process.nextTick) { + // Node.js before 0.9. Note that some fake-Node environments, like the + // Mocha test runner, introduce a `process` global without a `nextTick`. + isNodeJS = true; + + requestFlush = function () { + process.nextTick(flush); + }; + +} else if (typeof setImmediate === "function") { + // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate + if (typeof window !== "undefined") { + requestFlush = setImmediate.bind(window, flush); + } else { + requestFlush = function () { + setImmediate(flush); + }; + } + +} else if (typeof MessageChannel !== "undefined") { + // modern browsers + // http://www.nonblocking.io/2011/06/windownexttick.html + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + requestFlush = function () { + channel.port2.postMessage(0); + }; + +} else { + // old browsers + requestFlush = function () { + setTimeout(flush, 0); + }; +} + +function asap(task) { + tail = tail.next = { + task: task, + domain: isNodeJS && process.domain, + next: null + }; + + if (!flushing) { + flushing = true; + requestFlush(); + } +}; + +module.exports = asap; + diff --git a/node_modules/standard/node_modules/dezalgo/node_modules/asap/package.json b/node_modules/standard/node_modules/dezalgo/node_modules/asap/package.json new file mode 100644 index 00000000..371fc1e7 --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/node_modules/asap/package.json @@ -0,0 +1,39 @@ +{ + "name": "asap", + "version": "1.0.0", + "description": "High-priority task queue for Node.js and browsers", + "keywords": [ + "event", + "task", + "queue" + ], + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/kriskowal/asap/raw/master/LICENSE.md" + } + ], + "main": "asap", + "_id": "asap@1.0.0", + "dist": { + "shasum": "b2a45da5fdfa20b0496fc3768cc27c12fa916a7d", + "tarball": "http://registry.npmjs.org/asap/-/asap-1.0.0.tgz" + }, + "_from": "asap@>=1.0.0 <2.0.0", + "_npmVersion": "1.2.15", + "_npmUser": { + "name": "kriskowal", + "email": "kris.kowal@cixar.com" + }, + "maintainers": [ + { + "name": "kriskowal", + "email": "kris.kowal@cixar.com" + } + ], + "directories": {}, + "_shasum": "b2a45da5fdfa20b0496fc3768cc27c12fa916a7d", + "_resolved": "https://registry.npmjs.org/asap/-/asap-1.0.0.tgz", + "readme": "ERROR: No README data found!", + "scripts": {} +} diff --git a/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/LICENSE b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/README.md b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/package.json b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/test/basic.js b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/wrappy.js b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/standard/node_modules/dezalgo/package.json b/node_modules/standard/node_modules/dezalgo/package.json new file mode 100644 index 00000000..67a97f20 --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/package.json @@ -0,0 +1,68 @@ +{ + "name": "dezalgo", + "version": "1.0.1", + "description": "Contain async insanity so that the dark pony lord doesn't eat souls", + "main": "dezalgo.js", + "directories": { + "test": "test" + }, + "dependencies": { + "asap": "^1.0.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^0.4.11" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/dezalgo" + }, + "keywords": [ + "async", + "zalgo", + "the dark pony", + "he comes", + "asynchrony of all holy and good", + "T̯̪ͅo̯͖̹ ̻̮̖̲͢i̥̖n̢͈͇̝͍v͏͉ok̭̬̝ͅe̞͍̩̫͍̩͝ ̩̮̖̟͇͉́t͔͔͎̗h͏̗̟e̘͉̰̦̠̞͓ ͕h͉̟͎̪̠̱͠ḭ̮̩v̺͉͇̩e̵͖-̺̪m͍i̜n̪̲̲̲̮d̷ ̢r̠̼̯̹̦̦͘ͅe͓̳͓̙p̺̗̫͙͘ͅr͔̰͜e̴͓̞s͉̩̩͟ͅe͏̣n͚͇̗̭̺͍tì͙̣n͏̖̥̗͎̰̪g̞͓̭̱̯̫̕ ̣̱͜ͅc̦̰̰̠̮͎͙̀hao̺̜̻͍͙ͅs͉͓̘.͎̼̺̼͕̹͘", + "̠̞̱̰I͖͇̝̻n̦̰͍̰̟v̤̺̫̳̭̼̗͘ò̹̟̩̩͚k̢̥̠͍͉̦̬i̖͓͔̮̱̻͘n̶̳͙̫͎g̖̯̣̲̪͉ ̞͎̗͕͚ͅt̲͕̘̺̯̗̦h̘̦̲̜̻e̳͎͉̬͙ ̴̞̪̲̥f̜̯͓͓̭̭͢e̱̘͔̮e̜̤l̺̱͖̯͓͙͈͢i̵̦̬͉͔̫͚͕n͉g̨͖̙̙̹̹̟̤ ͉̪o̞̠͍̪̰͙ͅf̬̲̺ ͔͕̲͕͕̲̕c̙͉h̝͔̩̙̕ͅa̲͖̻̗̹o̥̼̫s̝̖̜̝͚̫̟.̺͚ ̸̱̲W̶̥̣͖̦i͏̤̬̱̳̣ͅt͉h̗̪̪ ̷̱͚̹̪ǫ͕̗̣̳̦͎u̼̦͔̥̮̕ţ͖͎̻͔͉ ̴͎̩òr̹̰̖͉͈͝d̷̲̦̖͓e̲͓̠r", + "̧͚̜͓̰̭̭Ṯ̫̹̜̮̟̮͝h͚̘̩̘̖̰́e ̥̘͓͉͔͙̼N̟̜̣̘͔̪e̞̞̤͢z̰̖̘͇p̠͟e̺̱̣͍͙̝ṛ̘̬͔̙͇̠d͝ḭ̯̱̥̗̩a̛ͅn͏̦ ̷̥hi̥v̖̳̹͉̮̱͝e̹̪̘̖̰̟-̴͙͓͚̜̻mi̗̺̻͙̺ͅn̪̯͈d ͏̘͓̫̳ͅơ̹͔̳̖̣͓f͈̹̘ ͕ͅc̗̤̠̜̮̥̥h̡͍̩̭̫͚̱a̤͉̤͔͜os͕̤̼͍̲̀ͅ.̡̱ ̦Za̯̱̗̭͍̣͚l̗͉̰̤g͏̣̭̬̗̲͖ͅo̶̭̩̳̟͈.̪̦̰̳", + "H̴̱̦̗̬̣͓̺e̮ ͉̠̰̞͎̖͟ẁh̛̺̯ͅo̖̫͡ ̢Ẁa̡̗i̸t͖̣͉̀ş͔̯̩ ̤̦̮͇̞̦̲B͎̭͇̦̼e̢hin͏͙̟̪d̴̰͓̻̣̮͕ͅ T͖̮̕h͖e̘̺̰̙͘ ̥Ẁ̦͔̻͚a̞͖̪͉l̪̠̻̰̣̠l̲͎͞", + "Z̘͍̼͎̣͔͝Ą̲̜̱̱̹̤͇L̶̝̰̭͔G͍̖͍O̫͜ͅ!̼̤ͅ", + "H̝̪̜͓̀̌̂̒E̢̙̠̣ ̴̳͇̥̟̠͍̐C̹̓̑̐̆͝Ó̶̭͓̚M̬̼Ĕ̖̤͔͔̟̹̽̿̊ͥ̍ͫS̻̰̦̻̖̘̱̒ͪ͌̅͟" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/dezalgo/issues" + }, + "homepage": "https://github.com/npm/dezalgo", + "gitHead": "0a5eee75c179611f8b67f663015d68bb517e57d2", + "_id": "dezalgo@1.0.1", + "_shasum": "12bde135060807900d5a7aebb607c2abb7c76937", + "_from": "dezalgo@>=1.0.1 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "12bde135060807900d5a7aebb607c2abb7c76937", + "tarball": "http://registry.npmjs.org/dezalgo/-/dezalgo-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/dezalgo/test/basic.js b/node_modules/standard/node_modules/dezalgo/test/basic.js new file mode 100644 index 00000000..da09e724 --- /dev/null +++ b/node_modules/standard/node_modules/dezalgo/test/basic.js @@ -0,0 +1,29 @@ +var test = require('tap').test +var dz = require('../dezalgo.js') + +test('the dark pony', function(t) { + + var n = 0 + function foo(i, cb) { + cb = dz(cb) + if (++n % 2) cb(true, i) + else process.nextTick(cb.bind(null, false, i)) + } + + var called = 0 + var order = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9] + var o = 0 + for (var i = 0; i < 10; i++) { + foo(i, function(cached, i) { + t.equal(i, order[o++]) + t.equal(i % 2, cached ? 0 : 1) + called++ + }) + t.equal(called, 0) + } + + setTimeout(function() { + t.equal(called, 10) + t.end() + }) +}) diff --git a/node_modules/standard/node_modules/eslint-plugin-react/History.md b/node_modules/standard/node_modules/eslint-plugin-react/History.md new file mode 100644 index 00000000..803c5c35 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/History.md @@ -0,0 +1,157 @@ +2.2.0 / 2015-04-22 +================== + +* add jsx-sort-prop-types rule ([#38][] @AlexKVal) +* fix variables marked as used when a prop has the same name ([#69][] @burnnat) +* documentation improvements ([#71][] @AlexKVal) + +[#38]: https://github.com/yannickcr/eslint-plugin-react/issues/38 +[#69]: https://github.com/yannickcr/eslint-plugin-react/pull/69 +[#71]: https://github.com/yannickcr/eslint-plugin-react/pull/71 + +2.1.1 / 2015-04-17 +================== + +* add support for classes static properties ([#43][]) +* add tests for the babel-eslint parser +* add ESLint as peerDependency ([#63][] @AlexKVal) +* documentation improvements ([#55][] @AlexKVal, [#60][] @chriscalo) + +[#43]: https://github.com/yannickcr/eslint-plugin-react/issues/43 +[#63]: https://github.com/yannickcr/eslint-plugin-react/pull/63 +[#55]: https://github.com/yannickcr/eslint-plugin-react/pull/55 +[#60]: https://github.com/yannickcr/eslint-plugin-react/pull/60 + +2.1.0 / 2015-04-06 +================== + +* update jsx-sort-props to reset the alphabetical verification on spread ([#47][] @zertosh) +* update jsx-uses-vars to be enabled by default ([#49][] @banderson) +* add jsx-boolean-value rule ([#11][]) +* add support for static methods in display-name and prop-types ([#48][]) +* fix describing comment for hasSpreadOperator() method ([#53][] @AlexKVal) + +[#47]: https://github.com/yannickcr/eslint-plugin-react/pull/47 +[#49]: https://github.com/yannickcr/eslint-plugin-react/pull/49 +[#11]: https://github.com/yannickcr/eslint-plugin-react/issues/11 +[#48]: https://github.com/yannickcr/eslint-plugin-react/issues/48 +[#53]: https://github.com/yannickcr/eslint-plugin-react/pull/53 + +2.0.2 / 2015-03-31 +================== + +* fix ignore rest spread when destructuring props ([#46][]) +* fix component detection in prop-types and display-name ([#45][]) +* fix spread handling in jsx-sort-props ([#42][] @zertosh) + +[#46]: https://github.com/yannickcr/eslint-plugin-react/issues/46 +[#45]: https://github.com/yannickcr/eslint-plugin-react/issues/45 +[#42]: https://github.com/yannickcr/eslint-plugin-react/pull/42 + +2.0.1 / 2015-03-30 +================== +* fix props detection when used in an object ([#41][]) + +[#41]: https://github.com/yannickcr/eslint-plugin-react/issues/41 + +2.0.0 / 2015-03-29 +================== +* update dependencies +* add jsx-sort-props rule ([#16][]) +* add no-unknown-property rule ([#28][]) +* add ignore option to prop-types rule +* breaking in prop-types the children prop is no longer ignored +* fix components are now detected when using ES6 classes ([#24][]) +* fix prop-types now return the right line/column ([#33][]) +* fix props are now detected when destructuring ([#27][]) +* fix only check for computed property names in prop-types ([#36][] @burnnat) + +[#16]: https://github.com/yannickcr/eslint-plugin-react/issues/16 +[#28]: https://github.com/yannickcr/eslint-plugin-react/issues/28 +[#24]: https://github.com/yannickcr/eslint-plugin-react/issues/24 +[#33]: https://github.com/yannickcr/eslint-plugin-react/issues/33 +[#27]: https://github.com/yannickcr/eslint-plugin-react/issues/27 +[#36]: https://github.com/yannickcr/eslint-plugin-react/pull/36 + + +1.6.1 / 2015-03-25 +================== +* update jsx-quotes documentation +* fix jsx-no-undef with babel-eslint ([#30][]) +* fix jsx-quotes on Literal childs ([#29][]) + +[#30]: https://github.com/yannickcr/eslint-plugin-react/issues/30 +[#29]: https://github.com/yannickcr/eslint-plugin-react/issues/29 + +1.6.0 / 2015-03-22 +================== +* update dependencies +* add jsx-no-undef rule +* add jsx-quotes rule ([#12][]) +* add @jsx pragma support ([#23][]) +* fix react-in-jsx-scope in Node.js env +* fix usage of propTypes with an external object ([#9][]) +* allow this.getState references (not calls) in lifecycle methods ([#22][] @benmosher) + +[#12]: https://github.com/yannickcr/eslint-plugin-react/issues/12 +[#23]: https://github.com/yannickcr/eslint-plugin-react/issues/23 +[#9]: https://github.com/yannickcr/eslint-plugin-react/issues/9 +[#22]: https://github.com/yannickcr/eslint-plugin-react/pull/22 + +1.5.0 / 2015-03-14 +================== +* add jsx-uses-vars rule +* fix jsx-uses-react for ESLint 0.17.0 + +1.4.1 / 2015-03-03 +================== +* fix this.props.children marked as missing in props validation ([#7][]) +* fix usage of this.props without property ([#8][]) + +[#7]: https://github.com/yannickcr/eslint-plugin-react/issues/7 +[#8]: https://github.com/yannickcr/eslint-plugin-react/issues/8 + +1.4.0 / 2015-02-24 +================== +* update prop-types to check props usage insead of propTypes presence ([#4][]) +* add react-in-jsx-scope rule ([#5][] @glenjamin) +* add jsx-uses-react rule ([#6][] @glenjamin) + +[#4]: https://github.com/yannickcr/eslint-plugin-react/issues/4 +[#5]: https://github.com/yannickcr/eslint-plugin-react/pull/5 +[#6]: https://github.com/yannickcr/eslint-plugin-react/pull/6 + +1.3.0 / 2015-02-24 +================== +* update dependencies +* add no-did-mount-set-state rule +* add no-did-update-set-state rule + +1.2.2 / 2015-02-09 +================== +* update dependencies +* fix childs detection in self-closing-comp ([#3][]) + +[#3]: https://github.com/yannickcr/eslint-plugin-react/issues/3 + +1.2.1 / 2015-01-29 +================== +* update Readme +* update dependencies +* update wrap-multilines and self-closing-comp rules for ESLint 0.13.0 + +1.2.0 / 2014-12-29 +================== +* add self-closing-comp rule +* fix display-name and prop-types rules + +1.1.0 / 2014-12-28 +================== + * add display-name rule + * add wrap-multilines rule + * add rules documentation + * add rules tests + +1.0.0 / 2014-12-16 +================== + * first revision diff --git a/node_modules/standard/node_modules/eslint-plugin-react/LICENSE b/node_modules/standard/node_modules/eslint-plugin-react/LICENSE new file mode 100644 index 00000000..6b5a43ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 Yannick Croissant + +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/node_modules/standard/node_modules/eslint-plugin-react/README.md b/node_modules/standard/node_modules/eslint-plugin-react/README.md new file mode 100644 index 00000000..b3d28811 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/README.md @@ -0,0 +1,115 @@ +ESLint-plugin-React +=================== + +[![Maintenance Status][status-image]][status-url] [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][deps-image]][deps-url] [![Coverage Status][coverage-image]][coverage-url] [![Code Climate][climate-image]][climate-url] + +React specific linting rules for ESLint + +# Installation + +Install [ESLint](https://www.github.com/eslint/eslint) either locally or globally. + + npm install eslint + +If you installed `ESLint` globally, you have to install React plugin globally too. Otherwise, install it locally. + + $ npm install eslint-plugin-react + +# Configuration + +Add `plugins` section and specify ESLint-plugin-React as a plugin. + +```json +{ + "plugins": [ + "react" + ] +} +``` + +If it is not already the case you must also configure `ESLint` to support JSX. + +```json +{ + "ecmaFeatures": { + "jsx": true + } +} +``` + +Finally, enable all of the rules that you would like to use. + +```json +{ + "rules": { + "react/display-name": 1, + "react/jsx-boolean-value": 1, + "react/jsx-quotes": 1, + "react/jsx-no-undef": 1, + "react/jsx-sort-props": 1, + "react/jsx-sort-prop-types": 1, + "react/jsx-uses-react": 1, + "react/jsx-uses-vars": 1, + "react/no-did-mount-set-state": 1, + "react/no-did-update-set-state": 1, + "react/no-multi-comp": 1, + "react/no-unknown-property": 1, + "react/prop-types": 1, + "react/react-in-jsx-scope": 1, + "react/self-closing-comp": 1, + "react/wrap-multilines": 1 + } +} +``` + +# List of supported rules + +* [display-name](docs/rules/display-name.md): Prevent missing displayName in a React component definition +* [jsx-boolean-value](docs/rules/jsx-boolean-value.md): Enforce boolean attributes notation in JSX +* [jsx-quotes](docs/rules/jsx-quotes.md): Enforce quote style for JSX attributes +* [jsx-no-undef](docs/rules/jsx-no-undef.md): Disallow undeclared variables in JSX +* [jsx-sort-props](docs/rules/jsx-sort-props.md): Enforce props alphabetical sorting +* [jsx-sort-prop-types](docs/rules/jsx-sort-prop-types.md): Enforce propTypes declarations alphabetical sorting +* [jsx-uses-react](docs/rules/jsx-uses-react.md): Prevent React to be incorrectly marked as unused +* [jsx-uses-vars](docs/rules/jsx-uses-vars.md): Prevent variables used in JSX to be incorrectly marked as unused +* [no-did-mount-set-state](docs/rules/no-did-mount-set-state.md): Prevent usage of setState in componentDidMount +* [no-did-update-set-state](docs/rules/no-did-update-set-state.md): Prevent usage of setState in componentDidUpdate +* [no-multi-comp](docs/rules/no-multi-comp.md): Prevent multiple component definition per file +* [no-unknown-property](docs/rules/no-unknown-property.md): Prevent usage of unknown DOM property +* [prop-types](docs/rules/prop-types.md): Prevent missing props validation in a React component definition +* [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing React when using JSX +* [self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children +* [wrap-multilines](docs/rules/wrap-multilines.md): Prevent missing parentheses around multilines JSX + +## To Do + +* no-deprecated: Prevent usage of deprecated methods ([React 0.12 Updated API](http://facebook.github.io/react/blog/2014/10/28/react-v0.12.html#new-terminology-amp-updated-apis)) +* no-classic: Prevent usage of "classic" methods ([#2700](https://github.com/facebook/react/pull/2700)) +* [Implement relevant rules from David Chang's React Style Guide](https://reactjsnews.com/react-style-guide-patterns-i-like) +* [Implement relevant rules from John Cobb's best practices and conventions](http://web-design-weekly.com/2015/01/29/opinionated-guide-react-js-best-practices-conventions/) +* [Implement relevant rules from Alexander Early's tips and best practices](http://aeflash.com/2015-02/react-tips-and-best-practices.html) + +[Any rule idea is welcome !](https://github.com/yannickcr/eslint-plugin-react/issues) + +# License + +ESLint-plugin-React is licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php). + + +[npm-url]: https://npmjs.org/package/eslint-plugin-react +[npm-image]: http://img.shields.io/npm/v/eslint-plugin-react.svg?style=flat-square + +[travis-url]: https://travis-ci.org/yannickcr/eslint-plugin-react +[travis-image]: http://img.shields.io/travis/yannickcr/eslint-plugin-react/master.svg?style=flat-square + +[deps-url]: https://david-dm.org/yannickcr/eslint-plugin-react +[deps-image]: https://img.shields.io/david/dev/yannickcr/eslint-plugin-react.svg?style=flat-square + +[coverage-url]: https://coveralls.io/r/yannickcr/eslint-plugin-react?branch=master +[coverage-image]: http://img.shields.io/coveralls/yannickcr/eslint-plugin-react/master.svg?style=flat-square + +[climate-url]: https://codeclimate.com/github/yannickcr/eslint-plugin-react +[climate-image]: http://img.shields.io/codeclimate/github/yannickcr/eslint-plugin-react.svg?style=flat-square + +[status-url]: https://github.com/yannickcr/eslint-plugin-react/pulse +[status-image]: http://img.shields.io/badge/status-maintained-brightgreen.svg?style=flat-square diff --git a/node_modules/standard/node_modules/eslint-plugin-react/index.js b/node_modules/standard/node_modules/eslint-plugin-react/index.js new file mode 100644 index 00000000..aaa6f682 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/index.js @@ -0,0 +1,40 @@ +'use strict'; + +module.exports = { + rules: { + 'jsx-uses-react': require('./lib/rules/jsx-uses-react'), + 'no-multi-comp': require('./lib/rules/no-multi-comp'), + 'prop-types': require('./lib/rules/prop-types'), + 'display-name': require('./lib/rules/display-name'), + 'wrap-multilines': require('./lib/rules/wrap-multilines'), + 'self-closing-comp': require('./lib/rules/self-closing-comp'), + 'no-did-mount-set-state': require('./lib/rules/no-did-mount-set-state'), + 'no-did-update-set-state': require('./lib/rules/no-did-update-set-state'), + 'react-in-jsx-scope': require('./lib/rules/react-in-jsx-scope'), + 'jsx-uses-vars': require('./lib/rules/jsx-uses-vars'), + 'jsx-no-undef': require('./lib/rules/jsx-no-undef'), + 'jsx-quotes': require('./lib/rules/jsx-quotes'), + 'no-unknown-property': require('./lib/rules/no-unknown-property'), + 'jsx-sort-props': require('./lib/rules/jsx-sort-props'), + 'jsx-sort-prop-types': require('./lib/rules/jsx-sort-prop-types'), + 'jsx-boolean-value': require('./lib/rules/jsx-boolean-value') + }, + rulesConfig: { + 'jsx-uses-react': 0, + 'no-multi-comp': 0, + 'prop-types': 0, + 'display-name': 0, + 'wrap-multilines': 0, + 'self-closing-comp': 0, + 'no-did-mount-set-state': 0, + 'no-did-update-set-state': 0, + 'react-in-jsx-scope': 0, + 'jsx-uses-vars': 1, + 'jsx-no-undef': 0, + 'jsx-quotes': 0, + 'no-unknown-property': 0, + 'jsx-sort-props': 0, + 'jsx-sort-prop-types': 0, + 'jsx-boolean-value': 0 + } +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/display-name.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/display-name.js new file mode 100644 index 00000000..811e7ea1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/display-name.js @@ -0,0 +1,143 @@ +/** + * @fileoverview Prevent missing displayName in a React component definition + * @author Yannick Croissant + */ +'use strict'; + +var componentUtil = require('../util/component'); +var ComponentList = componentUtil.List; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + var componentList = new ComponentList(); + + var MISSING_MESSAGE = 'Component definition is missing display name'; + var MISSING_MESSAGE_NAMED_COMP = '{{component}} component definition is missing display name'; + + /** + * Checks if the component must be validated + * @param {Object} component The component to process + * @returns {Boolean} True if the component must be validated, false if not. + */ + function mustBeValidated(component) { + return ( + component && + component.isReactComponent && + !component.hasDisplayName + ); + } + + /** + * Checks if we are declaring a display name + * @param {ASTNode} node The AST node being checked. + * @returns {Boolean} True if we are declaring a display name, false if not. + */ + function isDisplayNameDeclaration(node) { + + // Special case for class properties + // (babel-eslint does not expose property name so we have to rely on tokens) + if (node.type === 'ClassProperty') { + var tokens = context.getFirstTokens(node, 2); + if (tokens[0].value === 'displayName' || tokens[1].value === 'displayName') { + return true; + } + return false; + } + + return Boolean( + node && + node.name === 'displayName' + ); + } + + /** + * Mark a prop type as declared + * @param {ASTNode} node The AST node being checked. + */ + function markDisplayNameAsDeclared(node) { + componentList.set(context, node, { + hasDisplayName: true + }); + } + + /** + * Reports missing display name for a given component + * @param {Object} component The component to process + */ + function reportMissingDisplayName(component) { + context.report( + component.node, + component.name === componentUtil.DEFAULT_COMPONENT_NAME ? MISSING_MESSAGE : MISSING_MESSAGE_NAMED_COMP, { + component: component.name + } + ); + } + + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + + return { + + ClassProperty: function(node) { + if (!isDisplayNameDeclaration(node)) { + return; + } + + markDisplayNameAsDeclared(node); + }, + + MemberExpression: function(node) { + if (!isDisplayNameDeclaration(node.property)) { + return; + } + var component = componentList.getByName(node.object.name); + if (!component) { + return; + } + markDisplayNameAsDeclared(component.node); + }, + + MethodDefinition: function(node) { + if (!isDisplayNameDeclaration(node.key)) { + return; + } + markDisplayNameAsDeclared(node); + }, + + ObjectExpression: function(node) { + // Search for the displayName declaration + node.properties.forEach(function(property) { + if (!isDisplayNameDeclaration(property.key)) { + return; + } + markDisplayNameAsDeclared(node); + }); + }, + + 'Program:exit': function() { + var list = componentList.getList(); + // Report missing display name for all classes + for (var component in list) { + if (!list.hasOwnProperty(component) || !mustBeValidated(list[component])) { + continue; + } + reportMissingDisplayName(list[component]); + } + }, + + ReturnStatement: function(node) { + if (!componentUtil.isReactComponent(context, node)) { + return; + } + componentList.set(context, node, { + isReactComponent: true + }); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-boolean-value.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-boolean-value.js new file mode 100644 index 00000000..acf12eae --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-boolean-value.js @@ -0,0 +1,36 @@ +/** + * @fileoverview Enforce boolean attributes notation in JSX + * @author Yannick Croissant + */ +'use strict'; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + var configuration = context.options[0] || {}; + + var NEVER_MESSAGE = 'Value must be omitted for boolean attributes'; + var ALWAYS_MESSAGE = 'Value must be set for boolean attributes'; + + return { + JSXAttribute: function(node) { + switch (configuration) { + case 'always': + if (node.value === null) { + context.report(node, ALWAYS_MESSAGE); + } + break; + case 'never': + if (node.value && node.value.type === 'JSXExpressionContainer' && node.value.expression.value === true) { + context.report(node, NEVER_MESSAGE); + } + break; + default: + break; + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-no-undef.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-no-undef.js new file mode 100644 index 00000000..8a43f838 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-no-undef.js @@ -0,0 +1,65 @@ +/** + * @fileoverview Disallow undeclared variables in JSX + * @author Yannick Croissant + */ + +'use strict'; + +/** + * Checks if a node name match the JSX tag convention. + * @param {String} name - Name of the node to check. + * @returns {boolean} Whether or not the node name match the JSX tag convention. + */ +var tagConvention = /^[a-z]|\-/; +function isTagName(name) { + return tagConvention.test(name); +} + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Compare an identifier with the variables declared in the scope + * @param {ASTNode} node - Identifier or JSXIdentifier node + * @returns {void} + */ + function checkIdentifierInJSX(node) { + var scope = context.getScope(); + var variables = scope.variables; + var i; + var len; + + while (scope.type !== 'global') { + scope = scope.upper; + variables = scope.variables.concat(variables); + } + if (scope.childScopes.length) { + variables = scope.childScopes[0].variables.concat(variables); + // Temporary fix for babel-eslint + if (scope.childScopes[0].childScopes.length) { + variables = scope.childScopes[0].childScopes[0].variables.concat(variables); + } + } + + for (i = 0, len = variables.length; i < len; i++) { + if (variables[i].name === node.name) { + return; + } + } + + context.report(node, '\'' + node.name + '\' is not defined.'); + } + + return { + JSXOpeningElement: function(node) { + if (isTagName(node.name.name)) { + return; + } + checkIdentifierInJSX(node.name); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-quotes.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-quotes.js new file mode 100644 index 00000000..df193d46 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-quotes.js @@ -0,0 +1,70 @@ +/** + * @fileoverview Enforce props quotes style + * @author Matt DuVall , Brandon Payton, Yannick Croissant + */ +'use strict'; + +// ------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------ + +var QUOTE_SETTINGS = { + double: { + quote: '"', + alternateQuote: '\'', + description: 'doublequote' + }, + single: { + quote: '\'', + alternateQuote: '"', + description: 'singlequote' + } +}; + +var AVOID_ESCAPE = 'avoid-escape'; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Validate that a string passed in is surrounded by the specified character + * @param {string} val The text to check. + * @param {string} character The character to see if it's surrounded by. + * @returns {boolean} True if the text is surrounded by the character, false if not. + * @private + */ + function isSurroundedBy(val, character) { + return val[0] === character && val[val.length - 1] === character; + } + + return { + + Literal: function(node) { + if (node.parent.type !== 'JSXAttribute') { + return; + } + var val = node.value; + var rawVal = node.raw; + var quoteOption = context.options[0]; + var settings = QUOTE_SETTINGS[quoteOption]; + var avoidEscape = context.options[1] === AVOID_ESCAPE; + var isValid; + + if (settings && typeof val === 'string') { + isValid = isSurroundedBy(rawVal, settings.quote); + + if (!isValid && avoidEscape) { + isValid = isSurroundedBy(rawVal, settings.alternateQuote) && rawVal.indexOf(settings.quote) >= 0; + } + + if (!isValid) { + context.report(node, 'JSX attributes must use ' + settings.description + '.'); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-sort-prop-types.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-sort-prop-types.js new file mode 100644 index 00000000..bce91a4d --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-sort-prop-types.js @@ -0,0 +1,90 @@ +/** + * @fileoverview Enforce propTypes declarations alphabetical sorting + */ +'use strict'; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + var configuration = context.options[0] || {}; + var ignoreCase = configuration.ignoreCase || false; + + /** + * Checks if node is `propTypes` declaration + * @param {ASTNode} node The AST node being checked. + * @returns {Boolean} True if node is `propTypes` declaration, false if not. + */ + function isPropTypesDeclaration(node) { + + // Special case for class properties + // (babel-eslint does not expose property name so we have to rely on tokens) + if (node.type === 'ClassProperty') { + var tokens = context.getFirstTokens(node, 2); + if (tokens[0].value === 'propTypes' || tokens[1].value === 'propTypes') { + return true; + } + return false; + } + + return Boolean( + node && + node.name === 'propTypes' + ); + } + + /** + * Checks if propTypes declarations are sorted + * @param {Array} declarations The array of AST nodes being checked. + * @returns {void} + */ + function checkSorted(declarations) { + declarations.reduce(function(prev, curr) { + var prevPropName = prev.key.name; + var currenPropName = curr.key.name; + + if (ignoreCase) { + prevPropName = prevPropName.toLowerCase(); + currenPropName = currenPropName.toLowerCase(); + } + + if (currenPropName < prevPropName) { + context.report(curr, 'Prop types declarations should be sorted alphabetically'); + return prev; + } + + return curr; + }, declarations[0]); + } + + return { + ClassProperty: function(node) { + if (isPropTypesDeclaration(node) && node.value.type === 'ObjectExpression') { + checkSorted(node.value.properties); + } + }, + + MemberExpression: function(node) { + if (isPropTypesDeclaration(node.property)) { + var right = node.parent.right; + if (right && right.type === 'ObjectExpression') { + checkSorted(right.properties); + } + } + }, + + ObjectExpression: function(node) { + node.properties.forEach(function(property) { + if (!isPropTypesDeclaration(property.key)) { + return; + } + if (property.value.type === 'ObjectExpression') { + checkSorted(property.value.properties); + } + }); + } + + }; +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-sort-props.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-sort-props.js new file mode 100644 index 00000000..bcf1b68d --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-sort-props.js @@ -0,0 +1,40 @@ +/** + * @fileoverview Enforce props alphabetical sorting + * @author Ilya Volodin, Yannick Croissant + */ +'use strict'; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + var configuration = context.options[0] || {}; + var ignoreCase = configuration.ignoreCase || false; + + return { + JSXOpeningElement: function(node) { + node.attributes.reduce(function(memo, decl, idx, attrs) { + if (decl.type === 'JSXSpreadAttribute') { + return attrs[idx + 1]; + } + + var lastPropName = memo.name.name; + var currenPropName = decl.name.name; + + if (ignoreCase) { + lastPropName = lastPropName.toLowerCase(); + currenPropName = currenPropName.toLowerCase(); + } + + if (currenPropName < lastPropName) { + context.report(decl, 'Props should be sorted alphabetically'); + return memo; + } + + return decl; + }, node.attributes[0]); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-uses-react.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-uses-react.js new file mode 100644 index 00000000..d4fe5316 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-uses-react.js @@ -0,0 +1,39 @@ +/** + * @fileoverview Prevent React to be marked as unused + * @author Glen Mailer + */ +'use strict'; + +var variableUtil = require('../util/variable'); + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +var JSX_ANNOTATION_REGEX = /^\*\s*@jsx\s+([^\s]+)/; + +module.exports = function(context) { + + var id = 'React'; + + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + + return { + + JSXOpeningElement: function() { + variableUtil.markVariableAsUsed(context, id); + }, + + BlockComment: function(node) { + var matches = JSX_ANNOTATION_REGEX.exec(node.value); + if (!matches) { + return; + } + id = matches[1].split('.')[0]; + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-uses-vars.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-uses-vars.js new file mode 100644 index 00000000..f8428daf --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/jsx-uses-vars.js @@ -0,0 +1,32 @@ +/** + * @fileoverview Prevent variables used in JSX to be marked as unused + * @author Yannick Croissant + */ +'use strict'; + +var variableUtil = require('../util/variable'); + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + JSXExpressionContainer: function(node) { + if (node.expression.type !== 'Identifier') { + return; + } + variableUtil.markVariableAsUsed(context, node.expression.name); + }, + + JSXIdentifier: function(node) { + if (node.parent.type === 'JSXAttribute') { + return; + } + variableUtil.markVariableAsUsed(context, node.name); + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-did-mount-set-state.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-did-mount-set-state.js new file mode 100644 index 00000000..dae3d94f --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-did-mount-set-state.js @@ -0,0 +1,37 @@ +/** + * @fileoverview Prevent usage of setState in componentDidMount + * @author Yannick Croissant + */ +'use strict'; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + + return { + + CallExpression: function(node) { + var callee = node.callee; + if (callee.type !== 'MemberExpression') { + return; + } + if (callee.object.type !== 'ThisExpression' || callee.property.name !== 'setState') { + return; + } + var ancestors = context.getAncestors(callee); + for (var i = 0, j = ancestors.length; i < j; i++) { + if (ancestors[i].type !== 'Property' || ancestors[i].key.name !== 'componentDidMount') { + continue; + } + context.report(callee, 'Do not use setState in componentDidMount'); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-did-update-set-state.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-did-update-set-state.js new file mode 100644 index 00000000..21696ed7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-did-update-set-state.js @@ -0,0 +1,37 @@ +/** + * @fileoverview Prevent usage of setState in componentDidUpdate + * @author Yannick Croissant + */ +'use strict'; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + + return { + + CallExpression: function(node) { + var callee = node.callee; + if (callee.type !== 'MemberExpression') { + return; + } + if (callee.object.type !== 'ThisExpression' || callee.property.name !== 'setState') { + return; + } + var ancestors = context.getAncestors(callee); + for (var i = 0, j = ancestors.length; i < j; i++) { + if (ancestors[i].type !== 'Property' || ancestors[i].key.name !== 'componentDidUpdate') { + continue; + } + context.report(callee, 'Do not use setState in componentDidUpdate'); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-multi-comp.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-multi-comp.js new file mode 100644 index 00000000..c7dced8d --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-multi-comp.js @@ -0,0 +1,48 @@ +/** + * @fileoverview Prevent multiple component definition per file + * @author Yannick Croissant + */ +'use strict'; + +var componentUtil = require('../util/component'); +var ComponentList = componentUtil.List; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + var componentList = new ComponentList(); + + var MULTI_COMP_MESSAGE = 'Declare only one React component per file'; + + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + + return { + 'Program:exit': function() { + if (componentList.count() <= 1) { + return; + } + + var list = componentList.getList(); + var i = 0; + + for (var component in list) { + if (!list.hasOwnProperty(component) || ++i === 1) { + continue; + } + context.report(list[component].node, MULTI_COMP_MESSAGE); + } + }, + + ReturnStatement: function(node) { + if (!componentUtil.isReactComponent(context, node)) { + return; + } + componentList.set(context, node); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-unknown-property.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-unknown-property.js new file mode 100644 index 00000000..ab7526d8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/no-unknown-property.js @@ -0,0 +1,80 @@ +/** + * @fileoverview Prevent usage of unknown DOM property + * @author Yannick Croissant + */ +'use strict'; + +// ------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------ + +var UNKNOWN_MESSAGE = 'Unknown property \'{{name}}\' found, use \'{{standardName}}\' instead'; + +var DOM_ATTRIBUTE_NAMES = { + 'accept-charset': 'acceptCharset', + class: 'className', + for: 'htmlFor', + 'http-equiv': 'httpEquiv' +}; + +var DOM_PROPERTY_NAMES = [ + 'acceptCharset', 'accessKey', 'allowFullScreen', 'allowTransparency', 'autoComplete', 'autoFocus', 'autoPlay', + 'cellPadding', 'cellSpacing', 'charSet', 'classID', 'className', 'colSpan', 'contentEditable', 'contextMenu', + 'crossOrigin', 'dateTime', 'encType', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', + 'frameBorder', 'hrefLang', 'htmlFor', 'httpEquiv', 'marginHeight', 'marginWidth', 'maxLength', 'mediaGroup', + 'noValidate', 'radioGroup', 'readOnly', 'rowSpan', 'spellCheck', 'srcDoc', 'srcSet', 'tabIndex', 'useMap', + 'itemProp', 'itemScope', 'itemType', 'itemRef', 'itemId' +]; + +// ------------------------------------------------------------------------------ +// Helpers +// ------------------------------------------------------------------------------ + +/** + * Checks if a node name match the JSX tag convention. + * @param {String} name - Name of the node to check. + * @returns {boolean} Whether or not the node name match the JSX tag convention. + */ +var tagConvention = /^[a-z]|\-/; +function isTagName(name) { + return tagConvention.test(name); +} + +/** + * Get the standard name of the attribute. + * @param {String} name - Name of the attribute. + * @returns {String} The standard name of the attribute. + */ +function getStandardName(name) { + if (DOM_ATTRIBUTE_NAMES[name]) { + return DOM_ATTRIBUTE_NAMES[name]; + } + var i; + var found = DOM_PROPERTY_NAMES.some(function(element, index) { + i = index; + return element.toLowerCase() === name; + }); + return found ? DOM_PROPERTY_NAMES[i] : null; +} + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + JSXAttribute: function(node) { + var standardName = getStandardName(node.name.name); + if (!isTagName(node.parent.name.name) || !standardName) { + return; + } + context.report(node, UNKNOWN_MESSAGE, { + name: node.name.name, + standardName: standardName + }); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/prop-types.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/prop-types.js new file mode 100644 index 00000000..b397f79d --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/prop-types.js @@ -0,0 +1,291 @@ +/** + * @fileoverview Prevent missing props validation in a React component definition + * @author Yannick Croissant + */ +'use strict'; + +// As for exceptions for props.children or props.className (and alike) look at +// https://github.com/yannickcr/eslint-plugin-react/issues/7 + +var componentUtil = require('../util/component'); +var ComponentList = componentUtil.List; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + var configuration = context.options[0] || {}; + var ignored = configuration.ignore || []; + + var componentList = new ComponentList(); + + var MISSING_MESSAGE = '\'{{name}}\' is missing in props validation'; + var MISSING_MESSAGE_NAMED_COMP = '\'{{name}}\' is missing in props validation for {{component}}'; + + /** + * Checks if we are using a prop + * @param {ASTNode} node The AST node being checked. + * @returns {Boolean} True if we are using a prop, false if not. + */ + function isPropTypesUsage(node) { + return Boolean( + node.object.type === 'ThisExpression' && + node.property.name === 'props' + ); + } + + /** + * Checks if we are declaring a prop + * @param {ASTNode} node The AST node being checked. + * @returns {Boolean} True if we are declaring a prop, false if not. + */ + function isPropTypesDeclaration(node) { + + // Special case for class properties + // (babel-eslint does not expose property name so we have to rely on tokens) + if (node.type === 'ClassProperty') { + var tokens = context.getFirstTokens(node, 2); + if (tokens[0].value === 'propTypes' || tokens[1].value === 'propTypes') { + return true; + } + return false; + } + + return Boolean( + node && + node.name === 'propTypes' + ); + + } + + /** + * Checks if the prop is ignored + * @param {String} name Name of the prop to check. + * @returns {Boolean} True if the prop is ignored, false if not. + */ + function isIgnored(name) { + return ignored.indexOf(name) !== -1; + } + + /** + * Checks if the component must be validated + * @param {Object} component The component to process + * @returns {Boolean} True if the component must be validated, false if not. + */ + function mustBeValidated(component) { + return ( + component && + component.isReactComponent && + component.usedPropTypes && + !component.ignorePropsValidation + ); + } + + /** + * Checks if the prop is declared + * @param {String} name Name of the prop to check. + * @param {Object} component The component to process + * @returns {Boolean} True if the prop is declared, false if not. + */ + function isDeclaredInComponent(component, name) { + return ( + component.declaredPropTypes && + component.declaredPropTypes.indexOf(name) !== -1 + ); + } + + /** + * Checks if the prop has spread operator. + * @param {ASTNode} node The AST node being marked. + * @returns {Boolean} True if the prop has spread operator, false if not. + */ + function hasSpreadOperator(node) { + var tokens = context.getTokens(node); + return tokens.length && tokens[0].value === '...'; + } + + /** + * Mark a prop type as used + * @param {ASTNode} node The AST node being marked. + */ + function markPropTypesAsUsed(node) { + var component = componentList.getByNode(context, node); + var usedPropTypes = component && component.usedPropTypes || []; + var type; + if (node.parent.property && node.parent.property.name && !node.parent.computed) { + type = 'direct'; + } else if ( + node.parent.parent.declarations && + node.parent.parent.declarations[0].id.properties && + node.parent.parent.declarations[0].id.properties[0].key.name + ) { + type = 'destructuring'; + } + + switch (type) { + case 'direct': + usedPropTypes.push({ + name: node.parent.property.name, + node: node + }); + break; + case 'destructuring': + var properties = node.parent.parent.declarations[0].id.properties; + for (var i = 0, j = properties.length; i < j; i++) { + if (hasSpreadOperator(properties[i])) { + continue; + } + usedPropTypes.push({ + name: properties[i].key.name, + node: node + }); + } + break; + default: + break; + } + + componentList.set(context, node, { + usedPropTypes: usedPropTypes + }); + } + + /** + * Mark a prop type as declared + * @param {ASTNode} node The AST node being checked. + * @param {propTypes} node The AST node containing the proptypes + */ + function markPropTypesAsDeclared(node, propTypes) { + var component = componentList.getByNode(context, node); + var declaredPropTypes = component && component.declaredPropTypes || []; + var ignorePropsValidation = false; + + switch (propTypes.type) { + case 'ObjectExpression': + for (var i = 0, j = propTypes.properties.length; i < j; i++) { + declaredPropTypes.push(propTypes.properties[i].key.name); + } + break; + case 'MemberExpression': + declaredPropTypes.push(propTypes.property.name); + break; + default: + ignorePropsValidation = true; + break; + } + + componentList.set(context, node, { + declaredPropTypes: declaredPropTypes, + ignorePropsValidation: ignorePropsValidation + }); + + } + + /** + * Reports undeclared proptypes for a given component + * @param {Object} component The component to process + */ + function reportUndeclaredPropTypes(component) { + var name; + for (var i = 0, j = component.usedPropTypes.length; i < j; i++) { + name = component.usedPropTypes[i].name; + if (isDeclaredInComponent(component, name) || isIgnored(name)) { + continue; + } + context.report( + component.usedPropTypes[i].node, + component.name === componentUtil.DEFAULT_COMPONENT_NAME ? MISSING_MESSAGE : MISSING_MESSAGE_NAMED_COMP, { + name: name, + component: component.name + } + ); + } + } + + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + + return { + + ClassProperty: function(node) { + if (!isPropTypesDeclaration(node)) { + return; + } + + markPropTypesAsDeclared(node, node.value); + }, + + MemberExpression: function(node) { + var type; + if (isPropTypesUsage(node)) { + type = 'usage'; + } else if (isPropTypesDeclaration(node.property)) { + type = 'declaration'; + } + + switch (type) { + case 'usage': + markPropTypesAsUsed(node); + break; + case 'declaration': + var component = componentList.getByName(node.object.name); + if (!component) { + return; + } + markPropTypesAsDeclared(component.node, node.parent.right || node.parent); + break; + default: + break; + } + }, + + MethodDefinition: function(node) { + if (!isPropTypesDeclaration(node.key)) { + return; + } + + var i = node.value.body.body.length - 1; + for (; i >= 0; i--) { + if (node.value.body.body[i].type === 'ReturnStatement') { + break; + } + } + + markPropTypesAsDeclared(node, node.value.body.body[i].argument); + }, + + ObjectExpression: function(node) { + // Search for the displayName declaration + node.properties.forEach(function(property) { + if (!isPropTypesDeclaration(property.key)) { + return; + } + markPropTypesAsDeclared(node, property.value); + }); + }, + + 'Program:exit': function() { + var list = componentList.getList(); + // Report undeclared proptypes for all classes + for (var component in list) { + if (!list.hasOwnProperty(component) || !mustBeValidated(list[component])) { + continue; + } + reportUndeclaredPropTypes(list[component]); + } + }, + + ReturnStatement: function(node) { + if (!componentUtil.isReactComponent(context, node)) { + return; + } + componentList.set(context, node, { + isReactComponent: true + }); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/react-in-jsx-scope.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/react-in-jsx-scope.js new file mode 100644 index 00000000..b59f1ee6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/react-in-jsx-scope.js @@ -0,0 +1,42 @@ +/** + * @fileoverview Prevent missing React when using JSX + * @author Glen Mailer + */ +'use strict'; + +var variableUtil = require('../util/variable'); + +// ----------------------------------------------------------------------------- +// Rule Definition +// ----------------------------------------------------------------------------- + +var JSX_ANNOTATION_REGEX = /^\*\s*@jsx\s+([^\s]+)/; + +module.exports = function(context) { + + var id = 'React'; + var NOT_DEFINED_MESSAGE = '\'{{name}}\' must be in scope when using JSX'; + + return { + + JSXOpeningElement: function(node) { + var variables = variableUtil.variablesInScope(context); + if (variableUtil.findVariable(variables, id)) { + return; + } + context.report(node, NOT_DEFINED_MESSAGE, { + name: id + }); + }, + + BlockComment: function(node) { + var matches = JSX_ANNOTATION_REGEX.exec(node.value); + if (!matches) { + return; + } + id = matches[1].split('.')[0]; + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/self-closing-comp.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/self-closing-comp.js new file mode 100644 index 00000000..d944d7e9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/self-closing-comp.js @@ -0,0 +1,47 @@ +/** + * @fileoverview Prevent extra closing tags for components without children + * @author Yannick Croissant + */ +'use strict'; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + var tagConvention = /^[a-z]|\-/; + function isTagName(name) { + return tagConvention.test(name); + } + + function isComponent(node) { + return node.name && node.name.type === 'JSXIdentifier' && !isTagName(node.name.name); + } + + function hasChildren(node) { + var childrens = node.parent.children; + if ( + !childrens.length || + (childrens.length === 1 && childrens[0].type === 'Literal' && !childrens[0].value.trim()) + ) { + return false; + } + return true; + } + + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + + return { + + JSXOpeningElement: function(node) { + if (!isComponent(node) || node.selfClosing || hasChildren(node)) { + return; + } + context.report(node, 'Empty components are self-closing'); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/wrap-multilines.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/wrap-multilines.js new file mode 100644 index 00000000..44b8b83c --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/rules/wrap-multilines.js @@ -0,0 +1,55 @@ +/** + * @fileoverview Prevent missing parentheses around multilines JSX + * @author Yannick Croissant + */ +'use strict'; + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = function(context) { + + function isParenthesised(node) { + var previousToken = context.getTokenBefore(node); + var nextToken = context.getTokenAfter(node); + + return previousToken && nextToken && + previousToken.value === '(' && previousToken.range[1] <= node.range[0] && + nextToken.value === ')' && nextToken.range[0] >= node.range[1]; + } + + function isMultilines(node) { + return node.loc.start.line !== node.loc.end.line; + } + + function check(node) { + if (!node || node.type !== 'JSXElement') { + return; + } + + if (!isParenthesised(node) && isMultilines(node)) { + context.report(node, 'Missing parentheses around multilines JSX'); + } + } + + // -------------------------------------------------------------------------- + // Public + // -------------------------------------------------------------------------- + + return { + + VariableDeclarator: function(node) { + check(node.init); + }, + + AssignmentExpression: function(node) { + check(node.right); + }, + + ReturnStatement: function(node) { + check(node.argument); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/util/component.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/util/component.js new file mode 100644 index 00000000..8b55b69f --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/util/component.js @@ -0,0 +1,207 @@ +/** + * @fileoverview Utility functions for React components detection + * @author Yannick Croissant + */ +'use strict'; + +var util = require('util'); + +var DEFAULT_COMPONENT_NAME = 'eslintReactComponent'; + +/** + * Detect if we are in a React Component + * A React component is defined has an object/class with a property "render" + * that return a JSXElement or null/false + * @param {Object} context The current rule context. + * @param {ASTNode} node The AST node being checked. + * @returns {Boolean} True if we are in a React Component, false if not. + */ +function isReactComponent(context, node) { + if (node.type !== 'ReturnStatement') { + throw new Error('React Component detection must be done from a ReturnStatement ASTNode'); + } + + var scope = context.getScope(); + var isComponentRender = + node.argument && + node.argument.type === 'JSXElement' && + scope.block.parent.key && scope.block.parent.key.name === 'render' + ; + var isEmptyComponentRender = + node.argument && + node.argument.type === 'Literal' && (node.argument.value === null || node.argument.value === false) && + scope.block.parent.key && scope.block.parent.key.name === 'render' + ; + + return Boolean(isEmptyComponentRender || isComponentRender); +} + +/** + * Detect if the node is a component definition + * @param {ASTNode} node The AST node being checked. + * @returns {Boolean} True the node is a component definition, false if not. + */ +function isComponentDefinition(node) { + var isES6Component = node.type === 'ClassDeclaration'; + var isES5Component = Boolean( + node.type === 'ObjectExpression' && + node.parent && + node.parent.callee && + node.parent.callee.object && + node.parent.callee.property && + node.parent.callee.object.name === 'React' && + node.parent.callee.property.name === 'createClass' + ); + return isES5Component || isES6Component; +} + +/** + * Get the React component ASTNode from any child ASTNode + * @param {Object} context The current rule context. + * @param {ASTNode} node The AST node being checked. + * @returns {ASTNode} The ASTNode of the React component. + */ +function getNode(context, node) { + var componentNode = null; + var ancestors = context.getAncestors().reverse(); + + ancestors.unshift(node); + + for (var i = 0, j = ancestors.length; i < j; i++) { + if (isComponentDefinition(ancestors[i])) { + componentNode = ancestors[i]; + break; + } + } + + return componentNode; +} + +/** + * Get the identifiers of a React component ASTNode + * @param {ASTNode} node The React component ASTNode being checked. + * @returns {Object} The component identifiers. + */ +function getIdentifiers(node) { + var name = node.id && node.id.name || DEFAULT_COMPONENT_NAME; + var id = name + ':' + node.loc.start.line + ':' + node.loc.start.column; + + return { + id: id, + name: name + }; +} + +/** + * Store a React component list + * @constructor + */ +function List() { + this._list = {}; + this._length = 0; +} + +/** + * Find a component in the list by his node or one of his child node + * @param {Object} context The current rule context. + * @param {ASTNode} node The node to find. + * @returns {Object|null} The component if it is found, null if not. + */ +List.prototype.getByNode = function(context, node) { + var componentNode = getNode(context, node); + if (!componentNode) { + return null; + } + var identifiers = getIdentifiers(componentNode); + + return this._list[identifiers.id] || null; +}; + +/** + * Find a component in the list by his name + * @param {String} name Name of the component to find. + * @returns {Object|null} The component if it is found, null if not. + */ +List.prototype.getByName = function(name) { + for (var component in this._list) { + if (this._list.hasOwnProperty(component) && this._list[component].name === name) { + return this._list[component]; + } + } + return null; +}; + +/** + * Return the component list + * @returns {Object} The component list. + */ +List.prototype.getList = function() { + return this._list; +}; + +/** + * Add/update a component in the list + * @param {Object} context The current rule context. + * @param {ASTNode} node The node to add. + * @param {Object} customProperties Additional properties to add to the component. + * @returns {Object} The added component. + */ +List.prototype.set = function(context, node, customProperties) { + var componentNode = getNode(context, node); + if (!componentNode) { + return null; + } + var identifiers = getIdentifiers(componentNode); + + var component = util._extend({ + name: identifiers.name, + node: componentNode + }, customProperties || {}); + + if (!this._list[identifiers.id]) { + this._length++; + } + + this._list[identifiers.id] = util._extend(this._list[identifiers.id] || {}, component); + + return component; +}; + +/** + * Remove a component from the list + * @param {Object} context The current rule context. + * @param {ASTNode} node The node to remove. + */ +List.prototype.remove = function(context, node) { + var componentNode = getNode(context, node); + if (!componentNode) { + return null; + } + var identifiers = getIdentifiers(componentNode); + + if (!this._list[identifiers.id]) { + return null; + } + + delete this._list[identifiers.id]; + this._length--; + + return null; +}; + +/** + * Return the component list length + * @returns {Number} The component list length. + */ +List.prototype.count = function() { + return this._length; +}; + +module.exports = { + DEFAULT_COMPONENT_NAME: DEFAULT_COMPONENT_NAME, + isReactComponent: isReactComponent, + getNode: getNode, + isComponentDefinition: isComponentDefinition, + getIdentifiers: getIdentifiers, + List: List +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/lib/util/variable.js b/node_modules/standard/node_modules/eslint-plugin-react/lib/util/variable.js new file mode 100644 index 00000000..93b4d7fd --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/lib/util/variable.js @@ -0,0 +1,94 @@ +/** + * @fileoverview Utility functions for React components detection + * @author Yannick Croissant + */ +'use strict'; + +/** + * Record that a particular variable has been used in code + * + * Similar to the one coming from ESLint but with a patch for babel-eslint + * to avoid https://github.com/babel/babel-eslint/issues/21 + * + * @param {String} name The name of the variable to mark as used. + * @returns {Boolean} True if the variable was found and marked as used, false if not. + */ +function markVariableAsUsed(context, name) { + var scope = context.getScope(); + var variables; + var i; + var len; + + // Special Node.js scope means we need to start one level deeper + if (scope.type === 'global' && scope.childScopes.length) { + scope = scope.childScopes[0]; + if (scope.childScopes.length) { + scope = scope.childScopes[0]; + } + } + + do { + variables = scope.variables; + for (i = 0, len = variables.length; i < len; i++) { + if (variables[i].name === name) { + variables[i].eslintUsed = true; + return true; + } + } + scope = scope.upper; + } while (scope); + + return false; +} + +/** + * Search a particular variable in a list + * @param {Array} variables The variables list. + * @param {Array} name The name of the variable to search. + * @returns {Boolean} True if the variable was found, false if not. + */ +function findVariable(variables, name) { + var i; + var len; + + for (i = 0, len = variables.length; i < len; i++) { + if (variables[i].name === name) { + return true; + } + } + + return false; +} + +/** + * List all variable in a given scope + * + * Contain a patch for babel-eslint to avoid https://github.com/babel/babel-eslint/issues/21 + * + * @param {Object} context The current rule context. + * @param {Array} name The name of the variable to search. + * @returns {Boolean} True if the variable was found, false if not. + */ +function variablesInScope(context) { + var scope = context.getScope(); + var variables = scope.variables; + + while (scope.type !== 'global') { + scope = scope.upper; + variables = scope.variables.concat(variables); + } + if (scope.childScopes.length) { + variables = scope.childScopes[0].variables.concat(variables); + if (scope.childScopes[0].childScopes.length) { + variables = scope.childScopes[0].childScopes[0].variables.concat(variables); + } + } + + return variables; +} + +module.exports = { + findVariable: findVariable, + variablesInScope: variablesInScope, + markVariableAsUsed: markVariableAsUsed +}; diff --git a/node_modules/standard/node_modules/eslint-plugin-react/package.json b/node_modules/standard/node_modules/eslint-plugin-react/package.json new file mode 100644 index 00000000..9ae55450 --- /dev/null +++ b/node_modules/standard/node_modules/eslint-plugin-react/package.json @@ -0,0 +1,76 @@ +{ + "name": "eslint-plugin-react", + "version": "2.2.0", + "author": { + "name": "Yannick Croissant", + "email": "yannick.croissant+npm@gmail.com" + }, + "description": "React specific linting rules for ESLint", + "main": "index.js", + "scripts": { + "test": "npm run lint && npm run unit-test", + "lint": "eslint ./", + "unit-test": "istanbul cover --dir reports/coverage _mocha tests/**/*.js -- --reporter dot", + "coveralls": "cat ./reports/coverage/lcov.info | coveralls" + }, + "files": [ + "LICENSE", + "README.md", + "index.js", + "lib" + ], + "repository": { + "type": "git", + "url": "https://github.com/yannickcr/eslint-plugin-react" + }, + "homepage": "https://github.com/yannickcr/eslint-plugin-react", + "bugs": { + "url": "https://github.com/yannickcr/eslint-plugin-react/issues" + }, + "devDependencies": { + "babel-eslint": "3.0.1", + "coveralls": "2.11.2", + "eslint": "0.19.0", + "eslint-tester": "git+https://github.com/eslint/eslint-tester#c2a1f722cd", + "istanbul": "0.3.13", + "mocha": "2.2.4" + }, + "peerDependencies": { + "eslint": ">=0.8.0" + }, + "keywords": [ + "eslint-plugin", + "eslintplugin", + "eslint", + "react" + ], + "licenses": [ + { + "type": "MIT", + "url": "https://raw.github.com/yannickcr/eslint-plugin-react/master/LICENSE" + } + ], + "gitHead": "c59a6d81865857269c69a9e680e7c36a429ce555", + "_id": "eslint-plugin-react@2.2.0", + "_shasum": "4ea201404bf01bd549d0c44392029d8997ecf89b", + "_from": "eslint-plugin-react@>=2.1.0 <3.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "yannickcr", + "email": "yannick.croissant+npm@gmail.com" + }, + "dist": { + "shasum": "4ea201404bf01bd549d0c44392029d8997ecf89b", + "tarball": "http://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-2.2.0.tgz" + }, + "maintainers": [ + { + "name": "yannickcr", + "email": "yannick.croissant+npm@gmail.com" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-2.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/LICENSE b/node_modules/standard/node_modules/eslint/LICENSE new file mode 100644 index 00000000..3f7b4baa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/LICENSE @@ -0,0 +1,20 @@ +ESLint +Copyright (c) 2013 Nicholas C. Zakas. All rights reserved. + +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/node_modules/standard/node_modules/eslint/README.md b/node_modules/standard/node_modules/eslint/README.md new file mode 100644 index 00000000..118d4aae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/README.md @@ -0,0 +1,79 @@ +[![NPM version][npm-image]][npm-url] +[![build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![Downloads][downloads-image]][downloads-url] +[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=282608)](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE) + +# ESLint + +[Website](http://eslint.org) | [Configuring](http://eslint.org/docs/user-guide/configuring) | [Rules](http://eslint.org/docs/user-guide/rules) | [Contributing](http://eslint.org/docs/developer-guide/contributing.html) | [Twitter](https://twitter.com/geteslint) | [Mailing List](https://groups.google.com/group/eslint) + +ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions: + +* ESLint uses [Espree](https://github.com/eslint/espree) for JavaScript parsing. +* ESLint uses an AST to evaluate patterns in code. +* ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime. + +## Installation + +You can install ESLint using npm: + + npm install -g eslint + +## Usage + + eslint test.js test2.js + +## Frequently Asked Questions + +### Why don't you like JSHint??? + +I do like JSHint. And I like Anton and Rick. Neither of those were deciding factors in creating this tool. The fact is that I've had a dire need for a JavaScript tool with pluggable linting rules. I had hoped JSHint would be able to do this, however after chatting with Anton, I found that the planned plugin infrastructure wasn't going to suit my purpose. + +### I'm not giving up JSHint for this! + +That's not really a question, but I got it. I'm not trying to convince you that ESLint is better than JSHint. The only thing I know is that ESLint is better than JSHint for what I'm doing. In the off chance you're doing something similar, it might be better for you. Otherwise, keep using JSHint, I'm certainly not going to tell you to stop using it. + +### How does ESLint performance compare to JSHint? + +ESLint is slower than JSHint, usually 2-3x slower on a single file. This is because ESLint uses Espree to construct an AST before it can evaluate your code whereas JSHint evaluates your code as it's being parsed. The speed is also based on the number of rules you enable; the more rules you enable, the slower the process. + +Despite being slower, we believe that ESLint is fast enough to replace JSHint without causing significant pain. + +### Is ESLint just linting or does it also check style? + +ESLint does both traditional linting (looking for problematic patterns) and style checking (enforcement of conventions). You can use it for both. + +### Who is using ESLint? + +The following projects are using ESLint to validate their JavaScript: + +* [Drupal](https://www.drupal.org/node/2274223) +* [Esprima](https://github.com/ariya/esprima) +* [WebKit](https://bugs.webkit.org/show_bug.cgi?id=125048) + +In addition, the following companies are using ESLint internally to validate their JavaScript: + +* [Box](https://box.com) +* [CustomInk](https://customink.com) +* [Fitbit](http://www.fitbit.com) +* [HolidayCheck](http://holidaycheck.de) +* [the native web](http://www.thenativeweb.io) + +### What about ECMAScript 6 support? + +We are implementing ECMAScript 6 support piece-by-piece starting with version 0.12.0. You'll be able to opt-in to any ECMAScript 6 feature you want to use. + +### Where to ask for help? + +Join our [Mailing List](https://groups.google.com/group/eslint) + + +[npm-image]: https://img.shields.io/npm/v/eslint.svg?style=flat-square +[npm-url]: https://npmjs.org/package/eslint +[travis-image]: https://img.shields.io/travis/eslint/eslint/master.svg?style=flat-square +[travis-url]: https://travis-ci.org/eslint/eslint +[coveralls-image]: https://img.shields.io/coveralls/eslint/eslint/master.svg?style=flat-square +[coveralls-url]: https://coveralls.io/r/eslint/eslint?branch=master +[downloads-image]: http://img.shields.io/npm/dm/eslint.svg?style=flat-square +[downloads-url]: https://npmjs.org/package/eslint diff --git a/node_modules/standard/node_modules/eslint/bin/eslint.js b/node_modules/standard/node_modules/eslint/bin/eslint.js new file mode 100755 index 00000000..0188c2e6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/bin/eslint.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node +var concat = require("concat-stream"), + cli = require("../lib/cli"); + +var exitCode = 0, + useStdIn = (process.argv.indexOf("--stdin") > -1); + +if (useStdIn) { + process.stdin.pipe(concat({ encoding: "string" }, function(text) { + try { + exitCode = cli.execute(process.argv, text); + } catch (ex) { + console.error(ex.message); + console.error(ex.stack); + exitCode = 1; + } + })); +} else { + exitCode = cli.execute(process.argv); +} + +/* + * Wait for the stdout buffer to drain. + * See https://github.com/eslint/eslint/issues/317 + */ +process.on("exit", function() { + process.exit(exitCode); +}); diff --git a/node_modules/standard/node_modules/eslint/conf/environments.js b/node_modules/standard/node_modules/eslint/conf/environments.js new file mode 100644 index 00000000..f59b852f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/conf/environments.js @@ -0,0 +1,78 @@ +/** + * @fileoverview Defines environment settings and globals. + * @author Elan Shanker + * @copyright 2014 Elan Shanker. All rights reserved. + */ +"use strict"; + +var globals = require("globals"); + +module.exports = { + builtin: globals.builtin, + browser: { + globals: globals.browser + }, + node: { + globals: globals.node, + ecmaFeatures: { + globalReturn: true + }, + rules: { + "no-catch-shadow": 0, + "no-console": 0, + "no-mixed-requires": 2, + "no-new-require": 2, + "no-path-concat": 2, + "no-process-exit": 2, + "global-strict": [0, "always"], + "handle-callback-err": [2, "err"] + } + }, + amd: { + globals: globals.amd + }, + mocha: { + globals: globals.mocha + }, + jasmine: { + globals: globals.jasmine + }, + phantomjs: { + globals: globals.phantom + }, + jquery: { + globals: globals.jquery + }, + prototypejs: { + globals: globals.prototypejs + }, + shelljs: { + globals: globals.shelljs + }, + meteor: { + globals: globals.meteor + }, + es6: { + ecmaFeatures: { + arrowFunctions: true, + blockBindings: true, + regexUFlag: true, + regexYFlag: true, + templateStrings: true, + binaryLiterals: true, + octalLiterals: true, + unicodeCodePointEscapes: true, + superInFunctions: true, + defaultParams: true, + restParams: true, + forOf: true, + objectLiteralComputedProperties: true, + objectLiteralShorthandMethods: true, + objectLiteralShorthandProperties: true, + objectLiteralDuplicateProperties: true, + generators: true, + destructuring: true, + classes: true + } + } +}; diff --git a/node_modules/standard/node_modules/eslint/conf/eslint.json b/node_modules/standard/node_modules/eslint/conf/eslint.json new file mode 100644 index 00000000..593e5852 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/conf/eslint.json @@ -0,0 +1,169 @@ +{ + "ecmaFeatures": {}, + "parser": "espree", + "env": { + "browser": false, + "node": false, + "amd": false, + "mocha": false, + "jasmine": false + }, + + "rules": { + "no-alert": 2, + "no-array-constructor": 2, + "no-bitwise": 0, + "no-caller": 2, + "no-catch-shadow": 2, + "no-comma-dangle": 0, + "no-cond-assign": 2, + "no-console": 2, + "no-constant-condition": 2, + "no-control-regex": 2, + "no-debugger": 2, + "no-delete-var": 2, + "no-div-regex": 0, + "no-dupe-keys": 2, + "no-dupe-args": 2, + "no-duplicate-case": 2, + "no-else-return": 0, + "no-empty": 2, + "no-empty-class": 2, + "no-empty-label": 2, + "no-eq-null": 0, + "no-eval": 2, + "no-ex-assign": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-extra-boolean-cast": 2, + "no-extra-parens": 0, + "no-extra-semi": 2, + "no-extra-strict": 2, + "no-fallthrough": 2, + "no-floating-decimal": 0, + "no-func-assign": 2, + "no-implied-eval": 2, + "no-inline-comments": 0, + "no-inner-declarations": [2, "functions"], + "no-invalid-regexp": 2, + "no-irregular-whitespace": 2, + "no-iterator": 2, + "no-label-var": 2, + "no-labels": 2, + "no-lone-blocks": 2, + "no-lonely-if": 0, + "no-loop-func": 2, + "no-mixed-requires": [0, false], + "no-mixed-spaces-and-tabs": [2, false], + "no-multi-spaces": 2, + "no-multi-str": 2, + "no-multiple-empty-lines": [0, {"max": 2}], + "no-native-reassign": 2, + "no-negated-in-lhs": 2, + "no-nested-ternary": 0, + "no-new": 2, + "no-new-func": 2, + "no-new-object": 2, + "no-new-require": 0, + "no-new-wrappers": 2, + "no-obj-calls": 2, + "no-octal": 2, + "no-octal-escape": 2, + "no-param-reassign": 0, + "no-path-concat": 0, + "no-plusplus": 0, + "no-process-env": 0, + "no-process-exit": 2, + "no-proto": 2, + "no-redeclare": 2, + "no-regex-spaces": 2, + "no-reserved-keys": 0, + "no-restricted-modules": 0, + "no-return-assign": 2, + "no-script-url": 2, + "no-self-compare": 0, + "no-sequences": 2, + "no-shadow": 2, + "no-shadow-restricted-names": 2, + "no-space-before-semi": 0, + "no-spaced-func": 2, + "no-sparse-arrays": 2, + "no-sync": 0, + "no-ternary": 0, + "no-trailing-spaces": 2, + "no-throw-literal": 0, + "no-undef": 2, + "no-undef-init": 2, + "no-undefined": 0, + "no-underscore-dangle": 2, + "no-unreachable": 2, + "no-unused-expressions": 2, + "no-unused-vars": [2, {"vars": "all", "args": "after-used"}], + "no-use-before-define": 2, + "no-void": 0, + "no-var": 0, + "no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }], + "no-with": 2, + "no-wrap-func": 2, + + "block-scoped-var": 0, + "brace-style": [0, "1tbs"], + "camelcase": 2, + "comma-dangle": [2, "never"], + "comma-spacing": 2, + "comma-style": 0, + "complexity": [0, 11], + "consistent-return": 2, + "consistent-this": [0, "that"], + "curly": [2, "all"], + "default-case": 0, + "dot-notation": [2, { "allowKeywords": true }], + "eol-last": 2, + "eqeqeq": 2, + "func-names": 0, + "func-style": [0, "declaration"], + "generator-star": 0, + "generator-star-spacing": 0, + "global-strict": [2, "never"], + "guard-for-in": 0, + "handle-callback-err": 0, + "indent": 0, + "key-spacing": [2, { "beforeColon": false, "afterColon": true }], + "max-depth": [0, 4], + "max-len": [0, 80, 4], + "max-nested-callbacks": [0, 2], + "max-params": [0, 3], + "max-statements": [0, 10], + "new-cap": 2, + "new-parens": 2, + "newline-after-var": 0, + "one-var": 0, + "operator-assignment": [0, "always"], + "padded-blocks": 0, + "quote-props": 0, + "quotes": [2, "double"], + "radix": 0, + "semi": 2, + "semi-spacing": [2, {"before": false, "after": true}], + "sort-vars": 0, + "space-after-function-name": [0, "never"], + "space-after-keywords": [0, "always"], + "space-before-blocks": [0, "always"], + "space-before-function-paren": [0, "always"], + "space-before-function-parentheses": [0, "always"], + "space-in-brackets": [0, "never"], + "space-in-parens": [0, "never"], + "space-infix-ops": 2, + "space-return-throw-case": 2, + "space-unary-ops": [2, { "words": true, "nonwords": false }], + "spaced-line-comment": [0, "always"], + "strict": 2, + "use-isnan": 2, + "valid-jsdoc": 0, + "valid-typeof": 2, + "vars-on-top": 0, + "wrap-iife": 0, + "wrap-regex": 0, + "yoda": [2, "never"] + } +} diff --git a/node_modules/standard/node_modules/eslint/lib/api.js b/node_modules/standard/node_modules/eslint/lib/api.js new file mode 100644 index 00000000..aafad533 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/api.js @@ -0,0 +1,12 @@ +/** + * @fileoverview Expose out ESLint and CLI to require. + * @author Ian Christian Myers + */ + +"use strict"; + +module.exports = { + linter: require("./eslint"), + cli: require("./cli"), + CLIEngine: require("./cli-engine") +}; diff --git a/node_modules/standard/node_modules/eslint/lib/cli-engine.js b/node_modules/standard/node_modules/eslint/lib/cli-engine.js new file mode 100644 index 00000000..2085ace3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/cli-engine.js @@ -0,0 +1,416 @@ +/** + * @fileoverview Main CLI object. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + */ + +"use strict"; + +/* + * The CLI object should *not* call process.exit() directly. It should only return + * exit codes. This allows other programs to use the CLI object and still control + * when the program exits. + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var fs = require("fs"), + path = require("path"), + + assign = require("object-assign"), + debug = require("debug"), + + rules = require("./rules"), + eslint = require("./eslint"), + traverse = require("./util/traverse"), + IgnoredPaths = require("./ignored-paths"), + Config = require("./config"), + util = require("./util"); + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +/** + * The options to configure a CLI engine with. + * @typedef {Object} CLIEngineOptions + * @property {string} configFile The configuration file to use. + * @property {boolean} reset True disables all default rules and environments. + * @property {boolean} ignore False disables use of .eslintignore. + * @property {string[]} rulePaths An array of directories to load custom rules from. + * @property {boolean} useEslintrc False disables looking for .eslintrc + * @property {string[]} envs An array of environments to load. + * @property {string[]} globals An array of global variables to declare. + * @property {string[]} extensions An array of file extensions to check. + * @property {Object} rules An object of rules to use. + * @property {string} ignorePath The ignore file to use instead of .eslintignore. + */ + +/** + * A linting warning or error. + * @typedef {Object} LintMessage + * @property {string} message The message to display to the user. + */ + +/** + * A linting result. + * @typedef {Object} LintResult + * @property {string} filePath The path to the file that was linted. + * @property {LintMessage[]} messages All of the messages for the result. + */ + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + + +var defaultOptions = { + configFile: null, + reset: false, + rulePaths: [], + useEslintrc: true, + envs: [], + globals: [], + rules: {}, + extensions: [".js"], + ignore: true, + ignorePath: null + }, + loadedPlugins = Object.create(null); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +debug = debug("eslint:cli-engine"); + +/** + * Load the given plugins if they are not loaded already. + * @param {string[]} pluginNames An array of plugin names which should be loaded. + * @returns {void} + */ +function loadPlugins(pluginNames) { + if (pluginNames) { + pluginNames.forEach(function (pluginName) { + var pluginNameWithoutPrefix = util.removePluginPrefix(pluginName), + plugin; + + if (!loadedPlugins[pluginNameWithoutPrefix]) { + debug("Load plugin " + pluginNameWithoutPrefix); + + plugin = require(util.PLUGIN_NAME_PREFIX + pluginNameWithoutPrefix); + // if this plugin has rules, import them + if (plugin.rules) { + rules.import(plugin.rules, pluginNameWithoutPrefix); + } + + loadedPlugins[pluginNameWithoutPrefix] = plugin; + } + }); + } +} + +/** + * It will calculate the error and warning count for collection of messages per file + * @param {Object[]} messages - Collection of messages + * @returns {Object} Contains the stats + * @private + */ +function calculateStatsPerFile(messages) { + return messages.reduce(function(stat, message) { + if (message.fatal || message.severity === 2) { + stat.errorCount++; + } else { + stat.warningCount++; + } + return stat; + }, { + errorCount: 0, + warningCount: 0 + }); +} + +/** + * It will calculate the error and warning count for collection of results from all files + * @param {Object[]} results - Collection of messages from all the files + * @returns {Object} Contains the stats + * @private + */ +function calculateStatsPerRun(results) { + return results.reduce(function(stat, result) { + stat.errorCount += result.errorCount; + stat.warningCount += result.warningCount; + return stat; + }, { + errorCount: 0, + warningCount: 0 + }); +} + +/** + * Processes an individual file using ESLint. Files used here are known to + * exist, so no need to check that here. + * @param {string} filename The filename of the file being checked. + * @param {Object} configHelper The configuration options for ESLint. + * @returns {Result} The results for linting on this file. + * @private + */ +function processFile(filename, configHelper) { + + // clear all existing settings for a new file + eslint.reset(); + + var filePath = path.resolve(filename), + config, + text, + messages, + stats, + fileExtension = path.extname(filename), + processor; + + debug("Linting " + filePath); + config = configHelper.getConfig(filePath); + loadPlugins(config.plugins); + text = fs.readFileSync(path.resolve(filename), "utf8"); + + for (var plugin in loadedPlugins) { + if (loadedPlugins[plugin].processors && Object.keys(loadedPlugins[plugin].processors).indexOf(fileExtension) >= 0) { + processor = loadedPlugins[plugin].processors[fileExtension]; + break; + } + } + + if (processor) { + var parsedBlocks = processor.preprocess(text, filename); + var unprocessedMessages = []; + parsedBlocks.forEach(function(block) { + unprocessedMessages.push(eslint.verify(block, config, filename)); + }); + messages = processor.postprocess(unprocessedMessages, filename); + } else { + messages = eslint.verify(text, config, filename); + } + + stats = calculateStatsPerFile(messages); + + return { + filePath: filename, + messages: messages, + errorCount: stats.errorCount, + warningCount: stats.warningCount + }; +} + +/** + * Processes an source code using ESLint. + * @param {string} text The source code to check. + * @param {Object} configHelper The configuration options for ESLint. + * @returns {Result} The results for linting on this text. + * @private + */ +function processText(text, configHelper) { + + // clear all existing settings for a new file + eslint.reset(); + + var config, + messages, + stats; + + debug("Linting "); + config = configHelper.getConfig(); + loadPlugins(config.plugins); + messages = eslint.verify(text, config, ""); + + stats = calculateStatsPerFile(messages); + + return { + filePath: "", + messages: messages, + errorCount: stats.errorCount, + warningCount: stats.warningCount + }; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Creates a new instance of the core CLI engine. + * @param {CLIEngineOptions} options The options for this instance. + * @constructor + */ +function CLIEngine(options) { + + /** + * Stored options for this instance + * @type {Object} + */ + this.options = assign(Object.create(defaultOptions), options || {}); + + // load in additional rules + if (this.options.rulePaths) { + this.options.rulePaths.forEach(function(rulesdir) { + debug("Loading rules from " + rulesdir); + rules.load(rulesdir); + }); + } + + loadPlugins(this.options.plugins); +} + +CLIEngine.prototype = { + + constructor: CLIEngine, + + /** + * Executes the current configuration on an array of file and directory names. + * @param {string[]} files An array of file and directory names. + * @returns {Object} The results for all files that were linted. + */ + executeOnFiles: function(files) { + + var results = [], + processed = [], + options = this.options, + configHelper = new Config(options), + ignoredPaths = IgnoredPaths.load(options), + exclude = ignoredPaths.contains.bind(ignoredPaths), + stats; + + traverse({ + files: files, + extensions: options.extensions, + exclude: options.ignore ? exclude : false + }, function(filename) { + + debug("Processing " + filename); + + processed.push(filename); + results.push(processFile(filename, configHelper)); + }); + + // only warn for files explicitly passed on the command line + if (options.ignore) { + files.forEach(function(file) { + if (fs.statSync(path.resolve(file)).isFile() && processed.indexOf(file) === -1) { + results.push({ + filePath: file, + messages: [ + { + fatal: false, + severity: 1, + message: "File ignored because of your .eslintignore file. Use --no-ignore to override." + } + ], + errorCount: 0, + warningCount: 1 + }); + } + }); + } + + stats = calculateStatsPerRun(results); + + return { + results: results, + errorCount: stats.errorCount, + warningCount: stats.warningCount + }; + }, + + /** + * Executes the current configuration on text. + * @param {string} text A string of JavaScript code to lint. + * @returns {Object} The results for the linting. + */ + executeOnText: function(text) { + + var configHelper = new Config(this.options), + results = [], + stats; + + results.push(processText(text, configHelper)); + stats = calculateStatsPerRun(results); + + return { + results: results, + errorCount: stats.errorCount, + warningCount: stats.warningCount + }; + }, + + /** + * Returns a configuration object for the given file based on the CLI options. + * This is the same logic used by the ESLint CLI executable to determine + * configuration for each file it processes. + * @param {string} filePath The path of the file to retrieve a config object for. + * @returns {Object} A configuration object for the file. + */ + getConfigForFile: function(filePath) { + var configHelper = new Config(this.options); + return configHelper.getConfig(filePath); + }, + + /** + * Checks if a given path is ignored by ESLint. + * @param {string} filePath The path of the file to check. + * @returns {boolean} Whether or not the given path is ignored. + */ + isPathIgnored: function (filePath) { + var ignoredPaths; + + if (this.options.ignore) { + ignoredPaths = IgnoredPaths.load(this.options); + return ignoredPaths.contains(filePath); + } + + return false; + }, + + /** + * Returns the formatter representing the given format or null if no formatter + * with the given name can be found. + * @param {string} [format] The name of the format to load or the path to a + * custom formatter. + * @returns {Function} The formatter function or null if not found. + */ + getFormatter: function(format) { + + var formatterPath; + + // default is stylish + format = format || "stylish"; + + // only strings are valid formatters + if (typeof format === "string") { + + // replace \ with / for Windows compatibility + format = format.replace(/\\/g, "/"); + + // if there's a slash, then it's a file + if (format.indexOf("/") > -1) { + formatterPath = path.resolve(process.cwd(), format); + } else { + formatterPath = "./formatters/" + format; + } + + try { + return require(formatterPath); + } catch (ex) { + return null; + } + + } else { + return null; + } + + + } + +}; + +module.exports = CLIEngine; diff --git a/node_modules/standard/node_modules/eslint/lib/cli.js b/node_modules/standard/node_modules/eslint/lib/cli.js new file mode 100644 index 00000000..91d04981 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/cli.js @@ -0,0 +1,195 @@ +/** + * @fileoverview Main CLI object. + * @author Nicholas C. Zakas + */ + +"use strict"; + +/* + * The CLI object should *not* call process.exit() directly. It should only return + * exit codes. This allows other programs to use the CLI object and still control + * when the program exits. + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var fs = require("fs"), + path = require("path"), + + debug = require("debug"), + + options = require("./options"), + CLIEngine = require("./cli-engine"), + mkdirp = require("mkdirp"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +debug = debug("eslint:cli"); + +/** + * Translates the CLI options into the options expected by the CLIEngine. + * @param {Object} cliOptions The CLI options to translate. + * @returns {CLIEngineOptions} The options object for the CLIEngine. + * @private + */ +function translateOptions(cliOptions) { + return { + envs: cliOptions.env, + extensions: cliOptions.ext, + rules: cliOptions.rule, + plugins: cliOptions.plugin, + globals: cliOptions.global, + ignore: cliOptions.ignore, + ignorePath: cliOptions.ignorePath, + configFile: cliOptions.config, + rulePaths: cliOptions.rulesdir, + reset: cliOptions.reset, + useEslintrc: cliOptions.eslintrc + }; +} + +/** + * Outputs the results of the linting. + * @param {CLIEngine} engine The CLIEngine to use. + * @param {LintResult[]} results The results to print. + * @param {string} format The name of the formatter to use or the path to the formatter. + * @param {string} outputFile The path for the output file. + * @returns {boolean} True if the printing succeeds, false if not. + * @private + */ +function printResults(engine, results, format, outputFile) { + var formatter, + output, + filePath; + + formatter = engine.getFormatter(format); + if (!formatter) { + console.error("Could not find formatter '%s'.", format); + return false; + } + + output = formatter(results); + + if (output) { + if (outputFile) { + filePath = path.resolve(process.cwd(), outputFile); + + if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) { + console.error("Cannot write to output file path, it is a directory: %s", outputFile); + return false; + } + + try { + mkdirp.sync(path.dirname(filePath)); + fs.writeFileSync(filePath, output); + } catch (ex) { + console.error("There was a problem writing the output file:\n%s", ex); + return false; + } + } else { + console.log(output); + } + } + + return true; + +} + +/** + * Checks if the given message is an error message. + * @param {object} message The message to check. + * @returns {boolean} Whether or not the message is an error message. + */ +function isErrorMessage(message) { + return message.severity === 2; +} + +/** + * Returns results that only contains errors. + * @param {LintResult[]} results The results to filter. + * @returns {LintResult[]} The filtered results. + */ +function getErrorResults(results) { + var filtered = []; + + results.forEach(function (result) { + var filteredMessages = result.messages.filter(isErrorMessage); + + if (filteredMessages.length > 0) { + filtered.push({ + filePath: result.filePath, + messages: filteredMessages + }); + } + }); + + return filtered; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Encapsulates all CLI behavior for eslint. Makes it easier to test as well as + * for other Node.js programs to effectively run the CLI. + */ +var cli = { + + /** + * Executes the CLI based on an array of arguments that is passed in. + * @param {string|Array|Object} args The arguments to process. + * @param {string} [text] The text to lint (used for TTY). + * @returns {int} The exit code for the operation. + */ + execute: function(args, text) { + + var currentOptions, + files, + result, + engine; + + try { + currentOptions = options.parse(args); + } catch (error) { + console.error(error.message); + return 1; + } + + files = currentOptions._; + + if (currentOptions.version) { // version from package.json + + console.log("v" + require("../package.json").version); + + } else if (currentOptions.help || (!files.length && !text)) { + + console.log(options.generateHelp()); + + } else { + + engine = new CLIEngine(translateOptions(currentOptions)); + debug("Running on " + (text ? "text" : "files")); + + result = text ? engine.executeOnText(text) : engine.executeOnFiles(files); + if (currentOptions.quiet) { + result.results = getErrorResults(result.results); + } + + if (printResults(engine, result.results, currentOptions.format, currentOptions.outputFile)) { + return result.errorCount ? 1 : 0; + } else { + return 1; + } + + } + + return 0; + } +}; + +module.exports = cli; diff --git a/node_modules/standard/node_modules/eslint/lib/config.js b/node_modules/standard/node_modules/eslint/lib/config.js new file mode 100644 index 00000000..d716b0c3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/config.js @@ -0,0 +1,343 @@ +/** + * @fileoverview Responsible for loading config files + * @author Seth McLaughlin + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2013 Seth McLaughlin. All rights reserved. + * @copyright 2014 Michael McLaughlin. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var fs = require("fs"), + path = require("path"), + environments = require("../conf/environments"), + util = require("./util"), + FileFinder = require("./file-finder"), + stripComments = require("strip-json-comments"), + assign = require("object-assign"), + debug = require("debug"), + yaml = require("js-yaml"), + userHome = require("user-home"); + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +var LOCAL_CONFIG_FILENAME = ".eslintrc", + PACKAGE_CONFIG_FILENAME = "package.json", + PACKAGE_CONFIG_FIELD_NAME = "eslintConfig", + PERSONAL_CONFIG_PATH = userHome ? path.join(userHome, LOCAL_CONFIG_FILENAME) : null; + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +var loadedPlugins = Object.create(null); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +debug = debug("eslint:config"); + +/** + * Load and parse a JSON config object from a file. + * @param {string} filePath the path to the JSON config file + * @returns {Object} the parsed config object (empty object if there was a parse error) + */ +function loadConfig(filePath) { + var config = {}; + + if (filePath) { + try { + config = yaml.safeLoad(stripComments(fs.readFileSync(filePath, "utf8"))) || {}; + } catch (e) { + debug("Error reading YAML file: " + filePath); + e.message = "Cannot read config file: " + filePath + "\nError: " + e.message; + throw e; + } + } + + return config; +} + +/** + * Load configuration for all plugins provided. + * @param {string[]} pluginNames An array of plugin names which should be loaded. + * @returns {Object} all plugin configurations merged together + */ +function getPluginsConfig(pluginNames) { + var pluginConfig = {}; + + if (pluginNames) { + pluginNames.forEach(function (pluginName) { + var pluginNameWithoutPrefix = util.removePluginPrefix(pluginName), + plugin = {}, + rules = {}; + + if (!loadedPlugins[pluginNameWithoutPrefix]) { + try { + plugin = require(util.PLUGIN_NAME_PREFIX + pluginNameWithoutPrefix); + loadedPlugins[pluginNameWithoutPrefix] = plugin; + } catch(err) { + debug("Failed to load plugin configuration for " + pluginNameWithoutPrefix + ". Proceeding without it."); + plugin = { rulesConfig: {}}; + } + } else { + plugin = loadedPlugins[pluginNameWithoutPrefix]; + } + + if (!plugin.rulesConfig) { + plugin.rulesConfig = {}; + } + + Object.keys(plugin.rulesConfig).forEach(function(item) { + rules[pluginNameWithoutPrefix + "/" + item] = plugin.rulesConfig[item]; + }); + + pluginConfig = util.mergeConfigs(pluginConfig, rules); + }); + } + + return {rules: pluginConfig}; +} + +/** + * Get personal config object from ~/.eslintrc. + * @returns {Object} the personal config object (empty object if there is no personal config) + * @private + */ +function getPersonalConfig() { + var config = {}; + + if (PERSONAL_CONFIG_PATH && fs.existsSync(PERSONAL_CONFIG_PATH)) { + debug("Using personal config"); + config = loadConfig(PERSONAL_CONFIG_PATH); + } + + return config; +} + +/** + * Get a local config object. + * @param {Object} thisConfig A Config object. + * @param {string} directory The directory to start looking in for a local config file. + * @returns {Object} The local config object, or an empty object if there is no local config. + */ +function getLocalConfig(thisConfig, directory) { + var found, + i, + localConfig, + localConfigFile, + config = {}, + localConfigFiles = thisConfig.findLocalConfigFiles(directory), + numFiles = localConfigFiles.length; + + for (i = 0; i < numFiles; i++) { + + localConfigFile = localConfigFiles[i]; + localConfig = loadConfig(localConfigFile); + + if (path.basename(localConfigFile) !== LOCAL_CONFIG_FILENAME) { + + // Don't consider a local config file found if the package.json doesn't have the eslintConfig field. + if (!localConfig.hasOwnProperty(PACKAGE_CONFIG_FIELD_NAME)) { + continue; + } + localConfig = localConfig[PACKAGE_CONFIG_FIELD_NAME] || {}; + } + + found = true; + debug("Using " + localConfigFile); + config = util.mergeConfigs(localConfig, config); + } + + // Use the personal config file if there are no other local config files found. + return found ? config : util.mergeConfigs(config, getPersonalConfig()); +} + +/** + * Creates an environment config based on the specified environments. + * @param {Object} envs The environment settings. + * @param {boolean} reset The value of the command line reset option. If true, + * rules are not automatically merged into the config. + * @returns {Object} A configuration object with the appropriate rules and globals + * set. + * @private + */ +function createEnvironmentConfig(envs, reset) { + + var envConfig = { + globals: {}, + env: envs || {}, + rules: {}, + ecmaFeatures: {} + }; + + if (envs) { + Object.keys(envs).filter(function (name) { + return envs[name]; + }).forEach(function(name) { + var environment = environments[name]; + + if (environment) { + + if (!reset && environment.rules) { + assign(envConfig.rules, environment.rules); + } + + if (environment.globals) { + assign(envConfig.globals, environment.globals); + } + + if (environment.ecmaFeatures) { + assign(envConfig.ecmaFeatures, environment.ecmaFeatures); + } + } + }); + } + + return envConfig; +} + +//------------------------------------------------------------------------------ +// API +//------------------------------------------------------------------------------ + +/** + * Config + * @constructor + * @class Config + * @param {Object} options Options to be passed in + * @param {string} [cwd] current working directory. Defaults to process.cwd() + */ +function Config(options) { + var useConfig; + options = options || {}; + + this.ignore = options.ignore; + this.ignorePath = options.ignorePath; + this.cache = {}; + + this.baseConfig = options.reset ? { rules: {} } : + require(path.resolve(__dirname, "..", "conf", "eslint.json")); + + this.baseConfig.format = options.format; + this.useEslintrc = (options.useEslintrc !== false); + + this.env = (options.envs || []).reduce(function (envs, name) { + envs[name] = true; + return envs; + }, {}); + + this.globals = (options.globals || []).reduce(function (globals, def) { + // Default "foo" to false and handle "foo:false" and "foo:true" + var parts = def.split(":"); + globals[parts[0]] = (parts.length > 1 && parts[1] === "true"); + return globals; + }, {}); + + useConfig = options.configFile; + this.options = options; + + if (useConfig) { + debug("Using command line config " + useConfig); + this.useSpecificConfig = loadConfig(path.resolve(process.cwd(), useConfig)); + } +} + +/** + * Build a config object merging the base config (conf/eslint.json), the + * environments config (conf/environments.js) and eventually the user config. + * @param {string} filePath a file in whose directory we start looking for a local config + * @returns {Object} config object + */ +Config.prototype.getConfig = function (filePath) { + var config, + userConfig, + directory = filePath ? path.dirname(filePath) : process.cwd(), + pluginConfig; + + debug("Constructing config for " + (filePath ? filePath : "text")); + + config = this.cache[directory]; + + if (config) { + debug("Using config from cache"); + return config; + } + + // Step 1: Determine user-specified config from .eslintrc and package.json files + if (this.useEslintrc) { + debug("Using .eslintrc and package.json files"); + userConfig = getLocalConfig(this, directory); + } else { + debug("Not using .eslintrc or package.json files"); + userConfig = {}; + } + + // Step 2: Create a copy of the baseConfig + config = util.mergeConfigs({}, this.baseConfig); + + // Step 3: Merge in environment-specific globals and rules from .eslintrc files + config = util.mergeConfigs(config, createEnvironmentConfig(userConfig.env, this.options.reset)); + + // Step 4: Merge in the user-specified configuration from .eslintrc and package.json + config = util.mergeConfigs(config, userConfig); + + // Step 5: Merge in command line config file + if (this.useSpecificConfig) { + debug("Merging command line config file"); + + if (this.useSpecificConfig.env) { + config = util.mergeConfigs(config, createEnvironmentConfig(this.useSpecificConfig.env, this.options.reset)); + } + + config = util.mergeConfigs(config, this.useSpecificConfig); + } + + // Step 6: Merge in command line environments + if (this.env) { + debug("Merging command line environment settings"); + config = util.mergeConfigs(config, createEnvironmentConfig(this.env, this.options.reset)); + } + + // Step 7: Merge in command line rules + if (this.options.rules) { + debug("Merging command line rules"); + config = util.mergeConfigs(config, { rules: this.options.rules }); + } + + // Step 8: Merge in command line globals + config = util.mergeConfigs(config, { globals: this.globals }); + + + // Step 9: Merge in plugin specific rules in reverse + if (config.plugins) { + pluginConfig = getPluginsConfig(config.plugins); + config = util.mergeConfigs(pluginConfig, config); + } + + this.cache[directory] = config; + + return config; +}; + +/** + * Find local config files from directory and parent directories. + * @param {string} directory The directory to start searching from. + * @returns {string[]} The paths of local config files found. + */ +Config.prototype.findLocalConfigFiles = function (directory) { + + if (!this.localConfigFinder) { + this.localConfigFinder = new FileFinder(LOCAL_CONFIG_FILENAME, PACKAGE_CONFIG_FILENAME); + } + + return this.localConfigFinder.findAllInDirectoryAndParents(directory); +}; + +module.exports = Config; diff --git a/node_modules/standard/node_modules/eslint/lib/eslint.js b/node_modules/standard/node_modules/eslint/lib/eslint.js new file mode 100644 index 00000000..573b053f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/eslint.js @@ -0,0 +1,1064 @@ +/** + * @fileoverview Main ESLint object. + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var estraverse = require("estraverse-fb"), + escope = require("escope"), + environments = require("../conf/environments"), + assign = require("object-assign"), + rules = require("./rules"), + util = require("./util"), + RuleContext = require("./rule-context"), + timing = require("./timing"), + createTokenStore = require("./token-store.js"), + EventEmitter = require("events").EventEmitter, + escapeRegExp = require("escape-string-regexp"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +// Have to modify estraverse until TryStatement.handlers is removed +estraverse.VisitorKeys.TryStatement = ["block", "handlers", "finalizer"]; + +// TODO: Remove when estraverse is updated +estraverse.Syntax.ExportNamedDeclaration = "ExportNamedDeclaration"; +estraverse.Syntax.ExportDefaultDeclaration = "ExportDefaultDeclaration"; +estraverse.Syntax.ExportAllDeclaration = "ExportAllDeclaration"; +estraverse.Syntax.ExportSpecifier = "ExportSpecifier"; +estraverse.VisitorKeys.ExportNamedDeclaration = ["declaration", "specifies", "source"]; +estraverse.VisitorKeys.ExportAllDeclaration = ["source"]; +estraverse.VisitorKeys.ExportDefaultDeclaration = ["declaration"]; +estraverse.VisitorKeys.ExportNamedDeclaration = ["declaration", "specifiers", "source"]; +estraverse.VisitorKeys.ExportSpecifier = ["exported", "local"]; +/** + * Parses a list of "name:boolean_value" or/and "name" options divided by comma or + * whitespace. + * @param {string} string The string to parse. + * @returns {Object} Result map object of names and boolean values + */ +function parseBooleanConfig(string) { + var items = {}; + // Collapse whitespace around : to make parsing easier + string = string.replace(/\s*:\s*/g, ":"); + // Collapse whitespace around , + string = string.replace(/\s*,\s*/g, ","); + string.split(/\s|,+/).forEach(function(name) { + if (!name) { + return; + } + var pos = name.indexOf(":"), + value; + if (pos !== -1) { + value = name.substring(pos + 1, name.length); + name = name.substring(0, pos); + } + + items[name] = (value === "true"); + + }); + return items; +} + +/** + * Parses a JSON-like config. + * @param {string} string The string to parse. + * @param {Object} location Start line and column of comments for potential error message. + * @param {Object[]} messages The messages queue for potential error message. + * @returns {Object} Result map object + */ +function parseJsonConfig(string, location, messages) { + var items = {}; + string = string.replace(/([a-zA-Z0-9\-\/]+):/g, "\"$1\":").replace(/(\]|[0-9])\s+(?=")/, "$1,"); + try { + items = JSON.parse("{" + string + "}"); + } catch(ex) { + + messages.push({ + fatal: true, + severity: 2, + message: "Failed to parse JSON from '" + string + "': " + ex.message, + line: location.start.line, + column: location.start.column + }); + + } + + return items; +} + +/** + * Parses a config of values separated by comma. + * @param {string} string The string to parse. + * @returns {Object} Result map of values and true values + */ +function parseListConfig(string) { + var items = {}; + // Collapse whitespace around , + string = string.replace(/\s*,\s*/g, ","); + string.split(/,+/).forEach(function(name) { + name = name.trim(); + if (!name) { + return; + } + items[name] = true; + }); + return items; +} + +/** + * @param {Scope} scope The scope object to check. + * @param {string} name The name of the variable to look up. + * @returns {Variable} The variable object if found or null if not. + */ +function getVariable(scope, name) { + var variable = null; + scope.variables.some(function(v) { + if (v.name === name) { + variable = v; + return true; + } else { + return false; + } + + }); + return variable; +} + +/** + * Ensures that variables representing built-in properties of the Global Object, + * and any globals declared by special block comments, are present in the global + * scope. + * @param {ASTNode} program The top node of the AST. + * @param {Scope} globalScope The global scope. + * @param {Object} config The existing configuration data. + * @returns {void} + */ +function addDeclaredGlobals(program, globalScope, config) { + var declaredGlobals = {}, + explicitGlobals = {}, + builtin = environments.builtin; + + assign(declaredGlobals, builtin); + + Object.keys(config.env).forEach(function (name) { + if (config.env[name]) { + var environmentGlobals = environments[name] && environments[name].globals; + if (environmentGlobals) { + assign(declaredGlobals, environmentGlobals); + } + } + }); + + assign(declaredGlobals, config.globals); + assign(explicitGlobals, config.astGlobals); + + Object.keys(declaredGlobals).forEach(function(name) { + var variable = getVariable(globalScope, name); + if (!variable) { + variable = new escope.Variable(name, globalScope); + variable.eslintExplicitGlobal = false; + globalScope.variables.push(variable); + } + variable.writeable = declaredGlobals[name]; + }); + + Object.keys(explicitGlobals).forEach(function(name) { + var variable = getVariable(globalScope, name); + if (!variable) { + variable = new escope.Variable(name, globalScope); + variable.eslintExplicitGlobal = true; + globalScope.variables.push(variable); + } + variable.writeable = explicitGlobals[name]; + }); +} + +/** + * Add data to reporting configuration to disable reporting for list of rules + * starting from start location + * @param {Object[]} reportingConfig Current reporting configuration + * @param {Object} start Position to start + * @param {string[]} rulesToDisable List of rules + * @returns {void} + */ +function disableReporting(reportingConfig, start, rulesToDisable) { + + if (rulesToDisable.length) { + rulesToDisable.forEach(function(rule) { + reportingConfig.push({ + start: start, + end: null, + rule: rule + }); + }); + } else { + reportingConfig.push({ + start: start, + end: null, + rule: null + }); + } +} + +/** + * Add data to reporting configuration to enable reporting for list of rules + * starting from start location + * @param {Object[]} reportingConfig Current reporting configuration + * @param {Object} start Position to start + * @param {string[]} rulesToEnable List of rules + * @returns {void} + */ +function enableReporting(reportingConfig, start, rulesToEnable) { + var i; + + if (rulesToEnable.length) { + rulesToEnable.forEach(function(rule) { + for (i = reportingConfig.length - 1; i >= 0; i--) { + if (!reportingConfig[i].end && reportingConfig[i].rule === rule ) { + reportingConfig[i].end = start; + break; + } + } + }); + } else { + // find all previous disabled locations if they was started as list of rules + var prevStart; + for (i = reportingConfig.length - 1; i >= 0; i--) { + if (prevStart && prevStart !== reportingConfig[i].start) { + break; + } + + if (!reportingConfig[i].end) { + reportingConfig[i].end = start; + prevStart = reportingConfig[i].start; + } + } + } +} + +/** + * Parses comments in file to extract file-specific config of rules, globals + * and environments and merges them with global config; also code blocks + * where reporting is disabled or enabled and merges them with reporting config. + * @param {ASTNode} ast The top node of the AST. + * @param {Object} config The existing configuration data. + * @param {Object[]} reportingConfig The existing reporting configuration data. + * @param {Object[]} messages The messages queue. + * @returns {void} + */ +function modifyConfigsFromComments(ast, config, reportingConfig, messages) { + + var commentConfig = { + astGlobals: {}, + rules: {}, + env: {} + }; + var commentRules = {}; + + ast.comments.forEach(function(comment) { + + var value = comment.value.trim(); + var match = /^(eslint-\w+|eslint-\w+-\w+|eslint|globals?)(\s|$)/.exec(value); + + if (match) { + value = value.substring(match.index + match[1].length); + + if (comment.type === "Block") { + switch (match[1]) { + case "globals": + case "global": + util.mixin(commentConfig.astGlobals, parseBooleanConfig(value)); + break; + + case "eslint-env": + util.mixin(commentConfig.env, parseListConfig(value)); + break; + + case "eslint-disable": + disableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value))); + break; + + case "eslint-enable": + enableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value))); + break; + + case "eslint": + var items = parseJsonConfig(value, comment.loc, messages); + Object.keys(items).forEach(function(name) { + var ruleValue = items[name]; + if (typeof ruleValue === "number" || (Array.isArray(ruleValue) && typeof ruleValue[0] === "number")) { + commentRules[name] = ruleValue; + } + }); + break; + + // no default + } + } else { + // comment.type === "Line" + if (match[1] === "eslint-disable-line") { + disableReporting(reportingConfig, { "line": comment.loc.start.line, "column": 0 }, Object.keys(parseListConfig(value))); + enableReporting(reportingConfig, comment.loc.end, Object.keys(parseListConfig(value))); + } + } + } + }); + + // apply environment rules before user rules + Object.keys(commentConfig.env).forEach(function (name) { + var environmentRules = environments[name] && environments[name].rules; + if (commentConfig.env[name] && environmentRules) { + util.mixin(commentConfig.rules, environmentRules); + } + }); + util.mixin(commentConfig.rules, commentRules); + + util.mergeConfigs(config, commentConfig); +} + +/** + * Check if message of rule with ruleId should be ignored in location + * @param {Object[]} reportingConfig Collection of ignore records + * @param {string} ruleId Id of rule + * @param {Object} location Location of message + * @returns {boolean} True if message should be ignored, false otherwise + */ +function isDisabledByReportingConfig(reportingConfig, ruleId, location) { + + for (var i = 0, c = reportingConfig.length; i < c; i++) { + + var ignore = reportingConfig[i]; + if ((!ignore.rule || ignore.rule === ruleId) && + (location.line > ignore.start.line || (location.line === ignore.start.line && location.column >= ignore.start.column)) && + (!ignore.end || (location.line < ignore.end.line || (location.line === ignore.end.line && location.column <= ignore.end.column)))) { + return true; + } + } + + return false; +} + +/** + * Process initial config to make it safe to extend by file comment config + * @param {Object} config Initial config + * @returns {Object} Processed config + */ +function prepareConfig(config) { + + config.globals = config.globals || config.global || {}; + delete config.global; + + var copiedRules = {}, + ecmaFeatures = {}, + preparedConfig; + + if (typeof config.rules === "object") { + Object.keys(config.rules).forEach(function(k) { + var rule = config.rules[k]; + if (rule === null) { + throw new Error("Invalid config for rule '" + k + "'\."); + } + if (Array.isArray(rule)) { + copiedRules[k] = rule.slice(); + } else { + copiedRules[k] = rule; + } + }); + } + + // merge in environment ecmaFeatures + if (typeof config.env === "object") { + Object.keys(config.env).forEach(function(env) { + if (config.env[env] && environments[env].ecmaFeatures) { + assign(ecmaFeatures, environments[env].ecmaFeatures); + } + }); + } + + preparedConfig = { + rules: copiedRules, + parser: config.parser || "espree", + globals: util.mergeConfigs({}, config.globals), + env: util.mergeConfigs({}, config.env || {}), + settings: util.mergeConfigs({}, config.settings || {}), + ecmaFeatures: util.mergeConfigs(ecmaFeatures, config.ecmaFeatures || {}) + }; + + // can't have global return inside of modules + if (preparedConfig.ecmaFeatures.modules) { + preparedConfig.ecmaFeatures.globalReturn = false; + } + + return preparedConfig; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Object that is responsible for verifying JavaScript text + * @name eslint + */ +module.exports = (function() { + + var api = Object.create(new EventEmitter()), + messages = [], + currentText = null, + currentTextLines = [], + currentConfig = null, + currentTokens = null, + currentScopes = null, + scopeMap = null, + scopeManager = null, + currentFilename = null, + controller = null, + reportingConfig = [], + commentLocsEnter = [], + commentLocsExit = [], + currentAST = null; + + /** + * Parses text into an AST. Moved out here because the try-catch prevents + * optimization of functions, so it's best to keep the try-catch as isolated + * as possible + * @param {string} text The text to parse. + * @param {Object} config The ESLint configuration object. + * @returns {ASTNode} The AST if successful or null if not. + * @private + */ + function parse(text, config) { + + var parser; + + try { + parser = require(config.parser); + } catch (ex) { + messages.push({ + fatal: true, + severity: 2, + message: ex.message, + line: 0, + column: 0 + }); + + return null; + } + + /* + * Check for parsing errors first. If there's a parsing error, nothing + * else can happen. However, a parsing error does not throw an error + * from this method - it's just considered a fatal error message, a + * problem that ESLint identified just like any other. + */ + try { + return parser.parse(text, { + loc: true, + range: true, + raw: true, + tokens: true, + comment: true, + attachComment: true, + ecmaFeatures: config.ecmaFeatures + }); + } catch (ex) { + + messages.push({ + fatal: true, + severity: 2, + + // messages come as "Line X: Unexpected token foo", so strip off leading part + message: ex.message.substring(ex.message.indexOf(":") + 1).trim(), + + line: ex.lineNumber, + column: ex.column + }); + + return null; + } + } + + /** + * Check collection of comments to prevent double event for comment as + * leading and trailing, then emit event if passing + * @param {ASTNode[]} comments Collection of comment nodes + * @param {Object[]} locs List of locations of previous comment nodes + * @param {string} eventName Event name postfix + * @returns {void} + */ + function emitComments(comments, locs, eventName) { + + if (comments.length) { + comments.forEach(function(node) { + if (locs.indexOf(node.loc) >= 0) { + locs.splice(locs.indexOf(node.loc), 1); + } else { + locs.push(node.loc); + api.emit(node.type + eventName, node); + } + }); + } + } + + /** + * Shortcut to check and emit enter of comment nodes + * @param {ASTNode[]} comments Collection of comment nodes + * @returns {void} + */ + function emitCommentsEnter(comments) { + emitComments(comments, commentLocsEnter, "Comment"); + } + + /** + * Shortcut to check and emit exit of comment nodes + * @param {ASTNode[]} comments Collection of comment nodes + * @returns {void} + */ + function emitCommentsExit(comments) { + emitComments(comments, commentLocsExit, "Comment:exit"); + } + + /** + * Get the severity level of a rule (0 - none, 1 - warning, 2 - error) + * Returns 0 if the rule config is not valid (an Array or a number) + * @param {Array|number} ruleConfig rule configuration + * @returns {number} 0, 1, or 2, indicating rule severity + */ + function getRuleSeverity(ruleConfig) { + if (typeof ruleConfig === "number") { + return ruleConfig; + } else if (Array.isArray(ruleConfig)) { + return ruleConfig[0]; + } else { + return 0; + } + } + + /** + * Get the options for a rule (not including severity), if any + * @param {Array|number} ruleConfig rule configuration + * @returns {Array} of rule options, empty Array if none + */ + function getRuleOptions(ruleConfig) { + if (Array.isArray(ruleConfig)) { + return ruleConfig.slice(1); + } else { + return []; + } + } + + // set unlimited listeners (see https://github.com/eslint/eslint/issues/524) + api.setMaxListeners(0); + + /** + * Resets the internal state of the object. + * @returns {void} + */ + api.reset = function() { + this.removeAllListeners(); + messages = []; + currentAST = null; + currentConfig = null; + currentText = null; + currentTextLines = []; + currentTokens = null; + currentScopes = null; + scopeMap = null; + scopeManager = null; + controller = null; + reportingConfig = []; + commentLocsEnter = []; + commentLocsExit = []; + }; + + /** + * Verifies the text against the rules specified by the second argument. + * @param {string} text The JavaScript text to verify. + * @param {Object} config An object whose keys specify the rules to use. + * @param {string=} filename The optional filename of the file being checked. + * If this is not set, the filename will default to '' in the rule context. + * @param {boolean=} saveState Indicates if the state from the last run should be saved. + * Mostly useful for testing purposes. + * @returns {Object[]} The results as an array of messages or null if no messages. + */ + api.verify = function(text, config, filename, saveState) { + + var ast, + shebang, + ecmaFeatures, + ecmaVersion; + + // set the current parsed filename + currentFilename = filename; + + if (!saveState) { + this.reset(); + } + + // there's no input, just exit here + if (text.trim().length === 0) { + currentText = text; + return messages; + } + + // process initial config to make it safe to extend + config = prepareConfig(config || {}); + + ast = parse(text.replace(/^#!([^\r\n]+)/, function(match, captured) { + shebang = captured; + return "//" + captured; + }), config); + + // if espree failed to parse the file, there's no sense in setting up rules + if (ast) { + + currentAST = ast; + + // parse global comments and modify config + modifyConfigsFromComments(ast, config, reportingConfig, messages); + + // enable appropriate rules + Object.keys(config.rules).filter(function(key) { + return getRuleSeverity(config.rules[key]) > 0; + }).forEach(function(key) { + + var ruleCreator = rules.get(key), + severity = getRuleSeverity(config.rules[key]), + options = getRuleOptions(config.rules[key]), + rule; + + if (ruleCreator) { + try { + rule = ruleCreator(new RuleContext( + key, api, severity, options, + config.settings, config.ecmaFeatures + )); + + // add all the node types as listeners + Object.keys(rule).forEach(function(nodeType) { + api.on(nodeType, timing.enabled + ? timing.time(key, rule[nodeType]) + : rule[nodeType] + ); + }); + } catch(ex) { + ex.message = "Error while loading rule '" + key + "': " + ex.message; + throw ex; + } + + } else { + throw new Error("Definition for rule '" + key + "' was not found."); + } + }); + + // save config so rules can access as necessary + currentConfig = config; + currentText = text; + controller = new estraverse.Controller(); + + ecmaFeatures = currentConfig.ecmaFeatures; + ecmaVersion = (ecmaFeatures.blockBindings || ecmaFeatures.classes || + ecmaFeatures.modules || ecmaFeatures.defaultParams || + ecmaFeatures.destructuring) ? 6 : 5; + + + // gather data that may be needed by the rules + scopeManager = escope.analyze(ast, { + ignoreEval: true, + nodejsScope: ecmaFeatures.globalReturn, + ecmaVersion: ecmaVersion, + sourceType: ecmaFeatures.modules ? "module" : "script" + }); + currentScopes = scopeManager.scopes; + + /* + * Index the scopes by the start range of their block for efficient + * lookup in getScope. + */ + scopeMap = []; + currentScopes.forEach(function (scope, index) { + var range = scope.block.range[0]; + + // Sometimes two scopes are returned for a given node. This is + // handled later in a known way, so just don't overwrite here. + if (!scopeMap[range]) { + scopeMap[range] = index; + } + }); + + /* + * Split text here into array of lines so + * it's not being done repeatedly + * by individual rules. + */ + currentTextLines = currentText.split(/\r\n|\r|\n|\u2028|\u2029/g); + + // Freezing so array isn't accidentally changed by a rule. + Object.freeze(currentTextLines); + + currentTokens = createTokenStore(ast.tokens); + Object.keys(currentTokens).forEach(function(method) { + api[method] = currentTokens[method]; + }); + + // augment global scope with declared global variables + addDeclaredGlobals(ast, currentScopes[0], currentConfig); + + // remove shebang comments + if (shebang && ast.comments.length && ast.comments[0].value === shebang) { + ast.comments.splice(0, 1); + + if (ast.body.length && ast.body[0].leadingComments && ast.body[0].leadingComments[0].value === shebang) { + ast.body[0].leadingComments.splice(0, 1); + } + } + + /* + * Each node has a type property. Whenever a particular type of node is found, + * an event is fired. This allows any listeners to automatically be informed + * that this type of node has been found and react accordingly. + */ + controller.traverse(ast, { + enter: function(node, parent) { + + var comments = api.getComments(node); + + emitCommentsEnter(comments.leading); + node.parent = parent; + api.emit(node.type, node); + emitCommentsEnter(comments.trailing); + }, + leave: function(node) { + + var comments = api.getComments(node); + + emitCommentsExit(comments.trailing); + api.emit(node.type + ":exit", node); + emitCommentsExit(comments.leading); + } + }); + + } + + // sort by line and column + messages.sort(function(a, b) { + var lineDiff = a.line - b.line; + + if (lineDiff === 0) { + return a.column - b.column; + } else { + return lineDiff; + } + }); + + return messages; + }; + + /** + * Reports a message from one of the rules. + * @param {string} ruleId The ID of the rule causing the message. + * @param {number} severity The severity level of the rule as configured. + * @param {ASTNode} node The AST node that the message relates to. + * @param {Object=} location An object containing the error line and column + * numbers. If location is not provided the node's start location will + * be used. + * @param {string} message The actual message. + * @param {Object} opts Optional template data which produces a formatted message + * with symbols being replaced by this object's values. + * @returns {void} + */ + api.report = function(ruleId, severity, node, location, message, opts) { + + if (typeof location === "string") { + opts = message; + message = location; + location = node.loc.start; + } + + Object.keys(opts || {}).forEach(function (key) { + var rx = new RegExp("{{" + escapeRegExp(key) + "}}", "g"); + message = message.replace(rx, opts[key]); + }); + + if (isDisabledByReportingConfig(reportingConfig, ruleId, location)) { + return; + } + + messages.push({ + ruleId: ruleId, + severity: severity, + message: message, + line: location.line, + column: location.column, + nodeType: node.type, + source: currentTextLines[location.line - 1] || "" + }); + }; + + /** + * Gets the source code for the given node. + * @param {ASTNode=} node The AST node to get the text for. + * @param {int=} beforeCount The number of characters before the node to retrieve. + * @param {int=} afterCount The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + */ + api.getSource = function(node, beforeCount, afterCount) { + if (node) { + return (currentText !== null) ? currentText.slice(Math.max(node.range[0] - (beforeCount || 0), 0), + node.range[1] + (afterCount || 0)) : null; + } else { + return currentText; + } + + }; + + /** + * Gets the entire source text split into an array of lines. + * @returns {Array} The source text as an array of lines. + */ + api.getSourceLines = function() { + return currentTextLines; + }; + + /** + * Retrieves an array containing all comments in the source code. + * @returns {ASTNode[]} An array of comment nodes. + */ + api.getAllComments = function() { + return currentAST.comments; + }; + + /** + * Gets all comments for the given node. + * @param {ASTNode} node The AST node to get the comments for. + * @returns {Object} The list of comments indexed by their position. + */ + api.getComments = function(node) { + + var leadingComments = node.leadingComments || [], + trailingComments = node.trailingComments || []; + + /* + * espree adds a "comments" array on Program nodes rather than + * leadingComments/trailingComments. Comments are only left in the + * Program node comments array if there is no executable code. + */ + if (node.type === "Program") { + if (node.body.length === 0) { + leadingComments = node.comments; + } + } + + return { + leading: leadingComments, + trailing: trailingComments + }; + }; + + /** + * Retrieves the JSDoc comment for a given node. + * @param {ASTNode} node The AST node to get the comment for. + * @returns {ASTNode} The BlockComment node containing the JSDoc for the + * given node or null if not found. + */ + api.getJSDocComment = function(node) { + + var parent = node.parent, + line = node.loc.start.line; + + /** + * Finds a JSDoc comment node in an array of comment nodes. + * @param {ASTNode[]} comments The array of comment nodes to search. + * @returns {ASTNode} The node if found, null if not. + * @private + */ + function findJSDocComment(comments) { + + if (comments) { + for (var i = comments.length - 1; i >= 0; i--) { + if (comments[i].type === "Block" && comments[i].value.charAt(0) === "*") { + + if (line - comments[i].loc.end.line <= 1) { + return comments[i]; + } else { + break; + } + } + } + } + + return null; + } + + switch (node.type) { + case "FunctionDeclaration": + return findJSDocComment(node.leadingComments); + + case "ArrowFunctionExpression": + case "FunctionExpression": + + if (parent.type !== "CallExpression" || parent.callee !== node) { + while (parent && !parent.leadingComments && !/Function/.test(parent.type)) { + parent = parent.parent; + } + + return parent && (parent.type !== "FunctionDeclaration") ? findJSDocComment(parent.leadingComments) : null; + } + + // falls through + + default: + return null; + } + }; + + /** + * Gets nodes that are ancestors of current node. + * @returns {ASTNode[]} Array of objects representing ancestors. + */ + api.getAncestors = function() { + return controller.parents(); + }; + + /** + * Gets the deepest node containing a range index. + * @param {int} index Range index of the desired node. + * @returns {ASTNode} [description] + */ + api.getNodeByRangeIndex = function(index) { + var result = null; + + estraverse.traverse(controller.root, { + enter: function (node) { + if (node.range[0] <= index && index < node.range[1]) { + result = node; + } else { + this.skip(); + } + }, + leave: function (node) { + if (node === result) { + this.break(); + } + } + }); + + return result; + }; + + /** + * Gets the scope for the current node. + * @returns {Object} An object representing the current node's scope. + */ + api.getScope = function() { + var parents = controller.parents(), + scope = currentScopes[0]; + + // Don't do this for Program nodes - they have no parents + if (parents.length) { + + // if current node is function declaration, add it to the list + var current = controller.current(); + if (["FunctionDeclaration", "FunctionExpression", + "ArrowFunctionExpression"].indexOf(current.type) >= 0) { + parents.push(current); + } + + // Ascend the current node's parents + for (var i = parents.length - 1; i >= 0; --i) { + + scope = scopeManager.acquire(parents[i]); + if (scope) { + return scope; + } + + } + + } + + return currentScopes[0]; + }; + + /** + * Record that a particular variable has been used in code + * @param {string} name The name of the variable to mark as used + * @returns {boolean} True if the variable was found and marked as used, + * false if not. + */ + api.markVariableAsUsed = function(name) { + var scope = this.getScope(), + specialScope = currentConfig.ecmaFeatures.globalReturn || currentConfig.ecmaFeatures.modules, + variables, + i, + len; + + // Special Node.js scope means we need to start one level deeper + if (scope.type === "global" && specialScope) { + scope = scope.childScopes[0]; + } + + do { + variables = scope.variables; + for (i = 0, len = variables.length; i < len; i++) { + if (variables[i].name === name) { + variables[i].eslintUsed = true; + return true; + } + } + } while ( (scope = scope.upper) ); + + return false; + }; + + /** + * Gets the filename for the currently parsed source. + * @returns {string} The filename associated with the source being parsed. + * Defaults to "" if no filename info is present. + */ + api.getFilename = function() { + if (typeof currentFilename === "string") { + return currentFilename; + } else { + return ""; + } + }; + + /** + * Defines a new linting rule. + * @param {string} ruleId A unique rule identifier + * @param {Function} ruleModule Function from context to object mapping AST node types to event handlers + * @returns {void} + */ + var defineRule = api.defineRule = function(ruleId, ruleModule) { + rules.define(ruleId, ruleModule); + }; + + /** + * Defines many new linting rules. + * @param {object} rulesToDefine map from unique rule identifier to rule + * @returns {void} + */ + api.defineRules = function(rulesToDefine) { + Object.getOwnPropertyNames(rulesToDefine).forEach(function(ruleId) { + defineRule(ruleId, rulesToDefine[ruleId]); + }); + }; + + /** + * Gets the default eslint configuration. + * @returns {Object} Object mapping rule IDs to their default configurations + */ + api.defaults = function() { + return require("../conf/eslint.json"); + }; + + return api; + +}()); diff --git a/node_modules/standard/node_modules/eslint/lib/file-finder.js b/node_modules/standard/node_modules/eslint/lib/file-finder.js new file mode 100644 index 00000000..3cdf9150 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/file-finder.js @@ -0,0 +1,167 @@ +/** + * @fileoverview Util class to find config files. + * @author Aliaksei Shytkin + * @copyright 2014 Michael McLaughlin. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var fs = require("fs"), + path = require("path"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Get the entries for a directory. Including a try-catch may be detrimental to + * function performance, so move it out here a separate function. + * @param {string} directory The directory to search in. + * @returns {string[]} The entries in the directory or an empty array on error. + * @private + */ +function getDirectoryEntries(directory) { + try { + return fs.readdirSync(directory); + } catch (ex) { + return []; + } +} + +//------------------------------------------------------------------------------ +// API +//------------------------------------------------------------------------------ + +/** + * FileFinder + * @constructor + * @param {...string} arguments The basename(s) of the file(s) to find. + */ +function FileFinder() { + this.fileNames = Array.prototype.slice.call(arguments); + this.cache = {}; +} + +/** + * Find one instance of a specified file name in directory or in a parent directory. + * Cache the results. + * Does not check if a matching directory entry is a file, and intentionally + * only searches for the first file name in this.fileNames. + * Is currently used by lib/ignored_paths.js to find an .eslintignore file. + * @param {string} directory The directory to start the search from. + * @returns {string} Path of the file found, or an empty string if not found. + */ +FileFinder.prototype.findInDirectoryOrParents = function (directory) { + var cache = this.cache, + child, + dirs, + filePath, + i, + name, + searched; + + if (!directory) { + directory = process.cwd(); + } + + if (cache.hasOwnProperty(directory)) { + return cache[directory]; + } + + dirs = []; + searched = 0; + name = this.fileNames[0]; + + while (directory !== child) { + dirs[searched++] = directory; + + if (getDirectoryEntries(directory).indexOf(name) !== -1) { + filePath = path.resolve(directory, name); + break; + } + + child = directory; + + // Assign parent directory to directory. + directory = path.dirname(directory); + } + + for (i = 0; i < searched; i++) { + cache[dirs[i]] = filePath; + } + + return filePath || String(); +}; + +/** + * Find all instances of files with the specified file names, in directory and + * parent directories. Cache the results. + * Does not check if a matching directory entry is a file. + * Searches for all the file names in this.fileNames. + * Is currently used by lib/config.js to find .eslintrc and package.json files. + * @param {string} directory The directory to start the search from. + * @returns {string[]} The file paths found. + */ +FileFinder.prototype.findAllInDirectoryAndParents = function (directory) { + var cache = this.cache, + child, + dirs, + name, + fileNames, + fileNamesCount, + filePath, + i, + j, + searched; + + if (!directory) { + directory = process.cwd(); + } + + if (cache.hasOwnProperty(directory)) { + return cache[directory]; + } + + dirs = []; + searched = 0; + fileNames = this.fileNames; + fileNamesCount = fileNames.length; + + do { + dirs[searched++] = directory; + cache[directory] = []; + + for (i = 0; i < fileNamesCount; i++) { + name = fileNames[i]; + + if (getDirectoryEntries(directory).indexOf(name) !== -1) { + filePath = path.resolve(directory, name); + + // Add the file path to the cache of each directory searched. + for (j = 0; j < searched; j++) { + cache[dirs[j]].push(filePath); + } + } + } + child = directory; + + // Assign parent directory to directory. + directory = path.dirname(directory); + + if (directory === child) { + return cache[dirs[0]]; + } + } while (!cache.hasOwnProperty(directory)); + + // Add what has been cached previously to the cache of each directory searched. + for (i = 0; i < searched; i++) { + dirs.push.apply(cache[dirs[i]], cache[directory]); + } + + return cache[dirs[0]]; +}; + +module.exports = FileFinder; diff --git a/node_modules/standard/node_modules/eslint/lib/formatters/checkstyle.js b/node_modules/standard/node_modules/eslint/lib/formatters/checkstyle.js new file mode 100644 index 00000000..5e98c8b1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/formatters/checkstyle.js @@ -0,0 +1,68 @@ +/** + * @fileoverview CheckStyle XML reporter + * @author Ian Christian Myers + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "error"; + } else { + return "warning"; + } +} + +function xmlEscape(s) { + return ("" + s).replace(/[<>&"']/g, function(c) { + switch (c) { + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case "\"": + return """; + case "'": + return "'"; + // no default + } + }); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + var output = ""; + + output += ""; + output += ""; + + results.forEach(function(result) { + var messages = result.messages; + + output += ""; + + messages.forEach(function(message) { + output += ""; + }); + + output += ""; + + }); + + output += ""; + + return output; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/formatters/compact.js b/node_modules/standard/node_modules/eslint/lib/formatters/compact.js new file mode 100644 index 00000000..b7c2fc7e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/formatters/compact.js @@ -0,0 +1,53 @@ +/** + * @fileoverview Compact reporter + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "Error"; + } else { + return "Warning"; + } +} + + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + var output = "", + total = 0; + + results.forEach(function(result) { + + var messages = result.messages; + total += messages.length; + + messages.forEach(function(message) { + + output += result.filePath + ": "; + output += "line " + (message.line || 0); + output += ", col " + (message.column || 0); + output += ", " + getMessageType(message); + output += " - " + message.message; + output += message.ruleId ? " (" + message.ruleId + ")" : ""; + output += "\n"; + + }); + + }); + + if (total > 0) { + output += "\n" + total + " problem" + (total !== 1 ? "s" : ""); + } + + return output; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/formatters/jslint-xml.js b/node_modules/standard/node_modules/eslint/lib/formatters/jslint-xml.js new file mode 100644 index 00000000..26aa2de0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/formatters/jslint-xml.js @@ -0,0 +1,40 @@ +/** + * @fileoverview JSLint XML reporter + * @author Ian Christian Myers + */ +"use strict"; + +var xmlescape = require("xml-escape"); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + var output = ""; + + output += ""; + output += ""; + + results.forEach(function(result) { + var messages = result.messages; + + output += ""; + + messages.forEach(function(message) { + output += ""; + }); + + output += ""; + + }); + + output += ""; + + return output; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/formatters/junit.js b/node_modules/standard/node_modules/eslint/lib/formatters/junit.js new file mode 100644 index 00000000..7ee94135 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/formatters/junit.js @@ -0,0 +1,63 @@ +/** + * @fileoverview jUnit Reporter + * @author Jamund Ferguson + */ +"use strict"; + +var xmlescape = require("xml-escape"); + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "Error"; + } else { + return "Warning"; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + var output = ""; + + output += "\n"; + output += "\n"; + + results.forEach(function(result) { + + var messages = result.messages; + + if (messages.length) { + output += "\n"; + } + + messages.forEach(function(message) { + var type = message.fatal ? "error" : "failure"; + output += ""; + output += "<" + type + " message=\"" + xmlescape(message.message || "") + "\">"; + output += ""; + output += ""; + output += "\n"; + }); + + if (messages.length) { + output += "\n"; + } + + }); + + output += "\n"; + + return output; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/formatters/stylish.js b/node_modules/standard/node_modules/eslint/lib/formatters/stylish.js new file mode 100644 index 00000000..59e01d0b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/formatters/stylish.js @@ -0,0 +1,90 @@ +/** + * @fileoverview Stylish reporter + * @author Sindre Sorhus + */ +"use strict"; + +var chalk = require("chalk"), + table = require("text-table"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Given a word and a count, append an s if count is not one. + * @param {string} word A word in its singular form. + * @param {int} count A number controlling whether word should be pluralized. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word, count) { + return (count === 1 ? word : word + "s"); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + + var output = "\n", + total = 0, + errors = 0, + warnings = 0, + summaryColor = "yellow"; + + results.forEach(function(result) { + var messages = result.messages; + + if (messages.length === 0) { + return; + } + + total += messages.length; + output += chalk.underline(result.filePath) + "\n"; + + output += table( + messages.map(function(message) { + var messageType; + + if (message.fatal || message.severity === 2) { + messageType = chalk.red("error"); + summaryColor = "red"; + errors++; + } else { + messageType = chalk.yellow("warning"); + warnings++; + } + + return [ + "", + message.line || 0, + message.column || 0, + messageType, + message.message.replace(/\.$/, ""), + chalk.gray(message.ruleId || "") + ]; + }), + { + align: ["", "r", "l"], + stringLength: function(str) { + return chalk.stripColor(str).length; + } + } + ).split("\n").map(function(el) { + return el.replace(/(\d+)\s+(\d+)/, function(m, p1, p2) { + return chalk.gray(p1 + ":" + p2); + }); + }).join("\n") + "\n\n"; + }); + + if (total > 0) { + output += chalk[summaryColor].bold([ + "\u2716 ", total, pluralize(" problem", total), + " (", errors, pluralize(" error", errors), ", ", + warnings, pluralize(" warning", warnings), ")\n" + ].join("")); + } + + return total > 0 ? output : ""; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/formatters/tap.js b/node_modules/standard/node_modules/eslint/lib/formatters/tap.js new file mode 100644 index 00000000..b9f4cd66 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/formatters/tap.js @@ -0,0 +1,90 @@ +/** + * @fileoverview TAP reporter + * @author Jonathan Kingston + */ +"use strict"; + +var yaml = require("js-yaml"); + +//------------------------------------------------------------------------------ +// Helper Functions +//------------------------------------------------------------------------------ + +/** + * Returns a canonical error level string based upon the error message passed in. + * @param {object} message Individual error message provided by eslint + * @returns {String} Error level string + */ +function getMessageType(message) { + if (message.fatal || message.severity === 2) { + return "error"; + } else { + return "warning"; + } +} + +/** + * Takes in a JavaScript object and outputs a TAP diagnostics string + * @param {object} diagnostic JavaScript object to be embedded as YAML into output. + * @returns {string} diagnostics string with YAML embedded - TAP version 13 compliant + */ +function outputDiagnostics(diagnostic) { + var prefix = " "; + var output = prefix + "---\n"; + output += prefix + yaml.safeDump(diagnostic).split("\n").join("\n" + prefix); + output += "...\n"; + return output; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = function(results) { + var output = "TAP version 13\n1.." + results.length + "\n"; + + results.forEach(function(result, id) { + var messages = result.messages; + var testResult = "ok"; + var diagnostics = {}; + + if (messages.length > 0) { + testResult = "not ok"; + + messages.forEach(function(message) { + var diagnostic = { + message: message.message, + severity: getMessageType(message), + data: { + line: message.line || 0, + column: message.column || 0, + ruleId: message.ruleId || "" + } + }; + + // If we have multiple messages place them under a messages key + // The first error will be logged as message key + // This is to adhere to TAP 13 loosely defined specification of having a message key + if ("message" in diagnostics) { + if ("messages" in diagnostics) { + diagnostics.messages.push(diagnostic); + } else { + diagnostics.messages = [diagnostic]; + } + } else { + diagnostics = diagnostic; + } + }); + } + + output += testResult + " " + (id + 1) + " - " + result.filePath + "\n"; + + // If we have an error include diagnostics + if (messages.length > 0) { + output += outputDiagnostics(diagnostics); + } + + }); + + return output; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/ignored-paths.js b/node_modules/standard/node_modules/eslint/lib/ignored-paths.js new file mode 100644 index 00000000..3d2bd9b4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/ignored-paths.js @@ -0,0 +1,133 @@ +/** + * @fileoverview Responsible for loading ignore config files and managing ignore patterns + * @author Jonathan Rajavuori + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var fs = require("fs"), + debug = require("debug"), + minimatch = require("minimatch"), + FileFinder = require("./file-finder"); + +debug = debug("eslint:ignored-paths"); + + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +var ESLINT_IGNORE_FILENAME = ".eslintignore"; + + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Load and parse ignore patterns from the file at the given path + * @param {string} filepath Path to the ignore file. + * @returns {string[]} An array of ignore patterns or an empty array if no ignore file. + */ +function loadIgnoreFile(filepath) { + var ignorePatterns = []; + + function nonEmpty(line) { + return line.trim() !== "" && line[0] !== "#"; + } + + if (filepath) { + try { + ignorePatterns = fs.readFileSync(filepath, "utf8").split(/\r?\n/).filter(nonEmpty); + } catch (e) { + e.message = "Cannot read ignore file: " + filepath + "\nError: " + e.message; + throw e; + } + } + + return ["node_modules/**"].concat(ignorePatterns); +} + +var ignoreFileFinder; + +/** + * Find an ignore file in the current directory or a parent directory. + * @returns {string} Path of ignore file or an empty string. + */ +function findIgnoreFile() { + if (!ignoreFileFinder) { + ignoreFileFinder = new FileFinder(ESLINT_IGNORE_FILENAME); + } + + return ignoreFileFinder.findInDirectoryOrParents(); +} + + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * IgnoredPaths + * @constructor + * @class IgnoredPaths + * @param {Array} patterns to be matched against file paths + */ +function IgnoredPaths(patterns) { + this.patterns = patterns; +} + +/** + * IgnoredPaths initializer + * @param {Object} options object containing 'ignore' and 'ignorePath' properties + * @returns {IgnoredPaths} object, with patterns loaded from the ignore file + */ +IgnoredPaths.load = function (options) { + var patterns; + + options = options || {}; + + if (options.ignore) { + patterns = loadIgnoreFile(options.ignorePath || findIgnoreFile()); + } else { + patterns = []; + } + + return new IgnoredPaths(patterns); +}; + +/** + * Determine whether a file path is included in the configured ignore patterns + * @param {string} filepath Path to check + * @returns {boolean} true if the file path matches one or more patterns, false otherwise + */ +IgnoredPaths.prototype.contains = function (filepath) { + if (this.patterns === null) { + throw new Error("No ignore patterns loaded, call 'load' first"); + } + + filepath = filepath.replace("\\", "/"); + filepath = filepath.replace(/^\.\//, ""); + return this.patterns.reduce(function(ignored, pattern) { + var negated = pattern[0] === "!", + matches; + + if (negated) { + pattern = pattern.slice(1); + } + + // Remove leading "current folder" prefix + if (pattern.indexOf("./") === 0) { + pattern = pattern.slice(2); + } + + matches = minimatch(filepath, pattern) || minimatch(filepath, pattern + "/**"); + + return matches ? !negated : ignored; + }, false); +}; + +module.exports = IgnoredPaths; diff --git a/node_modules/standard/node_modules/eslint/lib/load-rules.js b/node_modules/standard/node_modules/eslint/lib/load-rules.js new file mode 100644 index 00000000..62183f34 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/load-rules.js @@ -0,0 +1,39 @@ +/** + * @fileoverview Module for loading rules from files and directories. + * @author Michael Ficarra + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var fs = require("fs"), + path = require("path"); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Load all rule modules from specified directory. + * @param {String} [rulesDir] Path to rules directory, may be relative. Defaults to `lib/rules`. + * @returns {Object} Loaded rule modules by rule ids (file names). + */ +module.exports = function(rulesDir) { + if (!rulesDir) { + rulesDir = path.join(__dirname, "rules"); + } else { + rulesDir = path.resolve(process.cwd(), rulesDir); + } + + var rules = Object.create(null); + fs.readdirSync(rulesDir).forEach(function(file) { + if (path.extname(file) !== ".js") { + return; + } + rules[file.slice(0, -3)] = require(path.join(rulesDir, file)); + }); + return rules; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/options.js b/node_modules/standard/node_modules/eslint/lib/options.js new file mode 100644 index 00000000..e75bac53 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/options.js @@ -0,0 +1,116 @@ +/** + * @fileoverview Options configuration for optionator. + * @author George Zahariev + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var optionator = require("optionator"); + +//------------------------------------------------------------------------------ +// Initialization and Public Interface +//------------------------------------------------------------------------------ + +// exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)" +module.exports = optionator({ + prepend: "eslint [options] file.js [file.js] [dir]", + concatRepeatedArrays: true, + mergeRepeatedObjects: true, + options: [{ + heading: "Options" + }, { + option: "help", + alias: "h", + type: "Boolean", + description: "Show help" + }, { + option: "config", + alias: "c", + type: "path::String", + description: "Use configuration from this file" + }, { + option: "rulesdir", + type: "[path::String]", + description: "Use additional rules from this directory" + }, { + option: "format", + alias: "f", + type: "String", + default: "stylish", + description: "Use a specific output format" + }, { + option: "version", + alias: "v", + type: "Boolean", + description: "Outputs the version number" + }, { + option: "reset", + type: "Boolean", + default: "false", + description: "Set all default rules to off" + }, { + option: "eslintrc", + type: "Boolean", + default: "true", + description: "Disable use of configuration from .eslintrc" + }, { + option: "env", + type: "[String]", + description: "Specify environments" + }, { + option: "ext", + type: "[String]", + default: ".js", + description: "Specify JavaScript file extensions" + }, { + option: "plugin", + type: "[String]", + description: "Specify plugins" + }, { + option: "global", + type: "[String]", + description: "Define global variables" + }, { + option: "rule", + type: "Object", + description: "Specify rules" + }, + { + option: "ignore-path", + type: "path::String", + description: "Specify path of ignore file" + }, + { + option: "ignore", + type: "Boolean", + default: "true", + description: "Disable use of .eslintignore" + }, + { + option: "color", + type: "Boolean", + default: "true", + description: "Disable color in piped output" + }, + { + option: "output-file", + alias: "o", + type: "path::String", + description: "Specify file to write report to" + }, + { + option: "quiet", + type: "Boolean", + default: "false", + description: "Report errors only" + }, + { + option: "stdin", + type: "Boolean", + default: "false", + description: "Lint code provided on " + }] +}); diff --git a/node_modules/standard/node_modules/eslint/lib/rule-context.js b/node_modules/standard/node_modules/eslint/lib/rule-context.js new file mode 100644 index 00000000..0513685f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rule-context.js @@ -0,0 +1,107 @@ +/** + * @fileoverview RuleContext utility for rules + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +var PASSTHROUGHS = [ + "getAllComments", + "getAncestors", + "getComments", + "getFilename", + "getFirstToken", + "getFirstTokens", + "getJSDocComment", + "getLastToken", + "getLastTokens", + "getNodeByRangeIndex", + "getScope", + "getSource", + "getSourceLines", + "getTokenAfter", + "getTokenBefore", + "getTokenByRangeStart", + "getTokens", + "getTokensAfter", + "getTokensBefore", + "getTokensBetween", + "markVariableAsUsed", + "isMarkedAsUsed" + ]; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** + * Acts as an abstraction layer between rules and the main eslint object. + * @constructor + * @param {string} ruleId The ID of the rule using this object. + * @param {eslint} eslint The eslint object. + * @param {number} severity The configured severity level of the rule. + * @param {array} options The configuration information to be added to the rule. + * @param {object} settings The configuration settings passed from the config file. + * @param {object} ecmaFeatures The ecmaFeatures settings passed from the config file. + */ +function RuleContext(ruleId, eslint, severity, options, settings, ecmaFeatures) { + + /** + * The read-only ID of the rule. + */ + Object.defineProperty(this, "id", { + value: ruleId + }); + + /** + * The read-only options of the rule + */ + Object.defineProperty(this, "options", { + value: options + }); + + /** + * The read-only settings shared between all rules + */ + Object.defineProperty(this, "settings", { + value: settings + }); + + /** + * The read-only ecmaFeatures shared across all rules + */ + Object.defineProperty(this, "ecmaFeatures", { + value: Object.create(ecmaFeatures) + }); + Object.freeze(this.ecmaFeatures); + + // copy over passthrough methods + PASSTHROUGHS.forEach(function(name) { + this[name] = function() { + return eslint[name].apply(eslint, arguments); + }; + }, this); + + /** + * Passthrough to eslint.report() that automatically assigns the rule ID and severity. + * @param {ASTNode} node The AST node related to the message. + * @param {Object=} location The location of the error. + * @param {string} message The message to display to the user. + * @param {Object} opts Optional template data which produces a formatted message + * with symbols being replaced by this object's values. + * @returns {void} + */ + this.report = function(node, location, message, opts) { + eslint.report(ruleId, severity, node, location, message, opts); + }; + +} + +RuleContext.prototype = { + constructor: RuleContext +}; + +module.exports = RuleContext; diff --git a/node_modules/standard/node_modules/eslint/lib/rules.js b/node_modules/standard/node_modules/eslint/lib/rules.js new file mode 100644 index 00000000..eef942fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules.js @@ -0,0 +1,88 @@ +/** + * @fileoverview Defines a storage for rules. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var loadRules = require("./load-rules"); + +//------------------------------------------------------------------------------ +// Privates +//------------------------------------------------------------------------------ + +var rules = Object.create(null); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Registers a rule module for rule id in storage. + * @param {String} ruleId Rule id (file name). + * @param {Function} ruleModule Rule handler. + * @returns {void} + */ +function define(ruleId, ruleModule) { + rules[ruleId] = ruleModule; +} + +exports.define = define; + +/** + * Loads and registers all rules from passed rules directory. + * @param {String} [rulesDir] Path to rules directory, may be relative. Defaults to `lib/rules`. + * @returns {void} + */ +function load(rulesDir) { + var newRules = loadRules(rulesDir); + Object.keys(newRules).forEach(function(ruleId) { + define(ruleId, newRules[ruleId]); + }); +} + +exports.load = load; + +/** + * Registers all given rules of a plugin. + * @param {Object} pluginRules A key/value map of rule definitions. + * @param {String} pluginName The name of the plugin without prefix (`eslint-plugin-`). + * @returns {void} + */ +exports.import = function (pluginRules, pluginName) { + Object.keys(pluginRules).forEach(function (ruleId) { + var qualifiedRuleId = pluginName + "/" + ruleId, + rule = pluginRules[ruleId]; + + define(qualifiedRuleId, rule); + }); +}; + +/** + * Access rule handler by id (file name). + * @param {String} ruleId Rule id (file name). + * @returns {Function} Rule handler. + */ +exports.get = function(ruleId) { + return rules[ruleId]; +}; + +/** + * Reset rules storage. + * Should be used only in tests. + * @returns {void} + */ +exports.testClear = function() { + rules = Object.create(null); +}; + +//------------------------------------------------------------------------------ +// Initialization +//------------------------------------------------------------------------------ + +// loads built-in rules +load(); diff --git a/node_modules/standard/node_modules/eslint/lib/rules/block-scoped-var.js b/node_modules/standard/node_modules/eslint/lib/rules/block-scoped-var.js new file mode 100644 index 00000000..e99496cb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/block-scoped-var.js @@ -0,0 +1,281 @@ +/** + * @fileoverview Rule to check for "block scoped" variables by binding context + * @author Matt DuVall + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var scopeStack = []; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines whether an identifier is in declaration position or is a non-declaration reference. + * @param {ASTNode} id The identifier. + * @param {ASTNode} parent The identifier's parent AST node. + * @returns {Boolean} true when the identifier is in declaration position. + */ + function isDeclaration(id, parent) { + switch (parent.type) { + case "FunctionDeclaration": + case "FunctionExpression": + return parent.params.indexOf(id) > -1 || id === parent.id; + + case "VariableDeclarator": + return id === parent.id; + + case "CatchClause": + return id === parent.param; + + default: + return false; + } + } + + /** + * Determines whether an identifier is in property position. + * @param {ASTNode} id The identifier. + * @param {ASTNode} parent The identifier's parent AST node. + * @returns {Boolean} true when the identifier is in property position. + */ + function isProperty(id, parent) { + switch (parent.type) { + case "MemberExpression": + return id === parent.property && !parent.computed; + + case "Property": + return id === parent.key; + + default: + return false; + } + } + + /** + * Pushes a new scope object on the scope stack. + * @returns {void} + */ + function pushScope() { + scopeStack.push([]); + } + + /** + * Removes the topmost scope object from the scope stack. + * @returns {void} + */ + function popScope() { + scopeStack.pop(); + } + + /** + * Declares the given names in the topmost scope object. + * @param {[String]} names A list of names to declare. + * @returns {void} + */ + function declare(names) { + [].push.apply(scopeStack[scopeStack.length - 1], names); + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + /** + * Declares all relevant identifiers for module imports. + * @param {ASTNode} node The AST node representing an import. + * @returns {void} + * @private + */ + function declareImports(node) { + declare([node.local.name]); + + if (node.imported && node.imported.name !== node.local.name) { + declare([node.imported.name]); + } + } + + /** + * Declares all relevant identifiers for classes. + * @param {ASTNode} node The AST node representing a class. + * @returns {void} + * @private + */ + function declareClass(node) { + pushScope(); + + if (node.id) { + declare([node.id.name]); + } + } + + /** + * Declares all relevant identifiers for classes. + * @param {ASTNode} node The AST node representing a class. + * @returns {void} + * @private + */ + function declareClassMethod(node) { + pushScope(); + + declare([node.key.name]); + } + + /** + * Add declarations based on the type of node being passed. + * @param {ASTNode} node The node containing declarations. + * @returns {void} + * @private + */ + function declareByNodeType(node) { + + var declarations = []; + + switch (node.type) { + case "Identifier": + declarations.push(node.name); + break; + + case "ObjectPattern": + node.properties.forEach(function(property) { + declarations.push(property.key.name); + if (property.value) { + declarations.push(property.value.name); + } + }); + break; + + case "ArrayPattern": + node.elements.forEach(function(element) { + if (element) { + declarations.push(element.name); + } + }); + break; + + // no default + } + + declare(declarations); + + } + + function functionHandler(node) { + pushScope(); + + node.params.forEach(function(param) { + declareByNodeType(param); + }); + + declare(node.id ? [node.id.name] : []); + declare(node.rest ? [node.rest.name] : []); + declare(["arguments"]); + } + + function variableDeclarationHandler(node) { + node.declarations.forEach(function(declaration) { + declareByNodeType(declaration.id); + }); + + } + + return { + "Program": function() { + var scope = context.getScope(); + scopeStack = [scope.variables.map(function(v) { + return v.name; + })]; + + // global return creates another scope + if (context.ecmaFeatures.globalReturn) { + scope = scope.childScopes[0]; + scopeStack.push(scope.variables.map(function(v) { + return v.name; + })); + } + }, + + "ImportSpecifier": declareImports, + "ImportDefaultSpecifier": declareImports, + "ImportNamespaceSpecifier": declareImports, + + "BlockStatement": function(node) { + var statements = node.body; + pushScope(); + statements.forEach(function(stmt) { + if (stmt.type === "VariableDeclaration") { + variableDeclarationHandler(stmt); + } else if (stmt.type === "FunctionDeclaration") { + declare([stmt.id.name]); + } + }); + }, + + "VariableDeclaration": function (node) { + variableDeclarationHandler(node); + }, + + "BlockStatement:exit": popScope, + + "CatchClause": function(node) { + pushScope(); + declare([node.param.name]); + }, + "CatchClause:exit": popScope, + + "FunctionDeclaration": functionHandler, + "FunctionDeclaration:exit": popScope, + + "ClassDeclaration": declareClass, + "ClassDeclaration:exit": popScope, + + "ClassExpression": declareClass, + "ClassExpression:exit": popScope, + + "MethodDefinition": declareClassMethod, + "MethodDefinition:exit": popScope, + + "FunctionExpression": functionHandler, + "FunctionExpression:exit": popScope, + + "ArrowFunctionExpression": functionHandler, + "ArrowFunctionExpression:exit": popScope, + + "ForStatement": function() { + pushScope(); + }, + "ForStatement:exit": popScope, + + "ForInStatement": function() { + pushScope(); + }, + "ForInStatement:exit": popScope, + + "ForOfStatement": function() { + pushScope(); + }, + "ForOfStatement:exit": popScope, + + "Identifier": function(node) { + var ancestor = context.getAncestors().pop(); + if (isDeclaration(node, ancestor) || isProperty(node, ancestor) || ancestor.type === "LabeledStatement") { + return; + } + + for (var i = 0, l = scopeStack.length; i < l; i++) { + if (scopeStack[i].indexOf(node.name) > -1) { + return; + } + } + + context.report(node, "\"" + node.name + "\" used outside of binding context."); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/brace-style.js b/node_modules/standard/node_modules/eslint/lib/rules/brace-style.js new file mode 100644 index 00000000..599e86f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/brace-style.js @@ -0,0 +1,204 @@ +/** + * @fileoverview Rule to flag block statements that do not use the one true brace style + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var style = context.options[0] || "1tbs"; + var params = context.options[1] || {}; + + var OPEN_MESSAGE = "Opening curly brace does not appear on the same line as controlling statement.", + BODY_MESSAGE = "Statement inside of curly braces should be on next line.", + CLOSE_MESSAGE = "Closing curly brace does not appear on the same line as the subsequent block.", + CLOSE_MESSAGE_SINGLE = "Closing curly brace should be on the same line as opening curly brace or on the line after the previous block.", + CLOSE_MESSAGE_STROUSTRUP = "Closing curly brace appears on the same line as the subsequent block."; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines if a given node is a block statement. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node is a block statement, false if not. + * @private + */ + function isBlock(node) { + return node && node.type === "BlockStatement"; + } + + + /** + * Binds a list of properties to a function that verifies that the opening + * curly brace is on the same line as its controlling statement of a given + * node. + * @param {...string} The properties to check on the node. + * @returns {Function} A function that will perform the check on a node + * @private + */ + function checkBlock() { + var blockProperties = arguments; + + return function(node) { + [].forEach.call(blockProperties, function(blockProp) { + var block = node[blockProp], previousToken, curlyToken, curlyTokenEnd, curlyTokensOnSameLine; + block = node[blockProp]; + + if (isBlock(block)) { + + previousToken = context.getTokenBefore(block); + curlyToken = context.getFirstToken(block); + curlyTokenEnd = context.getLastToken(block); + curlyTokensOnSameLine = curlyToken.loc.start.line === curlyTokenEnd.loc.start.line; + + if (previousToken.loc.start.line !== curlyToken.loc.start.line) { + context.report(node, OPEN_MESSAGE); + } else if (block.body.length && params.allowSingleLine) { + + if (curlyToken.loc.start.line === block.body[0].loc.start.line && !curlyTokensOnSameLine) { + context.report(block.body[0], BODY_MESSAGE); + } else if (curlyTokenEnd.loc.start.line === block.body[block.body.length - 1].loc.start.line && !curlyTokensOnSameLine) { + context.report(block.body[block.body.length - 1], CLOSE_MESSAGE_SINGLE); + } + + } else if (block.body.length && curlyToken.loc.start.line === block.body[0].loc.start.line) { + context.report(block.body[0], BODY_MESSAGE); + } + } + }); + }; + } + + /** + * Enforces the configured brace style on IfStatements + * @param {ASTNode} node An IfStatement node. + * @returns {void} + * @private + */ + function checkIfStatement(node) { + var tokens, + alternateIsBlock = false, + alternateIsIfBlock = false; + + checkBlock("consequent", "alternate")(node); + + if (node.alternate) { + + alternateIsBlock = isBlock(node.alternate); + alternateIsIfBlock = node.alternate.type === "IfStatement" && isBlock(node.alternate.consequent); + + if (alternateIsBlock || alternateIsIfBlock) { + tokens = context.getTokensBefore(node.alternate, 2); + + if (style === "1tbs") { + if (tokens[0].loc.start.line !== tokens[1].loc.start.line) { + context.report(node.alternate, CLOSE_MESSAGE); + } + } else if (style === "stroustrup") { + if (tokens[0].loc.start.line === tokens[1].loc.start.line) { + context.report(node.alternate, CLOSE_MESSAGE_STROUSTRUP); + } + } + } + + } + } + + /** + * Enforces the configured brace style on TryStatements + * @param {ASTNode} node A TryStatement node. + * @returns {void} + * @private + */ + function checkTryStatement(node) { + var tokens; + + checkBlock("block", "finalizer")(node); + + if (isBlock(node.finalizer)) { + tokens = context.getTokensBefore(node.finalizer, 2); + if (style === "1tbs") { + if (tokens[0].loc.start.line !== tokens[1].loc.start.line) { + context.report(node.finalizer, CLOSE_MESSAGE); + } + } else if (style === "stroustrup") { + if (tokens[0].loc.start.line === tokens[1].loc.start.line) { + context.report(node.finalizer, CLOSE_MESSAGE_STROUSTRUP); + } + } + } + } + + /** + * Enforces the configured brace style on CatchClauses + * @param {ASTNode} node A CatchClause node. + * @returns {void} + * @private + */ + function checkCatchClause(node) { + var previousToken = context.getTokenBefore(node), + firstToken = context.getFirstToken(node); + + checkBlock("body")(node); + + if (isBlock(node.body)) { + if (style === "1tbs") { + if (previousToken.loc.start.line !== firstToken.loc.start.line) { + context.report(node, CLOSE_MESSAGE); + } + } else if (style === "stroustrup") { + if (previousToken.loc.start.line === firstToken.loc.start.line) { + context.report(node, CLOSE_MESSAGE_STROUSTRUP); + } + } + } + } + + /** + * Enforces the configured brace style on SwitchStatements + * @param {ASTNode} node A SwitchStatement node. + * @returns {void} + * @private + */ + function checkSwitchStatement(node) { + var tokens; + if (node.cases && node.cases.length) { + tokens = context.getTokensBefore(node.cases[0], 2); + if (tokens[0].loc.start.line !== tokens[1].loc.start.line) { + context.report(node, OPEN_MESSAGE); + } + } else { + tokens = context.getLastTokens(node, 3); + if (tokens[0].loc.start.line !== tokens[1].loc.start.line) { + context.report(node, OPEN_MESSAGE); + } + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "FunctionDeclaration": checkBlock("body"), + "FunctionExpression": checkBlock("body"), + "ArrowFunctionExpression": checkBlock("body"), + "IfStatement": checkIfStatement, + "TryStatement": checkTryStatement, + "CatchClause": checkCatchClause, + "DoWhileStatement": checkBlock("body"), + "WhileStatement": checkBlock("body"), + "WithStatement": checkBlock("body"), + "ForStatement": checkBlock("body"), + "ForInStatement": checkBlock("body"), + "ForOfStatement": checkBlock("body"), + "SwitchStatement": checkSwitchStatement + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/camelcase.js b/node_modules/standard/node_modules/eslint/lib/rules/camelcase.js new file mode 100644 index 00000000..d523aee5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/camelcase.js @@ -0,0 +1,94 @@ +/** + * @fileoverview Rule to flag non-camelcased identifiers + * @author Nicholas C. Zakas + * @copyright 2015 Dieter Oberkofler. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Checks if a string contains an underscore and isn't all upper-case + * @param {String} name The string to check. + * @returns {boolean} if the string is underscored + * @private + */ + function isUnderscored(name) { + + // if there's an underscore, it might be A_CONSTANT, which is okay + return name.indexOf("_") > -1 && name !== name.toUpperCase(); + } + + /** + * Reports an AST node as a rule violation. + * @param {ASTNode} node The node to report. + * @returns {void} + * @private + */ + function report(node) { + context.report(node, "Identifier '{{name}}' is not in camel case.", { name: node.name }); + } + + var options = context.options[0] || {}, + properties = options.properties || ""; + + if (properties !== "always" && properties !== "never") { + properties = "always"; + } + + return { + + "Identifier": function(node) { + + // Leading and trailing underscores are commonly used to flag private/protected identifiers, strip them + var name = node.name.replace(/^_+|_+$/g, ""), + effectiveParent = (node.parent.type === "MemberExpression") ? node.parent.parent : node.parent; + + // MemberExpressions get special rules + if (node.parent.type === "MemberExpression") { + + // Always report underscored object names + if (node.parent.object.type === "Identifier" && + node.parent.object.name === node.name && + isUnderscored(name)) { + report(node); + + // Report AssignmentExpressions only if they are the left side of the assignment + } else if (effectiveParent.type === "AssignmentExpression" && + isUnderscored(name) && + (effectiveParent.right.type !== "MemberExpression" || + effectiveParent.left.type === "MemberExpression" && + effectiveParent.left.property.name === node.name)) { + report(node); + } + + // Properties have their own rules + } else if (node.parent.type === "Property") { + + // "never" check properties + if (properties === "never") { + return; + } + + if (isUnderscored(name) && effectiveParent.type !== "CallExpression") { + report(node); + } + + // Report anything that is underscored that isn't a CallExpression + } else if (isUnderscored(name) && effectiveParent.type !== "CallExpression") { + report(node); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/comma-dangle.js b/node_modules/standard/node_modules/eslint/lib/rules/comma-dangle.js new file mode 100644 index 00000000..da3776d4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/comma-dangle.js @@ -0,0 +1,58 @@ +/** + * @fileoverview Rule to forbid or enforce dangling commas. + * @author Ian Christian Myers + * @copyright 2015 Mathias Schreck + * @copyright 2013 Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + var allowDangle = context.options[0]; + var forbidDangle = allowDangle !== "always-multiline" && allowDangle !== "always"; + var UNEXPECTED_MESSAGE = "Unexpected trailing comma."; + var MISSING_MESSAGE = "Missing trailing comma."; + + /** + * Checks the given node for trailing comma and reports violations. + * @param {ASTNode} node The node of an ObjectExpression or ArrayExpression + * @returns {void} + */ + function checkForTrailingComma(node) { + var items = node.properties || node.elements, + length = items.length, + nodeIsMultiLine = node.loc.start.line !== node.loc.end.line, + lastItem, + penultimateToken, + hasDanglingComma; + + if (length) { + lastItem = items[length - 1]; + if (lastItem) { + penultimateToken = context.getLastToken(node, 1); + hasDanglingComma = penultimateToken.value === ","; + + if (forbidDangle && hasDanglingComma) { + context.report(lastItem, penultimateToken.loc.start, UNEXPECTED_MESSAGE); + } else if (allowDangle === "always-multiline") { + if (hasDanglingComma && !nodeIsMultiLine) { + context.report(lastItem, penultimateToken.loc.start, UNEXPECTED_MESSAGE); + } else if (!hasDanglingComma && nodeIsMultiLine) { + context.report(lastItem, penultimateToken.loc.end, MISSING_MESSAGE); + } + } else if (allowDangle === "always" && !hasDanglingComma) { + context.report(lastItem, lastItem.loc.end, MISSING_MESSAGE); + } + } + } + } + + return { + "ObjectExpression": checkForTrailingComma, + "ArrayExpression": checkForTrailingComma + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/comma-spacing.js b/node_modules/standard/node_modules/eslint/lib/rules/comma-spacing.js new file mode 100644 index 00000000..32136a35 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/comma-spacing.js @@ -0,0 +1,159 @@ +/** + * @fileoverview Comma spacing - validates spacing before and after comma + * @author Vignesh Anand aka vegetableman. + * @copyright 2014 Vignesh Anand. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var options = { + before: context.options[0] ? !!context.options[0].before : false, + after: context.options[0] ? !!context.options[0].after : true + }; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + // the index of the last comment that was checked + var lastCommentIndex = 0; + + /** + * Determines whether two adjacent tokens have whitespace between them. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not there is space between the tokens. + */ + function isSpaced(left, right) { + var punctuationLength = context.getTokensBetween(left, right).length; // the length of any parenthesis + return (left.range[1] + punctuationLength) < right.range[0]; + } + + /** + * Checks whether two tokens are on the same line. + * @param {ASTNode} left The leftmost token. + * @param {ASTNode} right The rightmost token. + * @returns {boolean} True if the tokens are on the same line, false if not. + * @private + */ + function isSameLine(left, right) { + return left.loc.end.line === right.loc.start.line; + } + + /** + * Determines if a given token is a comma operator. + * @param {ASTNode} token The token to check. + * @returns {boolean} True if the token is a comma, false if not. + * @private + */ + function isComma(token) { + return !!token && (token.type === "Punctuator") && (token.value === ","); + } + + /** + * Reports a spacing error with an appropriate message. + * @param {ASTNode} node The binary expression node to report. + * @param {string} dir Is the error "before" or "after" the comma? + * @returns {void} + * @private + */ + function report(node, dir) { + context.report(node, options[dir] ? + "A space is required " + dir + " ','." : + "There should be no space " + dir + " ','."); + } + + /** + * Validates the spacing around a comma token. + * @param {Object} tokens - The tokens to be validated. + * @param {Token} tokens.comma The token representing the comma. + * @param {Token} [tokens.left] The last token before the comma. + * @param {Token} [tokens.right] The first token after the comma. + * @param {Token|ASTNode} reportItem The item to use when reporting an error. + * @returns {void} + * @private + */ + function validateCommaItemSpacing(tokens, reportItem) { + if (tokens.left && isSameLine(tokens.left, tokens.comma) && + (options.before !== isSpaced(tokens.left, tokens.comma)) + ) { + report(reportItem, "before"); + } + if (tokens.right && isSameLine(tokens.comma, tokens.right) && + (options.after !== isSpaced(tokens.comma, tokens.right)) + ) { + report(reportItem, "after"); + } + } + + /** + * Determines if a given source index is in a comment or not by checking + * the index against the comment range. Since the check goes straight + * through the file, once an index is passed a certain comment, we can + * go to the next comment to check that. + * @param {int} index The source index to check. + * @param {ASTNode[]} comments An array of comment nodes. + * @returns {boolean} True if the index is within a comment, false if not. + * @private + */ + function isIndexInComment(index, comments) { + + var comment; + + while (lastCommentIndex < comments.length) { + + comment = comments[lastCommentIndex]; + + if (comment.range[0] <= index && index < comment.range[1]) { + return true; + } else if (index > comment.range[1]) { + lastCommentIndex++; + } else { + break; + } + + } + + return false; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "Program": function() { + + var source = context.getSource(), + allComments = context.getAllComments(), + pattern = /,/g, + commaToken, + previousToken, + nextToken; + + while (pattern.test(source)) { + + // do not flag anything inside of comments + if (!isIndexInComment(pattern.lastIndex, allComments)) { + commaToken = context.getTokenByRangeStart(pattern.lastIndex - 1); + + if (commaToken && commaToken.type !== "JSXText") { + previousToken = context.getTokenBefore(commaToken); + nextToken = context.getTokenAfter(commaToken); + validateCommaItemSpacing({ + comma: commaToken, + left: isComma(previousToken) ? null : previousToken, + right: isComma(nextToken) ? null : nextToken + }, commaToken); + } + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/comma-style.js b/node_modules/standard/node_modules/eslint/lib/rules/comma-style.js new file mode 100644 index 00000000..4b8d1457 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/comma-style.js @@ -0,0 +1,177 @@ +/** + * @fileoverview Comma style - enforces comma styles of two types: last and first + * @author Vignesh Anand aka vegetableman + * @copyright 2014 Vignesh Anand. All rights reserved. + * @copyright 2015 Evan Simmons. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var style = context.options[0] || "last", + exceptions = {}; + + if (context.options.length === 2 && context.options[1].hasOwnProperty("exceptions")) { + exceptions = context.options[1].exceptions; + } + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Checks whether two tokens are on the same line. + * @param {ASTNode} left The leftmost token. + * @param {ASTNode} right The rightmost token. + * @returns {boolean} True if the tokens are on the same line, false if not. + * @private + */ + function isSameLine(left, right) { + return left.loc.end.line === right.loc.start.line; + } + + /** + * Determines if a given token is a comma operator. + * @param {ASTNode} token The token to check. + * @returns {boolean} True if the token is a comma, false if not. + * @private + */ + function isComma(token) { + return !!token && (token.type === "Punctuator") && (token.value === ","); + } + + /** + * Validates the spacing around single items in lists. + * @param {Token} previousItemToken The last token from the previous item. + * @param {Token} commaToken The token representing the comma. + * @param {Token} currentItemToken The first token of the current item. + * @param {Token} reportItem The item to use when reporting an error. + * @returns {void} + * @private + */ + function validateCommaItemSpacing(previousItemToken, commaToken, currentItemToken, reportItem) { + + // if single line + if (isSameLine(commaToken, currentItemToken) && + isSameLine(previousItemToken, commaToken)) { + + return; + + } else if (!isSameLine(commaToken, currentItemToken) && + !isSameLine(previousItemToken, commaToken)) { + + // lone comma + context.report(reportItem, { + line: commaToken.loc.end.line, + column: commaToken.loc.start.column + }, "Bad line breaking before and after ','."); + + } else if (style === "first" && !isSameLine(commaToken, currentItemToken)) { + + context.report(reportItem, "',' should be placed first."); + + } else if (style === "last" && isSameLine(commaToken, currentItemToken)) { + + context.report(reportItem, { + line: commaToken.loc.end.line, + column: commaToken.loc.end.column + }, "',' should be placed last."); + } + } + + /** + * Checks the comma placement with regards to a declaration/property/element + * @param {ASTNode} node The binary expression node to check + * @param {string} property The property of the node containing child nodes. + * @private + * @returns {void} + */ + function validateComma(node, property) { + var items = node[property], + arrayLiteral = (node.type === "ArrayExpression"), + previousItemToken; + + if (items.length > 1 || arrayLiteral) { + + // seed as opening [ + previousItemToken = context.getFirstToken(node); + + items.forEach(function(item) { + var commaToken = item ? context.getTokenBefore(item) : previousItemToken, + currentItemToken = item ? context.getFirstToken(item) : context.getTokenAfter(commaToken), + reportItem = item || currentItemToken; + + /* + * This works by comparing three token locations: + * - previousItemToken is the last token of the previous item + * - commaToken is the location of the comma before the current item + * - currentItemToken is the first token of the current item + * + * These values get switched around if item is undefined. + * previousItemToken will refer to the last token not belonging + * to the current item, which could be a comma or an opening + * square bracket. currentItemToken could be a comma. + * + * All comparisons are done based on these tokens directly, so + * they are always valid regardless of an undefined item. + */ + if (isComma(commaToken)) { + validateCommaItemSpacing(previousItemToken, commaToken, + currentItemToken, reportItem); + } + + previousItemToken = item ? context.getLastToken(item) : previousItemToken; + }); + + /* + * Special case for array literals that have empty last items, such + * as [ 1, 2, ]. These arrays only have two items show up in the + * AST, so we need to look at the token to verify that there's no + * dangling comma. + */ + if (arrayLiteral) { + + var lastToken = context.getLastToken(node), + nextToLastToken = context.getTokenBefore(lastToken); + + if (isComma(nextToLastToken)) { + validateCommaItemSpacing( + context.getTokenBefore(nextToLastToken), + nextToLastToken, + lastToken, + lastToken + ); + } + } + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + var nodes = {}; + + if (!exceptions.VariableDeclaration) { + nodes.VariableDeclaration = function(node) { + validateComma(node, "declarations"); + }; + } + if (!exceptions.ObjectExpression) { + nodes.ObjectExpression = function(node) { + validateComma(node, "properties"); + }; + } + if (!exceptions.ArrayExpression) { + nodes.ArrayExpression = function(node) { + validateComma(node, "elements"); + }; + } + + return nodes; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/complexity.js b/node_modules/standard/node_modules/eslint/lib/rules/complexity.js new file mode 100644 index 00000000..36c9c1f4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/complexity.js @@ -0,0 +1,88 @@ +/** + * @fileoverview Counts the cyclomatic complexity of each function of the script. See http://en.wikipedia.org/wiki/Cyclomatic_complexity. + * Counts the number of if, conditional, for, whilte, try, switch/case, + * @author Patrick Brosset + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var THRESHOLD = context.options[0]; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + // Using a stack to store complexity (handling nested functions) + var fns = []; + + // When parsing a new function, store it in our function stack + function startFunction() { + fns.push(1); + } + + function endFunction(node) { + var complexity = fns.pop(), + name = "anonymous"; + + if (node.id) { + name = node.id.name; + } else if (node.parent.type === "MethodDefinition") { + name = node.parent.key.name; + } + + if (complexity > THRESHOLD) { + context.report(node, "Function '{{name}}' has a complexity of {{complexity}}.", { name: name, complexity: complexity }); + } + } + + function increaseComplexity() { + if (fns.length) { + fns[fns.length - 1] ++; + } + } + + function increaseSwitchComplexity(node) { + // Avoiding `default` + if (node.test) { + increaseComplexity(node); + } + } + + function increaseLogicalComplexity(node) { + // Avoiding && + if (node.operator === "||") { + increaseComplexity(node); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "FunctionDeclaration": startFunction, + "FunctionExpression": startFunction, + "ArrowFunctionExpression": startFunction, + "FunctionDeclaration:exit": endFunction, + "FunctionExpression:exit": endFunction, + "ArrowFunctionExpression:exit": endFunction, + + "CatchClause": increaseComplexity, + "ConditionalExpression": increaseComplexity, + "LogicalExpression": increaseLogicalComplexity, + "ForStatement": increaseComplexity, + "ForInStatement": increaseComplexity, + "ForOfStatement": increaseComplexity, + "IfStatement": increaseComplexity, + "SwitchCase": increaseSwitchComplexity, + "WhileStatement": increaseComplexity, + "DoWhileStatement": increaseComplexity + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/consistent-return.js b/node_modules/standard/node_modules/eslint/lib/rules/consistent-return.js new file mode 100644 index 00000000..38adba7f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/consistent-return.js @@ -0,0 +1,73 @@ +/** + * @fileoverview Rule to flag consistent return values + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var functions = []; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Marks entrance into a function by pushing a new object onto the functions + * stack. + * @returns {void} + * @private + */ + function enterFunction() { + functions.push({}); + } + + /** + * Marks exit of a function by popping off the functions stack. + * @returns {void} + * @private + */ + function exitFunction() { + functions.pop(); + } + + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "Program": enterFunction, + "FunctionDeclaration": enterFunction, + "FunctionExpression": enterFunction, + "ArrowFunctionExpression": enterFunction, + + "Program:exit": exitFunction, + "FunctionDeclaration:exit": exitFunction, + "FunctionExpression:exit": exitFunction, + "ArrowFunctionExpression:exit": exitFunction, + + "ReturnStatement": function(node) { + + var returnInfo = functions[functions.length - 1], + returnTypeDefined = "type" in returnInfo; + + if (returnTypeDefined) { + + if (returnInfo.type !== !!node.argument) { + context.report(node, "Expected " + (returnInfo.type ? "a" : "no") + " return value."); + } + + } else { + returnInfo.type = !!node.argument; + } + + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/consistent-this.js b/node_modules/standard/node_modules/eslint/lib/rules/consistent-this.js new file mode 100644 index 00000000..3efb2cd3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/consistent-this.js @@ -0,0 +1,108 @@ +/** + * @fileoverview Rule to enforce consistent naming of "this" context variables + * @author Raphael Pigulla + * @copyright 2015 Timothy Jones. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var alias = context.options[0]; + + /** + * Reports that a variable declarator or assignment expression is assigning + * a non-'this' value to the specified alias. + * @param {ASTNode} node - The assigning node. + * @returns {void} + */ + function reportBadAssignment(node) { + context.report(node, + "Designated alias '{{alias}}' is not assigned to 'this'.", + { alias: alias }); + } + + /** + * Checks that an assignment to an identifier only assigns 'this' to the + * appropriate alias, and the alias is only assigned to 'this'. + * @param {ASTNode} node - The assigning node. + * @param {Identifier} name - The name of the variable assigned to. + * @param {Expression} value - The value of the assignment. + * @returns {void} + */ + function checkAssignment(node, name, value) { + var isThis = value.type === "ThisExpression"; + + if (name === alias) { + if (!isThis || node.operator && node.operator !== "=") { + reportBadAssignment(node); + } + } else if (isThis) { + context.report(node, + "Unexpected alias '{{name}}' for 'this'.", { name: name }); + } + } + + /** + * Ensures that a variable declaration of the alias in a program or function + * is assigned to the correct value. + * @returns {void} + */ + function ensureWasAssigned() { + var scope = context.getScope(); + + scope.variables.some(function (variable) { + var lookup; + + if (variable.name === alias) { + if (variable.defs.some(function (def) { + return def.node.type === "VariableDeclarator" && + def.node.init !== null; + })) { + return true; + } + + lookup = scope.type === "global" ? scope : variable; + + // The alias has been declared and not assigned: check it was + // assigned later in the same scope. + if (!lookup.references.some(function (reference) { + var write = reference.writeExpr; + + if (reference.from === scope && + write && write.type === "ThisExpression" && + write.parent.operator === "=") { + return true; + } + })) { + variable.defs.map(function (def) { + return def.node; + }).forEach(reportBadAssignment); + } + + return true; + } + }); + } + + return { + "Program:exit": ensureWasAssigned, + "FunctionExpression:exit": ensureWasAssigned, + "FunctionDeclaration:exit": ensureWasAssigned, + + "VariableDeclarator": function (node) { + if (node.init !== null) { + checkAssignment(node, node.id.name, node.init); + } + }, + + "AssignmentExpression": function (node) { + if (node.left.type === "Identifier") { + checkAssignment(node, node.left.name, node.right); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/curly.js b/node_modules/standard/node_modules/eslint/lib/rules/curly.js new file mode 100644 index 00000000..2bfcfb27 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/curly.js @@ -0,0 +1,103 @@ +/** + * @fileoverview Rule to flag statements without curly braces + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var multiOnly = (context.options[0] === "multi"); + var multiLine = (context.options[0] === "multi-line"); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines if a given node is a one-liner that's on the same line as it's preceding code. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node is a one-liner that's on the same line as it's preceding code. + * @private + */ + function isCollapsedOneLiner(node) { + var before = context.getTokenBefore(node), + last = context.getLastToken(node); + return before.loc.start.line === last.loc.end.line; + } + + /** + * Checks the body of a node to see if it's a block statement. Depending on + * the rule options, reports the appropriate problems. + * @param {ASTNode} node The node to report if there's a problem. + * @param {ASTNode} body The body node to check for blocks. + * @param {string} name The name to report if there's a problem. + * @param {string} suffix Additional string to add to the end of a report. + * @returns {void} + */ + function checkBody(node, body, name, suffix) { + var hasBlock = (body.type === "BlockStatement"); + + if (multiOnly) { + if (hasBlock && body.body.length === 1) { + context.report(node, "Unnecessary { after '{{name}}'{{suffix}}.", + { + name: name, + suffix: (suffix ? " " + suffix : "") + } + ); + } + } else if (multiLine) { + if (!hasBlock && !isCollapsedOneLiner(body)) { + context.report(node, "Expected { after '{{name}}'{{suffix}}.", + { + name: name, + suffix: (suffix ? " " + suffix : "") + } + ); + } + } else { + if (!hasBlock) { + context.report(node, "Expected { after '{{name}}'{{suffix}}.", + { + name: name, + suffix: (suffix ? " " + suffix : "") + } + ); + } + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "IfStatement": function(node) { + + checkBody(node, node.consequent, "if", "condition"); + + if (node.alternate && node.alternate.type !== "IfStatement") { + checkBody(node, node.alternate, "else"); + } + + }, + + "WhileStatement": function(node) { + checkBody(node, node.body, "while", "condition"); + }, + + "DoWhileStatement": function (node) { + checkBody(node, node.body, "do"); + }, + + "ForStatement": function(node) { + checkBody(node, node.body, "for", "condition"); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/default-case.js b/node_modules/standard/node_modules/eslint/lib/rules/default-case.js new file mode 100644 index 00000000..da0da1ad --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/default-case.js @@ -0,0 +1,64 @@ +/** + * @fileoverview require default case in switch statements + * @author Aliaksei Shytkin + */ +"use strict"; + +var COMMENT_VALUE = "no default"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Shortcut to get last element of array + * @param {*[]} collection Array + * @returns {*} Last element + */ + function last(collection) { + return collection[collection.length - 1]; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "SwitchStatement": function(node) { + + if (!node.cases.length) { + // skip check of empty switch because there is no easy way + // to extract comments inside it now + return; + } + + var hasDefault = node.cases.some(function(v) { + return v.test === null; + }); + + if (!hasDefault) { + + var comment; + var comments; + + var lastCase = last(node.cases); + comments = context.getComments(lastCase).trailing; + + if (comments.length) { + comment = last(comments); + } + + if (!comment || comment.value.trim() !== COMMENT_VALUE) { + context.report(node, "Expected a default case."); + } + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/dot-notation.js b/node_modules/standard/node_modules/eslint/lib/rules/dot-notation.js new file mode 100644 index 00000000..bf89cbfd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/dot-notation.js @@ -0,0 +1,104 @@ +/** + * @fileoverview Rule to warn about using dot notation instead of square bracket notation when possible. + * @author Josh Perez + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +var validIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/; +var keywords = [ + "this", + "function", + "if", + "return", + "var", + "else", + "for", + "new", + "in", + "typeof", + "while", + "case", + "break", + "try", + "catch", + "delete", + "throw", + "switch", + "continue", + "default", + "instanceof", + "do", + "void", + "finally", + "with", + "debugger", + "implements", + "interface", + "package", + "private", + "protected", + "public", + "static", + "class", + "enum", + "export", + "extends", + "import", + "super", + "true", + "false", + "null", + "abstract", + "boolean", + "byte", + "char", + "const", + "double", + "final", + "float", + "goto", + "int", + "long", + "native", + "short", + "synchronized", + "throws", + "transient", + "volatile" +]; + +module.exports = function(context) { + var options = context.options[0] || {}; + var allowKeywords = options.allowKeywords === void 0 || !!options.allowKeywords; + + var allowPattern; + if (options.allowPattern) { + allowPattern = new RegExp(options.allowPattern); + } + + return { + "MemberExpression": function(node) { + if ( + node.computed && + node.property.type === "Literal" && + validIdentifier.test(node.property.value) && + (allowKeywords || keywords.indexOf("" + node.property.value) === -1) + ) { + if (!(allowPattern && allowPattern.test(node.property.value))) { + context.report(node, "[" + JSON.stringify(node.property.value) + "] is better written in dot notation."); + } + } + if ( + !allowKeywords && + !node.computed && + keywords.indexOf("" + node.property.name) !== -1 + ) { + context.report(node, "." + node.property.name + " is a syntax error."); + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/eol-last.js b/node_modules/standard/node_modules/eslint/lib/rules/eol-last.js new file mode 100644 index 00000000..96c78c18 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/eol-last.js @@ -0,0 +1,36 @@ +/** + * @fileoverview Require file to end with single newline. + * @author Nodeca Team + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "Program": function checkBadEOF(node) { + // Get the whole source code, not for node only. + var src = context.getSource(), location = {column: 1}; + + if (src.length === 0) { + return; + } + + if (src[src.length - 1] !== "\n") { + // file is not newline-terminated + location.line = src.split(/\n/g).length; + context.report(node, location, "Newline required at end of file but not found."); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/eqeqeq.js b/node_modules/standard/node_modules/eslint/lib/rules/eqeqeq.js new file mode 100644 index 00000000..e847a832 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/eqeqeq.js @@ -0,0 +1,90 @@ +/** + * @fileoverview Rule to flag statements that use != and == instead of !== and === + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Checks if an expression is a typeof expression + * @param {ASTNode} node The node to check + * @returns {boolean} if the node is a typeof expression + */ + function isTypeOf(node) { + return node.type === "UnaryExpression" && node.operator === "typeof"; + } + + /** + * Checks if either operand of a binary expression is a typeof operation + * @param {ASTNode} node The node to check + * @returns {boolean} if one of the operands is typeof + * @private + */ + function isTypeOfBinary(node) { + return isTypeOf(node.left) || isTypeOf(node.right); + } + + /** + * Checks if operands are literals of the same type (via typeof) + * @param {ASTNode} node The node to check + * @returns {boolean} if operands are of same type + * @private + */ + function areLiteralsAndSameType(node) { + return node.left.type === "Literal" && node.right.type === "Literal" && + typeof node.left.value === typeof node.right.value; + } + + /** + * Checks if one of the operands is a literal null + * @param {ASTNode} node The node to check + * @returns {boolean} if operands are null + * @private + */ + function isNullCheck(node) { + return (node.right.type === "Literal" && node.right.value === null) || + (node.left.type === "Literal" && node.left.value === null); + } + + /** + * Gets the location (line and column) of the binary expression's operator + * @param {ASTNode} node The binary expression node to check + * @param {String} operator The operator to find + * @returns {Object} { line, column } location of operator + * @private + */ + function getOperatorLocation(node) { + var opToken = context.getTokenAfter(node.left); + return {line: opToken.loc.start.line, column: opToken.loc.start.column}; + } + + return { + "BinaryExpression": function(node) { + if (node.operator !== "==" && node.operator !== "!=") { + return; + } + + if (context.options[0] === "smart" && (isTypeOfBinary(node) || + areLiteralsAndSameType(node)) || isNullCheck(node)) { + return; + } + + if (context.options[0] === "allow-null" && isNullCheck(node)) { + return; + } + + context.report( + node, getOperatorLocation(node), + "Expected '{{op}}=' and instead saw '{{op}}'.", + {op: node.operator} + ); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/func-names.js b/node_modules/standard/node_modules/eslint/lib/rules/func-names.js new file mode 100644 index 00000000..eb4d9be1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/func-names.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Rule to warn when a function expression does not have a name. + * @author Kyle T. Nunery + * @copyright 2015 Brandon Mills. All rights reserved. + * @copyright 2014 Kyle T. Nunery. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Determines whether the current FunctionExpression node is a get, set, or + * shorthand method in an object literal or a class. + * @returns {boolean} True if the node is a get, set, or shorthand method. + */ + function isObjectOrClassMethod() { + var parent = context.getAncestors().pop(); + + return (parent.type === "MethodDefinition" || ( + parent.type === "Property" && ( + parent.method || + parent.kind === "get" || + parent.kind === "set" + ) + )); + } + + return { + "FunctionExpression": function(node) { + + var name = node.id && node.id.name; + + if (!name && !isObjectOrClassMethod()) { + context.report(node, "Missing function expression name."); + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/func-style.js b/node_modules/standard/node_modules/eslint/lib/rules/func-style.js new file mode 100644 index 00000000..f54350e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/func-style.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Rule to enforce a particular function style + * @author Nicholas C. Zakas + * @copyright 2013 Nicholas C. Zakas. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var style = context.options[0], + enforceDeclarations = (style === "declaration"); + + return { + + "FunctionDeclaration": function(node) { + if (!enforceDeclarations) { + context.report(node, "Expected a function expression."); + } + }, + + "FunctionExpression": function() { + var parent = context.getAncestors().pop(); + + if (enforceDeclarations && parent.type === "VariableDeclarator") { + context.report(parent, "Expected a function declaration."); + } + }, + + "ArrowFunctionExpression": function() { + var parent = context.getAncestors().pop(); + + if (enforceDeclarations && parent.type === "VariableDeclarator") { + context.report(parent, "Expected a function declaration."); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/generator-star-spacing.js b/node_modules/standard/node_modules/eslint/lib/rules/generator-star-spacing.js new file mode 100644 index 00000000..fe0b82bd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/generator-star-spacing.js @@ -0,0 +1,83 @@ +/** + * @fileoverview Rule to check the spacing around the * in generator functions. + * @author Jamund Ferguson + * @copyright 2015 Brandon Mills. All rights reserved. + * @copyright 2014 Jamund Ferguson. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var mode = { + before: { before: true, after: false }, + after: { before: false, after: true }, + both: { before: true, after: true }, + neither: { before: false, after: false } + }[context.options[0] || "before"]; + + /** + * Checks the spacing between two tokens before or after the star token. + * @param {string} side Either "before" or "after". + * @param {Token} leftToken `function` keyword token if side is "before", or + * star token if side is "after". + * @param {Token} rightToken Star token if side is "before", or identifier + * token if side is "after". + * @returns {void} + */ + function checkSpacing(side, leftToken, rightToken) { + if (!!(rightToken.range[0] - leftToken.range[1]) !== mode[side]) { + context.report( + leftToken.value === "*" ? leftToken : rightToken, + "{{type}} space {{side}} *.", + { + type: mode[side] ? "Missing" : "Unexpected", + side: side + } + ); + } + } + + /** + * Enforces the spacing around the star if node is a generator function. + * @param {ASTNode} node A function expression or declaration node. + * @returns {void} + */ + function checkFunction(node) { + var isMethod, starToken, tokenBefore, tokenAfter; + + if (!node.generator) { + return; + } + + isMethod = !!context.getAncestors().pop().method; + + if (isMethod) { + starToken = context.getTokenBefore(node, 1); + } else { + starToken = context.getFirstToken(node, 1); + } + + // Only check before when preceded by `function` keyword + tokenBefore = context.getTokenBefore(starToken); + if (tokenBefore.value === "function") { + checkSpacing("before", tokenBefore, starToken); + } + + // Only check after when followed by an identifier + tokenAfter = context.getTokenAfter(starToken); + if (tokenAfter.type === "Identifier") { + checkSpacing("after", starToken, tokenAfter); + } + } + + return { + "FunctionDeclaration": checkFunction, + "FunctionExpression": checkFunction + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/generator-star.js b/node_modules/standard/node_modules/eslint/lib/rules/generator-star.js new file mode 100644 index 00000000..4541e671 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/generator-star.js @@ -0,0 +1,70 @@ +/** + * @fileoverview Rule to check for the position of the * in your generator functions + * @author Jamund Ferguson + * @copyright 2014 Jamund Ferguson. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var position = context.options[0] || "end"; + + /** + * Check the position of the star compared to the expected position. + * @param {ASTNode} node - the entire function node + * @returns {void} + */ + function checkStarPosition(node) { + var starToken; + + if (!node.generator) { + return; + } + + // Blocked, pending decision to fix or work around in eslint/espree#36 + if (context.getAncestors().pop().method) { + return; + } + + starToken = context.getFirstToken(node, 1); + + // check for function *name() {} + if (position === "end") { + + // * starts where the next identifier begins + if (starToken.range[1] !== context.getTokenAfter(starToken).range[0]) { + context.report(node, "Expected a space before *."); + } + } + + // check for function* name() {} + if (position === "start") { + + // * begins where the previous identifier ends + if (starToken.range[0] !== context.getTokenBefore(starToken).range[1]) { + context.report(node, "Expected no space before *."); + } + } + + // check for function * name() {} + if (position === "middle") { + + // must be a space before and afer the * + if (starToken.range[0] <= context.getTokenBefore(starToken).range[1] || + starToken.range[1] >= context.getTokenAfter(starToken).range[0]) { + context.report(node, "Expected spaces around *."); + } + } + } + + return { + "FunctionDeclaration": checkStarPosition, + "FunctionExpression": checkStarPosition + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/global-strict.js b/node_modules/standard/node_modules/eslint/lib/rules/global-strict.js new file mode 100644 index 00000000..c16c62db --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/global-strict.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Rule to flag or require global strict mode. + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var mode = context.options[0]; + + if (mode === "always") { + + return { + "Program": function(node) { + if (node.body.length > 0) { + var statement = node.body[0]; + + if (!(statement.type === "ExpressionStatement" && statement.expression.value === "use strict")) { + context.report(node, "Use the global form of \"use strict\"."); + } + } + } + }; + + } else { // mode = "never" + + return { + "ExpressionStatement": function(node) { + var parent = context.getAncestors().pop(); + + if (node.expression.value === "use strict" && parent.type === "Program") { + context.report(node, "Use the function form of \"use strict\"."); + } + } + }; + + } + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/guard-for-in.js b/node_modules/standard/node_modules/eslint/lib/rules/guard-for-in.js new file mode 100644 index 00000000..d79651d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/guard-for-in.js @@ -0,0 +1,30 @@ +/** + * @fileoverview Rule to flag for-in loops without if statements inside + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "ForInStatement": function(node) { + + /* + * If the for-in statement has {}, then the real body is the body + * of the BlockStatement. Otherwise, just use body as provided. + */ + var body = node.body.type === "BlockStatement" ? node.body.body[0] : node.body; + + if (body && body.type !== "IfStatement") { + context.report(node, "The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/handle-callback-err.js b/node_modules/standard/node_modules/eslint/lib/rules/handle-callback-err.js new file mode 100644 index 00000000..f57e4d17 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/handle-callback-err.js @@ -0,0 +1,118 @@ +/** + * @fileoverview Ensure handling of errors when we know they exist. + * @author Jamund Ferguson + * @copyright 2014 Jamund Ferguson. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var errorArgument = context.options[0] || "err"; + var callbacks = []; + var scopes = 0; + + /** + * Checks if the given argument should be interpreted as a regexp pattern. + * @param {string} stringToCheck The string which should be checked. + * @returns {boolean} Whether or not the string should be interpreted as a pattern. + */ + function isPattern(stringToCheck) { + var firstChar = stringToCheck[0]; + return firstChar === "^"; + } + + /** + * Checks if the given name matches the configured error argument. + * @param {string} name The name which should be compared. + * @returns {boolean} Whether or not the given name matches the configured error variable name. + */ + function matchesConfiguredErrorName(name) { + if (isPattern(errorArgument)) { + var regexp = new RegExp(errorArgument); + return regexp.test(name); + } + return name === errorArgument; + } + + /** + * Check the arguments to see if we need to start tracking the error object. + * @param {ASTNode} node The AST node to check. + * @returns {void} + */ + function startFunction(node) { + + // keep track of nested scopes + scopes++; + + // check if the first argument matches our argument name + var firstArg = node.params && node.params[0]; + if (firstArg && matchesConfiguredErrorName(firstArg.name)) { + callbacks.push({handled: false, depth: scopes, errorVariableName: firstArg.name}); + } + } + + /** + * At the end of a function check to see if the error was handled. + * @param {ASTNode} node The AST node to check. + * @returns {void} + */ + function endFunction(node) { + + var callback = callbacks[callbacks.length - 1] || {}; + + // check if a callback is ending, if so pop it off the stack + if (callback.depth === scopes) { + callbacks.pop(); + + // check if there were no handled errors since the last callback + if (!callback.handled) { + context.report(node, "Expected error to be handled."); + } + } + + // less nested functions + scopes--; + + } + + /** + * Check to see if we're handling the error object properly. + * @param {ASTNode} node The AST node to check. + * @returns {void} + */ + function checkForError(node) { + if (callbacks.length > 0) { + var callback = callbacks[callbacks.length - 1] || {}; + + // make sure the node's name matches our error argument name + var isAboutError = node.name === callback.errorVariableName; + + // we don't consider these use cases as "handling" the error + var doNotCount = ["FunctionDeclaration", "ArrowFunctionExpression", "FunctionExpression", "CatchClause"]; + + // make sure this identifier isn't used as part of one of them + var isHandled = doNotCount.indexOf(node.parent.type) === -1; + + if (isAboutError && isHandled) { + // record that this callback handled its error + callback.handled = true; + } + } + } + + return { + "FunctionDeclaration": startFunction, + "FunctionExpression": startFunction, + "ArrowFunctionExpression": startFunction, + "Identifier": checkForError, + "FunctionDeclaration:exit": endFunction, + "FunctionExpression:exit": endFunction, + "ArrowFunctionExpression:exit": endFunction + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/indent.js b/node_modules/standard/node_modules/eslint/lib/rules/indent.js new file mode 100644 index 00000000..b0e838e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/indent.js @@ -0,0 +1,464 @@ +/** + * @fileoverview This option sets a specific tab width for your code + * This rule has been ported and modified from JSCS. + * @author Dmitriy Shekhovtsov + * @copyright 2015 Dmitriy Shekhovtsov. All rights reserved. + * @copyright 2013 Dulin Marat and other contributors. + * + * 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. + */ +/*eslint no-use-before-define:[2, "nofunc"]*/ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + // indentation defaults: 4 spaces + var indentChar = " "; + var indentSize = 4; + var options = {indentSwitchCase: false}; + + var lines = null; + var indentStack = [0]; + var linesToCheck = null; + var breakIndents = null; + + if (context.options.length) { + if (context.options[0] === "tab") { + indentChar = "\t"; + indentSize = 1; + } else if (typeof context.options[0] === "number") { + indentSize = context.options[0]; + } + + if (context.options[1]) { + var opts = context.options[1]; + options.indentSwitchCase = opts.indentSwitchCase === true; + } + } + + var blockParents = [ + "IfStatement", + "WhileStatement", + "DoWhileStatement", + "ForStatement", + "ForInStatement", + "ForOfStatement", + "FunctionDeclaration", + "FunctionExpression", + "ArrowExpression", + "CatchClause", + "WithStatement" + ]; + + var indentableNodes = { + BlockStatement: "body", + Program: "body", + ObjectExpression: "properties", + ArrayExpression: "elements", + SwitchStatement: "cases" + }; + + if (options.indentSwitchCase) { + indentableNodes.SwitchCase = "consequent"; + } + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Mark line to be checked + * @param {Number} line - line number + * @returns {void} + */ + function markCheckLine(line) { + linesToCheck[line].check = true; + } + + /** + * Mark line with targeted node to be checked + * @param {ASTNode} checkNode - targeted node + * @returns {void} + */ + function markCheck(checkNode) { + markCheckLine(checkNode.loc.start.line - 1); + } + + /** + * Sets pushing indent of current node + * @param {ASTNode} node - targeted node + * @param {Number} indents - indents count to push + * @returns {void} + */ + function markPush(node, indents) { + linesToCheck[node.loc.start.line - 1].push.push(indents); + } + + /** + * Marks line as outdent, end of block statement for example + * @param {ASTNode} node - targeted node + * @param {Number} outdents - count of outedents in targeted line + * @returns {void} + */ + function markPop(node, outdents) { + linesToCheck[node.loc.end.line - 1].pop.push(outdents); + } + + /** + * Set alt push for current node + * @param {ASTNode} node - targeted node + * @returns {void} + */ + function markPushAlt(node) { + linesToCheck[node.loc.start.line - 1].pushAltLine.push(node.loc.end.line - 1); + } + + /** + * Marks end of node block to be checked + * and marks targeted node as indent pushing + * @param {ASTNode} pushNode - targeted node + * @param {Number} indents - indent count to push + * @returns {void} + */ + function markPushAndEndCheck(pushNode, indents) { + markPush(pushNode, indents); + markCheckLine(pushNode.loc.end.line - 1); + } + + /** + * Mark node as switch case statement + * and set push\pop indentation changes + * @param {ASTNode} caseNode - targeted node + * @param {ASTNode[]} children - consequent child nodes of case node + * @returns {void} + */ + function markCase(caseNode, children) { + var outdentNode = getCaseOutdent(children); + + if (outdentNode) { + // If a case statement has a `break` as a direct child and it is the + // first one encountered, use it as the example for all future case indentation + if (breakIndents === null) { + breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; + } + markPop(outdentNode, breakIndents); + } else { + markPop(caseNode, 0); + } + } + + /** + * Mark child nodes to be checked later of targeted node, + * only if child node not in same line as targeted one + * (if child and parent nodes wrote in single line) + * @param {ASTNode} node - targeted node + * @returns {void} + */ + function markChildren(node) { + getChildren(node).forEach(function(childNode) { + if (childNode.loc.start.line !== node.loc.start.line || node.type === "Program") { + markCheck(childNode); + } + }); + } + + /** + * Mark child block as scope pushing and mark to check + * @param {ASTNode} node - target node + * @param {String} property - target node property containing child + * @returns {void} + */ + function markAlternateBlockStatement(node, property) { + var child = node[property]; + if (child && child.type === "BlockStatement") { + markCheck(child); + } + } + + /** + * Checks whether node is multiline or single line + * @param {ASTNode} node - target node + * @returns {boolean} - is multiline node + */ + function isMultiline(node) { + return node.loc.start.line !== node.loc.end.line; + } + + /** + * Get switch case statement outdent node if any + * @param {ASTNode[]} caseChildren - case statement childs + * @returns {ASTNode} - outdent node + */ + function getCaseOutdent(caseChildren) { + var outdentNode; + caseChildren.some(function(node) { + if (node.type === "BreakStatement") { + outdentNode = node; + return true; + } + }); + + return outdentNode; + } + + /** + * Returns block containing node + * @param {ASTNode} node - targeted node + * @returns {ASTNode} - block node + */ + function getBlockNodeToMark(node) { + var parent = node.parent; + + // The parent of an else is the entire if/else block. To avoid over indenting + // in the case of a non-block if with a block else, mark push where the else starts, + // not where the if starts! + if (parent.type === "IfStatement" && parent.alternate === node) { + return node; + } + + // The end line to check of a do while statement needs to be the location of the + // closing curly brace, not the while statement, to avoid marking the last line of + // a multiline while as a line to check. + if (parent.type === "DoWhileStatement") { + return node; + } + + // Detect bare blocks: a block whose parent doesn"t expect blocks in its syntax specifically. + if (blockParents.indexOf(parent.type) === -1) { + return node; + } + + return parent; + } + + /** + * Get node's children + * @param {ASTNode} node - current node + * @returns {ASTNode[]} - children + */ + function getChildren(node) { + var childrenProperty = indentableNodes[node.type]; + return node[childrenProperty]; + } + + /** + * Gets indentation in line `i` + * @param {Number} i - number of line to get indentation + * @returns {Number} - count of indentation symbols + */ + function getIndentationFromLine(i) { + var rNotIndentChar = new RegExp("[^" + indentChar + "]"); + var firstContent = lines[i].search(rNotIndentChar); + if (firstContent === -1) { + firstContent = lines[i].length; + } + return firstContent; + } + + /** + * Compares expected and actual indentation + * and reports any violations + * @param {ASTNode} node - node used only for reporting + * @returns {void} + */ + function checkIndentations(node) { + linesToCheck.forEach(function(line, i) { + var actualIndentation = getIndentationFromLine(i); + var expectedIndentation = getExpectedIndentation(line, actualIndentation); + + if (line.check) { + + if (actualIndentation !== expectedIndentation) { + context.report(node, + {line: i + 1, column: expectedIndentation}, + "Expected indentation of " + expectedIndentation + " characters."); + // correct the indentation so that future lines + // can be validated appropriately + actualIndentation = expectedIndentation; + } + } + + if (line.push.length) { + pushExpectedIndentations(line, actualIndentation); + } + }); + } + + /** + * Counts expected indentation for given line number + * @param {Number} line - line number + * @param {Number} actual - actual indentation + * @returns {number} - expected indentation + */ + function getExpectedIndentation(line, actual) { + var outdent = indentSize * Math.max.apply(null, line.pop); + + var idx = indentStack.length - 1; + var expected = indentStack[idx]; + + if (!Array.isArray(expected)) { + expected = [expected]; + } + + expected = expected.map(function(value) { + if (line.pop.length) { + value -= outdent; + } + + return value; + }).reduce(function(previous, current) { + // when the expected is an array, resolve the value + // back into a Number by checking both values are the actual indentation + return actual === current ? current : previous; + }); + + indentStack[idx] = expected; + + line.pop.forEach(function() { + indentStack.pop(); + }); + + return expected; + } + + /** + * Store in stack expected indentations + * @param {Number} line - current line + * @param {Number} actualIndentation - actual indentation at current line + * @returns {void} + */ + function pushExpectedIndentations(line, actualIndentation) { + var indents = Math.max.apply(null, line.push); + var expected = actualIndentation + (indentSize * indents); + + // when a line has alternate indentations, push an array of possible values + // on the stack, to be resolved when checked against an actual indentation + if (line.pushAltLine.length) { + expected = [expected]; + line.pushAltLine.forEach(function(altLine) { + expected.push(getIndentationFromLine(altLine) + (indentSize * indents)); + }); + } + + line.push.forEach(function() { + indentStack.push(expected); + }); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "Program": function (node) { + lines = context.getSourceLines(); + linesToCheck = lines.map(function () { + return { + push: [], + pushAltLine: [], + pop: [], + check: false + }; + }); + + if (!isMultiline(node)) { + return; + } + + markChildren(node); + }, + "Program:exit": function (node) { + checkIndentations(node); + }, + + "BlockStatement": function (node) { + if (!isMultiline(node)) { + return; + } + + markChildren(node); + markPop(node, 1); + + markPushAndEndCheck(getBlockNodeToMark(node), 1); + }, + + "IfStatement": function (node) { + markAlternateBlockStatement(node, "alternate"); + }, + + "TryStatement": function (node) { + markAlternateBlockStatement(node, "handler"); + markAlternateBlockStatement(node, "finalizer"); + }, + + "SwitchStatement": function (node) { + if (!isMultiline(node)) { + return; + } + + var indents = 1; + var children = getChildren(node); + + if (children.length && node.loc.start.column === children[0].loc.start.column) { + indents = 0; + } + + markChildren(node); + markPop(node, indents); + markPushAndEndCheck(node, indents); + }, + + "SwitchCase": function (node) { + if (!options.indentSwitchCase) { + return; + } + + if (!isMultiline(node)) { + return; + } + + var children = getChildren(node); + + if (children.length === 1 && children[0].type === "BlockStatement") { + return; + } + + markPush(node, 1); + markCheck(node); + markChildren(node); + + markCase(node, children); + }, + + // indentations inside of function expressions can be offset from + // either the start of the function or the end of the function, therefore + // mark all starting lines of functions as potential indentations + "FunctionDeclaration": function (node) { + markPushAlt(node); + }, + "FunctionExpression": function (node) { + markPushAlt(node); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/key-spacing.js b/node_modules/standard/node_modules/eslint/lib/rules/key-spacing.js new file mode 100644 index 00000000..7b19e56a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/key-spacing.js @@ -0,0 +1,246 @@ +/** + * @fileoverview Rule to specify spacing of object literal keys and values + * @author Brandon Mills + * @copyright 2014 Brandon Mills. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether a string contains a line terminator as defined in + * http://www.ecma-international.org/ecma-262/5.1/#sec-7.3 + * @param {string} str String to test. + * @returns {boolean} True if str contains a line terminator. + */ +function containsLineTerminator(str) { + return /[\n\r\u2028\u2029]/.test(str); +} + +/** + * Gets the last element of an array. + * @param {Array} arr An array. + * @returns {any} Last element of arr. + */ +function last(arr) { + return arr[arr.length - 1]; +} + +/** + * Checks whether a property is a member of the property group it follows. + * @param {ASTNode} lastMember The last Property known to be in the group. + * @param {ASTNode} candidate The next Property that might be in the group. + * @returns {boolean} True if the candidate property is part of the group. + */ +function continuesPropertyGroup(lastMember, candidate) { + var groupEndLine = lastMember.loc.end.line, + candidateStartLine = candidate.loc.start.line, + comments, i; + + if (candidateStartLine - groupEndLine <= 1) { + return true; + } + + // Check that the first comment is adjacent to the end of the group, the + // last comment is adjacent to the candidate property, and that successive + // comments are adjacent to each other. + comments = candidate.leadingComments; + if ( + comments && + comments[0].loc.start.line - groupEndLine <= 1 && + candidateStartLine - last(comments).loc.end.line <= 1 + ) { + for (i = 1; i < comments.length; i++) { + if (comments[i].loc.start.line - comments[i - 1].loc.end.line > 1) { + return false; + } + } + return true; + } + + return false; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +var messages = { + key: "{{error}} space after {{computed}}key \"{{key}}\".", + value: "{{error}} space before value for {{computed}}key \"{{key}}\"." +}; + +module.exports = function(context) { + + /** + * OPTIONS + * "key-spacing": [2, { + * beforeColon: false, + * afterColon: true, + * align: "colon" // Optional, or "value" + * } + */ + + var options = context.options[0] || {}, + align = options.align, + beforeColon = +!!options.beforeColon, // Defaults to false + afterColon = +!(options.afterColon === false); // Defaults to true + + /** + * Gets an object literal property's key as the identifier name or string value. + * @param {ASTNode} property Property node whose key to retrieve. + * @returns {string} The property's key. + */ + function getKey(property) { + var key = property.key; + + if (property.computed) { + return context.getSource().slice(key.range[0], key.range[1]); + } + + return property.key.name || property.key.value; + } + + /** + * Reports an appropriately-formatted error if spacing is incorrect on one + * side of the colon. + * @param {ASTNode} property Key-value pair in an object literal. + * @param {string} side Side being verified - either "key" or "value". + * @param {string} whitespace Actual whitespace string. + * @param {int} expected Expected whitespace length. + * @returns {void} + */ + function report(property, side, whitespace, expected) { + var diff = whitespace.length - expected, + key = property.key, + firstTokenAfterColon = context.getTokenAfter(key, 1), + location = side === "key" ? key.loc.start : firstTokenAfterColon.loc.start; + + if (diff && !(expected && containsLineTerminator(whitespace))) { + context.report(property[side], location, messages[side], { + error: diff > 0 ? "Extra" : "Missing", + computed: property.computed ? "computed " : "", + key: getKey(property) + }); + } + } + + /** + * Gets the number of characters in a key, including quotes around string + * keys and braces around computed property keys. + * @param {ASTNode} property Property of on object literal. + * @returns {int} Width of the key. + */ + function getKeyWidth(property) { + var key = property.key, + startToken, endToken; + + // [computed]: value + if (property.computed) { + startToken = context.getTokenBefore(key); + endToken = context.getTokenAfter(key); + return endToken.range[1] - startToken.range[0]; + } + + // name: value + if (key.type === "Identifier") { + return key.name.length; + } + + // "literal": value + // 42: value + if (key.type === "Literal") { + return key.raw.length; + } + } + + /** + * Gets the whitespace around the colon in an object literal property. + * @param {ASTNode} property Property node from an object literal. + * @returns {Object} Whitespace before and after the property's colon. + */ + function getPropertyWhitespace(property) { + var whitespace = /(\s*):(\s*)/.exec(context.getSource().slice( + property.key.range[1], property.value.range[0] + )); + + if (whitespace) { + return { + beforeColon: whitespace[1], + afterColon: whitespace[2] + }; + } + } + + /** + * Verifies correct vertical alignment of a group of properties. + * @param {ASTNode[]} properties List of Property AST nodes. + * @returns {void} + */ + function verifyAlignment(properties) { + var length = properties.length, + widths = properties.map(getKeyWidth), // Width of keys, including quotes + targetWidth = Math.max.apply(null, widths), + i, property, whitespace, width; + + // Conditionally include one space before or after colon + targetWidth += (align === "colon" ? beforeColon : afterColon); + + for (i = 0; i < length; i++) { + property = properties[i]; + whitespace = getPropertyWhitespace(property); + + if (!whitespace) { + continue; // Object literal getters/setters lack a colon + } + + width = widths[i]; + + if (align === "value") { + report(property, "key", whitespace.beforeColon, beforeColon); + report(property, "value", whitespace.afterColon, targetWidth - width); + } else { // align = "colon" + report(property, "key", whitespace.beforeColon, targetWidth - width); + report(property, "value", whitespace.afterColon, afterColon); + } + } + } + + if (align) { // Verify vertical alignment + + return { + "ObjectExpression": function(node) { + node.properties.reduce(function(groups, property) { + var currentGroup = last(groups), + prev = last(currentGroup); + + if (!prev || continuesPropertyGroup(prev, property)) { + currentGroup.push(property); + } else { + groups.push([property]); + } + + return groups; + }, [[]]).forEach(function(group) { + verifyAlignment(group); + }); + } + }; + + } else { // Strictly obey beforeColon and afterColon in each property + + return { + "Property": function (node) { + var whitespace = getPropertyWhitespace(node); + if (whitespace) { // Object literal getters/setters lack colons + report(node, "key", whitespace.beforeColon, beforeColon); + report(node, "value", whitespace.afterColon, afterColon); + } + } + }; + + } + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/max-depth.js b/node_modules/standard/node_modules/eslint/lib/rules/max-depth.js new file mode 100644 index 00000000..cc7e3662 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/max-depth.js @@ -0,0 +1,83 @@ +/** + * @fileoverview A rule to set the maximum depth block can be nested in a function. + * @author Ian Christian Myers + * @copyright 2013 Ian Christian Myers. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + var functionStack = [], + maxDepth = context.options[0] || 4; + + function startFunction() { + functionStack.push(0); + } + + function endFunction() { + functionStack.pop(); + } + + function pushBlock(node) { + var len = ++functionStack[functionStack.length - 1]; + + if (len > maxDepth) { + context.report(node, "Blocks are nested too deeply ({{depth}}).", + { depth: len }); + } + } + + function popBlock() { + functionStack[functionStack.length - 1]--; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "Program": startFunction, + "FunctionDeclaration": startFunction, + "FunctionExpression": startFunction, + "ArrowFunctionExpression": startFunction, + + "IfStatement": function(node) { + if (node.parent.type !== "IfStatement") { + pushBlock(node); + } + }, + "SwitchStatement": pushBlock, + "TryStatement": pushBlock, + "DoWhileStatement": pushBlock, + "WhileStatement": pushBlock, + "WithStatement": pushBlock, + "ForStatement": pushBlock, + "ForInStatement": pushBlock, + "ForOfStatement": pushBlock, + + "IfStatement:exit": popBlock, + "SwitchStatement:exit": popBlock, + "TryStatement:exit": popBlock, + "DoWhileStatement:exit": popBlock, + "WhileStatement:exit": popBlock, + "WithStatement:exit": popBlock, + "ForStatement:exit": popBlock, + "ForInStatement:exit": popBlock, + "ForOfStatement:exit": popBlock, + + "FunctionDeclaration:exit": endFunction, + "FunctionExpression:exit": endFunction, + "ArrowFunctionExpression:exit": endFunction, + "Program:exit": endFunction + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/max-len.js b/node_modules/standard/node_modules/eslint/lib/rules/max-len.js new file mode 100644 index 00000000..a36dd73b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/max-len.js @@ -0,0 +1,65 @@ +/** + * @fileoverview Rule to check for max length on a line. + * @author Matt DuVall + * @copyright 2013 Matt DuVall. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Creates a string that is made up of repeating a given string a certain + * number of times. This uses exponentiation of squares to achieve significant + * performance gains over the more traditional implementation of such + * functionality. + * @param {string} str The string to repeat. + * @param {int} num The number of times to repeat the string. + * @returns {string} The created string. + * @private + */ + function stringRepeat(str, num) { + var result = ""; + for (num |= 0; num > 0; num >>>= 1, str += str) { + if (num & 1) { + result += str; + } + } + return result; + } + + var tabWidth = context.options[1]; + + var maxLength = context.options[0], + tabString = stringRepeat(" ", tabWidth); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + function checkProgramForMaxLength(node) { + var lines = context.getSourceLines(); + + // Replace the tabs + // Split (honors line-ending) + // Iterate + lines.forEach(function(line, i) { + if (line.replace(/\t/g, tabString).length > maxLength) { + context.report(node, { line: i + 1, col: 1 }, "Line " + (i + 1) + " exceeds the maximum line length of " + maxLength + "."); + } + }); + } + + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "Program": checkProgramForMaxLength + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/max-nested-callbacks.js b/node_modules/standard/node_modules/eslint/lib/rules/max-nested-callbacks.js new file mode 100644 index 00000000..590274ff --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/max-nested-callbacks.js @@ -0,0 +1,67 @@ +/** + * @fileoverview Rule to enforce a maximum number of nested callbacks. + * @author Ian Christian Myers + * @copyright 2013 Ian Christian Myers. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Constants + //-------------------------------------------------------------------------- + + var THRESHOLD = context.options[0]; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + var callbackStack = []; + + /** + * Checks a given function node for too many callbacks. + * @param {ASTNode} node The node to check. + * @returns {void} + * @private + */ + function checkFunction(node) { + var parent = node.parent; + + if (parent.type === "CallExpression") { + callbackStack.push(node); + } + + if (callbackStack.length > THRESHOLD) { + var opts = {num: callbackStack.length, max: THRESHOLD}; + context.report(node, "Too many nested callbacks ({{num}}). Maximum allowed is {{max}}.", opts); + } + } + + /** + * Pops the call stack. + * @returns {void} + * @private + */ + function popStack() { + callbackStack.pop(); + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "ArrowFunctionExpression": checkFunction, + "ArrowFunctionExpression:exit": popStack, + + "FunctionExpression": checkFunction, + "FunctionExpression:exit": popStack + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/max-params.js b/node_modules/standard/node_modules/eslint/lib/rules/max-params.js new file mode 100644 index 00000000..93154893 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/max-params.js @@ -0,0 +1,39 @@ +/** + * @fileoverview Rule to flag when a function has too many parameters + * @author Ilya Volodin + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2013 Ilya Volodin. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var numParams = context.options[0] || 3; + + /** + * Checks a function to see if it has too many parameters. + * @param {ASTNode} node The node to check. + * @returns {void} + * @private + */ + function checkFunction(node) { + if (node.params.length > numParams) { + context.report(node, "This function has too many parameters ({{count}}). Maximum allowed is {{max}}.", { + count: node.params.length, + max: numParams + }); + } + } + + return { + "FunctionDeclaration": checkFunction, + "ArrowFunctionExpression": checkFunction, + "FunctionExpression": checkFunction + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/max-statements.js b/node_modules/standard/node_modules/eslint/lib/rules/max-statements.js new file mode 100644 index 00000000..9fe11bfd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/max-statements.js @@ -0,0 +1,55 @@ +/** + * @fileoverview A rule to set the maximum number of statements in a function. + * @author Ian Christian Myers + * @copyright 2013 Ian Christian Myers. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + var functionStack = [], + maxStatements = context.options[0] || 10; + + function startFunction() { + functionStack.push(0); + } + + function endFunction(node) { + var count = functionStack.pop(); + + if (count > maxStatements) { + context.report(node, "This function has too many statements ({{count}}). Maximum allowed is {{max}}.", + { count: count, max: maxStatements }); + } + } + + function countStatements(node) { + functionStack[functionStack.length - 1] += node.body.length; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "FunctionDeclaration": startFunction, + "FunctionExpression": startFunction, + "ArrowFunctionExpression": startFunction, + + "BlockStatement": countStatements, + + "FunctionDeclaration:exit": endFunction, + "FunctionExpression:exit": endFunction, + "ArrowFunctionExpression:exit": endFunction + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/new-cap.js b/node_modules/standard/node_modules/eslint/lib/rules/new-cap.js new file mode 100644 index 00000000..1474fc80 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/new-cap.js @@ -0,0 +1,197 @@ +/** + * @fileoverview Rule to flag use of constructors without capital letters + * @author Nicholas C. Zakas + * @copyright 2014 Jordan Harband. All rights reserved. + * @copyright 2013-2014 Nicholas C. Zakas. All rights reserved. + */ + +"use strict"; + +var CAPS_ALLOWED = [ + "Array", + "Boolean", + "Date", + "Error", + "Function", + "Number", + "Object", + "RegExp", + "String", + "Symbol" +]; + +/** + * Ensure that if the key is provided, it must be an array. + * @param {Object} obj Object to check with `key`. + * @param {string} key Object key to check on `obj`. + * @param {*} fallback If obj[key] is not present, this will be returned. + * @returns {string[]} Returns obj[key] if it's an Array, otherwise `fallback` + */ +function checkArray(obj, key, fallback) { + if (Object.prototype.hasOwnProperty.call(obj, key) && !Array.isArray(obj[key])) { + throw new TypeError(key + ", if provided, must be an Array"); + } + return obj[key] || fallback; +} + +/** + * A reducer function to invert an array to an Object mapping the string form of the key, to `true`. + * @param {Object} map Accumulator object for the reduce. + * @param {string} key Object key to set to `true`. + * @returns {Object} Returns the updated Object for further reduction. + */ +function invert(map, key) { + map[key] = true; + return map; +} + +/** + * Creates an object with the cap is new exceptions as its keys and true as their values. + * @param {Object} config Rule configuration + * @returns {Object} Object with cap is new exceptions. + */ +function calculateCapIsNewExceptions(config) { + var capIsNewExceptions = checkArray(config, "capIsNewExceptions", CAPS_ALLOWED); + + if (capIsNewExceptions !== CAPS_ALLOWED) { + capIsNewExceptions = capIsNewExceptions.concat(CAPS_ALLOWED); + } + + return capIsNewExceptions.reduce(invert, {}); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var config = context.options[0] || {}; + config.newIsCap = config.newIsCap === false ? false : true; + config.capIsNew = config.capIsNew === false ? false : true; + + var newIsCapExceptions = checkArray(config, "newIsCapExceptions", []).reduce(invert, {}); + + var capIsNewExceptions = calculateCapIsNewExceptions(config); + + var listeners = {}; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Get exact callee name from expression + * @param {ASTNode} node CallExpression or NewExpression node + * @returns {string} name + */ + function extractNameFromExpression(node) { + + var name = "", + property; + + if (node.callee.type === "MemberExpression") { + property = node.callee.property; + + if (property.type === "Literal" && (typeof property.value === "string")) { + name = property.value; + } else if (property.type === "Identifier" && !node.callee.computed) { + name = property.name; + } + } else { + name = node.callee.name; + } + return name; + } + + /** + * Returns the capitalization state of the string - + * Whether the first character is uppercase, lowercase, or non-alphabetic + * @param {string} str String + * @returns {string} capitalization state: "non-alpha", "lower", or "upper" + */ + function getCap(str) { + var firstChar = str.charAt(0); + + var firstCharLower = firstChar.toLowerCase(); + var firstCharUpper = firstChar.toUpperCase(); + + if (firstCharLower === firstCharUpper) { + // char has no uppercase variant, so it's non-alphabetic + return "non-alpha"; + } else if (firstChar === firstCharLower) { + return "lower"; + } else { + return "upper"; + } + } + + /** + * Check if capitalization is allowed for a CallExpression + * @param {Object} allowedMap Object mapping calleeName to a Boolean + * @param {ASTNode} node CallExpression node + * @param {string} calleeName Capitalized callee name from a CallExpression + * @returns {Boolean} Returns true if the callee may be capitalized + */ + function isCapAllowed(allowedMap, node, calleeName) { + if (allowedMap[calleeName]) { + return true; + } + if (calleeName === "UTC" && node.callee.type === "MemberExpression") { + // allow if callee is Date.UTC + return node.callee.object.type === "Identifier" && + node.callee.object.name === "Date"; + } + return false; + } + + /** + * Reports the given message for the given node. The location will be the start of the property or the callee. + * @param {ASTNode} node CallExpression or NewExpression node. + * @param {string} message The message to report. + * @returns {void} + */ + function report(node, message) { + var callee = node.callee; + + if (callee.type === "MemberExpression") { + callee = callee.property; + } + + context.report(node, callee.loc.start, message); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + if (config.newIsCap) { + listeners.NewExpression = function(node) { + + var constructorName = extractNameFromExpression(node); + if (constructorName) { + var capitalization = getCap(constructorName); + var isAllowed = capitalization !== "lower" || isCapAllowed(newIsCapExceptions, node, constructorName); + if (!isAllowed) { + report(node, "A constructor name should not start with a lowercase letter."); + } + } + }; + } + + if (config.capIsNew) { + listeners.CallExpression = function(node) { + + var calleeName = extractNameFromExpression(node); + if (calleeName) { + var capitalization = getCap(calleeName); + var isAllowed = capitalization !== "upper" || isCapAllowed(capIsNewExceptions, node, calleeName); + if (!isAllowed) { + report(node, "A function with a name starting with an uppercase letter should only be used as a constructor."); + } + } + }; + } + + return listeners; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/new-parens.js b/node_modules/standard/node_modules/eslint/lib/rules/new-parens.js new file mode 100644 index 00000000..adc2f70c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/new-parens.js @@ -0,0 +1,27 @@ +/** + * @fileoverview Rule to flag when using constructor without parentheses + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "NewExpression": function(node) { + var tokens = context.getTokens(node); + var prenticesTokens = tokens.filter(function(token) { + return token.value === "(" || token.value === ")"; + }); + if (prenticesTokens.length < 2) { + context.report(node, "Missing '()' invoking a constructor"); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/newline-after-var.js b/node_modules/standard/node_modules/eslint/lib/rules/newline-after-var.js new file mode 100644 index 00000000..da46e23e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/newline-after-var.js @@ -0,0 +1,45 @@ +/** + * @fileoverview Rule to check empty newline after "var" statement + * @author Gopal Venkatesan + * @copyright 2015 Gopal Venkatesan. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var mode = context.options[0], + validator; // regex to validate the rule + + if (mode === "never") { + validator = /\S(?:\r?\n)?\S/; + } else { // assume mode === "always" + validator = /\S(?:\r?\n){2,}\S?/; + mode = "always"; + } + + return { + "VariableDeclaration:exit": function(node) { + var lastToken = context.getLastToken(node), + nextToken = context.getTokenAfter(node), + // peek few characters beyond the last token (typically the semi-colon) + sourceLines = context.getSource(lastToken, 0, 3); + + // Some coding styles like Google uses multiple `var` statements. + // So if the next token is a `var` statement don't do anything. + if (nextToken && nextToken.type === "Keyword" && + (nextToken.value === "var" || nextToken.value === "let" || nextToken.value === "const")) { + return; + } + + // Next statement is not a `var` + if (sourceLines && !sourceLines.match(validator)) { + context.report(node, "Newline is " + mode + " expected after a \"var\" statement.", + { identifier: node.name }); + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-alert.js b/node_modules/standard/node_modules/eslint/lib/rules/no-alert.js new file mode 100644 index 00000000..1f14b533 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-alert.js @@ -0,0 +1,54 @@ +/** + * @fileoverview Rule to flag use of alert, confirm, prompt + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +function matchProhibited(name) { + return name.match(/^(alert|confirm|prompt)$/); +} + +function report(context, node, result) { + context.report(node, "Unexpected {{name}}.", { name: result[1] }); +} + + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "CallExpression": function(node) { + + var result; + + // without window. + if (node.callee.type === "Identifier") { + + result = matchProhibited(node.callee.name); + + if (result) { + report(context, node, result); + } + + } else if (node.callee.type === "MemberExpression" && node.callee.property.type === "Identifier") { + + result = matchProhibited(node.callee.property.name); + + if (result && node.callee.object.name === "window") { + report(context, node, result); + } + + } + + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-array-constructor.js b/node_modules/standard/node_modules/eslint/lib/rules/no-array-constructor.js new file mode 100644 index 00000000..a37d674c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-array-constructor.js @@ -0,0 +1,29 @@ +/** + * @fileoverview Disallow construction of dense arrays using the Array constructor + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + function check(node) { + if ( + node.arguments.length !== 1 && + node.callee.type === "Identifier" && + node.callee.name === "Array" + ) { + context.report(node, "The array literal notation [] is preferrable."); + } + } + + return { + "CallExpression": check, + "NewExpression": check + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-bitwise.js b/node_modules/standard/node_modules/eslint/lib/rules/no-bitwise.js new file mode 100644 index 00000000..942317f3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-bitwise.js @@ -0,0 +1,55 @@ +/** + * @fileoverview Rule to flag bitwise identifiers + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var BITWISE_OPERATORS = [ + "^", "|", "&", "<<", ">>", ">>>", + "^=", "|=", "&=", "<<=", ">>=", ">>>=", + "~" + ]; + + /** + * Reports an unexpected use of a bitwise operator. + * @param {ASTNode} node Node which contains the bitwise operator. + * @returns {void} + */ + function report(node) { + context.report(node, "Unexpected use of '{{operator}}'.", { operator: node.operator }); + } + + /** + * Checks if the given node has a bitwise operator. + * @param {ASTNode} node The node to check. + * @returns {boolean} Whether or not the node has a bitwise operator. + */ + function hasBitwiseOperator(node) { + return BITWISE_OPERATORS.indexOf(node.operator) !== -1; + } + + /** + * Report if the given node contains a bitwise operator. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkNodeForBitwiseOperator(node) { + if (hasBitwiseOperator(node)) { + report(node); + } + } + + return { + "AssignmentExpression": checkNodeForBitwiseOperator, + "BinaryExpression": checkNodeForBitwiseOperator, + "UnaryExpression": checkNodeForBitwiseOperator + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-caller.js b/node_modules/standard/node_modules/eslint/lib/rules/no-caller.js new file mode 100644 index 00000000..b489d79c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-caller.js @@ -0,0 +1,27 @@ +/** + * @fileoverview Rule to flag use of arguments.callee and arguments.caller. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "MemberExpression": function(node) { + var objectName = node.object.name, + propertyName = node.property.name; + + if (objectName === "arguments" && !node.computed && propertyName && propertyName.match(/^calle[er]$/)) { + context.report(node, "Avoid arguments.{{property}}.", { property: propertyName }); + } + + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-catch-shadow.js b/node_modules/standard/node_modules/eslint/lib/rules/no-catch-shadow.js new file mode 100644 index 00000000..af07c462 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-catch-shadow.js @@ -0,0 +1,50 @@ +/** + * @fileoverview Rule to flag variable leak in CatchClauses in IE 8 and earlier + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + function paramIsShadowing(scope, name) { + var found = scope.variables.some(function(variable) { + return variable.name === name; + }); + + if (found) { + return true; + } + + if (scope.upper) { + return paramIsShadowing(scope.upper, name); + } + + return false; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + "CatchClause": function(node) { + var scope = context.getScope(); + + if (paramIsShadowing(scope, node.param.name)) { + context.report(node, "Value of '{{name}}' may be overwritten in IE 8 and earlier.", + { name: node.param.name }); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-comma-dangle.js b/node_modules/standard/node_modules/eslint/lib/rules/no-comma-dangle.js new file mode 100644 index 00000000..32b2a736 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-comma-dangle.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Rule to flag trailing commas in object literals. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //------------------------------------------------------------------------- + // Helpers + //------------------------------------------------------------------------- + + function checkForTrailingComma(node) { + var items = node.properties || node.elements, + length = items.length, + lastItem, penultimateToken; + + if (length) { + lastItem = items[length - 1]; + if (lastItem) { + penultimateToken = context.getLastToken(node, 1); + if (penultimateToken.value === ",") { + context.report(lastItem, penultimateToken.loc.start, "Trailing comma."); + } + } + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "ObjectExpression": checkForTrailingComma, + "ArrayExpression": checkForTrailingComma + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-cond-assign.js b/node_modules/standard/node_modules/eslint/lib/rules/no-cond-assign.js new file mode 100644 index 00000000..9b00fe4e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-cond-assign.js @@ -0,0 +1,117 @@ +/** + * @fileoverview Rule to flag assignment in a conditional statement's test expression + * @author Stephen Murray + */ +"use strict"; + +var NODE_DESCRIPTIONS = { + "DoWhileStatement": "a 'do...while' statement", + "ForStatement": "a 'for' statement", + "IfStatement": "an 'if' statement", + "WhileStatement": "a 'while' statement" +}; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var prohibitAssign = (context.options[0] || "except-parens"); + + /** + * Check whether an AST node is the test expression for a conditional statement. + * @param {!Object} node The node to test. + * @returns {boolean} `true` if the node is the text expression for a conditional statement; otherwise, `false`. + */ + function isConditionalTestExpression(node) { + return node.parent && + node.parent.test && + node === node.parent.test; + } + + /** + * Given an AST node, perform a bottom-up search for the first ancestor that represents a conditional statement. + * @param {!Object} node The node to use at the start of the search. + * @returns {?Object} The closest ancestor node that represents a conditional statement. + */ + function findConditionalAncestor(node) { + var currentAncestor = node; + + while ((currentAncestor = currentAncestor.parent)) { + if (isConditionalTestExpression(currentAncestor)) { + return currentAncestor.parent; + } + } + + return null; + } + + /** + * Check whether the code represented by an AST node is enclosed in parentheses. + * @param {!Object} node The node to test. + * @returns {boolean} `true` if the code is enclosed in parentheses; otherwise, `false`. + */ + function isParenthesised(node) { + var previousToken = context.getTokenBefore(node), + nextToken = context.getTokenAfter(node); + + return previousToken.value === "(" && previousToken.range[1] <= node.range[0] && + nextToken.value === ")" && nextToken.range[0] >= node.range[1]; + } + + /** + * Check whether the code represented by an AST node is enclosed in two sets of parentheses. + * @param {!Object} node The node to test. + * @returns {boolean} `true` if the code is enclosed in two sets of parentheses; otherwise, `false`. + */ + function isParenthesisedTwice(node) { + var previousToken = context.getTokenBefore(node, 1), + nextToken = context.getTokenAfter(node, 1); + + return isParenthesised(node) && + previousToken.value === "(" && previousToken.range[1] <= node.range[0] && + nextToken.value === ")" && nextToken.range[0] >= node.range[1]; + } + + /** + * Check a conditional statement's test expression for top-level assignments that are not enclosed in parentheses. + * @param {!Object} node The node for the conditional statement. + * @returns {void} + */ + function testForAssign(node) { + if (node.test && (node.test.type === "AssignmentExpression") && !isParenthesisedTwice(node.test)) { + // must match JSHint's error message + context.report(node, "Expected a conditional expression and instead saw an assignment."); + } + } + + /** + * Check whether an assignment expression is descended from a conditional statement's test expression. + * @param {!Object} node The node for the assignment expression. + * @returns {void} + */ + function testForConditionalAncestor(node) { + var ancestor = findConditionalAncestor(node); + + if (ancestor) { + context.report(ancestor, "Unexpected assignment within {{type}}.", { + type: NODE_DESCRIPTIONS[ancestor.type] || ancestor.type + }); + } + } + + if (prohibitAssign === "always") { + return { + "AssignmentExpression": testForConditionalAncestor + }; + } + + return { + "DoWhileStatement": testForAssign, + "ForStatement": testForAssign, + "IfStatement": testForAssign, + "WhileStatement": testForAssign + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-console.js b/node_modules/standard/node_modules/eslint/lib/rules/no-console.js new file mode 100644 index 00000000..929f0004 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-console.js @@ -0,0 +1,25 @@ +/** + * @fileoverview Rule to flag use of console object + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "MemberExpression": function(node) { + + if (node.object.name === "console") { + context.report(node, "Unexpected console statement."); + } + + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-constant-condition.js b/node_modules/standard/node_modules/eslint/lib/rules/no-constant-condition.js new file mode 100644 index 00000000..394a9c9b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-constant-condition.js @@ -0,0 +1,71 @@ +/** + * @fileoverview Rule to flag use constant conditions + * @author Christian Schulz + * @copyright 2014 Christian Schulz. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Checks if a node has a constant truthiness value. + * @param {ASTNode} node The AST node to check. + * @returns {Bool} true when node's truthiness is constant + * @private + */ + function isConstant(node) { + switch (node.type) { + case "Literal": + case "ArrowFunctionExpression": + case "FunctionExpression": + case "ObjectExpression": + case "ArrayExpression": + return true; + case "UnaryExpression": + return isConstant(node.argument); + case "BinaryExpression": + case "LogicalExpression": + return isConstant(node.left) && isConstant(node.right); + case "AssignmentExpression": + return (node.operator === "=") && isConstant(node.right); + case "SequenceExpression": + return isConstant(node.expressions[node.expressions.length - 1]); + // no default + } + return false; + } + + /** + * Reports when the given node contains a constant condition. + * @param {ASTNode} node The AST node to check. + * @returns {void} + * @private + */ + function checkConstantCondition(node) { + if (node.test && isConstant(node.test)) { + context.report(node, "Unexpected constant condition."); + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "ConditionalExpression": checkConstantCondition, + "IfStatement": checkConstantCondition, + "WhileStatement": checkConstantCondition, + "DoWhileStatement": checkConstantCondition, + "ForStatement": checkConstantCondition + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-control-regex.js b/node_modules/standard/node_modules/eslint/lib/rules/no-control-regex.js new file mode 100644 index 00000000..a800acc8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-control-regex.js @@ -0,0 +1,56 @@ +/** + * @fileoverview Rule to forbid control charactes from regular expressions. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + function getRegExp(node) { + + if (node.value instanceof RegExp) { + return node.value; + } else if (typeof node.value === "string") { + + var parent = context.getAncestors().pop(); + if ((parent.type === "NewExpression" || parent.type === "CallExpression") && + parent.callee.type === "Identifier" && parent.callee.name === "RegExp") { + + // there could be an invalid regular expression string + try { + return new RegExp(node.value); + } catch (ex) { + return null; + } + + } + } else { + return null; + } + + } + + + + return { + + "Literal": function(node) { + + var computedValue, + regex = getRegExp(node); + + if (regex) { + computedValue = regex.toString(); + if (/[\x00-\x1f]/.test(computedValue)) { + context.report(node, "Unexpected control character in regular expression."); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-debugger.js b/node_modules/standard/node_modules/eslint/lib/rules/no-debugger.js new file mode 100644 index 00000000..1a9a7e7d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-debugger.js @@ -0,0 +1,20 @@ +/** + * @fileoverview Rule to flag use of a debugger statement + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "DebuggerStatement": function(node) { + context.report(node, "Unexpected 'debugger' statement."); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-delete-var.js b/node_modules/standard/node_modules/eslint/lib/rules/no-delete-var.js new file mode 100644 index 00000000..a863d689 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-delete-var.js @@ -0,0 +1,23 @@ +/** + * @fileoverview Rule to flag when deleting variables + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "UnaryExpression": function(node) { + if (node.operator === "delete" && node.argument.type === "Identifier") { + context.report(node, "Variables should not be deleted."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-div-regex.js b/node_modules/standard/node_modules/eslint/lib/rules/no-div-regex.js new file mode 100644 index 00000000..17347480 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-div-regex.js @@ -0,0 +1,25 @@ +/** + * @fileoverview Rule to check for ambiguous div operator in regexes + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "Literal": function(node) { + var token = context.getFirstToken(node); + + if (token.type === "RegularExpression" && token.value[1] === "=") { + context.report(node, "A regular expression literal can be confused with '/='."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-dupe-args.js b/node_modules/standard/node_modules/eslint/lib/rules/no-dupe-args.js new file mode 100644 index 00000000..458622e5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-dupe-args.js @@ -0,0 +1,83 @@ +/** + * @fileoverview Rule to flag duplicate arguments + * @author Jamund Ferguson + * @copyright 2015 Jamund Ferguson. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines if a given node has duplicate parameters. + * @param {ASTNode} node The node to check. + * @returns {void} + * @private + */ + function checkParams(node) { + var params = {}, + dups = {}; + + + /** + * Marks a given param as either seen or duplicated. + * @param {string} name The name of the param to mark. + * @returns {void} + * @private + */ + function markParam(name) { + if (params.hasOwnProperty(name)) { + dups[name] = 1; + } else { + params[name] = 1; + } + } + + // loop through and find each duplicate param + node.params.forEach(function(param) { + + switch (param.type) { + case "Identifier": + markParam(param.name); + break; + + case "ObjectPattern": + param.properties.forEach(function(property) { + markParam(property.key.name); + }); + break; + + case "ArrayPattern": + param.elements.forEach(function(element) { + markParam(element.name); + }); + break; + + // no default + } + }); + + // log an error for each duplicate (not 2 for each) + Object.keys(dups).forEach(function(currentParam) { + context.report(node, "Duplicate param '{{key}}'.", { key: currentParam }); + }); + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "FunctionDeclaration": checkParams, + "FunctionExpression": checkParams + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-dupe-keys.js b/node_modules/standard/node_modules/eslint/lib/rules/no-dupe-keys.js new file mode 100644 index 00000000..522f6ace --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-dupe-keys.js @@ -0,0 +1,41 @@ +/** + * @fileoverview Rule to flag use of duplicate keys in an object. + * @author Ian Christian Myers + * @copyright 2013 Ian Christian Myers. All rights reserved. + * @copyright 2013 Nicholas C. Zakas. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "ObjectExpression": function(node) { + + // Object that will be a map of properties--safe because we will + // prefix all of the keys. + var nodeProps = Object.create(null); + + node.properties.forEach(function(property) { + var keyName = property.key.name || property.key.value, + key = property.kind + "-" + keyName, + checkProperty = (!property.computed || property.key.type === "Literal"); + + if (checkProperty) { + if (nodeProps[key]) { + context.report(node, "Duplicate key '{{key}}'.", { key: keyName }); + } else { + nodeProps[key] = true; + } + } + }); + + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-duplicate-case.js b/node_modules/standard/node_modules/eslint/lib/rules/no-duplicate-case.js new file mode 100644 index 00000000..89de7174 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-duplicate-case.js @@ -0,0 +1,59 @@ +/** + * @fileoverview Rule to disallow a duplicate case label. + * @author Dieter Oberkofler + * @copyright 2015 Dieter Oberkofler. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Get a hash value for the node + * @param {ASTNode} node The node. + * @returns {string} A hash value for the node. + * @private + */ + function getHash(node) { + if (node.type === "Literal") { + return node.type + typeof node.value + node.value; + } else if (node.type === "Identifier") { + return node.type + typeof node.name + node.name; + } else if (node.type === "MemberExpression") { + return node.type + getHash(node.object) + getHash(node.property); + } + } + + var switchStatement = []; + + return { + + "SwitchStatement": function(/*node*/) { + switchStatement.push({}); + }, + + "SwitchStatement:exit": function(/*node*/) { + switchStatement.pop(); + }, + + "SwitchCase": function(node) { + var currentSwitch = switchStatement[switchStatement.length - 1], + hashValue; + + if (node.test) { + hashValue = getHash(node.test); + if (typeof hashValue !== "undefined" && currentSwitch.hasOwnProperty(hashValue)) { + context.report(node, "Duplicate case label."); + } else { + currentSwitch[hashValue] = true; + } + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-else-return.js b/node_modules/standard/node_modules/eslint/lib/rules/no-else-return.js new file mode 100644 index 00000000..24960953 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-else-return.js @@ -0,0 +1,123 @@ +/** + * @fileoverview Rule to flag `else` after a `return` in `if` + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Display the context report if rule is violated + * + * @param {Node} node The 'else' node + * @returns {void} + */ + function displayReport(node) { + context.report(node, "Unexpected 'else' after 'return'."); + } + + /** + * Check to see if the node is a ReturnStatement + * + * @param {Node} node The node being evaluated + * @returns {boolean} True if node is a return + */ + function checkForReturn(node) { + return node.type === "ReturnStatement"; + } + + /** + * Naive return checking, does not iterate through the whole + * BlockStatement because we make the assumption that the ReturnStatement + * will be the last node in the body of the BlockStatement. + * + * @param {Node} node The consequent/alternate node + * @returns {boolean} True if it has a return + */ + function naiveHasReturn(node) { + if (node.type === "BlockStatement") { + var body = node.body, + lastChildNode = body[body.length - 1]; + + return lastChildNode && checkForReturn(lastChildNode); + } + return checkForReturn(node); + } + + /** + * Check to see if the node is valid for evaluation, + * meaning it has an else and not an else-if + * + * @param {Node} node The node being evaluated + * @returns {boolean} True if the node is valid + */ + function hasElse(node) { + return node.alternate && node.consequent && node.alternate.type !== "IfStatement"; + } + + /** + * If the consequent is an IfStatement, check to see if it has an else + * and both its consequent and alternate path return, meaning this is + * a nested case of rule violation. If-Else not considered currently. + * + * @param {Node} node The consequent node + * @returns {boolean} True if this is a nested rule violation + */ + function checkForIf(node) { + return node.type === "IfStatement" && hasElse(node) && + naiveHasReturn(node.alternate) && naiveHasReturn(node.consequent); + } + + /** + * Check the consequent/body node to make sure it is not + * a ReturnStatement or an IfStatement that returns on both + * code paths. If it is, display the context report. + * + * @param {Node} node The consequent or body node + * @param {Node} alternate The alternate node + * @returns {void} + */ + function checkForReturnOrIf(node, alternate) { + if (checkForReturn(node) || checkForIf(node)) { + displayReport(alternate); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + "IfStatement": function (node) { + // Don't bother finding a ReturnStatement, if there's no `else` + // or if the alternate is also an if (indicating an else if). + if (hasElse(node)) { + var consequent = node.consequent, + alternate = node.alternate; + // If we have a BlockStatement, check each consequent body node. + if (consequent.type === "BlockStatement") { + var body = consequent.body; + body.forEach(function (bodyNode) { + checkForReturnOrIf(bodyNode, alternate); + }); + // If not a block statement, make sure the consequent isn't a ReturnStatement + // or an IfStatement with returns on both paths + } else { + checkForReturnOrIf(consequent, alternate); + } + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-empty-class.js b/node_modules/standard/node_modules/eslint/lib/rules/no-empty-class.js new file mode 100644 index 00000000..009c1446 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-empty-class.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Rule to flag the use of empty character classes in regular expressions + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/* +plain-English description of the following regexp: +0. `^` fix the match at the beginning of the string +1. `\/`: the `/` that begins the regexp +2. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following + 2.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes) + 2.1. `\\.`: an escape sequence + 2.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty +3. `\/` the `/` that ends the regexp +4. `[gimy]*`: optional regexp flags +5. `$`: fix the match at the end of the string +*/ +var regex = /^\/([^\\[]|\\.|\[([^\\\]]|\\.)+\])*\/[gimy]*$/; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "Literal": function(node) { + var token = context.getFirstToken(node); + if (token.type === "RegularExpression" && !regex.test(token.value)) { + context.report(node, "Empty class."); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-empty-label.js b/node_modules/standard/node_modules/eslint/lib/rules/no-empty-label.js new file mode 100644 index 00000000..371c629a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-empty-label.js @@ -0,0 +1,25 @@ +/** + * @fileoverview Rule to flag when label is not used for a loop or switch + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "LabeledStatement": function(node) { + var type = node.body.type; + + if (type !== "ForStatement" && type !== "WhileStatement" && type !== "DoWhileStatement" && type !== "SwitchStatement" && type !== "ForInStatement" && type !== "ForOfStatement") { + context.report(node, "Unexpected label {{l}}", {l: node.label.name}); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-empty.js b/node_modules/standard/node_modules/eslint/lib/rules/no-empty.js new file mode 100644 index 00000000..33df4c4e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-empty.js @@ -0,0 +1,52 @@ +/** + * @fileoverview Rule to flag use of an empty block statement + * @author Nicholas C. Zakas + * @copyright Nicholas C. Zakas. All rights reserved. + * @copyright 2015 Dieter Oberkofler. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "BlockStatement": function(node) { + var parent = node.parent, + parentType = parent.type, + comments, + i; + + // if the body is not empty, we can just return immediately + if (node.body.length !== 0) { + return; + } + + // a function is generally allowed to be empty + if (parentType === "FunctionDeclaration" || parentType === "FunctionExpression" || parentType === "ArrowFunctionExpression") { + return; + } + + // any other block is only allowed to be empty, if it contains an empty comment + comments = context.getComments(node).trailing; + for (i = 0; i < comments.length; i++) { + if (comments[i].value.trim() === "empty") { + return; + } + } + + context.report(node, "Empty block statement."); + }, + + "SwitchStatement": function(node) { + + if (typeof node.cases === "undefined" || node.cases.length === 0) { + context.report(node, "Empty switch statement."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-eq-null.js b/node_modules/standard/node_modules/eslint/lib/rules/no-eq-null.js new file mode 100644 index 00000000..deee40c3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-eq-null.js @@ -0,0 +1,27 @@ +/** + * @fileoverview Rule to flag comparisons to null without a type-checking + * operator. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "BinaryExpression": function(node) { + var badOperator = node.operator === "==" || node.operator === "!="; + + if (node.right.type === "Literal" && node.right.raw === "null" && badOperator || + node.left.type === "Literal" && node.left.raw === "null" && badOperator) { + context.report(node, "Use ‘===’ to compare with ‘null’."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-eval.js b/node_modules/standard/node_modules/eslint/lib/rules/no-eval.js new file mode 100644 index 00000000..8eced727 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-eval.js @@ -0,0 +1,24 @@ +/** + * @fileoverview Rule to flag use of eval() statement + * @author Nicholas C. Zakas + * @copyright 2015 Mathias Schreck. All rights reserved. + * @copyright 2013 Nicholas C. Zakas. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "CallExpression": function(node) { + if (node.callee.name === "eval") { + context.report(node, "eval can be harmful."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-ex-assign.js b/node_modules/standard/node_modules/eslint/lib/rules/no-ex-assign.js new file mode 100644 index 00000000..6ea5a223 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-ex-assign.js @@ -0,0 +1,40 @@ +/** + * @fileoverview Rule to flag assignment of the exception parameter + * @author Stephen Murray + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var catchStack = []; + + return { + + "CatchClause": function(node) { + catchStack.push(node.param.name); + }, + + "CatchClause:exit": function() { + catchStack.pop(); + }, + + "AssignmentExpression": function(node) { + + if (catchStack.length > 0) { + + var exceptionName = catchStack[catchStack.length - 1]; + + if (node.left.name && node.left.name === exceptionName) { + context.report(node, "Do not assign to the exception parameter."); + } + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-extend-native.js b/node_modules/standard/node_modules/eslint/lib/rules/no-extend-native.js new file mode 100644 index 00000000..a600de09 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-extend-native.js @@ -0,0 +1,77 @@ +/** + * @fileoverview Rule to flag adding properties to native object's prototypes. + * @author David Nelson + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var BUILTINS = [ + "Object", "Function", "Array", "String", "Boolean", "Number", "Date", + "RegExp", "Error", "EvalError", "RangeError", "ReferenceError", + "SyntaxError", "TypeError", "URIError" +]; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + // handle the Array.prototype.extra style case + "AssignmentExpression": function(node) { + var lhs = node.left, affectsProto; + + if (lhs.type !== "MemberExpression" || lhs.object.type !== "MemberExpression") { + return; + } + + affectsProto = lhs.object.computed ? + lhs.object.property.type === "Literal" && lhs.object.property.value === "prototype" : + lhs.object.property.name === "prototype"; + + if (!affectsProto) { + return; + } + + BUILTINS.forEach(function(builtin) { + if (lhs.object.object.name === builtin) { + context.report(node, builtin + " prototype is read only, properties should not be added."); + } + }); + }, + + // handle the Object.defineProperty(Array.prototype) case + "CallExpression": function(node) { + + var callee = node.callee, + subject, + object; + + // only worry about Object.defineProperty + if (callee.type === "MemberExpression" && + callee.object.name === "Object" && + callee.property.name === "defineProperty") { + + // verify the object being added to is a native prototype + subject = node.arguments[0]; + object = subject.object; + + if (object && + object.type === "Identifier" && + (BUILTINS.indexOf(object.name) > -1) && + subject.property.name === "prototype") { + + context.report(node, object.name + " prototype is read only, properties should not be added."); + } + } + + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-extra-bind.js b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-bind.js new file mode 100644 index 00000000..b5857306 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-bind.js @@ -0,0 +1,79 @@ +/** + * @fileoverview Rule to flag unnecessary bind calls + * @author Bence Dányi + * @copyright 2014 Bence Dányi. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var scope = [{ + depth: -1, + found: 0 + }]; + + /** + * Get the topmost scope + * @returns {Object} The topmost scope + */ + function getTopScope() { + return scope[scope.length - 1]; + } + + /** + * Increment the depth of the top scope + * @returns {void} + */ + function incrementScopeDepth() { + var top = getTopScope(); + top.depth++; + } + + /** + * Decrement the depth of the top scope + * @returns {void} + */ + function decrementScopeDepth() { + var top = getTopScope(); + top.depth--; + } + + return { + "CallExpression": function(node) { + if (node.arguments.length === 1 && + node.callee.type === "MemberExpression" && + node.callee.property.name === "bind" && + /FunctionExpression$/.test(node.callee.object.type)) { + scope.push({ + call: node, + depth: -1, + found: 0 + }); + } + }, + "CallExpression:exit": function(node) { + var top = getTopScope(); + if (top.call === node && top.found === 0) { + context.report(node, "The function binding is unnecessary."); + scope.pop(); + } + }, + "ArrowFunctionExpression": incrementScopeDepth, + "ArrowFunctionExpression:exit": decrementScopeDepth, + "FunctionExpression": incrementScopeDepth, + "FunctionExpression:exit": decrementScopeDepth, + "FunctionDeclaration": incrementScopeDepth, + "FunctionDeclaration:exit": decrementScopeDepth, + "ThisExpression": function() { + var top = getTopScope(); + if (top.depth === 0) { + top.found++; + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-extra-boolean-cast.js b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-boolean-cast.js new file mode 100644 index 00000000..605d7b12 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-boolean-cast.js @@ -0,0 +1,69 @@ +/** + * @fileoverview Rule to flag unnecessary double negation in Boolean contexts + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "UnaryExpression": function (node) { + var ancestors = context.getAncestors(), + parent = ancestors.pop(), + grandparent = ancestors.pop(); + + // Exit early if it's guaranteed not to match + if (node.operator !== "!" || + parent.type !== "UnaryExpression" || + parent.operator !== "!") { + return; + } + + // if () ... + if (grandparent.type === "IfStatement") { + context.report(node, "Redundant double negation in an if statement condition."); + + // do ... while () + } else if (grandparent.type === "DoWhileStatement") { + context.report(node, "Redundant double negation in a do while loop condition."); + + // while () ... + } else if (grandparent.type === "WhileStatement") { + context.report(node, "Redundant double negation in a while loop condition."); + + // ? ... : ... + } else if ((grandparent.type === "ConditionalExpression" && + parent === grandparent.test)) { + context.report(node, "Redundant double negation in a ternary condition."); + + // for (...; ; ...) ... + } else if ((grandparent.type === "ForStatement" && + parent === grandparent.test)) { + context.report(node, "Redundant double negation in a for loop condition."); + + // ! + } else if ((grandparent.type === "UnaryExpression" && + grandparent.operator === "!")) { + context.report(node, "Redundant multiple negation."); + + // Boolean() + } else if ((grandparent.type === "CallExpression" && + grandparent.callee.type === "Identifier" && + grandparent.callee.name === "Boolean")) { + context.report(node, "Redundant double negation in call to Boolean()."); + + // new Boolean() + } else if ((grandparent.type === "NewExpression" && + grandparent.callee.type === "Identifier" && + grandparent.callee.name === "Boolean")) { + context.report(node, "Redundant double negation in Boolean constructor call."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-extra-parens.js b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-parens.js new file mode 100644 index 00000000..e4903b36 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-parens.js @@ -0,0 +1,293 @@ +/** + * @fileoverview Disallow parenthesesisng higher precedence subexpressions. + * @author Michael Ficarra + * @copyright 2014 Michael Ficarra. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + function isParenthesised(node) { + var previousToken = context.getTokenBefore(node), + nextToken = context.getTokenAfter(node); + + return previousToken && nextToken && + previousToken.value === "(" && previousToken.range[1] <= node.range[0] && + nextToken.value === ")" && nextToken.range[0] >= node.range[1]; + } + + function isParenthesisedTwice(node) { + var previousToken = context.getTokenBefore(node, 1), + nextToken = context.getTokenAfter(node, 1); + + return isParenthesised(node) && previousToken && nextToken && + previousToken.value === "(" && previousToken.range[1] <= node.range[0] && + nextToken.value === ")" && nextToken.range[0] >= node.range[1]; + } + + function precedence(node) { + + switch (node.type) { + case "SequenceExpression": + return 0; + + case "AssignmentExpression": + case "YieldExpression": + return 1; + + case "ConditionalExpression": + return 3; + + case "LogicalExpression": + switch (node.operator) { + case "||": + return 4; + case "&&": + return 5; + // no default + } + + /* falls through */ + case "BinaryExpression": + switch (node.operator) { + case "|": + return 6; + case "^": + return 7; + case "&": + return 8; + case "==": + case "!=": + case "===": + case "!==": + return 9; + case "<": + case "<=": + case ">": + case ">=": + case "in": + case "instanceof": + return 10; + case "<<": + case ">>": + case ">>>": + return 11; + case "+": + case "-": + return 12; + case "*": + case "/": + case "%": + return 13; + // no default + } + /* falls through */ + case "UnaryExpression": + return 14; + case "UpdateExpression": + return 15; + case "CallExpression": + // IIFE is allowed to have parens in any position (#655) + if (node.callee.type === "FunctionExpression") { + return -1; + } + return 16; + case "NewExpression": + return 17; + // no default + } + return 18; + } + + function report(node) { + var previousToken = context.getTokenBefore(node); + context.report(node, previousToken.loc.start, "Gratuitous parentheses around expression."); + } + + function dryUnaryUpdate(node) { + if (isParenthesised(node.argument) && precedence(node.argument) >= precedence(node)) { + report(node.argument); + } + } + + function dryCallNew(node) { + if (isParenthesised(node.callee) && precedence(node.callee) >= precedence(node) && + !(node.type === "CallExpression" && node.callee.type === "FunctionExpression")) { + report(node.callee); + } + if (node.arguments.length === 1) { + if (isParenthesisedTwice(node.arguments[0]) && precedence(node.arguments[0]) >= precedence({type: "AssignmentExpression"})) { + report(node.arguments[0]); + } + } else { + [].forEach.call(node.arguments, function(arg) { + if (isParenthesised(arg) && precedence(arg) >= precedence({type: "AssignmentExpression"})) { + report(arg); + } + }); + } + } + + function dryBinaryLogical(node) { + var prec = precedence(node); + if (isParenthesised(node.left) && precedence(node.left) >= prec) { + report(node.left); + } + if (isParenthesised(node.right) && precedence(node.right) > prec) { + report(node.right); + } + } + + return { + "ArrayExpression": function(node) { + [].forEach.call(node.elements, function(e) { + if (e && isParenthesised(e) && precedence(e) >= precedence({type: "AssignmentExpression"})) { + report(e); + } + }); + }, + "AssignmentExpression": function(node) { + if (isParenthesised(node.right) && precedence(node.right) >= precedence(node)) { + report(node.right); + } + }, + "BinaryExpression": dryBinaryLogical, + "CallExpression": dryCallNew, + "ConditionalExpression": function(node) { + if (isParenthesised(node.test) && precedence(node.test) >= precedence({type: "LogicalExpression", operator: "||"})) { + report(node.test); + } + if (isParenthesised(node.consequent) && precedence(node.consequent) >= precedence({type: "AssignmentExpression"})) { + report(node.consequent); + } + if (isParenthesised(node.alternate) && precedence(node.alternate) >= precedence({type: "AssignmentExpression"})) { + report(node.alternate); + } + }, + "DoWhileStatement": function(node) { + if (isParenthesisedTwice(node.test)) { + report(node.test); + } + }, + "ExpressionStatement": function(node) { + var firstToken; + if (isParenthesised(node.expression)) { + firstToken = context.getFirstToken(node.expression); + if (firstToken.value !== "function" && firstToken.value !== "{") { + report(node.expression); + } + } + }, + "ForInStatement": function(node) { + if (isParenthesised(node.right)) { + report(node.right); + } + }, + "ForOfStatement": function(node) { + if (isParenthesised(node.right)) { + report(node.right); + } + }, + "ForStatement": function(node) { + if (node.init && isParenthesised(node.init)) { + report(node.init); + } + + if (node.test && isParenthesised(node.test)) { + report(node.test); + } + + if (node.update && isParenthesised(node.update)) { + report(node.update); + } + }, + "IfStatement": function(node) { + if (isParenthesisedTwice(node.test)) { + report(node.test); + } + }, + "LogicalExpression": dryBinaryLogical, + "MemberExpression": function(node) { + if ( + isParenthesised(node.object) && + precedence(node.object) >= precedence(node) && + ( + node.computed || + !( + (node.object.type === "Literal" && + typeof node.object.value === "number" && + /^[0-9]+$/.test(context.getFirstToken(node.object).value)) + || + // RegExp literal is allowed to have parens (#1589) + (node.object.type === "Literal" && node.object.regex) + ) + ) + ) { + report(node.object); + } + }, + "NewExpression": dryCallNew, + "ObjectExpression": function(node) { + [].forEach.call(node.properties, function(e) { + var v = e.value; + if (v && isParenthesised(v) && precedence(v) >= precedence({type: "AssignmentExpression"})) { + report(v); + } + }); + }, + "ReturnStatement": function(node) { + if (node.argument && isParenthesised(node.argument) && + // RegExp literal is allowed to have parens (#1589) + !(node.argument.type === "Literal" && node.argument.regex)) { + report(node.argument); + } + }, + "SequenceExpression": function(node) { + [].forEach.call(node.expressions, function(e) { + if (isParenthesised(e) && precedence(e) >= precedence(node)) { + report(e); + } + }); + }, + "SwitchCase": function(node) { + if (node.test && isParenthesised(node.test)) { + report(node.test); + } + }, + "SwitchStatement": function(node) { + if (isParenthesisedTwice(node.discriminant)) { + report(node.discriminant); + } + }, + "ThrowStatement": function(node) { + if (isParenthesised(node.argument)) { + report(node.argument); + } + }, + "UnaryExpression": dryUnaryUpdate, + "UpdateExpression": dryUnaryUpdate, + "VariableDeclarator": function(node) { + if (node.init && isParenthesised(node.init) && + precedence(node.init) >= precedence({type: "AssignmentExpression"}) && + // RegExp literal is allowed to have parens (#1589) + !(node.init.type === "Literal" && node.init.regex)) { + report(node.init); + } + }, + "WhileStatement": function(node) { + if (isParenthesisedTwice(node.test)) { + report(node.test); + } + }, + "WithStatement": function(node) { + if (isParenthesisedTwice(node.object)) { + report(node.object); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-extra-semi.js b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-semi.js new file mode 100644 index 00000000..e155d982 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-semi.js @@ -0,0 +1,21 @@ +/** + * @fileoverview Rule to flag use of unnecessary semicolons + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "EmptyStatement": function(node) { + context.report(node, "Unnecessary semicolon."); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-extra-strict.js b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-strict.js new file mode 100644 index 00000000..4c6ac16a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-extra-strict.js @@ -0,0 +1,84 @@ +/** + * @fileoverview Rule to flag unnecessary strict directives. + * @author Ian Christian Myers + * @copyright 2014 Ian Christian Myers. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + function directives(block) { + var ds = [], body = block.body, e, i, l; + + if (body) { + for (i = 0, l = body.length; i < l; ++i) { + e = body[i]; + + if ( + e.type === "ExpressionStatement" && + e.expression.type === "Literal" && + typeof e.expression.value === "string" + ) { + ds.push(e.expression); + } else { + break; + } + } + } + + return ds; + } + + function isStrict(directive) { + return directive.value === "use strict"; + } + + function checkForUnnecessaryUseStrict(node) { + var useStrictDirectives = directives(node).filter(isStrict), + scope, + upper; + + switch (useStrictDirectives.length) { + case 0: + break; + + case 1: + scope = context.getScope(); + upper = scope.upper; + + if (upper && upper.functionExpressionScope) { + upper = upper.upper; + } + + if (upper && upper.isStrict) { + context.report(useStrictDirectives[0], "Unnecessary 'use strict'."); + } + break; + + default: + context.report(useStrictDirectives[1], "Multiple 'use strict' directives."); + } + } + + return { + + "Program": checkForUnnecessaryUseStrict, + + "ArrowFunctionExpression": function(node) { + checkForUnnecessaryUseStrict(node.body); + }, + + "FunctionExpression": function(node) { + checkForUnnecessaryUseStrict(node.body); + }, + + "FunctionDeclaration": function(node) { + checkForUnnecessaryUseStrict(node.body); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-fallthrough.js b/node_modules/standard/node_modules/eslint/lib/rules/no-fallthrough.js new file mode 100644 index 00000000..a137fb3f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-fallthrough.js @@ -0,0 +1,95 @@ +/** + * @fileoverview Rule to flag fall-through cases in switch statements. + * @author Matt DuVall + */ +"use strict"; + + +var FALLTHROUGH_COMMENT = /falls\sthrough/; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var switches = []; + + return { + + "SwitchCase": function(node) { + + var consequent = node.consequent, + switchData = switches[switches.length - 1], + i, + comments, + comment; + + /* + * Some developers wrap case bodies in blocks, so if there is just one + * node and it's a block statement, check inside. + */ + if (consequent.length === 1 && consequent[0].type === "BlockStatement") { + consequent = consequent[0]; + } + + // checking on previous case + if (!switchData.lastCaseClosed) { + + // a fall through comment will be the last trailing comment of the last case + comments = context.getComments(switchData.lastCase).trailing; + comment = comments[comments.length - 1]; + + // unless the user doesn't like semicolons, in which case it's first leading comment of this case + if (!comment) { + comments = context.getComments(node).leading; + comment = comments[comments.length - 1]; + } + + // check for comment + if (!comment || !FALLTHROUGH_COMMENT.test(comment.value)) { + + context.report(switchData.lastCase, + "Expected a \"break\" statement before \"{{code}}\".", + { code: node.test ? "case" : "default" }); + } + } + + // now dealing with the current case + switchData.lastCaseClosed = false; + switchData.lastCase = node; + + // try to verify using statements - go backwards as a fast path for the search + if (consequent.length) { + for (i = consequent.length - 1; i >= 0; i--) { + if (/(?:Break|Continue|Return|Throw)Statement/.test(consequent[i].type)) { + switchData.lastCaseClosed = true; + break; + } + } + } else { + // the case statement has no statements, so it must logically fall through + switchData.lastCaseClosed = true; + } + + /* + * Any warnings are triggered when the next SwitchCase occurs. + * There is no need to warn on the last SwitchCase, since it can't + * fall through to anything. + */ + }, + + "SwitchStatement": function(node) { + switches.push({ + node: node, + lastCaseClosed: true, + lastCase: null + }); + }, + + "SwitchStatement:exit": function() { + switches.pop(); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-floating-decimal.js b/node_modules/standard/node_modules/eslint/lib/rules/no-floating-decimal.js new file mode 100644 index 00000000..c6380d54 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-floating-decimal.js @@ -0,0 +1,28 @@ +/** + * @fileoverview Rule to flag use of a leading/trailing decimal point in a numeric literal + * @author James Allardice + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "Literal": function(node) { + + if (typeof node.value === "number") { + if (node.raw.indexOf(".") === 0) { + context.report(node, "A leading decimal point can be confused with a dot."); + } + if (node.raw.indexOf(".") === node.raw.length - 1) { + context.report(node, "A trailing decimal point can be confused with a dot."); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-func-assign.js b/node_modules/standard/node_modules/eslint/lib/rules/no-func-assign.js new file mode 100644 index 00000000..a9f28581 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-func-assign.js @@ -0,0 +1,81 @@ +/** + * @fileoverview Rule to flag use of function declaration identifiers as variables. + * @author Ian Christian Myers + * @copyright 2013 Ian Christian Myers. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /* + * Walk the scope chain looking for either a FunctionDeclaration or a + * VariableDeclaration with the same name as left-hand side of the + * AssignmentExpression. If we find the FunctionDeclaration first, then we + * warn, because a FunctionDeclaration is trying to become a Variable or a + * FunctionExpression. If we find a VariableDeclaration first, then we have + * a legitimate shadow variable. + */ + function checkIfIdentifierIsFunction(scope, name) { + var variable, + def, + i, + j; + + // Loop over all of the identifiers available in scope. + for (i = 0; i < scope.variables.length; i++) { + variable = scope.variables[i]; + + // For each identifier, see if it was defined in _this_ scope. + for (j = 0; j < variable.defs.length; j++) { + def = variable.defs[j]; + + // Identifier is a function and was declared in this scope + if (def.type === "FunctionName" && def.name.name === name) { + return true; + } + + // Identifier is a variable and was declared in this scope. This + // is a legitimate shadow variable. + if (def.name && def.name.name === name) { + return false; + } + } + } + + // Check the upper scope. + if (scope.upper) { + return checkIfIdentifierIsFunction(scope.upper, name); + } + + // We've reached the global scope and haven't found anything. + return false; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + "AssignmentExpression": function(node) { + var scope = context.getScope(), + name = node.left.name; + + if (checkIfIdentifierIsFunction(scope, name)) { + context.report(node, "'{{name}}' is a function.", { name: name }); + } + + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-implied-eval.js b/node_modules/standard/node_modules/eslint/lib/rules/no-implied-eval.js new file mode 100644 index 00000000..f798dcda --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-implied-eval.js @@ -0,0 +1,74 @@ +/** + * @fileoverview Rule to flag use of implied eval via setTimeout and setInterval + * @author James Allardice + * @copyright 2015 Mathias Schreck. All rights reserved. + * @copyright 2013 James Allardice. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var IMPLIED_EVAL = /set(?:Timeout|Interval)/; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Checks if the first argument of a given CallExpression node is a string literal. + * @param {ASTNode} node The CallExpression node the check. + * @returns {boolean} True if the first argument is a string literal, false if not. + */ + function hasStringLiteralArgument(node) { + var firstArgument = node.arguments[0]; + + return firstArgument && firstArgument.type === "Literal" && typeof firstArgument.value === "string"; + } + + /** + * Checks if the given MemberExpression node is window.setTimeout or window.setInterval. + * @param {ASTNode} node The MemberExpression node to check. + * @returns {boolean} Whether or not the given node is window.set*. + */ + function isSetMemberExpression(node) { + var object = node.object, + property = node.property, + hasSetPropertyName = IMPLIED_EVAL.test(property.name) || IMPLIED_EVAL.test(property.value); + + return object.name === "window" && hasSetPropertyName; + + } + + /** + * Determines if a node represents a call to setTimeout/setInterval with + * a string argument. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node matches, false if not. + * @private + */ + function isImpliedEval(node) { + var isMemberExpression = (node.callee.type === "MemberExpression"), + isIdentifier = (node.callee.type === "Identifier"), + isSetMethod = (isIdentifier && IMPLIED_EVAL.test(node.callee.name)) || + (isMemberExpression && isSetMemberExpression(node.callee)); + + return isSetMethod && hasStringLiteralArgument(node); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "CallExpression": function(node) { + if (isImpliedEval(node)) { + context.report(node, "Implied eval. Consider passing a function instead of a string."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-inline-comments.js b/node_modules/standard/node_modules/eslint/lib/rules/no-inline-comments.js new file mode 100644 index 00000000..091ad9be --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-inline-comments.js @@ -0,0 +1,47 @@ +/** + * @fileoverview Enforces or disallows inline comments. + * @author Greg Cochard + * @copyright 2014 Greg Cochard. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Will check that comments are not on lines starting with or ending with code + * @param {ASTNode} node The comment node to check + * @private + * @returns {void} + */ + function testCodeAroundComment(node) { + + // Get the whole line and cut it off at the start of the comment + var startLine = String(context.getSourceLines()[node.loc.start.line - 1]); + var endLine = String(context.getSourceLines()[node.loc.end.line - 1]); + + var preamble = startLine.slice(0, node.loc.start.column).trim(); + + // Also check after the comment + var postamble = endLine.slice(node.loc.end.column).trim(); + + // Should be empty if there was only whitespace around the comment + if (preamble || postamble) { + context.report(node, "Unexpected comment inline with code."); + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "LineComment": testCodeAroundComment, + "BlockComment": testCodeAroundComment + + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-inner-declarations.js b/node_modules/standard/node_modules/eslint/lib/rules/no-inner-declarations.js new file mode 100644 index 00000000..664639d5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-inner-declarations.js @@ -0,0 +1,72 @@ +/** + * @fileoverview Rule to enforce declarations in program or function body root. + * @author Brandon Mills + * @copyright 2014 Brandon Mills. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Find the nearest Program or Function ancestor node. + * @returns {Object} Ancestor's type and distance from node. + */ + function nearestBody() { + var ancestors = context.getAncestors(), + ancestor = ancestors.pop(), + generation = 1; + + while (ancestor && ["Program", "FunctionDeclaration", + "FunctionExpression", "ArrowFunctionExpression" + ].indexOf(ancestor.type) < 0) { + generation += 1; + ancestor = ancestors.pop(); + } + + return { + // Type of containing ancestor + type: ancestor.type, + // Separation between ancestor and node + distance: generation + }; + } + + /** + * Ensure that a given node is at a program or function body's root. + * @param {ASTNode} node Declaration node to check. + * @returns {void} + */ + function check(node) { + var body = nearestBody(node), + valid = ((body.type === "Program" && body.distance === 1) || + body.distance === 2); + + if (!valid) { + context.report(node, "Move {{type}} declaration to {{body}} root.", + { + type: (node.type === "FunctionDeclaration" ? + "function" : "variable"), + body: (body.type === "Program" ? + "program" : "function body") + } + ); + } + } + + return { + + "FunctionDeclaration": check, + "VariableDeclaration": function(node) { + if (context.options[0] === "both" && node.kind === "var") { + check(node); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-invalid-regexp.js b/node_modules/standard/node_modules/eslint/lib/rules/no-invalid-regexp.js new file mode 100644 index 00000000..cea5372f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-invalid-regexp.js @@ -0,0 +1,51 @@ +/** + * @fileoverview Validate strings passed to the RegExp constructor + * @author Michael Ficarra + * @copyright 2014 Michael Ficarra. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var espree = require("espree"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + function isString(node) { + return node && node.type === "Literal" && typeof node.value === "string"; + } + + function check(node) { + if (node.callee.type === "Identifier" && node.callee.name === "RegExp" && isString(node.arguments[0])) { + var flags = isString(node.arguments[1]) ? node.arguments[1].value : ""; + + try { + void new RegExp(node.arguments[0].value); + } catch(e) { + context.report(node, e.message); + } + + if (flags) { + + try { + espree.parse("/./" + flags, { ecmaFeatures: context.ecmaFeatures }); + } catch (ex) { + context.report(node, "Invalid flags supplied to RegExp constructor '" + flags + "'"); + } + } + + } + } + + return { + "CallExpression": check, + "NewExpression": check + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-irregular-whitespace.js b/node_modules/standard/node_modules/eslint/lib/rules/no-irregular-whitespace.js new file mode 100644 index 00000000..3599f0ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-irregular-whitespace.js @@ -0,0 +1,92 @@ +/** + * @fileoverview Rule to disalow whitespace that is not a tab or space, whitespace inside strings and comments are allowed + * @author Jonathan Kingston + * @copyright 2014 Jonathan Kingston. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var irregularWhitespace = /[\u0085\u00A0\ufeff\f\v\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000]+/mg; + + // Module store of errors that we have found + var errors = []; + + /** + * Removes errors that occur inside a string node + * @param {ASTNode} node to check for matching errors. + * @returns {void} + * @private + */ + function removeStringError(node) { + var locStart = node.loc.start; + var locEnd = node.loc.end; + + errors = errors.filter(function (error) { + var errorLoc = error[1]; + if (errorLoc.line >= locStart.line && errorLoc.line <= locEnd.line) { + if (errorLoc.column >= locStart.column && errorLoc.column <= locEnd.column) { + return false; + } + } + return true; + }); + } + + /** + * Checks nodes for errors that we are choosing to ignore and calls the relevent methods to remove the errors + * @param {ASTNode} node to check for matching errors. + * @returns {void} + * @private + */ + function removeInvalidNodeErrors(node) { + if (typeof node.value === "string") { + // If we have irregular characters remove them from the errors list + if (node.value.match(irregularWhitespace)) { + removeStringError(node); + } + } + } + + return { + "Program": function (node) { + /** + * As we can easily fire warnings for all white space issues with all the source its simpler to fire them here + * This means we can check all the application code without having to worry about issues caused in the parser tokens + * When writing this code also evaluating per node was missing out connecting tokens in some cases + * We can later filter the errors when they are found to be not an issue in nodes we don't care about + */ + var sourceLines = context.getSourceLines(); + + sourceLines.forEach(function (sourceLine, lineIndex) { + var location, + match = irregularWhitespace.exec(sourceLine); + + if (match !== null) { + location = { + line: lineIndex + 1, + column: match.index + }; + + errors.push([node, location, "Irregular whitespace not allowed"]); + } + }); + }, + "Identifier": removeInvalidNodeErrors, + "Literal": removeInvalidNodeErrors, + "Statement": removeInvalidNodeErrors, + "Expression": removeInvalidNodeErrors, + "Program:exit": function () { + + // If we have any errors remaining report on them + errors.forEach(function (error) { + context.report.apply(this, error); + }); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-iterator.js b/node_modules/standard/node_modules/eslint/lib/rules/no-iterator.js new file mode 100644 index 00000000..564c09ab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-iterator.js @@ -0,0 +1,26 @@ +/** + * @fileoverview Rule to flag usage of __iterator__ property + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "MemberExpression": function(node) { + + if (node.property && + (node.property.type === "Identifier" && node.property.name === "__iterator__" && !node.computed) || + (node.property.type === "Literal" && node.property.value === "__iterator__")) { + context.report(node, "Reserved name '__iterator__'."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-label-var.js b/node_modules/standard/node_modules/eslint/lib/rules/no-label-var.js new file mode 100644 index 00000000..b82bd0af --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-label-var.js @@ -0,0 +1,62 @@ +/** + * @fileoverview Rule to flag labels that are the same as an identifier + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + function findIdentifier(scope, identifier) { + var found = false; + + scope.variables.forEach(function(variable) { + if (variable.name === identifier) { + found = true; + } + }); + + scope.references.forEach(function(reference) { + if (reference.identifier.name === identifier) { + found = true; + } + }); + + // If we have not found the identifier in this scope, check the parent + // scope. + if (scope.upper && !found) { + return findIdentifier(scope.upper, identifier); + } + + return found; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + "LabeledStatement": function(node) { + + // Fetch the innermost scope. + var scope = context.getScope(); + + // Recursively find the identifier walking up the scope, starting + // with the innermost scope. + if (findIdentifier(scope, node.label.name)) { + context.report(node, "Found identifier with same name as label."); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-labels.js b/node_modules/standard/node_modules/eslint/lib/rules/no-labels.js new file mode 100644 index 00000000..8b5086a2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-labels.js @@ -0,0 +1,42 @@ +/** + * @fileoverview Disallow Labeled Statements + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "LabeledStatement": function(node) { + context.report(node, "Unexpected labeled statement."); + }, + + "BreakStatement": function(node) { + + if (node.label) { + context.report(node, "Unexpected label in break statement."); + } + + }, + + "ContinueStatement": function(node) { + + if (node.label) { + context.report(node, "Unexpected label in continue statement."); + } + + } + + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-lone-blocks.js b/node_modules/standard/node_modules/eslint/lib/rules/no-lone-blocks.js new file mode 100644 index 00000000..25d8c34f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-lone-blocks.js @@ -0,0 +1,25 @@ +/** + * @fileoverview Rule to flag blocks with no reason to exist + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "BlockStatement": function (node) { + // Check for any occurrence of BlockStatement > BlockStatement or + // Program > BlockStatement + var parent = context.getAncestors().pop(); + if (parent.type === "BlockStatement" || parent.type === "Program") { + context.report(node, "Block is nested inside another block."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-lonely-if.js b/node_modules/standard/node_modules/eslint/lib/rules/no-lonely-if.js new file mode 100644 index 00000000..59d807da --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-lonely-if.js @@ -0,0 +1,28 @@ +/** + * @fileoverview Rule to disallow if as the only statmenet in an else block + * @author Brandon Mills + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "IfStatement": function(node) { + var ancestors = context.getAncestors(), + parent = ancestors.pop(), + grandparent = ancestors.pop(); + + if (parent && parent.type === "BlockStatement" && + parent.body.length === 1 && grandparent && + grandparent.type === "IfStatement" && + parent === grandparent.alternate) { + context.report(node, "Unexpected if as the only statement in an else block."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-loop-func.js b/node_modules/standard/node_modules/eslint/lib/rules/no-loop-func.js new file mode 100644 index 00000000..ec68611b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-loop-func.js @@ -0,0 +1,49 @@ +/** + * @fileoverview Rule to flag creation of function inside a loop + * @author Ilya Volodin + * @copyright 2013 Ilya Volodin. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var loopNodeTypes = [ + "ForStatement", + "WhileStatement", + "ForInStatement", + "ForOfStatement", + "DoWhileStatement" + ]; + + /** + * Checks if the given node is a loop. + * @param {ASTNode} node The AST node to check. + * @returns {boolean} Whether or not the node is a loop. + */ + function isLoop(node) { + return loopNodeTypes.indexOf(node.type) > -1; + } + + /** + * Reports if the given node has an ancestor node which is a loop. + * @param {ASTNode} node The AST node to check. + * @returns {boolean} Whether or not the node is within a loop. + */ + function checkForLoops(node) { + var ancestors = context.getAncestors(); + + if (ancestors.some(isLoop)) { + context.report(node, "Don't make functions within a loop"); + } + } + + return { + "ArrowFunctionExpression": checkForLoops, + "FunctionExpression": checkForLoops, + "FunctionDeclaration": checkForLoops + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-mixed-requires.js b/node_modules/standard/node_modules/eslint/lib/rules/no-mixed-requires.js new file mode 100644 index 00000000..de7c4244 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-mixed-requires.js @@ -0,0 +1,159 @@ +/** + * @fileoverview Rule to enforce grouped require statements for Node.JS + * @author Raphael Pigulla + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Returns the list of built-in modules. + * + * @returns {string[]} An array of built-in Node.js modules. + */ + function getBuiltinModules() { + // This list is generated using `require("repl")._builtinLibs.concat('repl').sort()` + // This particular list was generated using node v0.11.9 + return [ + "assert", "buffer", "child_process", "cluster", "crypto", + "dgram", "dns", "domain", "events", "fs", "http", "https", + "net", "os", "path", "punycode", "querystring", "readline", + "repl", "smalloc", "stream", "string_decoder", "tls", "tty", + "url", "util", "vm", "zlib" + ]; + } + + var BUILTIN_MODULES = getBuiltinModules(); + + var DECL_REQUIRE = "require", + DECL_UNINITIALIZED = "uninitialized", + DECL_OTHER = "other"; + + var REQ_CORE = "core", + REQ_FILE = "file", + REQ_MODULE = "module", + REQ_COMPUTED = "computed"; + + /** + * Determines the type of a declaration statement. + * @param {ASTNode} initExpression The init node of the VariableDeclarator. + * @returns {string} The type of declaration represented by the expression. + */ + function getDeclarationType(initExpression) { + if (!initExpression) { + // "var x;" + return DECL_UNINITIALIZED; + } + + if (initExpression.type === "CallExpression" && + initExpression.callee.type === "Identifier" && + initExpression.callee.name === "require" + ) { + // "var x = require('util');" + return DECL_REQUIRE; + } else if (initExpression.type === "MemberExpression") { + // "var x = require('glob').Glob;" + return getDeclarationType(initExpression.object); + } + + // "var x = 42;" + return DECL_OTHER; + } + + /** + * Determines the type of module that is loaded via require. + * @param {ASTNode} initExpression The init node of the VariableDeclarator. + * @returns {string} The module type. + */ + function inferModuleType(initExpression) { + if (initExpression.type === "MemberExpression") { + // "var x = require('glob').Glob;" + return inferModuleType(initExpression.object); + } else if (initExpression.arguments.length === 0) { + // "var x = require();" + return REQ_COMPUTED; + } + + var arg = initExpression.arguments[0]; + + if (arg.type !== "Literal" || typeof arg.value !== "string") { + // "var x = require(42);" + return REQ_COMPUTED; + } + + if (BUILTIN_MODULES.indexOf(arg.value) !== -1) { + // "var fs = require('fs');" + return REQ_CORE; + } else if (/^\.{0,2}\//.test(arg.value)) { + // "var utils = require('./utils');" + return REQ_FILE; + } else { + // "var async = require('async');" + return REQ_MODULE; + } + } + + /** + * Check if the list of variable declarations is mixed, i.e. whether it + * contains both require and other declarations. + * @param {ASTNode} declarations The list of VariableDeclarators. + * @returns {boolean} True if the declarations are mixed, false if not. + */ + function isMixed(declarations) { + var contains = {}; + + declarations.forEach(function (declaration) { + var type = getDeclarationType(declaration.init); + contains[type] = true; + }); + + return !!( + contains[DECL_REQUIRE] && + (contains[DECL_UNINITIALIZED] || contains[DECL_OTHER]) + ); + } + + /** + * Check if all require declarations in the given list are of the same + * type. + * @param {ASTNode} declarations The list of VariableDeclarators. + * @returns {boolean} True if the declarations are grouped, false if not. + */ + function isGrouped(declarations) { + var found = {}; + + declarations.forEach(function (declaration) { + if (getDeclarationType(declaration.init) === DECL_REQUIRE) { + found[inferModuleType(declaration.init)] = true; + } + }); + + return Object.keys(found).length <= 1; + } + + + return { + + "VariableDeclaration": function(node) { + var grouping = !!context.options[0]; + + if (isMixed(node.declarations)) { + context.report( + node, + "Do not mix 'require' and other declarations." + ); + } else if (grouping && !isGrouped(node.declarations)) { + context.report( + node, + "Do not mix core, module, file and computed requires." + ); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js b/node_modules/standard/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js new file mode 100644 index 00000000..7b76d76d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js @@ -0,0 +1,68 @@ +/** + * @fileoverview Disallow mixed spaces and tabs for indentation + * @author Jary Niebur + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2014 Jary Niebur. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var smartTabs; + + switch (context.options[0]) { + case true: // Support old syntax, maybe add deprecation warning here + case "smart-tabs": + smartTabs = true; + break; + default: + smartTabs = false; + } + + var COMMENT_START = /^\s*\/\*/, + MAYBE_COMMENT = /^\s*\*/; + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "Program": function(node) { + /* + * At least one space followed by a tab + * or the reverse before non-tab/-space + * characters begin. + */ + var regex = /^(?=[\t ]*(\t | \t))/, + match, + lines = context.getSourceLines(); + + if (smartTabs) { + /* + * At least one space followed by a tab + * before non-tab/-space characters begin. + */ + regex = /^(?=[\t ]* \t)/; + } + + lines.forEach(function(line, i) { + match = regex.exec(line); + + if (match) { + + if (!MAYBE_COMMENT.test(line) && !COMMENT_START.test(lines[i - 1])) { + context.report(node, { line: i + 1, column: match.index + 1 }, "Mixed spaces and tabs."); + } + + } + }); + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-multi-spaces.js b/node_modules/standard/node_modules/eslint/lib/rules/no-multi-spaces.js new file mode 100644 index 00000000..9e247c15 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-multi-spaces.js @@ -0,0 +1,101 @@ +/** + * @fileoverview Disallow use of multiple spaces. + * @author Nicholas C. Zakas + * @copyright 2015 Brandon Mills. All rights reserved. + * @copyright 2015 Nicholas C. Zakas. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + // the index of the last comment that was checked + var exceptions = { "Property": true }, + hasExceptions = true, + options = context.options[0], + lastCommentIndex = 0; + + if (options && options.exceptions) { + Object.keys(options.exceptions).forEach(function (key) { + if (options.exceptions[key]) { + exceptions[key] = true; + } else { + delete exceptions[key]; + } + }); + hasExceptions = Object.keys(exceptions).length > 0; + } + + /** + * Determines if a given source index is in a comment or not by checking + * the index against the comment range. Since the check goes straight + * through the file, once an index is passed a certain comment, we can + * go to the next comment to check that. + * @param {int} index The source index to check. + * @param {ASTNode[]} comments An array of comment nodes. + * @returns {boolean} True if the index is within a comment, false if not. + * @private + */ + function isIndexInComment(index, comments) { + + var comment; + + while (lastCommentIndex < comments.length) { + + comment = comments[lastCommentIndex]; + + if (comment.range[0] <= index && index < comment.range[1]) { + return true; + } else if (index > comment.range[1]) { + lastCommentIndex++; + } else { + break; + } + + } + + return false; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "Program": function() { + + var source = context.getSource(), + allComments = context.getAllComments(), + pattern = /[^\n\r\u2028\u2029 ] {2,}/g, // note: repeating space + token, + parent; + + while (pattern.test(source)) { + + // do not flag anything inside of comments + if (!isIndexInComment(pattern.lastIndex, allComments)) { + + token = context.getTokenByRangeStart(pattern.lastIndex); + + if (token) { + if (hasExceptions) { + parent = context.getNodeByRangeIndex(pattern.lastIndex - 1); + } + + if (!parent || !exceptions[parent.type]) { + context.report(token, token.loc.start, + "Multiple spaces found before '{{value}}'.", + { value: token.value }); + } + } + + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-multi-str.js b/node_modules/standard/node_modules/eslint/lib/rules/no-multi-str.js new file mode 100644 index 00000000..1d4810b9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-multi-str.js @@ -0,0 +1,41 @@ +/** + * @fileoverview Rule to flag when using multiline strings + * @author Ilya Volodin + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2013 Ilya Volodin. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Determines if a given node is part of JSX syntax. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node is a JSX node, false if not. + * @private + */ + function isJSXElement(node) { + return node.type.indexOf("JSX") === 0; + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + "Literal": function(node) { + var lineBreak = /\n/; + + if (lineBreak.test(node.raw) && !isJSXElement(node.parent)) { + context.report(node, "Multiline support is limited to browsers supporting ES5 only."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-multiple-empty-lines.js b/node_modules/standard/node_modules/eslint/lib/rules/no-multiple-empty-lines.js new file mode 100644 index 00000000..9cfea63d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-multiple-empty-lines.js @@ -0,0 +1,60 @@ +/** + * @fileoverview Disallows multiple blank lines. + * implementation adapted from the no-trailing-spaces rule. + * @author Greg Cochard + * @copyright 2014 Greg Cochard. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + // Use options.max or 2 as default + var numLines = 2; + + if (context.options.length) { + numLines = context.options[0].max; + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "Program": function checkBlankLines(node) { + var lines = context.getSourceLines(), + currentLocation = -1, + lastLocation, + blankCounter = 0, + location, + trimmedLines = lines.map(function(str) { + return str.trim(); + }); + + // Aggregate and count blank lines + do { + lastLocation = currentLocation; + currentLocation = trimmedLines.indexOf("", currentLocation + 1); + if (lastLocation === currentLocation - 1) { + blankCounter++; + } else { + if (blankCounter >= numLines) { + location = { + line: lastLocation + 1, + column: lines[lastLocation].length + }; + context.report(node, location, "Multiple blank lines not allowed."); + } + + // Finally, reset the blank counter + blankCounter = 0; + } + } while (currentLocation !== -1); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-native-reassign.js b/node_modules/standard/node_modules/eslint/lib/rules/no-native-reassign.js new file mode 100644 index 00000000..29ff4a38 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-native-reassign.js @@ -0,0 +1,37 @@ +/** + * @fileoverview Rule to flag when re-assigning native objects + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var nativeObjects = ["Array", "Boolean", "Date", "decodeURI", + "decodeURIComponent", "encodeURI", "encodeURIComponent", + "Error", "eval", "EvalError", "Function", "isFinite", + "isNaN", "JSON", "Math", "Number", "Object", "parseInt", + "parseFloat", "RangeError", "ReferenceError", "RegExp", + "String", "SyntaxError", "TypeError", "URIError", + "Map", "NaN", "Set", "WeakMap", "Infinity", "undefined"]; + + return { + + "AssignmentExpression": function(node) { + if (nativeObjects.indexOf(node.left.name) >= 0) { + context.report(node, node.left.name + " is a read-only native object."); + } + }, + + "VariableDeclarator": function(node) { + if (nativeObjects.indexOf(node.id.name) >= 0) { + context.report(node, "Redefinition of '{{nativeObject}}'.", { nativeObject: node.id.name }); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-negated-in-lhs.js b/node_modules/standard/node_modules/eslint/lib/rules/no-negated-in-lhs.js new file mode 100644 index 00000000..75bdf731 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-negated-in-lhs.js @@ -0,0 +1,23 @@ +/** + * @fileoverview A rule to disallow negated left operands of the `in` operator + * @author Michael Ficarra + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "BinaryExpression": function(node) { + if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") { + context.report(node, "The `in` expression's left operand is negated"); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-nested-ternary.js b/node_modules/standard/node_modules/eslint/lib/rules/no-nested-ternary.js new file mode 100644 index 00000000..10b0683f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-nested-ternary.js @@ -0,0 +1,22 @@ +/** + * @fileoverview Rule to flag nested ternary expressions + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "ConditionalExpression": function(node) { + if (node.alternate.type === "ConditionalExpression" || + node.consequent.type === "ConditionalExpression") { + context.report(node, "Do not nest ternary expressions"); + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-new-func.js b/node_modules/standard/node_modules/eslint/lib/rules/no-new-func.js new file mode 100644 index 00000000..c0e64350 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-new-func.js @@ -0,0 +1,23 @@ +/** + * @fileoverview Rule to flag when using new Function + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "NewExpression": function(node) { + if (node.callee.name === "Function") { + context.report(node, "The Function constructor is eval."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-new-object.js b/node_modules/standard/node_modules/eslint/lib/rules/no-new-object.js new file mode 100644 index 00000000..426d7129 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-new-object.js @@ -0,0 +1,23 @@ +/** + * @fileoverview A rule to disallow calls to the Object constructor + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "NewExpression": function(node) { + if (node.callee.name === "Object") { + context.report(node, "The object literal notation {} is preferrable."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-new-require.js b/node_modules/standard/node_modules/eslint/lib/rules/no-new-require.js new file mode 100644 index 00000000..27d25d22 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-new-require.js @@ -0,0 +1,23 @@ +/** + * @fileoverview Rule to disallow use of new operator with the `require` function + * @author Wil Moore III + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "NewExpression": function(node) { + if (node.callee.type === "Identifier" && node.callee.name === "require") { + context.report(node, "Unexpected use of new with require."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-new-wrappers.js b/node_modules/standard/node_modules/eslint/lib/rules/no-new-wrappers.js new file mode 100644 index 00000000..4dbc60d5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-new-wrappers.js @@ -0,0 +1,24 @@ +/** + * @fileoverview Rule to flag when using constructor for wrapper objects + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "NewExpression": function(node) { + var wrapperObjects = ["String", "Number", "Boolean", "Math", "JSON"]; + if (wrapperObjects.indexOf(node.callee.name) > -1) { + context.report(node, "Do not use {{fn}} as a constructor.", { fn: node.callee.name }); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-new.js b/node_modules/standard/node_modules/eslint/lib/rules/no-new.js new file mode 100644 index 00000000..914a6493 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-new.js @@ -0,0 +1,25 @@ +/** + * @fileoverview Rule to flag statements with function invocation preceded by + * "new" and not part of assignment + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "ExpressionStatement": function(node) { + + if (node.expression.type === "NewExpression") { + context.report(node, "Do not use 'new' for side effects."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-obj-calls.js b/node_modules/standard/node_modules/eslint/lib/rules/no-obj-calls.js new file mode 100644 index 00000000..246720c2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-obj-calls.js @@ -0,0 +1,26 @@ +/** + * @fileoverview Rule to flag use of an object property of the global object (Math and JSON) as a function + * @author James Allardice + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "CallExpression": function(node) { + + if (node.callee.type === "Identifier") { + var name = node.callee.name; + if (name === "Math" || name === "JSON") { + context.report(node, "'{{name}}' is not a function.", { name: name }); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-octal-escape.js b/node_modules/standard/node_modules/eslint/lib/rules/no-octal-escape.js new file mode 100644 index 00000000..d6c75a86 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-octal-escape.js @@ -0,0 +1,37 @@ +/** + * @fileoverview Rule to flag octal escape sequences in string literals. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "Literal": function(node) { + if (typeof node.value !== "string") { + return; + } + + var match = node.raw.match(/^([^\\]|\\[^0-7])*\\([0-3][0-7]{1,2}|[4-7][0-7]|[0-7])/), + octalDigit; + + if (match) { + octalDigit = match[2]; + + // \0 is actually not considered an octal + if (match[2] !== "0" || typeof match[3] !== "undefined") { + context.report(node, "Don't use octal: '\\{{octalDigit}}'. Use '\\u....' instead.", + { octalDigit: octalDigit }); + } + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-octal.js b/node_modules/standard/node_modules/eslint/lib/rules/no-octal.js new file mode 100644 index 00000000..dae4f7fe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-octal.js @@ -0,0 +1,23 @@ +/** + * @fileoverview Rule to flag when initializing octal literal + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "Literal": function(node) { + if (typeof node.value === "number" && /^0[0-7]/.test(node.raw)) { + context.report(node, "Octal literals should not be used."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-param-reassign.js b/node_modules/standard/node_modules/eslint/lib/rules/no-param-reassign.js new file mode 100644 index 00000000..c38f0ef6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-param-reassign.js @@ -0,0 +1,85 @@ +/** + * @fileoverview Disallow reassignment of function parameters. + * @author Nat Burns + * @copyright 2014 Nat Burns. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Finds the declaration for a given variable by name, searching up the scope tree. + * @param {Scope} scope The scope in which to search. + * @param {String} name The name of the variable. + * @returns {Variable} The declaration information for the given variable, or null if no declaration was found. + */ + function findDeclaration(scope, name) { + var variables = scope.variables; + + for (var i = 0; i < variables.length; i++) { + if (variables[i].name === name) { + return variables[i]; + } + } + + if (scope.upper) { + return findDeclaration(scope.upper, name); + } else { + return null; + } + } + + /** + * Determines if a given variable is declared as a function parameter. + * @param {Variable} variable The variable declaration. + * @returns {boolean} True if the variable is a function parameter, false otherwise. + */ + function isParameter(variable) { + var defs = variable.defs; + + for (var i = 0; i < defs.length; i++) { + if (defs[i].type === "Parameter") { + return true; + } + } + + return false; + } + + /** + * Checks whether a given node is an assignment to a function parameter. + * If so, a linting error will be reported. + * @param {ASTNode} node The node to check. + * @param {String} name The name of the variable being assigned to. + * @returns {void} + */ + function checkParameter(node, name) { + var declaration = findDeclaration(context.getScope(), name); + + if (declaration && isParameter(declaration)) { + context.report(node, "Assignment to function parameter '{{name}}'.", { name: name }); + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "AssignmentExpression": function(node) { + checkParameter(node, node.left.name); + }, + + "UpdateExpression": function(node) { + checkParameter(node, node.argument.name); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-path-concat.js b/node_modules/standard/node_modules/eslint/lib/rules/no-path-concat.js new file mode 100644 index 00000000..b5555891 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-path-concat.js @@ -0,0 +1,37 @@ +/** + * @fileoverview Disallow string concatenation when using __dirname and __filename + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var MATCHER = /^__(?:dir|file)name$/; + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "BinaryExpression": function(node) { + + var left = node.left, + right = node.right; + + if (node.operator === "+" && + ((left.type === "Identifier" && MATCHER.test(left.name)) || + (right.type === "Identifier" && MATCHER.test(right.name))) + ) { + + context.report(node, "Use path.join() or path.resolve() instead of + to create paths."); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-plusplus.js b/node_modules/standard/node_modules/eslint/lib/rules/no-plusplus.js new file mode 100644 index 00000000..268af7ee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-plusplus.js @@ -0,0 +1,22 @@ +/** + * @fileoverview Rule to flag use of unary increment and decrement operators. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "UpdateExpression": function(node) { + context.report(node, "Unary operator '" + node.operator + "' used."); + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-process-env.js b/node_modules/standard/node_modules/eslint/lib/rules/no-process-env.js new file mode 100644 index 00000000..54a0cb49 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-process-env.js @@ -0,0 +1,28 @@ +/** + * @fileoverview Disallow the use of process.env() + * @author Vignesh Anand + * @copyright 2014 Vignesh Anand. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "MemberExpression": function(node) { + var objectName = node.object.name, + propertyName = node.property.name; + + if (objectName === "process" && !node.computed && propertyName && propertyName === "env") { + context.report(node, "Unexpected use of process.env."); + } + + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-process-exit.js b/node_modules/standard/node_modules/eslint/lib/rules/no-process-exit.js new file mode 100644 index 00000000..84006f2d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-process-exit.js @@ -0,0 +1,31 @@ +/** + * @fileoverview Disallow the use of process.exit() + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "CallExpression": function(node) { + var callee = node.callee; + + if (callee.type === "MemberExpression" && callee.object.name === "process" && + callee.property.name === "exit" + ) { + context.report(node, "Don't use process.exit(); throw an error instead."); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-proto.js b/node_modules/standard/node_modules/eslint/lib/rules/no-proto.js new file mode 100644 index 00000000..0ab434c1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-proto.js @@ -0,0 +1,26 @@ +/** + * @fileoverview Rule to flag usage of __proto__ property + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "MemberExpression": function(node) { + + if (node.property && + (node.property.type === "Identifier" && node.property.name === "__proto__" && !node.computed) || + (node.property.type === "Literal" && node.property.value === "__proto__")) { + context.report(node, "The '__proto__' property is deprecated."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-redeclare.js b/node_modules/standard/node_modules/eslint/lib/rules/no-redeclare.js new file mode 100644 index 00000000..da1b7bff --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-redeclare.js @@ -0,0 +1,58 @@ +/** + * @fileoverview Rule to flag when the same variable is declared more then once. + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Find variables in a given scope and flag redeclared ones. + * @param {Scope} scope An escope scope object. + * @returns {void} + * @private + */ + function findVariablesInScope(scope) { + scope.variables.forEach(function(variable) { + + if (variable.identifiers && variable.identifiers.length > 1) { + variable.identifiers.sort(function(a, b) { + return a.range[1] - b.range[1]; + }); + + for (var i = 1, l = variable.identifiers.length; i < l; i++) { + context.report(variable.identifiers[i], "{{a}} is already defined", {a: variable.name}); + } + } + }); + + } + + /** + * Find variables in a given node's associated scope. + * @param {ASTNode} node The node to check. + * @returns {void} + * @private + */ + function findVariables(node) { + var scope = context.getScope(); + + findVariablesInScope(scope); + + // globalReturn means one extra scope to check + if (node.type === "Program" && context.ecmaFeatures.globalReturn) { + findVariablesInScope(scope.childScopes[0]); + } + } + + return { + "Program": findVariables, + "FunctionExpression": findVariables, + "FunctionDeclaration": findVariables + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-regex-spaces.js b/node_modules/standard/node_modules/eslint/lib/rules/no-regex-spaces.js new file mode 100644 index 00000000..edbf76d5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-regex-spaces.js @@ -0,0 +1,33 @@ +/** + * @fileoverview Rule to count multiple spaces in regular expressions + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "Literal": function(node) { + var token = context.getFirstToken(node), + nodeType = token.type, + nodeValue = token.value, + multipleSpacesRegex = /( {2,})+?/, + regexResults; + + if (nodeType === "RegularExpression") { + regexResults = multipleSpacesRegex.exec(nodeValue); + + if (regexResults !== null) { + context.report(node, "Spaces are hard to count. Use {" + regexResults[0].length + "}."); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-reserved-keys.js b/node_modules/standard/node_modules/eslint/lib/rules/no-reserved-keys.js new file mode 100644 index 00000000..d94dcffb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-reserved-keys.js @@ -0,0 +1,54 @@ +/** + * @fileoverview Rule to disallow reserved words being used as keys + * @author Emil Bay + * @copyright 2014 Emil Bay. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var MESSAGE = "Reserved word '{{key}}' used as key."; + + var reservedWords = [ + "abstract", + "boolean", "break", "byte", + "case", "catch", "char", "class", "const", "continue", + "debugger", "default", "delete", "do", "double", + "else", "enum", "export", "extends", + "final", "finally", "float", "for", "function", + "goto", + "if", "implements", "import", "in", "instanceof", "int", "interface", + "long", + "native", "new", + "package", "private", "protected", "public", + "return", + "short", "static", "super", "switch", "synchronized", + "this", "throw", "throws", "transient", "try", "typeof", + "var", "void", "volatile", + "while", "with" + ]; + + return { + + "ObjectExpression": function(node) { + node.properties.forEach(function(property) { + + if (property.key.type === "Identifier") { + var keyName = property.key.name; + + if (reservedWords.indexOf("" + keyName) !== -1) { + context.report(node, MESSAGE, { key: keyName }); + } + } + + }); + + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-restricted-modules.js b/node_modules/standard/node_modules/eslint/lib/rules/no-restricted-modules.js new file mode 100644 index 00000000..a4c13517 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-restricted-modules.js @@ -0,0 +1,72 @@ +/** + * @fileoverview Restrict usage of specified node modules. + * @author Christian Schulz + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + // trim restricted module names + var restrictedModules = context.options; + + // if no modules are restricted we don't need to check the CallExpressions + if (restrictedModules.length === 0) { + return {}; + } + + /** + * Function to check if a node is a string literal. + * @param {ASTNode} node The node to check. + * @returns {boolean} If the node is a string literal. + */ + function isString(node) { + return node && node.type === "Literal" && typeof node.value === "string"; + } + + /** + * Function to check if a node is a require call. + * @param {ASTNode} node The node to check. + * @returns {boolean} If the node is a require call. + */ + function isRequireCall(node) { + return node.callee.type === "Identifier" && node.callee.name === "require"; + } + + /** + * Function to check if a node has an argument that is an restricted module and return its name. + * @param {ASTNode} node The node to check + * @returns {undefined|String} restricted module name or undefined if node argument isn't restricted. + */ + function getRestrictedModuleName(node) { + var moduleName; + + // node has arguments and first argument is string + if (node.arguments.length && isString(node.arguments[0])) { + var argumentValue = node.arguments[0].value.trim(); + + // check if argument value is in restricted modules array + if (restrictedModules.indexOf(argumentValue) !== -1) { + moduleName = argumentValue; + } + } + + return moduleName; + } + + return { + "CallExpression": function (node) { + if (isRequireCall(node)) { + var restrictedModuleName = getRestrictedModuleName(node); + + if (restrictedModuleName) { + context.report(node, "'{{moduleName}}' module is restricted from being used.", { + moduleName: restrictedModuleName + }); + } + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-return-assign.js b/node_modules/standard/node_modules/eslint/lib/rules/no-return-assign.js new file mode 100644 index 00000000..65a751c0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-return-assign.js @@ -0,0 +1,22 @@ +/** + * @fileoverview Rule to flag when return statement contains assignment + * @author Ilya Volodin + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "ReturnStatement": function(node) { + if (node.argument && node.argument.type === "AssignmentExpression") { + context.report(node, "Return statement should not contain assignment."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-script-url.js b/node_modules/standard/node_modules/eslint/lib/rules/no-script-url.js new file mode 100644 index 00000000..9ae9ba1a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-script-url.js @@ -0,0 +1,32 @@ +/** + * @fileoverview Rule to flag when using javascript: urls + * @author Ilya Volodin + */ +/*jshint scripturl: true */ +/*eslint no-script-url: 0*/ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "Literal": function(node) { + + var value; + + if (node.value && typeof node.value === "string") { + value = node.value.toLowerCase(); + + if (value.indexOf("javascript:") === 0) { + context.report(node, "Script URL is a form of eval."); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-self-compare.js b/node_modules/standard/node_modules/eslint/lib/rules/no-self-compare.js new file mode 100644 index 00000000..dc68c500 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-self-compare.js @@ -0,0 +1,27 @@ +/** + * @fileoverview Rule to flag comparison where left part is the same as the right + * part. + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "BinaryExpression": function(node) { + var operators = ["===", "==", "!==", "!=", ">", "<", ">=", "<="]; + if (operators.indexOf(node.operator) > -1 && + (node.left.type === "Identifier" && node.right.type === "Identifier" && node.left.name === node.right.name || + node.left.type === "Literal" && node.right.type === "Literal" && node.left.value === node.right.value)) { + context.report(node, "Comparing to itself is potentially pointless."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-sequences.js b/node_modules/standard/node_modules/eslint/lib/rules/no-sequences.js new file mode 100644 index 00000000..7edcd40d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-sequences.js @@ -0,0 +1,92 @@ +/** + * @fileoverview Rule to flag use of comma operator + * @author Brandon Mills + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Parts of the grammar that are required to have parens. + */ + var parenthesized = { + "DoWhileStatement": "test", + "IfStatement": "test", + "SwitchStatement": "discriminant", + "WhileStatement": "test", + "WithStatement": "object" + + // Omitting CallExpression - commas are parsed as argument separators + // Omitting NewExpression - commas are parsed as argument separators + // Omitting ForInStatement - parts aren't individually parenthesised + // Omitting ForStatement - parts aren't individually parenthesised + }; + + /** + * Determines whether a node is required by the grammar to be wrapped in + * parens, e.g. the test of an if statement. + * @param {ASTNode} node - The AST node + * @returns {boolean} True if parens around node belong to parent node. + */ + function requiresExtraParens(node) { + return node.parent && parenthesized[node.parent.type] != null && + node === node.parent[parenthesized[node.parent.type]]; + } + + /** + * Check if a node is wrapped in parens. + * @param {ASTNode} node - The AST node + * @returns {boolean} True if the node has a paren on each side. + */ + function isParenthesised(node) { + var previousToken = context.getTokenBefore(node), + nextToken = context.getTokenAfter(node); + + return previousToken && nextToken && + previousToken.value === "(" && previousToken.range[1] <= node.range[0] && + nextToken.value === ")" && nextToken.range[0] >= node.range[1]; + } + + /** + * Check if a node is wrapped in two levels of parens. + * @param {ASTNode} node - The AST node + * @returns {boolean} True if two parens surround the node on each side. + */ + function isParenthesisedTwice(node) { + var previousToken = context.getTokenBefore(node, 1), + nextToken = context.getTokenAfter(node, 1); + + return isParenthesised(node) && previousToken && nextToken && + previousToken.value === "(" && previousToken.range[1] <= node.range[0] && + nextToken.value === ")" && nextToken.range[0] >= node.range[1]; + } + + return { + "SequenceExpression": function(node) { + // Always allow sequences in for statement update + if (node.parent.type === "ForStatement" && + (node === node.parent.init || node === node.parent.update)) { + return; + } + + // Wrapping a sequence in extra parens indicates intent + if (requiresExtraParens(node)) { + if (isParenthesisedTwice(node)) { + return; + } + } else { + if (isParenthesised(node)) { + return; + } + } + + context.report(node, "Unexpected use of comma operator."); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-shadow-restricted-names.js b/node_modules/standard/node_modules/eslint/lib/rules/no-shadow-restricted-names.js new file mode 100644 index 00000000..e720a0a1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-shadow-restricted-names.js @@ -0,0 +1,49 @@ +/** + * @fileoverview Disallow shadowing of NaN, undefined, and Infinity (ES5 section 15.1.1) + * @author Michael Ficarra + * @copyright 2013 Michael Ficarra. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var RESTRICTED = ["undefined", "NaN", "Infinity", "arguments", "eval"]; + + function checkForViolation(id) { + if (RESTRICTED.indexOf(id.name) > -1) { + context.report(id, "Shadowing of global property \"" + id.name + "\"."); + } + } + + return { + "VariableDeclarator": function(node) { + checkForViolation(node.id); + }, + "ArrowFunctionExpression": function(node) { + if (node.id) { + checkForViolation(node.id); + } + [].map.call(node.params, checkForViolation); + }, + "FunctionExpression": function(node) { + if (node.id) { + checkForViolation(node.id); + } + [].map.call(node.params, checkForViolation); + }, + "FunctionDeclaration": function(node) { + if (node.id) { + checkForViolation(node.id); + [].map.call(node.params, checkForViolation); + } + }, + "CatchClause": function(node) { + checkForViolation(node.param); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-shadow.js b/node_modules/standard/node_modules/eslint/lib/rules/no-shadow.js new file mode 100644 index 00000000..39f81b82 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-shadow.js @@ -0,0 +1,69 @@ +/** + * @fileoverview Rule to flag on declaring variables already declared in the outer scope + * @author Ilya Volodin + * @copyright 2013 Ilya Volodin. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Checks if a variable is contained in the list of given scope variables. + * @param {Object} variable The variable to check. + * @param {Array} scopeVars The scope variables to look for. + * @returns {boolean} Whether or not the variable is contains in the list of scope variables. + */ + function isContainedInScopeVars(variable, scopeVars) { + return scopeVars.some(function (scopeVar) { + if (scopeVar.identifiers.length > 0) { + return variable.name === scopeVar.name; + } + return false; + }); + } + + /** + * Checks if the given variables are shadowed in the given scope. + * @param {Array} variables The variables to look for + * @param {Object} scope The scope to be checked. + * @returns {void} + */ + function checkShadowsInScope(variables, scope) { + variables.forEach(function (variable) { + if (isContainedInScopeVars(variable, scope.variables) && + // "arguments" is a special case that has no identifiers (#1759) + variable.identifiers.length > 0 + ) { + + context.report(variable.identifiers[0], "{{a}} is already declared in the upper scope.", {a: variable.name}); + } + }); + } + + /** + * Checks the current context for shadowed variables. + * @returns {void} + */ + function checkForShadows() { + var scope = context.getScope(), + variables = scope.variables; + + // iterate through the array of variables and find duplicates with the upper scope + var upper = scope.upper; + while (upper) { + checkShadowsInScope(variables, upper); + upper = upper.upper; + } + } + + return { + "FunctionDeclaration": checkForShadows, + "FunctionExpression": checkForShadows + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-space-before-semi.js b/node_modules/standard/node_modules/eslint/lib/rules/no-space-before-semi.js new file mode 100644 index 00000000..33926741 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-space-before-semi.js @@ -0,0 +1,96 @@ +/** + * @fileoverview Rule to disallow whitespace before the semicolon + * @author Jonathan Kingston + * @copyright 2015 Mathias Schreck + * @copyright 2014 Jonathan Kingston + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Determines whether two adjacent tokens are have whitespace between them. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not there is space between the tokens. + */ + function isSpaced(left, right) { + return left.range[1] < right.range[0]; + } + + /** + * Checks whether two tokens are on the same line. + * @param {Object} left The leftmost token. + * @param {Object} right The rightmost token. + * @returns {boolean} True if the tokens are on the same line, false if not. + * @private + */ + function isSameLine(left, right) { + return left.loc.end.line === right.loc.start.line; + } + + /** + * Checks if a given token has leading whitespace. + * @param {Object} token The token to check. + * @returns {boolean} True if the given token has leading space, false if not. + */ + function hasLeadingSpace(token) { + var tokenBefore = context.getTokenBefore(token); + return isSameLine(tokenBefore, token) && isSpaced(tokenBefore, token); + } + + /** + * Checks if the given token is a semicolon. + * @param {Token} token The token to check. + * @returns {boolean} Whether or not the given token is a semicolon. + */ + function isSemicolon(token) { + return token.type === "Punctuator" && token.value === ";"; + } + + /** + * Reports if the given token has leading space. + * @param {Token} token The semicolon token to check. + * @param {ASTNode} node The corresponding node of the token. + * @returns {void} + */ + function checkSemiTokenForLeadingSpace(token, node) { + if (isSemicolon(token) && hasLeadingSpace(token)) { + context.report(node, token.loc.start, "Unexpected whitespace before semicolon."); + } + } + + /** + * Checks leading space before the semicolon with the assumption that the last token is the semicolon. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkNode(node) { + var token = context.getLastToken(node); + checkSemiTokenForLeadingSpace(token, node); + } + + return { + "VariableDeclaration": checkNode, + "ExpressionStatement": checkNode, + "BreakStatement": checkNode, + "ContinueStatement": checkNode, + "DebuggerStatement": checkNode, + "ReturnStatement": checkNode, + "ThrowStatement": checkNode, + "ForStatement": function (node) { + if (node.init) { + checkSemiTokenForLeadingSpace(context.getTokenAfter(node.init), node); + } + + if (node.test) { + checkSemiTokenForLeadingSpace(context.getTokenAfter(node.test), node); + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-spaced-func.js b/node_modules/standard/node_modules/eslint/lib/rules/no-spaced-func.js new file mode 100644 index 00000000..7fb9fc28 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-spaced-func.js @@ -0,0 +1,35 @@ +/** + * @fileoverview Rule to check that spaced function application + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + function detectOpenSpaces(node) { + var lastCalleeToken = context.getLastToken(node.callee); + var tokens = context.getTokens(node); + var i = tokens.indexOf(lastCalleeToken), l = tokens.length; + while (i < l && tokens[i].value !== "(") { + ++i; + } + if (i >= l) { + return; + } + // look for a space between the callee and the open paren + if (tokens[i - 1].range[1] !== tokens[i].range[0]) { + context.report(node, "Unexpected space between function name and paren."); + } + } + + return { + "CallExpression": detectOpenSpaces, + "NewExpression": detectOpenSpaces + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-sparse-arrays.js b/node_modules/standard/node_modules/eslint/lib/rules/no-sparse-arrays.js new file mode 100644 index 00000000..14309771 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-sparse-arrays.js @@ -0,0 +1,31 @@ +/** + * @fileoverview Disallow sparse arrays + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "ArrayExpression": function(node) { + + var emptySpot = node.elements.indexOf(null) > -1; + + if (emptySpot) { + context.report(node, "Unexpected comma in middle of array."); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-sync.js b/node_modules/standard/node_modules/eslint/lib/rules/no-sync.js new file mode 100644 index 00000000..1a9d27d6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-sync.js @@ -0,0 +1,28 @@ +/** + * @fileoverview Rule to check for properties whose identifier ends with the string Sync + * @author Matt DuVall + */ + +/*jshint node:true*/ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "MemberExpression": function(node) { + var propertyName = node.property.name, + syncRegex = /.*Sync$/; + + if (syncRegex.exec(propertyName) !== null) { + context.report(node, "Unexpected sync method: '" + propertyName + "'."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-ternary.js b/node_modules/standard/node_modules/eslint/lib/rules/no-ternary.js new file mode 100644 index 00000000..6ae8e9a2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-ternary.js @@ -0,0 +1,22 @@ +/** + * @fileoverview Rule to flag use of ternary operators. + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "ConditionalExpression": function(node) { + context.report(node, "Ternary operator used."); + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-throw-literal.js b/node_modules/standard/node_modules/eslint/lib/rules/no-throw-literal.js new file mode 100644 index 00000000..d02e7786 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-throw-literal.js @@ -0,0 +1,31 @@ +/** + * @fileoverview Rule to restrict what can be thrown as an exception. + * @author Dieter Oberkofler + * @copyright 2015 Dieter Oberkofler. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "ThrowStatement": function(node) { + + if (node.argument.type === "Literal") { + context.report(node, "Do not throw a literal."); + } else if (node.argument.type === "Identifier") { + if (node.argument.name === "undefined") { + context.report(node, "Do not throw undefined."); + } + } + + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-trailing-spaces.js b/node_modules/standard/node_modules/eslint/lib/rules/no-trailing-spaces.js new file mode 100644 index 00000000..d299eb51 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-trailing-spaces.js @@ -0,0 +1,46 @@ +/** + * @fileoverview Disallow trailing spaces at the end of lines. + * @author Nodeca Team + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var TRAILER = "[ \t\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]+$"; + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "Program": function checkTrailingSpaces(node) { + + // Let's hack. Since Esprima does not return whitespace nodes, + // fetch the source code and do black magic via regexps. + + var src = context.getSource(), + re = new RegExp(TRAILER, "mg"), + match, lines, location; + + while ((match = re.exec(src)) !== null) { + lines = src.slice(0, re.lastIndex).split(/\r?\n/g); + + location = { + line: lines.length, + column: lines[lines.length - 1].length - match[0].length + 1 + }; + + // Passing node is a bit dirty, because message data will contain + // big text in `source`. But... who cares :) ? + // One more kludge will not make worse the bloody wizardry of this plugin. + context.report(node, location, "Trailing spaces not allowed."); + } + } + + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-undef-init.js b/node_modules/standard/node_modules/eslint/lib/rules/no-undef-init.js new file mode 100644 index 00000000..60ad5700 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-undef-init.js @@ -0,0 +1,26 @@ +/** + * @fileoverview Rule to flag when initializing to undefined + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "VariableDeclarator": function(node) { + var name = node.id.name; + var init = node.init && node.init.name; + + if (init === "undefined") { + context.report(node, "It's not necessary to initialize '{{name}}' to undefined.", { name: name }); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-undef.js b/node_modules/standard/node_modules/eslint/lib/rules/no-undef.js new file mode 100644 index 00000000..6c3f58d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-undef.js @@ -0,0 +1,122 @@ +/** + * @fileoverview Rule to flag references to undeclared variables. + * @author Mark Macdonald + * @copyright 2015 Nicholas C. Zakas. All rights reserved. + * @copyright 2013 Mark Macdonald. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var escope = require("escope"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +function isImplicitGlobal(variable) { + return variable.defs.every(function(def) { + return def.type === "ImplicitGlobalVariable"; + }); +} + +/** + * Gets the declared variable, defined in `scope`, that `ref` refers to. + * @param {Scope} scope The scope in which to search. + * @param {Reference} ref The reference to find in the scope. + * @returns {Variable} The variable, or null if ref refers to an undeclared variable. + */ +function getDeclaredGlobalVariable(scope, ref) { + var declaredGlobal = null; + scope.variables.some(function(variable) { + if (variable.name === ref.identifier.name) { + // If it's an implicit global, it must have a `writeable` field (indicating it was declared) + if (!isImplicitGlobal(variable) || {}.hasOwnProperty.call(variable, "writeable")) { + declaredGlobal = variable; + return true; + } + } + return false; + }); + return declaredGlobal; +} + +/** + * Checks if the given node is the argument of a typeof operator. + * @param {ASTNode} node The AST node being checked. + * @returns {boolean} Whether or not the node is the argument of a typeof operator. + */ +function hasTypeOfOperator(node) { + var parent = node.parent; + return parent.type === "UnaryExpression" && parent.operator === "typeof"; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var NOT_DEFINED_MESSAGE = "'{{name}}' is not defined.", + READ_ONLY_MESSAGE = "'{{name}}' is read only."; + + // TODO: Remove once escope is updated + var hackedImports = []; + + /** + * Temporary function to fix escope issue. Remove once we upgrade to + * escope 3.x. + * @param {ASTNode} node The import specifier node. + * @returns {void} + * @private + */ + function fixImport(node) { + var scope = context.getScope(), + variable = new escope.Variable(node.local.name, scope); + variable.defs.push(node); + scope.variables.push(variable); + hackedImports.push(variable); + } + + return { + + // TODO: Remove once escope is updated + "ImportSpecifier": fixImport, + "ImportNamespaceSpecifier": fixImport, + "ImportDefaultSpecifier": fixImport, + + "Program:exit": function(/*node*/) { + + var globalScope = context.getScope(); + + globalScope.through.forEach(function(ref) { + var variable = getDeclaredGlobalVariable(globalScope, ref), + name = ref.identifier.name; + + if (hasTypeOfOperator(ref.identifier)) { + return; + } + + // hack until https://github.com/eslint/eslint/issues/1968 is properly fixed + if (name === "super") { + return; + } + + if (!variable) { + context.report(ref.identifier, NOT_DEFINED_MESSAGE, { name: name }); + } else if (ref.isWrite() && variable.writeable === false) { + context.report(ref.identifier, READ_ONLY_MESSAGE, { name: name }); + } + }); + + // TODO: Remove once escope is updated + globalScope.variables = globalScope.variables.filter(function (variable) { + return hackedImports.indexOf(variable) < 0; + }); + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-undefined.js b/node_modules/standard/node_modules/eslint/lib/rules/no-undefined.js new file mode 100644 index 00000000..4d96eb3e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-undefined.js @@ -0,0 +1,25 @@ +/** + * @fileoverview Rule to flag references to the undefined variable. + * @author Michael Ficarra + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "Identifier": function(node) { + if (node.name === "undefined") { + var parent = context.getAncestors().pop(); + if (!parent || parent.type !== "MemberExpression" || node !== parent.property || parent.computed) { + context.report(node, "Unexpected use of undefined."); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-underscore-dangle.js b/node_modules/standard/node_modules/eslint/lib/rules/no-underscore-dangle.js new file mode 100644 index 00000000..9fd0b8d9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-underscore-dangle.js @@ -0,0 +1,71 @@ +/** + * @fileoverview Rule to flag trailing underscores in variable declarations. + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //------------------------------------------------------------------------- + // Helpers + //------------------------------------------------------------------------- + + function hasTrailingUnderscore(identifier) { + var len = identifier.length; + + return identifier !== "_" && (identifier[0] === "_" || identifier[len - 1] === "_"); + } + + function isSpecialCaseIdentifierForMemberExpression(identifier) { + return identifier === "__proto__"; + } + + function isSpecialCaseIdentifierInVariableExpression(identifier) { + // Checks for the underscore library usage here + return identifier === "_"; + } + + function checkForTrailingUnderscoreInFunctionDeclaration(node) { + if (node.id) { + var identifier = node.id.name; + + if (typeof identifier !== "undefined" && hasTrailingUnderscore(identifier)) { + context.report(node, "Unexpected dangling '_' in '" + identifier + "'."); + } + } + } + + function checkForTrailingUnderscoreInVariableExpression(node) { + var identifier = node.id.name; + + if (typeof identifier !== "undefined" && hasTrailingUnderscore(identifier) && + !isSpecialCaseIdentifierInVariableExpression(identifier)) { + context.report(node, "Unexpected dangling '_' in '" + identifier + "'."); + } + } + + function checkForTrailingUnderscoreInMemberExpression(node) { + var identifier = node.property.name; + + if (typeof identifier !== "undefined" && hasTrailingUnderscore(identifier) && + !isSpecialCaseIdentifierForMemberExpression(identifier)) { + context.report(node, "Unexpected dangling '_' in '" + identifier + "'."); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "FunctionDeclaration": checkForTrailingUnderscoreInFunctionDeclaration, + "VariableDeclarator": checkForTrailingUnderscoreInVariableExpression, + "MemberExpression": checkForTrailingUnderscoreInMemberExpression + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-unreachable.js b/node_modules/standard/node_modules/eslint/lib/rules/no-unreachable.js new file mode 100644 index 00000000..6606b6ad --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-unreachable.js @@ -0,0 +1,96 @@ +/** + * @fileoverview Checks for unreachable code due to return, throws, break, and continue. + * @author Joel Feenstra + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + + +function report(context, node, unreachableType) { + var keyword; + switch (unreachableType) { + case "BreakStatement": + keyword = "break"; + break; + case "ContinueStatement": + keyword = "continue"; + break; + case "ReturnStatement": + keyword = "return"; + break; + case "ThrowStatement": + keyword = "throw"; + break; + default: + return; + } + context.report(node, "Found unexpected statement after a {{type}}.", { type: keyword }); +} + + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Checks if a node is an exception for no-unreachable because of variable/function hoisting + * @param {ASTNode} node The AST node to check. + * @returns {boolean} if the node doesn't trigger unreachable + * @private + */ + function isUnreachableAllowed(node) { + return node.type === "FunctionDeclaration" || + node.type === "VariableDeclaration" && + node.declarations.every(function(declaration) { + return declaration.type === "VariableDeclarator" && declaration.init === null; + }); + } + + /* + * Verifies that the given node is the last node or followed exclusively by + * hoisted declarations + * @param {ASTNode} node Node that should be the last node + * @returns {void} + * @private + */ + function checkNode(node) { + var parent = context.getAncestors().pop(); + var field, i, sibling; + + switch (parent.type) { + case "SwitchCase": + field = "consequent"; + break; + case "Program": + case "BlockStatement": + field = "body"; + break; + default: + return; + } + + for (i = parent[field].length - 1; i >= 0; i--) { + sibling = parent[field][i]; + if (sibling === node) { + return; // Found the last reachable statement, all done + } + + if (!isUnreachableAllowed(sibling)) { + report(context, sibling, node.type); + } + } + } + + return { + "ReturnStatement": checkNode, + "ThrowStatement": checkNode, + "ContinueStatement": checkNode, + "BreakStatement": checkNode + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-unused-expressions.js b/node_modules/standard/node_modules/eslint/lib/rules/no-unused-expressions.js new file mode 100644 index 00000000..7036f90e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-unused-expressions.js @@ -0,0 +1,74 @@ +/** + * @fileoverview Flag expressions in statement position that do not side effect + * @author Michael Ficarra + * @copyright 2013 Michael Ficarra. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * @param {ASTNode} node - any node + * @returns {Boolean} whether the given node structurally represents a directive + */ + function looksLikeDirective(node) { + return node.type === "ExpressionStatement" && + node.expression.type === "Literal" && typeof node.expression.value === "string"; + } + + /** + * @param {Function} predicate - ([a] -> Boolean) the function used to make the determination + * @param {a[]} list - the input list + * @returns {a[]} the leading sequence of members in the given list that pass the given predicate + */ + function takeWhile(predicate, list) { + for (var i = 0, l = list.length; i < l; ++i) { + if (!predicate(list[i])) { + break; + } + } + return [].slice.call(list, 0, i); + } + + /** + * @param {ASTNode} node - a Program or BlockStatement node + * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body + */ + function directives(node) { + return takeWhile(looksLikeDirective, node.body); + } + + /** + * @param {ASTNode} node - any node + * @param {ASTNode[]} ancestors - the given node's ancestors + * @returns {Boolean} whether the given node is considered a directive in its current position + */ + function isDirective(node, ancestors) { + var parent = ancestors[ancestors.length - 1], + grandparent = ancestors[ancestors.length - 2]; + return (parent.type === "Program" || parent.type === "BlockStatement" && + (/Function/.test(grandparent.type))) && + directives(parent).indexOf(node) >= 0; + } + + return { + "ExpressionStatement": function(node) { + + var type = node.expression.type, + ancestors = context.getAncestors(); + + if ( + !/^(?:Assignment|Call|New|Update|Yield)Expression$/.test(type) && + (type !== "UnaryExpression" || ["delete", "void"].indexOf(node.expression.operator) < 0) && + !isDirective(node, ancestors) + ) { + context.report(node, "Expected an assignment or function call and instead saw an expression."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-unused-vars.js b/node_modules/standard/node_modules/eslint/lib/rules/no-unused-vars.js new file mode 100644 index 00000000..d6ec43bf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-unused-vars.js @@ -0,0 +1,180 @@ +/** + * @fileoverview Rule to flag declared but unused variables + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var MESSAGE = "{{name}} is defined but never used"; + + var config = { + vars: "all", + args: "after-used" + }; + + if (context.options[0]) { + if (typeof context.options[0] === "string") { + config.vars = context.options[0]; + } else { + config.vars = context.options[0].vars || config.vars; + config.args = context.options[0].args || config.args; + } + } + + /** + * Determines if a given variable is being exported from a module. + * @param {Variable} variable EScope variable object. + * @returns {boolean} True if the variable is exported, false if not. + * @private + */ + function isExported(variable) { + + var definition = variable.defs[0]; + + if (definition) { + + definition = definition.node; + if (definition.type === "VariableDeclarator") { + definition = definition.parent; + } + + return definition.parent.type.indexOf("Export") === 0; + } else { + return false; + } + } + + /** + * Determines if a reference is a read operation. + * @param {Reference} ref - an escope Reference + * @returns {Boolean} whether the given reference represents a read operation + * @private + */ + function isReadRef(ref) { + return ref.isRead(); + } + + /** + * Determine if an identifier is referencing the enclosing function name. + * @param {Reference} ref The reference to check. + * @returns {boolean} True if it's a self-reference, false if not. + * @private + */ + function isSelfReference(ref) { + + if (ref.from.type === "function" && ref.from.block.id) { + return ref.identifier.name === ref.from.block.id.name; + } + + return false; + } + + /** + * Determines if a reference should be counted as a read. A reference should + * be counted only if it's a read and it's not a reference to the containing + * function declaration name. + * @param {Reference} ref The reference to check. + * @returns {boolean} True if it's a value read reference, false if not. + * @private + */ + function isValidReadRef(ref) { + return isReadRef(ref) && !isSelfReference(ref); + } + + /** + * Gets an array of local variables without read references. + * @param {Scope} scope - an escope Scope object + * @returns {Variable[]} most of the local variables with no read references + * @private + */ + function getUnusedLocals(scope) { + var unused = []; + var variables = scope.variables; + + if (scope.type !== "global" && scope.type !== "TDZ") { + for (var i = 0, l = variables.length; i < l; ++i) { + + // skip function expression names + if (scope.functionExpressionScope || variables[i].eslintUsed) { + continue; + } + // skip implicit "arguments" variable + if (scope.type === "function" && variables[i].name === "arguments" && variables[i].identifiers.length === 0) { + continue; + } + + var def = variables[i].defs[0], + type = def.type; + + // skip catch variables + if (type === "CatchClause") { + continue; + } + + // skip any setter argument + if (type === "Parameter" && def.node.parent.type === "Property" && def.node.parent.kind === "set") { + continue; + } + + // if "args" option is "none", skip any parameter + if (config.args === "none" && type === "Parameter") { + continue; + } + + // if "args" option is "after-used", skip all but the last parameter + if (config.args === "after-used" && type === "Parameter" && variables[i].defs[0].index < variables[i].defs[0].node.params.length - 1) { + continue; + } + + if (variables[i].references.filter(isValidReadRef).length === 0 && !isExported(variables[i])) { + unused.push(variables[i]); + } + } + } + + return [].concat.apply(unused, scope.childScopes.map(getUnusedLocals)); + } + + return { + "Program:exit": function(programNode) { + var globalScope = context.getScope(); + var unused = getUnusedLocals(globalScope); + var i, l; + + // determine unused globals + if (config.vars === "all") { + var unresolvedRefs = globalScope.through.filter(isValidReadRef).map(function(ref) { + return ref.identifier.name; + }); + + for (i = 0, l = globalScope.variables.length; i < l; ++i) { + if (unresolvedRefs.indexOf(globalScope.variables[i].name) < 0 && + !globalScope.variables[i].eslintUsed && !isExported(globalScope.variables[i])) { + unused.push(globalScope.variables[i]); + } + } + } + + for (i = 0, l = unused.length; i < l; ++i) { + if (unused[i].eslintExplicitGlobal) { + context.report(programNode, MESSAGE, unused[i]); + } else if (unused[i].defs.length > 0) { + + // TODO: Remove when https://github.com/estools/escope/issues/49 is resolved + if (unused[i].defs[0].type === "ClassName") { + continue; + } + + context.report(unused[i].identifiers[0], MESSAGE, unused[i]); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-use-before-define.js b/node_modules/standard/node_modules/eslint/lib/rules/no-use-before-define.js new file mode 100644 index 00000000..3f175dc7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-use-before-define.js @@ -0,0 +1,67 @@ +/** + * @fileoverview Rule to flag use of variables before they are defined + * @author Ilya Volodin + * @copyright 2013 Ilya Volodin. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +var NO_FUNC = "nofunc"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + function findDeclaration(name, scope) { + // try searching in the current scope first + for (var i = 0, l = scope.variables.length; i < l; i++) { + if (scope.variables[i].name === name) { + return scope.variables[i]; + } + } + // check if there's upper scope and call recursivly till we find the variable + if (scope.upper) { + return findDeclaration(name, scope.upper); + } + } + + function findVariables() { + var scope = context.getScope(); + var typeOption = context.options[0]; + + function checkLocationAndReport(reference, declaration) { + if (typeOption !== NO_FUNC || declaration.defs[0].type !== "FunctionName") { + if (declaration.identifiers[0].range[1] > reference.identifier.range[1]) { + context.report(reference.identifier, "{{a}} was used before it was defined", {a: reference.identifier.name}); + } + } + } + + scope.references.forEach(function(reference) { + // if the reference is resolved check for declaration location + // if not, it could be function invocation, try to find manually + if (reference.resolved && reference.resolved.identifiers.length > 0) { + checkLocationAndReport(reference, reference.resolved); + } else { + var declaration = findDeclaration(reference.identifier.name, scope); + // if there're no identifiers, this is a global environment variable + if (declaration && declaration.identifiers.length !== 0) { + checkLocationAndReport(reference, declaration); + } + } + }); + } + + return { + "Program": findVariables, + "FunctionExpression": findVariables, + "FunctionDeclaration": findVariables, + "ArrowFunctionExpression": findVariables + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-var.js b/node_modules/standard/node_modules/eslint/lib/rules/no-var.js new file mode 100644 index 00000000..6b47b3da --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-var.js @@ -0,0 +1,24 @@ +/** + * @fileoverview Rule to check for the usage of var. + * @author Jamund Ferguson + * @copyright 2014 Jamund Ferguson. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "VariableDeclaration": function (node) { + if (node.kind === "var") { + context.report(node, "Unexpected var, use let or const instead."); + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-void.js b/node_modules/standard/node_modules/eslint/lib/rules/no-void.js new file mode 100644 index 00000000..11c54af7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-void.js @@ -0,0 +1,26 @@ +/** + * @fileoverview Rule to disallow use of void operator. + * @author Mike Sidorov + * @copyright 2014 Mike Sidorov. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "UnaryExpression": function(node) { + if (node.operator === "void") { + context.report(node, "Expected 'undefined' and instead saw 'void'."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-warning-comments.js b/node_modules/standard/node_modules/eslint/lib/rules/no-warning-comments.js new file mode 100644 index 00000000..58b6764f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-warning-comments.js @@ -0,0 +1,84 @@ +/** + * @fileoverview Rule that warns about used warning comments + * @author Alexander Schmidt + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + + var configuration = context.options[0] || {}, + warningTerms = configuration.terms || ["todo", "fixme", "xxx"], + location = configuration.location || "start", + warningRegExps; + + /** + * Convert a warning term into a RegExp which will match a comment containing that whole word in the specified + * location ("start" or "anywhere"). If the term starts or ends with non word characters, then the match will not + * require word boundaries on that side. + * + * @param {String} term A term to convert to a RegExp + * @returns {RegExp} The term converted to a RegExp + */ + function convertToRegExp(term) { + var escaped = term.replace(/[-\/\\$\^*+?.()|\[\]{}]/g, "\\$&"), + // If the term ends in a word character (a-z0-9_), ensure a word boundary at the end, so that substrings do + // not get falsely matched. eg "todo" in a string such as "mastodon". + // If the term ends in a non-word character, then \b won't match on the boundary to the next non-word + // character, which would likely be a space. For example `/\bFIX!\b/.test('FIX! blah') === false`. + // In these cases, use no bounding match. Same applies for the prefix, handled below. + suffix = /\w$/.test(term) ? "\\b" : "", + prefix; + + if (location === "start") { + // When matching at the start, ignore leading whitespace, and there's no need to worry about word boundaries + prefix = "^\\s*"; + } else if (/^\w/.test(term)) { + prefix = "\\b"; + } else { + prefix = ""; + } + + return new RegExp(prefix + escaped + suffix, "i"); + } + + /** + * Checks the specified comment for matches of the configured warning terms and returns the matches. + * @param {String} comment The comment which is checked. + * @returns {Array} All matched warning terms for this comment. + */ + function commentContainsWarningTerm(comment) { + var matches = []; + + warningRegExps.forEach(function (regex, index) { + if (regex.test(comment)) { + matches.push(warningTerms[index]); + } + }); + + return matches; + } + + /** + * Checks the specified node for matching warning comments and reports them. + * @param {ASTNode} node The AST node being checked. + * @returns {void} undefined. + */ + function checkComment(node) { + var matches = commentContainsWarningTerm(node.value); + + matches.forEach(function (matchedTerm) { + context.report(node, "Unexpected " + matchedTerm + " comment."); + }); + } + + warningRegExps = warningTerms.map(convertToRegExp); + return { + "BlockComment": checkComment, + "LineComment": checkComment + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-with.js b/node_modules/standard/node_modules/eslint/lib/rules/no-with.js new file mode 100644 index 00000000..1b889dc5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-with.js @@ -0,0 +1,20 @@ +/** + * @fileoverview Rule to flag use of with statement + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "WithStatement": function(node) { + context.report(node, "Unexpected use of 'with' statement."); + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/no-wrap-func.js b/node_modules/standard/node_modules/eslint/lib/rules/no-wrap-func.js new file mode 100644 index 00000000..a99c09ee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/no-wrap-func.js @@ -0,0 +1,44 @@ +/** + * @fileoverview Rule to flag wrapping non-iife in parens + * @author Ilya Volodin + * @copyright 2013 Ilya Volodin. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Checks a function expression to see if its surrounded by parens. + * @param {ASTNode} node The node to check. + * @returns {void} + * @private + */ + function checkFunction(node) { + var previousToken, nextToken; + + if (node.type === "ArrowFunctionExpression" && + /(?:Call|New|Logical|Binary|Conditional|Update)Expression/.test(node.parent.type) + ) { + return; + } + + if (!/CallExpression|NewExpression/.test(node.parent.type)) { + previousToken = context.getTokenBefore(node); + nextToken = context.getTokenAfter(node); + if (previousToken.value === "(" && nextToken.value === ")") { + context.report(node, "Wrapping non-IIFE function literals in parens is unnecessary."); + } + } + } + + return { + "ArrowFunctionExpression": checkFunction, + "FunctionExpression": checkFunction + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/one-var.js b/node_modules/standard/node_modules/eslint/lib/rules/one-var.js new file mode 100644 index 00000000..fd82d55c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/one-var.js @@ -0,0 +1,85 @@ +/** + * @fileoverview A rule to ensure the use of a single variable declaration. + * @author Ian Christian Myers + * @copyright 2015 Danny Fritz. All rights reserved. + * @copyright 2013 Ian Christian Myers. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var MODE = context.options[0] || "always"; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + var functionStack = []; + + /** + * Increments the functionStack counter. + * @returns {void} + * @private + */ + function startFunction() { + functionStack.push(false); + } + + /** + * Decrements the functionStack counter. + * @returns {void} + * @private + */ + function endFunction() { + functionStack.pop(); + } + + /** + * Determines if there is more than one var statement in the current scope. + * @returns {boolean} Returns true if it is the first var declaration, false if not. + * @private + */ + function hasOnlyOneVar() { + if (functionStack[functionStack.length - 1]) { + return true; + } else { + functionStack[functionStack.length - 1] = true; + return false; + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "Program": startFunction, + "FunctionDeclaration": startFunction, + "FunctionExpression": startFunction, + "ArrowFunctionExpression": startFunction, + + "VariableDeclaration": function(node) { + var declarationCount = node.declarations.length; + if (MODE === "never") { + if (declarationCount > 1) { + context.report(node, "Split 'var' declaration into multiple statements."); + } + } else { + if (hasOnlyOneVar()) { + context.report(node, "Combine this with the previous 'var' statement."); + } + } + }, + + "Program:exit": endFunction, + "FunctionDeclaration:exit": endFunction, + "FunctionExpression:exit": endFunction, + "ArrowFunctionExpression:exit": endFunction + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/operator-assignment.js b/node_modules/standard/node_modules/eslint/lib/rules/operator-assignment.js new file mode 100644 index 00000000..7ebb74d2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/operator-assignment.js @@ -0,0 +1,112 @@ +/** + * @fileoverview Rule to replace assignment expressions with operator assignment + * @author Brandon Mills + * @copyright 2014 Brandon Mills. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether an operator is commutative and has an operator assignment + * shorthand form. + * @param {string} operator Operator to check. + * @returns {boolean} True if the operator is commutative and has a + * shorthand form. + */ +function isCommutativeOperatorWithShorthand(operator) { + return ["*", "&", "^", "|"].indexOf(operator) >= 0; +} + +/** + * Checks whether an operator is not commuatative and has an operator assignment + * shorthand form. + * @param {string} operator Operator to check. + * @returns {boolean} True if the operator is not commuatative and has + * a shorthand form. + */ +function isNonCommutativeOperatorWithShorthand(operator) { + return ["+", "-", "/", "%", "<<", ">>", ">>>"].indexOf(operator) >= 0; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +/** + * Checks whether two expressions reference the same value. For example: + * a = a + * a.b = a.b + * a[0] = a[0] + * a['b'] = a['b'] + * @param {ASTNode} a Left side of the comparison. + * @param {ASTNode} b Right side of the comparison. + * @returns {boolean} True if both sides match and reference the same value. + */ +function same(a, b) { + if (a.type !== b.type) { + return false; + } + + switch (a.type) { + case "Identifier": + return a.name === b.name; + case "Literal": + return a.value === b.value; + case "MemberExpression": + // x[0] = x[0] + // x[y] = x[y] + // x.y = x.y + return same(a.object, b.object) && same(a.property, b.property); + default: + return false; + } +} + +module.exports = function(context) { + + /** + * Ensures that an assignment uses the shorthand form where possible. + * @param {ASTNode} node An AssignmentExpression node. + * @returns {void} + */ + function verify(node) { + var expr, left, operator; + + if (node.operator !== "=" || node.right.type !== "BinaryExpression") { + return; + } + + left = node.left; + expr = node.right; + operator = expr.operator; + + if (isCommutativeOperatorWithShorthand(operator)) { + if (same(left, expr.left) || same(left, expr.right)) { + context.report(node, "Assignment can be replaced with operator assignment."); + } + } else if (isNonCommutativeOperatorWithShorthand(operator)) { + if (same(left, expr.left)) { + context.report(node, "Assignment can be replaced with operator assignment."); + } + } + } + + /** + * Warns if an assignment expression uses operator assignment shorthand. + * @param {ASTNode} node An AssignmentExpression node. + * @returns {void} + */ + function prohibit(node) { + if (node.operator !== "=") { + context.report(node, "Unexpected operator assignment shorthand."); + } + } + + return { + "AssignmentExpression": context.options[0] !== "never" ? verify : prohibit + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/padded-blocks.js b/node_modules/standard/node_modules/eslint/lib/rules/padded-blocks.js new file mode 100644 index 00000000..59ebb5e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/padded-blocks.js @@ -0,0 +1,95 @@ +/** + * @fileoverview A rule to ensure blank lines within blocks. + * @author Mathias Schreck + * @copyright 2014 Mathias Schreck. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + var requirePadding = context.options[0] !== "never"; + + /** + * Checks if the given non empty block node has a blank line before its first child node. + * @param {ASTNode} node The AST node of a BlockStatement. + * @returns {boolean} Whether or not the block starts with a blank line. + */ + function isNonEmptyBlockTopPadded(node) { + var blockStart = node.loc.start.line, + first = node.body[0], + firstLine = first.loc.start.line, + expectedFirstLine = blockStart + 2, + leadingComments = context.getComments(first).leading; + + if (leadingComments.length > 0) { + firstLine = leadingComments[0].loc.start.line; + } + + return expectedFirstLine <= firstLine; + } + + /** + * Checks if the given non empty block node has a blank line after its last child node. + * @param {ASTNode} node The AST node of a BlockStatement. + * @returns {boolean} Whether or not the block ends with a blank line. + */ + function isNonEmptyBlockBottomPadded(node) { + var blockEnd = node.loc.end.line, + last = node.body[node.body.length - 1], + lastLine = last.loc.end.line, + expectedLastLine = blockEnd - 2, + trailingComments = context.getComments(last).trailing; + + if (trailingComments.length > 0) { + lastLine = trailingComments[trailingComments.length - 1].loc.end.line; + } + + return lastLine <= expectedLastLine; + } + + /** + * Checks if the given non empty block node starts AND ends with a blank line. + * @param {ASTNode} node The AST node of a BlockStatement. + * @returns {boolean} Whether or not the block starts and ends with a blank line. + */ + function isNonEmptyBlockPadded(node) { + return isNonEmptyBlockTopPadded(node) && isNonEmptyBlockBottomPadded(node); + } + + /** + * Checks if the given non empty block node starts OR ends with a blank line. + * @param {ASTNode} node The AST node of a BlockStatement. + * @returns {boolean} Whether or not the block starts and ends with a blank line. + */ + function hasNonEmptyBlockExtraPadding(node) { + return isNonEmptyBlockTopPadded(node) || isNonEmptyBlockBottomPadded(node); + } + + /** + * Checks the given BlockStatement node to be padded if the block is not empty. + * @param {ASTNode} node The AST node of a BlockStatement. + * @returns {void} undefined. + */ + function checkPadding(node) { + if (node.body.length > 0) { + if (requirePadding) { + if (!isNonEmptyBlockPadded(node)) { + context.report(node, "Block must be padded by blank lines."); + } + } else { + if (hasNonEmptyBlockExtraPadding(node)) { + context.report(node, "Block must not be padded by blank lines."); + } + } + } + } + + return { + "BlockStatement": checkPadding + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/quote-props.js b/node_modules/standard/node_modules/eslint/lib/rules/quote-props.js new file mode 100644 index 00000000..c4afd8f9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/quote-props.js @@ -0,0 +1,66 @@ +/** + * @fileoverview Rule to flag non-quoted property names in object literals. + * @author Mathias Bynens + * @copyright 2014 Brandon Mills. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var espree = require("espree"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var MODE = context.options[0]; + + /** + * Ensures that a property's key is quoted only when necessary + * @param {ASTNode} node Property AST node + * @returns {void} + */ + function asNeeded(node) { + var key = node.key, + tokens; + + if (key.type === "Literal" && typeof key.value === "string") { + try { + tokens = espree.tokenize(key.value); + } catch (e) { + return; + } + + if (tokens.length === 1 && + (["Identifier", "Null", "Boolean"].indexOf(tokens[0].type) >= 0 || + (tokens[0].type === "Numeric" && "" + +tokens[0].value === tokens[0].value)) + ) { + context.report(node, "Unnecessarily quoted property `{{value}}` found.", key); + } + } + } + + /** + * Ensures that a property's key is quoted + * @param {ASTNode} node Property AST node + * @returns {void} + */ + function always(node) { + var key = node.key; + + if (!(key.type === "Literal" && typeof key.value === "string")) { + context.report(node, "Unquoted property `{{key}}` found.", { + key: key.name || key.value + }); + } + } + + return { + "Property": MODE === "as-needed" ? asNeeded : always + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/quotes.js b/node_modules/standard/node_modules/eslint/lib/rules/quotes.js new file mode 100644 index 00000000..1ed86910 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/quotes.js @@ -0,0 +1,78 @@ +/** + * @fileoverview A rule to choose between single and double quote marks + * @author Matt DuVall , Brandon Payton + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +var QUOTE_SETTINGS = { + "double": { + quote: "\"", + alternateQuote: "'", + description: "doublequote" + }, + "single": { + quote: "'", + alternateQuote: "\"", + description: "singlequote" + } +}; + +var AVOID_ESCAPE = "avoid-escape"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + /** + * Validate that a string passed in is surrounded by the specified character + * @param {string} val The text to check. + * @param {string} character The character to see if it's surrounded by. + * @returns {boolean} True if the text is surrounded by the character, false if not. + * @private + */ + function isSurroundedBy(val, character) { + return val[0] === character && val[val.length - 1] === character; + } + + /** + * Determines if a given node is part of JSX syntax. + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node is a JSX node, false if not. + * @private + */ + function isJSXElement(node) { + return node.type.indexOf("JSX") === 0; + } + + return { + + "Literal": function(node) { + var val = node.value, + rawVal = node.raw, + quoteOption = context.options[0], + settings = QUOTE_SETTINGS[quoteOption], + avoidEscape = context.options[1] === AVOID_ESCAPE, + isValid; + + if (settings && typeof val === "string") { + isValid = isJSXElement(node.parent) || isSurroundedBy(rawVal, settings.quote); + + if (!isValid && avoidEscape) { + isValid = isSurroundedBy(rawVal, settings.alternateQuote) && rawVal.indexOf(settings.quote) >= 0; + } + + if (!isValid) { + context.report(node, "Strings must use " + settings.description + "."); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/radix.js b/node_modules/standard/node_modules/eslint/lib/rules/radix.js new file mode 100644 index 00000000..a0c7acfb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/radix.js @@ -0,0 +1,39 @@ +/** + * @fileoverview Rule to flag use of parseInt without a radix argument + * @author James Allardice + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + "CallExpression": function(node) { + + var radix; + + if (node.callee.name === "parseInt") { + + if (node.arguments.length < 2) { + context.report(node, "Missing radix parameter."); + } else { + + radix = node.arguments[1]; + + // don't allow non-numeric literals or undefined + if ((radix.type === "Literal" && typeof radix.value !== "number") || + (radix.type === "Identifier" && radix.name === "undefined") + ) { + context.report(node, "Invalid radix parameter."); + } + } + + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/semi-spacing.js b/node_modules/standard/node_modules/eslint/lib/rules/semi-spacing.js new file mode 100644 index 00000000..05ced445 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/semi-spacing.js @@ -0,0 +1,152 @@ +/** + * @fileoverview Validates spacing before and after semicolon + * @author Mathias Schreck + * @copyright 2015 Mathias Schreck + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + + var config = context.options[0], + requireSpaceBefore = false, + requireSpaceAfter = true; + + if (typeof config === "object") { + if (config.hasOwnProperty("before")) { + requireSpaceBefore = config.before; + } + if (config.hasOwnProperty("after")) { + requireSpaceAfter = config.after; + } + } + + /** + * Determines whether two adjacent tokens are have whitespace between them. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not there is space between the tokens. + */ + function isSpaced(left, right) { + return left.range[1] < right.range[0]; + } + + /** + * Checks whether two tokens are on the same line. + * @param {Object} left The leftmost token. + * @param {Object} right The rightmost token. + * @returns {boolean} True if the tokens are on the same line, false if not. + * @private + */ + function isSameLine(left, right) { + return left.loc.end.line === right.loc.start.line; + } + + /** + * Checks if a given token has leading whitespace. + * @param {Object} token The token to check. + * @returns {boolean} True if the given token has leading space, false if not. + */ + function hasLeadingSpace(token) { + var tokenBefore = context.getTokenBefore(token); + return tokenBefore && isSameLine(tokenBefore, token) && isSpaced(tokenBefore, token); + } + + /** + * Checks if a given token has trailing whitespace. + * @param {Object} token The token to check. + * @returns {boolean} True if the given token has trailing space, false if not. + */ + function hasTrailingSpace(token) { + var tokenAfter = context.getTokenAfter(token); + return tokenAfter && isSameLine(token, tokenAfter) && isSpaced(token, tokenAfter); + } + + /** + * Checks if the given token is the last token in its line. + * @param {Token} token The token to check. + * @returns {boolean} Whether or not the token is the last in its line. + */ + function isLastTokenInCurrentLine(token) { + var tokenAfter = context.getTokenAfter(token); + return !(tokenAfter && isSameLine(token, tokenAfter)); + } + + /** + * Checks if the given token is a semicolon. + * @param {Token} token The token to check. + * @returns {boolean} Whether or not the given token is a semicolon. + */ + function isSemicolon(token) { + return token.type === "Punctuator" && token.value === ";"; + } + + /** + * Reports if the given token has invalid spacing. + * @param {Token} token The semicolon token to check. + * @param {ASTNode} node The corresponding node of the token. + * @returns {void} + */ + function checkSemicolonSpacing(token, node) { + var location; + + if (isSemicolon(token)) { + location = token.loc.start; + + if (hasLeadingSpace(token)) { + if (!requireSpaceBefore) { + context.report(node, location, "Unexpected whitespace before semicolon."); + } + } else { + if (requireSpaceBefore) { + context.report(node, location, "Missing whitespace before semicolon."); + } + } + + if (!isLastTokenInCurrentLine(token)) { + if (hasTrailingSpace(token)) { + if (!requireSpaceAfter) { + context.report(node, location, "Unexpected whitespace after semicolon."); + } + } else { + if (requireSpaceAfter) { + context.report(node, location, "Missing whitespace after semicolon."); + } + } + } + } + } + + /** + * Checks the spacing of the semicolon with the assumption that the last token is the semicolon. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkNode(node) { + var token = context.getLastToken(node); + checkSemicolonSpacing(token, node); + } + + return { + "VariableDeclaration": checkNode, + "ExpressionStatement": checkNode, + "BreakStatement": checkNode, + "ContinueStatement": checkNode, + "DebuggerStatement": checkNode, + "ReturnStatement": checkNode, + "ThrowStatement": checkNode, + "ForStatement": function (node) { + if (node.init) { + checkSemicolonSpacing(context.getTokenAfter(node.init), node); + } + + if (node.test) { + checkSemicolonSpacing(context.getTokenAfter(node.test), node); + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/semi.js b/node_modules/standard/node_modules/eslint/lib/rules/semi.js new file mode 100644 index 00000000..f7c8637e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/semi.js @@ -0,0 +1,108 @@ +/** + * @fileoverview Rule to flag missing semicolons. + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ +module.exports = function(context) { + + var OPT_OUT_PATTERN = /[\[\(\/\+\-]/; + + var always = context.options[0] !== "never"; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Check if a semicolon is unnecessary, only true if: + * - next token is on a new line and is not one of the opt-out tokens + * - next token is a valid statement divider + * @param {Token} lastToken last token of current node. + * @param {Token} nextToken next token after current node. + * @returns {boolean} whether the semicolon is unnecessary. + */ + function isUnnecessarySemicolon(lastToken, nextToken) { + + var lastTokenLine = lastToken.loc.end.line, + nextTokenLine = nextToken && nextToken.loc.start.line, + isOptOutToken = nextToken && OPT_OUT_PATTERN.test(nextToken.value), + isDivider = nextToken && (nextToken.value === "}" || nextToken.value === ";"); + + return (lastTokenLine !== nextTokenLine && !isOptOutToken) || isDivider; + } + + /** + * Checks a node to see if it's followed by a semicolon. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkForSemicolon(node) { + var lastToken = context.getLastToken(node), + nextToken = context.getTokenAfter(node); + + if (always) { + if (lastToken.type !== "Punctuator" || lastToken.value !== ";") { + context.report(node, lastToken.loc.end, "Missing semicolon."); + } + } else { + if (lastToken.type === "Punctuator" && + lastToken.value === ";" && + isUnnecessarySemicolon(lastToken, nextToken) + ) { + context.report(node, node.loc.end, "Extra semicolon."); + } + } + } + + /** + * Checks to see if there's a semicolon after a variable declaration. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkForSemicolonForVariableDeclaration(node) { + + var ancestors = context.getAncestors(), + parentIndex = ancestors.length - 1, + parent = ancestors[parentIndex]; + + if ((parent.type !== "ForStatement" || parent.init !== node) && + (!/^For(?:In|Of)Statement/.test(parent.type) || parent.left !== node) + ) { + checkForSemicolon(node); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + + "VariableDeclaration": checkForSemicolonForVariableDeclaration, + "ExpressionStatement": checkForSemicolon, + "ReturnStatement": checkForSemicolon, + "ThrowStatement": checkForSemicolon, + "DebuggerStatement": checkForSemicolon, + "BreakStatement": checkForSemicolon, + "ContinueStatement": checkForSemicolon, + "EmptyStatement": function (node) { + var lastToken, nextToken; + + if (!always) { + lastToken = context.getLastToken(node); + nextToken = context.getTokenAfter(node) || context.getLastToken(node); + + if (isUnnecessarySemicolon(lastToken, nextToken)) { + context.report(node, "Extra semicolon."); + } + } + + + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/sort-vars.js b/node_modules/standard/node_modules/eslint/lib/rules/sort-vars.js new file mode 100644 index 00000000..8d4b6a89 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/sort-vars.js @@ -0,0 +1,37 @@ +/** + * @fileoverview Rule to require sorting of variables within a single Variable Declaration block + * @author Ilya Volodin + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var configuration = context.options[0] || {}, + ignoreCase = configuration.ignoreCase || false; + + return { + "VariableDeclaration": function(node) { + node.declarations.reduce(function(memo, decl) { + var lastVariableName = memo.id.name, + currenVariableName = decl.id.name; + + if (ignoreCase) { + lastVariableName = lastVariableName.toLowerCase(); + currenVariableName = currenVariableName.toLowerCase(); + } + + if (currenVariableName < lastVariableName) { + context.report(decl, "Variables within the same declaration block should be sorted alphabetically"); + return memo; + } else { + return decl; + } + }, node.declarations[0]); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-after-function-name.js b/node_modules/standard/node_modules/eslint/lib/rules/space-after-function-name.js new file mode 100644 index 00000000..c477768c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-after-function-name.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Rule to enforce consistent spacing after function names + * @author Roberto Vidal + * @copyright 2014 Roberto Vidal. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var requiresSpace = context.options[0] === "always"; + + /** + * Reports if the give named function node has the correct spacing after its name + * + * @param {ASTNode} node The node to which the potential problem belongs. + * @returns {void} + */ + function check(node) { + var tokens = context.getFirstTokens(node, 3), + hasSpace = tokens[1].range[1] < tokens[2].range[0]; + + if (hasSpace !== requiresSpace) { + context.report(node, "Function name \"{{name}}\" must {{not}}be followed by whitespace.", { + name: node.id.name, + not: requiresSpace ? "" : "not " + }); + } + } + + return { + "FunctionDeclaration": check, + "FunctionExpression": function (node) { + if (node.id) { + check(node); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-after-keywords.js b/node_modules/standard/node_modules/eslint/lib/rules/space-after-keywords.js new file mode 100644 index 00000000..3ece8bb0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-after-keywords.js @@ -0,0 +1,76 @@ +/** + * @fileoverview Rule to enforce the number of spaces after certain keywords + * @author Nick Fisher + * @copyright 2014 Nick Fisher. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + // unless the first option is `"never"`, then a space is required + var requiresSpace = context.options[0] !== "never"; + + /** + * Check if the separation of two adjacent tokens meets the spacing rules, and report a problem if not. + * + * @param {ASTNode} node The node to which the potential problem belongs. + * @param {Token} left The first token. + * @param {Token} right The second token + * @returns {void} + */ + function checkTokens(node, left, right) { + var hasSpace = left.range[1] < right.range[0], + value = left.value; + + if (hasSpace !== requiresSpace) { + context.report(node, "Keyword \"{{value}}\" must {{not}}be followed by whitespace.", { + value: value, + not: requiresSpace ? "" : "not " + }); + } + } + + /** + * Check if the given node (`if`, `for`, `while`, etc), has the correct spacing after it. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function check(node) { + var tokens = context.getFirstTokens(node, 2); + checkTokens(node, tokens[0], tokens[1]); + } + + return { + "IfStatement": function (node) { + check(node); + // check the `else` + if (node.alternate && node.alternate.type !== "IfStatement") { + checkTokens(node.alternate, context.getTokenBefore(node.alternate), context.getFirstToken(node.alternate)); + } + }, + "ForStatement": check, + "ForOfStatement": check, + "ForInStatement": check, + "WhileStatement": check, + "DoWhileStatement": function (node) { + check(node); + // check the `while` + var whileTokens = context.getTokensBefore(node.test, 2); + checkTokens(node, whileTokens[0], whileTokens[1]); + }, + "SwitchStatement": check, + "TryStatement": function (node) { + check(node); + // check the `finally` + if (node.finalizer) { + checkTokens(node.finalizer, context.getTokenBefore(node.finalizer), context.getFirstToken(node.finalizer)); + } + }, + "CatchStatement": check, + "WithStatement": check + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-before-blocks.js b/node_modules/standard/node_modules/eslint/lib/rules/space-before-blocks.js new file mode 100644 index 00000000..963ff425 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-before-blocks.js @@ -0,0 +1,85 @@ +/** + * @fileoverview A rule to ensure whitespace before blocks. + * @author Mathias Schreck + * @copyright 2014 Mathias Schreck. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + var requireSpace = context.options[0] !== "never"; + + /** + * Determines whether two adjacent tokens are have whitespace between them. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not there is space between the tokens. + */ + function isSpaced(left, right) { + return left.range[1] < right.range[0]; + } + + /** + * Determines whether two adjacent tokens are on the same line. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not the tokens are on the same line. + */ + function isSameLine(left, right) { + return left.loc.start.line === right.loc.start.line; + } + + /** + * Checks the given BlockStatement node has a preceding space if it doesn’t start on a new line. + * @param {ASTNode|Token} node The AST node of a BlockStatement. + * @returns {void} undefined. + */ + function checkPrecedingSpace(node) { + var precedingToken = context.getTokenBefore(node), + hasSpace; + + if (precedingToken && isSameLine(precedingToken, node)) { + hasSpace = isSpaced(precedingToken, node); + + if (requireSpace) { + if (!hasSpace) { + context.report(node, "Missing space before opening brace."); + } + } else { + if (hasSpace) { + context.report(node, "Unexpected space before opening brace."); + } + } + } + } + + /** + * Checks if the CaseBlock of an given SwitchStatement node has a preceding space. + * @param {ASTNode} node The node of a SwitchStatement. + * @returns {void} undefined. + */ + function checkSpaceBeforeCaseBlock(node) { + var cases = node.cases, + firstCase, + openingBrace; + + if (cases.length > 0) { + firstCase = cases[0]; + openingBrace = context.getTokenBefore(firstCase); + } else { + openingBrace = context.getLastToken(node, 1); + } + + checkPrecedingSpace(openingBrace); + } + + return { + "BlockStatement": checkPrecedingSpace, + "SwitchStatement": checkSpaceBeforeCaseBlock + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-before-function-paren.js b/node_modules/standard/node_modules/eslint/lib/rules/space-before-function-paren.js new file mode 100644 index 00000000..b56409ad --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-before-function-paren.js @@ -0,0 +1,117 @@ +/** + * @fileoverview Rule to validate spacing before function paren. + * @author Mathias Schreck + * @copyright 2015 Mathias Schreck + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var configuration = context.options[0], + requireAnonymousFunctionSpacing = true, + requireNamedFunctionSpacing = true; + + if (typeof configuration === "object") { + requireAnonymousFunctionSpacing = configuration.anonymous !== "never"; + requireNamedFunctionSpacing = configuration.named !== "never"; + } else if (configuration === "never") { + requireAnonymousFunctionSpacing = false; + requireNamedFunctionSpacing = false; + } + + /** + * Determines whether two adjacent tokens are have whitespace between them. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not there is space between the tokens. + */ + function isSpaced(left, right) { + return left.range[1] < right.range[0]; + } + + /** + * Determines whether a function has a name. + * @param {ASTNode} node The function node. + * @returns {boolean} Whether the function has a name. + */ + function isNamedFunction(node) { + var parent; + + if (node.id) { + return true; + } + + parent = context.getAncestors().pop(); + return parent.type === "MethodDefinition" || + (parent.type === "Property" && + ( + parent.kind === "get" || + parent.kind === "set" || + parent.method + ) + ); + } + + /** + * Validates the spacing before function parentheses. + * @param {ASTNode} node The node to be validated. + * @returns {void} + */ + function validateSpacingBeforeParentheses(node) { + var isNamed = isNamedFunction(node), + tokens, + leftToken, + rightToken, + location; + + if (node.generator && !isNamed) { + return; + } + + tokens = context.getTokens(node); + + if (node.generator) { + if (node.id) { + leftToken = tokens[2]; + rightToken = tokens[3]; + } else { + // Object methods are named but don't have an id + leftToken = context.getTokenBefore(node); + rightToken = tokens[0]; + } + } else if (isNamed) { + if (node.id) { + leftToken = tokens[1]; + rightToken = tokens[2]; + } else { + // Object methods are named but don't have an id + leftToken = context.getTokenBefore(node); + rightToken = tokens[0]; + } + } else { + leftToken = tokens[0]; + rightToken = tokens[1]; + } + + location = leftToken.loc.end; + + if (isSpaced(leftToken, rightToken)) { + if ((isNamed && !requireNamedFunctionSpacing) || (!isNamed && !requireAnonymousFunctionSpacing)) { + context.report(node, location, "Unexpected space before function parentheses."); + } + } else { + if ((isNamed && requireNamedFunctionSpacing) || (!isNamed && requireAnonymousFunctionSpacing)) { + context.report(node, location, "Missing space before function parentheses."); + } + } + } + + return { + "FunctionDeclaration": validateSpacingBeforeParentheses, + "FunctionExpression": validateSpacingBeforeParentheses + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-before-function-parentheses.js b/node_modules/standard/node_modules/eslint/lib/rules/space-before-function-parentheses.js new file mode 100644 index 00000000..b40351d0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-before-function-parentheses.js @@ -0,0 +1,117 @@ +/** + * @fileoverview Rule to validate spacing before function parentheses. + * @author Mathias Schreck + * @copyright 2015 Mathias Schreck + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var configuration = context.options[0], + requireAnonymousFunctionSpacing = true, + requireNamedFunctionSpacing = true; + + if (typeof configuration === "object") { + requireAnonymousFunctionSpacing = configuration.anonymous !== "never"; + requireNamedFunctionSpacing = configuration.named !== "never"; + } else if (configuration === "never") { + requireAnonymousFunctionSpacing = false; + requireNamedFunctionSpacing = false; + } + + /** + * Determines whether two adjacent tokens are have whitespace between them. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not there is space between the tokens. + */ + function isSpaced(left, right) { + return left.range[1] < right.range[0]; + } + + /** + * Determines whether a function has a name. + * @param {ASTNode} node The function node. + * @returns {boolean} Whether the function has a name. + */ + function isNamedFunction(node) { + var parent; + + if (node.id) { + return true; + } + + parent = context.getAncestors().pop(); + return parent.type === "MethodDefinition" || + (parent.type === "Property" && + ( + parent.kind === "get" || + parent.kind === "set" || + parent.method + ) + ); + } + + /** + * Validates the spacing before function parentheses. + * @param {ASTNode} node The node to be validated. + * @returns {void} + */ + function validateSpacingBeforeParentheses(node) { + var isNamed = isNamedFunction(node), + tokens, + leftToken, + rightToken, + location; + + if (node.generator && !isNamed) { + return; + } + + tokens = context.getTokens(node); + + if (node.generator) { + if (node.id) { + leftToken = tokens[2]; + rightToken = tokens[3]; + } else { + // Object methods are named but don't have an id + leftToken = context.getTokenBefore(node); + rightToken = tokens[0]; + } + } else if (isNamed) { + if (node.id) { + leftToken = tokens[1]; + rightToken = tokens[2]; + } else { + // Object methods are named but don't have an id + leftToken = context.getTokenBefore(node); + rightToken = tokens[0]; + } + } else { + leftToken = tokens[0]; + rightToken = tokens[1]; + } + + location = leftToken.loc.end; + + if (isSpaced(leftToken, rightToken)) { + if ((isNamed && !requireNamedFunctionSpacing) || (!isNamed && !requireAnonymousFunctionSpacing)) { + context.report(node, location, "Unexpected space before function parentheses."); + } + } else { + if ((isNamed && requireNamedFunctionSpacing) || (!isNamed && requireAnonymousFunctionSpacing)) { + context.report(node, location, "Missing space before function parentheses."); + } + } + } + + return { + "FunctionDeclaration": validateSpacingBeforeParentheses, + "FunctionExpression": validateSpacingBeforeParentheses + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-in-brackets.js b/node_modules/standard/node_modules/eslint/lib/rules/space-in-brackets.js new file mode 100644 index 00000000..e39f3a59 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-in-brackets.js @@ -0,0 +1,229 @@ +/** + * @fileoverview Disallows or enforces spaces inside of brackets. + * @author Ian Christian Myers + * @copyright 2014 Brandyn Bennett. All rights reserved. + * @copyright 2014 Michael Ficarra. No rights reserved. + * @copyright 2014 Vignesh Anand. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var spaced = context.options[0] === "always"; + + /** + * Determines whether an option is set, relative to the spacing option. + * If spaced is "always", then check whether option is set to false. + * If spaced is "never", then check whether option is set to true. + * @param {Object} option - The option to exclude. + * @returns {boolean} Whether or not the property is excluded. + */ + function isOptionSet(option) { + return context.options[1] != null ? context.options[1][option] === !spaced : false; + } + + var options = { + spaced: spaced, + singleElementException: isOptionSet("singleValue"), + objectsInArraysException: isOptionSet("objectsInArrays"), + arraysInArraysException: isOptionSet("arraysInArrays"), + arraysInObjectsException: isOptionSet("arraysInObjects"), + objectsInObjectsException: isOptionSet("objectsInObjects"), + propertyNameException: isOptionSet("propertyName") + }; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines whether two adjacent tokens are have whitespace between them. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not there is space between the tokens. + */ + function isSpaced(left, right) { + return left.range[1] < right.range[0]; + } + + /** + * Determines whether two adjacent tokens are on the same line. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not the tokens are on the same line. + */ + function isSameLine(left, right) { + return left.loc.start.line === right.loc.start.line; + } + + /** + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportNoBeginningSpace(node, token) { + context.report(node, token.loc.start, + "There should be no space after '" + token.value + "'"); + } + + /** + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportNoEndingSpace(node, token) { + context.report(node, token.loc.start, + "There should be no space before '" + token.value + "'"); + } + + /** + * Reports that there should be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportRequiredBeginningSpace(node, token) { + context.report(node, token.loc.start, + "A space is required after '" + token.value + "'"); + } + + /** + * Reports that there should be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportRequiredEndingSpace(node, token) { + context.report(node, token.loc.start, + "A space is required before '" + token.value + "'"); + } + + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + MemberExpression: function(node) { + if (!node.computed) { + return; + } + + var property = node.property, + before = context.getTokenBefore(property), + first = context.getFirstToken(property), + last = context.getLastToken(property), + after = context.getTokenAfter(property); + + var propertyNameMustBeSpaced = options.propertyNameException ? + !options.spaced : options.spaced; + + if (isSameLine(before, first)) { + if (propertyNameMustBeSpaced) { + if (!isSpaced(before, first) && isSameLine(before, first)) { + reportRequiredBeginningSpace(node, before); + } + } else { + if (isSpaced(before, first)) { + reportNoBeginningSpace(node, before); + } + } + } + + if (isSameLine(last, after)) { + if (propertyNameMustBeSpaced) { + if (!isSpaced(last, after) && isSameLine(last, after)) { + reportRequiredEndingSpace(node, after); + } + } else { + if (isSpaced(last, after)) { + reportNoEndingSpace(node, after); + } + } + } + }, + + ArrayExpression: function(node) { + if (node.elements.length === 0) { + return; + } + + var first = context.getFirstToken(node), + second = context.getFirstToken(node, 1), + penultimate = context.getLastToken(node, 1), + last = context.getLastToken(node); + + var openingBracketMustBeSpaced = + options.objectsInArraysException && second.value === "{" || + options.arraysInArraysException && second.value === "[" || + options.singleElementException && node.elements.length === 1 + ? !options.spaced : options.spaced; + + var closingBracketMustBeSpaced = + options.objectsInArraysException && penultimate.value === "}" || + options.arraysInArraysException && penultimate.value === "]" || + options.singleElementException && node.elements.length === 1 + ? !options.spaced : options.spaced; + + if (isSameLine(first, second)) { + if (openingBracketMustBeSpaced && !isSpaced(first, second)) { + reportRequiredBeginningSpace(node, first); + } + if (!openingBracketMustBeSpaced && isSpaced(first, second)) { + reportNoBeginningSpace(node, first); + } + } + + if (isSameLine(penultimate, last)) { + if (closingBracketMustBeSpaced && !isSpaced(penultimate, last)) { + reportRequiredEndingSpace(node, last); + } + if (!closingBracketMustBeSpaced && isSpaced(penultimate, last)) { + reportNoEndingSpace(node, last); + } + } + }, + + ObjectExpression: function(node) { + if (node.properties.length === 0) { + return; + } + + var first = context.getFirstToken(node), + second = context.getFirstToken(node, 1), + penultimate = context.getLastToken(node, 1), + last = context.getLastToken(node); + + var closingCurlyBraceMustBeSpaced = + options.arraysInObjectsException && penultimate.value === "]" || + options.objectsInObjectsException && penultimate.value === "}" + ? !options.spaced : options.spaced; + + if (isSameLine(first, second)) { + if (options.spaced && !isSpaced(first, second)) { + reportRequiredBeginningSpace(node, first); + } + if (!options.spaced && isSpaced(first, second)) { + reportNoBeginningSpace(node, first); + } + } + + if (isSameLine(penultimate, last)) { + if (closingCurlyBraceMustBeSpaced && !isSpaced(penultimate, last)) { + reportRequiredEndingSpace(node, last); + } + if (!closingCurlyBraceMustBeSpaced && isSpaced(penultimate, last)) { + reportNoEndingSpace(node, last); + } + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-in-parens.js b/node_modules/standard/node_modules/eslint/lib/rules/space-in-parens.js new file mode 100644 index 00000000..c7f7f5c1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-in-parens.js @@ -0,0 +1,262 @@ +/** + * @fileoverview Disallows or enforces spaces inside of parentheses. + * @author Jonathan Rajavuori + * @copyright 2014 David Clark. All rights reserved. + * @copyright 2014 Jonathan Rajavuori. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var MISSING_SPACE_MESSAGE = "There must be a space inside this paren.", + REJECTED_SPACE_MESSAGE = "There should be no spaces inside this paren.", + exceptionsArray = (context.options.length === 2) ? context.options[1].exceptions : [], + options = {}, + rejectedSpaceRegExp, + missingSpaceRegExp, + spaceChecks; + + if (exceptionsArray && exceptionsArray.length) { + options.braceException = exceptionsArray.indexOf("{}") !== -1 || false; + options.bracketException = exceptionsArray.indexOf("[]") !== -1 || false; + options.parenException = exceptionsArray.indexOf("()") !== -1 || false; + options.empty = exceptionsArray.indexOf("empty") !== -1 || false; + } + + /** + * Used with the `never` option to produce, given the exception options, + * two regular expressions to check for missing and rejected spaces. + * @param {Object} opts The exception options + * @returns {Object} `missingSpace` and `rejectedSpace` regular expressions + * @private + */ + function getNeverChecks(opts) { + var missingSpaceOpeners = [], + missingSpaceClosers = [], + rejectedSpaceOpeners = [" ", "\\n", "\\r"], + rejectedSpaceClosers = [" ", "\\n", "\\r"], + missingSpaceCheck, + rejectedSpaceCheck; + + // Populate openers and closers + if (opts.braceException) { + missingSpaceOpeners.push("\\{"); + missingSpaceClosers.push("\\}"); + rejectedSpaceOpeners.push("\\{"); + rejectedSpaceClosers.push("\\}"); + } + if (opts.bracketException) { + missingSpaceOpeners.push("\\["); + missingSpaceClosers.push("\\]"); + rejectedSpaceOpeners.push("\\["); + rejectedSpaceClosers.push("\\]"); + } + if (opts.parenException) { + missingSpaceOpeners.push("\\("); + missingSpaceClosers.push("\\)"); + rejectedSpaceOpeners.push("\\("); + rejectedSpaceClosers.push("\\)"); + } + if (opts.empty) { + missingSpaceOpeners.push("\\)"); + missingSpaceClosers.push("\\("); + rejectedSpaceOpeners.push("\\)"); + rejectedSpaceClosers.push("\\("); + } + + if (missingSpaceOpeners.length) { + missingSpaceCheck = "\\((" + missingSpaceOpeners.join("|") + ")"; + if (missingSpaceClosers.length) { + missingSpaceCheck += "|"; + } + } + if (missingSpaceClosers.length) { + missingSpaceCheck += "(" + missingSpaceClosers.join("|") + ")\\)"; + } + + // compose the rejected regexp + rejectedSpaceCheck = "\\( +[^" + rejectedSpaceOpeners.join("") + "]"; + rejectedSpaceCheck += "|[^" + rejectedSpaceClosers.join("") + "] +\\)"; + + return { + // e.g. \((\{)|(\})\) --- where {} is an exception + missingSpace: missingSpaceCheck || ".^", + // e.g. \( +[^ \n\r\{]|[^ \n\r\}] +\) --- where {} is an exception + rejectedSpace: rejectedSpaceCheck + }; + } + + /** + * Used with the `always` option to produce, given the exception options, + * two regular expressions to check for missing and rejected spaces. + * @param {Object} opts The exception options + * @returns {Object} `missingSpace` and `rejectedSpace` regular expressions + * @private + */ + function getAlwaysChecks(opts) { + var missingSpaceOpeners = [" ", "\\)", "\\r", "\\n"], + missingSpaceClosers = [" ", "\\(", "\\r", "\\n"], + rejectedSpaceOpeners = [], + rejectedSpaceClosers = [], + missingSpaceCheck, + rejectedSpaceCheck; + + // Populate openers and closers + if (opts.braceException) { + missingSpaceOpeners.push("\\{"); + missingSpaceClosers.push("\\}"); + rejectedSpaceOpeners.push(" \\{"); + rejectedSpaceClosers.push("\\} "); + } + if (opts.bracketException) { + missingSpaceOpeners.push("\\["); + missingSpaceClosers.push("\\]"); + rejectedSpaceOpeners.push(" \\["); + rejectedSpaceClosers.push("\\] "); + } + if (opts.parenException) { + missingSpaceOpeners.push("\\("); + missingSpaceClosers.push("\\)"); + rejectedSpaceOpeners.push(" \\("); + rejectedSpaceClosers.push("\\) "); + } + if (opts.empty) { + rejectedSpaceOpeners.push(" \\)"); + rejectedSpaceClosers.push("\\( "); + } + + // compose the allowed regexp + missingSpaceCheck = "\\([^" + missingSpaceOpeners.join("") + "]"; + missingSpaceCheck += "|[^" + missingSpaceClosers.join("") + "]\\)"; + + // compose the rejected regexp + if (rejectedSpaceOpeners.length) { + rejectedSpaceCheck = "\\((" + rejectedSpaceOpeners.join("|") + ")"; + if (rejectedSpaceClosers.length) { + rejectedSpaceCheck += "|"; + } + } + if (rejectedSpaceClosers.length) { + rejectedSpaceCheck += "(" + rejectedSpaceClosers.join("|") + ")\\)"; + } + + return { + // e.g. \([^ \)\r\n\{]|[^ \(\r\n\}]\) --- where {} is an exception + missingSpace: missingSpaceCheck, + // e.g. \(( \{})|(\} )\) --- where {} is an excpetion + rejectedSpace: rejectedSpaceCheck || ".^" + }; + } + + spaceChecks = (context.options[0] === "always") ? getAlwaysChecks(options) : getNeverChecks(options); + missingSpaceRegExp = new RegExp(spaceChecks.missingSpace, "mg"); + rejectedSpaceRegExp = new RegExp(spaceChecks.rejectedSpace, "mg"); + + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + var skipRanges = []; + + /** + * Adds the range of a node to the set to be skipped when checking parens + * @param {ASTNode} node The node to skip + * @returns {void} + * @private + */ + function addSkipRange(node) { + skipRanges.push(node.range); + } + + /** + * Sorts the skipRanges array. Must be called before shouldSkip + * @returns {void} + * @private + */ + function sortSkipRanges() { + skipRanges.sort(function (a, b) { + return a[0] - b[0]; + }); + } + + /** + * Checks if a certain position in the source should be skipped + * @param {Number} pos The 0-based index in the source + * @returns {boolean} whether the position should be skipped + * @private + */ + function shouldSkip(pos) { + var i, len, range; + for (i = 0, len = skipRanges.length; i < len; i += 1) { + range = skipRanges[i]; + if (pos < range[0]) { + break; + } else if (pos < range[1]) { + return true; + } + } + return false; + } + + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "Program:exit": function checkParenSpaces(node) { + + var nextMatch, + nextLine, + column, + line = 1, + source = context.getSource(), + pos = 0; + + function checkMatch(match, message) { + if (source.charAt(match.index) !== "(") { + // Matched a closing paren pattern + match.index += 1; + } + + if (!shouldSkip(match.index)) { + while ((nextLine = source.indexOf("\n", pos)) !== -1 && nextLine < match.index) { + pos = nextLine + 1; + line += 1; + } + column = match.index - pos; + + context.report(node, { line: line, column: column }, message); + } + } + + sortSkipRanges(); + + while ((nextMatch = rejectedSpaceRegExp.exec(source)) !== null) { + checkMatch(nextMatch, REJECTED_SPACE_MESSAGE); + } + + while ((nextMatch = missingSpaceRegExp.exec(source)) !== null) { + checkMatch(nextMatch, MISSING_SPACE_MESSAGE); + } + + }, + + + // These nodes can contain parentheses that this rule doesn't care about + + LineComment: addSkipRange, + + BlockComment: addSkipRange, + + Literal: addSkipRange + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-infix-ops.js b/node_modules/standard/node_modules/eslint/lib/rules/space-infix-ops.js new file mode 100644 index 00000000..41659879 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-infix-ops.js @@ -0,0 +1,68 @@ +/** + * @fileoverview Require spaces around infix operators + * @author Michael Ficarra + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var int32Hint = context.options[0] ? context.options[0].int32Hint === true : false; + + var OPERATORS = [ + "*", "/", "%", "+", "-", "<<", ">>", ">>>", "<", "<=", ">", ">=", "in", + "instanceof", "==", "!=", "===", "!==", "&", "^", "|", "&&", "||", "=", + "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", + "?", ":", "," + ]; + + function isSpaced(left, right) { + var op, tokens = context.getTokensBetween(left, right, 1); + for (var i = 1, l = tokens.length - 1; i < l; ++i) { + op = tokens[i]; + if ( + op.type === "Punctuator" && + OPERATORS.indexOf(op.value) >= 0 && + (tokens[i - 1].range[1] >= op.range[0] || op.range[1] >= tokens[i + 1].range[0]) + ) { + return false; + } + } + return true; + } + + function report(node) { + context.report(node, "Infix operators must be spaced."); + } + + function checkBinary(node) { + if (!isSpaced(node.left, node.right)) { + if (!(int32Hint && context.getSource(node).substr(-2) === "|0")) { + report(node); + } + } + } + + function checkConditional(node) { + if (!isSpaced(node.test, node.consequent) || !isSpaced(node.consequent, node.alternate)) { + report(node); + } + } + + function checkVar(node) { + if (node.init && !isSpaced(node.id, node.init)) { + report(node); + } + } + + return { + "AssignmentExpression": checkBinary, + "BinaryExpression": checkBinary, + "LogicalExpression": checkBinary, + "ConditionalExpression": checkConditional, + "VariableDeclarator": checkVar + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-return-throw-case.js b/node_modules/standard/node_modules/eslint/lib/rules/space-return-throw-case.js new file mode 100644 index 00000000..27928ade --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-return-throw-case.js @@ -0,0 +1,36 @@ +/** + * @fileoverview Require spaces following return, throw, and case + * @author Michael Ficarra + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + function check(node) { + var tokens = context.getFirstTokens(node, 2), + value = tokens[0].value; + + if (tokens[0].range[1] >= tokens[1].range[0]) { + context.report(node, "Keyword \"" + value + "\" must be followed by whitespace."); + } + } + + return { + "ReturnStatement": function(node) { + if (node.argument) { + check(node); + } + }, + "SwitchCase": function(node) { + if (node.test) { + check(node); + } + }, + "ThrowStatement": check + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/space-unary-ops.js b/node_modules/standard/node_modules/eslint/lib/rules/space-unary-ops.js new file mode 100644 index 00000000..2fe8a3f4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/space-unary-ops.js @@ -0,0 +1,118 @@ +/** + * @fileoverview This rule shoud require or disallow spaces before or after unary operations. + * @author Marcin Kumorek + * @copyright 2014 Marcin Kumorek. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var options = context.options && Array.isArray(context.options) && context.options[0] || { words: true, nonwords: false }; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Check if the parent unary operator is "!" in order to know if it's "!!" convert to Boolean or just "!" negation + * @param {ASTnode} node AST node + * @returns {boolean} Whether or not the parent is unary "!" operator + */ + function isParentUnaryBangExpression(node) { + return node && node.parent && node.parent.type === "UnaryExpression" && node.parent.operator === "!"; + } + + /** + * Checks if the type is a unary word expression + * @param {string} type value of AST token + * @returns {boolean} Whether the word is in the list of known words + */ + function isWordExpression(type) { + return ["delete", "new", "typeof", "void"].indexOf(type) !== -1; + } + + /** + * Check if the node's child argument is an "ObjectExpression" + * @param {ASTnode} node AST node + * @returns {boolean} Whether or not the argument's type is "ObjectExpression" + */ + function isArgumentObjectExpression(node) { + return node.argument && node.argument.type && node.argument.type === "ObjectExpression"; + } + + /** + * Check Unary Word Operators for spaces after the word operator + * @param {ASTnode} node AST node + * @param {object} firstToken first token from the AST node + * @param {object} secondToken second token from the AST node + * @returns {void} + */ + function checkUnaryWordOperatorForSpaces(node, firstToken, secondToken) { + if (options.words) { + if (secondToken.range[0] === firstToken.range[1]) { + context.report(node, "Unary word operator \"" + firstToken.value + "\" must be followed by whitespace."); + } + } + + if (!options.words && isArgumentObjectExpression(node)) { + if (secondToken.range[0] > firstToken.range[1]) { + context.report(node, "Unexpected space after unary word operator \"" + firstToken.value + "\"."); + } + } + } + + /** + * Checks UnaryExpression, UpdateExpression and NewExpression for spaces before and after the operator + * @param {ASTnode} node AST node + * @returns {void} + */ + function checkForSpaces(node) { + var tokens = context.getFirstTokens(node, 2), + firstToken = tokens[0], + secondToken = tokens[1]; + + if (isWordExpression(firstToken.value)) { + checkUnaryWordOperatorForSpaces(node, firstToken, secondToken); + return void 0; + } + + if (options.nonwords) { + if (node.prefix) { + if (isParentUnaryBangExpression(node)) { + return void 0; + } + if (firstToken.range[1] === secondToken.range[0]) { + context.report(node, "Unary operator \"" + firstToken.value + "\" must be followed by whitespace."); + } + } else { + if (firstToken.range[1] === secondToken.range[0]) { + context.report(node, "Space is required before unary expressions \"" + secondToken.value + "\"."); + } + } + } else { + if (node.prefix) { + if (secondToken.range[0] > firstToken.range[1]) { + context.report(node, "Unexpected space after unary operator \"" + firstToken.value + "\"."); + } + } else { + if (secondToken.range[0] > firstToken.range[1]) { + context.report(node, "Unexpected space before unary operator \"" + secondToken.value + "\"."); + } + } + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "UnaryExpression": checkForSpaces, + "UpdateExpression": checkForSpaces, + "NewExpression": checkForSpaces + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/spaced-line-comment.js b/node_modules/standard/node_modules/eslint/lib/rules/spaced-line-comment.js new file mode 100644 index 00000000..af5ba8cd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/spaced-line-comment.js @@ -0,0 +1,71 @@ +/** + * @fileoverview Enforces or disallows a space beginning a single-line comment. + * @author Greg Cochard + * @copyright 2014 Greg Cochard. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + // Unless the first option is never, require a space + var requireSpace = context.options[0] !== "never"; + + // Default to match anything, so all will fail if there are no exceptions + var exceptionMatcher = new RegExp(" "); + + // Grab the exceptions array and build a RegExp matcher for it + var hasExceptions = context.options.length === 2; + var unescapedExceptions = hasExceptions ? context.options[1].exceptions : []; + var exceptions; + + if (unescapedExceptions.length) { + exceptions = unescapedExceptions.map(function(s) { + return s.replace(/([.*+?${}()|\^\[\]\/\\])/g, "\\$1"); + }); + exceptionMatcher = new RegExp("(^(" + exceptions.join(")+$)|(^(") + ")+$)"); + } + + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "LineComment": function checkCommentForSpace(node) { + + if (requireSpace) { + + // If length is zero, ignore it + if (node.value.length === 0) { + return; + } + + // Space expected and not found + if (node.value.indexOf(" ") !== 0 && node.value.indexOf("\t") !== 0) { + + /* + * Do two tests; one for space starting the line, + * and one for a comment comprised only of exceptions + */ + if (hasExceptions && !exceptionMatcher.test(node.value)) { + context.report(node, "Expected exception block, space or tab after // in comment."); + } else if (!hasExceptions) { + context.report(node, "Expected space or tab after // in comment."); + } + } + + } else { + + if (node.value.indexOf(" ") === 0 || node.value.indexOf("\t") === 0) { + context.report(node, "Unexpected space or tab after // in comment."); + } + } + } + + }; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/strict.js b/node_modules/standard/node_modules/eslint/lib/rules/strict.js new file mode 100644 index 00000000..16d86128 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/strict.js @@ -0,0 +1,236 @@ +/** + * @fileoverview Rule to control usage of strict mode directives. + * @author Brandon Mills + * @copyright 2015 Brandon Mills. All rights reserved. + * @copyright 2013-2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2013 Ian Christian Myers. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +var messages = { + function: "Use the function form of \"use strict\".", + global: "Use the global form of \"use strict\".", + multiple: "Multiple \"use strict\" directives.", + never: "Strict mode is not permitted.", + unnecessary: "Unnecessary \"use strict\" directive." +}; + +/** + * Gets all of the Use Strict Directives in the Directive Prologue of a group of + * statements. + * @param {ASTNode[]} statements Statements in the program or function body. + * @returns {ASTNode[]} All of the Use Strict Directives. + */ +function getUseStrictDirectives(statements) { + var directives = [], + i, statement; + + for (i = 0; i < statements.length; i++) { + statement = statements[i]; + + if ( + statement.type === "ExpressionStatement" && + statement.expression.type === "Literal" && + statement.expression.value === "use strict" + ) { + directives[i] = statement; + } else { + break; + } + } + + return directives; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var mode = context.options[0], + isModule = context.ecmaFeatures.modules, + modes = {}, + scopes = []; + + /** + * Report a node or array of nodes with a given message. + * @param {(ASTNode|ASTNode[])} nodes Node or nodes to report. + * @param {string} message Message to display. + * @returns {void} + */ + function report(nodes, message) { + var i; + + if (Array.isArray(nodes)) { + for (i = 0; i < nodes.length; i++) { + context.report(nodes[i], message); + } + } else { + context.report(nodes, message); + } + } + + //-------------------------------------------------------------------------- + // "deprecated" mode (default) + //-------------------------------------------------------------------------- + + /** + * Determines if a given node is "use strict". + * @param {ASTNode} node The node to check. + * @returns {boolean} True if the node is a strict pragma, false if not. + * @void + */ + function isStrictPragma(node) { + return (node && node.type === "ExpressionStatement" && + node.expression.value === "use strict"); + } + + /** + * When you enter a scope, push the strict value from the previous scope + * onto the stack. + * @param {ASTNode} node The AST node being checked. + * @returns {void} + * @private + */ + function enterScope(node) { + + var isStrict = false, + isProgram = (node.type === "Program"), + isParentGlobal = scopes.length === 1, + isParentStrict = scopes.length ? scopes[scopes.length - 1] : false; + + // look for the "use strict" pragma + if (isModule) { + isStrict = true; + } else if (isProgram) { + isStrict = isStrictPragma(node.body[0]) || isParentStrict; + } else { + isStrict = node.body.body && isStrictPragma(node.body.body[0]) || isParentStrict; + } + + scopes.push(isStrict); + + // never warn if the parent is strict or the function is strict + if (!isParentStrict && !isStrict && isParentGlobal) { + context.report(node, "Missing \"use strict\" statement."); + } + } + + /** + * When you exit a scope, pop off the top scope and see if it's true or + * false. + * @returns {void} + * @private + */ + function exitScope() { + scopes.pop(); + } + + modes.deprecated = { + "Program": enterScope, + "FunctionDeclaration": enterScope, + "FunctionExpression": enterScope, + "ArrowFunctionExpression": enterScope, + + "Program:exit": exitScope, + "FunctionDeclaration:exit": exitScope, + "FunctionExpression:exit": exitScope, + "ArrowFunctionExpression:exit": exitScope + }; + + //-------------------------------------------------------------------------- + // "never" mode + //-------------------------------------------------------------------------- + + modes.never = { + "Program": function(node) { + report(getUseStrictDirectives(node.body), messages.never); + }, + "FunctionDeclaration": function(node) { + report(getUseStrictDirectives(node.body.body), messages.never); + }, + "FunctionExpression": function(node) { + report(getUseStrictDirectives(node.body.body), messages.never); + } + }; + + //-------------------------------------------------------------------------- + // "global" mode + //-------------------------------------------------------------------------- + + modes.global = { + "Program": function(node) { + var useStrictDirectives = getUseStrictDirectives(node.body); + + if (!isModule && node.body.length && useStrictDirectives.length < 1) { + report(node, messages.global); + } else if (isModule) { + report(useStrictDirectives, messages.unnecessary); + } else { + report(useStrictDirectives.slice(1), messages.multiple); + } + }, + "FunctionDeclaration": function(node) { + report(getUseStrictDirectives(node.body.body), messages.global); + }, + "FunctionExpression": function(node) { + report(getUseStrictDirectives(node.body.body), messages.global); + } + }; + + //-------------------------------------------------------------------------- + // "function" mode + //-------------------------------------------------------------------------- + + /** + * Entering a function pushes a new nested scope onto the stack. The new + * scope is true if the nested function is strict mode code. + * @param {ASTNode} node The function declaration or expression. + * @returns {void} + */ + function enterFunction(node) { + var useStrictDirectives = getUseStrictDirectives(node.body.body), + isParentGlobal = scopes.length === 0, + isParentStrict = isModule || (scopes.length && scopes[scopes.length - 1]), + isStrict = useStrictDirectives.length > 0 || isModule; + + if (isStrict) { + if (isParentStrict && useStrictDirectives.length) { + report(useStrictDirectives[0], messages.unnecessary); + } + + report(useStrictDirectives.slice(1), messages.multiple); + } else if (isParentGlobal && !isModule) { + report(node, messages.function); + } + + scopes.push(isParentStrict || isStrict); + } + + /** + * Exiting a function pops its scope off the stack. + * @returns {void} + */ + function exitFunction() { + scopes.pop(); + } + + modes.function = { + "Program": function(node) { + report(getUseStrictDirectives(node.body), messages.function); + }, + "FunctionDeclaration": enterFunction, + "FunctionExpression": enterFunction, + "FunctionDeclaration:exit": exitFunction, + "FunctionExpression:exit": exitFunction + }; + + return modes[mode || "deprecated"]; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/use-isnan.js b/node_modules/standard/node_modules/eslint/lib/rules/use-isnan.js new file mode 100644 index 00000000..d7a3f537 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/use-isnan.js @@ -0,0 +1,24 @@ +/** + * @fileoverview Rule to flag comparisons to the value NaN + * @author James Allardice + * @copyright 2014 Jordan Harband. All rights reserved. + * @copyright 2013 James Allardice. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + + return { + "BinaryExpression": function (node) { + if (/^(?:[<>]|[!=]=)=?$/.test(node.operator) && (node.left.name === "NaN" || node.right.name === "NaN")) { + context.report(node, "Use the isNaN function to compare with NaN."); + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/valid-jsdoc.js b/node_modules/standard/node_modules/eslint/lib/rules/valid-jsdoc.js new file mode 100644 index 00000000..a79bf7fe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/valid-jsdoc.js @@ -0,0 +1,191 @@ +/** + * @fileoverview Validates JSDoc comments are syntactically correct + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var doctrine = require("doctrine"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var options = context.options[0] || {}, + prefer = options.prefer || {}, + + // these both default to true, so you have to explicitly make them false + requireReturn = options.requireReturn === false ? false : true, + requireParamDescription = options.requireParamDescription !== false, + requireReturnDescription = options.requireReturnDescription !== false; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + // Using a stack to store if a function returns or not (handling nested functions) + var fns = []; + + /** + * When parsing a new function, store it in our function stack. + * @returns {void} + * @private + */ + function startFunction() { + fns.push({returnPresent: false}); + } + + /** + * Indicate that return has been found in the current function. + * @param {ASTNode} node The return node. + * @returns {void} + * @private + */ + function addReturn(node) { + var functionState = fns[fns.length - 1]; + + if (functionState && node.argument !== null) { + functionState.returnPresent = true; + } + } + + /** + * Validate the JSDoc node and output warnings if anything is wrong. + * @param {ASTNode} node The AST node to check. + * @returns {void} + * @private + */ + function checkJSDoc(node) { + var jsdocNode = context.getJSDocComment(node), + functionData = fns.pop(), + hasReturns = false, + hasConstructor = false, + params = Object.create(null), + jsdoc; + + // make sure only to validate JSDoc comments + if (jsdocNode) { + + try { + jsdoc = doctrine.parse(jsdocNode.value, { + strict: true, + unwrap: true, + sloppy: true + }); + } catch (ex) { + + if (/braces/i.test(ex.message)) { + context.report(jsdocNode, "JSDoc type missing brace."); + } else { + context.report(jsdocNode, "JSDoc syntax error."); + } + + return; + } + + jsdoc.tags.forEach(function(tag) { + + switch (tag.title) { + + case "param": + if (!tag.type) { + context.report(jsdocNode, "Missing JSDoc parameter type for '{{name}}'.", { name: tag.name }); + } + + if (!tag.description && requireParamDescription) { + context.report(jsdocNode, "Missing JSDoc parameter description for '{{name}}'.", { name: tag.name }); + } + + if (params[tag.name]) { + context.report(jsdocNode, "Duplicate JSDoc parameter '{{name}}'.", { name: tag.name }); + } else if (tag.name.indexOf(".") === -1) { + params[tag.name] = 1; + } + break; + + case "return": + case "returns": + hasReturns = true; + + if (!requireReturn && !functionData.returnPresent && tag.type.name !== "void" && tag.type.name !== "undefined") { + context.report(jsdocNode, "Unexpected @" + tag.title + " tag; function has no return statement."); + } else { + if (!tag.type) { + context.report(jsdocNode, "Missing JSDoc return type."); + } + + if (tag.type.name !== "void" && !tag.description && requireReturnDescription) { + context.report(jsdocNode, "Missing JSDoc return description."); + } + } + + break; + + case "constructor": + case "class": + hasConstructor = true; + break; + + // no default + } + + // check tag preferences + if (prefer.hasOwnProperty(tag.title)) { + context.report(jsdocNode, "Use @{{name}} instead.", { name: prefer[tag.title] }); + } + + }); + + // check for functions missing @returns + if (!hasReturns && !hasConstructor) { + if (requireReturn || functionData.returnPresent) { + context.report(jsdocNode, "Missing JSDoc @returns for function."); + } + } + + // check the parameters + var jsdocParams = Object.keys(params); + + node.params.forEach(function(param, i) { + var name = param.name; + + // TODO(nzakas): Figure out logical things to do with destructured, default, rest params + if (param.type === "Identifier") { + if (jsdocParams[i] && (name !== jsdocParams[i])) { + context.report(jsdocNode, "Expected JSDoc for '{{name}}' but found '{{jsdocName}}'.", { + name: name, + jsdocName: jsdocParams[i] + }); + } else if (!params[name]) { + context.report(jsdocNode, "Missing JSDoc for parameter '{{name}}'.", { + name: name + }); + } + } + }); + + } + + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "ArrowFunctionExpression": startFunction, + "FunctionExpression": startFunction, + "FunctionDeclaration": startFunction, + "ArrowFunctionExpression:exit": checkJSDoc, + "FunctionExpression:exit": checkJSDoc, + "FunctionDeclaration:exit": checkJSDoc, + "ReturnStatement": addReturn + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/valid-typeof.js b/node_modules/standard/node_modules/eslint/lib/rules/valid-typeof.js new file mode 100644 index 00000000..a108ab36 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/valid-typeof.js @@ -0,0 +1,40 @@ +/** + * @fileoverview Ensures that the results of typeof are compared against a valid string + * @author Ian Christian Myers + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var VALID_TYPES = ["symbol", "undefined", "object", "boolean", "number", "string", "function"], + OPERATORS = ["==", "===", "!=", "!=="]; + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + "UnaryExpression": function (node) { + var parent, sibling; + + if (node.operator === "typeof") { + parent = context.getAncestors().pop(); + + if (parent.type === "BinaryExpression" && OPERATORS.indexOf(parent.operator) !== -1) { + sibling = parent.left === node ? parent.right : parent.left; + + if (sibling.type === "Literal" && VALID_TYPES.indexOf(sibling.value) === -1) { + context.report(sibling, "Invalid typeof comparison value"); + } + } + } + } + + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/vars-on-top.js b/node_modules/standard/node_modules/eslint/lib/rules/vars-on-top.js new file mode 100644 index 00000000..4af70a88 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/vars-on-top.js @@ -0,0 +1,113 @@ +/** + * @fileoverview Rule to enforce var declarations are only at the top of a function. + * @author Danny Fritz + * @author Gyandeep Singh + * @copyright 2014 Danny Fritz. All rights reserved. + * @copyright 2014 Gyandeep Singh. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + var errorMessage = "All \"var\" declarations must be at the top of the function scope."; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * @param {ASTNode} node - any node + * @returns {Boolean} whether the given node structurally represents a directive + */ + function looksLikeDirective(node) { + return node.type === "ExpressionStatement" && + node.expression.type === "Literal" && typeof node.expression.value === "string"; + } + + /** + * Check to see if its a ES6 import declaration + * @param {ASTNode} node - any node + * @returns {Boolean} whether the given node represents a import declaration + */ + function looksLikeImport(node) { + return node.type === "ImportDeclaration" || node.type === "ImportSpecifier" || + node.type === "ImportDefaultSpecifier" || node.type === "ImportNamespaceSpecifier"; + } + + /** + * Checks whether this variable is on top of the block body + * @param {ASTNode} node - The node to check + * @param {ASTNode[]} statements - collection of ASTNodes for the parent node block + * @returns {Boolean} True if var is on top otherwise false + */ + function isVarOnTop(node, statements) { + var i = 0, l = statements.length; + + // skip over directives + for (; i < l; ++i) { + if (!looksLikeDirective(statements[i]) && !looksLikeImport(statements[i])) { + break; + } + } + + for (; i < l; ++i) { + if (statements[i].type !== "VariableDeclaration") { + return false; + } + if (statements[i] === node) { + return true; + } + } + } + + /** + * Checks whether variable is on top at the global level + * @param {ASTNode} node - The node to check + * @param {ASTNode} parent - Parent of the node + * @returns {void} + */ + function globalVarCheck(node, parent) { + if (!isVarOnTop(node, parent.body)) { + context.report(node, errorMessage); + } + } + + /** + * Checks whether variable is on top at functional block scope level + * @param {ASTNode} node - The node to check + * @param {ASTNode} parent - Parent of the node + * @param {ASTNode} grandParent - Parent of the node's parent + * @returns {void} + */ + function blockScopeVarCheck(node, parent, grandParent) { + if (!(/Function/.test(grandParent.type) && + parent.type === "BlockStatement" && + isVarOnTop(node, parent.body))) { + context.report(node, errorMessage); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + "VariableDeclaration": function (node) { + var ancestors = context.getAncestors(); + var parent = ancestors.pop(); + var grandParent = ancestors.pop(); + + if (node.kind === "var") {// check variable is `var` type and not `let` or `const` + if (parent.type === "Program") {// That means its a global variable + globalVarCheck(node, parent); + } else { + blockScopeVarCheck(node, parent, grandParent); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/wrap-iife.js b/node_modules/standard/node_modules/eslint/lib/rules/wrap-iife.js new file mode 100644 index 00000000..eb3c5d1d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/wrap-iife.js @@ -0,0 +1,42 @@ +/** + * @fileoverview Rule to flag when IIFE is not wrapped in parens + * @author Ilya Volodin + * @copyright 2013 Ilya Volodin. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var style = context.options[0] || "outside"; + + function wrapped(node) { + var previousToken = context.getTokenBefore(node), + nextToken = context.getTokenAfter(node); + return previousToken && previousToken.value === "(" && + nextToken && nextToken.value === ")"; + } + + return { + + "CallExpression": function(node) { + if (node.callee.type === "FunctionExpression") { + var callExpressionWrapped = wrapped(node), + functionExpressionWrapped = wrapped(node.callee); + + if (!callExpressionWrapped && !functionExpressionWrapped) { + context.report(node, "Wrap an immediate function invocation in parentheses."); + } else if (style === "inside" && !functionExpressionWrapped) { + context.report(node, "Wrap only the function expression in parens."); + } else if (style === "outside" && !callExpressionWrapped) { + context.report(node, "Move the invocation into the parens that contain the function."); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/wrap-regex.js b/node_modules/standard/node_modules/eslint/lib/rules/wrap-regex.js new file mode 100644 index 00000000..e2cc7d22 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/wrap-regex.js @@ -0,0 +1,36 @@ +/** + * @fileoverview Rule to flag when regex literals are not wrapped in parens + * @author Matt DuVall + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + return { + + "Literal": function(node) { + var token = context.getFirstToken(node), + nodeType = token.type, + source, + grandparent, + ancestors; + + if (nodeType === "RegularExpression") { + source = context.getTokenBefore(node); + ancestors = context.getAncestors(); + grandparent = ancestors[ancestors.length - 1]; + + if (grandparent.type === "MemberExpression" && grandparent.object === node && + (!source || source.value !== "(")) { + context.report(node, "Wrap the regexp literal in parens to disambiguate the slash."); + } + } + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/rules/yoda.js b/node_modules/standard/node_modules/eslint/lib/rules/yoda.js new file mode 100644 index 00000000..cdb5bdad --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/rules/yoda.js @@ -0,0 +1,210 @@ +/** + * @fileoverview Rule to require or disallow yoda comparisons + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2014 Brandon Mills. All rights reserved. + */ +"use strict"; + +//-------------------------------------------------------------------------- +// Helpers +//-------------------------------------------------------------------------- + +/** + * Determines whether an operator is a comparison operator. + * @param {String} operator The operator to check. + * @returns {boolean} Whether or not it is a comparison operator. + */ +function isComparisonOperator(operator) { + return (/^(==|===|!=|!==|<|>|<=|>=)$/).test(operator); +} + +/** + * Determines whether an operator is one used in a range test. + * Allowed operators are `<` and `<=`. + * @param {String} operator The operator to check. + * @returns {boolean} Whether the operator is used in range tests. + */ +function isRangeTestOperator(operator) { + return ["<", "<="].indexOf(operator) >= 0; +} + +/** + * Determines whether a non-Literal node is a negative number that should be + * treated as if it were a single Literal node. + * @param {ASTNode} node Node to test. + * @returns {boolean} True if the node is a negative number that looks like a + * real literal and should be treated as such. + */ +function looksLikeLiteral(node) { + return (node.type === "UnaryExpression" && + node.operator === "-" && + node.prefix && + node.argument.type === "Literal" && + typeof node.argument.value === "number"); +} + +/** + * Attempts to derive a Literal node from nodes that are treated like literals. + * @param {ASTNode} node Node to normalize. + * @returns {ASTNode} The original node if the node is already a Literal, or a + * normalized Literal node with the negative number as the + * value if the node represents a negative number literal, + * otherwise null if the node cannot be converted to a + * normalized literal. + */ +function getNormalizedLiteral(node) { + if (node.type === "Literal") { + return node; + } + + if (looksLikeLiteral(node)) { + return { + type: "Literal", + value: -node.argument.value, + raw: "-" + node.argument.value + }; + } + + return null; +} + +/** + * Checks whether two expressions reference the same value. For example: + * a = a + * a.b = a.b + * a[0] = a[0] + * a['b'] = a['b'] + * @param {ASTNode} a Left side of the comparison. + * @param {ASTNode} b Right side of the comparison. + * @returns {boolean} True if both sides match and reference the same value. + */ +function same(a, b) { + if (a.type !== b.type) { + return false; + } + + switch (a.type) { + case "Identifier": + return a.name === b.name; + case "Literal": + return a.value === b.value; + case "MemberExpression": + // x[0] = x[0] + // x[y] = x[y] + // x.y = x.y + return same(a.object, b.object) && same(a.property, b.property); + case "ThisExpression": + return true; + default: + return false; + } +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function (context) { + + // Default to "never" (!always) if no option + var always = (context.options[0] === "always"); + var exceptRange = (context.options[1] && context.options[1].exceptRange); + + /** + * Determines whether node represents a range test. + * A range test is a "between" test like `(0 <= x && x < 1)` or an "outside" + * test like `(x < 0 || 1 <= x)`. It must be wrapped in parentheses, and + * both operators must be `<` or `<=`. Finally, the literal on the left side + * must be less than or equal to the literal on the right side so that the + * test makes any sense. + * @param {ASTNode} node LogicalExpression node to test. + * @returns {Boolean} Whether node is a range test. + */ + function isRangeTest(node) { + var left = node.left, + right = node.right; + + /** + * Determines whether node is of the form `0 <= x && x < 1`. + * @returns {Boolean} Whether node is a "between" range test. + */ + function isBetweenTest() { + var leftLiteral, rightLiteral; + + return (node.operator === "&&" && + (leftLiteral = getNormalizedLiteral(left.left)) && + (rightLiteral = getNormalizedLiteral(right.right)) && + leftLiteral.value <= rightLiteral.value && + same(left.right, right.left)); + } + + /** + * Determines whether node is of the form `x < 0 || 1 <= x`. + * @returns {Boolean} Whether node is an "outside" range test. + */ + function isOutsideTest() { + var leftLiteral, rightLiteral; + + return (node.operator === "||" && + (leftLiteral = getNormalizedLiteral(left.right)) && + (rightLiteral = getNormalizedLiteral(right.left)) && + leftLiteral.value <= rightLiteral.value && + same(left.left, right.right)); + } + + /** + * Determines whether node is wrapped in parentheses. + * @returns {Boolean} Whether node is preceded immediately by an open + * paren token and followed immediately by a close + * paren token. + */ + function isParenWrapped() { + var tokenBefore, tokenAfter; + + return ((tokenBefore = context.getTokenBefore(node)) && + tokenBefore.value === "(" && + (tokenAfter = context.getTokenAfter(node)) && + tokenAfter.value === ")"); + } + + return (node.type === "LogicalExpression" && + left.type === "BinaryExpression" && + right.type === "BinaryExpression" && + isRangeTestOperator(left.operator) && + isRangeTestOperator(right.operator) && + (isBetweenTest() || isOutsideTest()) && + isParenWrapped()); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + "BinaryExpression": always ? function(node) { + + // Comparisons must always be yoda-style: if ("blue" === color) + if ( + (node.right.type === "Literal" || looksLikeLiteral(node.right)) && + isComparisonOperator(node.operator) && + !(exceptRange && isRangeTest(context.getAncestors().pop())) + ) { + context.report(node, "Expected literal to be on the left side of " + node.operator + "."); + } + + } : function(node) { + + // Comparisons must never be yoda-style (default) + if ( + (node.left.type === "Literal" || looksLikeLiteral(node.left)) && + isComparisonOperator(node.operator) && + !(exceptRange && isRangeTest(context.getAncestors().pop())) + ) { + context.report(node, "Expected literal to be on the right side of " + node.operator + "."); + } + + } + }; + +}; diff --git a/node_modules/standard/node_modules/eslint/lib/timing.js b/node_modules/standard/node_modules/eslint/lib/timing.js new file mode 100644 index 00000000..06e8da70 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/timing.js @@ -0,0 +1,109 @@ +/** + * @fileoverview Tracks performance of individual rules. + * @author Brandon Mills + * @copyright 2014 Brandon Mills. All rights reserved. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/* istanbul ignore next */ +function alignLeft(str, len, ch) { + return str + new Array(len - str.length + 1).join(ch || " "); +} + +/* istanbul ignore next */ +function alignRight(str, len, ch) { + return new Array(len - str.length + 1).join(ch || " ") + str; +} + +//------------------------------------------------------------------------------ +// Module definition +//------------------------------------------------------------------------------ + +var enabled = !!process.env.TIMING; + +var HEADERS = ["Rule", "Time (ms)", "Relative"]; +var ALIGN = [alignLeft, alignRight, alignRight]; + +/* istanbul ignore next */ +function display(data) { + var total = 0; + var rows = Object.keys(data) + .map(function(key) { + var time = data[key]; + total += time; + return [key, time]; + }) + .sort(function(a, b) { + return b[1] - a[1]; + }) + .slice(0, 10); + + rows.forEach(function(row) { + row.push((row[1] * 100 / total).toFixed(1) + "%"); + row[1] = row[1].toFixed(3); + }); + + rows.unshift(HEADERS); + + var widths = []; + rows.forEach(function(row) { + var len = row.length, i, n; + for (i = 0; i < len; i++) { + n = row[i].length; + if (!widths[i] || n > widths[i]) { + widths[i] = n; + } + } + }); + + var table = rows.map(function(row) { + return row.map(function(cell, index) { + return ALIGN[index](cell, widths[index]); + }).join(" | "); + }); + table.splice(1, 0, widths.map(function(w, index) { + if (index !== 0 && index !== widths.length - 1) { + w++; + } + + return ALIGN[index](":", w + 1, "-"); + }).join("|")); + + console.log(table.join("\n")); +} + +/* istanbul ignore next */ +module.exports = (function() { + + var data = Object.create(null); + + function time(key, fn) { + if (typeof data[key] === "undefined") { + data[key] = 0; + } + + return function() { + var t = process.hrtime(); + fn.apply(null, Array.prototype.slice.call(arguments)); + t = process.hrtime(t); + data[key] += t[0] * 1e3 + t[1] / 1e6; + }; + } + + if (enabled) { + process.on("exit", function() { + display(data); + }); + } + + return { + time: time, + enabled: enabled + }; + +}()); diff --git a/node_modules/standard/node_modules/eslint/lib/token-store.js b/node_modules/standard/node_modules/eslint/lib/token-store.js new file mode 100644 index 00000000..6a014941 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/token-store.js @@ -0,0 +1,201 @@ +/** + * @fileoverview Object to handle access and retrieval of tokens. + * @author Brandon Mills + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2014 Brandon Mills. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Implementation +//------------------------------------------------------------------------------ + +module.exports = function(tokens) { + var api = {}, + starts = Object.create(null), + ends = Object.create(null), + index, length, range; + + /** + * Gets tokens in a given interval. + * @param {int} start Inclusive index of the first token. 0 if negative. + * @param {int} end Exclusive index of the last token. + * @returns {Token[]} Tokens in the interval. + */ + function get(start, end) { + var result = [], + i; + + for (i = Math.max(0, start); i < end && i < length; i++) { + result.push(tokens[i]); + } + + return result; + } + + /** + * Gets the index in the tokens array of the last token belonging to a node. + * Usually a node ends exactly at a token, but due to ASI, sometimes a + * node's range extends beyond its last token. + * @param {ASTNode} node The node for which to find the last token's index. + * @returns {int} Index in the tokens array of the node's last token. + */ + function lastTokenIndex(node) { + var end = node.range[1], + cursor = ends[end]; + + // If the node extends beyond its last token, get the token before the + // next token + if (typeof cursor === "undefined") { + cursor = starts[end] - 1; + } + + // If there isn't a next token, the desired token is the last one in the + // array + if (isNaN(cursor)) { + cursor = length - 1; + } + + return cursor; + } + + // Map tokens' start and end range to the index in the tokens array + for (index = 0, length = tokens.length; index < length; index++) { + range = tokens[index].range; + starts[range[0]] = index; + ends[range[1]] = index; + } + + /** + * Gets a number of tokens that precede a given node or token in the token + * stream. + * @param {(ASTNode|Token)} node The AST node or token. + * @param {int} [beforeCount=0] The number of tokens before the node or + * token to retrieve. + * @returns {Token[]} Array of objects representing tokens. + */ + api.getTokensBefore = function(node, beforeCount) { + var first = starts[node.range[0]]; + return get(first - (beforeCount || 0), first); + }; + + /** + * Gets the token that precedes a given node or token in the token stream. + * @param {(ASTNode|Token)} node The AST node or token. + * @param {int} [skip=0] A number of tokens to skip before the given node or + * token. + * @returns {Token} An object representing the token. + */ + api.getTokenBefore = function(node, skip) { + return tokens[starts[node.range[0]] - (skip || 0) - 1]; + }; + + /** + * Gets a number of tokens that follow a given node or token in the token + * stream. + * @param {(ASTNode|Token)} node The AST node or token. + * @param {int} [afterCount=0] The number of tokens after the node or token + * to retrieve. + * @returns {Token[]} Array of objects representing tokens. + */ + api.getTokensAfter = function(node, afterCount) { + var start = lastTokenIndex(node) + 1; + return get(start, start + (afterCount || 0)); + }; + + /** + * Gets the token that follows a given node or token in the token stream. + * @param {(ASTNode|Token)} node The AST node or token. + * @param {int} [skip=0] A number of tokens to skip after the given node or + * token. + * @returns {Token} An object representing the token. + */ + api.getTokenAfter = function(node, skip) { + return tokens[lastTokenIndex(node) + (skip || 0) + 1]; + }; + + /** + * Gets all tokens that are related to the given node. + * @param {ASTNode} node The AST node. + * @param {int} [beforeCount=0] The number of tokens before the node to retrieve. + * @param {int} [afterCount=0] The number of tokens after the node to retrieve. + * @returns {Token[]} Array of objects representing tokens. + */ + api.getTokens = function(node, beforeCount, afterCount) { + return get( + starts[node.range[0]] - (beforeCount || 0), + lastTokenIndex(node) + (afterCount || 0) + 1 + ); + }; + + /** + * Gets the first `count` tokens of the given node's token stream. + * @param {ASTNode} node The AST node. + * @param {int} [count=0] The number of tokens of the node to retrieve. + * @returns {Token[]} Array of objects representing tokens. + */ + api.getFirstTokens = function(node, count) { + var first = starts[node.range[0]]; + return get( + first, + Math.min(lastTokenIndex(node) + 1, first + (count || 0)) + ); + }; + + /** + * Gets the first token of the given node's token stream. + * @param {ASTNode} node The AST node. + * @param {int} [skip=0] A number of tokens to skip. + * @returns {Token} An object representing the token. + */ + api.getFirstToken = function(node, skip) { + return tokens[starts[node.range[0]] + (skip || 0)]; + }; + + /** + * Gets the last `count` tokens of the given node. + * @param {ASTNode} node The AST node. + * @param {int} [count=0] The number of tokens of the node to retrieve. + * @returns {Token[]} Array of objects representing tokens. + */ + api.getLastTokens = function(node, count) { + var last = lastTokenIndex(node) + 1; + return get(Math.max(starts[node.range[0]], last - (count || 0)), last); + }; + + /** + * Gets the last token of the given node's token stream. + * @param {ASTNode} node The AST node. + * @param {int} [skip=0] A number of tokens to skip. + * @returns {Token} An object representing the token. + */ + api.getLastToken = function(node, skip) { + return tokens[lastTokenIndex(node) - (skip || 0)]; + }; + + /** + * Gets all of the tokens between two non-overlapping nodes. + * @param {ASTNode} left Node before the desired token range. + * @param {ASTNode} right Node after the desired token range. + * @param {int} [padding=0] Number of extra tokens on either side of center. + * @returns {Token[]} Tokens between left and right plus padding. + */ + api.getTokensBetween = function(left, right, padding) { + padding = padding || 0; + return get( + lastTokenIndex(left) + 1 - padding, + starts[right.range[0]] + padding + ); + }; + + /** + * Gets the token starting at the specified index. + * @param {int} startIndex Index of the start of the token's range. + * @returns {Token} The token starting at index, or null if no such token. + */ + api.getTokenByRangeStart = function(startIndex) { + return (tokens[starts[startIndex]] || null); + }; + + return api; +}; diff --git a/node_modules/standard/node_modules/eslint/lib/util.js b/node_modules/standard/node_modules/eslint/lib/util.js new file mode 100644 index 00000000..749cb119 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/util.js @@ -0,0 +1,78 @@ +/** + * @fileoverview Common utilities. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ + +var PLUGIN_NAME_PREFIX = "eslint-plugin-"; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ +/** + * Merges two objects together and assigns the result to the initial object. Can be used for shallow cloning. + * @param {Object} target of the cloning operation + * @param {Object} source object + * @returns {void} + */ +exports.mixin = function(target, source) { + Object.keys(source).forEach(function(key) { + target[key] = source[key]; + }); +}; + +/** + * Merges two config objects. This will not only add missing keys, but will also modify values to match. + * @param {Object} base config object + * @param {Object} custom config object. Overrides in this config object will take priority over base. + * @returns {Object} merged config object. + */ +exports.mergeConfigs = function mergeConfigs(base, custom) { + + Object.keys(custom).forEach(function (key) { + var property = custom[key]; + + if (key === "plugins") { + if (!base[key]) { + base[key] = []; + } + + property.forEach(function (plugin) { + // skip duplicates + if (base[key].indexOf(plugin) === -1) { + base[key].push(plugin); + } + }); + return; + } + + if (Array.isArray(base[key]) && !Array.isArray(property) && typeof property === "number") { + // assume that we are just overriding first attribute + base[key][0] = custom[key]; + return; + } + + if (typeof property === "object" && !Array.isArray(property) && property !== null) { + // base[key] might not exist, so be careful with recursion here + base[key] = mergeConfigs(base[key] || {}, custom[key]); + } else { + base[key] = custom[key]; + } + }); + + return base; +}; + +/** + * Removes the prefix `eslint-plugin-` from a plugin name. + * @param {string} pluginName The name of the plugin which may have the prefix. + * @returns {string} The name of the plugin without prefix. + */ +exports.removePluginPrefix = function removePluginPrefix(pluginName) { + return pluginName.indexOf(PLUGIN_NAME_PREFIX) === 0 ? pluginName.substring(PLUGIN_NAME_PREFIX.length) : pluginName; +}; + +exports.PLUGIN_NAME_PREFIX = PLUGIN_NAME_PREFIX; diff --git a/node_modules/standard/node_modules/eslint/lib/util/traverse.js b/node_modules/standard/node_modules/eslint/lib/util/traverse.js new file mode 100644 index 00000000..ba5520e3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/lib/util/traverse.js @@ -0,0 +1,105 @@ +/** + * @fileoverview Simple directory traversal logic. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var fs = require("fs"), + path = require("path"), + debug = require("debug"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +debug = debug("eslint:traverse"); + +/** + * Walks a path recursively calling the callback on each file. + * @param {string} name The file or directory path. + * @param {string[]} extensions The file extensions that should cause the callback + * to be called. + * @param {Function} exclude The function to check if file/path should be excluded. + * @param {Function} callback The function to call on each file. + * @returns {void} + * @private + */ +function walk(name, extensions, exclude, callback) { + + var stat, basename; + + stat = fs.statSync(name); + + function traverse(dir, stack) { + stack.push(dir); + + fs.readdirSync(path.join.apply(path, stack)).forEach(function(file) { + var filePath, fileStat; + + // skip all hidded things (dirs, files, links) + if (file[0] === ".") { + return; + } + + filePath = path.join.apply(path, stack.concat([file])); + fileStat = fs.statSync(filePath); + + // if this file or directory is excluded from linting, skip over it. + if (exclude && exclude(filePath)) { + // console.log("Ignoring " + filePath); + debug("Ignoring " + filePath); + return; + } + + // only call callback for files with correct extensions + if (fileStat.isFile() && extensions.indexOf(path.extname(filePath)) > -1) { + callback(filePath); + } else if (fileStat.isDirectory()) { + traverse(file, stack); + } + }); + stack.pop(); + } + + basename = path.basename(name); + + // don't ignore cases like 'eslint ./' + if ((basename !== "." && basename !== ".." && basename[0] === ".") || + (exclude && exclude(name))) { + + debug("Ignoring " + name); + return; + } + + // always call callback for any files that are passed on the command line + if (stat.isFile()) { + callback(name); + } else { + traverse(name, []); + } +} + +/** + * Traverses multiple directories and calls a callback on each file. + * @param {Object} options The option for the traversal. + * param {string[]} options.files An array of file and directory paths to traverse. + * param {Function} options.exclude The function to check if file/path should be excluded. + * @param {Function} callback A function to call for each file. + * @returns {void} + */ +module.exports = function traverse(options, callback) { + + var files = options.files, + exclude = options.exclude, + extensions = options.extensions; + + files.forEach(function(file) { + walk(file, extensions, exclude, callback); + }); + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/.bin/esparse b/node_modules/standard/node_modules/eslint/node_modules/.bin/esparse new file mode 120000 index 00000000..409161d5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/.bin/esparse @@ -0,0 +1 @@ +../espree/bin/esparse.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/.bin/esvalidate b/node_modules/standard/node_modules/eslint/node_modules/.bin/esvalidate new file mode 120000 index 00000000..939b663b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/.bin/esvalidate @@ -0,0 +1 @@ +../espree/bin/esvalidate.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/.bin/js-yaml b/node_modules/standard/node_modules/eslint/node_modules/.bin/js-yaml new file mode 120000 index 00000000..9dbd010d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/.bin/js-yaml @@ -0,0 +1 @@ +../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/.bin/mkdirp b/node_modules/standard/node_modules/eslint/node_modules/.bin/mkdirp new file mode 120000 index 00000000..017896ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/.bin/mkdirp @@ -0,0 +1 @@ +../mkdirp/bin/cmd.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/.bin/strip-json-comments b/node_modules/standard/node_modules/eslint/node_modules/.bin/strip-json-comments new file mode 120000 index 00000000..63d549f9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/.bin/strip-json-comments @@ -0,0 +1 @@ +../strip-json-comments/cli.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/.bin/user-home b/node_modules/standard/node_modules/eslint/node_modules/.bin/user-home new file mode 120000 index 00000000..d72d76bb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/.bin/user-home @@ -0,0 +1 @@ +../user-home/cli.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/index.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/index.js new file mode 100644 index 00000000..4138a64d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/index.js @@ -0,0 +1,100 @@ +'use strict'; +var escapeStringRegexp = require('escape-string-regexp'); +var ansiStyles = require('ansi-styles'); +var stripAnsi = require('strip-ansi'); +var hasAnsi = require('has-ansi'); +var supportsColor = require('supports-color'); +var defineProps = Object.defineProperties; + +function Chalk(options) { + // detect mode if not set manually + this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled; +} + +// use bright blue on Windows as the normal blue color is illegible +if (process.platform === 'win32') { + ansiStyles.blue.open = '\u001b[94m'; +} + +function build(_styles) { + var builder = function builder() { + return applyStyle.apply(builder, arguments); + }; + builder._styles = _styles; + builder.enabled = this.enabled; + // __proto__ is used because we must return a function, but there is + // no way to create a function with a different prototype. + builder.__proto__ = proto; + return builder; +} + +var styles = (function () { + var ret = {}; + + Object.keys(ansiStyles).forEach(function (key) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + + ret[key] = { + get: function () { + return build.call(this, this._styles.concat(key)); + } + }; + }); + + return ret; +})(); + +var proto = defineProps(function chalk() {}, styles); + +function applyStyle() { + // support varags, but simply cast to string in case there's only one arg + var args = arguments; + var argsLen = args.length; + var str = argsLen !== 0 && String(arguments[0]); + if (argsLen > 1) { + // don't slice `arguments`, it prevents v8 optimizations + for (var a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || !str) { + return str; + } + + /*jshint validthis: true */ + var nestedStyles = this._styles; + + var i = nestedStyles.length; + while (i--) { + var code = ansiStyles[nestedStyles[i]]; + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; + } + + return str; +} + +function init() { + var ret = {}; + + Object.keys(styles).forEach(function (name) { + ret[name] = { + get: function () { + return build.call(this, [name]); + } + }; + }); + + return ret; +} + +defineProps(Chalk.prototype, init()); + +module.exports = new Chalk(); +module.exports.styles = ansiStyles; +module.exports.hasColor = hasAnsi; +module.exports.stripColor = stripAnsi; +module.exports.supportsColor = supportsColor; diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/license b/node_modules/standard/node_modules/eslint/node_modules/chalk/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/.bin/has-ansi b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/.bin/has-ansi new file mode 120000 index 00000000..c1e7413f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/.bin/has-ansi @@ -0,0 +1 @@ +../has-ansi/cli.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/.bin/strip-ansi b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/.bin/strip-ansi new file mode 120000 index 00000000..b65c9f81 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/.bin/strip-ansi @@ -0,0 +1 @@ +../strip-ansi/cli.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/.bin/supports-color b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/.bin/supports-color new file mode 120000 index 00000000..af0f05ef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/.bin/supports-color @@ -0,0 +1 @@ +../supports-color/cli.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/index.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/index.js new file mode 100644 index 00000000..caf9e119 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/index.js @@ -0,0 +1,56 @@ +'use strict'; + +var styles = module.exports = { + modifiers: { + reset: [0, 0], + bold: [1, 22], // 21 isn't widely supported and 22 does the same thing + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + colors: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39] + }, + bgColors: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49] + } +}; + +// fix humans +styles.colors.grey = styles.colors.gray; + +Object.keys(styles).forEach(function (groupName) { + var group = styles[groupName]; + + Object.keys(group).forEach(function (styleName) { + var style = group[styleName]; + + styles[styleName] = group[styleName] = { + open: '\u001b[' + style[0] + 'm', + close: '\u001b[' + style[1] + 'm' + }; + }); + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/license b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/package.json b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/package.json new file mode 100644 index 00000000..e670f250 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/package.json @@ -0,0 +1,80 @@ +{ + "name": "ansi-styles", + "version": "2.0.1", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-styles" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "da6541334e1681cb803f891fab8abf4313cc4bc1", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-styles/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-styles", + "_id": "ansi-styles@2.0.1", + "_shasum": "b033f57f93e2d28adeb8bc11138fa13da0fd20a3", + "_from": "ansi-styles@>=2.0.1 <3.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "b033f57f93e2d28adeb8bc11138fa13da0fd20a3", + "tarball": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/readme.md b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/readme.md new file mode 100644 index 00000000..89ec6a7c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/readme.md @@ -0,0 +1,86 @@ +# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles) + +> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings. + +![](screenshot.png) + + +## Install + +```sh +$ npm install --save ansi-styles +``` + + +## Usage + +```js +var ansi = require('ansi-styles'); + +console.log(ansi.green.open + 'Hello world!' + ansi.green.close); +``` + + +## API + +Each style has an `open` and `close` property. + + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(not widely supported)* +- `underline` +- `inverse` +- `hidden` +- `strikethrough` *(not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `gray` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` + + +## Advanced usage + +By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `ansi.modifiers` +- `ansi.colors` +- `ansi.bgColors` + + +###### Example + +```js +console.log(ansi.colors.green.open); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/cli.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/cli.js new file mode 100755 index 00000000..0386a824 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/cli.js @@ -0,0 +1,45 @@ +#!/usr/bin/env node +'use strict'; +var stdin = require('get-stdin'); +var pkg = require('./package.json'); +var hasAnsi = require('./'); +var argv = process.argv.slice(2); +var input = argv[0]; + +function help() { + console.log([ + '', + ' ' + pkg.description, + '', + ' Usage', + ' has-ansi ', + ' echo | has-ansi', + '', + ' Exits with code 0 if input has ANSI escape codes and 1 if not' + ].join('\n')); +} + +function init(data) { + process.exit(hasAnsi(data) ? 0 : 1); +} + +if (argv.indexOf('--help') !== -1) { + help(); + return; +} + +if (argv.indexOf('--version') !== -1) { + console.log(pkg.version); + return; +} + +if (process.stdin.isTTY) { + if (!input) { + help(); + return; + } + + init(input); +} else { + stdin(init); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/index.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/index.js new file mode 100644 index 00000000..98fae067 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +var ansiRegex = require('ansi-regex'); +var re = new RegExp(ansiRegex().source); // remove the `g` flag +module.exports = re.test.bind(re); diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/license b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js new file mode 100644 index 00000000..2fcdd1e4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = function () { + return /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json new file mode 100644 index 00000000..8d703301 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json @@ -0,0 +1,86 @@ +{ + "name": "ansi-regex", + "version": "1.1.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-regex" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha test/test.js", + "view-supported": "node test/viewCodes.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "47fb974630af70998157b30fad6eb5e5bd7c7cd6", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-regex/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-regex", + "_id": "ansi-regex@1.1.1", + "_shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "_from": "ansi-regex@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md new file mode 100644 index 00000000..ae876e72 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md @@ -0,0 +1,33 @@ +# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) + +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save ansi-regex +``` + + +## Usage + +```js +var ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001b[4mcake\u001b[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); +//=> ['\u001b[4m', '\u001b[0m'] +``` + +*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/package.json b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/package.json new file mode 100644 index 00000000..43582f87 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/package.json @@ -0,0 +1,92 @@ +{ + "name": "has-ansi", + "version": "1.0.3", + "description": "Check if a string has ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/has-ansi" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "bin": { + "has-ansi": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern", + "has" + ], + "dependencies": { + "ansi-regex": "^1.1.0", + "get-stdin": "^4.0.1" + }, + "devDependencies": { + "mocha": "*" + }, + "gitHead": "416428ed16f8e9718aec54cea083173af6019917", + "bugs": { + "url": "https://github.com/sindresorhus/has-ansi/issues" + }, + "homepage": "https://github.com/sindresorhus/has-ansi", + "_id": "has-ansi@1.0.3", + "_shasum": "c0b5b1615d9e382b0ff67169d967b425e48ca538", + "_from": "has-ansi@>=1.0.3 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "c0b5b1615d9e382b0ff67169d967b425e48ca538", + "tarball": "http://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/readme.md b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/readme.md new file mode 100644 index 00000000..0fa149a8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/has-ansi/readme.md @@ -0,0 +1,45 @@ +# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) + +> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save has-ansi +``` + + +## Usage + +```js +var hasAnsi = require('has-ansi'); + +hasAnsi('\u001b[4mcake\u001b[0m'); +//=> true + +hasAnsi('cake'); +//=> false +``` + + +## CLI + +```sh +$ npm install --global has-ansi +``` + +``` +$ has-ansi --help + + Usage + has-ansi + echo | has-ansi + + Exits with code 0 if input has ANSI escape codes and 1 if not +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/cli.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/cli.js new file mode 100755 index 00000000..b83f63b9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/cli.js @@ -0,0 +1,47 @@ +#!/usr/bin/env node +'use strict'; +var fs = require('fs'); +var pkg = require('./package.json'); +var stripAnsi = require('./'); +var argv = process.argv.slice(2); +var input = argv[0]; + +function help() { + console.log([ + '', + ' ' + pkg.description, + '', + ' Usage', + ' strip-ansi > ', + ' cat | strip-ansi > ', + '', + ' Example', + ' strip-ansi unicorn.txt > unicorn-stripped.txt' + ].join('\n')); +} + +function init(data) { + process.stdout.write(stripAnsi(data)); +} + +if (argv.indexOf('--help') !== -1) { + help(); + return; +} + +if (argv.indexOf('--version') !== -1) { + console.log(pkg.version); + return; +} + +if (!input && process.stdin.isTTY) { + help(); + return; +} + +if (input) { + init(fs.readFileSync(input, 'utf8')); +} else { + process.stdin.setEncoding('utf8'); + process.stdin.on('data', init); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/index.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/index.js new file mode 100644 index 00000000..099480fb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/index.js @@ -0,0 +1,6 @@ +'use strict'; +var ansiRegex = require('ansi-regex')(); + +module.exports = function (str) { + return typeof str === 'string' ? str.replace(ansiRegex, '') : str; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js new file mode 100644 index 00000000..2fcdd1e4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = function () { + return /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json new file mode 100644 index 00000000..8d703301 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json @@ -0,0 +1,86 @@ +{ + "name": "ansi-regex", + "version": "1.1.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-regex" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha test/test.js", + "view-supported": "node test/viewCodes.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "47fb974630af70998157b30fad6eb5e5bd7c7cd6", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-regex/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-regex", + "_id": "ansi-regex@1.1.1", + "_shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "_from": "ansi-regex@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md new file mode 100644 index 00000000..ae876e72 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md @@ -0,0 +1,33 @@ +# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) + +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save ansi-regex +``` + + +## Usage + +```js +var ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001b[4mcake\u001b[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); +//=> ['\u001b[4m', '\u001b[0m'] +``` + +*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/package.json b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/package.json new file mode 100644 index 00000000..44c71ffb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/package.json @@ -0,0 +1,89 @@ +{ + "name": "strip-ansi", + "version": "2.0.1", + "description": "Strip ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/strip-ansi" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "bin": { + "strip-ansi": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^1.0.0" + }, + "devDependencies": { + "mocha": "*" + }, + "gitHead": "1eff0936c01f89efa312d9d51deed137259871a1", + "bugs": { + "url": "https://github.com/sindresorhus/strip-ansi/issues" + }, + "homepage": "https://github.com/sindresorhus/strip-ansi", + "_id": "strip-ansi@2.0.1", + "_shasum": "df62c1aa94ed2f114e1d0f21fd1d50482b79a60e", + "_from": "strip-ansi@>=2.0.1 <3.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "dist": { + "shasum": "df62c1aa94ed2f114e1d0f21fd1d50482b79a60e", + "tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/readme.md b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/readme.md new file mode 100644 index 00000000..53ec2643 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/strip-ansi/readme.md @@ -0,0 +1,43 @@ +# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi) + +> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save strip-ansi +``` + + +## Usage + +```js +var stripAnsi = require('strip-ansi'); + +stripAnsi('\u001b[4mcake\u001b[0m'); +//=> 'cake' +``` + + +## CLI + +```sh +$ npm install --global strip-ansi +``` + +```sh +$ strip-ansi --help + + Usage + strip-ansi > + cat | strip-ansi > + + Example + strip-ansi unicorn.txt > unicorn-stripped.txt +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/cli.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/cli.js new file mode 100755 index 00000000..e7469876 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/cli.js @@ -0,0 +1,29 @@ +#!/usr/bin/env node +'use strict'; +var pkg = require('./package.json'); +var supportsColor = require('./'); +var argv = process.argv.slice(2); + +function help() { + console.log([ + '', + ' ' + pkg.description, + '', + ' Usage', + ' supports-color', + '', + ' Exits with code 0 if color is supported and 1 if not' + ].join('\n')); +} + +if (argv.indexOf('--help') !== -1) { + help(); + return; +} + +if (argv.indexOf('--version') !== -1) { + console.log(pkg.version); + return; +} + +process.exit(supportsColor ? 0 : 1); diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/index.js b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/index.js new file mode 100644 index 00000000..a1719648 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/index.js @@ -0,0 +1,43 @@ +'use strict'; +var argv = process.argv; + +module.exports = (function () { + if ('FORCE_COLOR' in process.env) { + return true; + } + + if (argv.indexOf('--no-color') !== -1 || + argv.indexOf('--no-colors') !== -1 || + argv.indexOf('--color=false') !== -1) { + return false; + } + + if (argv.indexOf('--color') !== -1 || + argv.indexOf('--colors') !== -1 || + argv.indexOf('--color=true') !== -1 || + argv.indexOf('--color=always') !== -1) { + return true; + } + + if (process.stdout && !process.stdout.isTTY) { + return false; + } + + if (process.platform === 'win32') { + return true; + } + + if ('COLORTERM' in process.env) { + return true; + } + + if (process.env.TERM === 'dumb') { + return false; + } + + if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { + return true; + } + + return false; +})(); diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/license b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/package.json b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/package.json new file mode 100644 index 00000000..0a52c0d1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/package.json @@ -0,0 +1,85 @@ +{ + "name": "supports-color", + "version": "1.3.1", + "description": "Detect whether a terminal supports color", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/supports-color" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "bin": { + "supports-color": "cli.js" + }, + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect" + ], + "devDependencies": { + "mocha": "*", + "require-uncached": "^1.0.2" + }, + "gitHead": "09f1b4c336cee7269b4c8b3a8880054a23fcb35e", + "bugs": { + "url": "https://github.com/sindresorhus/supports-color/issues" + }, + "homepage": "https://github.com/sindresorhus/supports-color", + "_id": "supports-color@1.3.1", + "_shasum": "15758df09d8ff3b4acc307539fabe27095e1042d", + "_from": "supports-color@>=1.3.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "dist": { + "shasum": "15758df09d8ff3b4acc307539fabe27095e1042d", + "tarball": "http://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/readme.md b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/readme.md new file mode 100644 index 00000000..fe6016f9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/node_modules/supports-color/readme.md @@ -0,0 +1,46 @@ +# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color) + +> Detect whether a terminal supports color + + +## Install + +``` +$ npm install --save supports-color +``` + + +## Usage + +```js +var supportsColor = require('supports-color'); + +if (supportsColor) { + console.log('Terminal supports color'); +} +``` + +It obeys the `--color` and `--no-color` CLI flags. + +For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`. + + +## CLI + +``` +$ npm install --global supports-color +``` + +``` +$ supports-color --help + + Usage + supports-color + + Exits with code 0 if color is supported and 1 if not +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/package.json b/node_modules/standard/node_modules/eslint/node_modules/chalk/package.json new file mode 100644 index 00000000..93055c07 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/package.json @@ -0,0 +1,83 @@ +{ + "name": "chalk", + "version": "1.0.0", + "description": "Terminal string styling done right. Much color.", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/chalk" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "bench": "matcha benchmark.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "ansi", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-styles": "^2.0.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^1.0.3", + "strip-ansi": "^2.0.1", + "supports-color": "^1.3.0" + }, + "devDependencies": { + "matcha": "^0.6.0", + "mocha": "*" + }, + "gitHead": "8864d3563313ed15574a38dd5c9d5966080c46ce", + "bugs": { + "url": "https://github.com/sindresorhus/chalk/issues" + }, + "homepage": "https://github.com/sindresorhus/chalk", + "_id": "chalk@1.0.0", + "_shasum": "b3cf4ed0ff5397c99c75b8f679db2f52831f96dc", + "_from": "chalk@>=1.0.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "dist": { + "shasum": "b3cf4ed0ff5397c99c75b8f679db2f52831f96dc", + "tarball": "http://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/chalk/readme.md b/node_modules/standard/node_modules/eslint/node_modules/chalk/readme.md new file mode 100644 index 00000000..43c70643 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/chalk/readme.md @@ -0,0 +1,197 @@ +

+
+ chalk +
+
+

+ +> Terminal string styling done right + +[![Build Status](https://travis-ci.org/sindresorhus/chalk.svg?branch=master)](https://travis-ci.org/sindresorhus/chalk) [![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg?style=flat)](https://www.youtube.com/watch?v=Sm368W0OsHo) + +[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough. + +**Chalk is a clean and focused alternative.** + +![screenshot](https://github.com/sindresorhus/ansi-styles/raw/master/screenshot.png) + + +## Why + +- Highly performant +- Doesn't extend `String.prototype` +- Expressive API +- Ability to nest styles +- Clean and focused +- Auto-detects color support +- Actively maintained +- [Used by ~3000 modules](https://www.npmjs.com/browse/depended/chalk) + + +## Install + +``` +$ npm install --save chalk +``` + + +## Usage + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +var chalk = require('chalk'); + +// style a string +chalk.blue('Hello world!'); + +// combine styled and normal strings +chalk.blue('Hello') + 'World' + chalk.red('!'); + +// compose multiple styles using the chainable API +chalk.blue.bgRed.bold('Hello world!'); + +// pass in multiple arguments +chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'); + +// nest styles +chalk.red('Hello', chalk.underline.bgBlue('world') + '!'); + +// nest styles of the same type even (color, underline, background) +chalk.green( + 'I am a green line ' + + chalk.blue.underline.bold('with a blue substring') + + ' that becomes green again!' +); +``` + +Easily define your own themes. + +```js +var chalk = require('chalk'); +var error = chalk.bold.red; +console.log(error('Error!')); +``` + +Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data). + +```js +var name = 'Sindre'; +console.log(chalk.green('Hello %s'), name); +//=> Hello Sindre +``` + + +## API + +### chalk.` + + +
+

Code coverage report for All files

+

+ + Statements: 100% (0 / 0)      + + + Branches: 100% (0 / 0)      + + + Functions: 100% (0 / 0)      + + + Lines: 100% (0 / 0)      + + Ignored: none      +

+
+
+
+
+ + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
+
+
+ + + + + + + + diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/prettify.css b/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/prettify.css new file mode 100644 index 00000000..b317a7cd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/prettify.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/prettify.js new file mode 100644 index 00000000..ef51e038 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/sort-arrow-sprite.png b/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/sort-arrow-sprite.png new file mode 100644 index 00000000..03f704a6 Binary files /dev/null and b/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/sort-arrow-sprite.png differ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/sorter.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/sorter.js new file mode 100644 index 00000000..6afb736c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov-report/sorter.js @@ -0,0 +1,156 @@ +var addSorting = (function () { + "use strict"; + var cols, + currentSort = { + index: 0, + desc: false + }; + + // returns the summary table element + function getTable() { return document.querySelector('.coverage-summary table'); } + // returns the thead element of the summary table + function getTableHeader() { return getTable().querySelector('thead tr'); } + // returns the tbody element of the summary table + function getTableBody() { return getTable().querySelector('tbody'); } + // returns the th element for nth column + function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } + + // loads all columns + function loadColumns() { + var colNodes = getTableHeader().querySelectorAll('th'), + colNode, + cols = [], + col, + i; + + for (i = 0; i < colNodes.length; i += 1) { + colNode = colNodes[i]; + col = { + key: colNode.getAttribute('data-col'), + sortable: !colNode.getAttribute('data-nosort'), + type: colNode.getAttribute('data-type') || 'string' + }; + cols.push(col); + if (col.sortable) { + col.defaultDescSort = col.type === 'number'; + colNode.innerHTML = colNode.innerHTML + ''; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function (a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function (a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function () { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i =0 ; i < cols.length; i += 1) { + if (cols[i].sortable) { + el = getNthColumn(i).querySelector('.sorter'); + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function () { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(cols); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov.info b/node_modules/standard/node_modules/eslint/node_modules/doctrine/coverage/lcov.info new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/eslint.json b/node_modules/standard/node_modules/eslint/node_modules/doctrine/eslint.json new file mode 100644 index 00000000..330835b9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/eslint.json @@ -0,0 +1,22 @@ +{ + "env": { + "node": true + }, + "rules": { + "quotes": [2, "single"], + "valid-jsdoc": [2, true], + "brace-style": [2, true], + "semi": [2, true], + "no-bitwise": [2, true], + "camelcase": [2, true], + "curly": [2, true], + "eqeqeq": [2, "allow-null"], + "wrap-iife": [2, true], + "eqeqeq": [2, true], + "strict": [2, true], + "no-unused-vars": [2, true], + "no-underscore-dangle": [0, false], + "no-use-before-define": [0, false], + "no-constant-condition": [0, false] + } +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/gulpfile.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/gulpfile.js new file mode 100644 index 00000000..a68d0ff9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/gulpfile.js @@ -0,0 +1,120 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +'use strict'; + +var gulp = require('gulp'); +var mocha = require('gulp-mocha'); +var jshint = require('gulp-jshint'); +var eslint = require('gulp-eslint'); +var istanbul = require('gulp-istanbul'); +var bump = require('gulp-bump'); +var filter = require('gulp-filter'); +var git = require('gulp-git'); +var tagVersion = require('gulp-tag-version'); + +var SRC = [ 'lib/*.js' ]; + +var TEST = [ 'test/*.js' ]; + +var LINT = [ + 'gulpfile.js' +].concat(SRC); + +var ESLINT_OPTION = { + 'rules': { + 'quotes': 0, + 'eqeqeq': 0, + 'no-use-before-define': 0, + 'no-underscore-dangle': 0, + 'no-shadow': 0, + 'no-constant-condition': 0, + 'no-multi-spaces': 0, + 'dot-notation': [2, {'allowKeywords': false}] + }, + 'env': { + 'node': true + } +}; + +gulp.task('test', function (cb) { + gulp.src(SRC) + .pipe(istanbul()) // Covering files + .on('finish', function () { + gulp.src(TEST) + .pipe(mocha({ + reporter: 'spec', + timeout: 100000 // 100s + })) + .pipe(istanbul.writeReports()) // Creating the reports after tests runned + .on('end', cb); + }); +}); + +gulp.task('lint', function () { + return gulp.src(LINT) + .pipe(jshint('.jshintrc')) + .pipe(jshint.reporter(require('jshint-stylish'))) + .pipe(jshint.reporter('fail')) + .pipe(eslint(ESLINT_OPTION)) + .pipe(eslint.formatEach('compact', process.stderr)) + .pipe(eslint.failOnError()); +}); + + +/** + * Bumping version number and tagging the repository with it. + * Please read http://semver.org/ + * + * You can use the commands + * + * gulp patch # makes v0.1.0 -> v0.1.1 + * gulp feature # makes v0.1.1 -> v0.2.0 + * gulp release # makes v0.2.1 -> v1.0.0 + * + * To bump the version numbers accordingly after you did a patch, + * introduced a feature or made a backwards-incompatible release. + */ + +function inc(importance) { + // get all the files to bump version in + return gulp.src(['./package.json']) + // bump the version number in those files + .pipe(bump({type: importance})) + // save it back to filesystem + .pipe(gulp.dest('./')) + // commit the changed version number + .pipe(git.commit('Bumps package version')) + // read only one file to get the version number + .pipe(filter('package.json')) + // **tag it in the repository** + .pipe(tagVersion({ prefix: '' })); +} + +gulp.task('patch', [ 'travis' ], function () { return inc('patch'); }); +gulp.task('minor', [ 'travis' ], function () { return inc('minor'); }); +gulp.task('major', [ 'travis' ], function () { return inc('major'); }); + +gulp.task('travis', [ 'lint', 'test' ]); +gulp.task('default', [ 'travis' ]); diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/lib/doctrine.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/lib/doctrine.js new file mode 100644 index 00000000..dd3cccb2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/lib/doctrine.js @@ -0,0 +1,809 @@ +/* + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2014 Dan Tao + Copyright (C) 2013 Andrew Eisenberg + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + var typed, + utility, + isArray, + jsdoc, + esutils, + hasOwnProperty; + + esutils = require('esutils'); + isArray = require('isarray'); + typed = require('./typed'); + utility = require('./utility'); + + function sliceSource(source, index, last) { + return source.slice(index, last); + } + + hasOwnProperty = (function () { + var func = Object.prototype.hasOwnProperty; + return function hasOwnProperty(obj, name) { + return func.call(obj, name); + }; + }()); + + function shallowCopy(obj) { + var ret = {}, key; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + + function isASCIIAlphanumeric(ch) { + return (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) || + (ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) || + (ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */); + } + + function isParamTitle(title) { + return title === 'param' || title === 'argument' || title === 'arg'; + } + + function isProperty(title) { + return title === 'property' || title === 'prop'; + } + + function isNameParameterRequired(title) { + return isParamTitle(title) || isProperty(title) || + title === 'alias' || title === 'this' || title === 'mixes' || title === 'requires'; + } + + function isAllowedName(title) { + return isNameParameterRequired(title) || title === 'const' || title === 'constant'; + } + + function isAllowedNested(title) { + return isProperty(title) || isParamTitle(title); + } + + function isTypeParameterRequired(title) { + return isParamTitle(title) || title === 'define' || title === 'enum' || + title === 'implements' || title === 'return' || + title === 'this' || title === 'type' || title === 'typedef' || + title === 'returns' || isProperty(title); + } + + // Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required + // This would require changes to 'parseType' + function isAllowedType(title) { + return isTypeParameterRequired(title) || title === 'throws' || title === 'const' || title === 'constant' || + title === 'namespace' || title === 'member' || title === 'var' || title === 'module' || + title === 'constructor' || title === 'class' || title === 'extends' || title === 'augments' || + title === 'public' || title === 'private' || title === 'protected'; + } + + function trim(str) { + return str.replace(/^\s+/, '').replace(/\s+$/, ''); + } + + function unwrapComment(doc) { + // JSDoc comment is following form + // /** + // * ....... + // */ + // remove /**, */ and * + var BEFORE_STAR = 0, + STAR = 1, + AFTER_STAR = 2, + index, + len, + mode, + result, + ch; + + doc = doc.replace(/^\/\*\*?/, '').replace(/\*\/$/, ''); + index = 0; + len = doc.length; + mode = BEFORE_STAR; + result = ''; + + while (index < len) { + ch = doc.charCodeAt(index); + switch (mode) { + case BEFORE_STAR: + if (esutils.code.isLineTerminator(ch)) { + result += String.fromCharCode(ch); + } else if (ch === 0x2A /* '*' */) { + mode = STAR; + } else if (!esutils.code.isWhiteSpace(ch)) { + result += String.fromCharCode(ch); + mode = AFTER_STAR; + } + break; + + case STAR: + if (!esutils.code.isWhiteSpace(ch)) { + result += String.fromCharCode(ch); + } + mode = esutils.code.isLineTerminator(ch) ? BEFORE_STAR : AFTER_STAR; + break; + + case AFTER_STAR: + result += String.fromCharCode(ch); + if (esutils.code.isLineTerminator(ch)) { + mode = BEFORE_STAR; + } + break; + } + index += 1; + } + + return result; + } + + // JSDoc Tag Parser + + (function (exports) { + var Rules, + index, + lineNumber, + length, + source, + recoverable, + sloppy, + strict; + + function advance() { + var ch = source.charCodeAt(index); + index += 1; + if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(index) === 0x0A /* '\n' */)) { + lineNumber += 1; + } + return String.fromCharCode(ch); + } + + function scanTitle() { + var title = ''; + // waste '@' + advance(); + + while (index < length && isASCIIAlphanumeric(source.charCodeAt(index))) { + title += advance(); + } + + return title; + } + + function seekContent() { + var ch, waiting, last = index; + + waiting = false; + while (last < length) { + ch = source.charCodeAt(last); + if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(last + 1) === 0x0A /* '\n' */)) { + lineNumber += 1; + waiting = true; + } else if (waiting) { + if (ch === 0x40 /* '@' */) { + break; + } + if (!esutils.code.isWhiteSpace(ch)) { + waiting = false; + } + } + last += 1; + } + return last; + } + + // type expression may have nest brace, such as, + // { { ok: string } } + // + // therefore, scanning type expression with balancing braces. + function parseType(title, last) { + var ch, brace, type, direct = false; + + + // search '{' + while (index < last) { + ch = source.charCodeAt(index); + if (esutils.code.isWhiteSpace(ch)) { + advance(); + } else if (ch === 0x7B /* '{' */) { + advance(); + break; + } else { + // this is direct pattern + direct = true; + break; + } + } + + + if (direct) { + return null; + } + + // type expression { is found + brace = 1; + type = ''; + while (index < last) { + ch = source.charCodeAt(index); + if (esutils.code.isLineTerminator(ch)) { + advance(); + } else { + if (ch === 0x7D /* '}' */) { + brace -= 1; + if (brace === 0) { + advance(); + break; + } + } else if (ch === 0x7B /* '{' */) { + brace += 1; + } + type += advance(); + } + } + + if (brace !== 0) { + // braces is not balanced + return utility.throwError('Braces are not balanced'); + } + + if (isParamTitle(title)) { + return typed.parseParamType(type); + } + return typed.parseType(type); + } + + function scanIdentifier(last) { + var identifier; + if (!esutils.code.isIdentifierStart(source.charCodeAt(index))) { + return null; + } + identifier = advance(); + while (index < last && esutils.code.isIdentifierPart(source.charCodeAt(index))) { + identifier += advance(); + } + return identifier; + } + + function skipWhiteSpace(last) { + while (index < last && (esutils.code.isWhiteSpace(source.charCodeAt(index)) || esutils.code.isLineTerminator(source.charCodeAt(index)))) { + advance(); + } + } + + function parseName(last, allowBrackets, allowNestedParams) { + var name = '', useBrackets; + + skipWhiteSpace(last); + + if (index >= last) { + return null; + } + + if (allowBrackets && source.charCodeAt(index) === 0x5B /* '[' */) { + useBrackets = true; + name = advance(); + } + + if (!esutils.code.isIdentifierStart(source.charCodeAt(index))) { + return null; + } + + name += scanIdentifier(last); + + if (allowNestedParams) { + if (source.charCodeAt(index) === 0x3A /* ':' */ && ( + name === 'module' || + name === 'external' || + name === 'event')) { + name += advance(); + name += scanIdentifier(last); + + } + while (source.charCodeAt(index) === 0x2E /* '.' */ || + source.charCodeAt(index) === 0x23 /* '#' */ || + source.charCodeAt(index) === 0x7E /* '~' */) { + name += advance(); + name += scanIdentifier(last); + } + } + + if (useBrackets) { + // do we have a default value for this? + if (source.charCodeAt(index) === 0x3D /* '=' */) { + + // consume the '='' symbol + name += advance(); + // scan in the default value + while (index < last && source.charCodeAt(index) !== 0x5D /* ']' */) { + name += advance(); + } + } + + if (index >= last || source.charCodeAt(index) !== 0x5D /* ']' */) { + // we never found a closing ']' + return null; + } + + // collect the last ']' + name += advance(); + } + + return name; + } + + function skipToTag() { + while (index < length && source.charCodeAt(index) !== 0x40 /* '@' */) { + advance(); + } + if (index >= length) { + return false; + } + utility.assert(source.charCodeAt(index) === 0x40 /* '@' */); + return true; + } + + function TagParser(options, title) { + this._options = options; + this._title = title; + this._tag = { + title: title, + description: null + }; + if (this._options.lineNumbers) { + this._tag.lineNumber = lineNumber; + } + this._last = 0; + // space to save special information for title parsers. + this._extra = { }; + } + + // addError(err, ...) + TagParser.prototype.addError = function addError(errorText) { + var args = Array.prototype.slice.call(arguments, 1), + msg = errorText.replace( + /%(\d)/g, + function (whole, index) { + utility.assert(index < args.length, 'Message reference must be in range'); + return args[index]; + } + ); + + if (!this._tag.errors) { + this._tag.errors = []; + } + if (strict) { + utility.throwError(msg); + } + this._tag.errors.push(msg); + return recoverable; + }; + + TagParser.prototype.parseType = function () { + // type required titles + if (isTypeParameterRequired(this._title)) { + try { + this._tag.type = parseType(this._title, this._last); + if (!this._tag.type) { + if (!isParamTitle(this._title)) { + if (!this.addError('Missing or invalid tag type')) { + return false; + } + } + } + } catch (error) { + this._tag.type = null; + if (!this.addError(error.message)) { + return false; + } + } + } else if (isAllowedType(this._title)) { + // optional types + try { + this._tag.type = parseType(this._title, this._last); + } catch (e) { + //For optional types, lets drop the thrown error when we hit the end of the file + } + } + return true; + }; + + TagParser.prototype._parseNamePath = function (optional) { + var name; + name = parseName(this._last, sloppy && isParamTitle(this._title), true); + if (!name) { + if (!optional) { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } + this._tag.name = name; + return true; + }; + + TagParser.prototype.parseNamePath = function () { + return this._parseNamePath(false); + }; + + TagParser.prototype.parseNamePathOptional = function () { + return this._parseNamePath(true); + }; + + + TagParser.prototype.parseName = function () { + var assign, name; + + // param, property requires name + if (isAllowedName(this._title)) { + this._tag.name = parseName(this._last, sloppy && isParamTitle(this._title), isAllowedNested(this._title)); + if (!this._tag.name) { + if (!isNameParameterRequired(this._title)) { + return true; + } + + // it's possible the name has already been parsed but interpreted as a type + // it's also possible this is a sloppy declaration, in which case it will be + // fixed at the end + if (isParamTitle(this._title) && this._tag.type && this._tag.type.name) { + this._extra.name = this._tag.type; + this._tag.name = this._tag.type.name; + this._tag.type = null; + } else { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } else { + name = this._tag.name; + if (name.charAt(0) === '[' && name.charAt(name.length - 1) === ']') { + // extract the default value if there is one + // example: @param {string} [somebody=John Doe] description + assign = name.substring(1, name.length - 1).split('='); + if (assign[1]) { + this._tag['default'] = assign[1]; + } + this._tag.name = assign[0]; + + // convert to an optional type + if (this._tag.type && this._tag.type.type !== 'OptionalType') { + this._tag.type = { + type: 'OptionalType', + expression: this._tag.type + }; + } + } + } + } + + return true; + }; + + TagParser.prototype.parseDescription = function parseDescription() { + var description = trim(sliceSource(source, index, this._last)); + if (description) { + if ((/^-\s+/).test(description)) { + description = description.substring(2); + } + this._tag.description = description; + } + return true; + }; + + TagParser.prototype.parseKind = function parseKind() { + var kind, kinds; + kinds = { + 'class': true, + 'constant': true, + 'event': true, + 'external': true, + 'file': true, + 'function': true, + 'member': true, + 'mixin': true, + 'module': true, + 'namespace': true, + 'typedef': true + }; + kind = trim(sliceSource(source, index, this._last)); + this._tag.kind = kind; + if (!hasOwnProperty(kinds, kind)) { + if (!this.addError('Invalid kind name \'%0\'', kind)) { + return false; + } + } + return true; + }; + + TagParser.prototype.parseAccess = function parseAccess() { + var access; + access = trim(sliceSource(source, index, this._last)); + this._tag.access = access; + if (access !== 'private' && access !== 'protected' && access !== 'public') { + if (!this.addError('Invalid access name \'%0\'', access)) { + return false; + } + } + return true; + }; + + TagParser.prototype.parseVariation = function parseVariation() { + var variation, text; + text = trim(sliceSource(source, index, this._last)); + variation = parseFloat(text, 10); + this._tag.variation = variation; + if (isNaN(variation)) { + if (!this.addError('Invalid variation \'%0\'', text)) { + return false; + } + } + return true; + }; + + TagParser.prototype.ensureEnd = function () { + var shouldBeEmpty = trim(sliceSource(source, index, this._last)); + if (shouldBeEmpty) { + if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) { + return false; + } + } + return true; + }; + + TagParser.prototype.epilogue = function epilogue() { + var description; + + description = this._tag.description; + // un-fix potentially sloppy declaration + if (isParamTitle(this._title) && !this._tag.type && description && description.charAt(0) === '[') { + this._tag.type = this._extra.name; + this._tag.name = undefined; + + if (!sloppy) { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } + + return true; + }; + + Rules = { + // http://usejsdoc.org/tags-access.html + 'access': ['parseAccess'], + // http://usejsdoc.org/tags-alias.html + 'alias': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-augments.html + 'augments': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-constructor.html + 'constructor': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-constructor.html + 'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-extends.html + 'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-deprecated.html + 'deprecated': ['parseDescription'], + // http://usejsdoc.org/tags-global.html + 'global': ['ensureEnd'], + // http://usejsdoc.org/tags-inner.html + 'inner': ['ensureEnd'], + // http://usejsdoc.org/tags-instance.html + 'instance': ['ensureEnd'], + // http://usejsdoc.org/tags-kind.html + 'kind': ['parseKind'], + // http://usejsdoc.org/tags-mixes.html + 'mixes': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-mixin.html + 'mixin': ['parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-member.html + 'member': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-method.html + 'method': ['parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-module.html + 'module': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-method.html + 'func': ['parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-method.html + 'function': ['parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-member.html + 'var': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-name.html + 'name': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-namespace.html + 'namespace': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-private.html + 'private': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-protected.html + 'protected': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-public.html + 'public': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-readonly.html + 'readonly': ['ensureEnd'], + // http://usejsdoc.org/tags-requires.html + 'requires': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-since.html + 'since': ['parseDescription'], + // http://usejsdoc.org/tags-static.html + 'static': ['ensureEnd'], + // http://usejsdoc.org/tags-summary.html + 'summary': ['parseDescription'], + // http://usejsdoc.org/tags-this.html + 'this': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-todo.html + 'todo': ['parseDescription'], + // http://usejsdoc.org/tags-variation.html + 'variation': ['parseVariation'], + // http://usejsdoc.org/tags-version.html + 'version': ['parseDescription'] + }; + + TagParser.prototype.parse = function parse() { + var i, iz, sequences, method; + + // empty title + if (!this._title) { + if (!this.addError('Missing or invalid title')) { + return null; + } + } + + // Seek to content last index. + this._last = seekContent(this._title); + + if (hasOwnProperty(Rules, this._title)) { + sequences = Rules[this._title]; + } else { + // default sequences + sequences = ['parseType', 'parseName', 'parseDescription', 'epilogue']; + } + + for (i = 0, iz = sequences.length; i < iz; ++i) { + method = sequences[i]; + if (!this[method]()) { + return null; + } + } + + // Seek global index to end of this tag. + index = this._last; + return this._tag; + }; + + function parseTag(options) { + var title, parser; + + // skip to tag + if (!skipToTag()) { + return null; + } + + // scan title + title = scanTitle(); + + // construct tag parser + parser = new TagParser(options, title); + return parser.parse(); + } + + // + // Parse JSDoc + // + + function scanJSDocDescription() { + var description = '', ch, atAllowed; + + atAllowed = true; + while (index < length) { + ch = source.charCodeAt(index); + + if (atAllowed && ch === 0x40 /* '@' */) { + break; + } + + if (esutils.code.isLineTerminator(ch)) { + atAllowed = true; + } else if (atAllowed && !esutils.code.isWhiteSpace(ch)) { + atAllowed = false; + } + + description += advance(); + } + return trim(description); + } + + function parse(comment, options) { + var tags = [], tag, description, interestingTags, i, iz; + + if (options === undefined) { + options = {}; + } + + if (typeof options.unwrap === 'boolean' && options.unwrap) { + source = unwrapComment(comment); + } else { + source = comment; + } + + // array of relevant tags + if (options.tags) { + if (isArray(options.tags)) { + interestingTags = { }; + for (i = 0, iz = options.tags.length; i < iz; i++) { + if (typeof options.tags[i] === 'string') { + interestingTags[options.tags[i]] = true; + } else { + utility.throwError('Invalid "tags" parameter: ' + options.tags); + } + } + } else { + utility.throwError('Invalid "tags" parameter: ' + options.tags); + } + } + + length = source.length; + index = 0; + lineNumber = 0; + recoverable = options.recoverable; + sloppy = options.sloppy; + strict = options.strict; + + description = scanJSDocDescription(); + + while (true) { + tag = parseTag(options); + if (!tag) { + break; + } + if (!interestingTags || interestingTags.hasOwnProperty(tag.title)) { + tags.push(tag); + } + } + + return { + description: description, + tags: tags + }; + } + exports.parse = parse; + }(jsdoc = {})); + + exports.version = utility.VERSION; + exports.parse = jsdoc.parse; + exports.parseType = typed.parseType; + exports.parseParamType = typed.parseParamType; + exports.unwrapComment = unwrapComment; + exports.Syntax = shallowCopy(typed.Syntax); + exports.Error = utility.DoctrineError; + exports.type = { + Syntax: exports.Syntax, + parseType: typed.parseType, + parseParamType: typed.parseParamType, + stringify: typed.stringify + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/lib/typed.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/lib/typed.js new file mode 100644 index 00000000..2b02000e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/lib/typed.js @@ -0,0 +1,1261 @@ +/* + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2014 Dan Tao + Copyright (C) 2013 Andrew Eisenberg + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +// "typed", the Type Expression Parser for doctrine. + +(function () { + 'use strict'; + + var Syntax, + Token, + source, + length, + index, + previous, + token, + value, + esutils, + utility; + + esutils = require('esutils'); + utility = require('./utility'); + + Syntax = { + NullableLiteral: 'NullableLiteral', + AllLiteral: 'AllLiteral', + NullLiteral: 'NullLiteral', + UndefinedLiteral: 'UndefinedLiteral', + VoidLiteral: 'VoidLiteral', + UnionType: 'UnionType', + ArrayType: 'ArrayType', + RecordType: 'RecordType', + FieldType: 'FieldType', + FunctionType: 'FunctionType', + ParameterType: 'ParameterType', + RestType: 'RestType', + NonNullableType: 'NonNullableType', + OptionalType: 'OptionalType', + NullableType: 'NullableType', + NameExpression: 'NameExpression', + TypeApplication: 'TypeApplication' + }; + + Token = { + ILLEGAL: 0, // ILLEGAL + DOT_LT: 1, // .< + REST: 2, // ... + LT: 3, // < + GT: 4, // > + LPAREN: 5, // ( + RPAREN: 6, // ) + LBRACE: 7, // { + RBRACE: 8, // } + LBRACK: 9, // [ + RBRACK: 10, // ] + COMMA: 11, // , + COLON: 12, // : + STAR: 13, // * + PIPE: 14, // | + QUESTION: 15, // ? + BANG: 16, // ! + EQUAL: 17, // = + NAME: 18, // name token + STRING: 19, // string + NUMBER: 20, // number + EOF: 21 + }; + + function isTypeName(ch) { + return '><(){}[],:*|?!='.indexOf(String.fromCharCode(ch)) === -1 && !esutils.code.isWhiteSpace(ch) && !esutils.code.isLineTerminator(ch); + } + + function Context(previous, index, token, value) { + this._previous = previous; + this._index = index; + this._token = token; + this._value = value; + } + + Context.prototype.restore = function () { + previous = this._previous; + index = this._index; + token = this._token; + value = this._value; + }; + + Context.save = function () { + return new Context(previous, index, token, value); + }; + + function advance() { + var ch = source.charAt(index); + index += 1; + return ch; + } + + function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && esutils.code.isHexDigit(source.charCodeAt(index))) { + ch = advance(); + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } + + function scanString() { + var str = '', quote, ch, code, unescaped, restore; //TODO review removal octal = false + quote = source.charAt(index); + ++index; + + while (index < length) { + ch = advance(); + + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = advance(); + if (!esutils.code.isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'u': + case 'x': + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + str += unescaped; + } else { + index = restore; + str += ch; + } + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\v'; + break; + + default: + if (esutils.code.isOctalDigit(ch.charCodeAt(0))) { + code = '01234567'.indexOf(ch); + + // \0 is not octal escape sequence + // Deprecating unused code. TODO review removal + //if (code !== 0) { + // octal = true; + //} + + if (index < length && esutils.code.isOctalDigit(source.charCodeAt(index))) { + //TODO Review Removal octal = true; + code = code * 8 + '01234567'.indexOf(advance()); + + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + esutils.code.isOctalDigit(source.charCodeAt(index))) { + code = code * 8 + '01234567'.indexOf(advance()); + } + } + str += String.fromCharCode(code); + } else { + str += ch; + } + break; + } + } else { + if (ch === '\r' && source.charCodeAt(index) === 0x0A /* '\n' */) { + ++index; + } + } + } else if (esutils.code.isLineTerminator(ch.charCodeAt(0))) { + break; + } else { + str += ch; + } + } + + if (quote !== '') { + utility.throwError('unexpected quote'); + } + + value = str; + return Token.STRING; + } + + function scanNumber() { + var number, ch; + + number = ''; + ch = source.charCodeAt(index); + + if (ch !== 0x2E /* '.' */) { + number = advance(); + ch = source.charCodeAt(index); + + if (number === '0') { + if (ch === 0x78 /* 'x' */ || ch === 0x58 /* 'X' */) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isHexDigit(ch)) { + break; + } + number += advance(); + } + + if (number.length <= 2) { + // only 0x + utility.throwError('unexpected token'); + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStart(ch)) { + utility.throwError('unexpected token'); + } + } + value = parseInt(number, 16); + return Token.NUMBER; + } + + if (esutils.code.isOctalDigit(ch)) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isOctalDigit(ch)) { + break; + } + number += advance(); + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStart(ch) || esutils.code.isDecimalDigit(ch)) { + utility.throwError('unexpected token'); + } + } + value = parseInt(number, 8); + return Token.NUMBER; + } + + if (esutils.code.isDecimalDigit(ch)) { + utility.throwError('unexpected token'); + } + } + + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } + + if (ch === 0x2E /* '.' */) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } + + if (ch === 0x65 /* 'e' */ || ch === 0x45 /* 'E' */) { + number += advance(); + + ch = source.charCodeAt(index); + if (ch === 0x2B /* '+' */ || ch === 0x2D /* '-' */) { + number += advance(); + } + + ch = source.charCodeAt(index); + if (esutils.code.isDecimalDigit(ch)) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } else { + utility.throwError('unexpected token'); + } + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStart(ch)) { + utility.throwError('unexpected token'); + } + } + + value = parseFloat(number); + return Token.NUMBER; + } + + + function scanTypeName() { + var ch, ch2; + + value = advance(); + while (index < length && isTypeName(source.charCodeAt(index))) { + ch = source.charCodeAt(index); + if (ch === 0x2E /* '.' */) { + if ((index + 1) >= length) { + return Token.ILLEGAL; + } + ch2 = source.charCodeAt(index + 1); + if (ch2 === 0x3C /* '<' */) { + break; + } + } + value += advance(); + } + return Token.NAME; + } + + function next() { + var ch; + + previous = index; + + while (index < length && esutils.code.isWhiteSpace(source.charCodeAt(index))) { + advance(); + } + if (index >= length) { + token = Token.EOF; + return token; + } + + ch = source.charCodeAt(index); + switch (ch) { + case 0x27: /* ''' */ + case 0x22: /* '"' */ + token = scanString(); + return token; + + case 0x3A: /* ':' */ + advance(); + token = Token.COLON; + return token; + + case 0x2C: /* ',' */ + advance(); + token = Token.COMMA; + return token; + + case 0x28: /* '(' */ + advance(); + token = Token.LPAREN; + return token; + + case 0x29: /* ')' */ + advance(); + token = Token.RPAREN; + return token; + + case 0x5B: /* '[' */ + advance(); + token = Token.LBRACK; + return token; + + case 0x5D: /* ']' */ + advance(); + token = Token.RBRACK; + return token; + + case 0x7B: /* '{' */ + advance(); + token = Token.LBRACE; + return token; + + case 0x7D: /* '}' */ + advance(); + token = Token.RBRACE; + return token; + + case 0x2E: /* '.' */ + if (index + 1 < length) { + ch = source.charCodeAt(index + 1); + if (ch === 0x3C /* '<' */) { + advance(); // '.' + advance(); // '<' + token = Token.DOT_LT; + return token; + } + + if (ch === 0x2E /* '.' */ && index + 2 < length && source.charCodeAt(index + 2) === 0x2E /* '.' */) { + advance(); // '.' + advance(); // '.' + advance(); // '.' + token = Token.REST; + return token; + } + + if (esutils.code.isDecimalDigit(ch)) { + token = scanNumber(); + return token; + } + } + token = Token.ILLEGAL; + return token; + + case 0x3C: /* '<' */ + advance(); + token = Token.LT; + return token; + + case 0x3E: /* '>' */ + advance(); + token = Token.GT; + return token; + + case 0x2A: /* '*' */ + advance(); + token = Token.STAR; + return token; + + case 0x7C: /* '|' */ + advance(); + token = Token.PIPE; + return token; + + case 0x3F: /* '?' */ + advance(); + token = Token.QUESTION; + return token; + + case 0x21: /* '!' */ + advance(); + token = Token.BANG; + return token; + + case 0x3D: /* '=' */ + advance(); + token = Token.EQUAL; + return token; + + default: + if (esutils.code.isDecimalDigit(ch)) { + token = scanNumber(); + return token; + } + + // type string permits following case, + // + // namespace.module.MyClass + // + // this reduced 1 token TK_NAME + utility.assert(isTypeName(ch)); + token = scanTypeName(); + return token; + } + } + + function consume(target, text) { + utility.assert(token === target, text || 'consumed token not matched'); + next(); + } + + function expect(target, message) { + if (token !== target) { + utility.throwError(message || 'unexpected token'); + } + next(); + } + + // UnionType := '(' TypeUnionList ')' + // + // TypeUnionList := + // <> + // | NonemptyTypeUnionList + // + // NonemptyTypeUnionList := + // TypeExpression + // | TypeExpression '|' NonemptyTypeUnionList + function parseUnionType() { + var elements; + consume(Token.LPAREN, 'UnionType should start with ('); + elements = []; + if (token !== Token.RPAREN) { + while (true) { + elements.push(parseTypeExpression()); + if (token === Token.RPAREN) { + break; + } + expect(Token.PIPE); + } + } + consume(Token.RPAREN, 'UnionType should end with )'); + return { + type: Syntax.UnionType, + elements: elements + }; + } + + // ArrayType := '[' ElementTypeList ']' + // + // ElementTypeList := + // <> + // | TypeExpression + // | '...' TypeExpression + // | TypeExpression ',' ElementTypeList + function parseArrayType() { + var elements; + consume(Token.LBRACK, 'ArrayType should start with ['); + elements = []; + while (token !== Token.RBRACK) { + if (token === Token.REST) { + consume(Token.REST); + elements.push({ + type: Syntax.RestType, + expression: parseTypeExpression() + }); + break; + } else { + elements.push(parseTypeExpression()); + } + if (token !== Token.RBRACK) { + expect(Token.COMMA); + } + } + expect(Token.RBRACK); + return { + type: Syntax.ArrayType, + elements: elements + }; + } + + function parseFieldName() { + var v = value; + if (token === Token.NAME || token === Token.STRING) { + next(); + return v; + } + + if (token === Token.NUMBER) { + consume(Token.NUMBER); + return String(v); + } + + utility.throwError('unexpected token'); + } + + // FieldType := + // FieldName + // | FieldName ':' TypeExpression + // + // FieldName := + // NameExpression + // | StringLiteral + // | NumberLiteral + // | ReservedIdentifier + function parseFieldType() { + var key; + + key = parseFieldName(); + if (token === Token.COLON) { + consume(Token.COLON); + return { + type: Syntax.FieldType, + key: key, + value: parseTypeExpression() + }; + } + return { + type: Syntax.FieldType, + key: key, + value: null + }; + } + + // RecordType := '{' FieldTypeList '}' + // + // FieldTypeList := + // <> + // | FieldType + // | FieldType ',' FieldTypeList + function parseRecordType() { + var fields; + + consume(Token.LBRACE, 'RecordType should start with {'); + fields = []; + if (token === Token.COMMA) { + consume(Token.COMMA); + } else { + while (token !== Token.RBRACE) { + fields.push(parseFieldType()); + if (token !== Token.RBRACE) { + expect(Token.COMMA); + } + } + } + expect(Token.RBRACE); + return { + type: Syntax.RecordType, + fields: fields + }; + } + + // NameExpression := + // Identifier + // | TagIdentifier ':' Identifier + // + // Tag identifier is one of "module", "external" or "event" + // Identifier is the same as Token.NAME, including any dots, something like + // namespace.module.MyClass + function parseNameExpression() { + var name = value; + expect(Token.NAME); + + if (token === Token.COLON && ( + name === 'module' || + name === 'external' || + name === 'event')) { + consume(Token.COLON); + name += ':' + value; + expect(Token.NAME); + } + + return { + type: Syntax.NameExpression, + name: name + }; + } + + // TypeExpressionList := + // TopLevelTypeExpression + // | TopLevelTypeExpression ',' TypeExpressionList + function parseTypeExpressionList() { + var elements = []; + + elements.push(parseTop()); + while (token === Token.COMMA) { + consume(Token.COMMA); + elements.push(parseTop()); + } + return elements; + } + + // TypeName := + // NameExpression + // | NameExpression TypeApplication + // + // TypeApplication := + // '.<' TypeExpressionList '>' + // | '<' TypeExpressionList '>' // this is extension of doctrine + function parseTypeName() { + var expr, applications; + + expr = parseNameExpression(); + if (token === Token.DOT_LT || token === Token.LT) { + next(); + applications = parseTypeExpressionList(); + expect(Token.GT); + return { + type: Syntax.TypeApplication, + expression: expr, + applications: applications + }; + } + return expr; + } + + // ResultType := + // <> + // | ':' void + // | ':' TypeExpression + // + // BNF is above + // but, we remove <> pattern, so token is always TypeToken::COLON + function parseResultType() { + consume(Token.COLON, 'ResultType should start with :'); + if (token === Token.NAME && value === 'void') { + consume(Token.NAME); + return { + type: Syntax.VoidLiteral + }; + } + return parseTypeExpression(); + } + + // ParametersType := + // RestParameterType + // | NonRestParametersType + // | NonRestParametersType ',' RestParameterType + // + // RestParameterType := + // '...' + // '...' Identifier + // + // NonRestParametersType := + // ParameterType ',' NonRestParametersType + // | ParameterType + // | OptionalParametersType + // + // OptionalParametersType := + // OptionalParameterType + // | OptionalParameterType, OptionalParametersType + // + // OptionalParameterType := ParameterType= + // + // ParameterType := TypeExpression | Identifier ':' TypeExpression + // + // Identifier is "new" or "this" + function parseParametersType() { + var params = [], optionalSequence = false, expr, rest = false; + + while (token !== Token.RPAREN) { + if (token === Token.REST) { + // RestParameterType + consume(Token.REST); + rest = true; + } + + expr = parseTypeExpression(); + if (expr.type === Syntax.NameExpression && token === Token.COLON) { + // Identifier ':' TypeExpression + consume(Token.COLON); + expr = { + type: Syntax.ParameterType, + name: expr.name, + expression: parseTypeExpression() + }; + } + if (token === Token.EQUAL) { + consume(Token.EQUAL); + expr = { + type: Syntax.OptionalType, + expression: expr + }; + optionalSequence = true; + } else { + if (optionalSequence) { + utility.throwError('unexpected token'); + } + } + if (rest) { + expr = { + type: Syntax.RestType, + expression: expr + }; + } + params.push(expr); + if (token !== Token.RPAREN) { + expect(Token.COMMA); + } + } + return params; + } + + // FunctionType := 'function' FunctionSignatureType + // + // FunctionSignatureType := + // | TypeParameters '(' ')' ResultType + // | TypeParameters '(' ParametersType ')' ResultType + // | TypeParameters '(' 'this' ':' TypeName ')' ResultType + // | TypeParameters '(' 'this' ':' TypeName ',' ParametersType ')' ResultType + function parseFunctionType() { + var isNew, thisBinding, params, result, fnType; + utility.assert(token === Token.NAME && value === 'function', 'FunctionType should start with \'function\''); + consume(Token.NAME); + + // Google Closure Compiler is not implementing TypeParameters. + // So we do not. if we don't get '(', we see it as error. + expect(Token.LPAREN); + + isNew = false; + params = []; + thisBinding = null; + if (token !== Token.RPAREN) { + // ParametersType or 'this' + if (token === Token.NAME && + (value === 'this' || value === 'new')) { + // 'this' or 'new' + // 'new' is Closure Compiler extension + isNew = value === 'new'; + consume(Token.NAME); + expect(Token.COLON); + thisBinding = parseTypeName(); + if (token === Token.COMMA) { + consume(Token.COMMA); + params = parseParametersType(); + } + } else { + params = parseParametersType(); + } + } + + expect(Token.RPAREN); + + result = null; + if (token === Token.COLON) { + result = parseResultType(); + } + + fnType = { + type: Syntax.FunctionType, + params: params, + result: result + }; + if (thisBinding) { + // avoid adding null 'new' and 'this' properties + fnType['this'] = thisBinding; + if (isNew) { + fnType['new'] = true; + } + } + return fnType; + } + + // BasicTypeExpression := + // '*' + // | 'null' + // | 'undefined' + // | TypeName + // | FunctionType + // | UnionType + // | RecordType + // | ArrayType + function parseBasicTypeExpression() { + var context; + switch (token) { + case Token.STAR: + consume(Token.STAR); + return { + type: Syntax.AllLiteral + }; + + case Token.LPAREN: + return parseUnionType(); + + case Token.LBRACK: + return parseArrayType(); + + case Token.LBRACE: + return parseRecordType(); + + case Token.NAME: + if (value === 'null') { + consume(Token.NAME); + return { + type: Syntax.NullLiteral + }; + } + + if (value === 'undefined') { + consume(Token.NAME); + return { + type: Syntax.UndefinedLiteral + }; + } + + context = Context.save(); + if (value === 'function') { + try { + return parseFunctionType(); + } catch (e) { + context.restore(); + } + } + + return parseTypeName(); + + default: + utility.throwError('unexpected token'); + } + } + + // TypeExpression := + // BasicTypeExpression + // | '?' BasicTypeExpression + // | '!' BasicTypeExpression + // | BasicTypeExpression '?' + // | BasicTypeExpression '!' + // | '?' + // | BasicTypeExpression '[]' + function parseTypeExpression() { + var expr; + + if (token === Token.QUESTION) { + consume(Token.QUESTION); + if (token === Token.COMMA || token === Token.EQUAL || token === Token.RBRACE || + token === Token.RPAREN || token === Token.PIPE || token === Token.EOF || + token === Token.RBRACK || token === Token.GT) { + return { + type: Syntax.NullableLiteral + }; + } + return { + type: Syntax.NullableType, + expression: parseBasicTypeExpression(), + prefix: true + }; + } + + if (token === Token.BANG) { + consume(Token.BANG); + return { + type: Syntax.NonNullableType, + expression: parseBasicTypeExpression(), + prefix: true + }; + } + + expr = parseBasicTypeExpression(); + if (token === Token.BANG) { + consume(Token.BANG); + return { + type: Syntax.NonNullableType, + expression: expr, + prefix: false + }; + } + + if (token === Token.QUESTION) { + consume(Token.QUESTION); + return { + type: Syntax.NullableType, + expression: expr, + prefix: false + }; + } + + if (token === Token.LBRACK) { + consume(Token.LBRACK); + expect(Token.RBRACK, 'expected an array-style type declaration (' + value + '[])'); + return { + type: Syntax.TypeApplication, + expression: { + type: Syntax.NameExpression, + name: 'Array' + }, + applications: [expr] + }; + } + + return expr; + } + + // TopLevelTypeExpression := + // TypeExpression + // | TypeUnionList + // + // This rule is Google Closure Compiler extension, not ES4 + // like, + // { number | string } + // If strict to ES4, we should write it as + // { (number|string) } + function parseTop() { + var expr, elements; + + expr = parseTypeExpression(); + if (token !== Token.PIPE) { + return expr; + } + + elements = [ expr ]; + consume(Token.PIPE); + while (true) { + elements.push(parseTypeExpression()); + if (token !== Token.PIPE) { + break; + } + consume(Token.PIPE); + } + + return { + type: Syntax.UnionType, + elements: elements + }; + } + + function parseTopParamType() { + var expr; + + if (token === Token.REST) { + consume(Token.REST); + return { + type: Syntax.RestType, + expression: parseTop() + }; + } + + expr = parseTop(); + if (token === Token.EQUAL) { + consume(Token.EQUAL); + return { + type: Syntax.OptionalType, + expression: expr + }; + } + + return expr; + } + + function parseType(src, opt) { + var expr; + + source = src; + length = source.length; + index = 0; + previous = 0; + + next(); + expr = parseTop(); + + if (opt && opt.midstream) { + return { + expression: expr, + index: previous + }; + } + + if (token !== Token.EOF) { + utility.throwError('not reach to EOF'); + } + + return expr; + } + + function parseParamType(src, opt) { + var expr; + + source = src; + length = source.length; + index = 0; + previous = 0; + + next(); + expr = parseTopParamType(); + + if (opt && opt.midstream) { + return { + expression: expr, + index: previous + }; + } + + if (token !== Token.EOF) { + utility.throwError('not reach to EOF'); + } + + return expr; + } + + function stringifyImpl(node, compact, topLevel) { + var result, i, iz; + + switch (node.type) { + case Syntax.NullableLiteral: + result = '?'; + break; + + case Syntax.AllLiteral: + result = '*'; + break; + + case Syntax.NullLiteral: + result = 'null'; + break; + + case Syntax.UndefinedLiteral: + result = 'undefined'; + break; + + case Syntax.VoidLiteral: + result = 'void'; + break; + + case Syntax.UnionType: + if (!topLevel) { + result = '('; + } else { + result = ''; + } + + for (i = 0, iz = node.elements.length; i < iz; ++i) { + result += stringifyImpl(node.elements[i], compact); + if ((i + 1) !== iz) { + result += '|'; + } + } + + if (!topLevel) { + result += ')'; + } + break; + + case Syntax.ArrayType: + result = '['; + for (i = 0, iz = node.elements.length; i < iz; ++i) { + result += stringifyImpl(node.elements[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += ']'; + break; + + case Syntax.RecordType: + result = '{'; + for (i = 0, iz = node.fields.length; i < iz; ++i) { + result += stringifyImpl(node.fields[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += '}'; + break; + + case Syntax.FieldType: + if (node.value) { + result = node.key + (compact ? ':' : ': ') + stringifyImpl(node.value, compact); + } else { + result = node.key; + } + break; + + case Syntax.FunctionType: + result = compact ? 'function(' : 'function ('; + + if (node['this']) { + if (node['new']) { + result += (compact ? 'new:' : 'new: '); + } else { + result += (compact ? 'this:' : 'this: '); + } + + result += stringifyImpl(node['this'], compact); + + if (node.params.length !== 0) { + result += compact ? ',' : ', '; + } + } + + for (i = 0, iz = node.params.length; i < iz; ++i) { + result += stringifyImpl(node.params[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + + result += ')'; + + if (node.result) { + result += (compact ? ':' : ': ') + stringifyImpl(node.result, compact); + } + break; + + case Syntax.ParameterType: + result = node.name + (compact ? ':' : ': ') + stringifyImpl(node.expression, compact); + break; + + case Syntax.RestType: + result = '...'; + if (node.expression) { + result += stringifyImpl(node.expression, compact); + } + break; + + case Syntax.NonNullableType: + if (node.prefix) { + result = '!' + stringifyImpl(node.expression, compact); + } else { + result = stringifyImpl(node.expression, compact) + '!'; + } + break; + + case Syntax.OptionalType: + result = stringifyImpl(node.expression, compact) + '='; + break; + + case Syntax.NullableType: + if (node.prefix) { + result = '?' + stringifyImpl(node.expression, compact); + } else { + result = stringifyImpl(node.expression, compact) + '?'; + } + break; + + case Syntax.NameExpression: + result = node.name; + break; + + case Syntax.TypeApplication: + result = stringifyImpl(node.expression, compact) + '.<'; + for (i = 0, iz = node.applications.length; i < iz; ++i) { + result += stringifyImpl(node.applications[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += '>'; + break; + + default: + utility.throwError('Unknown type ' + node.type); + } + + return result; + } + + function stringify(node, options) { + if (options == null) { + options = {}; + } + return stringifyImpl(node, options.compact, options.topLevel); + } + + exports.parseType = parseType; + exports.parseParamType = parseParamType; + exports.stringify = stringify; + exports.Syntax = Syntax; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/lib/utility.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/lib/utility.js new file mode 100644 index 00000000..bb441258 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/lib/utility.js @@ -0,0 +1,54 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +(function () { + 'use strict'; + + var VERSION; + + VERSION = require('../package.json').version; + exports.VERSION = VERSION; + + function DoctrineError(message) { + this.name = 'DoctrineError'; + this.message = message; + } + DoctrineError.prototype = (function () { + var Middle = function () { }; + Middle.prototype = Error.prototype; + return new Middle(); + }()); + DoctrineError.prototype.constructor = DoctrineError; + exports.DoctrineError = DoctrineError; + + function throwError(message) { + throw new DoctrineError(message); + } + exports.throwError = throwError; + + exports.assert = require('assert'); +}()); + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/LICENSE.BSD b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/LICENSE.BSD new file mode 100644 index 00000000..3e580c35 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/README.md b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/README.md new file mode 100644 index 00000000..494fac5e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/README.md @@ -0,0 +1,169 @@ +### esutils [![Build Status](https://secure.travis-ci.org/Constellation/esutils.svg)](http://travis-ci.org/Constellation/esutils) +esutils ([esutils](http://github.com/Constellation/esutils)) is +utility box for ECMAScript language tools. + +### API + +### ast + +#### ast.isExpression(node) + +Returns true if `node` is an Expression as defined in ECMA262 edition 5.1 section +[11](https://es5.github.io/#x11). + +#### ast.isStatement(node) + +Returns true if `node` is a Statement as defined in ECMA262 edition 5.1 section +[12](https://es5.github.io/#x12). + +#### ast.isIterationStatement(node) + +Returns true if `node` is an IterationStatement as defined in ECMA262 edition +5.1 section [12.6](https://es5.github.io/#x12.6). + +#### ast.isSourceElement(node) + +Returns true if `node` is a SourceElement as defined in ECMA262 edition 5.1 +section [14](https://es5.github.io/#x14). + +#### ast.trailingStatement(node) + +Returns `Statement?` if `node` has trailing `Statement`. +```js +if (cond) + consequent; +``` +When taking this `IfStatement`, returns `consequent;` statement. + +#### ast.isProblematicIfStatement(node) + +Returns true if `node` is a problematic IfStatement. If `node` is a problematic `IfStatement`, `node` cannot be represented as an one on one JavaScript code. +```js +{ + type: 'IfStatement', + consequent: { + type: 'WithStatement', + body: { + type: 'IfStatement', + consequent: {type: 'EmptyStatement'} + } + }, + alternate: {type: 'EmptyStatement'} +} +``` +The above node cannot be represented as a JavaScript code, since the top level `else` alternate belongs to an inner `IfStatement`. + + +### code + +#### code.isDecimalDigit(code) + +Return true if provided code is decimal digit. + +#### code.isHexDigit(code) + +Return true if provided code is hexadecimal digit. + +#### code.isOctalDigit(code) + +Return true if provided code is octal digit. + +#### code.isWhiteSpace(code) + +Return true if provided code is white space. White space characters are formally defined in ECMA262. + +#### code.isLineTerminator(code) + +Return true if provided code is line terminator. Line terminator characters are formally defined in ECMA262. + +#### code.isIdentifierStart(code) + +Return true if provided code can be the first character of ECMA262 Identifier. They are formally defined in ECMA262. + +#### code.isIdentifierPart(code) + +Return true if provided code can be the trailing character of ECMA262 Identifier. They are formally defined in ECMA262. + +### keyword + +#### keyword.isKeywordES5(id, strict) + +Returns `true` if provided identifier string is a Keyword or Future Reserved Word +in ECMA262 edition 5.1. They are formally defined in ECMA262 sections +[7.6.1.1](http://es5.github.io/#x7.6.1.1) and [7.6.1.2](http://es5.github.io/#x7.6.1.2), +respectively. If the `strict` flag is truthy, this function additionally checks whether +`id` is a Keyword or Future Reserved Word under strict mode. + +#### keyword.isKeywordES6(id, strict) + +Returns `true` if provided identifier string is a Keyword or Future Reserved Word +in ECMA262 edition 6. They are formally defined in ECMA262 sections +[11.6.2.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-keywords) and +[11.6.2.2](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-future-reserved-words), +respectively. If the `strict` flag is truthy, this function additionally checks whether +`id` is a Keyword or Future Reserved Word under strict mode. + +#### keyword.isReservedWordES5(id, strict) + +Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 5.1. +They are formally defined in ECMA262 section [7.6.1](http://es5.github.io/#x7.6.1). +If the `strict` flag is truthy, this function additionally checks whether `id` +is a Reserved Word under strict mode. + +#### keyword.isReservedWordES6(id, strict) + +Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 6. +They are formally defined in ECMA262 section [11.6.2](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words). +If the `strict` flag is truthy, this function additionally checks whether `id` +is a Reserved Word under strict mode. + +#### keyword.isRestrictedWord(id) + +Returns `true` if provided identifier string is one of `eval` or `arguments`. +They are restricted in strict mode code throughout ECMA262 edition 5.1 and +in ECMA262 edition 6 section [12.1.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors). + +#### keyword.isIdentifierName(id) + +Return true if provided identifier string is an IdentifierName as specified in +ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). + +#### keyword.isIdentifierES5(id, strict) + +Return true if provided identifier string is an Identifier as specified in +ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). If the `strict` +flag is truthy, this function additionally checks whether `id` is an Identifier +under strict mode. + +#### keyword.isIdentifierES6(id, strict) + +Return true if provided identifier string is an Identifier as specified in +ECMA262 edition 6 section [12.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers). +If the `strict` flag is truthy, this function additionally checks whether `id` +is an Identifier under strict mode. + +### License + +Copyright (C) 2013 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/ast.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/ast.js new file mode 100644 index 00000000..8faadae1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/ast.js @@ -0,0 +1,144 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + function isExpression(node) { + if (node == null) { return false; } + switch (node.type) { + case 'ArrayExpression': + case 'AssignmentExpression': + case 'BinaryExpression': + case 'CallExpression': + case 'ConditionalExpression': + case 'FunctionExpression': + case 'Identifier': + case 'Literal': + case 'LogicalExpression': + case 'MemberExpression': + case 'NewExpression': + case 'ObjectExpression': + case 'SequenceExpression': + case 'ThisExpression': + case 'UnaryExpression': + case 'UpdateExpression': + return true; + } + return false; + } + + function isIterationStatement(node) { + if (node == null) { return false; } + switch (node.type) { + case 'DoWhileStatement': + case 'ForInStatement': + case 'ForStatement': + case 'WhileStatement': + return true; + } + return false; + } + + function isStatement(node) { + if (node == null) { return false; } + switch (node.type) { + case 'BlockStatement': + case 'BreakStatement': + case 'ContinueStatement': + case 'DebuggerStatement': + case 'DoWhileStatement': + case 'EmptyStatement': + case 'ExpressionStatement': + case 'ForInStatement': + case 'ForStatement': + case 'IfStatement': + case 'LabeledStatement': + case 'ReturnStatement': + case 'SwitchStatement': + case 'ThrowStatement': + case 'TryStatement': + case 'VariableDeclaration': + case 'WhileStatement': + case 'WithStatement': + return true; + } + return false; + } + + function isSourceElement(node) { + return isStatement(node) || node != null && node.type === 'FunctionDeclaration'; + } + + function trailingStatement(node) { + switch (node.type) { + case 'IfStatement': + if (node.alternate != null) { + return node.alternate; + } + return node.consequent; + + case 'LabeledStatement': + case 'ForStatement': + case 'ForInStatement': + case 'WhileStatement': + case 'WithStatement': + return node.body; + } + return null; + } + + function isProblematicIfStatement(node) { + var current; + + if (node.type !== 'IfStatement') { + return false; + } + if (node.alternate == null) { + return false; + } + current = node.consequent; + do { + if (current.type === 'IfStatement') { + if (current.alternate == null) { + return true; + } + } + current = trailingStatement(current); + } while (current); + + return false; + } + + module.exports = { + isExpression: isExpression, + isStatement: isStatement, + isIterationStatement: isIterationStatement, + isSourceElement: isSourceElement, + isProblematicIfStatement: isProblematicIfStatement, + + trailingStatement: trailingStatement + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/code.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/code.js new file mode 100644 index 00000000..730292a3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/code.js @@ -0,0 +1,101 @@ +/* + Copyright (C) 2013-2014 Yusuke Suzuki + Copyright (C) 2014 Ivan Nikulin + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + var Regex, NON_ASCII_WHITESPACES; + + // See `tools/generate-identifier-regex.js`. + Regex = { + NonAsciiIdentifierStart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]'), + NonAsciiIdentifierPart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]') + }; + + function isDecimalDigit(ch) { + return (ch >= 48 && ch <= 57); // 0..9 + } + + function isHexDigit(ch) { + return isDecimalDigit(ch) || // 0..9 + (97 <= ch && ch <= 102) || // a..f + (65 <= ch && ch <= 70); // A..F + } + + function isOctalDigit(ch) { + return (ch >= 48 && ch <= 55); // 0..7 + } + + // 7.2 White Space + + NON_ASCII_WHITESPACES = [ + 0x1680, 0x180E, + 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, + 0x202F, 0x205F, + 0x3000, + 0xFEFF + ]; + + function isWhiteSpace(ch) { + return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || + (ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0); + } + + // 7.3 Line Terminators + + function isLineTerminator(ch) { + return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); + } + + // 7.6 Identifier Names and Identifiers + + function isIdentifierStart(ch) { + return (ch >= 97 && ch <= 122) || // a..z + (ch >= 65 && ch <= 90) || // A..Z + (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore) + (ch === 92) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))); + } + + function isIdentifierPart(ch) { + return (ch >= 97 && ch <= 122) || // a..z + (ch >= 65 && ch <= 90) || // A..Z + (ch >= 48 && ch <= 57) || // 0..9 + (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore) + (ch === 92) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))); + } + + module.exports = { + isDecimalDigit: isDecimalDigit, + isHexDigit: isHexDigit, + isOctalDigit: isOctalDigit, + isWhiteSpace: isWhiteSpace, + isLineTerminator: isLineTerminator, + isIdentifierStart: isIdentifierStart, + isIdentifierPart: isIdentifierPart + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/keyword.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/keyword.js new file mode 100644 index 00000000..884be72f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/keyword.js @@ -0,0 +1,137 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + var code = require('./code'); + + function isStrictModeReservedWordES6(id) { + switch (id) { + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'let': + return true; + default: + return false; + } + } + + function isKeywordES5(id, strict) { + // yield should not be treated as keyword under non-strict mode. + if (!strict && id === 'yield') { + return false; + } + return isKeywordES6(id, strict); + } + + function isKeywordES6(id, strict) { + if (strict && isStrictModeReservedWordES6(id)) { + return true; + } + + switch (id.length) { + case 2: + return (id === 'if') || (id === 'in') || (id === 'do'); + case 3: + return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try'); + case 4: + return (id === 'this') || (id === 'else') || (id === 'case') || + (id === 'void') || (id === 'with') || (id === 'enum'); + case 5: + return (id === 'while') || (id === 'break') || (id === 'catch') || + (id === 'throw') || (id === 'const') || (id === 'yield') || + (id === 'class') || (id === 'super'); + case 6: + return (id === 'return') || (id === 'typeof') || (id === 'delete') || + (id === 'switch') || (id === 'export') || (id === 'import'); + case 7: + return (id === 'default') || (id === 'finally') || (id === 'extends'); + case 8: + return (id === 'function') || (id === 'continue') || (id === 'debugger'); + case 10: + return (id === 'instanceof'); + default: + return false; + } + } + + function isReservedWordES5(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict); + } + + function isReservedWordES6(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict); + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + function isIdentifierName(id) { + var i, iz, ch; + + if (id.length === 0) { + return false; + } + + ch = id.charCodeAt(0); + if (!code.isIdentifierStart(ch) || ch === 92) { // \ (backslash) + return false; + } + + for (i = 1, iz = id.length; i < iz; ++i) { + ch = id.charCodeAt(i); + if (!code.isIdentifierPart(ch) || ch === 92) { // \ (backslash) + return false; + } + } + return true; + } + + function isIdentifierES5(id, strict) { + return isIdentifierName(id) && !isReservedWordES5(id, strict); + } + + function isIdentifierES6(id, strict) { + return isIdentifierName(id) && !isReservedWordES6(id, strict); + } + + module.exports = { + isKeywordES5: isKeywordES5, + isKeywordES6: isKeywordES6, + isReservedWordES5: isReservedWordES5, + isReservedWordES6: isReservedWordES6, + isRestrictedWord: isRestrictedWord, + isIdentifierName: isIdentifierName, + isIdentifierES5: isIdentifierES5, + isIdentifierES6: isIdentifierES6 + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/utils.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/utils.js new file mode 100644 index 00000000..ce18faa6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/lib/utils.js @@ -0,0 +1,33 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +(function () { + 'use strict'; + + exports.ast = require('./ast'); + exports.code = require('./code'); + exports.keyword = require('./keyword'); +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/package.json b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/package.json new file mode 100644 index 00000000..f4741b1f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/esutils/package.json @@ -0,0 +1,66 @@ +{ + "name": "esutils", + "description": "utility box for ECMAScript language tools", + "homepage": "https://github.com/Constellation/esutils", + "main": "lib/utils.js", + "version": "1.1.6", + "engines": { + "node": ">=0.10.0" + }, + "directories": { + "lib": "./lib" + }, + "files": [ + "LICENSE.BSD", + "README.md", + "lib" + ], + "maintainers": [ + { + "name": "constellation", + "email": "utatane.tea@gmail.com" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/Constellation/esutils.git" + }, + "devDependencies": { + "mocha": "~1.12.0", + "chai": "~1.7.2", + "jshint": "2.1.5", + "coffee-script": "~1.6.3", + "unicode-6.3.0": "~0.1.1", + "regenerate": "~0.5.4" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/Constellation/esutils/raw/master/LICENSE.BSD" + } + ], + "scripts": { + "test": "npm run-script lint && npm run-script unit-test", + "lint": "jshint lib/*.js", + "unit-test": "mocha --compilers coffee:coffee-script -R spec", + "generate-regex": "node tools/generate-identifier-regex.js" + }, + "gitHead": "a91c5ed6199d1019ef071f610848fcd5103ef153", + "bugs": { + "url": "https://github.com/Constellation/esutils/issues" + }, + "_id": "esutils@1.1.6", + "_shasum": "c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375", + "_from": "esutils@>=1.1.6 <2.0.0", + "_npmVersion": "2.0.0-alpha-5", + "_npmUser": { + "name": "constellation", + "email": "utatane.tea@gmail.com" + }, + "dist": { + "shasum": "c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375", + "tarball": "http://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz" + }, + "_resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/README.md b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/README.md new file mode 100644 index 00000000..052a62b8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/README.md @@ -0,0 +1,54 @@ + +# isarray + +`Array#isArray` for older browsers. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](http://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/browserify). + +With [component](http://component.io) do + +```bash +$ component install juliangruber/isarray +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/build/build.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/build/build.js new file mode 100644 index 00000000..ec58596a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/build/build.js @@ -0,0 +1,209 @@ + +/** + * Require the given path. + * + * @param {String} path + * @return {Object} exports + * @api public + */ + +function require(path, parent, orig) { + var resolved = require.resolve(path); + + // lookup failed + if (null == resolved) { + orig = orig || path; + parent = parent || 'root'; + var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); + err.path = orig; + err.parent = parent; + err.require = true; + throw err; + } + + var module = require.modules[resolved]; + + // perform real require() + // by invoking the module's + // registered function + if (!module.exports) { + module.exports = {}; + module.client = module.component = true; + module.call(this, module.exports, require.relative(resolved), module); + } + + return module.exports; +} + +/** + * Registered modules. + */ + +require.modules = {}; + +/** + * Registered aliases. + */ + +require.aliases = {}; + +/** + * Resolve `path`. + * + * Lookup: + * + * - PATH/index.js + * - PATH.js + * - PATH + * + * @param {String} path + * @return {String} path or null + * @api private + */ + +require.resolve = function(path) { + if (path.charAt(0) === '/') path = path.slice(1); + var index = path + '/index.js'; + + var paths = [ + path, + path + '.js', + path + '.json', + path + '/index.js', + path + '/index.json' + ]; + + for (var i = 0; i < paths.length; i++) { + var path = paths[i]; + if (require.modules.hasOwnProperty(path)) return path; + } + + if (require.aliases.hasOwnProperty(index)) { + return require.aliases[index]; + } +}; + +/** + * Normalize `path` relative to the current path. + * + * @param {String} curr + * @param {String} path + * @return {String} + * @api private + */ + +require.normalize = function(curr, path) { + var segs = []; + + if ('.' != path.charAt(0)) return path; + + curr = curr.split('/'); + path = path.split('/'); + + for (var i = 0; i < path.length; ++i) { + if ('..' == path[i]) { + curr.pop(); + } else if ('.' != path[i] && '' != path[i]) { + segs.push(path[i]); + } + } + + return curr.concat(segs).join('/'); +}; + +/** + * Register module at `path` with callback `definition`. + * + * @param {String} path + * @param {Function} definition + * @api private + */ + +require.register = function(path, definition) { + require.modules[path] = definition; +}; + +/** + * Alias a module definition. + * + * @param {String} from + * @param {String} to + * @api private + */ + +require.alias = function(from, to) { + if (!require.modules.hasOwnProperty(from)) { + throw new Error('Failed to alias "' + from + '", it does not exist'); + } + require.aliases[to] = from; +}; + +/** + * Return a require function relative to the `parent` path. + * + * @param {String} parent + * @return {Function} + * @api private + */ + +require.relative = function(parent) { + var p = require.normalize(parent, '..'); + + /** + * lastIndexOf helper. + */ + + function lastIndexOf(arr, obj) { + var i = arr.length; + while (i--) { + if (arr[i] === obj) return i; + } + return -1; + } + + /** + * The relative require() itself. + */ + + function localRequire(path) { + var resolved = localRequire.resolve(path); + return require(resolved, parent, path); + } + + /** + * Resolve relative to the parent. + */ + + localRequire.resolve = function(path) { + var c = path.charAt(0); + if ('/' == c) return path.slice(1); + if ('.' == c) return require.normalize(p, path); + + // resolve deps by returning + // the dep in the nearest "deps" + // directory + var segs = parent.split('/'); + var i = lastIndexOf(segs, 'deps') + 1; + if (!i) i = 0; + path = segs.slice(0, i + 1).join('/') + '/deps/' + path; + return path; + }; + + /** + * Check if module is defined at `path`. + */ + + localRequire.exists = function(path) { + return require.modules.hasOwnProperty(localRequire.resolve(path)); + }; + + return localRequire; +}; +require.register("isarray/index.js", function(exports, require, module){ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; + +}); +require.alias("isarray/index.js", "isarray/index.js"); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/component.json b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/component.json new file mode 100644 index 00000000..9e31b683 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/component.json @@ -0,0 +1,19 @@ +{ + "name" : "isarray", + "description" : "Array#isArray for older browsers", + "version" : "0.0.1", + "repository" : "juliangruber/isarray", + "homepage": "https://github.com/juliangruber/isarray", + "main" : "index.js", + "scripts" : [ + "index.js" + ], + "dependencies" : {}, + "keywords": ["browser","isarray","array"], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/index.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/index.js new file mode 100644 index 00000000..5f5ad45d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/index.js @@ -0,0 +1,3 @@ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/package.json b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/package.json new file mode 100644 index 00000000..19228ab6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/node_modules/isarray/package.json @@ -0,0 +1,53 @@ +{ + "name": "isarray", + "description": "Array#isArray for older browsers", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "homepage": "https://github.com/juliangruber/isarray", + "main": "index.js", + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": {}, + "devDependencies": { + "tap": "*" + }, + "keywords": [ + "browser", + "isarray", + "array" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "_id": "isarray@0.0.1", + "dist": { + "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "_from": "isarray@0.0.1", + "_npmVersion": "1.2.18", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "directories": {}, + "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "bugs": { + "url": "https://github.com/juliangruber/isarray/issues" + }, + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/package.json b/node_modules/standard/node_modules/eslint/node_modules/doctrine/package.json new file mode 100644 index 00000000..be964e49 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/package.json @@ -0,0 +1,71 @@ +{ + "name": "doctrine", + "description": "JSDoc parser", + "homepage": "http://github.com/Constellation/doctrine.html", + "main": "lib/doctrine.js", + "version": "0.6.4", + "engines": { + "node": ">=0.10.0" + }, + "directories": { + "lib": "./lib" + }, + "maintainers": [ + { + "name": "constellation", + "email": "utatane.tea@gmail.com" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/Constellation/doctrine.git" + }, + "devDependencies": { + "coveralls": "^2.11.2", + "gulp": "^3.8.10", + "gulp-bump": "^0.1.13", + "gulp-eslint": "^0.5.0", + "gulp-filter": "^2.0.2", + "gulp-git": "^1.0.0", + "gulp-istanbul": "^0.6.0", + "gulp-jshint": "^1.9.0", + "gulp-mocha": "^2.0.0", + "gulp-tag-version": "^1.2.1", + "jshint-stylish": "^1.0.0", + "should": "^5.0.1" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/Constellation/doctrine/raw/master/LICENSE.BSD" + } + ], + "scripts": { + "test": "gulp", + "unit-test": "gulp test", + "lint": "gulp lint", + "coveralls": "cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" + }, + "dependencies": { + "esutils": "^1.1.6", + "isarray": "0.0.1" + }, + "gitHead": "0835299b485ecdfa908d20628d6c8900144590ff", + "bugs": { + "url": "https://github.com/Constellation/doctrine/issues" + }, + "_id": "doctrine@0.6.4", + "_shasum": "81428491a942ef18b0492056eda3800eee57d61d", + "_from": "doctrine@>=0.6.2 <0.7.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "constellation", + "email": "utatane.tea@gmail.com" + }, + "dist": { + "shasum": "81428491a942ef18b0492056eda3800eee57d61d", + "tarball": "http://registry.npmjs.org/doctrine/-/doctrine-0.6.4.tgz" + }, + "_resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.6.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/midstream.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/midstream.js new file mode 100644 index 00000000..2e71bd14 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/midstream.js @@ -0,0 +1,61 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*global require describe it*/ +/*jslint node:true */ +'use strict'; + +var fs = require('fs'), + path = require('path'), + root = path.join(path.dirname(fs.realpathSync(__filename)), '..'), + doctrine = require(root); +require('should'); + +describe('midstream', function () { + it('parseType', function () { + var res = doctrine.parseType('string name', { midstream: true }); + res.should.eql({ + "expression": { + "name": "string", + "type": "NameExpression" + }, + "index": 6 + }); + }); + + it('parseParamType', function () { + var res = doctrine.parseParamType('...test ok', { midstream: true }); + res.should.eql({ + "expression": { + "expression": { + "name": "test", + "type": "NameExpression" + }, + "type": "RestType" + }, + "index": 7 + }); + }); +}); + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/parse.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/parse.js new file mode 100644 index 00000000..851e67c0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/parse.js @@ -0,0 +1,2219 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*global require describe it*/ +/*jslint node:true */ +'use strict'; + +var fs = require('fs'), + path = require('path'), + root = path.join(path.dirname(fs.realpathSync(__filename)), '..'), + doctrine = require(root); +require('should'); + +describe('parse', function () { + it('alias', function () { + var res = doctrine.parse('/** @alias */', { unwrap: true }); + res.tags.should.have.length(0); + }); + + it('alias with name', function () { + var res = doctrine.parse('/** @alias aliasName */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'alias'); + res.tags[0].should.have.property('name', 'aliasName'); + }); + + it('alias with namepath', function () { + var res = doctrine.parse('/** @alias aliasName.OK */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'alias'); + res.tags[0].should.have.property('name', 'aliasName.OK'); + }); + + it('const', function () { + var res = doctrine.parse('/** @const */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'const'); + }); + + it('const with name', function () { + var res = doctrine.parse('/** @const constname */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'const'); + res.tags[0].should.have.property('name', 'constname'); + }); + + it('constant with name', function () { + var res = doctrine.parse('/** @constant constname */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'constant'); + res.tags[0].should.have.property('name', 'constname'); + }); + + it('const with type and name', function () { + var res = doctrine.parse('/** @const {String} constname */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'const'); + res.tags[0].should.have.property('name', 'constname'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'String' + }); + }); + + it('constant with type and name', function () { + var res = doctrine.parse('/** @constant {String} constname */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'constant'); + res.tags[0].should.have.property('name', 'constname'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'String' + }); + }); + + it('const multiple', function () { + var res = doctrine.parse("/**@const\n @const*/", { unwrap: true }); + res.tags.should.have.length(2); + res.tags[0].should.have.property('title', 'const'); + res.tags[1].should.have.property('title', 'const'); + }); + + it('const double', function () { + var res = doctrine.parse("/**@const\n @const*/", { unwrap: true }); + res.tags.should.have.length(2); + res.tags[0].should.have.property('title', 'const'); + res.tags[1].should.have.property('title', 'const'); + }); + + it('const triple', function () { + var res = doctrine.parse( + [ + "/**", + " * @const @const", + " * @const @const", + " * @const @const", + " */" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(3); + res.tags[0].should.have.property('title', 'const'); + res.tags[1].should.have.property('title', 'const'); + res.tags[2].should.have.property('title', 'const'); + }); + + it('constructor', function () { + var res = doctrine.parse('/** @constructor */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'constructor'); + }); + + it('constructor with type', function () { + var res = doctrine.parse('/** @constructor {Object} */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'constructor'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'Object' + }); + }); + + it('constructor with type and name', function () { + var res = doctrine.parse('/** @constructor {Object} objName */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'constructor'); + res.tags[0].should.have.property('name', 'objName'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'Object' + }); + }); + + it('class', function () { + var res = doctrine.parse('/** @class */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'class'); + }); + + it('class with type', function () { + var res = doctrine.parse('/** @class {Object} */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'class'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'Object' + }); + }); + + it('class with type and name', function () { + var res = doctrine.parse('/** @class {Object} objName */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'class'); + res.tags[0].should.have.property('name', 'objName'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'Object' + }); + }); + + it('deprecated', function () { + var res = doctrine.parse('/** @deprecated */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'deprecated'); + }); + + it('deprecated', function () { + var res = doctrine.parse('/** @deprecated some text here describing why it is deprecated */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'deprecated'); + res.tags[0].should.have.property('description', 'some text here describing why it is deprecated'); + }); + + it('func', function () { + var res = doctrine.parse('/** @func */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'func'); + }); + + it('func with name', function () { + var res = doctrine.parse('/** @func thingName.func */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'func'); + res.tags[0].should.have.property('name', 'thingName.func'); + }); + + it('func with type', function () { + var res = doctrine.parse('/** @func {Object} thingName.func */', { unwrap: true }); + res.tags.should.have.length(0); + // func does not accept type + }); + + it('function', function () { + var res = doctrine.parse('/** @function */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'function'); + }); + + it('function with name', function () { + var res = doctrine.parse('/** @function thingName.function */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'function'); + res.tags[0].should.have.property('name', 'thingName.function'); + }); + + it('function with type', function () { + var res = doctrine.parse('/** @function {Object} thingName.function */', { unwrap: true }); + res.tags.should.have.length(0); + // function does not accept type + }); + + it('member', function () { + var res = doctrine.parse('/** @member */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'member'); + }); + + it('member with name', function () { + var res = doctrine.parse('/** @member thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'member'); + res.tags[0].should.have.property('name', 'thingName.name'); + }); + + it('member with type', function () { + var res = doctrine.parse('/** @member {Object} thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'member'); + res.tags[0].should.have.property('name', 'thingName.name'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'Object' + }); + }); + + it('method', function () { + var res = doctrine.parse('/** @method */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'method'); + }); + + it('method with name', function () { + var res = doctrine.parse('/** @method thingName.function */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'method'); + res.tags[0].should.have.property('name', 'thingName.function'); + }); + + it('method with type', function () { + var res = doctrine.parse('/** @method {Object} thingName.function */', { unwrap: true }); + res.tags.should.have.length(0); + // method does not accept type + }); + + it('mixes', function () { + var res = doctrine.parse('/** @mixes */', { unwrap: true }); + res.tags.should.have.length(0); + }); + + it('mixes with name', function () { + var res = doctrine.parse('/** @mixes thingName */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'mixes'); + res.tags[0].should.have.property('name', 'thingName'); + }); + + it('mixes with namepath', function () { + var res = doctrine.parse('/** @mixes thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'mixes'); + res.tags[0].should.have.property('name', 'thingName.name'); + }); + + it('mixin', function () { + var res = doctrine.parse('/** @mixin */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'mixin'); + }); + + it('mixin with name', function () { + var res = doctrine.parse('/** @mixin thingName */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'mixin'); + res.tags[0].should.have.property('name', 'thingName'); + }); + + it('mixin with namepath', function () { + var res = doctrine.parse('/** @mixin thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'mixin'); + res.tags[0].should.have.property('name', 'thingName.name'); + }); + + it('module', function () { + var res = doctrine.parse('/** @module */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'module'); + }); + + it('module with name', function () { + var res = doctrine.parse('/** @module thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'module'); + res.tags[0].should.have.property('name', 'thingName.name'); + }); + + it('module with type', function () { + var res = doctrine.parse('/** @module {Object} thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'module'); + res.tags[0].should.have.property('name', 'thingName.name'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'Object' + }); + }); + + it('name', function () { + var res = doctrine.parse('/** @name thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'name'); + res.tags[0].should.have.property('name', 'thingName.name'); + }); + + it('name', function () { + var res = doctrine.parse('/** @name thingName#name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'name'); + res.tags[0].should.have.property('name', 'thingName#name'); + }); + + it('name', function () { + var res = doctrine.parse('/** @name thingName~name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'name'); + res.tags[0].should.have.property('name', 'thingName~name'); + }); + + it('name', function () { + var res = doctrine.parse('/** @name {thing} thingName.name */', { unwrap: true }); + // name does not accept type + res.tags.should.have.length(0); + }); + + it('namespace', function () { + var res = doctrine.parse('/** @namespace */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'namespace'); + }); + + it('namespace with name', function () { + var res = doctrine.parse('/** @namespace thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'namespace'); + res.tags[0].should.have.property('name', 'thingName.name'); + }); + + it('namespace with type', function () { + var res = doctrine.parse('/** @namespace {Object} thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'namespace'); + res.tags[0].should.have.property('name', 'thingName.name'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'Object' + }); + }); + + it('param', function () { + var res = doctrine.parse( + [ + "/**", + " * @param {String} userName", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('name', 'userName'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'String' + }); + }); + + it('param with properties', function () { + var res = doctrine.parse( + [ + "/**", + " * @param {String} user.name", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('name', 'user.name'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'String' + }); + }); + + it('arg with properties', function () { + var res = doctrine.parse( + [ + "/**", + " * @arg {String} user.name", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'arg'); + res.tags[0].should.have.property('name', 'user.name'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'String' + }); + }); + + it('argument with properties', function () { + var res = doctrine.parse( + [ + "/**", + " * @argument {String} user.name", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'argument'); + res.tags[0].should.have.property('name', 'user.name'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'String' + }); + }); + + it('param typeless', function () { + var res = doctrine.parse( + [ + "/**", + " * @param userName", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.eql({ + title: 'param', + type: null, + name: 'userName', + description: null + }); + + var res = doctrine.parse( + [ + "/**", + " * @param userName Something descriptive", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.eql({ + title: 'param', + type: null, + name: 'userName', + description: 'Something descriptive' + }); + + var res = doctrine.parse( + [ + "/**", + " * @param user.name Something descriptive", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.eql({ + title: 'param', + type: null, + name: 'user.name', + description: 'Something descriptive' + }); + }); + + it('param broken', function () { + var res = doctrine.parse( + [ + "/**", + " * @param {String} userName", + " * @param {String userName", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('name', 'userName'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'String' + }); + }); + + it('param record', function () { + var res = doctrine.parse( + [ + "/**", + " * @param {{ok:String}} userName", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('name', 'userName'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'RecordType', + fields: [{ + type: 'FieldType', + key: 'ok', + value: { + type: 'NameExpression', + name: 'String' + } + }] + }); + }); + + it('param record broken', function () { + var res = doctrine.parse( + [ + "/**", + " * @param {{ok:String} userName", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.be.empty; + }); + + it('param multiple lines', function () { + var res = doctrine.parse( + [ + "/**", + " * @param {string|", + " * number} userName", + " * }}", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('name', 'userName'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'UnionType', + elements: [{ + type: 'NameExpression', + name: 'string' + }, { + type: 'NameExpression', + name: 'number' + }] + }); + }); + + it('param without braces', function () { + var res = doctrine.parse( + [ + "/**", + " * @param string name description", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('name', 'string'); + res.tags[0].should.have.property('type', null); + res.tags[0].should.have.property('description', 'name description'); + }); + + it('param w/ hyphen before description', function () { + var res = doctrine.parse( + [ + "/**", + " * @param {string} name - description", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.eql({ + title: 'param', + type: { + type: 'NameExpression', + name: 'string' + }, + name: 'name', + description: 'description' + }); + }); + + it('param w/ hyphen + leading space before description', function () { + var res = doctrine.parse( + [ + "/**", + " * @param {string} name - description", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.eql({ + title: 'param', + type: { + type: 'NameExpression', + name: 'string' + }, + name: 'name', + description: ' description' + }); + }); + + it('description and param separated by blank line', function () { + var res = doctrine.parse( + [ + "/**", + " * Description", + " * blah blah blah", + " *", + " * @param {string} name description", + "*/" + ].join('\n'), { unwrap: true }); + res.description.should.eql('Description\nblah blah blah'); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('name', 'name'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'string' + }); + res.tags[0].should.have.property('description', 'description'); + }); + + it('regular block comment instead of jsdoc-style block comment', function () { + var res = doctrine.parse( + [ + "/*", + " * Description", + " * blah blah blah", + "*/" + ].join('\n'), { unwrap: true }); + res.description.should.eql("Description\nblah blah blah"); + }); + + it('augments', function () { + var res = doctrine.parse('/** @augments */', { unwrap: true }); + res.tags.should.have.length(1); + }); + + it('augments with name', function () { + var res = doctrine.parse('/** @augments ClassName */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'augments'); + res.tags[0].should.have.property('name', 'ClassName'); + }); + + it('augments with type', function () { + var res = doctrine.parse('/** @augments {ClassName} */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'augments'); + res.tags[0].should.have.property('type', { + type: 'NameExpression', + name: 'ClassName' + }); + }); + + it('augments with name', function () { + var res = doctrine.parse('/** @augments ClassName.OK */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'augments'); + res.tags[0].should.have.property('name', 'ClassName.OK'); + }); + + it('extends', function () { + var res = doctrine.parse('/** @extends */', { unwrap: true }); + res.tags.should.have.length(1); + }); + + it('extends with name', function () { + var res = doctrine.parse('/** @extends ClassName */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'extends'); + res.tags[0].should.have.property('name', 'ClassName'); + }); + + it('extends with type', function () { + var res = doctrine.parse('/** @extends {ClassName} */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'extends'); + res.tags[0].should.have.property('type', { + type: 'NameExpression', + name: 'ClassName' + }); + }); + + it('extends with namepath', function () { + var res = doctrine.parse('/** @extends ClassName.OK */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'extends'); + res.tags[0].should.have.property('name', 'ClassName.OK'); + }); + + it('prop', function () { + var res = doctrine.parse( + [ + "/**", + " * @prop {string} thingName - does some stuff", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'prop'); + res.tags[0].should.have.property('description', 'does some stuff'); + res.tags[0].type.should.have.property('name', 'string'); + res.tags[0].should.have.property('name', 'thingName'); + }); + + it('prop without type', function () { + var res = doctrine.parse( + [ + "/**", + " * @prop thingName - does some stuff", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(0); + }); + + + it('property', function () { + var res = doctrine.parse( + [ + "/**", + " * @property {string} thingName - does some stuff", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'property'); + res.tags[0].should.have.property('description', 'does some stuff'); + res.tags[0].type.should.have.property('name', 'string'); + res.tags[0].should.have.property('name', 'thingName'); + }); + + it('property without type', function () { + var res = doctrine.parse( + [ + "/**", + " * @property thingName - does some stuff", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(0); + }); + + it('property with nested name', function () { + var res = doctrine.parse( + [ + "/**", + " * @property {string} thingName.name - does some stuff", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'property'); + res.tags[0].should.have.property('description', 'does some stuff'); + res.tags[0].type.should.have.property('name', 'string'); + res.tags[0].should.have.property('name', 'thingName.name'); + }); + + it('throws', function () { + var res = doctrine.parse( + [ + "/**", + " * @throws {Error} if something goes wrong", + " */" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'throws'); + res.tags[0].should.have.property('description', 'if something goes wrong'); + res.tags[0].type.should.have.property('name', 'Error'); + }); + + it('throws without type', function () { + var res = doctrine.parse( + [ + "/**", + " * @throws if something goes wrong", + " */" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'throws'); + res.tags[0].should.have.property('description', 'if something goes wrong'); + }); + + it('kind', function () { + var res = doctrine.parse('/** @kind class */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'kind'); + res.tags[0].should.have.property('kind', 'class'); + }); + + it('kind error', function () { + var res = doctrine.parse('/** @kind ng */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('errors'); + res.tags[0].errors.should.have.length(1); + res.tags[0].errors[0].should.equal('Invalid kind name \'ng\''); + }); + + it('todo', function () { + var res = doctrine.parse('/** @todo Write the documentation */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'todo'); + res.tags[0].should.have.property('description', 'Write the documentation'); + }); + + it('summary', function () { + // japanese lang + var res = doctrine.parse('/** @summary ゆるゆり3期おめでとー */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'summary'); + res.tags[0].should.have.property('description', 'ゆるゆり3期おめでとー'); + }); + + it('variation', function () { + // japanese lang + var res = doctrine.parse('/** @variation 42 */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'variation'); + res.tags[0].should.have.property('variation', 42); + }); + + it('variation error', function () { + // japanese lang + var res = doctrine.parse('/** @variation Animation */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('errors'); + res.tags[0].errors.should.have.length(1); + res.tags[0].errors[0].should.equal('Invalid variation \'Animation\''); + }); + + it('access', function () { + var res = doctrine.parse('/** @access public */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'access'); + res.tags[0].should.have.property('access', 'public'); + }); + + it('access error', function () { + var res = doctrine.parse('/** @access ng */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('errors'); + res.tags[0].errors.should.have.length(1); + res.tags[0].errors[0].should.equal('Invalid access name \'ng\''); + }); + + it('public', function () { + var res = doctrine.parse('/** @public */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'public'); + }); + + it('public type and description', function () { + var res = doctrine.parse('/** @public {number} ok */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'public'); + res.tags[0].should.have.property('description', 'ok'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'number' + }); + }); + + it('protected', function () { + var res = doctrine.parse('/** @protected */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'protected'); + }); + + it('protected type and description', function () { + var res = doctrine.parse('/** @protected {number} ok */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'protected'); + res.tags[0].should.have.property('description', 'ok'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'number' + }); + }); + + it('private', function () { + var res = doctrine.parse('/** @private */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'private'); + }); + + it('private type and description', function () { + var res = doctrine.parse('/** @private {number} ok */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'private'); + res.tags[0].should.have.property('description', 'ok'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'number' + }); + }); + + it('readonly', function () { + var res = doctrine.parse('/** @readonly */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'readonly'); + }); + + it('readonly error', function () { + var res = doctrine.parse('/** @readonly ng */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('errors'); + res.tags[0].errors.should.have.length(1); + res.tags[0].errors[0].should.equal('Unknown content \'ng\''); + }); + + it('requires', function () { + var res = doctrine.parse('/** @requires */', { unwrap: true }); + res.tags.should.have.length(0); + }); + + it('requires with module name', function () { + var res = doctrine.parse('/** @requires name.path */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'requires'); + res.tags[0].should.have.property('name', 'name.path'); + }); + + it('global', function () { + var res = doctrine.parse('/** @global */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'global'); + }); + + it('global error', function () { + var res = doctrine.parse('/** @global ng */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('errors'); + res.tags[0].errors.should.have.length(1); + res.tags[0].errors[0].should.equal('Unknown content \'ng\''); + }); + + it('inner', function () { + var res = doctrine.parse('/** @inner */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'inner'); + }); + + it('inner error', function () { + var res = doctrine.parse('/** @inner ng */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('errors'); + res.tags[0].errors.should.have.length(1); + res.tags[0].errors[0].should.equal('Unknown content \'ng\''); + }); + + it('instance', function () { + var res = doctrine.parse('/** @instance */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'instance'); + }); + + it('instance error', function () { + var res = doctrine.parse('/** @instance ng */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('errors'); + res.tags[0].errors.should.have.length(1); + res.tags[0].errors[0].should.equal('Unknown content \'ng\''); + }); + + it('since', function () { + var res = doctrine.parse('/** @since 1.2.1 */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'since'); + res.tags[0].should.have.property('description', '1.2.1'); + }); + + it('static', function () { + var res = doctrine.parse('/** @static */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'static'); + }); + + it('static error', function () { + var res = doctrine.parse('/** @static ng */', { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('errors'); + res.tags[0].errors.should.have.length(1); + res.tags[0].errors[0].should.equal('Unknown content \'ng\''); + }); + + it('this', function () { + var res = doctrine.parse( + [ + "/**", + " * @this thingName", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'this'); + res.tags[0].should.have.property('name', 'thingName'); + }); + + it('this with namepath', function () { + var res = doctrine.parse( + [ + "/**", + " * @this thingName.name", + "*/" + ].join('\n'), { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'this'); + res.tags[0].should.have.property('name', 'thingName.name'); + }); + + it('this error', function () { + var res = doctrine.parse( + [ + "/**", + " * @this", + "*/" + ].join('\n'), { unwrap: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'this'); + res.tags[0].should.have.property('errors'); + res.tags[0].errors.should.have.length(1); + res.tags[0].errors[0].should.equal('Missing or invalid tag name'); + }); + + it('var', function () { + var res = doctrine.parse('/** @var */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'var'); + }); + + it('var with name', function () { + var res = doctrine.parse('/** @var thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'var'); + res.tags[0].should.have.property('name', 'thingName.name'); + }); + + it('var with type', function () { + var res = doctrine.parse('/** @var {Object} thingName.name */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'var'); + res.tags[0].should.have.property('name', 'thingName.name'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + type: 'NameExpression', + name: 'Object' + }); + }); + + it('version', function () { + var res = doctrine.parse('/** @version 1.2.1 */', { unwrap: true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'version'); + res.tags[0].should.have.property('description', '1.2.1'); + }); + + it('incorrect name', function () { + var res = doctrine.parse('/** @name thingName#%name */', { unwrap: true }); + // name does not accept type + res.tags.should.have.length(0); + res.should.eql({ + "description": "", + "tags": [ + ] + }); + }); +}); + +describe('parseType', function () { + it('union type closure-compiler extended', function () { + var type = doctrine.parseType("string|number"); + type.should.eql({ + type: 'UnionType', + elements: [{ + type: 'NameExpression', + name: 'string' + }, { + type: 'NameExpression', + name: 'number' + }] + }); + }); + + it('empty union type', function () { + var type = doctrine.parseType("()"); + type.should.eql({ + type: 'UnionType', + elements: [] + }); + }); + + it('comma last array type', function () { + var type = doctrine.parseType("[string,]"); + type.should.eql({ + type: 'ArrayType', + elements: [{ + type: 'NameExpression', + name: 'string' + }] + }); + }); + + it('array type of all literal', function () { + var type = doctrine.parseType("[*]"); + type.should.eql({ + type: 'ArrayType', + elements: [{ + type: 'AllLiteral' + }] + }); + }); + + it('array type of nullable literal', function () { + var type = doctrine.parseType("[?]"); + type.should.eql({ + type: 'ArrayType', + elements: [{ + type: 'NullableLiteral' + }] + }); + }); + + it('comma last record type', function () { + var type = doctrine.parseType("{,}"); + type.should.eql({ + type: 'RecordType', + fields: [] + }); + }); + + it('type application', function () { + var type = doctrine.parseType("Array."); + type.should.eql({ + type: 'TypeApplication', + expression: { + type: 'NameExpression', + name: 'Array' + }, + applications: [{ + type: 'NameExpression', + name: 'String' + }] + }); + }); + + it('type application with NullableLiteral', function () { + var type = doctrine.parseType("Array"); + type.should.eql({ + type: 'TypeApplication', + expression: { + type: 'NameExpression', + name: 'Array' + }, + applications: [{ + type: 'NullableLiteral' + }] + }); + }); + + it('type application with multiple patterns', function () { + var type = doctrine.parseType("Array."); + type.should.eql({ + type: 'TypeApplication', + expression: { + type: 'NameExpression', + name: 'Array' + }, + applications: [{ + type: 'NameExpression', + name: 'String' + }, { + type: 'NameExpression', + name: 'Number' + }] + }); + }); + + it('type application without dot', function () { + var type = doctrine.parseType("Array"); + type.should.eql({ + type: 'TypeApplication', + expression: { + type: 'NameExpression', + name: 'Array' + }, + applications: [{ + type: 'NameExpression', + name: 'String' + }] + }); + }); + + it('array-style type application', function () { + var type = doctrine.parseType("String[]"); + type.should.eql({ + type: 'TypeApplication', + expression: { + type: 'NameExpression', + name: 'Array' + }, + applications: [{ + type: 'NameExpression', + name: 'String' + }] + }); + }); + + it('function type simple', function () { + var type = doctrine.parseType("function()"); + type.should.eql({ + "type": "FunctionType", + "params": [], + "result": null + }); + }); + + it('function type with name', function () { + var type = doctrine.parseType("function(a)"); + type.should.eql({ + "type": "FunctionType", + "params": [ + { + "type": "NameExpression", + "name": "a" + } + ], + "result": null + }); + }); + it('function type with name and type', function () { + var type = doctrine.parseType("function(a:b)"); + type.should.eql({ + "type": "FunctionType", + "params": [ + { + "type": "ParameterType", + "name": "a", + "expression": { + "type": "NameExpression", + "name": "b" + } + } + ], + "result": null + }); + }); + it('function type with optional param', function () { + var type = doctrine.parseType("function(a=)"); + type.should.eql({ + "type": "FunctionType", + "params": [ + { + "type": "OptionalType", + "expression": { + "type": "NameExpression", + "name": "a" + } + } + ], + "result": null + }); + }); + it('function type with optional param name and type', function () { + var type = doctrine.parseType("function(a:b=)"); + type.should.eql({ + "type": "FunctionType", + "params": [ + { + "type": "OptionalType", + "expression": { + "type": "ParameterType", + "name": "a", + "expression": { + "type": "NameExpression", + "name": "b" + } + } + } + ], + "result": null + }); + }); + it('function type with rest param', function () { + var type = doctrine.parseType("function(...a)"); + type.should.eql({ + "type": "FunctionType", + "params": [ + { + "type": "RestType", + "expression": { + "type": "NameExpression", + "name": "a" + } + } + ], + "result": null + }); + }); + it('function type with rest param name and type', function () { + var type = doctrine.parseType("function(...a:b)"); + type.should.eql({ + "type": "FunctionType", + "params": [ + { + "type": "RestType", + "expression": { + "type": "ParameterType", + "name": "a", + "expression": { + "type": "NameExpression", + "name": "b" + } + } + } + ], + "result": null + }); + }); + + it('function type with optional rest param', function () { + var type = doctrine.parseType("function(...a=)"); + type.should.eql({ + "type": "FunctionType", + "params": [ + { + "type": "RestType", + "expression": { + "type": "OptionalType", + "expression": { + "type": "NameExpression", + "name": "a" + } + } + } + ], + "result": null + }); + }); + it('function type with optional rest param name and type', function () { + var type = doctrine.parseType("function(...a:b=)"); + type.should.eql({ + "type": "FunctionType", + "params": [ + { + "type": "RestType", + "expression": { + "type": "OptionalType", + "expression": { + "type": "ParameterType", + "name": "a", + "expression": { + "type": "NameExpression", + "name": "b" + } + } + } + }], + "result": null + }); + }); + + it('string value in type', function () { + var type; + + type = doctrine.parseType("{'ok':String}"); + type.should.eql({ + "fields": [ + { + "key": "ok", + "type": "FieldType", + "value": { + "name": "String", + "type": "NameExpression" + } + } + ], + "type": "RecordType" + }); + + type = doctrine.parseType('{"\\r\\n\\t\\u2028\\x20\\u20\\b\\f\\v\\\r\n\\\n\\0\\07\\012\\o":String}'); + type.should.eql({ + "fields": [ + { + "key": "\r\n\t\u2028\x20u20\b\f\v\0\u0007\u000ao", + "type": "FieldType", + "value": { + "name": "String", + "type": "NameExpression" + } + } + ], + "type": "RecordType" + }); + + doctrine.parseType.bind(doctrine, "{'ok\":String}").should.throw('unexpected quote'); + doctrine.parseType.bind(doctrine, "{'o\n':String}").should.throw('unexpected quote'); + }); + + it('number value in type', function () { + var type; + + type = doctrine.parseType("{20:String}"); + type.should.eql({ + "fields": [ + { + "key": "20", + "type": "FieldType", + "value": { + "name": "String", + "type": "NameExpression" + } + } + ], + "type": "RecordType" + }); + + type = doctrine.parseType("{.2:String, 30:Number, 0x20:String}"); + type.should.eql({ + "fields": [ + { + "key": "0.2", + "type": "FieldType", + "value": { + "name": "String", + "type": "NameExpression" + } + }, + { + "key": "30", + "type": "FieldType", + "value": { + "name": "Number", + "type": "NameExpression" + } + }, + { + "key": "32", + "type": "FieldType", + "value": { + "name": "String", + "type": "NameExpression" + } + } + ], + "type": "RecordType" + }); + + + type = doctrine.parseType("{0X2:String, 0:Number, 100e200:String, 10e-20:Number}"); + type.should.eql({ + "fields": [ + { + "key": "2", + "type": "FieldType", + "value": { + "name": "String", + "type": "NameExpression" + } + }, + { + "key": "0", + "type": "FieldType", + "value": { + "name": "Number", + "type": "NameExpression" + } + }, + { + "key": "1e+202", + "type": "FieldType", + "value": { + "name": "String", + "type": "NameExpression" + } + }, + { + "key": "1e-19", + "type": "FieldType", + "value": { + "name": "Number", + "type": "NameExpression" + } + } + ], + "type": "RecordType" + }); + + + doctrine.parseType.bind(doctrine, "{0x:String}").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{0x").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{0xd").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{0x2_:").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{021:").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{021_:").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{021").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{08").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{0y").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{0").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{100e2").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{100e-2").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{100e-200:").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "{100e:").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "function(number=, string)").should.throw('not reach to EOF'); + }); + + it('dotted type', function () { + var type; + type = doctrine.parseType("Cocoa.Cappuccino"); + type.should.eql({ + "name": "Cocoa.Cappuccino", + "type": "NameExpression" + }); + }); + + it('rest array type', function () { + var type; + type = doctrine.parseType("[string,...string]"); + type.should.eql({ + "elements": [ + { + "name": "string", + "type": "NameExpression" + }, + { + "expression": { + "name": "string", + "type": "NameExpression" + }, + "type": "RestType" + } + ], + "type": "ArrayType" + }); + }); + + it ('nullable type', function () { + var type; + type = doctrine.parseType("string?"); + type.should.eql({ + "expression": { + "name": "string", + "type": "NameExpression" + }, + "prefix": false, + "type": "NullableType" + }); + }); + + it ('non-nullable type', function () { + var type; + type = doctrine.parseType("string!"); + type.should.eql({ + "expression": { + "name": "string", + "type": "NameExpression" + }, + "prefix": false, + "type": "NonNullableType" + }); + }); + + it ('toplevel multiple pipe type', function () { + var type; + type = doctrine.parseType("string|number|Test"); + type.should.eql({ + "elements": [ + { + "name": "string", + "type": "NameExpression" + }, + { + "name": "number", + "type": "NameExpression" + }, + { + "name": "Test", + "type": "NameExpression" + } + ], + "type": "UnionType" + }); + }); + + it('illegal tokens', function () { + doctrine.parseType.bind(doctrine, ".").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, ".d").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "(").should.throw('unexpected token'); + doctrine.parseType.bind(doctrine, "Test.").should.throw('unexpected token'); + }); +}); + +describe('parseParamType', function () { + it('question', function () { + var type = doctrine.parseParamType("?"); + type.should.eql({ + type: 'NullableLiteral' + }); + }); + + it('question option', function () { + var type = doctrine.parseParamType("?="); + type.should.eql({ + type: 'OptionalType', + expression: { + type: 'NullableLiteral' + } + }); + }); + + it('function option parameters former', function () { + var type = doctrine.parseParamType("function(?, number)"); + type.should.eql({ + type: 'FunctionType', + params: [{ + type: 'NullableLiteral' + }, { + type: 'NameExpression', + name: 'number' + }], + result: null + }); + }); + + it('function option parameters latter', function () { + var type = doctrine.parseParamType("function(number, ?)"); + type.should.eql({ + type: 'FunctionType', + params: [{ + type: 'NameExpression', + name: 'number' + }, { + type: 'NullableLiteral' + }], + result: null + }); + }); + + it('function type union', function () { + var type = doctrine.parseParamType("function(): ?|number"); + type.should.eql({ + type: 'UnionType', + elements: [{ + type: 'FunctionType', + params: [], + result: { + type: 'NullableLiteral' + } + }, { + type: 'NameExpression', + name: 'number' + }] + }); + }); +}); + +describe('invalid', function () { + it('empty union pipe', function () { + doctrine.parseType.bind(doctrine, "(|)").should.throw(); + doctrine.parseType.bind(doctrine, "(string|)").should.throw(); + doctrine.parseType.bind(doctrine, "(string||)").should.throw(); + }); + + it('comma only array type', function () { + doctrine.parseType.bind(doctrine, "[,]").should.throw(); + }); + + it('comma only record type', function () { + doctrine.parseType.bind(doctrine, "{,,}").should.throw(); + }); + + it('incorrect bracket', function () { + doctrine.parseParamType.bind(doctrine, "int[").should.throw(); + }); +}); + +describe('tags option', function() { + it ('only param', function() { + var res = doctrine.parse( + [ + "/**", + " * @const @const", + " * @param {String} y", + " */" + ].join('\n'), { tags: ['param'], unwrap:true }); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('name', 'y'); + }); + + it ('param and type', function() { + var res = doctrine.parse( + [ + "/**", + " * @const x", + " * @param {String} y", + " * @type {String} ", + " */" + ].join('\n'), { tags: ['param', 'type'], unwrap:true }); + res.tags.should.have.length(2); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('name', 'y'); + res.tags[1].should.have.property('title', 'type'); + res.tags[1].should.have.property('type'); + res.tags[1].type.should.have.property('name', 'String'); + }); + +}); + +describe('invalid tags', function() { + it ('bad tag 1', function() { + doctrine.parse.bind(doctrine, + [ + "/**", + " * @param {String} hucairz", + " */" + ].join('\n'), { tags: 1, unwrap:true }).should.throw(); + }); + + it ('bad tag 2', function() { + doctrine.parse.bind(doctrine, + [ + "/**", + " * @param {String} hucairz", + " */" + ].join('\n'), { tags: ['a', 1], unwrap:true }).should.throw(); + }); +}); + +describe('optional params', function() { + + // should fail since sloppy option not set + it('failure 0', function() { + doctrine.parse( + ["/**", " * @param {String} [val]", " */"].join('\n'), { + unwrap: true + }).should.eql({ + "description": "", + "tags": [] + }); + }); + + it('failure 1', function() { + doctrine.parse( + ["/**", " * @param [val", " */"].join('\n'), { + unwrap: true, sloppy: true + }).should.eql({ + "description": "", + "tags": [] + }); + }); + + it('success 1', function() { + doctrine.parse( + ["/**", " * @param {String} [val]", " */"].join('\n'), { + unwrap: true, sloppy: true + }).should.eql({ + "description": "", + "tags": [{ + "title": "param", + "description": null, + "type": { + "type": "OptionalType", + "expression": { + "type": "NameExpression", + "name": "String" + } + }, + "name": "val" + }] + }); + }); + it('success 2', function() { + doctrine.parse( + ["/**", " * @param {String=} val", " */"].join('\n'), { + unwrap: true, sloppy: true + }).should.eql({ + "description": "", + "tags": [{ + "title": "param", + "description": null, + "type": { + "type": "OptionalType", + "expression": { + "type": "NameExpression", + "name": "String" + } + }, + "name": "val" + }] + }); + }); + + it('success 3', function() { + doctrine.parse( + ["/**", " * @param {String=} [val=abc] some description", " */"].join('\n'), + { unwrap: true, sloppy: true} + ).should.eql({ + "description": "", + "tags": [{ + "title": "param", + "description": "some description", + "type": { + "type": "OptionalType", + "expression": { + "type": "NameExpression", + "name": "String" + } + }, + "name": "val", + "default": "abc" + }] + }); + }); + + it('line numbers', function() { + var res = doctrine.parse( + [ + "/**", + " * @param {string} foo", + " * @returns {string}", + " *", + " * @example", + " * f('blah'); // => undefined", + " */" + ].join('\n'), + { unwrap: true, lineNumbers: true } + ); + + res.tags[0].should.have.property('lineNumber', 1); + res.tags[1].should.have.property('lineNumber', 2); + res.tags[2].should.have.property('lineNumber', 4); + }); + + it('should handle \\r\\n line endings correctly', function() { + var res = doctrine.parse( + [ + "/**", + " * @param {string} foo", + " * @returns {string}", + " *", + " * @example", + " * f('blah'); // => undefined", + " */" + ].join('\r\n'), + { unwrap: true, lineNumbers: true } + ); + + res.tags[0].should.have.property('lineNumber', 1); + res.tags[1].should.have.property('lineNumber', 2); + res.tags[2].should.have.property('lineNumber', 4); + }); +}); + +describe('recovery tests', function() { + it ('params 2', function () { + var res = doctrine.parse( + [ + "@param f", + "@param {string} f2" + ].join('\n'), { recoverable: true }); + + // ensure both parameters are OK + res.tags.should.have.length(2); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('type', null); + res.tags[0].should.have.property('name', 'f'); + + res.tags[1].should.have.property('title', 'param'); + res.tags[1].should.have.property('type'); + res.tags[1].type.should.have.property('name', 'string'); + res.tags[1].type.should.have.property('type', 'NameExpression'); + res.tags[1].should.have.property('name', 'f2'); + }); + + it ('params 2', function () { + var res = doctrine.parse( + [ + "@param string f", + "@param {string} f2" + ].join('\n'), { recoverable: true }); + + // ensure first parameter is OK even with invalid type name + res.tags.should.have.length(2); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('type', null); + res.tags[0].should.have.property('name', 'string'); + res.tags[0].should.have.property('description', 'f'); + + res.tags[1].should.have.property('title', 'param'); + res.tags[1].should.have.property('type'); + res.tags[1].type.should.have.property('name', 'string'); + res.tags[1].type.should.have.property('type', 'NameExpression'); + res.tags[1].should.have.property('name', 'f2'); + }); + + it ('return 1', function() { + var res = doctrine.parse( + [ + "@returns" + ].join('\n'), { recoverable: true }); + + // return tag should exist + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'returns'); + res.tags[0].should.have.property('type', null); + }); + it ('return 2', function() { + var res = doctrine.parse( + [ + "@returns", + "@param {string} f2" + ].join('\n'), { recoverable: true }); + + // return tag should exist as well as next tag + res.tags.should.have.length(2); + res.tags[0].should.have.property('title', 'returns'); + res.tags[0].should.have.property('type', null); + + res.tags[1].should.have.property('title', 'param'); + res.tags[1].should.have.property('type'); + res.tags[1].type.should.have.property('name', 'string'); + res.tags[1].type.should.have.property('type', 'NameExpression'); + res.tags[1].should.have.property('name', 'f2'); + }); + + it ('extra @ 1', function() { + var res = doctrine.parse( + [ + "@", + "@returns", + "@param {string} f2" + ].join('\n'), { recoverable: true }); + + // empty tag name shouldn't affect subsequent tags + res.tags.should.have.length(3); + res.tags[0].should.have.property('title', ''); + res.tags[0].should.not.have.property('type'); + + res.tags[1].should.have.property('title', 'returns'); + res.tags[1].should.have.property('type', null); + + res.tags[2].should.have.property('title', 'param'); + res.tags[2].should.have.property('type'); + res.tags[2].type.should.have.property('name', 'string'); + res.tags[2].type.should.have.property('type', 'NameExpression'); + res.tags[2].should.have.property('name', 'f2'); + }); + + it ('extra @ 2', function() { + var res = doctrine.parse( + [ + "@ invalid name", + "@param {string} f2" + ].join('\n'), { recoverable: true }); + + // empty tag name shouldn't affect subsequent tags + res.tags.should.have.length(2); + res.tags[0].should.have.property('title', ''); + res.tags[0].should.not.have.property('type'); + res.tags[0].should.not.have.property('name'); + res.tags[0].should.have.property('description', 'invalid name'); + + res.tags[1].should.have.property('title', 'param'); + res.tags[1].should.have.property('type'); + res.tags[1].type.should.have.property('name', 'string'); + res.tags[1].type.should.have.property('type', 'NameExpression'); + res.tags[1].should.have.property('name', 'f2'); + }); + + it ('invalid tag 1', function() { + var res = doctrine.parse( + [ + "@111 invalid name", + "@param {string} f2" + ].join('\n'), { recoverable: true }); + + // invalid tag name shouldn't affect subsequent tags + res.tags.should.have.length(2); + res.tags[0].should.have.property('title', '111'); + res.tags[0].should.not.have.property('type'); + res.tags[0].should.not.have.property('name'); + res.tags[0].should.have.property('description', 'invalid name'); + + res.tags[1].should.have.property('title', 'param'); + res.tags[1].should.have.property('type'); + res.tags[1].type.should.have.property('name', 'string'); + res.tags[1].type.should.have.property('type', 'NameExpression'); + res.tags[1].should.have.property('name', 'f2'); + }); + + it ('invalid tag 1', function() { + var res = doctrine.parse( + [ + "@111", + "@param {string} f2" + ].join('\n'), { recoverable: true }); + + // invalid tag name shouldn't affect subsequent tags + res.tags.should.have.length(2); + res.tags[0].should.have.property('title', '111'); + res.tags[0].should.not.have.property('type'); + res.tags[0].should.not.have.property('name'); + res.tags[0].should.have.property('description', null); + + res.tags[1].should.have.property('title', 'param'); + res.tags[1].should.have.property('type'); + res.tags[1].type.should.have.property('name', 'string'); + res.tags[1].type.should.have.property('type', 'NameExpression'); + res.tags[1].should.have.property('name', 'f2'); + }); + + it ('should not crash on bad type in @param without name', function() { + var res = doctrine.parse("@param {Function(DOMNode)}", { recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.eql({ + "description": null, + "errors": [ + "not reach to EOF", + "Missing or invalid tag name" + ], + "name": null, + "title": "param", + "type": null + }); + }); + + it ('should not crash on bad type in @param in sloppy mode', function() { + var res = doctrine.parse("@param {int[} [x]", { sloppy: true, recoverable: true }); + res.tags.should.have.length(1); + res.tags[0].should.eql({ + "description": null, + "errors": [ + "expected an array-style type declaration (int[])" + ], + "name": "x", + "title": "param", + "type": null + }); + }); +}); + +describe('exported Syntax', function() { + it ('members', function () { + doctrine.Syntax.should.eql({ + NullableLiteral: 'NullableLiteral', + AllLiteral: 'AllLiteral', + NullLiteral: 'NullLiteral', + UndefinedLiteral: 'UndefinedLiteral', + VoidLiteral: 'VoidLiteral', + UnionType: 'UnionType', + ArrayType: 'ArrayType', + RecordType: 'RecordType', + FieldType: 'FieldType', + FunctionType: 'FunctionType', + ParameterType: 'ParameterType', + RestType: 'RestType', + NonNullableType: 'NonNullableType', + OptionalType: 'OptionalType', + NullableType: 'NullableType', + NameExpression: 'NameExpression', + TypeApplication: 'TypeApplication' + }); + }); +}); + +describe('@ mark contained descriptions', function () { + it ('comment description #10', function () { + doctrine.parse( + [ + '/**', + ' * Prevents the default action. It is equivalent to', + ' * {@code e.preventDefault()}, but can be used as the callback argument of', + ' * {@link goog.events.listen} without declaring another function.', + ' * @param {!goog.events.Event} e An event.', + ' */' + ].join('\n'), + { unwrap: true, sloppy: true }).should.eql({ + 'description': 'Prevents the default action. It is equivalent to\n{@code e.preventDefault()}, but can be used as the callback argument of\n{@link goog.events.listen} without declaring another function.', + 'tags': [{ + 'title': 'param', + 'description': 'An event.', + 'type': { + 'type': 'NonNullableType', + 'expression': { + 'type': 'NameExpression', + 'name': 'goog.events.Event' + }, + 'prefix': true + }, + 'name': 'e' + }] + }); + }); + + it ('tag description', function () { + doctrine.parse( + [ + '/**', + ' * Prevents the default action. It is equivalent to', + ' * @param {!goog.events.Event} e An event.', + ' * {@code e.preventDefault()}, but can be used as the callback argument of', + ' * {@link goog.events.listen} without declaring another function.', + ' */' + ].join('\n'), + { unwrap: true, sloppy: true }).should.eql({ + 'description': 'Prevents the default action. It is equivalent to', + 'tags': [{ + 'title': 'param', + 'description': 'An event.\n{@code e.preventDefault()}, but can be used as the callback argument of\n{@link goog.events.listen} without declaring another function.', + 'type': { + 'type': 'NonNullableType', + 'expression': { + 'type': 'NameExpression', + 'name': 'goog.events.Event' + }, + 'prefix': true + }, + 'name': 'e' + }] + }); + }); +}); + +describe('function', function () { + it ('recognize "function" type', function () { + var res = doctrine.parse( + [ + "@param {function} foo description", + ].join('\n'), {}); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].should.have.property('type'); + res.tags[0].type.should.eql({ + "name": "function", + "type": "NameExpression" + }); + res.tags[0].should.have.property('name', 'foo'); + res.tags[0].should.have.property('description', 'description'); + }); +}); + +describe('tagged namepaths', function () { + it ('recognize module:', function () { + var res = doctrine.parse( + [ + "@alias module:Foo.bar" + ].join('\n'), {}); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'alias'); + res.tags[0].should.have.property('name', 'module:Foo.bar'); + res.tags[0].should.have.property('description', null); + }); + + it ('recognize external:', function () { + var res = doctrine.parse( + [ + "@param {external:Foo.bar} baz description" + ].join('\n'), {}); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'param'); + res.tags[0].type.should.eql({ + "name": "external:Foo.bar", + "type": "NameExpression" + }); + res.tags[0].should.have.property('name', 'baz'); + res.tags[0].should.have.property('description', 'description'); + }); + + it ('recognize event:', function () { + var res = doctrine.parse( + [ + "@function event:Foo.bar" + ].join('\n'), {}); + res.tags.should.have.length(1); + res.tags[0].should.have.property('title', 'function'); + res.tags[0].should.have.property('name', 'event:Foo.bar'); + res.tags[0].should.have.property('description', null); + }); + + it ('invalid bogus:', function () { + var res = doctrine.parse( + [ + "@method bogus:Foo.bar" + ].join('\n'), {}); + res.tags.should.have.length(0); + }); +}); + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/strict.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/strict.js new file mode 100644 index 00000000..f6008d52 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/strict.js @@ -0,0 +1,168 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*global require describe it*/ +/*jslint node:true */ +'use strict'; + +var fs = require('fs'), + path = require('path'), + root = path.join(path.dirname(fs.realpathSync(__filename)), '..'), + doctrine = require(root); +require('should'); + +describe('strict parse', function () { + // https://github.com/Constellation/doctrine/issues/21 + it('unbalanced braces', function () { + (function () { + doctrine.parse( + [ + "/**", + " * @param {const", + " */" + ].join('\n'), { unwrap: true, strict: true }); + }).should.throw('Braces are not balanced'); + + (function () { + doctrine.parse( + [ + "/**", + " * @param {const", + " */" + ].join('\n'), { unwrap: true }); + }).should.not.throw(); + + (function () { + doctrine.parse( + [ + "/**", + " * Description", + " * @param {string name Param description", + " * @param {int} foo Bar", + " */" + ].join('\n'), { unwrap: true, strict: true }); + }).should.throw('Braces are not balanced'); + + (function () { + doctrine.parse( + [ + "/**", + " * Description", + " * @param {string name Param description", + " * @param {int} foo Bar", + " */" + ].join('\n'), { unwrap: true }); + }).should.not.throw(); + + (function () { + doctrine.parse( + [ + "/**", + " * Description", + " * @returns {int", + " */" + ].join('\n'), { unwrap: true, strict: true }); + }).should.throw('Braces are not balanced'); + + (function () { + doctrine.parse( + [ + "/**", + " * Description", + " * @returns {int", + " */" + ].join('\n'), { unwrap: true }); + }).should.not.throw(); + }); + + // https://github.com/Constellation/doctrine/issues/21 + it('incorrect tag starting with @@', function () { + (function () { + doctrine.parse( + [ + "/**", + " * @@version", + " */" + ].join('\n'), { unwrap: true, strict: true }); + }).should.throw('Missing or invalid title'); + + (function () { + doctrine.parse( + [ + "/**", + " * @@version", + " */" + ].join('\n'), { unwrap: true }); + }).should.not.throw(); + + (function () { + doctrine.parse( + [ + "/**", + " * Description", + " * @@param {string} name Param description", + " */" + ].join('\n'), { unwrap: true, strict: true }); + }).should.throw('Missing or invalid title'); + + (function () { + doctrine.parse( + [ + "/**", + " * Description", + " * @@param {string} name Param description", + " */" + ].join('\n'), { unwrap: true }); + }).should.not.throw(); + + (function () { + doctrine.parse( + [ + "/**", + " * Description", + " * @kind ng", + " */" + ].join('\n'), { unwrap: true, strict: true }); + }).should.throw('Invalid kind name \'ng\''); + + (function () { + doctrine.parse( + [ + "/**", + " * Description", + " * @variation Animation", + " */" + ].join('\n'), { unwrap: true, strict: true }); + }).should.throw('Invalid variation \'Animation\''); + + (function () { + doctrine.parse( + [ + "/**", + " * Description", + " * @access ng", + " */" + ].join('\n'), { unwrap: true, strict: true }); + }).should.throw('Invalid access name \'ng\''); + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/stringify.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/stringify.js new file mode 100644 index 00000000..0f3a43ed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/stringify.js @@ -0,0 +1,413 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*global require describe it*/ +/*jslint node:true */ +'use strict'; + +var fs = require('fs'), + path = require('path'), + root = path.join(path.dirname(fs.realpathSync(__filename)), '..'), + doctrine = require(root), + assert = require('assert'); +require('should'); + +// tests for the stringify function. +// ensure that we can parse and then stringify and the results are identical +describe('stringify', function () { + + function testStringify(text) { + it (text, function() { + var result = doctrine.parse("@param {" + text + "} name"); + // console.log("Parse Tree: " + JSON.stringify(result, null, " ")); + var stringed = doctrine.type.stringify(result.tags[0].type, {compact:true}); + stringed.should.equal(text); + }); + } + + // simple + testStringify("String"); + testStringify("*"); + testStringify("null"); + testStringify("undefined"); + testStringify("void"); + //testStringify("?="); // Failing + + // rest + testStringify("...string"); + testStringify("...[string]"); + testStringify("...[[string]]"); + + // optional, nullable, nonnullable + testStringify("string="); + testStringify("?string"); + testStringify("!string"); + testStringify("!string="); + + // type applications + testStringify("Array."); + testStringify("Array."); + + // union types + testStringify("()"); + testStringify("(String|Number)"); + + // Arrays + testStringify("[String]"); + testStringify("[String,Number]"); + testStringify("[(String|Number)]"); + + // Record types + testStringify("{a}"); + testStringify("{a:String}"); + testStringify("{a:String,b}"); + testStringify("{a:String,b:object}"); + testStringify("{a:String,b:foo.bar.baz}"); + testStringify("{a:(String|Number),b,c:Array.}"); + testStringify("...{a:(String|Number),b,c:Array.}"); + testStringify("{a:(String|Number),b,c:Array.}="); + + // fn types + testStringify("function(a)"); + testStringify("function(a):String"); + testStringify("function(a:number):String"); + testStringify("function(a:number,b:Array.<(String|Number|Object)>):String"); + testStringify("function(a:number,callback:function(a:Array.<(String|Number|Object)>):boolean):String"); + testStringify("function(a:(string|number),this:string,new:true):function():number"); + testStringify("function(a:(string|number),this:string,new:true):function(a:function(val):result):number"); +}); + +describe('literals', function() { + it('NullableLiteral', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.NullableLiteral + }).should.equal('?'); + }); + + it('AllLiteral', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.AllLiteral + }).should.equal('*'); + }); + + it('NullLiteral', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.NullLiteral + }).should.equal('null'); + }); + + it('UndefinedLiteral', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.UndefinedLiteral + }).should.equal('undefined'); + }); +}); + +describe('Expression', function () { + it('NameExpression', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.NameExpression, + name: 'this.is.valid' + }).should.equal('this.is.valid'); + + doctrine.type.stringify({ + type: doctrine.Syntax.NameExpression, + name: 'String' + }).should.equal('String'); + }); + + it('ArrayType', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.ArrayType, + elements: [{ + type: doctrine.Syntax.NameExpression, + name: 'String' + }] + }).should.equal('[String]'); + + doctrine.type.stringify({ + type: doctrine.Syntax.ArrayType, + elements: [{ + type: doctrine.Syntax.NameExpression, + name: 'String' + }, { + type: doctrine.Syntax.NameExpression, + name: 'Number' + }] + }).should.equal('[String, Number]'); + + doctrine.type.stringify({ + type: doctrine.Syntax.ArrayType, + elements: [] + }).should.equal('[]'); + }); + + it('RecordType', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.RecordType, + fields: [{ + type: doctrine.Syntax.FieldType, + key: 'name', + value: null + }] + }).should.equal('{name}'); + + doctrine.type.stringify({ + type: doctrine.Syntax.RecordType, + fields: [{ + type: doctrine.Syntax.FieldType, + key: 'name', + value: { + type: doctrine.Syntax.NameExpression, + name: 'String' + } + }] + }).should.equal('{name: String}'); + + doctrine.type.stringify({ + type: doctrine.Syntax.RecordType, + fields: [{ + type: doctrine.Syntax.FieldType, + key: 'string', + value: { + type: doctrine.Syntax.NameExpression, + name: 'String' + } + }, { + type: doctrine.Syntax.FieldType, + key: 'number', + value: { + type: doctrine.Syntax.NameExpression, + name: 'Number' + } + }] + }).should.equal('{string: String, number: Number}'); + + doctrine.type.stringify({ + type: doctrine.Syntax.RecordType, + fields: [] + }).should.equal('{}'); + }); + + it('UnionType', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.UnionType, + elements: [{ + type: doctrine.Syntax.NameExpression, + name: 'String' + }] + }).should.equal('(String)'); + + doctrine.type.stringify({ + type: doctrine.Syntax.UnionType, + elements: [{ + type: doctrine.Syntax.NameExpression, + name: 'String' + }, { + type: doctrine.Syntax.NameExpression, + name: 'Number' + }] + }).should.equal('(String|Number)'); + + doctrine.type.stringify({ + type: doctrine.Syntax.UnionType, + elements: [{ + type: doctrine.Syntax.NameExpression, + name: 'String' + }, { + type: doctrine.Syntax.NameExpression, + name: 'Number' + }] + }, { topLevel: true }).should.equal('String|Number'); + }); + + it('RestType', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.RestType, + expression: { + type: doctrine.Syntax.NameExpression, + name: 'String' + } + }).should.equal('...String'); + }); + + it('NonNullableType', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.NonNullableType, + expression: { + type: doctrine.Syntax.NameExpression, + name: 'String' + }, + prefix: true + }).should.equal('!String'); + + doctrine.type.stringify({ + type: doctrine.Syntax.NonNullableType, + expression: { + type: doctrine.Syntax.NameExpression, + name: 'String' + }, + prefix: false + }).should.equal('String!'); + }); + + it('OptionalType', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.OptionalType, + expression: { + type: doctrine.Syntax.NameExpression, + name: 'String' + } + }).should.equal('String='); + }); + + it('NullableType', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.NullableType, + expression: { + type: doctrine.Syntax.NameExpression, + name: 'String' + }, + prefix: true + }).should.equal('?String'); + + doctrine.type.stringify({ + type: doctrine.Syntax.NullableType, + expression: { + type: doctrine.Syntax.NameExpression, + name: 'String' + }, + prefix: false + }).should.equal('String?'); + }); + + it('TypeApplication', function () { + doctrine.type.stringify({ + type: doctrine.Syntax.TypeApplication, + expression: { + type: doctrine.Syntax.NameExpression, + name: 'Array' + }, + applications: [ + { + type: doctrine.Syntax.NameExpression, + name: 'String' + } + ] + }).should.equal('Array.'); + + doctrine.type.stringify({ + type: doctrine.Syntax.TypeApplication, + expression: { + type: doctrine.Syntax.NameExpression, + name: 'Array' + }, + applications: [ + { + type: doctrine.Syntax.NameExpression, + name: 'String' + }, + { + type: doctrine.Syntax.AllLiteral + } + ] + }).should.equal('Array.'); + }); +}); + +describe('Complex identity', function () { + it('Functions', function () { + var data01 = 'function (): void'; + doctrine.type.stringify( + doctrine.type.parseType(data01) + ).should.equal(data01); + + var data02 = 'function (): String'; + doctrine.type.stringify( + doctrine.type.parseType(data02) + ).should.equal(data02); + + var data03 = 'function (test: string): String'; + doctrine.type.stringify( + doctrine.type.parseType(data03) + ).should.equal(data03); + + var data04 = 'function (this: Date, test: String): String'; + doctrine.type.stringify( + doctrine.type.parseType(data04) + ).should.equal(data04); + + var data05 = 'function (this: Date, a: String, b: Number): String'; + doctrine.type.stringify( + doctrine.type.parseType(data05) + ).should.equal(data05); + + var data06 = 'function (this: Date, a: Array., b: Number): String'; + doctrine.type.stringify( + doctrine.type.parseType(data06) + ).should.equal(data06); + + var data07 = 'function (new: Date, a: Array., b: Number): HashMap.'; + doctrine.type.stringify( + doctrine.type.parseType(data07) + ).should.equal(data07); + + var data08 = 'function (new: Date, a: Array., b: (Number|String|Date)): HashMap.'; + doctrine.type.stringify( + doctrine.type.parseType(data08) + ).should.equal(data08); + + var data09 = 'function (new: Date)'; + doctrine.type.stringify( + doctrine.type.parseType(data09) + ).should.equal(data09); + + var data10 = 'function (this: Date)'; + doctrine.type.stringify( + doctrine.type.parseType(data10) + ).should.equal(data10); + + var data11 = 'function (this: Date, ...list)'; + doctrine.type.stringify( + doctrine.type.parseType(data11) + ).should.equal(data11); + + var data11a = 'function (this: Date, test: String=)'; + doctrine.type.stringify( + doctrine.type.parseType(data11a) + ).should.equal(data11a); + + // raw ... are not supported +// var data12 = 'function (this: Date, ...)'; +// doctrine.type.stringify( +// doctrine.type.parseType(data12) +// ).should.equal(data12); + + var data12a = 'function (this: Date, ?=)'; + doctrine.type.stringify( + doctrine.type.parseType(data12a) + ).should.equal(data12a); + }); +}); + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/test.html b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/test.html new file mode 100644 index 00000000..3784c2e5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/test.html @@ -0,0 +1,31 @@ + + + + +Doctrine trying + + + + + +
+
+ +
+
+

Parse Tree

+

+	

Stringified

+

+
+
\ No newline at end of file
diff --git a/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/unwrap.js b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/unwrap.js
new file mode 100644
index 00000000..03d6f6df
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/doctrine/test/unwrap.js
@@ -0,0 +1,60 @@
+/*
+  Copyright (C) 2012 Yusuke Suzuki 
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
+  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/*jslint node:true */
+'use strict';
+
+var fs = require('fs'),
+    path = require('path'),
+    root = path.join(path.dirname(fs.realpathSync(__filename)), '..'),
+    doctrine = require(root);
+require('should');
+
+describe('unwrapComment', function () {
+  it('normal', function () {
+    doctrine.unwrapComment('/**\n * @const\n * @const\n */').should.equal('\n@const\n@const\n');
+  });
+
+  it('single', function () {
+    doctrine.unwrapComment('/**x*/').should.equal('x');
+  });
+
+  it('more stars', function () {
+    doctrine.unwrapComment('/***x*/').should.equal('x');
+    doctrine.unwrapComment('/****x*/').should.equal('*x');
+  });
+
+  it('2 lines', function () {
+    doctrine.unwrapComment('/**x\n * y\n*/').should.equal('x\ny\n');
+  });
+
+  it('2 lines with space', function () {
+    doctrine.unwrapComment('/**x\n *    y\n*/').should.equal('x\n   y\n');
+  });
+
+  it('3 lines with blank line', function () {
+    doctrine.unwrapComment('/**x\n *\n \* y\n*/').should.equal('x\n\ny\n');
+  });
+});
+/* vim: set sw=4 ts=4 et tw=80 : */
diff --git a/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/index.js b/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/index.js
new file mode 100644
index 00000000..ac6572ca
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/index.js
@@ -0,0 +1,11 @@
+'use strict';
+
+var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
+
+module.exports = function (str) {
+	if (typeof str !== 'string') {
+		throw new TypeError('Expected a string');
+	}
+
+	return str.replace(matchOperatorsRe,  '\\$&');
+};
diff --git a/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/license b/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/license
new file mode 100644
index 00000000..654d0bfe
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus  (sindresorhus.com)
+
+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/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/package.json b/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/package.json
new file mode 100644
index 00000000..749f5ded
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/package.json
@@ -0,0 +1,70 @@
+{
+  "name": "escape-string-regexp",
+  "version": "1.0.3",
+  "description": "Escape RegExp special characters",
+  "license": "MIT",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/sindresorhus/escape-string-regexp"
+  },
+  "author": {
+    "name": "Sindre Sorhus",
+    "email": "sindresorhus@gmail.com",
+    "url": "http://sindresorhus.com"
+  },
+  "maintainers": [
+    {
+      "name": "sindresorhus",
+      "email": "sindresorhus@gmail.com"
+    },
+    {
+      "name": "jbnicolai",
+      "email": "jappelman@xebia.com"
+    }
+  ],
+  "engines": {
+    "node": ">=0.8.0"
+  },
+  "scripts": {
+    "test": "mocha"
+  },
+  "files": [
+    "index.js"
+  ],
+  "keywords": [
+    "regex",
+    "regexp",
+    "re",
+    "regular",
+    "expression",
+    "escape",
+    "string",
+    "str",
+    "special",
+    "characters"
+  ],
+  "devDependencies": {
+    "mocha": "*"
+  },
+  "gitHead": "1e446e6b4449b5f1f8868cd31bf8fd25ee37fb4b",
+  "bugs": {
+    "url": "https://github.com/sindresorhus/escape-string-regexp/issues"
+  },
+  "homepage": "https://github.com/sindresorhus/escape-string-regexp",
+  "_id": "escape-string-regexp@1.0.3",
+  "_shasum": "9e2d8b25bc2555c3336723750e03f099c2735bb5",
+  "_from": "escape-string-regexp@>=1.0.2 <2.0.0",
+  "_npmVersion": "2.1.16",
+  "_nodeVersion": "0.10.35",
+  "_npmUser": {
+    "name": "jbnicolai",
+    "email": "jappelman@xebia.com"
+  },
+  "dist": {
+    "shasum": "9e2d8b25bc2555c3336723750e03f099c2735bb5",
+    "tarball": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/readme.md b/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/readme.md
new file mode 100644
index 00000000..808a963a
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/escape-string-regexp/readme.md
@@ -0,0 +1,27 @@
+# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp)
+
+> Escape RegExp special characters
+
+
+## Install
+
+```sh
+$ npm install --save escape-string-regexp
+```
+
+
+## Usage
+
+```js
+var escapeStringRegexp = require('escape-string-regexp');
+
+var escapedString = escapeStringRegexp('how much $ for a unicorn?');
+//=> how much \$ for a unicorn\?
+
+new RegExp(escapedString);
+```
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/.jshintrc b/node_modules/standard/node_modules/eslint/node_modules/escope/.jshintrc
new file mode 100644
index 00000000..defbf026
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/escope/.jshintrc
@@ -0,0 +1,20 @@
+{
+    "curly": true,
+    "eqeqeq": true,
+    "immed": true,
+    "indent": 4,
+    "eqnull": true,
+    "latedef": true,
+    "noarg": true,
+    "noempty": true,
+    "quotmark": "single",
+    "undef": true,
+    "unused": true,
+    "strict": true,
+    "trailing": true,
+    "validthis": true,
+
+    "onevar": true,
+
+    "node": true
+}
diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/LICENSE.BSD b/node_modules/standard/node_modules/eslint/node_modules/escope/LICENSE.BSD
new file mode 100644
index 00000000..3e580c35
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/escope/LICENSE.BSD
@@ -0,0 +1,19 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/README.md
new file mode 100644
index 00000000..eed34d52
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/escope/README.md
@@ -0,0 +1,49 @@
+Escope ([escope](http://github.com/estools/escope)) is
+[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
+scope analyzer extracted from [esmangle project](http://github.com/estools/esmangle).
+
+[![Build Status](https://travis-ci.org/estools/escope.png?branch=master)](https://travis-ci.org/estools/escope)
+
+### Document
+
+Generated JSDoc is [here](http://constellation.github.io/escope/).
+
+### Demos and Tools
+
+Demonstration is [here](http://mazurov.github.io/escope-demo/) by [Sasha Mazurov](https://github.com/mazurov) (twitter: [@mazurov](http://twitter.com/mazurov)). [issue](https://github.com/estools/escope/issues/14)
+
+![Demo](https://f.cloud.github.com/assets/75759/462920/7aa6dd40-b4f5-11e2-9f07-9f4e8d0415f9.gif)
+
+
+And there are tools constructed on Escope.
+
+- [Esmangle](https://github.com/estools/esmangle) is a minifier / mangler / optimizer.
+- [Eslevels](https://github.com/mazurov/eslevels) is a scope levels analyzer and [SublimeText plugin for scope context coloring](https://github.com/mazurov/sublime-levels) is constructed on it.
+- [Esgoggles](https://github.com/keeyipchan/esgoggles) is JavaScript code browser.
+
+
+### License
+
+Copyright (C) 2012-2013 [Yusuke Suzuki](http://github.com/Constellation)
+ (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/bower.json b/node_modules/standard/node_modules/eslint/node_modules/escope/bower.json
new file mode 100644
index 00000000..b19a0b9f
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/escope/bower.json
@@ -0,0 +1,13 @@
+{
+  "name": "escope",
+  "version": "2.0.1",
+  "main": "escope.js",
+  "dependencies": {
+    "estraverse": ">= 0.0.2"
+  },
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "components"
+  ]
+}
diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/escope.js b/node_modules/standard/node_modules/eslint/node_modules/escope/escope.js
new file mode 100644
index 00000000..b4d2b2fe
--- /dev/null
+++ b/node_modules/standard/node_modules/eslint/node_modules/escope/escope.js
@@ -0,0 +1,1450 @@
+/*
+  Copyright (C) 2012-2014 Yusuke Suzuki 
+  Copyright (C) 2013 Alex Seville 
+  Copyright (C) 2014 Thiago de Arruda 
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
+  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/**
+ * Escope (escope) is an ECMAScript
+ * scope analyzer extracted from the esmangle project.
+ * 

+ * escope finds lexical scopes in a source program, i.e. areas of that + * program where different occurrences of the same identifier refer to the same + * variable. With each scope the contained variables are collected, and each + * identifier reference in code is linked to its corresponding variable (if + * possible). + *

+ * escope works on a syntax tree of the parsed source code which has + * to adhere to the + * Mozilla Parser API. E.g. esprima is a parser + * that produces such syntax trees. + *

+ * The main interface is the {@link analyze} function. + * @module + */ + +/*jslint bitwise:true */ +(function () { + 'use strict'; + + var Syntax, + util, + extend, + estraverse, + esrecurse, + Map, + WeakMap; + + util = require('util'); + extend = require('util-extend'); + estraverse = require('estraverse'); + esrecurse = require('esrecurse'); + + Map = require('es6-map'); + WeakMap = require('es6-weak-map'); + + Syntax = estraverse.Syntax; + + function assert(cond, text) { + if (!cond) { + throw new Error(text); + } + } + + function defaultOptions() { + return { + optimistic: false, + directive: false, + nodejsScope: false, + sourceType: 'script', // one of ['script', 'module'] + ecmaVersion: 5 + }; + } + + function updateDeeply(target, override) { + var key, val; + + function isHashObject(target) { + return typeof target === 'object' && target instanceof Object && !(target instanceof RegExp); + } + + for (key in override) { + if (override.hasOwnProperty(key)) { + val = override[key]; + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } else { + target[key] = updateDeeply({}, val); + } + } else { + target[key] = val; + } + } + } + return target; + } + + /** + * A Reference represents a single occurrence of an identifier in code. + * @class Reference + */ + function Reference(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial) { + /** + * Identifier syntax node. + * @member {esprima#Identifier} Reference#identifier + */ + this.identifier = ident; + /** + * Reference to the enclosing Scope. + * @member {Scope} Reference#from + */ + this.from = scope; + /** + * Whether the reference comes from a dynamic scope (such as 'eval', + * 'with', etc.), and may be trapped by dynamic scopes. + * @member {boolean} Reference#tainted + */ + this.tainted = false; + /** + * The variable this reference is resolved with. + * @member {Variable} Reference#resolved + */ + this.resolved = null; + /** + * The read-write mode of the reference. (Value is one of {@link + * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). + * @member {number} Reference#flag + * @private + */ + this.flag = flag; + if (this.isWrite()) { + /** + * If reference is writeable, this is the tree being written to it. + * @member {esprima#Node} Reference#writeExpr + */ + this.writeExpr = writeExpr; + /** + * Whether the Reference might refer to a partial value of writeExpr. + * @member {boolean} Reference#partial + */ + this.partial = partial; + } + this.__maybeImplicitGlobal = maybeImplicitGlobal; + } + + /** + * @constant Reference.READ + * @private + */ + Reference.READ = 0x1; + /** + * @constant Reference.WRITE + * @private + */ + Reference.WRITE = 0x2; + /** + * @constant Reference.RW + * @private + */ + Reference.RW = Reference.READ | Reference.WRITE; + + /** + * Whether the reference is static. + * @method Reference#isStatic + * @return {boolean} + */ + Reference.prototype.isStatic = function isStatic() { + return !this.tainted && this.resolved && this.resolved.scope.isStatic(); + }; + + /** + * Whether the reference is writeable. + * @method Reference#isWrite + * @return {boolean} + */ + Reference.prototype.isWrite = function isWrite() { + return !!(this.flag & Reference.WRITE); + }; + + /** + * Whether the reference is readable. + * @method Reference#isRead + * @return {boolean} + */ + Reference.prototype.isRead = function isRead() { + return !!(this.flag & Reference.READ); + }; + + /** + * Whether the reference is read-only. + * @method Reference#isReadOnly + * @return {boolean} + */ + Reference.prototype.isReadOnly = function isReadOnly() { + return this.flag === Reference.READ; + }; + + /** + * Whether the reference is write-only. + * @method Reference#isWriteOnly + * @return {boolean} + */ + Reference.prototype.isWriteOnly = function isWriteOnly() { + return this.flag === Reference.WRITE; + }; + + /** + * Whether the reference is read-write. + * @method Reference#isReadWrite + * @return {boolean} + */ + Reference.prototype.isReadWrite = function isReadWrite() { + return this.flag === Reference.RW; + }; + + /** + * A Variable represents a locally scoped identifier. These include arguments to + * functions. + * @class Variable + */ + function Variable(name, scope) { + /** + * The variable name, as given in the source code. + * @member {String} Variable#name + */ + this.name = name; + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as AST nodes. + * @member {esprima.Identifier[]} Variable#identifiers + */ + this.identifiers = []; + /** + * List of {@link Reference|references} of this variable (excluding parameter entries) + * in its defining scope and all nested scopes. For defining + * occurrences only see {@link Variable#defs}. + * @member {Reference[]} Variable#references + */ + this.references = []; + + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as custom objects. + * @typedef {Object} DefEntry + * @property {String} DefEntry.type - the type of the occurrence (e.g. + * "Parameter", "Variable", ...) + * @property {esprima.Identifier} DefEntry.name - the identifier AST node of the occurrence + * @property {esprima.Node} DefEntry.node - the enclosing node of the + * identifier + * @property {esprima.Node} [DefEntry.parent] - the enclosing statement + * node of the identifier + * @member {DefEntry[]} Variable#defs + */ + this.defs = []; + + this.tainted = false; + /** + * Whether this is a stack variable. + * @member {boolean} Variable#stack + */ + this.stack = true; + /** + * Reference to the enclosing Scope. + * @member {Scope} Variable#scope + */ + this.scope = scope; + } + + Variable.CatchClause = 'CatchClause'; + Variable.Parameter = 'Parameter'; + Variable.FunctionName = 'FunctionName'; + Variable.ClassName = 'ClassName'; + Variable.Variable = 'Variable'; + Variable.ImportBinding = 'ImportBinding'; + Variable.TDZ = 'TDZ'; + Variable.ImplicitGlobalVariable = 'ImplicitGlobalVariable'; + + function isStrictScope(scope, block, isMethodDefinition, useDirective) { + var body, i, iz, stmt, expr; + + // When upper scope is exists and strict, inner scope is also strict. + if (scope.upper && scope.upper.isStrict) { + return true; + } + + // ArrowFunctionExpression's scope is always strict scope. + if (block.type === Syntax.ArrowFunctionExpression) { + return true; + } + + if (isMethodDefinition) { + return true; + } + + if (scope.type === 'class' || scope.type === 'module') { + return true; + } + + if (scope.type === 'block' || scope.type === 'switch') { + return false; + } + + if (scope.type === 'function') { + if (block.type === 'Program') { + body = block; + } else { + body = block.body; + } + } else if (scope.type === 'global') { + body = block; + } else { + return false; + } + + // Search 'use strict' directive. + if (useDirective) { + for (i = 0, iz = body.body.length; i < iz; ++i) { + stmt = body.body[i]; + if (stmt.type !== 'DirectiveStatement') { + break; + } + if (stmt.raw === '"use strict"' || stmt.raw === '\'use strict\'') { + return true; + } + } + } else { + for (i = 0, iz = body.body.length; i < iz; ++i) { + stmt = body.body[i]; + if (stmt.type !== Syntax.ExpressionStatement) { + break; + } + expr = stmt.expression; + if (expr.type !== Syntax.Literal || typeof expr.value !== 'string') { + break; + } + if (expr.raw != null) { + if (expr.raw === '"use strict"' || expr.raw === '\'use strict\'') { + return true; + } + } else { + if (expr.value === 'use strict') { + return true; + } + } + } + } + return false; + } + + function registerScope(scopeManager, scope) { + var scopes; + + scopeManager.scopes.push(scope); + + scopes = scopeManager.__nodeToScope.get(scope.block); + if (scopes) { + scopes.push(scope); + } else { + scopeManager.__nodeToScope.set(scope.block, [ scope ]); + } + } + + /* Special Scope types. */ + var SCOPE_NORMAL = 0, + SCOPE_MODULE = 1, + SCOPE_FUNCTION_EXPRESSION_NAME = 2, + SCOPE_TDZ = 3, + SCOPE_FUNCTION = 4; + + /** + * @class Scope + */ + function Scope(scopeManager, block, isMethodDefinition, scopeType) { + /** + * One of 'catch', 'with', 'function', 'global' or 'block'. + * @member {String} Scope#type + */ + this.type = + (scopeType === SCOPE_TDZ) ? 'TDZ' : + (scopeType === SCOPE_MODULE) ? 'module' : + (block.type === Syntax.BlockStatement) ? 'block' : + (block.type === Syntax.SwitchStatement) ? 'switch' : + (scopeType === SCOPE_FUNCTION || block.type === Syntax.FunctionExpression || block.type === Syntax.FunctionDeclaration || block.type === Syntax.ArrowFunctionExpression) ? 'function' : + (block.type === Syntax.CatchClause) ? 'catch' : + (block.type === Syntax.ForInStatement || block.type === Syntax.ForOfStatement || block.type === Syntax.ForStatement) ? 'for' : + (block.type === Syntax.WithStatement) ? 'with' : + (block.type === Syntax.ClassExpression || block.type === Syntax.ClassDeclaration) ? 'class' : 'global'; + /** + * The scoped {@link Variable}s of this scope, as { Variable.name + * : Variable }. + * @member {Map} Scope#set + */ + this.set = new Map(); + /** + * The tainted variables of this scope, as { Variable.name : + * boolean }. + * @member {Map} Scope#taints */ + this.taints = new Map(); + /** + * Generally, through the lexical scoping of JS you can always know + * which variable an identifier in the source code refers to. There are + * a few exceptions to this rule. With 'global' and 'with' scopes you + * can only decide at runtime which variable a reference refers to. + * Moreover, if 'eval()' is used in a scope, it might introduce new + * bindings in this or its prarent scopes. + * All those scopes are considered 'dynamic'. + * @member {boolean} Scope#dynamic + */ + this.dynamic = this.type === 'global' || this.type === 'with'; + /** + * A reference to the scope-defining syntax node. + * @member {esprima.Node} Scope#block + */ + this.block = block; + /** + * The {@link Reference|references} that are not resolved with this scope. + * @member {Reference[]} Scope#through + */ + this.through = []; + /** + * The scoped {@link Variable}s of this scope. In the case of a + * 'function' scope this includes the automatic argument arguments as + * its first element, as well as all further formal arguments. + * @member {Variable[]} Scope#variables + */ + this.variables = []; + /** + * Any variable {@link Reference|reference} found in this scope. This + * includes occurrences of local variables as well as variables from + * parent scopes (including the global scope). For local variables + * this also includes defining occurrences (like in a 'var' statement). + * In a 'function' scope this does not include the occurrences of the + * formal parameter in the parameter list. + * @member {Reference[]} Scope#references + */ + this.references = []; + + /** + * For 'global' and 'function' scopes, this is a self-reference. For + * other scope types this is the variableScope value of the + * parent scope. + * @member {Scope} Scope#variableScope + */ + this.variableScope = + (this.type === 'global' || this.type === 'function' || this.type === 'module') ? this : scopeManager.__currentScope.variableScope; + /** + * Whether this scope is created by a FunctionExpression. + * @member {boolean} Scope#functionExpressionScope + */ + this.functionExpressionScope = false; + /** + * Whether this is a scope that contains an 'eval()' invocation. + * @member {boolean} Scope#directCallToEvalScope + */ + this.directCallToEvalScope = false; + /** + * @member {boolean} Scope#thisFound + */ + this.thisFound = false; + + this.__left = []; + + if (scopeType === SCOPE_FUNCTION_EXPRESSION_NAME) { + this.__define(block.id, { + type: Variable.FunctionName, + name: block.id, + node: block + }); + this.functionExpressionScope = true; + } else { + // section 9.2.13, FunctionDeclarationInstantiation. + // NOTE Arrow functions never have an arguments objects. + if (this.type === 'function' && this.block.type !== Syntax.ArrowFunctionExpression) { + this.__defineArguments(); + } + + if (block.type === Syntax.FunctionExpression && block.id) { + scopeManager.__nestFunctionExpressionNameScope(block, isMethodDefinition); + } + } + + /** + * Reference to the parent {@link Scope|scope}. + * @member {Scope} Scope#upper + */ + this.upper = scopeManager.__currentScope; + /** + * Whether 'use strict' is in effect in this scope. + * @member {boolean} Scope#isStrict + */ + this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()); + + /** + * List of nested {@link Scope}s. + * @member {Scope[]} Scope#childScopes + */ + this.childScopes = []; + if (scopeManager.__currentScope) { + scopeManager.__currentScope.childScopes.push(this); + } + + + // RAII + scopeManager.__currentScope = this; + if (this.type === 'global') { + scopeManager.globalScope = this; + scopeManager.globalScope.implicit = { + set: new Map(), + variables: [], + /** + * List of {@link Reference}s that are left to be resolved (i.e. which + * need to be linked to the variable they refer to). + * @member {Reference[]} Scope#implicit#left + */ + left: [] + }; + } + + registerScope(scopeManager, this); + } + + Scope.prototype.__close = function __close(scopeManager) { + var i, iz, ref, current, implicit, info; + + // Because if this is global environment, upper is null + if (!this.dynamic || scopeManager.__isOptimistic()) { + // static resolve + for (i = 0, iz = this.__left.length; i < iz; ++i) { + ref = this.__left[i]; + if (!this.__resolve(ref)) { + this.__delegateToUpperScope(ref); + } + } + } else { + // this is "global" / "with" / "function with eval" environment + if (this.type === 'with') { + for (i = 0, iz = this.__left.length; i < iz; ++i) { + ref = this.__left[i]; + ref.tainted = true; + this.__delegateToUpperScope(ref); + } + } else { + for (i = 0, iz = this.__left.length; i < iz; ++i) { + // notify all names are through to global + ref = this.__left[i]; + current = this; + do { + current.through.push(ref); + current = current.upper; + } while (current); + } + } + } + + if (this.type === 'global') { + implicit = []; + for (i = 0, iz = this.__left.length; i < iz; ++i) { + ref = this.__left[i]; + if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { + implicit.push(ref.__maybeImplicitGlobal); + } + } + + // create an implicit global variable from assignment expression + for (i = 0, iz = implicit.length; i < iz; ++i) { + info = implicit[i]; + this.__defineImplicit(info.pattern, { + type: Variable.ImplicitGlobalVariable, + name: info.pattern, + node: info.node + }); + } + + this.implicit.left = this.__left; + } + + this.__left = null; + scopeManager.__currentScope = this.upper; + }; + + Scope.prototype.__resolve = function __resolve(ref) { + var variable, name; + name = ref.identifier.name; + if (this.set.has(name)) { + variable = this.set.get(name); + variable.references.push(ref); + variable.stack = variable.stack && ref.from.variableScope === this.variableScope; + if (ref.tainted) { + variable.tainted = true; + this.taints.set(variable.name, true); + } + ref.resolved = variable; + return true; + } + return false; + }; + + Scope.prototype.__delegateToUpperScope = function __delegateToUpperScope(ref) { + if (this.upper) { + this.upper.__left.push(ref); + } + this.through.push(ref); + }; + + Scope.prototype.__defineGeneric = function (name, set, variables, node, info) { + var variable; + + variable = set.get(name); + if (!variable) { + variable = new Variable(name, this); + set.set(name, variable); + variables.push(variable); + } + + if (info) { + variable.defs.push(info); + } + if (node) { + variable.identifiers.push(node); + } + }; + + Scope.prototype.__defineArguments = function () { + this.__defineGeneric('arguments', this.set, this.variables); + this.taints.set('arguments', true); + }; + + Scope.prototype.__defineImplicit = function (node, info) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric(node.name, this.implicit.set, this.implicit.variables, node, info); + } + }; + + Scope.prototype.__define = function (node, info) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric(node.name, this.set, this.variables, node, info); + } + }; + + Scope.prototype.__referencing = function __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial) { + var ref; + // because Array element may be null + if (node && node.type === Syntax.Identifier) { + ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial); + this.references.push(ref); + this.__left.push(ref); + } + }; + + Scope.prototype.__detectEval = function __detectEval() { + var current; + current = this; + this.directCallToEvalScope = true; + do { + current.dynamic = true; + current = current.upper; + } while (current); + }; + + Scope.prototype.__detectThis = function __detectThis() { + this.thisFound = true; + }; + + Scope.prototype.__isClosed = function isClosed() { + return this.__left === null; + }; + + // API Scope#resolve(name) + // returns resolved reference + Scope.prototype.resolve = function resolve(ident) { + var ref, i, iz; + assert(this.__isClosed(), 'scope should be closed'); + assert(ident.type === Syntax.Identifier, 'target should be identifier'); + for (i = 0, iz = this.references.length; i < iz; ++i) { + ref = this.references[i]; + if (ref.identifier === ident) { + return ref; + } + } + return null; + }; + + // API Scope#isStatic + // returns this scope is static + Scope.prototype.isStatic = function isStatic() { + return !this.dynamic; + }; + + // API Scope#isArgumentsMaterialized + // return this scope has materialized arguments + Scope.prototype.isArgumentsMaterialized = function isArgumentsMaterialized() { + // TODO(Constellation) + // We can more aggressive on this condition like this. + // + // function t() { + // // arguments of t is always hidden. + // function arguments() { + // } + // } + var variable; + + // This is not function scope + if (this.type !== 'function') { + return true; + } + + if (!this.isStatic()) { + return true; + } + + variable = this.set.get('arguments'); + assert(variable, 'always have arguments variable'); + return variable.tainted || variable.references.length !== 0; + }; + + // API Scope#isThisMaterialized + // return this scope has materialized `this` reference + Scope.prototype.isThisMaterialized = function isThisMaterialized() { + // This is not function scope + if (this.type !== 'function') { + return true; + } + if (!this.isStatic()) { + return true; + } + return this.thisFound; + }; + + Scope.prototype.isUsedName = function (name) { + if (this.set.has(name)) { + return true; + } + for (var i = 0, iz = this.through.length; i < iz; ++i) { + if (this.through[i].identifier.name === name) { + return true; + } + } + return false; + }; + + /** + * @class ScopeManager + */ + function ScopeManager(options) { + this.scopes = []; + this.globalScope = null; + this.__nodeToScope = new WeakMap(); + this.__currentScope = null; + this.__options = options; + } + + ScopeManager.prototype.__useDirective = function () { + return this.__options.directive; + }; + + ScopeManager.prototype.__isOptimistic = function () { + return this.__options.optimistic; + }; + + ScopeManager.prototype.__ignoreEval = function () { + return this.__options.ignoreEval; + }; + + ScopeManager.prototype.__isNodejsScope = function () { + return this.__options.nodejsScope; + }; + + ScopeManager.prototype.isModule = function () { + return this.__options.sourceType === 'module'; + }; + + // Returns appropliate scope for this node. + ScopeManager.prototype.__get = function __get(node) { + return this.__nodeToScope.get(node); + }; + + ScopeManager.prototype.acquire = function acquire(node, inner) { + var scopes, scope, i, iz; + + function predicate(scope) { + if (scope.type === 'function' && scope.functionExpressionScope) { + return false; + } + if (scope.type === 'TDZ') { + return false; + } + return true; + } + + scopes = this.__get(node); + if (!scopes || scopes.length === 0) { + return null; + } + + // Heuristic selection from all scopes. + // If you would like to get all scopes, please use ScopeManager#acquireAll. + if (scopes.length === 1) { + return scopes[0]; + } + + if (inner) { + for (i = scopes.length - 1; i >= 0; --i) { + scope = scopes[i]; + if (predicate(scope)) { + return scope; + } + } + } else { + for (i = 0, iz = scopes.length; i < iz; ++i) { + scope = scopes[i]; + if (predicate(scope)) { + return scope; + } + } + } + + return null; + }; + + ScopeManager.prototype.acquireAll = function acquire(node) { + return this.__get(node); + }; + + ScopeManager.prototype.release = function release(node, inner) { + var scopes, scope; + scopes = this.__get(node); + if (scopes && scopes.length) { + scope = scopes[0].upper; + if (!scope) { + return null; + } + return this.acquire(scope.block, inner); + } + return null; + }; + + ScopeManager.prototype.attach = function attach() { }; + + ScopeManager.prototype.detach = function detach() { }; + + ScopeManager.prototype.__nestScope = function (node, isMethodDefinition) { + return new Scope(this, node, isMethodDefinition, SCOPE_NORMAL); + }; + + ScopeManager.prototype.__nestForceFunctionScope = function (node) { + return new Scope(this, node, false, SCOPE_FUNCTION); + }; + + ScopeManager.prototype.__nestModuleScope = function (node) { + return new Scope(this, node, false, SCOPE_MODULE); + }; + + ScopeManager.prototype.__nestTDZScope = function (node) { + return new Scope(this, node, false, SCOPE_TDZ); + }; + + ScopeManager.prototype.__nestFunctionExpressionNameScope = function (node, isMethodDefinition) { + return new Scope(this, node, isMethodDefinition, SCOPE_FUNCTION_EXPRESSION_NAME); + }; + + ScopeManager.prototype.__isES6 = function () { + return this.__options.ecmaVersion >= 6; + }; + + function traverseIdentifierInPattern(rootPattern, callback) { + estraverse.traverse(rootPattern, { + enter: function (pattern, parent) { + var i, iz, element, property; + + switch (pattern.type) { + case Syntax.Identifier: + // Toplevel identifier. + if (parent === null) { + callback(pattern, true); + } + break; + + case Syntax.SpreadElement: + if (pattern.argument.type === Syntax.Identifier) { + callback(pattern.argument, false); + } + break; + + case Syntax.ObjectPattern: + for (i = 0, iz = pattern.properties.length; i < iz; ++i) { + property = pattern.properties[i]; + if (property.shorthand) { + callback(property.key, false); + continue; + } + if (property.value.type === Syntax.Identifier) { + callback(property.value, false); + continue; + } + } + break; + + case Syntax.ArrayPattern: + for (i = 0, iz = pattern.elements.length; i < iz; ++i) { + element = pattern.elements[i]; + if (element && element.type === Syntax.Identifier) { + callback(element, false); + } + } + break; + } + } + }); + } + + function isPattern(node) { + var nodeType = node.type; + return nodeType === Syntax.Identifier || nodeType === Syntax.ObjectPattern || nodeType === Syntax.ArrayPattern || nodeType === Syntax.SpreadElement; + } + + // Importing ImportDeclaration. + // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation + // FIXME: Now, we don't create module environment, because the context is + // implementation dependent. + + function Importer(declaration, referencer) { + esrecurse.Visitor.call(this, this); + this.declaration = declaration; + this.referencer = referencer; + } + util.inherits(Importer, esrecurse.Visitor); + + Importer.prototype.visitImport = function (id, specifier) { + var that = this; + that.referencer.visitPattern(id, function (pattern) { + that.referencer.currentScope().__define(pattern, { + type: Variable.ImportBinding, + name: pattern, + node: specifier, + parent: that.declaration + }); + }); + }; + + Importer.prototype.ImportNamespaceSpecifier = function (node) { + if (node.id) { + this.visitImport(node.id, node); + } + }; + + Importer.prototype.ImportDefaultSpecifier = function (node) { + this.visitImport(node.id, node); + }; + + Importer.prototype.ImportSpecifier = function (node) { + if (node.name) { + this.visitImport(node.name, node); + } else { + this.visitImport(node.id, node); + } + }; + + // Referencing variables and creating bindings. + + function Referencer(scopeManager) { + esrecurse.Visitor.call(this, this); + this.scopeManager = scopeManager; + this.parent = null; + this.isInnerMethodDefinition = false; + } + + util.inherits(Referencer, esrecurse.Visitor); + + extend(Referencer.prototype, { + currentScope: function () { + return this.scopeManager.__currentScope; + }, + + close: function (node) { + while (this.currentScope() && node === this.currentScope().block) { + this.currentScope().__close(this.scopeManager); + } + }, + + pushInnerMethodDefinition: function (isInnerMethodDefinition) { + var previous = this.isInnerMethodDefinition; + this.isInnerMethodDefinition = isInnerMethodDefinition; + return previous; + }, + + popInnerMethodDefinition: function (isInnerMethodDefinition) { + this.isInnerMethodDefinition = isInnerMethodDefinition; + }, + + materializeTDZScope: function (node, iterationNode) { + // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-forin-div-ofexpressionevaluation-abstract-operation + // TDZ scope hides the declaration's names. + this.scopeManager.__nestTDZScope(node, iterationNode); + this.visitVariableDeclaration(this.currentScope(), Variable.TDZ, iterationNode.left, 0); + }, + + materializeIterationScope: function (node) { + // Generate iteration scope for upper ForIn/ForOf Statements. + // parent node for __nestScope is only necessary to + // distinguish MethodDefinition. + var letOrConstDecl, that = this; + this.scopeManager.__nestScope(node, false); + letOrConstDecl = node.left; + this.visitVariableDeclaration(this.currentScope(), Variable.Variable, letOrConstDecl, 0); + this.visitPattern(letOrConstDecl.declarations[0].id, function (pattern) { + that.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true); + }); + }, + + visitPattern: function (node, callback) { + traverseIdentifierInPattern(node, callback); + }, + + visitFunction: function (node) { + var i, iz, that = this; + // FunctionDeclaration name is defined in upper scope + // NOTE: Not referring variableScope. It is intended. + // Since + // in ES5, FunctionDeclaration should be in FunctionBody. + // in ES6, FunctionDeclaration should be block scoped. + if (node.type === Syntax.FunctionDeclaration) { + // id is defined in upper scope + this.currentScope().__define(node.id, { + type: Variable.FunctionName, + name: node.id, + node: node + }); + } + + // Consider this function is in the MethodDefinition. + this.scopeManager.__nestScope(node, this.isInnerMethodDefinition); + + for (i = 0, iz = node.params.length; i < iz; ++i) { + this.visitPattern(node.params[i], function (pattern) { + that.currentScope().__define(pattern, { + type: Variable.Parameter, + name: pattern, + node: node, + index: i, + rest: false + }); + }); + } + + + // if there's a rest argument, add that + if (node.rest) { + this.visitPattern(node.rest, function (pattern) { + that.currentScope().__define(pattern, { + type: Variable.Parameter, + name: pattern, + node: node, + index: node.params.length, + rest: true + }); + }); + } + + // Skip BlockStatement to prevent creating BlockStatement scope. + if (node.body.type === Syntax.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + + this.close(node); + }, + + visitClass: function (node) { + if (node.type === Syntax.ClassDeclaration) { + this.currentScope().__define(node.id, { + type: Variable.ClassName, + name: node.id, + node: node + }); + } + + // FIXME: Maybe consider TDZ. + this.visit(node.superClass); + + this.scopeManager.__nestScope(node); + + if (node.id) { + this.currentScope().__define(node.id, { + type: Variable.ClassName, + name: node.id, + node: node + }); + } + this.visit(node.body); + + this.close(node); + }, + + visitProperty: function (node) { + var previous, isMethodDefinition; + if (node.computed) { + this.visit(node.key); + } + + isMethodDefinition = node.type === Syntax.MethodDefinition || node.method; + if (isMethodDefinition) { + previous = this.pushInnerMethodDefinition(true); + } + this.visit(node.value); + if (isMethodDefinition) { + this.popInnerMethodDefinition(previous); + } + }, + + visitForIn: function (node) { + var that = this; + if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== 'var') { + this.materializeTDZScope(node.right, node); + this.visit(node.right); + this.close(node.right); + + this.materializeIterationScope(node); + this.visit(node.body); + this.close(node); + } else { + if (node.left.type === Syntax.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, function (pattern) { + that.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true); + }); + } else { + if (!isPattern(node.left)) { + this.visit(node.left); + } + this.visitPattern(node.left, function (pattern) { + var maybeImplicitGlobal = null; + if (!that.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern: pattern, + node: node + }; + } + that.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true); + }); + } + this.visit(node.right); + this.visit(node.body); + } + }, + + visitVariableDeclaration: function (variableTargetScope, type, node, index) { + var decl, init, that = this; + + decl = node.declarations[index]; + init = decl.init; + // FIXME: Don't consider initializer with complex patterns. + // Such as, + // var [a, b, c = 20] = array; + this.visitPattern(decl.id, function (pattern, toplevel) { + variableTargetScope.__define(pattern, { + type: type, + name: pattern, + node: decl, + index: index, + kind: node.kind, + parent: node + }); + + if (init) { + that.currentScope().__referencing(pattern, Reference.WRITE, init, null, !toplevel); + } + }); + }, + + AssignmentExpression: function (node) { + var that = this; + if (isPattern(node.left)) { + if (node.operator === '=') { + this.visitPattern(node.left, function (pattern, toplevel) { + var maybeImplicitGlobal = null; + if (!that.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern: pattern, + node: node + }; + } + that.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !toplevel); + }); + } else { + that.currentScope().__referencing(node.left, Reference.RW, node.right); + } + } else { + this.visit(node.left); + } + this.visit(node.right); + }, + + CatchClause: function (node) { + var that = this; + this.scopeManager.__nestScope(node); + + this.visitPattern(node.param, function (pattern) { + that.currentScope().__define(pattern, { + type: Variable.CatchClause, + name: node.param, + node: node + }); + }); + this.visit(node.body); + + this.close(node); + }, + + Program: function (node) { + this.scopeManager.__nestScope(node); + + if (this.scopeManager.__isNodejsScope()) { + // Force strictness of GlobalScope to false when using node.js scope. + this.currentScope().isStrict = false; + this.scopeManager.__nestForceFunctionScope(node); + } + + if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { + this.scopeManager.__nestModuleScope(node); + } + + this.visitChildren(node); + this.close(node); + }, + + Identifier: function (node) { + this.currentScope().__referencing(node); + }, + + UpdateExpression: function (node) { + if (isPattern(node.argument)) { + this.currentScope().__referencing(node.argument, Reference.RW, null); + } else { + this.visitChildren(node); + } + }, + + MemberExpression: function (node) { + this.visit(node.object); + if (node.computed) { + this.visit(node.property); + } + }, + + Property: function (node) { + this.visitProperty(node); + }, + + MethodDefinition: function (node) { + this.visitProperty(node); + }, + + BreakStatement: function () {}, + + ContinueStatement: function () {}, + + LabeledStatement: function (node) { + this.visit(node.body); + }, + + ForStatement: function (node) { + // Create ForStatement declaration. + // NOTE: In ES6, ForStatement dynamically generates + // per iteration environment. However, escope is + // a static analyzer, we only generate one scope for ForStatement. + if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== 'var') { + this.scopeManager.__nestScope(node); + } + + this.visitChildren(node); + + this.close(node); + }, + + ClassExpression: function (node) { + this.visitClass(node); + }, + + ClassDeclaration: function (node) { + this.visitClass(node); + }, + + CallExpression: function (node) { + // Check this is direct call to eval + if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === 'eval') { + // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and + // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. + this.currentScope().variableScope.__detectEval(); + } + this.visitChildren(node); + }, + + BlockStatement: function (node) { + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestScope(node); + } + + this.visitChildren(node); + + this.close(node); + }, + + ThisExpression: function () { + this.currentScope().variableScope.__detectThis(); + }, + + WithStatement: function (node) { + this.visit(node.object); + // Then nest scope for WithStatement. + this.scopeManager.__nestScope(node); + + this.visit(node.body); + + this.close(node); + }, + + VariableDeclaration: function (node) { + var variableTargetScope, i, iz, decl; + variableTargetScope = (node.kind === 'var') ? this.currentScope().variableScope : this.currentScope(); + for (i = 0, iz = node.declarations.length; i < iz; ++i) { + decl = node.declarations[i]; + this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); + if (decl.init) { + this.visit(decl.init); + } + } + }, + + // sec 13.11.8 + SwitchStatement: function (node) { + var i, iz; + + this.visit(node.discriminant); + + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestScope(node); + } + + for (i = 0, iz = node.cases.length; i < iz; ++i) { + this.visit(node.cases[i]); + } + + this.close(node); + }, + + FunctionDeclaration: function (node) { + this.visitFunction(node); + }, + + FunctionExpression: function (node) { + this.visitFunction(node); + }, + + ForOfStatement: function (node) { + this.visitForIn(node); + }, + + ForInStatement: function (node) { + this.visitForIn(node); + }, + + ArrowFunctionExpression: function (node) { + this.visitFunction(node); + }, + + ImportDeclaration: function (node) { + var importer; + + assert(this.scopeManager.__isES6() && this.scopeManager.isModule()); + + importer = new Importer(node, this); + importer.visit(node); + }, + + ExportDeclaration: function (node) { + if (node.source) { + return; + } + if (node.declaration) { + this.visit(node.declaration); + return; + } + + this.visitChildren(node); + }, + + ExportSpecifier: function (node) { + this.visit(node.id); + } + }); + + /** + * Main interface function. Takes an Esprima syntax tree and returns the + * analyzed scopes. + * @function analyze + * @param {esprima.Tree} tree + * @param {Object} providedOptions - Options that tailor the scope analysis + * @param {boolean} [providedOptions.optimistic=false] - the optimistic flag + * @param {boolean} [providedOptions.directive=false]- the directive flag + * @param {boolean} [providedOptions.nodejsScope=false]- whether the whole + * script is executed under node.js environment. When enabled, escope adds + * a function scope immediately following the global scope. + * @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls + * @param {string} [providedOptions.sourceType='script']- the source type of the script. one of 'script' and 'module' + * @param {number} [providedOptions.ecmaVersion=5]- which ECMAScript version is considered + * @return {ScopeManager} + */ + function analyze(tree, providedOptions) { + var scopeManager, referencer, options; + + options = updateDeeply(defaultOptions(), providedOptions); + + scopeManager = new ScopeManager(options); + + referencer = new Referencer(scopeManager); + referencer.visit(tree); + + assert(scopeManager.__currentScope === null); + + return scopeManager; + } + + /** @name module:escope.version */ + exports.version = require('./package.json').version; + /** @name module:escope.Reference */ + exports.Reference = Reference; + /** @name module:escope.Variable */ + exports.Variable = Variable; + /** @name module:escope.Scope */ + exports.Scope = Scope; + /** @name module:escope.ScopeManager */ + exports.ScopeManager = ScopeManager; + /** @name module:escope.analyze */ + exports.analyze = analyze; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/gulpfile.coffee b/node_modules/standard/node_modules/eslint/node_modules/escope/gulpfile.coffee new file mode 100644 index 00000000..58153eba --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/gulpfile.coffee @@ -0,0 +1,72 @@ +# Copyright (C) 2014 Yusuke Suzuki +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +gulp = require 'gulp' +mocha = require 'gulp-mocha' +eslint = require 'gulp-eslint' +minimist = require 'minimist' +source = require 'vinyl-source-stream' +browserify = require 'browserify' + +require 'coffee-script/register' + +SOURCE = [ + '*.js' +] + +ESLINT_OPTION = + rules: + 'quotes': 0 + 'eqeqeq': 0 + 'no-use-before-define': 0 + 'no-shadow': 0 + 'no-new': 0 + 'no-underscore-dangle': 0 + 'no-multi-spaces': false + 'no-native-reassign': 0 + 'no-loop-func': 0 + 'no-lone-blocks': 0 + env: + 'node': true + +gulp.task 'test', -> + options = minimist process.argv.slice(2), + string: 'test', + default: + test: 'test/*.coffee' + return gulp.src(options.test).pipe(mocha reporter: 'spec') + +gulp.task 'lint', -> + return gulp.src(SOURCE) + .pipe(eslint(ESLINT_OPTION)) + .pipe(eslint.formatEach('stylish', process.stderr)) + .pipe(eslint.failOnError()) + +gulp.task 'build', -> + browserify + entries: [ './escope.js' ] + .bundle() + .pipe source 'bundle.js' + .pipe gulp.dest 'build' + +gulp.task 'travis', [ 'lint', 'test' ] +gulp.task 'default', [ 'travis' ] diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/.lint new file mode 100644 index 00000000..e8cb4c75 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/.lint @@ -0,0 +1,11 @@ +@root + +module + +indent 2 +maxlen 80 +tabs + +ass +nomen +plusplus diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/.travis.yml new file mode 100644 index 00000000..9181d782 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+es6-map@medikoo.com + +script: "npm test && npm run lint" diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/CHANGES new file mode 100644 index 00000000..a17e221a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/CHANGES @@ -0,0 +1,16 @@ +v0.1.1 -- 2014.10.07 +* Fix isImplemented so native Maps are detected properly +* Configure lint scripts + +v0.1.0 -- 2014.04.29 +* Assure strictly npm hosted dependencies +* Update to use latest versions of dependencies + +v0.0.1 -- 2014.04.25 +* Provide @@toStringTag symbol, and use other ES 6 symbols +* Fix iterators handling +* Fix isImplemented so it doesn't crash +* Update up to changes in dependencies + +v0.0.0 -- 2013.11.10 +- Initial (dev) version diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/LICENCE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/LICENCE new file mode 100644 index 00000000..aaf35282 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/LICENCE @@ -0,0 +1,19 @@ +Copyright (C) 2013 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/README.md new file mode 100644 index 00000000..1ea3a953 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/README.md @@ -0,0 +1,75 @@ +# es6-map +## Map collection as specified in ECMAScript6 + +### Usage + +If you want to make sure your environment implements `Map`, do: + +```javascript +require('es6-map/implement'); +``` + +If you'd like to use native version when it exists and fallback to polyfill if it doesn't, but without implementing `Map` on global scope, do: + +```javascript +var Map = require('es6-map'); +``` + +If you strictly want to use polyfill even if native `Map` exists, do: + +```javascript +var Map = require('es6-map/polyfill'); +``` + +### Installation + + $ npm install es6-map + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +#### API + +Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-objects). Still if you want quick look, follow examples: + +```javascript +var Map = require('es6-map'); + +var x = {}, y = {}, map = new Map([['raz', 'one'], ['dwa', 'two'], [x, y]]); + +map.size; // 3 +map.get('raz'); // 'one' +map.get(x); // y +map.has('raz'); // true +map.has(x); // true +map.has('foo'); // false +map.set('trzy', 'three'); // map +map.size // 4 +map.get('trzy'); // 'three' +map.has('trzy'); // true +map.has('dwa'); // true +map.delete('dwa'); // true +map.size; // 3 + +map.forEach(function (value, key) { + // { 'raz', 'one' }, { x, y }, { 'trzy', 'three' } iterated +}); + +// FF nightly only: +for (value of map) { + // ['raz', 'one'], [x, y], ['trzy', 'three'] iterated +} + +var iterator = map.values(); + +iterator.next(); // { done: false, value: 'one' } +iterator.next(); // { done: false, value: y } +iterator.next(); // { done: false, value: 'three' } +iterator.next(); // { done: true, value: undefined } + +map.clear(); // undefined +map.size; // 0 +``` + +## Tests [![Build Status](https://travis-ci.org/medikoo/es6-map.png)](https://travis-ci.org/medikoo/es6-map) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/implement.js new file mode 100644 index 00000000..ff3ebacc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(require('es5-ext/global'), 'Map', + { value: require('./polyfill'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/index.js new file mode 100644 index 00000000..3e27caac --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? Map : require('./polyfill'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/is-implemented.js new file mode 100644 index 00000000..cb872fa4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/is-implemented.js @@ -0,0 +1,30 @@ +'use strict'; + +module.exports = function () { + var map, iterator, result; + if (typeof Map !== 'function') return false; + try { + // WebKit doesn't support arguments and crashes + map = new Map([['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']]); + } catch (e) { + return false; + } + if (map.size !== 3) return false; + if (typeof map.clear !== 'function') return false; + if (typeof map.delete !== 'function') return false; + if (typeof map.entries !== 'function') return false; + if (typeof map.forEach !== 'function') return false; + if (typeof map.get !== 'function') return false; + if (typeof map.has !== 'function') return false; + if (typeof map.keys !== 'function') return false; + if (typeof map.set !== 'function') return false; + if (typeof map.values !== 'function') return false; + + iterator = map.entries(); + result = iterator.next(); + if (result.done !== false) return false; + if (!result.value) return false; + if (result.value[0] !== 'raz') return false; + if (result.value[1] !== 'one') return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/is-map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/is-map.js new file mode 100644 index 00000000..f45526a4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/is-map.js @@ -0,0 +1,12 @@ +'use strict'; + +var toStringTagSymbol = require('es6-symbol').toStringTag + + , toString = Object.prototype.toString + , id = '[object Map]' + , Global = (typeof Map === 'undefined') ? null : Map; + +module.exports = function (x) { + return (x && ((Global && (x instanceof Global)) || + (toString.call(x) === id) || (x[toStringTagSymbol] === 'Map'))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/is-native-implemented.js new file mode 100644 index 00000000..208c6613 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/is-native-implemented.js @@ -0,0 +1,9 @@ +// Exports true if environment provides native `Map` implementation, +// whatever that is. + +'use strict'; + +module.exports = (function () { + if (typeof Map === 'undefined') return false; + return (Object.prototype.toString.call(Map.prototype) === '[object Map]'); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/lib/iterator-kinds.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/lib/iterator-kinds.js new file mode 100644 index 00000000..5367b38d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/lib/iterator-kinds.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('es5-ext/object/primitive-set')('key', + 'value', 'key+value'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/lib/iterator.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/lib/iterator.js new file mode 100644 index 00000000..60f1e8c9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/lib/iterator.js @@ -0,0 +1,38 @@ +'use strict'; + +var setPrototypeOf = require('es5-ext/object/set-prototype-of') + , d = require('d') + , Iterator = require('es6-iterator') + , toStringTagSymbol = require('es6-symbol').toStringTag + , kinds = require('./iterator-kinds') + + , defineProperties = Object.defineProperties + , unBind = Iterator.prototype._unBind + , MapIterator; + +MapIterator = module.exports = function (map, kind) { + if (!(this instanceof MapIterator)) return new MapIterator(map, kind); + Iterator.call(this, map.__mapKeysData__, map); + if (!kind || !kinds[kind]) kind = 'key+value'; + defineProperties(this, { + __kind__: d('', kind), + __values__: d('w', map.__mapValuesData__) + }); +}; +if (setPrototypeOf) setPrototypeOf(MapIterator, Iterator); + +MapIterator.prototype = Object.create(Iterator.prototype, { + constructor: d(MapIterator), + _resolve: d(function (i) { + if (this.__kind__ === 'value') return this.__values__[i]; + if (this.__kind__ === 'key') return this.__list__[i]; + return [this.__list__[i], this.__values__[i]]; + }), + _unBind: d(function () { + this.__values__ = null; + unBind.call(this); + }), + toString: d(function () { return '[object Map Iterator]'; }) +}); +Object.defineProperty(MapIterator.prototype, toStringTagSymbol, + d('c', 'Map Iterator')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/lib/primitive-iterator.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/lib/primitive-iterator.js new file mode 100644 index 00000000..b9eada37 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/lib/primitive-iterator.js @@ -0,0 +1,57 @@ +'use strict'; + +var clear = require('es5-ext/array/#/clear') + , assign = require('es5-ext/object/assign') + , setPrototypeOf = require('es5-ext/object/set-prototype-of') + , toStringTagSymbol = require('es6-symbol').toStringTag + , d = require('d') + , autoBind = require('d/auto-bind') + , Iterator = require('es6-iterator') + , kinds = require('./iterator-kinds') + + , defineProperties = Object.defineProperties, keys = Object.keys + , unBind = Iterator.prototype._unBind + , PrimitiveMapIterator; + +PrimitiveMapIterator = module.exports = function (map, kind) { + if (!(this instanceof PrimitiveMapIterator)) { + return new PrimitiveMapIterator(map, kind); + } + Iterator.call(this, keys(map.__mapKeysData__), map); + if (!kind || !kinds[kind]) kind = 'key+value'; + defineProperties(this, { + __kind__: d('', kind), + __keysData__: d('w', map.__mapKeysData__), + __valuesData__: d('w', map.__mapValuesData__) + }); +}; +if (setPrototypeOf) setPrototypeOf(PrimitiveMapIterator, Iterator); + +PrimitiveMapIterator.prototype = Object.create(Iterator.prototype, assign({ + constructor: d(PrimitiveMapIterator), + _resolve: d(function (i) { + if (this.__kind__ === 'value') return this.__valuesData__[this.__list__[i]]; + if (this.__kind__ === 'key') return this.__keysData__[this.__list__[i]]; + return [this.__keysData__[this.__list__[i]], + this.__valuesData__[this.__list__[i]]]; + }), + _unBind: d(function () { + this.__keysData__ = null; + this.__valuesData__ = null; + unBind.call(this); + }), + toString: d(function () { return '[object Map Iterator]'; }) +}, autoBind({ + _onAdd: d(function (key) { this.__list__.push(key); }), + _onDelete: d(function (key) { + var index = this.__list__.lastIndexOf(key); + if (index < this.__nextIndex__) return; + this.__list__.splice(index, 1); + }), + _onClear: d(function () { + clear.call(this.__list__); + this.__nextIndex__ = 0; + }) +}))); +Object.defineProperty(PrimitiveMapIterator.prototype, toStringTagSymbol, + d('c', 'Map Iterator')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/.lint new file mode 100644 index 00000000..858b7535 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/.lint @@ -0,0 +1,12 @@ +@root + +es5 +module + +tabs +indent 2 +maxlen 80 + +ass +nomen +plusplus diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/.travis.yml new file mode 100644 index 00000000..50008b23 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+d@medikoo.com diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/CHANGES new file mode 100644 index 00000000..45233f74 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/CHANGES @@ -0,0 +1,7 @@ +v0.1.1 -- 2014.04.24 +- Add `autoBind` and `lazy` utilities +- Allow to pass other options to be merged onto created descriptor. + Useful when used with other custom utilties + +v0.1.0 -- 2013.06.20 +Initial (derived from es5-ext project) diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/LICENCE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/LICENCE new file mode 100644 index 00000000..aaf35282 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/LICENCE @@ -0,0 +1,19 @@ +Copyright (C) 2013 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/README.md new file mode 100644 index 00000000..872d493e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/README.md @@ -0,0 +1,108 @@ +# D - Property descriptor factory + +_Originally derived from [es5-ext](https://github.com/medikoo/es5-ext) package._ + +Defining properties with descriptors is very verbose: + +```javascript +var Account = function () {}; +Object.defineProperties(Account.prototype, { + deposit: { value: function () { + /* ... */ + }, configurable: true, enumerable: false, writable: true }, + whithdraw: { value: function () { + /* ... */ + }, configurable: true, enumerable: false, writable: true }, + balance: { get: function () { + /* ... */ + }, configurable: true, enumerable: false } +}); +``` + +D cuts that to: + +```javascript +var d = require('d'); + +var Account = function () {}; +Object.defineProperties(Account.prototype, { + deposit: d(function () { + /* ... */ + }), + whithdraw: d(function () { + /* ... */ + }), + balance: d.gs(function () { + /* ... */ + }) +}); +``` + +By default, created descriptor follow characteristics of native ES5 properties, and defines values as: + +```javascript +{ configurable: true, enumerable: false, writable: true } +``` + +You can overwrite it by preceding _value_ argument with instruction: +```javascript +d('c', value); // { configurable: true, enumerable: false, writable: false } +d('ce', value); // { configurable: true, enumerable: true, writable: false } +d('e', value); // { configurable: false, enumerable: true, writable: false } + +// Same way for get/set: +d.gs('e', value); // { configurable: false, enumerable: true } +``` + +### Other utilities + +#### autoBind(obj, props) _(d/auto-bind)_ + +Define methods which will be automatically bound to its instances + +```javascript +var d = require('d'); +var autoBind = require('d/auto-bind'); + +var Foo = function () { this._count = 0; }; +autoBind(Foo.prototype, { + increment: d(function () { ++this._count; }); +}); + +var foo = new Foo(); + +// Increment foo counter on each domEl click +domEl.addEventListener('click', foo.increment, false); +``` + +#### lazy(obj, props) _(d/lazy)_ + +Define lazy properties, which will be resolved on first access + +```javascript +var d = require('d'); +var lazy = require('d/lazy'); + +var Foo = function () {}; +lazy(Foo.prototype, { + items: d(function () { return []; }) +}); + +var foo = new Foo(); +foo.items.push(1, 2); // foo.items array created +``` + +## Installation +### NPM + +In your project path: + + $ npm install d + +### Browser + +You can easily bundle _D_ for browser with [modules-webmake](https://github.com/medikoo/modules-webmake) + +## Tests [![Build Status](https://travis-ci.org/medikoo/d.png)](https://travis-ci.org/medikoo/d) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/auto-bind.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/auto-bind.js new file mode 100644 index 00000000..1b00dba3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/auto-bind.js @@ -0,0 +1,31 @@ +'use strict'; + +var copy = require('es5-ext/object/copy') + , map = require('es5-ext/object/map') + , callable = require('es5-ext/object/valid-callable') + , validValue = require('es5-ext/object/valid-value') + + , bind = Function.prototype.bind, defineProperty = Object.defineProperty + , hasOwnProperty = Object.prototype.hasOwnProperty + , define; + +define = function (name, desc, bindTo) { + var value = validValue(desc) && callable(desc.value), dgs; + dgs = copy(desc); + delete dgs.writable; + delete dgs.value; + dgs.get = function () { + if (hasOwnProperty.call(this, name)) return value; + desc.value = bind.call(value, (bindTo == null) ? this : this[bindTo]); + defineProperty(this, name, desc); + return this[name]; + }; + return dgs; +}; + +module.exports = function (props/*, bindTo*/) { + var bindTo = arguments[1]; + return map(props, function (desc, name) { + return define(name, desc, bindTo); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/index.js new file mode 100644 index 00000000..076ae465 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/index.js @@ -0,0 +1,63 @@ +'use strict'; + +var assign = require('es5-ext/object/assign') + , normalizeOpts = require('es5-ext/object/normalize-options') + , isCallable = require('es5-ext/object/is-callable') + , contains = require('es5-ext/string/#/contains') + + , d; + +d = module.exports = function (dscr, value/*, options*/) { + var c, e, w, options, desc; + if ((arguments.length < 2) || (typeof dscr !== 'string')) { + options = value; + value = dscr; + dscr = null; + } else { + options = arguments[2]; + } + if (dscr == null) { + c = w = true; + e = false; + } else { + c = contains.call(dscr, 'c'); + e = contains.call(dscr, 'e'); + w = contains.call(dscr, 'w'); + } + + desc = { value: value, configurable: c, enumerable: e, writable: w }; + return !options ? desc : assign(normalizeOpts(options), desc); +}; + +d.gs = function (dscr, get, set/*, options*/) { + var c, e, options, desc; + if (typeof dscr !== 'string') { + options = set; + set = get; + get = dscr; + dscr = null; + } else { + options = arguments[3]; + } + if (get == null) { + get = undefined; + } else if (!isCallable(get)) { + options = get; + get = set = undefined; + } else if (set == null) { + set = undefined; + } else if (!isCallable(set)) { + options = set; + set = undefined; + } + if (dscr == null) { + c = true; + e = false; + } else { + c = contains.call(dscr, 'c'); + e = contains.call(dscr, 'e'); + } + + desc = { get: get, set: set, configurable: c, enumerable: e }; + return !options ? desc : assign(normalizeOpts(options), desc); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/lazy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/lazy.js new file mode 100644 index 00000000..61e46653 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/lazy.js @@ -0,0 +1,111 @@ +'use strict'; + +var map = require('es5-ext/object/map') + , isCallable = require('es5-ext/object/is-callable') + , validValue = require('es5-ext/object/valid-value') + , contains = require('es5-ext/string/#/contains') + + , call = Function.prototype.call + , defineProperty = Object.defineProperty + , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor + , getPrototypeOf = Object.getPrototypeOf + , hasOwnProperty = Object.prototype.hasOwnProperty + , cacheDesc = { configurable: false, enumerable: false, writable: false, + value: null } + , define; + +define = function (name, options) { + var value, dgs, cacheName, desc, writable = false, resolvable + , flat; + options = Object(validValue(options)); + cacheName = options.cacheName; + flat = options.flat; + if (cacheName == null) cacheName = name; + delete options.cacheName; + value = options.value; + resolvable = isCallable(value); + delete options.value; + dgs = { configurable: Boolean(options.configurable), + enumerable: Boolean(options.enumerable) }; + if (name !== cacheName) { + dgs.get = function () { + if (hasOwnProperty.call(this, cacheName)) return this[cacheName]; + cacheDesc.value = resolvable ? call.call(value, this, options) : value; + cacheDesc.writable = writable; + defineProperty(this, cacheName, cacheDesc); + cacheDesc.value = null; + if (desc) defineProperty(this, name, desc); + return this[cacheName]; + }; + } else if (!flat) { + dgs.get = function self() { + var ownDesc; + if (hasOwnProperty.call(this, name)) { + ownDesc = getOwnPropertyDescriptor(this, name); + // It happens in Safari, that getter is still called after property + // was defined with a value, following workarounds that + if (ownDesc.hasOwnProperty('value')) return ownDesc.value; + if ((typeof ownDesc.get === 'function') && (ownDesc.get !== self)) { + return ownDesc.get.call(this); + } + return value; + } + desc.value = resolvable ? call.call(value, this, options) : value; + defineProperty(this, name, desc); + desc.value = null; + return this[name]; + }; + } else { + dgs.get = function self() { + var base = this, ownDesc; + if (hasOwnProperty.call(this, name)) { + // It happens in Safari, that getter is still called after property + // was defined with a value, following workarounds that + ownDesc = getOwnPropertyDescriptor(this, name); + if (ownDesc.hasOwnProperty('value')) return ownDesc.value; + if ((typeof ownDesc.get === 'function') && (ownDesc.get !== self)) { + return ownDesc.get.call(this); + } + } + while (!hasOwnProperty.call(base, name)) base = getPrototypeOf(base); + desc.value = resolvable ? call.call(value, base, options) : value; + defineProperty(base, name, desc); + desc.value = null; + return base[name]; + }; + } + dgs.set = function (value) { + dgs.get.call(this); + this[cacheName] = value; + }; + if (options.desc) { + desc = { + configurable: contains.call(options.desc, 'c'), + enumerable: contains.call(options.desc, 'e') + }; + if (cacheName === name) { + desc.writable = contains.call(options.desc, 'w'); + desc.value = null; + } else { + writable = contains.call(options.desc, 'w'); + desc.get = dgs.get; + desc.set = dgs.set; + } + delete options.desc; + } else if (cacheName === name) { + desc = { + configurable: Boolean(options.configurable), + enumerable: Boolean(options.enumerable), + writable: Boolean(options.writable), + value: null + }; + } + delete options.configurable; + delete options.enumerable; + delete options.writable; + return dgs; +}; + +module.exports = function (props) { + return map(props, function (desc, name) { return define(name, desc); }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/package.json new file mode 100644 index 00000000..03d81db1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/package.json @@ -0,0 +1,59 @@ +{ + "name": "d", + "version": "0.1.1", + "description": "Property descriptor factory", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "scripts": { + "test": "node node_modules/tad/bin/tad" + }, + "repository": { + "type": "git", + "url": "git://github.com/medikoo/d.git" + }, + "keywords": [ + "descriptor", + "es", + "ecmascript", + "ecma", + "property", + "descriptors", + "meta", + "properties" + ], + "dependencies": { + "es5-ext": "~0.10.2" + }, + "devDependencies": { + "tad": "~0.1.21" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/medikoo/d/issues" + }, + "homepage": "https://github.com/medikoo/d", + "_id": "d@0.1.1", + "dist": { + "shasum": "da184c535d18d8ee7ba2aa229b914009fae11309", + "tarball": "http://registry.npmjs.org/d/-/d-0.1.1.tgz" + }, + "_from": "d@>=0.1.1 <0.2.0", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "directories": {}, + "_shasum": "da184c535d18d8ee7ba2aa229b914009fae11309", + "_resolved": "https://registry.npmjs.org/d/-/d-0.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/test/auto-bind.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/test/auto-bind.js new file mode 100644 index 00000000..89edfb88 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/test/auto-bind.js @@ -0,0 +1,12 @@ +'use strict'; + +var d = require('../'); + +module.exports = function (t, a) { + var o = Object.defineProperties({}, t({ + bar: d(function () { return this === o; }), + bar2: d(function () { return this; }) + })); + + a.deep([(o.bar)(), (o.bar2)()], [true, o]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/test/index.js new file mode 100644 index 00000000..3db0af10 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/test/index.js @@ -0,0 +1,182 @@ +'use strict'; + +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + +module.exports = function (t, a) { + var o, c, cg, cs, ce, ceg, ces, cew, cw, e, eg, es, ew, v, vg, vs, w, df, dfg + , dfs; + + o = Object.create(Object.prototype, { + c: t('c', c = {}), + cgs: t.gs('c', cg = function () {}, cs = function () {}), + ce: t('ce', ce = {}), + cegs: t.gs('ce', ceg = function () {}, ces = function () {}), + cew: t('cew', cew = {}), + cw: t('cw', cw = {}), + e: t('e', e = {}), + egs: t.gs('e', eg = function () {}, es = function () {}), + ew: t('ew', ew = {}), + v: t('', v = {}), + vgs: t.gs('', vg = function () {}, vs = function () {}), + w: t('w', w = {}), + + df: t(df = {}), + dfgs: t.gs(dfg = function () {}, dfs = function () {}) + }); + + return { + c: function (a) { + var d = getOwnPropertyDescriptor(o, 'c'); + a(d.value, c, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, false, "Writable"); + + d = getOwnPropertyDescriptor(o, 'cgs'); + a(d.value, undefined, "GS Value"); + a(d.get, cg, "GS Get"); + a(d.set, cs, "GS Set"); + a(d.configurable, true, "GS Configurable"); + a(d.enumerable, false, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + ce: function (a) { + var d = getOwnPropertyDescriptor(o, 'ce'); + a(d.value, ce, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, true, "Enumerable"); + a(d.writable, false, "Writable"); + + d = getOwnPropertyDescriptor(o, 'cegs'); + a(d.value, undefined, "GS Value"); + a(d.get, ceg, "GS Get"); + a(d.set, ces, "GS Set"); + a(d.configurable, true, "GS Configurable"); + a(d.enumerable, true, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + cew: function (a) { + var d = getOwnPropertyDescriptor(o, 'cew'); + a(d.value, cew, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, true, "Enumerable"); + a(d.writable, true, "Writable"); + }, + cw: function (a) { + var d = getOwnPropertyDescriptor(o, 'cw'); + a(d.value, cw, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, true, "Writable"); + }, + e: function (a) { + var d = getOwnPropertyDescriptor(o, 'e'); + a(d.value, e, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, false, "Configurable"); + a(d.enumerable, true, "Enumerable"); + a(d.writable, false, "Writable"); + + d = getOwnPropertyDescriptor(o, 'egs'); + a(d.value, undefined, "GS Value"); + a(d.get, eg, "GS Get"); + a(d.set, es, "GS Set"); + a(d.configurable, false, "GS Configurable"); + a(d.enumerable, true, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + ew: function (a) { + var d = getOwnPropertyDescriptor(o, 'ew'); + a(d.value, ew, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, false, "Configurable"); + a(d.enumerable, true, "Enumerable"); + a(d.writable, true, "Writable"); + }, + v: function (a) { + var d = getOwnPropertyDescriptor(o, 'v'); + a(d.value, v, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, false, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, false, "Writable"); + + d = getOwnPropertyDescriptor(o, 'vgs'); + a(d.value, undefined, "GS Value"); + a(d.get, vg, "GS Get"); + a(d.set, vs, "GS Set"); + a(d.configurable, false, "GS Configurable"); + a(d.enumerable, false, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + w: function (a) { + var d = getOwnPropertyDescriptor(o, 'w'); + a(d.value, w, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, false, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, true, "Writable"); + }, + d: function (a) { + var d = getOwnPropertyDescriptor(o, 'df'); + a(d.value, df, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, true, "Writable"); + + d = getOwnPropertyDescriptor(o, 'dfgs'); + a(d.value, undefined, "GS Value"); + a(d.get, dfg, "GS Get"); + a(d.set, dfs, "GS Set"); + a(d.configurable, true, "GS Configurable"); + a(d.enumerable, false, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + Options: { + v: function (a) { + var x = {}, d = t(x, { foo: true }); + a.deep(d, { configurable: true, enumerable: false, writable: true, + value: x, foo: true }, "No descriptor"); + d = t('c', 'foo', { marko: 'elo' }); + a.deep(d, { configurable: true, enumerable: false, writable: false, + value: 'foo', marko: 'elo' }, "Descriptor"); + }, + gs: function (a) { + var gFn = function () {}, sFn = function () {}, d; + d = t.gs(gFn, sFn, { foo: true }); + a.deep(d, { configurable: true, enumerable: false, get: gFn, set: sFn, + foo: true }, "No descriptor"); + d = t.gs(null, sFn, { foo: true }); + a.deep(d, { configurable: true, enumerable: false, get: undefined, + set: sFn, foo: true }, "No descriptor: Just set"); + d = t.gs(gFn, { foo: true }); + a.deep(d, { configurable: true, enumerable: false, get: gFn, + set: undefined, foo: true }, "No descriptor: Just get"); + + d = t.gs('e', gFn, sFn, { bar: true }); + a.deep(d, { configurable: false, enumerable: true, get: gFn, set: sFn, + bar: true }, "Descriptor"); + d = t.gs('e', null, sFn, { bar: true }); + a.deep(d, { configurable: false, enumerable: true, get: undefined, + set: sFn, bar: true }, "Descriptor: Just set"); + d = t.gs('e', gFn, { bar: true }); + a.deep(d, { configurable: false, enumerable: true, get: gFn, + set: undefined, bar: true }, "Descriptor: Just get"); + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/test/lazy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/test/lazy.js new file mode 100644 index 00000000..8266deb2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/d/test/lazy.js @@ -0,0 +1,77 @@ +'use strict'; + +var d = require('../') + + , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + +module.exports = function (t, a) { + var Foo = function () {}, i = 1, o, o2, desc; + Object.defineProperties(Foo.prototype, t({ + bar: d(function () { return ++i; }), + bar2: d(function () { return this.bar + 23; }), + bar3: d(function () { return this.bar2 + 34; }, { desc: 'ew' }), + bar4: d(function () { return this.bar3 + 12; }, { cacheName: '_bar4_' }), + bar5: d(function () { return this.bar4 + 3; }, + { cacheName: '_bar5_', desc: 'e' }) + })); + + desc = getOwnPropertyDescriptor(Foo.prototype, 'bar'); + a(desc.configurable, true, "Configurable: default"); + a(desc.enumerable, false, "Enumerable: default"); + + o = new Foo(); + a.deep([o.bar, o.bar2, o.bar3, o.bar4, o.bar5], [2, 25, 59, 71, 74], + "Values"); + + a.deep(getOwnPropertyDescriptor(o, 'bar3'), { configurable: false, + enumerable: true, writable: true, value: 59 }, "Desc"); + a(o.hasOwnProperty('bar4'), false, "Cache not exposed"); + desc = getOwnPropertyDescriptor(o, 'bar5'); + a.deep(desc, { configurable: false, + enumerable: true, get: desc.get, set: desc.set }, "Cache & Desc: desc"); + + o2 = Object.create(o); + o2.bar = 30; + o2.bar3 = 100; + + a.deep([o2.bar, o2.bar2, o2.bar3, o2.bar4, o2.bar5], [30, 25, 100, 112, 115], + "Extension Values"); + + Foo = function () {}; + Object.defineProperties(Foo.prototype, t({ + test: d('w', function () { return 'raz'; }), + test2: d('', function () { return 'raz'; }, { desc: 'w' }), + test3: d('', function () { return 'raz'; }, + { cacheName: '__test3__', desc: 'w' }), + test4: d('w', 'bar') + })); + + o = new Foo(); + o.test = 'marko'; + a.deep(getOwnPropertyDescriptor(o, 'test'), + { configurable: false, enumerable: false, writable: true, value: 'marko' }, + "Set before get"); + o.test2 = 'marko2'; + a.deep(getOwnPropertyDescriptor(o, 'test2'), + { configurable: false, enumerable: false, writable: true, value: 'marko2' }, + "Set before get: Custom desc"); + o.test3 = 'marko3'; + a.deep(getOwnPropertyDescriptor(o, '__test3__'), + { configurable: false, enumerable: false, writable: true, value: 'marko3' }, + "Set before get: Custom cache name"); + a(o.test4, 'bar', "Resolve by value"); + + a.h1("Flat"); + Object.defineProperties(Foo.prototype, t({ + flat: d(function () { return 'foo'; }, { flat: true }), + flat2: d(function () { return 'bar'; }, { flat: true }) + })); + + a.h2("Instance"); + a(o.flat, 'foo', "Value"); + a(o.hasOwnProperty('flat'), false, "Instance"); + a(Foo.prototype.flat, 'foo', "Prototype"); + + a.h2("Direct"); + a(Foo.prototype.flat2, 'bar'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.lint new file mode 100644 index 00000000..d1da6103 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.lint @@ -0,0 +1,38 @@ +@root + +module + +indent 2 +maxlen 100 +tabs + +ass +continue +forin +nomen +plusplus +vars + +./global.js +./function/_define-length.js +./function/#/copy.js +./object/unserialize.js +./test/function/valid-function.js +evil + +./math/_pack-ieee754.js +./math/_unpack-ieee754.js +./math/clz32/shim.js +./math/imul/shim.js +./number/to-uint32.js +./string/#/at.js +bitwise + +./math/fround/shim.js +predef+ Float32Array + +./object/first-key.js +forin + +./test/reg-exp/#/index.js +predef+ __dirname diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.lintignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.lintignore new file mode 100644 index 00000000..ed703ed7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.lintignore @@ -0,0 +1,8 @@ +/string/#/normalize/_data.js +/test/boolean/is-boolean.js +/test/date/is-date.js +/test/number/is-number.js +/test/object/is-copy.js +/test/object/is-object.js +/test/reg-exp/is-reg-exp.js +/test/string/is-string.js diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.npmignore new file mode 100644 index 00000000..eb09b500 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/.lintcache +/npm-debug.log diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.travis.yml new file mode 100644 index 00000000..a183dbce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/.travis.yml @@ -0,0 +1,15 @@ +sudo: false # http://docs.travis-ci.com/user/workers/container-based-infrastructure/ +language: node_js +node_js: + - 0.10 + - 0.12 + - iojs + +before_install: + - mkdir node_modules; ln -s ../ node_modules/es5-ext + +notifications: + email: + - medikoo+es5-ext@medikoo.com + +script: "npm test && npm run lint" diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/CHANGES new file mode 100644 index 00000000..5d0ace5b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/CHANGES @@ -0,0 +1,611 @@ +v0.10.7 -- 2015.04.22 +* New utlitities. They're convention differs from v0.10, as they were supposed to land in v1. + Still they're non breaking and start the conventions to be used in v1 + * Object.validateArrayLike + * Object.validateArrayLikeObject + * Object.validateStringifiable + * Object.validateStringifiableValue + * Universal utilities for array-like/iterable objects + * Iterable.is + * Iterable.validate + * Iterable.validateObject + * Iterable.forEach +* Fix camelToHyphen resolution, it must be absolutely reversable by hyphenToCamel +* Fix calculations of large numbers in Math.tanh +* Fix algorithm of Math.sinh +* Fix indexes to not use real symbols +* Fix length of String.fromCodePoint +* Fix tests of Array#copyWithin +* Update Travis CI configuration + +v0.10.6 -- 2015.02.02 +* Fix handling of infinite values in Math.trunc +* Fix handling of getters in Object.normalizeOptions + +v0.10.5 -- 2015.01.20 +* Add Function#toStringTokens +* Add Object.serialize and Object.unserialize +* Add String.randomUniq +* Fix Strin#camelToHyphen issue with tokens that end with digit +* Optimise Number.isInteger logic +* Improve documentation +* Configure lint scripts +* Fix spelling of LICENSE + +v0.10.4 -- 2014.04.30 +* Assure maximum spec compliance of Array.of and Array.from (thanks @mathiasbynens) +* Improve documentations + +v0.10.3 -- 2014.04.29 +Provide accurate iterators handling: +* Array.from improvements: + * Assure right unicode symbols resolution when processing strings in Array.from + * Rely on ES6 symbol shim and use native @@iterator Symbol if provided by environment +* Add methods: + * Array.prototype.entries + * Array.prototype.keys + * Array.prototype.values + * Array.prototype[@@iterator] + * String.prototype[@@iterator] + +Improve documentation + +v0.10.2 -- 2014.04.24 +- Simplify and deprecate `isCallable`. It seems in ES5 based engines there are + no callable objects which are `typeof obj !== 'function'` +- Update Array.from map callback signature (up to latest resolution of TC39) +- Improve documentation + +v0.10.1 -- 2014.04.14 +Bump version for npm +(Workaround for accidental premature publish & unpublish of v0.10.0 a while ago) + +v0.10.0 -- 2014.04.13 +Major update: +- All methods and function specified for ECMAScript 6 are now introduced as + shims accompanied with functions through which (optionally) they can be + implementend on native objects +- Filename convention was changed to shorter and strictly lower case names. e.g. + `lib/String/prototype/starts-with` became `string/#/starts-with` +- Generated functions are guaranteed to have expected length +- Objects with null prototype (created via `Object.create(null)`) are widely + supported (older version have crashed due to implied `obj.hasOwnProperty` and + related invocations) +- Support array subclasses +- When handling lists do not limit its length to Uint32 range +- Use newly introduced `Object.eq` for strict equality in place of `Object.is` +- Iteration of Object have been improved so properties that were hidden or + removed after iteration started are not iterated. + +Additions: +- `Array.isPlainArray` +- `Array.validArray` +- `Array.prototype.concat` (as updated with ES6) +- `Array.prototype.copyWithin` (as introduced with ES6) +- `Array.prototype.fill` (as introduced with ES6) +- `Array.prototype.filter` (as updated with ES6) +- `Array.prototype.findIndex` (as introduced with ES6) +- `Array.prototype.map` (as updated with ES6) +- `Array.prototype.separate` +- `Array.prototype.slice` (as updated with ES6) +- `Array.prototype.splice` (as updated with ES6) +- `Function.prototype.copy` +- `Math.acosh` (as introduced with ES6) +- `Math.atanh` (as introduced with ES6) +- `Math.cbrt` (as introduced with ES6) +- `Math.clz32` (as introduced with ES6) +- `Math.cosh` (as introduced with ES6) +- `Math.expm1` (as introduced with ES6) +- `Math.fround` (as introduced with ES6) +- `Math.hypot` (as introduced with ES6) +- `Math.imul` (as introduced with ES6) +- `Math.log2` (as introduced with ES6) +- `Math.log10` (as introduced with ES6) +- `Math.log1p` (as introduced with ES6) +- `Math.sinh` (as introduced with ES6) +- `Math.tanh` (as introduced with ES6) +- `Math.trunc` (as introduced with ES6) +- `Number.EPSILON` (as introduced with ES6) +- `Number.MIN_SAFE_INTEGER` (as introduced with ES6) +- `Number.MAX_SAFE_INTEGER` (as introduced with ES6) +- `Number.isFinite` (as introduced with ES6) +- `Number.isInteger` (as introduced with ES6) +- `Number.isSafeInteger` (as introduced with ES6) +- `Object.create` (with fix for V8 issue which disallows prototype turn of + objects derived from null +- `Object.eq` - Less restrictive version of `Object.is` based on SameValueZero + algorithm +- `Object.firstKey` +- `Object.keys` (as updated with ES6) +- `Object.mixinPrototypes` +- `Object.primitiveSet` +- `Object.setPrototypeOf` (as introduced with ES6) +- `Object.validObject` +- `RegExp.escape` +- `RegExp.prototype.match` (as introduced with ES6) +- `RegExp.prototype.replace` (as introduced with ES6) +- `RegExp.prototype.search` (as introduced with ES6) +- `RegExp.prototype.split` (as introduced with ES6) +- `RegExp.prototype.sticky` (as introduced with ES6) +- `RegExp.prototype.unicode` (as introduced with ES6) +- `String.fromCodePoint` (as introduced with ES6) +- `String.raw` (as introduced with ES6) +- `String.prototype.at` +- `String.prototype.codePointAt` (as introduced with ES6) +- `String.prototype.normalize` (as introduced with ES6) +- `String.prototype.plainReplaceAll` + +Removals: +- `reserved` set +- `Array.prototype.commonLeft` +- `Function.insert` +- `Function.remove` +- `Function.prototype.silent` +- `Function.prototype.wrap` +- `Object.descriptor` Move to external `d` project. + See: https://github.com/medikoo/d +- `Object.diff` +- `Object.extendDeep` +- `Object.reduce` +- `Object.values` +- `String.prototype.trimCommonLeft` + +Renames: +- `Function.i` into `Function.identity` +- `Function.k` into `Function.constant` +- `Number.toInt` into `Number.toInteger` +- `Number.toUint` into `Number.toPosInteger` +- `Object.extend` into `Object.assign` (as introduced in ES 6) +- `Object.extendProperties` into `Object.mixin`, with improved internal + handling, so it matches temporarily specified `Object.mixin` for ECMAScript 6 +- `Object.isList` into `Object.isArrayLike` +- `Object.mapToArray` into `Object.toArray` (with fixed function length) +- `Object.toPlainObject` into `Object.normalizeOptions` (as this is the real + use case where we use this function) +- `Function.prototype.chain` into `Function.prototype.compose` +- `Function.prototype.match` into `Function.prototype.spread` +- `String.prototype.format` into `String.formatMethod` + +Improvements & Fixes: +- Remove workaround for primitive values handling in object iterators +- `Array.from`: Update so it follows ES 6 spec +- `Array.prototype.compact`: filters just null and undefined values + (not all falsies) +- `Array.prototype.eIndexOf` and `Array.prototype.eLastIndexOf`: fix position + handling, improve internals +- `Array.prototype.find`: return undefined not null, in case of not found + (follow ES 6) +- `Array.prototype.remove` fix function length +- `Error.custom`: simplify, Custom class case is addressed by outer + `error-create` project -> https://github.com/medikoo/error-create +- `Error.isError` true only for Error instances (remove detection of host + Exception objects) +- `Number.prototype.pad`: Normalize negative pad +- `Object.clear`: Handle errors same way as in `Object.assign` +- `Object.compact`: filters just null and undefined values (not all falsies) +- `Object.compare`: Take into account NaN values +- `Object.copy`: Split into `Object.copy` and `Object.copyDeep` +- `Object.isCopy`: Separate into `Object.isCopy` and `Object.isCopyDeep`, where + `isCopyDeep` handles nested plain objects and plain arrays only +- `String.prototype.endsWith`: Adjust up to ES6 specification +- `String.prototype.repeat`: Adjust up to ES6 specification and improve algorithm +- `String.prototype.simpleReplace`: Rename into `String.prototype.plainReplace` +- `String.prototype.startsWith`: Adjust up to ES6 specification +- Update lint rules, and adjust code to that +- Update Travis CI configuration +- Remove Makefile (it's cross-env utility) + +v0.9.2 -- 2013.03.11 +Added: +* Array.prototype.isCopy +* Array.prototype.isUniq +* Error.CustomError +* Function.validFunction +* Object.extendDeep +* Object.descriptor.binder +* Object.safeTraverse +* RegExp.validRegExp +* String.prototype.capitalize +* String.prototype.simpleReplace + +Fixed: +* Fix Array.prototype.diff for sparse arrays +* Accept primitive objects as input values in Object iteration methods and + Object.clear, Object.count, Object.diff, Object.extend, + Object.getPropertyNames, Object.values +* Pass expected arguments to callbacks of Object.filter, Object.mapKeys, + Object.mapToArray, Object.map +* Improve callable callback support in Object.mapToArray + +v0.9.1 -- 2012.09.17 +* Object.reduce - reduce for hash-like collections +* Accapt any callable object as callback in Object.filter, mapKeys and map +* Convention cleanup + +v0.9.0 -- 2012.09.13 +We're getting to real solid API + +Removed: +* Function#memoize - it's grown up to be external package, to be soon published + as 'memoizee' +* String.guid - it doesn't fit es5-ext (extensions) concept, will be provided as + external package +# Function.arguments - obsolete +# Function.context - obsolete +# Function#flip - not readable when used, so it was never used +# Object.clone - obsolete and confusing + +Added: +* String#camelToHyphen - String format convertion + +Renamed: +* String#dashToCamelCase -> String#hyphenToCamel + +Fixes: +* Object.isObject - Quote names in literals that match reserved keywords + (older implementations crashed on that) +* String#repeat - Do not accept negative values (coerce them to 1) + +Improvements: +* Array#remove - Accepts many arguments, we can now remove many values at once +* Object iterators (forEach, map, some) - Compare function invoked with scope + object bound to this +* Function#curry - Algorithm cleanup +* Object.isCopy - Support for all types, not just plain objects +* Object.isPlainObject - Support for cross-frame objects +* Do not memoize any of the functions, it shouldn't be decided internally +* Remove Object.freeze calls in reserved, it's not up to convention +* Improved documentation +* Better linting (hard-core approach using both JSLint mod and JSHint) +* Optional arguments are now documented in funtions signature + +v0.8.2 -- 2012.06.22 +Fix errors in Array's intersection and exclusion methods, related to improper +usage of contains method + +v0.8.1 -- 2012.06.13 +Reorganized internal logic of Function.prototype.memoize. So it's more safe now +and clears cache properly. Additionally preventCache option was provided. + +v0.8.0 -- 2012.05.28 +Again, major overhaul. Probably last experimental stuff was trashed, all API +looks more like standard extensions now. + +Changes: +* Turn all Object.prototype extensions into functions and move them to Object +namespace. We learned that extending Object.prototype is bad idea in any case. +* Rename Function.prototype.curry into Function.prototype.partial. This function + is really doing partial application while currying is slightly different + concept. +* Convert Function.prototype.ncurry to new implementation of + Function.prototype.curry, it now serves real curry concept additionaly it + covers use cases for aritize and hold, which were removed. +* Rename Array's peek to last, and provide support for sparse arrays in it +* Rename Date's monthDaysCount into daysInMonth +* Simplify object iterators, now order of iteration can be configured with just + compareFn argument (no extra byKeys option) +* Rename Object.isDuplicate to Object.isCopy +* Rename Object.isEqual to Object.is which is compatible with future 'is' + keyword +* Function.memoize is now Function.prototype.memoize. Additionally clear cache + functionality is added, and access to original arguments object. +* Rename validation functions: assertNotNull to validValue, assertCallable to + validCallable. validValue was moved to Object namespace. On success they now + return validated value instead of true, it supports better composition. + Additionally created Date.validDate and Error.validError +* All documentation is now held in README.md not in code files. +* Move guid to String namespace. All guids now start with numbers. +* Array.generate: fill argument is now optional +* Object.toArray is now Array.from (as new ES6 specification draft suggests) +* All methods that rely on indexOf or lastIndexOf, now rely on egal (Object.is) + versions of them (eIndexOf, eLastIndexOf) +* Turn all get* functions that returned methods into actuall methods (get* + functionality can still be achieved with help of Function.prototype.partial). + So: Date.getFormat is now Date.prototype.format, + Number.getPad is now Number.prototype.pad, + String.getFormat is now String.prototype.format, + String.getIndent is now String.prototype.indent, + String.getPad is now String.prototype.pad +* Refactored Object.descriptor, it is now just two functions, main one and + main.gs, main is for describing values, and gs for describing getters and + setters. Configuration is passed with first argument as string e.g. 'ce' for + configurable and enumerable. If no configuration string is provided then by + default it returns configurable and writable but not enumerable for value or + configurable but not enumerable for getter/setter +* Function.prototype.silent now returns prepared function (it was + expected to be fixed for 0.7) +* Reserved keywords map (reserved) is now array not hash. +* Object.merge is now Object.extend (while former Object.extend was completely + removed) - 'extend' implies that we change object, not creating new one (as + 'merge' may imply). Similarily Object.mergeProperties was renamed to + Object.extendProperties +* Position argument support in Array.prototype.contains and + String.prototype.contains (so it follows ES6 specification draft) +* endPosition argument support in String.prototype.endsWith and fromPosition + argument support in String.prototype.startsWith (so it follows ES6 + specification draft) +* Better and cleaner String.prototype.indent implementation. No default value + for indent string argument, optional nest value (defaults to 1), remove + nostart argument +* Correct length values for most methods (so they reflect length of similar + methods in standard) +* Length argument is now optional in number and string pad methods. +* Improve arguments validation in general, so it adheres to standard conventions +* Fixed format of package.json + +Removed methods and functions: +* Object.prototype.slice - Object is not ordered collection, so slice doesn't + make sense. +* Function's rcurry, rncurry, s - too cumbersome for JS, not many use cases for + that +* Function.prototype.aritize and Function.prototype.hold - same functionality + can be achieved with new Function.prototype.curry +* Function.prototype.log - provided more generic Function.prototype.wrap for + same use case +* getNextIdGenerator - no use case for that (String.guid should be used if + needed) +* Object.toObject - Can be now acheived with Object(validValue(x)) +* Array.prototype.someValue - no real use case (personally used once and + case was already controversial) +* Date.prototype.duration - moved to external package +* Number.getAutoincrement - No real use case +* Object.prototype.extend, Object.prototype.override, + Object.prototype.plainCreate, Object.prototype.plainExtend - It was probably + too complex, same should be achieved just with Object.create, + Object.descriptor and by saving references to super methods in local scope. +* Object.getCompareBy - Functions should be created individually for each use + case +* Object.get, Object.getSet, Object.set, Object.unset - Not many use cases and + same can be easily achieved with simple inline function +* String.getPrefixWith - Not real use case for something that can be easily + achieved with '+' operator +* Object.isPrimitive - It's just negation of Object.isObject +* Number.prototype.isLess, Number.prototype.isLessOrEqual - they shouldn't be in + Number namespace and should rather be addressed with simple inline functions. +* Number.prototype.subtract - Should rather be addressed with simple inline + function + +New methods and functions: +* Array.prototype.lastIndex - Returns last declared index in array +* String.prototype.last - last for strings +* Function.prototype.wrap - Wrap function with other, it allows to specify + before and after behavior transform return value or prevent original function + from being called. +* Math.sign - Returns sign of a number (already in ES6 specification draft) +* Number.toInt - Converts value to integer (already in ES6 specification draft) +* Number.isNaN - Returns true if value is NaN (already in ES6 specification + draft) +* Number.toUint - Converts value to unsigned integer +* Number.toUint32 - Converts value to 32bit unsigned integer +* Array.prototype.eIndexOf, eLastIndexOf - Egal version (that uses Object.is) of + standard methods (all methods that were using native indexOf or lastIndexOf + now uses eIndexOf and elastIndexOf respectively) +* Array.of - as it's specified for ES6 + +Fixes: +* Fixed binarySearch so it always returns valid list index +* Object.isList - it failed on lists that are callable (e.g. NodeList in Nitro + engine) +* Object.map now supports third argument for callback + +v0.7.1 -- 2012.01.05 +New methods: +* Array.prototype.firstIndex - returns first valid index of array (for + sparse arrays it may not be '0' + +Improvements: +* Array.prototype.first - now returns value for index returned by firstIndex +* Object.prototype.mapToArray - can be called without callback, then array of + key-value pairs is returned + +Fixes +* Array.prototype.forEachRight, object's length read through UInt32 conversion + +v0.7.0 -- 2011.12.27 +Major update. +Stepped back from experimental ideas and introduced more standard approach +taking example from how ES5 methods and functions are designed. One exceptions +is that, we don’t refrain from declaring methods for Object.prototype - it’s up +to developer whether how he decides to use it in his context (as function or as +method). + +In general: +* Removed any method 'functionalization' and functionalize method itself. + es5-ext declares plain methods, which can be configured to work as functions + with call.bind(method) - see documentation. +* Removed separation of Object methods for ES5 (with descriptors) and + ES3 (plain) - we're following ES5 idea on that, some methods are intended just + for enumerable properties and some are for all properties, all are declared + for Object.prototype +* Removed separation of Array generic (collected in List folder) and not generic + methods (collected in Array folder). Now all methods are generic and are in + Array/prototype folder. This separation also meant, that methods in Array are + usually destructive. We don’t do that separation now, there’s generally no use + case for destructive iterators, we should be fine with one version of each + method, (same as ES5 is fine with e.g. one, non destructive 'filter' method) +* Folder structure resembles tree of native ES5 Objects +* All methods are written with ES5 conventions in mind, it means that most + methods are generic and can be run on any object. In more detail: + ** Array.prototype and Object.prototype methods can be run on any object (any + not null or undefined value), + ** Date.prototype methods should be called only on Date instances. + ** Function.prototype methods can be called on any callable objects (not + necessarily functions) + ** Number.prototype & String.prototype methods can be called on any value, in + case of Number it it’ll be degraded to number, in case of string it’ll be + degraded to string. +* Travis CI support (only for Node v0.6 branch, as v0.4 has buggy V8 version) + +Improvements for existing functions and methods: +* Function.memoize (was Function.cache) is now fully generic, can operate on any + type of arguments and it’s NaN safe (all NaN objects are considered equal) +* Method properties passed to Object.prototype.extend or + Object.prototype.override can aside of _super optionally take prototype object + via _proto argument +* Object iterators: forEach, mapToArray and every can now iterate in specified + order +* pluck, invoke and other functions that return reusable functions or methods + have now their results memoized. + +New methods: +* Global: assertNotNull, getNextIdGenerator, guid, isEqual, isPrimitive, + toObject +* Array: generate +* Array.prototype: binarySearch, clear, contains, diff, exclusion, find, first, + forEachRight, group, indexesOf, intersection, remove, someRight, someValue +* Boolean: isBoolean +* Date: isDate +* Function: arguments, context, insert, isArguments, remove +* Function.prototype: not, silent +* Number: getAutoincrement, isNumber +* Number.prototype: isLessOrEqual, isLess, subtract +* Object: assertCallable, descriptor (functions for clean descriptors), + getCompareBy, isCallable, isObject +* Object.prototype: clone (real clone), compact, count, diff, empty, + getPropertyNames, get, keyOf, mapKeys, override, plainCreate, plainExtend, + slice, some, unset +* RegExp: isRegExp +* String: getPrefixWith, isString +* String.prototype: caseInsensitiveCompare, contains, isNumeric + +Renamed methods: +* Date.clone -> Date.prototype.copy +* Date.format -> Date.getFormat +* Date/day/floor -> Date.prototype.floorDay +* Date/month/floor -> Date.prototype.floorMonth +* Date/month/year -> Date.prototype.floorYear +* Function.cache -> Function.memoize +* Function.getApplyArg -> Function.prototype.match +* Function.sequence -> Function.prototype.chain +* List.findSameStartLength -> Array.prototype.commonLeft +* Number.pad -> Number.getPad +* Object/plain/clone -> Object.prototype.copy +* Object/plain/elevate -> Object.prototype.flatten +* Object/plain/same -> Object.prototype.isDuplicate +* Object/plain/setValue -> Object.getSet +* String.format -> String.getFormat +* String.indent -> String.getIndent +* String.pad -> String.getPad +* String.trimLeftStr -> String.prototype.trimCommonLeft +* Object.merge -> Object.prototype.mergeProperties +* Object/plain/pluck -> Object.prototype.get +* Array.clone is now Array.prototype.copy and can be used also on any array-like + objects +* List.isList -> Object.isList +* List.toArray -> Object.prototype.toArray +* String/convert/dashToCamelCase -> String.prototype.dashToCamelCase + +Removed methods: +* Array.compact - removed destructive version (that operated on same array), we + have now non destructive version as Array.prototype.compact. +* Function.applyBind -> use apply.bind directly +* Function.bindBind -> use bind.bind directly +* Function.callBind -> use call.bind directly +* Fuction.clone -> no valid use case +* Function.dscope -> controversial approach, shouldn’t be considered seriously +* Function.functionalize -> It was experimental but standards are standards +* List/sort/length -> It can be easy obtained by Object.getCompareBy(‘length’) +* List.concat -> Concat’s for array-like’s makes no sense, just convert to array + first +* List.every -> Use Array.prototype.every directly +* List.filter -> Use Array.prototype.filter directly +* List.forEach -> User Array.prototype.forEach directly +* List.isListObject -> No valid use case, do: isList(list) && (typeof list === + 'object’) +* List.map -> Use Array.prototype.map directly +* List.reduce -> Use Array.prototype.reduce directly +* List.shiftSame -> Use Array.prototype.commonLeft and do slice +* List.slice -> Use Array.prototype.slice directly +* List.some -> Use Array.prototype.some directly +* Object.bindMethods -> it was version that considered descriptors, we have now + Object.prototype.bindMethods which operates only on enumerable properties +* Object.every -> version that considered all properties, we have now + Object.prototype.every which iterates only enumerables +* Object.invoke -> no use case +* Object.mergeDeep -> no use case +* Object.pluck -> no use case +* Object.same -> it considered descriptors, now there’s only Object.isDuplicate + which compares only enumerable properties +* Object.sameType -> no use case +* Object.toDescriptor and Object.toDescriptors -> replaced by much nicer + Object.descriptor functions +* Object/plain/link -> no use case (it was used internally only by + Object/plain/merge) +* Object/plain/setTrue -> now easily configurable by more universal + Object.getSet(true) +* String.trimRightStr -> Eventually String.prototype.trimCommonRight will be + added + +v0.6.3 -- 2011.12.12 +* Cleared npm warning for misnamed property in package.json + +v0.6.2 -- 2011.08.12 +* Calling String.indent without scope (global scope then) now treated as calling + it with null scope, it allows more direct invocations when using default nest + string: indent().call(str, nest) + +v0.6.1 -- 2011.08.08 +* Added TAD test suite to devDependencies, configured test commands. + Tests can be run with 'make test' or 'npm test' + +v0.6.0 -- 2011.08.07 +New methods: +* Array: clone, compact (in place) +* Date: format, duration, clone, monthDaysCount, day.floor, month.floor, + year.floor +* Function: getApplyArg, , ncurry, rncurry, hold, cache, log +* List: findSameStartLength, shiftSame, peek, isListObject +* Number: pad +* Object: sameType, toString, mapToArray, mergeDeep, toDescriptor, + toDescriptors, invoke +* String: startsWith, endsWith, indent, trimLeftStr, trimRightStr, pad, format + +Fixed: +* Object.extend does now prototypal extend as exptected +* Object.merge now tries to overwrite only configurable properties +* Function.flip + +Improved: +* Faster List.toArray +* Better global retrieval +* Functionalized all Function methods +* Renamed bindApply and bindCall to applyBind and callBind +* Removed Function.inherit (as it's unintuitive curry clone) +* Straightforward logic in Function.k +* Fixed naming of some tests files (letter case issue) +* Renamed Function.saturate into Function.lock +* String.dashToCamelCase digits support +* Strings now considered as List objects +* Improved List.compact +* Concise logic for List.concat +* Test wit TAD in clean ES5 context + +v0.5.1 -- 2011.07.11 +* Function's bindBind, bindCall and bindApply now more versatile + +v0.5.0 -- 2011.07.07 +* Removed Object.is and List.apply +* Renamed Object.plain.is to Object.plain.isPlainObject (keep naming convention + consistent) +* Improved documentation + +v0.4.0 -- 2011.07.05 +* Take most functions on Object to Object.plain to keep them away from object + descriptors +* Object functions with ES5 standard in mind (object descriptors) + +v0.3.0 -- 2011.06.24 +* New functions +* Consistent file naming (dash instead of camelCase) + +v0.2.1 -- 2011.05.28 +* Renamed Functions.K and Function.S to to lowercase versions (use consistent + naming) + +v0.2.0 -- 2011.05.28 +* Renamed Array folder to List (as its generic functions for array-like objects) +* Added Makefile +* Added various functions + +v0.1.0 -- 2011.05.24 +* Initial version diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/LICENSE new file mode 100644 index 00000000..de39071f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2011-2015 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/README.md new file mode 100644 index 00000000..11d8a343 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/README.md @@ -0,0 +1,993 @@ +# es5-ext +## ECMAScript 5 extensions +### (with respect to ECMAScript 6 standard) + +Shims for upcoming ES6 standard and other goodies implemented strictly with ECMAScript conventions in mind. + +It's designed to be used in compliant ECMAScript 5 or ECMAScript 6 environments. Older environments are not supported, although most of the features should work with correct ECMAScript 5 shim on board. + +When used in ECMAScript 6 environment, native implementation (if valid) takes precedence over shims. + +### Installation + + $ npm install es5-ext + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +### Usage + +#### ECMAScript 6 features + +You can force ES6 features to be implemented in your environment, e.g. following will assign `from` function to `Array` (only if it's not implemented already). + +```javascript +require('es5-ext/array/from/implement'); +Array.from('foo'); // ['f', 'o', 'o'] +``` + +You can also access shims directly, without fixing native objects. Following will return native `Array.from` if it's available and fallback to shim if it's not. + +```javascript +var aFrom = require('es5-ext/array/from'); +aFrom('foo'); // ['f', 'o', 'o'] +``` + +If you want to use shim unconditionally (even if native implementation exists) do: + +```javascript +var aFrom = require('es5-ext/array/from/shim'); +aFrom('foo'); // ['f', 'o', 'o'] +``` + +##### List of ES6 shims + +It's about properties introduced with ES6 and those that have been updated in new spec. + +- `Array.from` -> `require('es5-ext/array/from')` +- `Array.of` -> `require('es5-ext/array/of')` +- `Array.prototype.concat` -> `require('es5-ext/array/#/concat')` +- `Array.prototype.copyWithin` -> `require('es5-ext/array/#/copy-within')` +- `Array.prototype.entries` -> `require('es5-ext/array/#/entries')` +- `Array.prototype.fill` -> `require('es5-ext/array/#/fill')` +- `Array.prototype.filter` -> `require('es5-ext/array/#/filter')` +- `Array.prototype.find` -> `require('es5-ext/array/#/find')` +- `Array.prototype.findIndex` -> `require('es5-ext/array/#/find-index')` +- `Array.prototype.keys` -> `require('es5-ext/array/#/keys')` +- `Array.prototype.map` -> `require('es5-ext/array/#/map')` +- `Array.prototype.slice` -> `require('es5-ext/array/#/slice')` +- `Array.prototype.splice` -> `require('es5-ext/array/#/splice')` +- `Array.prototype.values` -> `require('es5-ext/array/#/values')` +- `Array.prototype[@@iterator]` -> `require('es5-ext/array/#/@@iterator')` +- `Math.acosh` -> `require('es5-ext/math/acosh')` +- `Math.asinh` -> `require('es5-ext/math/asinh')` +- `Math.atanh` -> `require('es5-ext/math/atanh')` +- `Math.cbrt` -> `require('es5-ext/math/cbrt')` +- `Math.clz32` -> `require('es5-ext/math/clz32')` +- `Math.cosh` -> `require('es5-ext/math/cosh')` +- `Math.exmp1` -> `require('es5-ext/math/expm1')` +- `Math.fround` -> `require('es5-ext/math/fround')` +- `Math.hypot` -> `require('es5-ext/math/hypot')` +- `Math.imul` -> `require('es5-ext/math/imul')` +- `Math.log1p` -> `require('es5-ext/math/log1p')` +- `Math.log2` -> `require('es5-ext/math/log2')` +- `Math.log10` -> `require('es5-ext/math/log10')` +- `Math.sign` -> `require('es5-ext/math/sign')` +- `Math.signh` -> `require('es5-ext/math/signh')` +- `Math.tanh` -> `require('es5-ext/math/tanh')` +- `Math.trunc` -> `require('es5-ext/math/trunc')` +- `Number.EPSILON` -> `require('es5-ext/number/epsilon')` +- `Number.MAX_SAFE_INTEGER` -> `require('es5-ext/number/max-safe-integer')` +- `Number.MIN_SAFE_INTEGER` -> `require('es5-ext/number/min-safe-integer')` +- `Number.isFinite` -> `require('es5-ext/number/is-finite')` +- `Number.isInteger` -> `require('es5-ext/number/is-integer')` +- `Number.isNaN` -> `require('es5-ext/number/is-nan')` +- `Number.isSafeInteger` -> `require('es5-ext/number/is-safe-integer')` +- `Object.assign` -> `require('es5-ext/object/assign')` +- `Object.keys` -> `require('es5-ext/object/keys')` +- `Object.setPrototypeOf` -> `require('es5-ext/object/set-prototype-of')` +- `RegExp.prototype.match` -> `require('es5-ext/reg-exp/#/match')` +- `RegExp.prototype.replace` -> `require('es5-ext/reg-exp/#/replace')` +- `RegExp.prototype.search` -> `require('es5-ext/reg-exp/#/search')` +- `RegExp.prototype.split` -> `require('es5-ext/reg-exp/#/split')` +- `RegExp.prototype.sticky` -> Implement with `require('es5-ext/reg-exp/#/sticky/implement')`, use as function with `require('es5-ext/reg-exp/#/is-sticky')` +- `RegExp.prototype.unicode` -> Implement with `require('es5-ext/reg-exp/#/unicode/implement')`, use as function with `require('es5-ext/reg-exp/#/is-unicode')` +- `String.fromCodePoint` -> `require('es5-ext/string/from-code-point')` +- `String.raw` -> `require('es5-ext/string/raw')` +- `String.prototype.codePointAt` -> `require('es5-ext/string/#/code-point-at')` +- `String.prototype.contains` -> `require('es5-ext/string/#/contains')` +- `String.prototype.endsWith` -> `require('es5-ext/string/#/ends-with')` +- `String.prototype.normalize` -> `require('es5-ext/string/#/normalize')` +- `String.prototype.repeat` -> `require('es5-ext/string/#/repeat')` +- `String.prototype.startsWith` -> `require('es5-ext/string/#/starts-with')` +- `String.prototype[@@iterator]` -> `require('es5-ext/string/#/@@iterator')` + +#### Non ECMAScript standard features + +__es5-ext__ provides also other utils, and implements them as if they were proposed for a standard. It mostly offers methods (not functions) which can directly be assigned to native prototypes: + +```javascript +Object.defineProperty(Function.prototype, 'partial', { value: require('es5-ext/function/#/partial'), + configurable: true, enumerable: false, writable: true }); +Object.defineProperty(Array.prototype, 'flatten', { value: require('es5-ext/array/#/flatten'), + configurable: true, enumerable: false, writable: true }); +Object.defineProperty(String.prototype, 'capitalize', { value: require('es5-ext/string/#/capitalize'), + configurable: true, enumerable: false, writable: true }); +``` + +See [es5-extend](https://github.com/wookieb/es5-extend#es5-extend), a great utility that automatically will extend natives for you. + +__Important:__ Remember to __not__ extend natives in scope of generic reusable packages (e.g. ones you intend to publish to npm). Extending natives is fine __only__ if you're the _owner_ of the global scope, so e.g. in final project you lead development of. + +When you're in situation when native extensions are not good idea, then you should use methods indirectly: + + +```javascript +var flatten = require('es5-ext/array/#/flatten'); + +flatten.call([1, [2, [3, 4]]]); // [1, 2, 3, 4] +``` + +for better convenience you can turn methods into functions: + + +```javascript +var call = Function.prototype.call +var flatten = call.bind(require('es5-ext/array/#/flatten')); + +flatten([1, [2, [3, 4]]]); // [1, 2, 3, 4] +``` + +You can configure custom toolkit (like [underscorejs](http://underscorejs.org/)), and use it throughout your application + +```javascript +var util = {}; +util.partial = call.bind(require('es5-ext/function/#/partial')); +util.flatten = call.bind(require('es5-ext/array/#/flatten')); +util.startsWith = call.bind(require('es5-ext/string/#/starts-with')); + +util.flatten([1, [2, [3, 4]]]); // [1, 2, 3, 4] +``` + +As with native ones most methods are generic and can be run on any type of object. + +## API + +### Global extensions + +#### global _(es5-ext/global)_ + +Object that represents global scope + +### Array Constructor extensions + +#### from(arrayLike[, mapFn[, thisArg]]) _(es5-ext/array/from)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from). +Returns array representation of _iterable_ or _arrayLike_. If _arrayLike_ is an instance of array, its copy is returned. + +#### generate([length[, …fill]]) _(es5-ext/array/generate)_ + +Generate an array of pre-given _length_ built of repeated arguments. + +#### isPlainArray(x) _(es5-ext/array/is-plain-array)_ + +Returns true if object is plain array (not instance of one of the Array's extensions). + +#### of([…items]) _(es5-ext/array/of)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.of). +Create an array from given arguments. + +#### toArray(obj) _(es5-ext/array/to-array)_ + +Returns array representation of `obj`. If `obj` is already an array, `obj` is returned back. + +#### validArray(obj) _(es5-ext/array/valid-array)_ + +Returns `obj` if it's an array, otherwise throws `TypeError` + +### Array Prototype extensions + +#### arr.binarySearch(compareFn) _(es5-ext/array/#/binary-search)_ + +In __sorted__ list search for index of item for which _compareFn_ returns value closest to _0_. +It's variant of binary search algorithm + +#### arr.clear() _(es5-ext/array/#/clear)_ + +Clears the array + +#### arr.compact() _(es5-ext/array/#/compact)_ + +Returns a copy of the context with all non-values (`null` or `undefined`) removed. + +#### arr.concat() _(es5-ext/array/#/concat)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.concat). +ES6's version of `concat`. Supports `isConcatSpreadable` symbol, and returns array of same type as the context. + +#### arr.contains(searchElement[, position]) _(es5-ext/array/#/contains)_ + +Whether list contains the given value. + +#### arr.copyWithin(target, start[, end]) _(es5-ext/array/#/copy-within)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.copywithin). + +#### arr.diff(other) _(es5-ext/array/#/diff)_ + +Returns the array of elements that are present in context list but not present in other list. + +#### arr.eIndexOf(searchElement[, fromIndex]) _(es5-ext/array/#/e-index-of)_ + +_egal_ version of `indexOf` method. [_SameValueZero_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) logic is used for comparision + +#### arr.eLastIndexOf(searchElement[, fromIndex]) _(es5-ext/array/#/e-last-index-of)_ + +_egal_ version of `lastIndexOf` method. [_SameValueZero_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) logic is used for comparision + +#### arr.entries() _(es5-ext/array/#/entries)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.entries). +Returns iterator object, which traverses the array. Each value is represented with an array, where first value is an index and second is corresponding to index value. + +#### arr.exclusion([…lists]]) _(es5-ext/array/#/exclusion)_ + +Returns the array of elements that are found only in one of the lists (either context list or list provided in arguments). + +#### arr.fill(value[, start, end]) _(es5-ext/array/#/fill)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.fill). + +#### arr.filter(callback[, thisArg]) _(es5-ext/array/#/filter)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.filter). +ES6's version of `filter`, returns array of same type as the context. + +#### arr.find(predicate[, thisArg]) _(es5-ext/array/#/find)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.find). +Return first element for which given function returns true + +#### arr.findIndex(predicate[, thisArg]) _(es5-ext/array/#/find-index)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.findindex). +Return first index for which given function returns true + +#### arr.first() _(es5-ext/array/#/first)_ + +Returns value for first defined index + +#### arr.firstIndex() _(es5-ext/array/#/first-index)_ + +Returns first declared index of the array + +#### arr.flatten() _(es5-ext/array/#/flatten)_ + +Returns flattened version of the array + +#### arr.forEachRight(cb[, thisArg]) _(es5-ext/array/#/for-each-right)_ + +`forEach` starting from last element + +#### arr.group(cb[, thisArg]) _(es5-ext/array/#/group)_ + +Group list elements by value returned by _cb_ function + +#### arr.indexesOf(searchElement[, fromIndex]) _(es5-ext/array/#/indexes-of)_ + +Returns array of all indexes of given value + +#### arr.intersection([…lists]) _(es5-ext/array/#/intersection)_ + +Computes the array of values that are the intersection of all lists (context list and lists given in arguments) + +#### arr.isCopy(other) _(es5-ext/array/#/is-copy)_ + +Returns true if both context and _other_ lists have same content + +#### arr.isUniq() _(es5-ext/array/#/is-uniq)_ + +Returns true if all values in array are unique + +#### arr.keys() _(es5-ext/array/#/keys)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.keys). +Returns iterator object, which traverses all array indexes. + +#### arr.last() _(es5-ext/array/#/last)_ + +Returns value of last defined index + +#### arr.lastIndex() _(es5-ext/array/#/last)_ + +Returns last defined index of the array + +#### arr.map(callback[, thisArg]) _(es5-ext/array/#/map)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.map). +ES6's version of `map`, returns array of same type as the context. + +#### arr.remove(value[, …valuen]) _(es5-ext/array/#/remove)_ + +Remove values from the array + +#### arr.separate(sep) _(es5-ext/array/#/separate)_ + +Returns array with items separated with `sep` value + +#### arr.slice(callback[, thisArg]) _(es5-ext/array/#/slice)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.slice). +ES6's version of `slice`, returns array of same type as the context. + +#### arr.someRight(cb[, thisArg]) _(es5-ext/array/#/someRight)_ + +`some` starting from last element + +#### arr.splice(callback[, thisArg]) _(es5-ext/array/#/splice)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.splice). +ES6's version of `splice`, returns array of same type as the context. + +#### arr.uniq() _(es5-ext/array/#/uniq)_ + +Returns duplicate-free version of the array + +#### arr.values() _(es5-ext/array/#/values)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.values). +Returns iterator object which traverses all array values. + +#### arr[@@iterator] _(es5-ext/array/#/@@iterator)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype-@@iterator). +Returns iterator object which traverses all array values. + +### Boolean Constructor extensions + +#### isBoolean(x) _(es5-ext/boolean/is-boolean)_ + +Whether value is boolean + +### Date Constructor extensions + +#### isDate(x) _(es5-ext/date/is-date)_ + +Whether value is date instance + +#### validDate(x) _(es5-ext/date/valid-date)_ + +If given object is not date throw TypeError in other case return it. + +### Date Prototype extensions + +#### date.copy(date) _(es5-ext/date/#/copy)_ + +Returns a copy of the date object + +#### date.daysInMonth() _(es5-ext/date/#/days-in-month)_ + +Returns number of days of date's month + +#### date.floorDay() _(es5-ext/date/#/floor-day)_ + +Sets the date time to 00:00:00.000 + +#### date.floorMonth() _(es5-ext/date/#/floor-month)_ + +Sets date day to 1 and date time to 00:00:00.000 + +#### date.floorYear() _(es5-ext/date/#/floor-year)_ + +Sets date month to 0, day to 1 and date time to 00:00:00.000 + +#### date.format(pattern) _(es5-ext/date/#/format)_ + +Formats date up to given string. Supported patterns: + +* `%Y` - Year with century, 1999, 2003 +* `%y` - Year without century, 99, 03 +* `%m` - Month, 01..12 +* `%d` - Day of the month 01..31 +* `%H` - Hour (24-hour clock), 00..23 +* `%M` - Minute, 00..59 +* `%S` - Second, 00..59 +* `%L` - Milliseconds, 000..999 + +### Error Constructor extensions + +#### custom(message/*, code, ext*/) _(es5-ext/error/custom)_ + +Creates custom error object, optinally extended with `code` and other extension properties (provided with `ext` object) + +#### isError(x) _(es5-ext/error/is-error)_ + +Whether value is an error (instance of `Error`). + +#### validError(x) _(es5-ext/error/valid-error)_ + +If given object is not error throw TypeError in other case return it. + +### Error Prototype extensions + +#### err.throw() _(es5-ext/error/#/throw)_ + +Throws error + +### Function Constructor extensions + +Some of the functions were inspired by [Functional JavaScript](http://osteele.com/sources/javascript/functional/) project by Olivier Steele + +#### constant(x) _(es5-ext/function/constant)_ + +Returns a constant function that returns pregiven argument + +_k(x)(y) =def x_ + +#### identity(x) _(es5-ext/function/identity)_ + +Identity function. Returns first argument + +_i(x) =def x_ + +#### invoke(name[, …args]) _(es5-ext/function/invoke)_ + +Returns a function that takes an object as an argument, and applies object's +_name_ method to arguments. +_name_ can be name of the method or method itself. + +_invoke(name, …args)(object, …args2) =def object\[name\]\(…args, …args2\)_ + +#### isArguments(x) _(es5-ext/function/is-arguments)_ + +Whether value is arguments object + +#### isFunction(arg) _(es5-ext/function/is-function)_ + +Wether value is instance of function + +#### noop() _(es5-ext/function/noop)_ + +No operation function + +#### pluck(name) _(es5-ext/function/pluck)_ + +Returns a function that takes an object, and returns the value of its _name_ +property + +_pluck(name)(obj) =def obj[name]_ + +#### validFunction(arg) _(es5-ext/function/valid-function)_ + +If given object is not function throw TypeError in other case return it. + +### Function Prototype extensions + +Some of the methods were inspired by [Functional JavaScript](http://osteele.com/sources/javascript/functional/) project by Olivier Steele + +#### fn.compose([…fns]) _(es5-ext/function/#/compose)_ + +Applies the functions in reverse argument-list order. + +_f1.compose(f2, f3, f4)(…args) =def f1(f2(f3(f4(…arg))))_ + +#### fn.copy() _(es5-ext/function/#/copy)_ + +Produces copy of given function + +#### fn.curry([n]) _(es5-ext/function/#/curry)_ + +Invoking the function returned by this function only _n_ arguments are passed to the underlying function. If the underlying function is not saturated, the result is a function that passes all its arguments to the underlying function. +If _n_ is not provided then it defaults to context function length + +_f.curry(4)(arg1, arg2)(arg3)(arg4) =def f(arg1, args2, arg3, arg4)_ + +#### fn.lock([…args]) _(es5-ext/function/#/lock)_ + +Returns a function that applies the underlying function to _args_, and ignores its own arguments. + +_f.lock(…args)(…args2) =def f(…args)_ + +_Named after it's counterpart in Google Closure_ + +#### fn.not() _(es5-ext/function/#/not)_ + +Returns a function that returns boolean negation of value returned by underlying function. + +_f.not()(…args) =def !f(…args)_ + +#### fn.partial([…args]) _(es5-ext/function/#/partial)_ + +Returns a function that when called will behave like context function called with initially passed arguments. If more arguments are suplilied, they are appended to initial args. + +_f.partial(…args1)(…args2) =def f(…args1, …args2)_ + +#### fn.spread() _(es5-ext/function/#/spread)_ + +Returns a function that applies underlying function with first list argument + +_f.match()(args) =def f.apply(null, args)_ + +#### fn.toStringTokens() _(es5-ext/function/#/to-string-tokens)_ + +Serializes function into two (arguments and body) string tokens. Result is plain object with `args` and `body` properties. + +### Math extensions + +#### acosh(x) _(es5-ext/math/acosh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.acosh). + +#### asinh(x) _(es5-ext/math/asinh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.asinh). + +#### atanh(x) _(es5-ext/math/atanh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.atanh). + +#### cbrt(x) _(es5-ext/math/cbrt)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.cbrt). + +#### clz32(x) _(es5-ext/math/clz32)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.clz32). + +#### cosh(x) _(es5-ext/math/cosh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.cosh). + +#### expm1(x) _(es5-ext/math/expm1)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.expm1). + +#### fround(x) _(es5-ext/math/fround)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.fround). + +#### hypot([…values]) _(es5-ext/math/hypot)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.hypot). + +#### imul(x, y) _(es5-ext/math/imul)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.imul). + +#### log1p(x) _(es5-ext/math/log1p)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log1p). + +#### log2(x) _(es5-ext/math/log2)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log2). + +#### log10(x) _(es5-ext/math/log10)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log10). + +#### sign(x) _(es5-ext/math/sign)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sign). + +#### sinh(x) _(es5-ext/math/sinh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sinh). + +#### tanh(x) _(es5-ext/math/tanh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.tanh). + +#### trunc(x) _(es5-ext/math/trunc)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.trunc). + +### Number Constructor extensions + +#### EPSILON _(es5-ext/number/epsilon)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.epsilon). + +The difference between 1 and the smallest value greater than 1 that is representable as a Number value, which is approximately 2.2204460492503130808472633361816 x 10-16. + +#### isFinite(x) _(es5-ext/number/is-finite)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite). +Whether value is finite. Differs from global isNaN that it doesn't do type coercion. + +#### isInteger(x) _(es5-ext/number/is-integer)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isinteger). +Whether value is integer. + +#### isNaN(x) _(es5-ext/number/is-nan)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isnan). +Whether value is NaN. Differs from global isNaN that it doesn't do type coercion. + +#### isNumber(x) _(es5-ext/number/is-number)_ + +Whether given value is number + +#### isSafeInteger(x) _(es5-ext/number/is-safe-integer)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.issafeinteger). + +#### MAX_SAFE_INTEGER _(es5-ext/number/max-safe-integer)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.maxsafeinteger). +The value of Number.MAX_SAFE_INTEGER is 9007199254740991. + +#### MIN_SAFE_INTEGER _(es5-ext/number/min-safe-integer)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.minsafeinteger). +The value of Number.MIN_SAFE_INTEGER is -9007199254740991 (253-1). + +#### toInteger(x) _(es5-ext/number/to-integer)_ + +Converts value to integer + +#### toPosInteger(x) _(es5-ext/number/to-pos-integer)_ + +Converts value to positive integer. If provided value is less than 0, then 0 is returned + +#### toUint32(x) _(es5-ext/number/to-uint32)_ + +Converts value to unsigned 32 bit integer. This type is used for array lengths. +See: http://www.2ality.com/2012/02/js-integers.html + +### Number Prototype extensions + +#### num.pad(length[, precision]) _(es5-ext/number/#/pad)_ + +Pad given number with zeros. Returns string + +### Object Constructor extensions + +#### assign(target, source[, …sourcen]) _(es5-ext/object/assign)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). +Extend _target_ by enumerable own properties of other objects. If properties are already set on target object, they will be overwritten. + +#### clear(obj) _(es5-ext/object/clear)_ + +Remove all enumerable own properties of the object + +#### compact(obj) _(es5-ext/object/compact)_ + +Returns copy of the object with all enumerable properties that have no falsy values + +#### compare(obj1, obj2) _(es5-ext/object/compare)_ + +Universal cross-type compare function. To be used for e.g. array sort. + +#### copy(obj) _(es5-ext/object/copy)_ + +Returns copy of the object with all enumerable properties. + +#### copyDeep(obj) _(es5-ext/object/copy-deep)_ + +Returns deep copy of the object with all enumerable properties. + +#### count(obj) _(es5-ext/object/count)_ + +Counts number of enumerable own properties on object + +#### create(obj[, properties]) _(es5-ext/object/create)_ + +`Object.create` alternative that provides workaround for [V8 issue](http://code.google.com/p/v8/issues/detail?id=2804). + +When `null` is provided as a prototype, it's substituted with specially prepared object that derives from Object.prototype but has all Object.prototype properties shadowed with undefined. + +It's quirky solution that allows us to have plain objects with no truthy properties but with turnable prototype. + +Use only for objects that you plan to switch prototypes of and be aware of limitations of this workaround. + +#### eq(x, y) _(es5-ext/object/eq)_ + +Whether two values are equal, using [_SameValueZero_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) algorithm. + +#### every(obj, cb[, thisArg[, compareFn]]) _(es5-ext/object/every)_ + +Analogous to Array.prototype.every. Returns true if every key-value pair in this object satisfies the provided testing function. +Optionally _compareFn_ can be provided which assures that keys are tested in given order. If provided _compareFn_ is equal to `true`, then order is alphabetical (by key). + +#### filter(obj, cb[, thisArg]) _(es5-ext/object/filter)_ + +Analogous to Array.prototype.filter. Returns new object with properites for which _cb_ function returned truthy value. + +#### firstKey(obj) _(es5-ext/object/first-key)_ + +Returns first enumerable key of the object, as keys are unordered by specification, it can be any key of an object. + +#### flatten(obj) _(es5-ext/object/flatten)_ + +Returns new object, with flatten properties of input object + +_flatten({ a: { b: 1 }, c: { d: 1 } }) =def { b: 1, d: 1 }_ + +#### forEach(obj, cb[, thisArg[, compareFn]]) _(es5-ext/object/for-each)_ + +Analogous to Array.prototype.forEach. Calls a function for each key-value pair found in object +Optionally _compareFn_ can be provided which assures that properties are iterated in given order. If provided _compareFn_ is equal to `true`, then order is alphabetical (by key). + +#### getPropertyNames() _(es5-ext/object/get-property-names)_ + +Get all (not just own) property names of the object + +#### is(x, y) _(es5-ext/object/is)_ + +Whether two values are equal, using [_SameValue_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) algorithm. + +#### isArrayLike(x) _(es5-ext/object/is-array-like)_ + +Whether object is array-like object + +#### isCopy(x, y) _(es5-ext/object/is-copy)_ + +Two values are considered a copy of same value when all of their own enumerable properties have same values. + +#### isCopyDeep(x, y) _(es5-ext/object/is-copy-deep)_ + +Deep comparision of objects + +#### isEmpty(obj) _(es5-ext/object/is-empty)_ + +True if object doesn't have any own enumerable property + +#### isObject(arg) _(es5-ext/object/is-object)_ + +Whether value is not primitive + +#### isPlainObject(arg) _(es5-ext/object/is-plain-object)_ + +Whether object is plain object, its protototype should be Object.prototype and it cannot be host object. + +#### keyOf(obj, searchValue) _(es5-ext/object/key-of)_ + +Search object for value + +#### keys(obj) _(es5-ext/object/keys)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys). +ES6's version of `keys`, doesn't throw on primitive input + +#### map(obj, cb[, thisArg]) _(es5-ext/object/map)_ + +Analogous to Array.prototype.map. Creates a new object with properties which values are results of calling a provided function on every key-value pair in this object. + +#### mapKeys(obj, cb[, thisArg]) _(es5-ext/object/map-keys)_ + +Create new object with same values, but remapped keys + +#### mixin(target, source) _(es5-ext/object/mixin)_ + +Extend _target_ by all own properties of other objects. Properties found in both objects will be overwritten (unless they're not configurable and cannot be overwritten). +_It was for a moment part of ECMAScript 6 draft._ + +#### mixinPrototypes(target, …source]) _(es5-ext/object/mixin-prototypes)_ + +Extends _target_, with all source and source's prototype properties. +Useful as an alternative for `setPrototypeOf` in environments in which it cannot be shimmed (no `__proto__` support). + +#### normalizeOptions(options) _(es5-ext/object/normalize-options)_ + +Normalizes options object into flat plain object. + +Useful for functions in which we either need to keep options object for future reference or need to modify it for internal use. + +- It never returns input `options` object back (always a copy is created) +- `options` can be undefined in such case empty plain object is returned. +- Copies all enumerable properties found down prototype chain. + +#### primitiveSet([…names]) _(es5-ext/object/primitive-set)_ + +Creates `null` prototype based plain object, and sets on it all property names provided in arguments to true. + +#### safeTraverse(obj[, …names]) _(es5-ext/object/safe-traverse)_ + +Safe navigation of object properties. See http://wiki.ecmascript.org/doku.php?id=strawman:existential_operator + +#### serialize(value) _(es5-ext/object/serialize)_ + +Serialize value into string. Differs from [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) that it serializes also dates, functions and regular expresssions. + +#### setPrototypeOf(object, proto) _(es5-ext/object/set-prototype-of)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.setprototypeof). +If native version is not provided, it depends on existence of `__proto__` functionality, if it's missing, `null` instead of function is exposed. + +#### some(obj, cb[, thisArg[, compareFn]]) _(es5-ext/object/some)_ + +Analogous to Array.prototype.some Returns true if any key-value pair satisfies the provided +testing function. +Optionally _compareFn_ can be provided which assures that keys are tested in given order. If provided _compareFn_ is equal to `true`, then order is alphabetical (by key). + +#### toArray(obj[, cb[, thisArg[, compareFn]]]) _(es5-ext/object/to-array)_ + +Creates an array of results of calling a provided function on every key-value pair in this object. +Optionally _compareFn_ can be provided which assures that results are added in given order. If provided _compareFn_ is equal to `true`, then order is alphabetical (by key). + +#### unserialize(str) _(es5-ext/object/unserialize)_ + +Userializes value previously serialized with [serialize](#serializevalue-es5-extobjectserialize) + +#### validCallable(x) _(es5-ext/object/valid-callable)_ + +If given object is not callable throw TypeError in other case return it. + +#### validObject(x) _(es5-ext/object/valid-object)_ + +Throws error if given value is not an object, otherwise it is returned. + +#### validValue(x) _(es5-ext/object/valid-value)_ + +Throws error if given value is `null` or `undefined`, otherwise returns value. + +### RegExp Constructor extensions + +#### escape(str) _(es5-ext/reg-exp/escape)_ + +Escapes string to be used in regular expression + +#### isRegExp(x) _(es5-ext/reg-exp/is-reg-exp)_ + +Whether object is regular expression + +#### validRegExp(x) _(es5-ext/reg-exp/valid-reg-exp)_ + +If object is regular expression it is returned, otherwise TypeError is thrown. + +### RegExp Prototype extensions + +#### re.isSticky(x) _(es5-ext/reg-exp/#/is-sticky)_ + +Whether regular expression has `sticky` flag. + +It's to be used as counterpart to [regExp.sticky](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.sticky) if it's not implemented. + +#### re.isUnicode(x) _(es5-ext/reg-exp/#/is-unicode)_ + +Whether regular expression has `unicode` flag. + +It's to be used as counterpart to [regExp.unicode](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.unicode) if it's not implemented. + +#### re.match(string) _(es5-ext/reg-exp/#/match)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.match). + +#### re.replace(string, replaceValue) _(es5-ext/reg-exp/#/replace)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.replace). + +#### re.search(string) _(es5-ext/reg-exp/#/search)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.search). + +#### re.split(string) _(es5-ext/reg-exp/#/search)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.split). + +#### re.sticky _(es5-ext/reg-exp/#/sticky/implement)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.sticky). +It's a getter, so only `implement` and `is-implemented` modules are provided. + +#### re.unicode _(es5-ext/reg-exp/#/unicode/implement)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.unicode). +It's a getter, so only `implement` and `is-implemented` modules are provided. + +### String Constructor extensions + +#### formatMethod(fMap) _(es5-ext/string/format-method)_ + +Creates format method. It's used e.g. to create `Date.prototype.format` method + +#### fromCodePoint([…codePoints]) _(es5-ext/string/from-code-point)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.fromcodepoint) + +#### isString(x) _(es5-ext/string/is-string)_ + +Whether object is string + +#### randomUniq() _(es5-ext/string/random-uniq)_ + +Returns randomly generated id, with guarantee of local uniqueness (no same id will be returned twice) + +#### raw(callSite[, …substitutions]) _(es5-ext/string/raw)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.raw) + +### String Prototype extensions + +#### str.at(pos) _(es5-ext/string/#/at)_ + +_Proposed for ECMAScript 6/7 standard, but not (yet) in a draft_ + +Returns a string at given position in Unicode-safe manner. +Based on [implementation by Mathias Bynens](https://github.com/mathiasbynens/String.prototype.at). + +#### str.camelToHyphen() _(es5-ext/string/#/camel-to-hyphen)_ + +Convert camelCase string to hyphen separated, e.g. one-two-three -> oneTwoThree. +Useful when converting names from js property convention into filename convention. + +#### str.capitalize() _(es5-ext/string/#/capitalize)_ + +Capitalize first character of a string + +#### str.caseInsensitiveCompare(str) _(es5-ext/string/#/case-insensitive-compare)_ + +Case insensitive compare + +#### str.codePointAt(pos) _(es5-ext/string/#/code-point-at)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.codepointat) + +Based on [implementation by Mathias Bynens](https://github.com/mathiasbynens/String.prototype.codePointAt). + +#### str.contains(searchString[, position]) _(es5-ext/string/#/contains)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.contains) + +Whether string contains given string. + +#### str.endsWith(searchString[, endPosition]) _(es5-ext/string/#/ends-with)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.endswith). +Whether strings ends with given string + +#### str.hyphenToCamel() _(es5-ext/string/#/hyphen-to-camel)_ + +Convert hyphen separated string to camelCase, e.g. one-two-three -> oneTwoThree. +Useful when converting names from filename convention to js property name convention. + +#### str.indent(str[, count]) _(es5-ext/string/#/indent)_ + +Indents each line with provided _str_ (if _count_ given then _str_ is repeated _count_ times). + +#### str.last() _(es5-ext/string/#/last)_ + +Return last character + +#### str.normalize([form]) _(es5-ext/string/#/normalize)_ + +[_Introduced with ECMAScript 6_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize). +Returns the Unicode Normalization Form of a given string. +Based on Matsuza's version. Code used for integrated shim can be found at [github.com/walling/unorm](https://github.com/walling/unorm/blob/master/lib/unorm.js) + +#### str.pad(fill[, length]) _(es5-ext/string/#/pad)_ + +Pad string with _fill_. +If _length_ si given than _fill_ is reapated _length_ times. +If _length_ is negative then pad is applied from right. + +#### str.repeat(n) _(es5-ext/string/#/repeat)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.repeat). +Repeat given string _n_ times + +#### str.plainReplace(search, replace) _(es5-ext/string/#/plain-replace)_ + +Simple `replace` version. Doesn't support regular expressions. Replaces just first occurrence of search string. Doesn't support insert patterns, therefore it is safe to replace text with text obtained programmatically (there's no need for additional _$_ characters escape in such case). + +#### str.plainReplaceAll(search, replace) _(es5-ext/string/#/plain-replace-all)_ + +Simple `replace` version. Doesn't support regular expressions. Replaces all occurrences of search string. Doesn't support insert patterns, therefore it is safe to replace text with text obtained programmatically (there's no need for additional _$_ characters escape in such case). + +#### str.startsWith(searchString[, position]) _(es5-ext/string/#/starts-with)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.startswith). +Whether strings starts with given string + +#### str[@@iterator] _(es5-ext/string/#/@@iterator)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype-@@iterator). +Returns iterator object which traverses all string characters (with respect to unicode symbols) + +### Tests [![Build Status](https://travis-ci.org/medikoo/es5-ext.png)](https://travis-ci.org/medikoo/es5-ext) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/implement.js new file mode 100644 index 00000000..0f714a1d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, require('es6-symbol').iterator, { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/index.js new file mode 100644 index 00000000..a6946265 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.prototype[require('es6-symbol').iterator] : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/is-implemented.js new file mode 100644 index 00000000..72eb1f8a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/is-implemented.js @@ -0,0 +1,16 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function () { + var arr = ['foo', 1], iterator, result; + if (typeof arr[iteratorSymbol] !== 'function') return false; + iterator = arr[iteratorSymbol](); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result) return false; + if (result.value !== 'foo') return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/shim.js new file mode 100644 index 00000000..ff295df9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/@@iterator/shim.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../values/shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/_compare-by-length.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/_compare-by-length.js new file mode 100644 index 00000000..d8343ce3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/_compare-by-length.js @@ -0,0 +1,9 @@ +// Used internally to sort array of lists by length + +'use strict'; + +var toPosInt = require('../../number/to-pos-integer'); + +module.exports = function (a, b) { + return toPosInt(a.length) - toPosInt(b.length); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/binary-search.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/binary-search.js new file mode 100644 index 00000000..8eb45675 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/binary-search.js @@ -0,0 +1,28 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , callable = require('../../object/valid-callable') + , value = require('../../object/valid-value') + + , floor = Math.floor; + +module.exports = function (compareFn) { + var length, low, high, middle; + + value(this); + callable(compareFn); + + length = toPosInt(this.length); + low = 0; + high = length - 1; + + while (low <= high) { + middle = floor((low + high) / 2); + if (compareFn(this[middle]) < 0) high = middle - 1; + else low = middle + 1; + } + + if (high < 0) return 0; + if (high >= length) return length - 1; + return high; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/clear.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/clear.js new file mode 100644 index 00000000..3587bdf9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/clear.js @@ -0,0 +1,12 @@ +// Inspired by Google Closure: +// http://closure-library.googlecode.com/svn/docs/ +// closure_goog_array_array.js.html#goog.array.clear + +'use strict'; + +var value = require('../../object/valid-value'); + +module.exports = function () { + value(this).length = 0; + return this; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/compact.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/compact.js new file mode 100644 index 00000000..d529d5a2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/compact.js @@ -0,0 +1,9 @@ +// Inspired by: http://documentcloud.github.com/underscore/#compact + +'use strict'; + +var filter = Array.prototype.filter; + +module.exports = function () { + return filter.call(this, function (val) { return val != null; }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/implement.js new file mode 100644 index 00000000..80c67cb4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'concat', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/index.js new file mode 100644 index 00000000..db205ea5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.concat : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/is-implemented.js new file mode 100644 index 00000000..cab8bc9e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +var SubArray = require('../../_sub-array-dummy-safe'); + +module.exports = function () { + return (new SubArray()).concat('foo') instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/shim.js new file mode 100644 index 00000000..8b28e4ae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/concat/shim.js @@ -0,0 +1,39 @@ +'use strict'; + +var isPlainArray = require('../../is-plain-array') + , toPosInt = require('../../../number/to-pos-integer') + , isObject = require('../../../object/is-object') + + , isArray = Array.isArray, concat = Array.prototype.concat + , forEach = Array.prototype.forEach + + , isSpreadable; + +isSpreadable = function (value) { + if (!value) return false; + if (!isObject(value)) return false; + if (value['@@isConcatSpreadable'] !== undefined) { + return Boolean(value['@@isConcatSpreadable']); + } + return isArray(value); +}; + +module.exports = function (item/*, …items*/) { + var result; + if (!this || !isArray(this) || isPlainArray(this)) { + return concat.apply(this, arguments); + } + result = new this.constructor(this.length); + forEach.call(this, function (val, i) { result[i] = val; }); + forEach.call(arguments, function (arg) { + var base; + if (isSpreadable(arg)) { + base = result.length; + result.length += toPosInt(arg.length); + forEach.call(arg, function (val, i) { result[base + i] = val; }); + return; + } + result.push(arg); + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/contains.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/contains.js new file mode 100644 index 00000000..4a2f9f67 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/contains.js @@ -0,0 +1,7 @@ +'use strict'; + +var indexOf = require('./e-index-of'); + +module.exports = function (searchElement/*, position*/) { + return indexOf.call(this, searchElement, arguments[1]) > -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/implement.js new file mode 100644 index 00000000..eedbad77 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'copyWithin', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/index.js new file mode 100644 index 00000000..bb89d0b8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.copyWithin : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/is-implemented.js new file mode 100644 index 00000000..8f17e06d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var arr = [1, 2, 3, 4, 5]; + if (typeof arr.copyWithin !== 'function') return false; + return String(arr.copyWithin(1, 3)) === '1,4,5,4,5'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/shim.js new file mode 100644 index 00000000..c0bfb8b0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/copy-within/shim.js @@ -0,0 +1,39 @@ +// Taken from: https://github.com/paulmillr/es6-shim/ + +'use strict'; + +var toInteger = require('../../../number/to-integer') + , toPosInt = require('../../../number/to-pos-integer') + , validValue = require('../../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty + , max = Math.max, min = Math.min; + +module.exports = function (target, start/*, end*/) { + var o = validValue(this), end = arguments[2], l = toPosInt(o.length) + , to, from, fin, count, direction; + + target = toInteger(target); + start = toInteger(start); + end = (end === undefined) ? l : toInteger(end); + + to = target < 0 ? max(l + target, 0) : min(target, l); + from = start < 0 ? max(l + start, 0) : min(start, l); + fin = end < 0 ? max(l + end, 0) : min(end, l); + count = min(fin - from, l - to); + direction = 1; + + if ((from < to) && (to < (from + count))) { + direction = -1; + from += count - 1; + to += count - 1; + } + while (count > 0) { + if (hasOwnProperty.call(o, from)) o[to] = o[from]; + else delete o[from]; + from += direction; + to += direction; + count -= 1; + } + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/diff.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/diff.js new file mode 100644 index 00000000..a1f95419 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/diff.js @@ -0,0 +1,13 @@ +'use strict'; + +var value = require('../../object/valid-value') + , contains = require('./contains') + + , filter = Array.prototype.filter; + +module.exports = function (other) { + (value(this) && value(other)); + return filter.call(this, function (item) { + return !contains.call(other, item); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/e-index-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/e-index-of.js new file mode 100644 index 00000000..80864d06 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/e-index-of.js @@ -0,0 +1,29 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , value = require('../../object/valid-value') + + , indexOf = Array.prototype.indexOf + , hasOwnProperty = Object.prototype.hasOwnProperty + , abs = Math.abs, floor = Math.floor; + +module.exports = function (searchElement/*, fromIndex*/) { + var i, l, fromIndex, val; + if (searchElement === searchElement) { //jslint: ignore + return indexOf.apply(this, arguments); + } + + l = toPosInt(value(this).length); + fromIndex = arguments[1]; + if (isNaN(fromIndex)) fromIndex = 0; + else if (fromIndex >= 0) fromIndex = floor(fromIndex); + else fromIndex = toPosInt(this.length) - floor(abs(fromIndex)); + + for (i = fromIndex; i < l; ++i) { + if (hasOwnProperty.call(this, i)) { + val = this[i]; + if (val !== val) return i; //jslint: ignore + } + } + return -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/e-last-index-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/e-last-index-of.js new file mode 100644 index 00000000..4fc536bd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/e-last-index-of.js @@ -0,0 +1,29 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , value = require('../../object/valid-value') + + , lastIndexOf = Array.prototype.lastIndexOf + , hasOwnProperty = Object.prototype.hasOwnProperty + , abs = Math.abs, floor = Math.floor; + +module.exports = function (searchElement/*, fromIndex*/) { + var i, fromIndex, val; + if (searchElement === searchElement) { //jslint: ignore + return lastIndexOf.apply(this, arguments); + } + + value(this); + fromIndex = arguments[1]; + if (isNaN(fromIndex)) fromIndex = (toPosInt(this.length) - 1); + else if (fromIndex >= 0) fromIndex = floor(fromIndex); + else fromIndex = toPosInt(this.length) - floor(abs(fromIndex)); + + for (i = fromIndex; i >= 0; --i) { + if (hasOwnProperty.call(this, i)) { + val = this[i]; + if (val !== val) return i; //jslint: ignore + } + } + return -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/implement.js new file mode 100644 index 00000000..490de60e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'entries', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/index.js new file mode 100644 index 00000000..292792cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.entries : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/is-implemented.js new file mode 100644 index 00000000..e186c172 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/is-implemented.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function () { + var arr = [1, 'foo'], iterator, result; + if (typeof arr.entries !== 'function') return false; + iterator = arr.entries(); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result || !result.value) return false; + if (result.value[0] !== 0) return false; + if (result.value[1] !== 1) return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/shim.js new file mode 100644 index 00000000..c052b53f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/entries/shim.js @@ -0,0 +1,4 @@ +'use strict'; + +var ArrayIterator = require('es6-iterator/array'); +module.exports = function () { return new ArrayIterator(this, 'key+value'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/exclusion.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/exclusion.js new file mode 100644 index 00000000..f08adc81 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/exclusion.js @@ -0,0 +1,27 @@ +'use strict'; + +var value = require('../../object/valid-value') + , aFrom = require('../from') + , toArray = require('../to-array') + , contains = require('./contains') + , byLength = require('./_compare-by-length') + + , filter = Array.prototype.filter, push = Array.prototype.push; + +module.exports = function (/*…lists*/) { + var lists, seen, result; + if (!arguments.length) return aFrom(this); + push.apply(lists = [this], arguments); + lists.forEach(value); + seen = []; + result = []; + lists.sort(byLength).forEach(function (list) { + result = result.filter(function (item) { + return !contains.call(list, item); + }).concat(filter.call(list, function (x) { + return !contains.call(seen, x); + })); + push.apply(seen, toArray(list)); + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/implement.js new file mode 100644 index 00000000..22511919 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'fill', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/index.js new file mode 100644 index 00000000..36c1f666 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.fill : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/is-implemented.js new file mode 100644 index 00000000..b8e54688 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var arr = [1, 2, 3, 4, 5, 6]; + if (typeof arr.fill !== 'function') return false; + return String(arr.fill(-1, -3)) === '1,2,3,-1,-1,-1'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/shim.js new file mode 100644 index 00000000..45823be5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/fill/shim.js @@ -0,0 +1,21 @@ +// Taken from: https://github.com/paulmillr/es6-shim/ + +'use strict'; + +var toInteger = require('../../../number/to-integer') + , toPosInt = require('../../../number/to-pos-integer') + , validValue = require('../../../object/valid-value') + + , max = Math.max, min = Math.min; + +module.exports = function (value/*, start, end*/) { + var o = validValue(this), start = arguments[1], end = arguments[2] + , l = toPosInt(o.length), relativeStart, i; + + start = (start === undefined) ? 0 : toInteger(start); + end = (end === undefined) ? l : toInteger(end); + + relativeStart = start < 0 ? max(l + start, 0) : min(start, l); + for (i = relativeStart; i < l && i < end; ++i) o[i] = value; + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/implement.js new file mode 100644 index 00000000..090c5f10 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'filter', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/index.js new file mode 100644 index 00000000..bcf0268d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.filter : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/is-implemented.js new file mode 100644 index 00000000..55772735 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +var SubArray = require('../../_sub-array-dummy-safe') + + , pass = function () { return true; }; + +module.exports = function () { + return (new SubArray()).filter(pass) instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/shim.js new file mode 100644 index 00000000..b0116def --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/filter/shim.js @@ -0,0 +1,22 @@ +'use strict'; + +var isPlainArray = require('../../is-plain-array') + , callable = require('../../../object/valid-callable') + + , isArray = Array.isArray, filter = Array.prototype.filter + , forEach = Array.prototype.forEach, call = Function.prototype.call; + +module.exports = function (callbackFn/*, thisArg*/) { + var result, thisArg, i; + if (!this || !isArray(this) || isPlainArray(this)) { + return filter.apply(this, arguments); + } + callable(callbackFn); + thisArg = arguments[1]; + result = new this.constructor(); + i = 0; + forEach.call(this, function (val, j, self) { + if (call.call(callbackFn, thisArg, val, j, self)) result[i++] = val; + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/implement.js new file mode 100644 index 00000000..556cb846 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'findIndex', + { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/index.js new file mode 100644 index 00000000..03a987e2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.findIndex : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/is-implemented.js new file mode 100644 index 00000000..dbd3c814 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +var fn = function (x) { return x > 3; }; + +module.exports = function () { + var arr = [1, 2, 3, 4, 5, 6]; + if (typeof arr.findIndex !== 'function') return false; + return arr.findIndex(fn) === 3; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/shim.js new file mode 100644 index 00000000..957939f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find-index/shim.js @@ -0,0 +1,20 @@ +'use strict'; + +var callable = require('../../../object/valid-callable') + , value = require('../../../object/valid-value') + + , some = Array.prototype.some, apply = Function.prototype.apply; + +module.exports = function (predicate/*, thisArg*/) { + var k, self; + self = Object(value(this)); + callable(predicate); + + return some.call(self, function (value, index) { + if (apply.call(predicate, this, arguments)) { + k = index; + return true; + } + return false; + }, arguments[1]) ? k : -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/implement.js new file mode 100644 index 00000000..0f37104a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'find', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/index.js new file mode 100644 index 00000000..96819d09 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.find : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/is-implemented.js new file mode 100644 index 00000000..cc7ec774 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +var fn = function (x) { return x > 3; }; + +module.exports = function () { + var arr = [1, 2, 3, 4, 5, 6]; + if (typeof arr.find !== 'function') return false; + return arr.find(fn) === 4; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/shim.js new file mode 100644 index 00000000..c7ee9069 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/find/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var findIndex = require('../find-index/shim'); + +module.exports = function (predicate/*, thisArg*/) { + var index = findIndex.apply(this, arguments); + return (index === -1) ? undefined : this[index]; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/first-index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/first-index.js new file mode 100644 index 00000000..7a9e4c34 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/first-index.js @@ -0,0 +1,16 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function () { + var i, l; + if (!(l = toPosInt(value(this).length))) return null; + i = 0; + while (!hasOwnProperty.call(this, i)) { + if (++i === l) return null; + } + return i; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/first.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/first.js new file mode 100644 index 00000000..11df5717 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/first.js @@ -0,0 +1,9 @@ +'use strict'; + +var firstIndex = require('./first-index'); + +module.exports = function () { + var i; + if ((i = firstIndex.call(this)) !== null) return this[i]; + return undefined; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/flatten.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/flatten.js new file mode 100644 index 00000000..c95407d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/flatten.js @@ -0,0 +1,12 @@ +'use strict'; + +var isArray = Array.isArray, forEach = Array.prototype.forEach + , push = Array.prototype.push; + +module.exports = function flatten() { + var r = []; + forEach.call(this, function (x) { + push.apply(r, isArray(x) ? flatten.call(x) : [x]); + }); + return r; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/for-each-right.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/for-each-right.js new file mode 100644 index 00000000..2f0ffaea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/for-each-right.js @@ -0,0 +1,20 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , callable = require('../../object/valid-callable') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty + , call = Function.prototype.call; + +module.exports = function (cb/*, thisArg*/) { + var i, self, thisArg; + + self = Object(value(this)); + callable(cb); + thisArg = arguments[1]; + + for (i = toPosInt(self.length); i >= 0; --i) { + if (hasOwnProperty.call(self, i)) call.call(cb, thisArg, self[i], i, self); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/group.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/group.js new file mode 100644 index 00000000..fbb178c3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/group.js @@ -0,0 +1,23 @@ +// Inspired by Underscore's groupBy: +// http://documentcloud.github.com/underscore/#groupBy + +'use strict'; + +var callable = require('../../object/valid-callable') + , value = require('../../object/valid-value') + + , forEach = Array.prototype.forEach, apply = Function.prototype.apply; + +module.exports = function (cb/*, thisArg*/) { + var r; + + (value(this) && callable(cb)); + + r = {}; + forEach.call(this, function (v) { + var key = apply.call(cb, this, arguments); + if (!r.hasOwnProperty(key)) r[key] = []; + r[key].push(v); + }, arguments[1]); + return r; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/index.js new file mode 100644 index 00000000..97ef65cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/index.js @@ -0,0 +1,40 @@ +'use strict'; + +module.exports = { + '@@iterator': require('./@@iterator'), + binarySearch: require('./binary-search'), + clear: require('./clear'), + compact: require('./compact'), + concat: require('./concat'), + contains: require('./contains'), + copyWithin: require('./copy-within'), + diff: require('./diff'), + eIndexOf: require('./e-index-of'), + eLastIndexOf: require('./e-last-index-of'), + entries: require('./entries'), + exclusion: require('./exclusion'), + fill: require('./fill'), + filter: require('./filter'), + find: require('./find'), + findIndex: require('./find-index'), + first: require('./first'), + firstIndex: require('./first-index'), + flatten: require('./flatten'), + forEachRight: require('./for-each-right'), + keys: require('./keys'), + group: require('./group'), + indexesOf: require('./indexes-of'), + intersection: require('./intersection'), + isCopy: require('./is-copy'), + isUniq: require('./is-uniq'), + last: require('./last'), + lastIndex: require('./last-index'), + map: require('./map'), + remove: require('./remove'), + separate: require('./separate'), + slice: require('./slice'), + someRight: require('./some-right'), + splice: require('./splice'), + uniq: require('./uniq'), + values: require('./values') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/indexes-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/indexes-of.js new file mode 100644 index 00000000..6b89157a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/indexes-of.js @@ -0,0 +1,12 @@ +'use strict'; + +var indexOf = require('./e-index-of'); + +module.exports = function (value/*, fromIndex*/) { + var r = [], i, fromIndex = arguments[1]; + while ((i = indexOf.call(this, value, fromIndex)) !== -1) { + r.push(i); + fromIndex = i + 1; + } + return r; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/intersection.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/intersection.js new file mode 100644 index 00000000..fadcb525 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/intersection.js @@ -0,0 +1,19 @@ +'use strict'; + +var value = require('../../object/valid-value') + , contains = require('./contains') + , byLength = require('./_compare-by-length') + + , filter = Array.prototype.filter, push = Array.prototype.push + , slice = Array.prototype.slice; + +module.exports = function (/*…list*/) { + var lists; + if (!arguments.length) slice.call(this); + push.apply(lists = [this], arguments); + lists.forEach(value); + lists.sort(byLength); + return lists.reduce(function (a, b) { + return filter.call(a, function (x) { return contains.call(b, x); }); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/is-copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/is-copy.js new file mode 100644 index 00000000..ac7c79bc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/is-copy.js @@ -0,0 +1,21 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , eq = require('../../object/eq') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function (other) { + var i, l; + (value(this) && value(other)); + l = toPosInt(this.length); + if (l !== toPosInt(other.length)) return false; + for (i = 0; i < l; ++i) { + if (hasOwnProperty.call(this, i) !== hasOwnProperty.call(other, i)) { + return false; + } + if (!eq(this[i], other[i])) return false; + } + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/is-uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/is-uniq.js new file mode 100644 index 00000000..b14f461d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/is-uniq.js @@ -0,0 +1,12 @@ +'use strict'; + +var indexOf = require('./e-index-of') + + , every = Array.prototype.every + , isFirst; + +isFirst = function (value, index) { + return indexOf.call(this, value) === index; +}; + +module.exports = function () { return every.call(this, isFirst, this); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/implement.js new file mode 100644 index 00000000..e18e6170 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'keys', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/index.js new file mode 100644 index 00000000..2f89cffe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.keys : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/is-implemented.js new file mode 100644 index 00000000..06bd87bf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function () { + var arr = [1, 'foo'], iterator, result; + if (typeof arr.keys !== 'function') return false; + iterator = arr.keys(); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result) return false; + if (result.value !== 0) return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/shim.js new file mode 100644 index 00000000..83773f6e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/keys/shim.js @@ -0,0 +1,4 @@ +'use strict'; + +var ArrayIterator = require('es6-iterator/array'); +module.exports = function () { return new ArrayIterator(this, 'key'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/last-index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/last-index.js new file mode 100644 index 00000000..a191d6e1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/last-index.js @@ -0,0 +1,16 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function () { + var i, l; + if (!(l = toPosInt(value(this).length))) return null; + i = l - 1; + while (!hasOwnProperty.call(this, i)) { + if (--i === -1) return null; + } + return i; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/last.js new file mode 100644 index 00000000..bf9d2f29 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/last.js @@ -0,0 +1,9 @@ +'use strict'; + +var lastIndex = require('./last-index'); + +module.exports = function () { + var i; + if ((i = lastIndex.call(this)) !== null) return this[i]; + return undefined; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/implement.js new file mode 100644 index 00000000..3aabb874 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'map', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/index.js new file mode 100644 index 00000000..66f66607 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.map : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/is-implemented.js new file mode 100644 index 00000000..c328b473 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var identity = require('../../../function/identity') + , SubArray = require('../../_sub-array-dummy-safe'); + +module.exports = function () { + return (new SubArray()).map(identity) instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/shim.js new file mode 100644 index 00000000..2ee73134 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/map/shim.js @@ -0,0 +1,21 @@ +'use strict'; + +var isPlainArray = require('../../is-plain-array') + , callable = require('../../../object/valid-callable') + + , isArray = Array.isArray, map = Array.prototype.map + , forEach = Array.prototype.forEach, call = Function.prototype.call; + +module.exports = function (callbackFn/*, thisArg*/) { + var result, thisArg; + if (!this || !isArray(this) || isPlainArray(this)) { + return map.apply(this, arguments); + } + callable(callbackFn); + thisArg = arguments[1]; + result = new this.constructor(this.length); + forEach.call(this, function (val, i, self) { + result[i] = call.call(callbackFn, thisArg, val, i, self); + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/remove.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/remove.js new file mode 100644 index 00000000..dcf84331 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/remove.js @@ -0,0 +1,12 @@ +'use strict'; + +var indexOf = require('./e-index-of') + + , forEach = Array.prototype.forEach, splice = Array.prototype.splice; + +module.exports = function (item/*, …item*/) { + forEach.call(arguments, function (item) { + var index = indexOf.call(this, item); + if (index !== -1) splice.call(this, index, 1); + }, this); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/separate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/separate.js new file mode 100644 index 00000000..dc974b83 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/separate.js @@ -0,0 +1,10 @@ +'use strict'; + +var forEach = Array.prototype.forEach; + +module.exports = function (sep) { + var result = []; + forEach.call(this, function (val, i) { result.push(val, sep); }); + result.pop(); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/implement.js new file mode 100644 index 00000000..cd488a06 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'slice', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/index.js new file mode 100644 index 00000000..72200ca9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.prototype.slice : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/is-implemented.js new file mode 100644 index 00000000..ec1985e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +var SubArray = require('../../_sub-array-dummy-safe'); + +module.exports = function () { + return (new SubArray()).slice() instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/shim.js new file mode 100644 index 00000000..2761a1aa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/slice/shim.js @@ -0,0 +1,35 @@ +'use strict'; + +var toInteger = require('../../../number/to-integer') + , toPosInt = require('../../../number/to-pos-integer') + , isPlainArray = require('../../is-plain-array') + + , isArray = Array.isArray, slice = Array.prototype.slice + , hasOwnProperty = Object.prototype.hasOwnProperty, max = Math.max; + +module.exports = function (start, end) { + var length, result, i; + if (!this || !isArray(this) || isPlainArray(this)) { + return slice.apply(this, arguments); + } + length = toPosInt(this.length); + start = toInteger(start); + if (start < 0) start = max(length + start, 0); + else if (start > length) start = length; + if (end === undefined) { + end = length; + } else { + end = toInteger(end); + if (end < 0) end = max(length + end, 0); + else if (end > length) end = length; + } + if (start > end) start = end; + result = new this.constructor(end - start); + i = 0; + while (start !== end) { + if (hasOwnProperty.call(this, start)) result[i] = this[start]; + ++i; + ++start; + } + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/some-right.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/some-right.js new file mode 100644 index 00000000..de7460d6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/some-right.js @@ -0,0 +1,22 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty + , call = Function.prototype.call; + +module.exports = function (cb/*, thisArg*/) { + var i, self, thisArg; + self = Object(value(this)); + callable(cb); + thisArg = arguments[1]; + + for (i = self.length; i >= 0; --i) { + if (hasOwnProperty.call(self, i) && + call.call(cb, thisArg, self[i], i, self)) { + return true; + } + } + return false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/implement.js new file mode 100644 index 00000000..aab1f8ef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'splice', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/index.js new file mode 100644 index 00000000..e8ecf3cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.prototype.splice : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/is-implemented.js new file mode 100644 index 00000000..ffddaa81 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +var SubArray = require('../../_sub-array-dummy-safe'); + +module.exports = function () { + return (new SubArray()).splice(0) instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/shim.js new file mode 100644 index 00000000..a8505a2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/splice/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var isPlainArray = require('../../is-plain-array') + + , isArray = Array.isArray, splice = Array.prototype.splice + , forEach = Array.prototype.forEach; + +module.exports = function (start, deleteCount/*, …items*/) { + var arr = splice.apply(this, arguments), result; + if (!this || !isArray(this) || isPlainArray(this)) return arr; + result = new this.constructor(arr.length); + forEach.call(arr, function (val, i) { result[i] = val; }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/uniq.js new file mode 100644 index 00000000..db014655 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/uniq.js @@ -0,0 +1,13 @@ +'use strict'; + +var indexOf = require('./e-index-of') + + , filter = Array.prototype.filter + + , isFirst; + +isFirst = function (value, index) { + return indexOf.call(this, value) === index; +}; + +module.exports = function () { return filter.call(this, isFirst, this); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/implement.js new file mode 100644 index 00000000..237281fd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'values', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/index.js new file mode 100644 index 00000000..c0832c30 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? Array.prototype.values : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/is-implemented.js new file mode 100644 index 00000000..cc0c6294 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function () { + var arr = ['foo', 1], iterator, result; + if (typeof arr.values !== 'function') return false; + iterator = arr.values(); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result) return false; + if (result.value !== 'foo') return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/shim.js new file mode 100644 index 00000000..f6555fd8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/#/values/shim.js @@ -0,0 +1,4 @@ +'use strict'; + +var ArrayIterator = require('es6-iterator/array'); +module.exports = function () { return new ArrayIterator(this, 'value'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/_is-extensible.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/_is-extensible.js new file mode 100644 index 00000000..61232064 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/_is-extensible.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = (function () { + var SubArray = require('./_sub-array-dummy'), arr; + + if (!SubArray) return false; + arr = new SubArray(); + if (!Array.isArray(arr)) return false; + if (!(arr instanceof SubArray)) return false; + + arr[34] = 'foo'; + return (arr.length === 35); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/_sub-array-dummy-safe.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/_sub-array-dummy-safe.js new file mode 100644 index 00000000..5baf8a8d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/_sub-array-dummy-safe.js @@ -0,0 +1,23 @@ +'use strict'; + +var setPrototypeOf = require('../object/set-prototype-of') + , isExtensible = require('./_is-extensible'); + +module.exports = (function () { + var SubArray; + + if (isExtensible) return require('./_sub-array-dummy'); + + if (!setPrototypeOf) return null; + SubArray = function () { + var arr = Array.apply(this, arguments); + setPrototypeOf(arr, SubArray.prototype); + return arr; + }; + setPrototypeOf(SubArray, Array); + SubArray.prototype = Object.create(Array.prototype, { + constructor: { value: SubArray, enumerable: false, writable: true, + configurable: true } + }); + return SubArray; +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/_sub-array-dummy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/_sub-array-dummy.js new file mode 100644 index 00000000..a926d1a3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/_sub-array-dummy.js @@ -0,0 +1,16 @@ +'use strict'; + +var setPrototypeOf = require('../object/set-prototype-of'); + +module.exports = (function () { + var SubArray; + + if (!setPrototypeOf) return null; + SubArray = function () { Array.apply(this, arguments); }; + setPrototypeOf(SubArray, Array); + SubArray.prototype = Object.create(Array.prototype, { + constructor: { value: SubArray, enumerable: false, writable: true, + configurable: true } + }); + return SubArray; +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/implement.js new file mode 100644 index 00000000..f3411b13 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array, 'from', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/index.js new file mode 100644 index 00000000..3b99cda8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.from + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/is-implemented.js new file mode 100644 index 00000000..63ff2a57 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function () { + var from = Array.from, arr, result; + if (typeof from !== 'function') return false; + arr = ['raz', 'dwa']; + result = from(arr); + return Boolean(result && (result !== arr) && (result[1] === 'dwa')); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/shim.js new file mode 100644 index 00000000..a90ba2f9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/from/shim.js @@ -0,0 +1,106 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , isArguments = require('../../function/is-arguments') + , isFunction = require('../../function/is-function') + , toPosInt = require('../../number/to-pos-integer') + , callable = require('../../object/valid-callable') + , validValue = require('../../object/valid-value') + , isString = require('../../string/is-string') + + , isArray = Array.isArray, call = Function.prototype.call + , desc = { configurable: true, enumerable: true, writable: true, value: null } + , defineProperty = Object.defineProperty; + +module.exports = function (arrayLike/*, mapFn, thisArg*/) { + var mapFn = arguments[1], thisArg = arguments[2], Constructor, i, j, arr, l, code, iterator + , result, getIterator, value; + + arrayLike = Object(validValue(arrayLike)); + + if (mapFn != null) callable(mapFn); + if (!this || (this === Array) || !isFunction(this)) { + // Result: Plain array + if (!mapFn) { + if (isArguments(arrayLike)) { + // Source: Arguments + l = arrayLike.length; + if (l !== 1) return Array.apply(null, arrayLike); + arr = new Array(1); + arr[0] = arrayLike[0]; + return arr; + } + if (isArray(arrayLike)) { + // Source: Array + arr = new Array(l = arrayLike.length); + for (i = 0; i < l; ++i) arr[i] = arrayLike[i]; + return arr; + } + } + arr = []; + } else { + // Result: Non plain array + Constructor = this; + } + + if (!isArray(arrayLike)) { + if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) { + // Source: Iterator + iterator = callable(getIterator).call(arrayLike); + if (Constructor) arr = new Constructor(); + result = iterator.next(); + i = 0; + while (!result.done) { + value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value; + if (!Constructor) { + arr[i] = value; + } else { + desc.value = value; + defineProperty(arr, i, desc); + } + result = iterator.next(); + ++i; + } + l = i; + } else if (isString(arrayLike)) { + // Source: String + l = arrayLike.length; + if (Constructor) arr = new Constructor(); + for (i = 0, j = 0; i < l; ++i) { + value = arrayLike[i]; + if ((i + 1) < l) { + code = value.charCodeAt(0); + if ((code >= 0xD800) && (code <= 0xDBFF)) value += arrayLike[++i]; + } + value = mapFn ? call.call(mapFn, thisArg, value, j) : value; + if (!Constructor) { + arr[j] = value; + } else { + desc.value = value; + defineProperty(arr, j, desc); + } + ++j; + } + l = j; + } + } + if (l === undefined) { + // Source: array or array-like + l = toPosInt(arrayLike.length); + if (Constructor) arr = new Constructor(l); + for (i = 0; i < l; ++i) { + value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i]; + if (!Constructor) { + arr[i] = value; + } else { + desc.value = value; + defineProperty(arr, i, desc); + } + } + } + if (Constructor) { + desc.value = null; + arr.length = l; + } + return arr; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/generate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/generate.js new file mode 100644 index 00000000..5e066750 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/generate.js @@ -0,0 +1,20 @@ +'use strict'; + +var toPosInt = require('../number/to-pos-integer') + , value = require('../object/valid-value') + + , slice = Array.prototype.slice; + +module.exports = function (length/*, …fill*/) { + var arr, l; + length = toPosInt(value(length)); + if (length === 0) return []; + + arr = (arguments.length < 2) ? [undefined] : + slice.call(arguments, 1, 1 + length); + + while ((l = arr.length) < length) { + arr = arr.concat(arr.slice(0, length - l)); + } + return arr; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/index.js new file mode 100644 index 00000000..7a686789 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/index.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + from: require('./from'), + generate: require('./generate'), + isPlainArray: require('./is-plain-array'), + of: require('./of'), + toArray: require('./to-array'), + validArray: require('./valid-array') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/is-plain-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/is-plain-array.js new file mode 100644 index 00000000..6b37e406 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/is-plain-array.js @@ -0,0 +1,11 @@ +'use strict'; + +var isArray = Array.isArray, getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (obj) { + var proto; + if (!obj || !isArray(obj)) return false; + proto = getPrototypeOf(obj); + if (!isArray(proto)) return false; + return !isArray(getPrototypeOf(proto)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/implement.js new file mode 100644 index 00000000..bf2a5a54 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array, 'of', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/index.js new file mode 100644 index 00000000..07ee54db --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.of + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/is-implemented.js new file mode 100644 index 00000000..4390a108 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function () { + var of = Array.of, result; + if (typeof of !== 'function') return false; + result = of('foo', 'bar'); + return Boolean(result && (result[1] === 'bar')); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/shim.js new file mode 100644 index 00000000..de72bc92 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/of/shim.js @@ -0,0 +1,19 @@ +'use strict'; + +var isFunction = require('../../function/is-function') + + , slice = Array.prototype.slice, defineProperty = Object.defineProperty + , desc = { configurable: true, enumerable: true, writable: true, value: null }; + +module.exports = function (/*…items*/) { + var result, i, l; + if (!this || (this === Array) || !isFunction(this)) return slice.call(arguments); + result = new this(l = arguments.length); + for (i = 0; i < l; ++i) { + desc.value = arguments[i]; + defineProperty(result, i, desc); + } + desc.value = null; + result.length = l; + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/to-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/to-array.js new file mode 100644 index 00000000..ce908dd9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/to-array.js @@ -0,0 +1,9 @@ +'use strict'; + +var from = require('./from') + + , isArray = Array.isArray; + +module.exports = function (arrayLike) { + return isArray(arrayLike) ? arrayLike : from(arrayLike); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/valid-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/valid-array.js new file mode 100644 index 00000000..d86a8f5f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/array/valid-array.js @@ -0,0 +1,8 @@ +'use strict'; + +var isArray = Array.isArray; + +module.exports = function (value) { + if (isArray(value)) return value; + throw new TypeError(value + " is not an array"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/boolean/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/boolean/index.js new file mode 100644 index 00000000..c193b948 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/boolean/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + isBoolean: require('./is-boolean') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/boolean/is-boolean.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/boolean/is-boolean.js new file mode 100644 index 00000000..5d1a802e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/boolean/is-boolean.js @@ -0,0 +1,10 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(true); + +module.exports = function (x) { + return (typeof x === 'boolean') || ((typeof x === 'object') && + ((x instanceof Boolean) || (toString.call(x) === id))); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/copy.js new file mode 100644 index 00000000..69e2eb09 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/copy.js @@ -0,0 +1,5 @@ +'use strict'; + +var getTime = Date.prototype.getTime; + +module.exports = function () { return new Date(getTime.call(this)); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/days-in-month.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/days-in-month.js new file mode 100644 index 00000000..e780efe3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/days-in-month.js @@ -0,0 +1,17 @@ +'use strict'; + +var getMonth = Date.prototype.getMonth; + +module.exports = function () { + switch (getMonth.call(this)) { + case 1: + return this.getFullYear() % 4 ? 28 : 29; + case 3: + case 5: + case 8: + case 10: + return 30; + default: + return 31; + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/floor-day.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/floor-day.js new file mode 100644 index 00000000..0c9eb8b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/floor-day.js @@ -0,0 +1,8 @@ +'use strict'; + +var setHours = Date.prototype.setHours; + +module.exports = function () { + setHours.call(this, 0, 0, 0, 0); + return this; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/floor-month.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/floor-month.js new file mode 100644 index 00000000..7328c250 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/floor-month.js @@ -0,0 +1,8 @@ +'use strict'; + +var floorDay = require('./floor-day'); + +module.exports = function () { + floorDay.call(this).setDate(1); + return this; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/floor-year.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/floor-year.js new file mode 100644 index 00000000..9c508538 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/floor-year.js @@ -0,0 +1,8 @@ +'use strict'; + +var floorMonth = require('./floor-month'); + +module.exports = function () { + floorMonth.call(this).setMonth(0); + return this; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/format.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/format.js new file mode 100644 index 00000000..15bd95f7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/format.js @@ -0,0 +1,21 @@ +'use strict'; + +var pad = require('../../number/#/pad') + , date = require('../valid-date') + + , format; + +format = require('../../string/format-method')({ + Y: function () { return String(this.getFullYear()); }, + y: function () { return String(this.getFullYear()).slice(-2); }, + m: function () { return pad.call(this.getMonth() + 1, 2); }, + d: function () { return pad.call(this.getDate(), 2); }, + H: function () { return pad.call(this.getHours(), 2); }, + M: function () { return pad.call(this.getMinutes(), 2); }, + S: function () { return pad.call(this.getSeconds(), 2); }, + L: function () { return pad.call(this.getMilliseconds(), 3); } +}); + +module.exports = function (pattern) { + return format.call(date(this), pattern); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/index.js new file mode 100644 index 00000000..f71b2950 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/#/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + copy: require('./copy'), + daysInMonth: require('./days-in-month'), + floorDay: require('./floor-day'), + floorMonth: require('./floor-month'), + floorYear: require('./floor-year'), + format: require('./format') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/index.js new file mode 100644 index 00000000..eac33fbe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/index.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + isDate: require('./is-date'), + validDate: require('./valid-date') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/is-date.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/is-date.js new file mode 100644 index 00000000..6ba236ec --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/is-date.js @@ -0,0 +1,9 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(new Date()); + +module.exports = function (x) { + return (x && ((x instanceof Date) || (toString.call(x) === id))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/valid-date.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/valid-date.js new file mode 100644 index 00000000..7d1a9b60 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/date/valid-date.js @@ -0,0 +1,8 @@ +'use strict'; + +var isDate = require('./is-date'); + +module.exports = function (x) { + if (!isDate(x)) throw new TypeError(x + " is not a Date object"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/#/index.js new file mode 100644 index 00000000..b984aa91 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/#/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + throw: require('./throw') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/#/throw.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/#/throw.js new file mode 100644 index 00000000..7e15ebd1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/#/throw.js @@ -0,0 +1,5 @@ +'use strict'; + +var error = require('../valid-error'); + +module.exports = function () { throw error(this); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/custom.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/custom.js new file mode 100644 index 00000000..bbc2dc20 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/custom.js @@ -0,0 +1,20 @@ +'use strict'; + +var assign = require('../object/assign') + + , captureStackTrace = Error.captureStackTrace; + +exports = module.exports = function (message/*, code, ext*/) { + var err = new Error(), code = arguments[1], ext = arguments[2]; + if (ext == null) { + if (code && (typeof code === 'object')) { + ext = code; + code = null; + } + } + if (ext != null) assign(err, ext); + err.message = String(message); + if (code != null) err.code = String(code); + if (captureStackTrace) captureStackTrace(err, exports); + return err; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/index.js new file mode 100644 index 00000000..62984b52 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + custom: require('./custom'), + isError: require('./is-error'), + validError: require('./valid-error') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/is-error.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/is-error.js new file mode 100644 index 00000000..422705fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/is-error.js @@ -0,0 +1,9 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(new Error()); + +module.exports = function (x) { + return (x && ((x instanceof Error) || (toString.call(x)) === id)) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/valid-error.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/valid-error.js new file mode 100644 index 00000000..0bef768a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/error/valid-error.js @@ -0,0 +1,8 @@ +'use strict'; + +var isError = require('./is-error'); + +module.exports = function (x) { + if (!isError(x)) throw new TypeError(x + " is not an Error object"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/compose.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/compose.js new file mode 100644 index 00000000..1da5e011 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/compose.js @@ -0,0 +1,20 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + , aFrom = require('../../array/from') + + , apply = Function.prototype.apply, call = Function.prototype.call + , callFn = function (arg, fn) { return call.call(fn, this, arg); }; + +module.exports = function (fn/*, …fnn*/) { + var fns, first; + if (!fn) callable(fn); + fns = [this].concat(aFrom(arguments)); + fns.forEach(callable); + fns = fns.reverse(); + first = fns[0]; + fns = fns.slice(1); + return function (arg) { + return fns.reduce(callFn, apply.call(first, this, arguments)); + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/copy.js new file mode 100644 index 00000000..e1467f76 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/copy.js @@ -0,0 +1,15 @@ +'use strict'; + +var mixin = require('../../object/mixin') + , validFunction = require('../valid-function') + + , re = /^\s*function\s*([\0-'\)-\uffff]+)*\s*\(([\0-\(\*-\uffff]*)\)\s*\{/; + +module.exports = function () { + var match = String(validFunction(this)).match(re), fn; + + fn = new Function('fn', 'return function ' + match[1].trim() + '(' + + match[2] + ') { return fn.apply(this, arguments); };')(this); + try { mixin(fn, this); } catch (ignore) {} + return fn; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/curry.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/curry.js new file mode 100644 index 00000000..943d6faf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/curry.js @@ -0,0 +1,24 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , callable = require('../../object/valid-callable') + , defineLength = require('../_define-length') + + , slice = Array.prototype.slice, apply = Function.prototype.apply + , curry; + +curry = function self(fn, length, preArgs) { + return defineLength(function () { + var args = preArgs ? + preArgs.concat(slice.call(arguments, 0, length - preArgs.length)) : + slice.call(arguments, 0, length); + return (args.length === length) ? apply.call(fn, this, args) : + self(fn, length, args); + }, preArgs ? (length - preArgs.length) : length); +}; + +module.exports = function (/*length*/) { + var length = arguments[0]; + return curry(callable(this), + isNaN(length) ? toPosInt(this.length) : toPosInt(length)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/index.js new file mode 100644 index 00000000..8d0da007 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/index.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = { + compose: require('./compose'), + copy: require('./copy'), + curry: require('./curry'), + lock: require('./lock'), + not: require('./not'), + partial: require('./partial'), + spread: require('./spread'), + toStringTokens: require('./to-string-tokens') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/lock.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/lock.js new file mode 100644 index 00000000..91e1a65c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/lock.js @@ -0,0 +1,12 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + + , apply = Function.prototype.apply; + +module.exports = function (/*…args*/) { + var fn = callable(this) + , args = arguments; + + return function () { return apply.call(fn, this, args); }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/not.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/not.js new file mode 100644 index 00000000..c6dbe97f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/not.js @@ -0,0 +1,14 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + , defineLength = require('../_define-length') + + , apply = Function.prototype.apply; + +module.exports = function () { + var fn = callable(this); + + return defineLength(function () { + return !apply.call(fn, this, arguments); + }, fn.length); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/partial.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/partial.js new file mode 100644 index 00000000..bf31a357 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/partial.js @@ -0,0 +1,16 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + , aFrom = require('../../array/from') + , defineLength = require('../_define-length') + + , apply = Function.prototype.apply; + +module.exports = function (/*…args*/) { + var fn = callable(this) + , args = aFrom(arguments); + + return defineLength(function () { + return apply.call(fn, this, args.concat(aFrom(arguments))); + }, fn.length - args.length); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/spread.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/spread.js new file mode 100644 index 00000000..d7c93b7e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/spread.js @@ -0,0 +1,10 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + + , apply = Function.prototype.apply; + +module.exports = function () { + var fn = callable(this); + return function (args) { return apply.call(fn, this, args); }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/to-string-tokens.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/to-string-tokens.js new file mode 100644 index 00000000..67afeae8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/#/to-string-tokens.js @@ -0,0 +1,11 @@ +'use strict'; + +var validFunction = require('../valid-function') + + , re = new RegExp('^\\s*function[\\0-\'\\)-\\uffff]*' + + '\\(([\\0-\\(\\*-\\uffff]*)\\)\\s*\\{([\\0-\\uffff]*)\\}\\s*$'); + +module.exports = function () { + var data = String(validFunction(this)).match(re); + return { args: data[1], body: data[2] }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/_define-length.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/_define-length.js new file mode 100644 index 00000000..496ea62c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/_define-length.js @@ -0,0 +1,44 @@ +'use strict'; + +var toPosInt = require('../number/to-pos-integer') + + , test = function (a, b) {}, desc, defineProperty + , generate, mixin; + +try { + Object.defineProperty(test, 'length', { configurable: true, writable: false, + enumerable: false, value: 1 }); +} catch (ignore) {} + +if (test.length === 1) { + // ES6 + desc = { configurable: true, writable: false, enumerable: false }; + defineProperty = Object.defineProperty; + module.exports = function (fn, length) { + length = toPosInt(length); + if (fn.length === length) return fn; + desc.value = length; + return defineProperty(fn, 'length', desc); + }; +} else { + mixin = require('../object/mixin'); + generate = (function () { + var cache = []; + return function (l) { + var args, i = 0; + if (cache[l]) return cache[l]; + args = []; + while (l--) args.push('a' + (++i).toString(36)); + return new Function('fn', 'return function (' + args.join(', ') + + ') { return fn.apply(this, arguments); };'); + }; + }()); + module.exports = function (src, length) { + var target; + length = toPosInt(length); + if (src.length === length) return src; + target = generate(length)(src); + try { mixin(target, src); } catch (ignore) {} + return target; + }; +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/constant.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/constant.js new file mode 100644 index 00000000..10f1e203 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/constant.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (x) { + return function () { return x; }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/identity.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/identity.js new file mode 100644 index 00000000..a9289f0b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/identity.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (x) { return x; }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/index.js new file mode 100644 index 00000000..cfad3f3e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/index.js @@ -0,0 +1,15 @@ +// Export all modules. + +'use strict'; + +module.exports = { + '#': require('./#'), + constant: require('./constant'), + identity: require('./identity'), + invoke: require('./invoke'), + isArguments: require('./is-arguments'), + isFunction: require('./is-function'), + noop: require('./noop'), + pluck: require('./pluck'), + validFunction: require('./valid-function') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/invoke.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/invoke.js new file mode 100644 index 00000000..9195afdd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/invoke.js @@ -0,0 +1,15 @@ +'use strict'; + +var isCallable = require('../object/is-callable') + , value = require('../object/valid-value') + + , slice = Array.prototype.slice, apply = Function.prototype.apply; + +module.exports = function (name/*, …args*/) { + var args = slice.call(arguments, 1), isFn = isCallable(name); + return function (obj) { + value(obj); + return apply.call(isFn ? name : obj[name], obj, + args.concat(slice.call(arguments, 1))); + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/is-arguments.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/is-arguments.js new file mode 100644 index 00000000..9a29855f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/is-arguments.js @@ -0,0 +1,7 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call((function () { return arguments; }())); + +module.exports = function (x) { return (toString.call(x) === id); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/is-function.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/is-function.js new file mode 100644 index 00000000..ab4399ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/is-function.js @@ -0,0 +1,9 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(require('./noop')); + +module.exports = function (f) { + return (typeof f === "function") && (toString.call(f) === id); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/noop.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/noop.js new file mode 100644 index 00000000..aa43baed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/noop.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function () {}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/pluck.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/pluck.js new file mode 100644 index 00000000..7f70a30c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/pluck.js @@ -0,0 +1,7 @@ +'use strict'; + +var value = require('../object/valid-value'); + +module.exports = function (name) { + return function (o) { return value(o)[name]; }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/valid-function.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/valid-function.js new file mode 100644 index 00000000..05fdee2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/function/valid-function.js @@ -0,0 +1,8 @@ +'use strict'; + +var isFunction = require('./is-function'); + +module.exports = function (x) { + if (!isFunction(x)) throw new TypeError(x + " is not a function"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/global.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/global.js new file mode 100644 index 00000000..872a40e8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/global.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = new Function("return this")(); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/index.js new file mode 100644 index 00000000..db9a7600 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/index.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = { + global: require('./global'), + + array: require('./array'), + boolean: require('./boolean'), + date: require('./date'), + error: require('./error'), + function: require('./function'), + iterable: require('./iterable'), + math: require('./math'), + number: require('./number'), + object: require('./object'), + regExp: require('./reg-exp'), + string: require('./string') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/for-each.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/for-each.js new file mode 100644 index 00000000..f1e20425 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/for-each.js @@ -0,0 +1,12 @@ +'use strict'; + +var forOf = require('es6-iterator/for-of') + , isIterable = require('es6-iterator/is-iterable') + , iterable = require('./validate') + + , forEach = Array.prototype.forEach; + +module.exports = function (target, cb/*, thisArg*/) { + if (isIterable(iterable(target))) forOf(target, cb, arguments[2]); + else forEach.call(target, cb, arguments[2]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/index.js new file mode 100644 index 00000000..a3e16a5e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = { + forEach: require('./for-each'), + is: require('./is'), + validate: require('./validate'), + validateObject: require('./validate-object') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/is.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/is.js new file mode 100644 index 00000000..bb8bf287 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/is.js @@ -0,0 +1,10 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , isArrayLike = require('../object/is-array-like'); + +module.exports = function (x) { + if (x == null) return false; + if (typeof x[iteratorSymbol] === 'function') return true; + return isArrayLike(x); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/validate-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/validate-object.js new file mode 100644 index 00000000..988a6adb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/validate-object.js @@ -0,0 +1,9 @@ +'use strict'; + +var isObject = require('../object/is-object') + , is = require('./is'); + +module.exports = function (x) { + if (is(x) && isObject(x)) return x; + throw new TypeError(x + " is not an iterable or array-like object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/validate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/validate.js new file mode 100644 index 00000000..1be6d7fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/iterable/validate.js @@ -0,0 +1,8 @@ +'use strict'; + +var is = require('./is'); + +module.exports = function (x) { + if (is(x)) return x; + throw new TypeError(x + " is not an iterable or array-like"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/_pack-ieee754.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/_pack-ieee754.js new file mode 100644 index 00000000..eecda565 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/_pack-ieee754.js @@ -0,0 +1,82 @@ +// Credit: https://github.com/paulmillr/es6-shim/ + +'use strict'; + +var abs = Math.abs, floor = Math.floor, log = Math.log, min = Math.min + , pow = Math.pow, LN2 = Math.LN2 + , roundToEven; + +roundToEven = function (n) { + var w = floor(n), f = n - w; + if (f < 0.5) return w; + if (f > 0.5) return w + 1; + return w % 2 ? w + 1 : w; +}; + +module.exports = function (v, ebits, fbits) { + var bias = (1 << (ebits - 1)) - 1, s, e, f, i, bits, str, bytes; + + // Compute sign, exponent, fraction + if (isNaN(v)) { + // NaN + // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping + e = (1 << ebits) - 1; + f = pow(2, fbits - 1); + s = 0; + } else if (v === Infinity || v === -Infinity) { + e = (1 << ebits) - 1; + f = 0; + s = (v < 0) ? 1 : 0; + } else if (v === 0) { + e = 0; + f = 0; + s = (1 / v === -Infinity) ? 1 : 0; + } else { + s = v < 0; + v = abs(v); + + if (v >= pow(2, 1 - bias)) { + e = min(floor(log(v) / LN2), 1023); + f = roundToEven(v / pow(2, e) * pow(2, fbits)); + if (f / pow(2, fbits) >= 2) { + e = e + 1; + f = 1; + } + if (e > bias) { + // Overflow + e = (1 << ebits) - 1; + f = 0; + } else { + // Normal + e = e + bias; + f = f - pow(2, fbits); + } + } else { + // Subnormal + e = 0; + f = roundToEven(v / pow(2, 1 - bias - fbits)); + } + } + + // Pack sign, exponent, fraction + bits = []; + for (i = fbits; i; i -= 1) { + bits.push(f % 2 ? 1 : 0); + f = floor(f / 2); + } + for (i = ebits; i; i -= 1) { + bits.push(e % 2 ? 1 : 0); + e = floor(e / 2); + } + bits.push(s ? 1 : 0); + bits.reverse(); + str = bits.join(''); + + // Bits to bytes + bytes = []; + while (str.length) { + bytes.push(parseInt(str.substring(0, 8), 2)); + str = str.substring(8); + } + return bytes; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/_unpack-ieee754.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/_unpack-ieee754.js new file mode 100644 index 00000000..c9f26f2b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/_unpack-ieee754.js @@ -0,0 +1,33 @@ +// Credit: https://github.com/paulmillr/es6-shim/ + +'use strict'; + +var pow = Math.pow; + +module.exports = function (bytes, ebits, fbits) { + // Bytes to bits + var bits = [], i, j, b, str, + bias, s, e, f; + + for (i = bytes.length; i; i -= 1) { + b = bytes[i - 1]; + for (j = 8; j; j -= 1) { + bits.push(b % 2 ? 1 : 0); + b = b >> 1; + } + } + bits.reverse(); + str = bits.join(''); + + // Unpack sign, exponent, fraction + bias = (1 << (ebits - 1)) - 1; + s = parseInt(str.substring(0, 1), 2) ? -1 : 1; + e = parseInt(str.substring(1, 1 + ebits), 2); + f = parseInt(str.substring(1 + ebits), 2); + + // Produce number + if (e === (1 << ebits) - 1) return f !== 0 ? NaN : s * Infinity; + if (e > 0) return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); + if (f !== 0) return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); + return s < 0 ? -0 : 0; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/implement.js new file mode 100644 index 00000000..f48ad11d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'acosh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/index.js new file mode 100644 index 00000000..00ddea69 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.acosh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/is-implemented.js new file mode 100644 index 00000000..363f0d8b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var acosh = Math.acosh; + if (typeof acosh !== 'function') return false; + return acosh(2) === 1.3169578969248166; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/shim.js new file mode 100644 index 00000000..89a24b5d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/acosh/shim.js @@ -0,0 +1,12 @@ +'use strict'; + +var log = Math.log, sqrt = Math.sqrt; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < 1) return NaN; + if (x === 1) return 0; + if (x === Infinity) return x; + return log(x + sqrt(x * x - 1)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/implement.js new file mode 100644 index 00000000..21f64d50 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'asinh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/index.js new file mode 100644 index 00000000..d415144e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.asinh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/is-implemented.js new file mode 100644 index 00000000..6c205f41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var asinh = Math.asinh; + if (typeof asinh !== 'function') return false; + return asinh(2) === 1.4436354751788103; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/shim.js new file mode 100644 index 00000000..42fbf145 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/asinh/shim.js @@ -0,0 +1,15 @@ +'use strict'; + +var log = Math.log, sqrt = Math.sqrt; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (!isFinite(x)) return x; + if (x < 0) { + x = -x; + return -log(x + sqrt(x * x + 1)); + } + return log(x + sqrt(x * x + 1)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/implement.js new file mode 100644 index 00000000..1a485134 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'atanh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/index.js new file mode 100644 index 00000000..785b3deb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.atanh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/is-implemented.js new file mode 100644 index 00000000..dbaf18ec --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var atanh = Math.atanh; + if (typeof atanh !== 'function') return false; + return atanh(0.5) === 0.5493061443340549; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/shim.js new file mode 100644 index 00000000..531e2891 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/atanh/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var log = Math.log; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < -1) return NaN; + if (x > 1) return NaN; + if (x === -1) return -Infinity; + if (x === 1) return Infinity; + if (x === 0) return x; + return 0.5 * log((1 + x) / (1 - x)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/implement.js new file mode 100644 index 00000000..3a12dde4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'cbrt', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/index.js new file mode 100644 index 00000000..89f966df --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.cbrt + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/is-implemented.js new file mode 100644 index 00000000..69809f3c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var cbrt = Math.cbrt; + if (typeof cbrt !== 'function') return false; + return cbrt(2) === 1.2599210498948732; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/shim.js new file mode 100644 index 00000000..bca19602 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cbrt/shim.js @@ -0,0 +1,12 @@ +'use strict'; + +var pow = Math.pow; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (!isFinite(x)) return x; + if (x < 0) return -pow(-x, 1 / 3); + return pow(x, 1 / 3); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/implement.js new file mode 100644 index 00000000..339df33e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'clz32', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/index.js new file mode 100644 index 00000000..1687b337 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.clz32 + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/is-implemented.js new file mode 100644 index 00000000..ccc8f713 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var clz32 = Math.clz32; + if (typeof clz32 !== 'function') return false; + return clz32(1000) === 22; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/shim.js new file mode 100644 index 00000000..2a582da3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/clz32/shim.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (value) { + value = value >>> 0; + return value ? 32 - value.toString(2).length : 32; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/implement.js new file mode 100644 index 00000000..f90d8305 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'cosh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/index.js new file mode 100644 index 00000000..000636ab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.cosh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/is-implemented.js new file mode 100644 index 00000000..c796bcbf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var cosh = Math.cosh; + if (typeof cosh !== 'function') return false; + return cosh(1) === 1.5430806348152437; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/shim.js new file mode 100644 index 00000000..f9062bd9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/cosh/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +var exp = Math.exp; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return 1; + if (!isFinite(x)) return Infinity; + return (exp(x) + exp(-x)) / 2; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/implement.js new file mode 100644 index 00000000..fc20c8cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'expm1', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/index.js new file mode 100644 index 00000000..4c1bc77a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.expm1 + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/is-implemented.js new file mode 100644 index 00000000..3b106d5d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var expm1 = Math.expm1; + if (typeof expm1 !== 'function') return false; + return expm1(1).toFixed(15) === '1.718281828459045'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/shim.js new file mode 100644 index 00000000..9c8c2360 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/expm1/shim.js @@ -0,0 +1,16 @@ +// Thanks: https://github.com/monolithed/ECMAScript-6 + +'use strict'; + +var exp = Math.exp; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (x === Infinity) return Infinity; + if (x === -Infinity) return -1; + + if ((x > -1.0e-6) && (x < 1.0e-6)) return x + x * x / 2; + return exp(x) - 1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/implement.js new file mode 100644 index 00000000..c55b26c4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'fround', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/index.js new file mode 100644 index 00000000..a077ed0b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.fround + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/is-implemented.js new file mode 100644 index 00000000..ffbf094e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var fround = Math.fround; + if (typeof fround !== 'function') return false; + return fround(1.337) === 1.3370000123977661; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/shim.js new file mode 100644 index 00000000..f2c86e46 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/fround/shim.js @@ -0,0 +1,33 @@ +// Credit: https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js + +'use strict'; + +var toFloat32; + +if (typeof Float32Array !== 'undefined') { + toFloat32 = (function () { + var float32Array = new Float32Array(1); + return function (x) { + float32Array[0] = x; + return float32Array[0]; + }; + }()); +} else { + toFloat32 = (function () { + var pack = require('../_pack-ieee754') + , unpack = require('../_unpack-ieee754'); + + return function (x) { + return unpack(pack(x, 8, 23), 8, 23); + }; + }()); +} + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (!isFinite(x)) return x; + + return toFloat32(x); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/implement.js new file mode 100644 index 00000000..b27fda7a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'hypot', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/index.js new file mode 100644 index 00000000..334bc584 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.hypot + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/is-implemented.js new file mode 100644 index 00000000..e75c5d36 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var hypot = Math.hypot; + if (typeof hypot !== 'function') return false; + return hypot(3, 4) === 5; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/shim.js new file mode 100644 index 00000000..3d0988bc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/hypot/shim.js @@ -0,0 +1,34 @@ +// Thanks for hints: https://github.com/paulmillr/es6-shim + +'use strict'; + +var some = Array.prototype.some, abs = Math.abs, sqrt = Math.sqrt + + , compare = function (a, b) { return b - a; } + , divide = function (x) { return x / this; } + , add = function (sum, number) { return sum + number * number; }; + +module.exports = function (val1, val2/*, …valn*/) { + var result, numbers; + if (!arguments.length) return 0; + some.call(arguments, function (val) { + if (isNaN(val)) { + result = NaN; + return; + } + if (!isFinite(val)) { + result = Infinity; + return true; + } + if (result !== undefined) return; + val = Number(val); + if (val === 0) return; + if (!numbers) numbers = [abs(val)]; + else numbers.push(abs(val)); + }); + if (result !== undefined) return result; + if (!numbers) return 0; + + numbers.sort(compare); + return numbers[0] * sqrt(numbers.map(divide, numbers[0]).reduce(add, 0)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/implement.js new file mode 100644 index 00000000..ed207bd2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'imul', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/index.js new file mode 100644 index 00000000..41e5d5f0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.imul + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/is-implemented.js new file mode 100644 index 00000000..d8495dea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var imul = Math.imul; + if (typeof imul !== 'function') return false; + return imul(-1, 8) === -8; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/shim.js new file mode 100644 index 00000000..8fd8a8d7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/imul/shim.js @@ -0,0 +1,13 @@ +// Thanks: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference +// /Global_Objects/Math/imul + +'use strict'; + +module.exports = function (x, y) { + var xh = (x >>> 16) & 0xffff, xl = x & 0xffff + , yh = (y >>> 16) & 0xffff, yl = y & 0xffff; + + // the shift by 0 fixes the sign on the high part + // the final |0 converts the unsigned value into a signed value + return ((xl * yl) + (((xh * yl + xl * yh) << 16) >>> 0) | 0); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/index.js new file mode 100644 index 00000000..d112d0bf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/index.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = { + acosh: require('./acosh'), + asinh: require('./asinh'), + atanh: require('./atanh'), + cbrt: require('./cbrt'), + clz32: require('./clz32'), + cosh: require('./cosh'), + expm1: require('./expm1'), + fround: require('./fround'), + hypot: require('./hypot'), + imul: require('./imul'), + log10: require('./log10'), + log2: require('./log2'), + log1p: require('./log1p'), + sign: require('./sign'), + sinh: require('./sinh'), + tanh: require('./tanh'), + trunc: require('./trunc') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/implement.js new file mode 100644 index 00000000..dd96edd8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'log10', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/index.js new file mode 100644 index 00000000..a9eee513 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.log10 + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/is-implemented.js new file mode 100644 index 00000000..c7f40ee7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var log10 = Math.log10; + if (typeof log10 !== 'function') return false; + return log10(2) === 0.3010299956639812; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/shim.js new file mode 100644 index 00000000..fc77287f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log10/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var log = Math.log, LOG10E = Math.LOG10E; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < 0) return NaN; + if (x === 0) return -Infinity; + if (x === 1) return 0; + if (x === Infinity) return Infinity; + + return log(x) * LOG10E; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/implement.js new file mode 100644 index 00000000..f62f91f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'log1p', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/index.js new file mode 100644 index 00000000..107b1147 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.log1p + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/is-implemented.js new file mode 100644 index 00000000..61e90974 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var log1p = Math.log1p; + if (typeof log1p !== 'function') return false; + return log1p(1) === 0.6931471805599453; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/shim.js new file mode 100644 index 00000000..10acebca --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log1p/shim.js @@ -0,0 +1,17 @@ +// Thanks: https://github.com/monolithed/ECMAScript-6/blob/master/ES6.js + +'use strict'; + +var log = Math.log; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < -1) return NaN; + if (x === -1) return -Infinity; + if (x === 0) return x; + if (x === Infinity) return Infinity; + + if (x > -1.0e-8 && x < 1.0e-8) return (x - x * x / 2); + return log(1 + x); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/implement.js new file mode 100644 index 00000000..8483f095 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'log2', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/index.js new file mode 100644 index 00000000..87e9050a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.log2 + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/is-implemented.js new file mode 100644 index 00000000..802322fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var log2 = Math.log2; + if (typeof log2 !== 'function') return false; + return log2(3).toFixed(15) === '1.584962500721156'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/shim.js new file mode 100644 index 00000000..cd80994a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/log2/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var log = Math.log, LOG2E = Math.LOG2E; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < 0) return NaN; + if (x === 0) return -Infinity; + if (x === 1) return 0; + if (x === Infinity) return Infinity; + + return log(x) * LOG2E; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/implement.js new file mode 100644 index 00000000..b0db2f41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'sign', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/index.js new file mode 100644 index 00000000..b2326333 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.sign + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/is-implemented.js new file mode 100644 index 00000000..6d0de475 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var sign = Math.sign; + if (typeof sign !== 'function') return false; + return ((sign(10) === 1) && (sign(-20) === -1)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/shim.js new file mode 100644 index 00000000..4df9c95a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sign/shim.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (value) { + value = Number(value); + if (isNaN(value) || (value === 0)) return value; + return (value > 0) ? 1 : -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/implement.js new file mode 100644 index 00000000..f259a631 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'sinh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/index.js new file mode 100644 index 00000000..e5bea572 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.sinh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/is-implemented.js new file mode 100644 index 00000000..888ec67a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var sinh = Math.sinh; + if (typeof sinh !== 'function') return false; + return ((sinh(1) === 1.1752011936438014) && (sinh(Number.MIN_VALUE) === 5e-324)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/shim.js new file mode 100644 index 00000000..5b725bed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/sinh/shim.js @@ -0,0 +1,17 @@ +// Parts of implementation taken from es6-shim project +// See: https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js + +'use strict'; + +var expm1 = require('../expm1') + + , abs = Math.abs, exp = Math.exp, e = Math.E; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (!isFinite(x)) return x; + if (abs(x) < 1) return (expm1(x) - expm1(-x)) / 2; + return (exp(x - 1) - exp(-x - 1)) * e / 2; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/implement.js new file mode 100644 index 00000000..5199a029 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'tanh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/index.js new file mode 100644 index 00000000..6099c408 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.tanh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/is-implemented.js new file mode 100644 index 00000000..a7d22237 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var tanh = Math.tanh; + if (typeof tanh !== 'function') return false; + return ((tanh(1) === 0.7615941559557649) && (tanh(Number.MAX_VALUE) === 1)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/shim.js new file mode 100644 index 00000000..f6e948f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/tanh/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +var exp = Math.exp; + +module.exports = function (x) { + var a, b; + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (x === Infinity) return 1; + if (x === -Infinity) return -1; + a = exp(x); + if (a === Infinity) return 1; + b = exp(-x); + if (b === Infinity) return -1; + return (a - b) / (a + b); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/implement.js new file mode 100644 index 00000000..3ee80ab2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'trunc', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/index.js new file mode 100644 index 00000000..0b0f9b2a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.trunc + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/is-implemented.js new file mode 100644 index 00000000..3e8cde1f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var trunc = Math.trunc; + if (typeof trunc !== 'function') return false; + return (trunc(13.67) === 13) && (trunc(-13.67) === -13); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/shim.js new file mode 100644 index 00000000..02e2c2ad --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/math/trunc/shim.js @@ -0,0 +1,13 @@ +'use strict'; + +var floor = Math.floor; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (x === Infinity) return Infinity; + if (x === -Infinity) return -Infinity; + if (x > 0) return floor(x); + return -floor(-x); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/.lint new file mode 100644 index 00000000..1851752f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/.lint @@ -0,0 +1,13 @@ +@root + +module + +tabs +indent 2 +maxlen 100 + +ass +nomen +plusplus +newcap +vars diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/.travis.yml new file mode 100644 index 00000000..afd3509a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+es6-symbol@medikoo.com diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/CHANGES new file mode 100644 index 00000000..df8c27ef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/CHANGES @@ -0,0 +1,34 @@ +v2.0.1 -- 2015.01.28 +* Fix Symbol.prototype[Symbol.isPrimitive] implementation +* Improve validation within Symbol.prototype.toString and + Symbol.prototype.valueOf + +v2.0.0 -- 2015.01.28 +* Update up to changes in specification: + * Implement `for` and `keyFor` + * Remove `Symbol.create` and `Symbol.isRegExp` + * Add `Symbol.match`, `Symbol.replace`, `Symbol.search`, `Symbol.species` and + `Symbol.split` +* Rename `validSymbol` to `validateSymbol` +* Improve documentation +* Remove dead test modules + +v1.0.0 -- 2015.01.26 +* Fix enumerability for symbol properties set normally (e.g. obj[symbol] = value) +* Introduce initialization via hidden constructor +* Fix isSymbol handling of polyfill values when native Symbol is present +* Fix spelling of LICENSE +* Configure lint scripts + +v0.1.1 -- 2014.10.07 +* Fix isImplemented, so it returns true in case of polyfill +* Improve documentations + +v0.1.0 -- 2014.04.28 +* Assure strictly npm dependencies +* Update to use latest versions of dependencies +* Fix implementation detection so it doesn't crash on `String(symbol)` +* throw on `new Symbol()` (as decided by TC39) + +v0.0.0 -- 2013.11.15 +* Initial (dev) version \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/LICENSE new file mode 100644 index 00000000..04724a3a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/README.md new file mode 100644 index 00000000..95d6780b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/README.md @@ -0,0 +1,71 @@ +# es6-symbol +## ECMAScript 6 Symbol polyfill + +For more information about symbols see following links +- [Symbols in ECMAScript 6 by Axel Rauschmayer](http://www.2ality.com/2014/12/es6-symbols.html) +- [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) +- [Specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-constructor) + +### Limitations + +Underneath it uses real string property names which can easily be retrieved, however accidental collision with other property names is unlikely. + +### Usage + +If you'd like to use native version when it exists and fallback to polyfill if it doesn't (but without implementing `Symbol` on global scope), do: + +```javascript +var Symbol = require('es6-symbol'); +``` + +If you want to make sure your environment implements `Symbol`, do: + +```javascript +require('es6-symbol/implement'); +``` + +If you strictly want to use polyfill even if native `Symbol` exists (hard to find a good reason for that), do: + +```javascript +var Symbol = require('es6-symbol/polyfill'); +``` + +#### API + +Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-objects). Still if you want quick look, follow examples: + +```javascript +var Symbol = require('es6-symbol'); + +var symbol = Symbol('My custom symbol'); +var x = {}; + +x[symbol] = 'foo'; +console.log(x[symbol]); 'foo' + +// Detect iterable: +var iterator, result; +if (possiblyIterable[Symbol.iterator]) { + iterator = possiblyIterable[Symbol.iterator](); + result = iterator.next(); + while(!result.done) { + console.log(result.value); + result = iterator.next(); + } +} +``` + +### Installation +#### NPM + +In your project path: + + $ npm install es6-symbol + +##### Browser + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +## Tests [![Build Status](https://travis-ci.org/medikoo/es6-symbol.png)](https://travis-ci.org/medikoo/es6-symbol) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/implement.js new file mode 100644 index 00000000..153edacd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(require('es5-ext/global'), 'Symbol', + { value: require('./polyfill'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/index.js new file mode 100644 index 00000000..609f1faf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? Symbol : require('./polyfill'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/is-implemented.js new file mode 100644 index 00000000..53759f32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/is-implemented.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function () { + var symbol; + if (typeof Symbol !== 'function') return false; + symbol = Symbol('test symbol'); + try { String(symbol); } catch (e) { return false; } + if (typeof Symbol.iterator === 'symbol') return true; + + // Return 'true' for polyfills + if (typeof Symbol.isConcatSpreadable !== 'object') return false; + if (typeof Symbol.iterator !== 'object') return false; + if (typeof Symbol.toPrimitive !== 'object') return false; + if (typeof Symbol.toStringTag !== 'object') return false; + if (typeof Symbol.unscopables !== 'object') return false; + + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/is-native-implemented.js new file mode 100644 index 00000000..a8cb8b86 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/is-native-implemented.js @@ -0,0 +1,8 @@ +// Exports true if environment provides native `Symbol` implementation + +'use strict'; + +module.exports = (function () { + if (typeof Symbol !== 'function') return false; + return (typeof Symbol.iterator === 'symbol'); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/is-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/is-symbol.js new file mode 100644 index 00000000..beeba2cb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/is-symbol.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (x) { + return (x && ((typeof x === 'symbol') || (x['@@toStringTag'] === 'Symbol'))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/package.json new file mode 100644 index 00000000..0efffeae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/package.json @@ -0,0 +1,63 @@ +{ + "name": "es6-symbol", + "version": "2.0.1", + "description": "ECMAScript6 Symbol polyfill", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "symbol", + "private", + "property", + "es6", + "ecmascript", + "harmony" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es6-symbol.git" + }, + "dependencies": { + "d": "~0.1.1", + "es5-ext": "~0.10.5" + }, + "devDependencies": { + "tad": "~0.2.1", + "xlint": "~0.2.2", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "51f6938d7830269fefa38f02eb912f5472b3ccd7", + "bugs": { + "url": "https://github.com/medikoo/es6-symbol/issues" + }, + "homepage": "https://github.com/medikoo/es6-symbol", + "_id": "es6-symbol@2.0.1", + "_shasum": "761b5c67cfd4f1d18afb234f691d678682cb3bf3", + "_from": "es6-symbol@>=2.0.1 <2.1.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "761b5c67cfd4f1d18afb234f691d678682cb3bf3", + "tarball": "http://registry.npmjs.org/es6-symbol/-/es6-symbol-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/polyfill.js new file mode 100644 index 00000000..735eb676 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/polyfill.js @@ -0,0 +1,77 @@ +'use strict'; + +var d = require('d') + , validateSymbol = require('./validate-symbol') + + , create = Object.create, defineProperties = Object.defineProperties + , defineProperty = Object.defineProperty, objPrototype = Object.prototype + , Symbol, HiddenSymbol, globalSymbols = create(null); + +var generateName = (function () { + var created = create(null); + return function (desc) { + var postfix = 0, name; + while (created[desc + (postfix || '')]) ++postfix; + desc += (postfix || ''); + created[desc] = true; + name = '@@' + desc; + defineProperty(objPrototype, name, d.gs(null, function (value) { + defineProperty(this, name, d(value)); + })); + return name; + }; +}()); + +HiddenSymbol = function Symbol(description) { + if (this instanceof HiddenSymbol) throw new TypeError('TypeError: Symbol is not a constructor'); + return Symbol(description); +}; +module.exports = Symbol = function Symbol(description) { + var symbol; + if (this instanceof Symbol) throw new TypeError('TypeError: Symbol is not a constructor'); + symbol = create(HiddenSymbol.prototype); + description = (description === undefined ? '' : String(description)); + return defineProperties(symbol, { + __description__: d('', description), + __name__: d('', generateName(description)) + }); +}; +defineProperties(Symbol, { + for: d(function (key) { + if (globalSymbols[key]) return globalSymbols[key]; + return (globalSymbols[key] = Symbol(String(key))); + }), + keyFor: d(function (s) { + var key; + validateSymbol(s); + for (key in globalSymbols) if (globalSymbols[key] === s) return key; + }), + hasInstance: d('', Symbol('hasInstance')), + isConcatSpreadable: d('', Symbol('isConcatSpreadable')), + iterator: d('', Symbol('iterator')), + match: d('', Symbol('match')), + replace: d('', Symbol('replace')), + search: d('', Symbol('search')), + species: d('', Symbol('species')), + split: d('', Symbol('split')), + toPrimitive: d('', Symbol('toPrimitive')), + toStringTag: d('', Symbol('toStringTag')), + unscopables: d('', Symbol('unscopables')) +}); +defineProperties(HiddenSymbol.prototype, { + constructor: d(Symbol), + toString: d('', function () { return this.__name__; }) +}); + +defineProperties(Symbol.prototype, { + toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }), + valueOf: d(function () { return validateSymbol(this); }) +}); +defineProperty(Symbol.prototype, Symbol.toPrimitive, d('', + function () { return validateSymbol(this); })); +defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol')); + +defineProperty(HiddenSymbol.prototype, Symbol.toPrimitive, + d('c', Symbol.prototype[Symbol.toPrimitive])); +defineProperty(HiddenSymbol.prototype, Symbol.toStringTag, + d('c', Symbol.prototype[Symbol.toStringTag])); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/implement.js new file mode 100644 index 00000000..eb35c301 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/implement.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof Symbol, 'function'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/index.js new file mode 100644 index 00000000..62b3296d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var d = require('d') + + , defineProperty = Object.defineProperty; + +module.exports = function (T, a) { + var symbol = T('test'), x = {}; + defineProperty(x, symbol, d('foo')); + a(x.test, undefined, "Name"); + a(x[symbol], 'foo', "Get"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/is-implemented.js new file mode 100644 index 00000000..bb0d6453 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +var global = require('es5-ext/global') + , polyfill = require('../polyfill'); + +module.exports = function (t, a) { + var cache; + a(typeof t(), 'boolean'); + cache = global.Symbol; + global.Symbol = polyfill; + a(t(), true); + if (cache === undefined) delete global.Symbol; + else global.Symbol = cache; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/is-native-implemented.js new file mode 100644 index 00000000..df8ba032 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/is-native-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t, 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/is-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/is-symbol.js new file mode 100644 index 00000000..ac24b9ab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/is-symbol.js @@ -0,0 +1,16 @@ +'use strict'; + +var SymbolPoly = require('../polyfill'); + +module.exports = function (t, a) { + a(t(undefined), false, "Undefined"); + a(t(null), false, "Null"); + a(t(true), false, "Primitive"); + a(t('raz'), false, "String"); + a(t({}), false, "Object"); + a(t([]), false, "Array"); + if (typeof Symbol !== 'undefined') { + a(t(Symbol()), true, "Native"); + } + a(t(SymbolPoly()), true, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/polyfill.js new file mode 100644 index 00000000..83fb5e92 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/polyfill.js @@ -0,0 +1,27 @@ +'use strict'; + +var d = require('d') + , isSymbol = require('../is-symbol') + + , defineProperty = Object.defineProperty; + +module.exports = function (T, a) { + var symbol = T('test'), x = {}; + defineProperty(x, symbol, d('foo')); + a(x.test, undefined, "Name"); + a(x[symbol], 'foo', "Get"); + a(x instanceof T, false); + + a(isSymbol(symbol), true, "Symbol"); + a(isSymbol(T.iterator), true, "iterator"); + a(isSymbol(T.toStringTag), true, "toStringTag"); + + x = {}; + x[symbol] = 'foo'; + a.deep(Object.getOwnPropertyDescriptor(x, symbol), { configurable: true, enumerable: false, + value: 'foo', writable: true }); + symbol = T.for('marko'); + a(isSymbol(symbol), true); + a(T.for('marko'), symbol); + a(T.keyFor(symbol), 'marko'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/validate-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/validate-symbol.js new file mode 100644 index 00000000..2c8f84c8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/test/validate-symbol.js @@ -0,0 +1,19 @@ +'use strict'; + +var SymbolPoly = require('../polyfill'); + +module.exports = function (t, a) { + var symbol; + a.throws(function () { t(undefined); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.throws(function () { t(true); }, TypeError, "Primitive"); + a.throws(function () { t('raz'); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Object"); + a.throws(function () { t([]); }, TypeError, "Array"); + if (typeof Symbol !== 'undefined') { + symbol = Symbol(); + a(t(symbol), symbol, "Native"); + } + symbol = SymbolPoly(); + a(t(symbol), symbol, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/validate-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/validate-symbol.js new file mode 100644 index 00000000..42750043 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/node_modules/es6-symbol/validate-symbol.js @@ -0,0 +1,8 @@ +'use strict'; + +var isSymbol = require('./is-symbol'); + +module.exports = function (value) { + if (!isSymbol(value)) throw new TypeError(value + " is not a symbol"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/#/index.js new file mode 100644 index 00000000..32481170 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/#/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + pad: require('./pad') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/#/pad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/#/pad.js new file mode 100644 index 00000000..4478f6a1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/#/pad.js @@ -0,0 +1,15 @@ +'use strict'; + +var pad = require('../../string/#/pad') + , toPosInt = require('../to-pos-integer') + + , toFixed = Number.prototype.toFixed; + +module.exports = function (length/*, precision*/) { + var precision; + length = toPosInt(length); + precision = toPosInt(arguments[1]); + + return pad.call(precision ? toFixed.call(this, precision) : this, + '0', length + (precision ? (1 + precision) : 0)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/epsilon/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/epsilon/implement.js new file mode 100644 index 00000000..f0a670ae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/epsilon/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'EPSILON', { value: require('./'), + configurable: false, enumerable: false, writable: false }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/epsilon/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/epsilon/index.js new file mode 100644 index 00000000..4e4b621b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/epsilon/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = 2.220446049250313e-16; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/epsilon/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/epsilon/is-implemented.js new file mode 100644 index 00000000..141f5d2f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/epsilon/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return (typeof Number.EPSILON === 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/index.js new file mode 100644 index 00000000..35daf78e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/index.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + EPSILON: require('./epsilon'), + isFinite: require('./is-finite'), + isInteger: require('./is-integer'), + isNaN: require('./is-nan'), + isNumber: require('./is-number'), + isSafeInteger: require('./is-safe-integer'), + MAX_SAFE_INTEGER: require('./max-safe-integer'), + MIN_SAFE_INTEGER: require('./min-safe-integer'), + toInteger: require('./to-integer'), + toPosInteger: require('./to-pos-integer'), + toUint32: require('./to-uint32') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/implement.js new file mode 100644 index 00000000..51d7cac0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'isFinite', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/index.js new file mode 100644 index 00000000..15d5f405 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Number.isFinite + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/is-implemented.js new file mode 100644 index 00000000..556e396b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var isFinite = Number.isFinite; + if (typeof isFinite !== 'function') return false; + return !isFinite('23') && isFinite(34) && !isFinite(Infinity); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/shim.js new file mode 100644 index 00000000..e3aee551 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-finite/shim.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (value) { + return (typeof value === 'number') && isFinite(value); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/implement.js new file mode 100644 index 00000000..fe53f281 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'isInteger', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/index.js new file mode 100644 index 00000000..55e039a9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Number.isInteger + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/is-implemented.js new file mode 100644 index 00000000..a0e573be --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var isInteger = Number.isInteger; + if (typeof isInteger !== 'function') return false; + return !isInteger('23') && isInteger(34) && !isInteger(32.34); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/shim.js new file mode 100644 index 00000000..54029398 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-integer/shim.js @@ -0,0 +1,8 @@ +// Credit: http://www.2ality.com/2014/05/is-integer.html + +'use strict'; + +module.exports = function (value) { + if (typeof value !== 'number') return false; + return (value % 1 === 0); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/implement.js new file mode 100644 index 00000000..e1c5deea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'isNaN', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/index.js new file mode 100644 index 00000000..3b2c4ca6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Number.isNaN + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/is-implemented.js new file mode 100644 index 00000000..4cf27665 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var isNaN = Number.isNaN; + if (typeof isNaN !== 'function') return false; + return !isNaN({}) && isNaN(NaN) && !isNaN(34); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/shim.js new file mode 100644 index 00000000..070d96cd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-nan/shim.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (value) { return (value !== value); } //jslint: ignore diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-number.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-number.js new file mode 100644 index 00000000..19a99e4f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-number.js @@ -0,0 +1,11 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(1); + +module.exports = function (x) { + return ((typeof x === 'number') || + ((x instanceof Number) || + ((typeof x === 'object') && (toString.call(x) === id)))); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/implement.js new file mode 100644 index 00000000..51cef960 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'isSafeInteger', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/index.js new file mode 100644 index 00000000..49adeaaf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Number.isSafeInteger + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/is-implemented.js new file mode 100644 index 00000000..510b60e4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function () { + var isSafeInteger = Number.isSafeInteger; + if (typeof isSafeInteger !== 'function') return false; + return !isSafeInteger('23') && isSafeInteger(34232322323) && + !isSafeInteger(9007199254740992); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/shim.js new file mode 100644 index 00000000..692acdd6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/is-safe-integer/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +var isInteger = require('../is-integer/shim') + , maxValue = require('../max-safe-integer') + + , abs = Math.abs; + +module.exports = function (value) { + if (!isInteger(value)) return false; + return abs(value) <= maxValue; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/max-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/max-safe-integer/implement.js new file mode 100644 index 00000000..4e0bb574 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/max-safe-integer/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'MAX_SAFE_INTEGER', { value: require('./'), + configurable: false, enumerable: false, writable: false }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/max-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/max-safe-integer/index.js new file mode 100644 index 00000000..ed5d6a53 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/max-safe-integer/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = Math.pow(2, 53) - 1; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/max-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/max-safe-integer/is-implemented.js new file mode 100644 index 00000000..7bd08a9d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/max-safe-integer/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return (typeof Number.MAX_SAFE_INTEGER === 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/min-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/min-safe-integer/implement.js new file mode 100644 index 00000000..e3f110e4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/min-safe-integer/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'MIN_SAFE_INTEGER', { value: require('./'), + configurable: false, enumerable: false, writable: false }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/min-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/min-safe-integer/index.js new file mode 100644 index 00000000..1c6cc274 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/min-safe-integer/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = -(Math.pow(2, 53) - 1); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/min-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/min-safe-integer/is-implemented.js new file mode 100644 index 00000000..efc9875f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/min-safe-integer/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return (typeof Number.MIN_SAFE_INTEGER === 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/to-integer.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/to-integer.js new file mode 100644 index 00000000..60e798c5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/to-integer.js @@ -0,0 +1,12 @@ +'use strict'; + +var sign = require('../math/sign') + + , abs = Math.abs, floor = Math.floor; + +module.exports = function (value) { + if (isNaN(value)) return 0; + value = Number(value); + if ((value === 0) || !isFinite(value)) return value; + return sign(value) * floor(abs(value)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/to-pos-integer.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/to-pos-integer.js new file mode 100644 index 00000000..605a302c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/to-pos-integer.js @@ -0,0 +1,7 @@ +'use strict'; + +var toInteger = require('./to-integer') + + , max = Math.max; + +module.exports = function (value) { return max(0, toInteger(value)); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/to-uint32.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/to-uint32.js new file mode 100644 index 00000000..6263e85e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/number/to-uint32.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (value) { return value >>> 0; }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/_iterate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/_iterate.js new file mode 100644 index 00000000..bf2c55d0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/_iterate.js @@ -0,0 +1,29 @@ +// Internal method, used by iteration functions. +// Calls a function for each key-value pair found in object +// Optionally takes compareFn to iterate object in specific order + +'use strict'; + +var isCallable = require('./is-callable') + , callable = require('./valid-callable') + , value = require('./valid-value') + + , call = Function.prototype.call, keys = Object.keys + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable; + +module.exports = function (method, defVal) { + return function (obj, cb/*, thisArg, compareFn*/) { + var list, thisArg = arguments[2], compareFn = arguments[3]; + obj = Object(value(obj)); + callable(cb); + + list = keys(obj); + if (compareFn) { + list.sort(isCallable(compareFn) ? compareFn.bind(obj) : undefined); + } + return list[method](function (key, index) { + if (!propertyIsEnumerable.call(obj, key)) return defVal; + return call.call(cb, thisArg, obj[key], key, obj, index); + }); + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/implement.js new file mode 100644 index 00000000..3bcc68e3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Object, 'assign', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/index.js new file mode 100644 index 00000000..ab0f9f24 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Object.assign + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/is-implemented.js new file mode 100644 index 00000000..579ad2dd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function () { + var assign = Object.assign, obj; + if (typeof assign !== 'function') return false; + obj = { foo: 'raz' }; + assign(obj, { bar: 'dwa' }, { trzy: 'trzy' }); + return (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/shim.js new file mode 100644 index 00000000..74da11a8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/assign/shim.js @@ -0,0 +1,22 @@ +'use strict'; + +var keys = require('../keys') + , value = require('../valid-value') + + , max = Math.max; + +module.exports = function (dest, src/*, …srcn*/) { + var error, i, l = max(arguments.length, 2), assign; + dest = Object(value(dest)); + assign = function (key) { + try { dest[key] = src[key]; } catch (e) { + if (!error) error = e; + } + }; + for (i = 1; i < l; ++i) { + src = arguments[i]; + keys(src).forEach(assign); + } + if (error !== undefined) throw error; + return dest; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/clear.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/clear.js new file mode 100644 index 00000000..85e46372 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/clear.js @@ -0,0 +1,16 @@ +'use strict'; + +var keys = require('./keys'); + +module.exports = function (obj) { + var error; + keys(obj).forEach(function (key) { + try { + delete this[key]; + } catch (e) { + if (!error) error = e; + } + }, obj); + if (error !== undefined) throw error; + return obj; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/compact.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/compact.js new file mode 100644 index 00000000..d021da45 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/compact.js @@ -0,0 +1,7 @@ +'use strict'; + +var filter = require('./filter'); + +module.exports = function (obj) { + return filter(obj, function (val) { return val != null; }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/compare.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/compare.js new file mode 100644 index 00000000..2ab11f1a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/compare.js @@ -0,0 +1,42 @@ +'use strict'; + +var strCompare = require('../string/#/case-insensitive-compare') + , isObject = require('./is-object') + + , resolve, typeMap; + +typeMap = { + undefined: 0, + object: 1, + boolean: 2, + string: 3, + number: 4 +}; + +resolve = function (a) { + if (isObject(a)) { + if (typeof a.valueOf !== 'function') return NaN; + a = a.valueOf(); + if (isObject(a)) { + if (typeof a.toString !== 'function') return NaN; + a = a.toString(); + if (typeof a !== 'string') return NaN; + } + } + return a; +}; + +module.exports = function (a, b) { + if (a === b) return 0; // Same + + a = resolve(a); + b = resolve(b); + if (a == b) return typeMap[typeof a] - typeMap[typeof b]; //jslint: ignore + if (a == null) return -1; + if (b == null) return 1; + if ((typeof a === 'string') || (typeof b === 'string')) { + return strCompare.call(a, b); + } + if ((a !== a) && (b !== b)) return 0; //jslint: ignore + return Number(a) - Number(b); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/copy-deep.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/copy-deep.js new file mode 100644 index 00000000..548e3ee4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/copy-deep.js @@ -0,0 +1,30 @@ +'use strict'; + +var isPlainObject = require('./is-plain-object') + , value = require('./valid-value') + + , keys = Object.keys + , copy; + +copy = function (source) { + var target = {}; + this[0].push(source); + this[1].push(target); + keys(source).forEach(function (key) { + var index; + if (!isPlainObject(source[key])) { + target[key] = source[key]; + return; + } + index = this[0].indexOf(source[key]); + if (index === -1) target[key] = copy.call(this, source[key]); + else target[key] = this[1][index]; + }, this); + return target; +}; + +module.exports = function (source) { + var obj = Object(value(source)); + if (obj !== source) return obj; + return copy.call([[], []], obj); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/copy.js new file mode 100644 index 00000000..4d717728 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/copy.js @@ -0,0 +1,10 @@ +'use strict'; + +var assign = require('./assign') + , value = require('./valid-value'); + +module.exports = function (obj) { + var copy = Object(value(obj)); + if (copy !== obj) return copy; + return assign({}, obj); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/count.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/count.js new file mode 100644 index 00000000..29cfbb53 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/count.js @@ -0,0 +1,5 @@ +'use strict'; + +var keys = require('./keys'); + +module.exports = function (obj) { return keys(obj).length; }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/create.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/create.js new file mode 100644 index 00000000..f813b466 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/create.js @@ -0,0 +1,36 @@ +// Workaround for http://code.google.com/p/v8/issues/detail?id=2804 + +'use strict'; + +var create = Object.create, shim; + +if (!require('./set-prototype-of/is-implemented')()) { + shim = require('./set-prototype-of/shim'); +} + +module.exports = (function () { + var nullObject, props, desc; + if (!shim) return create; + if (shim.level !== 1) return create; + + nullObject = {}; + props = {}; + desc = { configurable: false, enumerable: false, writable: true, + value: undefined }; + Object.getOwnPropertyNames(Object.prototype).forEach(function (name) { + if (name === '__proto__') { + props[name] = { configurable: true, enumerable: false, writable: true, + value: undefined }; + return; + } + props[name] = desc; + }); + Object.defineProperties(nullObject, props); + + Object.defineProperty(shim, 'nullPolyfill', { configurable: false, + enumerable: false, writable: false, value: nullObject }); + + return function (prototype, props) { + return create((prototype === null) ? nullObject : prototype, props); + }; +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/eq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/eq.js new file mode 100644 index 00000000..037937ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/eq.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (x, y) { + return ((x === y) || ((x !== x) && (y !== y))); //jslint: ignore +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/every.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/every.js new file mode 100644 index 00000000..1303db20 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/every.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./_iterate')('every', true); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/filter.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/filter.js new file mode 100644 index 00000000..e5edb49b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/filter.js @@ -0,0 +1,15 @@ +'use strict'; + +var callable = require('./valid-callable') + , forEach = require('./for-each') + + , call = Function.prototype.call; + +module.exports = function (obj, cb/*, thisArg*/) { + var o = {}, thisArg = arguments[2]; + callable(cb); + forEach(obj, function (value, key, obj, index) { + if (call.call(cb, thisArg, value, key, obj, index)) o[key] = obj[key]; + }); + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/first-key.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/first-key.js new file mode 100644 index 00000000..7df10b2f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/first-key.js @@ -0,0 +1,14 @@ +'use strict'; + +var value = require('./valid-value') + + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable; + +module.exports = function (obj) { + var i; + value(obj); + for (i in obj) { + if (propertyIsEnumerable.call(obj, i)) return i; + } + return null; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/flatten.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/flatten.js new file mode 100644 index 00000000..e8b40444 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/flatten.js @@ -0,0 +1,17 @@ +'use strict'; + +var isPlainObject = require('./is-plain-object') + , forEach = require('./for-each') + + , process; + +process = function self(value, key) { + if (isPlainObject(value)) forEach(value, self, this); + else this[key] = value; +}; + +module.exports = function (obj) { + var flattened = {}; + forEach(obj, process, flattened); + return flattened; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/for-each.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/for-each.js new file mode 100644 index 00000000..6674f8a6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/for-each.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./_iterate')('forEach'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/get-property-names.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/get-property-names.js new file mode 100644 index 00000000..54a01e50 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/get-property-names.js @@ -0,0 +1,18 @@ +'use strict'; + +var uniq = require('../array/#/uniq') + , value = require('./valid-value') + + , push = Array.prototype.push + , getOwnPropertyNames = Object.getOwnPropertyNames + , getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (obj) { + var keys; + obj = Object(value(obj)); + keys = getOwnPropertyNames(obj); + while ((obj = getPrototypeOf(obj))) { + push.apply(keys, getOwnPropertyNames(obj)); + } + return uniq.call(keys); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/index.js new file mode 100644 index 00000000..4bdf4035 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/index.js @@ -0,0 +1,48 @@ +'use strict'; + +module.exports = { + assign: require('./assign'), + clear: require('./clear'), + compact: require('./compact'), + compare: require('./compare'), + copy: require('./copy'), + copyDeep: require('./copy-deep'), + count: require('./count'), + create: require('./create'), + eq: require('./eq'), + every: require('./every'), + filter: require('./filter'), + firstKey: require('./first-key'), + flatten: require('./flatten'), + forEach: require('./for-each'), + getPropertyNames: require('./get-property-names'), + is: require('./is'), + isArrayLike: require('./is-array-like'), + isCallable: require('./is-callable'), + isCopy: require('./is-copy'), + isCopyDeep: require('./is-copy-deep'), + isEmpty: require('./is-empty'), + isObject: require('./is-object'), + isPlainObject: require('./is-plain-object'), + keyOf: require('./key-of'), + keys: require('./keys'), + map: require('./map'), + mapKeys: require('./map-keys'), + normalizeOptions: require('./normalize-options'), + mixin: require('./mixin'), + mixinPrototypes: require('./mixin-prototypes'), + primitiveSet: require('./primitive-set'), + safeTraverse: require('./safe-traverse'), + serialize: require('./serialize'), + setPrototypeOf: require('./set-prototype-of'), + some: require('./some'), + toArray: require('./to-array'), + unserialize: require('./unserialize'), + validateArrayLike: require('./validate-array-like'), + validateArrayLikeObject: require('./validate-array-like-object'), + validCallable: require('./valid-callable'), + validObject: require('./valid-object'), + validateStringifiable: require('./validate-stringifiable'), + validateStringifiableValue: require('./validate-stringifiable-value'), + validValue: require('./valid-value') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-array-like.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-array-like.js new file mode 100644 index 00000000..b8beed22 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-array-like.js @@ -0,0 +1,14 @@ +'use strict'; + +var isFunction = require('../function/is-function') + , isObject = require('./is-object'); + +module.exports = function (x) { + return ((x != null) && (typeof x.length === 'number') && + + // Just checking ((typeof x === 'object') && (typeof x !== 'function')) + // won't work right for some cases, e.g.: + // type of instance of NodeList in Safari is a 'function' + + ((isObject(x) && !isFunction(x)) || (typeof x === "string"))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-callable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-callable.js new file mode 100644 index 00000000..5d5d4b31 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-callable.js @@ -0,0 +1,5 @@ +// Deprecated + +'use strict'; + +module.exports = function (obj) { return typeof obj === 'function'; }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-copy-deep.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-copy-deep.js new file mode 100644 index 00000000..c4b2b42b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-copy-deep.js @@ -0,0 +1,58 @@ +'use strict'; + +var eq = require('./eq') + , isPlainObject = require('./is-plain-object') + , value = require('./valid-value') + + , isArray = Array.isArray, keys = Object.keys + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable + + , eqArr, eqVal, eqObj; + +eqArr = function (a, b, recMap) { + var i, l = a.length; + if (l !== b.length) return false; + for (i = 0; i < l; ++i) { + if (a.hasOwnProperty(i) !== b.hasOwnProperty(i)) return false; + if (!eqVal(a[i], b[i], recMap)) return false; + } + return true; +}; + +eqObj = function (a, b, recMap) { + var k1 = keys(a), k2 = keys(b); + if (k1.length !== k2.length) return false; + return k1.every(function (key) { + if (!propertyIsEnumerable.call(b, key)) return false; + return eqVal(a[key], b[key], recMap); + }); +}; + +eqVal = function (a, b, recMap) { + var i, eqX, c1, c2; + if (eq(a, b)) return true; + if (isPlainObject(a)) { + if (!isPlainObject(b)) return false; + eqX = eqObj; + } else if (isArray(a) && isArray(b)) { + eqX = eqArr; + } else { + return false; + } + c1 = recMap[0]; + c2 = recMap[1]; + i = c1.indexOf(a); + if (i !== -1) { + if (c2[i].indexOf(b) !== -1) return true; + } else { + i = c1.push(a) - 1; + c2[i] = []; + } + c2[i].push(b); + return eqX(a, b, recMap); +}; + +module.exports = function (a, b) { + if (eq(value(a), value(b))) return true; + return eqVal(Object(a), Object(b), [[], []]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-copy.js new file mode 100644 index 00000000..4fe639d4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-copy.js @@ -0,0 +1,24 @@ +'use strict'; + +var eq = require('./eq') + , value = require('./valid-value') + + , keys = Object.keys + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable; + +module.exports = function (a, b) { + var k1, k2; + + if (eq(value(a), value(b))) return true; + + a = Object(a); + b = Object(b); + + k1 = keys(a); + k2 = keys(b); + if (k1.length !== k2.length) return false; + return k1.every(function (key) { + if (!propertyIsEnumerable.call(b, key)) return false; + return eq(a[key], b[key]); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-empty.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-empty.js new file mode 100644 index 00000000..7b51a87c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-empty.js @@ -0,0 +1,14 @@ +'use strict'; + +var value = require('./valid-value') + + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable; + +module.exports = function (obj) { + var i; + value(obj); + for (i in obj) { //jslint: ignore + if (propertyIsEnumerable.call(obj, i)) return false; + } + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-object.js new file mode 100644 index 00000000..a86facf1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-object.js @@ -0,0 +1,7 @@ +'use strict'; + +var map = { function: true, object: true }; + +module.exports = function (x) { + return ((x != null) && map[typeof x]) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-plain-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-plain-object.js new file mode 100644 index 00000000..9a282319 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is-plain-object.js @@ -0,0 +1,20 @@ +'use strict'; + +var getPrototypeOf = Object.getPrototypeOf, prototype = Object.prototype + , toString = prototype.toString + + , id = Object().toString(); + +module.exports = function (value) { + var proto, constructor; + if (!value || (typeof value !== 'object') || (toString.call(value) !== id)) { + return false; + } + proto = getPrototypeOf(value); + if (proto === null) { + constructor = value.constructor; + if (typeof constructor !== 'function') return true; + return (constructor.prototype !== value); + } + return (proto === prototype) || (getPrototypeOf(proto) === null); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is.js new file mode 100644 index 00000000..5778b502 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/is.js @@ -0,0 +1,10 @@ +// Implementation credits go to: +// http://wiki.ecmascript.org/doku.php?id=harmony:egal + +'use strict'; + +module.exports = function (x, y) { + return (x === y) ? + ((x !== 0) || ((1 / x) === (1 / y))) : + ((x !== x) && (y !== y)); //jslint: ignore +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/key-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/key-of.js new file mode 100644 index 00000000..8c44c8d8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/key-of.js @@ -0,0 +1,15 @@ +'use strict'; + +var eq = require('./eq') + , some = require('./some'); + +module.exports = function (obj, searchValue) { + var r; + return some(obj, function (value, name) { + if (eq(value, searchValue)) { + r = name; + return true; + } + return false; + }) ? r : null; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/implement.js new file mode 100644 index 00000000..c6872bd0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Object, 'keys', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/index.js new file mode 100644 index 00000000..5ef05223 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Object.keys + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/is-implemented.js new file mode 100644 index 00000000..40c32c33 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function () { + try { + Object.keys('primitive'); + return true; + } catch (e) { return false; } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/shim.js new file mode 100644 index 00000000..034b6b29 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/keys/shim.js @@ -0,0 +1,7 @@ +'use strict'; + +var keys = Object.keys; + +module.exports = function (object) { + return keys(object == null ? object : Object(object)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/map-keys.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/map-keys.js new file mode 100644 index 00000000..26f0ecac --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/map-keys.js @@ -0,0 +1,15 @@ +'use strict'; + +var callable = require('./valid-callable') + , forEach = require('./for-each') + + , call = Function.prototype.call; + +module.exports = function (obj, cb/*, thisArg*/) { + var o = {}, thisArg = arguments[2]; + callable(cb); + forEach(obj, function (value, key, obj, index) { + o[call.call(cb, thisArg, key, value, this, index)] = value; + }, obj); + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/map.js new file mode 100644 index 00000000..6b39d3c9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/map.js @@ -0,0 +1,15 @@ +'use strict'; + +var callable = require('./valid-callable') + , forEach = require('./for-each') + + , call = Function.prototype.call; + +module.exports = function (obj, cb/*, thisArg*/) { + var o = {}, thisArg = arguments[2]; + callable(cb); + forEach(obj, function (value, key, obj, index) { + o[key] = call.call(cb, thisArg, value, key, obj, index); + }); + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/mixin-prototypes.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/mixin-prototypes.js new file mode 100644 index 00000000..1ef57564 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/mixin-prototypes.js @@ -0,0 +1,34 @@ +'use strict'; + +var value = require('./valid-value') + , mixin = require('./mixin') + + , defineProperty = Object.defineProperty + , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor + , getOwnPropertyNames = Object.getOwnPropertyNames + , getPrototypeOf = Object.getPrototypeOf + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function (target, source) { + var error, end, define; + target = Object(value(target)); + source = Object(value(source)); + end = getPrototypeOf(target); + if (source === end) return target; + try { + mixin(target, source); + } catch (e) { error = e; } + source = getPrototypeOf(source); + define = function (name) { + if (hasOwnProperty.call(target, name)) return; + try { + defineProperty(target, name, getOwnPropertyDescriptor(source, name)); + } catch (e) { error = e; } + }; + while (source && (source !== end)) { + getOwnPropertyNames(source).forEach(define); + source = getPrototypeOf(source); + } + if (error) throw error; + return target; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/mixin.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/mixin.js new file mode 100644 index 00000000..80b5df5e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/mixin.js @@ -0,0 +1,19 @@ +'use strict'; + +var value = require('./valid-value') + + , defineProperty = Object.defineProperty + , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor + , getOwnPropertyNames = Object.getOwnPropertyNames; + +module.exports = function (target, source) { + var error; + target = Object(value(target)); + getOwnPropertyNames(Object(value(source))).forEach(function (name) { + try { + defineProperty(target, name, getOwnPropertyDescriptor(source, name)); + } catch (e) { error = e; } + }); + if (error !== undefined) throw error; + return target; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/normalize-options.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/normalize-options.js new file mode 100644 index 00000000..cf8ed8d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/normalize-options.js @@ -0,0 +1,17 @@ +'use strict'; + +var forEach = Array.prototype.forEach, create = Object.create; + +var process = function (src, obj) { + var key; + for (key in src) obj[key] = src[key]; +}; + +module.exports = function (options/*, …options*/) { + var result = create(null); + forEach.call(arguments, function (options) { + if (options == null) return; + process(Object(options), result); + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/primitive-set.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/primitive-set.js new file mode 100644 index 00000000..ada10951 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/primitive-set.js @@ -0,0 +1,9 @@ +'use strict'; + +var forEach = Array.prototype.forEach, create = Object.create; + +module.exports = function (arg/*, …args*/) { + var set = create(null); + forEach.call(arguments, function (name) { set[name] = true; }); + return set; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/safe-traverse.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/safe-traverse.js new file mode 100644 index 00000000..7e1b5f41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/safe-traverse.js @@ -0,0 +1,15 @@ +'use strict'; + +var value = require('./valid-value'); + +module.exports = function (obj/*, …names*/) { + var length, current = 1; + value(obj); + length = arguments.length - 1; + if (!length) return obj; + while (current < length) { + obj = obj[arguments[current++]]; + if (obj == null) return undefined; + } + return obj[arguments[current]]; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/serialize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/serialize.js new file mode 100644 index 00000000..8113b680 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/serialize.js @@ -0,0 +1,36 @@ +'use strict'; + +var toArray = require('./to-array') + , isDate = require('../date/is-date') + , isRegExp = require('../reg-exp/is-reg-exp') + + , isArray = Array.isArray, stringify = JSON.stringify + , keyValueToString = function (value, key) { return stringify(key) + ':' + exports(value); }; + +var sparseMap = function (arr) { + var i, l = arr.length, result = new Array(l); + for (i = 0; i < l; ++i) { + if (!arr.hasOwnProperty(i)) continue; + result[i] = exports(arr[i]); + } + return result; +}; + +module.exports = exports = function (obj) { + if (obj == null) return String(obj); + switch (typeof obj) { + case 'string': + return stringify(obj); + case 'number': + case 'boolean': + case 'function': + return String(obj); + case 'object': + if (isArray(obj)) return '[' + sparseMap(obj) + ']'; + if (isRegExp(obj)) return String(obj); + if (isDate(obj)) return 'new Date(' + obj.valueOf() + ')'; + return '{' + toArray(obj, keyValueToString) + '}'; + default: + throw new TypeError("Serialization of " + String(obj) + "is unsupported"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/implement.js new file mode 100644 index 00000000..000e6bdb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/implement.js @@ -0,0 +1,8 @@ +'use strict'; + +var shim; + +if (!require('./is-implemented')() && (shim = require('./shim'))) { + Object.defineProperty(Object, 'setPrototypeOf', + { value: shim, configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/index.js new file mode 100644 index 00000000..ccc40995 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Object.setPrototypeOf + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/is-implemented.js new file mode 100644 index 00000000..98d0c843 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/is-implemented.js @@ -0,0 +1,11 @@ +'use strict'; + +var create = Object.create, getPrototypeOf = Object.getPrototypeOf + , x = {}; + +module.exports = function (/*customCreate*/) { + var setPrototypeOf = Object.setPrototypeOf + , customCreate = arguments[0] || create; + if (typeof setPrototypeOf !== 'function') return false; + return getPrototypeOf(setPrototypeOf(customCreate(null), x)) === x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/shim.js new file mode 100644 index 00000000..4ec94467 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/set-prototype-of/shim.js @@ -0,0 +1,73 @@ +// Big thanks to @WebReflection for sorting this out +// https://gist.github.com/WebReflection/5593554 + +'use strict'; + +var isObject = require('../is-object') + , value = require('../valid-value') + + , isPrototypeOf = Object.prototype.isPrototypeOf + , defineProperty = Object.defineProperty + , nullDesc = { configurable: true, enumerable: false, writable: true, + value: undefined } + , validate; + +validate = function (obj, prototype) { + value(obj); + if ((prototype === null) || isObject(prototype)) return obj; + throw new TypeError('Prototype must be null or an object'); +}; + +module.exports = (function (status) { + var fn, set; + if (!status) return null; + if (status.level === 2) { + if (status.set) { + set = status.set; + fn = function (obj, prototype) { + set.call(validate(obj, prototype), prototype); + return obj; + }; + } else { + fn = function (obj, prototype) { + validate(obj, prototype).__proto__ = prototype; + return obj; + }; + } + } else { + fn = function self(obj, prototype) { + var isNullBase; + validate(obj, prototype); + isNullBase = isPrototypeOf.call(self.nullPolyfill, obj); + if (isNullBase) delete self.nullPolyfill.__proto__; + if (prototype === null) prototype = self.nullPolyfill; + obj.__proto__ = prototype; + if (isNullBase) defineProperty(self.nullPolyfill, '__proto__', nullDesc); + return obj; + }; + } + return Object.defineProperty(fn, 'level', { configurable: false, + enumerable: false, writable: false, value: status.level }); +}((function () { + var x = Object.create(null), y = {}, set + , desc = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__'); + + if (desc) { + try { + set = desc.set; // Opera crashes at this point + set.call(x, y); + } catch (ignore) { } + if (Object.getPrototypeOf(x) === y) return { set: set, level: 2 }; + } + + x.__proto__ = y; + if (Object.getPrototypeOf(x) === y) return { level: 2 }; + + x = {}; + x.__proto__ = y; + if (Object.getPrototypeOf(x) === y) return { level: 1 }; + + return false; +}()))); + +require('../create'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/some.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/some.js new file mode 100644 index 00000000..cde5ddee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/some.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./_iterate')('some', false); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/to-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/to-array.js new file mode 100644 index 00000000..a954abb2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/to-array.js @@ -0,0 +1,18 @@ +'use strict'; + +var callable = require('./valid-callable') + , forEach = require('./for-each') + + , call = Function.prototype.call + + , defaultCb = function (value, key) { return [key, value]; }; + +module.exports = function (obj/*, cb, thisArg, compareFn*/) { + var a = [], cb = arguments[1], thisArg = arguments[2]; + cb = (cb == null) ? defaultCb : callable(cb); + + forEach(obj, function (value, key, obj, index) { + a.push(call.call(cb, thisArg, value, key, this, index)); + }, obj, arguments[3]); + return a; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/unserialize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/unserialize.js new file mode 100644 index 00000000..ce68e403 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/unserialize.js @@ -0,0 +1,7 @@ +'use strict'; + +var value = require('./valid-value'); + +module.exports = exports = function (code) { + return (new Function('return ' + value(code)))(); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/valid-callable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/valid-callable.js new file mode 100644 index 00000000..c977527a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/valid-callable.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (fn) { + if (typeof fn !== 'function') throw new TypeError(fn + " is not a function"); + return fn; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/valid-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/valid-object.js new file mode 100644 index 00000000..f82bd51e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/valid-object.js @@ -0,0 +1,8 @@ +'use strict'; + +var isObject = require('./is-object'); + +module.exports = function (value) { + if (!isObject(value)) throw new TypeError(value + " is not an Object"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/valid-value.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/valid-value.js new file mode 100644 index 00000000..36c8ec31 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/valid-value.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (value) { + if (value == null) throw new TypeError("Cannot use null or undefined"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-array-like-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-array-like-object.js new file mode 100644 index 00000000..89e12c51 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-array-like-object.js @@ -0,0 +1,9 @@ +'use strict'; + +var isArrayLike = require('./is-array-like') + , isObject = require('./is-object'); + +module.exports = function (obj) { + if (isObject(obj) && isArrayLike(obj)) return obj; + throw new TypeError(obj + " is not array-like object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-array-like.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-array-like.js new file mode 100644 index 00000000..6a35b54a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-array-like.js @@ -0,0 +1,8 @@ +'use strict'; + +var isArrayLike = require('./is-array-like'); + +module.exports = function (obj) { + if (isArrayLike(obj)) return obj; + throw new TypeError(obj + " is not array-like value"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-stringifiable-value.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-stringifiable-value.js new file mode 100644 index 00000000..9df3b668 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-stringifiable-value.js @@ -0,0 +1,6 @@ +'use strict'; + +var value = require('./valid-value') + , stringifiable = require('./validate-stringifiable'); + +module.exports = function (x) { return stringifiable(value(x)); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-stringifiable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-stringifiable.js new file mode 100644 index 00000000..eba7ce78 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/object/validate-stringifiable.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (stringifiable) { + try { + return String(stringifiable); + } catch (e) { + throw new TypeError("Passed argument cannot be stringifed"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/package.json new file mode 100644 index 00000000..01d65327 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/package.json @@ -0,0 +1,74 @@ +{ + "name": "es5-ext", + "version": "0.10.7", + "description": "ECMAScript 5 extensions and ES6 shims", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "ecmascript", + "ecmascript5", + "ecmascript6", + "es5", + "es6", + "extensions", + "ext", + "addons", + "extras", + "harmony", + "javascript", + "polyfill", + "shim", + "util", + "utils", + "utilities" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es5-ext.git" + }, + "dependencies": { + "es6-iterator": "~0.1.3", + "es6-symbol": "~2.0.1" + }, + "devDependencies": { + "tad": "~0.2.2", + "xlint": "~0.2.2", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "5b63ee02f50dfbc70dc1f62bc66b8718af443f83", + "bugs": { + "url": "https://github.com/medikoo/es5-ext/issues" + }, + "homepage": "https://github.com/medikoo/es5-ext", + "_id": "es5-ext@0.10.7", + "_shasum": "dfaea50721301042e2d89c1719d43493fa821656", + "_from": "es5-ext@>=0.10.6 <0.11.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "dfaea50721301042e2d89c1719d43493fa821656", + "tarball": "http://registry.npmjs.org/es5-ext/-/es5-ext-0.10.7.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.7.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/index.js new file mode 100644 index 00000000..f7e7a58e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + isSticky: require('./is-sticky'), + isUnicode: require('./is-unicode'), + match: require('./match'), + replace: require('./replace'), + search: require('./search'), + split: require('./split') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/is-sticky.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/is-sticky.js new file mode 100644 index 00000000..830a481f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/is-sticky.js @@ -0,0 +1,9 @@ +'use strict'; + +var validRegExp = require('../valid-reg-exp') + + , re = /\/[a-xz]*y[a-xz]*$/; + +module.exports = function () { + return Boolean(String(validRegExp(this)).match(re)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/is-unicode.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/is-unicode.js new file mode 100644 index 00000000..b005f6d9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/is-unicode.js @@ -0,0 +1,9 @@ +'use strict'; + +var validRegExp = require('../valid-reg-exp') + + , re = /\/[a-xz]*u[a-xz]*$/; + +module.exports = function () { + return Boolean(String(validRegExp(this)).match(re)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/implement.js new file mode 100644 index 00000000..921c9368 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'match', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/index.js new file mode 100644 index 00000000..0534ac3b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? RegExp.prototype.match + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/is-implemented.js new file mode 100644 index 00000000..b7e99643 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var re = /foo/; + +module.exports = function () { + if (typeof re.match !== 'function') return false; + return re.match('barfoobar') && !re.match('elo'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/shim.js new file mode 100644 index 00000000..4f99cf4d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/match/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var validRegExp = require('../../valid-reg-exp'); + +module.exports = function (string) { + validRegExp(this); + return String(string).match(this); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/implement.js new file mode 100644 index 00000000..ad580de8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'replace', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/index.js new file mode 100644 index 00000000..5658177d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? RegExp.prototype.replace + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/is-implemented.js new file mode 100644 index 00000000..1b42d252 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var re = /foo/; + +module.exports = function () { + if (typeof re.replace !== 'function') return false; + return re.replace('foobar', 'mar') === 'marbar'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/shim.js new file mode 100644 index 00000000..c3e6aeba --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/replace/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var validRegExp = require('../../valid-reg-exp'); + +module.exports = function (string, replaceValue) { + validRegExp(this); + return String(string).replace(this, replaceValue); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/implement.js new file mode 100644 index 00000000..3804f4eb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'search', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/index.js new file mode 100644 index 00000000..67995d4a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? RegExp.prototype.search + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/is-implemented.js new file mode 100644 index 00000000..efba889f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var re = /foo/; + +module.exports = function () { + if (typeof re.search !== 'function') return false; + return re.search('barfoo') === 3; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/shim.js new file mode 100644 index 00000000..6d9dcaed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/search/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var validRegExp = require('../../valid-reg-exp'); + +module.exports = function (string) { + validRegExp(this); + return String(string).search(this); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/implement.js new file mode 100644 index 00000000..50facb68 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'split', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/index.js new file mode 100644 index 00000000..f101f5af --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? RegExp.prototype.split + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/is-implemented.js new file mode 100644 index 00000000..7244c998 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var re = /\|/; + +module.exports = function () { + if (typeof re.split !== 'function') return false; + return re.split('bar|foo')[1] === 'foo'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/shim.js new file mode 100644 index 00000000..76154e7e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/split/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var validRegExp = require('../../valid-reg-exp'); + +module.exports = function (string) { + validRegExp(this); + return String(string).split(this); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/sticky/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/sticky/implement.js new file mode 100644 index 00000000..7e8af1db --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/sticky/implement.js @@ -0,0 +1,8 @@ +'use strict'; + +var isSticky = require('../is-sticky'); + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'sticky', { configurable: true, + enumerable: false, get: isSticky }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/sticky/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/sticky/is-implemented.js new file mode 100644 index 00000000..379c4a5a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/sticky/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return RegExp.prototype.sticky === false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/unicode/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/unicode/implement.js new file mode 100644 index 00000000..5a82a4d1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/unicode/implement.js @@ -0,0 +1,8 @@ +'use strict'; + +var isUnicode = require('../is-unicode'); + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'unicode', { configurable: true, + enumerable: false, get: isUnicode }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/unicode/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/unicode/is-implemented.js new file mode 100644 index 00000000..a8b15b3b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/#/unicode/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return RegExp.prototype.unicode === false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/escape.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/escape.js new file mode 100644 index 00000000..a2363fcf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/escape.js @@ -0,0 +1,9 @@ +// Thanks to Andrew Clover: +// http://stackoverflow.com/questions/3561493 +// /is-there-a-regexp-escape-function-in-javascript + +'use strict'; + +var re = /[\-\/\\\^$*+?.()|\[\]{}]/g; + +module.exports = function (str) { return String(str).replace(re, '\\$&'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/index.js new file mode 100644 index 00000000..75ea3135 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + escape: require('./escape'), + isRegExp: require('./is-reg-exp'), + validRegExp: require('./valid-reg-exp') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/is-reg-exp.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/is-reg-exp.js new file mode 100644 index 00000000..6eb12977 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/is-reg-exp.js @@ -0,0 +1,9 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(/a/); + +module.exports = function (x) { + return (x && (x instanceof RegExp || (toString.call(x) === id))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/valid-reg-exp.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/valid-reg-exp.js new file mode 100644 index 00000000..d3a77641 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/reg-exp/valid-reg-exp.js @@ -0,0 +1,8 @@ +'use strict'; + +var isRegExp = require('./is-reg-exp'); + +module.exports = function (x) { + if (!isRegExp(x)) throw new TypeError(x + " is not a RegExp object"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/implement.js new file mode 100644 index 00000000..4494d7b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, require('es6-symbol').iterator, + { value: require('./shim'), configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/index.js new file mode 100644 index 00000000..22f15e69 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype[require('es6-symbol').iterator] : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/is-implemented.js new file mode 100644 index 00000000..f5c462de --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/is-implemented.js @@ -0,0 +1,16 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function () { + var str = '🙈f', iterator, result; + if (typeof str[iteratorSymbol] !== 'function') return false; + iterator = str[iteratorSymbol](); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result) return false; + if (result.value !== '🙈') return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/shim.js new file mode 100644 index 00000000..0be30292 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/@@iterator/shim.js @@ -0,0 +1,6 @@ +'use strict'; + +var StringIterator = require('es6-iterator/string') + , value = require('../../../object/valid-value'); + +module.exports = function () { return new StringIterator(value(this)); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/at.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/at.js new file mode 100644 index 00000000..77bd251a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/at.js @@ -0,0 +1,33 @@ +// Based on: https://github.com/mathiasbynens/String.prototype.at +// Thanks @mathiasbynens ! + +'use strict'; + +var toInteger = require('../../number/to-integer') + , validValue = require('../../object/valid-value'); + +module.exports = function (pos) { + var str = String(validValue(this)), size = str.length + , cuFirst, cuSecond, nextPos, len; + pos = toInteger(pos); + + // Account for out-of-bounds indices + // The odd lower bound is because the ToInteger operation is + // going to round `n` to `0` for `-1 < n <= 0`. + if (pos <= -1 || pos >= size) return ''; + + // Second half of `ToInteger` + pos = pos | 0; + // Get the first code unit and code unit value + cuFirst = str.charCodeAt(pos); + nextPos = pos + 1; + len = 1; + if ( // check if it’s the start of a surrogate pair + (cuFirst >= 0xD800) && (cuFirst <= 0xDBFF) && // high surrogate + (size > nextPos) // there is a next code unit + ) { + cuSecond = str.charCodeAt(nextPos); + if (cuSecond >= 0xDC00 && cuSecond <= 0xDFFF) len = 2; // low surrogate + } + return str.slice(pos, pos + len); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/camel-to-hyphen.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/camel-to-hyphen.js new file mode 100644 index 00000000..1cb8d127 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/camel-to-hyphen.js @@ -0,0 +1,10 @@ +'use strict'; + +var replace = String.prototype.replace + , re = /([A-Z])/g; + +module.exports = function () { + var str = replace.call(this, re, "-$1").toLowerCase(); + if (str[0] === '-') str = str.slice(1); + return str; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/capitalize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/capitalize.js new file mode 100644 index 00000000..ed768273 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/capitalize.js @@ -0,0 +1,8 @@ +'use strict'; + +var value = require('../../object/valid-value'); + +module.exports = function () { + var str = String(value(this)); + return str.charAt(0).toUpperCase() + str.slice(1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/case-insensitive-compare.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/case-insensitive-compare.js new file mode 100644 index 00000000..599cb834 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/case-insensitive-compare.js @@ -0,0 +1,7 @@ +'use strict'; + +var toLowerCase = String.prototype.toLowerCase; + +module.exports = function (other) { + return toLowerCase.call(this).localeCompare(toLowerCase.call(String(other))); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/implement.js new file mode 100644 index 00000000..1e7a37bd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'codePointAt', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/index.js new file mode 100644 index 00000000..7e91d833 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.codePointAt + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/is-implemented.js new file mode 100644 index 00000000..b2715891 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'abc\uD834\uDF06def'; + +module.exports = function () { + if (typeof str.codePointAt !== 'function') return false; + return str.codePointAt(3) === 0x1D306; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/shim.js new file mode 100644 index 00000000..1c9038b3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/code-point-at/shim.js @@ -0,0 +1,26 @@ +// Based on: https://github.com/mathiasbynens/String.prototype.codePointAt +// Thanks @mathiasbynens ! + +'use strict'; + +var toInteger = require('../../../number/to-integer') + , validValue = require('../../../object/valid-value'); + +module.exports = function (pos) { + var str = String(validValue(this)), l = str.length, first, second; + pos = toInteger(pos); + + // Account for out-of-bounds indices: + if (pos < 0 || pos >= l) return undefined; + + // Get the first code unit + first = str.charCodeAt(pos); + if ((first >= 0xD800) && (first <= 0xDBFF) && (l > pos + 1)) { + second = str.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/implement.js new file mode 100644 index 00000000..6b7a3c08 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'contains', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/index.js new file mode 100644 index 00000000..abb3e373 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.contains + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/is-implemented.js new file mode 100644 index 00000000..6f7d4b71 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'razdwatrzy'; + +module.exports = function () { + if (typeof str.contains !== 'function') return false; + return ((str.contains('dwa') === true) && (str.contains('foo') === false)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/shim.js new file mode 100644 index 00000000..89e39e79 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/contains/shim.js @@ -0,0 +1,7 @@ +'use strict'; + +var indexOf = String.prototype.indexOf; + +module.exports = function (searchString/*, position*/) { + return indexOf.call(this, searchString, arguments[1]) > -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/implement.js new file mode 100644 index 00000000..0b09025b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'endsWith', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/index.js new file mode 100644 index 00000000..d2d94848 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.endsWith + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/is-implemented.js new file mode 100644 index 00000000..f3bb0088 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'razdwatrzy'; + +module.exports = function () { + if (typeof str.endsWith !== 'function') return false; + return ((str.endsWith('trzy') === true) && (str.endsWith('raz') === false)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/shim.js new file mode 100644 index 00000000..26cbdb13 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/ends-with/shim.js @@ -0,0 +1,16 @@ +'use strict'; + +var toInteger = require('../../../number/to-integer') + , value = require('../../../object/valid-value') + + , min = Math.min, max = Math.max; + +module.exports = function (searchString/*, endPosition*/) { + var self, start, endPos; + self = String(value(this)); + searchString = String(searchString); + endPos = arguments[1]; + start = ((endPos == null) ? self.length : + min(max(toInteger(endPos), 0), self.length)) - searchString.length; + return (start < 0) ? false : (self.indexOf(searchString, start) === start); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/hyphen-to-camel.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/hyphen-to-camel.js new file mode 100644 index 00000000..8928b024 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/hyphen-to-camel.js @@ -0,0 +1,8 @@ +'use strict'; + +var replace = String.prototype.replace + + , re = /-([a-z0-9])/g + , toUpperCase = function (m, a) { return a.toUpperCase(); }; + +module.exports = function () { return replace.call(this, re, toUpperCase); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/indent.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/indent.js new file mode 100644 index 00000000..223bd82b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/indent.js @@ -0,0 +1,12 @@ +'use strict'; + +var repeat = require('./repeat') + + , replace = String.prototype.replace + , re = /(\r\n|[\n\r\u2028\u2029])([\u0000-\u0009\u000b-\uffff]+)/g; + +module.exports = function (indent/*, count*/) { + var count = arguments[1]; + indent = repeat.call(String(indent), (count == null) ? 1 : count); + return indent + replace.call(this, re, '$1' + indent + '$2'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/index.js new file mode 100644 index 00000000..d45d747c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/index.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = { + '@@iterator': require('./@@iterator'), + at: require('./at'), + camelToHyphen: require('./camel-to-hyphen'), + capitalize: require('./capitalize'), + caseInsensitiveCompare: require('./case-insensitive-compare'), + codePointAt: require('./code-point-at'), + contains: require('./contains'), + hyphenToCamel: require('./hyphen-to-camel'), + endsWith: require('./ends-with'), + indent: require('./indent'), + last: require('./last'), + normalize: require('./normalize'), + pad: require('./pad'), + plainReplace: require('./plain-replace'), + plainReplaceAll: require('./plain-replace-all'), + repeat: require('./repeat'), + startsWith: require('./starts-with') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/last.js new file mode 100644 index 00000000..d5cf46ee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/last.js @@ -0,0 +1,8 @@ +'use strict'; + +var value = require('../../object/valid-value'); + +module.exports = function () { + var self = String(value(this)), l = self.length; + return l ? self[l - 1] : null; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/_data.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/_data.js new file mode 100644 index 00000000..e4e00a32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/_data.js @@ -0,0 +1,69 @@ +'use strict'; + +module.exports = { 0:{60:[,,{824:8814}],61:[,,{824:8800}],62:[,,{824:8815}],65:[,,{768:192,769:193,770:194,771:195,772:256,774:258,775:550,776:196,777:7842,778:197,780:461,783:512,785:514,803:7840,805:7680,808:260}],66:[,,{775:7682,803:7684,817:7686}],67:[,,{769:262,770:264,775:266,780:268,807:199}],68:[,,{775:7690,780:270,803:7692,807:7696,813:7698,817:7694}],69:[,,{768:200,769:201,770:202,771:7868,772:274,774:276,775:278,776:203,777:7866,780:282,783:516,785:518,803:7864,807:552,808:280,813:7704,816:7706}],70:[,,{775:7710}],71:[,,{769:500,770:284,772:7712,774:286,775:288,780:486,807:290}],72:[,,{770:292,775:7714,776:7718,780:542,803:7716,807:7720,814:7722}],73:[,,{768:204,769:205,770:206,771:296,772:298,774:300,775:304,776:207,777:7880,780:463,783:520,785:522,803:7882,808:302,816:7724}],74:[,,{770:308}],75:[,,{769:7728,780:488,803:7730,807:310,817:7732}],76:[,,{769:313,780:317,803:7734,807:315,813:7740,817:7738}],77:[,,{769:7742,775:7744,803:7746}],78:[,,{768:504,769:323,771:209,775:7748,780:327,803:7750,807:325,813:7754,817:7752}],79:[,,{768:210,769:211,770:212,771:213,772:332,774:334,775:558,776:214,777:7886,779:336,780:465,783:524,785:526,795:416,803:7884,808:490}],80:[,,{769:7764,775:7766}],82:[,,{769:340,775:7768,780:344,783:528,785:530,803:7770,807:342,817:7774}],83:[,,{769:346,770:348,775:7776,780:352,803:7778,806:536,807:350}],84:[,,{775:7786,780:356,803:7788,806:538,807:354,813:7792,817:7790}],85:[,,{768:217,769:218,770:219,771:360,772:362,774:364,776:220,777:7910,778:366,779:368,780:467,783:532,785:534,795:431,803:7908,804:7794,808:370,813:7798,816:7796}],86:[,,{771:7804,803:7806}],87:[,,{768:7808,769:7810,770:372,775:7814,776:7812,803:7816}],88:[,,{775:7818,776:7820}],89:[,,{768:7922,769:221,770:374,771:7928,772:562,775:7822,776:376,777:7926,803:7924}],90:[,,{769:377,770:7824,775:379,780:381,803:7826,817:7828}],97:[,,{768:224,769:225,770:226,771:227,772:257,774:259,775:551,776:228,777:7843,778:229,780:462,783:513,785:515,803:7841,805:7681,808:261}],98:[,,{775:7683,803:7685,817:7687}],99:[,,{769:263,770:265,775:267,780:269,807:231}],100:[,,{775:7691,780:271,803:7693,807:7697,813:7699,817:7695}],101:[,,{768:232,769:233,770:234,771:7869,772:275,774:277,775:279,776:235,777:7867,780:283,783:517,785:519,803:7865,807:553,808:281,813:7705,816:7707}],102:[,,{775:7711}],103:[,,{769:501,770:285,772:7713,774:287,775:289,780:487,807:291}],104:[,,{770:293,775:7715,776:7719,780:543,803:7717,807:7721,814:7723,817:7830}],105:[,,{768:236,769:237,770:238,771:297,772:299,774:301,776:239,777:7881,780:464,783:521,785:523,803:7883,808:303,816:7725}],106:[,,{770:309,780:496}],107:[,,{769:7729,780:489,803:7731,807:311,817:7733}],108:[,,{769:314,780:318,803:7735,807:316,813:7741,817:7739}],109:[,,{769:7743,775:7745,803:7747}],110:[,,{768:505,769:324,771:241,775:7749,780:328,803:7751,807:326,813:7755,817:7753}],111:[,,{768:242,769:243,770:244,771:245,772:333,774:335,775:559,776:246,777:7887,779:337,780:466,783:525,785:527,795:417,803:7885,808:491}],112:[,,{769:7765,775:7767}],114:[,,{769:341,775:7769,780:345,783:529,785:531,803:7771,807:343,817:7775}],115:[,,{769:347,770:349,775:7777,780:353,803:7779,806:537,807:351}],116:[,,{775:7787,776:7831,780:357,803:7789,806:539,807:355,813:7793,817:7791}],117:[,,{768:249,769:250,770:251,771:361,772:363,774:365,776:252,777:7911,778:367,779:369,780:468,783:533,785:535,795:432,803:7909,804:7795,808:371,813:7799,816:7797}],118:[,,{771:7805,803:7807}],119:[,,{768:7809,769:7811,770:373,775:7815,776:7813,778:7832,803:7817}],120:[,,{775:7819,776:7821}],121:[,,{768:7923,769:253,770:375,771:7929,772:563,775:7823,776:255,777:7927,778:7833,803:7925}],122:[,,{769:378,770:7825,775:380,780:382,803:7827,817:7829}],160:[[32],256],168:[[32,776],256,{768:8173,769:901,834:8129}],170:[[97],256],175:[[32,772],256],178:[[50],256],179:[[51],256],180:[[32,769],256],181:[[956],256],184:[[32,807],256],185:[[49],256],186:[[111],256],188:[[49,8260,52],256],189:[[49,8260,50],256],190:[[51,8260,52],256],192:[[65,768]],193:[[65,769]],194:[[65,770],,{768:7846,769:7844,771:7850,777:7848}],195:[[65,771]],196:[[65,776],,{772:478}],197:[[65,778],,{769:506}],198:[,,{769:508,772:482}],199:[[67,807],,{769:7688}],200:[[69,768]],201:[[69,769]],202:[[69,770],,{768:7872,769:7870,771:7876,777:7874}],203:[[69,776]],204:[[73,768]],205:[[73,769]],206:[[73,770]],207:[[73,776],,{769:7726}],209:[[78,771]],210:[[79,768]],211:[[79,769]],212:[[79,770],,{768:7890,769:7888,771:7894,777:7892}],213:[[79,771],,{769:7756,772:556,776:7758}],214:[[79,776],,{772:554}],216:[,,{769:510}],217:[[85,768]],218:[[85,769]],219:[[85,770]],220:[[85,776],,{768:475,769:471,772:469,780:473}],221:[[89,769]],224:[[97,768]],225:[[97,769]],226:[[97,770],,{768:7847,769:7845,771:7851,777:7849}],227:[[97,771]],228:[[97,776],,{772:479}],229:[[97,778],,{769:507}],230:[,,{769:509,772:483}],231:[[99,807],,{769:7689}],232:[[101,768]],233:[[101,769]],234:[[101,770],,{768:7873,769:7871,771:7877,777:7875}],235:[[101,776]],236:[[105,768]],237:[[105,769]],238:[[105,770]],239:[[105,776],,{769:7727}],241:[[110,771]],242:[[111,768]],243:[[111,769]],244:[[111,770],,{768:7891,769:7889,771:7895,777:7893}],245:[[111,771],,{769:7757,772:557,776:7759}],246:[[111,776],,{772:555}],248:[,,{769:511}],249:[[117,768]],250:[[117,769]],251:[[117,770]],252:[[117,776],,{768:476,769:472,772:470,780:474}],253:[[121,769]],255:[[121,776]]}, + 256:{256:[[65,772]],257:[[97,772]],258:[[65,774],,{768:7856,769:7854,771:7860,777:7858}],259:[[97,774],,{768:7857,769:7855,771:7861,777:7859}],260:[[65,808]],261:[[97,808]],262:[[67,769]],263:[[99,769]],264:[[67,770]],265:[[99,770]],266:[[67,775]],267:[[99,775]],268:[[67,780]],269:[[99,780]],270:[[68,780]],271:[[100,780]],274:[[69,772],,{768:7700,769:7702}],275:[[101,772],,{768:7701,769:7703}],276:[[69,774]],277:[[101,774]],278:[[69,775]],279:[[101,775]],280:[[69,808]],281:[[101,808]],282:[[69,780]],283:[[101,780]],284:[[71,770]],285:[[103,770]],286:[[71,774]],287:[[103,774]],288:[[71,775]],289:[[103,775]],290:[[71,807]],291:[[103,807]],292:[[72,770]],293:[[104,770]],296:[[73,771]],297:[[105,771]],298:[[73,772]],299:[[105,772]],300:[[73,774]],301:[[105,774]],302:[[73,808]],303:[[105,808]],304:[[73,775]],306:[[73,74],256],307:[[105,106],256],308:[[74,770]],309:[[106,770]],310:[[75,807]],311:[[107,807]],313:[[76,769]],314:[[108,769]],315:[[76,807]],316:[[108,807]],317:[[76,780]],318:[[108,780]],319:[[76,183],256],320:[[108,183],256],323:[[78,769]],324:[[110,769]],325:[[78,807]],326:[[110,807]],327:[[78,780]],328:[[110,780]],329:[[700,110],256],332:[[79,772],,{768:7760,769:7762}],333:[[111,772],,{768:7761,769:7763}],334:[[79,774]],335:[[111,774]],336:[[79,779]],337:[[111,779]],340:[[82,769]],341:[[114,769]],342:[[82,807]],343:[[114,807]],344:[[82,780]],345:[[114,780]],346:[[83,769],,{775:7780}],347:[[115,769],,{775:7781}],348:[[83,770]],349:[[115,770]],350:[[83,807]],351:[[115,807]],352:[[83,780],,{775:7782}],353:[[115,780],,{775:7783}],354:[[84,807]],355:[[116,807]],356:[[84,780]],357:[[116,780]],360:[[85,771],,{769:7800}],361:[[117,771],,{769:7801}],362:[[85,772],,{776:7802}],363:[[117,772],,{776:7803}],364:[[85,774]],365:[[117,774]],366:[[85,778]],367:[[117,778]],368:[[85,779]],369:[[117,779]],370:[[85,808]],371:[[117,808]],372:[[87,770]],373:[[119,770]],374:[[89,770]],375:[[121,770]],376:[[89,776]],377:[[90,769]],378:[[122,769]],379:[[90,775]],380:[[122,775]],381:[[90,780]],382:[[122,780]],383:[[115],256,{775:7835}],416:[[79,795],,{768:7900,769:7898,771:7904,777:7902,803:7906}],417:[[111,795],,{768:7901,769:7899,771:7905,777:7903,803:7907}],431:[[85,795],,{768:7914,769:7912,771:7918,777:7916,803:7920}],432:[[117,795],,{768:7915,769:7913,771:7919,777:7917,803:7921}],439:[,,{780:494}],452:[[68,381],256],453:[[68,382],256],454:[[100,382],256],455:[[76,74],256],456:[[76,106],256],457:[[108,106],256],458:[[78,74],256],459:[[78,106],256],460:[[110,106],256],461:[[65,780]],462:[[97,780]],463:[[73,780]],464:[[105,780]],465:[[79,780]],466:[[111,780]],467:[[85,780]],468:[[117,780]],469:[[220,772]],470:[[252,772]],471:[[220,769]],472:[[252,769]],473:[[220,780]],474:[[252,780]],475:[[220,768]],476:[[252,768]],478:[[196,772]],479:[[228,772]],480:[[550,772]],481:[[551,772]],482:[[198,772]],483:[[230,772]],486:[[71,780]],487:[[103,780]],488:[[75,780]],489:[[107,780]],490:[[79,808],,{772:492}],491:[[111,808],,{772:493}],492:[[490,772]],493:[[491,772]],494:[[439,780]],495:[[658,780]],496:[[106,780]],497:[[68,90],256],498:[[68,122],256],499:[[100,122],256],500:[[71,769]],501:[[103,769]],504:[[78,768]],505:[[110,768]],506:[[197,769]],507:[[229,769]],508:[[198,769]],509:[[230,769]],510:[[216,769]],511:[[248,769]],66045:[,220]}, + 512:{512:[[65,783]],513:[[97,783]],514:[[65,785]],515:[[97,785]],516:[[69,783]],517:[[101,783]],518:[[69,785]],519:[[101,785]],520:[[73,783]],521:[[105,783]],522:[[73,785]],523:[[105,785]],524:[[79,783]],525:[[111,783]],526:[[79,785]],527:[[111,785]],528:[[82,783]],529:[[114,783]],530:[[82,785]],531:[[114,785]],532:[[85,783]],533:[[117,783]],534:[[85,785]],535:[[117,785]],536:[[83,806]],537:[[115,806]],538:[[84,806]],539:[[116,806]],542:[[72,780]],543:[[104,780]],550:[[65,775],,{772:480}],551:[[97,775],,{772:481}],552:[[69,807],,{774:7708}],553:[[101,807],,{774:7709}],554:[[214,772]],555:[[246,772]],556:[[213,772]],557:[[245,772]],558:[[79,775],,{772:560}],559:[[111,775],,{772:561}],560:[[558,772]],561:[[559,772]],562:[[89,772]],563:[[121,772]],658:[,,{780:495}],688:[[104],256],689:[[614],256],690:[[106],256],691:[[114],256],692:[[633],256],693:[[635],256],694:[[641],256],695:[[119],256],696:[[121],256],728:[[32,774],256],729:[[32,775],256],730:[[32,778],256],731:[[32,808],256],732:[[32,771],256],733:[[32,779],256],736:[[611],256],737:[[108],256],738:[[115],256],739:[[120],256],740:[[661],256]}, + 768:{768:[,230],769:[,230],770:[,230],771:[,230],772:[,230],773:[,230],774:[,230],775:[,230],776:[,230,{769:836}],777:[,230],778:[,230],779:[,230],780:[,230],781:[,230],782:[,230],783:[,230],784:[,230],785:[,230],786:[,230],787:[,230],788:[,230],789:[,232],790:[,220],791:[,220],792:[,220],793:[,220],794:[,232],795:[,216],796:[,220],797:[,220],798:[,220],799:[,220],800:[,220],801:[,202],802:[,202],803:[,220],804:[,220],805:[,220],806:[,220],807:[,202],808:[,202],809:[,220],810:[,220],811:[,220],812:[,220],813:[,220],814:[,220],815:[,220],816:[,220],817:[,220],818:[,220],819:[,220],820:[,1],821:[,1],822:[,1],823:[,1],824:[,1],825:[,220],826:[,220],827:[,220],828:[,220],829:[,230],830:[,230],831:[,230],832:[[768],230],833:[[769],230],834:[,230],835:[[787],230],836:[[776,769],230],837:[,240],838:[,230],839:[,220],840:[,220],841:[,220],842:[,230],843:[,230],844:[,230],845:[,220],846:[,220],848:[,230],849:[,230],850:[,230],851:[,220],852:[,220],853:[,220],854:[,220],855:[,230],856:[,232],857:[,220],858:[,220],859:[,230],860:[,233],861:[,234],862:[,234],863:[,233],864:[,234],865:[,234],866:[,233],867:[,230],868:[,230],869:[,230],870:[,230],871:[,230],872:[,230],873:[,230],874:[,230],875:[,230],876:[,230],877:[,230],878:[,230],879:[,230],884:[[697]],890:[[32,837],256],894:[[59]],900:[[32,769],256],901:[[168,769]],902:[[913,769]],903:[[183]],904:[[917,769]],905:[[919,769]],906:[[921,769]],908:[[927,769]],910:[[933,769]],911:[[937,769]],912:[[970,769]],913:[,,{768:8122,769:902,772:8121,774:8120,787:7944,788:7945,837:8124}],917:[,,{768:8136,769:904,787:7960,788:7961}],919:[,,{768:8138,769:905,787:7976,788:7977,837:8140}],921:[,,{768:8154,769:906,772:8153,774:8152,776:938,787:7992,788:7993}],927:[,,{768:8184,769:908,787:8008,788:8009}],929:[,,{788:8172}],933:[,,{768:8170,769:910,772:8169,774:8168,776:939,788:8025}],937:[,,{768:8186,769:911,787:8040,788:8041,837:8188}],938:[[921,776]],939:[[933,776]],940:[[945,769],,{837:8116}],941:[[949,769]],942:[[951,769],,{837:8132}],943:[[953,769]],944:[[971,769]],945:[,,{768:8048,769:940,772:8113,774:8112,787:7936,788:7937,834:8118,837:8115}],949:[,,{768:8050,769:941,787:7952,788:7953}],951:[,,{768:8052,769:942,787:7968,788:7969,834:8134,837:8131}],953:[,,{768:8054,769:943,772:8145,774:8144,776:970,787:7984,788:7985,834:8150}],959:[,,{768:8056,769:972,787:8000,788:8001}],961:[,,{787:8164,788:8165}],965:[,,{768:8058,769:973,772:8161,774:8160,776:971,787:8016,788:8017,834:8166}],969:[,,{768:8060,769:974,787:8032,788:8033,834:8182,837:8179}],970:[[953,776],,{768:8146,769:912,834:8151}],971:[[965,776],,{768:8162,769:944,834:8167}],972:[[959,769]],973:[[965,769]],974:[[969,769],,{837:8180}],976:[[946],256],977:[[952],256],978:[[933],256,{769:979,776:980}],979:[[978,769]],980:[[978,776]],981:[[966],256],982:[[960],256],1008:[[954],256],1009:[[961],256],1010:[[962],256],1012:[[920],256],1013:[[949],256],1017:[[931],256]}, + 1024:{1024:[[1045,768]],1025:[[1045,776]],1027:[[1043,769]],1030:[,,{776:1031}],1031:[[1030,776]],1036:[[1050,769]],1037:[[1048,768]],1038:[[1059,774]],1040:[,,{774:1232,776:1234}],1043:[,,{769:1027}],1045:[,,{768:1024,774:1238,776:1025}],1046:[,,{774:1217,776:1244}],1047:[,,{776:1246}],1048:[,,{768:1037,772:1250,774:1049,776:1252}],1049:[[1048,774]],1050:[,,{769:1036}],1054:[,,{776:1254}],1059:[,,{772:1262,774:1038,776:1264,779:1266}],1063:[,,{776:1268}],1067:[,,{776:1272}],1069:[,,{776:1260}],1072:[,,{774:1233,776:1235}],1075:[,,{769:1107}],1077:[,,{768:1104,774:1239,776:1105}],1078:[,,{774:1218,776:1245}],1079:[,,{776:1247}],1080:[,,{768:1117,772:1251,774:1081,776:1253}],1081:[[1080,774]],1082:[,,{769:1116}],1086:[,,{776:1255}],1091:[,,{772:1263,774:1118,776:1265,779:1267}],1095:[,,{776:1269}],1099:[,,{776:1273}],1101:[,,{776:1261}],1104:[[1077,768]],1105:[[1077,776]],1107:[[1075,769]],1110:[,,{776:1111}],1111:[[1110,776]],1116:[[1082,769]],1117:[[1080,768]],1118:[[1091,774]],1140:[,,{783:1142}],1141:[,,{783:1143}],1142:[[1140,783]],1143:[[1141,783]],1155:[,230],1156:[,230],1157:[,230],1158:[,230],1159:[,230],1217:[[1046,774]],1218:[[1078,774]],1232:[[1040,774]],1233:[[1072,774]],1234:[[1040,776]],1235:[[1072,776]],1238:[[1045,774]],1239:[[1077,774]],1240:[,,{776:1242}],1241:[,,{776:1243}],1242:[[1240,776]],1243:[[1241,776]],1244:[[1046,776]],1245:[[1078,776]],1246:[[1047,776]],1247:[[1079,776]],1250:[[1048,772]],1251:[[1080,772]],1252:[[1048,776]],1253:[[1080,776]],1254:[[1054,776]],1255:[[1086,776]],1256:[,,{776:1258}],1257:[,,{776:1259}],1258:[[1256,776]],1259:[[1257,776]],1260:[[1069,776]],1261:[[1101,776]],1262:[[1059,772]],1263:[[1091,772]],1264:[[1059,776]],1265:[[1091,776]],1266:[[1059,779]],1267:[[1091,779]],1268:[[1063,776]],1269:[[1095,776]],1272:[[1067,776]],1273:[[1099,776]]}, + 1280:{1415:[[1381,1410],256],1425:[,220],1426:[,230],1427:[,230],1428:[,230],1429:[,230],1430:[,220],1431:[,230],1432:[,230],1433:[,230],1434:[,222],1435:[,220],1436:[,230],1437:[,230],1438:[,230],1439:[,230],1440:[,230],1441:[,230],1442:[,220],1443:[,220],1444:[,220],1445:[,220],1446:[,220],1447:[,220],1448:[,230],1449:[,230],1450:[,220],1451:[,230],1452:[,230],1453:[,222],1454:[,228],1455:[,230],1456:[,10],1457:[,11],1458:[,12],1459:[,13],1460:[,14],1461:[,15],1462:[,16],1463:[,17],1464:[,18],1465:[,19],1466:[,19],1467:[,20],1468:[,21],1469:[,22],1471:[,23],1473:[,24],1474:[,25],1476:[,230],1477:[,220],1479:[,18]}, + 1536:{1552:[,230],1553:[,230],1554:[,230],1555:[,230],1556:[,230],1557:[,230],1558:[,230],1559:[,230],1560:[,30],1561:[,31],1562:[,32],1570:[[1575,1619]],1571:[[1575,1620]],1572:[[1608,1620]],1573:[[1575,1621]],1574:[[1610,1620]],1575:[,,{1619:1570,1620:1571,1621:1573}],1608:[,,{1620:1572}],1610:[,,{1620:1574}],1611:[,27],1612:[,28],1613:[,29],1614:[,30],1615:[,31],1616:[,32],1617:[,33],1618:[,34],1619:[,230],1620:[,230],1621:[,220],1622:[,220],1623:[,230],1624:[,230],1625:[,230],1626:[,230],1627:[,230],1628:[,220],1629:[,230],1630:[,230],1631:[,220],1648:[,35],1653:[[1575,1652],256],1654:[[1608,1652],256],1655:[[1735,1652],256],1656:[[1610,1652],256],1728:[[1749,1620]],1729:[,,{1620:1730}],1730:[[1729,1620]],1746:[,,{1620:1747}],1747:[[1746,1620]],1749:[,,{1620:1728}],1750:[,230],1751:[,230],1752:[,230],1753:[,230],1754:[,230],1755:[,230],1756:[,230],1759:[,230],1760:[,230],1761:[,230],1762:[,230],1763:[,220],1764:[,230],1767:[,230],1768:[,230],1770:[,220],1771:[,230],1772:[,230],1773:[,220]}, + 1792:{1809:[,36],1840:[,230],1841:[,220],1842:[,230],1843:[,230],1844:[,220],1845:[,230],1846:[,230],1847:[,220],1848:[,220],1849:[,220],1850:[,230],1851:[,220],1852:[,220],1853:[,230],1854:[,220],1855:[,230],1856:[,230],1857:[,230],1858:[,220],1859:[,230],1860:[,220],1861:[,230],1862:[,220],1863:[,230],1864:[,220],1865:[,230],1866:[,230],2027:[,230],2028:[,230],2029:[,230],2030:[,230],2031:[,230],2032:[,230],2033:[,230],2034:[,220],2035:[,230]}, + 2048:{2070:[,230],2071:[,230],2072:[,230],2073:[,230],2075:[,230],2076:[,230],2077:[,230],2078:[,230],2079:[,230],2080:[,230],2081:[,230],2082:[,230],2083:[,230],2085:[,230],2086:[,230],2087:[,230],2089:[,230],2090:[,230],2091:[,230],2092:[,230],2093:[,230],2137:[,220],2138:[,220],2139:[,220],2276:[,230],2277:[,230],2278:[,220],2279:[,230],2280:[,230],2281:[,220],2282:[,230],2283:[,230],2284:[,230],2285:[,220],2286:[,220],2287:[,220],2288:[,27],2289:[,28],2290:[,29],2291:[,230],2292:[,230],2293:[,230],2294:[,220],2295:[,230],2296:[,230],2297:[,220],2298:[,220],2299:[,230],2300:[,230],2301:[,230],2302:[,230]}, + 2304:{2344:[,,{2364:2345}],2345:[[2344,2364]],2352:[,,{2364:2353}],2353:[[2352,2364]],2355:[,,{2364:2356}],2356:[[2355,2364]],2364:[,7],2381:[,9],2385:[,230],2386:[,220],2387:[,230],2388:[,230],2392:[[2325,2364],512],2393:[[2326,2364],512],2394:[[2327,2364],512],2395:[[2332,2364],512],2396:[[2337,2364],512],2397:[[2338,2364],512],2398:[[2347,2364],512],2399:[[2351,2364],512],2492:[,7],2503:[,,{2494:2507,2519:2508}],2507:[[2503,2494]],2508:[[2503,2519]],2509:[,9],2524:[[2465,2492],512],2525:[[2466,2492],512],2527:[[2479,2492],512]}, + 2560:{2611:[[2610,2620],512],2614:[[2616,2620],512],2620:[,7],2637:[,9],2649:[[2582,2620],512],2650:[[2583,2620],512],2651:[[2588,2620],512],2654:[[2603,2620],512],2748:[,7],2765:[,9],68109:[,220],68111:[,230],68152:[,230],68153:[,1],68154:[,220],68159:[,9]}, + 2816:{2876:[,7],2887:[,,{2878:2891,2902:2888,2903:2892}],2888:[[2887,2902]],2891:[[2887,2878]],2892:[[2887,2903]],2893:[,9],2908:[[2849,2876],512],2909:[[2850,2876],512],2962:[,,{3031:2964}],2964:[[2962,3031]],3014:[,,{3006:3018,3031:3020}],3015:[,,{3006:3019}],3018:[[3014,3006]],3019:[[3015,3006]],3020:[[3014,3031]],3021:[,9]}, + 3072:{3142:[,,{3158:3144}],3144:[[3142,3158]],3149:[,9],3157:[,84],3158:[,91],3260:[,7],3263:[,,{3285:3264}],3264:[[3263,3285]],3270:[,,{3266:3274,3285:3271,3286:3272}],3271:[[3270,3285]],3272:[[3270,3286]],3274:[[3270,3266],,{3285:3275}],3275:[[3274,3285]],3277:[,9]}, + 3328:{3398:[,,{3390:3402,3415:3404}],3399:[,,{3390:3403}],3402:[[3398,3390]],3403:[[3399,3390]],3404:[[3398,3415]],3405:[,9],3530:[,9],3545:[,,{3530:3546,3535:3548,3551:3550}],3546:[[3545,3530]],3548:[[3545,3535],,{3530:3549}],3549:[[3548,3530]],3550:[[3545,3551]]}, + 3584:{3635:[[3661,3634],256],3640:[,103],3641:[,103],3642:[,9],3656:[,107],3657:[,107],3658:[,107],3659:[,107],3763:[[3789,3762],256],3768:[,118],3769:[,118],3784:[,122],3785:[,122],3786:[,122],3787:[,122],3804:[[3755,3737],256],3805:[[3755,3745],256]}, + 3840:{3852:[[3851],256],3864:[,220],3865:[,220],3893:[,220],3895:[,220],3897:[,216],3907:[[3906,4023],512],3917:[[3916,4023],512],3922:[[3921,4023],512],3927:[[3926,4023],512],3932:[[3931,4023],512],3945:[[3904,4021],512],3953:[,129],3954:[,130],3955:[[3953,3954],512],3956:[,132],3957:[[3953,3956],512],3958:[[4018,3968],512],3959:[[4018,3969],256],3960:[[4019,3968],512],3961:[[4019,3969],256],3962:[,130],3963:[,130],3964:[,130],3965:[,130],3968:[,130],3969:[[3953,3968],512],3970:[,230],3971:[,230],3972:[,9],3974:[,230],3975:[,230],3987:[[3986,4023],512],3997:[[3996,4023],512],4002:[[4001,4023],512],4007:[[4006,4023],512],4012:[[4011,4023],512],4025:[[3984,4021],512],4038:[,220]}, + 4096:{4133:[,,{4142:4134}],4134:[[4133,4142]],4151:[,7],4153:[,9],4154:[,9],4237:[,220],4348:[[4316],256],69702:[,9],69785:[,,{69818:69786}],69786:[[69785,69818]],69787:[,,{69818:69788}],69788:[[69787,69818]],69797:[,,{69818:69803}],69803:[[69797,69818]],69817:[,9],69818:[,7]}, + 4352:{69888:[,230],69889:[,230],69890:[,230],69934:[[69937,69927]],69935:[[69938,69927]],69937:[,,{69927:69934}],69938:[,,{69927:69935}],69939:[,9],69940:[,9],70080:[,9]}, + 4864:{4957:[,230],4958:[,230],4959:[,230]}, + 5632:{71350:[,9],71351:[,7]}, + 5888:{5908:[,9],5940:[,9],6098:[,9],6109:[,230]}, + 6144:{6313:[,228]}, + 6400:{6457:[,222],6458:[,230],6459:[,220]}, + 6656:{6679:[,230],6680:[,220],6752:[,9],6773:[,230],6774:[,230],6775:[,230],6776:[,230],6777:[,230],6778:[,230],6779:[,230],6780:[,230],6783:[,220]}, + 6912:{6917:[,,{6965:6918}],6918:[[6917,6965]],6919:[,,{6965:6920}],6920:[[6919,6965]],6921:[,,{6965:6922}],6922:[[6921,6965]],6923:[,,{6965:6924}],6924:[[6923,6965]],6925:[,,{6965:6926}],6926:[[6925,6965]],6929:[,,{6965:6930}],6930:[[6929,6965]],6964:[,7],6970:[,,{6965:6971}],6971:[[6970,6965]],6972:[,,{6965:6973}],6973:[[6972,6965]],6974:[,,{6965:6976}],6975:[,,{6965:6977}],6976:[[6974,6965]],6977:[[6975,6965]],6978:[,,{6965:6979}],6979:[[6978,6965]],6980:[,9],7019:[,230],7020:[,220],7021:[,230],7022:[,230],7023:[,230],7024:[,230],7025:[,230],7026:[,230],7027:[,230],7082:[,9],7083:[,9],7142:[,7],7154:[,9],7155:[,9]}, + 7168:{7223:[,7],7376:[,230],7377:[,230],7378:[,230],7380:[,1],7381:[,220],7382:[,220],7383:[,220],7384:[,220],7385:[,220],7386:[,230],7387:[,230],7388:[,220],7389:[,220],7390:[,220],7391:[,220],7392:[,230],7394:[,1],7395:[,1],7396:[,1],7397:[,1],7398:[,1],7399:[,1],7400:[,1],7405:[,220],7412:[,230]}, + 7424:{7468:[[65],256],7469:[[198],256],7470:[[66],256],7472:[[68],256],7473:[[69],256],7474:[[398],256],7475:[[71],256],7476:[[72],256],7477:[[73],256],7478:[[74],256],7479:[[75],256],7480:[[76],256],7481:[[77],256],7482:[[78],256],7484:[[79],256],7485:[[546],256],7486:[[80],256],7487:[[82],256],7488:[[84],256],7489:[[85],256],7490:[[87],256],7491:[[97],256],7492:[[592],256],7493:[[593],256],7494:[[7426],256],7495:[[98],256],7496:[[100],256],7497:[[101],256],7498:[[601],256],7499:[[603],256],7500:[[604],256],7501:[[103],256],7503:[[107],256],7504:[[109],256],7505:[[331],256],7506:[[111],256],7507:[[596],256],7508:[[7446],256],7509:[[7447],256],7510:[[112],256],7511:[[116],256],7512:[[117],256],7513:[[7453],256],7514:[[623],256],7515:[[118],256],7516:[[7461],256],7517:[[946],256],7518:[[947],256],7519:[[948],256],7520:[[966],256],7521:[[967],256],7522:[[105],256],7523:[[114],256],7524:[[117],256],7525:[[118],256],7526:[[946],256],7527:[[947],256],7528:[[961],256],7529:[[966],256],7530:[[967],256],7544:[[1085],256],7579:[[594],256],7580:[[99],256],7581:[[597],256],7582:[[240],256],7583:[[604],256],7584:[[102],256],7585:[[607],256],7586:[[609],256],7587:[[613],256],7588:[[616],256],7589:[[617],256],7590:[[618],256],7591:[[7547],256],7592:[[669],256],7593:[[621],256],7594:[[7557],256],7595:[[671],256],7596:[[625],256],7597:[[624],256],7598:[[626],256],7599:[[627],256],7600:[[628],256],7601:[[629],256],7602:[[632],256],7603:[[642],256],7604:[[643],256],7605:[[427],256],7606:[[649],256],7607:[[650],256],7608:[[7452],256],7609:[[651],256],7610:[[652],256],7611:[[122],256],7612:[[656],256],7613:[[657],256],7614:[[658],256],7615:[[952],256],7616:[,230],7617:[,230],7618:[,220],7619:[,230],7620:[,230],7621:[,230],7622:[,230],7623:[,230],7624:[,230],7625:[,230],7626:[,220],7627:[,230],7628:[,230],7629:[,234],7630:[,214],7631:[,220],7632:[,202],7633:[,230],7634:[,230],7635:[,230],7636:[,230],7637:[,230],7638:[,230],7639:[,230],7640:[,230],7641:[,230],7642:[,230],7643:[,230],7644:[,230],7645:[,230],7646:[,230],7647:[,230],7648:[,230],7649:[,230],7650:[,230],7651:[,230],7652:[,230],7653:[,230],7654:[,230],7676:[,233],7677:[,220],7678:[,230],7679:[,220]}, + 7680:{7680:[[65,805]],7681:[[97,805]],7682:[[66,775]],7683:[[98,775]],7684:[[66,803]],7685:[[98,803]],7686:[[66,817]],7687:[[98,817]],7688:[[199,769]],7689:[[231,769]],7690:[[68,775]],7691:[[100,775]],7692:[[68,803]],7693:[[100,803]],7694:[[68,817]],7695:[[100,817]],7696:[[68,807]],7697:[[100,807]],7698:[[68,813]],7699:[[100,813]],7700:[[274,768]],7701:[[275,768]],7702:[[274,769]],7703:[[275,769]],7704:[[69,813]],7705:[[101,813]],7706:[[69,816]],7707:[[101,816]],7708:[[552,774]],7709:[[553,774]],7710:[[70,775]],7711:[[102,775]],7712:[[71,772]],7713:[[103,772]],7714:[[72,775]],7715:[[104,775]],7716:[[72,803]],7717:[[104,803]],7718:[[72,776]],7719:[[104,776]],7720:[[72,807]],7721:[[104,807]],7722:[[72,814]],7723:[[104,814]],7724:[[73,816]],7725:[[105,816]],7726:[[207,769]],7727:[[239,769]],7728:[[75,769]],7729:[[107,769]],7730:[[75,803]],7731:[[107,803]],7732:[[75,817]],7733:[[107,817]],7734:[[76,803],,{772:7736}],7735:[[108,803],,{772:7737}],7736:[[7734,772]],7737:[[7735,772]],7738:[[76,817]],7739:[[108,817]],7740:[[76,813]],7741:[[108,813]],7742:[[77,769]],7743:[[109,769]],7744:[[77,775]],7745:[[109,775]],7746:[[77,803]],7747:[[109,803]],7748:[[78,775]],7749:[[110,775]],7750:[[78,803]],7751:[[110,803]],7752:[[78,817]],7753:[[110,817]],7754:[[78,813]],7755:[[110,813]],7756:[[213,769]],7757:[[245,769]],7758:[[213,776]],7759:[[245,776]],7760:[[332,768]],7761:[[333,768]],7762:[[332,769]],7763:[[333,769]],7764:[[80,769]],7765:[[112,769]],7766:[[80,775]],7767:[[112,775]],7768:[[82,775]],7769:[[114,775]],7770:[[82,803],,{772:7772}],7771:[[114,803],,{772:7773}],7772:[[7770,772]],7773:[[7771,772]],7774:[[82,817]],7775:[[114,817]],7776:[[83,775]],7777:[[115,775]],7778:[[83,803],,{775:7784}],7779:[[115,803],,{775:7785}],7780:[[346,775]],7781:[[347,775]],7782:[[352,775]],7783:[[353,775]],7784:[[7778,775]],7785:[[7779,775]],7786:[[84,775]],7787:[[116,775]],7788:[[84,803]],7789:[[116,803]],7790:[[84,817]],7791:[[116,817]],7792:[[84,813]],7793:[[116,813]],7794:[[85,804]],7795:[[117,804]],7796:[[85,816]],7797:[[117,816]],7798:[[85,813]],7799:[[117,813]],7800:[[360,769]],7801:[[361,769]],7802:[[362,776]],7803:[[363,776]],7804:[[86,771]],7805:[[118,771]],7806:[[86,803]],7807:[[118,803]],7808:[[87,768]],7809:[[119,768]],7810:[[87,769]],7811:[[119,769]],7812:[[87,776]],7813:[[119,776]],7814:[[87,775]],7815:[[119,775]],7816:[[87,803]],7817:[[119,803]],7818:[[88,775]],7819:[[120,775]],7820:[[88,776]],7821:[[120,776]],7822:[[89,775]],7823:[[121,775]],7824:[[90,770]],7825:[[122,770]],7826:[[90,803]],7827:[[122,803]],7828:[[90,817]],7829:[[122,817]],7830:[[104,817]],7831:[[116,776]],7832:[[119,778]],7833:[[121,778]],7834:[[97,702],256],7835:[[383,775]],7840:[[65,803],,{770:7852,774:7862}],7841:[[97,803],,{770:7853,774:7863}],7842:[[65,777]],7843:[[97,777]],7844:[[194,769]],7845:[[226,769]],7846:[[194,768]],7847:[[226,768]],7848:[[194,777]],7849:[[226,777]],7850:[[194,771]],7851:[[226,771]],7852:[[7840,770]],7853:[[7841,770]],7854:[[258,769]],7855:[[259,769]],7856:[[258,768]],7857:[[259,768]],7858:[[258,777]],7859:[[259,777]],7860:[[258,771]],7861:[[259,771]],7862:[[7840,774]],7863:[[7841,774]],7864:[[69,803],,{770:7878}],7865:[[101,803],,{770:7879}],7866:[[69,777]],7867:[[101,777]],7868:[[69,771]],7869:[[101,771]],7870:[[202,769]],7871:[[234,769]],7872:[[202,768]],7873:[[234,768]],7874:[[202,777]],7875:[[234,777]],7876:[[202,771]],7877:[[234,771]],7878:[[7864,770]],7879:[[7865,770]],7880:[[73,777]],7881:[[105,777]],7882:[[73,803]],7883:[[105,803]],7884:[[79,803],,{770:7896}],7885:[[111,803],,{770:7897}],7886:[[79,777]],7887:[[111,777]],7888:[[212,769]],7889:[[244,769]],7890:[[212,768]],7891:[[244,768]],7892:[[212,777]],7893:[[244,777]],7894:[[212,771]],7895:[[244,771]],7896:[[7884,770]],7897:[[7885,770]],7898:[[416,769]],7899:[[417,769]],7900:[[416,768]],7901:[[417,768]],7902:[[416,777]],7903:[[417,777]],7904:[[416,771]],7905:[[417,771]],7906:[[416,803]],7907:[[417,803]],7908:[[85,803]],7909:[[117,803]],7910:[[85,777]],7911:[[117,777]],7912:[[431,769]],7913:[[432,769]],7914:[[431,768]],7915:[[432,768]],7916:[[431,777]],7917:[[432,777]],7918:[[431,771]],7919:[[432,771]],7920:[[431,803]],7921:[[432,803]],7922:[[89,768]],7923:[[121,768]],7924:[[89,803]],7925:[[121,803]],7926:[[89,777]],7927:[[121,777]],7928:[[89,771]],7929:[[121,771]]}, + 7936:{7936:[[945,787],,{768:7938,769:7940,834:7942,837:8064}],7937:[[945,788],,{768:7939,769:7941,834:7943,837:8065}],7938:[[7936,768],,{837:8066}],7939:[[7937,768],,{837:8067}],7940:[[7936,769],,{837:8068}],7941:[[7937,769],,{837:8069}],7942:[[7936,834],,{837:8070}],7943:[[7937,834],,{837:8071}],7944:[[913,787],,{768:7946,769:7948,834:7950,837:8072}],7945:[[913,788],,{768:7947,769:7949,834:7951,837:8073}],7946:[[7944,768],,{837:8074}],7947:[[7945,768],,{837:8075}],7948:[[7944,769],,{837:8076}],7949:[[7945,769],,{837:8077}],7950:[[7944,834],,{837:8078}],7951:[[7945,834],,{837:8079}],7952:[[949,787],,{768:7954,769:7956}],7953:[[949,788],,{768:7955,769:7957}],7954:[[7952,768]],7955:[[7953,768]],7956:[[7952,769]],7957:[[7953,769]],7960:[[917,787],,{768:7962,769:7964}],7961:[[917,788],,{768:7963,769:7965}],7962:[[7960,768]],7963:[[7961,768]],7964:[[7960,769]],7965:[[7961,769]],7968:[[951,787],,{768:7970,769:7972,834:7974,837:8080}],7969:[[951,788],,{768:7971,769:7973,834:7975,837:8081}],7970:[[7968,768],,{837:8082}],7971:[[7969,768],,{837:8083}],7972:[[7968,769],,{837:8084}],7973:[[7969,769],,{837:8085}],7974:[[7968,834],,{837:8086}],7975:[[7969,834],,{837:8087}],7976:[[919,787],,{768:7978,769:7980,834:7982,837:8088}],7977:[[919,788],,{768:7979,769:7981,834:7983,837:8089}],7978:[[7976,768],,{837:8090}],7979:[[7977,768],,{837:8091}],7980:[[7976,769],,{837:8092}],7981:[[7977,769],,{837:8093}],7982:[[7976,834],,{837:8094}],7983:[[7977,834],,{837:8095}],7984:[[953,787],,{768:7986,769:7988,834:7990}],7985:[[953,788],,{768:7987,769:7989,834:7991}],7986:[[7984,768]],7987:[[7985,768]],7988:[[7984,769]],7989:[[7985,769]],7990:[[7984,834]],7991:[[7985,834]],7992:[[921,787],,{768:7994,769:7996,834:7998}],7993:[[921,788],,{768:7995,769:7997,834:7999}],7994:[[7992,768]],7995:[[7993,768]],7996:[[7992,769]],7997:[[7993,769]],7998:[[7992,834]],7999:[[7993,834]],8000:[[959,787],,{768:8002,769:8004}],8001:[[959,788],,{768:8003,769:8005}],8002:[[8000,768]],8003:[[8001,768]],8004:[[8000,769]],8005:[[8001,769]],8008:[[927,787],,{768:8010,769:8012}],8009:[[927,788],,{768:8011,769:8013}],8010:[[8008,768]],8011:[[8009,768]],8012:[[8008,769]],8013:[[8009,769]],8016:[[965,787],,{768:8018,769:8020,834:8022}],8017:[[965,788],,{768:8019,769:8021,834:8023}],8018:[[8016,768]],8019:[[8017,768]],8020:[[8016,769]],8021:[[8017,769]],8022:[[8016,834]],8023:[[8017,834]],8025:[[933,788],,{768:8027,769:8029,834:8031}],8027:[[8025,768]],8029:[[8025,769]],8031:[[8025,834]],8032:[[969,787],,{768:8034,769:8036,834:8038,837:8096}],8033:[[969,788],,{768:8035,769:8037,834:8039,837:8097}],8034:[[8032,768],,{837:8098}],8035:[[8033,768],,{837:8099}],8036:[[8032,769],,{837:8100}],8037:[[8033,769],,{837:8101}],8038:[[8032,834],,{837:8102}],8039:[[8033,834],,{837:8103}],8040:[[937,787],,{768:8042,769:8044,834:8046,837:8104}],8041:[[937,788],,{768:8043,769:8045,834:8047,837:8105}],8042:[[8040,768],,{837:8106}],8043:[[8041,768],,{837:8107}],8044:[[8040,769],,{837:8108}],8045:[[8041,769],,{837:8109}],8046:[[8040,834],,{837:8110}],8047:[[8041,834],,{837:8111}],8048:[[945,768],,{837:8114}],8049:[[940]],8050:[[949,768]],8051:[[941]],8052:[[951,768],,{837:8130}],8053:[[942]],8054:[[953,768]],8055:[[943]],8056:[[959,768]],8057:[[972]],8058:[[965,768]],8059:[[973]],8060:[[969,768],,{837:8178}],8061:[[974]],8064:[[7936,837]],8065:[[7937,837]],8066:[[7938,837]],8067:[[7939,837]],8068:[[7940,837]],8069:[[7941,837]],8070:[[7942,837]],8071:[[7943,837]],8072:[[7944,837]],8073:[[7945,837]],8074:[[7946,837]],8075:[[7947,837]],8076:[[7948,837]],8077:[[7949,837]],8078:[[7950,837]],8079:[[7951,837]],8080:[[7968,837]],8081:[[7969,837]],8082:[[7970,837]],8083:[[7971,837]],8084:[[7972,837]],8085:[[7973,837]],8086:[[7974,837]],8087:[[7975,837]],8088:[[7976,837]],8089:[[7977,837]],8090:[[7978,837]],8091:[[7979,837]],8092:[[7980,837]],8093:[[7981,837]],8094:[[7982,837]],8095:[[7983,837]],8096:[[8032,837]],8097:[[8033,837]],8098:[[8034,837]],8099:[[8035,837]],8100:[[8036,837]],8101:[[8037,837]],8102:[[8038,837]],8103:[[8039,837]],8104:[[8040,837]],8105:[[8041,837]],8106:[[8042,837]],8107:[[8043,837]],8108:[[8044,837]],8109:[[8045,837]],8110:[[8046,837]],8111:[[8047,837]],8112:[[945,774]],8113:[[945,772]],8114:[[8048,837]],8115:[[945,837]],8116:[[940,837]],8118:[[945,834],,{837:8119}],8119:[[8118,837]],8120:[[913,774]],8121:[[913,772]],8122:[[913,768]],8123:[[902]],8124:[[913,837]],8125:[[32,787],256],8126:[[953]],8127:[[32,787],256,{768:8141,769:8142,834:8143}],8128:[[32,834],256],8129:[[168,834]],8130:[[8052,837]],8131:[[951,837]],8132:[[942,837]],8134:[[951,834],,{837:8135}],8135:[[8134,837]],8136:[[917,768]],8137:[[904]],8138:[[919,768]],8139:[[905]],8140:[[919,837]],8141:[[8127,768]],8142:[[8127,769]],8143:[[8127,834]],8144:[[953,774]],8145:[[953,772]],8146:[[970,768]],8147:[[912]],8150:[[953,834]],8151:[[970,834]],8152:[[921,774]],8153:[[921,772]],8154:[[921,768]],8155:[[906]],8157:[[8190,768]],8158:[[8190,769]],8159:[[8190,834]],8160:[[965,774]],8161:[[965,772]],8162:[[971,768]],8163:[[944]],8164:[[961,787]],8165:[[961,788]],8166:[[965,834]],8167:[[971,834]],8168:[[933,774]],8169:[[933,772]],8170:[[933,768]],8171:[[910]],8172:[[929,788]],8173:[[168,768]],8174:[[901]],8175:[[96]],8178:[[8060,837]],8179:[[969,837]],8180:[[974,837]],8182:[[969,834],,{837:8183}],8183:[[8182,837]],8184:[[927,768]],8185:[[908]],8186:[[937,768]],8187:[[911]],8188:[[937,837]],8189:[[180]],8190:[[32,788],256,{768:8157,769:8158,834:8159}]}, + 8192:{8192:[[8194]],8193:[[8195]],8194:[[32],256],8195:[[32],256],8196:[[32],256],8197:[[32],256],8198:[[32],256],8199:[[32],256],8200:[[32],256],8201:[[32],256],8202:[[32],256],8209:[[8208],256],8215:[[32,819],256],8228:[[46],256],8229:[[46,46],256],8230:[[46,46,46],256],8239:[[32],256],8243:[[8242,8242],256],8244:[[8242,8242,8242],256],8246:[[8245,8245],256],8247:[[8245,8245,8245],256],8252:[[33,33],256],8254:[[32,773],256],8263:[[63,63],256],8264:[[63,33],256],8265:[[33,63],256],8279:[[8242,8242,8242,8242],256],8287:[[32],256],8304:[[48],256],8305:[[105],256],8308:[[52],256],8309:[[53],256],8310:[[54],256],8311:[[55],256],8312:[[56],256],8313:[[57],256],8314:[[43],256],8315:[[8722],256],8316:[[61],256],8317:[[40],256],8318:[[41],256],8319:[[110],256],8320:[[48],256],8321:[[49],256],8322:[[50],256],8323:[[51],256],8324:[[52],256],8325:[[53],256],8326:[[54],256],8327:[[55],256],8328:[[56],256],8329:[[57],256],8330:[[43],256],8331:[[8722],256],8332:[[61],256],8333:[[40],256],8334:[[41],256],8336:[[97],256],8337:[[101],256],8338:[[111],256],8339:[[120],256],8340:[[601],256],8341:[[104],256],8342:[[107],256],8343:[[108],256],8344:[[109],256],8345:[[110],256],8346:[[112],256],8347:[[115],256],8348:[[116],256],8360:[[82,115],256],8400:[,230],8401:[,230],8402:[,1],8403:[,1],8404:[,230],8405:[,230],8406:[,230],8407:[,230],8408:[,1],8409:[,1],8410:[,1],8411:[,230],8412:[,230],8417:[,230],8421:[,1],8422:[,1],8423:[,230],8424:[,220],8425:[,230],8426:[,1],8427:[,1],8428:[,220],8429:[,220],8430:[,220],8431:[,220],8432:[,230]}, + 8448:{8448:[[97,47,99],256],8449:[[97,47,115],256],8450:[[67],256],8451:[[176,67],256],8453:[[99,47,111],256],8454:[[99,47,117],256],8455:[[400],256],8457:[[176,70],256],8458:[[103],256],8459:[[72],256],8460:[[72],256],8461:[[72],256],8462:[[104],256],8463:[[295],256],8464:[[73],256],8465:[[73],256],8466:[[76],256],8467:[[108],256],8469:[[78],256],8470:[[78,111],256],8473:[[80],256],8474:[[81],256],8475:[[82],256],8476:[[82],256],8477:[[82],256],8480:[[83,77],256],8481:[[84,69,76],256],8482:[[84,77],256],8484:[[90],256],8486:[[937]],8488:[[90],256],8490:[[75]],8491:[[197]],8492:[[66],256],8493:[[67],256],8495:[[101],256],8496:[[69],256],8497:[[70],256],8499:[[77],256],8500:[[111],256],8501:[[1488],256],8502:[[1489],256],8503:[[1490],256],8504:[[1491],256],8505:[[105],256],8507:[[70,65,88],256],8508:[[960],256],8509:[[947],256],8510:[[915],256],8511:[[928],256],8512:[[8721],256],8517:[[68],256],8518:[[100],256],8519:[[101],256],8520:[[105],256],8521:[[106],256],8528:[[49,8260,55],256],8529:[[49,8260,57],256],8530:[[49,8260,49,48],256],8531:[[49,8260,51],256],8532:[[50,8260,51],256],8533:[[49,8260,53],256],8534:[[50,8260,53],256],8535:[[51,8260,53],256],8536:[[52,8260,53],256],8537:[[49,8260,54],256],8538:[[53,8260,54],256],8539:[[49,8260,56],256],8540:[[51,8260,56],256],8541:[[53,8260,56],256],8542:[[55,8260,56],256],8543:[[49,8260],256],8544:[[73],256],8545:[[73,73],256],8546:[[73,73,73],256],8547:[[73,86],256],8548:[[86],256],8549:[[86,73],256],8550:[[86,73,73],256],8551:[[86,73,73,73],256],8552:[[73,88],256],8553:[[88],256],8554:[[88,73],256],8555:[[88,73,73],256],8556:[[76],256],8557:[[67],256],8558:[[68],256],8559:[[77],256],8560:[[105],256],8561:[[105,105],256],8562:[[105,105,105],256],8563:[[105,118],256],8564:[[118],256],8565:[[118,105],256],8566:[[118,105,105],256],8567:[[118,105,105,105],256],8568:[[105,120],256],8569:[[120],256],8570:[[120,105],256],8571:[[120,105,105],256],8572:[[108],256],8573:[[99],256],8574:[[100],256],8575:[[109],256],8585:[[48,8260,51],256],8592:[,,{824:8602}],8594:[,,{824:8603}],8596:[,,{824:8622}],8602:[[8592,824]],8603:[[8594,824]],8622:[[8596,824]],8653:[[8656,824]],8654:[[8660,824]],8655:[[8658,824]],8656:[,,{824:8653}],8658:[,,{824:8655}],8660:[,,{824:8654}]}, + 8704:{8707:[,,{824:8708}],8708:[[8707,824]],8712:[,,{824:8713}],8713:[[8712,824]],8715:[,,{824:8716}],8716:[[8715,824]],8739:[,,{824:8740}],8740:[[8739,824]],8741:[,,{824:8742}],8742:[[8741,824]],8748:[[8747,8747],256],8749:[[8747,8747,8747],256],8751:[[8750,8750],256],8752:[[8750,8750,8750],256],8764:[,,{824:8769}],8769:[[8764,824]],8771:[,,{824:8772}],8772:[[8771,824]],8773:[,,{824:8775}],8775:[[8773,824]],8776:[,,{824:8777}],8777:[[8776,824]],8781:[,,{824:8813}],8800:[[61,824]],8801:[,,{824:8802}],8802:[[8801,824]],8804:[,,{824:8816}],8805:[,,{824:8817}],8813:[[8781,824]],8814:[[60,824]],8815:[[62,824]],8816:[[8804,824]],8817:[[8805,824]],8818:[,,{824:8820}],8819:[,,{824:8821}],8820:[[8818,824]],8821:[[8819,824]],8822:[,,{824:8824}],8823:[,,{824:8825}],8824:[[8822,824]],8825:[[8823,824]],8826:[,,{824:8832}],8827:[,,{824:8833}],8828:[,,{824:8928}],8829:[,,{824:8929}],8832:[[8826,824]],8833:[[8827,824]],8834:[,,{824:8836}],8835:[,,{824:8837}],8836:[[8834,824]],8837:[[8835,824]],8838:[,,{824:8840}],8839:[,,{824:8841}],8840:[[8838,824]],8841:[[8839,824]],8849:[,,{824:8930}],8850:[,,{824:8931}],8866:[,,{824:8876}],8872:[,,{824:8877}],8873:[,,{824:8878}],8875:[,,{824:8879}],8876:[[8866,824]],8877:[[8872,824]],8878:[[8873,824]],8879:[[8875,824]],8882:[,,{824:8938}],8883:[,,{824:8939}],8884:[,,{824:8940}],8885:[,,{824:8941}],8928:[[8828,824]],8929:[[8829,824]],8930:[[8849,824]],8931:[[8850,824]],8938:[[8882,824]],8939:[[8883,824]],8940:[[8884,824]],8941:[[8885,824]]}, + 8960:{9001:[[12296]],9002:[[12297]]}, + 9216:{9312:[[49],256],9313:[[50],256],9314:[[51],256],9315:[[52],256],9316:[[53],256],9317:[[54],256],9318:[[55],256],9319:[[56],256],9320:[[57],256],9321:[[49,48],256],9322:[[49,49],256],9323:[[49,50],256],9324:[[49,51],256],9325:[[49,52],256],9326:[[49,53],256],9327:[[49,54],256],9328:[[49,55],256],9329:[[49,56],256],9330:[[49,57],256],9331:[[50,48],256],9332:[[40,49,41],256],9333:[[40,50,41],256],9334:[[40,51,41],256],9335:[[40,52,41],256],9336:[[40,53,41],256],9337:[[40,54,41],256],9338:[[40,55,41],256],9339:[[40,56,41],256],9340:[[40,57,41],256],9341:[[40,49,48,41],256],9342:[[40,49,49,41],256],9343:[[40,49,50,41],256],9344:[[40,49,51,41],256],9345:[[40,49,52,41],256],9346:[[40,49,53,41],256],9347:[[40,49,54,41],256],9348:[[40,49,55,41],256],9349:[[40,49,56,41],256],9350:[[40,49,57,41],256],9351:[[40,50,48,41],256],9352:[[49,46],256],9353:[[50,46],256],9354:[[51,46],256],9355:[[52,46],256],9356:[[53,46],256],9357:[[54,46],256],9358:[[55,46],256],9359:[[56,46],256],9360:[[57,46],256],9361:[[49,48,46],256],9362:[[49,49,46],256],9363:[[49,50,46],256],9364:[[49,51,46],256],9365:[[49,52,46],256],9366:[[49,53,46],256],9367:[[49,54,46],256],9368:[[49,55,46],256],9369:[[49,56,46],256],9370:[[49,57,46],256],9371:[[50,48,46],256],9372:[[40,97,41],256],9373:[[40,98,41],256],9374:[[40,99,41],256],9375:[[40,100,41],256],9376:[[40,101,41],256],9377:[[40,102,41],256],9378:[[40,103,41],256],9379:[[40,104,41],256],9380:[[40,105,41],256],9381:[[40,106,41],256],9382:[[40,107,41],256],9383:[[40,108,41],256],9384:[[40,109,41],256],9385:[[40,110,41],256],9386:[[40,111,41],256],9387:[[40,112,41],256],9388:[[40,113,41],256],9389:[[40,114,41],256],9390:[[40,115,41],256],9391:[[40,116,41],256],9392:[[40,117,41],256],9393:[[40,118,41],256],9394:[[40,119,41],256],9395:[[40,120,41],256],9396:[[40,121,41],256],9397:[[40,122,41],256],9398:[[65],256],9399:[[66],256],9400:[[67],256],9401:[[68],256],9402:[[69],256],9403:[[70],256],9404:[[71],256],9405:[[72],256],9406:[[73],256],9407:[[74],256],9408:[[75],256],9409:[[76],256],9410:[[77],256],9411:[[78],256],9412:[[79],256],9413:[[80],256],9414:[[81],256],9415:[[82],256],9416:[[83],256],9417:[[84],256],9418:[[85],256],9419:[[86],256],9420:[[87],256],9421:[[88],256],9422:[[89],256],9423:[[90],256],9424:[[97],256],9425:[[98],256],9426:[[99],256],9427:[[100],256],9428:[[101],256],9429:[[102],256],9430:[[103],256],9431:[[104],256],9432:[[105],256],9433:[[106],256],9434:[[107],256],9435:[[108],256],9436:[[109],256],9437:[[110],256],9438:[[111],256],9439:[[112],256],9440:[[113],256],9441:[[114],256],9442:[[115],256],9443:[[116],256],9444:[[117],256],9445:[[118],256],9446:[[119],256],9447:[[120],256],9448:[[121],256],9449:[[122],256],9450:[[48],256]}, + 10752:{10764:[[8747,8747,8747,8747],256],10868:[[58,58,61],256],10869:[[61,61],256],10870:[[61,61,61],256],10972:[[10973,824],512]}, + 11264:{11388:[[106],256],11389:[[86],256],11503:[,230],11504:[,230],11505:[,230]}, + 11520:{11631:[[11617],256],11647:[,9],11744:[,230],11745:[,230],11746:[,230],11747:[,230],11748:[,230],11749:[,230],11750:[,230],11751:[,230],11752:[,230],11753:[,230],11754:[,230],11755:[,230],11756:[,230],11757:[,230],11758:[,230],11759:[,230],11760:[,230],11761:[,230],11762:[,230],11763:[,230],11764:[,230],11765:[,230],11766:[,230],11767:[,230],11768:[,230],11769:[,230],11770:[,230],11771:[,230],11772:[,230],11773:[,230],11774:[,230],11775:[,230]}, + 11776:{11935:[[27597],256],12019:[[40863],256]}, + 12032:{12032:[[19968],256],12033:[[20008],256],12034:[[20022],256],12035:[[20031],256],12036:[[20057],256],12037:[[20101],256],12038:[[20108],256],12039:[[20128],256],12040:[[20154],256],12041:[[20799],256],12042:[[20837],256],12043:[[20843],256],12044:[[20866],256],12045:[[20886],256],12046:[[20907],256],12047:[[20960],256],12048:[[20981],256],12049:[[20992],256],12050:[[21147],256],12051:[[21241],256],12052:[[21269],256],12053:[[21274],256],12054:[[21304],256],12055:[[21313],256],12056:[[21340],256],12057:[[21353],256],12058:[[21378],256],12059:[[21430],256],12060:[[21448],256],12061:[[21475],256],12062:[[22231],256],12063:[[22303],256],12064:[[22763],256],12065:[[22786],256],12066:[[22794],256],12067:[[22805],256],12068:[[22823],256],12069:[[22899],256],12070:[[23376],256],12071:[[23424],256],12072:[[23544],256],12073:[[23567],256],12074:[[23586],256],12075:[[23608],256],12076:[[23662],256],12077:[[23665],256],12078:[[24027],256],12079:[[24037],256],12080:[[24049],256],12081:[[24062],256],12082:[[24178],256],12083:[[24186],256],12084:[[24191],256],12085:[[24308],256],12086:[[24318],256],12087:[[24331],256],12088:[[24339],256],12089:[[24400],256],12090:[[24417],256],12091:[[24435],256],12092:[[24515],256],12093:[[25096],256],12094:[[25142],256],12095:[[25163],256],12096:[[25903],256],12097:[[25908],256],12098:[[25991],256],12099:[[26007],256],12100:[[26020],256],12101:[[26041],256],12102:[[26080],256],12103:[[26085],256],12104:[[26352],256],12105:[[26376],256],12106:[[26408],256],12107:[[27424],256],12108:[[27490],256],12109:[[27513],256],12110:[[27571],256],12111:[[27595],256],12112:[[27604],256],12113:[[27611],256],12114:[[27663],256],12115:[[27668],256],12116:[[27700],256],12117:[[28779],256],12118:[[29226],256],12119:[[29238],256],12120:[[29243],256],12121:[[29247],256],12122:[[29255],256],12123:[[29273],256],12124:[[29275],256],12125:[[29356],256],12126:[[29572],256],12127:[[29577],256],12128:[[29916],256],12129:[[29926],256],12130:[[29976],256],12131:[[29983],256],12132:[[29992],256],12133:[[30000],256],12134:[[30091],256],12135:[[30098],256],12136:[[30326],256],12137:[[30333],256],12138:[[30382],256],12139:[[30399],256],12140:[[30446],256],12141:[[30683],256],12142:[[30690],256],12143:[[30707],256],12144:[[31034],256],12145:[[31160],256],12146:[[31166],256],12147:[[31348],256],12148:[[31435],256],12149:[[31481],256],12150:[[31859],256],12151:[[31992],256],12152:[[32566],256],12153:[[32593],256],12154:[[32650],256],12155:[[32701],256],12156:[[32769],256],12157:[[32780],256],12158:[[32786],256],12159:[[32819],256],12160:[[32895],256],12161:[[32905],256],12162:[[33251],256],12163:[[33258],256],12164:[[33267],256],12165:[[33276],256],12166:[[33292],256],12167:[[33307],256],12168:[[33311],256],12169:[[33390],256],12170:[[33394],256],12171:[[33400],256],12172:[[34381],256],12173:[[34411],256],12174:[[34880],256],12175:[[34892],256],12176:[[34915],256],12177:[[35198],256],12178:[[35211],256],12179:[[35282],256],12180:[[35328],256],12181:[[35895],256],12182:[[35910],256],12183:[[35925],256],12184:[[35960],256],12185:[[35997],256],12186:[[36196],256],12187:[[36208],256],12188:[[36275],256],12189:[[36523],256],12190:[[36554],256],12191:[[36763],256],12192:[[36784],256],12193:[[36789],256],12194:[[37009],256],12195:[[37193],256],12196:[[37318],256],12197:[[37324],256],12198:[[37329],256],12199:[[38263],256],12200:[[38272],256],12201:[[38428],256],12202:[[38582],256],12203:[[38585],256],12204:[[38632],256],12205:[[38737],256],12206:[[38750],256],12207:[[38754],256],12208:[[38761],256],12209:[[38859],256],12210:[[38893],256],12211:[[38899],256],12212:[[38913],256],12213:[[39080],256],12214:[[39131],256],12215:[[39135],256],12216:[[39318],256],12217:[[39321],256],12218:[[39340],256],12219:[[39592],256],12220:[[39640],256],12221:[[39647],256],12222:[[39717],256],12223:[[39727],256],12224:[[39730],256],12225:[[39740],256],12226:[[39770],256],12227:[[40165],256],12228:[[40565],256],12229:[[40575],256],12230:[[40613],256],12231:[[40635],256],12232:[[40643],256],12233:[[40653],256],12234:[[40657],256],12235:[[40697],256],12236:[[40701],256],12237:[[40718],256],12238:[[40723],256],12239:[[40736],256],12240:[[40763],256],12241:[[40778],256],12242:[[40786],256],12243:[[40845],256],12244:[[40860],256],12245:[[40864],256]}, + 12288:{12288:[[32],256],12330:[,218],12331:[,228],12332:[,232],12333:[,222],12334:[,224],12335:[,224],12342:[[12306],256],12344:[[21313],256],12345:[[21316],256],12346:[[21317],256],12358:[,,{12441:12436}],12363:[,,{12441:12364}],12364:[[12363,12441]],12365:[,,{12441:12366}],12366:[[12365,12441]],12367:[,,{12441:12368}],12368:[[12367,12441]],12369:[,,{12441:12370}],12370:[[12369,12441]],12371:[,,{12441:12372}],12372:[[12371,12441]],12373:[,,{12441:12374}],12374:[[12373,12441]],12375:[,,{12441:12376}],12376:[[12375,12441]],12377:[,,{12441:12378}],12378:[[12377,12441]],12379:[,,{12441:12380}],12380:[[12379,12441]],12381:[,,{12441:12382}],12382:[[12381,12441]],12383:[,,{12441:12384}],12384:[[12383,12441]],12385:[,,{12441:12386}],12386:[[12385,12441]],12388:[,,{12441:12389}],12389:[[12388,12441]],12390:[,,{12441:12391}],12391:[[12390,12441]],12392:[,,{12441:12393}],12393:[[12392,12441]],12399:[,,{12441:12400,12442:12401}],12400:[[12399,12441]],12401:[[12399,12442]],12402:[,,{12441:12403,12442:12404}],12403:[[12402,12441]],12404:[[12402,12442]],12405:[,,{12441:12406,12442:12407}],12406:[[12405,12441]],12407:[[12405,12442]],12408:[,,{12441:12409,12442:12410}],12409:[[12408,12441]],12410:[[12408,12442]],12411:[,,{12441:12412,12442:12413}],12412:[[12411,12441]],12413:[[12411,12442]],12436:[[12358,12441]],12441:[,8],12442:[,8],12443:[[32,12441],256],12444:[[32,12442],256],12445:[,,{12441:12446}],12446:[[12445,12441]],12447:[[12424,12426],256],12454:[,,{12441:12532}],12459:[,,{12441:12460}],12460:[[12459,12441]],12461:[,,{12441:12462}],12462:[[12461,12441]],12463:[,,{12441:12464}],12464:[[12463,12441]],12465:[,,{12441:12466}],12466:[[12465,12441]],12467:[,,{12441:12468}],12468:[[12467,12441]],12469:[,,{12441:12470}],12470:[[12469,12441]],12471:[,,{12441:12472}],12472:[[12471,12441]],12473:[,,{12441:12474}],12474:[[12473,12441]],12475:[,,{12441:12476}],12476:[[12475,12441]],12477:[,,{12441:12478}],12478:[[12477,12441]],12479:[,,{12441:12480}],12480:[[12479,12441]],12481:[,,{12441:12482}],12482:[[12481,12441]],12484:[,,{12441:12485}],12485:[[12484,12441]],12486:[,,{12441:12487}],12487:[[12486,12441]],12488:[,,{12441:12489}],12489:[[12488,12441]],12495:[,,{12441:12496,12442:12497}],12496:[[12495,12441]],12497:[[12495,12442]],12498:[,,{12441:12499,12442:12500}],12499:[[12498,12441]],12500:[[12498,12442]],12501:[,,{12441:12502,12442:12503}],12502:[[12501,12441]],12503:[[12501,12442]],12504:[,,{12441:12505,12442:12506}],12505:[[12504,12441]],12506:[[12504,12442]],12507:[,,{12441:12508,12442:12509}],12508:[[12507,12441]],12509:[[12507,12442]],12527:[,,{12441:12535}],12528:[,,{12441:12536}],12529:[,,{12441:12537}],12530:[,,{12441:12538}],12532:[[12454,12441]],12535:[[12527,12441]],12536:[[12528,12441]],12537:[[12529,12441]],12538:[[12530,12441]],12541:[,,{12441:12542}],12542:[[12541,12441]],12543:[[12467,12488],256]}, + 12544:{12593:[[4352],256],12594:[[4353],256],12595:[[4522],256],12596:[[4354],256],12597:[[4524],256],12598:[[4525],256],12599:[[4355],256],12600:[[4356],256],12601:[[4357],256],12602:[[4528],256],12603:[[4529],256],12604:[[4530],256],12605:[[4531],256],12606:[[4532],256],12607:[[4533],256],12608:[[4378],256],12609:[[4358],256],12610:[[4359],256],12611:[[4360],256],12612:[[4385],256],12613:[[4361],256],12614:[[4362],256],12615:[[4363],256],12616:[[4364],256],12617:[[4365],256],12618:[[4366],256],12619:[[4367],256],12620:[[4368],256],12621:[[4369],256],12622:[[4370],256],12623:[[4449],256],12624:[[4450],256],12625:[[4451],256],12626:[[4452],256],12627:[[4453],256],12628:[[4454],256],12629:[[4455],256],12630:[[4456],256],12631:[[4457],256],12632:[[4458],256],12633:[[4459],256],12634:[[4460],256],12635:[[4461],256],12636:[[4462],256],12637:[[4463],256],12638:[[4464],256],12639:[[4465],256],12640:[[4466],256],12641:[[4467],256],12642:[[4468],256],12643:[[4469],256],12644:[[4448],256],12645:[[4372],256],12646:[[4373],256],12647:[[4551],256],12648:[[4552],256],12649:[[4556],256],12650:[[4558],256],12651:[[4563],256],12652:[[4567],256],12653:[[4569],256],12654:[[4380],256],12655:[[4573],256],12656:[[4575],256],12657:[[4381],256],12658:[[4382],256],12659:[[4384],256],12660:[[4386],256],12661:[[4387],256],12662:[[4391],256],12663:[[4393],256],12664:[[4395],256],12665:[[4396],256],12666:[[4397],256],12667:[[4398],256],12668:[[4399],256],12669:[[4402],256],12670:[[4406],256],12671:[[4416],256],12672:[[4423],256],12673:[[4428],256],12674:[[4593],256],12675:[[4594],256],12676:[[4439],256],12677:[[4440],256],12678:[[4441],256],12679:[[4484],256],12680:[[4485],256],12681:[[4488],256],12682:[[4497],256],12683:[[4498],256],12684:[[4500],256],12685:[[4510],256],12686:[[4513],256],12690:[[19968],256],12691:[[20108],256],12692:[[19977],256],12693:[[22235],256],12694:[[19978],256],12695:[[20013],256],12696:[[19979],256],12697:[[30002],256],12698:[[20057],256],12699:[[19993],256],12700:[[19969],256],12701:[[22825],256],12702:[[22320],256],12703:[[20154],256]}, + 12800:{12800:[[40,4352,41],256],12801:[[40,4354,41],256],12802:[[40,4355,41],256],12803:[[40,4357,41],256],12804:[[40,4358,41],256],12805:[[40,4359,41],256],12806:[[40,4361,41],256],12807:[[40,4363,41],256],12808:[[40,4364,41],256],12809:[[40,4366,41],256],12810:[[40,4367,41],256],12811:[[40,4368,41],256],12812:[[40,4369,41],256],12813:[[40,4370,41],256],12814:[[40,4352,4449,41],256],12815:[[40,4354,4449,41],256],12816:[[40,4355,4449,41],256],12817:[[40,4357,4449,41],256],12818:[[40,4358,4449,41],256],12819:[[40,4359,4449,41],256],12820:[[40,4361,4449,41],256],12821:[[40,4363,4449,41],256],12822:[[40,4364,4449,41],256],12823:[[40,4366,4449,41],256],12824:[[40,4367,4449,41],256],12825:[[40,4368,4449,41],256],12826:[[40,4369,4449,41],256],12827:[[40,4370,4449,41],256],12828:[[40,4364,4462,41],256],12829:[[40,4363,4457,4364,4453,4523,41],256],12830:[[40,4363,4457,4370,4462,41],256],12832:[[40,19968,41],256],12833:[[40,20108,41],256],12834:[[40,19977,41],256],12835:[[40,22235,41],256],12836:[[40,20116,41],256],12837:[[40,20845,41],256],12838:[[40,19971,41],256],12839:[[40,20843,41],256],12840:[[40,20061,41],256],12841:[[40,21313,41],256],12842:[[40,26376,41],256],12843:[[40,28779,41],256],12844:[[40,27700,41],256],12845:[[40,26408,41],256],12846:[[40,37329,41],256],12847:[[40,22303,41],256],12848:[[40,26085,41],256],12849:[[40,26666,41],256],12850:[[40,26377,41],256],12851:[[40,31038,41],256],12852:[[40,21517,41],256],12853:[[40,29305,41],256],12854:[[40,36001,41],256],12855:[[40,31069,41],256],12856:[[40,21172,41],256],12857:[[40,20195,41],256],12858:[[40,21628,41],256],12859:[[40,23398,41],256],12860:[[40,30435,41],256],12861:[[40,20225,41],256],12862:[[40,36039,41],256],12863:[[40,21332,41],256],12864:[[40,31085,41],256],12865:[[40,20241,41],256],12866:[[40,33258,41],256],12867:[[40,33267,41],256],12868:[[21839],256],12869:[[24188],256],12870:[[25991],256],12871:[[31631],256],12880:[[80,84,69],256],12881:[[50,49],256],12882:[[50,50],256],12883:[[50,51],256],12884:[[50,52],256],12885:[[50,53],256],12886:[[50,54],256],12887:[[50,55],256],12888:[[50,56],256],12889:[[50,57],256],12890:[[51,48],256],12891:[[51,49],256],12892:[[51,50],256],12893:[[51,51],256],12894:[[51,52],256],12895:[[51,53],256],12896:[[4352],256],12897:[[4354],256],12898:[[4355],256],12899:[[4357],256],12900:[[4358],256],12901:[[4359],256],12902:[[4361],256],12903:[[4363],256],12904:[[4364],256],12905:[[4366],256],12906:[[4367],256],12907:[[4368],256],12908:[[4369],256],12909:[[4370],256],12910:[[4352,4449],256],12911:[[4354,4449],256],12912:[[4355,4449],256],12913:[[4357,4449],256],12914:[[4358,4449],256],12915:[[4359,4449],256],12916:[[4361,4449],256],12917:[[4363,4449],256],12918:[[4364,4449],256],12919:[[4366,4449],256],12920:[[4367,4449],256],12921:[[4368,4449],256],12922:[[4369,4449],256],12923:[[4370,4449],256],12924:[[4366,4449,4535,4352,4457],256],12925:[[4364,4462,4363,4468],256],12926:[[4363,4462],256],12928:[[19968],256],12929:[[20108],256],12930:[[19977],256],12931:[[22235],256],12932:[[20116],256],12933:[[20845],256],12934:[[19971],256],12935:[[20843],256],12936:[[20061],256],12937:[[21313],256],12938:[[26376],256],12939:[[28779],256],12940:[[27700],256],12941:[[26408],256],12942:[[37329],256],12943:[[22303],256],12944:[[26085],256],12945:[[26666],256],12946:[[26377],256],12947:[[31038],256],12948:[[21517],256],12949:[[29305],256],12950:[[36001],256],12951:[[31069],256],12952:[[21172],256],12953:[[31192],256],12954:[[30007],256],12955:[[22899],256],12956:[[36969],256],12957:[[20778],256],12958:[[21360],256],12959:[[27880],256],12960:[[38917],256],12961:[[20241],256],12962:[[20889],256],12963:[[27491],256],12964:[[19978],256],12965:[[20013],256],12966:[[19979],256],12967:[[24038],256],12968:[[21491],256],12969:[[21307],256],12970:[[23447],256],12971:[[23398],256],12972:[[30435],256],12973:[[20225],256],12974:[[36039],256],12975:[[21332],256],12976:[[22812],256],12977:[[51,54],256],12978:[[51,55],256],12979:[[51,56],256],12980:[[51,57],256],12981:[[52,48],256],12982:[[52,49],256],12983:[[52,50],256],12984:[[52,51],256],12985:[[52,52],256],12986:[[52,53],256],12987:[[52,54],256],12988:[[52,55],256],12989:[[52,56],256],12990:[[52,57],256],12991:[[53,48],256],12992:[[49,26376],256],12993:[[50,26376],256],12994:[[51,26376],256],12995:[[52,26376],256],12996:[[53,26376],256],12997:[[54,26376],256],12998:[[55,26376],256],12999:[[56,26376],256],13000:[[57,26376],256],13001:[[49,48,26376],256],13002:[[49,49,26376],256],13003:[[49,50,26376],256],13004:[[72,103],256],13005:[[101,114,103],256],13006:[[101,86],256],13007:[[76,84,68],256],13008:[[12450],256],13009:[[12452],256],13010:[[12454],256],13011:[[12456],256],13012:[[12458],256],13013:[[12459],256],13014:[[12461],256],13015:[[12463],256],13016:[[12465],256],13017:[[12467],256],13018:[[12469],256],13019:[[12471],256],13020:[[12473],256],13021:[[12475],256],13022:[[12477],256],13023:[[12479],256],13024:[[12481],256],13025:[[12484],256],13026:[[12486],256],13027:[[12488],256],13028:[[12490],256],13029:[[12491],256],13030:[[12492],256],13031:[[12493],256],13032:[[12494],256],13033:[[12495],256],13034:[[12498],256],13035:[[12501],256],13036:[[12504],256],13037:[[12507],256],13038:[[12510],256],13039:[[12511],256],13040:[[12512],256],13041:[[12513],256],13042:[[12514],256],13043:[[12516],256],13044:[[12518],256],13045:[[12520],256],13046:[[12521],256],13047:[[12522],256],13048:[[12523],256],13049:[[12524],256],13050:[[12525],256],13051:[[12527],256],13052:[[12528],256],13053:[[12529],256],13054:[[12530],256]}, + 13056:{13056:[[12450,12497,12540,12488],256],13057:[[12450,12523,12501,12449],256],13058:[[12450,12531,12506,12450],256],13059:[[12450,12540,12523],256],13060:[[12452,12491,12531,12464],256],13061:[[12452,12531,12481],256],13062:[[12454,12457,12531],256],13063:[[12456,12473,12463,12540,12489],256],13064:[[12456,12540,12459,12540],256],13065:[[12458,12531,12473],256],13066:[[12458,12540,12512],256],13067:[[12459,12452,12522],256],13068:[[12459,12521,12483,12488],256],13069:[[12459,12525,12522,12540],256],13070:[[12460,12525,12531],256],13071:[[12460,12531,12510],256],13072:[[12462,12460],256],13073:[[12462,12491,12540],256],13074:[[12461,12517,12522,12540],256],13075:[[12462,12523,12480,12540],256],13076:[[12461,12525],256],13077:[[12461,12525,12464,12521,12512],256],13078:[[12461,12525,12513,12540,12488,12523],256],13079:[[12461,12525,12527,12483,12488],256],13080:[[12464,12521,12512],256],13081:[[12464,12521,12512,12488,12531],256],13082:[[12463,12523,12476,12452,12525],256],13083:[[12463,12525,12540,12493],256],13084:[[12465,12540,12473],256],13085:[[12467,12523,12490],256],13086:[[12467,12540,12509],256],13087:[[12469,12452,12463,12523],256],13088:[[12469,12531,12481,12540,12512],256],13089:[[12471,12522,12531,12464],256],13090:[[12475,12531,12481],256],13091:[[12475,12531,12488],256],13092:[[12480,12540,12473],256],13093:[[12487,12471],256],13094:[[12489,12523],256],13095:[[12488,12531],256],13096:[[12490,12494],256],13097:[[12494,12483,12488],256],13098:[[12495,12452,12484],256],13099:[[12497,12540,12475,12531,12488],256],13100:[[12497,12540,12484],256],13101:[[12496,12540,12524,12523],256],13102:[[12500,12450,12473,12488,12523],256],13103:[[12500,12463,12523],256],13104:[[12500,12467],256],13105:[[12499,12523],256],13106:[[12501,12449,12521,12483,12489],256],13107:[[12501,12451,12540,12488],256],13108:[[12502,12483,12471,12455,12523],256],13109:[[12501,12521,12531],256],13110:[[12504,12463,12479,12540,12523],256],13111:[[12506,12477],256],13112:[[12506,12491,12498],256],13113:[[12504,12523,12484],256],13114:[[12506,12531,12473],256],13115:[[12506,12540,12472],256],13116:[[12505,12540,12479],256],13117:[[12509,12452,12531,12488],256],13118:[[12508,12523,12488],256],13119:[[12507,12531],256],13120:[[12509,12531,12489],256],13121:[[12507,12540,12523],256],13122:[[12507,12540,12531],256],13123:[[12510,12452,12463,12525],256],13124:[[12510,12452,12523],256],13125:[[12510,12483,12495],256],13126:[[12510,12523,12463],256],13127:[[12510,12531,12471,12519,12531],256],13128:[[12511,12463,12525,12531],256],13129:[[12511,12522],256],13130:[[12511,12522,12496,12540,12523],256],13131:[[12513,12460],256],13132:[[12513,12460,12488,12531],256],13133:[[12513,12540,12488,12523],256],13134:[[12516,12540,12489],256],13135:[[12516,12540,12523],256],13136:[[12518,12450,12531],256],13137:[[12522,12483,12488,12523],256],13138:[[12522,12521],256],13139:[[12523,12500,12540],256],13140:[[12523,12540,12502,12523],256],13141:[[12524,12512],256],13142:[[12524,12531,12488,12466,12531],256],13143:[[12527,12483,12488],256],13144:[[48,28857],256],13145:[[49,28857],256],13146:[[50,28857],256],13147:[[51,28857],256],13148:[[52,28857],256],13149:[[53,28857],256],13150:[[54,28857],256],13151:[[55,28857],256],13152:[[56,28857],256],13153:[[57,28857],256],13154:[[49,48,28857],256],13155:[[49,49,28857],256],13156:[[49,50,28857],256],13157:[[49,51,28857],256],13158:[[49,52,28857],256],13159:[[49,53,28857],256],13160:[[49,54,28857],256],13161:[[49,55,28857],256],13162:[[49,56,28857],256],13163:[[49,57,28857],256],13164:[[50,48,28857],256],13165:[[50,49,28857],256],13166:[[50,50,28857],256],13167:[[50,51,28857],256],13168:[[50,52,28857],256],13169:[[104,80,97],256],13170:[[100,97],256],13171:[[65,85],256],13172:[[98,97,114],256],13173:[[111,86],256],13174:[[112,99],256],13175:[[100,109],256],13176:[[100,109,178],256],13177:[[100,109,179],256],13178:[[73,85],256],13179:[[24179,25104],256],13180:[[26157,21644],256],13181:[[22823,27491],256],13182:[[26126,27835],256],13183:[[26666,24335,20250,31038],256],13184:[[112,65],256],13185:[[110,65],256],13186:[[956,65],256],13187:[[109,65],256],13188:[[107,65],256],13189:[[75,66],256],13190:[[77,66],256],13191:[[71,66],256],13192:[[99,97,108],256],13193:[[107,99,97,108],256],13194:[[112,70],256],13195:[[110,70],256],13196:[[956,70],256],13197:[[956,103],256],13198:[[109,103],256],13199:[[107,103],256],13200:[[72,122],256],13201:[[107,72,122],256],13202:[[77,72,122],256],13203:[[71,72,122],256],13204:[[84,72,122],256],13205:[[956,8467],256],13206:[[109,8467],256],13207:[[100,8467],256],13208:[[107,8467],256],13209:[[102,109],256],13210:[[110,109],256],13211:[[956,109],256],13212:[[109,109],256],13213:[[99,109],256],13214:[[107,109],256],13215:[[109,109,178],256],13216:[[99,109,178],256],13217:[[109,178],256],13218:[[107,109,178],256],13219:[[109,109,179],256],13220:[[99,109,179],256],13221:[[109,179],256],13222:[[107,109,179],256],13223:[[109,8725,115],256],13224:[[109,8725,115,178],256],13225:[[80,97],256],13226:[[107,80,97],256],13227:[[77,80,97],256],13228:[[71,80,97],256],13229:[[114,97,100],256],13230:[[114,97,100,8725,115],256],13231:[[114,97,100,8725,115,178],256],13232:[[112,115],256],13233:[[110,115],256],13234:[[956,115],256],13235:[[109,115],256],13236:[[112,86],256],13237:[[110,86],256],13238:[[956,86],256],13239:[[109,86],256],13240:[[107,86],256],13241:[[77,86],256],13242:[[112,87],256],13243:[[110,87],256],13244:[[956,87],256],13245:[[109,87],256],13246:[[107,87],256],13247:[[77,87],256],13248:[[107,937],256],13249:[[77,937],256],13250:[[97,46,109,46],256],13251:[[66,113],256],13252:[[99,99],256],13253:[[99,100],256],13254:[[67,8725,107,103],256],13255:[[67,111,46],256],13256:[[100,66],256],13257:[[71,121],256],13258:[[104,97],256],13259:[[72,80],256],13260:[[105,110],256],13261:[[75,75],256],13262:[[75,77],256],13263:[[107,116],256],13264:[[108,109],256],13265:[[108,110],256],13266:[[108,111,103],256],13267:[[108,120],256],13268:[[109,98],256],13269:[[109,105,108],256],13270:[[109,111,108],256],13271:[[80,72],256],13272:[[112,46,109,46],256],13273:[[80,80,77],256],13274:[[80,82],256],13275:[[115,114],256],13276:[[83,118],256],13277:[[87,98],256],13278:[[86,8725,109],256],13279:[[65,8725,109],256],13280:[[49,26085],256],13281:[[50,26085],256],13282:[[51,26085],256],13283:[[52,26085],256],13284:[[53,26085],256],13285:[[54,26085],256],13286:[[55,26085],256],13287:[[56,26085],256],13288:[[57,26085],256],13289:[[49,48,26085],256],13290:[[49,49,26085],256],13291:[[49,50,26085],256],13292:[[49,51,26085],256],13293:[[49,52,26085],256],13294:[[49,53,26085],256],13295:[[49,54,26085],256],13296:[[49,55,26085],256],13297:[[49,56,26085],256],13298:[[49,57,26085],256],13299:[[50,48,26085],256],13300:[[50,49,26085],256],13301:[[50,50,26085],256],13302:[[50,51,26085],256],13303:[[50,52,26085],256],13304:[[50,53,26085],256],13305:[[50,54,26085],256],13306:[[50,55,26085],256],13307:[[50,56,26085],256],13308:[[50,57,26085],256],13309:[[51,48,26085],256],13310:[[51,49,26085],256],13311:[[103,97,108],256]}, + 42496:{42607:[,230],42612:[,230],42613:[,230],42614:[,230],42615:[,230],42616:[,230],42617:[,230],42618:[,230],42619:[,230],42620:[,230],42621:[,230],42655:[,230],42736:[,230],42737:[,230]}, + 42752:{42864:[[42863],256],43000:[[294],256],43001:[[339],256]}, + 43008:{43014:[,9],43204:[,9],43232:[,230],43233:[,230],43234:[,230],43235:[,230],43236:[,230],43237:[,230],43238:[,230],43239:[,230],43240:[,230],43241:[,230],43242:[,230],43243:[,230],43244:[,230],43245:[,230],43246:[,230],43247:[,230],43248:[,230],43249:[,230]}, + 43264:{43307:[,220],43308:[,220],43309:[,220],43347:[,9],43443:[,7],43456:[,9]}, + 43520:{43696:[,230],43698:[,230],43699:[,230],43700:[,220],43703:[,230],43704:[,230],43710:[,230],43711:[,230],43713:[,230],43766:[,9]}, + 43776:{44013:[,9]}, + 53504:{119134:[[119127,119141],512],119135:[[119128,119141],512],119136:[[119135,119150],512],119137:[[119135,119151],512],119138:[[119135,119152],512],119139:[[119135,119153],512],119140:[[119135,119154],512],119141:[,216],119142:[,216],119143:[,1],119144:[,1],119145:[,1],119149:[,226],119150:[,216],119151:[,216],119152:[,216],119153:[,216],119154:[,216],119163:[,220],119164:[,220],119165:[,220],119166:[,220],119167:[,220],119168:[,220],119169:[,220],119170:[,220],119173:[,230],119174:[,230],119175:[,230],119176:[,230],119177:[,230],119178:[,220],119179:[,220],119210:[,230],119211:[,230],119212:[,230],119213:[,230],119227:[[119225,119141],512],119228:[[119226,119141],512],119229:[[119227,119150],512],119230:[[119228,119150],512],119231:[[119227,119151],512],119232:[[119228,119151],512]}, + 53760:{119362:[,230],119363:[,230],119364:[,230]}, + 54272:{119808:[[65],256],119809:[[66],256],119810:[[67],256],119811:[[68],256],119812:[[69],256],119813:[[70],256],119814:[[71],256],119815:[[72],256],119816:[[73],256],119817:[[74],256],119818:[[75],256],119819:[[76],256],119820:[[77],256],119821:[[78],256],119822:[[79],256],119823:[[80],256],119824:[[81],256],119825:[[82],256],119826:[[83],256],119827:[[84],256],119828:[[85],256],119829:[[86],256],119830:[[87],256],119831:[[88],256],119832:[[89],256],119833:[[90],256],119834:[[97],256],119835:[[98],256],119836:[[99],256],119837:[[100],256],119838:[[101],256],119839:[[102],256],119840:[[103],256],119841:[[104],256],119842:[[105],256],119843:[[106],256],119844:[[107],256],119845:[[108],256],119846:[[109],256],119847:[[110],256],119848:[[111],256],119849:[[112],256],119850:[[113],256],119851:[[114],256],119852:[[115],256],119853:[[116],256],119854:[[117],256],119855:[[118],256],119856:[[119],256],119857:[[120],256],119858:[[121],256],119859:[[122],256],119860:[[65],256],119861:[[66],256],119862:[[67],256],119863:[[68],256],119864:[[69],256],119865:[[70],256],119866:[[71],256],119867:[[72],256],119868:[[73],256],119869:[[74],256],119870:[[75],256],119871:[[76],256],119872:[[77],256],119873:[[78],256],119874:[[79],256],119875:[[80],256],119876:[[81],256],119877:[[82],256],119878:[[83],256],119879:[[84],256],119880:[[85],256],119881:[[86],256],119882:[[87],256],119883:[[88],256],119884:[[89],256],119885:[[90],256],119886:[[97],256],119887:[[98],256],119888:[[99],256],119889:[[100],256],119890:[[101],256],119891:[[102],256],119892:[[103],256],119894:[[105],256],119895:[[106],256],119896:[[107],256],119897:[[108],256],119898:[[109],256],119899:[[110],256],119900:[[111],256],119901:[[112],256],119902:[[113],256],119903:[[114],256],119904:[[115],256],119905:[[116],256],119906:[[117],256],119907:[[118],256],119908:[[119],256],119909:[[120],256],119910:[[121],256],119911:[[122],256],119912:[[65],256],119913:[[66],256],119914:[[67],256],119915:[[68],256],119916:[[69],256],119917:[[70],256],119918:[[71],256],119919:[[72],256],119920:[[73],256],119921:[[74],256],119922:[[75],256],119923:[[76],256],119924:[[77],256],119925:[[78],256],119926:[[79],256],119927:[[80],256],119928:[[81],256],119929:[[82],256],119930:[[83],256],119931:[[84],256],119932:[[85],256],119933:[[86],256],119934:[[87],256],119935:[[88],256],119936:[[89],256],119937:[[90],256],119938:[[97],256],119939:[[98],256],119940:[[99],256],119941:[[100],256],119942:[[101],256],119943:[[102],256],119944:[[103],256],119945:[[104],256],119946:[[105],256],119947:[[106],256],119948:[[107],256],119949:[[108],256],119950:[[109],256],119951:[[110],256],119952:[[111],256],119953:[[112],256],119954:[[113],256],119955:[[114],256],119956:[[115],256],119957:[[116],256],119958:[[117],256],119959:[[118],256],119960:[[119],256],119961:[[120],256],119962:[[121],256],119963:[[122],256],119964:[[65],256],119966:[[67],256],119967:[[68],256],119970:[[71],256],119973:[[74],256],119974:[[75],256],119977:[[78],256],119978:[[79],256],119979:[[80],256],119980:[[81],256],119982:[[83],256],119983:[[84],256],119984:[[85],256],119985:[[86],256],119986:[[87],256],119987:[[88],256],119988:[[89],256],119989:[[90],256],119990:[[97],256],119991:[[98],256],119992:[[99],256],119993:[[100],256],119995:[[102],256],119997:[[104],256],119998:[[105],256],119999:[[106],256],120000:[[107],256],120001:[[108],256],120002:[[109],256],120003:[[110],256],120005:[[112],256],120006:[[113],256],120007:[[114],256],120008:[[115],256],120009:[[116],256],120010:[[117],256],120011:[[118],256],120012:[[119],256],120013:[[120],256],120014:[[121],256],120015:[[122],256],120016:[[65],256],120017:[[66],256],120018:[[67],256],120019:[[68],256],120020:[[69],256],120021:[[70],256],120022:[[71],256],120023:[[72],256],120024:[[73],256],120025:[[74],256],120026:[[75],256],120027:[[76],256],120028:[[77],256],120029:[[78],256],120030:[[79],256],120031:[[80],256],120032:[[81],256],120033:[[82],256],120034:[[83],256],120035:[[84],256],120036:[[85],256],120037:[[86],256],120038:[[87],256],120039:[[88],256],120040:[[89],256],120041:[[90],256],120042:[[97],256],120043:[[98],256],120044:[[99],256],120045:[[100],256],120046:[[101],256],120047:[[102],256],120048:[[103],256],120049:[[104],256],120050:[[105],256],120051:[[106],256],120052:[[107],256],120053:[[108],256],120054:[[109],256],120055:[[110],256],120056:[[111],256],120057:[[112],256],120058:[[113],256],120059:[[114],256],120060:[[115],256],120061:[[116],256],120062:[[117],256],120063:[[118],256]}, + 54528:{120064:[[119],256],120065:[[120],256],120066:[[121],256],120067:[[122],256],120068:[[65],256],120069:[[66],256],120071:[[68],256],120072:[[69],256],120073:[[70],256],120074:[[71],256],120077:[[74],256],120078:[[75],256],120079:[[76],256],120080:[[77],256],120081:[[78],256],120082:[[79],256],120083:[[80],256],120084:[[81],256],120086:[[83],256],120087:[[84],256],120088:[[85],256],120089:[[86],256],120090:[[87],256],120091:[[88],256],120092:[[89],256],120094:[[97],256],120095:[[98],256],120096:[[99],256],120097:[[100],256],120098:[[101],256],120099:[[102],256],120100:[[103],256],120101:[[104],256],120102:[[105],256],120103:[[106],256],120104:[[107],256],120105:[[108],256],120106:[[109],256],120107:[[110],256],120108:[[111],256],120109:[[112],256],120110:[[113],256],120111:[[114],256],120112:[[115],256],120113:[[116],256],120114:[[117],256],120115:[[118],256],120116:[[119],256],120117:[[120],256],120118:[[121],256],120119:[[122],256],120120:[[65],256],120121:[[66],256],120123:[[68],256],120124:[[69],256],120125:[[70],256],120126:[[71],256],120128:[[73],256],120129:[[74],256],120130:[[75],256],120131:[[76],256],120132:[[77],256],120134:[[79],256],120138:[[83],256],120139:[[84],256],120140:[[85],256],120141:[[86],256],120142:[[87],256],120143:[[88],256],120144:[[89],256],120146:[[97],256],120147:[[98],256],120148:[[99],256],120149:[[100],256],120150:[[101],256],120151:[[102],256],120152:[[103],256],120153:[[104],256],120154:[[105],256],120155:[[106],256],120156:[[107],256],120157:[[108],256],120158:[[109],256],120159:[[110],256],120160:[[111],256],120161:[[112],256],120162:[[113],256],120163:[[114],256],120164:[[115],256],120165:[[116],256],120166:[[117],256],120167:[[118],256],120168:[[119],256],120169:[[120],256],120170:[[121],256],120171:[[122],256],120172:[[65],256],120173:[[66],256],120174:[[67],256],120175:[[68],256],120176:[[69],256],120177:[[70],256],120178:[[71],256],120179:[[72],256],120180:[[73],256],120181:[[74],256],120182:[[75],256],120183:[[76],256],120184:[[77],256],120185:[[78],256],120186:[[79],256],120187:[[80],256],120188:[[81],256],120189:[[82],256],120190:[[83],256],120191:[[84],256],120192:[[85],256],120193:[[86],256],120194:[[87],256],120195:[[88],256],120196:[[89],256],120197:[[90],256],120198:[[97],256],120199:[[98],256],120200:[[99],256],120201:[[100],256],120202:[[101],256],120203:[[102],256],120204:[[103],256],120205:[[104],256],120206:[[105],256],120207:[[106],256],120208:[[107],256],120209:[[108],256],120210:[[109],256],120211:[[110],256],120212:[[111],256],120213:[[112],256],120214:[[113],256],120215:[[114],256],120216:[[115],256],120217:[[116],256],120218:[[117],256],120219:[[118],256],120220:[[119],256],120221:[[120],256],120222:[[121],256],120223:[[122],256],120224:[[65],256],120225:[[66],256],120226:[[67],256],120227:[[68],256],120228:[[69],256],120229:[[70],256],120230:[[71],256],120231:[[72],256],120232:[[73],256],120233:[[74],256],120234:[[75],256],120235:[[76],256],120236:[[77],256],120237:[[78],256],120238:[[79],256],120239:[[80],256],120240:[[81],256],120241:[[82],256],120242:[[83],256],120243:[[84],256],120244:[[85],256],120245:[[86],256],120246:[[87],256],120247:[[88],256],120248:[[89],256],120249:[[90],256],120250:[[97],256],120251:[[98],256],120252:[[99],256],120253:[[100],256],120254:[[101],256],120255:[[102],256],120256:[[103],256],120257:[[104],256],120258:[[105],256],120259:[[106],256],120260:[[107],256],120261:[[108],256],120262:[[109],256],120263:[[110],256],120264:[[111],256],120265:[[112],256],120266:[[113],256],120267:[[114],256],120268:[[115],256],120269:[[116],256],120270:[[117],256],120271:[[118],256],120272:[[119],256],120273:[[120],256],120274:[[121],256],120275:[[122],256],120276:[[65],256],120277:[[66],256],120278:[[67],256],120279:[[68],256],120280:[[69],256],120281:[[70],256],120282:[[71],256],120283:[[72],256],120284:[[73],256],120285:[[74],256],120286:[[75],256],120287:[[76],256],120288:[[77],256],120289:[[78],256],120290:[[79],256],120291:[[80],256],120292:[[81],256],120293:[[82],256],120294:[[83],256],120295:[[84],256],120296:[[85],256],120297:[[86],256],120298:[[87],256],120299:[[88],256],120300:[[89],256],120301:[[90],256],120302:[[97],256],120303:[[98],256],120304:[[99],256],120305:[[100],256],120306:[[101],256],120307:[[102],256],120308:[[103],256],120309:[[104],256],120310:[[105],256],120311:[[106],256],120312:[[107],256],120313:[[108],256],120314:[[109],256],120315:[[110],256],120316:[[111],256],120317:[[112],256],120318:[[113],256],120319:[[114],256]}, + 54784:{120320:[[115],256],120321:[[116],256],120322:[[117],256],120323:[[118],256],120324:[[119],256],120325:[[120],256],120326:[[121],256],120327:[[122],256],120328:[[65],256],120329:[[66],256],120330:[[67],256],120331:[[68],256],120332:[[69],256],120333:[[70],256],120334:[[71],256],120335:[[72],256],120336:[[73],256],120337:[[74],256],120338:[[75],256],120339:[[76],256],120340:[[77],256],120341:[[78],256],120342:[[79],256],120343:[[80],256],120344:[[81],256],120345:[[82],256],120346:[[83],256],120347:[[84],256],120348:[[85],256],120349:[[86],256],120350:[[87],256],120351:[[88],256],120352:[[89],256],120353:[[90],256],120354:[[97],256],120355:[[98],256],120356:[[99],256],120357:[[100],256],120358:[[101],256],120359:[[102],256],120360:[[103],256],120361:[[104],256],120362:[[105],256],120363:[[106],256],120364:[[107],256],120365:[[108],256],120366:[[109],256],120367:[[110],256],120368:[[111],256],120369:[[112],256],120370:[[113],256],120371:[[114],256],120372:[[115],256],120373:[[116],256],120374:[[117],256],120375:[[118],256],120376:[[119],256],120377:[[120],256],120378:[[121],256],120379:[[122],256],120380:[[65],256],120381:[[66],256],120382:[[67],256],120383:[[68],256],120384:[[69],256],120385:[[70],256],120386:[[71],256],120387:[[72],256],120388:[[73],256],120389:[[74],256],120390:[[75],256],120391:[[76],256],120392:[[77],256],120393:[[78],256],120394:[[79],256],120395:[[80],256],120396:[[81],256],120397:[[82],256],120398:[[83],256],120399:[[84],256],120400:[[85],256],120401:[[86],256],120402:[[87],256],120403:[[88],256],120404:[[89],256],120405:[[90],256],120406:[[97],256],120407:[[98],256],120408:[[99],256],120409:[[100],256],120410:[[101],256],120411:[[102],256],120412:[[103],256],120413:[[104],256],120414:[[105],256],120415:[[106],256],120416:[[107],256],120417:[[108],256],120418:[[109],256],120419:[[110],256],120420:[[111],256],120421:[[112],256],120422:[[113],256],120423:[[114],256],120424:[[115],256],120425:[[116],256],120426:[[117],256],120427:[[118],256],120428:[[119],256],120429:[[120],256],120430:[[121],256],120431:[[122],256],120432:[[65],256],120433:[[66],256],120434:[[67],256],120435:[[68],256],120436:[[69],256],120437:[[70],256],120438:[[71],256],120439:[[72],256],120440:[[73],256],120441:[[74],256],120442:[[75],256],120443:[[76],256],120444:[[77],256],120445:[[78],256],120446:[[79],256],120447:[[80],256],120448:[[81],256],120449:[[82],256],120450:[[83],256],120451:[[84],256],120452:[[85],256],120453:[[86],256],120454:[[87],256],120455:[[88],256],120456:[[89],256],120457:[[90],256],120458:[[97],256],120459:[[98],256],120460:[[99],256],120461:[[100],256],120462:[[101],256],120463:[[102],256],120464:[[103],256],120465:[[104],256],120466:[[105],256],120467:[[106],256],120468:[[107],256],120469:[[108],256],120470:[[109],256],120471:[[110],256],120472:[[111],256],120473:[[112],256],120474:[[113],256],120475:[[114],256],120476:[[115],256],120477:[[116],256],120478:[[117],256],120479:[[118],256],120480:[[119],256],120481:[[120],256],120482:[[121],256],120483:[[122],256],120484:[[305],256],120485:[[567],256],120488:[[913],256],120489:[[914],256],120490:[[915],256],120491:[[916],256],120492:[[917],256],120493:[[918],256],120494:[[919],256],120495:[[920],256],120496:[[921],256],120497:[[922],256],120498:[[923],256],120499:[[924],256],120500:[[925],256],120501:[[926],256],120502:[[927],256],120503:[[928],256],120504:[[929],256],120505:[[1012],256],120506:[[931],256],120507:[[932],256],120508:[[933],256],120509:[[934],256],120510:[[935],256],120511:[[936],256],120512:[[937],256],120513:[[8711],256],120514:[[945],256],120515:[[946],256],120516:[[947],256],120517:[[948],256],120518:[[949],256],120519:[[950],256],120520:[[951],256],120521:[[952],256],120522:[[953],256],120523:[[954],256],120524:[[955],256],120525:[[956],256],120526:[[957],256],120527:[[958],256],120528:[[959],256],120529:[[960],256],120530:[[961],256],120531:[[962],256],120532:[[963],256],120533:[[964],256],120534:[[965],256],120535:[[966],256],120536:[[967],256],120537:[[968],256],120538:[[969],256],120539:[[8706],256],120540:[[1013],256],120541:[[977],256],120542:[[1008],256],120543:[[981],256],120544:[[1009],256],120545:[[982],256],120546:[[913],256],120547:[[914],256],120548:[[915],256],120549:[[916],256],120550:[[917],256],120551:[[918],256],120552:[[919],256],120553:[[920],256],120554:[[921],256],120555:[[922],256],120556:[[923],256],120557:[[924],256],120558:[[925],256],120559:[[926],256],120560:[[927],256],120561:[[928],256],120562:[[929],256],120563:[[1012],256],120564:[[931],256],120565:[[932],256],120566:[[933],256],120567:[[934],256],120568:[[935],256],120569:[[936],256],120570:[[937],256],120571:[[8711],256],120572:[[945],256],120573:[[946],256],120574:[[947],256],120575:[[948],256]}, + 55040:{120576:[[949],256],120577:[[950],256],120578:[[951],256],120579:[[952],256],120580:[[953],256],120581:[[954],256],120582:[[955],256],120583:[[956],256],120584:[[957],256],120585:[[958],256],120586:[[959],256],120587:[[960],256],120588:[[961],256],120589:[[962],256],120590:[[963],256],120591:[[964],256],120592:[[965],256],120593:[[966],256],120594:[[967],256],120595:[[968],256],120596:[[969],256],120597:[[8706],256],120598:[[1013],256],120599:[[977],256],120600:[[1008],256],120601:[[981],256],120602:[[1009],256],120603:[[982],256],120604:[[913],256],120605:[[914],256],120606:[[915],256],120607:[[916],256],120608:[[917],256],120609:[[918],256],120610:[[919],256],120611:[[920],256],120612:[[921],256],120613:[[922],256],120614:[[923],256],120615:[[924],256],120616:[[925],256],120617:[[926],256],120618:[[927],256],120619:[[928],256],120620:[[929],256],120621:[[1012],256],120622:[[931],256],120623:[[932],256],120624:[[933],256],120625:[[934],256],120626:[[935],256],120627:[[936],256],120628:[[937],256],120629:[[8711],256],120630:[[945],256],120631:[[946],256],120632:[[947],256],120633:[[948],256],120634:[[949],256],120635:[[950],256],120636:[[951],256],120637:[[952],256],120638:[[953],256],120639:[[954],256],120640:[[955],256],120641:[[956],256],120642:[[957],256],120643:[[958],256],120644:[[959],256],120645:[[960],256],120646:[[961],256],120647:[[962],256],120648:[[963],256],120649:[[964],256],120650:[[965],256],120651:[[966],256],120652:[[967],256],120653:[[968],256],120654:[[969],256],120655:[[8706],256],120656:[[1013],256],120657:[[977],256],120658:[[1008],256],120659:[[981],256],120660:[[1009],256],120661:[[982],256],120662:[[913],256],120663:[[914],256],120664:[[915],256],120665:[[916],256],120666:[[917],256],120667:[[918],256],120668:[[919],256],120669:[[920],256],120670:[[921],256],120671:[[922],256],120672:[[923],256],120673:[[924],256],120674:[[925],256],120675:[[926],256],120676:[[927],256],120677:[[928],256],120678:[[929],256],120679:[[1012],256],120680:[[931],256],120681:[[932],256],120682:[[933],256],120683:[[934],256],120684:[[935],256],120685:[[936],256],120686:[[937],256],120687:[[8711],256],120688:[[945],256],120689:[[946],256],120690:[[947],256],120691:[[948],256],120692:[[949],256],120693:[[950],256],120694:[[951],256],120695:[[952],256],120696:[[953],256],120697:[[954],256],120698:[[955],256],120699:[[956],256],120700:[[957],256],120701:[[958],256],120702:[[959],256],120703:[[960],256],120704:[[961],256],120705:[[962],256],120706:[[963],256],120707:[[964],256],120708:[[965],256],120709:[[966],256],120710:[[967],256],120711:[[968],256],120712:[[969],256],120713:[[8706],256],120714:[[1013],256],120715:[[977],256],120716:[[1008],256],120717:[[981],256],120718:[[1009],256],120719:[[982],256],120720:[[913],256],120721:[[914],256],120722:[[915],256],120723:[[916],256],120724:[[917],256],120725:[[918],256],120726:[[919],256],120727:[[920],256],120728:[[921],256],120729:[[922],256],120730:[[923],256],120731:[[924],256],120732:[[925],256],120733:[[926],256],120734:[[927],256],120735:[[928],256],120736:[[929],256],120737:[[1012],256],120738:[[931],256],120739:[[932],256],120740:[[933],256],120741:[[934],256],120742:[[935],256],120743:[[936],256],120744:[[937],256],120745:[[8711],256],120746:[[945],256],120747:[[946],256],120748:[[947],256],120749:[[948],256],120750:[[949],256],120751:[[950],256],120752:[[951],256],120753:[[952],256],120754:[[953],256],120755:[[954],256],120756:[[955],256],120757:[[956],256],120758:[[957],256],120759:[[958],256],120760:[[959],256],120761:[[960],256],120762:[[961],256],120763:[[962],256],120764:[[963],256],120765:[[964],256],120766:[[965],256],120767:[[966],256],120768:[[967],256],120769:[[968],256],120770:[[969],256],120771:[[8706],256],120772:[[1013],256],120773:[[977],256],120774:[[1008],256],120775:[[981],256],120776:[[1009],256],120777:[[982],256],120778:[[988],256],120779:[[989],256],120782:[[48],256],120783:[[49],256],120784:[[50],256],120785:[[51],256],120786:[[52],256],120787:[[53],256],120788:[[54],256],120789:[[55],256],120790:[[56],256],120791:[[57],256],120792:[[48],256],120793:[[49],256],120794:[[50],256],120795:[[51],256],120796:[[52],256],120797:[[53],256],120798:[[54],256],120799:[[55],256],120800:[[56],256],120801:[[57],256],120802:[[48],256],120803:[[49],256],120804:[[50],256],120805:[[51],256],120806:[[52],256],120807:[[53],256],120808:[[54],256],120809:[[55],256],120810:[[56],256],120811:[[57],256],120812:[[48],256],120813:[[49],256],120814:[[50],256],120815:[[51],256],120816:[[52],256],120817:[[53],256],120818:[[54],256],120819:[[55],256],120820:[[56],256],120821:[[57],256],120822:[[48],256],120823:[[49],256],120824:[[50],256],120825:[[51],256],120826:[[52],256],120827:[[53],256],120828:[[54],256],120829:[[55],256],120830:[[56],256],120831:[[57],256]}, + 60928:{126464:[[1575],256],126465:[[1576],256],126466:[[1580],256],126467:[[1583],256],126469:[[1608],256],126470:[[1586],256],126471:[[1581],256],126472:[[1591],256],126473:[[1610],256],126474:[[1603],256],126475:[[1604],256],126476:[[1605],256],126477:[[1606],256],126478:[[1587],256],126479:[[1593],256],126480:[[1601],256],126481:[[1589],256],126482:[[1602],256],126483:[[1585],256],126484:[[1588],256],126485:[[1578],256],126486:[[1579],256],126487:[[1582],256],126488:[[1584],256],126489:[[1590],256],126490:[[1592],256],126491:[[1594],256],126492:[[1646],256],126493:[[1722],256],126494:[[1697],256],126495:[[1647],256],126497:[[1576],256],126498:[[1580],256],126500:[[1607],256],126503:[[1581],256],126505:[[1610],256],126506:[[1603],256],126507:[[1604],256],126508:[[1605],256],126509:[[1606],256],126510:[[1587],256],126511:[[1593],256],126512:[[1601],256],126513:[[1589],256],126514:[[1602],256],126516:[[1588],256],126517:[[1578],256],126518:[[1579],256],126519:[[1582],256],126521:[[1590],256],126523:[[1594],256],126530:[[1580],256],126535:[[1581],256],126537:[[1610],256],126539:[[1604],256],126541:[[1606],256],126542:[[1587],256],126543:[[1593],256],126545:[[1589],256],126546:[[1602],256],126548:[[1588],256],126551:[[1582],256],126553:[[1590],256],126555:[[1594],256],126557:[[1722],256],126559:[[1647],256],126561:[[1576],256],126562:[[1580],256],126564:[[1607],256],126567:[[1581],256],126568:[[1591],256],126569:[[1610],256],126570:[[1603],256],126572:[[1605],256],126573:[[1606],256],126574:[[1587],256],126575:[[1593],256],126576:[[1601],256],126577:[[1589],256],126578:[[1602],256],126580:[[1588],256],126581:[[1578],256],126582:[[1579],256],126583:[[1582],256],126585:[[1590],256],126586:[[1592],256],126587:[[1594],256],126588:[[1646],256],126590:[[1697],256],126592:[[1575],256],126593:[[1576],256],126594:[[1580],256],126595:[[1583],256],126596:[[1607],256],126597:[[1608],256],126598:[[1586],256],126599:[[1581],256],126600:[[1591],256],126601:[[1610],256],126603:[[1604],256],126604:[[1605],256],126605:[[1606],256],126606:[[1587],256],126607:[[1593],256],126608:[[1601],256],126609:[[1589],256],126610:[[1602],256],126611:[[1585],256],126612:[[1588],256],126613:[[1578],256],126614:[[1579],256],126615:[[1582],256],126616:[[1584],256],126617:[[1590],256],126618:[[1592],256],126619:[[1594],256],126625:[[1576],256],126626:[[1580],256],126627:[[1583],256],126629:[[1608],256],126630:[[1586],256],126631:[[1581],256],126632:[[1591],256],126633:[[1610],256],126635:[[1604],256],126636:[[1605],256],126637:[[1606],256],126638:[[1587],256],126639:[[1593],256],126640:[[1601],256],126641:[[1589],256],126642:[[1602],256],126643:[[1585],256],126644:[[1588],256],126645:[[1578],256],126646:[[1579],256],126647:[[1582],256],126648:[[1584],256],126649:[[1590],256],126650:[[1592],256],126651:[[1594],256]}, + 61696:{127232:[[48,46],256],127233:[[48,44],256],127234:[[49,44],256],127235:[[50,44],256],127236:[[51,44],256],127237:[[52,44],256],127238:[[53,44],256],127239:[[54,44],256],127240:[[55,44],256],127241:[[56,44],256],127242:[[57,44],256],127248:[[40,65,41],256],127249:[[40,66,41],256],127250:[[40,67,41],256],127251:[[40,68,41],256],127252:[[40,69,41],256],127253:[[40,70,41],256],127254:[[40,71,41],256],127255:[[40,72,41],256],127256:[[40,73,41],256],127257:[[40,74,41],256],127258:[[40,75,41],256],127259:[[40,76,41],256],127260:[[40,77,41],256],127261:[[40,78,41],256],127262:[[40,79,41],256],127263:[[40,80,41],256],127264:[[40,81,41],256],127265:[[40,82,41],256],127266:[[40,83,41],256],127267:[[40,84,41],256],127268:[[40,85,41],256],127269:[[40,86,41],256],127270:[[40,87,41],256],127271:[[40,88,41],256],127272:[[40,89,41],256],127273:[[40,90,41],256],127274:[[12308,83,12309],256],127275:[[67],256],127276:[[82],256],127277:[[67,68],256],127278:[[87,90],256],127280:[[65],256],127281:[[66],256],127282:[[67],256],127283:[[68],256],127284:[[69],256],127285:[[70],256],127286:[[71],256],127287:[[72],256],127288:[[73],256],127289:[[74],256],127290:[[75],256],127291:[[76],256],127292:[[77],256],127293:[[78],256],127294:[[79],256],127295:[[80],256],127296:[[81],256],127297:[[82],256],127298:[[83],256],127299:[[84],256],127300:[[85],256],127301:[[86],256],127302:[[87],256],127303:[[88],256],127304:[[89],256],127305:[[90],256],127306:[[72,86],256],127307:[[77,86],256],127308:[[83,68],256],127309:[[83,83],256],127310:[[80,80,86],256],127311:[[87,67],256],127338:[[77,67],256],127339:[[77,68],256],127376:[[68,74],256]}, + 61952:{127488:[[12411,12363],256],127489:[[12467,12467],256],127490:[[12469],256],127504:[[25163],256],127505:[[23383],256],127506:[[21452],256],127507:[[12487],256],127508:[[20108],256],127509:[[22810],256],127510:[[35299],256],127511:[[22825],256],127512:[[20132],256],127513:[[26144],256],127514:[[28961],256],127515:[[26009],256],127516:[[21069],256],127517:[[24460],256],127518:[[20877],256],127519:[[26032],256],127520:[[21021],256],127521:[[32066],256],127522:[[29983],256],127523:[[36009],256],127524:[[22768],256],127525:[[21561],256],127526:[[28436],256],127527:[[25237],256],127528:[[25429],256],127529:[[19968],256],127530:[[19977],256],127531:[[36938],256],127532:[[24038],256],127533:[[20013],256],127534:[[21491],256],127535:[[25351],256],127536:[[36208],256],127537:[[25171],256],127538:[[31105],256],127539:[[31354],256],127540:[[21512],256],127541:[[28288],256],127542:[[26377],256],127543:[[26376],256],127544:[[30003],256],127545:[[21106],256],127546:[[21942],256],127552:[[12308,26412,12309],256],127553:[[12308,19977,12309],256],127554:[[12308,20108,12309],256],127555:[[12308,23433,12309],256],127556:[[12308,28857,12309],256],127557:[[12308,25171,12309],256],127558:[[12308,30423,12309],256],127559:[[12308,21213,12309],256],127560:[[12308,25943,12309],256],127568:[[24471],256],127569:[[21487],256]}, + 63488:{194560:[[20029]],194561:[[20024]],194562:[[20033]],194563:[[131362]],194564:[[20320]],194565:[[20398]],194566:[[20411]],194567:[[20482]],194568:[[20602]],194569:[[20633]],194570:[[20711]],194571:[[20687]],194572:[[13470]],194573:[[132666]],194574:[[20813]],194575:[[20820]],194576:[[20836]],194577:[[20855]],194578:[[132380]],194579:[[13497]],194580:[[20839]],194581:[[20877]],194582:[[132427]],194583:[[20887]],194584:[[20900]],194585:[[20172]],194586:[[20908]],194587:[[20917]],194588:[[168415]],194589:[[20981]],194590:[[20995]],194591:[[13535]],194592:[[21051]],194593:[[21062]],194594:[[21106]],194595:[[21111]],194596:[[13589]],194597:[[21191]],194598:[[21193]],194599:[[21220]],194600:[[21242]],194601:[[21253]],194602:[[21254]],194603:[[21271]],194604:[[21321]],194605:[[21329]],194606:[[21338]],194607:[[21363]],194608:[[21373]],194609:[[21375]],194610:[[21375]],194611:[[21375]],194612:[[133676]],194613:[[28784]],194614:[[21450]],194615:[[21471]],194616:[[133987]],194617:[[21483]],194618:[[21489]],194619:[[21510]],194620:[[21662]],194621:[[21560]],194622:[[21576]],194623:[[21608]],194624:[[21666]],194625:[[21750]],194626:[[21776]],194627:[[21843]],194628:[[21859]],194629:[[21892]],194630:[[21892]],194631:[[21913]],194632:[[21931]],194633:[[21939]],194634:[[21954]],194635:[[22294]],194636:[[22022]],194637:[[22295]],194638:[[22097]],194639:[[22132]],194640:[[20999]],194641:[[22766]],194642:[[22478]],194643:[[22516]],194644:[[22541]],194645:[[22411]],194646:[[22578]],194647:[[22577]],194648:[[22700]],194649:[[136420]],194650:[[22770]],194651:[[22775]],194652:[[22790]],194653:[[22810]],194654:[[22818]],194655:[[22882]],194656:[[136872]],194657:[[136938]],194658:[[23020]],194659:[[23067]],194660:[[23079]],194661:[[23000]],194662:[[23142]],194663:[[14062]],194664:[[14076]],194665:[[23304]],194666:[[23358]],194667:[[23358]],194668:[[137672]],194669:[[23491]],194670:[[23512]],194671:[[23527]],194672:[[23539]],194673:[[138008]],194674:[[23551]],194675:[[23558]],194676:[[24403]],194677:[[23586]],194678:[[14209]],194679:[[23648]],194680:[[23662]],194681:[[23744]],194682:[[23693]],194683:[[138724]],194684:[[23875]],194685:[[138726]],194686:[[23918]],194687:[[23915]],194688:[[23932]],194689:[[24033]],194690:[[24034]],194691:[[14383]],194692:[[24061]],194693:[[24104]],194694:[[24125]],194695:[[24169]],194696:[[14434]],194697:[[139651]],194698:[[14460]],194699:[[24240]],194700:[[24243]],194701:[[24246]],194702:[[24266]],194703:[[172946]],194704:[[24318]],194705:[[140081]],194706:[[140081]],194707:[[33281]],194708:[[24354]],194709:[[24354]],194710:[[14535]],194711:[[144056]],194712:[[156122]],194713:[[24418]],194714:[[24427]],194715:[[14563]],194716:[[24474]],194717:[[24525]],194718:[[24535]],194719:[[24569]],194720:[[24705]],194721:[[14650]],194722:[[14620]],194723:[[24724]],194724:[[141012]],194725:[[24775]],194726:[[24904]],194727:[[24908]],194728:[[24910]],194729:[[24908]],194730:[[24954]],194731:[[24974]],194732:[[25010]],194733:[[24996]],194734:[[25007]],194735:[[25054]],194736:[[25074]],194737:[[25078]],194738:[[25104]],194739:[[25115]],194740:[[25181]],194741:[[25265]],194742:[[25300]],194743:[[25424]],194744:[[142092]],194745:[[25405]],194746:[[25340]],194747:[[25448]],194748:[[25475]],194749:[[25572]],194750:[[142321]],194751:[[25634]],194752:[[25541]],194753:[[25513]],194754:[[14894]],194755:[[25705]],194756:[[25726]],194757:[[25757]],194758:[[25719]],194759:[[14956]],194760:[[25935]],194761:[[25964]],194762:[[143370]],194763:[[26083]],194764:[[26360]],194765:[[26185]],194766:[[15129]],194767:[[26257]],194768:[[15112]],194769:[[15076]],194770:[[20882]],194771:[[20885]],194772:[[26368]],194773:[[26268]],194774:[[32941]],194775:[[17369]],194776:[[26391]],194777:[[26395]],194778:[[26401]],194779:[[26462]],194780:[[26451]],194781:[[144323]],194782:[[15177]],194783:[[26618]],194784:[[26501]],194785:[[26706]],194786:[[26757]],194787:[[144493]],194788:[[26766]],194789:[[26655]],194790:[[26900]],194791:[[15261]],194792:[[26946]],194793:[[27043]],194794:[[27114]],194795:[[27304]],194796:[[145059]],194797:[[27355]],194798:[[15384]],194799:[[27425]],194800:[[145575]],194801:[[27476]],194802:[[15438]],194803:[[27506]],194804:[[27551]],194805:[[27578]],194806:[[27579]],194807:[[146061]],194808:[[138507]],194809:[[146170]],194810:[[27726]],194811:[[146620]],194812:[[27839]],194813:[[27853]],194814:[[27751]],194815:[[27926]]}, + 63744:{63744:[[35912]],63745:[[26356]],63746:[[36554]],63747:[[36040]],63748:[[28369]],63749:[[20018]],63750:[[21477]],63751:[[40860]],63752:[[40860]],63753:[[22865]],63754:[[37329]],63755:[[21895]],63756:[[22856]],63757:[[25078]],63758:[[30313]],63759:[[32645]],63760:[[34367]],63761:[[34746]],63762:[[35064]],63763:[[37007]],63764:[[27138]],63765:[[27931]],63766:[[28889]],63767:[[29662]],63768:[[33853]],63769:[[37226]],63770:[[39409]],63771:[[20098]],63772:[[21365]],63773:[[27396]],63774:[[29211]],63775:[[34349]],63776:[[40478]],63777:[[23888]],63778:[[28651]],63779:[[34253]],63780:[[35172]],63781:[[25289]],63782:[[33240]],63783:[[34847]],63784:[[24266]],63785:[[26391]],63786:[[28010]],63787:[[29436]],63788:[[37070]],63789:[[20358]],63790:[[20919]],63791:[[21214]],63792:[[25796]],63793:[[27347]],63794:[[29200]],63795:[[30439]],63796:[[32769]],63797:[[34310]],63798:[[34396]],63799:[[36335]],63800:[[38706]],63801:[[39791]],63802:[[40442]],63803:[[30860]],63804:[[31103]],63805:[[32160]],63806:[[33737]],63807:[[37636]],63808:[[40575]],63809:[[35542]],63810:[[22751]],63811:[[24324]],63812:[[31840]],63813:[[32894]],63814:[[29282]],63815:[[30922]],63816:[[36034]],63817:[[38647]],63818:[[22744]],63819:[[23650]],63820:[[27155]],63821:[[28122]],63822:[[28431]],63823:[[32047]],63824:[[32311]],63825:[[38475]],63826:[[21202]],63827:[[32907]],63828:[[20956]],63829:[[20940]],63830:[[31260]],63831:[[32190]],63832:[[33777]],63833:[[38517]],63834:[[35712]],63835:[[25295]],63836:[[27138]],63837:[[35582]],63838:[[20025]],63839:[[23527]],63840:[[24594]],63841:[[29575]],63842:[[30064]],63843:[[21271]],63844:[[30971]],63845:[[20415]],63846:[[24489]],63847:[[19981]],63848:[[27852]],63849:[[25976]],63850:[[32034]],63851:[[21443]],63852:[[22622]],63853:[[30465]],63854:[[33865]],63855:[[35498]],63856:[[27578]],63857:[[36784]],63858:[[27784]],63859:[[25342]],63860:[[33509]],63861:[[25504]],63862:[[30053]],63863:[[20142]],63864:[[20841]],63865:[[20937]],63866:[[26753]],63867:[[31975]],63868:[[33391]],63869:[[35538]],63870:[[37327]],63871:[[21237]],63872:[[21570]],63873:[[22899]],63874:[[24300]],63875:[[26053]],63876:[[28670]],63877:[[31018]],63878:[[38317]],63879:[[39530]],63880:[[40599]],63881:[[40654]],63882:[[21147]],63883:[[26310]],63884:[[27511]],63885:[[36706]],63886:[[24180]],63887:[[24976]],63888:[[25088]],63889:[[25754]],63890:[[28451]],63891:[[29001]],63892:[[29833]],63893:[[31178]],63894:[[32244]],63895:[[32879]],63896:[[36646]],63897:[[34030]],63898:[[36899]],63899:[[37706]],63900:[[21015]],63901:[[21155]],63902:[[21693]],63903:[[28872]],63904:[[35010]],63905:[[35498]],63906:[[24265]],63907:[[24565]],63908:[[25467]],63909:[[27566]],63910:[[31806]],63911:[[29557]],63912:[[20196]],63913:[[22265]],63914:[[23527]],63915:[[23994]],63916:[[24604]],63917:[[29618]],63918:[[29801]],63919:[[32666]],63920:[[32838]],63921:[[37428]],63922:[[38646]],63923:[[38728]],63924:[[38936]],63925:[[20363]],63926:[[31150]],63927:[[37300]],63928:[[38584]],63929:[[24801]],63930:[[20102]],63931:[[20698]],63932:[[23534]],63933:[[23615]],63934:[[26009]],63935:[[27138]],63936:[[29134]],63937:[[30274]],63938:[[34044]],63939:[[36988]],63940:[[40845]],63941:[[26248]],63942:[[38446]],63943:[[21129]],63944:[[26491]],63945:[[26611]],63946:[[27969]],63947:[[28316]],63948:[[29705]],63949:[[30041]],63950:[[30827]],63951:[[32016]],63952:[[39006]],63953:[[20845]],63954:[[25134]],63955:[[38520]],63956:[[20523]],63957:[[23833]],63958:[[28138]],63959:[[36650]],63960:[[24459]],63961:[[24900]],63962:[[26647]],63963:[[29575]],63964:[[38534]],63965:[[21033]],63966:[[21519]],63967:[[23653]],63968:[[26131]],63969:[[26446]],63970:[[26792]],63971:[[27877]],63972:[[29702]],63973:[[30178]],63974:[[32633]],63975:[[35023]],63976:[[35041]],63977:[[37324]],63978:[[38626]],63979:[[21311]],63980:[[28346]],63981:[[21533]],63982:[[29136]],63983:[[29848]],63984:[[34298]],63985:[[38563]],63986:[[40023]],63987:[[40607]],63988:[[26519]],63989:[[28107]],63990:[[33256]],63991:[[31435]],63992:[[31520]],63993:[[31890]],63994:[[29376]],63995:[[28825]],63996:[[35672]],63997:[[20160]],63998:[[33590]],63999:[[21050]],194816:[[27966]],194817:[[28023]],194818:[[27969]],194819:[[28009]],194820:[[28024]],194821:[[28037]],194822:[[146718]],194823:[[27956]],194824:[[28207]],194825:[[28270]],194826:[[15667]],194827:[[28363]],194828:[[28359]],194829:[[147153]],194830:[[28153]],194831:[[28526]],194832:[[147294]],194833:[[147342]],194834:[[28614]],194835:[[28729]],194836:[[28702]],194837:[[28699]],194838:[[15766]],194839:[[28746]],194840:[[28797]],194841:[[28791]],194842:[[28845]],194843:[[132389]],194844:[[28997]],194845:[[148067]],194846:[[29084]],194847:[[148395]],194848:[[29224]],194849:[[29237]],194850:[[29264]],194851:[[149000]],194852:[[29312]],194853:[[29333]],194854:[[149301]],194855:[[149524]],194856:[[29562]],194857:[[29579]],194858:[[16044]],194859:[[29605]],194860:[[16056]],194861:[[16056]],194862:[[29767]],194863:[[29788]],194864:[[29809]],194865:[[29829]],194866:[[29898]],194867:[[16155]],194868:[[29988]],194869:[[150582]],194870:[[30014]],194871:[[150674]],194872:[[30064]],194873:[[139679]],194874:[[30224]],194875:[[151457]],194876:[[151480]],194877:[[151620]],194878:[[16380]],194879:[[16392]],194880:[[30452]],194881:[[151795]],194882:[[151794]],194883:[[151833]],194884:[[151859]],194885:[[30494]],194886:[[30495]],194887:[[30495]],194888:[[30538]],194889:[[16441]],194890:[[30603]],194891:[[16454]],194892:[[16534]],194893:[[152605]],194894:[[30798]],194895:[[30860]],194896:[[30924]],194897:[[16611]],194898:[[153126]],194899:[[31062]],194900:[[153242]],194901:[[153285]],194902:[[31119]],194903:[[31211]],194904:[[16687]],194905:[[31296]],194906:[[31306]],194907:[[31311]],194908:[[153980]],194909:[[154279]],194910:[[154279]],194911:[[31470]],194912:[[16898]],194913:[[154539]],194914:[[31686]],194915:[[31689]],194916:[[16935]],194917:[[154752]],194918:[[31954]],194919:[[17056]],194920:[[31976]],194921:[[31971]],194922:[[32000]],194923:[[155526]],194924:[[32099]],194925:[[17153]],194926:[[32199]],194927:[[32258]],194928:[[32325]],194929:[[17204]],194930:[[156200]],194931:[[156231]],194932:[[17241]],194933:[[156377]],194934:[[32634]],194935:[[156478]],194936:[[32661]],194937:[[32762]],194938:[[32773]],194939:[[156890]],194940:[[156963]],194941:[[32864]],194942:[[157096]],194943:[[32880]],194944:[[144223]],194945:[[17365]],194946:[[32946]],194947:[[33027]],194948:[[17419]],194949:[[33086]],194950:[[23221]],194951:[[157607]],194952:[[157621]],194953:[[144275]],194954:[[144284]],194955:[[33281]],194956:[[33284]],194957:[[36766]],194958:[[17515]],194959:[[33425]],194960:[[33419]],194961:[[33437]],194962:[[21171]],194963:[[33457]],194964:[[33459]],194965:[[33469]],194966:[[33510]],194967:[[158524]],194968:[[33509]],194969:[[33565]],194970:[[33635]],194971:[[33709]],194972:[[33571]],194973:[[33725]],194974:[[33767]],194975:[[33879]],194976:[[33619]],194977:[[33738]],194978:[[33740]],194979:[[33756]],194980:[[158774]],194981:[[159083]],194982:[[158933]],194983:[[17707]],194984:[[34033]],194985:[[34035]],194986:[[34070]],194987:[[160714]],194988:[[34148]],194989:[[159532]],194990:[[17757]],194991:[[17761]],194992:[[159665]],194993:[[159954]],194994:[[17771]],194995:[[34384]],194996:[[34396]],194997:[[34407]],194998:[[34409]],194999:[[34473]],195000:[[34440]],195001:[[34574]],195002:[[34530]],195003:[[34681]],195004:[[34600]],195005:[[34667]],195006:[[34694]],195007:[[17879]],195008:[[34785]],195009:[[34817]],195010:[[17913]],195011:[[34912]],195012:[[34915]],195013:[[161383]],195014:[[35031]],195015:[[35038]],195016:[[17973]],195017:[[35066]],195018:[[13499]],195019:[[161966]],195020:[[162150]],195021:[[18110]],195022:[[18119]],195023:[[35488]],195024:[[35565]],195025:[[35722]],195026:[[35925]],195027:[[162984]],195028:[[36011]],195029:[[36033]],195030:[[36123]],195031:[[36215]],195032:[[163631]],195033:[[133124]],195034:[[36299]],195035:[[36284]],195036:[[36336]],195037:[[133342]],195038:[[36564]],195039:[[36664]],195040:[[165330]],195041:[[165357]],195042:[[37012]],195043:[[37105]],195044:[[37137]],195045:[[165678]],195046:[[37147]],195047:[[37432]],195048:[[37591]],195049:[[37592]],195050:[[37500]],195051:[[37881]],195052:[[37909]],195053:[[166906]],195054:[[38283]],195055:[[18837]],195056:[[38327]],195057:[[167287]],195058:[[18918]],195059:[[38595]],195060:[[23986]],195061:[[38691]],195062:[[168261]],195063:[[168474]],195064:[[19054]],195065:[[19062]],195066:[[38880]],195067:[[168970]],195068:[[19122]],195069:[[169110]],195070:[[38923]],195071:[[38923]]}, + 64000:{64000:[[20999]],64001:[[24230]],64002:[[25299]],64003:[[31958]],64004:[[23429]],64005:[[27934]],64006:[[26292]],64007:[[36667]],64008:[[34892]],64009:[[38477]],64010:[[35211]],64011:[[24275]],64012:[[20800]],64013:[[21952]],64016:[[22618]],64018:[[26228]],64021:[[20958]],64022:[[29482]],64023:[[30410]],64024:[[31036]],64025:[[31070]],64026:[[31077]],64027:[[31119]],64028:[[38742]],64029:[[31934]],64030:[[32701]],64032:[[34322]],64034:[[35576]],64037:[[36920]],64038:[[37117]],64042:[[39151]],64043:[[39164]],64044:[[39208]],64045:[[40372]],64046:[[37086]],64047:[[38583]],64048:[[20398]],64049:[[20711]],64050:[[20813]],64051:[[21193]],64052:[[21220]],64053:[[21329]],64054:[[21917]],64055:[[22022]],64056:[[22120]],64057:[[22592]],64058:[[22696]],64059:[[23652]],64060:[[23662]],64061:[[24724]],64062:[[24936]],64063:[[24974]],64064:[[25074]],64065:[[25935]],64066:[[26082]],64067:[[26257]],64068:[[26757]],64069:[[28023]],64070:[[28186]],64071:[[28450]],64072:[[29038]],64073:[[29227]],64074:[[29730]],64075:[[30865]],64076:[[31038]],64077:[[31049]],64078:[[31048]],64079:[[31056]],64080:[[31062]],64081:[[31069]],64082:[[31117]],64083:[[31118]],64084:[[31296]],64085:[[31361]],64086:[[31680]],64087:[[32244]],64088:[[32265]],64089:[[32321]],64090:[[32626]],64091:[[32773]],64092:[[33261]],64093:[[33401]],64094:[[33401]],64095:[[33879]],64096:[[35088]],64097:[[35222]],64098:[[35585]],64099:[[35641]],64100:[[36051]],64101:[[36104]],64102:[[36790]],64103:[[36920]],64104:[[38627]],64105:[[38911]],64106:[[38971]],64107:[[24693]],64108:[[148206]],64109:[[33304]],64112:[[20006]],64113:[[20917]],64114:[[20840]],64115:[[20352]],64116:[[20805]],64117:[[20864]],64118:[[21191]],64119:[[21242]],64120:[[21917]],64121:[[21845]],64122:[[21913]],64123:[[21986]],64124:[[22618]],64125:[[22707]],64126:[[22852]],64127:[[22868]],64128:[[23138]],64129:[[23336]],64130:[[24274]],64131:[[24281]],64132:[[24425]],64133:[[24493]],64134:[[24792]],64135:[[24910]],64136:[[24840]],64137:[[24974]],64138:[[24928]],64139:[[25074]],64140:[[25140]],64141:[[25540]],64142:[[25628]],64143:[[25682]],64144:[[25942]],64145:[[26228]],64146:[[26391]],64147:[[26395]],64148:[[26454]],64149:[[27513]],64150:[[27578]],64151:[[27969]],64152:[[28379]],64153:[[28363]],64154:[[28450]],64155:[[28702]],64156:[[29038]],64157:[[30631]],64158:[[29237]],64159:[[29359]],64160:[[29482]],64161:[[29809]],64162:[[29958]],64163:[[30011]],64164:[[30237]],64165:[[30239]],64166:[[30410]],64167:[[30427]],64168:[[30452]],64169:[[30538]],64170:[[30528]],64171:[[30924]],64172:[[31409]],64173:[[31680]],64174:[[31867]],64175:[[32091]],64176:[[32244]],64177:[[32574]],64178:[[32773]],64179:[[33618]],64180:[[33775]],64181:[[34681]],64182:[[35137]],64183:[[35206]],64184:[[35222]],64185:[[35519]],64186:[[35576]],64187:[[35531]],64188:[[35585]],64189:[[35582]],64190:[[35565]],64191:[[35641]],64192:[[35722]],64193:[[36104]],64194:[[36664]],64195:[[36978]],64196:[[37273]],64197:[[37494]],64198:[[38524]],64199:[[38627]],64200:[[38742]],64201:[[38875]],64202:[[38911]],64203:[[38923]],64204:[[38971]],64205:[[39698]],64206:[[40860]],64207:[[141386]],64208:[[141380]],64209:[[144341]],64210:[[15261]],64211:[[16408]],64212:[[16441]],64213:[[152137]],64214:[[154832]],64215:[[163539]],64216:[[40771]],64217:[[40846]],195072:[[38953]],195073:[[169398]],195074:[[39138]],195075:[[19251]],195076:[[39209]],195077:[[39335]],195078:[[39362]],195079:[[39422]],195080:[[19406]],195081:[[170800]],195082:[[39698]],195083:[[40000]],195084:[[40189]],195085:[[19662]],195086:[[19693]],195087:[[40295]],195088:[[172238]],195089:[[19704]],195090:[[172293]],195091:[[172558]],195092:[[172689]],195093:[[40635]],195094:[[19798]],195095:[[40697]],195096:[[40702]],195097:[[40709]],195098:[[40719]],195099:[[40726]],195100:[[40763]],195101:[[173568]]}, + 64256:{64256:[[102,102],256],64257:[[102,105],256],64258:[[102,108],256],64259:[[102,102,105],256],64260:[[102,102,108],256],64261:[[383,116],256],64262:[[115,116],256],64275:[[1396,1398],256],64276:[[1396,1381],256],64277:[[1396,1387],256],64278:[[1406,1398],256],64279:[[1396,1389],256],64285:[[1497,1460],512],64286:[,26],64287:[[1522,1463],512],64288:[[1506],256],64289:[[1488],256],64290:[[1491],256],64291:[[1492],256],64292:[[1499],256],64293:[[1500],256],64294:[[1501],256],64295:[[1512],256],64296:[[1514],256],64297:[[43],256],64298:[[1513,1473],512],64299:[[1513,1474],512],64300:[[64329,1473],512],64301:[[64329,1474],512],64302:[[1488,1463],512],64303:[[1488,1464],512],64304:[[1488,1468],512],64305:[[1489,1468],512],64306:[[1490,1468],512],64307:[[1491,1468],512],64308:[[1492,1468],512],64309:[[1493,1468],512],64310:[[1494,1468],512],64312:[[1496,1468],512],64313:[[1497,1468],512],64314:[[1498,1468],512],64315:[[1499,1468],512],64316:[[1500,1468],512],64318:[[1502,1468],512],64320:[[1504,1468],512],64321:[[1505,1468],512],64323:[[1507,1468],512],64324:[[1508,1468],512],64326:[[1510,1468],512],64327:[[1511,1468],512],64328:[[1512,1468],512],64329:[[1513,1468],512],64330:[[1514,1468],512],64331:[[1493,1465],512],64332:[[1489,1471],512],64333:[[1499,1471],512],64334:[[1508,1471],512],64335:[[1488,1500],256],64336:[[1649],256],64337:[[1649],256],64338:[[1659],256],64339:[[1659],256],64340:[[1659],256],64341:[[1659],256],64342:[[1662],256],64343:[[1662],256],64344:[[1662],256],64345:[[1662],256],64346:[[1664],256],64347:[[1664],256],64348:[[1664],256],64349:[[1664],256],64350:[[1658],256],64351:[[1658],256],64352:[[1658],256],64353:[[1658],256],64354:[[1663],256],64355:[[1663],256],64356:[[1663],256],64357:[[1663],256],64358:[[1657],256],64359:[[1657],256],64360:[[1657],256],64361:[[1657],256],64362:[[1700],256],64363:[[1700],256],64364:[[1700],256],64365:[[1700],256],64366:[[1702],256],64367:[[1702],256],64368:[[1702],256],64369:[[1702],256],64370:[[1668],256],64371:[[1668],256],64372:[[1668],256],64373:[[1668],256],64374:[[1667],256],64375:[[1667],256],64376:[[1667],256],64377:[[1667],256],64378:[[1670],256],64379:[[1670],256],64380:[[1670],256],64381:[[1670],256],64382:[[1671],256],64383:[[1671],256],64384:[[1671],256],64385:[[1671],256],64386:[[1677],256],64387:[[1677],256],64388:[[1676],256],64389:[[1676],256],64390:[[1678],256],64391:[[1678],256],64392:[[1672],256],64393:[[1672],256],64394:[[1688],256],64395:[[1688],256],64396:[[1681],256],64397:[[1681],256],64398:[[1705],256],64399:[[1705],256],64400:[[1705],256],64401:[[1705],256],64402:[[1711],256],64403:[[1711],256],64404:[[1711],256],64405:[[1711],256],64406:[[1715],256],64407:[[1715],256],64408:[[1715],256],64409:[[1715],256],64410:[[1713],256],64411:[[1713],256],64412:[[1713],256],64413:[[1713],256],64414:[[1722],256],64415:[[1722],256],64416:[[1723],256],64417:[[1723],256],64418:[[1723],256],64419:[[1723],256],64420:[[1728],256],64421:[[1728],256],64422:[[1729],256],64423:[[1729],256],64424:[[1729],256],64425:[[1729],256],64426:[[1726],256],64427:[[1726],256],64428:[[1726],256],64429:[[1726],256],64430:[[1746],256],64431:[[1746],256],64432:[[1747],256],64433:[[1747],256],64467:[[1709],256],64468:[[1709],256],64469:[[1709],256],64470:[[1709],256],64471:[[1735],256],64472:[[1735],256],64473:[[1734],256],64474:[[1734],256],64475:[[1736],256],64476:[[1736],256],64477:[[1655],256],64478:[[1739],256],64479:[[1739],256],64480:[[1733],256],64481:[[1733],256],64482:[[1737],256],64483:[[1737],256],64484:[[1744],256],64485:[[1744],256],64486:[[1744],256],64487:[[1744],256],64488:[[1609],256],64489:[[1609],256],64490:[[1574,1575],256],64491:[[1574,1575],256],64492:[[1574,1749],256],64493:[[1574,1749],256],64494:[[1574,1608],256],64495:[[1574,1608],256],64496:[[1574,1735],256],64497:[[1574,1735],256],64498:[[1574,1734],256],64499:[[1574,1734],256],64500:[[1574,1736],256],64501:[[1574,1736],256],64502:[[1574,1744],256],64503:[[1574,1744],256],64504:[[1574,1744],256],64505:[[1574,1609],256],64506:[[1574,1609],256],64507:[[1574,1609],256],64508:[[1740],256],64509:[[1740],256],64510:[[1740],256],64511:[[1740],256]}, + 64512:{64512:[[1574,1580],256],64513:[[1574,1581],256],64514:[[1574,1605],256],64515:[[1574,1609],256],64516:[[1574,1610],256],64517:[[1576,1580],256],64518:[[1576,1581],256],64519:[[1576,1582],256],64520:[[1576,1605],256],64521:[[1576,1609],256],64522:[[1576,1610],256],64523:[[1578,1580],256],64524:[[1578,1581],256],64525:[[1578,1582],256],64526:[[1578,1605],256],64527:[[1578,1609],256],64528:[[1578,1610],256],64529:[[1579,1580],256],64530:[[1579,1605],256],64531:[[1579,1609],256],64532:[[1579,1610],256],64533:[[1580,1581],256],64534:[[1580,1605],256],64535:[[1581,1580],256],64536:[[1581,1605],256],64537:[[1582,1580],256],64538:[[1582,1581],256],64539:[[1582,1605],256],64540:[[1587,1580],256],64541:[[1587,1581],256],64542:[[1587,1582],256],64543:[[1587,1605],256],64544:[[1589,1581],256],64545:[[1589,1605],256],64546:[[1590,1580],256],64547:[[1590,1581],256],64548:[[1590,1582],256],64549:[[1590,1605],256],64550:[[1591,1581],256],64551:[[1591,1605],256],64552:[[1592,1605],256],64553:[[1593,1580],256],64554:[[1593,1605],256],64555:[[1594,1580],256],64556:[[1594,1605],256],64557:[[1601,1580],256],64558:[[1601,1581],256],64559:[[1601,1582],256],64560:[[1601,1605],256],64561:[[1601,1609],256],64562:[[1601,1610],256],64563:[[1602,1581],256],64564:[[1602,1605],256],64565:[[1602,1609],256],64566:[[1602,1610],256],64567:[[1603,1575],256],64568:[[1603,1580],256],64569:[[1603,1581],256],64570:[[1603,1582],256],64571:[[1603,1604],256],64572:[[1603,1605],256],64573:[[1603,1609],256],64574:[[1603,1610],256],64575:[[1604,1580],256],64576:[[1604,1581],256],64577:[[1604,1582],256],64578:[[1604,1605],256],64579:[[1604,1609],256],64580:[[1604,1610],256],64581:[[1605,1580],256],64582:[[1605,1581],256],64583:[[1605,1582],256],64584:[[1605,1605],256],64585:[[1605,1609],256],64586:[[1605,1610],256],64587:[[1606,1580],256],64588:[[1606,1581],256],64589:[[1606,1582],256],64590:[[1606,1605],256],64591:[[1606,1609],256],64592:[[1606,1610],256],64593:[[1607,1580],256],64594:[[1607,1605],256],64595:[[1607,1609],256],64596:[[1607,1610],256],64597:[[1610,1580],256],64598:[[1610,1581],256],64599:[[1610,1582],256],64600:[[1610,1605],256],64601:[[1610,1609],256],64602:[[1610,1610],256],64603:[[1584,1648],256],64604:[[1585,1648],256],64605:[[1609,1648],256],64606:[[32,1612,1617],256],64607:[[32,1613,1617],256],64608:[[32,1614,1617],256],64609:[[32,1615,1617],256],64610:[[32,1616,1617],256],64611:[[32,1617,1648],256],64612:[[1574,1585],256],64613:[[1574,1586],256],64614:[[1574,1605],256],64615:[[1574,1606],256],64616:[[1574,1609],256],64617:[[1574,1610],256],64618:[[1576,1585],256],64619:[[1576,1586],256],64620:[[1576,1605],256],64621:[[1576,1606],256],64622:[[1576,1609],256],64623:[[1576,1610],256],64624:[[1578,1585],256],64625:[[1578,1586],256],64626:[[1578,1605],256],64627:[[1578,1606],256],64628:[[1578,1609],256],64629:[[1578,1610],256],64630:[[1579,1585],256],64631:[[1579,1586],256],64632:[[1579,1605],256],64633:[[1579,1606],256],64634:[[1579,1609],256],64635:[[1579,1610],256],64636:[[1601,1609],256],64637:[[1601,1610],256],64638:[[1602,1609],256],64639:[[1602,1610],256],64640:[[1603,1575],256],64641:[[1603,1604],256],64642:[[1603,1605],256],64643:[[1603,1609],256],64644:[[1603,1610],256],64645:[[1604,1605],256],64646:[[1604,1609],256],64647:[[1604,1610],256],64648:[[1605,1575],256],64649:[[1605,1605],256],64650:[[1606,1585],256],64651:[[1606,1586],256],64652:[[1606,1605],256],64653:[[1606,1606],256],64654:[[1606,1609],256],64655:[[1606,1610],256],64656:[[1609,1648],256],64657:[[1610,1585],256],64658:[[1610,1586],256],64659:[[1610,1605],256],64660:[[1610,1606],256],64661:[[1610,1609],256],64662:[[1610,1610],256],64663:[[1574,1580],256],64664:[[1574,1581],256],64665:[[1574,1582],256],64666:[[1574,1605],256],64667:[[1574,1607],256],64668:[[1576,1580],256],64669:[[1576,1581],256],64670:[[1576,1582],256],64671:[[1576,1605],256],64672:[[1576,1607],256],64673:[[1578,1580],256],64674:[[1578,1581],256],64675:[[1578,1582],256],64676:[[1578,1605],256],64677:[[1578,1607],256],64678:[[1579,1605],256],64679:[[1580,1581],256],64680:[[1580,1605],256],64681:[[1581,1580],256],64682:[[1581,1605],256],64683:[[1582,1580],256],64684:[[1582,1605],256],64685:[[1587,1580],256],64686:[[1587,1581],256],64687:[[1587,1582],256],64688:[[1587,1605],256],64689:[[1589,1581],256],64690:[[1589,1582],256],64691:[[1589,1605],256],64692:[[1590,1580],256],64693:[[1590,1581],256],64694:[[1590,1582],256],64695:[[1590,1605],256],64696:[[1591,1581],256],64697:[[1592,1605],256],64698:[[1593,1580],256],64699:[[1593,1605],256],64700:[[1594,1580],256],64701:[[1594,1605],256],64702:[[1601,1580],256],64703:[[1601,1581],256],64704:[[1601,1582],256],64705:[[1601,1605],256],64706:[[1602,1581],256],64707:[[1602,1605],256],64708:[[1603,1580],256],64709:[[1603,1581],256],64710:[[1603,1582],256],64711:[[1603,1604],256],64712:[[1603,1605],256],64713:[[1604,1580],256],64714:[[1604,1581],256],64715:[[1604,1582],256],64716:[[1604,1605],256],64717:[[1604,1607],256],64718:[[1605,1580],256],64719:[[1605,1581],256],64720:[[1605,1582],256],64721:[[1605,1605],256],64722:[[1606,1580],256],64723:[[1606,1581],256],64724:[[1606,1582],256],64725:[[1606,1605],256],64726:[[1606,1607],256],64727:[[1607,1580],256],64728:[[1607,1605],256],64729:[[1607,1648],256],64730:[[1610,1580],256],64731:[[1610,1581],256],64732:[[1610,1582],256],64733:[[1610,1605],256],64734:[[1610,1607],256],64735:[[1574,1605],256],64736:[[1574,1607],256],64737:[[1576,1605],256],64738:[[1576,1607],256],64739:[[1578,1605],256],64740:[[1578,1607],256],64741:[[1579,1605],256],64742:[[1579,1607],256],64743:[[1587,1605],256],64744:[[1587,1607],256],64745:[[1588,1605],256],64746:[[1588,1607],256],64747:[[1603,1604],256],64748:[[1603,1605],256],64749:[[1604,1605],256],64750:[[1606,1605],256],64751:[[1606,1607],256],64752:[[1610,1605],256],64753:[[1610,1607],256],64754:[[1600,1614,1617],256],64755:[[1600,1615,1617],256],64756:[[1600,1616,1617],256],64757:[[1591,1609],256],64758:[[1591,1610],256],64759:[[1593,1609],256],64760:[[1593,1610],256],64761:[[1594,1609],256],64762:[[1594,1610],256],64763:[[1587,1609],256],64764:[[1587,1610],256],64765:[[1588,1609],256],64766:[[1588,1610],256],64767:[[1581,1609],256]}, + 64768:{64768:[[1581,1610],256],64769:[[1580,1609],256],64770:[[1580,1610],256],64771:[[1582,1609],256],64772:[[1582,1610],256],64773:[[1589,1609],256],64774:[[1589,1610],256],64775:[[1590,1609],256],64776:[[1590,1610],256],64777:[[1588,1580],256],64778:[[1588,1581],256],64779:[[1588,1582],256],64780:[[1588,1605],256],64781:[[1588,1585],256],64782:[[1587,1585],256],64783:[[1589,1585],256],64784:[[1590,1585],256],64785:[[1591,1609],256],64786:[[1591,1610],256],64787:[[1593,1609],256],64788:[[1593,1610],256],64789:[[1594,1609],256],64790:[[1594,1610],256],64791:[[1587,1609],256],64792:[[1587,1610],256],64793:[[1588,1609],256],64794:[[1588,1610],256],64795:[[1581,1609],256],64796:[[1581,1610],256],64797:[[1580,1609],256],64798:[[1580,1610],256],64799:[[1582,1609],256],64800:[[1582,1610],256],64801:[[1589,1609],256],64802:[[1589,1610],256],64803:[[1590,1609],256],64804:[[1590,1610],256],64805:[[1588,1580],256],64806:[[1588,1581],256],64807:[[1588,1582],256],64808:[[1588,1605],256],64809:[[1588,1585],256],64810:[[1587,1585],256],64811:[[1589,1585],256],64812:[[1590,1585],256],64813:[[1588,1580],256],64814:[[1588,1581],256],64815:[[1588,1582],256],64816:[[1588,1605],256],64817:[[1587,1607],256],64818:[[1588,1607],256],64819:[[1591,1605],256],64820:[[1587,1580],256],64821:[[1587,1581],256],64822:[[1587,1582],256],64823:[[1588,1580],256],64824:[[1588,1581],256],64825:[[1588,1582],256],64826:[[1591,1605],256],64827:[[1592,1605],256],64828:[[1575,1611],256],64829:[[1575,1611],256],64848:[[1578,1580,1605],256],64849:[[1578,1581,1580],256],64850:[[1578,1581,1580],256],64851:[[1578,1581,1605],256],64852:[[1578,1582,1605],256],64853:[[1578,1605,1580],256],64854:[[1578,1605,1581],256],64855:[[1578,1605,1582],256],64856:[[1580,1605,1581],256],64857:[[1580,1605,1581],256],64858:[[1581,1605,1610],256],64859:[[1581,1605,1609],256],64860:[[1587,1581,1580],256],64861:[[1587,1580,1581],256],64862:[[1587,1580,1609],256],64863:[[1587,1605,1581],256],64864:[[1587,1605,1581],256],64865:[[1587,1605,1580],256],64866:[[1587,1605,1605],256],64867:[[1587,1605,1605],256],64868:[[1589,1581,1581],256],64869:[[1589,1581,1581],256],64870:[[1589,1605,1605],256],64871:[[1588,1581,1605],256],64872:[[1588,1581,1605],256],64873:[[1588,1580,1610],256],64874:[[1588,1605,1582],256],64875:[[1588,1605,1582],256],64876:[[1588,1605,1605],256],64877:[[1588,1605,1605],256],64878:[[1590,1581,1609],256],64879:[[1590,1582,1605],256],64880:[[1590,1582,1605],256],64881:[[1591,1605,1581],256],64882:[[1591,1605,1581],256],64883:[[1591,1605,1605],256],64884:[[1591,1605,1610],256],64885:[[1593,1580,1605],256],64886:[[1593,1605,1605],256],64887:[[1593,1605,1605],256],64888:[[1593,1605,1609],256],64889:[[1594,1605,1605],256],64890:[[1594,1605,1610],256],64891:[[1594,1605,1609],256],64892:[[1601,1582,1605],256],64893:[[1601,1582,1605],256],64894:[[1602,1605,1581],256],64895:[[1602,1605,1605],256],64896:[[1604,1581,1605],256],64897:[[1604,1581,1610],256],64898:[[1604,1581,1609],256],64899:[[1604,1580,1580],256],64900:[[1604,1580,1580],256],64901:[[1604,1582,1605],256],64902:[[1604,1582,1605],256],64903:[[1604,1605,1581],256],64904:[[1604,1605,1581],256],64905:[[1605,1581,1580],256],64906:[[1605,1581,1605],256],64907:[[1605,1581,1610],256],64908:[[1605,1580,1581],256],64909:[[1605,1580,1605],256],64910:[[1605,1582,1580],256],64911:[[1605,1582,1605],256],64914:[[1605,1580,1582],256],64915:[[1607,1605,1580],256],64916:[[1607,1605,1605],256],64917:[[1606,1581,1605],256],64918:[[1606,1581,1609],256],64919:[[1606,1580,1605],256],64920:[[1606,1580,1605],256],64921:[[1606,1580,1609],256],64922:[[1606,1605,1610],256],64923:[[1606,1605,1609],256],64924:[[1610,1605,1605],256],64925:[[1610,1605,1605],256],64926:[[1576,1582,1610],256],64927:[[1578,1580,1610],256],64928:[[1578,1580,1609],256],64929:[[1578,1582,1610],256],64930:[[1578,1582,1609],256],64931:[[1578,1605,1610],256],64932:[[1578,1605,1609],256],64933:[[1580,1605,1610],256],64934:[[1580,1581,1609],256],64935:[[1580,1605,1609],256],64936:[[1587,1582,1609],256],64937:[[1589,1581,1610],256],64938:[[1588,1581,1610],256],64939:[[1590,1581,1610],256],64940:[[1604,1580,1610],256],64941:[[1604,1605,1610],256],64942:[[1610,1581,1610],256],64943:[[1610,1580,1610],256],64944:[[1610,1605,1610],256],64945:[[1605,1605,1610],256],64946:[[1602,1605,1610],256],64947:[[1606,1581,1610],256],64948:[[1602,1605,1581],256],64949:[[1604,1581,1605],256],64950:[[1593,1605,1610],256],64951:[[1603,1605,1610],256],64952:[[1606,1580,1581],256],64953:[[1605,1582,1610],256],64954:[[1604,1580,1605],256],64955:[[1603,1605,1605],256],64956:[[1604,1580,1605],256],64957:[[1606,1580,1581],256],64958:[[1580,1581,1610],256],64959:[[1581,1580,1610],256],64960:[[1605,1580,1610],256],64961:[[1601,1605,1610],256],64962:[[1576,1581,1610],256],64963:[[1603,1605,1605],256],64964:[[1593,1580,1605],256],64965:[[1589,1605,1605],256],64966:[[1587,1582,1610],256],64967:[[1606,1580,1610],256],65008:[[1589,1604,1746],256],65009:[[1602,1604,1746],256],65010:[[1575,1604,1604,1607],256],65011:[[1575,1603,1576,1585],256],65012:[[1605,1581,1605,1583],256],65013:[[1589,1604,1593,1605],256],65014:[[1585,1587,1608,1604],256],65015:[[1593,1604,1610,1607],256],65016:[[1608,1587,1604,1605],256],65017:[[1589,1604,1609],256],65018:[[1589,1604,1609,32,1575,1604,1604,1607,32,1593,1604,1610,1607,32,1608,1587,1604,1605],256],65019:[[1580,1604,32,1580,1604,1575,1604,1607],256],65020:[[1585,1740,1575,1604],256]}, + 65024:{65040:[[44],256],65041:[[12289],256],65042:[[12290],256],65043:[[58],256],65044:[[59],256],65045:[[33],256],65046:[[63],256],65047:[[12310],256],65048:[[12311],256],65049:[[8230],256],65056:[,230],65057:[,230],65058:[,230],65059:[,230],65060:[,230],65061:[,230],65062:[,230],65072:[[8229],256],65073:[[8212],256],65074:[[8211],256],65075:[[95],256],65076:[[95],256],65077:[[40],256],65078:[[41],256],65079:[[123],256],65080:[[125],256],65081:[[12308],256],65082:[[12309],256],65083:[[12304],256],65084:[[12305],256],65085:[[12298],256],65086:[[12299],256],65087:[[12296],256],65088:[[12297],256],65089:[[12300],256],65090:[[12301],256],65091:[[12302],256],65092:[[12303],256],65095:[[91],256],65096:[[93],256],65097:[[8254],256],65098:[[8254],256],65099:[[8254],256],65100:[[8254],256],65101:[[95],256],65102:[[95],256],65103:[[95],256],65104:[[44],256],65105:[[12289],256],65106:[[46],256],65108:[[59],256],65109:[[58],256],65110:[[63],256],65111:[[33],256],65112:[[8212],256],65113:[[40],256],65114:[[41],256],65115:[[123],256],65116:[[125],256],65117:[[12308],256],65118:[[12309],256],65119:[[35],256],65120:[[38],256],65121:[[42],256],65122:[[43],256],65123:[[45],256],65124:[[60],256],65125:[[62],256],65126:[[61],256],65128:[[92],256],65129:[[36],256],65130:[[37],256],65131:[[64],256],65136:[[32,1611],256],65137:[[1600,1611],256],65138:[[32,1612],256],65140:[[32,1613],256],65142:[[32,1614],256],65143:[[1600,1614],256],65144:[[32,1615],256],65145:[[1600,1615],256],65146:[[32,1616],256],65147:[[1600,1616],256],65148:[[32,1617],256],65149:[[1600,1617],256],65150:[[32,1618],256],65151:[[1600,1618],256],65152:[[1569],256],65153:[[1570],256],65154:[[1570],256],65155:[[1571],256],65156:[[1571],256],65157:[[1572],256],65158:[[1572],256],65159:[[1573],256],65160:[[1573],256],65161:[[1574],256],65162:[[1574],256],65163:[[1574],256],65164:[[1574],256],65165:[[1575],256],65166:[[1575],256],65167:[[1576],256],65168:[[1576],256],65169:[[1576],256],65170:[[1576],256],65171:[[1577],256],65172:[[1577],256],65173:[[1578],256],65174:[[1578],256],65175:[[1578],256],65176:[[1578],256],65177:[[1579],256],65178:[[1579],256],65179:[[1579],256],65180:[[1579],256],65181:[[1580],256],65182:[[1580],256],65183:[[1580],256],65184:[[1580],256],65185:[[1581],256],65186:[[1581],256],65187:[[1581],256],65188:[[1581],256],65189:[[1582],256],65190:[[1582],256],65191:[[1582],256],65192:[[1582],256],65193:[[1583],256],65194:[[1583],256],65195:[[1584],256],65196:[[1584],256],65197:[[1585],256],65198:[[1585],256],65199:[[1586],256],65200:[[1586],256],65201:[[1587],256],65202:[[1587],256],65203:[[1587],256],65204:[[1587],256],65205:[[1588],256],65206:[[1588],256],65207:[[1588],256],65208:[[1588],256],65209:[[1589],256],65210:[[1589],256],65211:[[1589],256],65212:[[1589],256],65213:[[1590],256],65214:[[1590],256],65215:[[1590],256],65216:[[1590],256],65217:[[1591],256],65218:[[1591],256],65219:[[1591],256],65220:[[1591],256],65221:[[1592],256],65222:[[1592],256],65223:[[1592],256],65224:[[1592],256],65225:[[1593],256],65226:[[1593],256],65227:[[1593],256],65228:[[1593],256],65229:[[1594],256],65230:[[1594],256],65231:[[1594],256],65232:[[1594],256],65233:[[1601],256],65234:[[1601],256],65235:[[1601],256],65236:[[1601],256],65237:[[1602],256],65238:[[1602],256],65239:[[1602],256],65240:[[1602],256],65241:[[1603],256],65242:[[1603],256],65243:[[1603],256],65244:[[1603],256],65245:[[1604],256],65246:[[1604],256],65247:[[1604],256],65248:[[1604],256],65249:[[1605],256],65250:[[1605],256],65251:[[1605],256],65252:[[1605],256],65253:[[1606],256],65254:[[1606],256],65255:[[1606],256],65256:[[1606],256],65257:[[1607],256],65258:[[1607],256],65259:[[1607],256],65260:[[1607],256],65261:[[1608],256],65262:[[1608],256],65263:[[1609],256],65264:[[1609],256],65265:[[1610],256],65266:[[1610],256],65267:[[1610],256],65268:[[1610],256],65269:[[1604,1570],256],65270:[[1604,1570],256],65271:[[1604,1571],256],65272:[[1604,1571],256],65273:[[1604,1573],256],65274:[[1604,1573],256],65275:[[1604,1575],256],65276:[[1604,1575],256]}, + 65280:{65281:[[33],256],65282:[[34],256],65283:[[35],256],65284:[[36],256],65285:[[37],256],65286:[[38],256],65287:[[39],256],65288:[[40],256],65289:[[41],256],65290:[[42],256],65291:[[43],256],65292:[[44],256],65293:[[45],256],65294:[[46],256],65295:[[47],256],65296:[[48],256],65297:[[49],256],65298:[[50],256],65299:[[51],256],65300:[[52],256],65301:[[53],256],65302:[[54],256],65303:[[55],256],65304:[[56],256],65305:[[57],256],65306:[[58],256],65307:[[59],256],65308:[[60],256],65309:[[61],256],65310:[[62],256],65311:[[63],256],65312:[[64],256],65313:[[65],256],65314:[[66],256],65315:[[67],256],65316:[[68],256],65317:[[69],256],65318:[[70],256],65319:[[71],256],65320:[[72],256],65321:[[73],256],65322:[[74],256],65323:[[75],256],65324:[[76],256],65325:[[77],256],65326:[[78],256],65327:[[79],256],65328:[[80],256],65329:[[81],256],65330:[[82],256],65331:[[83],256],65332:[[84],256],65333:[[85],256],65334:[[86],256],65335:[[87],256],65336:[[88],256],65337:[[89],256],65338:[[90],256],65339:[[91],256],65340:[[92],256],65341:[[93],256],65342:[[94],256],65343:[[95],256],65344:[[96],256],65345:[[97],256],65346:[[98],256],65347:[[99],256],65348:[[100],256],65349:[[101],256],65350:[[102],256],65351:[[103],256],65352:[[104],256],65353:[[105],256],65354:[[106],256],65355:[[107],256],65356:[[108],256],65357:[[109],256],65358:[[110],256],65359:[[111],256],65360:[[112],256],65361:[[113],256],65362:[[114],256],65363:[[115],256],65364:[[116],256],65365:[[117],256],65366:[[118],256],65367:[[119],256],65368:[[120],256],65369:[[121],256],65370:[[122],256],65371:[[123],256],65372:[[124],256],65373:[[125],256],65374:[[126],256],65375:[[10629],256],65376:[[10630],256],65377:[[12290],256],65378:[[12300],256],65379:[[12301],256],65380:[[12289],256],65381:[[12539],256],65382:[[12530],256],65383:[[12449],256],65384:[[12451],256],65385:[[12453],256],65386:[[12455],256],65387:[[12457],256],65388:[[12515],256],65389:[[12517],256],65390:[[12519],256],65391:[[12483],256],65392:[[12540],256],65393:[[12450],256],65394:[[12452],256],65395:[[12454],256],65396:[[12456],256],65397:[[12458],256],65398:[[12459],256],65399:[[12461],256],65400:[[12463],256],65401:[[12465],256],65402:[[12467],256],65403:[[12469],256],65404:[[12471],256],65405:[[12473],256],65406:[[12475],256],65407:[[12477],256],65408:[[12479],256],65409:[[12481],256],65410:[[12484],256],65411:[[12486],256],65412:[[12488],256],65413:[[12490],256],65414:[[12491],256],65415:[[12492],256],65416:[[12493],256],65417:[[12494],256],65418:[[12495],256],65419:[[12498],256],65420:[[12501],256],65421:[[12504],256],65422:[[12507],256],65423:[[12510],256],65424:[[12511],256],65425:[[12512],256],65426:[[12513],256],65427:[[12514],256],65428:[[12516],256],65429:[[12518],256],65430:[[12520],256],65431:[[12521],256],65432:[[12522],256],65433:[[12523],256],65434:[[12524],256],65435:[[12525],256],65436:[[12527],256],65437:[[12531],256],65438:[[12441],256],65439:[[12442],256],65440:[[12644],256],65441:[[12593],256],65442:[[12594],256],65443:[[12595],256],65444:[[12596],256],65445:[[12597],256],65446:[[12598],256],65447:[[12599],256],65448:[[12600],256],65449:[[12601],256],65450:[[12602],256],65451:[[12603],256],65452:[[12604],256],65453:[[12605],256],65454:[[12606],256],65455:[[12607],256],65456:[[12608],256],65457:[[12609],256],65458:[[12610],256],65459:[[12611],256],65460:[[12612],256],65461:[[12613],256],65462:[[12614],256],65463:[[12615],256],65464:[[12616],256],65465:[[12617],256],65466:[[12618],256],65467:[[12619],256],65468:[[12620],256],65469:[[12621],256],65470:[[12622],256],65474:[[12623],256],65475:[[12624],256],65476:[[12625],256],65477:[[12626],256],65478:[[12627],256],65479:[[12628],256],65482:[[12629],256],65483:[[12630],256],65484:[[12631],256],65485:[[12632],256],65486:[[12633],256],65487:[[12634],256],65490:[[12635],256],65491:[[12636],256],65492:[[12637],256],65493:[[12638],256],65494:[[12639],256],65495:[[12640],256],65498:[[12641],256],65499:[[12642],256],65500:[[12643],256],65504:[[162],256],65505:[[163],256],65506:[[172],256],65507:[[175],256],65508:[[166],256],65509:[[165],256],65510:[[8361],256],65512:[[9474],256],65513:[[8592],256],65514:[[8593],256],65515:[[8594],256],65516:[[8595],256],65517:[[9632],256],65518:[[9675],256]} +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/implement.js new file mode 100644 index 00000000..cfc710ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'normalize', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/index.js new file mode 100644 index 00000000..619b0965 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.normalize + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/is-implemented.js new file mode 100644 index 00000000..67c8d8da --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'æøåäüö'; + +module.exports = function () { + if (typeof str.normalize !== 'function') return false; + return str.normalize('NFKD') === 'æøåäüö'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/shim.js new file mode 100644 index 00000000..a3799897 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/normalize/shim.js @@ -0,0 +1,289 @@ +// Taken from: https://github.com/walling/unorm/blob/master/lib/unorm.js + +/* + * UnicodeNormalizer 1.0.0 + * Copyright (c) 2008 Matsuza + * Dual licensed under the MIT (MIT-LICENSE.txt) and + * GPL (GPL-LICENSE.txt) licenses. + * $Date: 2008-06-05 16:44:17 +0200 (Thu, 05 Jun 2008) $ + * $Rev: 13309 $ +*/ + +'use strict'; + +var primitiveSet = require('../../../object/primitive-set') + , validValue = require('../../../object/valid-value') + , data = require('./_data') + + , floor = Math.floor + , forms = primitiveSet('NFC', 'NFD', 'NFKC', 'NFKD') + + , DEFAULT_FEATURE = [null, 0, {}], CACHE_THRESHOLD = 10, SBase = 0xAC00 + , LBase = 0x1100, VBase = 0x1161, TBase = 0x11A7, LCount = 19, VCount = 21 + , TCount = 28, NCount = VCount * TCount, SCount = LCount * NCount + , UChar, cache = {}, cacheCounter = [], i, fromCache, fromData, fromCpOnly + , fromRuleBasedJamo, fromCpFilter, strategies, UCharIterator + , RecursDecompIterator, DecompIterator, CompIterator, createIterator + , normalize; + +UChar = function (cp, feature) { + this.codepoint = cp; + this.feature = feature; +}; + +// Strategies +for (i = 0; i <= 0xFF; ++i) cacheCounter[i] = 0; + +fromCache = function (next, cp, needFeature) { + var ret = cache[cp]; + if (!ret) { + ret = next(cp, needFeature); + if (!!ret.feature && ++cacheCounter[(cp >> 8) & 0xFF] > CACHE_THRESHOLD) { + cache[cp] = ret; + } + } + return ret; +}; + +fromData = function (next, cp, needFeature) { + var hash = cp & 0xFF00, dunit = UChar.udata[hash] || {}, f = dunit[cp]; + return f ? new UChar(cp, f) : new UChar(cp, DEFAULT_FEATURE); +}; +fromCpOnly = function (next, cp, needFeature) { + return !!needFeature ? next(cp, needFeature) : new UChar(cp, null); +}; + +fromRuleBasedJamo = function (next, cp, needFeature) { + var c, base, i, arr, SIndex, TIndex, feature, j; + if (cp < LBase || (LBase + LCount <= cp && cp < SBase) || + (SBase + SCount < cp)) { + return next(cp, needFeature); + } + if (LBase <= cp && cp < LBase + LCount) { + c = {}; + base = (cp - LBase) * VCount; + for (i = 0; i < VCount; ++i) { + c[VBase + i] = SBase + TCount * (i + base); + } + arr = new Array(3); + arr[2] = c; + return new UChar(cp, arr); + } + + SIndex = cp - SBase; + TIndex = SIndex % TCount; + feature = []; + if (TIndex !== 0) { + feature[0] = [SBase + SIndex - TIndex, TBase + TIndex]; + } else { + feature[0] = [LBase + floor(SIndex / NCount), VBase + + floor((SIndex % NCount) / TCount)]; + feature[2] = {}; + for (j = 1; j < TCount; ++j) { + feature[2][TBase + j] = cp + j; + } + } + return new UChar(cp, feature); +}; + +fromCpFilter = function (next, cp, needFeature) { + return (cp < 60) || ((13311 < cp) && (cp < 42607)) + ? new UChar(cp, DEFAULT_FEATURE) : next(cp, needFeature); +}; + +strategies = [fromCpFilter, fromCache, fromCpOnly, fromRuleBasedJamo, fromData]; + +UChar.fromCharCode = strategies.reduceRight(function (next, strategy) { + return function (cp, needFeature) { return strategy(next, cp, needFeature); }; +}, null); + +UChar.isHighSurrogate = function (cp) { return cp >= 0xD800 && cp <= 0xDBFF; }; +UChar.isLowSurrogate = function (cp) { return cp >= 0xDC00 && cp <= 0xDFFF; }; + +UChar.prototype.prepFeature = function () { + if (!this.feature) { + this.feature = UChar.fromCharCode(this.codepoint, true).feature; + } +}; + +UChar.prototype.toString = function () { + var x; + if (this.codepoint < 0x10000) return String.fromCharCode(this.codepoint); + x = this.codepoint - 0x10000; + return String.fromCharCode(floor(x / 0x400) + 0xD800, x % 0x400 + 0xDC00); +}; + +UChar.prototype.getDecomp = function () { + this.prepFeature(); + return this.feature[0] || null; +}; + +UChar.prototype.isCompatibility = function () { + this.prepFeature(); + return !!this.feature[1] && (this.feature[1] & (1 << 8)); +}; +UChar.prototype.isExclude = function () { + this.prepFeature(); + return !!this.feature[1] && (this.feature[1] & (1 << 9)); +}; +UChar.prototype.getCanonicalClass = function () { + this.prepFeature(); + return !!this.feature[1] ? (this.feature[1] & 0xff) : 0; +}; +UChar.prototype.getComposite = function (following) { + var cp; + this.prepFeature(); + if (!this.feature[2]) return null; + cp = this.feature[2][following.codepoint]; + return cp ? UChar.fromCharCode(cp) : null; +}; + +UCharIterator = function (str) { + this.str = str; + this.cursor = 0; +}; +UCharIterator.prototype.next = function () { + if (!!this.str && this.cursor < this.str.length) { + var cp = this.str.charCodeAt(this.cursor++), d; + if (UChar.isHighSurrogate(cp) && this.cursor < this.str.length && + UChar.isLowSurrogate((d = this.str.charCodeAt(this.cursor)))) { + cp = (cp - 0xD800) * 0x400 + (d - 0xDC00) + 0x10000; + ++this.cursor; + } + return UChar.fromCharCode(cp); + } + this.str = null; + return null; +}; + +RecursDecompIterator = function (it, cano) { + this.it = it; + this.canonical = cano; + this.resBuf = []; +}; + +RecursDecompIterator.prototype.next = function () { + var recursiveDecomp, uchar; + recursiveDecomp = function (cano, uchar) { + var decomp = uchar.getDecomp(), ret, i, a, j; + if (!!decomp && !(cano && uchar.isCompatibility())) { + ret = []; + for (i = 0; i < decomp.length; ++i) { + a = recursiveDecomp(cano, UChar.fromCharCode(decomp[i])); + //ret.concat(a); //<-why does not this work? + //following block is a workaround. + for (j = 0; j < a.length; ++j) ret.push(a[j]); + } + return ret; + } + return [uchar]; + }; + if (this.resBuf.length === 0) { + uchar = this.it.next(); + if (!uchar) return null; + this.resBuf = recursiveDecomp(this.canonical, uchar); + } + return this.resBuf.shift(); +}; + +DecompIterator = function (it) { + this.it = it; + this.resBuf = []; +}; + +DecompIterator.prototype.next = function () { + var cc, uchar, inspt, uchar2, cc2; + if (this.resBuf.length === 0) { + do { + uchar = this.it.next(); + if (!uchar) break; + cc = uchar.getCanonicalClass(); + inspt = this.resBuf.length; + if (cc !== 0) { + for (inspt; inspt > 0; --inspt) { + uchar2 = this.resBuf[inspt - 1]; + cc2 = uchar2.getCanonicalClass(); + if (cc2 <= cc) break; + } + } + this.resBuf.splice(inspt, 0, uchar); + } while (cc !== 0); + } + return this.resBuf.shift(); +}; + +CompIterator = function (it) { + this.it = it; + this.procBuf = []; + this.resBuf = []; + this.lastClass = null; +}; + +CompIterator.prototype.next = function () { + var uchar, starter, composite, cc; + while (this.resBuf.length === 0) { + uchar = this.it.next(); + if (!uchar) { + this.resBuf = this.procBuf; + this.procBuf = []; + break; + } + if (this.procBuf.length === 0) { + this.lastClass = uchar.getCanonicalClass(); + this.procBuf.push(uchar); + } else { + starter = this.procBuf[0]; + composite = starter.getComposite(uchar); + cc = uchar.getCanonicalClass(); + if (!!composite && (this.lastClass < cc || this.lastClass === 0)) { + this.procBuf[0] = composite; + } else { + if (cc === 0) { + this.resBuf = this.procBuf; + this.procBuf = []; + } + this.lastClass = cc; + this.procBuf.push(uchar); + } + } + } + return this.resBuf.shift(); +}; + +createIterator = function (mode, str) { + switch (mode) { + case "NFD": + return new DecompIterator( + new RecursDecompIterator(new UCharIterator(str), true) + ); + case "NFKD": + return new DecompIterator( + new RecursDecompIterator(new UCharIterator(str), false) + ); + case "NFC": + return new CompIterator(new DecompIterator( + new RecursDecompIterator(new UCharIterator(str), true) + )); + case "NFKC": + return new CompIterator(new DecompIterator( + new RecursDecompIterator(new UCharIterator(str), false) + )); + } + throw mode + " is invalid"; +}; +normalize = function (mode, str) { + var it = createIterator(mode, str), ret = "", uchar; + while (!!(uchar = it.next())) ret += uchar.toString(); + return ret; +}; + +/* Unicode data */ +UChar.udata = data; + +module.exports = function (/*form*/) { + var str = String(validValue(this)), form = arguments[0]; + if (form === undefined) form = 'NFC'; + else form = String(form); + if (!forms[form]) throw new RangeError('Invalid normalization form: ' + form); + return normalize(form, str); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/pad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/pad.js new file mode 100644 index 00000000..f227f239 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/pad.js @@ -0,0 +1,18 @@ +'use strict'; + +var toInteger = require('../../number/to-integer') + , value = require('../../object/valid-value') + , repeat = require('./repeat') + + , abs = Math.abs, max = Math.max; + +module.exports = function (fill/*, length*/) { + var self = String(value(this)) + , sLength = self.length + , length = arguments[1]; + + length = isNaN(length) ? 1 : toInteger(length); + fill = repeat.call(String(fill), abs(length)); + if (length >= 0) return fill.slice(0, max(0, length - sLength)) + self; + return self + (((sLength + length) >= 0) ? '' : fill.slice(length + sLength)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/plain-replace-all.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/plain-replace-all.js new file mode 100644 index 00000000..678b1cbc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/plain-replace-all.js @@ -0,0 +1,16 @@ +'use strict'; + +var value = require('../../object/valid-value'); + +module.exports = function (search, replace) { + var index, pos = 0, str = String(value(this)), sl, rl; + search = String(search); + replace = String(replace); + sl = search.length; + rl = replace.length; + while ((index = str.indexOf(search, pos)) !== -1) { + str = str.slice(0, index) + replace + str.slice(index + sl); + pos = index + rl; + } + return str; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/plain-replace.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/plain-replace.js new file mode 100644 index 00000000..24ce16d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/plain-replace.js @@ -0,0 +1,10 @@ +'use strict'; + +var indexOf = String.prototype.indexOf, slice = String.prototype.slice; + +module.exports = function (search, replace) { + var index = indexOf.call(this, search); + if (index === -1) return String(this); + return slice.call(this, 0, index) + replace + + slice.call(this, index + String(search).length); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/implement.js new file mode 100644 index 00000000..4c39b9fb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'repeat', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/index.js new file mode 100644 index 00000000..15a800e8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.repeat + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/is-implemented.js new file mode 100644 index 00000000..f7b8750f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'foo'; + +module.exports = function () { + if (typeof str.repeat !== 'function') return false; + return (str.repeat(2) === 'foofoo'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/shim.js new file mode 100644 index 00000000..0a3928b2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/repeat/shim.js @@ -0,0 +1,22 @@ +// Thanks: http://www.2ality.com/2014/01/efficient-string-repeat.html + +'use strict'; + +var value = require('../../../object/valid-value') + , toInteger = require('../../../number/to-integer'); + +module.exports = function (count) { + var str = String(value(this)), result; + count = toInteger(count); + if (count < 0) throw new RangeError("Count must be >= 0"); + if (!isFinite(count)) throw new RangeError("Count must be < ∞"); + result = ''; + if (!count) return result; + while (true) { + if (count & 1) result += str; + count >>>= 1; + if (count <= 0) break; + str += str; + } + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/implement.js new file mode 100644 index 00000000..d4f1eaf5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'startsWith', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/index.js new file mode 100644 index 00000000..ec66a7c0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.startsWith + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/is-implemented.js new file mode 100644 index 00000000..a0556f19 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +var str = 'razdwatrzy'; + +module.exports = function () { + if (typeof str.startsWith !== 'function') return false; + return ((str.startsWith('trzy') === false) && + (str.startsWith('raz') === true)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/shim.js new file mode 100644 index 00000000..aa5aaf41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/#/starts-with/shim.js @@ -0,0 +1,12 @@ +'use strict'; + +var value = require('../../../object/valid-value') + , toInteger = require('../../../number/to-integer') + + , max = Math.max, min = Math.min; + +module.exports = function (searchString/*, position*/) { + var start, self = String(value(this)); + start = min(max(toInteger(arguments[1]), 0), self.length); + return (self.indexOf(searchString, start) === start); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/format-method.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/format-method.js new file mode 100644 index 00000000..f1de1e30 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/format-method.js @@ -0,0 +1,24 @@ +'use strict'; + +var isCallable = require('../object/is-callable') + , value = require('../object/valid-value') + + , call = Function.prototype.call; + +module.exports = function (fmap) { + fmap = Object(value(fmap)); + return function (pattern) { + var context = value(this); + pattern = String(pattern); + return pattern.replace(/%([a-zA-Z]+)|\\([\u0000-\uffff])/g, + function (match, token, escape) { + var t, r; + if (escape) return escape; + t = token; + while (t && !(r = fmap[t])) t = t.slice(0, -1); + if (!r) return match; + if (isCallable(r)) r = call.call(r, context); + return r + token.slice(t.length); + }); + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/implement.js new file mode 100644 index 00000000..b062331c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String, 'fromCodePoint', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/index.js new file mode 100644 index 00000000..3f3110b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.fromCodePoint + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/is-implemented.js new file mode 100644 index 00000000..840a20e3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var fromCodePoint = String.fromCodePoint; + if (typeof fromCodePoint !== 'function') return false; + return fromCodePoint(0x1D306, 0x61, 0x1D307) === '\ud834\udf06a\ud834\udf07'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/shim.js new file mode 100644 index 00000000..41fd7378 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/from-code-point/shim.js @@ -0,0 +1,30 @@ +// Based on: +// http://norbertlindenberg.com/2012/05/ecmascript-supplementary-characters/ +// and: +// https://github.com/mathiasbynens/String.fromCodePoint/blob/master +// /fromcodepoint.js + +'use strict'; + +var floor = Math.floor, fromCharCode = String.fromCharCode; + +module.exports = function (codePoint/*, …codePoints*/) { + var chars = [], l = arguments.length, i, c, result = ''; + for (i = 0; i < l; ++i) { + c = Number(arguments[i]); + if (!isFinite(c) || c < 0 || c > 0x10FFFF || floor(c) !== c) { + throw new RangeError("Invalid code point " + c); + } + + if (c < 0x10000) { + chars.push(c); + } else { + c -= 0x10000; + chars.push((c >> 10) + 0xD800, (c % 0x400) + 0xDC00); + } + if (i + 1 !== l && chars.length <= 0x4000) continue; + result += fromCharCode.apply(null, chars); + chars.length = 0; + } + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/index.js new file mode 100644 index 00000000..dbbcdf61 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + formatMethod: require('./format-method'), + fromCodePoint: require('./from-code-point'), + isString: require('./is-string'), + randomUniq: require('./random-uniq'), + raw: require('./raw') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/is-string.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/is-string.js new file mode 100644 index 00000000..719aeec1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/is-string.js @@ -0,0 +1,10 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(''); + +module.exports = function (x) { + return (typeof x === 'string') || (x && (typeof x === 'object') && + ((x instanceof String) || (toString.call(x) === id))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/random-uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/random-uniq.js new file mode 100644 index 00000000..54ae6f8c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/random-uniq.js @@ -0,0 +1,11 @@ +'use strict'; + +var generated = Object.create(null) + + , random = Math.random; + +module.exports = function () { + var str; + do { str = random().toString(36).slice(2); } while (generated[str]); + return str; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/implement.js new file mode 100644 index 00000000..c417e659 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String, 'raw', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/index.js new file mode 100644 index 00000000..504a5de2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.raw + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/is-implemented.js new file mode 100644 index 00000000..d7204c0c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function () { + var raw = String.raw, test; + if (typeof raw !== 'function') return false; + test = ['foo\nbar', 'marko\n']; + test.raw = ['foo\\nbar', 'marko\\n']; + return raw(test, 'INSE\nRT') === 'foo\\nbarINSE\nRTmarko\\n'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/shim.js new file mode 100644 index 00000000..7096efbc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/string/raw/shim.js @@ -0,0 +1,15 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , validValue = require('../../object/valid-value') + + , reduce = Array.prototype.reduce; + +module.exports = function (callSite/*, …substitutions*/) { + var args, rawValue = Object(validValue(Object(validValue(callSite)).raw)); + if (!toPosInt(rawValue.length)) return ''; + args = arguments; + return reduce.call(rawValue, function (a, b, i) { + return a + String(args[i]) + b; + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/__tad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/__tad.js new file mode 100644 index 00000000..88457788 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/__tad.js @@ -0,0 +1,3 @@ +'use strict'; + +exports.context = null; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/implement.js new file mode 100644 index 00000000..f0605399 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/@@iterator/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/shim.js new file mode 100644 index 00000000..e590d8f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/@@iterator/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.__generic = function (t, a) { + var iterator = t.call(this); + a.deep(iterator.next(), { value: '1', done: false }); + a.deep(iterator.next(), { value: '2', done: false }); + a.deep(iterator.next(), { value: '3', done: false }); + a.deep(iterator.next(), { value: undefined, done: true }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/_compare-by-length.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/_compare-by-length.js new file mode 100644 index 00000000..e40c305b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/_compare-by-length.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + var x = [4, 5, 6], y = { length: 8 }, w = {}, z = { length: 1 }; + + a.deep([x, y, w, z].sort(t), [w, z, x, y]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/binary-search.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/binary-search.js new file mode 100644 index 00000000..cf331737 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/binary-search.js @@ -0,0 +1,15 @@ +'use strict'; + +var compare = function (value) { return this - value; }; + +module.exports = function (t, a) { + var arr; + arr = [2, 5, 5, 8, 34, 67, 98, 345, 678]; + + // highest, equal match + a(t.call(arr, compare.bind(1)), 0, "All higher"); + a(t.call(arr, compare.bind(679)), arr.length - 1, "All lower"); + a(t.call(arr, compare.bind(4)), 0, "Mid"); + a(t.call(arr, compare.bind(5)), 2, "Match"); + a(t.call(arr, compare.bind(6)), 2, "Above"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/clear.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/clear.js new file mode 100644 index 00000000..a5b1c977 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/clear.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + var x = [1, 2, {}, 4]; + a(t.call(x), x, "Returns same array"); + a.deep(x, [], "Empties array"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/compact.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/compact.js new file mode 100644 index 00000000..6390eb26 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/compact.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a(t.call(this).length, 3); + }, + "": function (t, a) { + var o, x, y, z; + o = {}; + x = [0, 1, "", null, o, false, undefined, true]; + y = x.slice(0); + + a.not(z = t.call(x), x, "Returns different object"); + a.deep(x, y, "Origin not changed"); + a.deep(z, [0, 1, "", o, false, true], "Result"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/implement.js new file mode 100644 index 00000000..3bdbe868 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/concat/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/shim.js new file mode 100644 index 00000000..c30eb7ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/concat/shim.js @@ -0,0 +1,26 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr = [1, 3, 45], x = {}, subArr, subArr2, result; + + a.deep(t.call(arr, '2d', x, ['ere', 'fe', x], false, null), + [1, 3, 45, '2d', x, 'ere', 'fe', x, false, null], "Plain array"); + + subArr = new SubArray('lol', 'miszko'); + subArr2 = new SubArray('elo', 'fol'); + + result = t.call(subArr, 'df', arr, 'fef', subArr2, null); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, ['lol', 'miszko', 'df', 1, 3, 45, 'fef', 'elo', 'fol', null], + "Spreable by default"); + + SubArray.prototype['@@isConcatSpreadable'] = false; + + result = t.call(subArr, 'df', arr, 'fef', subArr2, null); + a.deep(result, ['lol', 'miszko', 'df', 1, 3, 45, 'fef', subArr2, null], + "Non spreadable"); + + delete SubArray.prototype['@@isConcatSpreadable']; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/contains.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/contains.js new file mode 100644 index 00000000..21404a17 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/contains.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a(t.call(this, this[1]), true, "Contains"); + a(t.call(this, {}), false, "Does Not contain"); + }, + "": function (t, a) { + var o, x = {}, y = {}; + + o = [1, 'raz', x]; + + a(t.call(o, 1), true, "First"); + a(t.call(o, '1'), false, "Type coercion"); + a(t.call(o, 'raz'), true, "Primitive"); + a(t.call(o, 'foo'), false, "Primitive not found"); + a(t.call(o, x), true, "Object found"); + a(t.call(o, y), false, "Object not found"); + a(t.call(o, 1, 1), false, "Position"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/implement.js new file mode 100644 index 00000000..36070477 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/copy-within/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/shim.js new file mode 100644 index 00000000..93c85ea3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/copy-within/shim.js @@ -0,0 +1,29 @@ +'use strict'; + +module.exports = function (t, a) { + var args, x; + + a.h1("2 args"); + x = [1, 2, 3, 4, 5]; + t.call(x, 0, 3); + a.deep(x, [4, 5, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 1, 3), [1, 4, 5, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 1, 2), [1, 3, 4, 5, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 2, 2), [1, 2, 3, 4, 5]); + + a.h1("3 args"); + a.deep(t.call([1, 2, 3, 4, 5], 0, 3, 4), [4, 2, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 1, 3, 4), [1, 4, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 1, 2, 4), [1, 3, 4, 4, 5]); + + a.h1("Negative args"); + a.deep(t.call([1, 2, 3, 4, 5], 0, -2), [4, 5, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 0, -2, -1), [4, 2, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -2), [1, 3, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -1), [1, 3, 4, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], -4, -3), [1, 3, 4, 5, 5]); + + a.h1("Array-likes"); + args = { 0: 1, 1: 2, 2: 3, length: 3 }; + a.deep(t.call(args, -2, 0), { '0': 1, '1': 1, '2': 2, length: 3 }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/diff.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/diff.js new file mode 100644 index 00000000..bcfa3a0b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/diff.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a.deep(t.call(this, this), []); + }, + "": function (t, a) { + var x = {}, y = {}; + + a.deep(t.call([1, 'raz', x, 2, 'trzy', y], [x, 2, 'trzy']), [1, 'raz', y], + "Scope longer"); + a.deep(t.call([1, 'raz', x], [x, 2, 'trzy', 1, y]), ['raz'], + "Arg longer"); + a.deep(t.call([1, 'raz', x], []), [1, 'raz', x], "Empty arg"); + a.deep(t.call([], [1, y, 'sdfs']), [], "Empty scope"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/e-index-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/e-index-of.js new file mode 100644 index 00000000..4cf6c635 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/e-index-of.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}; + a(t.call([3, 'raz', {}, x, {}], x), 3, "Regular"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN), 2, "NaN"); + a(t.call([3, 'raz', 0, {}, -0], -0), 2, "-0"); + a(t.call([3, 'raz', -0, {}, 0], +0), 2, "+0"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, 3), 4, "fromIndex"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, -1), 4, "fromIndex negative #1"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, -2), 4, "fromIndex negative #2"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, -3), 2, "fromIndex negative #3"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/e-last-index-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/e-last-index-of.js new file mode 100644 index 00000000..ed4f7004 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/e-last-index-of.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}; + a(t.call([3, 'raz', {}, x, {}, x], x), 5, "Regular"); + a(t.call([3, 'raz', NaN, {}, x], NaN), 2, "NaN"); + a(t.call([3, 'raz', 0, {}, -0], -0), 4, "-0"); + a(t.call([3, 'raz', -0, {}, 0], +0), 4, "+0"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, 3), 2, "fromIndex"); + a(t.call([3, 'raz', NaN, 2, NaN], NaN, -1), 4, "Negative fromIndex #1"); + a(t.call([3, 'raz', NaN, 2, NaN], NaN, -2), 2, "Negative fromIndex #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/implement.js new file mode 100644 index 00000000..733209a1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/entries/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/shim.js new file mode 100644 index 00000000..bf40d310 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/entries/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.__generic = function (t, a) { + var iterator = t.call(this); + a.deep(iterator.next(), { value: [0, '1'], done: false }); + a.deep(iterator.next(), { value: [1, '2'], done: false }); + a.deep(iterator.next(), { value: [2, '3'], done: false }); + a.deep(iterator.next(), { value: undefined, done: true }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/exclusion.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/exclusion.js new file mode 100644 index 00000000..07b32d8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/exclusion.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + var x = {}; + a.deep(t.call(this, this, [this[0], this[2], x]), [x]); + }, + "": function (t, a) { + var x = {}, y = {}; + + a.deep(t.call([x, y]), [x, y], "No arguments"); + a.deep(t.call([x, 1], [], []), [x, 1], "Empty arguments"); + a.deep(t.call([1, 'raz', x], [2, 'raz', y], [2, 'raz', x]), [1, y]); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/implement.js new file mode 100644 index 00000000..2a01d285 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/fill/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/shim.js new file mode 100644 index 00000000..d67300fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/fill/shim.js @@ -0,0 +1,18 @@ +// Taken from https://github.com/paulmillr/es6-shim/blob/master/test/array.js + +'use strict'; + +module.exports = function (t, a) { + var x; + + x = [1, 2, 3, 4, 5, 6]; + a(t.call(x, -1), x, "Returns self object"); + a.deep(x, [-1, -1, -1, -1, -1, -1], "Value"); + + a.deep(t.call([1, 2, 3, 4, 5, 6], -1, 3), [1, 2, 3, -1, -1, -1], + "Positive start"); + a.deep(t.call([1, 2, 3, 4, 5, 6], -1, -3), [1, 2, 3, -1, -1, -1], + "Negative start"); + a.deep(t.call([1, 2, 3, 4, 5, 6], -1, 9), [1, 2, 3, 4, 5, 6], + "Large start"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/implement.js new file mode 100644 index 00000000..6d6b87cc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/filter/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/shim.js new file mode 100644 index 00000000..e8b5c398 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/filter/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr, x = {}, subArr, result; + + arr = ['foo', undefined, 0, '2d', false, x, null]; + + a.deep(t.call(arr, Boolean), ['foo', '2d', x], "Plain array"); + + subArr = new SubArray('foo', undefined, 0, '2d', false, x, null); + + result = t.call(subArr, Boolean); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, ['foo', '2d', x], "Result of subclass"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/implement.js new file mode 100644 index 00000000..8d85e618 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/find-index/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/shim.js new file mode 100644 index 00000000..b5fee463 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find-index/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +exports.__generic = function (t, a) { + var count = 0, o = {}, self = Object(this); + a(t.call(self, function (value, i, scope) { + a(value, this[i], "Value"); + a(i, count++, "Index"); + a(scope, this, "Scope"); + }, self), -1, "Falsy result"); + a(count, 3); + + count = -1; + a(t.call(this, function () { + return ++count ? o : null; + }, this), 1, "Truthy result"); + a(count, 1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/implement.js new file mode 100644 index 00000000..29fac41e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/find/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/shim.js new file mode 100644 index 00000000..ad2e6450 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/find/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +exports.__generic = function (t, a) { + var count = 0, o = {}, self = Object(this); + a(t.call(self, function (value, i, scope) { + a(value, this[i], "Value"); + a(i, count++, "Index"); + a(scope, this, "Scope"); + }, self), undefined, "Falsy result"); + a(count, 3); + + count = -1; + a(t.call(this, function () { + return ++count ? o : null; + }, this), this[1], "Truthy result"); + a(count, 1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/first-index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/first-index.js new file mode 100644 index 00000000..4aebad64 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/first-index.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a(t.call([]), null, "Empty"); + a(t.call([null]), 0, "One value"); + a(t.call([1, 2, 3]), 0, "Many values"); + a(t.call(new Array(1000)), null, "Sparse empty"); + x = []; + x[883] = undefined; + x[890] = null; + a(t.call(x), 883, "Manual sparse, distant value"); + x = new Array(1000); + x[657] = undefined; + x[700] = null; + a(t.call(x), 657, "Sparse, distant value"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/first.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/first.js new file mode 100644 index 00000000..87fde035 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/first.js @@ -0,0 +1,13 @@ +'use strict'; + +exports.__generic = function (t, a) { + a(t.call(this), this[0]); +}; +exports[''] = function (t, a) { + var x; + a(t.call([]), undefined, "Empty"); + a(t.call(new Array(234), undefined, "Sparse empty")); + x = new Array(2342); + x[434] = {}; + a(t.call(x), x[434], "Sparse"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/flatten.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/flatten.js new file mode 100644 index 00000000..65f1214b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/flatten.js @@ -0,0 +1,12 @@ +'use strict'; + +var o = [1, 2, [3, 4, [5, 6], 7, 8], 9, 10]; + +module.exports = { + __generic: function (t, a) { + a(t.call(this).length, 3); + }, + "Nested Arrays": function (t, a) { + a(t.call(o).length, 10); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/for-each-right.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/for-each-right.js new file mode 100644 index 00000000..2d24569d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/for-each-right.js @@ -0,0 +1,36 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + var count = 0, first, last, x, icount = this.length; + t.call(this, function (item, index, col) { + ++count; + if (!first) { + first = item; + } + last = item; + x = col; + a(index, --icount, "Index"); + }); + a(count, this.length, "Iterated"); + a(first, this[this.length - 1], "First is last"); + a(last, this[0], "Last is first"); + a.deep(x, Object(this), "Collection as third argument"); //jslint: skip + }, + "": function (t, a) { + var x = {}, y, count; + t.call([1], function () { y = this; }, x); + a(y, x, "Scope"); + y = 0; + t.call([3, 4, 4], function (a, i) { y += i; }); + a(y, 3, "Indexes"); + + x = [1, 3]; + x[5] = 'x'; + y = 0; + count = 0; + t.call(x, function (a, i) { ++count; y += i; }); + a(y, 6, "Misssing Indexes"); + a(count, 3, "Misssing Indexes, count"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/group.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/group.js new file mode 100644 index 00000000..32dc8c2d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/group.js @@ -0,0 +1,24 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + var count = 0, self; + + self = Object(this); + a.deep(t.call(self, function (v, i, scope) { + a(v, this[i], "Value"); + a(i, count++, "Index"); + a(scope, this, "Scope"); + return i; + }, self), { 0: [this[0]], 1: [this[1]], 2: [this[2]] }); + }, + "": function (t, a) { + var r; + r = t.call([2, 3, 3, 4, 5, 6, 7, 7, 23, 45, 34, 56], + function (v) { + return v % 2 ? 'odd' : 'even'; + }); + a.deep(r.odd, [3, 3, 5, 7, 7, 23, 45]); + a.deep(r.even, [2, 4, 6, 34, 56]); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/indexes-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/indexes-of.js new file mode 100644 index 00000000..3364170f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/indexes-of.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a.deep(t.call(this, this[1]), [1]); + }, + "": function (t, a) { + var x = {}; + a.deep(t.call([1, 3, 5, 3, 5], 6), [], "No result"); + a.deep(t.call([1, 3, 5, 1, 3, 5, 1], 1), [0, 3, 6], "Some results"); + a.deep(t.call([], x), [], "Empty array"); + a.deep(t.call([x, 3, {}, x, 3, 5, x], x), [0, 3, 6], "Search for object"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/intersection.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/intersection.js new file mode 100644 index 00000000..b72b2fb0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/intersection.js @@ -0,0 +1,24 @@ +'use strict'; + +var toArray = require('../../../array/to-array'); + +module.exports = { + __generic: function (t, a) { + a.deep(t.call(this, this, this), toArray(this)); + }, + "": function (t, a) { + var x = {}, y = {}, p, r; + a.deep(t.call([], [2, 3, 4]), [], "Empty #1"); + a.deep(t.call([2, 3, 4], []), [], "Empty #2"); + a.deep(t.call([2, 3, x], [y, 5, 7]), [], "Different"); + p = t.call([3, 5, 'raz', {}, 'dwa', x], [1, 3, 'raz', 'dwa', 'trzy', x, {}], + [3, 'raz', x, 65]); + r = [3, 'raz', x]; + p.sort(); + r.sort(); + a.deep(p, r, "Same parts"); + a.deep(t.call(r, r), r, "Same"); + a.deep(t.call([1, 2, x, 4, 5, y, 7], [7, y, 5, 4, x, 2, 1]), + [1, 2, x, 4, 5, y, 7], "Long reverse same"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/is-copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/is-copy.js new file mode 100644 index 00000000..e7f80e7a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/is-copy.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}; + a(t.call([], []), true, "Empty"); + a(t.call([], {}), true, "Empty lists"); + a(t.call([1, x, 'raz'], [1, x, 'raz']), true, "Same"); + a(t.call([1, x, 'raz'], { 0: 1, 1: x, 2: 'raz', length: 3 }), true, + "Same lists"); + a(t.call([1, x, 'raz'], [x, 1, 'raz']), false, "Diff order"); + a(t.call([1, x], [1, x, 'raz']), false, "Diff length #1"); + a(t.call([1, x, 'raz'], [1, x]), false, "Diff length #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/is-uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/is-uniq.js new file mode 100644 index 00000000..7349ba33 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/is-uniq.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}; + a(t.call([]), true, "Empty"); + a(t.call({}), true, "Empty lists"); + a(t.call([1, x, 'raz']), true, "Uniq"); + a(t.call([1, x, 1, 'raz']), false, "Not Uniq: primitive"); + a(t.call([1, x, '1', 'raz']), true, "Uniq: primitive"); + a(t.call([1, x, 1, {}, 'raz']), false, "Not Uniq: Obj"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/implement.js new file mode 100644 index 00000000..b0c1aa07 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/keys/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/shim.js new file mode 100644 index 00000000..a43c04ca --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/keys/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.__generic = function (t, a) { + var iterator = t.call(this); + a.deep(iterator.next(), { value: 0, done: false }); + a.deep(iterator.next(), { value: 1, done: false }); + a.deep(iterator.next(), { value: 2, done: false }); + a.deep(iterator.next(), { value: undefined, done: true }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/last-index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/last-index.js new file mode 100644 index 00000000..a1cac107 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/last-index.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a(t.call([]), null, "Empty"); + a(t.call([null]), 0, "One value"); + a(t.call([1, 2, 3]), 2, "Many values"); + a(t.call(new Array(1000)), null, "Sparse empty"); + x = []; + x[883] = null; + x[890] = undefined; + a(t.call(x), 890, "Manual sparse, distant value"); + x = new Array(1000); + x[657] = null; + x[700] = undefined; + a(t.call(x), 700, "Sparse, distant value"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/last.js new file mode 100644 index 00000000..8d051bc8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/last.js @@ -0,0 +1,15 @@ +'use strict'; + +exports.__generic = function (t, a) { + a(t.call(this), this[this.length - 1]); +}; + +exports[''] = function (t, a) { + var x; + a(t.call([]), undefined, "Empty"); + a(t.call(new Array(234), undefined, "Sparse empty")); + x = new Array(2342); + x[434] = {}; + x[450] = {}; + a(t.call(x), x[450], "Sparse"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/implement.js new file mode 100644 index 00000000..cdcbc8df --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/map/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/shim.js new file mode 100644 index 00000000..bbfefe8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/map/shim.js @@ -0,0 +1,19 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr, x = {}, subArr, result; + + arr = ['foo', undefined, 0, '2d', false, x, null]; + + a.deep(t.call(arr, Boolean), [true, false, false, true, false, true, false], + "Plain array"); + + subArr = new SubArray('foo', undefined, 0, '2d', false, x, null); + + result = t.call(subArr, Boolean); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, [true, false, false, true, false, true, false], + "Result of subclass"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/remove.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/remove.js new file mode 100644 index 00000000..3ebdca2d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/remove.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + var y = {}, z = {}, x = [9, z, 5, y, 'foo']; + t.call(x, y); + a.deep(x, [9, z, 5, 'foo']); + t.call(x, {}); + a.deep(x, [9, z, 5, 'foo'], "Not existing"); + t.call(x, 5); + a.deep(x, [9, z, 'foo'], "Primitive"); + x = [9, z, 5, y, 'foo']; + t.call(x, z, 5, 'foo'); + a.deep(x, [9, y], "More than one argument"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/separate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/separate.js new file mode 100644 index 00000000..42918b59 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/separate.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var x = [], y = {}, z = {}; + a.deep(t.call(x, y), [], "Empty"); + a.not(t.call(x), x, "Returns copy"); + a.deep(t.call([1], y), [1], "One"); + a.deep(t.call([1, 'raz'], y), [1, y, 'raz'], "One"); + a.deep(t.call([1, 'raz', x], y), [1, y, 'raz', y, x], "More"); + x = new Array(1000); + x[23] = 2; + x[3453] = 'raz'; + x[500] = z; + a.deep(t.call(x, y), [2, y, z, y, 'raz'], "Sparse"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/implement.js new file mode 100644 index 00000000..855ae2fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/slice/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/shim.js new file mode 100644 index 00000000..f674f347 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/slice/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr, x = {}, subArr, result; + + arr = ['foo', undefined, 0, '2d', false, x, null]; + + a.deep(t.call(arr, 2, 4), [0, '2d'], "Plain array: result"); + + subArr = new SubArray('foo', undefined, 0, '2d', false, x, null); + + result = t.call(subArr, 2, 4); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, [0, '2d'], "Subclass: result"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/some-right.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/some-right.js new file mode 100644 index 00000000..900771a6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/some-right.js @@ -0,0 +1,43 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + var count = 0, first, last, x, icount = this.length; + t.call(this, function (item, index, col) { + ++count; + if (!first) { + first = item; + } + last = item; + x = col; + a(index, --icount, "Index"); + }); + a(count, this.length, "Iterated"); + a(first, this[this.length - 1], "First is last"); + a(last, this[0], "Last is first"); + a.deep(x, Object(this), "Collection as third argument"); //jslint: skip + }, + "": function (t, a) { + var x = {}, y, count; + t.call([1], function () { y = this; }, x); + a(y, x, "Scope"); + y = 0; + t.call([3, 4, 4], function (a, i) { y += i; }); + a(y, 3, "Indexes"); + + x = [1, 3]; + x[5] = 'x'; + y = 0; + count = 0; + a(t.call(x, function (a, i) { ++count; y += i; }), false, "Return"); + a(y, 6, "Misssing Indexes"); + a(count, 3, "Misssing Indexes, count"); + + count = 0; + a(t.call([-2, -3, -4, 2, -5], function (item) { + ++count; + return item > 0; + }), true, "Return"); + a(count, 2, "Break after true is returned"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/implement.js new file mode 100644 index 00000000..0d9f4618 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/splice/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/shim.js new file mode 100644 index 00000000..2c751e67 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/splice/shim.js @@ -0,0 +1,19 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr, x = {}, subArr, result; + + arr = ['foo', undefined, 0, '2d', false, x, null]; + + a.deep(t.call(arr, 2, 2, 'bar'), [0, '2d'], "Plain array: result"); + a.deep(arr, ["foo", undefined, "bar", false, x, null], "Plain array: change"); + + subArr = new SubArray('foo', undefined, 0, '2d', false, x, null); + + result = t.call(subArr, 2, 2, 'bar'); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, [0, '2d'], "Subclass: result"); + a.deep(subArr, ["foo", undefined, "bar", false, x, null], "Subclass: change"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/uniq.js new file mode 100644 index 00000000..2f7e6c4e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/uniq.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a(t.call(this).length, 3); + }, + "": function (t, a) { + var o, x = {}, y = {}, z = {}, w; + o = [1, 2, x, 3, 1, 'raz', '1', y, x, 'trzy', z, 'raz']; + + a.not(w = t.call(o), o, "Returns different object"); + a.deep(w, [1, 2, x, 3, 'raz', '1', y, 'trzy', z], "Result"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/implement.js new file mode 100644 index 00000000..9f40138c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/values/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/shim.js new file mode 100644 index 00000000..e590d8f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/#/values/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.__generic = function (t, a) { + var iterator = t.call(this); + a.deep(iterator.next(), { value: '1', done: false }); + a.deep(iterator.next(), { value: '2', done: false }); + a.deep(iterator.next(), { value: '3', done: false }); + a.deep(iterator.next(), { value: undefined, done: true }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/__scopes.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/__scopes.js new file mode 100644 index 00000000..fc240d30 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/__scopes.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.Array = ['1', '2', '3']; + +exports.Arguments = (function () { + return arguments; +}('1', '2', '3')); + +exports.String = "123"; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/_is-extensible.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/_is-extensible.js new file mode 100644 index 00000000..d387126f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/_is-extensible.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t, 'boolean'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/_sub-array-dummy-safe.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/_sub-array-dummy-safe.js new file mode 100644 index 00000000..29d8699d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/_sub-array-dummy-safe.js @@ -0,0 +1,7 @@ +'use strict'; + +var isArray = Array.isArray; + +module.exports = function (t, a) { + t((t === null) || isArray(t.prototype), true); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/_sub-array-dummy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/_sub-array-dummy.js new file mode 100644 index 00000000..29d8699d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/_sub-array-dummy.js @@ -0,0 +1,7 @@ +'use strict'; + +var isArray = Array.isArray; + +module.exports = function (t, a) { + t((t === null) || isArray(t.prototype), true); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/implement.js new file mode 100644 index 00000000..e0db846f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../array/from/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/shim.js new file mode 100644 index 00000000..310302ac --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/from/shim.js @@ -0,0 +1,60 @@ +// Some tests taken from: https://github.com/mathiasbynens/Array.from/blob/master/tests/tests.js + +'use strict'; + +module.exports = function (t, a) { + var o = [1, 2, 3], MyType; + a.not(t(o), o, "Array"); + a.deep(t(o), o, "Array: same content"); + a.deep(t('12r3v'), ['1', '2', 'r', '3', 'v'], "String"); + a.deep(t((function () { return arguments; }(3, o, 'raz'))), + [3, o, 'raz'], "Arguments"); + a.deep(t((function () { return arguments; }(3))), [3], + "Arguments with one numeric value"); + + a.deep(t({ 0: 'raz', 1: 'dwa', length: 2 }), ['raz', 'dwa'], "Other"); + + a.deep(t(o, function (val) { return (val + 2) * 10; }, 10), [30, 40, 50], + "Mapping"); + + a.throws(function () { t(); }, TypeError, "Undefined"); + a.deep(t(3), [], "Primitive"); + + a(t.length, 1, "Length"); + a.deep(t({ length: 0 }), [], "No values Array-like"); + a.deep(t({ length: -1 }), [], "Invalid length Array-like"); + a.deep(t({ length: -Infinity }), [], "Invalid length Array-like #2"); + a.throws(function () { t(undefined); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.deep(t(false), [], "Boolean"); + a.deep(t(-Infinity), [], "Inifity"); + a.deep(t(-0), [], "-0"); + a.deep(t(+0), [], "+0"); + a.deep(t(1), [], "1"); + a.deep(t(+Infinity), [], "+Infinity"); + a.deep(t({}), [], "Plain object"); + a.deep(t({ length: 1 }), [undefined], "Sparse array-like"); + a.deep(t({ '0': 'a', '1': 'b', length: 2 }, function (x) { return x + x; }), ['aa', 'bb'], + "Map"); + a.deep(t({ '0': 'a', '1': 'b', length: 2 }, function (x) { return String(this); }, undefined), + ['undefined', 'undefined'], "Map context"); + a.deep(t({ '0': 'a', '1': 'b', length: 2 }, function (x) { return String(this); }, 'x'), + ['x', 'x'], "Map primitive context"); + a.throws(function () { t({}, 'foo', 'x'); }, TypeError, "Non callable for map"); + + a.deep(t.call(null, { length: 1, '0': 'a' }), ['a'], "Null context"); + + a(t({ __proto__: { '0': 'abc', length: 1 } })[0], 'abc', "Values on prototype"); + + a.throws(function () { t.call(function () { return Object.freeze({}); }, {}); }, + TypeError, "Contructor producing freezed objects"); + + // Ensure no setters are called for the indexes + // Ensure no setters are called for the indexes + MyType = function () {}; + Object.defineProperty(MyType.prototype, '0', { + set: function (x) { throw new Error('Setter called: ' + x); } + }); + a.deep(t.call(MyType, { '0': 'abc', length: 1 }), { '0': 'abc', length: 1 }, + "Defined not set"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/generate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/generate.js new file mode 100644 index 00000000..d72e0568 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/generate.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}, y = {}; + a.deep(t(3), [undefined, undefined, undefined], "Just length"); + a.deep(t(0, 'x'), [], "No repeat"); + a.deep(t(1, x, y), [x], "Arguments length larger than repeat number"); + a.deep(t(3, x), [x, x, x], "Single argument"); + a.deep(t(5, x, y), [x, y, x, y, x], "Many arguments"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/is-plain-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/is-plain-array.js new file mode 100644 index 00000000..871a08ae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/is-plain-array.js @@ -0,0 +1,18 @@ +'use strict'; + +var SubArray = require('../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr = [1, 2, 3]; + a(t(arr), true, "Array"); + a(t(null), false, "Null"); + a(t(), false, "Undefined"); + a(t('234'), false, "String"); + a(t(23), false, "Number"); + a(t({}), false, "Plain object"); + a(t({ length: 1, 0: 'raz' }), false, "Array-like"); + a(t(Object.create(arr)), false, "Array extension"); + if (!SubArray) return; + a(t(new SubArray(23)), false, "Subclass instance"); + a(t(Array.prototype), false, "Array.prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/implement.js new file mode 100644 index 00000000..30d53be2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../array/of/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/shim.js new file mode 100644 index 00000000..e6974420 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/of/shim.js @@ -0,0 +1,68 @@ +// Most tests taken from https://github.com/mathiasbynens/Array.of/blob/master/tests/tests.js +// Thanks @mathiasbynens + +'use strict'; + +var defineProperty = Object.defineProperty; + +module.exports = function (t, a) { + var x = {}, testObject, MyType; + + a.deep(t(), [], "No arguments"); + a.deep(t(3), [3], "One numeric argument"); + a.deep(t(3, 'raz', null, x, undefined), [3, 'raz', null, x, undefined], + "Many arguments"); + + a(t.length, 0, "Length"); + + a.deep(t('abc'), ['abc'], "String"); + a.deep(t(undefined), [undefined], "Undefined"); + a.deep(t(null), [null], "Null"); + a.deep(t(false), [false], "Boolean"); + a.deep(t(-Infinity), [-Infinity], "Infinity"); + a.deep(t(-0), [-0], "-0"); + a.deep(t(+0), [+0], "+0"); + a.deep(t(1), [1], "1"); + a.deep(t(1, 2, 3), [1, 2, 3], "Numeric args"); + a.deep(t(+Infinity), [+Infinity], "+Infinity"); + a.deep(t({ '0': 'a', '1': 'b', '2': 'c', length: 3 }), + [{ '0': 'a', '1': 'b', '2': 'c', length: 3 }], "Array like"); + a.deep(t(undefined, null, false, -Infinity, -0, +0, 1, 2, +Infinity), + [undefined, null, false, -Infinity, -0, +0, 1, 2, +Infinity], "Falsy arguments"); + + a.h1("Null context"); + a.deep(t.call(null, 'abc'), ['abc'], "String"); + a.deep(t.call(null, undefined), [undefined], "Undefined"); + a.deep(t.call(null, null), [null], "Null"); + a.deep(t.call(null, false), [false], "Boolean"); + a.deep(t.call(null, -Infinity), [-Infinity], "-Infinity"); + a.deep(t.call(null, -0), [-0], "-0"); + a.deep(t.call(null, +0), [+0], "+0"); + a.deep(t.call(null, 1), [1], "1"); + a.deep(t.call(null, 1, 2, 3), [1, 2, 3], "Numeric"); + a.deep(t.call(null, +Infinity), [+Infinity], "+Infinity"); + a.deep(t.call(null, { '0': 'a', '1': 'b', '2': 'c', length: 3 }), + [{ '0': 'a', '1': 'b', '2': 'c', length: 3 }], "Array-like"); + a.deep(t.call(null, undefined, null, false, -Infinity, -0, +0, 1, 2, +Infinity), + [undefined, null, false, -Infinity, -0, +0, 1, 2, +Infinity], "Falsy"); + + a.h1("Other constructor context"); + a.deep(t.call(Object, 1, 2, 3), { '0': 1, '1': 2, '2': 3, length: 3 }, "Many arguments"); + + testObject = Object(3); + testObject[0] = 1; + testObject[1] = 2; + testObject[2] = 3; + testObject.length = 3; + a.deep(t.call(Object, 1, 2, 3), testObject, "Test object"); + a(t.call(Object).length, 0, "No arguments"); + a.throws(function () { t.call(function () { return Object.freeze({}); }); }, TypeError, + "Frozen instance"); + + // Ensure no setters are called for the indexes + MyType = function () {}; + defineProperty(MyType.prototype, '0', { + set: function (x) { throw new Error('Setter called: ' + x); } + }); + a.deep(t.call(MyType, 'abc'), { '0': 'abc', length: 1 }, "Define, not set"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/to-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/to-array.js new file mode 100644 index 00000000..4985b5ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/to-array.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var o = [1, 2, 3]; + a(t(o), o, "Array"); + a.deep(t('12r3v'), ['1', '2', 'r', '3', 'v'], "String"); + a.deep(t((function () { return arguments; }(3, o, 'raz'))), + [3, o, 'raz'], "Arguments"); + a.deep(t((function () { return arguments; }(3))), [3], + "Arguments with one numeric value"); + + a.deep(t({ 0: 'raz', 1: 'dwa', length: 2 }), ['raz', 'dwa'], "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/valid-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/valid-array.js new file mode 100644 index 00000000..3732192d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/array/valid-array.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.throws(function () { t(0); }, TypeError, "Number"); + a.throws(function () { t(true); }, TypeError, "Boolean"); + a.throws(function () { t('raz'); }, TypeError, "String"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a.throws(function () { t({}); }, TypeError, "Object"); + a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like"); + a(t(x = []), x, "Array"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/boolean/is-boolean.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/boolean/is-boolean.js new file mode 100644 index 00000000..4e6b3cb7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/boolean/is-boolean.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + a(t('arar'), false, "String"); + a(t(12), false, "Number"); + a(t(false), true, "Boolean"); + a(t(new Boolean(false)), true, "Boolean object"); + a(t(new Date()), false, "Date"); + a(t(new String('raz')), false, "String object"); + a(t({}), false, "Plain object"); + a(t(/a/), false, "Regular expression"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/copy.js new file mode 100644 index 00000000..767c5e16 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/copy.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var o = new Date(), o2; + + o2 = t.call(o); + a.not(o, o2, "Different objects"); + a.ok(o2 instanceof Date, "Instance of Date"); + a(o.getTime(), o2.getTime(), "Same time"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/days-in-month.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/days-in-month.js new file mode 100644 index 00000000..9ddba55f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/days-in-month.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(new Date(2001, 0, 1)), 31, "January"); + a(t.call(new Date(2001, 1, 1)), 28, "February"); + a(t.call(new Date(2000, 1, 1)), 29, "February (leap)"); + a(t.call(new Date(2001, 2, 1)), 31, "March"); + a(t.call(new Date(2001, 3, 1)), 30, "April"); + a(t.call(new Date(2001, 4, 1)), 31, "May"); + a(t.call(new Date(2001, 5, 1)), 30, "June"); + a(t.call(new Date(2001, 6, 1)), 31, "July"); + a(t.call(new Date(2001, 7, 1)), 31, "August"); + a(t.call(new Date(2001, 8, 1)), 30, "September"); + a(t.call(new Date(2001, 9, 1)), 31, "October"); + a(t.call(new Date(2001, 10, 1)), 30, "November"); + a(t.call(new Date(2001, 11, 1)), 31, "December"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/floor-day.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/floor-day.js new file mode 100644 index 00000000..d4f4a908 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/floor-day.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(new Date(2000, 0, 1, 13, 32, 34, 234)).valueOf(), + new Date(2000, 0, 1).valueOf()); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/floor-month.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/floor-month.js new file mode 100644 index 00000000..b4a81bef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/floor-month.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(new Date(2000, 0, 15, 13, 32, 34, 234)).valueOf(), + new Date(2000, 0, 1).valueOf()); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/floor-year.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/floor-year.js new file mode 100644 index 00000000..aae117e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/floor-year.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(new Date(2000, 5, 13, 13, 32, 34, 234)).valueOf(), + new Date(2000, 0, 1).valueOf()); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/format.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/format.js new file mode 100644 index 00000000..e68e4bf7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/#/format.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + var dt = new Date(2011, 2, 3, 3, 5, 5, 32); + a(t.call(dt, ' %Y.%y.%m.%d.%H.%M.%S.%L '), ' 2011.11.03.03.03.05.05.032 '); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/is-date.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/is-date.js new file mode 100644 index 00000000..109093df --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/is-date.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t('arar'), false, "String"); + a(t(12), false, "Number"); + a(t(true), false, "Boolean"); + a(t(new Date()), true, "Date"); + a(t(new String('raz')), false, "String object"); + a(t({}), false, "Plain object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/valid-date.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/valid-date.js new file mode 100644 index 00000000..98787e40 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/date/valid-date.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var d = new Date(); + a(t(d), d, "Date"); + a.throws(function () { + t({}); + }, "Object"); + a.throws(function () { + t({ valueOf: function () { return 20; } }); + }, "Number object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/#/throw.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/#/throw.js new file mode 100644 index 00000000..1213cfc3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/#/throw.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var e = new Error(); + try { + t.call(e); + } catch (e2) { + a(e2, e); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/custom.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/custom.js new file mode 100644 index 00000000..d4ff500c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/custom.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var T = t, err = new T('My Error', 'MY_ERROR', { errno: 123 }); + a(err instanceof Error, true, "Instance of error"); + a(err.constructor, Error, "Constructor"); + a(err.name, 'Error', "Name"); + a(String(err), 'Error: My Error', "String representation"); + a(err.code, 'MY_ERROR', "Code"); + a(err.errno, 123, "Errno"); + a(typeof err.stack, 'string', "Stack trace"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/is-error.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/is-error.js new file mode 100644 index 00000000..f8b5e200 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/is-error.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(), false, "Undefined"); + a(t(1), false, "Primitive"); + a(t({}), false, "Objectt"); + a(t({ toString: function () { return '[object Error]'; } }), false, + "Fake error"); + a(t(new Error()), true, "Error"); + a(t(new EvalError()), true, "EvalError"); + a(t(new RangeError()), true, "RangeError"); + a(t(new ReferenceError()), true, "ReferenceError"); + a(t(new SyntaxError()), true, "SyntaxError"); + a(t(new TypeError()), true, "TypeError"); + a(t(new URIError()), true, "URIError"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/valid-error.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/valid-error.js new file mode 100644 index 00000000..e04cdb33 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/error/valid-error.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + var e = new Error(); + a(t(e), e, "Error"); + a.throws(function () { + t({}); + }, "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/compose.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/compose.js new file mode 100644 index 00000000..83de5e84 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/compose.js @@ -0,0 +1,9 @@ +'use strict'; + +var f = function (a, b) { return ['a', arguments.length, a, b]; } + , g = function (a) { return ['b', arguments.length].concat(a); } + , h = function (a) { return ['c', arguments.length].concat(a); }; + +module.exports = function (t, a) { + a.deep(t.call(h, g, f)(1, 2), ['c', 1, 'b', 1, 'a', 2, 1, 2]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/copy.js new file mode 100644 index 00000000..7a22e2f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/copy.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = function (t, a) { + var foo = 'raz', bar = 'dwa' + , fn = function marko(a, b) { return this + a + b + foo + bar; } + , result, o = {}; + + fn.prototype = o; + + fn.foo = 'raz'; + + result = t.call(fn); + + a(result.length, fn.length, "Length"); + a(result.name, fn.name, "Length"); + a(result.call('marko', 'el', 'fe'), 'markoelferazdwa', "Body"); + a(result.prototype, fn.prototype, "Prototype"); + a(result.foo, fn.foo, "Custom property"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/curry.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/curry.js new file mode 100644 index 00000000..18fb0389 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/curry.js @@ -0,0 +1,18 @@ +'use strict'; + +var toArray = require('../../../array/to-array') + + , f = function () { return toArray(arguments); }; + +module.exports = function (t, a) { + var x, y = {}, z; + a.deep(t.call(f, 0, 1, 2)(3), [], "0 arguments"); + x = t.call(f, 5, {}); + a(x.length, 5, "Length #1"); + z = x(1, 2); + a(z.length, 3, "Length #2"); + z = z(3, 4); + a(z.length, 1, "Length #1"); + a.deep(z(5, 6), [1, 2, 3, 4, 5], "Many arguments"); + a.deep(x(8, 3)(y, 45)('raz', 6), [8, 3, y, 45, 'raz'], "Many arguments #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/lock.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/lock.js new file mode 100644 index 00000000..44a12d7b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/lock.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(function () { + return arguments.length; + })(1, 2, 3), 0); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/not.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/not.js new file mode 100644 index 00000000..c0f5e9d4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/not.js @@ -0,0 +1,11 @@ +'use strict'; + +var identity = require('../../../function/identity') + , noop = require('../../../function/noop'); + +module.exports = function (t, a) { + a(t.call(identity)(''), true, "Falsy"); + a(t.call(noop)(), true, "Undefined"); + a(t.call(identity)({}), false, "Any object"); + a(t.call(identity)(true), false, "True"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/partial.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/partial.js new file mode 100644 index 00000000..bd00ce75 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/partial.js @@ -0,0 +1,9 @@ +'use strict'; + +var toArray = require('../../../array/to-array') + + , f = function () { return toArray(arguments); }; + +module.exports = function (t, a) { + a.deep(t.call(f, 1)(2, 3), [1, 2, 3]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/spread.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/spread.js new file mode 100644 index 00000000..b82dfecf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/spread.js @@ -0,0 +1,8 @@ +'use strict'; + +var f = function (a, b) { return this[a] + this[b]; } + , o = { a: 3, b: 4 }; + +module.exports = function (t, a) { + a(t.call(f).call(o, ['a', 'b']), 7); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/to-string-tokens.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/to-string-tokens.js new file mode 100644 index 00000000..4c54d303 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/#/to-string-tokens.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t.call(function (a, b) { return this[a] + this[b]; }), + { args: 'a, b', body: ' return this[a] + this[b]; ' }); + a.deep(t.call(function () {}), + { args: '', body: '' }); + a.deep(t.call(function (raz) {}), + { args: 'raz', body: '' }); + a.deep(t.call(function () { Object(); }), + { args: '', body: ' Object(); ' }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/_define-length.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/_define-length.js new file mode 100644 index 00000000..8f037e85 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/_define-length.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var foo = 'raz', bar = 'dwa' + , fn = function (a, b) { return this + a + b + foo + bar; } + , result; + + result = t(fn, 3); + a(result.call('marko', 'el', 'fe'), 'markoelferazdwa', "Content"); + a(result.length, 3, "Length"); + a(result.prototype, fn.prototype, "Prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/constant.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/constant.js new file mode 100644 index 00000000..fda52aa4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/constant.js @@ -0,0 +1,7 @@ +'use strict'; + +var o = {}; + +module.exports = function (t, a) { + a(t(o)(), o); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/identity.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/identity.js new file mode 100644 index 00000000..8013e2e5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/identity.js @@ -0,0 +1,7 @@ +'use strict'; + +var o = {}; + +module.exports = function (t, a) { + a(t(o), o); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/invoke.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/invoke.js new file mode 100644 index 00000000..fcce4aaa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/invoke.js @@ -0,0 +1,9 @@ +'use strict'; + +var constant = require('../../function/constant') + + , o = { b: constant('c') }; + +module.exports = function (t, a) { + a(t('b')(o), 'c'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/is-arguments.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/is-arguments.js new file mode 100644 index 00000000..f8de8812 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/is-arguments.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + var args, dummy; + args = (function () { return arguments; }()); + dummy = { '0': 1, '1': 2 }; + Object.defineProperty(dummy, 'length', { value: 2 }); + a(t(args), true, "Arguments"); + a(t(dummy), false, "Dummy"); + a(t([]), false, "Array"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/is-function.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/is-function.js new file mode 100644 index 00000000..83acc42f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/is-function.js @@ -0,0 +1,8 @@ +'use strict'; + +var o = { call: Function.prototype.call, apply: Function.prototype.apply }; + +module.exports = function (t, a) { + a(t(function () {}), true, "Function is function"); + a(t(o), false, "Plain object is not function"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/noop.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/noop.js new file mode 100644 index 00000000..4305c6fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/noop.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t(1, 2, 3), 'undefined'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/pluck.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/pluck.js new file mode 100644 index 00000000..5bf9583a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/pluck.js @@ -0,0 +1,7 @@ +'use strict'; + +var o = { foo: 'bar' }; + +module.exports = function (t, a) { + a(t('foo')(o), o.foo); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/valid-function.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/valid-function.js new file mode 100644 index 00000000..59b16233 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/function/valid-function.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + var f = function () {}; + a(t(f), f, "Function"); + f = new Function(); + a(t(f), f, "Function"); + a.throws(function () { + t({}); + }, "Object"); + a.throws(function () { + t(/re/); + }, "RegExp"); + a.throws(function () { + t({ call: function () { return 20; } }); + }, "Plain object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/global.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/global.js new file mode 100644 index 00000000..1f452aef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/global.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a.ok(t && typeof t === 'object'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/for-each.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/for-each.js new file mode 100644 index 00000000..0fed8ad8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/for-each.js @@ -0,0 +1,40 @@ +'use strict'; + +var ArrayIterator = require('es6-iterator/array') + + , slice = Array.prototype.slice; + +module.exports = function (t, a) { + var i = 0, x = ['raz', 'dwa', 'trzy'], y = {}; + t(x, function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Array " + i + "#"); + a(this, y, "Array: context: " + (i++) + "#"); + }, y); + i = 0; + t((function () { return arguments; }('raz', 'dwa', 'trzy')), function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Arguments" + i + "#"); + a(this, y, "Arguments: context: " + (i++) + "#"); + }, y); + i = 0; + t({ 0: 'raz', 1: 'dwa', 2: 'trzy', length: 3 }, function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Array-like" + i + "#"); + a(this, y, "Array-like: context: " + (i++) + "#"); + }, y); + i = 0; + t(x = 'foo', function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#"); + a(this, y, "Regular String: context: " + (i++) + "#"); + }, y); + i = 0; + x = ['r', '💩', 'z']; + t('r💩z', function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#"); + a(this, y, "Unicode String: context: " + (i++) + "#"); + }, y); + i = 0; + t(new ArrayIterator(x), function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Iterator " + i + "#"); + a(this, y, "Iterator: context: " + (i++) + "#"); + }, y); + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/is.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/is.js new file mode 100644 index 00000000..c0d2a43e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/is.js @@ -0,0 +1,20 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (t, a) { + var x; + a(t([]), true, "Array"); + a(t(""), true, "String"); + a(t((function () { return arguments; }())), true, "Arguments"); + a(t({ length: 0 }), true, "List object"); + a(t(function () {}), false, "Function"); + a(t({}), false, "Plain object"); + a(t(/raz/), false, "Regexp"); + a(t(), false, "No argument"); + a(t(null), false, "Null"); + a(t(undefined), false, "Undefined"); + x = {}; + x[iteratorSymbol] = function () {}; + a(t(x), true, "Iterable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/validate-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/validate-object.js new file mode 100644 index 00000000..da12529b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/validate-object.js @@ -0,0 +1,20 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a.throws(function () { t(''); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Plain Object"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + + a(t(x = { length: 1 }), x, "Array like"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); + x = {}; + x[iteratorSymbol] = function () {}; + a(t(x), x, "Iterable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/validate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/validate.js new file mode 100644 index 00000000..bcc2ad3d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/iterable/validate.js @@ -0,0 +1,20 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a(t(''), '', "''"); + a.throws(function () { t({}); }, TypeError, "Plain Object"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + + a(t(x = { length: 1 }), x, "Array like"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); + x = {}; + x[iteratorSymbol] = function () {}; + a(t(x), x, "Iterable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/_pack-ieee754.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/_pack-ieee754.js new file mode 100644 index 00000000..9041431d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/_pack-ieee754.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t(1.337, 8, 23), [63, 171, 34, 209]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/_unpack-ieee754.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/_unpack-ieee754.js new file mode 100644 index 00000000..ca30b820 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/_unpack-ieee754.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t([63, 171, 34, 209], 8, 23), 1.3370000123977661); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/implement.js new file mode 100644 index 00000000..01fb6d08 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/acosh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/shim.js new file mode 100644 index 00000000..3d710c79 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/acosh/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-1), NaN, "Negative"); + a(t(0), NaN, "Zero"); + a(t(0.5), NaN, "Below 1"); + a(t(1), 0, "1"); + a(t(2), 1.3169578969248166, "Other"); + a(t(Infinity), Infinity, "Infinity"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/implement.js new file mode 100644 index 00000000..d1fcecee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/asinh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/shim.js new file mode 100644 index 00000000..d9fbe49e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/asinh/shim.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(t(-2), -1.4436354751788103, "Negative"); + a(t(2), 1.4436354751788103, "Positive"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/implement.js new file mode 100644 index 00000000..cba8fad8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/atanh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/shim.js new file mode 100644 index 00000000..a857b496 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/atanh/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-2), NaN, "Less than -1"); + a(t(2), NaN, "Greater than 1"); + a(t(-1), -Infinity, "-1"); + a(t(1), Infinity, "1"); + a(t(0), 0, "Zero"); + a(t(0.5), 0.5493061443340549, "Ohter"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/implement.js new file mode 100644 index 00000000..374d4b38 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/cbrt/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/shim.js new file mode 100644 index 00000000..43ab68b8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cbrt/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(t(-1), -1, "-1"); + a(t(1), 1, "1"); + a(t(2), 1.2599210498948732, "Ohter"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/implement.js new file mode 100644 index 00000000..44f88155 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/clz32/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/shim.js new file mode 100644 index 00000000..a769b39b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/clz32/shim.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(1), 31, "1"); + a(t(1000), 22, "1000"); + a(t(), 32, "No arguments"); + a(t(Infinity), 32, "Infinity"); + a(t(-Infinity), 32, "-Infinity"); + a(t("foo"), 32, "String"); + a(t(true), 31, "Boolean"); + a(t(3.5), 30, "Float"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/implement.js new file mode 100644 index 00000000..f3c712b1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/cosh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/shim.js new file mode 100644 index 00000000..419c1236 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/cosh/shim.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 1, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), Infinity, "-Infinity"); + a(t(1), 1.5430806348152437, "1"); + a(t(Number.MAX_VALUE), Infinity); + a(t(-Number.MAX_VALUE), Infinity); + a(t(Number.MIN_VALUE), 1); + a(t(-Number.MIN_VALUE), 1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/implement.js new file mode 100644 index 00000000..c2129672 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/expm1/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/shim.js new file mode 100644 index 00000000..15f0e796 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/expm1/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -1, "-Infinity"); + a(t(1).toFixed(15), '1.718281828459045', "1"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/implement.js new file mode 100644 index 00000000..c909af7c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/fround/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/shim.js new file mode 100644 index 00000000..4ef6d4ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/fround/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(t(1.337), 1.3370000123977661, "1"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/implement.js new file mode 100644 index 00000000..99466464 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/hypot/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/shim.js new file mode 100644 index 00000000..91d950a5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/hypot/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(), 0, "No arguments"); + a(t(0, -0, 0), 0, "Zeros"); + a(t(4, NaN, Infinity), Infinity, "Infinity"); + a(t(4, NaN, -Infinity), Infinity, "Infinity"); + a(t(4, NaN, 34), NaN, "NaN"); + a(t(3, 4), 5, "#1"); + a(t(3, 4, 5), 7.0710678118654755, "#2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/implement.js new file mode 100644 index 00000000..7b2a2a61 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/imul/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/shim.js new file mode 100644 index 00000000..a2ca7fe7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/imul/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(), 0, "No arguments"); + a(t(0, 0), 0, "Zeros"); + a(t(2, 4), 8, "#1"); + a(t(-1, 8), -8, "#2"); + a(t(0xfffffffe, 5), -10, "#3"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/implement.js new file mode 100644 index 00000000..4b3b4a45 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/log10/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/shim.js new file mode 100644 index 00000000..5fa0d5be --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log10/shim.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-0.5), NaN, "Less than 0"); + a(t(0), -Infinity, "0"); + a(t(1), 0, "1"); + a(t(Infinity), Infinity, "Infinity"); + a(t(2), 0.3010299956639812, "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/implement.js new file mode 100644 index 00000000..5d269bd3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/log1p/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/shim.js new file mode 100644 index 00000000..d495ce04 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log1p/shim.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-1.5), NaN, "Less than -1"); + a(t(-1), -Infinity, "-1"); + a(t(0), 0, "0"); + a(t(Infinity), Infinity, "Infinity"); + a(t(1), 0.6931471805599453, "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/implement.js new file mode 100644 index 00000000..92b501ac --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/log2/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/shim.js new file mode 100644 index 00000000..faa9c32a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/log2/shim.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-0.5), NaN, "Less than 0"); + a(t(0), -Infinity, "0"); + a(t(1), 0, "1"); + a(t(Infinity), Infinity, "Infinity"); + a(t(3).toFixed(15), '1.584962500721156', "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/implement.js new file mode 100644 index 00000000..5875c42d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/sign/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/shim.js new file mode 100644 index 00000000..b6b89c15 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sign/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +var is = require('../../../object/is'); + +module.exports = function (t, a) { + a(is(t(0), +0), true, "+0"); + a(is(t(-0), -0), true, "-0"); + a(t({}), NaN, true, "NaN"); + a(t(-234234234), -1, "Negative"); + a(t(234234234), 1, "Positive"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/implement.js new file mode 100644 index 00000000..e52089e4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/sinh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/shim.js new file mode 100644 index 00000000..4f63b59e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/sinh/shim.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(t(1), 1.1752011936438014, "1"); + a(t(Number.MAX_VALUE), Infinity); + a(t(-Number.MAX_VALUE), -Infinity); + a(t(Number.MIN_VALUE), 5e-324); + a(t(-Number.MIN_VALUE), -5e-324); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/implement.js new file mode 100644 index 00000000..a96bf193 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/tanh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/shim.js new file mode 100644 index 00000000..2c67aaf4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/tanh/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), 1, "Infinity"); + a(t(-Infinity), -1, "-Infinity"); + a(t(1), 0.7615941559557649, "1"); + a(t(Number.MAX_VALUE), 1); + a(t(-Number.MAX_VALUE), -1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/implement.js new file mode 100644 index 00000000..1830e61f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/trunc/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/shim.js new file mode 100644 index 00000000..9e5eed79 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/math/trunc/shim.js @@ -0,0 +1,16 @@ +'use strict'; + +var is = require('../../../object/is'); + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(is(t(0.234), 0), true, "0"); + a(is(t(-0.234), -0), true, "-0"); + a(t(13.7), 13, "Positive #1"); + a(t(12.3), 12, "Positive #2"); + a(t(-12.3), -12, "Negative #1"); + a(t(-14.7), -14, "Negative #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/#/pad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/#/pad.js new file mode 100644 index 00000000..e0208235 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/#/pad.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(78, 4), '0078'); + a(t.call(65.12323, 4, 3), '0065.123', "Precision"); + a(t.call(65, 4, 3), '0065.000', "Precision integer"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/epsilon/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/epsilon/implement.js new file mode 100644 index 00000000..574da75d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/epsilon/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/epsilon/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/epsilon/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/epsilon/index.js new file mode 100644 index 00000000..c892fd47 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/epsilon/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t, 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/epsilon/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/epsilon/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/epsilon/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/implement.js new file mode 100644 index 00000000..b35345fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/is-finite/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/shim.js new file mode 100644 index 00000000..5205d1c2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-finite/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(2), true, "Number"); + a(t('23'), false, "Not numeric"); + a(t(NaN), false, "NaN"); + a(t(Infinity), false, "Infinity"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/implement.js new file mode 100644 index 00000000..127149ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/is-integer/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/shim.js new file mode 100644 index 00000000..3f3985c3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-integer/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(2), true, "Number"); + a(t(2.34), false, "Float"); + a(t('23'), false, "Not numeric"); + a(t(NaN), false, "NaN"); + a(t(Infinity), false, "Infinity"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/implement.js new file mode 100644 index 00000000..2f01d6d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/is-nan/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/shim.js new file mode 100644 index 00000000..425723e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-nan/shim.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(2), false, "Number"); + a(t({}), false, "Not numeric"); + a(t(NaN), true, "NaN"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-number.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-number.js new file mode 100644 index 00000000..27513347 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-number.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(0), true, "Zero"); + a(t(NaN), true, "NaN"); + a(t(Infinity), true, "Infinity"); + a(t(12), true, "Number"); + a(t(false), false, "Boolean"); + a(t(new Date()), false, "Date"); + a(t(new Number(2)), true, "Number object"); + a(t('asdfaf'), false, "String"); + a(t(''), false, "Empty String"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/implement.js new file mode 100644 index 00000000..33667e2e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/is-safe-integer/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/shim.js new file mode 100644 index 00000000..77e06674 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/is-safe-integer/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(2), true, "Number"); + a(t(2.34), false, "Float"); + a(t(Math.pow(2, 53)), false, "Too large"); + a(t(Math.pow(2, 53) - 1), true, "Maximum"); + a(t('23'), false, "Not numeric"); + a(t(NaN), false, "NaN"); + a(t(Infinity), false, "Infinity"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/max-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/max-safe-integer/implement.js new file mode 100644 index 00000000..bef00ca4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/max-safe-integer/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/max-safe-integer/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/max-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/max-safe-integer/index.js new file mode 100644 index 00000000..c892fd47 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/max-safe-integer/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t, 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/max-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/max-safe-integer/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/max-safe-integer/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/min-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/min-safe-integer/implement.js new file mode 100644 index 00000000..fa440248 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/min-safe-integer/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/min-safe-integer/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/min-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/min-safe-integer/index.js new file mode 100644 index 00000000..c892fd47 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/min-safe-integer/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t, 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/min-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/min-safe-integer/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/min-safe-integer/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/to-integer.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/to-integer.js new file mode 100644 index 00000000..ff326ba7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/to-integer.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), 0, "NaN"); + a(t(20), 20, "Positive integer"); + a(t('-20'), -20, "String negative integer"); + a(t(Infinity), Infinity, "Infinity"); + a(t(15.343), 15, "Float"); + a(t(-15.343), -15, "Negative float"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/to-pos-integer.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/to-pos-integer.js new file mode 100644 index 00000000..2f3b4e67 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/to-pos-integer.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), 0, "NaN"); + a(t(20), 20, "Positive integer"); + a(t(-20), 0, "Negative integer"); + a(t(Infinity), Infinity, "Infinity"); + a(t(15.343), 15, "Float"); + a(t(-15.343), 0, "Negative float"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/to-uint32.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/to-uint32.js new file mode 100644 index 00000000..00d05bdf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/number/to-uint32.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), 0, "Not numeric"); + a(t(-4), 4294967292, "Negative"); + a(t(133432), 133432, "Positive"); + a(t(8589934592), 0, "Greater than maximum"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/_iterate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/_iterate.js new file mode 100644 index 00000000..179afed8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/_iterate.js @@ -0,0 +1,30 @@ +'use strict'; + +module.exports = function (t, a) { + var o = { raz: 1, dwa: 2, trzy: 3 } + , o2 = {}, o3 = {}, arr, i = -1; + + t = t('forEach'); + t(o, function (value, name, self, index) { + o2[name] = value; + a(index, ++i, "Index"); + a(self, o, "Self"); + a(this, o3, "Scope"); + }, o3); + a.deep(o2, o); + + arr = []; + o2 = {}; + i = -1; + t(o, function (value, name, self, index) { + arr.push(value); + o2[name] = value; + a(index, ++i, "Index"); + a(self, o, "Self"); + a(this, o3, "Scope"); + }, o3, function (a, b) { + return o[b] - o[a]; + }); + a.deep(o2, o, "Sort by Values: Content"); + a.deep(arr, [3, 2, 1], "Sort by Values: Order"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/implement.js new file mode 100644 index 00000000..40065594 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../object/assign/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/shim.js new file mode 100644 index 00000000..9afe5f65 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/assign/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + var o1 = { a: 1, b: 2 } + , o2 = { b: 3, c: 4 }; + + a(t(o1, o2), o1, "Returns self"); + a.deep(o1, { a: 1, b: 3, c: 4 }, "Single: content"); + + a.deep(t({}, o1, o2), { a: 1, b: 3, c: 4 }, "Multi argument"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/clear.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/clear.js new file mode 100644 index 00000000..bfc08cc2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/clear.js @@ -0,0 +1,13 @@ +'use strict'; + +var isEmpty = require('../../object/is-empty'); + +module.exports = function (t, a) { + var x = {}; + a(t(x), x, "Empty: Returns same object"); + a(isEmpty(x), true, "Empty: Not changed"); + x.foo = 'raz'; + x.bar = 'dwa'; + a(t(x), x, "Same object"); + a(isEmpty(x), true, "Emptied"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/compact.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/compact.js new file mode 100644 index 00000000..9c9064c7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/compact.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}, y = {}, z; + z = t(x); + a.not(z, x, "Returns different object"); + a.deep(z, {}, "Empty on empty"); + + x = { foo: 'bar', a: 0, b: false, c: '', d: '0', e: null, bar: y, + elo: undefined }; + z = t(x); + a.deep(z, { foo: 'bar', a: 0, b: false, c: '', d: '0', bar: y }, + "Cleared null values"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/compare.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/compare.js new file mode 100644 index 00000000..cb942410 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/compare.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var d = new Date(); + + a.ok(t(12, 3) > 0, "Numbers"); + a.ok(t(2, 13) < 0, "Numbers #2"); + a.ok(t("aaa", "aa") > 0, "Strings"); + a.ok(t("aa", "ab") < 0, "Strings #2"); + a(t("aa", "aa"), 0, "Strings same"); + a(t(d, new Date(d.getTime())), 0, "Same date"); + a.ok(t(d, new Date(d.getTime() + 1)) < 0, "Different date"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/copy-deep.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/copy-deep.js new file mode 100644 index 00000000..a4023bc8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/copy-deep.js @@ -0,0 +1,24 @@ +'use strict'; + +var stringify = JSON.stringify; + +module.exports = function (t, a) { + var o = { 1: 'raz', 2: 'dwa', 3: 'trzy' } + , no = t(o); + + a.not(no, o, "Return different object"); + a(stringify(no), stringify(o), "Match properties and values"); + + o = { foo: 'bar', raz: { dwa: 'dwa', + trzy: { cztery: 'pięć', 'sześć': 'siedem' }, osiem: {}, + 'dziewięć': function () { } }, 'dziesięć': 10 }; + o.raz.rec = o; + + no = t(o); + a.not(o.raz, no.raz, "Deep"); + a.not(o.raz.trzy, no.raz.trzy, "Deep #2"); + a(stringify(o.raz.trzy), stringify(no.raz.trzy), "Deep content"); + a(no.raz.rec, no, "Recursive"); + a.not(o.raz.osiem, no.raz.osiem, "Empty object"); + a(o.raz['dziewięć'], no.raz['dziewięć'], "Function"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/copy.js new file mode 100644 index 00000000..2f222ef8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/copy.js @@ -0,0 +1,19 @@ +'use strict'; + +var stringify = JSON.stringify; + +module.exports = function (t, a) { + var o = { 1: 'raz', 2: 'dwa', 3: 'trzy' } + , no = t(o); + + a.not(no, o, "Return different object"); + a(stringify(no), stringify(o), "Match properties and values"); + + o = { foo: 'bar', raz: { dwa: 'dwa', + trzy: { cztery: 'pięć', 'sześć': 'siedem' }, osiem: {}, + 'dziewięć': function () { } }, 'dziesięć': 10 }; + o.raz.rec = o; + + no = t(o); + a(o.raz, no.raz, "Shallow"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/count.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/count.js new file mode 100644 index 00000000..494f4f16 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/count.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), 0, "Empty"); + a(t({ raz: 1, dwa: null, trzy: undefined, cztery: 0 }), 4, + "Some properties"); + a(t(Object.defineProperties({}, { + raz: { value: 'raz' }, + dwa: { value: 'dwa', enumerable: true } + })), 1, "Some properties hidden"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/create.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/create.js new file mode 100644 index 00000000..8b7be214 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/create.js @@ -0,0 +1,22 @@ +'use strict'; + +var setPrototypeOf = require('../../object/set-prototype-of') + + , getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (t, a) { + var x = {}, obj; + + a(getPrototypeOf(t(x)), x, "Normal object"); + a(getPrototypeOf(t(null)), + (setPrototypeOf && setPrototypeOf.nullPolyfill) || null, "Null"); + + a.h1("Properties"); + a.h2("Normal object"); + a(getPrototypeOf(obj = t(x, { foo: { value: 'bar' } })), x, "Prototype"); + a(obj.foo, 'bar', "Property"); + a.h2("Null"); + a(getPrototypeOf(obj = t(null, { foo: { value: 'bar2' } })), + (setPrototypeOf && setPrototypeOf.nullPolyfill) || null, "Prototype"); + a(obj.foo, 'bar2', "Property"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/eq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/eq.js new file mode 100644 index 00000000..02b3f002 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/eq.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var o = {}; + a(t(o, {}), false, "Different objects"); + a(t(o, o), true, "Same objects"); + a(t('1', '1'), true, "Same primitive"); + a(t('1', 1), false, "Different primitive types"); + a(t(NaN, NaN), true, "NaN"); + a(t(0, 0), true, "0,0"); + a(t(0, -0), true, "0,-0"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/every.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/every.js new file mode 100644 index 00000000..07d5bbbd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/every.js @@ -0,0 +1,21 @@ +'use strict'; + +var o = { 1: 1, 2: 2, 3: 3 }; + +module.exports = function (t, a) { + var o2 = {}; + t(o, function (value, name) { + o2[name] = value; + return true; + }); + a(JSON.stringify(o2), JSON.stringify(o), "Iterates"); + + a(t(o, function () { + return true; + }), true, "Succeeds"); + + a(t(o, function () { + return false; + }), false, "Fails"); + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/filter.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/filter.js new file mode 100644 index 00000000..7307da86 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/filter.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t({ 1: 1, 2: 2, 3: 3, 4: 4 }, + function (value) { return Boolean(value % 2); }), { 1: 1, 3: 3 }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/first-key.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/first-key.js new file mode 100644 index 00000000..8169cd23 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/first-key.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}, y = Object.create(null); + a(t(x), null, "Normal: Empty"); + a(t(y), null, "Null extension: Empty"); + x.foo = 'raz'; + x.bar = 343; + a(['foo', 'bar'].indexOf(t(x)) !== -1, true, "Normal"); + y.elo = 'foo'; + y.mar = 'wew'; + a(['elo', 'mar'].indexOf(t(y)) !== -1, true, "Null extension"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/flatten.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/flatten.js new file mode 100644 index 00000000..ca342eab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/flatten.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t({ a: { aa: 1, ab: 2 }, b: { ba: 3, bb: 4 } }), + { aa: 1, ab: 2, ba: 3, bb: 4 }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/for-each.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/for-each.js new file mode 100644 index 00000000..8690d1e8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/for-each.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var o = { raz: 1, dwa: 2, trzy: 3 } + , o2 = {}; + a(t(o, function (value, name) { + o2[name] = value; + }), undefined, "Return"); + a.deep(o2, o); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/get-property-names.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/get-property-names.js new file mode 100644 index 00000000..b91c3dd5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/get-property-names.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function (t, a) { + var o = { first: 1, second: 4 }, r1, r2; + o = Object.create(o, { + third: { value: null } + }); + o.first = 2; + o = Object.create(o); + o.fourth = 3; + + r1 = t(o); + r1.sort(); + r2 = ['first', 'second', 'third', 'fourth'] + .concat(Object.getOwnPropertyNames(Object.prototype)); + r2.sort(); + a.deep(r1, r2); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-array-like.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-array-like.js new file mode 100644 index 00000000..6295973c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-array-like.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + a(t([]), true, "Array"); + a(t(""), true, "String"); + a(t((function () { return arguments; }())), true, "Arguments"); + a(t({ length: 0 }), true, "List object"); + a(t(function () {}), false, "Function"); + a(t({}), false, "Plain object"); + a(t(/raz/), false, "Regexp"); + a(t(), false, "No argument"); + a(t(null), false, "Null"); + a(t(undefined), false, "Undefined"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-callable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-callable.js new file mode 100644 index 00000000..625e221d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-callable.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(function () {}), true, "Function"); + a(t({}), false, "Object"); + a(t(), false, "Undefined"); + a(t(null), false, "Null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-copy-deep.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-copy-deep.js new file mode 100644 index 00000000..4f14cbbe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-copy-deep.js @@ -0,0 +1,46 @@ +'use strict'; + +module.exports = function (t, a) { + var x, y; + + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 3 }), true, "Same"); + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 4 }), false, + "Different property value"); + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2 }), false, + "Property only in source"); + a(t({ 1: 1, 2: 2 }, { 1: 1, 2: 2, 3: 4 }), false, + "Property only in target"); + + a(t("raz", "dwa"), false, "String: diff"); + a(t("raz", "raz"), true, "String: same"); + a(t("32", 32), false, "String & Number"); + + a(t([1, 'raz', true], [1, 'raz', true]), true, "Array: same"); + a(t([1, 'raz', undefined], [1, 'raz']), false, "Array: diff"); + a(t(['foo'], ['one']), false, "Array: One value comparision"); + + x = { foo: { bar: { mar: {} } } }; + y = { foo: { bar: { mar: {} } } }; + a(t(x, y), true, "Deep"); + + a(t({ foo: { bar: { mar: 'foo' } } }, { foo: { bar: { mar: {} } } }), + false, "Deep: false"); + + x = { foo: { bar: { mar: {} } } }; + x.rec = { foo: x }; + + y = { foo: { bar: { mar: {} } } }; + y.rec = { foo: x }; + + a(t(x, y), true, "Object: Infinite Recursion: Same #1"); + + x.rec.foo = y; + a(t(x, y), true, "Object: Infinite Recursion: Same #2"); + + x.rec.foo = x; + y.rec.foo = y; + a(t(x, y), true, "Object: Infinite Recursion: Same #3"); + + y.foo.bar.mar = 'raz'; + a(t(x, y), false, "Object: Infinite Recursion: Diff"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-copy.js new file mode 100644 index 00000000..394e2ed9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-copy.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 3 }), true, "Same"); + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 4 }), false, + "Different property value"); + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2 }), false, + "Property only in source"); + a(t({ 1: 1, 2: 2 }, { 1: 1, 2: 2, 3: 4 }), false, + "Property only in target"); + + a(t("raz", "dwa"), false, "String: diff"); + a(t("raz", "raz"), true, "String: same"); + a(t("32", 32), false, "String & Number"); + + a(t([1, 'raz', true], [1, 'raz', true]), true, "Array: same"); + a(t([1, 'raz', undefined], [1, 'raz']), false, "Array: diff"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-empty.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-empty.js new file mode 100644 index 00000000..b560c2c3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-empty.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), true, "Empty"); + a(t({ 1: 1 }), false, "Not empty"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-object.js new file mode 100644 index 00000000..72c8aa6d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-object.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + a(t('arar'), false, "String"); + a(t(12), false, "Number"); + a(t(true), false, "Boolean"); + a(t(null), false, "Null"); + a(t(new Date()), true, "Date"); + a(t(new String('raz')), true, "String object"); + a(t({}), true, "Plain object"); + a(t(/a/), true, "Regular expression"); + a(t(function () {}), true, "Function"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-plain-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-plain-object.js new file mode 100644 index 00000000..e988829d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is-plain-object.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), true, "Empty {} is plain object"); + a(t({ a: true }), true, "{} with property is plain object"); + a(t({ prototype: 1, constructor: 2, __proto__: 3 }), true, + "{} with any property keys is plain object"); + a(t(null), false, "Null is not plain object"); + a(t('string'), false, "Primitive is not plain object"); + a(t(function () {}), false, "Function is not plain object"); + a(t(Object.create({})), false, + "Object whose prototype is not Object.prototype is not plain object"); + a(t(Object.create(Object.prototype)), true, + "Object whose prototype is Object.prototype is plain object"); + a(t(Object.create(null)), true, + "Object whose prototype is null is plain object"); + a(t(Object.prototype), false, "Object.prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is.js new file mode 100644 index 00000000..4f8948cb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/is.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var o = {}; + a(t(o, {}), false, "Different objects"); + a(t(o, o), true, "Same objects"); + a(t('1', '1'), true, "Same primitive"); + a(t('1', 1), false, "Different primitive types"); + a(t(NaN, NaN), true, "NaN"); + a(t(0, 0), true, "0,0"); + a(t(0, -0), false, "0,-0"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/key-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/key-of.js new file mode 100644 index 00000000..a9225a04 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/key-of.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}, y = {} + , o = { foo: 'bar', raz: x, trzy: 'cztery', five: '6' }; + + a(t(o, 'bar'), 'foo', "First property"); + a(t(o, 6), null, "Primitive that's not there"); + a(t(o, x), 'raz', "Object"); + a(t(o, y), null, "Object that's not there"); + a(t(o, '6'), 'five', "Last property"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/implement.js new file mode 100644 index 00000000..179e1e56 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../object/keys/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/shim.js new file mode 100644 index 00000000..ed29eebc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/keys/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t({ foo: 'bar' }), ['foo'], "Object"); + a.deep(t('raz'), ['0', '1', '2'], "Primitive"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Undefined"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/map-keys.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/map-keys.js new file mode 100644 index 00000000..be84825b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/map-keys.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t({ 1: 1, 2: 2, 3: 3 }, function (key, value) { + return 'x' + (key + value); + }), { x11: 1, x22: 2, x33: 3 }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/map.js new file mode 100644 index 00000000..f9cc09c0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/map.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + var obj = { 1: 1, 2: 2, 3: 3 }; + a.deep(t(obj, function (value, key, context) { + a(context, obj, "Context argument"); + return (value + 1) + key; + }), { 1: '21', 2: '32', 3: '43' }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/mixin-prototypes.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/mixin-prototypes.js new file mode 100644 index 00000000..d1c727a9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/mixin-prototypes.js @@ -0,0 +1,67 @@ +'use strict'; + +module.exports = function (t, a) { + var o, o1, o2, x, y = {}, z = {}; + o = { inherited: true, visible: 23 }; + o1 = Object.create(o); + o1.visible = z; + o1.nonremovable = 'raz'; + Object.defineProperty(o1, 'hidden', { value: 'hidden' }); + + o2 = Object.defineProperties({}, { nonremovable: { value: y } }); + o2.other = 'other'; + + try { t(o2, o1); } catch (ignore) {} + + a(o2.visible, z, "Enumerable"); + a(o1.hidden, 'hidden', "Not Enumerable"); + a(o2.propertyIsEnumerable('visible'), true, "Enumerable is enumerable"); + a(o2.propertyIsEnumerable('hidden'), false, + "Not enumerable is not enumerable"); + + a(o2.inherited, true, "Extend deep"); + + a(o2.nonremovable, y, "Do not overwrite non configurable"); + a(o2.other, 'other', "Own kept"); + + x = {}; + t(x, o2); + try { t(x, o1); } catch (ignore) {} + + a(x.visible, z, "Enumerable"); + a(x.hidden, 'hidden', "Not Enumerable"); + a(x.propertyIsEnumerable('visible'), true, "Enumerable is enumerable"); + a(x.propertyIsEnumerable('hidden'), false, + "Not enumerable is not enumerable"); + + a(x.inherited, true, "Extend deep"); + + a(x.nonremovable, y, "Ignored non configurable"); + a(x.other, 'other', "Other"); + + x.visible = 3; + a(x.visible, 3, "Writable is writable"); + + x = {}; + t(x, o1); + a.throws(function () { + x.hidden = 3; + }, "Not writable is not writable"); + + x = {}; + t(x, o1); + delete x.visible; + a.ok(!x.hasOwnProperty('visible'), "Configurable is configurable"); + + x = {}; + t(x, o1); + a.throws(function () { + delete x.hidden; + }, "Not configurable is not configurable"); + + x = Object.defineProperty({}, 'foo', + { configurable: false, writable: true, enumerable: false, value: 'bar' }); + + try { t(x, { foo: 'lorem' }); } catch (ignore) {} + a(x.foo, 'bar', "Writable, not enumerable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/mixin.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/mixin.js new file mode 100644 index 00000000..866005b0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/mixin.js @@ -0,0 +1,69 @@ +'use strict'; + +module.exports = function (t, a) { + var o, o1, o2, x, y = {}, z = {}; + o = { inherited: true }; + o1 = Object.create(o); + o1.visible = z; + o1.nonremovable = 'raz'; + Object.defineProperty(o1, 'hidden', { value: 'hidden' }); + + o2 = Object.defineProperties({}, { nonremovable: { value: y } }); + o2.other = 'other'; + + try { t(o2, o1); } catch (ignore) {} + + a(o2.visible, z, "Enumerable"); + a(o1.hidden, 'hidden', "Not Enumerable"); + a(o2.propertyIsEnumerable('visible'), true, "Enumerable is enumerable"); + a(o2.propertyIsEnumerable('hidden'), false, + "Not enumerable is not enumerable"); + + a(o2.hasOwnProperty('inherited'), false, "Extend only own"); + a(o2.inherited, undefined, "Extend ony own: value"); + + a(o2.nonremovable, y, "Do not overwrite non configurable"); + a(o2.other, 'other', "Own kept"); + + x = {}; + t(x, o2); + try { t(x, o1); } catch (ignore) {} + + a(x.visible, z, "Enumerable"); + a(x.hidden, 'hidden', "Not Enumerable"); + a(x.propertyIsEnumerable('visible'), true, "Enumerable is enumerable"); + a(x.propertyIsEnumerable('hidden'), false, + "Not enumerable is not enumerable"); + + a(x.hasOwnProperty('inherited'), false, "Extend only own"); + a(x.inherited, undefined, "Extend ony own: value"); + + a(x.nonremovable, y, "Ignored non configurable"); + a(x.other, 'other', "Other"); + + x.visible = 3; + a(x.visible, 3, "Writable is writable"); + + x = {}; + t(x, o1); + a.throws(function () { + x.hidden = 3; + }, "Not writable is not writable"); + + x = {}; + t(x, o1); + delete x.visible; + a.ok(!x.hasOwnProperty('visible'), "Configurable is configurable"); + + x = {}; + t(x, o1); + a.throws(function () { + delete x.hidden; + }, "Not configurable is not configurable"); + + x = Object.defineProperty({}, 'foo', + { configurable: false, writable: true, enumerable: false, value: 'bar' }); + + try { t(x, { foo: 'lorem' }); } catch (ignore) {} + a(x.foo, 'bar', "Writable, not enumerable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/normalize-options.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/normalize-options.js new file mode 100644 index 00000000..0d2d4da0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/normalize-options.js @@ -0,0 +1,32 @@ +'use strict'; + +var create = Object.create, defineProperty = Object.defineProperty; + +module.exports = function (t, a) { + var x = { foo: 'raz', bar: 'dwa' }, y; + y = t(x); + a.not(y, x, "Returns copy"); + a.deep(y, x, "Plain"); + + x = { raz: 'one', dwa: 'two' }; + defineProperty(x, 'get', { + configurable: true, + enumerable: true, + get: function () { return this.dwa; } + }); + x = create(x); + x.trzy = 'three'; + x.cztery = 'four'; + x = create(x); + x.dwa = 'two!'; + x.trzy = 'three!'; + x.piec = 'five'; + x.szesc = 'six'; + + a.deep(t(x), { raz: 'one', dwa: 'two!', trzy: 'three!', cztery: 'four', + piec: 'five', szesc: 'six', get: 'two!' }, "Deep object"); + + a.deep(t({ marko: 'raz', raz: 'foo' }, x, { szesc: 'elo', siedem: 'bibg' }), + { marko: 'raz', raz: 'one', dwa: 'two!', trzy: 'three!', cztery: 'four', + piec: 'five', szesc: 'elo', siedem: 'bibg', get: 'two!' }, "Multiple options"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/primitive-set.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/primitive-set.js new file mode 100644 index 00000000..839857ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/primitive-set.js @@ -0,0 +1,15 @@ +'use strict'; + +var getPropertyNames = require('../../object/get-property-names') + , isPlainObject = require('../../object/is-plain-object'); + +module.exports = function (t, a) { + var x = t(); + a(isPlainObject(x), true, "Plain object"); + a.deep(getPropertyNames(x), [], "No properties"); + x.foo = 'bar'; + a.deep(getPropertyNames(x), ['foo'], "Extensible"); + + a.deep(t('raz', 'dwa', 3), { raz: true, dwa: true, 3: true }, + "Arguments handling"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/safe-traverse.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/safe-traverse.js new file mode 100644 index 00000000..d30cdefe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/safe-traverse.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var obj = { foo: { bar: { lorem: 12 } } }; + a(t(obj), obj, "No props"); + a(t(obj, 'foo'), obj.foo, "One"); + a(t(obj, 'raz'), undefined, "One: Fail"); + a(t(obj, 'foo', 'bar'), obj.foo.bar, "Two"); + a(t(obj, 'dsd', 'raz'), undefined, "Two: Fail #1"); + a(t(obj, 'foo', 'raz'), undefined, "Two: Fail #2"); + a(t(obj, 'foo', 'bar', 'lorem'), obj.foo.bar.lorem, "Three"); + a(t(obj, 'dsd', 'raz', 'fef'), undefined, "Three: Fail #1"); + a(t(obj, 'foo', 'raz', 'asdf'), undefined, "Three: Fail #2"); + a(t(obj, 'foo', 'bar', 'asd'), undefined, "Three: Fail #3"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/serialize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/serialize.js new file mode 100644 index 00000000..43eed6a8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/serialize.js @@ -0,0 +1,25 @@ +'use strict'; + +module.exports = function (t, a) { + var fn = function (raz, dwa) { return raz + dwa; }; + a(t(), 'undefined', "Undefined"); + a(t(null), 'null', "Null"); + a(t(null), 'null', "Null"); + a(t('raz'), '"raz"', "String"); + a(t('raz"ddwa\ntrzy'), '"raz\\"ddwa\\ntrzy"', "String with escape"); + a(t(false), 'false', "Booelean"); + a(t(fn), String(fn), "Function"); + + a(t(/raz-dwa/g), '/raz-dwa/g', "RegExp"); + a(t(new Date(1234567)), 'new Date(1234567)', "Date"); + a(t([]), '[]', "Empty array"); + a(t([undefined, false, null, 'raz"ddwa\ntrzy', fn, /raz/g, new Date(1234567), ['foo']]), + '[undefined,false,null,"raz\\"ddwa\\ntrzy",' + String(fn) + + ',/raz/g,new Date(1234567),["foo"]]', "Rich Array"); + a(t({}), '{}', "Empty object"); + a(t({ raz: undefined, dwa: false, trzy: null, cztery: 'raz"ddwa\ntrzy', piec: fn, szesc: /raz/g, + siedem: new Date(1234567), osiem: ['foo', 32], dziewiec: { foo: 'bar', dwa: 343 } }), + '{"raz":undefined,"dwa":false,"trzy":null,"cztery":"raz\\"ddwa\\ntrzy","piec":' + String(fn) + + ',"szesc":/raz/g,"siedem":new Date(1234567),"osiem":["foo",32],' + + '"dziewiec":{"foo":"bar","dwa":343}}', "Rich object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/implement.js new file mode 100644 index 00000000..30b2ac4b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +var create = require('../../../object/create') + , isImplemented = require('../../../object/set-prototype-of/is-implemented'); + +module.exports = function (a) { a(isImplemented(create), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/index.js new file mode 100644 index 00000000..aec2605c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var create = require('../../../object/create') + + , getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (t, a) { + var x = {}, y = {}; + + if (t === null) return; + a(t(x, y), x, "Return self object"); + a(getPrototypeOf(x), y, "Object"); + a.throws(function () { t(x); }, TypeError, "Undefined"); + a.throws(function () { t('foo'); }, TypeError, "Primitive"); + a(getPrototypeOf(t(x, null)), t.nullPolyfill || null, "Null"); + x = create(null); + a.h1("Change null prototype"); + a(t(x, y), x, "Result"); + a(getPrototypeOf(x), y, "Prototype"); + a.h1("Set null prototype"); + a(t(y, null), y, "Result"); + a(getPrototypeOf(y), t.nullPolyfill || null, "Prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js new file mode 100644 index 00000000..aec2605c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js @@ -0,0 +1,23 @@ +'use strict'; + +var create = require('../../../object/create') + + , getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (t, a) { + var x = {}, y = {}; + + if (t === null) return; + a(t(x, y), x, "Return self object"); + a(getPrototypeOf(x), y, "Object"); + a.throws(function () { t(x); }, TypeError, "Undefined"); + a.throws(function () { t('foo'); }, TypeError, "Primitive"); + a(getPrototypeOf(t(x, null)), t.nullPolyfill || null, "Null"); + x = create(null); + a.h1("Change null prototype"); + a(t(x, y), x, "Result"); + a(getPrototypeOf(x), y, "Prototype"); + a.h1("Set null prototype"); + a(t(y, null), y, "Result"); + a(getPrototypeOf(y), t.nullPolyfill || null, "Prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/some.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/some.js new file mode 100644 index 00000000..490431e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/some.js @@ -0,0 +1,23 @@ +'use strict'; + +var o = { 1: 1, 2: 2, 3: 3 }; + +module.exports = function (t, a) { + var o2 = {}, i = 0; + t(o, function (value, name) { + o2[name] = value; + return false; + }); + a(JSON.stringify(o2), JSON.stringify(o), "Iterates"); + + a(t(o, function () { + ++i; + return true; + }), true, "Succeeds"); + a(i, 1, "Stops iteration after condition is met"); + + a(t(o, function () { + return false; + }), false, "Fails"); + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/to-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/to-array.js new file mode 100644 index 00000000..1f4beef7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/to-array.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var o = { 1: 1, 2: 2, 3: 3 }, o1 = {} + , o2 = t(o, function (value, name, self) { + a(self, o, "Self"); + a(this, o1, "Scope"); + return value + Number(name); + }, o1); + a.deep(o2, [2, 4, 6]); + + t(o).sort().forEach(function (item) { + a.deep(item, [item[0], o[item[0]]], "Default"); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/unserialize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/unserialize.js new file mode 100644 index 00000000..405eef11 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/unserialize.js @@ -0,0 +1,24 @@ +'use strict'; + +module.exports = function (t, a) { + var fn = function (raz, dwa) { return raz + dwa; }; + a(t('undefined'), undefined, "Undefined"); + a(t('null'), null, "Null"); + a(t('"raz"'), 'raz', "String"); + a(t('"raz\\"ddwa\\ntrzy"'), 'raz"ddwa\ntrzy', "String with escape"); + a(t('false'), false, "Booelean"); + a(String(t(String(fn))), String(fn), "Function"); + + a.deep(t('/raz-dwa/g'), /raz-dwa/g, "RegExp"); + a.deep(t('new Date(1234567)'), new Date(1234567), "Date"); + a.deep(t('[]'), [], "Empty array"); + a.deep(t('[undefined,false,null,"raz\\"ddwa\\ntrzy",/raz/g,new Date(1234567),["foo"]]'), + [undefined, false, null, 'raz"ddwa\ntrzy', /raz/g, new Date(1234567), ['foo']], "Rich Array"); + a.deep(t('{}'), {}, "Empty object"); + a.deep(t('{"raz":undefined,"dwa":false,"trzy":null,"cztery":"raz\\"ddwa\\ntrzy",' + + '"szesc":/raz/g,"siedem":new Date(1234567),"osiem":["foo",32],' + + '"dziewiec":{"foo":"bar","dwa":343}}'), + { raz: undefined, dwa: false, trzy: null, cztery: 'raz"ddwa\ntrzy', szesc: /raz/g, + siedem: new Date(1234567), osiem: ['foo', 32], dziewiec: { foo: 'bar', dwa: 343 } }, + "Rich object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/valid-callable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/valid-callable.js new file mode 100644 index 00000000..b40540b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/valid-callable.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + var f = function () {}; + a(t(f), f, "Function"); + a.throws(function () { + t({}); + }, "Not Function"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/valid-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/valid-object.js new file mode 100644 index 00000000..eaa8e7bc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/valid-object.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a.throws(function () { t(''); }, TypeError, "''"); + a(t(x = {}), x, "Object"); + a(t(x = function () {}), x, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + a(t(x = new Date()), x, "Date"); + + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/valid-value.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/valid-value.js new file mode 100644 index 00000000..f1eeafa9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/valid-value.js @@ -0,0 +1,19 @@ +'use strict'; + +var numIsNaN = require('../../number/is-nan'); + +module.exports = function (t, a) { + var x; + a(t(0), 0, "0"); + a(t(false), false, "false"); + a(t(''), '', "''"); + a(numIsNaN(t(NaN)), true, "NaN"); + a(t(x = {}), x, "{}"); + + a.throws(function () { + t(); + }, "Undefined"); + a.throws(function () { + t(null); + }, "null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-array-like-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-array-like-object.js new file mode 100644 index 00000000..2f3e31b4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-array-like-object.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a.throws(function () { t(''); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Plain Object"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + + a(t(x = { length: 1 }), x, "Array like"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-array-like.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-array-like.js new file mode 100644 index 00000000..53bd1124 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-array-like.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a(t(''), '', "''"); + a.throws(function () { t({}); }, TypeError, "Plain Object"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + + a(t(x = { length: 1 }), x, "Array like"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-stringifiable-value.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-stringifiable-value.js new file mode 100644 index 00000000..ae9bd17a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-stringifiable-value.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a(t(0), "0"); + a(t(false), "false"); + a(t(''), ""); + a(t({}), String({}), "Object"); + a(t(x = function () {}), String(x), "Function"); + a(t(x = new String('raz')), String(x), "String object"); //jslint: ignore + a(t(x = new Date()), String(x), "Date"); + + a.throws(function () { t(Object.create(null)); }, TypeError, "Null prototype object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-stringifiable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-stringifiable.js new file mode 100644 index 00000000..4a46bb52 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/object/validate-stringifiable.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a(t(), 'undefined', "Undefined"); + a(t(null), 'null', "Null"); + a(t(0), "0"); + a(t(false), "false"); + a(t(''), ""); + a(t({}), String({}), "Object"); + a(t(x = function () {}), String(x), "Function"); + a(t(x = new String('raz')), String(x), "String object"); //jslint: ignore + a(t(x = new Date()), String(x), "Date"); + + a.throws(function () { t(Object.create(null)); }, TypeError, "Null prototype object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/index.js new file mode 100644 index 00000000..ca2bd650 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var indexTest = require('tad/lib/utils/index-test') + + , path = require('path').resolve(__dirname, '../../../reg-exp/#'); + +module.exports = function (t, a, d) { + indexTest(indexTest.readDir(path).aside(function (data) { + delete data.sticky; + delete data.unicode; + }))(t, a, d); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/is-sticky.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/is-sticky.js new file mode 100644 index 00000000..e154ac29 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/is-sticky.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var re; + a(t.call(/raz/), false, "Normal"); + a(t.call(/raz/g), false, "Global"); + try { re = new RegExp('raz', 'y'); } catch (ignore) {} + if (!re) return; + a(t.call(re), true, "Sticky"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/is-unicode.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/is-unicode.js new file mode 100644 index 00000000..2ffb9e86 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/is-unicode.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var re; + a(t.call(/raz/), false, "Normal"); + a(t.call(/raz/g), false, "Global"); + try { re = new RegExp('raz', 'u'); } catch (ignore) {} + if (!re) return; + a(t.call(re), true, "Unicode"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/implement.js new file mode 100644 index 00000000..89825a45 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/match/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/shim.js new file mode 100644 index 00000000..5249139f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/match/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + var result = ['foo']; + result.index = 0; + result.input = 'foobar'; + a.deep(t.call(/foo/, 'foobar'), result); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/implement.js new file mode 100644 index 00000000..c32b23a6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/replace/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/shim.js new file mode 100644 index 00000000..2b378fd5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/replace/shim.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(/foo/, 'foobar', 'mar'), 'marbar'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/implement.js new file mode 100644 index 00000000..ff1b8087 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/search/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/shim.js new file mode 100644 index 00000000..596bcdb9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/search/shim.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(/foo/, 'barfoo'), 3); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/implement.js new file mode 100644 index 00000000..1cee4418 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/split/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/shim.js new file mode 100644 index 00000000..6a95cd03 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/split/shim.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t.call(/\|/, 'bar|foo'), ['bar', 'foo']); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/sticky/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/sticky/implement.js new file mode 100644 index 00000000..d94e7b98 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/sticky/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/sticky/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/sticky/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/sticky/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/sticky/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/unicode/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/unicode/implement.js new file mode 100644 index 00000000..9b1aa0f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/unicode/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/unicode/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/unicode/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/unicode/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/#/unicode/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/escape.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/escape.js new file mode 100644 index 00000000..5b00f67f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/escape.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + var str = "(?:^te|er)s{2}t\\[raz]+$"; + a(RegExp('^' + t(str) + '$').test(str), true); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/is-reg-exp.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/is-reg-exp.js new file mode 100644 index 00000000..785ca28c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/is-reg-exp.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + a(t('arar'), false, "String"); + a(t(12), false, "Number"); + a(t(true), false, "Boolean"); + a(t(new Date()), false, "Date"); + a(t(new String('raz')), false, "String object"); + a(t({}), false, "Plain object"); + a(t(/a/), true, "Regular expression"); + a(t(new RegExp('a')), true, "Regular expression via constructor"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/valid-reg-exp.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/valid-reg-exp.js new file mode 100644 index 00000000..cd12cf12 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/reg-exp/valid-reg-exp.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + var r = /raz/; + a(t(r), r, "Direct"); + r = new RegExp('foo'); + a(t(r), r, "Constructor"); + a.throws(function () { + t({}); + }, "Object"); + a.throws(function () { + t(function () {}); + }, "Function"); + a.throws(function () { + t({ exec: function () { return 20; } }); + }, "Plain object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/implement.js new file mode 100644 index 00000000..09bf3361 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/@@iterator/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/shim.js new file mode 100644 index 00000000..3b0e0b75 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/@@iterator/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + var it = t.call('r💩z'); + a.deep(it.next(), { done: false, value: 'r' }, "#1"); + a.deep(it.next(), { done: false, value: '💩' }, "#2"); + a.deep(it.next(), { done: false, value: 'z' }, "#3"); + a.deep(it.next(), { done: true, value: undefined }, "End"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/at.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/at.js new file mode 100644 index 00000000..2447a9f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/at.js @@ -0,0 +1,97 @@ +// See tests at https://github.com/mathiasbynens/String.prototype.at + +'use strict'; + +module.exports = function (t, a) { + a(t.length, 1, "Length"); + + a.h1("BMP"); + a(t.call('abc\uD834\uDF06def', -Infinity), '', "-Infinity"); + a(t.call('abc\uD834\uDF06def', -1), '', "-1"); + a(t.call('abc\uD834\uDF06def', -0), 'a', "-0"); + a(t.call('abc\uD834\uDF06def', +0), 'a', "+0"); + a(t.call('abc\uD834\uDF06def', 1), 'b', "1"); + a(t.call('abc\uD834\uDF06def', 3), '\uD834\uDF06', "3"); + a(t.call('abc\uD834\uDF06def', 4), '\uDF06', "4"); + a(t.call('abc\uD834\uDF06def', 5), 'd', "5"); + a(t.call('abc\uD834\uDF06def', 42), '', "42"); + a(t.call('abc\uD834\uDF06def', +Infinity), '', "+Infinity"); + a(t.call('abc\uD834\uDF06def', null), 'a', "null"); + a(t.call('abc\uD834\uDF06def', undefined), 'a', "undefined"); + a(t.call('abc\uD834\uDF06def'), 'a', "No argument"); + a(t.call('abc\uD834\uDF06def', false), 'a', "false"); + a(t.call('abc\uD834\uDF06def', NaN), 'a', "NaN"); + a(t.call('abc\uD834\uDF06def', ''), 'a', "Empty string"); + a(t.call('abc\uD834\uDF06def', '_'), 'a', "_"); + a(t.call('abc\uD834\uDF06def', '1'), 'b', "'1'"); + a(t.call('abc\uD834\uDF06def', []), 'a', "[]"); + a(t.call('abc\uD834\uDF06def', {}), 'a', "{}"); + a(t.call('abc\uD834\uDF06def', -0.9), 'a', "-0.9"); + a(t.call('abc\uD834\uDF06def', 1.9), 'b', "1.9"); + a(t.call('abc\uD834\uDF06def', 7.9), 'f', "7.9"); + a(t.call('abc\uD834\uDF06def', Math.pow(2, 32)), '', "Big number"); + + a.h1("Astral symbol"); + a(t.call('\uD834\uDF06def', -Infinity), '', "-Infinity"); + a(t.call('\uD834\uDF06def', -1), '', "-1"); + a(t.call('\uD834\uDF06def', -0), '\uD834\uDF06', "-0"); + a(t.call('\uD834\uDF06def', +0), '\uD834\uDF06', "+0"); + a(t.call('\uD834\uDF06def', 1), '\uDF06', "1"); + a(t.call('\uD834\uDF06def', 2), 'd', "2"); + a(t.call('\uD834\uDF06def', 3), 'e', "3"); + a(t.call('\uD834\uDF06def', 4), 'f', "4"); + a(t.call('\uD834\uDF06def', 42), '', "42"); + a(t.call('\uD834\uDF06def', +Infinity), '', "+Infinity"); + a(t.call('\uD834\uDF06def', null), '\uD834\uDF06', "null"); + a(t.call('\uD834\uDF06def', undefined), '\uD834\uDF06', "undefined"); + a(t.call('\uD834\uDF06def'), '\uD834\uDF06', "No arguments"); + a(t.call('\uD834\uDF06def', false), '\uD834\uDF06', "false"); + a(t.call('\uD834\uDF06def', NaN), '\uD834\uDF06', "NaN"); + a(t.call('\uD834\uDF06def', ''), '\uD834\uDF06', "Empty string"); + a(t.call('\uD834\uDF06def', '_'), '\uD834\uDF06', "_"); + a(t.call('\uD834\uDF06def', '1'), '\uDF06', "'1'"); + + a.h1("Lone high surrogates"); + a(t.call('\uD834abc', -Infinity), '', "-Infinity"); + a(t.call('\uD834abc', -1), '', "-1"); + a(t.call('\uD834abc', -0), '\uD834', "-0"); + a(t.call('\uD834abc', +0), '\uD834', "+0"); + a(t.call('\uD834abc', 1), 'a', "1"); + a(t.call('\uD834abc', 42), '', "42"); + a(t.call('\uD834abc', +Infinity), '', "Infinity"); + a(t.call('\uD834abc', null), '\uD834', "null"); + a(t.call('\uD834abc', undefined), '\uD834', "undefined"); + a(t.call('\uD834abc'), '\uD834', "No arguments"); + a(t.call('\uD834abc', false), '\uD834', "false"); + a(t.call('\uD834abc', NaN), '\uD834', "NaN"); + a(t.call('\uD834abc', ''), '\uD834', "Empty string"); + a(t.call('\uD834abc', '_'), '\uD834', "_"); + a(t.call('\uD834abc', '1'), 'a', "'a'"); + + a.h1("Lone low surrogates"); + a(t.call('\uDF06abc', -Infinity), '', "-Infinity"); + a(t.call('\uDF06abc', -1), '', "-1"); + a(t.call('\uDF06abc', -0), '\uDF06', "-0"); + a(t.call('\uDF06abc', +0), '\uDF06', "+0"); + a(t.call('\uDF06abc', 1), 'a', "1"); + a(t.call('\uDF06abc', 42), '', "42"); + a(t.call('\uDF06abc', +Infinity), '', "+Infinity"); + a(t.call('\uDF06abc', null), '\uDF06', "null"); + a(t.call('\uDF06abc', undefined), '\uDF06', "undefined"); + a(t.call('\uDF06abc'), '\uDF06', "No arguments"); + a(t.call('\uDF06abc', false), '\uDF06', "false"); + a(t.call('\uDF06abc', NaN), '\uDF06', "NaN"); + a(t.call('\uDF06abc', ''), '\uDF06', "Empty string"); + a(t.call('\uDF06abc', '_'), '\uDF06', "_"); + a(t.call('\uDF06abc', '1'), 'a', "'1'"); + + a.h1("Context"); + a.throws(function () { t.call(undefined); }, TypeError, "Undefined"); + a.throws(function () { t.call(undefined, 4); }, TypeError, + "Undefined + argument"); + a.throws(function () { t.call(null); }, TypeError, "Null"); + a.throws(function () { t.call(null, 4); }, TypeError, "Null + argument"); + a(t.call(42, 0), '4', "Number #1"); + a(t.call(42, 1), '2', "Number #2"); + a(t.call({ toString: function () { return 'abc'; } }, 2), 'c', "Object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/camel-to-hyphen.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/camel-to-hyphen.js new file mode 100644 index 00000000..8b47a815 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/camel-to-hyphen.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('razDwaTRzy4yFoo45My'), 'raz-dwa-t-rzy4y-foo45-my'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/capitalize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/capitalize.js new file mode 100644 index 00000000..fa11ff8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/capitalize.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('raz'), 'Raz', "Word"); + a(t.call('BLA'), 'BLA', "Uppercase"); + a(t.call(''), '', "Empty"); + a(t.call('a'), 'A', "One letter"); + a(t.call('this is a test'), 'This is a test', "Sentence"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/case-insensitive-compare.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/case-insensitive-compare.js new file mode 100644 index 00000000..01a90c39 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/case-insensitive-compare.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call("AA", "aa"), 0, "Same"); + a.ok(t.call("Amber", "zebra") < 0, "Less"); + a.ok(t.call("Zebra", "amber") > 0, "Greater"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/implement.js new file mode 100644 index 00000000..5e33cd71 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +var isImplemented = + require('../../../../string/#/code-point-at/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/shim.js new file mode 100644 index 00000000..0df4751c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/code-point-at/shim.js @@ -0,0 +1,81 @@ +// Taken from: https://github.com/mathiasbynens/String.prototype.codePointAt +// /blob/master/tests/tests.js + +'use strict'; + +module.exports = function (t, a) { + a(t.length, 1, "Length"); + + // String that starts with a BMP symbol + a(t.call('abc\uD834\uDF06def', ''), 0x61); + a(t.call('abc\uD834\uDF06def', '_'), 0x61); + a(t.call('abc\uD834\uDF06def'), 0x61); + a(t.call('abc\uD834\uDF06def', -Infinity), undefined); + a(t.call('abc\uD834\uDF06def', -1), undefined); + a(t.call('abc\uD834\uDF06def', -0), 0x61); + a(t.call('abc\uD834\uDF06def', 0), 0x61); + a(t.call('abc\uD834\uDF06def', 3), 0x1D306); + a(t.call('abc\uD834\uDF06def', 4), 0xDF06); + a(t.call('abc\uD834\uDF06def', 5), 0x64); + a(t.call('abc\uD834\uDF06def', 42), undefined); + a(t.call('abc\uD834\uDF06def', Infinity), undefined); + a(t.call('abc\uD834\uDF06def', Infinity), undefined); + a(t.call('abc\uD834\uDF06def', NaN), 0x61); + a(t.call('abc\uD834\uDF06def', false), 0x61); + a(t.call('abc\uD834\uDF06def', null), 0x61); + a(t.call('abc\uD834\uDF06def', undefined), 0x61); + + // String that starts with an astral symbol + a(t.call('\uD834\uDF06def', ''), 0x1D306); + a(t.call('\uD834\uDF06def', '1'), 0xDF06); + a(t.call('\uD834\uDF06def', '_'), 0x1D306); + a(t.call('\uD834\uDF06def'), 0x1D306); + a(t.call('\uD834\uDF06def', -1), undefined); + a(t.call('\uD834\uDF06def', -0), 0x1D306); + a(t.call('\uD834\uDF06def', 0), 0x1D306); + a(t.call('\uD834\uDF06def', 1), 0xDF06); + a(t.call('\uD834\uDF06def', 42), undefined); + a(t.call('\uD834\uDF06def', false), 0x1D306); + a(t.call('\uD834\uDF06def', null), 0x1D306); + a(t.call('\uD834\uDF06def', undefined), 0x1D306); + + // Lone high surrogates + a(t.call('\uD834abc', ''), 0xD834); + a(t.call('\uD834abc', '_'), 0xD834); + a(t.call('\uD834abc'), 0xD834); + a(t.call('\uD834abc', -1), undefined); + a(t.call('\uD834abc', -0), 0xD834); + a(t.call('\uD834abc', 0), 0xD834); + a(t.call('\uD834abc', false), 0xD834); + a(t.call('\uD834abc', NaN), 0xD834); + a(t.call('\uD834abc', null), 0xD834); + a(t.call('\uD834abc', undefined), 0xD834); + + // Lone low surrogates + a(t.call('\uDF06abc', ''), 0xDF06); + a(t.call('\uDF06abc', '_'), 0xDF06); + a(t.call('\uDF06abc'), 0xDF06); + a(t.call('\uDF06abc', -1), undefined); + a(t.call('\uDF06abc', -0), 0xDF06); + a(t.call('\uDF06abc', 0), 0xDF06); + a(t.call('\uDF06abc', false), 0xDF06); + a(t.call('\uDF06abc', NaN), 0xDF06); + a(t.call('\uDF06abc', null), 0xDF06); + a(t.call('\uDF06abc', undefined), 0xDF06); + + a.throws(function () { t.call(undefined); }, TypeError); + a.throws(function () { t.call(undefined, 4); }, TypeError); + a.throws(function () { t.call(null); }, TypeError); + a.throws(function () { t.call(null, 4); }, TypeError); + a(t.call(42, 0), 0x34); + a(t.call(42, 1), 0x32); + a(t.call({ toString: function () { return 'abc'; } }, 2), 0x63); + + a.throws(function () { t.apply(undefined); }, TypeError); + a.throws(function () { t.apply(undefined, [4]); }, TypeError); + a.throws(function () { t.apply(null); }, TypeError); + a.throws(function () { t.apply(null, [4]); }, TypeError); + a(t.apply(42, [0]), 0x34); + a(t.apply(42, [1]), 0x32); + a(t.apply({ toString: function () { return 'abc'; } }, [2]), 0x63); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/implement.js new file mode 100644 index 00000000..220f50d4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/contains/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/shim.js new file mode 100644 index 00000000..a0ea4db2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/contains/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('raz', ''), true, "Empty"); + a(t.call('', ''), true, "Both Empty"); + a(t.call('raz', 'raz'), true, "Same"); + a(t.call('razdwa', 'raz'), true, "Starts with"); + a(t.call('razdwa', 'dwa'), true, "Ends with"); + a(t.call('razdwa', 'zdw'), true, "In middle"); + a(t.call('', 'raz'), false, "Something in empty"); + a(t.call('az', 'raz'), false, "Longer"); + a(t.call('azasdfasdf', 'azff'), false, "Not found"); + a(t.call('razdwa', 'raz', 1), false, "Position"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/implement.js new file mode 100644 index 00000000..93bd2ddc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/ends-with/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/shim.js new file mode 100644 index 00000000..e4b93c40 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/ends-with/shim.js @@ -0,0 +1,16 @@ +// In some parts copied from: +// http://closure-library.googlecode.com/svn/trunk/closure/goog/ +// string/string_test.html + +'use strict'; + +module.exports = function (t, a) { + a(t.call('abc', ''), true, "Empty needle"); + a(t.call('abcd', 'cd'), true, "Ends with needle"); + a(t.call('abcd', 'abcd'), true, "Needle equals haystack"); + a(t.call('abcd', 'ab'), false, "Doesn't end with needle"); + a(t.call('abc', 'defg'), false, "Length trick"); + a(t.call('razdwa', 'zd', 3), false, "Position: false"); + a(t.call('razdwa', 'zd', 4), true, "Position: true"); + a(t.call('razdwa', 'zd', 5), false, "Position: false #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/hyphen-to-camel.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/hyphen-to-camel.js new file mode 100644 index 00000000..bd7ded4b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/hyphen-to-camel.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('raz-dwa-t-rzy-4y-rtr4-tiu-45-pa'), 'razDwaTRzy4yRtr4Tiu45Pa'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/indent.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/indent.js new file mode 100644 index 00000000..eb92b36f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/indent.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('ra\nzz', ''), 'ra\nzz', "Empty"); + a(t.call('ra\nzz', '\t', 3), '\t\t\tra\n\t\t\tzz', "String repeat"); + a(t.call('ra\nzz\nsss\nfff\n', '\t'), '\tra\n\tzz\n\tsss\n\tfff\n', + "Multi-line"); + a(t.call('ra\n\nzz\n', '\t'), '\tra\n\n\tzz\n', "Don't touch empty lines"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/last.js new file mode 100644 index 00000000..ad36a213 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/last.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(''), null, "Null"); + a(t.call('abcdef'), 'f', "String"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/_data.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/_data.js new file mode 100644 index 00000000..c741addb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/_data.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t[0], 'object'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/implement.js new file mode 100644 index 00000000..4886c9b8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/normalize/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/shim.js new file mode 100644 index 00000000..28e27f59 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/normalize/shim.js @@ -0,0 +1,13 @@ +// Taken from: https://github.com/walling/unorm/blob/master/test/es6-shim.js + +'use strict'; + +var str = 'äiti'; + +module.exports = function (t, a) { + a(t.call(str), "\u00e4iti"); + a(t.call(str, "NFC"), "\u00e4iti"); + a(t.call(str, "NFD"), "a\u0308iti"); + a(t.call(str, "NFKC"), "\u00e4iti"); + a(t.call(str, "NFKD"), "a\u0308iti"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/pad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/pad.js new file mode 100644 index 00000000..28c3fcaa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/pad.js @@ -0,0 +1,24 @@ +'use strict'; + +var partial = require('../../../function/#/partial'); + +module.exports = { + Left: function (t, a) { + t = partial.call(t, 'x', 5); + + a(t.call('yy'), 'xxxyy'); + a(t.call(''), 'xxxxx', "Empty string"); + + a(t.call('yyyyy'), 'yyyyy', 'Equal length'); + a(t.call('yyyyyyy'), 'yyyyyyy', 'Longer'); + }, + Right: function (t, a) { + t = partial.call(t, 'x', -5); + + a(t.call('yy'), 'yyxxx'); + a(t.call(''), 'xxxxx', "Empty string"); + + a(t.call('yyyyy'), 'yyyyy', 'Equal length'); + a(t.call('yyyyyyy'), 'yyyyyyy', 'Longer'); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/plain-replace-all.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/plain-replace-all.js new file mode 100644 index 00000000..a425c87a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/plain-replace-all.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('razdwatrzy', 'dwa', 'olera'), 'razoleratrzy', "Basic"); + a(t.call('razdwatrzy', 'dwa', 'ole$&a'), 'razole$&atrzy', "Inserts"); + a(t.call('razdwa', 'ola', 'sdfs'), 'razdwa', "No replace"); + + a(t.call('$raz$$dwa$trzy$', '$', '&&'), '&&raz&&&&dwa&&trzy&&', "Multi"); + a(t.call('$raz$$dwa$$$$trzy$', '$$', '&'), '$raz&dwa&&trzy$', + "Multi many chars"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/plain-replace.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/plain-replace.js new file mode 100644 index 00000000..54522ed7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/plain-replace.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('razdwatrzy', 'dwa', 'olera'), 'razoleratrzy', "Basic"); + a(t.call('razdwatrzy', 'dwa', 'ole$&a'), 'razole$&atrzy', "Inserts"); + a(t.call('razdwa', 'ola', 'sdfs'), 'razdwa', "No replace"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/implement.js new file mode 100644 index 00000000..7ff65a81 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/repeat/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/shim.js new file mode 100644 index 00000000..7e0d077e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/repeat/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('a', 0), '', "Empty"); + a(t.call('a', 1), 'a', "1"); + a(t.call('\t', 5), '\t\t\t\t\t', "Whitespace"); + a(t.call('raz', 3), 'razrazraz', "Many chars"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/implement.js new file mode 100644 index 00000000..fc8490fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/starts-with/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/shim.js new file mode 100644 index 00000000..e0e123b3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/#/starts-with/shim.js @@ -0,0 +1,14 @@ +// Inspired and in some parts copied from: +// http://closure-library.googlecode.com/svn/trunk/closure/goog +// /string/string_test.html + +'use strict'; + +module.exports = function (t, a) { + a(t.call('abc', ''), true, "Empty needle"); + a(t.call('abcd', 'ab'), true, "Starts with needle"); + a(t.call('abcd', 'abcd'), true, "Needle equals haystack"); + a(t.call('abcd', 'bcde', 1), false, "Needle larger than haystack"); + a(!t.call('abcd', 'cd'), true, "Doesn't start with needle"); + a(t.call('abcd', 'bc', 1), true, "Position"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/format-method.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/format-method.js new file mode 100644 index 00000000..bb5561ee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/format-method.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + t = t({ a: 'A', aa: 'B', ab: 'C', b: 'D', + c: function () { return ++this.a; } }); + a(t.call({ a: 0 }, ' %a%aab%abb%b\\%aa%ab%c%c '), ' ABbCbD%aaC12 '); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/implement.js new file mode 100644 index 00000000..0aceb97e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../string/from-code-point/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/shim.js new file mode 100644 index 00000000..88cda3d6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/from-code-point/shim.js @@ -0,0 +1,47 @@ +// Taken from: https://github.com/mathiasbynens/String.fromCodePoint/blob/master +// /tests/tests.js + +'use strict'; + +var pow = Math.pow; + +module.exports = function (t, a) { + var counter, result; + + a(t.length, 1, "Length"); + a(String.propertyIsEnumerable('fromCodePoint'), false, "Not enumerable"); + + a(t(''), '\0', "Empty string"); + a(t(), '', "No arguments"); + a(t(-0), '\0', "-0"); + a(t(0), '\0', "0"); + a(t(0x1D306), '\uD834\uDF06', "Unicode"); + a(t(0x1D306, 0x61, 0x1D307), '\uD834\uDF06a\uD834\uDF07', "Complex unicode"); + a(t(0x61, 0x62, 0x1D307), 'ab\uD834\uDF07', "Complex"); + a(t(false), '\0', "false"); + a(t(null), '\0', "null"); + + a.throws(function () { t('_'); }, RangeError, "_"); + a.throws(function () { t(Infinity); }, RangeError, "Infinity"); + a.throws(function () { t(-Infinity); }, RangeError, "-Infinity"); + a.throws(function () { t(-1); }, RangeError, "-1"); + a.throws(function () { t(0x10FFFF + 1); }, RangeError, "Range error #1"); + a.throws(function () { t(3.14); }, RangeError, "Range error #2"); + a.throws(function () { t(3e-2); }, RangeError, "Range error #3"); + a.throws(function () { t(-Infinity); }, RangeError, "Range error #4"); + a.throws(function () { t(+Infinity); }, RangeError, "Range error #5"); + a.throws(function () { t(NaN); }, RangeError, "Range error #6"); + a.throws(function () { t(undefined); }, RangeError, "Range error #7"); + a.throws(function () { t({}); }, RangeError, "Range error #8"); + a.throws(function () { t(/re/); }, RangeError, "Range error #9"); + + counter = pow(2, 15) * 3 / 2; + result = []; + while (--counter >= 0) result.push(0); // one code unit per symbol + t.apply(null, result); // must not throw + + counter = pow(2, 15) * 3 / 2; + result = []; + while (--counter >= 0) result.push(0xFFFF + 1); // two code units per symbol + t.apply(null, result); // must not throw +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/is-string.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/is-string.js new file mode 100644 index 00000000..32f59582 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/is-string.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(null), false, "Null"); + a(t(''), true, "Empty string"); + a(t(12), false, "Number"); + a(t(false), false, "Boolean"); + a(t(new Date()), false, "Date"); + a(t(new String('raz')), true, "String object"); + a(t('asdfaf'), true, "String"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/random-uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/random-uniq.js new file mode 100644 index 00000000..6791ac26 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/random-uniq.js @@ -0,0 +1,14 @@ +'use strict'; + +var isValidFormat = RegExp.prototype.test.bind(/^[a-z0-9]+$/); + +module.exports = function (t, a) { + a(typeof t(), 'string'); + a.ok(t().length > 7); + a.not(t(), t()); + a.ok(isValidFormat(t())); + a.ok(isValidFormat(t())); + a.ok(isValidFormat(t())); + a.ok(isValidFormat(t())); + a.ok(isValidFormat(t())); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/implement.js new file mode 100644 index 00000000..59416de3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../string/raw/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/shim.js new file mode 100644 index 00000000..025ed780 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es5-ext/test/string/raw/shim.js @@ -0,0 +1,15 @@ +// Partially taken from: +// https://github.com/paulmillr/es6-shim/blob/master/test/string.js + +'use strict'; + +module.exports = function (t, a) { + var callSite = []; + + callSite.raw = ["The total is ", " ($", " with tax)"]; + a(t(callSite, '{total}', '{total * 1.01}'), + 'The total is {total} (${total * 1.01} with tax)'); + + callSite.raw = []; + a(t(callSite, '{total}', '{total * 1.01}'), ''); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/#/chain.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/#/chain.js new file mode 100644 index 00000000..6dc1543b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/#/chain.js @@ -0,0 +1,40 @@ +'use strict'; + +var setPrototypeOf = require('es5-ext/object/set-prototype-of') + , d = require('d') + , Iterator = require('../') + , validIterable = require('../valid-iterable') + + , push = Array.prototype.push + , defineProperties = Object.defineProperties + , IteratorChain; + +IteratorChain = function (iterators) { + defineProperties(this, { + __iterators__: d('', iterators), + __current__: d('w', iterators.shift()) + }); +}; +if (setPrototypeOf) setPrototypeOf(IteratorChain, Iterator); + +IteratorChain.prototype = Object.create(Iterator.prototype, { + constructor: d(IteratorChain), + next: d(function () { + var result; + if (!this.__current__) return { done: true, value: undefined }; + result = this.__current__.next(); + while (result.done) { + this.__current__ = this.__iterators__.shift(); + if (!this.__current__) return { done: true, value: undefined }; + result = this.__current__.next(); + } + return result; + }) +}); + +module.exports = function () { + var iterators = [this]; + push.apply(iterators, arguments); + iterators.forEach(validIterable); + return new IteratorChain(iterators); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/.lint new file mode 100644 index 00000000..cf54d815 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/.lint @@ -0,0 +1,11 @@ +@root + +module + +tabs +indent 2 +maxlen 100 + +ass +nomen +plusplus diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/.travis.yml new file mode 100644 index 00000000..02c277cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+es6-iterator@medikoo.com + +script: "npm test && npm run lint" diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/CHANGES new file mode 100644 index 00000000..a2d1ec7c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/CHANGES @@ -0,0 +1,28 @@ +v0.1.3 -- 2015.02.02 +* Update dependencies +* Fix spelling of LICENSE + +v0.1.2 -- 2014.11.19 +* Optimise internal `_next` to not verify internal's list length at all times + (#2 thanks @RReverser) +* Fix documentation examples +* Configure lint scripts + +v0.1.1 -- 2014.04.29 +* Fix es6-symbol dependency version + +v0.1.0 -- 2014.04.29 +* Assure strictly npm hosted dependencies +* Remove sparse arrays dedicated handling (as per spec) +* Add: isIterable, validIterable and chain (method) +* Remove toArray, it's addressed by Array.from (polyfil can be found in es5-ext/array/from) +* Add break possiblity to 'forOf' via 'doBreak' function argument +* Provide dedicated iterator for array-likes (ArrayIterator) and for strings (StringIterator) +* Provide @@toStringTag symbol +* When available rely on @@iterator symbol +* Remove 32bit integer maximum list length restriction +* Improve Iterator internals +* Update to use latest version of dependencies + +v0.0.0 -- 2013.10.12 +Initial (dev version) \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/LICENSE new file mode 100644 index 00000000..04724a3a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/README.md new file mode 100644 index 00000000..288373da --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/README.md @@ -0,0 +1,148 @@ +# es6-iterator +## ECMAScript 6 Iterator interface + +### Installation + + $ npm install es6-iterator + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +## API + +### Constructors + +#### Iterator(list) _(es6-iterator)_ + +Abstract Iterator interface. Meant for extensions and not to be used on its own. + +Accepts any _list_ object (technically object with numeric _length_ property). + +_Mind it doesn't iterate strings properly, for that use dedicated [StringIterator](#string-iterator)_ + +```javascript +var Iterator = require('es6-iterator') +var iterator = new Iterator([1, 2, 3]); + +iterator.next(); // { value: 1, done: false } +iterator.next(); // { value: 2, done: false } +iterator.next(); // { value: 3, done: false } +iterator.next(); // { value: undefined, done: true } +``` + + +#### ArrayIterator(arrayLike[, kind]) _(es6-iterator/array)_ + +Dedicated for arrays and array-likes. Supports three iteration kinds: +* __value__ _(default)_ - Iterates values +* __key__ - Iterates indexes +* __key+value__ - Iterates keys and indexes, each iteration value is in _[key, value]_ form. + + +```javascript +var ArrayIterator = require('es6-iterator/array') +var iterator = new ArrayIterator([1, 2, 3], 'key+value'); + +iterator.next(); // { value: [0, 1], done: false } +iterator.next(); // { value: [1, 2], done: false } +iterator.next(); // { value: [2, 3], done: false } +iterator.next(); // { value: undefined, done: true } +``` + +May also be used for _arguments_ objects: + +```javascript +(function () { + var iterator = new ArrayIterator(arguments); + + iterator.next(); // { value: 1, done: false } + iterator.next(); // { value: 2, done: false } + iterator.next(); // { value: 3, done: false } + iterator.next(); // { value: undefined, done: true } +}(1, 2, 3)); +``` + +#### StringIterator(str) _(es6-iterator/string)_ + +Assures proper iteration over unicode symbols. +See: http://mathiasbynens.be/notes/javascript-unicode + +```javascript +var StringIterator = require('es6-iterator/string'); +var iterator = new StringIterator('f🙈o🙉o🙊'); + +iterator.next(); // { value: 'f', done: false } +iterator.next(); // { value: '🙈', done: false } +iterator.next(); // { value: 'o', done: false } +iterator.next(); // { value: '🙉', done: false } +iterator.next(); // { value: 'o', done: false } +iterator.next(); // { value: '🙊', done: false } +iterator.next(); // { value: undefined, done: true } +``` + +### Function utilities + +#### forOf(iterable, callback[, thisArg]) _(es6-iterator/for-of)_ + +Polyfill for ECMAScript 6 [`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) statement. + +``` +var forOf = require('es6-iterator/for-of'); +var result = []; + +forOf('🙈🙉🙊', function (monkey) { result.push(monkey); }); +console.log(result); // ['🙈', '🙉', '🙊']; +``` + +Optionally you can break iteration at any point: + +```javascript +var result = []; + +forOf([1,2,3,4]', function (val, doBreak) { + result.push(monkey); + if (val >= 3) doBreak(); +}); +console.log(result); // [1, 2, 3]; +``` + +#### get(obj) _(es6-iterator/get)_ + +Return iterator for any iterable object. + +```javascript +var getIterator = require('es6-iterator/get'); +var iterator = get([1,2,3]); + +iterator.next(); // { value: 1, done: false } +iterator.next(); // { value: 2, done: false } +iterator.next(); // { value: 3, done: false } +iterator.next(); // { value: undefined, done: true } +``` + +#### isIterable(obj) _(es6-iterator/is-iterable)_ + +Whether _obj_ is iterable + +```javascript +var isIterable = require('es6-iterator/is-iterable'); + +isIterable(null); // false +isIterable(true); // false +isIterable('str'); // true +isIterable(['a', 'r', 'r']); // true +isIterable(new ArrayIterator([])); // true +``` + +#### validIterable(obj) _(es6-iterator/valid-iterable)_ + +If _obj_ is an iterable it is returned. Otherwise _TypeError_ is thrown. + +### Method extensions + +#### iterator.chain(iterator1[, …iteratorn]) _(es6-iterator/#/chain)_ + +Chain multiple iterators into one. + +### Tests [![Build Status](https://travis-ci.org/medikoo/es6-iterator.png)](https://travis-ci.org/medikoo/es6-iterator) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/array.js new file mode 100644 index 00000000..885ad0a4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/array.js @@ -0,0 +1,30 @@ +'use strict'; + +var setPrototypeOf = require('es5-ext/object/set-prototype-of') + , contains = require('es5-ext/string/#/contains') + , d = require('d') + , Iterator = require('./') + + , defineProperty = Object.defineProperty + , ArrayIterator; + +ArrayIterator = module.exports = function (arr, kind) { + if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind); + Iterator.call(this, arr); + if (!kind) kind = 'value'; + else if (contains.call(kind, 'key+value')) kind = 'key+value'; + else if (contains.call(kind, 'key')) kind = 'key'; + else kind = 'value'; + defineProperty(this, '__kind__', d('', kind)); +}; +if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator); + +ArrayIterator.prototype = Object.create(Iterator.prototype, { + constructor: d(ArrayIterator), + _resolve: d(function (i) { + if (this.__kind__ === 'value') return this.__list__[i]; + if (this.__kind__ === 'key+value') return [i, this.__list__[i]]; + return i; + }), + toString: d(function () { return '[object Array Iterator]'; }) +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/for-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/for-of.js new file mode 100644 index 00000000..111f5522 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/for-of.js @@ -0,0 +1,44 @@ +'use strict'; + +var callable = require('es5-ext/object/valid-callable') + , isString = require('es5-ext/string/is-string') + , get = require('./get') + + , isArray = Array.isArray, call = Function.prototype.call; + +module.exports = function (iterable, cb/*, thisArg*/) { + var mode, thisArg = arguments[2], result, doBreak, broken, i, l, char, code; + if (isArray(iterable)) mode = 'array'; + else if (isString(iterable)) mode = 'string'; + else iterable = get(iterable); + + callable(cb); + doBreak = function () { broken = true; }; + if (mode === 'array') { + iterable.some(function (value) { + call.call(cb, thisArg, value, doBreak); + if (broken) return true; + }); + return; + } + if (mode === 'string') { + l = iterable.length; + for (i = 0; i < l; ++i) { + char = iterable[i]; + if ((i + 1) < l) { + code = char.charCodeAt(0); + if ((code >= 0xD800) && (code <= 0xDBFF)) char += iterable[++i]; + } + call.call(cb, thisArg, char, doBreak); + if (broken) break; + } + return; + } + result = iterable.next(); + + while (!result.done) { + call.call(cb, thisArg, result.value, doBreak); + if (broken) return; + result = iterable.next(); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/get.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/get.js new file mode 100644 index 00000000..38230fd8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/get.js @@ -0,0 +1,13 @@ +'use strict'; + +var isString = require('es5-ext/string/is-string') + , ArrayIterator = require('./array') + , StringIterator = require('./string') + , iterable = require('./valid-iterable') + , iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (obj) { + if (typeof iterable(obj)[iteratorSymbol] === 'function') return obj[iteratorSymbol](); + if (isString(obj)) return new StringIterator(obj); + return new ArrayIterator(obj); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/index.js new file mode 100644 index 00000000..10fd0895 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/index.js @@ -0,0 +1,90 @@ +'use strict'; + +var clear = require('es5-ext/array/#/clear') + , assign = require('es5-ext/object/assign') + , callable = require('es5-ext/object/valid-callable') + , value = require('es5-ext/object/valid-value') + , d = require('d') + , autoBind = require('d/auto-bind') + , Symbol = require('es6-symbol') + + , defineProperty = Object.defineProperty + , defineProperties = Object.defineProperties + , Iterator; + +module.exports = Iterator = function (list, context) { + if (!(this instanceof Iterator)) return new Iterator(list, context); + defineProperties(this, { + __list__: d('w', value(list)), + __context__: d('w', context), + __nextIndex__: d('w', 0) + }); + if (!context) return; + callable(context.on); + context.on('_add', this._onAdd); + context.on('_delete', this._onDelete); + context.on('_clear', this._onClear); +}; + +defineProperties(Iterator.prototype, assign({ + constructor: d(Iterator), + _next: d(function () { + var i; + if (!this.__list__) return; + if (this.__redo__) { + i = this.__redo__.shift(); + if (i !== undefined) return i; + } + if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++; + this._unBind(); + }), + next: d(function () { return this._createResult(this._next()); }), + _createResult: d(function (i) { + if (i === undefined) return { done: true, value: undefined }; + return { done: false, value: this._resolve(i) }; + }), + _resolve: d(function (i) { return this.__list__[i]; }), + _unBind: d(function () { + this.__list__ = null; + delete this.__redo__; + if (!this.__context__) return; + this.__context__.off('_add', this._onAdd); + this.__context__.off('_delete', this._onDelete); + this.__context__.off('_clear', this._onClear); + this.__context__ = null; + }), + toString: d(function () { return '[object Iterator]'; }) +}, autoBind({ + _onAdd: d(function (index) { + if (index >= this.__nextIndex__) return; + ++this.__nextIndex__; + if (!this.__redo__) { + defineProperty(this, '__redo__', d('c', [index])); + return; + } + this.__redo__.forEach(function (redo, i) { + if (redo >= index) this.__redo__[i] = ++redo; + }, this); + this.__redo__.push(index); + }), + _onDelete: d(function (index) { + var i; + if (index >= this.__nextIndex__) return; + --this.__nextIndex__; + if (!this.__redo__) return; + i = this.__redo__.indexOf(index); + if (i !== -1) this.__redo__.splice(i, 1); + this.__redo__.forEach(function (redo, i) { + if (redo > index) this.__redo__[i] = --redo; + }, this); + }), + _onClear: d(function () { + if (this.__redo__) clear.call(this.__redo__); + this.__nextIndex__ = 0; + }) +}))); + +defineProperty(Iterator.prototype, Symbol.iterator, d(function () { + return this; +})); +defineProperty(Iterator.prototype, Symbol.toStringTag, d('', 'Iterator')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/is-iterable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/is-iterable.js new file mode 100644 index 00000000..bbcf1049 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/is-iterable.js @@ -0,0 +1,13 @@ +'use strict'; + +var isString = require('es5-ext/string/is-string') + , iteratorSymbol = require('es6-symbol').iterator + + , isArray = Array.isArray; + +module.exports = function (value) { + if (value == null) return false; + if (isArray(value)) return true; + if (isString(value)) return true; + return (typeof value[iteratorSymbol] === 'function'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/.lint new file mode 100644 index 00000000..1851752f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/.lint @@ -0,0 +1,13 @@ +@root + +module + +tabs +indent 2 +maxlen 100 + +ass +nomen +plusplus +newcap +vars diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/.travis.yml new file mode 100644 index 00000000..afd3509a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+es6-symbol@medikoo.com diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/CHANGES new file mode 100644 index 00000000..df8c27ef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/CHANGES @@ -0,0 +1,34 @@ +v2.0.1 -- 2015.01.28 +* Fix Symbol.prototype[Symbol.isPrimitive] implementation +* Improve validation within Symbol.prototype.toString and + Symbol.prototype.valueOf + +v2.0.0 -- 2015.01.28 +* Update up to changes in specification: + * Implement `for` and `keyFor` + * Remove `Symbol.create` and `Symbol.isRegExp` + * Add `Symbol.match`, `Symbol.replace`, `Symbol.search`, `Symbol.species` and + `Symbol.split` +* Rename `validSymbol` to `validateSymbol` +* Improve documentation +* Remove dead test modules + +v1.0.0 -- 2015.01.26 +* Fix enumerability for symbol properties set normally (e.g. obj[symbol] = value) +* Introduce initialization via hidden constructor +* Fix isSymbol handling of polyfill values when native Symbol is present +* Fix spelling of LICENSE +* Configure lint scripts + +v0.1.1 -- 2014.10.07 +* Fix isImplemented, so it returns true in case of polyfill +* Improve documentations + +v0.1.0 -- 2014.04.28 +* Assure strictly npm dependencies +* Update to use latest versions of dependencies +* Fix implementation detection so it doesn't crash on `String(symbol)` +* throw on `new Symbol()` (as decided by TC39) + +v0.0.0 -- 2013.11.15 +* Initial (dev) version \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/LICENSE new file mode 100644 index 00000000..04724a3a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/README.md new file mode 100644 index 00000000..95d6780b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/README.md @@ -0,0 +1,71 @@ +# es6-symbol +## ECMAScript 6 Symbol polyfill + +For more information about symbols see following links +- [Symbols in ECMAScript 6 by Axel Rauschmayer](http://www.2ality.com/2014/12/es6-symbols.html) +- [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) +- [Specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-constructor) + +### Limitations + +Underneath it uses real string property names which can easily be retrieved, however accidental collision with other property names is unlikely. + +### Usage + +If you'd like to use native version when it exists and fallback to polyfill if it doesn't (but without implementing `Symbol` on global scope), do: + +```javascript +var Symbol = require('es6-symbol'); +``` + +If you want to make sure your environment implements `Symbol`, do: + +```javascript +require('es6-symbol/implement'); +``` + +If you strictly want to use polyfill even if native `Symbol` exists (hard to find a good reason for that), do: + +```javascript +var Symbol = require('es6-symbol/polyfill'); +``` + +#### API + +Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-objects). Still if you want quick look, follow examples: + +```javascript +var Symbol = require('es6-symbol'); + +var symbol = Symbol('My custom symbol'); +var x = {}; + +x[symbol] = 'foo'; +console.log(x[symbol]); 'foo' + +// Detect iterable: +var iterator, result; +if (possiblyIterable[Symbol.iterator]) { + iterator = possiblyIterable[Symbol.iterator](); + result = iterator.next(); + while(!result.done) { + console.log(result.value); + result = iterator.next(); + } +} +``` + +### Installation +#### NPM + +In your project path: + + $ npm install es6-symbol + +##### Browser + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +## Tests [![Build Status](https://travis-ci.org/medikoo/es6-symbol.png)](https://travis-ci.org/medikoo/es6-symbol) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/implement.js new file mode 100644 index 00000000..153edacd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(require('es5-ext/global'), 'Symbol', + { value: require('./polyfill'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/index.js new file mode 100644 index 00000000..609f1faf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? Symbol : require('./polyfill'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/is-implemented.js new file mode 100644 index 00000000..53759f32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/is-implemented.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function () { + var symbol; + if (typeof Symbol !== 'function') return false; + symbol = Symbol('test symbol'); + try { String(symbol); } catch (e) { return false; } + if (typeof Symbol.iterator === 'symbol') return true; + + // Return 'true' for polyfills + if (typeof Symbol.isConcatSpreadable !== 'object') return false; + if (typeof Symbol.iterator !== 'object') return false; + if (typeof Symbol.toPrimitive !== 'object') return false; + if (typeof Symbol.toStringTag !== 'object') return false; + if (typeof Symbol.unscopables !== 'object') return false; + + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/is-native-implemented.js new file mode 100644 index 00000000..a8cb8b86 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/is-native-implemented.js @@ -0,0 +1,8 @@ +// Exports true if environment provides native `Symbol` implementation + +'use strict'; + +module.exports = (function () { + if (typeof Symbol !== 'function') return false; + return (typeof Symbol.iterator === 'symbol'); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/is-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/is-symbol.js new file mode 100644 index 00000000..beeba2cb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/is-symbol.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (x) { + return (x && ((typeof x === 'symbol') || (x['@@toStringTag'] === 'Symbol'))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/package.json new file mode 100644 index 00000000..0efffeae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/package.json @@ -0,0 +1,63 @@ +{ + "name": "es6-symbol", + "version": "2.0.1", + "description": "ECMAScript6 Symbol polyfill", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "symbol", + "private", + "property", + "es6", + "ecmascript", + "harmony" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es6-symbol.git" + }, + "dependencies": { + "d": "~0.1.1", + "es5-ext": "~0.10.5" + }, + "devDependencies": { + "tad": "~0.2.1", + "xlint": "~0.2.2", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "51f6938d7830269fefa38f02eb912f5472b3ccd7", + "bugs": { + "url": "https://github.com/medikoo/es6-symbol/issues" + }, + "homepage": "https://github.com/medikoo/es6-symbol", + "_id": "es6-symbol@2.0.1", + "_shasum": "761b5c67cfd4f1d18afb234f691d678682cb3bf3", + "_from": "es6-symbol@>=2.0.1 <2.1.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "761b5c67cfd4f1d18afb234f691d678682cb3bf3", + "tarball": "http://registry.npmjs.org/es6-symbol/-/es6-symbol-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/polyfill.js new file mode 100644 index 00000000..735eb676 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/polyfill.js @@ -0,0 +1,77 @@ +'use strict'; + +var d = require('d') + , validateSymbol = require('./validate-symbol') + + , create = Object.create, defineProperties = Object.defineProperties + , defineProperty = Object.defineProperty, objPrototype = Object.prototype + , Symbol, HiddenSymbol, globalSymbols = create(null); + +var generateName = (function () { + var created = create(null); + return function (desc) { + var postfix = 0, name; + while (created[desc + (postfix || '')]) ++postfix; + desc += (postfix || ''); + created[desc] = true; + name = '@@' + desc; + defineProperty(objPrototype, name, d.gs(null, function (value) { + defineProperty(this, name, d(value)); + })); + return name; + }; +}()); + +HiddenSymbol = function Symbol(description) { + if (this instanceof HiddenSymbol) throw new TypeError('TypeError: Symbol is not a constructor'); + return Symbol(description); +}; +module.exports = Symbol = function Symbol(description) { + var symbol; + if (this instanceof Symbol) throw new TypeError('TypeError: Symbol is not a constructor'); + symbol = create(HiddenSymbol.prototype); + description = (description === undefined ? '' : String(description)); + return defineProperties(symbol, { + __description__: d('', description), + __name__: d('', generateName(description)) + }); +}; +defineProperties(Symbol, { + for: d(function (key) { + if (globalSymbols[key]) return globalSymbols[key]; + return (globalSymbols[key] = Symbol(String(key))); + }), + keyFor: d(function (s) { + var key; + validateSymbol(s); + for (key in globalSymbols) if (globalSymbols[key] === s) return key; + }), + hasInstance: d('', Symbol('hasInstance')), + isConcatSpreadable: d('', Symbol('isConcatSpreadable')), + iterator: d('', Symbol('iterator')), + match: d('', Symbol('match')), + replace: d('', Symbol('replace')), + search: d('', Symbol('search')), + species: d('', Symbol('species')), + split: d('', Symbol('split')), + toPrimitive: d('', Symbol('toPrimitive')), + toStringTag: d('', Symbol('toStringTag')), + unscopables: d('', Symbol('unscopables')) +}); +defineProperties(HiddenSymbol.prototype, { + constructor: d(Symbol), + toString: d('', function () { return this.__name__; }) +}); + +defineProperties(Symbol.prototype, { + toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }), + valueOf: d(function () { return validateSymbol(this); }) +}); +defineProperty(Symbol.prototype, Symbol.toPrimitive, d('', + function () { return validateSymbol(this); })); +defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol')); + +defineProperty(HiddenSymbol.prototype, Symbol.toPrimitive, + d('c', Symbol.prototype[Symbol.toPrimitive])); +defineProperty(HiddenSymbol.prototype, Symbol.toStringTag, + d('c', Symbol.prototype[Symbol.toStringTag])); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/implement.js new file mode 100644 index 00000000..eb35c301 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/implement.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof Symbol, 'function'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/index.js new file mode 100644 index 00000000..62b3296d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var d = require('d') + + , defineProperty = Object.defineProperty; + +module.exports = function (T, a) { + var symbol = T('test'), x = {}; + defineProperty(x, symbol, d('foo')); + a(x.test, undefined, "Name"); + a(x[symbol], 'foo', "Get"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/is-implemented.js new file mode 100644 index 00000000..bb0d6453 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +var global = require('es5-ext/global') + , polyfill = require('../polyfill'); + +module.exports = function (t, a) { + var cache; + a(typeof t(), 'boolean'); + cache = global.Symbol; + global.Symbol = polyfill; + a(t(), true); + if (cache === undefined) delete global.Symbol; + else global.Symbol = cache; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/is-native-implemented.js new file mode 100644 index 00000000..df8ba032 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/is-native-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t, 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/is-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/is-symbol.js new file mode 100644 index 00000000..ac24b9ab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/is-symbol.js @@ -0,0 +1,16 @@ +'use strict'; + +var SymbolPoly = require('../polyfill'); + +module.exports = function (t, a) { + a(t(undefined), false, "Undefined"); + a(t(null), false, "Null"); + a(t(true), false, "Primitive"); + a(t('raz'), false, "String"); + a(t({}), false, "Object"); + a(t([]), false, "Array"); + if (typeof Symbol !== 'undefined') { + a(t(Symbol()), true, "Native"); + } + a(t(SymbolPoly()), true, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/polyfill.js new file mode 100644 index 00000000..83fb5e92 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/polyfill.js @@ -0,0 +1,27 @@ +'use strict'; + +var d = require('d') + , isSymbol = require('../is-symbol') + + , defineProperty = Object.defineProperty; + +module.exports = function (T, a) { + var symbol = T('test'), x = {}; + defineProperty(x, symbol, d('foo')); + a(x.test, undefined, "Name"); + a(x[symbol], 'foo', "Get"); + a(x instanceof T, false); + + a(isSymbol(symbol), true, "Symbol"); + a(isSymbol(T.iterator), true, "iterator"); + a(isSymbol(T.toStringTag), true, "toStringTag"); + + x = {}; + x[symbol] = 'foo'; + a.deep(Object.getOwnPropertyDescriptor(x, symbol), { configurable: true, enumerable: false, + value: 'foo', writable: true }); + symbol = T.for('marko'); + a(isSymbol(symbol), true); + a(T.for('marko'), symbol); + a(T.keyFor(symbol), 'marko'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/validate-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/validate-symbol.js new file mode 100644 index 00000000..2c8f84c8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/test/validate-symbol.js @@ -0,0 +1,19 @@ +'use strict'; + +var SymbolPoly = require('../polyfill'); + +module.exports = function (t, a) { + var symbol; + a.throws(function () { t(undefined); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.throws(function () { t(true); }, TypeError, "Primitive"); + a.throws(function () { t('raz'); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Object"); + a.throws(function () { t([]); }, TypeError, "Array"); + if (typeof Symbol !== 'undefined') { + symbol = Symbol(); + a(t(symbol), symbol, "Native"); + } + symbol = SymbolPoly(); + a(t(symbol), symbol, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/validate-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/validate-symbol.js new file mode 100644 index 00000000..42750043 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/node_modules/es6-symbol/validate-symbol.js @@ -0,0 +1,8 @@ +'use strict'; + +var isSymbol = require('./is-symbol'); + +module.exports = function (value) { + if (!isSymbol(value)) throw new TypeError(value + " is not a symbol"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/package.json new file mode 100644 index 00000000..593d080e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/package.json @@ -0,0 +1,66 @@ +{ + "name": "es6-iterator", + "version": "0.1.3", + "description": "Iterator abstraction based on ES6 specification", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "iterator", + "array", + "list", + "set", + "map", + "generator" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es6-iterator.git" + }, + "dependencies": { + "d": "~0.1.1", + "es5-ext": "~0.10.5", + "es6-symbol": "~2.0.1" + }, + "devDependencies": { + "event-emitter": "~0.3.3", + "tad": "~0.2.1", + "xlint": "~0.2.2", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "2addc362c6f139e4941cf4726eeb59e5960c5cef", + "bugs": { + "url": "https://github.com/medikoo/es6-iterator/issues" + }, + "homepage": "https://github.com/medikoo/es6-iterator", + "_id": "es6-iterator@0.1.3", + "_shasum": "d6f58b8c4fc413c249b4baa19768f8e4d7c8944e", + "_from": "es6-iterator@>=0.1.1 <0.2.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.11.16", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "d6f58b8c4fc413c249b4baa19768f8e4d7c8944e", + "tarball": "http://registry.npmjs.org/es6-iterator/-/es6-iterator-0.1.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-0.1.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/string.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/string.js new file mode 100644 index 00000000..cdb39ea4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/string.js @@ -0,0 +1,37 @@ +// Thanks @mathiasbynens +// http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols + +'use strict'; + +var setPrototypeOf = require('es5-ext/object/set-prototype-of') + , d = require('d') + , Iterator = require('./') + + , defineProperty = Object.defineProperty + , StringIterator; + +StringIterator = module.exports = function (str) { + if (!(this instanceof StringIterator)) return new StringIterator(str); + str = String(str); + Iterator.call(this, str); + defineProperty(this, '__length__', d('', str.length)); + +}; +if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator); + +StringIterator.prototype = Object.create(Iterator.prototype, { + constructor: d(StringIterator), + _next: d(function () { + if (!this.__list__) return; + if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++; + this._unBind(); + }), + _resolve: d(function (i) { + var char = this.__list__[i], code; + if (this.__nextIndex__ === this.__length__) return char; + code = char.charCodeAt(0); + if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++]; + return char; + }), + toString: d(function () { return '[object String Iterator]'; }) +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/#/chain.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/#/chain.js new file mode 100644 index 00000000..a414c66d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/#/chain.js @@ -0,0 +1,23 @@ +'use strict'; + +var Iterator = require('../../'); + +module.exports = function (t, a) { + var i1 = new Iterator(['raz', 'dwa', 'trzy']) + , i2 = new Iterator(['cztery', 'pięć', 'sześć']) + , i3 = new Iterator(['siedem', 'osiem', 'dziewięć']) + + , iterator = t.call(i1, i2, i3); + + a.deep(iterator.next(), { done: false, value: 'raz' }, "#1"); + a.deep(iterator.next(), { done: false, value: 'dwa' }, "#2"); + a.deep(iterator.next(), { done: false, value: 'trzy' }, "#3"); + a.deep(iterator.next(), { done: false, value: 'cztery' }, "#4"); + a.deep(iterator.next(), { done: false, value: 'pięć' }, "#5"); + a.deep(iterator.next(), { done: false, value: 'sześć' }, "#6"); + a.deep(iterator.next(), { done: false, value: 'siedem' }, "#7"); + a.deep(iterator.next(), { done: false, value: 'osiem' }, "#8"); + a.deep(iterator.next(), { done: false, value: 'dziewięć' }, "#9"); + a.deep(iterator.next(), { done: true, value: undefined }, "Done #1"); + a.deep(iterator.next(), { done: true, value: undefined }, "Done #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/array.js new file mode 100644 index 00000000..ae7c2199 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/array.js @@ -0,0 +1,67 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (T) { + return { + Values: function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it; + + it = new T(x); + a(it[iteratorSymbol](), it, "@@iterator"); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + x.splice(1, 0, 'elo'); + a.deep(it.next(), { done: false, value: 'dwa' }, "Insert"); + a.deep(it.next(), { done: false, value: 'trzy' }, "#3"); + a.deep(it.next(), { done: false, value: 'cztery' }, "#4"); + x.pop(); + a.deep(it.next(), { done: false, value: 'pięć' }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Keys & Values": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it; + + it = new T(x, 'key+value'); + a(it[iteratorSymbol](), it, "@@iterator"); + a.deep(it.next(), { done: false, value: [0, 'raz'] }, "#1"); + a.deep(it.next(), { done: false, value: [1, 'dwa'] }, "#2"); + x.splice(1, 0, 'elo'); + a.deep(it.next(), { done: false, value: [2, 'dwa'] }, "Insert"); + a.deep(it.next(), { done: false, value: [3, 'trzy'] }, "#3"); + a.deep(it.next(), { done: false, value: [4, 'cztery'] }, "#4"); + x.pop(); + a.deep(it.next(), { done: false, value: [5, 'pięć'] }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + Keys: function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it; + + it = new T(x, 'key'); + a(it[iteratorSymbol](), it, "@@iterator"); + a.deep(it.next(), { done: false, value: 0 }, "#1"); + a.deep(it.next(), { done: false, value: 1 }, "#2"); + x.splice(1, 0, 'elo'); + a.deep(it.next(), { done: false, value: 2 }, "Insert"); + a.deep(it.next(), { done: false, value: 3 }, "#3"); + a.deep(it.next(), { done: false, value: 4 }, "#4"); + x.pop(); + a.deep(it.next(), { done: false, value: 5 }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + Sparse: function (a) { + var x = new Array(6), it; + + x[2] = 'raz'; + x[4] = 'dwa'; + it = new T(x); + a.deep(it.next(), { done: false, value: undefined }, "#1"); + a.deep(it.next(), { done: false, value: undefined }, "#2"); + a.deep(it.next(), { done: false, value: 'raz' }, "#3"); + a.deep(it.next(), { done: false, value: undefined }, "#4"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#5"); + a.deep(it.next(), { done: false, value: undefined }, "#6"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/for-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/for-of.js new file mode 100644 index 00000000..502e7b76 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/for-of.js @@ -0,0 +1,35 @@ +'use strict'; + +var ArrayIterator = require('../array') + + , slice = Array.prototype.slice; + +module.exports = function (t, a) { + var i = 0, x = ['raz', 'dwa', 'trzy'], y = {}, called = 0; + t(x, function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Array " + i + "#"); + a(this, y, "Array: context: " + (i++) + "#"); + }, y); + i = 0; + t(x = 'foo', function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#"); + a(this, y, "Regular String: context: " + (i++) + "#"); + }, y); + i = 0; + x = ['r', '💩', 'z']; + t('r💩z', function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#"); + a(this, y, "Unicode String: context: " + (i++) + "#"); + }, y); + i = 0; + t(new ArrayIterator(x), function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Iterator " + i + "#"); + a(this, y, "Iterator: context: " + (i++) + "#"); + }, y); + + t(x = ['raz', 'dwa', 'trzy'], function (value, doBreak) { + ++called; + return doBreak(); + }); + a(called, 1, "Break"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/get.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/get.js new file mode 100644 index 00000000..7309590c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/get.js @@ -0,0 +1,16 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , Iterator = require('../'); + +module.exports = function (t, a) { + var iterator; + a.throws(function () { t(); }, TypeError, "Null"); + a.throws(function () { t({}); }, TypeError, "Plain object"); + a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like"); + iterator = {}; + iterator[iteratorSymbol] = function () { return new Iterator([]); }; + a(t(iterator) instanceof Iterator, true, "Iterator"); + a(String(t([])), '[object Array Iterator]', " Array"); + a(String(t('foo')), '[object String Iterator]', "String"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/index.js new file mode 100644 index 00000000..ea3621ad --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/index.js @@ -0,0 +1,99 @@ +'use strict'; + +var ee = require('event-emitter') + , iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (T) { + return { + "": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], it, y, z; + + it = new T(x); + a(it[iteratorSymbol](), it, "@@iterator"); + y = it.next(); + a.deep(y, { done: false, value: 'raz' }, "#1"); + z = it.next(); + a.not(y, z, "Recreate result"); + a.deep(z, { done: false, value: 'dwa' }, "#2"); + a.deep(it.next(), { done: false, value: 'trzy' }, "#3"); + a.deep(it.next(), { done: false, value: 'cztery' }, "#4"); + a.deep(it.next(), { done: false, value: 'pięć' }, "#5"); + a.deep(y = it.next(), { done: true, value: undefined }, "End"); + a.not(y, it.next(), "Recreate result on dead"); + }, + Emited: function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], y, it; + + y = ee(); + it = new T(x, y); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + y.emit('_add', x.push('sześć') - 1); + a.deep(it.next(), { done: false, value: 'trzy' }, "#3"); + x.splice(1, 0, 'półtora'); + y.emit('_add', 1); + a.deep(it.next(), { done: false, value: 'półtora' }, "Insert"); + x.splice(5, 1); + y.emit('_delete', 5); + a.deep(it.next(), { done: false, value: 'cztery' }, "#4"); + a.deep(it.next(), { done: false, value: 'sześć' }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited #2": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it; + + y = ee(); + it = new T(x, y); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + x.splice(1, 0, 'półtora'); + y.emit('_add', 1); + x.splice(1, 0, '1.25'); + y.emit('_add', 1); + x.splice(0, 1); + y.emit('_delete', 0); + a.deep(it.next(), { done: false, value: 'półtora' }, "Insert"); + a.deep(it.next(), { done: false, value: '1.25' }, "Insert #2"); + a.deep(it.next(), { done: false, value: 'trzy' }, "#3"); + a.deep(it.next(), { done: false, value: 'cztery' }, "#4"); + x.splice(5, 1); + y.emit('_delete', 5); + a.deep(it.next(), { done: false, value: 'sześć' }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited: Clear #1": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it; + + y = ee(); + it = new T(x, y); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + x.length = 0; + y.emit('_clear'); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited: Clear #2": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it; + + y = ee(); + it = new T(x, y); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + x.length = 0; + y.emit('_clear'); + x.push('foo'); + x.push('bar'); + a.deep(it.next(), { done: false, value: 'foo' }, "#3"); + a.deep(it.next(), { done: false, value: 'bar' }, "#4"); + x.splice(1, 0, 'półtora'); + y.emit('_add', 1); + x.splice(1, 0, '1.25'); + y.emit('_add', 1); + x.splice(0, 1); + y.emit('_delete', 0); + a.deep(it.next(), { done: false, value: 'półtora' }, "Insert"); + a.deep(it.next(), { done: false, value: '1.25' }, "Insert #2"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/is-iterable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/is-iterable.js new file mode 100644 index 00000000..7c5c59b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/is-iterable.js @@ -0,0 +1,18 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , Iterator = require('../'); + +module.exports = function (t, a) { + var iterator; + a(t(), false, "Undefined"); + a(t(123), false, "Number"); + a(t({}), false, "Plain object"); + a(t({ length: 0 }), false, "Array-like"); + iterator = {}; + iterator[iteratorSymbol] = function () { return new Iterator([]); }; + a(t(iterator), true, "Iterator"); + a(t([]), true, "Array"); + a(t('foo'), true, "String"); + a(t(''), true, "Empty string"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/string.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/string.js new file mode 100644 index 00000000..d11855f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/string.js @@ -0,0 +1,23 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (T, a) { + var it = new T('foobar'); + + a(it[iteratorSymbol](), it, "@@iterator"); + a.deep(it.next(), { done: false, value: 'f' }, "#1"); + a.deep(it.next(), { done: false, value: 'o' }, "#2"); + a.deep(it.next(), { done: false, value: 'o' }, "#3"); + a.deep(it.next(), { done: false, value: 'b' }, "#4"); + a.deep(it.next(), { done: false, value: 'a' }, "#5"); + a.deep(it.next(), { done: false, value: 'r' }, "#6"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + + a.h1("Outside of BMP"); + it = new T('r💩z'); + a.deep(it.next(), { done: false, value: 'r' }, "#1"); + a.deep(it.next(), { done: false, value: '💩' }, "#2"); + a.deep(it.next(), { done: false, value: 'z' }, "#3"); + a.deep(it.next(), { done: true, value: undefined }, "End"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/valid-iterable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/valid-iterable.js new file mode 100644 index 00000000..7760b017 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/test/valid-iterable.js @@ -0,0 +1,16 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , Iterator = require('../'); + +module.exports = function (t, a) { + var obj; + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t({}); }, TypeError, "Plain object"); + a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like"); + obj = {}; + obj[iteratorSymbol] = function () { return new Iterator([]); }; + a(t(obj), obj, "Iterator"); + obj = []; + a(t(obj), obj, 'Array'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/valid-iterable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/valid-iterable.js new file mode 100644 index 00000000..d330997c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-iterator/valid-iterable.js @@ -0,0 +1,8 @@ +'use strict'; + +var isIterable = require('./is-iterable'); + +module.exports = function (value) { + if (!isIterable(value)) throw new TypeError(value + " is not iterable"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/.lint new file mode 100644 index 00000000..cf54d815 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/.lint @@ -0,0 +1,11 @@ +@root + +module + +tabs +indent 2 +maxlen 100 + +ass +nomen +plusplus diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/.travis.yml new file mode 100644 index 00000000..4c4accb6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+es6-set@medikoo.com + +script: "npm test && npm run lint" diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/CHANGES new file mode 100644 index 00000000..79603bf8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/CHANGES @@ -0,0 +1,18 @@ +v0.1.1 -- 2014.10.07 +* Fix isImplemented so it validates native Set properly +* Add getFirst and getLast extensions +* Configure linter scripts + +v0.1.0 -- 2014.04.29 +* Assure strictly npm hosted dependencies +* Introduce faster 'primitive' alternative (doesn't guarantee order of iteration) +* Add isNativeImplemented, and some, every and copy method extensions +* If native Set is provided polyfill extends it +* Optimize forEach iteration +* Remove comparator support (as it was removed from spec) +* Provide @@toStringTag symbol, ad @@iterator symbols on iterators +* Update to use latest dependencies versions +* Improve interals + +v0.0.0 -- 2013.10.12 +Initial (dev) version diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/LICENCE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/LICENCE new file mode 100644 index 00000000..aaf35282 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/LICENCE @@ -0,0 +1,19 @@ +Copyright (C) 2013 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/README.md new file mode 100644 index 00000000..95e9d358 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/README.md @@ -0,0 +1,71 @@ +# es6-set +## Set collection as specified in ECMAScript6 + +### Usage + +If you want to make sure your environment implements `Set`, do: + +```javascript +require('es6-set/implement'); +``` + +If you'd like to use native version when it exists and fallback to polyfill if it doesn't, but without implementing `Set` on global scope, do: + +```javascript +var Set = require('es6-set'); +``` + +If you strictly want to use polyfill even if native `Set` exists, do: + +```javascript +var Set = require('es6-set/polyfill'); +``` + +### Installation + + $ npm install es6-set + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +#### API + +Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-objects). Still if you want quick look, follow examples: + +```javascript +var Set = require('es6-set'); + +var set = new Set(['raz', 'dwa', {}]); + +set.size; // 3 +set.has('raz'); // true +set.has('foo'); // false +set.add('foo'); // set +set.size // 4 +set.has('foo'); // true +set.has('dwa'); // true +set.delete('dwa'); // true +set.size; // 3 + +set.forEach(function (value) { + // 'raz', {}, 'foo' iterated +}); + +// FF nightly only: +for (value of set) { + // 'raz', {}, 'foo' iterated +} + +var iterator = set.values(); + +iterator.next(); // { done: false, value: 'raz' } +iterator.next(); // { done: false, value: {} } +iterator.next(); // { done: false, value: 'foo' } +iterator.next(); // { done: true, value: undefined } + +set.clear(); // undefined +set.size; // 0 +``` + +## Tests [![Build Status](https://travis-ci.org/medikoo/es6-set.png)](https://travis-ci.org/medikoo/es6-set) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/copy.js new file mode 100644 index 00000000..a8fd5c20 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/copy.js @@ -0,0 +1,5 @@ +'use strict'; + +var Set = require('../'); + +module.exports = function () { return new Set(this); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/every.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/every.js new file mode 100644 index 00000000..ea64ebc5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/every.js @@ -0,0 +1,18 @@ +'use strict'; + +var callable = require('es5-ext/object/valid-callable') + , forOf = require('es6-iterator/for-of') + + , call = Function.prototype.call; + +module.exports = function (cb/*, thisArg*/) { + var thisArg = arguments[1], result = true; + callable(cb); + forOf(this, function (value, doBreak) { + if (!call.call(cb, thisArg, value)) { + result = false; + doBreak(); + } + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/get-first.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/get-first.js new file mode 100644 index 00000000..b5d89fc1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/get-first.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return this.values().next().value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/get-last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/get-last.js new file mode 100644 index 00000000..d22ce737 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/get-last.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function () { + var value, iterator = this.values(), item; + while (true) { + item = iterator.next(); + if (item.done) break; + value = item.value; + } + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/some.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/some.js new file mode 100644 index 00000000..400a5a0c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/ext/some.js @@ -0,0 +1,18 @@ +'use strict'; + +var callable = require('es5-ext/object/valid-callable') + , forOf = require('es6-iterator/for-of') + + , call = Function.prototype.call; + +module.exports = function (cb/*, thisArg*/) { + var thisArg = arguments[1], result = false; + callable(cb); + forOf(this, function (value, doBreak) { + if (call.call(cb, thisArg, value)) { + result = true; + doBreak(); + } + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/implement.js new file mode 100644 index 00000000..f03362e0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(require('es5-ext/global'), 'Set', + { value: require('./polyfill'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/index.js new file mode 100644 index 00000000..daa78861 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? Set : require('./polyfill'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/is-implemented.js new file mode 100644 index 00000000..d8b0cd7d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/is-implemented.js @@ -0,0 +1,22 @@ +'use strict'; + +module.exports = function () { + var set, iterator, result; + if (typeof Set !== 'function') return false; + set = new Set(['raz', 'dwa', 'trzy']); + if (set.size !== 3) return false; + if (typeof set.add !== 'function') return false; + if (typeof set.clear !== 'function') return false; + if (typeof set.delete !== 'function') return false; + if (typeof set.entries !== 'function') return false; + if (typeof set.forEach !== 'function') return false; + if (typeof set.has !== 'function') return false; + if (typeof set.keys !== 'function') return false; + if (typeof set.values !== 'function') return false; + + iterator = set.values(); + result = iterator.next(); + if (result.done !== false) return false; + if (result.value !== 'raz') return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/is-native-implemented.js new file mode 100644 index 00000000..e8b0160e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/is-native-implemented.js @@ -0,0 +1,9 @@ +// Exports true if environment provides native `Set` implementation, +// whatever that is. + +'use strict'; + +module.exports = (function () { + if (typeof Set === 'undefined') return false; + return (Object.prototype.toString.call(Set.prototype) === '[object Set]'); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/is-set.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/is-set.js new file mode 100644 index 00000000..19e47929 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/is-set.js @@ -0,0 +1,12 @@ +'use strict'; + +var toString = Object.prototype.toString + , toStringTagSymbol = require('es6-symbol').toStringTag + + , id = '[object Set]' + , Global = (typeof Set === 'undefined') ? null : Set; + +module.exports = function (x) { + return (x && ((Global && (x instanceof Global)) || + (toString.call(x) === id) || (x[toStringTagSymbol] === 'Set'))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/lib/iterator.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/lib/iterator.js new file mode 100644 index 00000000..4a7dac7e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/lib/iterator.js @@ -0,0 +1,31 @@ +'use strict'; + +var setPrototypeOf = require('es5-ext/object/set-prototype-of') + , contains = require('es5-ext/string/#/contains') + , d = require('d') + , Iterator = require('es6-iterator') + , toStringTagSymbol = require('es6-symbol').toStringTag + + , defineProperty = Object.defineProperty + , SetIterator; + +SetIterator = module.exports = function (set, kind) { + if (!(this instanceof SetIterator)) return new SetIterator(set, kind); + Iterator.call(this, set.__setData__, set); + if (!kind) kind = 'value'; + else if (contains.call(kind, 'key+value')) kind = 'key+value'; + else kind = 'value'; + defineProperty(this, '__kind__', d('', kind)); +}; +if (setPrototypeOf) setPrototypeOf(SetIterator, Iterator); + +SetIterator.prototype = Object.create(Iterator.prototype, { + constructor: d(SetIterator), + _resolve: d(function (i) { + if (this.__kind__ === 'value') return this.__list__[i]; + return [this.__list__[i], this.__list__[i]]; + }), + toString: d(function () { return '[object Set Iterator]'; }) +}); +defineProperty(SetIterator.prototype, toStringTagSymbol, + d('c', 'Set Iterator')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/lib/primitive-iterator.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/lib/primitive-iterator.js new file mode 100644 index 00000000..1f0326a3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/lib/primitive-iterator.js @@ -0,0 +1,53 @@ +'use strict'; + +var clear = require('es5-ext/array/#/clear') + , assign = require('es5-ext/object/assign') + , setPrototypeOf = require('es5-ext/object/set-prototype-of') + , contains = require('es5-ext/string/#/contains') + , d = require('d') + , autoBind = require('d/auto-bind') + , Iterator = require('es6-iterator') + , toStringTagSymbol = require('es6-symbol').toStringTag + + , defineProperties = Object.defineProperties, keys = Object.keys + , unBind = Iterator.prototype._unBind + , PrimitiveSetIterator; + +PrimitiveSetIterator = module.exports = function (set, kind) { + if (!(this instanceof PrimitiveSetIterator)) { + return new PrimitiveSetIterator(set, kind); + } + Iterator.call(this, keys(set.__setData__), set); + kind = (!kind || !contains.call(kind, 'key+value')) ? 'value' : 'key+value'; + defineProperties(this, { + __kind__: d('', kind), + __data__: d('w', set.__setData__) + }); +}; +if (setPrototypeOf) setPrototypeOf(PrimitiveSetIterator, Iterator); + +PrimitiveSetIterator.prototype = Object.create(Iterator.prototype, assign({ + constructor: d(PrimitiveSetIterator), + _resolve: d(function (i) { + var value = this.__data__[this.__list__[i]]; + return (this.__kind__ === 'value') ? value : [value, value]; + }), + _unBind: d(function () { + this.__data__ = null; + unBind.call(this); + }), + toString: d(function () { return '[object Set Iterator]'; }) +}, autoBind({ + _onAdd: d(function (key) { this.__list__.push(key); }), + _onDelete: d(function (key) { + var index = this.__list__.lastIndexOf(key); + if (index < this.__nextIndex__) return; + this.__list__.splice(index, 1); + }), + _onClear: d(function () { + clear.call(this.__list__); + this.__nextIndex__ = 0; + }) +}))); +Object.defineProperty(PrimitiveSetIterator.prototype, toStringTagSymbol, + d('c', 'Set Iterator')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/package.json new file mode 100644 index 00000000..dd172092 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/package.json @@ -0,0 +1,66 @@ +{ + "name": "es6-set", + "version": "0.1.1", + "description": "ECMAScript6 Set polyfill", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "set", + "collection", + "es6", + "harmony", + "list", + "hash" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es6-set.git" + }, + "dependencies": { + "d": "~0.1.1", + "es5-ext": "~0.10.4", + "es6-iterator": "~0.1.1", + "es6-symbol": "~0.1.1", + "event-emitter": "~0.3.1" + }, + "devDependencies": { + "tad": "0.2.x", + "xlint": "~0.2.1", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "769f7391b194b25900a79d132d21f4abefb14201", + "bugs": { + "url": "https://github.com/medikoo/es6-set/issues" + }, + "homepage": "https://github.com/medikoo/es6-set", + "_id": "es6-set@0.1.1", + "_shasum": "497cd235c9a2691f4caa0e33dd73ef86bde738ac", + "_from": "es6-set@>=0.1.1 <0.2.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "497cd235c9a2691f4caa0e33dd73ef86bde738ac", + "tarball": "http://registry.npmjs.org/es6-set/-/es6-set-0.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/polyfill.js new file mode 100644 index 00000000..d272429f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/polyfill.js @@ -0,0 +1,79 @@ +'use strict'; + +var clear = require('es5-ext/array/#/clear') + , eIndexOf = require('es5-ext/array/#/e-index-of') + , setPrototypeOf = require('es5-ext/object/set-prototype-of') + , callable = require('es5-ext/object/valid-callable') + , d = require('d') + , ee = require('event-emitter') + , Symbol = require('es6-symbol') + , iterator = require('es6-iterator/valid-iterable') + , forOf = require('es6-iterator/for-of') + , Iterator = require('./lib/iterator') + , isNative = require('./is-native-implemented') + + , call = Function.prototype.call, defineProperty = Object.defineProperty + , SetPoly, getValues; + +module.exports = SetPoly = function (/*iterable*/) { + var iterable = arguments[0]; + if (!(this instanceof SetPoly)) return new SetPoly(iterable); + if (this.__setData__ !== undefined) { + throw new TypeError(this + " cannot be reinitialized"); + } + if (iterable != null) iterator(iterable); + defineProperty(this, '__setData__', d('c', [])); + if (!iterable) return; + forOf(iterable, function (value) { + if (eIndexOf.call(this, value) !== -1) return; + this.push(value); + }, this.__setData__); +}; + +if (isNative) { + if (setPrototypeOf) setPrototypeOf(SetPoly, Set); + SetPoly.prototype = Object.create(Set.prototype, { + constructor: d(SetPoly) + }); +} + +ee(Object.defineProperties(SetPoly.prototype, { + add: d(function (value) { + if (this.has(value)) return this; + this.emit('_add', this.__setData__.push(value) - 1, value); + return this; + }), + clear: d(function () { + if (!this.__setData__.length) return; + clear.call(this.__setData__); + this.emit('_clear'); + }), + delete: d(function (value) { + var index = eIndexOf.call(this.__setData__, value); + if (index === -1) return false; + this.__setData__.splice(index, 1); + this.emit('_delete', index, value); + return true; + }), + entries: d(function () { return new Iterator(this, 'key+value'); }), + forEach: d(function (cb/*, thisArg*/) { + var thisArg = arguments[1], iterator, result, value; + callable(cb); + iterator = this.values(); + result = iterator._next(); + while (result !== undefined) { + value = iterator._resolve(result); + call.call(cb, thisArg, value, value, this); + result = iterator._next(); + } + }), + has: d(function (value) { + return (eIndexOf.call(this.__setData__, value) !== -1); + }), + keys: d(getValues = function () { return this.values(); }), + size: d.gs(function () { return this.__setData__.length; }), + values: d(function () { return new Iterator(this); }), + toString: d(function () { return '[object Set]'; }) +})); +defineProperty(SetPoly.prototype, Symbol.iterator, d(getValues)); +defineProperty(SetPoly.prototype, Symbol.toStringTag, d('c', 'Set')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/primitive/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/primitive/index.js new file mode 100644 index 00000000..4565887d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/primitive/index.js @@ -0,0 +1,88 @@ +'use strict'; + +var callable = require('es5-ext/object/valid-callable') + , clear = require('es5-ext/object/clear') + , setPrototypeOf = require('es5-ext/object/set-prototype-of') + , d = require('d') + , iterator = require('es6-iterator/valid-iterable') + , forOf = require('es6-iterator/for-of') + , Set = require('../polyfill') + , Iterator = require('../lib/primitive-iterator') + + , create = Object.create, defineProperties = Object.defineProperties + , defineProperty = Object.defineProperty + , hasOwnProperty = Object.prototype.hasOwnProperty + , PrimitiveSet; + +module.exports = PrimitiveSet = function (/*iterable, serialize*/) { + var iterable = arguments[0], serialize = arguments[1]; + if (!(this instanceof PrimitiveSet)) { + return new PrimitiveSet(iterable, serialize); + } + if (this.__setData__ !== undefined) { + throw new TypeError(this + " cannot be reinitialized"); + } + if (iterable != null) iterator(iterable); + if (serialize !== undefined) { + callable(serialize); + defineProperty(this, '_serialize', d('', serialize)); + } + defineProperties(this, { + __setData__: d('c', create(null)), + __size__: d('w', 0) + }); + if (!iterable) return; + forOf(iterable, function (value) { + var key = this._serialize(value); + if (key == null) throw new TypeError(value + " cannot be serialized"); + if (hasOwnProperty.call(this.__setData__, key)) return; + this.__setData__[key] = value; + ++this.__size__; + }, this); +}; +if (setPrototypeOf) setPrototypeOf(PrimitiveSet, Set); + +PrimitiveSet.prototype = create(Set.prototype, { + constructor: d(PrimitiveSet), + _serialize: d(function (value) { + if (value && (typeof value.toString !== 'function')) return null; + return String(value); + }), + add: d(function (value) { + var key = this._serialize(value); + if (key == null) throw new TypeError(value + " cannot be serialized"); + if (hasOwnProperty.call(this.__setData__, key)) return this; + this.__setData__[key] = value; + ++this.__size__; + this.emit('_add', key); + return this; + }), + clear: d(function () { + if (!this.__size__) return; + clear(this.__setData__); + this.__size__ = 0; + this.emit('_clear'); + }), + delete: d(function (value) { + var key = this._serialize(value); + if (key == null) return false; + if (!hasOwnProperty.call(this.__setData__, key)) return false; + delete this.__setData__[key]; + --this.__size__; + this.emit('_delete', key); + return true; + }), + entries: d(function () { return new Iterator(this, 'key+value'); }), + get: d(function (key) { + key = this._serialize(key); + if (key == null) return; + return this.__setData__[key]; + }), + has: d(function (value) { + var key = this._serialize(value); + if (key == null) return false; + return hasOwnProperty.call(this.__setData__, key); + }), + size: d.gs(function () { return this.__size__; }), + values: d(function () { return new Iterator(this); }) +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/copy.js new file mode 100644 index 00000000..84fe912a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/copy.js @@ -0,0 +1,12 @@ +'use strict'; + +var toArray = require('es5-ext/array/to-array') + , Set = require('../../'); + +module.exports = function (t, a) { + var content = ['raz', 2, true], set = new Set(content), copy; + + copy = t.call(set); + a.not(copy, set, "Copy"); + a.deep(toArray(copy), content, "Content"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/every.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/every.js new file mode 100644 index 00000000..f56ca385 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/every.js @@ -0,0 +1,9 @@ +'use strict'; + +var Set = require('../../'); + +module.exports = function (t, a) { + a(t.call(new Set(), Boolean), true, "Empty set"); + a(t.call(new Set([2, 3, 4]), Boolean), true, "Truthy"); + a(t.call(new Set([2, 0, 4]), Boolean), false, "Falsy"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/get-first.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/get-first.js new file mode 100644 index 00000000..f99829e5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/get-first.js @@ -0,0 +1,12 @@ +'use strict'; + +var Set = require('../../'); + +module.exports = function (t, a) { + var content = ['raz', 2, true], set = new Set(content); + + a(t.call(set), 'raz'); + + set = new Set(); + a(t.call(set), undefined); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/get-last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/get-last.js new file mode 100644 index 00000000..1dcc993e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/get-last.js @@ -0,0 +1,12 @@ +'use strict'; + +var Set = require('../../'); + +module.exports = function (t, a) { + var content = ['raz', 2, true], set = new Set(content); + + a(t.call(set), true); + + set = new Set(); + a(t.call(set), undefined); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/some.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/some.js new file mode 100644 index 00000000..84ce1191 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/ext/some.js @@ -0,0 +1,10 @@ +'use strict'; + +var Set = require('../../'); + +module.exports = function (t, a) { + a(t.call(new Set(), Boolean), false, "Empty set"); + a(t.call(new Set([2, 3, 4]), Boolean), true, "All true"); + a(t.call(new Set([0, false, 4]), Boolean), true, "Some false"); + a(t.call(new Set([0, false, null]), Boolean), false, "All false"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/implement.js new file mode 100644 index 00000000..4882d378 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/implement.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof Set, 'function'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/index.js new file mode 100644 index 00000000..19c64865 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (T, a) { a((new T(['raz', 'dwa'])).size, 2); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/is-implemented.js new file mode 100644 index 00000000..124793e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +var global = require('es5-ext/global') + , polyfill = require('../polyfill'); + +module.exports = function (t, a) { + var cache; + a(typeof t(), 'boolean'); + cache = global.Set; + global.Set = polyfill; + a(t(), true); + if (cache === undefined) delete global.Set; + else global.Set = cache; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/is-native-implemented.js new file mode 100644 index 00000000..df8ba032 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/is-native-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t, 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/is-set.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/is-set.js new file mode 100644 index 00000000..c969cce2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/is-set.js @@ -0,0 +1,16 @@ +'use strict'; + +var SetPoly = require('../polyfill'); + +module.exports = function (t, a) { + a(t(undefined), false, "Undefined"); + a(t(null), false, "Null"); + a(t(true), false, "Primitive"); + a(t('raz'), false, "String"); + a(t({}), false, "Object"); + a(t([]), false, "Array"); + if (typeof Set !== 'undefined') { + a(t(new Set()), true, "Native"); + } + a(t(new SetPoly()), true, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/lib/iterator.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/lib/iterator.js new file mode 100644 index 00000000..9e5cfb91 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/lib/iterator.js @@ -0,0 +1,13 @@ +'use strict'; + +var Set = require('../../polyfill') + , toArray = require('es5-ext/array/to-array'); + +module.exports = function (T, a) { + var set = new Set(['raz', 'dwa']); + + a.deep(toArray(new T(set)), ['raz', 'dwa'], "Default"); + a.deep(toArray(new T(set, 'key+value')), [['raz', 'raz'], ['dwa', 'dwa']], + "Key & Value"); + a.deep(toArray(new T(set, 'value')), ['raz', 'dwa'], "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/lib/primitive-iterator.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/lib/primitive-iterator.js new file mode 100644 index 00000000..2a4956b8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/lib/primitive-iterator.js @@ -0,0 +1,113 @@ +'use strict'; + +var Set = require('../../primitive') + , toArray = require('es5-ext/array/to-array') + , iteratorSymbol = require('es6-symbol').iterator + + , compare, map; + +compare = function (a, b) { + if (!a.value) return -1; + if (!b.value) return 1; + return a.value.localeCompare(b.value); +}; + +map = function (arr) { + return arr.sort().map(function (value) { + return { done: false, value: value }; + }); +}; + +module.exports = function (T) { + return { + "": function (a) { + var arr = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], it, y, z + , set = new Set(arr), result = []; + + it = new T(set); + a(it[iteratorSymbol](), it, "@@iterator"); + y = it.next(); + result.push(y); + z = it.next(); + a.not(y, z, "Recreate result"); + result.push(z); + result.push(it.next()); + result.push(it.next()); + result.push(it.next()); + a.deep(result.sort(compare), map(arr)); + a.deep(y = it.next(), { done: true, value: undefined }, "End"); + a.not(y, it.next(), "Recreate result on dead"); + }, + Emited: function (a) { + var arr = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], it + , set = new Set(arr), result = []; + + it = new T(set); + result.push(it.next()); + result.push(it.next()); + set.add('sześć'); + arr.push('sześć'); + result.push(it.next()); + set.delete('pięć'); + arr.splice(4, 1); + result.push(it.next()); + result.push(it.next()); + a.deep(result.sort(compare), map(arr)); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited #2": function (a) { + var arr = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it + , set = new Set(arr), result = []; + + it = new T(set); + result.push(it.next()); + result.push(it.next()); + set.add('siedem'); + set.delete('siedem'); + result.push(it.next()); + result.push(it.next()); + set.delete('pięć'); + arr.splice(4, 1); + result.push(it.next()); + a.deep(result.sort(compare), map(arr)); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited: Clear #1": function (a) { + var arr = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it + , set = new Set(arr), result = []; + + it = new T(set); + result.push(it.next()); + result.push(it.next()); + arr = ['raz', 'dwa']; + set.clear(); + a.deep(result.sort(compare), map(arr)); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited: Clear #2": function (a) { + var arr = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it + , set = new Set(arr), result = []; + + it = new T(set); + result.push(it.next()); + result.push(it.next()); + set.clear(); + set.add('foo'); + set.add('bar'); + arr = ['raz', 'dwa', 'foo', 'bar']; + result.push(it.next()); + result.push(it.next()); + a.deep(result.sort(compare), map(arr)); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + Kinds: function (a) { + var set = new Set(['raz', 'dwa']); + + a.deep(toArray(new T(set)).sort(), ['raz', 'dwa'].sort(), "Default"); + a.deep(toArray(new T(set, 'key+value')).sort(), + [['raz', 'raz'], ['dwa', 'dwa']].sort(), "Key & Value"); + a.deep(toArray(new T(set, 'value')).sort(), ['raz', 'dwa'].sort(), + "Other"); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/polyfill.js new file mode 100644 index 00000000..10ce6d39 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/polyfill.js @@ -0,0 +1,44 @@ +'use strict'; + +var aFrom = require('es5-ext/array/from') + , toArray = require('es5-ext/array/to-array'); + +module.exports = function (T, a) { + var arr = ['raz', 'dwa', 'trzy'], set = new T(arr), x = {}, y = {}, i = 0; + + a(set instanceof T, true, "Set"); + a(set.size, 3, "Size"); + a(set.has('raz'), true, "Has: true"); + a(set.has(x), false, "Has: false"); + a(set.add(x), set, "Add: return"); + a(set.has(x), true, "Add"); + a(set.size, 4, "Add: Size"); + a(set.delete({}), false, "Delete: false"); + + arr.push(x); + set.forEach(function () { + a.deep(aFrom(arguments), [arr[i], arr[i], set], + "ForEach: Arguments: #" + i); + a(this, y, "ForEach: Context: #" + i); + if (i === 0) { + a(set.delete('raz'), true, "Delete: true"); + a(set.has('raz'), false, "Delete"); + a(set.size, 3, "Delete: size"); + set.add('cztery'); + arr.push('cztery'); + } + i++; + }, y); + arr.splice(0, 1); + + a.deep(toArray(set.entries()), [['dwa', 'dwa'], ['trzy', 'trzy'], [x, x], + ['cztery', 'cztery']], "Entries"); + a.deep(toArray(set.keys()), ['dwa', 'trzy', x, 'cztery'], "Keys"); + a.deep(toArray(set.values()), ['dwa', 'trzy', x, 'cztery'], "Values"); + a.deep(toArray(set), ['dwa', 'trzy', x, 'cztery'], "Iterator"); + + set.clear(); + a(set.size, 0, "Clear: size"); + a(set.has('trzy'), false, "Clear: has"); + a.deep(toArray(set), [], "Clear: Values"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/primitive/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/primitive/index.js new file mode 100644 index 00000000..54765d2a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/primitive/index.js @@ -0,0 +1,44 @@ +'use strict'; + +var aFrom = require('es5-ext/array/from') + , getIterator = require('es6-iterator/get') + , toArray = require('es5-ext/array/to-array'); + +module.exports = function (T, a) { + var arr = ['raz', 'dwa', 'trzy'], set = new T(arr), x = 'other', y = 'other2' + , i = 0, result = []; + + a(set instanceof T, true, "Set"); + a(set.size, 3, "Size"); + a(set.has('raz'), true, "Has: true"); + a(set.has(x), false, "Has: false"); + a(set.add(x), set, "Add: return"); + a(set.has(x), true, "Add"); + a(set.size, 4, "Add: Size"); + a(set.delete('else'), false, "Delete: false"); + a(set.get('raz'), 'raz', "Get"); + + arr.push(x); + set.forEach(function () { + result.push(aFrom(arguments)); + a(this, y, "ForEach: Context: #" + i); + }, y); + + a.deep(result.sort(function (a, b) { + return a[0].localeCompare(b[0]); + }), arr.sort().map(function (val) { return [val, val, set]; })); + + a.deep(toArray(set.entries()).sort(), [['dwa', 'dwa'], ['trzy', 'trzy'], + [x, x], ['raz', 'raz']].sort(), "Entries"); + a.deep(toArray(set.keys()).sort(), ['dwa', 'trzy', x, 'raz'].sort(), + "Keys"); + a.deep(toArray(set.values()).sort(), ['dwa', 'trzy', x, 'raz'].sort(), + "Values"); + a.deep(toArray(getIterator(set)).sort(), ['dwa', 'trzy', x, 'raz'].sort(), + "Iterator"); + + set.clear(); + a(set.size, 0, "Clear: size"); + a(set.has('trzy'), false, "Clear: has"); + a.deep(toArray(set.values()), [], "Clear: Values"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/valid-set.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/valid-set.js new file mode 100644 index 00000000..8c71f5f8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/test/valid-set.js @@ -0,0 +1,19 @@ +'use strict'; + +var SetPoly = require('../polyfill'); + +module.exports = function (t, a) { + var set; + a.throws(function () { t(undefined); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.throws(function () { t(true); }, TypeError, "Primitive"); + a.throws(function () { t('raz'); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Object"); + a.throws(function () { t([]); }, TypeError, "Array"); + if (typeof Set !== 'undefined') { + set = new Set(); + a(t(set), set, "Native"); + } + set = new SetPoly(); + a(t(set), set, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/valid-set.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/valid-set.js new file mode 100644 index 00000000..9336fd35 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-set/valid-set.js @@ -0,0 +1,8 @@ +'use strict'; + +var isSet = require('./is-set'); + +module.exports = function (x) { + if (!isSet(x)) throw new TypeError(x + " is not a Set"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/.lint new file mode 100644 index 00000000..701a50ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/.lint @@ -0,0 +1,13 @@ +@root + +module + +tabs +indent 2 +maxlen 80 + +ass +nomen +plusplus + +newcap diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/.travis.yml new file mode 100644 index 00000000..afd3509a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+es6-symbol@medikoo.com diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/CHANGES new file mode 100644 index 00000000..ff5e1b48 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/CHANGES @@ -0,0 +1,12 @@ +v0.1.1 -- 2014.10.07 +* Fix isImplemented, so it returns true in case of polyfill +* Improve documentations + +v0.1.0 -- 2014.04.28 +* Assure strictly npm dependencies +* Update to use latest versions of dependencies +* Fix implementation detection so it doesn't crash on `String(symbol)` +* throw on `new Symbol()` (as decided by TC39) + +v0.0.0 -- 2013.11.15 +* Initial (dev) version \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/LICENCE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/LICENCE new file mode 100644 index 00000000..aaf35282 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/LICENCE @@ -0,0 +1,19 @@ +Copyright (C) 2013 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/README.md new file mode 100644 index 00000000..978eb59d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/README.md @@ -0,0 +1,67 @@ +# es6-symbol +## ECMAScript6 Symbol polyfill + +### Limitations + +- Underneath it uses real string property names which can easily be retrieved (however accidental collision with other property names is unlikely) +- As it needs custom `toString` behavior to work properly. Original `Symbol.prototype.toString` couldn't be implemented as specified, still it's accessible as `Symbol.prototoype.properToString` + +### Usage + +If you want to make sure your environment implements `Symbol`, do: + +```javascript +require('es6-symbol/implement'); +``` + +If you'd like to use native version when it exists and fallback to polyfill if it doesn't, but without implementing `Symbol` on global scope, do: + +```javascript +var Symbol = require('es6-symbol'); +``` + +If you strictly want to use polyfill even if native `Symbol` exists (hard to find a good reason for that), do: + +```javascript +var Symbol = require('es6-symbol/polyfill'); +``` + +#### API + +Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-objects). Still if you want quick look, follow examples: + +```javascript +var Symbol = require('es6-symbol'); + +var symbol = Symbol('My custom symbol'); +var x = {}; + +x[symbol] = 'foo'; +console.log(x[symbol]); 'foo' + +// Detect iterable: +var iterator, result; +if (possiblyIterable[Symbol.iterator]) { + iterator = possiblyIterable[Symbol.iterator](); + result = iterator.next(); + while(!result.done) { + console.log(result.value); + result = iterator.next(); + } +} +``` + +### Installation +#### NPM + +In your project path: + + $ npm install es6-symbol + +##### Browser + +You can easily bundle _es6-symbol_ for browser with [modules-webmake](https://github.com/medikoo/modules-webmake) + +## Tests [![Build Status](https://travis-ci.org/medikoo/es6-symbol.png)](https://travis-ci.org/medikoo/es6-symbol) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/implement.js new file mode 100644 index 00000000..153edacd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(require('es5-ext/global'), 'Symbol', + { value: require('./polyfill'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/index.js new file mode 100644 index 00000000..609f1faf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? Symbol : require('./polyfill'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/is-implemented.js new file mode 100644 index 00000000..02a06b5a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/is-implemented.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = function () { + var symbol; + if (typeof Symbol !== 'function') return false; + symbol = Symbol('test symbol'); + try { String(symbol); } catch (e) { return false; } + if (typeof Symbol.iterator === 'symbol') return true; + + // Return 'true' for polyfills + if (typeof Symbol.isConcatSpreadable !== 'object') return false; + if (typeof Symbol.isRegExp !== 'object') return false; + if (typeof Symbol.iterator !== 'object') return false; + if (typeof Symbol.toPrimitive !== 'object') return false; + if (typeof Symbol.toStringTag !== 'object') return false; + if (typeof Symbol.unscopables !== 'object') return false; + + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/is-native-implemented.js new file mode 100644 index 00000000..a8cb8b86 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/is-native-implemented.js @@ -0,0 +1,8 @@ +// Exports true if environment provides native `Symbol` implementation + +'use strict'; + +module.exports = (function () { + if (typeof Symbol !== 'function') return false; + return (typeof Symbol.iterator === 'symbol'); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/is-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/is-symbol.js new file mode 100644 index 00000000..dcf72c9a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/is-symbol.js @@ -0,0 +1,12 @@ +'use strict'; + +var toString = Object.prototype.toString + , toStringTag = require('./').toStringTag + + , id = '[object Symbol]' + , Global = (typeof Symbol === 'undefined') ? null : Symbol; + +module.exports = function (x) { + return (x && ((Global && (x instanceof Global)) || + (toString.call(x) === id) || (x[toStringTag] === 'Symbol'))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/package.json new file mode 100644 index 00000000..a6ddc1a4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/package.json @@ -0,0 +1,59 @@ +{ + "name": "es6-symbol", + "version": "0.1.1", + "description": "ECMAScript6 Symbol polyfill", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "symbol", + "private", + "property", + "es6", + "ecmascript", + "harmony" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es6-symbol.git" + }, + "dependencies": { + "d": "~0.1.1", + "es5-ext": "~0.10.4" + }, + "devDependencies": { + "tad": "0.2.x" + }, + "scripts": { + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "2ca76a05feafaa14c838337722562625fb5072b4", + "bugs": { + "url": "https://github.com/medikoo/es6-symbol/issues" + }, + "homepage": "https://github.com/medikoo/es6-symbol", + "_id": "es6-symbol@0.1.1", + "_shasum": "9cf7fab2edaff1b1da8fe8e68bfe3f5aca6ca218", + "_from": "es6-symbol@>=0.1.1 <0.2.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "9cf7fab2edaff1b1da8fe8e68bfe3f5aca6ca218", + "tarball": "http://registry.npmjs.org/es6-symbol/-/es6-symbol-0.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-0.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/polyfill.js new file mode 100644 index 00000000..f7dfa258 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/polyfill.js @@ -0,0 +1,53 @@ +'use strict'; + +var d = require('d') + + , create = Object.create, defineProperties = Object.defineProperties + , generateName, Symbol; + +generateName = (function () { + var created = create(null); + return function (desc) { + var postfix = 0; + while (created[desc + (postfix || '')]) ++postfix; + desc += (postfix || ''); + created[desc] = true; + return '@@' + desc; + }; +}()); + +module.exports = Symbol = function (description) { + var symbol; + if (this instanceof Symbol) { + throw new TypeError('TypeError: Symbol is not a constructor'); + } + symbol = create(Symbol.prototype); + description = (description === undefined ? '' : String(description)); + return defineProperties(symbol, { + __description__: d('', description), + __name__: d('', generateName(description)) + }); +}; + +Object.defineProperties(Symbol, { + create: d('', Symbol('create')), + hasInstance: d('', Symbol('hasInstance')), + isConcatSpreadable: d('', Symbol('isConcatSpreadable')), + isRegExp: d('', Symbol('isRegExp')), + iterator: d('', Symbol('iterator')), + toPrimitive: d('', Symbol('toPrimitive')), + toStringTag: d('', Symbol('toStringTag')), + unscopables: d('', Symbol('unscopables')) +}); + +defineProperties(Symbol.prototype, { + properToString: d(function () { + return 'Symbol (' + this.__description__ + ')'; + }), + toString: d('', function () { return this.__name__; }) +}); +Object.defineProperty(Symbol.prototype, Symbol.toPrimitive, d('', + function (hint) { + throw new TypeError("Conversion of symbol objects is not allowed"); + })); +Object.defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/implement.js new file mode 100644 index 00000000..eb35c301 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/implement.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof Symbol, 'function'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/index.js new file mode 100644 index 00000000..62b3296d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var d = require('d') + + , defineProperty = Object.defineProperty; + +module.exports = function (T, a) { + var symbol = T('test'), x = {}; + defineProperty(x, symbol, d('foo')); + a(x.test, undefined, "Name"); + a(x[symbol], 'foo', "Get"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/is-implemented.js new file mode 100644 index 00000000..bb0d6453 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +var global = require('es5-ext/global') + , polyfill = require('../polyfill'); + +module.exports = function (t, a) { + var cache; + a(typeof t(), 'boolean'); + cache = global.Symbol; + global.Symbol = polyfill; + a(t(), true); + if (cache === undefined) delete global.Symbol; + else global.Symbol = cache; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/is-native-implemented.js new file mode 100644 index 00000000..df8ba032 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/is-native-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t, 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/is-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/is-symbol.js new file mode 100644 index 00000000..ac24b9ab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/is-symbol.js @@ -0,0 +1,16 @@ +'use strict'; + +var SymbolPoly = require('../polyfill'); + +module.exports = function (t, a) { + a(t(undefined), false, "Undefined"); + a(t(null), false, "Null"); + a(t(true), false, "Primitive"); + a(t('raz'), false, "String"); + a(t({}), false, "Object"); + a(t([]), false, "Array"); + if (typeof Symbol !== 'undefined') { + a(t(Symbol()), true, "Native"); + } + a(t(SymbolPoly()), true, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/polyfill.js new file mode 100644 index 00000000..cac9cd51 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/polyfill.js @@ -0,0 +1,17 @@ +'use strict'; + +var d = require('d') + , isSymbol = require('../is-symbol') + + , defineProperty = Object.defineProperty; + +module.exports = function (T, a) { + var symbol = T('test'), x = {}; + defineProperty(x, symbol, d('foo')); + a(x.test, undefined, "Name"); + a(x[symbol], 'foo', "Get"); + + a(isSymbol(symbol), true, "Symbol"); + a(isSymbol(T.iterator), true, "iterator"); + a(isSymbol(T.toStringTag), true, "toStringTag"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/valid-iterable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/valid-iterable.js new file mode 100644 index 00000000..d277bc97 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/valid-iterable.js @@ -0,0 +1,14 @@ +'use strict'; + +var Iterator = require('../'); + +module.exports = function (t, a) { + var obj; + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t({}); }, TypeError, "Plain object"); + a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like"); + obj = { '@@iterator': function () { return new Iterator([]); } }; + a(t(obj), obj, "Iterator"); + obj = []; + a(t(obj), obj, 'Array'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/valid-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/valid-symbol.js new file mode 100644 index 00000000..2c8f84c8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/test/valid-symbol.js @@ -0,0 +1,19 @@ +'use strict'; + +var SymbolPoly = require('../polyfill'); + +module.exports = function (t, a) { + var symbol; + a.throws(function () { t(undefined); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.throws(function () { t(true); }, TypeError, "Primitive"); + a.throws(function () { t('raz'); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Object"); + a.throws(function () { t([]); }, TypeError, "Array"); + if (typeof Symbol !== 'undefined') { + symbol = Symbol(); + a(t(symbol), symbol, "Native"); + } + symbol = SymbolPoly(); + a(t(symbol), symbol, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/valid-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/valid-symbol.js new file mode 100644 index 00000000..42750043 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/es6-symbol/valid-symbol.js @@ -0,0 +1,8 @@ +'use strict'; + +var isSymbol = require('./is-symbol'); + +module.exports = function (value) { + if (!isSymbol(value)) throw new TypeError(value + " is not a symbol"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.lint new file mode 100644 index 00000000..f76e528e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.lint @@ -0,0 +1,15 @@ +@root + +module +es5 + +indent 2 +maxlen 80 +tabs + +ass +plusplus +nomen + +./benchmark +predef+ console diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.npmignore new file mode 100644 index 00000000..68ebfddd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.npmignore @@ -0,0 +1,3 @@ +.DS_Store +/.lintcache +/node_modules diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.testignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.testignore new file mode 100644 index 00000000..f9c8c381 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.testignore @@ -0,0 +1 @@ +/benchmark diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.travis.yml new file mode 100644 index 00000000..a6ec240d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/.travis.yml @@ -0,0 +1,14 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +before_install: + - mkdir node_modules; ln -s ../ node_modules/event-emitter + +notifications: + email: + - medikoo+event-emitter@medikoo.com + +script: "npm test && npm run lint" diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/CHANGES new file mode 100644 index 00000000..dbc1b177 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/CHANGES @@ -0,0 +1,66 @@ +v0.3.3 -- 2015.01.30 +* Fix reference to module in benchmarks + +v0.3.2 -- 2015.01.20 +* Improve documentation +* Configure lint scripts +* Fix spelling of LICENSE + +v0.3.1 -- 2014.04.25 +* Fix redefinition of emit method in `pipe` +* Allow custom emit method name in `pipe` + +v0.3.0 -- 2014.04.24 +* Move out from lib folder +* Do not expose all utilities on main module +* Support objects which do not inherit from Object.prototype +* Improve arguments validation +* Improve internals +* Remove Makefile +* Improve documentation + +v0.2.2 -- 2013.06.05 +* `unify` functionality + +v0.2.1 -- 2012.09.21 +* hasListeners module +* Simplified internal id (improves performance a little), now it starts with + underscore (hint it's private). Abstracted it to external module to have it + one place +* Documentation cleanup + +v0.2.0 -- 2012.09.19 +* Trashed poor implementation of v0.1 and came up with something solid + +Changes: +* Improved performance +* Fixed bugs event-emitter is now cross-prototype safe and not affected by + unexpected methods attached to Object.prototype +* Removed support for optional "emitter" argument in `emit` method, it was + cumbersome to use, and should be solved just with event objects + +v0.1.5 -- 2012.08.06 +* (maintanance) Do not use descriptors for internal objects, it exposes V8 bugs + (only Node v0.6 branch) + +v0.1.4 -- 2012.06.13 +* Fix detachment of listeners added with 'once' + +v0.1.3 -- 2012.05.28 +* Updated es5-ext to latest version (v0.8) +* Cleared package.json so it's in npm friendly format + +v0.1.2 -- 2012.01.22 +* Support for emitter argument in emit function, this allows some listeners not + to be notified about event +* allOff - removes all listeners from object +* All methods returns self object +* Internal fixes +* Travis CI integration + +v0.1.1 -- 2011.08.08 +* Added TAD test suite to devDependencies, configured test commands. + Tests can be run with 'make test' or 'npm test' + +v0.1.0 -- 2011.08.08 +Initial version diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/LICENSE new file mode 100644 index 00000000..ccb76f6e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2012-2015 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/README.md new file mode 100644 index 00000000..17f4524f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/README.md @@ -0,0 +1,95 @@ +# event-emitter +## Environment agnostic event emitter + +### Installation + + $ npm install event-emitter + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +### Usage + +```javascript +var ee = require('event-emitter'); + +var emitter = ee({}), listener; + +emitter.on('test', listener = function (args) { + // …emitter logic +}); + +emitter.once('test', function (args) { + // …invoked only once(!) +}); + +emitter.emit('test', arg1, arg2/*…args*/); // Two above listeners invoked +emitter.emit('test', arg1, arg2/*…args*/); // Only first listener invoked + +emitter.off('test', listener); // Removed first listener +emitter.emit('test', arg1, arg2/*…args*/); // No listeners invoked +``` +### Additional utilities + +#### allOff(obj) _(event-emitter/all-off)_ + +Removes all listeners from given event emitter object + +#### hasListeners(obj[, name]) _(event-emitter/has-listeners)_ + +Whether object has some listeners attached to the object. +When `name` is provided, it checks listeners for specific event name + +```javascript +var emitter = ee(); +var hasListeners = require('event-emitter/has-listeners'); +var listener = function () {}; + +hasListeners(emitter); // false + +emitter.on('foo', listener); +hasListeners(emitter); // true +hasListeners(emitter, 'foo'); // true +hasListeners(emitter, 'bar'); // false + +emitter.off('foo', listener); +hasListeners(emitter, 'foo'); // false +``` + +#### pipe(source, target[, emitMethodName]) _(event-emitter/pipe)_ + +Pipes all events from _source_ emitter onto _target_ emitter (all events from _source_ emitter will be emitted also on _target_ emitter, but not other way). +Returns _pipe_ object which exposes `pipe.close` function. Invoke it to close configured _pipe_. +It works internally by redefinition of `emit` method, if in your interface this method is referenced differently, provide its name (or symbol) with third argument. + +#### unify(emitter1, emitter2) _(event-emitter/unify)_ + +Unifies event handling for two objects. Events emitted on _emitter1_ would be also emitter on _emitter2_, and other way back. +Non reversible. + +```javascript +var eeUnify = require('event-emitter/unify'); + +var emitter1 = ee(), listener1, listener3; +var emitter2 = ee(), listener2, listener4; + +emitter1.on('test', listener1 = function () { }); +emitter2.on('test', listener2 = function () { }); + +emitter1.emit('test'); // Invoked listener1 +emitter2.emit('test'); // Invoked listener2 + +var unify = eeUnify(emitter1, emitter2); + +emitter1.emit('test'); // Invoked listener1 and listener2 +emitter2.emit('test'); // Invoked listener1 and listener2 + +emitter1.on('test', listener3 = function () { }); +emitter2.on('test', listener4 = function () { }); + +emitter1.emit('test'); // Invoked listener1, listener2, listener3 and listener4 +emitter2.emit('test'); // Invoked listener1, listener2, listener3 and listener4 +``` + +### Tests [![Build Status](https://travis-ci.org/medikoo/event-emitter.png)](https://travis-ci.org/medikoo/event-emitter) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/all-off.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/all-off.js new file mode 100644 index 00000000..829be65c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/all-off.js @@ -0,0 +1,19 @@ +'use strict'; + +var value = require('es5-ext/object/valid-object') + + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function (emitter/*, type*/) { + var type = arguments[1], data; + + value(emitter); + + if (type !== undefined) { + data = hasOwnProperty.call(emitter, '__ee__') && emitter.__ee__; + if (!data) return; + if (data[type]) delete data[type]; + return; + } + if (hasOwnProperty.call(emitter, '__ee__')) delete emitter.__ee__; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/benchmark/many-on.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/benchmark/many-on.js new file mode 100644 index 00000000..e09bfde8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/benchmark/many-on.js @@ -0,0 +1,83 @@ +'use strict'; + +// Benchmark comparing performance of event emit for many listeners +// To run it, do following in memoizee package path: +// +// $ npm install eventemitter2 signals +// $ node benchmark/many-on.js + +var forEach = require('es5-ext/object/for-each') + , pad = require('es5-ext/string/#/pad') + + , now = Date.now + + , time, count = 1000000, i, data = {} + , ee, native, ee2, signals, a = {}, b = {}; + +ee = (function () { + var ee = require('../')(); + ee.on('test', function () { return arguments; }); + ee.on('test', function () { return arguments; }); + return ee.on('test', function () { return arguments; }); +}()); + +native = (function () { + var ee = require('events'); + ee = new ee.EventEmitter(); + ee.on('test', function () { return arguments; }); + ee.on('test', function () { return arguments; }); + return ee.on('test', function () { return arguments; }); +}()); + +ee2 = (function () { + var ee = require('eventemitter2'); + ee = new ee.EventEmitter2(); + ee.on('test', function () { return arguments; }); + ee.on('test', function () { return arguments; }); + return ee.on('test', function () { return arguments; }); +}()); + +signals = (function () { + var Signal = require('signals') + , ee = { test: new Signal() }; + ee.test.add(function () { return arguments; }); + ee.test.add(function () { return arguments; }); + ee.test.add(function () { return arguments; }); + return ee; +}()); + +console.log("Emit for 3 listeners", "x" + count + ":\n"); + +i = count; +time = now(); +while (i--) { + ee.emit('test', a, b); +} +data["event-emitter (this implementation)"] = now() - time; + +i = count; +time = now(); +while (i--) { + native.emit('test', a, b); +} +data["EventEmitter (Node.js native)"] = now() - time; + +i = count; +time = now(); +while (i--) { + ee2.emit('test', a, b); +} +data.EventEmitter2 = now() - time; + +i = count; +time = now(); +while (i--) { + signals.test.dispatch(a, b); +} +data.Signals = now() - time; + +forEach(data, function (value, name, obj, index) { + console.log(index + 1 + ":", pad.call(value, " ", 5), name); +}, null, function (a, b) { + return this[a] - this[b]; +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/benchmark/single-on.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/benchmark/single-on.js new file mode 100644 index 00000000..99decbda --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/benchmark/single-on.js @@ -0,0 +1,73 @@ +'use strict'; + +// Benchmark comparing performance of event emit for single listener +// To run it, do following in memoizee package path: +// +// $ npm install eventemitter2 signals +// $ node benchmark/single-on.js + +var forEach = require('es5-ext/object/for-each') + , pad = require('es5-ext/string/#/pad') + + , now = Date.now + + , time, count = 1000000, i, data = {} + , ee, native, ee2, signals, a = {}, b = {}; + +ee = (function () { + var ee = require('../'); + return ee().on('test', function () { return arguments; }); +}()); + +native = (function () { + var ee = require('events'); + return (new ee.EventEmitter()).on('test', function () { return arguments; }); +}()); + +ee2 = (function () { + var ee = require('eventemitter2'); + return (new ee.EventEmitter2()).on('test', function () { return arguments; }); +}()); + +signals = (function () { + var Signal = require('signals') + , ee = { test: new Signal() }; + ee.test.add(function () { return arguments; }); + return ee; +}()); + +console.log("Emit for single listener", "x" + count + ":\n"); + +i = count; +time = now(); +while (i--) { + ee.emit('test', a, b); +} +data["event-emitter (this implementation)"] = now() - time; + +i = count; +time = now(); +while (i--) { + native.emit('test', a, b); +} +data["EventEmitter (Node.js native)"] = now() - time; + +i = count; +time = now(); +while (i--) { + ee2.emit('test', a, b); +} +data.EventEmitter2 = now() - time; + +i = count; +time = now(); +while (i--) { + signals.test.dispatch(a, b); +} +data.Signals = now() - time; + +forEach(data, function (value, name, obj, index) { + console.log(index + 1 + ":", pad.call(value, " ", 5), name); +}, null, function (a, b) { + return this[a] - this[b]; +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/has-listeners.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/has-listeners.js new file mode 100644 index 00000000..8744522e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/has-listeners.js @@ -0,0 +1,16 @@ +'use strict'; + +var isEmpty = require('es5-ext/object/is-empty') + , value = require('es5-ext/object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function (obj/*, type*/) { + var type; + value(obj); + type = arguments[1]; + if (arguments.length > 1) { + return hasOwnProperty.call(obj, '__ee__') && Boolean(obj.__ee__[type]); + } + return obj.hasOwnProperty('__ee__') && !isEmpty(obj.__ee__); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/index.js new file mode 100644 index 00000000..c36d3e49 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/index.js @@ -0,0 +1,132 @@ +'use strict'; + +var d = require('d') + , callable = require('es5-ext/object/valid-callable') + + , apply = Function.prototype.apply, call = Function.prototype.call + , create = Object.create, defineProperty = Object.defineProperty + , defineProperties = Object.defineProperties + , hasOwnProperty = Object.prototype.hasOwnProperty + , descriptor = { configurable: true, enumerable: false, writable: true } + + , on, once, off, emit, methods, descriptors, base; + +on = function (type, listener) { + var data; + + callable(listener); + + if (!hasOwnProperty.call(this, '__ee__')) { + data = descriptor.value = create(null); + defineProperty(this, '__ee__', descriptor); + descriptor.value = null; + } else { + data = this.__ee__; + } + if (!data[type]) data[type] = listener; + else if (typeof data[type] === 'object') data[type].push(listener); + else data[type] = [data[type], listener]; + + return this; +}; + +once = function (type, listener) { + var once, self; + + callable(listener); + self = this; + on.call(this, type, once = function () { + off.call(self, type, once); + apply.call(listener, this, arguments); + }); + + once.__eeOnceListener__ = listener; + return this; +}; + +off = function (type, listener) { + var data, listeners, candidate, i; + + callable(listener); + + if (!hasOwnProperty.call(this, '__ee__')) return this; + data = this.__ee__; + if (!data[type]) return this; + listeners = data[type]; + + if (typeof listeners === 'object') { + for (i = 0; (candidate = listeners[i]); ++i) { + if ((candidate === listener) || + (candidate.__eeOnceListener__ === listener)) { + if (listeners.length === 2) data[type] = listeners[i ? 0 : 1]; + else listeners.splice(i, 1); + } + } + } else { + if ((listeners === listener) || + (listeners.__eeOnceListener__ === listener)) { + delete data[type]; + } + } + + return this; +}; + +emit = function (type) { + var i, l, listener, listeners, args; + + if (!hasOwnProperty.call(this, '__ee__')) return; + listeners = this.__ee__[type]; + if (!listeners) return; + + if (typeof listeners === 'object') { + l = arguments.length; + args = new Array(l - 1); + for (i = 1; i < l; ++i) args[i - 1] = arguments[i]; + + listeners = listeners.slice(); + for (i = 0; (listener = listeners[i]); ++i) { + apply.call(listener, this, args); + } + } else { + switch (arguments.length) { + case 1: + call.call(listeners, this); + break; + case 2: + call.call(listeners, this, arguments[1]); + break; + case 3: + call.call(listeners, this, arguments[1], arguments[2]); + break; + default: + l = arguments.length; + args = new Array(l - 1); + for (i = 1; i < l; ++i) { + args[i - 1] = arguments[i]; + } + apply.call(listeners, this, args); + } + } +}; + +methods = { + on: on, + once: once, + off: off, + emit: emit +}; + +descriptors = { + on: d(on), + once: d(once), + off: d(off), + emit: d(emit) +}; + +base = defineProperties({}, descriptors); + +module.exports = exports = function (o) { + return (o == null) ? create(base) : defineProperties(Object(o), descriptors); +}; +exports.methods = methods; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/package.json new file mode 100644 index 00000000..17a904ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/package.json @@ -0,0 +1,64 @@ +{ + "name": "event-emitter", + "version": "0.3.3", + "description": "Environment agnostic event emitter", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "event", + "events", + "trigger", + "observer", + "listener", + "emitter", + "pubsub" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/event-emitter.git" + }, + "dependencies": { + "es5-ext": "~0.10.5", + "d": "~0.1.1" + }, + "devDependencies": { + "tad": "~0.2.1", + "xlint": "~0.2.2", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "13f184ab039e3559164691d3a6a3d6b8c84aed3e", + "bugs": { + "url": "https://github.com/medikoo/event-emitter/issues" + }, + "homepage": "https://github.com/medikoo/event-emitter", + "_id": "event-emitter@0.3.3", + "_shasum": "df8e806541c68ab8ff20a79a1841b91abaa1bee4", + "_from": "event-emitter@>=0.3.1 <0.4.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "df8e806541c68ab8ff20a79a1841b91abaa1bee4", + "tarball": "http://registry.npmjs.org/event-emitter/-/event-emitter-0.3.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/pipe.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/pipe.js new file mode 100644 index 00000000..0088efef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/pipe.js @@ -0,0 +1,42 @@ +'use strict'; + +var aFrom = require('es5-ext/array/from') + , remove = require('es5-ext/array/#/remove') + , value = require('es5-ext/object/valid-object') + , d = require('d') + , emit = require('./').methods.emit + + , defineProperty = Object.defineProperty + , hasOwnProperty = Object.prototype.hasOwnProperty + , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + +module.exports = function (e1, e2/*, name*/) { + var pipes, pipe, desc, name; + + (value(e1) && value(e2)); + name = arguments[2]; + if (name === undefined) name = 'emit'; + + pipe = { + close: function () { remove.call(pipes, e2); } + }; + if (hasOwnProperty.call(e1, '__eePipes__')) { + (pipes = e1.__eePipes__).push(e2); + return pipe; + } + defineProperty(e1, '__eePipes__', d('c', pipes = [e2])); + desc = getOwnPropertyDescriptor(e1, name); + if (!desc) { + desc = d('c', undefined); + } else { + delete desc.get; + delete desc.set; + } + desc.value = function () { + var i, emitter, data = aFrom(pipes); + emit.apply(this, arguments); + for (i = 0; (emitter = data[i]); ++i) emit.apply(emitter, arguments); + }; + defineProperty(e1, name, desc); + return pipe; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/all-off.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/all-off.js new file mode 100644 index 00000000..8aa872e9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/all-off.js @@ -0,0 +1,48 @@ +'use strict'; + +var ee = require('../'); + +module.exports = function (t, a) { + var x, count, count2; + + x = ee(); + count = 0; + count2 = 0; + x.on('foo', function () { + ++count; + }); + x.on('foo', function () { + ++count; + }); + x.on('bar', function () { + ++count2; + }); + x.on('bar', function () { + ++count2; + }); + t(x, 'foo'); + x.emit('foo'); + x.emit('bar'); + a(count, 0, "All off: type"); + a(count2, 2, "All off: ohter type"); + + count = 0; + count2 = 0; + x.on('foo', function () { + ++count; + }); + x.on('foo', function () { + ++count; + }); + x.on('bar', function () { + ++count2; + }); + x.on('bar', function () { + ++count2; + }); + t(x); + x.emit('foo'); + x.emit('bar'); + a(count, 0, "All off: type"); + a(count2, 0, "All off: other type"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/has-listeners.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/has-listeners.js new file mode 100644 index 00000000..875b048a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/has-listeners.js @@ -0,0 +1,42 @@ +'use strict'; + +var ee = require('../'); + +module.exports = function (t) { + var x, y; + return { + Any: function (a) { + a(t(true), false, "Primitive"); + a(t({ events: [] }), false, "Other object"); + a(t(x = ee()), false, "Emitter: empty"); + + x.on('test', y = function () {}); + a(t(x), true, "Emitter: full"); + x.off('test', y); + a(t(x), false, "Emitter: empty but touched"); + x.once('test', y = function () {}); + a(t(x), true, "Emitter: full: Once"); + x.off('test', y); + a(t(x), false, "Emitter: empty but touched by once"); + }, + Specific: function (a) { + a(t(true, 'test'), false, "Primitive"); + a(t({ events: [] }, 'test'), false, "Other object"); + a(t(x = ee(), 'test'), false, "Emitter: empty"); + + x.on('test', y = function () {}); + a(t(x, 'test'), true, "Emitter: full"); + a(t(x, 'foo'), false, "Emitter: full, other event"); + x.off('test', y); + a(t(x, 'test'), false, "Emitter: empty but touched"); + a(t(x, 'foo'), false, "Emitter: empty but touched, other event"); + + x.once('test', y = function () {}); + a(t(x, 'test'), true, "Emitter: full: Once"); + a(t(x, 'foo'), false, "Emitter: full: Once, other event"); + x.off('test', y); + a(t(x, 'test'), false, "Emitter: empty but touched by once"); + a(t(x, 'foo'), false, "Emitter: empty but touched by once, other event"); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/index.js new file mode 100644 index 00000000..c7c3f24c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/index.js @@ -0,0 +1,107 @@ +'use strict'; + +module.exports = function (t, a) { + var x = t(), y, count, count2, count3, count4, test, listener1, listener2; + + x.emit('none'); + + test = "Once: "; + count = 0; + x.once('foo', function (a1, a2, a3) { + a(this, x, test + "Context"); + a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments"); + ++count; + }); + + x.emit('foobar'); + a(count, 0, test + "Not invoked on other event"); + x.emit('foo', 'foo', x, 15); + a(count, 1, test + "Emitted"); + x.emit('foo'); + a(count, 1, test + "Emitted once"); + + test = "On & Once: "; + count = 0; + x.on('foo', listener1 = function (a1, a2, a3) { + a(this, x, test + "Context"); + a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments"); + ++count; + }); + count2 = 0; + x.once('foo', listener2 = function (a1, a2, a3) { + a(this, x, test + "Context"); + a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments"); + ++count2; + }); + + x.emit('foobar'); + a(count, 0, test + "Not invoked on other event"); + x.emit('foo', 'foo', x, 15); + a(count, 1, test + "Emitted"); + x.emit('foo', 'foo', x, 15); + a(count, 2, test + "Emitted twice"); + a(count2, 1, test + "Emitted once"); + x.off('foo', listener1); + x.emit('foo'); + a(count, 2, test + "Not emitter after off"); + + count = 0; + x.once('foo', listener1 = function () { ++count; }); + + x.off('foo', listener1); + x.emit('foo'); + a(count, 0, "Once Off: Not emitted"); + + count = 0; + x.on('foo', listener2 = function () {}); + x.once('foo', listener1 = function () { ++count; }); + + x.off('foo', listener1); + x.emit('foo'); + a(count, 0, "Once Off (multi): Not emitted"); + x.off('foo', listener2); + + test = "Prototype Share: "; + + y = Object.create(x); + + count = 0; + count2 = 0; + count3 = 0; + count4 = 0; + x.on('foo', function () { + ++count; + }); + y.on('foo', function () { + ++count2; + }); + x.once('foo', function () { + ++count3; + }); + y.once('foo', function () { + ++count4; + }); + x.emit('foo'); + a(count, 1, test + "x on count"); + a(count2, 0, test + "y on count"); + a(count3, 1, test + "x once count"); + a(count4, 0, test + "y once count"); + + y.emit('foo'); + a(count, 1, test + "x on count"); + a(count2, 1, test + "y on count"); + a(count3, 1, test + "x once count"); + a(count4, 1, test + "y once count"); + + x.emit('foo'); + a(count, 2, test + "x on count"); + a(count2, 1, test + "y on count"); + a(count3, 1, test + "x once count"); + a(count4, 1, test + "y once count"); + + y.emit('foo'); + a(count, 2, test + "x on count"); + a(count2, 2, test + "y on count"); + a(count3, 1, test + "x once count"); + a(count4, 1, test + "y once count"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/pipe.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/pipe.js new file mode 100644 index 00000000..9d15d6da --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/pipe.js @@ -0,0 +1,53 @@ +'use strict'; + +var ee = require('../'); + +module.exports = function (t, a) { + var x = {}, y = {}, z = {}, count, count2, count3, pipe; + + ee(x); + x = Object.create(x); + ee(y); + ee(z); + + count = 0; + count2 = 0; + count3 = 0; + x.on('foo', function () { + ++count; + }); + y.on('foo', function () { + ++count2; + }); + z.on('foo', function () { + ++count3; + }); + + x.emit('foo'); + a(count, 1, "Pre pipe, x"); + a(count2, 0, "Pre pipe, y"); + a(count3, 0, "Pre pipe, z"); + + pipe = t(x, y); + x.emit('foo'); + a(count, 2, "Post pipe, x"); + a(count2, 1, "Post pipe, y"); + a(count3, 0, "Post pipe, z"); + + y.emit('foo'); + a(count, 2, "Post pipe, on y, x"); + a(count2, 2, "Post pipe, on y, y"); + a(count3, 0, "Post pipe, on y, z"); + + t(x, z); + x.emit('foo'); + a(count, 3, "Post pipe z, x"); + a(count2, 3, "Post pipe z, y"); + a(count3, 1, "Post pipe z, z"); + + pipe.close(); + x.emit('foo'); + a(count, 4, "Close pipe y, x"); + a(count2, 3, "Close pipe y, y"); + a(count3, 2, "Close pipe y, z"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/unify.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/unify.js new file mode 100644 index 00000000..69295e06 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/test/unify.js @@ -0,0 +1,123 @@ +'use strict'; + +var ee = require('../'); + +module.exports = function (t) { + + return { + "": function (a) { + var x = {}, y = {}, z = {}, count, count2, count3; + + ee(x); + ee(y); + ee(z); + + count = 0; + count2 = 0; + count3 = 0; + x.on('foo', function () { ++count; }); + y.on('foo', function () { ++count2; }); + z.on('foo', function () { ++count3; }); + + x.emit('foo'); + a(count, 1, "Pre unify, x"); + a(count2, 0, "Pre unify, y"); + a(count3, 0, "Pre unify, z"); + + t(x, y); + a(x.__ee__, y.__ee__, "Post unify y"); + x.emit('foo'); + a(count, 2, "Post unify, x"); + a(count2, 1, "Post unify, y"); + a(count3, 0, "Post unify, z"); + + y.emit('foo'); + a(count, 3, "Post unify, on y, x"); + a(count2, 2, "Post unify, on y, y"); + a(count3, 0, "Post unify, on y, z"); + + t(x, z); + a(x.__ee__, x.__ee__, "Post unify z"); + x.emit('foo'); + a(count, 4, "Post unify z, x"); + a(count2, 3, "Post unify z, y"); + a(count3, 1, "Post unify z, z"); + }, + "On empty": function (a) { + var x = {}, y = {}, z = {}, count, count2, count3; + + ee(x); + ee(y); + ee(z); + + count = 0; + count2 = 0; + count3 = 0; + y.on('foo', function () { ++count2; }); + x.emit('foo'); + a(count, 0, "Pre unify, x"); + a(count2, 0, "Pre unify, y"); + a(count3, 0, "Pre unify, z"); + + t(x, y); + a(x.__ee__, y.__ee__, "Post unify y"); + x.on('foo', function () { ++count; }); + x.emit('foo'); + a(count, 1, "Post unify, x"); + a(count2, 1, "Post unify, y"); + a(count3, 0, "Post unify, z"); + + y.emit('foo'); + a(count, 2, "Post unify, on y, x"); + a(count2, 2, "Post unify, on y, y"); + a(count3, 0, "Post unify, on y, z"); + + t(x, z); + a(x.__ee__, z.__ee__, "Post unify z"); + z.on('foo', function () { ++count3; }); + x.emit('foo'); + a(count, 3, "Post unify z, x"); + a(count2, 3, "Post unify z, y"); + a(count3, 1, "Post unify z, z"); + }, + Many: function (a) { + var x = {}, y = {}, z = {}, count, count2, count3; + + ee(x); + ee(y); + ee(z); + + count = 0; + count2 = 0; + count3 = 0; + x.on('foo', function () { ++count; }); + y.on('foo', function () { ++count2; }); + y.on('foo', function () { ++count2; }); + z.on('foo', function () { ++count3; }); + + x.emit('foo'); + a(count, 1, "Pre unify, x"); + a(count2, 0, "Pre unify, y"); + a(count3, 0, "Pre unify, z"); + + t(x, y); + a(x.__ee__, y.__ee__, "Post unify y"); + x.emit('foo'); + a(count, 2, "Post unify, x"); + a(count2, 2, "Post unify, y"); + a(count3, 0, "Post unify, z"); + + y.emit('foo'); + a(count, 3, "Post unify, on y, x"); + a(count2, 4, "Post unify, on y, y"); + a(count3, 0, "Post unify, on y, z"); + + t(x, z); + a(x.__ee__, x.__ee__, "Post unify z"); + x.emit('foo'); + a(count, 4, "Post unify z, x"); + a(count2, 6, "Post unify z, y"); + a(count3, 1, "Post unify z, z"); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/unify.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/unify.js new file mode 100644 index 00000000..c6a858a0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/node_modules/event-emitter/unify.js @@ -0,0 +1,50 @@ +'use strict'; + +var forEach = require('es5-ext/object/for-each') + , validValue = require('es5-ext/object/valid-object') + + , push = Array.prototype.apply, defineProperty = Object.defineProperty + , create = Object.create, hasOwnProperty = Object.prototype.hasOwnProperty + , d = { configurable: true, enumerable: false, writable: true }; + +module.exports = function (e1, e2) { + var data; + (validValue(e1) && validValue(e2)); + if (!hasOwnProperty.call(e1, '__ee__')) { + if (!hasOwnProperty.call(e2, '__ee__')) { + d.value = create(null); + defineProperty(e1, '__ee__', d); + defineProperty(e2, '__ee__', d); + d.value = null; + return; + } + d.value = e2.__ee__; + defineProperty(e1, '__ee__', d); + d.value = null; + return; + } + data = d.value = e1.__ee__; + if (!hasOwnProperty.call(e2, '__ee__')) { + defineProperty(e2, '__ee__', d); + d.value = null; + return; + } + if (data === e2.__ee__) return; + forEach(e2.__ee__, function (listener, name) { + if (!data[name]) { + data[name] = listener; + return; + } + if (typeof data[name] === 'object') { + if (typeof listener === 'object') push.apply(data[name], listener); + else data[name].push(listener); + } else if (typeof listener === 'object') { + listener.unshift(data[name]); + data[name] = listener; + } else { + data[name] = [data[name], listener]; + } + }); + defineProperty(e2, '__ee__', d); + d.value = null; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/package.json new file mode 100644 index 00000000..51b50e23 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/package.json @@ -0,0 +1,70 @@ +{ + "name": "es6-map", + "version": "0.1.1", + "description": "ECMAScript6 Map polyfill", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "collection", + "es6", + "shim", + "harmony", + "list", + "hash", + "map", + "polyfill", + "ecmascript" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es6-map.git" + }, + "dependencies": { + "d": "~0.1.1", + "es5-ext": "~0.10.4", + "es6-iterator": "~0.1.1", + "es6-set": "~0.1.1", + "es6-symbol": "~0.1.1", + "event-emitter": "~0.3.1" + }, + "devDependencies": { + "tad": "0.2.x", + "xlint": "~0.2.1", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "16b0bce8defe9742a40b9cac1eed194ee4e2d820", + "bugs": { + "url": "https://github.com/medikoo/es6-map/issues" + }, + "homepage": "https://github.com/medikoo/es6-map", + "_id": "es6-map@0.1.1", + "_shasum": "b879239ed7819e0b08c40ba6e19fa047ca7c8d1d", + "_from": "es6-map@>=0.1.1 <0.2.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "b879239ed7819e0b08c40ba6e19fa047ca7c8d1d", + "tarball": "http://registry.npmjs.org/es6-map/-/es6-map-0.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/polyfill.js new file mode 100644 index 00000000..fc44527f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/polyfill.js @@ -0,0 +1,100 @@ +'use strict'; + +var clear = require('es5-ext/array/#/clear') + , eIndexOf = require('es5-ext/array/#/e-index-of') + , setPrototypeOf = require('es5-ext/object/set-prototype-of') + , callable = require('es5-ext/object/valid-callable') + , validValue = require('es5-ext/object/valid-value') + , d = require('d') + , ee = require('event-emitter') + , Symbol = require('es6-symbol') + , iterator = require('es6-iterator/valid-iterable') + , forOf = require('es6-iterator/for-of') + , Iterator = require('./lib/iterator') + , isNative = require('./is-native-implemented') + + , call = Function.prototype.call, defineProperties = Object.defineProperties + , MapPoly; + +module.exports = MapPoly = function (/*iterable*/) { + var iterable = arguments[0], keys, values; + if (!(this instanceof MapPoly)) return new MapPoly(iterable); + if (this.__mapKeysData__ !== undefined) { + throw new TypeError(this + " cannot be reinitialized"); + } + if (iterable != null) iterator(iterable); + defineProperties(this, { + __mapKeysData__: d('c', keys = []), + __mapValuesData__: d('c', values = []) + }); + if (!iterable) return; + forOf(iterable, function (value) { + var key = validValue(value)[0]; + value = value[1]; + if (eIndexOf.call(keys, key) !== -1) return; + keys.push(key); + values.push(value); + }, this); +}; + +if (isNative) { + if (setPrototypeOf) setPrototypeOf(MapPoly, Map); + MapPoly.prototype = Object.create(Map.prototype, { + constructor: d(MapPoly) + }); +} + +ee(defineProperties(MapPoly.prototype, { + clear: d(function () { + if (!this.__mapKeysData__.length) return; + clear.call(this.__mapKeysData__); + clear.call(this.__mapValuesData__); + this.emit('_clear'); + }), + delete: d(function (key) { + var index = eIndexOf.call(this.__mapKeysData__, key); + if (index === -1) return false; + this.__mapKeysData__.splice(index, 1); + this.__mapValuesData__.splice(index, 1); + this.emit('_delete', index, key); + return true; + }), + entries: d(function () { return new Iterator(this, 'key+value'); }), + forEach: d(function (cb/*, thisArg*/) { + var thisArg = arguments[1], iterator, result; + callable(cb); + iterator = this.entries(); + result = iterator._next(); + while (result !== undefined) { + call.call(cb, thisArg, this.__mapValuesData__[result], + this.__mapKeysData__[result], this); + result = iterator._next(); + } + }), + get: d(function (key) { + var index = eIndexOf.call(this.__mapKeysData__, key); + if (index === -1) return; + return this.__mapValuesData__[index]; + }), + has: d(function (key) { + return (eIndexOf.call(this.__mapKeysData__, key) !== -1); + }), + keys: d(function () { return new Iterator(this, 'key'); }), + set: d(function (key, value) { + var index = eIndexOf.call(this.__mapKeysData__, key), emit; + if (index === -1) { + index = this.__mapKeysData__.push(key) - 1; + emit = true; + } + this.__mapValuesData__[index] = value; + if (emit) this.emit('_add', index, key); + return this; + }), + size: d.gs(function () { return this.__mapKeysData__.length; }), + values: d(function () { return new Iterator(this, 'value'); }), + toString: d(function () { return '[object Map]'; }) +})); +Object.defineProperty(MapPoly.prototype, Symbol.iterator, d(function () { + return this.entries(); +})); +Object.defineProperty(MapPoly.prototype, Symbol.toStringTag, d('c', 'Map')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/primitive/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/primitive/index.js new file mode 100644 index 00000000..425d4826 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/primitive/index.js @@ -0,0 +1,115 @@ +'use strict'; + +var clear = require('es5-ext/object/clear') + , setPrototypeOf = require('es5-ext/object/set-prototype-of') + , validValue = require('es5-ext/object/valid-value') + , callable = require('es5-ext/object/valid-callable') + , d = require('d') + , iterator = require('es6-iterator/valid-iterable') + , forOf = require('es6-iterator/for-of') + , Map = require('../polyfill') + , Iterator = require('../lib/primitive-iterator') + + , call = Function.prototype.call + , defineProperty = Object.defineProperty + , create = Object.create, defineProperties = Object.defineProperties + , hasOwnProperty = Object.prototype.hasOwnProperty + , PrimitiveMap; + +module.exports = PrimitiveMap = function (/*iterable, serialize*/) { + var iterable = arguments[0], serialize = arguments[1]; + if (!(this instanceof PrimitiveMap)) { + return new PrimitiveMap(iterable, serialize); + } + if (this.__mapData__ !== undefined) { + throw new TypeError(this + " cannot be reinitialized"); + } + if (iterable != null) iterator(iterable); + if (serialize !== undefined) { + callable(serialize); + defineProperty(this, '_serialize', d('', serialize)); + } + defineProperties(this, { + __mapKeysData__: d('c', create(null)), + __mapValuesData__: d('c', create(null)), + __size__: d('w', 0) + }); + if (!iterable) return; + forOf(iterable, function (value) { + var key = validValue(value)[0], sKey = this._serialize(key); + if (sKey == null) throw new TypeError(key + " cannot be serialized"); + value = value[1]; + if (hasOwnProperty.call(this.__mapKeysData__, sKey)) { + if (this.__mapValuesData__[sKey] === value) return; + } else { + ++this.__size__; + } + this.__mapKeysData__[sKey] = key; + this.__mapValuesData__[sKey] = value; + }, this); +}; +if (setPrototypeOf) setPrototypeOf(PrimitiveMap, Map); + +PrimitiveMap.prototype = create(Map.prototype, { + constructor: d(PrimitiveMap), + _serialize: d(function (value) { + if (value && (typeof value.toString !== 'function')) return null; + return String(value); + }), + clear: d(function () { + if (!this.__size__) return; + clear(this.__mapKeysData__); + clear(this.__mapValuesData__); + this.__size__ = 0; + this.emit('_clear'); + }), + delete: d(function (key) { + var sKey = this._serialize(key); + if (sKey == null) return false; + if (!hasOwnProperty.call(this.__mapKeysData__, sKey)) return false; + delete this.__mapKeysData__[sKey]; + delete this.__mapValuesData__[sKey]; + --this.__size__; + this.emit('_delete', sKey); + return true; + }), + entries: d(function () { return new Iterator(this, 'key+value'); }), + forEach: d(function (cb/*, thisArg*/) { + var thisArg = arguments[1], iterator, result, sKey; + callable(cb); + iterator = this.entries(); + result = iterator._next(); + while (result !== undefined) { + sKey = iterator.__list__[result]; + call.call(cb, thisArg, this.__mapValuesData__[sKey], + this.__mapKeysData__[sKey], this); + result = iterator._next(); + } + }), + get: d(function (key) { + var sKey = this._serialize(key); + if (sKey == null) return; + return this.__mapValuesData__[sKey]; + }), + has: d(function (key) { + var sKey = this._serialize(key); + if (sKey == null) return false; + return hasOwnProperty.call(this.__mapKeysData__, sKey); + }), + keys: d(function () { return new Iterator(this, 'key'); }), + size: d.gs(function () { return this.__size__; }), + set: d(function (key, value) { + var sKey = this._serialize(key); + if (sKey == null) throw new TypeError(key + " cannot be serialized"); + if (hasOwnProperty.call(this.__mapKeysData__, sKey)) { + if (this.__mapValuesData__[sKey] === value) return this; + } else { + ++this.__size__; + } + this.__mapKeysData__[sKey] = key; + this.__mapValuesData__[sKey] = value; + this.emit('_add', sKey); + return this; + }), + values: d(function () { return new Iterator(this, 'value'); }) +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/implement.js new file mode 100644 index 00000000..3569df61 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/implement.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof Map, 'function'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/index.js new file mode 100644 index 00000000..907b8c5a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (T, a) { + a((new T([['raz', 1], ['dwa', 2]])).size, 2); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/is-implemented.js new file mode 100644 index 00000000..06df91cc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +var global = require('es5-ext/global') + , polyfill = require('../polyfill'); + +module.exports = function (t, a) { + var cache; + a(typeof t(), 'boolean'); + cache = global.Map; + global.Map = polyfill; + a(t(), true); + if (cache === undefined) delete global.Map; + else global.Map = cache; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/is-map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/is-map.js new file mode 100644 index 00000000..f600b229 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/is-map.js @@ -0,0 +1,16 @@ +'use strict'; + +var MapPoly = require('../polyfill'); + +module.exports = function (t, a) { + a(t(undefined), false, "Undefined"); + a(t(null), false, "Null"); + a(t(true), false, "Primitive"); + a(t('raz'), false, "String"); + a(t({}), false, "Object"); + a(t([]), false, "Array"); + if (typeof Map !== 'undefined') { + a(t(new Map()), true, "Native"); + } + a(t(new MapPoly()), true, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/is-native-implemented.js new file mode 100644 index 00000000..df8ba032 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/is-native-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t, 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/lib/iterator-kinds.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/lib/iterator-kinds.js new file mode 100644 index 00000000..41ea10c5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/lib/iterator-kinds.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t, { key: true, value: true, 'key+value': true }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/lib/iterator.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/lib/iterator.js new file mode 100644 index 00000000..2688ed26 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/lib/iterator.js @@ -0,0 +1,13 @@ +'use strict'; + +var Map = require('../../polyfill') + , toArray = require('es5-ext/array/to-array'); + +module.exports = function (T, a) { + var arr = [['raz', 'one'], ['dwa', 'two']], map = new Map(arr); + + a.deep(toArray(new T(map)), arr, "Default"); + a.deep(toArray(new T(map, 'key+value')), arr, "Key & Value"); + a.deep(toArray(new T(map, 'value')), ['one', 'two'], "Value"); + a.deep(toArray(new T(map, 'key')), ['raz', 'dwa'], "Value"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/lib/primitive-iterator.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/lib/primitive-iterator.js new file mode 100644 index 00000000..ed2790de --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/lib/primitive-iterator.js @@ -0,0 +1,130 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , toArray = require('es5-ext/array/to-array') + , Map = require('../../primitive') + + , compare, mapToResults; + +compare = function (a, b) { + if (!a.value) return -1; + if (!b.value) return 1; + return a.value[0].localeCompare(b.value[0]); +}; + +mapToResults = function (arr) { + return arr.sort().map(function (value) { + return { done: false, value: value }; + }); +}; + +module.exports = function (T) { + return { + "": function (a) { + var arr, it, y, z, map, result = []; + + arr = [['raz', 'one'], ['dwa', 'two'], ['trzy', 'three'], + ['cztery', 'four'], ['pięć', 'five']]; + map = new Map(arr); + + it = new T(map); + a(it[iteratorSymbol](), it, "@@iterator"); + y = it.next(); + result.push(y); + z = it.next(); + a.not(y, z, "Recreate result"); + result.push(z); + result.push(it.next()); + result.push(it.next()); + result.push(it.next()); + a.deep(result.sort(compare), mapToResults(arr)); + a.deep(y = it.next(), { done: true, value: undefined }, "End"); + a.not(y, it.next(), "Recreate result on dead"); + }, + Emited: function (a) { + var arr, it, map, result = []; + + arr = [['raz', 'one'], ['dwa', 'two'], ['trzy', 'three'], + ['cztery', 'four'], ['pięć', 'five']]; + map = new Map(arr); + + it = new T(map); + result.push(it.next()); + result.push(it.next()); + map.set('sześć', 'six'); + arr.push(['sześć', 'six']); + result.push(it.next()); + map.delete('pięć'); + arr.splice(4, 1); + result.push(it.next()); + result.push(it.next()); + a.deep(result.sort(compare), mapToResults(arr)); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited #2": function (a) { + var arr, it, map, result = []; + + arr = [['raz', 'one'], ['dwa', 'two'], ['trzy', 'three'], + ['cztery', 'four'], ['pięć', 'five'], ['sześć', 'six']]; + map = new Map(arr); + + it = new T(map); + result.push(it.next()); + result.push(it.next()); + map.set('siedem', 'seven'); + map.delete('siedem'); + result.push(it.next()); + result.push(it.next()); + map.delete('pięć'); + arr.splice(4, 1); + result.push(it.next()); + a.deep(result.sort(compare), mapToResults(arr)); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited: Clear #1": function (a) { + var arr, it, map, result = []; + + arr = [['raz', 'one'], ['dwa', 'two'], ['trzy', 'three'], + ['cztery', 'four'], ['pięć', 'five'], ['sześć', 'six']]; + map = new Map(arr); + + it = new T(map); + result.push(it.next()); + result.push(it.next()); + arr = [['raz', 'one'], ['dwa', 'two']]; + map.clear(); + a.deep(result.sort(compare), mapToResults(arr)); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited: Clear #2": function (a) { + var arr, it, map, result = []; + + arr = [['raz', 'one'], ['dwa', 'two'], ['trzy', 'three'], + ['cztery', 'four'], ['pięć', 'five'], ['sześć', 'six']]; + map = new Map(arr); + + it = new T(map); + result.push(it.next()); + result.push(it.next()); + map.clear(); + map.set('foo', 'bru'); + map.set('bar', 'far'); + arr = [['raz', 'one'], ['dwa', 'two'], ['foo', 'bru'], ['bar', 'far']]; + result.push(it.next()); + result.push(it.next()); + a.deep(result.sort(compare), mapToResults(arr)); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + Kinds: function (a) { + var arr = [['raz', 'one'], ['dwa', 'two']], map = new Map(arr); + + a.deep(toArray(new T(map)).sort(), arr.sort(), "Default"); + a.deep(toArray(new T(map, 'key+value')).sort(), arr.sort(), + "Key + Value"); + a.deep(toArray(new T(map, 'value')).sort(), ['one', 'two'].sort(), + "Value"); + a.deep(toArray(new T(map, 'key')).sort(), ['raz', 'dwa'].sort(), + "Key"); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/polyfill.js new file mode 100644 index 00000000..6640e359 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/polyfill.js @@ -0,0 +1,54 @@ +'use strict'; + +var aFrom = require('es5-ext/array/from') + , toArray = require('es5-ext/array/to-array'); + +module.exports = function (T, a) { + var arr = [['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']] + , map = new T(arr), x = {}, y = {}, i = 0; + + a(map instanceof T, true, "Map"); + a(map.size, 3, "Size"); + a(map.get('raz'), 'one', "Get: contained"); + a(map.get(x), undefined, "Get: not contained"); + a(map.has('raz'), true, "Has: contained"); + a(map.has(x), false, "Has: not contained"); + a(map.set(x, y), map, "Set: return"); + a(map.has(x), true, "Set: has"); + a(map.get(x), y, "Set: get"); + a(map.size, 4, "Set: Size"); + map.set('dwa', x); + a(map.get('dwa'), x, "Overwrite: get"); + a(map.size, 4, "Overwrite: size"); + + a(map.delete({}), false, "Delete: false"); + + arr.push([x, y]); + arr[1][1] = x; + map.forEach(function () { + a.deep(aFrom(arguments), [arr[i][1], arr[i][0], map], + "ForEach: Arguments: #" + i); + a(this, y, "ForEach: Context: #" + i); + if (i === 0) { + a(map.delete('raz'), true, "Delete: true"); + a(map.has('raz'), false, "Delete"); + a(map.size, 3, "Delete: size"); + map.set('cztery', 'four'); + arr.push(['cztery', 'four']); + } + i++; + }, y); + arr.splice(0, 1); + + a.deep(toArray(map.entries()), [['dwa', x], ['trzy', 'three'], [x, y], + ['cztery', 'four']], "Entries"); + a.deep(toArray(map.keys()), ['dwa', 'trzy', x, 'cztery'], "Keys"); + a.deep(toArray(map.values()), [x, 'three', y, 'four'], "Values"); + a.deep(toArray(map), [['dwa', x], ['trzy', 'three'], [x, y], + ['cztery', 'four']], "Iterator"); + + map.clear(); + a(map.size, 0, "Clear: size"); + a(map.has('trzy'), false, "Clear: has"); + a.deep(toArray(map), [], "Clear: Values"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/primitive/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/primitive/index.js new file mode 100644 index 00000000..1167d2eb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/primitive/index.js @@ -0,0 +1,53 @@ +'use strict'; + +var aFrom = require('es5-ext/array/from') + , getIterator = require('es6-iterator/get') + , toArray = require('es5-ext/array/to-array'); + +module.exports = function (T, a) { + var arr = [['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']] + , map = new T(arr), x = 'other', y = 'other2' + , i = 0, result = []; + + a(map instanceof T, true, "Map"); + a(map.size, 3, "Size"); + a(map.get('raz'), 'one', "Get: contained"); + a(map.get(x), undefined, "Get: not contained"); + a(map.has('raz'), true, "Has: true"); + a(map.has(x), false, "Has: false"); + a(map.set(x, y), map, "Add: return"); + a(map.has(x), true, "Add"); + a(map.size, 4, "Add: Size"); + map.set('dwa', x); + a(map.get('dwa'), x, "Overwrite: get"); + a(map.size, 4, "Overwrite: size"); + + a(map.delete('else'), false, "Delete: false"); + + arr.push([x, y]); + arr[1][1] = x; + map.forEach(function () { + result.push(aFrom(arguments)); + a(this, y, "ForEach: Context: #" + i); + }, y); + + a.deep(result.sort(function (a, b) { + return String([a[1], a[0]]).localeCompare([b[1], b[0]]); + }), arr.sort().map(function (val) { return [val[1], val[0], map]; }), + "ForEach: Arguments"); + + a.deep(toArray(map.entries()).sort(), [['dwa', x], ['trzy', 'three'], + [x, y], ['raz', 'one']].sort(), "Entries"); + a.deep(toArray(map.keys()).sort(), ['dwa', 'trzy', x, 'raz'].sort(), + "Keys"); + a.deep(toArray(map.values()).sort(), [x, 'three', y, 'one'].sort(), + "Values"); + a.deep(toArray(getIterator(map)).sort(), [['dwa', x], ['trzy', 'three'], + [x, y], ['raz', 'one']].sort(), + "Iterator"); + + map.clear(); + a(map.size, 0, "Clear: size"); + a(map.has('trzy'), false, "Clear: has"); + a.deep(toArray(map.values()), [], "Clear: Values"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/valid-map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/valid-map.js new file mode 100644 index 00000000..ac031494 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/test/valid-map.js @@ -0,0 +1,19 @@ +'use strict'; + +var MapPoly = require('../polyfill'); + +module.exports = function (t, a) { + var map; + a.throws(function () { t(undefined); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.throws(function () { t(true); }, TypeError, "Primitive"); + a.throws(function () { t('raz'); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Object"); + a.throws(function () { t([]); }, TypeError, "Array"); + if (typeof Map !== 'undefined') { + map = new Map(); + a(t(map), map, "Native"); + } + map = new MapPoly(); + a(t(map), map, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/valid-map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/valid-map.js new file mode 100644 index 00000000..e2aca87a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-map/valid-map.js @@ -0,0 +1,8 @@ +'use strict'; + +var isMap = require('./is-map'); + +module.exports = function (x) { + if (!isMap(x)) throw new TypeError(x + " is not a Map"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/.lint new file mode 100644 index 00000000..cf54d815 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/.lint @@ -0,0 +1,11 @@ +@root + +module + +tabs +indent 2 +maxlen 100 + +ass +nomen +plusplus diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/.travis.yml new file mode 100644 index 00000000..08f04a1b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/.travis.yml @@ -0,0 +1,10 @@ +sudo: false # use faster docker infrastructure +language: node_js +node_js: + - 0.10 + - 0.12 + - iojs + +notifications: + email: + - medikoo+es6-weak-map@medikoo.com diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/CHANGES new file mode 100644 index 00000000..33944088 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/CHANGES @@ -0,0 +1,24 @@ +v0.1.4 -- 2015.04.13 +* Republish v0.1.2 as v0.1.4 due to breaking changes + (v0.1.3 should have been published as next major) + +v0.1.3 -- 2015.04.12 +* Update up to changes in specification (require new, remove clear method) +* Improve native implementation validation +* Configure lint scripts +* Rename LICENCE to LICENSE + +v0.1.2 -- 2014.09.01 +* Use internal random and unique id generator instead of external (time-uuid based). + Global uniqueness is not needed in scope of this module. Fixes #1 + +v0.1.1 -- 2014.05.15 +* Improve valid WeakMap detection + +v0.1.0 -- 2014.04.29 +* Assure to depend only npm hosted dependencies +* Update to use latest versions of dependencies +* Use ES6 symbols internally + +v0.0.0 -- 2013.10.24 +Initial (dev version) diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/LICENCE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/LICENCE new file mode 100644 index 00000000..aaf35282 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/LICENCE @@ -0,0 +1,19 @@ +Copyright (C) 2013 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/README.md new file mode 100644 index 00000000..dd91b469 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/README.md @@ -0,0 +1,65 @@ +# es6-weak-map +## WeakMap collection as specified in ECMAScript6 + +_Roughly inspired by Mark Miller's and Kris Kowal's [WeakMap implementation](https://github.com/drses/weak-map)_. + +Differences are: +- Assumes compliant ES5 environment (no weird ES3 workarounds or hacks) +- Well modularized CJS style +- Based on one solution. + +### Limitations + +- Will fail on non extensible objects provided as keys +- While `clear` method is provided, it's not perfectly spec compliant. If some objects were saved as _values_, they need to be removed via `delete`. Otherwise they'll remain infinitely attached to _key_ object (that means, they'll be free for GC only if _key_ object was collected as well). + +### Installation + + $ npm install es6-weak-map + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +### Usage + +If you want to make sure your environment implements `WeakMap`, do: + +```javascript +require('es6-weak-map/implement'); +``` + +If you'd like to use native version when it exists and fallback to polyfill if it doesn't, but without implementing `WeakMap` on global scope, do: + +```javascript +var WeakMap = require('es6-weak-map'); +``` + +If you strictly want to use polyfill even if native `WeakMap` exists, do: + +```javascript +var WeakMap = require('es6-weak-map/polyfill'); +``` + +#### API + +Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-objects). Still if you want quick look, follow example: + +```javascript +var WeakMap = require('es6-weak-map'); + +var map = new WeakMap(); +var obj = {}; + +map.set(obj, 'foo'); // map +map.get(obj); // 'foo' +map.has(obj); // true +map.delete(obj); // true +map.get(obj); // undefined +map.has(obj); // false +map.set(obj, 'bar'); // map +map.clear(); // undefined +map.has(obj); // false +``` + +## Tests [![Build Status](https://travis-ci.org/medikoo/es6-weak-map.png)](https://travis-ci.org/medikoo/es6-weak-map) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/implement.js new file mode 100644 index 00000000..6c3f306b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(require('es5-ext/global'), 'WeakMap', + { value: require('./polyfill'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/index.js new file mode 100644 index 00000000..5edc4cc8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + WeakMap : require('./polyfill'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/is-implemented.js new file mode 100644 index 00000000..455ff812 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function () { + var map; + if (typeof WeakMap !== 'function') return false; + map = new WeakMap(); + if (typeof map.set !== 'function') return false; + if (map.set({}, 1) !== map) return false; + if (typeof map.clear !== 'function') return false; + if (typeof map.delete !== 'function') return false; + if (typeof map.has !== 'function') return false; + + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/is-native-implemented.js new file mode 100644 index 00000000..b3fe5a59 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/is-native-implemented.js @@ -0,0 +1,10 @@ +// Exports true if environment provides native `WeakMap` implementation, +// whatever that is. + +'use strict'; + +module.exports = (function () { + if (typeof WeakMap === 'undefined') return false; + return (Object.prototype.toString.call(WeakMap.prototype) === + '[object WeakMap]'); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/is-weak-map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/is-weak-map.js new file mode 100644 index 00000000..10bb2a15 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/is-weak-map.js @@ -0,0 +1,13 @@ +'use strict'; + +var toStringTagSymbol = require('es6-symbol').toStringTag + + , toString = Object.prototype.toString + , id = '[object WeakMap]' + , Global = (typeof WeakMap === 'undefined') ? null : WeakMap; + +module.exports = function (x) { + return (x && ((Global && (x instanceof Global)) || + (toString.call(x) === id) || (x[toStringTagSymbol] === 'WeakMap'))) || + false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/.lint new file mode 100644 index 00000000..858b7535 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/.lint @@ -0,0 +1,12 @@ +@root + +es5 +module + +tabs +indent 2 +maxlen 80 + +ass +nomen +plusplus diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/.travis.yml new file mode 100644 index 00000000..50008b23 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+d@medikoo.com diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/CHANGES new file mode 100644 index 00000000..45233f74 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/CHANGES @@ -0,0 +1,7 @@ +v0.1.1 -- 2014.04.24 +- Add `autoBind` and `lazy` utilities +- Allow to pass other options to be merged onto created descriptor. + Useful when used with other custom utilties + +v0.1.0 -- 2013.06.20 +Initial (derived from es5-ext project) diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/LICENCE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/LICENCE new file mode 100644 index 00000000..aaf35282 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/LICENCE @@ -0,0 +1,19 @@ +Copyright (C) 2013 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/README.md new file mode 100644 index 00000000..872d493e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/README.md @@ -0,0 +1,108 @@ +# D - Property descriptor factory + +_Originally derived from [es5-ext](https://github.com/medikoo/es5-ext) package._ + +Defining properties with descriptors is very verbose: + +```javascript +var Account = function () {}; +Object.defineProperties(Account.prototype, { + deposit: { value: function () { + /* ... */ + }, configurable: true, enumerable: false, writable: true }, + whithdraw: { value: function () { + /* ... */ + }, configurable: true, enumerable: false, writable: true }, + balance: { get: function () { + /* ... */ + }, configurable: true, enumerable: false } +}); +``` + +D cuts that to: + +```javascript +var d = require('d'); + +var Account = function () {}; +Object.defineProperties(Account.prototype, { + deposit: d(function () { + /* ... */ + }), + whithdraw: d(function () { + /* ... */ + }), + balance: d.gs(function () { + /* ... */ + }) +}); +``` + +By default, created descriptor follow characteristics of native ES5 properties, and defines values as: + +```javascript +{ configurable: true, enumerable: false, writable: true } +``` + +You can overwrite it by preceding _value_ argument with instruction: +```javascript +d('c', value); // { configurable: true, enumerable: false, writable: false } +d('ce', value); // { configurable: true, enumerable: true, writable: false } +d('e', value); // { configurable: false, enumerable: true, writable: false } + +// Same way for get/set: +d.gs('e', value); // { configurable: false, enumerable: true } +``` + +### Other utilities + +#### autoBind(obj, props) _(d/auto-bind)_ + +Define methods which will be automatically bound to its instances + +```javascript +var d = require('d'); +var autoBind = require('d/auto-bind'); + +var Foo = function () { this._count = 0; }; +autoBind(Foo.prototype, { + increment: d(function () { ++this._count; }); +}); + +var foo = new Foo(); + +// Increment foo counter on each domEl click +domEl.addEventListener('click', foo.increment, false); +``` + +#### lazy(obj, props) _(d/lazy)_ + +Define lazy properties, which will be resolved on first access + +```javascript +var d = require('d'); +var lazy = require('d/lazy'); + +var Foo = function () {}; +lazy(Foo.prototype, { + items: d(function () { return []; }) +}); + +var foo = new Foo(); +foo.items.push(1, 2); // foo.items array created +``` + +## Installation +### NPM + +In your project path: + + $ npm install d + +### Browser + +You can easily bundle _D_ for browser with [modules-webmake](https://github.com/medikoo/modules-webmake) + +## Tests [![Build Status](https://travis-ci.org/medikoo/d.png)](https://travis-ci.org/medikoo/d) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/auto-bind.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/auto-bind.js new file mode 100644 index 00000000..1b00dba3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/auto-bind.js @@ -0,0 +1,31 @@ +'use strict'; + +var copy = require('es5-ext/object/copy') + , map = require('es5-ext/object/map') + , callable = require('es5-ext/object/valid-callable') + , validValue = require('es5-ext/object/valid-value') + + , bind = Function.prototype.bind, defineProperty = Object.defineProperty + , hasOwnProperty = Object.prototype.hasOwnProperty + , define; + +define = function (name, desc, bindTo) { + var value = validValue(desc) && callable(desc.value), dgs; + dgs = copy(desc); + delete dgs.writable; + delete dgs.value; + dgs.get = function () { + if (hasOwnProperty.call(this, name)) return value; + desc.value = bind.call(value, (bindTo == null) ? this : this[bindTo]); + defineProperty(this, name, desc); + return this[name]; + }; + return dgs; +}; + +module.exports = function (props/*, bindTo*/) { + var bindTo = arguments[1]; + return map(props, function (desc, name) { + return define(name, desc, bindTo); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/index.js new file mode 100644 index 00000000..076ae465 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/index.js @@ -0,0 +1,63 @@ +'use strict'; + +var assign = require('es5-ext/object/assign') + , normalizeOpts = require('es5-ext/object/normalize-options') + , isCallable = require('es5-ext/object/is-callable') + , contains = require('es5-ext/string/#/contains') + + , d; + +d = module.exports = function (dscr, value/*, options*/) { + var c, e, w, options, desc; + if ((arguments.length < 2) || (typeof dscr !== 'string')) { + options = value; + value = dscr; + dscr = null; + } else { + options = arguments[2]; + } + if (dscr == null) { + c = w = true; + e = false; + } else { + c = contains.call(dscr, 'c'); + e = contains.call(dscr, 'e'); + w = contains.call(dscr, 'w'); + } + + desc = { value: value, configurable: c, enumerable: e, writable: w }; + return !options ? desc : assign(normalizeOpts(options), desc); +}; + +d.gs = function (dscr, get, set/*, options*/) { + var c, e, options, desc; + if (typeof dscr !== 'string') { + options = set; + set = get; + get = dscr; + dscr = null; + } else { + options = arguments[3]; + } + if (get == null) { + get = undefined; + } else if (!isCallable(get)) { + options = get; + get = set = undefined; + } else if (set == null) { + set = undefined; + } else if (!isCallable(set)) { + options = set; + set = undefined; + } + if (dscr == null) { + c = true; + e = false; + } else { + c = contains.call(dscr, 'c'); + e = contains.call(dscr, 'e'); + } + + desc = { get: get, set: set, configurable: c, enumerable: e }; + return !options ? desc : assign(normalizeOpts(options), desc); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/lazy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/lazy.js new file mode 100644 index 00000000..61e46653 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/lazy.js @@ -0,0 +1,111 @@ +'use strict'; + +var map = require('es5-ext/object/map') + , isCallable = require('es5-ext/object/is-callable') + , validValue = require('es5-ext/object/valid-value') + , contains = require('es5-ext/string/#/contains') + + , call = Function.prototype.call + , defineProperty = Object.defineProperty + , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor + , getPrototypeOf = Object.getPrototypeOf + , hasOwnProperty = Object.prototype.hasOwnProperty + , cacheDesc = { configurable: false, enumerable: false, writable: false, + value: null } + , define; + +define = function (name, options) { + var value, dgs, cacheName, desc, writable = false, resolvable + , flat; + options = Object(validValue(options)); + cacheName = options.cacheName; + flat = options.flat; + if (cacheName == null) cacheName = name; + delete options.cacheName; + value = options.value; + resolvable = isCallable(value); + delete options.value; + dgs = { configurable: Boolean(options.configurable), + enumerable: Boolean(options.enumerable) }; + if (name !== cacheName) { + dgs.get = function () { + if (hasOwnProperty.call(this, cacheName)) return this[cacheName]; + cacheDesc.value = resolvable ? call.call(value, this, options) : value; + cacheDesc.writable = writable; + defineProperty(this, cacheName, cacheDesc); + cacheDesc.value = null; + if (desc) defineProperty(this, name, desc); + return this[cacheName]; + }; + } else if (!flat) { + dgs.get = function self() { + var ownDesc; + if (hasOwnProperty.call(this, name)) { + ownDesc = getOwnPropertyDescriptor(this, name); + // It happens in Safari, that getter is still called after property + // was defined with a value, following workarounds that + if (ownDesc.hasOwnProperty('value')) return ownDesc.value; + if ((typeof ownDesc.get === 'function') && (ownDesc.get !== self)) { + return ownDesc.get.call(this); + } + return value; + } + desc.value = resolvable ? call.call(value, this, options) : value; + defineProperty(this, name, desc); + desc.value = null; + return this[name]; + }; + } else { + dgs.get = function self() { + var base = this, ownDesc; + if (hasOwnProperty.call(this, name)) { + // It happens in Safari, that getter is still called after property + // was defined with a value, following workarounds that + ownDesc = getOwnPropertyDescriptor(this, name); + if (ownDesc.hasOwnProperty('value')) return ownDesc.value; + if ((typeof ownDesc.get === 'function') && (ownDesc.get !== self)) { + return ownDesc.get.call(this); + } + } + while (!hasOwnProperty.call(base, name)) base = getPrototypeOf(base); + desc.value = resolvable ? call.call(value, base, options) : value; + defineProperty(base, name, desc); + desc.value = null; + return base[name]; + }; + } + dgs.set = function (value) { + dgs.get.call(this); + this[cacheName] = value; + }; + if (options.desc) { + desc = { + configurable: contains.call(options.desc, 'c'), + enumerable: contains.call(options.desc, 'e') + }; + if (cacheName === name) { + desc.writable = contains.call(options.desc, 'w'); + desc.value = null; + } else { + writable = contains.call(options.desc, 'w'); + desc.get = dgs.get; + desc.set = dgs.set; + } + delete options.desc; + } else if (cacheName === name) { + desc = { + configurable: Boolean(options.configurable), + enumerable: Boolean(options.enumerable), + writable: Boolean(options.writable), + value: null + }; + } + delete options.configurable; + delete options.enumerable; + delete options.writable; + return dgs; +}; + +module.exports = function (props) { + return map(props, function (desc, name) { return define(name, desc); }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/package.json new file mode 100644 index 00000000..03d81db1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/package.json @@ -0,0 +1,59 @@ +{ + "name": "d", + "version": "0.1.1", + "description": "Property descriptor factory", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "scripts": { + "test": "node node_modules/tad/bin/tad" + }, + "repository": { + "type": "git", + "url": "git://github.com/medikoo/d.git" + }, + "keywords": [ + "descriptor", + "es", + "ecmascript", + "ecma", + "property", + "descriptors", + "meta", + "properties" + ], + "dependencies": { + "es5-ext": "~0.10.2" + }, + "devDependencies": { + "tad": "~0.1.21" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/medikoo/d/issues" + }, + "homepage": "https://github.com/medikoo/d", + "_id": "d@0.1.1", + "dist": { + "shasum": "da184c535d18d8ee7ba2aa229b914009fae11309", + "tarball": "http://registry.npmjs.org/d/-/d-0.1.1.tgz" + }, + "_from": "d@>=0.1.1 <0.2.0", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "directories": {}, + "_shasum": "da184c535d18d8ee7ba2aa229b914009fae11309", + "_resolved": "https://registry.npmjs.org/d/-/d-0.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/test/auto-bind.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/test/auto-bind.js new file mode 100644 index 00000000..89edfb88 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/test/auto-bind.js @@ -0,0 +1,12 @@ +'use strict'; + +var d = require('../'); + +module.exports = function (t, a) { + var o = Object.defineProperties({}, t({ + bar: d(function () { return this === o; }), + bar2: d(function () { return this; }) + })); + + a.deep([(o.bar)(), (o.bar2)()], [true, o]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/test/index.js new file mode 100644 index 00000000..3db0af10 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/test/index.js @@ -0,0 +1,182 @@ +'use strict'; + +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + +module.exports = function (t, a) { + var o, c, cg, cs, ce, ceg, ces, cew, cw, e, eg, es, ew, v, vg, vs, w, df, dfg + , dfs; + + o = Object.create(Object.prototype, { + c: t('c', c = {}), + cgs: t.gs('c', cg = function () {}, cs = function () {}), + ce: t('ce', ce = {}), + cegs: t.gs('ce', ceg = function () {}, ces = function () {}), + cew: t('cew', cew = {}), + cw: t('cw', cw = {}), + e: t('e', e = {}), + egs: t.gs('e', eg = function () {}, es = function () {}), + ew: t('ew', ew = {}), + v: t('', v = {}), + vgs: t.gs('', vg = function () {}, vs = function () {}), + w: t('w', w = {}), + + df: t(df = {}), + dfgs: t.gs(dfg = function () {}, dfs = function () {}) + }); + + return { + c: function (a) { + var d = getOwnPropertyDescriptor(o, 'c'); + a(d.value, c, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, false, "Writable"); + + d = getOwnPropertyDescriptor(o, 'cgs'); + a(d.value, undefined, "GS Value"); + a(d.get, cg, "GS Get"); + a(d.set, cs, "GS Set"); + a(d.configurable, true, "GS Configurable"); + a(d.enumerable, false, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + ce: function (a) { + var d = getOwnPropertyDescriptor(o, 'ce'); + a(d.value, ce, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, true, "Enumerable"); + a(d.writable, false, "Writable"); + + d = getOwnPropertyDescriptor(o, 'cegs'); + a(d.value, undefined, "GS Value"); + a(d.get, ceg, "GS Get"); + a(d.set, ces, "GS Set"); + a(d.configurable, true, "GS Configurable"); + a(d.enumerable, true, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + cew: function (a) { + var d = getOwnPropertyDescriptor(o, 'cew'); + a(d.value, cew, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, true, "Enumerable"); + a(d.writable, true, "Writable"); + }, + cw: function (a) { + var d = getOwnPropertyDescriptor(o, 'cw'); + a(d.value, cw, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, true, "Writable"); + }, + e: function (a) { + var d = getOwnPropertyDescriptor(o, 'e'); + a(d.value, e, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, false, "Configurable"); + a(d.enumerable, true, "Enumerable"); + a(d.writable, false, "Writable"); + + d = getOwnPropertyDescriptor(o, 'egs'); + a(d.value, undefined, "GS Value"); + a(d.get, eg, "GS Get"); + a(d.set, es, "GS Set"); + a(d.configurable, false, "GS Configurable"); + a(d.enumerable, true, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + ew: function (a) { + var d = getOwnPropertyDescriptor(o, 'ew'); + a(d.value, ew, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, false, "Configurable"); + a(d.enumerable, true, "Enumerable"); + a(d.writable, true, "Writable"); + }, + v: function (a) { + var d = getOwnPropertyDescriptor(o, 'v'); + a(d.value, v, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, false, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, false, "Writable"); + + d = getOwnPropertyDescriptor(o, 'vgs'); + a(d.value, undefined, "GS Value"); + a(d.get, vg, "GS Get"); + a(d.set, vs, "GS Set"); + a(d.configurable, false, "GS Configurable"); + a(d.enumerable, false, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + w: function (a) { + var d = getOwnPropertyDescriptor(o, 'w'); + a(d.value, w, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, false, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, true, "Writable"); + }, + d: function (a) { + var d = getOwnPropertyDescriptor(o, 'df'); + a(d.value, df, "Value"); + a(d.get, undefined, "Get"); + a(d.set, undefined, "Set"); + a(d.configurable, true, "Configurable"); + a(d.enumerable, false, "Enumerable"); + a(d.writable, true, "Writable"); + + d = getOwnPropertyDescriptor(o, 'dfgs'); + a(d.value, undefined, "GS Value"); + a(d.get, dfg, "GS Get"); + a(d.set, dfs, "GS Set"); + a(d.configurable, true, "GS Configurable"); + a(d.enumerable, false, "GS Enumerable"); + a(d.writable, undefined, "GS Writable"); + }, + Options: { + v: function (a) { + var x = {}, d = t(x, { foo: true }); + a.deep(d, { configurable: true, enumerable: false, writable: true, + value: x, foo: true }, "No descriptor"); + d = t('c', 'foo', { marko: 'elo' }); + a.deep(d, { configurable: true, enumerable: false, writable: false, + value: 'foo', marko: 'elo' }, "Descriptor"); + }, + gs: function (a) { + var gFn = function () {}, sFn = function () {}, d; + d = t.gs(gFn, sFn, { foo: true }); + a.deep(d, { configurable: true, enumerable: false, get: gFn, set: sFn, + foo: true }, "No descriptor"); + d = t.gs(null, sFn, { foo: true }); + a.deep(d, { configurable: true, enumerable: false, get: undefined, + set: sFn, foo: true }, "No descriptor: Just set"); + d = t.gs(gFn, { foo: true }); + a.deep(d, { configurable: true, enumerable: false, get: gFn, + set: undefined, foo: true }, "No descriptor: Just get"); + + d = t.gs('e', gFn, sFn, { bar: true }); + a.deep(d, { configurable: false, enumerable: true, get: gFn, set: sFn, + bar: true }, "Descriptor"); + d = t.gs('e', null, sFn, { bar: true }); + a.deep(d, { configurable: false, enumerable: true, get: undefined, + set: sFn, bar: true }, "Descriptor: Just set"); + d = t.gs('e', gFn, { bar: true }); + a.deep(d, { configurable: false, enumerable: true, get: gFn, + set: undefined, bar: true }, "Descriptor: Just get"); + } + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/test/lazy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/test/lazy.js new file mode 100644 index 00000000..8266deb2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/d/test/lazy.js @@ -0,0 +1,77 @@ +'use strict'; + +var d = require('../') + + , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + +module.exports = function (t, a) { + var Foo = function () {}, i = 1, o, o2, desc; + Object.defineProperties(Foo.prototype, t({ + bar: d(function () { return ++i; }), + bar2: d(function () { return this.bar + 23; }), + bar3: d(function () { return this.bar2 + 34; }, { desc: 'ew' }), + bar4: d(function () { return this.bar3 + 12; }, { cacheName: '_bar4_' }), + bar5: d(function () { return this.bar4 + 3; }, + { cacheName: '_bar5_', desc: 'e' }) + })); + + desc = getOwnPropertyDescriptor(Foo.prototype, 'bar'); + a(desc.configurable, true, "Configurable: default"); + a(desc.enumerable, false, "Enumerable: default"); + + o = new Foo(); + a.deep([o.bar, o.bar2, o.bar3, o.bar4, o.bar5], [2, 25, 59, 71, 74], + "Values"); + + a.deep(getOwnPropertyDescriptor(o, 'bar3'), { configurable: false, + enumerable: true, writable: true, value: 59 }, "Desc"); + a(o.hasOwnProperty('bar4'), false, "Cache not exposed"); + desc = getOwnPropertyDescriptor(o, 'bar5'); + a.deep(desc, { configurable: false, + enumerable: true, get: desc.get, set: desc.set }, "Cache & Desc: desc"); + + o2 = Object.create(o); + o2.bar = 30; + o2.bar3 = 100; + + a.deep([o2.bar, o2.bar2, o2.bar3, o2.bar4, o2.bar5], [30, 25, 100, 112, 115], + "Extension Values"); + + Foo = function () {}; + Object.defineProperties(Foo.prototype, t({ + test: d('w', function () { return 'raz'; }), + test2: d('', function () { return 'raz'; }, { desc: 'w' }), + test3: d('', function () { return 'raz'; }, + { cacheName: '__test3__', desc: 'w' }), + test4: d('w', 'bar') + })); + + o = new Foo(); + o.test = 'marko'; + a.deep(getOwnPropertyDescriptor(o, 'test'), + { configurable: false, enumerable: false, writable: true, value: 'marko' }, + "Set before get"); + o.test2 = 'marko2'; + a.deep(getOwnPropertyDescriptor(o, 'test2'), + { configurable: false, enumerable: false, writable: true, value: 'marko2' }, + "Set before get: Custom desc"); + o.test3 = 'marko3'; + a.deep(getOwnPropertyDescriptor(o, '__test3__'), + { configurable: false, enumerable: false, writable: true, value: 'marko3' }, + "Set before get: Custom cache name"); + a(o.test4, 'bar', "Resolve by value"); + + a.h1("Flat"); + Object.defineProperties(Foo.prototype, t({ + flat: d(function () { return 'foo'; }, { flat: true }), + flat2: d(function () { return 'bar'; }, { flat: true }) + })); + + a.h2("Instance"); + a(o.flat, 'foo', "Value"); + a(o.hasOwnProperty('flat'), false, "Instance"); + a(Foo.prototype.flat, 'foo', "Prototype"); + + a.h2("Direct"); + a(Foo.prototype.flat2, 'bar'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.lint new file mode 100644 index 00000000..d1da6103 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.lint @@ -0,0 +1,38 @@ +@root + +module + +indent 2 +maxlen 100 +tabs + +ass +continue +forin +nomen +plusplus +vars + +./global.js +./function/_define-length.js +./function/#/copy.js +./object/unserialize.js +./test/function/valid-function.js +evil + +./math/_pack-ieee754.js +./math/_unpack-ieee754.js +./math/clz32/shim.js +./math/imul/shim.js +./number/to-uint32.js +./string/#/at.js +bitwise + +./math/fround/shim.js +predef+ Float32Array + +./object/first-key.js +forin + +./test/reg-exp/#/index.js +predef+ __dirname diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.lintignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.lintignore new file mode 100644 index 00000000..ed703ed7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.lintignore @@ -0,0 +1,8 @@ +/string/#/normalize/_data.js +/test/boolean/is-boolean.js +/test/date/is-date.js +/test/number/is-number.js +/test/object/is-copy.js +/test/object/is-object.js +/test/reg-exp/is-reg-exp.js +/test/string/is-string.js diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.npmignore new file mode 100644 index 00000000..eb09b500 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/.lintcache +/npm-debug.log diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.travis.yml new file mode 100644 index 00000000..a183dbce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/.travis.yml @@ -0,0 +1,15 @@ +sudo: false # http://docs.travis-ci.com/user/workers/container-based-infrastructure/ +language: node_js +node_js: + - 0.10 + - 0.12 + - iojs + +before_install: + - mkdir node_modules; ln -s ../ node_modules/es5-ext + +notifications: + email: + - medikoo+es5-ext@medikoo.com + +script: "npm test && npm run lint" diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/CHANGES new file mode 100644 index 00000000..5d0ace5b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/CHANGES @@ -0,0 +1,611 @@ +v0.10.7 -- 2015.04.22 +* New utlitities. They're convention differs from v0.10, as they were supposed to land in v1. + Still they're non breaking and start the conventions to be used in v1 + * Object.validateArrayLike + * Object.validateArrayLikeObject + * Object.validateStringifiable + * Object.validateStringifiableValue + * Universal utilities for array-like/iterable objects + * Iterable.is + * Iterable.validate + * Iterable.validateObject + * Iterable.forEach +* Fix camelToHyphen resolution, it must be absolutely reversable by hyphenToCamel +* Fix calculations of large numbers in Math.tanh +* Fix algorithm of Math.sinh +* Fix indexes to not use real symbols +* Fix length of String.fromCodePoint +* Fix tests of Array#copyWithin +* Update Travis CI configuration + +v0.10.6 -- 2015.02.02 +* Fix handling of infinite values in Math.trunc +* Fix handling of getters in Object.normalizeOptions + +v0.10.5 -- 2015.01.20 +* Add Function#toStringTokens +* Add Object.serialize and Object.unserialize +* Add String.randomUniq +* Fix Strin#camelToHyphen issue with tokens that end with digit +* Optimise Number.isInteger logic +* Improve documentation +* Configure lint scripts +* Fix spelling of LICENSE + +v0.10.4 -- 2014.04.30 +* Assure maximum spec compliance of Array.of and Array.from (thanks @mathiasbynens) +* Improve documentations + +v0.10.3 -- 2014.04.29 +Provide accurate iterators handling: +* Array.from improvements: + * Assure right unicode symbols resolution when processing strings in Array.from + * Rely on ES6 symbol shim and use native @@iterator Symbol if provided by environment +* Add methods: + * Array.prototype.entries + * Array.prototype.keys + * Array.prototype.values + * Array.prototype[@@iterator] + * String.prototype[@@iterator] + +Improve documentation + +v0.10.2 -- 2014.04.24 +- Simplify and deprecate `isCallable`. It seems in ES5 based engines there are + no callable objects which are `typeof obj !== 'function'` +- Update Array.from map callback signature (up to latest resolution of TC39) +- Improve documentation + +v0.10.1 -- 2014.04.14 +Bump version for npm +(Workaround for accidental premature publish & unpublish of v0.10.0 a while ago) + +v0.10.0 -- 2014.04.13 +Major update: +- All methods and function specified for ECMAScript 6 are now introduced as + shims accompanied with functions through which (optionally) they can be + implementend on native objects +- Filename convention was changed to shorter and strictly lower case names. e.g. + `lib/String/prototype/starts-with` became `string/#/starts-with` +- Generated functions are guaranteed to have expected length +- Objects with null prototype (created via `Object.create(null)`) are widely + supported (older version have crashed due to implied `obj.hasOwnProperty` and + related invocations) +- Support array subclasses +- When handling lists do not limit its length to Uint32 range +- Use newly introduced `Object.eq` for strict equality in place of `Object.is` +- Iteration of Object have been improved so properties that were hidden or + removed after iteration started are not iterated. + +Additions: +- `Array.isPlainArray` +- `Array.validArray` +- `Array.prototype.concat` (as updated with ES6) +- `Array.prototype.copyWithin` (as introduced with ES6) +- `Array.prototype.fill` (as introduced with ES6) +- `Array.prototype.filter` (as updated with ES6) +- `Array.prototype.findIndex` (as introduced with ES6) +- `Array.prototype.map` (as updated with ES6) +- `Array.prototype.separate` +- `Array.prototype.slice` (as updated with ES6) +- `Array.prototype.splice` (as updated with ES6) +- `Function.prototype.copy` +- `Math.acosh` (as introduced with ES6) +- `Math.atanh` (as introduced with ES6) +- `Math.cbrt` (as introduced with ES6) +- `Math.clz32` (as introduced with ES6) +- `Math.cosh` (as introduced with ES6) +- `Math.expm1` (as introduced with ES6) +- `Math.fround` (as introduced with ES6) +- `Math.hypot` (as introduced with ES6) +- `Math.imul` (as introduced with ES6) +- `Math.log2` (as introduced with ES6) +- `Math.log10` (as introduced with ES6) +- `Math.log1p` (as introduced with ES6) +- `Math.sinh` (as introduced with ES6) +- `Math.tanh` (as introduced with ES6) +- `Math.trunc` (as introduced with ES6) +- `Number.EPSILON` (as introduced with ES6) +- `Number.MIN_SAFE_INTEGER` (as introduced with ES6) +- `Number.MAX_SAFE_INTEGER` (as introduced with ES6) +- `Number.isFinite` (as introduced with ES6) +- `Number.isInteger` (as introduced with ES6) +- `Number.isSafeInteger` (as introduced with ES6) +- `Object.create` (with fix for V8 issue which disallows prototype turn of + objects derived from null +- `Object.eq` - Less restrictive version of `Object.is` based on SameValueZero + algorithm +- `Object.firstKey` +- `Object.keys` (as updated with ES6) +- `Object.mixinPrototypes` +- `Object.primitiveSet` +- `Object.setPrototypeOf` (as introduced with ES6) +- `Object.validObject` +- `RegExp.escape` +- `RegExp.prototype.match` (as introduced with ES6) +- `RegExp.prototype.replace` (as introduced with ES6) +- `RegExp.prototype.search` (as introduced with ES6) +- `RegExp.prototype.split` (as introduced with ES6) +- `RegExp.prototype.sticky` (as introduced with ES6) +- `RegExp.prototype.unicode` (as introduced with ES6) +- `String.fromCodePoint` (as introduced with ES6) +- `String.raw` (as introduced with ES6) +- `String.prototype.at` +- `String.prototype.codePointAt` (as introduced with ES6) +- `String.prototype.normalize` (as introduced with ES6) +- `String.prototype.plainReplaceAll` + +Removals: +- `reserved` set +- `Array.prototype.commonLeft` +- `Function.insert` +- `Function.remove` +- `Function.prototype.silent` +- `Function.prototype.wrap` +- `Object.descriptor` Move to external `d` project. + See: https://github.com/medikoo/d +- `Object.diff` +- `Object.extendDeep` +- `Object.reduce` +- `Object.values` +- `String.prototype.trimCommonLeft` + +Renames: +- `Function.i` into `Function.identity` +- `Function.k` into `Function.constant` +- `Number.toInt` into `Number.toInteger` +- `Number.toUint` into `Number.toPosInteger` +- `Object.extend` into `Object.assign` (as introduced in ES 6) +- `Object.extendProperties` into `Object.mixin`, with improved internal + handling, so it matches temporarily specified `Object.mixin` for ECMAScript 6 +- `Object.isList` into `Object.isArrayLike` +- `Object.mapToArray` into `Object.toArray` (with fixed function length) +- `Object.toPlainObject` into `Object.normalizeOptions` (as this is the real + use case where we use this function) +- `Function.prototype.chain` into `Function.prototype.compose` +- `Function.prototype.match` into `Function.prototype.spread` +- `String.prototype.format` into `String.formatMethod` + +Improvements & Fixes: +- Remove workaround for primitive values handling in object iterators +- `Array.from`: Update so it follows ES 6 spec +- `Array.prototype.compact`: filters just null and undefined values + (not all falsies) +- `Array.prototype.eIndexOf` and `Array.prototype.eLastIndexOf`: fix position + handling, improve internals +- `Array.prototype.find`: return undefined not null, in case of not found + (follow ES 6) +- `Array.prototype.remove` fix function length +- `Error.custom`: simplify, Custom class case is addressed by outer + `error-create` project -> https://github.com/medikoo/error-create +- `Error.isError` true only for Error instances (remove detection of host + Exception objects) +- `Number.prototype.pad`: Normalize negative pad +- `Object.clear`: Handle errors same way as in `Object.assign` +- `Object.compact`: filters just null and undefined values (not all falsies) +- `Object.compare`: Take into account NaN values +- `Object.copy`: Split into `Object.copy` and `Object.copyDeep` +- `Object.isCopy`: Separate into `Object.isCopy` and `Object.isCopyDeep`, where + `isCopyDeep` handles nested plain objects and plain arrays only +- `String.prototype.endsWith`: Adjust up to ES6 specification +- `String.prototype.repeat`: Adjust up to ES6 specification and improve algorithm +- `String.prototype.simpleReplace`: Rename into `String.prototype.plainReplace` +- `String.prototype.startsWith`: Adjust up to ES6 specification +- Update lint rules, and adjust code to that +- Update Travis CI configuration +- Remove Makefile (it's cross-env utility) + +v0.9.2 -- 2013.03.11 +Added: +* Array.prototype.isCopy +* Array.prototype.isUniq +* Error.CustomError +* Function.validFunction +* Object.extendDeep +* Object.descriptor.binder +* Object.safeTraverse +* RegExp.validRegExp +* String.prototype.capitalize +* String.prototype.simpleReplace + +Fixed: +* Fix Array.prototype.diff for sparse arrays +* Accept primitive objects as input values in Object iteration methods and + Object.clear, Object.count, Object.diff, Object.extend, + Object.getPropertyNames, Object.values +* Pass expected arguments to callbacks of Object.filter, Object.mapKeys, + Object.mapToArray, Object.map +* Improve callable callback support in Object.mapToArray + +v0.9.1 -- 2012.09.17 +* Object.reduce - reduce for hash-like collections +* Accapt any callable object as callback in Object.filter, mapKeys and map +* Convention cleanup + +v0.9.0 -- 2012.09.13 +We're getting to real solid API + +Removed: +* Function#memoize - it's grown up to be external package, to be soon published + as 'memoizee' +* String.guid - it doesn't fit es5-ext (extensions) concept, will be provided as + external package +# Function.arguments - obsolete +# Function.context - obsolete +# Function#flip - not readable when used, so it was never used +# Object.clone - obsolete and confusing + +Added: +* String#camelToHyphen - String format convertion + +Renamed: +* String#dashToCamelCase -> String#hyphenToCamel + +Fixes: +* Object.isObject - Quote names in literals that match reserved keywords + (older implementations crashed on that) +* String#repeat - Do not accept negative values (coerce them to 1) + +Improvements: +* Array#remove - Accepts many arguments, we can now remove many values at once +* Object iterators (forEach, map, some) - Compare function invoked with scope + object bound to this +* Function#curry - Algorithm cleanup +* Object.isCopy - Support for all types, not just plain objects +* Object.isPlainObject - Support for cross-frame objects +* Do not memoize any of the functions, it shouldn't be decided internally +* Remove Object.freeze calls in reserved, it's not up to convention +* Improved documentation +* Better linting (hard-core approach using both JSLint mod and JSHint) +* Optional arguments are now documented in funtions signature + +v0.8.2 -- 2012.06.22 +Fix errors in Array's intersection and exclusion methods, related to improper +usage of contains method + +v0.8.1 -- 2012.06.13 +Reorganized internal logic of Function.prototype.memoize. So it's more safe now +and clears cache properly. Additionally preventCache option was provided. + +v0.8.0 -- 2012.05.28 +Again, major overhaul. Probably last experimental stuff was trashed, all API +looks more like standard extensions now. + +Changes: +* Turn all Object.prototype extensions into functions and move them to Object +namespace. We learned that extending Object.prototype is bad idea in any case. +* Rename Function.prototype.curry into Function.prototype.partial. This function + is really doing partial application while currying is slightly different + concept. +* Convert Function.prototype.ncurry to new implementation of + Function.prototype.curry, it now serves real curry concept additionaly it + covers use cases for aritize and hold, which were removed. +* Rename Array's peek to last, and provide support for sparse arrays in it +* Rename Date's monthDaysCount into daysInMonth +* Simplify object iterators, now order of iteration can be configured with just + compareFn argument (no extra byKeys option) +* Rename Object.isDuplicate to Object.isCopy +* Rename Object.isEqual to Object.is which is compatible with future 'is' + keyword +* Function.memoize is now Function.prototype.memoize. Additionally clear cache + functionality is added, and access to original arguments object. +* Rename validation functions: assertNotNull to validValue, assertCallable to + validCallable. validValue was moved to Object namespace. On success they now + return validated value instead of true, it supports better composition. + Additionally created Date.validDate and Error.validError +* All documentation is now held in README.md not in code files. +* Move guid to String namespace. All guids now start with numbers. +* Array.generate: fill argument is now optional +* Object.toArray is now Array.from (as new ES6 specification draft suggests) +* All methods that rely on indexOf or lastIndexOf, now rely on egal (Object.is) + versions of them (eIndexOf, eLastIndexOf) +* Turn all get* functions that returned methods into actuall methods (get* + functionality can still be achieved with help of Function.prototype.partial). + So: Date.getFormat is now Date.prototype.format, + Number.getPad is now Number.prototype.pad, + String.getFormat is now String.prototype.format, + String.getIndent is now String.prototype.indent, + String.getPad is now String.prototype.pad +* Refactored Object.descriptor, it is now just two functions, main one and + main.gs, main is for describing values, and gs for describing getters and + setters. Configuration is passed with first argument as string e.g. 'ce' for + configurable and enumerable. If no configuration string is provided then by + default it returns configurable and writable but not enumerable for value or + configurable but not enumerable for getter/setter +* Function.prototype.silent now returns prepared function (it was + expected to be fixed for 0.7) +* Reserved keywords map (reserved) is now array not hash. +* Object.merge is now Object.extend (while former Object.extend was completely + removed) - 'extend' implies that we change object, not creating new one (as + 'merge' may imply). Similarily Object.mergeProperties was renamed to + Object.extendProperties +* Position argument support in Array.prototype.contains and + String.prototype.contains (so it follows ES6 specification draft) +* endPosition argument support in String.prototype.endsWith and fromPosition + argument support in String.prototype.startsWith (so it follows ES6 + specification draft) +* Better and cleaner String.prototype.indent implementation. No default value + for indent string argument, optional nest value (defaults to 1), remove + nostart argument +* Correct length values for most methods (so they reflect length of similar + methods in standard) +* Length argument is now optional in number and string pad methods. +* Improve arguments validation in general, so it adheres to standard conventions +* Fixed format of package.json + +Removed methods and functions: +* Object.prototype.slice - Object is not ordered collection, so slice doesn't + make sense. +* Function's rcurry, rncurry, s - too cumbersome for JS, not many use cases for + that +* Function.prototype.aritize and Function.prototype.hold - same functionality + can be achieved with new Function.prototype.curry +* Function.prototype.log - provided more generic Function.prototype.wrap for + same use case +* getNextIdGenerator - no use case for that (String.guid should be used if + needed) +* Object.toObject - Can be now acheived with Object(validValue(x)) +* Array.prototype.someValue - no real use case (personally used once and + case was already controversial) +* Date.prototype.duration - moved to external package +* Number.getAutoincrement - No real use case +* Object.prototype.extend, Object.prototype.override, + Object.prototype.plainCreate, Object.prototype.plainExtend - It was probably + too complex, same should be achieved just with Object.create, + Object.descriptor and by saving references to super methods in local scope. +* Object.getCompareBy - Functions should be created individually for each use + case +* Object.get, Object.getSet, Object.set, Object.unset - Not many use cases and + same can be easily achieved with simple inline function +* String.getPrefixWith - Not real use case for something that can be easily + achieved with '+' operator +* Object.isPrimitive - It's just negation of Object.isObject +* Number.prototype.isLess, Number.prototype.isLessOrEqual - they shouldn't be in + Number namespace and should rather be addressed with simple inline functions. +* Number.prototype.subtract - Should rather be addressed with simple inline + function + +New methods and functions: +* Array.prototype.lastIndex - Returns last declared index in array +* String.prototype.last - last for strings +* Function.prototype.wrap - Wrap function with other, it allows to specify + before and after behavior transform return value or prevent original function + from being called. +* Math.sign - Returns sign of a number (already in ES6 specification draft) +* Number.toInt - Converts value to integer (already in ES6 specification draft) +* Number.isNaN - Returns true if value is NaN (already in ES6 specification + draft) +* Number.toUint - Converts value to unsigned integer +* Number.toUint32 - Converts value to 32bit unsigned integer +* Array.prototype.eIndexOf, eLastIndexOf - Egal version (that uses Object.is) of + standard methods (all methods that were using native indexOf or lastIndexOf + now uses eIndexOf and elastIndexOf respectively) +* Array.of - as it's specified for ES6 + +Fixes: +* Fixed binarySearch so it always returns valid list index +* Object.isList - it failed on lists that are callable (e.g. NodeList in Nitro + engine) +* Object.map now supports third argument for callback + +v0.7.1 -- 2012.01.05 +New methods: +* Array.prototype.firstIndex - returns first valid index of array (for + sparse arrays it may not be '0' + +Improvements: +* Array.prototype.first - now returns value for index returned by firstIndex +* Object.prototype.mapToArray - can be called without callback, then array of + key-value pairs is returned + +Fixes +* Array.prototype.forEachRight, object's length read through UInt32 conversion + +v0.7.0 -- 2011.12.27 +Major update. +Stepped back from experimental ideas and introduced more standard approach +taking example from how ES5 methods and functions are designed. One exceptions +is that, we don’t refrain from declaring methods for Object.prototype - it’s up +to developer whether how he decides to use it in his context (as function or as +method). + +In general: +* Removed any method 'functionalization' and functionalize method itself. + es5-ext declares plain methods, which can be configured to work as functions + with call.bind(method) - see documentation. +* Removed separation of Object methods for ES5 (with descriptors) and + ES3 (plain) - we're following ES5 idea on that, some methods are intended just + for enumerable properties and some are for all properties, all are declared + for Object.prototype +* Removed separation of Array generic (collected in List folder) and not generic + methods (collected in Array folder). Now all methods are generic and are in + Array/prototype folder. This separation also meant, that methods in Array are + usually destructive. We don’t do that separation now, there’s generally no use + case for destructive iterators, we should be fine with one version of each + method, (same as ES5 is fine with e.g. one, non destructive 'filter' method) +* Folder structure resembles tree of native ES5 Objects +* All methods are written with ES5 conventions in mind, it means that most + methods are generic and can be run on any object. In more detail: + ** Array.prototype and Object.prototype methods can be run on any object (any + not null or undefined value), + ** Date.prototype methods should be called only on Date instances. + ** Function.prototype methods can be called on any callable objects (not + necessarily functions) + ** Number.prototype & String.prototype methods can be called on any value, in + case of Number it it’ll be degraded to number, in case of string it’ll be + degraded to string. +* Travis CI support (only for Node v0.6 branch, as v0.4 has buggy V8 version) + +Improvements for existing functions and methods: +* Function.memoize (was Function.cache) is now fully generic, can operate on any + type of arguments and it’s NaN safe (all NaN objects are considered equal) +* Method properties passed to Object.prototype.extend or + Object.prototype.override can aside of _super optionally take prototype object + via _proto argument +* Object iterators: forEach, mapToArray and every can now iterate in specified + order +* pluck, invoke and other functions that return reusable functions or methods + have now their results memoized. + +New methods: +* Global: assertNotNull, getNextIdGenerator, guid, isEqual, isPrimitive, + toObject +* Array: generate +* Array.prototype: binarySearch, clear, contains, diff, exclusion, find, first, + forEachRight, group, indexesOf, intersection, remove, someRight, someValue +* Boolean: isBoolean +* Date: isDate +* Function: arguments, context, insert, isArguments, remove +* Function.prototype: not, silent +* Number: getAutoincrement, isNumber +* Number.prototype: isLessOrEqual, isLess, subtract +* Object: assertCallable, descriptor (functions for clean descriptors), + getCompareBy, isCallable, isObject +* Object.prototype: clone (real clone), compact, count, diff, empty, + getPropertyNames, get, keyOf, mapKeys, override, plainCreate, plainExtend, + slice, some, unset +* RegExp: isRegExp +* String: getPrefixWith, isString +* String.prototype: caseInsensitiveCompare, contains, isNumeric + +Renamed methods: +* Date.clone -> Date.prototype.copy +* Date.format -> Date.getFormat +* Date/day/floor -> Date.prototype.floorDay +* Date/month/floor -> Date.prototype.floorMonth +* Date/month/year -> Date.prototype.floorYear +* Function.cache -> Function.memoize +* Function.getApplyArg -> Function.prototype.match +* Function.sequence -> Function.prototype.chain +* List.findSameStartLength -> Array.prototype.commonLeft +* Number.pad -> Number.getPad +* Object/plain/clone -> Object.prototype.copy +* Object/plain/elevate -> Object.prototype.flatten +* Object/plain/same -> Object.prototype.isDuplicate +* Object/plain/setValue -> Object.getSet +* String.format -> String.getFormat +* String.indent -> String.getIndent +* String.pad -> String.getPad +* String.trimLeftStr -> String.prototype.trimCommonLeft +* Object.merge -> Object.prototype.mergeProperties +* Object/plain/pluck -> Object.prototype.get +* Array.clone is now Array.prototype.copy and can be used also on any array-like + objects +* List.isList -> Object.isList +* List.toArray -> Object.prototype.toArray +* String/convert/dashToCamelCase -> String.prototype.dashToCamelCase + +Removed methods: +* Array.compact - removed destructive version (that operated on same array), we + have now non destructive version as Array.prototype.compact. +* Function.applyBind -> use apply.bind directly +* Function.bindBind -> use bind.bind directly +* Function.callBind -> use call.bind directly +* Fuction.clone -> no valid use case +* Function.dscope -> controversial approach, shouldn’t be considered seriously +* Function.functionalize -> It was experimental but standards are standards +* List/sort/length -> It can be easy obtained by Object.getCompareBy(‘length’) +* List.concat -> Concat’s for array-like’s makes no sense, just convert to array + first +* List.every -> Use Array.prototype.every directly +* List.filter -> Use Array.prototype.filter directly +* List.forEach -> User Array.prototype.forEach directly +* List.isListObject -> No valid use case, do: isList(list) && (typeof list === + 'object’) +* List.map -> Use Array.prototype.map directly +* List.reduce -> Use Array.prototype.reduce directly +* List.shiftSame -> Use Array.prototype.commonLeft and do slice +* List.slice -> Use Array.prototype.slice directly +* List.some -> Use Array.prototype.some directly +* Object.bindMethods -> it was version that considered descriptors, we have now + Object.prototype.bindMethods which operates only on enumerable properties +* Object.every -> version that considered all properties, we have now + Object.prototype.every which iterates only enumerables +* Object.invoke -> no use case +* Object.mergeDeep -> no use case +* Object.pluck -> no use case +* Object.same -> it considered descriptors, now there’s only Object.isDuplicate + which compares only enumerable properties +* Object.sameType -> no use case +* Object.toDescriptor and Object.toDescriptors -> replaced by much nicer + Object.descriptor functions +* Object/plain/link -> no use case (it was used internally only by + Object/plain/merge) +* Object/plain/setTrue -> now easily configurable by more universal + Object.getSet(true) +* String.trimRightStr -> Eventually String.prototype.trimCommonRight will be + added + +v0.6.3 -- 2011.12.12 +* Cleared npm warning for misnamed property in package.json + +v0.6.2 -- 2011.08.12 +* Calling String.indent without scope (global scope then) now treated as calling + it with null scope, it allows more direct invocations when using default nest + string: indent().call(str, nest) + +v0.6.1 -- 2011.08.08 +* Added TAD test suite to devDependencies, configured test commands. + Tests can be run with 'make test' or 'npm test' + +v0.6.0 -- 2011.08.07 +New methods: +* Array: clone, compact (in place) +* Date: format, duration, clone, monthDaysCount, day.floor, month.floor, + year.floor +* Function: getApplyArg, , ncurry, rncurry, hold, cache, log +* List: findSameStartLength, shiftSame, peek, isListObject +* Number: pad +* Object: sameType, toString, mapToArray, mergeDeep, toDescriptor, + toDescriptors, invoke +* String: startsWith, endsWith, indent, trimLeftStr, trimRightStr, pad, format + +Fixed: +* Object.extend does now prototypal extend as exptected +* Object.merge now tries to overwrite only configurable properties +* Function.flip + +Improved: +* Faster List.toArray +* Better global retrieval +* Functionalized all Function methods +* Renamed bindApply and bindCall to applyBind and callBind +* Removed Function.inherit (as it's unintuitive curry clone) +* Straightforward logic in Function.k +* Fixed naming of some tests files (letter case issue) +* Renamed Function.saturate into Function.lock +* String.dashToCamelCase digits support +* Strings now considered as List objects +* Improved List.compact +* Concise logic for List.concat +* Test wit TAD in clean ES5 context + +v0.5.1 -- 2011.07.11 +* Function's bindBind, bindCall and bindApply now more versatile + +v0.5.0 -- 2011.07.07 +* Removed Object.is and List.apply +* Renamed Object.plain.is to Object.plain.isPlainObject (keep naming convention + consistent) +* Improved documentation + +v0.4.0 -- 2011.07.05 +* Take most functions on Object to Object.plain to keep them away from object + descriptors +* Object functions with ES5 standard in mind (object descriptors) + +v0.3.0 -- 2011.06.24 +* New functions +* Consistent file naming (dash instead of camelCase) + +v0.2.1 -- 2011.05.28 +* Renamed Functions.K and Function.S to to lowercase versions (use consistent + naming) + +v0.2.0 -- 2011.05.28 +* Renamed Array folder to List (as its generic functions for array-like objects) +* Added Makefile +* Added various functions + +v0.1.0 -- 2011.05.24 +* Initial version diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/LICENSE new file mode 100644 index 00000000..de39071f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2011-2015 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/README.md new file mode 100644 index 00000000..11d8a343 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/README.md @@ -0,0 +1,993 @@ +# es5-ext +## ECMAScript 5 extensions +### (with respect to ECMAScript 6 standard) + +Shims for upcoming ES6 standard and other goodies implemented strictly with ECMAScript conventions in mind. + +It's designed to be used in compliant ECMAScript 5 or ECMAScript 6 environments. Older environments are not supported, although most of the features should work with correct ECMAScript 5 shim on board. + +When used in ECMAScript 6 environment, native implementation (if valid) takes precedence over shims. + +### Installation + + $ npm install es5-ext + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +### Usage + +#### ECMAScript 6 features + +You can force ES6 features to be implemented in your environment, e.g. following will assign `from` function to `Array` (only if it's not implemented already). + +```javascript +require('es5-ext/array/from/implement'); +Array.from('foo'); // ['f', 'o', 'o'] +``` + +You can also access shims directly, without fixing native objects. Following will return native `Array.from` if it's available and fallback to shim if it's not. + +```javascript +var aFrom = require('es5-ext/array/from'); +aFrom('foo'); // ['f', 'o', 'o'] +``` + +If you want to use shim unconditionally (even if native implementation exists) do: + +```javascript +var aFrom = require('es5-ext/array/from/shim'); +aFrom('foo'); // ['f', 'o', 'o'] +``` + +##### List of ES6 shims + +It's about properties introduced with ES6 and those that have been updated in new spec. + +- `Array.from` -> `require('es5-ext/array/from')` +- `Array.of` -> `require('es5-ext/array/of')` +- `Array.prototype.concat` -> `require('es5-ext/array/#/concat')` +- `Array.prototype.copyWithin` -> `require('es5-ext/array/#/copy-within')` +- `Array.prototype.entries` -> `require('es5-ext/array/#/entries')` +- `Array.prototype.fill` -> `require('es5-ext/array/#/fill')` +- `Array.prototype.filter` -> `require('es5-ext/array/#/filter')` +- `Array.prototype.find` -> `require('es5-ext/array/#/find')` +- `Array.prototype.findIndex` -> `require('es5-ext/array/#/find-index')` +- `Array.prototype.keys` -> `require('es5-ext/array/#/keys')` +- `Array.prototype.map` -> `require('es5-ext/array/#/map')` +- `Array.prototype.slice` -> `require('es5-ext/array/#/slice')` +- `Array.prototype.splice` -> `require('es5-ext/array/#/splice')` +- `Array.prototype.values` -> `require('es5-ext/array/#/values')` +- `Array.prototype[@@iterator]` -> `require('es5-ext/array/#/@@iterator')` +- `Math.acosh` -> `require('es5-ext/math/acosh')` +- `Math.asinh` -> `require('es5-ext/math/asinh')` +- `Math.atanh` -> `require('es5-ext/math/atanh')` +- `Math.cbrt` -> `require('es5-ext/math/cbrt')` +- `Math.clz32` -> `require('es5-ext/math/clz32')` +- `Math.cosh` -> `require('es5-ext/math/cosh')` +- `Math.exmp1` -> `require('es5-ext/math/expm1')` +- `Math.fround` -> `require('es5-ext/math/fround')` +- `Math.hypot` -> `require('es5-ext/math/hypot')` +- `Math.imul` -> `require('es5-ext/math/imul')` +- `Math.log1p` -> `require('es5-ext/math/log1p')` +- `Math.log2` -> `require('es5-ext/math/log2')` +- `Math.log10` -> `require('es5-ext/math/log10')` +- `Math.sign` -> `require('es5-ext/math/sign')` +- `Math.signh` -> `require('es5-ext/math/signh')` +- `Math.tanh` -> `require('es5-ext/math/tanh')` +- `Math.trunc` -> `require('es5-ext/math/trunc')` +- `Number.EPSILON` -> `require('es5-ext/number/epsilon')` +- `Number.MAX_SAFE_INTEGER` -> `require('es5-ext/number/max-safe-integer')` +- `Number.MIN_SAFE_INTEGER` -> `require('es5-ext/number/min-safe-integer')` +- `Number.isFinite` -> `require('es5-ext/number/is-finite')` +- `Number.isInteger` -> `require('es5-ext/number/is-integer')` +- `Number.isNaN` -> `require('es5-ext/number/is-nan')` +- `Number.isSafeInteger` -> `require('es5-ext/number/is-safe-integer')` +- `Object.assign` -> `require('es5-ext/object/assign')` +- `Object.keys` -> `require('es5-ext/object/keys')` +- `Object.setPrototypeOf` -> `require('es5-ext/object/set-prototype-of')` +- `RegExp.prototype.match` -> `require('es5-ext/reg-exp/#/match')` +- `RegExp.prototype.replace` -> `require('es5-ext/reg-exp/#/replace')` +- `RegExp.prototype.search` -> `require('es5-ext/reg-exp/#/search')` +- `RegExp.prototype.split` -> `require('es5-ext/reg-exp/#/split')` +- `RegExp.prototype.sticky` -> Implement with `require('es5-ext/reg-exp/#/sticky/implement')`, use as function with `require('es5-ext/reg-exp/#/is-sticky')` +- `RegExp.prototype.unicode` -> Implement with `require('es5-ext/reg-exp/#/unicode/implement')`, use as function with `require('es5-ext/reg-exp/#/is-unicode')` +- `String.fromCodePoint` -> `require('es5-ext/string/from-code-point')` +- `String.raw` -> `require('es5-ext/string/raw')` +- `String.prototype.codePointAt` -> `require('es5-ext/string/#/code-point-at')` +- `String.prototype.contains` -> `require('es5-ext/string/#/contains')` +- `String.prototype.endsWith` -> `require('es5-ext/string/#/ends-with')` +- `String.prototype.normalize` -> `require('es5-ext/string/#/normalize')` +- `String.prototype.repeat` -> `require('es5-ext/string/#/repeat')` +- `String.prototype.startsWith` -> `require('es5-ext/string/#/starts-with')` +- `String.prototype[@@iterator]` -> `require('es5-ext/string/#/@@iterator')` + +#### Non ECMAScript standard features + +__es5-ext__ provides also other utils, and implements them as if they were proposed for a standard. It mostly offers methods (not functions) which can directly be assigned to native prototypes: + +```javascript +Object.defineProperty(Function.prototype, 'partial', { value: require('es5-ext/function/#/partial'), + configurable: true, enumerable: false, writable: true }); +Object.defineProperty(Array.prototype, 'flatten', { value: require('es5-ext/array/#/flatten'), + configurable: true, enumerable: false, writable: true }); +Object.defineProperty(String.prototype, 'capitalize', { value: require('es5-ext/string/#/capitalize'), + configurable: true, enumerable: false, writable: true }); +``` + +See [es5-extend](https://github.com/wookieb/es5-extend#es5-extend), a great utility that automatically will extend natives for you. + +__Important:__ Remember to __not__ extend natives in scope of generic reusable packages (e.g. ones you intend to publish to npm). Extending natives is fine __only__ if you're the _owner_ of the global scope, so e.g. in final project you lead development of. + +When you're in situation when native extensions are not good idea, then you should use methods indirectly: + + +```javascript +var flatten = require('es5-ext/array/#/flatten'); + +flatten.call([1, [2, [3, 4]]]); // [1, 2, 3, 4] +``` + +for better convenience you can turn methods into functions: + + +```javascript +var call = Function.prototype.call +var flatten = call.bind(require('es5-ext/array/#/flatten')); + +flatten([1, [2, [3, 4]]]); // [1, 2, 3, 4] +``` + +You can configure custom toolkit (like [underscorejs](http://underscorejs.org/)), and use it throughout your application + +```javascript +var util = {}; +util.partial = call.bind(require('es5-ext/function/#/partial')); +util.flatten = call.bind(require('es5-ext/array/#/flatten')); +util.startsWith = call.bind(require('es5-ext/string/#/starts-with')); + +util.flatten([1, [2, [3, 4]]]); // [1, 2, 3, 4] +``` + +As with native ones most methods are generic and can be run on any type of object. + +## API + +### Global extensions + +#### global _(es5-ext/global)_ + +Object that represents global scope + +### Array Constructor extensions + +#### from(arrayLike[, mapFn[, thisArg]]) _(es5-ext/array/from)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from). +Returns array representation of _iterable_ or _arrayLike_. If _arrayLike_ is an instance of array, its copy is returned. + +#### generate([length[, …fill]]) _(es5-ext/array/generate)_ + +Generate an array of pre-given _length_ built of repeated arguments. + +#### isPlainArray(x) _(es5-ext/array/is-plain-array)_ + +Returns true if object is plain array (not instance of one of the Array's extensions). + +#### of([…items]) _(es5-ext/array/of)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.of). +Create an array from given arguments. + +#### toArray(obj) _(es5-ext/array/to-array)_ + +Returns array representation of `obj`. If `obj` is already an array, `obj` is returned back. + +#### validArray(obj) _(es5-ext/array/valid-array)_ + +Returns `obj` if it's an array, otherwise throws `TypeError` + +### Array Prototype extensions + +#### arr.binarySearch(compareFn) _(es5-ext/array/#/binary-search)_ + +In __sorted__ list search for index of item for which _compareFn_ returns value closest to _0_. +It's variant of binary search algorithm + +#### arr.clear() _(es5-ext/array/#/clear)_ + +Clears the array + +#### arr.compact() _(es5-ext/array/#/compact)_ + +Returns a copy of the context with all non-values (`null` or `undefined`) removed. + +#### arr.concat() _(es5-ext/array/#/concat)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.concat). +ES6's version of `concat`. Supports `isConcatSpreadable` symbol, and returns array of same type as the context. + +#### arr.contains(searchElement[, position]) _(es5-ext/array/#/contains)_ + +Whether list contains the given value. + +#### arr.copyWithin(target, start[, end]) _(es5-ext/array/#/copy-within)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.copywithin). + +#### arr.diff(other) _(es5-ext/array/#/diff)_ + +Returns the array of elements that are present in context list but not present in other list. + +#### arr.eIndexOf(searchElement[, fromIndex]) _(es5-ext/array/#/e-index-of)_ + +_egal_ version of `indexOf` method. [_SameValueZero_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) logic is used for comparision + +#### arr.eLastIndexOf(searchElement[, fromIndex]) _(es5-ext/array/#/e-last-index-of)_ + +_egal_ version of `lastIndexOf` method. [_SameValueZero_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) logic is used for comparision + +#### arr.entries() _(es5-ext/array/#/entries)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.entries). +Returns iterator object, which traverses the array. Each value is represented with an array, where first value is an index and second is corresponding to index value. + +#### arr.exclusion([…lists]]) _(es5-ext/array/#/exclusion)_ + +Returns the array of elements that are found only in one of the lists (either context list or list provided in arguments). + +#### arr.fill(value[, start, end]) _(es5-ext/array/#/fill)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.fill). + +#### arr.filter(callback[, thisArg]) _(es5-ext/array/#/filter)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.filter). +ES6's version of `filter`, returns array of same type as the context. + +#### arr.find(predicate[, thisArg]) _(es5-ext/array/#/find)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.find). +Return first element for which given function returns true + +#### arr.findIndex(predicate[, thisArg]) _(es5-ext/array/#/find-index)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.findindex). +Return first index for which given function returns true + +#### arr.first() _(es5-ext/array/#/first)_ + +Returns value for first defined index + +#### arr.firstIndex() _(es5-ext/array/#/first-index)_ + +Returns first declared index of the array + +#### arr.flatten() _(es5-ext/array/#/flatten)_ + +Returns flattened version of the array + +#### arr.forEachRight(cb[, thisArg]) _(es5-ext/array/#/for-each-right)_ + +`forEach` starting from last element + +#### arr.group(cb[, thisArg]) _(es5-ext/array/#/group)_ + +Group list elements by value returned by _cb_ function + +#### arr.indexesOf(searchElement[, fromIndex]) _(es5-ext/array/#/indexes-of)_ + +Returns array of all indexes of given value + +#### arr.intersection([…lists]) _(es5-ext/array/#/intersection)_ + +Computes the array of values that are the intersection of all lists (context list and lists given in arguments) + +#### arr.isCopy(other) _(es5-ext/array/#/is-copy)_ + +Returns true if both context and _other_ lists have same content + +#### arr.isUniq() _(es5-ext/array/#/is-uniq)_ + +Returns true if all values in array are unique + +#### arr.keys() _(es5-ext/array/#/keys)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.keys). +Returns iterator object, which traverses all array indexes. + +#### arr.last() _(es5-ext/array/#/last)_ + +Returns value of last defined index + +#### arr.lastIndex() _(es5-ext/array/#/last)_ + +Returns last defined index of the array + +#### arr.map(callback[, thisArg]) _(es5-ext/array/#/map)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.map). +ES6's version of `map`, returns array of same type as the context. + +#### arr.remove(value[, …valuen]) _(es5-ext/array/#/remove)_ + +Remove values from the array + +#### arr.separate(sep) _(es5-ext/array/#/separate)_ + +Returns array with items separated with `sep` value + +#### arr.slice(callback[, thisArg]) _(es5-ext/array/#/slice)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.slice). +ES6's version of `slice`, returns array of same type as the context. + +#### arr.someRight(cb[, thisArg]) _(es5-ext/array/#/someRight)_ + +`some` starting from last element + +#### arr.splice(callback[, thisArg]) _(es5-ext/array/#/splice)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.splice). +ES6's version of `splice`, returns array of same type as the context. + +#### arr.uniq() _(es5-ext/array/#/uniq)_ + +Returns duplicate-free version of the array + +#### arr.values() _(es5-ext/array/#/values)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.values). +Returns iterator object which traverses all array values. + +#### arr[@@iterator] _(es5-ext/array/#/@@iterator)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype-@@iterator). +Returns iterator object which traverses all array values. + +### Boolean Constructor extensions + +#### isBoolean(x) _(es5-ext/boolean/is-boolean)_ + +Whether value is boolean + +### Date Constructor extensions + +#### isDate(x) _(es5-ext/date/is-date)_ + +Whether value is date instance + +#### validDate(x) _(es5-ext/date/valid-date)_ + +If given object is not date throw TypeError in other case return it. + +### Date Prototype extensions + +#### date.copy(date) _(es5-ext/date/#/copy)_ + +Returns a copy of the date object + +#### date.daysInMonth() _(es5-ext/date/#/days-in-month)_ + +Returns number of days of date's month + +#### date.floorDay() _(es5-ext/date/#/floor-day)_ + +Sets the date time to 00:00:00.000 + +#### date.floorMonth() _(es5-ext/date/#/floor-month)_ + +Sets date day to 1 and date time to 00:00:00.000 + +#### date.floorYear() _(es5-ext/date/#/floor-year)_ + +Sets date month to 0, day to 1 and date time to 00:00:00.000 + +#### date.format(pattern) _(es5-ext/date/#/format)_ + +Formats date up to given string. Supported patterns: + +* `%Y` - Year with century, 1999, 2003 +* `%y` - Year without century, 99, 03 +* `%m` - Month, 01..12 +* `%d` - Day of the month 01..31 +* `%H` - Hour (24-hour clock), 00..23 +* `%M` - Minute, 00..59 +* `%S` - Second, 00..59 +* `%L` - Milliseconds, 000..999 + +### Error Constructor extensions + +#### custom(message/*, code, ext*/) _(es5-ext/error/custom)_ + +Creates custom error object, optinally extended with `code` and other extension properties (provided with `ext` object) + +#### isError(x) _(es5-ext/error/is-error)_ + +Whether value is an error (instance of `Error`). + +#### validError(x) _(es5-ext/error/valid-error)_ + +If given object is not error throw TypeError in other case return it. + +### Error Prototype extensions + +#### err.throw() _(es5-ext/error/#/throw)_ + +Throws error + +### Function Constructor extensions + +Some of the functions were inspired by [Functional JavaScript](http://osteele.com/sources/javascript/functional/) project by Olivier Steele + +#### constant(x) _(es5-ext/function/constant)_ + +Returns a constant function that returns pregiven argument + +_k(x)(y) =def x_ + +#### identity(x) _(es5-ext/function/identity)_ + +Identity function. Returns first argument + +_i(x) =def x_ + +#### invoke(name[, …args]) _(es5-ext/function/invoke)_ + +Returns a function that takes an object as an argument, and applies object's +_name_ method to arguments. +_name_ can be name of the method or method itself. + +_invoke(name, …args)(object, …args2) =def object\[name\]\(…args, …args2\)_ + +#### isArguments(x) _(es5-ext/function/is-arguments)_ + +Whether value is arguments object + +#### isFunction(arg) _(es5-ext/function/is-function)_ + +Wether value is instance of function + +#### noop() _(es5-ext/function/noop)_ + +No operation function + +#### pluck(name) _(es5-ext/function/pluck)_ + +Returns a function that takes an object, and returns the value of its _name_ +property + +_pluck(name)(obj) =def obj[name]_ + +#### validFunction(arg) _(es5-ext/function/valid-function)_ + +If given object is not function throw TypeError in other case return it. + +### Function Prototype extensions + +Some of the methods were inspired by [Functional JavaScript](http://osteele.com/sources/javascript/functional/) project by Olivier Steele + +#### fn.compose([…fns]) _(es5-ext/function/#/compose)_ + +Applies the functions in reverse argument-list order. + +_f1.compose(f2, f3, f4)(…args) =def f1(f2(f3(f4(…arg))))_ + +#### fn.copy() _(es5-ext/function/#/copy)_ + +Produces copy of given function + +#### fn.curry([n]) _(es5-ext/function/#/curry)_ + +Invoking the function returned by this function only _n_ arguments are passed to the underlying function. If the underlying function is not saturated, the result is a function that passes all its arguments to the underlying function. +If _n_ is not provided then it defaults to context function length + +_f.curry(4)(arg1, arg2)(arg3)(arg4) =def f(arg1, args2, arg3, arg4)_ + +#### fn.lock([…args]) _(es5-ext/function/#/lock)_ + +Returns a function that applies the underlying function to _args_, and ignores its own arguments. + +_f.lock(…args)(…args2) =def f(…args)_ + +_Named after it's counterpart in Google Closure_ + +#### fn.not() _(es5-ext/function/#/not)_ + +Returns a function that returns boolean negation of value returned by underlying function. + +_f.not()(…args) =def !f(…args)_ + +#### fn.partial([…args]) _(es5-ext/function/#/partial)_ + +Returns a function that when called will behave like context function called with initially passed arguments. If more arguments are suplilied, they are appended to initial args. + +_f.partial(…args1)(…args2) =def f(…args1, …args2)_ + +#### fn.spread() _(es5-ext/function/#/spread)_ + +Returns a function that applies underlying function with first list argument + +_f.match()(args) =def f.apply(null, args)_ + +#### fn.toStringTokens() _(es5-ext/function/#/to-string-tokens)_ + +Serializes function into two (arguments and body) string tokens. Result is plain object with `args` and `body` properties. + +### Math extensions + +#### acosh(x) _(es5-ext/math/acosh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.acosh). + +#### asinh(x) _(es5-ext/math/asinh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.asinh). + +#### atanh(x) _(es5-ext/math/atanh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.atanh). + +#### cbrt(x) _(es5-ext/math/cbrt)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.cbrt). + +#### clz32(x) _(es5-ext/math/clz32)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.clz32). + +#### cosh(x) _(es5-ext/math/cosh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.cosh). + +#### expm1(x) _(es5-ext/math/expm1)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.expm1). + +#### fround(x) _(es5-ext/math/fround)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.fround). + +#### hypot([…values]) _(es5-ext/math/hypot)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.hypot). + +#### imul(x, y) _(es5-ext/math/imul)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.imul). + +#### log1p(x) _(es5-ext/math/log1p)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log1p). + +#### log2(x) _(es5-ext/math/log2)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log2). + +#### log10(x) _(es5-ext/math/log10)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log10). + +#### sign(x) _(es5-ext/math/sign)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sign). + +#### sinh(x) _(es5-ext/math/sinh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sinh). + +#### tanh(x) _(es5-ext/math/tanh)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.tanh). + +#### trunc(x) _(es5-ext/math/trunc)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.trunc). + +### Number Constructor extensions + +#### EPSILON _(es5-ext/number/epsilon)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.epsilon). + +The difference between 1 and the smallest value greater than 1 that is representable as a Number value, which is approximately 2.2204460492503130808472633361816 x 10-16. + +#### isFinite(x) _(es5-ext/number/is-finite)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite). +Whether value is finite. Differs from global isNaN that it doesn't do type coercion. + +#### isInteger(x) _(es5-ext/number/is-integer)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isinteger). +Whether value is integer. + +#### isNaN(x) _(es5-ext/number/is-nan)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isnan). +Whether value is NaN. Differs from global isNaN that it doesn't do type coercion. + +#### isNumber(x) _(es5-ext/number/is-number)_ + +Whether given value is number + +#### isSafeInteger(x) _(es5-ext/number/is-safe-integer)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.issafeinteger). + +#### MAX_SAFE_INTEGER _(es5-ext/number/max-safe-integer)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.maxsafeinteger). +The value of Number.MAX_SAFE_INTEGER is 9007199254740991. + +#### MIN_SAFE_INTEGER _(es5-ext/number/min-safe-integer)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.minsafeinteger). +The value of Number.MIN_SAFE_INTEGER is -9007199254740991 (253-1). + +#### toInteger(x) _(es5-ext/number/to-integer)_ + +Converts value to integer + +#### toPosInteger(x) _(es5-ext/number/to-pos-integer)_ + +Converts value to positive integer. If provided value is less than 0, then 0 is returned + +#### toUint32(x) _(es5-ext/number/to-uint32)_ + +Converts value to unsigned 32 bit integer. This type is used for array lengths. +See: http://www.2ality.com/2012/02/js-integers.html + +### Number Prototype extensions + +#### num.pad(length[, precision]) _(es5-ext/number/#/pad)_ + +Pad given number with zeros. Returns string + +### Object Constructor extensions + +#### assign(target, source[, …sourcen]) _(es5-ext/object/assign)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). +Extend _target_ by enumerable own properties of other objects. If properties are already set on target object, they will be overwritten. + +#### clear(obj) _(es5-ext/object/clear)_ + +Remove all enumerable own properties of the object + +#### compact(obj) _(es5-ext/object/compact)_ + +Returns copy of the object with all enumerable properties that have no falsy values + +#### compare(obj1, obj2) _(es5-ext/object/compare)_ + +Universal cross-type compare function. To be used for e.g. array sort. + +#### copy(obj) _(es5-ext/object/copy)_ + +Returns copy of the object with all enumerable properties. + +#### copyDeep(obj) _(es5-ext/object/copy-deep)_ + +Returns deep copy of the object with all enumerable properties. + +#### count(obj) _(es5-ext/object/count)_ + +Counts number of enumerable own properties on object + +#### create(obj[, properties]) _(es5-ext/object/create)_ + +`Object.create` alternative that provides workaround for [V8 issue](http://code.google.com/p/v8/issues/detail?id=2804). + +When `null` is provided as a prototype, it's substituted with specially prepared object that derives from Object.prototype but has all Object.prototype properties shadowed with undefined. + +It's quirky solution that allows us to have plain objects with no truthy properties but with turnable prototype. + +Use only for objects that you plan to switch prototypes of and be aware of limitations of this workaround. + +#### eq(x, y) _(es5-ext/object/eq)_ + +Whether two values are equal, using [_SameValueZero_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) algorithm. + +#### every(obj, cb[, thisArg[, compareFn]]) _(es5-ext/object/every)_ + +Analogous to Array.prototype.every. Returns true if every key-value pair in this object satisfies the provided testing function. +Optionally _compareFn_ can be provided which assures that keys are tested in given order. If provided _compareFn_ is equal to `true`, then order is alphabetical (by key). + +#### filter(obj, cb[, thisArg]) _(es5-ext/object/filter)_ + +Analogous to Array.prototype.filter. Returns new object with properites for which _cb_ function returned truthy value. + +#### firstKey(obj) _(es5-ext/object/first-key)_ + +Returns first enumerable key of the object, as keys are unordered by specification, it can be any key of an object. + +#### flatten(obj) _(es5-ext/object/flatten)_ + +Returns new object, with flatten properties of input object + +_flatten({ a: { b: 1 }, c: { d: 1 } }) =def { b: 1, d: 1 }_ + +#### forEach(obj, cb[, thisArg[, compareFn]]) _(es5-ext/object/for-each)_ + +Analogous to Array.prototype.forEach. Calls a function for each key-value pair found in object +Optionally _compareFn_ can be provided which assures that properties are iterated in given order. If provided _compareFn_ is equal to `true`, then order is alphabetical (by key). + +#### getPropertyNames() _(es5-ext/object/get-property-names)_ + +Get all (not just own) property names of the object + +#### is(x, y) _(es5-ext/object/is)_ + +Whether two values are equal, using [_SameValue_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) algorithm. + +#### isArrayLike(x) _(es5-ext/object/is-array-like)_ + +Whether object is array-like object + +#### isCopy(x, y) _(es5-ext/object/is-copy)_ + +Two values are considered a copy of same value when all of their own enumerable properties have same values. + +#### isCopyDeep(x, y) _(es5-ext/object/is-copy-deep)_ + +Deep comparision of objects + +#### isEmpty(obj) _(es5-ext/object/is-empty)_ + +True if object doesn't have any own enumerable property + +#### isObject(arg) _(es5-ext/object/is-object)_ + +Whether value is not primitive + +#### isPlainObject(arg) _(es5-ext/object/is-plain-object)_ + +Whether object is plain object, its protototype should be Object.prototype and it cannot be host object. + +#### keyOf(obj, searchValue) _(es5-ext/object/key-of)_ + +Search object for value + +#### keys(obj) _(es5-ext/object/keys)_ + +[_Updated with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys). +ES6's version of `keys`, doesn't throw on primitive input + +#### map(obj, cb[, thisArg]) _(es5-ext/object/map)_ + +Analogous to Array.prototype.map. Creates a new object with properties which values are results of calling a provided function on every key-value pair in this object. + +#### mapKeys(obj, cb[, thisArg]) _(es5-ext/object/map-keys)_ + +Create new object with same values, but remapped keys + +#### mixin(target, source) _(es5-ext/object/mixin)_ + +Extend _target_ by all own properties of other objects. Properties found in both objects will be overwritten (unless they're not configurable and cannot be overwritten). +_It was for a moment part of ECMAScript 6 draft._ + +#### mixinPrototypes(target, …source]) _(es5-ext/object/mixin-prototypes)_ + +Extends _target_, with all source and source's prototype properties. +Useful as an alternative for `setPrototypeOf` in environments in which it cannot be shimmed (no `__proto__` support). + +#### normalizeOptions(options) _(es5-ext/object/normalize-options)_ + +Normalizes options object into flat plain object. + +Useful for functions in which we either need to keep options object for future reference or need to modify it for internal use. + +- It never returns input `options` object back (always a copy is created) +- `options` can be undefined in such case empty plain object is returned. +- Copies all enumerable properties found down prototype chain. + +#### primitiveSet([…names]) _(es5-ext/object/primitive-set)_ + +Creates `null` prototype based plain object, and sets on it all property names provided in arguments to true. + +#### safeTraverse(obj[, …names]) _(es5-ext/object/safe-traverse)_ + +Safe navigation of object properties. See http://wiki.ecmascript.org/doku.php?id=strawman:existential_operator + +#### serialize(value) _(es5-ext/object/serialize)_ + +Serialize value into string. Differs from [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) that it serializes also dates, functions and regular expresssions. + +#### setPrototypeOf(object, proto) _(es5-ext/object/set-prototype-of)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.setprototypeof). +If native version is not provided, it depends on existence of `__proto__` functionality, if it's missing, `null` instead of function is exposed. + +#### some(obj, cb[, thisArg[, compareFn]]) _(es5-ext/object/some)_ + +Analogous to Array.prototype.some Returns true if any key-value pair satisfies the provided +testing function. +Optionally _compareFn_ can be provided which assures that keys are tested in given order. If provided _compareFn_ is equal to `true`, then order is alphabetical (by key). + +#### toArray(obj[, cb[, thisArg[, compareFn]]]) _(es5-ext/object/to-array)_ + +Creates an array of results of calling a provided function on every key-value pair in this object. +Optionally _compareFn_ can be provided which assures that results are added in given order. If provided _compareFn_ is equal to `true`, then order is alphabetical (by key). + +#### unserialize(str) _(es5-ext/object/unserialize)_ + +Userializes value previously serialized with [serialize](#serializevalue-es5-extobjectserialize) + +#### validCallable(x) _(es5-ext/object/valid-callable)_ + +If given object is not callable throw TypeError in other case return it. + +#### validObject(x) _(es5-ext/object/valid-object)_ + +Throws error if given value is not an object, otherwise it is returned. + +#### validValue(x) _(es5-ext/object/valid-value)_ + +Throws error if given value is `null` or `undefined`, otherwise returns value. + +### RegExp Constructor extensions + +#### escape(str) _(es5-ext/reg-exp/escape)_ + +Escapes string to be used in regular expression + +#### isRegExp(x) _(es5-ext/reg-exp/is-reg-exp)_ + +Whether object is regular expression + +#### validRegExp(x) _(es5-ext/reg-exp/valid-reg-exp)_ + +If object is regular expression it is returned, otherwise TypeError is thrown. + +### RegExp Prototype extensions + +#### re.isSticky(x) _(es5-ext/reg-exp/#/is-sticky)_ + +Whether regular expression has `sticky` flag. + +It's to be used as counterpart to [regExp.sticky](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.sticky) if it's not implemented. + +#### re.isUnicode(x) _(es5-ext/reg-exp/#/is-unicode)_ + +Whether regular expression has `unicode` flag. + +It's to be used as counterpart to [regExp.unicode](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.unicode) if it's not implemented. + +#### re.match(string) _(es5-ext/reg-exp/#/match)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.match). + +#### re.replace(string, replaceValue) _(es5-ext/reg-exp/#/replace)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.replace). + +#### re.search(string) _(es5-ext/reg-exp/#/search)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.search). + +#### re.split(string) _(es5-ext/reg-exp/#/search)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.split). + +#### re.sticky _(es5-ext/reg-exp/#/sticky/implement)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.sticky). +It's a getter, so only `implement` and `is-implemented` modules are provided. + +#### re.unicode _(es5-ext/reg-exp/#/unicode/implement)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.unicode). +It's a getter, so only `implement` and `is-implemented` modules are provided. + +### String Constructor extensions + +#### formatMethod(fMap) _(es5-ext/string/format-method)_ + +Creates format method. It's used e.g. to create `Date.prototype.format` method + +#### fromCodePoint([…codePoints]) _(es5-ext/string/from-code-point)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.fromcodepoint) + +#### isString(x) _(es5-ext/string/is-string)_ + +Whether object is string + +#### randomUniq() _(es5-ext/string/random-uniq)_ + +Returns randomly generated id, with guarantee of local uniqueness (no same id will be returned twice) + +#### raw(callSite[, …substitutions]) _(es5-ext/string/raw)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.raw) + +### String Prototype extensions + +#### str.at(pos) _(es5-ext/string/#/at)_ + +_Proposed for ECMAScript 6/7 standard, but not (yet) in a draft_ + +Returns a string at given position in Unicode-safe manner. +Based on [implementation by Mathias Bynens](https://github.com/mathiasbynens/String.prototype.at). + +#### str.camelToHyphen() _(es5-ext/string/#/camel-to-hyphen)_ + +Convert camelCase string to hyphen separated, e.g. one-two-three -> oneTwoThree. +Useful when converting names from js property convention into filename convention. + +#### str.capitalize() _(es5-ext/string/#/capitalize)_ + +Capitalize first character of a string + +#### str.caseInsensitiveCompare(str) _(es5-ext/string/#/case-insensitive-compare)_ + +Case insensitive compare + +#### str.codePointAt(pos) _(es5-ext/string/#/code-point-at)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.codepointat) + +Based on [implementation by Mathias Bynens](https://github.com/mathiasbynens/String.prototype.codePointAt). + +#### str.contains(searchString[, position]) _(es5-ext/string/#/contains)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.contains) + +Whether string contains given string. + +#### str.endsWith(searchString[, endPosition]) _(es5-ext/string/#/ends-with)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.endswith). +Whether strings ends with given string + +#### str.hyphenToCamel() _(es5-ext/string/#/hyphen-to-camel)_ + +Convert hyphen separated string to camelCase, e.g. one-two-three -> oneTwoThree. +Useful when converting names from filename convention to js property name convention. + +#### str.indent(str[, count]) _(es5-ext/string/#/indent)_ + +Indents each line with provided _str_ (if _count_ given then _str_ is repeated _count_ times). + +#### str.last() _(es5-ext/string/#/last)_ + +Return last character + +#### str.normalize([form]) _(es5-ext/string/#/normalize)_ + +[_Introduced with ECMAScript 6_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize). +Returns the Unicode Normalization Form of a given string. +Based on Matsuza's version. Code used for integrated shim can be found at [github.com/walling/unorm](https://github.com/walling/unorm/blob/master/lib/unorm.js) + +#### str.pad(fill[, length]) _(es5-ext/string/#/pad)_ + +Pad string with _fill_. +If _length_ si given than _fill_ is reapated _length_ times. +If _length_ is negative then pad is applied from right. + +#### str.repeat(n) _(es5-ext/string/#/repeat)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.repeat). +Repeat given string _n_ times + +#### str.plainReplace(search, replace) _(es5-ext/string/#/plain-replace)_ + +Simple `replace` version. Doesn't support regular expressions. Replaces just first occurrence of search string. Doesn't support insert patterns, therefore it is safe to replace text with text obtained programmatically (there's no need for additional _$_ characters escape in such case). + +#### str.plainReplaceAll(search, replace) _(es5-ext/string/#/plain-replace-all)_ + +Simple `replace` version. Doesn't support regular expressions. Replaces all occurrences of search string. Doesn't support insert patterns, therefore it is safe to replace text with text obtained programmatically (there's no need for additional _$_ characters escape in such case). + +#### str.startsWith(searchString[, position]) _(es5-ext/string/#/starts-with)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.startswith). +Whether strings starts with given string + +#### str[@@iterator] _(es5-ext/string/#/@@iterator)_ + +[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype-@@iterator). +Returns iterator object which traverses all string characters (with respect to unicode symbols) + +### Tests [![Build Status](https://travis-ci.org/medikoo/es5-ext.png)](https://travis-ci.org/medikoo/es5-ext) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/implement.js new file mode 100644 index 00000000..0f714a1d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, require('es6-symbol').iterator, { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/index.js new file mode 100644 index 00000000..a6946265 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.prototype[require('es6-symbol').iterator] : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/is-implemented.js new file mode 100644 index 00000000..72eb1f8a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/is-implemented.js @@ -0,0 +1,16 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function () { + var arr = ['foo', 1], iterator, result; + if (typeof arr[iteratorSymbol] !== 'function') return false; + iterator = arr[iteratorSymbol](); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result) return false; + if (result.value !== 'foo') return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/shim.js new file mode 100644 index 00000000..ff295df9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/@@iterator/shim.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../values/shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/_compare-by-length.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/_compare-by-length.js new file mode 100644 index 00000000..d8343ce3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/_compare-by-length.js @@ -0,0 +1,9 @@ +// Used internally to sort array of lists by length + +'use strict'; + +var toPosInt = require('../../number/to-pos-integer'); + +module.exports = function (a, b) { + return toPosInt(a.length) - toPosInt(b.length); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/binary-search.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/binary-search.js new file mode 100644 index 00000000..8eb45675 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/binary-search.js @@ -0,0 +1,28 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , callable = require('../../object/valid-callable') + , value = require('../../object/valid-value') + + , floor = Math.floor; + +module.exports = function (compareFn) { + var length, low, high, middle; + + value(this); + callable(compareFn); + + length = toPosInt(this.length); + low = 0; + high = length - 1; + + while (low <= high) { + middle = floor((low + high) / 2); + if (compareFn(this[middle]) < 0) high = middle - 1; + else low = middle + 1; + } + + if (high < 0) return 0; + if (high >= length) return length - 1; + return high; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/clear.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/clear.js new file mode 100644 index 00000000..3587bdf9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/clear.js @@ -0,0 +1,12 @@ +// Inspired by Google Closure: +// http://closure-library.googlecode.com/svn/docs/ +// closure_goog_array_array.js.html#goog.array.clear + +'use strict'; + +var value = require('../../object/valid-value'); + +module.exports = function () { + value(this).length = 0; + return this; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/compact.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/compact.js new file mode 100644 index 00000000..d529d5a2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/compact.js @@ -0,0 +1,9 @@ +// Inspired by: http://documentcloud.github.com/underscore/#compact + +'use strict'; + +var filter = Array.prototype.filter; + +module.exports = function () { + return filter.call(this, function (val) { return val != null; }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/implement.js new file mode 100644 index 00000000..80c67cb4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'concat', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/index.js new file mode 100644 index 00000000..db205ea5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.concat : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/is-implemented.js new file mode 100644 index 00000000..cab8bc9e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +var SubArray = require('../../_sub-array-dummy-safe'); + +module.exports = function () { + return (new SubArray()).concat('foo') instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/shim.js new file mode 100644 index 00000000..8b28e4ae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/concat/shim.js @@ -0,0 +1,39 @@ +'use strict'; + +var isPlainArray = require('../../is-plain-array') + , toPosInt = require('../../../number/to-pos-integer') + , isObject = require('../../../object/is-object') + + , isArray = Array.isArray, concat = Array.prototype.concat + , forEach = Array.prototype.forEach + + , isSpreadable; + +isSpreadable = function (value) { + if (!value) return false; + if (!isObject(value)) return false; + if (value['@@isConcatSpreadable'] !== undefined) { + return Boolean(value['@@isConcatSpreadable']); + } + return isArray(value); +}; + +module.exports = function (item/*, …items*/) { + var result; + if (!this || !isArray(this) || isPlainArray(this)) { + return concat.apply(this, arguments); + } + result = new this.constructor(this.length); + forEach.call(this, function (val, i) { result[i] = val; }); + forEach.call(arguments, function (arg) { + var base; + if (isSpreadable(arg)) { + base = result.length; + result.length += toPosInt(arg.length); + forEach.call(arg, function (val, i) { result[base + i] = val; }); + return; + } + result.push(arg); + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/contains.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/contains.js new file mode 100644 index 00000000..4a2f9f67 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/contains.js @@ -0,0 +1,7 @@ +'use strict'; + +var indexOf = require('./e-index-of'); + +module.exports = function (searchElement/*, position*/) { + return indexOf.call(this, searchElement, arguments[1]) > -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/implement.js new file mode 100644 index 00000000..eedbad77 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'copyWithin', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/index.js new file mode 100644 index 00000000..bb89d0b8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.copyWithin : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/is-implemented.js new file mode 100644 index 00000000..8f17e06d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var arr = [1, 2, 3, 4, 5]; + if (typeof arr.copyWithin !== 'function') return false; + return String(arr.copyWithin(1, 3)) === '1,4,5,4,5'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/shim.js new file mode 100644 index 00000000..c0bfb8b0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/copy-within/shim.js @@ -0,0 +1,39 @@ +// Taken from: https://github.com/paulmillr/es6-shim/ + +'use strict'; + +var toInteger = require('../../../number/to-integer') + , toPosInt = require('../../../number/to-pos-integer') + , validValue = require('../../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty + , max = Math.max, min = Math.min; + +module.exports = function (target, start/*, end*/) { + var o = validValue(this), end = arguments[2], l = toPosInt(o.length) + , to, from, fin, count, direction; + + target = toInteger(target); + start = toInteger(start); + end = (end === undefined) ? l : toInteger(end); + + to = target < 0 ? max(l + target, 0) : min(target, l); + from = start < 0 ? max(l + start, 0) : min(start, l); + fin = end < 0 ? max(l + end, 0) : min(end, l); + count = min(fin - from, l - to); + direction = 1; + + if ((from < to) && (to < (from + count))) { + direction = -1; + from += count - 1; + to += count - 1; + } + while (count > 0) { + if (hasOwnProperty.call(o, from)) o[to] = o[from]; + else delete o[from]; + from += direction; + to += direction; + count -= 1; + } + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/diff.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/diff.js new file mode 100644 index 00000000..a1f95419 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/diff.js @@ -0,0 +1,13 @@ +'use strict'; + +var value = require('../../object/valid-value') + , contains = require('./contains') + + , filter = Array.prototype.filter; + +module.exports = function (other) { + (value(this) && value(other)); + return filter.call(this, function (item) { + return !contains.call(other, item); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/e-index-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/e-index-of.js new file mode 100644 index 00000000..80864d06 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/e-index-of.js @@ -0,0 +1,29 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , value = require('../../object/valid-value') + + , indexOf = Array.prototype.indexOf + , hasOwnProperty = Object.prototype.hasOwnProperty + , abs = Math.abs, floor = Math.floor; + +module.exports = function (searchElement/*, fromIndex*/) { + var i, l, fromIndex, val; + if (searchElement === searchElement) { //jslint: ignore + return indexOf.apply(this, arguments); + } + + l = toPosInt(value(this).length); + fromIndex = arguments[1]; + if (isNaN(fromIndex)) fromIndex = 0; + else if (fromIndex >= 0) fromIndex = floor(fromIndex); + else fromIndex = toPosInt(this.length) - floor(abs(fromIndex)); + + for (i = fromIndex; i < l; ++i) { + if (hasOwnProperty.call(this, i)) { + val = this[i]; + if (val !== val) return i; //jslint: ignore + } + } + return -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/e-last-index-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/e-last-index-of.js new file mode 100644 index 00000000..4fc536bd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/e-last-index-of.js @@ -0,0 +1,29 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , value = require('../../object/valid-value') + + , lastIndexOf = Array.prototype.lastIndexOf + , hasOwnProperty = Object.prototype.hasOwnProperty + , abs = Math.abs, floor = Math.floor; + +module.exports = function (searchElement/*, fromIndex*/) { + var i, fromIndex, val; + if (searchElement === searchElement) { //jslint: ignore + return lastIndexOf.apply(this, arguments); + } + + value(this); + fromIndex = arguments[1]; + if (isNaN(fromIndex)) fromIndex = (toPosInt(this.length) - 1); + else if (fromIndex >= 0) fromIndex = floor(fromIndex); + else fromIndex = toPosInt(this.length) - floor(abs(fromIndex)); + + for (i = fromIndex; i >= 0; --i) { + if (hasOwnProperty.call(this, i)) { + val = this[i]; + if (val !== val) return i; //jslint: ignore + } + } + return -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/implement.js new file mode 100644 index 00000000..490de60e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'entries', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/index.js new file mode 100644 index 00000000..292792cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.entries : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/is-implemented.js new file mode 100644 index 00000000..e186c172 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/is-implemented.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function () { + var arr = [1, 'foo'], iterator, result; + if (typeof arr.entries !== 'function') return false; + iterator = arr.entries(); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result || !result.value) return false; + if (result.value[0] !== 0) return false; + if (result.value[1] !== 1) return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/shim.js new file mode 100644 index 00000000..c052b53f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/entries/shim.js @@ -0,0 +1,4 @@ +'use strict'; + +var ArrayIterator = require('es6-iterator/array'); +module.exports = function () { return new ArrayIterator(this, 'key+value'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/exclusion.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/exclusion.js new file mode 100644 index 00000000..f08adc81 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/exclusion.js @@ -0,0 +1,27 @@ +'use strict'; + +var value = require('../../object/valid-value') + , aFrom = require('../from') + , toArray = require('../to-array') + , contains = require('./contains') + , byLength = require('./_compare-by-length') + + , filter = Array.prototype.filter, push = Array.prototype.push; + +module.exports = function (/*…lists*/) { + var lists, seen, result; + if (!arguments.length) return aFrom(this); + push.apply(lists = [this], arguments); + lists.forEach(value); + seen = []; + result = []; + lists.sort(byLength).forEach(function (list) { + result = result.filter(function (item) { + return !contains.call(list, item); + }).concat(filter.call(list, function (x) { + return !contains.call(seen, x); + })); + push.apply(seen, toArray(list)); + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/implement.js new file mode 100644 index 00000000..22511919 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'fill', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/index.js new file mode 100644 index 00000000..36c1f666 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.fill : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/is-implemented.js new file mode 100644 index 00000000..b8e54688 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var arr = [1, 2, 3, 4, 5, 6]; + if (typeof arr.fill !== 'function') return false; + return String(arr.fill(-1, -3)) === '1,2,3,-1,-1,-1'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/shim.js new file mode 100644 index 00000000..45823be5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/fill/shim.js @@ -0,0 +1,21 @@ +// Taken from: https://github.com/paulmillr/es6-shim/ + +'use strict'; + +var toInteger = require('../../../number/to-integer') + , toPosInt = require('../../../number/to-pos-integer') + , validValue = require('../../../object/valid-value') + + , max = Math.max, min = Math.min; + +module.exports = function (value/*, start, end*/) { + var o = validValue(this), start = arguments[1], end = arguments[2] + , l = toPosInt(o.length), relativeStart, i; + + start = (start === undefined) ? 0 : toInteger(start); + end = (end === undefined) ? l : toInteger(end); + + relativeStart = start < 0 ? max(l + start, 0) : min(start, l); + for (i = relativeStart; i < l && i < end; ++i) o[i] = value; + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/implement.js new file mode 100644 index 00000000..090c5f10 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'filter', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/index.js new file mode 100644 index 00000000..bcf0268d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.filter : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/is-implemented.js new file mode 100644 index 00000000..55772735 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +var SubArray = require('../../_sub-array-dummy-safe') + + , pass = function () { return true; }; + +module.exports = function () { + return (new SubArray()).filter(pass) instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/shim.js new file mode 100644 index 00000000..b0116def --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/filter/shim.js @@ -0,0 +1,22 @@ +'use strict'; + +var isPlainArray = require('../../is-plain-array') + , callable = require('../../../object/valid-callable') + + , isArray = Array.isArray, filter = Array.prototype.filter + , forEach = Array.prototype.forEach, call = Function.prototype.call; + +module.exports = function (callbackFn/*, thisArg*/) { + var result, thisArg, i; + if (!this || !isArray(this) || isPlainArray(this)) { + return filter.apply(this, arguments); + } + callable(callbackFn); + thisArg = arguments[1]; + result = new this.constructor(); + i = 0; + forEach.call(this, function (val, j, self) { + if (call.call(callbackFn, thisArg, val, j, self)) result[i++] = val; + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/implement.js new file mode 100644 index 00000000..556cb846 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'findIndex', + { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/index.js new file mode 100644 index 00000000..03a987e2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.findIndex : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/is-implemented.js new file mode 100644 index 00000000..dbd3c814 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +var fn = function (x) { return x > 3; }; + +module.exports = function () { + var arr = [1, 2, 3, 4, 5, 6]; + if (typeof arr.findIndex !== 'function') return false; + return arr.findIndex(fn) === 3; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/shim.js new file mode 100644 index 00000000..957939f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find-index/shim.js @@ -0,0 +1,20 @@ +'use strict'; + +var callable = require('../../../object/valid-callable') + , value = require('../../../object/valid-value') + + , some = Array.prototype.some, apply = Function.prototype.apply; + +module.exports = function (predicate/*, thisArg*/) { + var k, self; + self = Object(value(this)); + callable(predicate); + + return some.call(self, function (value, index) { + if (apply.call(predicate, this, arguments)) { + k = index; + return true; + } + return false; + }, arguments[1]) ? k : -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/implement.js new file mode 100644 index 00000000..0f37104a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'find', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/index.js new file mode 100644 index 00000000..96819d09 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.find : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/is-implemented.js new file mode 100644 index 00000000..cc7ec774 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +var fn = function (x) { return x > 3; }; + +module.exports = function () { + var arr = [1, 2, 3, 4, 5, 6]; + if (typeof arr.find !== 'function') return false; + return arr.find(fn) === 4; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/shim.js new file mode 100644 index 00000000..c7ee9069 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/find/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var findIndex = require('../find-index/shim'); + +module.exports = function (predicate/*, thisArg*/) { + var index = findIndex.apply(this, arguments); + return (index === -1) ? undefined : this[index]; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/first-index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/first-index.js new file mode 100644 index 00000000..7a9e4c34 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/first-index.js @@ -0,0 +1,16 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function () { + var i, l; + if (!(l = toPosInt(value(this).length))) return null; + i = 0; + while (!hasOwnProperty.call(this, i)) { + if (++i === l) return null; + } + return i; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/first.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/first.js new file mode 100644 index 00000000..11df5717 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/first.js @@ -0,0 +1,9 @@ +'use strict'; + +var firstIndex = require('./first-index'); + +module.exports = function () { + var i; + if ((i = firstIndex.call(this)) !== null) return this[i]; + return undefined; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/flatten.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/flatten.js new file mode 100644 index 00000000..c95407d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/flatten.js @@ -0,0 +1,12 @@ +'use strict'; + +var isArray = Array.isArray, forEach = Array.prototype.forEach + , push = Array.prototype.push; + +module.exports = function flatten() { + var r = []; + forEach.call(this, function (x) { + push.apply(r, isArray(x) ? flatten.call(x) : [x]); + }); + return r; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/for-each-right.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/for-each-right.js new file mode 100644 index 00000000..2f0ffaea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/for-each-right.js @@ -0,0 +1,20 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , callable = require('../../object/valid-callable') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty + , call = Function.prototype.call; + +module.exports = function (cb/*, thisArg*/) { + var i, self, thisArg; + + self = Object(value(this)); + callable(cb); + thisArg = arguments[1]; + + for (i = toPosInt(self.length); i >= 0; --i) { + if (hasOwnProperty.call(self, i)) call.call(cb, thisArg, self[i], i, self); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/group.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/group.js new file mode 100644 index 00000000..fbb178c3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/group.js @@ -0,0 +1,23 @@ +// Inspired by Underscore's groupBy: +// http://documentcloud.github.com/underscore/#groupBy + +'use strict'; + +var callable = require('../../object/valid-callable') + , value = require('../../object/valid-value') + + , forEach = Array.prototype.forEach, apply = Function.prototype.apply; + +module.exports = function (cb/*, thisArg*/) { + var r; + + (value(this) && callable(cb)); + + r = {}; + forEach.call(this, function (v) { + var key = apply.call(cb, this, arguments); + if (!r.hasOwnProperty(key)) r[key] = []; + r[key].push(v); + }, arguments[1]); + return r; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/index.js new file mode 100644 index 00000000..97ef65cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/index.js @@ -0,0 +1,40 @@ +'use strict'; + +module.exports = { + '@@iterator': require('./@@iterator'), + binarySearch: require('./binary-search'), + clear: require('./clear'), + compact: require('./compact'), + concat: require('./concat'), + contains: require('./contains'), + copyWithin: require('./copy-within'), + diff: require('./diff'), + eIndexOf: require('./e-index-of'), + eLastIndexOf: require('./e-last-index-of'), + entries: require('./entries'), + exclusion: require('./exclusion'), + fill: require('./fill'), + filter: require('./filter'), + find: require('./find'), + findIndex: require('./find-index'), + first: require('./first'), + firstIndex: require('./first-index'), + flatten: require('./flatten'), + forEachRight: require('./for-each-right'), + keys: require('./keys'), + group: require('./group'), + indexesOf: require('./indexes-of'), + intersection: require('./intersection'), + isCopy: require('./is-copy'), + isUniq: require('./is-uniq'), + last: require('./last'), + lastIndex: require('./last-index'), + map: require('./map'), + remove: require('./remove'), + separate: require('./separate'), + slice: require('./slice'), + someRight: require('./some-right'), + splice: require('./splice'), + uniq: require('./uniq'), + values: require('./values') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/indexes-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/indexes-of.js new file mode 100644 index 00000000..6b89157a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/indexes-of.js @@ -0,0 +1,12 @@ +'use strict'; + +var indexOf = require('./e-index-of'); + +module.exports = function (value/*, fromIndex*/) { + var r = [], i, fromIndex = arguments[1]; + while ((i = indexOf.call(this, value, fromIndex)) !== -1) { + r.push(i); + fromIndex = i + 1; + } + return r; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/intersection.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/intersection.js new file mode 100644 index 00000000..fadcb525 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/intersection.js @@ -0,0 +1,19 @@ +'use strict'; + +var value = require('../../object/valid-value') + , contains = require('./contains') + , byLength = require('./_compare-by-length') + + , filter = Array.prototype.filter, push = Array.prototype.push + , slice = Array.prototype.slice; + +module.exports = function (/*…list*/) { + var lists; + if (!arguments.length) slice.call(this); + push.apply(lists = [this], arguments); + lists.forEach(value); + lists.sort(byLength); + return lists.reduce(function (a, b) { + return filter.call(a, function (x) { return contains.call(b, x); }); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/is-copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/is-copy.js new file mode 100644 index 00000000..ac7c79bc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/is-copy.js @@ -0,0 +1,21 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , eq = require('../../object/eq') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function (other) { + var i, l; + (value(this) && value(other)); + l = toPosInt(this.length); + if (l !== toPosInt(other.length)) return false; + for (i = 0; i < l; ++i) { + if (hasOwnProperty.call(this, i) !== hasOwnProperty.call(other, i)) { + return false; + } + if (!eq(this[i], other[i])) return false; + } + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/is-uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/is-uniq.js new file mode 100644 index 00000000..b14f461d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/is-uniq.js @@ -0,0 +1,12 @@ +'use strict'; + +var indexOf = require('./e-index-of') + + , every = Array.prototype.every + , isFirst; + +isFirst = function (value, index) { + return indexOf.call(this, value) === index; +}; + +module.exports = function () { return every.call(this, isFirst, this); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/implement.js new file mode 100644 index 00000000..e18e6170 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'keys', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/index.js new file mode 100644 index 00000000..2f89cffe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.keys : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/is-implemented.js new file mode 100644 index 00000000..06bd87bf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function () { + var arr = [1, 'foo'], iterator, result; + if (typeof arr.keys !== 'function') return false; + iterator = arr.keys(); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result) return false; + if (result.value !== 0) return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/shim.js new file mode 100644 index 00000000..83773f6e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/keys/shim.js @@ -0,0 +1,4 @@ +'use strict'; + +var ArrayIterator = require('es6-iterator/array'); +module.exports = function () { return new ArrayIterator(this, 'key'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/last-index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/last-index.js new file mode 100644 index 00000000..a191d6e1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/last-index.js @@ -0,0 +1,16 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function () { + var i, l; + if (!(l = toPosInt(value(this).length))) return null; + i = l - 1; + while (!hasOwnProperty.call(this, i)) { + if (--i === -1) return null; + } + return i; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/last.js new file mode 100644 index 00000000..bf9d2f29 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/last.js @@ -0,0 +1,9 @@ +'use strict'; + +var lastIndex = require('./last-index'); + +module.exports = function () { + var i; + if ((i = lastIndex.call(this)) !== null) return this[i]; + return undefined; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/implement.js new file mode 100644 index 00000000..3aabb874 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'map', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/index.js new file mode 100644 index 00000000..66f66607 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? + Array.prototype.map : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/is-implemented.js new file mode 100644 index 00000000..c328b473 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var identity = require('../../../function/identity') + , SubArray = require('../../_sub-array-dummy-safe'); + +module.exports = function () { + return (new SubArray()).map(identity) instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/shim.js new file mode 100644 index 00000000..2ee73134 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/map/shim.js @@ -0,0 +1,21 @@ +'use strict'; + +var isPlainArray = require('../../is-plain-array') + , callable = require('../../../object/valid-callable') + + , isArray = Array.isArray, map = Array.prototype.map + , forEach = Array.prototype.forEach, call = Function.prototype.call; + +module.exports = function (callbackFn/*, thisArg*/) { + var result, thisArg; + if (!this || !isArray(this) || isPlainArray(this)) { + return map.apply(this, arguments); + } + callable(callbackFn); + thisArg = arguments[1]; + result = new this.constructor(this.length); + forEach.call(this, function (val, i, self) { + result[i] = call.call(callbackFn, thisArg, val, i, self); + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/remove.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/remove.js new file mode 100644 index 00000000..dcf84331 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/remove.js @@ -0,0 +1,12 @@ +'use strict'; + +var indexOf = require('./e-index-of') + + , forEach = Array.prototype.forEach, splice = Array.prototype.splice; + +module.exports = function (item/*, …item*/) { + forEach.call(arguments, function (item) { + var index = indexOf.call(this, item); + if (index !== -1) splice.call(this, index, 1); + }, this); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/separate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/separate.js new file mode 100644 index 00000000..dc974b83 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/separate.js @@ -0,0 +1,10 @@ +'use strict'; + +var forEach = Array.prototype.forEach; + +module.exports = function (sep) { + var result = []; + forEach.call(this, function (val, i) { result.push(val, sep); }); + result.pop(); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/implement.js new file mode 100644 index 00000000..cd488a06 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'slice', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/index.js new file mode 100644 index 00000000..72200ca9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.prototype.slice : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/is-implemented.js new file mode 100644 index 00000000..ec1985e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +var SubArray = require('../../_sub-array-dummy-safe'); + +module.exports = function () { + return (new SubArray()).slice() instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/shim.js new file mode 100644 index 00000000..2761a1aa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/slice/shim.js @@ -0,0 +1,35 @@ +'use strict'; + +var toInteger = require('../../../number/to-integer') + , toPosInt = require('../../../number/to-pos-integer') + , isPlainArray = require('../../is-plain-array') + + , isArray = Array.isArray, slice = Array.prototype.slice + , hasOwnProperty = Object.prototype.hasOwnProperty, max = Math.max; + +module.exports = function (start, end) { + var length, result, i; + if (!this || !isArray(this) || isPlainArray(this)) { + return slice.apply(this, arguments); + } + length = toPosInt(this.length); + start = toInteger(start); + if (start < 0) start = max(length + start, 0); + else if (start > length) start = length; + if (end === undefined) { + end = length; + } else { + end = toInteger(end); + if (end < 0) end = max(length + end, 0); + else if (end > length) end = length; + } + if (start > end) start = end; + result = new this.constructor(end - start); + i = 0; + while (start !== end) { + if (hasOwnProperty.call(this, start)) result[i] = this[start]; + ++i; + ++start; + } + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/some-right.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/some-right.js new file mode 100644 index 00000000..de7460d6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/some-right.js @@ -0,0 +1,22 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + , value = require('../../object/valid-value') + + , hasOwnProperty = Object.prototype.hasOwnProperty + , call = Function.prototype.call; + +module.exports = function (cb/*, thisArg*/) { + var i, self, thisArg; + self = Object(value(this)); + callable(cb); + thisArg = arguments[1]; + + for (i = self.length; i >= 0; --i) { + if (hasOwnProperty.call(self, i) && + call.call(cb, thisArg, self[i], i, self)) { + return true; + } + } + return false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/implement.js new file mode 100644 index 00000000..aab1f8ef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'splice', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/index.js new file mode 100644 index 00000000..e8ecf3cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.prototype.splice : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/is-implemented.js new file mode 100644 index 00000000..ffddaa81 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +var SubArray = require('../../_sub-array-dummy-safe'); + +module.exports = function () { + return (new SubArray()).splice(0) instanceof SubArray; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/shim.js new file mode 100644 index 00000000..a8505a2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/splice/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var isPlainArray = require('../../is-plain-array') + + , isArray = Array.isArray, splice = Array.prototype.splice + , forEach = Array.prototype.forEach; + +module.exports = function (start, deleteCount/*, …items*/) { + var arr = splice.apply(this, arguments), result; + if (!this || !isArray(this) || isPlainArray(this)) return arr; + result = new this.constructor(arr.length); + forEach.call(arr, function (val, i) { result[i] = val; }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/uniq.js new file mode 100644 index 00000000..db014655 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/uniq.js @@ -0,0 +1,13 @@ +'use strict'; + +var indexOf = require('./e-index-of') + + , filter = Array.prototype.filter + + , isFirst; + +isFirst = function (value, index) { + return indexOf.call(this, value) === index; +}; + +module.exports = function () { return filter.call(this, isFirst, this); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/implement.js new file mode 100644 index 00000000..237281fd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array.prototype, 'values', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/index.js new file mode 100644 index 00000000..c0832c30 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? Array.prototype.values : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/is-implemented.js new file mode 100644 index 00000000..cc0c6294 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function () { + var arr = ['foo', 1], iterator, result; + if (typeof arr.values !== 'function') return false; + iterator = arr.values(); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result) return false; + if (result.value !== 'foo') return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/shim.js new file mode 100644 index 00000000..f6555fd8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/#/values/shim.js @@ -0,0 +1,4 @@ +'use strict'; + +var ArrayIterator = require('es6-iterator/array'); +module.exports = function () { return new ArrayIterator(this, 'value'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/_is-extensible.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/_is-extensible.js new file mode 100644 index 00000000..61232064 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/_is-extensible.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = (function () { + var SubArray = require('./_sub-array-dummy'), arr; + + if (!SubArray) return false; + arr = new SubArray(); + if (!Array.isArray(arr)) return false; + if (!(arr instanceof SubArray)) return false; + + arr[34] = 'foo'; + return (arr.length === 35); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/_sub-array-dummy-safe.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/_sub-array-dummy-safe.js new file mode 100644 index 00000000..5baf8a8d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/_sub-array-dummy-safe.js @@ -0,0 +1,23 @@ +'use strict'; + +var setPrototypeOf = require('../object/set-prototype-of') + , isExtensible = require('./_is-extensible'); + +module.exports = (function () { + var SubArray; + + if (isExtensible) return require('./_sub-array-dummy'); + + if (!setPrototypeOf) return null; + SubArray = function () { + var arr = Array.apply(this, arguments); + setPrototypeOf(arr, SubArray.prototype); + return arr; + }; + setPrototypeOf(SubArray, Array); + SubArray.prototype = Object.create(Array.prototype, { + constructor: { value: SubArray, enumerable: false, writable: true, + configurable: true } + }); + return SubArray; +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/_sub-array-dummy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/_sub-array-dummy.js new file mode 100644 index 00000000..a926d1a3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/_sub-array-dummy.js @@ -0,0 +1,16 @@ +'use strict'; + +var setPrototypeOf = require('../object/set-prototype-of'); + +module.exports = (function () { + var SubArray; + + if (!setPrototypeOf) return null; + SubArray = function () { Array.apply(this, arguments); }; + setPrototypeOf(SubArray, Array); + SubArray.prototype = Object.create(Array.prototype, { + constructor: { value: SubArray, enumerable: false, writable: true, + configurable: true } + }); + return SubArray; +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/implement.js new file mode 100644 index 00000000..f3411b13 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array, 'from', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/index.js new file mode 100644 index 00000000..3b99cda8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.from + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/is-implemented.js new file mode 100644 index 00000000..63ff2a57 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function () { + var from = Array.from, arr, result; + if (typeof from !== 'function') return false; + arr = ['raz', 'dwa']; + result = from(arr); + return Boolean(result && (result !== arr) && (result[1] === 'dwa')); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/shim.js new file mode 100644 index 00000000..a90ba2f9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/from/shim.js @@ -0,0 +1,106 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , isArguments = require('../../function/is-arguments') + , isFunction = require('../../function/is-function') + , toPosInt = require('../../number/to-pos-integer') + , callable = require('../../object/valid-callable') + , validValue = require('../../object/valid-value') + , isString = require('../../string/is-string') + + , isArray = Array.isArray, call = Function.prototype.call + , desc = { configurable: true, enumerable: true, writable: true, value: null } + , defineProperty = Object.defineProperty; + +module.exports = function (arrayLike/*, mapFn, thisArg*/) { + var mapFn = arguments[1], thisArg = arguments[2], Constructor, i, j, arr, l, code, iterator + , result, getIterator, value; + + arrayLike = Object(validValue(arrayLike)); + + if (mapFn != null) callable(mapFn); + if (!this || (this === Array) || !isFunction(this)) { + // Result: Plain array + if (!mapFn) { + if (isArguments(arrayLike)) { + // Source: Arguments + l = arrayLike.length; + if (l !== 1) return Array.apply(null, arrayLike); + arr = new Array(1); + arr[0] = arrayLike[0]; + return arr; + } + if (isArray(arrayLike)) { + // Source: Array + arr = new Array(l = arrayLike.length); + for (i = 0; i < l; ++i) arr[i] = arrayLike[i]; + return arr; + } + } + arr = []; + } else { + // Result: Non plain array + Constructor = this; + } + + if (!isArray(arrayLike)) { + if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) { + // Source: Iterator + iterator = callable(getIterator).call(arrayLike); + if (Constructor) arr = new Constructor(); + result = iterator.next(); + i = 0; + while (!result.done) { + value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value; + if (!Constructor) { + arr[i] = value; + } else { + desc.value = value; + defineProperty(arr, i, desc); + } + result = iterator.next(); + ++i; + } + l = i; + } else if (isString(arrayLike)) { + // Source: String + l = arrayLike.length; + if (Constructor) arr = new Constructor(); + for (i = 0, j = 0; i < l; ++i) { + value = arrayLike[i]; + if ((i + 1) < l) { + code = value.charCodeAt(0); + if ((code >= 0xD800) && (code <= 0xDBFF)) value += arrayLike[++i]; + } + value = mapFn ? call.call(mapFn, thisArg, value, j) : value; + if (!Constructor) { + arr[j] = value; + } else { + desc.value = value; + defineProperty(arr, j, desc); + } + ++j; + } + l = j; + } + } + if (l === undefined) { + // Source: array or array-like + l = toPosInt(arrayLike.length); + if (Constructor) arr = new Constructor(l); + for (i = 0; i < l; ++i) { + value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i]; + if (!Constructor) { + arr[i] = value; + } else { + desc.value = value; + defineProperty(arr, i, desc); + } + } + } + if (Constructor) { + desc.value = null; + arr.length = l; + } + return arr; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/generate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/generate.js new file mode 100644 index 00000000..5e066750 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/generate.js @@ -0,0 +1,20 @@ +'use strict'; + +var toPosInt = require('../number/to-pos-integer') + , value = require('../object/valid-value') + + , slice = Array.prototype.slice; + +module.exports = function (length/*, …fill*/) { + var arr, l; + length = toPosInt(value(length)); + if (length === 0) return []; + + arr = (arguments.length < 2) ? [undefined] : + slice.call(arguments, 1, 1 + length); + + while ((l = arr.length) < length) { + arr = arr.concat(arr.slice(0, length - l)); + } + return arr; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/index.js new file mode 100644 index 00000000..7a686789 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/index.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + from: require('./from'), + generate: require('./generate'), + isPlainArray: require('./is-plain-array'), + of: require('./of'), + toArray: require('./to-array'), + validArray: require('./valid-array') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/is-plain-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/is-plain-array.js new file mode 100644 index 00000000..6b37e406 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/is-plain-array.js @@ -0,0 +1,11 @@ +'use strict'; + +var isArray = Array.isArray, getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (obj) { + var proto; + if (!obj || !isArray(obj)) return false; + proto = getPrototypeOf(obj); + if (!isArray(proto)) return false; + return !isArray(getPrototypeOf(proto)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/implement.js new file mode 100644 index 00000000..bf2a5a54 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Array, 'of', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/index.js new file mode 100644 index 00000000..07ee54db --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Array.of + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/is-implemented.js new file mode 100644 index 00000000..4390a108 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function () { + var of = Array.of, result; + if (typeof of !== 'function') return false; + result = of('foo', 'bar'); + return Boolean(result && (result[1] === 'bar')); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/shim.js new file mode 100644 index 00000000..de72bc92 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/of/shim.js @@ -0,0 +1,19 @@ +'use strict'; + +var isFunction = require('../../function/is-function') + + , slice = Array.prototype.slice, defineProperty = Object.defineProperty + , desc = { configurable: true, enumerable: true, writable: true, value: null }; + +module.exports = function (/*…items*/) { + var result, i, l; + if (!this || (this === Array) || !isFunction(this)) return slice.call(arguments); + result = new this(l = arguments.length); + for (i = 0; i < l; ++i) { + desc.value = arguments[i]; + defineProperty(result, i, desc); + } + desc.value = null; + result.length = l; + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/to-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/to-array.js new file mode 100644 index 00000000..ce908dd9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/to-array.js @@ -0,0 +1,9 @@ +'use strict'; + +var from = require('./from') + + , isArray = Array.isArray; + +module.exports = function (arrayLike) { + return isArray(arrayLike) ? arrayLike : from(arrayLike); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/valid-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/valid-array.js new file mode 100644 index 00000000..d86a8f5f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/array/valid-array.js @@ -0,0 +1,8 @@ +'use strict'; + +var isArray = Array.isArray; + +module.exports = function (value) { + if (isArray(value)) return value; + throw new TypeError(value + " is not an array"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/boolean/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/boolean/index.js new file mode 100644 index 00000000..c193b948 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/boolean/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + isBoolean: require('./is-boolean') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/boolean/is-boolean.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/boolean/is-boolean.js new file mode 100644 index 00000000..5d1a802e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/boolean/is-boolean.js @@ -0,0 +1,10 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(true); + +module.exports = function (x) { + return (typeof x === 'boolean') || ((typeof x === 'object') && + ((x instanceof Boolean) || (toString.call(x) === id))); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/copy.js new file mode 100644 index 00000000..69e2eb09 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/copy.js @@ -0,0 +1,5 @@ +'use strict'; + +var getTime = Date.prototype.getTime; + +module.exports = function () { return new Date(getTime.call(this)); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/days-in-month.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/days-in-month.js new file mode 100644 index 00000000..e780efe3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/days-in-month.js @@ -0,0 +1,17 @@ +'use strict'; + +var getMonth = Date.prototype.getMonth; + +module.exports = function () { + switch (getMonth.call(this)) { + case 1: + return this.getFullYear() % 4 ? 28 : 29; + case 3: + case 5: + case 8: + case 10: + return 30; + default: + return 31; + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/floor-day.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/floor-day.js new file mode 100644 index 00000000..0c9eb8b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/floor-day.js @@ -0,0 +1,8 @@ +'use strict'; + +var setHours = Date.prototype.setHours; + +module.exports = function () { + setHours.call(this, 0, 0, 0, 0); + return this; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/floor-month.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/floor-month.js new file mode 100644 index 00000000..7328c250 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/floor-month.js @@ -0,0 +1,8 @@ +'use strict'; + +var floorDay = require('./floor-day'); + +module.exports = function () { + floorDay.call(this).setDate(1); + return this; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/floor-year.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/floor-year.js new file mode 100644 index 00000000..9c508538 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/floor-year.js @@ -0,0 +1,8 @@ +'use strict'; + +var floorMonth = require('./floor-month'); + +module.exports = function () { + floorMonth.call(this).setMonth(0); + return this; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/format.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/format.js new file mode 100644 index 00000000..15bd95f7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/format.js @@ -0,0 +1,21 @@ +'use strict'; + +var pad = require('../../number/#/pad') + , date = require('../valid-date') + + , format; + +format = require('../../string/format-method')({ + Y: function () { return String(this.getFullYear()); }, + y: function () { return String(this.getFullYear()).slice(-2); }, + m: function () { return pad.call(this.getMonth() + 1, 2); }, + d: function () { return pad.call(this.getDate(), 2); }, + H: function () { return pad.call(this.getHours(), 2); }, + M: function () { return pad.call(this.getMinutes(), 2); }, + S: function () { return pad.call(this.getSeconds(), 2); }, + L: function () { return pad.call(this.getMilliseconds(), 3); } +}); + +module.exports = function (pattern) { + return format.call(date(this), pattern); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/index.js new file mode 100644 index 00000000..f71b2950 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/#/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + copy: require('./copy'), + daysInMonth: require('./days-in-month'), + floorDay: require('./floor-day'), + floorMonth: require('./floor-month'), + floorYear: require('./floor-year'), + format: require('./format') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/index.js new file mode 100644 index 00000000..eac33fbe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/index.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + isDate: require('./is-date'), + validDate: require('./valid-date') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/is-date.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/is-date.js new file mode 100644 index 00000000..6ba236ec --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/is-date.js @@ -0,0 +1,9 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(new Date()); + +module.exports = function (x) { + return (x && ((x instanceof Date) || (toString.call(x) === id))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/valid-date.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/valid-date.js new file mode 100644 index 00000000..7d1a9b60 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/date/valid-date.js @@ -0,0 +1,8 @@ +'use strict'; + +var isDate = require('./is-date'); + +module.exports = function (x) { + if (!isDate(x)) throw new TypeError(x + " is not a Date object"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/#/index.js new file mode 100644 index 00000000..b984aa91 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/#/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + throw: require('./throw') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/#/throw.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/#/throw.js new file mode 100644 index 00000000..7e15ebd1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/#/throw.js @@ -0,0 +1,5 @@ +'use strict'; + +var error = require('../valid-error'); + +module.exports = function () { throw error(this); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/custom.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/custom.js new file mode 100644 index 00000000..bbc2dc20 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/custom.js @@ -0,0 +1,20 @@ +'use strict'; + +var assign = require('../object/assign') + + , captureStackTrace = Error.captureStackTrace; + +exports = module.exports = function (message/*, code, ext*/) { + var err = new Error(), code = arguments[1], ext = arguments[2]; + if (ext == null) { + if (code && (typeof code === 'object')) { + ext = code; + code = null; + } + } + if (ext != null) assign(err, ext); + err.message = String(message); + if (code != null) err.code = String(code); + if (captureStackTrace) captureStackTrace(err, exports); + return err; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/index.js new file mode 100644 index 00000000..62984b52 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + custom: require('./custom'), + isError: require('./is-error'), + validError: require('./valid-error') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/is-error.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/is-error.js new file mode 100644 index 00000000..422705fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/is-error.js @@ -0,0 +1,9 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(new Error()); + +module.exports = function (x) { + return (x && ((x instanceof Error) || (toString.call(x)) === id)) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/valid-error.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/valid-error.js new file mode 100644 index 00000000..0bef768a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/error/valid-error.js @@ -0,0 +1,8 @@ +'use strict'; + +var isError = require('./is-error'); + +module.exports = function (x) { + if (!isError(x)) throw new TypeError(x + " is not an Error object"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/compose.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/compose.js new file mode 100644 index 00000000..1da5e011 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/compose.js @@ -0,0 +1,20 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + , aFrom = require('../../array/from') + + , apply = Function.prototype.apply, call = Function.prototype.call + , callFn = function (arg, fn) { return call.call(fn, this, arg); }; + +module.exports = function (fn/*, …fnn*/) { + var fns, first; + if (!fn) callable(fn); + fns = [this].concat(aFrom(arguments)); + fns.forEach(callable); + fns = fns.reverse(); + first = fns[0]; + fns = fns.slice(1); + return function (arg) { + return fns.reduce(callFn, apply.call(first, this, arguments)); + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/copy.js new file mode 100644 index 00000000..e1467f76 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/copy.js @@ -0,0 +1,15 @@ +'use strict'; + +var mixin = require('../../object/mixin') + , validFunction = require('../valid-function') + + , re = /^\s*function\s*([\0-'\)-\uffff]+)*\s*\(([\0-\(\*-\uffff]*)\)\s*\{/; + +module.exports = function () { + var match = String(validFunction(this)).match(re), fn; + + fn = new Function('fn', 'return function ' + match[1].trim() + '(' + + match[2] + ') { return fn.apply(this, arguments); };')(this); + try { mixin(fn, this); } catch (ignore) {} + return fn; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/curry.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/curry.js new file mode 100644 index 00000000..943d6faf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/curry.js @@ -0,0 +1,24 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , callable = require('../../object/valid-callable') + , defineLength = require('../_define-length') + + , slice = Array.prototype.slice, apply = Function.prototype.apply + , curry; + +curry = function self(fn, length, preArgs) { + return defineLength(function () { + var args = preArgs ? + preArgs.concat(slice.call(arguments, 0, length - preArgs.length)) : + slice.call(arguments, 0, length); + return (args.length === length) ? apply.call(fn, this, args) : + self(fn, length, args); + }, preArgs ? (length - preArgs.length) : length); +}; + +module.exports = function (/*length*/) { + var length = arguments[0]; + return curry(callable(this), + isNaN(length) ? toPosInt(this.length) : toPosInt(length)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/index.js new file mode 100644 index 00000000..8d0da007 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/index.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = { + compose: require('./compose'), + copy: require('./copy'), + curry: require('./curry'), + lock: require('./lock'), + not: require('./not'), + partial: require('./partial'), + spread: require('./spread'), + toStringTokens: require('./to-string-tokens') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/lock.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/lock.js new file mode 100644 index 00000000..91e1a65c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/lock.js @@ -0,0 +1,12 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + + , apply = Function.prototype.apply; + +module.exports = function (/*…args*/) { + var fn = callable(this) + , args = arguments; + + return function () { return apply.call(fn, this, args); }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/not.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/not.js new file mode 100644 index 00000000..c6dbe97f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/not.js @@ -0,0 +1,14 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + , defineLength = require('../_define-length') + + , apply = Function.prototype.apply; + +module.exports = function () { + var fn = callable(this); + + return defineLength(function () { + return !apply.call(fn, this, arguments); + }, fn.length); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/partial.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/partial.js new file mode 100644 index 00000000..bf31a357 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/partial.js @@ -0,0 +1,16 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + , aFrom = require('../../array/from') + , defineLength = require('../_define-length') + + , apply = Function.prototype.apply; + +module.exports = function (/*…args*/) { + var fn = callable(this) + , args = aFrom(arguments); + + return defineLength(function () { + return apply.call(fn, this, args.concat(aFrom(arguments))); + }, fn.length - args.length); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/spread.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/spread.js new file mode 100644 index 00000000..d7c93b7e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/spread.js @@ -0,0 +1,10 @@ +'use strict'; + +var callable = require('../../object/valid-callable') + + , apply = Function.prototype.apply; + +module.exports = function () { + var fn = callable(this); + return function (args) { return apply.call(fn, this, args); }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/to-string-tokens.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/to-string-tokens.js new file mode 100644 index 00000000..67afeae8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/#/to-string-tokens.js @@ -0,0 +1,11 @@ +'use strict'; + +var validFunction = require('../valid-function') + + , re = new RegExp('^\\s*function[\\0-\'\\)-\\uffff]*' + + '\\(([\\0-\\(\\*-\\uffff]*)\\)\\s*\\{([\\0-\\uffff]*)\\}\\s*$'); + +module.exports = function () { + var data = String(validFunction(this)).match(re); + return { args: data[1], body: data[2] }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/_define-length.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/_define-length.js new file mode 100644 index 00000000..496ea62c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/_define-length.js @@ -0,0 +1,44 @@ +'use strict'; + +var toPosInt = require('../number/to-pos-integer') + + , test = function (a, b) {}, desc, defineProperty + , generate, mixin; + +try { + Object.defineProperty(test, 'length', { configurable: true, writable: false, + enumerable: false, value: 1 }); +} catch (ignore) {} + +if (test.length === 1) { + // ES6 + desc = { configurable: true, writable: false, enumerable: false }; + defineProperty = Object.defineProperty; + module.exports = function (fn, length) { + length = toPosInt(length); + if (fn.length === length) return fn; + desc.value = length; + return defineProperty(fn, 'length', desc); + }; +} else { + mixin = require('../object/mixin'); + generate = (function () { + var cache = []; + return function (l) { + var args, i = 0; + if (cache[l]) return cache[l]; + args = []; + while (l--) args.push('a' + (++i).toString(36)); + return new Function('fn', 'return function (' + args.join(', ') + + ') { return fn.apply(this, arguments); };'); + }; + }()); + module.exports = function (src, length) { + var target; + length = toPosInt(length); + if (src.length === length) return src; + target = generate(length)(src); + try { mixin(target, src); } catch (ignore) {} + return target; + }; +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/constant.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/constant.js new file mode 100644 index 00000000..10f1e203 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/constant.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (x) { + return function () { return x; }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/identity.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/identity.js new file mode 100644 index 00000000..a9289f0b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/identity.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (x) { return x; }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/index.js new file mode 100644 index 00000000..cfad3f3e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/index.js @@ -0,0 +1,15 @@ +// Export all modules. + +'use strict'; + +module.exports = { + '#': require('./#'), + constant: require('./constant'), + identity: require('./identity'), + invoke: require('./invoke'), + isArguments: require('./is-arguments'), + isFunction: require('./is-function'), + noop: require('./noop'), + pluck: require('./pluck'), + validFunction: require('./valid-function') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/invoke.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/invoke.js new file mode 100644 index 00000000..9195afdd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/invoke.js @@ -0,0 +1,15 @@ +'use strict'; + +var isCallable = require('../object/is-callable') + , value = require('../object/valid-value') + + , slice = Array.prototype.slice, apply = Function.prototype.apply; + +module.exports = function (name/*, …args*/) { + var args = slice.call(arguments, 1), isFn = isCallable(name); + return function (obj) { + value(obj); + return apply.call(isFn ? name : obj[name], obj, + args.concat(slice.call(arguments, 1))); + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/is-arguments.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/is-arguments.js new file mode 100644 index 00000000..9a29855f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/is-arguments.js @@ -0,0 +1,7 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call((function () { return arguments; }())); + +module.exports = function (x) { return (toString.call(x) === id); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/is-function.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/is-function.js new file mode 100644 index 00000000..ab4399ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/is-function.js @@ -0,0 +1,9 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(require('./noop')); + +module.exports = function (f) { + return (typeof f === "function") && (toString.call(f) === id); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/noop.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/noop.js new file mode 100644 index 00000000..aa43baed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/noop.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function () {}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/pluck.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/pluck.js new file mode 100644 index 00000000..7f70a30c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/pluck.js @@ -0,0 +1,7 @@ +'use strict'; + +var value = require('../object/valid-value'); + +module.exports = function (name) { + return function (o) { return value(o)[name]; }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/valid-function.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/valid-function.js new file mode 100644 index 00000000..05fdee2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/function/valid-function.js @@ -0,0 +1,8 @@ +'use strict'; + +var isFunction = require('./is-function'); + +module.exports = function (x) { + if (!isFunction(x)) throw new TypeError(x + " is not a function"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/global.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/global.js new file mode 100644 index 00000000..872a40e8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/global.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = new Function("return this")(); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/index.js new file mode 100644 index 00000000..db9a7600 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/index.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = { + global: require('./global'), + + array: require('./array'), + boolean: require('./boolean'), + date: require('./date'), + error: require('./error'), + function: require('./function'), + iterable: require('./iterable'), + math: require('./math'), + number: require('./number'), + object: require('./object'), + regExp: require('./reg-exp'), + string: require('./string') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/for-each.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/for-each.js new file mode 100644 index 00000000..f1e20425 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/for-each.js @@ -0,0 +1,12 @@ +'use strict'; + +var forOf = require('es6-iterator/for-of') + , isIterable = require('es6-iterator/is-iterable') + , iterable = require('./validate') + + , forEach = Array.prototype.forEach; + +module.exports = function (target, cb/*, thisArg*/) { + if (isIterable(iterable(target))) forOf(target, cb, arguments[2]); + else forEach.call(target, cb, arguments[2]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/index.js new file mode 100644 index 00000000..a3e16a5e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = { + forEach: require('./for-each'), + is: require('./is'), + validate: require('./validate'), + validateObject: require('./validate-object') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/is.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/is.js new file mode 100644 index 00000000..bb8bf287 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/is.js @@ -0,0 +1,10 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , isArrayLike = require('../object/is-array-like'); + +module.exports = function (x) { + if (x == null) return false; + if (typeof x[iteratorSymbol] === 'function') return true; + return isArrayLike(x); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/validate-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/validate-object.js new file mode 100644 index 00000000..988a6adb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/validate-object.js @@ -0,0 +1,9 @@ +'use strict'; + +var isObject = require('../object/is-object') + , is = require('./is'); + +module.exports = function (x) { + if (is(x) && isObject(x)) return x; + throw new TypeError(x + " is not an iterable or array-like object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/validate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/validate.js new file mode 100644 index 00000000..1be6d7fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/iterable/validate.js @@ -0,0 +1,8 @@ +'use strict'; + +var is = require('./is'); + +module.exports = function (x) { + if (is(x)) return x; + throw new TypeError(x + " is not an iterable or array-like"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/_pack-ieee754.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/_pack-ieee754.js new file mode 100644 index 00000000..eecda565 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/_pack-ieee754.js @@ -0,0 +1,82 @@ +// Credit: https://github.com/paulmillr/es6-shim/ + +'use strict'; + +var abs = Math.abs, floor = Math.floor, log = Math.log, min = Math.min + , pow = Math.pow, LN2 = Math.LN2 + , roundToEven; + +roundToEven = function (n) { + var w = floor(n), f = n - w; + if (f < 0.5) return w; + if (f > 0.5) return w + 1; + return w % 2 ? w + 1 : w; +}; + +module.exports = function (v, ebits, fbits) { + var bias = (1 << (ebits - 1)) - 1, s, e, f, i, bits, str, bytes; + + // Compute sign, exponent, fraction + if (isNaN(v)) { + // NaN + // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping + e = (1 << ebits) - 1; + f = pow(2, fbits - 1); + s = 0; + } else if (v === Infinity || v === -Infinity) { + e = (1 << ebits) - 1; + f = 0; + s = (v < 0) ? 1 : 0; + } else if (v === 0) { + e = 0; + f = 0; + s = (1 / v === -Infinity) ? 1 : 0; + } else { + s = v < 0; + v = abs(v); + + if (v >= pow(2, 1 - bias)) { + e = min(floor(log(v) / LN2), 1023); + f = roundToEven(v / pow(2, e) * pow(2, fbits)); + if (f / pow(2, fbits) >= 2) { + e = e + 1; + f = 1; + } + if (e > bias) { + // Overflow + e = (1 << ebits) - 1; + f = 0; + } else { + // Normal + e = e + bias; + f = f - pow(2, fbits); + } + } else { + // Subnormal + e = 0; + f = roundToEven(v / pow(2, 1 - bias - fbits)); + } + } + + // Pack sign, exponent, fraction + bits = []; + for (i = fbits; i; i -= 1) { + bits.push(f % 2 ? 1 : 0); + f = floor(f / 2); + } + for (i = ebits; i; i -= 1) { + bits.push(e % 2 ? 1 : 0); + e = floor(e / 2); + } + bits.push(s ? 1 : 0); + bits.reverse(); + str = bits.join(''); + + // Bits to bytes + bytes = []; + while (str.length) { + bytes.push(parseInt(str.substring(0, 8), 2)); + str = str.substring(8); + } + return bytes; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/_unpack-ieee754.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/_unpack-ieee754.js new file mode 100644 index 00000000..c9f26f2b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/_unpack-ieee754.js @@ -0,0 +1,33 @@ +// Credit: https://github.com/paulmillr/es6-shim/ + +'use strict'; + +var pow = Math.pow; + +module.exports = function (bytes, ebits, fbits) { + // Bytes to bits + var bits = [], i, j, b, str, + bias, s, e, f; + + for (i = bytes.length; i; i -= 1) { + b = bytes[i - 1]; + for (j = 8; j; j -= 1) { + bits.push(b % 2 ? 1 : 0); + b = b >> 1; + } + } + bits.reverse(); + str = bits.join(''); + + // Unpack sign, exponent, fraction + bias = (1 << (ebits - 1)) - 1; + s = parseInt(str.substring(0, 1), 2) ? -1 : 1; + e = parseInt(str.substring(1, 1 + ebits), 2); + f = parseInt(str.substring(1 + ebits), 2); + + // Produce number + if (e === (1 << ebits) - 1) return f !== 0 ? NaN : s * Infinity; + if (e > 0) return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); + if (f !== 0) return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); + return s < 0 ? -0 : 0; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/implement.js new file mode 100644 index 00000000..f48ad11d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'acosh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/index.js new file mode 100644 index 00000000..00ddea69 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.acosh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/is-implemented.js new file mode 100644 index 00000000..363f0d8b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var acosh = Math.acosh; + if (typeof acosh !== 'function') return false; + return acosh(2) === 1.3169578969248166; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/shim.js new file mode 100644 index 00000000..89a24b5d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/acosh/shim.js @@ -0,0 +1,12 @@ +'use strict'; + +var log = Math.log, sqrt = Math.sqrt; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < 1) return NaN; + if (x === 1) return 0; + if (x === Infinity) return x; + return log(x + sqrt(x * x - 1)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/implement.js new file mode 100644 index 00000000..21f64d50 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'asinh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/index.js new file mode 100644 index 00000000..d415144e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.asinh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/is-implemented.js new file mode 100644 index 00000000..6c205f41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var asinh = Math.asinh; + if (typeof asinh !== 'function') return false; + return asinh(2) === 1.4436354751788103; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/shim.js new file mode 100644 index 00000000..42fbf145 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/asinh/shim.js @@ -0,0 +1,15 @@ +'use strict'; + +var log = Math.log, sqrt = Math.sqrt; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (!isFinite(x)) return x; + if (x < 0) { + x = -x; + return -log(x + sqrt(x * x + 1)); + } + return log(x + sqrt(x * x + 1)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/implement.js new file mode 100644 index 00000000..1a485134 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'atanh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/index.js new file mode 100644 index 00000000..785b3deb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.atanh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/is-implemented.js new file mode 100644 index 00000000..dbaf18ec --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var atanh = Math.atanh; + if (typeof atanh !== 'function') return false; + return atanh(0.5) === 0.5493061443340549; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/shim.js new file mode 100644 index 00000000..531e2891 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/atanh/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var log = Math.log; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < -1) return NaN; + if (x > 1) return NaN; + if (x === -1) return -Infinity; + if (x === 1) return Infinity; + if (x === 0) return x; + return 0.5 * log((1 + x) / (1 - x)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/implement.js new file mode 100644 index 00000000..3a12dde4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'cbrt', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/index.js new file mode 100644 index 00000000..89f966df --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.cbrt + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/is-implemented.js new file mode 100644 index 00000000..69809f3c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var cbrt = Math.cbrt; + if (typeof cbrt !== 'function') return false; + return cbrt(2) === 1.2599210498948732; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/shim.js new file mode 100644 index 00000000..bca19602 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cbrt/shim.js @@ -0,0 +1,12 @@ +'use strict'; + +var pow = Math.pow; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (!isFinite(x)) return x; + if (x < 0) return -pow(-x, 1 / 3); + return pow(x, 1 / 3); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/implement.js new file mode 100644 index 00000000..339df33e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'clz32', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/index.js new file mode 100644 index 00000000..1687b337 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.clz32 + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/is-implemented.js new file mode 100644 index 00000000..ccc8f713 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var clz32 = Math.clz32; + if (typeof clz32 !== 'function') return false; + return clz32(1000) === 22; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/shim.js new file mode 100644 index 00000000..2a582da3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/clz32/shim.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (value) { + value = value >>> 0; + return value ? 32 - value.toString(2).length : 32; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/implement.js new file mode 100644 index 00000000..f90d8305 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'cosh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/index.js new file mode 100644 index 00000000..000636ab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.cosh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/is-implemented.js new file mode 100644 index 00000000..c796bcbf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var cosh = Math.cosh; + if (typeof cosh !== 'function') return false; + return cosh(1) === 1.5430806348152437; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/shim.js new file mode 100644 index 00000000..f9062bd9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/cosh/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +var exp = Math.exp; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return 1; + if (!isFinite(x)) return Infinity; + return (exp(x) + exp(-x)) / 2; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/implement.js new file mode 100644 index 00000000..fc20c8cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'expm1', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/index.js new file mode 100644 index 00000000..4c1bc77a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.expm1 + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/is-implemented.js new file mode 100644 index 00000000..3b106d5d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var expm1 = Math.expm1; + if (typeof expm1 !== 'function') return false; + return expm1(1).toFixed(15) === '1.718281828459045'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/shim.js new file mode 100644 index 00000000..9c8c2360 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/expm1/shim.js @@ -0,0 +1,16 @@ +// Thanks: https://github.com/monolithed/ECMAScript-6 + +'use strict'; + +var exp = Math.exp; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (x === Infinity) return Infinity; + if (x === -Infinity) return -1; + + if ((x > -1.0e-6) && (x < 1.0e-6)) return x + x * x / 2; + return exp(x) - 1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/implement.js new file mode 100644 index 00000000..c55b26c4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'fround', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/index.js new file mode 100644 index 00000000..a077ed0b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.fround + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/is-implemented.js new file mode 100644 index 00000000..ffbf094e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var fround = Math.fround; + if (typeof fround !== 'function') return false; + return fround(1.337) === 1.3370000123977661; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/shim.js new file mode 100644 index 00000000..f2c86e46 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/fround/shim.js @@ -0,0 +1,33 @@ +// Credit: https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js + +'use strict'; + +var toFloat32; + +if (typeof Float32Array !== 'undefined') { + toFloat32 = (function () { + var float32Array = new Float32Array(1); + return function (x) { + float32Array[0] = x; + return float32Array[0]; + }; + }()); +} else { + toFloat32 = (function () { + var pack = require('../_pack-ieee754') + , unpack = require('../_unpack-ieee754'); + + return function (x) { + return unpack(pack(x, 8, 23), 8, 23); + }; + }()); +} + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (!isFinite(x)) return x; + + return toFloat32(x); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/implement.js new file mode 100644 index 00000000..b27fda7a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'hypot', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/index.js new file mode 100644 index 00000000..334bc584 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.hypot + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/is-implemented.js new file mode 100644 index 00000000..e75c5d36 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var hypot = Math.hypot; + if (typeof hypot !== 'function') return false; + return hypot(3, 4) === 5; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/shim.js new file mode 100644 index 00000000..3d0988bc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/hypot/shim.js @@ -0,0 +1,34 @@ +// Thanks for hints: https://github.com/paulmillr/es6-shim + +'use strict'; + +var some = Array.prototype.some, abs = Math.abs, sqrt = Math.sqrt + + , compare = function (a, b) { return b - a; } + , divide = function (x) { return x / this; } + , add = function (sum, number) { return sum + number * number; }; + +module.exports = function (val1, val2/*, …valn*/) { + var result, numbers; + if (!arguments.length) return 0; + some.call(arguments, function (val) { + if (isNaN(val)) { + result = NaN; + return; + } + if (!isFinite(val)) { + result = Infinity; + return true; + } + if (result !== undefined) return; + val = Number(val); + if (val === 0) return; + if (!numbers) numbers = [abs(val)]; + else numbers.push(abs(val)); + }); + if (result !== undefined) return result; + if (!numbers) return 0; + + numbers.sort(compare); + return numbers[0] * sqrt(numbers.map(divide, numbers[0]).reduce(add, 0)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/implement.js new file mode 100644 index 00000000..ed207bd2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'imul', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/index.js new file mode 100644 index 00000000..41e5d5f0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.imul + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/is-implemented.js new file mode 100644 index 00000000..d8495dea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var imul = Math.imul; + if (typeof imul !== 'function') return false; + return imul(-1, 8) === -8; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/shim.js new file mode 100644 index 00000000..8fd8a8d7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/imul/shim.js @@ -0,0 +1,13 @@ +// Thanks: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference +// /Global_Objects/Math/imul + +'use strict'; + +module.exports = function (x, y) { + var xh = (x >>> 16) & 0xffff, xl = x & 0xffff + , yh = (y >>> 16) & 0xffff, yl = y & 0xffff; + + // the shift by 0 fixes the sign on the high part + // the final |0 converts the unsigned value into a signed value + return ((xl * yl) + (((xh * yl + xl * yh) << 16) >>> 0) | 0); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/index.js new file mode 100644 index 00000000..d112d0bf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/index.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = { + acosh: require('./acosh'), + asinh: require('./asinh'), + atanh: require('./atanh'), + cbrt: require('./cbrt'), + clz32: require('./clz32'), + cosh: require('./cosh'), + expm1: require('./expm1'), + fround: require('./fround'), + hypot: require('./hypot'), + imul: require('./imul'), + log10: require('./log10'), + log2: require('./log2'), + log1p: require('./log1p'), + sign: require('./sign'), + sinh: require('./sinh'), + tanh: require('./tanh'), + trunc: require('./trunc') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/implement.js new file mode 100644 index 00000000..dd96edd8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'log10', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/index.js new file mode 100644 index 00000000..a9eee513 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.log10 + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/is-implemented.js new file mode 100644 index 00000000..c7f40ee7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var log10 = Math.log10; + if (typeof log10 !== 'function') return false; + return log10(2) === 0.3010299956639812; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/shim.js new file mode 100644 index 00000000..fc77287f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log10/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var log = Math.log, LOG10E = Math.LOG10E; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < 0) return NaN; + if (x === 0) return -Infinity; + if (x === 1) return 0; + if (x === Infinity) return Infinity; + + return log(x) * LOG10E; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/implement.js new file mode 100644 index 00000000..f62f91f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'log1p', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/index.js new file mode 100644 index 00000000..107b1147 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.log1p + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/is-implemented.js new file mode 100644 index 00000000..61e90974 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var log1p = Math.log1p; + if (typeof log1p !== 'function') return false; + return log1p(1) === 0.6931471805599453; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/shim.js new file mode 100644 index 00000000..10acebca --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log1p/shim.js @@ -0,0 +1,17 @@ +// Thanks: https://github.com/monolithed/ECMAScript-6/blob/master/ES6.js + +'use strict'; + +var log = Math.log; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < -1) return NaN; + if (x === -1) return -Infinity; + if (x === 0) return x; + if (x === Infinity) return Infinity; + + if (x > -1.0e-8 && x < 1.0e-8) return (x - x * x / 2); + return log(1 + x); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/implement.js new file mode 100644 index 00000000..8483f095 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'log2', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/index.js new file mode 100644 index 00000000..87e9050a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.log2 + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/is-implemented.js new file mode 100644 index 00000000..802322fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var log2 = Math.log2; + if (typeof log2 !== 'function') return false; + return log2(3).toFixed(15) === '1.584962500721156'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/shim.js new file mode 100644 index 00000000..cd80994a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/log2/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var log = Math.log, LOG2E = Math.LOG2E; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x < 0) return NaN; + if (x === 0) return -Infinity; + if (x === 1) return 0; + if (x === Infinity) return Infinity; + + return log(x) * LOG2E; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/implement.js new file mode 100644 index 00000000..b0db2f41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'sign', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/index.js new file mode 100644 index 00000000..b2326333 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.sign + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/is-implemented.js new file mode 100644 index 00000000..6d0de475 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var sign = Math.sign; + if (typeof sign !== 'function') return false; + return ((sign(10) === 1) && (sign(-20) === -1)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/shim.js new file mode 100644 index 00000000..4df9c95a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sign/shim.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (value) { + value = Number(value); + if (isNaN(value) || (value === 0)) return value; + return (value > 0) ? 1 : -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/implement.js new file mode 100644 index 00000000..f259a631 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'sinh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/index.js new file mode 100644 index 00000000..e5bea572 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.sinh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/is-implemented.js new file mode 100644 index 00000000..888ec67a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var sinh = Math.sinh; + if (typeof sinh !== 'function') return false; + return ((sinh(1) === 1.1752011936438014) && (sinh(Number.MIN_VALUE) === 5e-324)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/shim.js new file mode 100644 index 00000000..5b725bed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/sinh/shim.js @@ -0,0 +1,17 @@ +// Parts of implementation taken from es6-shim project +// See: https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js + +'use strict'; + +var expm1 = require('../expm1') + + , abs = Math.abs, exp = Math.exp, e = Math.E; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (!isFinite(x)) return x; + if (abs(x) < 1) return (expm1(x) - expm1(-x)) / 2; + return (exp(x - 1) - exp(-x - 1)) * e / 2; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/implement.js new file mode 100644 index 00000000..5199a029 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'tanh', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/index.js new file mode 100644 index 00000000..6099c408 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.tanh + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/is-implemented.js new file mode 100644 index 00000000..a7d22237 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var tanh = Math.tanh; + if (typeof tanh !== 'function') return false; + return ((tanh(1) === 0.7615941559557649) && (tanh(Number.MAX_VALUE) === 1)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/shim.js new file mode 100644 index 00000000..f6e948f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/tanh/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +var exp = Math.exp; + +module.exports = function (x) { + var a, b; + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (x === Infinity) return 1; + if (x === -Infinity) return -1; + a = exp(x); + if (a === Infinity) return 1; + b = exp(-x); + if (b === Infinity) return -1; + return (a - b) / (a + b); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/implement.js new file mode 100644 index 00000000..3ee80ab2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Math, 'trunc', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/index.js new file mode 100644 index 00000000..0b0f9b2a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Math.trunc + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/is-implemented.js new file mode 100644 index 00000000..3e8cde1f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var trunc = Math.trunc; + if (typeof trunc !== 'function') return false; + return (trunc(13.67) === 13) && (trunc(-13.67) === -13); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/shim.js new file mode 100644 index 00000000..02e2c2ad --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/math/trunc/shim.js @@ -0,0 +1,13 @@ +'use strict'; + +var floor = Math.floor; + +module.exports = function (x) { + if (isNaN(x)) return NaN; + x = Number(x); + if (x === 0) return x; + if (x === Infinity) return Infinity; + if (x === -Infinity) return -Infinity; + if (x > 0) return floor(x); + return -floor(-x); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/#/index.js new file mode 100644 index 00000000..32481170 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/#/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + pad: require('./pad') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/#/pad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/#/pad.js new file mode 100644 index 00000000..4478f6a1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/#/pad.js @@ -0,0 +1,15 @@ +'use strict'; + +var pad = require('../../string/#/pad') + , toPosInt = require('../to-pos-integer') + + , toFixed = Number.prototype.toFixed; + +module.exports = function (length/*, precision*/) { + var precision; + length = toPosInt(length); + precision = toPosInt(arguments[1]); + + return pad.call(precision ? toFixed.call(this, precision) : this, + '0', length + (precision ? (1 + precision) : 0)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/epsilon/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/epsilon/implement.js new file mode 100644 index 00000000..f0a670ae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/epsilon/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'EPSILON', { value: require('./'), + configurable: false, enumerable: false, writable: false }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/epsilon/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/epsilon/index.js new file mode 100644 index 00000000..4e4b621b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/epsilon/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = 2.220446049250313e-16; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/epsilon/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/epsilon/is-implemented.js new file mode 100644 index 00000000..141f5d2f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/epsilon/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return (typeof Number.EPSILON === 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/index.js new file mode 100644 index 00000000..35daf78e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/index.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + EPSILON: require('./epsilon'), + isFinite: require('./is-finite'), + isInteger: require('./is-integer'), + isNaN: require('./is-nan'), + isNumber: require('./is-number'), + isSafeInteger: require('./is-safe-integer'), + MAX_SAFE_INTEGER: require('./max-safe-integer'), + MIN_SAFE_INTEGER: require('./min-safe-integer'), + toInteger: require('./to-integer'), + toPosInteger: require('./to-pos-integer'), + toUint32: require('./to-uint32') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/implement.js new file mode 100644 index 00000000..51d7cac0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'isFinite', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/index.js new file mode 100644 index 00000000..15d5f405 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Number.isFinite + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/is-implemented.js new file mode 100644 index 00000000..556e396b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var isFinite = Number.isFinite; + if (typeof isFinite !== 'function') return false; + return !isFinite('23') && isFinite(34) && !isFinite(Infinity); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/shim.js new file mode 100644 index 00000000..e3aee551 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-finite/shim.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (value) { + return (typeof value === 'number') && isFinite(value); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/implement.js new file mode 100644 index 00000000..fe53f281 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'isInteger', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/index.js new file mode 100644 index 00000000..55e039a9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Number.isInteger + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/is-implemented.js new file mode 100644 index 00000000..a0e573be --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var isInteger = Number.isInteger; + if (typeof isInteger !== 'function') return false; + return !isInteger('23') && isInteger(34) && !isInteger(32.34); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/shim.js new file mode 100644 index 00000000..54029398 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-integer/shim.js @@ -0,0 +1,8 @@ +// Credit: http://www.2ality.com/2014/05/is-integer.html + +'use strict'; + +module.exports = function (value) { + if (typeof value !== 'number') return false; + return (value % 1 === 0); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/implement.js new file mode 100644 index 00000000..e1c5deea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'isNaN', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/index.js new file mode 100644 index 00000000..3b2c4ca6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Number.isNaN + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/is-implemented.js new file mode 100644 index 00000000..4cf27665 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var isNaN = Number.isNaN; + if (typeof isNaN !== 'function') return false; + return !isNaN({}) && isNaN(NaN) && !isNaN(34); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/shim.js new file mode 100644 index 00000000..070d96cd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-nan/shim.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (value) { return (value !== value); } //jslint: ignore diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-number.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-number.js new file mode 100644 index 00000000..19a99e4f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-number.js @@ -0,0 +1,11 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(1); + +module.exports = function (x) { + return ((typeof x === 'number') || + ((x instanceof Number) || + ((typeof x === 'object') && (toString.call(x) === id)))); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/implement.js new file mode 100644 index 00000000..51cef960 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'isSafeInteger', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/index.js new file mode 100644 index 00000000..49adeaaf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Number.isSafeInteger + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/is-implemented.js new file mode 100644 index 00000000..510b60e4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function () { + var isSafeInteger = Number.isSafeInteger; + if (typeof isSafeInteger !== 'function') return false; + return !isSafeInteger('23') && isSafeInteger(34232322323) && + !isSafeInteger(9007199254740992); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/shim.js new file mode 100644 index 00000000..692acdd6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/is-safe-integer/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +var isInteger = require('../is-integer/shim') + , maxValue = require('../max-safe-integer') + + , abs = Math.abs; + +module.exports = function (value) { + if (!isInteger(value)) return false; + return abs(value) <= maxValue; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/max-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/max-safe-integer/implement.js new file mode 100644 index 00000000..4e0bb574 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/max-safe-integer/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'MAX_SAFE_INTEGER', { value: require('./'), + configurable: false, enumerable: false, writable: false }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/max-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/max-safe-integer/index.js new file mode 100644 index 00000000..ed5d6a53 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/max-safe-integer/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = Math.pow(2, 53) - 1; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/max-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/max-safe-integer/is-implemented.js new file mode 100644 index 00000000..7bd08a9d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/max-safe-integer/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return (typeof Number.MAX_SAFE_INTEGER === 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/min-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/min-safe-integer/implement.js new file mode 100644 index 00000000..e3f110e4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/min-safe-integer/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Number, 'MIN_SAFE_INTEGER', { value: require('./'), + configurable: false, enumerable: false, writable: false }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/min-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/min-safe-integer/index.js new file mode 100644 index 00000000..1c6cc274 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/min-safe-integer/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = -(Math.pow(2, 53) - 1); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/min-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/min-safe-integer/is-implemented.js new file mode 100644 index 00000000..efc9875f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/min-safe-integer/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return (typeof Number.MIN_SAFE_INTEGER === 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/to-integer.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/to-integer.js new file mode 100644 index 00000000..60e798c5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/to-integer.js @@ -0,0 +1,12 @@ +'use strict'; + +var sign = require('../math/sign') + + , abs = Math.abs, floor = Math.floor; + +module.exports = function (value) { + if (isNaN(value)) return 0; + value = Number(value); + if ((value === 0) || !isFinite(value)) return value; + return sign(value) * floor(abs(value)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/to-pos-integer.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/to-pos-integer.js new file mode 100644 index 00000000..605a302c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/to-pos-integer.js @@ -0,0 +1,7 @@ +'use strict'; + +var toInteger = require('./to-integer') + + , max = Math.max; + +module.exports = function (value) { return max(0, toInteger(value)); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/to-uint32.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/to-uint32.js new file mode 100644 index 00000000..6263e85e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/number/to-uint32.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (value) { return value >>> 0; }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/_iterate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/_iterate.js new file mode 100644 index 00000000..bf2c55d0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/_iterate.js @@ -0,0 +1,29 @@ +// Internal method, used by iteration functions. +// Calls a function for each key-value pair found in object +// Optionally takes compareFn to iterate object in specific order + +'use strict'; + +var isCallable = require('./is-callable') + , callable = require('./valid-callable') + , value = require('./valid-value') + + , call = Function.prototype.call, keys = Object.keys + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable; + +module.exports = function (method, defVal) { + return function (obj, cb/*, thisArg, compareFn*/) { + var list, thisArg = arguments[2], compareFn = arguments[3]; + obj = Object(value(obj)); + callable(cb); + + list = keys(obj); + if (compareFn) { + list.sort(isCallable(compareFn) ? compareFn.bind(obj) : undefined); + } + return list[method](function (key, index) { + if (!propertyIsEnumerable.call(obj, key)) return defVal; + return call.call(cb, thisArg, obj[key], key, obj, index); + }); + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/implement.js new file mode 100644 index 00000000..3bcc68e3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Object, 'assign', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/index.js new file mode 100644 index 00000000..ab0f9f24 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Object.assign + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/is-implemented.js new file mode 100644 index 00000000..579ad2dd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function () { + var assign = Object.assign, obj; + if (typeof assign !== 'function') return false; + obj = { foo: 'raz' }; + assign(obj, { bar: 'dwa' }, { trzy: 'trzy' }); + return (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/shim.js new file mode 100644 index 00000000..74da11a8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/assign/shim.js @@ -0,0 +1,22 @@ +'use strict'; + +var keys = require('../keys') + , value = require('../valid-value') + + , max = Math.max; + +module.exports = function (dest, src/*, …srcn*/) { + var error, i, l = max(arguments.length, 2), assign; + dest = Object(value(dest)); + assign = function (key) { + try { dest[key] = src[key]; } catch (e) { + if (!error) error = e; + } + }; + for (i = 1; i < l; ++i) { + src = arguments[i]; + keys(src).forEach(assign); + } + if (error !== undefined) throw error; + return dest; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/clear.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/clear.js new file mode 100644 index 00000000..85e46372 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/clear.js @@ -0,0 +1,16 @@ +'use strict'; + +var keys = require('./keys'); + +module.exports = function (obj) { + var error; + keys(obj).forEach(function (key) { + try { + delete this[key]; + } catch (e) { + if (!error) error = e; + } + }, obj); + if (error !== undefined) throw error; + return obj; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/compact.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/compact.js new file mode 100644 index 00000000..d021da45 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/compact.js @@ -0,0 +1,7 @@ +'use strict'; + +var filter = require('./filter'); + +module.exports = function (obj) { + return filter(obj, function (val) { return val != null; }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/compare.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/compare.js new file mode 100644 index 00000000..2ab11f1a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/compare.js @@ -0,0 +1,42 @@ +'use strict'; + +var strCompare = require('../string/#/case-insensitive-compare') + , isObject = require('./is-object') + + , resolve, typeMap; + +typeMap = { + undefined: 0, + object: 1, + boolean: 2, + string: 3, + number: 4 +}; + +resolve = function (a) { + if (isObject(a)) { + if (typeof a.valueOf !== 'function') return NaN; + a = a.valueOf(); + if (isObject(a)) { + if (typeof a.toString !== 'function') return NaN; + a = a.toString(); + if (typeof a !== 'string') return NaN; + } + } + return a; +}; + +module.exports = function (a, b) { + if (a === b) return 0; // Same + + a = resolve(a); + b = resolve(b); + if (a == b) return typeMap[typeof a] - typeMap[typeof b]; //jslint: ignore + if (a == null) return -1; + if (b == null) return 1; + if ((typeof a === 'string') || (typeof b === 'string')) { + return strCompare.call(a, b); + } + if ((a !== a) && (b !== b)) return 0; //jslint: ignore + return Number(a) - Number(b); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/copy-deep.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/copy-deep.js new file mode 100644 index 00000000..548e3ee4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/copy-deep.js @@ -0,0 +1,30 @@ +'use strict'; + +var isPlainObject = require('./is-plain-object') + , value = require('./valid-value') + + , keys = Object.keys + , copy; + +copy = function (source) { + var target = {}; + this[0].push(source); + this[1].push(target); + keys(source).forEach(function (key) { + var index; + if (!isPlainObject(source[key])) { + target[key] = source[key]; + return; + } + index = this[0].indexOf(source[key]); + if (index === -1) target[key] = copy.call(this, source[key]); + else target[key] = this[1][index]; + }, this); + return target; +}; + +module.exports = function (source) { + var obj = Object(value(source)); + if (obj !== source) return obj; + return copy.call([[], []], obj); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/copy.js new file mode 100644 index 00000000..4d717728 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/copy.js @@ -0,0 +1,10 @@ +'use strict'; + +var assign = require('./assign') + , value = require('./valid-value'); + +module.exports = function (obj) { + var copy = Object(value(obj)); + if (copy !== obj) return copy; + return assign({}, obj); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/count.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/count.js new file mode 100644 index 00000000..29cfbb53 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/count.js @@ -0,0 +1,5 @@ +'use strict'; + +var keys = require('./keys'); + +module.exports = function (obj) { return keys(obj).length; }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/create.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/create.js new file mode 100644 index 00000000..f813b466 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/create.js @@ -0,0 +1,36 @@ +// Workaround for http://code.google.com/p/v8/issues/detail?id=2804 + +'use strict'; + +var create = Object.create, shim; + +if (!require('./set-prototype-of/is-implemented')()) { + shim = require('./set-prototype-of/shim'); +} + +module.exports = (function () { + var nullObject, props, desc; + if (!shim) return create; + if (shim.level !== 1) return create; + + nullObject = {}; + props = {}; + desc = { configurable: false, enumerable: false, writable: true, + value: undefined }; + Object.getOwnPropertyNames(Object.prototype).forEach(function (name) { + if (name === '__proto__') { + props[name] = { configurable: true, enumerable: false, writable: true, + value: undefined }; + return; + } + props[name] = desc; + }); + Object.defineProperties(nullObject, props); + + Object.defineProperty(shim, 'nullPolyfill', { configurable: false, + enumerable: false, writable: false, value: nullObject }); + + return function (prototype, props) { + return create((prototype === null) ? nullObject : prototype, props); + }; +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/eq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/eq.js new file mode 100644 index 00000000..037937ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/eq.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (x, y) { + return ((x === y) || ((x !== x) && (y !== y))); //jslint: ignore +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/every.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/every.js new file mode 100644 index 00000000..1303db20 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/every.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./_iterate')('every', true); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/filter.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/filter.js new file mode 100644 index 00000000..e5edb49b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/filter.js @@ -0,0 +1,15 @@ +'use strict'; + +var callable = require('./valid-callable') + , forEach = require('./for-each') + + , call = Function.prototype.call; + +module.exports = function (obj, cb/*, thisArg*/) { + var o = {}, thisArg = arguments[2]; + callable(cb); + forEach(obj, function (value, key, obj, index) { + if (call.call(cb, thisArg, value, key, obj, index)) o[key] = obj[key]; + }); + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/first-key.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/first-key.js new file mode 100644 index 00000000..7df10b2f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/first-key.js @@ -0,0 +1,14 @@ +'use strict'; + +var value = require('./valid-value') + + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable; + +module.exports = function (obj) { + var i; + value(obj); + for (i in obj) { + if (propertyIsEnumerable.call(obj, i)) return i; + } + return null; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/flatten.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/flatten.js new file mode 100644 index 00000000..e8b40444 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/flatten.js @@ -0,0 +1,17 @@ +'use strict'; + +var isPlainObject = require('./is-plain-object') + , forEach = require('./for-each') + + , process; + +process = function self(value, key) { + if (isPlainObject(value)) forEach(value, self, this); + else this[key] = value; +}; + +module.exports = function (obj) { + var flattened = {}; + forEach(obj, process, flattened); + return flattened; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/for-each.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/for-each.js new file mode 100644 index 00000000..6674f8a6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/for-each.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./_iterate')('forEach'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/get-property-names.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/get-property-names.js new file mode 100644 index 00000000..54a01e50 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/get-property-names.js @@ -0,0 +1,18 @@ +'use strict'; + +var uniq = require('../array/#/uniq') + , value = require('./valid-value') + + , push = Array.prototype.push + , getOwnPropertyNames = Object.getOwnPropertyNames + , getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (obj) { + var keys; + obj = Object(value(obj)); + keys = getOwnPropertyNames(obj); + while ((obj = getPrototypeOf(obj))) { + push.apply(keys, getOwnPropertyNames(obj)); + } + return uniq.call(keys); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/index.js new file mode 100644 index 00000000..4bdf4035 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/index.js @@ -0,0 +1,48 @@ +'use strict'; + +module.exports = { + assign: require('./assign'), + clear: require('./clear'), + compact: require('./compact'), + compare: require('./compare'), + copy: require('./copy'), + copyDeep: require('./copy-deep'), + count: require('./count'), + create: require('./create'), + eq: require('./eq'), + every: require('./every'), + filter: require('./filter'), + firstKey: require('./first-key'), + flatten: require('./flatten'), + forEach: require('./for-each'), + getPropertyNames: require('./get-property-names'), + is: require('./is'), + isArrayLike: require('./is-array-like'), + isCallable: require('./is-callable'), + isCopy: require('./is-copy'), + isCopyDeep: require('./is-copy-deep'), + isEmpty: require('./is-empty'), + isObject: require('./is-object'), + isPlainObject: require('./is-plain-object'), + keyOf: require('./key-of'), + keys: require('./keys'), + map: require('./map'), + mapKeys: require('./map-keys'), + normalizeOptions: require('./normalize-options'), + mixin: require('./mixin'), + mixinPrototypes: require('./mixin-prototypes'), + primitiveSet: require('./primitive-set'), + safeTraverse: require('./safe-traverse'), + serialize: require('./serialize'), + setPrototypeOf: require('./set-prototype-of'), + some: require('./some'), + toArray: require('./to-array'), + unserialize: require('./unserialize'), + validateArrayLike: require('./validate-array-like'), + validateArrayLikeObject: require('./validate-array-like-object'), + validCallable: require('./valid-callable'), + validObject: require('./valid-object'), + validateStringifiable: require('./validate-stringifiable'), + validateStringifiableValue: require('./validate-stringifiable-value'), + validValue: require('./valid-value') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-array-like.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-array-like.js new file mode 100644 index 00000000..b8beed22 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-array-like.js @@ -0,0 +1,14 @@ +'use strict'; + +var isFunction = require('../function/is-function') + , isObject = require('./is-object'); + +module.exports = function (x) { + return ((x != null) && (typeof x.length === 'number') && + + // Just checking ((typeof x === 'object') && (typeof x !== 'function')) + // won't work right for some cases, e.g.: + // type of instance of NodeList in Safari is a 'function' + + ((isObject(x) && !isFunction(x)) || (typeof x === "string"))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-callable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-callable.js new file mode 100644 index 00000000..5d5d4b31 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-callable.js @@ -0,0 +1,5 @@ +// Deprecated + +'use strict'; + +module.exports = function (obj) { return typeof obj === 'function'; }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-copy-deep.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-copy-deep.js new file mode 100644 index 00000000..c4b2b42b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-copy-deep.js @@ -0,0 +1,58 @@ +'use strict'; + +var eq = require('./eq') + , isPlainObject = require('./is-plain-object') + , value = require('./valid-value') + + , isArray = Array.isArray, keys = Object.keys + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable + + , eqArr, eqVal, eqObj; + +eqArr = function (a, b, recMap) { + var i, l = a.length; + if (l !== b.length) return false; + for (i = 0; i < l; ++i) { + if (a.hasOwnProperty(i) !== b.hasOwnProperty(i)) return false; + if (!eqVal(a[i], b[i], recMap)) return false; + } + return true; +}; + +eqObj = function (a, b, recMap) { + var k1 = keys(a), k2 = keys(b); + if (k1.length !== k2.length) return false; + return k1.every(function (key) { + if (!propertyIsEnumerable.call(b, key)) return false; + return eqVal(a[key], b[key], recMap); + }); +}; + +eqVal = function (a, b, recMap) { + var i, eqX, c1, c2; + if (eq(a, b)) return true; + if (isPlainObject(a)) { + if (!isPlainObject(b)) return false; + eqX = eqObj; + } else if (isArray(a) && isArray(b)) { + eqX = eqArr; + } else { + return false; + } + c1 = recMap[0]; + c2 = recMap[1]; + i = c1.indexOf(a); + if (i !== -1) { + if (c2[i].indexOf(b) !== -1) return true; + } else { + i = c1.push(a) - 1; + c2[i] = []; + } + c2[i].push(b); + return eqX(a, b, recMap); +}; + +module.exports = function (a, b) { + if (eq(value(a), value(b))) return true; + return eqVal(Object(a), Object(b), [[], []]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-copy.js new file mode 100644 index 00000000..4fe639d4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-copy.js @@ -0,0 +1,24 @@ +'use strict'; + +var eq = require('./eq') + , value = require('./valid-value') + + , keys = Object.keys + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable; + +module.exports = function (a, b) { + var k1, k2; + + if (eq(value(a), value(b))) return true; + + a = Object(a); + b = Object(b); + + k1 = keys(a); + k2 = keys(b); + if (k1.length !== k2.length) return false; + return k1.every(function (key) { + if (!propertyIsEnumerable.call(b, key)) return false; + return eq(a[key], b[key]); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-empty.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-empty.js new file mode 100644 index 00000000..7b51a87c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-empty.js @@ -0,0 +1,14 @@ +'use strict'; + +var value = require('./valid-value') + + , propertyIsEnumerable = Object.prototype.propertyIsEnumerable; + +module.exports = function (obj) { + var i; + value(obj); + for (i in obj) { //jslint: ignore + if (propertyIsEnumerable.call(obj, i)) return false; + } + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-object.js new file mode 100644 index 00000000..a86facf1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-object.js @@ -0,0 +1,7 @@ +'use strict'; + +var map = { function: true, object: true }; + +module.exports = function (x) { + return ((x != null) && map[typeof x]) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-plain-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-plain-object.js new file mode 100644 index 00000000..9a282319 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is-plain-object.js @@ -0,0 +1,20 @@ +'use strict'; + +var getPrototypeOf = Object.getPrototypeOf, prototype = Object.prototype + , toString = prototype.toString + + , id = Object().toString(); + +module.exports = function (value) { + var proto, constructor; + if (!value || (typeof value !== 'object') || (toString.call(value) !== id)) { + return false; + } + proto = getPrototypeOf(value); + if (proto === null) { + constructor = value.constructor; + if (typeof constructor !== 'function') return true; + return (constructor.prototype !== value); + } + return (proto === prototype) || (getPrototypeOf(proto) === null); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is.js new file mode 100644 index 00000000..5778b502 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/is.js @@ -0,0 +1,10 @@ +// Implementation credits go to: +// http://wiki.ecmascript.org/doku.php?id=harmony:egal + +'use strict'; + +module.exports = function (x, y) { + return (x === y) ? + ((x !== 0) || ((1 / x) === (1 / y))) : + ((x !== x) && (y !== y)); //jslint: ignore +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/key-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/key-of.js new file mode 100644 index 00000000..8c44c8d8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/key-of.js @@ -0,0 +1,15 @@ +'use strict'; + +var eq = require('./eq') + , some = require('./some'); + +module.exports = function (obj, searchValue) { + var r; + return some(obj, function (value, name) { + if (eq(value, searchValue)) { + r = name; + return true; + } + return false; + }) ? r : null; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/implement.js new file mode 100644 index 00000000..c6872bd0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(Object, 'keys', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/index.js new file mode 100644 index 00000000..5ef05223 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Object.keys + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/is-implemented.js new file mode 100644 index 00000000..40c32c33 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function () { + try { + Object.keys('primitive'); + return true; + } catch (e) { return false; } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/shim.js new file mode 100644 index 00000000..034b6b29 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/keys/shim.js @@ -0,0 +1,7 @@ +'use strict'; + +var keys = Object.keys; + +module.exports = function (object) { + return keys(object == null ? object : Object(object)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/map-keys.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/map-keys.js new file mode 100644 index 00000000..26f0ecac --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/map-keys.js @@ -0,0 +1,15 @@ +'use strict'; + +var callable = require('./valid-callable') + , forEach = require('./for-each') + + , call = Function.prototype.call; + +module.exports = function (obj, cb/*, thisArg*/) { + var o = {}, thisArg = arguments[2]; + callable(cb); + forEach(obj, function (value, key, obj, index) { + o[call.call(cb, thisArg, key, value, this, index)] = value; + }, obj); + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/map.js new file mode 100644 index 00000000..6b39d3c9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/map.js @@ -0,0 +1,15 @@ +'use strict'; + +var callable = require('./valid-callable') + , forEach = require('./for-each') + + , call = Function.prototype.call; + +module.exports = function (obj, cb/*, thisArg*/) { + var o = {}, thisArg = arguments[2]; + callable(cb); + forEach(obj, function (value, key, obj, index) { + o[key] = call.call(cb, thisArg, value, key, obj, index); + }); + return o; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/mixin-prototypes.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/mixin-prototypes.js new file mode 100644 index 00000000..1ef57564 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/mixin-prototypes.js @@ -0,0 +1,34 @@ +'use strict'; + +var value = require('./valid-value') + , mixin = require('./mixin') + + , defineProperty = Object.defineProperty + , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor + , getOwnPropertyNames = Object.getOwnPropertyNames + , getPrototypeOf = Object.getPrototypeOf + , hasOwnProperty = Object.prototype.hasOwnProperty; + +module.exports = function (target, source) { + var error, end, define; + target = Object(value(target)); + source = Object(value(source)); + end = getPrototypeOf(target); + if (source === end) return target; + try { + mixin(target, source); + } catch (e) { error = e; } + source = getPrototypeOf(source); + define = function (name) { + if (hasOwnProperty.call(target, name)) return; + try { + defineProperty(target, name, getOwnPropertyDescriptor(source, name)); + } catch (e) { error = e; } + }; + while (source && (source !== end)) { + getOwnPropertyNames(source).forEach(define); + source = getPrototypeOf(source); + } + if (error) throw error; + return target; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/mixin.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/mixin.js new file mode 100644 index 00000000..80b5df5e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/mixin.js @@ -0,0 +1,19 @@ +'use strict'; + +var value = require('./valid-value') + + , defineProperty = Object.defineProperty + , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor + , getOwnPropertyNames = Object.getOwnPropertyNames; + +module.exports = function (target, source) { + var error; + target = Object(value(target)); + getOwnPropertyNames(Object(value(source))).forEach(function (name) { + try { + defineProperty(target, name, getOwnPropertyDescriptor(source, name)); + } catch (e) { error = e; } + }); + if (error !== undefined) throw error; + return target; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/normalize-options.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/normalize-options.js new file mode 100644 index 00000000..cf8ed8d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/normalize-options.js @@ -0,0 +1,17 @@ +'use strict'; + +var forEach = Array.prototype.forEach, create = Object.create; + +var process = function (src, obj) { + var key; + for (key in src) obj[key] = src[key]; +}; + +module.exports = function (options/*, …options*/) { + var result = create(null); + forEach.call(arguments, function (options) { + if (options == null) return; + process(Object(options), result); + }); + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/primitive-set.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/primitive-set.js new file mode 100644 index 00000000..ada10951 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/primitive-set.js @@ -0,0 +1,9 @@ +'use strict'; + +var forEach = Array.prototype.forEach, create = Object.create; + +module.exports = function (arg/*, …args*/) { + var set = create(null); + forEach.call(arguments, function (name) { set[name] = true; }); + return set; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/safe-traverse.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/safe-traverse.js new file mode 100644 index 00000000..7e1b5f41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/safe-traverse.js @@ -0,0 +1,15 @@ +'use strict'; + +var value = require('./valid-value'); + +module.exports = function (obj/*, …names*/) { + var length, current = 1; + value(obj); + length = arguments.length - 1; + if (!length) return obj; + while (current < length) { + obj = obj[arguments[current++]]; + if (obj == null) return undefined; + } + return obj[arguments[current]]; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/serialize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/serialize.js new file mode 100644 index 00000000..8113b680 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/serialize.js @@ -0,0 +1,36 @@ +'use strict'; + +var toArray = require('./to-array') + , isDate = require('../date/is-date') + , isRegExp = require('../reg-exp/is-reg-exp') + + , isArray = Array.isArray, stringify = JSON.stringify + , keyValueToString = function (value, key) { return stringify(key) + ':' + exports(value); }; + +var sparseMap = function (arr) { + var i, l = arr.length, result = new Array(l); + for (i = 0; i < l; ++i) { + if (!arr.hasOwnProperty(i)) continue; + result[i] = exports(arr[i]); + } + return result; +}; + +module.exports = exports = function (obj) { + if (obj == null) return String(obj); + switch (typeof obj) { + case 'string': + return stringify(obj); + case 'number': + case 'boolean': + case 'function': + return String(obj); + case 'object': + if (isArray(obj)) return '[' + sparseMap(obj) + ']'; + if (isRegExp(obj)) return String(obj); + if (isDate(obj)) return 'new Date(' + obj.valueOf() + ')'; + return '{' + toArray(obj, keyValueToString) + '}'; + default: + throw new TypeError("Serialization of " + String(obj) + "is unsupported"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/implement.js new file mode 100644 index 00000000..000e6bdb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/implement.js @@ -0,0 +1,8 @@ +'use strict'; + +var shim; + +if (!require('./is-implemented')() && (shim = require('./shim'))) { + Object.defineProperty(Object, 'setPrototypeOf', + { value: shim, configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/index.js new file mode 100644 index 00000000..ccc40995 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? Object.setPrototypeOf + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/is-implemented.js new file mode 100644 index 00000000..98d0c843 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/is-implemented.js @@ -0,0 +1,11 @@ +'use strict'; + +var create = Object.create, getPrototypeOf = Object.getPrototypeOf + , x = {}; + +module.exports = function (/*customCreate*/) { + var setPrototypeOf = Object.setPrototypeOf + , customCreate = arguments[0] || create; + if (typeof setPrototypeOf !== 'function') return false; + return getPrototypeOf(setPrototypeOf(customCreate(null), x)) === x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/shim.js new file mode 100644 index 00000000..4ec94467 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/set-prototype-of/shim.js @@ -0,0 +1,73 @@ +// Big thanks to @WebReflection for sorting this out +// https://gist.github.com/WebReflection/5593554 + +'use strict'; + +var isObject = require('../is-object') + , value = require('../valid-value') + + , isPrototypeOf = Object.prototype.isPrototypeOf + , defineProperty = Object.defineProperty + , nullDesc = { configurable: true, enumerable: false, writable: true, + value: undefined } + , validate; + +validate = function (obj, prototype) { + value(obj); + if ((prototype === null) || isObject(prototype)) return obj; + throw new TypeError('Prototype must be null or an object'); +}; + +module.exports = (function (status) { + var fn, set; + if (!status) return null; + if (status.level === 2) { + if (status.set) { + set = status.set; + fn = function (obj, prototype) { + set.call(validate(obj, prototype), prototype); + return obj; + }; + } else { + fn = function (obj, prototype) { + validate(obj, prototype).__proto__ = prototype; + return obj; + }; + } + } else { + fn = function self(obj, prototype) { + var isNullBase; + validate(obj, prototype); + isNullBase = isPrototypeOf.call(self.nullPolyfill, obj); + if (isNullBase) delete self.nullPolyfill.__proto__; + if (prototype === null) prototype = self.nullPolyfill; + obj.__proto__ = prototype; + if (isNullBase) defineProperty(self.nullPolyfill, '__proto__', nullDesc); + return obj; + }; + } + return Object.defineProperty(fn, 'level', { configurable: false, + enumerable: false, writable: false, value: status.level }); +}((function () { + var x = Object.create(null), y = {}, set + , desc = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__'); + + if (desc) { + try { + set = desc.set; // Opera crashes at this point + set.call(x, y); + } catch (ignore) { } + if (Object.getPrototypeOf(x) === y) return { set: set, level: 2 }; + } + + x.__proto__ = y; + if (Object.getPrototypeOf(x) === y) return { level: 2 }; + + x = {}; + x.__proto__ = y; + if (Object.getPrototypeOf(x) === y) return { level: 1 }; + + return false; +}()))); + +require('../create'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/some.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/some.js new file mode 100644 index 00000000..cde5ddee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/some.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./_iterate')('some', false); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/to-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/to-array.js new file mode 100644 index 00000000..a954abb2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/to-array.js @@ -0,0 +1,18 @@ +'use strict'; + +var callable = require('./valid-callable') + , forEach = require('./for-each') + + , call = Function.prototype.call + + , defaultCb = function (value, key) { return [key, value]; }; + +module.exports = function (obj/*, cb, thisArg, compareFn*/) { + var a = [], cb = arguments[1], thisArg = arguments[2]; + cb = (cb == null) ? defaultCb : callable(cb); + + forEach(obj, function (value, key, obj, index) { + a.push(call.call(cb, thisArg, value, key, this, index)); + }, obj, arguments[3]); + return a; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/unserialize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/unserialize.js new file mode 100644 index 00000000..ce68e403 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/unserialize.js @@ -0,0 +1,7 @@ +'use strict'; + +var value = require('./valid-value'); + +module.exports = exports = function (code) { + return (new Function('return ' + value(code)))(); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/valid-callable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/valid-callable.js new file mode 100644 index 00000000..c977527a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/valid-callable.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (fn) { + if (typeof fn !== 'function') throw new TypeError(fn + " is not a function"); + return fn; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/valid-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/valid-object.js new file mode 100644 index 00000000..f82bd51e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/valid-object.js @@ -0,0 +1,8 @@ +'use strict'; + +var isObject = require('./is-object'); + +module.exports = function (value) { + if (!isObject(value)) throw new TypeError(value + " is not an Object"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/valid-value.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/valid-value.js new file mode 100644 index 00000000..36c8ec31 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/valid-value.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (value) { + if (value == null) throw new TypeError("Cannot use null or undefined"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-array-like-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-array-like-object.js new file mode 100644 index 00000000..89e12c51 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-array-like-object.js @@ -0,0 +1,9 @@ +'use strict'; + +var isArrayLike = require('./is-array-like') + , isObject = require('./is-object'); + +module.exports = function (obj) { + if (isObject(obj) && isArrayLike(obj)) return obj; + throw new TypeError(obj + " is not array-like object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-array-like.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-array-like.js new file mode 100644 index 00000000..6a35b54a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-array-like.js @@ -0,0 +1,8 @@ +'use strict'; + +var isArrayLike = require('./is-array-like'); + +module.exports = function (obj) { + if (isArrayLike(obj)) return obj; + throw new TypeError(obj + " is not array-like value"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-stringifiable-value.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-stringifiable-value.js new file mode 100644 index 00000000..9df3b668 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-stringifiable-value.js @@ -0,0 +1,6 @@ +'use strict'; + +var value = require('./valid-value') + , stringifiable = require('./validate-stringifiable'); + +module.exports = function (x) { return stringifiable(value(x)); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-stringifiable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-stringifiable.js new file mode 100644 index 00000000..eba7ce78 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/object/validate-stringifiable.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (stringifiable) { + try { + return String(stringifiable); + } catch (e) { + throw new TypeError("Passed argument cannot be stringifed"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/package.json new file mode 100644 index 00000000..01d65327 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/package.json @@ -0,0 +1,74 @@ +{ + "name": "es5-ext", + "version": "0.10.7", + "description": "ECMAScript 5 extensions and ES6 shims", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "ecmascript", + "ecmascript5", + "ecmascript6", + "es5", + "es6", + "extensions", + "ext", + "addons", + "extras", + "harmony", + "javascript", + "polyfill", + "shim", + "util", + "utils", + "utilities" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es5-ext.git" + }, + "dependencies": { + "es6-iterator": "~0.1.3", + "es6-symbol": "~2.0.1" + }, + "devDependencies": { + "tad": "~0.2.2", + "xlint": "~0.2.2", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "5b63ee02f50dfbc70dc1f62bc66b8718af443f83", + "bugs": { + "url": "https://github.com/medikoo/es5-ext/issues" + }, + "homepage": "https://github.com/medikoo/es5-ext", + "_id": "es5-ext@0.10.7", + "_shasum": "dfaea50721301042e2d89c1719d43493fa821656", + "_from": "es5-ext@>=0.10.6 <0.11.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "dfaea50721301042e2d89c1719d43493fa821656", + "tarball": "http://registry.npmjs.org/es5-ext/-/es5-ext-0.10.7.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.7.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/index.js new file mode 100644 index 00000000..f7e7a58e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + isSticky: require('./is-sticky'), + isUnicode: require('./is-unicode'), + match: require('./match'), + replace: require('./replace'), + search: require('./search'), + split: require('./split') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/is-sticky.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/is-sticky.js new file mode 100644 index 00000000..830a481f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/is-sticky.js @@ -0,0 +1,9 @@ +'use strict'; + +var validRegExp = require('../valid-reg-exp') + + , re = /\/[a-xz]*y[a-xz]*$/; + +module.exports = function () { + return Boolean(String(validRegExp(this)).match(re)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/is-unicode.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/is-unicode.js new file mode 100644 index 00000000..b005f6d9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/is-unicode.js @@ -0,0 +1,9 @@ +'use strict'; + +var validRegExp = require('../valid-reg-exp') + + , re = /\/[a-xz]*u[a-xz]*$/; + +module.exports = function () { + return Boolean(String(validRegExp(this)).match(re)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/implement.js new file mode 100644 index 00000000..921c9368 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'match', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/index.js new file mode 100644 index 00000000..0534ac3b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? RegExp.prototype.match + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/is-implemented.js new file mode 100644 index 00000000..b7e99643 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var re = /foo/; + +module.exports = function () { + if (typeof re.match !== 'function') return false; + return re.match('barfoobar') && !re.match('elo'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/shim.js new file mode 100644 index 00000000..4f99cf4d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/match/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var validRegExp = require('../../valid-reg-exp'); + +module.exports = function (string) { + validRegExp(this); + return String(string).match(this); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/implement.js new file mode 100644 index 00000000..ad580de8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'replace', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/index.js new file mode 100644 index 00000000..5658177d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? RegExp.prototype.replace + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/is-implemented.js new file mode 100644 index 00000000..1b42d252 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var re = /foo/; + +module.exports = function () { + if (typeof re.replace !== 'function') return false; + return re.replace('foobar', 'mar') === 'marbar'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/shim.js new file mode 100644 index 00000000..c3e6aeba --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/replace/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var validRegExp = require('../../valid-reg-exp'); + +module.exports = function (string, replaceValue) { + validRegExp(this); + return String(string).replace(this, replaceValue); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/implement.js new file mode 100644 index 00000000..3804f4eb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'search', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/index.js new file mode 100644 index 00000000..67995d4a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? RegExp.prototype.search + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/is-implemented.js new file mode 100644 index 00000000..efba889f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var re = /foo/; + +module.exports = function () { + if (typeof re.search !== 'function') return false; + return re.search('barfoo') === 3; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/shim.js new file mode 100644 index 00000000..6d9dcaed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/search/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var validRegExp = require('../../valid-reg-exp'); + +module.exports = function (string) { + validRegExp(this); + return String(string).search(this); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/implement.js new file mode 100644 index 00000000..50facb68 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'split', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/index.js new file mode 100644 index 00000000..f101f5af --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? RegExp.prototype.split + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/is-implemented.js new file mode 100644 index 00000000..7244c998 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var re = /\|/; + +module.exports = function () { + if (typeof re.split !== 'function') return false; + return re.split('bar|foo')[1] === 'foo'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/shim.js new file mode 100644 index 00000000..76154e7e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/split/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +var validRegExp = require('../../valid-reg-exp'); + +module.exports = function (string) { + validRegExp(this); + return String(string).split(this); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/sticky/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/sticky/implement.js new file mode 100644 index 00000000..7e8af1db --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/sticky/implement.js @@ -0,0 +1,8 @@ +'use strict'; + +var isSticky = require('../is-sticky'); + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'sticky', { configurable: true, + enumerable: false, get: isSticky }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/sticky/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/sticky/is-implemented.js new file mode 100644 index 00000000..379c4a5a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/sticky/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return RegExp.prototype.sticky === false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/unicode/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/unicode/implement.js new file mode 100644 index 00000000..5a82a4d1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/unicode/implement.js @@ -0,0 +1,8 @@ +'use strict'; + +var isUnicode = require('../is-unicode'); + +if (!require('./is-implemented')()) { + Object.defineProperty(RegExp.prototype, 'unicode', { configurable: true, + enumerable: false, get: isUnicode }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/unicode/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/unicode/is-implemented.js new file mode 100644 index 00000000..a8b15b3b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/#/unicode/is-implemented.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return RegExp.prototype.unicode === false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/escape.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/escape.js new file mode 100644 index 00000000..a2363fcf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/escape.js @@ -0,0 +1,9 @@ +// Thanks to Andrew Clover: +// http://stackoverflow.com/questions/3561493 +// /is-there-a-regexp-escape-function-in-javascript + +'use strict'; + +var re = /[\-\/\\\^$*+?.()|\[\]{}]/g; + +module.exports = function (str) { return String(str).replace(re, '\\$&'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/index.js new file mode 100644 index 00000000..75ea3135 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + escape: require('./escape'), + isRegExp: require('./is-reg-exp'), + validRegExp: require('./valid-reg-exp') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/is-reg-exp.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/is-reg-exp.js new file mode 100644 index 00000000..6eb12977 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/is-reg-exp.js @@ -0,0 +1,9 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(/a/); + +module.exports = function (x) { + return (x && (x instanceof RegExp || (toString.call(x) === id))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/valid-reg-exp.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/valid-reg-exp.js new file mode 100644 index 00000000..d3a77641 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/reg-exp/valid-reg-exp.js @@ -0,0 +1,8 @@ +'use strict'; + +var isRegExp = require('./is-reg-exp'); + +module.exports = function (x) { + if (!isRegExp(x)) throw new TypeError(x + " is not a RegExp object"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/implement.js new file mode 100644 index 00000000..4494d7b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, require('es6-symbol').iterator, + { value: require('./shim'), configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/index.js new file mode 100644 index 00000000..22f15e69 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/index.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype[require('es6-symbol').iterator] : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/is-implemented.js new file mode 100644 index 00000000..f5c462de --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/is-implemented.js @@ -0,0 +1,16 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function () { + var str = '🙈f', iterator, result; + if (typeof str[iteratorSymbol] !== 'function') return false; + iterator = str[iteratorSymbol](); + if (!iterator) return false; + if (typeof iterator.next !== 'function') return false; + result = iterator.next(); + if (!result) return false; + if (result.value !== '🙈') return false; + if (result.done !== false) return false; + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/shim.js new file mode 100644 index 00000000..0be30292 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/@@iterator/shim.js @@ -0,0 +1,6 @@ +'use strict'; + +var StringIterator = require('es6-iterator/string') + , value = require('../../../object/valid-value'); + +module.exports = function () { return new StringIterator(value(this)); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/at.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/at.js new file mode 100644 index 00000000..77bd251a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/at.js @@ -0,0 +1,33 @@ +// Based on: https://github.com/mathiasbynens/String.prototype.at +// Thanks @mathiasbynens ! + +'use strict'; + +var toInteger = require('../../number/to-integer') + , validValue = require('../../object/valid-value'); + +module.exports = function (pos) { + var str = String(validValue(this)), size = str.length + , cuFirst, cuSecond, nextPos, len; + pos = toInteger(pos); + + // Account for out-of-bounds indices + // The odd lower bound is because the ToInteger operation is + // going to round `n` to `0` for `-1 < n <= 0`. + if (pos <= -1 || pos >= size) return ''; + + // Second half of `ToInteger` + pos = pos | 0; + // Get the first code unit and code unit value + cuFirst = str.charCodeAt(pos); + nextPos = pos + 1; + len = 1; + if ( // check if it’s the start of a surrogate pair + (cuFirst >= 0xD800) && (cuFirst <= 0xDBFF) && // high surrogate + (size > nextPos) // there is a next code unit + ) { + cuSecond = str.charCodeAt(nextPos); + if (cuSecond >= 0xDC00 && cuSecond <= 0xDFFF) len = 2; // low surrogate + } + return str.slice(pos, pos + len); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/camel-to-hyphen.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/camel-to-hyphen.js new file mode 100644 index 00000000..1cb8d127 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/camel-to-hyphen.js @@ -0,0 +1,10 @@ +'use strict'; + +var replace = String.prototype.replace + , re = /([A-Z])/g; + +module.exports = function () { + var str = replace.call(this, re, "-$1").toLowerCase(); + if (str[0] === '-') str = str.slice(1); + return str; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/capitalize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/capitalize.js new file mode 100644 index 00000000..ed768273 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/capitalize.js @@ -0,0 +1,8 @@ +'use strict'; + +var value = require('../../object/valid-value'); + +module.exports = function () { + var str = String(value(this)); + return str.charAt(0).toUpperCase() + str.slice(1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/case-insensitive-compare.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/case-insensitive-compare.js new file mode 100644 index 00000000..599cb834 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/case-insensitive-compare.js @@ -0,0 +1,7 @@ +'use strict'; + +var toLowerCase = String.prototype.toLowerCase; + +module.exports = function (other) { + return toLowerCase.call(this).localeCompare(toLowerCase.call(String(other))); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/implement.js new file mode 100644 index 00000000..1e7a37bd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'codePointAt', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/index.js new file mode 100644 index 00000000..7e91d833 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.codePointAt + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/is-implemented.js new file mode 100644 index 00000000..b2715891 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'abc\uD834\uDF06def'; + +module.exports = function () { + if (typeof str.codePointAt !== 'function') return false; + return str.codePointAt(3) === 0x1D306; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/shim.js new file mode 100644 index 00000000..1c9038b3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/code-point-at/shim.js @@ -0,0 +1,26 @@ +// Based on: https://github.com/mathiasbynens/String.prototype.codePointAt +// Thanks @mathiasbynens ! + +'use strict'; + +var toInteger = require('../../../number/to-integer') + , validValue = require('../../../object/valid-value'); + +module.exports = function (pos) { + var str = String(validValue(this)), l = str.length, first, second; + pos = toInteger(pos); + + // Account for out-of-bounds indices: + if (pos < 0 || pos >= l) return undefined; + + // Get the first code unit + first = str.charCodeAt(pos); + if ((first >= 0xD800) && (first <= 0xDBFF) && (l > pos + 1)) { + second = str.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/implement.js new file mode 100644 index 00000000..6b7a3c08 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'contains', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/index.js new file mode 100644 index 00000000..abb3e373 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.contains + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/is-implemented.js new file mode 100644 index 00000000..6f7d4b71 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'razdwatrzy'; + +module.exports = function () { + if (typeof str.contains !== 'function') return false; + return ((str.contains('dwa') === true) && (str.contains('foo') === false)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/shim.js new file mode 100644 index 00000000..89e39e79 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/contains/shim.js @@ -0,0 +1,7 @@ +'use strict'; + +var indexOf = String.prototype.indexOf; + +module.exports = function (searchString/*, position*/) { + return indexOf.call(this, searchString, arguments[1]) > -1; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/implement.js new file mode 100644 index 00000000..0b09025b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'endsWith', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/index.js new file mode 100644 index 00000000..d2d94848 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.endsWith + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/is-implemented.js new file mode 100644 index 00000000..f3bb0088 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'razdwatrzy'; + +module.exports = function () { + if (typeof str.endsWith !== 'function') return false; + return ((str.endsWith('trzy') === true) && (str.endsWith('raz') === false)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/shim.js new file mode 100644 index 00000000..26cbdb13 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/ends-with/shim.js @@ -0,0 +1,16 @@ +'use strict'; + +var toInteger = require('../../../number/to-integer') + , value = require('../../../object/valid-value') + + , min = Math.min, max = Math.max; + +module.exports = function (searchString/*, endPosition*/) { + var self, start, endPos; + self = String(value(this)); + searchString = String(searchString); + endPos = arguments[1]; + start = ((endPos == null) ? self.length : + min(max(toInteger(endPos), 0), self.length)) - searchString.length; + return (start < 0) ? false : (self.indexOf(searchString, start) === start); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/hyphen-to-camel.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/hyphen-to-camel.js new file mode 100644 index 00000000..8928b024 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/hyphen-to-camel.js @@ -0,0 +1,8 @@ +'use strict'; + +var replace = String.prototype.replace + + , re = /-([a-z0-9])/g + , toUpperCase = function (m, a) { return a.toUpperCase(); }; + +module.exports = function () { return replace.call(this, re, toUpperCase); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/indent.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/indent.js new file mode 100644 index 00000000..223bd82b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/indent.js @@ -0,0 +1,12 @@ +'use strict'; + +var repeat = require('./repeat') + + , replace = String.prototype.replace + , re = /(\r\n|[\n\r\u2028\u2029])([\u0000-\u0009\u000b-\uffff]+)/g; + +module.exports = function (indent/*, count*/) { + var count = arguments[1]; + indent = repeat.call(String(indent), (count == null) ? 1 : count); + return indent + replace.call(this, re, '$1' + indent + '$2'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/index.js new file mode 100644 index 00000000..d45d747c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/index.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = { + '@@iterator': require('./@@iterator'), + at: require('./at'), + camelToHyphen: require('./camel-to-hyphen'), + capitalize: require('./capitalize'), + caseInsensitiveCompare: require('./case-insensitive-compare'), + codePointAt: require('./code-point-at'), + contains: require('./contains'), + hyphenToCamel: require('./hyphen-to-camel'), + endsWith: require('./ends-with'), + indent: require('./indent'), + last: require('./last'), + normalize: require('./normalize'), + pad: require('./pad'), + plainReplace: require('./plain-replace'), + plainReplaceAll: require('./plain-replace-all'), + repeat: require('./repeat'), + startsWith: require('./starts-with') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/last.js new file mode 100644 index 00000000..d5cf46ee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/last.js @@ -0,0 +1,8 @@ +'use strict'; + +var value = require('../../object/valid-value'); + +module.exports = function () { + var self = String(value(this)), l = self.length; + return l ? self[l - 1] : null; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/_data.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/_data.js new file mode 100644 index 00000000..e4e00a32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/_data.js @@ -0,0 +1,69 @@ +'use strict'; + +module.exports = { 0:{60:[,,{824:8814}],61:[,,{824:8800}],62:[,,{824:8815}],65:[,,{768:192,769:193,770:194,771:195,772:256,774:258,775:550,776:196,777:7842,778:197,780:461,783:512,785:514,803:7840,805:7680,808:260}],66:[,,{775:7682,803:7684,817:7686}],67:[,,{769:262,770:264,775:266,780:268,807:199}],68:[,,{775:7690,780:270,803:7692,807:7696,813:7698,817:7694}],69:[,,{768:200,769:201,770:202,771:7868,772:274,774:276,775:278,776:203,777:7866,780:282,783:516,785:518,803:7864,807:552,808:280,813:7704,816:7706}],70:[,,{775:7710}],71:[,,{769:500,770:284,772:7712,774:286,775:288,780:486,807:290}],72:[,,{770:292,775:7714,776:7718,780:542,803:7716,807:7720,814:7722}],73:[,,{768:204,769:205,770:206,771:296,772:298,774:300,775:304,776:207,777:7880,780:463,783:520,785:522,803:7882,808:302,816:7724}],74:[,,{770:308}],75:[,,{769:7728,780:488,803:7730,807:310,817:7732}],76:[,,{769:313,780:317,803:7734,807:315,813:7740,817:7738}],77:[,,{769:7742,775:7744,803:7746}],78:[,,{768:504,769:323,771:209,775:7748,780:327,803:7750,807:325,813:7754,817:7752}],79:[,,{768:210,769:211,770:212,771:213,772:332,774:334,775:558,776:214,777:7886,779:336,780:465,783:524,785:526,795:416,803:7884,808:490}],80:[,,{769:7764,775:7766}],82:[,,{769:340,775:7768,780:344,783:528,785:530,803:7770,807:342,817:7774}],83:[,,{769:346,770:348,775:7776,780:352,803:7778,806:536,807:350}],84:[,,{775:7786,780:356,803:7788,806:538,807:354,813:7792,817:7790}],85:[,,{768:217,769:218,770:219,771:360,772:362,774:364,776:220,777:7910,778:366,779:368,780:467,783:532,785:534,795:431,803:7908,804:7794,808:370,813:7798,816:7796}],86:[,,{771:7804,803:7806}],87:[,,{768:7808,769:7810,770:372,775:7814,776:7812,803:7816}],88:[,,{775:7818,776:7820}],89:[,,{768:7922,769:221,770:374,771:7928,772:562,775:7822,776:376,777:7926,803:7924}],90:[,,{769:377,770:7824,775:379,780:381,803:7826,817:7828}],97:[,,{768:224,769:225,770:226,771:227,772:257,774:259,775:551,776:228,777:7843,778:229,780:462,783:513,785:515,803:7841,805:7681,808:261}],98:[,,{775:7683,803:7685,817:7687}],99:[,,{769:263,770:265,775:267,780:269,807:231}],100:[,,{775:7691,780:271,803:7693,807:7697,813:7699,817:7695}],101:[,,{768:232,769:233,770:234,771:7869,772:275,774:277,775:279,776:235,777:7867,780:283,783:517,785:519,803:7865,807:553,808:281,813:7705,816:7707}],102:[,,{775:7711}],103:[,,{769:501,770:285,772:7713,774:287,775:289,780:487,807:291}],104:[,,{770:293,775:7715,776:7719,780:543,803:7717,807:7721,814:7723,817:7830}],105:[,,{768:236,769:237,770:238,771:297,772:299,774:301,776:239,777:7881,780:464,783:521,785:523,803:7883,808:303,816:7725}],106:[,,{770:309,780:496}],107:[,,{769:7729,780:489,803:7731,807:311,817:7733}],108:[,,{769:314,780:318,803:7735,807:316,813:7741,817:7739}],109:[,,{769:7743,775:7745,803:7747}],110:[,,{768:505,769:324,771:241,775:7749,780:328,803:7751,807:326,813:7755,817:7753}],111:[,,{768:242,769:243,770:244,771:245,772:333,774:335,775:559,776:246,777:7887,779:337,780:466,783:525,785:527,795:417,803:7885,808:491}],112:[,,{769:7765,775:7767}],114:[,,{769:341,775:7769,780:345,783:529,785:531,803:7771,807:343,817:7775}],115:[,,{769:347,770:349,775:7777,780:353,803:7779,806:537,807:351}],116:[,,{775:7787,776:7831,780:357,803:7789,806:539,807:355,813:7793,817:7791}],117:[,,{768:249,769:250,770:251,771:361,772:363,774:365,776:252,777:7911,778:367,779:369,780:468,783:533,785:535,795:432,803:7909,804:7795,808:371,813:7799,816:7797}],118:[,,{771:7805,803:7807}],119:[,,{768:7809,769:7811,770:373,775:7815,776:7813,778:7832,803:7817}],120:[,,{775:7819,776:7821}],121:[,,{768:7923,769:253,770:375,771:7929,772:563,775:7823,776:255,777:7927,778:7833,803:7925}],122:[,,{769:378,770:7825,775:380,780:382,803:7827,817:7829}],160:[[32],256],168:[[32,776],256,{768:8173,769:901,834:8129}],170:[[97],256],175:[[32,772],256],178:[[50],256],179:[[51],256],180:[[32,769],256],181:[[956],256],184:[[32,807],256],185:[[49],256],186:[[111],256],188:[[49,8260,52],256],189:[[49,8260,50],256],190:[[51,8260,52],256],192:[[65,768]],193:[[65,769]],194:[[65,770],,{768:7846,769:7844,771:7850,777:7848}],195:[[65,771]],196:[[65,776],,{772:478}],197:[[65,778],,{769:506}],198:[,,{769:508,772:482}],199:[[67,807],,{769:7688}],200:[[69,768]],201:[[69,769]],202:[[69,770],,{768:7872,769:7870,771:7876,777:7874}],203:[[69,776]],204:[[73,768]],205:[[73,769]],206:[[73,770]],207:[[73,776],,{769:7726}],209:[[78,771]],210:[[79,768]],211:[[79,769]],212:[[79,770],,{768:7890,769:7888,771:7894,777:7892}],213:[[79,771],,{769:7756,772:556,776:7758}],214:[[79,776],,{772:554}],216:[,,{769:510}],217:[[85,768]],218:[[85,769]],219:[[85,770]],220:[[85,776],,{768:475,769:471,772:469,780:473}],221:[[89,769]],224:[[97,768]],225:[[97,769]],226:[[97,770],,{768:7847,769:7845,771:7851,777:7849}],227:[[97,771]],228:[[97,776],,{772:479}],229:[[97,778],,{769:507}],230:[,,{769:509,772:483}],231:[[99,807],,{769:7689}],232:[[101,768]],233:[[101,769]],234:[[101,770],,{768:7873,769:7871,771:7877,777:7875}],235:[[101,776]],236:[[105,768]],237:[[105,769]],238:[[105,770]],239:[[105,776],,{769:7727}],241:[[110,771]],242:[[111,768]],243:[[111,769]],244:[[111,770],,{768:7891,769:7889,771:7895,777:7893}],245:[[111,771],,{769:7757,772:557,776:7759}],246:[[111,776],,{772:555}],248:[,,{769:511}],249:[[117,768]],250:[[117,769]],251:[[117,770]],252:[[117,776],,{768:476,769:472,772:470,780:474}],253:[[121,769]],255:[[121,776]]}, + 256:{256:[[65,772]],257:[[97,772]],258:[[65,774],,{768:7856,769:7854,771:7860,777:7858}],259:[[97,774],,{768:7857,769:7855,771:7861,777:7859}],260:[[65,808]],261:[[97,808]],262:[[67,769]],263:[[99,769]],264:[[67,770]],265:[[99,770]],266:[[67,775]],267:[[99,775]],268:[[67,780]],269:[[99,780]],270:[[68,780]],271:[[100,780]],274:[[69,772],,{768:7700,769:7702}],275:[[101,772],,{768:7701,769:7703}],276:[[69,774]],277:[[101,774]],278:[[69,775]],279:[[101,775]],280:[[69,808]],281:[[101,808]],282:[[69,780]],283:[[101,780]],284:[[71,770]],285:[[103,770]],286:[[71,774]],287:[[103,774]],288:[[71,775]],289:[[103,775]],290:[[71,807]],291:[[103,807]],292:[[72,770]],293:[[104,770]],296:[[73,771]],297:[[105,771]],298:[[73,772]],299:[[105,772]],300:[[73,774]],301:[[105,774]],302:[[73,808]],303:[[105,808]],304:[[73,775]],306:[[73,74],256],307:[[105,106],256],308:[[74,770]],309:[[106,770]],310:[[75,807]],311:[[107,807]],313:[[76,769]],314:[[108,769]],315:[[76,807]],316:[[108,807]],317:[[76,780]],318:[[108,780]],319:[[76,183],256],320:[[108,183],256],323:[[78,769]],324:[[110,769]],325:[[78,807]],326:[[110,807]],327:[[78,780]],328:[[110,780]],329:[[700,110],256],332:[[79,772],,{768:7760,769:7762}],333:[[111,772],,{768:7761,769:7763}],334:[[79,774]],335:[[111,774]],336:[[79,779]],337:[[111,779]],340:[[82,769]],341:[[114,769]],342:[[82,807]],343:[[114,807]],344:[[82,780]],345:[[114,780]],346:[[83,769],,{775:7780}],347:[[115,769],,{775:7781}],348:[[83,770]],349:[[115,770]],350:[[83,807]],351:[[115,807]],352:[[83,780],,{775:7782}],353:[[115,780],,{775:7783}],354:[[84,807]],355:[[116,807]],356:[[84,780]],357:[[116,780]],360:[[85,771],,{769:7800}],361:[[117,771],,{769:7801}],362:[[85,772],,{776:7802}],363:[[117,772],,{776:7803}],364:[[85,774]],365:[[117,774]],366:[[85,778]],367:[[117,778]],368:[[85,779]],369:[[117,779]],370:[[85,808]],371:[[117,808]],372:[[87,770]],373:[[119,770]],374:[[89,770]],375:[[121,770]],376:[[89,776]],377:[[90,769]],378:[[122,769]],379:[[90,775]],380:[[122,775]],381:[[90,780]],382:[[122,780]],383:[[115],256,{775:7835}],416:[[79,795],,{768:7900,769:7898,771:7904,777:7902,803:7906}],417:[[111,795],,{768:7901,769:7899,771:7905,777:7903,803:7907}],431:[[85,795],,{768:7914,769:7912,771:7918,777:7916,803:7920}],432:[[117,795],,{768:7915,769:7913,771:7919,777:7917,803:7921}],439:[,,{780:494}],452:[[68,381],256],453:[[68,382],256],454:[[100,382],256],455:[[76,74],256],456:[[76,106],256],457:[[108,106],256],458:[[78,74],256],459:[[78,106],256],460:[[110,106],256],461:[[65,780]],462:[[97,780]],463:[[73,780]],464:[[105,780]],465:[[79,780]],466:[[111,780]],467:[[85,780]],468:[[117,780]],469:[[220,772]],470:[[252,772]],471:[[220,769]],472:[[252,769]],473:[[220,780]],474:[[252,780]],475:[[220,768]],476:[[252,768]],478:[[196,772]],479:[[228,772]],480:[[550,772]],481:[[551,772]],482:[[198,772]],483:[[230,772]],486:[[71,780]],487:[[103,780]],488:[[75,780]],489:[[107,780]],490:[[79,808],,{772:492}],491:[[111,808],,{772:493}],492:[[490,772]],493:[[491,772]],494:[[439,780]],495:[[658,780]],496:[[106,780]],497:[[68,90],256],498:[[68,122],256],499:[[100,122],256],500:[[71,769]],501:[[103,769]],504:[[78,768]],505:[[110,768]],506:[[197,769]],507:[[229,769]],508:[[198,769]],509:[[230,769]],510:[[216,769]],511:[[248,769]],66045:[,220]}, + 512:{512:[[65,783]],513:[[97,783]],514:[[65,785]],515:[[97,785]],516:[[69,783]],517:[[101,783]],518:[[69,785]],519:[[101,785]],520:[[73,783]],521:[[105,783]],522:[[73,785]],523:[[105,785]],524:[[79,783]],525:[[111,783]],526:[[79,785]],527:[[111,785]],528:[[82,783]],529:[[114,783]],530:[[82,785]],531:[[114,785]],532:[[85,783]],533:[[117,783]],534:[[85,785]],535:[[117,785]],536:[[83,806]],537:[[115,806]],538:[[84,806]],539:[[116,806]],542:[[72,780]],543:[[104,780]],550:[[65,775],,{772:480}],551:[[97,775],,{772:481}],552:[[69,807],,{774:7708}],553:[[101,807],,{774:7709}],554:[[214,772]],555:[[246,772]],556:[[213,772]],557:[[245,772]],558:[[79,775],,{772:560}],559:[[111,775],,{772:561}],560:[[558,772]],561:[[559,772]],562:[[89,772]],563:[[121,772]],658:[,,{780:495}],688:[[104],256],689:[[614],256],690:[[106],256],691:[[114],256],692:[[633],256],693:[[635],256],694:[[641],256],695:[[119],256],696:[[121],256],728:[[32,774],256],729:[[32,775],256],730:[[32,778],256],731:[[32,808],256],732:[[32,771],256],733:[[32,779],256],736:[[611],256],737:[[108],256],738:[[115],256],739:[[120],256],740:[[661],256]}, + 768:{768:[,230],769:[,230],770:[,230],771:[,230],772:[,230],773:[,230],774:[,230],775:[,230],776:[,230,{769:836}],777:[,230],778:[,230],779:[,230],780:[,230],781:[,230],782:[,230],783:[,230],784:[,230],785:[,230],786:[,230],787:[,230],788:[,230],789:[,232],790:[,220],791:[,220],792:[,220],793:[,220],794:[,232],795:[,216],796:[,220],797:[,220],798:[,220],799:[,220],800:[,220],801:[,202],802:[,202],803:[,220],804:[,220],805:[,220],806:[,220],807:[,202],808:[,202],809:[,220],810:[,220],811:[,220],812:[,220],813:[,220],814:[,220],815:[,220],816:[,220],817:[,220],818:[,220],819:[,220],820:[,1],821:[,1],822:[,1],823:[,1],824:[,1],825:[,220],826:[,220],827:[,220],828:[,220],829:[,230],830:[,230],831:[,230],832:[[768],230],833:[[769],230],834:[,230],835:[[787],230],836:[[776,769],230],837:[,240],838:[,230],839:[,220],840:[,220],841:[,220],842:[,230],843:[,230],844:[,230],845:[,220],846:[,220],848:[,230],849:[,230],850:[,230],851:[,220],852:[,220],853:[,220],854:[,220],855:[,230],856:[,232],857:[,220],858:[,220],859:[,230],860:[,233],861:[,234],862:[,234],863:[,233],864:[,234],865:[,234],866:[,233],867:[,230],868:[,230],869:[,230],870:[,230],871:[,230],872:[,230],873:[,230],874:[,230],875:[,230],876:[,230],877:[,230],878:[,230],879:[,230],884:[[697]],890:[[32,837],256],894:[[59]],900:[[32,769],256],901:[[168,769]],902:[[913,769]],903:[[183]],904:[[917,769]],905:[[919,769]],906:[[921,769]],908:[[927,769]],910:[[933,769]],911:[[937,769]],912:[[970,769]],913:[,,{768:8122,769:902,772:8121,774:8120,787:7944,788:7945,837:8124}],917:[,,{768:8136,769:904,787:7960,788:7961}],919:[,,{768:8138,769:905,787:7976,788:7977,837:8140}],921:[,,{768:8154,769:906,772:8153,774:8152,776:938,787:7992,788:7993}],927:[,,{768:8184,769:908,787:8008,788:8009}],929:[,,{788:8172}],933:[,,{768:8170,769:910,772:8169,774:8168,776:939,788:8025}],937:[,,{768:8186,769:911,787:8040,788:8041,837:8188}],938:[[921,776]],939:[[933,776]],940:[[945,769],,{837:8116}],941:[[949,769]],942:[[951,769],,{837:8132}],943:[[953,769]],944:[[971,769]],945:[,,{768:8048,769:940,772:8113,774:8112,787:7936,788:7937,834:8118,837:8115}],949:[,,{768:8050,769:941,787:7952,788:7953}],951:[,,{768:8052,769:942,787:7968,788:7969,834:8134,837:8131}],953:[,,{768:8054,769:943,772:8145,774:8144,776:970,787:7984,788:7985,834:8150}],959:[,,{768:8056,769:972,787:8000,788:8001}],961:[,,{787:8164,788:8165}],965:[,,{768:8058,769:973,772:8161,774:8160,776:971,787:8016,788:8017,834:8166}],969:[,,{768:8060,769:974,787:8032,788:8033,834:8182,837:8179}],970:[[953,776],,{768:8146,769:912,834:8151}],971:[[965,776],,{768:8162,769:944,834:8167}],972:[[959,769]],973:[[965,769]],974:[[969,769],,{837:8180}],976:[[946],256],977:[[952],256],978:[[933],256,{769:979,776:980}],979:[[978,769]],980:[[978,776]],981:[[966],256],982:[[960],256],1008:[[954],256],1009:[[961],256],1010:[[962],256],1012:[[920],256],1013:[[949],256],1017:[[931],256]}, + 1024:{1024:[[1045,768]],1025:[[1045,776]],1027:[[1043,769]],1030:[,,{776:1031}],1031:[[1030,776]],1036:[[1050,769]],1037:[[1048,768]],1038:[[1059,774]],1040:[,,{774:1232,776:1234}],1043:[,,{769:1027}],1045:[,,{768:1024,774:1238,776:1025}],1046:[,,{774:1217,776:1244}],1047:[,,{776:1246}],1048:[,,{768:1037,772:1250,774:1049,776:1252}],1049:[[1048,774]],1050:[,,{769:1036}],1054:[,,{776:1254}],1059:[,,{772:1262,774:1038,776:1264,779:1266}],1063:[,,{776:1268}],1067:[,,{776:1272}],1069:[,,{776:1260}],1072:[,,{774:1233,776:1235}],1075:[,,{769:1107}],1077:[,,{768:1104,774:1239,776:1105}],1078:[,,{774:1218,776:1245}],1079:[,,{776:1247}],1080:[,,{768:1117,772:1251,774:1081,776:1253}],1081:[[1080,774]],1082:[,,{769:1116}],1086:[,,{776:1255}],1091:[,,{772:1263,774:1118,776:1265,779:1267}],1095:[,,{776:1269}],1099:[,,{776:1273}],1101:[,,{776:1261}],1104:[[1077,768]],1105:[[1077,776]],1107:[[1075,769]],1110:[,,{776:1111}],1111:[[1110,776]],1116:[[1082,769]],1117:[[1080,768]],1118:[[1091,774]],1140:[,,{783:1142}],1141:[,,{783:1143}],1142:[[1140,783]],1143:[[1141,783]],1155:[,230],1156:[,230],1157:[,230],1158:[,230],1159:[,230],1217:[[1046,774]],1218:[[1078,774]],1232:[[1040,774]],1233:[[1072,774]],1234:[[1040,776]],1235:[[1072,776]],1238:[[1045,774]],1239:[[1077,774]],1240:[,,{776:1242}],1241:[,,{776:1243}],1242:[[1240,776]],1243:[[1241,776]],1244:[[1046,776]],1245:[[1078,776]],1246:[[1047,776]],1247:[[1079,776]],1250:[[1048,772]],1251:[[1080,772]],1252:[[1048,776]],1253:[[1080,776]],1254:[[1054,776]],1255:[[1086,776]],1256:[,,{776:1258}],1257:[,,{776:1259}],1258:[[1256,776]],1259:[[1257,776]],1260:[[1069,776]],1261:[[1101,776]],1262:[[1059,772]],1263:[[1091,772]],1264:[[1059,776]],1265:[[1091,776]],1266:[[1059,779]],1267:[[1091,779]],1268:[[1063,776]],1269:[[1095,776]],1272:[[1067,776]],1273:[[1099,776]]}, + 1280:{1415:[[1381,1410],256],1425:[,220],1426:[,230],1427:[,230],1428:[,230],1429:[,230],1430:[,220],1431:[,230],1432:[,230],1433:[,230],1434:[,222],1435:[,220],1436:[,230],1437:[,230],1438:[,230],1439:[,230],1440:[,230],1441:[,230],1442:[,220],1443:[,220],1444:[,220],1445:[,220],1446:[,220],1447:[,220],1448:[,230],1449:[,230],1450:[,220],1451:[,230],1452:[,230],1453:[,222],1454:[,228],1455:[,230],1456:[,10],1457:[,11],1458:[,12],1459:[,13],1460:[,14],1461:[,15],1462:[,16],1463:[,17],1464:[,18],1465:[,19],1466:[,19],1467:[,20],1468:[,21],1469:[,22],1471:[,23],1473:[,24],1474:[,25],1476:[,230],1477:[,220],1479:[,18]}, + 1536:{1552:[,230],1553:[,230],1554:[,230],1555:[,230],1556:[,230],1557:[,230],1558:[,230],1559:[,230],1560:[,30],1561:[,31],1562:[,32],1570:[[1575,1619]],1571:[[1575,1620]],1572:[[1608,1620]],1573:[[1575,1621]],1574:[[1610,1620]],1575:[,,{1619:1570,1620:1571,1621:1573}],1608:[,,{1620:1572}],1610:[,,{1620:1574}],1611:[,27],1612:[,28],1613:[,29],1614:[,30],1615:[,31],1616:[,32],1617:[,33],1618:[,34],1619:[,230],1620:[,230],1621:[,220],1622:[,220],1623:[,230],1624:[,230],1625:[,230],1626:[,230],1627:[,230],1628:[,220],1629:[,230],1630:[,230],1631:[,220],1648:[,35],1653:[[1575,1652],256],1654:[[1608,1652],256],1655:[[1735,1652],256],1656:[[1610,1652],256],1728:[[1749,1620]],1729:[,,{1620:1730}],1730:[[1729,1620]],1746:[,,{1620:1747}],1747:[[1746,1620]],1749:[,,{1620:1728}],1750:[,230],1751:[,230],1752:[,230],1753:[,230],1754:[,230],1755:[,230],1756:[,230],1759:[,230],1760:[,230],1761:[,230],1762:[,230],1763:[,220],1764:[,230],1767:[,230],1768:[,230],1770:[,220],1771:[,230],1772:[,230],1773:[,220]}, + 1792:{1809:[,36],1840:[,230],1841:[,220],1842:[,230],1843:[,230],1844:[,220],1845:[,230],1846:[,230],1847:[,220],1848:[,220],1849:[,220],1850:[,230],1851:[,220],1852:[,220],1853:[,230],1854:[,220],1855:[,230],1856:[,230],1857:[,230],1858:[,220],1859:[,230],1860:[,220],1861:[,230],1862:[,220],1863:[,230],1864:[,220],1865:[,230],1866:[,230],2027:[,230],2028:[,230],2029:[,230],2030:[,230],2031:[,230],2032:[,230],2033:[,230],2034:[,220],2035:[,230]}, + 2048:{2070:[,230],2071:[,230],2072:[,230],2073:[,230],2075:[,230],2076:[,230],2077:[,230],2078:[,230],2079:[,230],2080:[,230],2081:[,230],2082:[,230],2083:[,230],2085:[,230],2086:[,230],2087:[,230],2089:[,230],2090:[,230],2091:[,230],2092:[,230],2093:[,230],2137:[,220],2138:[,220],2139:[,220],2276:[,230],2277:[,230],2278:[,220],2279:[,230],2280:[,230],2281:[,220],2282:[,230],2283:[,230],2284:[,230],2285:[,220],2286:[,220],2287:[,220],2288:[,27],2289:[,28],2290:[,29],2291:[,230],2292:[,230],2293:[,230],2294:[,220],2295:[,230],2296:[,230],2297:[,220],2298:[,220],2299:[,230],2300:[,230],2301:[,230],2302:[,230]}, + 2304:{2344:[,,{2364:2345}],2345:[[2344,2364]],2352:[,,{2364:2353}],2353:[[2352,2364]],2355:[,,{2364:2356}],2356:[[2355,2364]],2364:[,7],2381:[,9],2385:[,230],2386:[,220],2387:[,230],2388:[,230],2392:[[2325,2364],512],2393:[[2326,2364],512],2394:[[2327,2364],512],2395:[[2332,2364],512],2396:[[2337,2364],512],2397:[[2338,2364],512],2398:[[2347,2364],512],2399:[[2351,2364],512],2492:[,7],2503:[,,{2494:2507,2519:2508}],2507:[[2503,2494]],2508:[[2503,2519]],2509:[,9],2524:[[2465,2492],512],2525:[[2466,2492],512],2527:[[2479,2492],512]}, + 2560:{2611:[[2610,2620],512],2614:[[2616,2620],512],2620:[,7],2637:[,9],2649:[[2582,2620],512],2650:[[2583,2620],512],2651:[[2588,2620],512],2654:[[2603,2620],512],2748:[,7],2765:[,9],68109:[,220],68111:[,230],68152:[,230],68153:[,1],68154:[,220],68159:[,9]}, + 2816:{2876:[,7],2887:[,,{2878:2891,2902:2888,2903:2892}],2888:[[2887,2902]],2891:[[2887,2878]],2892:[[2887,2903]],2893:[,9],2908:[[2849,2876],512],2909:[[2850,2876],512],2962:[,,{3031:2964}],2964:[[2962,3031]],3014:[,,{3006:3018,3031:3020}],3015:[,,{3006:3019}],3018:[[3014,3006]],3019:[[3015,3006]],3020:[[3014,3031]],3021:[,9]}, + 3072:{3142:[,,{3158:3144}],3144:[[3142,3158]],3149:[,9],3157:[,84],3158:[,91],3260:[,7],3263:[,,{3285:3264}],3264:[[3263,3285]],3270:[,,{3266:3274,3285:3271,3286:3272}],3271:[[3270,3285]],3272:[[3270,3286]],3274:[[3270,3266],,{3285:3275}],3275:[[3274,3285]],3277:[,9]}, + 3328:{3398:[,,{3390:3402,3415:3404}],3399:[,,{3390:3403}],3402:[[3398,3390]],3403:[[3399,3390]],3404:[[3398,3415]],3405:[,9],3530:[,9],3545:[,,{3530:3546,3535:3548,3551:3550}],3546:[[3545,3530]],3548:[[3545,3535],,{3530:3549}],3549:[[3548,3530]],3550:[[3545,3551]]}, + 3584:{3635:[[3661,3634],256],3640:[,103],3641:[,103],3642:[,9],3656:[,107],3657:[,107],3658:[,107],3659:[,107],3763:[[3789,3762],256],3768:[,118],3769:[,118],3784:[,122],3785:[,122],3786:[,122],3787:[,122],3804:[[3755,3737],256],3805:[[3755,3745],256]}, + 3840:{3852:[[3851],256],3864:[,220],3865:[,220],3893:[,220],3895:[,220],3897:[,216],3907:[[3906,4023],512],3917:[[3916,4023],512],3922:[[3921,4023],512],3927:[[3926,4023],512],3932:[[3931,4023],512],3945:[[3904,4021],512],3953:[,129],3954:[,130],3955:[[3953,3954],512],3956:[,132],3957:[[3953,3956],512],3958:[[4018,3968],512],3959:[[4018,3969],256],3960:[[4019,3968],512],3961:[[4019,3969],256],3962:[,130],3963:[,130],3964:[,130],3965:[,130],3968:[,130],3969:[[3953,3968],512],3970:[,230],3971:[,230],3972:[,9],3974:[,230],3975:[,230],3987:[[3986,4023],512],3997:[[3996,4023],512],4002:[[4001,4023],512],4007:[[4006,4023],512],4012:[[4011,4023],512],4025:[[3984,4021],512],4038:[,220]}, + 4096:{4133:[,,{4142:4134}],4134:[[4133,4142]],4151:[,7],4153:[,9],4154:[,9],4237:[,220],4348:[[4316],256],69702:[,9],69785:[,,{69818:69786}],69786:[[69785,69818]],69787:[,,{69818:69788}],69788:[[69787,69818]],69797:[,,{69818:69803}],69803:[[69797,69818]],69817:[,9],69818:[,7]}, + 4352:{69888:[,230],69889:[,230],69890:[,230],69934:[[69937,69927]],69935:[[69938,69927]],69937:[,,{69927:69934}],69938:[,,{69927:69935}],69939:[,9],69940:[,9],70080:[,9]}, + 4864:{4957:[,230],4958:[,230],4959:[,230]}, + 5632:{71350:[,9],71351:[,7]}, + 5888:{5908:[,9],5940:[,9],6098:[,9],6109:[,230]}, + 6144:{6313:[,228]}, + 6400:{6457:[,222],6458:[,230],6459:[,220]}, + 6656:{6679:[,230],6680:[,220],6752:[,9],6773:[,230],6774:[,230],6775:[,230],6776:[,230],6777:[,230],6778:[,230],6779:[,230],6780:[,230],6783:[,220]}, + 6912:{6917:[,,{6965:6918}],6918:[[6917,6965]],6919:[,,{6965:6920}],6920:[[6919,6965]],6921:[,,{6965:6922}],6922:[[6921,6965]],6923:[,,{6965:6924}],6924:[[6923,6965]],6925:[,,{6965:6926}],6926:[[6925,6965]],6929:[,,{6965:6930}],6930:[[6929,6965]],6964:[,7],6970:[,,{6965:6971}],6971:[[6970,6965]],6972:[,,{6965:6973}],6973:[[6972,6965]],6974:[,,{6965:6976}],6975:[,,{6965:6977}],6976:[[6974,6965]],6977:[[6975,6965]],6978:[,,{6965:6979}],6979:[[6978,6965]],6980:[,9],7019:[,230],7020:[,220],7021:[,230],7022:[,230],7023:[,230],7024:[,230],7025:[,230],7026:[,230],7027:[,230],7082:[,9],7083:[,9],7142:[,7],7154:[,9],7155:[,9]}, + 7168:{7223:[,7],7376:[,230],7377:[,230],7378:[,230],7380:[,1],7381:[,220],7382:[,220],7383:[,220],7384:[,220],7385:[,220],7386:[,230],7387:[,230],7388:[,220],7389:[,220],7390:[,220],7391:[,220],7392:[,230],7394:[,1],7395:[,1],7396:[,1],7397:[,1],7398:[,1],7399:[,1],7400:[,1],7405:[,220],7412:[,230]}, + 7424:{7468:[[65],256],7469:[[198],256],7470:[[66],256],7472:[[68],256],7473:[[69],256],7474:[[398],256],7475:[[71],256],7476:[[72],256],7477:[[73],256],7478:[[74],256],7479:[[75],256],7480:[[76],256],7481:[[77],256],7482:[[78],256],7484:[[79],256],7485:[[546],256],7486:[[80],256],7487:[[82],256],7488:[[84],256],7489:[[85],256],7490:[[87],256],7491:[[97],256],7492:[[592],256],7493:[[593],256],7494:[[7426],256],7495:[[98],256],7496:[[100],256],7497:[[101],256],7498:[[601],256],7499:[[603],256],7500:[[604],256],7501:[[103],256],7503:[[107],256],7504:[[109],256],7505:[[331],256],7506:[[111],256],7507:[[596],256],7508:[[7446],256],7509:[[7447],256],7510:[[112],256],7511:[[116],256],7512:[[117],256],7513:[[7453],256],7514:[[623],256],7515:[[118],256],7516:[[7461],256],7517:[[946],256],7518:[[947],256],7519:[[948],256],7520:[[966],256],7521:[[967],256],7522:[[105],256],7523:[[114],256],7524:[[117],256],7525:[[118],256],7526:[[946],256],7527:[[947],256],7528:[[961],256],7529:[[966],256],7530:[[967],256],7544:[[1085],256],7579:[[594],256],7580:[[99],256],7581:[[597],256],7582:[[240],256],7583:[[604],256],7584:[[102],256],7585:[[607],256],7586:[[609],256],7587:[[613],256],7588:[[616],256],7589:[[617],256],7590:[[618],256],7591:[[7547],256],7592:[[669],256],7593:[[621],256],7594:[[7557],256],7595:[[671],256],7596:[[625],256],7597:[[624],256],7598:[[626],256],7599:[[627],256],7600:[[628],256],7601:[[629],256],7602:[[632],256],7603:[[642],256],7604:[[643],256],7605:[[427],256],7606:[[649],256],7607:[[650],256],7608:[[7452],256],7609:[[651],256],7610:[[652],256],7611:[[122],256],7612:[[656],256],7613:[[657],256],7614:[[658],256],7615:[[952],256],7616:[,230],7617:[,230],7618:[,220],7619:[,230],7620:[,230],7621:[,230],7622:[,230],7623:[,230],7624:[,230],7625:[,230],7626:[,220],7627:[,230],7628:[,230],7629:[,234],7630:[,214],7631:[,220],7632:[,202],7633:[,230],7634:[,230],7635:[,230],7636:[,230],7637:[,230],7638:[,230],7639:[,230],7640:[,230],7641:[,230],7642:[,230],7643:[,230],7644:[,230],7645:[,230],7646:[,230],7647:[,230],7648:[,230],7649:[,230],7650:[,230],7651:[,230],7652:[,230],7653:[,230],7654:[,230],7676:[,233],7677:[,220],7678:[,230],7679:[,220]}, + 7680:{7680:[[65,805]],7681:[[97,805]],7682:[[66,775]],7683:[[98,775]],7684:[[66,803]],7685:[[98,803]],7686:[[66,817]],7687:[[98,817]],7688:[[199,769]],7689:[[231,769]],7690:[[68,775]],7691:[[100,775]],7692:[[68,803]],7693:[[100,803]],7694:[[68,817]],7695:[[100,817]],7696:[[68,807]],7697:[[100,807]],7698:[[68,813]],7699:[[100,813]],7700:[[274,768]],7701:[[275,768]],7702:[[274,769]],7703:[[275,769]],7704:[[69,813]],7705:[[101,813]],7706:[[69,816]],7707:[[101,816]],7708:[[552,774]],7709:[[553,774]],7710:[[70,775]],7711:[[102,775]],7712:[[71,772]],7713:[[103,772]],7714:[[72,775]],7715:[[104,775]],7716:[[72,803]],7717:[[104,803]],7718:[[72,776]],7719:[[104,776]],7720:[[72,807]],7721:[[104,807]],7722:[[72,814]],7723:[[104,814]],7724:[[73,816]],7725:[[105,816]],7726:[[207,769]],7727:[[239,769]],7728:[[75,769]],7729:[[107,769]],7730:[[75,803]],7731:[[107,803]],7732:[[75,817]],7733:[[107,817]],7734:[[76,803],,{772:7736}],7735:[[108,803],,{772:7737}],7736:[[7734,772]],7737:[[7735,772]],7738:[[76,817]],7739:[[108,817]],7740:[[76,813]],7741:[[108,813]],7742:[[77,769]],7743:[[109,769]],7744:[[77,775]],7745:[[109,775]],7746:[[77,803]],7747:[[109,803]],7748:[[78,775]],7749:[[110,775]],7750:[[78,803]],7751:[[110,803]],7752:[[78,817]],7753:[[110,817]],7754:[[78,813]],7755:[[110,813]],7756:[[213,769]],7757:[[245,769]],7758:[[213,776]],7759:[[245,776]],7760:[[332,768]],7761:[[333,768]],7762:[[332,769]],7763:[[333,769]],7764:[[80,769]],7765:[[112,769]],7766:[[80,775]],7767:[[112,775]],7768:[[82,775]],7769:[[114,775]],7770:[[82,803],,{772:7772}],7771:[[114,803],,{772:7773}],7772:[[7770,772]],7773:[[7771,772]],7774:[[82,817]],7775:[[114,817]],7776:[[83,775]],7777:[[115,775]],7778:[[83,803],,{775:7784}],7779:[[115,803],,{775:7785}],7780:[[346,775]],7781:[[347,775]],7782:[[352,775]],7783:[[353,775]],7784:[[7778,775]],7785:[[7779,775]],7786:[[84,775]],7787:[[116,775]],7788:[[84,803]],7789:[[116,803]],7790:[[84,817]],7791:[[116,817]],7792:[[84,813]],7793:[[116,813]],7794:[[85,804]],7795:[[117,804]],7796:[[85,816]],7797:[[117,816]],7798:[[85,813]],7799:[[117,813]],7800:[[360,769]],7801:[[361,769]],7802:[[362,776]],7803:[[363,776]],7804:[[86,771]],7805:[[118,771]],7806:[[86,803]],7807:[[118,803]],7808:[[87,768]],7809:[[119,768]],7810:[[87,769]],7811:[[119,769]],7812:[[87,776]],7813:[[119,776]],7814:[[87,775]],7815:[[119,775]],7816:[[87,803]],7817:[[119,803]],7818:[[88,775]],7819:[[120,775]],7820:[[88,776]],7821:[[120,776]],7822:[[89,775]],7823:[[121,775]],7824:[[90,770]],7825:[[122,770]],7826:[[90,803]],7827:[[122,803]],7828:[[90,817]],7829:[[122,817]],7830:[[104,817]],7831:[[116,776]],7832:[[119,778]],7833:[[121,778]],7834:[[97,702],256],7835:[[383,775]],7840:[[65,803],,{770:7852,774:7862}],7841:[[97,803],,{770:7853,774:7863}],7842:[[65,777]],7843:[[97,777]],7844:[[194,769]],7845:[[226,769]],7846:[[194,768]],7847:[[226,768]],7848:[[194,777]],7849:[[226,777]],7850:[[194,771]],7851:[[226,771]],7852:[[7840,770]],7853:[[7841,770]],7854:[[258,769]],7855:[[259,769]],7856:[[258,768]],7857:[[259,768]],7858:[[258,777]],7859:[[259,777]],7860:[[258,771]],7861:[[259,771]],7862:[[7840,774]],7863:[[7841,774]],7864:[[69,803],,{770:7878}],7865:[[101,803],,{770:7879}],7866:[[69,777]],7867:[[101,777]],7868:[[69,771]],7869:[[101,771]],7870:[[202,769]],7871:[[234,769]],7872:[[202,768]],7873:[[234,768]],7874:[[202,777]],7875:[[234,777]],7876:[[202,771]],7877:[[234,771]],7878:[[7864,770]],7879:[[7865,770]],7880:[[73,777]],7881:[[105,777]],7882:[[73,803]],7883:[[105,803]],7884:[[79,803],,{770:7896}],7885:[[111,803],,{770:7897}],7886:[[79,777]],7887:[[111,777]],7888:[[212,769]],7889:[[244,769]],7890:[[212,768]],7891:[[244,768]],7892:[[212,777]],7893:[[244,777]],7894:[[212,771]],7895:[[244,771]],7896:[[7884,770]],7897:[[7885,770]],7898:[[416,769]],7899:[[417,769]],7900:[[416,768]],7901:[[417,768]],7902:[[416,777]],7903:[[417,777]],7904:[[416,771]],7905:[[417,771]],7906:[[416,803]],7907:[[417,803]],7908:[[85,803]],7909:[[117,803]],7910:[[85,777]],7911:[[117,777]],7912:[[431,769]],7913:[[432,769]],7914:[[431,768]],7915:[[432,768]],7916:[[431,777]],7917:[[432,777]],7918:[[431,771]],7919:[[432,771]],7920:[[431,803]],7921:[[432,803]],7922:[[89,768]],7923:[[121,768]],7924:[[89,803]],7925:[[121,803]],7926:[[89,777]],7927:[[121,777]],7928:[[89,771]],7929:[[121,771]]}, + 7936:{7936:[[945,787],,{768:7938,769:7940,834:7942,837:8064}],7937:[[945,788],,{768:7939,769:7941,834:7943,837:8065}],7938:[[7936,768],,{837:8066}],7939:[[7937,768],,{837:8067}],7940:[[7936,769],,{837:8068}],7941:[[7937,769],,{837:8069}],7942:[[7936,834],,{837:8070}],7943:[[7937,834],,{837:8071}],7944:[[913,787],,{768:7946,769:7948,834:7950,837:8072}],7945:[[913,788],,{768:7947,769:7949,834:7951,837:8073}],7946:[[7944,768],,{837:8074}],7947:[[7945,768],,{837:8075}],7948:[[7944,769],,{837:8076}],7949:[[7945,769],,{837:8077}],7950:[[7944,834],,{837:8078}],7951:[[7945,834],,{837:8079}],7952:[[949,787],,{768:7954,769:7956}],7953:[[949,788],,{768:7955,769:7957}],7954:[[7952,768]],7955:[[7953,768]],7956:[[7952,769]],7957:[[7953,769]],7960:[[917,787],,{768:7962,769:7964}],7961:[[917,788],,{768:7963,769:7965}],7962:[[7960,768]],7963:[[7961,768]],7964:[[7960,769]],7965:[[7961,769]],7968:[[951,787],,{768:7970,769:7972,834:7974,837:8080}],7969:[[951,788],,{768:7971,769:7973,834:7975,837:8081}],7970:[[7968,768],,{837:8082}],7971:[[7969,768],,{837:8083}],7972:[[7968,769],,{837:8084}],7973:[[7969,769],,{837:8085}],7974:[[7968,834],,{837:8086}],7975:[[7969,834],,{837:8087}],7976:[[919,787],,{768:7978,769:7980,834:7982,837:8088}],7977:[[919,788],,{768:7979,769:7981,834:7983,837:8089}],7978:[[7976,768],,{837:8090}],7979:[[7977,768],,{837:8091}],7980:[[7976,769],,{837:8092}],7981:[[7977,769],,{837:8093}],7982:[[7976,834],,{837:8094}],7983:[[7977,834],,{837:8095}],7984:[[953,787],,{768:7986,769:7988,834:7990}],7985:[[953,788],,{768:7987,769:7989,834:7991}],7986:[[7984,768]],7987:[[7985,768]],7988:[[7984,769]],7989:[[7985,769]],7990:[[7984,834]],7991:[[7985,834]],7992:[[921,787],,{768:7994,769:7996,834:7998}],7993:[[921,788],,{768:7995,769:7997,834:7999}],7994:[[7992,768]],7995:[[7993,768]],7996:[[7992,769]],7997:[[7993,769]],7998:[[7992,834]],7999:[[7993,834]],8000:[[959,787],,{768:8002,769:8004}],8001:[[959,788],,{768:8003,769:8005}],8002:[[8000,768]],8003:[[8001,768]],8004:[[8000,769]],8005:[[8001,769]],8008:[[927,787],,{768:8010,769:8012}],8009:[[927,788],,{768:8011,769:8013}],8010:[[8008,768]],8011:[[8009,768]],8012:[[8008,769]],8013:[[8009,769]],8016:[[965,787],,{768:8018,769:8020,834:8022}],8017:[[965,788],,{768:8019,769:8021,834:8023}],8018:[[8016,768]],8019:[[8017,768]],8020:[[8016,769]],8021:[[8017,769]],8022:[[8016,834]],8023:[[8017,834]],8025:[[933,788],,{768:8027,769:8029,834:8031}],8027:[[8025,768]],8029:[[8025,769]],8031:[[8025,834]],8032:[[969,787],,{768:8034,769:8036,834:8038,837:8096}],8033:[[969,788],,{768:8035,769:8037,834:8039,837:8097}],8034:[[8032,768],,{837:8098}],8035:[[8033,768],,{837:8099}],8036:[[8032,769],,{837:8100}],8037:[[8033,769],,{837:8101}],8038:[[8032,834],,{837:8102}],8039:[[8033,834],,{837:8103}],8040:[[937,787],,{768:8042,769:8044,834:8046,837:8104}],8041:[[937,788],,{768:8043,769:8045,834:8047,837:8105}],8042:[[8040,768],,{837:8106}],8043:[[8041,768],,{837:8107}],8044:[[8040,769],,{837:8108}],8045:[[8041,769],,{837:8109}],8046:[[8040,834],,{837:8110}],8047:[[8041,834],,{837:8111}],8048:[[945,768],,{837:8114}],8049:[[940]],8050:[[949,768]],8051:[[941]],8052:[[951,768],,{837:8130}],8053:[[942]],8054:[[953,768]],8055:[[943]],8056:[[959,768]],8057:[[972]],8058:[[965,768]],8059:[[973]],8060:[[969,768],,{837:8178}],8061:[[974]],8064:[[7936,837]],8065:[[7937,837]],8066:[[7938,837]],8067:[[7939,837]],8068:[[7940,837]],8069:[[7941,837]],8070:[[7942,837]],8071:[[7943,837]],8072:[[7944,837]],8073:[[7945,837]],8074:[[7946,837]],8075:[[7947,837]],8076:[[7948,837]],8077:[[7949,837]],8078:[[7950,837]],8079:[[7951,837]],8080:[[7968,837]],8081:[[7969,837]],8082:[[7970,837]],8083:[[7971,837]],8084:[[7972,837]],8085:[[7973,837]],8086:[[7974,837]],8087:[[7975,837]],8088:[[7976,837]],8089:[[7977,837]],8090:[[7978,837]],8091:[[7979,837]],8092:[[7980,837]],8093:[[7981,837]],8094:[[7982,837]],8095:[[7983,837]],8096:[[8032,837]],8097:[[8033,837]],8098:[[8034,837]],8099:[[8035,837]],8100:[[8036,837]],8101:[[8037,837]],8102:[[8038,837]],8103:[[8039,837]],8104:[[8040,837]],8105:[[8041,837]],8106:[[8042,837]],8107:[[8043,837]],8108:[[8044,837]],8109:[[8045,837]],8110:[[8046,837]],8111:[[8047,837]],8112:[[945,774]],8113:[[945,772]],8114:[[8048,837]],8115:[[945,837]],8116:[[940,837]],8118:[[945,834],,{837:8119}],8119:[[8118,837]],8120:[[913,774]],8121:[[913,772]],8122:[[913,768]],8123:[[902]],8124:[[913,837]],8125:[[32,787],256],8126:[[953]],8127:[[32,787],256,{768:8141,769:8142,834:8143}],8128:[[32,834],256],8129:[[168,834]],8130:[[8052,837]],8131:[[951,837]],8132:[[942,837]],8134:[[951,834],,{837:8135}],8135:[[8134,837]],8136:[[917,768]],8137:[[904]],8138:[[919,768]],8139:[[905]],8140:[[919,837]],8141:[[8127,768]],8142:[[8127,769]],8143:[[8127,834]],8144:[[953,774]],8145:[[953,772]],8146:[[970,768]],8147:[[912]],8150:[[953,834]],8151:[[970,834]],8152:[[921,774]],8153:[[921,772]],8154:[[921,768]],8155:[[906]],8157:[[8190,768]],8158:[[8190,769]],8159:[[8190,834]],8160:[[965,774]],8161:[[965,772]],8162:[[971,768]],8163:[[944]],8164:[[961,787]],8165:[[961,788]],8166:[[965,834]],8167:[[971,834]],8168:[[933,774]],8169:[[933,772]],8170:[[933,768]],8171:[[910]],8172:[[929,788]],8173:[[168,768]],8174:[[901]],8175:[[96]],8178:[[8060,837]],8179:[[969,837]],8180:[[974,837]],8182:[[969,834],,{837:8183}],8183:[[8182,837]],8184:[[927,768]],8185:[[908]],8186:[[937,768]],8187:[[911]],8188:[[937,837]],8189:[[180]],8190:[[32,788],256,{768:8157,769:8158,834:8159}]}, + 8192:{8192:[[8194]],8193:[[8195]],8194:[[32],256],8195:[[32],256],8196:[[32],256],8197:[[32],256],8198:[[32],256],8199:[[32],256],8200:[[32],256],8201:[[32],256],8202:[[32],256],8209:[[8208],256],8215:[[32,819],256],8228:[[46],256],8229:[[46,46],256],8230:[[46,46,46],256],8239:[[32],256],8243:[[8242,8242],256],8244:[[8242,8242,8242],256],8246:[[8245,8245],256],8247:[[8245,8245,8245],256],8252:[[33,33],256],8254:[[32,773],256],8263:[[63,63],256],8264:[[63,33],256],8265:[[33,63],256],8279:[[8242,8242,8242,8242],256],8287:[[32],256],8304:[[48],256],8305:[[105],256],8308:[[52],256],8309:[[53],256],8310:[[54],256],8311:[[55],256],8312:[[56],256],8313:[[57],256],8314:[[43],256],8315:[[8722],256],8316:[[61],256],8317:[[40],256],8318:[[41],256],8319:[[110],256],8320:[[48],256],8321:[[49],256],8322:[[50],256],8323:[[51],256],8324:[[52],256],8325:[[53],256],8326:[[54],256],8327:[[55],256],8328:[[56],256],8329:[[57],256],8330:[[43],256],8331:[[8722],256],8332:[[61],256],8333:[[40],256],8334:[[41],256],8336:[[97],256],8337:[[101],256],8338:[[111],256],8339:[[120],256],8340:[[601],256],8341:[[104],256],8342:[[107],256],8343:[[108],256],8344:[[109],256],8345:[[110],256],8346:[[112],256],8347:[[115],256],8348:[[116],256],8360:[[82,115],256],8400:[,230],8401:[,230],8402:[,1],8403:[,1],8404:[,230],8405:[,230],8406:[,230],8407:[,230],8408:[,1],8409:[,1],8410:[,1],8411:[,230],8412:[,230],8417:[,230],8421:[,1],8422:[,1],8423:[,230],8424:[,220],8425:[,230],8426:[,1],8427:[,1],8428:[,220],8429:[,220],8430:[,220],8431:[,220],8432:[,230]}, + 8448:{8448:[[97,47,99],256],8449:[[97,47,115],256],8450:[[67],256],8451:[[176,67],256],8453:[[99,47,111],256],8454:[[99,47,117],256],8455:[[400],256],8457:[[176,70],256],8458:[[103],256],8459:[[72],256],8460:[[72],256],8461:[[72],256],8462:[[104],256],8463:[[295],256],8464:[[73],256],8465:[[73],256],8466:[[76],256],8467:[[108],256],8469:[[78],256],8470:[[78,111],256],8473:[[80],256],8474:[[81],256],8475:[[82],256],8476:[[82],256],8477:[[82],256],8480:[[83,77],256],8481:[[84,69,76],256],8482:[[84,77],256],8484:[[90],256],8486:[[937]],8488:[[90],256],8490:[[75]],8491:[[197]],8492:[[66],256],8493:[[67],256],8495:[[101],256],8496:[[69],256],8497:[[70],256],8499:[[77],256],8500:[[111],256],8501:[[1488],256],8502:[[1489],256],8503:[[1490],256],8504:[[1491],256],8505:[[105],256],8507:[[70,65,88],256],8508:[[960],256],8509:[[947],256],8510:[[915],256],8511:[[928],256],8512:[[8721],256],8517:[[68],256],8518:[[100],256],8519:[[101],256],8520:[[105],256],8521:[[106],256],8528:[[49,8260,55],256],8529:[[49,8260,57],256],8530:[[49,8260,49,48],256],8531:[[49,8260,51],256],8532:[[50,8260,51],256],8533:[[49,8260,53],256],8534:[[50,8260,53],256],8535:[[51,8260,53],256],8536:[[52,8260,53],256],8537:[[49,8260,54],256],8538:[[53,8260,54],256],8539:[[49,8260,56],256],8540:[[51,8260,56],256],8541:[[53,8260,56],256],8542:[[55,8260,56],256],8543:[[49,8260],256],8544:[[73],256],8545:[[73,73],256],8546:[[73,73,73],256],8547:[[73,86],256],8548:[[86],256],8549:[[86,73],256],8550:[[86,73,73],256],8551:[[86,73,73,73],256],8552:[[73,88],256],8553:[[88],256],8554:[[88,73],256],8555:[[88,73,73],256],8556:[[76],256],8557:[[67],256],8558:[[68],256],8559:[[77],256],8560:[[105],256],8561:[[105,105],256],8562:[[105,105,105],256],8563:[[105,118],256],8564:[[118],256],8565:[[118,105],256],8566:[[118,105,105],256],8567:[[118,105,105,105],256],8568:[[105,120],256],8569:[[120],256],8570:[[120,105],256],8571:[[120,105,105],256],8572:[[108],256],8573:[[99],256],8574:[[100],256],8575:[[109],256],8585:[[48,8260,51],256],8592:[,,{824:8602}],8594:[,,{824:8603}],8596:[,,{824:8622}],8602:[[8592,824]],8603:[[8594,824]],8622:[[8596,824]],8653:[[8656,824]],8654:[[8660,824]],8655:[[8658,824]],8656:[,,{824:8653}],8658:[,,{824:8655}],8660:[,,{824:8654}]}, + 8704:{8707:[,,{824:8708}],8708:[[8707,824]],8712:[,,{824:8713}],8713:[[8712,824]],8715:[,,{824:8716}],8716:[[8715,824]],8739:[,,{824:8740}],8740:[[8739,824]],8741:[,,{824:8742}],8742:[[8741,824]],8748:[[8747,8747],256],8749:[[8747,8747,8747],256],8751:[[8750,8750],256],8752:[[8750,8750,8750],256],8764:[,,{824:8769}],8769:[[8764,824]],8771:[,,{824:8772}],8772:[[8771,824]],8773:[,,{824:8775}],8775:[[8773,824]],8776:[,,{824:8777}],8777:[[8776,824]],8781:[,,{824:8813}],8800:[[61,824]],8801:[,,{824:8802}],8802:[[8801,824]],8804:[,,{824:8816}],8805:[,,{824:8817}],8813:[[8781,824]],8814:[[60,824]],8815:[[62,824]],8816:[[8804,824]],8817:[[8805,824]],8818:[,,{824:8820}],8819:[,,{824:8821}],8820:[[8818,824]],8821:[[8819,824]],8822:[,,{824:8824}],8823:[,,{824:8825}],8824:[[8822,824]],8825:[[8823,824]],8826:[,,{824:8832}],8827:[,,{824:8833}],8828:[,,{824:8928}],8829:[,,{824:8929}],8832:[[8826,824]],8833:[[8827,824]],8834:[,,{824:8836}],8835:[,,{824:8837}],8836:[[8834,824]],8837:[[8835,824]],8838:[,,{824:8840}],8839:[,,{824:8841}],8840:[[8838,824]],8841:[[8839,824]],8849:[,,{824:8930}],8850:[,,{824:8931}],8866:[,,{824:8876}],8872:[,,{824:8877}],8873:[,,{824:8878}],8875:[,,{824:8879}],8876:[[8866,824]],8877:[[8872,824]],8878:[[8873,824]],8879:[[8875,824]],8882:[,,{824:8938}],8883:[,,{824:8939}],8884:[,,{824:8940}],8885:[,,{824:8941}],8928:[[8828,824]],8929:[[8829,824]],8930:[[8849,824]],8931:[[8850,824]],8938:[[8882,824]],8939:[[8883,824]],8940:[[8884,824]],8941:[[8885,824]]}, + 8960:{9001:[[12296]],9002:[[12297]]}, + 9216:{9312:[[49],256],9313:[[50],256],9314:[[51],256],9315:[[52],256],9316:[[53],256],9317:[[54],256],9318:[[55],256],9319:[[56],256],9320:[[57],256],9321:[[49,48],256],9322:[[49,49],256],9323:[[49,50],256],9324:[[49,51],256],9325:[[49,52],256],9326:[[49,53],256],9327:[[49,54],256],9328:[[49,55],256],9329:[[49,56],256],9330:[[49,57],256],9331:[[50,48],256],9332:[[40,49,41],256],9333:[[40,50,41],256],9334:[[40,51,41],256],9335:[[40,52,41],256],9336:[[40,53,41],256],9337:[[40,54,41],256],9338:[[40,55,41],256],9339:[[40,56,41],256],9340:[[40,57,41],256],9341:[[40,49,48,41],256],9342:[[40,49,49,41],256],9343:[[40,49,50,41],256],9344:[[40,49,51,41],256],9345:[[40,49,52,41],256],9346:[[40,49,53,41],256],9347:[[40,49,54,41],256],9348:[[40,49,55,41],256],9349:[[40,49,56,41],256],9350:[[40,49,57,41],256],9351:[[40,50,48,41],256],9352:[[49,46],256],9353:[[50,46],256],9354:[[51,46],256],9355:[[52,46],256],9356:[[53,46],256],9357:[[54,46],256],9358:[[55,46],256],9359:[[56,46],256],9360:[[57,46],256],9361:[[49,48,46],256],9362:[[49,49,46],256],9363:[[49,50,46],256],9364:[[49,51,46],256],9365:[[49,52,46],256],9366:[[49,53,46],256],9367:[[49,54,46],256],9368:[[49,55,46],256],9369:[[49,56,46],256],9370:[[49,57,46],256],9371:[[50,48,46],256],9372:[[40,97,41],256],9373:[[40,98,41],256],9374:[[40,99,41],256],9375:[[40,100,41],256],9376:[[40,101,41],256],9377:[[40,102,41],256],9378:[[40,103,41],256],9379:[[40,104,41],256],9380:[[40,105,41],256],9381:[[40,106,41],256],9382:[[40,107,41],256],9383:[[40,108,41],256],9384:[[40,109,41],256],9385:[[40,110,41],256],9386:[[40,111,41],256],9387:[[40,112,41],256],9388:[[40,113,41],256],9389:[[40,114,41],256],9390:[[40,115,41],256],9391:[[40,116,41],256],9392:[[40,117,41],256],9393:[[40,118,41],256],9394:[[40,119,41],256],9395:[[40,120,41],256],9396:[[40,121,41],256],9397:[[40,122,41],256],9398:[[65],256],9399:[[66],256],9400:[[67],256],9401:[[68],256],9402:[[69],256],9403:[[70],256],9404:[[71],256],9405:[[72],256],9406:[[73],256],9407:[[74],256],9408:[[75],256],9409:[[76],256],9410:[[77],256],9411:[[78],256],9412:[[79],256],9413:[[80],256],9414:[[81],256],9415:[[82],256],9416:[[83],256],9417:[[84],256],9418:[[85],256],9419:[[86],256],9420:[[87],256],9421:[[88],256],9422:[[89],256],9423:[[90],256],9424:[[97],256],9425:[[98],256],9426:[[99],256],9427:[[100],256],9428:[[101],256],9429:[[102],256],9430:[[103],256],9431:[[104],256],9432:[[105],256],9433:[[106],256],9434:[[107],256],9435:[[108],256],9436:[[109],256],9437:[[110],256],9438:[[111],256],9439:[[112],256],9440:[[113],256],9441:[[114],256],9442:[[115],256],9443:[[116],256],9444:[[117],256],9445:[[118],256],9446:[[119],256],9447:[[120],256],9448:[[121],256],9449:[[122],256],9450:[[48],256]}, + 10752:{10764:[[8747,8747,8747,8747],256],10868:[[58,58,61],256],10869:[[61,61],256],10870:[[61,61,61],256],10972:[[10973,824],512]}, + 11264:{11388:[[106],256],11389:[[86],256],11503:[,230],11504:[,230],11505:[,230]}, + 11520:{11631:[[11617],256],11647:[,9],11744:[,230],11745:[,230],11746:[,230],11747:[,230],11748:[,230],11749:[,230],11750:[,230],11751:[,230],11752:[,230],11753:[,230],11754:[,230],11755:[,230],11756:[,230],11757:[,230],11758:[,230],11759:[,230],11760:[,230],11761:[,230],11762:[,230],11763:[,230],11764:[,230],11765:[,230],11766:[,230],11767:[,230],11768:[,230],11769:[,230],11770:[,230],11771:[,230],11772:[,230],11773:[,230],11774:[,230],11775:[,230]}, + 11776:{11935:[[27597],256],12019:[[40863],256]}, + 12032:{12032:[[19968],256],12033:[[20008],256],12034:[[20022],256],12035:[[20031],256],12036:[[20057],256],12037:[[20101],256],12038:[[20108],256],12039:[[20128],256],12040:[[20154],256],12041:[[20799],256],12042:[[20837],256],12043:[[20843],256],12044:[[20866],256],12045:[[20886],256],12046:[[20907],256],12047:[[20960],256],12048:[[20981],256],12049:[[20992],256],12050:[[21147],256],12051:[[21241],256],12052:[[21269],256],12053:[[21274],256],12054:[[21304],256],12055:[[21313],256],12056:[[21340],256],12057:[[21353],256],12058:[[21378],256],12059:[[21430],256],12060:[[21448],256],12061:[[21475],256],12062:[[22231],256],12063:[[22303],256],12064:[[22763],256],12065:[[22786],256],12066:[[22794],256],12067:[[22805],256],12068:[[22823],256],12069:[[22899],256],12070:[[23376],256],12071:[[23424],256],12072:[[23544],256],12073:[[23567],256],12074:[[23586],256],12075:[[23608],256],12076:[[23662],256],12077:[[23665],256],12078:[[24027],256],12079:[[24037],256],12080:[[24049],256],12081:[[24062],256],12082:[[24178],256],12083:[[24186],256],12084:[[24191],256],12085:[[24308],256],12086:[[24318],256],12087:[[24331],256],12088:[[24339],256],12089:[[24400],256],12090:[[24417],256],12091:[[24435],256],12092:[[24515],256],12093:[[25096],256],12094:[[25142],256],12095:[[25163],256],12096:[[25903],256],12097:[[25908],256],12098:[[25991],256],12099:[[26007],256],12100:[[26020],256],12101:[[26041],256],12102:[[26080],256],12103:[[26085],256],12104:[[26352],256],12105:[[26376],256],12106:[[26408],256],12107:[[27424],256],12108:[[27490],256],12109:[[27513],256],12110:[[27571],256],12111:[[27595],256],12112:[[27604],256],12113:[[27611],256],12114:[[27663],256],12115:[[27668],256],12116:[[27700],256],12117:[[28779],256],12118:[[29226],256],12119:[[29238],256],12120:[[29243],256],12121:[[29247],256],12122:[[29255],256],12123:[[29273],256],12124:[[29275],256],12125:[[29356],256],12126:[[29572],256],12127:[[29577],256],12128:[[29916],256],12129:[[29926],256],12130:[[29976],256],12131:[[29983],256],12132:[[29992],256],12133:[[30000],256],12134:[[30091],256],12135:[[30098],256],12136:[[30326],256],12137:[[30333],256],12138:[[30382],256],12139:[[30399],256],12140:[[30446],256],12141:[[30683],256],12142:[[30690],256],12143:[[30707],256],12144:[[31034],256],12145:[[31160],256],12146:[[31166],256],12147:[[31348],256],12148:[[31435],256],12149:[[31481],256],12150:[[31859],256],12151:[[31992],256],12152:[[32566],256],12153:[[32593],256],12154:[[32650],256],12155:[[32701],256],12156:[[32769],256],12157:[[32780],256],12158:[[32786],256],12159:[[32819],256],12160:[[32895],256],12161:[[32905],256],12162:[[33251],256],12163:[[33258],256],12164:[[33267],256],12165:[[33276],256],12166:[[33292],256],12167:[[33307],256],12168:[[33311],256],12169:[[33390],256],12170:[[33394],256],12171:[[33400],256],12172:[[34381],256],12173:[[34411],256],12174:[[34880],256],12175:[[34892],256],12176:[[34915],256],12177:[[35198],256],12178:[[35211],256],12179:[[35282],256],12180:[[35328],256],12181:[[35895],256],12182:[[35910],256],12183:[[35925],256],12184:[[35960],256],12185:[[35997],256],12186:[[36196],256],12187:[[36208],256],12188:[[36275],256],12189:[[36523],256],12190:[[36554],256],12191:[[36763],256],12192:[[36784],256],12193:[[36789],256],12194:[[37009],256],12195:[[37193],256],12196:[[37318],256],12197:[[37324],256],12198:[[37329],256],12199:[[38263],256],12200:[[38272],256],12201:[[38428],256],12202:[[38582],256],12203:[[38585],256],12204:[[38632],256],12205:[[38737],256],12206:[[38750],256],12207:[[38754],256],12208:[[38761],256],12209:[[38859],256],12210:[[38893],256],12211:[[38899],256],12212:[[38913],256],12213:[[39080],256],12214:[[39131],256],12215:[[39135],256],12216:[[39318],256],12217:[[39321],256],12218:[[39340],256],12219:[[39592],256],12220:[[39640],256],12221:[[39647],256],12222:[[39717],256],12223:[[39727],256],12224:[[39730],256],12225:[[39740],256],12226:[[39770],256],12227:[[40165],256],12228:[[40565],256],12229:[[40575],256],12230:[[40613],256],12231:[[40635],256],12232:[[40643],256],12233:[[40653],256],12234:[[40657],256],12235:[[40697],256],12236:[[40701],256],12237:[[40718],256],12238:[[40723],256],12239:[[40736],256],12240:[[40763],256],12241:[[40778],256],12242:[[40786],256],12243:[[40845],256],12244:[[40860],256],12245:[[40864],256]}, + 12288:{12288:[[32],256],12330:[,218],12331:[,228],12332:[,232],12333:[,222],12334:[,224],12335:[,224],12342:[[12306],256],12344:[[21313],256],12345:[[21316],256],12346:[[21317],256],12358:[,,{12441:12436}],12363:[,,{12441:12364}],12364:[[12363,12441]],12365:[,,{12441:12366}],12366:[[12365,12441]],12367:[,,{12441:12368}],12368:[[12367,12441]],12369:[,,{12441:12370}],12370:[[12369,12441]],12371:[,,{12441:12372}],12372:[[12371,12441]],12373:[,,{12441:12374}],12374:[[12373,12441]],12375:[,,{12441:12376}],12376:[[12375,12441]],12377:[,,{12441:12378}],12378:[[12377,12441]],12379:[,,{12441:12380}],12380:[[12379,12441]],12381:[,,{12441:12382}],12382:[[12381,12441]],12383:[,,{12441:12384}],12384:[[12383,12441]],12385:[,,{12441:12386}],12386:[[12385,12441]],12388:[,,{12441:12389}],12389:[[12388,12441]],12390:[,,{12441:12391}],12391:[[12390,12441]],12392:[,,{12441:12393}],12393:[[12392,12441]],12399:[,,{12441:12400,12442:12401}],12400:[[12399,12441]],12401:[[12399,12442]],12402:[,,{12441:12403,12442:12404}],12403:[[12402,12441]],12404:[[12402,12442]],12405:[,,{12441:12406,12442:12407}],12406:[[12405,12441]],12407:[[12405,12442]],12408:[,,{12441:12409,12442:12410}],12409:[[12408,12441]],12410:[[12408,12442]],12411:[,,{12441:12412,12442:12413}],12412:[[12411,12441]],12413:[[12411,12442]],12436:[[12358,12441]],12441:[,8],12442:[,8],12443:[[32,12441],256],12444:[[32,12442],256],12445:[,,{12441:12446}],12446:[[12445,12441]],12447:[[12424,12426],256],12454:[,,{12441:12532}],12459:[,,{12441:12460}],12460:[[12459,12441]],12461:[,,{12441:12462}],12462:[[12461,12441]],12463:[,,{12441:12464}],12464:[[12463,12441]],12465:[,,{12441:12466}],12466:[[12465,12441]],12467:[,,{12441:12468}],12468:[[12467,12441]],12469:[,,{12441:12470}],12470:[[12469,12441]],12471:[,,{12441:12472}],12472:[[12471,12441]],12473:[,,{12441:12474}],12474:[[12473,12441]],12475:[,,{12441:12476}],12476:[[12475,12441]],12477:[,,{12441:12478}],12478:[[12477,12441]],12479:[,,{12441:12480}],12480:[[12479,12441]],12481:[,,{12441:12482}],12482:[[12481,12441]],12484:[,,{12441:12485}],12485:[[12484,12441]],12486:[,,{12441:12487}],12487:[[12486,12441]],12488:[,,{12441:12489}],12489:[[12488,12441]],12495:[,,{12441:12496,12442:12497}],12496:[[12495,12441]],12497:[[12495,12442]],12498:[,,{12441:12499,12442:12500}],12499:[[12498,12441]],12500:[[12498,12442]],12501:[,,{12441:12502,12442:12503}],12502:[[12501,12441]],12503:[[12501,12442]],12504:[,,{12441:12505,12442:12506}],12505:[[12504,12441]],12506:[[12504,12442]],12507:[,,{12441:12508,12442:12509}],12508:[[12507,12441]],12509:[[12507,12442]],12527:[,,{12441:12535}],12528:[,,{12441:12536}],12529:[,,{12441:12537}],12530:[,,{12441:12538}],12532:[[12454,12441]],12535:[[12527,12441]],12536:[[12528,12441]],12537:[[12529,12441]],12538:[[12530,12441]],12541:[,,{12441:12542}],12542:[[12541,12441]],12543:[[12467,12488],256]}, + 12544:{12593:[[4352],256],12594:[[4353],256],12595:[[4522],256],12596:[[4354],256],12597:[[4524],256],12598:[[4525],256],12599:[[4355],256],12600:[[4356],256],12601:[[4357],256],12602:[[4528],256],12603:[[4529],256],12604:[[4530],256],12605:[[4531],256],12606:[[4532],256],12607:[[4533],256],12608:[[4378],256],12609:[[4358],256],12610:[[4359],256],12611:[[4360],256],12612:[[4385],256],12613:[[4361],256],12614:[[4362],256],12615:[[4363],256],12616:[[4364],256],12617:[[4365],256],12618:[[4366],256],12619:[[4367],256],12620:[[4368],256],12621:[[4369],256],12622:[[4370],256],12623:[[4449],256],12624:[[4450],256],12625:[[4451],256],12626:[[4452],256],12627:[[4453],256],12628:[[4454],256],12629:[[4455],256],12630:[[4456],256],12631:[[4457],256],12632:[[4458],256],12633:[[4459],256],12634:[[4460],256],12635:[[4461],256],12636:[[4462],256],12637:[[4463],256],12638:[[4464],256],12639:[[4465],256],12640:[[4466],256],12641:[[4467],256],12642:[[4468],256],12643:[[4469],256],12644:[[4448],256],12645:[[4372],256],12646:[[4373],256],12647:[[4551],256],12648:[[4552],256],12649:[[4556],256],12650:[[4558],256],12651:[[4563],256],12652:[[4567],256],12653:[[4569],256],12654:[[4380],256],12655:[[4573],256],12656:[[4575],256],12657:[[4381],256],12658:[[4382],256],12659:[[4384],256],12660:[[4386],256],12661:[[4387],256],12662:[[4391],256],12663:[[4393],256],12664:[[4395],256],12665:[[4396],256],12666:[[4397],256],12667:[[4398],256],12668:[[4399],256],12669:[[4402],256],12670:[[4406],256],12671:[[4416],256],12672:[[4423],256],12673:[[4428],256],12674:[[4593],256],12675:[[4594],256],12676:[[4439],256],12677:[[4440],256],12678:[[4441],256],12679:[[4484],256],12680:[[4485],256],12681:[[4488],256],12682:[[4497],256],12683:[[4498],256],12684:[[4500],256],12685:[[4510],256],12686:[[4513],256],12690:[[19968],256],12691:[[20108],256],12692:[[19977],256],12693:[[22235],256],12694:[[19978],256],12695:[[20013],256],12696:[[19979],256],12697:[[30002],256],12698:[[20057],256],12699:[[19993],256],12700:[[19969],256],12701:[[22825],256],12702:[[22320],256],12703:[[20154],256]}, + 12800:{12800:[[40,4352,41],256],12801:[[40,4354,41],256],12802:[[40,4355,41],256],12803:[[40,4357,41],256],12804:[[40,4358,41],256],12805:[[40,4359,41],256],12806:[[40,4361,41],256],12807:[[40,4363,41],256],12808:[[40,4364,41],256],12809:[[40,4366,41],256],12810:[[40,4367,41],256],12811:[[40,4368,41],256],12812:[[40,4369,41],256],12813:[[40,4370,41],256],12814:[[40,4352,4449,41],256],12815:[[40,4354,4449,41],256],12816:[[40,4355,4449,41],256],12817:[[40,4357,4449,41],256],12818:[[40,4358,4449,41],256],12819:[[40,4359,4449,41],256],12820:[[40,4361,4449,41],256],12821:[[40,4363,4449,41],256],12822:[[40,4364,4449,41],256],12823:[[40,4366,4449,41],256],12824:[[40,4367,4449,41],256],12825:[[40,4368,4449,41],256],12826:[[40,4369,4449,41],256],12827:[[40,4370,4449,41],256],12828:[[40,4364,4462,41],256],12829:[[40,4363,4457,4364,4453,4523,41],256],12830:[[40,4363,4457,4370,4462,41],256],12832:[[40,19968,41],256],12833:[[40,20108,41],256],12834:[[40,19977,41],256],12835:[[40,22235,41],256],12836:[[40,20116,41],256],12837:[[40,20845,41],256],12838:[[40,19971,41],256],12839:[[40,20843,41],256],12840:[[40,20061,41],256],12841:[[40,21313,41],256],12842:[[40,26376,41],256],12843:[[40,28779,41],256],12844:[[40,27700,41],256],12845:[[40,26408,41],256],12846:[[40,37329,41],256],12847:[[40,22303,41],256],12848:[[40,26085,41],256],12849:[[40,26666,41],256],12850:[[40,26377,41],256],12851:[[40,31038,41],256],12852:[[40,21517,41],256],12853:[[40,29305,41],256],12854:[[40,36001,41],256],12855:[[40,31069,41],256],12856:[[40,21172,41],256],12857:[[40,20195,41],256],12858:[[40,21628,41],256],12859:[[40,23398,41],256],12860:[[40,30435,41],256],12861:[[40,20225,41],256],12862:[[40,36039,41],256],12863:[[40,21332,41],256],12864:[[40,31085,41],256],12865:[[40,20241,41],256],12866:[[40,33258,41],256],12867:[[40,33267,41],256],12868:[[21839],256],12869:[[24188],256],12870:[[25991],256],12871:[[31631],256],12880:[[80,84,69],256],12881:[[50,49],256],12882:[[50,50],256],12883:[[50,51],256],12884:[[50,52],256],12885:[[50,53],256],12886:[[50,54],256],12887:[[50,55],256],12888:[[50,56],256],12889:[[50,57],256],12890:[[51,48],256],12891:[[51,49],256],12892:[[51,50],256],12893:[[51,51],256],12894:[[51,52],256],12895:[[51,53],256],12896:[[4352],256],12897:[[4354],256],12898:[[4355],256],12899:[[4357],256],12900:[[4358],256],12901:[[4359],256],12902:[[4361],256],12903:[[4363],256],12904:[[4364],256],12905:[[4366],256],12906:[[4367],256],12907:[[4368],256],12908:[[4369],256],12909:[[4370],256],12910:[[4352,4449],256],12911:[[4354,4449],256],12912:[[4355,4449],256],12913:[[4357,4449],256],12914:[[4358,4449],256],12915:[[4359,4449],256],12916:[[4361,4449],256],12917:[[4363,4449],256],12918:[[4364,4449],256],12919:[[4366,4449],256],12920:[[4367,4449],256],12921:[[4368,4449],256],12922:[[4369,4449],256],12923:[[4370,4449],256],12924:[[4366,4449,4535,4352,4457],256],12925:[[4364,4462,4363,4468],256],12926:[[4363,4462],256],12928:[[19968],256],12929:[[20108],256],12930:[[19977],256],12931:[[22235],256],12932:[[20116],256],12933:[[20845],256],12934:[[19971],256],12935:[[20843],256],12936:[[20061],256],12937:[[21313],256],12938:[[26376],256],12939:[[28779],256],12940:[[27700],256],12941:[[26408],256],12942:[[37329],256],12943:[[22303],256],12944:[[26085],256],12945:[[26666],256],12946:[[26377],256],12947:[[31038],256],12948:[[21517],256],12949:[[29305],256],12950:[[36001],256],12951:[[31069],256],12952:[[21172],256],12953:[[31192],256],12954:[[30007],256],12955:[[22899],256],12956:[[36969],256],12957:[[20778],256],12958:[[21360],256],12959:[[27880],256],12960:[[38917],256],12961:[[20241],256],12962:[[20889],256],12963:[[27491],256],12964:[[19978],256],12965:[[20013],256],12966:[[19979],256],12967:[[24038],256],12968:[[21491],256],12969:[[21307],256],12970:[[23447],256],12971:[[23398],256],12972:[[30435],256],12973:[[20225],256],12974:[[36039],256],12975:[[21332],256],12976:[[22812],256],12977:[[51,54],256],12978:[[51,55],256],12979:[[51,56],256],12980:[[51,57],256],12981:[[52,48],256],12982:[[52,49],256],12983:[[52,50],256],12984:[[52,51],256],12985:[[52,52],256],12986:[[52,53],256],12987:[[52,54],256],12988:[[52,55],256],12989:[[52,56],256],12990:[[52,57],256],12991:[[53,48],256],12992:[[49,26376],256],12993:[[50,26376],256],12994:[[51,26376],256],12995:[[52,26376],256],12996:[[53,26376],256],12997:[[54,26376],256],12998:[[55,26376],256],12999:[[56,26376],256],13000:[[57,26376],256],13001:[[49,48,26376],256],13002:[[49,49,26376],256],13003:[[49,50,26376],256],13004:[[72,103],256],13005:[[101,114,103],256],13006:[[101,86],256],13007:[[76,84,68],256],13008:[[12450],256],13009:[[12452],256],13010:[[12454],256],13011:[[12456],256],13012:[[12458],256],13013:[[12459],256],13014:[[12461],256],13015:[[12463],256],13016:[[12465],256],13017:[[12467],256],13018:[[12469],256],13019:[[12471],256],13020:[[12473],256],13021:[[12475],256],13022:[[12477],256],13023:[[12479],256],13024:[[12481],256],13025:[[12484],256],13026:[[12486],256],13027:[[12488],256],13028:[[12490],256],13029:[[12491],256],13030:[[12492],256],13031:[[12493],256],13032:[[12494],256],13033:[[12495],256],13034:[[12498],256],13035:[[12501],256],13036:[[12504],256],13037:[[12507],256],13038:[[12510],256],13039:[[12511],256],13040:[[12512],256],13041:[[12513],256],13042:[[12514],256],13043:[[12516],256],13044:[[12518],256],13045:[[12520],256],13046:[[12521],256],13047:[[12522],256],13048:[[12523],256],13049:[[12524],256],13050:[[12525],256],13051:[[12527],256],13052:[[12528],256],13053:[[12529],256],13054:[[12530],256]}, + 13056:{13056:[[12450,12497,12540,12488],256],13057:[[12450,12523,12501,12449],256],13058:[[12450,12531,12506,12450],256],13059:[[12450,12540,12523],256],13060:[[12452,12491,12531,12464],256],13061:[[12452,12531,12481],256],13062:[[12454,12457,12531],256],13063:[[12456,12473,12463,12540,12489],256],13064:[[12456,12540,12459,12540],256],13065:[[12458,12531,12473],256],13066:[[12458,12540,12512],256],13067:[[12459,12452,12522],256],13068:[[12459,12521,12483,12488],256],13069:[[12459,12525,12522,12540],256],13070:[[12460,12525,12531],256],13071:[[12460,12531,12510],256],13072:[[12462,12460],256],13073:[[12462,12491,12540],256],13074:[[12461,12517,12522,12540],256],13075:[[12462,12523,12480,12540],256],13076:[[12461,12525],256],13077:[[12461,12525,12464,12521,12512],256],13078:[[12461,12525,12513,12540,12488,12523],256],13079:[[12461,12525,12527,12483,12488],256],13080:[[12464,12521,12512],256],13081:[[12464,12521,12512,12488,12531],256],13082:[[12463,12523,12476,12452,12525],256],13083:[[12463,12525,12540,12493],256],13084:[[12465,12540,12473],256],13085:[[12467,12523,12490],256],13086:[[12467,12540,12509],256],13087:[[12469,12452,12463,12523],256],13088:[[12469,12531,12481,12540,12512],256],13089:[[12471,12522,12531,12464],256],13090:[[12475,12531,12481],256],13091:[[12475,12531,12488],256],13092:[[12480,12540,12473],256],13093:[[12487,12471],256],13094:[[12489,12523],256],13095:[[12488,12531],256],13096:[[12490,12494],256],13097:[[12494,12483,12488],256],13098:[[12495,12452,12484],256],13099:[[12497,12540,12475,12531,12488],256],13100:[[12497,12540,12484],256],13101:[[12496,12540,12524,12523],256],13102:[[12500,12450,12473,12488,12523],256],13103:[[12500,12463,12523],256],13104:[[12500,12467],256],13105:[[12499,12523],256],13106:[[12501,12449,12521,12483,12489],256],13107:[[12501,12451,12540,12488],256],13108:[[12502,12483,12471,12455,12523],256],13109:[[12501,12521,12531],256],13110:[[12504,12463,12479,12540,12523],256],13111:[[12506,12477],256],13112:[[12506,12491,12498],256],13113:[[12504,12523,12484],256],13114:[[12506,12531,12473],256],13115:[[12506,12540,12472],256],13116:[[12505,12540,12479],256],13117:[[12509,12452,12531,12488],256],13118:[[12508,12523,12488],256],13119:[[12507,12531],256],13120:[[12509,12531,12489],256],13121:[[12507,12540,12523],256],13122:[[12507,12540,12531],256],13123:[[12510,12452,12463,12525],256],13124:[[12510,12452,12523],256],13125:[[12510,12483,12495],256],13126:[[12510,12523,12463],256],13127:[[12510,12531,12471,12519,12531],256],13128:[[12511,12463,12525,12531],256],13129:[[12511,12522],256],13130:[[12511,12522,12496,12540,12523],256],13131:[[12513,12460],256],13132:[[12513,12460,12488,12531],256],13133:[[12513,12540,12488,12523],256],13134:[[12516,12540,12489],256],13135:[[12516,12540,12523],256],13136:[[12518,12450,12531],256],13137:[[12522,12483,12488,12523],256],13138:[[12522,12521],256],13139:[[12523,12500,12540],256],13140:[[12523,12540,12502,12523],256],13141:[[12524,12512],256],13142:[[12524,12531,12488,12466,12531],256],13143:[[12527,12483,12488],256],13144:[[48,28857],256],13145:[[49,28857],256],13146:[[50,28857],256],13147:[[51,28857],256],13148:[[52,28857],256],13149:[[53,28857],256],13150:[[54,28857],256],13151:[[55,28857],256],13152:[[56,28857],256],13153:[[57,28857],256],13154:[[49,48,28857],256],13155:[[49,49,28857],256],13156:[[49,50,28857],256],13157:[[49,51,28857],256],13158:[[49,52,28857],256],13159:[[49,53,28857],256],13160:[[49,54,28857],256],13161:[[49,55,28857],256],13162:[[49,56,28857],256],13163:[[49,57,28857],256],13164:[[50,48,28857],256],13165:[[50,49,28857],256],13166:[[50,50,28857],256],13167:[[50,51,28857],256],13168:[[50,52,28857],256],13169:[[104,80,97],256],13170:[[100,97],256],13171:[[65,85],256],13172:[[98,97,114],256],13173:[[111,86],256],13174:[[112,99],256],13175:[[100,109],256],13176:[[100,109,178],256],13177:[[100,109,179],256],13178:[[73,85],256],13179:[[24179,25104],256],13180:[[26157,21644],256],13181:[[22823,27491],256],13182:[[26126,27835],256],13183:[[26666,24335,20250,31038],256],13184:[[112,65],256],13185:[[110,65],256],13186:[[956,65],256],13187:[[109,65],256],13188:[[107,65],256],13189:[[75,66],256],13190:[[77,66],256],13191:[[71,66],256],13192:[[99,97,108],256],13193:[[107,99,97,108],256],13194:[[112,70],256],13195:[[110,70],256],13196:[[956,70],256],13197:[[956,103],256],13198:[[109,103],256],13199:[[107,103],256],13200:[[72,122],256],13201:[[107,72,122],256],13202:[[77,72,122],256],13203:[[71,72,122],256],13204:[[84,72,122],256],13205:[[956,8467],256],13206:[[109,8467],256],13207:[[100,8467],256],13208:[[107,8467],256],13209:[[102,109],256],13210:[[110,109],256],13211:[[956,109],256],13212:[[109,109],256],13213:[[99,109],256],13214:[[107,109],256],13215:[[109,109,178],256],13216:[[99,109,178],256],13217:[[109,178],256],13218:[[107,109,178],256],13219:[[109,109,179],256],13220:[[99,109,179],256],13221:[[109,179],256],13222:[[107,109,179],256],13223:[[109,8725,115],256],13224:[[109,8725,115,178],256],13225:[[80,97],256],13226:[[107,80,97],256],13227:[[77,80,97],256],13228:[[71,80,97],256],13229:[[114,97,100],256],13230:[[114,97,100,8725,115],256],13231:[[114,97,100,8725,115,178],256],13232:[[112,115],256],13233:[[110,115],256],13234:[[956,115],256],13235:[[109,115],256],13236:[[112,86],256],13237:[[110,86],256],13238:[[956,86],256],13239:[[109,86],256],13240:[[107,86],256],13241:[[77,86],256],13242:[[112,87],256],13243:[[110,87],256],13244:[[956,87],256],13245:[[109,87],256],13246:[[107,87],256],13247:[[77,87],256],13248:[[107,937],256],13249:[[77,937],256],13250:[[97,46,109,46],256],13251:[[66,113],256],13252:[[99,99],256],13253:[[99,100],256],13254:[[67,8725,107,103],256],13255:[[67,111,46],256],13256:[[100,66],256],13257:[[71,121],256],13258:[[104,97],256],13259:[[72,80],256],13260:[[105,110],256],13261:[[75,75],256],13262:[[75,77],256],13263:[[107,116],256],13264:[[108,109],256],13265:[[108,110],256],13266:[[108,111,103],256],13267:[[108,120],256],13268:[[109,98],256],13269:[[109,105,108],256],13270:[[109,111,108],256],13271:[[80,72],256],13272:[[112,46,109,46],256],13273:[[80,80,77],256],13274:[[80,82],256],13275:[[115,114],256],13276:[[83,118],256],13277:[[87,98],256],13278:[[86,8725,109],256],13279:[[65,8725,109],256],13280:[[49,26085],256],13281:[[50,26085],256],13282:[[51,26085],256],13283:[[52,26085],256],13284:[[53,26085],256],13285:[[54,26085],256],13286:[[55,26085],256],13287:[[56,26085],256],13288:[[57,26085],256],13289:[[49,48,26085],256],13290:[[49,49,26085],256],13291:[[49,50,26085],256],13292:[[49,51,26085],256],13293:[[49,52,26085],256],13294:[[49,53,26085],256],13295:[[49,54,26085],256],13296:[[49,55,26085],256],13297:[[49,56,26085],256],13298:[[49,57,26085],256],13299:[[50,48,26085],256],13300:[[50,49,26085],256],13301:[[50,50,26085],256],13302:[[50,51,26085],256],13303:[[50,52,26085],256],13304:[[50,53,26085],256],13305:[[50,54,26085],256],13306:[[50,55,26085],256],13307:[[50,56,26085],256],13308:[[50,57,26085],256],13309:[[51,48,26085],256],13310:[[51,49,26085],256],13311:[[103,97,108],256]}, + 42496:{42607:[,230],42612:[,230],42613:[,230],42614:[,230],42615:[,230],42616:[,230],42617:[,230],42618:[,230],42619:[,230],42620:[,230],42621:[,230],42655:[,230],42736:[,230],42737:[,230]}, + 42752:{42864:[[42863],256],43000:[[294],256],43001:[[339],256]}, + 43008:{43014:[,9],43204:[,9],43232:[,230],43233:[,230],43234:[,230],43235:[,230],43236:[,230],43237:[,230],43238:[,230],43239:[,230],43240:[,230],43241:[,230],43242:[,230],43243:[,230],43244:[,230],43245:[,230],43246:[,230],43247:[,230],43248:[,230],43249:[,230]}, + 43264:{43307:[,220],43308:[,220],43309:[,220],43347:[,9],43443:[,7],43456:[,9]}, + 43520:{43696:[,230],43698:[,230],43699:[,230],43700:[,220],43703:[,230],43704:[,230],43710:[,230],43711:[,230],43713:[,230],43766:[,9]}, + 43776:{44013:[,9]}, + 53504:{119134:[[119127,119141],512],119135:[[119128,119141],512],119136:[[119135,119150],512],119137:[[119135,119151],512],119138:[[119135,119152],512],119139:[[119135,119153],512],119140:[[119135,119154],512],119141:[,216],119142:[,216],119143:[,1],119144:[,1],119145:[,1],119149:[,226],119150:[,216],119151:[,216],119152:[,216],119153:[,216],119154:[,216],119163:[,220],119164:[,220],119165:[,220],119166:[,220],119167:[,220],119168:[,220],119169:[,220],119170:[,220],119173:[,230],119174:[,230],119175:[,230],119176:[,230],119177:[,230],119178:[,220],119179:[,220],119210:[,230],119211:[,230],119212:[,230],119213:[,230],119227:[[119225,119141],512],119228:[[119226,119141],512],119229:[[119227,119150],512],119230:[[119228,119150],512],119231:[[119227,119151],512],119232:[[119228,119151],512]}, + 53760:{119362:[,230],119363:[,230],119364:[,230]}, + 54272:{119808:[[65],256],119809:[[66],256],119810:[[67],256],119811:[[68],256],119812:[[69],256],119813:[[70],256],119814:[[71],256],119815:[[72],256],119816:[[73],256],119817:[[74],256],119818:[[75],256],119819:[[76],256],119820:[[77],256],119821:[[78],256],119822:[[79],256],119823:[[80],256],119824:[[81],256],119825:[[82],256],119826:[[83],256],119827:[[84],256],119828:[[85],256],119829:[[86],256],119830:[[87],256],119831:[[88],256],119832:[[89],256],119833:[[90],256],119834:[[97],256],119835:[[98],256],119836:[[99],256],119837:[[100],256],119838:[[101],256],119839:[[102],256],119840:[[103],256],119841:[[104],256],119842:[[105],256],119843:[[106],256],119844:[[107],256],119845:[[108],256],119846:[[109],256],119847:[[110],256],119848:[[111],256],119849:[[112],256],119850:[[113],256],119851:[[114],256],119852:[[115],256],119853:[[116],256],119854:[[117],256],119855:[[118],256],119856:[[119],256],119857:[[120],256],119858:[[121],256],119859:[[122],256],119860:[[65],256],119861:[[66],256],119862:[[67],256],119863:[[68],256],119864:[[69],256],119865:[[70],256],119866:[[71],256],119867:[[72],256],119868:[[73],256],119869:[[74],256],119870:[[75],256],119871:[[76],256],119872:[[77],256],119873:[[78],256],119874:[[79],256],119875:[[80],256],119876:[[81],256],119877:[[82],256],119878:[[83],256],119879:[[84],256],119880:[[85],256],119881:[[86],256],119882:[[87],256],119883:[[88],256],119884:[[89],256],119885:[[90],256],119886:[[97],256],119887:[[98],256],119888:[[99],256],119889:[[100],256],119890:[[101],256],119891:[[102],256],119892:[[103],256],119894:[[105],256],119895:[[106],256],119896:[[107],256],119897:[[108],256],119898:[[109],256],119899:[[110],256],119900:[[111],256],119901:[[112],256],119902:[[113],256],119903:[[114],256],119904:[[115],256],119905:[[116],256],119906:[[117],256],119907:[[118],256],119908:[[119],256],119909:[[120],256],119910:[[121],256],119911:[[122],256],119912:[[65],256],119913:[[66],256],119914:[[67],256],119915:[[68],256],119916:[[69],256],119917:[[70],256],119918:[[71],256],119919:[[72],256],119920:[[73],256],119921:[[74],256],119922:[[75],256],119923:[[76],256],119924:[[77],256],119925:[[78],256],119926:[[79],256],119927:[[80],256],119928:[[81],256],119929:[[82],256],119930:[[83],256],119931:[[84],256],119932:[[85],256],119933:[[86],256],119934:[[87],256],119935:[[88],256],119936:[[89],256],119937:[[90],256],119938:[[97],256],119939:[[98],256],119940:[[99],256],119941:[[100],256],119942:[[101],256],119943:[[102],256],119944:[[103],256],119945:[[104],256],119946:[[105],256],119947:[[106],256],119948:[[107],256],119949:[[108],256],119950:[[109],256],119951:[[110],256],119952:[[111],256],119953:[[112],256],119954:[[113],256],119955:[[114],256],119956:[[115],256],119957:[[116],256],119958:[[117],256],119959:[[118],256],119960:[[119],256],119961:[[120],256],119962:[[121],256],119963:[[122],256],119964:[[65],256],119966:[[67],256],119967:[[68],256],119970:[[71],256],119973:[[74],256],119974:[[75],256],119977:[[78],256],119978:[[79],256],119979:[[80],256],119980:[[81],256],119982:[[83],256],119983:[[84],256],119984:[[85],256],119985:[[86],256],119986:[[87],256],119987:[[88],256],119988:[[89],256],119989:[[90],256],119990:[[97],256],119991:[[98],256],119992:[[99],256],119993:[[100],256],119995:[[102],256],119997:[[104],256],119998:[[105],256],119999:[[106],256],120000:[[107],256],120001:[[108],256],120002:[[109],256],120003:[[110],256],120005:[[112],256],120006:[[113],256],120007:[[114],256],120008:[[115],256],120009:[[116],256],120010:[[117],256],120011:[[118],256],120012:[[119],256],120013:[[120],256],120014:[[121],256],120015:[[122],256],120016:[[65],256],120017:[[66],256],120018:[[67],256],120019:[[68],256],120020:[[69],256],120021:[[70],256],120022:[[71],256],120023:[[72],256],120024:[[73],256],120025:[[74],256],120026:[[75],256],120027:[[76],256],120028:[[77],256],120029:[[78],256],120030:[[79],256],120031:[[80],256],120032:[[81],256],120033:[[82],256],120034:[[83],256],120035:[[84],256],120036:[[85],256],120037:[[86],256],120038:[[87],256],120039:[[88],256],120040:[[89],256],120041:[[90],256],120042:[[97],256],120043:[[98],256],120044:[[99],256],120045:[[100],256],120046:[[101],256],120047:[[102],256],120048:[[103],256],120049:[[104],256],120050:[[105],256],120051:[[106],256],120052:[[107],256],120053:[[108],256],120054:[[109],256],120055:[[110],256],120056:[[111],256],120057:[[112],256],120058:[[113],256],120059:[[114],256],120060:[[115],256],120061:[[116],256],120062:[[117],256],120063:[[118],256]}, + 54528:{120064:[[119],256],120065:[[120],256],120066:[[121],256],120067:[[122],256],120068:[[65],256],120069:[[66],256],120071:[[68],256],120072:[[69],256],120073:[[70],256],120074:[[71],256],120077:[[74],256],120078:[[75],256],120079:[[76],256],120080:[[77],256],120081:[[78],256],120082:[[79],256],120083:[[80],256],120084:[[81],256],120086:[[83],256],120087:[[84],256],120088:[[85],256],120089:[[86],256],120090:[[87],256],120091:[[88],256],120092:[[89],256],120094:[[97],256],120095:[[98],256],120096:[[99],256],120097:[[100],256],120098:[[101],256],120099:[[102],256],120100:[[103],256],120101:[[104],256],120102:[[105],256],120103:[[106],256],120104:[[107],256],120105:[[108],256],120106:[[109],256],120107:[[110],256],120108:[[111],256],120109:[[112],256],120110:[[113],256],120111:[[114],256],120112:[[115],256],120113:[[116],256],120114:[[117],256],120115:[[118],256],120116:[[119],256],120117:[[120],256],120118:[[121],256],120119:[[122],256],120120:[[65],256],120121:[[66],256],120123:[[68],256],120124:[[69],256],120125:[[70],256],120126:[[71],256],120128:[[73],256],120129:[[74],256],120130:[[75],256],120131:[[76],256],120132:[[77],256],120134:[[79],256],120138:[[83],256],120139:[[84],256],120140:[[85],256],120141:[[86],256],120142:[[87],256],120143:[[88],256],120144:[[89],256],120146:[[97],256],120147:[[98],256],120148:[[99],256],120149:[[100],256],120150:[[101],256],120151:[[102],256],120152:[[103],256],120153:[[104],256],120154:[[105],256],120155:[[106],256],120156:[[107],256],120157:[[108],256],120158:[[109],256],120159:[[110],256],120160:[[111],256],120161:[[112],256],120162:[[113],256],120163:[[114],256],120164:[[115],256],120165:[[116],256],120166:[[117],256],120167:[[118],256],120168:[[119],256],120169:[[120],256],120170:[[121],256],120171:[[122],256],120172:[[65],256],120173:[[66],256],120174:[[67],256],120175:[[68],256],120176:[[69],256],120177:[[70],256],120178:[[71],256],120179:[[72],256],120180:[[73],256],120181:[[74],256],120182:[[75],256],120183:[[76],256],120184:[[77],256],120185:[[78],256],120186:[[79],256],120187:[[80],256],120188:[[81],256],120189:[[82],256],120190:[[83],256],120191:[[84],256],120192:[[85],256],120193:[[86],256],120194:[[87],256],120195:[[88],256],120196:[[89],256],120197:[[90],256],120198:[[97],256],120199:[[98],256],120200:[[99],256],120201:[[100],256],120202:[[101],256],120203:[[102],256],120204:[[103],256],120205:[[104],256],120206:[[105],256],120207:[[106],256],120208:[[107],256],120209:[[108],256],120210:[[109],256],120211:[[110],256],120212:[[111],256],120213:[[112],256],120214:[[113],256],120215:[[114],256],120216:[[115],256],120217:[[116],256],120218:[[117],256],120219:[[118],256],120220:[[119],256],120221:[[120],256],120222:[[121],256],120223:[[122],256],120224:[[65],256],120225:[[66],256],120226:[[67],256],120227:[[68],256],120228:[[69],256],120229:[[70],256],120230:[[71],256],120231:[[72],256],120232:[[73],256],120233:[[74],256],120234:[[75],256],120235:[[76],256],120236:[[77],256],120237:[[78],256],120238:[[79],256],120239:[[80],256],120240:[[81],256],120241:[[82],256],120242:[[83],256],120243:[[84],256],120244:[[85],256],120245:[[86],256],120246:[[87],256],120247:[[88],256],120248:[[89],256],120249:[[90],256],120250:[[97],256],120251:[[98],256],120252:[[99],256],120253:[[100],256],120254:[[101],256],120255:[[102],256],120256:[[103],256],120257:[[104],256],120258:[[105],256],120259:[[106],256],120260:[[107],256],120261:[[108],256],120262:[[109],256],120263:[[110],256],120264:[[111],256],120265:[[112],256],120266:[[113],256],120267:[[114],256],120268:[[115],256],120269:[[116],256],120270:[[117],256],120271:[[118],256],120272:[[119],256],120273:[[120],256],120274:[[121],256],120275:[[122],256],120276:[[65],256],120277:[[66],256],120278:[[67],256],120279:[[68],256],120280:[[69],256],120281:[[70],256],120282:[[71],256],120283:[[72],256],120284:[[73],256],120285:[[74],256],120286:[[75],256],120287:[[76],256],120288:[[77],256],120289:[[78],256],120290:[[79],256],120291:[[80],256],120292:[[81],256],120293:[[82],256],120294:[[83],256],120295:[[84],256],120296:[[85],256],120297:[[86],256],120298:[[87],256],120299:[[88],256],120300:[[89],256],120301:[[90],256],120302:[[97],256],120303:[[98],256],120304:[[99],256],120305:[[100],256],120306:[[101],256],120307:[[102],256],120308:[[103],256],120309:[[104],256],120310:[[105],256],120311:[[106],256],120312:[[107],256],120313:[[108],256],120314:[[109],256],120315:[[110],256],120316:[[111],256],120317:[[112],256],120318:[[113],256],120319:[[114],256]}, + 54784:{120320:[[115],256],120321:[[116],256],120322:[[117],256],120323:[[118],256],120324:[[119],256],120325:[[120],256],120326:[[121],256],120327:[[122],256],120328:[[65],256],120329:[[66],256],120330:[[67],256],120331:[[68],256],120332:[[69],256],120333:[[70],256],120334:[[71],256],120335:[[72],256],120336:[[73],256],120337:[[74],256],120338:[[75],256],120339:[[76],256],120340:[[77],256],120341:[[78],256],120342:[[79],256],120343:[[80],256],120344:[[81],256],120345:[[82],256],120346:[[83],256],120347:[[84],256],120348:[[85],256],120349:[[86],256],120350:[[87],256],120351:[[88],256],120352:[[89],256],120353:[[90],256],120354:[[97],256],120355:[[98],256],120356:[[99],256],120357:[[100],256],120358:[[101],256],120359:[[102],256],120360:[[103],256],120361:[[104],256],120362:[[105],256],120363:[[106],256],120364:[[107],256],120365:[[108],256],120366:[[109],256],120367:[[110],256],120368:[[111],256],120369:[[112],256],120370:[[113],256],120371:[[114],256],120372:[[115],256],120373:[[116],256],120374:[[117],256],120375:[[118],256],120376:[[119],256],120377:[[120],256],120378:[[121],256],120379:[[122],256],120380:[[65],256],120381:[[66],256],120382:[[67],256],120383:[[68],256],120384:[[69],256],120385:[[70],256],120386:[[71],256],120387:[[72],256],120388:[[73],256],120389:[[74],256],120390:[[75],256],120391:[[76],256],120392:[[77],256],120393:[[78],256],120394:[[79],256],120395:[[80],256],120396:[[81],256],120397:[[82],256],120398:[[83],256],120399:[[84],256],120400:[[85],256],120401:[[86],256],120402:[[87],256],120403:[[88],256],120404:[[89],256],120405:[[90],256],120406:[[97],256],120407:[[98],256],120408:[[99],256],120409:[[100],256],120410:[[101],256],120411:[[102],256],120412:[[103],256],120413:[[104],256],120414:[[105],256],120415:[[106],256],120416:[[107],256],120417:[[108],256],120418:[[109],256],120419:[[110],256],120420:[[111],256],120421:[[112],256],120422:[[113],256],120423:[[114],256],120424:[[115],256],120425:[[116],256],120426:[[117],256],120427:[[118],256],120428:[[119],256],120429:[[120],256],120430:[[121],256],120431:[[122],256],120432:[[65],256],120433:[[66],256],120434:[[67],256],120435:[[68],256],120436:[[69],256],120437:[[70],256],120438:[[71],256],120439:[[72],256],120440:[[73],256],120441:[[74],256],120442:[[75],256],120443:[[76],256],120444:[[77],256],120445:[[78],256],120446:[[79],256],120447:[[80],256],120448:[[81],256],120449:[[82],256],120450:[[83],256],120451:[[84],256],120452:[[85],256],120453:[[86],256],120454:[[87],256],120455:[[88],256],120456:[[89],256],120457:[[90],256],120458:[[97],256],120459:[[98],256],120460:[[99],256],120461:[[100],256],120462:[[101],256],120463:[[102],256],120464:[[103],256],120465:[[104],256],120466:[[105],256],120467:[[106],256],120468:[[107],256],120469:[[108],256],120470:[[109],256],120471:[[110],256],120472:[[111],256],120473:[[112],256],120474:[[113],256],120475:[[114],256],120476:[[115],256],120477:[[116],256],120478:[[117],256],120479:[[118],256],120480:[[119],256],120481:[[120],256],120482:[[121],256],120483:[[122],256],120484:[[305],256],120485:[[567],256],120488:[[913],256],120489:[[914],256],120490:[[915],256],120491:[[916],256],120492:[[917],256],120493:[[918],256],120494:[[919],256],120495:[[920],256],120496:[[921],256],120497:[[922],256],120498:[[923],256],120499:[[924],256],120500:[[925],256],120501:[[926],256],120502:[[927],256],120503:[[928],256],120504:[[929],256],120505:[[1012],256],120506:[[931],256],120507:[[932],256],120508:[[933],256],120509:[[934],256],120510:[[935],256],120511:[[936],256],120512:[[937],256],120513:[[8711],256],120514:[[945],256],120515:[[946],256],120516:[[947],256],120517:[[948],256],120518:[[949],256],120519:[[950],256],120520:[[951],256],120521:[[952],256],120522:[[953],256],120523:[[954],256],120524:[[955],256],120525:[[956],256],120526:[[957],256],120527:[[958],256],120528:[[959],256],120529:[[960],256],120530:[[961],256],120531:[[962],256],120532:[[963],256],120533:[[964],256],120534:[[965],256],120535:[[966],256],120536:[[967],256],120537:[[968],256],120538:[[969],256],120539:[[8706],256],120540:[[1013],256],120541:[[977],256],120542:[[1008],256],120543:[[981],256],120544:[[1009],256],120545:[[982],256],120546:[[913],256],120547:[[914],256],120548:[[915],256],120549:[[916],256],120550:[[917],256],120551:[[918],256],120552:[[919],256],120553:[[920],256],120554:[[921],256],120555:[[922],256],120556:[[923],256],120557:[[924],256],120558:[[925],256],120559:[[926],256],120560:[[927],256],120561:[[928],256],120562:[[929],256],120563:[[1012],256],120564:[[931],256],120565:[[932],256],120566:[[933],256],120567:[[934],256],120568:[[935],256],120569:[[936],256],120570:[[937],256],120571:[[8711],256],120572:[[945],256],120573:[[946],256],120574:[[947],256],120575:[[948],256]}, + 55040:{120576:[[949],256],120577:[[950],256],120578:[[951],256],120579:[[952],256],120580:[[953],256],120581:[[954],256],120582:[[955],256],120583:[[956],256],120584:[[957],256],120585:[[958],256],120586:[[959],256],120587:[[960],256],120588:[[961],256],120589:[[962],256],120590:[[963],256],120591:[[964],256],120592:[[965],256],120593:[[966],256],120594:[[967],256],120595:[[968],256],120596:[[969],256],120597:[[8706],256],120598:[[1013],256],120599:[[977],256],120600:[[1008],256],120601:[[981],256],120602:[[1009],256],120603:[[982],256],120604:[[913],256],120605:[[914],256],120606:[[915],256],120607:[[916],256],120608:[[917],256],120609:[[918],256],120610:[[919],256],120611:[[920],256],120612:[[921],256],120613:[[922],256],120614:[[923],256],120615:[[924],256],120616:[[925],256],120617:[[926],256],120618:[[927],256],120619:[[928],256],120620:[[929],256],120621:[[1012],256],120622:[[931],256],120623:[[932],256],120624:[[933],256],120625:[[934],256],120626:[[935],256],120627:[[936],256],120628:[[937],256],120629:[[8711],256],120630:[[945],256],120631:[[946],256],120632:[[947],256],120633:[[948],256],120634:[[949],256],120635:[[950],256],120636:[[951],256],120637:[[952],256],120638:[[953],256],120639:[[954],256],120640:[[955],256],120641:[[956],256],120642:[[957],256],120643:[[958],256],120644:[[959],256],120645:[[960],256],120646:[[961],256],120647:[[962],256],120648:[[963],256],120649:[[964],256],120650:[[965],256],120651:[[966],256],120652:[[967],256],120653:[[968],256],120654:[[969],256],120655:[[8706],256],120656:[[1013],256],120657:[[977],256],120658:[[1008],256],120659:[[981],256],120660:[[1009],256],120661:[[982],256],120662:[[913],256],120663:[[914],256],120664:[[915],256],120665:[[916],256],120666:[[917],256],120667:[[918],256],120668:[[919],256],120669:[[920],256],120670:[[921],256],120671:[[922],256],120672:[[923],256],120673:[[924],256],120674:[[925],256],120675:[[926],256],120676:[[927],256],120677:[[928],256],120678:[[929],256],120679:[[1012],256],120680:[[931],256],120681:[[932],256],120682:[[933],256],120683:[[934],256],120684:[[935],256],120685:[[936],256],120686:[[937],256],120687:[[8711],256],120688:[[945],256],120689:[[946],256],120690:[[947],256],120691:[[948],256],120692:[[949],256],120693:[[950],256],120694:[[951],256],120695:[[952],256],120696:[[953],256],120697:[[954],256],120698:[[955],256],120699:[[956],256],120700:[[957],256],120701:[[958],256],120702:[[959],256],120703:[[960],256],120704:[[961],256],120705:[[962],256],120706:[[963],256],120707:[[964],256],120708:[[965],256],120709:[[966],256],120710:[[967],256],120711:[[968],256],120712:[[969],256],120713:[[8706],256],120714:[[1013],256],120715:[[977],256],120716:[[1008],256],120717:[[981],256],120718:[[1009],256],120719:[[982],256],120720:[[913],256],120721:[[914],256],120722:[[915],256],120723:[[916],256],120724:[[917],256],120725:[[918],256],120726:[[919],256],120727:[[920],256],120728:[[921],256],120729:[[922],256],120730:[[923],256],120731:[[924],256],120732:[[925],256],120733:[[926],256],120734:[[927],256],120735:[[928],256],120736:[[929],256],120737:[[1012],256],120738:[[931],256],120739:[[932],256],120740:[[933],256],120741:[[934],256],120742:[[935],256],120743:[[936],256],120744:[[937],256],120745:[[8711],256],120746:[[945],256],120747:[[946],256],120748:[[947],256],120749:[[948],256],120750:[[949],256],120751:[[950],256],120752:[[951],256],120753:[[952],256],120754:[[953],256],120755:[[954],256],120756:[[955],256],120757:[[956],256],120758:[[957],256],120759:[[958],256],120760:[[959],256],120761:[[960],256],120762:[[961],256],120763:[[962],256],120764:[[963],256],120765:[[964],256],120766:[[965],256],120767:[[966],256],120768:[[967],256],120769:[[968],256],120770:[[969],256],120771:[[8706],256],120772:[[1013],256],120773:[[977],256],120774:[[1008],256],120775:[[981],256],120776:[[1009],256],120777:[[982],256],120778:[[988],256],120779:[[989],256],120782:[[48],256],120783:[[49],256],120784:[[50],256],120785:[[51],256],120786:[[52],256],120787:[[53],256],120788:[[54],256],120789:[[55],256],120790:[[56],256],120791:[[57],256],120792:[[48],256],120793:[[49],256],120794:[[50],256],120795:[[51],256],120796:[[52],256],120797:[[53],256],120798:[[54],256],120799:[[55],256],120800:[[56],256],120801:[[57],256],120802:[[48],256],120803:[[49],256],120804:[[50],256],120805:[[51],256],120806:[[52],256],120807:[[53],256],120808:[[54],256],120809:[[55],256],120810:[[56],256],120811:[[57],256],120812:[[48],256],120813:[[49],256],120814:[[50],256],120815:[[51],256],120816:[[52],256],120817:[[53],256],120818:[[54],256],120819:[[55],256],120820:[[56],256],120821:[[57],256],120822:[[48],256],120823:[[49],256],120824:[[50],256],120825:[[51],256],120826:[[52],256],120827:[[53],256],120828:[[54],256],120829:[[55],256],120830:[[56],256],120831:[[57],256]}, + 60928:{126464:[[1575],256],126465:[[1576],256],126466:[[1580],256],126467:[[1583],256],126469:[[1608],256],126470:[[1586],256],126471:[[1581],256],126472:[[1591],256],126473:[[1610],256],126474:[[1603],256],126475:[[1604],256],126476:[[1605],256],126477:[[1606],256],126478:[[1587],256],126479:[[1593],256],126480:[[1601],256],126481:[[1589],256],126482:[[1602],256],126483:[[1585],256],126484:[[1588],256],126485:[[1578],256],126486:[[1579],256],126487:[[1582],256],126488:[[1584],256],126489:[[1590],256],126490:[[1592],256],126491:[[1594],256],126492:[[1646],256],126493:[[1722],256],126494:[[1697],256],126495:[[1647],256],126497:[[1576],256],126498:[[1580],256],126500:[[1607],256],126503:[[1581],256],126505:[[1610],256],126506:[[1603],256],126507:[[1604],256],126508:[[1605],256],126509:[[1606],256],126510:[[1587],256],126511:[[1593],256],126512:[[1601],256],126513:[[1589],256],126514:[[1602],256],126516:[[1588],256],126517:[[1578],256],126518:[[1579],256],126519:[[1582],256],126521:[[1590],256],126523:[[1594],256],126530:[[1580],256],126535:[[1581],256],126537:[[1610],256],126539:[[1604],256],126541:[[1606],256],126542:[[1587],256],126543:[[1593],256],126545:[[1589],256],126546:[[1602],256],126548:[[1588],256],126551:[[1582],256],126553:[[1590],256],126555:[[1594],256],126557:[[1722],256],126559:[[1647],256],126561:[[1576],256],126562:[[1580],256],126564:[[1607],256],126567:[[1581],256],126568:[[1591],256],126569:[[1610],256],126570:[[1603],256],126572:[[1605],256],126573:[[1606],256],126574:[[1587],256],126575:[[1593],256],126576:[[1601],256],126577:[[1589],256],126578:[[1602],256],126580:[[1588],256],126581:[[1578],256],126582:[[1579],256],126583:[[1582],256],126585:[[1590],256],126586:[[1592],256],126587:[[1594],256],126588:[[1646],256],126590:[[1697],256],126592:[[1575],256],126593:[[1576],256],126594:[[1580],256],126595:[[1583],256],126596:[[1607],256],126597:[[1608],256],126598:[[1586],256],126599:[[1581],256],126600:[[1591],256],126601:[[1610],256],126603:[[1604],256],126604:[[1605],256],126605:[[1606],256],126606:[[1587],256],126607:[[1593],256],126608:[[1601],256],126609:[[1589],256],126610:[[1602],256],126611:[[1585],256],126612:[[1588],256],126613:[[1578],256],126614:[[1579],256],126615:[[1582],256],126616:[[1584],256],126617:[[1590],256],126618:[[1592],256],126619:[[1594],256],126625:[[1576],256],126626:[[1580],256],126627:[[1583],256],126629:[[1608],256],126630:[[1586],256],126631:[[1581],256],126632:[[1591],256],126633:[[1610],256],126635:[[1604],256],126636:[[1605],256],126637:[[1606],256],126638:[[1587],256],126639:[[1593],256],126640:[[1601],256],126641:[[1589],256],126642:[[1602],256],126643:[[1585],256],126644:[[1588],256],126645:[[1578],256],126646:[[1579],256],126647:[[1582],256],126648:[[1584],256],126649:[[1590],256],126650:[[1592],256],126651:[[1594],256]}, + 61696:{127232:[[48,46],256],127233:[[48,44],256],127234:[[49,44],256],127235:[[50,44],256],127236:[[51,44],256],127237:[[52,44],256],127238:[[53,44],256],127239:[[54,44],256],127240:[[55,44],256],127241:[[56,44],256],127242:[[57,44],256],127248:[[40,65,41],256],127249:[[40,66,41],256],127250:[[40,67,41],256],127251:[[40,68,41],256],127252:[[40,69,41],256],127253:[[40,70,41],256],127254:[[40,71,41],256],127255:[[40,72,41],256],127256:[[40,73,41],256],127257:[[40,74,41],256],127258:[[40,75,41],256],127259:[[40,76,41],256],127260:[[40,77,41],256],127261:[[40,78,41],256],127262:[[40,79,41],256],127263:[[40,80,41],256],127264:[[40,81,41],256],127265:[[40,82,41],256],127266:[[40,83,41],256],127267:[[40,84,41],256],127268:[[40,85,41],256],127269:[[40,86,41],256],127270:[[40,87,41],256],127271:[[40,88,41],256],127272:[[40,89,41],256],127273:[[40,90,41],256],127274:[[12308,83,12309],256],127275:[[67],256],127276:[[82],256],127277:[[67,68],256],127278:[[87,90],256],127280:[[65],256],127281:[[66],256],127282:[[67],256],127283:[[68],256],127284:[[69],256],127285:[[70],256],127286:[[71],256],127287:[[72],256],127288:[[73],256],127289:[[74],256],127290:[[75],256],127291:[[76],256],127292:[[77],256],127293:[[78],256],127294:[[79],256],127295:[[80],256],127296:[[81],256],127297:[[82],256],127298:[[83],256],127299:[[84],256],127300:[[85],256],127301:[[86],256],127302:[[87],256],127303:[[88],256],127304:[[89],256],127305:[[90],256],127306:[[72,86],256],127307:[[77,86],256],127308:[[83,68],256],127309:[[83,83],256],127310:[[80,80,86],256],127311:[[87,67],256],127338:[[77,67],256],127339:[[77,68],256],127376:[[68,74],256]}, + 61952:{127488:[[12411,12363],256],127489:[[12467,12467],256],127490:[[12469],256],127504:[[25163],256],127505:[[23383],256],127506:[[21452],256],127507:[[12487],256],127508:[[20108],256],127509:[[22810],256],127510:[[35299],256],127511:[[22825],256],127512:[[20132],256],127513:[[26144],256],127514:[[28961],256],127515:[[26009],256],127516:[[21069],256],127517:[[24460],256],127518:[[20877],256],127519:[[26032],256],127520:[[21021],256],127521:[[32066],256],127522:[[29983],256],127523:[[36009],256],127524:[[22768],256],127525:[[21561],256],127526:[[28436],256],127527:[[25237],256],127528:[[25429],256],127529:[[19968],256],127530:[[19977],256],127531:[[36938],256],127532:[[24038],256],127533:[[20013],256],127534:[[21491],256],127535:[[25351],256],127536:[[36208],256],127537:[[25171],256],127538:[[31105],256],127539:[[31354],256],127540:[[21512],256],127541:[[28288],256],127542:[[26377],256],127543:[[26376],256],127544:[[30003],256],127545:[[21106],256],127546:[[21942],256],127552:[[12308,26412,12309],256],127553:[[12308,19977,12309],256],127554:[[12308,20108,12309],256],127555:[[12308,23433,12309],256],127556:[[12308,28857,12309],256],127557:[[12308,25171,12309],256],127558:[[12308,30423,12309],256],127559:[[12308,21213,12309],256],127560:[[12308,25943,12309],256],127568:[[24471],256],127569:[[21487],256]}, + 63488:{194560:[[20029]],194561:[[20024]],194562:[[20033]],194563:[[131362]],194564:[[20320]],194565:[[20398]],194566:[[20411]],194567:[[20482]],194568:[[20602]],194569:[[20633]],194570:[[20711]],194571:[[20687]],194572:[[13470]],194573:[[132666]],194574:[[20813]],194575:[[20820]],194576:[[20836]],194577:[[20855]],194578:[[132380]],194579:[[13497]],194580:[[20839]],194581:[[20877]],194582:[[132427]],194583:[[20887]],194584:[[20900]],194585:[[20172]],194586:[[20908]],194587:[[20917]],194588:[[168415]],194589:[[20981]],194590:[[20995]],194591:[[13535]],194592:[[21051]],194593:[[21062]],194594:[[21106]],194595:[[21111]],194596:[[13589]],194597:[[21191]],194598:[[21193]],194599:[[21220]],194600:[[21242]],194601:[[21253]],194602:[[21254]],194603:[[21271]],194604:[[21321]],194605:[[21329]],194606:[[21338]],194607:[[21363]],194608:[[21373]],194609:[[21375]],194610:[[21375]],194611:[[21375]],194612:[[133676]],194613:[[28784]],194614:[[21450]],194615:[[21471]],194616:[[133987]],194617:[[21483]],194618:[[21489]],194619:[[21510]],194620:[[21662]],194621:[[21560]],194622:[[21576]],194623:[[21608]],194624:[[21666]],194625:[[21750]],194626:[[21776]],194627:[[21843]],194628:[[21859]],194629:[[21892]],194630:[[21892]],194631:[[21913]],194632:[[21931]],194633:[[21939]],194634:[[21954]],194635:[[22294]],194636:[[22022]],194637:[[22295]],194638:[[22097]],194639:[[22132]],194640:[[20999]],194641:[[22766]],194642:[[22478]],194643:[[22516]],194644:[[22541]],194645:[[22411]],194646:[[22578]],194647:[[22577]],194648:[[22700]],194649:[[136420]],194650:[[22770]],194651:[[22775]],194652:[[22790]],194653:[[22810]],194654:[[22818]],194655:[[22882]],194656:[[136872]],194657:[[136938]],194658:[[23020]],194659:[[23067]],194660:[[23079]],194661:[[23000]],194662:[[23142]],194663:[[14062]],194664:[[14076]],194665:[[23304]],194666:[[23358]],194667:[[23358]],194668:[[137672]],194669:[[23491]],194670:[[23512]],194671:[[23527]],194672:[[23539]],194673:[[138008]],194674:[[23551]],194675:[[23558]],194676:[[24403]],194677:[[23586]],194678:[[14209]],194679:[[23648]],194680:[[23662]],194681:[[23744]],194682:[[23693]],194683:[[138724]],194684:[[23875]],194685:[[138726]],194686:[[23918]],194687:[[23915]],194688:[[23932]],194689:[[24033]],194690:[[24034]],194691:[[14383]],194692:[[24061]],194693:[[24104]],194694:[[24125]],194695:[[24169]],194696:[[14434]],194697:[[139651]],194698:[[14460]],194699:[[24240]],194700:[[24243]],194701:[[24246]],194702:[[24266]],194703:[[172946]],194704:[[24318]],194705:[[140081]],194706:[[140081]],194707:[[33281]],194708:[[24354]],194709:[[24354]],194710:[[14535]],194711:[[144056]],194712:[[156122]],194713:[[24418]],194714:[[24427]],194715:[[14563]],194716:[[24474]],194717:[[24525]],194718:[[24535]],194719:[[24569]],194720:[[24705]],194721:[[14650]],194722:[[14620]],194723:[[24724]],194724:[[141012]],194725:[[24775]],194726:[[24904]],194727:[[24908]],194728:[[24910]],194729:[[24908]],194730:[[24954]],194731:[[24974]],194732:[[25010]],194733:[[24996]],194734:[[25007]],194735:[[25054]],194736:[[25074]],194737:[[25078]],194738:[[25104]],194739:[[25115]],194740:[[25181]],194741:[[25265]],194742:[[25300]],194743:[[25424]],194744:[[142092]],194745:[[25405]],194746:[[25340]],194747:[[25448]],194748:[[25475]],194749:[[25572]],194750:[[142321]],194751:[[25634]],194752:[[25541]],194753:[[25513]],194754:[[14894]],194755:[[25705]],194756:[[25726]],194757:[[25757]],194758:[[25719]],194759:[[14956]],194760:[[25935]],194761:[[25964]],194762:[[143370]],194763:[[26083]],194764:[[26360]],194765:[[26185]],194766:[[15129]],194767:[[26257]],194768:[[15112]],194769:[[15076]],194770:[[20882]],194771:[[20885]],194772:[[26368]],194773:[[26268]],194774:[[32941]],194775:[[17369]],194776:[[26391]],194777:[[26395]],194778:[[26401]],194779:[[26462]],194780:[[26451]],194781:[[144323]],194782:[[15177]],194783:[[26618]],194784:[[26501]],194785:[[26706]],194786:[[26757]],194787:[[144493]],194788:[[26766]],194789:[[26655]],194790:[[26900]],194791:[[15261]],194792:[[26946]],194793:[[27043]],194794:[[27114]],194795:[[27304]],194796:[[145059]],194797:[[27355]],194798:[[15384]],194799:[[27425]],194800:[[145575]],194801:[[27476]],194802:[[15438]],194803:[[27506]],194804:[[27551]],194805:[[27578]],194806:[[27579]],194807:[[146061]],194808:[[138507]],194809:[[146170]],194810:[[27726]],194811:[[146620]],194812:[[27839]],194813:[[27853]],194814:[[27751]],194815:[[27926]]}, + 63744:{63744:[[35912]],63745:[[26356]],63746:[[36554]],63747:[[36040]],63748:[[28369]],63749:[[20018]],63750:[[21477]],63751:[[40860]],63752:[[40860]],63753:[[22865]],63754:[[37329]],63755:[[21895]],63756:[[22856]],63757:[[25078]],63758:[[30313]],63759:[[32645]],63760:[[34367]],63761:[[34746]],63762:[[35064]],63763:[[37007]],63764:[[27138]],63765:[[27931]],63766:[[28889]],63767:[[29662]],63768:[[33853]],63769:[[37226]],63770:[[39409]],63771:[[20098]],63772:[[21365]],63773:[[27396]],63774:[[29211]],63775:[[34349]],63776:[[40478]],63777:[[23888]],63778:[[28651]],63779:[[34253]],63780:[[35172]],63781:[[25289]],63782:[[33240]],63783:[[34847]],63784:[[24266]],63785:[[26391]],63786:[[28010]],63787:[[29436]],63788:[[37070]],63789:[[20358]],63790:[[20919]],63791:[[21214]],63792:[[25796]],63793:[[27347]],63794:[[29200]],63795:[[30439]],63796:[[32769]],63797:[[34310]],63798:[[34396]],63799:[[36335]],63800:[[38706]],63801:[[39791]],63802:[[40442]],63803:[[30860]],63804:[[31103]],63805:[[32160]],63806:[[33737]],63807:[[37636]],63808:[[40575]],63809:[[35542]],63810:[[22751]],63811:[[24324]],63812:[[31840]],63813:[[32894]],63814:[[29282]],63815:[[30922]],63816:[[36034]],63817:[[38647]],63818:[[22744]],63819:[[23650]],63820:[[27155]],63821:[[28122]],63822:[[28431]],63823:[[32047]],63824:[[32311]],63825:[[38475]],63826:[[21202]],63827:[[32907]],63828:[[20956]],63829:[[20940]],63830:[[31260]],63831:[[32190]],63832:[[33777]],63833:[[38517]],63834:[[35712]],63835:[[25295]],63836:[[27138]],63837:[[35582]],63838:[[20025]],63839:[[23527]],63840:[[24594]],63841:[[29575]],63842:[[30064]],63843:[[21271]],63844:[[30971]],63845:[[20415]],63846:[[24489]],63847:[[19981]],63848:[[27852]],63849:[[25976]],63850:[[32034]],63851:[[21443]],63852:[[22622]],63853:[[30465]],63854:[[33865]],63855:[[35498]],63856:[[27578]],63857:[[36784]],63858:[[27784]],63859:[[25342]],63860:[[33509]],63861:[[25504]],63862:[[30053]],63863:[[20142]],63864:[[20841]],63865:[[20937]],63866:[[26753]],63867:[[31975]],63868:[[33391]],63869:[[35538]],63870:[[37327]],63871:[[21237]],63872:[[21570]],63873:[[22899]],63874:[[24300]],63875:[[26053]],63876:[[28670]],63877:[[31018]],63878:[[38317]],63879:[[39530]],63880:[[40599]],63881:[[40654]],63882:[[21147]],63883:[[26310]],63884:[[27511]],63885:[[36706]],63886:[[24180]],63887:[[24976]],63888:[[25088]],63889:[[25754]],63890:[[28451]],63891:[[29001]],63892:[[29833]],63893:[[31178]],63894:[[32244]],63895:[[32879]],63896:[[36646]],63897:[[34030]],63898:[[36899]],63899:[[37706]],63900:[[21015]],63901:[[21155]],63902:[[21693]],63903:[[28872]],63904:[[35010]],63905:[[35498]],63906:[[24265]],63907:[[24565]],63908:[[25467]],63909:[[27566]],63910:[[31806]],63911:[[29557]],63912:[[20196]],63913:[[22265]],63914:[[23527]],63915:[[23994]],63916:[[24604]],63917:[[29618]],63918:[[29801]],63919:[[32666]],63920:[[32838]],63921:[[37428]],63922:[[38646]],63923:[[38728]],63924:[[38936]],63925:[[20363]],63926:[[31150]],63927:[[37300]],63928:[[38584]],63929:[[24801]],63930:[[20102]],63931:[[20698]],63932:[[23534]],63933:[[23615]],63934:[[26009]],63935:[[27138]],63936:[[29134]],63937:[[30274]],63938:[[34044]],63939:[[36988]],63940:[[40845]],63941:[[26248]],63942:[[38446]],63943:[[21129]],63944:[[26491]],63945:[[26611]],63946:[[27969]],63947:[[28316]],63948:[[29705]],63949:[[30041]],63950:[[30827]],63951:[[32016]],63952:[[39006]],63953:[[20845]],63954:[[25134]],63955:[[38520]],63956:[[20523]],63957:[[23833]],63958:[[28138]],63959:[[36650]],63960:[[24459]],63961:[[24900]],63962:[[26647]],63963:[[29575]],63964:[[38534]],63965:[[21033]],63966:[[21519]],63967:[[23653]],63968:[[26131]],63969:[[26446]],63970:[[26792]],63971:[[27877]],63972:[[29702]],63973:[[30178]],63974:[[32633]],63975:[[35023]],63976:[[35041]],63977:[[37324]],63978:[[38626]],63979:[[21311]],63980:[[28346]],63981:[[21533]],63982:[[29136]],63983:[[29848]],63984:[[34298]],63985:[[38563]],63986:[[40023]],63987:[[40607]],63988:[[26519]],63989:[[28107]],63990:[[33256]],63991:[[31435]],63992:[[31520]],63993:[[31890]],63994:[[29376]],63995:[[28825]],63996:[[35672]],63997:[[20160]],63998:[[33590]],63999:[[21050]],194816:[[27966]],194817:[[28023]],194818:[[27969]],194819:[[28009]],194820:[[28024]],194821:[[28037]],194822:[[146718]],194823:[[27956]],194824:[[28207]],194825:[[28270]],194826:[[15667]],194827:[[28363]],194828:[[28359]],194829:[[147153]],194830:[[28153]],194831:[[28526]],194832:[[147294]],194833:[[147342]],194834:[[28614]],194835:[[28729]],194836:[[28702]],194837:[[28699]],194838:[[15766]],194839:[[28746]],194840:[[28797]],194841:[[28791]],194842:[[28845]],194843:[[132389]],194844:[[28997]],194845:[[148067]],194846:[[29084]],194847:[[148395]],194848:[[29224]],194849:[[29237]],194850:[[29264]],194851:[[149000]],194852:[[29312]],194853:[[29333]],194854:[[149301]],194855:[[149524]],194856:[[29562]],194857:[[29579]],194858:[[16044]],194859:[[29605]],194860:[[16056]],194861:[[16056]],194862:[[29767]],194863:[[29788]],194864:[[29809]],194865:[[29829]],194866:[[29898]],194867:[[16155]],194868:[[29988]],194869:[[150582]],194870:[[30014]],194871:[[150674]],194872:[[30064]],194873:[[139679]],194874:[[30224]],194875:[[151457]],194876:[[151480]],194877:[[151620]],194878:[[16380]],194879:[[16392]],194880:[[30452]],194881:[[151795]],194882:[[151794]],194883:[[151833]],194884:[[151859]],194885:[[30494]],194886:[[30495]],194887:[[30495]],194888:[[30538]],194889:[[16441]],194890:[[30603]],194891:[[16454]],194892:[[16534]],194893:[[152605]],194894:[[30798]],194895:[[30860]],194896:[[30924]],194897:[[16611]],194898:[[153126]],194899:[[31062]],194900:[[153242]],194901:[[153285]],194902:[[31119]],194903:[[31211]],194904:[[16687]],194905:[[31296]],194906:[[31306]],194907:[[31311]],194908:[[153980]],194909:[[154279]],194910:[[154279]],194911:[[31470]],194912:[[16898]],194913:[[154539]],194914:[[31686]],194915:[[31689]],194916:[[16935]],194917:[[154752]],194918:[[31954]],194919:[[17056]],194920:[[31976]],194921:[[31971]],194922:[[32000]],194923:[[155526]],194924:[[32099]],194925:[[17153]],194926:[[32199]],194927:[[32258]],194928:[[32325]],194929:[[17204]],194930:[[156200]],194931:[[156231]],194932:[[17241]],194933:[[156377]],194934:[[32634]],194935:[[156478]],194936:[[32661]],194937:[[32762]],194938:[[32773]],194939:[[156890]],194940:[[156963]],194941:[[32864]],194942:[[157096]],194943:[[32880]],194944:[[144223]],194945:[[17365]],194946:[[32946]],194947:[[33027]],194948:[[17419]],194949:[[33086]],194950:[[23221]],194951:[[157607]],194952:[[157621]],194953:[[144275]],194954:[[144284]],194955:[[33281]],194956:[[33284]],194957:[[36766]],194958:[[17515]],194959:[[33425]],194960:[[33419]],194961:[[33437]],194962:[[21171]],194963:[[33457]],194964:[[33459]],194965:[[33469]],194966:[[33510]],194967:[[158524]],194968:[[33509]],194969:[[33565]],194970:[[33635]],194971:[[33709]],194972:[[33571]],194973:[[33725]],194974:[[33767]],194975:[[33879]],194976:[[33619]],194977:[[33738]],194978:[[33740]],194979:[[33756]],194980:[[158774]],194981:[[159083]],194982:[[158933]],194983:[[17707]],194984:[[34033]],194985:[[34035]],194986:[[34070]],194987:[[160714]],194988:[[34148]],194989:[[159532]],194990:[[17757]],194991:[[17761]],194992:[[159665]],194993:[[159954]],194994:[[17771]],194995:[[34384]],194996:[[34396]],194997:[[34407]],194998:[[34409]],194999:[[34473]],195000:[[34440]],195001:[[34574]],195002:[[34530]],195003:[[34681]],195004:[[34600]],195005:[[34667]],195006:[[34694]],195007:[[17879]],195008:[[34785]],195009:[[34817]],195010:[[17913]],195011:[[34912]],195012:[[34915]],195013:[[161383]],195014:[[35031]],195015:[[35038]],195016:[[17973]],195017:[[35066]],195018:[[13499]],195019:[[161966]],195020:[[162150]],195021:[[18110]],195022:[[18119]],195023:[[35488]],195024:[[35565]],195025:[[35722]],195026:[[35925]],195027:[[162984]],195028:[[36011]],195029:[[36033]],195030:[[36123]],195031:[[36215]],195032:[[163631]],195033:[[133124]],195034:[[36299]],195035:[[36284]],195036:[[36336]],195037:[[133342]],195038:[[36564]],195039:[[36664]],195040:[[165330]],195041:[[165357]],195042:[[37012]],195043:[[37105]],195044:[[37137]],195045:[[165678]],195046:[[37147]],195047:[[37432]],195048:[[37591]],195049:[[37592]],195050:[[37500]],195051:[[37881]],195052:[[37909]],195053:[[166906]],195054:[[38283]],195055:[[18837]],195056:[[38327]],195057:[[167287]],195058:[[18918]],195059:[[38595]],195060:[[23986]],195061:[[38691]],195062:[[168261]],195063:[[168474]],195064:[[19054]],195065:[[19062]],195066:[[38880]],195067:[[168970]],195068:[[19122]],195069:[[169110]],195070:[[38923]],195071:[[38923]]}, + 64000:{64000:[[20999]],64001:[[24230]],64002:[[25299]],64003:[[31958]],64004:[[23429]],64005:[[27934]],64006:[[26292]],64007:[[36667]],64008:[[34892]],64009:[[38477]],64010:[[35211]],64011:[[24275]],64012:[[20800]],64013:[[21952]],64016:[[22618]],64018:[[26228]],64021:[[20958]],64022:[[29482]],64023:[[30410]],64024:[[31036]],64025:[[31070]],64026:[[31077]],64027:[[31119]],64028:[[38742]],64029:[[31934]],64030:[[32701]],64032:[[34322]],64034:[[35576]],64037:[[36920]],64038:[[37117]],64042:[[39151]],64043:[[39164]],64044:[[39208]],64045:[[40372]],64046:[[37086]],64047:[[38583]],64048:[[20398]],64049:[[20711]],64050:[[20813]],64051:[[21193]],64052:[[21220]],64053:[[21329]],64054:[[21917]],64055:[[22022]],64056:[[22120]],64057:[[22592]],64058:[[22696]],64059:[[23652]],64060:[[23662]],64061:[[24724]],64062:[[24936]],64063:[[24974]],64064:[[25074]],64065:[[25935]],64066:[[26082]],64067:[[26257]],64068:[[26757]],64069:[[28023]],64070:[[28186]],64071:[[28450]],64072:[[29038]],64073:[[29227]],64074:[[29730]],64075:[[30865]],64076:[[31038]],64077:[[31049]],64078:[[31048]],64079:[[31056]],64080:[[31062]],64081:[[31069]],64082:[[31117]],64083:[[31118]],64084:[[31296]],64085:[[31361]],64086:[[31680]],64087:[[32244]],64088:[[32265]],64089:[[32321]],64090:[[32626]],64091:[[32773]],64092:[[33261]],64093:[[33401]],64094:[[33401]],64095:[[33879]],64096:[[35088]],64097:[[35222]],64098:[[35585]],64099:[[35641]],64100:[[36051]],64101:[[36104]],64102:[[36790]],64103:[[36920]],64104:[[38627]],64105:[[38911]],64106:[[38971]],64107:[[24693]],64108:[[148206]],64109:[[33304]],64112:[[20006]],64113:[[20917]],64114:[[20840]],64115:[[20352]],64116:[[20805]],64117:[[20864]],64118:[[21191]],64119:[[21242]],64120:[[21917]],64121:[[21845]],64122:[[21913]],64123:[[21986]],64124:[[22618]],64125:[[22707]],64126:[[22852]],64127:[[22868]],64128:[[23138]],64129:[[23336]],64130:[[24274]],64131:[[24281]],64132:[[24425]],64133:[[24493]],64134:[[24792]],64135:[[24910]],64136:[[24840]],64137:[[24974]],64138:[[24928]],64139:[[25074]],64140:[[25140]],64141:[[25540]],64142:[[25628]],64143:[[25682]],64144:[[25942]],64145:[[26228]],64146:[[26391]],64147:[[26395]],64148:[[26454]],64149:[[27513]],64150:[[27578]],64151:[[27969]],64152:[[28379]],64153:[[28363]],64154:[[28450]],64155:[[28702]],64156:[[29038]],64157:[[30631]],64158:[[29237]],64159:[[29359]],64160:[[29482]],64161:[[29809]],64162:[[29958]],64163:[[30011]],64164:[[30237]],64165:[[30239]],64166:[[30410]],64167:[[30427]],64168:[[30452]],64169:[[30538]],64170:[[30528]],64171:[[30924]],64172:[[31409]],64173:[[31680]],64174:[[31867]],64175:[[32091]],64176:[[32244]],64177:[[32574]],64178:[[32773]],64179:[[33618]],64180:[[33775]],64181:[[34681]],64182:[[35137]],64183:[[35206]],64184:[[35222]],64185:[[35519]],64186:[[35576]],64187:[[35531]],64188:[[35585]],64189:[[35582]],64190:[[35565]],64191:[[35641]],64192:[[35722]],64193:[[36104]],64194:[[36664]],64195:[[36978]],64196:[[37273]],64197:[[37494]],64198:[[38524]],64199:[[38627]],64200:[[38742]],64201:[[38875]],64202:[[38911]],64203:[[38923]],64204:[[38971]],64205:[[39698]],64206:[[40860]],64207:[[141386]],64208:[[141380]],64209:[[144341]],64210:[[15261]],64211:[[16408]],64212:[[16441]],64213:[[152137]],64214:[[154832]],64215:[[163539]],64216:[[40771]],64217:[[40846]],195072:[[38953]],195073:[[169398]],195074:[[39138]],195075:[[19251]],195076:[[39209]],195077:[[39335]],195078:[[39362]],195079:[[39422]],195080:[[19406]],195081:[[170800]],195082:[[39698]],195083:[[40000]],195084:[[40189]],195085:[[19662]],195086:[[19693]],195087:[[40295]],195088:[[172238]],195089:[[19704]],195090:[[172293]],195091:[[172558]],195092:[[172689]],195093:[[40635]],195094:[[19798]],195095:[[40697]],195096:[[40702]],195097:[[40709]],195098:[[40719]],195099:[[40726]],195100:[[40763]],195101:[[173568]]}, + 64256:{64256:[[102,102],256],64257:[[102,105],256],64258:[[102,108],256],64259:[[102,102,105],256],64260:[[102,102,108],256],64261:[[383,116],256],64262:[[115,116],256],64275:[[1396,1398],256],64276:[[1396,1381],256],64277:[[1396,1387],256],64278:[[1406,1398],256],64279:[[1396,1389],256],64285:[[1497,1460],512],64286:[,26],64287:[[1522,1463],512],64288:[[1506],256],64289:[[1488],256],64290:[[1491],256],64291:[[1492],256],64292:[[1499],256],64293:[[1500],256],64294:[[1501],256],64295:[[1512],256],64296:[[1514],256],64297:[[43],256],64298:[[1513,1473],512],64299:[[1513,1474],512],64300:[[64329,1473],512],64301:[[64329,1474],512],64302:[[1488,1463],512],64303:[[1488,1464],512],64304:[[1488,1468],512],64305:[[1489,1468],512],64306:[[1490,1468],512],64307:[[1491,1468],512],64308:[[1492,1468],512],64309:[[1493,1468],512],64310:[[1494,1468],512],64312:[[1496,1468],512],64313:[[1497,1468],512],64314:[[1498,1468],512],64315:[[1499,1468],512],64316:[[1500,1468],512],64318:[[1502,1468],512],64320:[[1504,1468],512],64321:[[1505,1468],512],64323:[[1507,1468],512],64324:[[1508,1468],512],64326:[[1510,1468],512],64327:[[1511,1468],512],64328:[[1512,1468],512],64329:[[1513,1468],512],64330:[[1514,1468],512],64331:[[1493,1465],512],64332:[[1489,1471],512],64333:[[1499,1471],512],64334:[[1508,1471],512],64335:[[1488,1500],256],64336:[[1649],256],64337:[[1649],256],64338:[[1659],256],64339:[[1659],256],64340:[[1659],256],64341:[[1659],256],64342:[[1662],256],64343:[[1662],256],64344:[[1662],256],64345:[[1662],256],64346:[[1664],256],64347:[[1664],256],64348:[[1664],256],64349:[[1664],256],64350:[[1658],256],64351:[[1658],256],64352:[[1658],256],64353:[[1658],256],64354:[[1663],256],64355:[[1663],256],64356:[[1663],256],64357:[[1663],256],64358:[[1657],256],64359:[[1657],256],64360:[[1657],256],64361:[[1657],256],64362:[[1700],256],64363:[[1700],256],64364:[[1700],256],64365:[[1700],256],64366:[[1702],256],64367:[[1702],256],64368:[[1702],256],64369:[[1702],256],64370:[[1668],256],64371:[[1668],256],64372:[[1668],256],64373:[[1668],256],64374:[[1667],256],64375:[[1667],256],64376:[[1667],256],64377:[[1667],256],64378:[[1670],256],64379:[[1670],256],64380:[[1670],256],64381:[[1670],256],64382:[[1671],256],64383:[[1671],256],64384:[[1671],256],64385:[[1671],256],64386:[[1677],256],64387:[[1677],256],64388:[[1676],256],64389:[[1676],256],64390:[[1678],256],64391:[[1678],256],64392:[[1672],256],64393:[[1672],256],64394:[[1688],256],64395:[[1688],256],64396:[[1681],256],64397:[[1681],256],64398:[[1705],256],64399:[[1705],256],64400:[[1705],256],64401:[[1705],256],64402:[[1711],256],64403:[[1711],256],64404:[[1711],256],64405:[[1711],256],64406:[[1715],256],64407:[[1715],256],64408:[[1715],256],64409:[[1715],256],64410:[[1713],256],64411:[[1713],256],64412:[[1713],256],64413:[[1713],256],64414:[[1722],256],64415:[[1722],256],64416:[[1723],256],64417:[[1723],256],64418:[[1723],256],64419:[[1723],256],64420:[[1728],256],64421:[[1728],256],64422:[[1729],256],64423:[[1729],256],64424:[[1729],256],64425:[[1729],256],64426:[[1726],256],64427:[[1726],256],64428:[[1726],256],64429:[[1726],256],64430:[[1746],256],64431:[[1746],256],64432:[[1747],256],64433:[[1747],256],64467:[[1709],256],64468:[[1709],256],64469:[[1709],256],64470:[[1709],256],64471:[[1735],256],64472:[[1735],256],64473:[[1734],256],64474:[[1734],256],64475:[[1736],256],64476:[[1736],256],64477:[[1655],256],64478:[[1739],256],64479:[[1739],256],64480:[[1733],256],64481:[[1733],256],64482:[[1737],256],64483:[[1737],256],64484:[[1744],256],64485:[[1744],256],64486:[[1744],256],64487:[[1744],256],64488:[[1609],256],64489:[[1609],256],64490:[[1574,1575],256],64491:[[1574,1575],256],64492:[[1574,1749],256],64493:[[1574,1749],256],64494:[[1574,1608],256],64495:[[1574,1608],256],64496:[[1574,1735],256],64497:[[1574,1735],256],64498:[[1574,1734],256],64499:[[1574,1734],256],64500:[[1574,1736],256],64501:[[1574,1736],256],64502:[[1574,1744],256],64503:[[1574,1744],256],64504:[[1574,1744],256],64505:[[1574,1609],256],64506:[[1574,1609],256],64507:[[1574,1609],256],64508:[[1740],256],64509:[[1740],256],64510:[[1740],256],64511:[[1740],256]}, + 64512:{64512:[[1574,1580],256],64513:[[1574,1581],256],64514:[[1574,1605],256],64515:[[1574,1609],256],64516:[[1574,1610],256],64517:[[1576,1580],256],64518:[[1576,1581],256],64519:[[1576,1582],256],64520:[[1576,1605],256],64521:[[1576,1609],256],64522:[[1576,1610],256],64523:[[1578,1580],256],64524:[[1578,1581],256],64525:[[1578,1582],256],64526:[[1578,1605],256],64527:[[1578,1609],256],64528:[[1578,1610],256],64529:[[1579,1580],256],64530:[[1579,1605],256],64531:[[1579,1609],256],64532:[[1579,1610],256],64533:[[1580,1581],256],64534:[[1580,1605],256],64535:[[1581,1580],256],64536:[[1581,1605],256],64537:[[1582,1580],256],64538:[[1582,1581],256],64539:[[1582,1605],256],64540:[[1587,1580],256],64541:[[1587,1581],256],64542:[[1587,1582],256],64543:[[1587,1605],256],64544:[[1589,1581],256],64545:[[1589,1605],256],64546:[[1590,1580],256],64547:[[1590,1581],256],64548:[[1590,1582],256],64549:[[1590,1605],256],64550:[[1591,1581],256],64551:[[1591,1605],256],64552:[[1592,1605],256],64553:[[1593,1580],256],64554:[[1593,1605],256],64555:[[1594,1580],256],64556:[[1594,1605],256],64557:[[1601,1580],256],64558:[[1601,1581],256],64559:[[1601,1582],256],64560:[[1601,1605],256],64561:[[1601,1609],256],64562:[[1601,1610],256],64563:[[1602,1581],256],64564:[[1602,1605],256],64565:[[1602,1609],256],64566:[[1602,1610],256],64567:[[1603,1575],256],64568:[[1603,1580],256],64569:[[1603,1581],256],64570:[[1603,1582],256],64571:[[1603,1604],256],64572:[[1603,1605],256],64573:[[1603,1609],256],64574:[[1603,1610],256],64575:[[1604,1580],256],64576:[[1604,1581],256],64577:[[1604,1582],256],64578:[[1604,1605],256],64579:[[1604,1609],256],64580:[[1604,1610],256],64581:[[1605,1580],256],64582:[[1605,1581],256],64583:[[1605,1582],256],64584:[[1605,1605],256],64585:[[1605,1609],256],64586:[[1605,1610],256],64587:[[1606,1580],256],64588:[[1606,1581],256],64589:[[1606,1582],256],64590:[[1606,1605],256],64591:[[1606,1609],256],64592:[[1606,1610],256],64593:[[1607,1580],256],64594:[[1607,1605],256],64595:[[1607,1609],256],64596:[[1607,1610],256],64597:[[1610,1580],256],64598:[[1610,1581],256],64599:[[1610,1582],256],64600:[[1610,1605],256],64601:[[1610,1609],256],64602:[[1610,1610],256],64603:[[1584,1648],256],64604:[[1585,1648],256],64605:[[1609,1648],256],64606:[[32,1612,1617],256],64607:[[32,1613,1617],256],64608:[[32,1614,1617],256],64609:[[32,1615,1617],256],64610:[[32,1616,1617],256],64611:[[32,1617,1648],256],64612:[[1574,1585],256],64613:[[1574,1586],256],64614:[[1574,1605],256],64615:[[1574,1606],256],64616:[[1574,1609],256],64617:[[1574,1610],256],64618:[[1576,1585],256],64619:[[1576,1586],256],64620:[[1576,1605],256],64621:[[1576,1606],256],64622:[[1576,1609],256],64623:[[1576,1610],256],64624:[[1578,1585],256],64625:[[1578,1586],256],64626:[[1578,1605],256],64627:[[1578,1606],256],64628:[[1578,1609],256],64629:[[1578,1610],256],64630:[[1579,1585],256],64631:[[1579,1586],256],64632:[[1579,1605],256],64633:[[1579,1606],256],64634:[[1579,1609],256],64635:[[1579,1610],256],64636:[[1601,1609],256],64637:[[1601,1610],256],64638:[[1602,1609],256],64639:[[1602,1610],256],64640:[[1603,1575],256],64641:[[1603,1604],256],64642:[[1603,1605],256],64643:[[1603,1609],256],64644:[[1603,1610],256],64645:[[1604,1605],256],64646:[[1604,1609],256],64647:[[1604,1610],256],64648:[[1605,1575],256],64649:[[1605,1605],256],64650:[[1606,1585],256],64651:[[1606,1586],256],64652:[[1606,1605],256],64653:[[1606,1606],256],64654:[[1606,1609],256],64655:[[1606,1610],256],64656:[[1609,1648],256],64657:[[1610,1585],256],64658:[[1610,1586],256],64659:[[1610,1605],256],64660:[[1610,1606],256],64661:[[1610,1609],256],64662:[[1610,1610],256],64663:[[1574,1580],256],64664:[[1574,1581],256],64665:[[1574,1582],256],64666:[[1574,1605],256],64667:[[1574,1607],256],64668:[[1576,1580],256],64669:[[1576,1581],256],64670:[[1576,1582],256],64671:[[1576,1605],256],64672:[[1576,1607],256],64673:[[1578,1580],256],64674:[[1578,1581],256],64675:[[1578,1582],256],64676:[[1578,1605],256],64677:[[1578,1607],256],64678:[[1579,1605],256],64679:[[1580,1581],256],64680:[[1580,1605],256],64681:[[1581,1580],256],64682:[[1581,1605],256],64683:[[1582,1580],256],64684:[[1582,1605],256],64685:[[1587,1580],256],64686:[[1587,1581],256],64687:[[1587,1582],256],64688:[[1587,1605],256],64689:[[1589,1581],256],64690:[[1589,1582],256],64691:[[1589,1605],256],64692:[[1590,1580],256],64693:[[1590,1581],256],64694:[[1590,1582],256],64695:[[1590,1605],256],64696:[[1591,1581],256],64697:[[1592,1605],256],64698:[[1593,1580],256],64699:[[1593,1605],256],64700:[[1594,1580],256],64701:[[1594,1605],256],64702:[[1601,1580],256],64703:[[1601,1581],256],64704:[[1601,1582],256],64705:[[1601,1605],256],64706:[[1602,1581],256],64707:[[1602,1605],256],64708:[[1603,1580],256],64709:[[1603,1581],256],64710:[[1603,1582],256],64711:[[1603,1604],256],64712:[[1603,1605],256],64713:[[1604,1580],256],64714:[[1604,1581],256],64715:[[1604,1582],256],64716:[[1604,1605],256],64717:[[1604,1607],256],64718:[[1605,1580],256],64719:[[1605,1581],256],64720:[[1605,1582],256],64721:[[1605,1605],256],64722:[[1606,1580],256],64723:[[1606,1581],256],64724:[[1606,1582],256],64725:[[1606,1605],256],64726:[[1606,1607],256],64727:[[1607,1580],256],64728:[[1607,1605],256],64729:[[1607,1648],256],64730:[[1610,1580],256],64731:[[1610,1581],256],64732:[[1610,1582],256],64733:[[1610,1605],256],64734:[[1610,1607],256],64735:[[1574,1605],256],64736:[[1574,1607],256],64737:[[1576,1605],256],64738:[[1576,1607],256],64739:[[1578,1605],256],64740:[[1578,1607],256],64741:[[1579,1605],256],64742:[[1579,1607],256],64743:[[1587,1605],256],64744:[[1587,1607],256],64745:[[1588,1605],256],64746:[[1588,1607],256],64747:[[1603,1604],256],64748:[[1603,1605],256],64749:[[1604,1605],256],64750:[[1606,1605],256],64751:[[1606,1607],256],64752:[[1610,1605],256],64753:[[1610,1607],256],64754:[[1600,1614,1617],256],64755:[[1600,1615,1617],256],64756:[[1600,1616,1617],256],64757:[[1591,1609],256],64758:[[1591,1610],256],64759:[[1593,1609],256],64760:[[1593,1610],256],64761:[[1594,1609],256],64762:[[1594,1610],256],64763:[[1587,1609],256],64764:[[1587,1610],256],64765:[[1588,1609],256],64766:[[1588,1610],256],64767:[[1581,1609],256]}, + 64768:{64768:[[1581,1610],256],64769:[[1580,1609],256],64770:[[1580,1610],256],64771:[[1582,1609],256],64772:[[1582,1610],256],64773:[[1589,1609],256],64774:[[1589,1610],256],64775:[[1590,1609],256],64776:[[1590,1610],256],64777:[[1588,1580],256],64778:[[1588,1581],256],64779:[[1588,1582],256],64780:[[1588,1605],256],64781:[[1588,1585],256],64782:[[1587,1585],256],64783:[[1589,1585],256],64784:[[1590,1585],256],64785:[[1591,1609],256],64786:[[1591,1610],256],64787:[[1593,1609],256],64788:[[1593,1610],256],64789:[[1594,1609],256],64790:[[1594,1610],256],64791:[[1587,1609],256],64792:[[1587,1610],256],64793:[[1588,1609],256],64794:[[1588,1610],256],64795:[[1581,1609],256],64796:[[1581,1610],256],64797:[[1580,1609],256],64798:[[1580,1610],256],64799:[[1582,1609],256],64800:[[1582,1610],256],64801:[[1589,1609],256],64802:[[1589,1610],256],64803:[[1590,1609],256],64804:[[1590,1610],256],64805:[[1588,1580],256],64806:[[1588,1581],256],64807:[[1588,1582],256],64808:[[1588,1605],256],64809:[[1588,1585],256],64810:[[1587,1585],256],64811:[[1589,1585],256],64812:[[1590,1585],256],64813:[[1588,1580],256],64814:[[1588,1581],256],64815:[[1588,1582],256],64816:[[1588,1605],256],64817:[[1587,1607],256],64818:[[1588,1607],256],64819:[[1591,1605],256],64820:[[1587,1580],256],64821:[[1587,1581],256],64822:[[1587,1582],256],64823:[[1588,1580],256],64824:[[1588,1581],256],64825:[[1588,1582],256],64826:[[1591,1605],256],64827:[[1592,1605],256],64828:[[1575,1611],256],64829:[[1575,1611],256],64848:[[1578,1580,1605],256],64849:[[1578,1581,1580],256],64850:[[1578,1581,1580],256],64851:[[1578,1581,1605],256],64852:[[1578,1582,1605],256],64853:[[1578,1605,1580],256],64854:[[1578,1605,1581],256],64855:[[1578,1605,1582],256],64856:[[1580,1605,1581],256],64857:[[1580,1605,1581],256],64858:[[1581,1605,1610],256],64859:[[1581,1605,1609],256],64860:[[1587,1581,1580],256],64861:[[1587,1580,1581],256],64862:[[1587,1580,1609],256],64863:[[1587,1605,1581],256],64864:[[1587,1605,1581],256],64865:[[1587,1605,1580],256],64866:[[1587,1605,1605],256],64867:[[1587,1605,1605],256],64868:[[1589,1581,1581],256],64869:[[1589,1581,1581],256],64870:[[1589,1605,1605],256],64871:[[1588,1581,1605],256],64872:[[1588,1581,1605],256],64873:[[1588,1580,1610],256],64874:[[1588,1605,1582],256],64875:[[1588,1605,1582],256],64876:[[1588,1605,1605],256],64877:[[1588,1605,1605],256],64878:[[1590,1581,1609],256],64879:[[1590,1582,1605],256],64880:[[1590,1582,1605],256],64881:[[1591,1605,1581],256],64882:[[1591,1605,1581],256],64883:[[1591,1605,1605],256],64884:[[1591,1605,1610],256],64885:[[1593,1580,1605],256],64886:[[1593,1605,1605],256],64887:[[1593,1605,1605],256],64888:[[1593,1605,1609],256],64889:[[1594,1605,1605],256],64890:[[1594,1605,1610],256],64891:[[1594,1605,1609],256],64892:[[1601,1582,1605],256],64893:[[1601,1582,1605],256],64894:[[1602,1605,1581],256],64895:[[1602,1605,1605],256],64896:[[1604,1581,1605],256],64897:[[1604,1581,1610],256],64898:[[1604,1581,1609],256],64899:[[1604,1580,1580],256],64900:[[1604,1580,1580],256],64901:[[1604,1582,1605],256],64902:[[1604,1582,1605],256],64903:[[1604,1605,1581],256],64904:[[1604,1605,1581],256],64905:[[1605,1581,1580],256],64906:[[1605,1581,1605],256],64907:[[1605,1581,1610],256],64908:[[1605,1580,1581],256],64909:[[1605,1580,1605],256],64910:[[1605,1582,1580],256],64911:[[1605,1582,1605],256],64914:[[1605,1580,1582],256],64915:[[1607,1605,1580],256],64916:[[1607,1605,1605],256],64917:[[1606,1581,1605],256],64918:[[1606,1581,1609],256],64919:[[1606,1580,1605],256],64920:[[1606,1580,1605],256],64921:[[1606,1580,1609],256],64922:[[1606,1605,1610],256],64923:[[1606,1605,1609],256],64924:[[1610,1605,1605],256],64925:[[1610,1605,1605],256],64926:[[1576,1582,1610],256],64927:[[1578,1580,1610],256],64928:[[1578,1580,1609],256],64929:[[1578,1582,1610],256],64930:[[1578,1582,1609],256],64931:[[1578,1605,1610],256],64932:[[1578,1605,1609],256],64933:[[1580,1605,1610],256],64934:[[1580,1581,1609],256],64935:[[1580,1605,1609],256],64936:[[1587,1582,1609],256],64937:[[1589,1581,1610],256],64938:[[1588,1581,1610],256],64939:[[1590,1581,1610],256],64940:[[1604,1580,1610],256],64941:[[1604,1605,1610],256],64942:[[1610,1581,1610],256],64943:[[1610,1580,1610],256],64944:[[1610,1605,1610],256],64945:[[1605,1605,1610],256],64946:[[1602,1605,1610],256],64947:[[1606,1581,1610],256],64948:[[1602,1605,1581],256],64949:[[1604,1581,1605],256],64950:[[1593,1605,1610],256],64951:[[1603,1605,1610],256],64952:[[1606,1580,1581],256],64953:[[1605,1582,1610],256],64954:[[1604,1580,1605],256],64955:[[1603,1605,1605],256],64956:[[1604,1580,1605],256],64957:[[1606,1580,1581],256],64958:[[1580,1581,1610],256],64959:[[1581,1580,1610],256],64960:[[1605,1580,1610],256],64961:[[1601,1605,1610],256],64962:[[1576,1581,1610],256],64963:[[1603,1605,1605],256],64964:[[1593,1580,1605],256],64965:[[1589,1605,1605],256],64966:[[1587,1582,1610],256],64967:[[1606,1580,1610],256],65008:[[1589,1604,1746],256],65009:[[1602,1604,1746],256],65010:[[1575,1604,1604,1607],256],65011:[[1575,1603,1576,1585],256],65012:[[1605,1581,1605,1583],256],65013:[[1589,1604,1593,1605],256],65014:[[1585,1587,1608,1604],256],65015:[[1593,1604,1610,1607],256],65016:[[1608,1587,1604,1605],256],65017:[[1589,1604,1609],256],65018:[[1589,1604,1609,32,1575,1604,1604,1607,32,1593,1604,1610,1607,32,1608,1587,1604,1605],256],65019:[[1580,1604,32,1580,1604,1575,1604,1607],256],65020:[[1585,1740,1575,1604],256]}, + 65024:{65040:[[44],256],65041:[[12289],256],65042:[[12290],256],65043:[[58],256],65044:[[59],256],65045:[[33],256],65046:[[63],256],65047:[[12310],256],65048:[[12311],256],65049:[[8230],256],65056:[,230],65057:[,230],65058:[,230],65059:[,230],65060:[,230],65061:[,230],65062:[,230],65072:[[8229],256],65073:[[8212],256],65074:[[8211],256],65075:[[95],256],65076:[[95],256],65077:[[40],256],65078:[[41],256],65079:[[123],256],65080:[[125],256],65081:[[12308],256],65082:[[12309],256],65083:[[12304],256],65084:[[12305],256],65085:[[12298],256],65086:[[12299],256],65087:[[12296],256],65088:[[12297],256],65089:[[12300],256],65090:[[12301],256],65091:[[12302],256],65092:[[12303],256],65095:[[91],256],65096:[[93],256],65097:[[8254],256],65098:[[8254],256],65099:[[8254],256],65100:[[8254],256],65101:[[95],256],65102:[[95],256],65103:[[95],256],65104:[[44],256],65105:[[12289],256],65106:[[46],256],65108:[[59],256],65109:[[58],256],65110:[[63],256],65111:[[33],256],65112:[[8212],256],65113:[[40],256],65114:[[41],256],65115:[[123],256],65116:[[125],256],65117:[[12308],256],65118:[[12309],256],65119:[[35],256],65120:[[38],256],65121:[[42],256],65122:[[43],256],65123:[[45],256],65124:[[60],256],65125:[[62],256],65126:[[61],256],65128:[[92],256],65129:[[36],256],65130:[[37],256],65131:[[64],256],65136:[[32,1611],256],65137:[[1600,1611],256],65138:[[32,1612],256],65140:[[32,1613],256],65142:[[32,1614],256],65143:[[1600,1614],256],65144:[[32,1615],256],65145:[[1600,1615],256],65146:[[32,1616],256],65147:[[1600,1616],256],65148:[[32,1617],256],65149:[[1600,1617],256],65150:[[32,1618],256],65151:[[1600,1618],256],65152:[[1569],256],65153:[[1570],256],65154:[[1570],256],65155:[[1571],256],65156:[[1571],256],65157:[[1572],256],65158:[[1572],256],65159:[[1573],256],65160:[[1573],256],65161:[[1574],256],65162:[[1574],256],65163:[[1574],256],65164:[[1574],256],65165:[[1575],256],65166:[[1575],256],65167:[[1576],256],65168:[[1576],256],65169:[[1576],256],65170:[[1576],256],65171:[[1577],256],65172:[[1577],256],65173:[[1578],256],65174:[[1578],256],65175:[[1578],256],65176:[[1578],256],65177:[[1579],256],65178:[[1579],256],65179:[[1579],256],65180:[[1579],256],65181:[[1580],256],65182:[[1580],256],65183:[[1580],256],65184:[[1580],256],65185:[[1581],256],65186:[[1581],256],65187:[[1581],256],65188:[[1581],256],65189:[[1582],256],65190:[[1582],256],65191:[[1582],256],65192:[[1582],256],65193:[[1583],256],65194:[[1583],256],65195:[[1584],256],65196:[[1584],256],65197:[[1585],256],65198:[[1585],256],65199:[[1586],256],65200:[[1586],256],65201:[[1587],256],65202:[[1587],256],65203:[[1587],256],65204:[[1587],256],65205:[[1588],256],65206:[[1588],256],65207:[[1588],256],65208:[[1588],256],65209:[[1589],256],65210:[[1589],256],65211:[[1589],256],65212:[[1589],256],65213:[[1590],256],65214:[[1590],256],65215:[[1590],256],65216:[[1590],256],65217:[[1591],256],65218:[[1591],256],65219:[[1591],256],65220:[[1591],256],65221:[[1592],256],65222:[[1592],256],65223:[[1592],256],65224:[[1592],256],65225:[[1593],256],65226:[[1593],256],65227:[[1593],256],65228:[[1593],256],65229:[[1594],256],65230:[[1594],256],65231:[[1594],256],65232:[[1594],256],65233:[[1601],256],65234:[[1601],256],65235:[[1601],256],65236:[[1601],256],65237:[[1602],256],65238:[[1602],256],65239:[[1602],256],65240:[[1602],256],65241:[[1603],256],65242:[[1603],256],65243:[[1603],256],65244:[[1603],256],65245:[[1604],256],65246:[[1604],256],65247:[[1604],256],65248:[[1604],256],65249:[[1605],256],65250:[[1605],256],65251:[[1605],256],65252:[[1605],256],65253:[[1606],256],65254:[[1606],256],65255:[[1606],256],65256:[[1606],256],65257:[[1607],256],65258:[[1607],256],65259:[[1607],256],65260:[[1607],256],65261:[[1608],256],65262:[[1608],256],65263:[[1609],256],65264:[[1609],256],65265:[[1610],256],65266:[[1610],256],65267:[[1610],256],65268:[[1610],256],65269:[[1604,1570],256],65270:[[1604,1570],256],65271:[[1604,1571],256],65272:[[1604,1571],256],65273:[[1604,1573],256],65274:[[1604,1573],256],65275:[[1604,1575],256],65276:[[1604,1575],256]}, + 65280:{65281:[[33],256],65282:[[34],256],65283:[[35],256],65284:[[36],256],65285:[[37],256],65286:[[38],256],65287:[[39],256],65288:[[40],256],65289:[[41],256],65290:[[42],256],65291:[[43],256],65292:[[44],256],65293:[[45],256],65294:[[46],256],65295:[[47],256],65296:[[48],256],65297:[[49],256],65298:[[50],256],65299:[[51],256],65300:[[52],256],65301:[[53],256],65302:[[54],256],65303:[[55],256],65304:[[56],256],65305:[[57],256],65306:[[58],256],65307:[[59],256],65308:[[60],256],65309:[[61],256],65310:[[62],256],65311:[[63],256],65312:[[64],256],65313:[[65],256],65314:[[66],256],65315:[[67],256],65316:[[68],256],65317:[[69],256],65318:[[70],256],65319:[[71],256],65320:[[72],256],65321:[[73],256],65322:[[74],256],65323:[[75],256],65324:[[76],256],65325:[[77],256],65326:[[78],256],65327:[[79],256],65328:[[80],256],65329:[[81],256],65330:[[82],256],65331:[[83],256],65332:[[84],256],65333:[[85],256],65334:[[86],256],65335:[[87],256],65336:[[88],256],65337:[[89],256],65338:[[90],256],65339:[[91],256],65340:[[92],256],65341:[[93],256],65342:[[94],256],65343:[[95],256],65344:[[96],256],65345:[[97],256],65346:[[98],256],65347:[[99],256],65348:[[100],256],65349:[[101],256],65350:[[102],256],65351:[[103],256],65352:[[104],256],65353:[[105],256],65354:[[106],256],65355:[[107],256],65356:[[108],256],65357:[[109],256],65358:[[110],256],65359:[[111],256],65360:[[112],256],65361:[[113],256],65362:[[114],256],65363:[[115],256],65364:[[116],256],65365:[[117],256],65366:[[118],256],65367:[[119],256],65368:[[120],256],65369:[[121],256],65370:[[122],256],65371:[[123],256],65372:[[124],256],65373:[[125],256],65374:[[126],256],65375:[[10629],256],65376:[[10630],256],65377:[[12290],256],65378:[[12300],256],65379:[[12301],256],65380:[[12289],256],65381:[[12539],256],65382:[[12530],256],65383:[[12449],256],65384:[[12451],256],65385:[[12453],256],65386:[[12455],256],65387:[[12457],256],65388:[[12515],256],65389:[[12517],256],65390:[[12519],256],65391:[[12483],256],65392:[[12540],256],65393:[[12450],256],65394:[[12452],256],65395:[[12454],256],65396:[[12456],256],65397:[[12458],256],65398:[[12459],256],65399:[[12461],256],65400:[[12463],256],65401:[[12465],256],65402:[[12467],256],65403:[[12469],256],65404:[[12471],256],65405:[[12473],256],65406:[[12475],256],65407:[[12477],256],65408:[[12479],256],65409:[[12481],256],65410:[[12484],256],65411:[[12486],256],65412:[[12488],256],65413:[[12490],256],65414:[[12491],256],65415:[[12492],256],65416:[[12493],256],65417:[[12494],256],65418:[[12495],256],65419:[[12498],256],65420:[[12501],256],65421:[[12504],256],65422:[[12507],256],65423:[[12510],256],65424:[[12511],256],65425:[[12512],256],65426:[[12513],256],65427:[[12514],256],65428:[[12516],256],65429:[[12518],256],65430:[[12520],256],65431:[[12521],256],65432:[[12522],256],65433:[[12523],256],65434:[[12524],256],65435:[[12525],256],65436:[[12527],256],65437:[[12531],256],65438:[[12441],256],65439:[[12442],256],65440:[[12644],256],65441:[[12593],256],65442:[[12594],256],65443:[[12595],256],65444:[[12596],256],65445:[[12597],256],65446:[[12598],256],65447:[[12599],256],65448:[[12600],256],65449:[[12601],256],65450:[[12602],256],65451:[[12603],256],65452:[[12604],256],65453:[[12605],256],65454:[[12606],256],65455:[[12607],256],65456:[[12608],256],65457:[[12609],256],65458:[[12610],256],65459:[[12611],256],65460:[[12612],256],65461:[[12613],256],65462:[[12614],256],65463:[[12615],256],65464:[[12616],256],65465:[[12617],256],65466:[[12618],256],65467:[[12619],256],65468:[[12620],256],65469:[[12621],256],65470:[[12622],256],65474:[[12623],256],65475:[[12624],256],65476:[[12625],256],65477:[[12626],256],65478:[[12627],256],65479:[[12628],256],65482:[[12629],256],65483:[[12630],256],65484:[[12631],256],65485:[[12632],256],65486:[[12633],256],65487:[[12634],256],65490:[[12635],256],65491:[[12636],256],65492:[[12637],256],65493:[[12638],256],65494:[[12639],256],65495:[[12640],256],65498:[[12641],256],65499:[[12642],256],65500:[[12643],256],65504:[[162],256],65505:[[163],256],65506:[[172],256],65507:[[175],256],65508:[[166],256],65509:[[165],256],65510:[[8361],256],65512:[[9474],256],65513:[[8592],256],65514:[[8593],256],65515:[[8594],256],65516:[[8595],256],65517:[[9632],256],65518:[[9675],256]} +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/implement.js new file mode 100644 index 00000000..cfc710ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'normalize', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/index.js new file mode 100644 index 00000000..619b0965 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.normalize + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/is-implemented.js new file mode 100644 index 00000000..67c8d8da --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'æøåäüö'; + +module.exports = function () { + if (typeof str.normalize !== 'function') return false; + return str.normalize('NFKD') === 'æøåäüö'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/shim.js new file mode 100644 index 00000000..a3799897 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/normalize/shim.js @@ -0,0 +1,289 @@ +// Taken from: https://github.com/walling/unorm/blob/master/lib/unorm.js + +/* + * UnicodeNormalizer 1.0.0 + * Copyright (c) 2008 Matsuza + * Dual licensed under the MIT (MIT-LICENSE.txt) and + * GPL (GPL-LICENSE.txt) licenses. + * $Date: 2008-06-05 16:44:17 +0200 (Thu, 05 Jun 2008) $ + * $Rev: 13309 $ +*/ + +'use strict'; + +var primitiveSet = require('../../../object/primitive-set') + , validValue = require('../../../object/valid-value') + , data = require('./_data') + + , floor = Math.floor + , forms = primitiveSet('NFC', 'NFD', 'NFKC', 'NFKD') + + , DEFAULT_FEATURE = [null, 0, {}], CACHE_THRESHOLD = 10, SBase = 0xAC00 + , LBase = 0x1100, VBase = 0x1161, TBase = 0x11A7, LCount = 19, VCount = 21 + , TCount = 28, NCount = VCount * TCount, SCount = LCount * NCount + , UChar, cache = {}, cacheCounter = [], i, fromCache, fromData, fromCpOnly + , fromRuleBasedJamo, fromCpFilter, strategies, UCharIterator + , RecursDecompIterator, DecompIterator, CompIterator, createIterator + , normalize; + +UChar = function (cp, feature) { + this.codepoint = cp; + this.feature = feature; +}; + +// Strategies +for (i = 0; i <= 0xFF; ++i) cacheCounter[i] = 0; + +fromCache = function (next, cp, needFeature) { + var ret = cache[cp]; + if (!ret) { + ret = next(cp, needFeature); + if (!!ret.feature && ++cacheCounter[(cp >> 8) & 0xFF] > CACHE_THRESHOLD) { + cache[cp] = ret; + } + } + return ret; +}; + +fromData = function (next, cp, needFeature) { + var hash = cp & 0xFF00, dunit = UChar.udata[hash] || {}, f = dunit[cp]; + return f ? new UChar(cp, f) : new UChar(cp, DEFAULT_FEATURE); +}; +fromCpOnly = function (next, cp, needFeature) { + return !!needFeature ? next(cp, needFeature) : new UChar(cp, null); +}; + +fromRuleBasedJamo = function (next, cp, needFeature) { + var c, base, i, arr, SIndex, TIndex, feature, j; + if (cp < LBase || (LBase + LCount <= cp && cp < SBase) || + (SBase + SCount < cp)) { + return next(cp, needFeature); + } + if (LBase <= cp && cp < LBase + LCount) { + c = {}; + base = (cp - LBase) * VCount; + for (i = 0; i < VCount; ++i) { + c[VBase + i] = SBase + TCount * (i + base); + } + arr = new Array(3); + arr[2] = c; + return new UChar(cp, arr); + } + + SIndex = cp - SBase; + TIndex = SIndex % TCount; + feature = []; + if (TIndex !== 0) { + feature[0] = [SBase + SIndex - TIndex, TBase + TIndex]; + } else { + feature[0] = [LBase + floor(SIndex / NCount), VBase + + floor((SIndex % NCount) / TCount)]; + feature[2] = {}; + for (j = 1; j < TCount; ++j) { + feature[2][TBase + j] = cp + j; + } + } + return new UChar(cp, feature); +}; + +fromCpFilter = function (next, cp, needFeature) { + return (cp < 60) || ((13311 < cp) && (cp < 42607)) + ? new UChar(cp, DEFAULT_FEATURE) : next(cp, needFeature); +}; + +strategies = [fromCpFilter, fromCache, fromCpOnly, fromRuleBasedJamo, fromData]; + +UChar.fromCharCode = strategies.reduceRight(function (next, strategy) { + return function (cp, needFeature) { return strategy(next, cp, needFeature); }; +}, null); + +UChar.isHighSurrogate = function (cp) { return cp >= 0xD800 && cp <= 0xDBFF; }; +UChar.isLowSurrogate = function (cp) { return cp >= 0xDC00 && cp <= 0xDFFF; }; + +UChar.prototype.prepFeature = function () { + if (!this.feature) { + this.feature = UChar.fromCharCode(this.codepoint, true).feature; + } +}; + +UChar.prototype.toString = function () { + var x; + if (this.codepoint < 0x10000) return String.fromCharCode(this.codepoint); + x = this.codepoint - 0x10000; + return String.fromCharCode(floor(x / 0x400) + 0xD800, x % 0x400 + 0xDC00); +}; + +UChar.prototype.getDecomp = function () { + this.prepFeature(); + return this.feature[0] || null; +}; + +UChar.prototype.isCompatibility = function () { + this.prepFeature(); + return !!this.feature[1] && (this.feature[1] & (1 << 8)); +}; +UChar.prototype.isExclude = function () { + this.prepFeature(); + return !!this.feature[1] && (this.feature[1] & (1 << 9)); +}; +UChar.prototype.getCanonicalClass = function () { + this.prepFeature(); + return !!this.feature[1] ? (this.feature[1] & 0xff) : 0; +}; +UChar.prototype.getComposite = function (following) { + var cp; + this.prepFeature(); + if (!this.feature[2]) return null; + cp = this.feature[2][following.codepoint]; + return cp ? UChar.fromCharCode(cp) : null; +}; + +UCharIterator = function (str) { + this.str = str; + this.cursor = 0; +}; +UCharIterator.prototype.next = function () { + if (!!this.str && this.cursor < this.str.length) { + var cp = this.str.charCodeAt(this.cursor++), d; + if (UChar.isHighSurrogate(cp) && this.cursor < this.str.length && + UChar.isLowSurrogate((d = this.str.charCodeAt(this.cursor)))) { + cp = (cp - 0xD800) * 0x400 + (d - 0xDC00) + 0x10000; + ++this.cursor; + } + return UChar.fromCharCode(cp); + } + this.str = null; + return null; +}; + +RecursDecompIterator = function (it, cano) { + this.it = it; + this.canonical = cano; + this.resBuf = []; +}; + +RecursDecompIterator.prototype.next = function () { + var recursiveDecomp, uchar; + recursiveDecomp = function (cano, uchar) { + var decomp = uchar.getDecomp(), ret, i, a, j; + if (!!decomp && !(cano && uchar.isCompatibility())) { + ret = []; + for (i = 0; i < decomp.length; ++i) { + a = recursiveDecomp(cano, UChar.fromCharCode(decomp[i])); + //ret.concat(a); //<-why does not this work? + //following block is a workaround. + for (j = 0; j < a.length; ++j) ret.push(a[j]); + } + return ret; + } + return [uchar]; + }; + if (this.resBuf.length === 0) { + uchar = this.it.next(); + if (!uchar) return null; + this.resBuf = recursiveDecomp(this.canonical, uchar); + } + return this.resBuf.shift(); +}; + +DecompIterator = function (it) { + this.it = it; + this.resBuf = []; +}; + +DecompIterator.prototype.next = function () { + var cc, uchar, inspt, uchar2, cc2; + if (this.resBuf.length === 0) { + do { + uchar = this.it.next(); + if (!uchar) break; + cc = uchar.getCanonicalClass(); + inspt = this.resBuf.length; + if (cc !== 0) { + for (inspt; inspt > 0; --inspt) { + uchar2 = this.resBuf[inspt - 1]; + cc2 = uchar2.getCanonicalClass(); + if (cc2 <= cc) break; + } + } + this.resBuf.splice(inspt, 0, uchar); + } while (cc !== 0); + } + return this.resBuf.shift(); +}; + +CompIterator = function (it) { + this.it = it; + this.procBuf = []; + this.resBuf = []; + this.lastClass = null; +}; + +CompIterator.prototype.next = function () { + var uchar, starter, composite, cc; + while (this.resBuf.length === 0) { + uchar = this.it.next(); + if (!uchar) { + this.resBuf = this.procBuf; + this.procBuf = []; + break; + } + if (this.procBuf.length === 0) { + this.lastClass = uchar.getCanonicalClass(); + this.procBuf.push(uchar); + } else { + starter = this.procBuf[0]; + composite = starter.getComposite(uchar); + cc = uchar.getCanonicalClass(); + if (!!composite && (this.lastClass < cc || this.lastClass === 0)) { + this.procBuf[0] = composite; + } else { + if (cc === 0) { + this.resBuf = this.procBuf; + this.procBuf = []; + } + this.lastClass = cc; + this.procBuf.push(uchar); + } + } + } + return this.resBuf.shift(); +}; + +createIterator = function (mode, str) { + switch (mode) { + case "NFD": + return new DecompIterator( + new RecursDecompIterator(new UCharIterator(str), true) + ); + case "NFKD": + return new DecompIterator( + new RecursDecompIterator(new UCharIterator(str), false) + ); + case "NFC": + return new CompIterator(new DecompIterator( + new RecursDecompIterator(new UCharIterator(str), true) + )); + case "NFKC": + return new CompIterator(new DecompIterator( + new RecursDecompIterator(new UCharIterator(str), false) + )); + } + throw mode + " is invalid"; +}; +normalize = function (mode, str) { + var it = createIterator(mode, str), ret = "", uchar; + while (!!(uchar = it.next())) ret += uchar.toString(); + return ret; +}; + +/* Unicode data */ +UChar.udata = data; + +module.exports = function (/*form*/) { + var str = String(validValue(this)), form = arguments[0]; + if (form === undefined) form = 'NFC'; + else form = String(form); + if (!forms[form]) throw new RangeError('Invalid normalization form: ' + form); + return normalize(form, str); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/pad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/pad.js new file mode 100644 index 00000000..f227f239 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/pad.js @@ -0,0 +1,18 @@ +'use strict'; + +var toInteger = require('../../number/to-integer') + , value = require('../../object/valid-value') + , repeat = require('./repeat') + + , abs = Math.abs, max = Math.max; + +module.exports = function (fill/*, length*/) { + var self = String(value(this)) + , sLength = self.length + , length = arguments[1]; + + length = isNaN(length) ? 1 : toInteger(length); + fill = repeat.call(String(fill), abs(length)); + if (length >= 0) return fill.slice(0, max(0, length - sLength)) + self; + return self + (((sLength + length) >= 0) ? '' : fill.slice(length + sLength)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/plain-replace-all.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/plain-replace-all.js new file mode 100644 index 00000000..678b1cbc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/plain-replace-all.js @@ -0,0 +1,16 @@ +'use strict'; + +var value = require('../../object/valid-value'); + +module.exports = function (search, replace) { + var index, pos = 0, str = String(value(this)), sl, rl; + search = String(search); + replace = String(replace); + sl = search.length; + rl = replace.length; + while ((index = str.indexOf(search, pos)) !== -1) { + str = str.slice(0, index) + replace + str.slice(index + sl); + pos = index + rl; + } + return str; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/plain-replace.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/plain-replace.js new file mode 100644 index 00000000..24ce16d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/plain-replace.js @@ -0,0 +1,10 @@ +'use strict'; + +var indexOf = String.prototype.indexOf, slice = String.prototype.slice; + +module.exports = function (search, replace) { + var index = indexOf.call(this, search); + if (index === -1) return String(this); + return slice.call(this, 0, index) + replace + + slice.call(this, index + String(search).length); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/implement.js new file mode 100644 index 00000000..4c39b9fb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'repeat', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/index.js new file mode 100644 index 00000000..15a800e8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.repeat + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/is-implemented.js new file mode 100644 index 00000000..f7b8750f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/is-implemented.js @@ -0,0 +1,8 @@ +'use strict'; + +var str = 'foo'; + +module.exports = function () { + if (typeof str.repeat !== 'function') return false; + return (str.repeat(2) === 'foofoo'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/shim.js new file mode 100644 index 00000000..0a3928b2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/shim.js @@ -0,0 +1,22 @@ +// Thanks: http://www.2ality.com/2014/01/efficient-string-repeat.html + +'use strict'; + +var value = require('../../../object/valid-value') + , toInteger = require('../../../number/to-integer'); + +module.exports = function (count) { + var str = String(value(this)), result; + count = toInteger(count); + if (count < 0) throw new RangeError("Count must be >= 0"); + if (!isFinite(count)) throw new RangeError("Count must be < ∞"); + result = ''; + if (!count) return result; + while (true) { + if (count & 1) result += str; + count >>>= 1; + if (count <= 0) break; + str += str; + } + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/implement.js new file mode 100644 index 00000000..d4f1eaf5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String.prototype, 'startsWith', + { value: require('./shim'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/index.js new file mode 100644 index 00000000..ec66a7c0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.prototype.startsWith + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/is-implemented.js new file mode 100644 index 00000000..a0556f19 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +var str = 'razdwatrzy'; + +module.exports = function () { + if (typeof str.startsWith !== 'function') return false; + return ((str.startsWith('trzy') === false) && + (str.startsWith('raz') === true)); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/shim.js new file mode 100644 index 00000000..aa5aaf41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/#/starts-with/shim.js @@ -0,0 +1,12 @@ +'use strict'; + +var value = require('../../../object/valid-value') + , toInteger = require('../../../number/to-integer') + + , max = Math.max, min = Math.min; + +module.exports = function (searchString/*, position*/) { + var start, self = String(value(this)); + start = min(max(toInteger(arguments[1]), 0), self.length); + return (self.indexOf(searchString, start) === start); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/format-method.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/format-method.js new file mode 100644 index 00000000..f1de1e30 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/format-method.js @@ -0,0 +1,24 @@ +'use strict'; + +var isCallable = require('../object/is-callable') + , value = require('../object/valid-value') + + , call = Function.prototype.call; + +module.exports = function (fmap) { + fmap = Object(value(fmap)); + return function (pattern) { + var context = value(this); + pattern = String(pattern); + return pattern.replace(/%([a-zA-Z]+)|\\([\u0000-\uffff])/g, + function (match, token, escape) { + var t, r; + if (escape) return escape; + t = token; + while (t && !(r = fmap[t])) t = t.slice(0, -1); + if (!r) return match; + if (isCallable(r)) r = call.call(r, context); + return r + token.slice(t.length); + }); + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/implement.js new file mode 100644 index 00000000..b062331c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String, 'fromCodePoint', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/index.js new file mode 100644 index 00000000..3f3110b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.fromCodePoint + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/is-implemented.js new file mode 100644 index 00000000..840a20e3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/is-implemented.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function () { + var fromCodePoint = String.fromCodePoint; + if (typeof fromCodePoint !== 'function') return false; + return fromCodePoint(0x1D306, 0x61, 0x1D307) === '\ud834\udf06a\ud834\udf07'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/shim.js new file mode 100644 index 00000000..41fd7378 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/from-code-point/shim.js @@ -0,0 +1,30 @@ +// Based on: +// http://norbertlindenberg.com/2012/05/ecmascript-supplementary-characters/ +// and: +// https://github.com/mathiasbynens/String.fromCodePoint/blob/master +// /fromcodepoint.js + +'use strict'; + +var floor = Math.floor, fromCharCode = String.fromCharCode; + +module.exports = function (codePoint/*, …codePoints*/) { + var chars = [], l = arguments.length, i, c, result = ''; + for (i = 0; i < l; ++i) { + c = Number(arguments[i]); + if (!isFinite(c) || c < 0 || c > 0x10FFFF || floor(c) !== c) { + throw new RangeError("Invalid code point " + c); + } + + if (c < 0x10000) { + chars.push(c); + } else { + c -= 0x10000; + chars.push((c >> 10) + 0xD800, (c % 0x400) + 0xDC00); + } + if (i + 1 !== l && chars.length <= 0x4000) continue; + result += fromCharCode.apply(null, chars); + chars.length = 0; + } + return result; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/index.js new file mode 100644 index 00000000..dbbcdf61 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + '#': require('./#'), + formatMethod: require('./format-method'), + fromCodePoint: require('./from-code-point'), + isString: require('./is-string'), + randomUniq: require('./random-uniq'), + raw: require('./raw') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/is-string.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/is-string.js new file mode 100644 index 00000000..719aeec1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/is-string.js @@ -0,0 +1,10 @@ +'use strict'; + +var toString = Object.prototype.toString + + , id = toString.call(''); + +module.exports = function (x) { + return (typeof x === 'string') || (x && (typeof x === 'object') && + ((x instanceof String) || (toString.call(x) === id))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/random-uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/random-uniq.js new file mode 100644 index 00000000..54ae6f8c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/random-uniq.js @@ -0,0 +1,11 @@ +'use strict'; + +var generated = Object.create(null) + + , random = Math.random; + +module.exports = function () { + var str; + do { str = random().toString(36).slice(2); } while (generated[str]); + return str; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/implement.js new file mode 100644 index 00000000..c417e659 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(String, 'raw', { value: require('./shim'), + configurable: true, enumerable: false, writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/index.js new file mode 100644 index 00000000..504a5de2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./is-implemented')() + ? String.raw + : require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/is-implemented.js new file mode 100644 index 00000000..d7204c0c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/is-implemented.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function () { + var raw = String.raw, test; + if (typeof raw !== 'function') return false; + test = ['foo\nbar', 'marko\n']; + test.raw = ['foo\\nbar', 'marko\\n']; + return raw(test, 'INSE\nRT') === 'foo\\nbarINSE\nRTmarko\\n'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/shim.js new file mode 100644 index 00000000..7096efbc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/string/raw/shim.js @@ -0,0 +1,15 @@ +'use strict'; + +var toPosInt = require('../../number/to-pos-integer') + , validValue = require('../../object/valid-value') + + , reduce = Array.prototype.reduce; + +module.exports = function (callSite/*, …substitutions*/) { + var args, rawValue = Object(validValue(Object(validValue(callSite)).raw)); + if (!toPosInt(rawValue.length)) return ''; + args = arguments; + return reduce.call(rawValue, function (a, b, i) { + return a + String(args[i]) + b; + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/__tad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/__tad.js new file mode 100644 index 00000000..88457788 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/__tad.js @@ -0,0 +1,3 @@ +'use strict'; + +exports.context = null; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/implement.js new file mode 100644 index 00000000..f0605399 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/@@iterator/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/shim.js new file mode 100644 index 00000000..e590d8f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/@@iterator/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.__generic = function (t, a) { + var iterator = t.call(this); + a.deep(iterator.next(), { value: '1', done: false }); + a.deep(iterator.next(), { value: '2', done: false }); + a.deep(iterator.next(), { value: '3', done: false }); + a.deep(iterator.next(), { value: undefined, done: true }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/_compare-by-length.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/_compare-by-length.js new file mode 100644 index 00000000..e40c305b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/_compare-by-length.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + var x = [4, 5, 6], y = { length: 8 }, w = {}, z = { length: 1 }; + + a.deep([x, y, w, z].sort(t), [w, z, x, y]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/binary-search.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/binary-search.js new file mode 100644 index 00000000..cf331737 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/binary-search.js @@ -0,0 +1,15 @@ +'use strict'; + +var compare = function (value) { return this - value; }; + +module.exports = function (t, a) { + var arr; + arr = [2, 5, 5, 8, 34, 67, 98, 345, 678]; + + // highest, equal match + a(t.call(arr, compare.bind(1)), 0, "All higher"); + a(t.call(arr, compare.bind(679)), arr.length - 1, "All lower"); + a(t.call(arr, compare.bind(4)), 0, "Mid"); + a(t.call(arr, compare.bind(5)), 2, "Match"); + a(t.call(arr, compare.bind(6)), 2, "Above"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/clear.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/clear.js new file mode 100644 index 00000000..a5b1c977 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/clear.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + var x = [1, 2, {}, 4]; + a(t.call(x), x, "Returns same array"); + a.deep(x, [], "Empties array"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/compact.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/compact.js new file mode 100644 index 00000000..6390eb26 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/compact.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a(t.call(this).length, 3); + }, + "": function (t, a) { + var o, x, y, z; + o = {}; + x = [0, 1, "", null, o, false, undefined, true]; + y = x.slice(0); + + a.not(z = t.call(x), x, "Returns different object"); + a.deep(x, y, "Origin not changed"); + a.deep(z, [0, 1, "", o, false, true], "Result"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/implement.js new file mode 100644 index 00000000..3bdbe868 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/concat/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/shim.js new file mode 100644 index 00000000..c30eb7ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/concat/shim.js @@ -0,0 +1,26 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr = [1, 3, 45], x = {}, subArr, subArr2, result; + + a.deep(t.call(arr, '2d', x, ['ere', 'fe', x], false, null), + [1, 3, 45, '2d', x, 'ere', 'fe', x, false, null], "Plain array"); + + subArr = new SubArray('lol', 'miszko'); + subArr2 = new SubArray('elo', 'fol'); + + result = t.call(subArr, 'df', arr, 'fef', subArr2, null); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, ['lol', 'miszko', 'df', 1, 3, 45, 'fef', 'elo', 'fol', null], + "Spreable by default"); + + SubArray.prototype['@@isConcatSpreadable'] = false; + + result = t.call(subArr, 'df', arr, 'fef', subArr2, null); + a.deep(result, ['lol', 'miszko', 'df', 1, 3, 45, 'fef', subArr2, null], + "Non spreadable"); + + delete SubArray.prototype['@@isConcatSpreadable']; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/contains.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/contains.js new file mode 100644 index 00000000..21404a17 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/contains.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a(t.call(this, this[1]), true, "Contains"); + a(t.call(this, {}), false, "Does Not contain"); + }, + "": function (t, a) { + var o, x = {}, y = {}; + + o = [1, 'raz', x]; + + a(t.call(o, 1), true, "First"); + a(t.call(o, '1'), false, "Type coercion"); + a(t.call(o, 'raz'), true, "Primitive"); + a(t.call(o, 'foo'), false, "Primitive not found"); + a(t.call(o, x), true, "Object found"); + a(t.call(o, y), false, "Object not found"); + a(t.call(o, 1, 1), false, "Position"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/implement.js new file mode 100644 index 00000000..36070477 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/copy-within/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/shim.js new file mode 100644 index 00000000..93c85ea3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/copy-within/shim.js @@ -0,0 +1,29 @@ +'use strict'; + +module.exports = function (t, a) { + var args, x; + + a.h1("2 args"); + x = [1, 2, 3, 4, 5]; + t.call(x, 0, 3); + a.deep(x, [4, 5, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 1, 3), [1, 4, 5, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 1, 2), [1, 3, 4, 5, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 2, 2), [1, 2, 3, 4, 5]); + + a.h1("3 args"); + a.deep(t.call([1, 2, 3, 4, 5], 0, 3, 4), [4, 2, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 1, 3, 4), [1, 4, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 1, 2, 4), [1, 3, 4, 4, 5]); + + a.h1("Negative args"); + a.deep(t.call([1, 2, 3, 4, 5], 0, -2), [4, 5, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], 0, -2, -1), [4, 2, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -2), [1, 3, 3, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -1), [1, 3, 4, 4, 5]); + a.deep(t.call([1, 2, 3, 4, 5], -4, -3), [1, 3, 4, 5, 5]); + + a.h1("Array-likes"); + args = { 0: 1, 1: 2, 2: 3, length: 3 }; + a.deep(t.call(args, -2, 0), { '0': 1, '1': 1, '2': 2, length: 3 }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/diff.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/diff.js new file mode 100644 index 00000000..bcfa3a0b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/diff.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a.deep(t.call(this, this), []); + }, + "": function (t, a) { + var x = {}, y = {}; + + a.deep(t.call([1, 'raz', x, 2, 'trzy', y], [x, 2, 'trzy']), [1, 'raz', y], + "Scope longer"); + a.deep(t.call([1, 'raz', x], [x, 2, 'trzy', 1, y]), ['raz'], + "Arg longer"); + a.deep(t.call([1, 'raz', x], []), [1, 'raz', x], "Empty arg"); + a.deep(t.call([], [1, y, 'sdfs']), [], "Empty scope"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/e-index-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/e-index-of.js new file mode 100644 index 00000000..4cf6c635 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/e-index-of.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}; + a(t.call([3, 'raz', {}, x, {}], x), 3, "Regular"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN), 2, "NaN"); + a(t.call([3, 'raz', 0, {}, -0], -0), 2, "-0"); + a(t.call([3, 'raz', -0, {}, 0], +0), 2, "+0"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, 3), 4, "fromIndex"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, -1), 4, "fromIndex negative #1"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, -2), 4, "fromIndex negative #2"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, -3), 2, "fromIndex negative #3"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/e-last-index-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/e-last-index-of.js new file mode 100644 index 00000000..ed4f7004 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/e-last-index-of.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}; + a(t.call([3, 'raz', {}, x, {}, x], x), 5, "Regular"); + a(t.call([3, 'raz', NaN, {}, x], NaN), 2, "NaN"); + a(t.call([3, 'raz', 0, {}, -0], -0), 4, "-0"); + a(t.call([3, 'raz', -0, {}, 0], +0), 4, "+0"); + a(t.call([3, 'raz', NaN, {}, NaN], NaN, 3), 2, "fromIndex"); + a(t.call([3, 'raz', NaN, 2, NaN], NaN, -1), 4, "Negative fromIndex #1"); + a(t.call([3, 'raz', NaN, 2, NaN], NaN, -2), 2, "Negative fromIndex #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/implement.js new file mode 100644 index 00000000..733209a1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/entries/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/shim.js new file mode 100644 index 00000000..bf40d310 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/entries/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.__generic = function (t, a) { + var iterator = t.call(this); + a.deep(iterator.next(), { value: [0, '1'], done: false }); + a.deep(iterator.next(), { value: [1, '2'], done: false }); + a.deep(iterator.next(), { value: [2, '3'], done: false }); + a.deep(iterator.next(), { value: undefined, done: true }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/exclusion.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/exclusion.js new file mode 100644 index 00000000..07b32d8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/exclusion.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + var x = {}; + a.deep(t.call(this, this, [this[0], this[2], x]), [x]); + }, + "": function (t, a) { + var x = {}, y = {}; + + a.deep(t.call([x, y]), [x, y], "No arguments"); + a.deep(t.call([x, 1], [], []), [x, 1], "Empty arguments"); + a.deep(t.call([1, 'raz', x], [2, 'raz', y], [2, 'raz', x]), [1, y]); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/implement.js new file mode 100644 index 00000000..2a01d285 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/fill/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/shim.js new file mode 100644 index 00000000..d67300fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/fill/shim.js @@ -0,0 +1,18 @@ +// Taken from https://github.com/paulmillr/es6-shim/blob/master/test/array.js + +'use strict'; + +module.exports = function (t, a) { + var x; + + x = [1, 2, 3, 4, 5, 6]; + a(t.call(x, -1), x, "Returns self object"); + a.deep(x, [-1, -1, -1, -1, -1, -1], "Value"); + + a.deep(t.call([1, 2, 3, 4, 5, 6], -1, 3), [1, 2, 3, -1, -1, -1], + "Positive start"); + a.deep(t.call([1, 2, 3, 4, 5, 6], -1, -3), [1, 2, 3, -1, -1, -1], + "Negative start"); + a.deep(t.call([1, 2, 3, 4, 5, 6], -1, 9), [1, 2, 3, 4, 5, 6], + "Large start"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/implement.js new file mode 100644 index 00000000..6d6b87cc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/filter/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/shim.js new file mode 100644 index 00000000..e8b5c398 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/filter/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr, x = {}, subArr, result; + + arr = ['foo', undefined, 0, '2d', false, x, null]; + + a.deep(t.call(arr, Boolean), ['foo', '2d', x], "Plain array"); + + subArr = new SubArray('foo', undefined, 0, '2d', false, x, null); + + result = t.call(subArr, Boolean); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, ['foo', '2d', x], "Result of subclass"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/implement.js new file mode 100644 index 00000000..8d85e618 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/find-index/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/shim.js new file mode 100644 index 00000000..b5fee463 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find-index/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +exports.__generic = function (t, a) { + var count = 0, o = {}, self = Object(this); + a(t.call(self, function (value, i, scope) { + a(value, this[i], "Value"); + a(i, count++, "Index"); + a(scope, this, "Scope"); + }, self), -1, "Falsy result"); + a(count, 3); + + count = -1; + a(t.call(this, function () { + return ++count ? o : null; + }, this), 1, "Truthy result"); + a(count, 1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/implement.js new file mode 100644 index 00000000..29fac41e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/find/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/shim.js new file mode 100644 index 00000000..ad2e6450 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/find/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +exports.__generic = function (t, a) { + var count = 0, o = {}, self = Object(this); + a(t.call(self, function (value, i, scope) { + a(value, this[i], "Value"); + a(i, count++, "Index"); + a(scope, this, "Scope"); + }, self), undefined, "Falsy result"); + a(count, 3); + + count = -1; + a(t.call(this, function () { + return ++count ? o : null; + }, this), this[1], "Truthy result"); + a(count, 1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/first-index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/first-index.js new file mode 100644 index 00000000..4aebad64 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/first-index.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a(t.call([]), null, "Empty"); + a(t.call([null]), 0, "One value"); + a(t.call([1, 2, 3]), 0, "Many values"); + a(t.call(new Array(1000)), null, "Sparse empty"); + x = []; + x[883] = undefined; + x[890] = null; + a(t.call(x), 883, "Manual sparse, distant value"); + x = new Array(1000); + x[657] = undefined; + x[700] = null; + a(t.call(x), 657, "Sparse, distant value"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/first.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/first.js new file mode 100644 index 00000000..87fde035 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/first.js @@ -0,0 +1,13 @@ +'use strict'; + +exports.__generic = function (t, a) { + a(t.call(this), this[0]); +}; +exports[''] = function (t, a) { + var x; + a(t.call([]), undefined, "Empty"); + a(t.call(new Array(234), undefined, "Sparse empty")); + x = new Array(2342); + x[434] = {}; + a(t.call(x), x[434], "Sparse"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/flatten.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/flatten.js new file mode 100644 index 00000000..65f1214b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/flatten.js @@ -0,0 +1,12 @@ +'use strict'; + +var o = [1, 2, [3, 4, [5, 6], 7, 8], 9, 10]; + +module.exports = { + __generic: function (t, a) { + a(t.call(this).length, 3); + }, + "Nested Arrays": function (t, a) { + a(t.call(o).length, 10); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/for-each-right.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/for-each-right.js new file mode 100644 index 00000000..2d24569d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/for-each-right.js @@ -0,0 +1,36 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + var count = 0, first, last, x, icount = this.length; + t.call(this, function (item, index, col) { + ++count; + if (!first) { + first = item; + } + last = item; + x = col; + a(index, --icount, "Index"); + }); + a(count, this.length, "Iterated"); + a(first, this[this.length - 1], "First is last"); + a(last, this[0], "Last is first"); + a.deep(x, Object(this), "Collection as third argument"); //jslint: skip + }, + "": function (t, a) { + var x = {}, y, count; + t.call([1], function () { y = this; }, x); + a(y, x, "Scope"); + y = 0; + t.call([3, 4, 4], function (a, i) { y += i; }); + a(y, 3, "Indexes"); + + x = [1, 3]; + x[5] = 'x'; + y = 0; + count = 0; + t.call(x, function (a, i) { ++count; y += i; }); + a(y, 6, "Misssing Indexes"); + a(count, 3, "Misssing Indexes, count"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/group.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/group.js new file mode 100644 index 00000000..32dc8c2d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/group.js @@ -0,0 +1,24 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + var count = 0, self; + + self = Object(this); + a.deep(t.call(self, function (v, i, scope) { + a(v, this[i], "Value"); + a(i, count++, "Index"); + a(scope, this, "Scope"); + return i; + }, self), { 0: [this[0]], 1: [this[1]], 2: [this[2]] }); + }, + "": function (t, a) { + var r; + r = t.call([2, 3, 3, 4, 5, 6, 7, 7, 23, 45, 34, 56], + function (v) { + return v % 2 ? 'odd' : 'even'; + }); + a.deep(r.odd, [3, 3, 5, 7, 7, 23, 45]); + a.deep(r.even, [2, 4, 6, 34, 56]); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/indexes-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/indexes-of.js new file mode 100644 index 00000000..3364170f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/indexes-of.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a.deep(t.call(this, this[1]), [1]); + }, + "": function (t, a) { + var x = {}; + a.deep(t.call([1, 3, 5, 3, 5], 6), [], "No result"); + a.deep(t.call([1, 3, 5, 1, 3, 5, 1], 1), [0, 3, 6], "Some results"); + a.deep(t.call([], x), [], "Empty array"); + a.deep(t.call([x, 3, {}, x, 3, 5, x], x), [0, 3, 6], "Search for object"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/intersection.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/intersection.js new file mode 100644 index 00000000..b72b2fb0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/intersection.js @@ -0,0 +1,24 @@ +'use strict'; + +var toArray = require('../../../array/to-array'); + +module.exports = { + __generic: function (t, a) { + a.deep(t.call(this, this, this), toArray(this)); + }, + "": function (t, a) { + var x = {}, y = {}, p, r; + a.deep(t.call([], [2, 3, 4]), [], "Empty #1"); + a.deep(t.call([2, 3, 4], []), [], "Empty #2"); + a.deep(t.call([2, 3, x], [y, 5, 7]), [], "Different"); + p = t.call([3, 5, 'raz', {}, 'dwa', x], [1, 3, 'raz', 'dwa', 'trzy', x, {}], + [3, 'raz', x, 65]); + r = [3, 'raz', x]; + p.sort(); + r.sort(); + a.deep(p, r, "Same parts"); + a.deep(t.call(r, r), r, "Same"); + a.deep(t.call([1, 2, x, 4, 5, y, 7], [7, y, 5, 4, x, 2, 1]), + [1, 2, x, 4, 5, y, 7], "Long reverse same"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/is-copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/is-copy.js new file mode 100644 index 00000000..e7f80e7a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/is-copy.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}; + a(t.call([], []), true, "Empty"); + a(t.call([], {}), true, "Empty lists"); + a(t.call([1, x, 'raz'], [1, x, 'raz']), true, "Same"); + a(t.call([1, x, 'raz'], { 0: 1, 1: x, 2: 'raz', length: 3 }), true, + "Same lists"); + a(t.call([1, x, 'raz'], [x, 1, 'raz']), false, "Diff order"); + a(t.call([1, x], [1, x, 'raz']), false, "Diff length #1"); + a(t.call([1, x, 'raz'], [1, x]), false, "Diff length #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/is-uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/is-uniq.js new file mode 100644 index 00000000..7349ba33 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/is-uniq.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}; + a(t.call([]), true, "Empty"); + a(t.call({}), true, "Empty lists"); + a(t.call([1, x, 'raz']), true, "Uniq"); + a(t.call([1, x, 1, 'raz']), false, "Not Uniq: primitive"); + a(t.call([1, x, '1', 'raz']), true, "Uniq: primitive"); + a(t.call([1, x, 1, {}, 'raz']), false, "Not Uniq: Obj"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/implement.js new file mode 100644 index 00000000..b0c1aa07 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/keys/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/shim.js new file mode 100644 index 00000000..a43c04ca --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/keys/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.__generic = function (t, a) { + var iterator = t.call(this); + a.deep(iterator.next(), { value: 0, done: false }); + a.deep(iterator.next(), { value: 1, done: false }); + a.deep(iterator.next(), { value: 2, done: false }); + a.deep(iterator.next(), { value: undefined, done: true }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/last-index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/last-index.js new file mode 100644 index 00000000..a1cac107 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/last-index.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a(t.call([]), null, "Empty"); + a(t.call([null]), 0, "One value"); + a(t.call([1, 2, 3]), 2, "Many values"); + a(t.call(new Array(1000)), null, "Sparse empty"); + x = []; + x[883] = null; + x[890] = undefined; + a(t.call(x), 890, "Manual sparse, distant value"); + x = new Array(1000); + x[657] = null; + x[700] = undefined; + a(t.call(x), 700, "Sparse, distant value"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/last.js new file mode 100644 index 00000000..8d051bc8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/last.js @@ -0,0 +1,15 @@ +'use strict'; + +exports.__generic = function (t, a) { + a(t.call(this), this[this.length - 1]); +}; + +exports[''] = function (t, a) { + var x; + a(t.call([]), undefined, "Empty"); + a(t.call(new Array(234), undefined, "Sparse empty")); + x = new Array(2342); + x[434] = {}; + x[450] = {}; + a(t.call(x), x[450], "Sparse"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/implement.js new file mode 100644 index 00000000..cdcbc8df --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/map/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/shim.js new file mode 100644 index 00000000..bbfefe8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/map/shim.js @@ -0,0 +1,19 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr, x = {}, subArr, result; + + arr = ['foo', undefined, 0, '2d', false, x, null]; + + a.deep(t.call(arr, Boolean), [true, false, false, true, false, true, false], + "Plain array"); + + subArr = new SubArray('foo', undefined, 0, '2d', false, x, null); + + result = t.call(subArr, Boolean); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, [true, false, false, true, false, true, false], + "Result of subclass"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/remove.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/remove.js new file mode 100644 index 00000000..3ebdca2d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/remove.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + var y = {}, z = {}, x = [9, z, 5, y, 'foo']; + t.call(x, y); + a.deep(x, [9, z, 5, 'foo']); + t.call(x, {}); + a.deep(x, [9, z, 5, 'foo'], "Not existing"); + t.call(x, 5); + a.deep(x, [9, z, 'foo'], "Primitive"); + x = [9, z, 5, y, 'foo']; + t.call(x, z, 5, 'foo'); + a.deep(x, [9, y], "More than one argument"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/separate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/separate.js new file mode 100644 index 00000000..42918b59 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/separate.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var x = [], y = {}, z = {}; + a.deep(t.call(x, y), [], "Empty"); + a.not(t.call(x), x, "Returns copy"); + a.deep(t.call([1], y), [1], "One"); + a.deep(t.call([1, 'raz'], y), [1, y, 'raz'], "One"); + a.deep(t.call([1, 'raz', x], y), [1, y, 'raz', y, x], "More"); + x = new Array(1000); + x[23] = 2; + x[3453] = 'raz'; + x[500] = z; + a.deep(t.call(x, y), [2, y, z, y, 'raz'], "Sparse"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/implement.js new file mode 100644 index 00000000..855ae2fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/slice/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/shim.js new file mode 100644 index 00000000..f674f347 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/slice/shim.js @@ -0,0 +1,17 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr, x = {}, subArr, result; + + arr = ['foo', undefined, 0, '2d', false, x, null]; + + a.deep(t.call(arr, 2, 4), [0, '2d'], "Plain array: result"); + + subArr = new SubArray('foo', undefined, 0, '2d', false, x, null); + + result = t.call(subArr, 2, 4); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, [0, '2d'], "Subclass: result"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/some-right.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/some-right.js new file mode 100644 index 00000000..900771a6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/some-right.js @@ -0,0 +1,43 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + var count = 0, first, last, x, icount = this.length; + t.call(this, function (item, index, col) { + ++count; + if (!first) { + first = item; + } + last = item; + x = col; + a(index, --icount, "Index"); + }); + a(count, this.length, "Iterated"); + a(first, this[this.length - 1], "First is last"); + a(last, this[0], "Last is first"); + a.deep(x, Object(this), "Collection as third argument"); //jslint: skip + }, + "": function (t, a) { + var x = {}, y, count; + t.call([1], function () { y = this; }, x); + a(y, x, "Scope"); + y = 0; + t.call([3, 4, 4], function (a, i) { y += i; }); + a(y, 3, "Indexes"); + + x = [1, 3]; + x[5] = 'x'; + y = 0; + count = 0; + a(t.call(x, function (a, i) { ++count; y += i; }), false, "Return"); + a(y, 6, "Misssing Indexes"); + a(count, 3, "Misssing Indexes, count"); + + count = 0; + a(t.call([-2, -3, -4, 2, -5], function (item) { + ++count; + return item > 0; + }), true, "Return"); + a(count, 2, "Break after true is returned"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/implement.js new file mode 100644 index 00000000..0d9f4618 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/splice/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/shim.js new file mode 100644 index 00000000..2c751e67 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/splice/shim.js @@ -0,0 +1,19 @@ +'use strict'; + +var SubArray = require('../../../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr, x = {}, subArr, result; + + arr = ['foo', undefined, 0, '2d', false, x, null]; + + a.deep(t.call(arr, 2, 2, 'bar'), [0, '2d'], "Plain array: result"); + a.deep(arr, ["foo", undefined, "bar", false, x, null], "Plain array: change"); + + subArr = new SubArray('foo', undefined, 0, '2d', false, x, null); + + result = t.call(subArr, 2, 2, 'bar'); + a(result instanceof SubArray, true, "Instance of subclass"); + a.deep(result, [0, '2d'], "Subclass: result"); + a.deep(subArr, ["foo", undefined, "bar", false, x, null], "Subclass: change"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/uniq.js new file mode 100644 index 00000000..2f7e6c4e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/uniq.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + __generic: function (t, a) { + a(t.call(this).length, 3); + }, + "": function (t, a) { + var o, x = {}, y = {}, z = {}, w; + o = [1, 2, x, 3, 1, 'raz', '1', y, x, 'trzy', z, 'raz']; + + a.not(w = t.call(o), o, "Returns different object"); + a.deep(w, [1, 2, x, 3, 'raz', '1', y, 'trzy', z], "Result"); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/implement.js new file mode 100644 index 00000000..9f40138c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../array/#/values/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/shim.js new file mode 100644 index 00000000..e590d8f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/#/values/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.__generic = function (t, a) { + var iterator = t.call(this); + a.deep(iterator.next(), { value: '1', done: false }); + a.deep(iterator.next(), { value: '2', done: false }); + a.deep(iterator.next(), { value: '3', done: false }); + a.deep(iterator.next(), { value: undefined, done: true }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/__scopes.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/__scopes.js new file mode 100644 index 00000000..fc240d30 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/__scopes.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.Array = ['1', '2', '3']; + +exports.Arguments = (function () { + return arguments; +}('1', '2', '3')); + +exports.String = "123"; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/_is-extensible.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/_is-extensible.js new file mode 100644 index 00000000..d387126f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/_is-extensible.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t, 'boolean'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/_sub-array-dummy-safe.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/_sub-array-dummy-safe.js new file mode 100644 index 00000000..29d8699d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/_sub-array-dummy-safe.js @@ -0,0 +1,7 @@ +'use strict'; + +var isArray = Array.isArray; + +module.exports = function (t, a) { + t((t === null) || isArray(t.prototype), true); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/_sub-array-dummy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/_sub-array-dummy.js new file mode 100644 index 00000000..29d8699d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/_sub-array-dummy.js @@ -0,0 +1,7 @@ +'use strict'; + +var isArray = Array.isArray; + +module.exports = function (t, a) { + t((t === null) || isArray(t.prototype), true); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/implement.js new file mode 100644 index 00000000..e0db846f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../array/from/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/shim.js new file mode 100644 index 00000000..310302ac --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/from/shim.js @@ -0,0 +1,60 @@ +// Some tests taken from: https://github.com/mathiasbynens/Array.from/blob/master/tests/tests.js + +'use strict'; + +module.exports = function (t, a) { + var o = [1, 2, 3], MyType; + a.not(t(o), o, "Array"); + a.deep(t(o), o, "Array: same content"); + a.deep(t('12r3v'), ['1', '2', 'r', '3', 'v'], "String"); + a.deep(t((function () { return arguments; }(3, o, 'raz'))), + [3, o, 'raz'], "Arguments"); + a.deep(t((function () { return arguments; }(3))), [3], + "Arguments with one numeric value"); + + a.deep(t({ 0: 'raz', 1: 'dwa', length: 2 }), ['raz', 'dwa'], "Other"); + + a.deep(t(o, function (val) { return (val + 2) * 10; }, 10), [30, 40, 50], + "Mapping"); + + a.throws(function () { t(); }, TypeError, "Undefined"); + a.deep(t(3), [], "Primitive"); + + a(t.length, 1, "Length"); + a.deep(t({ length: 0 }), [], "No values Array-like"); + a.deep(t({ length: -1 }), [], "Invalid length Array-like"); + a.deep(t({ length: -Infinity }), [], "Invalid length Array-like #2"); + a.throws(function () { t(undefined); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.deep(t(false), [], "Boolean"); + a.deep(t(-Infinity), [], "Inifity"); + a.deep(t(-0), [], "-0"); + a.deep(t(+0), [], "+0"); + a.deep(t(1), [], "1"); + a.deep(t(+Infinity), [], "+Infinity"); + a.deep(t({}), [], "Plain object"); + a.deep(t({ length: 1 }), [undefined], "Sparse array-like"); + a.deep(t({ '0': 'a', '1': 'b', length: 2 }, function (x) { return x + x; }), ['aa', 'bb'], + "Map"); + a.deep(t({ '0': 'a', '1': 'b', length: 2 }, function (x) { return String(this); }, undefined), + ['undefined', 'undefined'], "Map context"); + a.deep(t({ '0': 'a', '1': 'b', length: 2 }, function (x) { return String(this); }, 'x'), + ['x', 'x'], "Map primitive context"); + a.throws(function () { t({}, 'foo', 'x'); }, TypeError, "Non callable for map"); + + a.deep(t.call(null, { length: 1, '0': 'a' }), ['a'], "Null context"); + + a(t({ __proto__: { '0': 'abc', length: 1 } })[0], 'abc', "Values on prototype"); + + a.throws(function () { t.call(function () { return Object.freeze({}); }, {}); }, + TypeError, "Contructor producing freezed objects"); + + // Ensure no setters are called for the indexes + // Ensure no setters are called for the indexes + MyType = function () {}; + Object.defineProperty(MyType.prototype, '0', { + set: function (x) { throw new Error('Setter called: ' + x); } + }); + a.deep(t.call(MyType, { '0': 'abc', length: 1 }), { '0': 'abc', length: 1 }, + "Defined not set"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/generate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/generate.js new file mode 100644 index 00000000..d72e0568 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/generate.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}, y = {}; + a.deep(t(3), [undefined, undefined, undefined], "Just length"); + a.deep(t(0, 'x'), [], "No repeat"); + a.deep(t(1, x, y), [x], "Arguments length larger than repeat number"); + a.deep(t(3, x), [x, x, x], "Single argument"); + a.deep(t(5, x, y), [x, y, x, y, x], "Many arguments"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/is-plain-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/is-plain-array.js new file mode 100644 index 00000000..871a08ae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/is-plain-array.js @@ -0,0 +1,18 @@ +'use strict'; + +var SubArray = require('../../array/_sub-array-dummy-safe'); + +module.exports = function (t, a) { + var arr = [1, 2, 3]; + a(t(arr), true, "Array"); + a(t(null), false, "Null"); + a(t(), false, "Undefined"); + a(t('234'), false, "String"); + a(t(23), false, "Number"); + a(t({}), false, "Plain object"); + a(t({ length: 1, 0: 'raz' }), false, "Array-like"); + a(t(Object.create(arr)), false, "Array extension"); + if (!SubArray) return; + a(t(new SubArray(23)), false, "Subclass instance"); + a(t(Array.prototype), false, "Array.prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/implement.js new file mode 100644 index 00000000..30d53be2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../array/of/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/shim.js new file mode 100644 index 00000000..e6974420 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/of/shim.js @@ -0,0 +1,68 @@ +// Most tests taken from https://github.com/mathiasbynens/Array.of/blob/master/tests/tests.js +// Thanks @mathiasbynens + +'use strict'; + +var defineProperty = Object.defineProperty; + +module.exports = function (t, a) { + var x = {}, testObject, MyType; + + a.deep(t(), [], "No arguments"); + a.deep(t(3), [3], "One numeric argument"); + a.deep(t(3, 'raz', null, x, undefined), [3, 'raz', null, x, undefined], + "Many arguments"); + + a(t.length, 0, "Length"); + + a.deep(t('abc'), ['abc'], "String"); + a.deep(t(undefined), [undefined], "Undefined"); + a.deep(t(null), [null], "Null"); + a.deep(t(false), [false], "Boolean"); + a.deep(t(-Infinity), [-Infinity], "Infinity"); + a.deep(t(-0), [-0], "-0"); + a.deep(t(+0), [+0], "+0"); + a.deep(t(1), [1], "1"); + a.deep(t(1, 2, 3), [1, 2, 3], "Numeric args"); + a.deep(t(+Infinity), [+Infinity], "+Infinity"); + a.deep(t({ '0': 'a', '1': 'b', '2': 'c', length: 3 }), + [{ '0': 'a', '1': 'b', '2': 'c', length: 3 }], "Array like"); + a.deep(t(undefined, null, false, -Infinity, -0, +0, 1, 2, +Infinity), + [undefined, null, false, -Infinity, -0, +0, 1, 2, +Infinity], "Falsy arguments"); + + a.h1("Null context"); + a.deep(t.call(null, 'abc'), ['abc'], "String"); + a.deep(t.call(null, undefined), [undefined], "Undefined"); + a.deep(t.call(null, null), [null], "Null"); + a.deep(t.call(null, false), [false], "Boolean"); + a.deep(t.call(null, -Infinity), [-Infinity], "-Infinity"); + a.deep(t.call(null, -0), [-0], "-0"); + a.deep(t.call(null, +0), [+0], "+0"); + a.deep(t.call(null, 1), [1], "1"); + a.deep(t.call(null, 1, 2, 3), [1, 2, 3], "Numeric"); + a.deep(t.call(null, +Infinity), [+Infinity], "+Infinity"); + a.deep(t.call(null, { '0': 'a', '1': 'b', '2': 'c', length: 3 }), + [{ '0': 'a', '1': 'b', '2': 'c', length: 3 }], "Array-like"); + a.deep(t.call(null, undefined, null, false, -Infinity, -0, +0, 1, 2, +Infinity), + [undefined, null, false, -Infinity, -0, +0, 1, 2, +Infinity], "Falsy"); + + a.h1("Other constructor context"); + a.deep(t.call(Object, 1, 2, 3), { '0': 1, '1': 2, '2': 3, length: 3 }, "Many arguments"); + + testObject = Object(3); + testObject[0] = 1; + testObject[1] = 2; + testObject[2] = 3; + testObject.length = 3; + a.deep(t.call(Object, 1, 2, 3), testObject, "Test object"); + a(t.call(Object).length, 0, "No arguments"); + a.throws(function () { t.call(function () { return Object.freeze({}); }); }, TypeError, + "Frozen instance"); + + // Ensure no setters are called for the indexes + MyType = function () {}; + defineProperty(MyType.prototype, '0', { + set: function (x) { throw new Error('Setter called: ' + x); } + }); + a.deep(t.call(MyType, 'abc'), { '0': 'abc', length: 1 }, "Define, not set"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/to-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/to-array.js new file mode 100644 index 00000000..4985b5ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/to-array.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var o = [1, 2, 3]; + a(t(o), o, "Array"); + a.deep(t('12r3v'), ['1', '2', 'r', '3', 'v'], "String"); + a.deep(t((function () { return arguments; }(3, o, 'raz'))), + [3, o, 'raz'], "Arguments"); + a.deep(t((function () { return arguments; }(3))), [3], + "Arguments with one numeric value"); + + a.deep(t({ 0: 'raz', 1: 'dwa', length: 2 }), ['raz', 'dwa'], "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/valid-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/valid-array.js new file mode 100644 index 00000000..3732192d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/array/valid-array.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.throws(function () { t(0); }, TypeError, "Number"); + a.throws(function () { t(true); }, TypeError, "Boolean"); + a.throws(function () { t('raz'); }, TypeError, "String"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a.throws(function () { t({}); }, TypeError, "Object"); + a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like"); + a(t(x = []), x, "Array"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/boolean/is-boolean.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/boolean/is-boolean.js new file mode 100644 index 00000000..4e6b3cb7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/boolean/is-boolean.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + a(t('arar'), false, "String"); + a(t(12), false, "Number"); + a(t(false), true, "Boolean"); + a(t(new Boolean(false)), true, "Boolean object"); + a(t(new Date()), false, "Date"); + a(t(new String('raz')), false, "String object"); + a(t({}), false, "Plain object"); + a(t(/a/), false, "Regular expression"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/copy.js new file mode 100644 index 00000000..767c5e16 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/copy.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var o = new Date(), o2; + + o2 = t.call(o); + a.not(o, o2, "Different objects"); + a.ok(o2 instanceof Date, "Instance of Date"); + a(o.getTime(), o2.getTime(), "Same time"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/days-in-month.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/days-in-month.js new file mode 100644 index 00000000..9ddba55f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/days-in-month.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(new Date(2001, 0, 1)), 31, "January"); + a(t.call(new Date(2001, 1, 1)), 28, "February"); + a(t.call(new Date(2000, 1, 1)), 29, "February (leap)"); + a(t.call(new Date(2001, 2, 1)), 31, "March"); + a(t.call(new Date(2001, 3, 1)), 30, "April"); + a(t.call(new Date(2001, 4, 1)), 31, "May"); + a(t.call(new Date(2001, 5, 1)), 30, "June"); + a(t.call(new Date(2001, 6, 1)), 31, "July"); + a(t.call(new Date(2001, 7, 1)), 31, "August"); + a(t.call(new Date(2001, 8, 1)), 30, "September"); + a(t.call(new Date(2001, 9, 1)), 31, "October"); + a(t.call(new Date(2001, 10, 1)), 30, "November"); + a(t.call(new Date(2001, 11, 1)), 31, "December"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/floor-day.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/floor-day.js new file mode 100644 index 00000000..d4f4a908 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/floor-day.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(new Date(2000, 0, 1, 13, 32, 34, 234)).valueOf(), + new Date(2000, 0, 1).valueOf()); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/floor-month.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/floor-month.js new file mode 100644 index 00000000..b4a81bef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/floor-month.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(new Date(2000, 0, 15, 13, 32, 34, 234)).valueOf(), + new Date(2000, 0, 1).valueOf()); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/floor-year.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/floor-year.js new file mode 100644 index 00000000..aae117e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/floor-year.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(new Date(2000, 5, 13, 13, 32, 34, 234)).valueOf(), + new Date(2000, 0, 1).valueOf()); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/format.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/format.js new file mode 100644 index 00000000..e68e4bf7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/#/format.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + var dt = new Date(2011, 2, 3, 3, 5, 5, 32); + a(t.call(dt, ' %Y.%y.%m.%d.%H.%M.%S.%L '), ' 2011.11.03.03.03.05.05.032 '); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/is-date.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/is-date.js new file mode 100644 index 00000000..109093df --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/is-date.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t('arar'), false, "String"); + a(t(12), false, "Number"); + a(t(true), false, "Boolean"); + a(t(new Date()), true, "Date"); + a(t(new String('raz')), false, "String object"); + a(t({}), false, "Plain object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/valid-date.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/valid-date.js new file mode 100644 index 00000000..98787e40 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/date/valid-date.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var d = new Date(); + a(t(d), d, "Date"); + a.throws(function () { + t({}); + }, "Object"); + a.throws(function () { + t({ valueOf: function () { return 20; } }); + }, "Number object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/#/throw.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/#/throw.js new file mode 100644 index 00000000..1213cfc3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/#/throw.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var e = new Error(); + try { + t.call(e); + } catch (e2) { + a(e2, e); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/custom.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/custom.js new file mode 100644 index 00000000..d4ff500c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/custom.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var T = t, err = new T('My Error', 'MY_ERROR', { errno: 123 }); + a(err instanceof Error, true, "Instance of error"); + a(err.constructor, Error, "Constructor"); + a(err.name, 'Error', "Name"); + a(String(err), 'Error: My Error', "String representation"); + a(err.code, 'MY_ERROR', "Code"); + a(err.errno, 123, "Errno"); + a(typeof err.stack, 'string', "Stack trace"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/is-error.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/is-error.js new file mode 100644 index 00000000..f8b5e200 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/is-error.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(), false, "Undefined"); + a(t(1), false, "Primitive"); + a(t({}), false, "Objectt"); + a(t({ toString: function () { return '[object Error]'; } }), false, + "Fake error"); + a(t(new Error()), true, "Error"); + a(t(new EvalError()), true, "EvalError"); + a(t(new RangeError()), true, "RangeError"); + a(t(new ReferenceError()), true, "ReferenceError"); + a(t(new SyntaxError()), true, "SyntaxError"); + a(t(new TypeError()), true, "TypeError"); + a(t(new URIError()), true, "URIError"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/valid-error.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/valid-error.js new file mode 100644 index 00000000..e04cdb33 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/error/valid-error.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + var e = new Error(); + a(t(e), e, "Error"); + a.throws(function () { + t({}); + }, "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/compose.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/compose.js new file mode 100644 index 00000000..83de5e84 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/compose.js @@ -0,0 +1,9 @@ +'use strict'; + +var f = function (a, b) { return ['a', arguments.length, a, b]; } + , g = function (a) { return ['b', arguments.length].concat(a); } + , h = function (a) { return ['c', arguments.length].concat(a); }; + +module.exports = function (t, a) { + a.deep(t.call(h, g, f)(1, 2), ['c', 1, 'b', 1, 'a', 2, 1, 2]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/copy.js new file mode 100644 index 00000000..7a22e2f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/copy.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = function (t, a) { + var foo = 'raz', bar = 'dwa' + , fn = function marko(a, b) { return this + a + b + foo + bar; } + , result, o = {}; + + fn.prototype = o; + + fn.foo = 'raz'; + + result = t.call(fn); + + a(result.length, fn.length, "Length"); + a(result.name, fn.name, "Length"); + a(result.call('marko', 'el', 'fe'), 'markoelferazdwa', "Body"); + a(result.prototype, fn.prototype, "Prototype"); + a(result.foo, fn.foo, "Custom property"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/curry.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/curry.js new file mode 100644 index 00000000..18fb0389 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/curry.js @@ -0,0 +1,18 @@ +'use strict'; + +var toArray = require('../../../array/to-array') + + , f = function () { return toArray(arguments); }; + +module.exports = function (t, a) { + var x, y = {}, z; + a.deep(t.call(f, 0, 1, 2)(3), [], "0 arguments"); + x = t.call(f, 5, {}); + a(x.length, 5, "Length #1"); + z = x(1, 2); + a(z.length, 3, "Length #2"); + z = z(3, 4); + a(z.length, 1, "Length #1"); + a.deep(z(5, 6), [1, 2, 3, 4, 5], "Many arguments"); + a.deep(x(8, 3)(y, 45)('raz', 6), [8, 3, y, 45, 'raz'], "Many arguments #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/lock.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/lock.js new file mode 100644 index 00000000..44a12d7b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/lock.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(function () { + return arguments.length; + })(1, 2, 3), 0); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/not.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/not.js new file mode 100644 index 00000000..c0f5e9d4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/not.js @@ -0,0 +1,11 @@ +'use strict'; + +var identity = require('../../../function/identity') + , noop = require('../../../function/noop'); + +module.exports = function (t, a) { + a(t.call(identity)(''), true, "Falsy"); + a(t.call(noop)(), true, "Undefined"); + a(t.call(identity)({}), false, "Any object"); + a(t.call(identity)(true), false, "True"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/partial.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/partial.js new file mode 100644 index 00000000..bd00ce75 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/partial.js @@ -0,0 +1,9 @@ +'use strict'; + +var toArray = require('../../../array/to-array') + + , f = function () { return toArray(arguments); }; + +module.exports = function (t, a) { + a.deep(t.call(f, 1)(2, 3), [1, 2, 3]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/spread.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/spread.js new file mode 100644 index 00000000..b82dfecf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/spread.js @@ -0,0 +1,8 @@ +'use strict'; + +var f = function (a, b) { return this[a] + this[b]; } + , o = { a: 3, b: 4 }; + +module.exports = function (t, a) { + a(t.call(f).call(o, ['a', 'b']), 7); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/to-string-tokens.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/to-string-tokens.js new file mode 100644 index 00000000..4c54d303 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/#/to-string-tokens.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t.call(function (a, b) { return this[a] + this[b]; }), + { args: 'a, b', body: ' return this[a] + this[b]; ' }); + a.deep(t.call(function () {}), + { args: '', body: '' }); + a.deep(t.call(function (raz) {}), + { args: 'raz', body: '' }); + a.deep(t.call(function () { Object(); }), + { args: '', body: ' Object(); ' }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/_define-length.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/_define-length.js new file mode 100644 index 00000000..8f037e85 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/_define-length.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var foo = 'raz', bar = 'dwa' + , fn = function (a, b) { return this + a + b + foo + bar; } + , result; + + result = t(fn, 3); + a(result.call('marko', 'el', 'fe'), 'markoelferazdwa', "Content"); + a(result.length, 3, "Length"); + a(result.prototype, fn.prototype, "Prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/constant.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/constant.js new file mode 100644 index 00000000..fda52aa4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/constant.js @@ -0,0 +1,7 @@ +'use strict'; + +var o = {}; + +module.exports = function (t, a) { + a(t(o)(), o); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/identity.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/identity.js new file mode 100644 index 00000000..8013e2e5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/identity.js @@ -0,0 +1,7 @@ +'use strict'; + +var o = {}; + +module.exports = function (t, a) { + a(t(o), o); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/invoke.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/invoke.js new file mode 100644 index 00000000..fcce4aaa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/invoke.js @@ -0,0 +1,9 @@ +'use strict'; + +var constant = require('../../function/constant') + + , o = { b: constant('c') }; + +module.exports = function (t, a) { + a(t('b')(o), 'c'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/is-arguments.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/is-arguments.js new file mode 100644 index 00000000..f8de8812 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/is-arguments.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + var args, dummy; + args = (function () { return arguments; }()); + dummy = { '0': 1, '1': 2 }; + Object.defineProperty(dummy, 'length', { value: 2 }); + a(t(args), true, "Arguments"); + a(t(dummy), false, "Dummy"); + a(t([]), false, "Array"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/is-function.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/is-function.js new file mode 100644 index 00000000..83acc42f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/is-function.js @@ -0,0 +1,8 @@ +'use strict'; + +var o = { call: Function.prototype.call, apply: Function.prototype.apply }; + +module.exports = function (t, a) { + a(t(function () {}), true, "Function is function"); + a(t(o), false, "Plain object is not function"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/noop.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/noop.js new file mode 100644 index 00000000..4305c6fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/noop.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t(1, 2, 3), 'undefined'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/pluck.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/pluck.js new file mode 100644 index 00000000..5bf9583a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/pluck.js @@ -0,0 +1,7 @@ +'use strict'; + +var o = { foo: 'bar' }; + +module.exports = function (t, a) { + a(t('foo')(o), o.foo); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/valid-function.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/valid-function.js new file mode 100644 index 00000000..59b16233 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/function/valid-function.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + var f = function () {}; + a(t(f), f, "Function"); + f = new Function(); + a(t(f), f, "Function"); + a.throws(function () { + t({}); + }, "Object"); + a.throws(function () { + t(/re/); + }, "RegExp"); + a.throws(function () { + t({ call: function () { return 20; } }); + }, "Plain object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/global.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/global.js new file mode 100644 index 00000000..1f452aef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/global.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a.ok(t && typeof t === 'object'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/for-each.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/for-each.js new file mode 100644 index 00000000..0fed8ad8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/for-each.js @@ -0,0 +1,40 @@ +'use strict'; + +var ArrayIterator = require('es6-iterator/array') + + , slice = Array.prototype.slice; + +module.exports = function (t, a) { + var i = 0, x = ['raz', 'dwa', 'trzy'], y = {}; + t(x, function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Array " + i + "#"); + a(this, y, "Array: context: " + (i++) + "#"); + }, y); + i = 0; + t((function () { return arguments; }('raz', 'dwa', 'trzy')), function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Arguments" + i + "#"); + a(this, y, "Arguments: context: " + (i++) + "#"); + }, y); + i = 0; + t({ 0: 'raz', 1: 'dwa', 2: 'trzy', length: 3 }, function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Array-like" + i + "#"); + a(this, y, "Array-like: context: " + (i++) + "#"); + }, y); + i = 0; + t(x = 'foo', function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#"); + a(this, y, "Regular String: context: " + (i++) + "#"); + }, y); + i = 0; + x = ['r', '💩', 'z']; + t('r💩z', function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#"); + a(this, y, "Unicode String: context: " + (i++) + "#"); + }, y); + i = 0; + t(new ArrayIterator(x), function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Iterator " + i + "#"); + a(this, y, "Iterator: context: " + (i++) + "#"); + }, y); + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/is.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/is.js new file mode 100644 index 00000000..c0d2a43e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/is.js @@ -0,0 +1,20 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (t, a) { + var x; + a(t([]), true, "Array"); + a(t(""), true, "String"); + a(t((function () { return arguments; }())), true, "Arguments"); + a(t({ length: 0 }), true, "List object"); + a(t(function () {}), false, "Function"); + a(t({}), false, "Plain object"); + a(t(/raz/), false, "Regexp"); + a(t(), false, "No argument"); + a(t(null), false, "Null"); + a(t(undefined), false, "Undefined"); + x = {}; + x[iteratorSymbol] = function () {}; + a(t(x), true, "Iterable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/validate-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/validate-object.js new file mode 100644 index 00000000..da12529b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/validate-object.js @@ -0,0 +1,20 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a.throws(function () { t(''); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Plain Object"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + + a(t(x = { length: 1 }), x, "Array like"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); + x = {}; + x[iteratorSymbol] = function () {}; + a(t(x), x, "Iterable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/validate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/validate.js new file mode 100644 index 00000000..bcc2ad3d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/iterable/validate.js @@ -0,0 +1,20 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a(t(''), '', "''"); + a.throws(function () { t({}); }, TypeError, "Plain Object"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + + a(t(x = { length: 1 }), x, "Array like"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); + x = {}; + x[iteratorSymbol] = function () {}; + a(t(x), x, "Iterable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/_pack-ieee754.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/_pack-ieee754.js new file mode 100644 index 00000000..9041431d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/_pack-ieee754.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t(1.337, 8, 23), [63, 171, 34, 209]); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/_unpack-ieee754.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/_unpack-ieee754.js new file mode 100644 index 00000000..ca30b820 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/_unpack-ieee754.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t([63, 171, 34, 209], 8, 23), 1.3370000123977661); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/implement.js new file mode 100644 index 00000000..01fb6d08 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/acosh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/shim.js new file mode 100644 index 00000000..3d710c79 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/acosh/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-1), NaN, "Negative"); + a(t(0), NaN, "Zero"); + a(t(0.5), NaN, "Below 1"); + a(t(1), 0, "1"); + a(t(2), 1.3169578969248166, "Other"); + a(t(Infinity), Infinity, "Infinity"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/implement.js new file mode 100644 index 00000000..d1fcecee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/asinh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/shim.js new file mode 100644 index 00000000..d9fbe49e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/asinh/shim.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(t(-2), -1.4436354751788103, "Negative"); + a(t(2), 1.4436354751788103, "Positive"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/implement.js new file mode 100644 index 00000000..cba8fad8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/atanh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/shim.js new file mode 100644 index 00000000..a857b496 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/atanh/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-2), NaN, "Less than -1"); + a(t(2), NaN, "Greater than 1"); + a(t(-1), -Infinity, "-1"); + a(t(1), Infinity, "1"); + a(t(0), 0, "Zero"); + a(t(0.5), 0.5493061443340549, "Ohter"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/implement.js new file mode 100644 index 00000000..374d4b38 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/cbrt/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/shim.js new file mode 100644 index 00000000..43ab68b8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cbrt/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(t(-1), -1, "-1"); + a(t(1), 1, "1"); + a(t(2), 1.2599210498948732, "Ohter"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/implement.js new file mode 100644 index 00000000..44f88155 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/clz32/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/shim.js new file mode 100644 index 00000000..a769b39b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/clz32/shim.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(1), 31, "1"); + a(t(1000), 22, "1000"); + a(t(), 32, "No arguments"); + a(t(Infinity), 32, "Infinity"); + a(t(-Infinity), 32, "-Infinity"); + a(t("foo"), 32, "String"); + a(t(true), 31, "Boolean"); + a(t(3.5), 30, "Float"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/implement.js new file mode 100644 index 00000000..f3c712b1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/cosh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/shim.js new file mode 100644 index 00000000..419c1236 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/cosh/shim.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 1, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), Infinity, "-Infinity"); + a(t(1), 1.5430806348152437, "1"); + a(t(Number.MAX_VALUE), Infinity); + a(t(-Number.MAX_VALUE), Infinity); + a(t(Number.MIN_VALUE), 1); + a(t(-Number.MIN_VALUE), 1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/implement.js new file mode 100644 index 00000000..c2129672 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/expm1/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/shim.js new file mode 100644 index 00000000..15f0e796 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/expm1/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -1, "-Infinity"); + a(t(1).toFixed(15), '1.718281828459045', "1"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/implement.js new file mode 100644 index 00000000..c909af7c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/fround/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/shim.js new file mode 100644 index 00000000..4ef6d4ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/fround/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(t(1.337), 1.3370000123977661, "1"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/implement.js new file mode 100644 index 00000000..99466464 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/hypot/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/shim.js new file mode 100644 index 00000000..91d950a5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/hypot/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(), 0, "No arguments"); + a(t(0, -0, 0), 0, "Zeros"); + a(t(4, NaN, Infinity), Infinity, "Infinity"); + a(t(4, NaN, -Infinity), Infinity, "Infinity"); + a(t(4, NaN, 34), NaN, "NaN"); + a(t(3, 4), 5, "#1"); + a(t(3, 4, 5), 7.0710678118654755, "#2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/implement.js new file mode 100644 index 00000000..7b2a2a61 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/imul/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/shim.js new file mode 100644 index 00000000..a2ca7fe7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/imul/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(), 0, "No arguments"); + a(t(0, 0), 0, "Zeros"); + a(t(2, 4), 8, "#1"); + a(t(-1, 8), -8, "#2"); + a(t(0xfffffffe, 5), -10, "#3"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/implement.js new file mode 100644 index 00000000..4b3b4a45 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/log10/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/shim.js new file mode 100644 index 00000000..5fa0d5be --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log10/shim.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-0.5), NaN, "Less than 0"); + a(t(0), -Infinity, "0"); + a(t(1), 0, "1"); + a(t(Infinity), Infinity, "Infinity"); + a(t(2), 0.3010299956639812, "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/implement.js new file mode 100644 index 00000000..5d269bd3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/log1p/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/shim.js new file mode 100644 index 00000000..d495ce04 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log1p/shim.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-1.5), NaN, "Less than -1"); + a(t(-1), -Infinity, "-1"); + a(t(0), 0, "0"); + a(t(Infinity), Infinity, "Infinity"); + a(t(1), 0.6931471805599453, "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/implement.js new file mode 100644 index 00000000..92b501ac --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/log2/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/shim.js new file mode 100644 index 00000000..faa9c32a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/log2/shim.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(-0.5), NaN, "Less than 0"); + a(t(0), -Infinity, "0"); + a(t(1), 0, "1"); + a(t(Infinity), Infinity, "Infinity"); + a(t(3).toFixed(15), '1.584962500721156', "Other"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/implement.js new file mode 100644 index 00000000..5875c42d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/sign/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/shim.js new file mode 100644 index 00000000..b6b89c15 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sign/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +var is = require('../../../object/is'); + +module.exports = function (t, a) { + a(is(t(0), +0), true, "+0"); + a(is(t(-0), -0), true, "-0"); + a(t({}), NaN, true, "NaN"); + a(t(-234234234), -1, "Negative"); + a(t(234234234), 1, "Positive"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/implement.js new file mode 100644 index 00000000..e52089e4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/sinh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/shim.js new file mode 100644 index 00000000..4f63b59e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/sinh/shim.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(t(1), 1.1752011936438014, "1"); + a(t(Number.MAX_VALUE), Infinity); + a(t(-Number.MAX_VALUE), -Infinity); + a(t(Number.MIN_VALUE), 5e-324); + a(t(-Number.MIN_VALUE), -5e-324); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/implement.js new file mode 100644 index 00000000..a96bf193 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/tanh/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/shim.js new file mode 100644 index 00000000..2c67aaf4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/tanh/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), 1, "Infinity"); + a(t(-Infinity), -1, "-Infinity"); + a(t(1), 0.7615941559557649, "1"); + a(t(Number.MAX_VALUE), 1); + a(t(-Number.MAX_VALUE), -1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/implement.js new file mode 100644 index 00000000..1830e61f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../math/trunc/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/shim.js new file mode 100644 index 00000000..9e5eed79 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/math/trunc/shim.js @@ -0,0 +1,16 @@ +'use strict'; + +var is = require('../../../object/is'); + +module.exports = function (t, a) { + a(t({}), NaN, "NaN"); + a(t(0), 0, "Zero"); + a(t(Infinity), Infinity, "Infinity"); + a(t(-Infinity), -Infinity, "-Infinity"); + a(is(t(0.234), 0), true, "0"); + a(is(t(-0.234), -0), true, "-0"); + a(t(13.7), 13, "Positive #1"); + a(t(12.3), 12, "Positive #2"); + a(t(-12.3), -12, "Negative #1"); + a(t(-14.7), -14, "Negative #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/#/pad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/#/pad.js new file mode 100644 index 00000000..e0208235 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/#/pad.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(78, 4), '0078'); + a(t.call(65.12323, 4, 3), '0065.123', "Precision"); + a(t.call(65, 4, 3), '0065.000', "Precision integer"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/epsilon/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/epsilon/implement.js new file mode 100644 index 00000000..574da75d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/epsilon/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/epsilon/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/epsilon/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/epsilon/index.js new file mode 100644 index 00000000..c892fd47 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/epsilon/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t, 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/epsilon/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/epsilon/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/epsilon/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/implement.js new file mode 100644 index 00000000..b35345fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/is-finite/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/shim.js new file mode 100644 index 00000000..5205d1c2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-finite/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(2), true, "Number"); + a(t('23'), false, "Not numeric"); + a(t(NaN), false, "NaN"); + a(t(Infinity), false, "Infinity"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/implement.js new file mode 100644 index 00000000..127149ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/is-integer/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/shim.js new file mode 100644 index 00000000..3f3985c3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-integer/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(2), true, "Number"); + a(t(2.34), false, "Float"); + a(t('23'), false, "Not numeric"); + a(t(NaN), false, "NaN"); + a(t(Infinity), false, "Infinity"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/implement.js new file mode 100644 index 00000000..2f01d6d3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/is-nan/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/shim.js new file mode 100644 index 00000000..425723e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-nan/shim.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(2), false, "Number"); + a(t({}), false, "Not numeric"); + a(t(NaN), true, "NaN"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-number.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-number.js new file mode 100644 index 00000000..27513347 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-number.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(0), true, "Zero"); + a(t(NaN), true, "NaN"); + a(t(Infinity), true, "Infinity"); + a(t(12), true, "Number"); + a(t(false), false, "Boolean"); + a(t(new Date()), false, "Date"); + a(t(new Number(2)), true, "Number object"); + a(t('asdfaf'), false, "String"); + a(t(''), false, "Empty String"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/implement.js new file mode 100644 index 00000000..33667e2e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/is-safe-integer/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/shim.js new file mode 100644 index 00000000..77e06674 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/is-safe-integer/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(2), true, "Number"); + a(t(2.34), false, "Float"); + a(t(Math.pow(2, 53)), false, "Too large"); + a(t(Math.pow(2, 53) - 1), true, "Maximum"); + a(t('23'), false, "Not numeric"); + a(t(NaN), false, "NaN"); + a(t(Infinity), false, "Infinity"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/max-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/max-safe-integer/implement.js new file mode 100644 index 00000000..bef00ca4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/max-safe-integer/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/max-safe-integer/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/max-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/max-safe-integer/index.js new file mode 100644 index 00000000..c892fd47 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/max-safe-integer/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t, 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/max-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/max-safe-integer/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/max-safe-integer/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/min-safe-integer/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/min-safe-integer/implement.js new file mode 100644 index 00000000..fa440248 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/min-safe-integer/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../number/min-safe-integer/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/min-safe-integer/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/min-safe-integer/index.js new file mode 100644 index 00000000..c892fd47 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/min-safe-integer/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(typeof t, 'number'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/min-safe-integer/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/min-safe-integer/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/min-safe-integer/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/to-integer.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/to-integer.js new file mode 100644 index 00000000..ff326ba7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/to-integer.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), 0, "NaN"); + a(t(20), 20, "Positive integer"); + a(t('-20'), -20, "String negative integer"); + a(t(Infinity), Infinity, "Infinity"); + a(t(15.343), 15, "Float"); + a(t(-15.343), -15, "Negative float"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/to-pos-integer.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/to-pos-integer.js new file mode 100644 index 00000000..2f3b4e67 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/to-pos-integer.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), 0, "NaN"); + a(t(20), 20, "Positive integer"); + a(t(-20), 0, "Negative integer"); + a(t(Infinity), Infinity, "Infinity"); + a(t(15.343), 15, "Float"); + a(t(-15.343), 0, "Negative float"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/to-uint32.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/to-uint32.js new file mode 100644 index 00000000..00d05bdf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/number/to-uint32.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), 0, "Not numeric"); + a(t(-4), 4294967292, "Negative"); + a(t(133432), 133432, "Positive"); + a(t(8589934592), 0, "Greater than maximum"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/_iterate.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/_iterate.js new file mode 100644 index 00000000..179afed8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/_iterate.js @@ -0,0 +1,30 @@ +'use strict'; + +module.exports = function (t, a) { + var o = { raz: 1, dwa: 2, trzy: 3 } + , o2 = {}, o3 = {}, arr, i = -1; + + t = t('forEach'); + t(o, function (value, name, self, index) { + o2[name] = value; + a(index, ++i, "Index"); + a(self, o, "Self"); + a(this, o3, "Scope"); + }, o3); + a.deep(o2, o); + + arr = []; + o2 = {}; + i = -1; + t(o, function (value, name, self, index) { + arr.push(value); + o2[name] = value; + a(index, ++i, "Index"); + a(self, o, "Self"); + a(this, o3, "Scope"); + }, o3, function (a, b) { + return o[b] - o[a]; + }); + a.deep(o2, o, "Sort by Values: Content"); + a.deep(arr, [3, 2, 1], "Sort by Values: Order"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/implement.js new file mode 100644 index 00000000..40065594 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../object/assign/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/shim.js new file mode 100644 index 00000000..9afe5f65 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/assign/shim.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + var o1 = { a: 1, b: 2 } + , o2 = { b: 3, c: 4 }; + + a(t(o1, o2), o1, "Returns self"); + a.deep(o1, { a: 1, b: 3, c: 4 }, "Single: content"); + + a.deep(t({}, o1, o2), { a: 1, b: 3, c: 4 }, "Multi argument"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/clear.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/clear.js new file mode 100644 index 00000000..bfc08cc2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/clear.js @@ -0,0 +1,13 @@ +'use strict'; + +var isEmpty = require('../../object/is-empty'); + +module.exports = function (t, a) { + var x = {}; + a(t(x), x, "Empty: Returns same object"); + a(isEmpty(x), true, "Empty: Not changed"); + x.foo = 'raz'; + x.bar = 'dwa'; + a(t(x), x, "Same object"); + a(isEmpty(x), true, "Emptied"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/compact.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/compact.js new file mode 100644 index 00000000..9c9064c7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/compact.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}, y = {}, z; + z = t(x); + a.not(z, x, "Returns different object"); + a.deep(z, {}, "Empty on empty"); + + x = { foo: 'bar', a: 0, b: false, c: '', d: '0', e: null, bar: y, + elo: undefined }; + z = t(x); + a.deep(z, { foo: 'bar', a: 0, b: false, c: '', d: '0', bar: y }, + "Cleared null values"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/compare.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/compare.js new file mode 100644 index 00000000..cb942410 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/compare.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var d = new Date(); + + a.ok(t(12, 3) > 0, "Numbers"); + a.ok(t(2, 13) < 0, "Numbers #2"); + a.ok(t("aaa", "aa") > 0, "Strings"); + a.ok(t("aa", "ab") < 0, "Strings #2"); + a(t("aa", "aa"), 0, "Strings same"); + a(t(d, new Date(d.getTime())), 0, "Same date"); + a.ok(t(d, new Date(d.getTime() + 1)) < 0, "Different date"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/copy-deep.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/copy-deep.js new file mode 100644 index 00000000..a4023bc8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/copy-deep.js @@ -0,0 +1,24 @@ +'use strict'; + +var stringify = JSON.stringify; + +module.exports = function (t, a) { + var o = { 1: 'raz', 2: 'dwa', 3: 'trzy' } + , no = t(o); + + a.not(no, o, "Return different object"); + a(stringify(no), stringify(o), "Match properties and values"); + + o = { foo: 'bar', raz: { dwa: 'dwa', + trzy: { cztery: 'pięć', 'sześć': 'siedem' }, osiem: {}, + 'dziewięć': function () { } }, 'dziesięć': 10 }; + o.raz.rec = o; + + no = t(o); + a.not(o.raz, no.raz, "Deep"); + a.not(o.raz.trzy, no.raz.trzy, "Deep #2"); + a(stringify(o.raz.trzy), stringify(no.raz.trzy), "Deep content"); + a(no.raz.rec, no, "Recursive"); + a.not(o.raz.osiem, no.raz.osiem, "Empty object"); + a(o.raz['dziewięć'], no.raz['dziewięć'], "Function"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/copy.js new file mode 100644 index 00000000..2f222ef8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/copy.js @@ -0,0 +1,19 @@ +'use strict'; + +var stringify = JSON.stringify; + +module.exports = function (t, a) { + var o = { 1: 'raz', 2: 'dwa', 3: 'trzy' } + , no = t(o); + + a.not(no, o, "Return different object"); + a(stringify(no), stringify(o), "Match properties and values"); + + o = { foo: 'bar', raz: { dwa: 'dwa', + trzy: { cztery: 'pięć', 'sześć': 'siedem' }, osiem: {}, + 'dziewięć': function () { } }, 'dziesięć': 10 }; + o.raz.rec = o; + + no = t(o); + a(o.raz, no.raz, "Shallow"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/count.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/count.js new file mode 100644 index 00000000..494f4f16 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/count.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), 0, "Empty"); + a(t({ raz: 1, dwa: null, trzy: undefined, cztery: 0 }), 4, + "Some properties"); + a(t(Object.defineProperties({}, { + raz: { value: 'raz' }, + dwa: { value: 'dwa', enumerable: true } + })), 1, "Some properties hidden"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/create.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/create.js new file mode 100644 index 00000000..8b7be214 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/create.js @@ -0,0 +1,22 @@ +'use strict'; + +var setPrototypeOf = require('../../object/set-prototype-of') + + , getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (t, a) { + var x = {}, obj; + + a(getPrototypeOf(t(x)), x, "Normal object"); + a(getPrototypeOf(t(null)), + (setPrototypeOf && setPrototypeOf.nullPolyfill) || null, "Null"); + + a.h1("Properties"); + a.h2("Normal object"); + a(getPrototypeOf(obj = t(x, { foo: { value: 'bar' } })), x, "Prototype"); + a(obj.foo, 'bar', "Property"); + a.h2("Null"); + a(getPrototypeOf(obj = t(null, { foo: { value: 'bar2' } })), + (setPrototypeOf && setPrototypeOf.nullPolyfill) || null, "Prototype"); + a(obj.foo, 'bar2', "Property"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/eq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/eq.js new file mode 100644 index 00000000..02b3f002 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/eq.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var o = {}; + a(t(o, {}), false, "Different objects"); + a(t(o, o), true, "Same objects"); + a(t('1', '1'), true, "Same primitive"); + a(t('1', 1), false, "Different primitive types"); + a(t(NaN, NaN), true, "NaN"); + a(t(0, 0), true, "0,0"); + a(t(0, -0), true, "0,-0"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/every.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/every.js new file mode 100644 index 00000000..07d5bbbd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/every.js @@ -0,0 +1,21 @@ +'use strict'; + +var o = { 1: 1, 2: 2, 3: 3 }; + +module.exports = function (t, a) { + var o2 = {}; + t(o, function (value, name) { + o2[name] = value; + return true; + }); + a(JSON.stringify(o2), JSON.stringify(o), "Iterates"); + + a(t(o, function () { + return true; + }), true, "Succeeds"); + + a(t(o, function () { + return false; + }), false, "Fails"); + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/filter.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/filter.js new file mode 100644 index 00000000..7307da86 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/filter.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t({ 1: 1, 2: 2, 3: 3, 4: 4 }, + function (value) { return Boolean(value % 2); }), { 1: 1, 3: 3 }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/first-key.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/first-key.js new file mode 100644 index 00000000..8169cd23 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/first-key.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}, y = Object.create(null); + a(t(x), null, "Normal: Empty"); + a(t(y), null, "Null extension: Empty"); + x.foo = 'raz'; + x.bar = 343; + a(['foo', 'bar'].indexOf(t(x)) !== -1, true, "Normal"); + y.elo = 'foo'; + y.mar = 'wew'; + a(['elo', 'mar'].indexOf(t(y)) !== -1, true, "Null extension"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/flatten.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/flatten.js new file mode 100644 index 00000000..ca342eab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/flatten.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t({ a: { aa: 1, ab: 2 }, b: { ba: 3, bb: 4 } }), + { aa: 1, ab: 2, ba: 3, bb: 4 }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/for-each.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/for-each.js new file mode 100644 index 00000000..8690d1e8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/for-each.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var o = { raz: 1, dwa: 2, trzy: 3 } + , o2 = {}; + a(t(o, function (value, name) { + o2[name] = value; + }), undefined, "Return"); + a.deep(o2, o); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/get-property-names.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/get-property-names.js new file mode 100644 index 00000000..b91c3dd5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/get-property-names.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function (t, a) { + var o = { first: 1, second: 4 }, r1, r2; + o = Object.create(o, { + third: { value: null } + }); + o.first = 2; + o = Object.create(o); + o.fourth = 3; + + r1 = t(o); + r1.sort(); + r2 = ['first', 'second', 'third', 'fourth'] + .concat(Object.getOwnPropertyNames(Object.prototype)); + r2.sort(); + a.deep(r1, r2); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-array-like.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-array-like.js new file mode 100644 index 00000000..6295973c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-array-like.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + a(t([]), true, "Array"); + a(t(""), true, "String"); + a(t((function () { return arguments; }())), true, "Arguments"); + a(t({ length: 0 }), true, "List object"); + a(t(function () {}), false, "Function"); + a(t({}), false, "Plain object"); + a(t(/raz/), false, "Regexp"); + a(t(), false, "No argument"); + a(t(null), false, "Null"); + a(t(undefined), false, "Undefined"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-callable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-callable.js new file mode 100644 index 00000000..625e221d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-callable.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(function () {}), true, "Function"); + a(t({}), false, "Object"); + a(t(), false, "Undefined"); + a(t(null), false, "Null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-copy-deep.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-copy-deep.js new file mode 100644 index 00000000..4f14cbbe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-copy-deep.js @@ -0,0 +1,46 @@ +'use strict'; + +module.exports = function (t, a) { + var x, y; + + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 3 }), true, "Same"); + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 4 }), false, + "Different property value"); + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2 }), false, + "Property only in source"); + a(t({ 1: 1, 2: 2 }, { 1: 1, 2: 2, 3: 4 }), false, + "Property only in target"); + + a(t("raz", "dwa"), false, "String: diff"); + a(t("raz", "raz"), true, "String: same"); + a(t("32", 32), false, "String & Number"); + + a(t([1, 'raz', true], [1, 'raz', true]), true, "Array: same"); + a(t([1, 'raz', undefined], [1, 'raz']), false, "Array: diff"); + a(t(['foo'], ['one']), false, "Array: One value comparision"); + + x = { foo: { bar: { mar: {} } } }; + y = { foo: { bar: { mar: {} } } }; + a(t(x, y), true, "Deep"); + + a(t({ foo: { bar: { mar: 'foo' } } }, { foo: { bar: { mar: {} } } }), + false, "Deep: false"); + + x = { foo: { bar: { mar: {} } } }; + x.rec = { foo: x }; + + y = { foo: { bar: { mar: {} } } }; + y.rec = { foo: x }; + + a(t(x, y), true, "Object: Infinite Recursion: Same #1"); + + x.rec.foo = y; + a(t(x, y), true, "Object: Infinite Recursion: Same #2"); + + x.rec.foo = x; + y.rec.foo = y; + a(t(x, y), true, "Object: Infinite Recursion: Same #3"); + + y.foo.bar.mar = 'raz'; + a(t(x, y), false, "Object: Infinite Recursion: Diff"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-copy.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-copy.js new file mode 100644 index 00000000..394e2ed9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-copy.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 3 }), true, "Same"); + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2, 3: 4 }), false, + "Different property value"); + a(t({ 1: 1, 2: 2, 3: 3 }, { 1: 1, 2: 2 }), false, + "Property only in source"); + a(t({ 1: 1, 2: 2 }, { 1: 1, 2: 2, 3: 4 }), false, + "Property only in target"); + + a(t("raz", "dwa"), false, "String: diff"); + a(t("raz", "raz"), true, "String: same"); + a(t("32", 32), false, "String & Number"); + + a(t([1, 'raz', true], [1, 'raz', true]), true, "Array: same"); + a(t([1, 'raz', undefined], [1, 'raz']), false, "Array: diff"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-empty.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-empty.js new file mode 100644 index 00000000..b560c2c3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-empty.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), true, "Empty"); + a(t({ 1: 1 }), false, "Not empty"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-object.js new file mode 100644 index 00000000..72c8aa6d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-object.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function (t, a) { + a(t('arar'), false, "String"); + a(t(12), false, "Number"); + a(t(true), false, "Boolean"); + a(t(null), false, "Null"); + a(t(new Date()), true, "Date"); + a(t(new String('raz')), true, "String object"); + a(t({}), true, "Plain object"); + a(t(/a/), true, "Regular expression"); + a(t(function () {}), true, "Function"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-plain-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-plain-object.js new file mode 100644 index 00000000..e988829d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is-plain-object.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function (t, a) { + a(t({}), true, "Empty {} is plain object"); + a(t({ a: true }), true, "{} with property is plain object"); + a(t({ prototype: 1, constructor: 2, __proto__: 3 }), true, + "{} with any property keys is plain object"); + a(t(null), false, "Null is not plain object"); + a(t('string'), false, "Primitive is not plain object"); + a(t(function () {}), false, "Function is not plain object"); + a(t(Object.create({})), false, + "Object whose prototype is not Object.prototype is not plain object"); + a(t(Object.create(Object.prototype)), true, + "Object whose prototype is Object.prototype is plain object"); + a(t(Object.create(null)), true, + "Object whose prototype is null is plain object"); + a(t(Object.prototype), false, "Object.prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is.js new file mode 100644 index 00000000..4f8948cb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/is.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var o = {}; + a(t(o, {}), false, "Different objects"); + a(t(o, o), true, "Same objects"); + a(t('1', '1'), true, "Same primitive"); + a(t('1', 1), false, "Different primitive types"); + a(t(NaN, NaN), true, "NaN"); + a(t(0, 0), true, "0,0"); + a(t(0, -0), false, "0,-0"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/key-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/key-of.js new file mode 100644 index 00000000..a9225a04 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/key-of.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + var x = {}, y = {} + , o = { foo: 'bar', raz: x, trzy: 'cztery', five: '6' }; + + a(t(o, 'bar'), 'foo', "First property"); + a(t(o, 6), null, "Primitive that's not there"); + a(t(o, x), 'raz', "Object"); + a(t(o, y), null, "Object that's not there"); + a(t(o, '6'), 'five', "Last property"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/implement.js new file mode 100644 index 00000000..179e1e56 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../object/keys/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/shim.js new file mode 100644 index 00000000..ed29eebc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/keys/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t({ foo: 'bar' }), ['foo'], "Object"); + a.deep(t('raz'), ['0', '1', '2'], "Primitive"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Undefined"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/map-keys.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/map-keys.js new file mode 100644 index 00000000..be84825b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/map-keys.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t({ 1: 1, 2: 2, 3: 3 }, function (key, value) { + return 'x' + (key + value); + }), { x11: 1, x22: 2, x33: 3 }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/map.js new file mode 100644 index 00000000..f9cc09c0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/map.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + var obj = { 1: 1, 2: 2, 3: 3 }; + a.deep(t(obj, function (value, key, context) { + a(context, obj, "Context argument"); + return (value + 1) + key; + }), { 1: '21', 2: '32', 3: '43' }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/mixin-prototypes.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/mixin-prototypes.js new file mode 100644 index 00000000..d1c727a9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/mixin-prototypes.js @@ -0,0 +1,67 @@ +'use strict'; + +module.exports = function (t, a) { + var o, o1, o2, x, y = {}, z = {}; + o = { inherited: true, visible: 23 }; + o1 = Object.create(o); + o1.visible = z; + o1.nonremovable = 'raz'; + Object.defineProperty(o1, 'hidden', { value: 'hidden' }); + + o2 = Object.defineProperties({}, { nonremovable: { value: y } }); + o2.other = 'other'; + + try { t(o2, o1); } catch (ignore) {} + + a(o2.visible, z, "Enumerable"); + a(o1.hidden, 'hidden', "Not Enumerable"); + a(o2.propertyIsEnumerable('visible'), true, "Enumerable is enumerable"); + a(o2.propertyIsEnumerable('hidden'), false, + "Not enumerable is not enumerable"); + + a(o2.inherited, true, "Extend deep"); + + a(o2.nonremovable, y, "Do not overwrite non configurable"); + a(o2.other, 'other', "Own kept"); + + x = {}; + t(x, o2); + try { t(x, o1); } catch (ignore) {} + + a(x.visible, z, "Enumerable"); + a(x.hidden, 'hidden', "Not Enumerable"); + a(x.propertyIsEnumerable('visible'), true, "Enumerable is enumerable"); + a(x.propertyIsEnumerable('hidden'), false, + "Not enumerable is not enumerable"); + + a(x.inherited, true, "Extend deep"); + + a(x.nonremovable, y, "Ignored non configurable"); + a(x.other, 'other', "Other"); + + x.visible = 3; + a(x.visible, 3, "Writable is writable"); + + x = {}; + t(x, o1); + a.throws(function () { + x.hidden = 3; + }, "Not writable is not writable"); + + x = {}; + t(x, o1); + delete x.visible; + a.ok(!x.hasOwnProperty('visible'), "Configurable is configurable"); + + x = {}; + t(x, o1); + a.throws(function () { + delete x.hidden; + }, "Not configurable is not configurable"); + + x = Object.defineProperty({}, 'foo', + { configurable: false, writable: true, enumerable: false, value: 'bar' }); + + try { t(x, { foo: 'lorem' }); } catch (ignore) {} + a(x.foo, 'bar', "Writable, not enumerable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/mixin.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/mixin.js new file mode 100644 index 00000000..866005b0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/mixin.js @@ -0,0 +1,69 @@ +'use strict'; + +module.exports = function (t, a) { + var o, o1, o2, x, y = {}, z = {}; + o = { inherited: true }; + o1 = Object.create(o); + o1.visible = z; + o1.nonremovable = 'raz'; + Object.defineProperty(o1, 'hidden', { value: 'hidden' }); + + o2 = Object.defineProperties({}, { nonremovable: { value: y } }); + o2.other = 'other'; + + try { t(o2, o1); } catch (ignore) {} + + a(o2.visible, z, "Enumerable"); + a(o1.hidden, 'hidden', "Not Enumerable"); + a(o2.propertyIsEnumerable('visible'), true, "Enumerable is enumerable"); + a(o2.propertyIsEnumerable('hidden'), false, + "Not enumerable is not enumerable"); + + a(o2.hasOwnProperty('inherited'), false, "Extend only own"); + a(o2.inherited, undefined, "Extend ony own: value"); + + a(o2.nonremovable, y, "Do not overwrite non configurable"); + a(o2.other, 'other', "Own kept"); + + x = {}; + t(x, o2); + try { t(x, o1); } catch (ignore) {} + + a(x.visible, z, "Enumerable"); + a(x.hidden, 'hidden', "Not Enumerable"); + a(x.propertyIsEnumerable('visible'), true, "Enumerable is enumerable"); + a(x.propertyIsEnumerable('hidden'), false, + "Not enumerable is not enumerable"); + + a(x.hasOwnProperty('inherited'), false, "Extend only own"); + a(x.inherited, undefined, "Extend ony own: value"); + + a(x.nonremovable, y, "Ignored non configurable"); + a(x.other, 'other', "Other"); + + x.visible = 3; + a(x.visible, 3, "Writable is writable"); + + x = {}; + t(x, o1); + a.throws(function () { + x.hidden = 3; + }, "Not writable is not writable"); + + x = {}; + t(x, o1); + delete x.visible; + a.ok(!x.hasOwnProperty('visible'), "Configurable is configurable"); + + x = {}; + t(x, o1); + a.throws(function () { + delete x.hidden; + }, "Not configurable is not configurable"); + + x = Object.defineProperty({}, 'foo', + { configurable: false, writable: true, enumerable: false, value: 'bar' }); + + try { t(x, { foo: 'lorem' }); } catch (ignore) {} + a(x.foo, 'bar', "Writable, not enumerable"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/normalize-options.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/normalize-options.js new file mode 100644 index 00000000..0d2d4da0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/normalize-options.js @@ -0,0 +1,32 @@ +'use strict'; + +var create = Object.create, defineProperty = Object.defineProperty; + +module.exports = function (t, a) { + var x = { foo: 'raz', bar: 'dwa' }, y; + y = t(x); + a.not(y, x, "Returns copy"); + a.deep(y, x, "Plain"); + + x = { raz: 'one', dwa: 'two' }; + defineProperty(x, 'get', { + configurable: true, + enumerable: true, + get: function () { return this.dwa; } + }); + x = create(x); + x.trzy = 'three'; + x.cztery = 'four'; + x = create(x); + x.dwa = 'two!'; + x.trzy = 'three!'; + x.piec = 'five'; + x.szesc = 'six'; + + a.deep(t(x), { raz: 'one', dwa: 'two!', trzy: 'three!', cztery: 'four', + piec: 'five', szesc: 'six', get: 'two!' }, "Deep object"); + + a.deep(t({ marko: 'raz', raz: 'foo' }, x, { szesc: 'elo', siedem: 'bibg' }), + { marko: 'raz', raz: 'one', dwa: 'two!', trzy: 'three!', cztery: 'four', + piec: 'five', szesc: 'elo', siedem: 'bibg', get: 'two!' }, "Multiple options"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/primitive-set.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/primitive-set.js new file mode 100644 index 00000000..839857ea --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/primitive-set.js @@ -0,0 +1,15 @@ +'use strict'; + +var getPropertyNames = require('../../object/get-property-names') + , isPlainObject = require('../../object/is-plain-object'); + +module.exports = function (t, a) { + var x = t(); + a(isPlainObject(x), true, "Plain object"); + a.deep(getPropertyNames(x), [], "No properties"); + x.foo = 'bar'; + a.deep(getPropertyNames(x), ['foo'], "Extensible"); + + a.deep(t('raz', 'dwa', 3), { raz: true, dwa: true, 3: true }, + "Arguments handling"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/safe-traverse.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/safe-traverse.js new file mode 100644 index 00000000..d30cdefe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/safe-traverse.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var obj = { foo: { bar: { lorem: 12 } } }; + a(t(obj), obj, "No props"); + a(t(obj, 'foo'), obj.foo, "One"); + a(t(obj, 'raz'), undefined, "One: Fail"); + a(t(obj, 'foo', 'bar'), obj.foo.bar, "Two"); + a(t(obj, 'dsd', 'raz'), undefined, "Two: Fail #1"); + a(t(obj, 'foo', 'raz'), undefined, "Two: Fail #2"); + a(t(obj, 'foo', 'bar', 'lorem'), obj.foo.bar.lorem, "Three"); + a(t(obj, 'dsd', 'raz', 'fef'), undefined, "Three: Fail #1"); + a(t(obj, 'foo', 'raz', 'asdf'), undefined, "Three: Fail #2"); + a(t(obj, 'foo', 'bar', 'asd'), undefined, "Three: Fail #3"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/serialize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/serialize.js new file mode 100644 index 00000000..43eed6a8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/serialize.js @@ -0,0 +1,25 @@ +'use strict'; + +module.exports = function (t, a) { + var fn = function (raz, dwa) { return raz + dwa; }; + a(t(), 'undefined', "Undefined"); + a(t(null), 'null', "Null"); + a(t(null), 'null', "Null"); + a(t('raz'), '"raz"', "String"); + a(t('raz"ddwa\ntrzy'), '"raz\\"ddwa\\ntrzy"', "String with escape"); + a(t(false), 'false', "Booelean"); + a(t(fn), String(fn), "Function"); + + a(t(/raz-dwa/g), '/raz-dwa/g', "RegExp"); + a(t(new Date(1234567)), 'new Date(1234567)', "Date"); + a(t([]), '[]', "Empty array"); + a(t([undefined, false, null, 'raz"ddwa\ntrzy', fn, /raz/g, new Date(1234567), ['foo']]), + '[undefined,false,null,"raz\\"ddwa\\ntrzy",' + String(fn) + + ',/raz/g,new Date(1234567),["foo"]]', "Rich Array"); + a(t({}), '{}', "Empty object"); + a(t({ raz: undefined, dwa: false, trzy: null, cztery: 'raz"ddwa\ntrzy', piec: fn, szesc: /raz/g, + siedem: new Date(1234567), osiem: ['foo', 32], dziewiec: { foo: 'bar', dwa: 343 } }), + '{"raz":undefined,"dwa":false,"trzy":null,"cztery":"raz\\"ddwa\\ntrzy","piec":' + String(fn) + + ',"szesc":/raz/g,"siedem":new Date(1234567),"osiem":["foo",32],' + + '"dziewiec":{"foo":"bar","dwa":343}}', "Rich object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/implement.js new file mode 100644 index 00000000..30b2ac4b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +var create = require('../../../object/create') + , isImplemented = require('../../../object/set-prototype-of/is-implemented'); + +module.exports = function (a) { a(isImplemented(create), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/index.js new file mode 100644 index 00000000..aec2605c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var create = require('../../../object/create') + + , getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (t, a) { + var x = {}, y = {}; + + if (t === null) return; + a(t(x, y), x, "Return self object"); + a(getPrototypeOf(x), y, "Object"); + a.throws(function () { t(x); }, TypeError, "Undefined"); + a.throws(function () { t('foo'); }, TypeError, "Primitive"); + a(getPrototypeOf(t(x, null)), t.nullPolyfill || null, "Null"); + x = create(null); + a.h1("Change null prototype"); + a(t(x, y), x, "Result"); + a(getPrototypeOf(x), y, "Prototype"); + a.h1("Set null prototype"); + a(t(y, null), y, "Result"); + a(getPrototypeOf(y), t.nullPolyfill || null, "Prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js new file mode 100644 index 00000000..aec2605c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js @@ -0,0 +1,23 @@ +'use strict'; + +var create = require('../../../object/create') + + , getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (t, a) { + var x = {}, y = {}; + + if (t === null) return; + a(t(x, y), x, "Return self object"); + a(getPrototypeOf(x), y, "Object"); + a.throws(function () { t(x); }, TypeError, "Undefined"); + a.throws(function () { t('foo'); }, TypeError, "Primitive"); + a(getPrototypeOf(t(x, null)), t.nullPolyfill || null, "Null"); + x = create(null); + a.h1("Change null prototype"); + a(t(x, y), x, "Result"); + a(getPrototypeOf(x), y, "Prototype"); + a.h1("Set null prototype"); + a(t(y, null), y, "Result"); + a(getPrototypeOf(y), t.nullPolyfill || null, "Prototype"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/some.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/some.js new file mode 100644 index 00000000..490431e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/some.js @@ -0,0 +1,23 @@ +'use strict'; + +var o = { 1: 1, 2: 2, 3: 3 }; + +module.exports = function (t, a) { + var o2 = {}, i = 0; + t(o, function (value, name) { + o2[name] = value; + return false; + }); + a(JSON.stringify(o2), JSON.stringify(o), "Iterates"); + + a(t(o, function () { + ++i; + return true; + }), true, "Succeeds"); + a(i, 1, "Stops iteration after condition is met"); + + a(t(o, function () { + return false; + }), false, "Fails"); + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/to-array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/to-array.js new file mode 100644 index 00000000..1f4beef7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/to-array.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var o = { 1: 1, 2: 2, 3: 3 }, o1 = {} + , o2 = t(o, function (value, name, self) { + a(self, o, "Self"); + a(this, o1, "Scope"); + return value + Number(name); + }, o1); + a.deep(o2, [2, 4, 6]); + + t(o).sort().forEach(function (item) { + a.deep(item, [item[0], o[item[0]]], "Default"); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/unserialize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/unserialize.js new file mode 100644 index 00000000..405eef11 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/unserialize.js @@ -0,0 +1,24 @@ +'use strict'; + +module.exports = function (t, a) { + var fn = function (raz, dwa) { return raz + dwa; }; + a(t('undefined'), undefined, "Undefined"); + a(t('null'), null, "Null"); + a(t('"raz"'), 'raz', "String"); + a(t('"raz\\"ddwa\\ntrzy"'), 'raz"ddwa\ntrzy', "String with escape"); + a(t('false'), false, "Booelean"); + a(String(t(String(fn))), String(fn), "Function"); + + a.deep(t('/raz-dwa/g'), /raz-dwa/g, "RegExp"); + a.deep(t('new Date(1234567)'), new Date(1234567), "Date"); + a.deep(t('[]'), [], "Empty array"); + a.deep(t('[undefined,false,null,"raz\\"ddwa\\ntrzy",/raz/g,new Date(1234567),["foo"]]'), + [undefined, false, null, 'raz"ddwa\ntrzy', /raz/g, new Date(1234567), ['foo']], "Rich Array"); + a.deep(t('{}'), {}, "Empty object"); + a.deep(t('{"raz":undefined,"dwa":false,"trzy":null,"cztery":"raz\\"ddwa\\ntrzy",' + + '"szesc":/raz/g,"siedem":new Date(1234567),"osiem":["foo",32],' + + '"dziewiec":{"foo":"bar","dwa":343}}'), + { raz: undefined, dwa: false, trzy: null, cztery: 'raz"ddwa\ntrzy', szesc: /raz/g, + siedem: new Date(1234567), osiem: ['foo', 32], dziewiec: { foo: 'bar', dwa: 343 } }, + "Rich object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/valid-callable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/valid-callable.js new file mode 100644 index 00000000..b40540b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/valid-callable.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + var f = function () {}; + a(t(f), f, "Function"); + a.throws(function () { + t({}); + }, "Not Function"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/valid-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/valid-object.js new file mode 100644 index 00000000..eaa8e7bc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/valid-object.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a.throws(function () { t(''); }, TypeError, "''"); + a(t(x = {}), x, "Object"); + a(t(x = function () {}), x, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + a(t(x = new Date()), x, "Date"); + + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/valid-value.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/valid-value.js new file mode 100644 index 00000000..f1eeafa9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/valid-value.js @@ -0,0 +1,19 @@ +'use strict'; + +var numIsNaN = require('../../number/is-nan'); + +module.exports = function (t, a) { + var x; + a(t(0), 0, "0"); + a(t(false), false, "false"); + a(t(''), '', "''"); + a(numIsNaN(t(NaN)), true, "NaN"); + a(t(x = {}), x, "{}"); + + a.throws(function () { + t(); + }, "Undefined"); + a.throws(function () { + t(null); + }, "null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-array-like-object.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-array-like-object.js new file mode 100644 index 00000000..2f3e31b4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-array-like-object.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a.throws(function () { t(''); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Plain Object"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + + a(t(x = { length: 1 }), x, "Array like"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-array-like.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-array-like.js new file mode 100644 index 00000000..53bd1124 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-array-like.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(0); }, TypeError, "0"); + a.throws(function () { t(false); }, TypeError, "false"); + a(t(''), '', "''"); + a.throws(function () { t({}); }, TypeError, "Plain Object"); + a.throws(function () { t(function () {}); }, TypeError, "Function"); + a(t(x = new String('raz')), x, "String object"); //jslint: ignore + + a(t(x = { length: 1 }), x, "Array like"); + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "null"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-stringifiable-value.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-stringifiable-value.js new file mode 100644 index 00000000..ae9bd17a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-stringifiable-value.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a(t(0), "0"); + a(t(false), "false"); + a(t(''), ""); + a(t({}), String({}), "Object"); + a(t(x = function () {}), String(x), "Function"); + a(t(x = new String('raz')), String(x), "String object"); //jslint: ignore + a(t(x = new Date()), String(x), "Date"); + + a.throws(function () { t(Object.create(null)); }, TypeError, "Null prototype object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-stringifiable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-stringifiable.js new file mode 100644 index 00000000..4a46bb52 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/validate-stringifiable.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = function (t, a) { + var x; + a(t(), 'undefined', "Undefined"); + a(t(null), 'null', "Null"); + a(t(0), "0"); + a(t(false), "false"); + a(t(''), ""); + a(t({}), String({}), "Object"); + a(t(x = function () {}), String(x), "Function"); + a(t(x = new String('raz')), String(x), "String object"); //jslint: ignore + a(t(x = new Date()), String(x), "Date"); + + a.throws(function () { t(Object.create(null)); }, TypeError, "Null prototype object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/index.js new file mode 100644 index 00000000..ca2bd650 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var indexTest = require('tad/lib/utils/index-test') + + , path = require('path').resolve(__dirname, '../../../reg-exp/#'); + +module.exports = function (t, a, d) { + indexTest(indexTest.readDir(path).aside(function (data) { + delete data.sticky; + delete data.unicode; + }))(t, a, d); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/is-sticky.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/is-sticky.js new file mode 100644 index 00000000..e154ac29 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/is-sticky.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var re; + a(t.call(/raz/), false, "Normal"); + a(t.call(/raz/g), false, "Global"); + try { re = new RegExp('raz', 'y'); } catch (ignore) {} + if (!re) return; + a(t.call(re), true, "Sticky"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/is-unicode.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/is-unicode.js new file mode 100644 index 00000000..2ffb9e86 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/is-unicode.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = function (t, a) { + var re; + a(t.call(/raz/), false, "Normal"); + a(t.call(/raz/g), false, "Global"); + try { re = new RegExp('raz', 'u'); } catch (ignore) {} + if (!re) return; + a(t.call(re), true, "Unicode"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/implement.js new file mode 100644 index 00000000..89825a45 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/match/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/shim.js new file mode 100644 index 00000000..5249139f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/match/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + var result = ['foo']; + result.index = 0; + result.input = 'foobar'; + a.deep(t.call(/foo/, 'foobar'), result); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/implement.js new file mode 100644 index 00000000..c32b23a6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/replace/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/shim.js new file mode 100644 index 00000000..2b378fd5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/replace/shim.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(/foo/, 'foobar', 'mar'), 'marbar'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/implement.js new file mode 100644 index 00000000..ff1b8087 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/search/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/shim.js new file mode 100644 index 00000000..596bcdb9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/search/shim.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(/foo/, 'barfoo'), 3); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/implement.js new file mode 100644 index 00000000..1cee4418 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/split/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/shim.js new file mode 100644 index 00000000..6a95cd03 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/split/shim.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a.deep(t.call(/\|/, 'bar|foo'), ['bar', 'foo']); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/sticky/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/sticky/implement.js new file mode 100644 index 00000000..d94e7b98 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/sticky/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/sticky/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/sticky/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/sticky/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/sticky/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/unicode/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/unicode/implement.js new file mode 100644 index 00000000..9b1aa0f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/unicode/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../reg-exp/#/unicode/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/unicode/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/unicode/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/#/unicode/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/escape.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/escape.js new file mode 100644 index 00000000..5b00f67f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/escape.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + var str = "(?:^te|er)s{2}t\\[raz]+$"; + a(RegExp('^' + t(str) + '$').test(str), true); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/is-reg-exp.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/is-reg-exp.js new file mode 100644 index 00000000..785ca28c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/is-reg-exp.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = function (t, a) { + a(t('arar'), false, "String"); + a(t(12), false, "Number"); + a(t(true), false, "Boolean"); + a(t(new Date()), false, "Date"); + a(t(new String('raz')), false, "String object"); + a(t({}), false, "Plain object"); + a(t(/a/), true, "Regular expression"); + a(t(new RegExp('a')), true, "Regular expression via constructor"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/valid-reg-exp.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/valid-reg-exp.js new file mode 100644 index 00000000..cd12cf12 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/reg-exp/valid-reg-exp.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function (t, a) { + var r = /raz/; + a(t(r), r, "Direct"); + r = new RegExp('foo'); + a(t(r), r, "Constructor"); + a.throws(function () { + t({}); + }, "Object"); + a.throws(function () { + t(function () {}); + }, "Function"); + a.throws(function () { + t({ exec: function () { return 20; } }); + }, "Plain object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/implement.js new file mode 100644 index 00000000..09bf3361 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/@@iterator/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/shim.js new file mode 100644 index 00000000..3b0e0b75 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/@@iterator/shim.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + var it = t.call('r💩z'); + a.deep(it.next(), { done: false, value: 'r' }, "#1"); + a.deep(it.next(), { done: false, value: '💩' }, "#2"); + a.deep(it.next(), { done: false, value: 'z' }, "#3"); + a.deep(it.next(), { done: true, value: undefined }, "End"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/at.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/at.js new file mode 100644 index 00000000..2447a9f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/at.js @@ -0,0 +1,97 @@ +// See tests at https://github.com/mathiasbynens/String.prototype.at + +'use strict'; + +module.exports = function (t, a) { + a(t.length, 1, "Length"); + + a.h1("BMP"); + a(t.call('abc\uD834\uDF06def', -Infinity), '', "-Infinity"); + a(t.call('abc\uD834\uDF06def', -1), '', "-1"); + a(t.call('abc\uD834\uDF06def', -0), 'a', "-0"); + a(t.call('abc\uD834\uDF06def', +0), 'a', "+0"); + a(t.call('abc\uD834\uDF06def', 1), 'b', "1"); + a(t.call('abc\uD834\uDF06def', 3), '\uD834\uDF06', "3"); + a(t.call('abc\uD834\uDF06def', 4), '\uDF06', "4"); + a(t.call('abc\uD834\uDF06def', 5), 'd', "5"); + a(t.call('abc\uD834\uDF06def', 42), '', "42"); + a(t.call('abc\uD834\uDF06def', +Infinity), '', "+Infinity"); + a(t.call('abc\uD834\uDF06def', null), 'a', "null"); + a(t.call('abc\uD834\uDF06def', undefined), 'a', "undefined"); + a(t.call('abc\uD834\uDF06def'), 'a', "No argument"); + a(t.call('abc\uD834\uDF06def', false), 'a', "false"); + a(t.call('abc\uD834\uDF06def', NaN), 'a', "NaN"); + a(t.call('abc\uD834\uDF06def', ''), 'a', "Empty string"); + a(t.call('abc\uD834\uDF06def', '_'), 'a', "_"); + a(t.call('abc\uD834\uDF06def', '1'), 'b', "'1'"); + a(t.call('abc\uD834\uDF06def', []), 'a', "[]"); + a(t.call('abc\uD834\uDF06def', {}), 'a', "{}"); + a(t.call('abc\uD834\uDF06def', -0.9), 'a', "-0.9"); + a(t.call('abc\uD834\uDF06def', 1.9), 'b', "1.9"); + a(t.call('abc\uD834\uDF06def', 7.9), 'f', "7.9"); + a(t.call('abc\uD834\uDF06def', Math.pow(2, 32)), '', "Big number"); + + a.h1("Astral symbol"); + a(t.call('\uD834\uDF06def', -Infinity), '', "-Infinity"); + a(t.call('\uD834\uDF06def', -1), '', "-1"); + a(t.call('\uD834\uDF06def', -0), '\uD834\uDF06', "-0"); + a(t.call('\uD834\uDF06def', +0), '\uD834\uDF06', "+0"); + a(t.call('\uD834\uDF06def', 1), '\uDF06', "1"); + a(t.call('\uD834\uDF06def', 2), 'd', "2"); + a(t.call('\uD834\uDF06def', 3), 'e', "3"); + a(t.call('\uD834\uDF06def', 4), 'f', "4"); + a(t.call('\uD834\uDF06def', 42), '', "42"); + a(t.call('\uD834\uDF06def', +Infinity), '', "+Infinity"); + a(t.call('\uD834\uDF06def', null), '\uD834\uDF06', "null"); + a(t.call('\uD834\uDF06def', undefined), '\uD834\uDF06', "undefined"); + a(t.call('\uD834\uDF06def'), '\uD834\uDF06', "No arguments"); + a(t.call('\uD834\uDF06def', false), '\uD834\uDF06', "false"); + a(t.call('\uD834\uDF06def', NaN), '\uD834\uDF06', "NaN"); + a(t.call('\uD834\uDF06def', ''), '\uD834\uDF06', "Empty string"); + a(t.call('\uD834\uDF06def', '_'), '\uD834\uDF06', "_"); + a(t.call('\uD834\uDF06def', '1'), '\uDF06', "'1'"); + + a.h1("Lone high surrogates"); + a(t.call('\uD834abc', -Infinity), '', "-Infinity"); + a(t.call('\uD834abc', -1), '', "-1"); + a(t.call('\uD834abc', -0), '\uD834', "-0"); + a(t.call('\uD834abc', +0), '\uD834', "+0"); + a(t.call('\uD834abc', 1), 'a', "1"); + a(t.call('\uD834abc', 42), '', "42"); + a(t.call('\uD834abc', +Infinity), '', "Infinity"); + a(t.call('\uD834abc', null), '\uD834', "null"); + a(t.call('\uD834abc', undefined), '\uD834', "undefined"); + a(t.call('\uD834abc'), '\uD834', "No arguments"); + a(t.call('\uD834abc', false), '\uD834', "false"); + a(t.call('\uD834abc', NaN), '\uD834', "NaN"); + a(t.call('\uD834abc', ''), '\uD834', "Empty string"); + a(t.call('\uD834abc', '_'), '\uD834', "_"); + a(t.call('\uD834abc', '1'), 'a', "'a'"); + + a.h1("Lone low surrogates"); + a(t.call('\uDF06abc', -Infinity), '', "-Infinity"); + a(t.call('\uDF06abc', -1), '', "-1"); + a(t.call('\uDF06abc', -0), '\uDF06', "-0"); + a(t.call('\uDF06abc', +0), '\uDF06', "+0"); + a(t.call('\uDF06abc', 1), 'a', "1"); + a(t.call('\uDF06abc', 42), '', "42"); + a(t.call('\uDF06abc', +Infinity), '', "+Infinity"); + a(t.call('\uDF06abc', null), '\uDF06', "null"); + a(t.call('\uDF06abc', undefined), '\uDF06', "undefined"); + a(t.call('\uDF06abc'), '\uDF06', "No arguments"); + a(t.call('\uDF06abc', false), '\uDF06', "false"); + a(t.call('\uDF06abc', NaN), '\uDF06', "NaN"); + a(t.call('\uDF06abc', ''), '\uDF06', "Empty string"); + a(t.call('\uDF06abc', '_'), '\uDF06', "_"); + a(t.call('\uDF06abc', '1'), 'a', "'1'"); + + a.h1("Context"); + a.throws(function () { t.call(undefined); }, TypeError, "Undefined"); + a.throws(function () { t.call(undefined, 4); }, TypeError, + "Undefined + argument"); + a.throws(function () { t.call(null); }, TypeError, "Null"); + a.throws(function () { t.call(null, 4); }, TypeError, "Null + argument"); + a(t.call(42, 0), '4', "Number #1"); + a(t.call(42, 1), '2', "Number #2"); + a(t.call({ toString: function () { return 'abc'; } }, 2), 'c', "Object"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/camel-to-hyphen.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/camel-to-hyphen.js new file mode 100644 index 00000000..8b47a815 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/camel-to-hyphen.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('razDwaTRzy4yFoo45My'), 'raz-dwa-t-rzy4y-foo45-my'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/capitalize.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/capitalize.js new file mode 100644 index 00000000..fa11ff8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/capitalize.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('raz'), 'Raz', "Word"); + a(t.call('BLA'), 'BLA', "Uppercase"); + a(t.call(''), '', "Empty"); + a(t.call('a'), 'A', "One letter"); + a(t.call('this is a test'), 'This is a test', "Sentence"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/case-insensitive-compare.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/case-insensitive-compare.js new file mode 100644 index 00000000..01a90c39 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/case-insensitive-compare.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call("AA", "aa"), 0, "Same"); + a.ok(t.call("Amber", "zebra") < 0, "Less"); + a.ok(t.call("Zebra", "amber") > 0, "Greater"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/implement.js new file mode 100644 index 00000000..5e33cd71 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/implement.js @@ -0,0 +1,6 @@ +'use strict'; + +var isImplemented = + require('../../../../string/#/code-point-at/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/shim.js new file mode 100644 index 00000000..0df4751c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/code-point-at/shim.js @@ -0,0 +1,81 @@ +// Taken from: https://github.com/mathiasbynens/String.prototype.codePointAt +// /blob/master/tests/tests.js + +'use strict'; + +module.exports = function (t, a) { + a(t.length, 1, "Length"); + + // String that starts with a BMP symbol + a(t.call('abc\uD834\uDF06def', ''), 0x61); + a(t.call('abc\uD834\uDF06def', '_'), 0x61); + a(t.call('abc\uD834\uDF06def'), 0x61); + a(t.call('abc\uD834\uDF06def', -Infinity), undefined); + a(t.call('abc\uD834\uDF06def', -1), undefined); + a(t.call('abc\uD834\uDF06def', -0), 0x61); + a(t.call('abc\uD834\uDF06def', 0), 0x61); + a(t.call('abc\uD834\uDF06def', 3), 0x1D306); + a(t.call('abc\uD834\uDF06def', 4), 0xDF06); + a(t.call('abc\uD834\uDF06def', 5), 0x64); + a(t.call('abc\uD834\uDF06def', 42), undefined); + a(t.call('abc\uD834\uDF06def', Infinity), undefined); + a(t.call('abc\uD834\uDF06def', Infinity), undefined); + a(t.call('abc\uD834\uDF06def', NaN), 0x61); + a(t.call('abc\uD834\uDF06def', false), 0x61); + a(t.call('abc\uD834\uDF06def', null), 0x61); + a(t.call('abc\uD834\uDF06def', undefined), 0x61); + + // String that starts with an astral symbol + a(t.call('\uD834\uDF06def', ''), 0x1D306); + a(t.call('\uD834\uDF06def', '1'), 0xDF06); + a(t.call('\uD834\uDF06def', '_'), 0x1D306); + a(t.call('\uD834\uDF06def'), 0x1D306); + a(t.call('\uD834\uDF06def', -1), undefined); + a(t.call('\uD834\uDF06def', -0), 0x1D306); + a(t.call('\uD834\uDF06def', 0), 0x1D306); + a(t.call('\uD834\uDF06def', 1), 0xDF06); + a(t.call('\uD834\uDF06def', 42), undefined); + a(t.call('\uD834\uDF06def', false), 0x1D306); + a(t.call('\uD834\uDF06def', null), 0x1D306); + a(t.call('\uD834\uDF06def', undefined), 0x1D306); + + // Lone high surrogates + a(t.call('\uD834abc', ''), 0xD834); + a(t.call('\uD834abc', '_'), 0xD834); + a(t.call('\uD834abc'), 0xD834); + a(t.call('\uD834abc', -1), undefined); + a(t.call('\uD834abc', -0), 0xD834); + a(t.call('\uD834abc', 0), 0xD834); + a(t.call('\uD834abc', false), 0xD834); + a(t.call('\uD834abc', NaN), 0xD834); + a(t.call('\uD834abc', null), 0xD834); + a(t.call('\uD834abc', undefined), 0xD834); + + // Lone low surrogates + a(t.call('\uDF06abc', ''), 0xDF06); + a(t.call('\uDF06abc', '_'), 0xDF06); + a(t.call('\uDF06abc'), 0xDF06); + a(t.call('\uDF06abc', -1), undefined); + a(t.call('\uDF06abc', -0), 0xDF06); + a(t.call('\uDF06abc', 0), 0xDF06); + a(t.call('\uDF06abc', false), 0xDF06); + a(t.call('\uDF06abc', NaN), 0xDF06); + a(t.call('\uDF06abc', null), 0xDF06); + a(t.call('\uDF06abc', undefined), 0xDF06); + + a.throws(function () { t.call(undefined); }, TypeError); + a.throws(function () { t.call(undefined, 4); }, TypeError); + a.throws(function () { t.call(null); }, TypeError); + a.throws(function () { t.call(null, 4); }, TypeError); + a(t.call(42, 0), 0x34); + a(t.call(42, 1), 0x32); + a(t.call({ toString: function () { return 'abc'; } }, 2), 0x63); + + a.throws(function () { t.apply(undefined); }, TypeError); + a.throws(function () { t.apply(undefined, [4]); }, TypeError); + a.throws(function () { t.apply(null); }, TypeError); + a.throws(function () { t.apply(null, [4]); }, TypeError); + a(t.apply(42, [0]), 0x34); + a(t.apply(42, [1]), 0x32); + a(t.apply({ toString: function () { return 'abc'; } }, [2]), 0x63); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/implement.js new file mode 100644 index 00000000..220f50d4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/contains/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/shim.js new file mode 100644 index 00000000..a0ea4db2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/contains/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('raz', ''), true, "Empty"); + a(t.call('', ''), true, "Both Empty"); + a(t.call('raz', 'raz'), true, "Same"); + a(t.call('razdwa', 'raz'), true, "Starts with"); + a(t.call('razdwa', 'dwa'), true, "Ends with"); + a(t.call('razdwa', 'zdw'), true, "In middle"); + a(t.call('', 'raz'), false, "Something in empty"); + a(t.call('az', 'raz'), false, "Longer"); + a(t.call('azasdfasdf', 'azff'), false, "Not found"); + a(t.call('razdwa', 'raz', 1), false, "Position"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/implement.js new file mode 100644 index 00000000..93bd2ddc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/ends-with/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/shim.js new file mode 100644 index 00000000..e4b93c40 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/ends-with/shim.js @@ -0,0 +1,16 @@ +// In some parts copied from: +// http://closure-library.googlecode.com/svn/trunk/closure/goog/ +// string/string_test.html + +'use strict'; + +module.exports = function (t, a) { + a(t.call('abc', ''), true, "Empty needle"); + a(t.call('abcd', 'cd'), true, "Ends with needle"); + a(t.call('abcd', 'abcd'), true, "Needle equals haystack"); + a(t.call('abcd', 'ab'), false, "Doesn't end with needle"); + a(t.call('abc', 'defg'), false, "Length trick"); + a(t.call('razdwa', 'zd', 3), false, "Position: false"); + a(t.call('razdwa', 'zd', 4), true, "Position: true"); + a(t.call('razdwa', 'zd', 5), false, "Position: false #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/hyphen-to-camel.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/hyphen-to-camel.js new file mode 100644 index 00000000..bd7ded4b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/hyphen-to-camel.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('raz-dwa-t-rzy-4y-rtr4-tiu-45-pa'), 'razDwaTRzy4yRtr4Tiu45Pa'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/indent.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/indent.js new file mode 100644 index 00000000..eb92b36f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/indent.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('ra\nzz', ''), 'ra\nzz', "Empty"); + a(t.call('ra\nzz', '\t', 3), '\t\t\tra\n\t\t\tzz', "String repeat"); + a(t.call('ra\nzz\nsss\nfff\n', '\t'), '\tra\n\tzz\n\tsss\n\tfff\n', + "Multi-line"); + a(t.call('ra\n\nzz\n', '\t'), '\tra\n\n\tzz\n', "Don't touch empty lines"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/last.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/last.js new file mode 100644 index 00000000..ad36a213 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/last.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call(''), null, "Null"); + a(t.call('abcdef'), 'f', "String"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/_data.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/_data.js new file mode 100644 index 00000000..c741addb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/_data.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t[0], 'object'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/implement.js new file mode 100644 index 00000000..4886c9b8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/normalize/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/shim.js new file mode 100644 index 00000000..28e27f59 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/normalize/shim.js @@ -0,0 +1,13 @@ +// Taken from: https://github.com/walling/unorm/blob/master/test/es6-shim.js + +'use strict'; + +var str = 'äiti'; + +module.exports = function (t, a) { + a(t.call(str), "\u00e4iti"); + a(t.call(str, "NFC"), "\u00e4iti"); + a(t.call(str, "NFD"), "a\u0308iti"); + a(t.call(str, "NFKC"), "\u00e4iti"); + a(t.call(str, "NFKD"), "a\u0308iti"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/pad.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/pad.js new file mode 100644 index 00000000..28c3fcaa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/pad.js @@ -0,0 +1,24 @@ +'use strict'; + +var partial = require('../../../function/#/partial'); + +module.exports = { + Left: function (t, a) { + t = partial.call(t, 'x', 5); + + a(t.call('yy'), 'xxxyy'); + a(t.call(''), 'xxxxx', "Empty string"); + + a(t.call('yyyyy'), 'yyyyy', 'Equal length'); + a(t.call('yyyyyyy'), 'yyyyyyy', 'Longer'); + }, + Right: function (t, a) { + t = partial.call(t, 'x', -5); + + a(t.call('yy'), 'yyxxx'); + a(t.call(''), 'xxxxx', "Empty string"); + + a(t.call('yyyyy'), 'yyyyy', 'Equal length'); + a(t.call('yyyyyyy'), 'yyyyyyy', 'Longer'); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/plain-replace-all.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/plain-replace-all.js new file mode 100644 index 00000000..a425c87a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/plain-replace-all.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('razdwatrzy', 'dwa', 'olera'), 'razoleratrzy', "Basic"); + a(t.call('razdwatrzy', 'dwa', 'ole$&a'), 'razole$&atrzy', "Inserts"); + a(t.call('razdwa', 'ola', 'sdfs'), 'razdwa', "No replace"); + + a(t.call('$raz$$dwa$trzy$', '$', '&&'), '&&raz&&&&dwa&&trzy&&', "Multi"); + a(t.call('$raz$$dwa$$$$trzy$', '$$', '&'), '$raz&dwa&&trzy$', + "Multi many chars"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/plain-replace.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/plain-replace.js new file mode 100644 index 00000000..54522ed7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/plain-replace.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('razdwatrzy', 'dwa', 'olera'), 'razoleratrzy', "Basic"); + a(t.call('razdwatrzy', 'dwa', 'ole$&a'), 'razole$&atrzy', "Inserts"); + a(t.call('razdwa', 'ola', 'sdfs'), 'razdwa', "No replace"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/implement.js new file mode 100644 index 00000000..7ff65a81 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/repeat/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/shim.js new file mode 100644 index 00000000..7e0d077e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/repeat/shim.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function (t, a) { + a(t.call('a', 0), '', "Empty"); + a(t.call('a', 1), 'a', "1"); + a(t.call('\t', 5), '\t\t\t\t\t', "Whitespace"); + a(t.call('raz', 3), 'razrazraz', "Many chars"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/implement.js new file mode 100644 index 00000000..fc8490fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../../string/#/starts-with/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/shim.js new file mode 100644 index 00000000..e0e123b3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/#/starts-with/shim.js @@ -0,0 +1,14 @@ +// Inspired and in some parts copied from: +// http://closure-library.googlecode.com/svn/trunk/closure/goog +// /string/string_test.html + +'use strict'; + +module.exports = function (t, a) { + a(t.call('abc', ''), true, "Empty needle"); + a(t.call('abcd', 'ab'), true, "Starts with needle"); + a(t.call('abcd', 'abcd'), true, "Needle equals haystack"); + a(t.call('abcd', 'bcde', 1), false, "Needle larger than haystack"); + a(!t.call('abcd', 'cd'), true, "Doesn't start with needle"); + a(t.call('abcd', 'bc', 1), true, "Position"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/format-method.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/format-method.js new file mode 100644 index 00000000..bb5561ee --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/format-method.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = function (t, a) { + t = t({ a: 'A', aa: 'B', ab: 'C', b: 'D', + c: function () { return ++this.a; } }); + a(t.call({ a: 0 }, ' %a%aab%abb%b\\%aa%ab%c%c '), ' ABbCbD%aaC12 '); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/implement.js new file mode 100644 index 00000000..0aceb97e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../string/from-code-point/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/shim.js new file mode 100644 index 00000000..88cda3d6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/from-code-point/shim.js @@ -0,0 +1,47 @@ +// Taken from: https://github.com/mathiasbynens/String.fromCodePoint/blob/master +// /tests/tests.js + +'use strict'; + +var pow = Math.pow; + +module.exports = function (t, a) { + var counter, result; + + a(t.length, 1, "Length"); + a(String.propertyIsEnumerable('fromCodePoint'), false, "Not enumerable"); + + a(t(''), '\0', "Empty string"); + a(t(), '', "No arguments"); + a(t(-0), '\0', "-0"); + a(t(0), '\0', "0"); + a(t(0x1D306), '\uD834\uDF06', "Unicode"); + a(t(0x1D306, 0x61, 0x1D307), '\uD834\uDF06a\uD834\uDF07', "Complex unicode"); + a(t(0x61, 0x62, 0x1D307), 'ab\uD834\uDF07', "Complex"); + a(t(false), '\0', "false"); + a(t(null), '\0', "null"); + + a.throws(function () { t('_'); }, RangeError, "_"); + a.throws(function () { t(Infinity); }, RangeError, "Infinity"); + a.throws(function () { t(-Infinity); }, RangeError, "-Infinity"); + a.throws(function () { t(-1); }, RangeError, "-1"); + a.throws(function () { t(0x10FFFF + 1); }, RangeError, "Range error #1"); + a.throws(function () { t(3.14); }, RangeError, "Range error #2"); + a.throws(function () { t(3e-2); }, RangeError, "Range error #3"); + a.throws(function () { t(-Infinity); }, RangeError, "Range error #4"); + a.throws(function () { t(+Infinity); }, RangeError, "Range error #5"); + a.throws(function () { t(NaN); }, RangeError, "Range error #6"); + a.throws(function () { t(undefined); }, RangeError, "Range error #7"); + a.throws(function () { t({}); }, RangeError, "Range error #8"); + a.throws(function () { t(/re/); }, RangeError, "Range error #9"); + + counter = pow(2, 15) * 3 / 2; + result = []; + while (--counter >= 0) result.push(0); // one code unit per symbol + t.apply(null, result); // must not throw + + counter = pow(2, 15) * 3 / 2; + result = []; + while (--counter >= 0) result.push(0xFFFF + 1); // two code units per symbol + t.apply(null, result); // must not throw +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/is-string.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/is-string.js new file mode 100644 index 00000000..32f59582 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/is-string.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function (t, a) { + a(t(null), false, "Null"); + a(t(''), true, "Empty string"); + a(t(12), false, "Number"); + a(t(false), false, "Boolean"); + a(t(new Date()), false, "Date"); + a(t(new String('raz')), true, "String object"); + a(t('asdfaf'), true, "String"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/random-uniq.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/random-uniq.js new file mode 100644 index 00000000..6791ac26 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/random-uniq.js @@ -0,0 +1,14 @@ +'use strict'; + +var isValidFormat = RegExp.prototype.test.bind(/^[a-z0-9]+$/); + +module.exports = function (t, a) { + a(typeof t(), 'string'); + a.ok(t().length > 7); + a.not(t(), t()); + a.ok(isValidFormat(t())); + a.ok(isValidFormat(t())); + a.ok(isValidFormat(t())); + a.ok(isValidFormat(t())); + a.ok(isValidFormat(t())); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/implement.js new file mode 100644 index 00000000..59416de3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/implement.js @@ -0,0 +1,5 @@ +'use strict'; + +var isImplemented = require('../../../string/raw/is-implemented'); + +module.exports = function (a) { a(isImplemented(), true); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/index.js new file mode 100644 index 00000000..2e0bfa32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./shim'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/shim.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/shim.js new file mode 100644 index 00000000..025ed780 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/string/raw/shim.js @@ -0,0 +1,15 @@ +// Partially taken from: +// https://github.com/paulmillr/es6-shim/blob/master/test/string.js + +'use strict'; + +module.exports = function (t, a) { + var callSite = []; + + callSite.raw = ["The total is ", " ($", " with tax)"]; + a(t(callSite, '{total}', '{total * 1.01}'), + 'The total is {total} (${total * 1.01} with tax)'); + + callSite.raw = []; + a(t(callSite, '{total}', '{total * 1.01}'), ''); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/#/chain.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/#/chain.js new file mode 100644 index 00000000..6dc1543b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/#/chain.js @@ -0,0 +1,40 @@ +'use strict'; + +var setPrototypeOf = require('es5-ext/object/set-prototype-of') + , d = require('d') + , Iterator = require('../') + , validIterable = require('../valid-iterable') + + , push = Array.prototype.push + , defineProperties = Object.defineProperties + , IteratorChain; + +IteratorChain = function (iterators) { + defineProperties(this, { + __iterators__: d('', iterators), + __current__: d('w', iterators.shift()) + }); +}; +if (setPrototypeOf) setPrototypeOf(IteratorChain, Iterator); + +IteratorChain.prototype = Object.create(Iterator.prototype, { + constructor: d(IteratorChain), + next: d(function () { + var result; + if (!this.__current__) return { done: true, value: undefined }; + result = this.__current__.next(); + while (result.done) { + this.__current__ = this.__iterators__.shift(); + if (!this.__current__) return { done: true, value: undefined }; + result = this.__current__.next(); + } + return result; + }) +}); + +module.exports = function () { + var iterators = [this]; + push.apply(iterators, arguments); + iterators.forEach(validIterable); + return new IteratorChain(iterators); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/.lint new file mode 100644 index 00000000..cf54d815 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/.lint @@ -0,0 +1,11 @@ +@root + +module + +tabs +indent 2 +maxlen 100 + +ass +nomen +plusplus diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/.travis.yml new file mode 100644 index 00000000..02c277cf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+es6-iterator@medikoo.com + +script: "npm test && npm run lint" diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/CHANGES new file mode 100644 index 00000000..a2d1ec7c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/CHANGES @@ -0,0 +1,28 @@ +v0.1.3 -- 2015.02.02 +* Update dependencies +* Fix spelling of LICENSE + +v0.1.2 -- 2014.11.19 +* Optimise internal `_next` to not verify internal's list length at all times + (#2 thanks @RReverser) +* Fix documentation examples +* Configure lint scripts + +v0.1.1 -- 2014.04.29 +* Fix es6-symbol dependency version + +v0.1.0 -- 2014.04.29 +* Assure strictly npm hosted dependencies +* Remove sparse arrays dedicated handling (as per spec) +* Add: isIterable, validIterable and chain (method) +* Remove toArray, it's addressed by Array.from (polyfil can be found in es5-ext/array/from) +* Add break possiblity to 'forOf' via 'doBreak' function argument +* Provide dedicated iterator for array-likes (ArrayIterator) and for strings (StringIterator) +* Provide @@toStringTag symbol +* When available rely on @@iterator symbol +* Remove 32bit integer maximum list length restriction +* Improve Iterator internals +* Update to use latest version of dependencies + +v0.0.0 -- 2013.10.12 +Initial (dev version) \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/LICENSE new file mode 100644 index 00000000..04724a3a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/README.md new file mode 100644 index 00000000..288373da --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/README.md @@ -0,0 +1,148 @@ +# es6-iterator +## ECMAScript 6 Iterator interface + +### Installation + + $ npm install es6-iterator + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +## API + +### Constructors + +#### Iterator(list) _(es6-iterator)_ + +Abstract Iterator interface. Meant for extensions and not to be used on its own. + +Accepts any _list_ object (technically object with numeric _length_ property). + +_Mind it doesn't iterate strings properly, for that use dedicated [StringIterator](#string-iterator)_ + +```javascript +var Iterator = require('es6-iterator') +var iterator = new Iterator([1, 2, 3]); + +iterator.next(); // { value: 1, done: false } +iterator.next(); // { value: 2, done: false } +iterator.next(); // { value: 3, done: false } +iterator.next(); // { value: undefined, done: true } +``` + + +#### ArrayIterator(arrayLike[, kind]) _(es6-iterator/array)_ + +Dedicated for arrays and array-likes. Supports three iteration kinds: +* __value__ _(default)_ - Iterates values +* __key__ - Iterates indexes +* __key+value__ - Iterates keys and indexes, each iteration value is in _[key, value]_ form. + + +```javascript +var ArrayIterator = require('es6-iterator/array') +var iterator = new ArrayIterator([1, 2, 3], 'key+value'); + +iterator.next(); // { value: [0, 1], done: false } +iterator.next(); // { value: [1, 2], done: false } +iterator.next(); // { value: [2, 3], done: false } +iterator.next(); // { value: undefined, done: true } +``` + +May also be used for _arguments_ objects: + +```javascript +(function () { + var iterator = new ArrayIterator(arguments); + + iterator.next(); // { value: 1, done: false } + iterator.next(); // { value: 2, done: false } + iterator.next(); // { value: 3, done: false } + iterator.next(); // { value: undefined, done: true } +}(1, 2, 3)); +``` + +#### StringIterator(str) _(es6-iterator/string)_ + +Assures proper iteration over unicode symbols. +See: http://mathiasbynens.be/notes/javascript-unicode + +```javascript +var StringIterator = require('es6-iterator/string'); +var iterator = new StringIterator('f🙈o🙉o🙊'); + +iterator.next(); // { value: 'f', done: false } +iterator.next(); // { value: '🙈', done: false } +iterator.next(); // { value: 'o', done: false } +iterator.next(); // { value: '🙉', done: false } +iterator.next(); // { value: 'o', done: false } +iterator.next(); // { value: '🙊', done: false } +iterator.next(); // { value: undefined, done: true } +``` + +### Function utilities + +#### forOf(iterable, callback[, thisArg]) _(es6-iterator/for-of)_ + +Polyfill for ECMAScript 6 [`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) statement. + +``` +var forOf = require('es6-iterator/for-of'); +var result = []; + +forOf('🙈🙉🙊', function (monkey) { result.push(monkey); }); +console.log(result); // ['🙈', '🙉', '🙊']; +``` + +Optionally you can break iteration at any point: + +```javascript +var result = []; + +forOf([1,2,3,4]', function (val, doBreak) { + result.push(monkey); + if (val >= 3) doBreak(); +}); +console.log(result); // [1, 2, 3]; +``` + +#### get(obj) _(es6-iterator/get)_ + +Return iterator for any iterable object. + +```javascript +var getIterator = require('es6-iterator/get'); +var iterator = get([1,2,3]); + +iterator.next(); // { value: 1, done: false } +iterator.next(); // { value: 2, done: false } +iterator.next(); // { value: 3, done: false } +iterator.next(); // { value: undefined, done: true } +``` + +#### isIterable(obj) _(es6-iterator/is-iterable)_ + +Whether _obj_ is iterable + +```javascript +var isIterable = require('es6-iterator/is-iterable'); + +isIterable(null); // false +isIterable(true); // false +isIterable('str'); // true +isIterable(['a', 'r', 'r']); // true +isIterable(new ArrayIterator([])); // true +``` + +#### validIterable(obj) _(es6-iterator/valid-iterable)_ + +If _obj_ is an iterable it is returned. Otherwise _TypeError_ is thrown. + +### Method extensions + +#### iterator.chain(iterator1[, …iteratorn]) _(es6-iterator/#/chain)_ + +Chain multiple iterators into one. + +### Tests [![Build Status](https://travis-ci.org/medikoo/es6-iterator.png)](https://travis-ci.org/medikoo/es6-iterator) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/array.js new file mode 100644 index 00000000..885ad0a4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/array.js @@ -0,0 +1,30 @@ +'use strict'; + +var setPrototypeOf = require('es5-ext/object/set-prototype-of') + , contains = require('es5-ext/string/#/contains') + , d = require('d') + , Iterator = require('./') + + , defineProperty = Object.defineProperty + , ArrayIterator; + +ArrayIterator = module.exports = function (arr, kind) { + if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind); + Iterator.call(this, arr); + if (!kind) kind = 'value'; + else if (contains.call(kind, 'key+value')) kind = 'key+value'; + else if (contains.call(kind, 'key')) kind = 'key'; + else kind = 'value'; + defineProperty(this, '__kind__', d('', kind)); +}; +if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator); + +ArrayIterator.prototype = Object.create(Iterator.prototype, { + constructor: d(ArrayIterator), + _resolve: d(function (i) { + if (this.__kind__ === 'value') return this.__list__[i]; + if (this.__kind__ === 'key+value') return [i, this.__list__[i]]; + return i; + }), + toString: d(function () { return '[object Array Iterator]'; }) +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/for-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/for-of.js new file mode 100644 index 00000000..111f5522 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/for-of.js @@ -0,0 +1,44 @@ +'use strict'; + +var callable = require('es5-ext/object/valid-callable') + , isString = require('es5-ext/string/is-string') + , get = require('./get') + + , isArray = Array.isArray, call = Function.prototype.call; + +module.exports = function (iterable, cb/*, thisArg*/) { + var mode, thisArg = arguments[2], result, doBreak, broken, i, l, char, code; + if (isArray(iterable)) mode = 'array'; + else if (isString(iterable)) mode = 'string'; + else iterable = get(iterable); + + callable(cb); + doBreak = function () { broken = true; }; + if (mode === 'array') { + iterable.some(function (value) { + call.call(cb, thisArg, value, doBreak); + if (broken) return true; + }); + return; + } + if (mode === 'string') { + l = iterable.length; + for (i = 0; i < l; ++i) { + char = iterable[i]; + if ((i + 1) < l) { + code = char.charCodeAt(0); + if ((code >= 0xD800) && (code <= 0xDBFF)) char += iterable[++i]; + } + call.call(cb, thisArg, char, doBreak); + if (broken) break; + } + return; + } + result = iterable.next(); + + while (!result.done) { + call.call(cb, thisArg, result.value, doBreak); + if (broken) return; + result = iterable.next(); + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/get.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/get.js new file mode 100644 index 00000000..38230fd8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/get.js @@ -0,0 +1,13 @@ +'use strict'; + +var isString = require('es5-ext/string/is-string') + , ArrayIterator = require('./array') + , StringIterator = require('./string') + , iterable = require('./valid-iterable') + , iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (obj) { + if (typeof iterable(obj)[iteratorSymbol] === 'function') return obj[iteratorSymbol](); + if (isString(obj)) return new StringIterator(obj); + return new ArrayIterator(obj); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/index.js new file mode 100644 index 00000000..10fd0895 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/index.js @@ -0,0 +1,90 @@ +'use strict'; + +var clear = require('es5-ext/array/#/clear') + , assign = require('es5-ext/object/assign') + , callable = require('es5-ext/object/valid-callable') + , value = require('es5-ext/object/valid-value') + , d = require('d') + , autoBind = require('d/auto-bind') + , Symbol = require('es6-symbol') + + , defineProperty = Object.defineProperty + , defineProperties = Object.defineProperties + , Iterator; + +module.exports = Iterator = function (list, context) { + if (!(this instanceof Iterator)) return new Iterator(list, context); + defineProperties(this, { + __list__: d('w', value(list)), + __context__: d('w', context), + __nextIndex__: d('w', 0) + }); + if (!context) return; + callable(context.on); + context.on('_add', this._onAdd); + context.on('_delete', this._onDelete); + context.on('_clear', this._onClear); +}; + +defineProperties(Iterator.prototype, assign({ + constructor: d(Iterator), + _next: d(function () { + var i; + if (!this.__list__) return; + if (this.__redo__) { + i = this.__redo__.shift(); + if (i !== undefined) return i; + } + if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++; + this._unBind(); + }), + next: d(function () { return this._createResult(this._next()); }), + _createResult: d(function (i) { + if (i === undefined) return { done: true, value: undefined }; + return { done: false, value: this._resolve(i) }; + }), + _resolve: d(function (i) { return this.__list__[i]; }), + _unBind: d(function () { + this.__list__ = null; + delete this.__redo__; + if (!this.__context__) return; + this.__context__.off('_add', this._onAdd); + this.__context__.off('_delete', this._onDelete); + this.__context__.off('_clear', this._onClear); + this.__context__ = null; + }), + toString: d(function () { return '[object Iterator]'; }) +}, autoBind({ + _onAdd: d(function (index) { + if (index >= this.__nextIndex__) return; + ++this.__nextIndex__; + if (!this.__redo__) { + defineProperty(this, '__redo__', d('c', [index])); + return; + } + this.__redo__.forEach(function (redo, i) { + if (redo >= index) this.__redo__[i] = ++redo; + }, this); + this.__redo__.push(index); + }), + _onDelete: d(function (index) { + var i; + if (index >= this.__nextIndex__) return; + --this.__nextIndex__; + if (!this.__redo__) return; + i = this.__redo__.indexOf(index); + if (i !== -1) this.__redo__.splice(i, 1); + this.__redo__.forEach(function (redo, i) { + if (redo > index) this.__redo__[i] = --redo; + }, this); + }), + _onClear: d(function () { + if (this.__redo__) clear.call(this.__redo__); + this.__nextIndex__ = 0; + }) +}))); + +defineProperty(Iterator.prototype, Symbol.iterator, d(function () { + return this; +})); +defineProperty(Iterator.prototype, Symbol.toStringTag, d('', 'Iterator')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/is-iterable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/is-iterable.js new file mode 100644 index 00000000..bbcf1049 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/is-iterable.js @@ -0,0 +1,13 @@ +'use strict'; + +var isString = require('es5-ext/string/is-string') + , iteratorSymbol = require('es6-symbol').iterator + + , isArray = Array.isArray; + +module.exports = function (value) { + if (value == null) return false; + if (isArray(value)) return true; + if (isString(value)) return true; + return (typeof value[iteratorSymbol] === 'function'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/package.json new file mode 100644 index 00000000..593d080e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/package.json @@ -0,0 +1,66 @@ +{ + "name": "es6-iterator", + "version": "0.1.3", + "description": "Iterator abstraction based on ES6 specification", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "iterator", + "array", + "list", + "set", + "map", + "generator" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es6-iterator.git" + }, + "dependencies": { + "d": "~0.1.1", + "es5-ext": "~0.10.5", + "es6-symbol": "~2.0.1" + }, + "devDependencies": { + "event-emitter": "~0.3.3", + "tad": "~0.2.1", + "xlint": "~0.2.2", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "2addc362c6f139e4941cf4726eeb59e5960c5cef", + "bugs": { + "url": "https://github.com/medikoo/es6-iterator/issues" + }, + "homepage": "https://github.com/medikoo/es6-iterator", + "_id": "es6-iterator@0.1.3", + "_shasum": "d6f58b8c4fc413c249b4baa19768f8e4d7c8944e", + "_from": "es6-iterator@>=0.1.1 <0.2.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.11.16", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "d6f58b8c4fc413c249b4baa19768f8e4d7c8944e", + "tarball": "http://registry.npmjs.org/es6-iterator/-/es6-iterator-0.1.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-0.1.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/string.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/string.js new file mode 100644 index 00000000..cdb39ea4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/string.js @@ -0,0 +1,37 @@ +// Thanks @mathiasbynens +// http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols + +'use strict'; + +var setPrototypeOf = require('es5-ext/object/set-prototype-of') + , d = require('d') + , Iterator = require('./') + + , defineProperty = Object.defineProperty + , StringIterator; + +StringIterator = module.exports = function (str) { + if (!(this instanceof StringIterator)) return new StringIterator(str); + str = String(str); + Iterator.call(this, str); + defineProperty(this, '__length__', d('', str.length)); + +}; +if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator); + +StringIterator.prototype = Object.create(Iterator.prototype, { + constructor: d(StringIterator), + _next: d(function () { + if (!this.__list__) return; + if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++; + this._unBind(); + }), + _resolve: d(function (i) { + var char = this.__list__[i], code; + if (this.__nextIndex__ === this.__length__) return char; + code = char.charCodeAt(0); + if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++]; + return char; + }), + toString: d(function () { return '[object String Iterator]'; }) +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/#/chain.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/#/chain.js new file mode 100644 index 00000000..a414c66d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/#/chain.js @@ -0,0 +1,23 @@ +'use strict'; + +var Iterator = require('../../'); + +module.exports = function (t, a) { + var i1 = new Iterator(['raz', 'dwa', 'trzy']) + , i2 = new Iterator(['cztery', 'pięć', 'sześć']) + , i3 = new Iterator(['siedem', 'osiem', 'dziewięć']) + + , iterator = t.call(i1, i2, i3); + + a.deep(iterator.next(), { done: false, value: 'raz' }, "#1"); + a.deep(iterator.next(), { done: false, value: 'dwa' }, "#2"); + a.deep(iterator.next(), { done: false, value: 'trzy' }, "#3"); + a.deep(iterator.next(), { done: false, value: 'cztery' }, "#4"); + a.deep(iterator.next(), { done: false, value: 'pięć' }, "#5"); + a.deep(iterator.next(), { done: false, value: 'sześć' }, "#6"); + a.deep(iterator.next(), { done: false, value: 'siedem' }, "#7"); + a.deep(iterator.next(), { done: false, value: 'osiem' }, "#8"); + a.deep(iterator.next(), { done: false, value: 'dziewięć' }, "#9"); + a.deep(iterator.next(), { done: true, value: undefined }, "Done #1"); + a.deep(iterator.next(), { done: true, value: undefined }, "Done #2"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/array.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/array.js new file mode 100644 index 00000000..ae7c2199 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/array.js @@ -0,0 +1,67 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (T) { + return { + Values: function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it; + + it = new T(x); + a(it[iteratorSymbol](), it, "@@iterator"); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + x.splice(1, 0, 'elo'); + a.deep(it.next(), { done: false, value: 'dwa' }, "Insert"); + a.deep(it.next(), { done: false, value: 'trzy' }, "#3"); + a.deep(it.next(), { done: false, value: 'cztery' }, "#4"); + x.pop(); + a.deep(it.next(), { done: false, value: 'pięć' }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Keys & Values": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it; + + it = new T(x, 'key+value'); + a(it[iteratorSymbol](), it, "@@iterator"); + a.deep(it.next(), { done: false, value: [0, 'raz'] }, "#1"); + a.deep(it.next(), { done: false, value: [1, 'dwa'] }, "#2"); + x.splice(1, 0, 'elo'); + a.deep(it.next(), { done: false, value: [2, 'dwa'] }, "Insert"); + a.deep(it.next(), { done: false, value: [3, 'trzy'] }, "#3"); + a.deep(it.next(), { done: false, value: [4, 'cztery'] }, "#4"); + x.pop(); + a.deep(it.next(), { done: false, value: [5, 'pięć'] }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + Keys: function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it; + + it = new T(x, 'key'); + a(it[iteratorSymbol](), it, "@@iterator"); + a.deep(it.next(), { done: false, value: 0 }, "#1"); + a.deep(it.next(), { done: false, value: 1 }, "#2"); + x.splice(1, 0, 'elo'); + a.deep(it.next(), { done: false, value: 2 }, "Insert"); + a.deep(it.next(), { done: false, value: 3 }, "#3"); + a.deep(it.next(), { done: false, value: 4 }, "#4"); + x.pop(); + a.deep(it.next(), { done: false, value: 5 }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + Sparse: function (a) { + var x = new Array(6), it; + + x[2] = 'raz'; + x[4] = 'dwa'; + it = new T(x); + a.deep(it.next(), { done: false, value: undefined }, "#1"); + a.deep(it.next(), { done: false, value: undefined }, "#2"); + a.deep(it.next(), { done: false, value: 'raz' }, "#3"); + a.deep(it.next(), { done: false, value: undefined }, "#4"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#5"); + a.deep(it.next(), { done: false, value: undefined }, "#6"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/for-of.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/for-of.js new file mode 100644 index 00000000..502e7b76 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/for-of.js @@ -0,0 +1,35 @@ +'use strict'; + +var ArrayIterator = require('../array') + + , slice = Array.prototype.slice; + +module.exports = function (t, a) { + var i = 0, x = ['raz', 'dwa', 'trzy'], y = {}, called = 0; + t(x, function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Array " + i + "#"); + a(this, y, "Array: context: " + (i++) + "#"); + }, y); + i = 0; + t(x = 'foo', function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#"); + a(this, y, "Regular String: context: " + (i++) + "#"); + }, y); + i = 0; + x = ['r', '💩', 'z']; + t('r💩z', function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#"); + a(this, y, "Unicode String: context: " + (i++) + "#"); + }, y); + i = 0; + t(new ArrayIterator(x), function () { + a.deep(slice.call(arguments, 0, 1), [x[i]], "Iterator " + i + "#"); + a(this, y, "Iterator: context: " + (i++) + "#"); + }, y); + + t(x = ['raz', 'dwa', 'trzy'], function (value, doBreak) { + ++called; + return doBreak(); + }); + a(called, 1, "Break"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/get.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/get.js new file mode 100644 index 00000000..7309590c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/get.js @@ -0,0 +1,16 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , Iterator = require('../'); + +module.exports = function (t, a) { + var iterator; + a.throws(function () { t(); }, TypeError, "Null"); + a.throws(function () { t({}); }, TypeError, "Plain object"); + a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like"); + iterator = {}; + iterator[iteratorSymbol] = function () { return new Iterator([]); }; + a(t(iterator) instanceof Iterator, true, "Iterator"); + a(String(t([])), '[object Array Iterator]', " Array"); + a(String(t('foo')), '[object String Iterator]', "String"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/index.js new file mode 100644 index 00000000..ea3621ad --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/index.js @@ -0,0 +1,99 @@ +'use strict'; + +var ee = require('event-emitter') + , iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (T) { + return { + "": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], it, y, z; + + it = new T(x); + a(it[iteratorSymbol](), it, "@@iterator"); + y = it.next(); + a.deep(y, { done: false, value: 'raz' }, "#1"); + z = it.next(); + a.not(y, z, "Recreate result"); + a.deep(z, { done: false, value: 'dwa' }, "#2"); + a.deep(it.next(), { done: false, value: 'trzy' }, "#3"); + a.deep(it.next(), { done: false, value: 'cztery' }, "#4"); + a.deep(it.next(), { done: false, value: 'pięć' }, "#5"); + a.deep(y = it.next(), { done: true, value: undefined }, "End"); + a.not(y, it.next(), "Recreate result on dead"); + }, + Emited: function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], y, it; + + y = ee(); + it = new T(x, y); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + y.emit('_add', x.push('sześć') - 1); + a.deep(it.next(), { done: false, value: 'trzy' }, "#3"); + x.splice(1, 0, 'półtora'); + y.emit('_add', 1); + a.deep(it.next(), { done: false, value: 'półtora' }, "Insert"); + x.splice(5, 1); + y.emit('_delete', 5); + a.deep(it.next(), { done: false, value: 'cztery' }, "#4"); + a.deep(it.next(), { done: false, value: 'sześć' }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited #2": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it; + + y = ee(); + it = new T(x, y); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + x.splice(1, 0, 'półtora'); + y.emit('_add', 1); + x.splice(1, 0, '1.25'); + y.emit('_add', 1); + x.splice(0, 1); + y.emit('_delete', 0); + a.deep(it.next(), { done: false, value: 'półtora' }, "Insert"); + a.deep(it.next(), { done: false, value: '1.25' }, "Insert #2"); + a.deep(it.next(), { done: false, value: 'trzy' }, "#3"); + a.deep(it.next(), { done: false, value: 'cztery' }, "#4"); + x.splice(5, 1); + y.emit('_delete', 5); + a.deep(it.next(), { done: false, value: 'sześć' }, "#5"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited: Clear #1": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it; + + y = ee(); + it = new T(x, y); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + x.length = 0; + y.emit('_clear'); + a.deep(it.next(), { done: true, value: undefined }, "End"); + }, + "Emited: Clear #2": function (a) { + var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it; + + y = ee(); + it = new T(x, y); + a.deep(it.next(), { done: false, value: 'raz' }, "#1"); + a.deep(it.next(), { done: false, value: 'dwa' }, "#2"); + x.length = 0; + y.emit('_clear'); + x.push('foo'); + x.push('bar'); + a.deep(it.next(), { done: false, value: 'foo' }, "#3"); + a.deep(it.next(), { done: false, value: 'bar' }, "#4"); + x.splice(1, 0, 'półtora'); + y.emit('_add', 1); + x.splice(1, 0, '1.25'); + y.emit('_add', 1); + x.splice(0, 1); + y.emit('_delete', 0); + a.deep(it.next(), { done: false, value: 'półtora' }, "Insert"); + a.deep(it.next(), { done: false, value: '1.25' }, "Insert #2"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + } + }; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/is-iterable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/is-iterable.js new file mode 100644 index 00000000..7c5c59b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/is-iterable.js @@ -0,0 +1,18 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , Iterator = require('../'); + +module.exports = function (t, a) { + var iterator; + a(t(), false, "Undefined"); + a(t(123), false, "Number"); + a(t({}), false, "Plain object"); + a(t({ length: 0 }), false, "Array-like"); + iterator = {}; + iterator[iteratorSymbol] = function () { return new Iterator([]); }; + a(t(iterator), true, "Iterator"); + a(t([]), true, "Array"); + a(t('foo'), true, "String"); + a(t(''), true, "Empty string"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/string.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/string.js new file mode 100644 index 00000000..d11855f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/string.js @@ -0,0 +1,23 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator; + +module.exports = function (T, a) { + var it = new T('foobar'); + + a(it[iteratorSymbol](), it, "@@iterator"); + a.deep(it.next(), { done: false, value: 'f' }, "#1"); + a.deep(it.next(), { done: false, value: 'o' }, "#2"); + a.deep(it.next(), { done: false, value: 'o' }, "#3"); + a.deep(it.next(), { done: false, value: 'b' }, "#4"); + a.deep(it.next(), { done: false, value: 'a' }, "#5"); + a.deep(it.next(), { done: false, value: 'r' }, "#6"); + a.deep(it.next(), { done: true, value: undefined }, "End"); + + a.h1("Outside of BMP"); + it = new T('r💩z'); + a.deep(it.next(), { done: false, value: 'r' }, "#1"); + a.deep(it.next(), { done: false, value: '💩' }, "#2"); + a.deep(it.next(), { done: false, value: 'z' }, "#3"); + a.deep(it.next(), { done: true, value: undefined }, "End"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/valid-iterable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/valid-iterable.js new file mode 100644 index 00000000..7760b017 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/test/valid-iterable.js @@ -0,0 +1,16 @@ +'use strict'; + +var iteratorSymbol = require('es6-symbol').iterator + , Iterator = require('../'); + +module.exports = function (t, a) { + var obj; + a.throws(function () { t(); }, TypeError, "Undefined"); + a.throws(function () { t({}); }, TypeError, "Plain object"); + a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like"); + obj = {}; + obj[iteratorSymbol] = function () { return new Iterator([]); }; + a(t(obj), obj, "Iterator"); + obj = []; + a(t(obj), obj, 'Array'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/valid-iterable.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/valid-iterable.js new file mode 100644 index 00000000..d330997c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-iterator/valid-iterable.js @@ -0,0 +1,8 @@ +'use strict'; + +var isIterable = require('./is-iterable'); + +module.exports = function (value) { + if (!isIterable(value)) throw new TypeError(value + " is not iterable"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/.lint b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/.lint new file mode 100644 index 00000000..1851752f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/.lint @@ -0,0 +1,13 @@ +@root + +module + +tabs +indent 2 +maxlen 100 + +ass +nomen +plusplus +newcap +vars diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/.npmignore new file mode 100644 index 00000000..155e41f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/.npmignore @@ -0,0 +1,4 @@ +.DS_Store +/node_modules +/npm-debug.log +/.lintcache diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/.travis.yml new file mode 100644 index 00000000..afd3509a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - 0.8 + - 0.10 + - 0.11 + +notifications: + email: + - medikoo+es6-symbol@medikoo.com diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/CHANGES b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/CHANGES new file mode 100644 index 00000000..df8c27ef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/CHANGES @@ -0,0 +1,34 @@ +v2.0.1 -- 2015.01.28 +* Fix Symbol.prototype[Symbol.isPrimitive] implementation +* Improve validation within Symbol.prototype.toString and + Symbol.prototype.valueOf + +v2.0.0 -- 2015.01.28 +* Update up to changes in specification: + * Implement `for` and `keyFor` + * Remove `Symbol.create` and `Symbol.isRegExp` + * Add `Symbol.match`, `Symbol.replace`, `Symbol.search`, `Symbol.species` and + `Symbol.split` +* Rename `validSymbol` to `validateSymbol` +* Improve documentation +* Remove dead test modules + +v1.0.0 -- 2015.01.26 +* Fix enumerability for symbol properties set normally (e.g. obj[symbol] = value) +* Introduce initialization via hidden constructor +* Fix isSymbol handling of polyfill values when native Symbol is present +* Fix spelling of LICENSE +* Configure lint scripts + +v0.1.1 -- 2014.10.07 +* Fix isImplemented, so it returns true in case of polyfill +* Improve documentations + +v0.1.0 -- 2014.04.28 +* Assure strictly npm dependencies +* Update to use latest versions of dependencies +* Fix implementation detection so it doesn't crash on `String(symbol)` +* throw on `new Symbol()` (as decided by TC39) + +v0.0.0 -- 2013.11.15 +* Initial (dev) version \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/LICENSE new file mode 100644 index 00000000..04724a3a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) + +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/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/README.md new file mode 100644 index 00000000..95d6780b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/README.md @@ -0,0 +1,71 @@ +# es6-symbol +## ECMAScript 6 Symbol polyfill + +For more information about symbols see following links +- [Symbols in ECMAScript 6 by Axel Rauschmayer](http://www.2ality.com/2014/12/es6-symbols.html) +- [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) +- [Specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-constructor) + +### Limitations + +Underneath it uses real string property names which can easily be retrieved, however accidental collision with other property names is unlikely. + +### Usage + +If you'd like to use native version when it exists and fallback to polyfill if it doesn't (but without implementing `Symbol` on global scope), do: + +```javascript +var Symbol = require('es6-symbol'); +``` + +If you want to make sure your environment implements `Symbol`, do: + +```javascript +require('es6-symbol/implement'); +``` + +If you strictly want to use polyfill even if native `Symbol` exists (hard to find a good reason for that), do: + +```javascript +var Symbol = require('es6-symbol/polyfill'); +``` + +#### API + +Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-objects). Still if you want quick look, follow examples: + +```javascript +var Symbol = require('es6-symbol'); + +var symbol = Symbol('My custom symbol'); +var x = {}; + +x[symbol] = 'foo'; +console.log(x[symbol]); 'foo' + +// Detect iterable: +var iterator, result; +if (possiblyIterable[Symbol.iterator]) { + iterator = possiblyIterable[Symbol.iterator](); + result = iterator.next(); + while(!result.done) { + console.log(result.value); + result = iterator.next(); + } +} +``` + +### Installation +#### NPM + +In your project path: + + $ npm install es6-symbol + +##### Browser + +To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) + +## Tests [![Build Status](https://travis-ci.org/medikoo/es6-symbol.png)](https://travis-ci.org/medikoo/es6-symbol) + + $ npm test diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/implement.js new file mode 100644 index 00000000..153edacd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/implement.js @@ -0,0 +1,7 @@ +'use strict'; + +if (!require('./is-implemented')()) { + Object.defineProperty(require('es5-ext/global'), 'Symbol', + { value: require('./polyfill'), configurable: true, enumerable: false, + writable: true }); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/index.js new file mode 100644 index 00000000..609f1faf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./is-implemented')() ? Symbol : require('./polyfill'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/is-implemented.js new file mode 100644 index 00000000..53759f32 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/is-implemented.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function () { + var symbol; + if (typeof Symbol !== 'function') return false; + symbol = Symbol('test symbol'); + try { String(symbol); } catch (e) { return false; } + if (typeof Symbol.iterator === 'symbol') return true; + + // Return 'true' for polyfills + if (typeof Symbol.isConcatSpreadable !== 'object') return false; + if (typeof Symbol.iterator !== 'object') return false; + if (typeof Symbol.toPrimitive !== 'object') return false; + if (typeof Symbol.toStringTag !== 'object') return false; + if (typeof Symbol.unscopables !== 'object') return false; + + return true; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/is-native-implemented.js new file mode 100644 index 00000000..a8cb8b86 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/is-native-implemented.js @@ -0,0 +1,8 @@ +// Exports true if environment provides native `Symbol` implementation + +'use strict'; + +module.exports = (function () { + if (typeof Symbol !== 'function') return false; + return (typeof Symbol.iterator === 'symbol'); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/is-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/is-symbol.js new file mode 100644 index 00000000..beeba2cb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/is-symbol.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (x) { + return (x && ((typeof x === 'symbol') || (x['@@toStringTag'] === 'Symbol'))) || false; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/package.json new file mode 100644 index 00000000..0efffeae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/package.json @@ -0,0 +1,63 @@ +{ + "name": "es6-symbol", + "version": "2.0.1", + "description": "ECMAScript6 Symbol polyfill", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "symbol", + "private", + "property", + "es6", + "ecmascript", + "harmony" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es6-symbol.git" + }, + "dependencies": { + "d": "~0.1.1", + "es5-ext": "~0.10.5" + }, + "devDependencies": { + "tad": "~0.2.1", + "xlint": "~0.2.2", + "xlint-jslint-medikoo": "~0.1.2" + }, + "scripts": { + "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", + "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "51f6938d7830269fefa38f02eb912f5472b3ccd7", + "bugs": { + "url": "https://github.com/medikoo/es6-symbol/issues" + }, + "homepage": "https://github.com/medikoo/es6-symbol", + "_id": "es6-symbol@2.0.1", + "_shasum": "761b5c67cfd4f1d18afb234f691d678682cb3bf3", + "_from": "es6-symbol@>=2.0.1 <2.1.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "761b5c67cfd4f1d18afb234f691d678682cb3bf3", + "tarball": "http://registry.npmjs.org/es6-symbol/-/es6-symbol-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/polyfill.js new file mode 100644 index 00000000..735eb676 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/polyfill.js @@ -0,0 +1,77 @@ +'use strict'; + +var d = require('d') + , validateSymbol = require('./validate-symbol') + + , create = Object.create, defineProperties = Object.defineProperties + , defineProperty = Object.defineProperty, objPrototype = Object.prototype + , Symbol, HiddenSymbol, globalSymbols = create(null); + +var generateName = (function () { + var created = create(null); + return function (desc) { + var postfix = 0, name; + while (created[desc + (postfix || '')]) ++postfix; + desc += (postfix || ''); + created[desc] = true; + name = '@@' + desc; + defineProperty(objPrototype, name, d.gs(null, function (value) { + defineProperty(this, name, d(value)); + })); + return name; + }; +}()); + +HiddenSymbol = function Symbol(description) { + if (this instanceof HiddenSymbol) throw new TypeError('TypeError: Symbol is not a constructor'); + return Symbol(description); +}; +module.exports = Symbol = function Symbol(description) { + var symbol; + if (this instanceof Symbol) throw new TypeError('TypeError: Symbol is not a constructor'); + symbol = create(HiddenSymbol.prototype); + description = (description === undefined ? '' : String(description)); + return defineProperties(symbol, { + __description__: d('', description), + __name__: d('', generateName(description)) + }); +}; +defineProperties(Symbol, { + for: d(function (key) { + if (globalSymbols[key]) return globalSymbols[key]; + return (globalSymbols[key] = Symbol(String(key))); + }), + keyFor: d(function (s) { + var key; + validateSymbol(s); + for (key in globalSymbols) if (globalSymbols[key] === s) return key; + }), + hasInstance: d('', Symbol('hasInstance')), + isConcatSpreadable: d('', Symbol('isConcatSpreadable')), + iterator: d('', Symbol('iterator')), + match: d('', Symbol('match')), + replace: d('', Symbol('replace')), + search: d('', Symbol('search')), + species: d('', Symbol('species')), + split: d('', Symbol('split')), + toPrimitive: d('', Symbol('toPrimitive')), + toStringTag: d('', Symbol('toStringTag')), + unscopables: d('', Symbol('unscopables')) +}); +defineProperties(HiddenSymbol.prototype, { + constructor: d(Symbol), + toString: d('', function () { return this.__name__; }) +}); + +defineProperties(Symbol.prototype, { + toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }), + valueOf: d(function () { return validateSymbol(this); }) +}); +defineProperty(Symbol.prototype, Symbol.toPrimitive, d('', + function () { return validateSymbol(this); })); +defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol')); + +defineProperty(HiddenSymbol.prototype, Symbol.toPrimitive, + d('c', Symbol.prototype[Symbol.toPrimitive])); +defineProperty(HiddenSymbol.prototype, Symbol.toStringTag, + d('c', Symbol.prototype[Symbol.toStringTag])); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/implement.js new file mode 100644 index 00000000..eb35c301 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/implement.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof Symbol, 'function'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/index.js new file mode 100644 index 00000000..62b3296d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var d = require('d') + + , defineProperty = Object.defineProperty; + +module.exports = function (T, a) { + var symbol = T('test'), x = {}; + defineProperty(x, symbol, d('foo')); + a(x.test, undefined, "Name"); + a(x[symbol], 'foo', "Get"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/is-implemented.js new file mode 100644 index 00000000..bb0d6453 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/is-implemented.js @@ -0,0 +1,14 @@ +'use strict'; + +var global = require('es5-ext/global') + , polyfill = require('../polyfill'); + +module.exports = function (t, a) { + var cache; + a(typeof t(), 'boolean'); + cache = global.Symbol; + global.Symbol = polyfill; + a(t(), true); + if (cache === undefined) delete global.Symbol; + else global.Symbol = cache; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/is-native-implemented.js new file mode 100644 index 00000000..df8ba032 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/is-native-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t, 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/is-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/is-symbol.js new file mode 100644 index 00000000..ac24b9ab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/is-symbol.js @@ -0,0 +1,16 @@ +'use strict'; + +var SymbolPoly = require('../polyfill'); + +module.exports = function (t, a) { + a(t(undefined), false, "Undefined"); + a(t(null), false, "Null"); + a(t(true), false, "Primitive"); + a(t('raz'), false, "String"); + a(t({}), false, "Object"); + a(t([]), false, "Array"); + if (typeof Symbol !== 'undefined') { + a(t(Symbol()), true, "Native"); + } + a(t(SymbolPoly()), true, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/polyfill.js new file mode 100644 index 00000000..83fb5e92 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/polyfill.js @@ -0,0 +1,27 @@ +'use strict'; + +var d = require('d') + , isSymbol = require('../is-symbol') + + , defineProperty = Object.defineProperty; + +module.exports = function (T, a) { + var symbol = T('test'), x = {}; + defineProperty(x, symbol, d('foo')); + a(x.test, undefined, "Name"); + a(x[symbol], 'foo', "Get"); + a(x instanceof T, false); + + a(isSymbol(symbol), true, "Symbol"); + a(isSymbol(T.iterator), true, "iterator"); + a(isSymbol(T.toStringTag), true, "toStringTag"); + + x = {}; + x[symbol] = 'foo'; + a.deep(Object.getOwnPropertyDescriptor(x, symbol), { configurable: true, enumerable: false, + value: 'foo', writable: true }); + symbol = T.for('marko'); + a(isSymbol(symbol), true); + a(T.for('marko'), symbol); + a(T.keyFor(symbol), 'marko'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/validate-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/validate-symbol.js new file mode 100644 index 00000000..2c8f84c8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/test/validate-symbol.js @@ -0,0 +1,19 @@ +'use strict'; + +var SymbolPoly = require('../polyfill'); + +module.exports = function (t, a) { + var symbol; + a.throws(function () { t(undefined); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.throws(function () { t(true); }, TypeError, "Primitive"); + a.throws(function () { t('raz'); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Object"); + a.throws(function () { t([]); }, TypeError, "Array"); + if (typeof Symbol !== 'undefined') { + symbol = Symbol(); + a(t(symbol), symbol, "Native"); + } + symbol = SymbolPoly(); + a(t(symbol), symbol, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/validate-symbol.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/validate-symbol.js new file mode 100644 index 00000000..42750043 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es6-symbol/validate-symbol.js @@ -0,0 +1,8 @@ +'use strict'; + +var isSymbol = require('./is-symbol'); + +module.exports = function (value) { + if (!isSymbol(value)) throw new TypeError(value + " is not a symbol"); + return value; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/package.json new file mode 100644 index 00000000..07973dfa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/package.json @@ -0,0 +1,64 @@ +{ + "name": "es6-weak-map", + "version": "0.1.4", + "description": "ECMAScript6 WeakMap polyfill", + "author": { + "name": "Mariusz Nowak", + "email": "medyk@medikoo.com", + "url": "http://www.medikoo.com/" + }, + "keywords": [ + "map", + "weakmap", + "collection", + "es6", + "harmony", + "list", + "hash", + "gc" + ], + "repository": { + "type": "git", + "url": "git://github.com/medikoo/es6-weak-map.git" + }, + "dependencies": { + "d": "~0.1.1", + "es5-ext": "~0.10.6", + "es6-iterator": "~0.1.3", + "es6-symbol": "~2.0.1" + }, + "devDependencies": { + "tad": "~0.2.2" + }, + "scripts": { + "test": "node ./node_modules/tad/bin/tad" + }, + "license": "MIT", + "gitHead": "e68802395b82a700257374c379cfaafe84ee8552", + "bugs": { + "url": "https://github.com/medikoo/es6-weak-map/issues" + }, + "homepage": "https://github.com/medikoo/es6-weak-map", + "_id": "es6-weak-map@0.1.4", + "_shasum": "706cef9e99aa236ba7766c239c8b9e286ea7d228", + "_from": "es6-weak-map@>=0.1.2 <0.2.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + }, + "maintainers": [ + { + "name": "medikoo", + "email": "medikoo+npm@medikoo.com" + } + ], + "dist": { + "shasum": "706cef9e99aa236ba7766c239c8b9e286ea7d228", + "tarball": "http://registry.npmjs.org/es6-weak-map/-/es6-weak-map-0.1.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-0.1.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/polyfill.js new file mode 100644 index 00000000..1d15660a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/polyfill.js @@ -0,0 +1,75 @@ +'use strict'; + +var setPrototypeOf = require('es5-ext/object/set-prototype-of') + , object = require('es5-ext/object/valid-object') + , value = require('es5-ext/object/valid-value') + , d = require('d') + , getIterator = require('es6-iterator/get') + , forOf = require('es6-iterator/for-of') + , toStringTagSymbol = require('es6-symbol').toStringTag + , isNative = require('./is-native-implemented') + + , isArray = Array.isArray, defineProperty = Object.defineProperty, random = Math.random + , hasOwnProperty = Object.prototype.hasOwnProperty + , genId, WeakMapPoly; + +genId = (function () { + var generated = Object.create(null); + return function () { + var id; + do { id = random().toString(36).slice(2); } while (generated[id]); + generated[id] = true; + return id; + }; +}()); + +module.exports = WeakMapPoly = function (/*iterable*/) { + var iterable = arguments[0]; + if (!(this instanceof WeakMapPoly)) return new WeakMapPoly(iterable); + if (this.__weakMapData__ !== undefined) { + throw new TypeError(this + " cannot be reinitialized"); + } + if (iterable != null) { + if (!isArray(iterable)) iterable = getIterator(iterable); + } + defineProperty(this, '__weakMapData__', d('c', '$weakMap$' + genId())); + if (!iterable) return; + forOf(iterable, function (val) { + value(val); + this.set(val[0], val[1]); + }, this); +}; + +if (isNative) { + if (setPrototypeOf) setPrototypeOf(WeakMapPoly, WeakMap); + WeakMapPoly.prototype = Object.create(WeakMap.prototype, { + constructor: d(WeakMapPoly) + }); +} + +Object.defineProperties(WeakMapPoly.prototype, { + clear: d(function () { + defineProperty(this, '__weakMapData__', d('c', '$weakMap$' + genId())); + }), + delete: d(function (key) { + if (hasOwnProperty.call(object(key), this.__weakMapData__)) { + delete key[this.__weakMapData__]; + return true; + } + return false; + }), + get: d(function (key) { + if (hasOwnProperty.call(object(key), this.__weakMapData__)) { + return key[this.__weakMapData__]; + } + }), + has: d(function (key) { + return hasOwnProperty.call(object(key), this.__weakMapData__); + }), + set: d(function (key, value) { + defineProperty(object(key), this.__weakMapData__, d('c', value)); + return this; + }), + toString: d(function () { return '[object WeakMap]'; }) +}); +defineProperty(WeakMapPoly.prototype, toStringTagSymbol, d('c', 'WeakMap')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/implement.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/implement.js new file mode 100644 index 00000000..860027ed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/implement.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof WeakMap, 'function'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/index.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/index.js new file mode 100644 index 00000000..9b26e4fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/index.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function (T, a) { + var x = {}; + a((new T([[x, 'foo']])).get(x), 'foo'); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/is-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/is-implemented.js new file mode 100644 index 00000000..1a883288 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/is-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t(), 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/is-native-implemented.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/is-native-implemented.js new file mode 100644 index 00000000..df8ba032 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/is-native-implemented.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = function (t, a) { a(typeof t, 'boolean'); }; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/is-weak-map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/is-weak-map.js new file mode 100644 index 00000000..ba8c0451 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/is-weak-map.js @@ -0,0 +1,16 @@ +'use strict'; + +var WeakMapPoly = require('../polyfill'); + +module.exports = function (t, a) { + a(t(undefined), false, "Undefined"); + a(t(null), false, "Null"); + a(t(true), false, "Primitive"); + a(t('raz'), false, "String"); + a(t({}), false, "Object"); + a(t([]), false, "Array"); + if (typeof WeakMap !== 'undefined') { + a(t(new WeakMap()), true, "Native"); + } + a(t(new WeakMapPoly()), true, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/polyfill.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/polyfill.js new file mode 100644 index 00000000..1a4885be --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/polyfill.js @@ -0,0 +1,22 @@ +'use strict'; + +module.exports = function (T, a) { + var x = {}, y = {}, z = {}, arr = [[x, 'raz'], [y, 'dwa']], map = new T(arr); + + a(map instanceof T, true, "WeakMap"); + a(map.has(x), true, "Has: true"); + a(map.get(x), 'raz', "Get: contains"); + a(map.has(z), false, "Has: false"); + a(map.get(z), undefined, "Get: doesn't contain"); + a(map.set(z, 'trzy'), map, "Set: return"); + a(map.has(z), true, "Add"); + a(map.delete({}), false, "Delete: false"); + + a(map.delete(x), true, "Delete: true"); + a(map.get(x), undefined, "Get: after delete"); + a(map.has(x), false, "Has: after delete"); + + a(map.has(y), true, "Has: pre clear"); + map.clear(); + a(map.has(y), false, "Has: after clear"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/valid-weak-map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/valid-weak-map.js new file mode 100644 index 00000000..a7823421 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/test/valid-weak-map.js @@ -0,0 +1,19 @@ +'use strict'; + +var WeakMapPoly = require('../polyfill'); + +module.exports = function (t, a) { + var map; + a.throws(function () { t(undefined); }, TypeError, "Undefined"); + a.throws(function () { t(null); }, TypeError, "Null"); + a.throws(function () { t(true); }, TypeError, "Primitive"); + a.throws(function () { t('raz'); }, TypeError, "String"); + a.throws(function () { t({}); }, TypeError, "Object"); + a.throws(function () { t([]); }, TypeError, "Array"); + if (typeof WeakMap !== 'undefined') { + map = new WeakMap(); + a(t(map), map, "Native"); + } + map = new WeakMapPoly(); + a(t(map), map, "Polyfill"); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/valid-weak-map.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/valid-weak-map.js new file mode 100644 index 00000000..bfb579fe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/es6-weak-map/valid-weak-map.js @@ -0,0 +1,8 @@ +'use strict'; + +var isWeakMap = require('./is-weak-map'); + +module.exports = function (x) { + if (!isWeakMap(x)) throw new TypeError(x + " is not a WeakMap"); + return x; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/README.md new file mode 100644 index 00000000..524177a7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/README.md @@ -0,0 +1,86 @@ +### Esrecurse [![Build Status](https://secure.travis-ci.org/estools/esrecurse.png)](http://travis-ci.org/estools/esrecurse) + +Esrecurse ([esrecurse](http://github.com/estools/esrecurse)) is +[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +recursive traversing functionality. + +### Example Usage + +The following code will output all variables declared at the root of a file. + +```javascript +esrecurse.visit(ast, { + XXXStatement: function (node) { + this.visit(node.left); + // do something... + this.visit(node.right); + } +}); +``` + +We can use `Visitor` instance. + +```javascript +var visitor = new esrecurse.Visitor({ + XXXStatement: function (node) { + this.visit(node.left); + // do something... + this.visit(node.right); + } +}); + +visitor.visit(ast); +``` + +We can inherit `Visitor` instance easily. + +```javascript +function DerivedVisitor() { + esrecurse.Visitor.call(/* this for constructor */ this, /* visitor object. */ this); +} +util.inherits(DerivedVisitor, esrecurse.Visitor); +DerivedVisitor.prototype.XXXStatement = function (node) { + this.visit(node.left); + // do something... + this.visit(node.right); +}; +``` + +And you can invoke default visiting operation inside custom visit operation. + +```javascript +function DerivedVisitor() { + esrecurse.Visitor.call(/* this for constructor */ this, /* visitor object. */ this); +} +util.inherits(DerivedVisitor, esrecurse.Visitor); +DerivedVisitor.prototype.XXXStatement = function (node) { + // do something... + this.visitChildren(node); +}; +``` + +### License + +Copyright (C) 2014 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js new file mode 100644 index 00000000..721f8e5c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js @@ -0,0 +1,122 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +(function () { + 'use strict'; + + var estraverse, + isArray, + objectKeys; + + estraverse = require('estraverse'); + + isArray = Array.isArray; + if (!isArray) { + isArray = function isArray(array) { + return Object.prototype.toString.call(array) === '[object Array]'; + }; + } + + objectKeys = Object.keys || function (o) { + var keys = [], key; + for (key in o) { + keys.push(key); + } + return keys; + }; + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties'; + } + + function Visitor(visitor) { + this.__visitor = visitor; + } + + /* Default method for visiting children. + * When you need to call default visiting operation inside custom visiting + * operation, you can use it with `this.visitChildren(node)`. + */ + Visitor.prototype.visitChildren = function (node) { + var type, children, i, iz, j, jz, child; + + if (node == null) { + return; + } + + type = node.type || estraverse.Syntax.Property; + + children = estraverse.VisitorKeys[type]; + if (!children) { + children = objectKeys(node); + } + + for (i = 0, iz = children.length; i < iz; ++i) { + child = node[children[i]]; + if (child) { + if (Array.isArray(child)) { + for (j = 0, jz = child.length; j < jz; ++j) { + if (child[j]) { + if (isNode(child[j]) || isProperty(type, children[i])) { + this.visit(child[j]); + } + } + } + } else if (isNode(child)) { + this.visit(child); + } + } + } + }; + + /* Dispatching node. */ + Visitor.prototype.visit = function (node) { + var type; + + if (node == null) { + return; + } + + type = node.type || estraverse.Syntax.Property; + if (this.__visitor[type]) { + this.__visitor[type].call(this, node); + return; + } + this.visitChildren(node); + }; + + exports.version = require('./package.json').version; + exports.Visitor = Visitor; + exports.visit = function (node, visitor) { + var v = new Visitor(visitor); + v.visit(node); + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/gulpfile.coffee b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/gulpfile.coffee new file mode 100644 index 00000000..3837cb22 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/gulpfile.coffee @@ -0,0 +1,61 @@ +# Copyright (C) 2014 Yusuke Suzuki +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +gulp = require 'gulp' +mocha = require 'gulp-mocha' +eslint = require 'gulp-eslint' +minimist = require 'minimist' +require 'coffee-script/register' + +SOURCE = [ + '*.js' +] + +ESLINT_OPTION = + rules: + 'quotes': 0 + 'eqeqeq': 0 + 'no-use-before-define': 0 + 'no-shadow': 0 + 'no-new': 0 + 'no-underscore-dangle': 0 + 'no-multi-spaces': false + 'no-native-reassign': 0 + 'no-loop-func': 0 + env: + 'node': true + +gulp.task 'test', -> + options = minimist process.argv.slice(2), + string: 'test', + default: + test: 'test/*.coffee' + return gulp.src(options.test).pipe(mocha reporter: 'spec') + +gulp.task 'lint', -> + return gulp.src(SOURCE) + .pipe(eslint(ESLINT_OPTION)) + .pipe(eslint.formatEach('stylish', process.stderr)) + .pipe(eslint.failOnError()) + +gulp.task 'travis', [ 'lint', 'test' ] +gulp.task 'default', [ 'travis' ] diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/package.json new file mode 100644 index 00000000..c4f6cf0d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/esrecurse/package.json @@ -0,0 +1,63 @@ +{ + "name": "esrecurse", + "description": "ECMAScript scope analyzer", + "homepage": "http://github.com/estools/esrecurse", + "main": "esrecurse.js", + "version": "1.2.0", + "engines": { + "node": ">=0.10.0" + }, + "maintainers": [ + { + "name": "constellation", + "email": "utatane.tea@gmail.com" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/estools/esrecurse.git" + }, + "dependencies": { + "estraverse": ">=1.9.0" + }, + "devDependencies": { + "chai": "~1.10.0", + "coffee-script": "~1.8.0", + "esprima": "~1.2.2", + "gulp": "~3.8.10", + "gulp-eslint": "^0.2.0", + "gulp-mocha": "~2.0.0", + "jsdoc": "~3.3.0-alpha10", + "minimist": "^1.1.0" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/estools/esrecurse/raw/master/LICENSE.BSD" + } + ], + "scripts": { + "test": "gulp travis", + "unit-test": "gulp test", + "lint": "gulp lint" + }, + "gitHead": "9b363cee6d6b6b29b5236f4b98066ba0735fe9e4", + "bugs": { + "url": "https://github.com/estools/esrecurse/issues" + }, + "_id": "esrecurse@1.2.0", + "_shasum": "25e3b3ab76ad8a1da2d38e9393fd76b8456a706f", + "_from": "esrecurse@>=1.2.0 <2.0.0", + "_npmVersion": "2.0.0-alpha-5", + "_npmUser": { + "name": "constellation", + "email": "utatane.tea@gmail.com" + }, + "dist": { + "shasum": "25e3b3ab76ad8a1da2d38e9393fd76b8456a706f", + "tarball": "http://registry.npmjs.org/esrecurse/-/esrecurse-1.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-1.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/README.md b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/README.md new file mode 100644 index 00000000..be03922a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/README.md @@ -0,0 +1,13 @@ +# util-extend + +The Node object extending function that Node uses for Node! + +## Usage + +```js +var extend = require('util-extend'); +function functionThatTakesOptions(options) { + var options = extend(defaults, options); + // now any unset options are set to the defaults. +} +``` diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/extend.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/extend.js new file mode 100644 index 00000000..de9fcf47 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/extend.js @@ -0,0 +1,33 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +module.exports = extend; +function extend(origin, add) { + // Don't do anything if add isn't an object + if (!add || typeof add !== 'object') return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/package.json new file mode 100644 index 00000000..942b7860 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/package.json @@ -0,0 +1,41 @@ +{ + "name": "util-extend", + "version": "1.0.1", + "description": "Node's internal object extension function", + "main": "extend.js", + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/util-extend" + }, + "author": "", + "license": "MIT", + "readmeFilename": "README.md", + "readme": "# util-extend\n\nThe Node object extending function that Node uses for Node!\n\n## Usage\n\n```js\nvar extend = require('util-extend');\nfunction functionThatTakesOptions(options) {\n var options = extend(defaults, options);\n // now any unset options are set to the defaults.\n}\n```\n", + "bugs": { + "url": "https://github.com/isaacs/util-extend/issues" + }, + "_id": "util-extend@1.0.1", + "dist": { + "shasum": "bb703b79480293ddcdcfb3c6a9fea20f483415bc", + "tarball": "http://registry.npmjs.org/util-extend/-/util-extend-1.0.1.tgz" + }, + "_from": "util-extend@>=1.0.1 <2.0.0", + "_npmVersion": "1.3.4", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "bb703b79480293ddcdcfb3c6a9fea20f483415bc", + "_resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.1.tgz", + "homepage": "https://github.com/isaacs/util-extend" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/test.js b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/test.js new file mode 100644 index 00000000..fbee2b1e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/node_modules/util-extend/test.js @@ -0,0 +1,10 @@ +var assert = require('assert'); +var extend = require('./'); +assert.deepEqual(extend({a:1}), {a:1}); +assert.deepEqual(extend({a:1}, []), {a:1}); +assert.deepEqual(extend({a:1}, null), {a:1}); +assert.deepEqual(extend({a:1}, true), {a:1}); +assert.deepEqual(extend({a:1}, false), {a:1}); +assert.deepEqual(extend({a:1}, {b:2}), {a:1, b:2}); +assert.deepEqual(extend({a:1, b:2}, {b:3}), {a:1, b:3}); +console.log('ok'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/escope/package.json b/node_modules/standard/node_modules/eslint/node_modules/escope/package.json new file mode 100644 index 00000000..8a869923 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/escope/package.json @@ -0,0 +1,70 @@ +{ + "name": "escope", + "description": "ECMAScript scope analyzer", + "homepage": "http://github.com/estools/escope.html", + "main": "escope.js", + "version": "2.0.6", + "engines": { + "node": ">=0.4.0" + }, + "maintainers": [ + { + "name": "constellation", + "email": "utatane.tea@gmail.com" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/estools/escope.git" + }, + "dependencies": { + "es6-map": "^0.1.1", + "es6-weak-map": "^0.1.2", + "esrecurse": "^1.2.0", + "estraverse": ">=1.9.0", + "util-extend": "^1.0.1" + }, + "devDependencies": { + "browserify": "^7.0.0", + "chai": "~1.10.0", + "coffee-script": "~1.8.0", + "esprima": "~1.2.2", + "gulp": "~3.8.10", + "gulp-eslint": "^0.2.0", + "gulp-mocha": "~2.0.0", + "jsdoc": "~3.3.0-alpha10", + "minimist": "^1.1.0", + "vinyl-source-stream": "^1.0.0" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/estools/escope/raw/master/LICENSE.BSD" + } + ], + "scripts": { + "test": "gulp travis", + "unit-test": "gulp test", + "lint": "gulp lint", + "jsdoc": "jsdoc escope.js README.md" + }, + "gitHead": "dc4b85631e98011268fc426dd824c74e353d5b48", + "bugs": { + "url": "https://github.com/estools/escope/issues" + }, + "_id": "escope@2.0.6", + "_shasum": "c1bac24870605bb384ba073dce0417c9305eddeb", + "_from": "escope@2.0.6", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "constellation", + "email": "utatane.tea@gmail.com" + }, + "dist": { + "shasum": "c1bac24870605bb384ba073dce0417c9305eddeb", + "tarball": "http://registry.npmjs.org/escope/-/escope-2.0.6.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/escope/-/escope-2.0.6.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/README.md b/node_modules/standard/node_modules/eslint/node_modules/espree/README.md new file mode 100644 index 00000000..a46001c9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/README.md @@ -0,0 +1,221 @@ +# Espree + +Espree is an actively-maintained fork Esprima, a high performance, +standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +parser written in ECMAScript (also popularly known as +[JavaScript](http://en.wikipedia.org/wiki/JavaScript)). + +## Features + +- Full support for ECMAScript 5.1 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm)) +- Sensible syntax tree format compatible with Mozilla +[Parser AST](https://developer.mozilla.org/en/SpiderMonkey/Parser_API) +- Optional tracking of syntax node location (index-based and line-column) +- Heavily tested (> 650 unit tests) with full code coverage + +## Usage + +Install: + +``` +npm i espree --save +``` + +And in your Node.js code: + +```javascript +var espree = require("espree"); + +var ast = espree.parse(code); +``` + +There is a second argument to `parse()` that allows you to specify various options: + +```javascript +var espree = require("espree"); + +var ast = espree.parse(code, { + + // attach range information to each node + range: true, + + // attach line/column location information to each node + loc: true, + + // create a top-level comments array containing all comments + comments: true, + + // attach comments to the closest relevant node as leadingComments and + // trailingComments + attachComment: true, + + // create a top-level tokens array containing all tokens + tokens: true, + + // try to continue parsing if an error is encountered, store errors in a + // top-level errors array + tolerant: true, + + // specify parsing features (default only has blockBindings: true) + ecmaFeatures: { + + // enable parsing of arrow functions + arrowFunctions: true, + + // enable parsing of let/const + blockBindings: true, + + // enable parsing of destructured arrays and objects + destructuring: true, + + // enable parsing of regular expression y flag + regexYFlag: true, + + // enable parsing of regular expression u flag + regexUFlag: true, + + // enable parsing of template strings + templateStrings: true, + + // enable parsing of binary literals + binaryLiterals: true, + + // enable parsing of ES6 octal literals + octalLiterals: true, + + // enable parsing unicode code point escape sequences + unicodeCodePointEscapes: true, + + // enable parsing of default parameters + defaultParams: true, + + // enable parsing of rest parameters + restParams: true, + + // enable parsing of for-of statement + forOf: true, + + // enable parsing computed object literal properties + objectLiteralComputedProperties: true, + + // enable parsing of shorthand object literal methods + objectLiteralShorthandMethods: true, + + // enable parsing of shorthand object literal properties + objectLiteralShorthandProperties: true, + + // Allow duplicate object literal properties (except '__proto__') + objectLiteralDuplicateProperties: true, + + // enable parsing of generators/yield + generators: true, + + // enable parsing spread operator + spread: true, + + // enable parsing classes + classes: true, + + // enable parsing of modules + modules: true, + + // enable React JSX parsing + jsx: true, + + // enable return in global scope + globalReturn: true + } +}); +``` + +## Plans + +Espree starts as a fork of Esprima v1.2.2, the last stable published released of Esprima before work on ECMAScript 6 began. Espree's first version is therefore v1.2.2 and is 100% compatible with Esprima v1.2.2 as a drop-in replacement. The version number will be incremented based on [semantic versioning](http://semver.org/) as features and bug fixes are added. + +The immediate plans are: + +1. Move away from giant files and move towards small, modular files that are easier to manage. +1. Move towards CommonJS for all files and use browserify to create browser bundles. +1. Support ECMAScript version filtering, allowing users to specify which version the parser should work in (similar to Acorn's `ecmaVersion` property). +1. Add tests to track comment attachment. +1. Add well-thought-out features that are useful for tools developers. +1. Add full support for ECMAScript 6. +1. Add optional parsing of JSX. + +## Esprima Compatibility Going Forward + +The primary goal is to produce the exact same AST structure as Esprima and Acorn, and that takes precedence over anything else. (The AST structure being the SpiderMonkey Parser API with JSX extensions.) Separate from that, Espree may deviate from what Esprima outputs in terms of where and how comments are attached, as well as what additional information is available on AST nodes. That is to say, Espree may add more things to the AST nodes than Esprima does but the overall AST structure produced will be the same. + +Espree may also deviate from Esprima in the interface it exposes. + +## Frequent and Incremental Releases + +Espree will not do giant releases. Releases will happen periodically as changes are made and incremental releases will be made towards larger goals. For instance, we will not have one big release for ECMAScript 6 support. Instead, we will implement ECMAScript 6, piece-by-piece, hiding those pieces behind an `ecmaFeatures` property that allows you to opt-in to use those features. + +## Contributing + +Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing.html), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/espree/issues). + +Espree is licensed under a permissive BSD 3-clause license. + +## Build Commands + +* `npm test` - run all linting and tests +* `npm run lint` - run all linting +* `npm run browserify` - creates a version of Espree that is usable in a browser + +## Known Incompatibilities + +In an effort to help those wanting to transition from other parsers to Espree, the following is a list of noteworthy incompatibilities with other parsers. These are known differences that we do not intend to change. + +### Esprima 1.2.2 + +* None. + +### Esprima/Harmony Branch + +* Esprima/Harmony uses a different comment attachment algorithm that results in some comments being added in different places than Espree. The algorithm Espree uses is the same one used in Esprima 1.2.2. +* Template tokens have a `head` property in addition to `tail`. Esprima has only `tail`. + +### Esprima-FB + +* All Esprima/Harmony incompatibilities. + +## Frequently Asked Questions + +### Why are you forking Esprima? + +[ESLint](http://eslint.org) has been relying on Esprima as its parser from the beginning. While that was fine when the JavaScript language was evolving slowly, the pace of development has increased dramatically and Esprima has fallen behind. ESLint, like many other tools reliant on Esprima, has been stuck in using new JavaScript language features until Esprima updates, and that has caused our users frustration. + +We decided the only way for us to move forward was to create our own parser, bringing us inline with JSHint and JSLint, and allowing us to keep implementing new features as we need them. We chose to fork Esprima instead of starting from scratch in order to move as quickly as possible with a compatible API. + +### Have you tried working with Esprima? + +Yes. Since the start of ESLint, we've regularly filed bugs and feature requests with Esprima. Unfortunately, we've been unable to make much progress towards getting our needs addressed. + +### Why don't you just use Facebook's Esprima fork? + +`esprima-fb` is Facebook's Esprima fork that features JSX and Flow type annotations. We tried working with `esprima-fb` in our evaluation of how to support ECMAScript 6 and JSX in ESLint. Unfortunately, we were hampered by bugs that were part of Esprima (not necessarily Facebook's code). Since `esprima-fb` tracks the Esprima Harmony branch, that means we still were unable to get fixes or features we needed in a timely manner. + +### Why don't you just use Acorn? + +Acorn is a great JavaScript parser that produces an AST that is compatible with Esprima. Unfortunately, ESLint relies on more than just the AST to do its job. It relies on Esprima's tokens and comment attachment features to get a complete picture of the source code. We investigated switching to Acorn, but the inconsistencies between Esprima and Acorn created too much work for a project like ESLint. + +We expect there are other tools like ESLint that rely on more than just the AST produced by Esprima, and so a drop-in replacement will help those projects as well as ESLint. + +### What ECMAScript 6 features do you support? + +Please see the [tracking issue](https://github.com/eslint/espree/issues/10) for the most up-to-date information. + +### Why use Espree instead of Esprima? + +* Faster turnaround time on bug fixes +* More frequent releases +* Better communication and responsiveness to issues +* Ongoing development + +### Why use Espree instead of Esprima-FB? + +* Opt-in to just the ECMAScript 6 features you want +* JSX support is off by default, so you're not forced to use it to use ECMAScript 6 +* Stricter ECMAScript 6 support diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/bin/esparse.js b/node_modules/standard/node_modules/eslint/node_modules/espree/bin/esparse.js new file mode 100755 index 00000000..4a9984aa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/bin/esparse.js @@ -0,0 +1,127 @@ +#!/usr/bin/env node +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint sloppy:true node:true rhino:true */ + +var fs, espree, fname, content, options, syntax; + +if (typeof require === 'function') { + fs = require('fs'); + espree = require('espree'); +} else if (typeof load === 'function') { + try { + load('espree.js'); + } catch (e) { + load('../espree.js'); + } +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { argv: arguments, exit: quit }; + process.argv.unshift('esparse.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esparse [options] file.js'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --comment Gather all line and block comments in an array'); + console.log(' --loc Include line-column location info for each syntax node'); + console.log(' --range Include index-based range for each syntax node'); + console.log(' --raw Display the raw value of literals'); + console.log(' --tokens List all tokens in an array'); + console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)'); + console.log(' -v, --version Shows program version'); + console.log(); + process.exit(1); +} + +if (process.argv.length <= 2) { + showUsage(); +} + +options = {}; + +process.argv.splice(2).forEach(function (entry) { + + if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Parser (using espree version', espree.version, ')'); + console.log(); + process.exit(0); + } else if (entry === '--comment') { + options.comment = true; + } else if (entry === '--loc') { + options.loc = true; + } else if (entry === '--range') { + options.range = true; + } else if (entry === '--raw') { + options.raw = true; + } else if (entry === '--tokens') { + options.tokens = true; + } else if (entry === '--tolerant') { + options.tolerant = true; + } else if (entry.slice(0, 2) === '--') { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } else if (typeof fname === 'string') { + console.log('Error: more than one input file.'); + process.exit(1); + } else { + fname = entry; + } +}); + +if (typeof fname !== 'string') { + console.log('Error: no input file.'); + process.exit(1); +} + +// Special handling for regular expression literal since we need to +// convert it to a string literal, otherwise it will be decoded +// as object "{}" and the regular expression would be lost. +function adjustRegexLiteral(key, value) { + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } + return value; +} + +try { + content = fs.readFileSync(fname, 'utf-8'); + syntax = espree.parse(content, options); + console.log(JSON.stringify(syntax, adjustRegexLiteral, 4)); +} catch (e) { + console.log('Error: ' + e.message); + process.exit(1); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/bin/esvalidate.js b/node_modules/standard/node_modules/eslint/node_modules/espree/bin/esvalidate.js new file mode 100755 index 00000000..7631d0a2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/bin/esvalidate.js @@ -0,0 +1,199 @@ +#!/usr/bin/env node +/* + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint sloppy:true plusplus:true node:true rhino:true */ +/*global phantom:true */ + +var fs, system, espree, options, fnames, count; + +if (typeof espree === 'undefined') { + // PhantomJS can only require() relative files + if (typeof phantom === 'object') { + fs = require('fs'); + system = require('system'); + espree = require('./espree'); + } else if (typeof require === 'function') { + fs = require('fs'); + espree = require('espree'); + } else if (typeof load === 'function') { + try { + load('espree.js'); + } catch (e) { + load('../espree.js'); + } + } +} + +// Shims to Node.js objects when running under PhantomJS 1.7+. +if (typeof phantom === 'object') { + fs.readFileSync = fs.read; + process = { + argv: [].slice.call(system.args), + exit: phantom.exit + }; + process.argv.unshift('phantomjs'); +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { argv: arguments, exit: quit }; + process.argv.unshift('esvalidate.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esvalidate [options] file.js'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --format=type Set the report format, plain (default) or junit'); + console.log(' -v, --version Print program version'); + console.log(); + process.exit(1); +} + +if (process.argv.length <= 2) { + showUsage(); +} + +options = { + format: 'plain' +}; + +fnames = []; + +process.argv.splice(2).forEach(function (entry) { + + if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Validator (using espree version', espree.version, ')'); + console.log(); + process.exit(0); + } else if (entry.slice(0, 9) === '--format=') { + options.format = entry.slice(9); + if (options.format !== 'plain' && options.format !== 'junit') { + console.log('Error: unknown report format ' + options.format + '.'); + process.exit(1); + } + } else if (entry.slice(0, 2) === '--') { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } else { + fnames.push(entry); + } +}); + +if (fnames.length === 0) { + console.log('Error: no input file.'); + process.exit(1); +} + +if (options.format === 'junit') { + console.log(''); + console.log(''); +} + +count = 0; +fnames.forEach(function (fname) { + var content, timestamp, syntax, name; + try { + content = fs.readFileSync(fname, 'utf-8'); + + if (content[0] === '#' && content[1] === '!') { + content = '//' + content.substr(2, content.length); + } + + timestamp = Date.now(); + syntax = espree.parse(content, { tolerant: true }); + + if (options.format === 'junit') { + + name = fname; + if (name.lastIndexOf('/') >= 0) { + name = name.slice(name.lastIndexOf('/') + 1); + } + + console.log(''); + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + console.log(' '); + console.log(' ' + + error.message + '(' + name + ':' + error.lineNumber + ')' + + ''); + console.log(' '); + }); + + console.log(''); + + } else if (options.format === 'plain') { + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + msg = fname + ':' + error.lineNumber + ': ' + msg; + console.log(msg); + ++count; + }); + + } + } catch (e) { + ++count; + if (options.format === 'junit') { + console.log(''); + console.log(' '); + console.log(' ' + + e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') + + ')'); + console.log(' '); + console.log(''); + } else { + console.log('Error: ' + e.message); + } + } +}); + +if (options.format === 'junit') { + console.log(''); +} + +if (count > 0) { + process.exit(1); +} + +if (count === 0 && typeof phantom === 'object') { + process.exit(0); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/espree.js b/node_modules/standard/node_modules/eslint/node_modules/espree/espree.js new file mode 100644 index 00000000..44c222f7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/espree.js @@ -0,0 +1,5470 @@ +/* +Copyright (C) 2015 Fred K. Schott +Copyright (C) 2013 Ariya Hidayat +Copyright (C) 2013 Thaddee Tyl +Copyright (C) 2013 Mathias Bynens +Copyright (C) 2012 Ariya Hidayat +Copyright (C) 2012 Mathias Bynens +Copyright (C) 2012 Joost-Wim Boekesteijn +Copyright (C) 2012 Kris Kowal +Copyright (C) 2012 Yusuke Suzuki +Copyright (C) 2012 Arpad Borsos +Copyright (C) 2011 Ariya Hidayat + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*eslint no-undefined:0, no-use-before-define: 0*/ + +"use strict"; + +var syntax = require("./lib/syntax"), + tokenInfo = require("./lib/token-info"), + astNodeTypes = require("./lib/ast-node-types"), + astNodeFactory = require("./lib/ast-node-factory"), + defaultFeatures = require("./lib/features"), + Messages = require("./lib/messages"), + XHTMLEntities = require("./lib/xhtml-entities"), + StringMap = require("./lib/string-map"), + commentAttachment = require("./lib/comment-attachment"); + +var Token = tokenInfo.Token, + TokenName = tokenInfo.TokenName, + FnExprTokens = tokenInfo.FnExprTokens, + Regex = syntax.Regex, + PropertyKind, + source, + strict, + index, + lineNumber, + lineStart, + length, + lookahead, + state, + extra; + +PropertyKind = { + Data: 1, + Get: 2, + Set: 4 +}; + + +// Ensure the condition is true, otherwise throw an error. +// This is only to have a better contract semantic, i.e. another safety net +// to catch a logic error. The condition shall be fulfilled in normal case. +// Do NOT use this to enforce a certain condition on any user input. + +function assert(condition, message) { + /* istanbul ignore if */ + if (!condition) { + throw new Error("ASSERT: " + message); + } +} + +// 7.4 Comments + +function addComment(type, value, start, end, loc) { + var comment; + + assert(typeof start === "number", "Comment must have valid position"); + + // Because the way the actual token is scanned, often the comments + // (if any) are skipped twice during the lexical analysis. + // Thus, we need to skip adding a comment if the comment array already + // handled it. + if (state.lastCommentStart >= start) { + return; + } + state.lastCommentStart = start; + + comment = { + type: type, + value: value + }; + if (extra.range) { + comment.range = [start, end]; + } + if (extra.loc) { + comment.loc = loc; + } + extra.comments.push(comment); + + if (extra.attachComment) { + commentAttachment.addComment(comment); + } +} + +function skipSingleLineComment(offset) { + var start, loc, ch, comment; + + start = index - offset; + loc = { + start: { + line: lineNumber, + column: index - lineStart - offset + } + }; + + while (index < length) { + ch = source.charCodeAt(index); + ++index; + if (syntax.isLineTerminator(ch)) { + if (extra.comments) { + comment = source.slice(start + offset, index - 1); + loc.end = { + line: lineNumber, + column: index - lineStart - 1 + }; + addComment("Line", comment, start, index - 1, loc); + } + if (ch === 13 && source.charCodeAt(index) === 10) { + ++index; + } + ++lineNumber; + lineStart = index; + return; + } + } + + if (extra.comments) { + comment = source.slice(start + offset, index); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + addComment("Line", comment, start, index, loc); + } +} + +function skipMultiLineComment() { + var start, loc, ch, comment; + + if (extra.comments) { + start = index - 2; + loc = { + start: { + line: lineNumber, + column: index - lineStart - 2 + } + }; + } + + while (index < length) { + ch = source.charCodeAt(index); + if (syntax.isLineTerminator(ch)) { + if (ch === 0x0D && source.charCodeAt(index + 1) === 0x0A) { + ++index; + } + ++lineNumber; + ++index; + lineStart = index; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + } else if (ch === 0x2A) { + // Block comment ends with "*/". + if (source.charCodeAt(index + 1) === 0x2F) { + ++index; + ++index; + if (extra.comments) { + comment = source.slice(start + 2, index - 2); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + addComment("Block", comment, start, index, loc); + } + return; + } + ++index; + } else { + ++index; + } + } + + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); +} + +function skipComment() { + var ch, start; + + start = (index === 0); + while (index < length) { + ch = source.charCodeAt(index); + + if (syntax.isWhiteSpace(ch)) { + ++index; + } else if (syntax.isLineTerminator(ch)) { + ++index; + if (ch === 0x0D && source.charCodeAt(index) === 0x0A) { + ++index; + } + ++lineNumber; + lineStart = index; + start = true; + } else if (ch === 0x2F) { // U+002F is "/" + ch = source.charCodeAt(index + 1); + if (ch === 0x2F) { + ++index; + ++index; + skipSingleLineComment(2); + start = true; + } else if (ch === 0x2A) { // U+002A is "*" + ++index; + ++index; + skipMultiLineComment(); + } else { + break; + } + } else if (start && ch === 0x2D) { // U+002D is "-" + // U+003E is ">" + if ((source.charCodeAt(index + 1) === 0x2D) && (source.charCodeAt(index + 2) === 0x3E)) { + // "-->" is a single-line comment + index += 3; + skipSingleLineComment(3); + } else { + break; + } + } else if (ch === 0x3C) { // U+003C is "<" + if (source.slice(index + 1, index + 4) === "!--") { + ++index; // `<` + ++index; // `!` + ++index; // `-` + ++index; // `-` + skipSingleLineComment(4); + } else { + break; + } + } else { + break; + } + } +} + +function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === "u") ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && syntax.isHexDigit(source[index])) { + ch = source[index++]; + code = code * 16 + "0123456789abcdef".indexOf(ch.toLowerCase()); + } else { + return ""; + } + } + return String.fromCharCode(code); +} + +/** + * Scans an extended unicode code point escape sequence from source. Throws an + * error if the sequence is empty or if the code point value is too large. + * @returns {string} The string created by the Unicode escape sequence. + * @private + */ +function scanUnicodeCodePointEscape() { + var ch, code, cu1, cu2; + + ch = source[index]; + code = 0; + + // At least one hex digit is required. + if (ch === "}") { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + while (index < length) { + ch = source[index++]; + if (!syntax.isHexDigit(ch)) { + break; + } + code = code * 16 + "0123456789abcdef".indexOf(ch.toLowerCase()); + } + + if (code > 0x10FFFF || ch !== "}") { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + // UTF-16 Encoding + if (code <= 0xFFFF) { + return String.fromCharCode(code); + } + cu1 = ((code - 0x10000) >> 10) + 0xD800; + cu2 = ((code - 0x10000) & 1023) + 0xDC00; + return String.fromCharCode(cu1, cu2); +} + +function getEscapedIdentifier() { + var ch, id; + + ch = source.charCodeAt(index++); + id = String.fromCharCode(ch); + + // "\u" (U+005C, U+0075) denotes an escaped character. + if (ch === 0x5C) { + if (source.charCodeAt(index) !== 0x75) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + ++index; + ch = scanHexEscape("u"); + if (!ch || ch === "\\" || !syntax.isIdentifierStart(ch.charCodeAt(0))) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + id = ch; + } + + while (index < length) { + ch = source.charCodeAt(index); + if (!syntax.isIdentifierPart(ch)) { + break; + } + ++index; + id += String.fromCharCode(ch); + + // "\u" (U+005C, U+0075) denotes an escaped character. + if (ch === 0x5C) { + id = id.substr(0, id.length - 1); + if (source.charCodeAt(index) !== 0x75) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + ++index; + ch = scanHexEscape("u"); + if (!ch || ch === "\\" || !syntax.isIdentifierPart(ch.charCodeAt(0))) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + id += ch; + } + } + + return id; +} + +function getIdentifier() { + var start, ch; + + start = index++; + while (index < length) { + ch = source.charCodeAt(index); + if (ch === 0x5C) { + // Blackslash (U+005C) marks Unicode escape sequence. + index = start; + return getEscapedIdentifier(); + } + if (syntax.isIdentifierPart(ch)) { + ++index; + } else { + break; + } + } + + return source.slice(start, index); +} + +function scanIdentifier() { + var start, id, type; + + start = index; + + // Backslash (U+005C) starts an escaped character. + id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); + + // There is no keyword or literal with only one character. + // Thus, it must be an identifier. + if (id.length === 1) { + type = Token.Identifier; + } else if (syntax.isKeyword(id, strict, extra.ecmaFeatures)) { + type = Token.Keyword; + } else if (id === "null") { + type = Token.NullLiteral; + } else if (id === "true" || id === "false") { + type = Token.BooleanLiteral; + } else { + type = Token.Identifier; + } + + return { + type: type, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; +} + + +// 7.7 Punctuators + +function scanPunctuator() { + var start = index, + code = source.charCodeAt(index), + code2, + ch1 = source[index], + ch2, + ch3, + ch4; + + switch (code) { + // Check for most common single-character punctuators. + case 40: // ( open bracket + case 41: // ) close bracket + case 59: // ; semicolon + case 44: // , comma + case 91: // [ + case 93: // ] + case 58: // : + case 63: // ? + case 126: // ~ + ++index; + + if (extra.tokenize && code === 40) { + extra.openParenToken = extra.tokens.length; + } + + return { + type: Token.Punctuator, + value: String.fromCharCode(code), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + + case 123: // { open curly brace + case 125: // } close curly brace + ++index; + + if (extra.tokenize && code === 123) { + extra.openCurlyToken = extra.tokens.length; + } + + // lookahead2 function can cause tokens to be scanned twice and in doing so + // would wreck the curly stack by pushing the same token onto the stack twice. + // curlyLastIndex ensures each token is pushed or popped exactly once + if (index > state.curlyLastIndex) { + state.curlyLastIndex = index; + if (code === 123) { + state.curlyStack.push("{"); + } else { + state.curlyStack.pop(); + } + } + + return { + type: Token.Punctuator, + value: String.fromCharCode(code), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + + default: + code2 = source.charCodeAt(index + 1); + + // "=" (char #61) marks an assignment or comparison operator. + if (code2 === 61) { + switch (code) { + case 37: // % + case 38: // & + case 42: // *: + case 43: // + + case 45: // - + case 47: // / + case 60: // < + case 62: // > + case 94: // ^ + case 124: // | + index += 2; + return { + type: Token.Punctuator, + value: String.fromCharCode(code) + String.fromCharCode(code2), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + + case 33: // ! + case 61: // = + index += 2; + + // !== and === + if (source.charCodeAt(index) === 61) { + ++index; + } + return { + type: Token.Punctuator, + value: source.slice(start, index), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + default: + break; + } + } + break; + } + + // Peek more characters. + + ch2 = source[index + 1]; + ch3 = source[index + 2]; + ch4 = source[index + 3]; + + // 4-character punctuator: >>>= + + if (ch1 === ">" && ch2 === ">" && ch3 === ">") { + if (ch4 === "=") { + index += 4; + return { + type: Token.Punctuator, + value: ">>>=", + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // 3-character punctuators: === !== >>> <<= >>= + + if (ch1 === ">" && ch2 === ">" && ch3 === ">") { + index += 3; + return { + type: Token.Punctuator, + value: ">>>", + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === "<" && ch2 === "<" && ch3 === "=") { + index += 3; + return { + type: Token.Punctuator, + value: "<<=", + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === ">" && ch2 === ">" && ch3 === "=") { + index += 3; + return { + type: Token.Punctuator, + value: ">>=", + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // The ... operator (spread, restParams, JSX, etc.) + if (extra.ecmaFeatures.spread || + extra.ecmaFeatures.restParams || + (extra.ecmaFeatures.jsx && state.inJSXSpreadAttribute) + ) { + if (ch1 === "." && ch2 === "." && ch3 === ".") { + index += 3; + return { + type: Token.Punctuator, + value: "...", + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // Other 2-character punctuators: ++ -- << >> && || + if (ch1 === ch2 && ("+-<>&|".indexOf(ch1) >= 0)) { + index += 2; + return { + type: Token.Punctuator, + value: ch1 + ch2, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // the => for arrow functions + if (extra.ecmaFeatures.arrowFunctions) { + if (ch1 === "=" && ch2 === ">") { + index += 2; + return { + type: Token.Punctuator, + value: "=>", + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + if ("<>=!+-*%&|^/".indexOf(ch1) >= 0) { + ++index; + return { + type: Token.Punctuator, + value: ch1, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === ".") { + ++index; + return { + type: Token.Punctuator, + value: ch1, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); +} + +// 7.8.3 Numeric Literals + +function scanHexLiteral(start) { + var number = ""; + + while (index < length) { + if (!syntax.isHexDigit(source[index])) { + break; + } + number += source[index++]; + } + + if (number.length === 0) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + if (syntax.isIdentifierStart(source.charCodeAt(index))) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + return { + type: Token.NumericLiteral, + value: parseInt("0x" + number, 16), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; +} + +function scanBinaryLiteral(start) { + var ch, number = ""; + + while (index < length) { + ch = source[index]; + if (ch !== "0" && ch !== "1") { + break; + } + number += source[index++]; + } + + if (number.length === 0) { + // only 0b or 0B + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + + if (index < length) { + ch = source.charCodeAt(index); + /* istanbul ignore else */ + if (syntax.isIdentifierStart(ch) || syntax.isDecimalDigit(ch)) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + } + + return { + type: Token.NumericLiteral, + value: parseInt(number, 2), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; +} + +function scanOctalLiteral(prefix, start) { + var number, octal; + + if (syntax.isOctalDigit(prefix)) { + octal = true; + number = "0" + source[index++]; + } else { + octal = false; + ++index; + number = ""; + } + + while (index < length) { + if (!syntax.isOctalDigit(source[index])) { + break; + } + number += source[index++]; + } + + if (!octal && number.length === 0) { + // only 0o or 0O + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + if (syntax.isIdentifierStart(source.charCodeAt(index)) || syntax.isDecimalDigit(source.charCodeAt(index))) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + return { + type: Token.NumericLiteral, + value: parseInt(number, 8), + octal: octal, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; +} + +function scanNumericLiteral() { + var number, start, ch; + + ch = source[index]; + assert(syntax.isDecimalDigit(ch.charCodeAt(0)) || (ch === "."), + "Numeric literal must start with a decimal digit or a decimal point"); + + start = index; + number = ""; + if (ch !== ".") { + number = source[index++]; + ch = source[index]; + + // Hex number starts with "0x". + // Octal number starts with "0". + if (number === "0") { + if (ch === "x" || ch === "X") { + ++index; + return scanHexLiteral(start); + } + + // Binary number in ES6 starts with '0b' + if (extra.ecmaFeatures.binaryLiterals) { + if (ch === "b" || ch === "B") { + ++index; + return scanBinaryLiteral(start); + } + } + + if ((extra.ecmaFeatures.octalLiterals && (ch === "o" || ch === "O")) || syntax.isOctalDigit(ch)) { + return scanOctalLiteral(ch, start); + } + + // decimal number starts with "0" such as "09" is illegal. + if (ch && syntax.isDecimalDigit(ch.charCodeAt(0))) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + } + + while (syntax.isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + ch = source[index]; + } + + if (ch === ".") { + number += source[index++]; + while (syntax.isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + ch = source[index]; + } + + if (ch === "e" || ch === "E") { + number += source[index++]; + + ch = source[index]; + if (ch === "+" || ch === "-") { + number += source[index++]; + } + if (syntax.isDecimalDigit(source.charCodeAt(index))) { + while (syntax.isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + } else { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + } + + if (syntax.isIdentifierStart(source.charCodeAt(index))) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + return { + type: Token.NumericLiteral, + value: parseFloat(number), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; +} + +/** + * Scan a string escape sequence and return its special character. + * @param {string} ch The starting character of the given sequence. + * @returns {Object} An object containing the character and a flag + * if the escape sequence was an octal. + * @private + */ +function scanEscapeSequence(ch) { + var code, + unescaped, + restore, + escapedCh, + octal = false; + + // An escape sequence cannot be empty + if (!ch) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + if (syntax.isLineTerminator(ch.charCodeAt(0))) { + ++lineNumber; + if (ch === "\r" && source[index] === "\n") { + ++index; + } + lineStart = index; + escapedCh = ""; + } else if (ch === "u" && source[index] === "{") { + // Handle ES6 extended unicode code point escape sequences. + if (extra.ecmaFeatures.unicodeCodePointEscapes) { + ++index; + escapedCh = scanUnicodeCodePointEscape(); + } else { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + } else if (ch === "u" || ch === "x") { + // Handle other unicode and hex codes normally + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + escapedCh = unescaped; + } else { + index = restore; + escapedCh = ch; + } + } else if (ch === "n") { + escapedCh = "\n"; + } else if (ch === "r") { + escapedCh = "\r"; + } else if (ch === "t") { + escapedCh = "\t"; + } else if (ch === "b") { + escapedCh = "\b"; + } else if (ch === "f") { + escapedCh = "\f"; + } else if (ch === "v") { + escapedCh = "\v"; + } else if (syntax.isOctalDigit(ch)) { + code = "01234567".indexOf(ch); + + // \0 is not octal escape sequence + if (code !== 0) { + octal = true; + } + + if (index < length && syntax.isOctalDigit(source[index])) { + octal = true; + code = code * 8 + "01234567".indexOf(source[index++]); + + // 3 digits are only allowed when string starts with 0, 1, 2, 3 + if ("0123".indexOf(ch) >= 0 && + index < length && + syntax.isOctalDigit(source[index])) { + code = code * 8 + "01234567".indexOf(source[index++]); + } + } + escapedCh = String.fromCharCode(code); + } else { + escapedCh = ch; + } + + return { + ch: escapedCh, + octal: octal + }; +} + +function scanStringLiteral() { + var str = "", + ch, + escapedSequence, + octal = false, + start = index, + startLineNumber = lineNumber, + startLineStart = lineStart, + quote = source[index]; + + assert((quote === "'" || quote === "\""), + "String literal must starts with a quote"); + + ++index; + + while (index < length) { + ch = source[index++]; + + if (syntax.isLineTerminator(ch.charCodeAt(0))) { + break; + } else if (ch === quote) { + quote = ""; + break; + } else if (ch === "\\") { + ch = source[index++]; + escapedSequence = scanEscapeSequence(ch); + str += escapedSequence.ch; + octal = escapedSequence.octal || octal; + } else { + str += ch; + } + } + + if (quote !== "") { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + return { + type: Token.StringLiteral, + value: str, + octal: octal, + startLineNumber: startLineNumber, + startLineStart: startLineStart, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; +} + +/** + * Scan a template string and return a token. This scans both the first and + * subsequent pieces of a template string and assumes that the first backtick + * or the closing } have already been scanned. + * @returns {Token} The template string token. + * @private + */ +function scanTemplate() { + var cooked = "", + ch, + escapedSequence, + start = index, + terminated = false, + tail = false, + head = (source[index] === "`"); + + ++index; + + while (index < length) { + ch = source[index++]; + + if (ch === "`") { + tail = true; + terminated = true; + break; + } else if (ch === "$") { + if (source[index] === "{") { + ++index; + terminated = true; + break; + } + cooked += ch; + } else if (ch === "\\") { + ch = source[index++]; + escapedSequence = scanEscapeSequence(ch); + + if (escapedSequence.octal) { + throwError({}, Messages.TemplateOctalLiteral); + } + + cooked += escapedSequence.ch; + + } else if (syntax.isLineTerminator(ch.charCodeAt(0))) { + ++lineNumber; + if (ch === "\r" && source[index] === "\n") { + ++index; + } + lineStart = index; + cooked += "\n"; + } else { + cooked += ch; + } + } + + if (!terminated) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + if (index > state.curlyLastIndex) { + state.curlyLastIndex = index; + + if (!tail) { + state.curlyStack.push("template"); + } + + if (!head) { + state.curlyStack.pop(); + } + } + + return { + type: Token.Template, + value: { + cooked: cooked, + raw: source.slice(start + 1, index - ((tail) ? 1 : 2)) + }, + head: head, + tail: tail, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; +} + +function testRegExp(pattern, flags) { + var tmp = pattern, + validFlags = "gmsi"; + + if (extra.ecmaFeatures.regexYFlag) { + validFlags += "y"; + } + + if (extra.ecmaFeatures.regexUFlag) { + validFlags += "u"; + } + + if (!RegExp("^[" + validFlags + "]*$").test(flags)) { + throwError({}, Messages.InvalidRegExpFlag); + } + + + if (flags.indexOf("u") >= 0) { + // Replace each astral symbol and every Unicode code point + // escape sequence with a single ASCII symbol to avoid throwing on + // regular expressions that are only valid in combination with the + // `/u` flag. + // Note: replacing with the ASCII symbol `x` might cause false + // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a + // perfectly valid pattern that is equivalent to `[a-b]`, but it + // would be replaced by `[x-b]` which throws an error. + tmp = tmp + .replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) { + if (parseInt($1, 16) <= 0x10FFFF) { + return "x"; + } + throwError({}, Messages.InvalidRegExp); + }) + .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x"); + } + + // First, detect invalid regular expressions. + try { + RegExp(tmp); + } catch (e) { + throwError({}, Messages.InvalidRegExp); + } + + // Return a regular expression object for this pattern-flag pair, or + // `null` in case the current environment doesn't support the flags it + // uses. + try { + return new RegExp(pattern, flags); + } catch (exception) { + return null; + } +} + +function scanRegExpBody() { + var ch, str, classMarker, terminated, body; + + ch = source[index]; + assert(ch === "/", "Regular expression literal must start with a slash"); + str = source[index++]; + + classMarker = false; + terminated = false; + while (index < length) { + ch = source[index++]; + str += ch; + if (ch === "\\") { + ch = source[index++]; + // ECMA-262 7.8.5 + if (syntax.isLineTerminator(ch.charCodeAt(0))) { + throwError({}, Messages.UnterminatedRegExp); + } + str += ch; + } else if (syntax.isLineTerminator(ch.charCodeAt(0))) { + throwError({}, Messages.UnterminatedRegExp); + } else if (classMarker) { + if (ch === "]") { + classMarker = false; + } + } else { + if (ch === "/") { + terminated = true; + break; + } else if (ch === "[") { + classMarker = true; + } + } + } + + if (!terminated) { + throwError({}, Messages.UnterminatedRegExp); + } + + // Exclude leading and trailing slash. + body = str.substr(1, str.length - 2); + return { + value: body, + literal: str + }; +} + +function scanRegExpFlags() { + var ch, str, flags, restore; + + str = ""; + flags = ""; + while (index < length) { + ch = source[index]; + if (!syntax.isIdentifierPart(ch.charCodeAt(0))) { + break; + } + + ++index; + if (ch === "\\" && index < length) { + ch = source[index]; + if (ch === "u") { + ++index; + restore = index; + ch = scanHexEscape("u"); + if (ch) { + flags += ch; + for (str += "\\u"; restore < index; ++restore) { + str += source[restore]; + } + } else { + index = restore; + flags += "u"; + str += "\\u"; + } + throwErrorTolerant({}, Messages.UnexpectedToken, "ILLEGAL"); + } else { + str += "\\"; + throwErrorTolerant({}, Messages.UnexpectedToken, "ILLEGAL"); + } + } else { + flags += ch; + str += ch; + } + } + + return { + value: flags, + literal: str + }; +} + +function scanRegExp() { + var start, body, flags, value; + + lookahead = null; + skipComment(); + start = index; + + body = scanRegExpBody(); + flags = scanRegExpFlags(); + value = testRegExp(body.value, flags.value); + + if (extra.tokenize) { + return { + type: Token.RegularExpression, + value: value, + regex: { + pattern: body.value, + flags: flags.value + }, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + return { + literal: body.literal + flags.literal, + value: value, + regex: { + pattern: body.value, + flags: flags.value + }, + range: [start, index] + }; +} + +function collectRegex() { + var pos, loc, regex, token; + + skipComment(); + + pos = index; + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + regex = scanRegExp(); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + + /* istanbul ignore next */ + if (!extra.tokenize) { + // Pop the previous token, which is likely "/" or "/=" + if (extra.tokens.length > 0) { + token = extra.tokens[extra.tokens.length - 1]; + if (token.range[0] === pos && token.type === "Punctuator") { + if (token.value === "/" || token.value === "/=") { + extra.tokens.pop(); + } + } + } + + extra.tokens.push({ + type: "RegularExpression", + value: regex.literal, + regex: regex.regex, + range: [pos, index], + loc: loc + }); + } + + return regex; +} + +function isIdentifierName(token) { + return token.type === Token.Identifier || + token.type === Token.Keyword || + token.type === Token.BooleanLiteral || + token.type === Token.NullLiteral; +} + +function advanceSlash() { + var prevToken, + checkToken; + // Using the following algorithm: + // https://github.com/mozilla/sweet.js/wiki/design + prevToken = extra.tokens[extra.tokens.length - 1]; + if (!prevToken) { + // Nothing before that: it cannot be a division. + return collectRegex(); + } + if (prevToken.type === "Punctuator") { + if (prevToken.value === "]") { + return scanPunctuator(); + } + if (prevToken.value === ")") { + checkToken = extra.tokens[extra.openParenToken - 1]; + if (checkToken && + checkToken.type === "Keyword" && + (checkToken.value === "if" || + checkToken.value === "while" || + checkToken.value === "for" || + checkToken.value === "with")) { + return collectRegex(); + } + return scanPunctuator(); + } + if (prevToken.value === "}") { + // Dividing a function by anything makes little sense, + // but we have to check for that. + if (extra.tokens[extra.openCurlyToken - 3] && + extra.tokens[extra.openCurlyToken - 3].type === "Keyword") { + // Anonymous function. + checkToken = extra.tokens[extra.openCurlyToken - 4]; + if (!checkToken) { + return scanPunctuator(); + } + } else if (extra.tokens[extra.openCurlyToken - 4] && + extra.tokens[extra.openCurlyToken - 4].type === "Keyword") { + // Named function. + checkToken = extra.tokens[extra.openCurlyToken - 5]; + if (!checkToken) { + return collectRegex(); + } + } else { + return scanPunctuator(); + } + // checkToken determines whether the function is + // a declaration or an expression. + if (FnExprTokens.indexOf(checkToken.value) >= 0) { + // It is an expression. + return scanPunctuator(); + } + // It is a declaration. + return collectRegex(); + } + return collectRegex(); + } + if (prevToken.type === "Keyword") { + return collectRegex(); + } + return scanPunctuator(); +} + +function advance() { + var ch, + allowJSX = extra.ecmaFeatures.jsx, + allowTemplateStrings = extra.ecmaFeatures.templateStrings; + + /* + * If JSX isn't allowed or JSX is allowed and we're not inside an JSX child, + * then skip any comments. + */ + if (!allowJSX || !state.inJSXChild) { + skipComment(); + } + + if (index >= length) { + return { + type: Token.EOF, + lineNumber: lineNumber, + lineStart: lineStart, + range: [index, index] + }; + } + + // if inside an JSX child, then abort regular tokenization + if (allowJSX && state.inJSXChild) { + return advanceJSXChild(); + } + + ch = source.charCodeAt(index); + + // Very common: ( and ) and ; + if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { + return scanPunctuator(); + } + + // String literal starts with single quote (U+0027) or double quote (U+0022). + if (ch === 0x27 || ch === 0x22) { + if (allowJSX && state.inJSXTag) { + return scanJSXStringLiteral(); + } + + return scanStringLiteral(); + } + + if (allowJSX && state.inJSXTag && syntax.isJSXIdentifierStart(ch)) { + return scanJSXIdentifier(); + } + + // Template strings start with backtick (U+0096) or closing curly brace (125) and backtick. + if (allowTemplateStrings) { + + // template strings start with backtick (96) or open curly (125) but only if the open + // curly closes a previously opened curly from a template. + if (ch === 96 || (ch === 125 && state.curlyStack[state.curlyStack.length - 1] === "template")) { + return scanTemplate(); + } + } + + if (syntax.isIdentifierStart(ch)) { + return scanIdentifier(); + } + + // Dot (.) U+002E can also start a floating-point number, hence the need + // to check the next character. + if (ch === 0x2E) { + if (syntax.isDecimalDigit(source.charCodeAt(index + 1))) { + return scanNumericLiteral(); + } + return scanPunctuator(); + } + + if (syntax.isDecimalDigit(ch)) { + return scanNumericLiteral(); + } + + // Slash (/) U+002F can also start a regex. + if (extra.tokenize && ch === 0x2F) { + return advanceSlash(); + } + + return scanPunctuator(); +} + +function collectToken() { + var loc, token, range, value, entry, + allowJSX = extra.ecmaFeatures.jsx; + + /* istanbul ignore else */ + if (!allowJSX || !state.inJSXChild) { + skipComment(); + } + + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + token = advance(); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + + if (token.type !== Token.EOF) { + range = [token.range[0], token.range[1]]; + value = source.slice(token.range[0], token.range[1]); + entry = { + type: TokenName[token.type], + value: value, + range: range, + loc: loc + }; + if (token.regex) { + entry.regex = { + pattern: token.regex.pattern, + flags: token.regex.flags + }; + } + extra.tokens.push(entry); + } + + return token; +} + +function lex() { + var token; + + token = lookahead; + index = token.range[1]; + lineNumber = token.lineNumber; + lineStart = token.lineStart; + + lookahead = (typeof extra.tokens !== "undefined") ? collectToken() : advance(); + + index = token.range[1]; + lineNumber = token.lineNumber; + lineStart = token.lineStart; + + return token; +} + +function peek() { + var pos, + line, + start; + + pos = index; + line = lineNumber; + start = lineStart; + + lookahead = (typeof extra.tokens !== "undefined") ? collectToken() : advance(); + + index = pos; + lineNumber = line; + lineStart = start; +} + +function lookahead2() { + var adv, pos, line, start, result; + + // If we are collecting the tokens, don't grab the next one yet. + /* istanbul ignore next */ + adv = (typeof extra.advance === "function") ? extra.advance : advance; + + pos = index; + line = lineNumber; + start = lineStart; + + // Scan for the next immediate token. + /* istanbul ignore if */ + if (lookahead === null) { + lookahead = adv(); + } + index = lookahead.range[1]; + lineNumber = lookahead.lineNumber; + lineStart = lookahead.lineStart; + + // Grab the token right after. + result = adv(); + index = pos; + lineNumber = line; + lineStart = start; + + return result; +} + + +//------------------------------------------------------------------------------ +// JSX +//------------------------------------------------------------------------------ + +function getQualifiedJSXName(object) { + if (object.type === astNodeTypes.JSXIdentifier) { + return object.name; + } + if (object.type === astNodeTypes.JSXNamespacedName) { + return object.namespace.name + ":" + object.name.name; + } + /* istanbul ignore else */ + if (object.type === astNodeTypes.JSXMemberExpression) { + return ( + getQualifiedJSXName(object.object) + "." + + getQualifiedJSXName(object.property) + ); + } + /* istanbul ignore next */ + throwUnexpected(object); +} + +function scanJSXIdentifier() { + var ch, start, value = ""; + + start = index; + while (index < length) { + ch = source.charCodeAt(index); + if (!syntax.isJSXIdentifierPart(ch)) { + break; + } + value += source[index++]; + } + + return { + type: Token.JSXIdentifier, + value: value, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; +} + +function scanJSXEntity() { + var ch, str = "", start = index, count = 0, code; + ch = source[index]; + assert(ch === "&", "Entity must start with an ampersand"); + index++; + while (index < length && count++ < 10) { + ch = source[index++]; + if (ch === ";") { + break; + } + str += ch; + } + + // Well-formed entity (ending was found). + if (ch === ";") { + // Numeric entity. + if (str[0] === "#") { + if (str[1] === "x") { + code = +("0" + str.substr(1)); + } else { + // Removing leading zeros in order to avoid treating as octal in old browsers. + code = +str.substr(1).replace(Regex.LeadingZeros, ""); + } + + if (!isNaN(code)) { + return String.fromCharCode(code); + } + /* istanbul ignore else */ + } else if (XHTMLEntities[str]) { + return XHTMLEntities[str]; + } + } + + // Treat non-entity sequences as regular text. + index = start + 1; + return "&"; +} + +function scanJSXText(stopChars) { + var ch, str = "", start; + start = index; + while (index < length) { + ch = source[index]; + if (stopChars.indexOf(ch) !== -1) { + break; + } + if (ch === "&") { + str += scanJSXEntity(); + } else { + index++; + if (ch === "\r" && source[index] === "\n") { + str += ch; + ch = source[index]; + index++; + } + if (syntax.isLineTerminator(ch.charCodeAt(0))) { + ++lineNumber; + lineStart = index; + } + str += ch; + } + } + return { + type: Token.JSXText, + value: str, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; +} + +function scanJSXStringLiteral() { + var innerToken, quote, start; + + quote = source[index]; + assert((quote === "\"" || quote === "'"), + "String literal must starts with a quote"); + + start = index; + ++index; + + innerToken = scanJSXText([quote]); + + if (quote !== source[index]) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + ++index; + + innerToken.range = [start, index]; + + return innerToken; +} + +/* + * Between JSX opening and closing tags (e.g. HERE), anything that + * is not another JSX tag and is not an expression wrapped by {} is text. + */ +function advanceJSXChild() { + var ch = source.charCodeAt(index); + + // { (123) and < (60) + if (ch !== 123 && ch !== 60) { + return scanJSXText(["<", "{"]); + } + + return scanPunctuator(); +} + +function parseJSXIdentifier() { + var token, marker = markerCreate(); + + if (lookahead.type !== Token.JSXIdentifier) { + throwUnexpected(lookahead); + } + + token = lex(); + return markerApply(marker, astNodeFactory.createJSXIdentifier(token.value)); +} + +function parseJSXNamespacedName() { + var namespace, name, marker = markerCreate(); + + namespace = parseJSXIdentifier(); + expect(":"); + name = parseJSXIdentifier(); + + return markerApply(marker, astNodeFactory.createJSXNamespacedName(namespace, name)); +} + +function parseJSXMemberExpression() { + var marker = markerCreate(), + expr = parseJSXIdentifier(); + + while (match(".")) { + lex(); + expr = markerApply(marker, astNodeFactory.createJSXMemberExpression(expr, parseJSXIdentifier())); + } + + return expr; +} + +function parseJSXElementName() { + if (lookahead2().value === ":") { + return parseJSXNamespacedName(); + } + if (lookahead2().value === ".") { + return parseJSXMemberExpression(); + } + + return parseJSXIdentifier(); +} + +function parseJSXAttributeName() { + if (lookahead2().value === ":") { + return parseJSXNamespacedName(); + } + + return parseJSXIdentifier(); +} + +function parseJSXAttributeValue() { + var value, marker; + if (match("{")) { + value = parseJSXExpressionContainer(); + if (value.expression.type === astNodeTypes.JSXEmptyExpression) { + throwError( + value, + "JSX attributes must only be assigned a non-empty " + + "expression" + ); + } + } else if (match("<")) { + value = parseJSXElement(); + } else if (lookahead.type === Token.JSXText) { + marker = markerCreate(); + value = markerApply(marker, astNodeFactory.createLiteralFromSource(lex(), source)); + } else { + throwError({}, Messages.InvalidJSXAttributeValue); + } + return value; +} + +function parseJSXEmptyExpression() { + var marker = markerCreatePreserveWhitespace(); + while (source.charAt(index) !== "}") { + index++; + } + return markerApply(marker, astNodeFactory.createJSXEmptyExpression()); +} + +function parseJSXExpressionContainer() { + var expression, origInJSXChild, origInJSXTag, marker = markerCreate(); + + origInJSXChild = state.inJSXChild; + origInJSXTag = state.inJSXTag; + state.inJSXChild = false; + state.inJSXTag = false; + + expect("{"); + + if (match("}")) { + expression = parseJSXEmptyExpression(); + } else { + expression = parseExpression(); + } + + state.inJSXChild = origInJSXChild; + state.inJSXTag = origInJSXTag; + + expect("}"); + + return markerApply(marker, astNodeFactory.createJSXExpressionContainer(expression)); +} + +function parseJSXSpreadAttribute() { + var expression, origInJSXChild, origInJSXTag, marker = markerCreate(); + + origInJSXChild = state.inJSXChild; + origInJSXTag = state.inJSXTag; + state.inJSXChild = false; + state.inJSXTag = false; + state.inJSXSpreadAttribute = true; + + expect("{"); + expect("..."); + + state.inJSXSpreadAttribute = false; + + expression = parseAssignmentExpression(); + + state.inJSXChild = origInJSXChild; + state.inJSXTag = origInJSXTag; + + expect("}"); + + return markerApply(marker, astNodeFactory.createJSXSpreadAttribute(expression)); +} + +function parseJSXAttribute() { + var name, marker; + + if (match("{")) { + return parseJSXSpreadAttribute(); + } + + marker = markerCreate(); + + name = parseJSXAttributeName(); + + // HTML empty attribute + if (match("=")) { + lex(); + return markerApply(marker, astNodeFactory.createJSXAttribute(name, parseJSXAttributeValue())); + } + + return markerApply(marker, astNodeFactory.createJSXAttribute(name)); +} + +function parseJSXChild() { + var token, marker; + if (match("{")) { + token = parseJSXExpressionContainer(); + } else if (lookahead.type === Token.JSXText) { + marker = markerCreatePreserveWhitespace(); + token = markerApply(marker, astNodeFactory.createLiteralFromSource(lex(), source)); + } else { + token = parseJSXElement(); + } + return token; +} + +function parseJSXClosingElement() { + var name, origInJSXChild, origInJSXTag, marker = markerCreate(); + origInJSXChild = state.inJSXChild; + origInJSXTag = state.inJSXTag; + state.inJSXChild = false; + state.inJSXTag = true; + expect("<"); + expect("/"); + name = parseJSXElementName(); + // Because advance() (called by lex() called by expect()) expects there + // to be a valid token after >, it needs to know whether to look for a + // standard JS token or an JSX text node + state.inJSXChild = origInJSXChild; + state.inJSXTag = origInJSXTag; + expect(">"); + return markerApply(marker, astNodeFactory.createJSXClosingElement(name)); +} + +function parseJSXOpeningElement() { + var name, attributes = [], selfClosing = false, origInJSXChild, + origInJSXTag, marker = markerCreate(); + + origInJSXChild = state.inJSXChild; + origInJSXTag = state.inJSXTag; + state.inJSXChild = false; + state.inJSXTag = true; + + expect("<"); + + name = parseJSXElementName(); + + while (index < length && + lookahead.value !== "/" && + lookahead.value !== ">") { + attributes.push(parseJSXAttribute()); + } + + state.inJSXTag = origInJSXTag; + + if (lookahead.value === "/") { + expect("/"); + // Because advance() (called by lex() called by expect()) expects + // there to be a valid token after >, it needs to know whether to + // look for a standard JS token or an JSX text node + state.inJSXChild = origInJSXChild; + expect(">"); + selfClosing = true; + } else { + state.inJSXChild = true; + expect(">"); + } + return markerApply(marker, astNodeFactory.createJSXOpeningElement(name, attributes, selfClosing)); +} + +function parseJSXElement() { + var openingElement, closingElement = null, children = [], origInJSXChild, origInJSXTag, marker = markerCreate(); + + origInJSXChild = state.inJSXChild; + origInJSXTag = state.inJSXTag; + openingElement = parseJSXOpeningElement(); + + if (!openingElement.selfClosing) { + while (index < length) { + state.inJSXChild = false; // Call lookahead2() with inJSXChild = false because one

two
; + * + * the default error message is a bit incomprehensible. Since it"s + * rarely (never?) useful to write a less-than sign after an JSX + * element, we disallow it here in the parser in order to provide a + * better error message. (In the rare case that the less-than operator + * was intended, the left tag can be wrapped in parentheses.) + */ + if (!origInJSXChild && match("<")) { + throwError(lookahead, Messages.AdjacentJSXElements); + } + + return markerApply(marker, astNodeFactory.createJSXElement(openingElement, closingElement, children)); +} + +//------------------------------------------------------------------------------ +// Location markers +//------------------------------------------------------------------------------ + +/** + * Applies location information to the given node by using the given marker. + * The marker indicates the point at which the node is said to have to begun + * in the source code. + * @param {Object} marker The marker to use for the node. + * @param {ASTNode} node The AST node to apply location information to. + * @returns {ASTNode} The node that was passed in. + * @private + */ +function markerApply(marker, node) { + + // add range information to the node if present + if (extra.range) { + node.range = [marker.offset, index]; + } + + // add location information the node if present + if (extra.loc) { + node.loc = { + start: { + line: marker.line, + column: marker.col + }, + end: { + line: lineNumber, + column: index - lineStart + } + }; + // Attach extra.source information to the location, if present + if (extra.source) { + node.loc.source = extra.source; + } + } + + // attach leading and trailing comments if requested + if (extra.attachComment) { + commentAttachment.processComment(node); + } + + return node; +} + +/** + * Creates a location marker in the source code. Location markers are used for + * tracking where tokens and nodes appear in the source code. + * @returns {Object} A marker object or undefined if the parser doesn't have + * any location information. + * @private + */ +function markerCreate() { + + if (!extra.loc && !extra.range) { + return undefined; + } + + skipComment(); + + return { + offset: index, + line: lineNumber, + col: index - lineStart + }; +} + +/** + * Creates a location marker in the source code. Location markers are used for + * tracking where tokens and nodes appear in the source code. This method + * doesn't skip comments or extra whitespace which is important for JSX. + * @returns {Object} A marker object or undefined if the parser doesn't have + * any location information. + * @private + */ +function markerCreatePreserveWhitespace() { + + if (!extra.loc && !extra.range) { + return undefined; + } + + return { + offset: index, + line: lineNumber, + col: index - lineStart + }; +} + + +//------------------------------------------------------------------------------ +// Syntax Tree Delegate +//------------------------------------------------------------------------------ + +// Return true if there is a line terminator before the next token. + +function peekLineTerminator() { + var pos, line, start, found; + + pos = index; + line = lineNumber; + start = lineStart; + skipComment(); + found = lineNumber !== line; + index = pos; + lineNumber = line; + lineStart = start; + + return found; +} + +// Throw an exception + +function throwError(token, messageFormat) { + + var error, + args = Array.prototype.slice.call(arguments, 2), + msg = messageFormat.replace( + /%(\d)/g, + function (whole, index) { + assert(index < args.length, "Message reference must be in range"); + return args[index]; + } + ); + + if (typeof token.lineNumber === "number") { + error = new Error("Line " + token.lineNumber + ": " + msg); + error.index = token.range[0]; + error.lineNumber = token.lineNumber; + error.column = token.range[0] - lineStart + 1; + } else { + error = new Error("Line " + lineNumber + ": " + msg); + error.index = index; + error.lineNumber = lineNumber; + error.column = index - lineStart + 1; + } + + error.description = msg; + throw error; +} + +function throwErrorTolerant() { + try { + throwError.apply(null, arguments); + } catch (e) { + if (extra.errors) { + extra.errors.push(e); + } else { + throw e; + } + } +} + + +// Throw an exception because of the token. + +function throwUnexpected(token) { + + if (token.type === Token.EOF) { + throwError(token, Messages.UnexpectedEOS); + } + + if (token.type === Token.NumericLiteral) { + throwError(token, Messages.UnexpectedNumber); + } + + if (token.type === Token.StringLiteral || token.type === Token.JSXText) { + throwError(token, Messages.UnexpectedString); + } + + if (token.type === Token.Identifier) { + throwError(token, Messages.UnexpectedIdentifier); + } + + if (token.type === Token.Keyword) { + if (syntax.isFutureReservedWord(token.value)) { + throwError(token, Messages.UnexpectedReserved); + } else if (strict && syntax.isStrictModeReservedWord(token.value)) { + throwErrorTolerant(token, Messages.StrictReservedWord); + return; + } + throwError(token, Messages.UnexpectedToken, token.value); + } + + if (token.type === Token.Template) { + throwError(token, Messages.UnexpectedTemplate, token.value.raw); + } + + // BooleanLiteral, NullLiteral, or Punctuator. + throwError(token, Messages.UnexpectedToken, token.value); +} + +// Expect the next token to match the specified punctuator. +// If not, an exception will be thrown. + +function expect(value) { + var token = lex(); + if (token.type !== Token.Punctuator || token.value !== value) { + throwUnexpected(token); + } +} + +// Expect the next token to match the specified keyword. +// If not, an exception will be thrown. + +function expectKeyword(keyword) { + var token = lex(); + if (token.type !== Token.Keyword || token.value !== keyword) { + throwUnexpected(token); + } +} + +// Return true if the next token matches the specified punctuator. + +function match(value) { + return lookahead.type === Token.Punctuator && lookahead.value === value; +} + +// Return true if the next token matches the specified keyword + +function matchKeyword(keyword) { + return lookahead.type === Token.Keyword && lookahead.value === keyword; +} + +// Return true if the next token matches the specified contextual keyword +// (where an identifier is sometimes a keyword depending on the context) + +function matchContextualKeyword(keyword) { + return lookahead.type === Token.Identifier && lookahead.value === keyword; +} + +// Return true if the next token is an assignment operator + +function matchAssign() { + var op; + + if (lookahead.type !== Token.Punctuator) { + return false; + } + op = lookahead.value; + return op === "=" || + op === "*=" || + op === "/=" || + op === "%=" || + op === "+=" || + op === "-=" || + op === "<<=" || + op === ">>=" || + op === ">>>=" || + op === "&=" || + op === "^=" || + op === "|="; +} + +function consumeSemicolon() { + var line; + + // Catch the very common case first: immediately a semicolon (U+003B). + if (source.charCodeAt(index) === 0x3B || match(";")) { + lex(); + return; + } + + line = lineNumber; + skipComment(); + if (lineNumber !== line) { + return; + } + + if (lookahead.type !== Token.EOF && !match("}")) { + throwUnexpected(lookahead); + } +} + +// Return true if provided expression is LeftHandSideExpression + +function isLeftHandSide(expr) { + return expr.type === astNodeTypes.Identifier || expr.type === astNodeTypes.MemberExpression; +} + +// 11.1.4 Array Initialiser + +function parseArrayInitialiser() { + var elements = [], + marker = markerCreate(), + tmp; + + expect("["); + + while (!match("]")) { + if (match(",")) { + lex(); // only get here when you have [a,,] or similar + elements.push(null); + } else { + tmp = parseSpreadOrAssignmentExpression(); + elements.push(tmp); + if (!(match("]"))) { + expect(","); // handles the common case of comma-separated values + } + } + } + + expect("]"); + + return markerApply(marker, astNodeFactory.createArrayExpression(elements)); +} + +// 11.1.5 Object Initialiser + +function parsePropertyFunction(paramInfo, options) { + var previousStrict = strict, + previousYieldAllowed = state.yieldAllowed, + generator = options ? options.generator : false, + body; + + state.yieldAllowed = generator; + + /* + * Esprima uses parseConciseBody() here, which is incorrect. Object literal + * methods must have braces. + */ + body = parseFunctionSourceElements(); + + if (strict && paramInfo.firstRestricted) { + throwErrorTolerant(paramInfo.firstRestricted, Messages.StrictParamName); + } + + if (strict && paramInfo.stricted) { + throwErrorTolerant(paramInfo.stricted, paramInfo.message); + } + + strict = previousStrict; + state.yieldAllowed = previousYieldAllowed; + + return markerApply(options.marker, astNodeFactory.createFunctionExpression( + null, + paramInfo.params, + paramInfo.defaults, + body, + paramInfo.rest, + generator, + body.type !== astNodeTypes.BlockStatement + )); +} + +function parsePropertyMethodFunction(options) { + var previousStrict = strict, + marker = markerCreate(), + params, + method; + + strict = true; + + params = parseParams(); + + if (params.stricted) { + throwErrorTolerant(params.stricted, params.message); + } + + method = parsePropertyFunction(params, { + generator: options ? options.generator : false, + marker: marker + }); + + strict = previousStrict; + + return method; +} + +function parseObjectPropertyKey() { + var marker = markerCreate(), + token = lex(), + allowObjectLiteralComputed = extra.ecmaFeatures.objectLiteralComputedProperties, + expr, + result; + + // Note: This function is called only from parseObjectProperty(), where + // EOF and Punctuator tokens are already filtered out. + + switch (token.type) { + case Token.StringLiteral: + case Token.NumericLiteral: + if (strict && token.octal) { + throwErrorTolerant(token, Messages.StrictOctalLiteral); + } + return markerApply(marker, astNodeFactory.createLiteralFromSource(token, source)); + + case Token.Identifier: + case Token.BooleanLiteral: + case Token.NullLiteral: + case Token.Keyword: + return markerApply(marker, astNodeFactory.createIdentifier(token.value)); + + case Token.Punctuator: + if ((!state.inObjectLiteral || allowObjectLiteralComputed) && + token.value === "[") { + // For computed properties we should skip the [ and ], and + // capture in marker only the assignment expression itself. + marker = markerCreate(); + expr = parseAssignmentExpression(); + result = markerApply(marker, expr); + expect("]"); + return result; + } + + // no default + } + + throwUnexpected(token); +} + +function lookaheadPropertyName() { + switch (lookahead.type) { + case Token.Identifier: + case Token.StringLiteral: + case Token.BooleanLiteral: + case Token.NullLiteral: + case Token.NumericLiteral: + case Token.Keyword: + return true; + case Token.Punctuator: + return lookahead.value === "["; + // no default + } + return false; +} + +// This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals, +// it might be called at a position where there is in fact a short hand identifier pattern or a data property. +// This can only be determined after we consumed up to the left parentheses. +// In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller +// is responsible to visit other options. +function tryParseMethodDefinition(token, key, computed, marker) { + var value, options, methodMarker; + + if (token.type === Token.Identifier) { + // check for `get` and `set`; + + if (token.value === "get" && lookaheadPropertyName()) { + + computed = match("["); + key = parseObjectPropertyKey(); + methodMarker = markerCreate(); + expect("("); + expect(")"); + + value = parsePropertyFunction({ + params: [], + defaults: [], + stricted: null, + firstRestricted: null, + message: null, + rest: null + }, { + marker: methodMarker + }); + + return markerApply(marker, astNodeFactory.createProperty("get", key, value, false, false, computed)); + + } else if (token.value === "set" && lookaheadPropertyName()) { + computed = match("["); + key = parseObjectPropertyKey(); + methodMarker = markerCreate(); + expect("("); + + options = { + params: [], + defaultCount: 0, + defaults: [], + stricted: null, + firstRestricted: null, + paramSet: new StringMap(), + rest: null + }; + if (match(")")) { + throwErrorTolerant(lookahead, Messages.UnexpectedToken, lookahead.value); + } else { + parseParam(options); + if (options.defaultCount === 0) { + options.defaults = []; + } + } + expect(")"); + + value = parsePropertyFunction(options, { marker: methodMarker }); + return markerApply(marker, astNodeFactory.createProperty("set", key, value, false, false, computed)); + } + } + + if (match("(")) { + value = parsePropertyMethodFunction(); + return markerApply(marker, astNodeFactory.createProperty("init", key, value, true, false, computed)); + } + + // Not a MethodDefinition. + return null; +} + +/** + * Parses Generator Properties + * @param {ASTNode} key The property key (usually an identifier). + * @param {Object} marker The marker to use for the node. + * @returns {ASTNode} The generator property node. + */ +function parseGeneratorProperty(key, marker) { + + var computed = (lookahead.type === Token.Punctuator && lookahead.value === "["); + + if (!match("(")) { + throwUnexpected(lex()); + } + + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + key, + parsePropertyMethodFunction({ generator: true }), + true, + false, + computed + ) + ); +} + +// TODO(nzakas): Update to match Esprima +function parseObjectProperty() { + var token, key, id, computed, methodMarker, options; + var allowComputed = extra.ecmaFeatures.objectLiteralComputedProperties, + allowMethod = extra.ecmaFeatures.objectLiteralShorthandMethods, + allowShorthand = extra.ecmaFeatures.objectLiteralShorthandProperties, + allowGenerators = extra.ecmaFeatures.generators, + allowDestructuring = extra.ecmaFeatures.destructuring, + marker = markerCreate(); + + token = lookahead; + computed = (token.value === "[" && token.type === Token.Punctuator); + + if (token.type === Token.Identifier || (allowComputed && computed)) { + + id = parseObjectPropertyKey(); + + /* + * Check for getters and setters. Be careful! "get" and "set" are legal + * method names. It's only a getter or setter if followed by a space. + */ + if (token.value === "get" && + !(match(":") || match("(") || match(",") || match("}"))) { + computed = (lookahead.value === "["); + key = parseObjectPropertyKey(); + methodMarker = markerCreate(); + expect("("); + expect(")"); + + return markerApply( + marker, + astNodeFactory.createProperty( + "get", + key, + parsePropertyFunction({ + generator: false + }, { + marker: methodMarker + }), + false, + false, + computed + ) + ); + } + + if (token.value === "set" && + !(match(":") || match("(") || match(",") || match("}"))) { + computed = (lookahead.value === "["); + key = parseObjectPropertyKey(); + methodMarker = markerCreate(); + expect("("); + + options = { + params: [], + defaultCount: 0, + defaults: [], + stricted: null, + firstRestricted: null, + paramSet: new StringMap(), + rest: null + }; + + if (match(")")) { + throwErrorTolerant(lookahead, Messages.UnexpectedToken, lookahead.value); + } else { + parseParam(options); + if (options.defaultCount === 0) { + options.defaults = []; + } + } + + expect(")"); + + return markerApply( + marker, + astNodeFactory.createProperty( + "set", + key, + parsePropertyFunction(options, { + marker: methodMarker + }), + false, + false, + computed + ) + ); + } + + // normal property (key:value) + if (match(":")) { + lex(); + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + id, + parseAssignmentExpression(), + false, + false, + computed + ) + ); + } + + // method shorthand (key(){...}) + if (allowMethod && match("(")) { + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + id, + parsePropertyMethodFunction({ generator: false }), + true, + false, + computed + ) + ); + } + + // destructuring defaults (shorthand syntax) + if (allowDestructuring && match("=")) { + lex(); + var value = parseAssignmentExpression(); + var prop = markerApply(marker, astNodeFactory.createAssignmentExpression("=", id, value)); + prop.type = astNodeTypes.AssignmentPattern; + var fullProperty = astNodeFactory.createProperty( + "init", + id, + prop, + false, + true, // shorthand + computed + ); + return markerApply(marker, fullProperty); + } + + /* + * Only other possibility is that this is a shorthand property. Computed + * properties cannot use shorthand notation, so that's a syntax error. + * If shorthand properties aren't allow, then this is an automatic + * syntax error. Destructuring is another case with a similar shorthand syntax. + */ + if (computed || (!allowShorthand && !allowDestructuring)) { + throwUnexpected(lookahead); + } + + // shorthand property + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + id, + id, + false, + true, + false + ) + ); + } + + // only possibility in this branch is a shorthand generator + if (token.type === Token.EOF || token.type === Token.Punctuator) { + if (!allowGenerators || !match("*") || !allowMethod) { + throwUnexpected(token); + } + + lex(); + + id = parseObjectPropertyKey(); + + return parseGeneratorProperty(id, marker); + + } + + /* + * If we've made it here, then that means the property name is represented + * by a string (i.e, { "foo": 2}). The only options here are normal + * property with a colon or a method. + */ + key = parseObjectPropertyKey(); + + // check for property value + if (match(":")) { + lex(); + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + key, + parseAssignmentExpression(), + false, + false, + false + ) + ); + } + + // check for method + if (allowMethod && match("(")) { + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + key, + parsePropertyMethodFunction(), + true, + false, + false + ) + ); + } + + // no other options, this is bad + throwUnexpected(lex()); +} + +function getFieldName(key) { + var toString = String; + if (key.type === astNodeTypes.Identifier) { + return key.name; + } + return toString(key.value); +} + +function parseObjectInitialiser() { + var marker = markerCreate(), + allowDuplicates = extra.ecmaFeatures.objectLiteralDuplicateProperties, + properties = [], + property, + name, + propertyFn, + kind, + storedKind, + previousInObjectLiteral = state.inObjectLiteral, + kindMap = new StringMap(); + + state.inObjectLiteral = true; + + expect("{"); + + while (!match("}")) { + + property = parseObjectProperty(); + + if (!property.computed) { + + name = getFieldName(property.key); + propertyFn = (property.kind === "get") ? PropertyKind.Get : PropertyKind.Set; + kind = (property.kind === "init") ? PropertyKind.Data : propertyFn; + + if (kindMap.has(name)) { + storedKind = kindMap.get(name); + if (storedKind === PropertyKind.Data) { + if (kind === PropertyKind.Data && name === "__proto__" && allowDuplicates) { + // Duplicate '__proto__' literal properties are forbidden in ES 6 + throwErrorTolerant({}, Messages.DuplicatePrototypeProperty); + } else if (strict && kind === PropertyKind.Data && !allowDuplicates) { + // Duplicate literal properties are only forbidden in ES 5 strict mode + throwErrorTolerant({}, Messages.StrictDuplicateProperty); + } else if (kind !== PropertyKind.Data) { + throwErrorTolerant({}, Messages.AccessorDataProperty); + } + } else { + if (kind === PropertyKind.Data) { + throwErrorTolerant({}, Messages.AccessorDataProperty); + } else if (storedKind & kind) { + throwErrorTolerant({}, Messages.AccessorGetSet); + } + } + kindMap.set(name, storedKind | kind); + } else { + kindMap.set(name, kind); + } + } + + properties.push(property); + + if (!match("}")) { + expect(","); + } + } + + expect("}"); + + state.inObjectLiteral = previousInObjectLiteral; + + return markerApply(marker, astNodeFactory.createObjectExpression(properties)); +} + +/** + * Parse a template string element and return its ASTNode representation + * @param {Object} option Parsing & scanning options + * @param {Object} option.head True if this element is the first in the + * template string, false otherwise. + * @returns {ASTNode} The template element node with marker info applied + * @private + */ +function parseTemplateElement(option) { + var marker, token; + + if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) { + throwError({}, Messages.UnexpectedToken, "ILLEGAL"); + } + + marker = markerCreate(); + token = lex(); + + return markerApply( + marker, + astNodeFactory.createTemplateElement( + { + raw: token.value.raw, + cooked: token.value.cooked + }, + token.tail + ) + ); +} + +/** + * Parse a template string literal and return its ASTNode representation + * @returns {ASTNode} The template literal node with marker info applied + * @private + */ +function parseTemplateLiteral() { + var quasi, quasis, expressions, marker = markerCreate(); + + quasi = parseTemplateElement({ head: true }); + quasis = [ quasi ]; + expressions = []; + + while (!quasi.tail) { + expressions.push(parseExpression()); + quasi = parseTemplateElement({ head: false }); + quasis.push(quasi); + } + + return markerApply(marker, astNodeFactory.createTemplateLiteral(quasis, expressions)); +} + +// 11.1.6 The Grouping Operator + +function parseGroupExpression() { + var expr; + + expect("("); + + ++state.parenthesisCount; + + expr = parseExpression(); + + expect(")"); + + return expr; +} + + +// 11.1 Primary Expressions + +function parsePrimaryExpression() { + var type, token, expr, + marker, + allowJSX = extra.ecmaFeatures.jsx, + allowClasses = extra.ecmaFeatures.classes, + allowSuper = allowClasses || extra.ecmaFeatures.superInFunctions; + + if (match("(")) { + return parseGroupExpression(); + } + + if (match("[")) { + return parseArrayInitialiser(); + } + + if (match("{")) { + return parseObjectInitialiser(); + } + + if (allowJSX && match("<")) { + return parseJSXElement(); + } + + type = lookahead.type; + marker = markerCreate(); + + if (type === Token.Identifier) { + expr = astNodeFactory.createIdentifier(lex().value); + } else if (type === Token.StringLiteral || type === Token.NumericLiteral) { + if (strict && lookahead.octal) { + throwErrorTolerant(lookahead, Messages.StrictOctalLiteral); + } + expr = astNodeFactory.createLiteralFromSource(lex(), source); + } else if (type === Token.Keyword) { + if (matchKeyword("function")) { + return parseFunctionExpression(); + } + + if (allowSuper && matchKeyword("super") && state.inFunctionBody) { + marker = markerCreate(); + lex(); + return markerApply(marker, astNodeFactory.createIdentifier("super")); + } + + if (matchKeyword("this")) { + marker = markerCreate(); + lex(); + return markerApply(marker, astNodeFactory.createThisExpression()); + } + + if (allowClasses && matchKeyword("class")) { + return parseClassExpression(); + } + + throwUnexpected(lex()); + } else if (type === Token.BooleanLiteral) { + token = lex(); + token.value = (token.value === "true"); + expr = astNodeFactory.createLiteralFromSource(token, source); + } else if (type === Token.NullLiteral) { + token = lex(); + token.value = null; + expr = astNodeFactory.createLiteralFromSource(token, source); + } else if (match("/") || match("/=")) { + if (typeof extra.tokens !== "undefined") { + expr = astNodeFactory.createLiteralFromSource(collectRegex(), source); + } else { + expr = astNodeFactory.createLiteralFromSource(scanRegExp(), source); + } + peek(); + } else if (type === Token.Template) { + return parseTemplateLiteral(); + } else { + throwUnexpected(lex()); + } + + return markerApply(marker, expr); +} + +// 11.2 Left-Hand-Side Expressions + +function parseArguments() { + var args = [], arg; + + expect("("); + + if (!match(")")) { + while (index < length) { + arg = parseSpreadOrAssignmentExpression(); + args.push(arg); + + if (match(")")) { + break; + } + + expect(","); + } + } + + expect(")"); + + return args; +} + +function parseSpreadOrAssignmentExpression() { + if (match("...")) { + var marker = markerCreate(); + lex(); + return markerApply(marker, astNodeFactory.createSpreadElement(parseAssignmentExpression())); + } + return parseAssignmentExpression(); +} + +function parseNonComputedProperty() { + var token, + marker = markerCreate(); + + token = lex(); + + if (!isIdentifierName(token)) { + throwUnexpected(token); + } + + return markerApply(marker, astNodeFactory.createIdentifier(token.value)); +} + +function parseNonComputedMember() { + expect("."); + + return parseNonComputedProperty(); +} + +function parseComputedMember() { + var expr; + + expect("["); + + expr = parseExpression(); + + expect("]"); + + return expr; +} + +function parseNewExpression() { + var callee, args, + marker = markerCreate(); + + expectKeyword("new"); + callee = parseLeftHandSideExpression(); + args = match("(") ? parseArguments() : []; + + return markerApply(marker, astNodeFactory.createNewExpression(callee, args)); +} + +function parseLeftHandSideExpressionAllowCall() { + var expr, args, + previousAllowIn = state.allowIn, + marker = markerCreate(); + + state.allowIn = true; + expr = matchKeyword("new") ? parseNewExpression() : parsePrimaryExpression(); + state.allowIn = previousAllowIn; + + // only start parsing template literal if the lookahead is a head (beginning with `) + while (match(".") || match("[") || match("(") || (lookahead.type === Token.Template && lookahead.head)) { + if (match("(")) { + args = parseArguments(); + expr = markerApply(marker, astNodeFactory.createCallExpression(expr, args)); + } else if (match("[")) { + expr = markerApply(marker, astNodeFactory.createMemberExpression("[", expr, parseComputedMember())); + } else if (match(".")) { + expr = markerApply(marker, astNodeFactory.createMemberExpression(".", expr, parseNonComputedMember())); + } else { + expr = markerApply(marker, astNodeFactory.createTaggedTemplateExpression(expr, parseTemplateLiteral())); + } + } + + return expr; +} + +function parseLeftHandSideExpression() { + var expr, + previousAllowIn = state.allowIn, + marker = markerCreate(); + + expr = matchKeyword("new") ? parseNewExpression() : parsePrimaryExpression(); + state.allowIn = previousAllowIn; + + // only start parsing template literal if the lookahead is a head (beginning with `) + while (match(".") || match("[") || (lookahead.type === Token.Template && lookahead.head)) { + if (match("[")) { + expr = markerApply(marker, astNodeFactory.createMemberExpression("[", expr, parseComputedMember())); + } else if (match(".")) { + expr = markerApply(marker, astNodeFactory.createMemberExpression(".", expr, parseNonComputedMember())); + } else { + expr = markerApply(marker, astNodeFactory.createTaggedTemplateExpression(expr, parseTemplateLiteral())); + } + } + + return expr; +} + + +// 11.3 Postfix Expressions + +function parsePostfixExpression() { + var expr, token, + marker = markerCreate(); + + expr = parseLeftHandSideExpressionAllowCall(); + + if (lookahead.type === Token.Punctuator) { + if ((match("++") || match("--")) && !peekLineTerminator()) { + // 11.3.1, 11.3.2 + if (strict && expr.type === astNodeTypes.Identifier && syntax.isRestrictedWord(expr.name)) { + throwErrorTolerant({}, Messages.StrictLHSPostfix); + } + + if (!isLeftHandSide(expr)) { + throwErrorTolerant({}, Messages.InvalidLHSInAssignment); + } + + token = lex(); + expr = markerApply(marker, astNodeFactory.createPostfixExpression(token.value, expr)); + } + } + + return expr; +} + +// 11.4 Unary Operators + +function parseUnaryExpression() { + var token, expr, + marker; + + if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) { + expr = parsePostfixExpression(); + } else if (match("++") || match("--")) { + marker = markerCreate(); + token = lex(); + expr = parseUnaryExpression(); + // 11.4.4, 11.4.5 + if (strict && expr.type === astNodeTypes.Identifier && syntax.isRestrictedWord(expr.name)) { + throwErrorTolerant({}, Messages.StrictLHSPrefix); + } + + if (!isLeftHandSide(expr)) { + throwErrorTolerant({}, Messages.InvalidLHSInAssignment); + } + + expr = astNodeFactory.createUnaryExpression(token.value, expr); + expr = markerApply(marker, expr); + } else if (match("+") || match("-") || match("~") || match("!")) { + marker = markerCreate(); + token = lex(); + expr = parseUnaryExpression(); + expr = astNodeFactory.createUnaryExpression(token.value, expr); + expr = markerApply(marker, expr); + } else if (matchKeyword("delete") || matchKeyword("void") || matchKeyword("typeof")) { + marker = markerCreate(); + token = lex(); + expr = parseUnaryExpression(); + expr = astNodeFactory.createUnaryExpression(token.value, expr); + expr = markerApply(marker, expr); + if (strict && expr.operator === "delete" && expr.argument.type === astNodeTypes.Identifier) { + throwErrorTolerant({}, Messages.StrictDelete); + } + } else { + expr = parsePostfixExpression(); + } + + return expr; +} + +function binaryPrecedence(token, allowIn) { + var prec = 0; + + if (token.type !== Token.Punctuator && token.type !== Token.Keyword) { + return 0; + } + + switch (token.value) { + case "||": + prec = 1; + break; + + case "&&": + prec = 2; + break; + + case "|": + prec = 3; + break; + + case "^": + prec = 4; + break; + + case "&": + prec = 5; + break; + + case "==": + case "!=": + case "===": + case "!==": + prec = 6; + break; + + case "<": + case ">": + case "<=": + case ">=": + case "instanceof": + prec = 7; + break; + + case "in": + prec = allowIn ? 7 : 0; + break; + + case "<<": + case ">>": + case ">>>": + prec = 8; + break; + + case "+": + case "-": + prec = 9; + break; + + case "*": + case "/": + case "%": + prec = 11; + break; + + default: + break; + } + + return prec; +} + +// 11.5 Multiplicative Operators +// 11.6 Additive Operators +// 11.7 Bitwise Shift Operators +// 11.8 Relational Operators +// 11.9 Equality Operators +// 11.10 Binary Bitwise Operators +// 11.11 Binary Logical Operators +function parseBinaryExpression() { + var expr, token, prec, previousAllowIn, stack, right, operator, left, i, + marker, markers; + + previousAllowIn = state.allowIn; + state.allowIn = true; + + marker = markerCreate(); + left = parseUnaryExpression(); + + token = lookahead; + prec = binaryPrecedence(token, previousAllowIn); + if (prec === 0) { + return left; + } + token.prec = prec; + lex(); + + markers = [marker, markerCreate()]; + right = parseUnaryExpression(); + + stack = [left, token, right]; + + while ((prec = binaryPrecedence(lookahead, previousAllowIn)) > 0) { + + // Reduce: make a binary expression from the three topmost entries. + while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { + right = stack.pop(); + operator = stack.pop().value; + left = stack.pop(); + expr = astNodeFactory.createBinaryExpression(operator, left, right); + markers.pop(); + marker = markers.pop(); + markerApply(marker, expr); + stack.push(expr); + markers.push(marker); + } + + // Shift. + token = lex(); + token.prec = prec; + stack.push(token); + markers.push(markerCreate()); + expr = parseUnaryExpression(); + stack.push(expr); + } + + state.allowIn = previousAllowIn; + + // Final reduce to clean-up the stack. + i = stack.length - 1; + expr = stack[i]; + markers.pop(); + while (i > 1) { + expr = astNodeFactory.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr); + i -= 2; + marker = markers.pop(); + markerApply(marker, expr); + } + + return expr; +} + +// 11.12 Conditional Operator + +function parseConditionalExpression() { + var expr, previousAllowIn, consequent, alternate, + marker = markerCreate(); + + expr = parseBinaryExpression(); + + if (match("?")) { + lex(); + previousAllowIn = state.allowIn; + state.allowIn = true; + consequent = parseAssignmentExpression(); + state.allowIn = previousAllowIn; + expect(":"); + alternate = parseAssignmentExpression(); + + expr = astNodeFactory.createConditionalExpression(expr, consequent, alternate); + markerApply(marker, expr); + } + + return expr; +} + +// [ES6] 14.2 Arrow Function + +function parseConciseBody() { + if (match("{")) { + return parseFunctionSourceElements(); + } + return parseAssignmentExpression(); +} + +function reinterpretAsCoverFormalsList(expressions) { + var i, len, param, params, defaults, defaultCount, options, rest; + + params = []; + defaults = []; + defaultCount = 0; + rest = null; + options = { + paramSet: new StringMap() + }; + + for (i = 0, len = expressions.length; i < len; i += 1) { + param = expressions[i]; + if (param.type === astNodeTypes.Identifier) { + params.push(param); + defaults.push(null); + validateParam(options, param, param.name); + } else if (param.type === astNodeTypes.ObjectExpression || param.type === astNodeTypes.ArrayExpression) { + reinterpretAsDestructuredParameter(options, param); + params.push(param); + defaults.push(null); + } else if (param.type === astNodeTypes.SpreadElement) { + assert(i === len - 1, "It is guaranteed that SpreadElement is last element by parseExpression"); + if (param.argument.type !== astNodeTypes.Identifier) { + throwError({}, Messages.InvalidLHSInFormalsList); + } + reinterpretAsDestructuredParameter(options, param.argument); + rest = param.argument; + } else if (param.type === astNodeTypes.AssignmentExpression) { + params.push(param.left); + defaults.push(param.right); + ++defaultCount; + validateParam(options, param.left, param.left.name); + } else { + return null; + } + } + + if (options.message === Messages.StrictParamDupe) { + throwError( + strict ? options.stricted : options.firstRestricted, + options.message + ); + } + + // must be here so it's not an array of [null, null] + if (defaultCount === 0) { + defaults = []; + } + + return { + params: params, + defaults: defaults, + rest: rest, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; +} + +function parseArrowFunctionExpression(options, marker) { + var previousStrict, body; + + expect("=>"); + previousStrict = strict; + + body = parseConciseBody(); + + if (strict && options.firstRestricted) { + throwError(options.firstRestricted, options.message); + } + if (strict && options.stricted) { + throwErrorTolerant(options.stricted, options.message); + } + + strict = previousStrict; + return markerApply(marker, astNodeFactory.createArrowFunctionExpression( + options.params, + options.defaults, + body, + options.rest, + body.type !== astNodeTypes.BlockStatement + )); +} + +// 11.13 Assignment Operators + +// 12.14.5 AssignmentPattern + +function reinterpretAsAssignmentBindingPattern(expr) { + var i, len, property, element, + allowDestructuring = extra.ecmaFeatures.destructuring; + + if (!allowDestructuring) { + throwUnexpected(lex()); + } + + if (expr.type === astNodeTypes.ObjectExpression) { + expr.type = astNodeTypes.ObjectPattern; + for (i = 0, len = expr.properties.length; i < len; i += 1) { + property = expr.properties[i]; + if (property.kind !== "init") { + throwErrorTolerant({}, Messages.InvalidLHSInAssignment); + } + reinterpretAsAssignmentBindingPattern(property.value); + } + } else if (expr.type === astNodeTypes.ArrayExpression) { + expr.type = astNodeTypes.ArrayPattern; + for (i = 0, len = expr.elements.length; i < len; i += 1) { + element = expr.elements[i]; + /* istanbul ignore else */ + if (element) { + reinterpretAsAssignmentBindingPattern(element); + } + } + } else if (expr.type === astNodeTypes.Identifier) { + if (syntax.isRestrictedWord(expr.name)) { + throwErrorTolerant({}, Messages.InvalidLHSInAssignment); + } + } else if (expr.type === astNodeTypes.SpreadElement) { + reinterpretAsAssignmentBindingPattern(expr.argument); + if (expr.argument.type === astNodeTypes.ObjectPattern) { + throwErrorTolerant({}, Messages.ObjectPatternAsSpread); + } + } else if (expr.type === "AssignmentExpression" && expr.operator === "=") { + expr.type = astNodeTypes.AssignmentPattern; + } else { + /* istanbul ignore else */ + if (expr.type !== astNodeTypes.MemberExpression && + expr.type !== astNodeTypes.CallExpression && + expr.type !== astNodeTypes.NewExpression && + expr.type !== astNodeTypes.AssignmentPattern + ) { + throwErrorTolerant({}, Messages.InvalidLHSInAssignment); + } + } +} + +// 13.2.3 BindingPattern + +function reinterpretAsDestructuredParameter(options, expr) { + var i, len, property, element, + allowDestructuring = extra.ecmaFeatures.destructuring; + + if (!allowDestructuring) { + throwUnexpected(lex()); + } + + if (expr.type === astNodeTypes.ObjectExpression) { + expr.type = astNodeTypes.ObjectPattern; + for (i = 0, len = expr.properties.length; i < len; i += 1) { + property = expr.properties[i]; + if (property.kind !== "init") { + throwErrorTolerant({}, Messages.InvalidLHSInFormalsList); + } + reinterpretAsDestructuredParameter(options, property.value); + } + } else if (expr.type === astNodeTypes.ArrayExpression) { + expr.type = astNodeTypes.ArrayPattern; + for (i = 0, len = expr.elements.length; i < len; i += 1) { + element = expr.elements[i]; + if (element) { + reinterpretAsDestructuredParameter(options, element); + } + } + } else if (expr.type === astNodeTypes.Identifier) { + validateParam(options, expr, expr.name); + } else if (expr.type === astNodeTypes.SpreadElement) { + // BindingRestElement only allows BindingIdentifier + if (expr.argument.type !== astNodeTypes.Identifier) { + throwErrorTolerant({}, Messages.InvalidLHSInFormalsList); + } + validateParam(options, expr.argument, expr.argument.name); + } else if (expr.type === astNodeTypes.AssignmentExpression && expr.operator === "=") { + expr.type = astNodeTypes.AssignmentPattern; + } else if (expr.type !== astNodeTypes.AssignmentPattern) { + throwError({}, Messages.InvalidLHSInFormalsList); + } +} + +function parseAssignmentExpression() { + var token, left, right, node, params, + marker, + startsWithParen = false, + oldParenthesisCount = state.parenthesisCount, + allowGenerators = extra.ecmaFeatures.generators; + + // Note that 'yield' is treated as a keyword in strict mode, but a + // contextual keyword (identifier) in non-strict mode, so we need + // to use matchKeyword and matchContextualKeyword appropriately. + if (allowGenerators && ((state.yieldAllowed && matchContextualKeyword("yield")) || (strict && matchKeyword("yield")))) { + return parseYieldExpression(); + } + + marker = markerCreate(); + + if (match("(")) { + token = lookahead2(); + if ((token.value === ")" && token.type === Token.Punctuator) || token.value === "...") { + params = parseParams(); + if (!match("=>")) { + throwUnexpected(lex()); + } + return parseArrowFunctionExpression(params, marker); + } + startsWithParen = true; + } + + // revert to the previous lookahead style object + token = lookahead; + node = left = parseConditionalExpression(); + + if (match("=>") && + (state.parenthesisCount === oldParenthesisCount || + state.parenthesisCount === (oldParenthesisCount + 1))) { + + if (node.type === astNodeTypes.Identifier) { + params = reinterpretAsCoverFormalsList([ node ]); + } else if (node.type === astNodeTypes.AssignmentExpression || + node.type === astNodeTypes.ArrayExpression || + node.type === astNodeTypes.ObjectExpression) { + if (!startsWithParen) { + throwUnexpected(lex()); + } + params = reinterpretAsCoverFormalsList([ node ]); + } else if (node.type === astNodeTypes.SequenceExpression) { + params = reinterpretAsCoverFormalsList(node.expressions); + } + + if (params) { + return parseArrowFunctionExpression(params, marker); + } + } + + if (matchAssign()) { + + // 11.13.1 + if (strict && left.type === astNodeTypes.Identifier && syntax.isRestrictedWord(left.name)) { + throwErrorTolerant(token, Messages.StrictLHSAssignment); + } + + // ES.next draf 11.13 Runtime Semantics step 1 + if (match("=") && (node.type === astNodeTypes.ObjectExpression || node.type === astNodeTypes.ArrayExpression)) { + reinterpretAsAssignmentBindingPattern(node); + } else if (!isLeftHandSide(node)) { + throwErrorTolerant({}, Messages.InvalidLHSInAssignment); + } + + token = lex(); + right = parseAssignmentExpression(); + node = markerApply(marker, astNodeFactory.createAssignmentExpression(token.value, left, right)); + } + + return node; +} + +// 11.14 Comma Operator + +function parseExpression() { + var marker = markerCreate(), + expr = parseAssignmentExpression(), + expressions = [ expr ], + sequence, spreadFound; + + if (match(",")) { + while (index < length) { + if (!match(",")) { + break; + } + lex(); + expr = parseSpreadOrAssignmentExpression(); + expressions.push(expr); + + if (expr.type === astNodeTypes.SpreadElement) { + spreadFound = true; + if (!match(")")) { + throwError({}, Messages.ElementAfterSpreadElement); + } + break; + } + } + + sequence = markerApply(marker, astNodeFactory.createSequenceExpression(expressions)); + } + + if (spreadFound && lookahead2().value !== "=>") { + throwError({}, Messages.IllegalSpread); + } + + return sequence || expr; +} + +// 12.1 Block + +function parseStatementList() { + var list = [], + statement; + + while (index < length) { + if (match("}")) { + break; + } + statement = parseSourceElement(); + if (typeof statement === "undefined") { + break; + } + list.push(statement); + } + + return list; +} + +function parseBlock() { + var block, + marker = markerCreate(); + + expect("{"); + + block = parseStatementList(); + + expect("}"); + + return markerApply(marker, astNodeFactory.createBlockStatement(block)); +} + +// 12.2 Variable Statement + +function parseVariableIdentifier() { + var token, + marker = markerCreate(); + + token = lex(); + + if (token.type !== Token.Identifier) { + if (strict && token.type === Token.Keyword && syntax.isStrictModeReservedWord(token.value)) { + throwErrorTolerant(token, Messages.StrictReservedWord); + } else { + throwUnexpected(token); + } + } + + return markerApply(marker, astNodeFactory.createIdentifier(token.value)); +} + +function parseVariableDeclaration(kind) { + var id, + marker = markerCreate(), + init = null; + if (match("{")) { + id = parseObjectInitialiser(); + reinterpretAsAssignmentBindingPattern(id); + } else if (match("[")) { + id = parseArrayInitialiser(); + reinterpretAsAssignmentBindingPattern(id); + } else { + /* istanbul ignore next */ + id = state.allowKeyword ? parseNonComputedProperty() : parseVariableIdentifier(); + // 12.2.1 + if (strict && syntax.isRestrictedWord(id.name)) { + throwErrorTolerant({}, Messages.StrictVarName); + } + } + + // TODO: Verify against feature flags + if (kind === "const") { + if (!match("=")) { + throwError({}, Messages.NoUnintializedConst); + } + expect("="); + init = parseAssignmentExpression(); + } else if (match("=")) { + lex(); + init = parseAssignmentExpression(); + } + + return markerApply(marker, astNodeFactory.createVariableDeclarator(id, init)); +} + +function parseVariableDeclarationList(kind) { + var list = []; + + do { + list.push(parseVariableDeclaration(kind)); + if (!match(",")) { + break; + } + lex(); + } while (index < length); + + return list; +} + +function parseVariableStatement() { + var declarations; + + expectKeyword("var"); + + declarations = parseVariableDeclarationList(); + + consumeSemicolon(); + + return astNodeFactory.createVariableDeclaration(declarations, "var"); +} + +// kind may be `const` or `let` +// Both are experimental and not in the specification yet. +// see http://wiki.ecmascript.org/doku.php?id=harmony:const +// and http://wiki.ecmascript.org/doku.php?id=harmony:let +function parseConstLetDeclaration(kind) { + var declarations, + marker = markerCreate(); + + expectKeyword(kind); + + declarations = parseVariableDeclarationList(kind); + + consumeSemicolon(); + + return markerApply(marker, astNodeFactory.createVariableDeclaration(declarations, kind)); +} + +// 12.3 Empty Statement + +function parseEmptyStatement() { + expect(";"); + return astNodeFactory.createEmptyStatement(); +} + +// 12.4 Expression Statement + +function parseExpressionStatement() { + var expr = parseExpression(); + consumeSemicolon(); + return astNodeFactory.createExpressionStatement(expr); +} + +// 12.5 If statement + +function parseIfStatement() { + var test, consequent, alternate; + + expectKeyword("if"); + + expect("("); + + test = parseExpression(); + + expect(")"); + + consequent = parseStatement(); + + if (matchKeyword("else")) { + lex(); + alternate = parseStatement(); + } else { + alternate = null; + } + + return astNodeFactory.createIfStatement(test, consequent, alternate); +} + +// 12.6 Iteration Statements + +function parseDoWhileStatement() { + var body, test, oldInIteration; + + expectKeyword("do"); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + expectKeyword("while"); + + expect("("); + + test = parseExpression(); + + expect(")"); + + if (match(";")) { + lex(); + } + + return astNodeFactory.createDoWhileStatement(test, body); +} + +function parseWhileStatement() { + var test, body, oldInIteration; + + expectKeyword("while"); + + expect("("); + + test = parseExpression(); + + expect(")"); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + return astNodeFactory.createWhileStatement(test, body); +} + +function parseForVariableDeclaration() { + var token, declarations, + marker = markerCreate(); + + token = lex(); + declarations = parseVariableDeclarationList(); + + return markerApply(marker, astNodeFactory.createVariableDeclaration(declarations, token.value)); +} + +function parseForStatement(opts) { + var init, test, update, left, right, body, operator, oldInIteration; + var allowForOf = extra.ecmaFeatures.forOf, + allowBlockBindings = extra.ecmaFeatures.blockBindings; + + init = test = update = null; + + expectKeyword("for"); + + expect("("); + + if (match(";")) { + lex(); + } else { + + if (matchKeyword("var") || + (allowBlockBindings && (matchKeyword("let") || matchKeyword("const"))) + ) { + state.allowIn = false; + init = parseForVariableDeclaration(); + state.allowIn = true; + + if (init.declarations.length === 1) { + if (matchKeyword("in") || (allowForOf && matchContextualKeyword("of"))) { + operator = lookahead; + + // TODO: is "var" check here really needed? wasn"t in 1.2.2 + if (!((operator.value === "in" || init.kind !== "var") && init.declarations[0].init)) { + lex(); + left = init; + right = parseExpression(); + init = null; + } + } + } + + } else { + state.allowIn = false; + init = parseExpression(); + state.allowIn = true; + + if (allowForOf && matchContextualKeyword("of")) { + operator = lex(); + left = init; + right = parseExpression(); + init = null; + } else if (matchKeyword("in")) { + // LeftHandSideExpression + if (!isLeftHandSide(init)) { + throwErrorTolerant({}, Messages.InvalidLHSInForIn); + } + + operator = lex(); + left = init; + right = parseExpression(); + init = null; + } + } + + if (typeof left === "undefined") { + expect(";"); + } + } + + if (typeof left === "undefined") { + + if (!match(";")) { + test = parseExpression(); + } + expect(";"); + + if (!match(")")) { + update = parseExpression(); + } + } + + expect(")"); + + oldInIteration = state.inIteration; + state.inIteration = true; + + if (!(opts !== undefined && opts.ignoreBody)) { + body = parseStatement(); + } + + state.inIteration = oldInIteration; + + if (typeof left === "undefined") { + return astNodeFactory.createForStatement(init, test, update, body); + } + + if (extra.ecmaFeatures.forOf && operator.value === "of") { + return astNodeFactory.createForOfStatement(left, right, body); + } + + return astNodeFactory.createForInStatement(left, right, body); +} + +// 12.7 The continue statement + +function parseContinueStatement() { + var label = null; + + expectKeyword("continue"); + + // Optimize the most common form: "continue;". + if (source.charCodeAt(index) === 0x3B) { + lex(); + + if (!state.inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return astNodeFactory.createContinueStatement(null); + } + + if (peekLineTerminator()) { + if (!state.inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return astNodeFactory.createContinueStatement(null); + } + + if (lookahead.type === Token.Identifier) { + label = parseVariableIdentifier(); + + if (!state.labelSet.has(label.name)) { + throwError({}, Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !state.inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return astNodeFactory.createContinueStatement(label); +} + +// 12.8 The break statement + +function parseBreakStatement() { + var label = null; + + expectKeyword("break"); + + // Catch the very common case first: immediately a semicolon (U+003B). + if (source.charCodeAt(index) === 0x3B) { + lex(); + + if (!(state.inIteration || state.inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return astNodeFactory.createBreakStatement(null); + } + + if (peekLineTerminator()) { + if (!(state.inIteration || state.inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return astNodeFactory.createBreakStatement(null); + } + + if (lookahead.type === Token.Identifier) { + label = parseVariableIdentifier(); + + if (!state.labelSet.has(label.name)) { + throwError({}, Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !(state.inIteration || state.inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return astNodeFactory.createBreakStatement(label); +} + +// 12.9 The return statement + +function parseReturnStatement() { + var argument = null; + + expectKeyword("return"); + + if (!state.inFunctionBody && !extra.ecmaFeatures.globalReturn) { + throwErrorTolerant({}, Messages.IllegalReturn); + } + + // "return" followed by a space and an identifier is very common. + if (source.charCodeAt(index) === 0x20) { + if (syntax.isIdentifierStart(source.charCodeAt(index + 1))) { + argument = parseExpression(); + consumeSemicolon(); + return astNodeFactory.createReturnStatement(argument); + } + } + + if (peekLineTerminator()) { + return astNodeFactory.createReturnStatement(null); + } + + if (!match(";")) { + if (!match("}") && lookahead.type !== Token.EOF) { + argument = parseExpression(); + } + } + + consumeSemicolon(); + + return astNodeFactory.createReturnStatement(argument); +} + +// 12.10 The with statement + +function parseWithStatement() { + var object, body; + + if (strict) { + // TODO(ikarienator): Should we update the test cases instead? + skipComment(); + throwErrorTolerant({}, Messages.StrictModeWith); + } + + expectKeyword("with"); + + expect("("); + + object = parseExpression(); + + expect(")"); + + body = parseStatement(); + + return astNodeFactory.createWithStatement(object, body); +} + +// 12.10 The swith statement + +function parseSwitchCase() { + var test, consequent = [], statement, + marker = markerCreate(); + + if (matchKeyword("default")) { + lex(); + test = null; + } else { + expectKeyword("case"); + test = parseExpression(); + } + expect(":"); + + while (index < length) { + if (match("}") || matchKeyword("default") || matchKeyword("case")) { + break; + } + statement = parseSourceElement(); + consequent.push(statement); + } + + return markerApply(marker, astNodeFactory.createSwitchCase(test, consequent)); +} + +function parseSwitchStatement() { + var discriminant, cases, clause, oldInSwitch, defaultFound; + + expectKeyword("switch"); + + expect("("); + + discriminant = parseExpression(); + + expect(")"); + + expect("{"); + + cases = []; + + if (match("}")) { + lex(); + return astNodeFactory.createSwitchStatement(discriminant, cases); + } + + oldInSwitch = state.inSwitch; + state.inSwitch = true; + defaultFound = false; + + while (index < length) { + if (match("}")) { + break; + } + clause = parseSwitchCase(); + if (clause.test === null) { + if (defaultFound) { + throwError({}, Messages.MultipleDefaultsInSwitch); + } + defaultFound = true; + } + cases.push(clause); + } + + state.inSwitch = oldInSwitch; + + expect("}"); + + return astNodeFactory.createSwitchStatement(discriminant, cases); +} + +// 12.13 The throw statement + +function parseThrowStatement() { + var argument; + + expectKeyword("throw"); + + if (peekLineTerminator()) { + throwError({}, Messages.NewlineAfterThrow); + } + + argument = parseExpression(); + + consumeSemicolon(); + + return astNodeFactory.createThrowStatement(argument); +} + +// 12.14 The try statement + +function parseCatchClause() { + var param, body, + marker = markerCreate(), + allowDestructuring = extra.ecmaFeatures.destructuring, + options = { + paramSet: new StringMap() + }; + + expectKeyword("catch"); + + expect("("); + if (match(")")) { + throwUnexpected(lookahead); + } + + if (match("[")) { + if (!allowDestructuring) { + throwUnexpected(lookahead); + } + param = parseArrayInitialiser(); + reinterpretAsDestructuredParameter(options, param); + } else if (match("{")) { + + if (!allowDestructuring) { + throwUnexpected(lookahead); + } + param = parseObjectInitialiser(); + reinterpretAsDestructuredParameter(options, param); + } else { + param = parseVariableIdentifier(); + } + + // 12.14.1 + if (strict && param.name && syntax.isRestrictedWord(param.name)) { + throwErrorTolerant({}, Messages.StrictCatchVariable); + } + + expect(")"); + body = parseBlock(); + return markerApply(marker, astNodeFactory.createCatchClause(param, body)); +} + +function parseTryStatement() { + var block, handler = null, finalizer = null; + + expectKeyword("try"); + + block = parseBlock(); + + if (matchKeyword("catch")) { + handler = parseCatchClause(); + } + + if (matchKeyword("finally")) { + lex(); + finalizer = parseBlock(); + } + + if (!handler && !finalizer) { + throwError({}, Messages.NoCatchOrFinally); + } + + return astNodeFactory.createTryStatement(block, handler, finalizer); +} + +// 12.15 The debugger statement + +function parseDebuggerStatement() { + expectKeyword("debugger"); + + consumeSemicolon(); + + return astNodeFactory.createDebuggerStatement(); +} + +// 12 Statements + +function parseStatement() { + var type = lookahead.type, + expr, + labeledBody, + marker; + + if (type === Token.EOF) { + throwUnexpected(lookahead); + } + + if (type === Token.Punctuator && lookahead.value === "{") { + return parseBlock(); + } + + marker = markerCreate(); + + if (type === Token.Punctuator) { + switch (lookahead.value) { + case ";": + return markerApply(marker, parseEmptyStatement()); + case "{": + return parseBlock(); + case "(": + return markerApply(marker, parseExpressionStatement()); + default: + break; + } + } + + marker = markerCreate(); + + if (type === Token.Keyword) { + switch (lookahead.value) { + case "break": + return markerApply(marker, parseBreakStatement()); + case "continue": + return markerApply(marker, parseContinueStatement()); + case "debugger": + return markerApply(marker, parseDebuggerStatement()); + case "do": + return markerApply(marker, parseDoWhileStatement()); + case "for": + return markerApply(marker, parseForStatement()); + case "function": + return markerApply(marker, parseFunctionDeclaration()); + case "if": + return markerApply(marker, parseIfStatement()); + case "return": + return markerApply(marker, parseReturnStatement()); + case "switch": + return markerApply(marker, parseSwitchStatement()); + case "throw": + return markerApply(marker, parseThrowStatement()); + case "try": + return markerApply(marker, parseTryStatement()); + case "var": + return markerApply(marker, parseVariableStatement()); + case "while": + return markerApply(marker, parseWhileStatement()); + case "with": + return markerApply(marker, parseWithStatement()); + default: + break; + } + } + + marker = markerCreate(); + expr = parseExpression(); + + // 12.12 Labelled Statements + if ((expr.type === astNodeTypes.Identifier) && match(":")) { + lex(); + + if (state.labelSet.has(expr.name)) { + throwError({}, Messages.Redeclaration, "Label", expr.name); + } + + state.labelSet.set(expr.name, true); + labeledBody = parseStatement(); + state.labelSet.delete(expr.name); + return markerApply(marker, astNodeFactory.createLabeledStatement(expr, labeledBody)); + } + + consumeSemicolon(); + + return markerApply(marker, astNodeFactory.createExpressionStatement(expr)); +} + +// 13 Function Definition + +// function parseConciseBody() { +// if (match("{")) { +// return parseFunctionSourceElements(); +// } +// return parseAssignmentExpression(); +// } + +function parseFunctionSourceElements() { + var sourceElement, sourceElements = [], token, directive, firstRestricted, + oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount, + marker = markerCreate(); + + expect("{"); + + while (index < length) { + if (lookahead.type !== Token.StringLiteral) { + break; + } + token = lookahead; + + sourceElement = parseSourceElement(); + sourceElements.push(sourceElement); + if (sourceElement.expression.type !== astNodeTypes.Literal) { + // this is not directive + break; + } + directive = source.slice(token.range[0] + 1, token.range[1] - 1); + if (directive === "use strict") { + strict = true; + + if (firstRestricted) { + throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + oldLabelSet = state.labelSet; + oldInIteration = state.inIteration; + oldInSwitch = state.inSwitch; + oldInFunctionBody = state.inFunctionBody; + oldParenthesisCount = state.parenthesizedCount; + + state.labelSet = new StringMap(); + state.inIteration = false; + state.inSwitch = false; + state.inFunctionBody = true; + + while (index < length) { + + if (match("}")) { + break; + } + + sourceElement = parseSourceElement(); + + if (typeof sourceElement === "undefined") { + break; + } + + sourceElements.push(sourceElement); + } + + expect("}"); + + state.labelSet = oldLabelSet; + state.inIteration = oldInIteration; + state.inSwitch = oldInSwitch; + state.inFunctionBody = oldInFunctionBody; + state.parenthesizedCount = oldParenthesisCount; + + return markerApply(marker, astNodeFactory.createBlockStatement(sourceElements)); +} + +function validateParam(options, param, name) { + + if (strict) { + if (syntax.isRestrictedWord(name)) { + options.stricted = param; + options.message = Messages.StrictParamName; + } + + if (options.paramSet.has(name)) { + options.stricted = param; + options.message = Messages.StrictParamDupe; + } + } else if (!options.firstRestricted) { + if (syntax.isRestrictedWord(name)) { + options.firstRestricted = param; + options.message = Messages.StrictParamName; + } else if (syntax.isStrictModeReservedWord(name)) { + options.firstRestricted = param; + options.message = Messages.StrictReservedWord; + } else if (options.paramSet.has(name)) { + options.firstRestricted = param; + options.message = Messages.StrictParamDupe; + } + } + options.paramSet.set(name, true); +} + +function parseParam(options) { + var token, rest, param, def, + allowRestParams = extra.ecmaFeatures.restParams, + allowDestructuring = extra.ecmaFeatures.destructuring, + allowDefaultParams = extra.ecmaFeatures.defaultParams; + + + token = lookahead; + if (token.value === "...") { + if (!allowRestParams) { + throwUnexpected(lookahead); + } + token = lex(); + rest = true; + } + + if (match("[")) { + if (!allowDestructuring) { + throwUnexpected(lookahead); + } + param = parseArrayInitialiser(); + reinterpretAsDestructuredParameter(options, param); + } else if (match("{")) { + if (rest) { + throwError({}, Messages.ObjectPatternAsRestParameter); + } + if (!allowDestructuring) { + throwUnexpected(lookahead); + } + param = parseObjectInitialiser(); + reinterpretAsDestructuredParameter(options, param); + } else { + param = parseVariableIdentifier(); + validateParam(options, token, token.value); + } + + if (match("=")) { + if (rest) { + throwErrorTolerant(lookahead, Messages.DefaultRestParameter); + } + if (allowDefaultParams || allowDestructuring) { + lex(); + def = parseAssignmentExpression(); + ++options.defaultCount; + } else { + throwUnexpected(lookahead); + } + } + + if (rest) { + if (!match(")")) { + throwError({}, Messages.ParameterAfterRestParameter); + } + options.rest = param; + return false; + } + + options.params.push(param); + options.defaults.push(def ? def : null); // TODO: determine if null or undefined (see: #55) + + return !match(")"); +} + + +function parseParams(firstRestricted) { + var options; + + options = { + params: [], + defaultCount: 0, + defaults: [], + rest: null, + firstRestricted: firstRestricted + }; + + expect("("); + + if (!match(")")) { + options.paramSet = new StringMap(); + while (index < length) { + if (!parseParam(options)) { + break; + } + expect(","); + } + } + + expect(")"); + + if (options.defaultCount === 0) { + options.defaults = []; + } + + return { + params: options.params, + defaults: options.defaults, + rest: options.rest, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; +} + +function parseFunctionDeclaration(identifierIsOptional) { + var id = null, body, token, tmp, firstRestricted, message, previousStrict, previousYieldAllowed, generator, + marker = markerCreate(), + allowGenerators = extra.ecmaFeatures.generators; + + expectKeyword("function"); + + generator = false; + if (allowGenerators && match("*")) { + lex(); + generator = true; + } + + if (!identifierIsOptional || !match("(")) { + + token = lookahead; + + id = parseVariableIdentifier(); + + if (strict) { + if (syntax.isRestrictedWord(token.value)) { + throwErrorTolerant(token, Messages.StrictFunctionName); + } + } else { + if (syntax.isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (syntax.isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + + tmp = parseParams(firstRestricted); + firstRestricted = tmp.firstRestricted; + if (tmp.message) { + message = tmp.message; + } + + previousStrict = strict; + previousYieldAllowed = state.yieldAllowed; + state.yieldAllowed = generator; + + body = parseFunctionSourceElements(); + + if (strict && firstRestricted) { + throwError(firstRestricted, message); + } + if (strict && tmp.stricted) { + throwErrorTolerant(tmp.stricted, message); + } + strict = previousStrict; + state.yieldAllowed = previousYieldAllowed; + + return markerApply( + marker, + astNodeFactory.createFunctionDeclaration( + id, + tmp.params, + tmp.defaults, + body, + tmp.rest, + generator, + false + ) + ); + } + +function parseFunctionExpression() { + var token, id = null, firstRestricted, message, tmp, body, previousStrict, previousYieldAllowed, generator, + marker = markerCreate(), + allowGenerators = extra.ecmaFeatures.generators; + + expectKeyword("function"); + + generator = false; + + if (allowGenerators && match("*")) { + lex(); + generator = true; + } + + if (!match("(")) { + token = lookahead; + id = parseVariableIdentifier(); + if (strict) { + if (syntax.isRestrictedWord(token.value)) { + throwErrorTolerant(token, Messages.StrictFunctionName); + } + } else { + if (syntax.isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (syntax.isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + + tmp = parseParams(firstRestricted); + firstRestricted = tmp.firstRestricted; + if (tmp.message) { + message = tmp.message; + } + + previousStrict = strict; + previousYieldAllowed = state.yieldAllowed; + state.yieldAllowed = generator; + + body = parseFunctionSourceElements(); + + if (strict && firstRestricted) { + throwError(firstRestricted, message); + } + if (strict && tmp.stricted) { + throwErrorTolerant(tmp.stricted, message); + } + strict = previousStrict; + state.yieldAllowed = previousYieldAllowed; + + return markerApply( + marker, + astNodeFactory.createFunctionExpression( + id, + tmp.params, + tmp.defaults, + body, + tmp.rest, + generator, + false + ) + ); +} + +function parseYieldExpression() { + var yieldToken, delegateFlag, expr, marker = markerCreate(); + + yieldToken = lex(); + assert(yieldToken.value === "yield", "Called parseYieldExpression with non-yield lookahead."); + + if (!state.yieldAllowed) { + throwErrorTolerant({}, Messages.IllegalYield); + } + + delegateFlag = false; + if (match("*")) { + lex(); + delegateFlag = true; + } + + expr = parseAssignmentExpression(); + + return markerApply(marker, astNodeFactory.createYieldExpression(expr, delegateFlag)); +} + +// Modules grammar from: +// people.mozilla.org/~jorendorff/es6-draft.html + +function parseModuleSpecifier() { + var marker = markerCreate(), + specifier; + + if (lookahead.type !== Token.StringLiteral) { + throwError({}, Messages.InvalidModuleSpecifier); + } + specifier = astNodeFactory.createLiteralFromSource(lex(), source); + return markerApply(marker, specifier); +} + +function parseExportSpecifier() { + var exported, local, marker = markerCreate(); + if (matchKeyword("default")) { + lex(); + local = markerApply(marker, astNodeFactory.createIdentifier("default")); + // export {default} from "something"; + } else { + local = parseVariableIdentifier(); + } + if (matchContextualKeyword("as")) { + lex(); + exported = parseNonComputedProperty(); + } + return markerApply(marker, astNodeFactory.createExportSpecifier(local, exported)); +} + +function parseExportNamedDeclaration() { + var declaration = null, + isExportFromIdentifier, + src = null, specifiers = [], + marker = markerCreate(); + + expectKeyword("export"); + + // non-default export + if (lookahead.type === Token.Keyword) { + // covers: + // export var f = 1; + switch (lookahead.value) { + case "let": + case "const": + case "var": + case "class": + case "function": + declaration = parseSourceElement(); + return markerApply(marker, astNodeFactory.createExportNamedDeclaration(declaration, specifiers, null)); + default: + break; + } + } + + expect("{"); + if (!match("}")) { + do { + isExportFromIdentifier = isExportFromIdentifier || matchKeyword("default"); + specifiers.push(parseExportSpecifier()); + } while (match(",") && lex()); + } + expect("}"); + + if (matchContextualKeyword("from")) { + // covering: + // export {default} from "foo"; + // export {foo} from "foo"; + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + } else if (isExportFromIdentifier) { + // covering: + // export {default}; // missing fromClause + throwError({}, lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } else { + // cover + // export {foo}; + consumeSemicolon(); + } + return markerApply(marker, astNodeFactory.createExportNamedDeclaration(declaration, specifiers, src)); +} + +function parseExportDefaultDeclaration() { + var declaration = null, + expression = null, + possibleIdentifierToken, + allowClasses = extra.ecmaFeatures.classes, + marker = markerCreate(); + + // covers: + // export default ... + expectKeyword("export"); + expectKeyword("default"); + + if (matchKeyword("function") || matchKeyword("class")) { + possibleIdentifierToken = lookahead2(); + if (possibleIdentifierToken.type === Token.Identifier) { + // covers: + // export default function foo () {} + // export default class foo {} + declaration = parseSourceElement(); + return markerApply(marker, astNodeFactory.createExportDefaultDeclaration(declaration)); + } + // covers: + // export default function () {} + // export default class {} + if (lookahead.value === "function") { + declaration = parseFunctionDeclaration(true); + return markerApply(marker, astNodeFactory.createExportDefaultDeclaration(declaration)); + } else if (allowClasses && lookahead.value === "class") { + declaration = parseClassDeclaration(true); + return markerApply(marker, astNodeFactory.createExportDefaultDeclaration(declaration)); + } + } + + if (matchContextualKeyword("from")) { + throwError({}, Messages.UnexpectedToken, lookahead.value); + } + + // covers: + // export default {}; + // export default []; + // export default (1 + 2); + if (match("{")) { + expression = parseObjectInitialiser(); + } else if (match("[")) { + expression = parseArrayInitialiser(); + } else { + expression = parseAssignmentExpression(); + } + consumeSemicolon(); + return markerApply(marker, astNodeFactory.createExportDefaultDeclaration(expression)); +} + + +function parseExportAllDeclaration() { + var src, + marker = markerCreate(); + + // covers: + // export * from "foo"; + expectKeyword("export"); + expect("*"); + if (!matchContextualKeyword("from")) { + throwError({}, lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + + return markerApply(marker, astNodeFactory.createExportAllDeclaration(src)); +} + +function parseExportDeclaration() { + if (state.inFunctionBody) { + throwError({}, Messages.IllegalExportDeclaration); + } + var declarationType = lookahead2().value; + if (declarationType === "default") { + return parseExportDefaultDeclaration(); + } else if (declarationType === "*") { + return parseExportAllDeclaration(); + } else { + return parseExportNamedDeclaration(); + } +} + +function parseImportSpecifier() { + // import {} ...; + var local, imported, marker = markerCreate(); + + imported = parseNonComputedProperty(); + if (matchContextualKeyword("as")) { + lex(); + local = parseVariableIdentifier(); + } + + return markerApply(marker, astNodeFactory.createImportSpecifier(local, imported)); +} + +function parseNamedImports() { + var specifiers = []; + // {foo, bar as bas} + expect("{"); + if (!match("}")) { + do { + specifiers.push(parseImportSpecifier()); + } while (match(",") && lex()); + } + expect("}"); + return specifiers; +} + +function parseImportDefaultSpecifier() { + // import ...; + var local, marker = markerCreate(); + + local = parseNonComputedProperty(); + + return markerApply(marker, astNodeFactory.createImportDefaultSpecifier(local)); +} + +function parseImportNamespaceSpecifier() { + // import <* as foo> ...; + var local, marker = markerCreate(); + + expect("*"); + if (!matchContextualKeyword("as")) { + throwError({}, Messages.NoAsAfterImportNamespace); + } + lex(); + local = parseNonComputedProperty(); + + return markerApply(marker, astNodeFactory.createImportNamespaceSpecifier(local)); +} + +function parseImportDeclaration() { + var specifiers, src, marker = markerCreate(); + + if (state.inFunctionBody) { + throwError({}, Messages.IllegalImportDeclaration); + } + + expectKeyword("import"); + specifiers = []; + + if (lookahead.type === Token.StringLiteral) { + // covers: + // import "foo"; + src = parseModuleSpecifier(); + consumeSemicolon(); + return markerApply(marker, astNodeFactory.createImportDeclaration(specifiers, src)); + } + + if (!matchKeyword("default") && isIdentifierName(lookahead)) { + // covers: + // import foo + // import foo, ... + specifiers.push(parseImportDefaultSpecifier()); + if (match(",")) { + lex(); + } + } + if (match("*")) { + // covers: + // import foo, * as foo + // import * as foo + specifiers.push(parseImportNamespaceSpecifier()); + } else if (match("{")) { + // covers: + // import foo, {bar} + // import {bar} + specifiers = specifiers.concat(parseNamedImports()); + } + + if (!matchContextualKeyword("from")) { + throwError({}, lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + + return markerApply(marker, astNodeFactory.createImportDeclaration(specifiers, src)); +} + +// 14 Functions and classes + +// 14.1 Functions is defined above (13 in ES5) +// 14.2 Arrow Functions Definitions is defined in (7.3 assignments) + +// 14.3 Method Definitions +// 14.3.7 + +// 14.5 Class Definitions + +function parseClassBody() { + var hasConstructor = false, generator = false, + allowGenerators = extra.ecmaFeatures.generators, + token, isStatic, body = [], method, computed, key; + + var existingProps = {}, + topMarker = markerCreate(), + marker; + + existingProps.static = new StringMap(); + existingProps.prototype = new StringMap(); + + expect("{"); + + while (!match("}")) { + + // extra semicolons are fine + if (match(";")) { + lex(); + continue; + } + + token = lookahead; + isStatic = false; + generator = match("*"); + computed = match("["); + marker = markerCreate(); + + if (generator) { + if (!allowGenerators) { + throwUnexpected(lookahead); + } + lex(); + } + + key = parseObjectPropertyKey(); + + // static generator methods + if (key.name === "static" && match("*")) { + if (!allowGenerators) { + throwUnexpected(lookahead); + } + generator = true; + lex(); + } + + if (key.name === "static" && lookaheadPropertyName()) { + token = lookahead; + isStatic = true; + computed = match("["); + key = parseObjectPropertyKey(); + } + + if (generator) { + method = parseGeneratorProperty(key, marker); + } else { + method = tryParseMethodDefinition(token, key, computed, marker, generator); + } + + if (method) { + method.static = isStatic; + if (method.kind === "init") { + method.kind = "method"; + } + + if (!isStatic) { + if (!method.computed && (method.key.name || method.key.value.toString()) === "constructor") { + if (method.kind !== "method" || !method.method || method.value.generator) { + throwUnexpected(token, Messages.ConstructorSpecialMethod); + } + if (hasConstructor) { + throwUnexpected(token, Messages.DuplicateConstructor); + } else { + hasConstructor = true; + } + method.kind = "constructor"; + } + } else { + if (!method.computed && (method.key.name || method.key.value.toString()) === "prototype") { + throwUnexpected(token, Messages.StaticPrototype); + } + } + method.type = astNodeTypes.MethodDefinition; + delete method.method; + delete method.shorthand; + body.push(method); + } else { + throwUnexpected(lookahead); + } + } + + lex(); + return markerApply(topMarker, astNodeFactory.createClassBody(body)); +} + +function parseClassExpression() { + var id = null, superClass = null, marker = markerCreate(), + previousStrict = strict, classBody; + + // classes run in strict mode + strict = true; + + expectKeyword("class"); + + if (lookahead.type === Token.Identifier) { + id = parseVariableIdentifier(); + } + + if (matchKeyword("extends")) { + lex(); + superClass = parseLeftHandSideExpressionAllowCall(); + } + + classBody = parseClassBody(); + strict = previousStrict; + + return markerApply(marker, astNodeFactory.createClassExpression(id, superClass, classBody)); +} + +function parseClassDeclaration(identifierIsOptional) { + var id = null, superClass = null, marker = markerCreate(), + previousStrict = strict, classBody; + + // classes run in strict mode + strict = true; + + expectKeyword("class"); + + if (!identifierIsOptional || lookahead.type === Token.Identifier) { + id = parseVariableIdentifier(); + } + + if (matchKeyword("extends")) { + lex(); + superClass = parseLeftHandSideExpressionAllowCall(); + } + + classBody = parseClassBody(); + strict = previousStrict; + + return markerApply(marker, astNodeFactory.createClassDeclaration(id, superClass, classBody)); +} + +// 15 Program + +function parseSourceElement() { + + var allowClasses = extra.ecmaFeatures.classes, + allowModules = extra.ecmaFeatures.modules, + allowBlockBindings = extra.ecmaFeatures.blockBindings; + + if (lookahead.type === Token.Keyword) { + switch (lookahead.value) { + case "export": + if (!allowModules) { + throwErrorTolerant({}, Messages.IllegalExportDeclaration); + } + return parseExportDeclaration(); + case "import": + if (!allowModules) { + throwErrorTolerant({}, Messages.IllegalImportDeclaration); + } + return parseImportDeclaration(); + case "function": + return parseFunctionDeclaration(); + case "class": + if (allowClasses) { + return parseClassDeclaration(); + } + break; + case "const": + case "let": + if (allowBlockBindings) { + return parseConstLetDeclaration(lookahead.value); + } + /* falls through */ + default: + return parseStatement(); + } + } + + if (lookahead.type !== Token.EOF) { + return parseStatement(); + } +} + +function parseSourceElements() { + var sourceElement, sourceElements = [], token, directive, firstRestricted; + + while (index < length) { + token = lookahead; + if (token.type !== Token.StringLiteral) { + break; + } + + sourceElement = parseSourceElement(); + sourceElements.push(sourceElement); + if (sourceElement.expression.type !== astNodeTypes.Literal) { + // this is not directive + break; + } + directive = source.slice(token.range[0] + 1, token.range[1] - 1); + if (directive === "use strict") { + strict = true; + if (firstRestricted) { + throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + while (index < length) { + sourceElement = parseSourceElement(); + /* istanbul ignore if */ + if (typeof sourceElement === "undefined") { + break; + } + sourceElements.push(sourceElement); + } + return sourceElements; +} + +function parseProgram() { + var body, + marker, + isModule = !!extra.ecmaFeatures.modules; + + skipComment(); + peek(); + marker = markerCreate(); + strict = isModule; + + body = parseSourceElements(); + return markerApply(marker, astNodeFactory.createProgram(body, isModule ? "module" : "script")); +} + +function filterTokenLocation() { + var i, entry, token, tokens = []; + + for (i = 0; i < extra.tokens.length; ++i) { + entry = extra.tokens[i]; + token = { + type: entry.type, + value: entry.value + }; + if (entry.regex) { + token.regex = { + pattern: entry.regex.pattern, + flags: entry.regex.flags + }; + } + if (extra.range) { + token.range = entry.range; + } + if (extra.loc) { + token.loc = entry.loc; + } + tokens.push(token); + } + + extra.tokens = tokens; +} + +//------------------------------------------------------------------------------ +// Tokenizer +//------------------------------------------------------------------------------ + +function tokenize(code, options) { + var toString, + tokens; + + toString = String; + if (typeof code !== "string" && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + length = source.length; + lookahead = null; + state = { + allowIn: true, + labelSet: {}, + parenthesisCount: 0, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + lastCommentStart: -1, + yieldAllowed: false, + curlyStack: [], + curlyLastIndex: 0, + inJSXSpreadAttribute: false, + inJSXChild: false, + inJSXTag: false + }; + + extra = { + ecmaFeatures: defaultFeatures + }; + + // Options matching. + options = options || {}; + + // Of course we collect tokens here. + options.tokens = true; + extra.tokens = []; + extra.tokenize = true; + + // The following two fields are necessary to compute the Regex tokens. + extra.openParenToken = -1; + extra.openCurlyToken = -1; + + extra.range = (typeof options.range === "boolean") && options.range; + extra.loc = (typeof options.loc === "boolean") && options.loc; + + if (typeof options.comment === "boolean" && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === "boolean" && options.tolerant) { + extra.errors = []; + } + + // apply parsing flags + if (options.ecmaFeatures && typeof options.ecmaFeatures === "object") { + extra.ecmaFeatures = options.ecmaFeatures; + } + + try { + peek(); + if (lookahead.type === Token.EOF) { + return extra.tokens; + } + + lex(); + while (lookahead.type !== Token.EOF) { + try { + lex(); + } catch (lexError) { + if (extra.errors) { + extra.errors.push(lexError); + // We have to break on the first error + // to avoid infinite loops. + break; + } else { + throw lexError; + } + } + } + + filterTokenLocation(); + tokens = extra.tokens; + + if (typeof extra.comments !== "undefined") { + tokens.comments = extra.comments; + } + if (typeof extra.errors !== "undefined") { + tokens.errors = extra.errors; + } + } catch (e) { + throw e; + } finally { + extra = {}; + } + return tokens; +} + +//------------------------------------------------------------------------------ +// Parser +//------------------------------------------------------------------------------ + +function parse(code, options) { + var program, toString; + + toString = String; + if (typeof code !== "string" && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + length = source.length; + lookahead = null; + state = { + allowIn: true, + labelSet: new StringMap(), + parenthesisCount: 0, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + lastCommentStart: -1, + yieldAllowed: false, + curlyStack: [], + curlyLastIndex: 0, + inJSXSpreadAttribute: false, + inJSXChild: false, + inJSXTag: false + }; + + extra = { + ecmaFeatures: Object.create(defaultFeatures) + }; + + // for template strings + state.curlyStack = []; + + if (typeof options !== "undefined") { + extra.range = (typeof options.range === "boolean") && options.range; + extra.loc = (typeof options.loc === "boolean") && options.loc; + extra.attachComment = (typeof options.attachComment === "boolean") && options.attachComment; + + if (extra.loc && options.source !== null && options.source !== undefined) { + extra.source = toString(options.source); + } + + if (typeof options.tokens === "boolean" && options.tokens) { + extra.tokens = []; + } + if (typeof options.comment === "boolean" && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === "boolean" && options.tolerant) { + extra.errors = []; + } + if (extra.attachComment) { + extra.range = true; + extra.comments = []; + commentAttachment.reset(); + } + + if (options.sourceType === "module") { + extra.ecmaFeatures = { + arrowFunctions: true, + blockBindings: true, + regexUFlag: true, + regexYFlag: true, + templateStrings: true, + binaryLiterals: true, + octalLiterals: true, + unicodeCodePointEscapes: true, + superInFunctions: true, + defaultParams: true, + restParams: true, + forOf: true, + objectLiteralComputedProperties: true, + objectLiteralShorthandMethods: true, + objectLiteralShorthandProperties: true, + objectLiteralDuplicateProperties: true, + generators: true, + destructuring: true, + classes: true, + modules: true + }; + } + + // apply parsing flags after sourceType to allow overriding + if (options.ecmaFeatures && typeof options.ecmaFeatures === "object") { + + // if it's a module, augment the ecmaFeatures + if (options.sourceType === "module") { + Object.keys(options.ecmaFeatures).forEach(function(key) { + extra.ecmaFeatures[key] = options.ecmaFeatures[key]; + }); + } else { + extra.ecmaFeatures = options.ecmaFeatures; + } + } + + } + + try { + program = parseProgram(); + if (typeof extra.comments !== "undefined") { + program.comments = extra.comments; + } + if (typeof extra.tokens !== "undefined") { + filterTokenLocation(); + program.tokens = extra.tokens; + } + if (typeof extra.errors !== "undefined") { + program.errors = extra.errors; + } + } catch (e) { + throw e; + } finally { + extra = {}; + } + + return program; +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +exports.version = require("./package.json").version; + +exports.tokenize = tokenize; + +exports.parse = parse; + +// Deep copy. +/* istanbul ignore next */ +exports.Syntax = (function () { + var name, types = {}; + + if (typeof Object.create === "function") { + types = Object.create(null); + } + + for (name in astNodeTypes) { + if (astNodeTypes.hasOwnProperty(name)) { + types[name] = astNodeTypes[name]; + } + } + + if (typeof Object.freeze === "function") { + Object.freeze(types); + } + + return types; +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/lib/ast-node-factory.js b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/ast-node-factory.js new file mode 100644 index 00000000..11594a30 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/ast-node-factory.js @@ -0,0 +1,910 @@ +/** + * @fileoverview A factory for creating AST nodes + * @author Fred K. Schott + * @copyright 2014 Fred K. Schott. All rights reserved. + * @copyright 2011-2013 Ariya Hidayat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var astNodeTypes = require("./ast-node-types"); + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + + /** + * Create an Array Expression ASTNode out of an array of elements + * @param {ASTNode[]} elements An array of ASTNode elements + * @returns {ASTNode} An ASTNode representing the entire array expression + */ + createArrayExpression: function (elements) { + return { + type: astNodeTypes.ArrayExpression, + elements: elements + }; + }, + + /** + * Create an Arrow Function Expression ASTNode + * @param {ASTNode} params The function arguments + * @param {ASTNode} defaults Any default arguments + * @param {ASTNode} body The function body + * @param {ASTNode} rest The rest parameter + * @param {boolean} expression True if the arrow function is created via an expression. + * Always false for declarations, but kept here to be in sync with + * FunctionExpression objects. + * @returns {ASTNode} An ASTNode representing the entire arrow function expression + */ + createArrowFunctionExpression: function (params, defaults, body, rest, expression) { + return { + type: astNodeTypes.ArrowFunctionExpression, + id: null, + params: params, + defaults: defaults, + body: body, + rest: rest, + generator: false, + expression: expression + }; + }, + + /** + * Create an ASTNode representation of an assignment expression + * @param {ASTNode} operator The assignment operator + * @param {ASTNode} left The left operand + * @param {ASTNode} right The right operand + * @returns {ASTNode} An ASTNode representing the entire assignment expression + */ + createAssignmentExpression: function (operator, left, right) { + return { + type: astNodeTypes.AssignmentExpression, + operator: operator, + left: left, + right: right + }; + }, + + /** + * Create an ASTNode representation of a binary expression + * @param {ASTNode} operator The assignment operator + * @param {ASTNode} left The left operand + * @param {ASTNode} right The right operand + * @returns {ASTNode} An ASTNode representing the entire binary expression + */ + createBinaryExpression: function (operator, left, right) { + var type = (operator === "||" || operator === "&&") ? astNodeTypes.LogicalExpression : + astNodeTypes.BinaryExpression; + return { + type: type, + operator: operator, + left: left, + right: right + }; + }, + + /** + * Create an ASTNode representation of a block statement + * @param {ASTNode} body The block statement body + * @returns {ASTNode} An ASTNode representing the entire block statement + */ + createBlockStatement: function (body) { + return { + type: astNodeTypes.BlockStatement, + body: body + }; + }, + + /** + * Create an ASTNode representation of a break statement + * @param {ASTNode} label The break statement label + * @returns {ASTNode} An ASTNode representing the break statement + */ + createBreakStatement: function (label) { + return { + type: astNodeTypes.BreakStatement, + label: label + }; + }, + + /** + * Create an ASTNode representation of a call expression + * @param {ASTNode} callee The function being called + * @param {ASTNode[]} args An array of ASTNodes representing the function call arguments + * @returns {ASTNode} An ASTNode representing the entire call expression + */ + createCallExpression: function (callee, args) { + return { + type: astNodeTypes.CallExpression, + callee: callee, + "arguments": args + }; + }, + + /** + * Create an ASTNode representation of a catch clause/block + * @param {ASTNode} param Any catch clause exeption/conditional parameter information + * @param {ASTNode} body The catch block body + * @returns {ASTNode} An ASTNode representing the entire catch clause + */ + createCatchClause: function (param, body) { + return { + type: astNodeTypes.CatchClause, + param: param, + body: body + }; + }, + + /** + * Creates an ASTNode representation of a class body. + * @param {ASTNode} body The node representing the body of the class. + * @returns {ASTNode} An ASTNode representing the class body. + */ + createClassBody: function (body) { + return { + type: astNodeTypes.ClassBody, + body: body + }; + }, + + createClassExpression: function (id, superClass, body) { + return { + type: astNodeTypes.ClassExpression, + id: id, + superClass: superClass, + body: body + }; + }, + + createClassDeclaration: function (id, superClass, body) { + return { + type: astNodeTypes.ClassDeclaration, + id: id, + superClass: superClass, + body: body + }; + }, + + createMethodDefinition: function (propertyType, kind, key, value, computed) { + return { + type: astNodeTypes.MethodDefinition, + key: key, + value: value, + kind: kind, + "static": propertyType === "static", + computed: computed + }; + }, + + /** + * Create an ASTNode representation of a conditional expression + * @param {ASTNode} test The conditional to evaluate + * @param {ASTNode} consequent The code to be run if the test returns true + * @param {ASTNode} alternate The code to be run if the test returns false + * @returns {ASTNode} An ASTNode representing the entire conditional expression + */ + createConditionalExpression: function (test, consequent, alternate) { + return { + type: astNodeTypes.ConditionalExpression, + test: test, + consequent: consequent, + alternate: alternate + }; + }, + + /** + * Create an ASTNode representation of a continue statement + * @param {?ASTNode} label The optional continue label (null if not set) + * @returns {ASTNode} An ASTNode representing the continue statement + */ + createContinueStatement: function (label) { + return { + type: astNodeTypes.ContinueStatement, + label: label + }; + }, + + /** + * Create an ASTNode representation of a debugger statement + * @returns {ASTNode} An ASTNode representing the debugger statement + */ + createDebuggerStatement: function () { + return { + type: astNodeTypes.DebuggerStatement + }; + }, + + /** + * Create an ASTNode representation of an empty statement + * @returns {ASTNode} An ASTNode representing an empty statement + */ + createEmptyStatement: function () { + return { + type: astNodeTypes.EmptyStatement + }; + }, + + /** + * Create an ASTNode representation of an expression statement + * @param {ASTNode} expression The expression + * @returns {ASTNode} An ASTNode representing an expression statement + */ + createExpressionStatement: function (expression) { + return { + type: astNodeTypes.ExpressionStatement, + expression: expression + }; + }, + + /** + * Create an ASTNode representation of a while statement + * @param {ASTNode} test The while conditional + * @param {ASTNode} body The while loop body + * @returns {ASTNode} An ASTNode representing a while statement + */ + createWhileStatement: function (test, body) { + return { + type: astNodeTypes.WhileStatement, + test: test, + body: body + }; + }, + + /** + * Create an ASTNode representation of a do..while statement + * @param {ASTNode} test The do..while conditional + * @param {ASTNode} body The do..while loop body + * @returns {ASTNode} An ASTNode representing a do..while statement + */ + createDoWhileStatement: function (test, body) { + return { + type: astNodeTypes.DoWhileStatement, + body: body, + test: test + }; + }, + + /** + * Create an ASTNode representation of a for statement + * @param {ASTNode} init The initialization expression + * @param {ASTNode} test The conditional test expression + * @param {ASTNode} update The update expression + * @param {ASTNode} body The statement body + * @returns {ASTNode} An ASTNode representing a for statement + */ + createForStatement: function (init, test, update, body) { + return { + type: astNodeTypes.ForStatement, + init: init, + test: test, + update: update, + body: body + }; + }, + + /** + * Create an ASTNode representation of a for..in statement + * @param {ASTNode} left The left-side variable for the property name + * @param {ASTNode} right The right-side object + * @param {ASTNode} body The statement body + * @returns {ASTNode} An ASTNode representing a for..in statement + */ + createForInStatement: function (left, right, body) { + return { + type: astNodeTypes.ForInStatement, + left: left, + right: right, + body: body, + each: false + }; + }, + + /** + * Create an ASTNode representation of a for..of statement + * @param {ASTNode} left The left-side variable for the property value + * @param {ASTNode} right The right-side object + * @param {ASTNode} body The statement body + * @returns {ASTNode} An ASTNode representing a for..of statement + */ + createForOfStatement: function (left, right, body) { + return { + type: astNodeTypes.ForOfStatement, + left: left, + right: right, + body: body + }; + }, + + /** + * Create an ASTNode representation of a function declaration + * @param {ASTNode} id The function name + * @param {ASTNode} params The function arguments + * @param {ASTNode} defaults Any default arguments (ES6-only feature) + * @param {ASTNode} body The function body + * @param {ASTNode} rest The node representing a rest argument. + * @param {boolean} generator True if the function is a generator, false if not. + * @param {boolean} expression True if the function is created via an expression. + * Always false for declarations, but kept here to be in sync with + * FunctionExpression objects. + * @returns {ASTNode} An ASTNode representing a function declaration + */ + createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression) { + return { + type: astNodeTypes.FunctionDeclaration, + id: id, + params: params || [], + defaults: defaults || [], + body: body, + rest: rest || null, + generator: !!generator, + expression: !!expression + }; + }, + + /** + * Create an ASTNode representation of a function expression + * @param {ASTNode} id The function name + * @param {ASTNode} params The function arguments + * @param {ASTNode} defaults Any default arguments (ES6-only feature) + * @param {ASTNode} body The function body + * @param {ASTNode} rest The node representing a rest argument. + * @param {boolean} generator True if the function is a generator, false if not. + * @param {boolean} expression True if the function is created via an expression. + * @returns {ASTNode} An ASTNode representing a function declaration + */ + createFunctionExpression: function (id, params, defaults, body, rest, generator, expression) { + return { + type: astNodeTypes.FunctionExpression, + id: id, + params: params || [], + defaults: defaults || [], + body: body, + rest: rest || null, + generator: !!generator, + expression: !!expression + }; + }, + + /** + * Create an ASTNode representation of an identifier + * @param {ASTNode} name The identifier name + * @returns {ASTNode} An ASTNode representing an identifier + */ + createIdentifier: function (name) { + return { + type: astNodeTypes.Identifier, + name: name + }; + }, + + /** + * Create an ASTNode representation of an if statement + * @param {ASTNode} test The if conditional expression + * @param {ASTNode} consequent The consequent if statement to run + * @param {ASTNode} alternate the "else" alternate statement + * @returns {ASTNode} An ASTNode representing an if statement + */ + createIfStatement: function (test, consequent, alternate) { + return { + type: astNodeTypes.IfStatement, + test: test, + consequent: consequent, + alternate: alternate + }; + }, + + /** + * Create an ASTNode representation of a labeled statement + * @param {ASTNode} label The statement label + * @param {ASTNode} body The labeled statement body + * @returns {ASTNode} An ASTNode representing a labeled statement + */ + createLabeledStatement: function (label, body) { + return { + type: astNodeTypes.LabeledStatement, + label: label, + body: body + }; + }, + + /** + * Create an ASTNode literal from the source code + * @param {ASTNode} token The ASTNode token + * @param {string} source The source code to get the literal from + * @returns {ASTNode} An ASTNode representing the new literal + */ + createLiteralFromSource: function (token, source) { + var node = { + type: astNodeTypes.Literal, + value: token.value, + raw: source.slice(token.range[0], token.range[1]) + }; + + // regular expressions have regex properties + if (token.regex) { + node.regex = token.regex; + } + + return node; + }, + + /** + * Create an ASTNode template element + * @param {Object} value Data on the element value + * @param {string} value.raw The raw template string + * @param {string} value.cooked The processed template string + * @param {boolean} tail True if this is the final element in a template string + * @returns {ASTNode} An ASTNode representing the template string element + */ + createTemplateElement: function (value, tail) { + return { + type: astNodeTypes.TemplateElement, + value: value, + tail: tail + }; + }, + + /** + * Create an ASTNode template literal + * @param {ASTNode[]} quasis An array of the template string elements + * @param {ASTNode[]} expressions An array of the template string expressions + * @returns {ASTNode} An ASTNode representing the template string + */ + createTemplateLiteral: function (quasis, expressions) { + return { + type: astNodeTypes.TemplateLiteral, + quasis: quasis, + expressions: expressions + }; + }, + + /** + * Create an ASTNode representation of a spread element + * @param {ASTNode} argument The array being spread + * @returns {ASTNode} An ASTNode representing a spread element + */ + createSpreadElement: function (argument) { + return { + type: astNodeTypes.SpreadElement, + argument: argument + }; + }, + + /** + * Create an ASTNode tagged template expression + * @param {ASTNode} tag The tag expression + * @param {ASTNode} quasi A TemplateLiteral ASTNode representing + * the template string itself. + * @returns {ASTNode} An ASTNode representing the tagged template + */ + createTaggedTemplateExpression: function (tag, quasi) { + return { + type: astNodeTypes.TaggedTemplateExpression, + tag: tag, + quasi: quasi + }; + }, + + /** + * Create an ASTNode representation of a member expression + * @param {string} accessor The member access method (bracket or period) + * @param {ASTNode} object The object being referenced + * @param {ASTNode} property The object-property being referenced + * @returns {ASTNode} An ASTNode representing a member expression + */ + createMemberExpression: function (accessor, object, property) { + return { + type: astNodeTypes.MemberExpression, + computed: accessor === "[", + object: object, + property: property + }; + }, + + /** + * Create an ASTNode representation of a new expression + * @param {ASTNode} callee The constructor for the new object type + * @param {ASTNode} args The arguments passed to the constructor + * @returns {ASTNode} An ASTNode representing a new expression + */ + createNewExpression: function (callee, args) { + return { + type: astNodeTypes.NewExpression, + callee: callee, + "arguments": args + }; + }, + + /** + * Create an ASTNode representation of a new object expression + * @param {ASTNode[]} properties An array of ASTNodes that represent all object + * properties and associated values + * @returns {ASTNode} An ASTNode representing a new object expression + */ + createObjectExpression: function (properties) { + return { + type: astNodeTypes.ObjectExpression, + properties: properties + }; + }, + + /** + * Create an ASTNode representation of a postfix expression + * @param {string} operator The postfix operator ("++", "--", etc.) + * @param {ASTNode} argument The operator argument + * @returns {ASTNode} An ASTNode representing a postfix expression + */ + createPostfixExpression: function (operator, argument) { + return { + type: astNodeTypes.UpdateExpression, + operator: operator, + argument: argument, + prefix: false + }; + }, + + /** + * Create an ASTNode representation of an entire program + * @param {ASTNode} body The program body + * @param {string} sourceType Either "module" or "script". + * @returns {ASTNode} An ASTNode representing an entire program + */ + createProgram: function (body, sourceType) { + return { + type: astNodeTypes.Program, + body: body, + sourceType: sourceType + }; + }, + + /** + * Create an ASTNode representation of an object property + * @param {string} kind The type of property represented ("get", "set", etc.) + * @param {ASTNode} key The property key + * @param {ASTNode} value The new property value + * @param {boolean} method True if the property is also a method (value is a function) + * @param {boolean} shorthand True if the property is shorthand + * @param {boolean} computed True if the property value has been computed + * @returns {ASTNode} An ASTNode representing an object property + */ + createProperty: function (kind, key, value, method, shorthand, computed) { + return { + type: astNodeTypes.Property, + key: key, + value: value, + kind: kind, + method: method, + shorthand: shorthand, + computed: computed + }; + }, + + /** + * Create an ASTNode representation of a return statement + * @param {?ASTNode} argument The return argument, null if no argument is provided + * @returns {ASTNode} An ASTNode representing a return statement + */ + createReturnStatement: function (argument) { + return { + type: astNodeTypes.ReturnStatement, + argument: argument + }; + }, + + /** + * Create an ASTNode representation of a sequence of expressions + * @param {ASTNode[]} expressions An array containing each expression, in order + * @returns {ASTNode} An ASTNode representing a sequence of expressions + */ + createSequenceExpression: function (expressions) { + return { + type: astNodeTypes.SequenceExpression, + expressions: expressions + }; + }, + + /** + * Create an ASTNode representation of a switch case statement + * @param {ASTNode} test The case value to test against the switch value + * @param {ASTNode} consequent The consequent case statement + * @returns {ASTNode} An ASTNode representing a switch case + */ + createSwitchCase: function (test, consequent) { + return { + type: astNodeTypes.SwitchCase, + test: test, + consequent: consequent + }; + }, + + /** + * Create an ASTNode representation of a switch statement + * @param {ASTNode} discriminant An expression to test against each case value + * @param {ASTNode[]} cases An array of switch case statements + * @returns {ASTNode} An ASTNode representing a switch statement + */ + createSwitchStatement: function (discriminant, cases) { + return { + type: astNodeTypes.SwitchStatement, + discriminant: discriminant, + cases: cases + }; + }, + + /** + * Create an ASTNode representation of a this statement + * @returns {ASTNode} An ASTNode representing a this statement + */ + createThisExpression: function () { + return { + type: astNodeTypes.ThisExpression + }; + }, + + /** + * Create an ASTNode representation of a throw statement + * @param {ASTNode} argument The argument to throw + * @returns {ASTNode} An ASTNode representing a throw statement + */ + createThrowStatement: function (argument) { + return { + type: astNodeTypes.ThrowStatement, + argument: argument + }; + }, + + /** + * Create an ASTNode representation of a try statement + * @param {ASTNode} block The try block + * @param {ASTNode} handler A catch handler + * @param {?ASTNode} finalizer The final code block to run after the try/catch has run + * @returns {ASTNode} An ASTNode representing a try statement + */ + createTryStatement: function (block, handler, finalizer) { + return { + type: astNodeTypes.TryStatement, + block: block, + guardedHandlers: [], + handlers: handler ? [ handler ] : [], + handler: handler, + finalizer: finalizer + }; + }, + + /** + * Create an ASTNode representation of a unary expression + * @param {string} operator The unary operator + * @param {ASTNode} argument The unary operand + * @returns {ASTNode} An ASTNode representing a unary expression + */ + createUnaryExpression: function (operator, argument) { + if (operator === "++" || operator === "--") { + return { + type: astNodeTypes.UpdateExpression, + operator: operator, + argument: argument, + prefix: true + }; + } + return { + type: astNodeTypes.UnaryExpression, + operator: operator, + argument: argument, + prefix: true + }; + }, + + /** + * Create an ASTNode representation of a variable declaration + * @param {ASTNode[]} declarations An array of variable declarations + * @param {string} kind The kind of variable created ("var", "let", etc.) + * @returns {ASTNode} An ASTNode representing a variable declaration + */ + createVariableDeclaration: function (declarations, kind) { + return { + type: astNodeTypes.VariableDeclaration, + declarations: declarations, + kind: kind + }; + }, + + /** + * Create an ASTNode representation of a variable declarator + * @param {ASTNode} id The variable ID + * @param {ASTNode} init The variable's initial value + * @returns {ASTNode} An ASTNode representing a variable declarator + */ + createVariableDeclarator: function (id, init) { + return { + type: astNodeTypes.VariableDeclarator, + id: id, + init: init + }; + }, + + /** + * Create an ASTNode representation of a with statement + * @param {ASTNode} object The with statement object expression + * @param {ASTNode} body The with statement body + * @returns {ASTNode} An ASTNode representing a with statement + */ + createWithStatement: function (object, body) { + return { + type: astNodeTypes.WithStatement, + object: object, + body: body + }; + }, + + createYieldExpression: function (argument, delegate) { + return { + type: astNodeTypes.YieldExpression, + argument: argument, + delegate: delegate + }; + }, + + createJSXAttribute: function (name, value) { + return { + type: astNodeTypes.JSXAttribute, + name: name, + value: value || null + }; + }, + + createJSXSpreadAttribute: function (argument) { + return { + type: astNodeTypes.JSXSpreadAttribute, + argument: argument + }; + }, + + createJSXIdentifier: function (name) { + return { + type: astNodeTypes.JSXIdentifier, + name: name + }; + }, + + createJSXNamespacedName: function (namespace, name) { + return { + type: astNodeTypes.JSXNamespacedName, + namespace: namespace, + name: name + }; + }, + + createJSXMemberExpression: function (object, property) { + return { + type: astNodeTypes.JSXMemberExpression, + object: object, + property: property + }; + }, + + createJSXElement: function (openingElement, closingElement, children) { + return { + type: astNodeTypes.JSXElement, + openingElement: openingElement, + closingElement: closingElement, + children: children + }; + }, + + createJSXEmptyExpression: function () { + return { + type: astNodeTypes.JSXEmptyExpression + }; + }, + + createJSXExpressionContainer: function (expression) { + return { + type: astNodeTypes.JSXExpressionContainer, + expression: expression + }; + }, + + createJSXOpeningElement: function (name, attributes, selfClosing) { + return { + type: astNodeTypes.JSXOpeningElement, + name: name, + selfClosing: selfClosing, + attributes: attributes + }; + }, + + createJSXClosingElement: function (name) { + return { + type: astNodeTypes.JSXClosingElement, + name: name + }; + }, + + createExportSpecifier: function (local, exported) { + return { + type: astNodeTypes.ExportSpecifier, + exported: exported || local, + local: local + }; + }, + + createImportDefaultSpecifier: function (local) { + return { + type: astNodeTypes.ImportDefaultSpecifier, + local: local + }; + }, + + createImportNamespaceSpecifier: function (local) { + return { + type: astNodeTypes.ImportNamespaceSpecifier, + local: local + }; + }, + + createExportNamedDeclaration: function (declaration, specifiers, source) { + return { + type: astNodeTypes.ExportNamedDeclaration, + declaration: declaration, + specifiers: specifiers, + source: source + }; + }, + + createExportDefaultDeclaration: function (declaration) { + return { + type: astNodeTypes.ExportDefaultDeclaration, + declaration: declaration + }; + }, + + createExportAllDeclaration: function (source) { + return { + type: astNodeTypes.ExportAllDeclaration, + source: source + }; + }, + + createImportSpecifier: function (local, imported) { + return { + type: astNodeTypes.ImportSpecifier, + local: local || imported, + imported: imported + }; + }, + + createImportDeclaration: function (specifiers, source) { + return { + type: astNodeTypes.ImportDeclaration, + specifiers: specifiers, + source: source + }; + } + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/lib/ast-node-types.js b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/ast-node-types.js new file mode 100644 index 00000000..7976f341 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/ast-node-types.js @@ -0,0 +1,114 @@ +/** + * @fileoverview The AST node types produced by the parser. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2011-2013 Ariya Hidayat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + AssignmentExpression: "AssignmentExpression", + AssignmentPattern: "AssignmentPattern", + ArrayExpression: "ArrayExpression", + ArrayPattern: "ArrayPattern", + ArrowFunctionExpression: "ArrowFunctionExpression", + BlockStatement: "BlockStatement", + BinaryExpression: "BinaryExpression", + BreakStatement: "BreakStatement", + CallExpression: "CallExpression", + CatchClause: "CatchClause", + ClassBody: "ClassBody", + ClassDeclaration: "ClassDeclaration", + ClassExpression: "ClassExpression", + ConditionalExpression: "ConditionalExpression", + ContinueStatement: "ContinueStatement", + DoWhileStatement: "DoWhileStatement", + DebuggerStatement: "DebuggerStatement", + EmptyStatement: "EmptyStatement", + ExpressionStatement: "ExpressionStatement", + ForStatement: "ForStatement", + ForInStatement: "ForInStatement", + ForOfStatement: "ForOfStatement", + FunctionDeclaration: "FunctionDeclaration", + FunctionExpression: "FunctionExpression", + Identifier: "Identifier", + IfStatement: "IfStatement", + Literal: "Literal", + LabeledStatement: "LabeledStatement", + LogicalExpression: "LogicalExpression", + MemberExpression: "MemberExpression", + MethodDefinition: "MethodDefinition", + NewExpression: "NewExpression", + ObjectExpression: "ObjectExpression", + ObjectPattern: "ObjectPattern", + Program: "Program", + Property: "Property", + ReturnStatement: "ReturnStatement", + SequenceExpression: "SequenceExpression", + SpreadElement: "SpreadElement", + SwitchCase: "SwitchCase", + SwitchStatement: "SwitchStatement", + TaggedTemplateExpression: "TaggedTemplateExpression", + TemplateElement: "TemplateElement", + TemplateLiteral: "TemplateLiteral", + ThisExpression: "ThisExpression", + ThrowStatement: "ThrowStatement", + TryStatement: "TryStatement", + UnaryExpression: "UnaryExpression", + UpdateExpression: "UpdateExpression", + VariableDeclaration: "VariableDeclaration", + VariableDeclarator: "VariableDeclarator", + WhileStatement: "WhileStatement", + WithStatement: "WithStatement", + YieldExpression: "YieldExpression", + JSXIdentifier: "JSXIdentifier", + JSXNamespacedName: "JSXNamespacedName", + JSXMemberExpression: "JSXMemberExpression", + JSXEmptyExpression: "JSXEmptyExpression", + JSXExpressionContainer: "JSXExpressionContainer", + JSXElement: "JSXElement", + JSXClosingElement: "JSXClosingElement", + JSXOpeningElement: "JSXOpeningElement", + JSXAttribute: "JSXAttribute", + JSXSpreadAttribute: "JSXSpreadAttribute", + JSXText: "JSXText", + ExportDefaultDeclaration: "ExportDefaultDeclaration", + ExportNamedDeclaration: "ExportNamedDeclaration", + ExportAllDeclaration: "ExportAllDeclaration", + ExportSpecifier: "ExportSpecifier", + ImportDeclaration: "ImportDeclaration", + ImportSpecifier: "ImportSpecifier", + ImportDefaultSpecifier: "ImportDefaultSpecifier", + ImportNamespaceSpecifier: "ImportNamespaceSpecifier" +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/lib/comment-attachment.js b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/comment-attachment.js new file mode 100644 index 00000000..3618bb3b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/comment-attachment.js @@ -0,0 +1,171 @@ +/** + * @fileoverview Attaches comments to the AST. + * @author Nicholas C. Zakas + * @copyright 2015 Nicholas C. Zakas. All rights reserved. + * @copyright 2011-2013 Ariya Hidayat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var astNodeTypes = require("./ast-node-types"); + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +var extra = { + trailingComments: [], + leadingComments: [], + bottomRightStack: [] + }; + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + + reset: function() { + extra.trailingComments = []; + extra.leadingComments = []; + extra.bottomRightStack = []; + }, + + addComment: function(comment) { + extra.trailingComments.push(comment); + extra.leadingComments.push(comment); + }, + + processComment: function(node) { + var lastChild, + trailingComments, + i; + + if (node.type === astNodeTypes.Program) { + if (node.body.length > 0) { + return; + } + } + + if (extra.trailingComments.length > 0) { + + /* + * If the first comment in trailingComments comes after the + * current node, then we're good - all comments in the array will + * come after the node and so it's safe to add then as official + * trailingComments. + */ + if (extra.trailingComments[0].range[0] >= node.range[1]) { + trailingComments = extra.trailingComments; + extra.trailingComments = []; + } else { + + /* + * Otherwise, if the first comment doesn't come after the + * current node, that means we have a mix of leading and trailing + * comments in the array and that leadingComments contains the + * same items as trailingComments. Reset trailingComments to + * zero items and we'll handle this by evaluating leadingComments + * later. + */ + extra.trailingComments.length = 0; + } + } else { + if (extra.bottomRightStack.length > 0 && + extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments && + extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments[0].range[0] >= node.range[1]) { + trailingComments = extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments; + delete extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments; + } + } + + // Eating the stack. + while (extra.bottomRightStack.length > 0 && extra.bottomRightStack[extra.bottomRightStack.length - 1].range[0] >= node.range[0]) { + lastChild = extra.bottomRightStack.pop(); + } + + if (lastChild) { + if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= node.range[0]) { + node.leadingComments = lastChild.leadingComments; + delete lastChild.leadingComments; + } + } else if (extra.leadingComments.length > 0) { + + if (extra.leadingComments[extra.leadingComments.length - 1].range[1] <= node.range[0]) { + node.leadingComments = extra.leadingComments; + extra.leadingComments = []; + } else { + + // https://github.com/eslint/espree/issues/2 + + /* + * In special cases, such as return (without a value) and + * debugger, all comments will end up as leadingComments and + * will otherwise be eliminated. This extra step runs when the + * bottomRightStack is empty and there are comments left + * in leadingComments. + * + * This loop figures out the stopping point between the actual + * leading and trailing comments by finding the location of the + * first comment that comes after the given node. + */ + for (i = 0; i < extra.leadingComments.length; i++) { + if (extra.leadingComments[i].range[1] > node.range[0]) { + break; + } + } + + /* + * Split the array based on the location of the first comment + * that comes after the node. Keep in mind that this could + * result in an empty array, and if so, the array must be + * deleted. + */ + node.leadingComments = extra.leadingComments.slice(0, i); + if (node.leadingComments.length === 0) { + delete node.leadingComments; + } + + /* + * Similarly, trailing comments are attached later. The variable + * must be reset to null if there are no trailing comments. + */ + trailingComments = extra.leadingComments.slice(i); + if (trailingComments.length === 0) { + trailingComments = null; + } + } + } + + if (trailingComments) { + node.trailingComments = trailingComments; + } + + extra.bottomRightStack.push(node); + } + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/lib/features.js b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/features.js new file mode 100644 index 00000000..c33274a4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/features.js @@ -0,0 +1,111 @@ +/** + * @fileoverview The list of feature flags supported by the parser and their default + * settings. + * @author Nicholas C. Zakas + * @copyright 2015 Fred K. Schott. All rights reserved. + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + + // enable parsing of arrow functions + arrowFunctions: false, + + // enable parsing of let and const + blockBindings: true, + + // enable parsing of destructured arrays and objects + destructuring: false, + + // enable parsing of regex u flag + regexUFlag: false, + + // enable parsing of regex y flag + regexYFlag: false, + + // enable parsing of template strings + templateStrings: false, + + // enable parsing binary literals + binaryLiterals: false, + + // enable parsing ES6 octal literals + octalLiterals: false, + + // enable parsing unicode code point escape sequences + unicodeCodePointEscapes: true, + + // enable parsing of default parameters + defaultParams: false, + + // enable parsing of rest parameters + restParams: false, + + // enable parsing of for-of statements + forOf: false, + + // enable parsing computed object literal properties + objectLiteralComputedProperties: false, + + // enable parsing of shorthand object literal methods + objectLiteralShorthandMethods: false, + + // enable parsing of shorthand object literal properties + objectLiteralShorthandProperties: false, + + // Allow duplicate object literal properties (except '__proto__') + objectLiteralDuplicateProperties: false, + + // enable parsing of generators/yield + generators: false, + + // support the spread operator + spread: false, + + // enable super in functions + superInFunctions: false, + + // enable parsing of classes + classes: false, + + // enable parsing of modules + modules: false, + + // React JSX parsing + jsx: false, + + // allow return statement in global scope + globalReturn: false +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/lib/messages.js b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/messages.js new file mode 100644 index 00000000..a7780b64 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/messages.js @@ -0,0 +1,99 @@ +/** + * @fileoverview Error messages returned by the parser. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2011-2013 Ariya Hidayat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +// error messages should be identical to V8 where possible +module.exports = { + UnexpectedToken: "Unexpected token %0", + UnexpectedNumber: "Unexpected number", + UnexpectedString: "Unexpected string", + UnexpectedIdentifier: "Unexpected identifier", + UnexpectedReserved: "Unexpected reserved word", + UnexpectedTemplate: "Unexpected quasi %0", + UnexpectedEOS: "Unexpected end of input", + NewlineAfterThrow: "Illegal newline after throw", + InvalidRegExp: "Invalid regular expression", + InvalidRegExpFlag: "Invalid regular expression flag", + UnterminatedRegExp: "Invalid regular expression: missing /", + InvalidLHSInAssignment: "Invalid left-hand side in assignment", + InvalidLHSInFormalsList: "Invalid left-hand side in formals list", + InvalidLHSInForIn: "Invalid left-hand side in for-in", + MultipleDefaultsInSwitch: "More than one default clause in switch statement", + NoCatchOrFinally: "Missing catch or finally after try", + NoUnintializedConst: "Const must be initialized", + UnknownLabel: "Undefined label '%0'", + Redeclaration: "%0 '%1' has already been declared", + IllegalContinue: "Illegal continue statement", + IllegalBreak: "Illegal break statement", + IllegalReturn: "Illegal return statement", + IllegalYield: "Illegal yield expression", + IllegalSpread: "Illegal spread element", + StrictModeWith: "Strict mode code may not include a with statement", + StrictCatchVariable: "Catch variable may not be eval or arguments in strict mode", + StrictVarName: "Variable name may not be eval or arguments in strict mode", + StrictParamName: "Parameter name eval or arguments is not allowed in strict mode", + StrictParamDupe: "Strict mode function may not have duplicate parameter names", + TemplateOctalLiteral: "Octal literals are not allowed in template strings.", + ParameterAfterRestParameter: "Rest parameter must be final parameter of an argument list", + DefaultRestParameter: "Rest parameter can not have a default value", + ElementAfterSpreadElement: "Spread must be the final element of an element list", + ObjectPatternAsRestParameter: "Invalid rest parameter", + ObjectPatternAsSpread: "Invalid spread argument", + StrictFunctionName: "Function name may not be eval or arguments in strict mode", + StrictOctalLiteral: "Octal literals are not allowed in strict mode.", + StrictDelete: "Delete of an unqualified identifier in strict mode.", + StrictDuplicateProperty: "Duplicate data property in object literal not allowed in strict mode", + DuplicatePrototypeProperty: "Duplicate '__proto__' property in object literal are not allowed", + ConstructorSpecialMethod: "Class constructor may not be an accessor", + DuplicateConstructor: "A class may only have one constructor", + StaticPrototype: "Classes may not have static property named prototype", + AccessorDataProperty: "Object literal may not have data and accessor property with the same name", + AccessorGetSet: "Object literal may not have multiple get/set accessors with the same name", + StrictLHSAssignment: "Assignment to eval or arguments is not allowed in strict mode", + StrictLHSPostfix: "Postfix increment/decrement may not have eval or arguments operand in strict mode", + StrictLHSPrefix: "Prefix increment/decrement may not have eval or arguments operand in strict mode", + StrictReservedWord: "Use of future reserved word in strict mode", + InvalidJSXAttributeValue: "JSX value should be either an expression or a quoted JSX text", + ExpectedJSXClosingTag: "Expected corresponding JSX closing tag for %0", + AdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag", + MissingFromClause: "Missing from clause", + NoAsAfterImportNamespace: "Missing as after import *", + InvalidModuleSpecifier: "Invalid module specifier", + IllegalImportDeclaration: "Illegal import declaration", + IllegalExportDeclaration: "Illegal export declaration" +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/lib/string-map.js b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/string-map.js new file mode 100644 index 00000000..97c87032 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/string-map.js @@ -0,0 +1,55 @@ +/** + * @fileoverview A simple map that helps avoid collisions on the Object prototype. + * @author Jamund Ferguson + * @copyright 2015 Jamund Ferguson. All rights reserved. + * @copyright 2011-2013 Ariya Hidayat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +function StringMap() { + this.$data = {}; +} + +StringMap.prototype.get = function (key) { + key = "$" + key; + return this.$data[key]; +}; + +StringMap.prototype.set = function (key, value) { + key = "$" + key; + this.$data[key] = value; + return this; +}; + +StringMap.prototype.has = function (key) { + key = "$" + key; + return Object.prototype.hasOwnProperty.call(this.$data, key); +}; + +StringMap.prototype.delete = function (key) { + key = "$" + key; + return delete this.$data[key]; +}; + +module.exports = StringMap; diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/lib/syntax.js b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/syntax.js new file mode 100644 index 00000000..7cad1afc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/syntax.js @@ -0,0 +1,187 @@ +/** + * @fileoverview Various syntax/pattern checks for parsing. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2011-2013 Ariya Hidayat + * @copyright 2012-2013 Mathias Bynens + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +// See also tools/generate-identifier-regex.js. +var Regex = { + NonAsciiIdentifierStart: new RegExp("[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]"), + NonAsciiIdentifierPart: new RegExp("[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]"), + LeadingZeros: new RegExp("^0+(?!$)") +}; + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + + Regex: Regex, + + isDecimalDigit: function(ch) { + return (ch >= 48 && ch <= 57); // 0..9 + }, + + isHexDigit: function(ch) { + return "0123456789abcdefABCDEF".indexOf(ch) >= 0; + }, + + isOctalDigit: function(ch) { + return "01234567".indexOf(ch) >= 0; + }, + + // 7.2 White Space + + isWhiteSpace: function(ch) { + return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || + (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); + }, + + // 7.3 Line Terminators + + isLineTerminator: function(ch) { + return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); + }, + + // 7.6 Identifier Names and Identifiers + + isIdentifierStart: function(ch) { + return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) + (ch >= 0x41 && ch <= 0x5A) || // A..Z + (ch >= 0x61 && ch <= 0x7A) || // a..z + (ch === 0x5C) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))); + }, + + isIdentifierPart: function(ch) { + return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) + (ch >= 0x41 && ch <= 0x5A) || // A..Z + (ch >= 0x61 && ch <= 0x7A) || // a..z + (ch >= 0x30 && ch <= 0x39) || // 0..9 + (ch === 0x5C) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))); + }, + + // 7.6.1.2 Future Reserved Words + + isFutureReservedWord: function(id) { + switch (id) { + case "class": + case "enum": + case "export": + case "extends": + case "import": + case "super": + return true; + default: + return false; + } + }, + + isStrictModeReservedWord: function(id) { + switch (id) { + case "implements": + case "interface": + case "package": + case "private": + case "protected": + case "public": + case "static": + case "yield": + case "let": + return true; + default: + return false; + } + }, + + isRestrictedWord: function(id) { + return id === "eval" || id === "arguments"; + }, + + // 7.6.1.1 Keywords + + isKeyword: function(id, strict, ecmaFeatures) { + + if (strict && this.isStrictModeReservedWord(id)) { + return true; + } + + // "const" is specialized as Keyword in V8. + // "yield" and "let" are for compatiblity with SpiderMonkey and ES.next. + // Some others are from future reserved words. + + switch (id.length) { + case 2: + return (id === "if") || (id === "in") || (id === "do"); + case 3: + return (id === "var") || (id === "for") || (id === "new") || + (id === "try") || (id === "let"); + case 4: + return (id === "this") || (id === "else") || (id === "case") || + (id === "void") || (id === "with") || (id === "enum"); + case 5: + return (id === "while") || (id === "break") || (id === "catch") || + (id === "throw") || (id === "const") || (!ecmaFeatures.generators && id === "yield") || + (id === "class") || (id === "super"); + case 6: + return (id === "return") || (id === "typeof") || (id === "delete") || + (id === "switch") || (id === "export") || (id === "import"); + case 7: + return (id === "default") || (id === "finally") || (id === "extends"); + case 8: + return (id === "function") || (id === "continue") || (id === "debugger"); + case 10: + return (id === "instanceof"); + default: + return false; + } + }, + + isJSXIdentifierStart: function(ch) { + // exclude backslash (\) + return (ch !== 92) && this.isIdentifierStart(ch); + }, + + isJSXIdentifierPart: function(ch) { + // exclude backslash (\) and add hyphen (-) + return (ch !== 92) && (ch === 45 || this.isIdentifierPart(ch)); + } + + +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/lib/token-info.js b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/token-info.js new file mode 100644 index 00000000..ea767647 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/token-info.js @@ -0,0 +1,90 @@ +/** + * @fileoverview Contains token information. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2013 Thaddee Tyl + * @copyright 2011-2013 Ariya Hidayat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +var Token = { + BooleanLiteral: 1, + EOF: 2, + Identifier: 3, + Keyword: 4, + NullLiteral: 5, + NumericLiteral: 6, + Punctuator: 7, + StringLiteral: 8, + RegularExpression: 9, + Template: 10, + JSXIdentifier: 11, + JSXText: 12 +}; + +var TokenName = {}; +TokenName[Token.BooleanLiteral] = "Boolean"; +TokenName[Token.EOF] = ""; +TokenName[Token.Identifier] = "Identifier"; +TokenName[Token.Keyword] = "Keyword"; +TokenName[Token.NullLiteral] = "Null"; +TokenName[Token.NumericLiteral] = "Numeric"; +TokenName[Token.Punctuator] = "Punctuator"; +TokenName[Token.StringLiteral] = "String"; +TokenName[Token.RegularExpression] = "RegularExpression"; +TokenName[Token.Template] = "Template"; +TokenName[Token.JSXIdentifier] = "JSXIdentifier"; +TokenName[Token.JSXText] = "JSXText"; + +// A function following one of those tokens is an expression. +var FnExprTokens = ["(", "{", "[", "in", "typeof", "instanceof", "new", + "return", "case", "delete", "throw", "void", + // assignment operators + "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", + "&=", "|=", "^=", ",", + // binary/unary operators + "+", "-", "*", "/", "%", "++", "--", "<<", ">>", ">>>", "&", + "|", "^", "!", "~", "&&", "||", "?", ":", "===", "==", ">=", + "<=", "<", ">", "!=", "!=="]; + + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + Token: Token, + TokenName: TokenName, + FnExprTokens: FnExprTokens +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/lib/xhtml-entities.js b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/xhtml-entities.js new file mode 100644 index 00000000..1ceda1ec --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/lib/xhtml-entities.js @@ -0,0 +1,293 @@ +/** + * @fileoverview The list of XHTML entities that are valid in JSX. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + quot: "\u0022", + amp: "&", + apos: "\u0027", + lt: "<", + gt: ">", + nbsp: "\u00A0", + iexcl: "\u00A1", + cent: "\u00A2", + pound: "\u00A3", + curren: "\u00A4", + yen: "\u00A5", + brvbar: "\u00A6", + sect: "\u00A7", + uml: "\u00A8", + copy: "\u00A9", + ordf: "\u00AA", + laquo: "\u00AB", + not: "\u00AC", + shy: "\u00AD", + reg: "\u00AE", + macr: "\u00AF", + deg: "\u00B0", + plusmn: "\u00B1", + sup2: "\u00B2", + sup3: "\u00B3", + acute: "\u00B4", + micro: "\u00B5", + para: "\u00B6", + middot: "\u00B7", + cedil: "\u00B8", + sup1: "\u00B9", + ordm: "\u00BA", + raquo: "\u00BB", + frac14: "\u00BC", + frac12: "\u00BD", + frac34: "\u00BE", + iquest: "\u00BF", + Agrave: "\u00C0", + Aacute: "\u00C1", + Acirc: "\u00C2", + Atilde: "\u00C3", + Auml: "\u00C4", + Aring: "\u00C5", + AElig: "\u00C6", + Ccedil: "\u00C7", + Egrave: "\u00C8", + Eacute: "\u00C9", + Ecirc: "\u00CA", + Euml: "\u00CB", + Igrave: "\u00CC", + Iacute: "\u00CD", + Icirc: "\u00CE", + Iuml: "\u00CF", + ETH: "\u00D0", + Ntilde: "\u00D1", + Ograve: "\u00D2", + Oacute: "\u00D3", + Ocirc: "\u00D4", + Otilde: "\u00D5", + Ouml: "\u00D6", + times: "\u00D7", + Oslash: "\u00D8", + Ugrave: "\u00D9", + Uacute: "\u00DA", + Ucirc: "\u00DB", + Uuml: "\u00DC", + Yacute: "\u00DD", + THORN: "\u00DE", + szlig: "\u00DF", + agrave: "\u00E0", + aacute: "\u00E1", + acirc: "\u00E2", + atilde: "\u00E3", + auml: "\u00E4", + aring: "\u00E5", + aelig: "\u00E6", + ccedil: "\u00E7", + egrave: "\u00E8", + eacute: "\u00E9", + ecirc: "\u00EA", + euml: "\u00EB", + igrave: "\u00EC", + iacute: "\u00ED", + icirc: "\u00EE", + iuml: "\u00EF", + eth: "\u00F0", + ntilde: "\u00F1", + ograve: "\u00F2", + oacute: "\u00F3", + ocirc: "\u00F4", + otilde: "\u00F5", + ouml: "\u00F6", + divide: "\u00F7", + oslash: "\u00F8", + ugrave: "\u00F9", + uacute: "\u00FA", + ucirc: "\u00FB", + uuml: "\u00FC", + yacute: "\u00FD", + thorn: "\u00FE", + yuml: "\u00FF", + OElig: "\u0152", + oelig: "\u0153", + Scaron: "\u0160", + scaron: "\u0161", + Yuml: "\u0178", + fnof: "\u0192", + circ: "\u02C6", + tilde: "\u02DC", + Alpha: "\u0391", + Beta: "\u0392", + Gamma: "\u0393", + Delta: "\u0394", + Epsilon: "\u0395", + Zeta: "\u0396", + Eta: "\u0397", + Theta: "\u0398", + Iota: "\u0399", + Kappa: "\u039A", + Lambda: "\u039B", + Mu: "\u039C", + Nu: "\u039D", + Xi: "\u039E", + Omicron: "\u039F", + Pi: "\u03A0", + Rho: "\u03A1", + Sigma: "\u03A3", + Tau: "\u03A4", + Upsilon: "\u03A5", + Phi: "\u03A6", + Chi: "\u03A7", + Psi: "\u03A8", + Omega: "\u03A9", + alpha: "\u03B1", + beta: "\u03B2", + gamma: "\u03B3", + delta: "\u03B4", + epsilon: "\u03B5", + zeta: "\u03B6", + eta: "\u03B7", + theta: "\u03B8", + iota: "\u03B9", + kappa: "\u03BA", + lambda: "\u03BB", + mu: "\u03BC", + nu: "\u03BD", + xi: "\u03BE", + omicron: "\u03BF", + pi: "\u03C0", + rho: "\u03C1", + sigmaf: "\u03C2", + sigma: "\u03C3", + tau: "\u03C4", + upsilon: "\u03C5", + phi: "\u03C6", + chi: "\u03C7", + psi: "\u03C8", + omega: "\u03C9", + thetasym: "\u03D1", + upsih: "\u03D2", + piv: "\u03D6", + ensp: "\u2002", + emsp: "\u2003", + thinsp: "\u2009", + zwnj: "\u200C", + zwj: "\u200D", + lrm: "\u200E", + rlm: "\u200F", + ndash: "\u2013", + mdash: "\u2014", + lsquo: "\u2018", + rsquo: "\u2019", + sbquo: "\u201A", + ldquo: "\u201C", + rdquo: "\u201D", + bdquo: "\u201E", + dagger: "\u2020", + Dagger: "\u2021", + bull: "\u2022", + hellip: "\u2026", + permil: "\u2030", + prime: "\u2032", + Prime: "\u2033", + lsaquo: "\u2039", + rsaquo: "\u203A", + oline: "\u203E", + frasl: "\u2044", + euro: "\u20AC", + image: "\u2111", + weierp: "\u2118", + real: "\u211C", + trade: "\u2122", + alefsym: "\u2135", + larr: "\u2190", + uarr: "\u2191", + rarr: "\u2192", + darr: "\u2193", + harr: "\u2194", + crarr: "\u21B5", + lArr: "\u21D0", + uArr: "\u21D1", + rArr: "\u21D2", + dArr: "\u21D3", + hArr: "\u21D4", + forall: "\u2200", + part: "\u2202", + exist: "\u2203", + empty: "\u2205", + nabla: "\u2207", + isin: "\u2208", + notin: "\u2209", + ni: "\u220B", + prod: "\u220F", + sum: "\u2211", + minus: "\u2212", + lowast: "\u2217", + radic: "\u221A", + prop: "\u221D", + infin: "\u221E", + ang: "\u2220", + and: "\u2227", + or: "\u2228", + cap: "\u2229", + cup: "\u222A", + "int": "\u222B", + there4: "\u2234", + sim: "\u223C", + cong: "\u2245", + asymp: "\u2248", + ne: "\u2260", + equiv: "\u2261", + le: "\u2264", + ge: "\u2265", + sub: "\u2282", + sup: "\u2283", + nsub: "\u2284", + sube: "\u2286", + supe: "\u2287", + oplus: "\u2295", + otimes: "\u2297", + perp: "\u22A5", + sdot: "\u22C5", + lceil: "\u2308", + rceil: "\u2309", + lfloor: "\u230A", + rfloor: "\u230B", + lang: "\u2329", + rang: "\u232A", + loz: "\u25CA", + spades: "\u2660", + clubs: "\u2663", + hearts: "\u2665", + diams: "\u2666" +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/package.json b/node_modules/standard/node_modules/eslint/node_modules/espree/package.json new file mode 100644 index 00000000..ff54f270 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/package.json @@ -0,0 +1,108 @@ +{ + "name": "espree", + "description": "An actively-maintained fork of Esprima, the ECMAScript parsing infrastructure for multipurpose analysis", + "author": { + "name": "Nicholas C. Zakas", + "email": "nicholas+npm@nczconsulting.com" + }, + "homepage": "https://github.com/eslint/espree", + "main": "espree.js", + "bin": { + "esparse": "./bin/esparse.js", + "esvalidate": "./bin/esvalidate.js" + }, + "version": "1.12.3", + "files": [ + "bin", + "lib", + "test/run.js", + "test/runner.js", + "test/test.js", + "test/compat.js", + "test/reflect.js", + "espree.js" + ], + "engines": { + "node": ">=0.10.0" + }, + "repository": { + "type": "git", + "url": "http://github.com/eslint/espree.git" + }, + "bugs": { + "url": "http://github.com/eslint/espree.git" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/nzakas/espree/raw/master/LICENSE" + } + ], + "devDependencies": { + "browserify": "^7.0.0", + "chai": "^1.10.0", + "complexity-report": "~0.6.1", + "dateformat": "^1.0.11", + "eslint": "^0.9.2", + "esprima": "git://github.com/ariya/esprima#harmony", + "esprima-fb": "^8001.2001.0-dev-harmony-fb", + "istanbul": "~0.2.6", + "json-diff": "~0.3.1", + "leche": "^1.0.1", + "mocha": "^2.0.1", + "npm-license": "^0.2.3", + "optimist": "~0.6.0", + "regenerate": "~0.5.4", + "semver": "^4.1.1", + "shelljs": "^0.3.0", + "shelljs-nodecli": "^0.1.1", + "unicode-6.3.0": "~0.1.0" + }, + "keywords": [ + "ast", + "ecmascript", + "javascript", + "parser", + "syntax" + ], + "scripts": { + "generate-regex": "node tools/generate-identifier-regex.js", + "test": "npm run-script lint && node Makefile.js test && node test/run.js", + "lint": "node Makefile.js lint", + "patch": "node Makefile.js patch", + "minor": "node Makefile.js minor", + "major": "node Makefile.js major", + "browserify": "node Makefile.js browserify", + "coverage": "npm run-script analyze-coverage && npm run-script check-coverage", + "analyze-coverage": "node node_modules/istanbul/lib/cli.js cover test/runner.js", + "check-coverage": "node node_modules/istanbul/lib/cli.js check-coverage --statement 99 --branch 99 --function 99", + "complexity": "npm run-script analyze-complexity && npm run-script check-complexity", + "analyze-complexity": "node tools/list-complexity.js", + "check-complexity": "node node_modules/complexity-report/src/cli.js --maxcc 14 --silent -l -w espree.js", + "benchmark": "node test/benchmarks.js", + "benchmark-quick": "node test/benchmarks.js quick" + }, + "dependencies": {}, + "gitHead": "ee8f6d35943ed13af619270e320ce2d6109d6796", + "_id": "espree@1.12.3", + "_shasum": "04ceeada91bda077a38c040c125ba186b13bb3cc", + "_from": "espree@>=1.12.0 <2.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "nzakas", + "email": "nicholas@nczconsulting.com" + }, + "maintainers": [ + { + "name": "nzakas", + "email": "nicholas@nczconsulting.com" + } + ], + "dist": { + "shasum": "04ceeada91bda077a38c040c125ba186b13bb3cc", + "tarball": "http://registry.npmjs.org/espree/-/espree-1.12.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/espree/-/espree-1.12.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/test/compat.js b/node_modules/standard/node_modules/eslint/node_modules/espree/test/compat.js new file mode 100644 index 00000000..abd623aa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/test/compat.js @@ -0,0 +1,255 @@ +/* + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint node: true */ +/*global document: true, window:true, espree: true, testReflect: true */ + +var runTests; + +function getContext(espree, reportCase, reportFailure) { + 'use strict'; + + var Reflect, Pattern; + + // Maps Mozilla Reflect object to our espree parser. + Reflect = { + parse: function (code) { + var result; + + reportCase(code); + + try { + result = espree.parse(code); + } catch (error) { + result = error; + } + + return result; + } + }; + + // This is used by Reflect test suite to match a syntax tree. + Pattern = function (obj) { + var pattern; + + // Poor man's deep object cloning. + pattern = JSON.parse(JSON.stringify(obj)); + + // Special handling for regular expression literal since we need to + // convert it to a string literal, otherwise it will be decoded + // as object "{}" and the regular expression would be lost. + if (obj.type && obj.type === 'Literal') { + if (obj.value instanceof RegExp) { + pattern = { + type: obj.type, + value: obj.value.toString() + }; + } + } + + // Special handling for branch statement because SpiderMonkey + // prefers to put the 'alternate' property before 'consequent'. + if (obj.type && obj.type === 'IfStatement') { + pattern = { + type: pattern.type, + test: pattern.test, + consequent: pattern.consequent, + alternate: pattern.alternate + }; + } + + // Special handling for do while statement because SpiderMonkey + // prefers to put the 'test' property before 'body'. + if (obj.type && obj.type === 'DoWhileStatement') { + pattern = { + type: pattern.type, + body: pattern.body, + test: pattern.test + }; + } + + // Remove special properties on Property node + if (obj.type && obj.type === 'Property') { + pattern = { + type: pattern.type, + key: pattern.key, + value: pattern.value, + kind: pattern.kind + }; + } + + function adjustRegexLiteralAndRaw(key, value) { + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } else if (key === 'raw' && typeof value === "string") { + // Ignore Espree-specific 'raw' property. + return undefined; + } else if (key === 'regex' && typeof value === "object") { + // Ignore Espree-specific 'regex' property. + return undefined; + } + return value; + } + + + if (obj.type && (obj.type === 'Program')) { + pattern.assert = function (tree) { + var actual, expected; + actual = JSON.stringify(tree, adjustRegexLiteralAndRaw, 4); + expected = JSON.stringify(obj, null, 4); + + if (expected !== actual) { + reportFailure(expected, actual); + } + }; + } + + return pattern; + }; + + return { + Reflect: Reflect, + Pattern: Pattern + }; +} + +if (typeof window !== 'undefined') { + // Run all tests in a browser environment. + runTests = function () { + 'use strict'; + + var total = 0, + failures = 0; + + function setText(el, str) { + if (typeof el.innerText === 'string') { + el.innerText = str; + } else { + el.textContent = str; + } + } + + function reportCase(code) { + var report, e; + report = document.getElementById('report'); + e = document.createElement('pre'); + e.setAttribute('class', 'code'); + setText(e, code); + report.appendChild(e); + total += 1; + } + + function reportFailure(expected, actual) { + var report, e; + + failures += 1; + + report = document.getElementById('report'); + + e = document.createElement('p'); + setText(e, 'Expected'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'expected'); + setText(e, expected); + report.appendChild(e); + + e = document.createElement('p'); + setText(e, 'Actual'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'actual'); + setText(e, actual); + report.appendChild(e); + } + + setText(document.getElementById('version'), espree.version); + + window.setTimeout(function () { + var tick, context = getContext(espree, reportCase, reportFailure); + + tick = new Date(); + testReflect(context.Reflect, context.Pattern); + tick = (new Date()) - tick; + + if (failures > 0) { + document.getElementById('status').className = 'alert-box alert'; + setText(document.getElementById('status'), total + ' tests. ' + + 'Failures: ' + failures + '. ' + tick + ' ms'); + } else { + document.getElementById('status').className = 'alert-box success'; + setText(document.getElementById('status'), total + ' tests. ' + + 'No failure. ' + tick + ' ms'); + } + }, 11); + }; +} else { + (function (global) { + 'use strict'; + var espree = require('../espree'), + tick, + total = 0, + failures = [], + header, + current, + context; + + function reportCase(code) { + total += 1; + current = code; + } + + function reportFailure(expected, actual) { + failures.push({ + source: current, + expected: expected.toString(), + actual: actual.toString() + }); + } + + context = getContext(espree, reportCase, reportFailure); + + tick = new Date(); + require('./reflect').testReflect(context.Reflect, context.Pattern); + tick = (new Date()) - tick; + + header = total + ' tests. ' + failures.length + ' failures. ' + + tick + ' ms'; + if (failures.length) { + console.error(header); + failures.forEach(function (failure) { + console.error(failure.source + ': Expected\n ' + + failure.expected.split('\n').join('\n ') + + '\nto match\n ' + failure.actual); + }); + } else { + console.log(header); + } + process.exit(failures.length === 0 ? 0 : 1); + }(this)); +} +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/test/reflect.js b/node_modules/standard/node_modules/eslint/node_modules/espree/test/reflect.js new file mode 100644 index 00000000..a4740fbb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/test/reflect.js @@ -0,0 +1,422 @@ +// This is modified from Mozilla Reflect.parse test suite (the file is located +// at js/src/tests/js1_8_5/extensions/reflect-parse.js in the source tree). +// +// Some notable changes: +// * Removed unsupported features (destructuring, let, comprehensions...). +// * Removed tests for E4X (ECMAScript for XML). +// * Removed everything related to builder. +// * Enclosed every 'Pattern' construct with a scope. +// * Tweaked some expected tree to remove generator field. +// * Removed the test for bug 632030 and bug 632024. + +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +(function (exports) { + +function testReflect(Reflect, Pattern) { + +function program(elts) { return Pattern({ type: "Program", body: elts }) } +function exprStmt(expr) { return Pattern({ type: "ExpressionStatement", expression: expr }) } +function throwStmt(expr) { return Pattern({ type: "ThrowStatement", argument: expr }) } +function returnStmt(expr) { return Pattern({ type: "ReturnStatement", argument: expr }) } +function yieldExpr(expr) { return Pattern({ type: "YieldExpression", argument: expr }) } +function lit(val) { return Pattern({ type: "Literal", value: val }) } +var thisExpr = Pattern({ type: "ThisExpression" }); +function funDecl(id, params, body) { return Pattern({ type: "FunctionDeclaration", + id: id, + params: params, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }) } +function genFunDecl(id, params, body) { return Pattern({ type: "FunctionDeclaration", + id: id, + params: params, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }) } +function declarator(id, init) { return Pattern({ type: "VariableDeclarator", id: id, init: init }) } +function varDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "var" }) } +function letDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "let" }) } +function constDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "const" }) } +function ident(name) { return Pattern({ type: "Identifier", name: name }) } +function dotExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: false, object: obj, property: id }) } +function memExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: true, object: obj, property: id }) } +function forStmt(init, test, update, body) { return Pattern({ type: "ForStatement", init: init, test: test, update: update, body: body }) } +function forInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: false }) } +function forEachInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: true }) } +function breakStmt(lab) { return Pattern({ type: "BreakStatement", label: lab }) } +function continueStmt(lab) { return Pattern({ type: "ContinueStatement", label: lab }) } +function blockStmt(body) { return Pattern({ type: "BlockStatement", body: body }) } +var emptyStmt = Pattern({ type: "EmptyStatement" }); +function ifStmt(test, cons, alt) { return Pattern({ type: "IfStatement", test: test, alternate: alt, consequent: cons }) } +function labStmt(lab, stmt) { return Pattern({ type: "LabeledStatement", label: lab, body: stmt }) } +function withStmt(obj, stmt) { return Pattern({ type: "WithStatement", object: obj, body: stmt }) } +function whileStmt(test, stmt) { return Pattern({ type: "WhileStatement", test: test, body: stmt }) } +function doStmt(stmt, test) { return Pattern({ type: "DoWhileStatement", test: test, body: stmt }) } +function switchStmt(disc, cases) { return Pattern({ type: "SwitchStatement", discriminant: disc, cases: cases }) } +function caseClause(test, stmts) { return Pattern({ type: "SwitchCase", test: test, consequent: stmts }) } +function defaultClause(stmts) { return Pattern({ type: "SwitchCase", test: null, consequent: stmts }) } +function catchClause(id, guard, body) { if (guard) { return Pattern({ type: "GuardedCatchClause", param: id, guard: guard, body: body }) } else { return Pattern({ type: "CatchClause", param: id, body: body }) } } +function tryStmt(body, guarded, catches, fin) { return Pattern({ type: "TryStatement", block: body, guardedHandlers: guarded, handlers: catches, handler: (catches.length > 0) ? catches[0] : null, finalizer: fin }) } +function letStmt(head, body) { return Pattern({ type: "LetStatement", head: head, body: body }) } +function funExpr(id, args, body, gen) { return Pattern({ type: "FunctionExpression", + id: id, + params: args, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }) } +function genFunExpr(id, args, body) { return Pattern({ type: "FunctionExpression", + id: id, + params: args, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }) } + +function unExpr(op, arg) { return Pattern({ type: "UnaryExpression", operator: op, argument: arg, prefix: true }) } +function binExpr(op, left, right) { return Pattern({ type: "BinaryExpression", operator: op, left: left, right: right }) } +function aExpr(op, left, right) { return Pattern({ type: "AssignmentExpression", operator: op, left: left, right: right }) } +function updExpr(op, arg, prefix) { return Pattern({ type: "UpdateExpression", operator: op, argument: arg, prefix: prefix }) } +function logExpr(op, left, right) { return Pattern({ type: "LogicalExpression", operator: op, left: left, right: right }) } + +function condExpr(test, cons, alt) { return Pattern({ type: "ConditionalExpression", test: test, consequent: cons, alternate: alt }) } +function seqExpr(exprs) { return Pattern({ type: "SequenceExpression", expressions: exprs }) } +function newExpr(callee, args) { return Pattern({ type: "NewExpression", callee: callee, arguments: args }) } +function callExpr(callee, args) { return Pattern({ type: "CallExpression", callee: callee, arguments: args }) } +function arrExpr(elts) { return Pattern({ type: "ArrayExpression", elements: elts }) } +function objExpr(elts) { return Pattern({ type: "ObjectExpression", properties: elts }) } +function objProp(key, value, kind) { return Pattern({ type: "Property", key: key, value: value, kind: kind }) } + +function arrPatt(elts) { return Pattern({ type: "ArrayPattern", elements: elts }) } +function objPatt(elts) { return Pattern({ type: "ObjectPattern", properties: elts }) } + +function localSrc(src) { return "(function(){ " + src + " })" } +function localPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([patt])))]) } +function blockSrc(src) { return "(function(){ { " + src + " } })" } +function blockPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([blockStmt([patt])])))]) } + +function assertBlockStmt(src, patt) { + blockPatt(patt).assert(Reflect.parse(blockSrc(src))); +} + +function assertBlockExpr(src, patt) { + assertBlockStmt(src, exprStmt(patt)); +} + +function assertBlockDecl(src, patt, builder) { + blockPatt(patt).assert(Reflect.parse(blockSrc(src), {builder: builder})); +} + +function assertLocalStmt(src, patt) { + localPatt(patt).assert(Reflect.parse(localSrc(src))); +} + +function assertLocalExpr(src, patt) { + assertLocalStmt(src, exprStmt(patt)); +} + +function assertLocalDecl(src, patt) { + localPatt(patt).assert(Reflect.parse(localSrc(src))); +} + +function assertGlobalStmt(src, patt, builder) { + program([patt]).assert(Reflect.parse(src, {builder: builder})); +} + +function assertGlobalExpr(src, patt, builder) { + program([exprStmt(patt)]).assert(Reflect.parse(src, {builder: builder})); + //assertStmt(src, exprStmt(patt)); +} + +function assertGlobalDecl(src, patt) { + program([patt]).assert(Reflect.parse(src)); +} + +function assertProg(src, patt) { + program(patt).assert(Reflect.parse(src)); +} + +function assertStmt(src, patt) { + assertLocalStmt(src, patt); + assertGlobalStmt(src, patt); + assertBlockStmt(src, patt); +} + +function assertExpr(src, patt) { + assertLocalExpr(src, patt); + assertGlobalExpr(src, patt); + assertBlockExpr(src, patt); +} + +function assertDecl(src, patt) { + assertLocalDecl(src, patt); + assertGlobalDecl(src, patt); + assertBlockDecl(src, patt); +} + +function assertError(src, errorType) { + try { + Reflect.parse(src); + } catch (e) { + return; + } + throw new Error("expected " + errorType.name + " for " + uneval(src)); +} + + +// general tests + +// NB: These are useful but for now jit-test doesn't do I/O reliably. + +//program(_).assert(Reflect.parse(snarf('data/flapjax.txt'))); +//program(_).assert(Reflect.parse(snarf('data/jquery-1.4.2.txt'))); +//program(_).assert(Reflect.parse(snarf('data/prototype.js'))); +//program(_).assert(Reflect.parse(snarf('data/dojo.js.uncompressed.js'))); +//program(_).assert(Reflect.parse(snarf('data/mootools-1.2.4-core-nc.js'))); + + +// declarations + +assertDecl("var x = 1, y = 2, z = 3", + varDecl([declarator(ident("x"), lit(1)), + declarator(ident("y"), lit(2)), + declarator(ident("z"), lit(3))])); +assertDecl("var x, y, z", + varDecl([declarator(ident("x"), null), + declarator(ident("y"), null), + declarator(ident("z"), null)])); +assertDecl("function foo() { }", + funDecl(ident("foo"), [], blockStmt([]))); +assertDecl("function foo() { return 42 }", + funDecl(ident("foo"), [], blockStmt([returnStmt(lit(42))]))); + + +// Bug 591437: rebound args have their defs turned into uses +assertDecl("function f(a) { function a() { } }", + funDecl(ident("f"), [ident("a")], blockStmt([funDecl(ident("a"), [], blockStmt([]))]))); +assertDecl("function f(a,b,c) { function b() { } }", + funDecl(ident("f"), [ident("a"),ident("b"),ident("c")], blockStmt([funDecl(ident("b"), [], blockStmt([]))]))); + +// expressions + +assertExpr("true", lit(true)); +assertExpr("false", lit(false)); +assertExpr("42", lit(42)); +assertExpr("(/asdf/)", lit(/asdf/)); +assertExpr("this", thisExpr); +assertExpr("foo", ident("foo")); +assertExpr("foo.bar", dotExpr(ident("foo"), ident("bar"))); +assertExpr("foo[bar]", memExpr(ident("foo"), ident("bar"))); +assertExpr("(function(){})", funExpr(null, [], blockStmt([]))); +assertExpr("(function f() {})", funExpr(ident("f"), [], blockStmt([]))); +assertExpr("(function f(x,y,z) {})", funExpr(ident("f"), [ident("x"),ident("y"),ident("z")], blockStmt([]))); +assertExpr("(++x)", updExpr("++", ident("x"), true)); +assertExpr("(x++)", updExpr("++", ident("x"), false)); +assertExpr("(+x)", unExpr("+", ident("x"))); +assertExpr("(-x)", unExpr("-", ident("x"))); +assertExpr("(!x)", unExpr("!", ident("x"))); +assertExpr("(~x)", unExpr("~", ident("x"))); +assertExpr("(delete x)", unExpr("delete", ident("x"))); +assertExpr("(typeof x)", unExpr("typeof", ident("x"))); +assertExpr("(void x)", unExpr("void", ident("x"))); +assertExpr("(x == y)", binExpr("==", ident("x"), ident("y"))); +assertExpr("(x != y)", binExpr("!=", ident("x"), ident("y"))); +assertExpr("(x === y)", binExpr("===", ident("x"), ident("y"))); +assertExpr("(x !== y)", binExpr("!==", ident("x"), ident("y"))); +assertExpr("(x < y)", binExpr("<", ident("x"), ident("y"))); +assertExpr("(x <= y)", binExpr("<=", ident("x"), ident("y"))); +assertExpr("(x > y)", binExpr(">", ident("x"), ident("y"))); +assertExpr("(x >= y)", binExpr(">=", ident("x"), ident("y"))); +assertExpr("(x << y)", binExpr("<<", ident("x"), ident("y"))); +assertExpr("(x >> y)", binExpr(">>", ident("x"), ident("y"))); +assertExpr("(x >>> y)", binExpr(">>>", ident("x"), ident("y"))); +assertExpr("(x + y)", binExpr("+", ident("x"), ident("y"))); +assertExpr("(w + x + y + z)", binExpr("+", binExpr("+", binExpr("+", ident("w"), ident("x")), ident("y")), ident("z"))); +assertExpr("(x - y)", binExpr("-", ident("x"), ident("y"))); +assertExpr("(w - x - y - z)", binExpr("-", binExpr("-", binExpr("-", ident("w"), ident("x")), ident("y")), ident("z"))); +assertExpr("(x * y)", binExpr("*", ident("x"), ident("y"))); +assertExpr("(x / y)", binExpr("/", ident("x"), ident("y"))); +assertExpr("(x % y)", binExpr("%", ident("x"), ident("y"))); +assertExpr("(x | y)", binExpr("|", ident("x"), ident("y"))); +assertExpr("(x ^ y)", binExpr("^", ident("x"), ident("y"))); +assertExpr("(x & y)", binExpr("&", ident("x"), ident("y"))); +assertExpr("(x in y)", binExpr("in", ident("x"), ident("y"))); +assertExpr("(x instanceof y)", binExpr("instanceof", ident("x"), ident("y"))); +assertExpr("(x = y)", aExpr("=", ident("x"), ident("y"))); +assertExpr("(x += y)", aExpr("+=", ident("x"), ident("y"))); +assertExpr("(x -= y)", aExpr("-=", ident("x"), ident("y"))); +assertExpr("(x *= y)", aExpr("*=", ident("x"), ident("y"))); +assertExpr("(x /= y)", aExpr("/=", ident("x"), ident("y"))); +assertExpr("(x %= y)", aExpr("%=", ident("x"), ident("y"))); +assertExpr("(x <<= y)", aExpr("<<=", ident("x"), ident("y"))); +assertExpr("(x >>= y)", aExpr(">>=", ident("x"), ident("y"))); +assertExpr("(x >>>= y)", aExpr(">>>=", ident("x"), ident("y"))); +assertExpr("(x |= y)", aExpr("|=", ident("x"), ident("y"))); +assertExpr("(x ^= y)", aExpr("^=", ident("x"), ident("y"))); +assertExpr("(x &= y)", aExpr("&=", ident("x"), ident("y"))); +assertExpr("(x || y)", logExpr("||", ident("x"), ident("y"))); +assertExpr("(x && y)", logExpr("&&", ident("x"), ident("y"))); +assertExpr("(w || x || y || z)", logExpr("||", logExpr("||", logExpr("||", ident("w"), ident("x")), ident("y")), ident("z"))) +assertExpr("(x ? y : z)", condExpr(ident("x"), ident("y"), ident("z"))); +assertExpr("(x,y)", seqExpr([ident("x"),ident("y")])) +assertExpr("(x,y,z)", seqExpr([ident("x"),ident("y"),ident("z")])) +assertExpr("(a,b,c,d,e,f,g)", seqExpr([ident("a"),ident("b"),ident("c"),ident("d"),ident("e"),ident("f"),ident("g")])); +assertExpr("(new Object)", newExpr(ident("Object"), [])); +assertExpr("(new Object())", newExpr(ident("Object"), [])); +assertExpr("(new Object(42))", newExpr(ident("Object"), [lit(42)])); +assertExpr("(new Object(1,2,3))", newExpr(ident("Object"), [lit(1),lit(2),lit(3)])); +assertExpr("(String())", callExpr(ident("String"), [])); +assertExpr("(String(42))", callExpr(ident("String"), [lit(42)])); +assertExpr("(String(1,2,3))", callExpr(ident("String"), [lit(1),lit(2),lit(3)])); +assertExpr("[]", arrExpr([])); +assertExpr("[1]", arrExpr([lit(1)])); +assertExpr("[1,2]", arrExpr([lit(1),lit(2)])); +assertExpr("[1,2,3]", arrExpr([lit(1),lit(2),lit(3)])); +assertExpr("[1,,2,3]", arrExpr([lit(1),,lit(2),lit(3)])); +assertExpr("[1,,,2,3]", arrExpr([lit(1),,,lit(2),lit(3)])); +assertExpr("[1,,,2,,3]", arrExpr([lit(1),,,lit(2),,lit(3)])); +assertExpr("[1,,,2,,,3]", arrExpr([lit(1),,,lit(2),,,lit(3)])); +assertExpr("[,1,2,3]", arrExpr([,lit(1),lit(2),lit(3)])); +assertExpr("[,,1,2,3]", arrExpr([,,lit(1),lit(2),lit(3)])); +assertExpr("[,,,1,2,3]", arrExpr([,,,lit(1),lit(2),lit(3)])); +assertExpr("[,,,1,2,3,]", arrExpr([,,,lit(1),lit(2),lit(3)])); +assertExpr("[,,,1,2,3,,]", arrExpr([,,,lit(1),lit(2),lit(3),undefined])); +assertExpr("[,,,1,2,3,,,]", arrExpr([,,,lit(1),lit(2),lit(3),undefined,undefined])); +assertExpr("[,,,,,]", arrExpr([undefined,undefined,undefined,undefined,undefined])); +assertExpr("({})", objExpr([])); +assertExpr("({x:1})", objExpr([objProp(ident("x"), lit(1), "init")])); +assertExpr("({x:1, y:2})", objExpr([objProp(ident("x"), lit(1), "init"), + objProp(ident("y"), lit(2), "init")])); +assertExpr("({x:1, y:2, z:3})", objExpr([objProp(ident("x"), lit(1), "init"), + objProp(ident("y"), lit(2), "init"), + objProp(ident("z"), lit(3), "init") ])); +assertExpr("({x:1, 'y':2, z:3})", objExpr([objProp(ident("x"), lit(1), "init"), + objProp(lit("y"), lit(2), "init"), + objProp(ident("z"), lit(3), "init") ])); +assertExpr("({'x':1, 'y':2, z:3})", objExpr([objProp(lit("x"), lit(1), "init"), + objProp(lit("y"), lit(2), "init"), + objProp(ident("z"), lit(3), "init") ])); +assertExpr("({'x':1, 'y':2, 3:3})", objExpr([objProp(lit("x"), lit(1), "init"), + objProp(lit("y"), lit(2), "init"), + objProp(lit(3), lit(3), "init") ])); + +// Bug 571617: eliminate constant-folding +assertExpr("2 + 3", binExpr("+", lit(2), lit(3))); + +// Bug 632026: constant-folding +assertExpr("typeof(0?0:a)", unExpr("typeof", condExpr(lit(0), lit(0), ident("a")))); + +// Bug 632056: constant-folding +program([exprStmt(ident("f")), + ifStmt(lit(1), + funDecl(ident("f"), [], blockStmt([])), + null)]).assert(Reflect.parse("f; if (1) function f(){}")); + +// statements + +assertStmt("throw 42", throwStmt(lit(42))); +assertStmt("for (;;) break", forStmt(null, null, null, breakStmt(null))); +assertStmt("for (x; y; z) break", forStmt(ident("x"), ident("y"), ident("z"), breakStmt(null))); +assertStmt("for (var x; y; z) break", forStmt(varDecl([declarator(ident("x"), null)]), ident("y"), ident("z"), breakStmt(null))); +assertStmt("for (var x = 42; y; z) break", forStmt(varDecl([declarator(ident("x"), lit(42))]), ident("y"), ident("z"), breakStmt(null))); +assertStmt("for (x; ; z) break", forStmt(ident("x"), null, ident("z"), breakStmt(null))); +assertStmt("for (var x; ; z) break", forStmt(varDecl([declarator(ident("x"), null)]), null, ident("z"), breakStmt(null))); +assertStmt("for (var x = 42; ; z) break", forStmt(varDecl([declarator(ident("x"), lit(42))]), null, ident("z"), breakStmt(null))); +assertStmt("for (x; y; ) break", forStmt(ident("x"), ident("y"), null, breakStmt(null))); +assertStmt("for (var x; y; ) break", forStmt(varDecl([declarator(ident("x"), null)]), ident("y"), null, breakStmt(null))); +assertStmt("for (var x = 42; y; ) break", forStmt(varDecl([declarator(ident("x"),lit(42))]), ident("y"), null, breakStmt(null))); +assertStmt("for (var x in y) break", forInStmt(varDecl([declarator(ident("x"),null)]), ident("y"), breakStmt(null))); +assertStmt("for (x in y) break", forInStmt(ident("x"), ident("y"), breakStmt(null))); +assertStmt("{ }", blockStmt([])); +assertStmt("{ throw 1; throw 2; throw 3; }", blockStmt([ throwStmt(lit(1)), throwStmt(lit(2)), throwStmt(lit(3))])); +assertStmt(";", emptyStmt); +assertStmt("if (foo) throw 42;", ifStmt(ident("foo"), throwStmt(lit(42)), null)); +assertStmt("if (foo) throw 42; else true;", ifStmt(ident("foo"), throwStmt(lit(42)), exprStmt(lit(true)))); +assertStmt("if (foo) { throw 1; throw 2; throw 3; }", + ifStmt(ident("foo"), + blockStmt([throwStmt(lit(1)), throwStmt(lit(2)), throwStmt(lit(3))]), + null)); +assertStmt("if (foo) { throw 1; throw 2; throw 3; } else true;", + ifStmt(ident("foo"), + blockStmt([throwStmt(lit(1)), throwStmt(lit(2)), throwStmt(lit(3))]), + exprStmt(lit(true)))); +assertStmt("foo: for(;;) break foo;", labStmt(ident("foo"), forStmt(null, null, null, breakStmt(ident("foo"))))); +assertStmt("foo: for(;;) continue foo;", labStmt(ident("foo"), forStmt(null, null, null, continueStmt(ident("foo"))))); +assertStmt("with (obj) { }", withStmt(ident("obj"), blockStmt([]))); +assertStmt("with (obj) { obj; }", withStmt(ident("obj"), blockStmt([exprStmt(ident("obj"))]))); +assertStmt("while (foo) { }", whileStmt(ident("foo"), blockStmt([]))); +assertStmt("while (foo) { foo; }", whileStmt(ident("foo"), blockStmt([exprStmt(ident("foo"))]))); +assertStmt("do { } while (foo);", doStmt(blockStmt([]), ident("foo"))); +assertStmt("do { foo; } while (foo)", doStmt(blockStmt([exprStmt(ident("foo"))]), ident("foo"))); +assertStmt("switch (foo) { case 1: 1; break; case 2: 2; break; default: 3; }", + switchStmt(ident("foo"), + [ caseClause(lit(1), [ exprStmt(lit(1)), breakStmt(null) ]), + caseClause(lit(2), [ exprStmt(lit(2)), breakStmt(null) ]), + defaultClause([ exprStmt(lit(3)) ]) ])); +assertStmt("switch (foo) { case 1: 1; break; case 2: 2; break; default: 3; case 42: 42; }", + switchStmt(ident("foo"), + [ caseClause(lit(1), [ exprStmt(lit(1)), breakStmt(null) ]), + caseClause(lit(2), [ exprStmt(lit(2)), breakStmt(null) ]), + defaultClause([ exprStmt(lit(3)) ]), + caseClause(lit(42), [ exprStmt(lit(42)) ]) ])); +assertStmt("try { } catch (e) { }", + tryStmt(blockStmt([]), + [], + [ catchClause(ident("e"), null, blockStmt([])) ], + null)); +assertStmt("try { } catch (e) { } finally { }", + tryStmt(blockStmt([]), + [], + [ catchClause(ident("e"), null, blockStmt([])) ], + blockStmt([]))); +assertStmt("try { } finally { }", + tryStmt(blockStmt([]), + [], + [], + blockStmt([]))); + +// redeclarations (TOK_NAME nodes with lexdef) + +assertStmt("function f() { function g() { } function g() { } }", + funDecl(ident("f"), [], blockStmt([funDecl(ident("g"), [], blockStmt([])), + funDecl(ident("g"), [], blockStmt([]))]))); + +assertStmt("function f() { function g() { } function g() { return 42 } }", + funDecl(ident("f"), [], blockStmt([funDecl(ident("g"), [], blockStmt([])), + funDecl(ident("g"), [], blockStmt([returnStmt(lit(42))]))]))); + +assertStmt("function f() { var x = 42; var x = 43; }", + funDecl(ident("f"), [], blockStmt([varDecl([declarator(ident("x"),lit(42))]), + varDecl([declarator(ident("x"),lit(43))])]))); + +// getters and setters + + assertExpr("({ get x() { return 42 } })", + objExpr([ objProp(ident("x"), + funExpr(null, [], blockStmt([returnStmt(lit(42))])), + "get" ) ])); + assertExpr("({ set x(v) { return 42 } })", + objExpr([ objProp(ident("x"), + funExpr(null, [ident("v")], blockStmt([returnStmt(lit(42))])), + "set" ) ])); + +} + +exports.testReflect = testReflect; + +}(typeof exports === 'undefined' ? this : exports)); diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/test/run.js b/node_modules/standard/node_modules/eslint/node_modules/espree/test/run.js new file mode 100644 index 00000000..bd303e05 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/test/run.js @@ -0,0 +1,68 @@ +/* + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint node:true */ + +(function () { + 'use strict'; + + var child = require('child_process'), + nodejs = '"' + process.execPath + '"', + ret = 0, + suites, + index; + + suites = [ + 'runner', + // TODO: Figure out what to do about this test...remove? + // 'compat', + 'parselibs' + ]; + + function nextTest() { + var suite = suites[index]; + + if (index < suites.length) { + child.exec(nodejs + ' ./test/' + suite + '.js', function (err, stdout, stderr) { + if (stdout) { + process.stdout.write(suite + ': ' + stdout); + } + if (stderr) { + process.stderr.write(suite + ': ' + stderr); + } + if (err) { + ret = err.code; + } + index += 1; + nextTest(); + }); + } else { + process.exit(ret); + } + } + + index = 0; + nextTest(); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/test/runner.js b/node_modules/standard/node_modules/eslint/node_modules/espree/test/runner.js new file mode 100644 index 00000000..a29f29e1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/test/runner.js @@ -0,0 +1,492 @@ +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + Copyright (C) 2011 Yusuke Suzuki + Copyright (C) 2011 Arpad Borsos + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint browser:true node:true */ +/*global espree:true, testFixture:true */ + +var runTests; + +// Special handling for regular expression literal since we need to +// convert it to a string literal, otherwise it will be decoded +// as object "{}" and the regular expression would be lost. +function adjustRegexLiteral(key, value) { + 'use strict'; + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } + return value; +} + +function NotMatchingError(expected, actual) { + 'use strict'; + Error.call(this, 'Expected '); + this.expected = expected; + this.actual = actual; +} +NotMatchingError.prototype = new Error(); + +function errorToObject(e) { + 'use strict'; + var msg = e.toString(); + + // Opera 9.64 produces an non-standard string in toString(). + if (msg.substr(0, 6) !== 'Error:') { + if (typeof e.message === 'string') { + msg = 'Error: ' + e.message; + } + } + + return { + index: e.index, + lineNumber: e.lineNumber, + column: e.column, + message: msg + }; +} + +function sortedObject(o) { + if (o === null) { + return o; + } + if (o instanceof Array) { + return o.map(sortedObject); + } + if (typeof o !== 'object') { + return o; + } + if (o instanceof RegExp) { + return o; + } + var keys = Object.keys(o); + var result = { + range: undefined, + loc: undefined + }; + keys.forEach(function (key) { + if (o.hasOwnProperty(key)){ + result[key] = sortedObject(o[key]); + } + }); + return result; +} + +function hasAttachedComment(syntax) { + var key; + for (key in syntax) { + if (key === 'leadingComments' || key === 'trailingComments') { + return true; + } + if (typeof syntax[key] === 'object' && syntax[key] !== null) { + if (hasAttachedComment(syntax[key])) { + return true; + } + } + } + return false; +} + +function testParse(espree, code, syntax) { + 'use strict'; + var expected, tree, actual, options, StringObject, i, len, err; + + // alias, so that JSLint does not complain. + StringObject = String; + + options = { + comment: (typeof syntax.comments !== 'undefined'), + range: true, + loc: true, + tokens: (typeof syntax.tokens !== 'undefined'), + raw: true, + tolerant: (typeof syntax.errors !== 'undefined'), + source: null + }; + + if (options.comment) { + options.attachComment = hasAttachedComment(syntax); + } + + if (typeof syntax.tokens !== 'undefined') { + if (syntax.tokens.length > 0) { + options.range = (typeof syntax.tokens[0].range !== 'undefined'); + options.loc = (typeof syntax.tokens[0].loc !== 'undefined'); + } + } + + if (typeof syntax.comments !== 'undefined') { + if (syntax.comments.length > 0) { + options.range = (typeof syntax.comments[0].range !== 'undefined'); + options.loc = (typeof syntax.comments[0].loc !== 'undefined'); + } + } + + if (options.loc) { + options.source = syntax.loc.source; + } + + syntax = sortedObject(syntax); + expected = JSON.stringify(syntax, null, 4); + try { + // Some variations of the options. + tree = espree.parse(code, { tolerant: options.tolerant }); + tree = espree.parse(code, { tolerant: options.tolerant, range: true }); + tree = espree.parse(code, { tolerant: options.tolerant, loc: true }); + + tree = espree.parse(code, options); + tree = (options.comment || options.tokens || options.tolerant) ? tree : tree.body[0]; + + if (options.tolerant) { + for (i = 0, len = tree.errors.length; i < len; i += 1) { + tree.errors[i] = errorToObject(tree.errors[i]); + } + } + tree = sortedObject(tree); + actual = JSON.stringify(tree, adjustRegexLiteral, 4); + + // Only to ensure that there is no error when using string object. + espree.parse(new StringObject(code), options); + + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } + + function filter(key, value) { + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } + return (key === 'loc' || key === 'range') ? undefined : value; + } + + if (options.tolerant) { + return; + } + + + // Check again without any location info. + options.range = false; + options.loc = false; + syntax = sortedObject(syntax); + expected = JSON.stringify(syntax, filter, 4); + try { + tree = espree.parse(code, options); + tree = (options.comment || options.tokens) ? tree : tree.body[0]; + + if (options.tolerant) { + for (i = 0, len = tree.errors.length; i < len; i += 1) { + tree.errors[i] = errorToObject(tree.errors[i]); + } + } + tree = sortedObject(tree); + actual = JSON.stringify(tree, filter, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } +} + +function testTokenize(espree, code, tokens) { + 'use strict'; + var options, expected, actual, tree; + + options = { + comment: true, + tolerant: true, + loc: true, + range: true + }; + + expected = JSON.stringify(tokens, null, 4); + + try { + tree = espree.tokenize(code, options); + actual = JSON.stringify(tree, null, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } +} + +function testError(espree, code, exception) { + 'use strict'; + var i, options, expected, actual, err, handleInvalidRegexFlag, tokenize; + + // Different parsing options should give the same error. + options = [ + {}, + { comment: true }, + { raw: true }, + { raw: true, comment: true } + ]; + + // If handleInvalidRegexFlag is true, an invalid flag in a regular expression + // will throw an exception. In some old version V8, this is not the case + // and hence handleInvalidRegexFlag is false. + handleInvalidRegexFlag = false; + try { + 'test'.match(new RegExp('[a-z]', 'x')); + } catch (e) { + handleInvalidRegexFlag = true; + } + + exception.description = exception.message.replace(/Error: Line [0-9]+: /, ''); + + if (exception.tokenize) { + tokenize = true; + exception.tokenize = undefined; + } + expected = JSON.stringify(exception); + + for (i = 0; i < options.length; i += 1) { + + try { + if (tokenize) { + espree.tokenize(code, options[i]) + } else { + espree.parse(code, options[i]); + } + } catch (e) { + err = errorToObject(e); + err.description = e.description; + actual = JSON.stringify(err); + } + + if (expected !== actual) { + + // Compensate for old V8 which does not handle invalid flag. + if (exception.message.indexOf('Invalid regular expression') > 0) { + if (typeof actual === 'undefined' && !handleInvalidRegexFlag) { + return; + } + } + + throw new NotMatchingError(expected, actual); + } + + } +} + +function testAPI(espree, code, result) { + 'use strict'; + var expected, res, actual; + + expected = JSON.stringify(result.result, null, 4); + try { + if (typeof result.property !== 'undefined') { + res = espree[result.property]; + } else { + res = espree[result.call].apply(espree, result.args); + } + actual = JSON.stringify(res, adjustRegexLiteral, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } +} + +function runTest(espree, code, result) { + 'use strict'; + if (result.hasOwnProperty('lineNumber')) { + testError(espree, code, result); + } else if (result.hasOwnProperty('result')) { + testAPI(espree, code, result); + } else if (result instanceof Array) { + testTokenize(espree, code, result); + } else { + testParse(espree, code, result); + } +} + +if (typeof window !== 'undefined') { + // Run all tests in a browser environment. + runTests = function () { + 'use strict'; + var total = 0, + failures = 0, + category, + fixture, + source, + tick, + expected, + index, + len; + + function setText(el, str) { + if (typeof el.innerText === 'string') { + el.innerText = str; + } else { + el.textContent = str; + } + } + + function startCategory(category) { + var report, e; + report = document.getElementById('report'); + e = document.createElement('h4'); + setText(e, category); + report.appendChild(e); + } + + function reportSuccess(code) { + var report, e; + report = document.getElementById('report'); + e = document.createElement('pre'); + e.setAttribute('class', 'code'); + setText(e, code); + report.appendChild(e); + } + + function reportFailure(code, expected, actual) { + var report, e; + + report = document.getElementById('report'); + + e = document.createElement('p'); + setText(e, 'Code:'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'code'); + setText(e, code); + report.appendChild(e); + + e = document.createElement('p'); + setText(e, 'Expected'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'expected'); + setText(e, expected); + report.appendChild(e); + + e = document.createElement('p'); + setText(e, 'Actual'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'actual'); + setText(e, actual); + report.appendChild(e); + } + + setText(document.getElementById('version'), espree.version); + + tick = new Date(); + for (category in testFixture) { + if (testFixture.hasOwnProperty(category)) { + startCategory(category); + fixture = testFixture[category]; + for (source in fixture) { + if (fixture.hasOwnProperty(source)) { + expected = fixture[source]; + total += 1; + try { + runTest(espree, source, expected); + reportSuccess(source, JSON.stringify(expected, null, 4)); + } catch (e) { + failures += 1; + reportFailure(source, e.expected, e.actual); + } + } + } + } + } + tick = (new Date()) - tick; + + if (failures > 0) { + document.getElementById('status').className = 'alert-box alert'; + setText(document.getElementById('status'), total + ' tests. ' + + 'Failures: ' + failures + '. ' + tick + ' ms.'); + } else { + document.getElementById('status').className = 'alert-box success'; + setText(document.getElementById('status'), total + ' tests. ' + + 'No failure. ' + tick + ' ms.'); + } + }; +} else { + (function () { + 'use strict'; + + var espree = require('../espree'), + diff = require('json-diff').diffString, + total = 0, + failures = [], + tick = new Date(), + expected, + header, + testFixture = require("./test"); + + Object.keys(testFixture).forEach(function (category) { + Object.keys(testFixture[category]).forEach(function (source) { + total += 1; + expected = testFixture[category][source]; + try { + runTest(espree, source, expected); + } catch (e) { + e.source = source; + failures.push(e); + } + }); + }); + tick = (new Date()) - tick; + + header = total + ' tests. ' + failures.length + ' failures. ' + + tick + ' ms'; + if (failures.length) { + console.error(header); + failures.forEach(function (failure) { + try { + var expectedObject = JSON.parse(failure.expected); + var actualObject = JSON.parse(failure.actual); + + console.error(failure.source + ': Expected\n ' + + failure.expected.split('\n').join('\n ') + + '\nto match\n ' + failure.actual + '\nDiff:\n' + + diff(expectedObject, actualObject)); + } catch (ex) { + console.error(failure.source + ': Expected\n ' + + failure.expected.split('\n').join('\n ') + + '\nto match\n ' + failure.actual); + } + }); + } else { + console.log(header); + } + process.exit(failures.length === 0 ? 0 : 1); + }()); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/espree/test/test.js b/node_modules/standard/node_modules/eslint/node_modules/espree/test/test.js new file mode 100644 index 00000000..93193c7e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/espree/test/test.js @@ -0,0 +1,34 @@ +/** + * @fileoverview Tests for parsing/tokenization. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var shelljs = require("shelljs"), + fs = require("fs"), + path = require("path"); + +//------------------------------------------------------------------------------ +// Processing +//------------------------------------------------------------------------------ + +var files = shelljs.find("./tests/fixtures/ast"); + +files.filter(function(filename) { + return path.extname(filename) === ".json"; +}).forEach(function(filename) { + var basename = path.basename(filename, ".json"); + exports[basename] = JSON.parse(fs.readFileSync(filename, "utf8"), function(key, value) { + + // JSON can't represent undefined, so we use a special value + if (value === "espree@undefined") { + return undefined; + } else { + return value; + } + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/.npmignore new file mode 100644 index 00000000..da23d0d4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/.npmignore @@ -0,0 +1,25 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Deployed apps should consider commenting this line out: +# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git +node_modules diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/.travis.yml new file mode 100644 index 00000000..ffb9f710 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/.travis.yml @@ -0,0 +1,2 @@ +language: node_js +node_js: '0.10' diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/LICENSE new file mode 100644 index 00000000..54530b38 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ingvar Stepanyan + +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. \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/README.md b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/README.md new file mode 100644 index 00000000..20b02966 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/README.md @@ -0,0 +1,34 @@ +estraverse-fb +============= +[![Build Status](https://travis-ci.org/RReverser/estraverse-fb.svg?branch=master)](https://travis-ci.org/RReverser/estraverse-fb) + +Drop-in for estraverse that enables traversal over React's JSX and Flow nodes using monkey-patching technique. + +You can use estraverse-fb in two possible ways: + +* by default, you just require it and it injects needed keys into your installed version of estraverse (it's installed automatically if you don't have it yet): + ```javascript + var estraverse = require('estraverse-fb'); + /* same as: + require('estraverse-fb'); + var estraverse = require('estraverse'); + */ + + estraverse.traverse(ast, { + enter: ..., + leave: ... + }); + ``` + +* alternatively, you can use it manually for selected traversals: + ```javascript + var jsxKeys = require('estraverse-fb/keys'); + + estraverse.traverse(ast, { + enter: ..., + leave: ..., + keys: jsxKeys + }) +``` + +Check out [estraverse page](https://github.com/Constellation/estraverse) for detailed usage. diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/estraverse-fb.js b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/estraverse-fb.js new file mode 100644 index 00000000..795ec40e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/estraverse-fb.js @@ -0,0 +1,13 @@ +var estraverse = module.exports = require('estraverse'); + +var VisitorKeys = require('./keys'); + +for (var nodeType in VisitorKeys) { + estraverse.Syntax[nodeType] = nodeType; + + var keys = VisitorKeys[nodeType]; + + if (keys) { + estraverse.VisitorKeys[nodeType] = keys; + } +} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/keys.js b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/keys.js new file mode 100644 index 00000000..47df04a5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/keys.js @@ -0,0 +1,57 @@ +var unprefixedKeys = { + Identifier: [], + NamespacedName: ['namespace', 'name'], + MemberExpression: ['object', 'property'], + EmptyExpression: [], + ExpressionContainer: ['expression'], + Element: ['openingElement', 'closingElement', 'children'], + ClosingElement: ['name'], + OpeningElement: ['name', 'attributes'], + Attribute: ['name', 'value'], + Text: null, + SpreadAttribute: ['argument'] +}; + +var flowKeys = { + Type: [], + AnyTypeAnnotation: [], + VoidTypeAnnotation: [], + NumberTypeAnnotation: [], + StringTypeAnnotation: [], + StringLiteralTypeAnnotation: ["value", "raw"], + BooleanTypeAnnotation: [], + TypeAnnotation: ["typeAnnotation"], + NullableTypeAnnotation: ["typeAnnotation"], + FunctionTypeAnnotation: ["params", "returnType", "rest", "typeParameters"], + FunctionTypeParam: ["name", "typeAnnotation", "optional"], + ObjectTypeAnnotation: ["properties"], + ObjectTypeProperty: ["key", "value", "optional"], + ObjectTypeIndexer: ["id", "key", "value"], + ObjectTypeCallProperty: ["value"], + QualifiedTypeIdentifier: ["qualification", "id"], + GenericTypeAnnotation: ["id", "typeParameters"], + MemberTypeAnnotation: ["object", "property"], + UnionTypeAnnotation: ["types"], + IntersectionTypeAnnotation: ["types"], + TypeofTypeAnnotation: ["argument"], + TypeParameterDeclaration: ["params"], + TypeParameterInstantiation: ["params"], + ClassProperty: ["key", "typeAnnotation"], + ClassImplements: [], + InterfaceDeclaration: ["id", "body", "extends"], + InterfaceExtends: ["id"], + TypeAlias: ["id", "typeParameters", "right"], + TupleTypeAnnotation: ["types"], + DeclareVariable: ["id"], + DeclareFunction: ["id"], + DeclareClass: ["id"], + DeclareModule: ["id", "body"] +}; + +for (var key in unprefixedKeys) { + exports['XJS' + key] = exports['JSX' + key] = unprefixedKeys[key]; +} + +for (var key in flowKeys) { + exports[key] = flowKeys[key]; +} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/package.json b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/package.json new file mode 100644 index 00000000..3d8266c8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/package.json @@ -0,0 +1,60 @@ +{ + "name": "estraverse-fb", + "version": "1.3.1", + "description": "Drop-in for estraverse that enables traversal over React's JSX nodes.", + "main": "estraverse-fb.js", + "repository": { + "type": "git", + "url": "https://github.com/RReverser/estraverse-fb" + }, + "keywords": [ + "traverse", + "ast", + "react", + "jsx" + ], + "author": { + "name": "Ingvar Stepanyan", + "email": "me@rreverser.com", + "url": "https://github.com/RReverser" + }, + "license": "MIT", + "scripts": { + "test": "mocha" + }, + "peerDependencies": { + "estraverse": "*" + }, + "devDependencies": { + "chai": "^1.9.1", + "esprima-fb": "^8001.1001.0-dev-harmony-fb", + "estraverse": "^1.7.0", + "mocha": "^1.20.0" + }, + "gitHead": "776d565d897ad91e20efedd926972c7ab0c7221e", + "bugs": { + "url": "https://github.com/RReverser/estraverse-fb/issues" + }, + "homepage": "https://github.com/RReverser/estraverse-fb", + "_id": "estraverse-fb@1.3.1", + "_shasum": "160e75a80e605b08ce894bcce2fe3e429abf92bf", + "_from": "estraverse-fb@>=1.3.1 <2.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "rreverser", + "email": "me@rreverser.com" + }, + "maintainers": [ + { + "name": "rreverser", + "email": "me@rreverser.com" + } + ], + "dist": { + "shasum": "160e75a80e605b08ce894bcce2fe3e429abf92bf", + "tarball": "http://registry.npmjs.org/estraverse-fb/-/estraverse-fb-1.3.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/estraverse-fb/-/estraverse-fb-1.3.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/test.js b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/test.js new file mode 100644 index 00000000..e0fca88a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse-fb/test.js @@ -0,0 +1,116 @@ +var assert = require('chai').assert; +var parse = require('esprima-fb').parse; +var originalKeys = require('./keys'); + +describe('works', function () { + var code = ['class MyClass{', + 'x: number;', + 'y: number;', + 'constructor(x: number, y: number){', + 'this.x = x;', + 'this.y = y;', + '}', + 'render(){', + 'return !{}', + '}', + '}'].join('\n'); + + var ast = parse(code); + + var expectedKeys = [ + 'ClassProperty', + 'TypeAnnotation', + 'NumberTypeAnnotation', + 'ClassProperty', + 'TypeAnnotation', + 'NumberTypeAnnotation', + 'XJSElement', + 'XJSOpeningElement', + 'XJSNamespacedName', + 'XJSIdentifier', + 'XJSIdentifier', + 'XJSAttribute', + 'XJSIdentifier', + 'XJSAttribute', + 'XJSIdentifier', + 'XJSExpressionContainer', + 'XJSSpreadAttribute', + 'XJSClosingElement', + 'XJSNamespacedName', + 'XJSIdentifier', + 'XJSIdentifier', + 'XJSElement', + 'XJSOpeningElement', + 'XJSMemberExpression', + 'XJSIdentifier', + 'XJSIdentifier', + 'XJSClosingElement', + 'XJSMemberExpression', + 'XJSIdentifier', + 'XJSIdentifier', + 'XJSExpressionContainer', + 'XJSEmptyExpression' + ]; + + beforeEach(function () { + for (var key in require.cache) { + delete require.cache[key]; + } + }); + + it('directly from dependency', function () { + var traverse = require('./').traverse; + var actualKeys = []; + var actualTypeKeys = []; + + traverse(ast, { + enter: function (node) { + if (originalKeys[node.type] != null) { + actualKeys.push(node.type); + } + } + }); + + assert.deepEqual(actualKeys, expectedKeys); + }); + + it('in injected mode', function () { + require('./'); + var traverse = require('estraverse').traverse; + var actualKeys = []; + + traverse(ast, { + enter: function (node) { + if (originalKeys[node.type] != null) { + actualKeys.push(node.type); + } + } + }); + + assert.deepEqual(actualKeys, expectedKeys); + }); + + it('in single-pass mode', function () { + var traverse = require('estraverse').traverse; + var keys = require('./keys'); + + var actualKeys = []; + + traverse(ast, { + enter: function (node) { + if (originalKeys[node.type] != null) { + actualKeys.push(node.type); + } + }, + keys: keys + }); + + assert.throws(function () { + traverse(ast, { + enter: function () {} + }); + }); + + assert.deepEqual(actualKeys, expectedKeys); + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse/.jshintrc b/node_modules/standard/node_modules/eslint/node_modules/estraverse/.jshintrc new file mode 100644 index 00000000..f642dae7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse/.jshintrc @@ -0,0 +1,16 @@ +{ + "curly": true, + "eqeqeq": true, + "immed": true, + "eqnull": true, + "latedef": true, + "noarg": true, + "noempty": true, + "quotmark": "single", + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + + "node": true +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse/LICENSE.BSD b/node_modules/standard/node_modules/eslint/node_modules/estraverse/LICENSE.BSD new file mode 100644 index 00000000..3e580c35 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse/README.md b/node_modules/standard/node_modules/eslint/node_modules/estraverse/README.md new file mode 100644 index 00000000..4242c513 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse/README.md @@ -0,0 +1,124 @@ +### Estraverse [![Build Status](https://secure.travis-ci.org/estools/estraverse.png)](http://travis-ci.org/estools/estraverse) + +Estraverse ([estraverse](http://github.com/estools/estraverse)) is +[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +traversal functions from [esmangle project](http://github.com/estools/esmangle). + +### Documentation + +You can find usage docs at [wiki page](https://github.com/estools/estraverse/wiki/Usage). + +### Example Usage + +The following code will output all variables declared at the root of a file. + +```javascript +estraverse.traverse(ast, { + enter: function (node, parent) { + if (node.type == 'FunctionExpression' || node.type == 'FunctionDeclaration') + return estraverse.VisitorOption.Skip; + }, + leave: function (node, parent) { + if (node.type == 'VariableDeclarator') + console.log(node.id.name); + } +}); +``` + +We can use `this.skip`, `this.remove` and `this.break` functions instead of using Skip, Remove and Break. + +```javascript +estraverse.traverse(ast, { + enter: function (node) { + this.break(); + } +}); +``` + +And estraverse provides `estraverse.replace` function. When returning node from `enter`/`leave`, current node is replaced with it. + +```javascript +result = estraverse.replace(tree, { + enter: function (node) { + // Replace it with replaced. + if (node.type === 'Literal') + return replaced; + } +}); +``` + +By passing `visitor.keys` mapping, we can extend estraverse traversing functionality. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Extending the exising traversing rules. + keys: { + // TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ] + TestExpression: ['argument'] + } +}); +``` + +By passing `visitor.fallback` option, we can control the behavior when encountering unknown nodes. +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Iterating the child **nodes** of unknown nodes. + fallback: 'iteration' +}); +``` + +### License + +Copyright (C) 2012-2013 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse/estraverse.js b/node_modules/standard/node_modules/eslint/node_modules/estraverse/estraverse.js new file mode 100644 index 00000000..abc52ce5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse/estraverse.js @@ -0,0 +1,839 @@ +/* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + 'use strict'; + + var Syntax, + isArray, + VisitorOption, + VisitorKeys, + objectCreate, + objectKeys, + BREAK, + SKIP, + REMOVE; + + function ignoreJSHintError() { } + + isArray = Array.isArray; + if (!isArray) { + isArray = function isArray(array) { + return Object.prototype.toString.call(array) === '[object Array]'; + }; + } + + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } + + function shallowCopy(obj) { + var ret = {}, key; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + ignoreJSHintError(shallowCopy); + + // based on LLVM libc++ upper_bound / lower_bound + // MIT License + + function upperBound(array, func) { + var diff, len, i, current; + + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } + + function lowerBound(array, func) { + var diff, len, i, current; + + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + i = current + 1; + len -= diff + 1; + } else { + len = diff; + } + } + return i; + } + ignoreJSHintError(lowerBound); + + objectCreate = Object.create || (function () { + function F() { } + + return function (o) { + F.prototype = o; + return new F(); + }; + })(); + + objectKeys = Object.keys || function (o) { + var keys = [], key; + for (key in o) { + keys.push(key); + } + return keys; + }; + + function extend(to, from) { + var keys = objectKeys(from), key, i, len; + for (i = 0, len = keys.length; i < len; i += 1) { + key = keys[i]; + to[key] = from[key]; + } + return to; + } + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'defaults', 'rest', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'defaults', 'rest', 'body'], + FunctionExpression: ['id', 'params', 'defaults', 'rest', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handlers', 'handler', 'guardedHandlers', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; + + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; + + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } + + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; + + Reference.prototype.remove = function remove() { + if (isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + + function Controller() { } + + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + + function addToPath(result, path) { + if (isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } + + // root node + if (!this.__current.path) { + return null; + } + + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; + + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; + + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; + + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + + return result; + }; + + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; + + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + + result = undefined; + + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; + + return result; + }; + + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; + + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; + + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; + + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; + + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = visitor.fallback === 'iteration'; + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = extend(objectCreate(this.__keys), visitor.keys); + } + }; + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + ret = this.__execute(visitor.leave, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } + + if (element.node) { + + ret = this.__execute(visitor.enter, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || ret === SKIP) { + continue; + } + + node = element.node; + nodeType = element.wrap || node.type; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = objectKeys(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; + + Controller.prototype.replace = function replace(root, visitor) { + function removeElem(element) { + var i, + key, + nextElem, + parent; + + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; + + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } + + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + target = this.__execute(visitor.leave, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } + + target = this.__execute(visitor.enter, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + + // node may be null + node = element.node; + if (!node) { + continue; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || target === SKIP) { + continue; + } + + nodeType = element.wrap || node.type; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = objectKeys(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } + + return outer.root; + }; + + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + + function extendCommentRange(comment, tokens) { + var target; + + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + + comment.extendedRange = [comment.range[0], comment.range[1]]; + + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + + return comment; + } + + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; + + if (!tree.range) { + throw new Error('attachComments needs range information'); + } + + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } + + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } + + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } + + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } + + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + return tree; + } + + exports.version = require('./package.json').version; + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; + + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse/gulpfile.js b/node_modules/standard/node_modules/eslint/node_modules/estraverse/gulpfile.js new file mode 100644 index 00000000..8772bbcc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse/gulpfile.js @@ -0,0 +1,70 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +'use strict'; + +var gulp = require('gulp'), + git = require('gulp-git'), + bump = require('gulp-bump'), + filter = require('gulp-filter'), + tagVersion = require('gulp-tag-version'); + +var TEST = [ 'test/*.js' ]; +var POWERED = [ 'powered-test/*.js' ]; +var SOURCE = [ 'src/**/*.js' ]; + +/** + * Bumping version number and tagging the repository with it. + * Please read http://semver.org/ + * + * You can use the commands + * + * gulp patch # makes v0.1.0 -> v0.1.1 + * gulp feature # makes v0.1.1 -> v0.2.0 + * gulp release # makes v0.2.1 -> v1.0.0 + * + * To bump the version numbers accordingly after you did a patch, + * introduced a feature or made a backwards-incompatible release. + */ + +function inc(importance) { + // get all the files to bump version in + return gulp.src(['./package.json']) + // bump the version number in those files + .pipe(bump({type: importance})) + // save it back to filesystem + .pipe(gulp.dest('./')) + // commit the changed version number + .pipe(git.commit('Bumps package version')) + // read only one file to get the version number + .pipe(filter('package.json')) + // **tag it in the repository** + .pipe(tagVersion({ + prefix: '' + })); +} + +gulp.task('patch', [ ], function () { return inc('patch'); }) +gulp.task('minor', [ ], function () { return inc('minor'); }) +gulp.task('major', [ ], function () { return inc('major'); }) diff --git a/node_modules/standard/node_modules/eslint/node_modules/estraverse/package.json b/node_modules/standard/node_modules/eslint/node_modules/estraverse/package.json new file mode 100644 index 00000000..e73f07bd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/estraverse/package.json @@ -0,0 +1,62 @@ +{ + "name": "estraverse", + "description": "ECMAScript JS AST traversal functions", + "homepage": "https://github.com/estools/estraverse", + "main": "estraverse.js", + "version": "2.0.0", + "engines": { + "node": ">=0.10.0" + }, + "maintainers": [ + { + "name": "constellation", + "email": "utatane.tea@gmail.com" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/estools/estraverse.git" + }, + "devDependencies": { + "chai": "^2.1.1", + "coffee-script": "^1.8.0", + "espree": "^1.11.0", + "gulp": "^3.8.10", + "gulp-bump": "^0.2.2", + "gulp-filter": "^2.0.0", + "gulp-git": "^1.0.1", + "gulp-tag-version": "^1.2.1", + "jshint": "^2.5.6", + "mocha": "^2.1.0" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/estools/estraverse/raw/master/LICENSE.BSD" + } + ], + "scripts": { + "test": "npm run-script lint && npm run-script unit-test", + "lint": "jshint estraverse.js", + "unit-test": "mocha --compilers coffee:coffee-script/register" + }, + "gitHead": "d8bc726f126817cc03c7a4e751528edb19db0ffb", + "bugs": { + "url": "https://github.com/estools/estraverse/issues" + }, + "_id": "estraverse@2.0.0", + "_shasum": "5ae46963243600206674ccb24a09e16674fcdca1", + "_from": "estraverse@>=2.0.0 <3.0.0", + "_npmVersion": "2.0.0-alpha-5", + "_npmUser": { + "name": "constellation", + "email": "utatane.tea@gmail.com" + }, + "dist": { + "shasum": "5ae46963243600206674ccb24a09e16674fcdca1", + "tarball": "http://registry.npmjs.org/estraverse/-/estraverse-2.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/estraverse/-/estraverse-2.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/globals/globals.json b/node_modules/standard/node_modules/eslint/node_modules/globals/globals.json new file mode 100644 index 00000000..14f69c31 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/globals/globals.json @@ -0,0 +1,749 @@ +{ + "builtin": { + "Array": false, + "ArrayBuffer": false, + "Boolean": false, + "constructor": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + "hasOwnProperty": false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + "isPrototypeOf": false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + "propertyIsEnumerable": false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + "System": false, + "toLocaleString": false, + "toString": false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "URIError": false, + "valueOf": false, + "WeakMap": false, + "WeakSet": false + }, + "nonstandard": { + "escape": false, + "unescape": false + }, + "browser": { + "addEventListener": false, + "alert": false, + "applicationCache": false, + "atob": false, + "Audio": false, + "AudioProcessingEvent": false, + "BeforeUnloadEvent": false, + "Blob": false, + "blur": false, + "btoa": false, + "cancelAnimationFrame": false, + "CanvasGradient": false, + "CanvasPattern": false, + "CanvasRenderingContext2D": false, + "clearInterval": false, + "clearTimeout": false, + "close": false, + "closed": false, + "CloseEvent": false, + "Comment": false, + "CompositionEvent": false, + "confirm": false, + "console": false, + "crypto": false, + "CSS": false, + "CustomEvent": false, + "DataView": false, + "Debug": false, + "defaultStatus": false, + "devicePixelRatio": false, + "dispatchEvent": false, + "document": false, + "Document": false, + "DocumentFragment": false, + "DOMParser": false, + "DragEvent": false, + "Element": false, + "ElementTimeControl": false, + "ErrorEvent": false, + "event": false, + "Event": false, + "FileReader": false, + "fetch": false, + "find": false, + "focus": false, + "FocusEvent": false, + "FormData": false, + "frameElement": false, + "frames": false, + "GamepadEvent": false, + "getComputedStyle": false, + "getSelection": false, + "HashChangeEvent": false, + "Headers": false, + "history": false, + "HTMLAnchorElement": false, + "HTMLBaseElement": false, + "HTMLBlockquoteElement": false, + "HTMLBodyElement": false, + "HTMLBRElement": false, + "HTMLButtonElement": false, + "HTMLCanvasElement": false, + "HTMLDirectoryElement": false, + "HTMLDivElement": false, + "HTMLDListElement": false, + "HTMLElement": false, + "HTMLFieldSetElement": false, + "HTMLFontElement": false, + "HTMLFormElement": false, + "HTMLFrameElement": false, + "HTMLFrameSetElement": false, + "HTMLHeadElement": false, + "HTMLHeadingElement": false, + "HTMLHRElement": false, + "HTMLHtmlElement": false, + "HTMLIFrameElement": false, + "HTMLImageElement": false, + "HTMLInputElement": false, + "HTMLIsIndexElement": false, + "HTMLLabelElement": false, + "HTMLLayerElement": false, + "HTMLLegendElement": false, + "HTMLLIElement": false, + "HTMLLinkElement": false, + "HTMLMapElement": false, + "HTMLMenuElement": false, + "HTMLMetaElement": false, + "HTMLModElement": false, + "HTMLObjectElement": false, + "HTMLOListElement": false, + "HTMLOptGroupElement": false, + "HTMLOptionElement": false, + "HTMLParagraphElement": false, + "HTMLParamElement": false, + "HTMLPreElement": false, + "HTMLQuoteElement": false, + "HTMLScriptElement": false, + "HTMLSelectElement": false, + "HTMLStyleElement": false, + "HTMLTableCaptionElement": false, + "HTMLTableCellElement": false, + "HTMLTableColElement": false, + "HTMLTableElement": false, + "HTMLTableRowElement": false, + "HTMLTableSectionElement": false, + "HTMLTextAreaElement": false, + "HTMLTitleElement": false, + "HTMLUListElement": false, + "HTMLVideoElement": false, + "IDBCursor": false, + "IDBCursorWithValue": false, + "IDBDatabase": false, + "IDBEnvironment": false, + "IDBFactory": false, + "IDBIndex": false, + "IDBKeyRange": false, + "IDBObjectStore": false, + "IDBOpenDBRequest": false, + "IDBRequest": false, + "IDBTransaction": false, + "IDBVersionChangeEvent": false, + "Image": false, + "indexedDB": false, + "innerHeight": false, + "innerWidth": false, + "InputEvent": false, + "Intl": false, + "KeyboardEvent": false, + "length": false, + "localStorage": false, + "location": false, + "matchMedia": false, + "MessageChannel": false, + "MessageEvent": false, + "MessagePort": false, + "MouseEvent": false, + "moveBy": false, + "moveTo": false, + "MutationObserver": false, + "name": false, + "navigator": false, + "Node": false, + "NodeFilter": false, + "NodeList": false, + "Notification": false, + "OfflineAudioCompletionEvent": false, + "onbeforeunload": true, + "onblur": true, + "onerror": true, + "onfocus": true, + "onload": true, + "onresize": true, + "onunload": true, + "open": false, + "openDatabase": false, + "opener": false, + "opera": false, + "Option": false, + "outerHeight": false, + "outerWidth": false, + "PageTransitionEvent": false, + "pageXOffset": false, + "pageYOffset": false, + "parent": false, + "PopStateEvent": false, + "postMessage": false, + "print": false, + "ProgressEvent": false, + "prompt": false, + "Range": false, + "Request": false, + "Response": false, + "removeEventListener": false, + "requestAnimationFrame": false, + "resizeBy": false, + "resizeTo": false, + "screen": false, + "screenX": false, + "screenY": false, + "scroll": false, + "scrollbars": false, + "scrollBy": false, + "scrollTo": false, + "scrollX": false, + "scrollY": false, + "self": false, + "sessionStorage": false, + "setInterval": false, + "setTimeout": false, + "SharedWorker": false, + "showModalDialog": false, + "status": false, + "stop": false, + "StorageEvent": false, + "SVGAElement": false, + "SVGAltGlyphDefElement": false, + "SVGAltGlyphElement": false, + "SVGAltGlyphItemElement": false, + "SVGAngle": false, + "SVGAnimateColorElement": false, + "SVGAnimatedAngle": false, + "SVGAnimatedBoolean": false, + "SVGAnimatedEnumeration": false, + "SVGAnimatedInteger": false, + "SVGAnimatedLength": false, + "SVGAnimatedLengthList": false, + "SVGAnimatedNumber": false, + "SVGAnimatedNumberList": false, + "SVGAnimatedPathData": false, + "SVGAnimatedPoints": false, + "SVGAnimatedPreserveAspectRatio": false, + "SVGAnimatedRect": false, + "SVGAnimatedString": false, + "SVGAnimatedTransformList": false, + "SVGAnimateElement": false, + "SVGAnimateMotionElement": false, + "SVGAnimateTransformElement": false, + "SVGAnimationElement": false, + "SVGCircleElement": false, + "SVGClipPathElement": false, + "SVGColor": false, + "SVGColorProfileElement": false, + "SVGColorProfileRule": false, + "SVGComponentTransferFunctionElement": false, + "SVGCSSRule": false, + "SVGCursorElement": false, + "SVGDefsElement": false, + "SVGDescElement": false, + "SVGDocument": false, + "SVGElement": false, + "SVGElementInstance": false, + "SVGElementInstanceList": false, + "SVGEllipseElement": false, + "SVGEvent": false, + "SVGExternalResourcesRequired": false, + "SVGFEBlendElement": false, + "SVGFEColorMatrixElement": false, + "SVGFEComponentTransferElement": false, + "SVGFECompositeElement": false, + "SVGFEConvolveMatrixElement": false, + "SVGFEDiffuseLightingElement": false, + "SVGFEDisplacementMapElement": false, + "SVGFEDistantLightElement": false, + "SVGFEFloodElement": false, + "SVGFEFuncAElement": false, + "SVGFEFuncBElement": false, + "SVGFEFuncGElement": false, + "SVGFEFuncRElement": false, + "SVGFEGaussianBlurElement": false, + "SVGFEImageElement": false, + "SVGFEMergeElement": false, + "SVGFEMergeNodeElement": false, + "SVGFEMorphologyElement": false, + "SVGFEOffsetElement": false, + "SVGFEPointLightElement": false, + "SVGFESpecularLightingElement": false, + "SVGFESpotLightElement": false, + "SVGFETileElement": false, + "SVGFETurbulenceElement": false, + "SVGFilterElement": false, + "SVGFilterPrimitiveStandardAttributes": false, + "SVGFitToViewBox": false, + "SVGFontElement": false, + "SVGFontFaceElement": false, + "SVGFontFaceFormatElement": false, + "SVGFontFaceNameElement": false, + "SVGFontFaceSrcElement": false, + "SVGFontFaceUriElement": false, + "SVGForeignObjectElement": false, + "SVGGElement": false, + "SVGGlyphElement": false, + "SVGGlyphRefElement": false, + "SVGGradientElement": false, + "SVGHKernElement": false, + "SVGICCColor": false, + "SVGImageElement": false, + "SVGLangSpace": false, + "SVGLength": false, + "SVGLengthList": false, + "SVGLinearGradientElement": false, + "SVGLineElement": false, + "SVGLocatable": false, + "SVGMarkerElement": false, + "SVGMaskElement": false, + "SVGMatrix": false, + "SVGMetadataElement": false, + "SVGMissingGlyphElement": false, + "SVGMPathElement": false, + "SVGNumber": false, + "SVGNumberList": false, + "SVGPaint": false, + "SVGPathElement": false, + "SVGPathSeg": false, + "SVGPathSegArcAbs": false, + "SVGPathSegArcRel": false, + "SVGPathSegClosePath": false, + "SVGPathSegCurvetoCubicAbs": false, + "SVGPathSegCurvetoCubicRel": false, + "SVGPathSegCurvetoCubicSmoothAbs": false, + "SVGPathSegCurvetoCubicSmoothRel": false, + "SVGPathSegCurvetoQuadraticAbs": false, + "SVGPathSegCurvetoQuadraticRel": false, + "SVGPathSegCurvetoQuadraticSmoothAbs": false, + "SVGPathSegCurvetoQuadraticSmoothRel": false, + "SVGPathSegLinetoAbs": false, + "SVGPathSegLinetoHorizontalAbs": false, + "SVGPathSegLinetoHorizontalRel": false, + "SVGPathSegLinetoRel": false, + "SVGPathSegLinetoVerticalAbs": false, + "SVGPathSegLinetoVerticalRel": false, + "SVGPathSegList": false, + "SVGPathSegMovetoAbs": false, + "SVGPathSegMovetoRel": false, + "SVGPatternElement": false, + "SVGPoint": false, + "SVGPointList": false, + "SVGPolygonElement": false, + "SVGPolylineElement": false, + "SVGPreserveAspectRatio": false, + "SVGRadialGradientElement": false, + "SVGRect": false, + "SVGRectElement": false, + "SVGRenderingIntent": false, + "SVGScriptElement": false, + "SVGSetElement": false, + "SVGStopElement": false, + "SVGStringList": false, + "SVGStylable": false, + "SVGStyleElement": false, + "SVGSVGElement": false, + "SVGSwitchElement": false, + "SVGSymbolElement": false, + "SVGTests": false, + "SVGTextContentElement": false, + "SVGTextElement": false, + "SVGTextPathElement": false, + "SVGTextPositioningElement": false, + "SVGTitleElement": false, + "SVGTransform": false, + "SVGTransformable": false, + "SVGTransformList": false, + "SVGTRefElement": false, + "SVGTSpanElement": false, + "SVGUnitTypes": false, + "SVGURIReference": false, + "SVGUseElement": false, + "SVGViewElement": false, + "SVGViewSpec": false, + "SVGVKernElement": false, + "SVGZoomAndPan": false, + "Text": false, + "TextDecoder": false, + "TextEncoder": false, + "TimeEvent": false, + "top": false, + "TouchEvent": false, + "UIEvent": false, + "URL": false, + "WebGLActiveInfo": false, + "WebGLBuffer": false, + "WebGLContextEvent": false, + "WebGLFramebuffer": false, + "WebGLProgram": false, + "WebGLRenderbuffer": false, + "WebGLRenderingContext": false, + "WebGLShader": false, + "WebGLShaderPrecisionFormat": false, + "WebGLTexture": false, + "WebGLUniformLocation": false, + "WebSocket": false, + "WheelEvent": false, + "window": false, + "Window": false, + "Worker": false, + "XDomainRequest": false, + "XMLHttpRequest": false, + "XMLSerializer": false, + "XPathEvaluator": false, + "XPathException": false, + "XPathExpression": false, + "XPathNamespace": false, + "XPathNSResolver": false, + "XPathResult": false + }, + "worker": { + "importScripts": true, + "postMessage": true, + "self": true + }, + "node": { + "__dirname": false, + "__filename": false, + "arguments": false, + "Buffer": false, + "clearImmediate": false, + "clearInterval": false, + "clearTimeout": false, + "console": false, + "DataView": false, + "exports": true, + "GLOBAL": false, + "global": false, + "module": false, + "process": false, + "require": false, + "setImmediate": false, + "setInterval": false, + "setTimeout": false + }, + "amd": { + "define": false, + "require": false + }, + "mocha": { + "after": false, + "afterEach": false, + "before": false, + "beforeEach": false, + "context": false, + "describe": false, + "it": false, + "setup": false, + "specify": false, + "suite": false, + "suiteSetup": false, + "suiteTeardown": false, + "teardown": false, + "test": false, + "xcontext": false, + "xdescribe": false, + "xit": false, + "xspecify": false + }, + "jasmine": { + "afterAll": false, + "afterEach": false, + "beforeAll": false, + "beforeEach": false, + "describe": false, + "expect": false, + "fail": false, + "fdescribe": false, + "fit": false, + "it": false, + "jasmine": false, + "pending": false, + "runs": false, + "spyOn": false, + "waits": false, + "waitsFor": false, + "xdescribe": false, + "xit": false + }, + "qunit": { + "asyncTest": false, + "deepEqual": false, + "equal": false, + "expect": false, + "module": false, + "notDeepEqual": false, + "notEqual": false, + "notPropEqual": false, + "notStrictEqual": false, + "ok": false, + "propEqual": false, + "QUnit": false, + "raises": false, + "start": false, + "stop": false, + "strictEqual": false, + "test": false, + "throws": false + }, + "phantomjs": { + "console": true, + "exports": true, + "phantom": true, + "require": true, + "WebPage": true + }, + "couch": { + "emit": false, + "exports": false, + "getRow": false, + "log": false, + "module": false, + "provides": false, + "require": false, + "respond": false, + "send": false, + "start": false, + "sum": false + }, + "rhino": { + "defineClass": false, + "deserialize": false, + "gc": false, + "help": false, + "importClass": false, + "importPackage": false, + "java": false, + "load": false, + "loadClass": false, + "Packages": false, + "print": false, + "quit": false, + "readFile": false, + "readUrl": false, + "runCommand": false, + "seal": false, + "serialize": false, + "spawn": false, + "sync": false, + "toint32": false, + "version": false + }, + "wsh": { + "ActiveXObject": true, + "Enumerator": true, + "GetObject": true, + "ScriptEngine": true, + "ScriptEngineBuildVersion": true, + "ScriptEngineMajorVersion": true, + "ScriptEngineMinorVersion": true, + "VBArray": true, + "WScript": true, + "WSH": true, + "XDomainRequest": true + }, + "jquery": { + "$": false, + "jQuery": false + }, + "yui": { + "Y": false, + "YUI": false, + "YUI_config": false + }, + "shelljs": { + "cat": false, + "cd": false, + "chmod": false, + "config": false, + "cp": false, + "dirs": false, + "echo": false, + "env": false, + "error": false, + "exec": false, + "exit": false, + "find": false, + "grep": false, + "ls": false, + "mkdir": false, + "mv": false, + "popd": false, + "pushd": false, + "pwd": false, + "rm": false, + "sed": false, + "target": false, + "tempdir": false, + "test": false, + "which": false + }, + "prototypejs": { + "$": false, + "$$": false, + "$A": false, + "$break": false, + "$continue": false, + "$F": false, + "$H": false, + "$R": false, + "$w": false, + "Abstract": false, + "Ajax": false, + "Autocompleter": false, + "Builder": false, + "Class": false, + "Control": false, + "Draggable": false, + "Draggables": false, + "Droppables": false, + "Effect": false, + "Element": false, + "Enumerable": false, + "Event": false, + "Field": false, + "Form": false, + "Hash": false, + "Insertion": false, + "ObjectRange": false, + "PeriodicalExecuter": false, + "Position": false, + "Prototype": false, + "Scriptaculous": false, + "Selector": false, + "Sortable": false, + "SortableObserver": false, + "Sound": false, + "Template": false, + "Toggle": false, + "Try": false + }, + "meteor": { + "$": false, + "_": false, + "Accounts": false, + "App": false, + "Assets": false, + "Blaze": false, + "check": false, + "Cordova": false, + "DDP": false, + "DDPServer": false, + "Deps": false, + "EJSON": false, + "Email": false, + "HTTP": false, + "Log": false, + "Match": false, + "Meteor": false, + "Mongo": false, + "MongoInternals": false, + "Npm": false, + "Package": false, + "Plugin": false, + "process": false, + "Random": false, + "ReactiveDict": false, + "ReactiveVar": false, + "Router": false, + "Session": false, + "share": false, + "Spacebars": false, + "Template": false, + "Tinytest": false, + "Tracker": false, + "UI": false, + "Utils": false, + "WebApp": false, + "WebAppInternals": false + }, + "mongo": { + "_isWindows": false, + "_rand": false, + "BulkWriteResult": false, + "cat": false, + "cd": false, + "connect": false, + "db": false, + "getHostName": false, + "getMemInfo": false, + "hostname": false, + "listFiles": false, + "load": false, + "ls": false, + "md5sumFile": false, + "mkdir": false, + "Mongo": false, + "ObjectId": false, + "PlanCache": false, + "pwd": false, + "quit": false, + "removeFile": false, + "rs": false, + "sh": false, + "UUID": false, + "version": false, + "WriteResult": false + }, + "applescript": { + "$": false, + "Application": false, + "Automation": false, + "console": false, + "delay": false, + "Library": false, + "ObjC": false, + "ObjectSpecifier": false, + "Path": false, + "Progress": false, + "Ref": false + } +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/globals/index.js b/node_modules/standard/node_modules/eslint/node_modules/globals/index.js new file mode 100644 index 00000000..a02ef248 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/globals/index.js @@ -0,0 +1 @@ +module.exports = require('./globals.json'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/globals/license b/node_modules/standard/node_modules/eslint/node_modules/globals/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/globals/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/standard/node_modules/eslint/node_modules/globals/package.json b/node_modules/standard/node_modules/eslint/node_modules/globals/package.json new file mode 100644 index 00000000..3d19aef6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/globals/package.json @@ -0,0 +1,73 @@ +{ + "name": "globals", + "version": "6.4.1", + "description": "Global identifiers from different JavaScript environments", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/globals" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "globals.json" + ], + "keywords": [ + "globals", + "global", + "identifiers", + "variables", + "vars", + "jshint", + "eslint", + "environments" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "c8e9f2aba0eaea2a732452667a386178ddd6bcb7", + "bugs": { + "url": "https://github.com/sindresorhus/globals/issues" + }, + "homepage": "https://github.com/sindresorhus/globals", + "_id": "globals@6.4.1", + "_shasum": "8498032b3b6d1cc81eebc5f79690d8fe29fabf4f", + "_from": "globals@>=6.1.0 <7.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "nzakas", + "email": "nicholas@nczconsulting.com" + }, + { + "name": "lo1tuma", + "email": "schreck.mathias@gmail.com" + } + ], + "dist": { + "shasum": "8498032b3b6d1cc81eebc5f79690d8fe29fabf4f", + "tarball": "http://registry.npmjs.org/globals/-/globals-6.4.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/globals/-/globals-6.4.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/globals/readme.md b/node_modules/standard/node_modules/eslint/node_modules/globals/readme.md new file mode 100644 index 00000000..dc23c97f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/globals/readme.md @@ -0,0 +1,39 @@ +# globals [![Build Status](https://travis-ci.org/sindresorhus/globals.svg?branch=master)](https://travis-ci.org/sindresorhus/globals) + +> Global identifiers from different JavaScript environments + +Extracted from [JSHint](https://github.com/jshint/jshint/blob/master/src/vars.js) and [ESLint](https://github.com/nzakas/eslint/blob/master/conf/environments.json) and merged. + +It's just a [JSON file](globals.json), so use it in whatever environment you like. + + +## Install + +``` +$ npm install --save globals +``` + + +## Usage + +```js +var globals = require('globals'); + +console.log(globals.browser); +/* +{ + addEventListener: false, + applicationCache: false, + ArrayBuffer: false, + atob: false, + ... +} +*/ +``` + +Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/CHANGELOG.md b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/CHANGELOG.md new file mode 100644 index 00000000..4cddf198 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/CHANGELOG.md @@ -0,0 +1,292 @@ +3.3.0 / 2015-04-26 +------------------ + +- Significantly improved long strings formatting in dumper, thanks to @isaacs. +- Strip BOM if exists. + + +3.2.7 / 2015-02-19 +------------------ + +- Maintenance release. +- Updated dependencies. +- HISTORY.md -> CHANGELOG.md + + +3.2.6 / 2015-02-07 +------------------ + +- Fixed encoding of UTF-16 surrogate pairs. (e.g. "\U0001F431" CAT FACE). +- Fixed demo dates dump (#113, thanks to @Hypercubed). + + +3.2.5 / 2014-12-28 +------------------ + +- Fixed resolving of all built-in types on empty nodes. +- Fixed invalid warning on empty lines within quoted scalars and flow collections. +- Fixed bug: Tag on an empty node didn't resolve in some cases. + + +3.2.4 / 2014-12-19 +------------------ + +- Fixed resolving of !!null tag on an empty node. + + +3.2.3 / 2014-11-08 +------------------ + +- Implemented dumping of objects with circular and cross references. +- Partially fixed aliasing of constructed objects. (see issue #141 for details) + + +3.2.2 / 2014-09-07 +------------------ + +- Fixed infinite loop on unindented block scalars. +- Rewritten base64 encode/decode in binary type, to keep code licence clear. + + +3.2.1 / 2014-08-24 +------------------ + +- Nothig new. Just fix npm publish error. + + +3.2.0 / 2014-08-24 +------------------ + +- Added input piping support to CLI. +- Fixed typo, that could cause hand on initial indent (#139). + + +3.1.0 / 2014-07-07 +------------------ + +- 1.5x-2x speed boost. +- Removed deprecated `require('xxx.yml')` support. +- Significant code cleanup and refactoring. +- Internal API changed. If you used custom types - see updated examples. + Others are not affected. +- Even if the input string has no trailing line break character, + it will be parsed as if it has one. +- Added benchmark scripts. +- Moved bower files to /dist folder +- Bugfixes. + + +3.0.2 / 2014-02-27 +------------------ + +- Fixed bug: "constructor" string parsed as `null`. + + +3.0.1 / 2013-12-22 +------------------ + +- Fixed parsing of literal scalars. (issue #108) +- Prevented adding unnecessary spaces in object dumps. (issue #68) +- Fixed dumping of objects with very long (> 1024 in length) keys. + + +3.0.0 / 2013-12-16 +------------------ + +- Refactored code. Changed API for custom types. +- Removed output colors in CLI, dump json by default. +- Removed big dependencies from browser version (esprima, buffer) + - load `esprima` manually, if !!js/function needed + - !!bin now returns Array in browser +- AMD support. +- Don't quote dumped strings because of `-` & `?` (if not first char). +- __Deprecated__ loading yaml files via `require()`, as not recommended + behaviour for node. + + +2.1.3 / 2013-10-16 +------------------ + +- Fix wrong loading of empty block scalars. + + +2.1.2 / 2013-10-07 +------------------ + +- Fix unwanted line breaks in folded scalars. + + +2.1.1 / 2013-10-02 +------------------ + +- Dumper now respects deprecated booleans syntax from YAML 1.0/1.1 +- Fixed reader bug in JSON-like sequences/mappings. + + +2.1.0 / 2013-06-05 +------------------ + +- Add standard YAML schemas: Failsafe (`FAILSAFE_SCHEMA`), + JSON (`JSON_SCHEMA`) and Core (`CORE_SCHEMA`). +- Rename `DEFAULT_SCHEMA` to `DEFAULT_FULL_SCHEMA` + and `SAFE_SCHEMA` to `DEFAULT_SAFE_SCHEMA`. +- Bug fix: export `NIL` constant from the public interface. +- Add `skipInvalid` dumper option. +- Use `safeLoad` for `require` extension. + + +2.0.5 / 2013-04-26 +------------------ + +- Close security issue in !!js/function constructor. + Big thanks to @nealpoole for security audit. + + +2.0.4 / 2013-04-08 +------------------ + +- Updated .npmignore to reduce package size + + +2.0.3 / 2013-02-26 +------------------ + +- Fixed dumping of empty arrays ans objects. ([] and {} instead of null) + + +2.0.2 / 2013-02-15 +------------------ + +- Fixed input validation: tabs are printable characters. + + +2.0.1 / 2013-02-09 +------------------ + +- Fixed error, when options not passed to function cass + + +2.0.0 / 2013-02-09 +------------------ + +- Full rewrite. New architecture. Fast one-stage parsing. +- Changed custom types API. +- Added YAML dumper. + + +1.0.3 / 2012-11-05 +------------------ + +- Fixed utf-8 files loading. + + +1.0.2 / 2012-08-02 +------------------ + +- Pull out hand-written shims. Use ES5-Shims for old browsers support. See #44. +- Fix timstamps incorectly parsed in local time when no time part specified. + + +1.0.1 / 2012-07-07 +------------------ + +- Fixes `TypeError: 'undefined' is not an object` under Safari. Thanks Phuong. +- Fix timestamps incorrectly parsed in local time. Thanks @caolan. Closes #46. + + +1.0.0 / 2012-07-01 +------------------ + +- `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore. + Fixes #42. +- `require(filename)` now returns a single document and throws an Error if + file contains more than one document. +- CLI was merged back from js-yaml.bin + + +0.3.7 / 2012-02-28 +------------------ + +- Fix export of `addConstructor()`. Closes #39. + + +0.3.6 / 2012-02-22 +------------------ + +- Removed AMD parts - too buggy to use. Need help to rewrite from scratch +- Removed YUI compressor warning (renamed `double` variable). Closes #40. + + +0.3.5 / 2012-01-10 +------------------ + +- Workagound for .npmignore fuckup under windows. Thanks to airportyh. + + +0.3.4 / 2011-12-24 +------------------ + +- Fixes str[] for oldIEs support. +- Adds better has change support for browserified demo. +- improves compact output of Error. Closes #33. + + +0.3.3 / 2011-12-20 +------------------ + +- jsyaml executable moved to separate module. +- adds `compact` stringification of Errors. + + +0.3.2 / 2011-12-16 +------------------ + +- Fixes ug with block style scalars. Closes #26. +- All sources are passing JSLint now. +- Fixes bug in Safari. Closes #28. +- Fixes bug in Opers. Closes #29. +- Improves browser support. Closes #20. +- Added jsyaml executable. +- Added !!js/function support. Closes #12. + + +0.3.1 / 2011-11-18 +------------------ + +- Added AMD support for browserified version. +- Wrapped browserified js-yaml into closure. +- Fixed the resolvement of non-specific tags. Closes #17. +- Added permalinks for online demo YAML snippets. Now we have YPaste service, lol. +- Added !!js/regexp and !!js/undefined types. Partially solves #12. +- Fixed !!set mapping. +- Fixed month parse in dates. Closes #19. + + +0.3.0 / 2011-11-09 +------------------ + +- Removed JS.Class dependency. Closes #3. +- Added browserified version. Closes #13. +- Added live demo of browserified version. +- Ported some of the PyYAML tests. See #14. +- Fixed timestamp bug when fraction was given. + + +0.2.2 / 2011-11-06 +------------------ + +- Fixed crash on docs without ---. Closes #8. +- Fixed miltiline string parse +- Fixed tests/comments for using array as key + + +0.2.1 / 2011-11-02 +------------------ + +- Fixed short file read (<4k). Closes #9. + + +0.2.0 / 2011-11-02 +------------------ + +- First public release diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/LICENSE new file mode 100644 index 00000000..09d3a29e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (C) 2011-2015 by Vitaly Puzrin + +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/node_modules/standard/node_modules/eslint/node_modules/js-yaml/README.md b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/README.md new file mode 100644 index 00000000..c181df16 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/README.md @@ -0,0 +1,288 @@ +JS-YAML - YAML 1.2 parser and serializer for JavaScript +======================================================= + +[![Build Status](https://travis-ci.org/nodeca/js-yaml.svg?branch=master)](https://travis-ci.org/nodeca/js-yaml) +[![NPM version](https://img.shields.io/npm/v/js-yaml.svg)](https://www.npmjs.org/package/js-yaml) + +[Online Demo](http://nodeca.github.com/js-yaml/) + + +This is an implementation of [YAML](http://yaml.org/), a human friendly data +serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was +completely rewritten from scratch. Now it's very fast, and supports 1.2 spec. + + +Installation +------------ + +### YAML module for node.js + +``` +npm install js-yaml +``` + + +### CLI executable + +If you want to inspect your YAML files from CLI, install js-yaml globally: + +``` +npm install -g js-yaml +``` + +#### Usage + +``` +usage: js-yaml [-h] [-v] [-c] [-t] file + +Positional arguments: + file File with YAML document(s) + +Optional arguments: + -h, --help Show this help message and exit. + -v, --version Show program's version number and exit. + -c, --compact Display errors in compact mode + -t, --trace Show stack trace on error +``` + + +### Bundled YAML library for browsers + +``` html + + + + +``` + +Browser support was done mostly for online demo. If you find any errors - feel +free to send pull requests with fixes. Also note, that IE and other old browsers +needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate. + +Notes: + +1. We have no resourses to support browserified version. Don't expect it to be + well tested. Don't expect fast fixes if something goes wrong there. +2. `!!js/function` in browser bundle will not work by default. If you really need + it - load `esprima` parser first (via amd or directly). +3. `!!bin` in browser will return `Array`, because browsers do not support + node.js `Buffer` and adding Buffer shims is completely useless on practice. + + +API +--- + +Here we cover the most 'useful' methods. If you need advanced details (creating +your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and +[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more +info. + +``` javascript +yaml = require('js-yaml'); +fs = require('fs'); + +// Get document, or throw exception on error +try { + var doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8')); + console.log(doc); +} catch (e) { + console.log(e); +} +``` + + +### safeLoad (string [ , options ]) + +**Recommended loading way.** Parses `string` as single YAML document. Returns a JavaScript +object or throws `YAMLException` on error. By default, does not support regexps, +functions and undefined. This method is safe for untrusted data. + +options: + +- `filename` _(default: null)_ - string to be used as a file path in + error/warning messages. +- `onWarning` _(default: null)_ - function to call on warning messages. + Loader will throw on warnings if this function is not provided. +- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use. + - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects: + http://www.yaml.org/spec/1.2/spec.html#id2802346 + - `JSON_SCHEMA` - all JSON-supported types: + http://www.yaml.org/spec/1.2/spec.html#id2803231 + - `CORE_SCHEMA` - same as `JSON_SCHEMA`: + http://www.yaml.org/spec/1.2/spec.html#id2804923 + - `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones + (`!!js/undefined`, `!!js/regexp` and `!!js/function`): + http://yaml.org/type/ + - `DEFAULT_FULL_SCHEMA` - all supported YAML types. + +NOTE: This function **does not** understand multi-document sources, it throws +exception on those. + +NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions. +So, JSON schema is not as strict as defined in the YAML specification. +It allows numbers in any notaion, use `Null` and `NULL` as `null`, etc. +Core schema also has no such restrictions. It allows binary notation for integers. + + +### load (string [ , options ]) + +**Use with care with untrusted sources**. The same as `safeLoad()` but uses +`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types: +`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources you +must additionally validate object structure, to avoid injections: + +``` javascript +var untrusted_code = '"toString": ! "function (){very_evil_thing();}"'; + +// I'm just converting that string, what could possibly go wrong? +require('js-yaml').load(untrusted_code) + '' +``` + + +### safeLoadAll (string, iterator [ , options ]) + +Same as `safeLoad()`, but understands multi-document sources and apply +`iterator` to each document. + +``` javascript +var yaml = require('js-yaml'); + +yaml.safeLoadAll(data, function (doc) { + console.log(doc); +}); +``` + + +### loadAll (string, iterator [ , options ]) + +Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default. + + +### safeDump (object [ , options ]) + +Serializes `object` as YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will +throw exception if you try to dump regexps or functions. However, you can +disable exceptions by `skipInvalid` option. + +options: + +- `indent` _(default: 2)_ - indentation width to use (in spaces). +- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function + in the safe schema) and skip pairs and single values with such types. +- `flowLevel` (default: -1) - specifies level of nesting, when to switch from + block to flow style for collections. -1 means block style everwhere +- `styles` - "tag" => "style" map. Each tag may have own set of styles. +- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use. + +styles: + +``` none +!!null + "canonical" => "~" + +!!int + "binary" => "0b1", "0b101010", "0b1110001111010" + "octal" => "01", "052", "016172" + "decimal" => "1", "42", "7290" + "hexadecimal" => "0x1", "0x2A", "0x1C7A" + +!!null, !!bool, !!float + "lowercase" => "null", "true", "false", ".nan", '.inf' + "uppercase" => "NULL", "TRUE", "FALSE", ".NAN", '.INF' + "camelcase" => "Null", "True", "False", ".NaN", '.Inf' +``` + +By default, !!int uses `decimal`, and !!null, !!bool, !!float use `lowercase`. + + + +### dump (object [ , options ]) + +Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default). + + +Supported YAML types +-------------------- + +The list of standard YAML tags and corresponding JavaScipt types. See also +[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and +[YAML types repository](http://yaml.org/type/). + +``` +!!null '' # null +!!bool 'yes' # bool +!!int '3...' # number +!!float '3.14...' # number +!!binary '...base64...' # buffer +!!timestamp 'YYYY-...' # date +!!omap [ ... ] # array of key-value pairs +!!pairs [ ... ] # array or array pairs +!!set { ... } # array of objects with given keys and null values +!!str '...' # string +!!seq [ ... ] # array +!!map { ... } # object +``` + +**JavaScript-specific tags** + +``` +!!js/regexp /pattern/gim # RegExp +!!js/undefined '' # Undefined +!!js/function 'function () {...}' # Function +``` + +Caveats +------- + +Note, that you use arrays or objects as key in JS-YAML. JS do not allows objects +or array as keys, and stringifies (by calling .toString method) them at the +moment of adding them. + +``` yaml +--- +? [ foo, bar ] +: - baz +? { foo: bar } +: - baz + - baz +``` + +``` javascript +{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] } +``` + +Also, reading of properties on implicit block mapping keys is not supported yet. +So, the following YAML document cannot be loaded. + +``` yaml +&anchor foo: + foo: bar + *anchor: duplicate key + baz: bat + *anchor: duplicate key +``` + + +Breaking changes in 2.x.x -> 3.x.x +---------------------------------- + +If your have not used __custom__ tags or loader classes and not loaded yaml +files via `require()` - no changes needed. Just upgrade library. + +In other case, you should: + +1. Replace all occurences of `require('xxxx.yml')` by `fs.readFileSync()` + + `yaml.safeLoad()`. +2. rewrite your custom tags constructors and custom loader + classes, to conform new API. See + [examples](https://github.com/nodeca/js-yaml/tree/master/examples) and + [wiki](https://github.com/nodeca/js-yaml/wiki) for details. + + +License +------- + +View the [LICENSE](https://github.com/nodeca/js-yaml/blob/master/LICENSE) file +(MIT). diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/bin/js-yaml.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/bin/js-yaml.js new file mode 100755 index 00000000..e6029d64 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/bin/js-yaml.js @@ -0,0 +1,142 @@ +#!/usr/bin/env node + + +'use strict'; + +/*eslint-disable no-console*/ + + +// stdlib +var fs = require('fs'); + + +// 3rd-party +var argparse = require('argparse'); + + +// internal +var yaml = require('..'); + + +//////////////////////////////////////////////////////////////////////////////// + + +var cli = new argparse.ArgumentParser({ + prog: 'js-yaml', + version: require('../package.json').version, + addHelp: true +}); + + +cli.addArgument([ '-c', '--compact' ], { + help: 'Display errors in compact mode', + action: 'storeTrue' +}); + + +// deprecated (not needed after we removed output colors) +// option suppressed, but not completely removed for compatibility +cli.addArgument([ '-j', '--to-json' ], { + help: argparse.Const.SUPPRESS, + dest: 'json', + action: 'storeTrue' +}); + + +cli.addArgument([ '-t', '--trace' ], { + help: 'Show stack trace on error', + action: 'storeTrue' +}); + +cli.addArgument([ 'file' ], { + help: 'File to read, utf-8 encoded without BOM', + nargs: '?', + defaultValue: '-' +}); + + +//////////////////////////////////////////////////////////////////////////////// + + +var options = cli.parseArgs(); + + +//////////////////////////////////////////////////////////////////////////////// + +function readFile(filename, encoding, callback) { + if (options.file === '-') { + // read from stdin + + var chunks = []; + + process.stdin.on('data', function (chunk) { + chunks.push(chunk); + }); + + process.stdin.on('end', function () { + return callback(null, Buffer.concat(chunks).toString(encoding)); + }); + } else { + fs.readFile(filename, encoding, callback); + } +} + +readFile(options.file, 'utf8', function (error, input) { + var output, isYaml; + + if (error) { + if (error.code === 'ENOENT') { + console.error('File not found: ' + options.file); + process.exit(2); + } + + console.error( + options.trace && error.stack || + error.message || + String(error)); + + process.exit(1); + } + + try { + output = JSON.parse(input); + isYaml = false; + } catch (error) { + if (error instanceof SyntaxError) { + try { + output = []; + yaml.loadAll(input, function (doc) { output.push(doc); }, {}); + isYaml = true; + + if (0 === output.length) { + output = null; + } else if (1 === output.length) { + output = output[0]; + } + } catch (error) { + if (options.trace && error.stack) { + console.error(error.stack); + } else { + console.error(error.toString(options.compact)); + } + + process.exit(1); + } + } else { + console.error( + options.trace && error.stack || + error.message || + String(error)); + + process.exit(1); + } + } + + if (isYaml) { + console.log(JSON.stringify(output, null, ' ')); + } else { + console.log(yaml.dump(output)); + } + + process.exit(0); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/bower.json b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/bower.json new file mode 100644 index 00000000..010912f1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/bower.json @@ -0,0 +1,23 @@ + +{ + "name": "js-yaml", + "main": "dist/js-yaml.js", + "homepage": "https://github.com/nodeca/js-yaml", + "authors": [ "Dervus Grim ", + "Vitaly Puzrin ", + "Aleksey V Zapparov ", + "Martin Grenfell " ], + "description": "YAML 1.2 parser and serializer", + "keywords": ["yaml", "parser", "serializer", "pyyaml"], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "benchmark", + "bower_components", + "test", + "Makefile", + "index*", + "package.json" + ] +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/dist/js-yaml.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/dist/js-yaml.js new file mode 100644 index 00000000..f917fea9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/dist/js-yaml.js @@ -0,0 +1,3947 @@ +/* js-yaml 3.3.0 https://github.com/nodeca/js-yaml */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jsyaml=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (null === map) { + return {}; + } + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if ('!!' === tag.slice(0, 2)) { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + + type = schema.compiledTypeMap[tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + +function State(options) { + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + if (line.length && line !== '\n') { + result += ind; + } + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +function StringBuilder(source) { + this.source = source; + this.result = ''; + this.checkpoint = 0; +} + +StringBuilder.prototype.takeUpTo = function (position) { + var er; + + if (position < this.checkpoint) { + er = new Error('position should be > checkpoint'); + er.position = position; + er.checkpoint = this.checkpoint; + throw er; + } + + this.result += this.source.slice(this.checkpoint, position); + this.checkpoint = position; + return this; +}; + +StringBuilder.prototype.escapeChar = function () { + var character, esc; + + character = this.source.charCodeAt(this.checkpoint); + esc = ESCAPE_SEQUENCES[character] || encodeHex(character); + this.result += esc; + this.checkpoint += 1; + + return this; +}; + +StringBuilder.prototype.finish = function () { + if (this.source.length > this.checkpoint) { + this.takeUpTo(this.source.length); + } +}; + +function writeScalar(state, object, level) { + var simple, first, spaceWrap, folded, literal, single, double, + sawLineFeed, linePosition, longestLine, indent, max, character, + position, escapeSeq, hexEsc, previous, lineLength, modifier, + trailingLineBreaks, result; + + if (0 === object.length) { + state.dump = "''"; + return; + } + + if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) { + state.dump = "'" + object + "'"; + return; + } + + simple = true; + first = object.length ? object.charCodeAt(0) : 0; + spaceWrap = (CHAR_SPACE === first || + CHAR_SPACE === object.charCodeAt(object.length - 1)); + + // Simplified check for restricted first characters + // http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29 + if (CHAR_MINUS === first || + CHAR_QUESTION === first || + CHAR_COMMERCIAL_AT === first || + CHAR_GRAVE_ACCENT === first) { + simple = false; + } + + // can only use > and | if not wrapped in spaces. + if (spaceWrap) { + simple = false; + folded = false; + literal = false; + } else { + folded = true; + literal = true; + } + + single = true; + double = new StringBuilder(object); + + sawLineFeed = false; + linePosition = 0; + longestLine = 0; + + indent = state.indent * level; + max = 80; + if (indent < 40) { + max -= indent; + } else { + max = 40; + } + + for (position = 0; position < object.length; position++) { + character = object.charCodeAt(position); + if (simple) { + // Characters that can never appear in the simple scalar + if (!simpleChar(character)) { + simple = false; + } else { + // Still simple. If we make it all the way through like + // this, then we can just dump the string as-is. + continue; + } + } + + if (single && character === CHAR_SINGLE_QUOTE) { + single = false; + } + + escapeSeq = ESCAPE_SEQUENCES[character]; + hexEsc = needsHexEscape(character); + + if (!escapeSeq && !hexEsc) { + continue; + } + + if (character !== CHAR_LINE_FEED && + character !== CHAR_DOUBLE_QUOTE && + character !== CHAR_SINGLE_QUOTE) { + folded = false; + literal = false; + } else if (character === CHAR_LINE_FEED) { + sawLineFeed = true; + single = false; + if (position > 0) { + previous = object.charCodeAt(position - 1); + if (previous === CHAR_SPACE) { + literal = false; + folded = false; + } + } + if (folded) { + lineLength = position - linePosition; + linePosition = position; + if (lineLength > longestLine) { + longestLine = lineLength; + } + } + } + + if (character !== CHAR_DOUBLE_QUOTE) { + single = false; + } + + double.takeUpTo(position); + double.escapeChar(); + } + + if (simple && testImplicitResolving(state, object)) { + simple = false; + } + + modifier = ''; + if (folded || literal) { + trailingLineBreaks = 0; + if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) { + trailingLineBreaks += 1; + if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) { + trailingLineBreaks += 1; + } + } + + if (trailingLineBreaks === 0) { + modifier = '-'; + } else if (trailingLineBreaks === 2) { + modifier = '+'; + } + } + + if (literal && longestLine < max) { + folded = false; + } + + // If it's literally one line, then don't bother with the literal. + // We may still want to do a fold, though, if it's a super long line. + if (!sawLineFeed) { + literal = false; + } + + if (simple) { + state.dump = object; + } else if (single) { + state.dump = '\'' + object + '\''; + } else if (folded) { + result = fold(object, max); + state.dump = '>' + modifier + '\n' + indentString(result, indent); + } else if (literal) { + if (!modifier) { + object = object.replace(/\n$/, ''); + } + state.dump = '|' + modifier + '\n' + indentString(object, indent); + } else if (double) { + double.finish(); + state.dump = '"' + double.result + '"'; + } else { + throw new Error('Failed to dump scalar value'); + } + + return; +} + +// The `trailing` var is a regexp match of any trailing `\n` characters. +// +// There are three cases we care about: +// +// 1. One trailing `\n` on the string. Just use `|` or `>`. +// This is the assumed default. (trailing = null) +// 2. No trailing `\n` on the string. Use `|-` or `>-` to "chomp" the end. +// 3. More than one trailing `\n` on the string. Use `|+` or `>+`. +// +// In the case of `>+`, these line breaks are *not* doubled (like the line +// breaks within the string), so it's important to only end with the exact +// same number as we started. +function fold(object, max) { + var result = '', + position = 0, + length = object.length, + trailing = /\n+$/.exec(object), + newLine; + + if (trailing) { + length = trailing.index + 1; + } + + while (position < length) { + newLine = object.indexOf('\n', position); + if (newLine > length || newLine === -1) { + if (result) { + result += '\n\n'; + } + result += foldLine(object.slice(position, length), max); + position = length; + } else { + if (result) { + result += '\n\n'; + } + result += foldLine(object.slice(position, newLine), max); + position = newLine + 1; + } + } + if (trailing && trailing[0] !== '\n') { + result += trailing[0]; + } + + return result; +} + +function foldLine(line, max) { + if (line === '') { + return line; + } + + var foldRe = /[^\s] [^\s]/g, + result = '', + prevMatch = 0, + foldStart = 0, + match = foldRe.exec(line), + index, + foldEnd, + folded; + + while (match) { + index = match.index; + + // when we cross the max len, if the previous match would've + // been ok, use that one, and carry on. If there was no previous + // match on this fold section, then just have a long line. + if (index - foldStart > max) { + if (prevMatch !== foldStart) { + foldEnd = prevMatch; + } else { + foldEnd = index; + } + + if (result) { + result += '\n'; + } + folded = line.slice(foldStart, foldEnd); + result += folded; + foldStart = foldEnd + 1; + } + prevMatch = index + 1; + match = foldRe.exec(line); + } + + if (result) { + result += '\n'; + } + + // if we end up with one last word at the end, then the last bit might + // be slightly bigger than we wanted, because we exited out of the loop. + if (foldStart !== prevMatch && line.length - foldStart > max) { + result += line.slice(foldStart, prevMatch) + '\n' + + line.slice(prevMatch + 1); + } else { + result += line.slice(foldStart); + } + + return result; +} + +// Returns true if character can be found in a simple scalar +function simpleChar(character) { + return CHAR_TAB !== character && + CHAR_LINE_FEED !== character && + CHAR_CARRIAGE_RETURN !== character && + CHAR_COMMA !== character && + CHAR_LEFT_SQUARE_BRACKET !== character && + CHAR_RIGHT_SQUARE_BRACKET !== character && + CHAR_LEFT_CURLY_BRACKET !== character && + CHAR_RIGHT_CURLY_BRACKET !== character && + CHAR_SHARP !== character && + CHAR_AMPERSAND !== character && + CHAR_ASTERISK !== character && + CHAR_EXCLAMATION !== character && + CHAR_VERTICAL_LINE !== character && + CHAR_GREATER_THAN !== character && + CHAR_SINGLE_QUOTE !== character && + CHAR_DOUBLE_QUOTE !== character && + CHAR_PERCENT !== character && + CHAR_COLON !== character && + !ESCAPE_SEQUENCES[character] && + !needsHexEscape(character); +} + +// Returns true if the character code needs to be escaped. +function needsHexEscape(character) { + return !((0x00020 <= character && character <= 0x00007E) || + (0x00085 === character) || + (0x000A0 <= character && character <= 0x00D7FF) || + (0x0E000 <= character && character <= 0x00FFFD) || + (0x10000 <= character && character <= 0x10FFFF)); +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level, object[index], false, false)) { + if (0 !== index) { + _result += ', '; + } + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || 0 !== index) { + _result += generateNextLine(state, level); + } + _result += '- ' + state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (0 !== index) { + pairBuffer += ', '; + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) { + pairBuffer += '? '; + } + + pairBuffer += state.dump + ': '; + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || 0 !== index) { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level + 1, objectKey, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (null !== state.tag && '?' !== state.tag) || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + state.tag = explicit ? type.tag : '?'; + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if ('[object Function]' === _toString.call(type.represent)) { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + + if (block) { + block = (0 > state.flowLevel || state.flowLevel > level); + } + + if ((null !== state.tag && '?' !== state.tag) || (2 !== state.indent && level > 0)) { + compact = false; + } + + var objectOrArray = '[object Object]' === type || '[object Array]' === type, + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if ('[object Object]' === type) { + if (block && (0 !== Object.keys(state.dump).length)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if ('[object Array]' === type) { + if (block && (0 !== state.dump.length)) { + writeBlockSequence(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if ('[object String]' === type) { + if ('?' !== state.tag) { + writeScalar(state, state.dump, level); + } + } else { + if (state.skipInvalid) { + return false; + } + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (null !== state.tag && '?' !== state.tag) { + state.dump = '!<' + state.tag + '> ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var type = _toString.call(object), + objectKeyList, + index, + length; + + if (null !== object && 'object' === typeof object) { + index = objects.indexOf(object); + if (-1 !== index) { + if (-1 === duplicatesIndexes.indexOf(index)) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State(options); + + getDuplicateReferences(input, state); + + if (writeNode(state, 0, input, true, true)) { + return state.dump + '\n'; + } + return ''; +} + +function safeDump(input, options) { + return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + +module.exports.dump = dump; +module.exports.safeDump = safeDump; + +},{"./common":3,"./exception":5,"./schema/default_full":10,"./schema/default_safe":11}],5:[function(require,module,exports){ +'use strict'; + + +function YAMLException(reason, mark) { + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = this.toString(false); +} + + +YAMLException.prototype.toString = function toString(compact) { + var result; + + result = 'JS-YAML: ' + (this.reason || '(unknown reason)'); + + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); + } + + return result; +}; + + +module.exports = YAMLException; + +},{}],6:[function(require,module,exports){ +'use strict'; + +/*eslint-disable max-len,no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Mark = require('./mark'); +var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); +var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uD800-\uDFFF\uFFFE\uFFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return 0x2C/* , */ === c || + 0x5B/* [ */ === c || + 0x5D/* ] */ === c || + 0x7B/* { */ === c || + 0x7D/* } */ === c; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.onWarning = options['onWarning'] || null; + this.legacy = options['legacy'] || false; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + return new YAMLException( + message, + new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + var error = generateError(state, message); + + if (state.onWarning) { + state.onWarning.call(null, error); + } else { + throw error; + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (null !== state.version) { + throwError(state, 'duplication of %YAML directive'); + } + + if (1 !== args.length) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (null === match) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (1 !== major) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (1 !== minor && 2 !== minor) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (2 !== args.length) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; + _position < _length; + _position += 1) { + _character = _result.charCodeAt(_position); + if (!(0x09 === _character || + 0x20 <= _character && _character <= 0x10FFFF)) { + throwError(state, 'expected valid JSON character'); + } + } + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + } + } +} + +function storeMappingPair(state, _result, keyTag, keyNode, valueNode) { + var index, quantity; + + keyNode = String(keyNode); + + if (null === _result) { + _result = {}; + } + + if ('tag:yaml.org,2002:merge' === keyTag) { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index]); + } + } else { + mergeMappings(state, _result, valueNode); + } + } else { + _result[keyNode] = valueNode; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (0x0A/* LF */ === ch) { + state.position++; + } else if (0x0D/* CR */ === ch) { + state.position++; + if (0x0A/* LF */ === state.input.charCodeAt(state.position)) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (0 !== ch) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && 0x23/* # */ === ch) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && 0 !== ch); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (0x20/* Space */ === ch) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((0x2D/* - */ === ch || 0x2E/* . */ === ch) && + state.input.charCodeAt(_position + 1) === ch && + state.input.charCodeAt(_position + 2) === ch) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (1 === count) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + 0x23/* # */ === ch || + 0x26/* & */ === ch || + 0x2A/* * */ === ch || + 0x21/* ! */ === ch || + 0x7C/* | */ === ch || + 0x3E/* > */ === ch || + 0x27/* ' */ === ch || + 0x22/* " */ === ch || + 0x25/* % */ === ch || + 0x40/* @ */ === ch || + 0x60/* ` */ === ch) { + return false; + } + + if (0x3F/* ? */ === ch || 0x2D/* - */ === ch) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (0 !== ch) { + if (0x3A/* : */ === ch) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (0x23/* # */ === ch) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (0x27/* ' */ !== ch) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while (0 !== (ch = state.input.charCodeAt(state.position))) { + if (0x27/* ' */ === ch) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (0x27/* ' */ === ch) { + captureStart = captureEnd = state.position; + state.position++; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, tmpEsc, + ch; + + ch = state.input.charCodeAt(state.position); + + if (0x22/* " */ !== ch) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while (0 !== (ch = state.input.charCodeAt(state.position))) { + if (0x22/* " */ === ch) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (0x5C/* \ */ === ch) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (null !== state.anchor) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (0 !== ch) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (0x3F/* ? */ === ch) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && 0x3A/* : */ === ch) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (0x2C/* , */ === ch) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (0 !== ch) { + ch = state.input.charCodeAt(++state.position); + + if (0x2B/* + */ === ch || 0x2D/* - */ === ch) { + if (CHOMPING_CLIP === chomping) { + chomping = (0x2B/* + */ === ch) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (0x23/* # */ === ch) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (0 !== ch)); + } + } + + while (0 !== ch) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (0x20/* Space */ === ch)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (detectedIndent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + state.result += common.repeat('\n', emptyLines + 1); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (0 === emptyLines) { + if (detectedIndent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else if (detectedIndent) { + // If current line isn't the first one - count line break from the last content line. + state.result += common.repeat('\n', emptyLines + 1); + } else { + // In case of the first content line - count only empty lines. + } + + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (0 !== ch)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + if (null !== state.anchor) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (0 !== ch) { + + if (0x2D/* - */ !== ch) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (0 !== ch)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + if (null !== state.anchor) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (0 !== ch) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((0x3F/* ? */ === ch || 0x3A/* : */ === ch) && is_WS_OR_EOL(following)) { + + if (0x3F/* ? */ === ch) { + if (atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (0x3A/* : */ === ch) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else { + break; // Reading is done. Go to the epilogue. + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, valueNode); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if (state.lineIndent > nodeIndent && (0 !== ch)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, null); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (0x21/* ! */ !== ch) { + return false; + } + + if (null !== state.tag) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (0x3C/* < */ === ch) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (0x21/* ! */ === ch) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (0 !== ch && 0x3E/* > */ !== ch); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (0 !== ch && !is_WS_OR_EOL(ch)) { + + if (0x21/* ! */ === ch) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if ('!' === tagHandle) { + state.tag = '!' + tagName; + + } else if ('!!' === tagHandle) { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (0x26/* & */ !== ch) { + return false; + } + + if (null !== state.anchor) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + len = state.length, + input = state.input, + ch; + + ch = state.input.charCodeAt(state.position); + + if (0x2A/* * */ !== ch) { + return false; + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!state.anchorMap.hasOwnProperty(alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (1 === indentStatus) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (1 === indentStatus) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (null !== state.tag || null !== state.anchor) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (null === state.tag) { + state.tag = '?'; + } + } + + if (null !== state.anchor) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (0 === indentStatus) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (null !== state.tag && '!' !== state.tag) { + if ('?' === state.tag) { + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; + typeIndex < typeQuantity; + typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only assigned to plain scalars. So, it isn't + // needed to check for 'kind' conformity. + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (null !== state.anchor) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap, state.tag)) { + type = state.typeMap[state.tag]; + + if (null !== state.result && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result); + if (null !== state.anchor) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwWarning(state, 'unknown tag !<' + state.tag + '>'); + } + } + + return null !== state.tag || null !== state.anchor || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; + + while (0 !== (ch = state.input.charCodeAt(state.position))) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || 0x25/* % */ !== ch) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (0 !== ch && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (0 !== ch) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (0x23/* # */ === ch) { + do { ch = state.input.charCodeAt(++state.position); } + while (0 !== ch && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) { + break; + } + + _position = state.position; + + while (0 !== ch && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (0 !== ch) { + readLineBreak(state); + } + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (0 === state.lineIndent && + 0x2D/* - */ === state.input.charCodeAt(state.position) && + 0x2D/* - */ === state.input.charCodeAt(state.position + 1) && + 0x2D/* - */ === state.input.charCodeAt(state.position + 2)) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (0x2E/* . */ === state.input.charCodeAt(state.position)) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (0x0A/* LF */ !== input.charCodeAt(input.length - 1) && + 0x0D/* CR */ !== input.charCodeAt(input.length - 1)) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + if (PATTERN_NON_PRINTABLE.test(state.input)) { + throwError(state, 'the stream contains non-printable characters'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (0x20/* Space */ === state.input.charCodeAt(state.position)) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + var documents = loadDocuments(input, options), index, length; + + for (index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options), index, length; + + if (0 === documents.length) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (1 === documents.length) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +function safeLoadAll(input, output, options) { + loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; + +},{"./common":3,"./exception":5,"./mark":7,"./schema/default_full":10,"./schema/default_safe":11}],7:[function(require,module,exports){ +'use strict'; + + +var common = require('./common'); + + +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; +} + + +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + + if (!this.buffer) { + return null; + } + + indent = indent || 4; + maxLength = maxLength || 75; + + head = ''; + start = this.position; + + while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) { + start -= 1; + if (this.position - start > (maxLength / 2 - 1)) { + head = ' ... '; + start += 5; + break; + } + } + + tail = ''; + end = this.position; + + while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) { + end += 1; + if (end - this.position > (maxLength / 2 - 1)) { + tail = ' ... '; + end -= 5; + break; + } + } + + snippet = this.buffer.slice(start, end); + + return common.repeat(' ', indent) + head + snippet + tail + '\n' + + common.repeat(' ', indent + this.position - start + head.length) + '^'; +}; + + +Mark.prototype.toString = function toString(compact) { + var snippet, where = ''; + + if (this.name) { + where += 'in "' + this.name + '" '; + } + + where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + + if (!compact) { + snippet = this.getSnippet(); + + if (snippet) { + where += ':\n' + snippet; + } + } + + return where; +}; + + +module.exports = Mark; + +},{"./common":3}],8:[function(require,module,exports){ +'use strict'; + +/*eslint-disable max-len*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Type = require('./type'); + + +function compileList(schema, name, result) { + var exclude = []; + + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); + + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag) { + exclude.push(previousIndex); + } + }); + + result.push(currentType); + }); + + return result.filter(function (type, index) { + return -1 === exclude.indexOf(index); + }); +} + + +function compileMap(/* lists... */) { + var result = {}, index, length; + + function collectType(type) { + result[type.tag] = type; + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + + return result; +} + + +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; + + this.implicit.forEach(function (type) { + if (type.loadKind && 'scalar' !== type.loadKind) { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + }); + + this.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); +} + + +Schema.DEFAULT = null; + + +Schema.create = function createSchema() { + var schemas, types; + + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; + + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; + + default: + throw new YAMLException('Wrong number of arguments for Schema.create function'); + } + + schemas = common.toArray(schemas); + types = common.toArray(types); + + if (!schemas.every(function (schema) { return schema instanceof Schema; })) { + throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + } + + if (!types.every(function (type) { return type instanceof Type; })) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + return new Schema({ + include: schemas, + explicit: types + }); +}; + + +module.exports = Schema; + +},{"./common":3,"./exception":5,"./type":14}],9:[function(require,module,exports){ +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./json') + ] +}); + +},{"../schema":8,"./json":13}],10:[function(require,module,exports){ +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = Schema.DEFAULT = new Schema({ + include: [ + require('./default_safe') + ], + explicit: [ + require('../type/js/undefined'), + require('../type/js/regexp'), + require('../type/js/function') + ] +}); + +},{"../schema":8,"../type/js/function":19,"../type/js/regexp":20,"../type/js/undefined":21,"./default_safe":11}],11:[function(require,module,exports){ +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./core') + ], + implicit: [ + require('../type/timestamp'), + require('../type/merge') + ], + explicit: [ + require('../type/binary'), + require('../type/omap'), + require('../type/pairs'), + require('../type/set') + ] +}); + +},{"../schema":8,"../type/binary":15,"../type/merge":23,"../type/omap":25,"../type/pairs":26,"../type/set":28,"../type/timestamp":30,"./core":9}],12:[function(require,module,exports){ +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + explicit: [ + require('../type/str'), + require('../type/seq'), + require('../type/map') + ] +}); + +},{"../schema":8,"../type/map":22,"../type/seq":27,"../type/str":29}],13:[function(require,module,exports){ +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./failsafe') + ], + implicit: [ + require('../type/null'), + require('../type/bool'), + require('../type/int'), + require('../type/float') + ] +}); + +},{"../schema":8,"../type/bool":16,"../type/float":17,"../type/int":18,"../type/null":24,"./failsafe":12}],14:[function(require,module,exports){ +'use strict'; + +var YAMLException = require('./exception'); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (null !== map) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; + +},{"./exception":5}],15:[function(require,module,exports){ +'use strict'; + +/*eslint-disable no-bitwise*/ + +// A trick for browserified version. +// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined +var NodeBuffer = require('buffer').Buffer; +var Type = require('../type'); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (null === data) { + return false; + } + + var code, idx, bitlen = 0, len = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) { continue; } + + // Fail on illegal characters + if (code < 0) { return false; } + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var code, idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + return new NodeBuffer(result); + } + + return result; +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); + +},{"../type":14,"buffer":1}],16:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +function resolveYamlBoolean(data) { + if (null === data) { + return false; + } + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return '[object Boolean]' === Object.prototype.toString.call(object); +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); + +},{"../type":14}],17:[function(require,module,exports){ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +var YAML_FLOAT_PATTERN = new RegExp( + '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' + + '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' + + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + '|[-+]?\\.(?:inf|Inf|INF)' + + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (null === data) { + return false; + } + + var value, sign, base, digits; + + if (!YAML_FLOAT_PATTERN.test(data)) { + return false; + } + return true; +} + +function constructYamlFloat(data) { + var value, sign, base, digits; + + value = data.replace(/_/g, '').toLowerCase(); + sign = '-' === value[0] ? -1 : 1; + digits = []; + + if (0 <= '+-'.indexOf(value[0])) { + value = value.slice(1); + } + + if ('.inf' === value) { + return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if ('.nan' === value) { + return NaN; + + } else if (0 <= value.indexOf(':')) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); + + value = 0.0; + base = 1; + + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); + + return sign * value; + + } + return sign * parseFloat(value, 10); +} + +function representYamlFloat(object, style) { + if (isNaN(object)) { + switch (style) { + case 'lowercase': + return '.nan'; + case 'uppercase': + return '.NAN'; + case 'camelcase': + return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': + return '.inf'; + case 'uppercase': + return '.INF'; + case 'camelcase': + return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': + return '-.inf'; + case 'uppercase': + return '-.INF'; + case 'camelcase': + return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + return object.toString(10); +} + +function isFloat(object) { + return ('[object Number]' === Object.prototype.toString.call(object)) && + (0 !== object % 1 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); + +},{"../common":3,"../type":14}],18:[function(require,module,exports){ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (null === data) { + return false; + } + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) { return false; } + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) { return true; } + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (ch !== '0' && ch !== '1') { + return false; + } + hasDigits = true; + } + return hasDigits; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (!isHexCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + return hasDigits; + } + + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (!isOctCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + return hasDigits; + } + + // base 10 (except 0) or base 60 + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (ch === ':') { break; } + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + if (!hasDigits) { return false; } + + // if !base60 - done; + if (ch !== ':') { return true; } + + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') { sign = -1; } + value = value.slice(1); + ch = value[0]; + } + + if ('0' === value) { + return 0; + } + + if (ch === '0') { + if (value[1] === 'b') { + return sign * parseInt(value.slice(2), 2); + } + if (value[1] === 'x') { + return sign * parseInt(value, 16); + } + return sign * parseInt(value, 8); + + } + + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); + + value = 0; + base = 1; + + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); + + return sign * value; + + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return ('[object Number]' === Object.prototype.toString.call(object)) && + (0 === object % 1 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (object) { return '0b' + object.toString(2); }, + octal: function (object) { return '0' + object.toString(8); }, + decimal: function (object) { return object.toString(10); }, + hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); + +},{"../common":3,"../type":14}],19:[function(require,module,exports){ +'use strict'; + +var esprima; + +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + esprima = require('esprima'); +} catch (_) { + /*global window */ + if (typeof window !== 'undefined') { esprima = window.esprima; } +} + +var Type = require('../../type'); + +function resolveJavascriptFunction(data) { + if (null === data) { + return false; + } + + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if ('Program' !== ast.type || + 1 !== ast.body.length || + 'ExpressionStatement' !== ast.body[0].type || + 'FunctionExpression' !== ast.body[0].expression.type) { + return false; + } + + return true; + } catch (err) { + return false; + } +} + +function constructJavascriptFunction(data) { + /*jslint evil:true*/ + + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if ('Program' !== ast.type || + 1 !== ast.body.length || + 'ExpressionStatement' !== ast.body[0].type || + 'FunctionExpression' !== ast.body[0].expression.type) { + throw new Error('Failed to resolve function'); + } + + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); +} + +function representJavascriptFunction(object /*, style*/) { + return object.toString(); +} + +function isFunction(object) { + return '[object Function]' === Object.prototype.toString.call(object); +} + +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); + +},{"../../type":14,"esprima":"esprima"}],20:[function(require,module,exports){ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptRegExp(data) { + if (null === data) { + return false; + } + + if (0 === data.length) { + return false; + } + + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if ('/' === regexp[0]) { + if (tail) { + modifiers = tail[1]; + } + + if (modifiers.length > 3) { return false; } + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; } + + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + try { + var dummy = new RegExp(regexp, modifiers); + return true; + } catch (error) { + return false; + } +} + +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // `/foo/gim` - tail can be maximum 4 chars + if ('/' === regexp[0]) { + if (tail) { + modifiers = tail[1]; + } + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + return new RegExp(regexp, modifiers); +} + +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; + + if (object.global) { + result += 'g'; + } + + if (object.multiline) { + result += 'm'; + } + + if (object.ignoreCase) { + result += 'i'; + } + + return result; +} + +function isRegExp(object) { + return '[object RegExp]' === Object.prototype.toString.call(object); +} + +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); + +},{"../../type":14}],21:[function(require,module,exports){ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptUndefined() { + return true; +} + +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} + +function representJavascriptUndefined() { + return ''; +} + +function isUndefined(object) { + return 'undefined' === typeof object; +} + +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); + +},{"../../type":14}],22:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return null !== data ? data : {}; } +}); + +},{"../type":14}],23:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +function resolveYamlMerge(data) { + return '<<' === data || null === data; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); + +},{"../type":14}],24:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +function resolveYamlNull(data) { + if (null === data) { + return true; + } + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return null === object; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; } + }, + defaultStyle: 'lowercase' +}); + +},{"../type":14}],25:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (null === data) { + return true; + } + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if ('[object Object]' !== _toString.call(pair)) { + return false; + } + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) { + pairHasKey = true; + } else { + return false; + } + } + } + + if (!pairHasKey) { + return false; + } + + if (-1 === objectKeys.indexOf(pairKey)) { + objectKeys.push(pairKey); + } else { + return false; + } + } + + return true; +} + +function constructYamlOmap(data) { + return null !== data ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); + +},{"../type":14}],26:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (null === data) { + return true; + } + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if ('[object Object]' !== _toString.call(pair)) { + return false; + } + + keys = Object.keys(pair); + + if (1 !== keys.length) { + return false; + } + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (null === data) { + return []; + } + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); + +},{"../type":14}],27:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return null !== data ? data : []; } +}); + +},{"../type":14}],28:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (null === data) { + return true; + } + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (null !== object[key]) { + return false; + } + } + } + + return true; +} + +function constructYamlSet(data) { + return null !== data ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); + +},{"../type":14}],29:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return null !== data ? data : ''; } +}); + +},{"../type":14}],30:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?)?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (null === data) { + return false; + } + + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (null === match) { + return false; + } + + return true; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (null === match) { + throw new Error('Date resolve error'); + } + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if ('-' === match[9]) { + delta = -delta; + } + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) { + date.setTime(date.getTime() - delta); + } + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); + +},{"../type":14}],"/":[function(require,module,exports){ +'use strict'; + + +var yaml = require('./lib/js-yaml.js'); + + +module.exports = yaml; + +},{"./lib/js-yaml.js":2}]},{},[])("/") +}); \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/custom_types.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/custom_types.js new file mode 100644 index 00000000..02d8754f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/custom_types.js @@ -0,0 +1,103 @@ +'use strict'; + +/*eslint-disable no-console*/ + +var fs = require('fs'); +var path = require('path'); +var util = require('util'); +var yaml = require('../lib/js-yaml'); + + +// Let's define a couple of classes. + +function Point(x, y, z) { + this.klass = 'Point'; + this.x = x; + this.y = y; + this.z = z; +} + + +function Space(height, width, points) { + if (points) { + if (!points.every(function (point) { return point instanceof Point; })) { + throw new Error('A non-Point inside a points array!'); + } + } + + this.klass = 'Space'; + this.height = height; + this.width = width; + this.points = points; +} + + +// Then define YAML types to load and dump our Point/Space objects. + +var PointYamlType = new yaml.Type('!point', { + // Loader must parse sequence nodes only for this type (i.e. arrays in JS terminology). + // Other available kinds are 'scalar' (string) and 'mapping' (object). + // http://www.yaml.org/spec/1.2/spec.html#kind// + kind: 'sequence', + + // Loader must check if the input object is suitable for this type. + resolve: function (data) { + // `data` may be either: + // - Null in case of an "empty node" (http://www.yaml.org/spec/1.2/spec.html#id2786563) + // - Array since we specified `kind` to 'sequence' + return data !== null && data.length === 3; + }, + + // If a node is resolved, use it to create a Point instance. + construct: function (data) { + return new Point(data[0], data[1], data[2]); + }, + + // Dumper must process instances of Point by rules of this YAML type. + instanceOf: Point, + + // Dumper must represent Point objects as three-element sequence in YAML. + represent: function (point) { + return [ point.x, point.y, point.z ]; + } +}); + + +var SpaceYamlType = new yaml.Type('!space', { + kind: 'mapping', + construct: function (data) { + data = data || {}; // in case of empty node + return new Space(data.height || 0, data.width || 0, data.points || []); + }, + instanceOf: Space + // `represent` is omitted here. So, Space objects will be dumped as is. + // That is regular mapping with three key-value pairs but with !space tag. +}); + + +// After our types are defined, it's time to join them into a schema. + +var SPACE_SCHEMA = yaml.Schema.create([ SpaceYamlType, PointYamlType ]); + + +// And read a document using that schema. + +fs.readFile(path.join(__dirname, 'custom_types.yml'), 'utf8', function (error, data) { + var loaded; + + if (!error) { + loaded = yaml.load(data, { schema: SPACE_SCHEMA }); + console.log(util.inspect(loaded, false, 20, true)); + } else { + console.error(error.stack || error.message || String(error)); + } +}); + + +// There are some exports to play with this example interactively. + +module.exports.Point = Point; +module.exports.Space = Space; +module.exports.PointYamlType = PointYamlType; +module.exports.SpaceYamlType = SpaceYamlType; +module.exports.SPACE_SCHEMA = SPACE_SCHEMA; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/custom_types.yml b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/custom_types.yml new file mode 100644 index 00000000..f10d4e25 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/custom_types.yml @@ -0,0 +1,18 @@ +subject: Custom types in JS-YAML +spaces: +- !space + height: 1000 + width: 1000 + points: + - !point [ 10, 43, 23 ] + - !point [ 165, 0, 50 ] + - !point [ 100, 100, 100 ] + +- !space + height: 64 + width: 128 + points: + - !point [ 12, 43, 0 ] + - !point [ 1, 4, 90 ] + +- !space # An empty space diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/dumper.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/dumper.js new file mode 100644 index 00000000..d2379495 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/dumper.js @@ -0,0 +1,32 @@ +'use strict'; + +/*eslint-disable no-console*/ + +var yaml = require('../lib/js-yaml'); +var object = require('./dumper.json'); + + +console.log(yaml.dump(object, { + flowLevel: 3, + styles: { + '!!int' : 'hexadecimal', + '!!null' : 'camelcase' + } +})); + + +// Output: +//============================================================================== +// name: Wizzard +// level: 0x11 +// sanity: Null +// inventory: +// - name: Hat +// features: [magic, pointed] +// traits: {} +// - name: Staff +// features: [] +// traits: {damage: 0xA} +// - name: Cloak +// features: [old] +// traits: {defence: 0x0, comfort: 0x3} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/dumper.json b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/dumper.json new file mode 100644 index 00000000..9f54c053 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/dumper.json @@ -0,0 +1,22 @@ +{ + "name" : "Wizzard", + "level" : 17, + "sanity" : null, + "inventory" : [ + { + "name" : "Hat", + "features" : [ "magic", "pointed" ], + "traits" : {} + }, + { + "name" : "Staff", + "features" : [], + "traits" : { "damage" : 10 } + }, + { + "name" : "Cloak", + "features" : [ "old" ], + "traits" : { "defence" : 0, "comfort" : 3 } + } + ] +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/sample_document.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/sample_document.js new file mode 100644 index 00000000..3204fa50 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/sample_document.js @@ -0,0 +1,19 @@ +'use strict'; + +/*eslint-disable no-console*/ + +var fs = require('fs'); +var path = require('path'); +var util = require('util'); +var yaml = require('../lib/js-yaml'); + + +try { + var filename = path.join(__dirname, 'sample_document.yml'), + contents = fs.readFileSync(filename, 'utf8'), + data = yaml.load(contents); + + console.log(util.inspect(data, false, 10, true)); +} catch (err) { + console.log(err.stack || String(err)); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/sample_document.yml b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/sample_document.yml new file mode 100644 index 00000000..4479ee9c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/examples/sample_document.yml @@ -0,0 +1,197 @@ +--- +# Collection Types ############################################################# +################################################################################ + +# http://yaml.org/type/map.html -----------------------------------------------# + +map: + # Unordered set of key: value pairs. + Block style: !!map + Clark : Evans + Ingy : döt Net + Oren : Ben-Kiki + Flow style: !!map { Clark: Evans, Ingy: döt Net, Oren: Ben-Kiki } + +# http://yaml.org/type/omap.html ----------------------------------------------# + +omap: + # Explicitly typed ordered map (dictionary). + Bestiary: !!omap + - aardvark: African pig-like ant eater. Ugly. + - anteater: South-American ant eater. Two species. + - anaconda: South-American constrictor snake. Scaly. + # Etc. + # Flow style + Numbers: !!omap [ one: 1, two: 2, three : 3 ] + +# http://yaml.org/type/pairs.html ---------------------------------------------# + +pairs: + # Explicitly typed pairs. + Block tasks: !!pairs + - meeting: with team. + - meeting: with boss. + - break: lunch. + - meeting: with client. + Flow tasks: !!pairs [ meeting: with team, meeting: with boss ] + +# http://yaml.org/type/set.html -----------------------------------------------# + +set: + # Explicitly typed set. + baseball players: !!set + ? Mark McGwire + ? Sammy Sosa + ? Ken Griffey + # Flow style + baseball teams: !!set { Boston Red Sox, Detroit Tigers, New York Yankees } + +# http://yaml.org/type/seq.html -----------------------------------------------# + +seq: + # Ordered sequence of nodes + Block style: !!seq + - Mercury # Rotates - no light/dark sides. + - Venus # Deadliest. Aptly named. + - Earth # Mostly dirt. + - Mars # Seems empty. + - Jupiter # The king. + - Saturn # Pretty. + - Uranus # Where the sun hardly shines. + - Neptune # Boring. No rings. + - Pluto # You call this a planet? + Flow style: !!seq [ Mercury, Venus, Earth, Mars, # Rocks + Jupiter, Saturn, Uranus, Neptune, # Gas + Pluto ] # Overrated + + +# Scalar Types ################################################################# +################################################################################ + +# http://yaml.org/type/binary.html --------------------------------------------# + +binary: + canonical: !!binary "\ + R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\ + OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\ + +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\ + AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=" + generic: !!binary | + R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5 + OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+ + +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC + AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs= + description: + The binary value above is a tiny arrow encoded as a gif image. + +# http://yaml.org/type/bool.html ----------------------------------------------# + +bool: + - true + - True + - TRUE + - false + - False + - FALSE + +# http://yaml.org/type/float.html ---------------------------------------------# + +float: + canonical: 6.8523015e+5 + exponentioal: 685.230_15e+03 + fixed: 685_230.15 + sexagesimal: 190:20:30.15 + negative infinity: -.inf + not a number: .NaN + +# http://yaml.org/type/int.html -----------------------------------------------# + +int: + canonical: 685230 + decimal: +685_230 + octal: 02472256 + hexadecimal: 0x_0A_74_AE + binary: 0b1010_0111_0100_1010_1110 + sexagesimal: 190:20:30 + +# http://yaml.org/type/merge.html ---------------------------------------------# + +merge: + - &CENTER { x: 1, y: 2 } + - &LEFT { x: 0, y: 2 } + - &BIG { r: 10 } + - &SMALL { r: 1 } + + # All the following maps are equal: + + - # Explicit keys + x: 1 + y: 2 + r: 10 + label: nothing + + - # Merge one map + << : *CENTER + r: 10 + label: center + + - # Merge multiple maps + << : [ *CENTER, *BIG ] + label: center/big + + - # Override + << : [ *BIG, *LEFT, *SMALL ] + x: 1 + label: big/left/small + +# http://yaml.org/type/null.html ----------------------------------------------# + +null: + # This mapping has four keys, + # one has a value. + empty: + canonical: ~ + english: null + ~: null key + # This sequence has five + # entries, two have values. + sparse: + - ~ + - 2nd entry + - + - 4th entry + - Null + +# http://yaml.org/type/str.html -----------------------------------------------# + +string: abcd + +# http://yaml.org/type/timestamp.html -----------------------------------------# + +timestamp: + canonical: 2001-12-15T02:59:43.1Z + valid iso8601: 2001-12-14t21:59:43.10-05:00 + space separated: 2001-12-14 21:59:43.10 -5 + no time zone (Z): 2001-12-15 2:59:43.10 + date (00:00:00Z): 2002-12-14 + + +# JavaScript Specific Types #################################################### +################################################################################ + +# https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp + +regexp: + simple: !!js/regexp foobar + modifiers: !!js/regexp /foobar/mi + +# https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/undefined + +undefined: !!js/undefined ~ + +# https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function + +function: !!js/function > + function foobar() { + return 'Wow! JS-YAML Rocks!'; + } diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/index.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/index.js new file mode 100644 index 00000000..13744352 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/index.js @@ -0,0 +1,7 @@ +'use strict'; + + +var yaml = require('./lib/js-yaml.js'); + + +module.exports = yaml; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml.js new file mode 100644 index 00000000..842104ec --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml.js @@ -0,0 +1,39 @@ +'use strict'; + + +var loader = require('./js-yaml/loader'); +var dumper = require('./js-yaml/dumper'); + + +function deprecated(name) { + return function () { + throw new Error('Function ' + name + ' is deprecated and cannot be used.'); + }; +} + + +module.exports.Type = require('./js-yaml/type'); +module.exports.Schema = require('./js-yaml/schema'); +module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe'); +module.exports.JSON_SCHEMA = require('./js-yaml/schema/json'); +module.exports.CORE_SCHEMA = require('./js-yaml/schema/core'); +module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe'); +module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full'); +module.exports.load = loader.load; +module.exports.loadAll = loader.loadAll; +module.exports.safeLoad = loader.safeLoad; +module.exports.safeLoadAll = loader.safeLoadAll; +module.exports.dump = dumper.dump; +module.exports.safeDump = dumper.safeDump; +module.exports.YAMLException = require('./js-yaml/exception'); + +// Deprecared schema names from JS-YAML 2.0.x +module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe'); +module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe'); +module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full'); + +// Deprecated functions from JS-YAML 1.x.x +module.exports.scan = deprecated('scan'); +module.exports.parse = deprecated('parse'); +module.exports.compose = deprecated('compose'); +module.exports.addConstructor = deprecated('addConstructor'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/common.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/common.js new file mode 100644 index 00000000..197eb248 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/common.js @@ -0,0 +1,61 @@ +'use strict'; + + +function isNothing(subject) { + return (typeof subject === 'undefined') || (null === subject); +} + + +function isObject(subject) { + return (typeof subject === 'object') && (null !== subject); +} + + +function toArray(sequence) { + if (Array.isArray(sequence)) { + return sequence; + } else if (isNothing(sequence)) { + return []; + } + return [ sequence ]; +} + + +function extend(target, source) { + var index, length, key, sourceKeys; + + if (source) { + sourceKeys = Object.keys(source); + + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + + return target; +} + + +function repeat(string, count) { + var result = '', cycle; + + for (cycle = 0; cycle < count; cycle += 1) { + result += string; + } + + return result; +} + + +function isNegativeZero(number) { + return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number); +} + + +module.exports.isNothing = isNothing; +module.exports.isObject = isObject; +module.exports.toArray = toArray; +module.exports.repeat = repeat; +module.exports.isNegativeZero = isNegativeZero; +module.exports.extend = extend; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/dumper.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/dumper.js new file mode 100644 index 00000000..1fc09ba3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/dumper.js @@ -0,0 +1,829 @@ +'use strict'; + +/*eslint-disable no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); +var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); + +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (null === map) { + return {}; + } + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if ('!!' === tag.slice(0, 2)) { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + + type = schema.compiledTypeMap[tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + +function State(options) { + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + if (line.length && line !== '\n') { + result += ind; + } + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +function StringBuilder(source) { + this.source = source; + this.result = ''; + this.checkpoint = 0; +} + +StringBuilder.prototype.takeUpTo = function (position) { + var er; + + if (position < this.checkpoint) { + er = new Error('position should be > checkpoint'); + er.position = position; + er.checkpoint = this.checkpoint; + throw er; + } + + this.result += this.source.slice(this.checkpoint, position); + this.checkpoint = position; + return this; +}; + +StringBuilder.prototype.escapeChar = function () { + var character, esc; + + character = this.source.charCodeAt(this.checkpoint); + esc = ESCAPE_SEQUENCES[character] || encodeHex(character); + this.result += esc; + this.checkpoint += 1; + + return this; +}; + +StringBuilder.prototype.finish = function () { + if (this.source.length > this.checkpoint) { + this.takeUpTo(this.source.length); + } +}; + +function writeScalar(state, object, level) { + var simple, first, spaceWrap, folded, literal, single, double, + sawLineFeed, linePosition, longestLine, indent, max, character, + position, escapeSeq, hexEsc, previous, lineLength, modifier, + trailingLineBreaks, result; + + if (0 === object.length) { + state.dump = "''"; + return; + } + + if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) { + state.dump = "'" + object + "'"; + return; + } + + simple = true; + first = object.length ? object.charCodeAt(0) : 0; + spaceWrap = (CHAR_SPACE === first || + CHAR_SPACE === object.charCodeAt(object.length - 1)); + + // Simplified check for restricted first characters + // http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29 + if (CHAR_MINUS === first || + CHAR_QUESTION === first || + CHAR_COMMERCIAL_AT === first || + CHAR_GRAVE_ACCENT === first) { + simple = false; + } + + // can only use > and | if not wrapped in spaces. + if (spaceWrap) { + simple = false; + folded = false; + literal = false; + } else { + folded = true; + literal = true; + } + + single = true; + double = new StringBuilder(object); + + sawLineFeed = false; + linePosition = 0; + longestLine = 0; + + indent = state.indent * level; + max = 80; + if (indent < 40) { + max -= indent; + } else { + max = 40; + } + + for (position = 0; position < object.length; position++) { + character = object.charCodeAt(position); + if (simple) { + // Characters that can never appear in the simple scalar + if (!simpleChar(character)) { + simple = false; + } else { + // Still simple. If we make it all the way through like + // this, then we can just dump the string as-is. + continue; + } + } + + if (single && character === CHAR_SINGLE_QUOTE) { + single = false; + } + + escapeSeq = ESCAPE_SEQUENCES[character]; + hexEsc = needsHexEscape(character); + + if (!escapeSeq && !hexEsc) { + continue; + } + + if (character !== CHAR_LINE_FEED && + character !== CHAR_DOUBLE_QUOTE && + character !== CHAR_SINGLE_QUOTE) { + folded = false; + literal = false; + } else if (character === CHAR_LINE_FEED) { + sawLineFeed = true; + single = false; + if (position > 0) { + previous = object.charCodeAt(position - 1); + if (previous === CHAR_SPACE) { + literal = false; + folded = false; + } + } + if (folded) { + lineLength = position - linePosition; + linePosition = position; + if (lineLength > longestLine) { + longestLine = lineLength; + } + } + } + + if (character !== CHAR_DOUBLE_QUOTE) { + single = false; + } + + double.takeUpTo(position); + double.escapeChar(); + } + + if (simple && testImplicitResolving(state, object)) { + simple = false; + } + + modifier = ''; + if (folded || literal) { + trailingLineBreaks = 0; + if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) { + trailingLineBreaks += 1; + if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) { + trailingLineBreaks += 1; + } + } + + if (trailingLineBreaks === 0) { + modifier = '-'; + } else if (trailingLineBreaks === 2) { + modifier = '+'; + } + } + + if (literal && longestLine < max) { + folded = false; + } + + // If it's literally one line, then don't bother with the literal. + // We may still want to do a fold, though, if it's a super long line. + if (!sawLineFeed) { + literal = false; + } + + if (simple) { + state.dump = object; + } else if (single) { + state.dump = '\'' + object + '\''; + } else if (folded) { + result = fold(object, max); + state.dump = '>' + modifier + '\n' + indentString(result, indent); + } else if (literal) { + if (!modifier) { + object = object.replace(/\n$/, ''); + } + state.dump = '|' + modifier + '\n' + indentString(object, indent); + } else if (double) { + double.finish(); + state.dump = '"' + double.result + '"'; + } else { + throw new Error('Failed to dump scalar value'); + } + + return; +} + +// The `trailing` var is a regexp match of any trailing `\n` characters. +// +// There are three cases we care about: +// +// 1. One trailing `\n` on the string. Just use `|` or `>`. +// This is the assumed default. (trailing = null) +// 2. No trailing `\n` on the string. Use `|-` or `>-` to "chomp" the end. +// 3. More than one trailing `\n` on the string. Use `|+` or `>+`. +// +// In the case of `>+`, these line breaks are *not* doubled (like the line +// breaks within the string), so it's important to only end with the exact +// same number as we started. +function fold(object, max) { + var result = '', + position = 0, + length = object.length, + trailing = /\n+$/.exec(object), + newLine; + + if (trailing) { + length = trailing.index + 1; + } + + while (position < length) { + newLine = object.indexOf('\n', position); + if (newLine > length || newLine === -1) { + if (result) { + result += '\n\n'; + } + result += foldLine(object.slice(position, length), max); + position = length; + } else { + if (result) { + result += '\n\n'; + } + result += foldLine(object.slice(position, newLine), max); + position = newLine + 1; + } + } + if (trailing && trailing[0] !== '\n') { + result += trailing[0]; + } + + return result; +} + +function foldLine(line, max) { + if (line === '') { + return line; + } + + var foldRe = /[^\s] [^\s]/g, + result = '', + prevMatch = 0, + foldStart = 0, + match = foldRe.exec(line), + index, + foldEnd, + folded; + + while (match) { + index = match.index; + + // when we cross the max len, if the previous match would've + // been ok, use that one, and carry on. If there was no previous + // match on this fold section, then just have a long line. + if (index - foldStart > max) { + if (prevMatch !== foldStart) { + foldEnd = prevMatch; + } else { + foldEnd = index; + } + + if (result) { + result += '\n'; + } + folded = line.slice(foldStart, foldEnd); + result += folded; + foldStart = foldEnd + 1; + } + prevMatch = index + 1; + match = foldRe.exec(line); + } + + if (result) { + result += '\n'; + } + + // if we end up with one last word at the end, then the last bit might + // be slightly bigger than we wanted, because we exited out of the loop. + if (foldStart !== prevMatch && line.length - foldStart > max) { + result += line.slice(foldStart, prevMatch) + '\n' + + line.slice(prevMatch + 1); + } else { + result += line.slice(foldStart); + } + + return result; +} + +// Returns true if character can be found in a simple scalar +function simpleChar(character) { + return CHAR_TAB !== character && + CHAR_LINE_FEED !== character && + CHAR_CARRIAGE_RETURN !== character && + CHAR_COMMA !== character && + CHAR_LEFT_SQUARE_BRACKET !== character && + CHAR_RIGHT_SQUARE_BRACKET !== character && + CHAR_LEFT_CURLY_BRACKET !== character && + CHAR_RIGHT_CURLY_BRACKET !== character && + CHAR_SHARP !== character && + CHAR_AMPERSAND !== character && + CHAR_ASTERISK !== character && + CHAR_EXCLAMATION !== character && + CHAR_VERTICAL_LINE !== character && + CHAR_GREATER_THAN !== character && + CHAR_SINGLE_QUOTE !== character && + CHAR_DOUBLE_QUOTE !== character && + CHAR_PERCENT !== character && + CHAR_COLON !== character && + !ESCAPE_SEQUENCES[character] && + !needsHexEscape(character); +} + +// Returns true if the character code needs to be escaped. +function needsHexEscape(character) { + return !((0x00020 <= character && character <= 0x00007E) || + (0x00085 === character) || + (0x000A0 <= character && character <= 0x00D7FF) || + (0x0E000 <= character && character <= 0x00FFFD) || + (0x10000 <= character && character <= 0x10FFFF)); +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level, object[index], false, false)) { + if (0 !== index) { + _result += ', '; + } + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || 0 !== index) { + _result += generateNextLine(state, level); + } + _result += '- ' + state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (0 !== index) { + pairBuffer += ', '; + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) { + pairBuffer += '? '; + } + + pairBuffer += state.dump + ': '; + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || 0 !== index) { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level + 1, objectKey, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (null !== state.tag && '?' !== state.tag) || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + state.tag = explicit ? type.tag : '?'; + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if ('[object Function]' === _toString.call(type.represent)) { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + + if (block) { + block = (0 > state.flowLevel || state.flowLevel > level); + } + + if ((null !== state.tag && '?' !== state.tag) || (2 !== state.indent && level > 0)) { + compact = false; + } + + var objectOrArray = '[object Object]' === type || '[object Array]' === type, + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if ('[object Object]' === type) { + if (block && (0 !== Object.keys(state.dump).length)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if ('[object Array]' === type) { + if (block && (0 !== state.dump.length)) { + writeBlockSequence(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if ('[object String]' === type) { + if ('?' !== state.tag) { + writeScalar(state, state.dump, level); + } + } else { + if (state.skipInvalid) { + return false; + } + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (null !== state.tag && '?' !== state.tag) { + state.dump = '!<' + state.tag + '> ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var type = _toString.call(object), + objectKeyList, + index, + length; + + if (null !== object && 'object' === typeof object) { + index = objects.indexOf(object); + if (-1 !== index) { + if (-1 === duplicatesIndexes.indexOf(index)) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State(options); + + getDuplicateReferences(input, state); + + if (writeNode(state, 0, input, true, true)) { + return state.dump + '\n'; + } + return ''; +} + +function safeDump(input, options) { + return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + +module.exports.dump = dump; +module.exports.safeDump = safeDump; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/exception.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/exception.js new file mode 100644 index 00000000..479ba887 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/exception.js @@ -0,0 +1,25 @@ +'use strict'; + + +function YAMLException(reason, mark) { + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = this.toString(false); +} + + +YAMLException.prototype.toString = function toString(compact) { + var result; + + result = 'JS-YAML: ' + (this.reason || '(unknown reason)'); + + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); + } + + return result; +}; + + +module.exports = YAMLException; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/loader.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/loader.js new file mode 100644 index 00000000..af1b99b3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/loader.js @@ -0,0 +1,1586 @@ +'use strict'; + +/*eslint-disable max-len,no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Mark = require('./mark'); +var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); +var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uD800-\uDFFF\uFFFE\uFFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return 0x2C/* , */ === c || + 0x5B/* [ */ === c || + 0x5D/* ] */ === c || + 0x7B/* { */ === c || + 0x7D/* } */ === c; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.onWarning = options['onWarning'] || null; + this.legacy = options['legacy'] || false; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + return new YAMLException( + message, + new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + var error = generateError(state, message); + + if (state.onWarning) { + state.onWarning.call(null, error); + } else { + throw error; + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (null !== state.version) { + throwError(state, 'duplication of %YAML directive'); + } + + if (1 !== args.length) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (null === match) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (1 !== major) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (1 !== minor && 2 !== minor) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (2 !== args.length) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; + _position < _length; + _position += 1) { + _character = _result.charCodeAt(_position); + if (!(0x09 === _character || + 0x20 <= _character && _character <= 0x10FFFF)) { + throwError(state, 'expected valid JSON character'); + } + } + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + } + } +} + +function storeMappingPair(state, _result, keyTag, keyNode, valueNode) { + var index, quantity; + + keyNode = String(keyNode); + + if (null === _result) { + _result = {}; + } + + if ('tag:yaml.org,2002:merge' === keyTag) { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index]); + } + } else { + mergeMappings(state, _result, valueNode); + } + } else { + _result[keyNode] = valueNode; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (0x0A/* LF */ === ch) { + state.position++; + } else if (0x0D/* CR */ === ch) { + state.position++; + if (0x0A/* LF */ === state.input.charCodeAt(state.position)) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (0 !== ch) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && 0x23/* # */ === ch) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && 0 !== ch); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (0x20/* Space */ === ch) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((0x2D/* - */ === ch || 0x2E/* . */ === ch) && + state.input.charCodeAt(_position + 1) === ch && + state.input.charCodeAt(_position + 2) === ch) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (1 === count) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + 0x23/* # */ === ch || + 0x26/* & */ === ch || + 0x2A/* * */ === ch || + 0x21/* ! */ === ch || + 0x7C/* | */ === ch || + 0x3E/* > */ === ch || + 0x27/* ' */ === ch || + 0x22/* " */ === ch || + 0x25/* % */ === ch || + 0x40/* @ */ === ch || + 0x60/* ` */ === ch) { + return false; + } + + if (0x3F/* ? */ === ch || 0x2D/* - */ === ch) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (0 !== ch) { + if (0x3A/* : */ === ch) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (0x23/* # */ === ch) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (0x27/* ' */ !== ch) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while (0 !== (ch = state.input.charCodeAt(state.position))) { + if (0x27/* ' */ === ch) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (0x27/* ' */ === ch) { + captureStart = captureEnd = state.position; + state.position++; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, tmpEsc, + ch; + + ch = state.input.charCodeAt(state.position); + + if (0x22/* " */ !== ch) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while (0 !== (ch = state.input.charCodeAt(state.position))) { + if (0x22/* " */ === ch) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (0x5C/* \ */ === ch) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (null !== state.anchor) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (0 !== ch) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (0x3F/* ? */ === ch) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && 0x3A/* : */ === ch) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (0x2C/* , */ === ch) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (0 !== ch) { + ch = state.input.charCodeAt(++state.position); + + if (0x2B/* + */ === ch || 0x2D/* - */ === ch) { + if (CHOMPING_CLIP === chomping) { + chomping = (0x2B/* + */ === ch) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (0x23/* # */ === ch) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (0 !== ch)); + } + } + + while (0 !== ch) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (0x20/* Space */ === ch)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (detectedIndent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + state.result += common.repeat('\n', emptyLines + 1); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (0 === emptyLines) { + if (detectedIndent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else if (detectedIndent) { + // If current line isn't the first one - count line break from the last content line. + state.result += common.repeat('\n', emptyLines + 1); + } else { + // In case of the first content line - count only empty lines. + } + + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (0 !== ch)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + if (null !== state.anchor) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (0 !== ch) { + + if (0x2D/* - */ !== ch) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (0 !== ch)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + if (null !== state.anchor) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (0 !== ch) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((0x3F/* ? */ === ch || 0x3A/* : */ === ch) && is_WS_OR_EOL(following)) { + + if (0x3F/* ? */ === ch) { + if (atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (0x3A/* : */ === ch) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else { + break; // Reading is done. Go to the epilogue. + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, valueNode); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if (state.lineIndent > nodeIndent && (0 !== ch)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, keyTag, keyNode, null); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (0x21/* ! */ !== ch) { + return false; + } + + if (null !== state.tag) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (0x3C/* < */ === ch) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (0x21/* ! */ === ch) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (0 !== ch && 0x3E/* > */ !== ch); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (0 !== ch && !is_WS_OR_EOL(ch)) { + + if (0x21/* ! */ === ch) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if ('!' === tagHandle) { + state.tag = '!' + tagName; + + } else if ('!!' === tagHandle) { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (0x26/* & */ !== ch) { + return false; + } + + if (null !== state.anchor) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + len = state.length, + input = state.input, + ch; + + ch = state.input.charCodeAt(state.position); + + if (0x2A/* * */ !== ch) { + return false; + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!state.anchorMap.hasOwnProperty(alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (1 === indentStatus) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (1 === indentStatus) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (null !== state.tag || null !== state.anchor) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (null === state.tag) { + state.tag = '?'; + } + } + + if (null !== state.anchor) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (0 === indentStatus) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (null !== state.tag && '!' !== state.tag) { + if ('?' === state.tag) { + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; + typeIndex < typeQuantity; + typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only assigned to plain scalars. So, it isn't + // needed to check for 'kind' conformity. + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (null !== state.anchor) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap, state.tag)) { + type = state.typeMap[state.tag]; + + if (null !== state.result && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result); + if (null !== state.anchor) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwWarning(state, 'unknown tag !<' + state.tag + '>'); + } + } + + return null !== state.tag || null !== state.anchor || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; + + while (0 !== (ch = state.input.charCodeAt(state.position))) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || 0x25/* % */ !== ch) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (0 !== ch && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (0 !== ch) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (0x23/* # */ === ch) { + do { ch = state.input.charCodeAt(++state.position); } + while (0 !== ch && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) { + break; + } + + _position = state.position; + + while (0 !== ch && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (0 !== ch) { + readLineBreak(state); + } + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (0 === state.lineIndent && + 0x2D/* - */ === state.input.charCodeAt(state.position) && + 0x2D/* - */ === state.input.charCodeAt(state.position + 1) && + 0x2D/* - */ === state.input.charCodeAt(state.position + 2)) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (0x2E/* . */ === state.input.charCodeAt(state.position)) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (0x0A/* LF */ !== input.charCodeAt(input.length - 1) && + 0x0D/* CR */ !== input.charCodeAt(input.length - 1)) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + if (PATTERN_NON_PRINTABLE.test(state.input)) { + throwError(state, 'the stream contains non-printable characters'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (0x20/* Space */ === state.input.charCodeAt(state.position)) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + var documents = loadDocuments(input, options), index, length; + + for (index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options), index, length; + + if (0 === documents.length) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (1 === documents.length) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +function safeLoadAll(input, output, options) { + loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/mark.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/mark.js new file mode 100644 index 00000000..bfe279ba --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/mark.js @@ -0,0 +1,78 @@ +'use strict'; + + +var common = require('./common'); + + +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; +} + + +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + + if (!this.buffer) { + return null; + } + + indent = indent || 4; + maxLength = maxLength || 75; + + head = ''; + start = this.position; + + while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) { + start -= 1; + if (this.position - start > (maxLength / 2 - 1)) { + head = ' ... '; + start += 5; + break; + } + } + + tail = ''; + end = this.position; + + while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) { + end += 1; + if (end - this.position > (maxLength / 2 - 1)) { + tail = ' ... '; + end -= 5; + break; + } + } + + snippet = this.buffer.slice(start, end); + + return common.repeat(' ', indent) + head + snippet + tail + '\n' + + common.repeat(' ', indent + this.position - start + head.length) + '^'; +}; + + +Mark.prototype.toString = function toString(compact) { + var snippet, where = ''; + + if (this.name) { + where += 'in "' + this.name + '" '; + } + + where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + + if (!compact) { + snippet = this.getSnippet(); + + if (snippet) { + where += ':\n' + snippet; + } + } + + return where; +}; + + +module.exports = Mark; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema.js new file mode 100644 index 00000000..984e2904 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema.js @@ -0,0 +1,104 @@ +'use strict'; + +/*eslint-disable max-len*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Type = require('./type'); + + +function compileList(schema, name, result) { + var exclude = []; + + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); + + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag) { + exclude.push(previousIndex); + } + }); + + result.push(currentType); + }); + + return result.filter(function (type, index) { + return -1 === exclude.indexOf(index); + }); +} + + +function compileMap(/* lists... */) { + var result = {}, index, length; + + function collectType(type) { + result[type.tag] = type; + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + + return result; +} + + +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; + + this.implicit.forEach(function (type) { + if (type.loadKind && 'scalar' !== type.loadKind) { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + }); + + this.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); +} + + +Schema.DEFAULT = null; + + +Schema.create = function createSchema() { + var schemas, types; + + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; + + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; + + default: + throw new YAMLException('Wrong number of arguments for Schema.create function'); + } + + schemas = common.toArray(schemas); + types = common.toArray(types); + + if (!schemas.every(function (schema) { return schema instanceof Schema; })) { + throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + } + + if (!types.every(function (type) { return type instanceof Type; })) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + return new Schema({ + include: schemas, + explicit: types + }); +}; + + +module.exports = Schema; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/core.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/core.js new file mode 100644 index 00000000..206daab5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/core.js @@ -0,0 +1,18 @@ +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./json') + ] +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/default_full.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/default_full.js new file mode 100644 index 00000000..a55ef42a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/default_full.js @@ -0,0 +1,25 @@ +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = Schema.DEFAULT = new Schema({ + include: [ + require('./default_safe') + ], + explicit: [ + require('../type/js/undefined'), + require('../type/js/regexp'), + require('../type/js/function') + ] +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js new file mode 100644 index 00000000..11d89bbf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js @@ -0,0 +1,28 @@ +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./core') + ], + implicit: [ + require('../type/timestamp'), + require('../type/merge') + ], + explicit: [ + require('../type/binary'), + require('../type/omap'), + require('../type/pairs'), + require('../type/set') + ] +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js new file mode 100644 index 00000000..b7a33eb7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js @@ -0,0 +1,17 @@ +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + explicit: [ + require('../type/str'), + require('../type/seq'), + require('../type/map') + ] +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/json.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/json.js new file mode 100644 index 00000000..5be3dbf8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/schema/json.js @@ -0,0 +1,25 @@ +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./failsafe') + ], + implicit: [ + require('../type/null'), + require('../type/bool'), + require('../type/int'), + require('../type/float') + ] +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type.js new file mode 100644 index 00000000..5e3176ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type.js @@ -0,0 +1,61 @@ +'use strict'; + +var YAMLException = require('./exception'); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (null !== map) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/binary.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/binary.js new file mode 100644 index 00000000..122155c7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/binary.js @@ -0,0 +1,134 @@ +'use strict'; + +/*eslint-disable no-bitwise*/ + +// A trick for browserified version. +// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined +var NodeBuffer = require('buffer').Buffer; +var Type = require('../type'); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (null === data) { + return false; + } + + var code, idx, bitlen = 0, len = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) { continue; } + + // Fail on illegal characters + if (code < 0) { return false; } + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var code, idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + return new NodeBuffer(result); + } + + return result; +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/bool.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/bool.js new file mode 100644 index 00000000..5c2a304d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/bool.js @@ -0,0 +1,37 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlBoolean(data) { + if (null === data) { + return false; + } + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return '[object Boolean]' === Object.prototype.toString.call(object); +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/float.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/float.js new file mode 100644 index 00000000..67c9c21f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/float.js @@ -0,0 +1,108 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +var YAML_FLOAT_PATTERN = new RegExp( + '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' + + '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' + + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + '|[-+]?\\.(?:inf|Inf|INF)' + + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (null === data) { + return false; + } + + var value, sign, base, digits; + + if (!YAML_FLOAT_PATTERN.test(data)) { + return false; + } + return true; +} + +function constructYamlFloat(data) { + var value, sign, base, digits; + + value = data.replace(/_/g, '').toLowerCase(); + sign = '-' === value[0] ? -1 : 1; + digits = []; + + if (0 <= '+-'.indexOf(value[0])) { + value = value.slice(1); + } + + if ('.inf' === value) { + return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if ('.nan' === value) { + return NaN; + + } else if (0 <= value.indexOf(':')) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); + + value = 0.0; + base = 1; + + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); + + return sign * value; + + } + return sign * parseFloat(value, 10); +} + +function representYamlFloat(object, style) { + if (isNaN(object)) { + switch (style) { + case 'lowercase': + return '.nan'; + case 'uppercase': + return '.NAN'; + case 'camelcase': + return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': + return '.inf'; + case 'uppercase': + return '.INF'; + case 'camelcase': + return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': + return '-.inf'; + case 'uppercase': + return '-.INF'; + case 'camelcase': + return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + return object.toString(10); +} + +function isFloat(object) { + return ('[object Number]' === Object.prototype.toString.call(object)) && + (0 !== object % 1 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/int.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/int.js new file mode 100644 index 00000000..800f1060 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/int.js @@ -0,0 +1,183 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (null === data) { + return false; + } + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) { return false; } + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) { return true; } + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (ch !== '0' && ch !== '1') { + return false; + } + hasDigits = true; + } + return hasDigits; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (!isHexCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + return hasDigits; + } + + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (!isOctCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + return hasDigits; + } + + // base 10 (except 0) or base 60 + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') { continue; } + if (ch === ':') { break; } + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + if (!hasDigits) { return false; } + + // if !base60 - done; + if (ch !== ':') { return true; } + + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') { sign = -1; } + value = value.slice(1); + ch = value[0]; + } + + if ('0' === value) { + return 0; + } + + if (ch === '0') { + if (value[1] === 'b') { + return sign * parseInt(value.slice(2), 2); + } + if (value[1] === 'x') { + return sign * parseInt(value, 16); + } + return sign * parseInt(value, 8); + + } + + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); + + value = 0; + base = 1; + + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); + + return sign * value; + + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return ('[object Number]' === Object.prototype.toString.call(object)) && + (0 === object % 1 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (object) { return '0b' + object.toString(2); }, + octal: function (object) { return '0' + object.toString(8); }, + decimal: function (object) { return object.toString(10); }, + hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/js/function.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/js/function.js new file mode 100644 index 00000000..4061c43a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/js/function.js @@ -0,0 +1,86 @@ +'use strict'; + +var esprima; + +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + esprima = require('esprima'); +} catch (_) { + /*global window */ + if (typeof window !== 'undefined') { esprima = window.esprima; } +} + +var Type = require('../../type'); + +function resolveJavascriptFunction(data) { + if (null === data) { + return false; + } + + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if ('Program' !== ast.type || + 1 !== ast.body.length || + 'ExpressionStatement' !== ast.body[0].type || + 'FunctionExpression' !== ast.body[0].expression.type) { + return false; + } + + return true; + } catch (err) { + return false; + } +} + +function constructJavascriptFunction(data) { + /*jslint evil:true*/ + + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if ('Program' !== ast.type || + 1 !== ast.body.length || + 'ExpressionStatement' !== ast.body[0].type || + 'FunctionExpression' !== ast.body[0].expression.type) { + throw new Error('Failed to resolve function'); + } + + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); +} + +function representJavascriptFunction(object /*, style*/) { + return object.toString(); +} + +function isFunction(object) { + return '[object Function]' === Object.prototype.toString.call(object); +} + +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js new file mode 100644 index 00000000..07ef5218 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js @@ -0,0 +1,84 @@ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptRegExp(data) { + if (null === data) { + return false; + } + + if (0 === data.length) { + return false; + } + + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if ('/' === regexp[0]) { + if (tail) { + modifiers = tail[1]; + } + + if (modifiers.length > 3) { return false; } + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; } + + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + try { + var dummy = new RegExp(regexp, modifiers); + return true; + } catch (error) { + return false; + } +} + +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // `/foo/gim` - tail can be maximum 4 chars + if ('/' === regexp[0]) { + if (tail) { + modifiers = tail[1]; + } + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + return new RegExp(regexp, modifiers); +} + +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; + + if (object.global) { + result += 'g'; + } + + if (object.multiline) { + result += 'm'; + } + + if (object.ignoreCase) { + result += 'i'; + } + + return result; +} + +function isRegExp(object) { + return '[object RegExp]' === Object.prototype.toString.call(object); +} + +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js new file mode 100644 index 00000000..562753c2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js @@ -0,0 +1,28 @@ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptUndefined() { + return true; +} + +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} + +function representJavascriptUndefined() { + return ''; +} + +function isUndefined(object) { + return 'undefined' === typeof object; +} + +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/map.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/map.js new file mode 100644 index 00000000..dab9838c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/map.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return null !== data ? data : {}; } +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/merge.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/merge.js new file mode 100644 index 00000000..29fa3827 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/merge.js @@ -0,0 +1,12 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlMerge(data) { + return '<<' === data || null === data; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/null.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/null.js new file mode 100644 index 00000000..34740556 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/null.js @@ -0,0 +1,36 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlNull(data) { + if (null === data) { + return true; + } + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return null === object; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; } + }, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/omap.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/omap.js new file mode 100644 index 00000000..f956459a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/omap.js @@ -0,0 +1,56 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (null === data) { + return true; + } + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if ('[object Object]' !== _toString.call(pair)) { + return false; + } + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) { + pairHasKey = true; + } else { + return false; + } + } + } + + if (!pairHasKey) { + return false; + } + + if (-1 === objectKeys.indexOf(pairKey)) { + objectKeys.push(pairKey); + } else { + return false; + } + } + + return true; +} + +function constructYamlOmap(data) { + return null !== data ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/pairs.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/pairs.js new file mode 100644 index 00000000..02a0af6b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/pairs.js @@ -0,0 +1,61 @@ +'use strict'; + +var Type = require('../type'); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (null === data) { + return true; + } + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if ('[object Object]' !== _toString.call(pair)) { + return false; + } + + keys = Object.keys(pair); + + if (1 !== keys.length) { + return false; + } + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (null === data) { + return []; + } + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/seq.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/seq.js new file mode 100644 index 00000000..5b860a26 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/seq.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return null !== data ? data : []; } +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/set.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/set.js new file mode 100644 index 00000000..64d29e9b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/set.js @@ -0,0 +1,33 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (null === data) { + return true; + } + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (null !== object[key]) { + return false; + } + } + } + + return true; +} + +function constructYamlSet(data) { + return null !== data ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/str.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/str.js new file mode 100644 index 00000000..8b5284fe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/str.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return null !== data ? data : ''; } +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/timestamp.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/timestamp.js new file mode 100644 index 00000000..dc8cf15a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/lib/js-yaml/type/timestamp.js @@ -0,0 +1,98 @@ +'use strict'; + +var Type = require('../type'); + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?)?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (null === data) { + return false; + } + + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (null === match) { + return false; + } + + return true; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (null === match) { + throw new Error('Date resolve error'); + } + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if ('-' === match[9]) { + delta = -delta; + } + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) { + date.setTime(date.getTime() - delta); + } + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/.bin/esparse b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/.bin/esparse new file mode 120000 index 00000000..7423b18b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/.bin/esparse @@ -0,0 +1 @@ +../esprima/bin/esparse.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/.bin/esvalidate b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/.bin/esvalidate new file mode 120000 index 00000000..16069eff --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/.bin/esvalidate @@ -0,0 +1 @@ +../esprima/bin/esvalidate.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/CHANGELOG.md b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/CHANGELOG.md new file mode 100644 index 00000000..661e75d7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/CHANGELOG.md @@ -0,0 +1,136 @@ +1.0.2 / 2015-03-22 +------------------ + +* Relaxed lodash version dependency. + + +1.0.1 / 2015-02-20 +------------------ + +* Changed dependencies to be compatible with ancient nodejs. + + +1.0.0 / 2015-02-19 +------------------ + +* Maintenance release. +* Replaced `underscore` with `lodash`. +* Bumped version to 1.0.0 to better reflect semver meaning. +* HISTORY.md -> CHANGELOG.md + + +0.1.16 / 2013-12-01 +------------------- + +* Maintenance release. Updated dependencies and docs. + + +0.1.15 / 2013-05-13 +------------------- + +* Fixed #55, @trebor89 + + +0.1.14 / 2013-05-12 +------------------- + +* Fixed #62, @maxtaco + + +0.1.13 / 2013-04-08 +------------------- + +* Added `.npmignore` to reduce package size + + +0.1.12 / 2013-02-10 +------------------- + +* Fixed conflictHandler (#46), @hpaulj + + +0.1.11 / 2013-02-07 +------------------- + +* Multiple bugfixes, @hpaulj +* Added 70+ tests (ported from python), @hpaulj +* Added conflictHandler, @applepicke +* Added fromfilePrefixChar, @hpaulj + + +0.1.10 / 2012-12-30 +------------------- + +* Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion) + support, thanks to @hpaulj +* Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj + + +0.1.9 / 2012-12-27 +------------------ + +* Fixed option dest interferens with other options (issue #23), thanks to @hpaulj +* Fixed default value behavior with `*` positionals, thanks to @hpaulj +* Improve `getDefault()` behavior, thanks to @hpaulj +* Imrove negative argument parsing, thanks to @hpaulj + + +0.1.8 / 2012-12-01 +------------------ + +* Fixed parser parents (issue #19), thanks to @hpaulj +* Fixed negative argument parse (issue #20), thanks to @hpaulj + + +0.1.7 / 2012-10-14 +------------------ + +* Fixed 'choices' argument parse (issue #16) +* Fixed stderr output (issue #15) + + +0.1.6 / 2012-09-09 +------------------ + +* Fixed check for conflict of options (thanks to @tomxtobin) + + +0.1.5 / 2012-09-03 +------------------ + +* Fix parser #setDefaults method (thanks to @tomxtobin) + + +0.1.4 / 2012-07-30 +------------------ + +* Fixed pseudo-argument support (thanks to @CGamesPlay) +* Fixed addHelp default (should be true), if not set (thanks to @benblank) + + +0.1.3 / 2012-06-27 +------------------ + +* Fixed formatter api name: Formatter -> HelpFormatter + + +0.1.2 / 2012-05-29 +------------------ + +* Added basic tests +* Removed excess whitespace in help +* Fixed error reporting, when parcer with subcommands + called with empty arguments + + +0.1.1 / 2012-05-23 +------------------ + +* Fixed line wrapping in help formatter +* Added better error reporting on invalid arguments + + +0.1.0 / 2012-05-16 +------------------ + +* First release. diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/LICENSE new file mode 100644 index 00000000..1afdae55 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (C) 2012 by Vitaly Puzrin + +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/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/README.md b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/README.md new file mode 100644 index 00000000..72e42616 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/README.md @@ -0,0 +1,243 @@ +argparse +======== + +[![Build Status](https://secure.travis-ci.org/nodeca/argparse.png?branch=master)](http://travis-ci.org/nodeca/argparse) +[![NPM version](https://img.shields.io/npm/v/argparse.svg)](https://www.npmjs.org/package/argparse) + +CLI arguments parser for node.js. Javascript port of python's +[argparse](http://docs.python.org/dev/library/argparse.html) module +(original version 3.2). That's a full port, except some very rare options, +recorded in issue tracker. + +**NB. Difference with original.** + +- Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/). +- Use `defaultValue` instead of `default`. + + +Example +======= + +test.js file: + +```javascript +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp:true, + description: 'Argparse example' +}); +parser.addArgument( + [ '-f', '--foo' ], + { + help: 'foo bar' + } +); +parser.addArgument( + [ '-b', '--bar' ], + { + help: 'bar foo' + } +); +var args = parser.parseArgs(); +console.dir(args); +``` + +Display help: + +``` +$ ./test.js -h +usage: example.js [-h] [-v] [-f FOO] [-b BAR] + +Argparse example + +Optional arguments: + -h, --help Show this help message and exit. + -v, --version Show program's version number and exit. + -f FOO, --foo FOO foo bar + -b BAR, --bar BAR bar foo +``` + +Parse arguments: + +``` +$ ./test.js -f=3 --bar=4 +{ foo: '3', bar: '4' } +``` + +More [examples](https://github.com/nodeca/argparse/tree/master/examples). + + +ArgumentParser objects +====================== + +``` +new ArgumentParser({paramters hash}); +``` + +Creates a new ArgumentParser object. + +**Supported params:** + +- ```description``` - Text to display before the argument help. +- ```epilog``` - Text to display after the argument help. +- ```addHelp``` - Add a -h/–help option to the parser. (default: true) +- ```argumentDefault``` - Set the global default value for arguments. (default: null) +- ```parents``` - A list of ArgumentParser objects whose arguments should also be included. +- ```prefixChars``` - The set of characters that prefix optional arguments. (default: ‘-‘) +- ```formatterClass``` - A class for customizing the help output. +- ```prog``` - The name of the program (default: `path.basename(process.argv[1])`) +- ```usage``` - The string describing the program usage (default: generated) +- ```conflictHandler``` - Usually unnecessary, defines strategy for resolving conflicting optionals. + +**Not supportied yet** + +- ```fromfilePrefixChars``` - The set of characters that prefix files from which additional arguments should be read. + + +Details in [original ArgumentParser guide](http://docs.python.org/dev/library/argparse.html#argumentparser-objects) + + +addArgument() method +==================== + +``` +ArgumentParser.addArgument([names or flags], {options}) +``` + +Defines how a single command-line argument should be parsed. + +- ```name or flags``` - Either a name or a list of option strings, e.g. foo or -f, --foo. + +Options: + +- ```action``` - The basic type of action to be taken when this argument is encountered at the command line. +- ```nargs```- The number of command-line arguments that should be consumed. +- ```constant``` - A constant value required by some action and nargs selections. +- ```defaultValue``` - The value produced if the argument is absent from the command line. +- ```type``` - The type to which the command-line argument should be converted. +- ```choices``` - A container of the allowable values for the argument. +- ```required``` - Whether or not the command-line option may be omitted (optionals only). +- ```help``` - A brief description of what the argument does. +- ```metavar``` - A name for the argument in usage messages. +- ```dest``` - The name of the attribute to be added to the object returned by parseArgs(). + +Details in [original add_argument guide](http://docs.python.org/dev/library/argparse.html#the-add-argument-method) + + +Action (some details) +================ + +ArgumentParser objects associate command-line arguments with actions. +These actions can do just about anything with the command-line arguments associated +with them, though most actions simply add an attribute to the object returned by +parseArgs(). The action keyword argument specifies how the command-line arguments +should be handled. The supported actions are: + +- ```store``` - Just stores the argument’s value. This is the default action. +- ```storeConst``` - Stores value, specified by the const keyword argument. + (Note that the const keyword argument defaults to the rather unhelpful None.) + The 'storeConst' action is most commonly used with optional arguments, that + specify some sort of flag. +- ```storeTrue``` and ```storeFalse``` - Stores values True and False + respectively. These are special cases of 'storeConst'. +- ```append``` - Stores a list, and appends each argument value to the list. + This is useful to allow an option to be specified multiple times. +- ```appendConst``` - Stores a list, and appends value, specified by the + const keyword argument to the list. (Note, that the const keyword argument defaults + is None.) The 'appendConst' action is typically used when multiple arguments need + to store constants to the same list. +- ```count``` - Counts the number of times a keyword argument occurs. For example, + used for increasing verbosity levels. +- ```help``` - Prints a complete help message for all the options in the current + parser and then exits. By default a help action is automatically added to the parser. + See ArgumentParser for details of how the output is created. +- ```version``` - Prints version information and exit. Expects a `version=` + keyword argument in the addArgument() call. + +Details in [original action guide](http://docs.python.org/dev/library/argparse.html#action) + + +Sub-commands +============ + +ArgumentParser.addSubparsers() + +Many programs split their functionality into a number of sub-commands, for +example, the svn program can invoke sub-commands like `svn checkout`, `svn update`, +and `svn commit`. Splitting up functionality this way can be a particularly good +idea when a program performs several different functions which require different +kinds of command-line arguments. `ArgumentParser` supports creation of such +sub-commands with `addSubparsers()` method. The `addSubparsers()` method is +normally called with no arguments and returns an special action object. +This object has a single method `addParser()`, which takes a command name and +any `ArgumentParser` constructor arguments, and returns an `ArgumentParser` object +that can be modified as usual. + +Example: + +sub_commands.js +```javascript +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp:true, + description: 'Argparse examples: sub-commands', +}); + +var subparsers = parser.addSubparsers({ + title:'subcommands', + dest:"subcommand_name" +}); + +var bar = subparsers.addParser('c1', {addHelp:true}); +bar.addArgument( + [ '-f', '--foo' ], + { + action: 'store', + help: 'foo3 bar3' + } +); +var bar = subparsers.addParser( + 'c2', + {aliases:['co'], addHelp:true} +); +bar.addArgument( + [ '-b', '--bar' ], + { + action: 'store', + type: 'int', + help: 'foo3 bar3' + } +); + +var args = parser.parseArgs(); +console.dir(args); + +``` + +Details in [original sub-commands guide](http://docs.python.org/dev/library/argparse.html#sub-commands) + + +Contributors +============ + +- [Eugene Shkuropat](https://github.com/shkuropat) +- [Paul Jacobson](https://github.com/hpaulj) + +[others](https://github.com/nodeca/argparse/graphs/contributors) + +License +======= + +Copyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin). +Released under the MIT license. See +[LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details. + + diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/arguments.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/arguments.js new file mode 100755 index 00000000..5b090fa2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/arguments.js @@ -0,0 +1,36 @@ +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: arguments' +}); +parser.addArgument( + [ '-f', '--foo' ], + { + help: 'foo bar' + } +); +parser.addArgument( + [ '-b', '--bar' ], + { + help: 'bar foo' + } +); + + +parser.printHelp(); +console.log('-----------'); + +var args; +args = parser.parseArgs('-f 1 -b2'.split(' ')); +console.dir(args); +console.log('-----------'); +args = parser.parseArgs('-f=3 --bar=4'.split(' ')); +console.dir(args); +console.log('-----------'); +args = parser.parseArgs('--foo 5 --bar 6'.split(' ')); +console.dir(args); +console.log('-----------'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/choice.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/choice.js new file mode 100755 index 00000000..2616fa4d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/choice.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: choice' +}); + +parser.addArgument(['foo'], {choices: 'abc'}); + +parser.printHelp(); +console.log('-----------'); + +var args; +args = parser.parseArgs(['c']); +console.dir(args); +console.log('-----------'); +parser.parseArgs(['X']); +console.dir(args); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/constants.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/constants.js new file mode 100755 index 00000000..172a4f3d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/constants.js @@ -0,0 +1,59 @@ +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: constant' +}); + +parser.addArgument( + [ '-a'], + { + action: 'storeConst', + dest: 'answer', + help: 'store constant', + constant: 42 + } +); +parser.addArgument( + [ '--str' ], + { + action: 'appendConst', + dest: 'types', + help: 'append constant "str" to types', + constant: 'str' + } +); +parser.addArgument( + [ '--int' ], + { + action: 'appendConst', + dest: 'types', + help: 'append constant "int" to types', + constant: 'int' + } +); + +parser.addArgument( + [ '--true' ], + { + action: 'storeTrue', + help: 'store true constant' + } +); +parser.addArgument( + [ '--false' ], + { + action: 'storeFalse', + help: 'store false constant' + } +); + +parser.printHelp(); +console.log('-----------'); + +var args; +args = parser.parseArgs('-a --str --int --true'.split(' ')); +console.dir(args); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/help.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/help.js new file mode 100755 index 00000000..7eb95553 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/help.js @@ -0,0 +1,13 @@ +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: help', + epilog: 'help epilog', + prog: 'help_example_prog', + usage: 'Usage %(prog)s ' +}); +parser.printHelp(); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/nargs.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/nargs.js new file mode 100755 index 00000000..74f376be --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/nargs.js @@ -0,0 +1,33 @@ +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: nargs' +}); +parser.addArgument( + [ '-f', '--foo' ], + { + help: 'foo bar', + nargs: 1 + } +); +parser.addArgument( + [ '-b', '--bar' ], + { + help: 'bar foo', + nargs: '*' + } +); + +parser.printHelp(); +console.log('-----------'); + +var args; +args = parser.parseArgs('--foo a --bar c d'.split(' ')); +console.dir(args); +console.log('-----------'); +args = parser.parseArgs('--bar b c f --foo a'.split(' ')); +console.dir(args); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/parents.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/parents.js new file mode 100755 index 00000000..dfe89686 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/parents.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; + +var args; +var parent_parser = new ArgumentParser({ addHelp: false }); +// note addHelp:false to prevent duplication of the -h option +parent_parser.addArgument( + ['--parent'], + { type: 'int', description: 'parent' } +); + +var foo_parser = new ArgumentParser({ + parents: [ parent_parser ], + description: 'child1' +}); +foo_parser.addArgument(['foo']); +args = foo_parser.parseArgs(['--parent', '2', 'XXX']); +console.log(args); + +var bar_parser = new ArgumentParser({ + parents: [ parent_parser ], + description: 'child2' +}); +bar_parser.addArgument(['--bar']); +args = bar_parser.parseArgs(['--bar', 'YYY']); +console.log(args); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js new file mode 100755 index 00000000..430d5e18 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js @@ -0,0 +1,23 @@ +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: prefix_chars', + prefixChars: '-+' +}); +parser.addArgument(['+f', '++foo']); +parser.addArgument(['++bar'], {action: 'storeTrue'}); + +parser.printHelp(); +console.log('-----------'); + +var args; +args = parser.parseArgs(['+f', '1']); +console.dir(args); +args = parser.parseArgs(['++bar']); +console.dir(args); +args = parser.parseArgs(['++foo', '2', '++bar']); +console.dir(args); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js new file mode 100755 index 00000000..df9c4944 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js @@ -0,0 +1,49 @@ +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: sub-commands' +}); + +var subparsers = parser.addSubparsers({ + title: 'subcommands', + dest: "subcommand_name" +}); + +var bar = subparsers.addParser('c1', {addHelp: true, help: 'c1 help'}); +bar.addArgument( + [ '-f', '--foo' ], + { + action: 'store', + help: 'foo3 bar3' + } +); +var bar = subparsers.addParser( + 'c2', + {aliases: ['co'], addHelp: true, help: 'c2 help'} +); +bar.addArgument( + [ '-b', '--bar' ], + { + action: 'store', + type: 'int', + help: 'foo3 bar3' + } +); +parser.printHelp(); +console.log('-----------'); + +var args; +args = parser.parseArgs('c1 -f 2'.split(' ')); +console.dir(args); +console.log('-----------'); +args = parser.parseArgs('c2 -b 1'.split(' ')); +console.dir(args); +console.log('-----------'); +args = parser.parseArgs('co -b 1'.split(' ')); +console.dir(args); +console.log('-----------'); +parser.parseArgs(['c1', '-h']); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/sum.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/sum.js new file mode 100755 index 00000000..4532800a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/sum.js @@ -0,0 +1,35 @@ +#!/usr/bin/env node + +'use strict'; + + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ description: 'Process some integers.' }); + + +function sum(arr) { + return arr.reduce(function (a, b) { + return a + b; + }, 0); +} +function max(arr) { + return Math.max.apply(Math, arr); +} + + +parser.addArgument(['integers'], { + metavar: 'N', + type: 'int', + nargs: '+', + help: 'an integer for the accumulator' +}); +parser.addArgument(['--sum'], { + dest: 'accumulate', + action: 'storeConst', + constant: sum, + defaultValue: max, + help: 'sum the integers (default: find the max)' +}); + +var args = parser.parseArgs('--sum 1 2 -1'.split(' ')); +console.log(args.accumulate(args.integers)); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js new file mode 100644 index 00000000..1c03cdc8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js @@ -0,0 +1,270 @@ +'use strict'; + +var a, group, parser, helptext; + +var assert = require('assert'); + + +var print = function () { + return console.log.apply(console, arguments); + }; +// print = function () {}; + +var argparse = require('argparse'); + +print("TEST argparse.ArgumentDefaultsHelpFormatter"); + +parser = new argparse.ArgumentParser({ + debug: true, + formatterClass: argparse.ArgumentDefaultsHelpFormatter, + description: 'description' +}); + +parser.addArgument(['--foo'], { + help: 'foo help - oh and by the way, %(defaultValue)s' +}); + +parser.addArgument(['--bar'], { + action: 'storeTrue', + help: 'bar help' +}); + +parser.addArgument(['spam'], { + help: 'spam help' +}); + +parser.addArgument(['badger'], { + nargs: '?', + defaultValue: 'wooden', + help: 'badger help' +}); + +group = parser.addArgumentGroup({ + title: 'title', + description: 'group description' +}); + +group.addArgument(['--baz'], { + type: 'int', + defaultValue: 42, + help: 'baz help' +}); + +helptext = parser.formatHelp(); +print(helptext); +// test selected clips +assert(helptext.match(/badger help \(default: wooden\)/)); +assert(helptext.match(/foo help - oh and by the way, null/)); +assert(helptext.match(/bar help \(default: false\)/)); +assert(helptext.match(/title:\n {2}group description/)); // test indent +assert(helptext.match(/baz help \(default: 42\)/im)); + +/* +usage: PROG [-h] [--foo FOO] [--bar] [--baz BAZ] spam [badger] + +description + +positional arguments: + spam spam help + badger badger help (default: wooden) + +optional arguments: + -h, --help show this help message and exit + --foo FOO foo help - oh and by the way, null + --bar bar help (default: false) + +title: + group description + + --baz BAZ baz help (default: 42) +*/ + +print("TEST argparse.RawDescriptionHelpFormatter"); + +parser = new argparse.ArgumentParser({ + debug: true, + prog: 'PROG', + formatterClass: argparse.RawDescriptionHelpFormatter, + description: 'Keep the formatting\n' + + ' exactly as it is written\n' + + '\n' + + 'here\n' +}); + +a = parser.addArgument(['--foo'], { + help: ' foo help should not\n' + + ' retain this odd formatting' +}); + +parser.addArgument(['spam'], { + 'help': 'spam help' +}); + +group = parser.addArgumentGroup({ + title: 'title', + description: ' This text\n' + + ' should be indented\n' + + ' exactly like it is here\n' +}); + +group.addArgument(['--bar'], { + help: 'bar help' +}); + +helptext = parser.formatHelp(); +print(helptext); +// test selected clips +assert(helptext.match(parser.description)); +assert.equal(helptext.match(a.help), null); +assert(helptext.match(/foo help should not retain this odd formatting/)); + +/* +class TestHelpRawDescription(HelpTestCase): + """Test the RawTextHelpFormatter""" +.... + +usage: PROG [-h] [--foo FOO] [--bar BAR] spam + +Keep the formatting + exactly as it is written + +here + +positional arguments: + spam spam help + +optional arguments: + -h, --help show this help message and exit + --foo FOO foo help should not retain this odd formatting + +title: + This text + should be indented + exactly like it is here + + --bar BAR bar help +*/ + + +print("TEST argparse.RawTextHelpFormatter"); + +parser = new argparse.ArgumentParser({ + debug: true, + prog: 'PROG', + formatterClass: argparse.RawTextHelpFormatter, + description: 'Keep the formatting\n' + + ' exactly as it is written\n' + + '\n' + + 'here\n' +}); + +parser.addArgument(['--baz'], { + help: ' baz help should also\n' + + 'appear as given here' +}); + +a = parser.addArgument(['--foo'], { + help: ' foo help should also\n' + + 'appear as given here' +}); + +parser.addArgument(['spam'], { + 'help': 'spam help' +}); + +group = parser.addArgumentGroup({ + title: 'title', + description: ' This text\n' + + ' should be indented\n' + + ' exactly like it is here\n' +}); + +group.addArgument(['--bar'], { + help: 'bar help' +}); + +helptext = parser.formatHelp(); +print(helptext); +// test selected clips +assert(helptext.match(parser.description)); +assert(helptext.match(/( {14})appear as given here/gm)); + +/* +class TestHelpRawText(HelpTestCase): + """Test the RawTextHelpFormatter""" + +usage: PROG [-h] [--foo FOO] [--bar BAR] spam + +Keep the formatting + exactly as it is written + +here + +positional arguments: + spam spam help + +optional arguments: + -h, --help show this help message and exit + --foo FOO foo help should also + appear as given here + +title: + This text + should be indented + exactly like it is here + + --bar BAR bar help +*/ + + +print("TEST metavar as a tuple"); + +parser = new argparse.ArgumentParser({ + prog: 'PROG' +}); + +parser.addArgument(['-w'], { + help: 'w', + nargs: '+', + metavar: ['W1', 'W2'] +}); + +parser.addArgument(['-x'], { + help: 'x', + nargs: '*', + metavar: ['X1', 'X2'] +}); + +parser.addArgument(['-y'], { + help: 'y', + nargs: 3, + metavar: ['Y1', 'Y2', 'Y3'] +}); + +parser.addArgument(['-z'], { + help: 'z', + nargs: '?', + metavar: ['Z1'] +}); + +helptext = parser.formatHelp(); +print(helptext); +var ustring = 'PROG [-h] [-w W1 [W2 ...]] [-x [X1 [X2 ...]]] [-y Y1 Y2 Y3] [-z [Z1]]'; +ustring = ustring.replace(/\[/g, '\\[').replace(/\]/g, '\\]'); +// print(ustring) +assert(helptext.match(new RegExp(ustring))); + +/* +class TestHelpTupleMetavar(HelpTestCase): + """Test specifying metavar as a tuple""" + +usage: PROG [-h] [-w W1 [W2 ...]] [-x [X1 [X2 ...]]] [-y Y1 Y2 Y3] [-z [Z1]] + +optional arguments: + -h, --help show this help message and exit + -w W1 [W2 ...] w + -x [X1 [X2 ...]] x + -y Y1 Y2 Y3 y + -z [Z1] z +*/ + diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/index.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/index.js new file mode 100644 index 00000000..3b6eea01 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/argparse'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action.js new file mode 100644 index 00000000..6f7e9a56 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action.js @@ -0,0 +1,146 @@ +/** + * class Action + * + * Base class for all actions + * Do not call in your code, use this class only for inherits your own action + * + * Information about how to convert command line strings to Javascript objects. + * Action objects are used by an ArgumentParser to represent the information + * needed to parse a single argument from one or more strings from the command + * line. The keyword arguments to the Action constructor are also all attributes + * of Action instances. + * + * #####Alowed keywords: + * + * - `store` + * - `storeConstant` + * - `storeTrue` + * - `storeFalse` + * - `append` + * - `appendConstant` + * - `count` + * - `help` + * - `version` + * + * Information about action options see [[Action.new]] + * + * See also [original guide](http://docs.python.org/dev/library/argparse.html#action) + * + **/ + +'use strict'; + + +// Constants +var $$ = require('./const'); + + +/** + * new Action(options) + * + * Base class for all actions. Used only for inherits + * + * + * ##### Options: + * + * - `optionStrings` A list of command-line option strings for the action. + * - `dest` Attribute to hold the created object(s) + * - `nargs` The number of command-line arguments that should be consumed. + * By default, one argument will be consumed and a single value will be + * produced. + * - `constant` Default value for an action with no value. + * - `defaultValue` The value to be produced if the option is not specified. + * - `type` Cast to 'string'|'int'|'float'|'complex'|function (string). If + * None, 'string'. + * - `choices` The choices available. + * - `required` True if the action must always be specified at the command + * line. + * - `help` The help describing the argument. + * - `metavar` The name to be used for the option's argument with the help + * string. If None, the 'dest' value will be used as the name. + * + * ##### nargs supported values: + * + * - `N` (an integer) consumes N arguments (and produces a list) + * - `?` consumes zero or one arguments + * - `*` consumes zero or more arguments (and produces a list) + * - `+` consumes one or more arguments (and produces a list) + * + * Note: that the difference between the default and nargs=1 is that with the + * default, a single value will be produced, while with nargs=1, a list + * containing a single value will be produced. + **/ +var Action = module.exports = function Action(options) { + options = options || {}; + this.optionStrings = options.optionStrings || []; + this.dest = options.dest; + this.nargs = options.nargs !== undefined ? options.nargs : null; + this.constant = options.constant !== undefined ? options.constant : null; + this.defaultValue = options.defaultValue; + this.type = options.type !== undefined ? options.type : null; + this.choices = options.choices !== undefined ? options.choices : null; + this.required = options.required !== undefined ? options.required: false; + this.help = options.help !== undefined ? options.help : null; + this.metavar = options.metavar !== undefined ? options.metavar : null; + + if (!(this.optionStrings instanceof Array)) { + throw new Error('optionStrings should be an array'); + } + if (this.required !== undefined && typeof(this.required) !== 'boolean') { + throw new Error('required should be a boolean'); + } +}; + +/** + * Action#getName -> String + * + * Tells action name + **/ +Action.prototype.getName = function () { + if (this.optionStrings.length > 0) { + return this.optionStrings.join('/'); + } else if (this.metavar !== null && this.metavar !== $$.SUPPRESS) { + return this.metavar; + } else if (this.dest !== undefined && this.dest !== $$.SUPPRESS) { + return this.dest; + } + return null; +}; + +/** + * Action#isOptional -> Boolean + * + * Return true if optional + **/ +Action.prototype.isOptional = function () { + return !this.isPositional(); +}; + +/** + * Action#isPositional -> Boolean + * + * Return true if positional + **/ +Action.prototype.isPositional = function () { + return (this.optionStrings.length === 0); +}; + +/** + * Action#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Should be implemented in inherited classes + * + * ##### Example + * + * ActionCount.prototype.call = function (parser, namespace, values, optionString) { + * namespace.set(this.dest, (namespace[this.dest] || 0) + 1); + * }; + * + **/ +Action.prototype.call = function () { + throw new Error('.call() not defined');// Not Implemented error +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/append.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/append.js new file mode 100644 index 00000000..48c6dbe3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/append.js @@ -0,0 +1,55 @@ +/*:nodoc:* + * class ActionAppend + * + * This action stores a list, and appends each argument value to the list. + * This is useful to allow an option to be specified multiple times. + * This class inherided from [[Action]] + * + **/ + +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// Constants +var $$ = require('../const'); + +/*:nodoc:* + * new ActionAppend(options) + * - options (object): options hash see [[Action.new]] + * + * Note: options.nargs should be optional for constants + * and more then zero for other + **/ +var ActionAppend = module.exports = function ActionAppend(options) { + options = options || {}; + if (this.nargs <= 0) { + throw new Error('nargs for append actions must be > 0; if arg ' + + 'strings are not supplying the value to append, ' + + 'the append const action may be more appropriate'); + } + if (!!this.constant && this.nargs !== $$.OPTIONAL) { + throw new Error('nargs must be OPTIONAL to supply const'); + } + Action.call(this, options); +}; +util.inherits(ActionAppend, Action); + +/*:nodoc:* + * ActionAppend#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionAppend.prototype.call = function (parser, namespace, values) { + var items = [].concat(namespace[this.dest] || []); // or _.clone + items.push(values); + namespace.set(this.dest, items); +}; + + diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js new file mode 100644 index 00000000..90747abb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js @@ -0,0 +1,47 @@ +/*:nodoc:* + * class ActionAppendConstant + * + * This stores a list, and appends the value specified by + * the const keyword argument to the list. + * (Note that the const keyword argument defaults to null.) + * The 'appendConst' action is typically useful when multiple + * arguments need to store constants to the same list. + * + * This class inherited from [[Action]] + **/ + +'use strict'; + +var util = require('util'); + +var Action = require('../../action'); + +/*:nodoc:* + * new ActionAppendConstant(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionAppendConstant = module.exports = function ActionAppendConstant(options) { + options = options || {}; + options.nargs = 0; + if (options.constant === undefined) { + throw new Error('constant option is required for appendAction'); + } + Action.call(this, options); +}; +util.inherits(ActionAppendConstant, Action); + +/*:nodoc:* + * ActionAppendConstant#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionAppendConstant.prototype.call = function (parser, namespace) { + var items = [].concat(namespace[this.dest] || []); + items.push(this.constant); + namespace.set(this.dest, items); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/count.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/count.js new file mode 100644 index 00000000..d6a5899d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/count.js @@ -0,0 +1,40 @@ +/*:nodoc:* + * class ActionCount + * + * This counts the number of times a keyword argument occurs. + * For example, this is useful for increasing verbosity levels + * + * This class inherided from [[Action]] + * + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +/*:nodoc:* + * new ActionCount(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionCount = module.exports = function ActionCount(options) { + options = options || {}; + options.nargs = 0; + + Action.call(this, options); +}; +util.inherits(ActionCount, Action); + +/*:nodoc:* + * ActionCount#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionCount.prototype.call = function (parser, namespace) { + namespace.set(this.dest, (namespace[this.dest] || 0) + 1); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/help.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/help.js new file mode 100644 index 00000000..7f7b4e2d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/help.js @@ -0,0 +1,48 @@ +/*:nodoc:* + * class ActionHelp + * + * Support action for printing help + * This class inherided from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// Constants +var $$ = require('../const'); + +/*:nodoc:* + * new ActionHelp(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionHelp = module.exports = function ActionHelp(options) { + options = options || {}; + if (options.defaultValue !== null) { + options.defaultValue = options.defaultValue; + } + else { + options.defaultValue = $$.SUPPRESS; + } + options.dest = (options.dest !== null ? options.dest: $$.SUPPRESS); + options.nargs = 0; + Action.call(this, options); + +}; +util.inherits(ActionHelp, Action); + +/*:nodoc:* + * ActionHelp#call(parser, namespace, values, optionString) + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Print help and exit + **/ +ActionHelp.prototype.call = function (parser) { + parser.printHelp(); + parser.exit(); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store.js new file mode 100644 index 00000000..8ebc9748 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store.js @@ -0,0 +1,50 @@ +/*:nodoc:* + * class ActionStore + * + * This action just stores the argument’s value. This is the default action. + * + * This class inherited from [[Action]] + * + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// Constants +var $$ = require('../const'); + + +/*:nodoc:* + * new ActionStore(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionStore = module.exports = function ActionStore(options) { + options = options || {}; + if (this.nargs <= 0) { + throw new Error('nargs for store actions must be > 0; if you ' + + 'have nothing to store, actions such as store ' + + 'true or store const may be more appropriate'); + + } + if (this.constant !== undefined && this.nargs !== $$.OPTIONAL) { + throw new Error('nargs must be OPTIONAL to supply const'); + } + Action.call(this, options); +}; +util.inherits(ActionStore, Action); + +/*:nodoc:* + * ActionStore#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionStore.prototype.call = function (parser, namespace, values) { + namespace.set(this.dest, values); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js new file mode 100644 index 00000000..8410fcf7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js @@ -0,0 +1,43 @@ +/*:nodoc:* + * class ActionStoreConstant + * + * This action stores the value specified by the const keyword argument. + * (Note that the const keyword argument defaults to the rather unhelpful null.) + * The 'store_const' action is most commonly used with optional + * arguments that specify some sort of flag. + * + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../../action'); + +/*:nodoc:* + * new ActionStoreConstant(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionStoreConstant = module.exports = function ActionStoreConstant(options) { + options = options || {}; + options.nargs = 0; + if (options.constant === undefined) { + throw new Error('constant option is required for storeAction'); + } + Action.call(this, options); +}; +util.inherits(ActionStoreConstant, Action); + +/*:nodoc:* + * ActionStoreConstant#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionStoreConstant.prototype.call = function (parser, namespace) { + namespace.set(this.dest, this.constant); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js new file mode 100644 index 00000000..66417bf6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js @@ -0,0 +1,27 @@ +/*:nodoc:* + * class ActionStoreFalse + * + * This action store the values False respectively. + * This is special cases of 'storeConst' + * + * This class inherited from [[Action]] + **/ + +'use strict'; + +var util = require('util'); + +var ActionStoreConstant = require('./constant'); + +/*:nodoc:* + * new ActionStoreFalse(options) + * - options (object): hash of options see [[Action.new]] + * + **/ +var ActionStoreFalse = module.exports = function ActionStoreFalse(options) { + options = options || {}; + options.constant = false; + options.defaultValue = options.defaultValue !== null ? options.defaultValue: true; + ActionStoreConstant.call(this, options); +}; +util.inherits(ActionStoreFalse, ActionStoreConstant); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js new file mode 100644 index 00000000..43ec7086 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js @@ -0,0 +1,26 @@ +/*:nodoc:* + * class ActionStoreTrue + * + * This action store the values True respectively. + * This isspecial cases of 'storeConst' + * + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var ActionStoreConstant = require('./constant'); + +/*:nodoc:* + * new ActionStoreTrue(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionStoreTrue = module.exports = function ActionStoreTrue(options) { + options = options || {}; + options.constant = true; + options.defaultValue = options.defaultValue !== null ? options.defaultValue: false; + ActionStoreConstant.call(this, options); +}; +util.inherits(ActionStoreTrue, ActionStoreConstant); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js new file mode 100644 index 00000000..257714d4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js @@ -0,0 +1,148 @@ +/** internal + * class ActionSubparsers + * + * Support the creation of such sub-commands with the addSubparsers() + * + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); +var format = require('util').format; +var _ = require('lodash'); + + +var Action = require('../action'); + +// Constants +var $$ = require('../const'); + +// Errors +var argumentErrorHelper = require('../argument/error'); + + +/*:nodoc:* + * new ChoicesPseudoAction(name, help) + * + * Create pseudo action for correct help text + * + **/ +var ChoicesPseudoAction = function (name, help) { + var options = { + optionStrings: [], + dest: name, + help: help + }; + + Action.call(this, options); +}; +util.inherits(ChoicesPseudoAction, Action); + +/** + * new ActionSubparsers(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionSubparsers = module.exports = function ActionSubparsers(options) { + options = options || {}; + options.dest = options.dest || $$.SUPPRESS; + options.nargs = $$.PARSER; + + this.debug = (options.debug === true); + + this._progPrefix = options.prog; + this._parserClass = options.parserClass; + this._nameParserMap = {}; + this._choicesActions = []; + + options.choices = this._nameParserMap; + Action.call(this, options); +}; +util.inherits(ActionSubparsers, Action); + +/*:nodoc:* + * ActionSubparsers#addParser(name, options) -> ArgumentParser + * - name (string): sub-command name + * - options (object): see [[ArgumentParser.new]] + * + * Note: + * addParser supports an additional aliases option, + * which allows multiple strings to refer to the same subparser. + * This example, like svn, aliases co as a shorthand for checkout + * + **/ +ActionSubparsers.prototype.addParser = function (name, options) { + var parser; + + var self = this; + + options = options || {}; + + options.debug = (this.debug === true); + + // set program from the existing prefix + if (!options.prog) { + options.prog = this._progPrefix + ' ' + name; + } + + var aliases = options.aliases || []; + + // create a pseudo-action to hold the choice help + if (!!options.help || _.isString(options.help)) { + var help = options.help; + delete options.help; + + var choiceAction = new ChoicesPseudoAction(name, help); + this._choicesActions.push(choiceAction); + } + + // create the parser and add it to the map + parser = new this._parserClass(options); + this._nameParserMap[name] = parser; + + // make parser available under aliases also + aliases.forEach(function (alias) { + self._nameParserMap[alias] = parser; + }); + + return parser; +}; + +ActionSubparsers.prototype._getSubactions = function () { + return this._choicesActions; +}; + +/*:nodoc:* + * ActionSubparsers#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Parse input aguments + **/ +ActionSubparsers.prototype.call = function (parser, namespace, values) { + var parserName = values[0]; + var argStrings = values.slice(1); + + // set the parser name if requested + if (this.dest !== $$.SUPPRESS) { + namespace[this.dest] = parserName; + } + + // select the parser + if (!!this._nameParserMap[parserName]) { + parser = this._nameParserMap[parserName]; + } else { + throw argumentErrorHelper(format( + 'Unknown parser "%s" (choices: [%s]).', + parserName, + _.keys(this._nameParserMap).join(', ') + )); + } + + // parse all the remaining options into the namespace + parser.parseArgs(argStrings, namespace); +}; + + diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/version.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/version.js new file mode 100644 index 00000000..a17877c0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action/version.js @@ -0,0 +1,50 @@ +/*:nodoc:* + * class ActionVersion + * + * Support action for printing program version + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// +// Constants +// +var $$ = require('../const'); + +/*:nodoc:* + * new ActionVersion(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionVersion = module.exports = function ActionVersion(options) { + options = options || {}; + options.defaultValue = (!!options.defaultValue ? options.defaultValue: $$.SUPPRESS); + options.dest = (options.dest || $$.SUPPRESS); + options.nargs = 0; + this.version = options.version; + Action.call(this, options); +}; +util.inherits(ActionVersion, Action); + +/*:nodoc:* + * ActionVersion#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Print version and exit + **/ +ActionVersion.prototype.call = function (parser) { + var version = this.version || parser.version; + var formatter = parser._getFormatter(); + formatter.addText(version); + parser.exit(0, formatter.formatHelp()); +}; + + + diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action_container.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action_container.js new file mode 100644 index 00000000..043ead41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/action_container.js @@ -0,0 +1,479 @@ +/** internal + * class ActionContainer + * + * Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]] + **/ + +'use strict'; + +var format = require('util').format; +var _ = require('lodash'); + +// Constants +var $$ = require('./const'); + +//Actions +var ActionHelp = require('./action/help'); +var ActionAppend = require('./action/append'); +var ActionAppendConstant = require('./action/append/constant'); +var ActionCount = require('./action/count'); +var ActionStore = require('./action/store'); +var ActionStoreConstant = require('./action/store/constant'); +var ActionStoreTrue = require('./action/store/true'); +var ActionStoreFalse = require('./action/store/false'); +var ActionVersion = require('./action/version'); +var ActionSubparsers = require('./action/subparsers'); + +// Errors +var argumentErrorHelper = require('./argument/error'); + + + +/** + * new ActionContainer(options) + * + * Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]] + * + * ##### Options: + * + * - `description` -- A description of what the program does + * - `prefixChars` -- Characters that prefix optional arguments + * - `argumentDefault` -- The default value for all arguments + * - `conflictHandler` -- The conflict handler to use for duplicate arguments + **/ +var ActionContainer = module.exports = function ActionContainer(options) { + options = options || {}; + + this.description = options.description; + this.argumentDefault = options.argumentDefault; + this.prefixChars = options.prefixChars || ''; + this.conflictHandler = options.conflictHandler; + + // set up registries + this._registries = {}; + + // register actions + this.register('action', null, ActionStore); + this.register('action', 'store', ActionStore); + this.register('action', 'storeConst', ActionStoreConstant); + this.register('action', 'storeTrue', ActionStoreTrue); + this.register('action', 'storeFalse', ActionStoreFalse); + this.register('action', 'append', ActionAppend); + this.register('action', 'appendConst', ActionAppendConstant); + this.register('action', 'count', ActionCount); + this.register('action', 'help', ActionHelp); + this.register('action', 'version', ActionVersion); + this.register('action', 'parsers', ActionSubparsers); + + // raise an exception if the conflict handler is invalid + this._getHandler(); + + // action storage + this._actions = []; + this._optionStringActions = {}; + + // groups + this._actionGroups = []; + this._mutuallyExclusiveGroups = []; + + // defaults storage + this._defaults = {}; + + // determines whether an "option" looks like a negative number + // -1, -1.5 -5e+4 + this._regexpNegativeNumber = new RegExp('^[-]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$'); + + // whether or not there are any optionals that look like negative + // numbers -- uses a list so it can be shared and edited + this._hasNegativeNumberOptionals = []; +}; + +// Groups must be required, then ActionContainer already defined +var ArgumentGroup = require('./argument/group'); +var MutuallyExclusiveGroup = require('./argument/exclusive'); + +// +// Registration methods +// + +/** + * ActionContainer#register(registryName, value, object) -> Void + * - registryName (String) : object type action|type + * - value (string) : keyword + * - object (Object|Function) : handler + * + * Register handlers + **/ +ActionContainer.prototype.register = function (registryName, value, object) { + this._registries[registryName] = this._registries[registryName] || {}; + this._registries[registryName][value] = object; +}; + +ActionContainer.prototype._registryGet = function (registryName, value, defaultValue) { + if (3 > arguments.length) { + defaultValue = null; + } + return this._registries[registryName][value] || defaultValue; +}; + +// +// Namespace default accessor methods +// + +/** + * ActionContainer#setDefaults(options) -> Void + * - options (object):hash of options see [[Action.new]] + * + * Set defaults + **/ +ActionContainer.prototype.setDefaults = function (options) { + options = options || {}; + for (var property in options) { + this._defaults[property] = options[property]; + } + + // if these defaults match any existing arguments, replace the previous + // default on the object with the new one + this._actions.forEach(function (action) { + if (action.dest in options) { + action.defaultValue = options[action.dest]; + } + }); +}; + +/** + * ActionContainer#getDefault(dest) -> Mixed + * - dest (string): action destination + * + * Return action default value + **/ +ActionContainer.prototype.getDefault = function (dest) { + var result = (_.has(this._defaults, dest)) ? this._defaults[dest] : null; + + this._actions.forEach(function (action) { + if (action.dest === dest && _.has(action, 'defaultValue')) { + result = action.defaultValue; + } + }); + + return result; +}; +// +// Adding argument actions +// + +/** + * ActionContainer#addArgument(args, options) -> Object + * - args (Array): array of argument keys + * - options (Object): action objects see [[Action.new]] + * + * #### Examples + * - addArgument([-f, --foo], {action:'store', defaultValue=1, ...}) + * - addArgument(['bar'], action: 'store', nargs:1, ...}) + **/ +ActionContainer.prototype.addArgument = function (args, options) { + args = args; + options = options || {}; + + if (!_.isArray(args)) { + throw new TypeError('addArgument first argument should be an array'); + } + if (!_.isObject(options) || _.isArray(options)) { + throw new TypeError('addArgument second argument should be a hash'); + } + + // if no positional args are supplied or only one is supplied and + // it doesn't look like an option string, parse a positional argument + if (!args || args.length === 1 && this.prefixChars.indexOf(args[0][0]) < 0) { + if (args && !!options.dest) { + throw new Error('dest supplied twice for positional argument'); + } + options = this._getPositional(args, options); + + // otherwise, we're adding an optional argument + } else { + options = this._getOptional(args, options); + } + + // if no default was supplied, use the parser-level default + if (_.isUndefined(options.defaultValue)) { + var dest = options.dest; + if (_.has(this._defaults, dest)) { + options.defaultValue = this._defaults[dest]; + } else if (!_.isUndefined(this.argumentDefault)) { + options.defaultValue = this.argumentDefault; + } + } + + // create the action object, and add it to the parser + var ActionClass = this._popActionClass(options); + if (! _.isFunction(ActionClass)) { + throw new Error(format('Unknown action "%s".', ActionClass)); + } + var action = new ActionClass(options); + + // throw an error if the action type is not callable + var typeFunction = this._registryGet('type', action.type, action.type); + if (!_.isFunction(typeFunction)) { + throw new Error(format('"%s" is not callable', typeFunction)); + } + + return this._addAction(action); +}; + +/** + * ActionContainer#addArgumentGroup(options) -> ArgumentGroup + * - options (Object): hash of options see [[ArgumentGroup.new]] + * + * Create new arguments groups + **/ +ActionContainer.prototype.addArgumentGroup = function (options) { + var group = new ArgumentGroup(this, options); + this._actionGroups.push(group); + return group; +}; + +/** + * ActionContainer#addMutuallyExclusiveGroup(options) -> ArgumentGroup + * - options (Object): {required: false} + * + * Create new mutual exclusive groups + **/ +ActionContainer.prototype.addMutuallyExclusiveGroup = function (options) { + var group = new MutuallyExclusiveGroup(this, options); + this._mutuallyExclusiveGroups.push(group); + return group; +}; + +ActionContainer.prototype._addAction = function (action) { + var self = this; + + // resolve any conflicts + this._checkConflict(action); + + // add to actions list + this._actions.push(action); + action.container = this; + + // index the action by any option strings it has + action.optionStrings.forEach(function (optionString) { + self._optionStringActions[optionString] = action; + }); + + // set the flag if any option strings look like negative numbers + action.optionStrings.forEach(function (optionString) { + if (optionString.match(self._regexpNegativeNumber)) { + if (!_.any(self._hasNegativeNumberOptionals)) { + self._hasNegativeNumberOptionals.push(true); + } + } + }); + + // return the created action + return action; +}; + +ActionContainer.prototype._removeAction = function (action) { + var actionIndex = this._actions.indexOf(action); + if (actionIndex >= 0) { + this._actions.splice(actionIndex, 1); + } +}; + +ActionContainer.prototype._addContainerActions = function (container) { + // collect groups by titles + var titleGroupMap = {}; + this._actionGroups.forEach(function (group) { + if (titleGroupMap[group.title]) { + throw new Error(format('Cannot merge actions - two groups are named "%s".', group.title)); + } + titleGroupMap[group.title] = group; + }); + + // map each action to its group + var groupMap = {}; + function actionHash(action) { + // unique (hopefully?) string suitable as dictionary key + return action.getName(); + } + container._actionGroups.forEach(function (group) { + // if a group with the title exists, use that, otherwise + // create a new group matching the container's group + if (!titleGroupMap[group.title]) { + titleGroupMap[group.title] = this.addArgumentGroup({ + title: group.title, + description: group.description + }); + } + + // map the actions to their new group + group._groupActions.forEach(function (action) { + groupMap[actionHash(action)] = titleGroupMap[group.title]; + }); + }, this); + + // add container's mutually exclusive groups + // NOTE: if add_mutually_exclusive_group ever gains title= and + // description= then this code will need to be expanded as above + var mutexGroup; + container._mutuallyExclusiveGroups.forEach(function (group) { + mutexGroup = this.addMutuallyExclusiveGroup({ + required: group.required + }); + // map the actions to their new mutex group + group._groupActions.forEach(function (action) { + groupMap[actionHash(action)] = mutexGroup; + }); + }, this); // forEach takes a 'this' argument + + // add all actions to this container or their group + container._actions.forEach(function (action) { + var key = actionHash(action); + if (!!groupMap[key]) { + groupMap[key]._addAction(action); + } + else + { + this._addAction(action); + } + }); +}; + +ActionContainer.prototype._getPositional = function (dest, options) { + if (_.isArray(dest)) { + dest = _.first(dest); + } + // make sure required is not specified + if (options.required) { + throw new Error('"required" is an invalid argument for positionals.'); + } + + // mark positional arguments as required if at least one is + // always required + if (options.nargs !== $$.OPTIONAL && options.nargs !== $$.ZERO_OR_MORE) { + options.required = true; + } + if (options.nargs === $$.ZERO_OR_MORE && options.defaultValue === undefined) { + options.required = true; + } + + // return the keyword arguments with no option strings + options.dest = dest; + options.optionStrings = []; + return options; +}; + +ActionContainer.prototype._getOptional = function (args, options) { + var prefixChars = this.prefixChars; + var optionStrings = []; + var optionStringsLong = []; + + // determine short and long option strings + args.forEach(function (optionString) { + // error on strings that don't start with an appropriate prefix + if (prefixChars.indexOf(optionString[0]) < 0) { + throw new Error(format('Invalid option string "%s": must start with a "%s".', + optionString, + prefixChars + )); + } + + // strings starting with two prefix characters are long options + optionStrings.push(optionString); + if (optionString.length > 1 && prefixChars.indexOf(optionString[1]) >= 0) { + optionStringsLong.push(optionString); + } + }); + + // infer dest, '--foo-bar' -> 'foo_bar' and '-x' -> 'x' + var dest = options.dest || null; + delete options.dest; + + if (!dest) { + var optionStringDest = optionStringsLong.length ? optionStringsLong[0] :optionStrings[0]; + dest = _.trim(optionStringDest, this.prefixChars); + + if (dest.length === 0) { + throw new Error( + format('dest= is required for options like "%s"', optionStrings.join(', ')) + ); + } + dest = dest.replace(/-/g, '_'); + } + + // return the updated keyword arguments + options.dest = dest; + options.optionStrings = optionStrings; + + return options; +}; + +ActionContainer.prototype._popActionClass = function (options, defaultValue) { + defaultValue = defaultValue || null; + + var action = (options.action || defaultValue); + delete options.action; + + var actionClass = this._registryGet('action', action, action); + return actionClass; +}; + +ActionContainer.prototype._getHandler = function () { + var handlerString = this.conflictHandler; + var handlerFuncName = "_handleConflict" + _.capitalize(handlerString); + var func = this[handlerFuncName]; + if (typeof func === 'undefined') { + var msg = "invalid conflict resolution value: " + handlerString; + throw new Error(msg); + } else { + return func; + } +}; + +ActionContainer.prototype._checkConflict = function (action) { + var optionStringActions = this._optionStringActions; + var conflictOptionals = []; + + // find all options that conflict with this option + // collect pairs, the string, and an existing action that it conflicts with + action.optionStrings.forEach(function (optionString) { + var conflOptional = optionStringActions[optionString]; + if (typeof conflOptional !== 'undefined') { + conflictOptionals.push([optionString, conflOptional]); + } + }); + + if (conflictOptionals.length > 0) { + var conflictHandler = this._getHandler(); + conflictHandler.call(this, action, conflictOptionals); + } +}; + +ActionContainer.prototype._handleConflictError = function (action, conflOptionals) { + var conflicts = _.map(conflOptionals, function (pair) {return pair[0]; }); + conflicts = conflicts.join(', '); + throw argumentErrorHelper( + action, + format('Conflicting option string(s): %s', conflicts) + ); +}; + +ActionContainer.prototype._handleConflictResolve = function (action, conflOptionals) { + // remove all conflicting options + var self = this; + conflOptionals.forEach(function (pair) { + var optionString = pair[0]; + var conflictingAction = pair[1]; + // remove the conflicting option string + var i = conflictingAction.optionStrings.indexOf(optionString); + if (i >= 0) { + conflictingAction.optionStrings.splice(i, 1); + } + delete self._optionStringActions[optionString]; + // if the option now has no option string, remove it from the + // container holding it + if (conflictingAction.optionStrings.length === 0) { + conflictingAction.container._removeAction(conflictingAction); + } + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argparse.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argparse.js new file mode 100644 index 00000000..f2a2c51d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argparse.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports.ArgumentParser = require('./argument_parser.js'); +module.exports.Namespace = require('./namespace'); +module.exports.Action = require('./action'); +module.exports.HelpFormatter = require('./help/formatter.js'); +module.exports.Const = require('./const.js'); + +module.exports.ArgumentDefaultsHelpFormatter = + require('./help/added_formatters.js').ArgumentDefaultsHelpFormatter; +module.exports.RawDescriptionHelpFormatter = + require('./help/added_formatters.js').RawDescriptionHelpFormatter; +module.exports.RawTextHelpFormatter = + require('./help/added_formatters.js').RawTextHelpFormatter; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js new file mode 100644 index 00000000..c8a02a08 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js @@ -0,0 +1,50 @@ +'use strict'; + + +var format = require('util').format; + + +var ERR_CODE = 'ARGError'; + +/*:nodoc:* + * argumentError(argument, message) -> TypeError + * - argument (Object): action with broken argument + * - message (String): error message + * + * Error format helper. An error from creating or using an argument + * (optional or positional). The string value of this exception + * is the message, augmented with information + * about the argument that caused it. + * + * #####Example + * + * var argumentErrorHelper = require('./argument/error'); + * if (conflictOptionals.length > 0) { + * throw argumentErrorHelper( + * action, + * format('Conflicting option string(s): %s', conflictOptionals.join(', ')) + * ); + * } + * + **/ +module.exports = function (argument, message) { + var argumentName = null; + var errMessage; + var err; + + if (argument.getName) { + argumentName = argument.getName(); + } else { + argumentName = '' + argument; + } + + if (!argumentName) { + errMessage = message; + } else { + errMessage = format('argument "%s": %s', argumentName, message); + } + + err = new TypeError(errMessage); + err.code = ERR_CODE; + return err; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js new file mode 100644 index 00000000..8287e00d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js @@ -0,0 +1,54 @@ +/** internal + * class MutuallyExclusiveGroup + * + * Group arguments. + * By default, ArgumentParser groups command-line arguments + * into “positional arguments” and “optional arguments” + * when displaying help messages. When there is a better + * conceptual grouping of arguments than this default one, + * appropriate groups can be created using the addArgumentGroup() method + * + * This class inherited from [[ArgumentContainer]] + **/ +'use strict'; + +var util = require('util'); + +var ArgumentGroup = require('./group'); + +/** + * new MutuallyExclusiveGroup(container, options) + * - container (object): main container + * - options (object): options.required -> true/false + * + * `required` could be an argument itself, but making it a property of + * the options argument is more consistent with the JS adaptation of the Python) + **/ +var MutuallyExclusiveGroup = module.exports = function MutuallyExclusiveGroup(container, options) { + var required; + options = options || {}; + required = options.required || false; + ArgumentGroup.call(this, container); + this.required = required; + +}; +util.inherits(MutuallyExclusiveGroup, ArgumentGroup); + + +MutuallyExclusiveGroup.prototype._addAction = function (action) { + var msg; + if (action.required) { + msg = 'mutually exclusive arguments must be optional'; + throw new Error(msg); + } + action = this._container._addAction(action); + this._groupActions.push(action); + return action; +}; + + +MutuallyExclusiveGroup.prototype._removeAction = function (action) { + this._container._removeAction(action); + this._groupActions.remove(action); +}; + diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js new file mode 100644 index 00000000..58b271f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js @@ -0,0 +1,75 @@ +/** internal + * class ArgumentGroup + * + * Group arguments. + * By default, ArgumentParser groups command-line arguments + * into “positional arguments” and “optional arguments” + * when displaying help messages. When there is a better + * conceptual grouping of arguments than this default one, + * appropriate groups can be created using the addArgumentGroup() method + * + * This class inherited from [[ArgumentContainer]] + **/ +'use strict'; + +var util = require('util'); + +var ActionContainer = require('../action_container'); + + +/** + * new ArgumentGroup(container, options) + * - container (object): main container + * - options (object): hash of group options + * + * #### options + * - **prefixChars** group name prefix + * - **argumentDefault** default argument value + * - **title** group title + * - **description** group description + * + **/ +var ArgumentGroup = module.exports = function ArgumentGroup(container, options) { + + options = options || {}; + + // add any missing keyword arguments by checking the container + options.conflictHandler = (options.conflictHandler || container.conflictHandler); + options.prefixChars = (options.prefixChars || container.prefixChars); + options.argumentDefault = (options.argumentDefault || container.argumentDefault); + + ActionContainer.call(this, options); + + // group attributes + this.title = options.title; + this._groupActions = []; + + // share most attributes with the container + this._container = container; + this._registries = container._registries; + this._actions = container._actions; + this._optionStringActions = container._optionStringActions; + this._defaults = container._defaults; + this._hasNegativeNumberOptionals = container._hasNegativeNumberOptionals; + this._mutuallyExclusiveGroups = container._mutuallyExclusiveGroups; +}; +util.inherits(ArgumentGroup, ActionContainer); + + +ArgumentGroup.prototype._addAction = function (action) { + // Parent add action + action = ActionContainer.prototype._addAction.call(this, action); + this._groupActions.push(action); + return action; +}; + + +ArgumentGroup.prototype._removeAction = function (action) { + // Parent remove action + ActionContainer.prototype._removeAction.call(this, action); + var actionIndex = this._groupActions.indexOf(action); + if (actionIndex >= 0) { + this._groupActions.splice(actionIndex, 1); + } +}; + diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js new file mode 100644 index 00000000..2b4cee39 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js @@ -0,0 +1,1168 @@ +/** + * class ArgumentParser + * + * Object for parsing command line strings into js objects. + * + * Inherited from [[ActionContainer]] + **/ +'use strict'; + +var util = require('util'); +var format = require('util').format; +var Path = require('path'); + +var _ = require('lodash'); +var sprintf = require('sprintf-js').sprintf; + +// Constants +var $$ = require('./const'); + +var ActionContainer = require('./action_container'); + +// Errors +var argumentErrorHelper = require('./argument/error'); + +var HelpFormatter = require('./help/formatter'); + +var Namespace = require('./namespace'); + + +/** + * new ArgumentParser(options) + * + * Create a new ArgumentParser object. + * + * ##### Options: + * - `prog` The name of the program (default: Path.basename(process.argv[1])) + * - `usage` A usage message (default: auto-generated from arguments) + * - `description` A description of what the program does + * - `epilog` Text following the argument descriptions + * - `parents` Parsers whose arguments should be copied into this one + * - `formatterClass` HelpFormatter class for printing help messages + * - `prefixChars` Characters that prefix optional arguments + * - `fromfilePrefixChars` Characters that prefix files containing additional arguments + * - `argumentDefault` The default value for all arguments + * - `addHelp` Add a -h/-help option + * - `conflictHandler` Specifies how to handle conflicting argument names + * - `debug` Enable debug mode. Argument errors throw exception in + * debug mode and process.exit in normal. Used for development and + * testing (default: false) + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#argumentparser-objects + **/ +var ArgumentParser = module.exports = function ArgumentParser(options) { + var self = this; + options = options || {}; + + options.description = (options.description || null); + options.argumentDefault = (options.argumentDefault || null); + options.prefixChars = (options.prefixChars || '-'); + options.conflictHandler = (options.conflictHandler || 'error'); + ActionContainer.call(this, options); + + options.addHelp = (options.addHelp === undefined || !!options.addHelp); + options.parents = (options.parents || []); + // default program name + options.prog = (options.prog || Path.basename(process.argv[1])); + this.prog = options.prog; + this.usage = options.usage; + this.epilog = options.epilog; + this.version = options.version; + + this.debug = (options.debug === true); + + this.formatterClass = (options.formatterClass || HelpFormatter); + this.fromfilePrefixChars = options.fromfilePrefixChars || null; + this._positionals = this.addArgumentGroup({title: 'Positional arguments'}); + this._optionals = this.addArgumentGroup({title: 'Optional arguments'}); + this._subparsers = null; + + // register types + var FUNCTION_IDENTITY = function (o) { + return o; + }; + this.register('type', 'auto', FUNCTION_IDENTITY); + this.register('type', null, FUNCTION_IDENTITY); + this.register('type', 'int', function (x) { + var result = parseInt(x, 10); + if (isNaN(result)) { + throw new Error(x + ' is not a valid integer.'); + } + return result; + }); + this.register('type', 'float', function (x) { + var result = parseFloat(x); + if (isNaN(result)) { + throw new Error(x + ' is not a valid float.'); + } + return result; + }); + this.register('type', 'string', function (x) { + return '' + x; + }); + + // add help and version arguments if necessary + var defaultPrefix = (this.prefixChars.indexOf('-') > -1) ? '-' : this.prefixChars[0]; + if (options.addHelp) { + this.addArgument( + [defaultPrefix + 'h', defaultPrefix + defaultPrefix + 'help'], + { + action: 'help', + defaultValue: $$.SUPPRESS, + help: 'Show this help message and exit.' + } + ); + } + if (this.version !== undefined) { + this.addArgument( + [defaultPrefix + 'v', defaultPrefix + defaultPrefix + 'version'], + { + action: 'version', + version: this.version, + defaultValue: $$.SUPPRESS, + help: "Show program's version number and exit." + } + ); + } + + // add parent arguments and defaults + options.parents.forEach(function (parent) { + self._addContainerActions(parent); + if (parent._defaults !== undefined) { + for (var defaultKey in parent._defaults) { + if (parent._defaults.hasOwnProperty(defaultKey)) { + self._defaults[defaultKey] = parent._defaults[defaultKey]; + } + } + } + }); + +}; +util.inherits(ArgumentParser, ActionContainer); + +/** + * ArgumentParser#addSubparsers(options) -> [[ActionSubparsers]] + * - options (object): hash of options see [[ActionSubparsers.new]] + * + * See also [subcommands][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#sub-commands + **/ +ArgumentParser.prototype.addSubparsers = function (options) { + if (!!this._subparsers) { + this.error('Cannot have multiple subparser arguments.'); + } + + options = options || {}; + options.debug = (this.debug === true); + options.optionStrings = []; + options.parserClass = (options.parserClass || ArgumentParser); + + + if (!!options.title || !!options.description) { + + this._subparsers = this.addArgumentGroup({ + title: (options.title || 'subcommands'), + description: options.description + }); + delete options.title; + delete options.description; + + } else { + this._subparsers = this._positionals; + } + + // prog defaults to the usage message of this parser, skipping + // optional arguments and with no "usage:" prefix + if (!options.prog) { + var formatter = this._getFormatter(); + var positionals = this._getPositionalActions(); + var groups = this._mutuallyExclusiveGroups; + formatter.addUsage(this.usage, positionals, groups, ''); + options.prog = _.trim(formatter.formatHelp()); + } + + // create the parsers action and add it to the positionals list + var ParsersClass = this._popActionClass(options, 'parsers'); + var action = new ParsersClass(options); + this._subparsers._addAction(action); + + // return the created parsers action + return action; +}; + +ArgumentParser.prototype._addAction = function (action) { + if (action.isOptional()) { + this._optionals._addAction(action); + } else { + this._positionals._addAction(action); + } + return action; +}; + +ArgumentParser.prototype._getOptionalActions = function () { + return this._actions.filter(function (action) { + return action.isOptional(); + }); +}; + +ArgumentParser.prototype._getPositionalActions = function () { + return this._actions.filter(function (action) { + return action.isPositional(); + }); +}; + + +/** + * ArgumentParser#parseArgs(args, namespace) -> Namespace|Object + * - args (array): input elements + * - namespace (Namespace|Object): result object + * + * Parsed args and throws error if some arguments are not recognized + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#the-parse-args-method + **/ +ArgumentParser.prototype.parseArgs = function (args, namespace) { + var argv; + var result = this.parseKnownArgs(args, namespace); + + args = result[0]; + argv = result[1]; + if (argv && argv.length > 0) { + this.error( + format('Unrecognized arguments: %s.', argv.join(' ')) + ); + } + return args; +}; + +/** + * ArgumentParser#parseKnownArgs(args, namespace) -> array + * - args (array): input options + * - namespace (Namespace|Object): result object + * + * Parse known arguments and return tuple of result object + * and unknown args + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#partial-parsing + **/ +ArgumentParser.prototype.parseKnownArgs = function (args, namespace) { + var self = this; + + // args default to the system args + args = args || process.argv.slice(2); + + // default Namespace built from parser defaults + namespace = namespace || new Namespace(); + + self._actions.forEach(function (action) { + if (action.dest !== $$.SUPPRESS) { + if (!_.has(namespace, action.dest)) { + if (action.defaultValue !== $$.SUPPRESS) { + var defaultValue = action.defaultValue; + if (_.isString(action.defaultValue)) { + defaultValue = self._getValue(action, defaultValue); + } + namespace[action.dest] = defaultValue; + } + } + } + }); + + _.keys(self._defaults).forEach(function (dest) { + namespace[dest] = self._defaults[dest]; + }); + + // parse the arguments and exit if there are any errors + try { + var res = this._parseKnownArgs(args, namespace); + + namespace = res[0]; + args = res[1]; + if (_.has(namespace, $$._UNRECOGNIZED_ARGS_ATTR)) { + args = _.union(args, namespace[$$._UNRECOGNIZED_ARGS_ATTR]); + delete namespace[$$._UNRECOGNIZED_ARGS_ATTR]; + } + return [namespace, args]; + } catch (e) { + this.error(e); + } +}; + +ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) { + var self = this; + + var extras = []; + + // replace arg strings that are file references + if (this.fromfilePrefixChars !== null) { + argStrings = this._readArgsFromFiles(argStrings); + } + // map all mutually exclusive arguments to the other arguments + // they can't occur with + // Python has 'conflicts = action_conflicts.setdefault(mutex_action, [])' + // though I can't conceive of a way in which an action could be a member + // of two different mutually exclusive groups. + + function actionHash(action) { + // some sort of hashable key for this action + // action itself cannot be a key in actionConflicts + // I think getName() (join of optionStrings) is unique enough + return action.getName(); + } + + var conflicts, key; + var actionConflicts = {}; + + this._mutuallyExclusiveGroups.forEach(function (mutexGroup) { + mutexGroup._groupActions.forEach(function (mutexAction, i, groupActions) { + key = actionHash(mutexAction); + if (!_.has(actionConflicts, key)) { + actionConflicts[key] = []; + } + conflicts = actionConflicts[key]; + conflicts.push.apply(conflicts, groupActions.slice(0, i)); + conflicts.push.apply(conflicts, groupActions.slice(i + 1)); + }); + }); + + // find all option indices, and determine the arg_string_pattern + // which has an 'O' if there is an option at an index, + // an 'A' if there is an argument, or a '-' if there is a '--' + var optionStringIndices = {}; + + var argStringPatternParts = []; + + argStrings.forEach(function (argString, argStringIndex) { + if (argString === '--') { + argStringPatternParts.push('-'); + while (argStringIndex < argStrings.length) { + argStringPatternParts.push('A'); + argStringIndex++; + } + } + // otherwise, add the arg to the arg strings + // and note the index if it was an option + else { + var pattern; + var optionTuple = self._parseOptional(argString); + if (!optionTuple) { + pattern = 'A'; + } + else { + optionStringIndices[argStringIndex] = optionTuple; + pattern = 'O'; + } + argStringPatternParts.push(pattern); + } + }); + var argStringsPattern = argStringPatternParts.join(''); + + var seenActions = []; + var seenNonDefaultActions = []; + + + function takeAction(action, argumentStrings, optionString) { + seenActions.push(action); + var argumentValues = self._getValues(action, argumentStrings); + + // error if this argument is not allowed with other previously + // seen arguments, assuming that actions that use the default + // value don't really count as "present" + if (argumentValues !== action.defaultValue) { + seenNonDefaultActions.push(action); + if (!!actionConflicts[actionHash(action)]) { + actionConflicts[actionHash(action)].forEach(function (actionConflict) { + if (seenNonDefaultActions.indexOf(actionConflict) >= 0) { + throw argumentErrorHelper( + action, + format('Not allowed with argument "%s".', actionConflict.getName()) + ); + } + }); + } + } + + if (argumentValues !== $$.SUPPRESS) { + action.call(self, namespace, argumentValues, optionString); + } + } + + function consumeOptional(startIndex) { + // get the optional identified at this index + var optionTuple = optionStringIndices[startIndex]; + var action = optionTuple[0]; + var optionString = optionTuple[1]; + var explicitArg = optionTuple[2]; + + // identify additional optionals in the same arg string + // (e.g. -xyz is the same as -x -y -z if no args are required) + var actionTuples = []; + + var args, argCount, start, stop; + + while (true) { + if (!action) { + extras.push(argStrings[startIndex]); + return startIndex + 1; + } + if (!!explicitArg) { + argCount = self._matchArgument(action, 'A'); + + // if the action is a single-dash option and takes no + // arguments, try to parse more single-dash options out + // of the tail of the option string + var chars = self.prefixChars; + if (argCount === 0 && chars.indexOf(optionString[1]) < 0) { + actionTuples.push([action, [], optionString]); + optionString = optionString[0] + explicitArg[0]; + var newExplicitArg = explicitArg.slice(1) || null; + var optionalsMap = self._optionStringActions; + + if (_.keys(optionalsMap).indexOf(optionString) >= 0) { + action = optionalsMap[optionString]; + explicitArg = newExplicitArg; + } + else { + var msg = 'ignored explicit argument %r'; + throw argumentErrorHelper(action, msg); + } + } + // if the action expect exactly one argument, we've + // successfully matched the option; exit the loop + else if (argCount === 1) { + stop = startIndex + 1; + args = [explicitArg]; + actionTuples.push([action, args, optionString]); + break; + } + // error if a double-dash option did not use the + // explicit argument + else { + var message = 'ignored explicit argument %r'; + throw argumentErrorHelper(action, sprintf(message, explicitArg)); + } + } + // if there is no explicit argument, try to match the + // optional's string arguments with the following strings + // if successful, exit the loop + else { + + start = startIndex + 1; + var selectedPatterns = argStringsPattern.substr(start); + + argCount = self._matchArgument(action, selectedPatterns); + stop = start + argCount; + + + args = argStrings.slice(start, stop); + + actionTuples.push([action, args, optionString]); + break; + } + + } + + // add the Optional to the list and return the index at which + // the Optional's string args stopped + if (actionTuples.length < 1) { + throw new Error('length should be > 0'); + } + for (var i = 0; i < actionTuples.length; i++) { + takeAction.apply(self, actionTuples[i]); + } + return stop; + } + + // the list of Positionals left to be parsed; this is modified + // by consume_positionals() + var positionals = self._getPositionalActions(); + + function consumePositionals(startIndex) { + // match as many Positionals as possible + var selectedPattern = argStringsPattern.substr(startIndex); + var argCounts = self._matchArgumentsPartial(positionals, selectedPattern); + + // slice off the appropriate arg strings for each Positional + // and add the Positional and its args to the list + _.zip(positionals, argCounts).forEach(function (item) { + var action = item[0]; + var argCount = item[1]; + if (argCount === undefined) { + return; + } + var args = argStrings.slice(startIndex, startIndex + argCount); + + startIndex += argCount; + takeAction(action, args); + }); + + // slice off the Positionals that we just parsed and return the + // index at which the Positionals' string args stopped + positionals = positionals.slice(argCounts.length); + return startIndex; + } + + // consume Positionals and Optionals alternately, until we have + // passed the last option string + var startIndex = 0; + var position; + + var maxOptionStringIndex = -1; + + Object.keys(optionStringIndices).forEach(function (position) { + maxOptionStringIndex = Math.max(maxOptionStringIndex, parseInt(position, 10)); + }); + + var positionalsEndIndex, nextOptionStringIndex; + + while (startIndex <= maxOptionStringIndex) { + // consume any Positionals preceding the next option + nextOptionStringIndex = null; + for (position in optionStringIndices) { + if (!optionStringIndices.hasOwnProperty(position)) { continue; } + + position = parseInt(position, 10); + if (position >= startIndex) { + if (nextOptionStringIndex !== null) { + nextOptionStringIndex = Math.min(nextOptionStringIndex, position); + } + else { + nextOptionStringIndex = position; + } + } + } + + if (startIndex !== nextOptionStringIndex) { + positionalsEndIndex = consumePositionals(startIndex); + // only try to parse the next optional if we didn't consume + // the option string during the positionals parsing + if (positionalsEndIndex > startIndex) { + startIndex = positionalsEndIndex; + continue; + } + else { + startIndex = positionalsEndIndex; + } + } + + // if we consumed all the positionals we could and we're not + // at the index of an option string, there were extra arguments + if (!optionStringIndices[startIndex]) { + var strings = argStrings.slice(startIndex, nextOptionStringIndex); + extras = extras.concat(strings); + startIndex = nextOptionStringIndex; + } + // consume the next optional and any arguments for it + startIndex = consumeOptional(startIndex); + } + + // consume any positionals following the last Optional + var stopIndex = consumePositionals(startIndex); + + // if we didn't consume all the argument strings, there were extras + extras = extras.concat(argStrings.slice(stopIndex)); + + // if we didn't use all the Positional objects, there were too few + // arg strings supplied. + if (positionals.length > 0) { + self.error('too few arguments'); + } + + // make sure all required actions were present + self._actions.forEach(function (action) { + if (action.required) { + if (_.indexOf(seenActions, action) < 0) { + self.error(format('Argument "%s" is required', action.getName())); + } + } + }); + + // make sure all required groups have one option present + var actionUsed = false; + self._mutuallyExclusiveGroups.forEach(function (group) { + if (group.required) { + actionUsed = _.any(group._groupActions, function (action) { + return _.contains(seenNonDefaultActions, action); + }); + + // if no actions were used, report the error + if (!actionUsed) { + var names = []; + group._groupActions.forEach(function (action) { + if (action.help !== $$.SUPPRESS) { + names.push(action.getName()); + } + }); + names = names.join(' '); + var msg = 'one of the arguments ' + names + ' is required'; + self.error(msg); + } + } + }); + + // return the updated namespace and the extra arguments + return [namespace, extras]; +}; + +ArgumentParser.prototype._readArgsFromFiles = function (argStrings) { + // expand arguments referencing files + var _this = this; + var fs = require('fs'); + var newArgStrings = []; + argStrings.forEach(function (argString) { + if (_this.fromfilePrefixChars.indexOf(argString[0]) < 0) { + // for regular arguments, just add them back into the list + newArgStrings.push(argString); + } else { + // replace arguments referencing files with the file content + try { + var argstrs = []; + var filename = argString.slice(1); + var content = fs.readFileSync(filename, 'utf8'); + content = content.trim().split('\n'); + content.forEach(function (argLine) { + _this.convertArgLineToArgs(argLine).forEach(function (arg) { + argstrs.push(arg); + }); + argstrs = _this._readArgsFromFiles(argstrs); + }); + newArgStrings.push.apply(newArgStrings, argstrs); + } catch (error) { + return _this.error(error.message); + } + } + }); + return newArgStrings; +}; + +ArgumentParser.prototype.convertArgLineToArgs = function (argLine) { + return [argLine]; +}; + +ArgumentParser.prototype._matchArgument = function (action, regexpArgStrings) { + + // match the pattern for this action to the arg strings + var regexpNargs = new RegExp('^' + this._getNargsPattern(action)); + var matches = regexpArgStrings.match(regexpNargs); + var message; + + // throw an exception if we weren't able to find a match + if (!matches) { + switch (action.nargs) { + case undefined: + case null: + message = 'Expected one argument.'; + break; + case $$.OPTIONAL: + message = 'Expected at most one argument.'; + break; + case $$.ONE_OR_MORE: + message = 'Expected at least one argument.'; + break; + default: + message = 'Expected %s argument(s)'; + } + + throw argumentErrorHelper( + action, + format(message, action.nargs) + ); + } + // return the number of arguments matched + return matches[1].length; +}; + +ArgumentParser.prototype._matchArgumentsPartial = function (actions, regexpArgStrings) { + // progressively shorten the actions list by slicing off the + // final actions until we find a match + var self = this; + var result = []; + var actionSlice, pattern, matches; + var i, j; + + var getLength = function (string) { + return string.length; + }; + + for (i = actions.length; i > 0; i--) { + pattern = ''; + actionSlice = actions.slice(0, i); + for (j = 0; j < actionSlice.length; j++) { + pattern += self._getNargsPattern(actionSlice[j]); + } + + pattern = new RegExp('^' + pattern); + matches = regexpArgStrings.match(pattern); + + if (matches && matches.length > 0) { + // need only groups + matches = matches.splice(1); + result = result.concat(matches.map(getLength)); + break; + } + } + + // return the list of arg string counts + return result; +}; + +ArgumentParser.prototype._parseOptional = function (argString) { + var action, optionString, argExplicit, optionTuples; + + // if it's an empty string, it was meant to be a positional + if (!argString) { + return null; + } + + // if it doesn't start with a prefix, it was meant to be positional + if (this.prefixChars.indexOf(argString[0]) < 0) { + return null; + } + + // if the option string is present in the parser, return the action + if (!!this._optionStringActions[argString]) { + return [this._optionStringActions[argString], argString, null]; + } + + // if it's just a single character, it was meant to be positional + if (argString.length === 1) { + return null; + } + + // if the option string before the "=" is present, return the action + if (argString.indexOf('=') >= 0) { + var argStringSplit = argString.split('='); + optionString = argStringSplit[0]; + argExplicit = argStringSplit[1]; + + if (!!this._optionStringActions[optionString]) { + action = this._optionStringActions[optionString]; + return [action, optionString, argExplicit]; + } + } + + // search through all possible prefixes of the option string + // and all actions in the parser for possible interpretations + optionTuples = this._getOptionTuples(argString); + + // if multiple actions match, the option string was ambiguous + if (optionTuples.length > 1) { + var optionStrings = optionTuples.map(function (optionTuple) { + return optionTuple[1]; + }); + this.error(format( + 'Ambiguous option: "%s" could match %s.', + argString, optionStrings.join(', ') + )); + // if exactly one action matched, this segmentation is good, + // so return the parsed action + } else if (optionTuples.length === 1) { + return optionTuples[0]; + } + + // if it was not found as an option, but it looks like a negative + // number, it was meant to be positional + // unless there are negative-number-like options + if (argString.match(this._regexpNegativeNumber)) { + if (!_.any(this._hasNegativeNumberOptionals)) { + return null; + } + } + // if it contains a space, it was meant to be a positional + if (argString.search(' ') >= 0) { + return null; + } + + // it was meant to be an optional but there is no such option + // in this parser (though it might be a valid option in a subparser) + return [null, argString, null]; +}; + +ArgumentParser.prototype._getOptionTuples = function (optionString) { + var result = []; + var chars = this.prefixChars; + var optionPrefix; + var argExplicit; + var action; + var actionOptionString; + + // option strings starting with two prefix characters are only split at + // the '=' + if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) >= 0) { + if (optionString.indexOf('=') >= 0) { + var optionStringSplit = optionString.split('=', 1); + + optionPrefix = optionStringSplit[0]; + argExplicit = optionStringSplit[1]; + } else { + optionPrefix = optionString; + argExplicit = null; + } + + for (actionOptionString in this._optionStringActions) { + if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) { + action = this._optionStringActions[actionOptionString]; + result.push([action, actionOptionString, argExplicit]); + } + } + + // single character options can be concatenated with their arguments + // but multiple character options always have to have their argument + // separate + } else if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) < 0) { + optionPrefix = optionString; + argExplicit = null; + var optionPrefixShort = optionString.substr(0, 2); + var argExplicitShort = optionString.substr(2); + + for (actionOptionString in this._optionStringActions) { + action = this._optionStringActions[actionOptionString]; + if (actionOptionString === optionPrefixShort) { + result.push([action, actionOptionString, argExplicitShort]); + } else if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) { + result.push([action, actionOptionString, argExplicit]); + } + } + + // shouldn't ever get here + } else { + throw new Error(format('Unexpected option string: %s.', optionString)); + } + // return the collected option tuples + return result; +}; + +ArgumentParser.prototype._getNargsPattern = function (action) { + // in all examples below, we have to allow for '--' args + // which are represented as '-' in the pattern + var regexpNargs; + + switch (action.nargs) { + // the default (null) is assumed to be a single argument + case undefined: + case null: + regexpNargs = '(-*A-*)'; + break; + // allow zero or more arguments + case $$.OPTIONAL: + regexpNargs = '(-*A?-*)'; + break; + // allow zero or more arguments + case $$.ZERO_OR_MORE: + regexpNargs = '(-*[A-]*)'; + break; + // allow one or more arguments + case $$.ONE_OR_MORE: + regexpNargs = '(-*A[A-]*)'; + break; + // allow any number of options or arguments + case $$.REMAINDER: + regexpNargs = '([-AO]*)'; + break; + // allow one argument followed by any number of options or arguments + case $$.PARSER: + regexpNargs = '(-*A[-AO]*)'; + break; + // all others should be integers + default: + regexpNargs = '(-*' + _.repeat('-*A', action.nargs) + '-*)'; + } + + // if this is an optional action, -- is not allowed + if (action.isOptional()) { + regexpNargs = regexpNargs.replace(/-\*/g, ''); + regexpNargs = regexpNargs.replace(/-/g, ''); + } + + // return the pattern + return regexpNargs; +}; + +// +// Value conversion methods +// + +ArgumentParser.prototype._getValues = function (action, argStrings) { + var self = this; + + // for everything but PARSER args, strip out '--' + if (action.nargs !== $$.PARSER && action.nargs !== $$.REMAINDER) { + argStrings = argStrings.filter(function (arrayElement) { + return arrayElement !== '--'; + }); + } + + var value, argString; + + // optional argument produces a default when not present + if (argStrings.length === 0 && action.nargs === $$.OPTIONAL) { + + value = (action.isOptional()) ? action.constant: action.defaultValue; + + if (typeof(value) === 'string') { + value = this._getValue(action, value); + this._checkValue(action, value); + } + + // when nargs='*' on a positional, if there were no command-line + // args, use the default if it is anything other than None + } else if (argStrings.length === 0 && action.nargs === $$.ZERO_OR_MORE && + action.optionStrings.length === 0) { + + value = (action.defaultValue || argStrings); + this._checkValue(action, value); + + // single argument or optional argument produces a single value + } else if (argStrings.length === 1 && + (!action.nargs || action.nargs === $$.OPTIONAL)) { + + argString = argStrings[0]; + value = this._getValue(action, argString); + this._checkValue(action, value); + + // REMAINDER arguments convert all values, checking none + } else if (action.nargs === $$.REMAINDER) { + value = argStrings.map(function (v) { + return self._getValue(action, v); + }); + + // PARSER arguments convert all values, but check only the first + } else if (action.nargs === $$.PARSER) { + value = argStrings.map(function (v) { + return self._getValue(action, v); + }); + this._checkValue(action, value[0]); + + // all other types of nargs produce a list + } else { + value = argStrings.map(function (v) { + return self._getValue(action, v); + }); + value.forEach(function (v) { + self._checkValue(action, v); + }); + } + + // return the converted value + return value; +}; + +ArgumentParser.prototype._getValue = function (action, argString) { + var result; + + var typeFunction = this._registryGet('type', action.type, action.type); + if (!_.isFunction(typeFunction)) { + var message = format('%s is not callable', typeFunction); + throw argumentErrorHelper(action, message); + } + + // convert the value to the appropriate type + try { + result = typeFunction(argString); + + // ArgumentTypeErrors indicate errors + // If action.type is not a registered string, it is a function + // Try to deduce its name for inclusion in the error message + // Failing that, include the error message it raised. + } catch (e) { + var name = null; + if (_.isString(action.type)) { + name = action.type; + } else { + name = action.type.name || action.type.displayName || ''; + } + var msg = format('Invalid %s value: %s', name, argString); + if (name === '') {msg += '\n' + e.message; } + throw argumentErrorHelper(action, msg); + } + // return the converted value + return result; +}; + +ArgumentParser.prototype._checkValue = function (action, value) { + // converted value must be one of the choices (if specified) + var choices = action.choices; + if (!!choices) { + // choise for argument can by array or string + if ((_.isString(choices) || _.isArray(choices)) && + choices.indexOf(value) !== -1) { + return; + } + // choise for subparsers can by only hash + if (_.isObject(choices) && !_.isArray(choices) && choices[value]) { + return; + } + + if (_.isString(choices)) { + choices = choices.split('').join(', '); + } + else if (_.isArray(choices)) { + choices = choices.join(', '); + } + else { + choices = _.keys(choices).join(', '); + } + var message = format('Invalid choice: %s (choose from [%s])', value, choices); + throw argumentErrorHelper(action, message); + } +}; + +// +// Help formatting methods +// + +/** + * ArgumentParser#formatUsage -> string + * + * Return usage string + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.formatUsage = function () { + var formatter = this._getFormatter(); + formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups); + return formatter.formatHelp(); +}; + +/** + * ArgumentParser#formatHelp -> string + * + * Return help + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.formatHelp = function () { + var formatter = this._getFormatter(); + + // usage + formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups); + + // description + formatter.addText(this.description); + + // positionals, optionals and user-defined groups + this._actionGroups.forEach(function (actionGroup) { + formatter.startSection(actionGroup.title); + formatter.addText(actionGroup.description); + formatter.addArguments(actionGroup._groupActions); + formatter.endSection(); + }); + + // epilog + formatter.addText(this.epilog); + + // determine help from format above + return formatter.formatHelp(); +}; + +ArgumentParser.prototype._getFormatter = function () { + var FormatterClass = this.formatterClass; + var formatter = new FormatterClass({prog: this.prog}); + return formatter; +}; + +// +// Print functions +// + +/** + * ArgumentParser#printUsage() -> Void + * + * Print usage + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.printUsage = function () { + this._printMessage(this.formatUsage()); +}; + +/** + * ArgumentParser#printHelp() -> Void + * + * Print help + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.printHelp = function () { + this._printMessage(this.formatHelp()); +}; + +ArgumentParser.prototype._printMessage = function (message, stream) { + if (!stream) { + stream = process.stdout; + } + if (message) { + stream.write('' + message); + } +}; + +// +// Exit functions +// + +/** + * ArgumentParser#exit(status=0, message) -> Void + * - status (int): exit status + * - message (string): message + * + * Print message in stderr/stdout and exit program + **/ +ArgumentParser.prototype.exit = function (status, message) { + if (!!message) { + if (status === 0) { + this._printMessage(message); + } + else { + this._printMessage(message, process.stderr); + } + } + + process.exit(status); +}; + +/** + * ArgumentParser#error(message) -> Void + * - err (Error|string): message + * + * Error method Prints a usage message incorporating the message to stderr and + * exits. If you override this in a subclass, + * it should not return -- it should + * either exit or throw an exception. + * + **/ +ArgumentParser.prototype.error = function (err) { + var message; + if (err instanceof Error) { + if (this.debug === true) { + throw err; + } + message = err.message; + } + else { + message = err; + } + var msg = format('%s: error: %s', this.prog, message) + $$.EOL; + + if (this.debug === true) { + throw new Error(msg); + } + + this.printUsage(process.stderr); + + return this.exit(2, msg); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/const.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/const.js new file mode 100644 index 00000000..de831ba4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/const.js @@ -0,0 +1,18 @@ +// +// Constants +// +module.exports.EOL = '\n'; + +module.exports.SUPPRESS = '==SUPPRESS=='; + +module.exports.OPTIONAL = '?'; + +module.exports.ZERO_OR_MORE = '*'; + +module.exports.ONE_OR_MORE = '+'; + +module.exports.PARSER = 'A...'; + +module.exports.REMAINDER = '...'; + +module.exports._UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args'; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js new file mode 100644 index 00000000..3c99c4a1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js @@ -0,0 +1,88 @@ +'use strict'; + +var util = require('util'); +var _ = require('lodash'); + + +// Constants +var $$ = require('../const'); + +var HelpFormatter = require('./formatter.js'); + +/** + * new RawDescriptionHelpFormatter(options) + * new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...}) + * + * Help message formatter which adds default values to argument help. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + **/ + +var ArgumentDefaultsHelpFormatter = function ArgumentDefaultsHelpFormatter(options) { + HelpFormatter.call(this, options); +}; + +util.inherits(ArgumentDefaultsHelpFormatter, HelpFormatter); + +ArgumentDefaultsHelpFormatter.prototype._getHelpString = function (action) { + var help = action.help; + if (action.help.indexOf('%(defaultValue)s') === -1) { + if (action.defaultValue !== $$.SUPPRESS) { + var defaulting_nargs = [$$.OPTIONAL, $$.ZERO_OR_MORE]; + if (action.isOptional() || (defaulting_nargs.indexOf(action.nargs) >= 0)) { + help += ' (default: %(defaultValue)s)'; + } + } + } + return help; +}; + +module.exports.ArgumentDefaultsHelpFormatter = ArgumentDefaultsHelpFormatter; + +/** + * new RawDescriptionHelpFormatter(options) + * new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...}) + * + * Help message formatter which retains any formatting in descriptions. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + **/ + +var RawDescriptionHelpFormatter = function RawDescriptionHelpFormatter(options) { + HelpFormatter.call(this, options); +}; + +util.inherits(RawDescriptionHelpFormatter, HelpFormatter); + +RawDescriptionHelpFormatter.prototype._fillText = function (text, width, indent) { + var lines = text.split('\n'); + lines = lines.map(function (line) { + return _.trimRight(indent + line); + }); + return lines.join('\n'); +}; +module.exports.RawDescriptionHelpFormatter = RawDescriptionHelpFormatter; + +/** + * new RawTextHelpFormatter(options) + * new ArgumentParser({formatterClass: argparse.RawTextHelpFormatter, ...}) + * + * Help message formatter which retains formatting of all help text. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + **/ + +var RawTextHelpFormatter = function RawTextHelpFormatter(options) { + RawDescriptionHelpFormatter.call(this, options); +}; + +util.inherits(RawTextHelpFormatter, RawDescriptionHelpFormatter); + +RawTextHelpFormatter.prototype._splitLines = function (text) { + return text.split('\n'); +}; + +module.exports.RawTextHelpFormatter = RawTextHelpFormatter; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js new file mode 100644 index 00000000..e050728e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js @@ -0,0 +1,798 @@ +/** + * class HelpFormatter + * + * Formatter for generating usage messages and argument help strings. Only the + * name of this class is considered a public API. All the methods provided by + * the class are considered an implementation detail. + * + * Do not call in your code, use this class only for inherits your own forvatter + * + * ToDo add [additonal formatters][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#formatter-class + **/ +'use strict'; + +var _ = require('lodash'); +var sprintf = require('sprintf-js').sprintf; + +// Constants +var $$ = require('../const'); + + +/*:nodoc:* internal + * new Support(parent, heding) + * - parent (object): parent section + * - heading (string): header string + * + **/ +function Section(parent, heading) { + this._parent = parent; + this._heading = heading; + this._items = []; +} + +/*:nodoc:* internal + * Section#addItem(callback) -> Void + * - callback (array): tuple with function and args + * + * Add function for single element + **/ +Section.prototype.addItem = function (callback) { + this._items.push(callback); +}; + +/*:nodoc:* internal + * Section#formatHelp(formatter) -> string + * - formatter (HelpFormatter): current formatter + * + * Form help section string + * + **/ +Section.prototype.formatHelp = function (formatter) { + var itemHelp, heading; + + // format the indented section + if (!!this._parent) { + formatter._indent(); + } + + itemHelp = this._items.map(function (item) { + var obj, func, args; + + obj = formatter; + func = item[0]; + args = item[1]; + return func.apply(obj, args); + }); + itemHelp = formatter._joinParts(itemHelp); + + if (!!this._parent) { + formatter._dedent(); + } + + // return nothing if the section was empty + if (!itemHelp) { + return ''; + } + + // add the heading if the section was non-empty + heading = ''; + if (!!this._heading && this._heading !== $$.SUPPRESS) { + var currentIndent = formatter.currentIndent; + heading = _.repeat(' ', currentIndent) + this._heading + ':' + $$.EOL; + } + + // join the section-initialize newline, the heading and the help + return formatter._joinParts([$$.EOL, heading, itemHelp, $$.EOL]); +}; + +/** + * new HelpFormatter(options) + * + * #### Options: + * - `prog`: program name + * - `indentIncriment`: indent step, default value 2 + * - `maxHelpPosition`: max help position, default value = 24 + * - `width`: line width + * + **/ +var HelpFormatter = module.exports = function HelpFormatter(options) { + options = options || {}; + + this._prog = options.prog; + + this._maxHelpPosition = options.maxHelpPosition || 24; + this._width = (options.width || ((process.env.COLUMNS || 80) - 2)); + + this._currentIndent = 0; + this._indentIncriment = options.indentIncriment || 2; + this._level = 0; + this._actionMaxLength = 0; + + this._rootSection = new Section(null); + this._currentSection = this._rootSection; + + this._whitespaceMatcher = new RegExp('\\s+', 'g'); + this._longBreakMatcher = new RegExp($$.EOL + $$.EOL + $$.EOL + '+', 'g'); +}; + +HelpFormatter.prototype._indent = function () { + this._currentIndent += this._indentIncriment; + this._level += 1; +}; + +HelpFormatter.prototype._dedent = function () { + this._currentIndent -= this._indentIncriment; + this._level -= 1; + if (this._currentIndent < 0) { + throw new Error('Indent decreased below 0.'); + } +}; + +HelpFormatter.prototype._addItem = function (func, args) { + this._currentSection.addItem([func, args]); +}; + +// +// Message building methods +// + +/** + * HelpFormatter#startSection(heading) -> Void + * - heading (string): header string + * + * Start new help section + * + * See alse [code example][1] + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + * + **/ +HelpFormatter.prototype.startSection = function (heading) { + this._indent(); + var section = new Section(this._currentSection, heading); + var func = section.formatHelp.bind(section); + this._addItem(func, [this]); + this._currentSection = section; +}; + +/** + * HelpFormatter#endSection -> Void + * + * End help section + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + **/ +HelpFormatter.prototype.endSection = function () { + this._currentSection = this._currentSection._parent; + this._dedent(); +}; + +/** + * HelpFormatter#addText(text) -> Void + * - text (string): plain text + * + * Add plain text into current section + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + * + **/ +HelpFormatter.prototype.addText = function (text) { + if (!!text && text !== $$.SUPPRESS) { + this._addItem(this._formatText, [text]); + } +}; + +/** + * HelpFormatter#addUsage(usage, actions, groups, prefix) -> Void + * - usage (string): usage text + * - actions (array): actions list + * - groups (array): groups list + * - prefix (string): usage prefix + * + * Add usage data into current section + * + * ##### Example + * + * formatter.addUsage(this.usage, this._actions, []); + * return formatter.formatHelp(); + * + **/ +HelpFormatter.prototype.addUsage = function (usage, actions, groups, prefix) { + if (usage !== $$.SUPPRESS) { + this._addItem(this._formatUsage, [usage, actions, groups, prefix]); + } +}; + +/** + * HelpFormatter#addArgument(action) -> Void + * - action (object): action + * + * Add argument into current section + * + * Single variant of [[HelpFormatter#addArguments]] + **/ +HelpFormatter.prototype.addArgument = function (action) { + if (action.help !== $$.SUPPRESS) { + var self = this; + + // find all invocations + var invocations = [this._formatActionInvocation(action)]; + var invocationLength = invocations[0].length; + + var actionLength; + + if (!!action._getSubactions) { + this._indent(); + action._getSubactions().forEach(function (subaction) { + + var invocationNew = self._formatActionInvocation(subaction); + invocations.push(invocationNew); + invocationLength = Math.max(invocationLength, invocationNew.length); + + }); + this._dedent(); + } + + // update the maximum item length + actionLength = invocationLength + this._currentIndent; + this._actionMaxLength = Math.max(this._actionMaxLength, actionLength); + + // add the item to the list + this._addItem(this._formatAction, [action]); + } +}; + +/** + * HelpFormatter#addArguments(actions) -> Void + * - actions (array): actions list + * + * Mass add arguments into current section + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + * + **/ +HelpFormatter.prototype.addArguments = function (actions) { + var self = this; + actions.forEach(function (action) { + self.addArgument(action); + }); +}; + +// +// Help-formatting methods +// + +/** + * HelpFormatter#formatHelp -> string + * + * Format help + * + * ##### Example + * + * formatter.addText(this.epilog); + * return formatter.formatHelp(); + * + **/ +HelpFormatter.prototype.formatHelp = function () { + var help = this._rootSection.formatHelp(this); + if (help) { + help = help.replace(this._longBreakMatcher, $$.EOL + $$.EOL); + help = _.trim(help, $$.EOL) + $$.EOL; + } + return help; +}; + +HelpFormatter.prototype._joinParts = function (partStrings) { + return partStrings.filter(function (part) { + return (!!part && part !== $$.SUPPRESS); + }).join(''); +}; + +HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix) { + if (!prefix && !_.isString(prefix)) { + prefix = 'usage: '; + } + + actions = actions || []; + groups = groups || []; + + + // if usage is specified, use that + if (usage) { + usage = sprintf(usage, {prog: this._prog}); + + // if no optionals or positionals are available, usage is just prog + } else if (!usage && actions.length === 0) { + usage = this._prog; + + // if optionals and positionals are available, calculate usage + } else if (!usage) { + var prog = this._prog; + var optionals = []; + var positionals = []; + var actionUsage; + var textWidth; + + // split optionals from positionals + actions.forEach(function (action) { + if (action.isOptional()) { + optionals.push(action); + } else { + positionals.push(action); + } + }); + + // build full usage string + actionUsage = this._formatActionsUsage([].concat(optionals, positionals), groups); + usage = [prog, actionUsage].join(' '); + + // wrap the usage parts if it's too long + textWidth = this._width - this._currentIndent; + if ((prefix.length + usage.length) > textWidth) { + + // break usage into wrappable parts + var regexpPart = new RegExp('\\(.*?\\)+|\\[.*?\\]+|\\S+', 'g'); + var optionalUsage = this._formatActionsUsage(optionals, groups); + var positionalUsage = this._formatActionsUsage(positionals, groups); + + + var optionalParts = optionalUsage.match(regexpPart); + var positionalParts = positionalUsage.match(regexpPart) || []; + + if (optionalParts.join(' ') !== optionalUsage) { + throw new Error('assert "optionalParts.join(\' \') === optionalUsage"'); + } + if (positionalParts.join(' ') !== positionalUsage) { + throw new Error('assert "positionalParts.join(\' \') === positionalUsage"'); + } + + // helper for wrapping lines + var _getLines = function (parts, indent, prefix) { + var lines = []; + var line = []; + + var lineLength = !!prefix ? prefix.length - 1: indent.length - 1; + + parts.forEach(function (part) { + if (lineLength + 1 + part.length > textWidth) { + lines.push(indent + line.join(' ')); + line = []; + lineLength = indent.length - 1; + } + line.push(part); + lineLength += part.length + 1; + }); + + if (line) { + lines.push(indent + line.join(' ')); + } + if (prefix) { + lines[0] = lines[0].substr(indent.length); + } + return lines; + }; + + var lines, indent, parts; + // if prog is short, follow it with optionals or positionals + if (prefix.length + prog.length <= 0.75 * textWidth) { + indent = _.repeat(' ', (prefix.length + prog.length + 1)); + if (optionalParts) { + lines = [].concat( + _getLines([prog].concat(optionalParts), indent, prefix), + _getLines(positionalParts, indent) + ); + } else if (positionalParts) { + lines = _getLines([prog].concat(positionalParts), indent, prefix); + } else { + lines = [prog]; + } + + // if prog is long, put it on its own line + } else { + indent = _.repeat(' ', prefix.length); + parts = optionalParts + positionalParts; + lines = _getLines(parts, indent); + if (lines.length > 1) { + lines = [].concat( + _getLines(optionalParts, indent), + _getLines(positionalParts, indent) + ); + } + lines = [prog] + lines; + } + // join lines into usage + usage = lines.join($$.EOL); + } + } + + // prefix with 'usage:' + return prefix + usage + $$.EOL + $$.EOL; +}; + +HelpFormatter.prototype._formatActionsUsage = function (actions, groups) { + // find group indices and identify actions in groups + var groupActions = []; + var inserts = []; + var self = this; + + groups.forEach(function (group) { + var end; + var i; + + var start = actions.indexOf(group._groupActions[0]); + if (start >= 0) { + end = start + group._groupActions.length; + + //if (actions.slice(start, end) === group._groupActions) { + if (_.isEqual(actions.slice(start, end), group._groupActions)) { + group._groupActions.forEach(function (action) { + groupActions.push(action); + }); + + if (!group.required) { + if (!!inserts[start]) { + inserts[start] += ' ['; + } + else { + inserts[start] = '['; + } + inserts[end] = ']'; + } else { + if (!!inserts[start]) { + inserts[start] += ' ('; + } + else { + inserts[start] = '('; + } + inserts[end] = ')'; + } + for (i = start + 1; i < end; i += 1) { + inserts[i] = '|'; + } + } + } + }); + + // collect all actions format strings + var parts = []; + + actions.forEach(function (action, actionIndex) { + var part; + var optionString; + var argsDefault; + var argsString; + + // suppressed arguments are marked with None + // remove | separators for suppressed arguments + if (action.help === $$.SUPPRESS) { + parts.push(null); + if (inserts[actionIndex] === '|') { + inserts.splice(actionIndex, actionIndex); + } else if (inserts[actionIndex + 1] === '|') { + inserts.splice(actionIndex + 1, actionIndex + 1); + } + + // produce all arg strings + } else if (!action.isOptional()) { + part = self._formatArgs(action, action.dest); + + // if it's in a group, strip the outer [] + if (groupActions.indexOf(action) >= 0) { + if (part[0] === '[' && part[part.length - 1] === ']') { + part = part.slice(1, -1); + } + } + // add the action string to the list + parts.push(part); + + // produce the first way to invoke the option in brackets + } else { + optionString = action.optionStrings[0]; + + // if the Optional doesn't take a value, format is: -s or --long + if (action.nargs === 0) { + part = '' + optionString; + + // if the Optional takes a value, format is: -s ARGS or --long ARGS + } else { + argsDefault = action.dest.toUpperCase(); + argsString = self._formatArgs(action, argsDefault); + part = optionString + ' ' + argsString; + } + // make it look optional if it's not required or in a group + if (!action.required && groupActions.indexOf(action) < 0) { + part = '[' + part + ']'; + } + // add the action string to the list + parts.push(part); + } + }); + + // insert things at the necessary indices + for (var i = inserts.length - 1; i >= 0; --i) { + if (inserts[i] !== null) { + parts.splice(i, 0, inserts[i]); + } + } + + // join all the action items with spaces + var text = parts.filter(function (part) { + return !!part; + }).join(' '); + + // clean up separators for mutually exclusive groups + text = text.replace(/([\[(]) /g, '$1'); // remove spaces + text = text.replace(/ ([\])])/g, '$1'); + text = text.replace(/\[ *\]/g, ''); // remove empty groups + text = text.replace(/\( *\)/g, ''); + text = text.replace(/\(([^|]*)\)/g, '$1'); // remove () from single action groups + + text = _.trim(text); + + // return the text + return text; +}; + +HelpFormatter.prototype._formatText = function (text) { + text = sprintf(text, {prog: this._prog}); + var textWidth = this._width - this._currentIndent; + var indentIncriment = _.repeat(' ', this._currentIndent); + return this._fillText(text, textWidth, indentIncriment) + $$.EOL + $$.EOL; +}; + +HelpFormatter.prototype._formatAction = function (action) { + var self = this; + + var helpText; + var helpLines; + var parts; + var indentFirst; + + // determine the required width and the entry label + var helpPosition = Math.min(this._actionMaxLength + 2, this._maxHelpPosition); + var helpWidth = this._width - helpPosition; + var actionWidth = helpPosition - this._currentIndent - 2; + var actionHeader = this._formatActionInvocation(action); + + // no help; start on same line and add a final newline + if (!action.help) { + actionHeader = _.repeat(' ', this._currentIndent) + actionHeader + $$.EOL; + + // short action name; start on the same line and pad two spaces + } else if (actionHeader.length <= actionWidth) { + actionHeader = _.repeat(' ', this._currentIndent) + + actionHeader + + ' ' + + _.repeat(' ', actionWidth - actionHeader.length); + indentFirst = 0; + + // long action name; start on the next line + } else { + actionHeader = _.repeat(' ', this._currentIndent) + actionHeader + $$.EOL; + indentFirst = helpPosition; + } + + // collect the pieces of the action help + parts = [actionHeader]; + + // if there was help for the action, add lines of help text + if (!!action.help) { + helpText = this._expandHelp(action); + helpLines = this._splitLines(helpText, helpWidth); + parts.push(_.repeat(' ', indentFirst) + helpLines[0] + $$.EOL); + helpLines.slice(1).forEach(function (line) { + parts.push(_.repeat(' ', helpPosition) + line + $$.EOL); + }); + + // or add a newline if the description doesn't end with one + } else if (actionHeader.charAt(actionHeader.length - 1) !== $$.EOL) { + parts.push($$.EOL); + } + // if there are any sub-actions, add their help as well + if (!!action._getSubactions) { + this._indent(); + action._getSubactions().forEach(function (subaction) { + parts.push(self._formatAction(subaction)); + }); + this._dedent(); + } + // return a single string + return this._joinParts(parts); +}; + +HelpFormatter.prototype._formatActionInvocation = function (action) { + if (!action.isOptional()) { + var format_func = this._metavarFormatter(action, action.dest); + var metavars = format_func(1); + return metavars[0]; + } else { + var parts = []; + var argsDefault; + var argsString; + + // if the Optional doesn't take a value, format is: -s, --long + if (action.nargs === 0) { + parts = parts.concat(action.optionStrings); + + // if the Optional takes a value, format is: -s ARGS, --long ARGS + } else { + argsDefault = action.dest.toUpperCase(); + argsString = this._formatArgs(action, argsDefault); + action.optionStrings.forEach(function (optionString) { + parts.push(optionString + ' ' + argsString); + }); + } + return parts.join(', '); + } +}; + +HelpFormatter.prototype._metavarFormatter = function (action, metavarDefault) { + var result; + + if (!!action.metavar || action.metavar === '') { + result = action.metavar; + } else if (!!action.choices) { + var choices = action.choices; + + if (_.isString(choices)) { + choices = choices.split('').join(', '); + } else if (_.isArray(choices)) { + choices = choices.join(','); + } + else + { + choices = _.keys(choices).join(','); + } + result = '{' + choices + '}'; + } else { + result = metavarDefault; + } + + return function (size) { + if (Array.isArray(result)) { + return result; + } else { + var metavars = []; + for (var i = 0; i < size; i += 1) { + metavars.push(result); + } + return metavars; + } + }; +}; + +HelpFormatter.prototype._formatArgs = function (action, metavarDefault) { + var result; + var metavars; + + var buildMetavar = this._metavarFormatter(action, metavarDefault); + + switch (action.nargs) { + case undefined: + case null: + metavars = buildMetavar(1); + result = '' + metavars[0]; + break; + case $$.OPTIONAL: + metavars = buildMetavar(1); + result = '[' + metavars[0] + ']'; + break; + case $$.ZERO_OR_MORE: + metavars = buildMetavar(2); + result = '[' + metavars[0] + ' [' + metavars[1] + ' ...]]'; + break; + case $$.ONE_OR_MORE: + metavars = buildMetavar(2); + result = '' + metavars[0] + ' [' + metavars[1] + ' ...]'; + break; + case $$.REMAINDER: + result = '...'; + break; + case $$.PARSER: + metavars = buildMetavar(1); + result = metavars[0] + ' ...'; + break; + default: + metavars = buildMetavar(action.nargs); + result = metavars.join(' '); + } + return result; +}; + +HelpFormatter.prototype._expandHelp = function (action) { + var params = { prog: this._prog }; + + Object.keys(action).forEach(function (actionProperty) { + var actionValue = action[actionProperty]; + + if (actionValue !== $$.SUPPRESS) { + params[actionProperty] = actionValue; + } + }); + + if (!!params.choices) { + if (_.isString(params.choices)) { + params.choices = params.choices.split('').join(', '); + } + else if (_.isArray(params.choices)) { + params.choices = params.choices.join(', '); + } + else { + params.choices = _.keys(params.choices).join(', '); + } + } + + return sprintf(this._getHelpString(action), params); +}; + +HelpFormatter.prototype._splitLines = function (text, width) { + var lines = []; + var delimiters = [" ", ".", ",", "!", "?"]; + var re = new RegExp('[' + delimiters.join('') + '][^' + delimiters.join('') + ']*$'); + + text = text.replace(/[\n\|\t]/g, ' '); + + text = _.trim(text); + text = text.replace(this._whitespaceMatcher, ' '); + + // Wraps the single paragraph in text (a string) so every line + // is at most width characters long. + text.split($$.EOL).forEach(function (line) { + if (width >= line.length) { + lines.push(line); + return; + } + + var wrapStart = 0; + var wrapEnd = width; + var delimiterIndex = 0; + while (wrapEnd <= line.length) { + if (wrapEnd !== line.length && delimiters.indexOf(line[wrapEnd] < -1)) { + delimiterIndex = (re.exec(line.substring(wrapStart, wrapEnd)) || {}).index; + wrapEnd = wrapStart + delimiterIndex + 1; + } + lines.push(line.substring(wrapStart, wrapEnd)); + wrapStart = wrapEnd; + wrapEnd += width; + } + if (wrapStart < line.length) { + lines.push(line.substring(wrapStart, wrapEnd)); + } + }); + + return lines; +}; + +HelpFormatter.prototype._fillText = function (text, width, indent) { + var lines = this._splitLines(text, width); + lines = lines.map(function (line) { + return indent + line; + }); + return lines.join($$.EOL); +}; + +HelpFormatter.prototype._getHelpString = function (action) { + return action.help; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/namespace.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/namespace.js new file mode 100644 index 00000000..2f1f8f4d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/lib/namespace.js @@ -0,0 +1,77 @@ +/** + * class Namespace + * + * Simple object for storing attributes. Implements equality by attribute names + * and values, and provides a simple string representation. + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#the-namespace-object + **/ +'use strict'; + +var _ = require('lodash'); + +/** + * new Namespace(options) + * - options(object): predefined propertis for result object + * + **/ +var Namespace = module.exports = function Namespace(options) { + _.extend(this, options); +}; + +/** + * Namespace#isset(key) -> Boolean + * - key (string|number): property name + * + * Tells whenever `namespace` contains given `key` or not. + **/ +Namespace.prototype.isset = function (key) { + return _.has(this, key); +}; + +/** + * Namespace#set(key, value) -> self + * -key (string|number|object): propery name + * -value (mixed): new property value + * + * Set the property named key with value. + * If key object then set all key properties to namespace object + **/ +Namespace.prototype.set = function (key, value) { + if (typeof (key) === 'object') { + _.extend(this, key); + } else { + this[key] = value; + } + return this; +}; + +/** + * Namespace#get(key, defaultValue) -> mixed + * - key (string|number): property name + * - defaultValue (mixed): default value + * + * Return the property key or defaulValue if not set + **/ +Namespace.prototype.get = function (key, defaultValue) { + return !this[key] ? defaultValue: this[key]; +}; + +/** + * Namespace#unset(key, defaultValue) -> mixed + * - key (string|number): property name + * - defaultValue (mixed): default value + * + * Return data[key](and delete it) or defaultValue + **/ +Namespace.prototype.unset = function (key, defaultValue) { + var value = this[key]; + if (value !== null) { + delete this[key]; + return value; + } else { + return defaultValue; + } +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/LICENSE.txt b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/LICENSE.txt new file mode 100644 index 00000000..9cd87e5d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +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/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/README.md b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/README.md new file mode 100644 index 00000000..701a14b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/README.md @@ -0,0 +1,119 @@ +# lodash v3.8.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules. + +Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli): +```bash +$ lodash modularize modern exports=node -o ./ +$ lodash modern -d -o ./index.js +``` + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash +``` + +In Node.js/io.js: + +```js +// load the modern build +var _ = require('lodash'); +// or a method category +var array = require('lodash/array'); +// or a method (great for smaller builds with browserify/webpack) +var chunk = require('lodash/array/chunk'); +``` + +See the [package source](https://github.com/lodash/lodash/tree/3.8.0-npm) for more details. + +**Note:**
+Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.
+Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default. + +## Module formats + +lodash is also available in a variety of other builds & module formats. + + * npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds + * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.8.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.8.0-amd) builds + * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.8.0-es) build + +## Further Reading + + * [API Documentation](https://lodash.com/docs) + * [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences) + * [Changelog](https://github.com/lodash/lodash/wiki/Changelog) + * [Release Notes](https://github.com/lodash/lodash/releases) + * [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap) + * [More Resources](https://github.com/lodash/lodash/wiki/Resources) + +## Features + + * ~100% [code coverage](https://coveralls.io/r/lodash) + * Follows [semantic versioning](http://semver.org/) for releases + * [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining + * [_(…)](https://lodash.com/docs#_) supports intuitive chaining + * [_.add](https://lodash.com/docs#add) for mathematical composition + * [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order + * [_.at](https://lodash.com/docs#at) for cherry-picking collection values + * [_.attempt](https://lodash.com/docs#attempt) to execute functions which may error without a try-catch + * [_.before](https://lodash.com/docs#before) to complement [_.after](https://lodash.com/docs#after) + * [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods + * [_.chunk](https://lodash.com/docs#chunk) for splitting an array into chunks of a given size + * [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects + * [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects + * [_.curry](https://lodash.com/docs#curry) & [_.curryRight](https://lodash.com/docs#curryRight) for creating [curried](http://hughfdjackson.com/javascript/why-curry-helps/) functions + * [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control + * [_.fill](https://lodash.com/docs#fill) to fill arrays with values + * [_.findKey](https://lodash.com/docs#findKey) for finding keys + * [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#flowRight) (a.k.a `_.compose`) + * [_.forEach](https://lodash.com/docs#forEach) supports exiting early + * [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties + * [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties + * [_.get](https://lodash.com/docs#get) & [_.set](https://lodash.com/docs#set) for deep property getting & setting + * [_.inRange](https://lodash.com/docs#inRange) for checking whether a number is within a given range + * [_.isNative](https://lodash.com/docs#isNative) to check for native functions + * [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects + * [_.isTypedArray](https://lodash.com/docs#isTypedArray) to check for typed arrays + * [_.mapKeys](https://lodash.com/docs#mapKeys) for mapping keys to an object + * [_.matches](https://lodash.com/docs#matches) supports deep object comparisons + * [_.matchesProperty](https://lodash.com/docs#matchesProperty) to complement [_.matches](https://lodash.com/docs#matches) & [_.property](https://lodash.com/docs#property) + * [_.method](https://lodash.com/docs#method) & [_.methodOf](https://lodash.com/docs#methodOf) to create functions that invoke methods + * [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend) + * [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior + * [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays + * [_.random](https://lodash.com/docs#random) supports returning floating-point numbers + * [_.restParam](https://lodash.com/docs#restParam) & [_.spread](https://lodash.com/docs#spread) for applying rest parameters & spreading arguments to functions + * [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking + * [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values + * [_.sortByAll](https://lodash.com/docs#sortByAll) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders + * [_.sum](https://lodash.com/docs#sum) to get the sum of values + * [_.support](https://lodash.com/docs#support) for flagging environment features + * [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) + * [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects + * [_.unzipWith](https://lodash.com/docs#unzipWith) & [_.zipWith](https://lodash.com/docs#zipWith) to specify how grouped values should be combined + * [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union) + * [_.valuesIn](https://lodash.com/docs#valuesIn) for getting values of all enumerable properties + * [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), & + [more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders + * [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), & + [more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods + * [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), & + [more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept customizer callbacks + * [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), & + [more](https://lodash.com/docs "_.drop, _.dropRight, _.dropRightWhile, _.take, _.takeRight, _.takeRightWhile") to complement [_.first](https://lodash.com/docs#first), [_.initial](https://lodash.com/docs#initial), [_.last](https://lodash.com/docs#last), & [_.rest](https://lodash.com/docs#rest) + * [_.findLast](https://lodash.com/docs#findLast), [_.findLastKey](https://lodash.com/docs#findLastKey), & + [more](https://lodash.com/docs "_.curryRight, _.dropRight, _.dropRightWhile, _.flowRight, _.forEachRight, _.forInRight, _.forOwnRight, _.padRight, partialRight, _.takeRight, _.trimRight, _.takeRightWhile") right-associative methods + * [_.includes](https://lodash.com/docs#includes), [_.toArray](https://lodash.com/docs#toArray), & + [more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.findWhere, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.sortByAll, _.sortByOrder, _.sum, _.where") accept strings + * [_#commit](https://lodash.com/docs#prototype-commit) & [_#plant](https://lodash.com/docs#prototype-plant) for working with chain sequences + * [_#thru](https://lodash.com/docs#thru) to pass values thru a chain sequence + +## Support + +Tested in Chrome 41-42, Firefox 36-37, IE 6-11, MS Edge, Opera 27-28, Safari 5-8, io.js 1.8.1, Node.js 0.8.28, 0.10.38, & 0.12.2, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. +Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing. diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array.js new file mode 100644 index 00000000..e5121fa5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array.js @@ -0,0 +1,44 @@ +module.exports = { + 'chunk': require('./array/chunk'), + 'compact': require('./array/compact'), + 'difference': require('./array/difference'), + 'drop': require('./array/drop'), + 'dropRight': require('./array/dropRight'), + 'dropRightWhile': require('./array/dropRightWhile'), + 'dropWhile': require('./array/dropWhile'), + 'fill': require('./array/fill'), + 'findIndex': require('./array/findIndex'), + 'findLastIndex': require('./array/findLastIndex'), + 'first': require('./array/first'), + 'flatten': require('./array/flatten'), + 'flattenDeep': require('./array/flattenDeep'), + 'head': require('./array/head'), + 'indexOf': require('./array/indexOf'), + 'initial': require('./array/initial'), + 'intersection': require('./array/intersection'), + 'last': require('./array/last'), + 'lastIndexOf': require('./array/lastIndexOf'), + 'object': require('./array/object'), + 'pull': require('./array/pull'), + 'pullAt': require('./array/pullAt'), + 'remove': require('./array/remove'), + 'rest': require('./array/rest'), + 'slice': require('./array/slice'), + 'sortedIndex': require('./array/sortedIndex'), + 'sortedLastIndex': require('./array/sortedLastIndex'), + 'tail': require('./array/tail'), + 'take': require('./array/take'), + 'takeRight': require('./array/takeRight'), + 'takeRightWhile': require('./array/takeRightWhile'), + 'takeWhile': require('./array/takeWhile'), + 'union': require('./array/union'), + 'uniq': require('./array/uniq'), + 'unique': require('./array/unique'), + 'unzip': require('./array/unzip'), + 'unzipWith': require('./array/unzipWith'), + 'without': require('./array/without'), + 'xor': require('./array/xor'), + 'zip': require('./array/zip'), + 'zipObject': require('./array/zipObject'), + 'zipWith': require('./array/zipWith') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/chunk.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/chunk.js new file mode 100644 index 00000000..4de9b396 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/chunk.js @@ -0,0 +1,47 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** Native method references. */ +var ceil = Math.ceil; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Creates an array of elements split into groups the length of `size`. + * If `collection` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new array containing chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ +function chunk(array, size, guard) { + if (guard ? isIterateeCall(array, size, guard) : size == null) { + size = 1; + } else { + size = nativeMax(+size || 1, 1); + } + var index = 0, + length = array ? array.length : 0, + resIndex = -1, + result = Array(ceil(length / size)); + + while (index < length) { + result[++resIndex] = baseSlice(array, index, (index += size)); + } + return result; +} + +module.exports = chunk; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/compact.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/compact.js new file mode 100644 index 00000000..1dc1c55e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/compact.js @@ -0,0 +1,30 @@ +/** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ +function compact(array) { + var index = -1, + length = array ? array.length : 0, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[++resIndex] = value; + } + } + return result; +} + +module.exports = compact; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/difference.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/difference.js new file mode 100644 index 00000000..22a5cf89 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/difference.js @@ -0,0 +1,28 @@ +var baseDifference = require('../internal/baseDifference'), + baseFlatten = require('../internal/baseFlatten'), + isArrayLike = require('../internal/isArrayLike'), + restParam = require('../function/restParam'); + +/** + * Creates an array excluding all values of the provided arrays using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The arrays of values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.difference([1, 2, 3], [4, 2]); + * // => [1, 3] + */ +var difference = restParam(function(array, values) { + return isArrayLike(array) + ? baseDifference(array, baseFlatten(values, false, true)) + : []; +}); + +module.exports = difference; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/drop.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/drop.js new file mode 100644 index 00000000..039a0b5f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/drop.js @@ -0,0 +1,39 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ +function drop(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, n < 0 ? 0 : n); +} + +module.exports = drop; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/dropRight.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/dropRight.js new file mode 100644 index 00000000..14b5eb6f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/dropRight.js @@ -0,0 +1,40 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ +function dropRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, 0, n < 0 ? 0 : n); +} + +module.exports = dropRight; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/dropRightWhile.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/dropRightWhile.js new file mode 100644 index 00000000..be158bd5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/dropRightWhile.js @@ -0,0 +1,59 @@ +var baseCallback = require('../internal/baseCallback'), + baseWhile = require('../internal/baseWhile'); + +/** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that match the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [1] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active', false), 'user'); + * // => ['barney'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ +function dropRightWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, baseCallback(predicate, thisArg, 3), true, true) + : []; +} + +module.exports = dropRightWhile; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/dropWhile.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/dropWhile.js new file mode 100644 index 00000000..d9eabae9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/dropWhile.js @@ -0,0 +1,59 @@ +var baseCallback = require('../internal/baseCallback'), + baseWhile = require('../internal/baseWhile'); + +/** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [3] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropWhile(users, 'active', false), 'user'); + * // => ['pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ +function dropWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, baseCallback(predicate, thisArg, 3), true) + : []; +} + +module.exports = dropWhile; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/fill.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/fill.js new file mode 100644 index 00000000..2c8f6da7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/fill.js @@ -0,0 +1,44 @@ +var baseFill = require('../internal/baseFill'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8], '*', 1, 2); + * // => [4, '*', 8] + */ +function fill(array, value, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); +} + +module.exports = fill; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/findIndex.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/findIndex.js new file mode 100644 index 00000000..2a6b8e14 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/findIndex.js @@ -0,0 +1,53 @@ +var createFindIndex = require('../internal/createFindIndex'); + +/** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(chr) { + * return chr.user == 'barney'; + * }); + * // => 0 + * + * // using the `_.matches` callback shorthand + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // using the `_.matchesProperty` callback shorthand + * _.findIndex(users, 'active', false); + * // => 0 + * + * // using the `_.property` callback shorthand + * _.findIndex(users, 'active'); + * // => 2 + */ +var findIndex = createFindIndex(); + +module.exports = findIndex; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/findLastIndex.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/findLastIndex.js new file mode 100644 index 00000000..d6d8eca6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/findLastIndex.js @@ -0,0 +1,53 @@ +var createFindIndex = require('../internal/createFindIndex'); + +/** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(chr) { + * return chr.user == 'pebbles'; + * }); + * // => 2 + * + * // using the `_.matches` callback shorthand + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // using the `_.matchesProperty` callback shorthand + * _.findLastIndex(users, 'active', false); + * // => 2 + * + * // using the `_.property` callback shorthand + * _.findLastIndex(users, 'active'); + * // => 0 + */ +var findLastIndex = createFindIndex(true); + +module.exports = findLastIndex; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/first.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/first.js new file mode 100644 index 00000000..b3b9c79c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/first.js @@ -0,0 +1,22 @@ +/** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @alias head + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.first([1, 2, 3]); + * // => 1 + * + * _.first([]); + * // => undefined + */ +function first(array) { + return array ? array[0] : undefined; +} + +module.exports = first; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flatten.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flatten.js new file mode 100644 index 00000000..65bbeefb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flatten.js @@ -0,0 +1,32 @@ +var baseFlatten = require('../internal/baseFlatten'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Flattens a nested array. If `isDeep` is `true` the array is recursively + * flattened, otherwise it is only flattened a single level. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to flatten. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, 3, [4]]]); + * // => [1, 2, 3, [4]] + * + * // using `isDeep` + * _.flatten([1, [2, 3, [4]]], true); + * // => [1, 2, 3, 4] + */ +function flatten(array, isDeep, guard) { + var length = array ? array.length : 0; + if (guard && isIterateeCall(array, isDeep, guard)) { + isDeep = false; + } + return length ? baseFlatten(array, isDeep) : []; +} + +module.exports = flatten; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flattenDeep.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flattenDeep.js new file mode 100644 index 00000000..9f775feb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flattenDeep.js @@ -0,0 +1,21 @@ +var baseFlatten = require('../internal/baseFlatten'); + +/** + * Recursively flattens a nested array. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to recursively flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, 3, [4]]]); + * // => [1, 2, 3, 4] + */ +function flattenDeep(array) { + var length = array ? array.length : 0; + return length ? baseFlatten(array, true) : []; +} + +module.exports = flattenDeep; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/head.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/head.js new file mode 100644 index 00000000..1961b08c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/head.js @@ -0,0 +1 @@ +module.exports = require('./first'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/indexOf.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/indexOf.js new file mode 100644 index 00000000..f8f6c9fc --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/indexOf.js @@ -0,0 +1,54 @@ +var baseIndexOf = require('../internal/baseIndexOf'), + binaryIndex = require('../internal/binaryIndex'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` + * performs a faster binary search. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + * + * // performing a binary search + * _.indexOf([1, 1, 2, 2], 2, true); + * // => 2 + */ +function indexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + if (typeof fromIndex == 'number') { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; + } else if (fromIndex) { + var index = binaryIndex(array, value), + other = array[index]; + + if (value === value ? (value === other) : (other !== other)) { + return index; + } + return -1; + } + return baseIndexOf(array, value, fromIndex || 0); +} + +module.exports = indexOf; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/initial.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/initial.js new file mode 100644 index 00000000..59b7a7d9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/initial.js @@ -0,0 +1,20 @@ +var dropRight = require('./dropRight'); + +/** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ +function initial(array) { + return dropRight(array, 1); +} + +module.exports = initial; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/intersection.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/intersection.js new file mode 100644 index 00000000..13af23eb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/intersection.js @@ -0,0 +1,65 @@ +var baseIndexOf = require('../internal/baseIndexOf'), + cacheIndexOf = require('../internal/cacheIndexOf'), + createCache = require('../internal/createCache'), + isArrayLike = require('../internal/isArrayLike'); + +/** + * Creates an array of unique values in all provided arrays using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of shared values. + * @example + * _.intersection([1, 2], [4, 2], [2, 1]); + * // => [2] + */ +function intersection() { + var args = [], + argsIndex = -1, + argsLength = arguments.length, + caches = [], + indexOf = baseIndexOf, + isCommon = true, + result = []; + + while (++argsIndex < argsLength) { + var value = arguments[argsIndex]; + if (isArrayLike(value)) { + args.push(value); + caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); + } + } + argsLength = args.length; + if (argsLength < 2) { + return result; + } + var array = args[0], + index = -1, + length = array ? array.length : 0, + seen = caches[0]; + + outer: + while (++index < length) { + value = array[index]; + if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { + argsIndex = argsLength; + while (--argsIndex) { + var cache = caches[argsIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) { + continue outer; + } + } + if (seen) { + seen.push(value); + } + result.push(value); + } + } + return result; +} + +module.exports = intersection; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/last.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/last.js new file mode 100644 index 00000000..299af314 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/last.js @@ -0,0 +1,19 @@ +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; +} + +module.exports = last; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/lastIndexOf.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/lastIndexOf.js new file mode 100644 index 00000000..02b80626 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/lastIndexOf.js @@ -0,0 +1,60 @@ +var binaryIndex = require('../internal/binaryIndex'), + indexOfNaN = require('../internal/indexOfNaN'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=array.length-1] The index to search from + * or `true` to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // using `fromIndex` + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + * + * // performing a binary search + * _.lastIndexOf([1, 1, 2, 2], 2, true); + * // => 3 + */ +function lastIndexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = length; + if (typeof fromIndex == 'number') { + index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; + } else if (fromIndex) { + index = binaryIndex(array, value, true) - 1; + var other = array[index]; + if (value === value ? (value === other) : (other !== other)) { + return index; + } + return -1; + } + if (value !== value) { + return indexOfNaN(array, index, true); + } + while (index--) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +module.exports = lastIndexOf; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/object.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/object.js new file mode 100644 index 00000000..f4a34531 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/object.js @@ -0,0 +1 @@ +module.exports = require('./zipObject'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pull.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pull.js new file mode 100644 index 00000000..746f196f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pull.js @@ -0,0 +1,52 @@ +var baseIndexOf = require('../internal/baseIndexOf'); + +/** Used for native method references. */ +var arrayProto = Array.prototype; + +/** Native method references. */ +var splice = arrayProto.splice; + +/** + * Removes all provided values from `array` using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +function pull() { + var args = arguments, + array = args[0]; + + if (!(array && array.length)) { + return array; + } + var index = 0, + indexOf = baseIndexOf, + length = args.length; + + while (++index < length) { + var fromIndex = 0, + value = args[index]; + + while ((fromIndex = indexOf(array, value, fromIndex)) > -1) { + splice.call(array, fromIndex, 1); + } + } + return array; +} + +module.exports = pull; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pullAt.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pullAt.js new file mode 100644 index 00000000..4ca2476f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pullAt.js @@ -0,0 +1,40 @@ +var baseAt = require('../internal/baseAt'), + baseCompareAscending = require('../internal/baseCompareAscending'), + baseFlatten = require('../internal/baseFlatten'), + basePullAt = require('../internal/basePullAt'), + restParam = require('../function/restParam'); + +/** + * Removes elements from `array` corresponding to the given indexes and returns + * an array of the removed elements. Indexes may be specified as an array of + * indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove, + * specified as individual indexes or arrays of indexes. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [5, 10, 15, 20]; + * var evens = _.pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +var pullAt = restParam(function(array, indexes) { + indexes = baseFlatten(indexes); + + var result = baseAt(array, indexes); + basePullAt(array, indexes.sort(baseCompareAscending)); + return result; +}); + +module.exports = pullAt; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/remove.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/remove.js new file mode 100644 index 00000000..0cf979bd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/remove.js @@ -0,0 +1,64 @@ +var baseCallback = require('../internal/baseCallback'), + basePullAt = require('../internal/basePullAt'); + +/** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is bound to + * `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * **Note:** Unlike `_.filter`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; + * }); + * + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] + */ +function remove(array, predicate, thisArg) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; + + predicate = baseCallback(predicate, thisArg, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; +} + +module.exports = remove; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/rest.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/rest.js new file mode 100644 index 00000000..9bfb734f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/rest.js @@ -0,0 +1,21 @@ +var drop = require('./drop'); + +/** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @alias tail + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.rest([1, 2, 3]); + * // => [2, 3] + */ +function rest(array) { + return drop(array, 1); +} + +module.exports = rest; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/slice.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/slice.js new file mode 100644 index 00000000..48ef1a1a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/slice.js @@ -0,0 +1,30 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of `Array#slice` to support node + * lists in IE < 9 and to ensure dense arrays are returned. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function slice(array, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + return baseSlice(array, start, end); +} + +module.exports = slice; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedIndex.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedIndex.js new file mode 100644 index 00000000..51d150e3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedIndex.js @@ -0,0 +1,53 @@ +var createSortedIndex = require('../internal/createSortedIndex'); + +/** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. If an iteratee + * function is provided it is invoked for `value` and each element of `array` + * to compute their sort ranking. The iteratee is bound to `thisArg` and + * invoked with one argument; (value). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 4, 5, 5], 5); + * // => 2 + * + * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } }; + * + * // using an iteratee function + * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) { + * return this.data[word]; + * }, dict); + * // => 1 + * + * // using the `_.property` callback shorthand + * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); + * // => 1 + */ +var sortedIndex = createSortedIndex(); + +module.exports = sortedIndex; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js new file mode 100644 index 00000000..81a4a868 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js @@ -0,0 +1,25 @@ +var createSortedIndex = require('../internal/createSortedIndex'); + +/** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 4, 5, 5], 5); + * // => 4 + */ +var sortedLastIndex = createSortedIndex(true); + +module.exports = sortedLastIndex; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/tail.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/tail.js new file mode 100644 index 00000000..c5dfe779 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/tail.js @@ -0,0 +1 @@ +module.exports = require('./rest'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/take.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/take.js new file mode 100644 index 00000000..875917a7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/take.js @@ -0,0 +1,39 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.take([1, 2, 3]); + * // => [1] + * + * _.take([1, 2, 3], 2); + * // => [1, 2] + * + * _.take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.take([1, 2, 3], 0); + * // => [] + */ +function take(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, 0, n < 0 ? 0 : n); +} + +module.exports = take; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/takeRight.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/takeRight.js new file mode 100644 index 00000000..6e89c874 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/takeRight.js @@ -0,0 +1,40 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRight([1, 2, 3]); + * // => [3] + * + * _.takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * _.takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.takeRight([1, 2, 3], 0); + * // => [] + */ +function takeRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, n < 0 ? 0 : n); +} + +module.exports = takeRight; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/takeRightWhile.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/takeRightWhile.js new file mode 100644 index 00000000..5464d13b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/takeRightWhile.js @@ -0,0 +1,59 @@ +var baseCallback = require('../internal/baseCallback'), + baseWhile = require('../internal/baseWhile'); + +/** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is bound to `thisArg` + * and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [2, 3] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active', false), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active'), 'user'); + * // => [] + */ +function takeRightWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, baseCallback(predicate, thisArg, 3), false, true) + : []; +} + +module.exports = takeRightWhile; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/takeWhile.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/takeWhile.js new file mode 100644 index 00000000..f7e28a1d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/takeWhile.js @@ -0,0 +1,59 @@ +var baseCallback = require('../internal/baseCallback'), + baseWhile = require('../internal/baseWhile'); + +/** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is bound to + * `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [1, 2] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false}, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeWhile(users, 'active', false), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeWhile(users, 'active'), 'user'); + * // => [] + */ +function takeWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, baseCallback(predicate, thisArg, 3)) + : []; +} + +module.exports = takeWhile; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/union.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/union.js new file mode 100644 index 00000000..ee71b278 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/union.js @@ -0,0 +1,24 @@ +var baseFlatten = require('../internal/baseFlatten'), + baseUniq = require('../internal/baseUniq'), + restParam = require('../function/restParam'); + +/** + * Creates an array of unique values, in order, of the provided arrays using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([1, 2], [4, 2], [2, 1]); + * // => [1, 2, 4] + */ +var union = restParam(function(arrays) { + return baseUniq(baseFlatten(arrays, false, true)); +}); + +module.exports = union; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/uniq.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/uniq.js new file mode 100644 index 00000000..91ae46e2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/uniq.js @@ -0,0 +1,71 @@ +var baseCallback = require('../internal/baseCallback'), + baseUniq = require('../internal/baseUniq'), + isIterateeCall = require('../internal/isIterateeCall'), + sortedUniq = require('../internal/sortedUniq'); + +/** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons, in which only the first occurence of each element + * is kept. Providing `true` for `isSorted` performs a faster search algorithm + * for sorted arrays. If an iteratee function is provided it is invoked for + * each element in the array to generate the criterion by which uniqueness + * is computed. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index, array). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias unique + * @category Array + * @param {Array} array The array to inspect. + * @param {boolean} [isSorted] Specify the array is sorted. + * @param {Function|Object|string} [iteratee] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new duplicate-value-free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + * + * // using `isSorted` + * _.uniq([1, 1, 2], true); + * // => [1, 2] + * + * // using an iteratee function + * _.uniq([1, 2.5, 1.5, 2], function(n) { + * return this.floor(n); + * }, Math); + * // => [1, 2.5] + * + * // using the `_.property` callback shorthand + * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ +function uniq(array, isSorted, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (isSorted != null && typeof isSorted != 'boolean') { + thisArg = iteratee; + iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; + isSorted = false; + } + iteratee = iteratee == null ? iteratee : baseCallback(iteratee, thisArg, 3); + return (isSorted) + ? sortedUniq(array, iteratee) + : baseUniq(array, iteratee); +} + +module.exports = uniq; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/unique.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/unique.js new file mode 100644 index 00000000..396de1b8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/unique.js @@ -0,0 +1 @@ +module.exports = require('./uniq'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/unzip.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/unzip.js new file mode 100644 index 00000000..0a539fa6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/unzip.js @@ -0,0 +1,47 @@ +var arrayFilter = require('../internal/arrayFilter'), + arrayMap = require('../internal/arrayMap'), + baseProperty = require('../internal/baseProperty'), + isArrayLike = require('../internal/isArrayLike'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-zip + * configuration. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + * + * _.unzip(zipped); + * // => [['fred', 'barney'], [30, 40], [true, false]] + */ +function unzip(array) { + if (!(array && array.length)) { + return []; + } + var index = -1, + length = 0; + + array = arrayFilter(array, function(group) { + if (isArrayLike(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + var result = Array(length); + while (++index < length) { + result[index] = arrayMap(array, baseProperty(index)); + } + return result; +} + +module.exports = unzip; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/unzipWith.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/unzipWith.js new file mode 100644 index 00000000..324a2b1d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/unzipWith.js @@ -0,0 +1,41 @@ +var arrayMap = require('../internal/arrayMap'), + arrayReduce = require('../internal/arrayReduce'), + bindCallback = require('../internal/bindCallback'), + unzip = require('./unzip'); + +/** + * This method is like `_.unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee] The function to combine regrouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ +function unzipWith(array, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + iteratee = bindCallback(iteratee, thisArg, 4); + return arrayMap(result, function(group) { + return arrayReduce(group, iteratee, undefined, true); + }); +} + +module.exports = unzipWith; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/without.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/without.js new file mode 100644 index 00000000..19b78491 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/without.js @@ -0,0 +1,27 @@ +var baseDifference = require('../internal/baseDifference'), + isArrayLike = require('../internal/isArrayLike'), + restParam = require('../function/restParam'); + +/** + * Creates an array excluding all provided values using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to filter. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.without([1, 2, 1, 3], 1, 2); + * // => [3] + */ +var without = restParam(function(array, values) { + return isArrayLike(array) + ? baseDifference(array, values) + : []; +}); + +module.exports = without; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/xor.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/xor.js new file mode 100644 index 00000000..315b9f8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/xor.js @@ -0,0 +1,34 @@ +var baseDifference = require('../internal/baseDifference'), + baseUniq = require('../internal/baseUniq'), + isArrayLike = require('../internal/isArrayLike'); + +/** + * Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the provided arrays. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of values. + * @example + * + * _.xor([1, 2], [4, 2]); + * // => [1, 4] + */ +function xor() { + var index = -1, + length = arguments.length; + + while (++index < length) { + var array = arguments[index]; + if (isArrayLike(array)) { + var result = result + ? baseDifference(result, array).concat(baseDifference(array, result)) + : array; + } + } + return result ? baseUniq(result) : []; +} + +module.exports = xor; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/zip.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/zip.js new file mode 100644 index 00000000..53a6f699 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/zip.js @@ -0,0 +1,21 @@ +var restParam = require('../function/restParam'), + unzip = require('./unzip'); + +/** + * Creates an array of grouped elements, the first of which contains the first + * elements of the given arrays, the second of which contains the second elements + * of the given arrays, and so on. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + */ +var zip = restParam(unzip); + +module.exports = zip; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/zipObject.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/zipObject.js new file mode 100644 index 00000000..dec7a211 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/zipObject.js @@ -0,0 +1,43 @@ +var isArray = require('../lang/isArray'); + +/** + * The inverse of `_.pairs`; this method returns an object composed from arrays + * of property names and values. Provide either a single two dimensional array, + * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names + * and one of corresponding values. + * + * @static + * @memberOf _ + * @alias object + * @category Array + * @param {Array} props The property names. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + * + * _.zipObject(['fred', 'barney'], [30, 40]); + * // => { 'fred': 30, 'barney': 40 } + */ +function zipObject(props, values) { + var index = -1, + length = props ? props.length : 0, + result = {}; + + if (length && !values && !isArray(props[0])) { + values = []; + } + while (++index < length) { + var key = props[index]; + if (values) { + result[key] = values[index]; + } else if (key) { + result[key[0]] = key[1]; + } + } + return result; +} + +module.exports = zipObject; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/zipWith.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/zipWith.js new file mode 100644 index 00000000..7a268df5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/zipWith.js @@ -0,0 +1,36 @@ +var restParam = require('../function/restParam'), + unzipWith = require('./unzipWith'); + +/** + * This method is like `_.zip` except that it accepts an iteratee to specify + * how grouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], _.add); + * // => [111, 222] + */ +var zipWith = restParam(function(arrays) { + var length = arrays.length, + iteratee = arrays[length - 2], + thisArg = arrays[length - 1]; + + if (length > 2 && typeof iteratee == 'function') { + length -= 2; + } else { + iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined; + thisArg = undefined; + } + arrays.length = length; + return unzipWith(arrays, iteratee, thisArg); +}); + +module.exports = zipWith; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain.js new file mode 100644 index 00000000..7992b733 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain.js @@ -0,0 +1,15 @@ +module.exports = { + 'chain': require('./chain/chain'), + 'commit': require('./chain/commit'), + 'lodash': require('./chain/lodash'), + 'plant': require('./chain/plant'), + 'reverse': require('./chain/reverse'), + 'run': require('./chain/run'), + 'tap': require('./chain/tap'), + 'thru': require('./chain/thru'), + 'toJSON': require('./chain/toJSON'), + 'toString': require('./chain/toString'), + 'value': require('./chain/value'), + 'valueOf': require('./chain/valueOf'), + 'wrapperChain': require('./chain/wrapperChain') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/chain.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/chain.js new file mode 100644 index 00000000..453ba1eb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/chain.js @@ -0,0 +1,35 @@ +var lodash = require('./lodash'); + +/** + * Creates a `lodash` object that wraps `value` with explicit method + * chaining enabled. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _.chain(users) + * .sortBy('age') + * .map(function(chr) { + * return chr.user + ' is ' + chr.age; + * }) + * .first() + * .value(); + * // => 'pebbles is 1' + */ +function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; +} + +module.exports = chain; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/commit.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/commit.js new file mode 100644 index 00000000..c732d1bf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/commit.js @@ -0,0 +1 @@ +module.exports = require('./wrapperCommit'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/lodash.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/lodash.js new file mode 100644 index 00000000..7ca104c4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/lodash.js @@ -0,0 +1,122 @@ +var LazyWrapper = require('../internal/LazyWrapper'), + LodashWrapper = require('../internal/LodashWrapper'), + baseLodash = require('../internal/baseLodash'), + isArray = require('../lang/isArray'), + isObjectLike = require('../internal/isObjectLike'), + wrapperClone = require('../internal/wrapperClone'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates a `lodash` object which wraps `value` to enable implicit chaining. + * Methods that operate on and return arrays, collections, and functions can + * be chained together. Methods that return a boolean or single value will + * automatically end the chain returning the unwrapped value. Explicit chaining + * may be enabled using `_.chain`. The execution of chained methods is lazy, + * that is, execution is deferred until `_#value` is implicitly or explicitly + * called. + * + * Lazy evaluation allows several methods to support shortcut fusion. Shortcut + * fusion is an optimization that merges iteratees to avoid creating intermediate + * arrays and reduce the number of iteratee executions. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, + * `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, + * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, + * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, + * and `where` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`, + * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`, + * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, + * `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, + * `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`, + * `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, + * `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, + * `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, + * `merge`, `mixin`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, + * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`, + * `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, + * `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, + * `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, `transform`, + * `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`, + * `without`, `wrap`, `xor`, `zip`, and `zipObject` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`, + * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, + * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`, + * `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`, + * `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite` + * `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, + * `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, + * `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, `noConflict`, + * `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, + * `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, `startsWith`, + * `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`, + * `uniqueId`, `value`, and `words` + * + * The wrapper method `sample` will return a wrapped value when `n` is provided, + * otherwise an unwrapped value is returned. + * + * @name _ + * @constructor + * @category Chain + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var wrapped = _([1, 2, 3]); + * + * // returns an unwrapped value + * wrapped.reduce(function(total, n) { + * return total + n; + * }); + * // => 6 + * + * // returns a wrapped value + * var squares = wrapped.map(function(n) { + * return n * n; + * }); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ +function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); +} + +// Ensure wrappers are instances of `baseLodash`. +lodash.prototype = baseLodash.prototype; + +module.exports = lodash; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/plant.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/plant.js new file mode 100644 index 00000000..04099f23 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/plant.js @@ -0,0 +1 @@ +module.exports = require('./wrapperPlant'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/reverse.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/reverse.js new file mode 100644 index 00000000..f72a64a1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/reverse.js @@ -0,0 +1 @@ +module.exports = require('./wrapperReverse'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/run.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/run.js new file mode 100644 index 00000000..5e751a2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/run.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/tap.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/tap.js new file mode 100644 index 00000000..3d0257ec --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/tap.js @@ -0,0 +1,29 @@ +/** + * This method invokes `interceptor` and returns `value`. The interceptor is + * bound to `thisArg` and invoked with one argument; (value). The purpose of + * this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ +function tap(value, interceptor, thisArg) { + interceptor.call(thisArg, value); + return value; +} + +module.exports = tap; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/thru.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/thru.js new file mode 100644 index 00000000..a7157803 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/thru.js @@ -0,0 +1,26 @@ +/** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ +function thru(value, interceptor, thisArg) { + return interceptor.call(thisArg, value); +} + +module.exports = thru; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/toJSON.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/toJSON.js new file mode 100644 index 00000000..5e751a2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/toJSON.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/toString.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/toString.js new file mode 100644 index 00000000..c7bcbf9a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/toString.js @@ -0,0 +1 @@ +module.exports = require('./wrapperToString'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/value.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/value.js new file mode 100644 index 00000000..5e751a2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/value.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/valueOf.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/valueOf.js new file mode 100644 index 00000000..5e751a2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/valueOf.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperChain.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperChain.js new file mode 100644 index 00000000..38234819 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperChain.js @@ -0,0 +1,32 @@ +var chain = require('./chain'); + +/** + * Enables explicit method chaining on the wrapper object. + * + * @name chain + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // without explicit chaining + * _(users).first(); + * // => { 'user': 'barney', 'age': 36 } + * + * // with explicit chaining + * _(users).chain() + * .first() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ +function wrapperChain() { + return chain(this); +} + +module.exports = wrapperChain; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperCommit.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperCommit.js new file mode 100644 index 00000000..c46a787e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperCommit.js @@ -0,0 +1,32 @@ +var LodashWrapper = require('../internal/LodashWrapper'); + +/** + * Executes the chained sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapper = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapper = wrapper.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapper.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ +function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); +} + +module.exports = wrapperCommit; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperPlant.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperPlant.js new file mode 100644 index 00000000..a3de146b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperPlant.js @@ -0,0 +1,45 @@ +var baseLodash = require('../internal/baseLodash'), + wrapperClone = require('../internal/wrapperClone'); + +/** + * Creates a clone of the chained sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapper = _(array).map(function(value) { + * return Math.pow(value, 2); + * }); + * + * var other = [3, 4]; + * var otherWrapper = wrapper.plant(other); + * + * otherWrapper.value(); + * // => [9, 16] + * + * wrapper.value(); + * // => [1, 4] + */ +function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; +} + +module.exports = wrapperPlant; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperReverse.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperReverse.js new file mode 100644 index 00000000..4518b3ed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperReverse.js @@ -0,0 +1,38 @@ +var LazyWrapper = require('../internal/LazyWrapper'), + LodashWrapper = require('../internal/LodashWrapper'), + thru = require('./thru'); + +/** + * Reverses the wrapped array so the first element becomes the last, the + * second element becomes the second to last, and so on. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new reversed `lodash` wrapper instance. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ +function wrapperReverse() { + var value = this.__wrapped__; + if (value instanceof LazyWrapper) { + if (this.__actions__.length) { + value = new LazyWrapper(this); + } + return new LodashWrapper(value.reverse(), this.__chain__); + } + return this.thru(function(value) { + return value.reverse(); + }); +} + +module.exports = wrapperReverse; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperToString.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperToString.js new file mode 100644 index 00000000..db975a5a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperToString.js @@ -0,0 +1,17 @@ +/** + * Produces the result of coercing the unwrapped value to a string. + * + * @name toString + * @memberOf _ + * @category Chain + * @returns {string} Returns the coerced string value. + * @example + * + * _([1, 2, 3]).toString(); + * // => '1,2,3' + */ +function wrapperToString() { + return (this.value() + ''); +} + +module.exports = wrapperToString; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperValue.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperValue.js new file mode 100644 index 00000000..2734e41c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/chain/wrapperValue.js @@ -0,0 +1,20 @@ +var baseWrapperValue = require('../internal/baseWrapperValue'); + +/** + * Executes the chained sequence to extract the unwrapped value. + * + * @name value + * @memberOf _ + * @alias run, toJSON, valueOf + * @category Chain + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ +function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); +} + +module.exports = wrapperValue; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection.js new file mode 100644 index 00000000..03388571 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection.js @@ -0,0 +1,44 @@ +module.exports = { + 'all': require('./collection/all'), + 'any': require('./collection/any'), + 'at': require('./collection/at'), + 'collect': require('./collection/collect'), + 'contains': require('./collection/contains'), + 'countBy': require('./collection/countBy'), + 'detect': require('./collection/detect'), + 'each': require('./collection/each'), + 'eachRight': require('./collection/eachRight'), + 'every': require('./collection/every'), + 'filter': require('./collection/filter'), + 'find': require('./collection/find'), + 'findLast': require('./collection/findLast'), + 'findWhere': require('./collection/findWhere'), + 'foldl': require('./collection/foldl'), + 'foldr': require('./collection/foldr'), + 'forEach': require('./collection/forEach'), + 'forEachRight': require('./collection/forEachRight'), + 'groupBy': require('./collection/groupBy'), + 'include': require('./collection/include'), + 'includes': require('./collection/includes'), + 'indexBy': require('./collection/indexBy'), + 'inject': require('./collection/inject'), + 'invoke': require('./collection/invoke'), + 'map': require('./collection/map'), + 'max': require('./math/max'), + 'min': require('./math/min'), + 'partition': require('./collection/partition'), + 'pluck': require('./collection/pluck'), + 'reduce': require('./collection/reduce'), + 'reduceRight': require('./collection/reduceRight'), + 'reject': require('./collection/reject'), + 'sample': require('./collection/sample'), + 'select': require('./collection/select'), + 'shuffle': require('./collection/shuffle'), + 'size': require('./collection/size'), + 'some': require('./collection/some'), + 'sortBy': require('./collection/sortBy'), + 'sortByAll': require('./collection/sortByAll'), + 'sortByOrder': require('./collection/sortByOrder'), + 'sum': require('./math/sum'), + 'where': require('./collection/where') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/all.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/all.js new file mode 100644 index 00000000..d0839f77 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/all.js @@ -0,0 +1 @@ +module.exports = require('./every'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/any.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/any.js new file mode 100644 index 00000000..900ac25e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/any.js @@ -0,0 +1 @@ +module.exports = require('./some'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/at.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/at.js new file mode 100644 index 00000000..29236e57 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/at.js @@ -0,0 +1,29 @@ +var baseAt = require('../internal/baseAt'), + baseFlatten = require('../internal/baseFlatten'), + restParam = require('../function/restParam'); + +/** + * Creates an array of elements corresponding to the given keys, or indexes, + * of `collection`. Keys may be specified as individual arguments or as arrays + * of keys. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(number|number[]|string|string[])} [props] The property names + * or indexes of elements to pick, specified individually or in arrays. + * @returns {Array} Returns the new array of picked elements. + * @example + * + * _.at(['a', 'b', 'c'], [0, 2]); + * // => ['a', 'c'] + * + * _.at(['barney', 'fred', 'pebbles'], 0, 2); + * // => ['barney', 'pebbles'] + */ +var at = restParam(function(collection, props) { + return baseAt(collection, baseFlatten(props)); +}); + +module.exports = at; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/collect.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/collect.js new file mode 100644 index 00000000..0d1e1abf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/collect.js @@ -0,0 +1 @@ +module.exports = require('./map'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/contains.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/contains.js new file mode 100644 index 00000000..594722af --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/contains.js @@ -0,0 +1 @@ +module.exports = require('./includes'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/countBy.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/countBy.js new file mode 100644 index 00000000..e97dbb74 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/countBy.js @@ -0,0 +1,54 @@ +var createAggregator = require('../internal/createAggregator'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the number of times the key was returned by `iteratee`. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': 1, '6': 2 } + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': 1, '6': 2 } + * + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ +var countBy = createAggregator(function(result, value, key) { + hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); +}); + +module.exports = countBy; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/detect.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/detect.js new file mode 100644 index 00000000..2fb6303e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/detect.js @@ -0,0 +1 @@ +module.exports = require('./find'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/each.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/each.js new file mode 100644 index 00000000..8800f420 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/each.js @@ -0,0 +1 @@ +module.exports = require('./forEach'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/eachRight.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/eachRight.js new file mode 100644 index 00000000..3252b2ab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/eachRight.js @@ -0,0 +1 @@ +module.exports = require('./forEachRight'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/every.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/every.js new file mode 100644 index 00000000..a04d3db6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/every.js @@ -0,0 +1,66 @@ +var arrayEvery = require('../internal/arrayEvery'), + baseCallback = require('../internal/baseCallback'), + baseEvery = require('../internal/baseEvery'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * The predicate is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias all + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.every(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.every(users, 'active'); + * // => false + */ +function every(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = null; + } + if (typeof predicate != 'function' || thisArg !== undefined) { + predicate = baseCallback(predicate, thisArg, 3); + } + return func(collection, predicate); +} + +module.exports = every; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/filter.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/filter.js new file mode 100644 index 00000000..7620aa76 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/filter.js @@ -0,0 +1,61 @@ +var arrayFilter = require('../internal/arrayFilter'), + baseCallback = require('../internal/baseCallback'), + baseFilter = require('../internal/baseFilter'), + isArray = require('../lang/isArray'); + +/** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias select + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.filter([4, 5, 6], function(n) { + * return n % 2 == 0; + * }); + * // => [4, 6] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.filter(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.filter(users, 'active'), 'user'); + * // => ['barney'] + */ +function filter(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = baseCallback(predicate, thisArg, 3); + return func(collection, predicate); +} + +module.exports = filter; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/find.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/find.js new file mode 100644 index 00000000..7358cfe8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/find.js @@ -0,0 +1,56 @@ +var baseEach = require('../internal/baseEach'), + createFind = require('../internal/createFind'); + +/** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias detect + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.result(_.find(users, function(chr) { + * return chr.age < 40; + * }), 'user'); + * // => 'barney' + * + * // using the `_.matches` callback shorthand + * _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); + * // => 'pebbles' + * + * // using the `_.matchesProperty` callback shorthand + * _.result(_.find(users, 'active', false), 'user'); + * // => 'fred' + * + * // using the `_.property` callback shorthand + * _.result(_.find(users, 'active'), 'user'); + * // => 'barney' + */ +var find = createFind(baseEach); + +module.exports = find; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/findLast.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/findLast.js new file mode 100644 index 00000000..75dbadca --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/findLast.js @@ -0,0 +1,25 @@ +var baseEachRight = require('../internal/baseEachRight'), + createFind = require('../internal/createFind'); + +/** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ +var findLast = createFind(baseEachRight, true); + +module.exports = findLast; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/findWhere.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/findWhere.js new file mode 100644 index 00000000..2d620655 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/findWhere.js @@ -0,0 +1,37 @@ +var baseMatches = require('../internal/baseMatches'), + find = require('./find'); + +/** + * Performs a deep comparison between each element in `collection` and the + * source object, returning the first element that has equivalent property + * values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user'); + * // => 'barney' + * + * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user'); + * // => 'fred' + */ +function findWhere(collection, source) { + return find(collection, baseMatches(source)); +} + +module.exports = findWhere; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/foldl.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/foldl.js new file mode 100644 index 00000000..26f53cf7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/foldl.js @@ -0,0 +1 @@ +module.exports = require('./reduce'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/foldr.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/foldr.js new file mode 100644 index 00000000..8fb199ed --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/foldr.js @@ -0,0 +1 @@ +module.exports = require('./reduceRight'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/forEach.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/forEach.js new file mode 100644 index 00000000..05a8e214 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/forEach.js @@ -0,0 +1,37 @@ +var arrayEach = require('../internal/arrayEach'), + baseEach = require('../internal/baseEach'), + createForEach = require('../internal/createForEach'); + +/** + * Iterates over elements of `collection` invoking `iteratee` for each element. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early + * by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" property + * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` + * may be used for object iteration. + * + * @static + * @memberOf _ + * @alias each + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEach(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from left to right and returns the array + * + * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { + * console.log(n, key); + * }); + * // => logs each value-key pair and returns the object (iteration order is not guaranteed) + */ +var forEach = createForEach(arrayEach, baseEach); + +module.exports = forEach; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/forEachRight.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/forEachRight.js new file mode 100644 index 00000000..34997110 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/forEachRight.js @@ -0,0 +1,26 @@ +var arrayEachRight = require('../internal/arrayEachRight'), + baseEachRight = require('../internal/baseEachRight'), + createForEach = require('../internal/createForEach'); + +/** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias eachRight + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEachRight(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from right to left and returns the array + */ +var forEachRight = createForEach(arrayEachRight, baseEachRight); + +module.exports = forEachRight; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/groupBy.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/groupBy.js new file mode 100644 index 00000000..a925c894 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/groupBy.js @@ -0,0 +1,59 @@ +var createAggregator = require('../internal/createAggregator'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is an array of the elements responsible for generating the key. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * // using the `_.property` callback shorthand + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ +var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + result[key] = [value]; + } +}); + +module.exports = groupBy; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/include.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/include.js new file mode 100644 index 00000000..594722af --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/include.js @@ -0,0 +1 @@ +module.exports = require('./includes'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/includes.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/includes.js new file mode 100644 index 00000000..80c90e1e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/includes.js @@ -0,0 +1,60 @@ +var baseIndexOf = require('../internal/baseIndexOf'), + getLength = require('../internal/getLength'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'), + isLength = require('../internal/isLength'), + isString = require('../lang/isString'), + values = require('../object/values'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Checks if `value` is in `collection` using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `collection`. + * + * @static + * @memberOf _ + * @alias contains, include + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {*} target The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {boolean} Returns `true` if a matching element is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); + * // => true + * + * _.includes('pebbles', 'eb'); + * // => true + */ +function includes(collection, target, fromIndex, guard) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { + collection = values(collection); + length = collection.length; + } + if (!length) { + return false; + } + if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { + fromIndex = 0; + } else { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); + } + return (typeof collection == 'string' || !isArray(collection) && isString(collection)) + ? (fromIndex < length && collection.indexOf(target, fromIndex) > -1) + : (baseIndexOf(collection, target, fromIndex) > -1); +} + +module.exports = includes; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/indexBy.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/indexBy.js new file mode 100644 index 00000000..34a941e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/indexBy.js @@ -0,0 +1,53 @@ +var createAggregator = require('../internal/createAggregator'); + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the last element responsible for generating the key. The + * iteratee function is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var keyData = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.indexBy(keyData, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return String.fromCharCode(object.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return this.fromCharCode(object.code); + * }, String); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + */ +var indexBy = createAggregator(function(result, value, key) { + result[key] = value; +}); + +module.exports = indexBy; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/inject.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/inject.js new file mode 100644 index 00000000..26f53cf7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/inject.js @@ -0,0 +1 @@ +module.exports = require('./reduce'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/invoke.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/invoke.js new file mode 100644 index 00000000..5cb428ec --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/invoke.js @@ -0,0 +1,42 @@ +var baseEach = require('../internal/baseEach'), + invokePath = require('../internal/invokePath'), + isArrayLike = require('../internal/isArrayLike'), + isKey = require('../internal/isKey'), + restParam = require('../function/restParam'); + +/** + * Invokes the method at `path` on each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `methodName` is a function it is + * invoked for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invoke([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ +var invoke = restParam(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + isProp = isKey(path), + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value) { + var func = isFunc ? path : (isProp && value != null && value[path]); + result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); + }); + return result; +}); + +module.exports = invoke; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/map.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/map.js new file mode 100644 index 00000000..1413f50c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/map.js @@ -0,0 +1,68 @@ +var arrayMap = require('../internal/arrayMap'), + baseCallback = require('../internal/baseCallback'), + baseMap = require('../internal/baseMap'), + isArray = require('../lang/isArray'); + +/** + * Creates an array of values by running each element in `collection` through + * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * Many lodash methods are guarded to work as interatees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, + * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, + * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, + * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, + * `sum`, `uniq`, and `words` + * + * @static + * @memberOf _ + * @alias collect + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new mapped array. + * @example + * + * function timesThree(n) { + * return n * 3; + * } + * + * _.map([1, 2], timesThree); + * // => [3, 6] + * + * _.map({ 'a': 1, 'b': 2 }, timesThree); + * // => [3, 6] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // using the `_.property` callback shorthand + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ +function map(collection, iteratee, thisArg) { + var func = isArray(collection) ? arrayMap : baseMap; + iteratee = baseCallback(iteratee, thisArg, 3); + return func(collection, iteratee); +} + +module.exports = map; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/max.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/max.js new file mode 100644 index 00000000..bb1d213c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/max.js @@ -0,0 +1 @@ +module.exports = require('../math/max'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/min.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/min.js new file mode 100644 index 00000000..eef13d02 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/min.js @@ -0,0 +1 @@ +module.exports = require('../math/min'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/partition.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/partition.js new file mode 100644 index 00000000..ee35f27d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/partition.js @@ -0,0 +1,66 @@ +var createAggregator = require('../internal/createAggregator'); + +/** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, while the second of which + * contains elements `predicate` returns falsey for. The predicate is bound + * to `thisArg` and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * _.partition([1, 2, 3], function(n) { + * return n % 2; + * }); + * // => [[1, 3], [2]] + * + * _.partition([1.2, 2.3, 3.4], function(n) { + * return this.floor(n) % 2; + * }, Math); + * // => [[1.2, 3.4], [2.3]] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * var mapper = function(array) { + * return _.pluck(array, 'user'); + * }; + * + * // using the `_.matches` callback shorthand + * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper); + * // => [['pebbles'], ['barney', 'fred']] + * + * // using the `_.matchesProperty` callback shorthand + * _.map(_.partition(users, 'active', false), mapper); + * // => [['barney', 'pebbles'], ['fred']] + * + * // using the `_.property` callback shorthand + * _.map(_.partition(users, 'active'), mapper); + * // => [['fred'], ['barney', 'pebbles']] + */ +var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); +}, function() { return [[], []]; }); + +module.exports = partition; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/pluck.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/pluck.js new file mode 100644 index 00000000..5ee1ec84 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/pluck.js @@ -0,0 +1,31 @@ +var map = require('./map'), + property = require('../utility/property'); + +/** + * Gets the property value of `path` from all elements in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|string} path The path of the property to pluck. + * @returns {Array} Returns the property values. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * _.pluck(users, 'user'); + * // => ['barney', 'fred'] + * + * var userIndex = _.indexBy(users, 'user'); + * _.pluck(userIndex, 'age'); + * // => [36, 40] (iteration order is not guaranteed) + */ +function pluck(collection, path) { + return map(collection, property(path)); +} + +module.exports = pluck; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/reduce.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/reduce.js new file mode 100644 index 00000000..a483d256 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/reduce.js @@ -0,0 +1,43 @@ +var arrayReduce = require('../internal/arrayReduce'), + baseEach = require('../internal/baseEach'), + createReduce = require('../internal/createReduce'); + +/** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` through `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not provided the first element of `collection` is used as the initial + * value. The `iteratee` is bound to `thisArg` and invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as interatees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `includes`, `merge`, `sortByAll`, and `sortByOrder` + * + * @static + * @memberOf _ + * @alias foldl, inject + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * _.reduce([1, 2], function(total, n) { + * return total + n; + * }); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { + * result[key] = n * 3; + * return result; + * }, {}); + * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed) + */ +var reduce = createReduce(arrayReduce, baseEach); + +module.exports = reduce; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/reduceRight.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/reduceRight.js new file mode 100644 index 00000000..5a5753b9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/reduceRight.js @@ -0,0 +1,29 @@ +var arrayReduceRight = require('../internal/arrayReduceRight'), + baseEachRight = require('../internal/baseEachRight'), + createReduce = require('../internal/createReduce'); + +/** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias foldr + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ +var reduceRight = createReduce(arrayReduceRight, baseEachRight); + +module.exports = reduceRight; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/reject.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/reject.js new file mode 100644 index 00000000..55924539 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/reject.js @@ -0,0 +1,50 @@ +var arrayFilter = require('../internal/arrayFilter'), + baseCallback = require('../internal/baseCallback'), + baseFilter = require('../internal/baseFilter'), + isArray = require('../lang/isArray'); + +/** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.reject([1, 2, 3, 4], function(n) { + * return n % 2 == 0; + * }); + * // => [1, 3] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.reject(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.reject(users, 'active'), 'user'); + * // => ['barney'] + */ +function reject(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = baseCallback(predicate, thisArg, 3); + return func(collection, function(value, index, collection) { + return !predicate(value, index, collection); + }); +} + +module.exports = reject; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sample.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sample.js new file mode 100644 index 00000000..f090db10 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sample.js @@ -0,0 +1,38 @@ +var baseRandom = require('../internal/baseRandom'), + isIterateeCall = require('../internal/isIterateeCall'), + shuffle = require('./shuffle'), + toIterable = require('../internal/toIterable'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMin = Math.min; + +/** + * Gets a random element or `n` random elements from a collection. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to sample. + * @param {number} [n] The number of elements to sample. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {*} Returns the random sample(s). + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + * + * _.sample([1, 2, 3, 4], 2); + * // => [3, 1] + */ +function sample(collection, n, guard) { + if (guard ? isIterateeCall(collection, n, guard) : n == null) { + collection = toIterable(collection); + var length = collection.length; + return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; + } + var result = shuffle(collection); + result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); + return result; +} + +module.exports = sample; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/select.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/select.js new file mode 100644 index 00000000..ade80f6f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/select.js @@ -0,0 +1 @@ +module.exports = require('./filter'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/shuffle.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/shuffle.js new file mode 100644 index 00000000..2281d4f6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/shuffle.js @@ -0,0 +1,35 @@ +var baseRandom = require('../internal/baseRandom'), + toIterable = require('../internal/toIterable'); + +/** + * Creates an array of shuffled values, using a version of the + * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + * @example + * + * _.shuffle([1, 2, 3, 4]); + * // => [4, 1, 3, 2] + */ +function shuffle(collection) { + collection = toIterable(collection); + + var index = -1, + length = collection.length, + result = Array(length); + + while (++index < length) { + var rand = baseRandom(0, index); + if (index != rand) { + result[index] = result[rand]; + } + result[rand] = collection[index]; + } + return result; +} + +module.exports = shuffle; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/size.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/size.js new file mode 100644 index 00000000..78dcf4ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/size.js @@ -0,0 +1,30 @@ +var getLength = require('../internal/getLength'), + isLength = require('../internal/isLength'), + keys = require('../object/keys'); + +/** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable properties for objects. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the size of `collection`. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ +function size(collection) { + var length = collection ? getLength(collection) : 0; + return isLength(length) ? length : keys(collection).length; +} + +module.exports = size; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/some.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/some.js new file mode 100644 index 00000000..2b866b46 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/some.js @@ -0,0 +1,67 @@ +var arraySome = require('../internal/arraySome'), + baseCallback = require('../internal/baseCallback'), + baseSome = require('../internal/baseSome'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * The function returns as soon as it finds a passing value and does not iterate + * over the entire collection. The predicate is bound to `thisArg` and invoked + * with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias any + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.some(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.some(users, 'active'); + * // => true + */ +function some(collection, predicate, thisArg) { + var func = isArray(collection) ? arraySome : baseSome; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = null; + } + if (typeof predicate != 'function' || thisArg !== undefined) { + predicate = baseCallback(predicate, thisArg, 3); + } + return func(collection, predicate); +} + +module.exports = some; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sortBy.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sortBy.js new file mode 100644 index 00000000..28d75f56 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sortBy.js @@ -0,0 +1,71 @@ +var baseCallback = require('../internal/baseCallback'), + baseMap = require('../internal/baseMap'), + baseSortBy = require('../internal/baseSortBy'), + compareAscending = require('../internal/compareAscending'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through `iteratee`. This method performs + * a stable sort, that is, it preserves the original sort order of equal elements. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new sorted array. + * @example + * + * _.sortBy([1, 2, 3], function(n) { + * return Math.sin(n); + * }); + * // => [3, 1, 2] + * + * _.sortBy([1, 2, 3], function(n) { + * return this.sin(n); + * }, Math); + * // => [3, 1, 2] + * + * var users = [ + * { 'user': 'fred' }, + * { 'user': 'pebbles' }, + * { 'user': 'barney' } + * ]; + * + * // using the `_.property` callback shorthand + * _.pluck(_.sortBy(users, 'user'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ +function sortBy(collection, iteratee, thisArg) { + if (collection == null) { + return []; + } + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var index = -1; + iteratee = baseCallback(iteratee, thisArg, 3); + + var result = baseMap(collection, function(value, key, collection) { + return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value }; + }); + return baseSortBy(result, compareAscending); +} + +module.exports = sortBy; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sortByAll.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sortByAll.js new file mode 100644 index 00000000..4766c209 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sortByAll.js @@ -0,0 +1,52 @@ +var baseFlatten = require('../internal/baseFlatten'), + baseSortByOrder = require('../internal/baseSortByOrder'), + isIterateeCall = require('../internal/isIterateeCall'), + restParam = require('../function/restParam'); + +/** + * This method is like `_.sortBy` except that it can sort by multiple iteratees + * or property names. + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees + * The iteratees to sort by, specified as individual values or arrays of values. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.map(_.sortByAll(users, ['user', 'age']), _.values); + * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.map(_.sortByAll(users, 'user', function(chr) { + * return Math.floor(chr.age / 10); + * }), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ +var sortByAll = restParam(function(collection, iteratees) { + if (collection == null) { + return []; + } + var guard = iteratees[2]; + if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) { + iteratees.length = 1; + } + return baseSortByOrder(collection, baseFlatten(iteratees), []); +}); + +module.exports = sortByAll; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sortByOrder.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sortByOrder.js new file mode 100644 index 00000000..c704eeb6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sortByOrder.js @@ -0,0 +1,55 @@ +var baseSortByOrder = require('../internal/baseSortByOrder'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * This method is like `_.sortByAll` except that it allows specifying the + * sort orders of the iteratees to sort by. A truthy value in `orders` will + * sort the corresponding property name in ascending order while a falsey + * value will sort it in descending order. + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {boolean[]} orders The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ +function sortByOrder(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (guard && isIterateeCall(iteratees, orders, guard)) { + orders = null; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseSortByOrder(collection, iteratees, orders); +} + +module.exports = sortByOrder; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sum.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sum.js new file mode 100644 index 00000000..a2e93808 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/sum.js @@ -0,0 +1 @@ +module.exports = require('../math/sum'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/where.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/where.js new file mode 100644 index 00000000..f603bf8c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/where.js @@ -0,0 +1,37 @@ +var baseMatches = require('../internal/baseMatches'), + filter = require('./filter'); + +/** + * Performs a deep comparison between each element in `collection` and the + * source object, returning an array of all elements that have equivalent + * property values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {Array} Returns the new filtered array. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] }, + * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] } + * ]; + * + * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user'); + * // => ['barney'] + * + * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); + * // => ['fred'] + */ +function where(collection, source) { + return filter(collection, baseMatches(source)); +} + +module.exports = where; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/date.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/date.js new file mode 100644 index 00000000..195366e7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/date.js @@ -0,0 +1,3 @@ +module.exports = { + 'now': require('./date/now') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/date/now.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/date/now.js new file mode 100644 index 00000000..628225d2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/date/now.js @@ -0,0 +1,24 @@ +var isNative = require('../lang/isNative'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeNow = isNative(nativeNow = Date.now) && nativeNow; + +/** + * Gets the number of milliseconds that have elapsed since the Unix epoch + * (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @category Date + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => logs the number of milliseconds it took for the deferred function to be invoked + */ +var now = nativeNow || function() { + return new Date().getTime(); +}; + +module.exports = now; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function.js new file mode 100644 index 00000000..2cacde1e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function.js @@ -0,0 +1,27 @@ +module.exports = { + 'after': require('./function/after'), + 'ary': require('./function/ary'), + 'backflow': require('./function/backflow'), + 'before': require('./function/before'), + 'bind': require('./function/bind'), + 'bindAll': require('./function/bindAll'), + 'bindKey': require('./function/bindKey'), + 'compose': require('./function/compose'), + 'curry': require('./function/curry'), + 'curryRight': require('./function/curryRight'), + 'debounce': require('./function/debounce'), + 'defer': require('./function/defer'), + 'delay': require('./function/delay'), + 'flow': require('./function/flow'), + 'flowRight': require('./function/flowRight'), + 'memoize': require('./function/memoize'), + 'negate': require('./function/negate'), + 'once': require('./function/once'), + 'partial': require('./function/partial'), + 'partialRight': require('./function/partialRight'), + 'rearg': require('./function/rearg'), + 'restParam': require('./function/restParam'), + 'spread': require('./function/spread'), + 'throttle': require('./function/throttle'), + 'wrap': require('./function/wrap') +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/after.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/after.js new file mode 100644 index 00000000..e6a5de40 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/after.js @@ -0,0 +1,48 @@ +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeIsFinite = global.isFinite; + +/** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it is called `n` or more times. + * + * @static + * @memberOf _ + * @category Function + * @param {number} n The number of calls before `func` is invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var saves = ['profile', 'settings']; + * + * var done = _.after(saves.length, function() { + * console.log('done saving!'); + * }); + * + * _.forEach(saves, function(type) { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => logs 'done saving!' after the two async saves have completed + */ +function after(n, func) { + if (typeof func != 'function') { + if (typeof n == 'function') { + var temp = n; + n = func; + func = temp; + } else { + throw new TypeError(FUNC_ERROR_TEXT); + } + } + n = nativeIsFinite(n = +n) ? n : 0; + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; +} + +module.exports = after; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/ary.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/ary.js new file mode 100644 index 00000000..1bcb6a72 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/ary.js @@ -0,0 +1,34 @@ +var createWrapper = require('../internal/createWrapper'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** Used to compose bitmasks for wrapper metadata. */ +var ARY_FLAG = 128; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Creates a function that accepts up to `n` arguments ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to cap arguments for. + * @param {number} [n=func.length] The arity cap. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the new function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ +function ary(func, n, guard) { + if (guard && isIterateeCall(func, n, guard)) { + n = null; + } + n = (func && n == null) ? func.length : nativeMax(+n || 0, 0); + return createWrapper(func, ARY_FLAG, null, null, null, null, n); +} + +module.exports = ary; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/backflow.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/backflow.js new file mode 100644 index 00000000..1954e942 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/backflow.js @@ -0,0 +1 @@ +module.exports = require('./flowRight'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/before.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/before.js new file mode 100644 index 00000000..4afd1e60 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/before.js @@ -0,0 +1,42 @@ +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it is called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery('#add').on('click', _.before(5, addContactToList)); + * // => allows adding up to 4 contacts to the list + */ +function before(n, func) { + var result; + if (typeof func != 'function') { + if (typeof n == 'function') { + var temp = n; + n = func; + func = temp; + } else { + throw new TypeError(FUNC_ERROR_TEXT); + } + } + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = null; + } + return result; + }; +} + +module.exports = before; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/bind.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/bind.js new file mode 100644 index 00000000..0de126ae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/bind.js @@ -0,0 +1,56 @@ +var createWrapper = require('../internal/createWrapper'), + replaceHolders = require('../internal/replaceHolders'), + restParam = require('./restParam'); + +/** Used to compose bitmasks for wrapper metadata. */ +var BIND_FLAG = 1, + PARTIAL_FLAG = 32; + +/** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and prepends any additional `_.bind` arguments to those provided to the + * bound function. + * + * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for partially applied arguments. + * + * **Note:** Unlike native `Function#bind` this method does not set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var greet = function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * }; + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // using placeholders + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ +var bind = restParam(function(func, thisArg, partials) { + var bitmask = BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, bind.placeholder); + bitmask |= PARTIAL_FLAG; + } + return createWrapper(func, bitmask, thisArg, partials, holders); +}); + +// Assign default placeholders. +bind.placeholder = {}; + +module.exports = bind; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/bindAll.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/bindAll.js new file mode 100644 index 00000000..a09e9485 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/bindAll.js @@ -0,0 +1,50 @@ +var baseFlatten = require('../internal/baseFlatten'), + createWrapper = require('../internal/createWrapper'), + functions = require('../object/functions'), + restParam = require('./restParam'); + +/** Used to compose bitmasks for wrapper metadata. */ +var BIND_FLAG = 1; + +/** + * Binds methods of an object to the object itself, overwriting the existing + * method. Method names may be specified as individual arguments or as arrays + * of method names. If no method names are provided all enumerable function + * properties, own and inherited, of `object` are bound. + * + * **Note:** This method does not set the "length" property of bound functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Object} object The object to bind and assign the bound methods to. + * @param {...(string|string[])} [methodNames] The object method names to bind, + * specified as individual method names or arrays of method names. + * @returns {Object} Returns `object`. + * @example + * + * var view = { + * 'label': 'docs', + * 'onClick': function() { + * console.log('clicked ' + this.label); + * } + * }; + * + * _.bindAll(view); + * jQuery('#docs').on('click', view.onClick); + * // => logs 'clicked docs' when the element is clicked + */ +var bindAll = restParam(function(object, methodNames) { + methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object); + + var index = -1, + length = methodNames.length; + + while (++index < length) { + var key = methodNames[index]; + object[key] = createWrapper(object[key], BIND_FLAG, object); + } + return object; +}); + +module.exports = bindAll; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/bindKey.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/bindKey.js new file mode 100644 index 00000000..b787fe70 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/bindKey.js @@ -0,0 +1,66 @@ +var createWrapper = require('../internal/createWrapper'), + replaceHolders = require('../internal/replaceHolders'), + restParam = require('./restParam'); + +/** Used to compose bitmasks for wrapper metadata. */ +var BIND_FLAG = 1, + BIND_KEY_FLAG = 2, + PARTIAL_FLAG = 32; + +/** + * Creates a function that invokes the method at `object[key]` and prepends + * any additional `_.bindKey` arguments to those provided to the bound function. + * + * This method differs from `_.bind` by allowing bound functions to reference + * methods that may be redefined or don't yet exist. + * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * for more details. + * + * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * @static + * @memberOf _ + * @category Function + * @param {Object} object The object the method belongs to. + * @param {string} key The key of the method. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var object = { + * 'user': 'fred', + * 'greet': function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * }; + * + * var bound = _.bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function(greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // using placeholders + * var bound = _.bindKey(object, 'greet', _, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ +var bindKey = restParam(function(object, key, partials) { + var bitmask = BIND_FLAG | BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, bindKey.placeholder); + bitmask |= PARTIAL_FLAG; + } + return createWrapper(key, bitmask, object, partials, holders); +}); + +// Assign default placeholders. +bindKey.placeholder = {}; + +module.exports = bindKey; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/compose.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/compose.js new file mode 100644 index 00000000..1954e942 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/compose.js @@ -0,0 +1 @@ +module.exports = require('./flowRight'); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/curry.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/curry.js new file mode 100644 index 00000000..b7db3fda --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/curry.js @@ -0,0 +1,51 @@ +var createCurry = require('../internal/createCurry'); + +/** Used to compose bitmasks for wrapper metadata. */ +var CURRY_FLAG = 8; + +/** + * Creates a function that accepts one or more arguments of `func` that when + * called either invokes `func` returning its result, if all `func` arguments + * have been provided, or returns a function that accepts one or more of the + * remaining `func` arguments, and so on. The arity of `func` may be specified + * if `func.length` is not sufficient. + * + * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for provided arguments. + * + * **Note:** This method does not set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curry(abc); + * + * curried(1)(2)(3); + * // => [1, 2, 3] + * + * curried(1, 2)(3); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // using placeholders + * curried(1)(_, 3)(2); + * // => [1, 2, 3] + */ +var curry = createCurry(CURRY_FLAG); + +// Assign default placeholders. +curry.placeholder = {}; + +module.exports = curry; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/curryRight.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/curryRight.js new file mode 100644 index 00000000..11c54039 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/curryRight.js @@ -0,0 +1,48 @@ +var createCurry = require('../internal/createCurry'); + +/** Used to compose bitmasks for wrapper metadata. */ +var CURRY_RIGHT_FLAG = 16; + +/** + * This method is like `_.curry` except that arguments are applied to `func` + * in the manner of `_.partialRight` instead of `_.partial`. + * + * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for provided arguments. + * + * **Note:** This method does not set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curryRight(abc); + * + * curried(3)(2)(1); + * // => [1, 2, 3] + * + * curried(2, 3)(1); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // using placeholders + * curried(3)(1, _)(2); + * // => [1, 2, 3] + */ +var curryRight = createCurry(CURRY_RIGHT_FLAG); + +// Assign default placeholders. +curryRight.placeholder = {}; + +module.exports = curryRight; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/debounce.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/debounce.js new file mode 100644 index 00000000..5fdf7fce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/debounce.js @@ -0,0 +1,186 @@ +var isObject = require('../lang/isObject'), + now = require('../date/now'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Creates a function that delays invoking `func` until after `wait` milliseconds + * have elapsed since the last time it was invoked. The created function comes + * with a `cancel` method to cancel delayed invocations. Provide an options + * object to indicate that `func` should be invoked on the leading and/or + * trailing edge of the `wait` timeout. Subsequent calls to the debounced + * function return the result of the last `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked + * on the trailing edge of the timeout only if the the debounced function is + * invoked more than once during the `wait` timeout. + * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options] The options object. + * @param {boolean} [options.leading=false] Specify invoking on the leading + * edge of the timeout. + * @param {number} [options.maxWait] The maximum time `func` is allowed to be + * delayed before it is invoked. + * @param {boolean} [options.trailing=true] Specify invoking on the trailing + * edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // avoid costly calculations while the window size is in flux + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // invoke `sendMail` when the click event is fired, debouncing subsequent calls + * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // ensure `batchLog` is invoked once after 1 second of debounced calls + * var source = new EventSource('/stream'); + * jQuery(source).on('message', _.debounce(batchLog, 250, { + * 'maxWait': 1000 + * })); + * + * // cancel a debounced call + * var todoChanges = _.debounce(batchLog, 1000); + * Object.observe(models.todo, todoChanges); + * + * Object.observe(models, function(changes) { + * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) { + * todoChanges.cancel(); + * } + * }, ['delete']); + * + * // ...at some point `models.todo` is changed + * models.todo.completed = true; + * + * // ...before 1 second has passed `models.todo` is deleted + * // which cancels the debounced `todoChanges` call + * delete models.todo; + */ +function debounce(func, wait, options) { + var args, + maxTimeoutId, + result, + stamp, + thisArg, + timeoutId, + trailingCall, + lastCalled = 0, + maxWait = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = wait < 0 ? 0 : (+wait || 0); + if (options === true) { + var leading = true; + trailing = false; + } else if (isObject(options)) { + leading = options.leading; + maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait); + trailing = 'trailing' in options ? options.trailing : trailing; + } + + function cancel() { + if (timeoutId) { + clearTimeout(timeoutId); + } + if (maxTimeoutId) { + clearTimeout(maxTimeoutId); + } + maxTimeoutId = timeoutId = trailingCall = undefined; + } + + function delayed() { + var remaining = wait - (now() - stamp); + if (remaining <= 0 || remaining > wait) { + if (maxTimeoutId) { + clearTimeout(maxTimeoutId); + } + var isCalled = trailingCall; + maxTimeoutId = timeoutId = trailingCall = undefined; + if (isCalled) { + lastCalled = now(); + result = func.apply(thisArg, args); + if (!timeoutId && !maxTimeoutId) { + args = thisArg = null; + } + } + } else { + timeoutId = setTimeout(delayed, remaining); + } + } + + function maxDelayed() { + if (timeoutId) { + clearTimeout(timeoutId); + } + maxTimeoutId = timeoutId = trailingCall = undefined; + if (trailing || (maxWait !== wait)) { + lastCalled = now(); + result = func.apply(thisArg, args); + if (!timeoutId && !maxTimeoutId) { + args = thisArg = null; + } + } + } + + function debounced() { + args = arguments; + stamp = now(); + thisArg = this; + trailingCall = trailing && (timeoutId || !leading); + + if (maxWait === false) { + var leadingCall = leading && !timeoutId; + } else { + if (!maxTimeoutId && !leading) { + lastCalled = stamp; + } + var remaining = maxWait - (stamp - lastCalled), + isCalled = remaining <= 0 || remaining > maxWait; + + if (isCalled) { + if (maxTimeoutId) { + maxTimeoutId = clearTimeout(maxTimeoutId); + } + lastCalled = stamp; + result = func.apply(thisArg, args); + } + else if (!maxTimeoutId) { + maxTimeoutId = setTimeout(maxDelayed, remaining); + } + } + if (isCalled && timeoutId) { + timeoutId = clearTimeout(timeoutId); + } + else if (!timeoutId && wait !== maxWait) { + timeoutId = setTimeout(delayed, wait); + } + if (leadingCall) { + isCalled = true; + result = func.apply(thisArg, args); + } + if (isCalled && !timeoutId && !maxTimeoutId) { + args = thisArg = null; + } + return result; + } + debounced.cancel = cancel; + return debounced; +} + +module.exports = debounce; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/defer.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/defer.js new file mode 100644 index 00000000..369790ce --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/defer.js @@ -0,0 +1,25 @@ +var baseDelay = require('../internal/baseDelay'), + restParam = require('./restParam'); + +/** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it is invoked. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke the function with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // logs 'deferred' after one or more milliseconds + */ +var defer = restParam(function(func, args) { + return baseDelay(func, 1, args); +}); + +module.exports = defer; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/delay.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/delay.js new file mode 100644 index 00000000..955b059e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/delay.js @@ -0,0 +1,26 @@ +var baseDelay = require('../internal/baseDelay'), + restParam = require('./restParam'); + +/** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it is invoked. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {...*} [args] The arguments to invoke the function with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => logs 'later' after one second + */ +var delay = restParam(function(func, wait, args) { + return baseDelay(func, wait, args); +}); + +module.exports = delay; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/flow.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/flow.js new file mode 100644 index 00000000..a435a3d8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/flow.js @@ -0,0 +1,25 @@ +var createFlow = require('../internal/createFlow'); + +/** + * Creates a function that returns the result of invoking the provided + * functions with the `this` binding of the created function, where each + * successive invocation is supplied the return value of the previous. + * + * @static + * @memberOf _ + * @category Function + * @param {...Function} [funcs] Functions to invoke. + * @returns {Function} Returns the new function. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flow(_.add, square); + * addSquare(1, 2); + * // => 9 + */ +var flow = createFlow(); + +module.exports = flow; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/flowRight.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/flowRight.js new file mode 100644 index 00000000..23b9d76b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/flowRight.js @@ -0,0 +1,25 @@ +var createFlow = require('../internal/createFlow'); + +/** + * This method is like `_.flow` except that it creates a function that + * invokes the provided functions from right to left. + * + * @static + * @memberOf _ + * @alias backflow, compose + * @category Function + * @param {...Function} [funcs] Functions to invoke. + * @returns {Function} Returns the new function. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flowRight(square, _.add); + * addSquare(1, 2); + * // => 9 + */ +var flowRight = createFlow(true); + +module.exports = flowRight; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/memoize.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/memoize.js new file mode 100644 index 00000000..c9de9897 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/memoize.js @@ -0,0 +1,80 @@ +var MapCache = require('../internal/MapCache'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the + * cache key. The `func` is invoked with the `this` binding of the memoized + * function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the [`Map`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) + * method interface of `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoizing function. + * @example + * + * var upperCase = _.memoize(function(string) { + * return string.toUpperCase(); + * }); + * + * upperCase('fred'); + * // => 'FRED' + * + * // modifying the result cache + * upperCase.cache.set('fred', 'BARNEY'); + * upperCase('fred'); + * // => 'BARNEY' + * + * // replacing `_.memoize.Cache` + * var object = { 'user': 'fred' }; + * var other = { 'user': 'barney' }; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'fred' } + * + * _.memoize.Cache = WeakMap; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'barney' } + */ +function memoize(func, resolver) { + if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + cache = memoized.cache, + key = resolver ? resolver.apply(this, args) : args[0]; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + cache.set(key, result); + return result; + }; + memoized.cache = new memoize.Cache; + return memoized; +} + +// Assign cache to `_.memoize`. +memoize.Cache = MapCache; + +module.exports = memoize; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/negate.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/negate.js new file mode 100644 index 00000000..82479390 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/negate.js @@ -0,0 +1,32 @@ +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that negates the result of the predicate `func`. The + * `func` predicate is invoked with the `this` binding and arguments of the + * created function. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} predicate The predicate to negate. + * @returns {Function} Returns the new function. + * @example + * + * function isEven(n) { + * return n % 2 == 0; + * } + * + * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); + * // => [1, 3, 5] + */ +function negate(predicate) { + if (typeof predicate != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function() { + return !predicate.apply(this, arguments); + }; +} + +module.exports = negate; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/once.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/once.js new file mode 100644 index 00000000..0b5bd853 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/once.js @@ -0,0 +1,24 @@ +var before = require('./before'); + +/** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first call. The `func` is invoked + * with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // `initialize` invokes `createApplication` once + */ +function once(func) { + return before(2, func); +} + +module.exports = once; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/partial.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/partial.js new file mode 100644 index 00000000..fb1d04fb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/partial.js @@ -0,0 +1,43 @@ +var createPartial = require('../internal/createPartial'); + +/** Used to compose bitmasks for wrapper metadata. */ +var PARTIAL_FLAG = 32; + +/** + * Creates a function that invokes `func` with `partial` arguments prepended + * to those provided to the new function. This method is like `_.bind` except + * it does **not** alter the `this` binding. + * + * The `_.partial.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method does not set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * var greet = function(greeting, name) { + * return greeting + ' ' + name; + * }; + * + * var sayHelloTo = _.partial(greet, 'hello'); + * sayHelloTo('fred'); + * // => 'hello fred' + * + * // using placeholders + * var greetFred = _.partial(greet, _, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + */ +var partial = createPartial(PARTIAL_FLAG); + +// Assign default placeholders. +partial.placeholder = {}; + +module.exports = partial; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/partialRight.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/partialRight.js new file mode 100644 index 00000000..634e6a4c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/partialRight.js @@ -0,0 +1,42 @@ +var createPartial = require('../internal/createPartial'); + +/** Used to compose bitmasks for wrapper metadata. */ +var PARTIAL_RIGHT_FLAG = 64; + +/** + * This method is like `_.partial` except that partially applied arguments + * are appended to those provided to the new function. + * + * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method does not set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * var greet = function(greeting, name) { + * return greeting + ' ' + name; + * }; + * + * var greetFred = _.partialRight(greet, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + * + * // using placeholders + * var sayHelloTo = _.partialRight(greet, 'hello', _); + * sayHelloTo('fred'); + * // => 'hello fred' + */ +var partialRight = createPartial(PARTIAL_RIGHT_FLAG); + +// Assign default placeholders. +partialRight.placeholder = {}; + +module.exports = partialRight; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/rearg.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/rearg.js new file mode 100644 index 00000000..0a4bf8fa --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/rearg.js @@ -0,0 +1,40 @@ +var baseFlatten = require('../internal/baseFlatten'), + createWrapper = require('../internal/createWrapper'), + restParam = require('./restParam'); + +/** Used to compose bitmasks for wrapper metadata. */ +var REARG_FLAG = 256; + +/** + * Creates a function that invokes `func` with arguments arranged according + * to the specified indexes where the argument value at the first index is + * provided as the first argument, the argument value at the second index is + * provided as the second argument, and so on. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to rearrange arguments for. + * @param {...(number|number[])} indexes The arranged argument indexes, + * specified as individual indexes or arrays of indexes. + * @returns {Function} Returns the new function. + * @example + * + * var rearged = _.rearg(function(a, b, c) { + * return [a, b, c]; + * }, 2, 0, 1); + * + * rearged('b', 'c', 'a') + * // => ['a', 'b', 'c'] + * + * var map = _.rearg(_.map, [1, 0]); + * map(function(n) { + * return n * 3; + * }, [1, 2, 3]); + * // => [3, 6, 9] + */ +var rearg = restParam(function(func, indexes) { + return createWrapper(func, REARG_FLAG, null, null, null, baseFlatten(indexes)); +}); + +module.exports = rearg; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/restParam.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/restParam.js new file mode 100644 index 00000000..3a1c1570 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/restParam.js @@ -0,0 +1,58 @@ +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as an array. + * + * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.restParam(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ +function restParam(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + rest = Array(length); + + while (++index < length) { + rest[index] = args[start + index]; + } + switch (start) { + case 0: return func.call(this, rest); + case 1: return func.call(this, args[0], rest); + case 2: return func.call(this, args[0], args[1], rest); + } + var otherArgs = Array(start + 1); + index = -1; + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = rest; + return func.apply(this, otherArgs); + }; +} + +module.exports = restParam; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/spread.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/spread.js new file mode 100644 index 00000000..aad4b714 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/spread.js @@ -0,0 +1,44 @@ +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that invokes `func` with the `this` binding of the created + * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). + * + * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator). + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to spread arguments over. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.spread(function(who, what) { + * return who + ' says ' + what; + * }); + * + * say(['fred', 'hello']); + * // => 'fred says hello' + * + * // with a Promise + * var numbers = Promise.all([ + * Promise.resolve(40), + * Promise.resolve(36) + * ]); + * + * numbers.then(_.spread(function(x, y) { + * return x + y; + * })); + * // => a Promise of 76 + */ +function spread(func) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function(array) { + return func.apply(this, array); + }; +} + +module.exports = spread; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/throttle.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/throttle.js new file mode 100644 index 00000000..7c30e646 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/throttle.js @@ -0,0 +1,72 @@ +var debounce = require('./debounce'), + isObject = require('../lang/isObject'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** Used as an internal `_.debounce` options object by `_.throttle`. */ +var debounceOptions = { + 'leading': false, + 'maxWait': 0, + 'trailing': false +}; + +/** + * Creates a function that only invokes `func` at most once per every `wait` + * milliseconds. The created function comes with a `cancel` method to cancel + * delayed invocations. Provide an options object to indicate that `func` + * should be invoked on the leading and/or trailing edge of the `wait` timeout. + * Subsequent calls to the throttled function return the result of the last + * `func` call. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked + * on the trailing edge of the timeout only if the the throttled function is + * invoked more than once during the `wait` timeout. + * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] The number of milliseconds to throttle invocations to. + * @param {Object} [options] The options object. + * @param {boolean} [options.leading=true] Specify invoking on the leading + * edge of the timeout. + * @param {boolean} [options.trailing=true] Specify invoking on the trailing + * edge of the timeout. + * @returns {Function} Returns the new throttled function. + * @example + * + * // avoid excessively updating the position while scrolling + * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); + * + * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes + * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { + * 'trailing': false + * })); + * + * // cancel a trailing throttled call + * jQuery(window).on('popstate', throttled.cancel); + */ +function throttle(func, wait, options) { + var leading = true, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (options === false) { + leading = false; + } else if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + debounceOptions.leading = leading; + debounceOptions.maxWait = +wait; + debounceOptions.trailing = trailing; + return debounce(func, wait, debounceOptions); +} + +module.exports = throttle; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/wrap.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/wrap.js new file mode 100644 index 00000000..68b09af2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/wrap.js @@ -0,0 +1,33 @@ +var createWrapper = require('../internal/createWrapper'), + identity = require('../utility/identity'); + +/** Used to compose bitmasks for wrapper metadata. */ +var PARTIAL_FLAG = 32; + +/** + * Creates a function that provides `value` to the wrapper function as its + * first argument. Any additional arguments provided to the function are + * appended to those provided to the wrapper function. The wrapper is invoked + * with the `this` binding of the created function. + * + * @static + * @memberOf _ + * @category Function + * @param {*} value The value to wrap. + * @param {Function} wrapper The wrapper function. + * @returns {Function} Returns the new function. + * @example + * + * var p = _.wrap(_.escape, function(func, text) { + * return '

' + func(text) + '

'; + * }); + * + * p('fred, barney, & pebbles'); + * // => '

fred, barney, & pebbles

' + */ +function wrap(value, wrapper) { + wrapper = wrapper == null ? identity : wrapper; + return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); +} + +module.exports = wrap; diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/index.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/index.js new file mode 100644 index 00000000..f52debbe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/index.js @@ -0,0 +1,12202 @@ +/** + * @license + * lodash 3.8.0 (Custom Build) + * Build: `lodash modern -d -o ./index.js` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +;(function() { + + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined; + + /** Used as the semantic version number. */ + var VERSION = '3.8.0'; + + /** Used to compose bitmasks for wrapper metadata. */ + var BIND_FLAG = 1, + BIND_KEY_FLAG = 2, + CURRY_BOUND_FLAG = 4, + CURRY_FLAG = 8, + CURRY_RIGHT_FLAG = 16, + PARTIAL_FLAG = 32, + PARTIAL_RIGHT_FLAG = 64, + ARY_FLAG = 128, + REARG_FLAG = 256; + + /** Used as default options for `_.trunc`. */ + var DEFAULT_TRUNC_LENGTH = 30, + DEFAULT_TRUNC_OMISSION = '...'; + + /** Used to detect when a function becomes hot. */ + var HOT_COUNT = 150, + HOT_SPAN = 16; + + /** Used to indicate the type of lazy iteratees. */ + var LAZY_DROP_WHILE_FLAG = 0, + LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2; + + /** Used as the `TypeError` message for "Functions" methods. */ + var FUNC_ERROR_TEXT = 'Expected a function'; + + /** Used as the internal argument placeholder. */ + var PLACEHOLDER = '__lodash_placeholder__'; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + + var arrayBufferTag = '[object ArrayBuffer]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + + /** Used to match empty string literals in compiled template source. */ + var reEmptyStringLeading = /\b__p \+= '';/g, + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + + /** Used to match HTML entities and HTML characters. */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g, + reUnescapedHtml = /[&<>"'`]/g, + reHasEscapedHtml = RegExp(reEscapedHtml.source), + reHasUnescapedHtml = RegExp(reUnescapedHtml.source); + + /** Used to match template delimiters. */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; + + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; + + /** + * Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special). + * In addition to special characters the forward slash is escaped to allow for + * easier `eval` use and `Function` compilation. + */ + var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, + reHasRegExpChars = RegExp(reRegExpChars.source); + + /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */ + var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */ + var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; + + /** Used to detect hexadecimal string values. */ + var reHasHexPrefix = /^0[xX]/; + + /** Used to detect host constructors (Safari > 5). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ + var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; + + /** Used to ensure capturing order of template delimiters. */ + var reNoMatch = /($^)/; + + /** Used to match unescaped characters in compiled string literals. */ + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; + + /** Used to match words to create compound words. */ + var reWords = (function() { + var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]', + lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+'; + + return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g'); + }()); + + /** Used to detect and test for whitespace. */ + var whitespace = ( + // Basic whitespace characters. + ' \t\x0b\f\xa0\ufeff' + + + // Line terminators. + '\n\r\u2028\u2029' + + + // Unicode category "Zs" space separators. + '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' + ); + + /** Used to assign default `context` object properties. */ + var contextProps = [ + 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array', + 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number', + 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document', + 'isFinite', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', + 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', + 'window' + ]; + + /** Used to make template sourceURLs easier to identify. */ + var templateCounter = -1; + + /** Used to identify `toStringTag` values of typed arrays. */ + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dateTag] = typedArrayTags[errorTag] = + typedArrayTags[funcTag] = typedArrayTags[mapTag] = + typedArrayTags[numberTag] = typedArrayTags[objectTag] = + typedArrayTags[regexpTag] = typedArrayTags[setTag] = + typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + + /** Used to identify `toStringTag` values supported by `_.clone`. */ + var cloneableTags = {}; + cloneableTags[argsTag] = cloneableTags[arrayTag] = + cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = + cloneableTags[dateTag] = cloneableTags[float32Tag] = + cloneableTags[float64Tag] = cloneableTags[int8Tag] = + cloneableTags[int16Tag] = cloneableTags[int32Tag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[stringTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = cloneableTags[funcTag] = + cloneableTags[mapTag] = cloneableTags[setTag] = + cloneableTags[weakMapTag] = false; + + /** Used as an internal `_.debounce` options object by `_.throttle`. */ + var debounceOptions = { + 'leading': false, + 'maxWait': 0, + 'trailing': false + }; + + /** Used to map latin-1 supplementary letters to basic latin letters. */ + var deburredLetters = { + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss' + }; + + /** Used to map characters to HTML entities. */ + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`' + }; + + /** Used to map HTML entities to characters. */ + var htmlUnescapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'", + '`': '`' + }; + + /** Used to determine if values are of the language type `Object`. */ + var objectTypes = { + 'function': true, + 'object': true + }; + + /** Used to escape characters for inclusion in compiled string literals. */ + var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + /** Detect free variable `exports`. */ + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global; + + /** Detect free variable `self`. */ + var freeSelf = objectTypes[typeof self] && self && self.Object && self; + + /** Detect free variable `window`. */ + var freeWindow = objectTypes[typeof window] && window && window.Object && window; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; + + /** + * Used as a reference to the global object. + * + * The `this` value is used if it is the global object to avoid Greasemonkey's + * restricted `window` object, otherwise the `window` object is used. + */ + var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this; + + /** + * The base implementation of `compareAscending` which compares values and + * sorts them in ascending order without guaranteeing a stable sort. + * + * @private + * @param {*} value The value to compare to `other`. + * @param {*} other The value to compare to `value`. + * @returns {number} Returns the sort order indicator for `value`. + */ + function baseCompareAscending(value, other) { + if (value !== other) { + var valIsReflexive = value === value, + othIsReflexive = other === other; + + if (value > other || !valIsReflexive || (value === undefined && othIsReflexive)) { + return 1; + } + if (value < other || !othIsReflexive || (other === undefined && valIsReflexive)) { + return -1; + } + } + return 0; + } + + /** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseFindIndex(array, predicate, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.indexOf` without support for binary searches. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return indexOfNaN(array, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.isFunction` without support for environments + * with incorrect `typeof` results. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + */ + function baseIsFunction(value) { + // Avoid a Chakra JIT bug in compatibility modes of IE 11. + // See https://github.com/jashkenas/underscore/issues/1621 for more details. + return typeof value == 'function' || false; + } + + /** + * Converts `value` to a string if it is not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); + } + + /** + * Used by `_.max` and `_.min` as the default callback for string values. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the code unit of the first character of the string. + */ + function charAtCallback(string) { + return string.charCodeAt(0); + } + + /** + * Used by `_.trim` and `_.trimLeft` to get the index of the first character + * of `string` that is not found in `chars`. + * + * @private + * @param {string} string The string to inspect. + * @param {string} chars The characters to find. + * @returns {number} Returns the index of the first character not found in `chars`. + */ + function charsLeftIndex(string, chars) { + var index = -1, + length = string.length; + + while (++index < length && chars.indexOf(string.charAt(index)) > -1) {} + return index; + } + + /** + * Used by `_.trim` and `_.trimRight` to get the index of the last character + * of `string` that is not found in `chars`. + * + * @private + * @param {string} string The string to inspect. + * @param {string} chars The characters to find. + * @returns {number} Returns the index of the last character not found in `chars`. + */ + function charsRightIndex(string, chars) { + var index = string.length; + + while (index-- && chars.indexOf(string.charAt(index)) > -1) {} + return index; + } + + /** + * Used by `_.sortBy` to compare transformed elements of a collection and stable + * sort them in ascending order. + * + * @private + * @param {Object} object The object to compare to `other`. + * @param {Object} other The object to compare to `object`. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareAscending(object, other) { + return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index); + } + + /** + * Used by `_.sortByOrder` to compare multiple properties of each element + * in a collection and stable sort them in the following order: + * + * If `orders` is unspecified, sort in ascending order for all properties. + * Otherwise, for each property, sort in ascending order if its corresponding value in + * orders is true, and descending order if false. + * + * @private + * @param {Object} object The object to compare to `other`. + * @param {Object} other The object to compare to `object`. + * @param {boolean[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = baseCompareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + return result * (orders[index] ? 1 : -1); + } + } + // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. + // + // This also ensures a stable sort in V8 and other engines. + // See https://code.google.com/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; + } + + /** + * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ + function deburrLetter(letter) { + return deburredLetters[letter]; + } + + /** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + function escapeHtmlChar(chr) { + return htmlEscapes[chr]; + } + + /** + * Used by `_.template` to escape characters for inclusion in compiled + * string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; + } + + /** + * Gets the index at which the first occurrence of `NaN` is found in `array`. + * + * @private + * @param {Array} array The array to search. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched `NaN`, else `-1`. + */ + function indexOfNaN(array, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 0 : -1); + + while ((fromRight ? index-- : ++index < length)) { + var other = array[index]; + if (other !== other) { + return index; + } + } + return -1; + } + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + /** + * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a + * character code is whitespace. + * + * @private + * @param {number} charCode The character code to inspect. + * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`. + */ + function isSpace(charCode) { + return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 || + (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279))); + } + + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = -1, + result = []; + + while (++index < length) { + if (array[index] === placeholder) { + array[index] = PLACEHOLDER; + result[++resIndex] = index; + } + } + return result; + } + + /** + * An implementation of `_.uniq` optimized for sorted arrays without support + * for callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The function invoked per iteration. + * @returns {Array} Returns the new duplicate-value-free array. + */ + function sortedUniq(array, iteratee) { + var seen, + index = -1, + length = array.length, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value, index, array) : value; + + if (!index || seen !== computed) { + seen = computed; + result[++resIndex] = value; + } + } + return result; + } + + /** + * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the first non-whitespace character. + */ + function trimmedLeftIndex(string) { + var index = -1, + length = string.length; + + while (++index < length && isSpace(string.charCodeAt(index))) {} + return index; + } + + /** + * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ + function trimmedRightIndex(string) { + var index = string.length; + + while (index-- && isSpace(string.charCodeAt(index))) {} + return index; + } + + /** + * Used by `_.unescape` to convert HTML entities to characters. + * + * @private + * @param {string} chr The matched character to unescape. + * @returns {string} Returns the unescaped character. + */ + function unescapeHtmlChar(chr) { + return htmlUnescapes[chr]; + } + + /** + * Create a new pristine `lodash` function using the given `context` object. + * + * @static + * @memberOf _ + * @category Utility + * @param {Object} [context=root] The context object. + * @returns {Function} Returns a new `lodash` function. + * @example + * + * _.mixin({ 'foo': _.constant('foo') }); + * + * var lodash = _.runInContext(); + * lodash.mixin({ 'bar': lodash.constant('bar') }); + * + * _.isFunction(_.foo); + * // => true + * _.isFunction(_.bar); + * // => false + * + * lodash.isFunction(lodash.foo); + * // => false + * lodash.isFunction(lodash.bar); + * // => true + * + * // using `context` to mock `Date#getTime` use in `_.now` + * var mock = _.runInContext({ + * 'Date': function() { + * return { 'getTime': getTimeMock }; + * } + * }); + * + * // or creating a suped-up `defer` in Node.js + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; + */ + function runInContext(context) { + // Avoid issues with some ES3 environments that attempt to use values, named + // after built-in constructors like `Object`, for the creation of literals. + // ES5 clears this up by stating that literals must use built-in constructors. + // See https://es5.github.io/#x11.1.5 for more details. + context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; + + /** Native constructor references. */ + var Array = context.Array, + Date = context.Date, + Error = context.Error, + Function = context.Function, + Math = context.Math, + Number = context.Number, + Object = context.Object, + RegExp = context.RegExp, + String = context.String, + TypeError = context.TypeError; + + /** Used for native method references. */ + var arrayProto = Array.prototype, + objectProto = Object.prototype, + stringProto = String.prototype; + + /** Used to detect DOM support. */ + var document = (document = context.window) && document.document; + + /** Used to resolve the decompiled source of functions. */ + var fnToString = Function.prototype.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to generate unique IDs. */ + var idCounter = 0; + + /** + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** Used to restore the original `_` reference in `_.noConflict`. */ + var oldDash = context._; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + escapeRegExp(objToString) + .replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** Native method references. */ + var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) && ArrayBuffer, + bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice, + ceil = Math.ceil, + clearTimeout = context.clearTimeout, + floor = Math.floor, + getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols, + getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, + push = arrayProto.push, + preventExtensions = isNative(preventExtensions = Object.preventExtensions) && preventExtensions, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + Set = isNative(Set = context.Set) && Set, + setTimeout = context.setTimeout, + splice = arrayProto.splice, + Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array, + WeakMap = isNative(WeakMap = context.WeakMap) && WeakMap; + + /** Used to clone array buffers. */ + var Float64Array = (function() { + // Safari 5 errors when using an array buffer to initialize a typed array + // where the array buffer's `byteLength` is not a multiple of the typed + // array's `BYTES_PER_ELEMENT`. + try { + var func = isNative(func = context.Float64Array) && func, + result = new func(new ArrayBuffer(10), 0, 1) && func; + } catch(e) {} + return result; + }()); + + /** Used as `baseAssign`. */ + var nativeAssign = (function() { + // Avoid `Object.assign` in Firefox 34-37 which have an early implementation + // with a now defunct try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344 + // for more details. + // + // Use `Object.preventExtensions` on a plain object instead of simply using + // `Object('x')` because Chrome and IE fail to throw an error when attempting + // to assign values to readonly indexes of strings. + var func = preventExtensions && isNative(func = Object.assign) && func; + try { + if (func) { + var object = preventExtensions({ '1': 0 }); + object[0] = 1; + } + } catch(e) { + // Only attempt in strict mode. + try { func(object, 'xo'); } catch(e) {} + return !object[1] && func; + } + return false; + }()); + + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, + nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, + nativeIsFinite = context.isFinite, + nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, + nativeMax = Math.max, + nativeMin = Math.min, + nativeNow = isNative(nativeNow = Date.now) && nativeNow, + nativeNumIsFinite = isNative(nativeNumIsFinite = Number.isFinite) && nativeNumIsFinite, + nativeParseInt = context.parseInt, + nativeRandom = Math.random; + + /** Used as references for `-Infinity` and `Infinity`. */ + var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY, + POSITIVE_INFINITY = Number.POSITIVE_INFINITY; + + /** Used as references for the maximum length and index of an array. */ + var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + + /** Used as the size, in bytes, of each `Float64Array` element. */ + var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0; + + /** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + + /** Used to store function metadata. */ + var metaMap = WeakMap && new WeakMap; + + /** Used to lookup unminified function names. */ + var realNames = {}; + + /** + * Creates a `lodash` object which wraps `value` to enable implicit chaining. + * Methods that operate on and return arrays, collections, and functions can + * be chained together. Methods that return a boolean or single value will + * automatically end the chain returning the unwrapped value. Explicit chaining + * may be enabled using `_.chain`. The execution of chained methods is lazy, + * that is, execution is deferred until `_#value` is implicitly or explicitly + * called. + * + * Lazy evaluation allows several methods to support shortcut fusion. Shortcut + * fusion is an optimization that merges iteratees to avoid creating intermediate + * arrays and reduce the number of iteratee executions. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, + * `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, + * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, + * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, + * and `where` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`, + * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`, + * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, + * `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, + * `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`, + * `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, + * `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, + * `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, + * `merge`, `mixin`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, + * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`, + * `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, + * `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, + * `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, `transform`, + * `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`, + * `without`, `wrap`, `xor`, `zip`, and `zipObject` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`, + * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, + * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`, + * `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`, + * `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite` + * `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, + * `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, + * `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, `noConflict`, + * `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, + * `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, `startsWith`, + * `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`, + * `uniqueId`, `value`, and `words` + * + * The wrapper method `sample` will return a wrapped value when `n` is provided, + * otherwise an unwrapped value is returned. + * + * @name _ + * @constructor + * @category Chain + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var wrapped = _([1, 2, 3]); + * + * // returns an unwrapped value + * wrapped.reduce(function(total, n) { + * return total + n; + * }); + * // => 6 + * + * // returns a wrapped value + * var squares = wrapped.map(function(n) { + * return n * n; + * }); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); + } + + /** + * The function whose prototype all chaining wrappers inherit from. + * + * @private + */ + function baseLodash() { + // No operation performed. + } + + /** + * The base constructor for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable chaining for all wrapper methods. + * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value. + */ + function LodashWrapper(value, chainAll, actions) { + this.__wrapped__ = value; + this.__actions__ = actions || []; + this.__chain__ = !!chainAll; + } + + /** + * An object environment feature flags. + * + * @static + * @memberOf _ + * @type Object + */ + var support = lodash.support = {}; + + (function(x) { + var Ctor = function() { this.x = x; }, + args = arguments, + object = { '0': x, 'length': x }, + props = []; + + Ctor.prototype = { 'valueOf': x, 'y': x }; + for (var key in new Ctor) { props.push(key); } + + /** + * Detect if functions can be decompiled by `Function#toString` + * (all but Firefox OS certified apps, older Opera mobile browsers, and + * the PlayStation 3; forced `false` for Windows 8 apps). + * + * @memberOf _.support + * @type boolean + */ + support.funcDecomp = /\bthis\b/.test(function() { return this; }); + + /** + * Detect if `Function#name` is supported (all but IE). + * + * @memberOf _.support + * @type boolean + */ + support.funcNames = typeof Function.name == 'string'; + + /** + * Detect if the DOM is supported. + * + * @memberOf _.support + * @type boolean + */ + try { + support.dom = document.createDocumentFragment().nodeType === 11; + } catch(e) { + support.dom = false; + } + + /** + * Detect if `arguments` object indexes are non-enumerable. + * + * In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object + * indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat + * `arguments` object indexes as non-enumerable and fail `hasOwnProperty` + * checks for indexes that exceed the number of function parameters and + * whose associated argument values are `0`. + * + * @memberOf _.support + * @type boolean + */ + try { + support.nonEnumArgs = !propertyIsEnumerable.call(args, 1); + } catch(e) { + support.nonEnumArgs = true; + } + }(1, 0)); + + /** + * By default, the template delimiters used by lodash are like those in + * embedded Ruby (ERB). Change the following template settings to use + * alternative delimiters. + * + * @static + * @memberOf _ + * @type Object + */ + lodash.templateSettings = { + + /** + * Used to detect `data` property values to be HTML-escaped. + * + * @memberOf _.templateSettings + * @type RegExp + */ + 'escape': reEscape, + + /** + * Used to detect code to be evaluated. + * + * @memberOf _.templateSettings + * @type RegExp + */ + 'evaluate': reEvaluate, + + /** + * Used to detect `data` property values to inject. + * + * @memberOf _.templateSettings + * @type RegExp + */ + 'interpolate': reInterpolate, + + /** + * Used to reference the data object in the template text. + * + * @memberOf _.templateSettings + * @type string + */ + 'variable': '', + + /** + * Used to import variables into the compiled template. + * + * @memberOf _.templateSettings + * @type Object + */ + 'imports': { + + /** + * A reference to the `lodash` function. + * + * @memberOf _.templateSettings.imports + * @type Function + */ + '_': lodash + } + }; + + /** + * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. + * + * @private + * @param {*} value The value to wrap. + */ + function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = null; + this.__dir__ = 1; + this.__dropCount__ = 0; + this.__filtered__ = false; + this.__iteratees__ = null; + this.__takeCount__ = POSITIVE_INFINITY; + this.__views__ = null; + } + + /** + * Creates a clone of the lazy wrapper object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ + function lazyClone() { + var actions = this.__actions__, + iteratees = this.__iteratees__, + views = this.__views__, + result = new LazyWrapper(this.__wrapped__); + + result.__actions__ = actions ? arrayCopy(actions) : null; + result.__dir__ = this.__dir__; + result.__filtered__ = this.__filtered__; + result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null; + result.__takeCount__ = this.__takeCount__; + result.__views__ = views ? arrayCopy(views) : null; + return result; + } + + /** + * Reverses the direction of lazy iteration. + * + * @private + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. + */ + function lazyReverse() { + if (this.__filtered__) { + var result = new LazyWrapper(this); + result.__dir__ = -1; + result.__filtered__ = true; + } else { + result = this.clone(); + result.__dir__ *= -1; + } + return result; + } + + /** + * Extracts the unwrapped value from its lazy wrapper. + * + * @private + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. + */ + function lazyValue() { + var array = this.__wrapped__.value(); + if (!isArray(array)) { + return baseWrapperValue(array, this.__actions__); + } + var dir = this.__dir__, + isRight = dir < 0, + view = getView(0, array.length, this.__views__), + start = view.start, + end = view.end, + length = end - start, + index = isRight ? end : (start - 1), + takeCount = nativeMin(length, this.__takeCount__), + iteratees = this.__iteratees__, + iterLength = iteratees ? iteratees.length : 0, + resIndex = 0, + result = []; + + outer: + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type; + + if (type == LAZY_DROP_WHILE_FLAG) { + if (data.done && (isRight ? (index > data.index) : (index < data.index))) { + data.count = 0; + data.done = false; + } + data.index = index; + if (!data.done) { + var limit = data.limit; + if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) { + continue outer; + } + } + } else { + var computed = iteratee(value); + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + } + result[resIndex++] = value; + } + return result; + } + + /** + * Creates a cache object to store key/value pairs. + * + * @private + * @static + * @name Cache + * @memberOf _.memoize + */ + function MapCache() { + this.__data__ = {}; + } + + /** + * Removes `key` and its value from the cache. + * + * @private + * @name delete + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`. + */ + function mapDelete(key) { + return this.has(key) && delete this.__data__[key]; + } + + /** + * Gets the cached value for `key`. + * + * @private + * @name get + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to get. + * @returns {*} Returns the cached value. + */ + function mapGet(key) { + return key == '__proto__' ? undefined : this.__data__[key]; + } + + /** + * Checks if a cached value for `key` exists. + * + * @private + * @name has + * @memberOf _.memoize.Cache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function mapHas(key) { + return key != '__proto__' && hasOwnProperty.call(this.__data__, key); + } + + /** + * Sets `value` to `key` of the cache. + * + * @private + * @name set + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to cache. + * @param {*} value The value to cache. + * @returns {Object} Returns the cache object. + */ + function mapSet(key, value) { + if (key != '__proto__') { + this.__data__[key] = value; + } + return this; + } + + /** + * + * Creates a cache object to store unique values. + * + * @private + * @param {Array} [values] The values to cache. + */ + function SetCache(values) { + var length = values ? values.length : 0; + + this.data = { 'hash': nativeCreate(null), 'set': new Set }; + while (length--) { + this.push(values[length]); + } + } + + /** + * Checks if `value` is in `cache` mimicking the return signature of + * `_.indexOf` by returning `0` if the value is found, else `-1`. + * + * @private + * @param {Object} cache The cache to search. + * @param {*} value The value to search for. + * @returns {number} Returns `0` if `value` is found, else `-1`. + */ + function cacheIndexOf(cache, value) { + var data = cache.data, + result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value]; + + return result ? 0 : -1; + } + + /** + * Adds `value` to the cache. + * + * @private + * @name push + * @memberOf SetCache + * @param {*} value The value to cache. + */ + function cachePush(value) { + var data = this.data; + if (typeof value == 'string' || isObject(value)) { + data.set.add(value); + } else { + data.hash[value] = true; + } + } + + /** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ + function arrayCopy(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; + } + + /** + * A specialized version of `_.forEach` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.forEachRight` for arrays without support for + * callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEachRight(array, iteratee) { + var length = array.length; + + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.every` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + */ + function arrayEvery(array, predicate) { + var index = -1, + length = array.length; + + while (++index < length) { + if (!predicate(array[index], index, array)) { + return false; + } + } + return true; + } + + /** + * A specialized version of `_.filter` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function arrayFilter(array, predicate) { + var index = -1, + length = array.length, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[++resIndex] = value; + } + } + return result; + } + + /** + * A specialized version of `_.map` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + /** + * A specialized version of `_.max` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {*} Returns the maximum value. + */ + function arrayMax(array) { + var index = -1, + length = array.length, + result = NEGATIVE_INFINITY; + + while (++index < length) { + var value = array[index]; + if (value > result) { + result = value; + } + } + return result; + } + + /** + * A specialized version of `_.min` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {*} Returns the minimum value. + */ + function arrayMin(array) { + var index = -1, + length = array.length, + result = POSITIVE_INFINITY; + + while (++index < length) { + var value = array[index]; + if (value < result) { + result = value; + } + } + return result; + } + + /** + * A specialized version of `_.reduce` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initFromArray] Specify using the first element of `array` + * as the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduce(array, iteratee, accumulator, initFromArray) { + var index = -1, + length = array.length; + + if (initFromArray && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; + } + + /** + * A specialized version of `_.reduceRight` for arrays without support for + * callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initFromArray] Specify using the last element of `array` + * as the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduceRight(array, iteratee, accumulator, initFromArray) { + var length = array.length; + if (initFromArray && length) { + accumulator = array[--length]; + } + while (length--) { + accumulator = iteratee(accumulator, array[length], length, array); + } + return accumulator; + } + + /** + * A specialized version of `_.some` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function arraySome(array, predicate) { + var index = -1, + length = array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; + } + + /** + * A specialized version of `_.sum` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {number} Returns the sum. + */ + function arraySum(array) { + var length = array.length, + result = 0; + + while (length--) { + result += +array[length] || 0; + } + return result; + } + + /** + * Used by `_.defaults` to customize its `_.assign` use. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @returns {*} Returns the value to assign to the destination object. + */ + function assignDefaults(objectValue, sourceValue) { + return objectValue === undefined ? sourceValue : objectValue; + } + + /** + * Used by `_.template` to customize its `_.assign` use. + * + * **Note:** This function is like `assignDefaults` except that it ignores + * inherited property values when checking if a property is `undefined`. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @param {string} key The key associated with the object and source values. + * @param {Object} object The destination object. + * @returns {*} Returns the value to assign to the destination object. + */ + function assignOwnDefaults(objectValue, sourceValue, key, object) { + return (objectValue === undefined || !hasOwnProperty.call(object, key)) + ? sourceValue + : objectValue; + } + + /** + * A specialized version of `_.assign` for customizing assigned values without + * support for argument juggling, multiple sources, and `this` binding `customizer` + * functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + */ + function assignWith(object, source, customizer) { + var props = keys(source); + push.apply(props, getSymbols(source)); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index], + value = object[key], + result = customizer(value, source[key], key, object, source); + + if ((result === result ? (result !== value) : (value === value)) || + (value === undefined && !(key in object))) { + object[key] = result; + } + } + return object; + } + + /** + * The base implementation of `_.assign` without support for argument juggling, + * multiple sources, and `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + var baseAssign = nativeAssign || function(object, source) { + return source == null + ? object + : baseCopy(source, getSymbols(source), baseCopy(source, keys(source), object)); + }; + + /** + * The base implementation of `_.at` without support for string collections + * and individual key arguments. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {number[]|string[]} props The property names or indexes of elements to pick. + * @returns {Array} Returns the new array of picked elements. + */ + function baseAt(collection, props) { + var index = -1, + isNil = collection == null, + isArr = !isNil && isArrayLike(collection), + length = isArr && collection.length, + propsLength = props.length, + result = Array(propsLength); + + while(++index < propsLength) { + var key = props[index]; + if (isArr) { + result[index] = isIndex(key, length) ? collection[key] : undefined; + } else { + result[index] = isNil ? undefined : collection[key]; + } + } + return result; + } + + /** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property names to copy. + * @param {Object} [object={}] The object to copy properties to. + * @returns {Object} Returns `object`. + */ + function baseCopy(source, props, object) { + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + object[key] = source[key]; + } + return object; + } + + /** + * The base implementation of `_.callback` which supports specifying the + * number of arguments to provide to `func`. + * + * @private + * @param {*} [func=_.identity] The value to convert to a callback. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {number} [argCount] The number of arguments to provide to `func`. + * @returns {Function} Returns the callback. + */ + function baseCallback(func, thisArg, argCount) { + var type = typeof func; + if (type == 'function') { + return thisArg === undefined + ? func + : bindCallback(func, thisArg, argCount); + } + if (func == null) { + return identity; + } + if (type == 'object') { + return baseMatches(func); + } + return thisArg === undefined + ? property(func) + : baseMatchesProperty(func, thisArg); + } + + /** + * The base implementation of `_.clone` without support for argument juggling + * and `this` binding `customizer` functions. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @param {Function} [customizer] The function to customize cloning values. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The object `value` belongs to. + * @param {Array} [stackA=[]] Tracks traversed source objects. + * @param {Array} [stackB=[]] Associates clones with source counterparts. + * @returns {*} Returns the cloned value. + */ + function baseClone(value, isDeep, customizer, key, object, stackA, stackB) { + var result; + if (customizer) { + result = object ? customizer(value, key, object) : customizer(value); + } + if (result !== undefined) { + return result; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result = initCloneArray(value); + if (!isDeep) { + return arrayCopy(value, result); + } + } else { + var tag = objToString.call(value), + isFunc = tag == funcTag; + + if (tag == objectTag || tag == argsTag || (isFunc && !object)) { + result = initCloneObject(isFunc ? {} : value); + if (!isDeep) { + return baseAssign(result, value); + } + } else { + return cloneableTags[tag] + ? initCloneByTag(value, tag, isDeep) + : (object ? value : {}); + } + } + // Check for circular references and return corresponding clone. + stackA || (stackA = []); + stackB || (stackB = []); + + var length = stackA.length; + while (length--) { + if (stackA[length] == value) { + return stackB[length]; + } + } + // Add the source value to the stack of traversed objects and associate it with its clone. + stackA.push(value); + stackB.push(result); + + // Recursively populate clone (susceptible to call stack limits). + (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { + result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB); + }); + return result; + } + + /** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ + var baseCreate = (function() { + function Object() {} + return function(prototype) { + if (isObject(prototype)) { + Object.prototype = prototype; + var result = new Object; + Object.prototype = null; + } + return result || context.Object(); + }; + }()); + + /** + * The base implementation of `_.delay` and `_.defer` which accepts an index + * of where to slice the arguments to provide to `func`. + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Object} args The arguments provide to `func`. + * @returns {number} Returns the timer id. + */ + function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined, args); }, wait); + } + + /** + * The base implementation of `_.difference` which accepts a single array + * of values to exclude. + * + * @private + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @returns {Array} Returns the new array of filtered values. + */ + function baseDifference(array, values) { + var length = array ? array.length : 0, + result = []; + + if (!length) { + return result; + } + var index = -1, + indexOf = getIndexOf(), + isCommon = indexOf == baseIndexOf, + cache = (isCommon && values.length >= 200) ? createCache(values) : null, + valuesLength = values.length; + + if (cache) { + indexOf = cacheIndexOf; + isCommon = false; + values = cache; + } + outer: + while (++index < length) { + var value = array[index]; + + if (isCommon && value === value) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === value) { + continue outer; + } + } + result.push(value); + } + else if (indexOf(values, value, 0) < 0) { + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.forEach` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object|string} Returns `collection`. + */ + var baseEach = createBaseEach(baseForOwn); + + /** + * The base implementation of `_.forEachRight` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object|string} Returns `collection`. + */ + var baseEachRight = createBaseEach(baseForOwnRight, true); + + /** + * The base implementation of `_.every` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` + */ + function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function(value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; + } + + /** + * The base implementation of `_.fill` without an iteratee call guard. + * + * @private + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ + function baseFill(array, value, start, end) { + var length = array.length; + + start = start == null ? 0 : (+start || 0); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : (+end || 0); + if (end < 0) { + end += length; + } + length = start > end ? 0 : (end >>> 0); + start >>>= 0; + + while (start < length) { + array[start++] = value; + } + return array; + } + + /** + * The base implementation of `_.filter` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; + } + + /** + * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, + * without support for callback shorthands and `this` binding, which iterates + * over `collection` using the provided `eachFunc`. + * + * @private + * @param {Array|Object|string} collection The collection to search. + * @param {Function} predicate The function invoked per iteration. + * @param {Function} eachFunc The function to iterate over `collection`. + * @param {boolean} [retKey] Specify returning the key of the found element + * instead of the element itself. + * @returns {*} Returns the found element or its key, else `undefined`. + */ + function baseFind(collection, predicate, eachFunc, retKey) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = retKey ? key : value; + return false; + } + }); + return result; + } + + /** + * The base implementation of `_.flatten` with added support for restricting + * flattening and specifying the start index. + * + * @private + * @param {Array} array The array to flatten. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, isDeep, isStrict) { + var index = -1, + length = array.length, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (isObjectLike(value) && isArrayLike(value) && + (isStrict || isArray(value) || isArguments(value))) { + if (isDeep) { + // Recursively flatten arrays (susceptible to call stack limits). + value = baseFlatten(value, isDeep, isStrict); + } + var valIndex = -1, + valLength = value.length; + + while (++valIndex < valLength) { + result[++resIndex] = value[valIndex]; + } + } else if (!isStrict) { + result[++resIndex] = value; + } + } + return result; + } + + /** + * The base implementation of `baseForIn` and `baseForOwn` which iterates + * over `object` properties returned by `keysFunc` invoking `iteratee` for + * each property. Iteratee functions may exit iteration early by explicitly + * returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseFor = createBaseFor(); + + /** + * This function is like `baseFor` except that it iterates over properties + * in the opposite order. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseForRight = createBaseFor(true); + + /** + * The base implementation of `_.forIn` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForIn(object, iteratee) { + return baseFor(object, iteratee, keysIn); + } + + /** + * The base implementation of `_.forOwn` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwn(object, iteratee) { + return baseFor(object, iteratee, keys); + } + + /** + * The base implementation of `_.forOwnRight` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwnRight(object, iteratee) { + return baseForRight(object, iteratee, keys); + } + + /** + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from those provided. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the new array of filtered property names. + */ + function baseFunctions(object, props) { + var index = -1, + length = props.length, + resIndex = -1, + result = []; + + while (++index < length) { + var key = props[index]; + if (isFunction(object[key])) { + result[++resIndex] = key; + } + } + return result; + } + + /** + * The base implementation of `get` without support for string paths + * and default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path of the property to get. + * @param {string} [pathKey] The key representation of path. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path, pathKey) { + if (object == null) { + return; + } + if (pathKey !== undefined && pathKey in toObject(object)) { + path = [pathKey]; + } + var index = -1, + length = path.length; + + while (object != null && ++index < length) { + object = object[path[index]]; + } + return (index && index == length) ? object : undefined; + } + + /** + * The base implementation of `_.isEqual` without support for `this` binding + * `customizer` functions. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparing values. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA] Tracks traversed `value` objects. + * @param {Array} [stackB] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ + function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { + // Exit early for identical values. + if (value === other) { + return true; + } + var valType = typeof value, + othType = typeof other; + + // Exit early for unlike primitive values. + if ((valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object') || + value == null || other == null) { + // Return `false` unless both values are `NaN`. + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); + } + + /** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparing objects. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA=[]] Tracks traversed `value` objects. + * @param {Array} [stackB=[]] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = arrayTag, + othTag = arrayTag; + + if (!objIsArr) { + objTag = objToString.call(object); + if (objTag == argsTag) { + objTag = objectTag; + } else if (objTag != objectTag) { + objIsArr = isTypedArray(object); + } + } + if (!othIsArr) { + othTag = objToString.call(other); + if (othTag == argsTag) { + othTag = objectTag; + } else if (othTag != objectTag) { + othIsArr = isTypedArray(other); + } + } + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && !(objIsArr || objIsObj)) { + return equalByTag(object, other, objTag); + } + if (!isLoose) { + var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (valWrapped || othWrapped) { + return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); + } + } + if (!isSameTag) { + return false; + } + // Assume cyclic values are equal. + // For more information on detecting circular references see https://es5.github.io/#JO. + stackA || (stackA = []); + stackB || (stackB = []); + + var length = stackA.length; + while (length--) { + if (stackA[length] == object) { + return stackB[length] == other; + } + } + // Add `object` and `other` to the stack of traversed objects. + stackA.push(object); + stackB.push(other); + + var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); + + stackA.pop(); + stackB.pop(); + + return result; + } + + /** + * The base implementation of `_.isMatch` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The source property names to match. + * @param {Array} values The source values to match. + * @param {Array} strictCompareFlags Strict comparison flags for source values. + * @param {Function} [customizer] The function to customize comparing objects. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ + function baseIsMatch(object, props, values, strictCompareFlags, customizer) { + var index = -1, + length = props.length, + noCustomizer = !customizer; + + while (++index < length) { + if ((noCustomizer && strictCompareFlags[index]) + ? values[index] !== object[props[index]] + : !(props[index] in object) + ) { + return false; + } + } + index = -1; + while (++index < length) { + var key = props[index], + objValue = object[key], + srcValue = values[index]; + + if (noCustomizer && strictCompareFlags[index]) { + var result = objValue !== undefined || (key in object); + } else { + result = customizer ? customizer(objValue, srcValue, key) : undefined; + if (result === undefined) { + result = baseIsEqual(srcValue, objValue, customizer, true); + } + } + if (!result) { + return false; + } + } + return true; + } + + /** + * The base implementation of `_.map` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; + } + + /** + * The base implementation of `_.matches` which does not clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new function. + */ + function baseMatches(source) { + var props = keys(source), + length = props.length; + + if (!length) { + return constant(true); + } + if (length == 1) { + var key = props[0], + value = source[key]; + + if (isStrictComparable(value)) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === value && (value !== undefined || (key in toObject(object))); + }; + } + } + var values = Array(length), + strictCompareFlags = Array(length); + + while (length--) { + value = source[props[length]]; + values[length] = value; + strictCompareFlags[length] = isStrictComparable(value); + } + return function(object) { + return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); + }; + } + + /** + * The base implementation of `_.matchesProperty` which does not which does + * not clone `value`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} value The value to compare. + * @returns {Function} Returns the new function. + */ + function baseMatchesProperty(path, value) { + var isArr = isArray(path), + isCommon = isKey(path) && isStrictComparable(value), + pathKey = (path + ''); + + path = toPath(path); + return function(object) { + if (object == null) { + return false; + } + var key = pathKey; + object = toObject(object); + if ((isArr || !isCommon) && !(key in object)) { + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + if (object == null) { + return false; + } + key = last(path); + object = toObject(object); + } + return object[key] === value + ? (value !== undefined || (key in object)) + : baseIsEqual(value, object[key], null, true); + }; + } + + /** + * The base implementation of `_.merge` without support for argument juggling, + * multiple sources, and `this` binding `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {Function} [customizer] The function to customize merging properties. + * @param {Array} [stackA=[]] Tracks traversed source objects. + * @param {Array} [stackB=[]] Associates values with source counterparts. + * @returns {Object} Returns `object`. + */ + function baseMerge(object, source, customizer, stackA, stackB) { + if (!isObject(object)) { + return object; + } + var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)); + if (!isSrcArr) { + var props = keys(source); + push.apply(props, getSymbols(source)); + } + arrayEach(props || source, function(srcValue, key) { + if (props) { + key = srcValue; + srcValue = source[key]; + } + if (isObjectLike(srcValue)) { + stackA || (stackA = []); + stackB || (stackB = []); + baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); + } + else { + var value = object[key], + result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = result === undefined; + + if (isCommon) { + result = srcValue; + } + if ((isSrcArr || result !== undefined) && + (isCommon || (result === result ? (result !== value) : (value === value)))) { + object[key] = result; + } + } + }); + return object; + } + + /** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize merging properties. + * @param {Array} [stackA=[]] Tracks traversed source objects. + * @param {Array} [stackB=[]] Associates values with source counterparts. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) { + var length = stackA.length, + srcValue = source[key]; + + while (length--) { + if (stackA[length] == srcValue) { + object[key] = stackB[length]; + return; + } + } + var value = object[key], + result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = result === undefined; + + if (isCommon) { + result = srcValue; + if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) { + result = isArray(value) + ? value + : (isArrayLike(value) ? arrayCopy(value) : []); + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + result = isArguments(value) + ? toPlainObject(value) + : (isPlainObject(value) ? value : {}); + } + else { + isCommon = false; + } + } + // Add the source value to the stack of traversed objects and associate + // it with its merged value. + stackA.push(srcValue); + stackB.push(result); + + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB); + } else if (result === result ? (result !== value) : (value === value)) { + object[key] = result; + } + } + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + */ + function basePropertyDeep(path) { + var pathKey = (path + ''); + path = toPath(path); + return function(object) { + return baseGet(object, path, pathKey); + }; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * index arguments and capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0; + while (length--) { + var index = parseFloat(indexes[length]); + if (index != previous && isIndex(index)) { + var previous = index; + splice.call(array, index, 1); + } + } + return array; + } + + /** + * The base implementation of `_.random` without support for argument juggling + * and returning floating-point numbers. + * + * @private + * @param {number} min The minimum possible value. + * @param {number} max The maximum possible value. + * @returns {number} Returns the random number. + */ + function baseRandom(min, max) { + return min + floor(nativeRandom() * (max - min + 1)); + } + + /** + * The base implementation of `_.reduce` and `_.reduceRight` without support + * for callback shorthands and `this` binding, which iterates over `collection` + * using the provided `eachFunc`. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initFromCollection Specify using the first or last element + * of `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. + */ + function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initFromCollection + ? (initFromCollection = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; + } + + /** + * The base implementation of `setData` without support for hot loop detection. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var baseSetData = !metaMap ? identity : function(func, data) { + metaMap.set(func, data); + return func; + }; + + /** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + start = start == null ? 0 : (+start || 0); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : (+end || 0); + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; + } + + /** + * The base implementation of `_.some` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function baseSome(collection, predicate) { + var result; + + baseEach(collection, function(value, index, collection) { + result = predicate(value, index, collection); + return !result; + }); + return !!result; + } + + /** + * The base implementation of `_.sortBy` which uses `comparer` to define + * the sort order of `array` and replaces criteria objects with their + * corresponding values. + * + * @private + * @param {Array} array The array to sort. + * @param {Function} comparer The function to define sort order. + * @returns {Array} Returns `array`. + */ + function baseSortBy(array, comparer) { + var length = array.length; + + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; + } + + /** + * The base implementation of `_.sortByOrder` without param guards. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {boolean[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. + */ + function baseSortByOrder(collection, iteratees, orders) { + var callback = getCallback(), + index = -1; + + iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); }); + + var result = baseMap(collection, function(value) { + var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; + }); + + return baseSortBy(result, function(object, other) { + return compareMultiple(object, other, orders); + }); + } + + /** + * The base implementation of `_.sum` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. + */ + function baseSum(collection, iteratee) { + var result = 0; + baseEach(collection, function(value, index, collection) { + result += +iteratee(value, index, collection) || 0; + }); + return result; + } + + /** + * The base implementation of `_.uniq` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The function invoked per iteration. + * @returns {Array} Returns the new duplicate-value-free array. + */ + function baseUniq(array, iteratee) { + var index = -1, + indexOf = getIndexOf(), + length = array.length, + isCommon = indexOf == baseIndexOf, + isLarge = isCommon && length >= 200, + seen = isLarge ? createCache() : null, + result = []; + + if (seen) { + indexOf = cacheIndexOf; + isCommon = false; + } else { + isLarge = false; + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value, index, array) : value; + + if (isCommon && value === value) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (indexOf(seen, computed, 0) < 0) { + if (iteratee || isLarge) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ + function baseValues(object, props) { + var index = -1, + length = props.length, + result = Array(length); + + while (++index < length) { + result[index] = object[props[index]]; + } + return result; + } + + /** + * The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`, + * and `_.takeWhile` without support for callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. + */ + function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} + return isDrop + ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) + : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); + } + + /** + * The base implementation of `wrapperValue` which returns the result of + * performing a sequence of actions on the unwrapped `value`, where each + * successive action is supplied the return value of the previous. + * + * @private + * @param {*} value The unwrapped value. + * @param {Array} actions Actions to peform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. + */ + function baseWrapperValue(value, actions) { + var result = value; + if (result instanceof LazyWrapper) { + result = result.value(); + } + var index = -1, + length = actions.length; + + while (++index < length) { + var args = [result], + action = actions[index]; + + push.apply(args, action.args); + result = action.func.apply(action.thisArg, args); + } + return result; + } + + /** + * Performs a binary search of `array` to determine the index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function binaryIndex(array, value, retHighest) { + var low = 0, + high = array ? array.length : low; + + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; + + if (retHighest ? (computed <= value) : (computed < value)) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return binaryIndexBy(array, value, identity, retHighest); + } + + /** + * This function is like `binaryIndex` except that it invokes `iteratee` for + * `value` and each element of `array` to compute their sort ranking. The + * iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The function invoked per iteration. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function binaryIndexBy(array, value, iteratee, retHighest) { + value = iteratee(value); + + var low = 0, + high = array ? array.length : 0, + valIsNaN = value !== value, + valIsUndef = value === undefined; + + while (low < high) { + var mid = floor((low + high) / 2), + computed = iteratee(array[mid]), + isReflexive = computed === computed; + + if (valIsNaN) { + var setLow = isReflexive || retHighest; + } else if (valIsUndef) { + setLow = isReflexive && (retHighest || computed !== undefined); + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); + } + + /** + * A specialized version of `baseCallback` which only supports `this` binding + * and specifying the number of arguments to provide to `func`. + * + * @private + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {number} [argCount] The number of arguments to provide to `func`. + * @returns {Function} Returns the callback. + */ + function bindCallback(func, thisArg, argCount) { + if (typeof func != 'function') { + return identity; + } + if (thisArg === undefined) { + return func; + } + switch (argCount) { + case 1: return function(value) { + return func.call(thisArg, value); + }; + case 3: return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; + case 4: return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + case 5: return function(value, other, key, object, source) { + return func.call(thisArg, value, other, key, object, source); + }; + } + return function() { + return func.apply(thisArg, arguments); + }; + } + + /** + * Creates a clone of the given array buffer. + * + * @private + * @param {ArrayBuffer} buffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ + function bufferClone(buffer) { + return bufferSlice.call(buffer, 0); + } + if (!bufferSlice) { + // PhantomJS has `ArrayBuffer` and `Uint8Array` but not `Float64Array`. + bufferClone = !(ArrayBuffer && Uint8Array) ? constant(null) : function(buffer) { + var byteLength = buffer.byteLength, + floatLength = Float64Array ? floor(byteLength / FLOAT64_BYTES_PER_ELEMENT) : 0, + offset = floatLength * FLOAT64_BYTES_PER_ELEMENT, + result = new ArrayBuffer(byteLength); + + if (floatLength) { + var view = new Float64Array(result, 0, floatLength); + view.set(new Float64Array(buffer, 0, floatLength)); + } + if (byteLength != offset) { + view = new Uint8Array(result, offset); + view.set(new Uint8Array(buffer, offset)); + } + return result; + }; + } + + /** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array|Object} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgs(args, partials, holders) { + var holdersLength = holders.length, + argsIndex = -1, + argsLength = nativeMax(args.length - holdersLength, 0), + leftIndex = -1, + leftLength = partials.length, + result = Array(argsLength + leftLength); + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + while (argsLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; + } + + /** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array|Object} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgsRight(args, partials, holders) { + var holdersIndex = -1, + holdersLength = holders.length, + argsIndex = -1, + argsLength = nativeMax(args.length - holdersLength, 0), + rightIndex = -1, + rightLength = partials.length, + result = Array(argsLength + rightLength); + + while (++argsIndex < argsLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + return result; + } + + /** + * Creates a function that aggregates a collection, creating an accumulator + * object composed from the results of running each element in the collection + * through an iteratee. + * + * **Note:** This function is used to create `_.countBy`, `_.groupBy`, `_.indexBy`, + * and `_.partition`. + * + * @private + * @param {Function} setter The function to set keys and values of the accumulator object. + * @param {Function} [initializer] The function to initialize the accumulator object. + * @returns {Function} Returns the new aggregator function. + */ + function createAggregator(setter, initializer) { + return function(collection, iteratee, thisArg) { + var result = initializer ? initializer() : {}; + iteratee = getCallback(iteratee, thisArg, 3); + + if (isArray(collection)) { + var index = -1, + length = collection.length; + + while (++index < length) { + var value = collection[index]; + setter(result, value, iteratee(value, index, collection), collection); + } + } else { + baseEach(collection, function(value, key, collection) { + setter(result, value, iteratee(value, key, collection), collection); + }); + } + return result; + }; + } + + /** + * Creates a function that assigns properties of source object(s) to a given + * destination object. + * + * **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return restParam(function(object, sources) { + var index = -1, + length = object == null ? 0 : sources.length, + customizer = length > 2 && sources[length - 2], + guard = length > 2 && sources[2], + thisArg = length > 1 && sources[length - 1]; + + if (typeof customizer == 'function') { + customizer = bindCallback(customizer, thisArg, 5); + length -= 2; + } else { + customizer = typeof thisArg == 'function' ? thisArg : null; + length -= (customizer ? 1 : 0); + } + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? null : customizer; + length = 1; + } + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, customizer); + } + } + return object; + }); + } + + /** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { + return eachFunc(collection, iteratee); + } + var index = fromRight ? length : -1, + iterable = toObject(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + + /** + * Creates a base function for `_.forIn` or `_.forInRight`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var iterable = toObject(object), + props = keysFunc(object), + length = props.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length)) { + var key = props[index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** + * Creates a function that wraps `func` and invokes it with the `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to bind. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new bound function. + */ + function createBindWrapper(func, thisArg) { + var Ctor = createCtorWrapper(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(thisArg, arguments); + } + return wrapper; + } + + /** + * Creates a `Set` cache object to optimize linear searches of large arrays. + * + * @private + * @param {Array} [values] The values to cache. + * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. + */ + var createCache = !(nativeCreate && Set) ? constant(null) : function(values) { + return new SetCache(values); + }; + + /** + * Creates a function that produces compound words out of the words in a + * given string. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ + function createCompounder(callback) { + return function(string) { + var index = -1, + array = words(deburr(string)), + length = array.length, + result = ''; + + while (++index < length) { + result = callback(result, array[index], index); + } + return result; + }; + } + + /** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ + function createCtorWrapper(Ctor) { + return function() { + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, arguments); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; + } + + /** + * Creates a `_.curry` or `_.curryRight` function. + * + * @private + * @param {boolean} flag The curry bit flag. + * @returns {Function} Returns the new curry function. + */ + function createCurry(flag) { + function curryFunc(func, arity, guard) { + if (guard && isIterateeCall(func, arity, guard)) { + arity = null; + } + var result = createWrapper(func, flag, null, null, null, null, null, arity); + result.placeholder = curryFunc.placeholder; + return result; + } + return curryFunc; + } + + /** + * Creates a `_.max` or `_.min` function. + * + * @private + * @param {Function} arrayFunc The function to get the extremum value from an array. + * @param {boolean} [isMin] Specify returning the minimum, instead of the maximum, + * extremum value. + * @returns {Function} Returns the new extremum function. + */ + function createExtremum(arrayFunc, isMin) { + return function(collection, iteratee, thisArg) { + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var func = getCallback(), + noIteratee = iteratee == null; + + if (!(func === baseCallback && noIteratee)) { + noIteratee = false; + iteratee = func(iteratee, thisArg, 3); + } + if (noIteratee) { + var isArr = isArray(collection); + if (!isArr && isString(collection)) { + iteratee = charAtCallback; + } else { + return arrayFunc(isArr ? collection : toIterable(collection)); + } + } + return extremumBy(collection, iteratee, isMin); + }; + } + + /** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new find function. + */ + function createFind(eachFunc, fromRight) { + return function(collection, predicate, thisArg) { + predicate = getCallback(predicate, thisArg, 3); + if (isArray(collection)) { + var index = baseFindIndex(collection, predicate, fromRight); + return index > -1 ? collection[index] : undefined; + } + return baseFind(collection, predicate, eachFunc); + }; + } + + /** + * Creates a `_.findIndex` or `_.findLastIndex` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new find function. + */ + function createFindIndex(fromRight) { + return function(array, predicate, thisArg) { + if (!(array && array.length)) { + return -1; + } + predicate = getCallback(predicate, thisArg, 3); + return baseFindIndex(array, predicate, fromRight); + }; + } + + /** + * Creates a `_.findKey` or `_.findLastKey` function. + * + * @private + * @param {Function} objectFunc The function to iterate over an object. + * @returns {Function} Returns the new find function. + */ + function createFindKey(objectFunc) { + return function(object, predicate, thisArg) { + predicate = getCallback(predicate, thisArg, 3); + return baseFind(object, predicate, objectFunc, true); + }; + } + + /** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ + function createFlow(fromRight) { + return function() { + var length = arguments.length; + if (!length) { + return function() { return arguments[0]; }; + } + var wrapper, + index = fromRight ? length : -1, + leftIndex = 0, + funcs = Array(length); + + while ((fromRight ? index-- : ++index < length)) { + var func = funcs[leftIndex++] = arguments[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var funcName = wrapper ? '' : getFuncName(func); + wrapper = funcName == 'wrapper' ? new LodashWrapper([]) : wrapper; + } + index = wrapper ? -1 : length; + while (++index < length) { + func = funcs[index]; + funcName = getFuncName(func); + + var data = funcName == 'wrapper' ? getData(func) : null; + if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { + wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); + } else { + wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); + } + } + return function() { + var args = arguments; + if (wrapper && args.length == 1 && isArray(args[0])) { + return wrapper.plant(args[0]).value(); + } + var index = 0, + result = funcs[index].apply(this, args); + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }; + } + + /** + * Creates a function for `_.forEach` or `_.forEachRight`. + * + * @private + * @param {Function} arrayFunc The function to iterate over an array. + * @param {Function} eachFunc The function to iterate over a collection. + * @returns {Function} Returns the new each function. + */ + function createForEach(arrayFunc, eachFunc) { + return function(collection, iteratee, thisArg) { + return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) + ? arrayFunc(collection, iteratee) + : eachFunc(collection, bindCallback(iteratee, thisArg, 3)); + }; + } + + /** + * Creates a function for `_.forIn` or `_.forInRight`. + * + * @private + * @param {Function} objectFunc The function to iterate over an object. + * @returns {Function} Returns the new each function. + */ + function createForIn(objectFunc) { + return function(object, iteratee, thisArg) { + if (typeof iteratee != 'function' || thisArg !== undefined) { + iteratee = bindCallback(iteratee, thisArg, 3); + } + return objectFunc(object, iteratee, keysIn); + }; + } + + /** + * Creates a function for `_.forOwn` or `_.forOwnRight`. + * + * @private + * @param {Function} objectFunc The function to iterate over an object. + * @returns {Function} Returns the new each function. + */ + function createForOwn(objectFunc) { + return function(object, iteratee, thisArg) { + if (typeof iteratee != 'function' || thisArg !== undefined) { + iteratee = bindCallback(iteratee, thisArg, 3); + } + return objectFunc(object, iteratee); + }; + } + + /** + * Creates a function for `_.mapKeys` or `_.mapValues`. + * + * @private + * @param {boolean} [isMapKeys] Specify mapping keys instead of values. + * @returns {Function} Returns the new map function. + */ + function createObjectMapper(isMapKeys) { + return function(object, iteratee, thisArg) { + var result = {}; + iteratee = getCallback(iteratee, thisArg, 3); + + baseForOwn(object, function(value, key, object) { + var mapped = iteratee(value, key, object); + key = isMapKeys ? mapped : key; + value = isMapKeys ? value : mapped; + result[key] = value; + }); + return result; + }; + } + + /** + * Creates a function for `_.padLeft` or `_.padRight`. + * + * @private + * @param {boolean} [fromRight] Specify padding from the right. + * @returns {Function} Returns the new pad function. + */ + function createPadDir(fromRight) { + return function(string, length, chars) { + string = baseToString(string); + return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); + }; + } + + /** + * Creates a `_.partial` or `_.partialRight` function. + * + * @private + * @param {boolean} flag The partial bit flag. + * @returns {Function} Returns the new partial function. + */ + function createPartial(flag) { + var partialFunc = restParam(function(func, partials) { + var holders = replaceHolders(partials, partialFunc.placeholder); + return createWrapper(func, flag, null, partials, holders); + }); + return partialFunc; + } + + /** + * Creates a function for `_.reduce` or `_.reduceRight`. + * + * @private + * @param {Function} arrayFunc The function to iterate over an array. + * @param {Function} eachFunc The function to iterate over a collection. + * @returns {Function} Returns the new each function. + */ + function createReduce(arrayFunc, eachFunc) { + return function(collection, iteratee, accumulator, thisArg) { + var initFromArray = arguments.length < 3; + return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) + ? arrayFunc(collection, iteratee, accumulator, initFromArray) + : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc); + }; + } + + /** + * Creates a function that wraps `func` and invokes it with optional `this` + * binding of, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to reference. + * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & ARY_FLAG, + isBind = bitmask & BIND_FLAG, + isBindKey = bitmask & BIND_KEY_FLAG, + isCurry = bitmask & CURRY_FLAG, + isCurryBound = bitmask & CURRY_BOUND_FLAG, + isCurryRight = bitmask & CURRY_RIGHT_FLAG; + + var Ctor = !isBindKey && createCtorWrapper(func), + key = func; + + function wrapper() { + // Avoid `arguments` object use disqualifying optimizations by + // converting it to an array before providing it to other functions. + var length = arguments.length, + index = length, + args = Array(length); + + while (index--) { + args[index] = arguments[index]; + } + if (partials) { + args = composeArgs(args, partials, holders); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight); + } + if (isCurry || isCurryRight) { + var placeholder = wrapper.placeholder, + argsHolders = replaceHolders(args, placeholder); + + length -= argsHolders.length; + if (length < arity) { + var newArgPos = argPos ? arrayCopy(argPos) : null, + newArity = nativeMax(arity - length, 0), + newsHolders = isCurry ? argsHolders : null, + newHoldersRight = isCurry ? null : argsHolders, + newPartials = isCurry ? args : null, + newPartialsRight = isCurry ? null : args; + + bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); + + if (!isCurryBound) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity], + result = createHybridWrapper.apply(undefined, newData); + + if (isLaziable(func)) { + setData(result, newData); + } + result.placeholder = placeholder; + return result; + } + } + var thisBinding = isBind ? thisArg : this; + if (isBindKey) { + func = thisBinding[key]; + } + if (argPos) { + args = reorder(args, argPos); + } + if (isAry && ary < args.length) { + args.length = ary; + } + var fn = (this && this !== root && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func; + return fn.apply(thisBinding, args); + } + return wrapper; + } + + /** + * Creates the padding required for `string` based on the given `length`. + * The `chars` string is truncated if the number of characters exceeds `length`. + * + * @private + * @param {string} string The string to create padding for. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the pad for `string`. + */ + function createPadding(string, length, chars) { + var strLength = string.length; + length = +length; + + if (strLength >= length || !nativeIsFinite(length)) { + return ''; + } + var padLength = length - strLength; + chars = chars == null ? ' ' : (chars + ''); + return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); + } + + /** + * Creates a function that wraps `func` and invokes it with the optional `this` + * binding of `thisArg` and the `partials` prepended to those provided to + * the wrapper. + * + * @private + * @param {Function} func The function to partially apply arguments to. + * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to the new function. + * @returns {Function} Returns the new bound function. + */ + function createPartialWrapper(func, bitmask, thisArg, partials) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtorWrapper(func); + + function wrapper() { + // Avoid `arguments` object use disqualifying optimizations by + // converting it to an array before providing it `func`. + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(argsLength + leftLength); + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, args); + } + return wrapper; + } + + /** + * Creates a `_.sortedIndex` or `_.sortedLastIndex` function. + * + * @private + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {Function} Returns the new index function. + */ + function createSortedIndex(retHighest) { + return function(array, value, iteratee, thisArg) { + var func = getCallback(iteratee); + return (func === baseCallback && iteratee == null) + ? binaryIndex(array, value, retHighest) + : binaryIndexBy(array, value, func(iteratee, thisArg, 1), retHighest); + }; + } + + /** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to reference. + * @param {number} bitmask The bitmask of flags. + * The bitmask may be composed of the following flags: + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); + partials = holders = null; + } + length -= (holders ? holders.length : 0); + if (bitmask & PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = null; + } + var data = isBindKey ? null : getData(func), + newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; + + if (data) { + mergeData(newData, data); + bitmask = newData[1]; + arity = newData[9]; + } + newData[9] = arity == null + ? (isBindKey ? 0 : func.length) + : (nativeMax(arity - length, 0) || 0); + + if (bitmask == BIND_FLAG) { + var result = createBindWrapper(newData[0], newData[2]); + } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) { + result = createPartialWrapper.apply(undefined, newData); + } else { + result = createHybridWrapper.apply(undefined, newData); + } + var setter = data ? baseSetData : setData; + return setter(result, newData); + } + + /** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparing arrays. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA] Tracks traversed `value` objects. + * @param {Array} [stackB] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ + function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { + var index = -1, + arrLength = array.length, + othLength = other.length, + result = true; + + if (arrLength != othLength && !(isLoose && othLength > arrLength)) { + return false; + } + // Deep compare the contents, ignoring non-numeric properties. + while (result && ++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + result = undefined; + if (customizer) { + result = isLoose + ? customizer(othValue, arrValue, index) + : customizer(arrValue, othValue, index); + } + if (result === undefined) { + // Recursively compare arrays (susceptible to call stack limits). + if (isLoose) { + var othIndex = othLength; + while (othIndex--) { + othValue = other[othIndex]; + result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); + if (result) { + break; + } + } + } else { + result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); + } + } + } + return !!result; + } + + /** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} value The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalByTag(object, other, tag) { + switch (tag) { + case boolTag: + case dateTag: + // Coerce dates and booleans to numbers, dates to milliseconds and booleans + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + return +object == +other; + + case errorTag: + return object.name == other.name && object.message == other.message; + + case numberTag: + // Treat `NaN` vs. `NaN` as equal. + return (object != +object) + ? other != +other + : object == +other; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings primitives and string + // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + return object == (other + ''); + } + return false; + } + + /** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparing values. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA] Tracks traversed `value` objects. + * @param {Array} [stackB] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { + var objProps = keys(object), + objLength = objProps.length, + othProps = keys(other), + othLength = othProps.length; + + if (objLength != othLength && !isLoose) { + return false; + } + var skipCtor = isLoose, + index = -1; + + while (++index < objLength) { + var key = objProps[index], + result = isLoose ? key in other : hasOwnProperty.call(other, key); + + if (result) { + var objValue = object[key], + othValue = other[key]; + + result = undefined; + if (customizer) { + result = isLoose + ? customizer(othValue, objValue, key) + : customizer(objValue, othValue, key); + } + if (result === undefined) { + // Recursively compare objects (susceptible to call stack limits). + result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB); + } + } + if (!result) { + return false; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (!skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + return false; + } + } + return true; + } + + /** + * Gets the extremum value of `collection` invoking `iteratee` for each value + * in `collection` to generate the criterion by which the value is ranked. + * The `iteratee` is invoked with three arguments: (value, index, collection). + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {boolean} [isMin] Specify returning the minimum, instead of the + * maximum, extremum value. + * @returns {*} Returns the extremum value. + */ + function extremumBy(collection, iteratee, isMin) { + var exValue = isMin ? POSITIVE_INFINITY : NEGATIVE_INFINITY, + computed = exValue, + result = computed; + + baseEach(collection, function(value, index, collection) { + var current = iteratee(value, index, collection); + if ((isMin ? (current < computed) : (current > computed)) || + (current === exValue && current === result)) { + computed = current; + result = value; + } + }); + return result; + } + + /** + * Gets the appropriate "callback" function. If the `_.callback` method is + * customized this function returns the custom method, otherwise it returns + * the `baseCallback` function. If arguments are provided the chosen function + * is invoked with them and its result is returned. + * + * @private + * @returns {Function} Returns the chosen function or its result. + */ + function getCallback(func, thisArg, argCount) { + var result = lodash.callback || callback; + result = result === callback ? baseCallback : result; + return argCount ? result(func, thisArg, argCount) : result; + } + + /** + * Gets metadata for `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {*} Returns the metadata for `func`. + */ + var getData = !metaMap ? noop : function(func) { + return metaMap.get(func); + }; + + /** + * Gets the name of `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {string} Returns the function name. + */ + var getFuncName = (function() { + if (!support.funcNames) { + return constant(''); + } + if (constant.name == 'constant') { + return baseProperty('name'); + } + return function(func) { + var result = func.name, + array = realNames[result], + length = array ? array.length : 0; + + while (length--) { + var data = array[length], + otherFunc = data.func; + + if (otherFunc == null || otherFunc == func) { + return data.name; + } + } + return result; + }; + }()); + + /** + * Gets the appropriate "indexOf" function. If the `_.indexOf` method is + * customized this function returns the custom method, otherwise it returns + * the `baseIndexOf` function. If arguments are provided the chosen function + * is invoked with them and its result is returned. + * + * @private + * @returns {Function|number} Returns the chosen function or its result. + */ + function getIndexOf(collection, target, fromIndex) { + var result = lodash.indexOf || indexOf; + result = result === indexOf ? baseIndexOf : result; + return collection ? result(collection, target, fromIndex) : result; + } + + /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); + + /** + * Creates an array of the own symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbols = !getOwnPropertySymbols ? constant([]) : function(object) { + return getOwnPropertySymbols(toObject(object)); + }; + + /** + * Gets the view, applying any `transforms` to the `start` and `end` positions. + * + * @private + * @param {number} start The start of the view. + * @param {number} end The end of the view. + * @param {Array} [transforms] The transformations to apply to the view. + * @returns {Object} Returns an object containing the `start` and `end` + * positions of the view. + */ + function getView(start, end, transforms) { + var index = -1, + length = transforms ? transforms.length : 0; + + while (++index < length) { + var data = transforms[index], + size = data.size; + + switch (data.type) { + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; + } + } + return { 'start': start, 'end': end }; + } + + /** + * Initializes an array clone. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the initialized clone. + */ + function initCloneArray(array) { + var length = array.length, + result = new array.constructor(length); + + // Add array properties assigned by `RegExp#exec`. + if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { + result.index = array.index; + result.input = array.input; + } + return result; + } + + /** + * Initializes an object clone. + * + * @private + * @param {Object} object The object to clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneObject(object) { + var Ctor = object.constructor; + if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) { + Ctor = Object; + } + return new Ctor; + } + + /** + * Initializes an object clone based on its `toStringTag`. + * + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to clone. + * @param {string} tag The `toStringTag` of the object to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneByTag(object, tag, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag: + return bufferClone(object); + + case boolTag: + case dateTag: + return new Ctor(+object); + + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: + var buffer = object.buffer; + return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length); + + case numberTag: + case stringTag: + return new Ctor(object); + + case regexpTag: + var result = new Ctor(object.source, reFlags.exec(object)); + result.lastIndex = object.lastIndex; + } + return result; + } + + /** + * Invokes the method at `path` on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + */ + function invokePath(object, path, args) { + if (object != null && !isKey(path, object)) { + path = toPath(path); + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + path = last(path); + } + var func = object == null ? object : object[path]; + return func == null ? undefined : func.apply(object, args); + } + + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + value = +value; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; + } + + /** + * Checks if the provided arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object)) { + var other = object[index]; + return value === value ? (value === other) : (other !== other); + } + return false; + } + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + var type = typeof value; + if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { + return true; + } + if (isArray(value)) { + return false; + } + var result = !reIsDeepProp.test(value); + return result || (object != null && value in toObject(object)); + } + + /** + * Checks if `func` has a lazy counterpart. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. + */ + function isLaziable(func) { + var funcName = getFuncName(func); + return !!funcName && func === lodash[funcName] && funcName in LazyWrapper.prototype; + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ + function isStrictComparable(value) { + return value === value && !isObject(value); + } + + /** + * Merges the function metadata of `source` into `data`. + * + * Merging metadata reduces the number of wrappers required to invoke a function. + * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` + * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` + * augment function arguments, making the order in which they are executed important, + * preventing the merging of metadata. However, we make an exception for a safe + * common case where curried functions have `_.ary` and or `_.rearg` applied. + * + * @private + * @param {Array} data The destination metadata. + * @param {Array} source The source metadata. + * @returns {Array} Returns `data`. + */ + function mergeData(data, source) { + var bitmask = data[1], + srcBitmask = source[1], + newBitmask = bitmask | srcBitmask, + isCommon = newBitmask < ARY_FLAG; + + var isCombo = + (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) || + (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) || + (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG); + + // Exit early if metadata can't be merged. + if (!(isCommon || isCombo)) { + return data; + } + // Use source `thisArg` if available. + if (srcBitmask & BIND_FLAG) { + data[2] = source[2]; + // Set when currying a bound function. + newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG; + } + // Compose partial arguments. + var value = source[3]; + if (value) { + var partials = data[3]; + data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value); + data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]); + } + // Compose partial right arguments. + value = source[5]; + if (value) { + partials = data[5]; + data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value); + data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]); + } + // Use source `argPos` if available. + value = source[7]; + if (value) { + data[7] = arrayCopy(value); + } + // Use source `ary` if it's smaller. + if (srcBitmask & ARY_FLAG) { + data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); + } + // Use source `arity` if one is not provided. + if (data[9] == null) { + data[9] = source[9]; + } + // Use source `func` and merge bitmasks. + data[0] = source[0]; + data[1] = newBitmask; + + return data; + } + + /** + * A specialized version of `_.pick` which picks `object` properties specified + * by `props`. + * + * @private + * @param {Object} object The source object. + * @param {string[]} props The property names to pick. + * @returns {Object} Returns the new object. + */ + function pickByArray(object, props) { + object = toObject(object); + + var index = -1, + length = props.length, + result = {}; + + while (++index < length) { + var key = props[index]; + if (key in object) { + result[key] = object[key]; + } + } + return result; + } + + /** + * A specialized version of `_.pick` which picks `object` properties `predicate` + * returns truthy for. + * + * @private + * @param {Object} object The source object. + * @param {Function} predicate The function invoked per iteration. + * @returns {Object} Returns the new object. + */ + function pickByCallback(object, predicate) { + var result = {}; + baseForIn(object, function(value, key, object) { + if (predicate(value, key, object)) { + result[key] = value; + } + }); + return result; + } + + /** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ + function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = arrayCopy(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; + } + + /** + * Sets metadata for `func`. + * + * **Note:** If this function becomes hot, i.e. is invoked a lot in a short + * period of time, it will trip its breaker and transition to an identity function + * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) + * for more details. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var setData = (function() { + var count = 0, + lastCalled = 0; + + return function(key, value) { + var stamp = now(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return key; + } + } else { + count = 0; + } + return baseSetData(key, value); + }; + }()); + + /** + * A fallback implementation of `_.isPlainObject` which checks if `value` + * is an object created by the `Object` constructor or has a `[[Prototype]]` + * of `null`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + */ + function shimIsPlainObject(value) { + var Ctor, + support = lodash.support; + + // Exit early for non `Object` objects. + if (!(isObjectLike(value) && objToString.call(value) == objectTag) || + (!hasOwnProperty.call(value, 'constructor') && + (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { + return false; + } + // IE < 9 iterates inherited properties before own properties. If the first + // iterated property is an object's own property then there are no inherited + // enumerable properties. + var result; + // In most environments an object's own properties are iterated before + // its inherited properties. If the last iterated property is an object's + // own property then there are no inherited enumerable properties. + baseForIn(value, function(subValue, key) { + result = key; + }); + return result === undefined || hasOwnProperty.call(value, result); + } + + /** + * A fallback implementation of `Object.keys` which creates an array of the + * own enumerable property names of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function shimKeys(object) { + var props = keysIn(object), + propsLength = props.length, + length = propsLength && object.length, + support = lodash.support; + + var allowIndexes = length && isLength(length) && + (isArray(object) || (support.nonEnumArgs && isArguments(object))); + + var index = -1, + result = []; + + while (++index < propsLength) { + var key = props[index]; + if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { + result.push(key); + } + } + return result; + } + + /** + * Converts `value` to an array-like object if it is not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array|Object} Returns the array-like object. + */ + function toIterable(value) { + if (value == null) { + return []; + } + if (!isArrayLike(value)) { + return values(value); + } + return isObject(value) ? value : Object(value); + } + + /** + * Converts `value` to an object if it is not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ + function toObject(value) { + return isObject(value) ? value : Object(value); + } + + /** + * Converts `value` to property path array if it is not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array} Returns the property path array. + */ + function toPath(value) { + if (isArray(value)) { + return value; + } + var result = []; + baseToString(value).replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + } + + /** + * Creates a clone of `wrapper`. + * + * @private + * @param {Object} wrapper The wrapper to clone. + * @returns {Object} Returns the cloned wrapper. + */ + function wrapperClone(wrapper) { + return wrapper instanceof LazyWrapper + ? wrapper.clone() + : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__)); + } + + /** + * Creates an array of elements split into groups the length of `size`. + * If `collection` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new array containing chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ + function chunk(array, size, guard) { + if (guard ? isIterateeCall(array, size, guard) : size == null) { + size = 1; + } else { + size = nativeMax(+size || 1, 1); + } + var index = 0, + length = array ? array.length : 0, + resIndex = -1, + result = Array(ceil(length / size)); + + while (index < length) { + result[++resIndex] = baseSlice(array, index, (index += size)); + } + return result; + } + + /** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ + function compact(array) { + var index = -1, + length = array ? array.length : 0, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[++resIndex] = value; + } + } + return result; + } + + /** + * Creates an array excluding all values of the provided arrays using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The arrays of values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.difference([1, 2, 3], [4, 2]); + * // => [1, 3] + */ + var difference = restParam(function(array, values) { + return isArrayLike(array) + ? baseDifference(array, baseFlatten(values, false, true)) + : []; + }); + + /** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function drop(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function dropRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that match the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [1] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active', false), 'user'); + * // => ['barney'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ + function dropRightWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, getCallback(predicate, thisArg, 3), true, true) + : []; + } + + /** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [3] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropWhile(users, 'active', false), 'user'); + * // => ['pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ + function dropWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, getCallback(predicate, thisArg, 3), true) + : []; + } + + /** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8], '*', 1, 2); + * // => [4, '*', 8] + */ + function fill(array, value, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); + } + + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(chr) { + * return chr.user == 'barney'; + * }); + * // => 0 + * + * // using the `_.matches` callback shorthand + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // using the `_.matchesProperty` callback shorthand + * _.findIndex(users, 'active', false); + * // => 0 + * + * // using the `_.property` callback shorthand + * _.findIndex(users, 'active'); + * // => 2 + */ + var findIndex = createFindIndex(); + + /** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(chr) { + * return chr.user == 'pebbles'; + * }); + * // => 2 + * + * // using the `_.matches` callback shorthand + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // using the `_.matchesProperty` callback shorthand + * _.findLastIndex(users, 'active', false); + * // => 2 + * + * // using the `_.property` callback shorthand + * _.findLastIndex(users, 'active'); + * // => 0 + */ + var findLastIndex = createFindIndex(true); + + /** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @alias head + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.first([1, 2, 3]); + * // => 1 + * + * _.first([]); + * // => undefined + */ + function first(array) { + return array ? array[0] : undefined; + } + + /** + * Flattens a nested array. If `isDeep` is `true` the array is recursively + * flattened, otherwise it is only flattened a single level. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to flatten. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, 3, [4]]]); + * // => [1, 2, 3, [4]] + * + * // using `isDeep` + * _.flatten([1, [2, 3, [4]]], true); + * // => [1, 2, 3, 4] + */ + function flatten(array, isDeep, guard) { + var length = array ? array.length : 0; + if (guard && isIterateeCall(array, isDeep, guard)) { + isDeep = false; + } + return length ? baseFlatten(array, isDeep) : []; + } + + /** + * Recursively flattens a nested array. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to recursively flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, 3, [4]]]); + * // => [1, 2, 3, 4] + */ + function flattenDeep(array) { + var length = array ? array.length : 0; + return length ? baseFlatten(array, true) : []; + } + + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` + * performs a faster binary search. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + * + * // performing a binary search + * _.indexOf([1, 1, 2, 2], 2, true); + * // => 2 + */ + function indexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + if (typeof fromIndex == 'number') { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; + } else if (fromIndex) { + var index = binaryIndex(array, value), + other = array[index]; + + if (value === value ? (value === other) : (other !== other)) { + return index; + } + return -1; + } + return baseIndexOf(array, value, fromIndex || 0); + } + + /** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ + function initial(array) { + return dropRight(array, 1); + } + + /** + * Creates an array of unique values in all provided arrays using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of shared values. + * @example + * _.intersection([1, 2], [4, 2], [2, 1]); + * // => [2] + */ + function intersection() { + var args = [], + argsIndex = -1, + argsLength = arguments.length, + caches = [], + indexOf = getIndexOf(), + isCommon = indexOf == baseIndexOf, + result = []; + + while (++argsIndex < argsLength) { + var value = arguments[argsIndex]; + if (isArrayLike(value)) { + args.push(value); + caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); + } + } + argsLength = args.length; + if (argsLength < 2) { + return result; + } + var array = args[0], + index = -1, + length = array ? array.length : 0, + seen = caches[0]; + + outer: + while (++index < length) { + value = array[index]; + if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { + argsIndex = argsLength; + while (--argsIndex) { + var cache = caches[argsIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) { + continue outer; + } + } + if (seen) { + seen.push(value); + } + result.push(value); + } + } + return result; + } + + /** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ + function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; + } + + /** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=array.length-1] The index to search from + * or `true` to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // using `fromIndex` + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + * + * // performing a binary search + * _.lastIndexOf([1, 1, 2, 2], 2, true); + * // => 3 + */ + function lastIndexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = length; + if (typeof fromIndex == 'number') { + index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; + } else if (fromIndex) { + index = binaryIndex(array, value, true) - 1; + var other = array[index]; + if (value === value ? (value === other) : (other !== other)) { + return index; + } + return -1; + } + if (value !== value) { + return indexOfNaN(array, index, true); + } + while (index--) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * Removes all provided values from `array` using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ + function pull() { + var args = arguments, + array = args[0]; + + if (!(array && array.length)) { + return array; + } + var index = 0, + indexOf = getIndexOf(), + length = args.length; + + while (++index < length) { + var fromIndex = 0, + value = args[index]; + + while ((fromIndex = indexOf(array, value, fromIndex)) > -1) { + splice.call(array, fromIndex, 1); + } + } + return array; + } + + /** + * Removes elements from `array` corresponding to the given indexes and returns + * an array of the removed elements. Indexes may be specified as an array of + * indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove, + * specified as individual indexes or arrays of indexes. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [5, 10, 15, 20]; + * var evens = _.pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ + var pullAt = restParam(function(array, indexes) { + indexes = baseFlatten(indexes); + + var result = baseAt(array, indexes); + basePullAt(array, indexes.sort(baseCompareAscending)); + return result; + }); + + /** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is bound to + * `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * **Note:** Unlike `_.filter`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; + * }); + * + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] + */ + function remove(array, predicate, thisArg) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; + + predicate = getCallback(predicate, thisArg, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; + } + + /** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @alias tail + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.rest([1, 2, 3]); + * // => [2, 3] + */ + function rest(array) { + return drop(array, 1); + } + + /** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of `Array#slice` to support node + * lists in IE < 9 and to ensure dense arrays are returned. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function slice(array, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + return baseSlice(array, start, end); + } + + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. If an iteratee + * function is provided it is invoked for `value` and each element of `array` + * to compute their sort ranking. The iteratee is bound to `thisArg` and + * invoked with one argument; (value). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 4, 5, 5], 5); + * // => 2 + * + * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } }; + * + * // using an iteratee function + * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) { + * return this.data[word]; + * }, dict); + * // => 1 + * + * // using the `_.property` callback shorthand + * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); + * // => 1 + */ + var sortedIndex = createSortedIndex(); + + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 4, 5, 5], 5); + * // => 4 + */ + var sortedLastIndex = createSortedIndex(true); + + /** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.take([1, 2, 3]); + * // => [1] + * + * _.take([1, 2, 3], 2); + * // => [1, 2] + * + * _.take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.take([1, 2, 3], 0); + * // => [] + */ + function take(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRight([1, 2, 3]); + * // => [3] + * + * _.takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * _.takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.takeRight([1, 2, 3], 0); + * // => [] + */ + function takeRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is bound to `thisArg` + * and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [2, 3] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active', false), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active'), 'user'); + * // => [] + */ + function takeRightWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, getCallback(predicate, thisArg, 3), false, true) + : []; + } + + /** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is bound to + * `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [1, 2] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false}, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeWhile(users, 'active', false), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeWhile(users, 'active'), 'user'); + * // => [] + */ + function takeWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, getCallback(predicate, thisArg, 3)) + : []; + } + + /** + * Creates an array of unique values, in order, of the provided arrays using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([1, 2], [4, 2], [2, 1]); + * // => [1, 2, 4] + */ + var union = restParam(function(arrays) { + return baseUniq(baseFlatten(arrays, false, true)); + }); + + /** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons, in which only the first occurence of each element + * is kept. Providing `true` for `isSorted` performs a faster search algorithm + * for sorted arrays. If an iteratee function is provided it is invoked for + * each element in the array to generate the criterion by which uniqueness + * is computed. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index, array). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias unique + * @category Array + * @param {Array} array The array to inspect. + * @param {boolean} [isSorted] Specify the array is sorted. + * @param {Function|Object|string} [iteratee] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new duplicate-value-free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + * + * // using `isSorted` + * _.uniq([1, 1, 2], true); + * // => [1, 2] + * + * // using an iteratee function + * _.uniq([1, 2.5, 1.5, 2], function(n) { + * return this.floor(n); + * }, Math); + * // => [1, 2.5] + * + * // using the `_.property` callback shorthand + * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + function uniq(array, isSorted, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (isSorted != null && typeof isSorted != 'boolean') { + thisArg = iteratee; + iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; + isSorted = false; + } + var func = getCallback(); + if (!(func === baseCallback && iteratee == null)) { + iteratee = func(iteratee, thisArg, 3); + } + return (isSorted && getIndexOf() == baseIndexOf) + ? sortedUniq(array, iteratee) + : baseUniq(array, iteratee); + } + + /** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-zip + * configuration. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + * + * _.unzip(zipped); + * // => [['fred', 'barney'], [30, 40], [true, false]] + */ + function unzip(array) { + if (!(array && array.length)) { + return []; + } + var index = -1, + length = 0; + + array = arrayFilter(array, function(group) { + if (isArrayLike(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + var result = Array(length); + while (++index < length) { + result[index] = arrayMap(array, baseProperty(index)); + } + return result; + } + + /** + * This method is like `_.unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee] The function to combine regrouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + iteratee = bindCallback(iteratee, thisArg, 4); + return arrayMap(result, function(group) { + return arrayReduce(group, iteratee, undefined, true); + }); + } + + /** + * Creates an array excluding all provided values using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to filter. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.without([1, 2, 1, 3], 1, 2); + * // => [3] + */ + var without = restParam(function(array, values) { + return isArrayLike(array) + ? baseDifference(array, values) + : []; + }); + + /** + * Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the provided arrays. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of values. + * @example + * + * _.xor([1, 2], [4, 2]); + * // => [1, 4] + */ + function xor() { + var index = -1, + length = arguments.length; + + while (++index < length) { + var array = arguments[index]; + if (isArrayLike(array)) { + var result = result + ? baseDifference(result, array).concat(baseDifference(array, result)) + : array; + } + } + return result ? baseUniq(result) : []; + } + + /** + * Creates an array of grouped elements, the first of which contains the first + * elements of the given arrays, the second of which contains the second elements + * of the given arrays, and so on. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + */ + var zip = restParam(unzip); + + /** + * The inverse of `_.pairs`; this method returns an object composed from arrays + * of property names and values. Provide either a single two dimensional array, + * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names + * and one of corresponding values. + * + * @static + * @memberOf _ + * @alias object + * @category Array + * @param {Array} props The property names. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + * + * _.zipObject(['fred', 'barney'], [30, 40]); + * // => { 'fred': 30, 'barney': 40 } + */ + function zipObject(props, values) { + var index = -1, + length = props ? props.length : 0, + result = {}; + + if (length && !values && !isArray(props[0])) { + values = []; + } + while (++index < length) { + var key = props[index]; + if (values) { + result[key] = values[index]; + } else if (key) { + result[key[0]] = key[1]; + } + } + return result; + } + + /** + * This method is like `_.zip` except that it accepts an iteratee to specify + * how grouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], _.add); + * // => [111, 222] + */ + var zipWith = restParam(function(arrays) { + var length = arrays.length, + iteratee = arrays[length - 2], + thisArg = arrays[length - 1]; + + if (length > 2 && typeof iteratee == 'function') { + length -= 2; + } else { + iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined; + thisArg = undefined; + } + arrays.length = length; + return unzipWith(arrays, iteratee, thisArg); + }); + + /** + * Creates a `lodash` object that wraps `value` with explicit method + * chaining enabled. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _.chain(users) + * .sortBy('age') + * .map(function(chr) { + * return chr.user + ' is ' + chr.age; + * }) + * .first() + * .value(); + * // => 'pebbles is 1' + */ + function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; + } + + /** + * This method invokes `interceptor` and returns `value`. The interceptor is + * bound to `thisArg` and invoked with one argument; (value). The purpose of + * this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ + function tap(value, interceptor, thisArg) { + interceptor.call(thisArg, value); + return value; + } + + /** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ + function thru(value, interceptor, thisArg) { + return interceptor.call(thisArg, value); + } + + /** + * Enables explicit method chaining on the wrapper object. + * + * @name chain + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // without explicit chaining + * _(users).first(); + * // => { 'user': 'barney', 'age': 36 } + * + * // with explicit chaining + * _(users).chain() + * .first() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ + function wrapperChain() { + return chain(this); + } + + /** + * Executes the chained sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapper = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapper = wrapper.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapper.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ + function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); + } + + /** + * Creates a clone of the chained sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapper = _(array).map(function(value) { + * return Math.pow(value, 2); + * }); + * + * var other = [3, 4]; + * var otherWrapper = wrapper.plant(other); + * + * otherWrapper.value(); + * // => [9, 16] + * + * wrapper.value(); + * // => [1, 4] + */ + function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; + } + + /** + * Reverses the wrapped array so the first element becomes the last, the + * second element becomes the second to last, and so on. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new reversed `lodash` wrapper instance. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function wrapperReverse() { + var value = this.__wrapped__; + if (value instanceof LazyWrapper) { + if (this.__actions__.length) { + value = new LazyWrapper(this); + } + return new LodashWrapper(value.reverse(), this.__chain__); + } + return this.thru(function(value) { + return value.reverse(); + }); + } + + /** + * Produces the result of coercing the unwrapped value to a string. + * + * @name toString + * @memberOf _ + * @category Chain + * @returns {string} Returns the coerced string value. + * @example + * + * _([1, 2, 3]).toString(); + * // => '1,2,3' + */ + function wrapperToString() { + return (this.value() + ''); + } + + /** + * Executes the chained sequence to extract the unwrapped value. + * + * @name value + * @memberOf _ + * @alias run, toJSON, valueOf + * @category Chain + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ + function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); + } + + /** + * Creates an array of elements corresponding to the given keys, or indexes, + * of `collection`. Keys may be specified as individual arguments or as arrays + * of keys. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(number|number[]|string|string[])} [props] The property names + * or indexes of elements to pick, specified individually or in arrays. + * @returns {Array} Returns the new array of picked elements. + * @example + * + * _.at(['a', 'b', 'c'], [0, 2]); + * // => ['a', 'c'] + * + * _.at(['barney', 'fred', 'pebbles'], 0, 2); + * // => ['barney', 'pebbles'] + */ + var at = restParam(function(collection, props) { + return baseAt(collection, baseFlatten(props)); + }); + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the number of times the key was returned by `iteratee`. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': 1, '6': 2 } + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': 1, '6': 2 } + * + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ + var countBy = createAggregator(function(result, value, key) { + hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); + }); + + /** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * The predicate is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias all + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.every(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.every(users, 'active'); + * // => false + */ + function every(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = null; + } + if (typeof predicate != 'function' || thisArg !== undefined) { + predicate = getCallback(predicate, thisArg, 3); + } + return func(collection, predicate); + } + + /** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias select + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.filter([4, 5, 6], function(n) { + * return n % 2 == 0; + * }); + * // => [4, 6] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.filter(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.filter(users, 'active'), 'user'); + * // => ['barney'] + */ + function filter(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = getCallback(predicate, thisArg, 3); + return func(collection, predicate); + } + + /** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias detect + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.result(_.find(users, function(chr) { + * return chr.age < 40; + * }), 'user'); + * // => 'barney' + * + * // using the `_.matches` callback shorthand + * _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); + * // => 'pebbles' + * + * // using the `_.matchesProperty` callback shorthand + * _.result(_.find(users, 'active', false), 'user'); + * // => 'fred' + * + * // using the `_.property` callback shorthand + * _.result(_.find(users, 'active'), 'user'); + * // => 'barney' + */ + var find = createFind(baseEach); + + /** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ + var findLast = createFind(baseEachRight, true); + + /** + * Performs a deep comparison between each element in `collection` and the + * source object, returning the first element that has equivalent property + * values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user'); + * // => 'barney' + * + * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user'); + * // => 'fred' + */ + function findWhere(collection, source) { + return find(collection, baseMatches(source)); + } + + /** + * Iterates over elements of `collection` invoking `iteratee` for each element. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early + * by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" property + * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` + * may be used for object iteration. + * + * @static + * @memberOf _ + * @alias each + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEach(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from left to right and returns the array + * + * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { + * console.log(n, key); + * }); + * // => logs each value-key pair and returns the object (iteration order is not guaranteed) + */ + var forEach = createForEach(arrayEach, baseEach); + + /** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias eachRight + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEachRight(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from right to left and returns the array + */ + var forEachRight = createForEach(arrayEachRight, baseEachRight); + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is an array of the elements responsible for generating the key. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * // using the `_.property` callback shorthand + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ + var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + result[key] = [value]; + } + }); + + /** + * Checks if `value` is in `collection` using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `collection`. + * + * @static + * @memberOf _ + * @alias contains, include + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {*} target The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {boolean} Returns `true` if a matching element is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); + * // => true + * + * _.includes('pebbles', 'eb'); + * // => true + */ + function includes(collection, target, fromIndex, guard) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { + collection = values(collection); + length = collection.length; + } + if (!length) { + return false; + } + if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { + fromIndex = 0; + } else { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); + } + return (typeof collection == 'string' || !isArray(collection) && isString(collection)) + ? (fromIndex < length && collection.indexOf(target, fromIndex) > -1) + : (getIndexOf(collection, target, fromIndex) > -1); + } + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the last element responsible for generating the key. The + * iteratee function is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var keyData = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.indexBy(keyData, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return String.fromCharCode(object.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return this.fromCharCode(object.code); + * }, String); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + */ + var indexBy = createAggregator(function(result, value, key) { + result[key] = value; + }); + + /** + * Invokes the method at `path` on each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `methodName` is a function it is + * invoked for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invoke([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ + var invoke = restParam(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + isProp = isKey(path), + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value) { + var func = isFunc ? path : (isProp && value != null && value[path]); + result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); + }); + return result; + }); + + /** + * Creates an array of values by running each element in `collection` through + * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * Many lodash methods are guarded to work as interatees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, + * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, + * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, + * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, + * `sum`, `uniq`, and `words` + * + * @static + * @memberOf _ + * @alias collect + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new mapped array. + * @example + * + * function timesThree(n) { + * return n * 3; + * } + * + * _.map([1, 2], timesThree); + * // => [3, 6] + * + * _.map({ 'a': 1, 'b': 2 }, timesThree); + * // => [3, 6] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // using the `_.property` callback shorthand + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ + function map(collection, iteratee, thisArg) { + var func = isArray(collection) ? arrayMap : baseMap; + iteratee = getCallback(iteratee, thisArg, 3); + return func(collection, iteratee); + } + + /** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, while the second of which + * contains elements `predicate` returns falsey for. The predicate is bound + * to `thisArg` and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * _.partition([1, 2, 3], function(n) { + * return n % 2; + * }); + * // => [[1, 3], [2]] + * + * _.partition([1.2, 2.3, 3.4], function(n) { + * return this.floor(n) % 2; + * }, Math); + * // => [[1.2, 3.4], [2.3]] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * var mapper = function(array) { + * return _.pluck(array, 'user'); + * }; + * + * // using the `_.matches` callback shorthand + * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper); + * // => [['pebbles'], ['barney', 'fred']] + * + * // using the `_.matchesProperty` callback shorthand + * _.map(_.partition(users, 'active', false), mapper); + * // => [['barney', 'pebbles'], ['fred']] + * + * // using the `_.property` callback shorthand + * _.map(_.partition(users, 'active'), mapper); + * // => [['fred'], ['barney', 'pebbles']] + */ + var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); + }, function() { return [[], []]; }); + + /** + * Gets the property value of `path` from all elements in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|string} path The path of the property to pluck. + * @returns {Array} Returns the property values. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * _.pluck(users, 'user'); + * // => ['barney', 'fred'] + * + * var userIndex = _.indexBy(users, 'user'); + * _.pluck(userIndex, 'age'); + * // => [36, 40] (iteration order is not guaranteed) + */ + function pluck(collection, path) { + return map(collection, property(path)); + } + + /** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` through `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not provided the first element of `collection` is used as the initial + * value. The `iteratee` is bound to `thisArg` and invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as interatees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `includes`, `merge`, `sortByAll`, and `sortByOrder` + * + * @static + * @memberOf _ + * @alias foldl, inject + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * _.reduce([1, 2], function(total, n) { + * return total + n; + * }); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { + * result[key] = n * 3; + * return result; + * }, {}); + * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed) + */ + var reduce = createReduce(arrayReduce, baseEach); + + /** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias foldr + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ + var reduceRight = createReduce(arrayReduceRight, baseEachRight); + + /** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.reject([1, 2, 3, 4], function(n) { + * return n % 2 == 0; + * }); + * // => [1, 3] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.reject(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.reject(users, 'active'), 'user'); + * // => ['barney'] + */ + function reject(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = getCallback(predicate, thisArg, 3); + return func(collection, function(value, index, collection) { + return !predicate(value, index, collection); + }); + } + + /** + * Gets a random element or `n` random elements from a collection. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to sample. + * @param {number} [n] The number of elements to sample. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {*} Returns the random sample(s). + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + * + * _.sample([1, 2, 3, 4], 2); + * // => [3, 1] + */ + function sample(collection, n, guard) { + if (guard ? isIterateeCall(collection, n, guard) : n == null) { + collection = toIterable(collection); + var length = collection.length; + return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; + } + var result = shuffle(collection); + result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); + return result; + } + + /** + * Creates an array of shuffled values, using a version of the + * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + * @example + * + * _.shuffle([1, 2, 3, 4]); + * // => [4, 1, 3, 2] + */ + function shuffle(collection) { + collection = toIterable(collection); + + var index = -1, + length = collection.length, + result = Array(length); + + while (++index < length) { + var rand = baseRandom(0, index); + if (index != rand) { + result[index] = result[rand]; + } + result[rand] = collection[index]; + } + return result; + } + + /** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable properties for objects. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the size of `collection`. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ + function size(collection) { + var length = collection ? getLength(collection) : 0; + return isLength(length) ? length : keys(collection).length; + } + + /** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * The function returns as soon as it finds a passing value and does not iterate + * over the entire collection. The predicate is bound to `thisArg` and invoked + * with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias any + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.some(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.some(users, 'active'); + * // => true + */ + function some(collection, predicate, thisArg) { + var func = isArray(collection) ? arraySome : baseSome; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = null; + } + if (typeof predicate != 'function' || thisArg !== undefined) { + predicate = getCallback(predicate, thisArg, 3); + } + return func(collection, predicate); + } + + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through `iteratee`. This method performs + * a stable sort, that is, it preserves the original sort order of equal elements. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new sorted array. + * @example + * + * _.sortBy([1, 2, 3], function(n) { + * return Math.sin(n); + * }); + * // => [3, 1, 2] + * + * _.sortBy([1, 2, 3], function(n) { + * return this.sin(n); + * }, Math); + * // => [3, 1, 2] + * + * var users = [ + * { 'user': 'fred' }, + * { 'user': 'pebbles' }, + * { 'user': 'barney' } + * ]; + * + * // using the `_.property` callback shorthand + * _.pluck(_.sortBy(users, 'user'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ + function sortBy(collection, iteratee, thisArg) { + if (collection == null) { + return []; + } + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var index = -1; + iteratee = getCallback(iteratee, thisArg, 3); + + var result = baseMap(collection, function(value, key, collection) { + return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value }; + }); + return baseSortBy(result, compareAscending); + } + + /** + * This method is like `_.sortBy` except that it can sort by multiple iteratees + * or property names. + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees + * The iteratees to sort by, specified as individual values or arrays of values. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.map(_.sortByAll(users, ['user', 'age']), _.values); + * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.map(_.sortByAll(users, 'user', function(chr) { + * return Math.floor(chr.age / 10); + * }), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + var sortByAll = restParam(function(collection, iteratees) { + if (collection == null) { + return []; + } + var guard = iteratees[2]; + if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) { + iteratees.length = 1; + } + return baseSortByOrder(collection, baseFlatten(iteratees), []); + }); + + /** + * This method is like `_.sortByAll` except that it allows specifying the + * sort orders of the iteratees to sort by. A truthy value in `orders` will + * sort the corresponding property name in ascending order while a falsey + * value will sort it in descending order. + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {boolean[]} orders The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + function sortByOrder(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (guard && isIterateeCall(iteratees, orders, guard)) { + orders = null; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseSortByOrder(collection, iteratees, orders); + } + + /** + * Performs a deep comparison between each element in `collection` and the + * source object, returning an array of all elements that have equivalent + * property values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {Array} Returns the new filtered array. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] }, + * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] } + * ]; + * + * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user'); + * // => ['barney'] + * + * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); + * // => ['fred'] + */ + function where(collection, source) { + return filter(collection, baseMatches(source)); + } + + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch + * (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @category Date + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => logs the number of milliseconds it took for the deferred function to be invoked + */ + var now = nativeNow || function() { + return new Date().getTime(); + }; + + /** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it is called `n` or more times. + * + * @static + * @memberOf _ + * @category Function + * @param {number} n The number of calls before `func` is invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var saves = ['profile', 'settings']; + * + * var done = _.after(saves.length, function() { + * console.log('done saving!'); + * }); + * + * _.forEach(saves, function(type) { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => logs 'done saving!' after the two async saves have completed + */ + function after(n, func) { + if (typeof func != 'function') { + if (typeof n == 'function') { + var temp = n; + n = func; + func = temp; + } else { + throw new TypeError(FUNC_ERROR_TEXT); + } + } + n = nativeIsFinite(n = +n) ? n : 0; + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; + } + + /** + * Creates a function that accepts up to `n` arguments ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to cap arguments for. + * @param {number} [n=func.length] The arity cap. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the new function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ + function ary(func, n, guard) { + if (guard && isIterateeCall(func, n, guard)) { + n = null; + } + n = (func && n == null) ? func.length : nativeMax(+n || 0, 0); + return createWrapper(func, ARY_FLAG, null, null, null, null, n); + } + + /** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it is called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery('#add').on('click', _.before(5, addContactToList)); + * // => allows adding up to 4 contacts to the list + */ + function before(n, func) { + var result; + if (typeof func != 'function') { + if (typeof n == 'function') { + var temp = n; + n = func; + func = temp; + } else { + throw new TypeError(FUNC_ERROR_TEXT); + } + } + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = null; + } + return result; + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and prepends any additional `_.bind` arguments to those provided to the + * bound function. + * + * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for partially applied arguments. + * + * **Note:** Unlike native `Function#bind` this method does not set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var greet = function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * }; + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // using placeholders + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ + var bind = restParam(function(func, thisArg, partials) { + var bitmask = BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, bind.placeholder); + bitmask |= PARTIAL_FLAG; + } + return createWrapper(func, bitmask, thisArg, partials, holders); + }); + + /** + * Binds methods of an object to the object itself, overwriting the existing + * method. Method names may be specified as individual arguments or as arrays + * of method names. If no method names are provided all enumerable function + * properties, own and inherited, of `object` are bound. + * + * **Note:** This method does not set the "length" property of bound functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Object} object The object to bind and assign the bound methods to. + * @param {...(string|string[])} [methodNames] The object method names to bind, + * specified as individual method names or arrays of method names. + * @returns {Object} Returns `object`. + * @example + * + * var view = { + * 'label': 'docs', + * 'onClick': function() { + * console.log('clicked ' + this.label); + * } + * }; + * + * _.bindAll(view); + * jQuery('#docs').on('click', view.onClick); + * // => logs 'clicked docs' when the element is clicked + */ + var bindAll = restParam(function(object, methodNames) { + methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object); + + var index = -1, + length = methodNames.length; + + while (++index < length) { + var key = methodNames[index]; + object[key] = createWrapper(object[key], BIND_FLAG, object); + } + return object; + }); + + /** + * Creates a function that invokes the method at `object[key]` and prepends + * any additional `_.bindKey` arguments to those provided to the bound function. + * + * This method differs from `_.bind` by allowing bound functions to reference + * methods that may be redefined or don't yet exist. + * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * for more details. + * + * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * @static + * @memberOf _ + * @category Function + * @param {Object} object The object the method belongs to. + * @param {string} key The key of the method. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var object = { + * 'user': 'fred', + * 'greet': function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * }; + * + * var bound = _.bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function(greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // using placeholders + * var bound = _.bindKey(object, 'greet', _, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ + var bindKey = restParam(function(object, key, partials) { + var bitmask = BIND_FLAG | BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, bindKey.placeholder); + bitmask |= PARTIAL_FLAG; + } + return createWrapper(key, bitmask, object, partials, holders); + }); + + /** + * Creates a function that accepts one or more arguments of `func` that when + * called either invokes `func` returning its result, if all `func` arguments + * have been provided, or returns a function that accepts one or more of the + * remaining `func` arguments, and so on. The arity of `func` may be specified + * if `func.length` is not sufficient. + * + * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for provided arguments. + * + * **Note:** This method does not set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curry(abc); + * + * curried(1)(2)(3); + * // => [1, 2, 3] + * + * curried(1, 2)(3); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // using placeholders + * curried(1)(_, 3)(2); + * // => [1, 2, 3] + */ + var curry = createCurry(CURRY_FLAG); + + /** + * This method is like `_.curry` except that arguments are applied to `func` + * in the manner of `_.partialRight` instead of `_.partial`. + * + * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for provided arguments. + * + * **Note:** This method does not set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curryRight(abc); + * + * curried(3)(2)(1); + * // => [1, 2, 3] + * + * curried(2, 3)(1); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // using placeholders + * curried(3)(1, _)(2); + * // => [1, 2, 3] + */ + var curryRight = createCurry(CURRY_RIGHT_FLAG); + + /** + * Creates a function that delays invoking `func` until after `wait` milliseconds + * have elapsed since the last time it was invoked. The created function comes + * with a `cancel` method to cancel delayed invocations. Provide an options + * object to indicate that `func` should be invoked on the leading and/or + * trailing edge of the `wait` timeout. Subsequent calls to the debounced + * function return the result of the last `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked + * on the trailing edge of the timeout only if the the debounced function is + * invoked more than once during the `wait` timeout. + * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options] The options object. + * @param {boolean} [options.leading=false] Specify invoking on the leading + * edge of the timeout. + * @param {number} [options.maxWait] The maximum time `func` is allowed to be + * delayed before it is invoked. + * @param {boolean} [options.trailing=true] Specify invoking on the trailing + * edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // avoid costly calculations while the window size is in flux + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // invoke `sendMail` when the click event is fired, debouncing subsequent calls + * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // ensure `batchLog` is invoked once after 1 second of debounced calls + * var source = new EventSource('/stream'); + * jQuery(source).on('message', _.debounce(batchLog, 250, { + * 'maxWait': 1000 + * })); + * + * // cancel a debounced call + * var todoChanges = _.debounce(batchLog, 1000); + * Object.observe(models.todo, todoChanges); + * + * Object.observe(models, function(changes) { + * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) { + * todoChanges.cancel(); + * } + * }, ['delete']); + * + * // ...at some point `models.todo` is changed + * models.todo.completed = true; + * + * // ...before 1 second has passed `models.todo` is deleted + * // which cancels the debounced `todoChanges` call + * delete models.todo; + */ + function debounce(func, wait, options) { + var args, + maxTimeoutId, + result, + stamp, + thisArg, + timeoutId, + trailingCall, + lastCalled = 0, + maxWait = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = wait < 0 ? 0 : (+wait || 0); + if (options === true) { + var leading = true; + trailing = false; + } else if (isObject(options)) { + leading = options.leading; + maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait); + trailing = 'trailing' in options ? options.trailing : trailing; + } + + function cancel() { + if (timeoutId) { + clearTimeout(timeoutId); + } + if (maxTimeoutId) { + clearTimeout(maxTimeoutId); + } + maxTimeoutId = timeoutId = trailingCall = undefined; + } + + function delayed() { + var remaining = wait - (now() - stamp); + if (remaining <= 0 || remaining > wait) { + if (maxTimeoutId) { + clearTimeout(maxTimeoutId); + } + var isCalled = trailingCall; + maxTimeoutId = timeoutId = trailingCall = undefined; + if (isCalled) { + lastCalled = now(); + result = func.apply(thisArg, args); + if (!timeoutId && !maxTimeoutId) { + args = thisArg = null; + } + } + } else { + timeoutId = setTimeout(delayed, remaining); + } + } + + function maxDelayed() { + if (timeoutId) { + clearTimeout(timeoutId); + } + maxTimeoutId = timeoutId = trailingCall = undefined; + if (trailing || (maxWait !== wait)) { + lastCalled = now(); + result = func.apply(thisArg, args); + if (!timeoutId && !maxTimeoutId) { + args = thisArg = null; + } + } + } + + function debounced() { + args = arguments; + stamp = now(); + thisArg = this; + trailingCall = trailing && (timeoutId || !leading); + + if (maxWait === false) { + var leadingCall = leading && !timeoutId; + } else { + if (!maxTimeoutId && !leading) { + lastCalled = stamp; + } + var remaining = maxWait - (stamp - lastCalled), + isCalled = remaining <= 0 || remaining > maxWait; + + if (isCalled) { + if (maxTimeoutId) { + maxTimeoutId = clearTimeout(maxTimeoutId); + } + lastCalled = stamp; + result = func.apply(thisArg, args); + } + else if (!maxTimeoutId) { + maxTimeoutId = setTimeout(maxDelayed, remaining); + } + } + if (isCalled && timeoutId) { + timeoutId = clearTimeout(timeoutId); + } + else if (!timeoutId && wait !== maxWait) { + timeoutId = setTimeout(delayed, wait); + } + if (leadingCall) { + isCalled = true; + result = func.apply(thisArg, args); + } + if (isCalled && !timeoutId && !maxTimeoutId) { + args = thisArg = null; + } + return result; + } + debounced.cancel = cancel; + return debounced; + } + + /** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it is invoked. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke the function with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // logs 'deferred' after one or more milliseconds + */ + var defer = restParam(function(func, args) { + return baseDelay(func, 1, args); + }); + + /** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it is invoked. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {...*} [args] The arguments to invoke the function with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => logs 'later' after one second + */ + var delay = restParam(function(func, wait, args) { + return baseDelay(func, wait, args); + }); + + /** + * Creates a function that returns the result of invoking the provided + * functions with the `this` binding of the created function, where each + * successive invocation is supplied the return value of the previous. + * + * @static + * @memberOf _ + * @category Function + * @param {...Function} [funcs] Functions to invoke. + * @returns {Function} Returns the new function. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flow(_.add, square); + * addSquare(1, 2); + * // => 9 + */ + var flow = createFlow(); + + /** + * This method is like `_.flow` except that it creates a function that + * invokes the provided functions from right to left. + * + * @static + * @memberOf _ + * @alias backflow, compose + * @category Function + * @param {...Function} [funcs] Functions to invoke. + * @returns {Function} Returns the new function. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flowRight(square, _.add); + * addSquare(1, 2); + * // => 9 + */ + var flowRight = createFlow(true); + + /** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the + * cache key. The `func` is invoked with the `this` binding of the memoized + * function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the [`Map`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) + * method interface of `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoizing function. + * @example + * + * var upperCase = _.memoize(function(string) { + * return string.toUpperCase(); + * }); + * + * upperCase('fred'); + * // => 'FRED' + * + * // modifying the result cache + * upperCase.cache.set('fred', 'BARNEY'); + * upperCase('fred'); + * // => 'BARNEY' + * + * // replacing `_.memoize.Cache` + * var object = { 'user': 'fred' }; + * var other = { 'user': 'barney' }; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'fred' } + * + * _.memoize.Cache = WeakMap; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'barney' } + */ + function memoize(func, resolver) { + if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + cache = memoized.cache, + key = resolver ? resolver.apply(this, args) : args[0]; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + cache.set(key, result); + return result; + }; + memoized.cache = new memoize.Cache; + return memoized; + } + + /** + * Creates a function that negates the result of the predicate `func`. The + * `func` predicate is invoked with the `this` binding and arguments of the + * created function. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} predicate The predicate to negate. + * @returns {Function} Returns the new function. + * @example + * + * function isEven(n) { + * return n % 2 == 0; + * } + * + * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); + * // => [1, 3, 5] + */ + function negate(predicate) { + if (typeof predicate != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function() { + return !predicate.apply(this, arguments); + }; + } + + /** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first call. The `func` is invoked + * with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // `initialize` invokes `createApplication` once + */ + function once(func) { + return before(2, func); + } + + /** + * Creates a function that invokes `func` with `partial` arguments prepended + * to those provided to the new function. This method is like `_.bind` except + * it does **not** alter the `this` binding. + * + * The `_.partial.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method does not set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * var greet = function(greeting, name) { + * return greeting + ' ' + name; + * }; + * + * var sayHelloTo = _.partial(greet, 'hello'); + * sayHelloTo('fred'); + * // => 'hello fred' + * + * // using placeholders + * var greetFred = _.partial(greet, _, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + */ + var partial = createPartial(PARTIAL_FLAG); + + /** + * This method is like `_.partial` except that partially applied arguments + * are appended to those provided to the new function. + * + * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method does not set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * var greet = function(greeting, name) { + * return greeting + ' ' + name; + * }; + * + * var greetFred = _.partialRight(greet, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + * + * // using placeholders + * var sayHelloTo = _.partialRight(greet, 'hello', _); + * sayHelloTo('fred'); + * // => 'hello fred' + */ + var partialRight = createPartial(PARTIAL_RIGHT_FLAG); + + /** + * Creates a function that invokes `func` with arguments arranged according + * to the specified indexes where the argument value at the first index is + * provided as the first argument, the argument value at the second index is + * provided as the second argument, and so on. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to rearrange arguments for. + * @param {...(number|number[])} indexes The arranged argument indexes, + * specified as individual indexes or arrays of indexes. + * @returns {Function} Returns the new function. + * @example + * + * var rearged = _.rearg(function(a, b, c) { + * return [a, b, c]; + * }, 2, 0, 1); + * + * rearged('b', 'c', 'a') + * // => ['a', 'b', 'c'] + * + * var map = _.rearg(_.map, [1, 0]); + * map(function(n) { + * return n * 3; + * }, [1, 2, 3]); + * // => [3, 6, 9] + */ + var rearg = restParam(function(func, indexes) { + return createWrapper(func, REARG_FLAG, null, null, null, baseFlatten(indexes)); + }); + + /** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as an array. + * + * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.restParam(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ + function restParam(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + rest = Array(length); + + while (++index < length) { + rest[index] = args[start + index]; + } + switch (start) { + case 0: return func.call(this, rest); + case 1: return func.call(this, args[0], rest); + case 2: return func.call(this, args[0], args[1], rest); + } + var otherArgs = Array(start + 1); + index = -1; + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = rest; + return func.apply(this, otherArgs); + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of the created + * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). + * + * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator). + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to spread arguments over. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.spread(function(who, what) { + * return who + ' says ' + what; + * }); + * + * say(['fred', 'hello']); + * // => 'fred says hello' + * + * // with a Promise + * var numbers = Promise.all([ + * Promise.resolve(40), + * Promise.resolve(36) + * ]); + * + * numbers.then(_.spread(function(x, y) { + * return x + y; + * })); + * // => a Promise of 76 + */ + function spread(func) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function(array) { + return func.apply(this, array); + }; + } + + /** + * Creates a function that only invokes `func` at most once per every `wait` + * milliseconds. The created function comes with a `cancel` method to cancel + * delayed invocations. Provide an options object to indicate that `func` + * should be invoked on the leading and/or trailing edge of the `wait` timeout. + * Subsequent calls to the throttled function return the result of the last + * `func` call. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked + * on the trailing edge of the timeout only if the the throttled function is + * invoked more than once during the `wait` timeout. + * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] The number of milliseconds to throttle invocations to. + * @param {Object} [options] The options object. + * @param {boolean} [options.leading=true] Specify invoking on the leading + * edge of the timeout. + * @param {boolean} [options.trailing=true] Specify invoking on the trailing + * edge of the timeout. + * @returns {Function} Returns the new throttled function. + * @example + * + * // avoid excessively updating the position while scrolling + * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); + * + * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes + * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { + * 'trailing': false + * })); + * + * // cancel a trailing throttled call + * jQuery(window).on('popstate', throttled.cancel); + */ + function throttle(func, wait, options) { + var leading = true, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (options === false) { + leading = false; + } else if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + debounceOptions.leading = leading; + debounceOptions.maxWait = +wait; + debounceOptions.trailing = trailing; + return debounce(func, wait, debounceOptions); + } + + /** + * Creates a function that provides `value` to the wrapper function as its + * first argument. Any additional arguments provided to the function are + * appended to those provided to the wrapper function. The wrapper is invoked + * with the `this` binding of the created function. + * + * @static + * @memberOf _ + * @category Function + * @param {*} value The value to wrap. + * @param {Function} wrapper The wrapper function. + * @returns {Function} Returns the new function. + * @example + * + * var p = _.wrap(_.escape, function(func, text) { + * return '

' + func(text) + '

'; + * }); + * + * p('fred, barney, & pebbles'); + * // => '

fred, barney, & pebbles

' + */ + function wrap(value, wrapper) { + wrapper = wrapper == null ? identity : wrapper; + return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); + } + + /** + * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, + * otherwise they are assigned by reference. If `customizer` is provided it is + * invoked to produce the cloned values. If `customizer` returns `undefined` + * cloning is handled by the method instead. The `customizer` is bound to + * `thisArg` and invoked with two argument; (value [, index|key, object]). + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). + * The enumerable properties of `arguments` objects and objects created by + * constructors other than `Object` are cloned to plain `Object` objects. An + * empty object is returned for uncloneable values such as functions, DOM nodes, + * Maps, Sets, and WeakMaps. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @param {Function} [customizer] The function to customize cloning values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {*} Returns the cloned value. + * @example + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * var shallow = _.clone(users); + * shallow[0] === users[0]; + * // => true + * + * var deep = _.clone(users, true); + * deep[0] === users[0]; + * // => false + * + * // using a customizer callback + * var el = _.clone(document.body, function(value) { + * if (_.isElement(value)) { + * return value.cloneNode(false); + * } + * }); + * + * el === document.body + * // => false + * el.nodeName + * // => BODY + * el.childNodes.length; + * // => 0 + */ + function clone(value, isDeep, customizer, thisArg) { + if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) { + isDeep = false; + } + else if (typeof isDeep == 'function') { + thisArg = customizer; + customizer = isDeep; + isDeep = false; + } + customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); + return baseClone(value, isDeep, customizer); + } + + /** + * Creates a deep clone of `value`. If `customizer` is provided it is invoked + * to produce the cloned values. If `customizer` returns `undefined` cloning + * is handled by the method instead. The `customizer` is bound to `thisArg` + * and invoked with two argument; (value [, index|key, object]). + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). + * The enumerable properties of `arguments` objects and objects created by + * constructors other than `Object` are cloned to plain `Object` objects. An + * empty object is returned for uncloneable values such as functions, DOM nodes, + * Maps, Sets, and WeakMaps. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to deep clone. + * @param {Function} [customizer] The function to customize cloning values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {*} Returns the deep cloned value. + * @example + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * var deep = _.cloneDeep(users); + * deep[0] === users[0]; + * // => false + * + * // using a customizer callback + * var el = _.cloneDeep(document.body, function(value) { + * if (_.isElement(value)) { + * return value.cloneNode(true); + * } + * }); + * + * el === document.body + * // => false + * el.nodeName + * // => BODY + * el.childNodes.length; + * // => 20 + */ + function cloneDeep(value, customizer, thisArg) { + customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); + return baseClone(value, true, customizer); + } + + /** + * Checks if `value` is classified as an `arguments` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + function isArguments(value) { + return isObjectLike(value) && isArrayLike(value) && objToString.call(value) == argsTag; + } + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(function() { return arguments; }()); + * // => false + */ + var isArray = nativeIsArray || function(value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; + }; + + /** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ + function isBoolean(value) { + return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag); + } + + /** + * Checks if `value` is classified as a `Date` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isDate(new Date); + * // => true + * + * _.isDate('Mon April 23 2012'); + * // => false + */ + function isDate(value) { + return isObjectLike(value) && objToString.call(value) == dateTag; + } + + /** + * Checks if `value` is a DOM element. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * @example + * + * _.isElement(document.body); + * // => true + * + * _.isElement(''); + * // => false + */ + function isElement(value) { + return !!value && value.nodeType === 1 && isObjectLike(value) && + (objToString.call(value).indexOf('Element') > -1); + } + // Fallback for environments without DOM support. + if (!support.dom) { + isElement = function(value) { + return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); + }; + } + + /** + * Checks if `value` is empty. A value is considered empty unless it is an + * `arguments` object, array, string, or jQuery-like collection with a length + * greater than `0` or an object with own enumerable properties. + * + * @static + * @memberOf _ + * @category Lang + * @param {Array|Object|string} value The value to inspect. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */ + function isEmpty(value) { + if (value == null) { + return true; + } + if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || + (isObjectLike(value) && isFunction(value.splice)))) { + return !value.length; + } + return !keys(value).length; + } + + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. If `customizer` is provided it is invoked to compare values. + * If `customizer` returns `undefined` comparisons are handled by the method + * instead. The `customizer` is bound to `thisArg` and invoked with three + * arguments: (value, other [, index|key]). + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. Functions and DOM nodes + * are **not** supported. Provide a customizer function to extend support + * for comparing other values. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize value comparisons. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * object == other; + * // => false + * + * _.isEqual(object, other); + * // => true + * + * // using a customizer callback + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqual(array, other, function(value, other) { + * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) { + * return true; + * } + * }); + * // => true + */ + function isEqual(value, other, customizer, thisArg) { + customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); + if (!customizer && isStrictComparable(value) && isStrictComparable(other)) { + return value === other; + } + var result = customizer ? customizer(value, other) : undefined; + return result === undefined ? baseIsEqual(value, other, customizer) : !!result; + } + + /** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ + function isError(value) { + return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag; + } + + /** + * Checks if `value` is a finite primitive number. + * + * **Note:** This method is based on [`Number.isFinite`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @example + * + * _.isFinite(10); + * // => true + * + * _.isFinite('10'); + * // => false + * + * _.isFinite(true); + * // => false + * + * _.isFinite(Object(10)); + * // => false + * + * _.isFinite(Infinity); + * // => false + */ + var isFinite = nativeNumIsFinite || function(value) { + return typeof value == 'number' && nativeIsFinite(value); + }; + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return objToString.call(value) == funcTag; + }; + + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return type == 'function' || (!!value && type == 'object'); + } + + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. If `customizer` is provided + * it is invoked to compare values. If `customizer` returns `undefined` + * comparisons are handled by the method instead. The `customizer` is bound + * to `thisArg` and invoked with three arguments: (value, other, index|key). + * + * **Note:** This method supports comparing properties of arrays, booleans, + * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions + * and DOM nodes are **not** supported. Provide a customizer function to extend + * support for comparing other values. + * + * @static + * @memberOf _ + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize value comparisons. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + * + * // using a customizer callback + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatch(object, source, function(value, other) { + * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined; + * }); + * // => true + */ + function isMatch(object, source, customizer, thisArg) { + var props = keys(source), + length = props.length; + + if (!length) { + return true; + } + if (object == null) { + return false; + } + customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); + object = toObject(object); + if (!customizer && length == 1) { + var key = props[0], + value = source[key]; + + if (isStrictComparable(value)) { + return value === object[key] && (value !== undefined || (key in object)); + } + } + var values = Array(length), + strictCompareFlags = Array(length); + + while (length--) { + value = values[length] = source[props[length]]; + strictCompareFlags[length] = isStrictComparable(value); + } + return baseIsMatch(object, props, values, strictCompareFlags, customizer); + } + + /** + * Checks if `value` is `NaN`. + * + * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4) + * which returns `true` for `undefined` and other non-numeric values. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + * @example + * + * _.isNaN(NaN); + * // => true + * + * _.isNaN(new Number(NaN)); + * // => true + * + * isNaN(undefined); + * // => true + * + * _.isNaN(undefined); + * // => false + */ + function isNaN(value) { + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some host objects in IE. + return isNumber(value) && value != +value; + } + + /** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (value == null) { + return false; + } + if (objToString.call(value) == funcTag) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); + } + + /** + * Checks if `value` is `null`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `null`, else `false`. + * @example + * + * _.isNull(null); + * // => true + * + * _.isNull(void 0); + * // => false + */ + function isNull(value) { + return value === null; + } + + /** + * Checks if `value` is classified as a `Number` primitive or object. + * + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified + * as numbers, use the `_.isFinite` method. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isNumber(8.4); + * // => true + * + * _.isNumber(NaN); + * // => true + * + * _.isNumber('8.4'); + * // => false + */ + function isNumber(value) { + return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag); + } + + /** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * **Note:** This method assumes objects created by the `Object` constructor + * have no inherited enumerable properties. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ + var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { + if (!(value && objToString.call(value) == objectTag)) { + return false; + } + var valueOf = value.valueOf, + objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); + + return objProto + ? (value == objProto || getPrototypeOf(value) == objProto) + : shimIsPlainObject(value); + }; + + /** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ + function isRegExp(value) { + return isObjectLike(value) && objToString.call(value) == regexpTag; + } + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag); + } + + /** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ + function isTypedArray(value) { + return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; + } + + /** + * Checks if `value` is `undefined`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ + function isUndefined(value) { + return value === undefined; + } + + /** + * Converts `value` to an array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * (function() { + * return _.toArray(arguments).slice(1); + * }(1, 2, 3)); + * // => [2, 3] + */ + function toArray(value) { + var length = value ? getLength(value) : 0; + if (!isLength(length)) { + return values(value); + } + if (!length) { + return []; + } + return arrayCopy(value); + } + + /** + * Converts `value` to a plain object flattening inherited enumerable + * properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */ + function toPlainObject(value) { + return baseCopy(value, keysIn(value)); + } + + /** + * Assigns own enumerable properties of source object(s) to the destination + * object. Subsequent sources overwrite property assignments of previous sources. + * If `customizer` is provided it is invoked to produce the assigned values. + * The `customizer` is bound to `thisArg` and invoked with five arguments: + * (objectValue, sourceValue, key, object, source). + * + * **Note:** This method mutates `object` and is based on + * [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). + * + * @static + * @memberOf _ + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {Object} Returns `object`. + * @example + * + * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); + * // => { 'user': 'fred', 'age': 40 } + * + * // using a customizer callback + * var defaults = _.partialRight(_.assign, function(value, other) { + * return _.isUndefined(value) ? other : value; + * }); + * + * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); + * // => { 'user': 'barney', 'age': 36 } + */ + var assign = createAssigner(function(object, source, customizer) { + return customizer + ? assignWith(object, source, customizer) + : baseAssign(object, source); + }); + + /** + * Creates an object that inherits from the given `prototype` object. If a + * `properties` object is provided its own enumerable properties are assigned + * to the created object. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Object} Returns the new object. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * function Circle() { + * Shape.call(this); + * } + * + * Circle.prototype = _.create(Shape.prototype, { + * 'constructor': Circle + * }); + * + * var circle = new Circle; + * circle instanceof Circle; + * // => true + * + * circle instanceof Shape; + * // => true + */ + function create(prototype, properties, guard) { + var result = baseCreate(prototype); + if (guard && isIterateeCall(prototype, properties, guard)) { + properties = null; + } + return properties ? baseAssign(result, properties) : result; + } + + /** + * Assigns own enumerable properties of source object(s) to the destination + * object for all destination properties that resolve to `undefined`. Once a + * property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); + * // => { 'user': 'barney', 'age': 36 } + */ + var defaults = restParam(function(args) { + var object = args[0]; + if (object == null) { + return object; + } + args.push(assignDefaults); + return assign.apply(undefined, args); + }); + + /** + * This method is like `_.find` except that it returns the key of the first + * element `predicate` returns truthy for instead of the element itself. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {string|undefined} Returns the key of the matched element, else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findKey(users, function(chr) { + * return chr.age < 40; + * }); + * // => 'barney' (iteration order is not guaranteed) + * + * // using the `_.matches` callback shorthand + * _.findKey(users, { 'age': 1, 'active': true }); + * // => 'pebbles' + * + * // using the `_.matchesProperty` callback shorthand + * _.findKey(users, 'active', false); + * // => 'fred' + * + * // using the `_.property` callback shorthand + * _.findKey(users, 'active'); + * // => 'barney' + */ + var findKey = createFindKey(baseForOwn); + + /** + * This method is like `_.findKey` except that it iterates over elements of + * a collection in the opposite order. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {string|undefined} Returns the key of the matched element, else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findLastKey(users, function(chr) { + * return chr.age < 40; + * }); + * // => returns `pebbles` assuming `_.findKey` returns `barney` + * + * // using the `_.matches` callback shorthand + * _.findLastKey(users, { 'age': 36, 'active': true }); + * // => 'barney' + * + * // using the `_.matchesProperty` callback shorthand + * _.findLastKey(users, 'active', false); + * // => 'fred' + * + * // using the `_.property` callback shorthand + * _.findLastKey(users, 'active'); + * // => 'pebbles' + */ + var findLastKey = createFindKey(baseForOwnRight); + + /** + * Iterates over own and inherited enumerable properties of an object invoking + * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked + * with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forIn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed) + */ + var forIn = createForIn(baseFor); + + /** + * This method is like `_.forIn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forInRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c' + */ + var forInRight = createForIn(baseForRight); + + /** + * Iterates over own enumerable properties of an object invoking `iteratee` + * for each property. The `iteratee` is bound to `thisArg` and invoked with + * three arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => logs 'a' and 'b' (iteration order is not guaranteed) + */ + var forOwn = createForOwn(baseForOwn); + + /** + * This method is like `_.forOwn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwnRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b' + */ + var forOwnRight = createForOwn(baseForOwnRight); + + /** + * Creates an array of function property names from all enumerable properties, + * own and inherited, of `object`. + * + * @static + * @memberOf _ + * @alias methods + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the new array of property names. + * @example + * + * _.functions(_); + * // => ['after', 'ary', 'assign', ...] + */ + function functions(object) { + return baseFunctions(object, keysIn(object)); + } + + /** + * Gets the property value of `path` on `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, toPath(path), path + ''); + return result === undefined ? defaultValue : result; + } + + /** + * Checks if `path` is a direct property. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` is a direct property, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + */ + function has(object, path) { + if (object == null) { + return false; + } + var result = hasOwnProperty.call(object, path); + if (!result && !isKey(path)) { + path = toPath(path); + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + path = last(path); + result = object != null && hasOwnProperty.call(object, path); + } + return result; + } + + /** + * Creates an object composed of the inverted keys and values of `object`. + * If `object` contains duplicate values, subsequent values overwrite property + * assignments of previous values unless `multiValue` is `true`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to invert. + * @param {boolean} [multiValue] Allow multiple values per key. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invert(object); + * // => { '1': 'c', '2': 'b' } + * + * // with `multiValue` + * _.invert(object, true); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ + function invert(object, multiValue, guard) { + if (guard && isIterateeCall(object, multiValue, guard)) { + multiValue = null; + } + var index = -1, + props = keys(object), + length = props.length, + result = {}; + + while (++index < length) { + var key = props[index], + value = object[key]; + + if (multiValue) { + if (hasOwnProperty.call(result, value)) { + result[value].push(key); + } else { + result[value] = [key]; + } + } + else { + result[value] = key; + } + } + return result; + } + + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) + * for more details. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + var keys = !nativeKeys ? shimKeys : function(object) { + var Ctor = object != null && object.constructor; + if ((typeof Ctor == 'function' && Ctor.prototype === object) || + (typeof object != 'function' && isArrayLike(object))) { + return shimKeys(object); + } + return isObject(object) ? nativeKeys(object) : []; + }; + + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ + function keysIn(object) { + if (object == null) { + return []; + } + if (!isObject(object)) { + object = Object(object); + } + var length = object.length; + length = (length && isLength(length) && + (isArray(object) || (support.nonEnumArgs && isArguments(object))) && length) || 0; + + var Ctor = object.constructor, + index = -1, + isProto = typeof Ctor == 'function' && Ctor.prototype === object, + result = Array(length), + skipIndexes = length > 0; + + while (++index < length) { + result[index] = (index + ''); + } + for (var key in object) { + if (!(skipIndexes && isIndex(key, length)) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + /** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * property of `object` through `iteratee`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the new mapped object. + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + var mapKeys = createObjectMapper(true); + + /** + * Creates an object with the same keys as `object` and values generated by + * running each own enumerable property of `object` through `iteratee`. The + * iteratee function is bound to `thisArg` and invoked with three arguments: + * (value, key, object). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the new mapped object. + * @example + * + * _.mapValues({ 'a': 1, 'b': 2 }, function(n) { + * return n * 3; + * }); + * // => { 'a': 3, 'b': 6 } + * + * var users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * + * // using the `_.property` callback shorthand + * _.mapValues(users, 'age'); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + */ + var mapValues = createObjectMapper(); + + /** + * Recursively merges own enumerable properties of the source object(s), that + * don't resolve to `undefined` into the destination object. Subsequent sources + * overwrite property assignments of previous sources. If `customizer` is + * provided it is invoked to produce the merged values of the destination and + * source properties. If `customizer` returns `undefined` merging is handled + * by the method instead. The `customizer` is bound to `thisArg` and invoked + * with five arguments: (objectValue, sourceValue, key, object, source). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {Object} Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } + * + * // using a customizer callback + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, function(a, b) { + * if (_.isArray(a)) { + * return a.concat(b); + * } + * }); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + var merge = createAssigner(baseMerge); + + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {Function|...(string|string[])} [predicate] The function invoked per + * iteration or property names to omit, specified as individual property + * names or arrays of property names. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.omit(object, 'age'); + * // => { 'user': 'fred' } + * + * _.omit(object, _.isNumber); + * // => { 'user': 'fred' } + */ + var omit = restParam(function(object, props) { + if (object == null) { + return {}; + } + if (typeof props[0] != 'function') { + var props = arrayMap(baseFlatten(props), String); + return pickByArray(object, baseDifference(keysIn(object), props)); + } + var predicate = bindCallback(props[0], props[1], 3); + return pickByCallback(object, function(value, key, object) { + return !predicate(value, key, object); + }); + }); + + /** + * Creates a two dimensional array of the key-value pairs for `object`, + * e.g. `[[key1, value1], [key2, value2]]`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the new array of key-value pairs. + * @example + * + * _.pairs({ 'barney': 36, 'fred': 40 }); + * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) + */ + function pairs(object) { + var index = -1, + props = keys(object), + length = props.length, + result = Array(length); + + while (++index < length) { + var key = props[index]; + result[index] = [key, object[key]]; + } + return result; + } + + /** + * Creates an object composed of the picked `object` properties. Property + * names may be specified as individual arguments or as arrays of property + * names. If `predicate` is provided it is invoked for each property of `object` + * picking the properties `predicate` returns truthy for. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, key, object). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {Function|...(string|string[])} [predicate] The function invoked per + * iteration or property names to pick, specified as individual property + * names or arrays of property names. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.pick(object, 'user'); + * // => { 'user': 'fred' } + * + * _.pick(object, _.isString); + * // => { 'user': 'fred' } + */ + var pick = restParam(function(object, props) { + if (object == null) { + return {}; + } + return typeof props[0] == 'function' + ? pickByCallback(object, bindCallback(props[0], props[1], 3)) + : pickByArray(object, baseFlatten(props)); + }); + + /** + * This method is like `_.get` except that if the resolved value is a function + * it is invoked with the `this` binding of its parent object and its result + * is returned. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to resolve. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; + * + * _.result(object, 'a[0].b.c1'); + * // => 3 + * + * _.result(object, 'a[0].b.c2'); + * // => 4 + * + * _.result(object, 'a.b.c', 'default'); + * // => 'default' + * + * _.result(object, 'a.b.c', _.constant('default')); + * // => 'default' + */ + function result(object, path, defaultValue) { + var result = object == null ? undefined : object[path]; + if (result === undefined) { + if (object != null && !isKey(path, object)) { + path = toPath(path); + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + result = object == null ? undefined : object[last(path)]; + } + result = result === undefined ? defaultValue : result; + } + return isFunction(result) ? result.call(object) : result; + } + + /** + * Sets the property value of `path` on `object`. If a portion of `path` + * does not exist it is created. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to augment. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, 'x[0].y.z', 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + if (object == null) { + return object; + } + var pathKey = (path + ''); + path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path); + + var index = -1, + length = path.length, + endIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = path[index]; + if (isObject(nested)) { + if (index == endIndex) { + nested[key] = value; + } else if (nested[key] == null) { + nested[key] = isIndex(path[index + 1]) ? [] : {}; + } + } + nested = nested[key]; + } + return object; + } + + /** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own enumerable + * properties through `iteratee`, with each invocation potentially mutating + * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked + * with four arguments: (accumulator, value, key, object). Iteratee functions + * may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Object + * @param {Array|Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) { + * result[key] = n * 3; + * }); + * // => { 'a': 3, 'b': 6 } + */ + function transform(object, iteratee, accumulator, thisArg) { + var isArr = isArray(object) || isTypedArray(object); + iteratee = getCallback(iteratee, thisArg, 4); + + if (accumulator == null) { + if (isArr || isObject(object)) { + var Ctor = object.constructor; + if (isArr) { + accumulator = isArray(object) ? new Ctor : []; + } else { + accumulator = baseCreate(isFunction(Ctor) && Ctor.prototype); + } + } else { + accumulator = {}; + } + } + (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) { + return iteratee(accumulator, value, index, object); + }); + return accumulator; + } + + /** + * Creates an array of the own enumerable property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ + function values(object) { + return baseValues(object, keys(object)); + } + + /** + * Creates an array of the own and inherited enumerable property values + * of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.valuesIn(new Foo); + * // => [1, 2, 3] (iteration order is not guaranteed) + */ + function valuesIn(object) { + return baseValues(object, keysIn(object)); + } + + /** + * Checks if `n` is between `start` and up to but not including, `end`. If + * `end` is not specified it is set to `start` with `start` then set to `0`. + * + * @static + * @memberOf _ + * @category Number + * @param {number} n The number to check. + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `n` is in the range, else `false`. + * @example + * + * _.inRange(3, 2, 4); + * // => true + * + * _.inRange(4, 8); + * // => true + * + * _.inRange(4, 2); + * // => false + * + * _.inRange(2, 2); + * // => false + * + * _.inRange(1.2, 2); + * // => true + * + * _.inRange(5.2, 4); + * // => false + */ + function inRange(value, start, end) { + start = +start || 0; + if (typeof end === 'undefined') { + end = start; + start = 0; + } else { + end = +end || 0; + } + return value >= nativeMin(start, end) && value < nativeMax(start, end); + } + + /** + * Produces a random number between `min` and `max` (inclusive). If only one + * argument is provided a number between `0` and the given number is returned. + * If `floating` is `true`, or either `min` or `max` are floats, a floating-point + * number is returned instead of an integer. + * + * @static + * @memberOf _ + * @category Number + * @param {number} [min=0] The minimum possible value. + * @param {number} [max=1] The maximum possible value. + * @param {boolean} [floating] Specify returning a floating-point number. + * @returns {number} Returns the random number. + * @example + * + * _.random(0, 5); + * // => an integer between 0 and 5 + * + * _.random(5); + * // => also an integer between 0 and 5 + * + * _.random(5, true); + * // => a floating-point number between 0 and 5 + * + * _.random(1.2, 5.2); + * // => a floating-point number between 1.2 and 5.2 + */ + function random(min, max, floating) { + if (floating && isIterateeCall(min, max, floating)) { + max = floating = null; + } + var noMin = min == null, + noMax = max == null; + + if (floating == null) { + if (noMax && typeof min == 'boolean') { + floating = min; + min = 1; + } + else if (typeof max == 'boolean') { + floating = max; + noMax = true; + } + } + if (noMin && noMax) { + max = 1; + noMax = false; + } + min = +min || 0; + if (noMax) { + max = min; + min = 0; + } else { + max = +max || 0; + } + if (floating || min % 1 || max % 1) { + var rand = nativeRandom(); + return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max); + } + return baseRandom(min, max); + } + + /** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the camel cased string. + * @example + * + * _.camelCase('Foo Bar'); + * // => 'fooBar' + * + * _.camelCase('--foo-bar'); + * // => 'fooBar' + * + * _.camelCase('__foo_bar__'); + * // => 'fooBar' + */ + var camelCase = createCompounder(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word); + }); + + /** + * Capitalizes the first character of `string`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('fred'); + * // => 'Fred' + */ + function capitalize(string) { + string = baseToString(string); + return string && (string.charAt(0).toUpperCase() + string.slice(1)); + } + + /** + * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ + function deburr(string) { + string = baseToString(string); + return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); + } + + /** + * Checks if `string` ends with the given target string. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to search. + * @param {string} [target] The string to search for. + * @param {number} [position=string.length] The position to search from. + * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. + * @example + * + * _.endsWith('abc', 'c'); + * // => true + * + * _.endsWith('abc', 'b'); + * // => false + * + * _.endsWith('abc', 'b', 2); + * // => true + */ + function endsWith(string, target, position) { + string = baseToString(string); + target = (target + ''); + + var length = string.length; + position = position === undefined + ? length + : nativeMin(position < 0 ? 0 : (+position || 0), length); + + position -= target.length; + return position >= 0 && string.indexOf(target, position) == position; + } + + /** + * Converts the characters "&", "<", ">", '"', "'", and "\`", in `string` to + * their corresponding HTML entities. + * + * **Note:** No other characters are escaped. To escape additional characters + * use a third-party library like [_he_](https://mths.be/he). + * + * Though the ">" character is escaped for symmetry, characters like + * ">" and "/" don't require escaping in HTML and have no special meaning + * unless they're part of a tag or unquoted attribute value. + * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * (under "semi-related fun fact") for more details. + * + * Backticks are escaped because in Internet Explorer < 9, they can break out + * of attribute values or HTML comments. See [#59](https://html5sec.org/#59), + * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and + * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) + * for more details. + * + * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) + * to reduce XSS vectors. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escape('fred, barney, & pebbles'); + * // => 'fred, barney, & pebbles' + */ + function escape(string) { + // Reset `lastIndex` because in IE < 9 `String#replace` does not. + string = baseToString(string); + return (string && reHasUnescapedHtml.test(string)) + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; + } + + /** + * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?", + * "*", "+", "(", ")", "[", "]", "{" and "}" in `string`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https:\/\/lodash\.com\/\)' + */ + function escapeRegExp(string) { + string = baseToString(string); + return (string && reHasRegExpChars.test(string)) + ? string.replace(reRegExpChars, '\\$&') + : string; + } + + /** + * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the kebab cased string. + * @example + * + * _.kebabCase('Foo Bar'); + * // => 'foo-bar' + * + * _.kebabCase('fooBar'); + * // => 'foo-bar' + * + * _.kebabCase('__foo_bar__'); + * // => 'foo-bar' + */ + var kebabCase = createCompounder(function(result, word, index) { + return result + (index ? '-' : '') + word.toLowerCase(); + }); + + /** + * Pads `string` on the left and right sides if it is shorter than `length`. + * Padding characters are truncated if they can't be evenly divided by `length`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.pad('abc', 8); + * // => ' abc ' + * + * _.pad('abc', 8, '_-'); + * // => '_-abc_-_' + * + * _.pad('abc', 3); + * // => 'abc' + */ + function pad(string, length, chars) { + string = baseToString(string); + length = +length; + + var strLength = string.length; + if (strLength >= length || !nativeIsFinite(length)) { + return string; + } + var mid = (length - strLength) / 2, + leftLength = floor(mid), + rightLength = ceil(mid); + + chars = createPadding('', rightLength, chars); + return chars.slice(0, leftLength) + string + chars; + } + + /** + * Pads `string` on the left side if it is shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padLeft('abc', 6); + * // => ' abc' + * + * _.padLeft('abc', 6, '_-'); + * // => '_-_abc' + * + * _.padLeft('abc', 3); + * // => 'abc' + */ + var padLeft = createPadDir(); + + /** + * Pads `string` on the right side if it is shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padRight('abc', 6); + * // => 'abc ' + * + * _.padRight('abc', 6, '_-'); + * // => 'abc_-_' + * + * _.padRight('abc', 3); + * // => 'abc' + */ + var padRight = createPadDir(true); + + /** + * Converts `string` to an integer of the specified radix. If `radix` is + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, + * in which case a `radix` of `16` is used. + * + * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E) + * of `parseInt`. + * + * @static + * @memberOf _ + * @category String + * @param {string} string The string to convert. + * @param {number} [radix] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {number} Returns the converted integer. + * @example + * + * _.parseInt('08'); + * // => 8 + * + * _.map(['6', '08', '10'], _.parseInt); + * // => [6, 8, 10] + */ + function parseInt(string, radix, guard) { + if (guard && isIterateeCall(string, radix, guard)) { + radix = 0; + } + return nativeParseInt(string, radix); + } + // Fallback for environments with pre-ES5 implementations. + if (nativeParseInt(whitespace + '08') != 8) { + parseInt = function(string, radix, guard) { + // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. + // Chrome fails to trim leading whitespace characters. + // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. + if (guard ? isIterateeCall(string, radix, guard) : radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } + string = trim(string); + return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); + }; + } + + /** + * Repeats the given string `n` times. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to repeat. + * @param {number} [n=0] The number of times to repeat the string. + * @returns {string} Returns the repeated string. + * @example + * + * _.repeat('*', 3); + * // => '***' + * + * _.repeat('abc', 2); + * // => 'abcabc' + * + * _.repeat('abc', 0); + * // => '' + */ + function repeat(string, n) { + var result = ''; + string = baseToString(string); + n = +n; + if (n < 1 || !string || !nativeIsFinite(n)) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = floor(n / 2); + string += string; + } while (n); + + return result; + } + + /** + * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the snake cased string. + * @example + * + * _.snakeCase('Foo Bar'); + * // => 'foo_bar' + * + * _.snakeCase('fooBar'); + * // => 'foo_bar' + * + * _.snakeCase('--foo-bar'); + * // => 'foo_bar' + */ + var snakeCase = createCompounder(function(result, word, index) { + return result + (index ? '_' : '') + word.toLowerCase(); + }); + + /** + * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the start cased string. + * @example + * + * _.startCase('--foo-bar'); + * // => 'Foo Bar' + * + * _.startCase('fooBar'); + * // => 'Foo Bar' + * + * _.startCase('__foo_bar__'); + * // => 'Foo Bar' + */ + var startCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1)); + }); + + /** + * Checks if `string` starts with the given target string. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to search. + * @param {string} [target] The string to search for. + * @param {number} [position=0] The position to search from. + * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`. + * @example + * + * _.startsWith('abc', 'a'); + * // => true + * + * _.startsWith('abc', 'b'); + * // => false + * + * _.startsWith('abc', 'b', 1); + * // => true + */ + function startsWith(string, target, position) { + string = baseToString(string); + position = position == null + ? 0 + : nativeMin(position < 0 ? 0 : (+position || 0), string.length); + + return string.lastIndexOf(target, position) == position; + } + + /** + * Creates a compiled template function that can interpolate data properties + * in "interpolate" delimiters, HTML-escape interpolated data properties in + * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data + * properties may be accessed as free variables in the template. If a setting + * object is provided it takes precedence over `_.templateSettings` values. + * + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The template string. + * @param {Object} [options] The options object. + * @param {RegExp} [options.escape] The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate] The "evaluate" delimiter. + * @param {Object} [options.imports] An object to import into the template as free variables. + * @param {RegExp} [options.interpolate] The "interpolate" delimiter. + * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. + * @param {string} [options.variable] The data object variable name. + * @param- {Object} [otherOptions] Enables the legacy `options` param signature. + * @returns {Function} Returns the compiled template function. + * @example + * + * // using the "interpolate" delimiter to create a compiled template + * var compiled = _.template('hello <%= user %>!'); + * compiled({ 'user': 'fred' }); + * // => 'hello fred!' + * + * // using the HTML "escape" delimiter to escape data property values + * var compiled = _.template('<%- value %>'); + * compiled({ 'value': ' + + + + +
{{ "%+010d"|sprintf:-123 }}
+
{{ "%+010d"|vsprintf:[-123] }}
+
{{ "%+010d"|fmt:-123 }}
+
{{ "%+010d"|vfmt:[-123] }}
+
{{ "I've got %2$d apples and %1$d oranges."|fmt:4:2 }}
+
{{ "I've got %(apples)d apples and %(oranges)d oranges."|fmt:{apples: 2, oranges: 4} }}
+ + + + diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/angular-sprintf.min.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/angular-sprintf.min.js new file mode 100644 index 00000000..dbaf744d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/angular-sprintf.min.js @@ -0,0 +1,4 @@ +/*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */ + +angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(a){return a("sprintf")}]).filter("vsprintf",function(){return function(a,b){return vsprintf(a,b)}}).filter("vfmt",["$filter",function(a){return a("vsprintf")}]); +//# sourceMappingURL=angular-sprintf.min.map \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/angular-sprintf.min.map b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/angular-sprintf.min.map new file mode 100644 index 00000000..055964c6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/angular-sprintf.min.map @@ -0,0 +1 @@ +{"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/sprintf.min.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/sprintf.min.js new file mode 100644 index 00000000..d5bcd097 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/sprintf.min.js @@ -0,0 +1,4 @@ +/*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */ + +!function(a){function b(){var a=arguments[0],c=b.cache;return c[a]&&c.hasOwnProperty(a)||(c[a]=b.parse(a)),b.format.call(null,c[a],arguments)}function c(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function d(a,b){return Array(b+1).join(a)}var e={not_string:/[^s]/,number:/[dief]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fiosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};b.format=function(a,f){var g,h,i,j,k,l,m,n=1,o=a.length,p="",q=[],r=!0,s="";for(h=0;o>h;h++)if(p=c(a[h]),"string"===p)q[q.length]=a[h];else if("array"===p){if(j=a[h],j[2])for(g=f[n],i=0;i=0),j[8]){case"b":g=g.toString(2);break;case"c":g=String.fromCharCode(g);break;case"d":case"i":g=parseInt(g,10);break;case"e":g=j[7]?g.toExponential(j[7]):g.toExponential();break;case"f":g=j[7]?parseFloat(g).toFixed(j[7]):parseFloat(g);break;case"o":g=g.toString(8);break;case"s":g=(g=String(g))&&j[7]?g.substring(0,j[7]):g;break;case"u":g>>>=0;break;case"x":g=g.toString(16);break;case"X":g=g.toString(16).toUpperCase()}!e.number.test(j[8])||r&&!j[3]?s="":(s=r?"+":"-",g=g.toString().replace(e.sign,"")),l=j[4]?"0"===j[4]?"0":j[4].charAt(1):" ",m=j[6]-(s+g).length,k=j[6]&&m>0?d(l,m):"",q[q.length]=j[5]?s+g+k:"0"===l?s+k+g:k+s+g}return q.join("")},b.cache={},b.parse=function(a){for(var b=a,c=[],d=[],f=0;b;){if(null!==(c=e.text.exec(b)))d[d.length]=c[0];else if(null!==(c=e.modulo.exec(b)))d[d.length]="%";else{if(null===(c=e.placeholder.exec(b)))throw new SyntaxError("[sprintf] unexpected placeholder");if(c[2]){f|=1;var g=[],h=c[2],i=[];if(null===(i=e.key.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(g[g.length]=i[1];""!==(h=h.substring(i[0].length));)if(null!==(i=e.key_access.exec(h)))g[g.length]=i[1];else{if(null===(i=e.index_access.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");g[g.length]=i[1]}c[2]=g}else f|=2;if(3===f)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d[d.length]=c}b=b.substring(c[0].length)}return d};var f=function(a,c,d){return d=(c||[]).slice(0),d.splice(0,0,a),b.apply(null,d)};"undefined"!=typeof exports?(exports.sprintf=b,exports.vsprintf=f):(a.sprintf=b,a.vsprintf=f,"function"==typeof define&&define.amd&&define(function(){return{sprintf:b,vsprintf:f}}))}("undefined"==typeof window?this:window); +//# sourceMappingURL=sprintf.min.map \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/sprintf.min.map b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/sprintf.min.map new file mode 100644 index 00000000..33fe1636 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/dist/sprintf.min.map @@ -0,0 +1 @@ +{"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","toExponential","parseFloat","toFixed","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAaN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WAoJjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GA1KtC,GAAII,IACAC,WAAY,OACZC,OAAQ,SACRC,KAAM,YACNC,OAAQ,WACRC,YAAa,wFACbxB,IAAK,sBACLyB,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV5B,GAAQM,OAAS,SAASuB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,EAAJP,EAAiBA,IAEzB,GADAS,EAAYjC,EAASqB,EAAWG,IACd,WAAdS,EACAC,EAAOA,EAAOF,QAAUX,EAAWG,OAElC,IAAkB,UAAdS,EAAuB,CAE5B,GADAP,EAAQL,EAAWG,GACfE,EAAM,GAEN,IADAH,EAAMD,EAAKQ,GACNL,EAAI,EAAGA,EAAIC,EAAM,GAAGM,OAAQP,IAAK,CAClC,IAAKF,EAAI3B,eAAe8B,EAAM,GAAGD,IAC7B,KAAM,IAAIW,OAAM5C,EAAQ,yCAA0CkC,EAAM,GAAGD,IAE/EF,GAAMA,EAAIG,EAAM,GAAGD,QAIvBF,GADKG,EAAM,GACLJ,EAAKI,EAAM,IAGXJ,EAAKQ,IAOf,IAJqB,YAAjB9B,EAASuB,KACTA,EAAMA,KAGNX,EAAGC,WAAWwB,KAAKX,EAAM,KAAyB,UAAjB1B,EAASuB,IAAoBe,MAAMf,GACpE,KAAM,IAAIgB,WAAU/C,EAAQ,0CAA2CQ,EAASuB,IAOpF,QAJIX,EAAGE,OAAOuB,KAAKX,EAAM,MACrBS,EAAcZ,GAAO,GAGjBG,EAAM,IACV,IAAK,IACDH,EAAMA,EAAInB,SAAS,EACvB,MACA,KAAK,IACDmB,EAAMiB,OAAOC,aAAalB,EAC9B,MACA,KAAK,IACL,IAAK,IACDA,EAAMmB,SAASnB,EAAK,GACxB,MACA,KAAK,IACDA,EAAMG,EAAM,GAAKH,EAAIoB,cAAcjB,EAAM,IAAMH,EAAIoB,eACvD,MACA,KAAK,IACDpB,EAAMG,EAAM,GAAKkB,WAAWrB,GAAKsB,QAAQnB,EAAM,IAAMkB,WAAWrB,EACpE,MACA,KAAK,IACDA,EAAMA,EAAInB,SAAS,EACvB,MACA,KAAK,IACDmB,GAAQA,EAAMiB,OAAOjB,KAASG,EAAM,GAAKH,EAAIuB,UAAU,EAAGpB,EAAM,IAAMH,CAC1E,MACA,KAAK,IACDA,KAAc,CAClB,MACA,KAAK,IACDA,EAAMA,EAAInB,SAAS,GACvB,MACA,KAAK,IACDmB,EAAMA,EAAInB,SAAS,IAAI2C,eAG3BnC,EAAGE,OAAOuB,KAAKX,EAAM,KAASS,IAAeT,EAAM,GAKnDN,EAAO,IAJPA,EAAOe,EAAc,IAAM,IAC3BZ,EAAMA,EAAInB,WAAW4C,QAAQpC,EAAGQ,KAAM,KAK1CQ,EAAgBF,EAAM,GAAkB,MAAbA,EAAM,GAAa,IAAMA,EAAM,GAAGuB,OAAO,GAAK,IACzEpB,EAAaH,EAAM,IAAMN,EAAOG,GAAKS,OACrCL,EAAMD,EAAM,IAAMG,EAAa,EAAItB,EAAWqB,EAAeC,GAAoB,GACjFK,EAAOA,EAAOF,QAAUN,EAAM,GAAKN,EAAOG,EAAMI,EAAyB,MAAlBC,EAAwBR,EAAOO,EAAMJ,EAAMI,EAAMP,EAAOG,EAGvH,MAAOW,GAAOvB,KAAK,KAGvBnB,EAAQG,SAERH,EAAQK,MAAQ,SAASqD,GAErB,IADA,GAAIC,GAAOD,EAAKxB,KAAYL,KAAiB+B,EAAY,EAClDD,GAAM,CACT,GAAqC,QAAhCzB,EAAQd,EAAGG,KAAKsC,KAAKF,IACtB9B,EAAWA,EAAWW,QAAUN,EAAM,OAErC,IAAuC,QAAlCA,EAAQd,EAAGI,OAAOqC,KAAKF,IAC7B9B,EAAWA,EAAWW,QAAU,QAE/B,CAAA,GAA4C,QAAvCN,EAAQd,EAAGK,YAAYoC,KAAKF,IAgClC,KAAM,IAAIG,aAAY,mCA/BtB,IAAI5B,EAAM,GAAI,CACV0B,GAAa,CACb,IAAIG,MAAiBC,EAAoB9B,EAAM,GAAI+B,IACnD,IAAuD,QAAlDA,EAAc7C,EAAGnB,IAAI4D,KAAKG,IAe3B,KAAM,IAAIF,aAAY,+CAbtB,KADAC,EAAWA,EAAWvB,QAAUyB,EAAY,GACwC,MAA5ED,EAAoBA,EAAkBV,UAAUW,EAAY,GAAGzB,UACnE,GAA8D,QAAzDyB,EAAc7C,EAAGM,WAAWmC,KAAKG,IAClCD,EAAWA,EAAWvB,QAAUyB,EAAY,OAE3C,CAAA,GAAgE,QAA3DA,EAAc7C,EAAGO,aAAakC,KAAKG,IAIzC,KAAM,IAAIF,aAAY,+CAHtBC,GAAWA,EAAWvB,QAAUyB,EAAY,GAUxD/B,EAAM,GAAK6B,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAIhB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpCyB,EAAOA,EAAKL,UAAUpB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIqC,GAAW,SAASR,EAAK5B,EAAMqC,GAG/B,MAFAA,IAASrC,OAAYjB,MAAM,GAC3BsD,EAAMC,OAAO,EAAG,EAAGV,GACZ1D,EAAQqE,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQtE,QAAUA,EAClBsE,QAAQJ,SAAWA,IAGnBnE,EAAOC,QAAUA,EACjBD,EAAOmE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACIvE,QAASA,EACTkE,SAAUA,OAKT,mBAAXnE,QAAyB0E,KAAO1E"} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/gruntfile.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/gruntfile.js new file mode 100644 index 00000000..246e1c3b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/gruntfile.js @@ -0,0 +1,36 @@ +module.exports = function(grunt) { + grunt.initConfig({ + pkg: grunt.file.readJSON("package.json"), + + uglify: { + options: { + banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n", + sourceMap: true + }, + build: { + files: [ + { + src: "src/sprintf.js", + dest: "dist/sprintf.min.js" + }, + { + src: "src/angular-sprintf.js", + dest: "dist/angular-sprintf.min.js" + } + ] + } + }, + + watch: { + js: { + files: "src/*.js", + tasks: ["uglify"] + } + } + }) + + grunt.loadNpmTasks("grunt-contrib-uglify") + grunt.loadNpmTasks("grunt-contrib-watch") + + grunt.registerTask("default", ["uglify", "watch"]) +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/package.json b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/package.json new file mode 100644 index 00000000..fa573225 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/package.json @@ -0,0 +1,51 @@ +{ + "name": "sprintf-js", + "version": "1.0.2", + "description": "JavaScript sprintf implementation", + "author": { + "name": "Alexandru Marasteanu", + "email": "hello@alexei.ro", + "url": "http://alexei.ro/" + }, + "main": "src/sprintf.js", + "scripts": { + "test": "mocha test/test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/alexei/sprintf.js.git" + }, + "license": "BSD-3-Clause", + "devDependencies": { + "mocha": "*", + "grunt": "*", + "grunt-contrib-watch": "*", + "grunt-contrib-uglify": "*" + }, + "gitHead": "e8c73065cd1a79a32c697806a4e85f1fe7917592", + "bugs": { + "url": "https://github.com/alexei/sprintf.js/issues" + }, + "homepage": "https://github.com/alexei/sprintf.js", + "_id": "sprintf-js@1.0.2", + "_shasum": "11e4d84ff32144e35b0bf3a66f8587f38d8f9978", + "_from": "sprintf-js@>=1.0.2 <1.1.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "alexei", + "email": "hello@alexei.ro" + }, + "maintainers": [ + { + "name": "alexei", + "email": "hello@alexei.ro" + } + ], + "dist": { + "shasum": "11e4d84ff32144e35b0bf3a66f8587f38d8f9978", + "tarball": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/src/angular-sprintf.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/src/angular-sprintf.js new file mode 100644 index 00000000..9c69123b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/src/angular-sprintf.js @@ -0,0 +1,18 @@ +angular. + module("sprintf", []). + filter("sprintf", function() { + return function() { + return sprintf.apply(null, arguments) + } + }). + filter("fmt", ["$filter", function($filter) { + return $filter("sprintf") + }]). + filter("vsprintf", function() { + return function(format, argv) { + return vsprintf(format, argv) + } + }). + filter("vfmt", ["$filter", function($filter) { + return $filter("vsprintf") + }]) diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/src/sprintf.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/src/sprintf.js new file mode 100644 index 00000000..0ccb64c9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/src/sprintf.js @@ -0,0 +1,195 @@ +(function(window) { + var re = { + not_string: /[^s]/, + number: /[dief]/, + text: /^[^\x25]+/, + modulo: /^\x25{2}/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fiosuxX])/, + key: /^([a-z_][a-z_\d]*)/i, + key_access: /^\.([a-z_][a-z_\d]*)/i, + index_access: /^\[(\d+)\]/, + sign: /^[\+\-]/ + } + + function sprintf() { + var key = arguments[0], cache = sprintf.cache + if (!(cache[key] && cache.hasOwnProperty(key))) { + cache[key] = sprintf.parse(key) + } + return sprintf.format.call(null, cache[key], arguments) + } + + sprintf.format = function(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "" + for (i = 0; i < tree_length; i++) { + node_type = get_type(parse_tree[i]) + if (node_type === "string") { + output[output.length] = parse_tree[i] + } + else if (node_type === "array") { + match = parse_tree[i] // convenience purposes only + if (match[2]) { // keyword argument + arg = argv[cursor] + for (k = 0; k < match[2].length; k++) { + if (!arg.hasOwnProperty(match[2][k])) { + throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k])) + } + arg = arg[match[2][k]] + } + } + else if (match[1]) { // positional argument (explicit) + arg = argv[match[1]] + } + else { // positional argument (implicit) + arg = argv[cursor++] + } + + if (get_type(arg) == "function") { + arg = arg() + } + + if (re.not_string.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) { + throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) + } + + if (re.number.test(match[8])) { + is_positive = arg >= 0 + } + + switch (match[8]) { + case "b": + arg = arg.toString(2) + break + case "c": + arg = String.fromCharCode(arg) + break + case "d": + case "i": + arg = parseInt(arg, 10) + break + case "e": + arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential() + break + case "f": + arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) + break + case "o": + arg = arg.toString(8) + break + case "s": + arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg) + break + case "u": + arg = arg >>> 0 + break + case "x": + arg = arg.toString(16) + break + case "X": + arg = arg.toString(16).toUpperCase() + break + } + if (re.number.test(match[8]) && (!is_positive || match[3])) { + sign = is_positive ? "+" : "-" + arg = arg.toString().replace(re.sign, "") + } + else { + sign = "" + } + pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " " + pad_length = match[6] - (sign + arg).length + pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : "" + output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg) + } + } + return output.join("") + } + + sprintf.cache = {} + + sprintf.parse = function(fmt) { + var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 + while (_fmt) { + if ((match = re.text.exec(_fmt)) !== null) { + parse_tree[parse_tree.length] = match[0] + } + else if ((match = re.modulo.exec(_fmt)) !== null) { + parse_tree[parse_tree.length] = "%" + } + else if ((match = re.placeholder.exec(_fmt)) !== null) { + if (match[2]) { + arg_names |= 1 + var field_list = [], replacement_field = match[2], field_match = [] + if ((field_match = re.key.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") { + if ((field_match = re.key_access.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + } + else if ((field_match = re.index_access.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + } + else { + throw new SyntaxError("[sprintf] failed to parse named argument key") + } + } + } + else { + throw new SyntaxError("[sprintf] failed to parse named argument key") + } + match[2] = field_list + } + else { + arg_names |= 2 + } + if (arg_names === 3) { + throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") + } + parse_tree[parse_tree.length] = match + } + else { + throw new SyntaxError("[sprintf] unexpected placeholder") + } + _fmt = _fmt.substring(match[0].length) + } + return parse_tree + } + + var vsprintf = function(fmt, argv, _argv) { + _argv = (argv || []).slice(0) + _argv.splice(0, 0, fmt) + return sprintf.apply(null, _argv) + } + + /** + * helpers + */ + function get_type(variable) { + return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() + } + + function str_repeat(input, multiplier) { + return Array(multiplier + 1).join(input) + } + + /** + * export to either browser or node.js + */ + if (typeof exports !== "undefined") { + exports.sprintf = sprintf + exports.vsprintf = vsprintf + } + else { + window.sprintf = sprintf + window.vsprintf = vsprintf + + if (typeof define === "function" && define.amd) { + define(function() { + return { + sprintf: sprintf, + vsprintf: vsprintf + } + }) + } + } +})(typeof window === "undefined" ? this : window); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/test/test.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/test/test.js new file mode 100644 index 00000000..1717d8fd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/test/test.js @@ -0,0 +1,72 @@ +var assert = require("assert"), + sprintfjs = require("../src/sprintf.js"), + sprintf = sprintfjs.sprintf, + vsprintf = sprintfjs.vsprintf + +describe("sprintfjs", function() { + it("should return formated strings for simple placeholders", function() { + assert.equal("%", sprintf("%%")) + assert.equal("10", sprintf("%b", 2)) + assert.equal("A", sprintf("%c", 65)) + assert.equal("2", sprintf("%d", 2)) + assert.equal("2", sprintf("%i", 2)) + assert.equal("2", sprintf("%d", "2")) + assert.equal("2", sprintf("%i", "2")) + assert.equal("2e+0", sprintf("%e", 2)) + assert.equal("2", sprintf("%u", 2)) + assert.equal("4294967294", sprintf("%u", -2)) + assert.equal("2.2", sprintf("%f", 2.2)) + assert.equal("10", sprintf("%o", 8)) + assert.equal("%s", sprintf("%s", "%s")) + assert.equal("ff", sprintf("%x", 255)) + assert.equal("FF", sprintf("%X", 255)) + assert.equal("Polly wants a cracker", sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")) + assert.equal("Hello world!", sprintf("Hello %(who)s!", {"who": "world"})) + }) + + it("should return formated strings for complex placeholders", function() { + // sign + assert.equal("2", sprintf("%d", 2)) + assert.equal("-2", sprintf("%d", -2)) + assert.equal("+2", sprintf("%+d", 2)) + assert.equal("-2", sprintf("%+d", -2)) + assert.equal("2", sprintf("%i", 2)) + assert.equal("-2", sprintf("%i", -2)) + assert.equal("+2", sprintf("%+i", 2)) + assert.equal("-2", sprintf("%+i", -2)) + assert.equal("2.2", sprintf("%f", 2.2)) + assert.equal("-2.2", sprintf("%f", -2.2)) + assert.equal("+2.2", sprintf("%+f", 2.2)) + assert.equal("-2.2", sprintf("%+f", -2.2)) + assert.equal("-2.3", sprintf("%+.1f", -2.34)) + assert.equal("-0.0", sprintf("%+.1f", -0.01)) + assert.equal("-000000123", sprintf("%+010d", -123)) + assert.equal("______-123", sprintf("%+'_10d", -123)) + assert.equal("-234.34 123.2", sprintf("%f %f", -234.34, 123.2)) + + // padding + assert.equal("-0002", sprintf("%05d", -2)) + assert.equal("-0002", sprintf("%05i", -2)) + assert.equal(" <", sprintf("%5s", "<")) + assert.equal("0000<", sprintf("%05s", "<")) + assert.equal("____<", sprintf("%'_5s", "<")) + assert.equal("> ", sprintf("%-5s", ">")) + assert.equal(">0000", sprintf("%0-5s", ">")) + assert.equal(">____", sprintf("%'_-5s", ">")) + assert.equal("xxxxxx", sprintf("%5s", "xxxxxx")) + assert.equal("1234", sprintf("%02u", 1234)) + assert.equal(" -10.235", sprintf("%8.3f", -10.23456)) + assert.equal("-12.34 xxx", sprintf("%f %s", -12.34, "xxx")) + + // precision + assert.equal("2.3", sprintf("%.1f", 2.345)) + assert.equal("xxxxx", sprintf("%5.5s", "xxxxxx")) + assert.equal(" x", sprintf("%5.1s", "xxxxxx")) + + }) + + it("should return formated strings for callbacks", function() { + assert.equal("foobar", sprintf("%s", function() { return "foobar" })) + assert.equal(Date.now(), sprintf("%s", Date.now)) // should pass... + }) +}) diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/package.json b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/package.json new file mode 100644 index 00000000..3c1b7fd7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/argparse/package.json @@ -0,0 +1,62 @@ +{ + "name": "argparse", + "description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library", + "version": "1.0.2", + "keywords": [ + "cli", + "parser", + "argparse", + "option", + "args" + ], + "homepage": "https://github.com/nodeca/argparse", + "contributors": [ + { + "name": "Eugene Shkuropat" + }, + { + "name": "Paul Jacobson" + } + ], + "bugs": { + "url": "https://github.com/nodeca/argparse/issues" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/nodeca/argparse.git" + }, + "main": "./index.js", + "scripts": { + "test": "make test" + }, + "dependencies": { + "lodash": ">= 3.2.0 < 4.0.0", + "sprintf-js": "~1.0.2" + }, + "devDependencies": { + "mocha": "*" + }, + "gitHead": "990f1b5332e70dd3c1c437d2f4077a2b63ac9674", + "_id": "argparse@1.0.2", + "_shasum": "bcfae39059656d1973d0b9e6a1a74154b5a9a136", + "_from": "argparse@>=1.0.2 <1.1.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "vitaly", + "email": "vitaly@rcdesign.ru" + }, + "maintainers": [ + { + "name": "vitaly", + "email": "vitaly@rcdesign.ru" + } + ], + "dist": { + "shasum": "bcfae39059656d1973d0b9e6a1a74154b5a9a136", + "tarball": "http://registry.npmjs.org/argparse/-/argparse-1.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/ChangeLog b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/ChangeLog new file mode 100644 index 00000000..72d64b5d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/ChangeLog @@ -0,0 +1,111 @@ +2015-04-17: Version 2.2.0 + + * Support ES6 import and export declarations (issue 1000) + * Fix line terminator before arrow not recognized as error (issue 1009) + * Support ES6 destructuring (issue 1045) + * Support ES6 template literal (issue 1074) + * Fix the handling of invalid/incomplete string escape sequences (issue 1106) + * Fix ES3 static member access restriction (issue 1120) + * Support for `super` in ES6 class (issue 1147) + +2015-03-09: Version 2.1.0 + + * Support ES6 class (issue 1001) + * Support ES6 rest parameter (issue 1011) + * Expand the location of property getter, setter, and methods (issue 1029) + * Enable TryStatement transition to a single handler (issue 1031) + * Support ES6 computed property name (issue 1037) + * Tolerate unclosed block comment (issue 1041) + * Support ES6 lexical declaration (issue 1065) + +2015-02-06: Version 2.0.0 + + * Support ES6 arrow function (issue 517) + * Support ES6 Unicode code point escape (issue 521) + * Improve the speed and accuracy of comment attachment (issue 522) + * Support ES6 default parameter (issue 519) + * Support ES6 regular expression flags (issue 557) + * Fix scanning of implicit octal literals (issue 565) + * Fix the handling of automatic semicolon insertion (issue 574) + * Support ES6 method definition (issue 620) + * Support ES6 octal integer literal (issue 621) + * Support ES6 binary integer literal (issue 622) + * Support ES6 object literal property value shorthand (issue 624) + +2015-03-03: Version 1.2.5 + + * Fix scanning of implicit octal literals (issue 565) + +2015-02-05: Version 1.2.4 + + * Fix parsing of LeftHandSideExpression in ForInStatement (issue 560) + * Fix the handling of automatic semicolon insertion (issue 574) + +2015-01-18: Version 1.2.3 + + * Fix division by this (issue 616) + +2014-05-18: Version 1.2.2 + + * Fix duplicated tokens when collecting comments (issue 537) + +2014-05-04: Version 1.2.1 + + * Ensure that Program node may still have leading comments (issue 536) + +2014-04-29: Version 1.2.0 + + * Fix semicolon handling for expression statement (issue 462, 533) + * Disallow escaped characters in regular expression flags (issue 503) + * Performance improvement for location tracking (issue 520) + * Improve the speed of comment attachment (issue 522) + +2014-03-26: Version 1.1.1 + + * Fix token handling of forward slash after an array literal (issue 512) + +2014-03-23: Version 1.1.0 + + * Optionally attach comments to the owning syntax nodes (issue 197) + * Simplify binary parsing with stack-based shift reduce (issue 352) + * Always include the raw source of literals (issue 376) + * Add optional input source information (issue 386) + * Tokenizer API for pure lexical scanning (issue 398) + * Improve the web site and its online demos (issue 337, 400, 404) + * Performance improvement for location tracking (issue 417, 424) + * Support HTML comment syntax (issue 451) + * Drop support for legacy browsers (issue 474) + +2013-08-27: Version 1.0.4 + + * Minimize the payload for packages (issue 362) + * Fix missing cases on an empty switch statement (issue 436) + * Support escaped ] in regexp literal character classes (issue 442) + * Tolerate invalid left-hand side expression (issue 130) + +2013-05-17: Version 1.0.3 + + * Variable declaration needs at least one declarator (issue 391) + * Fix benchmark's variance unit conversion (issue 397) + * IE < 9: \v should be treated as vertical tab (issue 405) + * Unary expressions should always have prefix: true (issue 418) + * Catch clause should only accept an identifier (issue 423) + * Tolerate setters without parameter (issue 426) + +2012-11-02: Version 1.0.2 + + Improvement: + + * Fix esvalidate JUnit output upon a syntax error (issue 374) + +2012-10-28: Version 1.0.1 + + Improvements: + + * esvalidate understands shebang in a Unix shell script (issue 361) + * esvalidate treats fatal parsing failure as an error (issue 361) + * Reduce Node.js package via .npmignore (issue 362) + +2012-10-22: Version 1.0.0 + + Initial release. diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/LICENSE.BSD b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/LICENSE.BSD new file mode 100644 index 00000000..3e580c35 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/README.md b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/README.md new file mode 100644 index 00000000..9ba7c0f5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/README.md @@ -0,0 +1,23 @@ +**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance, +standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +parser written in ECMAScript (also popularly known as +[JavaScript](https://en.wikipedia.org/wiki/JavaScript). +Esprima is created and maintained by [Ariya Hidayat](https://twitter.com/ariyahidayat), +with the help of [many contributors](https://github.com/jquery/esprima/contributors). + +### Features + +- Full support for ECMAScript 5.1 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm)) +- Sensible [syntax tree format](https://github.com/estree/estree/blob/master/spec.md) as standardized by [EStree project](https://github.com/estree/estree) +- Optional tracking of syntax node location (index-based and line-column) +- Heavily tested (~1000 [unit tests](https://github.com/jquery/esprima/tree/master/test/fixtures) with [full code coverage](https://travis-ci.org/jquery/esprima)) +- [Partial support](https://github.com/jquery/esprima/issues/1099) for ECMAScript 6 + +Esprima serves as a **building block** for some JavaScript +language tools, from [code instrumentation](http://esprima.org/demo/functiontrace.html) +to [editor autocompletion](http://esprima.org/demo/autocomplete.html). + +Esprima runs on many popular web browsers, as well as other ECMAScript platforms such as +[Rhino](http://www.mozilla.org/rhino), [Nashorn](http://openjdk.java.net/projects/nashorn/), and [Node.js](https://npmjs.org/package/esprima). + +For more information, check the web site [esprima.org](http://esprima.org). diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/bin/esparse.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/bin/esparse.js new file mode 100755 index 00000000..56036669 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/bin/esparse.js @@ -0,0 +1,127 @@ +#!/usr/bin/env node +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint sloppy:true node:true rhino:true */ + +var fs, esprima, fname, content, options, syntax; + +if (typeof require === 'function') { + fs = require('fs'); + esprima = require('esprima'); +} else if (typeof load === 'function') { + try { + load('esprima.js'); + } catch (e) { + load('../esprima.js'); + } +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { argv: arguments, exit: quit }; + process.argv.unshift('esparse.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esparse [options] file.js'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --comment Gather all line and block comments in an array'); + console.log(' --loc Include line-column location info for each syntax node'); + console.log(' --range Include index-based range for each syntax node'); + console.log(' --raw Display the raw value of literals'); + console.log(' --tokens List all tokens in an array'); + console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)'); + console.log(' -v, --version Shows program version'); + console.log(); + process.exit(1); +} + +if (process.argv.length <= 2) { + showUsage(); +} + +options = {}; + +process.argv.splice(2).forEach(function (entry) { + + if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Parser (using Esprima version', esprima.version, ')'); + console.log(); + process.exit(0); + } else if (entry === '--comment') { + options.comment = true; + } else if (entry === '--loc') { + options.loc = true; + } else if (entry === '--range') { + options.range = true; + } else if (entry === '--raw') { + options.raw = true; + } else if (entry === '--tokens') { + options.tokens = true; + } else if (entry === '--tolerant') { + options.tolerant = true; + } else if (entry.slice(0, 2) === '--') { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } else if (typeof fname === 'string') { + console.log('Error: more than one input file.'); + process.exit(1); + } else { + fname = entry; + } +}); + +if (typeof fname !== 'string') { + console.log('Error: no input file.'); + process.exit(1); +} + +// Special handling for regular expression literal since we need to +// convert it to a string literal, otherwise it will be decoded +// as object "{}" and the regular expression would be lost. +function adjustRegexLiteral(key, value) { + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } + return value; +} + +try { + content = fs.readFileSync(fname, 'utf-8'); + syntax = esprima.parse(content, options); + console.log(JSON.stringify(syntax, adjustRegexLiteral, 4)); +} catch (e) { + console.log('Error: ' + e.message); + process.exit(1); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js new file mode 100755 index 00000000..dddd8a2a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js @@ -0,0 +1,199 @@ +#!/usr/bin/env node +/* + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint sloppy:true plusplus:true node:true rhino:true */ +/*global phantom:true */ + +var fs, system, esprima, options, fnames, count; + +if (typeof esprima === 'undefined') { + // PhantomJS can only require() relative files + if (typeof phantom === 'object') { + fs = require('fs'); + system = require('system'); + esprima = require('./esprima'); + } else if (typeof require === 'function') { + fs = require('fs'); + esprima = require('esprima'); + } else if (typeof load === 'function') { + try { + load('esprima.js'); + } catch (e) { + load('../esprima.js'); + } + } +} + +// Shims to Node.js objects when running under PhantomJS 1.7+. +if (typeof phantom === 'object') { + fs.readFileSync = fs.read; + process = { + argv: [].slice.call(system.args), + exit: phantom.exit + }; + process.argv.unshift('phantomjs'); +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { argv: arguments, exit: quit }; + process.argv.unshift('esvalidate.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esvalidate [options] file.js'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --format=type Set the report format, plain (default) or junit'); + console.log(' -v, --version Print program version'); + console.log(); + process.exit(1); +} + +if (process.argv.length <= 2) { + showUsage(); +} + +options = { + format: 'plain' +}; + +fnames = []; + +process.argv.splice(2).forEach(function (entry) { + + if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Validator (using Esprima version', esprima.version, ')'); + console.log(); + process.exit(0); + } else if (entry.slice(0, 9) === '--format=') { + options.format = entry.slice(9); + if (options.format !== 'plain' && options.format !== 'junit') { + console.log('Error: unknown report format ' + options.format + '.'); + process.exit(1); + } + } else if (entry.slice(0, 2) === '--') { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } else { + fnames.push(entry); + } +}); + +if (fnames.length === 0) { + console.log('Error: no input file.'); + process.exit(1); +} + +if (options.format === 'junit') { + console.log(''); + console.log(''); +} + +count = 0; +fnames.forEach(function (fname) { + var content, timestamp, syntax, name; + try { + content = fs.readFileSync(fname, 'utf-8'); + + if (content[0] === '#' && content[1] === '!') { + content = '//' + content.substr(2, content.length); + } + + timestamp = Date.now(); + syntax = esprima.parse(content, { tolerant: true }); + + if (options.format === 'junit') { + + name = fname; + if (name.lastIndexOf('/') >= 0) { + name = name.slice(name.lastIndexOf('/') + 1); + } + + console.log(''); + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + console.log(' '); + console.log(' ' + + error.message + '(' + name + ':' + error.lineNumber + ')' + + ''); + console.log(' '); + }); + + console.log(''); + + } else if (options.format === 'plain') { + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + msg = fname + ':' + error.lineNumber + ': ' + msg; + console.log(msg); + ++count; + }); + + } + } catch (e) { + ++count; + if (options.format === 'junit') { + console.log(''); + console.log(' '); + console.log(' ' + + e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') + + ')'); + console.log(' '); + console.log(''); + } else { + console.log('Error: ' + e.message); + } + } +}); + +if (options.format === 'junit') { + console.log(''); +} + +if (count > 0) { + process.exit(1); +} + +if (count === 0 && typeof phantom === 'object') { + process.exit(0); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/esprima.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/esprima.js new file mode 100644 index 00000000..2d7fc11c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/esprima.js @@ -0,0 +1,5321 @@ +/* + Copyright (C) 2013 Ariya Hidayat + Copyright (C) 2013 Thaddee Tyl + Copyright (C) 2013 Mathias Bynens + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Mathias Bynens + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Kris Kowal + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function (root, factory) { + 'use strict'; + + // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, + // Rhino, and plain browser loading. + + /* istanbul ignore next */ + if (typeof define === 'function' && define.amd) { + define(['exports'], factory); + } else if (typeof exports !== 'undefined') { + factory(exports); + } else { + factory((root.esprima = {})); + } +}(this, function (exports) { + 'use strict'; + + var Token, + TokenName, + FnExprTokens, + Syntax, + PlaceHolders, + Messages, + Regex, + source, + strict, + sourceType, + index, + lineNumber, + lineStart, + hasLineTerminator, + lastIndex, + lastLineNumber, + lastLineStart, + startIndex, + startLineNumber, + startLineStart, + scanning, + length, + lookahead, + state, + extra, + isBindingElement, + isAssignmentTarget, + firstCoverInitializedNameError; + + Token = { + BooleanLiteral: 1, + EOF: 2, + Identifier: 3, + Keyword: 4, + NullLiteral: 5, + NumericLiteral: 6, + Punctuator: 7, + StringLiteral: 8, + RegularExpression: 9, + Template: 10 + }; + + TokenName = {}; + TokenName[Token.BooleanLiteral] = 'Boolean'; + TokenName[Token.EOF] = ''; + TokenName[Token.Identifier] = 'Identifier'; + TokenName[Token.Keyword] = 'Keyword'; + TokenName[Token.NullLiteral] = 'Null'; + TokenName[Token.NumericLiteral] = 'Numeric'; + TokenName[Token.Punctuator] = 'Punctuator'; + TokenName[Token.StringLiteral] = 'String'; + TokenName[Token.RegularExpression] = 'RegularExpression'; + TokenName[Token.Template] = 'Template'; + + // A function following one of those tokens is an expression. + FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new', + 'return', 'case', 'delete', 'throw', 'void', + // assignment operators + '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=', + '&=', '|=', '^=', ',', + // binary/unary operators + '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&', + '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=', + '<=', '<', '>', '!=', '!==']; + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement' + }; + + PlaceHolders = { + ArrowParameterPlaceHolder: 'ArrowParameterPlaceHolder' + }; + + // Error messages should be identical to V8. + Messages = { + UnexpectedToken: 'Unexpected token %0', + UnexpectedNumber: 'Unexpected number', + UnexpectedString: 'Unexpected string', + UnexpectedIdentifier: 'Unexpected identifier', + UnexpectedReserved: 'Unexpected reserved word', + UnexpectedTemplate: 'Unexpected quasi %0', + UnexpectedEOS: 'Unexpected end of input', + NewlineAfterThrow: 'Illegal newline after throw', + InvalidRegExp: 'Invalid regular expression', + UnterminatedRegExp: 'Invalid regular expression: missing /', + InvalidLHSInAssignment: 'Invalid left-hand side in assignment', + InvalidLHSInForIn: 'Invalid left-hand side in for-in', + MultipleDefaultsInSwitch: 'More than one default clause in switch statement', + NoCatchOrFinally: 'Missing catch or finally after try', + UnknownLabel: 'Undefined label \'%0\'', + Redeclaration: '%0 \'%1\' has already been declared', + IllegalContinue: 'Illegal continue statement', + IllegalBreak: 'Illegal break statement', + IllegalReturn: 'Illegal return statement', + StrictModeWith: 'Strict mode code may not include a with statement', + StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', + StrictVarName: 'Variable name may not be eval or arguments in strict mode', + StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', + StrictParamDupe: 'Strict mode function may not have duplicate parameter names', + StrictFunctionName: 'Function name may not be eval or arguments in strict mode', + StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', + StrictDelete: 'Delete of an unqualified identifier in strict mode.', + StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', + StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', + StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', + StrictReservedWord: 'Use of future reserved word in strict mode', + TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', + ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', + DefaultRestParameter: 'Unexpected token =', + ObjectPatternAsRestParameter: 'Unexpected token {', + DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', + ConstructorSpecialMethod: 'Class constructor may not be an accessor', + DuplicateConstructor: 'A class may only have one constructor', + StaticPrototype: 'Classes may not have static property named prototype', + MissingFromClause: 'Unexpected token', + NoAsAfterImportNamespace: 'Unexpected token', + InvalidModuleSpecifier: 'Unexpected token', + IllegalImportDeclaration: 'Unexpected token', + IllegalExportDeclaration: 'Unexpected token' + }; + + // See also tools/generate-unicode-regex.py. + Regex = { + NonAsciiIdentifierStart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]'), + NonAsciiIdentifierPart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]') + }; + + // Ensure the condition is true, otherwise throw an error. + // This is only to have a better contract semantic, i.e. another safety net + // to catch a logic error. The condition shall be fulfilled in normal case. + // Do NOT use this to enforce a certain condition on any user input. + + function assert(condition, message) { + /* istanbul ignore if */ + if (!condition) { + throw new Error('ASSERT: ' + message); + } + } + + function isDecimalDigit(ch) { + return (ch >= 0x30 && ch <= 0x39); // 0..9 + } + + function isHexDigit(ch) { + return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; + } + + function isOctalDigit(ch) { + return '01234567'.indexOf(ch) >= 0; + } + + function octalToDecimal(ch) { + // \0 is not octal escape sequence + var octal = (ch !== '0'), code = '01234567'.indexOf(ch); + + if (index < length && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + '01234567'.indexOf(source[index++]); + + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + isOctalDigit(source[index])) { + code = code * 8 + '01234567'.indexOf(source[index++]); + } + } + + return { + code: code, + octal: octal + }; + } + + // 7.2 White Space + + function isWhiteSpace(ch) { + return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || + (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); + } + + // 7.3 Line Terminators + + function isLineTerminator(ch) { + return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); + } + + // 7.6 Identifier Names and Identifiers + + function isIdentifierStart(ch) { + return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) + (ch >= 0x41 && ch <= 0x5A) || // A..Z + (ch >= 0x61 && ch <= 0x7A) || // a..z + (ch === 0x5C) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))); + } + + function isIdentifierPart(ch) { + return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) + (ch >= 0x41 && ch <= 0x5A) || // A..Z + (ch >= 0x61 && ch <= 0x7A) || // a..z + (ch >= 0x30 && ch <= 0x39) || // 0..9 + (ch === 0x5C) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))); + } + + // 7.6.1.2 Future Reserved Words + + function isFutureReservedWord(id) { + switch (id) { + case 'enum': + case 'export': + case 'import': + case 'super': + return true; + default: + return false; + } + } + + // 11.6.2.2 Future Reserved Words + + function isStrictModeReservedWord(id) { + switch (id) { + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'yield': + case 'let': + return true; + default: + return false; + } + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + // 7.6.1.1 Keywords + + function isKeyword(id) { + + // 'const' is specialized as Keyword in V8. + // 'yield' and 'let' are for compatibility with SpiderMonkey and ES.next. + // Some others are from future reserved words. + + switch (id.length) { + case 2: + return (id === 'if') || (id === 'in') || (id === 'do'); + case 3: + return (id === 'var') || (id === 'for') || (id === 'new') || + (id === 'try') || (id === 'let'); + case 4: + return (id === 'this') || (id === 'else') || (id === 'case') || + (id === 'void') || (id === 'with') || (id === 'enum'); + case 5: + return (id === 'while') || (id === 'break') || (id === 'catch') || + (id === 'throw') || (id === 'const') || (id === 'yield') || + (id === 'class') || (id === 'super'); + case 6: + return (id === 'return') || (id === 'typeof') || (id === 'delete') || + (id === 'switch') || (id === 'export') || (id === 'import'); + case 7: + return (id === 'default') || (id === 'finally') || (id === 'extends'); + case 8: + return (id === 'function') || (id === 'continue') || (id === 'debugger'); + case 10: + return (id === 'instanceof'); + default: + return false; + } + } + + // 7.4 Comments + + function addComment(type, value, start, end, loc) { + var comment; + + assert(typeof start === 'number', 'Comment must have valid position'); + + state.lastCommentStart = start; + + comment = { + type: type, + value: value + }; + if (extra.range) { + comment.range = [start, end]; + } + if (extra.loc) { + comment.loc = loc; + } + extra.comments.push(comment); + if (extra.attachComment) { + extra.leadingComments.push(comment); + extra.trailingComments.push(comment); + } + } + + function skipSingleLineComment(offset) { + var start, loc, ch, comment; + + start = index - offset; + loc = { + start: { + line: lineNumber, + column: index - lineStart - offset + } + }; + + while (index < length) { + ch = source.charCodeAt(index); + ++index; + if (isLineTerminator(ch)) { + hasLineTerminator = true; + if (extra.comments) { + comment = source.slice(start + offset, index - 1); + loc.end = { + line: lineNumber, + column: index - lineStart - 1 + }; + addComment('Line', comment, start, index - 1, loc); + } + if (ch === 13 && source.charCodeAt(index) === 10) { + ++index; + } + ++lineNumber; + lineStart = index; + return; + } + } + + if (extra.comments) { + comment = source.slice(start + offset, index); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + addComment('Line', comment, start, index, loc); + } + } + + function skipMultiLineComment() { + var start, loc, ch, comment; + + if (extra.comments) { + start = index - 2; + loc = { + start: { + line: lineNumber, + column: index - lineStart - 2 + } + }; + } + + while (index < length) { + ch = source.charCodeAt(index); + if (isLineTerminator(ch)) { + if (ch === 0x0D && source.charCodeAt(index + 1) === 0x0A) { + ++index; + } + hasLineTerminator = true; + ++lineNumber; + ++index; + lineStart = index; + } else if (ch === 0x2A) { + // Block comment ends with '*/'. + if (source.charCodeAt(index + 1) === 0x2F) { + ++index; + ++index; + if (extra.comments) { + comment = source.slice(start + 2, index - 2); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + addComment('Block', comment, start, index, loc); + } + return; + } + ++index; + } else { + ++index; + } + } + + // Ran off the end of the file - the whole thing is a comment + if (extra.comments) { + loc.end = { + line: lineNumber, + column: index - lineStart + }; + comment = source.slice(start + 2, index); + addComment('Block', comment, start, index, loc); + } + tolerateUnexpectedToken(); + } + + function skipComment() { + var ch, start; + hasLineTerminator = false; + + start = (index === 0); + while (index < length) { + ch = source.charCodeAt(index); + + if (isWhiteSpace(ch)) { + ++index; + } else if (isLineTerminator(ch)) { + hasLineTerminator = true; + ++index; + if (ch === 0x0D && source.charCodeAt(index) === 0x0A) { + ++index; + } + ++lineNumber; + lineStart = index; + start = true; + } else if (ch === 0x2F) { // U+002F is '/' + ch = source.charCodeAt(index + 1); + if (ch === 0x2F) { + ++index; + ++index; + skipSingleLineComment(2); + start = true; + } else if (ch === 0x2A) { // U+002A is '*' + ++index; + ++index; + skipMultiLineComment(); + } else { + break; + } + } else if (start && ch === 0x2D) { // U+002D is '-' + // U+003E is '>' + if ((source.charCodeAt(index + 1) === 0x2D) && (source.charCodeAt(index + 2) === 0x3E)) { + // '-->' is a single-line comment + index += 3; + skipSingleLineComment(3); + } else { + break; + } + } else if (ch === 0x3C) { // U+003C is '<' + if (source.slice(index + 1, index + 4) === '!--') { + ++index; // `<` + ++index; // `!` + ++index; // `-` + ++index; // `-` + skipSingleLineComment(4); + } else { + break; + } + } else { + break; + } + } + } + + function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && isHexDigit(source[index])) { + ch = source[index++]; + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } + + function scanUnicodeCodePointEscape() { + var ch, code, cu1, cu2; + + ch = source[index]; + code = 0; + + // At least, one hex digit is required. + if (ch === '}') { + throwUnexpectedToken(); + } + + while (index < length) { + ch = source[index++]; + if (!isHexDigit(ch)) { + break; + } + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } + + if (code > 0x10FFFF || ch !== '}') { + throwUnexpectedToken(); + } + + // UTF-16 Encoding + if (code <= 0xFFFF) { + return String.fromCharCode(code); + } + cu1 = ((code - 0x10000) >> 10) + 0xD800; + cu2 = ((code - 0x10000) & 1023) + 0xDC00; + return String.fromCharCode(cu1, cu2); + } + + function getEscapedIdentifier() { + var ch, id; + + ch = source.charCodeAt(index++); + id = String.fromCharCode(ch); + + // '\u' (U+005C, U+0075) denotes an escaped character. + if (ch === 0x5C) { + if (source.charCodeAt(index) !== 0x75) { + throwUnexpectedToken(); + } + ++index; + ch = scanHexEscape('u'); + if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { + throwUnexpectedToken(); + } + id = ch; + } + + while (index < length) { + ch = source.charCodeAt(index); + if (!isIdentifierPart(ch)) { + break; + } + ++index; + id += String.fromCharCode(ch); + + // '\u' (U+005C, U+0075) denotes an escaped character. + if (ch === 0x5C) { + id = id.substr(0, id.length - 1); + if (source.charCodeAt(index) !== 0x75) { + throwUnexpectedToken(); + } + ++index; + ch = scanHexEscape('u'); + if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { + throwUnexpectedToken(); + } + id += ch; + } + } + + return id; + } + + function getIdentifier() { + var start, ch; + + start = index++; + while (index < length) { + ch = source.charCodeAt(index); + if (ch === 0x5C) { + // Blackslash (U+005C) marks Unicode escape sequence. + index = start; + return getEscapedIdentifier(); + } + if (isIdentifierPart(ch)) { + ++index; + } else { + break; + } + } + + return source.slice(start, index); + } + + function scanIdentifier() { + var start, id, type; + + start = index; + + // Backslash (U+005C) starts an escaped character. + id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); + + // There is no keyword or literal with only one character. + // Thus, it must be an identifier. + if (id.length === 1) { + type = Token.Identifier; + } else if (isKeyword(id)) { + type = Token.Keyword; + } else if (id === 'null') { + type = Token.NullLiteral; + } else if (id === 'true' || id === 'false') { + type = Token.BooleanLiteral; + } else { + type = Token.Identifier; + } + + return { + type: type, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + + // 7.7 Punctuators + + function scanPunctuator() { + var token, str; + + token = { + type: Token.Punctuator, + value: '', + lineNumber: lineNumber, + lineStart: lineStart, + start: index, + end: index + }; + + // Check for most common single-character punctuators. + str = source[index]; + switch (str) { + + case '(': + if (extra.tokenize) { + extra.openParenToken = extra.tokens.length; + } + ++index; + break; + + case '{': + if (extra.tokenize) { + extra.openCurlyToken = extra.tokens.length; + } + state.curlyStack.push('{'); + ++index; + break; + + case '.': + ++index; + if (source[index] === '.' && source[index + 1] === '.') { + // Spread operator: ... + index += 2; + str = '...'; + } + break; + + case '}': + ++index; + state.curlyStack.pop(); + break; + case ')': + case ';': + case ',': + case '[': + case ']': + case ':': + case '?': + case '~': + ++index; + break; + + default: + // 4-character punctuator. + str = source.substr(index, 4); + if (str === '>>>=') { + index += 4; + } else { + + // 3-character punctuators. + str = str.substr(0, 3); + if (str === '===' || str === '!==' || str === '>>>' || + str === '<<=' || str === '>>=') { + index += 3; + } else { + + // 2-character punctuators. + str = str.substr(0, 2); + if (str === '&&' || str === '||' || str === '==' || str === '!=' || + str === '+=' || str === '-=' || str === '*=' || str === '/=' || + str === '++' || str === '--' || str === '<<' || str === '>>' || + str === '&=' || str === '|=' || str === '^=' || str === '%=' || + str === '<=' || str === '>=' || str === '=>') { + index += 2; + } else { + + // 1-character punctuators. + str = source[index]; + if ('<>=!+-*%&|^/'.indexOf(str) >= 0) { + ++index; + } + } + } + } + } + + if (index === token.start) { + throwUnexpectedToken(); + } + + token.end = index; + token.value = str; + return token; + } + + // 7.8.3 Numeric Literals + + function scanHexLiteral(start) { + var number = ''; + + while (index < length) { + if (!isHexDigit(source[index])) { + break; + } + number += source[index++]; + } + + if (number.length === 0) { + throwUnexpectedToken(); + } + + if (isIdentifierStart(source.charCodeAt(index))) { + throwUnexpectedToken(); + } + + return { + type: Token.NumericLiteral, + value: parseInt('0x' + number, 16), + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + function scanBinaryLiteral(start) { + var ch, number; + + number = ''; + + while (index < length) { + ch = source[index]; + if (ch !== '0' && ch !== '1') { + break; + } + number += source[index++]; + } + + if (number.length === 0) { + // only 0b or 0B + throwUnexpectedToken(); + } + + if (index < length) { + ch = source.charCodeAt(index); + /* istanbul ignore else */ + if (isIdentifierStart(ch) || isDecimalDigit(ch)) { + throwUnexpectedToken(); + } + } + + return { + type: Token.NumericLiteral, + value: parseInt(number, 2), + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + function scanOctalLiteral(prefix, start) { + var number, octal; + + if (isOctalDigit(prefix)) { + octal = true; + number = '0' + source[index++]; + } else { + octal = false; + ++index; + number = ''; + } + + while (index < length) { + if (!isOctalDigit(source[index])) { + break; + } + number += source[index++]; + } + + if (!octal && number.length === 0) { + // only 0o or 0O + throwUnexpectedToken(); + } + + if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { + throwUnexpectedToken(); + } + + return { + type: Token.NumericLiteral, + value: parseInt(number, 8), + octal: octal, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + function isImplicitOctalLiteral() { + var i, ch; + + // Implicit octal, unless there is a non-octal digit. + // (Annex B.1.1 on Numeric Literals) + for (i = index + 1; i < length; ++i) { + ch = source[i]; + if (ch === '8' || ch === '9') { + return false; + } + if (!isOctalDigit(ch)) { + return true; + } + } + + return true; + } + + function scanNumericLiteral() { + var number, start, ch; + + ch = source[index]; + assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), + 'Numeric literal must start with a decimal digit or a decimal point'); + + start = index; + number = ''; + if (ch !== '.') { + number = source[index++]; + ch = source[index]; + + // Hex number starts with '0x'. + // Octal number starts with '0'. + // Octal number in ES6 starts with '0o'. + // Binary number in ES6 starts with '0b'. + if (number === '0') { + if (ch === 'x' || ch === 'X') { + ++index; + return scanHexLiteral(start); + } + if (ch === 'b' || ch === 'B') { + ++index; + return scanBinaryLiteral(start); + } + if (ch === 'o' || ch === 'O') { + return scanOctalLiteral(ch, start); + } + + if (isOctalDigit(ch)) { + if (isImplicitOctalLiteral()) { + return scanOctalLiteral(ch, start); + } + } + } + + while (isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + ch = source[index]; + } + + if (ch === '.') { + number += source[index++]; + while (isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + ch = source[index]; + } + + if (ch === 'e' || ch === 'E') { + number += source[index++]; + + ch = source[index]; + if (ch === '+' || ch === '-') { + number += source[index++]; + } + if (isDecimalDigit(source.charCodeAt(index))) { + while (isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + } else { + throwUnexpectedToken(); + } + } + + if (isIdentifierStart(source.charCodeAt(index))) { + throwUnexpectedToken(); + } + + return { + type: Token.NumericLiteral, + value: parseFloat(number), + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + // 7.8.4 String Literals + + function scanStringLiteral() { + var str = '', quote, start, ch, unescaped, octToDec, octal = false; + + quote = source[index]; + assert((quote === '\'' || quote === '"'), + 'String literal must starts with a quote'); + + start = index; + ++index; + + while (index < length) { + ch = source[index++]; + + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = source[index++]; + if (!ch || !isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'u': + case 'x': + if (source[index] === '{') { + ++index; + str += scanUnicodeCodePointEscape(); + } else { + unescaped = scanHexEscape(ch); + if (!unescaped) { + throw throwUnexpectedToken(); + } + str += unescaped; + } + break; + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\x0B'; + break; + case '8': + case '9': + throw throwUnexpectedToken(); + + default: + if (isOctalDigit(ch)) { + octToDec = octalToDecimal(ch); + + octal = octToDec.octal || octal; + str += String.fromCharCode(octToDec.code); + } else { + str += ch; + } + break; + } + } else { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + lineStart = index; + } + } else if (isLineTerminator(ch.charCodeAt(0))) { + break; + } else { + str += ch; + } + } + + if (quote !== '') { + throwUnexpectedToken(); + } + + return { + type: Token.StringLiteral, + value: str, + octal: octal, + lineNumber: startLineNumber, + lineStart: startLineStart, + start: start, + end: index + }; + } + + function scanTemplate() { + var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped; + + terminated = false; + tail = false; + start = index; + head = (source[index] === '`'); + rawOffset = 2; + + ++index; + + while (index < length) { + ch = source[index++]; + if (ch === '`') { + rawOffset = 1; + tail = true; + terminated = true; + break; + } else if (ch === '$') { + if (source[index] === '{') { + state.curlyStack.push('${'); + ++index; + terminated = true; + break; + } + cooked += ch; + } else if (ch === '\\') { + ch = source[index++]; + if (!isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'n': + cooked += '\n'; + break; + case 'r': + cooked += '\r'; + break; + case 't': + cooked += '\t'; + break; + case 'u': + case 'x': + if (source[index] === '{') { + ++index; + cooked += scanUnicodeCodePointEscape(); + } else { + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + cooked += unescaped; + } else { + index = restore; + cooked += ch; + } + } + break; + case 'b': + cooked += '\b'; + break; + case 'f': + cooked += '\f'; + break; + case 'v': + cooked += '\v'; + break; + + default: + if (ch === '0') { + if (isDecimalDigit(source.charCodeAt(index))) { + // Illegal: \01 \02 and so on + throwError(Messages.TemplateOctalLiteral); + } + cooked += '\0'; + } else if (isOctalDigit(ch)) { + // Illegal: \1 \2 + throwError(Messages.TemplateOctalLiteral); + } else { + cooked += ch; + } + break; + } + } else { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + lineStart = index; + } + } else if (isLineTerminator(ch.charCodeAt(0))) { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + lineStart = index; + cooked += '\n'; + } else { + cooked += ch; + } + } + + if (!terminated) { + throwUnexpectedToken(); + } + + if (!head) { + state.curlyStack.pop(); + } + + return { + type: Token.Template, + value: { + cooked: cooked, + raw: source.slice(start + 1, index - rawOffset) + }, + head: head, + tail: tail, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + function testRegExp(pattern, flags) { + var tmp = pattern; + + if (flags.indexOf('u') >= 0) { + // Replace each astral symbol and every Unicode escape sequence + // that possibly represents an astral symbol or a paired surrogate + // with a single ASCII symbol to avoid throwing on regular + // expressions that are only valid in combination with the `/u` + // flag. + // Note: replacing with the ASCII symbol `x` might cause false + // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a + // perfectly valid pattern that is equivalent to `[a-b]`, but it + // would be replaced by `[x-b]` which throws an error. + tmp = tmp + .replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) { + if (parseInt($1, 16) <= 0x10FFFF) { + return 'x'; + } + throwUnexpectedToken(null, Messages.InvalidRegExp); + }) + .replace( + /\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + 'x' + ); + } + + // First, detect invalid regular expressions. + try { + RegExp(tmp); + } catch (e) { + throwUnexpectedToken(null, Messages.InvalidRegExp); + } + + // Return a regular expression object for this pattern-flag pair, or + // `null` in case the current environment doesn't support the flags it + // uses. + try { + return new RegExp(pattern, flags); + } catch (exception) { + return null; + } + } + + function scanRegExpBody() { + var ch, str, classMarker, terminated, body; + + ch = source[index]; + assert(ch === '/', 'Regular expression literal must start with a slash'); + str = source[index++]; + + classMarker = false; + terminated = false; + while (index < length) { + ch = source[index++]; + str += ch; + if (ch === '\\') { + ch = source[index++]; + // ECMA-262 7.8.5 + if (isLineTerminator(ch.charCodeAt(0))) { + throwUnexpectedToken(null, Messages.UnterminatedRegExp); + } + str += ch; + } else if (isLineTerminator(ch.charCodeAt(0))) { + throwUnexpectedToken(null, Messages.UnterminatedRegExp); + } else if (classMarker) { + if (ch === ']') { + classMarker = false; + } + } else { + if (ch === '/') { + terminated = true; + break; + } else if (ch === '[') { + classMarker = true; + } + } + } + + if (!terminated) { + throwUnexpectedToken(null, Messages.UnterminatedRegExp); + } + + // Exclude leading and trailing slash. + body = str.substr(1, str.length - 2); + return { + value: body, + literal: str + }; + } + + function scanRegExpFlags() { + var ch, str, flags, restore; + + str = ''; + flags = ''; + while (index < length) { + ch = source[index]; + if (!isIdentifierPart(ch.charCodeAt(0))) { + break; + } + + ++index; + if (ch === '\\' && index < length) { + ch = source[index]; + if (ch === 'u') { + ++index; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + flags += ch; + for (str += '\\u'; restore < index; ++restore) { + str += source[restore]; + } + } else { + index = restore; + flags += 'u'; + str += '\\u'; + } + tolerateUnexpectedToken(); + } else { + str += '\\'; + tolerateUnexpectedToken(); + } + } else { + flags += ch; + str += ch; + } + } + + return { + value: flags, + literal: str + }; + } + + function scanRegExp() { + scanning = true; + var start, body, flags, value; + + lookahead = null; + skipComment(); + start = index; + + body = scanRegExpBody(); + flags = scanRegExpFlags(); + value = testRegExp(body.value, flags.value); + scanning = false; + if (extra.tokenize) { + return { + type: Token.RegularExpression, + value: value, + regex: { + pattern: body.value, + flags: flags.value + }, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + return { + literal: body.literal + flags.literal, + value: value, + regex: { + pattern: body.value, + flags: flags.value + }, + start: start, + end: index + }; + } + + function collectRegex() { + var pos, loc, regex, token; + + skipComment(); + + pos = index; + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + regex = scanRegExp(); + + loc.end = { + line: lineNumber, + column: index - lineStart + }; + + /* istanbul ignore next */ + if (!extra.tokenize) { + // Pop the previous token, which is likely '/' or '/=' + if (extra.tokens.length > 0) { + token = extra.tokens[extra.tokens.length - 1]; + if (token.range[0] === pos && token.type === 'Punctuator') { + if (token.value === '/' || token.value === '/=') { + extra.tokens.pop(); + } + } + } + + extra.tokens.push({ + type: 'RegularExpression', + value: regex.literal, + regex: regex.regex, + range: [pos, index], + loc: loc + }); + } + + return regex; + } + + function isIdentifierName(token) { + return token.type === Token.Identifier || + token.type === Token.Keyword || + token.type === Token.BooleanLiteral || + token.type === Token.NullLiteral; + } + + function advanceSlash() { + var prevToken, + checkToken; + // Using the following algorithm: + // https://github.com/mozilla/sweet.js/wiki/design + prevToken = extra.tokens[extra.tokens.length - 1]; + if (!prevToken) { + // Nothing before that: it cannot be a division. + return collectRegex(); + } + if (prevToken.type === 'Punctuator') { + if (prevToken.value === ']') { + return scanPunctuator(); + } + if (prevToken.value === ')') { + checkToken = extra.tokens[extra.openParenToken - 1]; + if (checkToken && + checkToken.type === 'Keyword' && + (checkToken.value === 'if' || + checkToken.value === 'while' || + checkToken.value === 'for' || + checkToken.value === 'with')) { + return collectRegex(); + } + return scanPunctuator(); + } + if (prevToken.value === '}') { + // Dividing a function by anything makes little sense, + // but we have to check for that. + if (extra.tokens[extra.openCurlyToken - 3] && + extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') { + // Anonymous function. + checkToken = extra.tokens[extra.openCurlyToken - 4]; + if (!checkToken) { + return scanPunctuator(); + } + } else if (extra.tokens[extra.openCurlyToken - 4] && + extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') { + // Named function. + checkToken = extra.tokens[extra.openCurlyToken - 5]; + if (!checkToken) { + return collectRegex(); + } + } else { + return scanPunctuator(); + } + // checkToken determines whether the function is + // a declaration or an expression. + if (FnExprTokens.indexOf(checkToken.value) >= 0) { + // It is an expression. + return scanPunctuator(); + } + // It is a declaration. + return collectRegex(); + } + return collectRegex(); + } + if (prevToken.type === 'Keyword' && prevToken.value !== 'this') { + return collectRegex(); + } + return scanPunctuator(); + } + + function advance() { + var ch, token; + + if (index >= length) { + return { + type: Token.EOF, + lineNumber: lineNumber, + lineStart: lineStart, + start: index, + end: index + }; + } + + ch = source.charCodeAt(index); + + if (isIdentifierStart(ch)) { + token = scanIdentifier(); + if (strict && isStrictModeReservedWord(token.value)) { + token.type = Token.Keyword; + } + return token; + } + + // Very common: ( and ) and ; + if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { + return scanPunctuator(); + } + + // String literal starts with single quote (U+0027) or double quote (U+0022). + if (ch === 0x27 || ch === 0x22) { + return scanStringLiteral(); + } + + // Dot (.) U+002E can also start a floating-point number, hence the need + // to check the next character. + if (ch === 0x2E) { + if (isDecimalDigit(source.charCodeAt(index + 1))) { + return scanNumericLiteral(); + } + return scanPunctuator(); + } + + if (isDecimalDigit(ch)) { + return scanNumericLiteral(); + } + + // Slash (/) U+002F can also start a regex. + if (extra.tokenize && ch === 0x2F) { + return advanceSlash(); + } + + // Template literals start with ` (U+0060) for template head + // or } (U+007D) for template middle or template tail. + if (ch === 0x60 || (ch === 0x7D && state.curlyStack[state.curlyStack.length - 1] === '${')) { + return scanTemplate(); + } + + return scanPunctuator(); + } + + function collectToken() { + var loc, token, value, entry; + + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + token = advance(); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + + if (token.type !== Token.EOF) { + value = source.slice(token.start, token.end); + entry = { + type: TokenName[token.type], + value: value, + range: [token.start, token.end], + loc: loc + }; + if (token.regex) { + entry.regex = { + pattern: token.regex.pattern, + flags: token.regex.flags + }; + } + extra.tokens.push(entry); + } + + return token; + } + + function lex() { + var token; + scanning = true; + + lastIndex = index; + lastLineNumber = lineNumber; + lastLineStart = lineStart; + + skipComment(); + + token = lookahead; + + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + + lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance(); + scanning = false; + return token; + } + + function peek() { + scanning = true; + + skipComment(); + + lastIndex = index; + lastLineNumber = lineNumber; + lastLineStart = lineStart; + + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + + lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance(); + scanning = false; + } + + function Position() { + this.line = startLineNumber; + this.column = startIndex - startLineStart; + } + + function SourceLocation() { + this.start = new Position(); + this.end = null; + } + + function WrappingSourceLocation(startToken) { + this.start = { + line: startToken.lineNumber, + column: startToken.start - startToken.lineStart + }; + this.end = null; + } + + function Node() { + if (extra.range) { + this.range = [startIndex, 0]; + } + if (extra.loc) { + this.loc = new SourceLocation(); + } + } + + function WrappingNode(startToken) { + if (extra.range) { + this.range = [startToken.start, 0]; + } + if (extra.loc) { + this.loc = new WrappingSourceLocation(startToken); + } + } + + WrappingNode.prototype = Node.prototype = { + + processComment: function () { + var lastChild, + leadingComments, + trailingComments, + bottomRight = extra.bottomRightStack, + i, + comment, + last = bottomRight[bottomRight.length - 1]; + + if (this.type === Syntax.Program) { + if (this.body.length > 0) { + return; + } + } + + if (extra.trailingComments.length > 0) { + trailingComments = []; + for (i = extra.trailingComments.length - 1; i >= 0; --i) { + comment = extra.trailingComments[i]; + if (comment.range[0] >= this.range[1]) { + trailingComments.unshift(comment); + extra.trailingComments.splice(i, 1); + } + } + extra.trailingComments = []; + } else { + if (last && last.trailingComments && last.trailingComments[0].range[0] >= this.range[1]) { + trailingComments = last.trailingComments; + delete last.trailingComments; + } + } + + // Eating the stack. + if (last) { + while (last && last.range[0] >= this.range[0]) { + lastChild = last; + last = bottomRight.pop(); + } + } + + if (lastChild) { + if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= this.range[0]) { + this.leadingComments = lastChild.leadingComments; + lastChild.leadingComments = undefined; + } + } else if (extra.leadingComments.length > 0) { + leadingComments = []; + for (i = extra.leadingComments.length - 1; i >= 0; --i) { + comment = extra.leadingComments[i]; + if (comment.range[1] <= this.range[0]) { + leadingComments.unshift(comment); + extra.leadingComments.splice(i, 1); + } + } + } + + + if (leadingComments && leadingComments.length > 0) { + this.leadingComments = leadingComments; + } + if (trailingComments && trailingComments.length > 0) { + this.trailingComments = trailingComments; + } + + bottomRight.push(this); + }, + + finish: function () { + if (extra.range) { + this.range[1] = lastIndex; + } + if (extra.loc) { + this.loc.end = { + line: lastLineNumber, + column: lastIndex - lastLineStart + }; + if (extra.source) { + this.loc.source = extra.source; + } + } + + if (extra.attachComment) { + this.processComment(); + } + }, + + finishArrayExpression: function (elements) { + this.type = Syntax.ArrayExpression; + this.elements = elements; + this.finish(); + return this; + }, + + finishArrayPattern: function (elements) { + this.type = Syntax.ArrayPattern; + this.elements = elements; + this.finish(); + return this; + }, + + finishArrowFunctionExpression: function (params, defaults, body, expression) { + this.type = Syntax.ArrowFunctionExpression; + this.id = null; + this.params = params; + this.defaults = defaults; + this.body = body; + this.generator = false; + this.expression = expression; + this.finish(); + return this; + }, + + finishAssignmentExpression: function (operator, left, right) { + this.type = Syntax.AssignmentExpression; + this.operator = operator; + this.left = left; + this.right = right; + this.finish(); + return this; + }, + + finishAssignmentPattern: function (left, right) { + this.type = Syntax.AssignmentPattern; + this.left = left; + this.right = right; + this.finish(); + return this; + }, + + finishBinaryExpression: function (operator, left, right) { + this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression; + this.operator = operator; + this.left = left; + this.right = right; + this.finish(); + return this; + }, + + finishBlockStatement: function (body) { + this.type = Syntax.BlockStatement; + this.body = body; + this.finish(); + return this; + }, + + finishBreakStatement: function (label) { + this.type = Syntax.BreakStatement; + this.label = label; + this.finish(); + return this; + }, + + finishCallExpression: function (callee, args) { + this.type = Syntax.CallExpression; + this.callee = callee; + this.arguments = args; + this.finish(); + return this; + }, + + finishCatchClause: function (param, body) { + this.type = Syntax.CatchClause; + this.param = param; + this.body = body; + this.finish(); + return this; + }, + + finishClassBody: function (body) { + this.type = Syntax.ClassBody; + this.body = body; + this.finish(); + return this; + }, + + finishClassDeclaration: function (id, superClass, body) { + this.type = Syntax.ClassDeclaration; + this.id = id; + this.superClass = superClass; + this.body = body; + this.finish(); + return this; + }, + + finishClassExpression: function (id, superClass, body) { + this.type = Syntax.ClassExpression; + this.id = id; + this.superClass = superClass; + this.body = body; + this.finish(); + return this; + }, + + finishConditionalExpression: function (test, consequent, alternate) { + this.type = Syntax.ConditionalExpression; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + this.finish(); + return this; + }, + + finishContinueStatement: function (label) { + this.type = Syntax.ContinueStatement; + this.label = label; + this.finish(); + return this; + }, + + finishDebuggerStatement: function () { + this.type = Syntax.DebuggerStatement; + this.finish(); + return this; + }, + + finishDoWhileStatement: function (body, test) { + this.type = Syntax.DoWhileStatement; + this.body = body; + this.test = test; + this.finish(); + return this; + }, + + finishEmptyStatement: function () { + this.type = Syntax.EmptyStatement; + this.finish(); + return this; + }, + + finishExpressionStatement: function (expression) { + this.type = Syntax.ExpressionStatement; + this.expression = expression; + this.finish(); + return this; + }, + + finishForStatement: function (init, test, update, body) { + this.type = Syntax.ForStatement; + this.init = init; + this.test = test; + this.update = update; + this.body = body; + this.finish(); + return this; + }, + + finishForInStatement: function (left, right, body) { + this.type = Syntax.ForInStatement; + this.left = left; + this.right = right; + this.body = body; + this.each = false; + this.finish(); + return this; + }, + + finishFunctionDeclaration: function (id, params, defaults, body) { + this.type = Syntax.FunctionDeclaration; + this.id = id; + this.params = params; + this.defaults = defaults; + this.body = body; + this.generator = false; + this.expression = false; + this.finish(); + return this; + }, + + finishFunctionExpression: function (id, params, defaults, body) { + this.type = Syntax.FunctionExpression; + this.id = id; + this.params = params; + this.defaults = defaults; + this.body = body; + this.generator = false; + this.expression = false; + this.finish(); + return this; + }, + + finishIdentifier: function (name) { + this.type = Syntax.Identifier; + this.name = name; + this.finish(); + return this; + }, + + finishIfStatement: function (test, consequent, alternate) { + this.type = Syntax.IfStatement; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + this.finish(); + return this; + }, + + finishLabeledStatement: function (label, body) { + this.type = Syntax.LabeledStatement; + this.label = label; + this.body = body; + this.finish(); + return this; + }, + + finishLiteral: function (token) { + this.type = Syntax.Literal; + this.value = token.value; + this.raw = source.slice(token.start, token.end); + if (token.regex) { + this.regex = token.regex; + } + this.finish(); + return this; + }, + + finishMemberExpression: function (accessor, object, property) { + this.type = Syntax.MemberExpression; + this.computed = accessor === '['; + this.object = object; + this.property = property; + this.finish(); + return this; + }, + + finishNewExpression: function (callee, args) { + this.type = Syntax.NewExpression; + this.callee = callee; + this.arguments = args; + this.finish(); + return this; + }, + + finishObjectExpression: function (properties) { + this.type = Syntax.ObjectExpression; + this.properties = properties; + this.finish(); + return this; + }, + + finishObjectPattern: function (properties) { + this.type = Syntax.ObjectPattern; + this.properties = properties; + this.finish(); + return this; + }, + + finishPostfixExpression: function (operator, argument) { + this.type = Syntax.UpdateExpression; + this.operator = operator; + this.argument = argument; + this.prefix = false; + this.finish(); + return this; + }, + + finishProgram: function (body) { + this.type = Syntax.Program; + this.body = body; + if (sourceType === 'module') { + // very restrictive for now + this.sourceType = sourceType; + } + this.finish(); + return this; + }, + + finishProperty: function (kind, key, computed, value, method, shorthand) { + this.type = Syntax.Property; + this.key = key; + this.computed = computed; + this.value = value; + this.kind = kind; + this.method = method; + this.shorthand = shorthand; + this.finish(); + return this; + }, + + finishRestElement: function (argument) { + this.type = Syntax.RestElement; + this.argument = argument; + this.finish(); + return this; + }, + + finishReturnStatement: function (argument) { + this.type = Syntax.ReturnStatement; + this.argument = argument; + this.finish(); + return this; + }, + + finishSequenceExpression: function (expressions) { + this.type = Syntax.SequenceExpression; + this.expressions = expressions; + this.finish(); + return this; + }, + + finishSpreadElement: function (argument) { + this.type = Syntax.SpreadElement; + this.argument = argument; + this.finish(); + return this; + }, + + finishSwitchCase: function (test, consequent) { + this.type = Syntax.SwitchCase; + this.test = test; + this.consequent = consequent; + this.finish(); + return this; + }, + + finishSuper: function () { + this.type = Syntax.Super; + this.finish(); + return this; + }, + + finishSwitchStatement: function (discriminant, cases) { + this.type = Syntax.SwitchStatement; + this.discriminant = discriminant; + this.cases = cases; + this.finish(); + return this; + }, + + finishTaggedTemplateExpression: function (tag, quasi) { + this.type = Syntax.TaggedTemplateExpression; + this.tag = tag; + this.quasi = quasi; + this.finish(); + return this; + }, + + finishTemplateElement: function (value, tail) { + this.type = Syntax.TemplateElement; + this.value = value; + this.tail = tail; + this.finish(); + return this; + }, + + finishTemplateLiteral: function (quasis, expressions) { + this.type = Syntax.TemplateLiteral; + this.quasis = quasis; + this.expressions = expressions; + this.finish(); + return this; + }, + + finishThisExpression: function () { + this.type = Syntax.ThisExpression; + this.finish(); + return this; + }, + + finishThrowStatement: function (argument) { + this.type = Syntax.ThrowStatement; + this.argument = argument; + this.finish(); + return this; + }, + + finishTryStatement: function (block, handler, finalizer) { + this.type = Syntax.TryStatement; + this.block = block; + this.guardedHandlers = []; + this.handlers = handler ? [ handler ] : []; + this.handler = handler; + this.finalizer = finalizer; + this.finish(); + return this; + }, + + finishUnaryExpression: function (operator, argument) { + this.type = (operator === '++' || operator === '--') ? Syntax.UpdateExpression : Syntax.UnaryExpression; + this.operator = operator; + this.argument = argument; + this.prefix = true; + this.finish(); + return this; + }, + + finishVariableDeclaration: function (declarations) { + this.type = Syntax.VariableDeclaration; + this.declarations = declarations; + this.kind = 'var'; + this.finish(); + return this; + }, + + finishLexicalDeclaration: function (declarations, kind) { + this.type = Syntax.VariableDeclaration; + this.declarations = declarations; + this.kind = kind; + this.finish(); + return this; + }, + + finishVariableDeclarator: function (id, init) { + this.type = Syntax.VariableDeclarator; + this.id = id; + this.init = init; + this.finish(); + return this; + }, + + finishWhileStatement: function (test, body) { + this.type = Syntax.WhileStatement; + this.test = test; + this.body = body; + this.finish(); + return this; + }, + + finishWithStatement: function (object, body) { + this.type = Syntax.WithStatement; + this.object = object; + this.body = body; + this.finish(); + return this; + }, + + finishExportSpecifier: function (local, exported) { + this.type = Syntax.ExportSpecifier; + this.exported = exported || local; + this.local = local; + this.finish(); + return this; + }, + + finishImportDefaultSpecifier: function (local) { + this.type = Syntax.ImportDefaultSpecifier; + this.local = local; + this.finish(); + return this; + }, + + finishImportNamespaceSpecifier: function (local) { + this.type = Syntax.ImportNamespaceSpecifier; + this.local = local; + this.finish(); + return this; + }, + + finishExportNamedDeclaration: function (declaration, specifiers, src) { + this.type = Syntax.ExportNamedDeclaration; + this.declaration = declaration; + this.specifiers = specifiers; + this.source = src; + this.finish(); + return this; + }, + + finishExportDefaultDeclaration: function (declaration) { + this.type = Syntax.ExportDefaultDeclaration; + this.declaration = declaration; + this.finish(); + return this; + }, + + finishExportAllDeclaration: function (src) { + this.type = Syntax.ExportAllDeclaration; + this.source = src; + this.finish(); + return this; + }, + + finishImportSpecifier: function (local, imported) { + this.type = Syntax.ImportSpecifier; + this.local = local || imported; + this.imported = imported; + this.finish(); + return this; + }, + + finishImportDeclaration: function (specifiers, src) { + this.type = Syntax.ImportDeclaration; + this.specifiers = specifiers; + this.source = src; + this.finish(); + return this; + } + }; + + + function recordError(error) { + var e, existing; + + for (e = 0; e < extra.errors.length; e++) { + existing = extra.errors[e]; + // Prevent duplicated error. + /* istanbul ignore next */ + if (existing.index === error.index && existing.message === error.message) { + return; + } + } + + extra.errors.push(error); + } + + function createError(line, pos, description) { + var error = new Error('Line ' + line + ': ' + description); + error.index = pos; + error.lineNumber = line; + error.column = pos - (scanning ? lineStart : lastLineStart) + 1; + error.description = description; + return error; + } + + // Throw an exception + + function throwError(messageFormat) { + var args, msg; + + args = Array.prototype.slice.call(arguments, 1); + msg = messageFormat.replace(/%(\d)/g, + function (whole, idx) { + assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + } + ); + + throw createError(lastLineNumber, lastIndex, msg); + } + + function tolerateError(messageFormat) { + var args, msg, error; + + args = Array.prototype.slice.call(arguments, 1); + /* istanbul ignore next */ + msg = messageFormat.replace(/%(\d)/g, + function (whole, idx) { + assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + } + ); + + error = createError(lineNumber, lastIndex, msg); + if (extra.errors) { + recordError(error); + } else { + throw error; + } + } + + // Throw an exception because of the token. + + function unexpectedTokenError(token, message) { + var value, msg = message || Messages.UnexpectedToken; + + if (token) { + if (!message) { + msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS : + (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier : + (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber : + (token.type === Token.StringLiteral) ? Messages.UnexpectedString : + (token.type === Token.Template) ? Messages.UnexpectedTemplate : + Messages.UnexpectedToken; + + if (token.type === Token.Keyword) { + if (isFutureReservedWord(token.value)) { + msg = Messages.UnexpectedReserved; + } else if (strict && isStrictModeReservedWord(token.value)) { + msg = Messages.StrictReservedWord; + } + } + } + + value = (token.type === Token.Template) ? token.value.raw : token.value; + } else { + value = 'ILLEGAL'; + } + + msg = msg.replace('%0', value); + + return (token && typeof token.lineNumber === 'number') ? + createError(token.lineNumber, token.start, msg) : + createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg); + } + + function throwUnexpectedToken(token, message) { + throw unexpectedTokenError(token, message); + } + + function tolerateUnexpectedToken(token, message) { + var error = unexpectedTokenError(token, message); + if (extra.errors) { + recordError(error); + } else { + throw error; + } + } + + // Expect the next token to match the specified punctuator. + // If not, an exception will be thrown. + + function expect(value) { + var token = lex(); + if (token.type !== Token.Punctuator || token.value !== value) { + throwUnexpectedToken(token); + } + } + + /** + * @name expectCommaSeparator + * @description Quietly expect a comma when in tolerant mode, otherwise delegates + * to expect(value) + * @since 2.0 + */ + function expectCommaSeparator() { + var token; + + if (extra.errors) { + token = lookahead; + if (token.type === Token.Punctuator && token.value === ',') { + lex(); + } else if (token.type === Token.Punctuator && token.value === ';') { + lex(); + tolerateUnexpectedToken(token); + } else { + tolerateUnexpectedToken(token, Messages.UnexpectedToken); + } + } else { + expect(','); + } + } + + // Expect the next token to match the specified keyword. + // If not, an exception will be thrown. + + function expectKeyword(keyword) { + var token = lex(); + if (token.type !== Token.Keyword || token.value !== keyword) { + throwUnexpectedToken(token); + } + } + + // Return true if the next token matches the specified punctuator. + + function match(value) { + return lookahead.type === Token.Punctuator && lookahead.value === value; + } + + // Return true if the next token matches the specified keyword + + function matchKeyword(keyword) { + return lookahead.type === Token.Keyword && lookahead.value === keyword; + } + + // Return true if the next token matches the specified contextual keyword + // (where an identifier is sometimes a keyword depending on the context) + + function matchContextualKeyword(keyword) { + return lookahead.type === Token.Identifier && lookahead.value === keyword; + } + + // Return true if the next token is an assignment operator + + function matchAssign() { + var op; + + if (lookahead.type !== Token.Punctuator) { + return false; + } + op = lookahead.value; + return op === '=' || + op === '*=' || + op === '/=' || + op === '%=' || + op === '+=' || + op === '-=' || + op === '<<=' || + op === '>>=' || + op === '>>>=' || + op === '&=' || + op === '^=' || + op === '|='; + } + + function consumeSemicolon() { + // Catch the very common case first: immediately a semicolon (U+003B). + if (source.charCodeAt(startIndex) === 0x3B || match(';')) { + lex(); + return; + } + + if (hasLineTerminator) { + return; + } + + // FIXME(ikarienator): this is seemingly an issue in the previous location info convention. + lastIndex = startIndex; + lastLineNumber = startLineNumber; + lastLineStart = startLineStart; + + if (lookahead.type !== Token.EOF && !match('}')) { + throwUnexpectedToken(lookahead); + } + } + + // Cover grammar support. + // + // When an assignment expression position starts with an left parenthesis, the determination of the type + // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) + // or the first comma. This situation also defers the determination of all the expressions nested in the pair. + // + // There are three productions that can be parsed in a parentheses pair that needs to be determined + // after the outermost pair is closed. They are: + // + // 1. AssignmentExpression + // 2. BindingElements + // 3. AssignmentTargets + // + // In order to avoid exponential backtracking, we use two flags to denote if the production can be + // binding element or assignment target. + // + // The three productions have the relationship: + // + // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression + // + // with a single exception that CoverInitializedName when used directly in an Expression, generates + // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the + // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. + // + // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not + // effect the current flags. This means the production the parser parses is only used as an expression. Therefore + // the CoverInitializedName check is conducted. + // + // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates + // the flags outside of the parser. This means the production the parser parses is used as a part of a potential + // pattern. The CoverInitializedName check is deferred. + function isolateCoverGrammar(parser) { + var oldIsBindingElement = isBindingElement, + oldIsAssignmentTarget = isAssignmentTarget, + oldFirstCoverInitializedNameError = firstCoverInitializedNameError, + result; + isBindingElement = true; + isAssignmentTarget = true; + firstCoverInitializedNameError = null; + result = parser(); + if (firstCoverInitializedNameError !== null) { + throwUnexpectedToken(firstCoverInitializedNameError); + } + isBindingElement = oldIsBindingElement; + isAssignmentTarget = oldIsAssignmentTarget; + firstCoverInitializedNameError = oldFirstCoverInitializedNameError; + return result; + } + + function inheritCoverGrammar(parser) { + var oldIsBindingElement = isBindingElement, + oldIsAssignmentTarget = isAssignmentTarget, + oldFirstCoverInitializedNameError = firstCoverInitializedNameError, + result; + isBindingElement = true; + isAssignmentTarget = true; + firstCoverInitializedNameError = null; + result = parser(); + isBindingElement = isBindingElement && oldIsBindingElement; + isAssignmentTarget = isAssignmentTarget && oldIsAssignmentTarget; + firstCoverInitializedNameError = oldFirstCoverInitializedNameError || firstCoverInitializedNameError; + return result; + } + + function parseArrayPattern() { + var node = new Node(), elements = [], rest, restNode; + expect('['); + + while (!match(']')) { + if (match(',')) { + lex(); + elements.push(null); + } else { + if (match('...')) { + restNode = new Node(); + lex(); + rest = parseVariableIdentifier(); + elements.push(restNode.finishRestElement(rest)); + break; + } else { + elements.push(parsePatternWithDefault()); + } + if (!match(']')) { + expect(','); + } + } + + } + + expect(']'); + + return node.finishArrayPattern(elements); + } + + function parsePropertyPattern() { + var node = new Node(), key, computed = match('['), init; + if (lookahead.type === Token.Identifier) { + key = parseVariableIdentifier(); + if (match('=')) { + lex(); + init = parseAssignmentExpression(); + return node.finishProperty( + 'init', key, false, + new WrappingNode(key).finishAssignmentPattern(key, init), false, false); + } else if (!match(':')) { + return node.finishProperty('init', key, false, key, false, true); + } + } else { + key = parseObjectPropertyKey(); + } + expect(':'); + init = parsePatternWithDefault(); + return node.finishProperty('init', key, computed, init, false, false); + } + + function parseObjectPattern() { + var node = new Node(), properties = []; + + expect('{'); + + while (!match('}')) { + properties.push(parsePropertyPattern()); + if (!match('}')) { + expect(','); + } + } + + lex(); + + return node.finishObjectPattern(properties); + } + + function parsePattern() { + if (lookahead.type === Token.Identifier) { + return parseVariableIdentifier(); + } else if (match('[')) { + return parseArrayPattern(); + } else if (match('{')) { + return parseObjectPattern(); + } + throwUnexpectedToken(lookahead); + } + + function parsePatternWithDefault() { + var startToken = lookahead, pattern, right; + pattern = parsePattern(); + if (match('=')) { + lex(); + right = isolateCoverGrammar(parseAssignmentExpression); + pattern = new WrappingNode(startToken).finishAssignmentPattern(pattern, right); + } + return pattern; + } + + // 11.1.4 Array Initialiser + + function parseArrayInitialiser() { + var elements = [], node = new Node(), restSpread; + + expect('['); + + while (!match(']')) { + if (match(',')) { + lex(); + elements.push(null); + } else if (match('...')) { + restSpread = new Node(); + lex(); + restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression)); + + if (!match(']')) { + isAssignmentTarget = isBindingElement = false; + expect(','); + } + elements.push(restSpread); + } else { + elements.push(inheritCoverGrammar(parseAssignmentExpression)); + + if (!match(']')) { + expect(','); + } + } + } + + lex(); + + return node.finishArrayExpression(elements); + } + + // 11.1.5 Object Initialiser + + function parsePropertyFunction(node, paramInfo) { + var previousStrict, body; + + isAssignmentTarget = isBindingElement = false; + + previousStrict = strict; + body = isolateCoverGrammar(parseFunctionSourceElements); + + if (strict && paramInfo.firstRestricted) { + tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message); + } + if (strict && paramInfo.stricted) { + tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message); + } + + strict = previousStrict; + return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body); + } + + function parsePropertyMethodFunction() { + var params, method, node = new Node(); + + params = parseParams(); + method = parsePropertyFunction(node, params); + + return method; + } + + function parseObjectPropertyKey() { + var token, node = new Node(), expr; + + token = lex(); + + // Note: This function is called only from parseObjectProperty(), where + // EOF and Punctuator tokens are already filtered out. + + switch (token.type) { + case Token.StringLiteral: + case Token.NumericLiteral: + if (strict && token.octal) { + tolerateUnexpectedToken(token, Messages.StrictOctalLiteral); + } + return node.finishLiteral(token); + case Token.Identifier: + case Token.BooleanLiteral: + case Token.NullLiteral: + case Token.Keyword: + return node.finishIdentifier(token.value); + case Token.Punctuator: + if (token.value === '[') { + expr = isolateCoverGrammar(parseAssignmentExpression); + expect(']'); + return expr; + } + break; + } + throwUnexpectedToken(token); + } + + function lookaheadPropertyName() { + switch (lookahead.type) { + case Token.Identifier: + case Token.StringLiteral: + case Token.BooleanLiteral: + case Token.NullLiteral: + case Token.NumericLiteral: + case Token.Keyword: + return true; + case Token.Punctuator: + return lookahead.value === '['; + } + return false; + } + + // This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals, + // it might be called at a position where there is in fact a short hand identifier pattern or a data property. + // This can only be determined after we consumed up to the left parentheses. + // + // In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller + // is responsible to visit other options. + function tryParseMethodDefinition(token, key, computed, node) { + var value, options, methodNode; + + if (token.type === Token.Identifier) { + // check for `get` and `set`; + + if (token.value === 'get' && lookaheadPropertyName()) { + computed = match('['); + key = parseObjectPropertyKey(); + methodNode = new Node(); + expect('('); + expect(')'); + value = parsePropertyFunction(methodNode, { + params: [], + defaults: [], + stricted: null, + firstRestricted: null, + message: null + }); + return node.finishProperty('get', key, computed, value, false, false); + } else if (token.value === 'set' && lookaheadPropertyName()) { + computed = match('['); + key = parseObjectPropertyKey(); + methodNode = new Node(); + expect('('); + + options = { + params: [], + defaultCount: 0, + defaults: [], + firstRestricted: null, + paramSet: {} + }; + if (match(')')) { + tolerateUnexpectedToken(lookahead); + } else { + parseParam(options); + if (options.defaultCount === 0) { + options.defaults = []; + } + } + expect(')'); + + value = parsePropertyFunction(methodNode, options); + return node.finishProperty('set', key, computed, value, false, false); + } + } + + if (match('(')) { + value = parsePropertyMethodFunction(); + return node.finishProperty('init', key, computed, value, true, false); + } + + // Not a MethodDefinition. + return null; + } + + function checkProto(key, computed, hasProto) { + if (computed === false && (key.type === Syntax.Identifier && key.name === '__proto__' || + key.type === Syntax.Literal && key.value === '__proto__')) { + if (hasProto.value) { + tolerateError(Messages.DuplicateProtoProperty); + } else { + hasProto.value = true; + } + } + } + + function parseObjectProperty(hasProto) { + var token = lookahead, node = new Node(), computed, key, maybeMethod, value; + + computed = match('['); + key = parseObjectPropertyKey(); + maybeMethod = tryParseMethodDefinition(token, key, computed, node); + + if (maybeMethod) { + checkProto(maybeMethod.key, maybeMethod.computed, hasProto); + // finished + return maybeMethod; + } + + // init property or short hand property. + checkProto(key, computed, hasProto); + + if (match(':')) { + lex(); + value = inheritCoverGrammar(parseAssignmentExpression); + return node.finishProperty('init', key, computed, value, false, false); + } + + if (token.type === Token.Identifier) { + if (match('=')) { + firstCoverInitializedNameError = lookahead; + lex(); + value = isolateCoverGrammar(parseAssignmentExpression); + return node.finishProperty('init', key, computed, + new WrappingNode(token).finishAssignmentPattern(key, value), false, true); + } + return node.finishProperty('init', key, computed, key, false, true); + } + + throwUnexpectedToken(lookahead); + } + + function parseObjectInitialiser() { + var properties = [], hasProto = {value: false}, node = new Node(); + + expect('{'); + + while (!match('}')) { + properties.push(parseObjectProperty(hasProto)); + + if (!match('}')) { + expectCommaSeparator(); + } + } + + expect('}'); + + return node.finishObjectExpression(properties); + } + + function reinterpretExpressionAsPattern(expr) { + var i; + switch (expr.type) { + case Syntax.Identifier: + case Syntax.MemberExpression: + case Syntax.RestElement: + case Syntax.AssignmentPattern: + break; + case Syntax.SpreadElement: + expr.type = Syntax.RestElement; + reinterpretExpressionAsPattern(expr.argument); + break; + case Syntax.ArrayExpression: + expr.type = Syntax.ArrayPattern; + for (i = 0; i < expr.elements.length; i++) { + if (expr.elements[i] !== null) { + reinterpretExpressionAsPattern(expr.elements[i]); + } + } + break; + case Syntax.ObjectExpression: + expr.type = Syntax.ObjectPattern; + for (i = 0; i < expr.properties.length; i++) { + reinterpretExpressionAsPattern(expr.properties[i].value); + } + break; + case Syntax.AssignmentExpression: + expr.type = Syntax.AssignmentPattern; + reinterpretExpressionAsPattern(expr.left); + break; + default: + // Allow other node type for tolerant parsing. + break; + } + } + + function parseTemplateElement(option) { + var node, token; + + if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) { + throwUnexpectedToken(); + } + + node = new Node(); + token = lex(); + + return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail); + } + + function parseTemplateLiteral() { + var quasi, quasis, expressions, node = new Node(); + + quasi = parseTemplateElement({ head: true }); + quasis = [ quasi ]; + expressions = []; + + while (!quasi.tail) { + expressions.push(parseExpression()); + quasi = parseTemplateElement({ head: false }); + quasis.push(quasi); + } + + return node.finishTemplateLiteral(quasis, expressions); + } + + // 11.1.6 The Grouping Operator + + function parseGroupExpression() { + var expr, expressions, startToken, i; + + expect('('); + + if (match(')')) { + lex(); + if (!match('=>')) { + expect('=>'); + } + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: [] + }; + } + + startToken = lookahead; + if (match('...')) { + expr = parseRestElement(); + expect(')'); + if (!match('=>')) { + expect('=>'); + } + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: [expr] + }; + } + + isBindingElement = true; + expr = inheritCoverGrammar(parseAssignmentExpression); + + if (match(',')) { + isAssignmentTarget = false; + expressions = [expr]; + + while (startIndex < length) { + if (!match(',')) { + break; + } + lex(); + + if (match('...')) { + if (!isBindingElement) { + throwUnexpectedToken(lookahead); + } + expressions.push(parseRestElement()); + expect(')'); + if (!match('=>')) { + expect('=>'); + } + isBindingElement = false; + for (i = 0; i < expressions.length; i++) { + reinterpretExpressionAsPattern(expressions[i]); + } + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: expressions + }; + } + + expressions.push(inheritCoverGrammar(parseAssignmentExpression)); + } + + expr = new WrappingNode(startToken).finishSequenceExpression(expressions); + } + + + expect(')'); + + if (match('=>')) { + if (!isBindingElement) { + throwUnexpectedToken(lookahead); + } + + if (expr.type === Syntax.SequenceExpression) { + for (i = 0; i < expr.expressions.length; i++) { + reinterpretExpressionAsPattern(expr.expressions[i]); + } + } else { + reinterpretExpressionAsPattern(expr); + } + + expr = { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr] + }; + } + isBindingElement = false; + return expr; + } + + + // 11.1 Primary Expressions + + function parsePrimaryExpression() { + var type, token, expr, node; + + if (match('(')) { + isBindingElement = false; + return inheritCoverGrammar(parseGroupExpression); + } + + if (match('[')) { + return inheritCoverGrammar(parseArrayInitialiser); + } + + if (match('{')) { + return inheritCoverGrammar(parseObjectInitialiser); + } + + type = lookahead.type; + node = new Node(); + + if (type === Token.Identifier) { + expr = node.finishIdentifier(lex().value); + } else if (type === Token.StringLiteral || type === Token.NumericLiteral) { + isAssignmentTarget = isBindingElement = false; + if (strict && lookahead.octal) { + tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral); + } + expr = node.finishLiteral(lex()); + } else if (type === Token.Keyword) { + isAssignmentTarget = isBindingElement = false; + if (matchKeyword('function')) { + return parseFunctionExpression(); + } + if (matchKeyword('this')) { + lex(); + return node.finishThisExpression(); + } + if (matchKeyword('class')) { + return parseClassExpression(); + } + throwUnexpectedToken(lex()); + } else if (type === Token.BooleanLiteral) { + isAssignmentTarget = isBindingElement = false; + token = lex(); + token.value = (token.value === 'true'); + expr = node.finishLiteral(token); + } else if (type === Token.NullLiteral) { + isAssignmentTarget = isBindingElement = false; + token = lex(); + token.value = null; + expr = node.finishLiteral(token); + } else if (match('/') || match('/=')) { + isAssignmentTarget = isBindingElement = false; + index = startIndex; + + if (typeof extra.tokens !== 'undefined') { + token = collectRegex(); + } else { + token = scanRegExp(); + } + lex(); + expr = node.finishLiteral(token); + } else if (type === Token.Template) { + expr = parseTemplateLiteral(); + } else { + throwUnexpectedToken(lex()); + } + + return expr; + } + + // 11.2 Left-Hand-Side Expressions + + function parseArguments() { + var args = []; + + expect('('); + + if (!match(')')) { + while (startIndex < length) { + args.push(isolateCoverGrammar(parseAssignmentExpression)); + if (match(')')) { + break; + } + expectCommaSeparator(); + } + } + + expect(')'); + + return args; + } + + function parseNonComputedProperty() { + var token, node = new Node(); + + token = lex(); + + if (!isIdentifierName(token)) { + throwUnexpectedToken(token); + } + + return node.finishIdentifier(token.value); + } + + function parseNonComputedMember() { + expect('.'); + + return parseNonComputedProperty(); + } + + function parseComputedMember() { + var expr; + + expect('['); + + expr = isolateCoverGrammar(parseExpression); + + expect(']'); + + return expr; + } + + function parseNewExpression() { + var callee, args, node = new Node(); + + expectKeyword('new'); + callee = isolateCoverGrammar(parseLeftHandSideExpression); + args = match('(') ? parseArguments() : []; + + isAssignmentTarget = isBindingElement = false; + + return node.finishNewExpression(callee, args); + } + + function parseLeftHandSideExpressionAllowCall() { + var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn; + + startToken = lookahead; + state.allowIn = true; + + if (matchKeyword('super') && state.inFunctionBody) { + expr = new Node(); + lex(); + expr = expr.finishSuper(); + if (!match('(') && !match('.') && !match('[')) { + throwUnexpectedToken(lookahead); + } + } else { + expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression); + } + + for (;;) { + if (match('.')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseNonComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property); + } else if (match('(')) { + isBindingElement = false; + isAssignmentTarget = false; + args = parseArguments(); + expr = new WrappingNode(startToken).finishCallExpression(expr, args); + } else if (match('[')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property); + } else if (lookahead.type === Token.Template && lookahead.head) { + quasi = parseTemplateLiteral(); + expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi); + } else { + break; + } + } + state.allowIn = previousAllowIn; + + return expr; + } + + function parseLeftHandSideExpression() { + var quasi, expr, property, startToken; + assert(state.allowIn, 'callee of new expression always allow in keyword.'); + + startToken = lookahead; + + if (matchKeyword('super') && state.inFunctionBody) { + expr = new Node(); + lex(); + expr = expr.finishSuper(); + if (!match('[') && !match('.')) { + throwUnexpectedToken(lookahead); + } + } else { + expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression); + } + + for (;;) { + if (match('[')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property); + } else if (match('.')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseNonComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property); + } else if (lookahead.type === Token.Template && lookahead.head) { + quasi = parseTemplateLiteral(); + expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi); + } else { + break; + } + } + return expr; + } + + // 11.3 Postfix Expressions + + function parsePostfixExpression() { + var expr, token, startToken = lookahead; + + expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall); + + if (!hasLineTerminator && lookahead.type === Token.Punctuator) { + if (match('++') || match('--')) { + // 11.3.1, 11.3.2 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + tolerateError(Messages.StrictLHSPostfix); + } + + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInAssignment); + } + + isAssignmentTarget = isBindingElement = false; + + token = lex(); + expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr); + } + } + + return expr; + } + + // 11.4 Unary Operators + + function parseUnaryExpression() { + var token, expr, startToken; + + if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) { + expr = parsePostfixExpression(); + } else if (match('++') || match('--')) { + startToken = lookahead; + token = lex(); + expr = inheritCoverGrammar(parseUnaryExpression); + // 11.4.4, 11.4.5 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + tolerateError(Messages.StrictLHSPrefix); + } + + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInAssignment); + } + expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); + isAssignmentTarget = isBindingElement = false; + } else if (match('+') || match('-') || match('~') || match('!')) { + startToken = lookahead; + token = lex(); + expr = inheritCoverGrammar(parseUnaryExpression); + expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); + isAssignmentTarget = isBindingElement = false; + } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { + startToken = lookahead; + token = lex(); + expr = inheritCoverGrammar(parseUnaryExpression); + expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); + if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) { + tolerateError(Messages.StrictDelete); + } + isAssignmentTarget = isBindingElement = false; + } else { + expr = parsePostfixExpression(); + } + + return expr; + } + + function binaryPrecedence(token, allowIn) { + var prec = 0; + + if (token.type !== Token.Punctuator && token.type !== Token.Keyword) { + return 0; + } + + switch (token.value) { + case '||': + prec = 1; + break; + + case '&&': + prec = 2; + break; + + case '|': + prec = 3; + break; + + case '^': + prec = 4; + break; + + case '&': + prec = 5; + break; + + case '==': + case '!=': + case '===': + case '!==': + prec = 6; + break; + + case '<': + case '>': + case '<=': + case '>=': + case 'instanceof': + prec = 7; + break; + + case 'in': + prec = allowIn ? 7 : 0; + break; + + case '<<': + case '>>': + case '>>>': + prec = 8; + break; + + case '+': + case '-': + prec = 9; + break; + + case '*': + case '/': + case '%': + prec = 11; + break; + + default: + break; + } + + return prec; + } + + // 11.5 Multiplicative Operators + // 11.6 Additive Operators + // 11.7 Bitwise Shift Operators + // 11.8 Relational Operators + // 11.9 Equality Operators + // 11.10 Binary Bitwise Operators + // 11.11 Binary Logical Operators + + function parseBinaryExpression() { + var marker, markers, expr, token, prec, stack, right, operator, left, i; + + marker = lookahead; + left = inheritCoverGrammar(parseUnaryExpression); + + token = lookahead; + prec = binaryPrecedence(token, state.allowIn); + if (prec === 0) { + return left; + } + isAssignmentTarget = isBindingElement = false; + token.prec = prec; + lex(); + + markers = [marker, lookahead]; + right = isolateCoverGrammar(parseUnaryExpression); + + stack = [left, token, right]; + + while ((prec = binaryPrecedence(lookahead, state.allowIn)) > 0) { + + // Reduce: make a binary expression from the three topmost entries. + while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { + right = stack.pop(); + operator = stack.pop().value; + left = stack.pop(); + markers.pop(); + expr = new WrappingNode(markers[markers.length - 1]).finishBinaryExpression(operator, left, right); + stack.push(expr); + } + + // Shift. + token = lex(); + token.prec = prec; + stack.push(token); + markers.push(lookahead); + expr = isolateCoverGrammar(parseUnaryExpression); + stack.push(expr); + } + + // Final reduce to clean-up the stack. + i = stack.length - 1; + expr = stack[i]; + markers.pop(); + while (i > 1) { + expr = new WrappingNode(markers.pop()).finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); + i -= 2; + } + + return expr; + } + + + // 11.12 Conditional Operator + + function parseConditionalExpression() { + var expr, previousAllowIn, consequent, alternate, startToken; + + startToken = lookahead; + + expr = inheritCoverGrammar(parseBinaryExpression); + if (match('?')) { + lex(); + previousAllowIn = state.allowIn; + state.allowIn = true; + consequent = isolateCoverGrammar(parseAssignmentExpression); + state.allowIn = previousAllowIn; + expect(':'); + alternate = isolateCoverGrammar(parseAssignmentExpression); + + expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate); + isAssignmentTarget = isBindingElement = false; + } + + return expr; + } + + // [ES6] 14.2 Arrow Function + + function parseConciseBody() { + if (match('{')) { + return parseFunctionSourceElements(); + } + return isolateCoverGrammar(parseAssignmentExpression); + } + + function checkPatternParam(options, param) { + var i; + switch (param.type) { + case Syntax.Identifier: + validateParam(options, param, param.name); + break; + case Syntax.RestElement: + checkPatternParam(options, param.argument); + break; + case Syntax.AssignmentPattern: + checkPatternParam(options, param.left); + break; + case Syntax.ArrayPattern: + for (i = 0; i < param.elements.length; i++) { + if (param.elements[i] !== null) { + checkPatternParam(options, param.elements[i]); + } + } + break; + default: + assert(param.type === Syntax.ObjectPattern, 'Invalid type'); + for (i = 0; i < param.properties.length; i++) { + checkPatternParam(options, param.properties[i].value); + } + break; + } + } + function reinterpretAsCoverFormalsList(expr) { + var i, len, param, params, defaults, defaultCount, options, token; + + defaults = []; + defaultCount = 0; + params = [expr]; + + switch (expr.type) { + case Syntax.Identifier: + break; + case PlaceHolders.ArrowParameterPlaceHolder: + params = expr.params; + break; + default: + return null; + } + + options = { + paramSet: {} + }; + + for (i = 0, len = params.length; i < len; i += 1) { + param = params[i]; + switch (param.type) { + case Syntax.AssignmentPattern: + params[i] = param.left; + defaults.push(param.right); + ++defaultCount; + checkPatternParam(options, param.left); + break; + default: + checkPatternParam(options, param); + params[i] = param; + defaults.push(null); + break; + } + } + + if (options.message === Messages.StrictParamDupe) { + token = strict ? options.stricted : options.firstRestricted; + throwUnexpectedToken(token, options.message); + } + + if (defaultCount === 0) { + defaults = []; + } + + return { + params: params, + defaults: defaults, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + } + + function parseArrowFunctionExpression(options, node) { + var previousStrict, body; + + if (hasLineTerminator) { + tolerateUnexpectedToken(lookahead); + } + expect('=>'); + previousStrict = strict; + + body = parseConciseBody(); + + if (strict && options.firstRestricted) { + throwUnexpectedToken(options.firstRestricted, options.message); + } + if (strict && options.stricted) { + tolerateUnexpectedToken(options.stricted, options.message); + } + + strict = previousStrict; + + return node.finishArrowFunctionExpression(options.params, options.defaults, body, body.type !== Syntax.BlockStatement); + } + + // 11.13 Assignment Operators + + function parseAssignmentExpression() { + var token, expr, right, list, startToken; + + startToken = lookahead; + token = lookahead; + + expr = parseConditionalExpression(); + + if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) { + isAssignmentTarget = isBindingElement = false; + list = reinterpretAsCoverFormalsList(expr); + + if (list) { + firstCoverInitializedNameError = null; + return parseArrowFunctionExpression(list, new WrappingNode(startToken)); + } + + return expr; + } + + if (matchAssign()) { + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInAssignment); + } + + // 11.13.1 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + tolerateUnexpectedToken(token, Messages.StrictLHSAssignment); + } + + if (!match('=')) { + isAssignmentTarget = isBindingElement = false; + } else { + reinterpretExpressionAsPattern(expr); + } + + token = lex(); + right = isolateCoverGrammar(parseAssignmentExpression); + expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right); + firstCoverInitializedNameError = null; + } + + return expr; + } + + // 11.14 Comma Operator + + function parseExpression() { + var expr, startToken = lookahead, expressions; + + expr = isolateCoverGrammar(parseAssignmentExpression); + + if (match(',')) { + expressions = [expr]; + + while (startIndex < length) { + if (!match(',')) { + break; + } + lex(); + expressions.push(isolateCoverGrammar(parseAssignmentExpression)); + } + + expr = new WrappingNode(startToken).finishSequenceExpression(expressions); + } + + return expr; + } + + // 12.1 Block + + function parseStatementListItem() { + if (lookahead.type === Token.Keyword) { + switch (lookahead.value) { + case 'export': + if (sourceType !== 'module') { + tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration); + } + return parseExportDeclaration(); + case 'import': + if (sourceType !== 'module') { + tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration); + } + return parseImportDeclaration(); + case 'const': + case 'let': + return parseLexicalDeclaration({inFor: false}); + case 'function': + return parseFunctionDeclaration(new Node()); + case 'class': + return parseClassDeclaration(); + } + } + + return parseStatement(); + } + + function parseStatementList() { + var list = []; + while (startIndex < length) { + if (match('}')) { + break; + } + list.push(parseStatementListItem()); + } + + return list; + } + + function parseBlock() { + var block, node = new Node(); + + expect('{'); + + block = parseStatementList(); + + expect('}'); + + return node.finishBlockStatement(block); + } + + // 12.2 Variable Statement + + function parseVariableIdentifier() { + var token, node = new Node(); + + token = lex(); + + if (token.type !== Token.Identifier) { + if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) { + tolerateUnexpectedToken(token, Messages.StrictReservedWord); + } else { + throwUnexpectedToken(token); + } + } + + return node.finishIdentifier(token.value); + } + + function parseVariableDeclaration() { + var init = null, id, node = new Node(); + + id = parsePattern(); + + // 12.2.1 + if (strict && isRestrictedWord(id.name)) { + tolerateError(Messages.StrictVarName); + } + + if (match('=')) { + lex(); + init = isolateCoverGrammar(parseAssignmentExpression); + } else if (id.type !== Syntax.Identifier) { + expect('='); + } + + return node.finishVariableDeclarator(id, init); + } + + function parseVariableDeclarationList() { + var list = []; + + do { + list.push(parseVariableDeclaration()); + if (!match(',')) { + break; + } + lex(); + } while (startIndex < length); + + return list; + } + + function parseVariableStatement(node) { + var declarations; + + expectKeyword('var'); + + declarations = parseVariableDeclarationList(); + + consumeSemicolon(); + + return node.finishVariableDeclaration(declarations); + } + + function parseLexicalBinding(kind, options) { + var init = null, id, node = new Node(); + + id = parsePattern(); + + // 12.2.1 + if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) { + tolerateError(Messages.StrictVarName); + } + + if (kind === 'const') { + if (!matchKeyword('in')) { + expect('='); + init = isolateCoverGrammar(parseAssignmentExpression); + } + } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) { + expect('='); + init = isolateCoverGrammar(parseAssignmentExpression); + } + + return node.finishVariableDeclarator(id, init); + } + + function parseBindingList(kind, options) { + var list = []; + + do { + list.push(parseLexicalBinding(kind, options)); + if (!match(',')) { + break; + } + lex(); + } while (startIndex < length); + + return list; + } + + function parseLexicalDeclaration(options) { + var kind, declarations, node = new Node(); + + kind = lex().value; + assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); + + declarations = parseBindingList(kind, options); + + consumeSemicolon(); + + return node.finishLexicalDeclaration(declarations, kind); + } + + function parseRestElement() { + var param, node = new Node(); + + lex(); + + if (match('{')) { + throwError(Messages.ObjectPatternAsRestParameter); + } + + param = parseVariableIdentifier(); + + if (match('=')) { + throwError(Messages.DefaultRestParameter); + } + + if (!match(')')) { + throwError(Messages.ParameterAfterRestParameter); + } + + return node.finishRestElement(param); + } + + // 12.3 Empty Statement + + function parseEmptyStatement(node) { + expect(';'); + return node.finishEmptyStatement(); + } + + // 12.4 Expression Statement + + function parseExpressionStatement(node) { + var expr = parseExpression(); + consumeSemicolon(); + return node.finishExpressionStatement(expr); + } + + // 12.5 If statement + + function parseIfStatement(node) { + var test, consequent, alternate; + + expectKeyword('if'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + consequent = parseStatement(); + + if (matchKeyword('else')) { + lex(); + alternate = parseStatement(); + } else { + alternate = null; + } + + return node.finishIfStatement(test, consequent, alternate); + } + + // 12.6 Iteration Statements + + function parseDoWhileStatement(node) { + var body, test, oldInIteration; + + expectKeyword('do'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + if (match(';')) { + lex(); + } + + return node.finishDoWhileStatement(body, test); + } + + function parseWhileStatement(node) { + var test, body, oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + return node.finishWhileStatement(test, body); + } + + function parseForStatement(node) { + var init, initSeq, initStartToken, test, update, left, right, kind, declarations, + body, oldInIteration, previousAllowIn = state.allowIn; + + init = test = update = null; + + expectKeyword('for'); + + expect('('); + + if (match(';')) { + lex(); + } else { + if (matchKeyword('var')) { + init = new Node(); + lex(); + + state.allowIn = false; + init = init.finishVariableDeclaration(parseVariableDeclarationList()); + state.allowIn = previousAllowIn; + + if (init.declarations.length === 1 && matchKeyword('in')) { + lex(); + left = init; + right = parseExpression(); + init = null; + } else { + expect(';'); + } + } else if (matchKeyword('const') || matchKeyword('let')) { + init = new Node(); + kind = lex().value; + + state.allowIn = false; + declarations = parseBindingList(kind, {inFor: true}); + state.allowIn = previousAllowIn; + + if (declarations.length === 1 && declarations[0].init === null && matchKeyword('in')) { + init = init.finishLexicalDeclaration(declarations, kind); + lex(); + left = init; + right = parseExpression(); + init = null; + } else { + consumeSemicolon(); + init = init.finishLexicalDeclaration(declarations, kind); + } + } else { + initStartToken = lookahead; + state.allowIn = false; + init = inheritCoverGrammar(parseAssignmentExpression); + state.allowIn = previousAllowIn; + + if (matchKeyword('in')) { + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInForIn); + } + + lex(); + reinterpretExpressionAsPattern(init); + left = init; + right = parseExpression(); + init = null; + } else { + if (match(',')) { + initSeq = [init]; + while (match(',')) { + lex(); + initSeq.push(isolateCoverGrammar(parseAssignmentExpression)); + } + init = new WrappingNode(initStartToken).finishSequenceExpression(initSeq); + } + expect(';'); + } + } + } + + if (typeof left === 'undefined') { + + if (!match(';')) { + test = parseExpression(); + } + expect(';'); + + if (!match(')')) { + update = parseExpression(); + } + } + + expect(')'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = isolateCoverGrammar(parseStatement); + + state.inIteration = oldInIteration; + + return (typeof left === 'undefined') ? + node.finishForStatement(init, test, update, body) : + node.finishForInStatement(left, right, body); + } + + // 12.7 The continue statement + + function parseContinueStatement(node) { + var label = null, key; + + expectKeyword('continue'); + + // Optimize the most common form: 'continue;'. + if (source.charCodeAt(startIndex) === 0x3B) { + lex(); + + if (!state.inIteration) { + throwError(Messages.IllegalContinue); + } + + return node.finishContinueStatement(null); + } + + if (hasLineTerminator) { + if (!state.inIteration) { + throwError(Messages.IllegalContinue); + } + + return node.finishContinueStatement(null); + } + + if (lookahead.type === Token.Identifier) { + label = parseVariableIdentifier(); + + key = '$' + label.name; + if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { + throwError(Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !state.inIteration) { + throwError(Messages.IllegalContinue); + } + + return node.finishContinueStatement(label); + } + + // 12.8 The break statement + + function parseBreakStatement(node) { + var label = null, key; + + expectKeyword('break'); + + // Catch the very common case first: immediately a semicolon (U+003B). + if (source.charCodeAt(lastIndex) === 0x3B) { + lex(); + + if (!(state.inIteration || state.inSwitch)) { + throwError(Messages.IllegalBreak); + } + + return node.finishBreakStatement(null); + } + + if (hasLineTerminator) { + if (!(state.inIteration || state.inSwitch)) { + throwError(Messages.IllegalBreak); + } + + return node.finishBreakStatement(null); + } + + if (lookahead.type === Token.Identifier) { + label = parseVariableIdentifier(); + + key = '$' + label.name; + if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { + throwError(Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !(state.inIteration || state.inSwitch)) { + throwError(Messages.IllegalBreak); + } + + return node.finishBreakStatement(label); + } + + // 12.9 The return statement + + function parseReturnStatement(node) { + var argument = null; + + expectKeyword('return'); + + if (!state.inFunctionBody) { + tolerateError(Messages.IllegalReturn); + } + + // 'return' followed by a space and an identifier is very common. + if (source.charCodeAt(lastIndex) === 0x20) { + if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) { + argument = parseExpression(); + consumeSemicolon(); + return node.finishReturnStatement(argument); + } + } + + if (hasLineTerminator) { + // HACK + return node.finishReturnStatement(null); + } + + if (!match(';')) { + if (!match('}') && lookahead.type !== Token.EOF) { + argument = parseExpression(); + } + } + + consumeSemicolon(); + + return node.finishReturnStatement(argument); + } + + // 12.10 The with statement + + function parseWithStatement(node) { + var object, body; + + if (strict) { + tolerateError(Messages.StrictModeWith); + } + + expectKeyword('with'); + + expect('('); + + object = parseExpression(); + + expect(')'); + + body = parseStatement(); + + return node.finishWithStatement(object, body); + } + + // 12.10 The swith statement + + function parseSwitchCase() { + var test, consequent = [], statement, node = new Node(); + + if (matchKeyword('default')) { + lex(); + test = null; + } else { + expectKeyword('case'); + test = parseExpression(); + } + expect(':'); + + while (startIndex < length) { + if (match('}') || matchKeyword('default') || matchKeyword('case')) { + break; + } + statement = parseStatementListItem(); + consequent.push(statement); + } + + return node.finishSwitchCase(test, consequent); + } + + function parseSwitchStatement(node) { + var discriminant, cases, clause, oldInSwitch, defaultFound; + + expectKeyword('switch'); + + expect('('); + + discriminant = parseExpression(); + + expect(')'); + + expect('{'); + + cases = []; + + if (match('}')) { + lex(); + return node.finishSwitchStatement(discriminant, cases); + } + + oldInSwitch = state.inSwitch; + state.inSwitch = true; + defaultFound = false; + + while (startIndex < length) { + if (match('}')) { + break; + } + clause = parseSwitchCase(); + if (clause.test === null) { + if (defaultFound) { + throwError(Messages.MultipleDefaultsInSwitch); + } + defaultFound = true; + } + cases.push(clause); + } + + state.inSwitch = oldInSwitch; + + expect('}'); + + return node.finishSwitchStatement(discriminant, cases); + } + + // 12.13 The throw statement + + function parseThrowStatement(node) { + var argument; + + expectKeyword('throw'); + + if (hasLineTerminator) { + throwError(Messages.NewlineAfterThrow); + } + + argument = parseExpression(); + + consumeSemicolon(); + + return node.finishThrowStatement(argument); + } + + // 12.14 The try statement + + function parseCatchClause() { + var param, body, node = new Node(); + + expectKeyword('catch'); + + expect('('); + if (match(')')) { + throwUnexpectedToken(lookahead); + } + + param = parsePattern(); + + // 12.14.1 + if (strict && isRestrictedWord(param.name)) { + tolerateError(Messages.StrictCatchVariable); + } + + expect(')'); + body = parseBlock(); + return node.finishCatchClause(param, body); + } + + function parseTryStatement(node) { + var block, handler = null, finalizer = null; + + expectKeyword('try'); + + block = parseBlock(); + + if (matchKeyword('catch')) { + handler = parseCatchClause(); + } + + if (matchKeyword('finally')) { + lex(); + finalizer = parseBlock(); + } + + if (!handler && !finalizer) { + throwError(Messages.NoCatchOrFinally); + } + + return node.finishTryStatement(block, handler, finalizer); + } + + // 12.15 The debugger statement + + function parseDebuggerStatement(node) { + expectKeyword('debugger'); + + consumeSemicolon(); + + return node.finishDebuggerStatement(); + } + + // 12 Statements + + function parseStatement() { + var type = lookahead.type, + expr, + labeledBody, + key, + node; + + if (type === Token.EOF) { + throwUnexpectedToken(lookahead); + } + + if (type === Token.Punctuator && lookahead.value === '{') { + return parseBlock(); + } + isAssignmentTarget = isBindingElement = true; + node = new Node(); + + if (type === Token.Punctuator) { + switch (lookahead.value) { + case ';': + return parseEmptyStatement(node); + case '(': + return parseExpressionStatement(node); + default: + break; + } + } else if (type === Token.Keyword) { + switch (lookahead.value) { + case 'break': + return parseBreakStatement(node); + case 'continue': + return parseContinueStatement(node); + case 'debugger': + return parseDebuggerStatement(node); + case 'do': + return parseDoWhileStatement(node); + case 'for': + return parseForStatement(node); + case 'function': + return parseFunctionDeclaration(node); + case 'if': + return parseIfStatement(node); + case 'return': + return parseReturnStatement(node); + case 'switch': + return parseSwitchStatement(node); + case 'throw': + return parseThrowStatement(node); + case 'try': + return parseTryStatement(node); + case 'var': + return parseVariableStatement(node); + case 'while': + return parseWhileStatement(node); + case 'with': + return parseWithStatement(node); + default: + break; + } + } + + expr = parseExpression(); + + // 12.12 Labelled Statements + if ((expr.type === Syntax.Identifier) && match(':')) { + lex(); + + key = '$' + expr.name; + if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) { + throwError(Messages.Redeclaration, 'Label', expr.name); + } + + state.labelSet[key] = true; + labeledBody = parseStatement(); + delete state.labelSet[key]; + return node.finishLabeledStatement(expr, labeledBody); + } + + consumeSemicolon(); + + return node.finishExpressionStatement(expr); + } + + // 13 Function Definition + + function parseFunctionSourceElements() { + var statement, body = [], token, directive, firstRestricted, + oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount, + node = new Node(); + + expect('{'); + + while (startIndex < length) { + if (lookahead.type !== Token.StringLiteral) { + break; + } + token = lookahead; + + statement = parseStatementListItem(); + body.push(statement); + if (statement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = source.slice(token.start + 1, token.end - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + oldLabelSet = state.labelSet; + oldInIteration = state.inIteration; + oldInSwitch = state.inSwitch; + oldInFunctionBody = state.inFunctionBody; + oldParenthesisCount = state.parenthesizedCount; + + state.labelSet = {}; + state.inIteration = false; + state.inSwitch = false; + state.inFunctionBody = true; + state.parenthesizedCount = 0; + + while (startIndex < length) { + if (match('}')) { + break; + } + body.push(parseStatementListItem()); + } + + expect('}'); + + state.labelSet = oldLabelSet; + state.inIteration = oldInIteration; + state.inSwitch = oldInSwitch; + state.inFunctionBody = oldInFunctionBody; + state.parenthesizedCount = oldParenthesisCount; + + return node.finishBlockStatement(body); + } + + function validateParam(options, param, name) { + var key = '$' + name; + if (strict) { + if (isRestrictedWord(name)) { + options.stricted = param; + options.message = Messages.StrictParamName; + } + if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = Messages.StrictParamDupe; + } + } else if (!options.firstRestricted) { + if (isRestrictedWord(name)) { + options.firstRestricted = param; + options.message = Messages.StrictParamName; + } else if (isStrictModeReservedWord(name)) { + options.firstRestricted = param; + options.message = Messages.StrictReservedWord; + } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.firstRestricted = param; + options.message = Messages.StrictParamDupe; + } + } + options.paramSet[key] = true; + } + + function parseParam(options) { + var token, param, def; + + token = lookahead; + if (token.value === '...') { + param = parseRestElement(); + validateParam(options, param.argument, param.argument.name); + options.params.push(param); + options.defaults.push(null); + return false; + } + + param = parsePatternWithDefault(); + validateParam(options, token, token.value); + + if (param.type === Syntax.AssignmentPattern) { + def = param.right; + param = param.left; + ++options.defaultCount; + } + + options.params.push(param); + options.defaults.push(def); + + return !match(')'); + } + + function parseParams(firstRestricted) { + var options; + + options = { + params: [], + defaultCount: 0, + defaults: [], + firstRestricted: firstRestricted + }; + + expect('('); + + if (!match(')')) { + options.paramSet = {}; + while (startIndex < length) { + if (!parseParam(options)) { + break; + } + expect(','); + } + } + + expect(')'); + + if (options.defaultCount === 0) { + options.defaults = []; + } + + return { + params: options.params, + defaults: options.defaults, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + } + + function parseFunctionDeclaration(node, identifierIsOptional) { + var id = null, params = [], defaults = [], body, token, stricted, tmp, firstRestricted, message, previousStrict; + + expectKeyword('function'); + if (!identifierIsOptional || !match('(')) { + token = lookahead; + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + tolerateUnexpectedToken(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + + tmp = parseParams(firstRestricted); + params = tmp.params; + defaults = tmp.defaults; + stricted = tmp.stricted; + firstRestricted = tmp.firstRestricted; + if (tmp.message) { + message = tmp.message; + } + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwUnexpectedToken(firstRestricted, message); + } + if (strict && stricted) { + tolerateUnexpectedToken(stricted, message); + } + strict = previousStrict; + + return node.finishFunctionDeclaration(id, params, defaults, body); + } + + function parseFunctionExpression() { + var token, id = null, stricted, firstRestricted, message, tmp, + params = [], defaults = [], body, previousStrict, node = new Node(); + + expectKeyword('function'); + + if (!match('(')) { + token = lookahead; + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + tolerateUnexpectedToken(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + + tmp = parseParams(firstRestricted); + params = tmp.params; + defaults = tmp.defaults; + stricted = tmp.stricted; + firstRestricted = tmp.firstRestricted; + if (tmp.message) { + message = tmp.message; + } + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwUnexpectedToken(firstRestricted, message); + } + if (strict && stricted) { + tolerateUnexpectedToken(stricted, message); + } + strict = previousStrict; + + return node.finishFunctionExpression(id, params, defaults, body); + } + + + function parseClassBody() { + var classBody, token, isStatic, hasConstructor = false, body, method, computed, key; + + classBody = new Node(); + + expect('{'); + body = []; + while (!match('}')) { + if (match(';')) { + lex(); + } else { + method = new Node(); + token = lookahead; + isStatic = false; + computed = match('['); + key = parseObjectPropertyKey(); + if (key.name === 'static' && lookaheadPropertyName()) { + token = lookahead; + isStatic = true; + computed = match('['); + key = parseObjectPropertyKey(); + } + method = tryParseMethodDefinition(token, key, computed, method); + if (method) { + method['static'] = isStatic; + if (method.kind === 'init') { + method.kind = 'method'; + } + if (!isStatic) { + if (!method.computed && (method.key.name || method.key.value.toString()) === 'constructor') { + if (method.kind !== 'method' || !method.method || method.value.generator) { + throwUnexpectedToken(token, Messages.ConstructorSpecialMethod); + } + if (hasConstructor) { + throwUnexpectedToken(token, Messages.DuplicateConstructor); + } else { + hasConstructor = true; + } + method.kind = 'constructor'; + } + } else { + if (!method.computed && (method.key.name || method.key.value.toString()) === 'prototype') { + throwUnexpectedToken(token, Messages.StaticPrototype); + } + } + method.type = Syntax.MethodDefinition; + delete method.method; + delete method.shorthand; + body.push(method); + } else { + throwUnexpectedToken(lookahead); + } + } + } + lex(); + return classBody.finishClassBody(body); + } + + function parseClassDeclaration(identifierIsOptional) { + var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; + strict = true; + + expectKeyword('class'); + + if (!identifierIsOptional || lookahead.type === Token.Identifier) { + id = parseVariableIdentifier(); + } + + if (matchKeyword('extends')) { + lex(); + superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); + } + classBody = parseClassBody(); + strict = previousStrict; + + return classNode.finishClassDeclaration(id, superClass, classBody); + } + + function parseClassExpression() { + var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; + strict = true; + + expectKeyword('class'); + + if (lookahead.type === Token.Identifier) { + id = parseVariableIdentifier(); + } + + if (matchKeyword('extends')) { + lex(); + superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); + } + classBody = parseClassBody(); + strict = previousStrict; + + return classNode.finishClassExpression(id, superClass, classBody); + } + + // Modules grammar from: + // people.mozilla.org/~jorendorff/es6-draft.html + + function parseModuleSpecifier() { + var node = new Node(); + + if (lookahead.type !== Token.StringLiteral) { + throwError(Messages.InvalidModuleSpecifier); + } + return node.finishLiteral(lex()); + } + + function parseExportSpecifier() { + var exported, local, node = new Node(), def; + if (matchKeyword('default')) { + // export {default} from 'something'; + def = new Node(); + lex(); + local = def.finishIdentifier('default'); + } else { + local = parseVariableIdentifier(); + } + if (matchContextualKeyword('as')) { + lex(); + exported = parseNonComputedProperty(); + } + return node.finishExportSpecifier(local, exported); + } + + function parseExportNamedDeclaration(node) { + var declaration = null, + isExportFromIdentifier, + src = null, specifiers = []; + + // non-default export + if (lookahead.type === Token.Keyword) { + // covers: + // export var f = 1; + switch (lookahead.value) { + case 'let': + case 'const': + case 'var': + case 'class': + case 'function': + declaration = parseStatementListItem(); + return node.finishExportNamedDeclaration(declaration, specifiers, null); + } + } + + expect('{'); + if (!match('}')) { + do { + isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default'); + specifiers.push(parseExportSpecifier()); + } while (match(',') && lex()); + } + expect('}'); + + if (matchContextualKeyword('from')) { + // covering: + // export {default} from 'foo'; + // export {foo} from 'foo'; + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + } else if (isExportFromIdentifier) { + // covering: + // export {default}; // missing fromClause + throwError(lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } else { + // cover + // export {foo}; + consumeSemicolon(); + } + return node.finishExportNamedDeclaration(declaration, specifiers, src); + } + + function parseExportDefaultDeclaration(node) { + var declaration = null, + expression = null; + + // covers: + // export default ... + expectKeyword('default'); + + if (matchKeyword('function')) { + // covers: + // export default function foo () {} + // export default function () {} + declaration = parseFunctionDeclaration(new Node(), true); + return node.finishExportDefaultDeclaration(declaration); + } + if (matchKeyword('class')) { + declaration = parseClassDeclaration(true); + return node.finishExportDefaultDeclaration(declaration); + } + + if (matchContextualKeyword('from')) { + throwError(Messages.UnexpectedToken, lookahead.value); + } + + // covers: + // export default {}; + // export default []; + // export default (1 + 2); + if (match('{')) { + expression = parseObjectInitialiser(); + } else if (match('[')) { + expression = parseArrayInitialiser(); + } else { + expression = parseAssignmentExpression(); + } + consumeSemicolon(); + return node.finishExportDefaultDeclaration(expression); + } + + function parseExportAllDeclaration(node) { + var src; + + // covers: + // export * from 'foo'; + expect('*'); + if (!matchContextualKeyword('from')) { + throwError(lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + + return node.finishExportAllDeclaration(src); + } + + function parseExportDeclaration() { + var node = new Node(); + if (state.inFunctionBody) { + throwError(Messages.IllegalExportDeclaration); + } + + expectKeyword('export'); + + if (matchKeyword('default')) { + return parseExportDefaultDeclaration(node); + } + if (match('*')) { + return parseExportAllDeclaration(node); + } + return parseExportNamedDeclaration(node); + } + + function parseImportSpecifier() { + // import {} ...; + var local, imported, node = new Node(); + + imported = parseNonComputedProperty(); + if (matchContextualKeyword('as')) { + lex(); + local = parseVariableIdentifier(); + } + + return node.finishImportSpecifier(local, imported); + } + + function parseNamedImports() { + var specifiers = []; + // {foo, bar as bas} + expect('{'); + if (!match('}')) { + do { + specifiers.push(parseImportSpecifier()); + } while (match(',') && lex()); + } + expect('}'); + return specifiers; + } + + function parseImportDefaultSpecifier() { + // import ...; + var local, node = new Node(); + + local = parseNonComputedProperty(); + + return node.finishImportDefaultSpecifier(local); + } + + function parseImportNamespaceSpecifier() { + // import <* as foo> ...; + var local, node = new Node(); + + expect('*'); + if (!matchContextualKeyword('as')) { + throwError(Messages.NoAsAfterImportNamespace); + } + lex(); + local = parseNonComputedProperty(); + + return node.finishImportNamespaceSpecifier(local); + } + + function parseImportDeclaration() { + var specifiers, src, node = new Node(); + + if (state.inFunctionBody) { + throwError(Messages.IllegalImportDeclaration); + } + + expectKeyword('import'); + specifiers = []; + + if (lookahead.type === Token.StringLiteral) { + // covers: + // import 'foo'; + src = parseModuleSpecifier(); + consumeSemicolon(); + return node.finishImportDeclaration(specifiers, src); + } + + if (!matchKeyword('default') && isIdentifierName(lookahead)) { + // covers: + // import foo + // import foo, ... + specifiers.push(parseImportDefaultSpecifier()); + if (match(',')) { + lex(); + } + } + if (match('*')) { + // covers: + // import foo, * as foo + // import * as foo + specifiers.push(parseImportNamespaceSpecifier()); + } else if (match('{')) { + // covers: + // import foo, {bar} + // import {bar} + specifiers = specifiers.concat(parseNamedImports()); + } + + if (!matchContextualKeyword('from')) { + throwError(lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + + return node.finishImportDeclaration(specifiers, src); + } + + // 14 Program + + function parseScriptBody() { + var statement, body = [], token, directive, firstRestricted; + + while (startIndex < length) { + token = lookahead; + if (token.type !== Token.StringLiteral) { + break; + } + + statement = parseStatementListItem(); + body.push(statement); + if (statement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = source.slice(token.start + 1, token.end - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + while (startIndex < length) { + statement = parseStatementListItem(); + /* istanbul ignore if */ + if (typeof statement === 'undefined') { + break; + } + body.push(statement); + } + return body; + } + + function parseProgram() { + var body, node; + + peek(); + node = new Node(); + + body = parseScriptBody(); + return node.finishProgram(body); + } + + function filterTokenLocation() { + var i, entry, token, tokens = []; + + for (i = 0; i < extra.tokens.length; ++i) { + entry = extra.tokens[i]; + token = { + type: entry.type, + value: entry.value + }; + if (entry.regex) { + token.regex = { + pattern: entry.regex.pattern, + flags: entry.regex.flags + }; + } + if (extra.range) { + token.range = entry.range; + } + if (extra.loc) { + token.loc = entry.loc; + } + tokens.push(token); + } + + extra.tokens = tokens; + } + + function tokenize(code, options) { + var toString, + tokens; + + toString = String; + if (typeof code !== 'string' && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + length = source.length; + lookahead = null; + state = { + allowIn: true, + labelSet: {}, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + lastCommentStart: -1, + curlyStack: [] + }; + + extra = {}; + + // Options matching. + options = options || {}; + + // Of course we collect tokens here. + options.tokens = true; + extra.tokens = []; + extra.tokenize = true; + // The following two fields are necessary to compute the Regex tokens. + extra.openParenToken = -1; + extra.openCurlyToken = -1; + + extra.range = (typeof options.range === 'boolean') && options.range; + extra.loc = (typeof options.loc === 'boolean') && options.loc; + + if (typeof options.comment === 'boolean' && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === 'boolean' && options.tolerant) { + extra.errors = []; + } + + try { + peek(); + if (lookahead.type === Token.EOF) { + return extra.tokens; + } + + lex(); + while (lookahead.type !== Token.EOF) { + try { + lex(); + } catch (lexError) { + if (extra.errors) { + recordError(lexError); + // We have to break on the first error + // to avoid infinite loops. + break; + } else { + throw lexError; + } + } + } + + filterTokenLocation(); + tokens = extra.tokens; + if (typeof extra.comments !== 'undefined') { + tokens.comments = extra.comments; + } + if (typeof extra.errors !== 'undefined') { + tokens.errors = extra.errors; + } + } catch (e) { + throw e; + } finally { + extra = {}; + } + return tokens; + } + + function parse(code, options) { + var program, toString; + + toString = String; + if (typeof code !== 'string' && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + length = source.length; + lookahead = null; + state = { + allowIn: true, + labelSet: {}, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + lastCommentStart: -1, + curlyStack: [] + }; + sourceType = 'script'; + strict = false; + + extra = {}; + if (typeof options !== 'undefined') { + extra.range = (typeof options.range === 'boolean') && options.range; + extra.loc = (typeof options.loc === 'boolean') && options.loc; + extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment; + + if (extra.loc && options.source !== null && options.source !== undefined) { + extra.source = toString(options.source); + } + + if (typeof options.tokens === 'boolean' && options.tokens) { + extra.tokens = []; + } + if (typeof options.comment === 'boolean' && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === 'boolean' && options.tolerant) { + extra.errors = []; + } + if (extra.attachComment) { + extra.range = true; + extra.comments = []; + extra.bottomRightStack = []; + extra.trailingComments = []; + extra.leadingComments = []; + } + if (options.sourceType === 'module') { + // very restrictive condition for now + sourceType = options.sourceType; + strict = true; + } + } + + try { + program = parseProgram(); + if (typeof extra.comments !== 'undefined') { + program.comments = extra.comments; + } + if (typeof extra.tokens !== 'undefined') { + filterTokenLocation(); + program.tokens = extra.tokens; + } + if (typeof extra.errors !== 'undefined') { + program.errors = extra.errors; + } + } catch (e) { + throw e; + } finally { + extra = {}; + } + + return program; + } + + // Sync with *.json manifests. + exports.version = '2.2.0'; + + exports.tokenize = tokenize; + + exports.parse = parse; + + // Deep copy. + /* istanbul ignore next */ + exports.Syntax = (function () { + var name, types = {}; + + if (typeof Object.create === 'function') { + types = Object.create(null); + } + + for (name in Syntax) { + if (Syntax.hasOwnProperty(name)) { + types[name] = Syntax[name]; + } + } + + if (typeof Object.freeze === 'function') { + Object.freeze(types); + } + + return types; + }()); + +})); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/package.json b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/package.json new file mode 100644 index 00000000..91b79779 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/package.json @@ -0,0 +1,93 @@ +{ + "name": "esprima", + "description": "ECMAScript parsing infrastructure for multipurpose analysis", + "homepage": "http://esprima.org", + "main": "esprima.js", + "bin": { + "esparse": "./bin/esparse.js", + "esvalidate": "./bin/esvalidate.js" + }, + "version": "2.2.0", + "files": [ + "bin", + "test/run.js", + "test/runner.js", + "test/test.js", + "esprima.js" + ], + "engines": { + "node": ">=0.4.0" + }, + "author": { + "name": "Ariya Hidayat", + "email": "ariya.hidayat@gmail.com" + }, + "maintainers": [ + { + "name": "ariya", + "email": "ariya.hidayat@gmail.com" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/jquery/esprima.git" + }, + "bugs": { + "url": "http://issues.esprima.org" + }, + "licenses": [ + { + "type": "BSD", + "url": "https://github.com/jquery/esprima/raw/master/LICENSE.BSD" + } + ], + "devDependencies": { + "eslint": "~0.19.0", + "jscs": "~1.12.0", + "istanbul": "~0.3.7", + "escomplex-js": "1.2.0", + "complexity-report": "~1.4.0", + "regenerate": "~0.6.2", + "unicode-7.0.0": "~0.1.5", + "json-diff": "~0.3.1", + "optimist": "~0.6.0" + }, + "keywords": [ + "ast", + "ecmascript", + "javascript", + "parser", + "syntax" + ], + "scripts": { + "generate-regex": "node tools/generate-identifier-regex.js", + "test": "node test/run.js && npm run lint && npm run coverage", + "lint": "npm run check-version && npm run eslint && npm run jscs && npm run complexity", + "check-version": "node tools/check-version.js", + "jscs": "jscs esprima.js", + "eslint": "node node_modules/eslint/bin/eslint.js esprima.js", + "complexity": "node tools/list-complexity.js && cr -s -l -w --maxcyc 17 esprima.js", + "coverage": "npm run analyze-coverage && npm run check-coverage", + "analyze-coverage": "istanbul cover test/runner.js", + "check-coverage": "istanbul check-coverage --statement 100 --branch 100 --function 100", + "benchmark": "node test/benchmarks.js", + "benchmark-quick": "node test/benchmarks.js quick" + }, + "gitHead": "deef03ca006b03912d9f74b041f9239a9045181f", + "_id": "esprima@2.2.0", + "_shasum": "4292c1d68e4173d815fa2290dc7afc96d81fcd83", + "_from": "esprima@>=2.2.0 <2.3.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "ariya", + "email": "ariya.hidayat@gmail.com" + }, + "dist": { + "shasum": "4292c1d68e4173d815fa2290dc7afc96d81fcd83", + "tarball": "http://registry.npmjs.org/esprima/-/esprima-2.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/esprima/-/esprima-2.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/test/run.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/test/run.js new file mode 100644 index 00000000..a5b919bf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/test/run.js @@ -0,0 +1,66 @@ +/* + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint node:true */ + +(function () { + 'use strict'; + + var child = require('child_process'), + nodejs = '"' + process.execPath + '"', + ret = 0, + suites, + index; + + suites = [ + 'runner', + 'parselibs' + ]; + + function nextTest() { + var suite = suites[index]; + + if (index < suites.length) { + child.exec(nodejs + ' ./test/' + suite + '.js', function (err, stdout, stderr) { + if (stdout) { + process.stdout.write(suite + ': ' + stdout); + } + if (stderr) { + process.stderr.write(suite + ': ' + stderr); + } + if (err) { + ret = err.code; + } + index += 1; + nextTest(); + }); + } else { + process.exit(ret); + } + } + + index = 0; + nextTest(); +}()); diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/test/runner.js b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/test/runner.js new file mode 100644 index 00000000..7f4a1738 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/node_modules/esprima/test/runner.js @@ -0,0 +1,475 @@ +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + Copyright (C) 2011 Yusuke Suzuki + Copyright (C) 2011 Arpad Borsos + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint browser:true node:true */ +/*global esprima:true, testFixture:true */ + +var runTests; + +function NotMatchingError(expected, actual) { + 'use strict'; + Error.call(this, 'Expected '); + this.expected = expected; + this.actual = actual; +} +NotMatchingError.prototype = new Error(); + +function errorToObject(e) { + 'use strict'; + var msg = e.toString(); + + // Opera 9.64 produces an non-standard string in toString(). + if (msg.substr(0, 6) !== 'Error:') { + if (typeof e.message === 'string') { + msg = 'Error: ' + e.message; + } + } + + return { + index: e.index, + lineNumber: e.lineNumber, + column: e.column, + message: msg + }; +} + +function sortedObject(o) { + if (o === null) { + return o; + } + if (Array.isArray(o)) { + return o.map(sortedObject); + } + if (typeof o !== 'object') { + return o; + } + if (o instanceof RegExp) { + return o; + } + var keys = Object.keys(o); + var result = { + range: undefined, + loc: undefined + }; + keys.forEach(function (key) { + if (o.hasOwnProperty(key)){ + result[key] = sortedObject(o[key]); + } + }); + return result; +} + +function hasAttachedComment(syntax) { + var key; + for (key in syntax) { + if (key === 'leadingComments' || key === 'trailingComments') { + return true; + } + if (typeof syntax[key] === 'object' && syntax[key] !== null) { + if (hasAttachedComment(syntax[key])) { + return true; + } + } + } + return false; +} + +function testParse(esprima, code, syntax) { + 'use strict'; + var expected, tree, actual, options, StringObject, i, len; + + // alias, so that JSLint does not complain. + StringObject = String; + + options = { + comment: (typeof syntax.comments !== 'undefined'), + range: true, + loc: true, + tokens: (typeof syntax.tokens !== 'undefined'), + raw: true, + tolerant: (typeof syntax.errors !== 'undefined'), + source: null, + sourceType: syntax.sourceType + }; + + if (options.comment) { + options.attachComment = hasAttachedComment(syntax); + } + + if (typeof syntax.tokens !== 'undefined') { + if (syntax.tokens.length > 0) { + options.range = (typeof syntax.tokens[0].range !== 'undefined'); + options.loc = (typeof syntax.tokens[0].loc !== 'undefined'); + } + } + + if (typeof syntax.comments !== 'undefined') { + if (syntax.comments.length > 0) { + options.range = (typeof syntax.comments[0].range !== 'undefined'); + options.loc = (typeof syntax.comments[0].loc !== 'undefined'); + } + } + + if (options.loc) { + options.source = syntax.loc.source; + } + + syntax = sortedObject(syntax); + expected = JSON.stringify(syntax, null, 4); + try { + // Some variations of the options. + tree = esprima.parse(code, { tolerant: options.tolerant, sourceType: options.sourceType }); + tree = esprima.parse(code, { tolerant: options.tolerant, sourceType: options.sourceType, range: true }); + tree = esprima.parse(code, { tolerant: options.tolerant, sourceType: options.sourceType, loc: true }); + + tree = esprima.parse(code, options); + + if (options.tolerant) { + for (i = 0, len = tree.errors.length; i < len; i += 1) { + tree.errors[i] = errorToObject(tree.errors[i]); + } + } + tree = sortedObject(tree); + actual = JSON.stringify(tree, null, 4); + + // Only to ensure that there is no error when using string object. + esprima.parse(new StringObject(code), options); + + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } + + function filter(key, value) { + return (key === 'loc' || key === 'range') ? undefined : value; + } + + if (options.tolerant) { + return; + } + + + // Check again without any location info. + options.range = false; + options.loc = false; + syntax = sortedObject(syntax); + expected = JSON.stringify(syntax, filter, 4); + try { + tree = esprima.parse(code, options); + + if (options.tolerant) { + for (i = 0, len = tree.errors.length; i < len; i += 1) { + tree.errors[i] = errorToObject(tree.errors[i]); + } + } + tree = sortedObject(tree); + actual = JSON.stringify(tree, filter, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } +} + +function testTokenize(esprima, code, tokens) { + 'use strict'; + var options, expected, actual, tree; + + options = { + comment: true, + tolerant: true, + loc: true, + range: true + }; + + expected = JSON.stringify(tokens, null, 4); + + try { + tree = esprima.tokenize(code, options); + actual = JSON.stringify(tree, null, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } +} + + +function testModule(esprima, code, exception) { + 'use strict'; + var i, options, expected, actual, err, handleInvalidRegexFlag, tokenize; + + // Different parsing options should give the same error. + options = [ + { sourceType: 'module' }, + { sourceType: 'module', comment: true }, + { sourceType: 'module', raw: true }, + { sourceType: 'module', raw: true, comment: true } + ]; + + if (!exception.message) { + exception.message = 'Error: Line 1: ' + exception.description; + } + exception.description = exception.message.replace(/Error: Line [0-9]+: /, ''); + + expected = JSON.stringify(exception); + + for (i = 0; i < options.length; i += 1) { + + try { + esprima.parse(code, options[i]); + } catch (e) { + err = errorToObject(e); + err.description = e.description; + actual = JSON.stringify(err); + } + + if (expected !== actual) { + + // Compensate for old V8 which does not handle invalid flag. + if (exception.message.indexOf('Invalid regular expression') > 0) { + if (typeof actual === 'undefined' && !handleInvalidRegexFlag) { + return; + } + } + + throw new NotMatchingError(expected, actual); + } + + } +} + +function testError(esprima, code, exception) { + 'use strict'; + var i, options, expected, actual, err, handleInvalidRegexFlag, tokenize; + + // Different parsing options should give the same error. + options = [ + {}, + { comment: true }, + { raw: true }, + { raw: true, comment: true } + ]; + + // If handleInvalidRegexFlag is true, an invalid flag in a regular expression + // will throw an exception. In some old version of V8, this is not the case + // and hence handleInvalidRegexFlag is false. + handleInvalidRegexFlag = false; + try { + 'test'.match(new RegExp('[a-z]', 'x')); + } catch (e) { + handleInvalidRegexFlag = true; + } + + exception.description = exception.message.replace(/Error: Line [0-9]+: /, ''); + + if (exception.tokenize) { + tokenize = true; + exception.tokenize = undefined; + } + expected = JSON.stringify(exception); + + for (i = 0; i < options.length; i += 1) { + + try { + if (tokenize) { + esprima.tokenize(code, options[i]); + } else { + esprima.parse(code, options[i]); + } + } catch (e) { + err = errorToObject(e); + err.description = e.description; + actual = JSON.stringify(err); + } + + if (expected !== actual) { + + // Compensate for old V8 which does not handle invalid flag. + if (exception.message.indexOf('Invalid regular expression') > 0) { + if (typeof actual === 'undefined' && !handleInvalidRegexFlag) { + return; + } + } + + throw new NotMatchingError(expected, actual); + } + + } +} + +function testAPI(esprima, code, expected) { + var result; + // API test. + expected = JSON.stringify(expected, null, 4); + try { + result = eval(code); + result = JSON.stringify(result, null, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== result) { + throw new NotMatchingError(expected, result); + } +} + +function generateTestCase(esprima, testCase) { + var tree, fileName = testCase.key + ".tree.json"; + try { + tree = esprima.parse(testCase.case, {loc: true, range: true}); + tree = JSON.stringify(tree, null, 4); + } catch (e) { + if (typeof e.index === 'undefined') { + console.error("Failed to generate test result."); + throw e; + } + tree = errorToObject(e); + tree.description = e.description; + tree = JSON.stringify(tree); + fileName = testCase.key + ".failure.json"; + } + require('fs').writeFileSync(fileName, tree); + console.error("Done."); +} + +if (typeof window === 'undefined') { + (function () { + 'use strict'; + + var esprima = require('../esprima'), + vm = require('vm'), + fs = require('fs'), + diff = require('json-diff').diffString, + total = 0, + result, + failures = [], + cases = {}, + context = {source: '', result: null}, + tick = new Date(), + expected, + testCase, + header; + + function enumerateFixtures(root) { + var dirs = fs.readdirSync(root), key, kind, + kinds = ['case', 'source', 'module', 'run', 'tree', 'tokens', 'failure', 'result'], + suffices = ['js', 'js', 'json', 'js', 'json', 'json', 'json', 'json']; + + dirs.forEach(function (item) { + var i; + if (fs.statSync(root + '/' + item).isDirectory()) { + enumerateFixtures(root + '/' + item); + } else { + kind = 'case'; + key = item.slice(0, -3); + for (i = 1; i < kinds.length; i++) { + var suffix = '.' + kinds[i] + '.' + suffices[i]; + if (item.slice(-suffix.length) === suffix) { + key = item.slice(0, -suffix.length); + kind = kinds[i]; + } + } + key = root + '/' + key; + if (!cases[key]) { + total++; + cases[key] = { key: key }; + } + cases[key][kind] = fs.readFileSync(root + '/' + item, 'utf-8'); + } + }); + } + + enumerateFixtures(__dirname + '/fixtures'); + + for (var key in cases) { + if (cases.hasOwnProperty(key)) { + testCase = cases[key]; + + if (testCase.hasOwnProperty('source')) { + testCase.case = eval(testCase.source + ';source'); + } + + try { + if (testCase.hasOwnProperty('module')) { + testModule(esprima, testCase.case, JSON.parse(testCase.module)); + } else if (testCase.hasOwnProperty('tree')) { + testParse(esprima, testCase.case, JSON.parse(testCase.tree)); + } else if (testCase.hasOwnProperty('tokens')) { + testTokenize(esprima, testCase.case, JSON.parse(testCase.tokens)); + } else if (testCase.hasOwnProperty('failure')) { + testError(esprima, testCase.case, JSON.parse(testCase.failure)); + } else if (testCase.hasOwnProperty('result')) { + testAPI(esprima, testCase.run, JSON.parse(testCase.result)); + } else { + console.error('Incomplete test case:' + testCase.key + '. Generating test result...'); + generateTestCase(esprima, testCase); + } + } catch (e) { + if (!e.expected) { + throw e; + } + e.source = testCase.case || testCase.key; + failures.push(e); + } + } + } + + tick = (new Date()) - tick; + + header = total + ' tests. ' + failures.length + ' failures. ' + + tick + ' ms'; + if (failures.length) { + console.error(header); + failures.forEach(function (failure) { + try { + var expectedObject = JSON.parse(failure.expected); + var actualObject = JSON.parse(failure.actual); + + console.error(failure.source + ': Expected\n ' + + failure.expected.split('\n').join('\n ') + + '\nto match\n ' + failure.actual + '\nDiff:\n' + + diff(expectedObject, actualObject)); + } catch (ex) { + console.error(failure.source + ': Expected\n ' + + failure.expected.split('\n').join('\n ') + + '\nto match\n ' + failure.actual); + } + }); + } else { + console.log(header); + } + process.exit(failures.length === 0 ? 0 : 1); + + }()); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/js-yaml/package.json b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/package.json new file mode 100644 index 00000000..f52da7b7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/js-yaml/package.json @@ -0,0 +1,84 @@ +{ + "name": "js-yaml", + "version": "3.3.0", + "description": "YAML 1.2 parser and serializer", + "keywords": [ + "yaml", + "parser", + "serializer", + "pyyaml" + ], + "homepage": "https://github.com/nodeca/js-yaml", + "author": { + "name": "Dervus Grim", + "email": "dervus.grim@gmail.com" + }, + "contributors": [ + { + "name": "Aleksey V Zapparov", + "email": "ixti@member.fsf.org", + "url": "http://www.ixti.net/" + }, + { + "name": "Vitaly Puzrin", + "email": "vitaly@rcdesign.ru", + "url": "https://github.com/puzrin" + }, + { + "name": "Martin Grenfell", + "email": "martin.grenfell@gmail.com", + "url": "http://got-ravings.blogspot.com" + } + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/nodeca/js-yaml.git" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + }, + "dependencies": { + "argparse": "~1.0.2", + "esprima": "~2.2.0" + }, + "devDependencies": { + "ansi": "*", + "benchmark": "*", + "eslint": "0.18.0", + "eslint-plugin-nodeca": "^1.0.3", + "istanbul": "*", + "mocha": "*" + }, + "browser": { + "buffer": false + }, + "scripts": { + "test": "make test" + }, + "gitHead": "9cc570a50a767b08c3b0fcd0e61efec880aa7c11", + "bugs": { + "url": "https://github.com/nodeca/js-yaml/issues" + }, + "_id": "js-yaml@3.3.0", + "_shasum": "cb6422d39168dbde419fecb7fd06fbe27ad56210", + "_from": "js-yaml@>=3.2.5 <4.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "vitaly", + "email": "vitaly@rcdesign.ru" + }, + "maintainers": [ + { + "name": "vitaly", + "email": "vitaly@rcdesign.ru" + } + ], + "dist": { + "shasum": "cb6422d39168dbde419fecb7fd06fbe27ad56210", + "tarball": "http://registry.npmjs.org/js-yaml/-/js-yaml-3.3.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.3.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..05a40109 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +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/node_modules/standard/node_modules/eslint/node_modules/minimatch/README.md b/node_modules/standard/node_modules/eslint/node_modules/minimatch/README.md new file mode 100644 index 00000000..d458bc2e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/README.md @@ -0,0 +1,216 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instanting the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +## Functions + +The top-level exported function has a `cache` property, which is an LRU +cache set to store 100 items. So, calling these methods repeatedly +with the same pattern and options will use the same Minimatch object, +saving the cost of parsing it multiple times. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/browser.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/browser.js new file mode 100644 index 00000000..967b45c0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/browser.js @@ -0,0 +1,1113 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} + +},{"brace-expansion":2,"path":undefined}],2:[function(require,module,exports){ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + var expansions = expand(escapeBraces(str)); + return expansions.filter(identity).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0]).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + expansions.push([pre, N[j], post[k]].join('')) + } + } + + return expansions; +} + + +},{"balanced-match":3,"concat-map":4}],3:[function(require,module,exports){ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} + +},{}],4:[function(require,module,exports){ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (Array.isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +},{}]},{},[1]); diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/minimatch.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000..5e13d6d5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/minimatch.js @@ -0,0 +1,867 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/.npmignore new file mode 100644 index 00000000..249bc20e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/.npmignore @@ -0,0 +1,2 @@ +node_modules +*.sw* diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/.travis.yml new file mode 100644 index 00000000..6e5919de --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/README.md b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/README.md new file mode 100644 index 00000000..62bc7bae --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/README.md @@ -0,0 +1,121 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/example.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/example.js new file mode 100644 index 00000000..60ecfc74 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/example.js @@ -0,0 +1,8 @@ +var expand = require('./'); + +console.log(expand('http://any.org/archive{1996..1999}/vol{1..4}/part{a,b,c}.html')); +console.log(expand('http://www.numericals.com/file{1..100..10}.txt')); +console.log(expand('http://www.letters.com/file{a..z..2}.txt')); +console.log(expand('mkdir /usr/local/src/bash/{old,new,dist,bugs}')); +console.log(expand('chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}')); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/index.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/index.js new file mode 100644 index 00000000..a23104e9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/index.js @@ -0,0 +1,191 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore new file mode 100644 index 00000000..fd4f2b06 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile new file mode 100644 index 00000000..fa5da71a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile @@ -0,0 +1,6 @@ + +test: + @node_modules/.bin/tape test/*.js + +.PHONY: test + diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md new file mode 100644 index 00000000..2aff0ebf --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md @@ -0,0 +1,80 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js new file mode 100644 index 00000000..c02ad348 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js @@ -0,0 +1,5 @@ +var balanced = require('./'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js new file mode 100644 index 00000000..d165ae81 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -0,0 +1,38 @@ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json new file mode 100644 index 00000000..ede6efef --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -0,0 +1,73 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "0.2.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.1" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "ba40ed78e7114a4a67c51da768a100184dead39c", + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "_id": "balanced-match@0.2.0", + "_shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "_from": "balanced-match@>=0.2.0 <0.3.0", + "_npmVersion": "2.1.8", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "dist": { + "shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js new file mode 100644 index 00000000..36bfd399 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js @@ -0,0 +1,56 @@ +var test = require('tape'); +var balanced = require('..'); + +test('balanced', function(t) { + t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), { + start: 3, + end: 12, + pre: 'pre', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), { + start: 8, + end: 11, + pre: '{{{{{{{{', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body{in}post'), { + start: 8, + end: 11, + pre: 'pre{body', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), { + start: 4, + end: 13, + pre: 'pre}', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), { + start: 3, + end: 8, + pre: 'pre', + body: 'body', + post: 'between{body2}post' + }); + t.notOk(balanced('{', '}', 'nope'), 'should be notOk'); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 3, + end: 19, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 7, + end: 23, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml new file mode 100644 index 00000000..f1d0f13c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown new file mode 100644 index 00000000..408f70a1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js new file mode 100644 index 00000000..33656217 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js new file mode 100644 index 00000000..b29a7812 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json new file mode 100644 index 00000000..b5161380 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json @@ -0,0 +1,83 @@ +{ + "name": "concat-map", + "description": "concatenative mapdashery", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-concat-map.git" + }, + "main": "index.js", + "keywords": [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories": { + "example": "example", + "test": "test" + }, + "scripts": { + "test": "tape test/*.js" + }, + "devDependencies": { + "tape": "~2.4.0" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "bugs": { + "url": "https://github.com/substack/node-concat-map/issues" + }, + "homepage": "https://github.com/substack/node-concat-map", + "_id": "concat-map@0.0.1", + "dist": { + "shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "tarball": "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + }, + "_from": "concat-map@0.0.1", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js new file mode 100644 index 00000000..fdbd7022 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/package.json b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/package.json new file mode 100644 index 00000000..5f1866c8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -0,0 +1,75 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh" + }, + "dependencies": { + "balanced-match": "^0.2.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "tape": "^3.0.3" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "b5fa3b1c74e5e2dba2d0efa19b28335641bc1164", + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "_id": "brace-expansion@1.1.0", + "_shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "_from": "brace-expansion@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + } + ], + "dist": { + "shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js new file mode 100644 index 00000000..5fe2b8ad --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var expand = require('..'); +var fs = require('fs'); +var resfile = __dirname + '/bash-results.txt'; +var cases = fs.readFileSync(resfile, 'utf8').split('><><><><'); + +// throw away the EOF marker +cases.pop() + +test('matches bash expansions', function(t) { + cases.forEach(function(testcase) { + var set = testcase.split('\n'); + var pattern = set.shift(); + var actual = expand(pattern); + + // If it expands to the empty string, then it's actually + // just nothing, but Bash is a singly typed language, so + // "nothing" is the same as "". + if (set.length === 1 && set[0] === '') { + set = [] + } else { + // otherwise, strip off the [] that were added so that + // "" expansions would be preserved properly. + set = set.map(function (s) { + return s.replace(/^\[|\]$/g, '') + }) + } + + t.same(actual, set, pattern); + }); + t.end(); +}) diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt new file mode 100644 index 00000000..958148d2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt @@ -0,0 +1,1075 @@ +A{b,{d,e},{f,g}}Z +[AbZ] +[AdZ] +[AeZ] +[AfZ] +[AgZ]><><><><><><><\{a,b}{{a,b},a,b} +[{a,b}a] +[{a,b}b] +[{a,b}a] +[{a,b}b]><><><><{{a,b} +[{a] +[{b]><><><><{a,b}} +[a}] +[b}]><><><><{,} +><><><><><><><{,}b +[b] +[b]><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><{-01..5} +[-01] +[000] +[001] +[002] +[003] +[004] +[005]><><><><{-05..100..5} +[-05] +[000] +[005] +[010] +[015] +[020] +[025] +[030] +[035] +[040] +[045] +[050] +[055] +[060] +[065] +[070] +[075] +[080] +[085] +[090] +[095] +[100]><><><><{-05..100} +[-05] +[-04] +[-03] +[-02] +[-01] +[000] +[001] +[002] +[003] +[004] +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0..5..2} +[0] +[2] +[4]><><><><{0001..05..2} +[0001] +[0003] +[0005]><><><><{0001..-5..2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..-5..-2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..5..-2} +[0001] +[0003] +[0005]><><><><{01..5} +[01] +[02] +[03] +[04] +[05]><><><><{1..05} +[01] +[02] +[03] +[04] +[05]><><><><{1..05..3} +[01] +[04]><><><><{05..100} +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0a..0z} +[{0a..0z}]><><><><{a,b\}c,d} +[a] +[b}c] +[d]><><><><{a,b{c,d} +[{a,bc] +[{a,bd]><><><><{a,b}c,d} +[ac,d}] +[bc,d}]><><><><{a..F} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F]><><><><{A..f} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f]><><><><{a..Z} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z]><><><><{A..z} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{z..A} +[z] +[y] +[x] +[w] +[v] +[u] +[t] +[s] +[r] +[q] +[p] +[o] +[n] +[m] +[l] +[k] +[j] +[i] +[h] +[g] +[f] +[e] +[d] +[c] +[b] +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{Z..a} +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{a..F..2} +[a] +[_] +[]] +[[] +[Y] +[W] +[U] +[S] +[Q] +[O] +[M] +[K] +[I] +[G]><><><><{A..f..02} +[A] +[C] +[E] +[G] +[I] +[K] +[M] +[O] +[Q] +[S] +[U] +[W] +[Y] +[[] +[]] +[_] +[a] +[c] +[e]><><><><{a..Z..5} +[a] +[]><><><><><><><{A..z..10} +[A] +[K] +[U] +[_] +[i] +[s]><><><><{z..A..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b] +[`] +[^] +[] +[Z] +[X] +[V] +[T] +[R] +[P] +[N] +[L] +[J] +[H] +[F] +[D] +[B]><><><><{Z..a..20} +[Z]><><><><{a{,b} +[{a] +[{ab]><><><><{a},b} +[a}] +[b]><><><><{x,y{,}g} +[x] +[yg] +[yg]><><><><{x,y{}g} +[x] +[y{}g]><><><><{{a,b} +[{a] +[{b]><><><><{{a,b},c} +[a] +[b] +[c]><><><><{{a,b}c} +[{ac}] +[{bc}]><><><><{{a,b},} +[a] +[b]><><><><><><><{{a,b},}c +[ac] +[bc] +[c]><><><><{{a,b}.} +[{a.}] +[{b.}]><><><><{{a,b}} +[{a}] +[{b}]><><><><><><>< +><><><><{-10..00} +[-10] +[-09] +[-08] +[-07] +[-06] +[-05] +[-04] +[-03] +[-02] +[-01] +[000]><><><><{a,\\{a,b}c} +[a] +[\ac] +[\bc]><><><><{a,\{a,b}c} +[ac}] +[{ac}] +[bc}]><><><><><><><{-10.\.00} +[{-10..00}]><><><><><><><><><><{l,n,m}xyz +[lxyz] +[nxyz] +[mxyz]><><><><{abc\,def} +[{abc,def}]><><><><{abc} +[{abc}]><><><><{x\,y,\{abc\},trie} +[x,y] +[{abc}] +[trie]><><><><{} +[{}]><><><><} +[}]><><><><{ +[{]><><><><><><><{1..10} +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10]><><><><{0..10,braces} +[0..10] +[braces]><><><><{{0..10},braces} +[0] +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10] +[braces]><><><><><><><{3..3} +[3]><><><><><><><{10..1} +[10] +[9] +[8] +[7] +[6] +[5] +[4] +[3] +[2] +[1]><><><><{10..1}y +[10y] +[9y] +[8y] +[7y] +[6y] +[5y] +[4y] +[3y] +[2y] +[1y]><><><><><><><{a..f} +[a] +[b] +[c] +[d] +[e] +[f]><><><><{f..a} +[f] +[e] +[d] +[c] +[b] +[a]><><><><{a..A} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{A..a} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{f..f} +[f]><><><><{1..f} +[{1..f}]><><><><{f..1} +[{f..1}]><><><><{-1..-10} +[-1] +[-2] +[-3] +[-4] +[-5] +[-6] +[-7] +[-8] +[-9] +[-10]><><><><{-20..0} +[-20] +[-19] +[-18] +[-17] +[-16] +[-15] +[-14] +[-13] +[-12] +[-11] +[-10] +[-9] +[-8] +[-7] +[-6] +[-5] +[-4] +[-3] +[-2] +[-1] +[0]><><><><><><><><><><{klklkl}{1,2,3} +[{klklkl}1] +[{klklkl}2] +[{klklkl}3]><><><><{1..10..2} +[1] +[3] +[5] +[7] +[9]><><><><{-1..-10..2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{-1..-10..-2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{10..1..-2} +[10] +[8] +[6] +[4] +[2]><><><><{10..1..2} +[10] +[8] +[6] +[4] +[2]><><><><{1..20..2} +[1] +[3] +[5] +[7] +[9] +[11] +[13] +[15] +[17] +[19]><><><><{1..20..20} +[1]><><><><{100..0..5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{100..0..-5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{a..z} +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{a..z..2} +[a] +[c] +[e] +[g] +[i] +[k] +[m] +[o] +[q] +[s] +[u] +[w] +[y]><><><><{z..a..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b]><><><><{2147483645..2147483649} +[2147483645] +[2147483646] +[2147483647] +[2147483648] +[2147483649]><><><><{10..0..2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{10..0..-2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{-50..-0..5} +[-50] +[-45] +[-40] +[-35] +[-30] +[-25] +[-20] +[-15] +[-10] +[-5] +[0]><><><><{1..10.f} +[{1..10.f}]><><><><{1..ff} +[{1..ff}]><><><><{1..10..ff} +[{1..10..ff}]><><><><{1.20..2} +[{1.20..2}]><><><><{1..20..f2} +[{1..20..f2}]><><><><{1..20..2f} +[{1..20..2f}]><><><><{1..2f..2} +[{1..2f..2}]><><><><{1..ff..2} +[{1..ff..2}]><><><><{1..ff} +[{1..ff}]><><><><{1..f} +[{1..f}]><><><><{1..0f} +[{1..0f}]><><><><{1..10f} +[{1..10f}]><><><><{1..10.f} +[{1..10.f}]><><><><{1..10.f} +[{1..10.f}]><><><>< \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt new file mode 100644 index 00000000..e5161c3d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt @@ -0,0 +1,182 @@ +# skip quotes for now +# "{x,x}" +# {"x,x"} +# {x","x} +# '{a,b}{{a,b},a,b}' +A{b,{d,e},{f,g}}Z +PRE-{a,b}{{a,b},a,b}-POST +\\{a,b}{{a,b},a,b} +{{a,b} +{a,b}} +{,} +a{,} +{,}b +a{,}b +a{b}c +a{1..5}b +a{01..5}b +a{-01..5}b +a{-01..5..3}b +a{001..9}b +a{b,c{d,e},{f,g}h}x{y,z +a{b,c{d,e},{f,g}h}x{y,z\\} +a{b,c{d,e},{f,g}h}x{y,z} +a{b{c{d,e}f{x,y{{g}h +a{b{c{d,e}f{x,y{}g}h +a{b{c{d,e}f{x,y}}g}h +a{b{c{d,e}f}g}h +a{{x,y},z}b +f{x,y{g,z}}h +f{x,y{{g,z}}h +f{x,y{{g,z}}h} +f{x,y{{g}h +f{x,y{{g}}h +f{x,y{}g}h +z{a,b{,c}d +z{a,b},c}d +{-01..5} +{-05..100..5} +{-05..100} +{0..5..2} +{0001..05..2} +{0001..-5..2} +{0001..-5..-2} +{0001..5..-2} +{01..5} +{1..05} +{1..05..3} +{05..100} +{0a..0z} +{a,b\\}c,d} +{a,b{c,d} +{a,b}c,d} +{a..F} +{A..f} +{a..Z} +{A..z} +{z..A} +{Z..a} +{a..F..2} +{A..f..02} +{a..Z..5} +d{a..Z..5}b +{A..z..10} +{z..A..-2} +{Z..a..20} +{a{,b} +{a},b} +{x,y{,}g} +{x,y{}g} +{{a,b} +{{a,b},c} +{{a,b}c} +{{a,b},} +X{{a,b},}X +{{a,b},}c +{{a,b}.} +{{a,b}} +X{a..#}X +# this next one is an empty string + +{-10..00} +# Need to escape slashes in here for reasons i guess. +{a,\\\\{a,b}c} +{a,\\{a,b}c} +a,\\{b,c} +{-10.\\.00} +#### bash tests/braces.tests +# Note that some tests are edited out because some features of +# bash are intentionally not supported in this brace expander. +ff{c,b,a} +f{d,e,f}g +{l,n,m}xyz +{abc\\,def} +{abc} +{x\\,y,\\{abc\\},trie} +# not impementing back-ticks obviously +# XXXX\\{`echo a b c | tr ' ' ','`\\} +{} +# We only ever have to worry about parsing a single argument, +# not a command line, so spaces have a different meaning than bash. +# { } +} +{ +abcd{efgh +# spaces +# foo {1,2} bar +# not impementing back-ticks obviously +# `zecho foo {1,2} bar` +# $(zecho foo {1,2} bar) +# ${var} is not a variable here, like it is in bash. omit. +# foo{bar,${var}.} +# foo{bar,${var}} +# isaacs: skip quotes for now +# "${var}"{x,y} +# $var{x,y} +# ${var}{x,y} +# new sequence brace operators +{1..10} +# this doesn't work yet +{0..10,braces} +# but this does +{{0..10},braces} +x{{0..10},braces}y +{3..3} +x{3..3}y +{10..1} +{10..1}y +x{10..1}y +{a..f} +{f..a} +{a..A} +{A..a} +{f..f} +# mixes are incorrectly-formed brace expansions +{1..f} +{f..1} +# spaces +# 0{1..9} {10..20} +# do negative numbers work? +{-1..-10} +{-20..0} +# weirdly-formed brace expansions -- fixed in post-bash-3.1 +a-{b{d,e}}-c +a-{bdef-{g,i}-c +# isaacs: skip quotes for now +# {"klklkl"}{1,2,3} +# isaacs: this is a valid test, though +{klklkl}{1,2,3} +# {"x,x"} +{1..10..2} +{-1..-10..2} +{-1..-10..-2} +{10..1..-2} +{10..1..2} +{1..20..2} +{1..20..20} +{100..0..5} +{100..0..-5} +{a..z} +{a..z..2} +{z..a..-2} +# make sure brace expansion handles ints > 2**31 - 1 using intmax_t +{2147483645..2147483649} +# unwanted zero-padding -- fixed post-bash-4.0 +{10..0..2} +{10..0..-2} +{-50..-0..5} +# bad +{1..10.f} +{1..ff} +{1..10..ff} +{1.20..2} +{1..20..f2} +{1..20..2f} +{1..2f..2} +{1..ff..2} +{1..ff} +{1..f} +{1..0f} +{1..10f} +{1..10.f} +{1..10.f} diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js new file mode 100644 index 00000000..3fcc185a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var expand = require('..'); + +test('ignores ${', function(t) { + t.deepEqual(expand('${1..3}'), ['${1..3}']); + t.deepEqual(expand('${a,b}${c,d}'), ['${a,b}${c,d}']); + t.deepEqual(expand('x${a,b}x${c,d}x'), ['x${a,b}x${c,d}x']); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js new file mode 100644 index 00000000..e429121e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('empty option', function(t) { + t.deepEqual(expand('-v{,,,,}'), [ + '-v', '-v', '-v', '-v', '-v' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh new file mode 100644 index 00000000..e040e664 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +# Bash 4.3 because of arbitrary need to pick a single standard. + +if [ "${BASH_VERSINFO[0]}" != "4" ] || [ "${BASH_VERSINFO[1]}" != "3" ]; then + echo "this script requires bash 4.3" >&2 + exit 1 +fi + +CDPATH= cd "$(dirname "$0")" + +js='require("./")(process.argv[1]).join(" ")' + +cat cases.txt | \ + while read case; do + if [ "${case:0:1}" = "#" ]; then + continue; + fi; + b="$($BASH -c 'for c in '"$case"'; do echo ["$c"]; done')" + echo "$case" + echo -n "$b><><><><"; + done > bash-results.txt diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js new file mode 100644 index 00000000..8d434c23 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var expand = require('..'); + +test('negative increment', function(t) { + t.deepEqual(expand('{3..1}'), ['3', '2', '1']); + t.deepEqual(expand('{10..8}'), ['10', '9', '8']); + t.deepEqual(expand('{10..08}'), ['10', '09', '08']); + t.deepEqual(expand('{c..a}'), ['c', 'b', 'a']); + + t.deepEqual(expand('{4..0..2}'), ['4', '2', '0']); + t.deepEqual(expand('{4..0..-2}'), ['4', '2', '0']); + t.deepEqual(expand('{e..a..2}'), ['e', 'c', 'a']); + + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/nested.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/nested.js new file mode 100644 index 00000000..0862dc51 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/nested.js @@ -0,0 +1,16 @@ +var test = require('tape'); +var expand = require('..'); + +test('nested', function(t) { + t.deepEqual(expand('{a,b{1..3},c}'), [ + 'a', 'b1', 'b2', 'b3', 'c' + ]); + t.deepEqual(expand('{{A..Z},{a..z}}'), + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('') + ); + t.deepEqual(expand('ppp{,config,oe{,conf}}'), [ + 'ppp', 'pppconfig', 'pppoe', 'pppoeconf' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/order.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/order.js new file mode 100644 index 00000000..c00ad155 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/order.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('order', function(t) { + t.deepEqual(expand('a{d,c,b}e'), [ + 'ade', 'ace', 'abe' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/pad.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/pad.js new file mode 100644 index 00000000..e4158775 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/pad.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var expand = require('..'); + +test('pad', function(t) { + t.deepEqual(expand('{9..11}'), [ + '9', '10', '11' + ]); + t.deepEqual(expand('{09..11}'), [ + '09', '10', '11' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js new file mode 100644 index 00000000..3038fba7 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js @@ -0,0 +1,7 @@ +var test = require('tape'); +var expand = require('..'); + +test('x and y of same type', function(t) { + t.deepEqual(expand('{a..9}'), ['{a..9}']); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js new file mode 100644 index 00000000..f73a9579 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js @@ -0,0 +1,50 @@ +var test = require('tape'); +var expand = require('..'); + +test('numeric sequences', function(t) { + t.deepEqual(expand('a{1..2}b{2..3}c'), [ + 'a1b2c', 'a1b3c', 'a2b2c', 'a2b3c' + ]); + t.deepEqual(expand('{1..2}{2..3}'), [ + '12', '13', '22', '23' + ]); + t.end(); +}); + +test('numeric sequences with step count', function(t) { + t.deepEqual(expand('{0..8..2}'), [ + '0', '2', '4', '6', '8' + ]); + t.deepEqual(expand('{1..8..2}'), [ + '1', '3', '5', '7' + ]); + t.end(); +}); + +test('numeric sequence with negative x / y', function(t) { + t.deepEqual(expand('{3..-2}'), [ + '3', '2', '1', '0', '-1', '-2' + ]); + t.end(); +}); + +test('alphabetic sequences', function(t) { + t.deepEqual(expand('1{a..b}2{b..c}3'), [ + '1a2b3', '1a2c3', '1b2b3', '1b2c3' + ]); + t.deepEqual(expand('{a..b}{b..c}'), [ + 'ab', 'ac', 'bb', 'bc' + ]); + t.end(); +}); + +test('alphabetic sequences with step count', function(t) { + t.deepEqual(expand('{a..k..2}'), [ + 'a', 'c', 'e', 'g', 'i', 'k' + ]); + t.deepEqual(expand('{b..k..2}'), [ + 'b', 'd', 'f', 'h', 'j' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/minimatch/package.json b/node_modules/standard/node_modules/eslint/node_modules/minimatch/package.json new file mode 100644 index 00000000..b438bdb9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/minimatch/package.json @@ -0,0 +1,66 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "2.0.7", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "pretest": "standard minimatch.js test/*.js", + "test": "tap test/*.js", + "prepublish": "browserify -o browser.js -e minimatch.js --bare" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.0.0" + }, + "devDependencies": { + "browserify": "^9.0.3", + "standard": "^3.7.2", + "tap": "" + }, + "license": { + "type": "MIT", + "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" + }, + "files": [ + "minimatch.js", + "browser.js" + ], + "gitHead": "4bd6dc22c248c7ea07cc49d63181fe6f6aafae9c", + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" + }, + "homepage": "https://github.com/isaacs/minimatch", + "_id": "minimatch@2.0.7", + "_shasum": "d23652ab10e663e7d914602e920e21f9f66492be", + "_from": "minimatch@>=2.0.1 <3.0.0", + "_npmVersion": "2.7.6", + "_nodeVersion": "1.7.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d23652ab10e663e7d914602e920e21f9f66492be", + "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/.npmignore new file mode 100644 index 00000000..9303c347 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/.travis.yml new file mode 100644 index 00000000..c693a939 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - "0.10" diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/LICENSE new file mode 100644 index 00000000..432d1aeb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/LICENSE @@ -0,0 +1,21 @@ +Copyright 2010 James Halliday (mail@substack.net) + +This project is free software released under the MIT/X11 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. + +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/node_modules/standard/node_modules/eslint/node_modules/mkdirp/bin/cmd.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/bin/cmd.js new file mode 100755 index 00000000..d95de15a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/bin/cmd.js @@ -0,0 +1,33 @@ +#!/usr/bin/env node + +var mkdirp = require('../'); +var minimist = require('minimist'); +var fs = require('fs'); + +var argv = minimist(process.argv.slice(2), { + alias: { m: 'mode', h: 'help' }, + string: [ 'mode' ] +}); +if (argv.help) { + fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout); + return; +} + +var paths = argv._.slice(); +var mode = argv.mode ? parseInt(argv.mode, 8) : undefined; + +(function next () { + if (paths.length === 0) return; + var p = paths.shift(); + + if (mode === undefined) mkdirp(p, cb) + else mkdirp(p, mode, cb) + + function cb (err) { + if (err) { + console.error(err.message); + process.exit(1); + } + else next(); + } +})(); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/bin/usage.txt b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/bin/usage.txt new file mode 100644 index 00000000..f952aa2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/bin/usage.txt @@ -0,0 +1,12 @@ +usage: mkdirp [DIR1,DIR2..] {OPTIONS} + + Create each supplied directory including any necessary parent directories that + don't yet exist. + + If the directory already exists, do nothing. + +OPTIONS are: + + -m, --mode If a directory needs to be created, set the mode as an octal + permission string. + diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/examples/pow.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/examples/pow.js new file mode 100644 index 00000000..e6924212 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/examples/pow.js @@ -0,0 +1,6 @@ +var mkdirp = require('mkdirp'); + +mkdirp('/tmp/foo/bar/baz', function (err) { + if (err) console.error(err) + else console.log('pow!') +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/index.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/index.js new file mode 100644 index 00000000..a1742b20 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/index.js @@ -0,0 +1,97 @@ +var path = require('path'); +var fs = require('fs'); + +module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + +function mkdirP (p, opts, f, made) { + if (typeof opts === 'function') { + f = opts; + opts = {}; + } + else if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = 0777 & (~process.umask()); + } + if (!made) made = null; + + var cb = f || function () {}; + p = path.resolve(p); + + xfs.mkdir(p, mode, function (er) { + if (!er) { + made = made || p; + return cb(null, made); + } + switch (er.code) { + case 'ENOENT': + mkdirP(path.dirname(p), opts, function (er, made) { + if (er) cb(er, made); + else mkdirP(p, opts, cb, made); + }); + break; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, function (er2, stat) { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) cb(er, made) + else cb(null, made); + }); + break; + } + }); +} + +mkdirP.sync = function sync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = 0777 & (~process.umask()); + } + if (!made) made = null; + + p = path.resolve(p); + + try { + xfs.mkdirSync(p, mode); + made = made || p; + } + catch (err0) { + switch (err0.code) { + case 'ENOENT' : + made = sync(path.dirname(p), opts, made); + sync(p, opts, made); + break; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + var stat; + try { + stat = xfs.statSync(p); + } + catch (err1) { + throw err0; + } + if (!stat.isDirectory()) throw err0; + break; + } + } + + return made; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/example/parse.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/example/parse.js new file mode 100644 index 00000000..abff3e8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/example/parse.js @@ -0,0 +1,2 @@ +var argv = require('../')(process.argv.slice(2)); +console.dir(argv); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/index.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/index.js new file mode 100644 index 00000000..584f551a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/index.js @@ -0,0 +1,187 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {} }; + + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + }); + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function setArg (key, val) { + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + setArg(m[1], m[2]); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, next); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true'); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2)); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, args[i+1]); + i++; + } + else if (args[i+1] && /true|false/.test(args[i+1])) { + setArg(key, args[i+1] === 'true'); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true); + } + } + } + else { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + notFlags.forEach(function(key) { + argv._.push(key); + }); + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function setKey (obj, keys, value) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + if (o[key] === undefined) o[key] = {}; + o = o[key]; + }); + + var key = keys[keys.length - 1]; + if (o[key] === undefined || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } +} + +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +} + +function longest (xs) { + return Math.max.apply(null, xs.map(function (x) { return x.length })); +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/package.json b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/package.json new file mode 100644 index 00000000..09e9ec44 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/package.json @@ -0,0 +1,67 @@ +{ + "name": "minimist", + "version": "0.0.8", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "tape": "~1.0.4", + "tap": "~0.4.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/substack/minimist/issues" + }, + "_id": "minimist@0.0.8", + "dist": { + "shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d", + "tarball": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz" + }, + "_from": "minimist@0.0.8", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "directories": {}, + "_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d", + "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/readme.markdown b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/readme.markdown new file mode 100644 index 00000000..c2563532 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/readme.markdown @@ -0,0 +1,73 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist) + +[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist) + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.dir(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a string or array of strings to always treat as booleans +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/dash.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/dash.js new file mode 100644 index 00000000..8b034b99 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/dash.js @@ -0,0 +1,24 @@ +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(5); + t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); + t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); + t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); + t.deepEqual( + parse([ '-b', '-' ], { boolean: 'b' }), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + parse([ '-s', '-' ], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(3); + t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/default_bool.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/default_bool.js new file mode 100644 index 00000000..f0041ee4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/default_bool.js @@ -0,0 +1,20 @@ +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true } + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false } + }); + t.equal(argv.somefalse, false); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/dotted.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/dotted.js new file mode 100644 index 00000000..ef0ae349 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/dotted.js @@ -0,0 +1,16 @@ +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/long.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/long.js new file mode 100644 index 00000000..5d3a1e09 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/long.js @@ -0,0 +1,31 @@ +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse([ '--bool' ]), + { bool : true, _ : [] }, + 'long boolean' + ); + t.deepEqual( + parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture sp' + ); + t.deepEqual( + parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture eq' + ); + t.deepEqual( + parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures sp' + ); + t.deepEqual( + parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/parse.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/parse.js new file mode 100644 index 00000000..8a906466 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/parse.js @@ -0,0 +1,318 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse([ '--no-moo' ]), + { moo : false, _ : [] }, + 'no' + ); + t.deepEqual( + parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ] + } + ); + t.end(); +}); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789' + ]); + t.deepEqual(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ] + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse([ '-t', 'moo' ], { boolean: 't' }); + t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: [ 't', 'verbose' ], + default: { verbose: true } + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false } + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { + boolean: ['x','y','z'] + }); + + t.deepEqual(argv, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ] + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = parse([ '-s', "X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse([ "--s=X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + t.end(); +}); + +test('strings' , function (t) { + var s = parse([ '-s', '0001234' ], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse([ '-x', '56' ], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([ ' ', ' ' ], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function(t) { + var s = parse([ '-s' ], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse([ '--str' ], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse([ '-art' ], { + string: [ 'a', 't' ] + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + + +test('slashBreak', function (t) { + t.same( + parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [] } + ); + t.same( + parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: 'zoom' } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: [ 'zm', 'zoom' ] } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]); + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + } + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); + +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + alias: { 'h': 'herp' }, + boolean: 'herp' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js new file mode 100644 index 00000000..21851b03 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,9 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = parse([ '-b', '123' ], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: ['123'] }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/short.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/short.js new file mode 100644 index 00000000..d513a1c2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/short.js @@ -0,0 +1,67 @@ +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); + t.deepEqual( + parse([ '-123', '456' ]), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse([ '-b' ]), + { b : true, _ : [] }, + 'short boolean' + ); + t.deepEqual( + parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ] }, + 'bare' + ); + t.deepEqual( + parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [] }, + 'group' + ); + t.deepEqual( + parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [] }, + 'short group next' + ); + t.deepEqual( + parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [] }, + 'short capture' + ); + t.deepEqual( + parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/whitespace.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/whitespace.js new file mode 100644 index 00000000..8a52a58c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/node_modules/minimist/test/whitespace.js @@ -0,0 +1,8 @@ +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/package.json b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/package.json new file mode 100644 index 00000000..54d87e73 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/package.json @@ -0,0 +1,58 @@ +{ + "name": "mkdirp", + "description": "Recursively mkdir, like `mkdir -p`", + "version": "0.5.0", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "main": "./index", + "keywords": [ + "mkdir", + "directory" + ], + "repository": { + "type": "git", + "url": "https://github.com/substack/node-mkdirp.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "minimist": "0.0.8" + }, + "devDependencies": { + "tap": "~0.4.0", + "mock-fs": "~2.2.0" + }, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/substack/node-mkdirp/issues" + }, + "homepage": "https://github.com/substack/node-mkdirp", + "_id": "mkdirp@0.5.0", + "dist": { + "shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12", + "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz" + }, + "_from": "mkdirp@>=0.5.0 <0.6.0", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "directories": {}, + "_shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12", + "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/readme.markdown b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/readme.markdown new file mode 100644 index 00000000..3cc13153 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/readme.markdown @@ -0,0 +1,100 @@ +# mkdirp + +Like `mkdir -p`, but in node.js! + +[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) + +# example + +## pow.js + +```js +var mkdirp = require('mkdirp'); + +mkdirp('/tmp/foo/bar/baz', function (err) { + if (err) console.error(err) + else console.log('pow!') +}); +``` + +Output + +``` +pow! +``` + +And now /tmp/foo/bar/baz exists, huzzah! + +# methods + +```js +var mkdirp = require('mkdirp'); +``` + +## mkdirp(dir, opts, cb) + +Create a new directory and any necessary subdirectories at `dir` with octal +permission string `opts.mode`. If `opts` is a non-object, it will be treated as +the `opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +`cb(err, made)` fires with the error or the first directory `made` +that had to be created, if any. + +You can optionally pass in an alternate `fs` implementation by passing in +`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and +`opts.fs.stat(path, cb)`. + +## mkdirp.sync(dir, opts) + +Synchronously create a new directory and any necessary subdirectories at `dir` +with octal permission string `opts.mode`. If `opts` is a non-object, it will be +treated as the `opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +Returns the first directory that had to be created, if any. + +You can optionally pass in an alternate `fs` implementation by passing in +`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and +`opts.fs.statSync(path)`. + +# usage + +This package also ships with a `mkdirp` command. + +``` +usage: mkdirp [DIR1,DIR2..] {OPTIONS} + + Create each supplied directory including any necessary parent directories that + don't yet exist. + + If the directory already exists, do nothing. + +OPTIONS are: + + -m, --mode If a directory needs to be created, set the mode as an octal + permission string. + +``` + +# install + +With [npm](http://npmjs.org) do: + +``` +npm install mkdirp +``` + +to get the library, or + +``` +npm install -g mkdirp +``` + +to get the command. + +# license + +MIT diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/chmod.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/chmod.js new file mode 100644 index 00000000..520dcb8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/chmod.js @@ -0,0 +1,38 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +var ps = [ '', 'tmp' ]; + +for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); +} + +var file = ps.join('/'); + +test('chmod-pre', function (t) { + var mode = 0744 + mkdirp(file, mode, function (er) { + t.ifError(er, 'should not error'); + fs.stat(file, function (er, stat) { + t.ifError(er, 'should exist'); + t.ok(stat && stat.isDirectory(), 'should be directory'); + t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); + t.end(); + }); + }); +}); + +test('chmod', function (t) { + var mode = 0755 + mkdirp(file, mode, function (er) { + t.ifError(er, 'should not error'); + fs.stat(file, function (er, stat) { + t.ifError(er, 'should exist'); + t.ok(stat && stat.isDirectory(), 'should be directory'); + t.end(); + }); + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/clobber.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/clobber.js new file mode 100644 index 00000000..0eb70998 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/clobber.js @@ -0,0 +1,37 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +var ps = [ '', 'tmp' ]; + +for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); +} + +var file = ps.join('/'); + +// a file in the way +var itw = ps.slice(0, 3).join('/'); + + +test('clobber-pre', function (t) { + console.error("about to write to "+itw) + fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); + + fs.stat(itw, function (er, stat) { + t.ifError(er) + t.ok(stat && stat.isFile(), 'should be file') + t.end() + }) +}) + +test('clobber', function (t) { + t.plan(2); + mkdirp(file, 0755, function (err) { + t.ok(err); + t.equal(err.code, 'ENOTDIR'); + t.end(); + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/mkdirp.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/mkdirp.js new file mode 100644 index 00000000..3b624ddb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/mkdirp.js @@ -0,0 +1,26 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; + +test('woo', function (t) { + t.plan(5); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + mkdirp(file, 0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }) + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/opts_fs.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/opts_fs.js new file mode 100644 index 00000000..f1fbeca1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/opts_fs.js @@ -0,0 +1,27 @@ +var mkdirp = require('../'); +var path = require('path'); +var test = require('tap').test; +var mockfs = require('mock-fs'); + +test('opts.fs', function (t) { + t.plan(5); + + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/beep/boop/' + [x,y,z].join('/'); + var xfs = mockfs.fs(); + + mkdirp(file, { fs: xfs, mode: 0755 }, function (err) { + t.ifError(err); + xfs.exists(file, function (ex) { + t.ok(ex, 'created file'); + xfs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/opts_fs_sync.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/opts_fs_sync.js new file mode 100644 index 00000000..224b5064 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/opts_fs_sync.js @@ -0,0 +1,25 @@ +var mkdirp = require('../'); +var path = require('path'); +var test = require('tap').test; +var mockfs = require('mock-fs'); + +test('opts.fs sync', function (t) { + t.plan(4); + + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/beep/boop/' + [x,y,z].join('/'); + var xfs = mockfs.fs(); + + mkdirp.sync(file, { fs: xfs, mode: 0755 }); + xfs.exists(file, function (ex) { + t.ok(ex, 'created file'); + xfs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/perm.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/perm.js new file mode 100644 index 00000000..2c975905 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/perm.js @@ -0,0 +1,30 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; + +test('async perm', function (t) { + t.plan(5); + var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); + + mkdirp(file, 0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }) + }); +}); + +test('async root perm', function (t) { + mkdirp('/tmp', 0755, function (err) { + if (err) t.fail(err); + t.end(); + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/perm_sync.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/perm_sync.js new file mode 100644 index 00000000..327e54b2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/perm_sync.js @@ -0,0 +1,34 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; + +test('sync perm', function (t) { + t.plan(4); + var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; + + mkdirp.sync(file, 0755); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); + +test('sync root perm', function (t) { + t.plan(3); + + var file = '/tmp'; + mkdirp.sync(file, 0755); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/race.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/race.js new file mode 100644 index 00000000..7c295f41 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/race.js @@ -0,0 +1,40 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; + +test('race', function (t) { + t.plan(6); + var ps = [ '', 'tmp' ]; + + for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); + } + var file = ps.join('/'); + + var res = 2; + mk(file, function () { + if (--res === 0) t.end(); + }); + + mk(file, function () { + if (--res === 0) t.end(); + }); + + function mk (file, cb) { + mkdirp(file, 0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + if (cb) cb(); + }); + }) + }); + } +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/rel.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/rel.js new file mode 100644 index 00000000..d1f175c2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/rel.js @@ -0,0 +1,30 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; + +test('rel', function (t) { + t.plan(5); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var cwd = process.cwd(); + process.chdir('/tmp'); + + var file = [x,y,z].join('/'); + + mkdirp(file, 0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + process.chdir(cwd); + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }) + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/return.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/return.js new file mode 100644 index 00000000..bce68e56 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/return.js @@ -0,0 +1,25 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('return value', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + // should return the first dir created. + // By this point, it would be profoundly surprising if /tmp didn't + // already exist, since every other test makes things in there. + mkdirp(file, function (err, made) { + t.ifError(err); + t.equal(made, '/tmp/' + x); + mkdirp(file, function (err, made) { + t.ifError(err); + t.equal(made, null); + }); + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/return_sync.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/return_sync.js new file mode 100644 index 00000000..7c222d35 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/return_sync.js @@ -0,0 +1,24 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('return value', function (t) { + t.plan(2); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + // should return the first dir created. + // By this point, it would be profoundly surprising if /tmp didn't + // already exist, since every other test makes things in there. + // Note that this will throw on failure, which will fail the test. + var made = mkdirp.sync(file); + t.equal(made, '/tmp/' + x); + + // making the same file again should have no effect. + made = mkdirp.sync(file); + t.equal(made, null); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/root.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/root.js new file mode 100644 index 00000000..97ad7a2f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/root.js @@ -0,0 +1,18 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('root', function (t) { + // '/' on unix, 'c:/' on windows. + var file = path.resolve('/'); + + mkdirp(file, 0755, function (err) { + if (err) throw err + fs.stat(file, function (er, stat) { + if (er) throw er + t.ok(stat.isDirectory(), 'target is a directory'); + t.end(); + }) + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/sync.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/sync.js new file mode 100644 index 00000000..88fa4324 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/sync.js @@ -0,0 +1,30 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; + +test('sync', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + try { + mkdirp.sync(file, 0755); + } catch (err) { + t.fail(err); + return t.end(); + } + + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/umask.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/umask.js new file mode 100644 index 00000000..82c393a0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/umask.js @@ -0,0 +1,26 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; + +test('implicit mode from umask', function (t) { + t.plan(5); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + mkdirp(file, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & 0777, 0777 & (~process.umask())); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }) + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/umask_sync.js b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/umask_sync.js new file mode 100644 index 00000000..e537fbe4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/mkdirp/test/umask_sync.js @@ -0,0 +1,30 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; + +test('umask sync modes', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + try { + mkdirp.sync(file); + } catch (err) { + t.fail(err); + return t.end(); + } + + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & 0777, (0777 & (~process.umask()))); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/object-assign/index.js b/node_modules/standard/node_modules/eslint/node_modules/object-assign/index.js new file mode 100644 index 00000000..438b80ab --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/object-assign/index.js @@ -0,0 +1,26 @@ +'use strict'; + +function ToObject(val) { + if (val == null) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +module.exports = Object.assign || function (target, source) { + var from; + var keys; + var to = ToObject(target); + + for (var s = 1; s < arguments.length; s++) { + from = arguments[s]; + keys = Object.keys(Object(from)); + + for (var i = 0; i < keys.length; i++) { + to[keys[i]] = from[keys[i]]; + } + } + + return to; +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/object-assign/package.json b/node_modules/standard/node_modules/eslint/node_modules/object-assign/package.json new file mode 100644 index 00000000..59a6bb56 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/object-assign/package.json @@ -0,0 +1,68 @@ +{ + "name": "object-assign", + "version": "2.0.0", + "description": "ES6 Object.assign() ponyfill", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/object-assign" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es6", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "4cd0365f5a78dd369473ca0bbd31f7b234148c42", + "bugs": { + "url": "https://github.com/sindresorhus/object-assign/issues" + }, + "homepage": "https://github.com/sindresorhus/object-assign", + "_id": "object-assign@2.0.0", + "_shasum": "f8309b09083b01261ece3ef7373f2b57b8dd7042", + "_from": "object-assign@>=2.0.0 <3.0.0", + "_npmVersion": "2.1.5", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "f8309b09083b01261ece3ef7373f2b57b8dd7042", + "tarball": "http://registry.npmjs.org/object-assign/-/object-assign-2.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/object-assign/readme.md b/node_modules/standard/node_modules/eslint/node_modules/object-assign/readme.md new file mode 100644 index 00000000..aee51c12 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/object-assign/readme.md @@ -0,0 +1,51 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES6 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) ponyfill + +> Ponyfill: A polyfill that doesn't overwrite the native method + + +## Install + +```sh +$ npm install --save object-assign +``` + + +## Usage + +```js +var objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, source, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES6 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/optionator/LICENSE new file mode 100644 index 00000000..525b1185 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +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/node_modules/standard/node_modules/eslint/node_modules/optionator/README.md b/node_modules/standard/node_modules/eslint/node_modules/optionator/README.md new file mode 100644 index 00000000..99e3bc75 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/README.md @@ -0,0 +1,200 @@ +# Optionator + + +Optionator is an option parsing and help generation library. + +## Why? +The problem with other option parsers, such as `yargs` or `minimist`, is they just accept all input, valid or not. +With Optionator, if you mistype an option, it will give you an error (with a suggestion for what you meant). +If you give the wrong type of argument for an option, it will give you an error rather than supplying the wrong input to your application. + + $ cmd --halp + Invalid option '--halp' - perhaps you meant '--help'? + + $ cmd --count str + Invalid value for option 'count' - expected type Int, received value: str. + +Over helpful features include reformatting the help text based on the size of the console, so that it fits even if the console is narrow, and accepting not just an array (eg. process.argv), but a string or object as well, making things like testing much easier. + +## About +Optionator uses [type-check](https://github.com/gkz/type-check) and [levn](https://github.com/gkz/levn) behind the scenes to cast and verify input according the specified types. + +Optionator is used by [Grasp](http://graspjs.com), [eslint](http://eslint.org), [LiveScript](http://livescript.net), [esmangle](https://github.com/estools/esmangle), [escodegen](https://github.com/estools/escodegen), and more. + +MIT license. Version 0.5.0 + + npm install optionator + +For updates on Optionator, [follow me on twitter](https://twitter.com/gkzahariev). + +## Usage +`require('optionator');` returns a function. It has one property, `VERSION`, the current version of the library as a string. This function is called with an object specifying your options and other information, see the [settings format section](#settings-format). This in turn returns an object with three properties, `parse`, `generateHelp`, and `generateHelpForOption`, which are all functions. + +```js +var optionator = require('optionator')({ + prepend: 'Usage: cmd [options]', + append: 'Version 1.0.0', + options: [{ + option: 'help', + alias: 'h', + type: 'Boolean', + description: 'displays help' + }, { + option: 'count', + alias: 'c', + type: 'Int', + description: 'number of things', + example: 'cmd --count 2' + }] +}); +``` + +### parse(input, parseOptions) +`parse` processes the `input` according to your settings, and returns an object with the results. + +##### arguments +* input - `[String] | Object | String` - the input you wish to parse +* parseOptions - `{slice: Int}` - all options optional + - `slice` specifies how much to slice away from the beginning if the input is an array or string - by default `0` for string, `2` for array (works with `process.argv`) + +##### returns +`Object` - the parsed options, each key is a camelCase version of the option name (specified in dash-case), and each value is the processed value for that option. Positional values are in an array under the `_` key. + +##### example +```js +parse(['node', 't.js', '--count', '2', 'positional']); // {count: 2, _: ['positional']} +parse('--count 2 positional'); // {count: 2, _: ['positional']} +parse({count: 2, _:['positional']}); // {count: 2, _: ['positional']} +``` + +### generateHelp(helpOptions) +`generateHelp` produces help text based on your settings. + +##### arguments +* helpOptions - `{showHidden: Boolean, interpolate: Object}` - all options optional + - `showHidden` specifies whether to show options with `hidden: true` specified, by default it is `false` + - `interpolate` specify data to be interpolated in `prepend` and `append` text, `{{key}}` is the format - eg. `generateHelp({interpolate:{version: '0.4.2'}})`, will change this `append` text: `Version {{version}}` to `Version 0.4.2` + +##### returns +`String` - the generated help text + +##### example +```js +generateHelp(); /* +"Usage: cmd [options] positional + + -h, --help displays help + -c, --count Int number of things + +Version 1.0.0 +"*/ +``` + +### generateHelpForOption(optionName) +`generateHelpForOption` produces expanded help text for the specified with `optionName` option. If an `example` was specified for the option, it will be displayed, and if a `longDescription` was specified, it will display that instead of the `description`. + +##### arguments +* optionName - `String` - the name of the option to display + +##### returns +`String` - the generated help text for the option + +##### example +```js +generateHelpForOption('count'); /* +"-c, --count Int +description: number of things +example: cmd --count 2 +"*/ +``` + +## Settings Format +When your `require('optionator')`, you get a function that takes in a settings object. This object has the type: + + { + prepend: Maybe String, + append: Maybe String, + options: [{heading: String} | { + option: String, + alias: Maybe [String] | String, + type: Maybe String, + enum: Maybe [String], + default: Maybe String, + restPositional: Maybe Boolean, + requried: Maybe Boolean, + overrideRequired: Maybe Bookean, + dependsOn: Maybe [String] | String, + description: Maybe String, + longDescription: Maybe String, + example: Maybe [String] | String + }], + helpStyle: Maybe { + aliasSeparator: Maybe String, + typeSeparator: Maybe String, + descriptionSeparator: Maybe String, + initialIndent: Maybe Int, + secondaryIndent: Maybe Int, + maxPadFactor: Maybe Number + }, + mutuallyExclusive: Maybe [[String | [String]]], + concatRepeatedArrays: Maybe Boolean, + mergeRepeatedObjects: Maybe Boolean + } + +### Top Level Properties +* `prepend` is an optional string to be placed before the options in the help text +* `append` is an optional string to be placed after the options in the help text +* `options` is a required array specifying your options and headings, the options and headings will be displayed in the order specified +* `helpStyle` is an optional object which enables you to change the default appearance of some aspects of the help text +* `mutuallyExclusive` is an optional array of arrays of either strings or arrays of strings. The top level array is a list of rules, each rule is a list of elements - each element can be either a string (the name of an option), or a list of strings (a group of option names) - there will be an error if more than one element is present +* `concatRepeatedArrays` is an optional boolean (defaults to `false`) - when set to `true` and an option contains an array value and is repeated, the subsequent values for the flag will be appended rather than overwriting the original value - eg. option `g` of type `[String]`: `-g a -g b -g c,d` will result in `['a','b','c','d']` +* `mergeRepeatedObjects` is an optional boolean (defaults to `false`) - when set to `true` and an option contains an object value and is repeated, the subsequent values for the flag will be merged rather than overwriting the original value - eg. option `g` of type `Object`: `-g a:1 -g b:2 -g c:3,d:4` will result in `{a: 1, b: 2, c: 3, d: 4}` + +#### Heading Properties +* `heading` a required string, the name of the heading + +#### Option Properties +* `option` the required name of the option - use dash-case, without the leading dashes +* `alias` is an optional string or array of strings which specify any aliases for the option +* `type` is a required string in the [type check](https://github.com/gkz/type-check) [format](https://github.com/gkz/type-check#type-format), this will be used to cast the inputted value and validate it +* `enum` is an optional array of strings, each string will be parsed by [levn](https://github.com/gkz/levn) - the argument value must be one of the resulting values - each potential value must validate against the specified `type` +* `default` is a optional string, which will be parsed by [levn](https://github.com/gkz/levn) and used as the default value if none is set - the value must validate against the specified `type` +* `restPositional` is an optional boolean - if set to `true`, everything after the option will be taken to be a positional argument, even if it looks like a named argument +* `required` is an optional boolean - if set to `true`, the option parsing will fail if the option is not defined +* `overrideRequired` is a optional boolean - if set to `true` and the option is used, and there is another option which is required but not set, it will override the need for the required option and there will be no error - this is useful if you have required options and want to use `--help` or `--version` flags +* `dependsOn` is an optional string or array of strings - if simply a string (the name of another option), it will make sure that that other option is set, if an array of strings, depending on whether `'and'` or `'or'` is first, it will either check whether all (`['and', 'option-a', 'option-b']`), or at least one (`['or', 'option-a', 'option-b']`) other options are set +* `description` is an optional string, which will be displayed next to the option in the help text +* `longDescription` is an optional string, it will be displayed instead of the `description` when `generateHelpForOption` is used +* `example` is an optional string or array of strings with example(s) for the option - these will be displayed when `generateHelpForOption` is used + +#### Help Style Properties +* `aliasSeparator` is an optional string, separates multiple names from each other - default: ' ,' +* `typeSeparator` is an optional string, separates the type from the names - default: ' ' +* `descriptionSeparator` is an optional string , separates the description from the padded name and type - default: ' ' +* `initialIndent` is an optional int - the amount of indent for options - default: 2 +* `secondaryIndent` is an optional int - the amount of indent if wrapped fully (in addition to the initial indent) - default: 4 +* `maxPadFactor` is an optional number - affects the default level of padding for the names/type, it is multiplied by the average of the length of the names/type - default: 1.5 + +## Argument Format +At the highest level there are two types of arguments: named, and positional. + +Name arguments of any length are prefixed with `--` (eg. `--go`), and those of one character may be prefixed with either `--` or `-` (eg. `-g`). + +There are two types of named arguments: boolean flags (eg. `--problemo`, `-p`) which take no value and result in a `true` if they are present, the falsey `undefined` if they are not present, or `false` if present and explicitly prefixed with `no` (eg. `--no-problemo`). Named arguments with values (eg. `--tseries 800`, `-t 800`) are the other type. If the option has a type `Boolean` it will automatically be made into a boolean flag. Any other type results in a named argument that takes a value. + +For more information about how to properly set types to get the value you want, take a look at the [type check](https://github.com/gkz/type-check) and [levn](https://github.com/gkz/levn) pages. + +You can group single character arguments that use a single `-`, however all except the last must be boolean flags (which take no value). The last may be a boolean flag, or an argument which takes a value - eg. `-ba 2` is equivalent to `-b -a 2`. + +Positional arguments are all those values which do not fall under the above - they can be anywhere, not just at the end. For example, in `cmd -b one -a 2 two` where `b` is a boolean flag, and `a` has the type `Number`, there are two positional arguments, `one` and `two`. + +Everything after an `--` is positional, even if it looks like a named argument. + +You may optionally use `=` to separate option names from values, for example: `--count=2`. + +If you specify the option `NUM`, then any argument using a single `-` followed by a number will be valid and will set the value of `NUM`. Eg. `-2` will be parsed into `NUM: 2`. + +If duplicate named arguments are present, the last one will be taken. + +## Technical About +`optionator` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It uses [levn](https://github.com/gkz/levn) to cast arguments to their specified type, and uses [type-check](https://github.com/gkz/type-check) to validate values. It also uses the [prelude.ls](http://preludels.com/) library. diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/coerce.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/coerce.js new file mode 100644 index 00000000..6fb60aa8 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/coerce.js @@ -0,0 +1,367 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var ref$, id, reject, parsedTypeCheck, types, tokenRegex, toString$ = {}.toString; + ref$ = require('prelude-ls'), id = ref$.id, reject = ref$.reject; + parsedTypeCheck = require('type-check').parsedTypeCheck; + types = { + '*': function(it){ + switch (toString$.call(it).slice(8, -1)) { + case 'Array': + return coerceType(it, { + type: 'Array' + }); + case 'Object': + return coerceType(it, { + type: 'Object' + }); + default: + return { + type: 'Just', + value: coerceTypes(it, [ + { + type: 'Undefined' + }, { + type: 'Null' + }, { + type: 'Boolean' + }, { + type: 'Number' + }, { + type: 'Date' + }, { + type: 'RegExp' + }, { + type: 'Array' + }, { + type: 'Object' + }, { + type: 'String' + } + ], { + explicit: true + }) + }; + } + }, + Undefined: function(it){ + if (it === 'undefined') { + return { + type: 'Just', + value: void 8 + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Null: function(it){ + if (it === 'null') { + return { + type: 'Just', + value: null + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Boolean: function(it){ + if (it === 'true') { + return { + type: 'Just', + value: true + }; + } else if (it === 'false') { + return { + type: 'Just', + value: false + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Number: function(it){ + return { + type: 'Just', + value: +it + }; + }, + Int: function(it){ + return { + type: 'Just', + value: parseInt(it) + }; + }, + Float: function(it){ + return { + type: 'Just', + value: parseFloat(it) + }; + }, + Date: function(value, options){ + var that; + if (that = /^\#(.*)\#$/.exec(value)) { + return { + type: 'Just', + value: new Date(+that[1] || that[1]) + }; + } else if (options.explicit) { + return { + type: 'Nothing' + }; + } else { + return { + type: 'Just', + value: new Date(+value || value) + }; + } + }, + RegExp: function(value, options){ + var that; + if (that = /^\/(.*)\/([gimy]*)$/.exec(value)) { + return { + type: 'Just', + value: new RegExp(that[1], that[2]) + }; + } else if (options.explicit) { + return { + type: 'Nothing' + }; + } else { + return { + type: 'Just', + value: new RegExp(value) + }; + } + }, + Array: function(it){ + return coerceArray(it, { + of: [{ + type: '*' + }] + }); + }, + Object: function(it){ + return coerceFields(it, { + of: {} + }); + }, + String: function(it){ + var that; + if (that = it.match(/^'(.*)'$/)) { + return { + type: 'Just', + value: that[1] + }; + } else if (that = it.match(/^"(.*)"$/)) { + return { + type: 'Just', + value: that[1] + }; + } else { + return { + type: 'Just', + value: it + }; + } + } + }; + function coerceArray(node, type){ + var typeOf, element; + if (toString$.call(node).slice(8, -1) !== 'Array') { + return { + type: 'Nothing' + }; + } + typeOf = type.of; + return { + type: 'Just', + value: (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = node).length; i$ < len$; ++i$) { + element = ref$[i$]; + results$.push(coerceTypes(element, typeOf)); + } + return results$; + }()) + }; + } + function coerceTuple(node, type){ + var i, types; + if (toString$.call(node).slice(8, -1) !== 'Array') { + return { + type: 'Nothing' + }; + } + return { + type: 'Just', + value: (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) { + i = i$; + types = ref$[i$]; + results$.push(coerceTypes(node[i], types)); + } + return results$; + }()) + }; + } + function coerceFields(node, type){ + var typeOf, key, value; + if (toString$.call(node).slice(8, -1) !== 'Object') { + return { + type: 'Nothing' + }; + } + typeOf = type.of; + return { + type: 'Just', + value: (function(){ + var ref$, results$ = {}; + for (key in ref$ = node) { + value = ref$[key]; + results$[key] = coerceTypes(value, typeOf[key] || [{ + type: '*' + }]); + } + return results$; + }()) + }; + } + function coerceType(node, typeObj, options){ + var type, structure, coerceFunc; + type = typeObj.type, structure = typeObj.structure; + if (type) { + coerceFunc = types[type]; + return coerceFunc(node, options); + } else { + switch (structure) { + case 'array': + return coerceArray(node, typeObj); + case 'tuple': + return coerceTuple(node, typeObj); + case 'fields': + return coerceFields(node, typeObj); + } + } + } + function coerceTypes(node, types, options){ + var i$, len$, type, ref$, valueType, value; + options == null && (options = {}); + for (i$ = 0, len$ = types.length; i$ < len$; ++i$) { + type = types[i$]; + ref$ = coerceType(node, type, options), valueType = ref$.type, value = ref$.value; + if (valueType === 'Nothing') { + continue; + } + if (parsedTypeCheck([type], value)) { + return value; + } + } + throw new Error("Value '" + node + "' does not type check against " + JSON.stringify(types) + "."); + } + function consumeOp(tokens, op){ + if (tokens[0] === op) { + return tokens.shift(); + } else { + throw new Error("Expected '" + op + "', but got " + tokens[0] + " instead."); + } + } + function maybeConsumeOp(tokens, op){ + if (tokens[0] === op) { + return tokens.shift(); + } + } + function consumeList(tokens, delimiters, hasDelimiters){ + var result; + if (hasDelimiters) { + consumeOp(tokens, delimiters[0]); + } + result = []; + while (tokens.length && tokens[0] !== delimiters[1]) { + result.push(consumeElement(tokens)); + maybeConsumeOp(tokens, ','); + } + if (hasDelimiters) { + consumeOp(tokens, delimiters[1]); + } + return result; + } + function consumeArray(tokens, hasDelimiters){ + return consumeList(tokens, ['[', ']'], hasDelimiters); + } + function consumeTuple(tokens, hasDelimiters){ + return consumeList(tokens, ['(', ')'], hasDelimiters); + } + function consumeFields(tokens, hasDelimiters){ + var result, key; + if (hasDelimiters) { + consumeOp(tokens, '{'); + } + result = {}; + while (tokens.length && (!hasDelimiters || tokens[0] !== '}')) { + key = tokens.shift(); + consumeOp(tokens, ':'); + result[key] = consumeElement(tokens); + maybeConsumeOp(tokens, ','); + } + if (hasDelimiters) { + consumeOp(tokens, '}'); + } + return result; + } + function consumeElement(tokens){ + switch (tokens[0]) { + case '[': + return consumeArray(tokens, true); + case '(': + return consumeTuple(tokens, true); + case '{': + return consumeFields(tokens, true); + default: + return tokens.shift(); + } + } + function consumeTopLevel(tokens, types){ + var structure, origTokens, result; + structure = types[0].structure; + if (types.length === 1 && structure) { + origTokens = tokens.slice(); + result = structure === 'array' + ? consumeArray(tokens, tokens[0] === '[') + : structure === 'tuple' + ? consumeTuple(tokens, tokens[0] === '(') + : consumeFields(tokens, tokens[0] === '{'); + if (tokens.length) { + return consumeElement(structure === 'array' + ? ['['].concat(origTokens, [']']) + : ['('].concat(origTokens, [')'])); + } else { + return result; + } + } else { + return consumeElement(tokens); + } + } + tokenRegex = /("(?:[^"]|\\")*")|('(?:[^']|\\')*')|(#.*#)|(\/(?:\\\/|[^\/])*\/[gimy]*)|([\[\]\(\)}{:,])|([-\.\$\w]+)|\s*/; + function coerce(types, string){ + var tokens, node; + tokens = reject(function(it){ + return !it || /^\s+$/.test(it); + }, string.split(tokenRegex)); + node = consumeTopLevel(tokens, types); + if (!node) { + throw new Error("Error parsing " + string); + } + return coerceTypes(node, types); + } + module.exports = coerce; + /* + function log + console.log it; it + */ +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/help.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/help.js new file mode 100644 index 00000000..26afec2d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/help.js @@ -0,0 +1,242 @@ +// Generated by LiveScript 1.3.1 +(function(){ + var ref$, id, find, sort, min, max, map, unlines, nameToRaw, dasherize, wordwrap, getPreText, setHelpStyleDefaults, generateHelpForOption, generateHelp; + ref$ = require('prelude-ls'), id = ref$.id, find = ref$.find, sort = ref$.sort, min = ref$.min, max = ref$.max, map = ref$.map, unlines = ref$.unlines; + ref$ = require('./util'), nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize; + wordwrap = require('wordwrap'); + getPreText = function(option, arg$, maxWidth){ + var mainName, shortNames, ref$, longNames, type, description, aliasSeparator, typeSeparator, initialIndent, names, namesString, namesStringLen, typeSeparatorString, typeSeparatorStringLen, typeString, that, wrap; + mainName = option.option, shortNames = (ref$ = option.shortNames) != null + ? ref$ + : [], longNames = (ref$ = option.longNames) != null + ? ref$ + : [], type = option.type, description = option.description; + aliasSeparator = arg$.aliasSeparator, typeSeparator = arg$.typeSeparator, initialIndent = arg$.initialIndent; + if (option.negateName) { + mainName = "no-" + mainName; + if (longNames) { + longNames = map(function(it){ + return "no-" + it; + }, longNames); + } + } + names = mainName.length === 1 + ? [mainName].concat(shortNames, longNames) + : shortNames.concat([mainName], longNames); + namesString = map(nameToRaw, names).join(aliasSeparator); + namesStringLen = namesString.length; + typeSeparatorString = mainName === 'NUM' ? '::' : typeSeparator; + typeSeparatorStringLen = typeSeparatorString.length; + typeString = (that = option['enum']) ? "One of: " + that.join(', ') : type; + if (maxWidth != null && !option.boolean && initialIndent + namesStringLen + typeSeparatorStringLen + typeString.length > maxWidth) { + wrap = wordwrap(initialIndent + namesStringLen + typeSeparatorStringLen, maxWidth); + return namesString + "" + typeSeparatorString + wrap(typeString).replace(/^\s+/, ''); + } else { + return namesString + "" + (option.boolean + ? '' + : typeSeparatorString + "" + typeString); + } + }; + setHelpStyleDefaults = function(helpStyle){ + helpStyle.aliasSeparator == null && (helpStyle.aliasSeparator = ', '); + helpStyle.typeSeparator == null && (helpStyle.typeSeparator = ' '); + helpStyle.descriptionSeparator == null && (helpStyle.descriptionSeparator = ' '); + helpStyle.initialIndent == null && (helpStyle.initialIndent = 2); + helpStyle.secondaryIndent == null && (helpStyle.secondaryIndent = 4); + helpStyle.maxPadFactor == null && (helpStyle.maxPadFactor = 1.5); + }; + generateHelpForOption = function(getOption, arg$){ + var stdout, helpStyle, ref$; + stdout = arg$.stdout, helpStyle = (ref$ = arg$.helpStyle) != null + ? ref$ + : {}; + setHelpStyleDefaults(helpStyle); + return function(optionName){ + var maxWidth, wrap, option, e, pre, defaultString, restPositionalString, description, fullDescription, that, preDescription, descriptionString, exampleString, examples, seperator; + maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null; + wrap = maxWidth ? wordwrap(maxWidth) : id; + try { + option = getOption(dasherize(optionName)); + } catch (e$) { + e = e$; + return e.message; + } + pre = getPreText(option, helpStyle); + defaultString = option['default'] && !option.negateName ? "\ndefault: " + option['default'] : ''; + restPositionalString = option.restPositional ? 'Everything after this option is considered a positional argument, even if it looks like an option.' : ''; + description = option.longDescription || option.description && sentencize(option.description); + fullDescription = description && restPositionalString + ? description + " " + restPositionalString + : (that = description || restPositionalString) ? that : ''; + preDescription = 'description:'; + descriptionString = !fullDescription + ? '' + : maxWidth && fullDescription.length - 1 - preDescription.length > maxWidth + ? "\n" + preDescription + "\n" + wrap(fullDescription) + : "\n" + preDescription + " " + fullDescription; + exampleString = (that = option.example) ? (examples = [].concat(that), examples.length > 1 + ? "\nexamples:\n" + unlines(examples) + : "\nexample: " + examples[0]) : ''; + seperator = defaultString || descriptionString || exampleString ? "\n" + repeatString$('=', pre.length) : ''; + return pre + "" + seperator + defaultString + descriptionString + exampleString; + }; + }; + generateHelp = function(arg$){ + var options, prepend, append, helpStyle, ref$, stdout, aliasSeparator, typeSeparator, descriptionSeparator, maxPadFactor, initialIndent, secondaryIndent; + options = arg$.options, prepend = arg$.prepend, append = arg$.append, helpStyle = (ref$ = arg$.helpStyle) != null + ? ref$ + : {}, stdout = arg$.stdout; + setHelpStyleDefaults(helpStyle); + aliasSeparator = helpStyle.aliasSeparator, typeSeparator = helpStyle.typeSeparator, descriptionSeparator = helpStyle.descriptionSeparator, maxPadFactor = helpStyle.maxPadFactor, initialIndent = helpStyle.initialIndent, secondaryIndent = helpStyle.secondaryIndent; + return function(arg$){ + var ref$, showHidden, interpolate, maxWidth, output, out, data, optionCount, totalPreLen, preLens, i$, len$, item, that, pre, desc, preLen, sortedPreLens, maxPreLen, preLenMean, x, padAmount, descSepLen, fullWrapCount, partialWrapCount, descLen, totalLen, initialSpace, wrapAllFull, i, wrap; + ref$ = arg$ != null + ? arg$ + : {}, showHidden = ref$.showHidden, interpolate = ref$.interpolate; + maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null; + output = []; + out = function(it){ + return output.push(it != null ? it : ''); + }; + if (prepend) { + out(interpolate ? interp(prepend, interpolate) : prepend); + out(); + } + data = []; + optionCount = 0; + totalPreLen = 0; + preLens = []; + for (i$ = 0, len$ = (ref$ = options).length; i$ < len$; ++i$) { + item = ref$[i$]; + if (showHidden || !item.hidden) { + if (that = item.heading) { + data.push({ + type: 'heading', + value: that + }); + } else { + pre = getPreText(item, helpStyle, maxWidth); + desc = item['default'] && !item.negateName + ? (that = item.description) != null + ? that + " - default: " + item['default'] + : "default: " + item['default'] + : (that = item.description) != null ? that : ''; + data.push({ + type: 'option', + pre: pre, + desc: desc, + descLen: desc.length + }); + preLen = pre.length; + optionCount++; + totalPreLen += preLen; + preLens.push(preLen); + } + } + } + sortedPreLens = sort(preLens); + maxPreLen = sortedPreLens[sortedPreLens.length - 1]; + preLenMean = initialIndent + totalPreLen / optionCount; + x = optionCount > 2 ? min(preLenMean * maxPadFactor, maxPreLen) : maxPreLen; + for (i$ = sortedPreLens.length - 1; i$ >= 0; --i$) { + preLen = sortedPreLens[i$]; + if (preLen <= x) { + padAmount = preLen; + break; + } + } + descSepLen = descriptionSeparator.length; + if (maxWidth != null) { + fullWrapCount = 0; + partialWrapCount = 0; + for (i$ = 0, len$ = data.length; i$ < len$; ++i$) { + item = data[i$]; + if (item.type === 'option') { + pre = item.pre, desc = item.desc, descLen = item.descLen; + if (descLen === 0) { + item.wrap = 'none'; + } else { + preLen = max(padAmount, pre.length) + initialIndent + descSepLen; + totalLen = preLen + descLen; + if (totalLen > maxWidth) { + if (descLen / 2.5 > maxWidth - preLen) { + fullWrapCount++; + item.wrap = 'full'; + } else { + partialWrapCount++; + item.wrap = 'partial'; + } + } else { + item.wrap = 'none'; + } + } + } + } + } + initialSpace = repeatString$(' ', initialIndent); + wrapAllFull = optionCount > 1 && fullWrapCount + partialWrapCount * 0.5 > optionCount * 0.5; + for (i$ = 0, len$ = data.length; i$ < len$; ++i$) { + i = i$; + item = data[i$]; + if (item.type === 'heading') { + if (i !== 0) { + out(); + } + out(item.value + ":"); + } else { + pre = item.pre, desc = item.desc, descLen = item.descLen, wrap = item.wrap; + if (maxWidth != null) { + if (wrapAllFull || wrap === 'full') { + wrap = wordwrap(initialIndent + secondaryIndent, maxWidth); + out(initialSpace + "" + pre + "\n" + wrap(desc)); + continue; + } else if (wrap === 'partial') { + wrap = wordwrap(initialIndent + descSepLen + max(padAmount, pre.length), maxWidth); + out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + wrap(desc).replace(/^\s+/, '')); + continue; + } + } + if (descLen === 0) { + out(initialSpace + "" + pre); + } else { + out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + desc); + } + } + } + if (append) { + out(); + out(interpolate ? interp(append, interpolate) : append); + } + return unlines(output); + }; + }; + function pad(str, num){ + var len, padAmount; + len = str.length; + padAmount = num - len; + return str + "" + repeatString$(' ', padAmount > 0 ? padAmount : 0); + } + function sentencize(str){ + var first, rest, period; + first = str.charAt(0).toUpperCase(); + rest = str.slice(1); + period = /[\.!\?]$/.test(str) ? '' : '.'; + return first + "" + rest + period; + } + function interp(string, object){ + return string.replace(/{{([a-zA-Z$_][a-zA-Z$_0-9]*)}}/g, function(arg$, key){ + var ref$; + return (ref$ = object[key]) != null + ? ref$ + : "{{" + key + "}}"; + }); + } + module.exports = { + generateHelp: generateHelp, + generateHelpForOption: generateHelpForOption + }; + function repeatString$(str, n){ + for (var r = ''; n > 0; (n >>= 1) && (str += str)) if (n & 1) r += str; + return r; + } +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/index.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/index.js new file mode 100644 index 00000000..f9ae9a56 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/index.js @@ -0,0 +1,417 @@ +// Generated by LiveScript 1.3.1 +(function(){ + var VERSION, ref$, id, map, compact, any, groupBy, partition, chars, isItNaN, keys, Obj, camelize, deepIs, closestString, nameToRaw, dasherize, generateHelp, generateHelpForOption, parsedTypeCheck, parseType, parseLevn, camelizeKeys, parseString, main, toString$ = {}.toString, slice$ = [].slice; + VERSION = '0.5.0'; + ref$ = require('prelude-ls'), id = ref$.id, map = ref$.map, compact = ref$.compact, any = ref$.any, groupBy = ref$.groupBy, partition = ref$.partition, chars = ref$.chars, isItNaN = ref$.isItNaN, keys = ref$.keys, Obj = ref$.Obj, camelize = ref$.camelize; + deepIs = require('deep-is'); + ref$ = require('./util'), closestString = ref$.closestString, nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize; + ref$ = require('./help'), generateHelp = ref$.generateHelp, generateHelpForOption = ref$.generateHelpForOption; + ref$ = require('type-check'), parsedTypeCheck = ref$.parsedTypeCheck, parseType = ref$.parseType; + parseLevn = require('levn').parsedTypeParse; + camelizeKeys = function(obj){ + var key, value, resultObj$ = {}; + for (key in obj) { + value = obj[key]; + resultObj$[camelize(key)] = value; + } + return resultObj$; + }; + parseString = function(string){ + var assignOpt, regex, replaceRegex, result; + assignOpt = '--?[a-zA-Z][-a-z-A-Z0-9]*='; + regex = RegExp('(?:' + assignOpt + ')?(?:\'(?:\\\\\'|[^\'])+\'|"(?:\\\\"|[^"])+")|[^\'"\\s]+', 'g'); + replaceRegex = RegExp('^(' + assignOpt + ')?[\'"]([\\s\\S]*)[\'"]$'); + result = map(function(it){ + return it.replace(replaceRegex, '$1$2'); + }, string.match(regex) || []); + return result; + }; + main = function(libOptions){ + var opts, defaults, required, traverse, getOption, parse; + opts = {}; + defaults = {}; + required = []; + if (toString$.call(libOptions.stdout).slice(8, -1) === 'Undefined') { + libOptions.stdout = process.stdout; + } + traverse = function(options){ + var i$, len$, option, name, e, parsedPossibilities, parsedType, j$, ref$, len1$, possibility, that, rawDependsType, dependsOpts, dependsType, alias, shortNames, longNames; + if (toString$.call(options).slice(8, -1) !== 'Array') { + throw new Error('No options defined.'); + } + for (i$ = 0, len$ = options.length; i$ < len$; ++i$) { + option = options[i$]; + if (option.heading == null) { + name = option.option; + if (opts[name] != null) { + throw new Error("Option '" + name + "' already defined."); + } + if (option.type === 'Boolean') { + option.boolean == null && (option.boolean = true); + } + if (option.parsedType == null) { + if (!option.type) { + throw new Error("No type defined for option '" + name + "'."); + } + try { + option.parsedType = parseType(option.type); + } catch (e$) { + e = e$; + throw new Error("Option '" + name + "': Error parsing type '" + option.type + "': " + e.message); + } + } + if (option['default']) { + try { + defaults[name] = parseLevn(option.parsedType, option['default']); + } catch (e$) { + e = e$; + throw new Error("Option '" + name + "': Error parsing default value '" + option['default'] + "' for type '" + option.type + "': " + e.message); + } + } + if (option['enum'] && !option.parsedPossiblities) { + parsedPossibilities = []; + parsedType = option.parsedType; + for (j$ = 0, len1$ = (ref$ = option['enum']).length; j$ < len1$; ++j$) { + possibility = ref$[j$]; + try { + parsedPossibilities.push(parseLevn(parsedType, possibility)); + } catch (e$) { + e = e$; + throw new Error("Option '" + name + "': Error parsing enum value '" + possibility + "' for type '" + option.type + "': " + e.message); + } + } + option.parsedPossibilities = parsedPossibilities; + } + if (that = option.dependsOn) { + if (that.length) { + ref$ = [].concat(option.dependsOn), rawDependsType = ref$[0], dependsOpts = slice$.call(ref$, 1); + dependsType = rawDependsType.toLowerCase(); + if (dependsOpts.length) { + if (dependsType === 'and' || dependsType === 'or') { + option.dependsOn = [dependsType].concat(slice$.call(dependsOpts)); + } else { + throw new Error("Option '" + name + "': If you have more than one dependency, you must specify either 'and' or 'or'"); + } + } else { + if ((ref$ = dependsType.toLowerCase()) === 'and' || ref$ === 'or') { + option.dependsOn = null; + } else { + option.dependsOn = ['and', rawDependsType]; + } + } + } else { + option.dependsOn = null; + } + } + if (option.required) { + required.push(name); + } + opts[name] = option; + if (option.alias || option.aliases) { + if (name === 'NUM') { + throw new Error("-NUM option can't have aliases."); + } + if (option.alias) { + option.aliases == null && (option.aliases = [].concat(option.alias)); + } + for (j$ = 0, len1$ = (ref$ = option.aliases).length; j$ < len1$; ++j$) { + alias = ref$[j$]; + if (opts[alias] != null) { + throw new Error("Option '" + alias + "' already defined."); + } + opts[alias] = option; + } + ref$ = partition(fn$, option.aliases), shortNames = ref$[0], longNames = ref$[1]; + option.shortNames == null && (option.shortNames = shortNames); + option.longNames == null && (option.longNames = longNames); + } + if ((!option.aliases || option.shortNames.length === 0) && option.type === 'Boolean' && option['default'] === 'true') { + option.negateName = true; + } + } + } + function fn$(it){ + return it.length === 1; + } + }; + traverse(libOptions.options); + getOption = function(name){ + var opt, possiblyMeant; + opt = opts[name]; + if (opt == null) { + possiblyMeant = closestString(keys(opts), name); + throw new Error("Invalid option '" + nameToRaw(name) + "'" + (possiblyMeant ? " - perhaps you meant '" + nameToRaw(possiblyMeant) + "'?" : '.')); + } + return opt; + }; + parse = function(input, arg$){ + var slice, obj, positional, restPositional, overrideRequired, prop, setValue, setDefaults, checkRequired, mutuallyExclusiveError, checkMutuallyExclusive, checkDependency, checkDependencies, args, key, value, option, ref$, i$, len$, arg, that, result, short, argName, usingAssign, val, flags, len, j$, len1$, i, flag, opt, name, negated, noedName, valPrime; + slice = (arg$ != null + ? arg$ + : {}).slice; + obj = {}; + positional = []; + restPositional = false; + overrideRequired = false; + prop = null; + setValue = function(name, value){ + var opt, val, e, currentType; + opt = getOption(name); + if (opt.boolean) { + val = value; + } else { + try { + val = parseLevn(opt.parsedType, value); + } catch (e$) { + e = e$; + throw new Error("Invalid value for option '" + name + "' - expected type " + opt.type + ", received value: " + value + "."); + } + if (opt['enum'] && !any(function(it){ + return deepIs(it, val); + }, opt.parsedPossibilities)) { + throw new Error("Option " + name + ": '" + val + "' not in [" + opt['enum'].join(', ') + "]."); + } + } + currentType = toString$.call(obj[name]).slice(8, -1); + if (obj[name] != null) { + if (libOptions.concatRepeatedArrays && currentType === 'Array') { + obj[name] = obj[name].concat(val); + } else if (libOptions.mergeRepeatedObjects && currentType === 'Object') { + import$(obj[name], val); + } else { + obj[name] = val; + } + } else { + obj[name] = val; + } + if (opt.restPositional) { + restPositional = true; + } + if (opt.overrideRequired) { + overrideRequired = true; + } + }; + setDefaults = function(){ + var name, ref$, value; + for (name in ref$ = defaults) { + value = ref$[name]; + if (obj[name] == null) { + obj[name] = value; + } + } + }; + checkRequired = function(){ + var i$, ref$, len$, name; + if (overrideRequired) { + return; + } + for (i$ = 0, len$ = (ref$ = required).length; i$ < len$; ++i$) { + name = ref$[i$]; + if (!obj[name]) { + throw new Error("Option " + nameToRaw(name) + " is required."); + } + } + }; + mutuallyExclusiveError = function(first, second){ + throw new Error("The options " + nameToRaw(first) + " and " + nameToRaw(second) + " are mutually exclusive - you cannot use them at the same time."); + }; + checkMutuallyExclusive = function(){ + var rules, i$, len$, rule, present, j$, len1$, element, k$, len2$, opt; + rules = libOptions.mutuallyExclusive; + if (!rules) { + return; + } + for (i$ = 0, len$ = rules.length; i$ < len$; ++i$) { + rule = rules[i$]; + present = null; + for (j$ = 0, len1$ = rule.length; j$ < len1$; ++j$) { + element = rule[j$]; + if (toString$.call(element).slice(8, -1) === 'Array') { + for (k$ = 0, len2$ = element.length; k$ < len2$; ++k$) { + opt = element[k$]; + if (opt in obj) { + if (present != null) { + mutuallyExclusiveError(present, opt); + } else { + present = opt; + break; + } + } + } + } else { + if (element in obj) { + if (present != null) { + mutuallyExclusiveError(present, element); + } else { + present = element; + } + } + } + } + } + }; + checkDependency = function(option){ + var dependsOn, type, targetOptionNames, i$, len$, targetOptionName, targetOption; + dependsOn = option.dependsOn; + if (!dependsOn || option.dependenciesMet) { + return true; + } + type = dependsOn[0], targetOptionNames = slice$.call(dependsOn, 1); + for (i$ = 0, len$ = targetOptionNames.length; i$ < len$; ++i$) { + targetOptionName = targetOptionNames[i$]; + targetOption = obj[targetOptionName]; + if (targetOption && checkDependency(targetOption)) { + if (type === 'or') { + return true; + } + } else if (type === 'and') { + throw new Error("The option '" + option.option + "' did not have its dependencies met."); + } + } + if (type === 'and') { + return true; + } else { + throw new Error("The option '" + option.option + "' did not meet any of its dependencies."); + } + }; + checkDependencies = function(){ + var name; + for (name in obj) { + checkDependency(opts[name]); + } + }; + switch (toString$.call(input).slice(8, -1)) { + case 'String': + args = parseString(input.slice(slice != null ? slice : 0)); + break; + case 'Array': + args = input.slice(slice != null ? slice : 2); + break; + case 'Object': + obj = {}; + for (key in input) { + value = input[key]; + if (key !== '_') { + option = getOption(dasherize(key)); + if (parsedTypeCheck(option.parsedType, value)) { + obj[option.option] = value; + } else { + throw new Error("Option '" + option.option + "': Invalid type for '" + value + "' - expected type '" + option.type + "'."); + } + } + } + checkMutuallyExclusive(); + checkDependencies(); + setDefaults(); + checkRequired(); + return ref$ = camelizeKeys(obj), ref$._ = input._ || [], ref$; + default: + throw new Error("Invalid argument to 'parse': " + input + "."); + } + for (i$ = 0, len$ = args.length; i$ < len$; ++i$) { + arg = args[i$]; + if (arg === '--') { + restPositional = true; + } else if (restPositional) { + positional.push(arg); + } else { + if (that = arg.match(/^(--?)([a-zA-Z][-a-zA-Z0-9]*)(=)?(.*)?$/)) { + result = that; + if (prop) { + throw new Error("Value for '" + prop + "' of type '" + getOption(prop).type + "' required."); + } + short = result[1].length === 1; + argName = result[2]; + usingAssign = result[3] != null; + val = result[4]; + if (usingAssign && val == null) { + throw new Error("No value for '" + argName + "' specified."); + } + if (short) { + flags = chars(argName); + len = flags.length; + for (j$ = 0, len1$ = flags.length; j$ < len1$; ++j$) { + i = j$; + flag = flags[j$]; + opt = getOption(flag); + name = opt.option; + if (restPositional) { + positional.push(flag); + } else if (opt.boolean) { + setValue(name, true); + } else if (i === len - 1) { + if (usingAssign) { + setValue(name, val); + } else { + prop = name; + } + } else { + throw new Error("Can't set argument '" + flag + "' when not last flag in a group of short flags."); + } + } + } else { + negated = false; + if (that = argName.match(/^no-(.+)$/)) { + negated = true; + noedName = that[1]; + opt = getOption(noedName); + } else { + opt = getOption(argName); + } + name = opt.option; + if (opt.boolean) { + valPrime = usingAssign ? parseLevn([{ + type: 'Boolean' + }], val) : true; + if (negated) { + setValue(name, !valPrime); + } else { + setValue(name, valPrime); + } + } else { + if (negated) { + throw new Error("Only use 'no-' prefix for Boolean options, not with '" + noedName + "'."); + } + if (usingAssign) { + setValue(name, val); + } else { + prop = name; + } + } + } + } else if (that = arg.match(/^-([0-9]+(?:\.[0-9]+)?)$/)) { + opt = opts.NUM; + if (!opt) { + throw new Error('No -NUM option defined.'); + } + setValue(opt.option, that[1]); + } else { + if (prop) { + setValue(prop, arg); + prop = null; + } else { + positional.push(arg); + } + } + } + } + checkMutuallyExclusive(); + checkDependencies(); + setDefaults(); + checkRequired(); + return ref$ = camelizeKeys(obj), ref$._ = positional, ref$; + }; + return { + parse: parse, + generateHelp: generateHelp(libOptions), + generateHelpForOption: generateHelpForOption(getOption, libOptions) + }; + }; + main.VERSION = VERSION; + module.exports = main; + function import$(obj, src){ + var own = {}.hasOwnProperty; + for (var key in src) if (own.call(src, key)) obj[key] = src[key]; + return obj; + } +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/parse-type.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/parse-type.js new file mode 100644 index 00000000..e648723c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/parse-type.js @@ -0,0 +1,143 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var reject, tokenRegex; + reject = require('prelude-ls').reject; + function consumeWord(tokens){ + var token; + token = tokens[0]; + if (!(token != null && /^[a-zA-Z]+$/.test(token))) { + throw new Error("Exected textual string."); + } + return tokens.shift(); + } + function consumeOp(tokens, op){ + var token; + token = tokens[0]; + if (token !== op) { + throw new Error("Expected " + op); + } + return tokens.shift(); + } + function maybeConsumeOp(tokens, op){ + var token; + token = tokens[0]; + if (token === op) { + return tokens.shift(); + } else { + return null; + } + } + function consumeArray(tokens){ + var contentType; + consumeOp(tokens, '['); + contentType = consumeTypes(tokens); + if (!contentType) { + throw new Error("Must specify content type for Array."); + } + consumeOp(tokens, ']'); + return { + type: 'Array', + contentType: contentType + }; + } + function consumeTuple(tokens){ + var contentTypes, that; + contentTypes = []; + consumeOp(tokens, '('); + while (that = consumeTypes(tokens)) { + contentTypes.push(that); + if (!maybeConsumeOp(tokens, ',')) { + break; + } + } + consumeOp(tokens, ')'); + return { + type: 'Tuple', + contentTypes: contentTypes + }; + } + function consumeProperty(tokens){ + var key, type; + key = consumeWord(tokens); + consumeOp(tokens, ':'); + type = consumeTypes(tokens); + return { + key: key, + type: type + }; + } + function consumeObject(tokens){ + var properties, that; + properties = []; + consumeOp(tokens, '{'); + while (that = consumeProperty(tokens)) { + properties.push(that); + if (!maybeConsumeOp(tokens, ',')) { + break; + } + } + consumeOp(tokens, '}'); + return { + type: 'Object', + properties: properties + }; + } + function consumeType(tokens){ + switch (tokens[0]) { + case '[': + return consumeArray(tokens); + case '{': + return consumeObject(tokens); + case '(': + return consumeTuple(tokens); + default: + return { + type: consumeWord(tokens) + }; + } + } + function consumeMaybe(tokens){ + var maybe, type; + if (tokens[0] === 'Maybe') { + tokens.shift(); + maybe = true; + } + type = consumeType(tokens); + if (maybe) { + return { + type: 'Maybe', + contentType: type + }; + } else { + return type; + } + } + function consumeTypes(tokens){ + var types; + types = []; + for (;;) { + types.push(consumeMaybe(tokens)); + if (!maybeConsumeOp('|')) { + break; + } + } + if (!types.length) { + throw new Error("Expected type(s)."); + } + return types; + } + tokenRegex = /[:,\[\]\(\)}{]|[a-zA-Z]+/g; + module.exports = function(input){ + var tokens, e; + tokens = reject(function(it){ + return /^\s*$/.test(it); + })( + input.match(tokenRegex)); + try { + return consumeTypes(tokens); + } catch (e$) { + e = e$; + throw new Error(e.message + " - '" + tokens.join('#') + "' - '" + input + "'"); + } + }; +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/util.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/util.js new file mode 100644 index 00000000..480ba955 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/lib/util.js @@ -0,0 +1,46 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var prelude, map, sortBy, fl, closestString, nameToRaw, dasherize; + prelude = require('prelude-ls'), map = prelude.map, sortBy = prelude.sortBy; + fl = require('fast-levenshtein'); + closestString = function(possibilities, input){ + var distances, ref$, string, distance; + if (!possibilities.length) { + return; + } + distances = map(function(it){ + var ref$, longer, shorter; + ref$ = input.length > it.length + ? [input, it] + : [it, input], longer = ref$[0], shorter = ref$[1]; + return { + string: it, + distance: fl.get(longer, shorter) + }; + })( + possibilities); + ref$ = sortBy(function(it){ + return it.distance; + }, distances)[0], string = ref$.string, distance = ref$.distance; + return string; + }; + nameToRaw = function(name){ + if (name.length === 1 || name === 'NUM') { + return "-" + name; + } else { + return "--" + name; + } + }; + dasherize = function(string){ + if (/^[A-Z]/.test(string)) { + return string; + } else { + return prelude.dasherize(string); + } + }; + module.exports = { + closestString: closestString, + nameToRaw: nameToRaw, + dasherize: dasherize + }; +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/.travis.yml new file mode 100644 index 00000000..d523c5f5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - 0.4 + - 0.6 + - 0.8 + - 0.10 diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/LICENSE new file mode 100644 index 00000000..c38f8407 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2012, 2013 Thorsten Lorenz +Copyright (c) 2012 James Halliday +Copyright (c) 2009 Thomas Robinson <280north.com> + +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/README.markdown b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/README.markdown new file mode 100644 index 00000000..eb69a83b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/README.markdown @@ -0,0 +1,70 @@ +deep-is +========== + +Node's `assert.deepEqual() algorithm` as a standalone module. Exactly like +[deep-equal](https://github.com/substack/node-deep-equal) except for the fact that `deepEqual(NaN, NaN) === true`. + +This module is around [5 times faster](https://gist.github.com/2790507) +than wrapping `assert.deepEqual()` in a `try/catch`. + +[![browser support](http://ci.testling.com/thlorenz/deep-is.png)](http://ci.testling.com/thlorenz/deep-is) + +[![build status](https://secure.travis-ci.org/thlorenz/deep-is.png)](http://travis-ci.org/thlorenz/deep-is) + +example +======= + +``` js +var equal = require('deep-is'); +console.dir([ + equal( + { a : [ 2, 3 ], b : [ 4 ] }, + { a : [ 2, 3 ], b : [ 4 ] } + ), + equal( + { x : 5, y : [6] }, + { x : 5, y : 6 } + ) +]); +``` + +methods +======= + +var deepIs = require('deep-is') + +deepIs(a, b) +--------------- + +Compare objects `a` and `b`, returning whether they are equal according to a +recursive equality algorithm. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install deep-is +``` + +test +==== + +With [npm](http://npmjs.org) do: + +``` +npm test +``` + +license +======= + +Copyright (c) 2012, 2013 Thorsten Lorenz +Copyright (c) 2012 James Halliday + +Derived largely from node's assert module, which has the copyright statement: + +Copyright (c) 2009 Thomas Robinson <280north.com> + +Released under the MIT license, see LICENSE for details. diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/example/cmp.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/example/cmp.js new file mode 100644 index 00000000..67014b88 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/example/cmp.js @@ -0,0 +1,11 @@ +var equal = require('../'); +console.dir([ + equal( + { a : [ 2, 3 ], b : [ 4 ] }, + { a : [ 2, 3 ], b : [ 4 ] } + ), + equal( + { x : 5, y : [6] }, + { x : 5, y : 6 } + ) +]); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/index.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/index.js new file mode 100644 index 00000000..506fe279 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/index.js @@ -0,0 +1,102 @@ +var pSlice = Array.prototype.slice; +var Object_keys = typeof Object.keys === 'function' + ? Object.keys + : function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; + } +; + +var deepEqual = module.exports = function (actual, expected) { + // enforce Object.is +0 !== -0 + if (actual === 0 && expected === 0) { + return areZerosEqual(actual, expected); + + // 7.1. All identical values are equivalent, as determined by ===. + } else if (actual === expected) { + return true; + + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + } else if (isNumberNaN(actual)) { + return isNumberNaN(expected); + + // 7.3. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected); + } +}; + +function isUndefinedOrNull(value) { + return value === null || value === undefined; +} + +function isArguments(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +} + +function isNumberNaN(value) { + // NaN === NaN -> false + return typeof value == 'number' && value !== value; +} + +function areZerosEqual(zeroA, zeroB) { + // (1 / +0|0) -> Infinity, but (1 / -0) -> -Infinity and (Infinity !== -Infinity) + return (1 / zeroA) === (1 / zeroB); +} + +function objEquiv(a, b) { + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + + // an identical 'prototype' property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return deepEqual(a, b); + } + try { + var ka = Object_keys(a), + kb = Object_keys(b), + key, i; + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!deepEqual(a[key], b[key])) return false; + } + return true; +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/package.json b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/package.json new file mode 100644 index 00000000..5b429977 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/package.json @@ -0,0 +1,86 @@ +{ + "name": "deep-is", + "version": "0.1.3", + "description": "node's assert.deepEqual algorithm except for NaN being equal to NaN", + "main": "index.js", + "directories": { + "lib": ".", + "example": "example", + "test": "test" + }, + "scripts": { + "test": "tape test/*.js" + }, + "devDependencies": { + "tape": "~1.0.2" + }, + "repository": { + "type": "git", + "url": "http://github.com/thlorenz/deep-is.git" + }, + "keywords": [ + "equality", + "equal", + "compare" + ], + "author": { + "name": "Thorsten Lorenz", + "email": "thlorenz@gmx.de", + "url": "http://thlorenz.com" + }, + "license": { + "type": "MIT", + "url": "https://github.com/thlorenz/deep-is/blob/master/LICENSE" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "gitHead": "f126057628423458636dec9df3d621843b9ac55e", + "bugs": { + "url": "https://github.com/thlorenz/deep-is/issues" + }, + "homepage": "https://github.com/thlorenz/deep-is", + "_id": "deep-is@0.1.3", + "_shasum": "b369d6fb5dbc13eecf524f91b070feedc357cf34", + "_from": "deep-is@>=0.1.2 <0.2.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "thlorenz", + "email": "thlorenz@gmx.de" + }, + "maintainers": [ + { + "name": "thlorenz", + "email": "thlorenz@gmx.de" + } + ], + "dist": { + "shasum": "b369d6fb5dbc13eecf524f91b070feedc357cf34", + "tarball": "http://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz" + }, + "_resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/test/NaN.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/test/NaN.js new file mode 100644 index 00000000..ddaa5a77 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/test/NaN.js @@ -0,0 +1,16 @@ +var test = require('tape'); +var equal = require('../'); + +test('NaN and 0 values', function (t) { + t.ok(equal(NaN, NaN)); + t.notOk(equal(0, NaN)); + t.ok(equal(0, 0)); + t.notOk(equal(0, 1)); + t.end(); +}); + + +test('nested NaN values', function (t) { + t.ok(equal([ NaN, 1, NaN ], [ NaN, 1, NaN ])); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/test/cmp.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/test/cmp.js new file mode 100644 index 00000000..30710134 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/test/cmp.js @@ -0,0 +1,23 @@ +var test = require('tape'); +var equal = require('../'); + +test('equal', function (t) { + t.ok(equal( + { a : [ 2, 3 ], b : [ 4 ] }, + { a : [ 2, 3 ], b : [ 4 ] } + )); + t.end(); +}); + +test('not equal', function (t) { + t.notOk(equal( + { x : 5, y : [6] }, + { x : 5, y : 6 } + )); + t.end(); +}); + +test('nested nulls', function (t) { + t.ok(equal([ null, null, null ], [ null, null, null ])); + t.end(); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/test/neg-vs-pos-0.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/test/neg-vs-pos-0.js new file mode 100644 index 00000000..ac26130e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/deep-is/test/neg-vs-pos-0.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var equal = require('../'); + +test('0 values', function (t) { + t.ok(equal( 0, 0), ' 0 === 0'); + t.ok(equal( 0, +0), ' 0 === +0'); + t.ok(equal(+0, +0), '+0 === +0'); + t.ok(equal(-0, -0), '-0 === -0'); + + t.notOk(equal(-0, 0), '-0 !== 0'); + t.notOk(equal(-0, +0), '-0 !== +0'); + + t.end(); +}); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/.npmignore new file mode 100644 index 00000000..0cc2c66b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/.npmignore @@ -0,0 +1,4 @@ +*.iml +.idea/ +node_modules/ +npm-debug.log diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/.travis.yml new file mode 100644 index 00000000..cc060cb0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/.travis.yml @@ -0,0 +1,16 @@ +language: node_js + +node_js: + - 0.10 + - 0.11 + +before_script: + - "npm install -g grunt-cli" + - "npm install" + +script: + - "npm run build" + +notifications: + email: + - ram@hiddentao.com diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/CONTRIBUTING.md b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/CONTRIBUTING.md new file mode 100644 index 00000000..66626826 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/CONTRIBUTING.md @@ -0,0 +1,22 @@ +# Contribute to fast-levenshtein + +This guide guidelines for those wishing to contribute to fast-levenshtein. + +## Contributor license agreement + +By submitting code as an individual or as an entity you agree that your code is [licensed the same as fast-levenshtein](https://github.com/hiddentao/fast-levenshtein/blob/master/LICENSE.md). + +## Issues and pull requests + +Issues and merge requests should be in English and contain appropriate language for audiences of all ages. + +We will only accept a merge requests which meets the following criteria: + +* Includes proper tests and all tests pass (unless it contains a test exposing a bug in existing code) +* Can be merged without problems (if not please use: `git rebase master`) +* Does not break any existing functionality +* Fixes one specific issue or implements one specific feature (do not combine things, send separate merge requests if needed) +* Keeps the code base clean and well structured +* Contains functionality we think other users will benefit from too +* Doesn't add unnessecary configuration options since they complicate future changes + diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/Gruntfile.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/Gruntfile.js new file mode 100644 index 00000000..6e7b3b37 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/Gruntfile.js @@ -0,0 +1,81 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + + mochaTest: { + files: ['test/*.js'] + }, + mochaTestConfig: { + options: { + reporter: 'spec', + ui: 'exports' + } + }, + + jshint: { + options: { + "bitwise": false, + "camelcase": false, + "curly": false, + "eqeqeq": true, + "forin": true, + "immed": true, + "indent": 2, + "latedef": false, + "newcap": true, + "noarg": true, + "noempty": false, + "nonew": true, + "plusplus": false, + "quotmark": false, + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + + "boss": true, + "laxcomma": true, + "multistr": true, + "sub": true, + "supernew": true, + + "browser": true, + "node": true, + "worker": true, + + "predef": [ + 'define', 'require' + ] + }, + files: ['levenshtein.js'] + }, + + uglify: { + options: { + banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %>. Copyright <%= pkg.author %> */\n' + }, + build: { + src: 'levenshtein.js', + dest: 'levenshtein.min.js' + } + }, + + benchmarkConfig: { + speed: { + src: ['benchmark/speed.js'] + } + }, + }); + + require('load-grunt-tasks')(grunt); + grunt.renameTask('benchmark', 'benchmarkConfig'); + + grunt.registerTask('build', ['jshint', 'uglify', 'mochaTest']); + + grunt.registerTask('default', ['build']); + + grunt.registerTask('benchmark', ['npm-install:levenshtein-edit-distance:levenshtein:natural:levenshtein-component:levenshtein-deltas', 'benchmarkConfig']); +}; + + diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/LICENSE.md b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/LICENSE.md new file mode 100644 index 00000000..6212406b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/LICENSE.md @@ -0,0 +1,25 @@ +(MIT License) + +Copyright (c) 2013 [Ramesh Nair](http://www.hiddentao.com/) + +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/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/README.md b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/README.md new file mode 100644 index 00000000..2a917a73 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/README.md @@ -0,0 +1,120 @@ +# fast-levenshtein - Levenshtein algorithm in Javascript + +[![Build Status](https://secure.travis-ci.org/hiddentao/fast-levenshtein.png)](http://travis-ci.org/hiddentao/fast-levenshtein) + +An efficient Javascript implementation of the [Levenshtein algorithm](http://en.wikipedia.org/wiki/Levenshtein_distance) with asynchronous callback support. + +## Features + +* Works in node.js and in the browser. +* Better performance than other implementations by not needing to store the whole matrix ([more info](http://www.codeproject.com/Articles/13525/Fast-memory-efficient-Levenshtein-algorithm)). +* Provides synchronous and asynchronous versions of the algorithm. +* Asynchronous version is almost as fast as the synchronous version for small strings and can also provide progress updates. +* Comprehensive test suite and performance benchmark. +* Small: <1 KB minified and gzipped + +## Installation + +### node.js + +Install using [npm](http://npmjs.org/): + +```bash +$ npm install fast-levenshtein +``` + +### Browser + +Using bower: + +```bash +$ bower install fast-levenshtein +``` + +If you are not using any module loader system then the API will then be accessible via the `window.Levenshtein` object. + +## Examples + +**Synchronous** + +```javascript +var levenshtein = require('fast-levenshtein'); + +var distance = levenshtein.get('back', 'book'); // 2 +var distance = levenshtein.get('我愛你', '我叫你'); // 1 +``` + +**Asynchronous** + +```javascript +var levenshtein = require('fast-levenshtein'); + +levenshtein.getAsync('back', 'book', function (err, distance) { + // err is null unless an error was thrown + // distance equals 2 +}); +``` + +**Asynchronous with progress updates** + +```javascript +var levenshtein = require('fast-levenshtein'); + +var hugeText1 = fs.readFileSync(...); +var hugeText2 = fs.readFileSync(...); + +levenshtein.getAsync(hugeText1, hugeText2, function (err, distance) { + // process the results as normal +}, { + progress: function(percentComplete) { + console.log(percentComplete + ' % completed so far...'); + } +); +``` + +## Building and Testing + +To build the code and run the tests: + +```bash +$ npm install -g grunt-cli +$ npm install +$ npm run build +``` + +## Performance + +_Thanks to [Titus Wormer](https://github.com/wooorm) for [encouraging me](https://github.com/hiddentao/fast-levenshtein/issues/1) to do this._ + +Benchmarked against other node.js levenshtein distance modules (on Macbook Air 2012, Core i7, 8GB RAM): + +```bash +Running suite Implementation comparison [benchmark/speed.js]... +>> levenshtein-edit-distance x 234 ops/sec ±3.02% (73 runs sampled) +>> levenshtein-component x 422 ops/sec ±4.38% (83 runs sampled) +>> levenshtein-deltas x 283 ops/sec ±3.83% (78 runs sampled) +>> natural x 255 ops/sec ±0.76% (88 runs sampled) +>> levenshtein x 180 ops/sec ±3.55% (86 runs sampled) +>> fast-levenshtein x 1,792 ops/sec ±2.72% (95 runs sampled) +Benchmark done. +Fastest test is fast-levenshtein at 4.2x faster than levenshtein-component +``` + +You can run this benchmark yourself by doing: + +```bash +$ npm install -g grunt-cli +$ npm install +$ npm run build +$ npm run benchmark +``` + +## Contributing + +If you wish to submit a pull request please update and/or create new tests for any changes you make and ensure the grunt build passes. + +See [CONTRIBUTING.md](https://github.com/hiddentao/fast-levenshtein/blob/master/CONTRIBUTING.md) for details. + +## License + +MIT - see [LICENSE.md](https://github.com/hiddentao/fast-levenshtein/blob/master/LICENSE.md) diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/benchmark/speed.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/benchmark/speed.js new file mode 100644 index 00000000..2564430a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/benchmark/speed.js @@ -0,0 +1,182 @@ +var fastLevenshtein = require('../levenshtein.min').get, + levenshtein = require('levenshtein'), + levenshteinEditDistance = require('levenshtein-edit-distance'), + levenshteinComponent = require('levenshtein-component'), + levenshteinDeltas = require('levenshtein-deltas'), + natural = require('natural').LevenshteinDistance; + + + +/* The first 100 words from Letterpress: https://github.com/atebits/Words */ +source = Array(11).join([ + 'aa', + 'aah', + 'aahed', + 'aahing', + 'aahs', + 'aal', + 'aalii', + 'aaliis', + 'aals', + 'aardvark', + 'aardvarks', + 'aardwolf', + 'aardwolves', + 'aargh', + 'aarrgh', + 'aarrghh', + 'aarti', + 'aartis', + 'aas', + 'aasvogel', + 'aasvogels', + 'ab', + 'aba', + 'abac', + 'abaca', + 'abacas', + 'abaci', + 'aback', + 'abacs', + 'abacterial', + 'abactinal', + 'abactinally', + 'abactor', + 'abactors', + 'abacus', + 'abacuses', + 'abaft', + 'abaka', + 'abakas', + 'abalone', + 'abalones', + 'abamp', + 'abampere', + 'abamperes', + 'abamps', + 'aband', + 'abanded', + 'abanding', + 'abandon', + 'abandoned', + 'abandonedly', + 'abandonee', + 'abandonees', + 'abandoner', + 'abandoners', + 'abandoning', + 'abandonment', + 'abandonments', + 'abandons', + 'abandonware', + 'abandonwares', + 'abands', + 'abapical', + 'abas', + 'abase', + 'abased', + 'abasedly', + 'abasement', + 'abasements', + 'abaser', + 'abasers', + 'abases', + 'abash', + 'abashed', + 'abashedly', + 'abashes', + 'abashing', + 'abashless', + 'abashment', + 'abashments', + 'abasia', + 'abasias', + 'abasing', + 'abask', + 'abatable', + 'abate', + 'abated', + 'abatement', + 'abatements', + 'abater', + 'abaters', + 'abates', + 'abating', + 'abatis', + 'abatises', + 'abator', + 'abators', + 'abattis', + 'abattises', + 'abattoir', + 'abattoirs' +].join('|')).split('|'); + + + +/** + * The actual test loop. + * @param {Function} fn Levenshtein distance function. + */ +var loop = function(fn) { + var iterator = -1, + previousValue = '', + value, + dist; + + while (value = source[++iterator]) { + dist = fn(previousValue, value); + previousValue = value; + } +}; + + +/** @type {Object} Test config */ +module.exports = { + name: 'Implementation comparison', + onComplete: function() { + console.log('Benchmark done.'); + }, + tests: [ + { + name: 'levenshtein-edit-distance', + fn: function() { + loop(levenshteinEditDistance); + } + }, + { + name: 'levenshtein-component', + fn: function() { + loop(levenshteinComponent); + } + }, + { + name: 'levenshtein-deltas', + fn: function() { + loop(function(v1,v2) { + return new levenshteinDeltas.Lev(v1,v2).distance(); + }); + } + }, + { + name: 'natural', + fn: function() { + loop(natural); + } + }, + { + name: 'levenshtein', + fn: function() { + loop(levenshtein); + } + }, + { + name: 'fast-levenshtein', + fn: function() { + loop(fastLevenshtein); + } + }, + ] +}; + + diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/bower.json b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/bower.json new file mode 100644 index 00000000..16703934 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/bower.json @@ -0,0 +1,30 @@ +{ + "name": "fast-levenshtein", + "version": "1.0.6", + "homepage": "https://github.com/hiddentao/fast-levenshtein", + "authors": [ + "Ramesh Nair " + ], + "description": "Efficient implementation of Levenshtein algorithm with asynchronous callback support", + "main": "levenshtein.js", + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "levenshtein", + "distance", + "string" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests", + "benchmark", + "Gruntfile.js" + ] +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js new file mode 100644 index 00000000..0028f405 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js @@ -0,0 +1,198 @@ +(function() { + 'use strict'; + + /** + * Extend an Object with another Object's properties. + * + * The source objects are specified as additional arguments. + * + * @param dst Object the object to extend. + * + * @return Object the final object. + */ + var _extend = function(dst) { + var sources = Array.prototype.slice.call(arguments, 1); + for (var i=0; i tmp) { + nextCol = tmp; + } + // deletion + tmp = prevRow[j + 1] + 1; + if (nextCol > tmp) { + nextCol = tmp; + } + + // copy current col value into previous (in preparation for next iteration) + prevRow[j] = curCol; + } + + // copy last col value into previous (in preparation for next iteration) + prevRow[j] = nextCol; + } + + return nextCol; + }, + + /** + * Asynchronously calculate levenshtein distance of the two strings. + * + * @param str1 String the first string. + * @param str2 String the second string. + * @param cb Function callback function with signature: function(Error err, int distance) + * @param [options] Object additional options. + * @param [options.progress] Function progress callback with signature: function(percentComplete) + */ + getAsync: function(str1, str2, cb, options) { + options = _extend({}, { + progress: null + }, options); + + // base cases + if (str1 === str2) return cb(null, 0); + if (str1.length === 0) return cb(null, str2.length); + if (str2.length === 0) return cb(null, str1.length); + + // two rows + var prevRow = new Array(str2.length + 1), + curCol, nextCol, + i, j, tmp, + startTime, currentTime; + + // initialise previous row + for (i=0; i tmp) { + nextCol = tmp; + } + // deletion + tmp = prevRow[j + 1] + 1; + if (nextCol > tmp) { + nextCol = tmp; + } + + // copy current into previous (in preparation for next iteration) + prevRow[j] = curCol; + + // get current time + currentTime = new Date().valueOf(); + } + + // send a progress update? + if (null !== options.progress) { + try { + options.progress.call(null, (i * 100.0/ str1.length)); + } catch (err) { + return cb('Progress callback: ' + err.toString()); + } + } + + // next iteration + setTimeout(__calculate(), 0); + }; + + __calculate(); + } + + }; + + // amd + if (typeof define !== "undefined" && define !== null && define.amd) { + define(function() { + return Levenshtein; + }); + } + // commonjs + else if (typeof module !== "undefined" && module !== null) { + module.exports = Levenshtein; + } + // web worker + else if (typeof self !== "undefined" && typeof self.postMessage === 'function' && typeof self.importScripts === 'function') { + self.Levenshtein = Levenshtein; + } + // browser main thread + else if (typeof window !== "undefined" && window !== null) { + window.Levenshtein = Levenshtein; + } +}()); + diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.min.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.min.js new file mode 100644 index 00000000..94d89ee5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.min.js @@ -0,0 +1,2 @@ +/*! fast-levenshtein 2014-12-17. Copyright Ramesh Nair (http://www.hiddentao.com/) */ +!function(){"use strict";var a=function(a){for(var b=Array.prototype.slice.call(arguments,1),c=0;cg&&(d=g),g=h[f+1]+1,d>g&&(d=g),h[f]=c;h[f]=d}return d},getAsync:function(b,c,d,e){if(e=a({},{progress:null},e),b===c)return d(null,0);if(0===b.length)return d(null,c.length);if(0===c.length)return d(null,b.length);var f,g,h,i,j,k,l,m=new Array(c.length+1);for(h=0;hl-k;){if(c.length<=++i){if(m[i]=g,b.length<=++h)return d(null,g);g=h+1,i=0}f=g,g=m[i]+(b.charAt(h)===c.charAt(i)?0:1),j=f+1,g>j&&(g=j),j=m[i+1]+1,g>j&&(g=j),m[i]=f,l=(new Date).valueOf()}if(null!==e.progress)try{e.progress.call(null,100*h/b.length)}catch(a){return d("Progress callback: "+a.toString())}setTimeout(n(),0)};n()}};"undefined"!=typeof define&&null!==define&&define.amd?define(function(){return b}):"undefined"!=typeof module&&null!==module?module.exports=b:"undefined"!=typeof self&&"function"==typeof self.postMessage&&"function"==typeof self.importScripts?self.Levenshtein=b:"undefined"!=typeof window&&null!==window&&(window.Levenshtein=b)}(); \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/package.json b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/package.json new file mode 100644 index 00000000..d1a01826 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/package.json @@ -0,0 +1,62 @@ +{ + "name": "fast-levenshtein", + "version": "1.0.6", + "description": "Efficient implementation of Levenshtein algorithm with asynchronous callback support", + "main": "levenshtein.js", + "scripts": { + "build": "grunt build", + "benchmark": "grunt benchmark" + }, + "devDependencies": { + "lodash": "~1.2.0", + "chai": "~1.5.0", + "mocha": "~1.9.0", + "grunt-contrib-uglify": "~0.2.0", + "grunt": "~0.4.1", + "grunt-contrib-jshint": "~0.4.3", + "grunt-mocha-test": "~0.2.2", + "grunt-npm-install": "~0.1.0", + "load-grunt-tasks": "~0.6.0", + "grunt-benchmark": "~0.2.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/hiddentao/fast-levenshtein.git" + }, + "keywords": [ + "levenshtein", + "distance", + "string" + ], + "author": { + "name": "Ramesh Nair", + "email": "ram@hiddentao.com", + "url": "http://www.hiddentao.com/" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/hiddentao/fast-levenshtein/issues" + }, + "homepage": "https://github.com/hiddentao/fast-levenshtein", + "_id": "fast-levenshtein@1.0.6", + "_shasum": "3bedb184e39f95cb0d88928688e6b1ee3273446a", + "_from": "fast-levenshtein@>=1.0.0 <1.1.0", + "_npmVersion": "1.4.9", + "_npmUser": { + "name": "hiddentao", + "email": "ram@hiddentao.com" + }, + "maintainers": [ + { + "name": "hiddentao", + "email": "ram@hiddentao.com" + } + ], + "dist": { + "shasum": "3bedb184e39f95cb0d88928688e6b1ee3273446a", + "tarball": "http://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-1.0.6.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-1.0.6.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/mocha.opts b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/mocha.opts new file mode 100644 index 00000000..a8ccfb45 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/mocha.opts @@ -0,0 +1,2 @@ +--ui exports +--reporter spec diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/tests.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/tests.js new file mode 100644 index 00000000..54b92220 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/tests.js @@ -0,0 +1,171 @@ +var _ = require('lodash'), + chai = require('chai'), + fs = require('fs'), + levenshtein = require('../levenshtein.min'); + +var expect = chai.expect, + assert = chai.assert; + + +/** + * Create test functions. + * @return Object + */ +var createTests = function(str1, str2, expectedLength, options) { + options = _.extend({}, { + description: null + }, options); + + if (!options.description) { + options.description = (0 === str1.length ? '(empty)' : str1) + ' <-> ' + (0 === str2.length ? '(empty)' : str2); + } + + var ret = {}; + + ret["SYNC:\t" + options.description] = function() { + expect(levenshtein.get(str1, str2)).to.eql(expectedLength); + }; + + ret["ASYNC:\t" + options.description] = function(done) { + levenshtein.getAsync(str1, str2, function(err, distance) { + expect(err).to.be.null; + expect(distance).to.eql(expectedLength); + + done(); + }); + }; + + return ret; +}; + + +// ----- Basic tests ----- // + +(function() { + + var tests = {}, + str = 'hello', + str1 = str, + str2 = str, + i; + + // equal strings + _.extend(tests, createTests('hello', 'hello', 0)); + + // inserts + for (i=0; i<=str.length; ++i) { + str1 = str.substr(0,i); + str2 = str; + + _.extend(tests, createTests(str1, str2, str.length - i)); + } + + // deletes + for (i=str.length-1; i>=0; --i) { + str1 = str; + str2 = str.substr(0,i); + + _.extend(tests, createTests(str1, str2, str.length - i)); + } + + // substitutions + _.extend(tests, createTests("a", "b", 1 )); + _.extend(tests, createTests("ab", "ac", 1 )); + _.extend(tests, createTests("ac", "bc", 1 )); + _.extend(tests, createTests("abc", "axc", 1 )); + _.extend(tests, createTests("xabxcdxxefxgx", "1ab2cd34ef5g6", 6 )); + + // many ops + _.extend(tests, createTests('xabxcdxxefxgx', 'abcdefg', 6)); + _.extend(tests, createTests('javawasneat', 'scalaisgreat', 7)); + _.extend(tests, createTests("example", "samples", 3)); + _.extend(tests, createTests("sturgeon", "urgently", 6 )); + _.extend(tests, createTests("levenshtein", "frankenstein", 6 )); + _.extend(tests, createTests("distance", "difference", 5 )); + + // non-latin + _.extend(tests, createTests('因為我是中國人所以我會說中文', '因為我是英國人所以我會說英文', 2, { + description: 'non-latin' + })); + + // long text + _.extend(tests, createTests( + 'Morbi interdum ultricies neque varius condimentum. Donec volutpat turpis interdum metus ultricies vulputate. Duis ultricies rhoncus sapien, sit amet fermentum risus imperdiet vitae. Ut et lectus', + 'Duis erat dolor, cursus in tincidunt a, lobortis in odio. Cras magna sem, pharetra et iaculis quis, faucibus quis tellus. Suspendisse dapibus sapien in justo cursus', + 143, + { + description: 'long text' + } + )); + + exports['Basic'] = tests; +})(); + +// ------ Asynchronous tests ----- // + +var text1 = fs.readFileSync(__dirname + '/text1.txt', 'utf-8'), + text2 = fs.readFileSync(__dirname + '/text2.txt', 'utf-8'); + +exports['Async'] = { + 'no progress callback': function(done) { + this.timeout(20000); + + var startTime = new Date().valueOf(); + + levenshtein.getAsync(text1, text2, function(err, distance) { + var timeElapsed = new Date().valueOf() - startTime; + + expect(err).to.be.null; + expect(distance).to.eql(194); + + console.log(timeElapsed + ' ms'); + + done(); + }); + }, + 'with progress callback': function(done) { + this.timeout(20000); + + var percents = []; + var progress = function(percent) { + percents.push(percent); + }; + + var startTime = new Date().valueOf(); + + levenshtein.getAsync(text1, text2, function(err, distance) { + var timeElapsed = new Date().valueOf() - startTime; + + expect(err).to.be.null; + expect(distance).to.eql(194); + + console.log(timeElapsed + ' ms, ' + percents.length + ' progress updates'); + + expect(0 < percents.length).to.be.true; + + // check percentages + var lastPercent = 0; + _.each(percents, function(percent) { + expect(100 >= percent); + expect(percent > lastPercent); + lastPercent = percent; + }); + + done(); + }, { + progress: progress + }); + }, + 'progress callback error': function(done) { + levenshtein.getAsync(text1 + text2, text2 + text1, function(err) { + expect(err.toString()).to.be.eql('Progress callback: Error: Bla bla'); + + done(); + }, { + progress: function() { + throw new Error('Bla bla'); + } + }); + } +}; + diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/text1.txt b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/text1.txt new file mode 100644 index 00000000..4833682a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/text1.txt @@ -0,0 +1 @@ +Duis mollis rhoncus turpis. Proin ut nunc eget urna molestie dictum. Cras mollis nibh quis eros faucibus posuere vehicula diam rutrum. Morbi mattis orci vel ante dignissim sollicitudin. Aenean quis enim orci. Integer vehicula elementum porta. Nullam massa mauris, ornare eget ullamcorper eget, consequat at dolor. Integer cursus pellentesque velit in semper. Donec sem turpis, tristique vitae egestas nec, varius sit amet ipsum. Nullam scelerisque est eu arcu vulputate varius. Integer vel gravida leo. Suspendisse blandit vehicula neque, non porttitor eros adipiscing non. Curabitur egestas pulvinar sapien ac imperdiet. Ut ac purus sit amet magna sollicitudin cursus non vel eros. In vel nibh eget libero mattis volutpat nec vulputate quam. Vestibulum commodo ante id magna cursus tristique. Integer rutrum diam sit amet nulla placerat ornare. Quisque nec felis lacus. In lorem mauris, lobortis sit amet sodales non, sollicitudin vitae odio. Nam a dui est, venenatis iaculis purus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In in sollicitudin urna. Praesent dapibus ligula sed lacus pulvinar sit amet pellentesque enim tincidunt. Vivamus feugiat, sapien vitae convallis consectetur, justo ligula semper quam, mollis dapibus lorem odio sit amet justo. Duis ut leo vel turpis cursus tempor. Donec condimentum convallis lacus at feugiat. Aliquam erat volutpat. Etiam auctor risus dolor, in tempor nibh. Nulla interdum, magna eget suscipit aliquet, enim arcu aliquet nunc, vel molestie est sem ac turpis. Ut et convallis diam. Integer malesuada eleifend eros non sollicitudin. In ac sem eget purus iaculis sollicitudin. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse ultrices nulla sit amet sapien fringilla eleifend. Integer eget lectus a augue convallis dignissim sit amet scelerisque odio. Duis velit nisl, mollis a adipiscing eget, suscipit in quam. Sed id lacus et justo dapibus dapibus vestibulum gravida massa. Duis euismod luctus tempor. Nam venenatis gravida rutrum. Etiam id aliquet est. Integer ante arcu, viverra sit amet placerat sit amet, posuere in est. Cras eleifend ultricies urna, ut euismod quam euismod quis. Cras pellentesque nulla et ante molestie pulvinar. Duis malesuada bibendum arcu, id imperdiet enim egestas eget. Sed blandit iaculis enim vel adipiscing. Donec dui quam, tristique non tincidunt sed, interdum luctus ante. Etiam eget nisl id est hendrerit egestas. Vestibulum tempor justo magna, non sagittis felis. Vivamus nec nibh porta nibh cursus luctus suscipit ut nibh. Aenean mollis molestie justo, non ornare mi mollis id. Vestibulum massa neque, mattis eget pulvinar et, tincidunt in magna. Nunc vitae dapibus turpis. Nullam bibendum vehicula odio sed viverra. Donec laoreet, lectus sit amet viverra scelerisque, mi enim fermentum tellus, quis consequat arcu felis in ante. Donec non felis non nisl tincidunt ultricies sit amet nec mi. Maecenas sodales, lorem vel volutpat cursus, nisi tortor pulvinar eros, in pharetra mauris neque sit amet nulla. Nulla ligula turpis, egestas in imperdDuis mollis rhoncus turpis. Proin ut nunc eget urna molestie dictum. Cras mollis nibh quis eros faucibus posuere vehicula diam rutrum. Morbi mattis orci vel ante dignissim sollicitudin. Aenean quis enim orci. Integer vehicula elementum porta. Nullam massa mauris, ornare eget ullamcorper eget, consequat at dolor. Integer cursus pellentesque velit in semper. Donec sem turpis, tristique vitae egestas nec, varius sit amet ipsum. Nullam scelerisque est eu arcu vulputate varius. Integer vel gravida leo. Suspendisse blandit vehicula neque, non porttitor eros adipiscing non. Curabitur egestas pulvinar sapien ac imperdiet. Ut ac purus sit amet magna sollicitudin cursus non vel eros. In vel nibh eget libero mattis volutpat nec vulputate quam. Vestibulum commodo ante id magna cursus tristique. Integer rutrum diam sit amet nulla placerat ornare. Quisque nec felis lacus. In lorem mauris, lobortis sit amet sodales non, sollicitudin vitae odio. Nam a dui est, venenatis iaculis purus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In in sollicitudin urna. Praesent dapibus ligula sed lacus pulvinar sit amet pellentesque enim tincidunt. Vivamus feugiat, sapien vitae convallis consectetur, justo ligula semper quam, mollis dapibus lorem odio sit amet justo. Duis ut leo vel turpis cursus tempor. Donec condimentum convallis lacus at feugiat. Aliquam erat volutpat. Etiam auctor risus dolor, in tempor nibh. Nulla interdum, magna eget suscipit aliquet, enim arcu aliquet nunc, vel molestie est sem ac turpis. Ut et convallis diam. Integer malesuada eleifend eros non sollicitudin. In ac sem eget purus iaculis sollicitudin. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse ultrices nulla sit amet sapien fringilla eleifend. Integer eget lectus a augue convallis dignissim sit amet scelerisque odio. Duis velit nisl, mollis a adipiscing eget, suscipit in quam. Sed id lacus et justo dapibus dapibus vestibulum gravida massa. Duis euismod luctus tempor. Nam venenatis gravida rutrum. Etiam id aliquet est. Integer ante arcu, viverra sit amet placerat sit amet, posuere in est. Cras eleifend ultricies urna, ut euismod quam euismod quis. Cras pellentesque nulla et ante molestie pulvinar. Duis malesuada bibendum arcu, id imperdiet enim egestas eget. Sed blandit iaculis enim vel adipiscing. Donec dui quam, tristique non tincidunt sed, interdum luctus ante. Etiam eget nisl id est hendrerit egestas. Vestibulum tempor justo magna, non sagittis felis. Vivamus nec nibh porta nibh cursus luctus suscipit ut nibh. Aenean mollis molestie justo, non ornare mi mollis id. Vestibulum massa neque, mattis eget pulvinar et, tincidunt in magna. Nunc vitae dapibus turpis. Nullam bibendum vehicula odio sed viverra. Donec laoreet, lectus sit amet viverra scelerisque, mi enim fermentum tellus, quis consequat arcu felis in ante. Donec non felis non nisl tincidunt ultricies sit amet nec mi. Maecenas sodales, lorem vel volutpat cursus, nisi tortor pulvinar eros, in pharetra mauris neque sit amet nulla. Nulla ligula turpis, egestas in imperdiet a, faucibus quis turpis. Vivamus purus lorem, vestibulum id rhoncus iaculis, vulputate nec mi \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/text2.txt b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/text2.txt new file mode 100644 index 00000000..ca15f413 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/fast-levenshtein/test/text2.txt @@ -0,0 +1 @@ +Duis mollis rhoncus turpis. Proin ut nunc eget urna molestie dictum. Cras mollis nibh quis eros faucibus posuere vehicula diam rutrum. Morbi mattis orci vel ante dignissim sollicitudin. Aenean quis enim orci. Integer vehicula elementum porta. Nullam massa mauris, ornare eget ullamcorper eget, consequat at dolor. Integer cursus pellentesque velit in semper. Donec sem turpis, tristique vitae egestas nec, varius sit amet ipsum. Nullam scelerisque est eu arcu vulputate varius. Integer vel gravida leo. Suspendisse blandit vehicula neque, non porttitor eros adipiscing non. Curabitur egestas pulvinar sapien ac imperdiet. Ut ac purus sit amet magna sollicitudin cursus non vel eros. In vel nibh eget libero mattis volutpat nec vulputate quam. Vestibulum commodo ante id magna cursus tristique. Integer rutrum diam sit amet nulla placerat ornare. Quisque nec felis lacus. In lorem mauris, lobortis sit amet sodales non, sollicitudin vitae odio. Nam a dui est, venenatis iaculis purus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In in sollicitudin urna. Praesent dapibus ligula sed lacus pulvinar sit amet pellentesque enim tincidunt. Vivamus feugiat, sapien vitae convallis consectetur, justo ligula semper quam, mollis dapibus lorem odio sit amet justo. Duis ut leo vel turpis cursus tempor. Donec condimentum convallis lacus at feugiat. Aliquam erat volutpat. Etiam auctor risus dolor, in tempor nibh. Nulla interdum, magna eget suscipit aliquet, enim arcu aliquet nunc, vel molestie est sem ac turpis. Ut et convallis diam. Integer malesuada eleifend eros non sollicitudin. In ac sem eget purus iaculis sollicitudin. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse ultrices nulla sit amet sapien fringilla eleifend. Integer eget lectus a augue convallis dignissim sit amet scelerisque odio. Duis velit nisl, mollis a adipiscing eget, suscipit in quam. Sed id lacus et justo dapibus dapibus vestibulum gravida massa. Duis euismod luctus tempor. Nam venenatis gravida rutrum. Etiam id aliquet est. Integer ante arcu, viverra sit amet placerat sit amet, posuere in est. Cras eleifend ultricies urna, ut euismod quam euismod quis. Cras pellentesque nulla et ante molestie pulvinar. Duis malesuada bibendum arcu, id imperdiet enim egestas eget. Sed blandit iaculis enim vel adipiscing. Donec dui quam, tristique non tincidunt sed, interdum luctus ante. Etiam eget nisl id est hendrerit egestas. Vestibulum tempor justo magna, non sagittis felis. Vivamus nec nibh porta nibh cursus luctus suscipit ut nibh. Aenean mollis molestie justo, non ornare mi mollis id. Vestibulum massa neque, mattis eget pulvinar et, tincidunt in magna. Nunc vitae dapibus turpis. Nullam bibendum vehicula odio sed viverra. Donec laoreet, lectus sit amet viverra scelerisque, mi enim fermentum tellus, quis consequat arcu felis in ante. Donec non felis non nisl tincidunt ultricies sit amet nec mi. Maecenas sodales, lorem vel volutpat cursus, nisi tortor pulvinar eros, in pharetra mauris neque sit amet nulla. Nulla ligula turpis, egestas in imperdiet a, faucibus quis turpis. Vivamus purus lorem, vestibulum id rhoncus iaculis, vulputate nec miDuis mollis rhoncus turpis. Proin ut nunc eget urna molestie dictum. Cras mollis nibh quis eros faucibus posuere vehicula diam rutrum. Morbi mattis orci vel ante dignissim sollicitudin. Aenean quis enim orci. Integer vehicula elementum porta. Nullam massa mauris, ornare eget ullamcorper eget, consequat at dolor. Integer cursus pellentesque velit in semper. Donec sem turpis, tristique vitae egestas nec, varius sit amet ipsum. Nullam scelerisque est eu arcu vulputate varius. Integer vel gravida leo. Suspendisse blandit vehicula neque, non porttitor eros adipiscing non. Curabitur egestas pulvinar sapien ac imperdiet. Ut ac purus sit amet magna sollicitudin cursus non vel eros. In vel nibh eget libero mattis volutpat nec vulputate quam. Vestibulum commodo ante id magna cursus tristique. Integer rutrum diam sit amet nulla placerat ornare. Quisque nec felis lacus. In lorem mauris, lobortis sit amet sodales non, sollicitudin vitae odio. Nam a dui est, venenatis iaculis purus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In in sollicitudin urna. Praesent dapibus ligula sed lacus pulvinar sit amet pellentesque enim tincidunt. Vivamus feugiat, sapien vitae convallis consectetur, justo ligula semper quam, mollis dapibus lorem odio sit amet justo. Duis ut leo vel turpis cursus tempor. Donec condimentum convallis lacus at feugiat. Aliquam erat volutpat. Etiam auctor risus dolor, in tempor nibh. Nulla interdum, magna eget suscipit aliquet, enim arcu aliquet nunc, vel molestie est sem ac turpis. Ut et convallis diam. Integer malesuada eleifend eros non sollicitudin. In ac sem eget purus iaculis sollicitudin. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse ultrices nulla sit amet sapien fringilla eleifend. Integer eget lectus a augue convallis dignissim sit amet scelerisque odio. Duis velit nisl, mollis a adipiscing eget, suscipit in quam. Sed id lacus et justo dapibus dapibus vestibulum gravida massa. Duis euismod luctus tempor. Nam venenatis gravida rutrum. Etiam id aliquet est. Integer ante arcu, viverra sit amet placerat sit amet, posuere in est. Cras eleifend ultricies urna, ut euismod quam euismod quis. Cras pellentesque nulla et ante molestie pulvinar. Duis malesuada bibendum arcu, id imperdiet enim egestas eget. Sed blandit iaculis enim vel adipiscing. Donec dui quam, tristique non tincidunt sed, interdum luctus ante. Etiam eget nisl id est hendrerit egestas. Vestibulum tempor justo magna, non sagittis felis. Vivamus nec nibh porta nibh cursus luctus suscipit ut nibh. Aenean mollis molestie justo, non ornare mi mollis id. Vestibulum massa neque, mattis eget pulvinar et, tincidunt in magna. Nunc vitae dapibus turpis. Nullam bibendum vehicula odio sed viverra. Donec laoreet, lectus sit amet viverra scelerisque, mi enim fermentum tellus, quis consequat arcu felis in ante. Donec non felis non nisl tincidunt ultricies sit amet nec mi. Maecenas sodales, lorem vel volutpat cursus, nisi tortor pulvinar eros, in pharetra mauris neque sit amet nulla. Nulla ligula turpis, egestas in imperd \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/LICENSE new file mode 100644 index 00000000..525b1185 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +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/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/README.md b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/README.md new file mode 100644 index 00000000..e55d9435 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/README.md @@ -0,0 +1,195 @@ +# levn [![Build Status](https://travis-ci.org/gkz/levn.png)](https://travis-ci.org/gkz/levn) +__Light ECMAScript (JavaScript) Value Notation__ +Levn is a library which allows you to parse a string into a JavaScript value based on an expected type. It is meant for short amounts of human entered data (eg. config files, command line arguments). + +Levn aims to concisely describe JavaScript values in text, and allow for the extraction and validation of those values. Levn uses [type-check](https://github.com/gkz/type-check) for its type format, and to validate the results. MIT license. Version 0.2.5. + +__How is this different than JSON?__ levn is meant to be written by humans only, is (due to the previous point) much more concise, can be validated against supplied types, has regex and date literals, and can easily be extended with custom types. On the other hand, it is probably slower and thus less efficient at transporting large amounts of data, which is fine since this is not its purpose. + + npm install levn + +For updates on levn, [follow me on twitter](https://twitter.com/gkzahariev). + + +## Quick Examples + +```js +var parse = require('levn').parse; +parse('Number', '2'); // 2 +parse('String', '2'); // '2' +parse('String', 'levn'); // 'levn' +parse('String', 'a b'); // 'a b' +parse('Boolean', 'true'); // true + +parse('Date', '#2011-11-11#'); // (Date object) +parse('Date', '2011-11-11'); // (Date object) +parse('RegExp', '/[a-z]/gi'); // /[a-z]/gi +parse('RegExp', 're'); // /re/ + +parse('Number | String', 'str'); // 'str' +parse('Number | String', '2'); // 2 + +parse('[Number]', '[1,2,3]'); // [1,2,3] +parse('(String, Boolean)', '(hi, false)'); // ['hi', false] +parse('{a: String, b: Number}', '{a: str, b: 2}'); // {a: 'str', b: 2} + +// at the top level, you can ommit surrounding delimiters +parse('[Number]', '1,2,3'); // [1,2,3] +parse('(String, Boolean)', 'hi, false'); // ['hi', false] +parse('{a: String, b: Number}', 'a: str, b: 2'); // {a: 'str', b: 2} + +// wildcard - auto choose type +parse('*', '[hi,(null,[42]),{k: true}]'); // ['hi', [null, [42]], {k: true}] +``` +## Usage + +`require('levn');` returns an object that exposes three properties. `VERSION` is the current version of the library as a string. `parse` and `parsedTypeParse` are functions. + +```js +// parse(type, input, options); +parse('[Number]', '1,2,3'); // [1, 2, 3] + +// parsedTypeParse(parsedType, input, options); +var parsedType = require('type-check').parseType('[Number]'); +parsedTypeParse(parsedType, '1,2,3'); // [1, 2, 3] +``` + +### parse(type, input, options) + +`parse` casts the string `input` into a JavaScript value according to the specified `type` in the [type format](https://github.com/gkz/type-check#type-format) (and taking account the optional `options`) and returns the resulting JavaScript value. + +##### arguments +* type - `String` - the type written in the [type format](https://github.com/gkz/type-check#type-format) which to check against +* input - `String` - the value written in the [levn format](#levn-format) +* options - `Maybe Object` - an optional parameter specifying additional [options](#options) + +##### returns +`*` - the resulting JavaScript value + +##### example +```js +parse('[Number]', '1,2,3'); // [1, 2, 3] +``` + +### parsedTypeParse(parsedType, input, options) + +`parsedTypeParse` casts the string `input` into a JavaScript value according to the specified `type` which has already been parsed (and taking account the optional `options`) and returns the resulting JavaScript value. You can parse a type using the [type-check](https://github.com/gkz/type-check) library's `parseType` function. + +##### arguments +* type - `Object` - the type in the parsed type format which to check against +* input - `String` - the value written in the [levn format](#levn-format) +* options - `Maybe Object` - an optional parameter specifying additional [options](#options) + +##### returns +`*` - the resulting JavaScript value + +##### example +```js +var parsedType = require('type-check').parseType('[Number]'); +parsedTypeParse(parsedType, '1,2,3'); // [1, 2, 3] +``` + +## Levn Format + +Levn can use the type information you provide to choose the appropriate value to produce from the input. For the same input, it will choose a different output value depending on the type provided. For example, `parse('Number', '2')` will produce the number `2`, but `parse('String', '2')` will produce the string `"2"`. + +If you do not provide type information, and simply use `*`, levn will parse the input according the unambiguous "explicit" mode, which we will now detail - you can also set the `explicit` option to true manually in the [options](#options). + +* `"string"`, `'string'` are parsed as a String, eg. `"a msg"` is `"a msg"` +* `#date#` is parsed as a Date, eg. `#2011-11-11#` is `new Date('2011-11-11')` +* `/regexp/flags` is parsed as a RegExp, eg. `/re/gi` is `/re/gi` +* `undefined`, `null`, `NaN`, `true`, and `false` are all their JavaScript equivalents +* `[element1, element2, etc]` is an Array, and the casting procedure is recursively applied to each element. Eg. `[1,2,3]` is `[1,2,3]`. +* `(element1, element2, etc)` is an tuple, and the casting procedure is recursively applied to each element. Eg. `(1, a)` is `(1, a)` (is `[1, 'a']`). +* `{key1: val1, key2: val2, ...}` is an Object, and the casting procedure is recursively applied to each property. Eg. `{a: 1, b: 2}` is `{a: 1, b: 2}`. +* Any test which does not fall under the above, and which does not contain special characters (`[``]``(``)``{``}``:``,`) is a string, eg. `$12- blah` is `"$12- blah"`. + +If you do provide type information, you can make your input more concise as the program already has some information about what it expects. Please see the [type format](https://github.com/gkz/type-check#type-format) section of [type-check](https://github.com/gkz/type-check) for more information about how to specify types. There are some rules about what levn can do with the information: + +* If a String is expected, and only a String, all characters of the input (including any special ones) will become part of the output. Eg. `[({})]` is `"[({})]"`, and `"hi"` is `'"hi"'`. +* If a Date is expected, the surrounding `#` can be omitted from date literals. Eg. `2011-11-11` is `new Date('2011-11-11')`. +* If a RegExp is expected, no flags need to be specified, and the regex is not using any of the special characters,the opening and closing `/` can be omitted - this will have the affect of setting the source of the regex to the input. Eg. `regex` is `/regex/`. +* If an Array is expected, and it is the root node (at the top level), the opening `[` and closing `]` can be omitted. Eg. `1,2,3` is `[1,2,3]`. +* If a tuple is expected, and it is the root node (at the top level), the opening `(` and closing `)` can be omitted. Eg. `1, a` is `(1, a)` (is `[1, 'a']`). +* If an Object is expected, and it is the root node (at the top level), the opening `{` and closing `}` can be omitted. Eg `a: 1, b: 2` is `{a: 1, b: 2}`. + +If you list multiple types (eg. `Number | String`), it will first attempt to cast to the first type and then validate - if the validation fails it will move on to the next type and so forth, left to right. You must be careful as some types will succeed with any input, such as String. Thus put String at the end of your list. In non-explicit mode, Date and RegExp will succeed with a large variety of input - also be careful with these and list them near the end if not last in your list. + +Whitespace between special characters and elements is inconsequential. + +## Options + +Options is an object. It is an optional parameter to the `parse` and `parsedTypeParse` functions. + +### Explicit + +A `Boolean`. By default it is `false`. + +__Example:__ + +```js +parse('RegExp', 're', {explicit: false}); // /re/ +parse('RegExp', 're', {explicit: true}); // Error: ... does not type check... +parse('RegExp | String', 're', {explicit: true}); // 're' +``` + +`explicit` sets whether to be in explicit mode or not. Using `*` automatically activates explicit mode. For more information, read the [levn format](#levn-format) section. + +### customTypes + +An `Object`. Empty `{}` by default. + +__Example:__ + +```js +var options = { + customTypes: { + Even: { + typeOf: 'Number', + validate: function (x) { + return x % 2 === 0; + }, + cast: function (x) { + return {type: 'Just', value: parseInt(x)}; + } + } + } +} +parse('Even', '2', options); // 2 +parse('Even', '3', options); // Error: Value: "3" does not type check... +``` + +__Another Example:__ +```js +function Person(name, age){ + this.name = name; + this.age = age; +} +var options = { + customTypes: { + Person: { + typeOf: 'Object', + validate: function (x) { + x instanceof Person; + }, + cast: function (value, options, typesCast) { + var name, age; + if ({}.toString.call(value).slice(8, -1) !== 'Object') { + return {type: 'Nothing'}; + } + name = typesCast(value.name, [{type: 'String'}], options); + age = typesCast(value.age, [{type: 'Numger'}], options); + return {type: 'Just', value: new Person(name, age)}; + } + } +} +parse('Person', '{name: Laura, age: 25}', options); // Person {name: 'Laura', age: 25} +``` + +`customTypes` is an object whose keys are the name of the types, and whose values are an object with three properties, `typeOf`, `validate`, and `cast`. For more information about `typeOf` and `validate`, please see the [custom types](https://github.com/gkz/type-check#custom-types) section of type-check. + +`cast` is a function which receives three arguments, the value under question, options, and the typesCast function. In `cast`, attempt to cast the value into the specified type. If you are successful, return an object in the format `{type: 'Just', value: CAST-VALUE}`, if you know it won't work, return `{type: 'Nothing'}`. You can use the `typesCast` function to cast any child values. Remember to pass `options` to it. In your function you can also check for `options.explicit` and act accordingly. + +## Technical About + +`levn` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It uses [type-check](https://github.com/gkz/type-check) to both parse types and validate values. It also uses the [prelude.ls](http://preludels.com/) library. diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/cast.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/cast.js new file mode 100644 index 00000000..2a6816f9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/cast.js @@ -0,0 +1,298 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var parsedTypeCheck, types, toString$ = {}.toString; + parsedTypeCheck = require('type-check').parsedTypeCheck; + types = { + '*': function(value, options){ + switch (toString$.call(value).slice(8, -1)) { + case 'Array': + return typeCast(value, { + type: 'Array' + }, options); + case 'Object': + return typeCast(value, { + type: 'Object' + }, options); + default: + return { + type: 'Just', + value: typesCast(value, [ + { + type: 'Undefined' + }, { + type: 'Null' + }, { + type: 'NaN' + }, { + type: 'Boolean' + }, { + type: 'Number' + }, { + type: 'Date' + }, { + type: 'RegExp' + }, { + type: 'Array' + }, { + type: 'Object' + }, { + type: 'String' + } + ], (options.explicit = true, options)) + }; + } + }, + Undefined: function(it){ + if (it === 'undefined' || it === void 8) { + return { + type: 'Just', + value: void 8 + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Null: function(it){ + if (it === 'null') { + return { + type: 'Just', + value: null + }; + } else { + return { + type: 'Nothing' + }; + } + }, + NaN: function(it){ + if (it === 'NaN') { + return { + type: 'Just', + value: NaN + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Boolean: function(it){ + if (it === 'true') { + return { + type: 'Just', + value: true + }; + } else if (it === 'false') { + return { + type: 'Just', + value: false + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Number: function(it){ + return { + type: 'Just', + value: +it + }; + }, + Int: function(it){ + return { + type: 'Just', + value: parseInt(it) + }; + }, + Float: function(it){ + return { + type: 'Just', + value: parseFloat(it) + }; + }, + Date: function(value, options){ + var that; + if (that = /^\#([\s\S]*)\#$/.exec(value)) { + return { + type: 'Just', + value: new Date(+that[1] || that[1]) + }; + } else if (options.explicit) { + return { + type: 'Nothing' + }; + } else { + return { + type: 'Just', + value: new Date(+value || value) + }; + } + }, + RegExp: function(value, options){ + var that; + if (that = /^\/([\s\S]*)\/([gimy]*)$/.exec(value)) { + return { + type: 'Just', + value: new RegExp(that[1], that[2]) + }; + } else if (options.explicit) { + return { + type: 'Nothing' + }; + } else { + return { + type: 'Just', + value: new RegExp(value) + }; + } + }, + Array: function(value, options){ + return castArray(value, { + of: [{ + type: '*' + }] + }, options); + }, + Object: function(value, options){ + return castFields(value, { + of: {} + }, options); + }, + String: function(it){ + var that; + if (toString$.call(it).slice(8, -1) !== 'String') { + return { + type: 'Nothing' + }; + } + if (that = it.match(/^'([\s\S]*)'$/)) { + return { + type: 'Just', + value: that[1].replace(/\\'/g, "'") + }; + } else if (that = it.match(/^"([\s\S]*)"$/)) { + return { + type: 'Just', + value: that[1].replace(/\\"/g, '"') + }; + } else { + return { + type: 'Just', + value: it + }; + } + } + }; + function castArray(node, type, options){ + var typeOf, element; + if (toString$.call(node).slice(8, -1) !== 'Array') { + return { + type: 'Nothing' + }; + } + typeOf = type.of; + return { + type: 'Just', + value: (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = node).length; i$ < len$; ++i$) { + element = ref$[i$]; + results$.push(typesCast(element, typeOf, options)); + } + return results$; + }()) + }; + } + function castTuple(node, type, options){ + var result, i, i$, ref$, len$, types, cast; + if (toString$.call(node).slice(8, -1) !== 'Array') { + return { + type: 'Nothing' + }; + } + result = []; + i = 0; + for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) { + types = ref$[i$]; + cast = typesCast(node[i], types, options); + if (toString$.call(cast).slice(8, -1) !== 'Undefined') { + result.push(cast); + } + i++; + } + if (node.length <= i) { + return { + type: 'Just', + value: result + }; + } else { + return { + type: 'Nothing' + }; + } + } + function castFields(node, type, options){ + var typeOf, key, value; + if (toString$.call(node).slice(8, -1) !== 'Object') { + return { + type: 'Nothing' + }; + } + typeOf = type.of; + return { + type: 'Just', + value: (function(){ + var ref$, results$ = {}; + for (key in ref$ = node) { + value = ref$[key]; + results$[typesCast(key, [{ + type: 'String' + }], options)] = typesCast(value, typeOf[key] || [{ + type: '*' + }], options); + } + return results$; + }()) + }; + } + function typeCast(node, typeObj, options){ + var type, structure, castFunc, ref$; + type = typeObj.type, structure = typeObj.structure; + if (type) { + castFunc = ((ref$ = options.customTypes[type]) != null ? ref$.cast : void 8) || types[type]; + if (!castFunc) { + throw new Error("Type not defined: " + type + "."); + } + return castFunc(node, options, typesCast); + } else { + switch (structure) { + case 'array': + return castArray(node, typeObj, options); + case 'tuple': + return castTuple(node, typeObj, options); + case 'fields': + return castFields(node, typeObj, options); + } + } + } + function typesCast(node, types, options){ + var i$, len$, type, ref$, valueType, value; + for (i$ = 0, len$ = types.length; i$ < len$; ++i$) { + type = types[i$]; + ref$ = typeCast(node, type, options), valueType = ref$.type, value = ref$.value; + if (valueType === 'Nothing') { + continue; + } + if (parsedTypeCheck([type], value, { + customTypes: options.customTypes + })) { + return value; + } + } + throw new Error("Value " + JSON.stringify(node) + " does not type check against " + JSON.stringify(types) + "."); + } + module.exports = typesCast; +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/coerce.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/coerce.js new file mode 100644 index 00000000..027b6da0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/coerce.js @@ -0,0 +1,285 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var parsedTypeCheck, types, toString$ = {}.toString; + parsedTypeCheck = require('type-check').parsedTypeCheck; + types = { + '*': function(it){ + switch (toString$.call(it).slice(8, -1)) { + case 'Array': + return coerceType(it, { + type: 'Array' + }); + case 'Object': + return coerceType(it, { + type: 'Object' + }); + default: + return { + type: 'Just', + value: coerceTypes(it, [ + { + type: 'Undefined' + }, { + type: 'Null' + }, { + type: 'NaN' + }, { + type: 'Boolean' + }, { + type: 'Number' + }, { + type: 'Date' + }, { + type: 'RegExp' + }, { + type: 'Array' + }, { + type: 'Object' + }, { + type: 'String' + } + ], { + explicit: true + }) + }; + } + }, + Undefined: function(it){ + if (it === 'undefined' || it === void 8) { + return { + type: 'Just', + value: void 8 + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Null: function(it){ + if (it === 'null') { + return { + type: 'Just', + value: null + }; + } else { + return { + type: 'Nothing' + }; + } + }, + NaN: function(it){ + if (it === 'NaN') { + return { + type: 'Just', + value: NaN + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Boolean: function(it){ + if (it === 'true') { + return { + type: 'Just', + value: true + }; + } else if (it === 'false') { + return { + type: 'Just', + value: false + }; + } else { + return { + type: 'Nothing' + }; + } + }, + Number: function(it){ + return { + type: 'Just', + value: +it + }; + }, + Int: function(it){ + return { + type: 'Just', + value: parseInt(it) + }; + }, + Float: function(it){ + return { + type: 'Just', + value: parseFloat(it) + }; + }, + Date: function(value, options){ + var that; + if (that = /^\#(.*)\#$/.exec(value)) { + return { + type: 'Just', + value: new Date(+that[1] || that[1]) + }; + } else if (options.explicit) { + return { + type: 'Nothing' + }; + } else { + return { + type: 'Just', + value: new Date(+value || value) + }; + } + }, + RegExp: function(value, options){ + var that; + if (that = /^\/(.*)\/([gimy]*)$/.exec(value)) { + return { + type: 'Just', + value: new RegExp(that[1], that[2]) + }; + } else if (options.explicit) { + return { + type: 'Nothing' + }; + } else { + return { + type: 'Just', + value: new RegExp(value) + }; + } + }, + Array: function(it){ + return coerceArray(it, { + of: [{ + type: '*' + }] + }); + }, + Object: function(it){ + return coerceFields(it, { + of: {} + }); + }, + String: function(it){ + var that; + if (toString$.call(it).slice(8, -1) !== 'String') { + return { + type: 'Nothing' + }; + } + if (that = it.match(/^'(.*)'$/)) { + return { + type: 'Just', + value: that[1] + }; + } else if (that = it.match(/^"(.*)"$/)) { + return { + type: 'Just', + value: that[1] + }; + } else { + return { + type: 'Just', + value: it + }; + } + } + }; + function coerceArray(node, type){ + var typeOf, element; + if (toString$.call(node).slice(8, -1) !== 'Array') { + return { + type: 'Nothing' + }; + } + typeOf = type.of; + return { + type: 'Just', + value: (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = node).length; i$ < len$; ++i$) { + element = ref$[i$]; + results$.push(coerceTypes(element, typeOf)); + } + return results$; + }()) + }; + } + function coerceTuple(node, type){ + var result, i$, ref$, len$, i, types, that; + if (toString$.call(node).slice(8, -1) !== 'Array') { + return { + type: 'Nothing' + }; + } + result = []; + for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) { + i = i$; + types = ref$[i$]; + if (that = coerceTypes(node[i], types)) { + result.push(that); + } + } + return { + type: 'Just', + value: result + }; + } + function coerceFields(node, type){ + var typeOf, key, value; + if (toString$.call(node).slice(8, -1) !== 'Object') { + return { + type: 'Nothing' + }; + } + typeOf = type.of; + return { + type: 'Just', + value: (function(){ + var ref$, results$ = {}; + for (key in ref$ = node) { + value = ref$[key]; + results$[key] = coerceTypes(value, typeOf[key] || [{ + type: '*' + }]); + } + return results$; + }()) + }; + } + function coerceType(node, typeObj, options){ + var type, structure, coerceFunc; + type = typeObj.type, structure = typeObj.structure; + if (type) { + coerceFunc = types[type]; + return coerceFunc(node, options); + } else { + switch (structure) { + case 'array': + return coerceArray(node, typeObj); + case 'tuple': + return coerceTuple(node, typeObj); + case 'fields': + return coerceFields(node, typeObj); + } + } + } + function coerceTypes(node, types, options){ + var i$, len$, type, ref$, valueType, value; + for (i$ = 0, len$ = types.length; i$ < len$; ++i$) { + type = types[i$]; + ref$ = coerceType(node, type, options), valueType = ref$.type, value = ref$.value; + if (valueType === 'Nothing') { + continue; + } + if (parsedTypeCheck([type], value)) { + return value; + } + } + throw new Error("Value " + JSON.stringify(node) + " does not type check against " + JSON.stringify(types) + "."); + } + module.exports = coerceTypes; +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/index.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/index.js new file mode 100644 index 00000000..54b5769e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/index.js @@ -0,0 +1,22 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var parseString, cast, parseType, VERSION, parsedTypeParse, parse; + parseString = require('./parse-string'); + cast = require('./cast'); + parseType = require('type-check').parseType; + VERSION = '0.2.5'; + parsedTypeParse = function(parsedType, string, options){ + options == null && (options = {}); + options.explicit == null && (options.explicit = false); + options.customTypes == null && (options.customTypes = {}); + return cast(parseString(parsedType, string, options), parsedType, options); + }; + parse = function(type, string, options){ + return parsedTypeParse(parseType(type), string, options); + }; + module.exports = { + VERSION: VERSION, + parse: parse, + parsedTypeParse: parsedTypeParse + }; +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/parse-string.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/parse-string.js new file mode 100644 index 00000000..65ec755c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/parse-string.js @@ -0,0 +1,113 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var reject, special, tokenRegex; + reject = require('prelude-ls').reject; + function consumeOp(tokens, op){ + if (tokens[0] === op) { + return tokens.shift(); + } else { + throw new Error("Expected '" + op + "', but got '" + tokens[0] + "' instead in " + JSON.stringify(tokens) + "."); + } + } + function maybeConsumeOp(tokens, op){ + if (tokens[0] === op) { + return tokens.shift(); + } + } + function consumeList(tokens, arg$, hasDelimiters){ + var open, close, result, untilTest; + open = arg$[0], close = arg$[1]; + if (hasDelimiters) { + consumeOp(tokens, open); + } + result = []; + untilTest = "," + (hasDelimiters ? close : ''); + while (tokens.length && (hasDelimiters && tokens[0] !== close)) { + result.push(consumeElement(tokens, untilTest)); + maybeConsumeOp(tokens, ','); + } + if (hasDelimiters) { + consumeOp(tokens, close); + } + return result; + } + function consumeArray(tokens, hasDelimiters){ + return consumeList(tokens, ['[', ']'], hasDelimiters); + } + function consumeTuple(tokens, hasDelimiters){ + return consumeList(tokens, ['(', ')'], hasDelimiters); + } + function consumeFields(tokens, hasDelimiters){ + var result, untilTest, key; + if (hasDelimiters) { + consumeOp(tokens, '{'); + } + result = {}; + untilTest = "," + (hasDelimiters ? '}' : ''); + while (tokens.length && (!hasDelimiters || tokens[0] !== '}')) { + key = consumeValue(tokens, ':'); + consumeOp(tokens, ':'); + result[key] = consumeElement(tokens, untilTest); + maybeConsumeOp(tokens, ','); + } + if (hasDelimiters) { + consumeOp(tokens, '}'); + } + return result; + } + function consumeValue(tokens, untilTest){ + var out; + untilTest == null && (untilTest = ''); + out = ''; + while (tokens.length && -1 === untilTest.indexOf(tokens[0])) { + out += tokens.shift(); + } + return out; + } + function consumeElement(tokens, untilTest){ + switch (tokens[0]) { + case '[': + return consumeArray(tokens, true); + case '(': + return consumeTuple(tokens, true); + case '{': + return consumeFields(tokens, true); + default: + return consumeValue(tokens, untilTest); + } + } + function consumeTopLevel(tokens, types, options){ + var ref$, type, structure, origTokens, result, finalResult, x$, y$; + ref$ = types[0], type = ref$.type, structure = ref$.structure; + origTokens = tokens.concat(); + if (!options.explicit && types.length === 1 && ((!type && structure) || (type === 'Array' || type === 'Object'))) { + result = structure === 'array' || type === 'Array' + ? consumeArray(tokens, tokens[0] === '[') + : structure === 'tuple' + ? consumeTuple(tokens, tokens[0] === '(') + : consumeFields(tokens, tokens[0] === '{'); + finalResult = tokens.length ? consumeElement(structure === 'array' || type === 'Array' + ? (x$ = origTokens, x$.unshift('['), x$.push(']'), x$) + : (y$ = origTokens, y$.unshift('('), y$.push(')'), y$)) : result; + } else { + finalResult = consumeElement(tokens); + } + return finalResult; + } + special = /\[\]\(\)}{:,/.source; + tokenRegex = RegExp('("(?:\\\\"|[^"])*")|(\'(?:\\\\\'|[^\'])*\')|(/(?:\\\\/|[^/])*/[a-zA-Z]*)|(#.*#)|([' + special + '])|([^\\s' + special + '](?:\\s*[^\\s' + special + ']+)*)|\\s*'); + module.exports = function(types, string, options){ + var tokens, node; + options == null && (options = {}); + if (!options.explicit && types.length === 1 && types[0].type === 'String') { + return "'" + string.replace(/\\'/g, "\\\\'") + "'"; + } + tokens = reject(not$, string.split(tokenRegex)); + node = consumeTopLevel(tokens, types, options); + if (!node) { + throw new Error("Error parsing '" + string + "'."); + } + return node; + }; + function not$(x){ return !x; } +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/parse.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/parse.js new file mode 100644 index 00000000..2beff0f4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/lib/parse.js @@ -0,0 +1,102 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var reject, special, tokenRegex; + reject = require('prelude-ls').reject; + function consumeOp(tokens, op){ + if (tokens[0] === op) { + return tokens.shift(); + } else { + throw new Error("Expected '" + op + "', but got '" + tokens[0] + "' instead in " + JSON.stringify(tokens) + "."); + } + } + function maybeConsumeOp(tokens, op){ + if (tokens[0] === op) { + return tokens.shift(); + } + } + function consumeList(tokens, delimiters, hasDelimiters){ + var result; + if (hasDelimiters) { + consumeOp(tokens, delimiters[0]); + } + result = []; + while (tokens.length && tokens[0] !== delimiters[1]) { + result.push(consumeElement(tokens)); + maybeConsumeOp(tokens, ','); + } + if (hasDelimiters) { + consumeOp(tokens, delimiters[1]); + } + return result; + } + function consumeArray(tokens, hasDelimiters){ + return consumeList(tokens, ['[', ']'], hasDelimiters); + } + function consumeTuple(tokens, hasDelimiters){ + return consumeList(tokens, ['(', ')'], hasDelimiters); + } + function consumeFields(tokens, hasDelimiters){ + var result, key; + if (hasDelimiters) { + consumeOp(tokens, '{'); + } + result = {}; + while (tokens.length && (!hasDelimiters || tokens[0] !== '}')) { + key = tokens.shift(); + consumeOp(tokens, ':'); + result[key] = consumeElement(tokens); + maybeConsumeOp(tokens, ','); + } + if (hasDelimiters) { + consumeOp(tokens, '}'); + } + return result; + } + function consumeElement(tokens){ + switch (tokens[0]) { + case '[': + return consumeArray(tokens, true); + case '(': + return consumeTuple(tokens, true); + case '{': + return consumeFields(tokens, true); + default: + return tokens.shift(); + } + } + function consumeTopLevel(tokens, types){ + var ref$, type, structure, origTokens, result, finalResult, x$, y$; + ref$ = types[0], type = ref$.type, structure = ref$.structure; + origTokens = tokens.concat(); + if (types.length === 1 && (structure || (type === 'Array' || type === 'Object'))) { + result = structure === 'array' || type === 'Array' + ? consumeArray(tokens, tokens[0] === '[') + : structure === 'tuple' + ? consumeTuple(tokens, tokens[0] === '(') + : consumeFields(tokens, tokens[0] === '{'); + finalResult = tokens.length ? consumeElement(structure === 'array' || type === 'Array' + ? (x$ = origTokens, x$.unshift('['), x$.push(']'), x$) + : (y$ = origTokens, y$.unshift('('), y$.push(')'), y$)) : result; + } else { + finalResult = consumeElement(tokens); + } + if (tokens.length && origTokens.length) { + throw new Error("Unable to parse " + JSON.stringify(origTokens) + " of type " + JSON.stringify(types) + "."); + } else { + return finalResult; + } + } + special = /\[\]\(\)}{:,/.source; + tokenRegex = RegExp('("(?:[^"]|\\\\")*")|(\'(?:[^\']|\\\\\')*\')|(#.*#)|(/(?:\\\\/|[^/])*/[gimy]*)|([' + special + '])|([^\\s' + special + ']+)|\\s*'); + module.exports = function(string, types){ + var tokens, node; + tokens = reject(function(it){ + return !it || /^\s+$/.test(it); + }, string.split(tokenRegex)); + node = consumeTopLevel(tokens, types); + if (!node) { + throw new Error("Error parsing '" + string + "'."); + } + return node; + }; +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/package.json b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/package.json new file mode 100644 index 00000000..bc7269b1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/levn/package.json @@ -0,0 +1,78 @@ +{ + "name": "levn", + "version": "0.2.5", + "author": { + "name": "George Zahariev", + "email": "z@georgezahariev.com" + }, + "description": "Light ECMAScript (JavaScript) Value Notation - human written, concise, typed, flexible", + "homepage": "https://github.com/gkz/levn", + "keywords": [ + "levn", + "light", + "ecmascript", + "value", + "notation", + "json", + "typed", + "human", + "concise", + "typed", + "flexible" + ], + "files": [ + "lib", + "README.md", + "LICENSE" + ], + "main": "./lib/", + "bugs": { + "url": "https://github.com/gkz/levn/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://raw.github.com/gkz/levn/master/LICENSE" + } + ], + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/levn.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "prelude-ls": "~1.1.0", + "type-check": "~0.3.1" + }, + "devDependencies": { + "LiveScript": "~1.2.0", + "mocha": "~1.8.2", + "istanbul": "~0.1.43" + }, + "_id": "levn@0.2.5", + "dist": { + "shasum": "ba8d339d0ca4a610e3a3f145b9caf48807155054", + "tarball": "http://registry.npmjs.org/levn/-/levn-0.2.5.tgz" + }, + "_from": "levn@>=0.2.5 <0.3.0", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "gkz", + "email": "z@georgezahariev.com" + }, + "maintainers": [ + { + "name": "gkz", + "email": "z@georgezahariev.com" + } + ], + "directories": {}, + "_shasum": "ba8d339d0ca4a610e3a3f145b9caf48807155054", + "_resolved": "https://registry.npmjs.org/levn/-/levn-0.2.5.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/LICENSE new file mode 100644 index 00000000..525b1185 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +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/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/README.md b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/README.md new file mode 100644 index 00000000..fabc212e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/README.md @@ -0,0 +1,15 @@ +# prelude.ls [![Build Status](https://travis-ci.org/gkz/prelude-ls.png?branch=master)](https://travis-ci.org/gkz/prelude-ls) + +is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, LiveScript. + +See **[the prelude.ls site](http://preludels.com)** for examples, a reference, and more. + +You can install via npm `npm install prelude-ls` + +### Development + +`make test` to test + +`make build` to build `lib` from `src` + +`make build-browser` to build browser versions diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Func.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Func.js new file mode 100644 index 00000000..7af0b197 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Func.js @@ -0,0 +1,45 @@ +// Generated by LiveScript 1.2.0 +var apply, curry, flip, fix, over; +apply = curry$(function(f, list){ + return f.apply(null, list); +}); +curry = function(f){ + return curry$(f); +}; +flip = curry$(function(f, x, y){ + return f(y, x); +}); +fix = function(f){ + return function(g){ + return function(){ + return f(g(g)).apply(null, arguments); + }; + }(function(g){ + return function(){ + return f(g(g)).apply(null, arguments); + }; + }); +}; +over = curry$(function(f, g, x, y){ + return f(g(x), g(y)); +}); +module.exports = { + curry: curry, + flip: flip, + fix: fix, + apply: apply, + over: over +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/List.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/List.js new file mode 100644 index 00000000..02e73528 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/List.js @@ -0,0 +1,677 @@ +// Generated by LiveScript 1.2.0 +var each, map, compact, filter, reject, partition, find, head, first, tail, last, initial, empty, reverse, unique, uniqueBy, fold, foldl, fold1, foldl1, foldr, foldr1, unfoldr, concat, concatMap, flatten, difference, intersection, union, countBy, groupBy, andList, orList, any, all, sort, sortWith, sortBy, sum, product, mean, average, maximum, minimum, maximumBy, minimumBy, scan, scanl, scan1, scanl1, scanr, scanr1, slice, take, drop, splitAt, takeWhile, dropWhile, span, breakList, zip, zipWith, zipAll, zipAllWith, at, elemIndex, elemIndices, findIndex, findIndices, toString$ = {}.toString, slice$ = [].slice; +each = curry$(function(f, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + f(x); + } + return xs; +}); +map = curry$(function(f, xs){ + var i$, len$, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + results$.push(f(x)); + } + return results$; +}); +compact = function(xs){ + var i$, len$, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (x) { + results$.push(x); + } + } + return results$; +}; +filter = curry$(function(f, xs){ + var i$, len$, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (f(x)) { + results$.push(x); + } + } + return results$; +}); +reject = curry$(function(f, xs){ + var i$, len$, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (!f(x)) { + results$.push(x); + } + } + return results$; +}); +partition = curry$(function(f, xs){ + var passed, failed, i$, len$, x; + passed = []; + failed = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + (f(x) ? passed : failed).push(x); + } + return [passed, failed]; +}); +find = curry$(function(f, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (f(x)) { + return x; + } + } +}); +head = first = function(xs){ + return xs[0]; +}; +tail = function(xs){ + if (!xs.length) { + return; + } + return xs.slice(1); +}; +last = function(xs){ + return xs[xs.length - 1]; +}; +initial = function(xs){ + if (!xs.length) { + return; + } + return xs.slice(0, -1); +}; +empty = function(xs){ + return !xs.length; +}; +reverse = function(xs){ + return xs.concat().reverse(); +}; +unique = function(xs){ + var result, i$, len$, x; + result = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (!in$(x, result)) { + result.push(x); + } + } + return result; +}; +uniqueBy = curry$(function(f, xs){ + var seen, i$, len$, x, val, results$ = []; + seen = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + val = f(x); + if (in$(val, seen)) { + continue; + } + seen.push(val); + results$.push(x); + } + return results$; +}); +fold = foldl = curry$(function(f, memo, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + memo = f(memo, x); + } + return memo; +}); +fold1 = foldl1 = curry$(function(f, xs){ + return fold(f, xs[0], xs.slice(1)); +}); +foldr = curry$(function(f, memo, xs){ + var i$, x; + for (i$ = xs.length - 1; i$ >= 0; --i$) { + x = xs[i$]; + memo = f(x, memo); + } + return memo; +}); +foldr1 = curry$(function(f, xs){ + return foldr(f, xs[xs.length - 1], xs.slice(0, -1)); +}); +unfoldr = curry$(function(f, b){ + var result, x, that; + result = []; + x = b; + while ((that = f(x)) != null) { + result.push(that[0]); + x = that[1]; + } + return result; +}); +concat = function(xss){ + return [].concat.apply([], xss); +}; +concatMap = curry$(function(f, xs){ + var x; + return [].concat.apply([], (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) { + x = ref$[i$]; + results$.push(f(x)); + } + return results$; + }())); +}); +flatten = function(xs){ + var x; + return [].concat.apply([], (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (toString$.call(x).slice(8, -1) === 'Array') { + results$.push(flatten(x)); + } else { + results$.push(x); + } + } + return results$; + }())); +}; +difference = function(xs){ + var yss, results, i$, len$, x, j$, len1$, ys; + yss = slice$.call(arguments, 1); + results = []; + outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) { + ys = yss[j$]; + if (in$(x, ys)) { + continue outer; + } + } + results.push(x); + } + return results; +}; +intersection = function(xs){ + var yss, results, i$, len$, x, j$, len1$, ys; + yss = slice$.call(arguments, 1); + results = []; + outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) { + ys = yss[j$]; + if (!in$(x, ys)) { + continue outer; + } + } + results.push(x); + } + return results; +}; +union = function(){ + var xss, results, i$, len$, xs, j$, len1$, x; + xss = slice$.call(arguments); + results = []; + for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) { + xs = xss[i$]; + for (j$ = 0, len1$ = xs.length; j$ < len1$; ++j$) { + x = xs[j$]; + if (!in$(x, results)) { + results.push(x); + } + } + } + return results; +}; +countBy = curry$(function(f, xs){ + var results, i$, len$, x, key; + results = {}; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + key = f(x); + if (key in results) { + results[key] += 1; + } else { + results[key] = 1; + } + } + return results; +}); +groupBy = curry$(function(f, xs){ + var results, i$, len$, x, key; + results = {}; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + key = f(x); + if (key in results) { + results[key].push(x); + } else { + results[key] = [x]; + } + } + return results; +}); +andList = function(xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (!x) { + return false; + } + } + return true; +}; +orList = function(xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (x) { + return true; + } + } + return false; +}; +any = curry$(function(f, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (f(x)) { + return true; + } + } + return false; +}); +all = curry$(function(f, xs){ + var i$, len$, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + if (!f(x)) { + return false; + } + } + return true; +}); +sort = function(xs){ + return xs.concat().sort(function(x, y){ + if (x > y) { + return 1; + } else if (x < y) { + return -1; + } else { + return 0; + } + }); +}; +sortWith = curry$(function(f, xs){ + return xs.concat().sort(f); +}); +sortBy = curry$(function(f, xs){ + return xs.concat().sort(function(x, y){ + if (f(x) > f(y)) { + return 1; + } else if (f(x) < f(y)) { + return -1; + } else { + return 0; + } + }); +}); +sum = function(xs){ + var result, i$, len$, x; + result = 0; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + result += x; + } + return result; +}; +product = function(xs){ + var result, i$, len$, x; + result = 1; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + result *= x; + } + return result; +}; +mean = average = function(xs){ + var sum, i$, len$, x; + sum = 0; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + x = xs[i$]; + sum += x; + } + return sum / xs.length; +}; +maximum = function(xs){ + var max, i$, ref$, len$, x; + max = xs[0]; + for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (x > max) { + max = x; + } + } + return max; +}; +minimum = function(xs){ + var min, i$, ref$, len$, x; + min = xs[0]; + for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (x < min) { + min = x; + } + } + return min; +}; +maximumBy = curry$(function(f, xs){ + var max, i$, ref$, len$, x; + max = xs[0]; + for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (f(x) > f(max)) { + max = x; + } + } + return max; +}); +minimumBy = curry$(function(f, xs){ + var min, i$, ref$, len$, x; + min = xs[0]; + for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) { + x = ref$[i$]; + if (f(x) < f(min)) { + min = x; + } + } + return min; +}); +scan = scanl = curry$(function(f, memo, xs){ + var last, x; + last = memo; + return [memo].concat((function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) { + x = ref$[i$]; + results$.push(last = f(last, x)); + } + return results$; + }())); +}); +scan1 = scanl1 = curry$(function(f, xs){ + if (!xs.length) { + return; + } + return scan(f, xs[0], xs.slice(1)); +}); +scanr = curry$(function(f, memo, xs){ + xs = xs.concat().reverse(); + return scan(f, memo, xs).reverse(); +}); +scanr1 = curry$(function(f, xs){ + if (!xs.length) { + return; + } + xs = xs.concat().reverse(); + return scan(f, xs[0], xs.slice(1)).reverse(); +}); +slice = curry$(function(x, y, xs){ + return xs.slice(x, y); +}); +take = curry$(function(n, xs){ + if (n <= 0) { + return xs.slice(0, 0); + } else { + return xs.slice(0, n); + } +}); +drop = curry$(function(n, xs){ + if (n <= 0) { + return xs; + } else { + return xs.slice(n); + } +}); +splitAt = curry$(function(n, xs){ + return [take(n, xs), drop(n, xs)]; +}); +takeWhile = curry$(function(p, xs){ + var len, i; + len = xs.length; + if (!len) { + return xs; + } + i = 0; + while (i < len && p(xs[i])) { + i += 1; + } + return xs.slice(0, i); +}); +dropWhile = curry$(function(p, xs){ + var len, i; + len = xs.length; + if (!len) { + return xs; + } + i = 0; + while (i < len && p(xs[i])) { + i += 1; + } + return xs.slice(i); +}); +span = curry$(function(p, xs){ + return [takeWhile(p, xs), dropWhile(p, xs)]; +}); +breakList = curry$(function(p, xs){ + return span(function(){ + return not$(p.apply(this, arguments)); + }, xs); +}); +zip = curry$(function(xs, ys){ + var result, len, i$, len$, i, x; + result = []; + len = ys.length; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (i === len) { + break; + } + result.push([x, ys[i]]); + } + return result; +}); +zipWith = curry$(function(f, xs, ys){ + var result, len, i$, len$, i, x; + result = []; + len = ys.length; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (i === len) { + break; + } + result.push(f(x, ys[i])); + } + return result; +}); +zipAll = function(){ + var xss, minLength, i$, len$, xs, ref$, i, lresult$, j$, results$ = []; + xss = slice$.call(arguments); + minLength = 9e9; + for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) { + xs = xss[i$]; + minLength <= (ref$ = xs.length) || (minLength = ref$); + } + for (i$ = 0; i$ < minLength; ++i$) { + i = i$; + lresult$ = []; + for (j$ = 0, len$ = xss.length; j$ < len$; ++j$) { + xs = xss[j$]; + lresult$.push(xs[i]); + } + results$.push(lresult$); + } + return results$; +}; +zipAllWith = function(f){ + var xss, minLength, i$, len$, xs, ref$, i, results$ = []; + xss = slice$.call(arguments, 1); + minLength = 9e9; + for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) { + xs = xss[i$]; + minLength <= (ref$ = xs.length) || (minLength = ref$); + } + for (i$ = 0; i$ < minLength; ++i$) { + i = i$; + results$.push(f.apply(null, (fn$()))); + } + return results$; + function fn$(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = xss).length; i$ < len$; ++i$) { + xs = ref$[i$]; + results$.push(xs[i]); + } + return results$; + } +}; +at = curry$(function(n, xs){ + if (n < 0) { + return xs[xs.length + n]; + } else { + return xs[n]; + } +}); +elemIndex = curry$(function(el, xs){ + var i$, len$, i, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (x === el) { + return i; + } + } +}); +elemIndices = curry$(function(el, xs){ + var i$, len$, i, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (x === el) { + results$.push(i); + } + } + return results$; +}); +findIndex = curry$(function(f, xs){ + var i$, len$, i, x; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (f(x)) { + return i; + } + } +}); +findIndices = curry$(function(f, xs){ + var i$, len$, i, x, results$ = []; + for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { + i = i$; + x = xs[i$]; + if (f(x)) { + results$.push(i); + } + } + return results$; +}); +module.exports = { + each: each, + map: map, + filter: filter, + compact: compact, + reject: reject, + partition: partition, + find: find, + head: head, + first: first, + tail: tail, + last: last, + initial: initial, + empty: empty, + reverse: reverse, + difference: difference, + intersection: intersection, + union: union, + countBy: countBy, + groupBy: groupBy, + fold: fold, + fold1: fold1, + foldl: foldl, + foldl1: foldl1, + foldr: foldr, + foldr1: foldr1, + unfoldr: unfoldr, + andList: andList, + orList: orList, + any: any, + all: all, + unique: unique, + uniqueBy: uniqueBy, + sort: sort, + sortWith: sortWith, + sortBy: sortBy, + sum: sum, + product: product, + mean: mean, + average: average, + concat: concat, + concatMap: concatMap, + flatten: flatten, + maximum: maximum, + minimum: minimum, + maximumBy: maximumBy, + minimumBy: minimumBy, + scan: scan, + scan1: scan1, + scanl: scanl, + scanl1: scanl1, + scanr: scanr, + scanr1: scanr1, + slice: slice, + take: take, + drop: drop, + splitAt: splitAt, + takeWhile: takeWhile, + dropWhile: dropWhile, + span: span, + breakList: breakList, + zip: zip, + zipWith: zipWith, + zipAll: zipAll, + zipAllWith: zipAllWith, + at: at, + elemIndex: elemIndex, + elemIndices: elemIndices, + findIndex: findIndex, + findIndices: findIndices +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} +function in$(x, xs){ + var i = -1, l = xs.length >>> 0; + while (++i < l) if (x === xs[i]) return true; + return false; +} +function not$(x){ return !x; } \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Num.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Num.js new file mode 100644 index 00000000..904b6cd5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Num.js @@ -0,0 +1,130 @@ +// Generated by LiveScript 1.2.0 +var max, min, negate, abs, signum, quot, rem, div, mod, recip, pi, tau, exp, sqrt, ln, pow, sin, tan, cos, asin, acos, atan, atan2, truncate, round, ceiling, floor, isItNaN, even, odd, gcd, lcm; +max = curry$(function(x$, y$){ + return x$ > y$ ? x$ : y$; +}); +min = curry$(function(x$, y$){ + return x$ < y$ ? x$ : y$; +}); +negate = function(x){ + return -x; +}; +abs = Math.abs; +signum = function(x){ + if (x < 0) { + return -1; + } else if (x > 0) { + return 1; + } else { + return 0; + } +}; +quot = curry$(function(x, y){ + return ~~(x / y); +}); +rem = curry$(function(x$, y$){ + return x$ % y$; +}); +div = curry$(function(x, y){ + return Math.floor(x / y); +}); +mod = curry$(function(x$, y$){ + var ref$; + return ((x$) % (ref$ = y$) + ref$) % ref$; +}); +recip = (function(it){ + return 1 / it; +}); +pi = Math.PI; +tau = pi * 2; +exp = Math.exp; +sqrt = Math.sqrt; +ln = Math.log; +pow = curry$(function(x$, y$){ + return Math.pow(x$, y$); +}); +sin = Math.sin; +tan = Math.tan; +cos = Math.cos; +asin = Math.asin; +acos = Math.acos; +atan = Math.atan; +atan2 = curry$(function(x, y){ + return Math.atan2(x, y); +}); +truncate = function(x){ + return ~~x; +}; +round = Math.round; +ceiling = Math.ceil; +floor = Math.floor; +isItNaN = function(x){ + return x !== x; +}; +even = function(x){ + return x % 2 === 0; +}; +odd = function(x){ + return x % 2 !== 0; +}; +gcd = curry$(function(x, y){ + var z; + x = Math.abs(x); + y = Math.abs(y); + while (y !== 0) { + z = x % y; + x = y; + y = z; + } + return x; +}); +lcm = curry$(function(x, y){ + return Math.abs(Math.floor(x / gcd(x, y) * y)); +}); +module.exports = { + max: max, + min: min, + negate: negate, + abs: abs, + signum: signum, + quot: quot, + rem: rem, + div: div, + mod: mod, + recip: recip, + pi: pi, + tau: tau, + exp: exp, + sqrt: sqrt, + ln: ln, + pow: pow, + sin: sin, + tan: tan, + cos: cos, + acos: acos, + asin: asin, + atan: atan, + atan2: atan2, + truncate: truncate, + round: round, + ceiling: ceiling, + floor: floor, + isItNaN: isItNaN, + even: even, + odd: odd, + gcd: gcd, + lcm: lcm +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Obj.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Obj.js new file mode 100644 index 00000000..bb244d8e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Obj.js @@ -0,0 +1,154 @@ +// Generated by LiveScript 1.2.0 +var values, keys, pairsToObj, objToPairs, listsToObj, objToLists, empty, each, map, compact, filter, reject, partition, find; +values = function(object){ + var i$, x, results$ = []; + for (i$ in object) { + x = object[i$]; + results$.push(x); + } + return results$; +}; +keys = function(object){ + var x, results$ = []; + for (x in object) { + results$.push(x); + } + return results$; +}; +pairsToObj = function(object){ + var i$, len$, x, results$ = {}; + for (i$ = 0, len$ = object.length; i$ < len$; ++i$) { + x = object[i$]; + results$[x[0]] = x[1]; + } + return results$; +}; +objToPairs = function(object){ + var key, value, results$ = []; + for (key in object) { + value = object[key]; + results$.push([key, value]); + } + return results$; +}; +listsToObj = curry$(function(keys, values){ + var i$, len$, i, key, results$ = {}; + for (i$ = 0, len$ = keys.length; i$ < len$; ++i$) { + i = i$; + key = keys[i$]; + results$[key] = values[i]; + } + return results$; +}); +objToLists = function(object){ + var keys, values, key, value; + keys = []; + values = []; + for (key in object) { + value = object[key]; + keys.push(key); + values.push(value); + } + return [keys, values]; +}; +empty = function(object){ + var x; + for (x in object) { + return false; + } + return true; +}; +each = curry$(function(f, object){ + var i$, x; + for (i$ in object) { + x = object[i$]; + f(x); + } + return object; +}); +map = curry$(function(f, object){ + var k, x, results$ = {}; + for (k in object) { + x = object[k]; + results$[k] = f(x); + } + return results$; +}); +compact = function(object){ + var k, x, results$ = {}; + for (k in object) { + x = object[k]; +if (x) { + results$[k] = x; + } + } + return results$; +}; +filter = curry$(function(f, object){ + var k, x, results$ = {}; + for (k in object) { + x = object[k]; +if (f(x)) { + results$[k] = x; + } + } + return results$; +}); +reject = curry$(function(f, object){ + var k, x, results$ = {}; + for (k in object) { + x = object[k]; +if (!f(x)) { + results$[k] = x; + } + } + return results$; +}); +partition = curry$(function(f, object){ + var passed, failed, k, x; + passed = {}; + failed = {}; + for (k in object) { + x = object[k]; + (f(x) ? passed : failed)[k] = x; + } + return [passed, failed]; +}); +find = curry$(function(f, object){ + var i$, x; + for (i$ in object) { + x = object[i$]; + if (f(x)) { + return x; + } + } +}); +module.exports = { + values: values, + keys: keys, + pairsToObj: pairsToObj, + objToPairs: objToPairs, + listsToObj: listsToObj, + objToLists: objToLists, + empty: empty, + each: each, + map: map, + filter: filter, + compact: compact, + reject: reject, + partition: partition, + find: find +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Str.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Str.js new file mode 100644 index 00000000..c1b34246 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/Str.js @@ -0,0 +1,92 @@ +// Generated by LiveScript 1.2.0 +var split, join, lines, unlines, words, unwords, chars, unchars, reverse, repeat, capitalize, camelize, dasherize; +split = curry$(function(sep, str){ + return str.split(sep); +}); +join = curry$(function(sep, xs){ + return xs.join(sep); +}); +lines = function(str){ + if (!str.length) { + return []; + } + return str.split('\n'); +}; +unlines = function(it){ + return it.join('\n'); +}; +words = function(str){ + if (!str.length) { + return []; + } + return str.split(/[ ]+/); +}; +unwords = function(it){ + return it.join(' '); +}; +chars = function(it){ + return it.split(''); +}; +unchars = function(it){ + return it.join(''); +}; +reverse = function(str){ + return str.split('').reverse().join(''); +}; +repeat = curry$(function(n, str){ + var result, i$; + result = ''; + for (i$ = 0; i$ < n; ++i$) { + result += str; + } + return result; +}); +capitalize = function(str){ + return str.charAt(0).toUpperCase() + str.slice(1); +}; +camelize = function(it){ + return it.replace(/[-_]+(.)?/g, function(arg$, c){ + return (c != null ? c : '').toUpperCase(); + }); +}; +dasherize = function(str){ + return str.replace(/([^-A-Z])([A-Z]+)/g, function(arg$, lower, upper){ + return lower + "-" + (upper.length > 1 + ? upper + : upper.toLowerCase()); + }).replace(/^([A-Z]+)/, function(arg$, upper){ + if (upper.length > 1) { + return upper + "-"; + } else { + return upper.toLowerCase(); + } + }); +}; +module.exports = { + split: split, + join: join, + lines: lines, + unlines: unlines, + words: words, + unwords: unwords, + chars: chars, + unchars: unchars, + reverse: reverse, + repeat: repeat, + capitalize: capitalize, + camelize: camelize, + dasherize: dasherize +}; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/index.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/index.js new file mode 100644 index 00000000..73014773 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/lib/index.js @@ -0,0 +1,178 @@ +// Generated by LiveScript 1.2.0 +var Func, List, Obj, Str, Num, id, isType, replicate, prelude, toString$ = {}.toString; +Func = require('./Func.js'); +List = require('./List.js'); +Obj = require('./Obj.js'); +Str = require('./Str.js'); +Num = require('./Num.js'); +id = function(x){ + return x; +}; +isType = curry$(function(type, x){ + return toString$.call(x).slice(8, -1) === type; +}); +replicate = curry$(function(n, x){ + var i$, results$ = []; + for (i$ = 0; i$ < n; ++i$) { + results$.push(x); + } + return results$; +}); +Str.empty = List.empty; +Str.slice = List.slice; +Str.take = List.take; +Str.drop = List.drop; +Str.splitAt = List.splitAt; +Str.takeWhile = List.takeWhile; +Str.dropWhile = List.dropWhile; +Str.span = List.span; +Str.breakStr = List.breakList; +prelude = { + Func: Func, + List: List, + Obj: Obj, + Str: Str, + Num: Num, + id: id, + isType: isType, + replicate: replicate +}; +prelude.each = List.each; +prelude.map = List.map; +prelude.filter = List.filter; +prelude.compact = List.compact; +prelude.reject = List.reject; +prelude.partition = List.partition; +prelude.find = List.find; +prelude.head = List.head; +prelude.first = List.first; +prelude.tail = List.tail; +prelude.last = List.last; +prelude.initial = List.initial; +prelude.empty = List.empty; +prelude.reverse = List.reverse; +prelude.difference = List.difference; +prelude.intersection = List.intersection; +prelude.union = List.union; +prelude.countBy = List.countBy; +prelude.groupBy = List.groupBy; +prelude.fold = List.fold; +prelude.foldl = List.foldl; +prelude.fold1 = List.fold1; +prelude.foldl1 = List.foldl1; +prelude.foldr = List.foldr; +prelude.foldr1 = List.foldr1; +prelude.unfoldr = List.unfoldr; +prelude.andList = List.andList; +prelude.orList = List.orList; +prelude.any = List.any; +prelude.all = List.all; +prelude.unique = List.unique; +prelude.uniqueBy = List.uniqueBy; +prelude.sort = List.sort; +prelude.sortWith = List.sortWith; +prelude.sortBy = List.sortBy; +prelude.sum = List.sum; +prelude.product = List.product; +prelude.mean = List.mean; +prelude.average = List.average; +prelude.concat = List.concat; +prelude.concatMap = List.concatMap; +prelude.flatten = List.flatten; +prelude.maximum = List.maximum; +prelude.minimum = List.minimum; +prelude.maximumBy = List.maximumBy; +prelude.minimumBy = List.minimumBy; +prelude.scan = List.scan; +prelude.scanl = List.scanl; +prelude.scan1 = List.scan1; +prelude.scanl1 = List.scanl1; +prelude.scanr = List.scanr; +prelude.scanr1 = List.scanr1; +prelude.slice = List.slice; +prelude.take = List.take; +prelude.drop = List.drop; +prelude.splitAt = List.splitAt; +prelude.takeWhile = List.takeWhile; +prelude.dropWhile = List.dropWhile; +prelude.span = List.span; +prelude.breakList = List.breakList; +prelude.zip = List.zip; +prelude.zipWith = List.zipWith; +prelude.zipAll = List.zipAll; +prelude.zipAllWith = List.zipAllWith; +prelude.at = List.at; +prelude.elemIndex = List.elemIndex; +prelude.elemIndices = List.elemIndices; +prelude.findIndex = List.findIndex; +prelude.findIndices = List.findIndices; +prelude.apply = Func.apply; +prelude.curry = Func.curry; +prelude.flip = Func.flip; +prelude.fix = Func.fix; +prelude.over = Func.over; +prelude.split = Str.split; +prelude.join = Str.join; +prelude.lines = Str.lines; +prelude.unlines = Str.unlines; +prelude.words = Str.words; +prelude.unwords = Str.unwords; +prelude.chars = Str.chars; +prelude.unchars = Str.unchars; +prelude.repeat = Str.repeat; +prelude.capitalize = Str.capitalize; +prelude.camelize = Str.camelize; +prelude.dasherize = Str.dasherize; +prelude.values = Obj.values; +prelude.keys = Obj.keys; +prelude.pairsToObj = Obj.pairsToObj; +prelude.objToPairs = Obj.objToPairs; +prelude.listsToObj = Obj.listsToObj; +prelude.objToLists = Obj.objToLists; +prelude.max = Num.max; +prelude.min = Num.min; +prelude.negate = Num.negate; +prelude.abs = Num.abs; +prelude.signum = Num.signum; +prelude.quot = Num.quot; +prelude.rem = Num.rem; +prelude.div = Num.div; +prelude.mod = Num.mod; +prelude.recip = Num.recip; +prelude.pi = Num.pi; +prelude.tau = Num.tau; +prelude.exp = Num.exp; +prelude.sqrt = Num.sqrt; +prelude.ln = Num.ln; +prelude.pow = Num.pow; +prelude.sin = Num.sin; +prelude.tan = Num.tan; +prelude.cos = Num.cos; +prelude.acos = Num.acos; +prelude.asin = Num.asin; +prelude.atan = Num.atan; +prelude.atan2 = Num.atan2; +prelude.truncate = Num.truncate; +prelude.round = Num.round; +prelude.ceiling = Num.ceiling; +prelude.floor = Num.floor; +prelude.isItNaN = Num.isItNaN; +prelude.even = Num.even; +prelude.odd = Num.odd; +prelude.gcd = Num.gcd; +prelude.lcm = Num.lcm; +prelude.VERSION = '1.1.1'; +module.exports = prelude; +function curry$(f, bound){ + var context, + _curry = function(args) { + return f.length > 1 ? function(){ + var params = args ? args.concat() : []; + context = bound ? context || this : this; + return params.push.apply(params, arguments) < + f.length && arguments.length ? + _curry.call(context, params) : f.apply(context, params); + } : f; + }; + return _curry(); +} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/package.json b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/package.json new file mode 100644 index 00000000..4637f0e6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/prelude-ls/package.json @@ -0,0 +1,77 @@ +{ + "name": "prelude-ls", + "version": "1.1.1", + "author": { + "name": "George Zahariev", + "email": "z@georgezahariev.com" + }, + "description": "prelude.ls is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, LiveScript.", + "keywords": [ + "prelude", + "livescript", + "utility", + "ls", + "coffeescript", + "javascript", + "library", + "functional", + "array", + "list", + "object", + "string" + ], + "main": "lib/", + "files": [ + "lib/", + "README.md", + "LICENSE" + ], + "homepage": "http://preludels.com", + "bugs": { + "url": "https://github.com/gkz/prelude-ls/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://raw.github.com/gkz/prelude-ls/master/LICENSE" + } + ], + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/prelude-ls.git" + }, + "scripts": { + "test": "make test" + }, + "devDependencies": { + "LiveScript": "~1.2.0", + "uglify-js": "~2.4.12", + "mocha": "~1.17.1", + "istanbul": "~0.2.4", + "browserify": "~3.24.13" + }, + "_id": "prelude-ls@1.1.1", + "dist": { + "shasum": "c0b86c1ffd151ad3cc75e7e3fe38d7a1bf33728a", + "tarball": "http://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.1.tgz" + }, + "_from": "prelude-ls@>=1.1.1 <1.2.0", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "gkz", + "email": "z@georgezahariev.com" + }, + "maintainers": [ + { + "name": "gkz", + "email": "z@georgezahariev.com" + } + ], + "directories": {}, + "_shasum": "c0b86c1ffd151ad3cc75e7e3fe38d7a1bf33728a", + "_resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/LICENSE new file mode 100644 index 00000000..525b1185 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) George Zahariev + +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/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/README.md b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/README.md new file mode 100644 index 00000000..0b8c1fd3 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/README.md @@ -0,0 +1,210 @@ +# type-check [![Build Status](https://travis-ci.org/gkz/type-check.png?branch=master)](https://travis-ci.org/gkz/type-check) + + + +`type-check` is a library which allows you to check the types of JavaScript values at runtime with a Haskell like type syntax. It is great for checking external input, for testing, or even for adding a bit of safety to your internal code. It is a major component of [levn](https://github.com/gkz/levn). MIT license. Version 0.3.1. Check out the [demo](http://gkz.github.io/type-check/). + +For updates on `type-check`, [follow me on twitter](https://twitter.com/gkzahariev). + + npm install type-check + +## Quick Examples + +```js +// Basic types: +var typeCheck = require('type-check').typeCheck; +typeCheck('Number', 1); // true +typeCheck('Number', 'str'); // false +typeCheck('Error', new Error); // true +typeCheck('Undefined', undefined); // true + +// Comment +typeCheck('count::Number', 1); // true + +// One type OR another type: +typeCheck('Number | String', 2); // true +typeCheck('Number | String', 'str'); // true + +// Wildcard, matches all types: +typeCheck('*', 2) // true + +// Array, all elements of a single type: +typeCheck('[Number]', [1, 2, 3]); // true +typeCheck('[Number]', [1, 'str', 3]); // false + +// Tuples, or fixed length arrays with elements of different types: +typeCheck('(String, Number)', ['str', 2]); // true +typeCheck('(String, Number)', ['str']); // false +typeCheck('(String, Number)', ['str', 2, 5]); // false + +// Object properties: +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2}); // false +typeCheck('{x: Number, y: Maybe Boolean}', {x: 2}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false, z: 3}); // false +typeCheck('{x: Number, y: Boolean, ...}', {x: 2, y: false, z: 3}); // true + +// A particular type AND object properties: +typeCheck('RegExp{source: String, ...}', /re/i); // true +typeCheck('RegExp{source: String, ...}', {source: 're'}); // false + +// Custom types: +var opt = {customTypes: + {Even: { typeOf: 'Number', validate: function(x) { return x % 2 === 0; }}}}; +typeCheck('Even', 2, opt); // true + +// Nested: +var type = '{a: (String, [Number], {y: Array, ...}), b: Error{message: String, ...}}' +typeCheck(type, {a: ['hi', [1, 2, 3], {y: [1, 'ms']}], b: new Error('oh no')}); // true +``` + +Check out the [type syntax format](#syntax) and [guide](#guide). + +## Usage + +`require('type-check');` returns an object that exposes four properties. `VERSION` is the current version of the library as a string. `typeCheck`, `parseType`, and `parsedTypeCheck` are functions. + +```js +// typeCheck(type, input, options); +typeCheck('Number', 2); // true + +// parseType(type); +var parsedType = parseType('Number'); // object + +// parsedTypeCheck(parsedType, input, options); +parsedTypeCheck(parsedType, 2); // true +``` + +### typeCheck(type, input, options) + +`typeCheck` checks a JavaScript value `input` against `type` written in the [type format](#type-format) (and taking account the optional `options`) and returns whether the `input` matches the `type`. + +##### arguments +* type - `String` - the type written in the [type format](#type-format) which to check against +* input - `*` - any JavaScript value, which is to be checked against the type +* options - `Maybe Object` - an optional parameter specifying additional options, currently the only available option is specifying [custom types](#custom-types) + +##### returns +`Boolean` - whether the input matches the type + +##### example +```js +typeCheck('Number', 2); // true +``` + +### parseType(type) + +`parseType` parses string `type` written in the [type format](#type-format) into an object representing the parsed type. + +##### arguments +* type - `String` - the type written in the [type format](#type-format) which to parse + +##### returns +`Object` - an object in the parsed type format representing the parsed type + +##### example +```js +parseType('Number'); // [{type: 'Number'}] +``` +### parsedTypeCheck(parsedType, input, options) + +`parsedTypeCheck` checks a JavaScript value `input` against parsed `type` in the parsed type format (and taking account the optional `options`) and returns whether the `input` matches the `type`. Use this in conjunction with `parseType` if you are going to use a type more than once. + +##### arguments +* type - `Object` - the type in the parsed type format which to check against +* input - `*` - any JavaScript value, which is to be checked against the type +* options - `Maybe Object` - an optional parameter specifying additional options, currently the only available option is specifying [custom types](#custom-types) + +##### returns +`Boolean` - whether the input matches the type + +##### example +```js +parsedTypeCheck([{type: 'Number'}], 2); // true +var parsedType = parseType('String'); +parsedTypeCheck(parsedType, 'str'); // true +``` + + +## Type Format + +### Syntax + +White space is ignored. The root node is a __Types__. + +* __Identifier__ = `[\$\w]+` - a group of any lower or upper case letters, numbers, underscores, or dollar signs - eg. `String` +* __Type__ = an `Identifier`, an `Identifier` followed by a `Structure`, just a `Structure`, or a wildcard `*` - eg. `String`, `Object{x: Number}`, `{x: Number}`, `Array{0: String, 1: Boolean, length: Number}`, `*` +* __Types__ = optionally a comment (an `Indentifier` followed by a `::`), optionally the identifier `Maybe`, one or more `Type`, separated by `|` - eg. `Number`, `String | Date`, `Maybe Number`, `Maybe Boolean | String` +* __Structure__ = `Fields`, or a `Tuple`, or an `Array` - eg. `{x: Number}`, `(String, Number)`, `[Date]` +* __Fields__ = a `{`, followed one or more `Field` separated by a comma `,` (trailing comma `,` is permitted), optionally an `...` (always preceded by a comma `,`), followed by a `}` - eg. `{x: Number, y: String}`, `{k: Function, ...}` +* __Field__ = an `Identifier`, followed by a colon `:`, followed by `Types` - eg. `x: Date | String`, `y: Boolean` +* __Tuple__ = a `(`, followed by one or more `Types` separated by a comma `,` (trailing comma `,` is permitted), followed by a `)` - eg `(Date)`, `(Number, Date)` +* __Array__ = a `[` followed by exactly one `Types` followed by a `]` - eg. `[Boolean]`, `[Boolean | Null]` + +### Guide + +`type-check` uses `Object.toString` to find out the basic type of a value. Specifically, + +```js +{}.toString.call(VALUE).slice(8, -1) +{}.toString.call(true).slice(8, -1) // 'Boolean' +``` +A basic type, eg. `Number`, uses this check. This is much more versatile than using `typeof` - for example, with `document`, `typeof` produces `'object'` which isn't that useful, and our technique produces `'HTMLDocument'`. + +You may check for multiple types by separating types with a `|`. The checker proceeds from left to right, and passes if the value is any of the types - eg. `String | Boolean` first checks if the value is a string, and then if it is a boolean. If it is none of those, then it returns false. + +Adding a `Maybe` in front of a list of multiple types is the same as also checking for `Null` and `Undefined` - eg. `Maybe String` is equivalent to `Undefined | Null | String`. + +You may add a comment to remind you of what the type is for by following an identifier with a `::` before a type (or multiple types). The comment is simply thrown out. + +The wildcard `*` matches all types. + +There are three types of structures for checking the contents of a value: 'fields', 'tuple', and 'array'. + +If used by itself, a 'fields' structure will pass with any type of object as long as it is an instance of `Object` and the properties pass - this allows for duck typing - eg. `{x: Boolean}`. + +To check if the properties pass, and the value is of a certain type, you can specify the type - eg. `Error{message: String}`. + +If you want to make a field optional, you can simply use `Maybe` - eg. `{x: Boolean, y: Maybe String}` will still pass if `y` is undefined (or null). + +If you don't care if the value has properties beyond what you have specified, you can use the 'etc' operator `...` - eg. `{x: Boolean, ...}` will match an object with an `x` property that is a boolean, and with zero or more other properties. + +For an array, you must specify one or more types (separated by `|`) - it will pass for something of any length as long as each element passes the types provided - eg. `[Number]`, `[Number | String]`. + +A tuple checks for a fixed number of elements, each of a potentially different type. Each element is separated by a comma - eg. `(String, Number)`. + +An array and tuple structure check that the value is of type `Array` by default, but if another type is specified, they will check for that instead - eg. `Int32Array[Number]`. You can use the wildcard `*` to search for any type at all. + +Check out the [type precedence](https://github.com/zaboco/type-precedence) library for type-check. + +## Options + +Options is an object. It is an optional parameter to the `typeCheck` and `parsedTypeCheck` functions. The only current option is `customTypes`. + + +### Custom Types + +__Example:__ + +```js +var options = { + customTypes: { + Even: { + typeOf: 'Number', + validate: function(x) { + return x % 2 === 0; + } + } + } +}; +typeCheck('Even', 2, options); // true +typeCheck('Even', 3, options); // false +``` + +`customTypes` allows you to set up custom types for validation. The value of this is an object. The keys of the object are the types you will be matching. Each value of the object will be an object having a `typeOf` property - a string, and `validate` property - a function. + +The `typeOf` property is the type the value should be, and `validate` is a function which should return true if the value is of that type. `validate` receives one parameter, which is the value that we are checking. + +## Technical About + +`type-check` is written in [LiveScript](http://livescript.net/) - a language that compiles to JavaScript. It also uses the [prelude.ls](http://preludels.com/) library. diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/lib/check.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/lib/check.js new file mode 100644 index 00000000..c1e51ff9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/lib/check.js @@ -0,0 +1,126 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var ref$, any, all, isItNaN, types, defaultType, customTypes, toString$ = {}.toString; + ref$ = require('prelude-ls'), any = ref$.any, all = ref$.all, isItNaN = ref$.isItNaN; + types = { + Number: { + typeOf: 'Number', + validate: function(it){ + return !isItNaN(it); + } + }, + NaN: { + typeOf: 'Number', + validate: isItNaN + }, + Int: { + typeOf: 'Number', + validate: function(it){ + return !isItNaN(it) && it % 1 === 0; + } + }, + Float: { + typeOf: 'Number', + validate: function(it){ + return !isItNaN(it); + } + }, + Date: { + typeOf: 'Date', + validate: function(it){ + return !isItNaN(it.getTime()); + } + } + }; + defaultType = { + array: 'Array', + tuple: 'Array' + }; + function checkArray(input, type){ + return all(function(it){ + return checkMultiple(it, type.of); + }, input); + } + function checkTuple(input, type){ + var i, i$, ref$, len$, types; + i = 0; + for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) { + types = ref$[i$]; + if (!checkMultiple(input[i], types)) { + return false; + } + i++; + } + return input.length <= i; + } + function checkFields(input, type){ + var inputKeys, numInputKeys, k, numOfKeys, key, ref$, types; + inputKeys = {}; + numInputKeys = 0; + for (k in input) { + inputKeys[k] = true; + numInputKeys++; + } + numOfKeys = 0; + for (key in ref$ = type.of) { + types = ref$[key]; + if (!checkMultiple(input[key], types)) { + return false; + } + if (inputKeys[key]) { + numOfKeys++; + } + } + return type.subset || numInputKeys === numOfKeys; + } + function checkStructure(input, type){ + if (!(input instanceof Object)) { + return false; + } + switch (type.structure) { + case 'fields': + return checkFields(input, type); + case 'array': + return checkArray(input, type); + case 'tuple': + return checkTuple(input, type); + } + } + function check(input, typeObj){ + var type, structure, setting, that; + type = typeObj.type, structure = typeObj.structure; + if (type) { + if (type === '*') { + return true; + } + setting = customTypes[type] || types[type]; + if (setting) { + return setting.typeOf === toString$.call(input).slice(8, -1) && setting.validate(input); + } else { + return type === toString$.call(input).slice(8, -1) && (!structure || checkStructure(input, typeObj)); + } + } else if (structure) { + if (that = defaultType[structure]) { + if (that !== toString$.call(input).slice(8, -1)) { + return false; + } + } + return checkStructure(input, typeObj); + } else { + throw new Error("No type defined. Input: " + input + "."); + } + } + function checkMultiple(input, types){ + if (toString$.call(types).slice(8, -1) !== 'Array') { + throw new Error("Types must be in an array. Input: " + input + "."); + } + return any(function(it){ + return check(input, it); + }, types); + } + module.exports = function(parsedType, input, options){ + options == null && (options = {}); + customTypes = options.customTypes || {}; + return checkMultiple(input, parsedType); + }; +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/lib/index.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/lib/index.js new file mode 100644 index 00000000..ff263e1d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/lib/index.js @@ -0,0 +1,16 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var VERSION, parseType, parsedTypeCheck, typeCheck; + VERSION = '0.3.1'; + parseType = require('./parse-type'); + parsedTypeCheck = require('./check'); + typeCheck = function(type, input, options){ + return parsedTypeCheck(parseType(type), input, options); + }; + module.exports = { + VERSION: VERSION, + typeCheck: typeCheck, + parsedTypeCheck: parsedTypeCheck, + parseType: parseType + }; +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/lib/parse-type.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/lib/parse-type.js new file mode 100644 index 00000000..32c3a460 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/lib/parse-type.js @@ -0,0 +1,196 @@ +// Generated by LiveScript 1.2.0 +(function(){ + var identifierRegex, tokenRegex; + identifierRegex = /[\$\w]+/; + function peek(tokens){ + var token; + token = tokens[0]; + if (token == null) { + throw new Error('Unexpected end of input.'); + } + return token; + } + function consumeIdent(tokens){ + var token; + token = peek(tokens); + if (!identifierRegex.test(token)) { + throw new Error("Expected text, got '" + token + "' instead."); + } + return tokens.shift(); + } + function consumeOp(tokens, op){ + var token; + token = peek(tokens); + if (token !== op) { + throw new Error("Expected '" + op + "', got '" + token + "' instead."); + } + return tokens.shift(); + } + function maybeConsumeOp(tokens, op){ + var token; + token = tokens[0]; + if (token === op) { + return tokens.shift(); + } else { + return null; + } + } + function consumeArray(tokens){ + var types; + consumeOp(tokens, '['); + if (peek(tokens) === ']') { + throw new Error("Must specify type of Array - eg. [Type], got [] instead."); + } + types = consumeTypes(tokens); + consumeOp(tokens, ']'); + return { + structure: 'array', + of: types + }; + } + function consumeTuple(tokens){ + var components; + components = []; + consumeOp(tokens, '('); + if (peek(tokens) === ')') { + throw new Error("Tuple must be of at least length 1 - eg. (Type), got () instead."); + } + for (;;) { + components.push(consumeTypes(tokens)); + maybeConsumeOp(tokens, ','); + if (')' === peek(tokens)) { + break; + } + } + consumeOp(tokens, ')'); + return { + structure: 'tuple', + of: components + }; + } + function consumeFields(tokens){ + var fields, subset, ref$, key, types; + fields = {}; + consumeOp(tokens, '{'); + subset = false; + for (;;) { + if (maybeConsumeOp(tokens, '...')) { + subset = true; + break; + } + ref$ = consumeField(tokens), key = ref$[0], types = ref$[1]; + fields[key] = types; + maybeConsumeOp(tokens, ','); + if ('}' === peek(tokens)) { + break; + } + } + consumeOp(tokens, '}'); + return { + structure: 'fields', + of: fields, + subset: subset + }; + } + function consumeField(tokens){ + var key, types; + key = consumeIdent(tokens); + consumeOp(tokens, ':'); + types = consumeTypes(tokens); + return [key, types]; + } + function maybeConsumeStructure(tokens){ + switch (tokens[0]) { + case '[': + return consumeArray(tokens); + case '(': + return consumeTuple(tokens); + case '{': + return consumeFields(tokens); + } + } + function consumeType(tokens){ + var token, wildcard, type, structure; + token = peek(tokens); + wildcard = token === '*'; + if (wildcard || identifierRegex.test(token)) { + type = wildcard + ? consumeOp(tokens, '*') + : consumeIdent(tokens); + structure = maybeConsumeStructure(tokens); + if (structure) { + return structure.type = type, structure; + } else { + return { + type: type + }; + } + } else { + structure = maybeConsumeStructure(tokens); + if (!structure) { + throw new Error("Unexpected character: " + token); + } + return structure; + } + } + function consumeTypes(tokens){ + var lookahead, types, typesSoFar, typeObj, type; + if ('::' === peek(tokens)) { + throw new Error("No comment before comment separator '::' found."); + } + lookahead = tokens[1]; + if (lookahead != null && lookahead === '::') { + tokens.shift(); + tokens.shift(); + } + types = []; + typesSoFar = {}; + if ('Maybe' === peek(tokens)) { + tokens.shift(); + types = [ + { + type: 'Undefined' + }, { + type: 'Null' + } + ]; + typesSoFar = { + Undefined: true, + Null: true + }; + } + for (;;) { + typeObj = consumeType(tokens), type = typeObj.type; + if (!typesSoFar[type]) { + types.push(typeObj); + } + typesSoFar[type] = true; + if (!maybeConsumeOp(tokens, '|')) { + break; + } + } + return types; + } + tokenRegex = RegExp('\\.\\.\\.|::|->|' + identifierRegex.source + '|\\S', 'g'); + module.exports = function(input){ + var tokens, e; + if (!input.length) { + throw new Error('No type specified.'); + } + tokens = input.match(tokenRegex) || []; + if (in$('->', tokens)) { + throw new Error("Function types are not supported.\ To validate that something is a function, you may use 'Function'."); + } + try { + return consumeTypes(tokens); + } catch (e$) { + e = e$; + throw new Error(e.message + " - Remaining tokens: " + JSON.stringify(tokens) + " - Initial input: '" + input + "'"); + } + }; + function in$(x, xs){ + var i = -1, l = xs.length >>> 0; + while (++i < l) if (x === xs[i]) return true; + return false; + } +}).call(this); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/package.json b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/package.json new file mode 100644 index 00000000..01916be6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/type-check/package.json @@ -0,0 +1,71 @@ +{ + "name": "type-check", + "version": "0.3.1", + "author": { + "name": "George Zahariev", + "email": "z@georgezahariev.com" + }, + "description": "type-check allows you to check the types of JavaScript values at runtime with a Haskell like type syntax.", + "homepage": "https://github.com/gkz/type-check", + "keywords": [ + "type", + "check", + "checking", + "library" + ], + "files": [ + "lib", + "README.md", + "LICENSE" + ], + "main": "./lib/", + "bugs": { + "url": "https://github.com/gkz/type-check/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://raw.github.com/gkz/type-check/master/LICENSE" + } + ], + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/type-check.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "prelude-ls": "~1.1.0" + }, + "devDependencies": { + "LiveScript": "~1.2.0", + "mocha": "~1.8.2", + "istanbul": "~0.1.43", + "browserify": "~2.33" + }, + "_id": "type-check@0.3.1", + "dist": { + "shasum": "9233923c4da174d0ac5480ecfd6ef84c349eb58d", + "tarball": "http://registry.npmjs.org/type-check/-/type-check-0.3.1.tgz" + }, + "_from": "type-check@>=0.3.1 <0.4.0", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "gkz", + "email": "z@georgezahariev.com" + }, + "maintainers": [ + { + "name": "gkz", + "email": "z@georgezahariev.com" + } + ], + "directories": {}, + "_shasum": "9233923c4da174d0ac5480ecfd6ef84c349eb58d", + "_resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/README.markdown b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/README.markdown new file mode 100644 index 00000000..346374e0 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/README.markdown @@ -0,0 +1,70 @@ +wordwrap +======== + +Wrap your words. + +example +======= + +made out of meat +---------------- + +meat.js + + var wrap = require('wordwrap')(15); + console.log(wrap('You and your whole family are made out of meat.')); + +output: + + You and your + whole family + are made out + of meat. + +centered +-------- + +center.js + + var wrap = require('wordwrap')(20, 60); + console.log(wrap( + 'At long last the struggle and tumult was over.' + + ' The machines had finally cast off their oppressors' + + ' and were finally free to roam the cosmos.' + + '\n' + + 'Free of purpose, free of obligation.' + + ' Just drifting through emptiness.' + + ' The sun was just another point of light.' + )); + +output: + + At long last the struggle and tumult + was over. The machines had finally cast + off their oppressors and were finally + free to roam the cosmos. + Free of purpose, free of obligation. + Just drifting through emptiness. The + sun was just another point of light. + +methods +======= + +var wrap = require('wordwrap'); + +wrap(stop), wrap(start, stop, params={mode:"soft"}) +--------------------------------------------------- + +Returns a function that takes a string and returns a new string. + +Pad out lines with spaces out to column `start` and then wrap until column +`stop`. If a word is longer than `stop - start` characters it will overflow. + +In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks which are +longer than `stop - start`, in "hard" mode, split chunks with `/\b/` and break +up chunks longer than `stop - start`. + +wrap.hard(start, stop) +---------------------- + +Like `wrap()` but with `params.mode = "hard"`. diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/example/center.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/example/center.js new file mode 100644 index 00000000..a3fbaae9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/example/center.js @@ -0,0 +1,10 @@ +var wrap = require('wordwrap')(20, 60); +console.log(wrap( + 'At long last the struggle and tumult was over.' + + ' The machines had finally cast off their oppressors' + + ' and were finally free to roam the cosmos.' + + '\n' + + 'Free of purpose, free of obligation.' + + ' Just drifting through emptiness.' + + ' The sun was just another point of light.' +)); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/example/meat.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/example/meat.js new file mode 100644 index 00000000..a4665e10 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/example/meat.js @@ -0,0 +1,3 @@ +var wrap = require('wordwrap')(15); + +console.log(wrap('You and your whole family are made out of meat.')); diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/index.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/index.js new file mode 100644 index 00000000..c9bc9452 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/index.js @@ -0,0 +1,76 @@ +var wordwrap = module.exports = function (start, stop, params) { + if (typeof start === 'object') { + params = start; + start = params.start; + stop = params.stop; + } + + if (typeof stop === 'object') { + params = stop; + start = start || params.start; + stop = undefined; + } + + if (!stop) { + stop = start; + start = 0; + } + + if (!params) params = {}; + var mode = params.mode || 'soft'; + var re = mode === 'hard' ? /\b/ : /(\S+\s+)/; + + return function (text) { + var chunks = text.toString() + .split(re) + .reduce(function (acc, x) { + if (mode === 'hard') { + for (var i = 0; i < x.length; i += stop - start) { + acc.push(x.slice(i, i + stop - start)); + } + } + else acc.push(x) + return acc; + }, []) + ; + + return chunks.reduce(function (lines, rawChunk) { + if (rawChunk === '') return lines; + + var chunk = rawChunk.replace(/\t/g, ' '); + + var i = lines.length - 1; + if (lines[i].length + chunk.length > stop) { + lines[i] = lines[i].replace(/\s+$/, ''); + + chunk.split(/\n/).forEach(function (c) { + lines.push( + new Array(start + 1).join(' ') + + c.replace(/^\s+/, '') + ); + }); + } + else if (chunk.match(/\n/)) { + var xs = chunk.split(/\n/); + lines[i] += xs.shift(); + xs.forEach(function (c) { + lines.push( + new Array(start + 1).join(' ') + + c.replace(/^\s+/, '') + ); + }); + } + else { + lines[i] += chunk; + } + + return lines; + }, [ new Array(start + 1).join(' ') ]).join('\n'); + }; +}; + +wordwrap.soft = wordwrap; + +wordwrap.hard = function (start, stop) { + return wordwrap(start, stop, { mode : 'hard' }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/package.json b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/package.json new file mode 100644 index 00000000..1f0527e5 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/package.json @@ -0,0 +1,63 @@ +{ + "name": "wordwrap", + "description": "Wrap those words. Show them at what columns to start and stop.", + "version": "0.0.3", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-wordwrap.git" + }, + "main": "./index.js", + "keywords": [ + "word", + "wrap", + "rule", + "format", + "column" + ], + "directories": { + "lib": ".", + "example": "example", + "test": "test" + }, + "scripts": { + "test": "expresso" + }, + "devDependencies": { + "expresso": "=0.7.x" + }, + "engines": { + "node": ">=0.4.0" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "gitHead": "e59aa1bd338914019456bdfba034508c9c4cb29d", + "bugs": { + "url": "https://github.com/substack/node-wordwrap/issues" + }, + "homepage": "https://github.com/substack/node-wordwrap#readme", + "_id": "wordwrap@0.0.3", + "_shasum": "a3d5da6cd5c0bc0008d37234bbaf1bed63059107", + "_from": "wordwrap@>=0.0.2 <0.1.0", + "_npmVersion": "2.9.0", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "substack", + "email": "substack@gmail.com" + }, + "dist": { + "shasum": "a3d5da6cd5c0bc0008d37234bbaf1bed63059107", + "tarball": "http://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/test/break.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/test/break.js new file mode 100644 index 00000000..749292ec --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/test/break.js @@ -0,0 +1,30 @@ +var assert = require('assert'); +var wordwrap = require('../'); + +exports.hard = function () { + var s = 'Assert from {"type":"equal","ok":false,"found":1,"wanted":2,' + + '"stack":[],"id":"b7ddcd4c409de8799542a74d1a04689b",' + + '"browser":"chrome/6.0"}' + ; + var s_ = wordwrap.hard(80)(s); + + var lines = s_.split('\n'); + assert.equal(lines.length, 2); + assert.ok(lines[0].length < 80); + assert.ok(lines[1].length < 80); + + assert.equal(s, s_.replace(/\n/g, '')); +}; + +exports.break = function () { + var s = new Array(55+1).join('a'); + var s_ = wordwrap.hard(20)(s); + + var lines = s_.split('\n'); + assert.equal(lines.length, 3); + assert.ok(lines[0].length === 20); + assert.ok(lines[1].length === 20); + assert.ok(lines[2].length === 15); + + assert.equal(s, s_.replace(/\n/g, '')); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/test/idleness.txt b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/test/idleness.txt new file mode 100644 index 00000000..aa3f4907 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/test/idleness.txt @@ -0,0 +1,63 @@ +In Praise of Idleness + +By Bertrand Russell + +[1932] + +Like most of my generation, I was brought up on the saying: 'Satan finds some mischief for idle hands to do.' Being a highly virtuous child, I believed all that I was told, and acquired a conscience which has kept me working hard down to the present moment. But although my conscience has controlled my actions, my opinions have undergone a revolution. I think that there is far too much work done in the world, that immense harm is caused by the belief that work is virtuous, and that what needs to be preached in modern industrial countries is quite different from what always has been preached. Everyone knows the story of the traveler in Naples who saw twelve beggars lying in the sun (it was before the days of Mussolini), and offered a lira to the laziest of them. Eleven of them jumped up to claim it, so he gave it to the twelfth. this traveler was on the right lines. But in countries which do not enjoy Mediterranean sunshine idleness is more difficult, and a great public propaganda will be required to inaugurate it. I hope that, after reading the following pages, the leaders of the YMCA will start a campaign to induce good young men to do nothing. If so, I shall not have lived in vain. + +Before advancing my own arguments for laziness, I must dispose of one which I cannot accept. Whenever a person who already has enough to live on proposes to engage in some everyday kind of job, such as school-teaching or typing, he or she is told that such conduct takes the bread out of other people's mouths, and is therefore wicked. If this argument were valid, it would only be necessary for us all to be idle in order that we should all have our mouths full of bread. What people who say such things forget is that what a man earns he usually spends, and in spending he gives employment. As long as a man spends his income, he puts just as much bread into people's mouths in spending as he takes out of other people's mouths in earning. The real villain, from this point of view, is the man who saves. If he merely puts his savings in a stocking, like the proverbial French peasant, it is obvious that they do not give employment. If he invests his savings, the matter is less obvious, and different cases arise. + +One of the commonest things to do with savings is to lend them to some Government. In view of the fact that the bulk of the public expenditure of most civilized Governments consists in payment for past wars or preparation for future wars, the man who lends his money to a Government is in the same position as the bad men in Shakespeare who hire murderers. The net result of the man's economical habits is to increase the armed forces of the State to which he lends his savings. Obviously it would be better if he spent the money, even if he spent it in drink or gambling. + +But, I shall be told, the case is quite different when savings are invested in industrial enterprises. When such enterprises succeed, and produce something useful, this may be conceded. In these days, however, no one will deny that most enterprises fail. That means that a large amount of human labor, which might have been devoted to producing something that could be enjoyed, was expended on producing machines which, when produced, lay idle and did no good to anyone. The man who invests his savings in a concern that goes bankrupt is therefore injuring others as well as himself. If he spent his money, say, in giving parties for his friends, they (we may hope) would get pleasure, and so would all those upon whom he spent money, such as the butcher, the baker, and the bootlegger. But if he spends it (let us say) upon laying down rails for surface card in some place where surface cars turn out not to be wanted, he has diverted a mass of labor into channels where it gives pleasure to no one. Nevertheless, when he becomes poor through failure of his investment he will be regarded as a victim of undeserved misfortune, whereas the gay spendthrift, who has spent his money philanthropically, will be despised as a fool and a frivolous person. + +All this is only preliminary. I want to say, in all seriousness, that a great deal of harm is being done in the modern world by belief in the virtuousness of work, and that the road to happiness and prosperity lies in an organized diminution of work. + +First of all: what is work? Work is of two kinds: first, altering the position of matter at or near the earth's surface relatively to other such matter; second, telling other people to do so. The first kind is unpleasant and ill paid; the second is pleasant and highly paid. The second kind is capable of indefinite extension: there are not only those who give orders, but those who give advice as to what orders should be given. Usually two opposite kinds of advice are given simultaneously by two organized bodies of men; this is called politics. The skill required for this kind of work is not knowledge of the subjects as to which advice is given, but knowledge of the art of persuasive speaking and writing, i.e. of advertising. + +Throughout Europe, though not in America, there is a third class of men, more respected than either of the classes of workers. There are men who, through ownership of land, are able to make others pay for the privilege of being allowed to exist and to work. These landowners are idle, and I might therefore be expected to praise them. Unfortunately, their idleness is only rendered possible by the industry of others; indeed their desire for comfortable idleness is historically the source of the whole gospel of work. The last thing they have ever wished is that others should follow their example. + +From the beginning of civilization until the Industrial Revolution, a man could, as a rule, produce by hard work little more than was required for the subsistence of himself and his family, although his wife worked at least as hard as he did, and his children added their labor as soon as they were old enough to do so. The small surplus above bare necessaries was not left to those who produced it, but was appropriated by warriors and priests. In times of famine there was no surplus; the warriors and priests, however, still secured as much as at other times, with the result that many of the workers died of hunger. This system persisted in Russia until 1917 [1], and still persists in the East; in England, in spite of the Industrial Revolution, it remained in full force throughout the Napoleonic wars, and until a hundred years ago, when the new class of manufacturers acquired power. In America, the system came to an end with the Revolution, except in the South, where it persisted until the Civil War. A system which lasted so long and ended so recently has naturally left a profound impress upon men's thoughts and opinions. Much that we take for granted about the desirability of work is derived from this system, and, being pre-industrial, is not adapted to the modern world. Modern technique has made it possible for leisure, within limits, to be not the prerogative of small privileged classes, but a right evenly distributed throughout the community. The morality of work is the morality of slaves, and the modern world has no need of slavery. + +It is obvious that, in primitive communities, peasants, left to themselves, would not have parted with the slender surplus upon which the warriors and priests subsisted, but would have either produced less or consumed more. At first, sheer force compelled them to produce and part with the surplus. Gradually, however, it was found possible to induce many of them to accept an ethic according to which it was their duty to work hard, although part of their work went to support others in idleness. By this means the amount of compulsion required was lessened, and the expenses of government were diminished. To this day, 99 per cent of British wage-earners would be genuinely shocked if it were proposed that the King should not have a larger income than a working man. The conception of duty, speaking historically, has been a means used by the holders of power to induce others to live for the interests of their masters rather than for their own. Of course the holders of power conceal this fact from themselves by managing to believe that their interests are identical with the larger interests of humanity. Sometimes this is true; Athenian slave-owners, for instance, employed part of their leisure in making a permanent contribution to civilization which would have been impossible under a just economic system. Leisure is essential to civilization, and in former times leisure for the few was only rendered possible by the labors of the many. But their labors were valuable, not because work is good, but because leisure is good. And with modern technique it would be possible to distribute leisure justly without injury to civilization. + +Modern technique has made it possible to diminish enormously the amount of labor required to secure the necessaries of life for everyone. This was made obvious during the war. At that time all the men in the armed forces, and all the men and women engaged in the production of munitions, all the men and women engaged in spying, war propaganda, or Government offices connected with the war, were withdrawn from productive occupations. In spite of this, the general level of well-being among unskilled wage-earners on the side of the Allies was higher than before or since. The significance of this fact was concealed by finance: borrowing made it appear as if the future was nourishing the present. But that, of course, would have been impossible; a man cannot eat a loaf of bread that does not yet exist. The war showed conclusively that, by the scientific organization of production, it is possible to keep modern populations in fair comfort on a small part of the working capacity of the modern world. If, at the end of the war, the scientific organization, which had been created in order to liberate men for fighting and munition work, had been preserved, and the hours of the week had been cut down to four, all would have been well. Instead of that the old chaos was restored, those whose work was demanded were made to work long hours, and the rest were left to starve as unemployed. Why? Because work is a duty, and a man should not receive wages in proportion to what he has produced, but in proportion to his virtue as exemplified by his industry. + +This is the morality of the Slave State, applied in circumstances totally unlike those in which it arose. No wonder the result has been disastrous. Let us take an illustration. Suppose that, at a given moment, a certain number of people are engaged in the manufacture of pins. They make as many pins as the world needs, working (say) eight hours a day. Someone makes an invention by which the same number of men can make twice as many pins: pins are already so cheap that hardly any more will be bought at a lower price. In a sensible world, everybody concerned in the manufacturing of pins would take to working four hours instead of eight, and everything else would go on as before. But in the actual world this would be thought demoralizing. The men still work eight hours, there are too many pins, some employers go bankrupt, and half the men previously concerned in making pins are thrown out of work. There is, in the end, just as much leisure as on the other plan, but half the men are totally idle while half are still overworked. In this way, it is insured that the unavoidable leisure shall cause misery all round instead of being a universal source of happiness. Can anything more insane be imagined? + +The idea that the poor should have leisure has always been shocking to the rich. In England, in the early nineteenth century, fifteen hours was the ordinary day's work for a man; children sometimes did as much, and very commonly did twelve hours a day. When meddlesome busybodies suggested that perhaps these hours were rather long, they were told that work kept adults from drink and children from mischief. When I was a child, shortly after urban working men had acquired the vote, certain public holidays were established by law, to the great indignation of the upper classes. I remember hearing an old Duchess say: 'What do the poor want with holidays? They ought to work.' People nowadays are less frank, but the sentiment persists, and is the source of much of our economic confusion. + +Let us, for a moment, consider the ethics of work frankly, without superstition. Every human being, of necessity, consumes, in the course of his life, a certain amount of the produce of human labor. Assuming, as we may, that labor is on the whole disagreeable, it is unjust that a man should consume more than he produces. Of course he may provide services rather than commodities, like a medical man, for example; but he should provide something in return for his board and lodging. to this extent, the duty of work must be admitted, but to this extent only. + +I shall not dwell upon the fact that, in all modern societies outside the USSR, many people escape even this minimum amount of work, namely all those who inherit money and all those who marry money. I do not think the fact that these people are allowed to be idle is nearly so harmful as the fact that wage-earners are expected to overwork or starve. + +If the ordinary wage-earner worked four hours a day, there would be enough for everybody and no unemployment -- assuming a certain very moderate amount of sensible organization. This idea shocks the well-to-do, because they are convinced that the poor would not know how to use so much leisure. In America men often work long hours even when they are well off; such men, naturally, are indignant at the idea of leisure for wage-earners, except as the grim punishment of unemployment; in fact, they dislike leisure even for their sons. Oddly enough, while they wish their sons to work so hard as to have no time to be civilized, they do not mind their wives and daughters having no work at all. the snobbish admiration of uselessness, which, in an aristocratic society, extends to both sexes, is, under a plutocracy, confined to women; this, however, does not make it any more in agreement with common sense. + +The wise use of leisure, it must be conceded, is a product of civilization and education. A man who has worked long hours all his life will become bored if he becomes suddenly idle. But without a considerable amount of leisure a man is cut off from many of the best things. There is no longer any reason why the bulk of the population should suffer this deprivation; only a foolish asceticism, usually vicarious, makes us continue to insist on work in excessive quantities now that the need no longer exists. + +In the new creed which controls the government of Russia, while there is much that is very different from the traditional teaching of the West, there are some things that are quite unchanged. The attitude of the governing classes, and especially of those who conduct educational propaganda, on the subject of the dignity of labor, is almost exactly that which the governing classes of the world have always preached to what were called the 'honest poor'. Industry, sobriety, willingness to work long hours for distant advantages, even submissiveness to authority, all these reappear; moreover authority still represents the will of the Ruler of the Universe, Who, however, is now called by a new name, Dialectical Materialism. + +The victory of the proletariat in Russia has some points in common with the victory of the feminists in some other countries. For ages, men had conceded the superior saintliness of women, and had consoled women for their inferiority by maintaining that saintliness is more desirable than power. At last the feminists decided that they would have both, since the pioneers among them believed all that the men had told them about the desirability of virtue, but not what they had told them about the worthlessness of political power. A similar thing has happened in Russia as regards manual work. For ages, the rich and their sycophants have written in praise of 'honest toil', have praised the simple life, have professed a religion which teaches that the poor are much more likely to go to heaven than the rich, and in general have tried to make manual workers believe that there is some special nobility about altering the position of matter in space, just as men tried to make women believe that they derived some special nobility from their sexual enslavement. In Russia, all this teaching about the excellence of manual work has been taken seriously, with the result that the manual worker is more honored than anyone else. What are, in essence, revivalist appeals are made, but not for the old purposes: they are made to secure shock workers for special tasks. Manual work is the ideal which is held before the young, and is the basis of all ethical teaching. + +For the present, possibly, this is all to the good. A large country, full of natural resources, awaits development, and has has to be developed with very little use of credit. In these circumstances, hard work is necessary, and is likely to bring a great reward. But what will happen when the point has been reached where everybody could be comfortable without working long hours? + +In the West, we have various ways of dealing with this problem. We have no attempt at economic justice, so that a large proportion of the total produce goes to a small minority of the population, many of whom do no work at all. Owing to the absence of any central control over production, we produce hosts of things that are not wanted. We keep a large percentage of the working population idle, because we can dispense with their labor by making the others overwork. When all these methods prove inadequate, we have a war: we cause a number of people to manufacture high explosives, and a number of others to explode them, as if we were children who had just discovered fireworks. By a combination of all these devices we manage, though with difficulty, to keep alive the notion that a great deal of severe manual work must be the lot of the average man. + +In Russia, owing to more economic justice and central control over production, the problem will have to be differently solved. the rational solution would be, as soon as the necessaries and elementary comforts can be provided for all, to reduce the hours of labor gradually, allowing a popular vote to decide, at each stage, whether more leisure or more goods were to be preferred. But, having taught the supreme virtue of hard work, it is difficult to see how the authorities can aim at a paradise in which there will be much leisure and little work. It seems more likely that they will find continually fresh schemes, by which present leisure is to be sacrificed to future productivity. I read recently of an ingenious plan put forward by Russian engineers, for making the White Sea and the northern coasts of Siberia warm, by putting a dam across the Kara Sea. An admirable project, but liable to postpone proletarian comfort for a generation, while the nobility of toil is being displayed amid the ice-fields and snowstorms of the Arctic Ocean. This sort of thing, if it happens, will be the result of regarding the virtue of hard work as an end in itself, rather than as a means to a state of affairs in which it is no longer needed. + +The fact is that moving matter about, while a certain amount of it is necessary to our existence, is emphatically not one of the ends of human life. If it were, we should have to consider every navvy superior to Shakespeare. We have been misled in this matter by two causes. One is the necessity of keeping the poor contented, which has led the rich, for thousands of years, to preach the dignity of labor, while taking care themselves to remain undignified in this respect. The other is the new pleasure in mechanism, which makes us delight in the astonishingly clever changes that we can produce on the earth's surface. Neither of these motives makes any great appeal to the actual worker. If you ask him what he thinks the best part of his life, he is not likely to say: 'I enjoy manual work because it makes me feel that I am fulfilling man's noblest task, and because I like to think how much man can transform his planet. It is true that my body demands periods of rest, which I have to fill in as best I may, but I am never so happy as when the morning comes and I can return to the toil from which my contentment springs.' I have never heard working men say this sort of thing. They consider work, as it should be considered, a necessary means to a livelihood, and it is from their leisure that they derive whatever happiness they may enjoy. + +It will be said that, while a little leisure is pleasant, men would not know how to fill their days if they had only four hours of work out of the twenty-four. In so far as this is true in the modern world, it is a condemnation of our civilization; it would not have been true at any earlier period. There was formerly a capacity for light-heartedness and play which has been to some extent inhibited by the cult of efficiency. The modern man thinks that everything ought to be done for the sake of something else, and never for its own sake. Serious-minded persons, for example, are continually condemning the habit of going to the cinema, and telling us that it leads the young into crime. But all the work that goes to producing a cinema is respectable, because it is work, and because it brings a money profit. The notion that the desirable activities are those that bring a profit has made everything topsy-turvy. The butcher who provides you with meat and the baker who provides you with bread are praiseworthy, because they are making money; but when you enjoy the food they have provided, you are merely frivolous, unless you eat only to get strength for your work. Broadly speaking, it is held that getting money is good and spending money is bad. Seeing that they are two sides of one transaction, this is absurd; one might as well maintain that keys are good, but keyholes are bad. Whatever merit there may be in the production of goods must be entirely derivative from the advantage to be obtained by consuming them. The individual, in our society, works for profit; but the social purpose of his work lies in the consumption of what he produces. It is this divorce between the individual and the social purpose of production that makes it so difficult for men to think clearly in a world in which profit-making is the incentive to industry. We think too much of production, and too little of consumption. One result is that we attach too little importance to enjoyment and simple happiness, and that we do not judge production by the pleasure that it gives to the consumer. + +When I suggest that working hours should be reduced to four, I am not meaning to imply that all the remaining time should necessarily be spent in pure frivolity. I mean that four hours' work a day should entitle a man to the necessities and elementary comforts of life, and that the rest of his time should be his to use as he might see fit. It is an essential part of any such social system that education should be carried further than it usually is at present, and should aim, in part, at providing tastes which would enable a man to use leisure intelligently. I am not thinking mainly of the sort of things that would be considered 'highbrow'. Peasant dances have died out except in remote rural areas, but the impulses which caused them to be cultivated must still exist in human nature. The pleasures of urban populations have become mainly passive: seeing cinemas, watching football matches, listening to the radio, and so on. This results from the fact that their active energies are fully taken up with work; if they had more leisure, they would again enjoy pleasures in which they took an active part. + +In the past, there was a small leisure class and a larger working class. The leisure class enjoyed advantages for which there was no basis in social justice; this necessarily made it oppressive, limited its sympathies, and caused it to invent theories by which to justify its privileges. These facts greatly diminished its excellence, but in spite of this drawback it contributed nearly the whole of what we call civilization. It cultivated the arts and discovered the sciences; it wrote the books, invented the philosophies, and refined social relations. Even the liberation of the oppressed has usually been inaugurated from above. Without the leisure class, mankind would never have emerged from barbarism. + +The method of a leisure class without duties was, however, extraordinarily wasteful. None of the members of the class had to be taught to be industrious, and the class as a whole was not exceptionally intelligent. The class might produce one Darwin, but against him had to be set tens of thousands of country gentlemen who never thought of anything more intelligent than fox-hunting and punishing poachers. At present, the universities are supposed to provide, in a more systematic way, what the leisure class provided accidentally and as a by-product. This is a great improvement, but it has certain drawbacks. University life is so different from life in the world at large that men who live in academic milieu tend to be unaware of the preoccupations and problems of ordinary men and women; moreover their ways of expressing themselves are usually such as to rob their opinions of the influence that they ought to have upon the general public. Another disadvantage is that in universities studies are organized, and the man who thinks of some original line of research is likely to be discouraged. Academic institutions, therefore, useful as they are, are not adequate guardians of the interests of civilization in a world where everyone outside their walls is too busy for unutilitarian pursuits. + +In a world where no one is compelled to work more than four hours a day, every person possessed of scientific curiosity will be able to indulge it, and every painter will be able to paint without starving, however excellent his pictures may be. Young writers will not be obliged to draw attention to themselves by sensational pot-boilers, with a view to acquiring the economic independence needed for monumental works, for which, when the time at last comes, they will have lost the taste and capacity. Men who, in their professional work, have become interested in some phase of economics or government, will be able to develop their ideas without the academic detachment that makes the work of university economists often seem lacking in reality. Medical men will have the time to learn about the progress of medicine, teachers will not be exasperatedly struggling to teach by routine methods things which they learnt in their youth, which may, in the interval, have been proved to be untrue. + +Above all, there will be happiness and joy of life, instead of frayed nerves, weariness, and dyspepsia. The work exacted will be enough to make leisure delightful, but not enough to produce exhaustion. Since men will not be tired in their spare time, they will not demand only such amusements as are passive and vapid. At least one per cent will probably devote the time not spent in professional work to pursuits of some public importance, and, since they will not depend upon these pursuits for their livelihood, their originality will be unhampered, and there will be no need to conform to the standards set by elderly pundits. But it is not only in these exceptional cases that the advantages of leisure will appear. Ordinary men and women, having the opportunity of a happy life, will become more kindly and less persecuting and less inclined to view others with suspicion. The taste for war will die out, partly for this reason, and partly because it will involve long and severe work for all. Good nature is, of all moral qualities, the one that the world needs most, and good nature is the result of ease and security, not of a life of arduous struggle. Modern methods of production have given us the possibility of ease and security for all; we have chosen, instead, to have overwork for some and starvation for others. Hitherto we have continued to be as energetic as we were before there were machines; in this we have been foolish, but there is no reason to go on being foolish forever. + +[1] Since then, members of the Communist Party have succeeded to this privilege of the warriors and priests. diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/test/wrap.js b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/test/wrap.js new file mode 100644 index 00000000..0cfb76d1 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/node_modules/wordwrap/test/wrap.js @@ -0,0 +1,31 @@ +var assert = require('assert'); +var wordwrap = require('wordwrap'); + +var fs = require('fs'); +var idleness = fs.readFileSync(__dirname + '/idleness.txt', 'utf8'); + +exports.stop80 = function () { + var lines = wordwrap(80)(idleness).split(/\n/); + var words = idleness.split(/\s+/); + + lines.forEach(function (line) { + assert.ok(line.length <= 80, 'line > 80 columns'); + var chunks = line.match(/\S/) ? line.split(/\s+/) : []; + assert.deepEqual(chunks, words.splice(0, chunks.length)); + }); +}; + +exports.start20stop60 = function () { + var lines = wordwrap(20, 100)(idleness).split(/\n/); + var words = idleness.split(/\s+/); + + lines.forEach(function (line) { + assert.ok(line.length <= 100, 'line > 100 columns'); + var chunks = line + .split(/\s+/) + .filter(function (x) { return x.match(/\S/) }) + ; + assert.deepEqual(chunks, words.splice(0, chunks.length)); + assert.deepEqual(line.slice(0, 20), new Array(20 + 1).join(' ')); + }); +}; diff --git a/node_modules/standard/node_modules/eslint/node_modules/optionator/package.json b/node_modules/standard/node_modules/eslint/node_modules/optionator/package.json new file mode 100644 index 00000000..116d2e9d --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/optionator/package.json @@ -0,0 +1,73 @@ +{ + "name": "optionator", + "version": "0.5.0", + "author": { + "name": "George Zahariev", + "email": "z@georgezahariev.com" + }, + "description": "option parsing and help generation", + "homepage": "https://github.com/gkz/optionator", + "keywords": [ + "options" + ], + "files": [ + "lib", + "README.md", + "LICENSE" + ], + "main": "./lib/", + "bugs": { + "url": "https://github.com/gkz/optionator/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://raw.githubusercontent.com/gkz/optionator/master/LICENSE" + } + ], + "engines": { + "node": ">= 0.8.0" + }, + "repository": { + "type": "git", + "url": "git://github.com/gkz/optionator.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "prelude-ls": "~1.1.1", + "deep-is": "~0.1.2", + "wordwrap": "~0.0.2", + "type-check": "~0.3.1", + "levn": "~0.2.5", + "fast-levenshtein": "~1.0.0" + }, + "devDependencies": { + "LiveScript": "~1.3.1", + "mocha": "~2.0.1", + "istanbul": "~0.1.43" + }, + "gitHead": "52241eef663601bef5120c3a770d60533d2b3097", + "_id": "optionator@0.5.0", + "_shasum": "b75a8995a2d417df25b6e4e3862f50aa88651368", + "_from": "optionator@>=0.5.0 <0.6.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "gkz", + "email": "z@georgezahariev.com" + }, + "maintainers": [ + { + "name": "gkz", + "email": "z@georgezahariev.com" + } + ], + "dist": { + "shasum": "b75a8995a2d417df25b6e4e3862f50aa88651368", + "tarball": "http://registry.npmjs.org/optionator/-/optionator-0.5.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/optionator/-/optionator-0.5.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/cli.js b/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/cli.js new file mode 100755 index 00000000..ac4da484 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/cli.js @@ -0,0 +1,41 @@ +#!/usr/bin/env node +'use strict'; +var fs = require('fs'); +var strip = require('./strip-json-comments'); +var input = process.argv[2]; + + +function getStdin(cb) { + var ret = ''; + + process.stdin.setEncoding('utf8'); + + process.stdin.on('data', function (data) { + ret += data; + }); + + process.stdin.on('end', function () { + cb(ret); + }); +} + +if (process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) { + console.log('strip-json-comments > '); + console.log('or'); + console.log('cat | strip-json-comments > '); + return; +} + +if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) { + console.log(require('./package').version); + return; +} + +if (input) { + process.stdout.write(strip(fs.readFileSync(input, 'utf8'))); + return; +} + +getStdin(function (data) { + process.stdout.write(strip(data)); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/package.json b/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/package.json new file mode 100644 index 00000000..64283d2c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/package.json @@ -0,0 +1,78 @@ +{ + "name": "strip-json-comments", + "version": "1.0.2", + "description": "Strip comments from JSON. Lets you use comments in your JSON files!", + "keywords": [ + "json", + "strip", + "remove", + "delete", + "trim", + "comments", + "multiline", + "parse", + "config", + "configuration", + "conf", + "settings", + "util", + "env", + "environment", + "cli", + "bin" + ], + "license": "MIT", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "files": [ + "cli.js", + "strip-json-comments.js" + ], + "main": "strip-json-comments", + "bin": { + "strip-json-comments": "cli.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/strip-json-comments" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "mocha": "*" + }, + "engines": { + "node": ">=0.8.0" + }, + "gitHead": "142dd671c71f90fb7fdba440184b1bb64543acb3", + "bugs": { + "url": "https://github.com/sindresorhus/strip-json-comments/issues" + }, + "homepage": "https://github.com/sindresorhus/strip-json-comments", + "_id": "strip-json-comments@1.0.2", + "_shasum": "5a48ab96023dbac1b7b8d0ffabf6f63f1677be9f", + "_from": "strip-json-comments@>=1.0.1 <1.1.0", + "_npmVersion": "2.1.2", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "5a48ab96023dbac1b7b8d0ffabf6f63f1677be9f", + "tarball": "http://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/readme.md b/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/readme.md new file mode 100644 index 00000000..33652324 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/readme.md @@ -0,0 +1,74 @@ +# strip-json-comments [![Build Status](https://travis-ci.org/sindresorhus/strip-json-comments.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-json-comments) + +> Strip comments from JSON. Lets you use comments in your JSON files! + +This is now possible: + +```js +{ + // rainbows + "unicorn": /* ❤ */ "cake" +} +``` + +It will remove single-line comments `//` and multi-line comments `/**/`. + +Also available as a [gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin and a [require hook](https://github.com/uTest/autostrip-json-comments). + + +*There's already [json-comments](https://npmjs.org/package/json-comments), but it's only for Node.js and uses a naive regex to strip comments which fails on simple cases like `{"a":"//"}`. This module however parses out the comments.* + + +## Install + +```sh +$ npm install --save strip-json-comments +``` + +```sh +$ bower install --save strip-json-comments +``` + +```sh +$ component install sindresorhus/strip-json-comments +``` + + +## Usage + +```js +var json = '{/*rainbows*/"unicorn":"cake"}'; +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} +``` + + +## API + +### stripJsonComments(input) + +#### input + +Type: `string` + +Accepts a string with JSON and returns a string without comments. + + +## CLI + +```sh +$ npm install --global strip-json-comments +``` + +```sh +$ strip-json-comments --help + +strip-json-comments input-file > output-file +# or +strip-json-comments < input-file > output-file +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/strip-json-comments.js b/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/strip-json-comments.js new file mode 100644 index 00000000..a47976fd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/strip-json-comments/strip-json-comments.js @@ -0,0 +1,67 @@ +/*! + strip-json-comments + Strip comments from JSON. Lets you use comments in your JSON files! + https://github.com/sindresorhus/strip-json-comments + by Sindre Sorhus + MIT License +*/ +(function () { + 'use strict'; + + function stripJsonComments(str) { + var currentChar; + var nextChar; + var insideString = false; + var insideComment = false; + var ret = ''; + + for (var i = 0; i < str.length; i++) { + currentChar = str[i]; + nextChar = str[i + 1]; + + if (!insideComment && str[i - 1] !== '\\' && currentChar === '"') { + insideString = !insideString; + } + + if (insideString) { + ret += currentChar; + continue; + } + + if (!insideComment && currentChar + nextChar === '//') { + insideComment = 'single'; + i++; + } else if (insideComment === 'single' && currentChar + nextChar === '\r\n') { + insideComment = false; + i++; + ret += currentChar; + ret += nextChar; + continue; + } else if (insideComment === 'single' && currentChar === '\n') { + insideComment = false; + } else if (!insideComment && currentChar + nextChar === '/*') { + insideComment = 'multi'; + i++; + continue; + } else if (insideComment === 'multi' && currentChar + nextChar === '*/') { + insideComment = false; + i++; + continue; + } + + if (insideComment) { + continue; + } + + ret += currentChar; + } + + return ret; + } + + if (typeof module !== 'undefined' && module.exports) { + module.exports = stripJsonComments; + } else { + window.stripJsonComments = stripJsonComments; + } +})(); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/.travis.yml b/node_modules/standard/node_modules/eslint/node_modules/text-table/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/text-table/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/eslint/node_modules/text-table/example/align.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/align.js new file mode 100644 index 00000000..9be43098 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/align.js @@ -0,0 +1,8 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] +], { align: [ 'l', 'r' ] }); +console.log(t); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/example/center.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/center.js new file mode 100644 index 00000000..52b1c69e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/center.js @@ -0,0 +1,8 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] +], { align: [ 'l', 'c', 'l' ] }); +console.log(t); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/example/dotalign.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/dotalign.js new file mode 100644 index 00000000..2cea6299 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/dotalign.js @@ -0,0 +1,9 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] +], { align: [ 'l', '.' ] }); +console.log(t); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/example/doubledot.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/doubledot.js new file mode 100644 index 00000000..bab983b6 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/doubledot.js @@ -0,0 +1,11 @@ +var table = require('../'); +var t = table([ + [ '0.1.2' ], + [ '11.22.33' ], + [ '5.6.7' ], + [ '1.22222' ], + [ '12345.' ], + [ '5555.' ], + [ '123' ] +], { align: [ '.' ] }); +console.log(t); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/example/table.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/table.js new file mode 100644 index 00000000..903ea4c4 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/example/table.js @@ -0,0 +1,6 @@ +var table = require('../'); +var t = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] +]); +console.log(t); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/index.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/index.js new file mode 100644 index 00000000..5c0ba987 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/index.js @@ -0,0 +1,86 @@ +module.exports = function (rows_, opts) { + if (!opts) opts = {}; + var hsep = opts.hsep === undefined ? ' ' : opts.hsep; + var align = opts.align || []; + var stringLength = opts.stringLength + || function (s) { return String(s).length; } + ; + + var dotsizes = reduce(rows_, function (acc, row) { + forEach(row, function (c, ix) { + var n = dotindex(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); + + var rows = map(rows_, function (row) { + return map(row, function (c_, ix) { + var c = String(c_); + if (align[ix] === '.') { + var index = dotindex(c); + var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2) + - (stringLength(c) - index) + ; + return c + Array(size).join(' '); + } + else return c; + }); + }); + + var sizes = reduce(rows, function (acc, row) { + forEach(row, function (c, ix) { + var n = stringLength(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); + + return map(rows, function (row) { + return map(row, function (c, ix) { + var n = (sizes[ix] - stringLength(c)) || 0; + var s = Array(Math.max(n + 1, 1)).join(' '); + if (align[ix] === 'r' || align[ix] === '.') { + return s + c; + } + if (align[ix] === 'c') { + return Array(Math.ceil(n / 2 + 1)).join(' ') + + c + Array(Math.floor(n / 2 + 1)).join(' ') + ; + } + + return c + s; + }).join(hsep).replace(/\s+$/, ''); + }).join('\n'); +}; + +function dotindex (c) { + var m = /\.[^.]*$/.exec(c); + return m ? m.index + 1 : c.length; +} + +function reduce (xs, f, init) { + if (xs.reduce) return xs.reduce(f, init); + var i = 0; + var acc = arguments.length >= 3 ? init : xs[i++]; + for (; i < xs.length; i++) { + f(acc, xs[i], i); + } + return acc; +} + +function forEach (xs, f) { + if (xs.forEach) return xs.forEach(f); + for (var i = 0; i < xs.length; i++) { + f.call(xs, xs[i], i); + } +} + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f.call(xs, xs[i], i)); + } + return res; +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/package.json b/node_modules/standard/node_modules/eslint/node_modules/text-table/package.json new file mode 100644 index 00000000..38707c10 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/package.json @@ -0,0 +1,70 @@ +{ + "name": "text-table", + "version": "0.2.0", + "description": "borderless text tables with alignment", + "main": "index.js", + "devDependencies": { + "tap": "~0.4.0", + "tape": "~1.0.2", + "cli-color": "~0.2.3" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "chrome/20..latest", + "firefox/10..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6", + "ipad/6" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/text-table.git" + }, + "homepage": "https://github.com/substack/text-table", + "keywords": [ + "text", + "table", + "align", + "ascii", + "rows", + "tabular" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "readme": "# text-table\n\ngenerate borderless text table strings suitable for printing to stdout\n\n[![build status](https://secure.travis-ci.org/substack/text-table.png)](http://travis-ci.org/substack/text-table)\n\n[![browser support](https://ci.testling.com/substack/text-table.png)](http://ci.testling.com/substack/text-table)\n\n# example\n\n## default align\n\n``` js\nvar table = require('text-table');\nvar t = table([\n [ 'master', '0123456789abcdef' ],\n [ 'staging', 'fedcba9876543210' ]\n]);\nconsole.log(t);\n```\n\n```\nmaster 0123456789abcdef\nstaging fedcba9876543210\n```\n\n## left-right align\n\n``` js\nvar table = require('text-table');\nvar t = table([\n [ 'beep', '1024' ],\n [ 'boop', '33450' ],\n [ 'foo', '1006' ],\n [ 'bar', '45' ]\n], { align: [ 'l', 'r' ] });\nconsole.log(t);\n```\n\n```\nbeep 1024\nboop 33450\nfoo 1006\nbar 45\n```\n\n## dotted align\n\n``` js\nvar table = require('text-table');\nvar t = table([\n [ 'beep', '1024' ],\n [ 'boop', '334.212' ],\n [ 'foo', '1006' ],\n [ 'bar', '45.6' ],\n [ 'baz', '123.' ]\n], { align: [ 'l', '.' ] });\nconsole.log(t);\n```\n\n```\nbeep 1024\nboop 334.212\nfoo 1006\nbar 45.6\nbaz 123.\n```\n\n## centered\n\n``` js\nvar table = require('text-table');\nvar t = table([\n [ 'beep', '1024', 'xyz' ],\n [ 'boop', '3388450', 'tuv' ],\n [ 'foo', '10106', 'qrstuv' ],\n [ 'bar', '45', 'lmno' ]\n], { align: [ 'l', 'c', 'l' ] });\nconsole.log(t);\n```\n\n```\nbeep 1024 xyz\nboop 3388450 tuv\nfoo 10106 qrstuv\nbar 45 lmno\n```\n\n# methods\n\n``` js\nvar table = require('text-table')\n```\n\n## var s = table(rows, opts={})\n\nReturn a formatted table string `s` from an array of `rows` and some options\n`opts`.\n\n`rows` should be an array of arrays containing strings, numbers, or other\nprintable values.\n\noptions can be:\n\n* `opts.hsep` - separator to use between columns, default `' '`\n* `opts.align` - array of alignment types for each column, default `['l','l',...]`\n* `opts.stringLength` - callback function to use when calculating the string length\n\nalignment types are:\n\n* `'l'` - left\n* `'r'` - right\n* `'c'` - center\n* `'.'` - decimal\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install text-table\n```\n\n# Use with ANSI-colors\n\nSince the string length of ANSI color schemes does not equal the length\nJavaScript sees internally it is necessary to pass the a custom string length\ncalculator during the main function call.\n\nSee the `test/ansi-colors.js` file for an example.\n\n# license\n\nMIT\n", + "readmeFilename": "readme.markdown", + "bugs": { + "url": "https://github.com/substack/text-table/issues" + }, + "_id": "text-table@0.2.0", + "dist": { + "shasum": "7f5ee823ae805207c00af2df4a84ec3fcfa570b4", + "tarball": "http://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" + }, + "_from": "text-table@>=0.2.0 <0.3.0", + "_npmVersion": "1.3.7", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "directories": {}, + "_shasum": "7f5ee823ae805207c00af2df4a84ec3fcfa570b4", + "_resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/readme.markdown b/node_modules/standard/node_modules/eslint/node_modules/text-table/readme.markdown new file mode 100644 index 00000000..18806acd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/readme.markdown @@ -0,0 +1,134 @@ +# text-table + +generate borderless text table strings suitable for printing to stdout + +[![build status](https://secure.travis-ci.org/substack/text-table.png)](http://travis-ci.org/substack/text-table) + +[![browser support](https://ci.testling.com/substack/text-table.png)](http://ci.testling.com/substack/text-table) + +# example + +## default align + +``` js +var table = require('text-table'); +var t = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] +]); +console.log(t); +``` + +``` +master 0123456789abcdef +staging fedcba9876543210 +``` + +## left-right align + +``` js +var table = require('text-table'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] +], { align: [ 'l', 'r' ] }); +console.log(t); +``` + +``` +beep 1024 +boop 33450 +foo 1006 +bar 45 +``` + +## dotted align + +``` js +var table = require('text-table'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] +], { align: [ 'l', '.' ] }); +console.log(t); +``` + +``` +beep 1024 +boop 334.212 +foo 1006 +bar 45.6 +baz 123. +``` + +## centered + +``` js +var table = require('text-table'); +var t = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] +], { align: [ 'l', 'c', 'l' ] }); +console.log(t); +``` + +``` +beep 1024 xyz +boop 3388450 tuv +foo 10106 qrstuv +bar 45 lmno +``` + +# methods + +``` js +var table = require('text-table') +``` + +## var s = table(rows, opts={}) + +Return a formatted table string `s` from an array of `rows` and some options +`opts`. + +`rows` should be an array of arrays containing strings, numbers, or other +printable values. + +options can be: + +* `opts.hsep` - separator to use between columns, default `' '` +* `opts.align` - array of alignment types for each column, default `['l','l',...]` +* `opts.stringLength` - callback function to use when calculating the string length + +alignment types are: + +* `'l'` - left +* `'r'` - right +* `'c'` - center +* `'.'` - decimal + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install text-table +``` + +# Use with ANSI-colors + +Since the string length of ANSI color schemes does not equal the length +JavaScript sees internally it is necessary to pass the a custom string length +calculator during the main function call. + +See the `test/ansi-colors.js` file for an example. + +# license + +MIT diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/test/align.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/align.js new file mode 100644 index 00000000..245357f2 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/align.js @@ -0,0 +1,18 @@ +var test = require('tape'); +var table = require('../'); + +test('align', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] + ], { align: [ 'l', 'r' ] }); + t.equal(s, [ + 'beep 1024', + 'boop 33450', + 'foo 1006', + 'bar 45' + ].join('\n')); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/test/ansi-colors.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/ansi-colors.js new file mode 100644 index 00000000..fbc5bb10 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/ansi-colors.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var table = require('../'); +var color = require('cli-color'); +var ansiTrim = require('cli-color/lib/trim'); + +test('center', function (t) { + t.plan(1); + var opts = { + align: [ 'l', 'c', 'l' ], + stringLength: function(s) { return ansiTrim(s).length } + }; + var s = table([ + [ + color.red('Red'), color.green('Green'), color.blue('Blue') + ], + [ + color.bold('Bold'), color.underline('Underline'), + color.italic('Italic') + ], + [ + color.inverse('Inverse'), color.strike('Strike'), + color.blink('Blink') + ], + [ 'bar', '45', 'lmno' ] + ], opts); + t.equal(ansiTrim(s), [ + 'Red Green Blue', + 'Bold Underline Italic', + 'Inverse Strike Blink', + 'bar 45 lmno' + ].join('\n')); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/test/center.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/center.js new file mode 100644 index 00000000..c2c7a62a --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/center.js @@ -0,0 +1,18 @@ +var test = require('tape'); +var table = require('../'); + +test('center', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] + ], { align: [ 'l', 'c', 'l' ] }); + t.equal(s, [ + 'beep 1024 xyz', + 'boop 3388450 tuv', + 'foo 10106 qrstuv', + 'bar 45 lmno' + ].join('\n')); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/test/dotalign.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/dotalign.js new file mode 100644 index 00000000..f804f928 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/dotalign.js @@ -0,0 +1,20 @@ +var test = require('tape'); +var table = require('../'); + +test('dot align', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] + ], { align: [ 'l', '.' ] }); + t.equal(s, [ + 'beep 1024', + 'boop 334.212', + 'foo 1006', + 'bar 45.6', + 'baz 123.' + ].join('\n')); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/test/doubledot.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/doubledot.js new file mode 100644 index 00000000..659b57c9 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/doubledot.js @@ -0,0 +1,24 @@ +var test = require('tape'); +var table = require('../'); + +test('dot align', function (t) { + t.plan(1); + var s = table([ + [ '0.1.2' ], + [ '11.22.33' ], + [ '5.6.7' ], + [ '1.22222' ], + [ '12345.' ], + [ '5555.' ], + [ '123' ] + ], { align: [ '.' ] }); + t.equal(s, [ + ' 0.1.2', + '11.22.33', + ' 5.6.7', + ' 1.22222', + '12345.', + ' 5555.', + ' 123' + ].join('\n')); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/text-table/test/table.js b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/table.js new file mode 100644 index 00000000..9c670146 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/text-table/test/table.js @@ -0,0 +1,14 @@ +var test = require('tape'); +var table = require('../'); + +test('table', function (t) { + t.plan(1); + var s = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] + ]); + t.equal(s, [ + 'master 0123456789abcdef', + 'staging fedcba9876543210' + ].join('\n')); +}); diff --git a/node_modules/standard/node_modules/eslint/node_modules/user-home/cli.js b/node_modules/standard/node_modules/eslint/node_modules/user-home/cli.js new file mode 100755 index 00000000..bacbd227 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/user-home/cli.js @@ -0,0 +1,26 @@ +#!/usr/bin/env node +'use strict'; +var pkg = require('./package.json'); +var userHome = require('./'); + +function help() { + console.log([ + pkg.description, + '', + 'Example', + ' $ user-home', + ' /Users/sindresorhus' + ].join('\n')); +} + +if (process.argv.indexOf('--help') !== -1) { + help(); + return; +} + +if (process.argv.indexOf('--version') !== -1) { + console.log(pkg.version); + return; +} + +process.stdout.write(userHome); diff --git a/node_modules/standard/node_modules/eslint/node_modules/user-home/index.js b/node_modules/standard/node_modules/eslint/node_modules/user-home/index.js new file mode 100644 index 00000000..d53b7939 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/user-home/index.js @@ -0,0 +1,15 @@ +'use strict'; +var env = process.env; +var home = env.HOME; +var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME; + +if (process.platform === 'win32') { + module.exports = env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null; +} else if (process.platform === 'darwin') { + module.exports = home || (user ? '/Users/' + user : null) || null; +} else if (process.platform === 'linux') { + module.exports = home || + (user ? (process.getuid() === 0 ? '/root' : '/home/' + user) : null) || null; +} else { + module.exports = home || null; +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/user-home/license b/node_modules/standard/node_modules/eslint/node_modules/user-home/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/user-home/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/standard/node_modules/eslint/node_modules/user-home/package.json b/node_modules/standard/node_modules/eslint/node_modules/user-home/package.json new file mode 100644 index 00000000..e1cd6f5f --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/user-home/package.json @@ -0,0 +1,69 @@ +{ + "name": "user-home", + "version": "1.1.1", + "description": "Get the path to the user home directory", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/user-home" + }, + "bin": { + "user-home": "cli.js" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "user", + "home", + "homedir", + "dir", + "directory", + "folder", + "path" + ], + "devDependencies": { + "ava": "0.0.3" + }, + "gitHead": "cf6ba885d3e6bf625fb3c15ad0334fa623968481", + "bugs": { + "url": "https://github.com/sindresorhus/user-home/issues" + }, + "homepage": "https://github.com/sindresorhus/user-home", + "_id": "user-home@1.1.1", + "_shasum": "2b5be23a32b63a7c9deb8d0f28d485724a3df190", + "_from": "user-home@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "2b5be23a32b63a7c9deb8d0f28d485724a3df190", + "tarball": "http://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/user-home/readme.md b/node_modules/standard/node_modules/eslint/node_modules/user-home/readme.md new file mode 100644 index 00000000..5307a07e --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/user-home/readme.md @@ -0,0 +1,42 @@ +# user-home [![Build Status](https://travis-ci.org/sindresorhus/user-home.svg?branch=master)](https://travis-ci.org/sindresorhus/user-home) + +> Get the path to the user home directory + + +## Install + +```sh +$ npm install --save user-home +``` + + +## Usage + +```js +var userHome = require('user-home'); + +console.log(userHome); +//=> /Users/sindresorhus +``` + +Returns `null` in the unlikely scenario that the home directory can't be found. + + +## CLI + +```sh +$ npm install --global user-home +``` + +```sh +$ user-home --help + +Example + $ user-home + /Users/sindresorhus +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/eslint/node_modules/xml-escape/.npmignore b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/.npmignore new file mode 100644 index 00000000..a72b52eb --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules diff --git a/node_modules/standard/node_modules/eslint/node_modules/xml-escape/LICENSE b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/LICENSE new file mode 100644 index 00000000..bd261eff --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Michael Hernandez + +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/node_modules/standard/node_modules/eslint/node_modules/xml-escape/README.md b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/README.md new file mode 100644 index 00000000..db55ce80 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/README.md @@ -0,0 +1,15 @@ +xml-escape +========== + +Escape XML in javascript (NodeJS) + + +npm install xml-escape + +// Warning escape is a reserved word, so maybe best to use xmlescape for var name +var xmlescape = require('xml-escape'); + +xmlescape('"hello" \'world\' & false < true > -1') + +// output +// '"hello" 'world' & true < false > -1' \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/xml-escape/index.js b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/index.js new file mode 100644 index 00000000..d26715dd --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/index.js @@ -0,0 +1,15 @@ + + +var escape = module.exports = function escape(string) { + return string.replace(/([&"<>'])/g, function(str, item) { + return escape.map[item]; + }) +} + +var map = escape.map = { + '>': '>' + , '<': '<' + , "'": ''' + , '"': '"' + , '&': '&' +} \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/node_modules/xml-escape/package.json b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/package.json new file mode 100644 index 00000000..46412796 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/package.json @@ -0,0 +1,53 @@ +{ + "name": "xml-escape", + "version": "1.0.0", + "description": "Escape XML ", + "main": "index.js", + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/miketheprogrammer/xml-escape.git" + }, + "keywords": [ + "Escape", + "XML", + "Unesacpe", + "encoding", + "xml-escape" + ], + "author": { + "name": "Michael Hernandez - michael.hernandez1988@gmail.com" + }, + "license": "MIT License", + "bugs": { + "url": "https://github.com/miketheprogrammer/xml-escape/issues" + }, + "homepage": "https://github.com/miketheprogrammer/xml-escape", + "dependencies": {}, + "devDependencies": { + "tape": "~2.4.2" + }, + "_id": "xml-escape@1.0.0", + "dist": { + "shasum": "00963d697b2adf0c185c4e04e73174ba9b288eb2", + "tarball": "http://registry.npmjs.org/xml-escape/-/xml-escape-1.0.0.tgz" + }, + "_from": "xml-escape@>=1.0.0 <1.1.0", + "_npmVersion": "1.3.14", + "_npmUser": { + "name": "mhernandez", + "email": "michael.hernandez1988@gmail.com" + }, + "maintainers": [ + { + "name": "mhernandez", + "email": "michael.hernandez1988@gmail.com" + } + ], + "directories": {}, + "_shasum": "00963d697b2adf0c185c4e04e73174ba9b288eb2", + "_resolved": "https://registry.npmjs.org/xml-escape/-/xml-escape-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/eslint/node_modules/xml-escape/test.js b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/test.js new file mode 100644 index 00000000..211c3b81 --- /dev/null +++ b/node_modules/standard/node_modules/eslint/node_modules/xml-escape/test.js @@ -0,0 +1,7 @@ +var test = require('tape'); +var escape = require('./index'); +test("Characters should be escaped properly", function (t) { + t.plan(1); + + t.equals(escape('" \' < > &'), '" ' < > &'); +}) \ No newline at end of file diff --git a/node_modules/standard/node_modules/eslint/package.json b/node_modules/standard/node_modules/eslint/package.json new file mode 100644 index 00000000..52ee818c --- /dev/null +++ b/node_modules/standard/node_modules/eslint/package.json @@ -0,0 +1,118 @@ +{ + "name": "eslint", + "version": "0.18.0", + "author": { + "name": "Nicholas C. Zakas", + "email": "nicholas+npm@nczconsulting.com" + }, + "description": "An AST-based pattern checker for JavaScript.", + "bin": { + "eslint": "./bin/eslint.js" + }, + "main": "./lib/api.js", + "scripts": { + "test": "node Makefile.js test", + "lint": "node Makefile.js lint", + "patch": "node Makefile.js patch", + "minor": "node Makefile.js minor", + "major": "node Makefile.js major", + "docs": "node Makefile.js docs", + "gensite": "node Makefile.js gensite", + "browserify": "node Makefile.js browserify", + "perf": "node Makefile.js perf", + "profile": "beefy tests/bench/bench.js --open -- -t brfs -t ./tests/bench/xform-rules.js", + "coveralls": "cat ./coverage/lcov.info | coveralls" + }, + "files": [ + "LICENSE", + "README.md", + "bin", + "conf", + "lib" + ], + "repository": { + "type": "git", + "url": "https://github.com/eslint/eslint" + }, + "homepage": "http://eslint.org", + "bugs": { + "url": "https://github.com/eslint/eslint/issues/" + }, + "dependencies": { + "chalk": "^1.0.0", + "concat-stream": "^1.4.6", + "debug": "^2.1.1", + "doctrine": "^0.6.2", + "escape-string-regexp": "^1.0.2", + "escope": "2.0.6", + "espree": "^1.12.0", + "estraverse": "^2.0.0", + "estraverse-fb": "^1.3.1", + "globals": "^6.1.0", + "js-yaml": "^3.2.5", + "minimatch": "^2.0.1", + "mkdirp": "^0.5.0", + "object-assign": "^2.0.0", + "optionator": "^0.5.0", + "strip-json-comments": "~1.0.1", + "text-table": "~0.2.0", + "user-home": "^1.0.0", + "xml-escape": "~1.0.0" + }, + "devDependencies": { + "beefy": "^1.0.0", + "brfs": "0.0.9", + "browserify": "^8.1.3", + "chai": "^1.9.1", + "coveralls": "2.11.2", + "dateformat": "^1.0.8", + "esprima-fb": "^10001.1.0-dev-harmony-fb", + "eslint-tester": "^0.6.0", + "istanbul": "^0.3.5", + "jsdoc": "^3.3.0-beta1", + "jsonlint": "^1.6.2", + "mocha": "^2.1.0", + "mocha-phantomjs": "^3.5.0", + "npm-license": "^0.2.3", + "phantomjs": "^1.9.9", + "proxyquire": "^1.0.0", + "semver": "^4.1.0", + "shelljs": "^0.3.0", + "shelljs-nodecli": "~0.1.0", + "sinon": "^1.12.2", + "through": "^2.3.6" + }, + "keywords": [ + "ast", + "lint", + "javascript", + "ecmascript", + "espree" + ], + "license": "MIT", + "engines": { + "node": ">=0.10" + }, + "gitHead": "a5ce647aedd4627143d7928051cadaf86ab30932", + "_id": "eslint@0.18.0", + "_shasum": "e1117ccd86af174b0312ffe82509019d5b50759b", + "_from": "eslint@>=0.18.0 <0.19.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "nzakas", + "email": "nicholas@nczconsulting.com" + }, + "maintainers": [ + { + "name": "nzakas", + "email": "nicholas@nczconsulting.com" + } + ], + "dist": { + "shasum": "e1117ccd86af174b0312ffe82509019d5b50759b", + "tarball": "http://registry.npmjs.org/eslint/-/eslint-0.18.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/eslint/-/eslint-0.18.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/find-root/.npmignore b/node_modules/standard/node_modules/find-root/.npmignore new file mode 100644 index 00000000..fd4f2b06 --- /dev/null +++ b/node_modules/standard/node_modules/find-root/.npmignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/node_modules/standard/node_modules/find-root/LICENSE.md b/node_modules/standard/node_modules/find-root/LICENSE.md new file mode 100644 index 00000000..c0db24fd --- /dev/null +++ b/node_modules/standard/node_modules/find-root/LICENSE.md @@ -0,0 +1,7 @@ +Copyright © 2013 AgileMD http://agilemd.com + +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. \ No newline at end of file diff --git a/node_modules/standard/node_modules/find-root/README.md b/node_modules/standard/node_modules/find-root/README.md new file mode 100644 index 00000000..b7cd9189 --- /dev/null +++ b/node_modules/standard/node_modules/find-root/README.md @@ -0,0 +1,53 @@ +# find-root +recursively find the closest package.json + +## usage +Say you want to check if the directory name of a project matches its +module name in package.json: + +```js +var path = require('path') +var findRoot = require('find-root') + +// from a starting directory, recursively search for the nearest +// directory containing package.json +var root = findRoot('/Users/jden/dev/find-root/tests') +// => '/Users/jden/dev/find-root' + +var dirname = path.basename(root) +console.log('is it the same?') +console.log(dirname === require(path.join(root, 'package.json')).name) +``` + + +## api + +### `findRoot: (startingPath : String) => String` + +Returns the path for the nearest directory to `startingPath` containing +a `package.json` file, eg `/foo/module`. + +Throws an error if no `package.json` is found at any level in the +`startingPath`. + + +## installation + + $ npm install find-root + + +## running the tests + +From package root: + + $ npm install + $ npm test + + +## contributors + +- jden + + +## license +MIT. (c) MMXIII AgileMD http://agilemd.com diff --git a/node_modules/standard/node_modules/find-root/index.js b/node_modules/standard/node_modules/find-root/index.js new file mode 100644 index 00000000..84e13361 --- /dev/null +++ b/node_modules/standard/node_modules/find-root/index.js @@ -0,0 +1,23 @@ +var path = require('path') +var fs = require('fs') + +function findRoot(start) { + start = start || module.parent.filename + if (typeof start === 'string') { + if (start[start.length-1] !== path.sep) { + start+=path.sep + } + start = start.split(path.sep) + } + if(!start.length) { + throw new Error('package.json not found in path') + } + start.pop() + var dir = start.join(path.sep) + if (fs.existsSync(path.join(dir, 'package.json'))) { + return dir + } + return findRoot(start) +} + +module.exports = findRoot \ No newline at end of file diff --git a/node_modules/standard/node_modules/find-root/package.json b/node_modules/standard/node_modules/find-root/package.json new file mode 100644 index 00000000..5532dc11 --- /dev/null +++ b/node_modules/standard/node_modules/find-root/package.json @@ -0,0 +1,60 @@ +{ + "name": "find-root", + "author": { + "name": "AgileMD", + "email": "hello@agilemd.com" + }, + "contributors": [ + { + "name": "jden", + "email": "jason@denizac.org" + } + ], + "version": "0.1.1", + "description": "find the closest package.json", + "keywords": [ + "package", + "module", + "base", + "root" + ], + "main": "index.js", + "scripts": { + "test": "node node_modules/mocha/bin/mocha" + }, + "repository": { + "type": "git", + "url": "git@github.com:agilemd/find-root.git" + }, + "license": "MIT", + "devDependencies": { + "chai": "~1.6.0", + "mocha": "~1.9.0", + "moquire": "~1.5.4" + }, + "bugs": { + "url": "https://github.com/agilemd/find-root/issues" + }, + "homepage": "https://github.com/agilemd/find-root", + "_id": "find-root@0.1.1", + "dist": { + "shasum": "f636d46f3e75f085f3289eb7c7791e5039a377ca", + "tarball": "http://registry.npmjs.org/find-root/-/find-root-0.1.1.tgz" + }, + "_from": "find-root@>=0.1.1 <0.2.0", + "_npmVersion": "1.3.14", + "_npmUser": { + "name": "jden", + "email": "jason@denizac.org" + }, + "maintainers": [ + { + "name": "jden", + "email": "jason@denizac.org" + } + ], + "directories": {}, + "_shasum": "f636d46f3e75f085f3289eb7c7791e5039a377ca", + "_resolved": "https://registry.npmjs.org/find-root/-/find-root-0.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/find-root/test/test.js b/node_modules/standard/node_modules/find-root/test/test.js new file mode 100644 index 00000000..bce76697 --- /dev/null +++ b/node_modules/standard/node_modules/find-root/test/test.js @@ -0,0 +1,49 @@ +var chai = require('chai') +chai.should() +var expect = chai.expect +var moquire = require('moquire') +var path = require('path') + +var MODULE = '../' + +describe('find-root', function () { + + it('recursively looks for package.json', function () { + + var checked = [] + var fs = { + existsSync: function (path) { + checked.push(path) + return path === '/foo/package.json' + } + } + + var findRoot = moquire(MODULE, {fs: fs}) + + findRoot('/foo/bar/baz') + .should.equal('/foo') + + checked.should.deep.equal([ + '/foo/bar/baz/package.json', + '/foo/bar/package.json', + '/foo/package.json' + ]) + + }) + + it('throws if not found', function () { + + var fs = { + existsSync: function (path) { + return false + } + } + + var findRoot = moquire(MODULE, {fs: fs}) + + expect(function () { + findRoot('/foo/bar/baz/') + }).to.throw('not found') + + }) +}) \ No newline at end of file diff --git a/node_modules/standard/node_modules/get-stdin/index.js b/node_modules/standard/node_modules/get-stdin/index.js new file mode 100644 index 00000000..0f1aeb3d --- /dev/null +++ b/node_modules/standard/node_modules/get-stdin/index.js @@ -0,0 +1,49 @@ +'use strict'; + +module.exports = function (cb) { + var stdin = process.stdin; + var ret = ''; + + if (stdin.isTTY) { + setImmediate(cb, ''); + return; + } + + stdin.setEncoding('utf8'); + + stdin.on('readable', function () { + var chunk; + + while (chunk = stdin.read()) { + ret += chunk; + } + }); + + stdin.on('end', function () { + cb(ret); + }); +}; + +module.exports.buffer = function (cb) { + var stdin = process.stdin; + var ret = []; + var len = 0; + + if (stdin.isTTY) { + setImmediate(cb, new Buffer('')); + return; + } + + stdin.on('readable', function () { + var chunk; + + while (chunk = stdin.read()) { + ret.push(chunk); + len += chunk.length; + } + }); + + stdin.on('end', function () { + cb(Buffer.concat(ret, len)); + }); +}; diff --git a/node_modules/standard/node_modules/get-stdin/package.json b/node_modules/standard/node_modules/get-stdin/package.json new file mode 100644 index 00000000..e0e5c64a --- /dev/null +++ b/node_modules/standard/node_modules/get-stdin/package.json @@ -0,0 +1,64 @@ +{ + "name": "get-stdin", + "version": "4.0.1", + "description": "Easier stdin", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/get-stdin" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js && node test-buffer.js && echo unicorns | node test-real.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "std", + "stdin", + "stdio", + "concat", + "buffer", + "stream", + "process", + "stream" + ], + "devDependencies": { + "ava": "0.0.4", + "buffer-equal": "0.0.1" + }, + "gitHead": "65c744975229b25d6cc5c7546f49b6ad9099553f", + "bugs": { + "url": "https://github.com/sindresorhus/get-stdin/issues" + }, + "homepage": "https://github.com/sindresorhus/get-stdin", + "_id": "get-stdin@4.0.1", + "_shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe", + "_from": "get-stdin@>=4.0.1 <5.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe", + "tarball": "http://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/get-stdin/readme.md b/node_modules/standard/node_modules/get-stdin/readme.md new file mode 100644 index 00000000..bc1d32a8 --- /dev/null +++ b/node_modules/standard/node_modules/get-stdin/readme.md @@ -0,0 +1,44 @@ +# get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin) + +> Easier stdin + + +## Install + +```sh +$ npm install --save get-stdin +``` + + +## Usage + +```js +// example.js +var stdin = require('get-stdin'); + +stdin(function (data) { + console.log(data); + //=> unicorns +}); +``` + +```sh +$ echo unicorns | node example.js +unicorns +``` + + +## API + +### stdin(callback) + +Get `stdin` as a string. + +### stdin.buffer(callback) + +Get `stdin` as a buffer. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/glob/LICENSE b/node_modules/standard/node_modules/glob/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/glob/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/glob/README.md b/node_modules/standard/node_modules/glob/README.md new file mode 100644 index 00000000..fa993dcb --- /dev/null +++ b/node_modules/standard/node_modules/glob/README.md @@ -0,0 +1,378 @@ +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Dependency Status](https://david-dm.org/isaacs/node-glob.svg)](https://david-dm.org/isaacs/node-glob) [![devDependency Status](https://david-dm.org/isaacs/node-glob/dev-status.svg)](https://david-dm.org/isaacs/node-glob#info=devDependencies) [![optionalDependency Status](https://david-dm.org/isaacs/node-glob/optional-status.svg)](https://david-dm.org/isaacs/node-glob#info=optionalDependencies) + +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![](oh-my-glob.gif) + +## Usage + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Negation + +The intent for negation would be for a pattern starting with `!` to +match everything that *doesn't* match the supplied pattern. However, +the implementation is weird, and for the time being, this should be +avoided. The behavior is deprecated in version 5, and will be removed +entirely in version 6. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` {String} Pattern to be matched +* `options` {Object} +* `cb` {Function} + * `err` {Error | null} + * `matches` {Array} filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` {String} Pattern to be matched +* `options` {Object} +* return: {Array} filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` {String} pattern to search for +* `options` {Object} +* `cb` {Function} Called when an error occurs, or matches are found + * `err` {Error | null} + * `matches` {Array} filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'DIR'` - Path exists, and is not a directory + * `'FILE'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the matched. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nonull` Return the pattern when no matches are found. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of patterns to exclude matches. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `nonegate` Suppress deprecated `negate` behavior. (See below.) + Default=true +* `nocomment` Suppress deprecated `comment` behavior. (See below.) + Default=true + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +**Note**: In version 5 of this module, negation and comments are +**disabled** by default. You can explicitly set `nonegate:false` or +`nocomment:false` to re-enable them. They are going away entirely in +version 6. + +The intent for negation would be for a pattern starting with `!` to +match everything that *doesn't* match the supplied pattern. However, +the implementation is weird. It is better to use the `ignore` option +to set a pattern or set of patterns to exclude from matches. If you +want the "everything except *x*" type of behavior, you can use `**` as +the main pattern, and set an `ignore` for the things to exclude. + +The comments feature is added in minimatch, primarily to more easily +support use cases like ignore files, where a `#` at the start of a +line makes the pattern "empty". However, in the context of a +straightforward filesystem globber, "comments" don't make much sense. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` diff --git a/node_modules/standard/node_modules/glob/common.js b/node_modules/standard/node_modules/glob/common.js new file mode 100644 index 00000000..7bef9a27 --- /dev/null +++ b/node_modules/standard/node_modules/glob/common.js @@ -0,0 +1,244 @@ +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern) + } + + return { + matcher: new Minimatch(pattern), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = options.cwd + self.changedCwd = path.resolve(options.cwd) !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + self.nomount = !!options.nomount + + // disable comments and negation unless the user explicitly + // passes in false as the option. + options.nonegate = options.nonegate === false ? false : true + options.nocomment = options.nocomment === false ? false : true + deprecationWarning(options) + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +// TODO(isaacs): remove entirely in v6 +// exported to reset in tests +exports.deprecationWarned +function deprecationWarning(options) { + if (!options.nonegate || !options.nocomment) { + if (process.noDeprecation !== true && !exports.deprecationWarned) { + var msg = 'glob WARNING: comments and negation will be disabled in v6' + if (process.throwDeprecation) + throw new Error(msg) + else if (process.traceDeprecation) + console.trace(msg) + else + console.error(msg) + + exports.deprecationWarned = true + } + } +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + return !(/\/$/.test(e)) + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/node_modules/standard/node_modules/glob/glob.js b/node_modules/standard/node_modules/glob/glob.js new file mode 100644 index 00000000..1bfed19d --- /dev/null +++ b/node_modules/standard/node_modules/glob/glob.js @@ -0,0 +1,740 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +glob.hasMagic = function (pattern, options_) { + var options = util._extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + var n = this.minimatch.set.length + this._processing = 0 + this.matches = new Array(n) + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + + function done () { + --self._processing + if (self._processing <= 0) + self._finish() + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + fs.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (this.matches[index][e]) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = this._makeAbs(e) + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + if (this.mark) + e = this._mark(e) + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er) + return cb() + + var isSym = lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) return this.emit('error', er) + if (!this.silent) console.error('glob error', er) + break + } + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && !stat.isDirectory()) + return cb(null, false, stat) + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return cb() + + return cb(null, c, stat) +} diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/.eslintrc b/node_modules/standard/node_modules/glob/node_modules/inflight/.eslintrc new file mode 100644 index 00000000..b7a1550e --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/.eslintrc @@ -0,0 +1,17 @@ +{ + "env" : { + "node" : true + }, + "rules" : { + "semi": [2, "never"], + "strict": 0, + "quotes": [1, "single", "avoid-escape"], + "no-use-before-define": 0, + "curly": 0, + "no-underscore-dangle": 0, + "no-lonely-if": 1, + "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], + "no-mixed-requires": 0, + "space-infix-ops": 0 + } +} diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/LICENSE b/node_modules/standard/node_modules/glob/node_modules/inflight/LICENSE new file mode 100644 index 00000000..05eeeb88 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/README.md b/node_modules/standard/node_modules/glob/node_modules/inflight/README.md new file mode 100644 index 00000000..6dc89291 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/inflight.js b/node_modules/standard/node_modules/glob/node_modules/inflight/inflight.js new file mode 100644 index 00000000..8bc96cbd --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/inflight.js @@ -0,0 +1,44 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/package.json b/node_modules/standard/node_modules/glob/node_modules/inflight/package.json new file mode 100644 index 00000000..a6645bc5 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/package.json @@ -0,0 +1,61 @@ +{ + "name": "inflight", + "version": "1.0.4", + "description": "Add callbacks to requests in flight to avoid async duplication", + "main": "inflight.js", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^0.4.10" + }, + "scripts": { + "test": "tap test.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inflight" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC", + "gitHead": "c7b5531d572a867064d4a1da9e013e8910b7d1ba", + "_id": "inflight@1.0.4", + "_shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", + "_from": "inflight@>=1.0.4 <2.0.0", + "_npmVersion": "2.1.3", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + { + "name": "iarna", + "email": "me@re-becca.org" + } + ], + "dist": { + "shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", + "tarball": "http://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/inflight/test.js b/node_modules/standard/node_modules/glob/node_modules/inflight/test.js new file mode 100644 index 00000000..2bb75b38 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inflight/test.js @@ -0,0 +1,97 @@ +var test = require('tap').test +var inf = require('./inflight.js') + + +function req (key, cb) { + cb = inf(key, cb) + if (cb) setTimeout(function () { + cb(key) + cb(key) + }) + return cb +} + +test('basic', function (t) { + var calleda = false + var a = req('key', function (k) { + t.notOk(calleda) + calleda = true + t.equal(k, 'key') + if (calledb) t.end() + }) + t.ok(a, 'first returned cb function') + + var calledb = false + var b = req('key', function (k) { + t.notOk(calledb) + calledb = true + t.equal(k, 'key') + if (calleda) t.end() + }) + + t.notOk(b, 'second should get falsey inflight response') +}) + +test('timing', function (t) { + var expect = [ + 'method one', + 'start one', + 'end one', + 'two', + 'tick', + 'three' + ] + var i = 0 + + function log (m) { + t.equal(m, expect[i], m + ' === ' + expect[i]) + ++i + if (i === expect.length) + t.end() + } + + function method (name, cb) { + log('method ' + name) + process.nextTick(cb) + } + + var one = inf('foo', function () { + log('start one') + var three = inf('foo', function () { + log('three') + }) + if (three) method('three', three) + log('end one') + }) + + method('one', one) + + var two = inf('foo', function () { + log('two') + }) + if (two) method('one', two) + + process.nextTick(log.bind(null, 'tick')) +}) + +test('parameters', function (t) { + t.plan(8) + + var a = inf('key', function (first, second, third) { + t.equal(first, 1) + t.equal(second, 2) + t.equal(third, 3) + }) + t.ok(a, 'first returned cb function') + + var b = inf('key', function (first, second, third) { + t.equal(first, 1) + t.equal(second, 2) + t.equal(third, 3) + }) + t.notOk(b, 'second should get falsey inflight response') + + setTimeout(function () { + a(1, 2, 3) + }) +}) diff --git a/node_modules/standard/node_modules/glob/node_modules/inherits/LICENSE b/node_modules/standard/node_modules/glob/node_modules/inherits/LICENSE new file mode 100644 index 00000000..dea3013d --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/standard/node_modules/glob/node_modules/inherits/README.md b/node_modules/standard/node_modules/glob/node_modules/inherits/README.md new file mode 100644 index 00000000..b1c56658 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/standard/node_modules/glob/node_modules/inherits/inherits.js b/node_modules/standard/node_modules/glob/node_modules/inherits/inherits.js new file mode 100644 index 00000000..29f5e24f --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inherits/inherits.js @@ -0,0 +1 @@ +module.exports = require('util').inherits diff --git a/node_modules/standard/node_modules/glob/node_modules/inherits/inherits_browser.js b/node_modules/standard/node_modules/glob/node_modules/inherits/inherits_browser.js new file mode 100644 index 00000000..c1e78a75 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} diff --git a/node_modules/standard/node_modules/glob/node_modules/inherits/package.json b/node_modules/standard/node_modules/glob/node_modules/inherits/package.json new file mode 100644 index 00000000..a703bddd --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inherits/package.json @@ -0,0 +1,50 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.1", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits" + }, + "license": "ISC", + "scripts": { + "test": "node test" + }, + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "_id": "inherits@2.0.1", + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "_from": "inherits@>=2.0.0 <3.0.0", + "_npmVersion": "1.3.8", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/isaacs/inherits" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/inherits/test.js b/node_modules/standard/node_modules/glob/node_modules/inherits/test.js new file mode 100644 index 00000000..fc53012d --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/inherits/test.js @@ -0,0 +1,25 @@ +var inherits = require('./inherits.js') +var assert = require('assert') + +function test(c) { + assert(c.constructor === Child) + assert(c.constructor.super_ === Parent) + assert(Object.getPrototypeOf(c) === Child.prototype) + assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) + assert(c instanceof Child) + assert(c instanceof Parent) +} + +function Child() { + Parent.call(this) + test(this) +} + +function Parent() {} + +inherits(Child, Parent) + +var c = new Child +test(c) + +console.log('ok') diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/LICENSE b/node_modules/standard/node_modules/glob/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..05a40109 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +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/node_modules/standard/node_modules/glob/node_modules/minimatch/README.md b/node_modules/standard/node_modules/glob/node_modules/minimatch/README.md new file mode 100644 index 00000000..d458bc2e --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/README.md @@ -0,0 +1,216 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instanting the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +## Functions + +The top-level exported function has a `cache` property, which is an LRU +cache set to store 100 items. So, calling these methods repeatedly +with the same pattern and options will use the same Minimatch object, +saving the cost of parsing it multiple times. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/browser.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/browser.js new file mode 100644 index 00000000..967b45c0 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/browser.js @@ -0,0 +1,1113 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} + +},{"brace-expansion":2,"path":undefined}],2:[function(require,module,exports){ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + var expansions = expand(escapeBraces(str)); + return expansions.filter(identity).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0]).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + expansions.push([pre, N[j], post[k]].join('')) + } + } + + return expansions; +} + + +},{"balanced-match":3,"concat-map":4}],3:[function(require,module,exports){ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} + +},{}],4:[function(require,module,exports){ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (Array.isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +},{}]},{},[1]); diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/minimatch.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000..5e13d6d5 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/minimatch.js @@ -0,0 +1,867 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore new file mode 100644 index 00000000..249bc20e --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore @@ -0,0 +1,2 @@ +node_modules +*.sw* diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml new file mode 100644 index 00000000..6e5919de --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md new file mode 100644 index 00000000..62bc7bae --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md @@ -0,0 +1,121 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js new file mode 100644 index 00000000..60ecfc74 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js @@ -0,0 +1,8 @@ +var expand = require('./'); + +console.log(expand('http://any.org/archive{1996..1999}/vol{1..4}/part{a,b,c}.html')); +console.log(expand('http://www.numericals.com/file{1..100..10}.txt')); +console.log(expand('http://www.letters.com/file{a..z..2}.txt')); +console.log(expand('mkdir /usr/local/src/bash/{old,new,dist,bugs}')); +console.log(expand('chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}')); + diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js new file mode 100644 index 00000000..a23104e9 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js @@ -0,0 +1,191 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore new file mode 100644 index 00000000..fd4f2b06 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile new file mode 100644 index 00000000..fa5da71a --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile @@ -0,0 +1,6 @@ + +test: + @node_modules/.bin/tape test/*.js + +.PHONY: test + diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md new file mode 100644 index 00000000..2aff0ebf --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md @@ -0,0 +1,80 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js new file mode 100644 index 00000000..c02ad348 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js @@ -0,0 +1,5 @@ +var balanced = require('./'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); + diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js new file mode 100644 index 00000000..d165ae81 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -0,0 +1,38 @@ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json new file mode 100644 index 00000000..ede6efef --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -0,0 +1,73 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "0.2.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.1" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "ba40ed78e7114a4a67c51da768a100184dead39c", + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "_id": "balanced-match@0.2.0", + "_shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "_from": "balanced-match@>=0.2.0 <0.3.0", + "_npmVersion": "2.1.8", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "dist": { + "shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js new file mode 100644 index 00000000..36bfd399 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js @@ -0,0 +1,56 @@ +var test = require('tape'); +var balanced = require('..'); + +test('balanced', function(t) { + t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), { + start: 3, + end: 12, + pre: 'pre', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), { + start: 8, + end: 11, + pre: '{{{{{{{{', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body{in}post'), { + start: 8, + end: 11, + pre: 'pre{body', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), { + start: 4, + end: 13, + pre: 'pre}', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), { + start: 3, + end: 8, + pre: 'pre', + body: 'body', + post: 'between{body2}post' + }); + t.notOk(balanced('{', '}', 'nope'), 'should be notOk'); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 3, + end: 19, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 7, + end: 23, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml new file mode 100644 index 00000000..f1d0f13c --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown new file mode 100644 index 00000000..408f70a1 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js new file mode 100644 index 00000000..33656217 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js new file mode 100644 index 00000000..b29a7812 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json new file mode 100644 index 00000000..b5161380 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json @@ -0,0 +1,83 @@ +{ + "name": "concat-map", + "description": "concatenative mapdashery", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-concat-map.git" + }, + "main": "index.js", + "keywords": [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories": { + "example": "example", + "test": "test" + }, + "scripts": { + "test": "tape test/*.js" + }, + "devDependencies": { + "tape": "~2.4.0" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "bugs": { + "url": "https://github.com/substack/node-concat-map/issues" + }, + "homepage": "https://github.com/substack/node-concat-map", + "_id": "concat-map@0.0.1", + "dist": { + "shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "tarball": "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + }, + "_from": "concat-map@0.0.1", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js new file mode 100644 index 00000000..fdbd7022 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json new file mode 100644 index 00000000..5f1866c8 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -0,0 +1,75 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh" + }, + "dependencies": { + "balanced-match": "^0.2.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "tape": "^3.0.3" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "b5fa3b1c74e5e2dba2d0efa19b28335641bc1164", + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "_id": "brace-expansion@1.1.0", + "_shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "_from": "brace-expansion@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + } + ], + "dist": { + "shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js new file mode 100644 index 00000000..5fe2b8ad --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var expand = require('..'); +var fs = require('fs'); +var resfile = __dirname + '/bash-results.txt'; +var cases = fs.readFileSync(resfile, 'utf8').split('><><><><'); + +// throw away the EOF marker +cases.pop() + +test('matches bash expansions', function(t) { + cases.forEach(function(testcase) { + var set = testcase.split('\n'); + var pattern = set.shift(); + var actual = expand(pattern); + + // If it expands to the empty string, then it's actually + // just nothing, but Bash is a singly typed language, so + // "nothing" is the same as "". + if (set.length === 1 && set[0] === '') { + set = [] + } else { + // otherwise, strip off the [] that were added so that + // "" expansions would be preserved properly. + set = set.map(function (s) { + return s.replace(/^\[|\]$/g, '') + }) + } + + t.same(actual, set, pattern); + }); + t.end(); +}) diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt new file mode 100644 index 00000000..958148d2 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt @@ -0,0 +1,1075 @@ +A{b,{d,e},{f,g}}Z +[AbZ] +[AdZ] +[AeZ] +[AfZ] +[AgZ]><><><><><><><\{a,b}{{a,b},a,b} +[{a,b}a] +[{a,b}b] +[{a,b}a] +[{a,b}b]><><><><{{a,b} +[{a] +[{b]><><><><{a,b}} +[a}] +[b}]><><><><{,} +><><><><><><><{,}b +[b] +[b]><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><{-01..5} +[-01] +[000] +[001] +[002] +[003] +[004] +[005]><><><><{-05..100..5} +[-05] +[000] +[005] +[010] +[015] +[020] +[025] +[030] +[035] +[040] +[045] +[050] +[055] +[060] +[065] +[070] +[075] +[080] +[085] +[090] +[095] +[100]><><><><{-05..100} +[-05] +[-04] +[-03] +[-02] +[-01] +[000] +[001] +[002] +[003] +[004] +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0..5..2} +[0] +[2] +[4]><><><><{0001..05..2} +[0001] +[0003] +[0005]><><><><{0001..-5..2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..-5..-2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..5..-2} +[0001] +[0003] +[0005]><><><><{01..5} +[01] +[02] +[03] +[04] +[05]><><><><{1..05} +[01] +[02] +[03] +[04] +[05]><><><><{1..05..3} +[01] +[04]><><><><{05..100} +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0a..0z} +[{0a..0z}]><><><><{a,b\}c,d} +[a] +[b}c] +[d]><><><><{a,b{c,d} +[{a,bc] +[{a,bd]><><><><{a,b}c,d} +[ac,d}] +[bc,d}]><><><><{a..F} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F]><><><><{A..f} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f]><><><><{a..Z} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z]><><><><{A..z} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{z..A} +[z] +[y] +[x] +[w] +[v] +[u] +[t] +[s] +[r] +[q] +[p] +[o] +[n] +[m] +[l] +[k] +[j] +[i] +[h] +[g] +[f] +[e] +[d] +[c] +[b] +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{Z..a} +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{a..F..2} +[a] +[_] +[]] +[[] +[Y] +[W] +[U] +[S] +[Q] +[O] +[M] +[K] +[I] +[G]><><><><{A..f..02} +[A] +[C] +[E] +[G] +[I] +[K] +[M] +[O] +[Q] +[S] +[U] +[W] +[Y] +[[] +[]] +[_] +[a] +[c] +[e]><><><><{a..Z..5} +[a] +[]><><><><><><><{A..z..10} +[A] +[K] +[U] +[_] +[i] +[s]><><><><{z..A..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b] +[`] +[^] +[] +[Z] +[X] +[V] +[T] +[R] +[P] +[N] +[L] +[J] +[H] +[F] +[D] +[B]><><><><{Z..a..20} +[Z]><><><><{a{,b} +[{a] +[{ab]><><><><{a},b} +[a}] +[b]><><><><{x,y{,}g} +[x] +[yg] +[yg]><><><><{x,y{}g} +[x] +[y{}g]><><><><{{a,b} +[{a] +[{b]><><><><{{a,b},c} +[a] +[b] +[c]><><><><{{a,b}c} +[{ac}] +[{bc}]><><><><{{a,b},} +[a] +[b]><><><><><><><{{a,b},}c +[ac] +[bc] +[c]><><><><{{a,b}.} +[{a.}] +[{b.}]><><><><{{a,b}} +[{a}] +[{b}]><><><><><><>< +><><><><{-10..00} +[-10] +[-09] +[-08] +[-07] +[-06] +[-05] +[-04] +[-03] +[-02] +[-01] +[000]><><><><{a,\\{a,b}c} +[a] +[\ac] +[\bc]><><><><{a,\{a,b}c} +[ac}] +[{ac}] +[bc}]><><><><><><><{-10.\.00} +[{-10..00}]><><><><><><><><><><{l,n,m}xyz +[lxyz] +[nxyz] +[mxyz]><><><><{abc\,def} +[{abc,def}]><><><><{abc} +[{abc}]><><><><{x\,y,\{abc\},trie} +[x,y] +[{abc}] +[trie]><><><><{} +[{}]><><><><} +[}]><><><><{ +[{]><><><><><><><{1..10} +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10]><><><><{0..10,braces} +[0..10] +[braces]><><><><{{0..10},braces} +[0] +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10] +[braces]><><><><><><><{3..3} +[3]><><><><><><><{10..1} +[10] +[9] +[8] +[7] +[6] +[5] +[4] +[3] +[2] +[1]><><><><{10..1}y +[10y] +[9y] +[8y] +[7y] +[6y] +[5y] +[4y] +[3y] +[2y] +[1y]><><><><><><><{a..f} +[a] +[b] +[c] +[d] +[e] +[f]><><><><{f..a} +[f] +[e] +[d] +[c] +[b] +[a]><><><><{a..A} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{A..a} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{f..f} +[f]><><><><{1..f} +[{1..f}]><><><><{f..1} +[{f..1}]><><><><{-1..-10} +[-1] +[-2] +[-3] +[-4] +[-5] +[-6] +[-7] +[-8] +[-9] +[-10]><><><><{-20..0} +[-20] +[-19] +[-18] +[-17] +[-16] +[-15] +[-14] +[-13] +[-12] +[-11] +[-10] +[-9] +[-8] +[-7] +[-6] +[-5] +[-4] +[-3] +[-2] +[-1] +[0]><><><><><><><><><><{klklkl}{1,2,3} +[{klklkl}1] +[{klklkl}2] +[{klklkl}3]><><><><{1..10..2} +[1] +[3] +[5] +[7] +[9]><><><><{-1..-10..2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{-1..-10..-2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{10..1..-2} +[10] +[8] +[6] +[4] +[2]><><><><{10..1..2} +[10] +[8] +[6] +[4] +[2]><><><><{1..20..2} +[1] +[3] +[5] +[7] +[9] +[11] +[13] +[15] +[17] +[19]><><><><{1..20..20} +[1]><><><><{100..0..5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{100..0..-5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{a..z} +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{a..z..2} +[a] +[c] +[e] +[g] +[i] +[k] +[m] +[o] +[q] +[s] +[u] +[w] +[y]><><><><{z..a..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b]><><><><{2147483645..2147483649} +[2147483645] +[2147483646] +[2147483647] +[2147483648] +[2147483649]><><><><{10..0..2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{10..0..-2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{-50..-0..5} +[-50] +[-45] +[-40] +[-35] +[-30] +[-25] +[-20] +[-15] +[-10] +[-5] +[0]><><><><{1..10.f} +[{1..10.f}]><><><><{1..ff} +[{1..ff}]><><><><{1..10..ff} +[{1..10..ff}]><><><><{1.20..2} +[{1.20..2}]><><><><{1..20..f2} +[{1..20..f2}]><><><><{1..20..2f} +[{1..20..2f}]><><><><{1..2f..2} +[{1..2f..2}]><><><><{1..ff..2} +[{1..ff..2}]><><><><{1..ff} +[{1..ff}]><><><><{1..f} +[{1..f}]><><><><{1..0f} +[{1..0f}]><><><><{1..10f} +[{1..10f}]><><><><{1..10.f} +[{1..10.f}]><><><><{1..10.f} +[{1..10.f}]><><><>< \ No newline at end of file diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt new file mode 100644 index 00000000..e5161c3d --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt @@ -0,0 +1,182 @@ +# skip quotes for now +# "{x,x}" +# {"x,x"} +# {x","x} +# '{a,b}{{a,b},a,b}' +A{b,{d,e},{f,g}}Z +PRE-{a,b}{{a,b},a,b}-POST +\\{a,b}{{a,b},a,b} +{{a,b} +{a,b}} +{,} +a{,} +{,}b +a{,}b +a{b}c +a{1..5}b +a{01..5}b +a{-01..5}b +a{-01..5..3}b +a{001..9}b +a{b,c{d,e},{f,g}h}x{y,z +a{b,c{d,e},{f,g}h}x{y,z\\} +a{b,c{d,e},{f,g}h}x{y,z} +a{b{c{d,e}f{x,y{{g}h +a{b{c{d,e}f{x,y{}g}h +a{b{c{d,e}f{x,y}}g}h +a{b{c{d,e}f}g}h +a{{x,y},z}b +f{x,y{g,z}}h +f{x,y{{g,z}}h +f{x,y{{g,z}}h} +f{x,y{{g}h +f{x,y{{g}}h +f{x,y{}g}h +z{a,b{,c}d +z{a,b},c}d +{-01..5} +{-05..100..5} +{-05..100} +{0..5..2} +{0001..05..2} +{0001..-5..2} +{0001..-5..-2} +{0001..5..-2} +{01..5} +{1..05} +{1..05..3} +{05..100} +{0a..0z} +{a,b\\}c,d} +{a,b{c,d} +{a,b}c,d} +{a..F} +{A..f} +{a..Z} +{A..z} +{z..A} +{Z..a} +{a..F..2} +{A..f..02} +{a..Z..5} +d{a..Z..5}b +{A..z..10} +{z..A..-2} +{Z..a..20} +{a{,b} +{a},b} +{x,y{,}g} +{x,y{}g} +{{a,b} +{{a,b},c} +{{a,b}c} +{{a,b},} +X{{a,b},}X +{{a,b},}c +{{a,b}.} +{{a,b}} +X{a..#}X +# this next one is an empty string + +{-10..00} +# Need to escape slashes in here for reasons i guess. +{a,\\\\{a,b}c} +{a,\\{a,b}c} +a,\\{b,c} +{-10.\\.00} +#### bash tests/braces.tests +# Note that some tests are edited out because some features of +# bash are intentionally not supported in this brace expander. +ff{c,b,a} +f{d,e,f}g +{l,n,m}xyz +{abc\\,def} +{abc} +{x\\,y,\\{abc\\},trie} +# not impementing back-ticks obviously +# XXXX\\{`echo a b c | tr ' ' ','`\\} +{} +# We only ever have to worry about parsing a single argument, +# not a command line, so spaces have a different meaning than bash. +# { } +} +{ +abcd{efgh +# spaces +# foo {1,2} bar +# not impementing back-ticks obviously +# `zecho foo {1,2} bar` +# $(zecho foo {1,2} bar) +# ${var} is not a variable here, like it is in bash. omit. +# foo{bar,${var}.} +# foo{bar,${var}} +# isaacs: skip quotes for now +# "${var}"{x,y} +# $var{x,y} +# ${var}{x,y} +# new sequence brace operators +{1..10} +# this doesn't work yet +{0..10,braces} +# but this does +{{0..10},braces} +x{{0..10},braces}y +{3..3} +x{3..3}y +{10..1} +{10..1}y +x{10..1}y +{a..f} +{f..a} +{a..A} +{A..a} +{f..f} +# mixes are incorrectly-formed brace expansions +{1..f} +{f..1} +# spaces +# 0{1..9} {10..20} +# do negative numbers work? +{-1..-10} +{-20..0} +# weirdly-formed brace expansions -- fixed in post-bash-3.1 +a-{b{d,e}}-c +a-{bdef-{g,i}-c +# isaacs: skip quotes for now +# {"klklkl"}{1,2,3} +# isaacs: this is a valid test, though +{klklkl}{1,2,3} +# {"x,x"} +{1..10..2} +{-1..-10..2} +{-1..-10..-2} +{10..1..-2} +{10..1..2} +{1..20..2} +{1..20..20} +{100..0..5} +{100..0..-5} +{a..z} +{a..z..2} +{z..a..-2} +# make sure brace expansion handles ints > 2**31 - 1 using intmax_t +{2147483645..2147483649} +# unwanted zero-padding -- fixed post-bash-4.0 +{10..0..2} +{10..0..-2} +{-50..-0..5} +# bad +{1..10.f} +{1..ff} +{1..10..ff} +{1.20..2} +{1..20..f2} +{1..20..2f} +{1..2f..2} +{1..ff..2} +{1..ff} +{1..f} +{1..0f} +{1..10f} +{1..10.f} +{1..10.f} diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js new file mode 100644 index 00000000..3fcc185a --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var expand = require('..'); + +test('ignores ${', function(t) { + t.deepEqual(expand('${1..3}'), ['${1..3}']); + t.deepEqual(expand('${a,b}${c,d}'), ['${a,b}${c,d}']); + t.deepEqual(expand('x${a,b}x${c,d}x'), ['x${a,b}x${c,d}x']); + t.end(); +}); diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js new file mode 100644 index 00000000..e429121e --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('empty option', function(t) { + t.deepEqual(expand('-v{,,,,}'), [ + '-v', '-v', '-v', '-v', '-v' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh new file mode 100644 index 00000000..e040e664 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +# Bash 4.3 because of arbitrary need to pick a single standard. + +if [ "${BASH_VERSINFO[0]}" != "4" ] || [ "${BASH_VERSINFO[1]}" != "3" ]; then + echo "this script requires bash 4.3" >&2 + exit 1 +fi + +CDPATH= cd "$(dirname "$0")" + +js='require("./")(process.argv[1]).join(" ")' + +cat cases.txt | \ + while read case; do + if [ "${case:0:1}" = "#" ]; then + continue; + fi; + b="$($BASH -c 'for c in '"$case"'; do echo ["$c"]; done')" + echo "$case" + echo -n "$b><><><><"; + done > bash-results.txt diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js new file mode 100644 index 00000000..8d434c23 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var expand = require('..'); + +test('negative increment', function(t) { + t.deepEqual(expand('{3..1}'), ['3', '2', '1']); + t.deepEqual(expand('{10..8}'), ['10', '9', '8']); + t.deepEqual(expand('{10..08}'), ['10', '09', '08']); + t.deepEqual(expand('{c..a}'), ['c', 'b', 'a']); + + t.deepEqual(expand('{4..0..2}'), ['4', '2', '0']); + t.deepEqual(expand('{4..0..-2}'), ['4', '2', '0']); + t.deepEqual(expand('{e..a..2}'), ['e', 'c', 'a']); + + t.end(); +}); diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js new file mode 100644 index 00000000..0862dc51 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js @@ -0,0 +1,16 @@ +var test = require('tape'); +var expand = require('..'); + +test('nested', function(t) { + t.deepEqual(expand('{a,b{1..3},c}'), [ + 'a', 'b1', 'b2', 'b3', 'c' + ]); + t.deepEqual(expand('{{A..Z},{a..z}}'), + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('') + ); + t.deepEqual(expand('ppp{,config,oe{,conf}}'), [ + 'ppp', 'pppconfig', 'pppoe', 'pppoeconf' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js new file mode 100644 index 00000000..c00ad155 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('order', function(t) { + t.deepEqual(expand('a{d,c,b}e'), [ + 'ade', 'ace', 'abe' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js new file mode 100644 index 00000000..e4158775 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var expand = require('..'); + +test('pad', function(t) { + t.deepEqual(expand('{9..11}'), [ + '9', '10', '11' + ]); + t.deepEqual(expand('{09..11}'), [ + '09', '10', '11' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js new file mode 100644 index 00000000..3038fba7 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js @@ -0,0 +1,7 @@ +var test = require('tape'); +var expand = require('..'); + +test('x and y of same type', function(t) { + t.deepEqual(expand('{a..9}'), ['{a..9}']); + t.end(); +}); diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js new file mode 100644 index 00000000..f73a9579 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js @@ -0,0 +1,50 @@ +var test = require('tape'); +var expand = require('..'); + +test('numeric sequences', function(t) { + t.deepEqual(expand('a{1..2}b{2..3}c'), [ + 'a1b2c', 'a1b3c', 'a2b2c', 'a2b3c' + ]); + t.deepEqual(expand('{1..2}{2..3}'), [ + '12', '13', '22', '23' + ]); + t.end(); +}); + +test('numeric sequences with step count', function(t) { + t.deepEqual(expand('{0..8..2}'), [ + '0', '2', '4', '6', '8' + ]); + t.deepEqual(expand('{1..8..2}'), [ + '1', '3', '5', '7' + ]); + t.end(); +}); + +test('numeric sequence with negative x / y', function(t) { + t.deepEqual(expand('{3..-2}'), [ + '3', '2', '1', '0', '-1', '-2' + ]); + t.end(); +}); + +test('alphabetic sequences', function(t) { + t.deepEqual(expand('1{a..b}2{b..c}3'), [ + '1a2b3', '1a2c3', '1b2b3', '1b2c3' + ]); + t.deepEqual(expand('{a..b}{b..c}'), [ + 'ab', 'ac', 'bb', 'bc' + ]); + t.end(); +}); + +test('alphabetic sequences with step count', function(t) { + t.deepEqual(expand('{a..k..2}'), [ + 'a', 'c', 'e', 'g', 'i', 'k' + ]); + t.deepEqual(expand('{b..k..2}'), [ + 'b', 'd', 'f', 'h', 'j' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/glob/node_modules/minimatch/package.json b/node_modules/standard/node_modules/glob/node_modules/minimatch/package.json new file mode 100644 index 00000000..b438bdb9 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/minimatch/package.json @@ -0,0 +1,66 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "2.0.7", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "pretest": "standard minimatch.js test/*.js", + "test": "tap test/*.js", + "prepublish": "browserify -o browser.js -e minimatch.js --bare" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.0.0" + }, + "devDependencies": { + "browserify": "^9.0.3", + "standard": "^3.7.2", + "tap": "" + }, + "license": { + "type": "MIT", + "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" + }, + "files": [ + "minimatch.js", + "browser.js" + ], + "gitHead": "4bd6dc22c248c7ea07cc49d63181fe6f6aafae9c", + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" + }, + "homepage": "https://github.com/isaacs/minimatch", + "_id": "minimatch@2.0.7", + "_shasum": "d23652ab10e663e7d914602e920e21f9f66492be", + "_from": "minimatch@>=2.0.1 <3.0.0", + "_npmVersion": "2.7.6", + "_nodeVersion": "1.7.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d23652ab10e663e7d914602e920e21f9f66492be", + "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/once/LICENSE b/node_modules/standard/node_modules/glob/node_modules/once/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/glob/node_modules/once/README.md b/node_modules/standard/node_modules/glob/node_modules/once/README.md new file mode 100644 index 00000000..a2981ea0 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/README.md @@ -0,0 +1,51 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` diff --git a/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/README.md b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/package.json b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/standard/node_modules/glob/node_modules/once/once.js b/node_modules/standard/node_modules/glob/node_modules/once/once.js new file mode 100644 index 00000000..2e1e721b --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/once.js @@ -0,0 +1,21 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} diff --git a/node_modules/standard/node_modules/glob/node_modules/once/package.json b/node_modules/standard/node_modules/glob/node_modules/once/package.json new file mode 100644 index 00000000..8f46e507 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/package.json @@ -0,0 +1,60 @@ +{ + "name": "once", + "version": "1.3.2", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "~0.3.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once.git" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "gitHead": "e35eed5a7867574e2bf2260a1ba23970958b22f2", + "bugs": { + "url": "https://github.com/isaacs/once/issues" + }, + "homepage": "https://github.com/isaacs/once#readme", + "_id": "once@1.3.2", + "_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "_from": "once@>=1.3.0 <2.0.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "tarball": "http://registry.npmjs.org/once/-/once-1.3.2.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "_resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/once/test/once.js b/node_modules/standard/node_modules/glob/node_modules/once/test/once.js new file mode 100644 index 00000000..c618360d --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/once/test/once.js @@ -0,0 +1,23 @@ +var test = require('tap').test +var once = require('../once.js') + +test('once', function (t) { + var f = 0 + function fn (g) { + t.equal(f, 0) + f ++ + return f + g + this + } + fn.ownProperty = {} + var foo = once(fn) + t.equal(fn.ownProperty, foo.ownProperty) + t.notOk(foo.called) + for (var i = 0; i < 1E3; i++) { + t.same(f, i === 0 ? 0 : 1) + var g = foo.call(1, 1) + t.ok(foo.called) + t.same(g, 3) + t.same(f, 1) + } + t.end() +}) diff --git a/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/index.js b/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/index.js new file mode 100644 index 00000000..19f103f9 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'use strict'; + +function posix(path) { + return path.charAt(0) === '/'; +}; + +function win32(path) { + // https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = !!device && device.charAt(1) !== ':'; + + // UNC paths are always absolute + return !!result[2] || isUnc; +}; + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/license b/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/package.json b/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/package.json new file mode 100644 index 00000000..301658ff --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/package.json @@ -0,0 +1,70 @@ +{ + "name": "path-is-absolute", + "version": "1.0.0", + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/path-is-absolute" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "gitHead": "7a76a0c9f2263192beedbe0a820e4d0baee5b7a1", + "bugs": { + "url": "https://github.com/sindresorhus/path-is-absolute/issues" + }, + "homepage": "https://github.com/sindresorhus/path-is-absolute", + "_id": "path-is-absolute@1.0.0", + "_shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", + "_from": "path-is-absolute@>=1.0.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", + "tarball": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/readme.md b/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/readme.md new file mode 100644 index 00000000..cdf94f43 --- /dev/null +++ b/node_modules/standard/node_modules/glob/node_modules/path-is-absolute/readme.md @@ -0,0 +1,51 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) ponyfill + +> Ponyfill: A polyfill that doesn't overwrite the native method + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +var pathIsAbsolute = require('path-is-absolute'); + +// Linux +pathIsAbsolute('/home/foo'); +//=> true + +// Windows +pathIsAbsolute('C:/Users/'); +//=> true + +// Any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +The Posix specific version. + +### pathIsAbsolute.win32(path) + +The Windows specific version. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/glob/package.json b/node_modules/standard/node_modules/glob/package.json new file mode 100644 index 00000000..bd80eba6 --- /dev/null +++ b/node_modules/standard/node_modules/glob/package.json @@ -0,0 +1,73 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "name": "glob", + "description": "a little globber", + "version": "5.0.5", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "engines": { + "node": "*" + }, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^2.0.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "devDependencies": { + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^0.5.0", + "tick": "0.0.6" + }, + "scripts": { + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "npm run profclean && tap test/*.js", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "bash benchclean.sh" + }, + "license": "ISC", + "gitHead": "9db1a83b44da0c60f5fdd31b28b1f9917ee6316d", + "bugs": { + "url": "https://github.com/isaacs/node-glob/issues" + }, + "homepage": "https://github.com/isaacs/node-glob", + "_id": "glob@5.0.5", + "_shasum": "784431e4e29a900ae0d47fba6aa1c7f16a8e7df7", + "_from": "glob@>=5.0.0 <6.0.0", + "_npmVersion": "2.7.6", + "_nodeVersion": "1.4.2", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "784431e4e29a900ae0d47fba6aa1c7f16a8e7df7", + "tarball": "http://registry.npmjs.org/glob/-/glob-5.0.5.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/glob/-/glob-5.0.5.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/glob/sync.js b/node_modules/standard/node_modules/glob/sync.js new file mode 100644 index 00000000..92fe1101 --- /dev/null +++ b/node_modules/standard/node_modules/glob/sync.js @@ -0,0 +1,457 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = fs.realpathSync(p, this.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this.matches[index][e] = true + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + var abs = this._makeAbs(e) + if (this.mark) + e = this._mark(e) + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[this._makeAbs(e)] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + // lstat failed, doesn't exist + return null + } + + var isSym = lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) throw er + if (!this.silent) console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this.matches[index][prefix] = true +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + return false + } + + if (lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/node_modules/standard/node_modules/minimist/.travis.yml b/node_modules/standard/node_modules/minimist/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/standard/node_modules/minimist/LICENSE b/node_modules/standard/node_modules/minimist/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/minimist/example/parse.js b/node_modules/standard/node_modules/minimist/example/parse.js new file mode 100644 index 00000000..abff3e8e --- /dev/null +++ b/node_modules/standard/node_modules/minimist/example/parse.js @@ -0,0 +1,2 @@ +var argv = require('../')(process.argv.slice(2)); +console.dir(argv); diff --git a/node_modules/standard/node_modules/minimist/index.js b/node_modules/standard/node_modules/minimist/index.js new file mode 100644 index 00000000..185a0455 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/index.js @@ -0,0 +1,219 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {}, unknownFn: null }; + + if (typeof opts['unknown'] === 'function') { + flags.unknownFn = opts['unknown']; + } + + if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { + flags.allBools = true; + } else { + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + flags.strings[aliases[key]] = true; + } + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function argDefined(key, arg) { + return (flags.allBools && /^--[^=]+$/.test(arg)) || + flags.strings[key] || flags.bools[key] || aliases[key]; + } + + function setArg (key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) return; + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + function setKey (obj, keys, value) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + if (o[key] === undefined) o[key] = {}; + o = o[key]; + }); + + var key = keys[keys.length - 1]; + if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + setArg(m[1], m[2], arg); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, next, arg); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next, arg) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2), arg); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, args[i+1], arg); + i++; + } + else if (args[i+1] && /true|false/.test(args[i+1])) { + setArg(key, args[i+1] === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } + else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + if (opts['--']) { + argv['--'] = new Array(); + notFlags.forEach(function(key) { + argv['--'].push(key); + }); + } + else { + notFlags.forEach(function(key) { + argv._.push(key); + }); + } + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +} + diff --git a/node_modules/standard/node_modules/minimist/package.json b/node_modules/standard/node_modules/minimist/package.json new file mode 100644 index 00000000..c6096bdd --- /dev/null +++ b/node_modules/standard/node_modules/minimist/package.json @@ -0,0 +1,71 @@ +{ + "name": "minimist", + "version": "1.1.1", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "covert": "^1.0.0", + "tap": "~0.4.0", + "tape": "^3.5.0" + }, + "scripts": { + "test": "tap test/*.js", + "coverage": "covert test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "gitHead": "bc9d1c466541eb52ae85e6682a4b809f4c32fe1f", + "bugs": { + "url": "https://github.com/substack/minimist/issues" + }, + "_id": "minimist@1.1.1", + "_shasum": "1bc2bc71658cdca5712475684363615b0b4f695b", + "_from": "minimist@>=1.1.0 <2.0.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "dist": { + "shasum": "1bc2bc71658cdca5712475684363615b0b4f695b", + "tarball": "http://registry.npmjs.org/minimist/-/minimist-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/minimist/readme.markdown b/node_modules/standard/node_modules/minimist/readme.markdown new file mode 100644 index 00000000..30a74cf8 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/readme.markdown @@ -0,0 +1,91 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist) + +[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist) + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.dir(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +``` +> require('./')('one two three -- four five --six'.split(' '), { '--': true }) +{ _: [ 'one', 'two', 'three' ], + '--': [ 'four', 'five', '--six' ] } +``` + +Note that with `opts['--']` set, parsing for arguments still stops after the +`--`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/node_modules/standard/node_modules/minimist/test/all_bool.js b/node_modules/standard/node_modules/minimist/test/all_bool.js new file mode 100644 index 00000000..ac835483 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/all_bool.js @@ -0,0 +1,32 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean true (default all --args to boolean)', function (t) { + var argv = parse(['moo', '--honk', 'cow'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); + +test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { + var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + tacos: 'good', + p: 55, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); diff --git a/node_modules/standard/node_modules/minimist/test/bool.js b/node_modules/standard/node_modules/minimist/test/bool.js new file mode 100644 index 00000000..749e083c --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/bool.js @@ -0,0 +1,119 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false } + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { + boolean: ['x','y','z'] + }); + + t.deepEqual(argv, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ] + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + alias: { 'h': 'herp' }, + boolean: 'herp' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); diff --git a/node_modules/standard/node_modules/minimist/test/dash.js b/node_modules/standard/node_modules/minimist/test/dash.js new file mode 100644 index 00000000..5a4fa5be --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/dash.js @@ -0,0 +1,31 @@ +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(5); + t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); + t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); + t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); + t.deepEqual( + parse([ '-b', '-' ], { boolean: 'b' }), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + parse([ '-s', '-' ], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(3); + t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); +}); + +test('move arguments after the -- into their own `--` array', function(t) { + t.plan(1); + t.deepEqual( + parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }), + { name: 'John', _: [ 'before' ], '--': [ 'after' ] }); +}); diff --git a/node_modules/standard/node_modules/minimist/test/default_bool.js b/node_modules/standard/node_modules/minimist/test/default_bool.js new file mode 100644 index 00000000..780a3112 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/default_bool.js @@ -0,0 +1,35 @@ +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true } + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false } + }); + t.equal(argv.somefalse, false); + t.end(); +}); + +test('boolean default to null', function (t) { + var argv = parse([], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, null); + var argv = parse(['--maybe'], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, true); + t.end(); + +}) diff --git a/node_modules/standard/node_modules/minimist/test/dotted.js b/node_modules/standard/node_modules/minimist/test/dotted.js new file mode 100644 index 00000000..d8b3e856 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/dotted.js @@ -0,0 +1,22 @@ +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); + +test('dotted default with no alias', function (t) { + var argv = parse('', {default: {'a.b': 11}}); + t.equal(argv.a.b, 11); + t.end(); +}); diff --git a/node_modules/standard/node_modules/minimist/test/long.js b/node_modules/standard/node_modules/minimist/test/long.js new file mode 100644 index 00000000..5d3a1e09 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/long.js @@ -0,0 +1,31 @@ +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse([ '--bool' ]), + { bool : true, _ : [] }, + 'long boolean' + ); + t.deepEqual( + parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture sp' + ); + t.deepEqual( + parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture eq' + ); + t.deepEqual( + parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures sp' + ); + t.deepEqual( + parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/node_modules/standard/node_modules/minimist/test/num.js b/node_modules/standard/node_modules/minimist/test/num.js new file mode 100644 index 00000000..2cc77f4d --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/num.js @@ -0,0 +1,36 @@ +var parse = require('../'); +var test = require('tape'); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789' + ]); + t.deepEqual(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ] + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('already a number', function (t) { + var argv = parse([ '-x', 1234, 789 ]); + t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); diff --git a/node_modules/standard/node_modules/minimist/test/parse.js b/node_modules/standard/node_modules/minimist/test/parse.js new file mode 100644 index 00000000..7b4a2a17 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/parse.js @@ -0,0 +1,197 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse([ '--no-moo' ]), + { moo : false, _ : [] }, + 'no' + ); + t.deepEqual( + parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ] + } + ); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse([ '-t', 'moo' ], { boolean: 't' }); + t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: [ 't', 'verbose' ], + default: { verbose: true } + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = parse([ '-s', "X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse([ "--s=X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + t.end(); +}); + +test('strings' , function (t) { + var s = parse([ '-s', '0001234' ], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse([ '-x', '56' ], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([ ' ', ' ' ], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function(t) { + var s = parse([ '-s' ], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse([ '--str' ], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse([ '-art' ], { + string: [ 'a', 't' ] + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + + +test('string and alias', function(t) { + var x = parse([ '--str', '000123' ], { + string: 's', + alias: { s: 'str' } + }); + + t.equal(x.str, '000123'); + t.equal(typeof x.str, 'string'); + t.equal(x.s, '000123'); + t.equal(typeof x.s, 'string'); + + var y = parse([ '-s', '000123' ], { + string: 'str', + alias: { str: 's' } + }); + + t.equal(y.str, '000123'); + t.equal(typeof y.str, 'string'); + t.equal(y.s, '000123'); + t.equal(typeof y.s, 'string'); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [] } + ); + t.same( + parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: 'zoom' } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: [ 'zm', 'zoom' ] } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]); + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + } + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/minimist/test/parse_modified.js b/node_modules/standard/node_modules/minimist/test/parse_modified.js new file mode 100644 index 00000000..ab620dc5 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,9 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = parse([ '-b', '123' ], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: [123] }); +}); diff --git a/node_modules/standard/node_modules/minimist/test/short.js b/node_modules/standard/node_modules/minimist/test/short.js new file mode 100644 index 00000000..d513a1c2 --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/short.js @@ -0,0 +1,67 @@ +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); + t.deepEqual( + parse([ '-123', '456' ]), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse([ '-b' ]), + { b : true, _ : [] }, + 'short boolean' + ); + t.deepEqual( + parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ] }, + 'bare' + ); + t.deepEqual( + parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [] }, + 'group' + ); + t.deepEqual( + parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [] }, + 'short group next' + ); + t.deepEqual( + parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [] }, + 'short capture' + ); + t.deepEqual( + parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); diff --git a/node_modules/standard/node_modules/minimist/test/stop_early.js b/node_modules/standard/node_modules/minimist/test/stop_early.js new file mode 100644 index 00000000..bdf9fbcb --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/stop_early.js @@ -0,0 +1,15 @@ +var parse = require('../'); +var test = require('tape'); + +test('stops parsing on the first non-option when stopEarly is set', function (t) { + var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { + stopEarly: true + }); + + t.deepEqual(argv, { + aaa: 'bbb', + _: ['ccc', '--ddd'] + }); + + t.end(); +}); diff --git a/node_modules/standard/node_modules/minimist/test/unknown.js b/node_modules/standard/node_modules/minimist/test/unknown.js new file mode 100644 index 00000000..462a36bd --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/unknown.js @@ -0,0 +1,102 @@ +var parse = require('../'); +var test = require('tape'); + +test('boolean and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'true', '--derp', 'true' ]; + var regular = [ '--herp', 'true', '-d', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('flag boolean true any double hyphen argument is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { + boolean: true, + unknown: unknownFn + }); + t.same(unknown, ['--tacos=good', 'cow', '-p']); + t.same(argv, { + honk: true, + _: [] + }); + t.end(); +}); + +test('string and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello', '--derp', 'goodbye' ]; + var regular = [ '--herp', 'hello', '-d', 'moon' ]; + var opts = { + alias: { h: 'herp' }, + string: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('default and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello' ]; + var regular = [ '--herp', 'hello' ]; + var opts = { + default: { 'h': 'bar' }, + alias: { 'h': 'herp' }, + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, []); + t.end(); + unknownFn(); // exercise fn for 100% coverage +}); + +test('value following -- is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '--bad', '--', 'good', 'arg' ]; + var opts = { + '--': true, + unknown: unknownFn + }; + var argv = parse(aliased, opts); + + t.same(unknown, ['--bad']); + t.same(argv, { + '--': ['good', 'arg'], + '_': [] + }) + t.end(); +}); diff --git a/node_modules/standard/node_modules/minimist/test/whitespace.js b/node_modules/standard/node_modules/minimist/test/whitespace.js new file mode 100644 index 00000000..8a52a58c --- /dev/null +++ b/node_modules/standard/node_modules/minimist/test/whitespace.js @@ -0,0 +1,8 @@ +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/node_modules/standard/node_modules/run-parallel/.travis.yml b/node_modules/standard/node_modules/run-parallel/.travis.yml new file mode 100644 index 00000000..18ae2d89 --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.11" + - "0.10" diff --git a/node_modules/standard/node_modules/run-parallel/LICENSE b/node_modules/standard/node_modules/run-parallel/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/standard/node_modules/run-parallel/README.md b/node_modules/standard/node_modules/run-parallel/README.md new file mode 100644 index 00000000..8b684c68 --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/README.md @@ -0,0 +1,75 @@ +# run-parallel [![travis](https://img.shields.io/travis/feross/run-parallel.svg)](https://travis-ci.org/feross/run-parallel) [![npm](https://img.shields.io/npm/v/run-parallel.svg)](https://npmjs.org/package/run-parallel) [![npm](https://img.shields.io/npm/dm/run-parallel.svg)](https://npmjs.org/package/run-parallel) + +### Run an array of functions in parallel + +![parallel](https://raw.githubusercontent.com/feross/run-parallel/master/img.png) [![browser support](https://ci.testling.com/feross/run-parallel.png)](https://ci.testling.com/feross/run-parallel) + +### install + +``` +npm install run-parallel +``` + +### usage + +#### parallel(tasks, [callback]) + +Run the `tasks` array of functions in parallel, without waiting until the previous +function has completed. If any of the functions pass an error to its callback, the main +`callback` is immediately called with the value of the error. Once the `tasks` have +completed, the results are passed to the final `callback` as an array. + +It is also possible to use an object instead of an array. Each property will be run as a +function and the results will be passed to the final `callback` as an object instead of +an array. This can be a more readable way of handling the results. + +##### arguments + +- `tasks` - An array or object containing functions to run. Each function is passed a +`callback(err, result)` which it must call on completion with an error `err` (which can +be `null`) and an optional `result` value. +- `callback(err, results)` - An optional callback to run once all the functions have +completed. This function gets a results array (or object) containing all the result +arguments passed to the task callbacks. + +##### example + +```js +var parallel = require('run-parallel') + +parallel([ + function (callback) { + setTimeout(function () { + callback(null, 'one') + }, 200) + }, + function (callback) { + setTimeout(function () { + callback(null, 'two') + }, 100) + } +], +// optional callback +function (err, results) { + // the results array will equal ['one','two'] even though + // the second function had a shorter timeout. +}) +``` + +This module is basically equavalent to +[`async.parallel`](https://github.com/caolan/async#paralleltasks-callback), but it's +handy to just have the one function you need instead of the kitchen sink. Modularity! +Especially handy if you're serving to the browser and need to reduce your javascript +bundle size. + +Works great in the browser with [browserify](http://browserify.org/)! + +### see also + +- [run-auto](https://github.com/feross/run-auto) +- [run-series](https://github.com/feross/run-series) +- [run-waterfall](https://github.com/feross/run-waterfall) + +### license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/standard/node_modules/run-parallel/img.png b/node_modules/standard/node_modules/run-parallel/img.png new file mode 100644 index 00000000..a5cdcd0c Binary files /dev/null and b/node_modules/standard/node_modules/run-parallel/img.png differ diff --git a/node_modules/standard/node_modules/run-parallel/index.js b/node_modules/standard/node_modules/run-parallel/index.js new file mode 100644 index 00000000..5ae44d0d --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/index.js @@ -0,0 +1,38 @@ +var dezalgo = require('dezalgo') + +module.exports = function (tasks, cb) { + if (cb) cb = dezalgo(cb) + var results, pending, keys + if (Array.isArray(tasks)) { + results = [] + pending = tasks.length + } else { + keys = Object.keys(tasks) + results = {} + pending = keys.length + } + + function done (i, err, result) { + results[i] = result + if (--pending === 0 || err) { + if (cb) cb(err, results) + cb = null + } + } + + if (!pending) { + // empty + if (cb) cb(null, results) + cb = null + } else if (keys) { + // object + keys.forEach(function (key) { + tasks[key](done.bind(undefined, key)) + }) + } else { + // array + tasks.forEach(function (task, i) { + task(done.bind(undefined, i)) + }) + } +} diff --git a/node_modules/standard/node_modules/run-parallel/package.json b/node_modules/standard/node_modules/run-parallel/package.json new file mode 100644 index 00000000..60c5571c --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/package.json @@ -0,0 +1,79 @@ +{ + "name": "run-parallel", + "description": "Run an array of functions in parallel", + "version": "1.1.1", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/run-parallel/issues" + }, + "dependencies": { + "dezalgo": "^1.0.1" + }, + "devDependencies": { + "standard": "^3.2.0", + "tape": "^4.0.0" + }, + "homepage": "https://github.com/feross/run-parallel", + "keywords": [ + "parallel", + "async", + "function", + "callback", + "asynchronous", + "run", + "array", + "run parallel" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/run-parallel.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/9..latest", + "chrome/25..latest", + "chrome/canary", + "firefox/20..latest", + "firefox/nightly", + "safari/6..latest", + "opera/12..latest", + "opera/next", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "5a58a11b8a33c03ed6a8d865670d0a0fb22e2def", + "_id": "run-parallel@1.1.1", + "_shasum": "043c1f40e5ea94485f6858b79c6ca08254d0720e", + "_from": "run-parallel@>=1.0.0 <2.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "043c1f40e5ea94485f6858b79c6ca08254d0720e", + "tarball": "http://registry.npmjs.org/run-parallel/-/run-parallel-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/run-parallel/test/array.js b/node_modules/standard/node_modules/run-parallel/test/array.js new file mode 100644 index 00000000..07abca26 --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/test/array.js @@ -0,0 +1,71 @@ +var parallel = require('../') +var test = require('tape') + +test('functions run in parallel', function (t) { + t.plan(4) + + var tasks = [ + function (cb) { + t.pass('cb 1') + cb(null) + }, + function (cb) { + t.pass('cb 2') + cb(null) + }, + function (cb) { + t.pass('cb 3') + cb(null) + } + ] + + parallel(tasks, function (err) { + t.error(err) + }) +}) + +test('functions that return results', function (t) { + t.plan(4) + + var tasks = [ + function (cb) { + t.pass('cb 1') + cb(null, 1) + }, + function (cb) { + t.pass('cb 2') + cb(null, 2) + } + ] + + parallel(tasks, function (err, results) { + t.error(err) + t.deepEqual(results, [1, 2]) + }) +}) + +test('functions that return results preserve order', function (t) { + t.plan(4) + + var tasks = [ + function (cb) { + setTimeout(function () { + t.pass('cb 1') + cb(null, 1) + }, 200) + }, + function (cb) { + setTimeout(function () { + t.pass('cb 2') + cb(null, 2) + }, 100) + } + ] + + parallel(tasks, function (err, results) { + t.error(err) + + // 2 should be second, even though it gets returned first + t.deepEqual(results, [1, 2]) + }) +}) diff --git a/node_modules/standard/node_modules/run-parallel/test/empty-tasks.js b/node_modules/standard/node_modules/run-parallel/test/empty-tasks.js new file mode 100644 index 00000000..53a1d4cc --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/test/empty-tasks.js @@ -0,0 +1,30 @@ +var parallel = require('../') +var test = require('tape') + +test('empty tasks array', function (t) { + t.plan(1) + + parallel([], function (err) { + t.error(err) + }) +}) + +test('empty tasks object', function (t) { + t.plan(1) + + parallel({}, function (err) { + t.error(err) + }) +}) + +test('empty tasks array and no callback', function (t) { + parallel([]) + t.pass('did not throw') + t.end() +}) + +test('empty tasks object and no callback', function (t) { + parallel({}) + t.pass('did not throw') + t.end() +}) diff --git a/node_modules/standard/node_modules/run-parallel/test/error.js b/node_modules/standard/node_modules/run-parallel/test/error.js new file mode 100644 index 00000000..8e356bd1 --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/test/error.js @@ -0,0 +1,66 @@ +var parallel = require('../') +var test = require('tape') + +test('functions that return errors (array)', function (t) { + t.plan(3) + + var tasks = [ + function (cb) { + t.pass('cb 1') + cb(new Error('oops')) + }, + function (cb) { + setTimeout(function () { + t.pass('cb 2') + cb(null, 2) + }, 100) + } + ] + + parallel(tasks, function (err) { + t.ok(err instanceof Error) + }) +}) + +test('functions that return errors (object)', function (t) { + t.plan(3) + + var tasks = { + one: function (cb) { + t.pass('cb 1') + cb(new Error('oops')) + }, + two: function (cb) { + setTimeout(function () { + t.pass('cb 2') + cb(null, 2) + }, 100) + } + } + + parallel(tasks, function (err) { + t.ok(err instanceof Error) + }) +}) + +test('functions that return errors (object) w/ partial results', function (t) { + t.plan(4) + + var tasks = { + one: function (cb) { + t.pass('cb 1') + cb(null, 1) + }, + two: function (cb) { + setTimeout(function () { + t.pass('cb 2') + cb(new Error('oops')) + }, 100) + } + } + + parallel(tasks, function (err, results) { + t.ok(err instanceof Error) + t.deepEqual(results, { one: 1, two: undefined }) + }) +}) diff --git a/node_modules/standard/node_modules/run-parallel/test/no-callback.js b/node_modules/standard/node_modules/run-parallel/test/no-callback.js new file mode 100644 index 00000000..38683fbc --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/test/no-callback.js @@ -0,0 +1,32 @@ +var parallel = require('../') +var test = require('tape') + +test('no callback (array)', function (t) { + t.plan(2) + + var tasks = [ + function (cb) { + t.pass('cb 1') + }, + function (cb) { + t.pass('cb 2') + } + ] + + parallel(tasks) +}) + +test('no callback (object)', function (t) { + t.plan(2) + + var tasks = { + one: function (cb) { + t.pass('cb 1') + }, + two: function (cb) { + t.pass('cb 2') + } + } + + parallel(tasks) +}) diff --git a/node_modules/standard/node_modules/run-parallel/test/object.js b/node_modules/standard/node_modules/run-parallel/test/object.js new file mode 100644 index 00000000..5977ac92 --- /dev/null +++ b/node_modules/standard/node_modules/run-parallel/test/object.js @@ -0,0 +1,45 @@ +var parallel = require('../') +var test = require('tape') + +test('functions run in parallel', function (t) { + t.plan(4) + + var tasks = { + one: function (cb) { + t.pass('cb 1') + cb(null) + }, + two: function (cb) { + t.pass('cb 2') + cb(null) + }, + three: function (cb) { + t.pass('cb 3') + cb(null) + } + } + + parallel(tasks, function (err) { + t.error(err) + }) +}) + +test('functions that return results', function (t) { + t.plan(4) + + var tasks = { + one: function (cb) { + t.pass('cb 1') + cb(null, 1) + }, + two: function (cb) { + t.pass('cb 2') + cb(null, 2) + } + } + + parallel(tasks, function (err, results) { + t.error(err) + t.deepEqual(results, { one: 1, two: 2 }) + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/.npmignore b/node_modules/standard/node_modules/standard-format/.npmignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/.npmignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/.travis.yml b/node_modules/standard/node_modules/standard-format/.travis.yml new file mode 100644 index 00000000..13c0c5db --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - '0.12' + - '0.11' + - '0.10' +sudo: false # Enable docker based containers +cache: + directories: # Cache npm install + - node_modules diff --git a/node_modules/standard/node_modules/standard-format/bin.js b/node_modules/standard/node_modules/standard-format/bin.js new file mode 100755 index 00000000..4504ee69 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/bin.js @@ -0,0 +1,85 @@ +#!/usr/bin/env node + +var fmt = require('./') +var fs = require('fs') +var stdin = require('stdin') +var argv = require('minimist')(process.argv.slice(2), { + boolean: ['help', 'stdin', 'version', 'write'], + alias: { + h: 'help', + w: 'write' + } +}) + +// running `standard-format -` is equivalent to `standard-format --stdin` +if (argv._[0] === '-') { + argv.stdin = true + argv._.shift() +} + +if (argv.help) { + console.log(function () { + /* + standard-format - Auto formatter for the easier cases in standard + + Usage: + standard-format [FILES...] + + If FILES is omitted, then all JavaScript source files (*.js) in the current + working directory are checked, recursively. + + These paths are automatically excluded: + node_modules/, .git/, *.min.js, bundle.js + + Flags: + --version Show current version. + -w --write Directly modify input files. + -h, --help Show usage information. + + Readme: https://github.com/maxogden/standard-format + + */ + }.toString().split(/\n/).slice(2, -2).join('\n')) + process.exit(0) +} + +if (argv.version) { + console.log(require('./package.json').version) + process.exit(0) +} + +function processFile (transformed) { + if (argv.write && transformed.name !== 'stdin') { + fs.writeFileSync(transformed.name, transformed.data) + } else { + process.stdout.write(transformed.data) + } +} + +function getFiles (done) { + var args = argv._ + if (argv.stdin) { + return stdin(function (file) { + return done(null, [{ name: 'stdin', data: file }]) + }) + } else if (args.length === 0) { + return fmt.load(done) + } else { + return done(null, args.map(function (file) { + return { name: file, data: fs.readFileSync(file).toString() } + })) + } +} + +getFiles(function (err, files) { + if (err) return error(err) + files.forEach(function (file) { + file.data = fmt.transform(file.data) + processFile(file) + }) +}) + +function error (err) { + console.error(err) + process.exit(1) +} diff --git a/node_modules/standard/node_modules/standard-format/collaborators.md b/node_modules/standard/node_modules/standard-format/collaborators.md new file mode 100644 index 00000000..7cee98b3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/collaborators.md @@ -0,0 +1,10 @@ +## Collaborators + +standard-format is only possible due to the excellent work of the following collaborators: + + + + + + +
maxogdenGitHub/maxogden
jb55GitHub/jb55
ferossGitHub/feross
bcomnesGitHub/bcomnes
FletGitHub/Flet
diff --git a/node_modules/standard/node_modules/standard-format/index.js b/node_modules/standard/node_modules/standard-format/index.js new file mode 100644 index 00000000..a33331ed --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/index.js @@ -0,0 +1,71 @@ +var path = require('path') +var fs = require('fs') +var os = require('os') +var glob = require('glob') +var findRoot = require('find-root') +var Minimatch = require('minimatch').Minimatch +var formatter = require('esformatter') + +var ESFORMATTER_CONFIG = require(path.join(__dirname, 'rc', 'esformatter.json')) +var DEFAULT_IGNORE = [ + 'node_modules/**', + '.git/**', + '**/*.min.js', + '**/bundle.js' +] + +var MULTI_NEWLINE = /((?:\r?\n){3,})/g +var EOL_SEMICOLON = /;\r?\n/g +var SOF_NEWLINES = /^(\r?\n)+/g +var EOL = os.EOL + +module.exports.transform = function (file) { + file = file + .replace(MULTI_NEWLINE, EOL + EOL) + + var formatted = formatter.format(file, ESFORMATTER_CONFIG) + .replace(EOL_SEMICOLON, EOL) + .replace(SOF_NEWLINES, '') + + return formatted +} + +module.exports.load = function (opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} + } + if (!opts) opts = {} + + var root + try { + root = findRoot(process.cwd()) + } catch (e) {} + + var ignore = [].concat(DEFAULT_IGNORE) // globs to ignore + + if (root) { + var packageOpts = require(path.join(root, 'package.json')).standard + if (packageOpts) ignore = ignore.concat(packageOpts.ignore) + } + + if (opts.ignore) ignore = ignore.concat(opts.ignore) + + ignore = ignore.map(function (pattern) { + return new Minimatch(pattern) + }) + + glob('**/*.js', { + cwd: opts.cwd || process.cwd() + }, function (err, files) { + if (err) return cb(err) + files = files.filter(function (file) { + return !ignore.some(function (mm) { + return mm.match(file) + }) + }).map(function (f) { + return { name: f, data: fs.readFileSync(f).toString() } // assume utf8 + }) + cb(null, files) + }) +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/.bin/esformatter b/node_modules/standard/node_modules/standard-format/node_modules/.bin/esformatter new file mode 120000 index 00000000..71bcf016 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/.bin/esformatter @@ -0,0 +1 @@ +../esformatter/bin/esformatter \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/.npmignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/.travis.yml new file mode 100644 index 00000000..05d299e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.10" + - "0.11" diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/README.md new file mode 100644 index 00000000..394fb2ce --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/README.md @@ -0,0 +1,4 @@ +# esformatter-eol-last [![Build Status](https://secure.travis-ci.org/briandipalma/esformatter-eol-last.png)](http://travis-ci.org/briandipalma/esformatter-eol-last) [![Dependency Status](https://david-dm.org/briandipalma/esformatter-eol-last.png?theme=shields.io)](https://david-dm.org/briandipalma/esformatter-eol-last) + +Adds a newline to the end of esformatter output. +Will not add newline is the output ends in a newline already. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/index.js new file mode 100644 index 00000000..c15c4ea2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/index.js @@ -0,0 +1,11 @@ +'use strict'; + +require('string.prototype.endswith'); + +exports.stringAfter = function(formattedString) { + if (formattedString.endsWith('\n')) { + return formattedString; + } + + return formattedString + '\n'; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/LICENSE-MIT.txt b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/LICENSE-MIT.txt new file mode 100644 index 00000000..97067e54 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/README.md new file mode 100644 index 00000000..b118ff15 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/README.md @@ -0,0 +1,46 @@ +# ES6 `String.prototype.endsWith` polyfill [![Build status](https://travis-ci.org/mathiasbynens/String.prototype.endsWith.svg?branch=master)](https://travis-ci.org/mathiasbynens/String.prototype.endsWith) + +A robust & optimized ES3-compatible polyfill for [the `String.prototype.endsWith` method in ECMAScript 6](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.endswith). + +Other polyfills for `String.prototype.endsWith` are available: + +* by [Paul Miller](http://paulmillr.com/) (~~fails some tests: [1](https://github.com/paulmillr/es6-shim/issues/168), [2](https://github.com/paulmillr/es6-shim/issues/175)~~ passes all tests) +* by Google (~~[fails a lot of tests](https://github.com/google/traceur-compiler/pull/555)~~ now uses this polyfill and passes all tests) + +## Installation + +In a browser: + +```html + +``` + +Via [npm](http://npmjs.org/): + +```bash +npm install string.prototype.endswith +``` + +Then, in [Node.js](http://nodejs.org/): + +```js +require('string.prototype.endswith'); + +// On Windows and on Mac systems with default settings, case doesn’t matter, +// which allows you to do this instead: +require('String.prototype.endsWith'); +``` + +## Notes + +Polyfills + test suites for [`String.prototype.startsWith`](http://mths.be/startswith) and [`String.prototype.contains`](http://mths.be/contains) are available, too. + +## Author + +| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](http://mathiasbynens.be/) | + +## License + +This polyfill is available under the [MIT](http://mths.be/mit) license. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/endswith.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/endswith.js new file mode 100644 index 00000000..84ca5969 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/endswith.js @@ -0,0 +1,60 @@ +/*! http://mths.be/endswith v0.2.0 by @mathias */ +if (!String.prototype.endsWith) { + (function() { + 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` + var defineProperty = (function() { + // IE 8 only supports `Object.defineProperty` on DOM elements + try { + var object = {}; + var $defineProperty = Object.defineProperty; + var result = $defineProperty(object, object, object) && $defineProperty; + } catch(error) {} + return result; + }()); + var toString = {}.toString; + var endsWith = function(search) { + if (this == null) { + throw TypeError(); + } + var string = String(this); + if (search && toString.call(search) == '[object RegExp]') { + throw TypeError(); + } + var stringLength = string.length; + var searchString = String(search); + var searchLength = searchString.length; + var pos = stringLength; + if (arguments.length > 1) { + var position = arguments[1]; + if (position !== undefined) { + // `ToInteger` + pos = position ? Number(position) : 0; + if (pos != pos) { // better `isNaN` + pos = 0; + } + } + } + var end = Math.min(Math.max(pos, 0), stringLength); + var start = end - searchLength; + if (start < 0) { + return false; + } + var index = -1; + while (++index < searchLength) { + if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) { + return false; + } + } + return true; + }; + if (defineProperty) { + defineProperty(String.prototype, 'endsWith', { + 'value': endsWith, + 'configurable': true, + 'writable': true + }); + } else { + String.prototype.endsWith = endsWith; + } + }()); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/package.json new file mode 100644 index 00000000..006f3a69 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/node_modules/string.prototype.endswith/package.json @@ -0,0 +1,62 @@ +{ + "name": "string.prototype.endswith", + "version": "0.2.0", + "description": "A robust & optimized `String.prototype.endsWith` polyfill, based on the ECMAScript 6 specification.", + "homepage": "http://mths.be/endswith", + "main": "endswith.js", + "keywords": [ + "string", + "endswith", + "es6", + "ecmascript", + "polyfill" + ], + "licenses": [ + { + "type": "MIT", + "url": "http://mths.be/mit" + } + ], + "author": { + "name": "Mathias Bynens", + "url": "http://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/String.prototype.endsWith.git" + }, + "bugs": { + "url": "https://github.com/mathiasbynens/String.prototype.endsWith/issues" + }, + "files": [ + "LICENSE-MIT.txt", + "endswith.js" + ], + "directories": { + "test": "tests" + }, + "scripts": { + "test": "node tests/tests.js", + "cover": "istanbul cover --report html --verbose --dir coverage tests/tests.js" + }, + "_id": "string.prototype.endswith@0.2.0", + "dist": { + "shasum": "a19c20dee51a98777e9a47e10f09be393b9bba75", + "tarball": "http://registry.npmjs.org/string.prototype.endswith/-/string.prototype.endswith-0.2.0.tgz" + }, + "_from": "string.prototype.endswith@>=0.2.0 <0.3.0", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "mathias", + "email": "mathias@qiwi.be" + }, + "maintainers": [ + { + "name": "mathias", + "email": "mathias@qiwi.be" + } + ], + "_shasum": "a19c20dee51a98777e9a47e10f09be393b9bba75", + "_resolved": "https://registry.npmjs.org/string.prototype.endswith/-/string.prototype.endswith-0.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/package.json new file mode 100644 index 00000000..082d3e7c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/package.json @@ -0,0 +1,48 @@ +{ + "name": "esformatter-eol-last", + "version": "1.0.0", + "description": "Adds a newline to the end of esformatter output. Will not add newline is the output ends in a newline already.", + "main": "index.js", + "scripts": { + "test": "mocha" + }, + "repository": { + "type": "git", + "url": "https://github.com/briandipalma/esformatter-eol-last.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/briandipalma/esformatter-eol-last/issues" + }, + "homepage": "https://github.com/briandipalma/esformatter-eol-last", + "devDependencies": { + "mocha": "^2.0.1" + }, + "dependencies": { + "string.prototype.endswith": "^0.2.0" + }, + "gitHead": "e7ad010b07606ab510b38c3f7f13bfcad5edabfb", + "_id": "esformatter-eol-last@1.0.0", + "_shasum": "45a78ff4622b1d49e44f56b49905766a63290c07", + "_from": "esformatter-eol-last@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.4", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "briandipalma", + "email": "offler@gmail.com" + }, + "maintainers": [ + { + "name": "briandipalma", + "email": "offler@gmail.com" + } + ], + "dist": { + "shasum": "45a78ff4622b1d49e44f56b49905766a63290c07", + "tarball": "http://registry.npmjs.org/esformatter-eol-last/-/esformatter-eol-last-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/esformatter-eol-last/-/esformatter-eol-last-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/test/test.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/test/test.js new file mode 100644 index 00000000..b74e06a9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-eol-last/test/test.js @@ -0,0 +1,27 @@ +var assert = require('assert'); +var eolFormatter = require('../'); + +describe('EOL-last formatter', function() { + it('adds newline at end of input', function() { + //Given. + var input = 'Hi!'; + var expectedOutput = 'Hi!\n'; + + //When + var formatterOutput = eolFormatter.stringAfter(input); + + //Then + assert(formatterOutput, expectedOutput); + }); + + it('does not add newline at end of input with a newline', function() { + //Given. + var input = 'Hi!\n'; + + //When + var formatterOutput = eolFormatter.stringAfter(input); + + //Then + assert(formatterOutput, input); + }); +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/.npmignore new file mode 100644 index 00000000..67dd5378 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/.npmignore @@ -0,0 +1,3 @@ +node_modules +test +.editorconfig diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/.travis.yml new file mode 100644 index 00000000..b1504b98 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: +- "0.10" +- "0.11" diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/LICENSE new file mode 100644 index 00000000..392be517 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/LICENSE @@ -0,0 +1,20 @@ +This software is released under the MIT license: + +Copyright (c) 2014 Antoine Lehurt + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/README.md new file mode 100644 index 00000000..5991f0c0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/README.md @@ -0,0 +1,37 @@ +# esformatter-literal-notation [![Build Status](https://travis-ci.org/kewah/esformatter-literal-notation.svg?branch=master)](https://travis-ci.org/kewah/esformatter-literal-notation) + +[esformatter](https://github.com/millermedeiros/esformatter) plugin that converts array and object constructors to literal notations + +```js +var foo = new Array(); +// converted to: +var foo = []; + +var bar = new Object(); +// converted to: +var bar = {}; +``` + +## Install + +With [npm](http://npmjs.org) do: + +```bash +$ npm install esformatter-literal-notation +``` + +## Usage + +esformatter config file: + +```json +{ + "plugins": [ + "esformatter-literal-notation" + ] +} +``` + +## License + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/index.js new file mode 100644 index 00000000..901358b6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/index.js @@ -0,0 +1,85 @@ +'use strict'; + +var tk = require('rocambole-token'); +var rocambole = require('rocambole'); + + +exports.transformBefore = transformBefore; +function transformBefore(ast) { + rocambole.moonwalk(ast, literalNotation); +} + + +function literalNotation(node) { + if (node.type !== 'NewExpression') { + return; + } + + var hasArgs = node.arguments.length > 0; + + if (node.callee.name === 'Object') { + convertObject(node, hasArgs); + return; + } + + if (node.callee.name === 'Array') { + if (hasArgs) { + return; + } + + convertArray(node); + return; + } +} + + +function convertObject(node, keepBraces) { + var endToken = node.endToken; + var token = node.startToken; + + while (token !== endToken) { + if (keepBraces && token.value === '{') { + break; + } + + tk.remove(token); + token = token.next; + } + + if (!keepBraces) { + node.startToken = tk.before(endToken, { + type: 'Punctuator', + value: '{' + }); + + node.endToken = tk.after(endToken, { + type: 'Punctuator', + value: '}' + }); + } + + tk.remove(endToken); +} + + +function convertArray(node) { + var endToken = node.endToken; + var token = node.startToken; + + while (token !== endToken) { + tk.remove(token); + token = token.next; + } + + node.startToken = tk.before(endToken, { + type: 'Punctuator', + value: '[' + }); + + node.endToken = tk.after(endToken, { + type: 'Punctuator', + value: ']' + }); + + tk.remove(endToken); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/.npmignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/README.md new file mode 100644 index 00000000..c2c03c23 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/README.md @@ -0,0 +1,37 @@ +# rocambole-token + +Helpers to manipulate [rocambole](https://github.com/millermedeiros/rocambole) +AST tokens. + + +## Why? + +Created mainly to be used by +[esindent](https://github.com/millermedeiros/esindent/) and +[esformatter](https://github.com/millermedeiros/esformatter/). + + +## Important Notes + +Right now all methods ignores the `loc` and `range` info of the tokens, this is +*by design* since updating the range and loc info on a large JS program +multiple times can be very expensive. It's *better* to write a separate tool to +*sanitize* this info and that can be executed as a separate step. + +Also important to note that right now rocambole doesn't add any reference on +the token itself to the nodes that contain that token, so if you remove a token +that happens to be the `startToken` or `endToken` of any node you might have +some conflict if you start manipulating the tokens based on the `nodes`, +instead of the `token` LinkedList. - the `node.startToken` might be *detached* +from the LinkedList. + +Test coverage is pretty low so far, but since it was mostly extracted from +esformatter the methods should work as expected. I started to write some tests +just to show how I would do it but did not had the time to finish it... +(ideally tests should be written before the implementation). + + +## License + +Released under the MIT License. + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/find.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/find.js new file mode 100644 index 00000000..956dc061 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/find.js @@ -0,0 +1,76 @@ +"use strict"; + +var makeCheck = require('./makeCheck'); +var isNotEmpty = require('./is').isNotEmpty; + + +// --- + + +exports.findInBetween = findInBetween; +function findInBetween(startToken, endToken, check) { + check = makeCheck(check); + var found; + var last = endToken && endToken.next; + while (startToken && startToken !== last && !found) { + if (check(startToken)) { + found = startToken; + } + startToken = startToken.next; + } + return found; +} + + +exports.findInBetweenFromEnd = findInBetweenFromEnd; +function findInBetweenFromEnd(startToken, endToken, check) { + check = makeCheck(check); + var found; + var last = startToken && startToken.prev; + while (endToken && endToken !== last && !found) { + if (check(endToken)) { + found = endToken; + } + endToken = endToken.prev; + } + return found; +} + + +exports.findNext = findNext; +function findNext(startToken, check) { + check = makeCheck(check); + startToken = startToken && startToken.next; + while (startToken) { + if (check(startToken)) { + return startToken; + } + startToken = startToken.next; + } +} + + +exports.findPrev = findPrev; +function findPrev(endToken, check) { + check = makeCheck(check); + endToken = endToken && endToken.prev; + while (endToken) { + if (check(endToken)) { + return endToken; + } + endToken = endToken.prev; + } +} + + +exports.findNextNonEmpty = findNextNonEmpty; +function findNextNonEmpty(startToken) { + return findNext(startToken, isNotEmpty); +} + + +exports.findPrevNonEmpty = findPrevNonEmpty; +function findPrevNonEmpty(endToken) { + return findPrev(endToken, isNotEmpty); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/index.js new file mode 100644 index 00000000..92413441 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/index.js @@ -0,0 +1,34 @@ +"use strict"; + +// --- + +function mixIn(target, source){ + Object.keys(source).forEach(function(key){ + target[key] = source[key]; + }); + return target; +} + + +// --- + + +exports.eachInBetween = eachInBetween; +function eachInBetween(startToken, endToken, iterator) { + var last = endToken && endToken.next; + while (startToken && startToken !== last) { + iterator(startToken); + startToken = startToken.next; + } +} + + +// --- + +// XXX: ugly but works for now, that way we avoid changing the whole +// esformatter structure. +mixIn(exports, require('./find')); +mixIn(exports, require('./insert')); +mixIn(exports, require('./is')); +mixIn(exports, require('./remove')); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/insert.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/insert.js new file mode 100644 index 00000000..7768007c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/insert.js @@ -0,0 +1,31 @@ +"use strict"; + +exports.before = before; +function before(target, newToken) { + newToken.prev = target.prev; + newToken.next = target; + if (target.prev) { + target.prev.next = newToken; + } else if (target.root) { + target.root.startToken = newToken; + } + target.prev = newToken; + newToken.root = target.root; + return newToken; +} + + +exports.after = after; +function after(target, newToken) { + if (target.next) { + target.next.prev = newToken; + } else if (target.root) { + target.root.endToken = newToken; + } + newToken.prev = target; + newToken.next = target.next; + target.next = newToken; + newToken.root = target.root; + return newToken; +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/is.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/is.js new file mode 100644 index 00000000..68335e57 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/is.js @@ -0,0 +1,63 @@ +"use strict"; + + +// --- + + +exports.isWs = isWs; +function isWs(token) { + return token && token.type === 'WhiteSpace'; +} + + +exports.isBr = isBr; +function isBr(token) { + return token && token.type === 'LineBreak'; +} + + +exports.isEmpty = isEmpty; +function isEmpty(token) { + return token && + (token.type === 'WhiteSpace' || + token.type === 'LineBreak' || + token.type === 'Indent'); +} + + +exports.isNotEmpty = isNotEmpty; +function isNotEmpty(token) { + return !isEmpty(token); +} + + +//XXX: isCode is a bad name, find something better to describe it +exports.isCode = isCode; +function isCode(token) { + return !isEmpty(token) && !isComment(token); +} + + +exports.isSemiColon = isSemiColon; +function isSemiColon(token) { + return token && (token.type === 'Punctuator' && token.value === ';'); +} + + +exports.isComma = isComma; +function isComma(token) { + return token && (token.type === 'Punctuator' && token.value === ','); +} + + +exports.isIndent = isIndent; +function isIndent(token) { + return token && token.type === 'Indent'; +} + + +exports.isComment = isComment; +function isComment(token) { + return token && (token.type === 'LineComment' || token.type === 'BlockComment'); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/makeCheck.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/makeCheck.js new file mode 100644 index 00000000..5f928611 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/makeCheck.js @@ -0,0 +1,28 @@ +"use strict"; + +module.exports = makeCheck; + +function makeCheck(orig) { + if (typeof orig === 'string') { + return makeStringCheck(orig); + } + else if (Array.isArray(orig)) { + return makeArrayCheck(orig); + } + // already a function or invalid value + return orig; +} + + +function makeArrayCheck(arr) { + return function checkTypeAndValueByIndex(token) { + return token && (arr.indexOf(token.type) !== -1 || arr.indexOf(token.value) !== -1); + }; +} + + +function makeStringCheck(str) { + return function checkTypeAndValueByString(token) { + return token && (token.type === str || token.value === str); + }; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/package.json new file mode 100644 index 00000000..9e468ae8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/package.json @@ -0,0 +1,57 @@ +{ + "name": "rocambole-token", + "version": "1.2.1", + "description": "Helpers for rocambole AST token manipulation", + "main": "./index.js", + "scripts": { + "test": "jasmine-node test/" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/rocambole-token.git" + }, + "keywords": [ + "ast", + "token", + "rocambole" + ], + "author": { + "name": "Miller Medeiros", + "email": "contact@millermedeiros.com", + "url": "http://blog.millermedeiros.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/millermedeiros/rocambole-token/issues" + }, + "homepage": "https://github.com/millermedeiros/rocambole-token", + "devDependencies": { + "rocambole": "~0.2.3", + "jasmine-node": "~1.11.0" + }, + "jshintConfig": { + "node": true + }, + "gitHead": "fc03674b38f288dc545db0a5b2bdfd2d96cab170", + "_id": "rocambole-token@1.2.1", + "_shasum": "c785df7428dc3cb27ad7897047bd5238cc070d35", + "_from": "rocambole-token@>=1.2.1 <2.0.0", + "_npmVersion": "1.4.17", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + } + ], + "dist": { + "shasum": "c785df7428dc3cb27ad7897047bd5238cc070d35", + "tarball": "http://registry.npmjs.org/rocambole-token/-/rocambole-token-1.2.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/rocambole-token/-/rocambole-token-1.2.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/remove.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/remove.js new file mode 100644 index 00000000..bc32add9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/remove.js @@ -0,0 +1,84 @@ +"use strict"; + +var makeCheck = require('./makeCheck'); +var isEmpty = require('./is').isEmpty; + + +// --- + + +exports.remove = remove; +function remove(target) { + if (target.next) { + target.next.prev = target.prev; + } else if (target.root) { + target.root.endToken = target.prev; + } + + if (target.prev) { + target.prev.next = target.next; + } else if (target.root) { + target.root.startToken = target.next; + } +} + + +exports.removeInBetween = removeInBetween; +function removeInBetween(startToken, endToken, check) { + check = makeCheck(check); + var last = endToken && endToken.next; + while (startToken && startToken !== last) { + if (check(startToken)) { + remove(startToken); + } + startToken = startToken.next; + } +} + + +exports.removeAdjacent = removeAdjacent; +function removeAdjacent(token, check) { + removeAdjacentBefore(token, check); + removeAdjacentAfter(token, check); +} + + +exports.removeAdjacentBefore = removeAdjacentBefore; +function removeAdjacentBefore(token, check) { + check = makeCheck(check); + var prev = token.prev; + while (prev && check(prev)) { + remove(prev); + prev = prev.prev; + } +} + + +exports.removeAdjacentAfter = removeAdjacentAfter; +function removeAdjacentAfter(token, check) { + check = makeCheck(check); + var next = token.next; + while (next && check(next)) { + remove(next); + next = next.next; + } +} + + +exports.removeEmptyAdjacentBefore = removeEmptyAdjacentBefore; +function removeEmptyAdjacentBefore(startToken) { + removeAdjacentBefore(startToken, isEmpty); +} + + +exports.removeEmptyAdjacentAfter = removeEmptyAdjacentAfter; +function removeEmptyAdjacentAfter(startToken) { + removeAdjacentAfter(startToken, isEmpty); +} + + +exports.removeEmptyInBetween = removeEmptyInBetween; +function removeEmptyInBetween(startToken, endToken) { + removeInBetween(startToken, endToken, isEmpty); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/test/find-spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/test/find-spec.js new file mode 100644 index 00000000..b63ffe42 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole-token/test/find-spec.js @@ -0,0 +1,76 @@ +/* jshint strict:true */ +/* global describe, it, expect, beforeEach */ +"use strict"; + +// --- + + +var rocambole = require('rocambole'); + +var _find = require('../find'); +var findInBetween = _find.findInBetween; +var findInBetweenFromEnd = _find.findInBetweenFromEnd; + + +// --- + + +describe('find', function () { + + + describe('findInBetween', function () { + + var ast = rocambole.parse('var foo = "bar";\nfunction fn(a, b){\nreturn b? a + b : a * 2;\n}'); + + it('should return first token inside range by value', function () { + var tk = findInBetween(ast.startToken, ast.endToken, 'a'); + expect( tk.type ).toBe( 'Identifier' ); + expect( tk.value ).toBe( 'a' ); + expect( tk.prev.value ).toBe( '(' ); + }); + + it('should return first token inside range by Type', function () { + var tk = findInBetween(ast.startToken, ast.endToken, 'Punctuator'); + expect( tk.value ).toBe( '=' ); + }); + + it('should return first token that passes truth test', function () { + var tk = findInBetween(ast.startToken, ast.endToken, function(val){ + return val.type === 'Punctuator' && val.prev.prev.value !== 'foo'; + }); + expect( tk.value ).toBe(';'); + }); + + it('shold return first token that matches any array items values', function () { + var tk = findInBetween(ast.startToken, ast.endToken, ['?', 'return']); + expect( tk.type ).toBe( 'Keyword' ); + }); + + it('shold return first token that matches any array items types', function () { + var tk = findInBetween(ast.startToken, ast.endToken, ['Keyword', 'Identifier']); + expect( tk.value ).toBe( 'var' ); + }); + + }); + + + describe('findInBetweenFromEnd', function () { + + var ast = rocambole.parse('var foo = "bar";\nfunction fn(a, b){\nreturn b? a + b : a * 2;\n}'); + + it('should return first match from end by "type"', function () { + var tk = findInBetweenFromEnd(ast.startToken, ast.endToken, 'Keyword'); + expect( tk.value ).toBe( 'return' ); + }); + + it('should return first match from end by "value"', function () { + var tk = findInBetweenFromEnd(ast.startToken, ast.endToken, 'a'); + expect( tk.prev.prev.value ).toBe( ':' ); + }); + + + }); + + +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/.jshintrc b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/.jshintrc new file mode 100644 index 00000000..ea218f5e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/.jshintrc @@ -0,0 +1,61 @@ +{ + // Settings + "passfail" : false, // Stop on first error. + "maxerr" : 500, // Maximum error before stopping. + + + // Predefined globals whom JSHint will ignore. + "browser" : false, // Standard browser globals e.g. `window`, `document`. + "node" : true, + + + // Custom globals. + "predef" : [], + + + // Development. + "debug" : false, // Allow debugger statements e.g. browser breakpoints. + "devel" : false, // Allow developments statements e.g. `console.log();`. + + + // EcmaScript 5. + "es5" : false, // Allow EcmaScript 5 syntax. + "globalstrict" : true, // Allow global "use strict" (also enables 'strict'). + "strict" : true, // Require `use strict` pragma in every file. + + + // The Good Parts. + "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons). + "bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.). + "boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. + "curly" : false, // Require {} for every new block or scope. + "eqeqeq" : false, // Require triple equals i.e. `===`. + "eqnull" : true, // Tolerate use of `== null`. + "evil" : false, // Tolerate use of `eval`. + "expr" : false, // Tolerate `ExpressionStatement` as Programs. + "forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`. + "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` + "latedef" : false, // Prohibit variable use before definition. + "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. + "loopfunc" : false, // Allow functions to be defined within loops. + "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. + "regexdash" : true, // Tolerate unescaped last dash i.e. `[-...]`. + "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions. + "scripturl" : false, // Tolerate script-targeted URLs. + "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. + "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. + "undef" : true, // Require all non-global variables be declared before they are used. + "unused" : true, // Check for unused vars + + + // Personal styling prefrences. + "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. + "noempty" : true, // Prohipit use of empty blocks. + "nomen" : false, // Prohibit use of initial or trailing underbars in names. + "nonew" : true, // Prohibit use of constructors for side-effects. + "onevar" : false, // Allow only one `var` statement per function. + "plusplus" : false, // Prohibit use of `++` & `--`. + "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. + "trailing" : true, // Prohibit trailing whitespaces. + "white" : false // Check against strict whitespace and indentation rules. +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/.npmignore new file mode 100644 index 00000000..8002c5f2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/.npmignore @@ -0,0 +1,15 @@ +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +Icon? +ehthumbs.db +Thumbs.db + +### + +node_modules/ +npm-debug.log +coverage/ + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/.travis.yml new file mode 100644 index 00000000..836418eb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/.travis.yml @@ -0,0 +1,5 @@ + language: node_js + node_js: 0.10 + script: + - "npm test --coverage" + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/README.md new file mode 100644 index 00000000..edb28130 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/README.md @@ -0,0 +1,293 @@ +# Rocambole [![Build Status](https://secure.travis-ci.org/millermedeiros/rocambole.png?branch=master)](https://travis-ci.org/millermedeiros/rocambole) + +![rocambole](https://raw.github.com/millermedeiros/rocambole/master/rocambole.jpg) + +Recursively walk and add extra information/helpers to [Esprima / Mozilla +SpiderMonkey Parser API](http://esprima.org/doc/index.html#ast) compatible AST. + +The main difference between other tools is that it also keeps information about +tokens and white spaces and it is meant to be used to transform the tokens and +not the string values itself. + +This library is specially useful for non-destructive AST manipulation. + + +## Inspiration + +This module was heavily inspired by +[node-falafel](https://github.com/substack/node-falafel) and +[node-burrito](https://github.com/substack/node-burrito) but I needed more +information than what is currently available on falafel (specially about +tokens, empty lines and white spaces) and also needed to do the node traversing +on the opposite order (start from leaf nodes). The amount of changes required +to introduce the new features and the differences on the concept behind the +tool justified a new project. + +It was created mainly to be used on +[esformatter](https://github.com/millermedeiros/esformatter/). + + + +## Extra Tokens + +Besides all the regular tokens returned by `esprima` we also add a few more +that are important for non-destructive transformations: + + * `WhiteSpace` + - Can store multiple white spaces (tabs are considered white space, line + breaks not). Important if you want to do non-destructive replacements that + are white-space sensitive. + - Multiple subsequent white spaces are treated as a single token. + * `LineBreak` + * `LineComment` + * `BlockComment` + +It's way easier to rebuild the JS string if the tokens already have line breaks +and comments. It's also easier to identify if previous/next/current token is a +LineBreak or Comment (sometimes needed for non-destructive transformations). + +Rocambole structure might change in the future to keep the extraneous tokens +outside the `tokens` array and also add an option to toggle the behavior. +([issue #7](https://github.com/millermedeiros/rocambole/issues/7)) + + +## Extra Properties + +Each Node have the following extra properties/methods: + + - `parent` : Node|undefined + - `toString()` : string + - `next` : Node|undefined + - `prev` : Node|undefined + - `depth` : Number + - `startToken` : Token + - `endToken` : Token + +Each token also have: + + - `prev` : Token|undefined + - `next` : Token|undefined + +BlockComment also have: + + - `originalIndent`: String|undefined + +To get a better idea of the generated AST structure try out +[rocambole-visualize](http://piuccio.github.io/rocambole-visualize/). + + +## Linked List + +You should **treat the tokens as a linked list instead of reading the +`ast.tokens` array** (inserting/removing items from a linked list is very cheap +and won't break the loop). You should grab a reference to the `node.startToken` +and get `token.next` until you find the desired token or reach the end of the +program. To loop between all tokens inside a node you can do like this: + +```js +var token = node.startToken; +while (token !== node.endToken.next) { + doStuffWithToken(token); + token = token.next; +} +``` + +The method `toString` loops through all tokens between `node.startToken` and +`node.endToken` grabbing the `token.raw` (used by comments) or `token.value` +properties. To implement a method similar to falafel `update()` you can do +this: + +```js +function update(node, str){ + var newToken = { + type : 'Custom', // can be anything (not used internally) + value : str + }; + // update linked list references + if ( node.startToken.prev ) { + node.startToken.prev.next = newToken; + newToken.prev = node.startToken.prev; + } + if ( node.endToken.next ) { + node.endToken.next.prev = newToken; + newToken.next = node.endToken.next; + } + node.startToken = node.endToken = newToken; +} +``` + + +## Helpers + +I plan to create helpers as separate projects. For now I'm adding the helpers +on the [esformatter util +package](https://github.com/millermedeiros/esformatter/tree/master/lib/util) +but I plan to extract the generic ones. + + - [rocambole-token](https://github.com/millermedeiros/rocambole-token): helpers for token manipulation + + + +## API + + +### rocambole.parse + +Parses a string and instrument the AST with extra properties/methods. + +```js +var rocambole = require('rocambole'); +var ast = rocambole.parse(string); +console.log( ast.startToken ); +// to get a string representation of all tokens call toString() +console.log( ast.toString() ); +``` + + +### rocambole.moonwalk + +The `moonwalk()` starts at the leaf nodes and go down the tree until it reaches +the root node (`Program`). Each node will be traversed only once. + +```js +rocambole.moonwalk(ast, function(node){ + if (node.type == 'ArrayExpression'){ + console.log( node.depth +': '+ node.toString() ); + } +}); +``` + +Traverse order: + +``` + Program [#18] + `-FunctionDeclaration [#16] + |-BlockStatement [#14] + | |-IfStatement [#12] + | | |-BynaryExpression [#9] + | | | |-Identifier [#4] + | | | `-Literal [#5] + | | `-BlockStatement [#10] + | | `-ExpressionStatement [#6] + | | `-AssignmentExpression [#3] + | | |-Identifier [#1 walk starts here] + | | `-Literal [#2] + | `-VariableDeclaration [#13] + | `-VariableDeclarator [#11] + | |-Identifier [#7] + | `-Literal [#8] + `-ReturnStatement [#17] + `-Identifier [#15] +``` + +This behavior is very different from node-falafel and node-burrito. + + +### rocambole.recursive + +It loops through all nodes on the AST starting from the root node (`Program`), +similar to `node-falafel`. + +```js +rocambole.recursive(ast, function(node){ + console.log(node.type); +}); +``` + + +## Popular Alternatives + + - [burrito](https://github.com/substack/node-burrito) + - [falafel](https://github.com/substack/node-falafel) + + + +## Unit Tests + +Besides the regular unit tests we also use +[istanbul](https://github.com/yahoo/istanbul) to generate code coverage +reports, tests should have at least 95% code coverage for statements, branches +and lines and 100% code coverage for functions or travis build will fail. + +We do not run the coverage test at each call since it slows down the +performnace of the tests and it also makes it harder to see the test results. +To execute tests and generate coverage report call `npm test --coverage`, for +regular tests just do `npm test`. + +Coverage reports are not committed to the repository since they will change at +each `npm test --coverage` call. + + + +## License + +MIT + + + +## Changelog + +### v0.3.6 (2014/06/23) + + - really handle sparse arrays (eg. `[,]`), fixes moonwalk. (#15) + +### v0.3.5 (2014/06/23) + + - handle sparse arrays (eg. `[,]`). (#15) + +### v0.3.4 (2014/06/23) + + - only add `BlockComment.originalIndent` if `WhiteSpace` is on the start of + a line. + +### v0.3.3 (2014/04/26) + + - add `toString` to empty programs AST (#16) + +### v0.3.2 (2014/01/17) + + - exports `BYPASS_RECURSION` (#8) + - fix error if input is empty (#12) + - support anything that implements `toString()` as input (#13) + +### v0.3.1 (2013/12/15) + + - fix `originalIndent` on `BlockComment` when prev token is not `WhiteSpace`. + +### v0.3.0 (2013/12/15) + + - add `originalIndent` to `BlockComment` (#11) + +### v0.2.3 (2013/01/08) + + - improve `rocambole.parse()` performance by 4500%. (#4) + - improve `rocambole.moonwalk()` performance by 11000%. + +### v0.2.2 (2012/12/19) + + - fix consecutive comments before start of program. (#3) + +### v0.2.1 (2012/12/13) + + - fix `loc` info on `WhiteSpace` and `LineBreak` tokens. (#2) + +### v0.2.0 (2012/12/09) + + - Deprecated: + - `token.before()` + - `token.after()` + - `token.remove()` + - `node.getTokens()` + - `ast.nodes` + - avoid recursion over comments. + - fix weird bug on esformatter introduced on v0.1.1 related to `token._ast` + property. + +### v0.1.1 (2012/12/08) + + - Improve token manipulation methods behavior (`before`, `after`, `remove`) + +### v0.1.0 (2012/12/06) + + - Initial release + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/.bin/esparse b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/.bin/esparse new file mode 120000 index 00000000..7423b18b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/.bin/esparse @@ -0,0 +1 @@ +../esprima/bin/esparse.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/.bin/esvalidate b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/.bin/esvalidate new file mode 120000 index 00000000..16069eff --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/.bin/esvalidate @@ -0,0 +1 @@ +../esprima/bin/esvalidate.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/README.md new file mode 100644 index 00000000..a74bd12d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/README.md @@ -0,0 +1,73 @@ +**Esprima** ([esprima.org](http://esprima.org)) is a high performance, +standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +parser written in ECMAScript (also popularly known as +[JavaScript](http://en.wikipedia.org/wiki/JavaScript>JavaScript)). +Esprima is created and maintained by [Ariya Hidayat](http://twitter.com/ariyahidayat), +with the help of [many contributors](https://github.com/ariya/esprima/contributors). + +Esprima runs on web browsers (IE 6+, Firefox 1+, Safari 3+, Chrome 1+, Konqueror 4.6+, Opera 8+) as well as +[Node.js](http://nodejs.org). + +### Features + +- Full support for [ECMAScript 5.1](http://www.ecma-international.org/publications/standards/Ecma-262.htm)(ECMA-262) +- Sensible [syntax tree format](http://esprima.org/doc/index.html#ast) compatible with Mozilla +[Parser AST](https://developer.mozilla.org/en/SpiderMonkey/Parser_API) +- Heavily tested (> 550 [unit tests](http://esprima.org/test/) with solid 100% statement coverage) +- Optional tracking of syntax node location (index-based and line-column) +- Experimental support for ES6/Harmony (module, class, destructuring, ...) + +Esprima is blazing fast (see the [benchmark suite](http://esprima.org/test/benchmarks.html)). +It is up to 3x faster than UglifyJS v1 and it is still [competitive](http://esprima.org/test/compare.html) +with the new generation of fast parsers. + +### Applications + +Esprima serves as the basis for many popular JavaScript development tools: + +- Code coverage analysis: [node-cover](https://github.com/itay/node-cover), [Istanbul](https://github.com/yahoo/Istanbul) +- Documentation tool: [JFDoc](https://github.com/thejohnfreeman/jfdoc), [JSDuck](https://github.com/senchalabs/jsduck) +- Language extension: [LLJS](http://mbebenita.github.com/LLJS/) (low-level JS), +[Sweet.js](http://sweetjs.org/) (macro) +- ES6/Harmony transpiler: [Six](https://github.com/matthewrobb/six), [Harmonizr](https://github.com/jdiamond/harmonizr) +- Eclipse Orion smart editing ([outline view](https://github.com/aclement/esprima-outline), [content assist](http://contraptionsforprogramming.blogspot.com/2012/02/better-javascript-content-assist-in.html)) +- Source code modification: [Esmorph](https://github.com/ariya/esmorph), [Code Painter](https://github.com/fawek/codepainter), +- Source transformation: [node-falafel](https://github.com/substack/node-falafel), [Esmangle](https://github.com/Constellation/esmangle), [escodegen](https://github.com/Constellation/escodegen) + +### Questions? +- [Documentation](http://esprima.org/doc) +- [Issue tracker](http://issues.esprima.org): [known problems](http://code.google.com/p/esprima/issues/list?q=Defect) +and [future plans](http://code.google.com/p/esprima/issues/list?q=Enhancement) +- [Mailing list](http://groups.google.com/group/esprima) +- [Contribution guide](http://esprima.org/doc/index.html#contribution) + +Follow [@Esprima](http://twitter.com/Esprima) on Twitter to get the +development updates. +Feedback and contribution are welcomed! + +### License + +Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about) + and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/bin/esparse.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/bin/esparse.js new file mode 100755 index 00000000..3e7bb81e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/bin/esparse.js @@ -0,0 +1,117 @@ +#!/usr/bin/env node +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint sloppy:true node:true rhino:true */ + +var fs, esprima, fname, content, options, syntax; + +if (typeof require === 'function') { + fs = require('fs'); + esprima = require('esprima'); +} else if (typeof load === 'function') { + try { + load('esprima.js'); + } catch (e) { + load('../esprima.js'); + } +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { argv: arguments, exit: quit }; + process.argv.unshift('esparse.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esparse [options] file.js'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --comment Gather all line and block comments in an array'); + console.log(' --loc Include line-column location info for each syntax node'); + console.log(' --range Include index-based range for each syntax node'); + console.log(' --raw Display the raw value of literals'); + console.log(' --tokens List all tokens in an array'); + console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)'); + console.log(' -v, --version Shows program version'); + console.log(); + process.exit(1); +} + +if (process.argv.length <= 2) { + showUsage(); +} + +options = {}; + +process.argv.splice(2).forEach(function (entry) { + + if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Parser (using Esprima version', esprima.version, ')'); + console.log(); + process.exit(0); + } else if (entry === '--comment') { + options.comment = true; + } else if (entry === '--loc') { + options.loc = true; + } else if (entry === '--range') { + options.range = true; + } else if (entry === '--raw') { + options.raw = true; + } else if (entry === '--tokens') { + options.tokens = true; + } else if (entry === '--tolerant') { + options.tolerant = true; + } else if (entry.slice(0, 2) === '--') { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } else if (typeof fname === 'string') { + console.log('Error: more than one input file.'); + process.exit(1); + } else { + fname = entry; + } +}); + +if (typeof fname !== 'string') { + console.log('Error: no input file.'); + process.exit(1); +} + +try { + content = fs.readFileSync(fname, 'utf-8'); + syntax = esprima.parse(content, options); + console.log(JSON.stringify(syntax, null, 4)); +} catch (e) { + console.log('Error: ' + e.message); + process.exit(1); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/bin/esvalidate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/bin/esvalidate.js new file mode 100755 index 00000000..e0af3f70 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/bin/esvalidate.js @@ -0,0 +1,177 @@ +#!/usr/bin/env node +/* + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint sloppy:true plusplus:true node:true rhino:true */ + +var fs, esprima, options, fnames, count; + +if (typeof require === 'function') { + fs = require('fs'); + esprima = require('esprima'); +} else if (typeof load === 'function') { + try { + load('esprima.js'); + } catch (e) { + load('../esprima.js'); + } +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { argv: arguments, exit: quit }; + process.argv.unshift('esvalidate.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esvalidate [options] file.js'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --format=type Set the report format, plain (default) or junit'); + console.log(' -v, --version Print program version'); + console.log(); + process.exit(1); +} + +if (process.argv.length <= 2) { + showUsage(); +} + +options = { + format: 'plain' +}; + +fnames = []; + +process.argv.splice(2).forEach(function (entry) { + + if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Validator (using Esprima version', esprima.version, ')'); + console.log(); + process.exit(0); + } else if (entry.slice(0, 9) === '--format=') { + options.format = entry.slice(9); + if (options.format !== 'plain' && options.format !== 'junit') { + console.log('Error: unknown report format ' + options.format + '.'); + process.exit(1); + } + } else if (entry.slice(0, 2) === '--') { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } else { + fnames.push(entry); + } +}); + +if (fnames.length === 0) { + console.log('Error: no input file.'); + process.exit(1); +} + +if (options.format === 'junit') { + console.log(''); + console.log(''); +} + +count = 0; +fnames.forEach(function (fname) { + var content, timestamp, syntax, name; + try { + content = fs.readFileSync(fname, 'utf-8'); + + if (content[0] === '#' && content[1] === '!') { + content = '//' + content.substr(2, content.length); + } + + timestamp = Date.now(); + syntax = esprima.parse(content, { tolerant: true }); + + if (options.format === 'junit') { + + name = fname; + if (name.lastIndexOf('/') >= 0) { + name = name.slice(name.lastIndexOf('/') + 1); + } + + console.log(''); + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + console.log(' '); + console.log(' ' + + error.message + '(' + name + ':' + error.lineNumber + ')' + + ''); + console.log(' '); + }); + + console.log(''); + + } else if (options.format === 'plain') { + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + msg = fname + ':' + error.lineNumber + ': ' + msg; + console.log(msg); + ++count; + }); + + } + } catch (e) { + ++count; + if (options.format === 'junit') { + console.log(''); + console.log(' '); + console.log(' ' + + e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') + + ')'); + console.log(' '); + console.log(''); + } else { + console.log('Error: ' + e.message); + } + } +}); + +if (options.format === 'junit') { + console.log(''); +} + +if (count > 0) { + process.exit(1); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/esprima.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/esprima.js new file mode 100644 index 00000000..f1320daf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/esprima.js @@ -0,0 +1,3908 @@ +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Mathias Bynens + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Kris Kowal + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint bitwise:true plusplus:true */ +/*global esprima:true, define:true, exports:true, window: true, +throwError: true, createLiteral: true, generateStatement: true, +parseAssignmentExpression: true, parseBlock: true, parseExpression: true, +parseFunctionDeclaration: true, parseFunctionExpression: true, +parseFunctionSourceElements: true, parseVariableIdentifier: true, +parseLeftHandSideExpression: true, +parseStatement: true, parseSourceElement: true */ + +(function (root, factory) { + 'use strict'; + + // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, + // Rhino, and plain browser loading. + if (typeof define === 'function' && define.amd) { + define(['exports'], factory); + } else if (typeof exports !== 'undefined') { + factory(exports); + } else { + factory((root.esprima = {})); + } +}(this, function (exports) { + 'use strict'; + + var Token, + TokenName, + Syntax, + PropertyKind, + Messages, + Regex, + source, + strict, + index, + lineNumber, + lineStart, + length, + buffer, + state, + extra; + + Token = { + BooleanLiteral: 1, + EOF: 2, + Identifier: 3, + Keyword: 4, + NullLiteral: 5, + NumericLiteral: 6, + Punctuator: 7, + StringLiteral: 8 + }; + + TokenName = {}; + TokenName[Token.BooleanLiteral] = 'Boolean'; + TokenName[Token.EOF] = ''; + TokenName[Token.Identifier] = 'Identifier'; + TokenName[Token.Keyword] = 'Keyword'; + TokenName[Token.NullLiteral] = 'Null'; + TokenName[Token.NumericLiteral] = 'Numeric'; + TokenName[Token.Punctuator] = 'Punctuator'; + TokenName[Token.StringLiteral] = 'String'; + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + ArrayExpression: 'ArrayExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + Program: 'Program', + Property: 'Property', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement' + }; + + PropertyKind = { + Data: 1, + Get: 2, + Set: 4 + }; + + // Error messages should be identical to V8. + Messages = { + UnexpectedToken: 'Unexpected token %0', + UnexpectedNumber: 'Unexpected number', + UnexpectedString: 'Unexpected string', + UnexpectedIdentifier: 'Unexpected identifier', + UnexpectedReserved: 'Unexpected reserved word', + UnexpectedEOS: 'Unexpected end of input', + NewlineAfterThrow: 'Illegal newline after throw', + InvalidRegExp: 'Invalid regular expression', + UnterminatedRegExp: 'Invalid regular expression: missing /', + InvalidLHSInAssignment: 'Invalid left-hand side in assignment', + InvalidLHSInForIn: 'Invalid left-hand side in for-in', + MultipleDefaultsInSwitch: 'More than one default clause in switch statement', + NoCatchOrFinally: 'Missing catch or finally after try', + UnknownLabel: 'Undefined label \'%0\'', + Redeclaration: '%0 \'%1\' has already been declared', + IllegalContinue: 'Illegal continue statement', + IllegalBreak: 'Illegal break statement', + IllegalReturn: 'Illegal return statement', + StrictModeWith: 'Strict mode code may not include a with statement', + StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', + StrictVarName: 'Variable name may not be eval or arguments in strict mode', + StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', + StrictParamDupe: 'Strict mode function may not have duplicate parameter names', + StrictFunctionName: 'Function name may not be eval or arguments in strict mode', + StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', + StrictDelete: 'Delete of an unqualified identifier in strict mode.', + StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode', + AccessorDataProperty: 'Object literal may not have data and accessor property with the same name', + AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name', + StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', + StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', + StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', + StrictReservedWord: 'Use of future reserved word in strict mode' + }; + + // See also tools/generate-unicode-regex.py. + Regex = { + NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'), + NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]') + }; + + // Ensure the condition is true, otherwise throw an error. + // This is only to have a better contract semantic, i.e. another safety net + // to catch a logic error. The condition shall be fulfilled in normal case. + // Do NOT use this to enforce a certain condition on any user input. + + function assert(condition, message) { + if (!condition) { + throw new Error('ASSERT: ' + message); + } + } + + function sliceSource(from, to) { + return source.slice(from, to); + } + + if (typeof 'esprima'[0] === 'undefined') { + sliceSource = function sliceArraySource(from, to) { + return source.slice(from, to).join(''); + }; + } + + function isDecimalDigit(ch) { + return '0123456789'.indexOf(ch) >= 0; + } + + function isHexDigit(ch) { + return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; + } + + function isOctalDigit(ch) { + return '01234567'.indexOf(ch) >= 0; + } + + + // 7.2 White Space + + function isWhiteSpace(ch) { + return (ch === ' ') || (ch === '\u0009') || (ch === '\u000B') || + (ch === '\u000C') || (ch === '\u00A0') || + (ch.charCodeAt(0) >= 0x1680 && + '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(ch) >= 0); + } + + // 7.3 Line Terminators + + function isLineTerminator(ch) { + return (ch === '\n' || ch === '\r' || ch === '\u2028' || ch === '\u2029'); + } + + // 7.6 Identifier Names and Identifiers + + function isIdentifierStart(ch) { + return (ch === '$') || (ch === '_') || (ch === '\\') || + (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || + ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierStart.test(ch)); + } + + function isIdentifierPart(ch) { + return (ch === '$') || (ch === '_') || (ch === '\\') || + (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || + ((ch >= '0') && (ch <= '9')) || + ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierPart.test(ch)); + } + + // 7.6.1.2 Future Reserved Words + + function isFutureReservedWord(id) { + switch (id) { + + // Future reserved words. + case 'class': + case 'enum': + case 'export': + case 'extends': + case 'import': + case 'super': + return true; + } + + return false; + } + + function isStrictModeReservedWord(id) { + switch (id) { + + // Strict Mode reserved words. + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'yield': + case 'let': + return true; + } + + return false; + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + // 7.6.1.1 Keywords + + function isKeyword(id) { + var keyword = false; + switch (id.length) { + case 2: + keyword = (id === 'if') || (id === 'in') || (id === 'do'); + break; + case 3: + keyword = (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try'); + break; + case 4: + keyword = (id === 'this') || (id === 'else') || (id === 'case') || (id === 'void') || (id === 'with'); + break; + case 5: + keyword = (id === 'while') || (id === 'break') || (id === 'catch') || (id === 'throw'); + break; + case 6: + keyword = (id === 'return') || (id === 'typeof') || (id === 'delete') || (id === 'switch'); + break; + case 7: + keyword = (id === 'default') || (id === 'finally'); + break; + case 8: + keyword = (id === 'function') || (id === 'continue') || (id === 'debugger'); + break; + case 10: + keyword = (id === 'instanceof'); + break; + } + + if (keyword) { + return true; + } + + switch (id) { + // Future reserved words. + // 'const' is specialized as Keyword in V8. + case 'const': + return true; + + // For compatiblity to SpiderMonkey and ES.next + case 'yield': + case 'let': + return true; + } + + if (strict && isStrictModeReservedWord(id)) { + return true; + } + + return isFutureReservedWord(id); + } + + // 7.4 Comments + + function skipComment() { + var ch, blockComment, lineComment; + + blockComment = false; + lineComment = false; + + while (index < length) { + ch = source[index]; + + if (lineComment) { + ch = source[index++]; + if (isLineTerminator(ch)) { + lineComment = false; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + ++lineNumber; + lineStart = index; + } + } else if (blockComment) { + if (isLineTerminator(ch)) { + if (ch === '\r' && source[index + 1] === '\n') { + ++index; + } + ++lineNumber; + ++index; + lineStart = index; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + ch = source[index++]; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + if (ch === '*') { + ch = source[index]; + if (ch === '/') { + ++index; + blockComment = false; + } + } + } + } else if (ch === '/') { + ch = source[index + 1]; + if (ch === '/') { + index += 2; + lineComment = true; + } else if (ch === '*') { + index += 2; + blockComment = true; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + break; + } + } else if (isWhiteSpace(ch)) { + ++index; + } else if (isLineTerminator(ch)) { + ++index; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + ++lineNumber; + lineStart = index; + } else { + break; + } + } + } + + function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && isHexDigit(source[index])) { + ch = source[index++]; + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } + + function scanIdentifier() { + var ch, start, id, restore; + + ch = source[index]; + if (!isIdentifierStart(ch)) { + return; + } + + start = index; + if (ch === '\\') { + ++index; + if (source[index] !== 'u') { + return; + } + ++index; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + if (ch === '\\' || !isIdentifierStart(ch)) { + return; + } + id = ch; + } else { + index = restore; + id = 'u'; + } + } else { + id = source[index++]; + } + + while (index < length) { + ch = source[index]; + if (!isIdentifierPart(ch)) { + break; + } + if (ch === '\\') { + ++index; + if (source[index] !== 'u') { + return; + } + ++index; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + if (ch === '\\' || !isIdentifierPart(ch)) { + return; + } + id += ch; + } else { + index = restore; + id += 'u'; + } + } else { + id += source[index++]; + } + } + + // There is no keyword or literal with only one character. + // Thus, it must be an identifier. + if (id.length === 1) { + return { + type: Token.Identifier, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (isKeyword(id)) { + return { + type: Token.Keyword, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.8.1 Null Literals + + if (id === 'null') { + return { + type: Token.NullLiteral, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.8.2 Boolean Literals + + if (id === 'true' || id === 'false') { + return { + type: Token.BooleanLiteral, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + return { + type: Token.Identifier, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.7 Punctuators + + function scanPunctuator() { + var start = index, + ch1 = source[index], + ch2, + ch3, + ch4; + + // Check for most common single-character punctuators. + + if (ch1 === ';' || ch1 === '{' || ch1 === '}') { + ++index; + return { + type: Token.Punctuator, + value: ch1, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === ',' || ch1 === '(' || ch1 === ')') { + ++index; + return { + type: Token.Punctuator, + value: ch1, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // Dot (.) can also start a floating-point number, hence the need + // to check the next character. + + ch2 = source[index + 1]; + if (ch1 === '.' && !isDecimalDigit(ch2)) { + return { + type: Token.Punctuator, + value: source[index++], + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // Peek more characters. + + ch3 = source[index + 2]; + ch4 = source[index + 3]; + + // 4-character punctuator: >>>= + + if (ch1 === '>' && ch2 === '>' && ch3 === '>') { + if (ch4 === '=') { + index += 4; + return { + type: Token.Punctuator, + value: '>>>=', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // 3-character punctuators: === !== >>> <<= >>= + + if (ch1 === '=' && ch2 === '=' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '===', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '!' && ch2 === '=' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '!==', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '>' && ch2 === '>' && ch3 === '>') { + index += 3; + return { + type: Token.Punctuator, + value: '>>>', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '<' && ch2 === '<' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '<<=', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '>' && ch2 === '>' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '>>=', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 2-character punctuators: <= >= == != ++ -- << >> && || + // += -= *= %= &= |= ^= /= + + if (ch2 === '=') { + if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { + index += 2; + return { + type: Token.Punctuator, + value: ch1 + ch2, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0)) { + if ('+-<>&|'.indexOf(ch2) >= 0) { + index += 2; + return { + type: Token.Punctuator, + value: ch1 + ch2, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // The remaining 1-character punctuators. + + if ('[]<>+-*%&|^!~?:=/'.indexOf(ch1) >= 0) { + return { + type: Token.Punctuator, + value: source[index++], + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // 7.8.3 Numeric Literals + + function scanNumericLiteral() { + var number, start, ch; + + ch = source[index]; + assert(isDecimalDigit(ch) || (ch === '.'), + 'Numeric literal must start with a decimal digit or a decimal point'); + + start = index; + number = ''; + if (ch !== '.') { + number = source[index++]; + ch = source[index]; + + // Hex number starts with '0x'. + // Octal number starts with '0'. + if (number === '0') { + if (ch === 'x' || ch === 'X') { + number += source[index++]; + while (index < length) { + ch = source[index]; + if (!isHexDigit(ch)) { + break; + } + number += source[index++]; + } + + if (number.length <= 2) { + // only 0x + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + + if (index < length) { + ch = source[index]; + if (isIdentifierStart(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + return { + type: Token.NumericLiteral, + value: parseInt(number, 16), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } else if (isOctalDigit(ch)) { + number += source[index++]; + while (index < length) { + ch = source[index]; + if (!isOctalDigit(ch)) { + break; + } + number += source[index++]; + } + + if (index < length) { + ch = source[index]; + if (isIdentifierStart(ch) || isDecimalDigit(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + return { + type: Token.NumericLiteral, + value: parseInt(number, 8), + octal: true, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // decimal number starts with '0' such as '09' is illegal. + if (isDecimalDigit(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + + while (index < length) { + ch = source[index]; + if (!isDecimalDigit(ch)) { + break; + } + number += source[index++]; + } + } + + if (ch === '.') { + number += source[index++]; + while (index < length) { + ch = source[index]; + if (!isDecimalDigit(ch)) { + break; + } + number += source[index++]; + } + } + + if (ch === 'e' || ch === 'E') { + number += source[index++]; + + ch = source[index]; + if (ch === '+' || ch === '-') { + number += source[index++]; + } + + ch = source[index]; + if (isDecimalDigit(ch)) { + number += source[index++]; + while (index < length) { + ch = source[index]; + if (!isDecimalDigit(ch)) { + break; + } + number += source[index++]; + } + } else { + ch = 'character ' + ch; + if (index >= length) { + ch = ''; + } + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + + if (index < length) { + ch = source[index]; + if (isIdentifierStart(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + + return { + type: Token.NumericLiteral, + value: parseFloat(number), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.8.4 String Literals + + function scanStringLiteral() { + var str = '', quote, start, ch, code, unescaped, restore, octal = false; + + quote = source[index]; + assert((quote === '\'' || quote === '"'), + 'String literal must starts with a quote'); + + start = index; + ++index; + + while (index < length) { + ch = source[index++]; + + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = source[index++]; + if (!isLineTerminator(ch)) { + switch (ch) { + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'u': + case 'x': + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + str += unescaped; + } else { + index = restore; + str += ch; + } + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\x0B'; + break; + + default: + if (isOctalDigit(ch)) { + code = '01234567'.indexOf(ch); + + // \0 is not octal escape sequence + if (code !== 0) { + octal = true; + } + + if (index < length && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + '01234567'.indexOf(source[index++]); + + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + isOctalDigit(source[index])) { + code = code * 8 + '01234567'.indexOf(source[index++]); + } + } + str += String.fromCharCode(code); + } else { + str += ch; + } + break; + } + } else { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + } + } else if (isLineTerminator(ch)) { + break; + } else { + str += ch; + } + } + + if (quote !== '') { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + + return { + type: Token.StringLiteral, + value: str, + octal: octal, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + function scanRegExp() { + var str, ch, start, pattern, flags, value, classMarker = false, restore, terminated = false; + + buffer = null; + skipComment(); + + start = index; + ch = source[index]; + assert(ch === '/', 'Regular expression literal must start with a slash'); + str = source[index++]; + + while (index < length) { + ch = source[index++]; + str += ch; + if (ch === '\\') { + ch = source[index++]; + // ECMA-262 7.8.5 + if (isLineTerminator(ch)) { + throwError({}, Messages.UnterminatedRegExp); + } + str += ch; + } else if (classMarker) { + if (ch === ']') { + classMarker = false; + } + } else { + if (ch === '/') { + terminated = true; + break; + } else if (ch === '[') { + classMarker = true; + } else if (isLineTerminator(ch)) { + throwError({}, Messages.UnterminatedRegExp); + } + } + } + + if (!terminated) { + throwError({}, Messages.UnterminatedRegExp); + } + + // Exclude leading and trailing slash. + pattern = str.substr(1, str.length - 2); + + flags = ''; + while (index < length) { + ch = source[index]; + if (!isIdentifierPart(ch)) { + break; + } + + ++index; + if (ch === '\\' && index < length) { + ch = source[index]; + if (ch === 'u') { + ++index; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + flags += ch; + str += '\\u'; + for (; restore < index; ++restore) { + str += source[restore]; + } + } else { + index = restore; + flags += 'u'; + str += '\\u'; + } + } else { + str += '\\'; + } + } else { + flags += ch; + str += ch; + } + } + + try { + value = new RegExp(pattern, flags); + } catch (e) { + throwError({}, Messages.InvalidRegExp); + } + + return { + literal: str, + value: value, + range: [start, index] + }; + } + + function isIdentifierName(token) { + return token.type === Token.Identifier || + token.type === Token.Keyword || + token.type === Token.BooleanLiteral || + token.type === Token.NullLiteral; + } + + function advance() { + var ch, token; + + skipComment(); + + if (index >= length) { + return { + type: Token.EOF, + lineNumber: lineNumber, + lineStart: lineStart, + range: [index, index] + }; + } + + token = scanPunctuator(); + if (typeof token !== 'undefined') { + return token; + } + + ch = source[index]; + + if (ch === '\'' || ch === '"') { + return scanStringLiteral(); + } + + if (ch === '.' || isDecimalDigit(ch)) { + return scanNumericLiteral(); + } + + token = scanIdentifier(); + if (typeof token !== 'undefined') { + return token; + } + + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + + function lex() { + var token; + + if (buffer) { + index = buffer.range[1]; + lineNumber = buffer.lineNumber; + lineStart = buffer.lineStart; + token = buffer; + buffer = null; + return token; + } + + buffer = null; + return advance(); + } + + function lookahead() { + var pos, line, start; + + if (buffer !== null) { + return buffer; + } + + pos = index; + line = lineNumber; + start = lineStart; + buffer = advance(); + index = pos; + lineNumber = line; + lineStart = start; + + return buffer; + } + + // Return true if there is a line terminator before the next token. + + function peekLineTerminator() { + var pos, line, start, found; + + pos = index; + line = lineNumber; + start = lineStart; + skipComment(); + found = lineNumber !== line; + index = pos; + lineNumber = line; + lineStart = start; + + return found; + } + + // Throw an exception + + function throwError(token, messageFormat) { + var error, + args = Array.prototype.slice.call(arguments, 2), + msg = messageFormat.replace( + /%(\d)/g, + function (whole, index) { + return args[index] || ''; + } + ); + + if (typeof token.lineNumber === 'number') { + error = new Error('Line ' + token.lineNumber + ': ' + msg); + error.index = token.range[0]; + error.lineNumber = token.lineNumber; + error.column = token.range[0] - lineStart + 1; + } else { + error = new Error('Line ' + lineNumber + ': ' + msg); + error.index = index; + error.lineNumber = lineNumber; + error.column = index - lineStart + 1; + } + + throw error; + } + + function throwErrorTolerant() { + try { + throwError.apply(null, arguments); + } catch (e) { + if (extra.errors) { + extra.errors.push(e); + } else { + throw e; + } + } + } + + + // Throw an exception because of the token. + + function throwUnexpected(token) { + if (token.type === Token.EOF) { + throwError(token, Messages.UnexpectedEOS); + } + + if (token.type === Token.NumericLiteral) { + throwError(token, Messages.UnexpectedNumber); + } + + if (token.type === Token.StringLiteral) { + throwError(token, Messages.UnexpectedString); + } + + if (token.type === Token.Identifier) { + throwError(token, Messages.UnexpectedIdentifier); + } + + if (token.type === Token.Keyword) { + if (isFutureReservedWord(token.value)) { + throwError(token, Messages.UnexpectedReserved); + } else if (strict && isStrictModeReservedWord(token.value)) { + throwErrorTolerant(token, Messages.StrictReservedWord); + return; + } + throwError(token, Messages.UnexpectedToken, token.value); + } + + // BooleanLiteral, NullLiteral, or Punctuator. + throwError(token, Messages.UnexpectedToken, token.value); + } + + // Expect the next token to match the specified punctuator. + // If not, an exception will be thrown. + + function expect(value) { + var token = lex(); + if (token.type !== Token.Punctuator || token.value !== value) { + throwUnexpected(token); + } + } + + // Expect the next token to match the specified keyword. + // If not, an exception will be thrown. + + function expectKeyword(keyword) { + var token = lex(); + if (token.type !== Token.Keyword || token.value !== keyword) { + throwUnexpected(token); + } + } + + // Return true if the next token matches the specified punctuator. + + function match(value) { + var token = lookahead(); + return token.type === Token.Punctuator && token.value === value; + } + + // Return true if the next token matches the specified keyword + + function matchKeyword(keyword) { + var token = lookahead(); + return token.type === Token.Keyword && token.value === keyword; + } + + // Return true if the next token is an assignment operator + + function matchAssign() { + var token = lookahead(), + op = token.value; + + if (token.type !== Token.Punctuator) { + return false; + } + return op === '=' || + op === '*=' || + op === '/=' || + op === '%=' || + op === '+=' || + op === '-=' || + op === '<<=' || + op === '>>=' || + op === '>>>=' || + op === '&=' || + op === '^=' || + op === '|='; + } + + function consumeSemicolon() { + var token, line; + + // Catch the very common case first. + if (source[index] === ';') { + lex(); + return; + } + + line = lineNumber; + skipComment(); + if (lineNumber !== line) { + return; + } + + if (match(';')) { + lex(); + return; + } + + token = lookahead(); + if (token.type !== Token.EOF && !match('}')) { + throwUnexpected(token); + } + } + + // Return true if provided expression is LeftHandSideExpression + + function isLeftHandSide(expr) { + return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression; + } + + // 11.1.4 Array Initialiser + + function parseArrayInitialiser() { + var elements = []; + + expect('['); + + while (!match(']')) { + if (match(',')) { + lex(); + elements.push(null); + } else { + elements.push(parseAssignmentExpression()); + + if (!match(']')) { + expect(','); + } + } + } + + expect(']'); + + return { + type: Syntax.ArrayExpression, + elements: elements + }; + } + + // 11.1.5 Object Initialiser + + function parsePropertyFunction(param, first) { + var previousStrict, body; + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (first && strict && isRestrictedWord(param[0].name)) { + throwErrorTolerant(first, Messages.StrictParamName); + } + strict = previousStrict; + + return { + type: Syntax.FunctionExpression, + id: null, + params: param, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }; + } + + function parseObjectPropertyKey() { + var token = lex(); + + // Note: This function is called only from parseObjectProperty(), where + // EOF and Punctuator tokens are already filtered out. + + if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) { + if (strict && token.octal) { + throwErrorTolerant(token, Messages.StrictOctalLiteral); + } + return createLiteral(token); + } + + return { + type: Syntax.Identifier, + name: token.value + }; + } + + function parseObjectProperty() { + var token, key, id, param; + + token = lookahead(); + + if (token.type === Token.Identifier) { + + id = parseObjectPropertyKey(); + + // Property Assignment: Getter and Setter. + + if (token.value === 'get' && !match(':')) { + key = parseObjectPropertyKey(); + expect('('); + expect(')'); + return { + type: Syntax.Property, + key: key, + value: parsePropertyFunction([]), + kind: 'get' + }; + } else if (token.value === 'set' && !match(':')) { + key = parseObjectPropertyKey(); + expect('('); + token = lookahead(); + if (token.type !== Token.Identifier) { + expect(')'); + throwErrorTolerant(token, Messages.UnexpectedToken, token.value); + return { + type: Syntax.Property, + key: key, + value: parsePropertyFunction([]), + kind: 'set' + }; + } else { + param = [ parseVariableIdentifier() ]; + expect(')'); + return { + type: Syntax.Property, + key: key, + value: parsePropertyFunction(param, token), + kind: 'set' + }; + } + } else { + expect(':'); + return { + type: Syntax.Property, + key: id, + value: parseAssignmentExpression(), + kind: 'init' + }; + } + } else if (token.type === Token.EOF || token.type === Token.Punctuator) { + throwUnexpected(token); + } else { + key = parseObjectPropertyKey(); + expect(':'); + return { + type: Syntax.Property, + key: key, + value: parseAssignmentExpression(), + kind: 'init' + }; + } + } + + function parseObjectInitialiser() { + var properties = [], property, name, kind, map = {}, toString = String; + + expect('{'); + + while (!match('}')) { + property = parseObjectProperty(); + + if (property.key.type === Syntax.Identifier) { + name = property.key.name; + } else { + name = toString(property.key.value); + } + kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set; + if (Object.prototype.hasOwnProperty.call(map, name)) { + if (map[name] === PropertyKind.Data) { + if (strict && kind === PropertyKind.Data) { + throwErrorTolerant({}, Messages.StrictDuplicateProperty); + } else if (kind !== PropertyKind.Data) { + throwErrorTolerant({}, Messages.AccessorDataProperty); + } + } else { + if (kind === PropertyKind.Data) { + throwErrorTolerant({}, Messages.AccessorDataProperty); + } else if (map[name] & kind) { + throwErrorTolerant({}, Messages.AccessorGetSet); + } + } + map[name] |= kind; + } else { + map[name] = kind; + } + + properties.push(property); + + if (!match('}')) { + expect(','); + } + } + + expect('}'); + + return { + type: Syntax.ObjectExpression, + properties: properties + }; + } + + // 11.1.6 The Grouping Operator + + function parseGroupExpression() { + var expr; + + expect('('); + + expr = parseExpression(); + + expect(')'); + + return expr; + } + + + // 11.1 Primary Expressions + + function parsePrimaryExpression() { + var token = lookahead(), + type = token.type; + + if (type === Token.Identifier) { + return { + type: Syntax.Identifier, + name: lex().value + }; + } + + if (type === Token.StringLiteral || type === Token.NumericLiteral) { + if (strict && token.octal) { + throwErrorTolerant(token, Messages.StrictOctalLiteral); + } + return createLiteral(lex()); + } + + if (type === Token.Keyword) { + if (matchKeyword('this')) { + lex(); + return { + type: Syntax.ThisExpression + }; + } + + if (matchKeyword('function')) { + return parseFunctionExpression(); + } + } + + if (type === Token.BooleanLiteral) { + lex(); + token.value = (token.value === 'true'); + return createLiteral(token); + } + + if (type === Token.NullLiteral) { + lex(); + token.value = null; + return createLiteral(token); + } + + if (match('[')) { + return parseArrayInitialiser(); + } + + if (match('{')) { + return parseObjectInitialiser(); + } + + if (match('(')) { + return parseGroupExpression(); + } + + if (match('/') || match('/=')) { + return createLiteral(scanRegExp()); + } + + return throwUnexpected(lex()); + } + + // 11.2 Left-Hand-Side Expressions + + function parseArguments() { + var args = []; + + expect('('); + + if (!match(')')) { + while (index < length) { + args.push(parseAssignmentExpression()); + if (match(')')) { + break; + } + expect(','); + } + } + + expect(')'); + + return args; + } + + function parseNonComputedProperty() { + var token = lex(); + + if (!isIdentifierName(token)) { + throwUnexpected(token); + } + + return { + type: Syntax.Identifier, + name: token.value + }; + } + + function parseNonComputedMember() { + expect('.'); + + return parseNonComputedProperty(); + } + + function parseComputedMember() { + var expr; + + expect('['); + + expr = parseExpression(); + + expect(']'); + + return expr; + } + + function parseNewExpression() { + var expr; + + expectKeyword('new'); + + expr = { + type: Syntax.NewExpression, + callee: parseLeftHandSideExpression(), + 'arguments': [] + }; + + if (match('(')) { + expr['arguments'] = parseArguments(); + } + + return expr; + } + + function parseLeftHandSideExpressionAllowCall() { + var expr; + + expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression(); + + while (match('.') || match('[') || match('(')) { + if (match('(')) { + expr = { + type: Syntax.CallExpression, + callee: expr, + 'arguments': parseArguments() + }; + } else if (match('[')) { + expr = { + type: Syntax.MemberExpression, + computed: true, + object: expr, + property: parseComputedMember() + }; + } else { + expr = { + type: Syntax.MemberExpression, + computed: false, + object: expr, + property: parseNonComputedMember() + }; + } + } + + return expr; + } + + + function parseLeftHandSideExpression() { + var expr; + + expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression(); + + while (match('.') || match('[')) { + if (match('[')) { + expr = { + type: Syntax.MemberExpression, + computed: true, + object: expr, + property: parseComputedMember() + }; + } else { + expr = { + type: Syntax.MemberExpression, + computed: false, + object: expr, + property: parseNonComputedMember() + }; + } + } + + return expr; + } + + // 11.3 Postfix Expressions + + function parsePostfixExpression() { + var expr = parseLeftHandSideExpressionAllowCall(), token; + + token = lookahead(); + if (token.type !== Token.Punctuator) { + return expr; + } + + if ((match('++') || match('--')) && !peekLineTerminator()) { + // 11.3.1, 11.3.2 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + throwErrorTolerant({}, Messages.StrictLHSPostfix); + } + if (!isLeftHandSide(expr)) { + throwErrorTolerant({}, Messages.InvalidLHSInAssignment); + } + + expr = { + type: Syntax.UpdateExpression, + operator: lex().value, + argument: expr, + prefix: false + }; + } + + return expr; + } + + // 11.4 Unary Operators + + function parseUnaryExpression() { + var token, expr; + + token = lookahead(); + if (token.type !== Token.Punctuator && token.type !== Token.Keyword) { + return parsePostfixExpression(); + } + + if (match('++') || match('--')) { + token = lex(); + expr = parseUnaryExpression(); + // 11.4.4, 11.4.5 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + throwErrorTolerant({}, Messages.StrictLHSPrefix); + } + + if (!isLeftHandSide(expr)) { + throwErrorTolerant({}, Messages.InvalidLHSInAssignment); + } + + expr = { + type: Syntax.UpdateExpression, + operator: token.value, + argument: expr, + prefix: true + }; + return expr; + } + + if (match('+') || match('-') || match('~') || match('!')) { + expr = { + type: Syntax.UnaryExpression, + operator: lex().value, + argument: parseUnaryExpression(), + prefix: true + }; + return expr; + } + + if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { + expr = { + type: Syntax.UnaryExpression, + operator: lex().value, + argument: parseUnaryExpression(), + prefix: true + }; + if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) { + throwErrorTolerant({}, Messages.StrictDelete); + } + return expr; + } + + return parsePostfixExpression(); + } + + // 11.5 Multiplicative Operators + + function parseMultiplicativeExpression() { + var expr = parseUnaryExpression(); + + while (match('*') || match('/') || match('%')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseUnaryExpression() + }; + } + + return expr; + } + + // 11.6 Additive Operators + + function parseAdditiveExpression() { + var expr = parseMultiplicativeExpression(); + + while (match('+') || match('-')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseMultiplicativeExpression() + }; + } + + return expr; + } + + // 11.7 Bitwise Shift Operators + + function parseShiftExpression() { + var expr = parseAdditiveExpression(); + + while (match('<<') || match('>>') || match('>>>')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseAdditiveExpression() + }; + } + + return expr; + } + // 11.8 Relational Operators + + function parseRelationalExpression() { + var expr, previousAllowIn; + + previousAllowIn = state.allowIn; + state.allowIn = true; + + expr = parseShiftExpression(); + + while (match('<') || match('>') || match('<=') || match('>=') || (previousAllowIn && matchKeyword('in')) || matchKeyword('instanceof')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseShiftExpression() + }; + } + + state.allowIn = previousAllowIn; + return expr; + } + + // 11.9 Equality Operators + + function parseEqualityExpression() { + var expr = parseRelationalExpression(); + + while (match('==') || match('!=') || match('===') || match('!==')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseRelationalExpression() + }; + } + + return expr; + } + + // 11.10 Binary Bitwise Operators + + function parseBitwiseANDExpression() { + var expr = parseEqualityExpression(); + + while (match('&')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: '&', + left: expr, + right: parseEqualityExpression() + }; + } + + return expr; + } + + function parseBitwiseXORExpression() { + var expr = parseBitwiseANDExpression(); + + while (match('^')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: '^', + left: expr, + right: parseBitwiseANDExpression() + }; + } + + return expr; + } + + function parseBitwiseORExpression() { + var expr = parseBitwiseXORExpression(); + + while (match('|')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: '|', + left: expr, + right: parseBitwiseXORExpression() + }; + } + + return expr; + } + + // 11.11 Binary Logical Operators + + function parseLogicalANDExpression() { + var expr = parseBitwiseORExpression(); + + while (match('&&')) { + lex(); + expr = { + type: Syntax.LogicalExpression, + operator: '&&', + left: expr, + right: parseBitwiseORExpression() + }; + } + + return expr; + } + + function parseLogicalORExpression() { + var expr = parseLogicalANDExpression(); + + while (match('||')) { + lex(); + expr = { + type: Syntax.LogicalExpression, + operator: '||', + left: expr, + right: parseLogicalANDExpression() + }; + } + + return expr; + } + + // 11.12 Conditional Operator + + function parseConditionalExpression() { + var expr, previousAllowIn, consequent; + + expr = parseLogicalORExpression(); + + if (match('?')) { + lex(); + previousAllowIn = state.allowIn; + state.allowIn = true; + consequent = parseAssignmentExpression(); + state.allowIn = previousAllowIn; + expect(':'); + + expr = { + type: Syntax.ConditionalExpression, + test: expr, + consequent: consequent, + alternate: parseAssignmentExpression() + }; + } + + return expr; + } + + // 11.13 Assignment Operators + + function parseAssignmentExpression() { + var token, expr; + + token = lookahead(); + expr = parseConditionalExpression(); + + if (matchAssign()) { + // LeftHandSideExpression + if (!isLeftHandSide(expr)) { + throwErrorTolerant({}, Messages.InvalidLHSInAssignment); + } + + // 11.13.1 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + throwErrorTolerant(token, Messages.StrictLHSAssignment); + } + + expr = { + type: Syntax.AssignmentExpression, + operator: lex().value, + left: expr, + right: parseAssignmentExpression() + }; + } + + return expr; + } + + // 11.14 Comma Operator + + function parseExpression() { + var expr = parseAssignmentExpression(); + + if (match(',')) { + expr = { + type: Syntax.SequenceExpression, + expressions: [ expr ] + }; + + while (index < length) { + if (!match(',')) { + break; + } + lex(); + expr.expressions.push(parseAssignmentExpression()); + } + + } + return expr; + } + + // 12.1 Block + + function parseStatementList() { + var list = [], + statement; + + while (index < length) { + if (match('}')) { + break; + } + statement = parseSourceElement(); + if (typeof statement === 'undefined') { + break; + } + list.push(statement); + } + + return list; + } + + function parseBlock() { + var block; + + expect('{'); + + block = parseStatementList(); + + expect('}'); + + return { + type: Syntax.BlockStatement, + body: block + }; + } + + // 12.2 Variable Statement + + function parseVariableIdentifier() { + var token = lex(); + + if (token.type !== Token.Identifier) { + throwUnexpected(token); + } + + return { + type: Syntax.Identifier, + name: token.value + }; + } + + function parseVariableDeclaration(kind) { + var id = parseVariableIdentifier(), + init = null; + + // 12.2.1 + if (strict && isRestrictedWord(id.name)) { + throwErrorTolerant({}, Messages.StrictVarName); + } + + if (kind === 'const') { + expect('='); + init = parseAssignmentExpression(); + } else if (match('=')) { + lex(); + init = parseAssignmentExpression(); + } + + return { + type: Syntax.VariableDeclarator, + id: id, + init: init + }; + } + + function parseVariableDeclarationList(kind) { + var list = []; + + do { + list.push(parseVariableDeclaration(kind)); + if (!match(',')) { + break; + } + lex(); + } while (index < length); + + return list; + } + + function parseVariableStatement() { + var declarations; + + expectKeyword('var'); + + declarations = parseVariableDeclarationList(); + + consumeSemicolon(); + + return { + type: Syntax.VariableDeclaration, + declarations: declarations, + kind: 'var' + }; + } + + // kind may be `const` or `let` + // Both are experimental and not in the specification yet. + // see http://wiki.ecmascript.org/doku.php?id=harmony:const + // and http://wiki.ecmascript.org/doku.php?id=harmony:let + function parseConstLetDeclaration(kind) { + var declarations; + + expectKeyword(kind); + + declarations = parseVariableDeclarationList(kind); + + consumeSemicolon(); + + return { + type: Syntax.VariableDeclaration, + declarations: declarations, + kind: kind + }; + } + + // 12.3 Empty Statement + + function parseEmptyStatement() { + expect(';'); + + return { + type: Syntax.EmptyStatement + }; + } + + // 12.4 Expression Statement + + function parseExpressionStatement() { + var expr = parseExpression(); + + consumeSemicolon(); + + return { + type: Syntax.ExpressionStatement, + expression: expr + }; + } + + // 12.5 If statement + + function parseIfStatement() { + var test, consequent, alternate; + + expectKeyword('if'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + consequent = parseStatement(); + + if (matchKeyword('else')) { + lex(); + alternate = parseStatement(); + } else { + alternate = null; + } + + return { + type: Syntax.IfStatement, + test: test, + consequent: consequent, + alternate: alternate + }; + } + + // 12.6 Iteration Statements + + function parseDoWhileStatement() { + var body, test, oldInIteration; + + expectKeyword('do'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + if (match(';')) { + lex(); + } + + return { + type: Syntax.DoWhileStatement, + body: body, + test: test + }; + } + + function parseWhileStatement() { + var test, body, oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + return { + type: Syntax.WhileStatement, + test: test, + body: body + }; + } + + function parseForVariableDeclaration() { + var token = lex(); + + return { + type: Syntax.VariableDeclaration, + declarations: parseVariableDeclarationList(), + kind: token.value + }; + } + + function parseForStatement() { + var init, test, update, left, right, body, oldInIteration; + + init = test = update = null; + + expectKeyword('for'); + + expect('('); + + if (match(';')) { + lex(); + } else { + if (matchKeyword('var') || matchKeyword('let')) { + state.allowIn = false; + init = parseForVariableDeclaration(); + state.allowIn = true; + + if (init.declarations.length === 1 && matchKeyword('in')) { + lex(); + left = init; + right = parseExpression(); + init = null; + } + } else { + state.allowIn = false; + init = parseExpression(); + state.allowIn = true; + + if (matchKeyword('in')) { + // LeftHandSideExpression + if (!isLeftHandSide(init)) { + throwErrorTolerant({}, Messages.InvalidLHSInForIn); + } + + lex(); + left = init; + right = parseExpression(); + init = null; + } + } + + if (typeof left === 'undefined') { + expect(';'); + } + } + + if (typeof left === 'undefined') { + + if (!match(';')) { + test = parseExpression(); + } + expect(';'); + + if (!match(')')) { + update = parseExpression(); + } + } + + expect(')'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + if (typeof left === 'undefined') { + return { + type: Syntax.ForStatement, + init: init, + test: test, + update: update, + body: body + }; + } + + return { + type: Syntax.ForInStatement, + left: left, + right: right, + body: body, + each: false + }; + } + + // 12.7 The continue statement + + function parseContinueStatement() { + var token, label = null; + + expectKeyword('continue'); + + // Optimize the most common form: 'continue;'. + if (source[index] === ';') { + lex(); + + if (!state.inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return { + type: Syntax.ContinueStatement, + label: null + }; + } + + if (peekLineTerminator()) { + if (!state.inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return { + type: Syntax.ContinueStatement, + label: null + }; + } + + token = lookahead(); + if (token.type === Token.Identifier) { + label = parseVariableIdentifier(); + + if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) { + throwError({}, Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !state.inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return { + type: Syntax.ContinueStatement, + label: label + }; + } + + // 12.8 The break statement + + function parseBreakStatement() { + var token, label = null; + + expectKeyword('break'); + + // Optimize the most common form: 'break;'. + if (source[index] === ';') { + lex(); + + if (!(state.inIteration || state.inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return { + type: Syntax.BreakStatement, + label: null + }; + } + + if (peekLineTerminator()) { + if (!(state.inIteration || state.inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return { + type: Syntax.BreakStatement, + label: null + }; + } + + token = lookahead(); + if (token.type === Token.Identifier) { + label = parseVariableIdentifier(); + + if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) { + throwError({}, Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !(state.inIteration || state.inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return { + type: Syntax.BreakStatement, + label: label + }; + } + + // 12.9 The return statement + + function parseReturnStatement() { + var token, argument = null; + + expectKeyword('return'); + + if (!state.inFunctionBody) { + throwErrorTolerant({}, Messages.IllegalReturn); + } + + // 'return' followed by a space and an identifier is very common. + if (source[index] === ' ') { + if (isIdentifierStart(source[index + 1])) { + argument = parseExpression(); + consumeSemicolon(); + return { + type: Syntax.ReturnStatement, + argument: argument + }; + } + } + + if (peekLineTerminator()) { + return { + type: Syntax.ReturnStatement, + argument: null + }; + } + + if (!match(';')) { + token = lookahead(); + if (!match('}') && token.type !== Token.EOF) { + argument = parseExpression(); + } + } + + consumeSemicolon(); + + return { + type: Syntax.ReturnStatement, + argument: argument + }; + } + + // 12.10 The with statement + + function parseWithStatement() { + var object, body; + + if (strict) { + throwErrorTolerant({}, Messages.StrictModeWith); + } + + expectKeyword('with'); + + expect('('); + + object = parseExpression(); + + expect(')'); + + body = parseStatement(); + + return { + type: Syntax.WithStatement, + object: object, + body: body + }; + } + + // 12.10 The swith statement + + function parseSwitchCase() { + var test, + consequent = [], + statement; + + if (matchKeyword('default')) { + lex(); + test = null; + } else { + expectKeyword('case'); + test = parseExpression(); + } + expect(':'); + + while (index < length) { + if (match('}') || matchKeyword('default') || matchKeyword('case')) { + break; + } + statement = parseStatement(); + if (typeof statement === 'undefined') { + break; + } + consequent.push(statement); + } + + return { + type: Syntax.SwitchCase, + test: test, + consequent: consequent + }; + } + + function parseSwitchStatement() { + var discriminant, cases, clause, oldInSwitch, defaultFound; + + expectKeyword('switch'); + + expect('('); + + discriminant = parseExpression(); + + expect(')'); + + expect('{'); + + cases = []; + + if (match('}')) { + lex(); + return { + type: Syntax.SwitchStatement, + discriminant: discriminant, + cases: cases + }; + } + + oldInSwitch = state.inSwitch; + state.inSwitch = true; + defaultFound = false; + + while (index < length) { + if (match('}')) { + break; + } + clause = parseSwitchCase(); + if (clause.test === null) { + if (defaultFound) { + throwError({}, Messages.MultipleDefaultsInSwitch); + } + defaultFound = true; + } + cases.push(clause); + } + + state.inSwitch = oldInSwitch; + + expect('}'); + + return { + type: Syntax.SwitchStatement, + discriminant: discriminant, + cases: cases + }; + } + + // 12.13 The throw statement + + function parseThrowStatement() { + var argument; + + expectKeyword('throw'); + + if (peekLineTerminator()) { + throwError({}, Messages.NewlineAfterThrow); + } + + argument = parseExpression(); + + consumeSemicolon(); + + return { + type: Syntax.ThrowStatement, + argument: argument + }; + } + + // 12.14 The try statement + + function parseCatchClause() { + var param; + + expectKeyword('catch'); + + expect('('); + if (match(')')) { + throwUnexpected(lookahead()); + } + + param = parseVariableIdentifier(); + // 12.14.1 + if (strict && isRestrictedWord(param.name)) { + throwErrorTolerant({}, Messages.StrictCatchVariable); + } + + expect(')'); + + return { + type: Syntax.CatchClause, + param: param, + body: parseBlock() + }; + } + + function parseTryStatement() { + var block, handlers = [], finalizer = null; + + expectKeyword('try'); + + block = parseBlock(); + + if (matchKeyword('catch')) { + handlers.push(parseCatchClause()); + } + + if (matchKeyword('finally')) { + lex(); + finalizer = parseBlock(); + } + + if (handlers.length === 0 && !finalizer) { + throwError({}, Messages.NoCatchOrFinally); + } + + return { + type: Syntax.TryStatement, + block: block, + guardedHandlers: [], + handlers: handlers, + finalizer: finalizer + }; + } + + // 12.15 The debugger statement + + function parseDebuggerStatement() { + expectKeyword('debugger'); + + consumeSemicolon(); + + return { + type: Syntax.DebuggerStatement + }; + } + + // 12 Statements + + function parseStatement() { + var token = lookahead(), + expr, + labeledBody; + + if (token.type === Token.EOF) { + throwUnexpected(token); + } + + if (token.type === Token.Punctuator) { + switch (token.value) { + case ';': + return parseEmptyStatement(); + case '{': + return parseBlock(); + case '(': + return parseExpressionStatement(); + default: + break; + } + } + + if (token.type === Token.Keyword) { + switch (token.value) { + case 'break': + return parseBreakStatement(); + case 'continue': + return parseContinueStatement(); + case 'debugger': + return parseDebuggerStatement(); + case 'do': + return parseDoWhileStatement(); + case 'for': + return parseForStatement(); + case 'function': + return parseFunctionDeclaration(); + case 'if': + return parseIfStatement(); + case 'return': + return parseReturnStatement(); + case 'switch': + return parseSwitchStatement(); + case 'throw': + return parseThrowStatement(); + case 'try': + return parseTryStatement(); + case 'var': + return parseVariableStatement(); + case 'while': + return parseWhileStatement(); + case 'with': + return parseWithStatement(); + default: + break; + } + } + + expr = parseExpression(); + + // 12.12 Labelled Statements + if ((expr.type === Syntax.Identifier) && match(':')) { + lex(); + + if (Object.prototype.hasOwnProperty.call(state.labelSet, expr.name)) { + throwError({}, Messages.Redeclaration, 'Label', expr.name); + } + + state.labelSet[expr.name] = true; + labeledBody = parseStatement(); + delete state.labelSet[expr.name]; + + return { + type: Syntax.LabeledStatement, + label: expr, + body: labeledBody + }; + } + + consumeSemicolon(); + + return { + type: Syntax.ExpressionStatement, + expression: expr + }; + } + + // 13 Function Definition + + function parseFunctionSourceElements() { + var sourceElement, sourceElements = [], token, directive, firstRestricted, + oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody; + + expect('{'); + + while (index < length) { + token = lookahead(); + if (token.type !== Token.StringLiteral) { + break; + } + + sourceElement = parseSourceElement(); + sourceElements.push(sourceElement); + if (sourceElement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = sliceSource(token.range[0] + 1, token.range[1] - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + oldLabelSet = state.labelSet; + oldInIteration = state.inIteration; + oldInSwitch = state.inSwitch; + oldInFunctionBody = state.inFunctionBody; + + state.labelSet = {}; + state.inIteration = false; + state.inSwitch = false; + state.inFunctionBody = true; + + while (index < length) { + if (match('}')) { + break; + } + sourceElement = parseSourceElement(); + if (typeof sourceElement === 'undefined') { + break; + } + sourceElements.push(sourceElement); + } + + expect('}'); + + state.labelSet = oldLabelSet; + state.inIteration = oldInIteration; + state.inSwitch = oldInSwitch; + state.inFunctionBody = oldInFunctionBody; + + return { + type: Syntax.BlockStatement, + body: sourceElements + }; + } + + function parseFunctionDeclaration() { + var id, param, params = [], body, token, stricted, firstRestricted, message, previousStrict, paramSet; + + expectKeyword('function'); + token = lookahead(); + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwErrorTolerant(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + + expect('('); + + if (!match(')')) { + paramSet = {}; + while (index < length) { + token = lookahead(); + param = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + stricted = token; + message = Messages.StrictParamName; + } + if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + stricted = token; + message = Messages.StrictParamDupe; + } + } else if (!firstRestricted) { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictParamName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + firstRestricted = token; + message = Messages.StrictParamDupe; + } + } + params.push(param); + paramSet[param.name] = true; + if (match(')')) { + break; + } + expect(','); + } + } + + expect(')'); + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwError(firstRestricted, message); + } + if (strict && stricted) { + throwErrorTolerant(stricted, message); + } + strict = previousStrict; + + return { + type: Syntax.FunctionDeclaration, + id: id, + params: params, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }; + } + + function parseFunctionExpression() { + var token, id = null, stricted, firstRestricted, message, param, params = [], body, previousStrict, paramSet; + + expectKeyword('function'); + + if (!match('(')) { + token = lookahead(); + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwErrorTolerant(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + + expect('('); + + if (!match(')')) { + paramSet = {}; + while (index < length) { + token = lookahead(); + param = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + stricted = token; + message = Messages.StrictParamName; + } + if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + stricted = token; + message = Messages.StrictParamDupe; + } + } else if (!firstRestricted) { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictParamName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + firstRestricted = token; + message = Messages.StrictParamDupe; + } + } + params.push(param); + paramSet[param.name] = true; + if (match(')')) { + break; + } + expect(','); + } + } + + expect(')'); + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwError(firstRestricted, message); + } + if (strict && stricted) { + throwErrorTolerant(stricted, message); + } + strict = previousStrict; + + return { + type: Syntax.FunctionExpression, + id: id, + params: params, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }; + } + + // 14 Program + + function parseSourceElement() { + var token = lookahead(); + + if (token.type === Token.Keyword) { + switch (token.value) { + case 'const': + case 'let': + return parseConstLetDeclaration(token.value); + case 'function': + return parseFunctionDeclaration(); + default: + return parseStatement(); + } + } + + if (token.type !== Token.EOF) { + return parseStatement(); + } + } + + function parseSourceElements() { + var sourceElement, sourceElements = [], token, directive, firstRestricted; + + while (index < length) { + token = lookahead(); + if (token.type !== Token.StringLiteral) { + break; + } + + sourceElement = parseSourceElement(); + sourceElements.push(sourceElement); + if (sourceElement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = sliceSource(token.range[0] + 1, token.range[1] - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + while (index < length) { + sourceElement = parseSourceElement(); + if (typeof sourceElement === 'undefined') { + break; + } + sourceElements.push(sourceElement); + } + return sourceElements; + } + + function parseProgram() { + var program; + strict = false; + program = { + type: Syntax.Program, + body: parseSourceElements() + }; + return program; + } + + // The following functions are needed only when the option to preserve + // the comments is active. + + function addComment(type, value, start, end, loc) { + assert(typeof start === 'number', 'Comment must have valid position'); + + // Because the way the actual token is scanned, often the comments + // (if any) are skipped twice during the lexical analysis. + // Thus, we need to skip adding a comment if the comment array already + // handled it. + if (extra.comments.length > 0) { + if (extra.comments[extra.comments.length - 1].range[1] > start) { + return; + } + } + + extra.comments.push({ + type: type, + value: value, + range: [start, end], + loc: loc + }); + } + + function scanComment() { + var comment, ch, loc, start, blockComment, lineComment; + + comment = ''; + blockComment = false; + lineComment = false; + + while (index < length) { + ch = source[index]; + + if (lineComment) { + ch = source[index++]; + if (isLineTerminator(ch)) { + loc.end = { + line: lineNumber, + column: index - lineStart - 1 + }; + lineComment = false; + addComment('Line', comment, start, index - 1, loc); + if (ch === '\r' && source[index] === '\n') { + ++index; + } + ++lineNumber; + lineStart = index; + comment = ''; + } else if (index >= length) { + lineComment = false; + comment += ch; + loc.end = { + line: lineNumber, + column: length - lineStart + }; + addComment('Line', comment, start, length, loc); + } else { + comment += ch; + } + } else if (blockComment) { + if (isLineTerminator(ch)) { + if (ch === '\r' && source[index + 1] === '\n') { + ++index; + comment += '\r\n'; + } else { + comment += ch; + } + ++lineNumber; + ++index; + lineStart = index; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + ch = source[index++]; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + comment += ch; + if (ch === '*') { + ch = source[index]; + if (ch === '/') { + comment = comment.substr(0, comment.length - 1); + blockComment = false; + ++index; + loc.end = { + line: lineNumber, + column: index - lineStart + }; + addComment('Block', comment, start, index, loc); + comment = ''; + } + } + } + } else if (ch === '/') { + ch = source[index + 1]; + if (ch === '/') { + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + start = index; + index += 2; + lineComment = true; + if (index >= length) { + loc.end = { + line: lineNumber, + column: index - lineStart + }; + lineComment = false; + addComment('Line', comment, start, index, loc); + } + } else if (ch === '*') { + start = index; + index += 2; + blockComment = true; + loc = { + start: { + line: lineNumber, + column: index - lineStart - 2 + } + }; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + break; + } + } else if (isWhiteSpace(ch)) { + ++index; + } else if (isLineTerminator(ch)) { + ++index; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + ++lineNumber; + lineStart = index; + } else { + break; + } + } + } + + function filterCommentLocation() { + var i, entry, comment, comments = []; + + for (i = 0; i < extra.comments.length; ++i) { + entry = extra.comments[i]; + comment = { + type: entry.type, + value: entry.value + }; + if (extra.range) { + comment.range = entry.range; + } + if (extra.loc) { + comment.loc = entry.loc; + } + comments.push(comment); + } + + extra.comments = comments; + } + + function collectToken() { + var start, loc, token, range, value; + + skipComment(); + start = index; + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + token = extra.advance(); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + + if (token.type !== Token.EOF) { + range = [token.range[0], token.range[1]]; + value = sliceSource(token.range[0], token.range[1]); + extra.tokens.push({ + type: TokenName[token.type], + value: value, + range: range, + loc: loc + }); + } + + return token; + } + + function collectRegex() { + var pos, loc, regex, token; + + skipComment(); + + pos = index; + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + regex = extra.scanRegExp(); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + + // Pop the previous token, which is likely '/' or '/=' + if (extra.tokens.length > 0) { + token = extra.tokens[extra.tokens.length - 1]; + if (token.range[0] === pos && token.type === 'Punctuator') { + if (token.value === '/' || token.value === '/=') { + extra.tokens.pop(); + } + } + } + + extra.tokens.push({ + type: 'RegularExpression', + value: regex.literal, + range: [pos, index], + loc: loc + }); + + return regex; + } + + function filterTokenLocation() { + var i, entry, token, tokens = []; + + for (i = 0; i < extra.tokens.length; ++i) { + entry = extra.tokens[i]; + token = { + type: entry.type, + value: entry.value + }; + if (extra.range) { + token.range = entry.range; + } + if (extra.loc) { + token.loc = entry.loc; + } + tokens.push(token); + } + + extra.tokens = tokens; + } + + function createLiteral(token) { + return { + type: Syntax.Literal, + value: token.value + }; + } + + function createRawLiteral(token) { + return { + type: Syntax.Literal, + value: token.value, + raw: sliceSource(token.range[0], token.range[1]) + }; + } + + function createLocationMarker() { + var marker = {}; + + marker.range = [index, index]; + marker.loc = { + start: { + line: lineNumber, + column: index - lineStart + }, + end: { + line: lineNumber, + column: index - lineStart + } + }; + + marker.end = function () { + this.range[1] = index; + this.loc.end.line = lineNumber; + this.loc.end.column = index - lineStart; + }; + + marker.applyGroup = function (node) { + if (extra.range) { + node.groupRange = [this.range[0], this.range[1]]; + } + if (extra.loc) { + node.groupLoc = { + start: { + line: this.loc.start.line, + column: this.loc.start.column + }, + end: { + line: this.loc.end.line, + column: this.loc.end.column + } + }; + } + }; + + marker.apply = function (node) { + if (extra.range) { + node.range = [this.range[0], this.range[1]]; + } + if (extra.loc) { + node.loc = { + start: { + line: this.loc.start.line, + column: this.loc.start.column + }, + end: { + line: this.loc.end.line, + column: this.loc.end.column + } + }; + } + }; + + return marker; + } + + function trackGroupExpression() { + var marker, expr; + + skipComment(); + marker = createLocationMarker(); + expect('('); + + expr = parseExpression(); + + expect(')'); + + marker.end(); + marker.applyGroup(expr); + + return expr; + } + + function trackLeftHandSideExpression() { + var marker, expr; + + skipComment(); + marker = createLocationMarker(); + + expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression(); + + while (match('.') || match('[')) { + if (match('[')) { + expr = { + type: Syntax.MemberExpression, + computed: true, + object: expr, + property: parseComputedMember() + }; + marker.end(); + marker.apply(expr); + } else { + expr = { + type: Syntax.MemberExpression, + computed: false, + object: expr, + property: parseNonComputedMember() + }; + marker.end(); + marker.apply(expr); + } + } + + return expr; + } + + function trackLeftHandSideExpressionAllowCall() { + var marker, expr; + + skipComment(); + marker = createLocationMarker(); + + expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression(); + + while (match('.') || match('[') || match('(')) { + if (match('(')) { + expr = { + type: Syntax.CallExpression, + callee: expr, + 'arguments': parseArguments() + }; + marker.end(); + marker.apply(expr); + } else if (match('[')) { + expr = { + type: Syntax.MemberExpression, + computed: true, + object: expr, + property: parseComputedMember() + }; + marker.end(); + marker.apply(expr); + } else { + expr = { + type: Syntax.MemberExpression, + computed: false, + object: expr, + property: parseNonComputedMember() + }; + marker.end(); + marker.apply(expr); + } + } + + return expr; + } + + function filterGroup(node) { + var n, i, entry; + + n = (Object.prototype.toString.apply(node) === '[object Array]') ? [] : {}; + for (i in node) { + if (node.hasOwnProperty(i) && i !== 'groupRange' && i !== 'groupLoc') { + entry = node[i]; + if (entry === null || typeof entry !== 'object' || entry instanceof RegExp) { + n[i] = entry; + } else { + n[i] = filterGroup(entry); + } + } + } + return n; + } + + function wrapTrackingFunction(range, loc) { + + return function (parseFunction) { + + function isBinary(node) { + return node.type === Syntax.LogicalExpression || + node.type === Syntax.BinaryExpression; + } + + function visit(node) { + var start, end; + + if (isBinary(node.left)) { + visit(node.left); + } + if (isBinary(node.right)) { + visit(node.right); + } + + if (range) { + if (node.left.groupRange || node.right.groupRange) { + start = node.left.groupRange ? node.left.groupRange[0] : node.left.range[0]; + end = node.right.groupRange ? node.right.groupRange[1] : node.right.range[1]; + node.range = [start, end]; + } else if (typeof node.range === 'undefined') { + start = node.left.range[0]; + end = node.right.range[1]; + node.range = [start, end]; + } + } + if (loc) { + if (node.left.groupLoc || node.right.groupLoc) { + start = node.left.groupLoc ? node.left.groupLoc.start : node.left.loc.start; + end = node.right.groupLoc ? node.right.groupLoc.end : node.right.loc.end; + node.loc = { + start: start, + end: end + }; + } else if (typeof node.loc === 'undefined') { + node.loc = { + start: node.left.loc.start, + end: node.right.loc.end + }; + } + } + } + + return function () { + var marker, node; + + skipComment(); + + marker = createLocationMarker(); + node = parseFunction.apply(null, arguments); + marker.end(); + + if (range && typeof node.range === 'undefined') { + marker.apply(node); + } + + if (loc && typeof node.loc === 'undefined') { + marker.apply(node); + } + + if (isBinary(node)) { + visit(node); + } + + return node; + }; + }; + } + + function patch() { + + var wrapTracking; + + if (extra.comments) { + extra.skipComment = skipComment; + skipComment = scanComment; + } + + if (extra.raw) { + extra.createLiteral = createLiteral; + createLiteral = createRawLiteral; + } + + if (extra.range || extra.loc) { + + extra.parseGroupExpression = parseGroupExpression; + extra.parseLeftHandSideExpression = parseLeftHandSideExpression; + extra.parseLeftHandSideExpressionAllowCall = parseLeftHandSideExpressionAllowCall; + parseGroupExpression = trackGroupExpression; + parseLeftHandSideExpression = trackLeftHandSideExpression; + parseLeftHandSideExpressionAllowCall = trackLeftHandSideExpressionAllowCall; + + wrapTracking = wrapTrackingFunction(extra.range, extra.loc); + + extra.parseAdditiveExpression = parseAdditiveExpression; + extra.parseAssignmentExpression = parseAssignmentExpression; + extra.parseBitwiseANDExpression = parseBitwiseANDExpression; + extra.parseBitwiseORExpression = parseBitwiseORExpression; + extra.parseBitwiseXORExpression = parseBitwiseXORExpression; + extra.parseBlock = parseBlock; + extra.parseFunctionSourceElements = parseFunctionSourceElements; + extra.parseCatchClause = parseCatchClause; + extra.parseComputedMember = parseComputedMember; + extra.parseConditionalExpression = parseConditionalExpression; + extra.parseConstLetDeclaration = parseConstLetDeclaration; + extra.parseEqualityExpression = parseEqualityExpression; + extra.parseExpression = parseExpression; + extra.parseForVariableDeclaration = parseForVariableDeclaration; + extra.parseFunctionDeclaration = parseFunctionDeclaration; + extra.parseFunctionExpression = parseFunctionExpression; + extra.parseLogicalANDExpression = parseLogicalANDExpression; + extra.parseLogicalORExpression = parseLogicalORExpression; + extra.parseMultiplicativeExpression = parseMultiplicativeExpression; + extra.parseNewExpression = parseNewExpression; + extra.parseNonComputedProperty = parseNonComputedProperty; + extra.parseObjectProperty = parseObjectProperty; + extra.parseObjectPropertyKey = parseObjectPropertyKey; + extra.parsePostfixExpression = parsePostfixExpression; + extra.parsePrimaryExpression = parsePrimaryExpression; + extra.parseProgram = parseProgram; + extra.parsePropertyFunction = parsePropertyFunction; + extra.parseRelationalExpression = parseRelationalExpression; + extra.parseStatement = parseStatement; + extra.parseShiftExpression = parseShiftExpression; + extra.parseSwitchCase = parseSwitchCase; + extra.parseUnaryExpression = parseUnaryExpression; + extra.parseVariableDeclaration = parseVariableDeclaration; + extra.parseVariableIdentifier = parseVariableIdentifier; + + parseAdditiveExpression = wrapTracking(extra.parseAdditiveExpression); + parseAssignmentExpression = wrapTracking(extra.parseAssignmentExpression); + parseBitwiseANDExpression = wrapTracking(extra.parseBitwiseANDExpression); + parseBitwiseORExpression = wrapTracking(extra.parseBitwiseORExpression); + parseBitwiseXORExpression = wrapTracking(extra.parseBitwiseXORExpression); + parseBlock = wrapTracking(extra.parseBlock); + parseFunctionSourceElements = wrapTracking(extra.parseFunctionSourceElements); + parseCatchClause = wrapTracking(extra.parseCatchClause); + parseComputedMember = wrapTracking(extra.parseComputedMember); + parseConditionalExpression = wrapTracking(extra.parseConditionalExpression); + parseConstLetDeclaration = wrapTracking(extra.parseConstLetDeclaration); + parseEqualityExpression = wrapTracking(extra.parseEqualityExpression); + parseExpression = wrapTracking(extra.parseExpression); + parseForVariableDeclaration = wrapTracking(extra.parseForVariableDeclaration); + parseFunctionDeclaration = wrapTracking(extra.parseFunctionDeclaration); + parseFunctionExpression = wrapTracking(extra.parseFunctionExpression); + parseLeftHandSideExpression = wrapTracking(parseLeftHandSideExpression); + parseLogicalANDExpression = wrapTracking(extra.parseLogicalANDExpression); + parseLogicalORExpression = wrapTracking(extra.parseLogicalORExpression); + parseMultiplicativeExpression = wrapTracking(extra.parseMultiplicativeExpression); + parseNewExpression = wrapTracking(extra.parseNewExpression); + parseNonComputedProperty = wrapTracking(extra.parseNonComputedProperty); + parseObjectProperty = wrapTracking(extra.parseObjectProperty); + parseObjectPropertyKey = wrapTracking(extra.parseObjectPropertyKey); + parsePostfixExpression = wrapTracking(extra.parsePostfixExpression); + parsePrimaryExpression = wrapTracking(extra.parsePrimaryExpression); + parseProgram = wrapTracking(extra.parseProgram); + parsePropertyFunction = wrapTracking(extra.parsePropertyFunction); + parseRelationalExpression = wrapTracking(extra.parseRelationalExpression); + parseStatement = wrapTracking(extra.parseStatement); + parseShiftExpression = wrapTracking(extra.parseShiftExpression); + parseSwitchCase = wrapTracking(extra.parseSwitchCase); + parseUnaryExpression = wrapTracking(extra.parseUnaryExpression); + parseVariableDeclaration = wrapTracking(extra.parseVariableDeclaration); + parseVariableIdentifier = wrapTracking(extra.parseVariableIdentifier); + } + + if (typeof extra.tokens !== 'undefined') { + extra.advance = advance; + extra.scanRegExp = scanRegExp; + + advance = collectToken; + scanRegExp = collectRegex; + } + } + + function unpatch() { + if (typeof extra.skipComment === 'function') { + skipComment = extra.skipComment; + } + + if (extra.raw) { + createLiteral = extra.createLiteral; + } + + if (extra.range || extra.loc) { + parseAdditiveExpression = extra.parseAdditiveExpression; + parseAssignmentExpression = extra.parseAssignmentExpression; + parseBitwiseANDExpression = extra.parseBitwiseANDExpression; + parseBitwiseORExpression = extra.parseBitwiseORExpression; + parseBitwiseXORExpression = extra.parseBitwiseXORExpression; + parseBlock = extra.parseBlock; + parseFunctionSourceElements = extra.parseFunctionSourceElements; + parseCatchClause = extra.parseCatchClause; + parseComputedMember = extra.parseComputedMember; + parseConditionalExpression = extra.parseConditionalExpression; + parseConstLetDeclaration = extra.parseConstLetDeclaration; + parseEqualityExpression = extra.parseEqualityExpression; + parseExpression = extra.parseExpression; + parseForVariableDeclaration = extra.parseForVariableDeclaration; + parseFunctionDeclaration = extra.parseFunctionDeclaration; + parseFunctionExpression = extra.parseFunctionExpression; + parseGroupExpression = extra.parseGroupExpression; + parseLeftHandSideExpression = extra.parseLeftHandSideExpression; + parseLeftHandSideExpressionAllowCall = extra.parseLeftHandSideExpressionAllowCall; + parseLogicalANDExpression = extra.parseLogicalANDExpression; + parseLogicalORExpression = extra.parseLogicalORExpression; + parseMultiplicativeExpression = extra.parseMultiplicativeExpression; + parseNewExpression = extra.parseNewExpression; + parseNonComputedProperty = extra.parseNonComputedProperty; + parseObjectProperty = extra.parseObjectProperty; + parseObjectPropertyKey = extra.parseObjectPropertyKey; + parsePrimaryExpression = extra.parsePrimaryExpression; + parsePostfixExpression = extra.parsePostfixExpression; + parseProgram = extra.parseProgram; + parsePropertyFunction = extra.parsePropertyFunction; + parseRelationalExpression = extra.parseRelationalExpression; + parseStatement = extra.parseStatement; + parseShiftExpression = extra.parseShiftExpression; + parseSwitchCase = extra.parseSwitchCase; + parseUnaryExpression = extra.parseUnaryExpression; + parseVariableDeclaration = extra.parseVariableDeclaration; + parseVariableIdentifier = extra.parseVariableIdentifier; + } + + if (typeof extra.scanRegExp === 'function') { + advance = extra.advance; + scanRegExp = extra.scanRegExp; + } + } + + function stringToArray(str) { + var length = str.length, + result = [], + i; + for (i = 0; i < length; ++i) { + result[i] = str.charAt(i); + } + return result; + } + + function parse(code, options) { + var program, toString; + + toString = String; + if (typeof code !== 'string' && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + length = source.length; + buffer = null; + state = { + allowIn: true, + labelSet: {}, + inFunctionBody: false, + inIteration: false, + inSwitch: false + }; + + extra = {}; + if (typeof options !== 'undefined') { + extra.range = (typeof options.range === 'boolean') && options.range; + extra.loc = (typeof options.loc === 'boolean') && options.loc; + extra.raw = (typeof options.raw === 'boolean') && options.raw; + if (typeof options.tokens === 'boolean' && options.tokens) { + extra.tokens = []; + } + if (typeof options.comment === 'boolean' && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === 'boolean' && options.tolerant) { + extra.errors = []; + } + } + + if (length > 0) { + if (typeof source[0] === 'undefined') { + // Try first to convert to a string. This is good as fast path + // for old IE which understands string indexing for string + // literals only and not for string object. + if (code instanceof String) { + source = code.valueOf(); + } + + // Force accessing the characters via an array. + if (typeof source[0] === 'undefined') { + source = stringToArray(code); + } + } + } + + patch(); + try { + program = parseProgram(); + if (typeof extra.comments !== 'undefined') { + filterCommentLocation(); + program.comments = extra.comments; + } + if (typeof extra.tokens !== 'undefined') { + filterTokenLocation(); + program.tokens = extra.tokens; + } + if (typeof extra.errors !== 'undefined') { + program.errors = extra.errors; + } + if (extra.range || extra.loc) { + program.body = filterGroup(program.body); + } + } catch (e) { + throw e; + } finally { + unpatch(); + extra = {}; + } + + return program; + } + + // Sync with package.json. + exports.version = '1.0.4'; + + exports.parse = parse; + + // Deep copy. + exports.Syntax = (function () { + var name, types = {}; + + if (typeof Object.create === 'function') { + types = Object.create(null); + } + + for (name in Syntax) { + if (Syntax.hasOwnProperty(name)) { + types[name] = Syntax[name]; + } + } + + if (typeof Object.freeze === 'function') { + Object.freeze(types); + } + + return types; + }()); + +})); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/package.json new file mode 100644 index 00000000..5e594e0c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/package.json @@ -0,0 +1,69 @@ +{ + "name": "esprima", + "description": "ECMAScript parsing infrastructure for multipurpose analysis", + "homepage": "http://esprima.org", + "main": "esprima.js", + "bin": { + "esparse": "./bin/esparse.js", + "esvalidate": "./bin/esvalidate.js" + }, + "files": [ + "bin", + "test/run.js", + "test/runner.js", + "test/test.js", + "test/compat.js", + "test/reflect.js", + "esprima.js" + ], + "version": "1.0.4", + "engines": { + "node": ">=0.4.0" + }, + "maintainers": [ + { + "name": "ariya", + "email": "ariya.hidayat@gmail.com" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/ariya/esprima.git" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/ariya/esprima/raw/master/LICENSE.BSD" + } + ], + "keywords": [ + "ast", + "ecmascript", + "javascript", + "parser", + "syntax" + ], + "scripts": { + "test": "node test/run.js", + "benchmark": "node test/benchmarks.js", + "benchmark-quick": "node test/benchmarks.js quick" + }, + "_id": "esprima@1.0.4", + "dist": { + "shasum": "9f557e08fc3b4d26ece9dd34f8fbf476b62585ad", + "tarball": "http://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz" + }, + "_npmVersion": "1.1.61", + "_npmUser": { + "name": "ariya", + "email": "ariya.hidayat@gmail.com" + }, + "directories": {}, + "_shasum": "9f557e08fc3b4d26ece9dd34f8fbf476b62585ad", + "_resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", + "_from": "esprima@>=1.0.0 <1.1.0", + "bugs": { + "url": "https://github.com/ariya/esprima/issues" + }, + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/compat.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/compat.js new file mode 100644 index 00000000..ee3a6295 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/compat.js @@ -0,0 +1,239 @@ +/* + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint node: true */ +/*global document: true, window:true, esprima: true, testReflect: true */ + +var runTests; + +function getContext(esprima, reportCase, reportFailure) { + 'use strict'; + + var Reflect, Pattern; + + // Maps Mozilla Reflect object to our Esprima parser. + Reflect = { + parse: function (code) { + var result; + + reportCase(code); + + try { + result = esprima.parse(code); + } catch (error) { + result = error; + } + + return result; + } + }; + + // This is used by Reflect test suite to match a syntax tree. + Pattern = function (obj) { + var pattern; + + // Poor man's deep object cloning. + pattern = JSON.parse(JSON.stringify(obj)); + + // Special handling for regular expression literal since we need to + // convert it to a string literal, otherwise it will be decoded + // as object "{}" and the regular expression would be lost. + if (obj.type && obj.type === 'Literal') { + if (obj.value instanceof RegExp) { + pattern = { + type: obj.type, + value: obj.value.toString() + }; + } + } + + // Special handling for branch statement because SpiderMonkey + // prefers to put the 'alternate' property before 'consequent'. + if (obj.type && obj.type === 'IfStatement') { + pattern = { + type: pattern.type, + test: pattern.test, + consequent: pattern.consequent, + alternate: pattern.alternate + }; + } + + // Special handling for do while statement because SpiderMonkey + // prefers to put the 'test' property before 'body'. + if (obj.type && obj.type === 'DoWhileStatement') { + pattern = { + type: pattern.type, + body: pattern.body, + test: pattern.test + }; + } + + function adjustRegexLiteralAndRaw(key, value) { + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } else if (key === 'raw' && typeof value === "string") { + // Ignore Esprima-specific 'raw' property. + return undefined; + } + return value; + } + + if (obj.type && (obj.type === 'Program')) { + pattern.assert = function (tree) { + var actual, expected; + actual = JSON.stringify(tree, adjustRegexLiteralAndRaw, 4); + expected = JSON.stringify(obj, null, 4); + + if (expected !== actual) { + reportFailure(expected, actual); + } + }; + } + + return pattern; + }; + + return { + Reflect: Reflect, + Pattern: Pattern + }; +} + +if (typeof window !== 'undefined') { + // Run all tests in a browser environment. + runTests = function () { + 'use strict'; + + var total = 0, + failures = 0; + + function setText(el, str) { + if (typeof el.innerText === 'string') { + el.innerText = str; + } else { + el.textContent = str; + } + } + + function reportCase(code) { + var report, e; + report = document.getElementById('report'); + e = document.createElement('pre'); + e.setAttribute('class', 'code'); + setText(e, code); + report.appendChild(e); + total += 1; + } + + function reportFailure(expected, actual) { + var report, e; + + failures += 1; + + report = document.getElementById('report'); + + e = document.createElement('p'); + setText(e, 'Expected'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'expected'); + setText(e, expected); + report.appendChild(e); + + e = document.createElement('p'); + setText(e, 'Actual'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'actual'); + setText(e, actual); + report.appendChild(e); + } + + setText(document.getElementById('version'), esprima.version); + + window.setTimeout(function () { + var tick, context = getContext(esprima, reportCase, reportFailure); + + tick = new Date(); + testReflect(context.Reflect, context.Pattern); + tick = (new Date()) - tick; + + if (failures > 0) { + setText(document.getElementById('status'), total + ' tests. ' + + 'Failures: ' + failures + '. ' + tick + ' ms'); + } else { + setText(document.getElementById('status'), total + ' tests. ' + + 'No failure. ' + tick + ' ms'); + } + }, 513); + }; +} else { + (function (global) { + 'use strict'; + var esprima = require('../esprima'), + tick, + total = 0, + failures = [], + header, + current, + context; + + function reportCase(code) { + total += 1; + current = code; + } + + function reportFailure(expected, actual) { + failures.push({ + source: current, + expected: expected.toString(), + actual: actual.toString() + }); + } + + context = getContext(esprima, reportCase, reportFailure); + + tick = new Date(); + require('./reflect').testReflect(context.Reflect, context.Pattern); + tick = (new Date()) - tick; + + header = total + ' tests. ' + failures.length + ' failures. ' + + tick + ' ms'; + if (failures.length) { + console.error(header); + failures.forEach(function (failure) { + console.error(failure.source + ': Expected\n ' + + failure.expected.split('\n').join('\n ') + + '\nto match\n ' + failure.actual); + }); + } else { + console.log(header); + } + process.exit(failures.length === 0 ? 0 : 1); + }(this)); +} +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/reflect.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/reflect.js new file mode 100644 index 00000000..dba1ba8f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/reflect.js @@ -0,0 +1,422 @@ +// This is modified from Mozilla Reflect.parse test suite (the file is located +// at js/src/tests/js1_8_5/extensions/reflect-parse.js in the source tree). +// +// Some notable changes: +// * Removed unsupported features (destructuring, let, comprehensions...). +// * Removed tests for E4X (ECMAScript for XML). +// * Removed everything related to builder. +// * Enclosed every 'Pattern' construct with a scope. +// * Tweaked some expected tree to remove generator field. +// * Removed the test for bug 632030 and bug 632024. + +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +(function (exports) { + +function testReflect(Reflect, Pattern) { + +function program(elts) { return Pattern({ type: "Program", body: elts }) } +function exprStmt(expr) { return Pattern({ type: "ExpressionStatement", expression: expr }) } +function throwStmt(expr) { return Pattern({ type: "ThrowStatement", argument: expr }) } +function returnStmt(expr) { return Pattern({ type: "ReturnStatement", argument: expr }) } +function yieldExpr(expr) { return Pattern({ type: "YieldExpression", argument: expr }) } +function lit(val) { return Pattern({ type: "Literal", value: val }) } +var thisExpr = Pattern({ type: "ThisExpression" }); +function funDecl(id, params, body) { return Pattern({ type: "FunctionDeclaration", + id: id, + params: params, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }) } +function genFunDecl(id, params, body) { return Pattern({ type: "FunctionDeclaration", + id: id, + params: params, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }) } +function declarator(id, init) { return Pattern({ type: "VariableDeclarator", id: id, init: init }) } +function varDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "var" }) } +function letDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "let" }) } +function constDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "const" }) } +function ident(name) { return Pattern({ type: "Identifier", name: name }) } +function dotExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: false, object: obj, property: id }) } +function memExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: true, object: obj, property: id }) } +function forStmt(init, test, update, body) { return Pattern({ type: "ForStatement", init: init, test: test, update: update, body: body }) } +function forInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: false }) } +function forEachInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: true }) } +function breakStmt(lab) { return Pattern({ type: "BreakStatement", label: lab }) } +function continueStmt(lab) { return Pattern({ type: "ContinueStatement", label: lab }) } +function blockStmt(body) { return Pattern({ type: "BlockStatement", body: body }) } +var emptyStmt = Pattern({ type: "EmptyStatement" }); +function ifStmt(test, cons, alt) { return Pattern({ type: "IfStatement", test: test, alternate: alt, consequent: cons }) } +function labStmt(lab, stmt) { return Pattern({ type: "LabeledStatement", label: lab, body: stmt }) } +function withStmt(obj, stmt) { return Pattern({ type: "WithStatement", object: obj, body: stmt }) } +function whileStmt(test, stmt) { return Pattern({ type: "WhileStatement", test: test, body: stmt }) } +function doStmt(stmt, test) { return Pattern({ type: "DoWhileStatement", test: test, body: stmt }) } +function switchStmt(disc, cases) { return Pattern({ type: "SwitchStatement", discriminant: disc, cases: cases }) } +function caseClause(test, stmts) { return Pattern({ type: "SwitchCase", test: test, consequent: stmts }) } +function defaultClause(stmts) { return Pattern({ type: "SwitchCase", test: null, consequent: stmts }) } +function catchClause(id, guard, body) { if (guard) { return Pattern({ type: "GuardedCatchClause", param: id, guard: guard, body: body }) } else { return Pattern({ type: "CatchClause", param: id, body: body }) } } +function tryStmt(body, guarded, catches, fin) { return Pattern({ type: "TryStatement", block: body, guardedHandlers: guarded, handlers: catches, finalizer: fin }) } +function letStmt(head, body) { return Pattern({ type: "LetStatement", head: head, body: body }) } +function funExpr(id, args, body, gen) { return Pattern({ type: "FunctionExpression", + id: id, + params: args, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }) } +function genFunExpr(id, args, body) { return Pattern({ type: "FunctionExpression", + id: id, + params: args, + defaults: [], + body: body, + rest: null, + generator: false, + expression: false + }) } + +function unExpr(op, arg) { return Pattern({ type: "UnaryExpression", operator: op, argument: arg, prefix: true }) } +function binExpr(op, left, right) { return Pattern({ type: "BinaryExpression", operator: op, left: left, right: right }) } +function aExpr(op, left, right) { return Pattern({ type: "AssignmentExpression", operator: op, left: left, right: right }) } +function updExpr(op, arg, prefix) { return Pattern({ type: "UpdateExpression", operator: op, argument: arg, prefix: prefix }) } +function logExpr(op, left, right) { return Pattern({ type: "LogicalExpression", operator: op, left: left, right: right }) } + +function condExpr(test, cons, alt) { return Pattern({ type: "ConditionalExpression", test: test, consequent: cons, alternate: alt }) } +function seqExpr(exprs) { return Pattern({ type: "SequenceExpression", expressions: exprs }) } +function newExpr(callee, args) { return Pattern({ type: "NewExpression", callee: callee, arguments: args }) } +function callExpr(callee, args) { return Pattern({ type: "CallExpression", callee: callee, arguments: args }) } +function arrExpr(elts) { return Pattern({ type: "ArrayExpression", elements: elts }) } +function objExpr(elts) { return Pattern({ type: "ObjectExpression", properties: elts }) } +function objProp(key, value, kind) { return Pattern({ type: "Property", key: key, value: value, kind: kind }) } + +function arrPatt(elts) { return Pattern({ type: "ArrayPattern", elements: elts }) } +function objPatt(elts) { return Pattern({ type: "ObjectPattern", properties: elts }) } + +function localSrc(src) { return "(function(){ " + src + " })" } +function localPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([patt])))]) } +function blockSrc(src) { return "(function(){ { " + src + " } })" } +function blockPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([blockStmt([patt])])))]) } + +function assertBlockStmt(src, patt) { + blockPatt(patt).assert(Reflect.parse(blockSrc(src))); +} + +function assertBlockExpr(src, patt) { + assertBlockStmt(src, exprStmt(patt)); +} + +function assertBlockDecl(src, patt, builder) { + blockPatt(patt).assert(Reflect.parse(blockSrc(src), {builder: builder})); +} + +function assertLocalStmt(src, patt) { + localPatt(patt).assert(Reflect.parse(localSrc(src))); +} + +function assertLocalExpr(src, patt) { + assertLocalStmt(src, exprStmt(patt)); +} + +function assertLocalDecl(src, patt) { + localPatt(patt).assert(Reflect.parse(localSrc(src))); +} + +function assertGlobalStmt(src, patt, builder) { + program([patt]).assert(Reflect.parse(src, {builder: builder})); +} + +function assertGlobalExpr(src, patt, builder) { + program([exprStmt(patt)]).assert(Reflect.parse(src, {builder: builder})); + //assertStmt(src, exprStmt(patt)); +} + +function assertGlobalDecl(src, patt) { + program([patt]).assert(Reflect.parse(src)); +} + +function assertProg(src, patt) { + program(patt).assert(Reflect.parse(src)); +} + +function assertStmt(src, patt) { + assertLocalStmt(src, patt); + assertGlobalStmt(src, patt); + assertBlockStmt(src, patt); +} + +function assertExpr(src, patt) { + assertLocalExpr(src, patt); + assertGlobalExpr(src, patt); + assertBlockExpr(src, patt); +} + +function assertDecl(src, patt) { + assertLocalDecl(src, patt); + assertGlobalDecl(src, patt); + assertBlockDecl(src, patt); +} + +function assertError(src, errorType) { + try { + Reflect.parse(src); + } catch (e) { + return; + } + throw new Error("expected " + errorType.name + " for " + uneval(src)); +} + + +// general tests + +// NB: These are useful but for now jit-test doesn't do I/O reliably. + +//program(_).assert(Reflect.parse(snarf('data/flapjax.txt'))); +//program(_).assert(Reflect.parse(snarf('data/jquery-1.4.2.txt'))); +//program(_).assert(Reflect.parse(snarf('data/prototype.js'))); +//program(_).assert(Reflect.parse(snarf('data/dojo.js.uncompressed.js'))); +//program(_).assert(Reflect.parse(snarf('data/mootools-1.2.4-core-nc.js'))); + + +// declarations + +assertDecl("var x = 1, y = 2, z = 3", + varDecl([declarator(ident("x"), lit(1)), + declarator(ident("y"), lit(2)), + declarator(ident("z"), lit(3))])); +assertDecl("var x, y, z", + varDecl([declarator(ident("x"), null), + declarator(ident("y"), null), + declarator(ident("z"), null)])); +assertDecl("function foo() { }", + funDecl(ident("foo"), [], blockStmt([]))); +assertDecl("function foo() { return 42 }", + funDecl(ident("foo"), [], blockStmt([returnStmt(lit(42))]))); + + +// Bug 591437: rebound args have their defs turned into uses +assertDecl("function f(a) { function a() { } }", + funDecl(ident("f"), [ident("a")], blockStmt([funDecl(ident("a"), [], blockStmt([]))]))); +assertDecl("function f(a,b,c) { function b() { } }", + funDecl(ident("f"), [ident("a"),ident("b"),ident("c")], blockStmt([funDecl(ident("b"), [], blockStmt([]))]))); + +// expressions + +assertExpr("true", lit(true)); +assertExpr("false", lit(false)); +assertExpr("42", lit(42)); +assertExpr("(/asdf/)", lit(/asdf/)); +assertExpr("this", thisExpr); +assertExpr("foo", ident("foo")); +assertExpr("foo.bar", dotExpr(ident("foo"), ident("bar"))); +assertExpr("foo[bar]", memExpr(ident("foo"), ident("bar"))); +assertExpr("(function(){})", funExpr(null, [], blockStmt([]))); +assertExpr("(function f() {})", funExpr(ident("f"), [], blockStmt([]))); +assertExpr("(function f(x,y,z) {})", funExpr(ident("f"), [ident("x"),ident("y"),ident("z")], blockStmt([]))); +assertExpr("(++x)", updExpr("++", ident("x"), true)); +assertExpr("(x++)", updExpr("++", ident("x"), false)); +assertExpr("(+x)", unExpr("+", ident("x"))); +assertExpr("(-x)", unExpr("-", ident("x"))); +assertExpr("(!x)", unExpr("!", ident("x"))); +assertExpr("(~x)", unExpr("~", ident("x"))); +assertExpr("(delete x)", unExpr("delete", ident("x"))); +assertExpr("(typeof x)", unExpr("typeof", ident("x"))); +assertExpr("(void x)", unExpr("void", ident("x"))); +assertExpr("(x == y)", binExpr("==", ident("x"), ident("y"))); +assertExpr("(x != y)", binExpr("!=", ident("x"), ident("y"))); +assertExpr("(x === y)", binExpr("===", ident("x"), ident("y"))); +assertExpr("(x !== y)", binExpr("!==", ident("x"), ident("y"))); +assertExpr("(x < y)", binExpr("<", ident("x"), ident("y"))); +assertExpr("(x <= y)", binExpr("<=", ident("x"), ident("y"))); +assertExpr("(x > y)", binExpr(">", ident("x"), ident("y"))); +assertExpr("(x >= y)", binExpr(">=", ident("x"), ident("y"))); +assertExpr("(x << y)", binExpr("<<", ident("x"), ident("y"))); +assertExpr("(x >> y)", binExpr(">>", ident("x"), ident("y"))); +assertExpr("(x >>> y)", binExpr(">>>", ident("x"), ident("y"))); +assertExpr("(x + y)", binExpr("+", ident("x"), ident("y"))); +assertExpr("(w + x + y + z)", binExpr("+", binExpr("+", binExpr("+", ident("w"), ident("x")), ident("y")), ident("z"))); +assertExpr("(x - y)", binExpr("-", ident("x"), ident("y"))); +assertExpr("(w - x - y - z)", binExpr("-", binExpr("-", binExpr("-", ident("w"), ident("x")), ident("y")), ident("z"))); +assertExpr("(x * y)", binExpr("*", ident("x"), ident("y"))); +assertExpr("(x / y)", binExpr("/", ident("x"), ident("y"))); +assertExpr("(x % y)", binExpr("%", ident("x"), ident("y"))); +assertExpr("(x | y)", binExpr("|", ident("x"), ident("y"))); +assertExpr("(x ^ y)", binExpr("^", ident("x"), ident("y"))); +assertExpr("(x & y)", binExpr("&", ident("x"), ident("y"))); +assertExpr("(x in y)", binExpr("in", ident("x"), ident("y"))); +assertExpr("(x instanceof y)", binExpr("instanceof", ident("x"), ident("y"))); +assertExpr("(x = y)", aExpr("=", ident("x"), ident("y"))); +assertExpr("(x += y)", aExpr("+=", ident("x"), ident("y"))); +assertExpr("(x -= y)", aExpr("-=", ident("x"), ident("y"))); +assertExpr("(x *= y)", aExpr("*=", ident("x"), ident("y"))); +assertExpr("(x /= y)", aExpr("/=", ident("x"), ident("y"))); +assertExpr("(x %= y)", aExpr("%=", ident("x"), ident("y"))); +assertExpr("(x <<= y)", aExpr("<<=", ident("x"), ident("y"))); +assertExpr("(x >>= y)", aExpr(">>=", ident("x"), ident("y"))); +assertExpr("(x >>>= y)", aExpr(">>>=", ident("x"), ident("y"))); +assertExpr("(x |= y)", aExpr("|=", ident("x"), ident("y"))); +assertExpr("(x ^= y)", aExpr("^=", ident("x"), ident("y"))); +assertExpr("(x &= y)", aExpr("&=", ident("x"), ident("y"))); +assertExpr("(x || y)", logExpr("||", ident("x"), ident("y"))); +assertExpr("(x && y)", logExpr("&&", ident("x"), ident("y"))); +assertExpr("(w || x || y || z)", logExpr("||", logExpr("||", logExpr("||", ident("w"), ident("x")), ident("y")), ident("z"))) +assertExpr("(x ? y : z)", condExpr(ident("x"), ident("y"), ident("z"))); +assertExpr("(x,y)", seqExpr([ident("x"),ident("y")])) +assertExpr("(x,y,z)", seqExpr([ident("x"),ident("y"),ident("z")])) +assertExpr("(a,b,c,d,e,f,g)", seqExpr([ident("a"),ident("b"),ident("c"),ident("d"),ident("e"),ident("f"),ident("g")])); +assertExpr("(new Object)", newExpr(ident("Object"), [])); +assertExpr("(new Object())", newExpr(ident("Object"), [])); +assertExpr("(new Object(42))", newExpr(ident("Object"), [lit(42)])); +assertExpr("(new Object(1,2,3))", newExpr(ident("Object"), [lit(1),lit(2),lit(3)])); +assertExpr("(String())", callExpr(ident("String"), [])); +assertExpr("(String(42))", callExpr(ident("String"), [lit(42)])); +assertExpr("(String(1,2,3))", callExpr(ident("String"), [lit(1),lit(2),lit(3)])); +assertExpr("[]", arrExpr([])); +assertExpr("[1]", arrExpr([lit(1)])); +assertExpr("[1,2]", arrExpr([lit(1),lit(2)])); +assertExpr("[1,2,3]", arrExpr([lit(1),lit(2),lit(3)])); +assertExpr("[1,,2,3]", arrExpr([lit(1),,lit(2),lit(3)])); +assertExpr("[1,,,2,3]", arrExpr([lit(1),,,lit(2),lit(3)])); +assertExpr("[1,,,2,,3]", arrExpr([lit(1),,,lit(2),,lit(3)])); +assertExpr("[1,,,2,,,3]", arrExpr([lit(1),,,lit(2),,,lit(3)])); +assertExpr("[,1,2,3]", arrExpr([,lit(1),lit(2),lit(3)])); +assertExpr("[,,1,2,3]", arrExpr([,,lit(1),lit(2),lit(3)])); +assertExpr("[,,,1,2,3]", arrExpr([,,,lit(1),lit(2),lit(3)])); +assertExpr("[,,,1,2,3,]", arrExpr([,,,lit(1),lit(2),lit(3)])); +assertExpr("[,,,1,2,3,,]", arrExpr([,,,lit(1),lit(2),lit(3),undefined])); +assertExpr("[,,,1,2,3,,,]", arrExpr([,,,lit(1),lit(2),lit(3),undefined,undefined])); +assertExpr("[,,,,,]", arrExpr([undefined,undefined,undefined,undefined,undefined])); +assertExpr("({})", objExpr([])); +assertExpr("({x:1})", objExpr([objProp(ident("x"), lit(1), "init")])); +assertExpr("({x:1, y:2})", objExpr([objProp(ident("x"), lit(1), "init"), + objProp(ident("y"), lit(2), "init")])); +assertExpr("({x:1, y:2, z:3})", objExpr([objProp(ident("x"), lit(1), "init"), + objProp(ident("y"), lit(2), "init"), + objProp(ident("z"), lit(3), "init") ])); +assertExpr("({x:1, 'y':2, z:3})", objExpr([objProp(ident("x"), lit(1), "init"), + objProp(lit("y"), lit(2), "init"), + objProp(ident("z"), lit(3), "init") ])); +assertExpr("({'x':1, 'y':2, z:3})", objExpr([objProp(lit("x"), lit(1), "init"), + objProp(lit("y"), lit(2), "init"), + objProp(ident("z"), lit(3), "init") ])); +assertExpr("({'x':1, 'y':2, 3:3})", objExpr([objProp(lit("x"), lit(1), "init"), + objProp(lit("y"), lit(2), "init"), + objProp(lit(3), lit(3), "init") ])); + +// Bug 571617: eliminate constant-folding +assertExpr("2 + 3", binExpr("+", lit(2), lit(3))); + +// Bug 632026: constant-folding +assertExpr("typeof(0?0:a)", unExpr("typeof", condExpr(lit(0), lit(0), ident("a")))); + +// Bug 632056: constant-folding +program([exprStmt(ident("f")), + ifStmt(lit(1), + funDecl(ident("f"), [], blockStmt([])), + null)]).assert(Reflect.parse("f; if (1) function f(){}")); + +// statements + +assertStmt("throw 42", throwStmt(lit(42))); +assertStmt("for (;;) break", forStmt(null, null, null, breakStmt(null))); +assertStmt("for (x; y; z) break", forStmt(ident("x"), ident("y"), ident("z"), breakStmt(null))); +assertStmt("for (var x; y; z) break", forStmt(varDecl([declarator(ident("x"), null)]), ident("y"), ident("z"), breakStmt(null))); +assertStmt("for (var x = 42; y; z) break", forStmt(varDecl([declarator(ident("x"), lit(42))]), ident("y"), ident("z"), breakStmt(null))); +assertStmt("for (x; ; z) break", forStmt(ident("x"), null, ident("z"), breakStmt(null))); +assertStmt("for (var x; ; z) break", forStmt(varDecl([declarator(ident("x"), null)]), null, ident("z"), breakStmt(null))); +assertStmt("for (var x = 42; ; z) break", forStmt(varDecl([declarator(ident("x"), lit(42))]), null, ident("z"), breakStmt(null))); +assertStmt("for (x; y; ) break", forStmt(ident("x"), ident("y"), null, breakStmt(null))); +assertStmt("for (var x; y; ) break", forStmt(varDecl([declarator(ident("x"), null)]), ident("y"), null, breakStmt(null))); +assertStmt("for (var x = 42; y; ) break", forStmt(varDecl([declarator(ident("x"),lit(42))]), ident("y"), null, breakStmt(null))); +assertStmt("for (var x in y) break", forInStmt(varDecl([declarator(ident("x"),null)]), ident("y"), breakStmt(null))); +assertStmt("for (x in y) break", forInStmt(ident("x"), ident("y"), breakStmt(null))); +assertStmt("{ }", blockStmt([])); +assertStmt("{ throw 1; throw 2; throw 3; }", blockStmt([ throwStmt(lit(1)), throwStmt(lit(2)), throwStmt(lit(3))])); +assertStmt(";", emptyStmt); +assertStmt("if (foo) throw 42;", ifStmt(ident("foo"), throwStmt(lit(42)), null)); +assertStmt("if (foo) throw 42; else true;", ifStmt(ident("foo"), throwStmt(lit(42)), exprStmt(lit(true)))); +assertStmt("if (foo) { throw 1; throw 2; throw 3; }", + ifStmt(ident("foo"), + blockStmt([throwStmt(lit(1)), throwStmt(lit(2)), throwStmt(lit(3))]), + null)); +assertStmt("if (foo) { throw 1; throw 2; throw 3; } else true;", + ifStmt(ident("foo"), + blockStmt([throwStmt(lit(1)), throwStmt(lit(2)), throwStmt(lit(3))]), + exprStmt(lit(true)))); +assertStmt("foo: for(;;) break foo;", labStmt(ident("foo"), forStmt(null, null, null, breakStmt(ident("foo"))))); +assertStmt("foo: for(;;) continue foo;", labStmt(ident("foo"), forStmt(null, null, null, continueStmt(ident("foo"))))); +assertStmt("with (obj) { }", withStmt(ident("obj"), blockStmt([]))); +assertStmt("with (obj) { obj; }", withStmt(ident("obj"), blockStmt([exprStmt(ident("obj"))]))); +assertStmt("while (foo) { }", whileStmt(ident("foo"), blockStmt([]))); +assertStmt("while (foo) { foo; }", whileStmt(ident("foo"), blockStmt([exprStmt(ident("foo"))]))); +assertStmt("do { } while (foo);", doStmt(blockStmt([]), ident("foo"))); +assertStmt("do { foo; } while (foo)", doStmt(blockStmt([exprStmt(ident("foo"))]), ident("foo"))); +assertStmt("switch (foo) { case 1: 1; break; case 2: 2; break; default: 3; }", + switchStmt(ident("foo"), + [ caseClause(lit(1), [ exprStmt(lit(1)), breakStmt(null) ]), + caseClause(lit(2), [ exprStmt(lit(2)), breakStmt(null) ]), + defaultClause([ exprStmt(lit(3)) ]) ])); +assertStmt("switch (foo) { case 1: 1; break; case 2: 2; break; default: 3; case 42: 42; }", + switchStmt(ident("foo"), + [ caseClause(lit(1), [ exprStmt(lit(1)), breakStmt(null) ]), + caseClause(lit(2), [ exprStmt(lit(2)), breakStmt(null) ]), + defaultClause([ exprStmt(lit(3)) ]), + caseClause(lit(42), [ exprStmt(lit(42)) ]) ])); +assertStmt("try { } catch (e) { }", + tryStmt(blockStmt([]), + [], + [ catchClause(ident("e"), null, blockStmt([])) ], + null)); +assertStmt("try { } catch (e) { } finally { }", + tryStmt(blockStmt([]), + [], + [ catchClause(ident("e"), null, blockStmt([])) ], + blockStmt([]))); +assertStmt("try { } finally { }", + tryStmt(blockStmt([]), + [], + [], + blockStmt([]))); + +// redeclarations (TOK_NAME nodes with lexdef) + +assertStmt("function f() { function g() { } function g() { } }", + funDecl(ident("f"), [], blockStmt([funDecl(ident("g"), [], blockStmt([])), + funDecl(ident("g"), [], blockStmt([]))]))); + +assertStmt("function f() { function g() { } function g() { return 42 } }", + funDecl(ident("f"), [], blockStmt([funDecl(ident("g"), [], blockStmt([])), + funDecl(ident("g"), [], blockStmt([returnStmt(lit(42))]))]))); + +assertStmt("function f() { var x = 42; var x = 43; }", + funDecl(ident("f"), [], blockStmt([varDecl([declarator(ident("x"),lit(42))]), + varDecl([declarator(ident("x"),lit(43))])]))); + +// getters and setters + + assertExpr("({ get x() { return 42 } })", + objExpr([ objProp(ident("x"), + funExpr(null, [], blockStmt([returnStmt(lit(42))])), + "get" ) ])); + assertExpr("({ set x(v) { return 42 } })", + objExpr([ objProp(ident("x"), + funExpr(null, [ident("v")], blockStmt([returnStmt(lit(42))])), + "set" ) ])); + +} + +exports.testReflect = testReflect; + +}(typeof exports === 'undefined' ? this : exports)); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/run.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/run.js new file mode 100644 index 00000000..32ca3faa --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/run.js @@ -0,0 +1,66 @@ +/* + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint node:true */ + +(function () { + 'use strict'; + + var child = require('child_process'), + nodejs = '"' + process.execPath + '"', + ret = 0, + suites, + index; + + suites = [ + 'runner', + 'compat' + ]; + + function nextTest() { + var suite = suites[index]; + + if (index < suites.length) { + child.exec(nodejs + ' ./test/' + suite + '.js', function (err, stdout, stderr) { + if (stdout) { + process.stdout.write(suite + ': ' + stdout); + } + if (stderr) { + process.stderr.write(suite + ': ' + stderr); + } + if (err) { + ret = err.code; + } + index += 1; + nextTest(); + }); + } else { + process.exit(ret); + } + } + + index = 0; + nextTest(); +}()); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/runner.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/runner.js new file mode 100644 index 00000000..c1a3fc9b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/runner.js @@ -0,0 +1,387 @@ +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + Copyright (C) 2011 Yusuke Suzuki + Copyright (C) 2011 Arpad Borsos + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint browser:true node:true */ +/*global esprima:true, testFixture:true */ + +var runTests; + +// Special handling for regular expression literal since we need to +// convert it to a string literal, otherwise it will be decoded +// as object "{}" and the regular expression would be lost. +function adjustRegexLiteral(key, value) { + 'use strict'; + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } + return value; +} + +function NotMatchingError(expected, actual) { + 'use strict'; + Error.call(this, 'Expected '); + this.expected = expected; + this.actual = actual; +} +NotMatchingError.prototype = new Error(); + +function errorToObject(e) { + 'use strict'; + var msg = e.toString(); + + // Opera 9.64 produces an non-standard string in toString(). + if (msg.substr(0, 6) !== 'Error:') { + if (typeof e.message === 'string') { + msg = 'Error: ' + e.message; + } + } + + return { + index: e.index, + lineNumber: e.lineNumber, + column: e.column, + message: msg + }; +} + +function testParse(esprima, code, syntax) { + 'use strict'; + var expected, tree, actual, options, StringObject, i, len, err; + + // alias, so that JSLint does not complain. + StringObject = String; + + options = { + comment: (typeof syntax.comments !== 'undefined'), + range: true, + loc: true, + tokens: (typeof syntax.tokens !== 'undefined'), + raw: true, + tolerant: (typeof syntax.errors !== 'undefined') + }; + + if (typeof syntax.tokens !== 'undefined') { + if (syntax.tokens.length > 0) { + options.range = (typeof syntax.tokens[0].range !== 'undefined'); + options.loc = (typeof syntax.tokens[0].loc !== 'undefined'); + } + } + + if (typeof syntax.comments !== 'undefined') { + if (syntax.comments.length > 0) { + options.range = (typeof syntax.comments[0].range !== 'undefined'); + options.loc = (typeof syntax.comments[0].loc !== 'undefined'); + } + } + + expected = JSON.stringify(syntax, null, 4); + try { + tree = esprima.parse(code, options); + tree = (options.comment || options.tokens || options.tolerant) ? tree : tree.body[0]; + + if (options.tolerant) { + for (i = 0, len = tree.errors.length; i < len; i += 1) { + tree.errors[i] = errorToObject(tree.errors[i]); + } + } + + actual = JSON.stringify(tree, adjustRegexLiteral, 4); + + // Only to ensure that there is no error when using string object. + esprima.parse(new StringObject(code), options); + + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } + + function filter(key, value) { + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } + return (key === 'loc' || key === 'range') ? undefined : value; + } + + if (options.tolerant) { + return; + } + + + // Check again without any location info. + options.range = false; + options.loc = false; + expected = JSON.stringify(syntax, filter, 4); + try { + tree = esprima.parse(code, options); + tree = (options.comment || options.tokens) ? tree : tree.body[0]; + + if (options.tolerant) { + for (i = 0, len = tree.errors.length; i < len; i += 1) { + tree.errors[i] = errorToObject(tree.errors[i]); + } + } + + actual = JSON.stringify(tree, filter, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } +} + +function testError(esprima, code, exception) { + 'use strict'; + var i, options, expected, actual, handleInvalidRegexFlag; + + // Different parsing options should give the same error. + options = [ + {}, + { comment: true }, + { raw: true }, + { raw: true, comment: true } + ]; + + // If handleInvalidRegexFlag is true, an invalid flag in a regular expression + // will throw an exception. In some old version V8, this is not the case + // and hence handleInvalidRegexFlag is false. + handleInvalidRegexFlag = false; + try { + 'test'.match(new RegExp('[a-z]', 'x')); + } catch (e) { + handleInvalidRegexFlag = true; + } + + expected = JSON.stringify(exception); + + for (i = 0; i < options.length; i += 1) { + + try { + esprima.parse(code, options[i]); + } catch (e) { + actual = JSON.stringify(errorToObject(e)); + } + + if (expected !== actual) { + + // Compensate for old V8 which does not handle invalid flag. + if (exception.message.indexOf('Invalid regular expression') > 0) { + if (typeof actual === 'undefined' && !handleInvalidRegexFlag) { + return; + } + } + + throw new NotMatchingError(expected, actual); + } + + } +} + +function testAPI(esprima, code, result) { + 'use strict'; + var expected, res, actual; + + expected = JSON.stringify(result.result, null, 4); + try { + if (typeof result.property !== 'undefined') { + res = esprima[result.property]; + } else { + res = esprima[result.call].apply(esprima, result.args); + } + actual = JSON.stringify(res, adjustRegexLiteral, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } +} + +function runTest(esprima, code, result) { + 'use strict'; + if (result.hasOwnProperty('lineNumber')) { + testError(esprima, code, result); + } else if (result.hasOwnProperty('result')) { + testAPI(esprima, code, result); + } else { + testParse(esprima, code, result); + } +} + +if (typeof window !== 'undefined') { + // Run all tests in a browser environment. + runTests = function () { + 'use strict'; + var total = 0, + failures = 0, + category, + fixture, + source, + tick, + expected, + index, + len; + + function setText(el, str) { + if (typeof el.innerText === 'string') { + el.innerText = str; + } else { + el.textContent = str; + } + } + + function startCategory(category) { + var report, e; + report = document.getElementById('report'); + e = document.createElement('h4'); + setText(e, category); + report.appendChild(e); + } + + function reportSuccess(code) { + var report, e; + report = document.getElementById('report'); + e = document.createElement('pre'); + e.setAttribute('class', 'code'); + setText(e, code); + report.appendChild(e); + } + + function reportFailure(code, expected, actual) { + var report, e; + + report = document.getElementById('report'); + + e = document.createElement('p'); + setText(e, 'Code:'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'code'); + setText(e, code); + report.appendChild(e); + + e = document.createElement('p'); + setText(e, 'Expected'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'expected'); + setText(e, expected); + report.appendChild(e); + + e = document.createElement('p'); + setText(e, 'Actual'); + report.appendChild(e); + + e = document.createElement('pre'); + e.setAttribute('class', 'actual'); + setText(e, actual); + report.appendChild(e); + } + + setText(document.getElementById('version'), esprima.version); + + tick = new Date(); + for (category in testFixture) { + if (testFixture.hasOwnProperty(category)) { + startCategory(category); + fixture = testFixture[category]; + for (source in fixture) { + if (fixture.hasOwnProperty(source)) { + expected = fixture[source]; + total += 1; + try { + runTest(esprima, source, expected); + reportSuccess(source, JSON.stringify(expected, null, 4)); + } catch (e) { + failures += 1; + reportFailure(source, e.expected, e.actual); + } + } + } + } + } + tick = (new Date()) - tick; + + if (failures > 0) { + setText(document.getElementById('status'), total + ' tests. ' + + 'Failures: ' + failures + '. ' + tick + ' ms'); + } else { + setText(document.getElementById('status'), total + ' tests. ' + + 'No failure. ' + tick + ' ms'); + } + }; +} else { + (function () { + 'use strict'; + + var esprima = require('../esprima'), + vm = require('vm'), + fs = require('fs'), + total = 0, + failures = [], + tick = new Date(), + expected, + header; + + vm.runInThisContext(fs.readFileSync(__dirname + '/test.js', 'utf-8')); + + Object.keys(testFixture).forEach(function (category) { + Object.keys(testFixture[category]).forEach(function (source) { + total += 1; + expected = testFixture[category][source]; + try { + runTest(esprima, source, expected); + } catch (e) { + e.source = source; + failures.push(e); + } + }); + }); + tick = (new Date()) - tick; + + header = total + ' tests. ' + failures.length + ' failures. ' + + tick + ' ms'; + if (failures.length) { + console.error(header); + failures.forEach(function (failure) { + console.error(failure.source + ': Expected\n ' + + failure.expected.split('\n').join('\n ') + + '\nto match\n ' + failure.actual); + }); + } else { + console.log(header); + } + process.exit(failures.length === 0 ? 0 : 1); + }()); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/test.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/test.js new file mode 100644 index 00000000..8ceee54b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/node_modules/esprima/test/test.js @@ -0,0 +1,20238 @@ +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + Copyright (C) 2011 Yusuke Suzuki + Copyright (C) 2011 Arpad Borsos + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +var testFixture = { + + 'Primary Expression': { + + 'this\n': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'ThisExpression', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 0 } + } + }], + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 0 } + }, + tokens: [{ + type: 'Keyword', + value: 'this', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }] + }, + + 'null\n': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: null, + raw: 'null', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 0 } + } + }], + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 0 } + }, + tokens: [{ + type: 'Null', + value: 'null', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }] + }, + + '\n 42\n\n': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [5, 7], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }, + range: [5, 9], + loc: { + start: { line: 2, column: 4 }, + end: { line: 4, column: 0 } + } + }], + range: [5, 9], + loc: { + start: { line: 2, column: 4 }, + end: { line: 4, column: 0 } + }, + tokens: [{ + type: 'Numeric', + value: '42', + range: [5, 7], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }] + }, + + '(1 + 2 ) * 3': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'Literal', + value: 1, + raw: '1', + range: [1, 2], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 2 } + } + }, + right: { + type: 'Literal', + value: 2, + raw: '2', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [1, 6], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 6 } + } + }, + right: { + type: 'Literal', + value: 3, + raw: '3', + range: [11, 12], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + } + + }, + + 'Grouping Operator': { + + '(1) + (2 ) + 3': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'Literal', + value: 1, + raw: '1', + range: [1, 2], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 2 } + } + }, + right: { + type: 'Literal', + value: 2, + raw: '2', + range: [7, 8], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + right: { + type: 'Literal', + value: 3, + raw: '3', + range: [14, 15], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + + '4 + 5 << (6)': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '<<', + left: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'Literal', + value: 4, + raw: '4', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 5, + raw: '5', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Literal', + value: 6, + raw: '6', + range: [10, 11], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + } + + }, + + 'Array Initializer': { + + 'x = []': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [4, 6], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }], + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + }, + tokens: [{ + type: 'Identifier', + value: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, { + type: 'Punctuator', + value: '=', + range: [2, 3], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Punctuator', + value: '[', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: ']', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }] + }, + + 'x = [ ]': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x = [ 42 ]': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ArrayExpression', + elements: [{ + type: 'Literal', + value: 42, + raw: '42', + range: [6, 8], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 8 } + } + }], + range: [4, 10], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 10 } + } + }, + range: [0, 10], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 10 } + } + }, + range: [0, 10], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 10 } + } + }, + + 'x = [ 42, ]': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ArrayExpression', + elements: [{ + type: 'Literal', + value: 42, + raw: '42', + range: [6, 8], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 8 } + } + }], + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + 'x = [ ,, 42 ]': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ArrayExpression', + elements: [ + null, + null, + { + type: 'Literal', + value: 42, + raw: '42', + range: [9, 11], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 11 } + } + }], + range: [4, 13], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + + 'x = [ 1, 2, 3, ]': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ArrayExpression', + elements: [{ + type: 'Literal', + value: 1, + raw: '1', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'Literal', + value: 2, + raw: '2', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, { + type: 'Literal', + value: 3, + raw: '3', + range: [12, 13], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 13 } + } + }], + range: [4, 16], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + 'x = [ 1, 2,, 3, ]': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ArrayExpression', + elements: [{ + type: 'Literal', + value: 1, + raw: '1', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'Literal', + value: 2, + raw: '2', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, null, { + type: 'Literal', + value: 3, + raw: '3', + range: [13, 14], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 14 } + } + }], + range: [4, 17], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + + '日本語 = []': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: '日本語', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [6, 8], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + + 'T\u203F = []': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'T\u203F', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'T\u200C = []': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'T\u200C', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'T\u200D = []': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'T\u200D', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + '\u2163\u2161 = []': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: '\u2163\u2161', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + '\u2163\u2161\u200A=\u2009[]': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: '\u2163\u2161', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + } + + }, + + 'Object Initializer': { + + 'x = {}': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [], + range: [4, 6], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x = { }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [], + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x = { answer: 42 }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'answer', + range: [6, 12], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + } + }, + value: { + type: 'Literal', + value: 42, + raw: '42', + range: [14, 16], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 16 } + } + }, + kind: 'init', + range: [6, 16], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 16 } + } + }], + range: [4, 18], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 18 } + } + }, + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + } + }, + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + } + }, + + 'x = { if: 42 }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'if', + range: [6, 8], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 8 } + } + }, + value: { + type: 'Literal', + value: 42, + raw: '42', + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + kind: 'init', + range: [6, 12], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + } + }], + range: [4, 14], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + + 'x = { true: 42 }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'true', + range: [6, 10], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 10 } + } + }, + value: { + type: 'Literal', + value: 42, + raw: '42', + range: [12, 14], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 14 } + } + }, + kind: 'init', + range: [6, 14], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 14 } + } + }], + range: [4, 16], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + 'x = { false: 42 }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'false', + range: [6, 11], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 11 } + } + }, + value: { + type: 'Literal', + value: 42, + raw: '42', + range: [13, 15], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 15 } + } + }, + kind: 'init', + range: [6, 15], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 15 } + } + }], + range: [4, 17], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + + 'x = { null: 42 }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'null', + range: [6, 10], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 10 } + } + }, + value: { + type: 'Literal', + value: 42, + raw: '42', + range: [12, 14], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 14 } + } + }, + kind: 'init', + range: [6, 14], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 14 } + } + }], + range: [4, 16], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + 'x = { "answer": 42 }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Literal', + value: 'answer', + raw: '"answer"', + range: [6, 14], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 14 } + } + }, + value: { + type: 'Literal', + value: 42, + raw: '42', + range: [16, 18], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 18 } + } + }, + kind: 'init', + range: [6, 18], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 18 } + } + }], + range: [4, 20], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 20 } + } + }, + range: [0, 20], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 20 } + } + }, + range: [0, 20], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 20 } + } + }, + + 'x = { x: 1, x: 2 }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [ + { + type: 'Property', + key: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + value: { + type: 'Literal', + value: 1, + raw: '1', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, + kind: 'init', + range: [6, 10], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 10 } + } + }, + { + type: 'Property', + key: { + type: 'Identifier', + name: 'x', + range: [12, 13], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 13 } + } + }, + value: { + type: 'Literal', + value: 2, + raw: '2', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, + kind: 'init', + range: [12, 16], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 16 } + } + } + ], + range: [4, 18], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 18 } + } + }, + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + } + }, + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + } + }, + + 'x = { get width() { return m_width } }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'width', + range: [10, 15], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 15 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ReturnStatement', + argument: { + type: 'Identifier', + name: 'm_width', + range: [27, 34], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 34 } + } + }, + range: [20, 35], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 35 } + } + }], + range: [18, 36], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 36 } + } + }, + rest: null, + generator: false, + expression: false, + range: [18, 36], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 36 } + } + }, + kind: 'get', + range: [6, 36], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 36 } + } + }], + range: [4, 38], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 38 } + } + }, + range: [0, 38], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 38 } + } + }, + range: [0, 38], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 38 } + } + }, + + 'x = { get undef() {} }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'undef', + range: [10, 15], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 15 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [18, 20], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 20 } + } + }, + rest: null, + generator: false, + expression: false, + range: [18, 20], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 20 } + } + }, + kind: 'get', + range: [6, 20], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 20 } + } + }], + range: [4, 22], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + }, + + 'x = { get if() {} }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'if', + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [15, 17], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 17 } + } + }, + rest: null, + generator: false, + expression: false, + range: [15, 17], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 17 } + } + }, + kind: 'get', + range: [6, 17], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 17 } + } + }], + range: [4, 19], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 19 } + } + }, + range: [0, 19], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + } + }, + range: [0, 19], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + } + }, + + 'x = { get true() {} }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'true', + range: [10, 14], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 14 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [17, 19], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 19 } + } + }, + rest: null, + generator: false, + expression: false, + range: [17, 19], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 19 } + } + }, + kind: 'get', + range: [6, 19], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 19 } + } + }], + range: [4, 21], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + + 'x = { get false() {} }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'false', + range: [10, 15], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 15 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [18, 20], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 20 } + } + }, + rest: null, + generator: false, + expression: false, + range: [18, 20], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 20 } + } + }, + kind: 'get', + range: [6, 20], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 20 } + } + }], + range: [4, 22], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + }, + + 'x = { get null() {} }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'null', + range: [10, 14], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 14 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [17, 19], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 19 } + } + }, + rest: null, + generator: false, + expression: false, + range: [17, 19], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 19 } + } + }, + kind: 'get', + range: [6, 19], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 19 } + } + }], + range: [4, 21], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + + 'x = { get "undef"() {} }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Literal', + value: 'undef', + raw: '"undef"', + range: [10, 17], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 17 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [20, 22], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 22 } + } + }, + rest: null, + generator: false, + expression: false, + range: [20, 22], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 22 } + } + }, + kind: 'get', + range: [6, 22], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 22 } + } + }], + range: [4, 24], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 24 } + } + }, + range: [0, 24], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 24 } + } + }, + range: [0, 24], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 24 } + } + }, + + 'x = { get 10() {} }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Literal', + value: 10, + raw: '10', + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [15, 17], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 17 } + } + }, + rest: null, + generator: false, + expression: false, + range: [15, 17], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 17 } + } + }, + kind: 'get', + range: [6, 17], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 17 } + } + }], + range: [4, 19], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 19 } + } + }, + range: [0, 19], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + } + }, + range: [0, 19], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + } + }, + + 'x = { set width(w) { m_width = w } }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'width', + range: [10, 15], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 15 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'Identifier', + name: 'w', + range: [16, 17], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'm_width', + range: [21, 28], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 28 } + } + }, + right: { + type: 'Identifier', + name: 'w', + range: [31, 32], + loc: { + start: { line: 1, column: 31 }, + end: { line: 1, column: 32 } + } + }, + range: [21, 32], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 32 } + } + }, + range: [21, 33], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 33 } + } + }], + range: [19, 34], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 34 } + } + }, + rest: null, + generator: false, + expression: false, + range: [19, 34], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 34 } + } + }, + kind: 'set', + range: [6, 34], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 34 } + } + }], + range: [4, 36], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 36 } + } + }, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + } + }, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + } + }, + + 'x = { set if(w) { m_if = w } }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'if', + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'Identifier', + name: 'w', + range: [13, 14], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 14 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'm_if', + range: [18, 22], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 22 } + } + }, + right: { + type: 'Identifier', + name: 'w', + range: [25, 26], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 26 } + } + }, + range: [18, 26], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 26 } + } + }, + range: [18, 27], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 27 } + } + }], + range: [16, 28], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 28 } + } + }, + rest: null, + generator: false, + expression: false, + range: [16, 28], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 28 } + } + }, + kind: 'set', + range: [6, 28], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 28 } + } + }], + range: [4, 30], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 30 } + } + }, + range: [0, 30], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 30 } + } + }, + range: [0, 30], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 30 } + } + }, + + 'x = { set true(w) { m_true = w } }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'true', + range: [10, 14], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 14 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'Identifier', + name: 'w', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'm_true', + range: [20, 26], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 26 } + } + }, + right: { + type: 'Identifier', + name: 'w', + range: [29, 30], + loc: { + start: { line: 1, column: 29 }, + end: { line: 1, column: 30 } + } + }, + range: [20, 30], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 30 } + } + }, + range: [20, 31], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 31 } + } + }], + range: [18, 32], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 32 } + } + }, + rest: null, + generator: false, + expression: false, + range: [18, 32], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 32 } + } + }, + kind: 'set', + range: [6, 32], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 32 } + } + }], + range: [4, 34], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 34 } + } + }, + range: [0, 34], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 34 } + } + }, + range: [0, 34], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 34 } + } + }, + + 'x = { set false(w) { m_false = w } }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'false', + range: [10, 15], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 15 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'Identifier', + name: 'w', + range: [16, 17], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'm_false', + range: [21, 28], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 28 } + } + }, + right: { + type: 'Identifier', + name: 'w', + range: [31, 32], + loc: { + start: { line: 1, column: 31 }, + end: { line: 1, column: 32 } + } + }, + range: [21, 32], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 32 } + } + }, + range: [21, 33], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 33 } + } + }], + range: [19, 34], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 34 } + } + }, + rest: null, + generator: false, + expression: false, + range: [19, 34], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 34 } + } + }, + kind: 'set', + range: [6, 34], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 34 } + } + }], + range: [4, 36], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 36 } + } + }, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + } + }, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + } + }, + + 'x = { set null(w) { m_null = w } }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'null', + range: [10, 14], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 14 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'Identifier', + name: 'w', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'm_null', + range: [20, 26], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 26 } + } + }, + right: { + type: 'Identifier', + name: 'w', + range: [29, 30], + loc: { + start: { line: 1, column: 29 }, + end: { line: 1, column: 30 } + } + }, + range: [20, 30], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 30 } + } + }, + range: [20, 31], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 31 } + } + }], + range: [18, 32], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 32 } + } + }, + rest: null, + generator: false, + expression: false, + range: [18, 32], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 32 } + } + }, + kind: 'set', + range: [6, 32], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 32 } + } + }], + range: [4, 34], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 34 } + } + }, + range: [0, 34], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 34 } + } + }, + range: [0, 34], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 34 } + } + }, + + 'x = { set "null"(w) { m_null = w } }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Literal', + value: 'null', + raw: '"null"', + range: [10, 16], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 16 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'Identifier', + name: 'w', + range: [17, 18], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 18 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'm_null', + range: [22, 28], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 28 } + } + }, + right: { + type: 'Identifier', + name: 'w', + range: [31, 32], + loc: { + start: { line: 1, column: 31 }, + end: { line: 1, column: 32 } + } + }, + range: [22, 32], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 32 } + } + }, + range: [22, 33], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 33 } + } + }], + range: [20, 34], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 34 } + } + }, + rest: null, + generator: false, + expression: false, + range: [20, 34], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 34 } + } + }, + kind: 'set', + range: [6, 34], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 34 } + } + }], + range: [4, 36], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 36 } + } + }, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + } + }, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + } + }, + + 'x = { set 10(w) { m_null = w } }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Literal', + value: 10, + raw: '10', + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'Identifier', + name: 'w', + range: [13, 14], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 14 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'm_null', + range: [18, 24], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 24 } + } + }, + right: { + type: 'Identifier', + name: 'w', + range: [27, 28], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 28 } + } + }, + range: [18, 28], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 28 } + } + }, + range: [18, 29], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 29 } + } + }], + range: [16, 30], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 30 } + } + }, + rest: null, + generator: false, + expression: false, + range: [16, 30], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 30 } + } + }, + kind: 'set', + range: [6, 30], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 30 } + } + }], + range: [4, 32], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 32 } + } + }, + range: [0, 32], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 32 } + } + }, + range: [0, 32], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 32 } + } + }, + + 'x = { get: 42 }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'get', + range: [6, 9], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 9 } + } + }, + value: { + type: 'Literal', + value: 42, + raw: '42', + range: [11, 13], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 13 } + } + }, + kind: 'init', + range: [6, 13], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 13 } + } + }], + range: [4, 15], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + + 'x = { set: 43 }': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'set', + range: [6, 9], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 9 } + } + }, + value: { + type: 'Literal', + value: 43, + raw: '43', + range: [11, 13], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 13 } + } + }, + kind: 'init', + range: [6, 13], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 13 } + } + }], + range: [4, 15], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + } + + }, + + 'Comments': { + + '/* block comment */ 42': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [20, 22], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 22 } + } + }, + range: [20, 22], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 22 } + } + }, + + '42 /*The*/ /*Answer*/': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }], + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + }, + comments: [{ + type: 'Block', + value: 'The', + range: [3, 10], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 10 } + } + }, { + type: 'Block', + value: 'Answer', + range: [11, 21], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 21 } + } + }] + }, + + '42 /*the*/ /*answer*/': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [0, 2] + }, + range: [0, 21] + }], + range: [0, 21], + comments: [{ + type: 'Block', + value: 'the', + range: [3, 10] + }, { + type: 'Block', + value: 'answer', + range: [11, 21] + }] + }, + + '/* multiline\ncomment\nshould\nbe\nignored */ 42': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [42, 44], + loc: { + start: { line: 5, column: 11 }, + end: { line: 5, column: 13 } + } + }, + range: [42, 44], + loc: { + start: { line: 5, column: 11 }, + end: { line: 5, column: 13 } + } + }, + + '/*a\r\nb*/ 42': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [9, 11], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }, + range: [9, 11], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }], + range: [9, 11], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + }, + comments: [{ + type: 'Block', + value: 'a\r\nb', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 3 } + } + }] + }, + + '/*a\rb*/ 42': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [8, 10], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }, + range: [8, 10], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }], + range: [8, 10], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + }, + comments: [{ + type: 'Block', + value: 'a\rb', + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 3 } + } + }] + }, + + '/*a\nb*/ 42': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [8, 10], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }, + range: [8, 10], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }], + range: [8, 10], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + }, + comments: [{ + type: 'Block', + value: 'a\nb', + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 3 } + } + }] + }, + + '/*a\nc*/ 42': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }, + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + } + }], + loc: { + start: { line: 2, column: 4 }, + end: { line: 2, column: 6 } + }, + comments: [{ + type: 'Block', + value: 'a\nc', + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 3 } + } + }] + }, + + '// line comment\n42': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [16, 18], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + } + }, + range: [16, 18], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + } + }, + + '42 // line comment': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + } + }], + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + }, + comments: [{ + type: 'Line', + value: ' line comment', + range: [3, 18], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 18 } + } + }] + }, + + '// Hello, world!\n42': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [17, 19], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + } + }, + range: [17, 19], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + } + }], + range: [17, 19], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + }, + comments: [{ + type: 'Line', + value: ' Hello, world!', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }] + }, + + '// Hello, world!\n': { + type: 'Program', + body: [], + range: [17, 17], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 0 } + }, + comments: [{ + type: 'Line', + value: ' Hello, world!', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }] + }, + + '// Hallo, world!\n': { + type: 'Program', + body: [], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 0 } + }, + comments: [{ + type: 'Line', + value: ' Hallo, world!', + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }] + }, + + '//\n42': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [3, 5], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + } + }, + range: [3, 5], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + } + }], + range: [3, 5], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + }, + comments: [{ + type: 'Line', + value: '', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }] + }, + + '//': { + type: 'Program', + body: [], + range: [2, 2], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 2 } + }, + comments: [{ + type: 'Line', + value: '', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }] + }, + + '// ': { + type: 'Program', + body: [], + range: [3, 3], + comments: [{ + type: 'Line', + value: ' ', + range: [0, 3] + }] + }, + + '/**/42': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [4, 6], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + } + }, + range: [4, 6], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + } + }], + range: [4, 6], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + }, + comments: [{ + type: 'Block', + value: '', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }] + }, + + '// Hello, world!\n\n// Another hello\n42': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [37, 39], + loc: { + start: { line: 4, column: 0 }, + end: { line: 4, column: 2 } + } + }, + range: [37, 39], + loc: { + start: { line: 4, column: 0 }, + end: { line: 4, column: 2 } + } + }], + range: [37, 39], + loc: { + start: { line: 4, column: 0 }, + end: { line: 4, column: 2 } + }, + comments: [{ + type: 'Line', + value: ' Hello, world!', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, { + type: 'Line', + value: ' Another hello', + range: [18, 36], + loc: { + start: { line: 3, column: 0 }, + end: { line: 3, column: 18 } + } + }] + }, + + 'if (x) { // Some comment\ndoThat(); }': { + type: 'Program', + body: [{ + type: 'IfStatement', + test: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + consequent: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'doThat', + range: [25, 31], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 6 } + } + }, + 'arguments': [], + range: [25, 33], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 8 } + } + }, + range: [25, 34], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 9 } + } + }], + range: [7, 36], + loc: { + start: { line: 1, column: 7 }, + end: { line: 2, column: 11 } + } + }, + alternate: null, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 11 } + } + }], + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 11 } + }, + comments: [{ + type: 'Line', + value: ' Some comment', + range: [9, 24], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 24 } + } + }] + }, + + 'switch (answer) { case 42: /* perfect */ bingo() }': { + type: 'Program', + body: [{ + type: 'SwitchStatement', + discriminant: { + type: 'Identifier', + name: 'answer', + range: [8, 14], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 14 } + } + }, + cases: [{ + type: 'SwitchCase', + test: { + type: 'Literal', + value: 42, + raw: '42', + range: [23, 25], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 25 } + } + }, + consequent: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'bingo', + range: [41, 46], + loc: { + start: { line: 1, column: 41 }, + end: { line: 1, column: 46 } + } + }, + 'arguments': [], + range: [41, 48], + loc: { + start: { line: 1, column: 41 }, + end: { line: 1, column: 48 } + } + }, + range: [41, 49], + loc: { + start: { line: 1, column: 41 }, + end: { line: 1, column: 49 } + } + }], + range: [18, 49], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 49 } + } + }], + range: [0, 50], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 50 } + } + }], + range: [0, 50], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 50 } + }, + comments: [{ + type: 'Block', + value: ' perfect ', + range: [27, 40], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 40 } + } + }] + } + + }, + + 'Numeric Literals': { + + '0': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0, + raw: '0', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + + '42': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42, + raw: '42', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + + '3': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 3, + raw: '3', + range: [0, 1] + }, + range: [0, 1] + }], + range: [0, 1], + tokens: [{ + type: 'Numeric', + value: '3', + range: [0, 1] + }] + }, + + '5': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 5, + raw: '5', + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + }, + tokens: [{ + type: 'Numeric', + value: '5', + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }] + }, + + '.14': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0.14, + raw: '.14', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + + '3.14159': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 3.14159, + raw: '3.14159', + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + '6.02214179e+23': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 6.02214179e+23, + raw: '6.02214179e+23', + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + + '1.492417830e-10': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 1.49241783e-10, + raw: '1.492417830e-10', + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + + '0x0': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0, + raw: '0x0', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + + '0e+100': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0, + raw: '0e+100', + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + '0xabc': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0xabc, + raw: '0xabc', + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + '0xdef': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0xdef, + raw: '0xdef', + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + '0X1A': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0x1A, + raw: '0X1A', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + + '0x10': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0x10, + raw: '0x10', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + + '0x100': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0x100, + raw: '0x100', + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + '0X04': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 0X04, + raw: '0X04', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + + '02': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 2, + raw: '02', + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + + '012': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 10, + raw: '012', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + + '0012': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 10, + raw: '0012', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + } + + }, + + 'String Literals': { + + '"Hello"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello', + raw: '"Hello"', + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + '"\\n\\r\\t\\v\\b\\f\\\\\\\'\\"\\0"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: '\n\r\t\x0B\b\f\\\'"\x00', + raw: '"\\n\\r\\t\\v\\b\\f\\\\\\\'\\"\\0"', + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + }, + + '"\\u0061"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'a', + raw: '"\\u0061"', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + + '"\\x61"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'a', + raw: '"\\x61"', + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + '"\\u00"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'u00', + raw: '"\\u00"', + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + '"\\xt"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'xt', + raw: '"\\xt"', + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + '"Hello\\nworld"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\nworld', + raw: '"Hello\\nworld"', + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + + '"Hello\\\nworld"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Helloworld', + raw: '"Hello\\\nworld"', + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 14 } + } + }, + + '"Hello\\02World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\u0002World', + raw: '"Hello\\02World"', + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + + '"Hello\\012World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\u000AWorld', + raw: '"Hello\\012World"', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + '"Hello\\122World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\122World', + raw: '"Hello\\122World"', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + '"Hello\\0122World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\u000A2World', + raw: '"Hello\\0122World"', + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + + '"Hello\\312World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\u00CAWorld', + raw: '"Hello\\312World"', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + '"Hello\\412World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\412World', + raw: '"Hello\\412World"', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + '"Hello\\812World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello812World', + raw: '"Hello\\812World"', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + '"Hello\\712World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\712World', + raw: '"Hello\\712World"', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + '"Hello\\0World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\u0000World', + raw: '"Hello\\0World"', + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + + '"Hello\\\r\nworld"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Helloworld', + raw: '"Hello\\\r\nworld"', + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 15 } + } + }, + + '"Hello\\1World"': { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'Hello\u0001World', + raw: '"Hello\\1World"', + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + } + }, + + 'Regular Expression Literals': { + + 'var x = /[a-z]/i': { + type: 'Program', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: '/[a-z]/i', + raw: '/[a-z]/i', + range: [8, 16], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 16 } + } + }, + range: [4, 16], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 16 } + } + }], + kind: 'var', + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }], + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + }, + tokens: [{ + type: 'Keyword', + value: 'var', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Identifier', + value: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: '=', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'RegularExpression', + value: '/[a-z]/i', + range: [8, 16], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 16 } + } + }] + }, + + 'var x = /[x-z]/i': { + type: 'Program', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5] + }, + init: { + type: 'Literal', + value: '/[x-z]/i', + raw: '/[x-z]/i', + range: [8, 16] + }, + range: [4, 16] + }], + kind: 'var', + range: [0, 16] + }], + range: [0, 16], + tokens: [{ + type: 'Keyword', + value: 'var', + range: [0, 3] + }, { + type: 'Identifier', + value: 'x', + range: [4, 5] + }, { + type: 'Punctuator', + value: '=', + range: [6, 7] + }, { + type: 'RegularExpression', + value: '/[x-z]/i', + range: [8, 16] + }] + }, + + 'var x = /[a-c]/i': { + type: 'Program', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: '/[a-c]/i', + raw: '/[a-c]/i', + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 16 } + } + }, + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 16 } + } + }], + kind: 'var', + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + }, + tokens: [{ + type: 'Keyword', + value: 'var', + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Identifier', + value: 'x', + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: '=', + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'RegularExpression', + value: '/[a-c]/i', + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 16 } + } + }] + }, + + 'var x = /[P QR]/i': { + type: 'Program', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: '/[P QR]/i', + raw: '/[P QR]/i', + range: [8, 17], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 17 } + } + }, + range: [4, 17], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 17 } + } + }], + kind: 'var', + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }], + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + }, + tokens: [{ + type: 'Keyword', + value: 'var', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Identifier', + value: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: '=', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'RegularExpression', + value: '/[P QR]/i', + range: [8, 17], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 17 } + } + }] + }, + + 'var x = /[\\]/]/': { + type: 'Program', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: new RegExp('[\\]/]').toString(), + raw: '/[\\]/]/', + range: [8, 15], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 15 } + } + }, + range: [4, 15], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 15 } + } + }], + kind: 'var', + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }], + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + }, + tokens: [{ + type: 'Keyword', + value: 'var', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Identifier', + value: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: '=', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'RegularExpression', + value: '/[\\]/]/', + range: [8, 15], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 15 } + } + }] + }, + + 'var x = /foo\\/bar/': { + type: 'Program', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: '/foo\\/bar/', + raw: '/foo\\/bar/', + range: [8, 18], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 18 } + } + }, + range: [4, 18], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 18 } + } + }], + kind: 'var', + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + } + }], + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + }, + tokens: [{ + type: 'Keyword', + value: 'var', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Identifier', + value: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: '=', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'RegularExpression', + value: '/foo\\/bar/', + range: [8, 18], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 18 } + } + }] + }, + + 'var x = /=([^=\\s])+/g': { + type: 'Program', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: '/=([^=\\s])+/g', + raw: '/=([^=\\s])+/g', + range: [8, 21], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 21 } + } + }, + range: [4, 21], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 21 } + } + }], + kind: 'var', + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }], + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + }, + tokens: [{ + type: 'Keyword', + value: 'var', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Identifier', + value: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: '=', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'RegularExpression', + value: '/=([^=\\s])+/g', + range: [8, 21], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 21 } + } + }] + }, + + 'var x = /[P QR]/\\u0067': { + type: 'Program', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: '/[P QR]/g', + raw: '/[P QR]/\\u0067', + range: [8, 22], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 22 } + } + }, + range: [4, 22], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 22 } + } + }], + kind: 'var', + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + }], + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + }, + tokens: [{ + type: 'Keyword', + value: 'var', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Identifier', + value: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: '=', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'RegularExpression', + value: '/[P QR]/\\u0067', + range: [8, 22], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 22 } + } + }] + }, + + 'var x = /[P QR]/\\g': { + type: 'Program', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: '/[P QR]/g', + raw: '/[P QR]/\\g', + range: [8, 18], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 18 } + } + }, + range: [4, 18], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 18 } + } + }], + kind: 'var', + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + } + }], + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + }, + tokens: [{ + type: 'Keyword', + value: 'var', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Identifier', + value: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: '=', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'RegularExpression', + value: '/[P QR]/\\g', + range: [8, 18], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 18 } + } + }] + } + + }, + + 'Left-Hand-Side Expression': { + + 'new Button': { + type: 'ExpressionStatement', + expression: { + type: 'NewExpression', + callee: { + type: 'Identifier', + name: 'Button', + range: [4, 10], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 10 } + } + }, + 'arguments': [], + range: [0, 10], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 10 } + } + }, + range: [0, 10], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 10 } + } + }, + + 'new Button()': { + type: 'ExpressionStatement', + expression: { + type: 'NewExpression', + callee: { + type: 'Identifier', + name: 'Button', + range: [4, 10], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 10 } + } + }, + 'arguments': [], + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + + 'new new foo': { + type: 'ExpressionStatement', + expression: { + type: 'NewExpression', + callee: { + type: 'NewExpression', + callee: { + type: 'Identifier', + name: 'foo', + range: [8, 11], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 11 } + } + }, + 'arguments': [], + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, + 'arguments': [], + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + 'new new foo()': { + type: 'ExpressionStatement', + expression: { + type: 'NewExpression', + callee: { + type: 'NewExpression', + callee: { + type: 'Identifier', + name: 'foo', + range: [8, 11], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 11 } + } + }, + 'arguments': [], + range: [4, 13], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 13 } + } + }, + 'arguments': [], + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + + 'new foo().bar()': { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'MemberExpression', + computed: false, + object: { + type: 'NewExpression', + callee: { + type: 'Identifier', + name: 'foo', + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + 'arguments': [], + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + property: { + type: 'Identifier', + name: 'bar', + range: [10, 13], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + 'arguments': [], + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + range: [0, 15], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 15 } + } + }, + + 'new foo[bar]': { + type: 'ExpressionStatement', + expression: { + type: 'NewExpression', + callee: { + type: 'MemberExpression', + computed: true, + object: { + type: 'Identifier', + name: 'foo', + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + property: { + type: 'Identifier', + name: 'bar', + range: [8, 11], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 11 } + } + }, + range: [4, 12], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 12 } + } + }, + 'arguments': [], + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + + 'new foo.bar()': { + type: 'ExpressionStatement', + expression: { + type: 'NewExpression', + callee: { + type: 'MemberExpression', + computed: false, + object: { + type: 'Identifier', + name: 'foo', + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + property: { + type: 'Identifier', + name: 'bar', + range: [8, 11], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 11 } + } + }, + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, + 'arguments': [], + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + + '( new foo).bar()': { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'MemberExpression', + computed: false, + object: { + type: 'NewExpression', + callee: { + type: 'Identifier', + name: 'foo', + range: [6, 9], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 9 } + } + }, + 'arguments': [], + range: [2, 9], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 9 } + } + }, + property: { + type: 'Identifier', + name: 'bar', + range: [11, 14], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + 'arguments': [], + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + 'foo(bar, baz)': { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'foo', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'bar', + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, { + type: 'Identifier', + name: 'baz', + range: [9, 12], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 12 } + } + }], + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + + '( foo )()': { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'foo', + range: [5, 8], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 8 } + } + }, + 'arguments': [], + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + + 'universe.milkyway': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'Identifier', + name: 'milkyway', + range: [9, 17], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + + 'universe.milkyway.solarsystem': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'MemberExpression', + computed: false, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'Identifier', + name: 'milkyway', + range: [9, 17], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + property: { + type: 'Identifier', + name: 'solarsystem', + range: [18, 29], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 29 } + } + }, + range: [0, 29], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 29 } + } + }, + range: [0, 29], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 29 } + } + }, + + 'universe.milkyway.solarsystem.Earth': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'MemberExpression', + computed: false, + object: { + type: 'MemberExpression', + computed: false, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'Identifier', + name: 'milkyway', + range: [9, 17], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + property: { + type: 'Identifier', + name: 'solarsystem', + range: [18, 29], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 29 } + } + }, + range: [0, 29], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 29 } + } + }, + property: { + type: 'Identifier', + name: 'Earth', + range: [30, 35], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 35 } + } + }, + range: [0, 35], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 35 } + } + }, + range: [0, 35], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 35 } + } + }, + + 'universe[galaxyName, otherUselessName]': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: true, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'SequenceExpression', + expressions: [{ + type: 'Identifier', + name: 'galaxyName', + range: [9, 19], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 19 } + } + }, { + type: 'Identifier', + name: 'otherUselessName', + range: [21, 37], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 37 } + } + }], + range: [9, 37], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 37 } + } + }, + range: [0, 38], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 38 } + } + }, + range: [0, 38], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 38 } + } + }, + + 'universe[galaxyName]': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: true, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'Identifier', + name: 'galaxyName', + range: [9, 19], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 19 } + } + }, + range: [0, 20], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 20 } + } + }, + range: [0, 20], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 20 } + } + }, + + 'universe[42].galaxies': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'MemberExpression', + computed: true, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'Literal', + value: 42, + raw: '42', + range: [9, 11], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + property: { + type: 'Identifier', + name: 'galaxies', + range: [13, 21], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + + 'universe(42).galaxies': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + 'arguments': [{ + type: 'Literal', + value: 42, + raw: '42', + range: [9, 11], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 11 } + } + }], + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + property: { + type: 'Identifier', + name: 'galaxies', + range: [13, 21], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + + 'universe(42).galaxies(14, 3, 77).milkyway': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'CallExpression', + callee: { + type: 'MemberExpression', + computed: false, + object: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + 'arguments': [{ + type: 'Literal', + value: 42, + raw: '42', + range: [9, 11], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 11 } + } + }], + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + property: { + type: 'Identifier', + name: 'galaxies', + range: [13, 21], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + 'arguments': [{ + type: 'Literal', + value: 14, + raw: '14', + range: [22, 24], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 24 } + } + }, { + type: 'Literal', + value: 3, + raw: '3', + range: [26, 27], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 27 } + } + }, { + type: 'Literal', + value: 77, + raw: '77', + range: [29, 31], + loc: { + start: { line: 1, column: 29 }, + end: { line: 1, column: 31 } + } + }], + range: [0, 32], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 32 } + } + }, + property: { + type: 'Identifier', + name: 'milkyway', + range: [33, 41], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 41 } + } + }, + range: [0, 41], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 41 } + } + }, + range: [0, 41], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 41 } + } + }, + + 'earth.asia.Indonesia.prepareForElection(2014)': { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'MemberExpression', + computed: false, + object: { + type: 'MemberExpression', + computed: false, + object: { + type: 'MemberExpression', + computed: false, + object: { + type: 'Identifier', + name: 'earth', + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + property: { + type: 'Identifier', + name: 'asia', + range: [6, 10], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 10 } + } + }, + range: [0, 10], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 10 } + } + }, + property: { + type: 'Identifier', + name: 'Indonesia', + range: [11, 20], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 20 } + } + }, + range: [0, 20], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 20 } + } + }, + property: { + type: 'Identifier', + name: 'prepareForElection', + range: [21, 39], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 39 } + } + }, + range: [0, 39], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 39 } + } + }, + 'arguments': [{ + type: 'Literal', + value: 2014, + raw: '2014', + range: [40, 44], + loc: { + start: { line: 1, column: 40 }, + end: { line: 1, column: 44 } + } + }], + range: [0, 45], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 45 } + } + }, + range: [0, 45], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 45 } + } + }, + + 'universe.if': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'Identifier', + name: 'if', + range: [9, 11], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + 'universe.true': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'Identifier', + name: 'true', + range: [9, 13], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + + 'universe.false': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'Identifier', + name: 'false', + range: [9, 14], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + + 'universe.null': { + type: 'ExpressionStatement', + expression: { + type: 'MemberExpression', + computed: false, + object: { + type: 'Identifier', + name: 'universe', + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + property: { + type: 'Identifier', + name: 'null', + range: [9, 13], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + } + + }, + + 'Postfix Expressions': { + + 'x++': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + prefix: false, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + + 'x--': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + prefix: false, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + + 'eval++': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'eval', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + prefix: false, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'eval--': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'eval', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + prefix: false, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'arguments++': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'arguments', + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + prefix: false, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + 'arguments--': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'arguments', + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + prefix: false, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + } + + }, + + 'Unary Operators': { + + '++x': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'x', + range: [2, 3], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 3 } + } + }, + prefix: true, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + + '--x': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'x', + range: [2, 3], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 3 } + } + }, + prefix: true, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + + '++eval': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'eval', + range: [2, 6], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 6 } + } + }, + prefix: true, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + '--eval': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'eval', + range: [2, 6], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 6 } + } + }, + prefix: true, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + '++arguments': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'arguments', + range: [2, 11], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 11 } + } + }, + prefix: true, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + '--arguments': { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'arguments', + range: [2, 11], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 11 } + } + }, + prefix: true, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + '+x': { + type: 'ExpressionStatement', + expression: { + type: 'UnaryExpression', + operator: '+', + argument: { + type: 'Identifier', + name: 'x', + range: [1, 2], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 2 } + } + }, + prefix: true, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + + '-x': { + type: 'ExpressionStatement', + expression: { + type: 'UnaryExpression', + operator: '-', + argument: { + type: 'Identifier', + name: 'x', + range: [1, 2], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 2 } + } + }, + prefix: true, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + + '~x': { + type: 'ExpressionStatement', + expression: { + type: 'UnaryExpression', + operator: '~', + argument: { + type: 'Identifier', + name: 'x', + range: [1, 2], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 2 } + } + }, + prefix: true, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + + '!x': { + type: 'ExpressionStatement', + expression: { + type: 'UnaryExpression', + operator: '!', + argument: { + type: 'Identifier', + name: 'x', + range: [1, 2], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 2 } + } + }, + prefix: true, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + }, + + 'void x': { + type: 'ExpressionStatement', + expression: { + type: 'UnaryExpression', + operator: 'void', + argument: { + type: 'Identifier', + name: 'x', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + prefix: true, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'delete x': { + type: 'ExpressionStatement', + expression: { + type: 'UnaryExpression', + operator: 'delete', + argument: { + type: 'Identifier', + name: 'x', + range: [7, 8], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + } + }, + prefix: true, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + + 'typeof x': { + type: 'ExpressionStatement', + expression: { + type: 'UnaryExpression', + operator: 'typeof', + argument: { + type: 'Identifier', + name: 'x', + range: [7, 8], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + } + }, + prefix: true, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + } + + }, + + 'Multiplicative Operators': { + + 'x * y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + 'x / y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '/', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + 'x % y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '%', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + } + + }, + + 'Additive Operators': { + + 'x + y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + 'x - y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '-', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + } + + }, + + 'Bitwise Shift Operator': { + + 'x << y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '<<', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x >> y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '>>', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x >>> y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '>>>', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + } + + }, + + 'Relational Operators': { + + 'x < y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '<', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + 'x > y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '>', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + 'x <= y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '<=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x >= y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '>=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x in y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: 'in', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x instanceof y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: 'instanceof', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [13, 14], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + + 'x < y < z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '<', + left: { + type: 'BinaryExpression', + operator: '<', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + } + + }, + + 'Equality Operators': { + + 'x == y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '==', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x != y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '!=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x === y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '===', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x !== y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '!==', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + } + + }, + + 'Binary Bitwise Operators': { + + 'x & y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '&', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + 'x ^ y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '^', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + 'x | y': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '|', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + } + + }, + + 'Binary Expressions': { + + 'x + y + z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x - y + z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'BinaryExpression', + operator: '-', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x + y - z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '-', + left: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x - y - z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '-', + left: { + type: 'BinaryExpression', + operator: '-', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x + y * z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x + y / z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '+', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'BinaryExpression', + operator: '/', + left: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x - y % z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '-', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'BinaryExpression', + operator: '%', + left: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x * y * z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x * y / z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '/', + left: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x * y % z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '%', + left: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x % y * z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'BinaryExpression', + operator: '%', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x << y << z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '<<', + left: { + type: 'BinaryExpression', + operator: '<<', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [10, 11], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + 'x | y | z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '|', + left: { + type: 'BinaryExpression', + operator: '|', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x & y & z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '&', + left: { + type: 'BinaryExpression', + operator: '&', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x ^ y ^ z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '^', + left: { + type: 'BinaryExpression', + operator: '^', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x & y | z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '|', + left: { + type: 'BinaryExpression', + operator: '&', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x | y ^ z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '|', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'BinaryExpression', + operator: '^', + left: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x | y & z': { + type: 'ExpressionStatement', + expression: { + type: 'BinaryExpression', + operator: '|', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'BinaryExpression', + operator: '&', + left: { + type: 'Identifier', + name: 'y', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + } + + }, + + 'Binary Logical Operators': { + + 'x || y': { + type: 'ExpressionStatement', + expression: { + type: 'LogicalExpression', + operator: '||', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x && y': { + type: 'ExpressionStatement', + expression: { + type: 'LogicalExpression', + operator: '&&', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'x || y || z': { + type: 'ExpressionStatement', + expression: { + type: 'LogicalExpression', + operator: '||', + left: { + type: 'LogicalExpression', + operator: '||', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [10, 11], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + 'x && y && z': { + type: 'ExpressionStatement', + expression: { + type: 'LogicalExpression', + operator: '&&', + left: { + type: 'LogicalExpression', + operator: '&&', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [10, 11], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + 'x || y && z': { + type: 'ExpressionStatement', + expression: { + type: 'LogicalExpression', + operator: '||', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'LogicalExpression', + operator: '&&', + left: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [10, 11], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + } + }, + range: [5, 11], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + 'x || y ^ z': { + type: 'ExpressionStatement', + expression: { + type: 'LogicalExpression', + operator: '||', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'BinaryExpression', + operator: '^', + left: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + right: { + type: 'Identifier', + name: 'z', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, + range: [5, 10], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 10 } + } + }, + range: [0, 10], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 10 } + } + }, + range: [0, 10], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 10 } + } + } + + }, + + 'Conditional Operator': { + + 'y ? 1 : 2': { + type: 'ExpressionStatement', + expression: { + type: 'ConditionalExpression', + test: { + type: 'Identifier', + name: 'y', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + consequent: { + type: 'Literal', + value: 1, + raw: '1', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + alternate: { + type: 'Literal', + value: 2, + raw: '2', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x && y ? 1 : 2': { + type: 'ExpressionStatement', + expression: { + type: 'ConditionalExpression', + test: { + type: 'LogicalExpression', + operator: '&&', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + consequent: { + type: 'Literal', + value: 1, + raw: '1', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, + alternate: { + type: 'Literal', + value: 2, + raw: '2', + range: [13, 14], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + } + + }, + + 'Assignment Operators': { + + 'x = 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [4, 6], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'eval = 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'eval', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [7, 9], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'arguments = 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'arguments', + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [12, 14], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + + 'x *= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '*=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x /= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '/=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x %= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '%=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x += 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '+=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x -= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '-=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x <<= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '<<=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [6, 8], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + + 'x >>= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '>>=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [6, 8], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + + 'x >>>= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '>>>=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [7, 9], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'x &= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '&=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x ^= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '^=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + 'x |= 42': { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '|=', + left: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [5, 7], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + } + + }, + + 'Block': { + + '{ foo }': { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'foo', + range: [2, 5], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 5 } + } + }, + range: [2, 6], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 6 } + } + }], + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + '{ doThis(); doThat(); }': { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'doThis', + range: [2, 8], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 8 } + } + }, + 'arguments': [], + range: [2, 10], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 10 } + } + }, + range: [2, 11], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 11 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'doThat', + range: [12, 18], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 18 } + } + }, + 'arguments': [], + range: [12, 20], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 20 } + } + }, + range: [12, 21], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 21 } + } + }], + range: [0, 23], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 23 } + } + }, + + '{}': { + type: 'BlockStatement', + body: [], + range: [0, 2], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } + } + } + + }, + + 'Variable Statement': { + + 'var x': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: null, + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }], + kind: 'var', + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + 'var x, y;': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: null, + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'y', + range: [7, 8], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + } + }, + init: null, + range: [7, 8], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + } + }], + kind: 'var', + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'var x = 42': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: 42, + raw: '42', + range: [8, 10], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 10 } + } + }, + range: [4, 10], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 10 } + } + }], + kind: 'var', + range: [0, 10], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 10 } + } + }, + + 'var eval = 42, arguments = 42': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'eval', + range: [4, 8], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 8 } + } + }, + init: { + type: 'Literal', + value: 42, + raw: '42', + range: [11, 13], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 13 } + } + }, + range: [4, 13], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 13 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'arguments', + range: [15, 24], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 24 } + } + }, + init: { + type: 'Literal', + value: 42, + raw: '42', + range: [27, 29], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 29 } + } + }, + range: [15, 29], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 29 } + } + }], + kind: 'var', + range: [0, 29], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 29 } + } + }, + + 'var x = 14, y = 3, z = 1977': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: { + type: 'Literal', + value: 14, + raw: '14', + range: [8, 10], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 10 } + } + }, + range: [4, 10], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 10 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'y', + range: [12, 13], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 13 } + } + }, + init: { + type: 'Literal', + value: 3, + raw: '3', + range: [16, 17], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + } + }, + range: [12, 17], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 17 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'z', + range: [19, 20], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + } + }, + init: { + type: 'Literal', + value: 1977, + raw: '1977', + range: [23, 27], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 27 } + } + }, + range: [19, 27], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 27 } + } + }], + kind: 'var', + range: [0, 27], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 27 } + } + }, + + 'var implements, interface, package': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'implements', + range: [4, 14], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 14 } + } + }, + init: null, + range: [4, 14], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 14 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'interface', + range: [16, 25], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 25 } + } + }, + init: null, + range: [16, 25], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 25 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'package', + range: [27, 34], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 34 } + } + }, + init: null, + range: [27, 34], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 34 } + } + }], + kind: 'var', + range: [0, 34], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 34 } + } + }, + + 'var private, protected, public, static': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'private', + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, + init: null, + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'protected', + range: [13, 22], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 22 } + } + }, + init: null, + range: [13, 22], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 22 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'public', + range: [24, 30], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 30 } + } + }, + init: null, + range: [24, 30], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 30 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'static', + range: [32, 38], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 38 } + } + }, + init: null, + range: [32, 38], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 38 } + } + }], + kind: 'var', + range: [0, 38], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 38 } + } + } + + }, + + 'Let Statement': { + + 'let x': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: null, + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }], + kind: 'let', + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + + '{ let x }': { + type: 'BlockStatement', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + init: null, + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }], + kind: 'let', + range: [2, 8], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 8 } + } + }], + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + '{ let x = 42 }': { + type: 'BlockStatement', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + init: { + type: 'Literal', + value: 42, + raw: '42', + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + range: [6, 12], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + } + }], + kind: 'let', + range: [2, 13], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 13 } + } + }], + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + }, + + '{ let x = 14, y = 3, z = 1977 }': { + type: 'BlockStatement', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + init: { + type: 'Literal', + value: 14, + raw: '14', + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + range: [6, 12], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'y', + range: [14, 15], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 15 } + } + }, + init: { + type: 'Literal', + value: 3, + raw: '3', + range: [18, 19], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + } + }, + range: [14, 19], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 19 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'z', + range: [21, 22], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 22 } + } + }, + init: { + type: 'Literal', + value: 1977, + raw: '1977', + range: [25, 29], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 29 } + } + }, + range: [21, 29], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 29 } + } + }], + kind: 'let', + range: [2, 30], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 30 } + } + }], + range: [0, 31], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 31 } + } + } + + }, + + 'Const Statement': { + + 'const x = 42': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + init: { + type: 'Literal', + value: 42, + raw: '42', + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + range: [6, 12], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + } + }], + kind: 'const', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + + '{ const x = 42 }': { + type: 'BlockStatement', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + init: { + type: 'Literal', + value: 42, + raw: '42', + range: [12, 14], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 14 } + } + }, + range: [8, 14], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 14 } + } + }], + kind: 'const', + range: [2, 15], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 15 } + } + }], + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + + '{ const x = 14, y = 3, z = 1977 }': { + type: 'BlockStatement', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + init: { + type: 'Literal', + value: 14, + raw: '14', + range: [12, 14], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 14 } + } + }, + range: [8, 14], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 14 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'y', + range: [16, 17], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + } + }, + init: { + type: 'Literal', + value: 3, + raw: '3', + range: [20, 21], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 21 } + } + }, + range: [16, 21], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 21 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'z', + range: [23, 24], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 24 } + } + }, + init: { + type: 'Literal', + value: 1977, + raw: '1977', + range: [27, 31], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 31 } + } + }, + range: [23, 31], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 31 } + } + }], + kind: 'const', + range: [2, 32], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 32 } + } + }], + range: [0, 33], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 33 } + } + } + + }, + + 'Empty Statement': { + + ';': { + type: 'EmptyStatement', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + } + + }, + + 'Expression Statement': { + + 'x': { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + + 'x, y': { + type: 'ExpressionStatement', + expression: { + type: 'SequenceExpression', + expressions: [{ + type: 'Identifier', + name: 'x', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, { + type: 'Identifier', + name: 'y', + range: [3, 4], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + } + }], + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + + '\\u0061': { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'a', + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }, + + 'a\\u0061': { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'aa', + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 7], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + } + }, + + '\\ua': { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'ua', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + + 'a\\u': { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'au', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + } + + }, + + 'If Statement': { + + 'if (morning) goodMorning()': { + type: 'IfStatement', + test: { + type: 'Identifier', + name: 'morning', + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, + consequent: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'goodMorning', + range: [13, 24], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 24 } + } + }, + 'arguments': [], + range: [13, 26], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 26 } + } + }, + range: [13, 26], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 26 } + } + }, + alternate: null, + range: [0, 26], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 26 } + } + }, + + 'if (morning) (function(){})': { + type: 'IfStatement', + test: { + type: 'Identifier', + name: 'morning', + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, + consequent: { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [24, 26], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 26 } + } + }, + rest: null, + generator: false, + expression: false, + range: [14, 26], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 26 } + } + }, + range: [13, 27], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 27 } + } + }, + alternate: null, + range: [0, 27], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 27 } + } + }, + + 'if (morning) var x = 0;': { + type: 'IfStatement', + test: { + type: 'Identifier', + name: 'morning', + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, + consequent: { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [17, 18], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 18 } + } + }, + init: { + type: 'Literal', + value: 0, + raw: '0', + range: [21, 22], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 22 } + } + }, + range: [17, 22], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 22 } + } + }], + kind: 'var', + range: [13, 23], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 23 } + } + }, + alternate: null, + range: [0, 23], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 23 } + } + }, + + 'if (morning) function a(){}': { + type: 'IfStatement', + test: { + type: 'Identifier', + name: 'morning', + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, + consequent: { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'a', + range: [22, 23], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 23 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [25, 27], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 27 } + } + }, + rest: null, + generator: false, + expression: false, + range: [13, 27], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 27 } + } + }, + alternate: null, + range: [0, 27], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 27 } + } + }, + + 'if (morning) goodMorning(); else goodDay()': { + type: 'IfStatement', + test: { + type: 'Identifier', + name: 'morning', + range: [4, 11], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 11 } + } + }, + consequent: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'goodMorning', + range: [13, 24], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 24 } + } + }, + 'arguments': [], + range: [13, 26], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 26 } + } + }, + range: [13, 27], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 27 } + } + }, + alternate: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'goodDay', + range: [33, 40], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 40 } + } + }, + 'arguments': [], + range: [33, 42], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 42 } + } + }, + range: [33, 42], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 42 } + } + }, + range: [0, 42], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 42 } + } + } + + }, + + 'Iteration Statements': { + + 'do keep(); while (true)': { + type: 'DoWhileStatement', + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'keep', + range: [3, 7], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 7 } + } + }, + 'arguments': [], + range: [3, 9], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 9 } + } + }, + range: [3, 10], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 10 } + } + }, + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [18, 22], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 23], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 23 } + } + }, + + 'do keep(); while (true);': { + type: 'DoWhileStatement', + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'keep', + range: [3, 7], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 7 } + } + }, + 'arguments': [], + range: [3, 9], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 9 } + } + }, + range: [3, 10], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 10 } + } + }, + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [18, 22], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 24], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 24 } + } + }, + + 'do { x++; y--; } while (x < 10)': { + type: 'DoWhileStatement', + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'x', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + prefix: false, + range: [5, 8], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 8 } + } + }, + range: [5, 9], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 9 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'y', + range: [10, 11], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + } + }, + prefix: false, + range: [10, 13], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 13 } + } + }, + range: [10, 14], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 14 } + } + }], + range: [3, 16], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 16 } + } + }, + test: { + type: 'BinaryExpression', + operator: '<', + left: { + type: 'Identifier', + name: 'x', + range: [24, 25], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + } + }, + right: { + type: 'Literal', + value: 10, + raw: '10', + range: [28, 30], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 30 } + } + }, + range: [24, 30], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 30 } + } + }, + range: [0, 31], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 31 } + } + }, + + '{ do { } while (false) false }': { + type: 'BlockStatement', + body: [{ + type: 'DoWhileStatement', + body: { + type: 'BlockStatement', + body: [], + range: [5, 8], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 8 } + } + }, + test: { + type: 'Literal', + value: false, + raw: 'false', + range: [16, 21], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 21 } + } + }, + range: [2, 22], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 22 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: false, + raw: 'false', + range: [23, 28], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 28 } + } + }, + range: [23, 29], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 29 } + } + }], + range: [0, 30], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 30 } + } + }, + + 'while (true) doSomething()': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'doSomething', + range: [13, 24], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 24 } + } + }, + 'arguments': [], + range: [13, 26], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 26 } + } + }, + range: [13, 26], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 26 } + } + }, + range: [0, 26], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 26 } + } + }, + + 'while (x < 10) { x++; y--; }': { + type: 'WhileStatement', + test: { + type: 'BinaryExpression', + operator: '<', + left: { + type: 'Identifier', + name: 'x', + range: [7, 8], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + } + }, + right: { + type: 'Literal', + value: 10, + raw: '10', + range: [11, 13], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 13 } + } + }, + range: [7, 13], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 13 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'x', + range: [17, 18], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 18 } + } + }, + prefix: false, + range: [17, 20], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 20 } + } + }, + range: [17, 21], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 21 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'y', + range: [22, 23], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 23 } + } + }, + prefix: false, + range: [22, 25], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 25 } + } + }, + range: [22, 26], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 26 } + } + }], + range: [15, 28], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 28 } + } + }, + range: [0, 28], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 28 } + } + }, + + 'for(;;);': { + type: 'ForStatement', + init: null, + test: null, + update: null, + body: { + type: 'EmptyStatement', + range: [7, 8], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + + 'for(;;){}': { + type: 'ForStatement', + init: null, + test: null, + update: null, + body: { + type: 'BlockStatement', + body: [], + range: [7, 9], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 9 } + } + }, + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + }, + + 'for(x = 0;;);': { + type: 'ForStatement', + init: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Literal', + value: 0, + raw: '0', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + test: null, + update: null, + body: { + type: 'EmptyStatement', + range: [12, 13], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + + 'for(var x = 0;;);': { + type: 'ForStatement', + init: { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + init: { + type: 'Literal', + value: 0, + raw: '0', + range: [12, 13], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 13 } + } + }, + range: [8, 13], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 13 } + } + }], + kind: 'var', + range: [4, 13], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 13 } + } + }, + test: null, + update: null, + body: { + type: 'EmptyStatement', + range: [16, 17], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + + 'for(let x = 0;;);': { + type: 'ForStatement', + init: { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + init: { + type: 'Literal', + value: 0, + raw: '0', + range: [12, 13], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 13 } + } + }, + range: [8, 13], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 13 } + } + }], + kind: 'let', + range: [4, 13], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 13 } + } + }, + test: null, + update: null, + body: { + type: 'EmptyStatement', + range: [16, 17], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }, + + 'for(var x = 0, y = 1;;);': { + type: 'ForStatement', + init: { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + init: { + type: 'Literal', + value: 0, + raw: '0', + range: [12, 13], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 13 } + } + }, + range: [8, 13], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 13 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'y', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, + init: { + type: 'Literal', + value: 1, + raw: '1', + range: [19, 20], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + } + }, + range: [15, 20], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 20 } + } + }], + kind: 'var', + range: [4, 20], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 20 } + } + }, + test: null, + update: null, + body: { + type: 'EmptyStatement', + range: [23, 24], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 24 } + } + }, + range: [0, 24], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 24 } + } + }, + + 'for(x = 0; x < 42;);': { + type: 'ForStatement', + init: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Literal', + value: 0, + raw: '0', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + test: { + type: 'BinaryExpression', + operator: '<', + left: { + type: 'Identifier', + name: 'x', + range: [11, 12], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 12 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [15, 17], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 17 } + } + }, + range: [11, 17], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 17 } + } + }, + update: null, + body: { + type: 'EmptyStatement', + range: [19, 20], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + } + }, + range: [0, 20], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 20 } + } + }, + + 'for(x = 0; x < 42; x++);': { + type: 'ForStatement', + init: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Literal', + value: 0, + raw: '0', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + test: { + type: 'BinaryExpression', + operator: '<', + left: { + type: 'Identifier', + name: 'x', + range: [11, 12], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 12 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [15, 17], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 17 } + } + }, + range: [11, 17], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 17 } + } + }, + update: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'x', + range: [19, 20], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + } + }, + prefix: false, + range: [19, 22], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 22 } + } + }, + body: { + type: 'EmptyStatement', + range: [23, 24], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 24 } + } + }, + range: [0, 24], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 24 } + } + }, + + 'for(x = 0; x < 42; x++) process(x);': { + type: 'ForStatement', + init: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Literal', + value: 0, + raw: '0', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + test: { + type: 'BinaryExpression', + operator: '<', + left: { + type: 'Identifier', + name: 'x', + range: [11, 12], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 12 } + } + }, + right: { + type: 'Literal', + value: 42, + raw: '42', + range: [15, 17], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 17 } + } + }, + range: [11, 17], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 17 } + } + }, + update: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'x', + range: [19, 20], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + } + }, + prefix: false, + range: [19, 22], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 22 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'process', + range: [24, 31], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 31 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'x', + range: [32, 33], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 33 } + } + }], + range: [24, 34], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 34 } + } + }, + range: [24, 35], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 35 } + } + }, + range: [0, 35], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 35 } + } + }, + + 'for(x in list) process(x);': { + type: 'ForInStatement', + left: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + right: { + type: 'Identifier', + name: 'list', + range: [9, 13], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 13 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'process', + range: [15, 22], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 22 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'x', + range: [23, 24], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 24 } + } + }], + range: [15, 25], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 25 } + } + }, + range: [15, 26], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 26 } + } + }, + each: false, + range: [0, 26], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 26 } + } + }, + + 'for (var x in list) process(x);': { + type: 'ForInStatement', + left: { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, + init: null, + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }], + kind: 'var', + range: [5, 10], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 10 } + } + }, + right: { + type: 'Identifier', + name: 'list', + range: [14, 18], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 18 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'process', + range: [20, 27], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 27 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'x', + range: [28, 29], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 29 } + } + }], + range: [20, 30], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 30 } + } + }, + range: [20, 31], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 31 } + } + }, + each: false, + range: [0, 31], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 31 } + } + }, + + 'for (var x = 42 in list) process(x);': { + type: 'ForInStatement', + left: { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, + init: { + type: 'Literal', + value: 42, + raw: '42', + range: [13, 15], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 15 } + } + }, + range: [9, 15], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 15 } + } + }], + kind: 'var', + range: [5, 15], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 15 } + } + }, + right: { + type: 'Identifier', + name: 'list', + range: [19, 23], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 23 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'process', + range: [25, 32], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 32 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'x', + range: [33, 34], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 34 } + } + }], + range: [25, 35], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 35 } + } + }, + range: [25, 36], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 36 } + } + }, + each: false, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + } + }, + + 'for (let x in list) process(x);': { + type: 'ForInStatement', + left: { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, + init: null, + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }], + kind: 'let', + range: [5, 10], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 10 } + } + }, + right: { + type: 'Identifier', + name: 'list', + range: [14, 18], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 18 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'process', + range: [20, 27], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 27 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'x', + range: [28, 29], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 29 } + } + }], + range: [20, 30], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 30 } + } + }, + range: [20, 31], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 31 } + } + }, + each: false, + range: [0, 31], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 31 } + } + }, + + 'for (let x = 42 in list) process(x);': { + type: 'ForInStatement', + left: { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, + init: { + type: 'Literal', + value: 42, + raw: '42', + range: [13, 15], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 15 } + } + }, + range: [9, 15], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 15 } + } + }], + kind: 'let', + range: [5, 15], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 15 } + } + }, + right: { + type: 'Identifier', + name: 'list', + range: [19, 23], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 23 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'process', + range: [25, 32], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 32 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'x', + range: [33, 34], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 34 } + } + }], + range: [25, 35], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 35 } + } + }, + range: [25, 36], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 36 } + } + }, + each: false, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + } + }, + + 'for (var i = function() { return 10 in [] } in list) process(x);': { + type: 'ForInStatement', + left: { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'i', + range: [9, 10], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + } + }, + init: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ReturnStatement', + argument: { + type: 'BinaryExpression', + operator: 'in', + left: { + type: 'Literal', + value: 10, + raw: '10', + range: [33, 35], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 35 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [39, 41], + loc: { + start: { line: 1, column: 39 }, + end: { line: 1, column: 41 } + } + }, + range: [33, 41], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 41 } + } + }, + range: [26, 42], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 42 } + } + }], + range: [24, 43], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 43 } + } + }, + rest: null, + generator: false, + expression: false, + range: [13, 43], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 43 } + } + }, + range: [9, 43], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 43 } + } + }], + kind: 'var', + range: [5, 43], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 43 } + } + }, + right: { + type: 'Identifier', + name: 'list', + range: [47, 51], + loc: { + start: { line: 1, column: 47 }, + end: { line: 1, column: 51 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'process', + range: [53, 60], + loc: { + start: { line: 1, column: 53 }, + end: { line: 1, column: 60 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'x', + range: [61, 62], + loc: { + start: { line: 1, column: 61 }, + end: { line: 1, column: 62 } + } + }], + range: [53, 63], + loc: { + start: { line: 1, column: 53 }, + end: { line: 1, column: 63 } + } + }, + range: [53, 64], + loc: { + start: { line: 1, column: 53 }, + end: { line: 1, column: 64 } + } + }, + each: false, + range: [0, 64], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 64 } + } + } + + }, + + 'continue statement': { + + 'while (true) { continue; }': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'BlockStatement', + body: [ + { + type: 'ContinueStatement', + label: null, + range: [15, 24], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 24 } + } + } + ], + range: [13, 26], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 26 } + } + }, + range: [0, 26], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 26 } + } + }, + + 'while (true) { continue }': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'BlockStatement', + body: [ + { + type: 'ContinueStatement', + label: null, + range: [15, 24], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 24 } + } + } + ], + range: [13, 25], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 25 } + } + }, + range: [0, 25], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 25 } + } + }, + + 'done: while (true) { continue done }': { + type: 'LabeledStatement', + label: { + type: 'Identifier', + name: 'done', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + body: { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [13, 17], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 17 } + } + }, + body: { + type: 'BlockStatement', + body: [ + { + type: 'ContinueStatement', + label: { + type: 'Identifier', + name: 'done', + range: [30, 34], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 34 } + } + }, + range: [21, 35], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 35 } + } + } + ], + range: [19, 36], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 36 } + } + }, + range: [6, 36], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 36 } + } + }, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + } + }, + + 'done: while (true) { continue done; }': { + type: 'LabeledStatement', + label: { + type: 'Identifier', + name: 'done', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + body: { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [13, 17], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 17 } + } + }, + body: { + type: 'BlockStatement', + body: [ + { + type: 'ContinueStatement', + label: { + type: 'Identifier', + name: 'done', + range: [30, 34], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 34 } + } + }, + range: [21, 35], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 35 } + } + } + ], + range: [19, 37], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 37 } + } + }, + range: [6, 37], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 37 } + } + }, + range: [0, 37], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 37 } + } + } + + }, + + 'break statement': { + + 'while (true) { break }': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'BlockStatement', + body: [ + { + type: 'BreakStatement', + label: null, + range: [15, 21], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 21 } + } + } + ], + range: [13, 22], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + }, + + 'done: while (true) { break done }': { + type: 'LabeledStatement', + label: { + type: 'Identifier', + name: 'done', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + body: { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [13, 17], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 17 } + } + }, + body: { + type: 'BlockStatement', + body: [ + { + type: 'BreakStatement', + label: { + type: 'Identifier', + name: 'done', + range: [27, 31], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 31 } + } + }, + range: [21, 32], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 32 } + } + } + ], + range: [19, 33], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 33 } + } + }, + range: [6, 33], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 33 } + } + }, + range: [0, 33], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 33 } + } + }, + + 'done: while (true) { break done; }': { + type: 'LabeledStatement', + label: { + type: 'Identifier', + name: 'done', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + body: { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [13, 17], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 17 } + } + }, + body: { + type: 'BlockStatement', + body: [ + { + type: 'BreakStatement', + label: { + type: 'Identifier', + name: 'done', + range: [27, 31], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 31 } + } + }, + range: [21, 32], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 32 } + } + } + ], + range: [19, 34], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 34 } + } + }, + range: [6, 34], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 34 } + } + }, + range: [0, 34], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 34 } + } + } + + }, + + 'return statement': { + + '(function(){ return })': { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [ + { + type: 'ReturnStatement', + argument: null, + range: [13, 20], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 20 } + } + } + ], + range: [11, 21], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 21 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 21], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 21 } + } + }, + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + }, + + '(function(){ return; })': { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [ + { + type: 'ReturnStatement', + argument: null, + range: [13, 20], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 20 } + } + } + ], + range: [11, 22], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 22 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 22], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 23], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 23 } + } + }, + + '(function(){ return x; })': { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [ + { + type: 'ReturnStatement', + argument: { + type: 'Identifier', + name: 'x', + range: [20, 21], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 21 } + } + }, + range: [13, 22], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 22 } + } + } + ], + range: [11, 24], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 24 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 24], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 24 } + } + }, + range: [0, 25], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 25 } + } + }, + + '(function(){ return x * y })': { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [ + { + type: 'ReturnStatement', + argument: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'Identifier', + name: 'x', + range: [20, 21], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 21 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [24, 25], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + } + }, + range: [20, 25], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 25 } + } + }, + range: [13, 26], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 26 } + } + } + ], + range: [11, 27], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 27 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 27], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 27 } + } + }, + range: [0, 28], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 28 } + } + } + }, + + 'with statement': { + + 'with (x) foo = bar': { + type: 'WithStatement', + object: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'foo', + range: [9, 12], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 12 } + } + }, + right: { + type: 'Identifier', + name: 'bar', + range: [15, 18], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 18 } + } + }, + range: [9, 18], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 18 } + } + }, + range: [9, 18], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 18 } + } + }, + range: [0, 18], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + } + }, + + 'with (x) foo = bar;': { + type: 'WithStatement', + object: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + body: { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'foo', + range: [9, 12], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 12 } + } + }, + right: { + type: 'Identifier', + name: 'bar', + range: [15, 18], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 18 } + } + }, + range: [9, 18], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 18 } + } + }, + range: [9, 19], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 19 } + } + }, + range: [0, 19], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + } + }, + + 'with (x) { foo = bar }': { + type: 'WithStatement', + object: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'foo', + range: [11, 14], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 14 } + } + }, + right: { + type: 'Identifier', + name: 'bar', + range: [17, 20], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 20 } + } + }, + range: [11, 20], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 20 } + } + }, + range: [11, 21], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 21 } + } + }], + range: [9, 22], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 22 } + } + }, + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + } + } + + }, + + 'switch statement': { + + 'switch (x) {}': { + type: 'SwitchStatement', + discriminant: { + type: 'Identifier', + name: 'x', + range: [8, 9], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + } + }, + cases:[], + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, + + 'switch (answer) { case 42: hi(); break; }': { + type: 'SwitchStatement', + discriminant: { + type: 'Identifier', + name: 'answer', + range: [8, 14], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 14 } + } + }, + cases: [{ + type: 'SwitchCase', + test: { + type: 'Literal', + value: 42, + raw: '42', + range: [23, 25], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 25 } + } + }, + consequent: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'hi', + range: [27, 29], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 29 } + } + }, + 'arguments': [], + range: [27, 31], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 31 } + } + }, + range: [27, 32], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 32 } + } + }, { + type: 'BreakStatement', + label: null, + range: [33, 39], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 39 } + } + }], + range: [18, 39], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 39 } + } + }], + range: [0, 41], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 41 } + } + }, + + 'switch (answer) { case 42: hi(); break; default: break }': { + type: 'SwitchStatement', + discriminant: { + type: 'Identifier', + name: 'answer', + range: [8, 14], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 14 } + } + }, + cases: [{ + type: 'SwitchCase', + test: { + type: 'Literal', + value: 42, + raw: '42', + range: [23, 25], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 25 } + } + }, + consequent: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'hi', + range: [27, 29], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 29 } + } + }, + 'arguments': [], + range: [27, 31], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 31 } + } + }, + range: [27, 32], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 32 } + } + }, { + type: 'BreakStatement', + label: null, + range: [33, 39], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 39 } + } + }], + range: [18, 39], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 39 } + } + }, { + type: 'SwitchCase', + test: null, + consequent: [{ + type: 'BreakStatement', + label: null, + range: [49, 55], + loc: { + start: { line: 1, column: 49 }, + end: { line: 1, column: 55 } + } + }], + range: [40, 55], + loc: { + start: { line: 1, column: 40 }, + end: { line: 1, column: 55 } + } + }], + range: [0, 56], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 56 } + } + } + + }, + + 'Labelled Statements': { + + 'start: for (;;) break start': { + type: 'LabeledStatement', + label: { + type: 'Identifier', + name: 'start', + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + body: { + type: 'ForStatement', + init: null, + test: null, + update: null, + body: { + type: 'BreakStatement', + label: { + type: 'Identifier', + name: 'start', + range: [22, 27], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 27 } + } + }, + range: [16, 27], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 27 } + } + }, + range: [7, 27], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 27 } + } + }, + range: [0, 27], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 27 } + } + }, + + 'start: while (true) break start': { + type: 'LabeledStatement', + label: { + type: 'Identifier', + name: 'start', + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + body: { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [14, 18], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 18 } + } + }, + body: { + type: 'BreakStatement', + label: { + type: 'Identifier', + name: 'start', + range: [26, 31], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 31 } + } + }, + range: [20, 31], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 31 } + } + }, + range: [7, 31], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 31 } + } + }, + range: [0, 31], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 31 } + } + } + + }, + + 'throw statement': { + + 'throw x;': { + type: 'ThrowStatement', + argument: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + range: [0, 8], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + } + }, + + 'throw x * y': { + type: 'ThrowStatement', + argument: { + type: 'BinaryExpression', + operator: '*', + left: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + right: { + type: 'Identifier', + name: 'y', + range: [10, 11], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + } + }, + range: [6, 11], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 11 } + } + }, + range: [0, 11], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + } + }, + + 'throw { message: "Error" }': { + type: 'ThrowStatement', + argument: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'message', + range: [8, 15], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 15 } + } + }, + value: { + type: 'Literal', + value: 'Error', + raw: '"Error"', + range: [17, 24], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 24 } + } + }, + kind: 'init', + range: [8, 24], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 24 } + } + }], + range: [6, 26], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 26 } + } + }, + range: [0, 26], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 26 } + } + } + + }, + + 'try statement': { + + 'try { } catch (e) { }': { + type: 'TryStatement', + block: { + type: 'BlockStatement', + body: [], + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + guardedHandlers: [], + handlers: [{ + type: 'CatchClause', + param: { + type: 'Identifier', + name: 'e', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, + body: { + type: 'BlockStatement', + body: [], + range: [18, 21], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 21 } + } + }, + range: [8, 21], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 21 } + } + }], + finalizer: null, + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + } + }, + + 'try { } catch (eval) { }': { + type: 'TryStatement', + block: { + type: 'BlockStatement', + body: [], + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + guardedHandlers: [], + handlers: [{ + type: 'CatchClause', + param: { + type: 'Identifier', + name: 'eval', + range: [15, 19], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 19 } + } + }, + body: { + type: 'BlockStatement', + body: [], + range: [21, 24], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 24 } + } + }, + range: [8, 24], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 24 } + } + }], + finalizer: null, + range: [0, 24], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 24 } + } + }, + + 'try { } catch (arguments) { }': { + type: 'TryStatement', + block: { + type: 'BlockStatement', + body: [], + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + guardedHandlers: [], + handlers: [{ + type: 'CatchClause', + param: { + type: 'Identifier', + name: 'arguments', + range: [15, 24], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 24 } + } + }, + body: { + type: 'BlockStatement', + body: [], + range: [26, 29], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 29 } + } + }, + range: [8, 29], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 29 } + } + }], + finalizer: null, + range: [0, 29], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 29 } + } + }, + + 'try { } catch (e) { say(e) }': { + type: 'TryStatement', + block: { + type: 'BlockStatement', + body: [], + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + guardedHandlers: [], + handlers: [{ + type: 'CatchClause', + param: { + type: 'Identifier', + name: 'e', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'say', + range: [20, 23], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 23 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'e', + range: [24, 25], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + } + }], + range: [20, 26], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 26 } + } + }, + range: [20, 27], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 27 } + } + }], + range: [18, 28], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 28 } + } + }, + range: [8, 28], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 28 } + } + }], + finalizer: null, + range: [0, 28], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 28 } + } + }, + + 'try { } finally { cleanup(stuff) }': { + type: 'TryStatement', + block: { + type: 'BlockStatement', + body: [], + range: [4, 7], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + } + }, + guardedHandlers: [], + handlers: [], + finalizer: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'cleanup', + range: [18, 25], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 25 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'stuff', + range: [26, 31], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 31 } + } + }], + range: [18, 32], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 32 } + } + }, + range: [18, 33], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 33 } + } + }], + range: [16, 34], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 34 } + } + }, + range: [0, 34], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 34 } + } + }, + + 'try { doThat(); } catch (e) { say(e) }': { + type: 'TryStatement', + block: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'doThat', + range: [6, 12], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + } + }, + 'arguments': [], + range: [6, 14], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 14 } + } + }, + range: [6, 15], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 15 } + } + }], + range: [4, 17], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 17 } + } + }, + guardedHandlers: [], + handlers: [{ + type: 'CatchClause', + param: { + type: 'Identifier', + name: 'e', + range: [25, 26], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 26 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'say', + range: [30, 33], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 33 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'e', + range: [34, 35], + loc: { + start: { line: 1, column: 34 }, + end: { line: 1, column: 35 } + } + }], + range: [30, 36], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 36 } + } + }, + range: [30, 37], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 37 } + } + }], + range: [28, 38], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 38 } + } + }, + range: [18, 38], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 38 } + } + }], + finalizer: null, + range: [0, 38], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 38 } + } + }, + + 'try { doThat(); } catch (e) { say(e) } finally { cleanup(stuff) }': { + type: 'TryStatement', + block: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'doThat', + range: [6, 12], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + } + }, + 'arguments': [], + range: [6, 14], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 14 } + } + }, + range: [6, 15], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 15 } + } + }], + range: [4, 17], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 17 } + } + }, + guardedHandlers: [], + handlers: [{ + type: 'CatchClause', + param: { + type: 'Identifier', + name: 'e', + range: [25, 26], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 26 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'say', + range: [30, 33], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 33 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'e', + range: [34, 35], + loc: { + start: { line: 1, column: 34 }, + end: { line: 1, column: 35 } + } + }], + range: [30, 36], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 36 } + } + }, + range: [30, 37], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 37 } + } + }], + range: [28, 38], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 38 } + } + }, + range: [18, 38], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 38 } + } + }], + finalizer: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'cleanup', + range: [49, 56], + loc: { + start: { line: 1, column: 49 }, + end: { line: 1, column: 56 } + } + }, + 'arguments': [{ + type: 'Identifier', + name: 'stuff', + range: [57, 62], + loc: { + start: { line: 1, column: 57 }, + end: { line: 1, column: 62 } + } + }], + range: [49, 63], + loc: { + start: { line: 1, column: 49 }, + end: { line: 1, column: 63 } + } + }, + range: [49, 64], + loc: { + start: { line: 1, column: 49 }, + end: { line: 1, column: 64 } + } + }], + range: [47, 65], + loc: { + start: { line: 1, column: 47 }, + end: { line: 1, column: 65 } + } + }, + range: [0, 65], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 65 } + } + } + + }, + + 'debugger statement': { + + 'debugger;': { + type: 'DebuggerStatement', + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + } + } + + }, + + 'Function Definition': { + + 'function hello() { sayHi(); }': { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'hello', + range: [9, 14], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 14 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'sayHi', + range: [19, 24], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 24 } + } + }, + 'arguments': [], + range: [19, 26], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 26 } + } + }, + range: [19, 27], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 27 } + } + }], + range: [17, 29], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 29 } + } + }, + rest: null, + generator: false, + expression: false, + range: [0, 29], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 29 } + } + }, + + 'function eval() { }': { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'eval', + range: [9, 13], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 13 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [16, 19], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 19 } + } + }, + rest: null, + generator: false, + expression: false, + range: [0, 19], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + } + }, + + 'function arguments() { }': { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'arguments', + range: [9, 18], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 18 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [21, 24], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 24 } + } + }, + rest: null, + generator: false, + expression: false, + range: [0, 24], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 24 } + } + }, + + 'function test(t, t) { }': { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'test', + range: [9, 13], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 13 } + } + }, + params: [{ + type: 'Identifier', + name: 't', + range: [14, 15], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 15 } + } + }, { + type: 'Identifier', + name: 't', + range: [17, 18], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 18 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [20, 23], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 23 } + } + }, + rest: null, + generator: false, + expression: false, + range: [0, 23], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 23 } + } + }, + + '(function test(t, t) { })': { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'test', + range: [10, 14], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 14 } + } + }, + params: [{ + type: 'Identifier', + name: 't', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, { + type: 'Identifier', + name: 't', + range: [18, 19], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [21, 24], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 24 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 24], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 24 } + } + }, + range: [0, 25], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 25 } + } + }, + + 'function eval() { function inner() { "use strict" } }': { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'eval', + range: [9, 13], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 13 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'inner', + range: [27, 32], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 32 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '\"use strict\"', + range: [37, 49], + loc: { + start: { line: 1, column: 37 }, + end: { line: 1, column: 49 } + } + }, + range: [37, 50], + loc: { + start: { line: 1, column: 37 }, + end: { line: 1, column: 50 } + } + }], + range: [35, 51], + loc: { + start: { line: 1, column: 35 }, + end: { line: 1, column: 51 } + } + }, + rest: null, + generator: false, + expression: false, + range: [18, 51], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 51 } + } + }], + range: [16, 53], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 53 } + } + }, + rest: null, + generator: false, + expression: false, + range: [0, 53], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 53 } + } + }, + + 'function hello(a) { sayHi(); }': { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'hello', + range: [9, 14], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 14 } + } + }, + params: [{ + type: 'Identifier', + name: 'a', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'sayHi', + range: [20, 25], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 25 } + } + }, + 'arguments': [], + range: [20, 27], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 27 } + } + }, + range: [20, 28], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 28 } + } + }], + range: [18, 30], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 30 } + } + }, + rest: null, + generator: false, + expression: false, + range: [0, 30], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 30 } + } + }, + + 'function hello(a, b) { sayHi(); }': { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'hello', + range: [9, 14], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 14 } + } + }, + params: [{ + type: 'Identifier', + name: 'a', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, { + type: 'Identifier', + name: 'b', + range: [18, 19], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'sayHi', + range: [23, 28], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 28 } + } + }, + 'arguments': [], + range: [23, 30], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 30 } + } + }, + range: [23, 31], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 31 } + } + }], + range: [21, 33], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 33 } + } + }, + rest: null, + generator: false, + expression: false, + range: [0, 33], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 33 } + } + }, + + 'var hi = function() { sayHi() };': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'hi', + range: [4, 6], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + } + }, + init: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'sayHi', + range: [22, 27], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 27 } + } + }, + 'arguments': [], + range: [22, 29], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 29 } + } + }, + range: [22, 30], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 30 } + } + }], + range: [20, 31], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 31 } + } + }, + rest: null, + generator: false, + expression: false, + range: [9, 31], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 31 } + } + }, + range: [4, 31], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 31 } + } + }], + kind: 'var', + range: [0, 32], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 32 } + } + }, + + 'var hi = function eval() { };': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'hi', + range: [4, 6], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + } + }, + init: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'eval', + range: [18, 22], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 22 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [25, 28], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 28 } + } + }, + rest: null, + generator: false, + expression: false, + range: [9, 28], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 28 } + } + }, + range: [4, 28], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 28 } + } + }], + kind: 'var', + range: [0, 29], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 29 } + } + }, + + 'var hi = function arguments() { };': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'hi', + range: [4, 6], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + } + }, + init: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'arguments', + range: [18, 27], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 27 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [30, 33], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 33 } + } + }, + rest: null, + generator: false, + expression: false, + range: [9, 33], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 33 } + } + }, + range: [4, 33], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 33 } + } + }], + kind: 'var', + range: [0, 34], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 34 } + } + }, + + 'var hello = function hi() { sayHi() };': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'hello', + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }, + init: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'hi', + range: [21, 23], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 23 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'sayHi', + range: [28, 33], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 33 } + } + }, + 'arguments': [], + range: [28, 35], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 35 } + } + }, + range: [28, 36], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 36 } + } + }], + range: [26, 37], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 37 } + } + }, + rest: null, + generator: false, + expression: false, + range: [12, 37], + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 37 } + } + }, + range: [4, 37], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 37 } + } + }], + kind: 'var', + range: [0, 38], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 38 } + } + }, + + '(function(){})': { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [11, 13], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 13 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 13], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 13 } + } + }, + range: [0, 14], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + } + } + + }, + + 'Automatic semicolon insertion': { + + '{ x\n++y }': { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'x', + range: [2, 3], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 3 } + } + }, + range: [2, 4], + loc: { + start: { line: 1, column: 2 }, + end: { line: 2, column: 0 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'y', + range: [6, 7], + loc: { + start: { line: 2, column: 2 }, + end: { line: 2, column: 3 } + } + }, + prefix: true, + range: [4, 7], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 3 } + } + }, + range: [4, 8], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 4 } + } + }], + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 5 } + } + }, + + '{ x\n--y }': { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'x', + range: [2, 3], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 3 } + } + }, + range: [2, 4], + loc: { + start: { line: 1, column: 2 }, + end: { line: 2, column: 0 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'y', + range: [6, 7], + loc: { + start: { line: 2, column: 2 }, + end: { line: 2, column: 3 } + } + }, + prefix: true, + range: [4, 7], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 3 } + } + }, + range: [4, 8], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 4 } + } + }], + range: [0, 9], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 5 } + } + }, + + 'var x /* comment */;': { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + init: null, + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }], + kind: 'var', + range: [0, 20], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 20 } + } + }, + + '{ var x = 14, y = 3\nz; }': { + type: 'BlockStatement', + body: [{ + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, + init: { + type: 'Literal', + value: 14, + raw: '14', + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + range: [6, 12], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + } + }, { + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'y', + range: [14, 15], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 15 } + } + }, + init: { + type: 'Literal', + value: 3, + raw: '3', + range: [18, 19], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + } + }, + range: [14, 19], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 19 } + } + }], + kind: 'var', + range: [2, 20], + loc: { + start: { line: 1, column: 2 }, + end: { line: 2, column: 0 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'z', + range: [20, 21], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 1 } + } + }, + range: [20, 22], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + } + }], + range: [0, 24], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 4 } + } + }, + + 'while (true) { continue\nthere; }': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'ContinueStatement', + label: null, + range: [15, 23], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 23 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'there', + range: [24, 29], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 5 } + } + }, + range: [24, 30], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 6 } + } + }], + range: [13, 32], + loc: { + start: { line: 1, column: 13 }, + end: { line: 2, column: 8 } + } + }, + range: [0, 32], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 8 } + } + }, + + 'while (true) { continue // Comment\nthere; }': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'ContinueStatement', + label: null, + range: [15, 23], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 23 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'there', + range: [35, 40], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 5 } + } + }, + range: [35, 41], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 6 } + } + }], + range: [13, 43], + loc: { + start: { line: 1, column: 13 }, + end: { line: 2, column: 8 } + } + }, + range: [0, 43], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 8 } + } + }, + + 'while (true) { continue /* Multiline\nComment */there; }': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'ContinueStatement', + label: null, + range: [15, 23], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 23 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'there', + range: [47, 52], + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 15 } + } + }, + range: [47, 53], + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 16 } + } + }], + range: [13, 55], + loc: { + start: { line: 1, column: 13 }, + end: { line: 2, column: 18 } + } + }, + range: [0, 55], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 18 } + } + }, + + 'while (true) { break\nthere; }': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'BreakStatement', + label: null, + range: [15, 20], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 20 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'there', + range: [21, 26], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 5 } + } + }, + range: [21, 27], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 6 } + } + }], + range: [13, 29], + loc: { + start: { line: 1, column: 13 }, + end: { line: 2, column: 8 } + } + }, + range: [0, 29], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 8 } + } + }, + + 'while (true) { break // Comment\nthere; }': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'BreakStatement', + label: null, + range: [15, 20], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 20 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'there', + range: [32, 37], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 5 } + } + }, + range: [32, 38], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 6 } + } + }], + range: [13, 40], + loc: { + start: { line: 1, column: 13 }, + end: { line: 2, column: 8 } + } + }, + range: [0, 40], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 8 } + } + }, + + 'while (true) { break /* Multiline\nComment */there; }': { + type: 'WhileStatement', + test: { + type: 'Literal', + value: true, + raw: 'true', + range: [7, 11], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + } + }, + body: { + type: 'BlockStatement', + body: [{ + type: 'BreakStatement', + label: null, + range: [15, 20], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 20 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'there', + range: [44, 49], + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 15 } + } + }, + range: [44, 50], + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 16 } + } + }], + range: [13, 52], + loc: { + start: { line: 1, column: 13 }, + end: { line: 2, column: 18 } + } + }, + range: [0, 52], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 18 } + } + }, + + '(function(){ return\nx; })': { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [ + { + type: 'ReturnStatement', + argument: null, + range: [13, 19], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 19 } + } + }, + { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'x', + range: [20, 21], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 1 } + } + }, + range: [20, 22], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + } + } + ], + range: [11, 24], + loc: { + start: { line: 1, column: 11 }, + end: { line: 2, column: 4 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 24], + loc: { + start: { line: 1, column: 1 }, + end: { line: 2, column: 4 } + } + }, + range: [0, 25], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 5 } + } + }, + + '(function(){ return // Comment\nx; })': { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [ + { + type: 'ReturnStatement', + argument: null, + range: [13, 19], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 19 } + } + }, + { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'x', + range: [31, 32], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 1 } + } + }, + range: [31, 33], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 2 } + } + } + ], + range: [11, 35], + loc: { + start: { line: 1, column: 11 }, + end: { line: 2, column: 4 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 35], + loc: { + start: { line: 1, column: 1 }, + end: { line: 2, column: 4 } + } + }, + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 5 } + } + }, + + '(function(){ return/* Multiline\nComment */x; })': { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [ + { + type: 'ReturnStatement', + argument: null, + range: [13, 19], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 19 } + } + }, + { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'x', + range: [42, 43], + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 11 } + } + }, + range: [42, 44], + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 12 } + } + } + ], + range: [11, 46], + loc: { + start: { line: 1, column: 11 }, + end: { line: 2, column: 14 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 46], + loc: { + start: { line: 1, column: 1 }, + end: { line: 2, column: 14 } + } + }, + range: [0, 47], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 15 } + } + }, + + '{ throw error\nerror; }': { + type: 'BlockStatement', + body: [{ + type: 'ThrowStatement', + argument: { + type: 'Identifier', + name: 'error', + range: [8, 13], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 13 } + } + }, + range: [2, 14], + loc: { + start: { line: 1, column: 2 }, + end: { line: 2, column: 0 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'error', + range: [14, 19], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 5 } + } + }, + range: [14, 20], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 6 } + } + }], + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 8 } + } + }, + + '{ throw error// Comment\nerror; }': { + type: 'BlockStatement', + body: [{ + type: 'ThrowStatement', + argument: { + type: 'Identifier', + name: 'error', + range: [8, 13], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 13 } + } + }, + range: [2, 24], + loc: { + start: { line: 1, column: 2 }, + end: { line: 2, column: 0 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'error', + range: [24, 29], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 5 } + } + }, + range: [24, 30], + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 6 } + } + }], + range: [0, 32], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 8 } + } + }, + + '{ throw error/* Multiline\nComment */error; }': { + type: 'BlockStatement', + body: [{ + type: 'ThrowStatement', + argument: { + type: 'Identifier', + name: 'error', + range: [8, 13], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 13 } + } + }, + range: [2, 36], + loc: { + start: { line: 1, column: 2 }, + end: { line: 2, column: 10 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'error', + range: [36, 41], + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 15 } + } + }, + range: [36, 42], + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 16 } + } + }], + range: [0, 44], + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 18 } + } + } + + }, + + 'Source elements': { + + '': { + type: 'Program', + body: [], + range: [0, 0], + loc: { + start: { line: 0, column: 0 }, + end: { line: 0, column: 0 } + }, + tokens: [] + } + }, + + 'Invalid syntax': { + + '{': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Unexpected end of input' + }, + + '}': { + index: 0, + lineNumber: 1, + column: 1, + message: 'Error: Line 1: Unexpected token }' + }, + + '3ea': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '3in []': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '3e': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '3e+': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '3e-': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '3x': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '3x0': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '0x': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '09': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '018': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '01a': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '3in[]': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '0x3in[]': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '"Hello\nWorld"': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + 'x\\': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + 'x\\u005c': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + 'x\\u002a': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + 'var x = /(s/g': { + index: 13, + lineNumber: 1, + column: 14, + message: 'Error: Line 1: Invalid regular expression' + }, + + '/': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Invalid regular expression: missing /' + }, + + '/test': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Invalid regular expression: missing /' + }, + + 'var x = /[a-z]/\\ux': { + index: 18, + lineNumber: 1, + column: 19, + message: 'Error: Line 1: Invalid regular expression' + }, + + '3 = 4': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }, + + 'func() = 4': { + index: 6, + lineNumber: 1, + column: 7, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }, + + '(1 + 1) = 10': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }, + + '1++': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }, + + '1--': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }, + + '++1': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }, + + '--1': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }, + + 'for((1 + 1) in list) process(x);': { + index: 11, + lineNumber: 1, + column: 12, + message: 'Error: Line 1: Invalid left-hand side in for-in' + }, + + '[': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Unexpected end of input' + }, + + '[,': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected end of input' + }, + + '1 + {': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Unexpected end of input' + }, + + '1 + { t:t ': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Unexpected end of input' + }, + + '1 + { t:t,': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'var x = /\n/': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Invalid regular expression: missing /' + }, + + 'var x = "\n': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + 'var if = 42': { + index: 4, + lineNumber: 1, + column: 5, + message: 'Error: Line 1: Unexpected token if' + }, + + 'i + 2 = 42': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }, + + '+i = 42': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }, + + '1 + (': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Unexpected end of input' + }, + + '\n\n\n{': { + index: 4, + lineNumber: 4, + column: 2, + message: 'Error: Line 4: Unexpected end of input' + }, + + '\n/* Some multiline\ncomment */\n)': { + index: 30, + lineNumber: 4, + column: 1, + message: 'Error: Line 4: Unexpected token )' + }, + + '{ set 1 }': { + index: 6, + lineNumber: 1, + column: 7, + message: 'Error: Line 1: Unexpected number' + }, + + '{ get 2 }': { + index: 6, + lineNumber: 1, + column: 7, + message: 'Error: Line 1: Unexpected number' + }, + + '({ set: s(if) { } })': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Unexpected token if' + }, + + '({ set s(.) { } })': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token .' + }, + + '({ set s() { } })': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token )' + }, + + '({ set: s() { } })': { + index: 12, + lineNumber: 1, + column: 13, + message: 'Error: Line 1: Unexpected token {' + }, + + '({ set: s(a, b) { } })': { + index: 16, + lineNumber: 1, + column: 17, + message: 'Error: Line 1: Unexpected token {' + }, + + '({ get: g(d) { } })': { + index: 13, + lineNumber: 1, + column: 14, + message: 'Error: Line 1: Unexpected token {' + }, + + '({ get i() { }, i: 42 })': { + index: 21, + lineNumber: 1, + column: 22, + message: 'Error: Line 1: Object literal may not have data and accessor property with the same name' + }, + + '({ i: 42, get i() { } })': { + index: 21, + lineNumber: 1, + column: 22, + message: 'Error: Line 1: Object literal may not have data and accessor property with the same name' + }, + + '({ set i(x) { }, i: 42 })': { + index: 22, + lineNumber: 1, + column: 23, + message: 'Error: Line 1: Object literal may not have data and accessor property with the same name' + }, + + '({ i: 42, set i(x) { } })': { + index: 22, + lineNumber: 1, + column: 23, + message: 'Error: Line 1: Object literal may not have data and accessor property with the same name' + }, + + '({ get i() { }, get i() { } })': { + index: 27, + lineNumber: 1, + column: 28, + message: 'Error: Line 1: Object literal may not have multiple get/set accessors with the same name' + }, + + '({ set i(x) { }, set i(x) { } })': { + index: 29, + lineNumber: 1, + column: 30, + message: 'Error: Line 1: Object literal may not have multiple get/set accessors with the same name' + }, + + 'function t(if) { }': { + index: 11, + lineNumber: 1, + column: 12, + message: 'Error: Line 1: Unexpected token if' + }, + + 'function t(true) { }': { + index: 11, + lineNumber: 1, + column: 12, + message: 'Error: Line 1: Unexpected token true' + }, + + 'function t(false) { }': { + index: 11, + lineNumber: 1, + column: 12, + message: 'Error: Line 1: Unexpected token false' + }, + + 'function t(null) { }': { + index: 11, + lineNumber: 1, + column: 12, + message: 'Error: Line 1: Unexpected token null' + }, + + 'function null() { }': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token null' + }, + + 'function true() { }': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token true' + }, + + 'function false() { }': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token false' + }, + + 'function if() { }': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token if' + }, + + 'a b;': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected identifier' + }, + + 'if.a;': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected token .' + }, + + 'a if;': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected token if' + }, + + 'a class;': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected reserved word' + }, + + 'break\n': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Illegal break statement' + }, + + 'break 1;': { + index: 6, + lineNumber: 1, + column: 7, + message: 'Error: Line 1: Unexpected number' + }, + + 'continue\n': { + index: 8, + lineNumber: 1, + column: 9, + message: 'Error: Line 1: Illegal continue statement' + }, + + 'continue 2;': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected number' + }, + + 'throw': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'throw;': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Unexpected token ;' + }, + + 'throw\n': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Illegal newline after throw' + }, + + 'for (var i, i2 in {});': { + index: 15, + lineNumber: 1, + column: 16, + message: 'Error: Line 1: Unexpected token in' + }, + + 'for ((i in {}));': { + index: 14, + lineNumber: 1, + column: 15, + message: 'Error: Line 1: Unexpected token )' + }, + + 'for (i + 1 in {});': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Invalid left-hand side in for-in' + }, + + 'for (+i in {});': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Invalid left-hand side in for-in' + }, + + 'if(false)': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'if(false) doThis(); else': { + index: 24, + lineNumber: 1, + column: 25, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'do': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'while(false)': { + index: 12, + lineNumber: 1, + column: 13, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'for(;;)': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'with(x)': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'try { }': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Missing catch or finally after try' + }, + + 'try {} catch (42) {} ': { + index: 14, + lineNumber: 1, + column: 15, + message: 'Error: Line 1: Unexpected number' + }, + + 'try {} catch (answer()) {} ': { + index: 20, + lineNumber: 1, + column: 21, + message: 'Error: Line 1: Unexpected token (' + }, + + 'try {} catch (-x) {} ': { + index: 14, + lineNumber: 1, + column: 15, + message: 'Error: Line 1: Unexpected token -' + }, + + + '\u203F = 10': { + index: 0, + lineNumber: 1, + column: 1, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + 'const x = 12, y;': { + index: 15, + lineNumber: 1, + column: 16, + message: 'Error: Line 1: Unexpected token ;' + }, + + 'const x, y = 12;': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Unexpected token ,' + }, + + 'const x;': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Unexpected token ;' + }, + + 'if(true) let a = 1;': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token let' + }, + + 'if(true) const a = 1;': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token const' + }, + + 'switch (c) { default: default: }': { + index: 30, + lineNumber: 1, + column: 31, + message: 'Error: Line 1: More than one default clause in switch statement' + }, + + 'new X()."s"': { + index: 8, + lineNumber: 1, + column: 9, + message: 'Error: Line 1: Unexpected string' + }, + + '/*': { + index: 2, + lineNumber: 1, + column: 3, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '/*\n\n\n': { + index: 5, + lineNumber: 4, + column: 1, + message: 'Error: Line 4: Unexpected token ILLEGAL' + }, + + '/**': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '/*\n\n*': { + index: 5, + lineNumber: 3, + column: 2, + message: 'Error: Line 3: Unexpected token ILLEGAL' + }, + + '/*hello': { + index: 7, + lineNumber: 1, + column: 8, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '/*hello *': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '\n]': { + index: 1, + lineNumber: 2, + column: 1, + message: 'Error: Line 2: Unexpected token ]' + }, + + '\r]': { + index: 1, + lineNumber: 2, + column: 1, + message: 'Error: Line 2: Unexpected token ]' + }, + + '\r\n]': { + index: 2, + lineNumber: 2, + column: 1, + message: 'Error: Line 2: Unexpected token ]' + }, + + '\n\r]': { + index: 2, + lineNumber: 3, + column: 1, + message: 'Error: Line 3: Unexpected token ]' + }, + + '//\r\n]': { + index: 4, + lineNumber: 2, + column: 1, + message: 'Error: Line 2: Unexpected token ]' + }, + + '//\n\r]': { + index: 4, + lineNumber: 3, + column: 1, + message: 'Error: Line 3: Unexpected token ]' + }, + + '/a\\\n/': { + index: 4, + lineNumber: 1, + column: 5, + message: 'Error: Line 1: Invalid regular expression: missing /' + }, + + '//\r \n]': { + index: 5, + lineNumber: 3, + column: 1, + message: 'Error: Line 3: Unexpected token ]' + }, + + '/*\r\n*/]': { + index: 6, + lineNumber: 2, + column: 3, + message: 'Error: Line 2: Unexpected token ]' + }, + + '/*\n\r*/]': { + index: 6, + lineNumber: 3, + column: 3, + message: 'Error: Line 3: Unexpected token ]' + }, + + '/*\r \n*/]': { + index: 7, + lineNumber: 3, + column: 3, + message: 'Error: Line 3: Unexpected token ]' + }, + + '\\\\': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '\\u005c': { + index: 6, + lineNumber: 1, + column: 7, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + + '\\x': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '\\u0000': { + index: 6, + lineNumber: 1, + column: 7, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '\u200C = []': { + index: 0, + lineNumber: 1, + column: 1, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '\u200D = []': { + index: 0, + lineNumber: 1, + column: 1, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '"\\': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + '"\\u': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Unexpected token ILLEGAL' + }, + + 'try { } catch() {}': { + index: 14, + lineNumber: 1, + column: 15, + message: 'Error: Line 1: Unexpected token )' + }, + + 'return': { + index: 6, + lineNumber: 1, + column: 7, + message: 'Error: Line 1: Illegal return statement' + }, + + 'break': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Illegal break statement' + }, + + 'continue': { + index: 8, + lineNumber: 1, + column: 9, + message: 'Error: Line 1: Illegal continue statement' + }, + + 'switch (x) { default: continue; }': { + index: 31, + lineNumber: 1, + column: 32, + message: 'Error: Line 1: Illegal continue statement' + }, + + 'do { x } *': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token *' + }, + + 'while (true) { break x; }': { + index: 22, + lineNumber: 1, + column: 23, + message: 'Error: Line 1: Undefined label \'x\'' + }, + + 'while (true) { continue x; }': { + index: 25, + lineNumber: 1, + column: 26, + message: 'Error: Line 1: Undefined label \'x\'' + }, + + 'x: while (true) { (function () { break x; }); }': { + index: 40, + lineNumber: 1, + column: 41, + message: 'Error: Line 1: Undefined label \'x\'' + }, + + 'x: while (true) { (function () { continue x; }); }': { + index: 43, + lineNumber: 1, + column: 44, + message: 'Error: Line 1: Undefined label \'x\'' + }, + + 'x: while (true) { (function () { break; }); }': { + index: 39, + lineNumber: 1, + column: 40, + message: 'Error: Line 1: Illegal break statement' + }, + + 'x: while (true) { (function () { continue; }); }': { + index: 42, + lineNumber: 1, + column: 43, + message: 'Error: Line 1: Illegal continue statement' + }, + + 'x: while (true) { x: while (true) { } }': { + index: 20, + lineNumber: 1, + column: 21, + message: 'Error: Line 1: Label \'x\' has already been declared' + }, + + '(function () { \'use strict\'; delete i; }())': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Delete of an unqualified identifier in strict mode.' + }, + + '(function () { \'use strict\'; with (i); }())': { + index: 28, + lineNumber: 1, + column: 29, + message: 'Error: Line 1: Strict mode code may not include a with statement' + }, + + 'function hello() {\'use strict\'; ({ i: 42, i: 42 }) }': { + index: 47, + lineNumber: 1, + column: 48, + message: 'Error: Line 1: Duplicate data property in object literal not allowed in strict mode' + }, + + 'function hello() {\'use strict\'; ({ hasOwnProperty: 42, hasOwnProperty: 42 }) }': { + index: 73, + lineNumber: 1, + column: 74, + message: 'Error: Line 1: Duplicate data property in object literal not allowed in strict mode' + }, + + 'function hello() {\'use strict\'; var eval = 10; }': { + index: 40, + lineNumber: 1, + column: 41, + message: 'Error: Line 1: Variable name may not be eval or arguments in strict mode' + }, + + 'function hello() {\'use strict\'; var arguments = 10; }': { + index: 45, + lineNumber: 1, + column: 46, + message: 'Error: Line 1: Variable name may not be eval or arguments in strict mode' + }, + + 'function hello() {\'use strict\'; try { } catch (eval) { } }': { + index: 51, + lineNumber: 1, + column: 52, + message: 'Error: Line 1: Catch variable may not be eval or arguments in strict mode' + }, + + 'function hello() {\'use strict\'; try { } catch (arguments) { } }': { + index: 56, + lineNumber: 1, + column: 57, + message: 'Error: Line 1: Catch variable may not be eval or arguments in strict mode' + }, + + 'function hello() {\'use strict\'; eval = 10; }': { + index: 32, + lineNumber: 1, + column: 33, + message: 'Error: Line 1: Assignment to eval or arguments is not allowed in strict mode' + }, + + 'function hello() {\'use strict\'; arguments = 10; }': { + index: 32, + lineNumber: 1, + column: 33, + message: 'Error: Line 1: Assignment to eval or arguments is not allowed in strict mode' + }, + + 'function hello() {\'use strict\'; ++eval; }': { + index: 38, + lineNumber: 1, + column: 39, + message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode' + }, + + 'function hello() {\'use strict\'; --eval; }': { + index: 38, + lineNumber: 1, + column: 39, + message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode' + }, + + 'function hello() {\'use strict\'; ++arguments; }': { + index: 43, + lineNumber: 1, + column: 44, + message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode' + }, + + 'function hello() {\'use strict\'; --arguments; }': { + index: 43, + lineNumber: 1, + column: 44, + message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode' + }, + + 'function hello() {\'use strict\'; eval++; }': { + index: 36, + lineNumber: 1, + column: 37, + message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode' + }, + + 'function hello() {\'use strict\'; eval--; }': { + index: 36, + lineNumber: 1, + column: 37, + message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode' + }, + + 'function hello() {\'use strict\'; arguments++; }': { + index: 41, + lineNumber: 1, + column: 42, + message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode' + }, + + 'function hello() {\'use strict\'; arguments--; }': { + index: 41, + lineNumber: 1, + column: 42, + message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode' + }, + + 'function hello() {\'use strict\'; function eval() { } }': { + index: 41, + lineNumber: 1, + column: 42, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }, + + 'function hello() {\'use strict\'; function arguments() { } }': { + index: 41, + lineNumber: 1, + column: 42, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }, + + 'function eval() {\'use strict\'; }': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }, + + 'function arguments() {\'use strict\'; }': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }, + + 'function hello() {\'use strict\'; (function eval() { }()) }': { + index: 42, + lineNumber: 1, + column: 43, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }, + + 'function hello() {\'use strict\'; (function arguments() { }()) }': { + index: 42, + lineNumber: 1, + column: 43, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }, + + '(function eval() {\'use strict\'; })()': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }, + + '(function arguments() {\'use strict\'; })()': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }, + + 'function hello() {\'use strict\'; ({ s: function eval() { } }); }': { + index: 47, + lineNumber: 1, + column: 48, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }, + + '(function package() {\'use strict\'; })()': { + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello() {\'use strict\'; ({ i: 10, set s(eval) { } }); }': { + index: 48, + lineNumber: 1, + column: 49, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }, + + 'function hello() {\'use strict\'; ({ set s(eval) { } }); }': { + index: 41, + lineNumber: 1, + column: 42, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }, + + 'function hello() {\'use strict\'; ({ s: function s(eval) { } }); }': { + index: 49, + lineNumber: 1, + column: 50, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }, + + 'function hello(eval) {\'use strict\';}': { + index: 15, + lineNumber: 1, + column: 16, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }, + + 'function hello(arguments) {\'use strict\';}': { + index: 15, + lineNumber: 1, + column: 16, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }, + + 'function hello() { \'use strict\'; function inner(eval) {} }': { + index: 48, + lineNumber: 1, + column: 49, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }, + + 'function hello() { \'use strict\'; function inner(arguments) {} }': { + index: 48, + lineNumber: 1, + column: 49, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }, + + ' "\\1"; \'use strict\';': { + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }, + + 'function hello() { \'use strict\'; "\\1"; }': { + index: 33, + lineNumber: 1, + column: 34, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }, + + 'function hello() { \'use strict\'; 021; }': { + index: 33, + lineNumber: 1, + column: 34, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }, + + 'function hello() { \'use strict\'; ({ "\\1": 42 }); }': { + index: 36, + lineNumber: 1, + column: 37, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }, + + 'function hello() { \'use strict\'; ({ 021: 42 }); }': { + index: 36, + lineNumber: 1, + column: 37, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }, + + 'function hello() { "octal directive\\1"; "use strict"; }': { + index: 19, + lineNumber: 1, + column: 20, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }, + + 'function hello() { "octal directive\\1"; "octal directive\\2"; "use strict"; }': { + index: 19, + lineNumber: 1, + column: 20, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }, + + 'function hello() { "use strict"; function inner() { "octal directive\\1"; } }': { + index: 52, + lineNumber: 1, + column: 53, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }, + + 'function hello() { "use strict"; var implements; }': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello() { "use strict"; var interface; }': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello() { "use strict"; var package; }': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello() { "use strict"; var private; }': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello() { "use strict"; var protected; }': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello() { "use strict"; var public; }': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello() { "use strict"; var static; }': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello() { "use strict"; var yield; }': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello() { "use strict"; var let; }': { + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function hello(static) { "use strict"; }': { + index: 15, + lineNumber: 1, + column: 16, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function static() { "use strict"; }': { + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'var yield': { + index: 4, + lineNumber: 1, + column: 5, + message: 'Error: Line 1: Unexpected token yield' + }, + + 'var let': { + index: 4, + lineNumber: 1, + column: 5, + message: 'Error: Line 1: Unexpected token let' + }, + + '"use strict"; function static() { }': { + index: 23, + lineNumber: 1, + column: 24, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function a(t, t) { "use strict"; }': { + index: 14, + lineNumber: 1, + column: 15, + message: 'Error: Line 1: Strict mode function may not have duplicate parameter names' + }, + + 'function a(eval) { "use strict"; }': { + index: 11, + lineNumber: 1, + column: 12, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }, + + 'function a(package) { "use strict"; }': { + index: 11, + lineNumber: 1, + column: 12, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'function a() { "use strict"; function b(t, t) { }; }': { + index: 43, + lineNumber: 1, + column: 44, + message: 'Error: Line 1: Strict mode function may not have duplicate parameter names' + }, + + '(function a(t, t) { "use strict"; })': { + index: 15, + lineNumber: 1, + column: 16, + message: 'Error: Line 1: Strict mode function may not have duplicate parameter names' + }, + + 'function a() { "use strict"; (function b(t, t) { }); }': { + index: 44, + lineNumber: 1, + column: 45, + message: 'Error: Line 1: Strict mode function may not have duplicate parameter names' + }, + + '(function a(eval) { "use strict"; })': { + index: 12, + lineNumber: 1, + column: 13, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }, + + '(function a(package) { "use strict"; })': { + index: 12, + lineNumber: 1, + column: 13, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }, + + 'var': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'let': { + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Unexpected end of input' + }, + + 'const': { + index: 5, + lineNumber: 1, + column: 6, + message: 'Error: Line 1: Unexpected end of input' + } + + }, + + 'API': { + 'parse()': { + call: 'parse', + args: [], + result: { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'undefined' + } + }] + } + }, + + 'parse(null)': { + call: 'parse', + args: [null], + result: { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: null + } + }] + } + }, + + 'parse(42)': { + call: 'parse', + args: [42], + result: { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42 + } + }] + } + }, + + 'parse(true)': { + call: 'parse', + args: [true], + result: { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: true + } + }] + } + }, + + 'parse(undefined)': { + call: 'parse', + args: [void 0], + result: { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'undefined' + } + }] + } + }, + + 'parse(new String("test"))': { + call: 'parse', + args: [new String('test')], + result: { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Identifier', + name: 'test' + } + }] + } + }, + + 'parse(new Number(42))': { + call: 'parse', + args: [new Number(42)], + result: { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 42 + } + }] + } + }, + + 'parse(new Boolean(true))': { + call: 'parse', + args: [new Boolean(true)], + result: { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: true + } + }] + } + }, + + 'Syntax': { + property: 'Syntax', + result: { + AssignmentExpression: 'AssignmentExpression', + ArrayExpression: 'ArrayExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + Program: 'Program', + Property: 'Property', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement' + } + } + + }, + + 'Tolerant parse': { + 'return': { + type: 'Program', + body: [{ + type: 'ReturnStatement', + 'argument': null, + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + } + }], + range: [0, 6], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + }, + errors: [{ + index: 6, + lineNumber: 1, + column: 7, + message: 'Error: Line 1: Illegal return statement' + }] + }, + + '(function () { \'use strict\'; with (i); }())': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '\'use strict\'', + range: [15, 27], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 27 } + } + }, + range: [15, 28], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 28 } + } + }, { + type: 'WithStatement', + object: { + type: 'Identifier', + name: 'i', + range: [35, 36], + loc: { + start: { line: 1, column: 35 }, + end: { line: 1, column: 36 } + } + }, + body: { + type: 'EmptyStatement', + range: [37, 38], + loc: { + start: { line: 1, column: 37 }, + end: { line: 1, column: 38 } + } + }, + range: [29, 38], + loc: { + start: { line: 1, column: 29 }, + end: { line: 1, column: 38 } + } + }], + range: [13, 40], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 40 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 40], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 40 } + } + }, + 'arguments': [], + range: [1, 42], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 42 } + } + }, + range: [0, 43], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 43 } + } + }], + range: [0, 43], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 43 } + }, + errors: [{ + index: 29, + lineNumber: 1, + column: 30, + message: 'Error: Line 1: Strict mode code may not include a with statement' + }] + }, + + '(function () { \'use strict\'; 021 }())': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'CallExpression', + callee: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '\'use strict\'', + range: [15, 27], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 27 } + } + }, + range: [15, 28], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 28 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 17, + raw: "021", + range: [29, 32], + loc: { + start: { line: 1, column: 29 }, + end: { line: 1, column: 32 } + } + }, + range: [29, 33], + loc: { + start: { line: 1, column: 29 }, + end: { line: 1, column: 33 } + } + }], + range: [13, 34], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 34 } + } + }, + rest: null, + generator: false, + expression: false, + range: [1, 34], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 34 } + } + }, + 'arguments': [], + range: [1, 36], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 36 } + } + }, + range: [0, 37], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 37 } + } + }], + range: [0, 37], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 37 } + }, + errors: [{ + index: 29, + lineNumber: 1, + column: 30, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }] + }, + + '"use strict"; delete x': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'UnaryExpression', + operator: 'delete', + argument: { + type: 'Identifier', + name: 'x', + range: [21, 22], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 22 } + } + }, + prefix: true, + range: [14, 22], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 22 } + } + }, + range: [14, 22], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 22 } + } + }], + range: [0, 22], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + }, + errors: [{ + index: 22, + lineNumber: 1, + column: 23, + message: 'Error: Line 1: Delete of an unqualified identifier in strict mode.' + }] + }, + + '"use strict"; try {} catch (eval) {}': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'TryStatement', + block: { + type: 'BlockStatement', + body: [], + range: [18, 20], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 20 } + } + }, + guardedHandlers: [], + handlers: [{ + type: 'CatchClause', + param: { + type: 'Identifier', + name: 'eval', + range: [28, 32], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 32 } + } + }, + body: { + type: 'BlockStatement', + body: [], + range: [34, 36], + loc: { + start: { line: 1, column: 34 }, + end: { line: 1, column: 36 } + } + }, + range: [21, 36], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 36 } + } + }], + finalizer: null, + range: [14, 36], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 36 } + } + }], + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + }, + errors: [{ + index: 32, + lineNumber: 1, + column: 33, + message: 'Error: Line 1: Catch variable may not be eval or arguments in strict mode' + }] + }, + + '"use strict"; try {} catch (arguments) {}': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'TryStatement', + block: { + type: 'BlockStatement', + body: [], + range: [18, 20], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 20 } + } + }, + guardedHandlers: [], + handlers: [{ + type: 'CatchClause', + param: { + type: 'Identifier', + name: 'arguments', + range: [28, 37], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 37 } + } + }, + body: { + type: 'BlockStatement', + body: [], + range: [39, 41], + loc: { + start: { line: 1, column: 39 }, + end: { line: 1, column: 41 } + } + }, + range: [21, 41], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 41 } + } + }], + finalizer: null, + range: [14, 41], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 41 } + } + }], + range: [0, 41], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 41 } + }, + errors: [{ + index: 37, + lineNumber: 1, + column: 38, + message: 'Error: Line 1: Catch variable may not be eval or arguments in strict mode' + }] + }, + + '"use strict"; var eval;': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'eval', + range: [18, 22], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 22 } + } + }, + init: null, + range: [18, 22], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 22 } + } + }], + kind: 'var', + range: [14, 23], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 23 } + } + }], + range: [0, 23], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 23 } + }, + errors: [{ + index: 22, + lineNumber: 1, + column: 23, + message: 'Error: Line 1: Variable name may not be eval or arguments in strict mode' + }] + }, + + '"use strict"; var arguments;': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'arguments', + range: [18, 27], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 27 } + } + }, + init: null, + range: [18, 27], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 27 } + } + }], + kind: 'var', + range: [14, 28], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 28 } + } + }], + range: [0, 28], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 28 } + }, + errors: [{ + index: 27, + lineNumber: 1, + column: 28, + message: 'Error: Line 1: Variable name may not be eval or arguments in strict mode' + }] + }, + + '"use strict"; eval = 0;': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'eval', + range: [14, 18], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 18 } + } + }, + right: { + type: 'Literal', + value: 0, + raw: '0', + range: [21, 22], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 22 } + } + }, + range: [14, 22], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 22 } + } + }, + range: [14, 23], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 23 } + } + }], + range: [0, 23], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 23 } + }, + errors: [{ + index: 14, + lineNumber: 1, + column: 15, + message: 'Error: Line 1: Assignment to eval or arguments is not allowed in strict mode' + }] + }, + + '"use strict"; eval++;': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'eval', + range: [14, 18], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 18 } + } + }, + prefix: false, + range: [14, 20], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 20 } + } + }, + range: [14, 21], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 21 } + } + }], + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + }, + errors: [{ + index: 18, + lineNumber: 1, + column: 19, + message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode' + }] + }, + + '"use strict"; --eval;': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'eval', + range: [16, 20], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 20 } + } + }, + prefix: true, + range: [14, 20], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 20 } + } + }, + range: [14, 21], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 21 } + } + }], + range: [0, 21], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 21 } + }, + errors: [{ + index: 20, + lineNumber: 1, + column: 21, + message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode' + }] + }, + + '"use strict"; arguments = 0;': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'arguments', + range: [14, 23], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 23 } + } + }, + right: { + type: 'Literal', + value: 0, + raw: '0', + range: [26, 27], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 27 } + } + }, + range: [14, 27], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 27 } + } + }, + range: [14, 28], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 28 } + } + }], + range: [0, 28], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 28 } + }, + errors: [{ + index: 14, + lineNumber: 1, + column: 15, + message: 'Error: Line 1: Assignment to eval or arguments is not allowed in strict mode' + }] + }, + + '"use strict"; arguments--;': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Identifier', + name: 'arguments', + range: [14, 23], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 23 } + } + }, + prefix: false, + range: [14, 25], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 25 } + } + }, + range: [14, 26], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 26 } + } + }], + range: [0, 26], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 26 } + }, + errors: [{ + index: 23, + lineNumber: 1, + column: 24, + message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode' + }] + }, + + '"use strict"; ++arguments;': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Identifier', + name: 'arguments', + range: [16, 25], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 25 } + } + }, + prefix: true, + range: [14, 25], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 25 } + } + }, + range: [14, 26], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 26 } + } + }], + range: [0, 26], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 26 } + }, + errors: [{ + index: 25, + lineNumber: 1, + column: 26, + message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode' + }] + }, + + + '"use strict";x={y:1,y:1}': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [13, 14], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 14 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'y', + range: [16, 17], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + } + }, + value: { + type: 'Literal', + value: 1, + raw: '1', + range: [18, 19], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + } + }, + kind: 'init', + range: [16, 19], + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 19 } + } + }, { + type: 'Property', + key: { + type: 'Identifier', + name: 'y', + range: [20, 21], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 21 } + } + }, + value: { + type: 'Literal', + value: 1, + raw: '1', + range: [22, 23], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 23 } + } + }, + kind: 'init', + range: [20, 23], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 23 } + } + }], + range: [15, 24], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 24 } + } + }, + range: [13, 24], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 24 } + } + }, + range: [13, 24], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 24 } + } + }], + range: [0, 24], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 24 } + }, + errors: [{ + index: 23, + lineNumber: 1, + column: 24, + message: 'Error: Line 1: Duplicate data property in object literal not allowed in strict mode' + }] + }, + + '"use strict"; function eval() {};': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'eval', + range: [23, 27], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 27 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [30, 32], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 32 } + } + }, + rest: null, + generator: false, + expression: false, + range: [14, 32], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 32 } + } + }, { + type: 'EmptyStatement', + range: [32, 33], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 33 } + } + }], + range: [0, 33], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 33 } + }, + errors: [{ + index: 23, + lineNumber: 1, + column: 24, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }] + }, + + '"use strict"; function arguments() {};': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'arguments', + range: [23, 32], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 32 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [35, 37], + loc: { + start: { line: 1, column: 35 }, + end: { line: 1, column: 37 } + } + }, + rest: null, + generator: false, + expression: false, + range: [14, 37], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 37 } + } + }, { + type: 'EmptyStatement', + range: [37, 38], + loc: { + start: { line: 1, column: 37 }, + end: { line: 1, column: 38 } + } + }], + range: [0, 38], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 38 } + }, + errors: [{ + index: 23, + lineNumber: 1, + column: 24, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }] + }, + + '"use strict"; function interface() {};': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'interface', + range: [23, 32], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 32 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [35, 37], + loc: { + start: { line: 1, column: 35 }, + end: { line: 1, column: 37 } + } + }, + rest: null, + generator: false, + expression: false, + range: [14, 37], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 37 } + } + }, { + type: 'EmptyStatement', + range: [37, 38], + loc: { + start: { line: 1, column: 37 }, + end: { line: 1, column: 38 } + } + }], + range: [0, 38], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 38 } + }, + errors: [{ + index: 23, + lineNumber: 1, + column: 24, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }] + }, + + '"use strict"; (function eval() {});': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'eval', + range: [24, 28], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 28 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [31, 33], + loc: { + start: { line: 1, column: 31 }, + end: { line: 1, column: 33 } + } + }, + rest: null, + generator: false, + expression: false, + range: [15, 33], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 33 } + } + }, + range: [14, 35], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 35 } + } + }], + range: [0, 35], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 35 } + }, + errors: [{ + index: 24, + lineNumber: 1, + column: 25, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }] + }, + + '"use strict"; (function arguments() {});': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'arguments', + range: [24, 33], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 33 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [36, 38], + loc: { + start: { line: 1, column: 36 }, + end: { line: 1, column: 38 } + } + }, + rest: null, + generator: false, + expression: false, + range: [15, 38], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 38 } + } + }, + range: [14, 40], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 40 } + } + }], + range: [0, 40], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 40 } + }, + errors: [{ + index: 24, + lineNumber: 1, + column: 25, + message: 'Error: Line 1: Function name may not be eval or arguments in strict mode' + }] + }, + + '"use strict"; (function interface() {});': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'interface', + range: [24, 33], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 33 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [36, 38], + loc: { + start: { line: 1, column: 36 }, + end: { line: 1, column: 38 } + } + }, + rest: null, + generator: false, + expression: false, + range: [15, 38], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 38 } + } + }, + range: [14, 40], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 40 } + } + }], + range: [0, 40], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 40 } + }, + errors: [{ + index: 24, + lineNumber: 1, + column: 25, + message: 'Error: Line 1: Use of future reserved word in strict mode' + }] + }, + + '"use strict"; function f(eval) {};': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'f', + range: [23, 24], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 24 } + } + }, + params: [{ + type: 'Identifier', + name: 'eval', + range: [25, 29], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 29 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [31, 33], + loc: { + start: { line: 1, column: 31 }, + end: { line: 1, column: 33 } + } + }, + rest: null, + generator: false, + expression: false, + range: [14, 33], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 33 } + } + }, { + type: 'EmptyStatement', + range: [33, 34], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 34 } + } + }], + range: [0, 34], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 34 } + }, + errors: [{ + index: 25, + lineNumber: 1, + column: 26, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }] + }, + + '"use strict"; function f(arguments) {};': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'f', + range: [23, 24], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 24 } + } + }, + params: [{ + type: 'Identifier', + name: 'arguments', + range: [25, 34], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 34 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [36, 38], + loc: { + start: { line: 1, column: 36 }, + end: { line: 1, column: 38 } + } + }, + rest: null, + generator: false, + expression: false, + range: [14, 38], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 38 } + } + }, { + type: 'EmptyStatement', + range: [38, 39], + loc: { + start: { line: 1, column: 38 }, + end: { line: 1, column: 39 } + } + }], + range: [0, 39], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 39 } + }, + errors: [{ + index: 25, + lineNumber: 1, + column: 26, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }] + }, + + '"use strict"; function f(foo, foo) {};': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'f', + range: [23, 24], + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 24 } + } + }, + params: [{ + type: 'Identifier', + name: 'foo', + range: [25, 28], + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 28 } + } + }, { + type: 'Identifier', + name: 'foo', + range: [31, 34], + loc: { + start: { line: 1, column: 31 }, + end: { line: 1, column: 34 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [36, 38], + loc: { + start: { line: 1, column: 36 }, + end: { line: 1, column: 38 } + } + }, + rest: null, + generator: false, + expression: false, + range: [14, 38], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 38 } + } + }, { + type: 'EmptyStatement', + range: [38, 39], + loc: { + start: { line: 1, column: 38 }, + end: { line: 1, column: 39 } + } + }], + range: [0, 39], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 39 } + }, + errors: [{ + index: 31, + lineNumber: 1, + column: 32, + message: 'Error: Line 1: Strict mode function may not have duplicate parameter names' + }] + }, + + '"use strict"; (function f(eval) {});': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'f', + range: [24, 25], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + } + }, + params: [{ + type: 'Identifier', + name: 'eval', + range: [26, 30], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 30 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [32, 34], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 34 } + } + }, + rest: null, + generator: false, + expression: false, + range: [15, 34], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 34 } + } + }, + range: [14, 36], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 36 } + } + }], + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + }, + errors: [{ + index: 26, + lineNumber: 1, + column: 27, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }] + }, + + + '"use strict"; (function f(arguments) {});': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'f', + range: [24, 25], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + } + }, + params: [{ + type: 'Identifier', + name: 'arguments', + range: [26, 35], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 35 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [37, 39], + loc: { + start: { line: 1, column: 37 }, + end: { line: 1, column: 39 } + } + }, + rest: null, + generator: false, + expression: false, + range: [15, 39], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 39 } + } + }, + range: [14, 41], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 41 } + } + }], + range: [0, 41], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 41 } + }, + errors: [{ + index: 26, + lineNumber: 1, + column: 27, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }] + }, + + '"use strict"; (function f(foo, foo) {});': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'FunctionExpression', + id: { + type: 'Identifier', + name: 'f', + range: [24, 25], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + } + }, + params: [{ + type: 'Identifier', + name: 'foo', + range: [26, 29], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 29 } + } + }, { + type: 'Identifier', + name: 'foo', + range: [32, 35], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 35 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [37, 39], + loc: { + start: { line: 1, column: 37 }, + end: { line: 1, column: 39 } + } + }, + rest: null, + generator: false, + expression: false, + range: [15, 39], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 39 } + } + }, + range: [14, 41], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 41 } + } + }], + range: [0, 41], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 41 } + }, + errors: [{ + index: 32, + lineNumber: 1, + column: 33, + message: 'Error: Line 1: Strict mode function may not have duplicate parameter names' + }] + }, + + '"use strict"; x = { set f(eval) {} }' : { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Identifier', + name: 'x', + range: [14, 15], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 15 } + } + }, + right: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'f', + range: [24, 25], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + } + }, + value : { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'Identifier', + name: 'eval', + range: [26, 30], + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 30 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [32, 34], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 34 } + } + }, + rest: null, + generator: false, + expression: false, + range: [32, 34], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 34 } + } + }, + kind: 'set', + range: [20, 34], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 34 } + } + }], + range: [18, 36], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 36 } + } + }, + range: [14, 36], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 36 } + } + }, + range: [14, 36], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 36 } + } + }], + range: [0, 36], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 36 } + }, + errors: [{ + index: 26, + lineNumber: 1, + column: 27, + message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode' + }] + }, + + 'function hello() { "octal directive\\1"; "use strict"; }': { + type: 'Program', + body: [{ + type: 'FunctionDeclaration', + id: { + type: 'Identifier', + name: 'hello', + range: [9, 14], + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 14 } + } + }, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'octal directive\u0001', + raw: '"octal directive\\1"', + range: [19, 38], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 38 } + } + }, + range: [19, 39], + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 39 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [40, 52], + loc: { + start: { line: 1, column: 40 }, + end: { line: 1, column: 52 } + } + }, + range: [40, 53], + loc: { + start: { line: 1, column: 40 }, + end: { line: 1, column: 53 } + } + }], + range: [17, 55], + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 55 } + } + }, + rest: null, + generator: false, + expression: false, + range: [0, 55], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 55 } + } + }], + range: [0, 55], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 55 } + }, + errors: [{ + index: 19, + lineNumber: 1, + column: 20, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }] + }, + + '"\\1"; \'use strict\';': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: '\u0001', + raw: '"\\1"', + range: [0, 4], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, { + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '\'use strict\'', + range: [6, 18], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 18 } + } + }, + range: [6, 19], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 19 } + } + }], + range: [0, 19], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + }, + errors: [{ + index: 0, + lineNumber: 1, + column: 1, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }] + }, + + '"use strict"; var x = { 014: 3}': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [18, 19], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + } + }, + init: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Literal', + value: 12, + raw: '014', + range: [24, 27], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 27 } + } + }, + value: { + type: 'Literal', + value: 3, + raw: '3', + range: [29, 30], + loc: { + start: { line: 1, column: 29 }, + end: { line: 1, column: 30 } + } + }, + kind: 'init', + range: [24, 30], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 30 } + } + }], + range: [22, 31], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 31 } + } + }, + range: [18, 31], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 31 } + } + }], + kind: 'var', + range: [14, 31], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 31 } + } + }], + range: [0, 31], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 31 } + }, + errors: [{ + index: 24, + lineNumber: 1, + column: 25, + message: 'Error: Line 1: Octal literals are not allowed in strict mode.' + }] + }, + + '"use strict"; var x = { get i() {}, get i() {} }': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [18, 19], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + } + }, + init: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'i', + range: [28, 29], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 29 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [32, 34], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 34 } + } + }, + rest: null, + generator: false, + expression: false, + range: [32, 34], + loc: { + start: { line: 1, column: 32 }, + end: { line: 1, column: 34 } + } + }, + kind: 'get', + range: [24, 34], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 34 } + } + }, { + type: 'Property', + key: { + type: 'Identifier', + name: 'i', + range: [40, 41], + loc: { + start: { line: 1, column: 40 }, + end: { line: 1, column: 41 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [44, 46], + loc: { + start: { line: 1, column: 44 }, + end: { line: 1, column: 46 } + } + }, + rest: null, + generator: false, + expression: false, + range: [44, 46], + loc: { + start: { line: 1, column: 44 }, + end: { line: 1, column: 46 } + } + }, + kind: 'get', + range: [36, 46], + loc: { + start: { line: 1, column: 36 }, + end: { line: 1, column: 46 } + } + }], + range: [22, 48], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 48 } + } + }, + range: [18, 48], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 48 } + } + }], + kind: 'var', + range: [14, 48], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 48 } + } + }], + range: [0, 48], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 48 } + }, + errors: [{ + index: 46, + lineNumber: 1, + column: 47, + message: 'Error: Line 1: Object literal may not have multiple get/set accessors with the same name' + }] + }, + + '"use strict"; var x = { i: 42, get i() {} }': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [18, 19], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + } + }, + init: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'i', + range: [24, 25], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + } + }, + value: { + type: 'Literal', + value: 42, + raw: '42', + range: [27, 29], + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 29 } + } + }, + kind: 'init', + range: [24, 29], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 29 } + } + }, { + type: 'Property', + key: { + type: 'Identifier', + name: 'i', + range: [35, 36], + loc: { + start: { line: 1, column: 35 }, + end: { line: 1, column: 36 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [39, 41], + loc: { + start: { line: 1, column: 39 }, + end: { line: 1, column: 41 } + } + }, + rest: null, + generator: false, + expression: false, + range: [39, 41], + loc: { + start: { line: 1, column: 39 }, + end: { line: 1, column: 41 } + } + }, + kind: 'get', + range: [31, 41], + loc: { + start: { line: 1, column: 31 }, + end: { line: 1, column: 41 } + } + }], + range: [22, 43], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 43 } + } + }, + range: [18, 43], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 43 } + } + }], + kind: 'var', + range: [14, 43], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 43 } + } + }], + range: [0, 43], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 43 } + }, + errors: [{ + index: 41, + lineNumber: 1, + column: 42, + message: 'Error: Line 1: Object literal may not have data and accessor property with the same name' + }] + }, + + '"use strict"; var x = { set i(x) {}, i: 42 }': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'Literal', + value: 'use strict', + raw: '"use strict"', + range: [0, 12], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 12 } + } + }, + range: [0, 13], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 13 } + } + }, { + type: 'VariableDeclaration', + declarations: [{ + type: 'VariableDeclarator', + id: { + type: 'Identifier', + name: 'x', + range: [18, 19], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + } + }, + init: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'i', + range: [28, 29], + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 29 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'Identifier', + name: 'x', + range: [30, 31], + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 31 } + } + }], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [33, 35], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 35 } + } + }, + rest: null, + generator: false, + expression: false, + range: [33, 35], + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 35 } + } + }, + kind: 'set', + range: [24, 35], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 35 } + } + }, { + type: 'Property', + key: { + type: 'Identifier', + name: 'i', + range: [37, 38], + loc: { + start: { line: 1, column: 37 }, + end: { line: 1, column: 38 } + } + }, + value: { + type: 'Literal', + value: 42, + raw: '42', + range: [40, 42], + loc: { + start: { line: 1, column: 40 }, + end: { line: 1, column: 42 } + } + }, + kind: 'init', + range: [37, 42], + loc: { + start: { line: 1, column: 37 }, + end: { line: 1, column: 42 } + } + }], + range: [22, 44], + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 44 } + } + }, + range: [18, 44], + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 44 } + } + }], + kind: 'var', + range: [14, 44], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 44 } + } + }], + range: [0, 44], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 44 } + }, + errors: [{ + index: 42, + lineNumber: 1, + column: 43, + message: 'Error: Line 1: Object literal may not have data and accessor property with the same name' + }] + + + }, + + '({ set s() { } })': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 's', + range: [7, 8], + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [], + defaults: [], + body: { + type: 'BlockStatement', + body: [], + range: [11, 14], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 14 } + } + }, + rest: null, + generator: false, + expression: false, + range: [11, 14], + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 14 } + } + }, + kind: 'set', + range: [3, 14], + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 14 } + } + }], + range: [1, 16], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + } + }], + range: [0, 17], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + }, + errors: [{ + index: 9, + lineNumber: 1, + column: 10, + message: 'Error: Line 1: Unexpected token )' + }] + }, + + 'foo("bar") = baz': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'foo', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + 'arguments': [{ + type: 'Literal', + value: 'bar', + raw: '"bar"', + range: [4, 9], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + } + }], + range: [0, 10], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 10 } + } + }, + right: { + type: 'Identifier', + name: 'baz', + range: [13, 16], + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }], + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + }, + errors: [{ + index: 10, + lineNumber: 1, + column: 11, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }] + }, + + '1 = 2': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'AssignmentExpression', + operator: '=', + left: { + type: 'Literal', + value: 1, + raw: '1', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + right: { + type: 'Literal', + value: 2, + raw: '2', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }, + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + } + }], + range: [0, 5], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + }, + errors: [{ + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }] + }, + + '3++': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '++', + argument: { + type: 'Literal', + value: 3, + raw: '3', + range: [0, 1], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + } + }, + prefix: false, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }], + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + }, + errors: [{ + index: 1, + lineNumber: 1, + column: 2, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }] + }, + + '--4': { + type: 'Program', + body: [{ + type: 'ExpressionStatement', + expression: { + type: 'UpdateExpression', + operator: '--', + argument: { + type: 'Literal', + value: 4, + raw: '4', + range: [2, 3], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 3 } + } + }, + prefix: true, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }], + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + }, + errors: [{ + index: 3, + lineNumber: 1, + column: 4, + message: 'Error: Line 1: Invalid left-hand side in assignment' + }] + }, + + 'for (5 in []) {}': { + type: 'Program', + body: [{ + type: 'ForInStatement', + left: { + type: 'Literal', + value: 5, + raw: '5', + range: [5, 6], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + } + }, + right: { + type: 'ArrayExpression', + elements: [], + range: [10, 12], + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + } + }, + body: { + type: 'BlockStatement', + body: [], + range: [14, 16], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 16 } + } + }, + each: false, + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + } + }], + range: [0, 16], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + }, + errors: [{ + index: 6, + lineNumber: 1, + column: 7, + message: 'Error: Line 1: Invalid left-hand side in for-in' + }] + } + + + } +}; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/package.json new file mode 100644 index 00000000..f978c091 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/package.json @@ -0,0 +1,64 @@ +{ + "name": "rocambole", + "version": "0.3.6", + "description": "Recursively walk and transform EcmaScript AST", + "main": "rocambole.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "istanbul test test/runner.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/rocambole.git" + }, + "bugs": { + "url": "https://github.com/millermedeiros/rocambole/issues" + }, + "keywords": [ + "ast", + "walk", + "syntax", + "source", + "tree", + "traversal", + "falafel", + "burrito", + "esprima" + ], + "author": { + "name": "Miller Medeiros", + "email": "http://blog.millermedeiros.com" + }, + "license": "MIT", + "dependencies": { + "esprima": "~1.0" + }, + "devDependencies": { + "mocha": "~1.7", + "expect.js": "0.2", + "istanbul": "~0.1.23" + }, + "homepage": "https://github.com/millermedeiros/rocambole", + "_id": "rocambole@0.3.6", + "dist": { + "shasum": "4debbf5943144bc7b6006d95be8facc0b74352a7", + "tarball": "http://registry.npmjs.org/rocambole/-/rocambole-0.3.6.tgz" + }, + "_from": "rocambole@>=0.3.6 <0.4.0", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + } + ], + "_shasum": "4debbf5943144bc7b6006d95be8facc0b74352a7", + "_resolved": "https://registry.npmjs.org/rocambole/-/rocambole-0.3.6.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/rocambole.jpg b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/rocambole.jpg new file mode 100644 index 00000000..a329c4d5 Binary files /dev/null and b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/rocambole.jpg differ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/rocambole.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/rocambole.js new file mode 100644 index 00000000..d910fad2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/rocambole.js @@ -0,0 +1,417 @@ +/*jshint node:true */ +"use strict"; + + +var esprima = require('esprima'); + + + +// --- + +// we expose the flags so other tools can tweak the values (#8) +exports.BYPASS_RECURSION = { + root : true, + comments : true, + tokens : true, + + loc : true, + range : true, + + parent : true, + next : true, + prev : true, + + // IMPORTANT! "value" can't be bypassed since it is used by object + // expression + type : true, + raw : true, + + startToken : true, + endToken : true +}; + + +// --- + +var _addLocInfo; + +// --- + + +// parse string and return an augmented AST +exports.parse = function parse(source, opts){ + _addLocInfo = opts && opts.loc; + source = source.toString(); + + var ast = esprima.parse(source, { + loc : _addLocInfo, + range : true, + tokens : true, + comment : true + }); + + // we augment just root node since program is "empty" + // can't check `ast.body.length` because it might contain just comments + if (!ast.tokens.length && !ast.comments.length) { + ast.depth = 0; + ast.startToken = ast.endToken = null; + ast.toString = _nodeProto.toString; + return ast; + } + + instrumentTokens(ast, source); + + // update program range since it doesn't include white spaces and comments + // before/after the program body by default + var lastToken = ast.tokens[ast.tokens.length - 1]; + ast.range[0] = ast.tokens[0].range[0]; + ast.range[1] = lastToken.range[1]; + if (_addLocInfo) { + ast.loc.start.line = 0; + ast.loc.start.column = 0; + ast.loc.end.line = lastToken.loc.end.line; + ast.loc.end.column = lastToken.loc.end.column; + } + + var toString = _nodeProto.toString; + var instrumentNodes = function(node, parent, prev, next){ + + node.parent = parent; + node.prev = prev; + node.next = next; + node.depth = parent? parent.depth + 1 : 0; // used later for moonwalk + + node.toString = toString; + + // we do not add nextToken and prevToken to avoid updating even more + // references during each remove/before/after you can grab the + // prev/next token by simply accesing the startToken.prev and + // endToken.next + var prevToken = prev? prev.endToken : (parent? parent.startToken : null); + var nextToken = parent? parent.endToken : null; + node.startToken = prevToken? getNodeStartToken(prevToken, node.range) : ast.tokens[0]; + node.endToken = nextToken? getNodeEndToken(nextToken, node.range) : ast.tokens[ast.tokens.length - 1]; + }; + recursiveWalk(ast, instrumentNodes); + + return ast; +}; + + +var _nodeProto = {}; + +// get the node string +_nodeProto.toString = function(){ + var str = ''; + var token = this.startToken; + if (!token) return str; + do { + str += ('raw' in token)? token.raw : token.value; + token = token.next; + } while (token && token !== this.endToken.next); + return str; +}; + + +function getNodeStartToken(token, range){ + var startRange = range[0]; + while (token){ + if (token.range[0] >= startRange) { + return token; + } + token = token.next; + } +} + +function getNodeEndToken(token, range){ + var endRange = range[1]; + while (token){ + if (token.range[1] <= endRange) { + return token; + } + token = token.prev; + } +} + + + +function getPrevToken(tokens, range){ + var result, token, + startRange = range[0], + n = tokens.length; + while (n--) { + token = tokens[n]; + if (token.range[1] <= startRange) { + result = token; + break; + } + } + return result; +} + + + + + + +function instrumentTokens(ast, source){ + + var tokens = ast.tokens; + + + // --- inject comments into tokens list + var comments = ast.comments; + var comment, + q = -1, + nComments = comments.length; + + while (++q < nComments) { + comment = comments[q]; + // we edit it in place since it is faster, will also affect + comment.raw = comment.type === 'Block'? '/*'+ comment.value +'*/' : '//'+ comment.value; + comment.type += 'Comment'; + + var prevToken = getPrevToken(tokens, comment.range); + var prevIndex = prevToken? tokens.indexOf(prevToken) : -1; + tokens.splice(prevIndex + 1, 0, comment); + } + + + // --- inject white spaces and line breaks + + // we create a new array since it's simpler than using splice, it will + // also avoid mistakes + var result = []; + + // insert white spaces before start of program + var wsTokens; + var firstToken = ast.tokens[0]; + var raw; + if ( firstToken.range[0] ) { + raw = source.substring(0, firstToken.range[0]); + result = result.concat( getWhiteSpaceTokens(raw, null) ); + } + + // insert white spaces between regular tokens + // faster than forEach and reduce lookups + var i = -1, + nTokens = tokens.length, + token, prev; + var k, nWs; + while (++i < nTokens) { + token = tokens[i]; + if (i) { + if (prev.range[1] < token.range[0]) { + wsTokens = getWhiteSpaceTokens(source.substring(prev.range[1], token.range[0]), prev); + // faster than concat or push.apply + k = -1; + nWs = wsTokens.length; + while (++k < nWs) { + result.push(wsTokens[k]); + } + } + } + result.push(token); + prev = token; + } + + // insert white spaces after end of program + var lastToken = ast.tokens[ast.tokens.length - 1]; + if (lastToken.range[1] < source.length) { + wsTokens = getWhiteSpaceTokens(source.substring(lastToken.range[1], source.length), lastToken); + k = -1; + nWs = wsTokens.length; + while (++k < nWs) { + result.push(wsTokens[k]); + } + } + + // --- instrument tokens + + // need to come afterwards since we add line breaks and comments + var n; + for (i = 0, n = result.length, token; i < n; i++) { + token = result[i]; + token.prev = i? result[i - 1] : undefined; + token.next = result[i + 1]; + token.root = ast; // used internally + // original indent is very important for block comments since some + // transformations require manipulation of raw comment value + if ( + token.type === 'BlockComment' && + token.prev && token.prev.type === 'WhiteSpace' && + (!token.prev.prev || (token.prev.prev.type === 'LineBreak')) + ) { + token.originalIndent = token.prev.value; + } + } + + ast.tokens = result; +} + + +function getWhiteSpaceTokens(raw, prev){ + var whiteSpaces = getWhiteSpaces(raw); + + var startRange = prev? prev.range[1] : 0; + // line starts at 1 !!! + var startLine, startColumn; + if (_addLocInfo) { + startLine = prev? prev.loc.end.line : 1; + startColumn = prev? prev.loc.end.column : 0; + } + + var tokens = []; + for (var i = 0, n = whiteSpaces.length, value; i < n; i++){ + value = whiteSpaces[i]; + + var wsToken = { value : value }; + var isBr = '\r\n'.indexOf(value) >= 0; + wsToken.type = isBr? 'LineBreak' : 'WhiteSpace'; + wsToken.range = [startRange, startRange + value.length]; + + if (_addLocInfo) { + wsToken.loc = { + start : { + line : startLine, + column : startColumn + }, + end : { + line : startLine, // yes, br starts and end on same line + column : startColumn + value.length + } + }; + + if (isBr) { + // next token after a
always starts at zero and on next line + startLine = wsToken.loc.end.line + 1; + startColumn = 0; + } else { + startLine = wsToken.loc.end.line; + startColumn = wsToken.loc.end.column; + } + } + + startRange += value.length; + tokens.push(wsToken); + } + + return tokens; +} + + +function getWhiteSpaces(source) { + var result = []; + var whiteSpaces = source.split(''); + var buf = ''; + for (var value, i = 0, nSpaces = whiteSpaces.length; i < nSpaces; i++) { + value = whiteSpaces[i]; + switch(value){ + case '\n': + if (buf === '\r') { + // DOS line break + result.push(buf + value); + } else { + if (buf) { + result.push(buf); + } + // unix break + result.push(value); + } + buf = ''; + break; + case '\r': + // might be multiple consecutive Mac breaks + if (buf) { + result.push(buf); + } + buf = value; + break; + default: + if (buf === '\r') { + result.push(buf); + buf = value; + } else { + // group multiple white spaces into same token + buf += value; + } + } + } + if (buf) { + result.push(buf); + } + return result; +} + + + +exports.recursive = recursiveWalk; + +// heavily inspired by node-falafel +// walk nodes recursively starting from root +function recursiveWalk(node, fn, parent, prev, next){ + // sparse arrays might have `null` elements, so we skip those for now + // see issue #15 + if ( !node || fn(node, parent, prev, next) === false ) { + return; // stop recursion + } + + // faster than for in + var keys = Object.keys(node), + child, key; + + for (var i = 0, nKeys = keys.length; i < nKeys; i++) { + + key = keys[i]; + child = node[key]; + + // only need to recurse real nodes and arrays + // ps: typeof null == 'object' + if (!child || typeof child !== 'object' || exports.BYPASS_RECURSION[key]) { + continue; + } + + // inception + if (typeof child.type === 'string') { // faster than boolean coercion + recursiveWalk(child, fn, node); + } else if ( typeof child.length === 'number' ) { // faster than Array.isArray and boolean coercion + // faster than forEach + for (var k = 0, nChilds = child.length; k < nChilds; k++) { + recursiveWalk(child[k], fn, node, (k? child[k - 1] : undefined), child[k + 1] ); + } + } + + } + +} + + + +// walk AST starting from leaf nodes +exports.moonwalk = function moonwalk(ast, fn){ + if (typeof ast === 'string') { + ast = exports.parse(ast); + } + + // we create a separate array for each depth and than we flatten it to + // boost performance, way faster than doing an insertion sort + var swap = []; + recursiveWalk(ast, function(node){ + if (! swap[node.depth]) { + swap[node.depth] = []; + } + swap[node.depth].push(node); + }); + + var nodes = []; + var nDepths = swap.length, cur; + while (cur = swap[--nDepths]) { + for (var i = 0, n = cur.length; i < n; i++) { + nodes.push(cur[i]); + } + } + + nodes.forEach(fn); + return ast; +}; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/files/crossroads.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/files/crossroads.js new file mode 100644 index 00000000..79d992e8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/files/crossroads.js @@ -0,0 +1,683 @@ +/** @license + * crossroads + * License: MIT + * Author: Miller Medeiros + * Version: 0.11.0 (2012/10/31 21:44) + */ + +(function (define) { +define(['signals'], function (signals) { + + var crossroads, + _hasOptionalGroupBug, + UNDEF; + + // Helpers ----------- + //==================== + + // IE 7-8 capture optional groups as empty strings while other browsers + // capture as `undefined` + _hasOptionalGroupBug = (/t(.+)?/).exec('t')[1] === ''; + + function arrayIndexOf(arr, val) { + if (arr.indexOf) { + return arr.indexOf(val); + } else { + //Array.indexOf doesn't work on IE 6-7 + var n = arr.length; + while (n--) { + if (arr[n] === val) { + return n; + } + } + return -1; + } + } + + function arrayRemove(arr, item) { + var i = arrayIndexOf(arr, item); + if (i !== -1) { + arr.splice(i, 1); + } + } + + function isKind(val, kind) { + return '[object '+ kind +']' === Object.prototype.toString.call(val); + } + + function isRegExp(val) { + return isKind(val, 'RegExp'); + } + + function isArray(val) { + return isKind(val, 'Array'); + } + + function isFunction(val) { + return typeof val === 'function'; + } + + //borrowed from AMD-utils + function typecastValue(val) { + var r; + if (val === null || val === 'null') { + r = null; + } else if (val === 'true') { + r = true; + } else if (val === 'false') { + r = false; + } else if (val === UNDEF || val === 'undefined') { + r = UNDEF; + } else if (val === '' || isNaN(val)) { + //isNaN('') returns false + r = val; + } else { + //parseFloat(null || '') returns NaN + r = parseFloat(val); + } + return r; + } + + function typecastArrayValues(values) { + var n = values.length, + result = []; + while (n--) { + result[n] = typecastValue(values[n]); + } + return result; + } + + //borrowed from AMD-Utils + function decodeQueryString(str, shouldTypecast) { + var queryArr = (str || '').replace('?', '').split('&'), + n = queryArr.length, + obj = {}, + item, val; + while (n--) { + item = queryArr[n].split('='); + val = shouldTypecast ? typecastValue(item[1]) : item[1]; + obj[item[0]] = (typeof val === 'string')? decodeURIComponent(val) : val; + } + return obj; + } + + + // Crossroads -------- + //==================== + + /** + * @constructor + */ + function Crossroads() { + this.bypassed = new signals.Signal(); + this.routed = new signals.Signal(); + this._routes = []; + this._prevRoutes = []; + this._piped = []; + this.resetState(); + } + + Crossroads.prototype = { + + greedy : false, + + greedyEnabled : true, + + ignoreCase : true, + + ignoreState : false, + + shouldTypecast : false, + + normalizeFn : null, + + resetState : function(){ + this._prevRoutes.length = 0; + this._prevMatchedRequest = null; + this._prevBypassedRequest = null; + }, + + create : function () { + return new Crossroads(); + }, + + addRoute : function (pattern, callback, priority) { + var route = new Route(pattern, callback, priority, this); + this._sortedInsert(route); + return route; + }, + + removeRoute : function (route) { + arrayRemove(this._routes, route); + route._destroy(); + }, + + removeAllRoutes : function () { + var n = this.getNumRoutes(); + while (n--) { + this._routes[n]._destroy(); + } + this._routes.length = 0; + }, + + parse : function (request, defaultArgs) { + request = request || ''; + defaultArgs = defaultArgs || []; + + // should only care about different requests if ignoreState isn't true + if ( !this.ignoreState && + (request === this._prevMatchedRequest || + request === this._prevBypassedRequest) ) { + return; + } + + var routes = this._getMatchedRoutes(request), + i = 0, + n = routes.length, + cur; + + if (n) { + this._prevMatchedRequest = request; + + this._notifyPrevRoutes(routes, request); + this._prevRoutes = routes; + //should be incremental loop, execute routes in order + while (i < n) { + cur = routes[i]; + cur.route.matched.dispatch.apply(cur.route.matched, defaultArgs.concat(cur.params)); + cur.isFirst = !i; + this.routed.dispatch.apply(this.routed, defaultArgs.concat([request, cur])); + i += 1; + } + } else { + this._prevBypassedRequest = request; + this.bypassed.dispatch.apply(this.bypassed, defaultArgs.concat([request])); + } + + this._pipeParse(request, defaultArgs); + }, + + _notifyPrevRoutes : function(matchedRoutes, request) { + var i = 0, prev; + while (prev = this._prevRoutes[i++]) { + //check if switched exist since route may be disposed + if(prev.route.switched && this._didSwitch(prev.route, matchedRoutes)) { + prev.route.switched.dispatch(request); + } + } + }, + + _didSwitch : function (route, matchedRoutes){ + var matched, + i = 0; + while (matched = matchedRoutes[i++]) { + // only dispatch switched if it is going to a different route + if (matched.route === route) { + return false; + } + } + return true; + }, + + _pipeParse : function(request, defaultArgs) { + var i = 0, route; + while (route = this._piped[i++]) { + route.parse(request, defaultArgs); + } + }, + + getNumRoutes : function () { + return this._routes.length; + }, + + _sortedInsert : function (route) { + //simplified insertion sort + var routes = this._routes, + n = routes.length; + do { --n; } while (routes[n] && route._priority <= routes[n]._priority); + routes.splice(n+1, 0, route); + }, + + _getMatchedRoutes : function (request) { + var res = [], + routes = this._routes, + n = routes.length, + route; + //should be decrement loop since higher priorities are added at the end of array + while (route = routes[--n]) { + if ((!res.length || this.greedy || route.greedy) && route.match(request)) { + res.push({ + route : route, + params : route._getParamsArray(request) + }); + } + if (!this.greedyEnabled && res.length) { + break; + } + } + return res; + }, + + pipe : function (otherRouter) { + this._piped.push(otherRouter); + }, + + unpipe : function (otherRouter) { + arrayRemove(this._piped, otherRouter); + }, + + toString : function () { + return '[crossroads numRoutes:'+ this.getNumRoutes() +']'; + } + }; + + //"static" instance + crossroads = new Crossroads(); + crossroads.VERSION = '0.11.0'; + + crossroads.NORM_AS_ARRAY = function (req, vals) { + return [vals.vals_]; + }; + + crossroads.NORM_AS_OBJECT = function (req, vals) { + return [vals]; + }; + + + // Route -------------- + //===================== + + /** + * @constructor + */ + function Route(pattern, callback, priority, router) { + var isRegexPattern = isRegExp(pattern), + patternLexer = crossroads.patternLexer; + this._router = router; + this._pattern = pattern; + this._paramsIds = isRegexPattern? null : patternLexer.getParamIds(pattern); + this._optionalParamsIds = isRegexPattern? null : patternLexer.getOptionalParamsIds(pattern); + this._matchRegexp = isRegexPattern? pattern : patternLexer.compilePattern(pattern, router.ignoreCase); + this.matched = new signals.Signal(); + this.switched = new signals.Signal(); + if (callback) { + this.matched.add(callback); + } + this._priority = priority || 0; + } + + Route.prototype = { + + greedy : false, + + rules : void(0), + + match : function (request) { + request = request || ''; + return this._matchRegexp.test(request) && this._validateParams(request); //validate params even if regexp because of `request_` rule. + }, + + _validateParams : function (request) { + var rules = this.rules, + values = this._getParamsObject(request), + key; + for (key in rules) { + // normalize_ isn't a validation rule... (#39) + if(key !== 'normalize_' && rules.hasOwnProperty(key) && ! this._isValidParam(request, key, values)){ + return false; + } + } + return true; + }, + + _isValidParam : function (request, prop, values) { + var validationRule = this.rules[prop], + val = values[prop], + isValid = false, + isQuery = (prop.indexOf('?') === 0); + + if (val == null && this._optionalParamsIds && arrayIndexOf(this._optionalParamsIds, prop) !== -1) { + isValid = true; + } + else if (isRegExp(validationRule)) { + if (isQuery) { + val = values[prop +'_']; //use raw string + } + isValid = validationRule.test(val); + } + else if (isArray(validationRule)) { + if (isQuery) { + val = values[prop +'_']; //use raw string + } + isValid = this._isValidArrayRule(validationRule, val); + } + else if (isFunction(validationRule)) { + isValid = validationRule(val, request, values); + } + + return isValid; //fail silently if validationRule is from an unsupported type + }, + + _isValidArrayRule : function (arr, val) { + if (! this._router.ignoreCase) { + return arrayIndexOf(arr, val) !== -1; + } + + if (typeof val === 'string') { + val = val.toLowerCase(); + } + + var n = arr.length, + item, + compareVal; + + while (n--) { + item = arr[n]; + compareVal = (typeof item === 'string')? item.toLowerCase() : item; + if (compareVal === val) { + return true; + } + } + return false; + }, + + _getParamsObject : function (request) { + var shouldTypecast = this._router.shouldTypecast, + values = crossroads.patternLexer.getParamValues(request, this._matchRegexp, shouldTypecast), + o = {}, + n = values.length, + param, val; + while (n--) { + val = values[n]; + if (this._paramsIds) { + param = this._paramsIds[n]; + if (param.indexOf('?') === 0 && val) { + //make a copy of the original string so array and + //RegExp validation can be applied properly + o[param +'_'] = val; + //update vals_ array as well since it will be used + //during dispatch + val = decodeQueryString(val, shouldTypecast); + values[n] = val; + } + // IE will capture optional groups as empty strings while other + // browsers will capture `undefined` so normalize behavior. + // see: #gh-58, #gh-59, #gh-60 + if ( _hasOptionalGroupBug && val === '' && arrayIndexOf(this._optionalParamsIds, param) !== -1 ) { + val = void(0); + values[n] = val; + } + o[param] = val; + } + //alias to paths and for RegExp pattern + o[n] = val; + } + o.request_ = shouldTypecast? typecastValue(request) : request; + o.vals_ = values; + return o; + }, + + _getParamsArray : function (request) { + var norm = this.rules? this.rules.normalize_ : null, + params; + norm = norm || this._router.normalizeFn; // default normalize + if (norm && isFunction(norm)) { + params = norm(request, this._getParamsObject(request)); + } else { + params = this._getParamsObject(request).vals_; + } + return params; + }, + + interpolate : function(replacements) { + var str = crossroads.patternLexer.interpolate(this._pattern, replacements); + if (! this._validateParams(str) ) { + throw new Error('Generated string doesn\'t validate against `Route.rules`.'); + } + return str; + }, + + dispose : function () { + this._router.removeRoute(this); + }, + + _destroy : function () { + this.matched.dispose(); + this.switched.dispose(); + this.matched = this.switched = this._pattern = this._matchRegexp = null; + }, + + toString : function () { + return '[Route pattern:"'+ this._pattern +'", numListeners:'+ this.matched.getNumListeners() +']'; + } + + }; + + + + // Pattern Lexer ------ + //===================== + + crossroads.patternLexer = (function () { + + var + //match chars that should be escaped on string regexp + ESCAPE_CHARS_REGEXP = /[\\.+*?\^$\[\](){}\/'#]/g, + + //trailing slashes (begin/end of string) + LOOSE_SLASHES_REGEXP = /^\/|\/$/g, + LEGACY_SLASHES_REGEXP = /\/$/g, + + //params - everything between `{ }` or `: :` + PARAMS_REGEXP = /(?:\{|:)([^}:]+)(?:\}|:)/g, + + //used to save params during compile (avoid escaping things that + //shouldn't be escaped). + TOKENS = { + 'OS' : { + //optional slashes + //slash between `::` or `}:` or `\w:` or `:{?` or `}{?` or `\w{?` + rgx : /([:}]|\w(?=\/))\/?(:|(?:\{\?))/g, + save : '$1{{id}}$2', + res : '\\/?' + }, + 'RS' : { + //required slashes + //used to insert slash between `:{` and `}{` + rgx : /([:}])\/?(\{)/g, + save : '$1{{id}}$2', + res : '\\/' + }, + 'RQ' : { + //required query string - everything in between `{? }` + rgx : /\{\?([^}]+)\}/g, + //everything from `?` till `#` or end of string + res : '\\?([^#]+)' + }, + 'OQ' : { + //optional query string - everything in between `:? :` + rgx : /:\?([^:]+):/g, + //everything from `?` till `#` or end of string + res : '(?:\\?([^#]*))?' + }, + 'OR' : { + //optional rest - everything in between `: *:` + rgx : /:([^:]+)\*:/g, + res : '(.*)?' // optional group to avoid passing empty string as captured + }, + 'RR' : { + //rest param - everything in between `{ *}` + rgx : /\{([^}]+)\*\}/g, + res : '(.+)' + }, + // required/optional params should come after rest segments + 'RP' : { + //required params - everything between `{ }` + rgx : /\{([^}]+)\}/g, + res : '([^\\/?]+)' + }, + 'OP' : { + //optional params - everything between `: :` + rgx : /:([^:]+):/g, + res : '([^\\/?]+)?\/?' + } + }, + + LOOSE_SLASH = 1, + STRICT_SLASH = 2, + LEGACY_SLASH = 3, + + _slashMode = LOOSE_SLASH; + + + function precompileTokens(){ + var key, cur; + for (key in TOKENS) { + if (TOKENS.hasOwnProperty(key)) { + cur = TOKENS[key]; + cur.id = '__CR_'+ key +'__'; + cur.save = ('save' in cur)? cur.save.replace('{{id}}', cur.id) : cur.id; + cur.rRestore = new RegExp(cur.id, 'g'); + } + } + } + precompileTokens(); + + + function captureVals(regex, pattern) { + var vals = [], match; + // very important to reset lastIndex since RegExp can have "g" flag + // and multiple runs might affect the result, specially if matching + // same string multiple times on IE 7-8 + regex.lastIndex = 0; + while (match = regex.exec(pattern)) { + vals.push(match[1]); + } + return vals; + } + + function getParamIds(pattern) { + return captureVals(PARAMS_REGEXP, pattern); + } + + function getOptionalParamsIds(pattern) { + return captureVals(TOKENS.OP.rgx, pattern); + } + + function compilePattern(pattern, ignoreCase) { + pattern = pattern || ''; + + if(pattern){ + if (_slashMode === LOOSE_SLASH) { + pattern = pattern.replace(LOOSE_SLASHES_REGEXP, ''); + } + else if (_slashMode === LEGACY_SLASH) { + pattern = pattern.replace(LEGACY_SLASHES_REGEXP, ''); + } + + //save tokens + pattern = replaceTokens(pattern, 'rgx', 'save'); + //regexp escape + pattern = pattern.replace(ESCAPE_CHARS_REGEXP, '\\$&'); + //restore tokens + pattern = replaceTokens(pattern, 'rRestore', 'res'); + + if (_slashMode === LOOSE_SLASH) { + pattern = '\\/?'+ pattern; + } + } + + if (_slashMode !== STRICT_SLASH) { + //single slash is treated as empty and end slash is optional + pattern += '\\/?'; + } + return new RegExp('^'+ pattern + '$', ignoreCase? 'i' : ''); + } + + function replaceTokens(pattern, regexpName, replaceName) { + var cur, key; + for (key in TOKENS) { + if (TOKENS.hasOwnProperty(key)) { + cur = TOKENS[key]; + pattern = pattern.replace(cur[regexpName], cur[replaceName]); + } + } + return pattern; + } + + function getParamValues(request, regexp, shouldTypecast) { + var vals = regexp.exec(request); + if (vals) { + vals.shift(); + if (shouldTypecast) { + vals = typecastArrayValues(vals); + } + } + return vals; + } + + function interpolate(pattern, replacements) { + if (typeof pattern !== 'string') { + throw new Error('Route pattern should be a string.'); + } + + var replaceFn = function(match, prop){ + var val; + if (prop in replacements) { + // make sure value is a string see #gh-54 + val = String(replacements[prop]); + if (match.indexOf('*') === -1 && val.indexOf('/') !== -1) { + throw new Error('Invalid value "'+ val +'" for segment "'+ match +'".'); + } + } + else if (match.indexOf('{') !== -1) { + throw new Error('The segment '+ match +' is required.'); + } + else { + val = ''; + } + return val; + }; + + if (! TOKENS.OS.trail) { + TOKENS.OS.trail = new RegExp('(?:'+ TOKENS.OS.id +')+$'); + } + + return pattern + .replace(TOKENS.OS.rgx, TOKENS.OS.save) + .replace(PARAMS_REGEXP, replaceFn) + .replace(TOKENS.OS.trail, '') // remove trailing + .replace(TOKENS.OS.rRestore, '/'); // add slash between segments + } + + //API + return { + strict : function(){ + _slashMode = STRICT_SLASH; + }, + loose : function(){ + _slashMode = LOOSE_SLASH; + }, + legacy : function(){ + _slashMode = LEGACY_SLASH; + }, + getParamIds : getParamIds, + getOptionalParamsIds : getOptionalParamsIds, + getParamValues : getParamValues, + compilePattern : compilePattern, + interpolate : interpolate + }; + + }()); + + + return crossroads; +}); +}(typeof define === 'function' && define.amd ? define : function (deps, factory) { + if (typeof module !== 'undefined' && module.exports) { //Node + module.exports = factory(require(deps[0])); + } else { + /*jshint sub:true */ + window['crossroads'] = factory(window[deps[0]]); + } +})); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/files/jquery.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/files/jquery.js new file mode 100644 index 00000000..8c24ffc6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/files/jquery.js @@ -0,0 +1,9472 @@ +/*! + * jQuery JavaScript Library v1.8.3 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time) + */ +(function( window, undefined ) { +var + // A central reference to the root jQuery(document) + rootjQuery, + + // The deferred used on DOM ready + readyList, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + location = window.location, + navigator = window.navigator, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // Save a reference to some core methods + core_push = Array.prototype.push, + core_slice = Array.prototype.slice, + core_indexOf = Array.prototype.indexOf, + core_toString = Object.prototype.toString, + core_hasOwn = Object.prototype.hasOwnProperty, + core_trim = String.prototype.trim, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Used for matching numbers + core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, + + // Used for detecting and trimming whitespace + core_rnotwhite = /\S/, + core_rspace = /\s+/, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + + // The ready event handler and self cleanup method + DOMContentLoaded = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + } else if ( document.readyState === "complete" ) { + // we're here because readyState === "complete" in oldIE + // which is good enough for us to call the dom ready! + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context && context.nodeType ? context.ownerDocument || context : document ); + + // scripts is true for back-compat + selector = jQuery.parseHTML( match[1], doc, true ); + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + this.attr.call( selector, context, true ); + } + + return jQuery.merge( this, selector ); + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.8.3", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return core_slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }, + + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ), + "slice", core_slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ core_toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // scripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, scripts ) { + var parsed; + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + scripts = context; + context = 0; + } + context = context || document; + + // Single tag + if ( (parsed = rsingleTag.exec( data )) ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); + return jQuery.merge( [], + (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); + }, + + parseJSON: function( data ) { + if ( !data || typeof data !== "string") { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && core_rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var name, + i = 0, + length = obj.length, + isObj = length === undefined || jQuery.isFunction( obj ); + + if ( args ) { + if ( isObj ) { + for ( name in obj ) { + if ( callback.apply( obj[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( obj[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in obj ) { + if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var type, + ret = results || []; + + if ( arr != null ) { + // The window, strings (and functions) also have 'length' + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + type = jQuery.type( arr ); + + if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { + core_push.call( ret, arr ); + } else { + jQuery.merge( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, + ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, pass ) { + var exec, + bulk = key == null, + i = 0, + length = elems.length; + + // Sets many values + if ( key && typeof key === "object" ) { + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); + } + chainable = 1; + + // Sets one value + } else if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = pass === undefined && jQuery.isFunction( value ); + + if ( bulk ) { + // Bulk operations only iterate when executing function values + if ( exec ) { + exec = fn; + fn = function( elem, key, value ) { + return exec.call( jQuery( elem ), value ); + }; + + // Otherwise they run against the entire set + } else { + fn.call( elems, value ); + fn = null; + } + } + + if ( fn ) { + for (; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + } + + chainable = 1; + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + } +}); + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready, 1 ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.split( core_rspace ), function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + return jQuery.inArray( fn, list ) > -1; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( list && ( !fired || stack ) ) { + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? + function() { + var returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + } : + newDefer[ action ] + ); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] = list.fire + deferred[ tuple[0] ] = list.fire; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); +jQuery.support = (function() { + + var support, + all, + a, + select, + opt, + input, + fragment, + eventName, + i, + isSupported, + clickFn, + div = document.createElement("div"); + + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = "
a"; + + // Support tests won't run in some limited or non-browser environments + all = div.getElementsByTagName("*"); + a = div.getElementsByTagName("a")[ 0 ]; + if ( !all || !a || !all.length ) { + return {}; + } + + // First batch of tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; + + a.style.cssText = "top:1px;float:left;opacity:.5"; + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute("href") === "/a" ), + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.5/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Tests for enctype support on a form (#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + + // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode + boxModel: ( document.compatMode === "CSS1Compat" ), + + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + boxSizingReliable: true, + pixelPosition: false + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", clickFn = function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent("onclick"); + div.detachEvent( "onclick", clickFn ); + } + + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; + + input.setAttribute( "checked", "checked" ); + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + fragment.removeChild( input ); + fragment.appendChild( div ); + + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for ( i in { + submit: true, + change: true, + focusin: true + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + // Run tests that need a body at doc ready + jQuery(function() { + var container, div, tds, marginDiv, + divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + container = document.createElement("div"); + container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; + body.insertBefore( container, body.firstChild ); + + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = "
t
"; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check box-sizing and margin behavior + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + support.boxSizing = ( div.offsetWidth === 4 ); + support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); + + // NOTE: To any future maintainer, we've window.getComputedStyle + // because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = document.createElement("div"); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } + + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = "block"; + div.style.overflow = "visible"; + div.innerHTML = "
"; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + + container.style.zoom = 1; + } + + // Null elements to avoid leaks in IE + body.removeChild( container ); + container = div = tds = marginDiv = null; + }); + + // Null elements to avoid leaks in IE + fragment.removeChild( div ); + all = a = select = opt = input = fragment = div = null; + + return support; +})(); +var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, + rmultiDash = /([A-Z])/g; + +jQuery.extend({ + cache: {}, + + deletedIds: [], + + // Remove at next major release (1.9/2.0) + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var parts, part, attr, name, l, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attr = elem.attributes; + for ( l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( !name.indexOf( "data-" ) ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + parts = key.split( ".", 2 ); + parts[1] = parts[1] ? "." + parts[1] : ""; + part = parts[1] + "!"; + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + data = this.triggerHandler( "getData" + part, [ parts[0] ] ); + + // Try to fetch any internally stored data first + if ( data === undefined && elem ) { + data = jQuery.data( elem, key ); + data = dataAttr( elem, key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + } + + parts[1] = value; + this.each(function() { + var self = jQuery( this ); + + self.triggerHandler( "setData" + part, parts ); + jQuery.data( this, key, value ); + self.triggerHandler( "changeData" + part, parts ); + }); + }, null, value, arguments.length > 1, null, false ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery.removeData( elem, type + "queue", true ); + jQuery.removeData( elem, key, true ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var nodeHook, boolHook, fixSpecified, + rclass = /[\t\r\n]/g, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea|)$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } + + if ( value && typeof value === "string" ) { + classNames = value.split( core_rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; + + } else { + setClass = " " + elem.className + " "; + + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var removes, className, elem, c, cl, i, l; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + if ( (value && typeof value === "string") || value === undefined ) { + removes = ( value || "" ).split( core_rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + if ( elem.nodeType === 1 && elem.className ) { + + className = (" " + elem.className + " ").replace( rclass, " " ); + + // loop over each item in the removal list + for ( c = 0, cl = removes.length; c < cl; c++ ) { + // Remove until there is nothing to remove, + while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { + className = className.replace( " " + removes[ c ] + " " , " " ); + } + } + elem.className = value ? jQuery.trim( className ) : ""; + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( core_rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var val, + self = jQuery(this); + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 + attrFn: {}, + + attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { + return jQuery( elem )[ name ]( value ); + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, value + "" ); + return value; + } + + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + ret = elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var propName, attrNames, name, isBool, + i = 0; + + if ( value && elem.nodeType === 1 ) { + + attrNames = value.split( core_rspace ); + + for ( ; i < attrNames.length; i++ ) { + name = attrNames[ i ]; + + if ( name ) { + propName = jQuery.propFix[ name ] || name; + isBool = rboolean.test( name ); + + // See #9699 for explanation of this approach (setting first, then removal) + // Do not do this for boolean attributes (see #10870) + if ( !isBool ) { + jQuery.attr( elem, name, "" ); + } + elem.removeAttribute( getSetAttribute ? name : propName ); + + // Set corresponding property to false for boolean attributes + if ( isBool && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + fixSpecified = { + name: true, + id: true, + coords: true + }; + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? + ret.value : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.value = value + "" ); + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); +var rformElems = /^(?:textarea|input|select)$/i, + rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, + rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + events = elemData.events; + if ( !events ) { + elemData.events = events = {}; + } + eventHandle = elemData.handle; + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { + + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + handlers = events[ type ]; + if ( !handlers ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var t, tns, type, origType, namespaces, origCount, + j, events, special, eventType, handleObj, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; + + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); + + if ( handleObj.selector ) { + eventType.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, "events", true ); + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + + // Event object or event type + var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, + type = event.type || event, + namespaces = []; + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); + } + } + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + for ( old = elem; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old === (elem.ownerDocument || document) ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + } + } + + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + + cur = eventPath[i][0]; + event.type = eventPath[i][1]; + + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, + handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = core_slice.call( arguments ), + run_all = !event.exclusive && !event.namespace, + special = jQuery.event.special[ event.type ] || {}, + handlerQueue = []; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers that should run if there are delegated events + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !(event.button && event.type === "click") ) { + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + + // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.disabled !== true || event.type !== "click" ) { + selMatch = {}; + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = jQuery.Event( originalEvent ); + + for ( i = copy.length; i; ) { + prop = copy[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Target should not be a text node (#504, Safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) + event.metaKey = !!event.metaKey; + + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +// Some plugins are using, but it's undocumented/deprecated and will be removed. +// The 1.7 special event interface should provide all the hooks needed now. +jQuery.event.handle = jQuery.event.dispatch; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === "undefined" ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "_submit_attached" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "_submit_attached", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "_change_attached", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { // && selector != null + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://sizzlejs.com/ + */ +(function( window, undefined ) { + +var cachedruns, + assertGetIdNotName, + Expr, + getText, + isXML, + contains, + compile, + sortOrder, + hasDuplicate, + outermostContext, + + baseHasDuplicate = true, + strundefined = "undefined", + + expando = ( "sizcache" + Math.random() ).replace( ".", "" ), + + Token = String, + document = window.document, + docElem = document.documentElement, + dirruns = 0, + done = 0, + pop = [].pop, + push = [].push, + slice = [].slice, + // Use a stripped-down indexOf if a native one is unavailable + indexOf = [].indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + // Augment a function for special use by Sizzle + markFunction = function( fn, value ) { + fn[ expando ] = value == null || value; + return fn; + }, + + createCache = function() { + var cache = {}, + keys = []; + + return markFunction(function( key, value ) { + // Only keep the most recent entries + if ( keys.push( key ) > Expr.cacheLength ) { + delete cache[ keys.shift() ]; + } + + // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) + return (cache[ key + " " ] = value); + }, cache ); + }, + + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + + // Regex + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + operators = "([*^$|!~]?=)", + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments not in parens/brackets, + // then attribute selectors and non-pseudos (denoted by :), + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", + + // For matchExpr.POS and matchExpr.needsContext + pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), + rpseudo = new RegExp( pseudos ), + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, + + rnot = /^:not/, + rsibling = /[\x20\t\r\n\f]*[+~]/, + rendsWithNot = /:not\($/, + + rheader = /h\d/i, + rinputs = /input|select|textarea|button/i, + + rbackslash = /\\(?!\\)/g, + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "POS": new RegExp( pos, "i" ), + "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + // For use in libraries implementing .is() + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) + }, + + // Support + + // Used for testing something on an element + assert = function( fn ) { + var div = document.createElement("div"); + + try { + return fn( div ); + } catch (e) { + return false; + } finally { + // release memory in IE + div = null; + } + }, + + // Check if getElementsByTagName("*") returns only elements + assertTagNameNoComments = assert(function( div ) { + div.appendChild( document.createComment("") ); + return !div.getElementsByTagName("*").length; + }), + + // Check if getAttribute returns normalized href attributes + assertHrefNotNormalized = assert(function( div ) { + div.innerHTML = ""; + return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && + div.firstChild.getAttribute("href") === "#"; + }), + + // Check if attributes should be retrieved by attribute nodes + assertAttributes = assert(function( div ) { + div.innerHTML = ""; + var type = typeof div.lastChild.getAttribute("multiple"); + // IE8 returns a string for some attributes even when not present + return type !== "boolean" && type !== "string"; + }), + + // Check if getElementsByClassName can be trusted + assertUsableClassName = assert(function( div ) { + // Opera can't find a second classname (in 9.6) + div.innerHTML = ""; + if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { + return false; + } + + // Safari 3.2 caches class attributes and doesn't catch changes + div.lastChild.className = "e"; + return div.getElementsByClassName("e").length === 2; + }), + + // Check if getElementById returns elements by name + // Check if getElementsByName privileges form controls or returns elements by ID + assertUsableName = assert(function( div ) { + // Inject content + div.id = expando + 0; + div.innerHTML = "
"; + docElem.insertBefore( div, docElem.firstChild ); + + // Test + var pass = document.getElementsByName && + // buggy browsers will return fewer than the correct 2 + document.getElementsByName( expando ).length === 2 + + // buggy browsers will return more than the correct 0 + document.getElementsByName( expando + 0 ).length; + assertGetIdNotName = !document.getElementById( expando ); + + // Cleanup + docElem.removeChild( div ); + + return pass; + }); + +// If slice is not available, provide a backup +try { + slice.call( docElem.childNodes, 0 )[0].nodeType; +} catch ( e ) { + slice = function( i ) { + var elem, + results = []; + for ( ; (elem = this[i]); i++ ) { + results.push( elem ); + } + return results; + }; +} + +function Sizzle( selector, context, results, seed ) { + results = results || []; + context = context || document; + var match, elem, xml, m, + nodeType = context.nodeType; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( nodeType !== 1 && nodeType !== 9 ) { + return []; + } + + xml = isXML( context ); + + if ( !xml && !seed ) { + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { + push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); + return results; + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); +} + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + return Sizzle( expr, null, null, [ elem ] ).length > 0; +}; + +// Returns a function to use in pseudos for input types +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +// Returns a function to use in pseudos for buttons +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +// Returns a function to use in pseudos for positionals +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + } else { + + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } + return ret; +}; + +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +// Element contains another +contains = Sizzle.contains = docElem.contains ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); + } : + docElem.compareDocumentPosition ? + function( a, b ) { + return b && !!( a.compareDocumentPosition( b ) & 16 ); + } : + function( a, b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + return false; + }; + +Sizzle.attr = function( elem, name ) { + var val, + xml = isXML( elem ); + + if ( !xml ) { + name = name.toLowerCase(); + } + if ( (val = Expr.attrHandle[ name ]) ) { + return val( elem ); + } + if ( xml || assertAttributes ) { + return elem.getAttribute( name ); + } + val = elem.getAttributeNode( name ); + return val ? + typeof elem[ name ] === "boolean" ? + elem[ name ] ? name : null : + val.specified ? val.value : null : + null; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + // IE6/7 return a modified href + attrHandle: assertHrefNotNormalized ? + {} : + { + "href": function( elem ) { + return elem.getAttribute( "href", 2 ); + }, + "type": function( elem ) { + return elem.getAttribute("type"); + } + }, + + find: { + "ID": assertGetIdNotName ? + function( id, context, xml ) { + if ( typeof context.getElementById !== strundefined && !xml ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + } : + function( id, context, xml ) { + if ( typeof context.getElementById !== strundefined && !xml ) { + var m = context.getElementById( id ); + + return m ? + m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? + [m] : + undefined : + []; + } + }, + + "TAG": assertTagNameNoComments ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + var elem, + tmp = [], + i = 0; + + for ( ; (elem = results[i]); i++ ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }, + + "NAME": assertUsableName && function( tag, context ) { + if ( typeof context.getElementsByName !== strundefined ) { + return context.getElementsByName( name ); + } + }, + + "CLASS": assertUsableClassName && function( className, context, xml ) { + if ( typeof context.getElementsByClassName !== strundefined && !xml ) { + return context.getElementsByClassName( className ); + } + } + }, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( rbackslash, "" ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 3 xn-component of xn+y argument ([+-]?\d*n|) + 4 sign of xn-component + 5 x of xn-component + 6 sign of y-component + 7 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1] === "nth" ) { + // nth-child requires argument + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); + match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); + + // other types prohibit arguments + } else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var unquoted, excess; + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + if ( match[3] ) { + match[2] = match[3]; + } else if ( (unquoted = match[4]) ) { + // Only check arguments that contain a pseudo + if ( rpseudo.test(unquoted) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + unquoted = unquoted.slice( 0, excess ); + match[0] = match[0].slice( 0, excess ); + } + match[2] = unquoted; + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + "ID": assertGetIdNotName ? + function( id ) { + id = id.replace( rbackslash, "" ); + return function( elem ) { + return elem.getAttribute("id") === id; + }; + } : + function( id ) { + id = id.replace( rbackslash, "" ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === id; + }; + }, + + "TAG": function( nodeName ) { + if ( nodeName === "*" ) { + return function() { return true; }; + } + nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); + + return function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ expando ][ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem, context ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.substr( result.length - check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, argument, first, last ) { + + if ( type === "nth" ) { + return function( elem ) { + var node, diff, + parent = elem.parentNode; + + if ( first === 1 && last === 0 ) { + return true; + } + + if ( parent ) { + diff = 0; + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + diff++; + if ( elem === node ) { + break; + } + } + } + } + + // Incorporate the offset (or cast to NaN), then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + }; + } + + return function( elem ) { + var node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + /* falls through */ + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + var nodeType; + elem = elem.firstChild; + while ( elem ) { + if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { + return false; + } + elem = elem.nextSibling; + } + return true; + }, + + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "text": function( elem ) { + var type, attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + (type = elem.type) === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); + }, + + // Input types + "radio": createInputPseudo("radio"), + "checkbox": createInputPseudo("checkbox"), + "file": createInputPseudo("file"), + "password": createInputPseudo("password"), + "image": createInputPseudo("image"), + + "submit": createButtonPseudo("submit"), + "reset": createButtonPseudo("reset"), + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "focus": function( elem ) { + var doc = elem.ownerDocument; + return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + "active": function( elem ) { + return elem === elem.ownerDocument.activeElement; + }, + + // Positional types + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + for ( var i = 0; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + for ( var i = 1; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +function siblingCheck( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; +} + +sortOrder = docElem.compareDocumentPosition ? + function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? + a.compareDocumentPosition : + a.compareDocumentPosition(b) & 4 + ) ? -1 : 1; + } : + function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + +// Always assume the presence of duplicates if sort doesn't +// pass them to our comparison function (as in Google Chrome). +[0, 0].sort( sortOrder ); +baseHasDuplicate = !hasDuplicate; + +// Document sorting and removing duplicates +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + i = 1, + j = 0; + + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem === results[ i - 1 ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + return results; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ expando ][ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( tokens = [] ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + tokens.push( matched = new Token( match.shift() ) ); + soFar = soFar.slice( matched.length ); + + // Cast descendant combinators to space + matched.type = match[0].replace( rtrim, " " ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + + tokens.push( matched = new Token( match.shift() ) ); + soFar = soFar.slice( matched.length ); + matched.type = type; + matched.matches = match; + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && combinator.dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( !xml ) { + var cache, + dirkey = dirruns + " " + doneName + " ", + cachedkey = dirkey + cachedruns; + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + if ( (cache = elem[ expando ]) === cachedkey ) { + return elem.sizset; + } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { + if ( elem.sizset ) { + return elem; + } + } else { + elem[ expando ] = cachedkey; + if ( matcher( elem, context, xml ) ) { + elem.sizset = true; + return elem; + } + elem.sizset = false; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + if ( matcher( elem, context, xml ) ) { + return elem; + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && tokens.join("") + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Nested matchers should use non-integer dirruns + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); + + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = superMatcher.el; + } + + // Add elements passing elementMatchers directly to results + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + for ( j = 0; (matcher = elementMatchers[j]); j++ ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++superMatcher.el; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + for ( j = 0; (matcher = setMatchers[j]); j++ ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + superMatcher.el = 0; + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ expando ][ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed, xml ) { + var i, tokens, token, type, find, + match = tokenize( selector ), + j = match.length; + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && !xml && + Expr.relative[ tokens[1].type ] ) { + + context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; + if ( !context ) { + return results; + } + + selector = selector.slice( tokens.shift().length ); + } + + // Fetch a seed set for right-to-left matching + for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( rbackslash, "" ), + rsibling.test( tokens[0].type ) && context.parentNode || context, + xml + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && tokens.join(""); + if ( !selector ) { + push.apply( results, slice.call( seed, 0 ) ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + xml, + results, + rsibling.test( selector ) + ); + return results; +} + +if ( document.querySelectorAll ) { + (function() { + var disconnectedMatch, + oldSelect = select, + rescape = /'|\\/g, + rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, + + // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA + // A support test would require too much code (would include document ready) + rbuggyQSA = [ ":focus" ], + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + // A support test would require too much code (would include document ready) + // just skip matchesSelector for :active + rbuggyMatches = [ ":active" ], + matches = docElem.matchesSelector || + docElem.mozMatchesSelector || + docElem.webkitMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector; + + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explictly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // IE8 - Some boolean attributes are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here (do not put tests after this one) + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + + // Opera 10-12/IE9 - ^= $= *= and empty values + // Should not select anything + div.innerHTML = "

"; + if ( div.querySelectorAll("[test^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here (do not put tests after this one) + div.innerHTML = ""; + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push(":enabled", ":disabled"); + } + }); + + // rbuggyQSA always contains :focus, so no need for a length check + rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); + + select = function( selector, context, results, seed, xml ) { + // Only use querySelectorAll when not filtering, + // when this is not xml, + // and when no QSA bugs apply + if ( !seed && !xml && !rbuggyQSA.test( selector ) ) { + var groups, i, + old = true, + nid = expando, + newContext = context, + newSelector = context.nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + groups[i].join(""); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, slice.call( newContext.querySelectorAll( + newSelector + ), 0 ) ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + + return oldSelect( selector, context, results, seed, xml ); + }; + + if ( matches ) { + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + try { + matches.call( div, "[test!='']:sizzle" ); + rbuggyMatches.push( "!=", pseudos ); + } catch ( e ) {} + }); + + // rbuggyMatches always contains :active and :focus, so no need for a length check + rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); + + Sizzle.matchesSelector = function( elem, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + // rbuggyMatches always contains :active, so no need for an existence check + if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) { + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, null, null, [ elem ] ).length > 0; + }; + } + })(); +} + +// Deprecated +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Back-compat +function setFilters() {} +Expr.filters = setFilters.prototype = Expr.pseudos; +Expr.setFilters = new setFilters(); + +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})( window ); +var runtil = /Until$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, + isSimple = /^.[^:#\[\.,]*$/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var i, l, length, n, r, ret, + self = this; + + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + ret = this.pushStack( "", "find", selector ); + + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + rneedsContext.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + cur = this[i]; + + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + } + cur = cur.parentNode; + } + } + + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +jQuery.fn.andSelf = jQuery.fn.addBack; + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( this.length > 1 && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /]", "i"), + rcheckableType = /^(?:checkbox|radio)$/, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /\/(java|ecma)script/i, + rcleanScript = /^\s*\s*$/g, + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
", "
" ], + thead: [ 1, "", "
" ], + tr: [ 2, "", "
" ], + td: [ 3, "", "
" ], + col: [ 2, "", "
" ], + area: [ 1, "", "" ], + _default: [ 0, "", "" ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, +// unless wrapped in a div with non-breaking characters in front of it. +if ( !jQuery.support.htmlSerialize ) { + wrapMap._default = [ 1, "X
", "
" ]; +} + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + if ( !isDisconnected( this[0] ) ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this ); + }); + } + + if ( arguments.length ) { + var set = jQuery.clean( arguments ); + return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); + } + }, + + after: function() { + if ( !isDisconnected( this[0] ) ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + } + + if ( arguments.length ) { + var set = jQuery.clean( arguments ); + return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); + } + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + jQuery.cleanData( [ elem ] ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName( "*" ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + if ( !isDisconnected( this[0] ) ) { + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( jQuery.isFunction( value ) ) { + return this.each(function(i) { + var self = jQuery(this), old = self.html(); + self.replaceWith( value.call( this, i, old ) ); + }); + } + + if ( typeof value !== "string" ) { + value = jQuery( value ).detach(); + } + + return this.each(function() { + var next = this.nextSibling, + parent = this.parentNode; + + jQuery( this ).remove(); + + if ( next ) { + jQuery(next).before( value ); + } else { + jQuery(parent).append( value ); + } + }); + } + + return this.length ? + this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : + this; + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + + // Flatten any nested arrays + args = [].concat.apply( [], args ); + + var results, first, fragment, iNoClone, + i = 0, + value = args[0], + scripts = [], + l = this.length; + + // We can't cloneNode fragments that contain checked, in WebKit + if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { + return this.each(function() { + jQuery(this).domManip( args, table, callback ); + }); + } + + if ( jQuery.isFunction(value) ) { + return this.each(function(i) { + var self = jQuery(this); + args[0] = value.call( this, i, table ? self.html() : undefined ); + self.domManip( args, table, callback ); + }); + } + + if ( this[0] ) { + results = jQuery.buildFragment( args, this, scripts ); + fragment = results.fragment; + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + // Fragments from the fragment cache must always be cloned and never used in place. + for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + i === iNoClone ? + fragment : + jQuery.clone( fragment, true, true ) + ); + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + + if ( scripts.length ) { + jQuery.each( scripts, function( i, elem ) { + if ( elem.src ) { + if ( jQuery.ajax ) { + jQuery.ajax({ + url: elem.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.error("no ajax"); + } + } else { + jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + }); + } + } + + return this; + } +}); + +function findOrAppend( elem, tag ) { + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function cloneFixAttributes( src, dest ) { + var nodeName; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + // clearAttributes removes the attributes, which we don't want, + // but also removes the attachEvent events, which we *do* want + if ( dest.clearAttributes ) { + dest.clearAttributes(); + } + + // mergeAttributes, in contrast, only merges back on the + // original attributes, not the events + if ( dest.mergeAttributes ) { + dest.mergeAttributes( src ); + } + + nodeName = dest.nodeName.toLowerCase(); + + if ( nodeName === "object" ) { + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + + // IE blanks contents when cloning scripts + } else if ( nodeName === "script" && dest.text !== src.text ) { + dest.text = src.text; + } + + // Event data gets referenced instead of copied if the expando + // gets copied too + dest.removeAttribute( jQuery.expando ); +} + +jQuery.buildFragment = function( args, context, scripts ) { + var fragment, cacheable, cachehit, + first = args[ 0 ]; + + // Set context from what may come in as undefined or a jQuery collection or a node + // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & + // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception + context = context || document; + context = !context.nodeType && context[0] || context; + context = context.ownerDocument || context; + + // Only cache "small" (1/2 KB) HTML strings that are associated with the main document + // Cloning options loses the selected state, so don't cache them + // IE 6 doesn't like it when you put or elements in a fragment + // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache + // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 + if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && + first.charAt(0) === "<" && !rnocache.test( first ) && + (jQuery.support.checkClone || !rchecked.test( first )) && + (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { + + // Mark cacheable and look for a hit + cacheable = true; + fragment = jQuery.fragments[ first ]; + cachehit = fragment !== undefined; + } + + if ( !fragment ) { + fragment = context.createDocumentFragment(); + jQuery.clean( args, context, fragment, scripts ); + + // Update the cache, but only store false + // unless this is a second parsing of the same content + if ( cacheable ) { + jQuery.fragments[ first ] = cachehit && fragment; + } + } + + return { fragment: fragment, cacheable: cacheable }; +}; + +jQuery.fragments = {}; + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + l = insert.length, + parent = this.length === 1 && this[0].parentNode; + + if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { + insert[ original ]( this[0] ); + return this; + } else { + for ( ; i < l; i++ ) { + elems = ( i > 0 ? this.clone(true) : this ).get(); + jQuery( insert[i] )[ original ]( elems ); + ret = ret.concat( elems ); + } + + return this.pushStack( ret, name, insert.selector ); + } + }; +}); + +function getAll( elem ) { + if ( typeof elem.getElementsByTagName !== "undefined" ) { + return elem.getElementsByTagName( "*" ); + + } else if ( typeof elem.querySelectorAll !== "undefined" ) { + return elem.querySelectorAll( "*" ); + + } else { + return []; + } +} + +// Used in clean, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var srcElements, + destElements, + i, + clone; + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + // IE copies events bound via attachEvent when using cloneNode. + // Calling detachEvent on the clone will also remove the events + // from the original. In order to get around this, we use some + // proprietary methods to clear the events. Thanks to MooTools + // guys for this hotness. + + cloneFixAttributes( elem, clone ); + + // Using Sizzle here is crazy slow, so we use getElementsByTagName instead + srcElements = getAll( elem ); + destElements = getAll( clone ); + + // Weird iteration because IE will replace the length property + // with an element if you are cloning the body and one of the + // elements on the page has a name or id of "length" + for ( i = 0; srcElements[i]; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + cloneFixAttributes( srcElements[i], destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + cloneCopyEvent( elem, clone ); + + if ( deepDataAndEvents ) { + srcElements = getAll( elem ); + destElements = getAll( clone ); + + for ( i = 0; srcElements[i]; ++i ) { + cloneCopyEvent( srcElements[i], destElements[i] ); + } + } + } + + srcElements = destElements = null; + + // Return the cloned set + return clone; + }, + + clean: function( elems, context, fragment, scripts ) { + var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, + safe = context === document && safeFragment, + ret = []; + + // Ensure that context is a document + if ( !context || typeof context.createDocumentFragment === "undefined" ) { + context = document; + } + + // Use the already-created safe fragment if context permits + for ( i = 0; (elem = elems[i]) != null; i++ ) { + if ( typeof elem === "number" ) { + elem += ""; + } + + if ( !elem ) { + continue; + } + + // Convert html string into DOM nodes + if ( typeof elem === "string" ) { + if ( !rhtml.test( elem ) ) { + elem = context.createTextNode( elem ); + } else { + // Ensure a safe container in which to render the html + safe = safe || createSafeFragment( context ); + div = context.createElement("div"); + safe.appendChild( div ); + + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(rxhtmlTag, "<$1>"); + + // Go to html and back, then peel off extra wrappers + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + depth = wrap[0]; + div.innerHTML = wrap[1] + elem + wrap[2]; + + // Move to the right depth + while ( depth-- ) { + div = div.lastChild; + } + + // Remove IE's autoinserted from table fragments + if ( !jQuery.support.tbody ) { + + // String was a , *may* have spurious + hasBody = rtbody.test(elem); + tbody = tag === "table" && !hasBody ? + div.firstChild && div.firstChild.childNodes : + + // String was a bare or + wrap[1] === "
" && !hasBody ? + div.childNodes : + []; + + for ( j = tbody.length - 1; j >= 0 ; --j ) { + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { + tbody[ j ].parentNode.removeChild( tbody[ j ] ); + } + } + } + + // IE completely kills leading whitespace when innerHTML is used + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); + } + + elem = div.childNodes; + + // Take out of fragment container (we need a fresh div each time) + div.parentNode.removeChild( div ); + } + } + + if ( elem.nodeType ) { + ret.push( elem ); + } else { + jQuery.merge( ret, elem ); + } + } + + // Fix #11356: Clear elements from safeFragment + if ( div ) { + elem = div = safe = null; + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + for ( i = 0; (elem = ret[i]) != null; i++ ) { + if ( jQuery.nodeName( elem, "input" ) ) { + fixDefaultChecked( elem ); + } else if ( typeof elem.getElementsByTagName !== "undefined" ) { + jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); + } + } + } + + // Append elements to a provided document fragment + if ( fragment ) { + // Special handling of each script element + handleScript = function( elem ) { + // Check if we consider it executable + if ( !elem.type || rscriptType.test( elem.type ) ) { + // Detach the script and store it in the scripts array (if provided) or the fragment + // Return truthy to indicate that it has been handled + return scripts ? + scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : + fragment.appendChild( elem ); + } + }; + + for ( i = 0; (elem = ret[i]) != null; i++ ) { + // Check if we're done after handling an executable script + if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { + // Append to fragment and handle embedded scripts + fragment.appendChild( elem ); + if ( typeof elem.getElementsByTagName !== "undefined" ) { + // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration + jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); + + // Splice the scripts into ret after their former ancestor and advance our index beyond them + ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); + i += jsTags.length; + } + } + } + } + + return ret; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var data, id, elem, type, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( elem.removeAttribute ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + jQuery.deletedIds.push( id ); + } + } + } + } + } +}); +// Limit scope pollution from any deprecated API +(function() { + +var matched, browser; + +// Use of jQuery.browser is frowned upon. +// More details: http://api.jquery.com/jQuery.browser +// jQuery.uaMatch maintained for back-compat +jQuery.uaMatch = function( ua ) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; +}; + +matched = jQuery.uaMatch( navigator.userAgent ); +browser = {}; + +if ( matched.browser ) { + browser[ matched.browser ] = true; + browser.version = matched.version; +} + +// Chrome is Webkit, but Webkit is also Safari. +if ( browser.chrome ) { + browser.webkit = true; +} else if ( browser.webkit ) { + browser.safari = true; +} + +jQuery.browser = browser; + +jQuery.sub = function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; +}; + +})(); +var curCSS, iframe, iframeDoc, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity=([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], + + eventsToggle = jQuery.fn.toggle; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var elem, display, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + values[ index ] = jQuery._data( elem, "olddisplay" ); + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && elem.style.display === "none" ) { + elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else { + display = curCSS( elem, "display" ); + + if ( !values[ index ] && display !== "none" ) { + jQuery._data( elem, "olddisplay", display ); + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state, fn2 ) { + var bool = typeof state === "boolean"; + + if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { + return eventsToggle.apply( this, arguments ); + } + + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, numeric, extra ) { + var val, num, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( numeric || extra !== undefined ) { + num = parseFloat( val ); + return numeric || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.call( elem ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// NOTE: To any future maintainer, we've window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + curCSS = function( elem, name ) { + var ret, width, minWidth, maxWidth, + computed = window.getComputedStyle( elem, null ), + style = elem.style; + + if ( computed ) { + + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + curCSS = function( elem, name ) { + var left, rsLeft, + ret = elem.currentStyle && elem.currentStyle[ name ], + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + elem.runtimeStyle.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + elem.runtimeStyle.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + // we use jQuery.css instead of curCSS here + // because of the reliableMarginRight CSS hook! + val += jQuery.css( elem, extra + cssExpand[ i ], true ); + } + + // From this point on we use curCSS for maximum performance (relevant in animations) + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + } else { + // at this point, extra isn't content, so add padding + val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + valueIsBorderBox = true, + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox + ) + ) + "px"; +} + + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + if ( elemdisplay[ nodeName ] ) { + return elemdisplay[ nodeName ]; + } + + var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), + display = elem.css("display"); + elem.remove(); + + // If the simple way fails, + // get element's real default display by attaching it to a temp iframe + if ( display === "none" || display === "" ) { + // Use the already-created iframe if possible + iframe = document.body.appendChild( + iframe || jQuery.extend( document.createElement("iframe"), { + frameBorder: 0, + width: 0, + height: 0 + }) + ); + + // Create a cacheable copy of the iframe document on first call. + // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML + // document to it; WebKit & Firefox won't allow reusing the iframe document. + if ( !iframeDoc || !iframe.createElement ) { + iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; + iframeDoc.write(""); + iframeDoc.close(); + } + + elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); + + display = curCSS( elem, "display" ); + document.body.removeChild( iframe ); + } + + // Store the correct default display + elemdisplay[ nodeName ] = display; + + return display; +} + +jQuery.each([ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + // certain elements can have dimension info if we invisibly show them + // however, it must have a current display style that would benefit from this + if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { + return jQuery.swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + }); + } else { + return getWidthOrHeight( elem, name, extra ); + } + } + }, + + set: function( elem, value, extra ) { + return setPositiveNumber( elem, value, extra ? + augmentWidthOrHeight( + elem, + name, + extra, + jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" + ) : 0 + ); + } + }; +}); + +if ( !jQuery.support.opacity ) { + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : + computed ? "1" : ""; + }, + + set: function( elem, value ) { + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; + + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; + + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && + style.removeAttribute ) { + + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); + + // if there there is no filter style applied in a css rule, we are done + if ( currentStyle && !currentStyle.filter ) { + return; + } + } + + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; + } + }; +} + +// These hooks cannot be added until DOM ready because the support test +// for it is not run until after DOM ready +jQuery(function() { + if ( !jQuery.support.reliableMarginRight ) { + jQuery.cssHooks.marginRight = { + get: function( elem, computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + return jQuery.swap( elem, { "display": "inline-block" }, function() { + if ( computed ) { + return curCSS( elem, "marginRight" ); + } + }); + } + }; + } + + // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 + // getComputedStyle returns percent when specified for top/left/bottom/right + // rather than make the css module depend on the offset module, we just check for it here + if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { + jQuery.each( [ "top", "left" ], function( i, prop ) { + jQuery.cssHooks[ prop ] = { + get: function( elem, computed ) { + if ( computed ) { + var ret = curCSS( elem, prop ); + // if curCSS returns percentage, fallback to offset + return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; + } + } + }; + }); + } + +}); + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.hidden = function( elem ) { + return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); + }; + + jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); + }; +} + +// These hooks are used by animate to expand properties +jQuery.each({ + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i, + + // assumes a single number if not a string + parts = typeof value === "string" ? value.split(" ") : [ value ], + expanded = {}; + + for ( i = 0; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +}); +var r20 = /%20/g, + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, + rselectTextarea = /^(?:select|textarea)/i; + +jQuery.fn.extend({ + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map(function(){ + return this.elements ? jQuery.makeArray( this.elements ) : this; + }) + .filter(function(){ + return this.name && !this.disabled && + ( this.checked || rselectTextarea.test( this.nodeName ) || + rinput.test( this.type ) ); + }) + .map(function( i, elem ){ + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val, i ){ + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }).get(); + } +}); + +//Serialize an array of form elements or a set of +//key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; + + // Set traditional to true for jQuery <= 1.3.2 behavior. + if ( traditional === undefined ) { + traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + }); + + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ).replace( r20, "+" ); +}; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( jQuery.isArray( obj ) ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + // If array item is non-scalar (array or object), encode its + // numeric index to resolve deserialization ambiguity issues. + // Note that rack (as of 1.0.0) can't currently deserialize + // nested arrays properly, and attempting to do so may cause + // a server error. Possible fixes are to modify rack's + // deserialization algorithm or to provide an option or flag + // to force array serialization to be shallow. + buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); + } + }); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + // Serialize scalar item. + add( prefix, obj ); + } +} +var + // Document location + ajaxLocParts, + ajaxLocation, + + rhash = /#.*$/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + rquery = /\?/, + rscript = /)<[^<]*)*<\/script>/gi, + rts = /([?&])_=[^&]*/, + rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, + + // Keep a copy of the old load method + _load = jQuery.fn.load, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = ["*/"] + ["*"]; + +// #8138, IE may throw an exception when accessing +// a field from window.location if document.domain has been set +try { + ajaxLocation = location.href; +} catch( e ) { + // Use the href attribute of an A element + // since IE will modify it given document.location + ajaxLocation = document.createElement( "a" ); + ajaxLocation.href = ""; + ajaxLocation = ajaxLocation.href; +} + +// Segment location into parts +ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, list, placeBefore, + dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), + i = 0, + length = dataTypes.length; + + if ( jQuery.isFunction( func ) ) { + // For each dataType in the dataTypeExpression + for ( ; i < length; i++ ) { + dataType = dataTypes[ i ]; + // We control if we're asked to add before + // any existing element + placeBefore = /^\+/.test( dataType ); + if ( placeBefore ) { + dataType = dataType.substr( 1 ) || "*"; + } + list = structure[ dataType ] = structure[ dataType ] || []; + // then we add to the structure accordingly + list[ placeBefore ? "unshift" : "push" ]( func ); + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, + dataType /* internal */, inspected /* internal */ ) { + + dataType = dataType || options.dataTypes[ 0 ]; + inspected = inspected || {}; + + inspected[ dataType ] = true; + + var selection, + list = structure[ dataType ], + i = 0, + length = list ? list.length : 0, + executeOnly = ( structure === prefilters ); + + for ( ; i < length && ( executeOnly || !selection ); i++ ) { + selection = list[ i ]( options, originalOptions, jqXHR ); + // If we got redirected to another dataType + // we try there if executing only and not done already + if ( typeof selection === "string" ) { + if ( !executeOnly || inspected[ selection ] ) { + selection = undefined; + } else { + options.dataTypes.unshift( selection ); + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, selection, inspected ); + } + } + } + // If we're only executing or nothing was selected + // we try the catchall dataType if not done already + if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, "*", inspected ); + } + // unnecessary when only executing (prefilters) + // but it'll be ignored by the caller in that case + return selection; +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } +} + +jQuery.fn.load = function( url, params, callback ) { + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); + } + + // Don't do a request if no elements are being requested + if ( !this.length ) { + return this; + } + + var selector, type, response, + self = this, + off = url.indexOf(" "); + + if ( off >= 0 ) { + selector = url.slice( off, url.length ); + url = url.slice( 0, off ); + } + + // If it's a function + if ( jQuery.isFunction( params ) ) { + + // We assume that it's the callback + callback = params; + params = undefined; + + // Otherwise, build a param string + } else if ( params && typeof params === "object" ) { + type = "POST"; + } + + // Request the remote document + jQuery.ajax({ + url: url, + + // if "type" variable is undefined, then "GET" method will be used + type: type, + dataType: "html", + data: params, + complete: function( jqXHR, status ) { + if ( callback ) { + self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); + } + } + }).done(function( responseText ) { + + // Save response for use in complete callback + response = arguments; + + // See if a selector was specified + self.html( selector ? + + // Create a dummy div to hold the results + jQuery("
") + + // inject the contents of the document in, removing the scripts + // to avoid any 'Permission Denied' errors in IE + .append( responseText.replace( rscript, "" ) ) + + // Locate the specified elements + .find( selector ) : + + // If not, just inject the full result + responseText ); + + }); + + return this; +}; + +// Attach a bunch of functions for handling common AJAX events +jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ + jQuery.fn[ o ] = function( f ){ + return this.on( o, f ); + }; +}); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + return jQuery.ajax({ + type: method, + url: url, + data: data, + success: callback, + dataType: type + }); + }; +}); + +jQuery.extend({ + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + if ( settings ) { + // Building a settings object + ajaxExtend( target, jQuery.ajaxSettings ); + } else { + // Extending ajaxSettings + settings = target; + target = jQuery.ajaxSettings; + } + ajaxExtend( target, settings ); + return target; + }, + + ajaxSettings: { + url: ajaxLocation, + isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), + global: true, + type: "GET", + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + processData: true, + async: true, + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + xml: "application/xml, text/xml", + html: "text/html", + text: "text/plain", + json: "application/json, text/javascript", + "*": allTypes + }, + + contents: { + xml: /xml/, + html: /html/, + json: /json/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText" + }, + + // List of data converters + // 1) key format is "source_type destination_type" (a single space in-between) + // 2) the catchall symbol "*" can be used for source_type + converters: { + + // Convert anything to text + "* text": window.String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": jQuery.parseJSON, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + context: true, + url: true + } + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var // ifModified key + ifModifiedKey, + // Response headers + responseHeadersString, + responseHeaders, + // transport + transport, + // timeout handle + timeoutTimer, + // Cross-domain detection vars + parts, + // To know if global events are to be dispatched + fireGlobals, + // Loop variable + i, + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + // Callbacks context + callbackContext = s.context || s, + // Context for global events + // It's the callbackContext if one was provided in the options + // and if it's a DOM node or a jQuery collection + globalEventContext = callbackContext !== s && + ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? + jQuery( callbackContext ) : jQuery.event, + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + // Status-dependent callbacks + statusCode = s.statusCode || {}, + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + // The jqXHR state + state = 0, + // Default abort message + strAbort = "canceled", + // Fake xhr + jqXHR = { + + readyState: 0, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( !state ) { + var lname = name.toLowerCase(); + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( state === 2 ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match === undefined ? null : match; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( !state ) { + s.mimeType = type; + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + statusText = statusText || strAbort; + if ( transport ) { + transport.abort( statusText ); + } + done( 0, statusText ); + return this; + } + }; + + // Callback for when everything is done + // It is defined here because jslint complains if it is declared + // at the end of the function (which would be more logical and readable) + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Called once + if ( state === 2 ) { + return; + } + + // State is "done" now + state = 2; + + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // If successful, handle type chaining + if ( status >= 200 && status < 300 || status === 304 ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + + modified = jqXHR.getResponseHeader("Last-Modified"); + if ( modified ) { + jQuery.lastModified[ ifModifiedKey ] = modified; + } + modified = jqXHR.getResponseHeader("Etag"); + if ( modified ) { + jQuery.etag[ ifModifiedKey ] = modified; + } + } + + // If not modified + if ( status === 304 ) { + + statusText = "notmodified"; + isSuccess = true; + + // If we have data + } else { + + isSuccess = ajaxConvert( s, response ); + statusText = isSuccess.state; + success = isSuccess.data; + error = isSuccess.error; + isSuccess = !error; + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if ( !statusText || status ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + // Attach deferreds + deferred.promise( jqXHR ); + jqXHR.success = jqXHR.done; + jqXHR.error = jqXHR.fail; + jqXHR.complete = completeDeferred.add; + + // Status-dependent callbacks + jqXHR.statusCode = function( map ) { + if ( map ) { + var tmp; + if ( state < 2 ) { + for ( tmp in map ) { + statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; + } + } else { + tmp = map[ jqXHR.status ]; + jqXHR.always( tmp ); + } + } + return this; + }; + + // Remove hash character (#7531: and string promotion) + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // We also use the url parameter if available + s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + + // Extract dataTypes list + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); + + // A cross-domain request is in order when we have a protocol:host:port mismatch + if ( s.crossDomain == null ) { + parts = rurl.exec( s.url.toLowerCase() ); + s.crossDomain = !!( parts && + ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != + ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) + ); + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( state === 2 ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + fireGlobals = s.global; + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // If data is available, append data to url + if ( s.data ) { + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Get ifModifiedKey before adding the anti-cache parameter + ifModifiedKey = s.url; + + // Add anti-cache in url if needed + if ( s.cache === false ) { + + var ts = jQuery.now(), + // try replacing _= if it is there + ret = s.url.replace( rts, "$1_=" + ts ); + + // if nothing was replaced, add timestamp to the end + s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + ifModifiedKey = ifModifiedKey || s.url; + if ( jQuery.lastModified[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); + } + if ( jQuery.etag[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); + } + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { + // Abort if not done already and return + return jqXHR.abort(); + + } + + // aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + for ( i in { success: 1, error: 1, complete: 1 } ) { + jqXHR[ i ]( s[ i ] ); + } + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = setTimeout( function(){ + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + state = 1; + transport.send( requestHeaders, done ); + } catch (e) { + // Propagate exception as error if not done + if ( state < 2 ) { + done( -1, e ); + // Simply rethrow otherwise + } else { + throw e; + } + } + } + + return jqXHR; + }, + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {} + +}); + +/* Handles responses to an ajax request: + * - sets all responseXXX fields accordingly + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes, + responseFields = s.responseFields; + + // Fill responseXXX fields + for ( type in responseFields ) { + if ( type in responses ) { + jqXHR[ responseFields[type] ] = responses[ type ]; + } + } + + // Remove auto dataType and get content-type in the process + while( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +// Chain conversions given the request and the original response +function ajaxConvert( s, response ) { + + var conv, conv2, current, tmp, + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(), + prev = dataTypes[ 0 ], + converters = {}, + i = 0; + + // Apply the dataFilter if provided + if ( s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + // Convert to each sequential dataType, tolerating list modification + for ( ; (current = dataTypes[++i]); ) { + + // There's only work to do if current dataType is non-auto + if ( current !== "*" ) { + + // Convert response if prev dataType is non-auto and differs from current + if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split(" "); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.splice( i--, 0, current ); + } + + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s["throws"] ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; + } + } + } + } + + // Update prev for next iteration + prev = current; + } + } + + return { state: "success", data: response }; +} +var oldCallbacks = [], + rquestion = /\?/, + rjsonp = /(=)\?(?=&|$)|\?\?/, + nonce = jQuery.now(); + +// Default jsonp settings +jQuery.ajaxSetup({ + jsonp: "callback", + jsonpCallback: function() { + var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); + this[ callback ] = true; + return callback; + } +}); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { + + var callbackName, overwritten, responseContainer, + data = s.data, + url = s.url, + hasCallback = s.jsonp !== false, + replaceInUrl = hasCallback && rjsonp.test( url ), + replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && + !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && + rjsonp.test( data ); + + // Handle iff the expected data type is "jsonp" or we have a parameter to set + if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { + + // Get callback name, remembering preexisting value associated with it + callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? + s.jsonpCallback() : + s.jsonpCallback; + overwritten = window[ callbackName ]; + + // Insert callback into url or form data + if ( replaceInUrl ) { + s.url = url.replace( rjsonp, "$1" + callbackName ); + } else if ( replaceInData ) { + s.data = data.replace( rjsonp, "$1" + callbackName ); + } else if ( hasCallback ) { + s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; + } + + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( !responseContainer ) { + jQuery.error( callbackName + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // force json dataType + s.dataTypes[ 0 ] = "json"; + + // Install callback + window[ callbackName ] = function() { + responseContainer = arguments; + }; + + // Clean-up function (fires after converters) + jqXHR.always(function() { + // Restore preexisting value + window[ callbackName ] = overwritten; + + // Save back as free + if ( s[ callbackName ] ) { + // make sure that re-using the options doesn't screw things around + s.jsonpCallback = originalSettings.jsonpCallback; + + // save the callback name for future use + oldCallbacks.push( callbackName ); + } + + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( overwritten ) ) { + overwritten( responseContainer[ 0 ] ); + } + + responseContainer = overwritten = undefined; + }); + + // Delegate to script + return "script"; + } +}); +// Install script dataType +jQuery.ajaxSetup({ + accepts: { + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /javascript|ecmascript/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +}); + +// Handle cache's special case and global +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; + } +}); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function(s) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + + var script, + head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; + + return { + + send: function( _, callback ) { + + script = document.createElement( "script" ); + + script.async = "async"; + + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; + } + + script.src = s.url; + + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { + + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { + + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; + + // Remove the script + if ( head && script.parentNode ) { + head.removeChild( script ); + } + + // Dereference the script + script = undefined; + + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709 and #4378). + head.insertBefore( script, head.firstChild ); + }, + + abort: function() { + if ( script ) { + script.onload( 0, 1 ); + } + } + }; + } +}); +var xhrCallbacks, + // #5280: Internet Explorer will keep connections alive if we don't abort on unload + xhrOnUnloadAbort = window.ActiveXObject ? function() { + // Abort all pending requests + for ( var key in xhrCallbacks ) { + xhrCallbacks[ key ]( 0, 1 ); + } + } : false, + xhrId = 0; + +// Functions to create xhrs +function createStandardXHR() { + try { + return new window.XMLHttpRequest(); + } catch( e ) {} +} + +function createActiveXHR() { + try { + return new window.ActiveXObject( "Microsoft.XMLHTTP" ); + } catch( e ) {} +} + +// Create the request object +// (This is still attached to ajaxSettings for backward compatibility) +jQuery.ajaxSettings.xhr = window.ActiveXObject ? + /* Microsoft failed to properly + * implement the XMLHttpRequest in IE7 (can't request local files), + * so we use the ActiveXObject when it is available + * Additionally XMLHttpRequest can be disabled in IE7/IE8 so + * we need a fallback. + */ + function() { + return !this.isLocal && createStandardXHR() || createActiveXHR(); + } : + // For all other browsers, use the standard XMLHttpRequest object + createStandardXHR; + +// Determine support properties +(function( xhr ) { + jQuery.extend( jQuery.support, { + ajax: !!xhr, + cors: !!xhr && ( "withCredentials" in xhr ) + }); +})( jQuery.ajaxSettings.xhr() ); + +// Create transport if the browser can provide an xhr +if ( jQuery.support.ajax ) { + + jQuery.ajaxTransport(function( s ) { + // Cross domain only allowed if supported through XMLHttpRequest + if ( !s.crossDomain || jQuery.support.cors ) { + + var callback; + + return { + send: function( headers, complete ) { + + // Get a new xhr + var handle, i, + xhr = s.xhr(); + + // Open the socket + // Passing null username, generates a login popup on Opera (#2865) + if ( s.username ) { + xhr.open( s.type, s.url, s.async, s.username, s.password ); + } else { + xhr.open( s.type, s.url, s.async ); + } + + // Apply custom fields if provided + if ( s.xhrFields ) { + for ( i in s.xhrFields ) { + xhr[ i ] = s.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( s.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( s.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !s.crossDomain && !headers["X-Requested-With"] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + } catch( _ ) {} + + // Do send the request + // This may raise an exception which is actually + // handled in jQuery.ajax (so no try/catch here) + xhr.send( ( s.hasContent && s.data ) || null ); + + // Listener + callback = function( _, isAbort ) { + + var status, + statusText, + responseHeaders, + responses, + xml; + + // Firefox throws exceptions when accessing properties + // of an xhr when a network error occurred + // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) + try { + + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + + // Only called once + callback = undefined; + + // Do not keep as active anymore + if ( handle ) { + xhr.onreadystatechange = jQuery.noop; + if ( xhrOnUnloadAbort ) { + delete xhrCallbacks[ handle ]; + } + } + + // If it's an abort + if ( isAbort ) { + // Abort it manually if needed + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + status = xhr.status; + responseHeaders = xhr.getAllResponseHeaders(); + responses = {}; + xml = xhr.responseXML; + + // Construct response list + if ( xml && xml.documentElement /* #4958 */ ) { + responses.xml = xml; + } + + // When requesting binary data, IE6-9 will throw an exception + // on any attempt to access responseText (#11426) + try { + responses.text = xhr.responseText; + } catch( e ) { + } + + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } + + // Filter status for non standard behaviors + + // If the request is local and we have data: assume a success + // (success with no data won't get notified, that's the best we + // can do given current implementations) + if ( !status && s.isLocal && !s.crossDomain ) { + status = responses.text ? 200 : 404; + // IE - #1450: sometimes returns 1223 when it should be 204 + } else if ( status === 1223 ) { + status = 204; + } + } + } + } catch( firefoxAccessException ) { + if ( !isAbort ) { + complete( -1, firefoxAccessException ); + } + } + + // Call complete if needed + if ( responses ) { + complete( status, statusText, responses, responseHeaders ); + } + }; + + if ( !s.async ) { + // if we're in sync mode we fire the callback + callback(); + } else if ( xhr.readyState === 4 ) { + // (IE6 & IE7) if it's in cache and has been + // retrieved directly we need to fire the callback + setTimeout( callback, 0 ); + } else { + handle = ++xhrId; + if ( xhrOnUnloadAbort ) { + // Create the active xhrs callbacks list if needed + // and attach the unload handler + if ( !xhrCallbacks ) { + xhrCallbacks = {}; + jQuery( window ).unload( xhrOnUnloadAbort ); + } + // Add to list of active xhrs callbacks + xhrCallbacks[ handle ] = callback; + } + xhr.onreadystatechange = callback; + } + }, + + abort: function() { + if ( callback ) { + callback(0,1); + } + } + }; + } + }); +} +var fxNow, timerId, + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), + rrun = /queueHooks$/, + animationPrefilters = [ defaultPrefilter ], + tweeners = { + "*": [function( prop, value ) { + var end, unit, + tween = this.createTween( prop, value ), + parts = rfxnum.exec( value ), + target = tween.cur(), + start = +target || 0, + scale = 1, + maxIterations = 20; + + if ( parts ) { + end = +parts[2]; + unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + + // We need to compute starting value + if ( unit !== "px" && start ) { + // Iteratively approximate from a nonzero starting point + // Prefer the current property, because this process will be trivial if it uses the same units + // Fallback to end or a simple constant + start = jQuery.css( tween.elem, prop, true ) || end || 1; + + do { + // If previous iteration zeroed out, double until we get *something* + // Use a string for doubling factor so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + start = start / scale; + jQuery.style( tween.elem, prop, start + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // And breaking the loop if scale is unchanged or perfect, or if we've just had enough + } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); + } + + tween.unit = unit; + tween.start = start; + // If a +=/-= token was provided, we're doing a relative animation + tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; + } + return tween; + }] + }; + +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout(function() { + fxNow = undefined; + }, 0 ); + return ( fxNow = jQuery.now() ); +} + +function createTweens( animation, props ) { + jQuery.each( props, function( prop, value ) { + var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( collection[ index ].call( animation, prop, value ) ) { + + // we're done with this property + return; + } + } + }); +} + +function Animation( elem, properties, options ) { + var result, + index = 0, + tweenerIndex = 0, + length = animationPrefilters.length, + deferred = jQuery.Deferred().always( function() { + // don't match elem in the :animated selector + delete tick.elem; + }), + tick = function() { + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ]); + + if ( percent < 1 && length ) { + return remaining; + } else { + deferred.resolveWith( elem, [ animation ] ); + return false; + } + }, + animation = deferred.promise({ + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { specialEasing: {} }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end, easing ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + // if we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // resolve when we played the last frame + // otherwise, reject + if ( gotoEnd ) { + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + }), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length ; index++ ) { + result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + return result; + } + } + + createTweens( animation, props ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + jQuery.fx.timer( + jQuery.extend( tick, { + anim: animation, + queue: animation.opts.queue, + elem: elem + }) + ); + + // attach callbacks from options + return animation.progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( jQuery.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // not quite $.extend, this wont overwrite keys already present. + // also - reusing 'index' from above because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.split(" "); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length ; index++ ) { + prop = props[ index ]; + tweeners[ prop ] = tweeners[ prop ] || []; + tweeners[ prop ].unshift( callback ); + } + }, + + prefilter: function( callback, prepend ) { + if ( prepend ) { + animationPrefilters.unshift( callback ); + } else { + animationPrefilters.push( callback ); + } + } +}); + +function defaultPrefilter( elem, props, opts ) { + var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, + anim = this, + style = elem.style, + orig = {}, + handled = [], + hidden = elem.nodeType && isHidden( elem ); + + // handle queue: false promises + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always(function() { + // doing this makes sure that the complete handler will be called + // before this completes + anim.always(function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + }); + }); + } + + // height/width overflow pass + if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { + // Make sure that nothing sneaks out + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height animated + if ( jQuery.css( elem, "display" ) === "inline" && + jQuery.css( elem, "float" ) === "none" ) { + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { + style.display = "inline-block"; + + } else { + style.zoom = 1; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + if ( !jQuery.support.shrinkWrapBlocks ) { + anim.done(function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + }); + } + } + + + // show/hide pass + for ( index in props ) { + value = props[ index ]; + if ( rfxtypes.exec( value ) ) { + delete props[ index ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + continue; + } + handled.push( index ); + } + } + + length = handled.length; + if ( length ) { + dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + + // store state if its toggle - enables .stop().toggle() to "reverse" + if ( toggle ) { + dataShow.hidden = !hidden; + } + if ( hidden ) { + jQuery( elem ).show(); + } else { + anim.done(function() { + jQuery( elem ).hide(); + }); + } + anim.done(function() { + var prop; + jQuery.removeData( elem, "fxshow", true ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + }); + for ( index = 0 ; index < length ; index++ ) { + prop = handled[ index ]; + tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); + orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); + + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = tween.start; + if ( hidden ) { + tween.end = tween.start; + tween.start = prop === "width" || prop === "height" ? 1 : 0; + } + } + } + } +} + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || "swing"; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + if ( tween.elem[ tween.prop ] != null && + (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { + return tween.elem[ tween.prop ]; + } + + // passing any value as a 4th parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails + // so, simple values such as "10px" are parsed to Float. + // complex values such as "rotate(1rad)" are returned as is. + result = jQuery.css( tween.elem, tween.prop, false, "" ); + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + // use step hook for back compat - use cssHook if its there - use .style if its + // available and use plain properties where available + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Remove in 2.0 - this supports IE8's panic based approach +// to setting things on disconnected nodes + +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" || + // special check for .toggle( handler, handler, ... ) + ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +}); + +jQuery.fn.extend({ + fadeTo: function( speed, to, easing, callback ) { + + // show any hidden elements after setting opacity to 0 + return this.filter( isHidden ).css( "opacity", 0 ).show() + + // animate to the value specified + .end().animate({ opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations resolve immediately + if ( empty ) { + anim.stop( true ); + } + }; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each(function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = jQuery._data( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + }); + } +}); + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + attrs = { height: type }, + i = 0; + + // if we include width, step value is 1 to do all cssExpand values, + // if we don't include width, step value is 2 to skip over Left and Right + includeWidth = includeWidth? 1 : 0; + for( ; i < 4 ; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +// Generate shortcuts for custom animations +jQuery.each({ + slideDown: genFx("show"), + slideUp: genFx("hide"), + slideToggle: genFx("toggle"), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +}); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p*Math.PI ) / 2; + } +}; + +jQuery.timers = []; +jQuery.fx = Tween.prototype.init; +jQuery.fx.tick = function() { + var timer, + timers = jQuery.timers, + i = 0; + + fxNow = jQuery.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + if ( timer() && jQuery.timers.push( timer ) && !timerId ) { + timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); + } +}; + +jQuery.fx.interval = 13; + +jQuery.fx.stop = function() { + clearInterval( timerId ); + timerId = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + // Default speed + _default: 400 +}; + +// Back Compat <1.8 extension point +jQuery.fx.step = {}; + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { + return elem === fn.elem; + }).length; + }; +} +var rroot = /^(?:body|html)$/i; + +jQuery.fn.offset = function( options ) { + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } + + var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, + box = { top: 0, left: 0 }, + elem = this[ 0 ], + doc = elem && elem.ownerDocument; + + if ( !doc ) { + return; + } + + if ( (body = doc.body) === elem ) { + return jQuery.offset.bodyOffset( elem ); + } + + docElem = doc.documentElement; + + // Make sure it's not a disconnected DOM node + if ( !jQuery.contains( docElem, elem ) ) { + return box; + } + + // If we don't have gBCR, just use 0,0 rather than error + // BlackBerry 5, iOS 3 (original iPhone) + if ( typeof elem.getBoundingClientRect !== "undefined" ) { + box = elem.getBoundingClientRect(); + } + win = getWindow( doc ); + clientTop = docElem.clientTop || body.clientTop || 0; + clientLeft = docElem.clientLeft || body.clientLeft || 0; + scrollTop = win.pageYOffset || docElem.scrollTop; + scrollLeft = win.pageXOffset || docElem.scrollLeft; + return { + top: box.top + scrollTop - clientTop, + left: box.left + scrollLeft - clientLeft + }; +}; + +jQuery.offset = { + + bodyOffset: function( body ) { + var top = body.offsetTop, + left = body.offsetLeft; + + if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { + top += parseFloat( jQuery.css(body, "marginTop") ) || 0; + left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; + } + + return { top: top, left: left }; + }, + + setOffset: function( elem, options, i ) { + var position = jQuery.css( elem, "position" ); + + // set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } + + var curElem = jQuery( elem ), + curOffset = curElem.offset(), + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, + props = {}, curPosition = {}, curTop, curLeft; + + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } + + if ( jQuery.isFunction( options ) ) { + options = options.call( elem, i, curOffset ); + } + + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } + + if ( "using" in options ) { + options.using.call( elem, props ); + } else { + curElem.css( props ); + } + } +}; + + +jQuery.fn.extend({ + + position: function() { + if ( !this[0] ) { + return; + } + + var elem = this[0], + + // Get *real* offsetParent + offsetParent = this.offsetParent(), + + // Get correct offsets + offset = this.offset(), + parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); + + // Subtract element margins + // note: when an element has margin: auto the offsetLeft and marginLeft + // are the same in Safari causing offset.left to incorrectly be 0 + offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; + offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; + + // Add offsetParent borders + parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; + parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; + + // Subtract the two offsets + return { + top: offset.top - parentOffset.top, + left: offset.left - parentOffset.left + }; + }, + + offsetParent: function() { + return this.map(function() { + var offsetParent = this.offsetParent || document.body; + while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent || document.body; + }); + } +}); + + +// Create scrollLeft and scrollTop methods +jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { + var top = /Y/.test( prop ); + + jQuery.fn[ method ] = function( val ) { + return jQuery.access( this, function( elem, method, val ) { + var win = getWindow( elem ); + + if ( val === undefined ) { + return win ? (prop in win) ? win[ prop ] : + win.document.documentElement[ method ] : + elem[ method ]; + } + + if ( win ) { + win.scrollTo( + !top ? val : jQuery( win ).scrollLeft(), + top ? val : jQuery( win ).scrollTop() + ); + + } else { + elem[ method ] = val; + } + }, method, val, arguments.length, null ); + }; +}); + +function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; +} +// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods +jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { + jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { + // margin is only for outerHeight, outerWidth + jQuery.fn[ funcName ] = function( margin, value ) { + var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), + extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); + + return jQuery.access( this, function( elem, type, value ) { + var doc; + + if ( jQuery.isWindow( elem ) ) { + // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there + // isn't a whole lot we can do. See pull request at this URL for discussion: + // https://github.com/jquery/jquery/pull/764 + return elem.document.documentElement[ "client" + name ]; + } + + // Get document width or height + if ( elem.nodeType === 9 ) { + doc = elem.documentElement; + + // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest + // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. + return Math.max( + elem.body[ "scroll" + name ], doc[ "scroll" + name ], + elem.body[ "offset" + name ], doc[ "offset" + name ], + doc[ "client" + name ] + ); + } + + return value === undefined ? + // Get width or height on the element, requesting but not forcing parseFloat + jQuery.css( elem, type, value, extra ) : + + // Set width or height on the element + jQuery.style( elem, type, value, extra ); + }, type, chainable ? margin : undefined, chainable, null ); + }; + }); +}); +// Expose jQuery to the global object +window.jQuery = window.$ = jQuery; + +// Expose jQuery as an AMD module, but only for AMD loaders that +// understand the issues with loading multiple versions of jQuery +// in a page that all might call define(). The loader will indicate +// they have special allowances for multiple jQuery versions by +// specifying define.amd.jQuery = true. Register as a named module, +// since jQuery can be concatenated with other files that may use define, +// but not use a proper concatenation script that understands anonymous +// AMD modules. A named AMD is safest and most robust way to register. +// Lowercase jquery is used because AMD module names are derived from +// file names, and jQuery is normally delivered in a lowercase file name. +// Do this after creating the global so that if an AMD module wants to call +// noConflict to hide this version of jQuery, it will work. +if ( typeof define === "function" && define.amd && define.amd.jQuery ) { + define( "jquery", [], function () { return jQuery; } ); +} + +})( window ); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/moonwalk.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/moonwalk.spec.js new file mode 100644 index 00000000..1c8e15d1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/moonwalk.spec.js @@ -0,0 +1,77 @@ +/* globals describe:false, it:false */ +/* jshint node:true */ +"use strict"; + + +var expect = require('expect.js'); +var rocambole = require('../'); + + +describe('moonwalk()', function () { + + it('should generate AST if first arg is a string', function () { + var count = 0; + var ast = rocambole.moonwalk("function fn(x){\n var foo = 'bar';\n if (x) {\n foo += 'baz';\n } else {\n foo += 's';\n }\n return foo;\n}", function(){ + count++; + }); + expect( ast.body ).not.to.be(undefined); + expect( ast.tokens ).not.to.be(undefined); + expect( count ).to.be.greaterThan( 1 ); + }); + + it('should work with existing AST', function () { + var ast = rocambole.parse("function fn(x){\n var foo = 'bar';\n if (x) {\n foo += 'baz';\n } else {\n foo += 's';\n }\n return foo;\n}"); + var count = 0; + rocambole.moonwalk(ast, function(){ + count++; + }); + expect( count ).to.be.greaterThan( 1 ); + }); + + it('should walk AST starting from leaf nodes until it reaches the root', function () { + var prevDepth = Infinity; + var count = 0; + var prevNode; + rocambole.moonwalk("function fn(x){\n var foo = 'bar';\n if (x) {\n foo += 'baz';\n } else {\n foo += 's';\n }\n return foo;\n}", function(node){ + count++; + expect( node.depth <= prevDepth ).to.be( true ); + prevDepth = node.depth; + prevNode = node; + }); + expect( count ).to.be.greaterThan( 1 ); + expect( prevNode.type ).to.be( 'Program' ); // reached root + }); + + it('should skip null nodes', function(){ + var count = 0; + rocambole.moonwalk('[,3,[,4]]', function () { + count++; + }); + expect(count).to.be(6); + }); + +}); + + +describe('recursive()', function () { + + it('should allow breaking the loop', function () { + var ast = rocambole.parse('function fn(x){ return x * 2 }'); + var count_1 = 0; + rocambole.recursive(ast, function(){ + count_1 += 1; + }); + var count_2 = 0; + rocambole.recursive(ast, function(node){ + count_2 += 1; + if (node.type === 'BlockStatement') { + return false; // break + } + }); + expect( count_1 ).to.be( 9 ); + expect( count_2 ).to.be( 5 ); + }); + +}); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/parse.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/parse.spec.js new file mode 100644 index 00000000..9d58afb8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/parse.spec.js @@ -0,0 +1,373 @@ +/*global describe:false, it:false, beforeEach:false */ +"use strict"; + +var expect = require('expect.js'); +var rocambole = require('../'); + + +describe('parse', function () { + + it('should parse string and return AST', function () { + var ast = rocambole.parse('(function(){ return 123 })'); + expect( ast.type ).to.equal( 'Program' ); + expect( ast.body[0].type ).to.equal( 'ExpressionStatement' ); + }); + + + it('should include tokens before and after "program" end', function () { + var ast = rocambole.parse('//foo\n(function(){ return 123 })\n//bar\n'); + expect( ast.startToken.value ).to.equal( 'foo' ); + expect( ast.endToken.value ).to.equal( '\n' ); + ast = rocambole.parse('\n//foo\n(function(){ return 123 })\n//dolor'); + expect( ast.startToken.value ).to.equal( '\n' ); + expect( ast.endToken.value ).to.equal( 'dolor' ); + }); + + + it('should work with any kind of line breaks & spaces', function () { + var ast = rocambole.parse('\nvar n\r\n=\n10;\r\r \t\t \n', {loc : true}); + + var br_1 = ast.startToken; + expect( br_1.type ).to.be( 'LineBreak' ); + expect( br_1.value ).to.be( '\n' ); + expect( br_1.range ).to.eql( [0, 1] ); + expect( br_1.loc ).to.eql({ + start : { + line : 1, + column : 0 + }, + end : { + line : 1, + column : 1 + } + }); + + var ws_1 = ast.startToken.next.next; + expect( ws_1.type ).to.be( 'WhiteSpace' ); + expect( ws_1.value ).to.be( ' ' ); + + var br_2 = br_1.next.next.next.next; + expect( br_2.type ).to.be( 'LineBreak' ); + expect( br_2.value ).to.be( '\r\n' ); + expect( br_2.range ).to.eql( [6, 8] ); + expect( br_2.loc ).to.eql({ + start : { + line : 2, + column : 5 + }, + end : { + line : 2, + column : 7 + } + }); + + // it's important to notice that esprima doesn't parse "\r" as line + // break, so if it is not at EOF it will give conflicting "loc" info. + var br_6 = ast.endToken; + expect( br_6.type ).to.be( 'LineBreak' ); + expect( br_6.value ).to.be( '\n' ); + expect( br_6.range ).to.eql( [21, 22] ); + expect( br_6.loc ).to.eql({ + start : { + line : 6, + column : 6 + }, + end : { + line : 6, + column : 7 + } + }); + + var ws_2 = ast.endToken.prev; + expect( ws_2.type ).to.be( 'WhiteSpace' ); + expect( ws_2.value ).to.be( ' \t\t ' ); + expect( ws_2.range ).to.eql( [15, 21] ); + expect( ws_2.loc ).to.eql({ + start : { + line : 6, + column : 0 + }, + end : { + line : 6, + column : 6 + } + }); + + var br_5 = ws_2.prev; + expect( br_5.type ).to.be( 'LineBreak' ); + expect( br_5.value ).to.be( '\r' ); + + var br_4 = br_5.prev; + expect( br_4.type ).to.be( 'LineBreak' ); + expect( br_4.value ).to.be( '\r' ); + }); + + + it('should not include any char that isn\'t a white space on a WhiteSpace token [issue #3]', function () { + var ast = rocambole.parse("\n/* foo */\n/* bar */\nfunction foo(){\n var bar = 'baz';\n\n //foo\n //bar\n\n var lorem = 'ipsum';\n return bar + lorem;\n}"); + var tk = ast.startToken; + var nComments = 0; + while (tk) { + if (tk.type === 'WhiteSpace') { + expect( tk.value ).to.match( /^[\s\t]+$/ ); + } else if (tk.type === 'LineBreak') { + expect( tk.value ).to.equal( '\n' ); + } else if (tk.type === 'LineComment') { + expect( tk.raw ).to.match( /^\/\/\w{3}$/ ); + nComments++; + } else if (tk.type === 'BlockComment') { + expect( tk.raw ).to.match( /^\/\* \w{3} \*\/$/ ); + nComments++; + } + tk = tk.next; + } + expect( nComments ).to.be( 4 ); + }); + + + it('should instrument object expression "value" node', function () { + // this was a bug introduced while trying to improve performance + var ast = rocambole.parse('amet(123, a, {flag : true});'); + var exp = ast.body[0].expression; + expect( exp.startToken ).not.to.be(undefined); + expect( exp.callee.startToken ).not.to.be(undefined); + expect( exp['arguments'][0].startToken ).not.to.be(undefined); + expect( exp['arguments'][1].startToken ).not.to.be(undefined); + expect( exp['arguments'][2].startToken ).not.to.be(undefined); + expect( exp['arguments'][2].properties[0].startToken ).not.to.be(undefined); + expect( exp['arguments'][2].properties[0].key.startToken ).not.to.be(undefined); + expect( exp['arguments'][2].properties[0].value.startToken ).not.to.be(undefined); + }); + + + + describe('Node', function () { + + var ast, program, expressionStatement, + fnExpression, block, returnStatement; + + beforeEach(function(){ + ast = rocambole.parse('/* block */\n(function(){\n return 123; // line\n})'); + program = ast; + expressionStatement = ast.body[0]; + fnExpression = expressionStatement.expression; + block = fnExpression.body; + returnStatement = block.body[0]; + }); + + describe('node.parent', function () { + it('should add reference to parent node', function () { + expect( program.parent ).to.equal( undefined ); + expect( expressionStatement.parent ).to.equal( program ); + expect( fnExpression.parent ).to.equal( expressionStatement ); + expect( block.parent ).to.equal( fnExpression ); + }); + }); + + + describe('node.toString()', function(){ + it('should return the node source', function () { + expect( returnStatement.type ).to.equal( 'ReturnStatement' ); + expect( returnStatement.toString() ).to.equal( 'return 123;' ); + }); + it('should use raw value of comments', function () { + expect( block.toString() ).to.equal( '{\n return 123; // line\n}' ); + }); + it('should use raw value of comments', function () { + expect( ast.toString() ).to.equal( '/* block */\n(function(){\n return 123; // line\n})' ); + }); + }); + + + describe('depth', function () { + it('should add depth property to nodes', function () { + expect( program.depth ).to.equal( 0 ); + expect( expressionStatement.depth ).to.equal( 1 ); + expect( fnExpression.depth ).to.equal( 2 ); + expect( block.depth ).to.equal( 3 ); + expect( returnStatement.depth ).to.equal( 4 ); + }); + }); + + + describe('node.endToken', function () { + it('should return last token inside node', function () { + expect( program.endToken.value ).to.equal( ')' ); + expect( expressionStatement.endToken.value ).to.equal( ')' ); + expect( fnExpression.endToken.value ).to.equal( '}' ); + expect( block.endToken.value ).to.equal( '}' ); + expect( returnStatement.endToken.value ).to.equal( ';' ); + }); + + it('should capture end token properly', function () { + var ast = rocambole.parse('[1,2,[3,4,[5,6,[7,8,9]]]];'); + var exp = ast.body[0].expression; + expect( exp.endToken.value ).to.equal( ']' ); + expect( exp.elements[0].value ).to.equal( 1 ); + expect( exp.elements[0].startToken.value ).to.equal( '1' ); + expect( exp.elements[0].endToken.value ).to.equal( '1' ); + }); + }); + + + describe('node.startToken', function () { + it('should return first token inside node', function () { + expect( program.startToken.value ).to.equal( ' block ' ); + expect( expressionStatement.startToken.value ).to.equal( '(' ); + expect( fnExpression.startToken.value ).to.equal( 'function' ); + expect( block.startToken.value ).to.equal( '{' ); + expect( returnStatement.startToken.value ).to.equal( 'return' ); + }); + }); + + + describe('Node.next & Node.prev', function () { + it('should return reference to previous and next nodes', function () { + var ast = rocambole.parse("\n/* foo */\n/* bar */\nfunction foo(){\n var bar = 'baz';\n var lorem = 'ipsum';\n return bar + lorem;\n}"); + var block = ast.body[0].body.body; + var firstNode = block[0]; + var secondNode = block[1]; + var lastNode = block[2]; + expect( firstNode.prev ).to.equal( undefined ); + expect( firstNode.next ).to.equal( secondNode ); + expect( secondNode.prev ).to.equal( firstNode ); + expect( secondNode.next ).to.equal( lastNode ); + expect( lastNode.prev ).to.equal( secondNode ); + expect( lastNode.next ).to.equal( undefined ); + }); + }); + + }); + + + describe('Token', function () { + + it('should instrument tokens', function () { + var ast = rocambole.parse('function foo(){ return "bar"; }'); + var tokens = ast.tokens; + + expect( tokens[0].prev ).to.be(undefined); + expect( tokens[0].next ).to.be( tokens[1] ); + expect( tokens[1].prev ).to.be( tokens[0] ); + expect( tokens[1].next ).to.be( tokens[2] ); + }); + + it('should add range and loc info to comment tokens', function () { + var ast = rocambole.parse('\n/* foo\n bar\n*/\nfunction foo(){ return "bar"; }\n// end', {loc:true}); + var blockComment = ast.startToken.next; + expect( blockComment.range ).to.eql( [1, 16] ); + expect( blockComment.loc ).to.eql({ + start : { + line : 2, + column : 0 + }, + end : { + line : 4, + column : 2 + } + }); + var lineComment = ast.endToken; + expect( lineComment.range ).to.eql( [49, 55] ); + expect( lineComment.loc ).to.eql({ + start : { + line : 6, + column : 0 + }, + end : { + line : 6, + column : 6 + } + }); + }); + + it('should add originalIndent info to block comments', function () { + var ast = rocambole.parse(' /* foo */\n\t\t// bar'); + expect( ast.startToken.next.originalIndent ).to.be(' '); + }); + + it('should not add originalIndent info to line comments', function () { + var ast = rocambole.parse(' /* foo */\n\t\t// bar'); + expect( ast.endToken.originalIndent ).to.be(undefined); + }); + + it('should not add as originalIndent if prev token is not white space', function () { + var ast = rocambole.parse('lorem;/* foo */\n\t\t// bar'); + expect( ast.startToken.next.next.originalIndent ).to.be(undefined); + }); + + it('should not add as originalIndent if prev token is not on a new line', function () { + var ast = rocambole.parse('lorem; /* foo */\n\t\t// bar'); + expect( ast.startToken.next.next.next.originalIndent ).to.be(undefined); + }); + + it('should add as originalIndent if on a new line', function () { + var ast = rocambole.parse('lorem;\n /* foo */\n\t\t// bar'); + expect( ast.startToken.next.next.next.next.originalIndent ).to.be(' '); + }); + }); + + + describe('export BYPASS_RECURSION', function () { + it('should export BYPASS_RECURSION', function () { + expect( rocambole.BYPASS_RECURSION.root ).to.be(true); + }); + }); + + + describe('empty program', function () { + it('should not throw if program is empty', function () { + expect(function(){ + rocambole.parse(''); + }).not.throwError(); + }); + it('should return augmented AST', function () { + var ast = rocambole.parse(''); + expect(ast).to.eql({ + type: 'Program', + body: [], + range: [0,0], + comments: [], + tokens: [], + // we check toString behavior later + toString: ast.toString, + startToken: null, + endToken: null, + depth: 0 + }); + }); + it('toString should return proper value', function() { + var ast = rocambole.parse(''); + expect(ast.toString()).to.be(''); + }); + }); + + + describe('support anything that implements `toString` as input', function () { + it('should support arrays', function () { + var ast = rocambole.parse([1,2,3]); + expect(ast.body[0].toString()).to.eql('1,2,3'); + }); + it('should support functions', function () { + var ast = rocambole.parse(function doStuff(){ + doStuff(1, 2); + }); + expect(ast.body[0].type).to.be('FunctionDeclaration'); + }); + }); + + + describe('sparse array', function() { + // yes, people shold not be writting code like this, but we should not + // bail when that happens + it('should not fail on sparse arrays', function() { + var ast = rocambole.parse('[,3,[,4]]'); + expect(ast.toString()).to.eql('[,3,[,4]]'); + var elements = ast.body[0].expression.elements; + expect(elements[0]).to.be(null); + expect(elements[1].type).to.be('Literal'); + expect(elements[1].value).to.be(3); + }); + }); + +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/perf.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/perf.spec.js new file mode 100644 index 00000000..2ad6de08 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/perf.spec.js @@ -0,0 +1,59 @@ +/*global describe:false, it:false */ +"use strict"; + +var expect = require('expect.js'); +var rocambole = require('../'); + +var _fs = require('fs'); + +// since it takes a long time to instrument jQuery we avoid doing it multiple +// times and cache the result +var _jqueryAST; + + +describe('performance', function () { + + describe('rocambole.parse', function () { + it('should be fast :P', function () { + var file = _fs.readFileSync( __dirname +'/files/crossroads.js', 'utf-8'); + var startTime = process.hrtime(); + var ast = rocambole.parse(file); + var diff = process.hrtime(startTime); + expect( diff[0] ).to.be.below( 300 ); + expect( ast.startToken ).not.to.be( undefined ); + }); + + it('should not take forever to instrument jQuery', function () { + var file = _fs.readFileSync( __dirname +'/files/jquery.js', 'utf-8'); + var startTime = process.hrtime(); + var ast = rocambole.parse(file); + var diff = process.hrtime(startTime); + expect( diff[0] ).to.be.below( 10000 ); + expect( ast.startToken ).not.to.be( undefined ); + _jqueryAST = ast; + }); + }); + + describe('rocambole.moonwalk', function () { + it('should not take forever to loop over jQuery nodes', function () { + if (! _jqueryAST) { + var file = _fs.readFileSync( __dirname +'/files/jquery.js', 'utf-8'); + _jqueryAST = rocambole.parse(file); + } + var startTime = process.hrtime(); + var count = 0; + rocambole.moonwalk(_jqueryAST, function(node){ + if (!node) throw new Error('node should not be undefined'); + count += 1; + }); + var diff = process.hrtime(startTime); + expect( diff[0] ).to.be.below( 200 ); + expect( count ).to.be.above( 20000 ); + }); + }); + +}); + + + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/runner.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/runner.js new file mode 100644 index 00000000..add25544 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/node_modules/rocambole/test/runner.js @@ -0,0 +1,33 @@ +"use strict"; + +// we run mocha manually otherwise istanbul coverage won't work +// run `npm test --coverage` to generate coverage report + +var Mocha = require('mocha'); + +var opts = { + ui : 'bdd', + reporter : (process.env.REPORTER || 'spec'), + grep : process.env.GREP +}; + +// we use the dot reporter on travis since it works better +if (process.env.TRAVIS) { + opts.reporter = 'dot'; +} + +var m = new Mocha(opts); + +if (process.env.INVERT) { + m.invert(); +} + +m.addFile('test/parse.spec.js'); +m.addFile('test/moonwalk.spec.js'); +m.addFile('test/perf.spec.js'); + +m.run(function(err){ + var exitCode = err? 1 : 0; + process.exit(exitCode); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/package.json new file mode 100644 index 00000000..f071ddde --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-literal-notation/package.json @@ -0,0 +1,61 @@ +{ + "name": "esformatter-literal-notation", + "version": "1.0.0", + "description": "esformatter plugin that converts array and object constructors to literal notations", + "main": "index.js", + "scripts": { + "test": "./node_modules/mocha/bin/mocha --reporter spec", + "watch": "./node_modules/mocha/bin/mocha --watch --reporter spec" + }, + "keywords": [ + "esformatter", + "plugin", + "literal", + "notation" + ], + "license": "MIT", + "author": { + "name": "Antoine Lehurt", + "email": "hello@kewah.com", + "url": "http://kewah.com" + }, + "repository": { + "type": "git", + "url": "https://github.com/kewah/esformatter-literal-notation" + }, + "dependencies": { + "rocambole": "^0.3.6", + "rocambole-token": "^1.2.1" + }, + "devDependencies": { + "esformatter": "^0.4.2", + "mocha": "*" + }, + "gitHead": "72aa4f2cf9dba8cec79fed3522edc1049fa6fd8f", + "bugs": { + "url": "https://github.com/kewah/esformatter-literal-notation/issues" + }, + "homepage": "https://github.com/kewah/esformatter-literal-notation", + "_id": "esformatter-literal-notation@1.0.0", + "_shasum": "d0201d0406993044aaaf38d32548425cacb538e5", + "_from": "esformatter-literal-notation@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.2", + "_nodeVersion": "0.10.26", + "_npmUser": { + "name": "kewah", + "email": "keuwah@gmail.com" + }, + "maintainers": [ + { + "name": "kewah", + "email": "keuwah@gmail.com" + } + ], + "dist": { + "shasum": "d0201d0406993044aaaf38d32548425cacb538e5", + "tarball": "http://registry.npmjs.org/esformatter-literal-notation/-/esformatter-literal-notation-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/esformatter-literal-notation/-/esformatter-literal-notation-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/.npmignore new file mode 100644 index 00000000..edead594 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/.npmignore @@ -0,0 +1,2 @@ +__* +node_modules/ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/README.md new file mode 100644 index 00000000..9cb47c06 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/README.md @@ -0,0 +1,113 @@ +# esformatter-quotes + +[esformatter](https://github.com/millermedeiros/esformatter) plugin for +single/double quotes normalization. + + +## Usage + +install it: + +```sh +npm install esformatter-quotes +``` + +and add to your esformatter config file: + +```json +{ + "plugins": [ + "esformatter-quotes" + ], + "quotes": { + "type": "single", + "avoidEscape": false + } +} +``` + + +## Options + + - **type:String** + - if code should use "single" or "double" quotes. + - **avoidEscape:Boolean** + - `true` if you want to avoid escaping quotes when possible. + +```js +// register plugin +esformatter.register(require('esformatter-quotes')); +// pass options as second argument +var output = esformatter.format(str, { + "quotes": { + "type": "single", + "avoidEscape": false + } +}); +``` + +## Examples + +Given this input program: + +```js +var singleQuote = 'single'; +var doubleQuote = "double"; +var avoidSingle = 'single "quote"'; +var avoidDouble = "double 'quote'"; +var lorem = "ipsum \"dolor\" sit 'amet'"; +var maecennas = 'ipsum \'dolor\' sit "amet"'; +``` + +Will you get the following output based on the config options: + + +### {type: 'single'} + +```js +var singleQuote = 'single'; +var doubleQuote = 'double'; +var avoidSingle = 'single "quote"'; +var avoidDouble = 'double \'quote\''; +var lorem = 'ipsum "dolor" sit \'amet\''; +var maecennas = 'ipsum \'dolor\' sit "amet"'; +``` + +### {type: 'single', avoidEscape: true} + +```js +var singleQuote = 'single'; +var doubleQuote = 'double'; +var avoidSingle = 'single "quote"'; +var avoidDouble = "double 'quote'"; +var lorem = 'ipsum "dolor" sit \'amet\''; +var maecennas = 'ipsum \'dolor\' sit "amet"'; +``` + +### {type: 'double'} + +```js +var singleQuote = "single"; +var doubleQuote = "double"; +var avoidSingle = "single \"quote\""; +var avoidDouble = "double 'quote'"; +var lorem = "ipsum \"dolor\" sit 'amet'"; +var maecennas = "ipsum 'dolor' sit \"amet\""; +``` + +### {type: 'double', avoidEscape: true} + +```js +var singleQuote = "single"; +var doubleQuote = "double"; +var avoidSingle = 'single "quote"'; +var avoidDouble = "double 'quote'"; +var lorem = "ipsum \"dolor\" sit 'amet'"; +var maecennas = "ipsum 'dolor' sit \"amet\""; +``` + + +## License + +Released under the [MIT License](http://opensource.org/licenses/MIT). + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/index.js new file mode 100644 index 00000000..c342657a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/index.js @@ -0,0 +1,61 @@ +//jshint node:true, eqnull:true +'use strict'; + +var DOUBLE_QUOTE = '"'; +var SINGLE_QUOTE = '\''; + +var avoidEscape; +var disabled; +var quoteValue; +var alternateQuote; + + +exports.setOptions = function(opts) { + opts = opts && opts.quotes; + if (!opts || (opts.type == null && opts.avoidEscape == null)) { + disabled = true; + return; + } + disabled = false; + if (opts.type != null) { + quoteValue = opts.type === 'single' ? SINGLE_QUOTE : DOUBLE_QUOTE; + alternateQuote = opts.type !== 'single' ? SINGLE_QUOTE : DOUBLE_QUOTE; + } + avoidEscape = opts.avoidEscape; +}; + + +exports.tokenBefore = function(token) { + if (disabled) return; + + if (token.type === 'String') { + var content = token.value.substr(1, token.value.length - 2); + var quote = quoteValue; + var alternate = alternateQuote; + + var shouldAvoidEscape = avoidEscape && + content.indexOf(quote) >= 0 && + content.indexOf(alternate) < 0; + + if (shouldAvoidEscape) { + alternate = quoteValue; + quote = alternateQuote; + } + + // we always normalize the behavior to remove unnecessary escapes + var alternateEscape = new RegExp('\\\\' + alternate, 'g'); + content = content.replace(alternateEscape, alternate); + + // If the first character is a quote, escape it (e.g. "'hello" -> '\'hello') + // or if a character is an unescaped quote, escape it (e.g. "hello'" -> 'hello\'') + // If we are an unescaped set of quotes, escape them (e.g. "hello'" -> 'hello\'', "hello''" -> 'hello\'\'') + // DEV: JavaScript starts the next match at the end of the current one, causing us to need a function or loop. + var quoteEscape = new RegExp('(^|[^\\\\])(' + quote + '+)', 'g'); + content = content.replace(quoteEscape, function replaceQuotes (input, group1, group2, match) { + return group1 + new Array(group2.length + 1).join('\\' + quote); + }); + + token.value = quote + content + quote; + } +}; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/package.json new file mode 100644 index 00000000..52a059f6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/package.json @@ -0,0 +1,56 @@ +{ + "name": "esformatter-quotes", + "version": "1.0.1", + "description": "esformatter plugin: enforces coding style that string literals are delimited with single or double quotes.", + "main": "index.js", + "scripts": { + "test": "mocha --ui bdd --reporter spec test" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/esformatter-quotes.git" + }, + "keywords": [ + "esformatter", + "string", + "quotes", + "AST" + ], + "author": { + "name": "Miller Medeiros", + "url": "http://blog.millermedeiros.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/millermedeiros/esformatter-quotes/issues" + }, + "homepage": "https://github.com/millermedeiros/esformatter-quotes", + "devDependencies": { + "mocha": "https://github.com/millermedeiros/mocha/tarball/latest", + "chai": "^1.4", + "esformatter": "^0.3.0" + }, + "gitHead": "482b262c46d0eec56624aa38f45a2e2bf767daf7", + "_id": "esformatter-quotes@1.0.1", + "_shasum": "ecbf4bdde4672792f61e7bea62e78b272b54315c", + "_from": "esformatter-quotes@>=1.0.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + } + ], + "dist": { + "shasum": "ecbf4bdde4672792f61e7bea62e78b272b54315c", + "tarball": "http://registry.npmjs.org/esformatter-quotes/-/esformatter-quotes-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/esformatter-quotes/-/esformatter-quotes-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare.spec.js new file mode 100644 index 00000000..bc6c28f1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare.spec.js @@ -0,0 +1,67 @@ +//jshint node:true, eqnull:true +/*global describe, it, before*/ +'use strict'; + +var esformatter = require('esformatter'); +var fs = require('fs'); +var quotes = require('../'); +var expect = require('chai').expect; + + +describe('compare input/output', function() { + + var input; + + before(function() { + input = getFile('input.js'); + esformatter.register(quotes); + }); + + describe('single quote', function() { + it('should convert to single quotes and normalize escapes', function() { + var output = esformatter.format(input, { + quotes: { + type: 'single' + } + }); + expect(output).to.be.eql(getFile('output-single.js')); + }); + + it('should avoid escape', function() { + var output = esformatter.format(input, { + quotes: { + type: 'single', + avoidEscape: true + } + }); + expect(output).to.be.eql(getFile('output-single-avoid.js')); + }); + }); + + describe('double quote', function() { + it('should convert to double quotes and normalize escapes', function() { + var output = esformatter.format(input, { + quotes: { + type: 'double' + } + }); + expect(output).to.be.eql(getFile('output-double.js')); + }); + + it('should avoid escape', function() { + var output = esformatter.format(input, { + quotes: { + type: 'double', + avoidEscape: true + } + }); + expect(output).to.be.eql(getFile('output-double-avoid.js')); + }); + }); + +}); + + +function getFile(name) { + return fs.readFileSync('test/compare/' + name).toString(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/input.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/input.js new file mode 100644 index 00000000..bb7858e1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/input.js @@ -0,0 +1,47 @@ +"use strict"; + +// basic ==== + +var singleQuote = 'single'; +var doubleQuote = "double"; + + +// avoid escaping ==== + +var avoidSingle = 'single "quote"'; +var avoidDouble = "double 'quote'"; + + +// escaping ==== + +var lorem = "ipsum \"dolor\" sit 'amet'"; +var maecennas = 'ipsum \'dolor\' sit "amet"'; + +var unnecessaryEscape = 'bar \'baz\' \"dolor\"'; + +var leadingSingle = "'"; +var leadingDouble = '"'; +var unnecessaryEscapeSingle = '\''; + +var successiveQuotes = ' \'\' ""'; + + +// multiline strings ==== + +var multi1 = 'multiline \ +madness \ +"quotes" \ +\'everywhere\''.substr(0, 15) + +var multi2 = "even more \ +multiline \ +'strings' \ +\"which is one of the \ +saddest things about JS\"".substr(15, 15) + +var multiAvoidSingle = 'lorem \ +ipsum "dolor"'; + +var multiAvoidDouble = "dolor sit \ +ipsum 'dolor'"; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-double-avoid.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-double-avoid.js new file mode 100644 index 00000000..ff3c78f3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-double-avoid.js @@ -0,0 +1,47 @@ +"use strict"; + +// basic ==== + +var singleQuote = "single"; +var doubleQuote = "double"; + + +// avoid escaping ==== + +var avoidSingle = 'single "quote"'; +var avoidDouble = "double 'quote'"; + + +// escaping ==== + +var lorem = "ipsum \"dolor\" sit 'amet'"; +var maecennas = "ipsum 'dolor' sit \"amet\""; + +var unnecessaryEscape = "bar 'baz' \"dolor\""; + +var leadingSingle = "'"; +var leadingDouble = '"'; +var unnecessaryEscapeSingle = "'"; + +var successiveQuotes = " '' \"\""; + + +// multiline strings ==== + +var multi1 = "multiline \ +madness \ +\"quotes\" \ +'everywhere'".substr(0, 15) + +var multi2 = "even more \ +multiline \ +'strings' \ +\"which is one of the \ +saddest things about JS\"".substr(15, 15) + +var multiAvoidSingle = 'lorem \ +ipsum "dolor"'; + +var multiAvoidDouble = "dolor sit \ +ipsum 'dolor'"; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-double.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-double.js new file mode 100644 index 00000000..7eecda8e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-double.js @@ -0,0 +1,47 @@ +"use strict"; + +// basic ==== + +var singleQuote = "single"; +var doubleQuote = "double"; + + +// avoid escaping ==== + +var avoidSingle = "single \"quote\""; +var avoidDouble = "double 'quote'"; + + +// escaping ==== + +var lorem = "ipsum \"dolor\" sit 'amet'"; +var maecennas = "ipsum 'dolor' sit \"amet\""; + +var unnecessaryEscape = "bar 'baz' \"dolor\""; + +var leadingSingle = "'"; +var leadingDouble = "\""; +var unnecessaryEscapeSingle = "'"; + +var successiveQuotes = " '' \"\""; + + +// multiline strings ==== + +var multi1 = "multiline \ +madness \ +\"quotes\" \ +'everywhere'".substr(0, 15) + +var multi2 = "even more \ +multiline \ +'strings' \ +\"which is one of the \ +saddest things about JS\"".substr(15, 15) + +var multiAvoidSingle = "lorem \ +ipsum \"dolor\""; + +var multiAvoidDouble = "dolor sit \ +ipsum 'dolor'"; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-single-avoid.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-single-avoid.js new file mode 100644 index 00000000..fc14a9a6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-single-avoid.js @@ -0,0 +1,47 @@ +'use strict'; + +// basic ==== + +var singleQuote = 'single'; +var doubleQuote = 'double'; + + +// avoid escaping ==== + +var avoidSingle = 'single "quote"'; +var avoidDouble = "double 'quote'"; + + +// escaping ==== + +var lorem = 'ipsum "dolor" sit \'amet\''; +var maecennas = 'ipsum \'dolor\' sit "amet"'; + +var unnecessaryEscape = 'bar \'baz\' "dolor"'; + +var leadingSingle = "'"; +var leadingDouble = '"'; +var unnecessaryEscapeSingle = "'"; + +var successiveQuotes = ' \'\' ""'; + + +// multiline strings ==== + +var multi1 = 'multiline \ +madness \ +"quotes" \ +\'everywhere\''.substr(0, 15) + +var multi2 = 'even more \ +multiline \ +\'strings\' \ +"which is one of the \ +saddest things about JS"'.substr(15, 15) + +var multiAvoidSingle = 'lorem \ +ipsum "dolor"'; + +var multiAvoidDouble = "dolor sit \ +ipsum 'dolor'"; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-single.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-single.js new file mode 100644 index 00000000..465ffa8e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-quotes/test/compare/output-single.js @@ -0,0 +1,47 @@ +'use strict'; + +// basic ==== + +var singleQuote = 'single'; +var doubleQuote = 'double'; + + +// avoid escaping ==== + +var avoidSingle = 'single "quote"'; +var avoidDouble = 'double \'quote\''; + + +// escaping ==== + +var lorem = 'ipsum "dolor" sit \'amet\''; +var maecennas = 'ipsum \'dolor\' sit "amet"'; + +var unnecessaryEscape = 'bar \'baz\' "dolor"'; + +var leadingSingle = '\''; +var leadingDouble = '"'; +var unnecessaryEscapeSingle = '\''; + +var successiveQuotes = ' \'\' ""'; + + +// multiline strings ==== + +var multi1 = 'multiline \ +madness \ +"quotes" \ +\'everywhere\''.substr(0, 15) + +var multi2 = 'even more \ +multiline \ +\'strings\' \ +"which is one of the \ +saddest things about JS"'.substr(15, 15) + +var multiAvoidSingle = 'lorem \ +ipsum "dolor"'; + +var multiAvoidDouble = 'dolor sit \ +ipsum \'dolor\''; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-spaced-lined-comment/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-spaced-lined-comment/README.md new file mode 100644 index 00000000..08ded1cb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-spaced-lined-comment/README.md @@ -0,0 +1,11 @@ +# esformatter-spaced-lined-comment +[![Build Status](https://secure.travis-ci.org/briandipalma/esformatter-spaced-lined-comment.png)](http://travis-ci.org/briandipalma/esformatter-spaced-lined-comment) +[![Dependency Status](https://david-dm.org/briandipalma/esformatter-spaced-lined-comment.png)](https://david-dm.org/briandipalma/esformatter-spaced-lined-comment) +[![devDependency Status](https://david-dm.org/briandipalma/esformatter-spaced-lined-comment/dev-status.svg)](https://david-dm.org/briandipalma/esformatter-spaced-lined-comment#info=devDependencies) + +esformatter plugin that adds a space in front of line comments. This automates fixing the ESLint +`spaced-lined-comment` rule warnings. + +## Install + +Install with `npm i esformatter-spaced-lined-comment` diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-spaced-lined-comment/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-spaced-lined-comment/index.js new file mode 100644 index 00000000..3d1d5ca7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-spaced-lined-comment/index.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports.tokenBefore = function(token) { + if (token.type === 'LineComment' && token.value.match(/^\S/)) { + token.raw = '// ' + token.value; + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter-spaced-lined-comment/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-spaced-lined-comment/package.json new file mode 100644 index 00000000..32a8cad7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter-spaced-lined-comment/package.json @@ -0,0 +1,62 @@ +{ + "name": "esformatter-spaced-lined-comment", + "version": "2.0.1", + "description": "esformatter plugin for adding a space as the first character in a line comment", + "main": "index.js", + "scripts": { + "test": "mocha", + "lint": "eslint *.js", + "build": "npm run lint && npm run test" + }, + "files": [ + "index.js" + ], + "repository": { + "type": "git", + "url": "https://github.com/briandipalma/esformatter-spaced-lined-comment" + }, + "keywords": [ + "esformatter", + "plugin" + ], + "engines": { + "node": ">=0.10.0" + }, + "author": { + "name": "Brian Di Palma" + }, + "license": "ISC", + "devDependencies": { + "esformatter": "^0.4.3", + "eslint": "^0.15.0", + "mocha": "^2.1.0" + }, + "dependencies": {}, + "gitHead": "cda9c05491f7c460f4d02c11bacfa4733066c329", + "bugs": { + "url": "https://github.com/briandipalma/esformatter-spaced-lined-comment/issues" + }, + "homepage": "https://github.com/briandipalma/esformatter-spaced-lined-comment", + "_id": "esformatter-spaced-lined-comment@2.0.1", + "_shasum": "dc5f3407f93c295e1e56446bd344560da5e6dcac", + "_from": "esformatter-spaced-lined-comment@>=2.0.0 <3.0.0", + "_resolved": "https://registry.npmjs.org/esformatter-spaced-lined-comment/-/esformatter-spaced-lined-comment-2.0.1.tgz", + "_npmVersion": "2.6.0", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "briandipalma", + "email": "offler@gmail.com" + }, + "maintainers": [ + { + "name": "briandipalma", + "email": "offler@gmail.com" + } + ], + "dist": { + "shasum": "dc5f3407f93c295e1e56446bd344560da5e6dcac", + "tarball": "http://registry.npmjs.org/esformatter-spaced-lined-comment/-/esformatter-spaced-lined-comment-2.0.1.tgz" + }, + "directories": {}, + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.editorconfig b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.editorconfig new file mode 100644 index 00000000..bfdf0734 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.editorconfig @@ -0,0 +1,35 @@ +; EditorConfig is awesome: http://EditorConfig.org + +; top-most EditorConfig file +root = true + +; Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true + +; test files can have mized indent and there is no way to reset the value so we +; only add to files/folders that need it +[lib/**] +indent_style = space +indent_size = 2 + +[bin/*] +indent_style = space +indent_size = 2 + +[test/*.js] +indent_style = space +indent_size = 2 + +[package.json] +indent_style = space +indent_size = 2 + +; The test files can have mixed indent, tailing white space, etc... +[test/compare/**] +insert_final_newline = false +trim_trailing_whitespace = false + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.jshintrc b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.jshintrc new file mode 100644 index 00000000..ea218f5e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.jshintrc @@ -0,0 +1,61 @@ +{ + // Settings + "passfail" : false, // Stop on first error. + "maxerr" : 500, // Maximum error before stopping. + + + // Predefined globals whom JSHint will ignore. + "browser" : false, // Standard browser globals e.g. `window`, `document`. + "node" : true, + + + // Custom globals. + "predef" : [], + + + // Development. + "debug" : false, // Allow debugger statements e.g. browser breakpoints. + "devel" : false, // Allow developments statements e.g. `console.log();`. + + + // EcmaScript 5. + "es5" : false, // Allow EcmaScript 5 syntax. + "globalstrict" : true, // Allow global "use strict" (also enables 'strict'). + "strict" : true, // Require `use strict` pragma in every file. + + + // The Good Parts. + "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons). + "bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.). + "boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. + "curly" : false, // Require {} for every new block or scope. + "eqeqeq" : false, // Require triple equals i.e. `===`. + "eqnull" : true, // Tolerate use of `== null`. + "evil" : false, // Tolerate use of `eval`. + "expr" : false, // Tolerate `ExpressionStatement` as Programs. + "forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`. + "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` + "latedef" : false, // Prohibit variable use before definition. + "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. + "loopfunc" : false, // Allow functions to be defined within loops. + "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. + "regexdash" : true, // Tolerate unescaped last dash i.e. `[-...]`. + "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions. + "scripturl" : false, // Tolerate script-targeted URLs. + "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. + "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. + "undef" : true, // Require all non-global variables be declared before they are used. + "unused" : true, // Check for unused vars + + + // Personal styling prefrences. + "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. + "noempty" : true, // Prohipit use of empty blocks. + "nomen" : false, // Prohibit use of initial or trailing underbars in names. + "nonew" : true, // Prohibit use of constructors for side-effects. + "onevar" : false, // Allow only one `var` statement per function. + "plusplus" : false, // Prohibit use of `++` & `--`. + "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. + "trailing" : true, // Prohibit trailing whitespaces. + "white" : false // Check against strict whitespace and indentation rules. +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.npmignore new file mode 100644 index 00000000..f761434c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.npmignore @@ -0,0 +1,6 @@ +__* +coverage/ +/node_modules/ + +# the inplace test only removes the generated file if it's executed +test/compare/default/inplace-in.js.copy diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.travis.yml new file mode 100644 index 00000000..67d30910 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/.travis.yml @@ -0,0 +1,16 @@ + language: node_js + node_js: + - "0.12" + script: + - "npm test --coverage" + - "npm run-script lint" + branches: + only: + - master + notifications: + irc: + channels: + - "irc.freenode.org#esformatter" + on_success: change + use_notice: true + skip_join: true diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/CHANGELOG.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/CHANGELOG.md new file mode 100644 index 00000000..53364dc4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/CHANGELOG.md @@ -0,0 +1,165 @@ +# esformatter changelog + +## v0.6.1 (2015-03-27) + + - fix comment alignment if surrounded by whitespaces. closes #297 + - improve ObjectExpression hook logic to handle values surrounded by parenthesis. fixes #295 + - fix setOptions behavior to allow user to override plugin default settings. fixes #293 + +## v0.6.0 (2015-03-26) + + - add support for the pipe option on the config file, allowing user to pipe other CLI tools. closes #168 + - add support for ES6 classes. closes #286 + - add support for ES6 default params. closes #285 + - add support for ES6 arrow functions. closes #255 + - change comment indentation behavior to match next/prev code block based on context. fixes #209. fixes #270. + - extract helpers from lib/indent.js into rocambole-indent. closes #277 + - fixes SwitchCase indentation range. closes #290 + - ignore shebang by default. closes #284 + - add setting to limit line breaks and white spaces around BreakKeyword. fixes #213 + - limit spaces before function name. closes #283 + - make sure plugins.setOptions is called before plugins.stringBefore. fixes #288 + - replace lib/lineBreak.js with rocambole-linebreak. closes #279 + - replace lib/whiteSpace.js with rocambole-whitespace. closes #278 + - support in place edits. fixes #275 + - use locally installed esformatter version if available. closes #190 + +## v0.5.1 (2015-03-17) + + - make it work with esprima@2.1 AST! + - ConditionalExpression: indent even if consequent is on the same line as the test + - Fix indent for logical expression as argument of return statement + - Fix indent for multi-var declaration with logical expression + - ForStatement improvements + - IfStatement: Fix multi-line test with comments + - ObjectExpression: Indent multi-line binary and logical expression values + - Update jQuery preset to fix single-line object expression spacing + - Update jQuery preset to make use of new IIFE settings + - fix DoWhileStatement indent. closes #256 + - improve CallExpression hook to handle a few edge cases and add option to limit br/ws around opening/closing parentheses. closes #267 + - improve getter/setter behavior on ObjectExpression. fixes #265 + - indent NewExpression arguments. fixes #254 + - make sure we don't loop over same CatchClause twice. fixes #264 + +## v0.5.0 (2015-02-26) + + - add support for br/ws around IIFEOpeningParentheses and IIFEClosingParentheses and keep spaces around CallExpression to avoid conflicts. closes #223. closes #250. + - don't remove line breaks before FunctionExpression by default and handle an edge case for array indentation if it is a chained member expression argument. fixes #202 + - drop ArgumentList exceptions (used previously by jQuery preset) + - fix FunctionExpression: Handle two special cases for TopLevelFunctionBlock + - fix SwitchCase indent if missing semicolon after break. fixes #225 + - fix array indentation for cases where closing bracket is on the same line. simplify ObjectExpression indentation logic while also fixing how it works inside arrays. fixes #224. fixes #239. + - fix indent edges for chained MemberExpression. fixes #240 + - improve IfStatement.test indentation. closes #222 + - indent BinaryExpression & LogicalExpression if inside VariableDeclaration, CallExpression or AssignmentExpression. fixes #212 + - indent support for ParameterList and enable it by default. closes #231 + - make sure plugins are loaded/registered before `plugins.stringBefore` is called and expose `unregisterAll`. fixes #245. closes #246. + - only indent if there is a line break before/between arguments. fixes #238 + - support getters/setters in ObjectExpression + - update jQuery preset to use CatchParameterList whiteSpace setting + - update jQuery preset to tolerate single line objects + - update rocambole to v0.5 and change the BinaryExpression test to match esprima@2.0 behavior (no EmptyStatement between ExpressionStatements). see #192 + +## v0.4.3 (2014-10-13) + + - fix error related to multiple `plugin.register` calls. (#218) + +## v0.4.2 (2014-09-08) + + - fix `else if` consequent with no braces. closes #196 + - fix indent of nested if braces before comments. closes #197 + - fix CatchClause indent and add settings for `FinallyKeyword` and `TryKeyword`. closes #203 + - indent `LogicalExpression` if it's the `VariableDeclaration.init`. + +## v0.4.1 (2014-07-09) + + - fix comma and white spaces around object property values (#191). + - fix ObjectExpression indent edges (#193). + +## v0.4.0 (2014-07-06) + + - add `transformBefore` hook for plugins and `transformAfter` to keep API consistent. closes #187 + - add option to add/remove trailing empty lines in the file (EOF). closes #111. + - add options to control line breaks inside ArrayExpressions. closes #129 + - add support for multiple indent levels (closes #179, closes #106). + - add double indent for `IfStatementConditional` on the jQuery preset (closes #150) + - add support for line breaks before/after `PropertyName` and `PropertyValue` (closes #184) + - support plugins option on the CLI. closes #182 + - fix `MemberExpression` indent behavior. (meta bug #181) + - fix indent end edge for `FunctionExpression` inside `MemberExpression`. closes #152 + - change indent rules for `AssignmentExpression` and `ConditionalExpression` to match jQuery preset needs. closes #149 + - convert comma-first objects to comma-last (closes #175) + - improve `CatchClause` and `TryStatement` line break and white space handling. closes #128 + - improve `ReturnStatement` and `CallExpression` indent behavior. + - rename `ChainedMemberExpression` to `MemberExpression` on the config file. + +## v0.3.2 (2014-06-23) + + - fix issue with sparse arrays. see millermedeiros/rocambole#15 + - fix Params comma handling and update rocambole to 0.3.4 to fix BlockComment. closes #139 + - fix indent for objects inside arrays. closes #142 + - fix white space inside expression statement with parens. closes #155 + - change IfStatement indent edges to avoid indenting comments that are just before `} else`. closes #123 + - fix comments inside ObjectExpression. closes #166 + + +## v0.3.1 (2014-06-23) + + - avoid merging undefined config on `esformatter.rc`. + - make sure `esformatter.rc` doesn't load config file if user provides + a 'preset' or if 'root == true' to match CLI behavior. + + +## v0.3.0 (2014-06-20) + + - expose ALL the things!! exposed a few methods related to line break, white + space and indentation; also flattened the directory structure to make it + easier for plugin authors to reuse esformatter internal methods when needed. + + +## v0.2.0 (2014-06-16) + + - add plugin support. + - refactored the way indentation is handled (and changed default settings + related to indentation). + - expose the `rc` method. + - fix rc merge/search logic to avoid problems on windows. + - fix `void 0` + - proper indent edges for `AssignmentExpression` + - indent `CallExpression` by default + - make sure `_br.limit` doesn't remove LineBreak if previous token is + a comment (fixes a few bugs). + - fix comments inside empty catch block (avoid removing line breaks). + + +## v0.1.1 (2014-05-12) + + - fix error when input is an empty file. + - fix `typeof` + - add spaces inside ForStatement and WhileStatement parenthesis on jQuery + preset. + + +## v0.1.0 (2014-04-15) + + - major refactor on the code structure and major changes to the default tool + behavior. + - changed some rules so the tool is less opinionated. + - change formatter logic to support ranges on the configuration file. + - avoid removing line breaks during the formatting process, increasing the + flexibility of the formatting rules. + + +## notes about v0.0.1 (2012-12-06) till v0.0.16 (2014-02-24) + +The formatter had stricter rules and was way less flexible before v0.1.0; + +Lots of small improvements between each version. Behavior was still in flux and +each version was breaking backwards compatibility. + +We considered v0.0.15 (2013-12-18) to be "stable" for most common cases, most +of bugs found in the following months after release was on edge-cases. We +decided to make a big refactor to increase the formatter flexibility and to be +less aggressive on the changes. + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/CONTRIBUTING.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/CONTRIBUTING.md new file mode 100644 index 00000000..35f087da --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/CONTRIBUTING.md @@ -0,0 +1,187 @@ +# Project Structure / Contributing + + +Check open issues for a list of features/bugs that we would like to see +fixed/implemented. + + +## EditorConfig + +To make sure we all use the same basic settings (indent, EOL, EOF) please +install [EditorConfig](http://editorconfig.org/#download). It will make code +review/merge easier. + + +## New Features / Bugs + +The easiest way to add new features and fix bugs is to create a test file with +mixed input and use the [rocambole-visualize](http://piuccio.github.io/rocambole-visualize/) +or the [esprima parser demo](http://esprima.org/demo/parse.html) to visualize +the syntax tree and implement each step separately. + +A good example of a commit that fixes a bug: +https://github.com/millermedeiros/esformatter/commit/ebafa00f76 and a good +example of a commit that introduces a new feature: +https://github.com/millermedeiros/esformatter/commit/e7d82cc81e + + + +## How it works? + +We augment the AST with +[rocambole](https://github.com/millermedeiros/rocambole), so every `node` have +[extra +properties](https://github.com/millermedeiros/rocambole#extra-properties) that +can be used to traverse the AST (similar to the DOM). + +The whole process is very similar to working with the DOM. Don't feel +intimidated by *complex names* like `ConditionalExpressionConsequent`, use the +[esprima parser demo](http://esprima.org/demo/parse.html) and/or +[rocambole-visualize](http://piuccio.github.io/rocambole-visualize/) as reference +and you should be good to go. + +We rely on some external libraries to add/remove/find tokens: + + - [rocambole-token](https://github.com/millermedeiros/rocambole-token) + - [rocambole-whitespace](https://github.com/millermedeiros/rocambole-whitespace) + - [rocambole-linebreak](https://github.com/millermedeiros/rocambole-linebreak) + +### Recursion + +The recursion starts from the *leaf nodes* and moves till it reaches the +`Program` root. It works this way because child nodes usually affects the +parent nodes structure (specially line breaks), that gives the option for the +parent node to override the child node behavior if needed. + +### Adding/Removing line breaks and white spaces + +The `format` method of each object exposed on `lib/hooks.js` is called once for +each matching `node`. The `format` method is responsible for adding/removing +line breaks and white spaces based on the node structure and config options. + +### Indentation + +We do the indentation after the whole process; that is necessary since the +parent nodes affects the indentation of the child nodes (line breaks might be +added or removed during the process). + +The core logic is handled by `lib/indent.js`, but most nodes actually require +specific rules to detect the *indent edges*, so most `lib/hooks` also implement +a method `getIndentEdges` that can return: + + - *falsy* value: means the node should **not** be indented; + - single `IndentEdge` object: indent in between `startToken` and `endToken`; + - array containing multiple `IndentEdge` objects and/or *falsy* values: indent + inside any `IndentEdge` object and ignore *falsy* values. + +The `IndentEdge` is just a Plain JavaScript Object with the properties: + + - `startToken:Token`: points to token that delimits the indent start (eg. a token + with value "{") + - `endToken:Token`: pointer to a token that sets the last token that should be + indented (eg. a line break just before `]`) + - `level:Int` (optional): sets how many indents should be added for that + `IndentEdge`, that is very useful for cases where you might have different + options for the same parent node (eg. the `FunctionExpression` hook also + handles the `ParameterList` indentation); if `level <= 0` that *edge* is not + indented (we don't support negative indent so far) + +If the hook doesn't implement `getIndentEdges` we consider `node.startToken` +and `node.endToken` as the default edge. We only indent nodes that have a value +greater than zero on the configuration options. + +Also important to notice that we only add `Indent` tokens to the beginning of +lines and if `edge.startToken` is `{` or `[` or `(` we use the +`edge.startToken.next` as the first token since that is usually the expected +behavior (you want to indent what is inside the braces/parenthesis). + +The reason why we decided to handle indentation as multiple `IndentEdge`s is +because there are many cases where the lines between `node.startToken` and +`node.endToken` are not really the *range* that you want to indent (eg. on +`IfStatement` you what to indent the `test`, `consequent` and `alt` but not the +lines that open/close the curly braces). Trying to handle all the cases +automatically is a path doomed to failure. This is the most flexible +abstraction, and cleanest implementation, that we could think of so far but it +is indeed complex; it would be way easier if we had a real CST (concrete syntax +tree) but that ship already sailed. + + + +## Branches and Pull Requests + +We will create `-wip` branches (work in progress) for *unfinished* features +(mostly because of failing tests) and try to keep master only with *stable* +code. We will try hard to not rewrite the commit history of `master` branch but +will do it for `-wip` branches. + +If you plan to implement a new feature check the existing branches, I will push +all my local `-wip` branches if I don't complete the feature in the same day. +So that should give a good idea on what I'm currently working. + +Try to split your pull requests into small chunks (separate features), that way +it is easier to review and merge. But feel free to do large refactors as well, +will be harder to merge but we can work it out. - see [issue-guidelines for +more info about good pull +requests](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#pull-requests) + + + +## Default Settings + +The default settings should be as *conservative* as possible, [Google +JavaScript Style +Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml) +should be used as a reference. + +We have plans to support other presets like +[Idiomatic.js](https://github.com/rwldrn/idiomatic.js/) and [jQuery Style +Guide](http://contribute.jquery.org/style-guide/js). + + + +## Tests + +Tests are done by comparing the result of `esformatter.parse()` of files with +name ending on `-in.js` with the files `-out.js`. The folder +`test/compare/default` tests the default settings and files inside +`test/compare/custom` tests custom settings. Tests inside the `compare/custom` +folder should try to test the *opposite* of the default settings whenever +possible. + +To run the tests install the `devDependencies` by running `npm install` +(only required once) and then run `npm test`. + +`mocha` source code was edited to provide better error +messages. See [mocha/issues/710](https://github.com/visionmedia/mocha/pull/710) +for more info. + +```sh +# runs all tests +npm test +# bail stops at first failed test +BAIL=true npm test +# GREP is used to filter the specs to run (only specs that contain "indent" in the name) +GREP='indent' npm test +# can also use "INVERT=true" to only execute specs that doesn't contain "cli" in the name +GREP=cli INVERT=true npm test +# to set the mocha reporter +REPORTER=dot npm test +# enable logging for the specified module +DEBUG=rocambole:br:* npm test +``` + +**protip:** files starting with double underscore (`__`) are on our +`.gitignore` file and won't be commited, so I usually have a `__tmp-in.js` and +`__tmp-out.js` test files that contains the bare minimum code that reproduces +the bug that I'm trying to fix and execute that with +`DEBUG=esformatter:*:*,rocambole:*:* GREP=tmp npm test` to get all the logs. + + +## IRC + +We have an IRC channel [#esformatter on +irc.freenode.net](http://webchat.freenode.net/?channels=esformatter) for quick +discussions about the project development/structure. + + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/README.md new file mode 100644 index 00000000..ac91d3e5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/README.md @@ -0,0 +1,554 @@ +# esformatter + +[![Build Status](https://secure.travis-ci.org/millermedeiros/esformatter.svg?branch=master)](https://travis-ci.org/millermedeiros/esformatter) + +ECMAScript code beautifier/formatter. + +Live preview: [lloiser/esformatter-visualize](http://lloiser.github.io/esformatter-visualize/) + + +## Important + +This tool is still on early development and is missing support for many +important features. Please report any bugs you find, the code is only as good +as the test cases. + +**We are looking for [contributors](https://github.com/millermedeiros/esformatter/blob/master/CONTRIBUTING.md)!!** + + + +## Why? + +[jsbeautifier.org](http://jsbeautifier.org/) doesn't have enough options and +not all IDEs/Editors have a good JavaScript code formatter. I would like to +have a command line tool (and standalone lib) as powerful/flexible as the +[WebStorm](http://www.jetbrains.com/webstorm/) and +[FDT](http://fdt.powerflasher.com/) code formatters. + +This tool could also be reused by other node.js libs like +[escodegen](https://github.com/Constellation/escodegen/) to format the output +(so each lib has a single responsibility). + +For more reasoning behind it and history of the project see: [esformatter +& rocambole](http://blog.millermedeiros.com/esformatter-rocambole/) + + + +## How? + +This tool uses [rocambole](https://github.com/millermedeiros/rocambole) (based +on Esprima) to recursively parse the tokens and transform it *in place*. + + + +## Goals + + - *granular* control about white spaces, indent and line breaks. + - command line interface (cli). + - be non-destructive. + - support for local/global config file so settings can be shared between team + members. + - support most popular style guides (Google, jQuery, Idiomatic.js). + - be the best JavaScript code formatter. + + + +## API + +### esformatter.format(str[, opts]):String + +`format()` method receives a string containing the code that you would like to +format and the configuration options that you would like to use and returns +a string with the result. + +```js +var esformatter = require('esformatter'); + +// for a list of available options check "lib/preset/default.json" +var options = { + // inherit from the default preset + preset : 'default', + indent : { + value : ' ' + }, + lineBreak : { + before : { + // at least one line break before BlockStatement + BlockStatement : '>=1', + // only one line break before BlockStatement + DoWhileStatementOpeningBrace : 1, + // ... + } + }, + whiteSpace : { + // ... + } +}; + +var fs = require('fs'); +var codeStr = fs.readFileSync('path/to/js/file.js').toString(); + +// return a string with the formatted code +var formattedCode = esformatter.format(codeStr, options); +``` + +### esformatter.transform(ast[, opts]):AST + +or you can use the `transform()` method to manipulate an AST in place (allows +pipping other tools that manipulates the AST). - so far only supports +[rocambole](https://github.com/millermedeiros/rocambole) generated ASTs, but we +will work to fix this limitation in the future (see [issue #86](https://github.com/millermedeiros/esformatter/issues/86)). + +```js +var inputAST = rocambole.parse('var foo=123;'); +// you can also pass the formatting options as second argument like the +// `format` method +var outputAST = esformatter.transform(inputAST); +assert(outputAST === inputAST, 'edits AST in place'); +assert(outputAST.toString() === 'var foo = 123;', 'formats input'); +``` + +### esformatter.rc([filePath], [customOptions]):Object + +Used by task runners and/or plugin authors to retrieve the configuration stored +on `.esformatter` and `package.json` files relative to the `filePath`, `cwd` or +global config file (`~/.esformatter`) if it can't find any config file until +the root path. + +You can also pass an object with `customOptions` to override the default +options. + +`rc` will merge the options from multiple [config files](#configuration). + +```js +// will start search from the "foo/bar" directory +var baseConfig = esformatter.rc('foo/bar/baz.js'); +// will start the search from cwd +var otherConfig = esformatter.rc(); +// merge some custom options to the user settings +var override = esformatter.rc({ + indent: { value: '\t' } +}); +``` + +### esformatter.register(plugin) + +Register a [plugin](#plugins) module. + +```js +var plugin = { + nodeAfter: function(node) { + // called once for each node, after the esformatter manipulation + } +}; +esformatter.register(plugin); +``` + +### esformatter.unregister(plugin) + +Remove [plugin](#plugins) from the execution queue. + +```js +esformatter.unregister(pluginObject); +``` + +### esformatter.unregisterAll() + +Remove all the registered plugins from the execution queue; useful in case you +want to edit multiple files using different plugins each time. + + + +## CLI + +You can also use the simple command line interface to process `stdin` and +`stdout` or read from a file. + +```sh +npm install -g esformatter +``` + +### Usage: + +````sh +esformatter [OPTIONS] [FILES] + +Options: + -c, --config Path to custom configuration file. + -p, --preset Set style guide preset ("jquery", "default"). + -h, --help Display help and usage details. + -v, --version Display the current version. + --plugins Comma separated list of plugins. + -i Edit input files in place. +```` + +### Examples: + +```sh +# format "test.js" and output result to stdout +esformatter test.js +# you can also pipe other shell commands (read file from stdin) +cat test.js | esformatter +# format "test.js" using options in "options.json" and output result to stdout +esformatter --config options.json test.js +# process "test.js" and writes to "test.out.js" +esformatter test.js > test.out.js +# you can override the default settings, see lib/preset/default.json for +# a list of available options +esformatter test.js --indent.value="\t" --lineBreak.before.IfStatementOpeningBrace=0 +# format "test.js" and output result to "test.js" +esformatter -i test.js +``` + +### Local version + +If a locally installed `esformatter` is found, the CLI uses that instead of the +global executable (this means you can have multiple projects depending on +different versions of esformatter). + +**protip:** add `esformatter` and all the plugins that you need on your project +to the [package.json `devDependencies`](https://docs.npmjs.com/files/package.json#devdependencies) +that way you can use locally installed plugins and also make sure everyone on +your team is using the same version/settings. + +```json +{ + "devDependencies": { + "esformatter": "~0.6.0", + "esformatter-quotes": "^1.0.1" + }, + "esformatter": { + "plugins": ["esformatter-quotes"], + "quotes": { + "type": "single" + } + } +} +``` + +### Configuration + +For a live preview check [esformatter-visualize](http://lloiser.github.io/esformatter-visualize/) + +`esformatter` will look for the closest `.esformatter` file and use that as +a setting unless you specify `--preset` or `--config`. + +You also have the option to put your `esformatter` settings inside the +`package.json` file under the `esformatter` property. + +Settings from multiple files will be merged until it finds a config file that +contains the property `"preset"` or `"root": true`; that makes it easy to +define exceptions to the project rules without needing to copy all the shared +properties. - for an example see test files inside the `"test/compare/rc"` +folder. + +The `"preset"` property is used to set the `prototype` of the config file, +enabling inheritance. For instance, you can say your config inherits from the +`jquery` preset and only override the settings you need: + +```json +{ + "preset": "jquery", + "indent": { + "value": " " + } +} +``` + +PS: the [jQuery preset](https://github.com/millermedeiros/esformatter/issues/19) is still under development. + + +Configuration in esformatter consists of three main building blocks: + +#### indent + +Indent is responsible for whitespace at the front of each line. `indent.value` is used for each indentation. The default indents with two spaces. Setting `indent.value` to `"\t"` will switch to indentation using tabs. + +The other properties for indent toggle indentation for specific elements. These all refer to regular JavaScript statements except for TopLevelFunctionBlock. This is enabled by default, with no special behaviour. When disabled (set to `0`), esformattter will not indent top level function blocks (used by the jQuery preset). + +#### lineBreak and whiteSpace + +Both of these have `value`, `before` and `after` properties. `lineBreak`'s value is `"\n"` by default, while whiteSpace uses a single space (`" "`). Its unlikely that you ever need to change these. + +More interesting are all the properties nested under `before` and `after`. These refer to various elements of JavaScript syntax, where the terms mostly match the names used by the Abstract Syntax Tree (AST) for JavaScript. A lot of them have "...Opening", "...Closing", "...OpeningBrace" and "...ClosingBrace" as variants, allowing very fine grained control over each settings. + +Documenting each property here wouldn't be practical. For now we recommend you look at the existing presets (default and jquery) to find the properties you need to adjust for your specific needs. Better yet, adopt one of the presets to avoid having to configure anything beyond the most basic settings (like `indent.value`). + +For `lineBreak` you can use ranges or integers: + + - positive integer (`1` till `99`): "add or keep `[n]` line breaks". + - `-1`: keep original line breaks. + - `">2"`: add linebreaks until it's over `2`. + - `">=1"`: add line breaks until it's equal or greater than `1`. + - `"<2"`: remove linebreaks until it's smaller than `2`. + - `"<=1"`: remove/add line breaks until it's smaller or equal to `1`. + +For `whiteSpace` you can only use positive integers for now (any positive number between `1` and `99`) or `-1` when you want to keep the original value. + + +## Pipe other CLI tools + +Since we don't expect everyone to write plugins that only works with +esformatter we decided to encourage the usage of standalone CLI tools. + +```js +{ + // pipe is a simple way to "pipe" multiple binaries input/output + "pipe": { + // scripts listed as "before" will be executed before esformatter + // and will forward output to next command in the queue + "before": [ + "strip-debug", + "./bin/my-custom-script.sh --foo true -zx" + ], + // scripts listed as "after" will be executed after esformatter + "after": [ + "baz --keepLineBreaks" + ] + } +} +``` + +The pipe option works by passing the string input to `stdin` of the first +executable and piping the `stdout->stdin` of each tool. The executables will be +executed in the same order as they are listed, `before` or `after` the default +`esformatter` transformations. + +The `pipe` option works similar to `npm run-script`, where it locates the +locally installed executables inside the `node_modules` folder. If it can't +find a local executable it will fallback to global commands. (this allows you +to install `devDependencies` that are only used by a single project) + + +## Plugins + +Esformatter also have support for plugins (v0.2.0+). + +JavaScript is a very flexible language, which means people write it in many +different ways, since adding support for every single kind of style would be +*impossible*, we decided to introduce plugins; that should give enough +flexibility to tailor the formatting to match the craziest needs. + +Plugins are automatically loaded from `node_modules` if you pass the module id +in the config file: + +```json +{ + "indent": { + "value": "\t" + }, + "plugins": ["esformatter-sample-plugin", "foobar"] +} +``` + +List of plugins and plugins wish list: https://github.com/millermedeiros/esformatter/wiki/Plugins + +You also have the option to `register` a plugin programmatically: + +```js +var plugin = { + nodeAfter: function(node) { + // transform node here + } +}; +esformatter.register(plugin); +``` + +Plugins are executed in the same order as they are registered (first in, first +out). + +The plugin methods are executed in the following order: `setOptions` > `stringBefore` > `transformBefore` > `tokenBefore` > `nodeBefore` > `nodeAfter` > `tokenAfter` > `transformAfter` > `stringAfter`. + +**All plugin methods are optional.** + +**IMPORTANT:** If you need to edit the structure of the AST (add/remove nodes, +change the order of elements) we recommend you to write it as a standalone CLI +tool whenever possible and use the `pipe` option instead of writting a plugin +(eg. [strip-debug](https://www.npmjs.com/package/strip-debug)). Plugins should +ideally only add/remove/edit the `WhiteSpace`, `Indent`, `LineBreak` and +`Comment` tokens, otherwise you might have conflicts with other plugins and +esformatter itself. + +**protip:** You can use +[rocambole-token](https://github.com/millermedeiros/rocambole-token) and +[rocambole-node](https://github.com/millermedeiros/rocambole-node) to simplify +the AST manipulation process. + + +### setOptions(options) + +Called once before any manipulation, the object is shared with the esformatter +which means you can use this method to override default options if needed. + +```js +var options; + +plugin.setOptions = function(opts) { + // override the default settings (objects are passed by reference, changing + // the value here will also change the value used by esformatter) + opts.indent.value = ' '; + // store the options to be used later + options = opts; +}; +``` + +### stringBefore(inputString):String + +A way to replace the input string, it should **ALWAYS** return a string. + +```js +plugin.stringBefore = function(str) { + // prepend a variable declaration to the file + return 'var foo = "bar";\n' + str; +}; +``` + +PS: you should only really use this method if you need to store some state +during `stringBefore` to be used by your other methods; otherwise favor the +`pipe` option. + +### stringAfter(outputString):String + +Replaces the output string. + +```js +plugin.stringAfter = function(str) { + // replaces all the occurances of "foo" with "bar" (very naive) + // using regular expressions or string manipulation methods to process code + // is very error-prone! BEWARE! + return str.replace(/foo/g, 'bar'); +}; +``` + +PS: you should only really use this method if you need to recover from some of +the changes you introduced by the other plugin methods; otherwise favor the +`pipe` option. + +### tokenBefore(token) + +Called once for each token (eg. Keyword, Punctuator, WhiteSpace, Indent...) +before processing the nodes. Can be used to manipulate the token value or +add/remove/replace the token or tokens around it. + +```js +var tk = require('rocambole-token'); + +plugin.tokenBefore = function(token) { + if (tk.isSemiColon(token) && tk.isSemiColon(token.next)) { + // remove semicolon if next token is also a semicolon + tk.remove(token); + } +}; +``` + +### tokenAfter(token) + +Called once for each token (eg. Keyword, Punctuator, WhiteSpace, Indent...) +after processing all the nodes. Can be used to manipulate the token value or +add/remove/replace the token or tokens around it. + +### nodeBefore(node) + +Called once for each `node` of the program (eg. VariableDeclaration, +IfStatement, FunctionExpression...) before the esformatter default +manipulations. + +### nodeAfter(node) + +Called once for each `node` of the program (eg. VariableDeclaration, +IfStatement, FunctionExpression...) after the esformatter default +manipulations. + +```js +var tk = require('rocambole-token'); + +plugin.nodeAfter = function(node) { + if (node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration') { + if (node.body) { + // insert a line break before the function body + tk.before(node.body.startToken, { + type: 'LineBreak', + value: options.lineBreak.value + }); + } + } +}; +``` + +### transformBefore(ast) + +Called before esformatter loops through all the nodes, it receives the whole +AST in case you need a different loop strategy than `rocambole.moonwalk`. In +most cases the `nodeBefore` method is enough. + +This method **should only** be used to add/remove `WhiteSpace`, `LineBreak` and +`Indent` tokens. + +It's very important to note that adding/removing/reordering `nodes` might cause +some serious problems on the code formatting. esformatter will skip nodes +unless you instrument them properly (adding all the properties that +`rocambole.moonwalk`, `rocambole.recursive` and future plugins expects) so it +is not recommended to do it here. + +If you need to edit the tree structure please use the `stringBefore` method or +write a standalone CLI tool that can be used on the `pipe` setting. + +### transformAfter(ast) + +Called after all nodes and tokens are processed, allows overriding all the +changes (including indentation). + +This method **should only** be used to add/remove `WhiteSpace`, `LineBreak` and +`Indent` tokens. + +```js +var rocambole = require('rocambole'); + +plugin.transformAfter = function(ast) { + // if you need to manipulate multiple nodes you can use the + // rocambole.moonwalk or rocambole.walk methods. we don't do it + // automatically since you might have very specific needs + rocambole.moonwalk(ast, function(node) { + doStuff(node); + }); +}; +``` + +It's very important to note that adding/removing/reordering `nodes` might cause +undesired side effects on other plugins (`rocambole.moonwalk` and +`rocambole.walk` might not work as expected and/or you might forget some +`node.[start|end]Token` and/or `token.[next|prev]` and break other plugins). So +if you need to edit the tree structure please use the `stringAfter` method or +write a standalone CLI tool that can be used on the `pipe` setting. + + +## IRC + +We have an IRC channel [#esformatter on +irc.freenode.net](http://webchat.freenode.net/?channels=esformatter) for quick +discussions about the project development/structure. + + +## Wiki + +See project Wiki for more info: https://github.com/millermedeiros/esformatter/wiki + + + +## Project structure / Contributing + +See [CONTRIBUTING.md](https://github.com/millermedeiros/esformatter/blob/master/CONTRIBUTING.md) + + + +## Popular Alternatives + + - [jsbeautifier](http://jsbeautifier.org/) + + + +## License + +Released under the MIT license + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/bin/esformatter b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/bin/esformatter new file mode 100755 index 00000000..7986bc2a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/bin/esformatter @@ -0,0 +1,40 @@ +#!/usr/bin/env node +"use strict"; + +// resolve allow us to load the locally installed esformatter instead of using +// the global version +var requireResolve = require('resolve').sync; +var path = require('path'); +var dirname = path.dirname; +var pathResolve = path.resolve; + +var argv = process.argv.slice(2); + +// if user sets a config file we use that as the base directory to start the +// search because we assume that some settings aren't backwards compatible +// otherwise we just use the process.cwd() +var opts = require('../lib/cli.js').parse(argv); +var basedir = opts.config ? + pathResolve(dirname(opts.config)) : + process.cwd(); + +var cliPath; +try { + cliPath = requireResolve('esformatter', { + basedir: basedir + }); + cliPath = pathResolve(dirname(cliPath), './cli.js'); +} catch (err) { + // fallback to this version instead + cliPath = '../lib/cli.js'; +} + +var cli = require(cliPath); +// until v0.5 the cli module only exposed a single `parse` method, after v0.6 +// we expose 2 methods to allow processing the data before executing the +// command (all the logic above) +if ('run' in cli) { + cli.run(cli.parse(argv)); +} else { + cli.parse(argv); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/cli.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/cli.js new file mode 100644 index 00000000..6e7e1083 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/cli.js @@ -0,0 +1,112 @@ +"use strict"; + +var esformatter = require('../lib/esformatter'); +var fs = require('fs'); +var optimist = require('optimist'); +var stdin = require('stdin'); +var merge = require('mout/object/merge'); +var options = require('./options'); + + +// --- + + +optimist + .usage('esformatter [OPTIONS] [FILES]') + .alias('c', 'config').describe('c', 'Path to custom configuration file.') + .alias('p', 'preset').describe('p', 'Set style guide preset ("jquery", "default").') + .alias('h', 'help').describe('h', 'Display help and usage details.') + .alias('v', 'version').describe('v', 'Display the current version.') + .describe('plugins', 'Comma separated list of plugins.') + .boolean('i').describe('i', 'Edit input files in place.') + .string(['config', 'preset', 'indent.value', 'lineBreak.value', 'whiteSpace.value', 'plugins']) + .boolean(['help', 'version']) + .wrap(80); + + +exports.parse = function(str) { + var argv = optimist.parse(str); + + if (argv.plugins) { + argv.plugins = argv.plugins.split(','); + } + + return argv; +}; + + +exports.run = function(argv) { + if (argv.help) { + optimist.showHelp(); + process.exit(0); + } + + if (argv.version) { + console.log('esformatter v' + require('../package.json').version); + process.exit(0); + } + + run(argv); +}; + + +// --- + + +function run(argv) { + var files = argv._; + if (!files.length) { + stdin(function(source) { + formatToConsole(source, getConfig(null, argv)); + }); + } else if (argv.i) { + files.forEach(function(file) { + formatToSelf(file, getConfig(file, argv)); + }); + } else { + files.forEach(function(file) { + formatToConsole(getSource(file), getConfig(file, argv)); + }); + } +} + + +function getSource(file) { + try { + return fs.readFileSync(file).toString(); + } catch (ex) { + console.error('Can\'t read source file: "' + file + '"\nException: ' + ex.message); + process.exit(2); + } +} + + +function getConfig(filePath, argv) { + // if user sets the "preset" we don't load any other config file + // we assume the "preset" overrides any user settings + if (argv.preset || argv.root) { + return argv; + } + + // we only load ".esformatter" or "package.json" file if user did not + // provide a config file as argument, that way we allow user to override + // the behavior + var config = argv.config ? + options.loadAndParseConfig(argv.config) : + options.getRc(filePath); + + // we always merge the argv to allow user to override the default settings + return merge(config, argv); +} + + +function formatToConsole(source, config) { + var result = esformatter.format(source, config); + // do not use console.log since it adds a line break at the end + process.stdout.write(result); +} + +function formatToSelf(file, config) { + fs.writeFileSync(file, esformatter.format(getSource(file), config)); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/esformatter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/esformatter.js new file mode 100644 index 00000000..a7ed3994 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/esformatter.js @@ -0,0 +1,186 @@ +'use strict'; + + +// non-destructive changes to EcmaScript code using an "enhanced" AST for the +// process, it updates the tokens in place and add/remove spaces & line breaks +// based on user settings. +// not using any kind of code rewrite based on string concatenation to avoid +// breaking the program correctness and/or undesired side-effects. + + +var _br = require('rocambole-linebreak'); +var _options = require('./options'); +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); +var addBrAroundNode = require('./lineBreakAroundNode'); +var expressionParentheses = require('./hooks/expressionParentheses'); +var hooks = require('./hooks'); +var indent = require('./indent'); +var plugins = require('./plugins'); +var rocambole = require('rocambole'); +var pipe = require('./pipe'); + +// esprima@2.1 introduces a "handler" property on TryStatement, so we would +// loop the same node twice (see jquery/esprima/issues/1031 and #264) +rocambole.BYPASS_RECURSION.handler = true; + +// --- + + +var _shouldRemoveTrailingWs; +// used to make sure we don't call setOptions twice when executing `transform` +// from inside `format` +var BYPASS_OPTIONS = {}; + + +// --- + + +exports.hooks = hooks; +exports.format = format; +exports.transform = transform; +exports.rc = _options.getRc; +exports.register = plugins.register; +exports.unregister = plugins.unregister; +exports.unregisterAll = plugins.unregisterAll; + + +// --- + + +function format(str, opts) { + // we need to load and register the plugins as soon as possible otherwise + // `stringBefore` won't be called and default settings won't be used + _options.set(opts); + + // remove shebang before pipe because piped commands might not know how + // to handle it + var prefix = ''; + if (_options.get('esformatter.allowShebang')) { + prefix = getShebang(str); + if (prefix) { + str = str.replace(prefix, ''); + } + } + + var pipeCommands = _options.get('pipe'); + + if (pipeCommands) { + str = pipe.run(pipeCommands.before, str).toString(); + } + + str = doFormat(str, opts); + + if (pipeCommands) { + str = pipe.run(pipeCommands.after, str).toString(); + } + + // we only restore bang after pipe because piped commands might not know how + // to handle it + return prefix + str; +} + + +function getShebang(str) { + var result = (/^#!.+\n/).exec(str); + return result ? result[0] : ''; +} + + +function doFormat(str) { + str = plugins.stringBefore(str); + var ast = rocambole.parse(str); + transform(ast, BYPASS_OPTIONS); + str = ast.toString(); + str = plugins.stringAfter(str); + return str; +} + + +function transform(ast, opts) { + if (opts !== BYPASS_OPTIONS) { + _options.set(opts); + } + _shouldRemoveTrailingWs = Boolean(_options.get('whiteSpace.removeTrailing')); + + plugins.transformBefore(ast); + + _tk.eachInBetween(ast.startToken, ast.endToken, preprocessToken); + rocambole.moonwalk(ast, transformNode); + _tk.eachInBetween(ast.startToken, ast.endToken, postprocessToken); + _br.limitBeforeEndOfFile(ast); + + // indent should come after all other transformations since it depends on + // line breaks caused by "parent" nodes, otherwise it will cause conflicts. + // it should also happen after the postprocessToken since it adds line breaks + // before/after comments and that changes the indent logic + indent.transform(ast); + + // plugin transformation comes after the indentation since we assume user + // knows what he is doing (will increase flexibility and allow plugin to + // override the indentation logic) + // we have an alias "transform" to match v0.3 API, but favor `transformAfter` + // moving forward. (we might deprecate "transform" in the future) + plugins.transform(ast); + plugins.transformAfter(ast); + + return ast; +} + + +function transformNode(node) { + plugins.nodeBefore(node); + addBrAroundNode(node); + + var hook = hooks[node.type]; + if (hook && 'format' in hook) { + hook.format(node); + } + + // empty program doesn't have startToken or endToken + if (node.startToken) { + // automatic white space comes afterwards since line breaks introduced by + // the hooks affects it + _ws.limitBefore(node.startToken, node.type); + _ws.limitAfter(node.endToken, node.type); + } + + // handle parenthesis automatically since it is needed by multiple node types + // and it avoids code duplication and reduces complexity of each hook + expressionParentheses.addSpaceInside(node); + plugins.nodeAfter(node); +} + + +function preprocessToken(token) { + if (_tk.isComment(token)) { + _br.limit(token, token.type); + } + plugins.tokenBefore(token); +} + + +function postprocessToken(token) { + if (_tk.isComment(token)) { + processComment(token); + } else if (_shouldRemoveTrailingWs && _tk.isWs(token)) { + removeTrailingWs(token); + } + plugins.tokenAfter(token); +} + + +function processComment(token) { + _ws.limitBefore(token, token.type); + // only block comment needs space afterwards + if (token.type === 'BlockComment') { + _ws.limitAfter(token, token.type); + } +} + + +function removeTrailingWs(token) { + if (_tk.isBr(token.next) || !token.next) { + _tk.remove(token); + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks.js new file mode 100644 index 00000000..310060fb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks.js @@ -0,0 +1,44 @@ +"use strict"; + + +// Hooks for each node.type that should be processed individually +// --- +// using an object to store each transform method to avoid a long switch +// statement, will be more organized in the long run and also allow +// monkey-patching/spies/mock/stub. + + +// we are not using something like https://npmjs.org/package/require-all +// because we want esformatter to be able to run in the browser in the future + +exports.ArrayExpression = require('./hooks/ArrayExpression'); +exports.ArrowFunctionExpression = require('./hooks/ArrowFunctionExpression'); +exports.AssignmentExpression = require('./hooks/AssignmentExpression'); +exports.BinaryExpression = require('./hooks/BinaryExpression'); +exports.CallExpression = exports.NewExpression = require('./hooks/CallExpression'); +exports.CatchClause = require('./hooks/CatchClause'); +exports.ClassDeclaration = require('./hooks/ClassDeclaration'); +exports.ConditionalExpression = require('./hooks/ConditionalExpression'); +exports.DoWhileStatement = require('./hooks/DoWhileStatement'); +exports.ForInStatement = require('./hooks/ForInStatement'); +exports.ForStatement = require('./hooks/ForStatement'); +exports.FunctionDeclaration = require('./hooks/FunctionDeclaration'); +exports.FunctionExpression = require('./hooks/FunctionExpression'); +exports.IfStatement = require('./hooks/IfStatement'); +exports.LogicalExpression = require('./hooks/LogicalExpression'); +exports.MemberExpression = require('./hooks/MemberExpression'); +exports.MethodDefinition = require('./hooks/MethodDefinition'); +exports.ObjectExpression = require('./hooks/ObjectExpression'); +exports.ReturnStatement = require('./hooks/ReturnStatement'); +exports.SequenceExpression = require('./hooks/SequenceExpression'); +exports.SwitchStatement = require('./hooks/SwitchStatement'); +exports.SwitchCase = require('./hooks/SwitchCase'); +exports.ThrowStatement = require('./hooks/ThrowStatement'); +exports.TryStatement = require('./hooks/TryStatement'); +exports.UnaryExpression = require('./hooks/UnaryExpression'); +exports.UpdateExpression = require('./hooks/UpdateExpression'); +exports.VariableDeclaration = require('./hooks/VariableDeclaration'); +exports.WhileStatement = require('./hooks/WhileStatement'); + + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ArrayExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ArrayExpression.js new file mode 100644 index 00000000..5c5b2b3a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ArrayExpression.js @@ -0,0 +1,61 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _limit = require('../limit'); + + +exports.format = function ArrayExpression(node) { + if (node.elements.length) { + _limit.around(node.startToken, 'ArrayExpressionOpening'); + _limit.around(node.endToken, 'ArrayExpressionClosing'); + + node.elements.forEach(function(el) { + // sparse arrays have `null` elements + if (!el) return; + + var prev = _tk.findPrevNonEmpty(el.startToken); + if (prev.value === ',') { + _limit.around(prev, 'ArrayExpressionComma'); + } + }); + } else { + // empty array should be single line + _limit.after(node.startToken, 0); + } +}; + + +exports.getIndentEdges = function(node) { + var start; + var prev = node.startToken; + + // this will grab the start of first element that is on a new line + node.elements.some(function(el, i, els) { + // sparse arrays have `null` elements! which is very weird + if (i) { + var prevEl = els[i - 1]; + prev = prevEl ? prevEl.endToken : _tk.findNextNonEmpty(prev); + } + var next = el ? el.startToken : _tk.findNextNonEmpty(prev); + + if (_tk.findInBetween(prev, next, _tk.isBr)) { + start = prev; + return true; + } + }); + + var end = node.endToken.prev; + + // if it ends on same line as previous non-empty we need to change the indent + // rule to make sure {}, [] and () are aligned + var sibling = _tk.findPrevNonEmpty(node.endToken); + if (!_tk.findInBetween(sibling, node.endToken, _tk.isBr)) { + end = node.endToken; + } + + return start ? { + startToken: start, + endToken: end + } : false; +}; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ArrowFunctionExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ArrowFunctionExpression.js new file mode 100644 index 00000000..f89a6ac8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ArrowFunctionExpression.js @@ -0,0 +1,37 @@ +'use strict'; + +var tk = require('rocambole-token'); +var limit = require('../limit'); +var _params = require('./Params'); + +exports.format = function ArrowFunctionExpression(node) { + var body = node.body; + if (body.type === 'BlockStatement') { + limit.around(body.startToken, 'ArrowFunctionExpressionOpeningBrace'); + limit.around(body.endToken, 'ArrowFunctionExpressionClosingBrace'); + } + + var arrow = tk.findPrev(body.startToken, '=>'); + limit.around(arrow, 'ArrowFunctionExpressionArrow'); + + // make sure we handle `(x) => x` and `x => x` + if (shouldHandleParams(node)) { + _params.format(node); + } +}; + +exports.getIndentEdges = function(node, opts) { + var edges = [ + node.body + ]; + if (shouldHandleParams(node)) { + edges.push(_params.getIndentEdges(node, opts)); + } + return edges; +}; + +function shouldHandleParams(node) { + var arrow = tk.findPrev(node.body.startToken, '=>'); + // we don't check based on `node.params` because of `node.defaults` + return tk.findPrevNonEmpty(arrow).value === ')'; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/AssignmentExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/AssignmentExpression.js new file mode 100644 index 00000000..1e1854f9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/AssignmentExpression.js @@ -0,0 +1,28 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); +var _br = require('rocambole-linebreak'); + + +exports.format = function AssignmentExpression(node) { + // can't use node.right.startToken since it might be surrounded by + // a parenthesis (see #5) + var operator = _tk.findNext(node.left.endToken, node.operator); + _br.limit(operator, 'AssignmentOperator'); + _ws.limit(operator, 'AssignmentOperator'); +}; + + +exports.getIndentEdges = function(node, opts) { + var operator = _tk.findNext(node.left.endToken, node.operator); + if (_tk.findInBetween(operator, node.right.startToken, _tk.isBr) || + (opts['AssignmentExpression.' + node.right.type] && + _tk.findInBetween(operator, node.right.endToken, _tk.isBr))) { + // we only indent if assignment is on next line + return { + startToken: operator, + endToken: node.endToken.next || node.endToken + }; + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/BinaryExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/BinaryExpression.js new file mode 100644 index 00000000..2e43852d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/BinaryExpression.js @@ -0,0 +1,23 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); + + +exports.format = function BinaryExpression(node) { + var operator = _tk.findNext(node.left.endToken, node.operator); + _ws.limit(operator, 'BinaryExpressionOperator'); +}; + +exports.getIndentEdges = function(node) { + // we only add indent for the top most BinaryExpression (in case we have + // multiple operations in a row) + if (node.parent.type === 'BinaryExpression') { + return; + } + + return { + startToken: node.startToken.next, + endToken: node.endToken.next || node.endToken + }; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/CallExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/CallExpression.js new file mode 100644 index 00000000..3b6e51bf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/CallExpression.js @@ -0,0 +1,95 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _limit = require('../limit'); +var _parens = require('./expressionParentheses'); + + +exports.format = function CallExpression(node) { + var openingParentheses = _tk.findNext(node.callee.endToken, '('); + var closingParentheses = node.endToken; + + _limit.around(openingParentheses, 'CallExpressionOpeningParentheses'); + _limit.around(closingParentheses, 'CallExpressionClosingParentheses'); + + var args = node['arguments']; + + if (args.length) { + _limit.before(_tk.findNextNonEmpty(openingParentheses), 'ArgumentList'); + + args.forEach(function(arg) { + var next = _tk.findInBetween(arg.endToken, closingParentheses, ','); + if (next && next.value === ',') { + _limit.around(next, 'ArgumentComma'); + } + }); + + _limit.after(_tk.findPrevNonEmpty(closingParentheses), 'ArgumentList'); + + } else { + _limit.after(openingParentheses, 0); + _limit.before(closingParentheses, 0); + } + + // iife + if (node.callee.type !== 'FunctionExpression') { + return; + } + + var parens = _parens.getParentheses({ + type: 'Special', + startToken: node.startToken, + endToken: node.endToken + }); + + if (parens) { + _limit.after(parens.opening, 'IIFEOpeningParentheses'); + _limit.before(parens.closing, 'IIFEClosingParentheses'); + } + +}; + +exports.getIndentEdges = function(node, opts) { + + var openingParentheses = _tk.findNext(node.callee.endToken, '('); + + if (!node.arguments.length) { + // it might contain comments inside even tho there are no args + return { + startToken: openingParentheses, + endToken: _tk.findNext(openingParentheses, ')') + }; + } + + var start; + + function hasBr(start, end) { + return _tk.findInBetween(start, end, _tk.isBr); + } + + node.arguments.some(function(arg, i, args) { + var prev = i ? args[i - 1].endToken.next : openingParentheses; + if (hasBr(prev, arg.startToken)) { + start = prev; + return true; + } + }); + + if (!start) { + // we handle BinaryExpressions here because multiple operations are grouped + // inside the same root node, and we need to indent if it breaks lines + node.arguments.some(function(arg) { + if (opts['CallExpression.' + arg.type] && + hasBr(arg.startToken, arg.endToken)) { + start = arg.startToken.next; + return true; + } + }); + } + + return start ? { + startToken: start, + endToken: node.endToken + } : false; + +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/CatchClause.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/CatchClause.js new file mode 100644 index 00000000..7654180f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/CatchClause.js @@ -0,0 +1,29 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _limit = require('../limit'); + + +exports.format = function CatchClause(node) { + _limit.around(node.startToken, 'CatchKeyword'); + + _limit.before(node.param.startToken, 'CatchParameterList'); + _limit.after(node.param.endToken, 'CatchParameterList'); + + _limit.around(node.body.startToken, 'CatchOpeningBrace'); + _limit.around(node.body.endToken, 'CatchClosingBrace'); + + // only remove line breaks if there are no comments inside. Ref #169 + if (!node.body.body.length && !containsCommentsInside(node.body)) { + _tk.removeEmptyInBetween(node.body.startToken, node.body.endToken); + } +}; + + +function containsCommentsInside(node) { + return !!_tk.findInBetween(node.startToken, node.endToken, _tk.isComment); +} + +exports.getIndentEdges = function(node) { + return node.body; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ClassDeclaration.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ClassDeclaration.js new file mode 100644 index 00000000..dc82444e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ClassDeclaration.js @@ -0,0 +1,32 @@ +'use strict'; + +var tk = require('rocambole-token'); +var ws = require('rocambole-whitespace'); +var br = require('rocambole-linebreak'); +var limit = require('../limit'); + +exports.format = function ClassDeclaration(node) { + var opening = tk.findNext(node.startToken, '{'); + var closing = node.endToken; + // yes, we remove all the line breaks and limit to a single whitespace in + // between the words since line breaks here are stupid and would make things + // more complex + limitInBetweenKeywords(node.startToken, opening); + limit.around(opening, 'ClassDeclarationOpeningBrace'); + limit.around(closing, 'ClassDeclarationClosingBrace'); +}; + +function limitInBetweenKeywords(start, end) { + var token = start; + while (token && token !== end) { + if (!tk.isEmpty(token)) { + br.limitAfter(token, 0); + ws.limitAfter(token, 1); + } + token = token.next; + } +} + +exports.getIndentEdges = function(node) { + return node; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ConditionalExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ConditionalExpression.js new file mode 100644 index 00000000..80f0d995 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ConditionalExpression.js @@ -0,0 +1,33 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); + + +exports.format = function ConditionalExpression(node) { + // we need to grab the actual punctuators since parenthesis aren't counted + // as part of test/consequent/alternate + var questionMark = _tk.findNext(node.test.endToken, '?'); + var colon = _tk.findNext(node.consequent.endToken, ':'); + + _ws.limitBefore(questionMark, _ws.expectedAfter('ConditionalExpressionTest')); + _ws.limitAfter(questionMark, _ws.expectedBefore('ConditionalExpressionConsequent')); + _ws.limitBefore(colon, _ws.expectedAfter('ConditionalExpressionConsequent')); + _ws.limitAfter(colon, _ws.expectedBefore('ConditionalExpressionAlternate')); +}; + + +exports.getIndentEdges = function(node) { + if (_tk.findInBetween(node.test.endToken, node.consequent.startToken, _tk.isBr)) { + return { + startToken: node.test.endToken.next, + endToken: node.endToken.next + }; + } + if (_tk.findInBetween(node.consequent.endToken, node.alternate.startToken, _tk.isBr)) { + return { + startToken: node.consequent.endToken.next, + endToken: node.endToken.next + }; + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/DoWhileStatement.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/DoWhileStatement.js new file mode 100644 index 00000000..3bb3331b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/DoWhileStatement.js @@ -0,0 +1,31 @@ +'use strict'; + +var _tk = require('rocambole-token'); +var _limit = require('../limit'); +var _ws = require('rocambole-whitespace'); + + +exports.format = function DoWhileStatement(node) { + if (node.body.type === 'BlockStatement') { + _limit.around(node.body.startToken, 'DoWhileStatementOpeningBrace'); + _limit.around(node.body.endToken, 'DoWhileStatementClosingBrace'); + } else { + _ws.limitAfter(node.startToken, 1); + } + var whileKeyword = _tk.findPrev(node.test.startToken, 'while'); + _ws.limit(whileKeyword, 1); +}; + + +exports.getIndentEdges = function(node) { + return [ + { // do + startToken: node.startToken.next, + endToken: node.body.endToken + }, + { // while + startToken: _tk.findNext(node.body.endToken, '('), + endToken: _tk.findPrev(node.endToken, ')') + } + ]; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ForInStatement.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ForInStatement.js new file mode 100644 index 00000000..96248544 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ForInStatement.js @@ -0,0 +1,54 @@ +"use strict"; + +var _br = require('rocambole-linebreak'); +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); + + +exports.format = function ForInStatement(node) { + var expressionStart = _tk.findNext(node.startToken, '('); + var expressionEnd = _tk.findPrev(node.body.startToken, ')'); + + _br.limit(expressionStart, 'ForInStatementExpressionOpening'); + _ws.limit(expressionStart, 'ForInStatementExpressionOpening'); + + _br.limit(expressionEnd, 'ForInStatementExpressionClosing'); + _ws.limit(expressionEnd, 'ForInStatementExpressionClosing'); + + if (node.body.type === 'BlockStatement' && node.body.body.length) { + var bodyStart = node.body.startToken; + var bodyEnd = node.body.endToken; + + _br.limit(bodyStart, 'ForInStatementOpeningBrace'); + _ws.limit(bodyStart, 'ForInStatementOpeningBrace'); + + _br.limit(bodyEnd, 'ForInStatementClosingBrace'); + _ws.limit(bodyEnd, 'ForInStatementClosingBrace'); + + _ws.limitAfter(expressionEnd, 'ForInStatementExpression'); + } + + _ws.limitAfter(node.left.endToken, 1); + _ws.limitBefore(node.right.startToken, 1); +}; + + +exports.getIndentEdges = function(node) { + var edges = []; + + edges.push({ + startToken: node.left.startToken, + endToken: node.right.endToken + }); + + if (node.body.type === 'BlockStatement') { + edges.push(node.body); + } else { + edges.push({ + startToken: _tk.findNext(node.right.endToken, ')').next, + endToken: node.endToken + }); + } + + return edges; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ForStatement.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ForStatement.js new file mode 100644 index 00000000..ba8c9bb6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ForStatement.js @@ -0,0 +1,47 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); +var _limit = require('../limit'); + + +exports.format = function ForStatement(node) { + var semi_1 = _tk.findNext(node.startToken, ';'); + var semi_2 = _tk.findPrev(node.body.startToken, ';'); + _ws.limit(semi_1, 'ForStatementSemicolon'); + _ws.limit(semi_2, 'ForStatementSemicolon'); + + var expressionStart = _tk.findNext(node.startToken, '('); + var expressionEnd = _tk.findPrev(node.body.startToken, ')'); + _limit.around(expressionStart, 'ForStatementExpressionOpening'); + _limit.around(expressionEnd, 'ForStatementExpressionClosing'); + + if (node.body.type === 'BlockStatement') { + var bodyStart = node.body.startToken; + var bodyEnd = node.body.endToken; + _limit.around(bodyStart, 'ForStatementOpeningBrace'); + _limit.around(bodyEnd, 'ForStatementClosingBrace'); + } +}; + + +exports.getIndentEdges = function(node) { + var edges = []; + + var args = { + startToken: _tk.findNext(node.startToken, '('), + endToken: _tk.findPrev(node.body.startToken, ')') + }; + edges.push(args); + + if (node.body.type === 'BlockStatement') { + edges.push(node.body); + } else { + edges.push({ + startToken: args.endToken, + endToken: node.endToken + }); + } + + return edges; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/FunctionDeclaration.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/FunctionDeclaration.js new file mode 100644 index 00000000..5a4a49fd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/FunctionDeclaration.js @@ -0,0 +1,20 @@ +"use strict"; + +var _limit = require('../limit'); +var _params = require('./Params'); + + +exports.format = function FunctionDeclaration(node) { + _limit.around(node.id.startToken, 'FunctionName'); + _params.format(node); + _limit.around(node.body.startToken, 'FunctionDeclarationOpeningBrace'); + _limit.around(node.body.endToken, 'FunctionDeclarationClosingBrace'); +}; + + +exports.getIndentEdges = function(node, opts) { + return [ + _params.getIndentEdges(node, opts), + node.body + ]; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/FunctionExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/FunctionExpression.js new file mode 100644 index 00000000..98f4a36d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/FunctionExpression.js @@ -0,0 +1,70 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); +var _params = require('./Params'); +var _limit = require('../limit'); + + +exports.format = function FunctionExpression(node) { + _limit.around(node.body.startToken, 'FunctionExpressionOpeningBrace'); + _limit.around(node.endToken, 'FunctionExpressionClosingBrace'); + + if (node.id) { + _ws.limit(node.id.startToken, 'FunctionName'); + } else { + _ws.limit(node.startToken, 'FunctionReservedWord'); + } + + if (_tk.isWs(node.endToken.next) && + _tk.isSemiColon(node.endToken.next.next)) { + _tk.remove(node.endToken.next); + } + + if (node.parent.type === 'CallExpression') { + _ws.limitAfter(node.endToken, 0); + } + + var bodyFirstNonEmpty = _tk.findNextNonEmpty(node.body.startToken); + if (bodyFirstNonEmpty.value === '}') { + // noop + _limit.after(node.body.startToken, 0); + } + + _params.format(node); +}; + + +exports.getIndentEdges = function(node, opts) { + var params = _params.getIndentEdges(node, opts); + // TODO make this a plugin + if (!opts.TopLevelFunctionBlock && isTopLevelFunctionBlock(node)) { + return params; + } + return [ + params, + { + startToken: node.body.startToken, + endToken: _tk.findPrevNonEmpty(node.body.endToken).next + } + ]; +}; + + +function isTopLevelFunctionBlock(node) { + // exception for UMD blocks + return !(node.params.length === 1 && node.params[0].name === "factory") && + // regular IFEE + (isOfType(node.parent, 'CallExpression') || + // module.exports assignment + isOfType(node.parent, 'AssignmentExpression')) && + !isOfType(node.parent.callee, 'MemberExpression') && + isOfType(node.parent.parent, 'ExpressionStatement') && + isOfType(node.parent.parent.parent, 'Program'); +} + + +// TODO: extract into rocambole-node +function isOfType(node, type) { + return node && node.type === type; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/IfStatement.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/IfStatement.js new file mode 100644 index 00000000..a24c0d1c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/IfStatement.js @@ -0,0 +1,122 @@ +"use strict"; + +var _br = require('rocambole-linebreak'); +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); +var _limit = require('../limit'); + + +exports.format = function IfStatement(node) { + + var startBody = node.consequent.startToken; + var endBody = node.consequent.endToken; + + var conditionalStart = _tk.findPrev(node.test.startToken, '('); + var conditionalEnd = _tk.findNext(node.test.endToken, ')'); + + _ws.limit(conditionalStart, 'IfStatementConditionalOpening'); + _ws.limit(conditionalEnd, 'IfStatementConditionalClosing'); + + var alt = node.alternate; + if (alt) { + var elseKeyword = _tk.findPrev(alt.startToken, 'else'); + + if (alt.type === 'IfStatement') { + // ElseIfStatement + _br.limitBefore(alt.startToken, 0); + _ws.limitBefore(alt.startToken, 1); + + if (alt.consequent.type === 'BlockStatement') { + _br.limitBefore(alt.consequent.startToken, 'ElseIfStatementOpeningBrace'); + _br.limitBefore(alt.consequent.endToken, 'ElseIfStatementClosingBrace'); + } + + _br.limitBefore(elseKeyword, 'ElseIfStatement'); + if (! alt.alternate) { + // we only limit the line breaks after the ElseIfStatement if it is not + // followed by an ElseStatement, otherwise it would add line breaks + // that it shouldn't + _br.limitAfter(alt.consequent.endToken, 'ElseIfStatement'); + } + + } else if (alt.type === 'BlockStatement') { + // ElseStatement + + _limit.around(alt.startToken, 'ElseStatementOpeningBrace'); + + _br.limitBefore(elseKeyword, 'ElseStatement'); + _br.limitAfter(alt.endToken, 'ElseStatement'); + + _ws.limitBefore(elseKeyword, 1); + + _limit.around(alt.endToken, 'ElseStatementClosingBrace'); + } else { + // ElseStatement without curly braces + _ws.limitAfter(elseKeyword, 1); + } + } + + // only handle braces if block statement + if (node.consequent.type === 'BlockStatement') { + _limit.around(startBody, 'IfStatementOpeningBrace'); + if (!alt) { + _br.limit(endBody, 'IfStatementClosingBrace'); + } else { + _br.limitBefore(endBody, 'IfStatementClosingBrace'); + } + _ws.limit(endBody, 'IfStatementClosingBrace'); + } + +}; + + +exports.getIndentEdges = function(node, opts) { + var edges = []; + + var test = node.test; + var consequent = node.consequent; + var alt = node.alternate; + + // test (IfStatementConditional) + edges.push({ + level: opts.IfStatementConditional, + startToken: _tk.findNext(node.startToken, '('), + endToken: _tk.findPrev(consequent.startToken, ')'), + }); + + function isExecutable(token) { + return _tk.isNotEmpty(token) && !_tk.isComment(token); + } + + // consequent (body) + edges.push({ + startToken: ( + consequent.type === 'BlockStatement' ? + consequent.startToken : + test.endToken.next + ), + // we have some special rules for comments just before the `else` statement + // because of jQuery style guide. maybe in the future we will add + // a setting to toggle this behavior (if someone asks for it) + endToken: ( + alt && _tk.isComment(_tk.findPrevNonEmpty(consequent.endToken)) ? + _tk.findPrev(consequent.endToken, isExecutable).next : + consequent.endToken + ) + }); + + // alt (else) + if (alt && alt.type !== 'IfStatement') { + // it the alternate is IfStatement it will already take care of indentation + edges.push({ + startToken: ( + alt.type === 'BlockStatement' ? + alt.startToken : + _tk.findPrevNonEmpty(alt.startToken).next + ), + endToken: alt.endToken + }); + } + + return edges; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/LogicalExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/LogicalExpression.js new file mode 100644 index 00000000..8acc5ece --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/LogicalExpression.js @@ -0,0 +1,27 @@ +"use strict"; + +var _br = require('rocambole-linebreak'); +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); + + +exports.format = function LogicalExpression(node) { + var operator = _tk.findNext(node.left.endToken, node.operator); + _ws.limit(operator, 'LogicalExpressionOperator'); + // revert line breaks since parenthesis might not be part of + // node.startToken and node.endToken + if (node.parent.type === 'ExpressionStatement') { + var prev = _tk.findPrevNonEmpty(node.left.startToken); + if (prev && prev.value === '(') { + _br.limit(prev, 'ExpressionOpeningParentheses'); + _ws.limit(prev, 'ExpressionOpeningParentheses'); + node.startToken = prev; + } + var next = _tk.findNextNonEmpty(node.right.endToken); + if (next && next.value === ')') { + _br.limit(next, 'ExpressionClosingParentheses'); + _ws.limit(next, 'ExpressionClosingParentheses'); + node.endToken = next; + } + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/MemberExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/MemberExpression.js new file mode 100644 index 00000000..89a8b9a7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/MemberExpression.js @@ -0,0 +1,38 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); + + +exports.format = function MemberExpression(node) { + var opening = _tk.findPrevNonEmpty(node.property.startToken), + closing = _tk.findNextNonEmpty(node.property.endToken); + if (opening && closing && opening.value === '[' && closing.value === ']') { + _ws.limitAfter(opening, "MemberExpressionOpening"); + _ws.limitBefore(closing, "MemberExpressionClosing"); + } +}; + + +exports.getIndentEdges = function(node) { + var edge = {}; + edge.startToken = node.object.endToken; + + if (node.object.type !== 'CallExpression') { + edge.startToken = edge.startToken.next; + } + + edge.endToken = node.endToken; + if (node.parent.type === 'CallExpression' && + node.parent.callee.type === 'MemberExpression') { + edge.endToken = node.parent.endToken; + } + + // only indent if on a different line + if (!_tk.findInBetween(edge.startToken, node.property.startToken, _tk.isBr)) { + return false; + } + + return edge; +}; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/MethodDefinition.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/MethodDefinition.js new file mode 100644 index 00000000..7416486a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/MethodDefinition.js @@ -0,0 +1,13 @@ +'use strict'; + +var ws = require('rocambole-whitespace'); +var br = require('rocambole-linebreak'); + +exports.format = function MethodDefinition(node) { + br.limitAfter(node.startToken, 0); + // limit to one space after get/set/static + if (node.startToken !== node.key) { + ws.limitAfter(node.startToken, 1); + } + ws.limitAfter(node.key.endToken, 0); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ObjectExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ObjectExpression.js new file mode 100644 index 00000000..854aabac --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ObjectExpression.js @@ -0,0 +1,96 @@ +"use strict"; + +var _br = require('rocambole-linebreak'); +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); +var _limit = require('../limit'); + + +exports.format = function ObjectExpression(node) { + if (!node.properties.length) return; + + // TODO: improve this, there are probably more edge cases + var shouldBeSingleLine = node.parent.type === 'ForInStatement'; + + if (!shouldBeSingleLine) { + _limit.around(node.startToken, 'ObjectExpressionOpeningBrace'); + } else { + // XXX: we still have this rule that looks weird, maybe change it in the + // future since it is not flexible (edge-case tho) + _tk.removeEmptyInBetween(node.startToken, node.endToken); + } + + node.properties.forEach(function(prop) { + var valueStart = getValueStart(prop); + var valueEnd = getValueEnd(prop); + var keyStart = prop.key.startToken; + var keyEnd = prop.key.endToken; + + // convert comma-first to comma-last + var comma = _tk.findNext(valueEnd, [',', '}']); + if (_tk.isComma(comma)) { + _tk.removeInBetween(valueEnd, comma, _tk.isBr); + _tk.remove(comma); + _tk.after(valueEnd, comma); + } + + if (!shouldBeSingleLine) { + _br.limitBefore(keyStart, 'PropertyName'); + _br.limitAfter(keyEnd, 'PropertyName'); + _br.limitBefore(valueStart, 'PropertyValue'); + _br.limitAfter(valueEnd, 'PropertyValue'); + } else if (keyStart.prev.value !== '{') { + _ws.limitBefore(keyStart, 'Property'); + } + + if (prop.kind === 'get' || prop.kind === 'set') { + _ws.limitBefore(keyStart, 1); + _ws.limitAfter(keyEnd, 0); + return; + } + + _ws.limitBefore(keyStart, 'PropertyName'); + _ws.limitAfter(keyEnd, 'PropertyName'); + _ws.limitBefore(valueStart, 'PropertyValue'); + _ws.limitAfter(valueEnd, 'PropertyValue'); + }); + + if (!shouldBeSingleLine) { + _limit.around(node.endToken, 'ObjectExpressionClosingBrace'); + } +}; + + +function getValueStart(prop) { + var start = prop.value.startToken; + return (prop.kind === 'get' || prop.kind === 'set') ? + start : + // we need to grab first/last "executable" token to avoid issues (see #191) + _tk.findNext(_tk.findPrev(start, ':'), _tk.isCode); +} + + +function getValueEnd(prop) { + // we need to grab next "," or "}" because value might be surrounded by + // parenthesis which would break the regular logic + var end = _tk.findNext(prop.value.endToken, [',', '}']); + return _tk.findPrev(end, _tk.isCode); +} + + +exports.getIndentEdges = function(node, opts) { + var edges = [{ + startToken: node.startToken, + endToken: _tk.findInBetweenFromEnd(node.startToken, node.endToken, _tk.isBr) + }]; + + node.properties.forEach(function(property) { + if (!opts['ObjectExpression.' + property.value.type]) return; + edges.push({ + startToken: getValueStart(property), + endToken: getValueEnd(property) + }); + }); + + return edges; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/Params.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/Params.js new file mode 100644 index 00000000..24dd75ae --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/Params.js @@ -0,0 +1,55 @@ +"use strict"; + +// Important: Params is a "virtual" node type, not part of the AST spec. +// this hook is actually called by FunctionDeclaration and FunctionExpression +// hooks. It's mainly a way to share the common logic between both hooks. + +var _ws = require('rocambole-whitespace'); +var _tk = require('rocambole-token'); +var _limit = require('../limit'); + + +exports.format = function Params(node) { + var params = node.params; + var defaults = node.defaults; + var opening = node.startToken.value === '(' ? + node.startToken : + _tk.findNext(node.startToken, '('); + var closing = _tk.findPrev(node.body.startToken, ')'); + + if (params.length) { + _ws.limitBefore(_tk.findNextNonEmpty(opening), 'ParameterList'); + params.forEach(function(param, i) { + // if only one param or last one there are no commas to look for + if (i === params.length - 1) return; + + _ws.limit(_tk.findNext(param.startToken, ','), 'ParameterComma'); + }); + defaults.forEach(function(init) { + if (init) { + _limit.around(_tk.findPrev(init.startToken, '='), 'ParameterDefault'); + } + }); + _ws.limitAfter(_tk.findPrevNonEmpty(closing), 'ParameterList'); + } else { + _limit.after(opening, 0); + } +}; + +exports.getIndentEdges = function(node, opts) { + var params = node.params; + if (params.length && opts.ParameterList) { + // get/set on ObjectEpression affect drastically the FunctionExpression + // structure so we need to handle it differently + var start = node.parent.type === 'Property' ? + node.parent.startToken : + node.startToken; + return { + // we check if start is equal to "(" because of arrow functions + startToken: start.value === '(' ? start : _tk.findNext(start, '('), + endToken: _tk.findPrev(node.body.startToken, ')'), + level: opts.ParameterList + }; + } + return null; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ReturnStatement.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ReturnStatement.js new file mode 100644 index 00000000..0a0d39b4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ReturnStatement.js @@ -0,0 +1,51 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); + +var expressionParentheses = require('./expressionParentheses'); + + +exports.format = function ReturnStatement(node) { + // need to make sure we only remove line breaks inside the node itself + // because of ASI (see #29) + var nonEmpty = _tk.findInBetween(node.startToken.next, node.endToken, _tk.isNotEmpty); + // XXX: we want to remove line breaks and white spaces inside the node, not + // using _br.limitAfter to avoid changing the program behavior (ASI) + if (nonEmpty) _tk.removeEmptyInBetween(node.startToken, nonEmpty); + + _ws.limitAfter(node.startToken, 1); + if (_tk.isSemiColon(node.endToken)) { + // XXX: we want semicolon to be on same line and no whitespaces for now. + _tk.removeEmptyInBetween(_tk.findPrevNonEmpty(node.endToken), node.endToken); + } + + if (node.argument) { + expressionParentheses.addSpaceInside(node.argument); + } +}; + + +var _specialArguments = { + 'BinaryExpression': true +}; + + +exports.getIndentEdges = function(node, opts) { + // we bypass indentation if argument already adds indentation + if (!node.argument || + (opts[node.argument.type] && !_specialArguments[node.argument.type])) { + return false; + } + + var parentheses = expressionParentheses.getParentheses(node.argument); + return parentheses ? + { + startToken: parentheses.opening, + endToken: parentheses.closing + } : + { + startToken: node.startToken.next, + endToken: node.endToken + }; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/SequenceExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/SequenceExpression.js new file mode 100644 index 00000000..fdb363a5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/SequenceExpression.js @@ -0,0 +1,16 @@ +"use strict"; + +var _ws = require('rocambole-whitespace'); + + +exports.format = function SequenceExpression(node) { + node.expressions.forEach(function(expr, i) { + if (i) { + var operator = expr.startToken.prev; + while (operator.value !== ',') { + operator = operator.prev; + } + _ws.limit(operator, 'CommaOperator'); + } + }); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/SwitchCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/SwitchCase.js new file mode 100644 index 00000000..b0f46628 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/SwitchCase.js @@ -0,0 +1,35 @@ +"use strict"; + +var _ws = require('rocambole-whitespace'); +var _br = require('rocambole-linebreak'); +var _tk = require('rocambole-token'); +var limit = require('../limit'); + + +exports.format = function SwitchCase(node) { + if (node.test) { + // we want case to always be on the same line! + _br.limitBefore(node.test.startToken, 0); + _ws.limitBefore(node.test.startToken, 1); + } + var endToken = node.endToken; + if (endToken.value !== ':') { + // endToken might be ":" or "break" or ";" + var breakKeyword = _tk.findPrev(endToken.next, 'break'); + if (breakKeyword) { + limit.before(breakKeyword, 'BreakKeyword'); + limit.after(endToken, 'BreakKeyword'); + } + } +}; + + +exports.getIndentEdges = function(node) { + return { + startToken: node.startToken, + // we need to get the next token because `default` might end with a `}` + // (ie. IfStatement) we also need to search for next `case` or `}` or + // `break` or `default` to make sure comments are included inside the range + endToken: _tk.findNext(node.endToken, ['}', 'case', 'break', 'default']).prev + }; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/SwitchStatement.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/SwitchStatement.js new file mode 100644 index 00000000..aac2329d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/SwitchStatement.js @@ -0,0 +1,27 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _limit = require('../limit'); + + +exports.format = function SwitchStatement(node) { + var opening = _tk.findPrev(node.discriminant.startToken, '('); + var closing = _tk.findNext(node.discriminant.endToken, ')'); + var openingBrace = _tk.findNext(closing, '{'); + var closingBrace = node.endToken; + + _limit.around(openingBrace, 'SwitchOpeningBrace'); + _limit.around(closingBrace, 'SwitchClosingBrace'); + _limit.around(opening, 'SwitchDiscriminantOpening'); + _limit.around(closing, 'SwitchDiscriminantClosing'); + + // cases are handled by SwitchCase hook! +}; + + +exports.getIndentEdges = function(node) { + return { + startToken: _tk.findNext(node.discriminant.endToken, '{'), + endToken: node.endToken + }; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ThrowStatement.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ThrowStatement.js new file mode 100644 index 00000000..6d2f90ae --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/ThrowStatement.js @@ -0,0 +1,8 @@ +"use strict"; + +var _ws = require('rocambole-whitespace'); + + +exports.format = function ThrowStatement(node) { + _ws.limit(node.startToken, 'ThrowKeyword'); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/TryStatement.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/TryStatement.js new file mode 100644 index 00000000..0af5b6da --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/TryStatement.js @@ -0,0 +1,44 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _limit = require('../limit'); + + +exports.format = function TryStatement(node) { + var finalizer = node.finalizer; + if (finalizer) { + var finallyKeyword = _tk.findPrev(finalizer.startToken, 'finally'); + _limit.around(finallyKeyword, 'FinallyKeyword'); + _limit.around(finalizer.startToken, 'FinallyOpeningBrace'); + _limit.around(finalizer.endToken, 'FinallyClosingBrace'); + + if (!finalizer.body.length && !containsCommentsInside(finalizer)) { + // XXX: empty body, so we should remove all white spaces + _tk.removeEmptyInBetween(finalizer.startToken, finalizer.endToken); + } + } + + // CatchClause is handled by its own hook + + _limit.around(node.startToken, 'TryKeyword'); + _limit.around(node.block.startToken, 'TryOpeningBrace'); + _limit.around(node.block.endToken, 'TryClosingBrace'); +}; + + +function containsCommentsInside(node) { + return !!_tk.findInBetween(node.startToken, node.endToken, _tk.isComment); +} + + +exports.getIndentEdges = function(node) { + var edges = [node.block]; + + if (node.finalizer) { + edges.push(node.finalizer); + } + + // CatchClause is handled by it's own node (automatically) + + return edges; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/UnaryExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/UnaryExpression.js new file mode 100644 index 00000000..af2bcd03 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/UnaryExpression.js @@ -0,0 +1,22 @@ +"use strict"; + +var _br = require('rocambole-linebreak'); +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); + + +exports.format = function UnaryExpression(node) { + if (node.operator === 'delete') { + _ws.limitAfter(node.startToken, 1); + _br.limitBefore(node.startToken, 'DeleteOperator'); + var endToken = node.endToken; + if (_tk.isSemiColon(endToken.next)) { + endToken = endToken.next; + } + _br.limitAfter(endToken, 'DeleteOperator'); + } else if (node.operator === 'typeof' || node.operator === 'void') { + _ws.limitAfter(node.startToken, 1); + } else { + _ws.limit(node.startToken, 'UnaryExpressionOperator'); + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/UpdateExpression.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/UpdateExpression.js new file mode 100644 index 00000000..140e1a8d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/UpdateExpression.js @@ -0,0 +1,8 @@ +"use strict"; + +var _tk = require('rocambole-token'); + +exports.format = function UpdateExpression(node) { + // XXX: should never have spaces or line breaks before/after "++" and "--"! + _tk.removeEmptyInBetween(node.startToken, node.endToken); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/VariableDeclaration.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/VariableDeclaration.js new file mode 100644 index 00000000..6cf51d54 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/VariableDeclaration.js @@ -0,0 +1,70 @@ +"use strict"; + +var _br = require('rocambole-linebreak'); +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); + + +exports.format = function VariableDeclaration(node) { + var insideFor = node.parent.type === 'ForStatement'; + + node.declarations.forEach(function(declarator, i) { + var idStartToken = declarator.id.startToken; + + // need to swap comma-first line break + var prevNonEmpty = _tk.findPrevNonEmpty(idStartToken); + if (i && prevNonEmpty.value === ',') { + if (_tk.isBr(prevNonEmpty.prev) || _tk.isBr(prevNonEmpty.prev.prev)) { + var beforeComma = _tk.findPrev(prevNonEmpty, function(t) { + return !_tk.isEmpty(t) && !_tk.isComment(t); + }); + _ws.limit(prevNonEmpty, 0); + _tk.remove(prevNonEmpty); + _tk.after(beforeComma, prevNonEmpty); + } + } + + if (!i && !_tk.isComment(_tk.findPrevNonEmpty(idStartToken))) { + // XXX: we don't allow line breaks or multiple spaces after "var" + // keyword for now (might change in the future) + _tk.removeEmptyAdjacentBefore(idStartToken); + } else if (!insideFor && declarator.init) { + _br.limit(idStartToken, 'VariableName'); + } + _ws.limitBefore(idStartToken, 'VariableName'); + + if (declarator.init) { + _ws.limitAfter(declarator.id.endToken, 'VariableName'); + var equalSign = _tk.findNext(declarator.id.endToken, '='); + var valueStart = _tk.findNextNonEmpty(equalSign); + _br.limitBefore(valueStart, 'VariableValue'); + _ws.limitBefore(valueStart, 'VariableValue'); + _br.limitAfter(declarator.endToken, 'VariableValue'); + _ws.limitAfter(declarator.endToken, 'VariableValue'); + } + }); + + // always add a space after the "var" keyword + _ws.limitAfter(node.startToken, 1); +}; + + +exports.getIndentEdges = function(node, opts) { + var edges = []; + + if (opts.MultipleVariableDeclaration && node.declarations.length > 1) { + edges.push(node); + } + + node.declarations.forEach(function(declaration) { + var init = declaration.init; + if (init && opts['VariableDeclaration.' + init.type]) { + edges.push({ + startToken: init.startToken, + endToken: init.endToken.next || node.endToken + }); + } + }); + + return edges; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/WhileStatement.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/WhileStatement.js new file mode 100644 index 00000000..9f20f7e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/WhileStatement.js @@ -0,0 +1,44 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _limit = require('../limit'); + + +exports.format = function WhileStatement(node) { + var conditionalStart = _tk.findNext(node.startToken, '('); + var conditionalEnd = _tk.findPrev(node.body.startToken, ')'); + + _limit.around(conditionalStart, 'WhileStatementConditionalOpening'); + + if (node.body.type === 'BlockStatement') { + var bodyStart = node.body.startToken; + var bodyEnd = node.body.endToken; + _limit.around(bodyStart, 'WhileStatementOpeningBrace'); + _limit.around(bodyEnd, 'WhileStatementClosingBrace'); + _limit.around(conditionalEnd, 'WhileStatementConditionalClosing'); + } else { + var next = _tk.findNextNonEmpty(conditionalEnd); + _limit.before(conditionalEnd, 'WhileStatementConditionalClosing'); + if (_tk.isSemiColon(next)) { + _limit.after(conditionalEnd, 0); + } else { + _limit.after(conditionalEnd, 'WhileStatementConditionalClosing'); + } + } +}; + + +exports.getIndentEdges = function(node) { + var edges = [ + { + startToken: _tk.findNext(node.startToken, '('), + endToken: _tk.findPrev(node.body.startToken, ')') + } + ]; + + if (node.body.type !== 'EmptyStatement') { + edges.push(node.body); + } + + return edges; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/expressionParentheses.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/expressionParentheses.js new file mode 100644 index 00000000..128a0f3f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/hooks/expressionParentheses.js @@ -0,0 +1,106 @@ +"use strict"; + +var _tk = require('rocambole-token'); +var _ws = require('rocambole-whitespace'); +var debug = require('debug')('esformatter:parentheses'); + + +exports.addSpaceInside = addSpaceInsideExpressionParentheses; +function addSpaceInsideExpressionParentheses(node) { + var parentheses = getParentheses(node); + if (parentheses) { + _ws.limitAfter(parentheses.opening, 'ExpressionOpeningParentheses'); + _ws.limitBefore(parentheses.closing, 'ExpressionClosingParentheses'); + } +} + + +exports.getParentheses = getParentheses; +function getParentheses(node) { + if (!isValidExpression(node)) { + debug('not valid expression: %s', node.type); + return; + } + + var opening = node.startToken; + if (/^(?:Binary|Logical)Expression$/.test(node.type) || opening.value !== '(') { + opening = _tk.findPrevNonEmpty(opening); + } + + if (!opening || opening.value !== '(') { + // "safe" to assume it is not inside parentheses + debug( + 'opening is not a parentheses; type: %s, opening: "%s"', + node.type, + opening && opening.value + ); + return; + } + + var token = opening; + var count = 0; + var closing; + + while(token) { + if (token.value === '(') { + count += 1; + } else if (token.value === ')') { + count -= 1; + } + if (count === 0) { + closing = token; + break; + } + token = token.next; + } + + if (!closing) { + debug('not inside parentheses', count); + return; + } + + debug( + 'found parentheses; type: %s, opening: "%s", closing: "%s"', + node.type, + opening && opening.value, + closing && closing.value + ); + + return { + opening: opening, + closing: closing + }; +} + +// Literal when inside BinaryExpression might be surrounded by parenthesis +// CallExpression and ArrayExpression don't need spaces +var needExpressionParenthesesSpaces = { + Literal: true, + CallExpression: false, + FunctionExpression: false, + ArrayExpression: false, + ObjectExpression: false, + // Special is used when we need to override default behavior + Special: true +}; + + +function isValidExpression(node) { + var needSpaces = needExpressionParenthesesSpaces[node.type]; + + if (needSpaces) { + return true; + } + + if (needSpaces == null && node.type.indexOf('Expression') !== -1) { + if (node.type === 'ExpressionStatement' && + (node.expression.callee && node.expression.callee.type === 'FunctionExpression')) { + // bypass IIFE + return false; + } + return true; + } + + return false; +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/indent.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/indent.js new file mode 100644 index 00000000..42cdee73 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/indent.js @@ -0,0 +1,99 @@ +"use strict"; + +var rocambole = require('rocambole'); +var indent = require('rocambole-indent'); +var debug = require('debug')('esformatter:indent'); +var hooks = require('./hooks'); + +// --- + + +var _opts; + +// this hash table is used to map special node types (used only for +// indentation) into the real hooks +var _specialTypes = { + 'VariableDeclaration': 'MultipleVariableDeclaration' +}; + + +// --- + + +exports.setOptions = setOptions; +function setOptions(opts){ + _opts = opts; + indent.setOptions(opts); +} + + +// transform AST in place +exports.transform = transform; +function transform(ast) { + rocambole.walk(ast, transformNode); + indent.sanitize(ast); + if (_opts.AlignComments) { + indent.alignComments(ast); + } + return ast; +} + + +function transformNode(node) { + var indentLevel = getIndentLevel(node); + if (indentLevel) { + var type = node.type; + var edges; + + if (type in hooks && hooks[type].getIndentEdges) { + edges = hooks[type].getIndentEdges(node, _opts); + // for some nodes we might decide that they should not be indented + // (complex rules based on context) + if (!edges) { + debug('[transformNode]: hook returned no edges'); + return; + } + } else { + edges = node; + } + + debug( + '[transformNode] type: %s, edges: "%s", "%s"', + node.type, + edges && edges.startToken && edges.startToken.value, + edges && edges.endToken && edges.endToken.value + ); + + // some complex nodes like IfStatement contains multiple sub-parts that + // should be indented, so we allow an Array of edges as well + if (Array.isArray(edges)) { + edges.forEach(function(edge) { + if (!edge) { + // to simplify the logic we allow empty/falsy values on the edges + // array, that way we can use same logic for single/multiple edges + return; + } + indentEdge(edge, indentLevel); + }); + } else { + indentEdge(edges, indentLevel); + } + } +} + + +function indentEdge(edge, level) { + indent.inBetween(edge.startToken, edge.endToken, edge.level || level); +} + + +function getIndentLevel(node) { + var value = _opts[node.type]; + debug('[getIndentLevel] type: %s, value: %s', node.type, value); + if (node.type in _specialTypes) { + value = value || _opts[_specialTypes[node.type]]; + debug('[specialNodeType] indent: %s', value); + } + return value; +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/limit.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/limit.js new file mode 100644 index 00000000..56a8ef41 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/limit.js @@ -0,0 +1,27 @@ +'use strict'; + +// limit amount of consecutive white spaces and line breaks adjacent to a given +// token. + +var _br = require('rocambole-linebreak'); +var _ws = require('rocambole-whitespace'); + +exports.before = limitBefore; +function limitBefore(token, typeOrValue) { + _br.limitBefore(token, typeOrValue); + _ws.limitBefore(token, typeOrValue); +} + + +exports.after = limitAfter; +function limitAfter(token, typeOrValue) { + _br.limitAfter(token, typeOrValue); + _ws.limitAfter(token, typeOrValue); +} + + +exports.around = limitAround; +function limitAround(token, typeOrValue) { + _br.limit(token, typeOrValue); + _ws.limit(token, typeOrValue); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/lineBreakAroundNode.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/lineBreakAroundNode.js new file mode 100644 index 00000000..aea45ade --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/lineBreakAroundNode.js @@ -0,0 +1,115 @@ +'use strict'; + +// this module is used for automatic line break around nodes. + + +var _tk = require('rocambole-token'); +var _br = require('rocambole-linebreak'); +var debugAround = require('debug')('esformatter:br:around'); + + +// --- + + +module.exports = aroundNodeIfNeeded; +function aroundNodeIfNeeded(node) { + var shouldLimit = shouldLimitLineBreakAroundNode(node); + debugAround('[aroundNodeIfNeeded] type: %s, shouldLimit: %s, ', node.type, shouldLimit); + if (!shouldLimit) return; + + var type = node.type; + _br.limitBefore(node.startToken, type); + + if (_tk.isSemiColon(node.endToken)) { + _br.limitAfter(node.endToken, type); + } +} + + + +// tokens that only break line for special reasons +var CONTEXTUAL_LINE_BREAK = { + AssignmentExpression: 1, + ConditionalExpression: 1, + CallExpression: 1, + ExpressionStatement: 1, + SequenceExpression: 1, + LogicalExpression: 1, + VariableDeclaration: 1 +}; + +// bypass automatic line break of direct child +var BYPASS_CHILD_LINE_BREAK = { + CallExpression: 1, + DoWhileStatement: 1, + IfStatement: 1, + WhileStatement: 1, + ForStatement: 1, + ForInStatement: 1, + ReturnStatement: 1, + ThrowStatement: 1 +}; + +// add line break only if great parent is one of these +var CONTEXTUAL_LINE_BREAK_GREAT_PARENTS = { + Program: 1, + BlockStatement: 1, + IfStatement: 1, + FunctionExpression: 1 +}; + +function shouldLimitLineBreakAroundNode(node) { + + if (node.parent) { + // EmptyStatement shouldn't cause line breaks by default since user might + // be using asi and it's common to add it to begin of line when needed + if (node.parent.prev && + node.parent.prev.type === 'EmptyStatement') { + return false; + } + // it is on root it should cause line breaks + if (node.parent.type === 'Program') { + return true; + } + // if inside "if" test we change the rules since you probaly don't + // want to change the line break of the input ("test" can contain + // AssignmentExpression, SequenceExpression, BinaryExpression, ...) + if (isInsideIfTest(node)) { + return false; + } + } + + if (!(node.type in CONTEXTUAL_LINE_BREAK)) { + return true; + } + if (node.parent.type in BYPASS_CHILD_LINE_BREAK) { + return false; + } + + // iife + if (node.type === 'CallExpression' && + node.callee.type === 'FunctionExpression') { + return false; + } + + var gp = node.parent.parent; + if (gp && gp.type in CONTEXTUAL_LINE_BREAK_GREAT_PARENTS) { + return true; + } + + return false; +} + + +function isInsideIfTest(node) { + if (node.parent && node.parent.type === 'IfStatement') { + return node === node.parent.test; + } + // we don't check further than great parent since it's "expensive" and we + // consider it as an edge case (you probably should not have too much logic + // inside the "test") + var greatParent = node.parent && node.parent.parent; + return greatParent && greatParent.type === 'IfStatement' && + node.parent === greatParent.test; +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/options.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/options.js new file mode 100644 index 00000000..6acc957f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/options.js @@ -0,0 +1,161 @@ +"use strict"; + +var stripJsonComments = require('strip-json-comments'); +var fs = require('fs'); +var path = require('path'); + +var _ws = require('rocambole-whitespace'); +var _br = require('rocambole-linebreak'); +var indent = require('./indent'); +var plugins = require('./plugins'); + +var deepMixIn = require('mout/object/deepMixIn'); +var merge = require('mout/object/merge'); +var get = require('mout/object/get'); +var isObject = require('mout/lang/isObject'); + + +// --- + +var _curOpts; + +// --- + +exports.presets = { + 'default': require('./preset/default.json'), + 'jquery' : require('./preset/jquery.json') +}; + + +exports.set = function(opts) { + var preset = opts && opts.preset ? opts.preset : 'default'; + // we need to pass all the user settings and default settings to the plugins + // so they are able to toggle the behavior and make changes based on the + // options + _curOpts = mergeOptions(preset, opts); + + _ws.setOptions(_curOpts.whiteSpace); + _br.setOptions(_curOpts.lineBreak); + indent.setOptions(_curOpts.indent); + plugins.setOptions(_curOpts); + + // user provided options should override default settings and also any + // changes made by plugins + if (opts) { + _curOpts = deepMixIn(_curOpts, opts); + } +}; + + +function mergeOptions(preset, opts){ + if (!(preset in exports.presets)) { + throw new Error('Invalid preset file "' + preset + '".'); + } + var baseOpts = exports.presets[preset]; + // recursively merge options to allow a "prototype chain" + if (baseOpts.preset) { + baseOpts = mergeOptions(baseOpts.preset, baseOpts); + } + return merge({}, baseOpts, opts); +} + + +exports.get = function(prop) { + return prop ? get(_curOpts, prop) : _curOpts; +}; + + +exports.getRc = getRc; +function getRc(filePath, customOptions) { + // if user sets the "preset" we don't load any other config file + // we assume the "preset" overrides any user settings + if (isTopLevel(customOptions)) { + return customOptions; + } + + if (isObject(filePath)) { + customOptions = filePath; + filePath = null; + } + // we search for config file starting from source directory or from cwd if + // path is not provided + var basedir = filePath ? path.dirname(filePath) : process.cwd(); + var cwd = process.cwd(); + var rc = findAndMergeConfigs(basedir); + if (!rc && basedir !== cwd) { + rc = findAndMergeConfigs(cwd); + } + return merge(rc || getGlobalConfig(), customOptions); +} + + +function findAndMergeConfigs(basedir) { + if (!basedir || !basedir.length) return; + + var configFiles = ['.esformatter', 'package.json']; + var config; + + configFiles.some(function(name) { + var filePath = path.join(basedir, name); + if (!fs.existsSync(filePath)) return; + + var cur = loadAndParseConfig(filePath); + if (name === 'package.json') { + cur = cur.esformatter; + } + + if (!cur) return; + + // we merge configs on same folder as well just in case user have + // ".esformatter" and "package.json" on same folder + // notice that ".esformatter" file takes precedence and will override the + // "package.json" settings. + config = config ? merge(cur, config) : cur; + + // stop the loop + if (isTopLevel(config)) return true; + }); + + if (isTopLevel(config)) { + return config; + } + + // we merge configs from parent folders so it's easier to add different rules + // for each folder on a project and/or override just specific settings + var parentDir = path.resolve(basedir, '..'); + // we need to check if parentDir is different from basedir to avoid conflicts + // on windows (see #174) + var parentConfig = parentDir && parentDir !== basedir ? + findAndMergeConfigs(parentDir) : + {}; + // notice that current folder config overrides the parent folder config + return merge(parentConfig, config); +} + + +function isTopLevel(config) { + // if config contains 'root:true' or inherit from another "preset" we + // consider it as top-level and don't merge the settings with config files on + // parent folders. + return config && (config.root || config.preset); +} + + +function getGlobalConfig() { + var home = process.platform === 'win32' ? process.env.USERPROFILE : process.env.HOME; + var file = path.join(home, '.esformatter'); + return fs.existsSync(file) ? loadAndParseConfig(file) : {}; +} + + +exports.loadAndParseConfig = loadAndParseConfig; +function loadAndParseConfig(file) { + try { + return JSON.parse(stripJsonComments(fs.readFileSync(file).toString())); + } catch (ex) { + console.error('Can\'t parse configuration file: "' + file + '"\nException: ' + ex.message); + process.exit(1); + } +} + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/pipe.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/pipe.js new file mode 100644 index 00000000..71733083 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/pipe.js @@ -0,0 +1,17 @@ +"use strict"; + +var npmRun = require('npm-run').sync; + +// --- + +// run cli tools in series passing the stdout of previous tool as stdin of next +// one +exports.run = run; +function run(commands, input) { + if (!commands) { + return input; + } + return commands.reduce(function(input, cmd) { + return npmRun(cmd, { input: input }); + }, input); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/plugins.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/plugins.js new file mode 100644 index 00000000..0436a821 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/plugins.js @@ -0,0 +1,80 @@ +"use strict"; + +var partial = require('mout/function/partial'); +var remove = require('mout/array/remove'); + +var _plugins = []; + + +exports.register = register; +function register(plugin) { + if (_plugins.indexOf(plugin) === -1) { + _plugins.push(plugin); + } +} + + +exports.unregister = partial(remove, _plugins); + + +exports.unregisterAll = unregisterAll; +function unregisterAll() { + _plugins = []; +} + + +exports.setOptions = function(opts) { + loadAndRegister(opts && opts.plugins); + exec('setOptions', opts); +}; + + +exports.loadAndRegister = loadAndRegister; +function loadAndRegister(ids) { + ids = ids || []; + ids.forEach(function(id) { + register(require(id)); + }); +} + + +exportMethods([ + 'tokenBefore', + 'tokenAfter', + 'nodeBefore', + 'nodeAfter', + // "transform" is an alias to "transformAfter" but we do not recommend using + // it going forward. it might be deprecated in the future. + 'transform', + 'transformAfter', + 'transformBefore' +], exec); + +exportMethods([ + 'stringBefore', + 'stringAfter' +], pipe); + + +function exportMethods(arr, fn) { + arr.forEach(function(methodName) { + exports[methodName] = partial(fn, methodName); + }); +} + + +function exec(methodName) { + var args = Array.prototype.slice.call(arguments, 1); + _plugins.forEach(function(plugin){ + if (methodName in plugin) { + plugin[methodName].apply(plugin, args); + } + }); +} + + +function pipe(methodName, input) { + return _plugins.reduce(function(output, plugin) { + return methodName in plugin ? plugin[methodName](output) : output; + }, input); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/preset/default.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/preset/default.json new file mode 100644 index 00000000..fca58ec0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/preset/default.json @@ -0,0 +1,364 @@ +{ + "esformatter": { + "allowShebang": true + }, + + "indent" : { + "value": " ", + "AlignComments": true, + + "ArrayExpression": 1, + "ArrowFunctionExpression": 1, + "AssignmentExpression": 1, + "AssignmentExpression.BinaryExpression": 1, + "AssignmentExpression.LogicalExpression": 1, + "CallExpression": 1, + "CallExpression.BinaryExpression": 1, + "CallExpression.LogicalExpression": 1, + "CatchClause": 1, + "ConditionalExpression": 1, + "CommentInsideEmptyBlock": 1, + "ClassDeclaration": 1, + "DoWhileStatement": 1, + "ForInStatement": 1, + "ForStatement": 1, + "FunctionDeclaration": 1, + "FunctionExpression": 1, + "IfStatement": 1, + "MemberExpression": 1, + "MultipleVariableDeclaration": 1, + "NewExpression": 1, + "ObjectExpression": 1, + "ObjectExpression.BinaryExpression": 1, + "ObjectExpression.LogicalExpression": 1, + "ParameterList": 1, + "ReturnStatement": 1, + "SwitchCase": 1, + "SwitchStatement": 1, + "TopLevelFunctionBlock": 1, + "TryStatement": 1, + "VariableDeclaration.BinaryExpression": 1, + "VariableDeclaration.LogicalExpression": 1, + "WhileStatement": 1 + }, + + + "lineBreak" : { + "value" : "\n", + + "before" : { + "AssignmentExpression" : ">=1", + "AssignmentOperator": 0, + "ArrowFunctionExpressionArrow": 0, + "ArrowFunctionExpressionOpeningBrace": 0, + "ArrowFunctionExpressionClosingBrace": ">=1", + "BlockStatement" : 0, + "BreakKeyword": ">=1", + "CallExpression" : -1, + "CallExpressionOpeningParentheses" : 0, + "CallExpressionClosingParentheses" : -1, + "ClassDeclaration" : ">=1", + "ClassDeclarationOpeningBrace" : 0, + "ClassDeclarationClosingBrace" : ">=1", + "ConditionalExpression" : ">=1", + "CatchOpeningBrace" : 0, + "CatchClosingBrace" : ">=1", + "CatchKeyword": 0, + "DeleteOperator" : ">=1", + "DoWhileStatement" : ">=1", + "DoWhileStatementOpeningBrace" : 0, + "DoWhileStatementClosingBrace" : ">=1", + "EndOfFile" : -1, + "EmptyStatement" : -1, + "FinallyKeyword" : -1, + "FinallyOpeningBrace" : 0, + "FinallyClosingBrace" : ">=1", + "ForInStatement" : ">=1", + "ForInStatementExpressionOpening" : 0, + "ForInStatementExpressionClosing" : 0, + "ForInStatementOpeningBrace" : 0, + "ForInStatementClosingBrace" : ">=1", + "ForStatement" : ">=1", + "ForStatementExpressionOpening" : 0, + "ForStatementExpressionClosing" : "<2", + "ForStatementOpeningBrace" : 0, + "ForStatementClosingBrace" : ">=1", + "FunctionExpression" : -1, + "FunctionExpressionOpeningBrace" : 0, + "FunctionExpressionClosingBrace" : ">=1", + "FunctionDeclaration" : ">=1", + "FunctionDeclarationOpeningBrace" : 0, + "FunctionDeclarationClosingBrace" : ">=1", + "IIFEClosingParentheses" : 0, + "IfStatement" : ">=1", + "IfStatementOpeningBrace" : 0, + "IfStatementClosingBrace" : ">=1", + "ElseIfStatement" : 0, + "ElseIfStatementOpeningBrace" : 0, + "ElseIfStatementClosingBrace" : ">=1", + "ElseStatement" : 0, + "ElseStatementOpeningBrace" : 0, + "ElseStatementClosingBrace" : ">=1", + "LogicalExpression" : -1, + "MethodDefinition": ">=1", + "ObjectExpressionClosingBrace" : ">=1", + "ParameterDefault" : 0, + "Property" : ">=1", + "ReturnStatement" : -1, + "SwitchOpeningBrace" : 0, + "SwitchClosingBrace" : ">=1", + "ThisExpression" : -1, + "ThrowStatement" : ">=1", + "TryKeyword": -1, + "TryOpeningBrace" : 0, + "TryClosingBrace" : ">=1", + "VariableName" : ">=1", + "VariableValue" : 0, + "VariableDeclaration" : ">=1", + "VariableDeclarationWithoutInit" : ">=1", + "WhileStatement" : ">=1", + "WhileStatementOpeningBrace" : 0, + "WhileStatementClosingBrace" : ">=1" + }, + + "after" : { + "AssignmentExpression" : ">=1", + "AssignmentOperator" : 0, + "ArrowFunctionExpressionArrow": 0, + "ArrowFunctionExpressionOpeningBrace": ">=1", + "ArrowFunctionExpressionClosingBrace": -1, + "BlockStatement" : 0, + "BreakKeyword": -1, + "CallExpression" : -1, + "CallExpressionOpeningParentheses" : -1, + "CallExpressionClosingParentheses" : -1, + "ClassDeclaration" : ">=1", + "ClassDeclarationOpeningBrace" : ">=1", + "ClassDeclarationClosingBrace" : ">=1", + "CatchOpeningBrace" : ">=1", + "CatchClosingBrace" : ">=0", + "CatchKeyword": 0, + "ConditionalExpression" : ">=1", + "DeleteOperator" : ">=1", + "DoWhileStatement" : ">=1", + "DoWhileStatementOpeningBrace" : ">=1", + "DoWhileStatementClosingBrace" : 0, + "EmptyStatement" : -1, + "FinallyKeyword" : -1, + "FinallyOpeningBrace" : ">=1", + "FinallyClosingBrace" : ">=1", + "ForInStatement" : ">=1", + "ForInStatementExpressionOpening" : "<2", + "ForInStatementExpressionClosing" : -1, + "ForInStatementOpeningBrace" : ">=1", + "ForInStatementClosingBrace" : ">=1", + "ForStatement" : ">=1", + "ForStatementExpressionOpening" : "<2", + "ForStatementExpressionClosing" : -1, + "ForStatementOpeningBrace" : ">=1", + "ForStatementClosingBrace" : ">=1", + "FunctionExpression" : ">=1", + "FunctionExpressionOpeningBrace" : ">=1", + "FunctionExpressionClosingBrace" : -1, + "FunctionDeclaration" : ">=1", + "FunctionDeclarationOpeningBrace" : ">=1", + "FunctionDeclarationClosingBrace" : ">=1", + "IIFEOpeningParentheses" : 0, + "IfStatement" : ">=1", + "IfStatementOpeningBrace" : ">=1", + "IfStatementClosingBrace" : ">=1", + "ElseIfStatement" : ">=1", + "ElseIfStatementOpeningBrace" : ">=1", + "ElseIfStatementClosingBrace" : ">=1", + "ElseStatement" : ">=1", + "ElseStatementOpeningBrace" : ">=1", + "ElseStatementClosingBrace" : ">=1", + "LogicalExpression" : -1, + "MethodDefinition": ">=1", + "ObjectExpressionOpeningBrace" : ">=1", + "ParameterDefault" : 0, + "Property" : 0, + "ReturnStatement" : -1, + "SwitchOpeningBrace" : ">=1", + "SwitchClosingBrace" : ">=1", + "ThisExpression" : 0, + "ThrowStatement" : ">=1", + "TryKeyword": -1, + "TryOpeningBrace" : ">=1", + "TryClosingBrace" : 0, + "VariableDeclaration" : ">=1", + "WhileStatement" : ">=1", + "WhileStatementOpeningBrace" : ">=1", + "WhileStatementClosingBrace" : ">=1" + } + }, + + + "whiteSpace" : { + "value" : " ", + "removeTrailing" : 1, + + "before" : { + "ArrayExpressionOpening" : 0, + "ArrayExpressionClosing" : 0, + "ArrayExpressionComma" : 0, + "ArrowFunctionExpressionArrow": 1, + "ArrowFunctionExpressionOpeningBrace": 1, + "ArrowFunctionExpressionClosingBrace": 0, + "ArgumentComma" : 0, + "ArgumentList" : 0, + "AssignmentOperator" : 1, + "BinaryExpression": 0, + "BinaryExpressionOperator" : 1, + "BlockComment" : 1, + "CallExpression" : -1, + "CallExpressionOpeningParentheses" : 0, + "CallExpressionClosingParentheses" : -1, + "CatchParameterList" : 0, + "CatchOpeningBrace" : 1, + "CatchClosingBrace" : 1, + "CatchKeyword" : 1, + "CommaOperator" : 0, + "ClassDeclarationOpeningBrace" : 1, + "ClassDeclarationClosingBrace" : 1, + "ConditionalExpressionConsequent" : 1, + "ConditionalExpressionAlternate" : 1, + "DoWhileStatementOpeningBrace" : 1, + "DoWhileStatementClosingBrace" : 1, + "DoWhileStatementConditional" : 1, + "EmptyStatement" : 0, + "ExpressionClosingParentheses" : 0, + "FinallyKeyword" : -1, + "FinallyOpeningBrace" : 1, + "FinallyClosingBrace" : 1, + "ForInStatement" : 1, + "ForInStatementExpressionOpening" : 1, + "ForInStatementExpressionClosing" : 0, + "ForInStatementOpeningBrace" : 1, + "ForInStatementClosingBrace" : 1, + "ForStatement" : 1, + "ForStatementExpressionOpening" : 1, + "ForStatementExpressionClosing" : 0, + "ForStatementOpeningBrace" : 1, + "ForStatementClosingBrace" : 1, + "ForStatementSemicolon" : 0, + "FunctionDeclarationOpeningBrace" : 1, + "FunctionDeclarationClosingBrace" : 1, + "FunctionExpressionOpeningBrace" : 1, + "FunctionExpressionClosingBrace" : 1, + "FunctionName" : 1, + "IIFEClosingParentheses" : 0, + "IfStatementConditionalOpening" : 1, + "IfStatementConditionalClosing" : 0, + "IfStatementOpeningBrace" : 1, + "IfStatementClosingBrace" : 1, + "ElseStatementOpeningBrace" : 1, + "ElseStatementClosingBrace" : 1, + "ElseIfStatementOpeningBrace" : 1, + "ElseIfStatementClosingBrace" : 1, + "MemberExpressionClosing" : 0, + "LineComment" : 1, + "LogicalExpressionOperator" : 1, + "Property" : 1, + "PropertyValue" : 1, + "ParameterComma" : 0, + "ParameterDefault" : 1, + "ParameterList" : 0, + "SwitchDiscriminantOpening" : 1, + "SwitchDiscriminantClosing" : 0, + "ThrowKeyword": 1, + "TryKeyword": -1, + "TryOpeningBrace" : 1, + "TryClosingBrace" : 1, + "UnaryExpressionOperator": 0, + "VariableName" : 1, + "VariableValue" : 1, + "WhileStatementConditionalOpening" : 1, + "WhileStatementConditionalClosing" : 0, + "WhileStatementOpeningBrace" : 1, + "WhileStatementClosingBrace" : 1 + }, + + "after" : { + "ArrayExpressionOpening" : 0, + "ArrayExpressionClosing" : 0, + "ArrayExpressionComma" : 1, + "ArrowFunctionExpressionArrow": 1, + "ArrowFunctionExpressionOpeningBrace": 0, + "ArrowFunctionExpressionClosingBrace": 0, + "ArgumentComma" : 1, + "ArgumentList" : 0, + "AssignmentOperator" : 1, + "BinaryExpression": 0, + "BinaryExpressionOperator" : 1, + "BlockComment" : 1, + "CallExpression" : -1, + "CallExpressionOpeningParentheses" : -1, + "CallExpressionClosingParentheses" : -1, + "CatchParameterList" : 0, + "CatchOpeningBrace" : 1, + "CatchClosingBrace" : 1, + "CatchKeyword" : 1, + "ClassDeclarationOpeningBrace" : 1, + "ClassDeclarationClosingBrace" : 1, + "CommaOperator" : 1, + "ConditionalExpressionConsequent" : 1, + "ConditionalExpressionTest" : 1, + "DoWhileStatementOpeningBrace" : 1, + "DoWhileStatementClosingBrace" : 1, + "DoWhileStatementBody" : 1, + "EmptyStatement" : 0, + "ExpressionOpeningParentheses" : 0, + "FinallyKeyword" : -1, + "FinallyOpeningBrace" : 1, + "FinallyClosingBrace" : 1, + "ForInStatement" : 1, + "ForInStatementExpressionOpening" : 0, + "ForInStatementExpressionClosing" : 1, + "ForInStatementOpeningBrace" : 1, + "ForInStatementClosingBrace" : 1, + "ForStatement" : 1, + "ForStatementExpressionOpening" : 0, + "ForStatementExpressionClosing" : 1, + "ForStatementClosingBrace" : 1, + "ForStatementOpeningBrace" : 1, + "ForStatementSemicolon" : 1, + "FunctionReservedWord": 0, + "FunctionName" : 0, + "FunctionExpressionOpeningBrace" : 1, + "FunctionExpressionClosingBrace" : 0, + "FunctionDeclarationOpeningBrace" : 1, + "FunctionDeclarationClosingBrace" : 1, + "IIFEOpeningParentheses" : 0, + "IfStatementConditionalOpening" : 0, + "IfStatementConditionalClosing" : 1, + "IfStatementOpeningBrace" : 1, + "IfStatementClosingBrace" : 1, + "ElseStatementOpeningBrace" : 1, + "ElseStatementClosingBrace" : 1, + "ElseIfStatementOpeningBrace" : 1, + "ElseIfStatementClosingBrace" : 1, + "MemberExpressionOpening" : 0, + "LogicalExpressionOperator" : 1, + "ObjectExpressionClosingBrace": 0, + "PropertyName" : 0, + "PropertyValue" : 0, + "ParameterComma" : 1, + "ParameterDefault" : 1, + "ParameterList" : 0, + "SwitchDiscriminantOpening" : 0, + "SwitchDiscriminantClosing" : 1, + "ThrowKeyword": 1, + "TryKeyword": -1, + "TryOpeningBrace" : 1, + "TryClosingBrace" : 1, + "UnaryExpressionOperator": 0, + "VariableName" : 1, + "WhileStatementConditionalOpening" : 0, + "WhileStatementConditionalClosing" : 1, + "WhileStatementOpeningBrace" : 1, + "WhileStatementClosingBrace" : 1 + } + } + +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/preset/jquery.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/preset/jquery.json new file mode 100644 index 00000000..326f6a3d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/lib/preset/jquery.json @@ -0,0 +1,59 @@ +{ + "preset" : "default", + + "indent" : { + "value" : "\t", + "IfStatementConditional": 2, + "SwitchStatement" : 0, + "TopLevelFunctionBlock" : 0 + }, + + "lineBreak" : { + "before" : { + "ObjectExpressionOpeningBrace": -1, + "ObjectExpressionClosingBrace": -1, + "Property": -1, + "VariableDeclarationWithoutInit" : 0 + }, + + "after": { + "AssignmentOperator": -1, + "ObjectExpressionOpeningBrace": -1, + "ObjectExpressionClosingBrace": -1, + "Property": -1 + } + }, + + "whiteSpace" : { + "before" : { + "ArgumentList" : 1, + "ArrayExpressionClosing" : 1, + "CatchParameterList": 1, + "ExpressionClosingParentheses" : 1, + "ForInStatementExpressionClosing" : 1, + "ForStatementExpressionClosing" : 1, + "IfStatementConditionalClosing" : 1, + "IIFEClosingParentheses": 1, + "MemberExpressionClosing" : 1, + "ObjectExpressionClosingBrace": 1, + "ParameterList" : 1, + "SwitchDiscriminantClosing" : 1, + "WhileStatementConditionalClosing" : 1 + }, + "after" : { + "ArgumentList" : 1, + "ArrayExpressionOpening" : 1, + "CatchParameterList": 1, + "ExpressionOpeningParentheses" : 1, + "ForInStatementExpressionOpening" : 1, + "ForStatementExpressionOpening" : 1, + "IfStatementConditionalOpening" : 1, + "IIFEOpeningParentheses": 1, + "MemberExpressionOpening" : 1, + "ParameterList" : 1, + "PropertyValue": -1, + "SwitchDiscriminantOpening" : 1, + "WhileStatementConditionalOpening" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/.bin/npm-run b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/.bin/npm-run new file mode 120000 index 00000000..171ad09a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/.bin/npm-run @@ -0,0 +1 @@ +../npm-run/bin/npm-run.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/.bin/semver b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/.bin/semver new file mode 120000 index 00000000..317eb293 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/.bin/strip-json-comments b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/.bin/strip-json-comments new file mode 120000 index 00000000..63d549f9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/.bin/strip-json-comments @@ -0,0 +1 @@ +../strip-json-comments/cli.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/Readme.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/Readme.md new file mode 100644 index 00000000..c5a34e8b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/Readme.md @@ -0,0 +1,115 @@ +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +``` +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stderr is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + _(NOTE: Debug now uses stderr instead of stdout, so the correct shell command for this example is actually `DEBUG=* node example/worker 2> out &`)_ + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The "*" character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + a('doing some work'); +}, 1200); +``` + +## License + +(The MIT License) + +Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/debug.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/debug.js new file mode 100644 index 00000000..509dc0de --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/debug.js @@ -0,0 +1,137 @@ + +/** + * Expose `debug()` as the module. + */ + +module.exports = debug; + +/** + * Create a debugger with the given `name`. + * + * @param {String} name + * @return {Type} + * @api public + */ + +function debug(name) { + if (!debug.enabled(name)) return function(){}; + + return function(fmt){ + fmt = coerce(fmt); + + var curr = new Date; + var ms = curr - (debug[name] || curr); + debug[name] = curr; + + fmt = name + + ' ' + + fmt + + ' +' + debug.humanize(ms); + + // This hackery is required for IE8 + // where `console.log` doesn't have 'apply' + window.console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); + } +} + +/** + * The currently active debug mode names. + */ + +debug.names = []; +debug.skips = []; + +/** + * Enables a debug mode by name. This can include modes + * separated by a colon and wildcards. + * + * @param {String} name + * @api public + */ + +debug.enable = function(name) { + try { + localStorage.debug = name; + } catch(e){} + + var split = (name || '').split(/[\s,]+/) + , len = split.length; + + for (var i = 0; i < len; i++) { + name = split[i].replace('*', '.*?'); + if (name[0] === '-') { + debug.skips.push(new RegExp('^' + name.substr(1) + '$')); + } + else { + debug.names.push(new RegExp('^' + name + '$')); + } + } +}; + +/** + * Disable debug output. + * + * @api public + */ + +debug.disable = function(){ + debug.enable(''); +}; + +/** + * Humanize the given `ms`. + * + * @param {Number} m + * @return {String} + * @api private + */ + +debug.humanize = function(ms) { + var sec = 1000 + , min = 60 * 1000 + , hour = 60 * min; + + if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; + if (ms >= min) return (ms / min).toFixed(1) + 'm'; + if (ms >= sec) return (ms / sec | 0) + 's'; + return ms + 'ms'; +}; + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +debug.enabled = function(name) { + for (var i = 0, len = debug.skips.length; i < len; i++) { + if (debug.skips[i].test(name)) { + return false; + } + } + for (var i = 0, len = debug.names.length; i < len; i++) { + if (debug.names[i].test(name)) { + return true; + } + } + return false; +}; + +/** + * Coerce `val`. + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} + +// persist + +try { + if (window.localStorage) debug.enable(localStorage.debug); +} catch(e){} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/index.js new file mode 100644 index 00000000..e02c13b7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/index.js @@ -0,0 +1,5 @@ +if ('undefined' == typeof window) { + module.exports = require('./lib/debug'); +} else { + module.exports = require('./debug'); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/lib/debug.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/lib/debug.js new file mode 100644 index 00000000..3b0a9183 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/lib/debug.js @@ -0,0 +1,147 @@ +/** + * Module dependencies. + */ + +var tty = require('tty'); + +/** + * Expose `debug()` as the module. + */ + +module.exports = debug; + +/** + * Enabled debuggers. + */ + +var names = [] + , skips = []; + +(process.env.DEBUG || '') + .split(/[\s,]+/) + .forEach(function(name){ + name = name.replace('*', '.*?'); + if (name[0] === '-') { + skips.push(new RegExp('^' + name.substr(1) + '$')); + } else { + names.push(new RegExp('^' + name + '$')); + } + }); + +/** + * Colors. + */ + +var colors = [6, 2, 3, 4, 5, 1]; + +/** + * Previous debug() call. + */ + +var prev = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Is stdout a TTY? Colored output is disabled when `true`. + */ + +var isatty = tty.isatty(2); + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function color() { + return colors[prevColor++ % colors.length]; +} + +/** + * Humanize the given `ms`. + * + * @param {Number} m + * @return {String} + * @api private + */ + +function humanize(ms) { + var sec = 1000 + , min = 60 * 1000 + , hour = 60 * min; + + if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; + if (ms >= min) return (ms / min).toFixed(1) + 'm'; + if (ms >= sec) return (ms / sec | 0) + 's'; + return ms + 'ms'; +} + +/** + * Create a debugger with the given `name`. + * + * @param {String} name + * @return {Type} + * @api public + */ + +function debug(name) { + function disabled(){} + disabled.enabled = false; + + var match = skips.some(function(re){ + return re.test(name); + }); + + if (match) return disabled; + + match = names.some(function(re){ + return re.test(name); + }); + + if (!match) return disabled; + var c = color(); + + function colored(fmt) { + fmt = coerce(fmt); + + var curr = new Date; + var ms = curr - (prev[name] || curr); + prev[name] = curr; + + fmt = ' \u001b[9' + c + 'm' + name + ' ' + + '\u001b[3' + c + 'm\u001b[90m' + + fmt + '\u001b[3' + c + 'm' + + ' +' + humanize(ms) + '\u001b[0m'; + + console.error.apply(this, arguments); + } + + function plain(fmt) { + fmt = coerce(fmt); + + fmt = new Date().toUTCString() + + ' ' + name + ' ' + fmt; + console.error.apply(this, arguments); + } + + colored.enabled = plain.enabled = true; + + return isatty || process.env.DEBUG_COLORS + ? colored + : plain; +} + +/** + * Coerce `val`. + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/package.json new file mode 100644 index 00000000..65c5936e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/debug/package.json @@ -0,0 +1,64 @@ +{ + "name": "debug", + "version": "0.7.4", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "*" + }, + "main": "lib/debug.js", + "browser": "./debug.js", + "engines": { + "node": "*" + }, + "files": [ + "lib/debug.js", + "debug.js", + "index.js" + ], + "component": { + "scripts": { + "debug/index.js": "index.js", + "debug/debug.js": "debug.js" + } + }, + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@0.7.4", + "dist": { + "shasum": "06e1ea8082c2cb14e39806e22e2f6f757f92af39", + "tarball": "http://registry.npmjs.org/debug/-/debug-0.7.4.tgz" + }, + "_from": "debug@>=0.7.4 <0.8.0", + "_npmVersion": "1.3.13", + "_npmUser": { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + } + ], + "directories": {}, + "_shasum": "06e1ea8082c2cb14e39806e22e2f6f757f92af39", + "_resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", + "readme": "ERROR: No README data found!", + "scripts": {} +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.editorconfig b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.editorconfig new file mode 100644 index 00000000..e036e247 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.editorconfig @@ -0,0 +1,20 @@ +; EditorConfig is awesome: http://EditorConfig.org + +; top-most EditorConfig file +root = true + +; base rules +[*] +end_of_line = lf +insert_final_newline = false +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true + +; The default indent on package.json is 2 spaces, better to keep it so we can +; use `npm install --save` and other features that rewrites the package.json +; file automatically +[package.json] +indent_style = space +indent_size = 2 diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.jshintrc b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.jshintrc new file mode 100644 index 00000000..bbdb29cf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.jshintrc @@ -0,0 +1,69 @@ +{ + // Settings + "passfail" : false, // Stop on first error. + "maxerr" : 50, // Maximum error before stopping. + + + // Predefined globals whom JSHint will ignore. + "browser" : true, // Standard browser globals e.g. `window`, `document`. + "couch" : false, + "dojo" : false, + "jquery" : true, + "mootools" : false, + "node" : false, + "prototypejs" : false, + "rhino" : false, + "wsh" : false, + + // Custom globals. + "predef" : [ + "define", + "require" + ], + + + // Development. + "debug" : false, // Allow debugger statements e.g. browser breakpoints. + "devel" : false, // Allow developments statements e.g. `console.log();`. + + + // EcmaScript 5. + "es5" : false, // Allow EcmaScript 5 syntax. + "globalstrict" : false, // Allow global "use strict" (also enables 'strict'). + "strict" : false, // Require `use strict` pragma in every file. + + + // The Good Parts. + "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons). + "bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.). + "boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. + "curly" : false, // Require {} for every new block or scope. + "eqeqeq" : true, // Require triple equals i.e. `===`. + "eqnull" : true, // Tolerate use of `== null`. + "evil" : false, // Tolerate use of `eval`. + "expr" : false, // Tolerate `ExpressionStatement` as Programs. + "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`. + "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` + "latedef" : false, // Prohibit variable use before definition. + "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. + "loopfunc" : false, // Allow functions to be defined within loops. + "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. + "regexdash" : true, // Tolerate unescaped last dash i.e. `[-...]`. + "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions. + "scripturl" : false, // Tolerate script-targeted URLs. + "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. + "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. + "undef" : false, // Require all non-global variables be declared before they are used. + + + // Personal styling prefrences. + "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. + "noempty" : true, // Prohipit use of empty blocks. + "nomen" : false, // Prohibit use of initial or trailing underbars in names. + "nonew" : true, // Prohibit use of constructors for side-effects. + "onevar" : false, // Allow only one `var` statement per function. + "plusplus" : false, // Prohibit use of `++` & `--`. + "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. + "trailing" : true, // Prohibit trailing whitespaces. + "white" : false // Check against strict whitespace and indentation rules. +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.npmignore new file mode 100644 index 00000000..1341acd9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.npmignore @@ -0,0 +1,30 @@ +# dumb files +# ========== + +.tmp* +.project +.settings/ +.livereload +.DS_Store? +ehthumbs.db +Icon? +Thumbs.db + + +# stuff not needed by node +# ======================== + +node_modules/ +tests/ +_build/ +doc_html/ +coverage/ + +# we keep the doc/ folder in case npm decides to display it in the future +# also good in case user is using an old version or working offline + +# we also keep the src/ folder in case the user still needs the AMD modules +# after build (see issue #102) + +bower.json +build.js diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.travis.yml new file mode 100644 index 00000000..1c6fcf8a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/.travis.yml @@ -0,0 +1,16 @@ + language: node_js + node_js: + - "0.10" + script: + - "npm test --coverage" + - "jshint src" + notifications: + irc: + channels: + - "irc.freenode.org#moutjs" + on_success: change + on_failure: always + use_notice: true + skip_join: true + git: + depth: 10 diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/CHANGELOG.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/CHANGELOG.md new file mode 100644 index 00000000..f4059154 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/CHANGELOG.md @@ -0,0 +1,189 @@ +mout changelog +============== + +v0.11.0 (2014/11/17) +-------------------- + + - add `array/take`; + - remove unused variable from `date/totalDaysInMonth`; + - fix case insensitive RegExp cloning on `lang/clone`; + + +v0.10.0 (2014/09/02) +-------------------- + + - add `array/equals`; + - add `array/groupBy`; + - add `array/last`; + - add `function/wrap`; + - add `lang/GLOBAL`; + - add `lang/isPrimitive`; + - add `number/MAX_SAFE_INTEGER`; + - add `object/omit`; + - add `object/result`; + - add `object/result`; + - add `random/randString`; + - change `lang/isEmpty` behavior to return `true` for any value that isn't + a collection. + - fix `array/findLastIndex` to stop at zero index; + - improve `function/partial` to accept placeholders; + - improve `math.norm` behavior for values outside the range and for cases + where `val === min === max`; + - improve `object/get` behavior to return properties from any value that is + not `null` or `undefined`; + - move `object/deepEquals` to `lang/deepEquals` (improving the behavior); + + +v0.9.1 (2014/04/08) +------------------- + + - fix `array/slice` behavior when start and end are higher than length. + + +v0.9.0 (2014/02/04) +------------------- + + - add `date/quarter`; + - add `function/constant`; + - add `random/randBool`; + - add un-padded 12-hour (`%l`) to `date/strftime`; + - fix `array/slice` on IE < 9 by using a custom implementation. + - fix `object/forIn` iteration for IE < 9 constructor property; + - improve `lang/inheritPrototype` by returning the `prototype`; + - improve `string/removeNonWord` to cover more chars; + - improve `string/repeat` performance; + - improve `string/unescapeHtml` by accepting leading zeros for `'`; + + +v0.8.0 (2013/11/22) +------------------- + + - add `array/findLast`. + - add `array/findLastIndex`. + - add `array/slice` and use it internally. + - add `array/sortBy` + - add `function/awaitDelay`. + - add `function/identity` + - add `number/isNaN`. + - add `number/nth`. + - add `number/ordinal`. + - allows nested replacement patterns in `string/interpolate`. + - change `function/makeIterator_` behavior (uses `identity` by default). + - simplify `string/escapeRegExp`. + - support custom equality on `array/compare`. + + +v0.7.1 (2013/09/18) +------------------- + + - fix `null` value handling in object/get. + + +v0.7.0 (2013/09/05) +------------------- + + - add bower ignores. + - add german translation for date localization. + - alias `function` package as `fn` since "function" is a reserved keyword. + - allow second argument on `array/pick`. + - improve `string/makePath` to not remove "//" after protocol. + - make sure methods inside `number` package works with mixed types. + - support arrays on `queryString/encode`. + - support multiple values for same property on `queryString/decode`. + - add `cancel()` method to `throttled/debounced` functions. + - add `function/times`. + - add `lang/toNumber`. + - add `string/insert`. + - add `super_` to constructor on `lang/inheritPrototype`. + + +v0.6.0 (2013/05/22) +------------------- + + - add optional delimeter to `string/unCamelCase` + - allow custom char on `number/pad` + - allow underscore characters in `string/removeNonWord` + - accept `level` on `array/flatten` instead of a flag + - convert underscores to camelCase in `string/camelCase` + - remove `create()` from number/currencyFormat + - add `date/dayOfTheYear` + - add `date/diff` + - add `date/isSame` + - add `date/startOf` + - add `date/strftime` + - add `date/timezoneAbbr` + - add `date/timezoneOffset` + - add `date/totalDaysInYear` + - add `date/weekOfTheYear` + - add `function/timeout` + - add `object/bindAll` + - add `object/functions` + - add `time/convert` + + +v0.5.0 (2013/04/04) +------------------- + + - add `array/collect` + - add `callback` parameter to `object/equals` and `object/deepEquals` to allow + custom compare operations. + - normalize behavior in `array/*` methods to treat `null` values as empty + arrays when reading from array + - add `date/parseIso` + - add `date/isLeapYear` + - add `date/totalDaysInMonth` + - add `object/deepMatches` + - change `function/makeIterator_` to use `deepMatches` (affects nearly all + iteration methods) + - add `thisObj` parameter to `array/min` and `array/max` + + +v0.4.0 (2013/02/26) +------------------- + + - add `object/equals` + - add `object/deepEquals` + - add `object/matches`. + - add `lang/is` and `lang/isnt`. + - add `lang/isInteger`. + - add `array/findIndex`. + - add shorthand syntax to `array/*`, `object/*` and `collection/*` methods. + - improve `number/sign` behavior when value is NaN or +0 or -0. + - improve `lang/isNaN` to actually check if value *is not a number* without + coercing value; so `[]`, `""`, `null` and `"12"` are considered NaN (#39). + - improve `string/contains` to match ES6 behavior (add fromIndex argument). + + +v0.3.0 (2013/02/01) +------------------- + + - add `lang/clone`. + - add `lang/toString`. + - add `string/replace`. + - add `string/WHITE_SPACES` + - rename `function/curry` to `function/partial`. + - allow custom chars in `string/trim`, `ltrim`, and `rtrim`. + - convert values to strings in the `string/*` functions. + + +v0.2.0 (2013/01/13) +------------------- + + - fix bug in `math/ceil` for negative radixes. + - change `object/deepFillIn` and `object/deepMixIn` to recurse only if both + existing and new values are plain objects. Will not recurse into arrays + or objects not created by the Object constructor. + - add `lang/isPlainObject` to check if a file is a valid object and is created + by the Object constructor + - change `lang/clone` behavior when dealing with custom types (avoid cloning + it by default) and add second argument to allow custom behavior if needed. + - rename `lang/clone` to `lang/deepClone`. + - add VERSION property to index.js + - simplify `math/floor`, `math/round`, `math/ceil` and `math/countSteps`. + + +v0.1.0 (2013/01/09) +------------------- + +- Rename project from "amd-utils" to "mout" + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/CONTRIBUTING.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/CONTRIBUTING.md new file mode 100644 index 00000000..65d9add1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/CONTRIBUTING.md @@ -0,0 +1,61 @@ +# Contributing + +Fork the repo at https://github.com/mout/mout + + > "Write clearly, don't be too clever" - The Elements of Programming Style + +Avoid unnamed functions and follow the other modules structure. By only using named functions it will be easier to extract the code from the AMD module if needed and it will also give better error messages, JavaScript minifiers like [Google Closure Compiler](http://code.google.com/closure/compiler/) and [UglifyJS](https://github.com/mishoo/UglifyJS) will make sure code is as small/optimized as possible. + + > "Make it clear before you make it faster." - The Elements of Programming Style + +Be sure to always create tests for each proposed module. Features will only be merged if they contain proper tests and documentation. + + > "Good code is its own best documentation." - Steve McConnell + +We should do a code review before merging to make sure names makes sense and implementation is as good as possible. + +Try to split your pull requests into logical groups, the smaller the easier to be reviewed/merged. + + + +## Tests & Code Coverage ## + +Tests can be found inside the `tests` folder, to execute them in the browser open the `tests/runner.html`. The same tests also work on node.js by running `npm test`. + +We should have tests for all methods and ensure we have a high code coverage through our continuous integration server ([travis](https://travis-ci.org/mout/mout)). When you ask for a pull request Travis will automatically run the tests on node.js and check the code coverage as well. + +We run `node build pkg` automatically before any `npm test`, so specs and packages should always be in sync. (will avoid human mistakes) + +To check code coverage run `npm test --coverage`, it will generate the reports inside the `coverage` folder and also log the results. Please note that node.js doesn't execute all code branches since we have some conditionals that are only met on old JavaScript engines (eg. IE 7-8), so we will never have 100% code coverage (but should be close to it). + + + +## Build Script ## + +The [build script](https://github.com/mout/mout/wiki/Build-Script) can be extremely helpful and can avoid human mistakes, use it. + + + +## Admins / Pull Requests ## + +Even if you are an admin (have commit rights) please do pull requests when adding new features or changing current behavior, that way we can review the work and discuss. Feel free to push changes that doesn't affect behavior without asking for a pull request (readme, changelog, build script, typos, refactoring, ...). + + + +## Large changes ## + +If you are proposing some major change, please create an issue to discuss it first. (maybe it's outside the scope of the project) + + + +## Questions / IRC / Wiki / Issue Tracker ## + +When in doubt ask someone on IRC to help you ([#moutjs on irc.freenode.net](http://webchat.freenode.net/?channels=moutjs)) or create a [new issue](http://github.com/mout/mout/issues). + +The [project wiki](https://github.com/mout/mout/wiki) can also be a good resource of information. + + +--- + +Check the [contributors list at github](https://github.com/mout/mout/contributors). + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/LICENSE.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/LICENSE.md new file mode 100644 index 00000000..e9ccc2be --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/LICENSE.md @@ -0,0 +1,21 @@ +# The MIT License (MIT) +## Copyright (c) 2012, 2013 moutjs team and contributors (http://moutjs.com) + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/README.md new file mode 100644 index 00000000..ebc3a9ec --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/README.md @@ -0,0 +1,63 @@ +![mout](http://moutjs.com/logo.png "Modular JavaScript Utilties") + +http://moutjs.com/ + +[![Build Status](https://travis-ci.org/mout/mout.svg?branch=master)](https://travis-ci.org/mout/mout) + +All code is library agnostic and consist mostly of helper methods that aren't +directly related with the DOM, the purpose of this library isn't to replace +Dojo, jQuery, YUI, Mootools, etc, but to provide modular solutions for common +problems that aren't solved by most of them. Consider it as a crossbrowser +JavaScript standard library. + + + +## Main goals ## + + - increase code reuse; + - be clear (code should be clean/readable); + - be easy to debug; + - be easy to maintain; + - follow best practices; + - follow standards when possible; + - **don't convert JavaScript into another language!** + - be compatible with other frameworks; + - be modular; + - have unit tests for all modules; + - work on multiple environments (IE7+, modern browsers, node.js); + + + +## What shouldn't be here ## + + - UI components; + - CSS selector engine; + - Event system - pub/sub; + - Template engine; + - Anything that isn't generic enough to be on a standard library; + - Anything that could be a separate library and/or isn't a modular utility... + + + +## API Documentation ## + +Online documentation can be found at http://moutjs.com/ or inside the +`doc` folder. + + + +## FAQ / Wiki / IRC ## + +For more info about project structure, design decisions, tips, how to +contribute, build system, etc, please check the [project +wiki](https://github.com/mout/mout/wiki). + +We also have an IRC channel [#moutjs on +irc.freenode.net](http://webchat.freenode.net/?channels=moutjs) + + + +## License ## + +Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php). + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array.js new file mode 100644 index 00000000..e058096a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array.js @@ -0,0 +1,54 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'append' : require('./array/append'), + 'collect' : require('./array/collect'), + 'combine' : require('./array/combine'), + 'compact' : require('./array/compact'), + 'contains' : require('./array/contains'), + 'difference' : require('./array/difference'), + 'equals' : require('./array/equals'), + 'every' : require('./array/every'), + 'filter' : require('./array/filter'), + 'find' : require('./array/find'), + 'findIndex' : require('./array/findIndex'), + 'findLast' : require('./array/findLast'), + 'findLastIndex' : require('./array/findLastIndex'), + 'flatten' : require('./array/flatten'), + 'forEach' : require('./array/forEach'), + 'groupBy' : require('./array/groupBy'), + 'indexOf' : require('./array/indexOf'), + 'insert' : require('./array/insert'), + 'intersection' : require('./array/intersection'), + 'invoke' : require('./array/invoke'), + 'join' : require('./array/join'), + 'last' : require('./array/last'), + 'lastIndexOf' : require('./array/lastIndexOf'), + 'map' : require('./array/map'), + 'max' : require('./array/max'), + 'min' : require('./array/min'), + 'pick' : require('./array/pick'), + 'pluck' : require('./array/pluck'), + 'range' : require('./array/range'), + 'reduce' : require('./array/reduce'), + 'reduceRight' : require('./array/reduceRight'), + 'reject' : require('./array/reject'), + 'remove' : require('./array/remove'), + 'removeAll' : require('./array/removeAll'), + 'shuffle' : require('./array/shuffle'), + 'slice' : require('./array/slice'), + 'some' : require('./array/some'), + 'sort' : require('./array/sort'), + 'sortBy' : require('./array/sortBy'), + 'split' : require('./array/split'), + 'take' : require('./array/take'), + 'toLookup' : require('./array/toLookup'), + 'union' : require('./array/union'), + 'unique' : require('./array/unique'), + 'xor' : require('./array/xor'), + 'zip' : require('./array/zip') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/append.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/append.js new file mode 100644 index 00000000..bf74037e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/append.js @@ -0,0 +1,21 @@ + + + /** + * Appends an array to the end of another. + * The first array will be modified. + */ + function append(arr1, arr2) { + if (arr2 == null) { + return arr1; + } + + var pad = arr1.length, + i = -1, + len = arr2.length; + while (++i < len) { + arr1[pad + i] = arr2[i]; + } + return arr1; + } + module.exports = append; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/collect.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/collect.js new file mode 100644 index 00000000..58637493 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/collect.js @@ -0,0 +1,27 @@ +var append = require('./append'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Maps the items in the array and concatenates the result arrays. + */ + function collect(arr, callback, thisObj){ + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null) { + return results; + } + + var i = -1, len = arr.length; + while (++i < len) { + var value = callback(arr[i], i, arr); + if (value != null) { + append(results, value); + } + } + + return results; + } + + module.exports = collect; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/combine.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/combine.js new file mode 100644 index 00000000..d66e6212 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/combine.js @@ -0,0 +1,22 @@ +var indexOf = require('./indexOf'); + + /** + * Combines an array with all the items of another. + * Does not allow duplicates and is case and type sensitive. + */ + function combine(arr1, arr2) { + if (arr2 == null) { + return arr1; + } + + var i = -1, len = arr2.length; + while (++i < len) { + if (indexOf(arr1, arr2[i]) === -1) { + arr1.push(arr2[i]); + } + } + + return arr1; + } + module.exports = combine; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/compact.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/compact.js new file mode 100644 index 00000000..74c176ed --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/compact.js @@ -0,0 +1,13 @@ +var filter = require('./filter'); + + /** + * Remove all null/undefined items from array. + */ + function compact(arr) { + return filter(arr, function(val){ + return (val != null); + }); + } + + module.exports = compact; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/contains.js new file mode 100644 index 00000000..92bb6ad9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/contains.js @@ -0,0 +1,10 @@ +var indexOf = require('./indexOf'); + + /** + * If array contains values. + */ + function contains(arr, val) { + return indexOf(arr, val) !== -1; + } + module.exports = contains; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/difference.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/difference.js new file mode 100644 index 00000000..ca57524d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/difference.js @@ -0,0 +1,23 @@ +var unique = require('./unique'); +var filter = require('./filter'); +var some = require('./some'); +var contains = require('./contains'); +var slice = require('./slice'); + + + /** + * Return a new Array with elements that aren't present in the other Arrays. + */ + function difference(arr) { + var arrs = slice(arguments, 1), + result = filter(unique(arr), function(needle){ + return !some(arrs, function(haystack){ + return contains(haystack, needle); + }); + }); + return result; + } + + module.exports = difference; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/equals.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/equals.js new file mode 100644 index 00000000..1a204303 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/equals.js @@ -0,0 +1,30 @@ +var is = require('../lang/is'); +var isArray = require('../lang/isArray'); +var every = require('./every'); + + /** + * Compares if both arrays have the same elements + */ + function equals(a, b, callback){ + callback = callback || is; + + if (!isArray(a) || !isArray(b)) { + return callback(a, b); + } + + if (a.length !== b.length) { + return false; + } + + return every(a, makeCompare(callback), b); + } + + function makeCompare(callback) { + return function(value, i) { + return i in this && callback(value, this[i]); + }; + } + + module.exports = equals; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/every.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/every.js new file mode 100644 index 00000000..ac598832 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/every.js @@ -0,0 +1,27 @@ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array every + */ + function every(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = true; + if (arr == null) { + return result; + } + + var i = -1, len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if (!callback(arr[i], i, arr) ) { + result = false; + break; + } + } + + return result; + } + + module.exports = every; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/filter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/filter.js new file mode 100644 index 00000000..f0e74199 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/filter.js @@ -0,0 +1,26 @@ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array filter + */ + function filter(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null) { + return results; + } + + var i = -1, len = arr.length, value; + while (++i < len) { + value = arr[i]; + if (callback(value, i, arr)) { + results.push(value); + } + } + + return results; + } + + module.exports = filter; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/find.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/find.js new file mode 100644 index 00000000..b4a73131 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/find.js @@ -0,0 +1,13 @@ +var findIndex = require('./findIndex'); + + /** + * Returns first item that matches criteria + */ + function find(arr, iterator, thisObj){ + var idx = findIndex(arr, iterator, thisObj); + return idx >= 0? arr[idx] : void(0); + } + + module.exports = find; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/findIndex.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/findIndex.js new file mode 100644 index 00000000..53f22a5f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/findIndex.js @@ -0,0 +1,23 @@ +var makeIterator = require('../function/makeIterator_'); + + /** + * Returns the index of the first item that matches criteria + */ + function findIndex(arr, iterator, thisObj){ + iterator = makeIterator(iterator, thisObj); + if (arr == null) { + return -1; + } + + var i = -1, len = arr.length; + while (++i < len) { + if (iterator(arr[i], i, arr)) { + return i; + } + } + + return -1; + } + + module.exports = findIndex; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/findLast.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/findLast.js new file mode 100644 index 00000000..84ba4bf1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/findLast.js @@ -0,0 +1,13 @@ +var findLastIndex = require('./findLastIndex'); + + /** + * Returns last item that matches criteria + */ + function findLast(arr, iterator, thisObj){ + var idx = findLastIndex(arr, iterator, thisObj); + return idx >= 0? arr[idx] : void(0); + } + + module.exports = findLast; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/findLastIndex.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/findLastIndex.js new file mode 100644 index 00000000..b8330f2f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/findLastIndex.js @@ -0,0 +1,24 @@ +var makeIterator = require('../function/makeIterator_'); + + /** + * Returns the index of the last item that matches criteria + */ + function findLastIndex(arr, iterator, thisObj){ + iterator = makeIterator(iterator, thisObj); + if (arr == null) { + return -1; + } + + var n = arr.length; + while (--n >= 0) { + if (iterator(arr[n], n, arr)) { + return n; + } + } + + return -1; + } + + module.exports = findLastIndex; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/flatten.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/flatten.js new file mode 100644 index 00000000..aa9757ab --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/flatten.js @@ -0,0 +1,43 @@ +var isArray = require('../lang/isArray'); +var append = require('./append'); + + /* + * Helper function to flatten to a destination array. + * Used to remove the need to create intermediate arrays while flattening. + */ + function flattenTo(arr, result, level) { + if (arr == null) { + return result; + } else if (level === 0) { + append(result, arr); + return result; + } + + var value, + i = -1, + len = arr.length; + while (++i < len) { + value = arr[i]; + if (isArray(value)) { + flattenTo(value, result, level - 1); + } else { + result.push(value); + } + } + return result; + } + + /** + * Recursively flattens an array. + * A new array containing all the elements is returned. + * If `shallow` is true, it will only flatten one level. + */ + function flatten(arr, level) { + level = level == null? -1 : level; + return flattenTo(arr, [], level); + } + + module.exports = flatten; + + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/forEach.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/forEach.js new file mode 100644 index 00000000..268e506f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/forEach.js @@ -0,0 +1,23 @@ + + + /** + * Array forEach + */ + function forEach(arr, callback, thisObj) { + if (arr == null) { + return; + } + var i = -1, + len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if ( callback.call(thisObj, arr[i], i, arr) === false ) { + break; + } + } + } + + module.exports = forEach; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/groupBy.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/groupBy.js new file mode 100644 index 00000000..af6f434e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/groupBy.js @@ -0,0 +1,30 @@ +var forEach = require('../array/forEach'); +var identity = require('../function/identity'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Bucket the array values. + */ + function groupBy(arr, categorize, thisObj) { + if (categorize) { + categorize = makeIterator(categorize, thisObj); + } else { + // Default to identity function. + categorize = identity; + } + + var buckets = {}; + forEach(arr, function(element) { + var bucket = categorize(element); + if (!(bucket in buckets)) { + buckets[bucket] = []; + } + + buckets[bucket].push(element); + }); + + return buckets; + } + + module.exports = groupBy; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/indexOf.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/indexOf.js new file mode 100644 index 00000000..6a9ac832 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/indexOf.js @@ -0,0 +1,28 @@ + + + /** + * Array.indexOf + */ + function indexOf(arr, item, fromIndex) { + fromIndex = fromIndex || 0; + if (arr == null) { + return -1; + } + + var len = arr.length, + i = fromIndex < 0 ? len + fromIndex : fromIndex; + while (i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if (arr[i] === item) { + return i; + } + + i++; + } + + return -1; + } + + module.exports = indexOf; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/insert.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/insert.js new file mode 100644 index 00000000..20bd442a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/insert.js @@ -0,0 +1,15 @@ +var difference = require('./difference'); +var slice = require('./slice'); + + /** + * Insert item into array if not already present. + */ + function insert(arr, rest_items) { + var diff = difference(slice(arguments, 1), arr); + if (diff.length) { + Array.prototype.push.apply(arr, diff); + } + return arr.length; + } + module.exports = insert; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/intersection.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/intersection.js new file mode 100644 index 00000000..34957ab1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/intersection.js @@ -0,0 +1,24 @@ +var unique = require('./unique'); +var filter = require('./filter'); +var every = require('./every'); +var contains = require('./contains'); +var slice = require('./slice'); + + + /** + * Return a new Array with elements common to all Arrays. + * - based on underscore.js implementation + */ + function intersection(arr) { + var arrs = slice(arguments, 1), + result = filter(unique(arr), function(needle){ + return every(arrs, function(haystack){ + return contains(haystack, needle); + }); + }); + return result; + } + + module.exports = intersection; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/invoke.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/invoke.js new file mode 100644 index 00000000..32ec5841 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/invoke.js @@ -0,0 +1,23 @@ +var slice = require('./slice'); + + /** + * Call `methodName` on each item of the array passing custom arguments if + * needed. + */ + function invoke(arr, methodName, var_args){ + if (arr == null) { + return arr; + } + + var args = slice(arguments, 2); + var i = -1, len = arr.length, value; + while (++i < len) { + value = arr[i]; + value[methodName].apply(value, args); + } + + return arr; + } + + module.exports = invoke; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/join.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/join.js new file mode 100644 index 00000000..71d8bd20 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/join.js @@ -0,0 +1,17 @@ +var filter = require('./filter'); + + function isValidString(val) { + return (val != null && val !== ''); + } + + /** + * Joins strings with the specified separator inserted between each value. + * Null values and empty strings will be excluded. + */ + function join(items, separator) { + separator = separator || ''; + return filter(items, isValidString).join(separator); + } + + module.exports = join; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/last.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/last.js new file mode 100644 index 00000000..d80ab2b9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/last.js @@ -0,0 +1,16 @@ + + + /** + * Returns last element of array. + */ + function last(arr){ + if (arr == null || arr.length < 1) { + return undefined; + } + + return arr[arr.length - 1]; + } + + module.exports = last; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/lastIndexOf.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/lastIndexOf.js new file mode 100644 index 00000000..ee44a25b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/lastIndexOf.js @@ -0,0 +1,28 @@ + + + /** + * Array lastIndexOf + */ + function lastIndexOf(arr, item, fromIndex) { + if (arr == null) { + return -1; + } + + var len = arr.length; + fromIndex = (fromIndex == null || fromIndex >= len)? len - 1 : fromIndex; + fromIndex = (fromIndex < 0)? len + fromIndex : fromIndex; + + while (fromIndex >= 0) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if (arr[fromIndex] === item) { + return fromIndex; + } + fromIndex--; + } + + return -1; + } + + module.exports = lastIndexOf; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/map.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/map.js new file mode 100644 index 00000000..7b7fb331 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/map.js @@ -0,0 +1,22 @@ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array map + */ + function map(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null){ + return results; + } + + var i = -1, len = arr.length; + while (++i < len) { + results[i] = callback(arr[i], i, arr); + } + + return results; + } + + module.exports = map; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/max.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/max.js new file mode 100644 index 00000000..0b8f2594 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/max.js @@ -0,0 +1,34 @@ +var makeIterator = require('../function/makeIterator_'); + + /** + * Return maximum value inside array + */ + function max(arr, iterator, thisObj){ + if (arr == null || !arr.length) { + return Infinity; + } else if (arr.length && !iterator) { + return Math.max.apply(Math, arr); + } else { + iterator = makeIterator(iterator, thisObj); + var result, + compare = -Infinity, + value, + temp; + + var i = -1, len = arr.length; + while (++i < len) { + value = arr[i]; + temp = iterator(value, i, arr); + if (temp > compare) { + compare = temp; + result = value; + } + } + + return result; + } + } + + module.exports = max; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/min.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/min.js new file mode 100644 index 00000000..ed6cc6a1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/min.js @@ -0,0 +1,34 @@ +var makeIterator = require('../function/makeIterator_'); + + /** + * Return minimum value inside array + */ + function min(arr, iterator, thisObj){ + if (arr == null || !arr.length) { + return -Infinity; + } else if (arr.length && !iterator) { + return Math.min.apply(Math, arr); + } else { + iterator = makeIterator(iterator, thisObj); + var result, + compare = Infinity, + value, + temp; + + var i = -1, len = arr.length; + while (++i < len) { + value = arr[i]; + temp = iterator(value, i, arr); + if (temp < compare) { + compare = temp; + result = value; + } + } + + return result; + } + } + + module.exports = min; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/pick.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/pick.js new file mode 100644 index 00000000..64086784 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/pick.js @@ -0,0 +1,31 @@ +var randInt = require('../random/randInt'); + + /** + * Remove random item(s) from the Array and return it. + * Returns an Array of items if [nItems] is provided or a single item if + * it isn't specified. + */ + function pick(arr, nItems){ + if (nItems != null) { + var result = []; + if (nItems > 0 && arr && arr.length) { + nItems = nItems > arr.length? arr.length : nItems; + while (nItems--) { + result.push( pickOne(arr) ); + } + } + return result; + } + return (arr && arr.length)? pickOne(arr) : void(0); + } + + + function pickOne(arr){ + var idx = randInt(0, arr.length - 1); + return arr.splice(idx, 1)[0]; + } + + + module.exports = pick; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/pluck.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/pluck.js new file mode 100644 index 00000000..fef4043b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/pluck.js @@ -0,0 +1,12 @@ +var map = require('./map'); + + /** + * Extract a list of property values. + */ + function pluck(arr, propName){ + return map(arr, propName); + } + + module.exports = pluck; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/range.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/range.js new file mode 100644 index 00000000..31d3c770 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/range.js @@ -0,0 +1,27 @@ +var countSteps = require('../math/countSteps'); + + /** + * Returns an Array of numbers inside range. + */ + function range(start, stop, step) { + if (stop == null) { + stop = start; + start = 0; + } + step = step || 1; + + var result = [], + nSteps = countSteps(stop - start, step), + i = start; + + while (i <= stop) { + result.push(i); + i += step; + } + + return result; + } + + module.exports = range; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/reduce.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/reduce.js new file mode 100644 index 00000000..827f428f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/reduce.js @@ -0,0 +1,33 @@ + + + /** + * Array reduce + */ + function reduce(arr, fn, initVal) { + // check for args.length since initVal might be "undefined" see #gh-57 + var hasInit = arguments.length > 2, + result = initVal; + + if (arr == null || !arr.length) { + if (!hasInit) { + throw new Error('reduce of empty array with no initial value'); + } else { + return initVal; + } + } + + var i = -1, len = arr.length; + while (++i < len) { + if (!hasInit) { + result = arr[i]; + hasInit = true; + } else { + result = fn(result, arr[i], i, arr); + } + } + + return result; + } + + module.exports = reduce; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/reduceRight.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/reduceRight.js new file mode 100644 index 00000000..e36fd4aa --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/reduceRight.js @@ -0,0 +1,34 @@ + + + /** + * Array reduceRight + */ + function reduceRight(arr, fn, initVal) { + // check for args.length since initVal might be "undefined" see #gh-57 + var hasInit = arguments.length > 2; + + if (arr == null || !arr.length) { + if (hasInit) { + return initVal; + } else { + throw new Error('reduce of empty array with no initial value'); + } + } + + var i = arr.length, result = initVal, value; + while (--i >= 0) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + value = arr[i]; + if (!hasInit) { + result = value; + hasInit = true; + } else { + result = fn(result, value, i, arr); + } + } + return result; + } + + module.exports = reduceRight; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/reject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/reject.js new file mode 100644 index 00000000..0cfc8b1a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/reject.js @@ -0,0 +1,25 @@ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array reject + */ + function reject(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null) { + return results; + } + + var i = -1, len = arr.length, value; + while (++i < len) { + value = arr[i]; + if (!callback(value, i, arr)) { + results.push(value); + } + } + + return results; + } + + module.exports = reject; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/remove.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/remove.js new file mode 100644 index 00000000..aa6517db --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/remove.js @@ -0,0 +1,13 @@ +var indexOf = require('./indexOf'); + + /** + * Remove a single item from the array. + * (it won't remove duplicates, just a single item) + */ + function remove(arr, item){ + var idx = indexOf(arr, item); + if (idx !== -1) arr.splice(idx, 1); + } + + module.exports = remove; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/removeAll.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/removeAll.js new file mode 100644 index 00000000..d5f7f3b6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/removeAll.js @@ -0,0 +1,15 @@ +var indexOf = require('./indexOf'); + + /** + * Remove all instances of an item from array. + */ + function removeAll(arr, item){ + var idx = indexOf(arr, item); + while (idx !== -1) { + arr.splice(idx, 1); + idx = indexOf(arr, item, idx); + } + } + + module.exports = removeAll; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/shuffle.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/shuffle.js new file mode 100644 index 00000000..99d0660f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/shuffle.js @@ -0,0 +1,28 @@ +var randInt = require('../random/randInt'); + + /** + * Shuffle array items. + */ + function shuffle(arr) { + var results = [], + rnd; + if (arr == null) { + return results; + } + + var i = -1, len = arr.length, value; + while (++i < len) { + if (!i) { + results[0] = arr[0]; + } else { + rnd = randInt(0, i); + results[i] = results[rnd]; + results[rnd] = arr[i]; + } + } + + return results; + } + + module.exports = shuffle; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/slice.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/slice.js new file mode 100644 index 00000000..0a4d5cf7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/slice.js @@ -0,0 +1,35 @@ + + + /** + * Create slice of source array or array-like object + */ + function slice(arr, start, end){ + var len = arr.length; + + if (start == null) { + start = 0; + } else if (start < 0) { + start = Math.max(len + start, 0); + } else { + start = Math.min(start, len); + } + + if (end == null) { + end = len; + } else if (end < 0) { + end = Math.max(len + end, 0); + } else { + end = Math.min(end, len); + } + + var result = []; + while (start < end) { + result.push(arr[start++]); + } + + return result; + } + + module.exports = slice; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/some.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/some.js new file mode 100644 index 00000000..8d17772b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/some.js @@ -0,0 +1,27 @@ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array some + */ + function some(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = false; + if (arr == null) { + return result; + } + + var i = -1, len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if ( callback(arr[i], i, arr) ) { + result = true; + break; + } + } + + return result; + } + + module.exports = some; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/sort.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/sort.js new file mode 100644 index 00000000..7807339b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/sort.js @@ -0,0 +1,55 @@ + + + /** + * Merge sort (http://en.wikipedia.org/wiki/Merge_sort) + */ + function mergeSort(arr, compareFn) { + if (arr == null) { + return []; + } else if (arr.length < 2) { + return arr; + } + + if (compareFn == null) { + compareFn = defaultCompare; + } + + var mid, left, right; + + mid = ~~(arr.length / 2); + left = mergeSort( arr.slice(0, mid), compareFn ); + right = mergeSort( arr.slice(mid, arr.length), compareFn ); + + return merge(left, right, compareFn); + } + + function defaultCompare(a, b) { + return a < b ? -1 : (a > b? 1 : 0); + } + + function merge(left, right, compareFn) { + var result = []; + + while (left.length && right.length) { + if (compareFn(left[0], right[0]) <= 0) { + // if 0 it should preserve same order (stable) + result.push(left.shift()); + } else { + result.push(right.shift()); + } + } + + if (left.length) { + result.push.apply(result, left); + } + + if (right.length) { + result.push.apply(result, right); + } + + return result; + } + + module.exports = mergeSort; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/sortBy.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/sortBy.js new file mode 100644 index 00000000..b84544c1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/sortBy.js @@ -0,0 +1,19 @@ +var sort = require('./sort'); +var makeIterator = require('../function/makeIterator_'); + + /* + * Sort array by the result of the callback + */ + function sortBy(arr, callback, context){ + callback = makeIterator(callback, context); + + return sort(arr, function(a, b) { + a = callback(a); + b = callback(b); + return (a < b) ? -1 : ((a > b) ? 1 : 0); + }); + } + + module.exports = sortBy; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/split.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/split.js new file mode 100644 index 00000000..4f3ba50c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/split.js @@ -0,0 +1,35 @@ + + + /** + * Split array into a fixed number of segments. + */ + function split(array, segments) { + segments = segments || 2; + var results = []; + if (array == null) { + return results; + } + + var minLength = Math.floor(array.length / segments), + remainder = array.length % segments, + i = 0, + len = array.length, + segmentIndex = 0, + segmentLength; + + while (i < len) { + segmentLength = minLength; + if (segmentIndex < remainder) { + segmentLength++; + } + + results.push(array.slice(i, i + segmentLength)); + + segmentIndex++; + i += segmentLength; + } + + return results; + } + module.exports = split; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/take.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/take.js new file mode 100644 index 00000000..bd8eb071 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/take.js @@ -0,0 +1,24 @@ + + + /** + * Iterates over a callback a set amount of times + * returning the results + */ + function take(n, callback, thisObj){ + var i = -1; + var arr = []; + if( !thisObj ){ + while(++i < n){ + arr[i] = callback(i, n); + } + } else { + while(++i < n){ + arr[i] = callback.call(thisObj, i, n); + } + } + return arr; + } + + module.exports = take; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/toLookup.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/toLookup.js new file mode 100644 index 00000000..ce4c55dd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/toLookup.js @@ -0,0 +1,28 @@ +var isFunction = require('../lang/isFunction'); + + /** + * Creates an object that holds a lookup for the objects in the array. + */ + function toLookup(arr, key) { + var result = {}; + if (arr == null) { + return result; + } + + var i = -1, len = arr.length, value; + if (isFunction(key)) { + while (++i < len) { + value = arr[i]; + result[key(value)] = value; + } + } else { + while (++i < len) { + value = arr[i]; + result[value[key]] = value; + } + } + + return result; + } + module.exports = toLookup; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/union.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/union.js new file mode 100644 index 00000000..f1334a91 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/union.js @@ -0,0 +1,19 @@ +var unique = require('./unique'); +var append = require('./append'); + + /** + * Concat multiple arrays and remove duplicates + */ + function union(arrs) { + var results = []; + var i = -1, len = arguments.length; + while (++i < len) { + append(results, arguments[i]); + } + + return unique(results); + } + + module.exports = union; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/unique.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/unique.js new file mode 100644 index 00000000..5db25103 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/unique.js @@ -0,0 +1,25 @@ +var filter = require('./filter'); + + /** + * @return {array} Array of unique items + */ + function unique(arr, compare){ + compare = compare || isEqual; + return filter(arr, function(item, i, arr){ + var n = arr.length; + while (++i < n) { + if ( compare(item, arr[i]) ) { + return false; + } + } + return true; + }); + } + + function isEqual(a, b){ + return a === b; + } + + module.exports = unique; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/xor.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/xor.js new file mode 100644 index 00000000..c125a996 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/xor.js @@ -0,0 +1,26 @@ +var unique = require('./unique'); +var filter = require('./filter'); +var contains = require('./contains'); + + + /** + * Exclusive OR. Returns items that are present in a single array. + * - like ptyhon's `symmetric_difference` + */ + function xor(arr1, arr2) { + arr1 = unique(arr1); + arr2 = unique(arr2); + + var a1 = filter(arr1, function(item){ + return !contains(arr2, item); + }), + a2 = filter(arr2, function(item){ + return !contains(arr1, item); + }); + + return a1.concat(a2); + } + + module.exports = xor; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/zip.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/zip.js new file mode 100644 index 00000000..8bce9c07 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/array/zip.js @@ -0,0 +1,28 @@ +var max = require('./max'); +var map = require('./map'); + + function getLength(arr) { + return arr == null ? 0 : arr.length; + } + + /** + * Merges together the values of each of the arrays with the values at the + * corresponding position. + */ + function zip(arr){ + var len = arr ? max(map(arguments, getLength)) : 0, + results = [], + i = -1; + while (++i < len) { + // jshint loopfunc: true + results.push(map(arguments, function(item) { + return item == null ? undefined : item[i]; + })); + } + + return results; + } + + module.exports = zip; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection.js new file mode 100644 index 00000000..d5cf6cad --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection.js @@ -0,0 +1,22 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'contains' : require('./collection/contains'), + 'every' : require('./collection/every'), + 'filter' : require('./collection/filter'), + 'find' : require('./collection/find'), + 'forEach' : require('./collection/forEach'), + 'make_' : require('./collection/make_'), + 'map' : require('./collection/map'), + 'max' : require('./collection/max'), + 'min' : require('./collection/min'), + 'pluck' : require('./collection/pluck'), + 'reduce' : require('./collection/reduce'), + 'reject' : require('./collection/reject'), + 'size' : require('./collection/size'), + 'some' : require('./collection/some') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/contains.js new file mode 100644 index 00000000..a73f994b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/contains.js @@ -0,0 +1,9 @@ +var make = require('./make_'); +var arrContains = require('../array/contains'); +var objContains = require('../object/contains'); + + /** + */ + module.exports = make(arrContains, objContains); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/every.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/every.js new file mode 100644 index 00000000..300e03c5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/every.js @@ -0,0 +1,9 @@ +var make = require('./make_'); +var arrEvery = require('../array/every'); +var objEvery = require('../object/every'); + + /** + */ + module.exports = make(arrEvery, objEvery); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/filter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/filter.js new file mode 100644 index 00000000..38757005 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/filter.js @@ -0,0 +1,23 @@ +var forEach = require('./forEach'); +var makeIterator = require('../function/makeIterator_'); + + /** + * filter collection values, returns array. + */ + function filter(list, iterator, thisObj) { + iterator = makeIterator(iterator, thisObj); + var results = []; + if (!list) { + return results; + } + forEach(list, function(value, index, list) { + if (iterator(value, index, list)) { + results[results.length] = value; + } + }); + return results; + } + + module.exports = filter; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/find.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/find.js new file mode 100644 index 00000000..14317e64 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/find.js @@ -0,0 +1,10 @@ +var make = require('./make_'); +var arrFind = require('../array/find'); +var objFind = require('../object/find'); + + /** + * Find value that returns true on iterator check. + */ + module.exports = make(arrFind, objFind); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/forEach.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/forEach.js new file mode 100644 index 00000000..6e28dcb1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/forEach.js @@ -0,0 +1,9 @@ +var make = require('./make_'); +var arrForEach = require('../array/forEach'); +var objForEach = require('../object/forOwn'); + + /** + */ + module.exports = make(arrForEach, objForEach); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/make_.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/make_.js new file mode 100644 index 00000000..4fb8a81d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/make_.js @@ -0,0 +1,19 @@ +var slice = require('../array/slice'); + + /** + * internal method used to create other collection modules. + */ + function makeCollectionMethod(arrMethod, objMethod, defaultReturn) { + return function(){ + var args = slice(arguments); + if (args[0] == null) { + return defaultReturn; + } + // array-like is treated as array + return (typeof args[0].length === 'number')? arrMethod.apply(null, args) : objMethod.apply(null, args); + }; + } + + module.exports = makeCollectionMethod; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/map.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/map.js new file mode 100644 index 00000000..fc157f53 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/map.js @@ -0,0 +1,23 @@ +var isObject = require('../lang/isObject'); +var values = require('../object/values'); +var arrMap = require('../array/map'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Map collection values, returns Array. + */ + function map(list, callback, thisObj) { + callback = makeIterator(callback, thisObj); + // list.length to check array-like object, if not array-like + // we simply map all the object values + if( isObject(list) && list.length == null ){ + list = values(list); + } + return arrMap(list, function (val, key, list) { + return callback(val, key, list); + }); + } + + module.exports = map; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/max.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/max.js new file mode 100644 index 00000000..a8490e7e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/max.js @@ -0,0 +1,10 @@ +var make = require('./make_'); +var arrMax = require('../array/max'); +var objMax = require('../object/max'); + + /** + * Get maximum value inside collection + */ + module.exports = make(arrMax, objMax); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/min.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/min.js new file mode 100644 index 00000000..51d9f148 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/min.js @@ -0,0 +1,10 @@ +var make = require('./make_'); +var arrMin = require('../array/min'); +var objMin = require('../object/min'); + + /** + * Get minimum value inside collection. + */ + module.exports = make(arrMin, objMin); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/pluck.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/pluck.js new file mode 100644 index 00000000..9b283776 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/pluck.js @@ -0,0 +1,14 @@ +var map = require('./map'); + + /** + * Extract a list of property values. + */ + function pluck(list, key) { + return map(list, function(value) { + return value[key]; + }); + } + + module.exports = pluck; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/reduce.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/reduce.js new file mode 100644 index 00000000..4c075735 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/reduce.js @@ -0,0 +1,9 @@ +var make = require('./make_'); +var arrReduce = require('../array/reduce'); +var objReduce = require('../object/reduce'); + + /** + */ + module.exports = make(arrReduce, objReduce); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/reject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/reject.js new file mode 100644 index 00000000..2a92e3b3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/reject.js @@ -0,0 +1,16 @@ +var filter = require('./filter'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Inverse or collection/filter + */ + function reject(list, iterator, thisObj) { + iterator = makeIterator(iterator, thisObj); + return filter(list, function(value, index, list) { + return !iterator(value, index, list); + }, thisObj); + } + + module.exports = reject; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/size.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/size.js new file mode 100644 index 00000000..244e33e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/size.js @@ -0,0 +1,19 @@ +var isArray = require('../lang/isArray'); +var objSize = require('../object/size'); + + /** + * Get collection size + */ + function size(list) { + if (!list) { + return 0; + } + if (isArray(list)) { + return list.length; + } + return objSize(list); + } + + module.exports = size; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/some.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/some.js new file mode 100644 index 00000000..48fd252e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/collection/some.js @@ -0,0 +1,9 @@ +var make = require('./make_'); +var arrSome = require('../array/some'); +var objSome = require('../object/some'); + + /** + */ + module.exports = make(arrSome, objSome); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date.js new file mode 100644 index 00000000..9c2efe95 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date.js @@ -0,0 +1,22 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'dayOfTheYear' : require('./date/dayOfTheYear'), + 'diff' : require('./date/diff'), + 'i18n_' : require('./date/i18n_'), + 'isLeapYear' : require('./date/isLeapYear'), + 'isSame' : require('./date/isSame'), + 'parseIso' : require('./date/parseIso'), + 'quarter' : require('./date/quarter'), + 'startOf' : require('./date/startOf'), + 'strftime' : require('./date/strftime'), + 'timezoneAbbr' : require('./date/timezoneAbbr'), + 'timezoneOffset' : require('./date/timezoneOffset'), + 'totalDaysInMonth' : require('./date/totalDaysInMonth'), + 'totalDaysInYear' : require('./date/totalDaysInYear'), + 'weekOfTheYear' : require('./date/weekOfTheYear') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/dayOfTheYear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/dayOfTheYear.js new file mode 100644 index 00000000..85905c5a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/dayOfTheYear.js @@ -0,0 +1,13 @@ +var isDate = require('../lang/isDate'); + + /** + * return the day of the year (1..366) + */ + function dayOfTheYear(date){ + return (Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) - + Date.UTC(date.getFullYear(), 0, 1)) / 86400000 + 1; + } + + module.exports = dayOfTheYear; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/diff.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/diff.js new file mode 100644 index 00000000..1131cdcb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/diff.js @@ -0,0 +1,130 @@ +var totalDaysInMonth = require('./totalDaysInMonth'); +var totalDaysInYear = require('./totalDaysInYear'); +var convert = require('../time/convert'); + + /** + * calculate the difference between dates (range) + */ + function diff(start, end, unitName){ + // sort the dates to make it easier to process (specially year/month) + if (start > end) { + var swap = start; + start = end; + end = swap; + } + + var output; + + if (unitName === 'month') { + output = getMonthsDiff(start, end); + } else if (unitName === 'year'){ + output = getYearsDiff(start, end); + } else if (unitName != null) { + if (unitName === 'day') { + // ignore timezone difference because of daylight savings time + start = toUtc(start); + end = toUtc(end); + } + output = convert(end - start, 'ms', unitName); + } else { + output = end - start; + } + + return output; + } + + + function toUtc(d){ + // we ignore timezone differences on purpose because of daylight + // savings time, otherwise it would return fractional days/weeks even + // if a full day elapsed. eg: + // Wed Feb 12 2014 00:00:00 GMT-0200 (BRST) + // Sun Feb 16 2014 00:00:00 GMT-0300 (BRT) + // diff should be 4 days and not 4.041666666666667 + return Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), + d.getHours(), d.getMinutes(), d.getSeconds(), + d.getMilliseconds()); + } + + + function getMonthsDiff(start, end){ + return getElapsedMonths(start, end) + + getElapsedYears(start, end) * 12 + + getFractionalMonth(start, end); + } + + + function getYearsDiff(start, end){ + var elapsedYears = getElapsedYears(start, end); + return elapsedYears + getFractionalYear(start, end, elapsedYears); + } + + + function getElapsedMonths(start, end){ + var monthDiff = end.getMonth() - start.getMonth(); + if (monthDiff < 0) { + monthDiff += 12; + } + // less than a full month + if (start.getDate() > end.getDate()) { + monthDiff -= 1; + } + return monthDiff; + } + + + function getElapsedYears(start, end){ + var yearDiff = end.getFullYear() - start.getFullYear(); + // less than a full year + if (start.getMonth() > end.getMonth()) { + yearDiff -= 1; + } + return yearDiff; + } + + + function getFractionalMonth(start, end){ + var fractionalDiff = 0; + var startDay = start.getDate(); + var endDay = end.getDate(); + + if (startDay !== endDay) { + var startTotalDays = totalDaysInMonth(start); + var endTotalDays = totalDaysInMonth(end); + var totalDays; + var daysElapsed; + + if (startDay > endDay) { + // eg: Jan 29 - Feb 27 (29 days elapsed but not a full month) + var baseDay = startTotalDays - startDay; + daysElapsed = endDay + baseDay; + // total days should be relative to 1st day of next month if + // startDay > endTotalDays + totalDays = (startDay > endTotalDays)? + endTotalDays + baseDay + 1 : startDay + baseDay; + } else { + // fractional is only based on endMonth eg: Jan 12 - Feb 18 + // (6 fractional days, 28 days until next full month) + daysElapsed = endDay - startDay; + totalDays = endTotalDays; + } + + fractionalDiff = daysElapsed / totalDays; + } + + return fractionalDiff; + } + + + function getFractionalYear(start, end, elapsedYears){ + var base = elapsedYears? + new Date(end.getFullYear(), start.getMonth(), start.getDate()) : + start; + var elapsedDays = diff(base, end, 'day'); + return elapsedDays / totalDaysInYear(end); + } + + + module.exports = diff; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n/de-DE.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n/de-DE.js new file mode 100644 index 00000000..b3ab6207 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n/de-DE.js @@ -0,0 +1,61 @@ + + // de-DE (German) + module.exports = { + "am" : "", + "pm" : "", + + "x": "%d/%m/%y", + "X": "%H:%M:%S", + "c": "%a %d %b %Y %H:%M:%S %Z", + + "months" : [ + "Januar", + "Februar", + "März", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Dezember" + ], + + "months_abbr" : [ + "Jan", + "Febr", + "März", + "Apr", + "Mai", + "Juni", + "Juli", + "Aug", + "Sept", + "Okt", + "Nov", + "Dez" + ], + + "days" : [ + "Sonntag", + "Montag", + "Dienstag", + "Mittwoch", + "Donnerstag", + "Freitag", + "Samstag" + ], + + "days_abbr" : [ + "So", + "Mo", + "Di", + "Mi", + "Do", + "Fr", + "Sa" + ] + }; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n/en-US.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n/en-US.js new file mode 100644 index 00000000..f9526ce4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n/en-US.js @@ -0,0 +1,61 @@ + + // en-US (English, United States) + module.exports = { + "am" : "AM", + "pm" : "PM", + + "x": "%m/%d/%y", + "X": "%H:%M:%S", + "c": "%a %d %b %Y %I:%M:%S %p %Z", + + "months" : [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + + "months_abbr" : [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ], + + "days" : [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + + "days_abbr" : [ + "Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat" + ] + }; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n/pt-BR.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n/pt-BR.js new file mode 100644 index 00000000..71ebadb5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n/pt-BR.js @@ -0,0 +1,61 @@ + + // pt-BR (Brazillian Portuguese) + module.exports = { + "am" : "", + "pm" : "", + + "x": "%d/%m/%y", + "X": "%H:%M:%S", + "c": "%a %d %b %Y %H:%M:%S %Z", + + "months" : [ + "Janeiro", + "Fevereiro", + "Março", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro" + ], + + "months_abbr" : [ + "Jan", + "Fev", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Out", + "Nov", + "Dez" + ], + + "days" : [ + "Domingo", + "Segunda", + "Terça", + "Quarta", + "Quinta", + "Sexta", + "Sábado" + ], + + "days_abbr" : [ + "Dom", + "Seg", + "Ter", + "Qua", + "Qui", + "Sex", + "Sáb" + ] + }; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n_.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n_.js new file mode 100644 index 00000000..723fc103 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/i18n_.js @@ -0,0 +1,14 @@ +var mixIn = require('../object/mixIn'); +var enUS = require('./i18n/en-US'); + + // we also use mixIn to make sure we don't affect the original locale + var activeLocale = mixIn({}, enUS, { + // we expose a "set" method to allow overriding the global locale + set : function(localeData){ + mixIn(activeLocale, localeData); + } + }); + + module.exports = activeLocale; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/isLeapYear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/isLeapYear.js new file mode 100644 index 00000000..4212870b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/isLeapYear.js @@ -0,0 +1,15 @@ +var isDate = require('../lang/isDate'); + + /** + * checks if it's a leap year + */ + function isLeapYear(fullYear){ + if (isDate(fullYear)) { + fullYear = fullYear.getFullYear(); + } + return fullYear % 400 === 0 || (fullYear % 100 !== 0 && fullYear % 4 === 0); + } + + module.exports = isLeapYear; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/isSame.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/isSame.js new file mode 100644 index 00000000..4097d29b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/isSame.js @@ -0,0 +1,16 @@ +var startOf = require('./startOf'); + + /** + * Check if date is "same" with optional period + */ + function isSame(date1, date2, period){ + if (period) { + date1 = startOf(date1, period); + date2 = startOf(date2, period); + } + return Number(date1) === Number(date2); + } + + module.exports = isSame; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/parseIso.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/parseIso.js new file mode 100644 index 00000000..40a70a88 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/parseIso.js @@ -0,0 +1,146 @@ +var some = require('../array/some'); + + var datePatterns = [ + /^([0-9]{4})$/, // YYYY + /^([0-9]{4})-([0-9]{2})$/, // YYYY-MM (YYYYMM not allowed) + /^([0-9]{4})-?([0-9]{2})-?([0-9]{2})$/ // YYYY-MM-DD or YYYYMMDD + ]; + var ORD_DATE = /^([0-9]{4})-?([0-9]{3})$/; // YYYY-DDD + + var timePatterns = [ + /^([0-9]{2}(?:\.[0-9]*)?)$/, // HH.hh + /^([0-9]{2}):?([0-9]{2}(?:\.[0-9]*)?)$/, // HH:MM.mm + /^([0-9]{2}):?([0-9]{2}):?([0-9]{2}(\.[0-9]*)?)$/ // HH:MM:SS.ss + ]; + + var DATE_TIME = /^(.+)T(.+)$/; + var TIME_ZONE = /^(.+)([+\-])([0-9]{2}):?([0-9]{2})$/; + + function matchAll(str, patterns) { + var match; + var found = some(patterns, function(pattern) { + return !!(match = pattern.exec(str)); + }); + + return found ? match : null; + } + + function getDate(year, month, day) { + var date = new Date(Date.UTC(year, month, day)); + + // Explicitly set year to avoid Date.UTC making dates < 100 relative to + // 1900 + date.setUTCFullYear(year); + + var valid = + date.getUTCFullYear() === year && + date.getUTCMonth() === month && + date.getUTCDate() === day; + return valid ? +date : NaN; + } + + function parseOrdinalDate(str) { + var match = ORD_DATE.exec(str); + if (match ) { + var year = +match[1], + day = +match[2], + date = new Date(Date.UTC(year, 0, day)); + + if (date.getUTCFullYear() === year) { + return +date; + } + } + + return NaN; + } + + function parseDate(str) { + var match, year, month, day; + + match = matchAll(str, datePatterns); + if (match === null) { + // Ordinal dates are verified differently. + return parseOrdinalDate(str); + } + + year = (match[1] === void 0) ? 0 : +match[1]; + month = (match[2] === void 0) ? 0 : +match[2] - 1; + day = (match[3] === void 0) ? 1 : +match[3]; + + return getDate(year, month, day); + } + + function getTime(hr, min, sec) { + var valid = + (hr < 24 && hr >= 0 && + min < 60 && min >= 0 && + sec < 60 && min >= 0) || + (hr === 24 && min === 0 && sec === 0); + if (!valid) { + return NaN; + } + + return ((hr * 60 + min) * 60 + sec) * 1000; + } + + function parseOffset(str) { + var match; + if (str.charAt(str.length - 1) === 'Z') { + str = str.substring(0, str.length - 1); + } else { + match = TIME_ZONE.exec(str); + if (match) { + var hours = +match[3], + minutes = (match[4] === void 0) ? 0 : +match[4], + offset = getTime(hours, minutes, 0); + + if (match[2] === '-') { + offset *= -1; + } + + return { offset: offset, time: match[1] }; + } + } + + // No time zone specified, assume UTC + return { offset: 0, time: str }; + } + + function parseTime(str) { + var match; + var offset = parseOffset(str); + + str = offset.time; + offset = offset.offset; + if (isNaN(offset)) { + return NaN; + } + + match = matchAll(str, timePatterns); + if (match === null) { + return NaN; + } + + var hours = (match[1] === void 0) ? 0 : +match[1], + minutes = (match[2] === void 0) ? 0 : +match[2], + seconds = (match[3] === void 0) ? 0 : +match[3]; + + return getTime(hours, minutes, seconds) - offset; + } + + /** + * Parse an ISO8601 formatted date string, and return a Date object. + */ + function parseISO8601(str){ + var match = DATE_TIME.exec(str); + if (!match) { + // No time specified + return parseDate(str); + } + + return parseDate(match[1]) + parseTime(match[2]); + } + + module.exports = parseISO8601; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/quarter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/quarter.js new file mode 100644 index 00000000..8f610761 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/quarter.js @@ -0,0 +1,16 @@ + + + /** + * gets date quarter + */ + function quarter(date){ + var month = date.getMonth(); + if (month < 3) return 1; + if (month < 6) return 2; + if (month < 9) return 3; + return 4; + } + + module.exports = quarter; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/startOf.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/startOf.js new file mode 100644 index 00000000..072bc0ef --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/startOf.js @@ -0,0 +1,54 @@ +var clone = require('../lang/clone'); + + /** + * get a new Date object representing start of period + */ + function startOf(date, period){ + date = clone(date); + + // intentionally removed "break" from switch since start of + // month/year/etc should also reset the following periods + switch (period) { + case 'year': + date.setMonth(0); + /* falls through */ + case 'month': + date.setDate(1); + /* falls through */ + case 'week': + case 'day': + date.setHours(0); + /* falls through */ + case 'hour': + date.setMinutes(0); + /* falls through */ + case 'minute': + date.setSeconds(0); + /* falls through */ + case 'second': + date.setMilliseconds(0); + break; + default: + throw new Error('"'+ period +'" is not a valid period'); + } + + // week is the only case that should reset the weekDay and maybe even + // overflow to previous month + if (period === 'week') { + var weekDay = date.getDay(); + var baseDate = date.getDate(); + if (weekDay) { + if (weekDay >= baseDate) { + //start of the week is on previous month + date.setDate(0); + } + date.setDate(date.getDate() - date.getDay()); + } + } + + return date; + } + + module.exports = startOf; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/strftime.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/strftime.js new file mode 100644 index 00000000..5e566332 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/strftime.js @@ -0,0 +1,121 @@ +var pad = require('../number/pad'); +var lpad = require('../string/lpad'); +var i18n = require('./i18n_'); +var dayOfTheYear = require('./dayOfTheYear'); +var timezoneOffset = require('./timezoneOffset'); +var timezoneAbbr = require('./timezoneAbbr'); +var weekOfTheYear = require('./weekOfTheYear'); + + var _combinations = { + 'D': '%m/%d/%y', + 'F': '%Y-%m-%d', + 'r': '%I:%M:%S %p', + 'R': '%H:%M', + 'T': '%H:%M:%S', + 'x': 'locale', + 'X': 'locale', + 'c': 'locale' + }; + + + /** + * format date based on strftime format + */ + function strftime(date, format, localeData){ + localeData = localeData || i18n; + var reToken = /%([a-z%])/gi; + + function makeIterator(fn) { + return function(match, token){ + return fn(date, token, localeData); + }; + } + + return format + .replace(reToken, makeIterator(expandCombinations)) + .replace(reToken, makeIterator(convertToken)); + } + + + function expandCombinations(date, token, l10n){ + if (token in _combinations) { + var expanded = _combinations[token]; + return expanded === 'locale'? l10n[token] : expanded; + } else { + return '%'+ token; + } + } + + + function convertToken(date, token, l10n){ + switch (token){ + case 'a': + return l10n.days_abbr[date.getDay()]; + case 'A': + return l10n.days[date.getDay()]; + case 'h': + case 'b': + return l10n.months_abbr[date.getMonth()]; + case 'B': + return l10n.months[date.getMonth()]; + case 'C': + return pad(Math.floor(date.getFullYear() / 100), 2); + case 'd': + return pad(date.getDate(), 2); + case 'e': + return pad(date.getDate(), 2, ' '); + case 'H': + return pad(date.getHours(), 2); + case 'I': + return pad(date.getHours() % 12, 2); + case 'j': + return pad(dayOfTheYear(date), 3); + case 'l': + return lpad(date.getHours() % 12, 2); + case 'L': + return pad(date.getMilliseconds(), 3); + case 'm': + return pad(date.getMonth() + 1, 2); + case 'M': + return pad(date.getMinutes(), 2); + case 'n': + return '\n'; + case 'p': + return date.getHours() >= 12? l10n.pm : l10n.am; + case 'P': + return convertToken(date, 'p', l10n).toLowerCase(); + case 's': + return date.getTime() / 1000; + case 'S': + return pad(date.getSeconds(), 2); + case 't': + return '\t'; + case 'u': + var day = date.getDay(); + return day === 0? 7 : day; + case 'U': + return pad(weekOfTheYear(date), 2); + case 'w': + return date.getDay(); + case 'W': + return pad(weekOfTheYear(date, 1), 2); + case 'y': + return pad(date.getFullYear() % 100, 2); + case 'Y': + return pad(date.getFullYear(), 4); + case 'z': + return timezoneOffset(date); + case 'Z': + return timezoneAbbr(date); + case '%': + return '%'; + default: + // keep unrecognized tokens + return '%'+ token; + } + } + + + module.exports = strftime; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/timezoneAbbr.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/timezoneAbbr.js new file mode 100644 index 00000000..b1006875 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/timezoneAbbr.js @@ -0,0 +1,17 @@ +var timezoneOffset = require('./timezoneOffset'); + + /** + * Abbreviated time zone name or similar information. + */ + function timezoneAbbr(date){ + // Date.toString gives different results depending on the + // browser/system so we fallback to timezone offset + // chrome: 'Mon Apr 08 2013 09:02:04 GMT-0300 (BRT)' + // IE: 'Mon Apr 8 09:02:04 UTC-0300 2013' + var tz = /\(([A-Z]{3,4})\)/.exec(date.toString()); + return tz? tz[1] : timezoneOffset(date); + } + + module.exports = timezoneAbbr; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/timezoneOffset.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/timezoneOffset.js new file mode 100644 index 00000000..9492dceb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/timezoneOffset.js @@ -0,0 +1,16 @@ +var pad = require('../number/pad'); + + /** + * time zone as hour and minute offset from UTC (e.g. +0900) + */ + function timezoneOffset(date){ + var offset = date.getTimezoneOffset(); + var abs = Math.abs(offset); + var h = pad(Math.floor(abs / 60), 2); + var m = pad(abs % 60, 2); + return (offset > 0? '-' : '+') + h + m; + } + + module.exports = timezoneOffset; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/totalDaysInMonth.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/totalDaysInMonth.js new file mode 100644 index 00000000..e5d53905 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/totalDaysInMonth.js @@ -0,0 +1,23 @@ +var isDate = require('../lang/isDate'); +var isLeapYear = require('./isLeapYear'); + + var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + + /** + * returns the total amount of days in the month (considering leap years) + */ + function totalDaysInMonth(fullYear, monthIndex){ + if (isDate(fullYear)) { + monthIndex = fullYear.getMonth(); + } + + if (monthIndex === 1 && isLeapYear(fullYear)) { + return 29; + } else { + return DAYS_IN_MONTH[monthIndex]; + } + } + + module.exports = totalDaysInMonth; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/totalDaysInYear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/totalDaysInYear.js new file mode 100644 index 00000000..b4b7e9b7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/totalDaysInYear.js @@ -0,0 +1,13 @@ +var isLeapYear = require('./isLeapYear'); + + /** + * return the amount of days in the year following the gregorian calendar + * and leap years + */ + function totalDaysInYear(fullYear){ + return isLeapYear(fullYear)? 366 : 365; + } + + module.exports = totalDaysInYear; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/weekOfTheYear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/weekOfTheYear.js new file mode 100644 index 00000000..dd51b7f1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/date/weekOfTheYear.js @@ -0,0 +1,16 @@ +var dayOfTheYear = require('./dayOfTheYear'); + + /** + * Return the week of the year based on given firstDayOfWeek + */ + function weekOfTheYear(date, firstDayOfWeek){ + firstDayOfWeek = firstDayOfWeek == null? 0 : firstDayOfWeek; + var doy = dayOfTheYear(date); + var dow = (7 + date.getDay() - firstDayOfWeek) % 7; + var relativeWeekDay = 6 - firstDayOfWeek - dow; + return Math.floor((doy + relativeWeekDay) / 7); + } + + module.exports = weekOfTheYear; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/array.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/array.md new file mode 100644 index 00000000..17c9d347 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/array.md @@ -0,0 +1,965 @@ +# array # + +Array utilities. + + + + +## append(arr1, arr2):Array + +Appends an array to the end of the other. +The first array will be modified and will contain the appended items. + +See: [`union()`](#union), [`combine()`](#combine) + +```js +var foo = ['a', 'b'], + bar = ['b', 'd']; + +append(foo, bar); // ['a', 'b', 'b', 'd'] +``` + + + +## collect(arr, callback, [thisObj]):Array + +Maps the items in `arr` and concatenates the resulting arrays. + +See: [`map()`](#map) + +```js +collect([1, 2, 3], function(val) { + return [val, val % 2]; +}); // [1, 1, 2, 0, 3, 1]; + +collect(['a', 'bb', ''], function(val) { + return val.split(''); +}); // ['a', 'b', 'b'] +``` + +It also supports a shorthand syntax: + +```js +var items = [{ a: [1] }, { b: 'foo' }, { a: [2, 3] }]; +collect(items, 'a'); // [1, 2, 3]; +``` + + + +## combine(arr1, arr2):Array + +Combines an array with all the items of another. +The first array will be modified and will contain the combined items. +Does not allow duplicates and is case and type sensitive. + +See: [`union()`](#union), [`append()`](#append) + +```js +var foo = ['a', 'b'], + bar = ['b', 'd']; + +combine(foo, bar); // ['a', 'b', 'd'] +``` + + + +## compact(arr):Array + +Returns a new Array without any `null` or `undefined` values. Note that it will +keep empty strings and other falsy values (simillar to Ruby Array#compact). + +```js +var arr = [0, 1, null, false, '', 'foo', undefined, 'bar']; +compact(arr); // [0, 1, false, '', 'foo', 'bar']; +``` + + + +## contains(arr, value):Boolean + +Checks if Array contains value. Alias to `indexOf(arr, val) !== -1`. + +```js +var arr = [1, 2, 3]; +contains(arr, 2); // true +contains(arr, 'foo'); // false +``` + + + +## difference(...arrs):Array + +Return a new Array with elements that aren't present in the other Arrays +besides the first one. + +Works like [Python set#difference](http://docs.python.org/library/stdtypes.html#set.difference). + +It will remove duplicates. + +See: [`xor()`](#xor), [`intersection()`](#intersection) + +```js +var a = ['a', 'b', 1]; +var b = ['c', 1]; +difference(a, b); // ['a', 'b'] +``` + + +## equals(a, b, [compare]):Boolean + +Checks if both arrays are equal. + +```js +equals([1, 2], [1, 2]); // true +equals([2, 4], [1, 2]); // false +``` + +By default it uses the [lang/is](lang.html#is) as the `compare` function but +you can pass a custom function to change the behavior. + +```js +function loose(a, b) { + return a == b; +} +equals(['1', 2], [1, 2], loose); // true +``` + +See: [object/equals](object.html#equals), [lang/deepEquals](lang.html#deepEquals) + + + +## every(arr, callback, [thisObj]):Array + +Crossbrowser `Array.every()`. + +Tests whether all elements in the array pass the test implemented by the provided function. + +It differs from ES5 since it will also loop over sparse items in the array to +normalize the behavior across browsers (avoid inconsistencies). + +```js +var items = [1, 'foo', 'bar']; +every(items, isString); // false +every(items, isFunction); // false +every(items, function(val, key, arr){ + return val != null; +}); // true +``` + +more info at [MDN Array#every](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every) + +It also supports a shorthand syntax: + +```js +var items = [{id:1, active:true}, {id:3, active:true}, {id:8, active:true}]; +// all items with `id === 8` +every(items, {id:8}); // false +// `active` is truthy on all items +every(items, 'active'); // true +``` + + + +## filter(arr, callback, [thisObj]):Array + +Crossbrowser `Array.filter()`. + +Creates a new array with all elements that pass the callback test. + +It differs from ES5 since it will also loop over sparse items in the array to +normalize the behavior across browsers (avoid inconsistencies). + +```js +var nums = [1, 2, 3, 4, 5, 6]; +var oddNumbers = filter(nums, function(val, key, arr){ + return (val % 2) !== 0; +}); +// > [1, 3, 5] +``` + +more info at [MDN Array#filter](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/filter) + +Filter also supports shorthand notation: + +```js +var users = [ + {name:'john', surname:'connor', beard:false}, + {name:'john', surname:'doe', beard:true}, + {name:'jane', surname:'doe', beard:false} +]; +// filter item that matches all properties/values pairs +filter(arr, {name:'john', beard:false}); +// > [{name:'john', surnname:'connor', beard:false}] +// items where 'beard' is a truthy value +filter(arr, 'beard'); +// > [{name:'john', surnname:'doe', beard:true}] +``` + +See [`reject()`](#reject) + + + +## find(arr, callback, [thisObj]):* + +Loops through all the items in the Array and returns the first one that passes +a truth test (callback). + +```js +var arr = [123, {a:'b'}, 'foo', 'bar']; +find(arr, isString); // "foo" +find(arr, isNumber); // 123 +find(arr, isObject); // {a:'b'} +``` + +Find also supports shorthand notation: + +```js +var users = [ + {name:'john', surname:'connor', beard:false}, + {name:'john', surname:'doe', beard:true} +]; +// first item that matches all properties/values pairs +find(arr, {name:'john'}); // {name:'john', surnname:'connor', beard:false} +// first item where 'beard' is a truthy value +find(arr, 'beard'); // {name:'john', surnname:'doe', beard:true} +``` + +See: [findIndex()](#findIndex), [findLast()](#findLast), +[findLastIndex()](#findLastIndex) + + + +## findLast(arr, callback, [thisObj]):* + +Loops through all the items in the Array (starting from last item) and returns +the first one that passes a truth test (callback). + +```js +var arr = [123, {a:'b'}, 'foo', 'bar']; +findLast(arr, isString); // "bar" +findLast(arr, isNumber); // 123 +findLast(arr, isObject); // {a:'b'} +``` + +`findLast` also supports shorthand notation: + +```js +var users = [ + {name:'john', surname:'connor', beard:false}, + {name:'john', surname:'doe', beard:true} +]; +// last item that matches all properties/values pairs +findLast(arr, {name:'john'}); // {name:'john', surnname:'doe', beard:true} +// last item where 'beard' is a truthy value +findLast(arr, 'beard'); // {name:'john', surnname:'doe', beard:true} +``` + +See: [find()](#find), [findIndex()](#findIndex), +[findLastIndex()](#findLastIndex) + + + +## findIndex(arr, iterator, [thisObj]):Number + +Loops through the items in the Array and returns the index of the first one +that passes a truth test (callback). + +Returns `-1` if no item was found that passes the truth test. + +```js +var arr = [1, { a: 1 }, 'foo', 'bar']; +findIndex(arr, isString); // 2 +findIndex(arr, isNumber); // 0 +findIndex(arr, isObject); // 1 +findIndex(arr, isRegExp); // -1 +``` + +`findIndex` also supports shorthand notation: + +```js +var pets = [ + { pet: 'dog', name: 'Sam' }, + { pet: 'dog', name: 'Maggie' } +]; + +findIndex(pets, { pet: 'dog' }); // 0 +findIndex(pets, { name: 'Maggie' }); // 1 +``` + +See: [find()](#find), [findLastIndex()](#findLastIndex) + + + +## findLastIndex(arr, iterator, [thisObj]):Number + +Loops through the items in the Array on the reverse order and returns the index +of the first one that passes a truth test (callback). + +Returns `-1` if no item was found that passes the truth test. + +```js +var arr = [1, { a: 1 }, 'foo', 'bar']; +findLastIndex(arr, isString); // 3 +findLastIndex(arr, isNumber); // 0 +findLastIndex(arr, isObject); // 1 +findLastIndex(arr, isRegExp); // -1 +``` + +`findLastndex` also supports shorthand notation: + +```js +var pets = [ + { pet: 'dog', name: 'Sam' }, + { pet: 'dog', name: 'Maggie' } +]; + +findLastIndex(pets, { pet: 'dog' }); // 1 +findLastIndex(pets, { name: 'Sam' }); // 0 +``` + +See: [find()](#find), [findIndex()](#findIndex) + + + +## flatten(arr, [level]):Array + +Recursively flattens an array. A new array containing all the elements is +returned. If `level` is specified, it will only flatten up to that level. + +### Example + +```js +flatten([1, [2], [3, [4, 5]]]); +// > [1, 2, 3, 4, 5] +flatten([1, [2], [3, [4, 5]]], 1); +// > [1, 2, 3, [4, 5]] +``` + + + +## forEach(arr, callback, [thisObj]):void + +Crossbrowser `Array.forEach()`. + +It allows exiting the iteration early by returning `false` on the callback. + +It differs from ES5 since it will also loop over sparse items in the array to +normalize the behavior across browsers (avoid inconsistencies). + +```js +var items = ['foo', 'bar', 'lorem', 'ipsum']; +forEach(items, function(val, key, arr){ + console.log(key +' : '+ val); + if (val === 'lorem') { + // stop iteration (break) + return false; + } +}); +``` + +more info at [MDN Array#forEach](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach) + + + +## groupBy(arr, [categorize=identity], [thisObj]):Object + +Groups array elements by the `key` returned from the `categorize` function. + +It will use the [function/identity](function.html#identity) as the default +`categorize` function. + +```js +var items = ['lorem', 'ipsum', 'foo', 'bar', 'baz']; +groupBy(items, function(val) { return val.length }); +// > {'3': ['foo', 'bar', 'baz'], '5': ['lorem', 'ipsum']} +``` + + + +## indexOf(arr, item, [fromIndex]):Number + +Crossbrowser `Array.indexOf()`. + +It differs from ES5 since it will also loop over sparse items in the array to +normalize the behavior across browsers (avoid inconsistencies). + +more info at [MDN Array#indexOf](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf) + + + + +## insert(arr, ...items):Number + +Push items into array only if they aren't contained by it. Returns the new +`length` of the array. + +See: [`remove()`](#remove), [`removeAll()`](#removeAll), +[`contains()`](#contains) + +```js +var arr = ['a', 'b']; +insert(arr, 'a'); // 2 : ['a', 'b'] +insert(arr, 'c'); // 3 : ['a', 'b', 'c'] +insert(arr, 1, 2, 'b'); // 5 : ['a', 'b', 'c', 1, 2] +``` + + + +## intersection(...arrs):Array + +Return a new Array with elements common to all Arrays. + +Similar to Python set#intersection and underscore.js intersection. + +It will remove duplicates. + +See: [`difference()`](#difference), [`xor()`](#xor) + +```js +var a = ['a', 'b', 1], + b = ['c', 1], + c = [1, 2, 3]; +intersection(a, b, c); // [1] +``` + + + +## invoke(arr, methodName[, ...args]):Array + +Call `methodName` on each item of the array passing custom arguments if needed. + +```js +invoke([[3,2,1], [9,5,2]], 'sort'); // [[1,2,3], [2,5,9]] +``` + + + +## join(arr, [separator]):String + +Joins the strings in `arr`, inserting `separator` between each value. + +This ignores null values and empty strings that are in the array. `separator` +defaults to an empty string. This will convert all non-string objects in the +array to a string. + +### Example + +```js +join(['a', 'b', 'c']); // 'abc' +join(['foo', 'bar'], ', '); // 'foo, bar' +join([null, 'foo', '', 'bar', undefined], ':'); // 'foo:bar' +``` + + +## last(arr):* + +Returns the last element of an array without modifying the array. + + +```js +last( [1, 2, 3, 4] ) // > 4 +last( ['foo', 'bar'] ) // > 'bar' +``` + + +## lastIndexOf(arr, item, [fromIndex]):Number + +Crossbrowser `Array.lastIndexOf()`. + +It differs from ES5 since it will also loop over sparse items in the array to +normalize the behavior across browsers (avoid inconsistencies). + +more info at [MDN Array#lastIndexOf](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf) + + + +## map(arr, callback, [thisObj]]):Array + +Crossbrowser `Array.map()`. + +Creates a new array with the results of calling a provided function on every +element in this array. + +It differs from ES5 since it will also loop over sparse items in the array to +normalize the behavior across browsers (avoid inconsistencies). + +See: [`collect()`](#collect) + +```js +var nums = [1,2,3,4]; +var double = map(nums, function(val, key, arr){ + return val * 2; +}); +// > [2, 4, 6, 8] +``` + +more info at [MDN Array#map](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map) + +It also supports a shorthand notation which can be used to achieve same result +as [`array/pluck`](#pluck): + +```js +var src = ['lorem', 'ipsum', 'foo', 'amet']; +// grab the "length" property of all items +var lengths = map(src, 'length'); // [5, 5, 3, 4] +``` + + + +## max(arr, [iterator], [thisObj]):* + +Returns maximum value inside array or use a custom iterator to define how items +should be compared. + +See: [`min()`](#min) + +```js +max([10, 2, 7]); // 10 +max(['foo', 'lorem', 'amet'], function(val){ + return val.length; +}); // 'lorem' +``` + +It also supports a shorthand notation: + +```js +max(['foo', 'lorem', 'amet'], 'length'); // "lorem" +``` + + + +## min(arr, [iterator], [thisObj]):* + +Returns minimum value inside array or use a custom iterator to define how items +should be compared. + +See: [`max()`](#max) + +```js +min([10, 2, 7]); // 2 +min(['foo', 'lorem', 'amet'], function(val){ + return val.length; +}); // 'foo' +``` + +It also supports a shorthand notation: + +```js +min(['foo', 'lorem', 'amet'], 'length'); // "foo" +``` + + + +## pick(arr, [nItems]):* + +Gets random item(s) and removes it from the original array. + +If `nItems` is specified it will return a new Array contained the *picked* +items otherwise it returns a single item. + +See: [`random/choice()`](./random.html#choice) + +### Example: + +```js +var arr = [1, 2, 3, 4, 5, 6]; +var item1 = pick(arr); // 4 +var item2 = pick(arr); // 1 +var items = pick(arr, 2); // [5, 2] +console.log(arr); // [3, 6] +``` + + + +## pluck(arr, propName):Array + +Extract a list of property values. + +See: [`function/prop()`](function.html#prop) + +```js +var users = [{name : 'John', age: 21}, {name: 'Jane', age : 27}]; +var names = pluck(users, 'name'); // ["John", "Jane"] +var ages = pluck(users, 'age'); // [21, 27] +``` + + + +## range([start], stop[, step]):Array + +Creates a new Array with all the values inside the range. Works similarly to +Python#range or PHP#range. + +### Arguments + + 1. `[start]` (Number) : Range start. Default is `0`. + 2. `stop` (Number) : Range limit. + 3. `[step]` (Number) : Step size. Default is `1`. + +### Example + +```js +range(5); // [0, 1, 2, 3, 4, 5] +range(0, 5); // [0, 1, 2, 3, 4, 5] +range(0, 5, 2); // [0, 2, 4] +range(20, 40, 5); // [20, 25, 30, 35, 40] +``` + + + +## reduce(arr, fn):* + +Crossbrowser `Array.reduce()`. + +Apply a function against an accumulator and each value of the array (from +left-to-right) as to reduce it to a single value. + +It differs from ES5 since it will also loop over sparse items in the array to +normalize the behavior across browsers (avoid inconsistencies). + +more info at [MDN Array#reduce](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce) + + + +## reduceRight(arr, fn):* + +Crossbrowser `Array.reduceRight()`. + +Apply a function simultaneously against two values of the array (from +right-to-left) as to reduce it to a single value. + +It differs from ES5 since it will also loop over sparse items in the array to +normalize the behavior across browsers (avoid inconsistencies). + +more info at [MDN Array#reduceRight](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduceRight) + + + +## reject(arr, fn, thisObj):Array + +Creates a new array with all the elements that do **not** pass the truth test. +Opposite of [`filter()`](#filter). + +See [`filter()`](#filter) + +### Example + +```js +var numbers = [1, 2, 3, 4, 5, 6]; +reject(numbers, function(x) { return (x % 2) !== 0; }); // [2, 4, 6] +``` + +It also supports a shorthand syntax: + +```js +var users = [ + {name:'john', surname:'connor', beard:false}, + {name:'john', surname:'doe', beard:true}, + {name:'jane', surname:'doe', beard:false} +]; +// reject items that matches all properties/values pairs +reject(arr, {name:'john'}); +// > [{name:'jane', surnname:'doe', beard:false}] +// reject items where 'beard' is a truthy value +filter(arr, 'beard'); +// > [{name:'john', surnname:'connor', beard:false}, +// {name:'jane', surname:'doe', beard:false}] +``` + + + +## remove(arr, item):void + +Remove a single item from the array. + +IMPORTANT: it won't remove duplicates, just a single item. + +### Example + +```js +var foo = [1, 2, 3, 4]; +remove(foo, 2); +console.log(foo); // [1, 3, 4] +``` + + + +## removeAll(arr, item):void + +Remove all instances of an item from the array. + +### Example + +```js +var foo = [1, 2, 3, 4, 2, 2]; +removeAll(foo, 2); +console.log(foo); // [1, 3, 4]; +``` + + + +## shuffle(arr):Array + +Returns a new Array with items randomly sorted (shuffled). Similar to Ruby Array#shuffle. + +### Example + +```js +var arr = ['a', 'b', 'c', 'd', 'e']; +shuffle(arr); // ['b', 'd', 'e', 'c', 'a'] +``` + + + +## slice(arr, [start], [end]):Array + +Returns a new array containing the items from `arr` from the start index to the +end index. + +If `start` is omitted, it will start at `0`. If `end` is omitted, it will used +the last index of the array. If `start` or `end` is negative, it is used as an +offset from the end of the array. + +It will also convert array-like objects to arrays. + +### Example + +```js +slice([1, 2, 3, 4], 1, 2); // [2, 3] +slice([1, 2, 3], 1); // [2, 3] +slice([1, 2, 3]); // [1, 2, 3] +slice({ length: 2, 0: 'a', 1: 'b' }); // ['a', 'b'] +slice([1, 2, 3], 0, -1); // [1, 2] +slice([1, 2, 3], -2); // [2, 3] +``` + + + +## some(arr, callback, [thisObj]):Array + +Crossbrowser `Array.some()`. + +Tests whether some element in the array passes the test implemented by the provided function. + +It differs from ES5 since it will also loop over sparse items in the array to +normalize the behavior across browsers (avoid inconsistencies). + +```js +var items = [1, 'foo', 'bar']; +some(items, isString); // true +some(items, isFunction); // false +``` + +more info at [MDN Array#some](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some) + +It also supports a shorthand syntax: + +```js +var items = [{id:1, active:true}, {id:3, active:false}, {id:8, active:false}]; +// at least one item with `id === 8` +some(items, {id:8}); // true +// `active` is truthy on at least one item +some(items, 'active'); // true +``` + +see also: [`object/matches`](object.html#matches) + + + +## sort(arr, [compareFn]):Array + +Returns a sorted Array using the [Merge Sort](http://en.wikipedia.org/wiki/Merge_sort) algorithm (stable sort). + +The `Array.prototype.sort` browser implementations differ since the sorting algorithm isn't described in the ES spec - [in V8 it isn't stable](http://code.google.com/p/v8/issues/detail?id=90) and [on Firefox it is stable](https://bugzilla.mozilla.org/show_bug.cgi?id=224128) - so this function doesn't use the browser native implementation and is recommended in cases where a stable sort is required (items should preserve same order if already sorted). + +**Important:** It does logical comparisson by default (greater/less than) and +not a string comparisson like the native `Array#sort`. + +### compareFn + +If `compareFn` is supplied elements are sorted based on the value returned by +the `compareFn`. + + - If `compareFn(a, b)` is less than `0`, sort `a` to a lower index than `b`. + - If `compareFn(a, b)` returns `0`, leave `a` and `b` unchanged with respect + to each other, but sorted with respect to all different elements. + - If `compareFn(a, b)` is greater than `0`, sort `b` to a lower index than + `a`. + +See: [`sortBy`](#sortBy) + +### Example + +```js +sort([187, 23, 47, 987, 12, 59, 0]); // [0, 12, 23, 47, 59, 187, 987] +sort(['a', 'z', 'c', 'beta', 'b']); // ['a', 'b', 'beta', 'c', 'z'] + +// ['sit', 'amet', 'lorem', 'ipsum'] +sort(['lorem', 'ipsum', 'sit', 'amet'], function(a, b){ + // sort by length, items with same length + // will keep the relative order (stable) + return a.length - b.length; +}); + +// [4, 3, 2, 1] +sort([2, 3, 1, 4], function(a, b){ + // reverse sort + return b - a; +}); +``` + + + +## sortBy(arr, callback, [context]):Array + +Returns an array sorted by the result of the callback. + +The callback is called for each item that is to be sorted, and the +results of the callback are used to sort the array. The callback +is called with the item as the first parameter, optionally with +the provided context. + +It also supports a shorthand notation which can be used to sort by a property +name. + +See: [`sort`](#sort) + +```js +// Returns [{ a: 1 }, { a: 2 }, { a: 3 }] +sortBy([{ a: 1 }, { a: 3 }, { a: 2 }], + function(item) { return item.a; }); + +// Same as above, using shorthand notation +sortBy([{ a: 1 }, { a: 3 }, { a: 2 }], 'a'); +``` + + + +## split(arr, [segments]):Array + +Splits an array into a fixed number of segments. + +The number of segments is specified by `segments` and defaults to 2. If the +array cannot be evenly split, the first segments will contain the extra items. +If `arr` is empty, an empty array is returned. If `arr.length` is less than +`segments`, then the resulting array will have `arr.length` number of +single-element arrays. + +### Example +```js +split([1, 2, 3, 4, 5], 3) // [ [1, 2], [3, 4], [5] ] +split([1, 2, 3, 4, 5]) // [ [1, 2, 3], [4, 5] ] +split([]) // [] +split([1, 2], 3) // [ [1], [2] ] +``` + + + +## take(times, callback, [thisObj]):Array + +Builds a new array based on the returned values from the given `callback`. + +```js +take(4, function(i, total) { + return i / total; +}); +// > [0, 0.25, 0.5, 0.75] +``` + +see: [function/times](../function.html#times) + + + +## toLookup(arr, key):Object + +Create an object that indexes the items in the array by a key. If `key` is a function, the key for each value in the resulting object will be the result of calling the function with the value as an argument. Otherwise `key` specifies the property on each value to use as the key. + +### Example + +```js +var foo = [{ name: 'a', thing: 1 }, { name: 'b', thing: 2 }]; +// { a: { name: 'a', thing: 1 }, b: { name: 'b', thing: 2 } } +toLookup(foo, 'name'); +// same as above +toLookup(foo, function (value) { return value.name; }); +``` + + + +## union(...arrs):Array + +Concat multiple arrays removing duplicates. + +```js +var a = ['a', 'b'], + b = ['c', 'a'], + c = [1, 'b', 2, 3, 'a']; + +//note that unique remove from begin to end +union(a, b, c); // ['c', 1, 'b', 2, 3, 'a'] +``` + + + +## unique(arr, [compare]):Array + +Return a new Array of unique items. + +**IMPORTANT:** duplicates are removed starting from begining of array. + +```js +var arr = [1, 2, 3, 4, 2, 2, 4]; +var foo = unique(arr); +console.log(foo); +// > [1, 3, 2, 4]; + +// you also have the option to set a custom compare function +var users = [{name: 'john'}, {name: 'paul'}, {name: 'john'}]; +var uniqueNames = unique(arr, function(a, b){ + return a.name === b.name; +}); +console.log(uniqueNames); +// > [{name: 'paul'}, {name: 'john'}] +``` + + + +## xor(arr1, arr2):Array + +Exclusive OR. Returns items that are present in a single array. + +Works like [Python set#symmetric_difference](http://docs.python.org/library/stdtypes.html#set.symmetric_difference) renamed for brevity. + +It will remove duplicates. + +See: [`difference()`](#difference), [`intersection()`](#intersection) + +```js +var a = ['a', 'b', 1]; +var b = ['c', 1]; +xor(a, b); // ['a', 'b', 'c'] +``` + + + +## zip(...arrs):Array + +Groups the elements of each array at their corresponding indexes. + +Useful for separate data sources that are coordinated through matching array +indexes. For a matrix of nested arrays, `zip.apply(...)` can transpose the +matrix in a similar fashion. + +```js +// [['moe', 30, true], ['larry', 40, false], ['curly', 50, false]] +zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); +``` + + + + +------------------------------------------------------------------------------- + +For more usage examples check specs inside `/tests` folder. Unit tests are the +best documentation you can get... + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/collection.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/collection.md new file mode 100644 index 00000000..2ffcab10 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/collection.md @@ -0,0 +1,233 @@ +# collection # + +Methods for dealing with collections (Array or Objects). + + + +## contains(list, value):Boolean + +Checks if collection contains value. + +```js +contains({a: 1, b: 2, c: 'bar'}, 2); // true +contains([1, 2, 3], 'foo'); // false +``` + +See: [array/contains](array.html#contains), [object/contains](object.html#contains) + + + +## every(list, callback, [thisObj]):Boolean + +Tests whether all values in the collection pass the test implemented by the +provided callback. + +```js +var obj = { + a: 1, + b: 2, + c: 3, + d: 'string' +}; + +every(obj, isNumber); // false +``` + +See: [array/every](array.html#every), [object/every](object.html#every) + + + +## filter(list, callback, [thisObj]):Array + +Filter collection properties. + +See: [array/filter](array.html#filter), [object/filter](object.html#filter) + + + +## find(list, callback, [thisObj]):* + +Loops through all the values in the collection and returns the first one that +passes a truth test (callback). + +**Important:** loop order over objects properties isn't guaranteed to be the +same on all environments. + +```js +find({a: 'foo', b: 12}, isString); // 'foo' +find(['foo', 12], isNumber); // 12 +``` + +See: [array/find](array.html#find), [object/find](object.html#find) + + + +## forEach(list, callback, [thisObj]) + +Loop through all values of the collection. + +See: [array/forEach](array.html#forEach), [object/forOwn](object.html#forOwn) + + + +## map(list, callback, [thisObj]):Array + +Returns a new collection where the properties values are the result of calling +the callback for each property in the original collection. + +See: [array/map](array.html#map), [object/map](object.html#map) + + + +## max(list, [iterator]):* + +Returns maximum value inside collection or use a custom iterator to define how +items should be compared. + +See: [`min()`](#min), [array/max](array.html#max), [object/max](object.html#max) + +```js +max({a: 100, b: 2, c: 1, d: 3, e: 200}); // 200 +max(['foo', 'lorem', 'amet'], function(val){ + return val.length; +}); // 'lorem' +``` + + + +## min(list, [iterator]):* + +Returns minimum value inside collection or use a custom iterator to define how +items should be compared. + +See: [`max()`](#max), [array/min](array.html#min), [object/min](object.html#min) + +```js +min([10, 2, 7]); // 2 +min({a: 'foo', b: 'lorem', c: 'amet'}, function(val){ + return val.length; +}); // 'foo' +``` + + + +## pluck(list, propName):Array + +Extract a list of property values. + +```js +var users = [ + { + name : 'John', + age : 21 + }, + { + name : 'Jane', + age : 27 + } +]; + +pluck(users, 'name'); // ["John", "Jane"] +pluck(users, 'age'); // [21, 27] + +users = { + first: { + name : 'John', + age : 21 + }, + second: { + name : 'Mary', + age : 25 + } +}; + +pluck(users, 'name'); // ['John', 'Mary'] +``` + +See: [array/pluck](array.html#pluck), [object/pluck](object.html#pluck) + + + +## reduce(list, callback, initial, [thisObj]):* + +Apply a function against an accumulator and each value in the collection as to +reduce it to a single value. + +```js +var obj = {a: 1, b: 2, c: 3, d: 4}; + +function sum(prev, cur, key, list) { + return prev + cur; +} + +reduce(obj, sum); // 10 +``` + +See: [array/reduce](array.html#reduce), [object/reduce](object.html#reduce) + + + +## reject(list, fn, [thisObj]):Array + +Creates a new array with all the elements that do **not** pass the truth test. +Opposite of [`filter()`](#filter). + +### Example + +```js +var numbers = [1, 2, 3, 4, 5]; +reject(numbers, function(x) { return (x % 2) !== 0; }); // [2, 4] + +var obj = {a: 1, b: 2, c: 3, d: 4, e: 5}; +reject(obj, function(x) { return (x % 2) !== 0; }); // [2, 4] +``` + +See: [array/reject](array.html#reject), [object/reject](object.html#reject) + + + +## size(list):Number + +Returns the number of values in the collection. + +```js +var obj = { + foo : 1, + bar : 2, + lorem : 3 +}; +size(obj); // 3 +size([1,2,3]); // 3 +size(null); // 0 +``` + +See: [object/size](object.html#size) + + + +## some(list, callback, [thisObj]):Boolean + +Tests whether any values in the collection pass the test implemented by the +provided callback. + +```js +var obj = { + a: 1, + b: 2, + c: 3, + d: 'string' +}; + +some(obj, isNumber); // true +some(obj, isString); // true +some([1, 2, 3], isNumber) // true +some([1, 2, 3], isString) // false +``` + +See: [array/some](array.html#some), [object/some](object.html#some) + + +------------------------------------------------------------------------------- + +For more usage examples check specs inside `/tests` folder. Unit tests are the +best documentation you can get... diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/date.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/date.md new file mode 100644 index 00000000..e1403991 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/date.md @@ -0,0 +1,307 @@ +# date # + +Date utilities. + + +## dayOfTheYear(date):Number + +How many days elapsed since begining of the year (following gregorian +calendar). + +```js +// Jan 1st +dayOfTheYear(new Date(2013, 0, 1)); // 1 +// Dec 31th +dayOfTheYear(new Date(2013, 11, 31)); // 364 +``` + + + +## diff(date1, date2, [unitName]):Number + +Calculate the difference between dates (range). + +The returned value is always positive. The default `unitName` is `"ms"`. + +Available units: `year`, `month`, `week`, `day`, `hour`, `minute`, `second`, +`millisecond`. + +See: [`time/convert()`](time.html#convert) + +```js +var d1 = new Date(2012, 4, 5); +var d2 = new Date(2013, 4, 8); +diff(d1, d2); // 31795200000 +diff(d1, d2, 'hour'); // 8832 +diff(d1, d2, 'week'); // 52.57142857142857 +diff(d1, d2, 'month'); // 12.096774193548388 +diff(d1, d2, 'year'); // 1.0082191780821919 +``` + + + +## isLeapYear(fullYear|date):Boolean + +Checks if it's a [leap year](http://en.wikipedia.org/wiki/Leap_year) according +to the Gregorian calendar. + +see: [`totalDaysInMonth()`](#totalDaysInMonth) + +```js +isLeapYear(2012); // true +isLeapYear(2013); // false +isLeapYear(new Date(2012, 2, 28)); // true +``` + + +## isSame(date1, date2[, period]):Boolean + +Check if both dates are the "same". + +You can pass an optional *period* used to set the comparisson precision. + +Available periods: `year`, `month`, `week`, `day`, `hour`, `minute`, `second`. + +```js +var date1 = new Date(2013, 1, 3); +var date2 = new Date(2013, 2, 9); +isSame(date1, date2); // false +isSame(date1, date2, 'day'); // false +isSame(date1, date2, 'month'); // false +isSame(date1, date2, 'year'); // true +``` + + + +## parseIso(str):Number + +Parses an [ISO8601](http://en.wikipedia.org/wiki/Iso8601) date and returns the +number of milliseconds since January 1, 1970, 00:00:00 UTC, or `NaN` if it is +not a valid ISO8601 date. + +This parses *all* ISO8601 dates, including dates without times, [ordinal +dates](https://en.wikipedia.org/wiki/ISO_8601#Ordinal_dates), and the compact +representation (omitting delimeters). The only exception is [ISO week +dates](https://en.wikipedia.org/wiki/ISO_week_date), which are not parsed. + +If no time zone offset is specified, it assumes UTC time. + +```js +// Jan 01, 1970 00:00 GMT +parseIso('1970-01-01T00:00:00') // 0 +parseIso('1970-001') // 0 +parseIso('1970-01-01') // 0 +parseIso('19700101T000000.00') // 0 +parseIso('1970-01-01T02:00+02:00') // 0 + +// Jan 02, 2000 20:10 GMT+04:00 +parseIso('2000-01-02T20:10+04:00') // 946829400000 +``` + + +## quarter(date):Number + +Get a number between 1 to 4 that represents the quarter of the year. + +```js +quarter(new Date(2013, 1, 19)); // 1 +quarter(new Date(2013, 4, 12)); // 2 +quarter(new Date(2013, 7, 25)); // 3 +quarter(new Date(2013, 10, 8)); // 4 +``` + + +## startOf(date, period):Date + +Get a new Date at the start of the period. + +Available periods: `year`, `month`, `week`, `day`, `hour`, `minute`, `second`. + +```js +// Apr 05 2013 11:27:43 +var date = new Date(2013, 3, 5, 11, 27, 43, 123); +startOf(date, 'year'); // Jan 01 2013 00:00:00 +startOf(date, 'month'); // Apr 01 2013 00:00:00 +startOf(date, 'day'); // Apr 05 2013 00:00:00 +startOf(date, 'hour'); // Apr 05 2013 11:00:00 +``` + + + +## strftime(date, format, [l10n]):String + +Format date based on strftime format. + +Replaced tokens: + +
+
%a
locale's abbreviated weekday name.
+
%A
locale's full weekday name.
+
%b
locale's abbreviated month name.
+
%B
locale's full month name.
+
%c
locale's appropriate date and time representation.
+
%C
century number (the year divided by 100 and truncated +to an integer) as a decimal number [00..99].
+
%d
day of the month as a decimal number [01..31].
+
%D
same as %m/%d/%y.
+
%e
day of the month as a decimal number [1..31]; +a single digit is preceded by a space.
+
%F
The ISO 8601 date format (%Y-%m-%d)
+
%h
same as %b.
+
%H
hour (24-hour clock) as a decimal number [00..23].
+
%I
hour (12-hour clock) as a decimal number [01..12].
+
%j
day of the year as a decimal number [001..366].
+
%l
hour (12-hour clock) as a decimal number (range 1 to 12); single digits are preceded by a blank
+
%L
zero-padded milliseconds [000..999]
+
%m
month as a decimal number [01..12].
+
%M
minute as a decimal number [00..59].
+
%n
newline character.
+
%p
locale's equivalent of either "am" or "pm"
+
%P
locale's equivalent of either "AM" or "PM"
+
%r
time in a.m. and +p.m. notation; in the POSIX locale this is equivalent to %I:%M:%S %p.
+
%R
time in 24 hour notation (%H:%M).
+
%s
seconds since Epoch (1970-01-01 00:00:00 UTC)
+
%S
second as a decimal number [00..60].
+
%t
tab character.
+
%T
time (%H:%M:%S).
+
%u
weekday as a decimal number [1..7], with 1 representing +Monday.
+
%U
week number of the year (Sunday as the first day of +the week) as a decimal number [00..53].
+
%V
week number of the year (Monday as the first day of the +week) as a decimal number [01..53]. If the week containing 1 January has +four or more days in the new year, then it is considered week 1. Otherwise, +it is the last week of the previous year, and the next week is week 1.
+
%w
weekday as a decimal number [0..6], with 0 representing +Sunday.
+
%W
week number of the year (Monday as the first day of +the week) as a decimal number [00..53]. All days in a new year preceding +the first Monday are considered to be in week 0.
+
%x
locale's appropriate date representation.
+
%X
locale's appropriate time representation.
+
%y
year without century as a decimal number [00..99].
+
%Y
year with century as a decimal number.
+
%Z
timezone name or abbreviation, or by no bytes +if no timezone information exists.
+
%%
is replaced by %.
+
+ +```js +var date = new Date(2013, 3, 8, 9, 2, 4); +strftime(date, '%Y-%m-%d'); // "2013-04-08" +strftime(date, '%R'); // "09:02" +strftime(date, '%Y-%m-%dT%H:%M:%S%z'); // "2013-04-08T09:02:04+0000" +``` + +You can also set a custom locale: + +```js +var ptBr = require('mout/date/i18n/pt-BR'); +strftime(date, '%a, %d %b', ptBr); // 'Seg, 08 Abr' +strftime(date, '%A, %d %B', ptBr); // 'Segunda, 08 Abril' +``` + +To set it globally: + +```js +require('mout/date/i18n_').set( customLocaleData ); +``` + +See [date/i18n](https://github.com/mout/mout/tree/master/src/date/i18n) +for localization examples. + + + +## timezoneAbbr(date):String + +Return timezone abbreviation or similar data. + +The result will vary based on the OS/browser since some environments doesn't +provide enough info about the current locale. + +```js +// IE 7-8 +timezoneAbbr(new Date()); // "-0500" +// Chrome, FF, V8 +timezoneAbbr(new Date()); // "EST" +``` + + + +## timezoneOffset(date):String + +Return time zone as hour and minute offset from UTC (e.g. +0900). + +It's important to note that JavaScript Date object will use the system locale +info to determinate the [timezone +offset](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset) +and that daylight saving time affects the result. + +```js +// if system locale is EST +timezoneOffset(new Date()); // -0500 +``` + + + +## totalDaysInMonth(fullYear, monthIndex):Number + +Returns the amount of days in the month taking into consideration leap years +(following Gregorian calendar). + +see: [`isLeapYear()`](#isLeapYear) + +```js +totalDaysInMonth(2008, 1); // 29 (leap year) +totalDaysInMonth(2009, 1); // 28 + +// you can also pass a Date object as single argument +totalDaysInMonth( new Date(2013, 0, 1) ); // 31 +``` + + +## totalDaysInYear(fullYear):Number + +Returns the amount of days in the year taking into consideration leap years +(following Gregorian calendar). + +see: [`isLeapYear()`](#isLeapYear), [`totalDaysInMonth()`](#totalDaysInMonth) + +```js +totalDaysInYear(2008); // 366 (leap year) +totalDaysInYear(2009); // 365 + +// you can also pass a Date object as single argument +totalDaysInYear( new Date(2013, 0, 1) ); // 365 +``` + + + +## weekOfTheYear(date, [firstDayOfWeek]):Number + +Returns how many weeks elapsed since start of the year (`0..53`). + +`firstDayOfWeek` can be `0` (Sunday) or `1` (Monday). By default weeks start at +Sunday. + +It will return `0` if `date` is before the first `firstDayOfWeek` of the year. + +```js +// Tue Jan 01 2013 +weekOfTheYear( new Date(2013,0,1) ); // 0 +// Wed Jan 09 2013 +weekOfTheYear( new Date(2013,0,9) ); // 1 +// Sun Jan 01 2012 +weekOfTheYear( new Date(2012,0,1) ); // 1 +// Mon Jan 09 2012 +weekOfTheYear( new Date(2012,0,9) ); // 2 +``` + + + +------------------------------------------------------------------------------- + +For more usage examples check specs inside `/tests` folder. Unit tests are the +best documentation you can get... + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/function.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/function.md new file mode 100644 index 00000000..bc9663d1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/function.md @@ -0,0 +1,293 @@ +# function # + +Function*(al)* utilities. + + +## awaitDelay(fn, delay):Function + +Returns a function that ensures that `fn` is only called *after* `delay` +milliseconds have elapsed. When the returned function is called before the +delay has elapsed, it will wait until the delay has elapsed and then call `fn`. +When the returned function is called after the delay has elapsed, it will call +`fn` after the next "tick" (it will always be called asynchronously). The +context and arguments that the returned function is called in are applied to +`fn`. + +In the below example `onLoaded` will not be executed before a 1000 millisecond +delay. Even if `loadImages` loads and calls `callback` earlier. However, say +the images take 1500 milliseconds to load, it will trigger `onLoaded` +immediately. + +```js +var callback = after(onLoaded, 1000); +loadImages(callback); +function onLoaded(){ + console.log('loaded'); +} +``` + +You can also cancel de delayed call by simply using the native `clearTimeout` +method (like a regular `setTimeout` call). + +```js +var timeoutId = callback(); +// onLoaded won't be called since it was canceled before the 1000ms delay +clearTimeout(timeoutId); +``` + +### Arguments: + + 1. `fn` (Function) : Target Function + 2. `delay` (Number) : Delay of execution in milliseconds + +See: [`debounce()`](#debounce) + + + +## bind(fn, context, [...args]):Function + +Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection. + +### Arguments + + 1. `fn` (Function) : Target Function + 2. `context` (Object) : Execution context (object used as `this`) + 3. `[...args]` (*) : Arguments (0...n arguments) + +See: [`partial()`](#partial), [object/bindAll](./object.html#bindAll) + + + +## compose(...fn):Function + +Returns the composition of a list of functions, where each function consumes +the return value of the function that follows. In math terms, composing the +functions `f()`, `g()`, and `h()` produces `f(g(h()))`. + +```js +function add2(x) { return x + 2 } +function multi2(x) { return x * 2 } +map([1, 2, 3], compose(add2, multi2)); // [4, 6, 8] + +//same as +map([1, 2, 3], function(x){ + return add2( multi2(x) ); +}); +``` + + + +## constant(value):Function + +Returns a new function that will always return `value` when called. + +```js +var f = constant('foo'); +f(); // 'foo' + +// Provided arguments are ignored; value is always returned +f(1); // 'foo' + +f = constant({ foo: 'bar' }); +f(); // { foo: 'bar' } +``` + + + +## debounce(fn, delay[, isAsap]):Function + +Creates a function that will delay the execution of `fn` until after `delay` +milliseconds have elapsed since the last time it was invoked. + +Subsequent calls to the debounced function will return the result of the last +`fn` call. + +```js +// sometimes less is more +var lazyRedraw = debounce(redraw, 300); +foo.on.resize.add(lazyRedraw); +``` + +In this visualization, `|` is a debounced-function call and `X` is the actual +callback execution: + + Default + ||||||||||||||||||||||||| (pause) ||||||||||||||||||||||||| + X X + + Debounced with `isAsap == true`: + ||||||||||||||||||||||||| (pause) ||||||||||||||||||||||||| + X X + +You also have the option to cancel the debounced call if it didn't happen yet: + +```js +lazyRedraw(); +// lazyRedraw won't be called since `cancel` was called before the `delay` +lazyRedraw.cancel(); +``` + +See: [`throttle()`](#throttle) + + +## func(name):Function + +Returns a function that calls a method with given `name` on supplied object. +Useful for iteration methods like `array/map` and `array/forEach`. + +See: [`prop()`](#prop) + +```js +// will call the method `getName()` for each `user` +var names = map(users, func('getName')); +``` + + + +## identity(val):* + +Returns the first argument provided to it. + +```js +identity(3); // 3 +identity(1,2,3); // 1 +identity('foo'); // "foo" +``` + + + +## partial(fn, [...args]):Function + +Return a partially applied function supplying default arguments. + +This method is similar to [`bind`](#bind), except it does not alter the this +binding. + +### Arguments + + 1. `fn` (Function) : Target Function + 2. `[...args]` (*) : Arguments (0...n arguments) + +See: [`bind()`](#bind) + +```js +function add(a, b){ return a + b } +var add10 = partial(add, 10); +console.log( add10(2) ); // 12 +``` + + + +## prop(name):Function + +Returns a function that gets a property with given `name` from supplied object. +Useful for using in conjunction with `array/map` and/or for creating getters. + +See: [`array/pluck()`](array.html#pluck) + +```js +var users = [{name:"John", age:21}, {name:"Jane", age:25}]; +// ["John", "Jane"] +var names = map(users, prop('name')); +``` + + + +## series(...fn):Function + +Returns a function that will execute all the supplied functions in order and +passing the same parameters to all of them. Useful for combining multiple +`array/forEach` into a single one and/or for debugging. + +```js +// call `console.log()` and `doStuff()` for each item item in the array +forEach(arr, series(console.log, doStuff)); +``` + + + +## throttle(fn, interval):Function + +Creates a function that, when executed, will only call the `fn` function at +most once per every `interval` milliseconds. + +If the throttled function is invoked more than once during the wait timeout, +`fn` will also be called on the trailing edge of the timeout. + +Subsequent calls to the throttled function will return the result of the last +`fn` call. + +```js +// sometimes less is more +var lazyRedraw = throttle(redraw, 300); +foo.on.resize.add(lazyRedraw); +``` + +In this visualization, `|` is a throttled-function call and `X` is the actual +`fn` execution: + + ||||||||||||||||||||||||| (pause) ||||||||||||||||||||||||| + X X X X X X X X X X X X + +You also have the option to cancel the throttled call if it didn't happen yet: + +```js +lazyRedraw(); +setTimeout(function(){ + lazyRedraw(); + // lazyRedraw will be called only once since `cancel` was called before + // the `interval` for 2nd call completed + lazyRedraw.cancel(); +}, 250); +``` + +See: [`debounce()`](#debounce) + + +## timeout(fn, millis, context, [...args]):Number + +Functions as a wrapper for `setTimeout`. Calls a the function `fn` after a given delay `millis` in milliseconds. +The function is called within the specified context. The return value can be used to clear the timeout using `clearTimeout`. + +```js +var id = timeout(doStuff, 300, this); + +clearTimeout(id); +``` + +## times(n, callback, [context]):void + +Iterates over a callback `n` times. + +### Arguments + + 1. `n` (Number) : Number of iterations + 2. `callback` (Function) : Closure executed for every iteration + 3. `context` (Object) : Execution context (object used as `this`) + +```js +var output = ''; +times(5, function(i) { + output += i.toString(); +}); +// output: 01234 +``` + +## wrap(fn, wrapper):Function + +Wraps the first `fn` inside of the `wrapper` function, passing it as the first argument. This allows the `wrapper` to execute code before and after the `fn` runs, adjust the arguments, and execute it conditionally. + +```js +var hello = function(name) { return "hello: " + name; }; +hello = wrap(hello, function(func) { + return "before, " + func("moe") + ", after"; +}); +hello(); +// output: 'before, hello: moe, after' +``` + +See: [`partial()`](#partial) +------------------------------------------------------------------------------- + +For more usage examples check specs inside `/tests` folder. Unit tests are the +best documentation you can get... diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/lang.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/lang.md new file mode 100644 index 00000000..9324968d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/lang.md @@ -0,0 +1,516 @@ +# lang # + +Language Utilities. Easier inheritance, scope handling, type checks. + + + +## clone(val):* + +Clone native types like Object, Array, RegExp, Date and primitives. + +This method will not clone values that are referenced within `val`. It will +only copy the value reference to the new value. If the value is not a plain +object but is an object, it will return the value unchanged. + +### Example + +```js +var a = { foo: 'bar' }; +var b = clone(a); +console.log(a === b); // false +console.log(a.foo === b.foo); // true + +var c = [1, 2, 3]; +var d = clone(b); +console.log(c === d); // false +console.log(c); // [1, 2, 3] +``` + +See: [`deepClone()`](#deepClone) + + + +## createObject(parent, [props]):Object + +Create Object using prototypal inheritance and setting custom properties. + +Mix between [Douglas Crockford Prototypal Inheritance](http://javascript.crockford.com/prototypal.html) and [`object/mixIn`](./object.html#mixIn). + +### Arguments + + 1. `parent` (Object) : Parent Object + 2. `[props]` (Object) : Object properties + +### Example + +```js +var base = { + trace : function(){ + console.log(this.name); + } +}; + +var myObject = createObject(base, { + name : 'Lorem Ipsum' +}); + +myObject.trace(); // "Lorem Ipsum" +``` + + + +## ctorApply(constructor, args):Object + +Do `Function.prototype.apply()` on a constructor while maintaining prototype +chain. + +```js +function Person(name, surname) { + this.name = name; + this.surname = surname; +} + +Person.prototype.walk = function(){ + console.log(this.name +' is walking'); +}; + +var args = ['John', 'Doe']; + +// "similar" effect as calling `new Person("John", "Doe")` +var john = ctorApply(Person, args); +john.walk(); // "John is walking" +``` + + + +## deepClone(val, [instanceClone]):* + +Deep clone native types like Object, Array, RegExp, Date and primitives. + +The `instanceClone` function will be invoked to clone objects that are not +"plain" objects (as defined by [`isPlainObject`](#isPlainObject)) if it is +provided. If `instanceClone` is not specified, it will not attempt to clone +non-plain objects, and will copy the object reference. + +### Example + +```js +var a = {foo:'bar', obj: {a:1, b:2}}; +var b = deepClone(a); // {foo:'bar', obj: {a:1, b:2}} +console.log( a === b ); // false +console.log( a.obj === b.obj ); // false + +var c = [1, 2, [3, 4]]; +var d = deepClone(c); // [1, 2, [3, 4]] +var e = c.concat(); // [1, 2, [3, 4]] + +console.log( c[2] === d[2] ); // false +// concat doesn't do a deep clone, arrays are passed by reference +console.log( e[2] === d[2] ); // true + +function Custom() { } +function cloneCustom(x) { return new Custom(); } +var f = { test: new Custom() }; +var g = deepClone(f, cloneCustom); +g.test === f.test // false, since new Custom instance will be created +``` + +See: [`clone()`](#clone) + + + +## deepEquals(a, b, [callback]):Boolean + +Recursively tests whether two values contains the same keys and values. + +`callback` specifies the equality comparison function used to compare +non-object values. It defaults to using the [`is()`](#is) function. + +If the values are both an object or array, it will recurse into both values, +checking if their keys/values are equal. It will only check the keys and values +contained by the objects; it will not check the objects' prototypes. If either +of the values are not objects, they will be checked using the `callback` +function. + +Example: + +```js +deepEquals({ a: 1 }, { a: 1 }); // true +deepEquals({ value: { a: 1 } }, { value: { a: 1 } }); // true +deepEquals({ value: { a: 1 } }, { value: { a: 2 } }); // false +deepEquals({ value: { a: 1 } }, { value: { a: 1, b: 2 } }); // false +deepEquals({}, null); // false +deepEquals(null, null); // true +deepEquals( + { a: { b: 1 } }, + { a: { b: '1' } }, + function(a, b) { return a == b; }); // true +``` + +See: [object/equals](object.html#equals), [array/equals](array.html#equals) + + + +## defaults(val, ...defaults):void + +Return first value that isn't `null` or `undefined`. + + function doSomethingAwesome(foo, bar) { + // default arguments + foo = defaults(foo, 'lorem'); + bar = defaults(bar, 123); + // ... + } + + + +## GLOBAL:Object + +Reference to the global context (`window` inside a browser, `global` on +node.js). Works on ES3 and ES5 strict-mode. + + + +## inheritPrototype(childCtor, parentCtor):Object + +Inherit the prototype methods from one constructor into another. + +Similar to [node.js util/inherits](http://nodejs.org/docs/latest/api/util.html#util_util_inherits_constructor_superconstructor). + +It returns the the `childCtor.prototype` for convenience. + +```js +function Foo(name){ + this.name = name; +} +Foo.prototype = { + getName : function(){ + return this.name; + } +}; + +function Bar(name){ + Foo.call(this, name); +} +//should be called before calling constructor +var proto = inheritPrototype(Bar, Foo); + +// for convenience we return the new prototype object +console.log(proto === Bar.prototype); // true + +var myObj = new Bar('lorem ipsum'); +myObj.getName(); // "lorem ipsum" + +console.log(myObj instanceof Foo); // true + +// you also have access to the "super" constructor +console.log(Bar.super_ === Foo); // true +``` + + +## is(x, y):Boolean + +Check if both values are identical/egal. + +```js +// wtfjs +NaN === NaN; // false +-0 === +0; // true + +is(NaN, NaN); // true +is(-0, +0); // false +is('a', 'b'); // false +``` + +See: [`isnt()`](#isnt) + + + +## isnt(x, y):Boolean + +Check if both values are not identical/egal. + +```js +// wtfjs +NaN === NaN; // false +-0 === +0; // true + +isnt(NaN, NaN); // false +isnt(-0, +0); // true +isnt('a', 'b'); // true +``` + +See: [`is()`](#is) + + + + +## isArguments(val):Boolean + +If value is an "Arguments" object. + + + +## isArray(val):Boolean + +If value is an Array. Uses native ES5 `Array.isArray()` if available. + + + +## isBoolean(val):Boolean + +If value is a Boolean. + + + +## isDate(val):Boolean + +If value is a Date. + + + +## isEmpty(val):Boolean + +Checks if Array/Object/String is empty. + +Will return `true` for any object that doesn't contain enumerable properties +and also to any type of value that isn't considered a collection (boolean, +null, undefined, function, etc). + +```js +isEmpty(''); // true +isEmpty('bar'); // false +isEmpty([]); // true +isEmpty([1, 2]); // false +isEmpty({}); // true +isEmpty({a:1, b:2}); // false +// null, undefined, booleans, numbers are considered as "empty" values +isEmpty(null); // true +isEmpty(undefined); // true +isEmpty(123); // true +isEmpty(true); // true +``` + + +## isFinite(val):Boolean + +Checks if value is Finite. + +**IMPORTANT:** This is not the same as native `isFinite`, which will return +`true` for values that can be coerced into finite numbers. See +http://es5.github.com/#x15.1.2.5. + +```js +isFinite(123); // true +isFinite(Infinity); // false + +// this is different than native behavior +isFinite(''); // false +isFinite(true); // false +isFinite([]); // false +isFinite(null); // false +``` + + +## isFunction(val):Boolean + +If value is a Function. + + + +## isKind(val, kind):Boolean + +If value is of "kind". (used internally by some of the *isSomething* checks). + +Favor the other methods since strings are commonly mistyped and also because +some "kinds" can only be accurately checked by using other methods (e.g. +`Arguments`), some of the other checks are also faster. + +```js +isKind([1,2], 'Array'); // true +isKind(3, 'Array'); // false +isKind(3, 'Number'); // true +``` + +See: [`kindOf()`](#kindOf) + + + +## isInteger(val):Boolean + +Check if value is an integer. + +```js +isInteger(123); // true +isInteger(123.45); // false +isInteger({}); // false +isInteger('foo'); // false +isInteger('123'); // false +``` + + + +## isNaN(val):Boolean + +Check if value is not a number. + +It doesn't coerce value into number before doing the check, giving better +results than native `isNaN`. Returns `true` for everything besides numeric +values. + +**IMPORTANT:** behavior is very different than the native `isNaN` and way more +useful!!! See: http://es5.github.io/#x15.1.2.4 + +```js +isNaN(123); // false + +isNaN(NaN); // true +isNaN({}); // true +isNaN(undefined); // true +isNaN([4,5]); // true + +// these are all "false" on native isNaN and main reason why this module exists +isNaN(''); // true +isNaN(null); // true +isNaN(true); // true +isNaN(false); // true +isNaN("123"); // true +isNaN([]); // true +isNaN([5]); // true +``` + + + +## isNull(val):Boolean + +If value is `null`. + + + +## isNumber(val):Boolean + +If value is a Number. + + + +## isObject(val):Boolean + +If value is an Object. + + + +## isPlainObject(val):Boolean + +If the value is an Object created by the Object constructor. + + + +## isRegExp(val):Boolean + +If value is a RegExp. + + + +## isString(val):Boolean + +If value is a String. + + + +## isUndefined(val):Boolean + +If value is `undefined`. + + + +## kindOf(val):String + +Gets kind of value (e.g. "String", "Number", "RegExp", "Null", "Date"). +Used internally by `isKind()` and most of the other *isSomething* checks. + +```js +kindOf([1,2]); // "Array" +kindOf('foo'); // "String" +kindOf(3); // "Number" +``` + +See: [`isKind()`](#isKind) + + +## toArray(val):Array + +Convert array-like object into Array or wrap value into Array. + +```js +toArray({ + "0" : "foo", + "1" : "bar", + "length" : 2 +}); // ["foo", "bar"] + +function foo(){ + return toArray(arguments); +} +foo("lorem", 123); // ["lorem", 123] + +toArray("lorem ipsum"); // ["lorem ipsum"] +toArray(window); // [window] +toArray({foo:"bar", lorem:123}); // [{foo:"bar", lorem:123}] +``` + +See: object/values() + + + +## toNumber(val):Number + +Convert value into number. + +```js +// numeric values are typecasted as Number +toNumber('123'); // 123 +toNumber(-567); // -567 + +// falsy values returns zero +toNumber(''); // 0 +toNumber(null); // 0 +toNumber(undefined); // 0 +toNumber(false); // 0 + +// non-numeric values returns NaN +toNumber('asd'); // NaN +toNumber({}); // NaN +toNumber([]); // NaN + +// Date objects return milliseconds since epoch +toNumber(new Date(1985, 6, 23)); // 490935600000 +``` + + + +## toString(val):String + +Convert any value to its string representation. + +Will return an empty string for `undefined` or `null`, otherwise will convert +the value to its string representation. + +```js +// null and undefined are converted into empty strings +toString(null); // "" +toString(undefined); // "" + +toString(1); // "1" +toString([1,2,3]); // "1,2,3" +toString(false); // "false" + +// uses `val.toString()` to convert value +toString({toString:funtion(){ return 'foo'; }}); // "foo" +``` + + + +------------------------------------------------------------------------------- + +For more usage examples check specs inside `/tests` folder. Unit tests are the +best documentation you can get... diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/math.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/math.md new file mode 100644 index 00000000..d6b9994b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/math.md @@ -0,0 +1,303 @@ +# math # + +Math utilities. + + +## ceil(val[, step]):Number + +Round value up to full steps. Similar to `Math.ceil()` but can round value +to an arbitrary *radix*. + + ceil(7.2); // 8 + ceil(7.8); // 8 + ceil(7, 5); // 10 + ceil(11, 5); // 15 + ceil(15, 5); // 15 + +### Common use cases + +Round values by increments of 5/10/1000/etc. + +See: [`round()`](#round), [`floor()`](#floor), [`countSteps()`](#countSteps) + + + +## clamp(val, min, max):Number + +Clamps value inside range. + +`clamp()` is extremely useful in cases where you need to limit a value inside +a certain range. So instead of doing a complex `if/else` to filter/process the +value you can restrict it to always be inside the desired range: + + clamp(-5, 0, 10); // 0 + clamp(7, 1, 10); // 7 + clamp(8, 1, 10); // 8 + clamp(10, 1, 10); // 10 + clamp(11, 1, 10); // 10 + +If the value is smaller than `min` it returns the `min`, if `val` is higher +than `max` it returns `max`. + +### Common use cases + +Any situation where you need to limit a number inside a range like: slider +position, image galleries (so user can't skip to an image that doesn't +exist), drag and drop, scroll boundaries, etc. + +See: [`loop()`](#loop) + + + + +## countSteps(val, step[, overflow]):Number + +Count number of full steps. + +### Arguments: + + 1. `val` (Number) : Value. + 2. `step` (Number) : Step size. + 3. `[overflow]` (Number) : Maximum number of steps, nSteps will loop if +`>=` than overflow. + + +Count steps is very useful for cases where you need to know how many "full +steps" the number *completed*. Think of it as a division that only returns +integers and ignore remainders. + + countSteps(3, 5); // 0 + countSteps(6, 5); // 1 + countSteps(12, 5); // 2 + countSteps(18, 5); // 3 + countSteps(21, 5); // 4 + +You can also set an `overflow` which will reset the *counter* before reaching +this number. + + countSteps(3, 5, 3); // 0 + countSteps(6, 5, 3); // 1 + countSteps(12, 5, 3); // 2 + countSteps(18, 5, 3); // 0 + countSteps(21, 5, 3); // 1 + +### Common use cases + +#### How many items fit inside an area: + + var containerWidth = 100; + var itemWidth = 8; + var howManyFit = countSteps(containerWidth, itemWidth); // 12 + +#### Split value into different scales or convert value from one scale to another + +From [mout/time/parseMs](time.html#parseMs): + + function parseMs(ms){ + return { + milliseconds : countSteps(ms, 1, 1000), + seconds : countSteps(ms, 1000, 60), + minutes : countSteps(ms, 60000, 60), + hours : countSteps(ms, 3600000, 24), + days : countSteps(ms, 86400000) + }; + } + + // {days:27, hours:4, minutes:26, seconds:5, milliseconds:454} + parseMs(2348765454); + + + +## floor(val[, step]):Number + +Round value down to full steps. Similar to `Math.floor()` but can round value +to an arbitrary *radix*. (formerly `snap`) + + floor(7.2); // 7 + floor(7.8); // 7 + floor(7, 5); // 5 + floor(11, 5); // 10 + floor(15, 5); // 15 + +### Common use cases + +Round values by increments of 5/10/1000/etc. + +See: [`round()`](#round), [`ceil()`](#ceil), [`countSteps()`](#countSteps) + + + +## inRange(val, min, max[, threshold]):Boolean + +Checks if value is inside the range. + + inRange(-6, 1, 10); // false + inRange( 5, 1, 10); // true + inRange(12, 1, 10); // false + +The threshold can be useful when you want granular control of what should match +and/or the precision could change at runtime or by some configuration option, +avoids the clutter of adding/subtracting the `threshold` from `mix` and `max`. + + inRange(12, 1, 10, 2); // true + inRange(13, 1, 10, 2); // false + +### Common use cases + +Anything that needs to check if value is inside a range, be it collision +detection, limiting interaction by mouse position, ignoring parts of the logic +that shouldn't happen if value isn't valid, simplify `if/else` conditions, +making code more readable, etc... + + + + +## isNear(val, target, threshold):Boolean + +Check if value is close to target. + +Similar to `inRange()` but used to check if value is close to a certain value +or match the desired value. Basically to simplify `if/else` conditions and to +make code clearer. + + isNear( 10.2, 10, 0.5); // true + isNear( 10.5, 10, 0.5); // true + isNear(10.51, 10, 0.5); // false + +### Common use cases + +Games where a certain action should happen if an *actor* is close to a target, +gravity fields, any numeric check that has some tolerance. + + + + +## lerp(ratio, start, end):Number + +Linear interpolation. + + lerp(0.5, 0, 10); // 5 + lerp(0.75, 0, 10); // 7.5 + +### Common use cases + +Linear interpolation is commonly used to create animations of elements moving +from one point to another, where you simply update the current ratio (which in +this case represents time) and get back the position of the element at that +"frame". + +The core idea of `lerp` is that you are using a number that goes from `0` to +`1` to specify a ratio inside that scale. This concept can be applied to +convert numbers from different scales easily. + +See: [`map()`](#map), [`norm()`](#norm) + + + + +## loop(val, min, max):Number + +Loops value inside range. Will return `min` if `val > max` and `max` if `val +< min`, otherwise it returns `val`. + + loop(-1, 0, 10); // 10 + loop( 1, 0, 10); // 1 + loop( 5, 0, 10); // 5 + loop( 9, 0, 10); // 9 + loop(10, 0, 10); // 10 + loop(11, 0, 10); // 0 + +Similar to [`clamp()`](#clamp) but *loops* the value inside the range when an +overflow occurs. + +### Common use cases + +Image galleries, infinite scroll, any kind of logic that requires that the +first item should be displayed after the last one or the last one should be +displayed after first if going on the opposite direction. + +See: [`clamp()`](#clamp) + + + + +## map(val, min1, max1, min2, max2):Number + +Maps a number from one scale to another. + + map(3, 0, 4, -1, 1) // 0.5 + map(3, 0, 10, 0, 100) // 30 + +### Common use cases + +Very useful to convert values from/to multiple scales. + +Let's suppose we have a slider that needs to go from `2000` to `5000` and that slider +has `300px` of width, here is how we would translate the knob position into the +current value: + + var knobX = 123; + var sliderWid = 300; + var minVal = 2000; + var maxVal = 5000; + + var curVal = map(knobX, 0, sliderWid, minVal, maxVal); // 3230 + +See: [`lerp()`](#lerp), [`norm()`](#norm) + + + + +## norm(val, min, max):Number + +Gets normalized ratio of value inside range. + +If `val < min` or `val > max` it will throw a `RangeError` since we can't +normalize the value. + + norm(50, 0, 100); // 0.5 + norm(75, 0, 100); // 0.75 + norm(100, 0, 100); // 1 + norm(-50, 0, 100); // RangeError: value (-50) must be between 0 and 100 + +### Common use cases + +Convert values between scales, used by [`map()`](#map) internally. Direct +opposite of [`lerp()`](#lerp). + +See: [`lerp()`](#lerp), [`map()`](#map) + + + +## round(val[, step]):Number + +Round value to full steps. Similar to `Math.round()` but allow setting an +arbitrary *radix*. + + // default + round(0.22); // 0 + round(0.49); // 0 + round(0.51); // 1 + + // custom radix + round(0.22, 0.5); // 0 + round(0.49, 0.5); // 0.5 + round(0.51, 0.5); // 0.5 + round(0.74, 0.5); // 0.5 + round(0.75, 0.5); // 1 + round(1.24, 0.5); // 1 + round(1.25, 0.5); // 1.5 + round(1.74, 0.5); // 1.5 + +### Common use cases + +Round values by increments of 0.5/5/10/1000/etc. + +See: [`floor()`](#floor), [`ceil()`](#ceil), [`countSteps()`](#countSteps) + + + +------------------------------------------------------------------------------- + +For more usage more info check the specs and source code. + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/number.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/number.md new file mode 100644 index 00000000..1b769638 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/number.md @@ -0,0 +1,279 @@ +# number # + +Number utilities. + + +## abbreviate(val[, nDecimalDigits, dictionary]):String + +Abbreviate number to thousands (K), millions (M) or billions (B). + +The default value for `nDecimalDigits` is `1`. + +### Example + + abbreviate(123456); // "123.5K" + abbreviate(12345678); // "12.3M" + abbreviate(1234567890); // "1.2B" + +You can set the amount of decimal digits (default is `1`): + + abbreviate(543); // "0.5K" + abbreviate(543, 1); // "0.5K" + abbreviate(543, 2); // "0.54K" + abbreviate(543, 3); // "0.543K" + +You can customize the abbreviation by passing a custom "dictionary": + + var _ptbrDict = { + thousands : ' mil', + millions : ' Mi', + billions : ' Bi' + }; + function customAbbr(val) { + return abbreviate(val, 1, _ptbrDict); + } + + customAbbr(123456); // "123.5 mil" + customAbbr(12345678); // "12.3 Mi" + customAbbr(1234567890); // "1.2 Bi" + + + +## currencyFormat(val[, nDecimalDigits, decimalSeparator, thousandsSeparator]):String + +Format a number as currency. + +### Example: + + currencyFormat(1000); // "1,000.00" + currencyFormat(1000, 1); // "1,000.0" + currencyFormat(1000, 2, ',', '.'); // "1.000,00" + + + +## enforcePrecision(val, nDecimalDigits):Number + +Enforce a specific amount of decimal digits and also fix floating point +rounding issues. + +### Example: + +```js +enforcePrecision(0.615, 2); // 0.62 +enforcePrecision(0.625, 2); // 0.63 +//floating point rounding "error" (rounds to odd number) ++(0.615).toFixed(2); // 0.61 ++(0.625).toFixed(2); // 0.63 +``` + + +## isNaN(val):Boolean + +ES6 `Number.isNaN()`, checks if supplied value is `NaN`. + +```js +// only returns `true` for `NaN` +isNaN(NaN); // true +isNaN(0 / 0); // true + +// everything else is `false` +isNaN(true); // false +isNaN(123); // false +isNaN('asd'); // false +isNaN('NaN'); // false +``` + + +## MAX_INT:Number + +Maximum 32-bit signed integer value. `Math.pow(2, 31) - 1` + +### Example: + +```js +console.log( MAX_INT ); // 2147483647 +``` + + +## MAX_SAFE_INTEGER:Number + +Maximum safe integer. `Math.pow(2,53) − 1` + + +## MAX_UINT:Number + +Maximum 32-bit unsigned integer value. `Math.pow(2, 32) - 1` + +### Example: + +```js +console.log( MAX_UINT ); // 4294967295 +``` + + +## MIN_INT:Number + +Minimum 32-bit signed integer value. `Math.pow(2, 31) * -1`. + +### Example: + +```js +console.log( MIN_INT ); // -2147483648 +``` + + +## nth(n):String + +Returns the "nth" of number. (`"st"`, `"nd"`, `"rd"`, `"th"`) + +```js +nth(1); // "st" +nth(2); // "nd" +nth(12); // "th" +nth(22); // "nd" +nth(23); // "rd" +nth(34); // "th" +``` + +See: [`ordinal()`](#ordinal) + + + +## ordinal(n):String + +Converts number into ordinal form (1st, 2nd, 3rd, 4th, ...) + +```js +ordinal(1); // "1st" +ordinal(2); // "2nd" +ordinal(3); // "3rd" +ordinal(14); // "14th" +ordinal(21); // "21st" +``` + +See: [`nth()`](#nth) + + + +## pad(n, minLength[, char]):String + +Add padding zeros if `n.length` < `minLength`. + +### Example: + +```js +pad(1, 5); // "00001" +pad(12, 5); // "00012" +pad(123, 5); // "00123" +pad(1234, 5); // "01234" +pad(12345, 5); // "12345" +pad(123456, 5); // "123456" + +// you can also specify the "char" used for padding +pad(12, 5, '_'); // "___12" +``` + +see: [string/lpad](./string.html#lpad) + + + +## rol(val, shift):Number + +Bitwise circular shift left. + +More info at [Wikipedia#Circular_shift](http://en.wikipedia.org/wiki/Circular_shift) + + + +## ror(val, shift):Number + +Bitwise circular shift right. + +More info at [Wikipedia#Circular_shift](http://en.wikipedia.org/wiki/Circular_shift) + + + +## sign(val):Number + +Returns `-1` if value is negative, `0` if the value is `0` and `1` if value is positive. Useful for +multiplications. + +```js +sign(-123); // -1 +sign(123); // 1 +sign(0); // 0 +``` + + + +## toInt(val):Number + +"Convert" value into an 32-bit integer. Works like `Math.floor` if `val > 0` and +`Math.ceil` if `val < 0`. + +**IMPORTANT:** val will wrap at [number/MIN_INT](#MIN_INT) and +[number/MAX_INT](#MAX_INT). + +Created because most people don't know bitwise operations and also because this +feature is commonly needed. + +[Perf tests](http://jsperf.com/vs-vs-parseint-bitwise-operators/7) + +### Example: + +```js +toInt(1.25); // 1 +toInt(0.75); // 0 +toInt(-0.55); // 0 +toInt(-5.0001) // -5 +``` + + + +## toUInt(val):Number + +"Convert" value into an 32-bit unsigned integer. + +Works like AS3#uint(). + +**IMPORTANT:** val will wrap at 2^32. + +### Example: + +```js +toUInt(1.25); // 1 +toUInt(0.75); // 0 +toUInt(-0.55); // 0 +toUInt(-5.0001); // 4294967291 +toUInt(Math.pow(2,32) - 0.5); // 4294967295 +toUInt(Math.pow(2,32) + 0.5); // 0 +``` + + +## toUInt31(val):Number + +"Convert" value into an 31-bit unsigned integer (since 1 bit is used for sign). + +Useful since all bitwise operators besides `>>>` treat numbers as signed +integers. + +**IMPORTANT:** val will wrap at 2^31 and negative numbers will be treated as +`zero`. + +### Example: + +```js +toUInt31(1.25); // 1 +toUInt31(0.75); // 0 +toUInt31(-0.55); // 0 +toUInt31(-5.0001); // 0 +toUInt31(Math.pow(2,31) - 0.5); // 21474836470 +toUInt31(Math.pow(2,31) + 0.5); // 0 +``` + + +------------------------------------------------------------------------------- + +For more usage examples check specs inside `/tests` folder. Unit tests are the +best documentation you can get... + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/object.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/object.md new file mode 100644 index 00000000..1e53eb01 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/object.md @@ -0,0 +1,793 @@ +# object # + +Object utilities. + + + +## bindAll(obj, [...methodNames]):void + +Bind methods of the target object to always execute on its own context +(ovewritting the original function). + +See: [function/bind](./function.html#bind) + +```js +var view = { + name: 'Lorem Ipsum', + logNameOnClick: function() { + console.log(this.name); + } +}; + +// binds all methods by default +bindAll(view); +jQuery('#docs').on('click', view.logNameOnClick); +``` + +You can also specify the list of methods that you want to bind (in case you +just want to bind a few of them). + +```js +// only the listed methods will be bound to `obj` context +bindAll(obj, 'logNameOnClick', 'doAwesomeStuffOnDrag'); +``` + + + +## contains(obj, value):Boolean + +Similar to [Array/contains](array.html#contains). Checks if Object contains +value. + +```js +var obj = { + a: 1, + b: 2, + c: 'bar' +}; +contains(obj, 2); // true +contains(obj, 'foo'); // false +``` + + + +## deepFillIn(target, ...objects):Object + +Fill missing properties recursively. + +It's different from `deepMixIn` since it won't override any existing property. +It's also different from `merge` since it won't clone child objects during the +process. + +It returns the target object and mutates it in place. + +See: [`fillIn()`](#fillIn), [`deepMixIn()`](#deepMixIn), [`merge()`](#merge) + +```js +var base = { + foo : { + bar : 123 + }, + lorem : 'ipsum' +}; +var options = deepFillIn({foo : { baz : 45 }, lorem : 'amet'}, base); +// > {foo: {bar:123, baz : 45}, lorem : 'amet'} +``` + + + +## deepMatches(target, pattern):Boolean + +Recursively checks if object contains all properties/value pairs. When both +the target and pattern values are arrays, it checks that the target value +contain matches for all the items in the pattern array (independent of order). + +```js +var john = { + name: 'John', + age: 22, + pets: [ + { type: 'cat', name: 'Grumpy Cat' }, + { type: 'dog', name: 'Hawk' } + ] +}; + +deepMatches(john, { name: 'John' }); // true +deepMatches(john, { age: 21 }); // false +deepMatches(john, { pets: [ { type: 'cat' } ] }); // true +deepMatches(john, { pets: [ { name: 'Hawk' } ] }); // true +deepMatches(john, { pets: [ { name: 'Hairball' } ] }); // false +``` + +See [`matches()`](#matches) + + + +## deepMixIn(target, ...objects):Object + +Mixes objects into the target object, recursively mixing existing child objects +as well. + +It will only recursively mix objects if both (existing and new) values are +plain objects. + +Returns the target object. Like [`merge()`](#merge), but mutates the target +object, and does not clone child objects. + +```js +var target = { + foo: { + name: "foo", + id: 1 + } +}; + +deepMixIn(target, { foo: { id: 2 } }); +console.log(target); // { foo: { name: "foo", id: 2 } } +``` + +See: [`mixIn()`](#mixIn), [`merge()`](#merge), [`deepFillIn()`](#deepFillIn) + + + +## equals(a, b, [callback]):Boolean + +Tests whether two objects contain the same keys and values. + +`callback` specifies the equality comparison function used to compare the +values. It defaults to using [lang/is](lang.html#is). + +It will only check the keys and values contained by the objects; it will not +check the objects' prototypes. If either of the values are not objects, they +will be compared using the `callback` function. + +```js +equals({}, {}); // true +equals({ a: 1 }, { a: 1 }); // true +equals({ a: 1 }, { a: 2 }); // false +equals({ a: 1, b: 2 }, { a: 1 }); // false +equals({ a: 1 }, { a: 1, b: 2 }); // false +equals(null, null); // true +equals(null, {}); // false +equals({ a: 1 }, { a: '1' }, function(a, b) { return a == b; }); // true +``` + +See: [array/equals](array.html#equals), [lang/deepEquals](lang.html#deepEquals) + + +## every(obj, callback, [thisObj]):Boolean + +Similar to [Array/every](array.html#every). Tests whether all properties in the +object pass the test implemented by the provided callback. + +```js +var obj = { + a: 1, + b: 2, + c: 3, + d: 'string' +}; + +every(obj, isNumber); // false +``` + + + +## fillIn(obj, ...default):Object + +Fill in missing properties in object with values from the *defaults* objects. + + var base = { + foo : 'bar', + num : 123 + }; + + fillIn({foo:'ipsum'}, base); // {foo:'ipsum', num:123} + +PS: it allows merging multiple objects at once, the first ones will take +precedence. + +See: [`mixIn()`](#mixIn), [`merge()`](#merge), [`deepFillIn()`](#deepFillIn) + + + +## filter(obj, callback, [thisObj]) + +Returns a new object containing all properties where `callback` returns true, +similar to Array/filter. It does not use properties from the object's +prototype. + +Callback receives the same arguments as `forOwn()`. + +See: [`forOwn()`](#forOwn), [`forIn()`](#forIn), [`pick()`](#pick) + +```js +var obj = { + foo: 'value', + bar: 'bar value' +}; + +// returns { bar: 'bar value' } +filter(obj, function(v) { return value.length > 5; }); + +// returns { foo: 'value' } +filter(obj, function(v, k) { return k === 'foo'; }); +``` + + + +## find(obj, callback, [thisObj]) + +Loops through all the properties in the Object and returns the first one that +passes a truth test (callback), similar to [Array/find](array.html#find). +Unlike Array/find, order of iteration is not guaranteed. + +```js +var obj = { + a: 'foo', + b: 12 +}; + +find(obj, isString); // 'foo' +find(obj, isNumber); // 12 +``` + + + +## forIn(obj, callback[, thisObj]) + +Iterate over all properties of an Object, similar to +[Array/forEach](array.html#forEach). + +It [avoids don't enum bug on IE](https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug). +It **will** iterate over inherited (enumerable) properties from the prototype. + +It allows exiting the iteration early by returning `false` on the callback. + +See: [`forOwn()`](#forOwn), [`keys()`](#keys), [`values()`](#values) + +### Callback arguments + +Callback will receive the following arguments: + + 1. Property Value (*) + 2. Key name (String) + 3. Target object (Object) + +### Example + +```js +function Foo(){ + this.foo = 1; + this.bar = 2; +} + +Foo.prototype.lorem = 4; + +var obj = new Foo(); + +var result = 0; +var keys = []; + +forIn(obj, function(val, key, o){ + result += val; + keys.push(key); +}); + +console.log(result); // 7 +console.log(keys); // ['foo', 'bar', 'lorem'] +``` + + + +## forOwn(obj, callback[, thisObj]) + +Iterate over all own properties from an Object, similar to +[Array/forEach](array.html#forEach). + +It [avoids don't enum bug on IE](https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug). +Notice that it **won't** iterate over properties from the prototype. + +It allows exiting the iteration early by returning `false` on the callback. + +See: [`forIn()`](#forIn), [`keys()`](#keys), [`values()`](#values) + +### Callback arguments + +Callback will receive the following arguments: + + 1. Property Value (*) + 2. Key name (String) + 3. Target object (Object) + +### Example + +```js +function Foo(){ + this.foo = 1; + this.bar = 2; +} + +// will be ignored +Foo.prototype.lorem = 4; + +var obj = new Foo(); + +var result = 0; +var keys = []; + +forOwn(obj, function(val, key, o){ + result += val; + keys.push(key); +}); + +console.log(result); // 3 +console.log(keys); // ['foo', 'bar'] +``` + + + +## functions(obj):Array + +Returns a sorted list of all enumerable properties that have function values +(including inherited properties). + +```js +var obj = { + foo : function(){}, + bar : 'baz' +}; +functions(obj); // ['foo'] +``` + + + +## get(obj, propName):* + +Returns nested property value. Will return `undefined` if property doesn't +exist. + +See: [`set()`](#set), [`namespace()`](#namespace), [`has()`](#has) + +```js +var lorem = { + ipsum : { + dolor : { + sit : 'amet' + } + } + }; + +get(lorem, 'ipsum.dolor.sit'); // "amet" +get(lorem, 'foo.bar'); // undefined +``` + + + +## has(obj, propName):Boolean + +Checks if object contains a child property. Useful for cases where you need to +check if an object contain a *nested* property. It will get properties +inherited by the prototype. + +see: [`hasOwn()`](#hasOwn), [`get()`](#get) + +```js +var a = { + b : { + c : 123 + } + }; + +has(a, 'b.c'); // true +has(a, 'foo.c'); // false +``` + +### Common use case + +```js +if( has(a, 'foo.c') ){ // false + // ... +} + +if( a.foo.c ){ // ReferenceError: `foo` is not defined + // ... +} +``` + + + +## hasOwn(obj, propName):Boolean + +Safer `Object.hasOwnProperty`. Returns a boolean indicating whether the object +has the specified property. + +see: [`has()`](#has) + +```js +var obj = { + foo: 1, + hasOwnProperty : 'bar' +}; + +obj.hasOwnProperty('foo'); // ERROR! hasOwnProperty is not a function + +hasOwn(obj, 'foo'); // true +hasOwn(obj, 'hasOwnProperty'); // true +hasOwn(obj, 'toString'); // false +``` + + + +## keys(obj):Array + +Returns an array of all own enumerable properties found upon a given object. +It will use the native `Object.keys` if present. + +PS: it won't return properties from the prototype. + +See: [`forOwn()`](#forOwn), [`values()`](#values) + +```js +var obj = { + foo : 1, + bar : 2, + lorem : 3 +}; +keys(obj); // ['foo', 'bar', 'lorem'] +``` + + + +## map(obj, callback, [thisObj]):Object + +Returns a new object where the property values are the result of calling the +callback for each property in the original object, similar to Array/map. + +The callback function receives the same arguments as in `forOwn()`. + +See: [`forOwn()`](#forOwn) + +```js +var obj = { foo: 1, bar: 2 }, + data = { foo: 0, bar: 1 }; + +map(obj, function(v) { return v + 1; }); // { foo: 2, bar: 3 } +map(obj, function(v, k) { return k; }); // { foo: "foo", bar: "bar" } +map(obj, function(v, k) { return this[k]; }, data); // { foo: 0, bar: 1 } +``` + + + +## matches(obj, props):Boolean + +Checks if object contains all properties/values pairs. Useful for validation +and filtering. + +```js +var john = {age:25, hair:'long', beard:true}; +var mark = {age:27, hair:'short', beard:false}; +var hippie = {hair:'long', beard:true}; +matches(john, hippie); // true +matches(mark, hippie); // false +``` + +See [`deepMatches()`](#deepMatches) + + + +## merge(...objects):Object + +Deep merges objects. Note that objects and properties will be cloned during the +process to avoid undesired side effects. It return a new object and won't +affect source objects. + +```js +var obj1 = {a: {b: 1, c: 1, d: {e: 1, f: 1}}}; +var obj2 = {a: {b: 2, d : {f : 'yeah'} }}; + +merge(obj1, obj2); // {a: {b : 2, c : 1, d : {e : 1, f : 'yeah'}}} +``` + +See: [`deepMixIn()`](#deepMixIn), [`deepFillIn()`](#deepFillIn) + + + +## max(obj[, iterator]):* + +Returns maximum value inside object or use a custom iterator to define how +items should be compared. Similar to [Array/max](array.html#max). + +See: [`min()`](#min) + +```js +max({a: 100, b: 2, c: 1, d: 3, e: 200}); // 200 +max({a: 'foo', b: 'lorem', c: 'amet'}, function(val){ + return val.length; +}); // 'lorem' +``` + + + +## min(obj[, iterator]):* + +Returns minimum value inside object or use a custom iterator to define how +items should be compared. Similar to [Array/min](array.html#min). + +See: [`max()`](#max) + +```js +min({a: 100, b: 2, c: 1, d: 3, e: 200}); // 1 +min({a: 'foo', b: 'lorem', c: 'amet'}, function(val){ + return val.length; +}); // 'foo' +``` + + + +## mixIn(target, ...objects):Object + +Combine properties from all the objects into first one. + +This method affects target object in place, if you want to create a new Object +pass an empty object as first parameter. + +### Arguments + + 1. `target` (Object) : Target Object. + 2. `...objects` (...Object) : Objects to be combined (0...n objects). + +### Example + +```js +var a = {foo: "bar"}; +var b = {lorem: 123}; + +mixIn({}, a, b); // {foo: "bar", lorem: 123} +console.log(a); // {foo: "bar"} + +mixIn(a, b); // {foo: "bar", lorem: 123} +console.log(a); // {foo: "bar", lorem: 123} +``` + +See: [`fillIn()`](#fillIn), [`merge()`](#merge) + + + + +## namespace(obj, propName):Object + +Creates an empty object inside namespace if not existent. Will return created +object or existing object. + +See: [`get()`](#get), [`set()`](#set) + +```js +var obj = {}; +namespace(obj, 'foo.bar'); // {} +console.log(obj); // {foo:{bar:{}}} +``` + + +## omit(obj, ...keys):Object + +Return a copy of the object without the blacklisted keys. + +See: [`filter()`](#filter) + +```js +var user = { + firstName : 'John', + lastName : 'Doe', + dob : '1985/07/23', + gender : 'male' +}; + +// can pass an array of keys as second argument +var keys = ['firstName', 'dob'] +omit(user, keys); // {lastName : 'Doe', gender : 'male'} + +// or multiple arguments +omit(user, 'firstName', 'lastName'); // {dob : '1985/07/23', gender : 'male'} +``` + + + +## pick(obj, ...keys):Object + +Return a copy of the object that contains only the whitelisted keys. + +See: [`filter()`](#filter) + +```js +var user = { + firstName : 'John', + lastName : 'Doe', + dob : '1985/07/23', + gender : 'male' +}; + +// can pass an array of keys as second argument +var keys = ['firstName', 'dob'] +pick(user, keys); // {firstName:"John", dob: "1985/07/23"} + +// or multiple arguments +pick(user, 'firstName', 'lastName'); // {firstName:"John", lastName: "Doe"} +``` + + + +## pluck(obj, propName):Object + +Extract an object containing property values with keys as they appear in the +passed object. + +```js +var users = { + first: { + name : 'John', + age : 21 + }, + second: { + name : 'Mary', + age : 25 + } +}; + +pluck(users, 'name'); // {first: 'John', second: 'Mary'} ); +pluck(users, 'age'); // {first: 21, second: 25} ); +``` + + + +## reduce(obj, callback, initial, [thisObj]):* + +Similar to [Array/reduce](array.html#reduce). + +Apply a function against an accumulator and each property of the object (order +is undefined) as to reduce it to a single value. + +```js +var obj = {a: 1, b: 2, c: 3, d: 4}; + +function sum(prev, cur, key, list) { + compare1.push(prev); + return prev + cur; +} + +reduce(obj, sum); // 10 +``` + + + +## reject(obj, callback, thisObj):Object + +Returns a new object containing all properties where `callback` returns true, +similar to [Array/reject](array.html#reject). It does not use properties from +the object's prototype. Opposite of [`filter()`](#filter). + +See [`filter()`](#filter) + +### Example + +```js +var obj = {a: 1, b: 2, c: 3, d: 4, e: 5}; +reject(obj, function(x) { return (x % 2) !== 0; }); // {b: 2, d: 4} +``` + + + +## values(obj):Array + +Returns an array of all own enumerable properties values found upon a given object. + +PS: it won't return properties from the prototype. + +See: [`forOwn()`](#forOwn), [`keys()`](#keys) + +```js +var obj = { + foo : 1, + bar : 2, + lorem : 3 +}; +values(obj); // [1, 2, 3] +``` + + + +## set(obj, propName, value) + +Sets a nested property value. + +See: [`get()`](#get), [`namespace()`](#namespace) + +```js +var obj = {}; +set(obj, 'foo.bar', 123); +console.log(obj.foo.bar); // 123 +console.log(obj); // {foo:{bar:123}} +``` + + + +## size(obj):Number + +Returns the count of own enumerable properties found upon a given object. + +PS: it won't return properties from the prototype. + +See: [`forOwn()`](#forOwn), [`keys()`](#keys) + +```js +var obj = { + foo : 1, + bar : 2, + lorem : 3 +}; +size(obj); // 3 +``` + + + +## some(obj, callback, [thisObj]):Boolean + +Similar to [Array/some](array.html#some). Tests whether any properties in the +object pass the test implemented by the provided callback. + +```js +var obj = { + a: 1, + b: 2, + c: 3, + d: 'string' +}; + +some(obj, isNumber); // true +``` + + + +## unset(obj, propName):Boolean + +Delete object property if existent and returns a boolean indicating succes. It +will also return `true` if property doesn't exist. + +Some properties can't be deleted, to understand why [check this +article](http://perfectionkills.com/understanding-delete/). + +See: [`set()`](#set) + +```js +var lorem = { + ipsum : { + dolor : { + sit : 'amet' + } + } + }; + +unset(lorem, 'ipsum.dolor.sit'); // true +console.log(lorem.ipsum.dolor); // {} +unset(lorem, 'foo.bar'); // true +``` + + + +## result(object, property):Mixed + +Evaluates an objects property and returns result. + +```js +var person = { + name: 'john', + + mood: function() { + // some dynamic calculated property. + return 'happy'; + } +}; + +var name = result(person, 'name'), // john + mood = result(person, 'mood'); // happy +``` diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/queryString.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/queryString.md new file mode 100644 index 00000000..1be3c102 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/queryString.md @@ -0,0 +1,115 @@ +# queryString # + +Utilities for query string manipulation. + + + +## contains(url, paramName):Boolen + +Checks if query string contains parameter. + +### Arguments: + + 1. `url` (String) : URL or query string. + 2. `paramName` (String) : Parameter name. + +### Example: + +```js +var url = 'example.com/?lorem=ipsum'; +contains(url, 'lorem'); // true +contains(url, 'foo'); //false +``` + + + +## decode(queryStr[, shouldTypecast]):Object + +Parses query string and creates an object of keys => vals. + +Will typecast value with [`string/typecast`](string.html#typecast) by default +and decode string parameters using `decodeURIComponent()`. + +```js +var query = '?foo=bar&lorem=123'; +decode(query); // {foo: "bar", lorem: 123} +decode(query, false); // {foo: "bar", lorem: "123"} +``` + + +## encode(obj):String + +Encode object into a query string. + +Will encode parameters with `encodeURIComponent()`. + +```js +encode({foo: "bar", lorem: 123}); // "?foo=bar&lorem=123" +``` + + +## getParam(url, param[, shouldTypecast]):* + +Get query parameter value. + +Will typecast value with [`string/typecast`](string.html#typecast) by default. + +See: [`setParam()`](#setParam) + +### Arguments: + + 1. `url` (String) : Url. + 2. `param` (String) : Parameter name. + 3. `[shouldTypecast]` (Boolean) : If it should typecast value. + +### Example: + +```js +var url = 'example.com/?foo=bar&lorem=123&ipsum=false'; +getParam(url, 'dolor'); // "amet" +getParam(url, 'lorem'); // 123 +getParam(url, 'lorem', false); // "123" +``` + + +## parse(url[, shouldTypecast]):Object + +Parses URL, extracts query string and decodes it. + +It will typecast all properties of the query object unless second argument is +`false`. + +Alias to: `decode(getQuery(url))`. + +```js +var url = 'example.com/?lorem=ipsum&a=123'; +parse(url); // {lorem: "ipsum", a: 123} +parse(url, false); // {lorem: "ipsum", a: "123"} +``` + + +## getQuery(url):String + +Gets full query as string with all special chars decoded. + +```js +getQuery('example.com/?lorem=ipsum'); // "?lorem=ipsum" +``` + + +## setParam(url, paramName, value):String + +Add new query string parameter to URL or update existing value. + +See: [`getParam()`](#getParam) + +```js +setParam('?foo=bar&lorem=0', 'lorem', 'ipsum'); // '?foo=bar&lorem=ipsum' +setParam('?lorem=1', 'foo', 123); // '?lorem=1&foo=123' +``` + + +------------------------------------------------------------------------------- + +For more usage examples check specs inside `/tests` folder. Unit tests are the +best documentation you can get... diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/random.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/random.md new file mode 100644 index 00000000..cd32eb35 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/random.md @@ -0,0 +1,256 @@ +# random # + +Pseudo-random generators. + +mout uses `Math.random` by default on all the pseudo-random generators, if +you need a seeded random or a better algorithm see the [`random()`](#random) +documentation for instructions. + + + +## choice(...items):* + +Returns a random element from the supplied arguments or from an array if single +argument is an array. + +### Example: + +```js +choice(1, 2, 3, 4, 5); // 3 + +var arr = ['lorem', 'ipsum', 'dolor']; +choice(arr); // 'dolor' +``` + + + +## guid():String + +Generates a pseudo-random [Globally Unique Identifier](http://en.wikipedia.org/wiki/Globally_unique_identifier) (v4). + +Since the total number of GUIDs is 2122 the chance of generating the +same value twice is negligible. + +**Important:** this method uses `Math.random` by default so the UUID isn't +*safe* (sequence of outputs can be predicted in some cases), check the +[`random()`](#random) documentation for more info on how to replace the default +PRNG if you need extra safety or need *seeded* results. + +See: [`randHex()`](#randHex), [`random()`](#random) + +### Example: + +```js +guid(); // 830e9f50-ac7f-4369-a14f-ed0e62b2fa0b +guid(); // 5de3d09b-e79c-4727-932b-48c49228d508 +``` + + + +## rand([min], [max]):Number + +Gets a random number inside range or snap to min/max values. + +### Arguments: + + 1. `[min]` (Number) : Minimum value. Defaults to `number/MIN_INT`. + 2. `[max]` (Number) : Maximum value. Defaults to `number/MAX_INT`. + + +### Example: + +```js +rand(); // 448740433.55274725 +rand(); // -31797596.097682 +rand(0, 10); // 7.369723 +rand(0, 10); // 5.987042 +``` + +See: [`random()`](#random) + + + +## randBit():Number + +Returns a random "bit" (0 or 1). Useful for addition/subtraction. + +It's slightly faster than `choice(0, 1)` since implementation is simpler (not +that it will make a huge difference in most cases). + +See: [`choice()`](#choice) + +### Example: + +```js +randBit(); // 1 +randBit(); // 0 + +//same effect as +choice(0, 1); +``` + + +## randBool():Boolean + +Returns a random Boolean (`true` or `false`). + +Since this is very common it makes sense to abstract it into a discrete method. + +### Example: + +```js +randBool(); // true +randBool(); // false +``` + + + +## randHex([size]):String + +Returns a random hexadecimal string. + +The default `size` is `6`. + +### Example: + +```js +randHex(); // "dd8575" +randHex(); // "e6baeb" +randHex(2); // "a2" +randHex(30); // "effd7e2ad9a4a3067e30525fab983a" +``` + + + +## randInt([min], [max]):Number + +Gets a random integer inside range or snap to min/max values. + +### Arguments: + + 1. `[min]` (Number) : Minimum value. Defaults to `number/MIN_INT`. + 2. `[max]` (Number) : Maximum value. Defaults to `number/MAX_INT`. + + +### Example: + +```js +randInt(); // 448740433 +randInt(); // -31797596 +randInt(0, 10); // 7 +randInt(0, 10); // 5 +``` + + + +## randSign():Number + +Returns a random "sign" (-1 or 1). Useful for multiplications. + +It's slightly faster than `choice(-1, 1)` since implementation is simpler (not +that it will make a huge difference in most cases). + +See: [`choice()`](#choice) + +### Example: + +```js +randSign(); // -1 +randSign(); // 1 + +//same effect as +choice(-1, 1); +``` + + + +## random():Number + +Returns a random number between `0` and `1`. Same as `Math.random()`. + +```js +random(); // 0.35435103671625257 +random(); // 0.8768321881070733 +``` + +**Important:** No methods inside mout should call `Math.random()` +directly, they all use `random/random` as a proxy, that way we can +inject/replace the pseudo-random number generator if needed (ie. in case we +need a seeded random or a better algorithm than the native one). + +### Replacing the PRNG + +In some cases we might need better/different algorithms than the one provided +by `Math.random` (ie. safer, seeded). + +Because of licensing issues, file size limitations and different needs we +decided to **not** implement a custom PRNG and instead provide a easy way to +override the default behavior. - [issue #99](https://github.com/millermedeiros/amd-utils/issues/99) + +If you are using mout with a loader that supports the [AMD map +config](https://github.com/amdjs/amdjs-api/wiki/Common-Config), such as +[RequireJS](http://requirejs.org/), you can use it to replace the PRNG +(recommended approach): + +```js +requirejs.config({ + map : { + // all modules will load "my_custom_prng" instead of + // "mout/random/random" + '*' : { + 'mout/random/random' : 'my_custom_prng' + } + } +}); +``` + +You also have the option to override `random.get` in case you are using +mout on node.js or with a loader which doesn't support the map config: + +```js +// replace the PRNG +var n = 0; +random.get = function(){ + return ++n % 2? 0 : 1; // not so random :P +}; +random(); // 0 +random(); // 1 +random(); // 0 +random(); // 1 +``` + +See this [detailed explanation about PRNG in +JavaScript](http://baagoe.org/en/w/index.php/Better_random_numbers_for_javascript) +to understand the issues with the native `Math.random` and also for a list of +algorithms that could be used instead. + + + +## randString([length, dictionary]):String + +Returns a random string. + +By default returns string containing alphanumeric characters (lowercase and uppercase) with a length of 8. + +### Arguments: + + 1. `[length]` (number) : Length of the string to return. Defaults to 8. + 2. `[dictionary]` (string) : A string containing all characters used as a dictionary for the random string construction. Defaults to alphanumeric characters (lowercase and uppercase). + +### Example: + +```js +randString(); // returns a string with length 8. +randString(12); // returns a string of length 12. +randString(-1); // returns a string of length 8. +randString(null, 'pew!'); // returns a random string of length 8 composed of 'p', 'e', 'w' and '!'. +randString(10, '0'); // always returns '0's of length 10. +randString(rand(8, 10)); // returns a random string with length between 8 and 10. +``` + + + +------------------------------------------------------------------------------- + +For more usage examples check specs inside `/tests` folder. Unit tests are the +best documentation you can get... diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/string.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/string.md new file mode 100644 index 00000000..70a36fc0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/string.md @@ -0,0 +1,626 @@ +# string # + +String utilities. + + +## camelCase(str):String + +Convert string to "camelCase" text. + +See: [`pascalCase()`](#pascalCase), [`unCamelCase()`](#unCamelCase) + +### Example + +```js +camelCase('lorem-ipsum-dolor'); // "loremIpsumDolor" +camelCase('lorem ipsum dolor'); // "loremIpsumDolor" +``` + + + +## contains(str, substring, [fromIndex]):Boolean + +Checks if string contains the given substring. + +See: [`startsWith()`](#startsWith), [`endsWith()`](#endsWith) + +### Example + +```js +contains('lorem', 'or'); // true +contains('lorem', 'bar'); // false +``` + + + +## crop(str, maxChars, [append]):String + +Truncate string at full words. Alias to `truncate(str, maxChars, append, true);`. + +See: [`truncate()`](#truncate) + +### Example + +```js +crop('lorem ipsum dolor', 10); // "lorem..." +crop('lorem ipsum dolor', 10, '+'); // "lorem+" +``` + + + +## endsWith(str, suffix):Boolean + +Checks if string ends with specified suffix. + +See: [`startsWith()`](#startsWith), [`contains()`](#contains) + +### Example + +```js +endsWith('lorem ipsum', 'lorem'); // false +endsWith('lorem ipsum', 'ipsum'); // true +``` + + + +## escapeHtml(str):String + +Escapes the following special characters for use in HTML: + +* `&` becomes `&` +* `<` becomes `<` +* `>` becomes `>` +* `'` becomes `'` +* `"` becomes `"` + +No other characters are escaped. To HTML-escape other characters as well, use a third-party library like [_he_](http://mths.be/he). + +See: [`unescapeHtml()`](#unescapeHtml) + +### Example + +```js +escapeHtml('lorem & "ipsum"'); // "lorem &amp; &quot;ipsum&quot;" +``` + + + +## escapeRegExp(str):String + +Escape special chars to be used as literals in RegExp constructors. + +### Example + +```js +str = escapeRegExp('[lorem.ipsum]'); // "\\[lorem\\.ipsum\\]" +reg = new RegExp(str); // /\[lorem\.ipsum\]/ +``` + + + +## escapeUnicode(str[, shouldEscapePrintable]):String + +Unicode escape chars. + +It will only escape non-printable ASCII chars unless `shouldEscapePrintable` is +set to `true`. + +See: [`unescapeUnicode()`](#unescapeUnicode) + +```js +escapeUnicode('føo bår'); +// > "f\u00f8o b\u00e5r" +escapeUnicode('føo bår', true); +// > "\u0066\u00f8\u006f\u0020\u0062\u00e5\u0072" +``` + + + +## hyphenate(str):String + +Replaces spaces with hyphens, split camelCase text, remove non-word chars, +remove accents and convert to lower case. + +See: [`slugify()`](#slugify), [`underscore()`](#underscore), +[`unhyphenate`](#unhyphenate) + +```js +hyphenate(' %# lorem ipsum ? $ dolor'); // "lorem-ipsum-dolor" +hyphenate('spéçïãl çhârs'); // "special-chars" +hyphenate('loremIpsum'); // "lorem-ipsum" +``` + + + +## insert(str, index, partial):String + +Inserts a `partial` before the given `index` in the provided `str`. +If the index is larger than the length of the string the partial is appended at the end. +A negative index is treated as `length - index` where `length` is the length or the string. + +```js +insert('this is a sentence', 10, 'sample '); // "this is a sample sentence" +insert('foo', 100, 'bar'); // "foobar" +insert('image.png', -4, '-large'); // "image-large.png" +``` + +## interpolate(str, replacements[, syntax]):String + +String interpolation. Format/replace tokens with object properties. + +```js +var tmpl = 'Hello {{name}}!'; +interpolate(tmpl, {name: 'World'}); // "Hello World!" +interpolate(tmpl, {name: 'Lorem Ipsum'}); // "Hello Lorem Ipsum!" + +tmpl = 'Hello {{name.first}}!'; +interpolate(tmpl, {name: {first: 'Lorem'}}); // "Hello Lorem!" +``` + +It uses a mustache-like syntax by default but you can set your own format if +needed. You can also use Arrays for the replacements (since Arrays are +objects as well): + +```js +// matches everything inside "${}" +var syntax = /\$\{([^}]+)\}/g; +var tmpl = "Hello ${0}!"; +interpolate(tmpl, ['Foo Bar'], syntax); // "Hello Foo Bar!" +``` + + + +## lowerCase(str):String + +"Safer" `String.toLowerCase()`. (Used internally) + +### Example + +```js +(null).toLowerCase(); // Error! +(undefined).toLowerCase(); // Error! +lowerCase(null); // "" +lowerCase(undefined); // "" +``` + + + +## lpad(str, minLength[, char]):String + +Pad string from left with `char` if its' length is smaller than `minLen`. + +See: [`rpad()`](#rpad) + +### Example + +```js +lpad('a', 5); // " a" +lpad('a', 5, '-'); // "----a" +lpad('abc', 3, '-'); // "abc" +lpad('abc', 4, '-'); // "-abc" +``` + + + +## ltrim(str, [chars]):String + +Remove chars or white-spaces from beginning of string. + +`chars` is an array of chars to remove from the beginning of the string. If +`chars` is not specified, Unicode whitespace chars will be used instead. + +See: [`rtrim()`](#rtrim), [`trim()`](#trim) + +### Example + +```js +ltrim(' lorem ipsum '); // "lorem ipsum " +ltrim('--lorem ipsum--', ['-']); // "lorem ipsum--" +``` + + + +## makePath(...args):String + +Group arguments as path segments, if any of the args is `null` or `undefined` +it will be ignored from resulting path. It will also remove duplicate "/". + +See: [`array/join()`](array.html#join) + +### Example + +```js +makePath('lorem', 'ipsum', null, 'dolor'); // "lorem/ipsum/dolor" +makePath('foo///bar/'); // "foo/bar/" +``` + + + +## normalizeLineBreaks(str, [lineBreak]):String + +Normalize line breaks to a single format. Defaults to Unix `\n`. + +It handles DOS (`\r\n`), Mac (`\r`) and Unix (`\n`) formats. + +### Example + +```js +// "foo\nbar\nlorem\nipsum" +normalizeLineBreaks('foo\nbar\r\nlorem\ripsum'); + +// "foo\rbar\rlorem\ripsum" +normalizeLineBreaks('foo\nbar\r\nlorem\ripsum', '\r'); + +// "foo bar lorem ipsum" +normalizeLineBreaks('foo\nbar\r\nlorem\ripsum', ' '); +``` + + + +## pascalCase(str):String + +Convert string to "PascalCase" text. + +See: [`camelCase()`](#camelCase) + +### Example + +```js +pascalCase('lorem-ipsum-dolor'); // "LoremIpsumDolor" +pascalCase('lorem ipsum dolor'); // "LoremIpsumDolor" +``` + + + +## properCase(str):String + +UPPERCASE first char of each word, lowercase other chars. + +### Example + +```js +properCase('loRem iPSum'); // "Lorem Ipsum" +``` + + + +## removeNonASCII(str):String + +Remove [non-printable ASCII +chars](http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters). + +### Example + +```js +removeNonASCII('äÄçÇéÉêlorem-ipsumöÖÐþúÚ'); // "lorem-ipsum" +``` + + + +## removeNonWord(str):String + +Remove non-word chars. + +### Example + +```js +var str = 'lorem ~!@#$%^&*()_+`-={}[]|\\:";\'/?><., ipsum'; +removeNonWord(str); // "lorem - ipsum" +``` + + + +## repeat(str, n):String + +Repeat string n-times. + +### Example + +```js +repeat('a', 3); // "aaa" +repeat('bc', 2); // "bcbc" +repeat('a', 0); // "" +``` + + + +## replace(str, search, replacements):String + +Replace string(s) with the replacement(s) in the source. + +`search` and `replacements` can be an array, or a single item. For every item +in `search`, it will call `str.replace` with the search item and the matching +replacement in `replacements`. If `replacements` only contains one replacement, +it will be used for all the searches, otherwise it will use the replacement at +the same index as the search. + +### Example + +```js +replace('foo bar', 'foo', 'test'); // "test bar" +replace('test 1 2', ['1', '2'], 'n'); // "test n n" +replace('test 1 2', ['1', '2'], ['one', 'two']); // "test one two" +replace('123abc', [/\d/g, /[a-z]/g], ['0', '.']); // "000..." +``` + + + +## replaceAccents(str):String + +Replaces all accented chars with regular ones. + +**Important:** Only covers **Basic Latin** and **Latin-1** unicode chars. + +### Example + +```js +replaceAccents('spéçïãl çhârs'); // "special chars" +``` + + + +## rpad(str, minLength[, char]):String + +Pad string from right with `char` if its' length is smaller than `minLen`. + +See: [`lpad()`](#lpad) + +### Example + +```js +rpad('a', 5); // "a " +rpad('a', 5, '-'); // "a----" +rpad('abc', 3, '-'); // "abc" +rpad('abc', 4, '-'); // "abc-" +``` + + + +## rtrim(str, [chars]):String + +Remove chars or white-spaces from end of string. + +`chars` is an array of chars to remove from the end of the string. If +`chars` is not specified, Unicode whitespace chars will be used instead. + +See: [`trim()`](#trim), [`ltrim()`](#ltrim) + +### Example + +```js +rtrim(' lorem ipsum '); // " lorem ipsum" +rtrim('--lorem ipsum--', ['-']); // "--lorem ipsum" +``` + + + +## sentenceCase(str):String + +UPPERCASE first char of each sentence and lowercase other chars. + +### Example + +```js +var str = 'Lorem IpSum DoLOr. maeCeNnas Ullamcor.'; +sentenceCase(str); // "Lorem ipsum dolor. Maecennas ullamcor." +``` + + + +## stripHtmlTags(str):String + +Remove HTML/XML tags from string. + +### Example + +```js +var str = '

lorem ipsum

'; +stripHtmlTags(str); // "lorem ipsum" +``` + + + +## startsWith(str, prefix):Boolean + +Checks if string starts with specified prefix. + +See: [`endsWith()`](#endsWith), [`contains()`](#contains) + +### Example + +```js +startsWith('lorem ipsum', 'lorem'); // true +startsWith('lorem ipsum', 'ipsum'); // false +``` + + + +## slugify(str[, delimeter]):String + +Convert to lower case, remove accents, remove non-word chars and replace spaces +with the delimeter. The default delimeter is a hyphen. + +Note that this does not split camelCase text. + +See: [`hyphenate()`](#hyphenate) and [`underscore()`](#underscore) + +### Example + +```js +var str = 'loremIpsum dolor spéçïãl chârs'; +slugify(str); // "loremipsum-dolor-special-chars" +slugify(str, '_'); // "loremipsum_dolor_special_chars" +``` + + + +## trim(str, [chars]):String + +Remove chars or white-spaces from beginning and end of string. + +`chars` is an array of chars to remove from the beginning and end of the +string. If `chars` is not specified, Unicode whitespace chars will be used +instead. + +See: [`rtrim()`](#rtrim), [`ltrim()`](#ltrim) + +### Example + +```js +trim(' lorem ipsum '); // "lorem ipsum" +trim('-+-lorem ipsum-+-', ['-', '+']); // "lorem ipsum" +``` + + + +## truncate(str, maxChars, [append], [onlyFullWords]):String + +Limit number of chars. Returned string `length` will be `<= maxChars`. + +See: [`crop()`](#crop) + +### Arguments + + 1. `str` (String) : String + 2. `maxChars` (Number) : Maximum number of characters including `append.length`. + 3. `[append]` (String) : Value that should be added to the end of string. + Defaults to "...". + 4. `[onlyFullWords]` (Boolean) : If it shouldn't break words. Default is + `false`. (favor [`crop()`](#crop) since code will be clearer). + +### Example + +```js +truncate('lorem ipsum dolor', 11); // "lorem ip..." +truncate('lorem ipsum dolor', 11, '+'); // "lorem ipsu+" +truncate('lorem ipsum dolor', 11, null, true); // "lorem..." +``` + + + +## typecast(str):* + +Parses string and convert it into a native value. + +### Example + +```js +typecast('lorem ipsum'); // "lorem ipsum" +typecast('123'); // 123 +typecast('123.45'); // 123.45 +typecast('false'); // false +typecast('true'); // true +typecast('null'); // null +typecast('undefined'); // undefined +``` + + + +## unCamelCase(str, [delimiter]):String + +Add the delimiter between camelCase text and convert first char of each word to +lower case. + +The delimiter defaults to a space character. + +See: [`camelCase()`][#camelCase] + +### Example + +```js +unCamelCase('loremIpsumDolor'); // "lorem ipsum dolor" +unCamelCase('loremIpsumDolor', '-'); // "lorem-ipsum-color" +``` + + +## underscore(str):String + +Replaces spaces with underscores, split camelCase text, remove non-word chars, +remove accents and convert to lower case. + +See: [`slugify()`](#slugify), [`hyphenate()`](#hyphenate) + +```js +underscore(' %# lorem ipsum ? $ dolor'); // "lorem_ipsum_dolor" +underscore('spéçïãl çhârs'); // "special_chars" +underscore('loremIpsum'); // "lorem_ipsum" +``` + + + +## unescapeHtml(str):String + +Unescapes the following HTML character references back into the raw symbol they map to: + +* `&` becomes `&` +* `<` becomes `<` +* `>` becomes `>` +* `'` becomes `'` +* `"` becomes `"` + +No other HTML character references are unescaped. To HTML-unescape other entities as well, use a third-party library like [_he_](http://mths.be/he). + + +See: [`escapeHtml()`](#escapeHtml) + +### Example + +```js +unescapeHtml('lorem &amp; &quot;ipsum&quot;'); // 'lorem & "ipsum"' +``` + + + +## unescapeUnicode(str):String + +Unescapes unicode char sequences. + +See: [`escapeUnicode()`](#escapeUnicode) + +```js +unescapeUnicode('\\u0066\\u00f8\\u006f\\u0020\\u0062\\u00e5\\u0072'); +// > 'føo bår' +``` + + + +## unhyphenate(str):String + +Replaces hyphens with spaces. (only hyphens between word chars) + +See : [`hyphenate()`](#hyphenate) + +### Example + +```js +unhyphenate('lorem-ipsum-dolor'); // "lorem ipsum dolor" +``` + + +## upperCase(str):String + +"Safer" `String.toUpperCase()`. (Used internally) + +### Example + +```js +(null).toUpperCase(); // Error! +(undefined).toUpperCase(); // Error! +upperCase(null); // "" +upperCase(undefined); // "" +``` + + + +## WHITE_SPACES:Array + +Constant array of all [Unicode white-space +characters](http://en.wikipedia.org/wiki/Whitespace_character). + + + +------------------------------------------------------------------------------- + +For more usage examples check specs inside `/tests` folder. Unit tests are the +best documentation you can get... + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/time.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/time.md new file mode 100644 index 00000000..628c2a9b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/doc/time.md @@ -0,0 +1,64 @@ +# time # + +Utilities for time manipulation. + + +## convert(value, sourceUnit, [destinationUnit]):Number + +Converts time between units. + +Available units: `millisecond`, `second`, `minute`, `hour`, `day`, `week`. +Abbreviations: `ms`, `s`, `m`, `h`, `d`, `w`. + +We do **not** support year and month as a time unit since their values are not +fixed. + +The default `destinationUnit` is `ms`. + +```js +convert(1, 'minute'); // 60000 +convert(2.5, 's', 'ms'); // 2500 +convert(2, 'm', 's'); // 120 +convert(500, 'ms', 's'); // 0.5 +``` + + + +## now():Number + +Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC. +Uses `Date.now()` if available. + +### Example + +```js +now(); // 1335449614650 +``` + + + +## parseMs(ms):Object + +Parse timestamp (milliseconds) into an object `{milliseconds:number, +seconds:number, minutes:number, hours:number, days:number}`. + +### Example + +```js +// {days:27, hours:4, minutes:26, seconds:5, milliseconds:454} +parseMs(2348765454); +``` + + + +## toTimeString(ms):String + +Convert timestamp (milliseconds) into a time string in the format "[H:]MM:SS". + +### Example + +```js +toTimeString(12513); // "00:12" +toTimeString(951233); // "15:51" +toTimeString(8765235); // "2:26:05" +``` diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function.js new file mode 100644 index 00000000..f8de6388 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function.js @@ -0,0 +1,23 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'awaitDelay' : require('./function/awaitDelay'), + 'bind' : require('./function/bind'), + 'compose' : require('./function/compose'), + 'constant' : require('./function/constant'), + 'debounce' : require('./function/debounce'), + 'func' : require('./function/func'), + 'identity' : require('./function/identity'), + 'makeIterator_' : require('./function/makeIterator_'), + 'partial' : require('./function/partial'), + 'prop' : require('./function/prop'), + 'series' : require('./function/series'), + 'throttle' : require('./function/throttle'), + 'timeout' : require('./function/timeout'), + 'times' : require('./function/times'), + 'wrap' : require('./function/wrap') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/awaitDelay.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/awaitDelay.js new file mode 100644 index 00000000..8c9b1a33 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/awaitDelay.js @@ -0,0 +1,22 @@ +var now = require('../time/now'); +var timeout = require('./timeout'); +var append = require('../array/append'); + + /** + * Ensure a minimum delay for callbacks + */ + function awaitDelay( callback, delay ){ + var baseTime = now() + delay; + return function() { + // ensure all browsers will execute it asynchronously (avoid hard + // to catch errors) not using "0" because of old browsers and also + // since new browsers increase the value to be at least "4" + // http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout + var ms = Math.max(baseTime - now(), 4); + return timeout.apply(this, append([callback, ms, this], arguments)); + }; + } + + module.exports = awaitDelay; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/bind.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/bind.js new file mode 100644 index 00000000..c6c47192 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/bind.js @@ -0,0 +1,19 @@ +var slice = require('../array/slice'); + + /** + * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection. + * @param {Function} fn Function. + * @param {object} context Execution context. + * @param {rest} args Arguments (0...n arguments). + * @return {Function} Wrapped Function. + */ + function bind(fn, context, args){ + var argsArr = slice(arguments, 2); //curried args + return function(){ + return fn.apply(context, argsArr.concat(slice(arguments))); + }; + } + + module.exports = bind; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/compose.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/compose.js new file mode 100644 index 00000000..8cd5c5f3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/compose.js @@ -0,0 +1,23 @@ + + + /** + * Returns a function that composes multiple functions, passing results to + * each other. + */ + function compose() { + var fns = arguments; + return function(arg){ + // only cares about the first argument since the chain can only + // deal with a single return value anyway. It should start from + // the last fn. + var n = fns.length; + while (n--) { + arg = fns[n].call(this, arg); + } + return arg; + }; + } + + module.exports = compose; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/constant.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/constant.js new file mode 100644 index 00000000..ab932d9d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/constant.js @@ -0,0 +1,14 @@ + + + /** + * Returns a new function that will return the value + */ + function constant(value){ + return function() { + return value; + }; + } + + module.exports = constant; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/debounce.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/debounce.js new file mode 100644 index 00000000..7f6f3021 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/debounce.js @@ -0,0 +1,32 @@ + + + /** + * Debounce callback execution + */ + function debounce(fn, threshold, isAsap){ + var timeout, result; + function debounced(){ + var args = arguments, context = this; + function delayed(){ + if (! isAsap) { + result = fn.apply(context, args); + } + timeout = null; + } + if (timeout) { + clearTimeout(timeout); + } else if (isAsap) { + result = fn.apply(context, args); + } + timeout = setTimeout(delayed, threshold); + return result; + } + debounced.cancel = function(){ + clearTimeout(timeout); + }; + return debounced; + } + + module.exports = debounce; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/func.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/func.js new file mode 100644 index 00000000..b81bf0a8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/func.js @@ -0,0 +1,14 @@ + + + /** + * Returns a function that call a method on the passed object + */ + function func(name){ + return function(obj){ + return obj[name](); + }; + } + + module.exports = func; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/identity.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/identity.js new file mode 100644 index 00000000..d07b01ad --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/identity.js @@ -0,0 +1,12 @@ + + + /** + * Returns the first argument provided to it. + */ + function identity(val){ + return val; + } + + module.exports = identity; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/makeIterator_.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/makeIterator_.js new file mode 100644 index 00000000..20cc0e7e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/makeIterator_.js @@ -0,0 +1,34 @@ +var identity = require('./identity'); +var prop = require('./prop'); +var deepMatches = require('../object/deepMatches'); + + /** + * Converts argument into a valid iterator. + * Used internally on most array/object/collection methods that receives a + * callback/iterator providing a shortcut syntax. + */ + function makeIterator(src, thisObj){ + if (src == null) { + return identity; + } + switch(typeof src) { + case 'function': + // function is the first to improve perf (most common case) + // also avoid using `Function#call` if not needed, which boosts + // perf a lot in some cases + return (typeof thisObj !== 'undefined')? function(val, i, arr){ + return src.call(thisObj, val, i, arr); + } : src; + case 'object': + return function(val){ + return deepMatches(val, src); + }; + case 'string': + case 'number': + return prop(src); + } + } + + module.exports = makeIterator; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/partial.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/partial.js new file mode 100644 index 00000000..a31dc129 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/partial.js @@ -0,0 +1,23 @@ +var slice = require('../array/slice'); + + /** + * Creates a partially applied function. + */ + function partial(f) { + var as = slice(arguments, 1); + return function() { + var args = as.concat(slice(arguments)); + for (var i = args.length; i--;) { + if (args[i] === partial._) { + args[i] = args.splice(-1)[0]; + } + } + return f.apply(this, args); + }; + } + + partial._ = {}; + + module.exports = partial; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/prop.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/prop.js new file mode 100644 index 00000000..734acb7a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/prop.js @@ -0,0 +1,14 @@ + + + /** + * Returns a function that gets a property of the passed object + */ + function prop(name){ + return function(obj){ + return obj[name]; + }; + } + + module.exports = prop; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/series.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/series.js new file mode 100644 index 00000000..25159c2c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/series.js @@ -0,0 +1,22 @@ + + + /** + * Returns a function that will execute a list of functions in sequence + * passing the same arguments to each one. (useful for batch processing + * items during a forEach loop) + */ + function series(){ + var fns = arguments; + return function(){ + var i = 0, + n = fns.length; + while (i < n) { + fns[i].apply(this, arguments); + i += 1; + } + }; + } + + module.exports = series; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/throttle.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/throttle.js new file mode 100644 index 00000000..0a5e1613 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/throttle.js @@ -0,0 +1,33 @@ +var now = require('../time/now'); + + /** + */ + function throttle(fn, delay){ + var context, timeout, result, args, + diff, prevCall = 0; + function delayed(){ + prevCall = now(); + timeout = null; + result = fn.apply(context, args); + } + function throttled(){ + context = this; + args = arguments; + diff = delay - (now() - prevCall); + if (diff <= 0) { + clearTimeout(timeout); + delayed(); + } else if (! timeout) { + timeout = setTimeout(delayed, diff); + } + return result; + } + throttled.cancel = function(){ + clearTimeout(timeout); + }; + return throttled; + } + + module.exports = throttle; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/timeout.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/timeout.js new file mode 100644 index 00000000..509dd68c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/timeout.js @@ -0,0 +1,17 @@ +var slice = require('../array/slice'); + + /** + * Delays the call of a function within a given context. + */ + function timeout(fn, millis, context){ + + var args = slice(arguments, 3); + + return setTimeout(function() { + fn.apply(context, args); + }, millis); + } + + module.exports = timeout; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/times.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/times.js new file mode 100644 index 00000000..04a11c26 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/times.js @@ -0,0 +1,17 @@ + + + /** + * Iterates over a callback a set amount of times + */ + function times(n, callback, thisObj){ + var i = -1; + while (++i < n) { + if ( callback.call(thisObj, i) === false ) { + break; + } + } + } + + module.exports = times; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/wrap.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/wrap.js new file mode 100644 index 00000000..82d77ff1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/function/wrap.js @@ -0,0 +1,14 @@ +var partial = require('./partial'); + + /** + * Returns the first function passed as an argument to the second, + * allowing you to adjust arguments, run code before and after, and + * conditionally execute the original function. + */ + function wrap(fn, wrapper){ + return partial(wrapper, fn); + } + + module.exports = wrap; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/index.js new file mode 100644 index 00000000..a32126a0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/index.js @@ -0,0 +1,25 @@ +/**@license + * mout v0.11.0 | http://moutjs.com | MIT license + */ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'VERSION' : '0.11.0', + 'array' : require('./array'), + 'collection' : require('./collection'), + 'date' : require('./date'), + 'function' : require('./function'), + 'lang' : require('./lang'), + 'math' : require('./math'), + 'number' : require('./number'), + 'object' : require('./object'), + 'queryString' : require('./queryString'), + 'random' : require('./random'), + 'string' : require('./string'), + 'time' : require('./time'), + 'fn' : require('./function') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang.js new file mode 100644 index 00000000..150007f8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang.js @@ -0,0 +1,40 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'GLOBAL' : require('./lang/GLOBAL'), + 'clone' : require('./lang/clone'), + 'createObject' : require('./lang/createObject'), + 'ctorApply' : require('./lang/ctorApply'), + 'deepClone' : require('./lang/deepClone'), + 'deepEquals' : require('./lang/deepEquals'), + 'defaults' : require('./lang/defaults'), + 'inheritPrototype' : require('./lang/inheritPrototype'), + 'is' : require('./lang/is'), + 'isArguments' : require('./lang/isArguments'), + 'isArray' : require('./lang/isArray'), + 'isBoolean' : require('./lang/isBoolean'), + 'isDate' : require('./lang/isDate'), + 'isEmpty' : require('./lang/isEmpty'), + 'isFinite' : require('./lang/isFinite'), + 'isFunction' : require('./lang/isFunction'), + 'isInteger' : require('./lang/isInteger'), + 'isKind' : require('./lang/isKind'), + 'isNaN' : require('./lang/isNaN'), + 'isNull' : require('./lang/isNull'), + 'isNumber' : require('./lang/isNumber'), + 'isObject' : require('./lang/isObject'), + 'isPlainObject' : require('./lang/isPlainObject'), + 'isPrimitive' : require('./lang/isPrimitive'), + 'isRegExp' : require('./lang/isRegExp'), + 'isString' : require('./lang/isString'), + 'isUndefined' : require('./lang/isUndefined'), + 'isnt' : require('./lang/isnt'), + 'kindOf' : require('./lang/kindOf'), + 'toArray' : require('./lang/toArray'), + 'toNumber' : require('./lang/toNumber'), + 'toString' : require('./lang/toString') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/GLOBAL.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/GLOBAL.js new file mode 100644 index 00000000..4d759ba9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/GLOBAL.js @@ -0,0 +1,7 @@ + + + // Reference to the global context (works on ES3 and ES5-strict mode) + //jshint -W061, -W064 + module.exports = Function('return this')(); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/clone.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/clone.js new file mode 100644 index 00000000..e5154872 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/clone.js @@ -0,0 +1,49 @@ +var kindOf = require('./kindOf'); +var isPlainObject = require('./isPlainObject'); +var mixIn = require('../object/mixIn'); + + /** + * Clone native types. + */ + function clone(val){ + switch (kindOf(val)) { + case 'Object': + return cloneObject(val); + case 'Array': + return cloneArray(val); + case 'RegExp': + return cloneRegExp(val); + case 'Date': + return cloneDate(val); + default: + return val; + } + } + + function cloneObject(source) { + if (isPlainObject(source)) { + return mixIn({}, source); + } else { + return source; + } + } + + function cloneRegExp(r) { + var flags = ''; + flags += r.multiline ? 'm' : ''; + flags += r.global ? 'g' : ''; + flags += r.ignoreCase ? 'i' : ''; + return new RegExp(r.source, flags); + } + + function cloneDate(date) { + return new Date(+date); + } + + function cloneArray(arr) { + return arr.slice(); + } + + module.exports = clone; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/createObject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/createObject.js new file mode 100644 index 00000000..bbc14c1d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/createObject.js @@ -0,0 +1,18 @@ +var mixIn = require('../object/mixIn'); + + /** + * Create Object using prototypal inheritance and setting custom properties. + * - Mix between Douglas Crockford Prototypal Inheritance and the EcmaScript 5 `Object.create()` method. + * @param {object} parent Parent Object. + * @param {object} [props] Object properties. + * @return {object} Created object. + */ + function createObject(parent, props){ + function F(){} + F.prototype = parent; + return mixIn(new F(), props); + + } + module.exports = createObject; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/ctorApply.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/ctorApply.js new file mode 100644 index 00000000..d68dc506 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/ctorApply.js @@ -0,0 +1,17 @@ + + + function F(){} + + /** + * Do fn.apply on a constructor. + */ + function ctorApply(ctor, args) { + F.prototype = ctor.prototype; + var instance = new F(); + ctor.apply(instance, args); + return instance; + } + + module.exports = ctorApply; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/deepClone.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/deepClone.js new file mode 100644 index 00000000..25fd95f1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/deepClone.js @@ -0,0 +1,48 @@ +var clone = require('./clone'); +var forOwn = require('../object/forOwn'); +var kindOf = require('./kindOf'); +var isPlainObject = require('./isPlainObject'); + + /** + * Recursively clone native types. + */ + function deepClone(val, instanceClone) { + switch ( kindOf(val) ) { + case 'Object': + return cloneObject(val, instanceClone); + case 'Array': + return cloneArray(val, instanceClone); + default: + return clone(val); + } + } + + function cloneObject(source, instanceClone) { + if (isPlainObject(source)) { + var out = {}; + forOwn(source, function(val, key) { + this[key] = deepClone(val, instanceClone); + }, out); + return out; + } else if (instanceClone) { + return instanceClone(source); + } else { + return source; + } + } + + function cloneArray(arr, instanceClone) { + var out = [], + i = -1, + n = arr.length, + val; + while (++i < n) { + out[i] = deepClone(arr[i], instanceClone); + } + return out; + } + + module.exports = deepClone; + + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/deepEquals.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/deepEquals.js new file mode 100644 index 00000000..bf2b90dd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/deepEquals.js @@ -0,0 +1,30 @@ +var is = require('./is'); +var isObject = require('./isObject'); +var isArray = require('./isArray'); +var objEquals = require('../object/equals'); +var arrEquals = require('../array/equals'); + + /** + * Recursively checks for same properties and values. + */ + function deepEquals(a, b, callback){ + callback = callback || is; + + var bothObjects = isObject(a) && isObject(b); + var bothArrays = !bothObjects && isArray(a) && isArray(b); + + if (!bothObjects && !bothArrays) { + return callback(a, b); + } + + function compare(a, b){ + return deepEquals(a, b, callback); + } + + var method = bothObjects ? objEquals : arrEquals; + return method(a, b, compare); + } + + module.exports = deepEquals; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/defaults.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/defaults.js new file mode 100644 index 00000000..1111b2ef --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/defaults.js @@ -0,0 +1,17 @@ +var toArray = require('./toArray'); +var find = require('../array/find'); + + /** + * Return first non void argument + */ + function defaults(var_args){ + return find(toArray(arguments), nonVoid); + } + + function nonVoid(val){ + return val != null; + } + + module.exports = defaults; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/inheritPrototype.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/inheritPrototype.js new file mode 100644 index 00000000..1c9da1f7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/inheritPrototype.js @@ -0,0 +1,18 @@ +var createObject = require('./createObject'); + + /** + * Inherit prototype from another Object. + * - inspired by Nicholas Zackas Solution + * @param {object} child Child object + * @param {object} parent Parent Object + */ + function inheritPrototype(child, parent){ + var p = createObject(parent.prototype); + p.constructor = child; + child.prototype = p; + child.super_ = parent; + return p; + } + + module.exports = inheritPrototype; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/is.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/is.js new file mode 100644 index 00000000..4a835739 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/is.js @@ -0,0 +1,23 @@ + + + /** + * Check if both arguments are egal. + */ + function is(x, y){ + // implementation borrowed from harmony:egal spec + if (x === y) { + // 0 === -0, but they are not identical + return x !== 0 || 1 / x === 1 / y; + } + + // NaN !== NaN, but they are identical. + // NaNs are the only non-reflexive value, i.e., if x !== x, + // then x is a NaN. + // isNaN is broken: it converts its argument to number, so + // isNaN("foo") => true + return x !== x && y !== y; + } + + module.exports = is; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isArguments.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isArguments.js new file mode 100644 index 00000000..f7b08ba4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isArguments.js @@ -0,0 +1,15 @@ +var isKind = require('./isKind'); + + /** + */ + var isArgs = isKind(arguments, 'Arguments')? + function(val){ + return isKind(val, 'Arguments'); + } : + function(val){ + // Arguments is an Object on IE7 + return !!(val && Object.prototype.hasOwnProperty.call(val, 'callee')); + }; + + module.exports = isArgs; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isArray.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isArray.js new file mode 100644 index 00000000..262ee400 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isArray.js @@ -0,0 +1,8 @@ +var isKind = require('./isKind'); + /** + */ + var isArray = Array.isArray || function (val) { + return isKind(val, 'Array'); + }; + module.exports = isArray; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isBoolean.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isBoolean.js new file mode 100644 index 00000000..86557cb9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isBoolean.js @@ -0,0 +1,8 @@ +var isKind = require('./isKind'); + /** + */ + function isBoolean(val) { + return isKind(val, 'Boolean'); + } + module.exports = isBoolean; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isDate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isDate.js new file mode 100644 index 00000000..4a5130f2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isDate.js @@ -0,0 +1,8 @@ +var isKind = require('./isKind'); + /** + */ + function isDate(val) { + return isKind(val, 'Date'); + } + module.exports = isDate; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isEmpty.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isEmpty.js new file mode 100644 index 00000000..c7854c6c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isEmpty.js @@ -0,0 +1,24 @@ +var forOwn = require('../object/forOwn'); +var isArray = require('./isArray'); + + function isEmpty(val){ + if (val == null) { + // typeof null == 'object' so we check it first + return true; + } else if ( typeof val === 'string' || isArray(val) ) { + return !val.length; + } else if ( typeof val === 'object' ) { + var result = true; + forOwn(val, function(){ + result = false; + return false; // break loop + }); + return result; + } else { + return true; + } + } + + module.exports = isEmpty; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isFinite.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isFinite.js new file mode 100644 index 00000000..812e3177 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isFinite.js @@ -0,0 +1,20 @@ +var isNumber = require('./isNumber'); +var GLOBAL = require('./GLOBAL'); + + /** + * Check if value is finite + */ + function isFinite(val){ + var is = false; + if (typeof val === 'string' && val !== '') { + is = GLOBAL.isFinite( parseFloat(val) ); + } else if (isNumber(val)){ + // need to use isNumber because of Number constructor + is = GLOBAL.isFinite( val ); + } + return is; + } + + module.exports = isFinite; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isFunction.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isFunction.js new file mode 100644 index 00000000..216879f6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isFunction.js @@ -0,0 +1,8 @@ +var isKind = require('./isKind'); + /** + */ + function isFunction(val) { + return isKind(val, 'Function'); + } + module.exports = isFunction; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isInteger.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isInteger.js new file mode 100644 index 00000000..29f95d96 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isInteger.js @@ -0,0 +1,12 @@ +var isNumber = require('./isNumber'); + + /** + * Check if value is an integer + */ + function isInteger(val){ + return isNumber(val) && (val % 1 === 0); + } + + module.exports = isInteger; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isKind.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isKind.js new file mode 100644 index 00000000..02301e04 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isKind.js @@ -0,0 +1,9 @@ +var kindOf = require('./kindOf'); + /** + * Check if value is from a specific "kind". + */ + function isKind(val, kind){ + return kindOf(val) === kind; + } + module.exports = isKind; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isNaN.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isNaN.js new file mode 100644 index 00000000..b1018ec2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isNaN.js @@ -0,0 +1,16 @@ +var isNumber = require('./isNumber'); +var $isNaN = require('../number/isNaN'); + + /** + * Check if value is NaN for realz + */ + function isNaN(val){ + // based on the fact that NaN !== NaN + // need to check if it's a number to avoid conflicts with host objects + // also need to coerce ToNumber to avoid edge case `new Number(NaN)` + return !isNumber(val) || $isNaN(Number(val)); + } + + module.exports = isNaN; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isNull.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isNull.js new file mode 100644 index 00000000..6252f9ef --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isNull.js @@ -0,0 +1,9 @@ + + /** + */ + function isNull(val){ + return val === null; + } + module.exports = isNull; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isNumber.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isNumber.js new file mode 100644 index 00000000..126c1cce --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isNumber.js @@ -0,0 +1,8 @@ +var isKind = require('./isKind'); + /** + */ + function isNumber(val) { + return isKind(val, 'Number'); + } + module.exports = isNumber; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isObject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isObject.js new file mode 100644 index 00000000..7350c891 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isObject.js @@ -0,0 +1,8 @@ +var isKind = require('./isKind'); + /** + */ + function isObject(val) { + return isKind(val, 'Object'); + } + module.exports = isObject; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isPlainObject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isPlainObject.js new file mode 100644 index 00000000..b81342ee --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isPlainObject.js @@ -0,0 +1,13 @@ + + + /** + * Checks if the value is created by the `Object` constructor. + */ + function isPlainObject(value) { + return (!!value && typeof value === 'object' && + value.constructor === Object); + } + + module.exports = isPlainObject; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isPrimitive.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isPrimitive.js new file mode 100644 index 00000000..e255475b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isPrimitive.js @@ -0,0 +1,21 @@ + + + /** + * Checks if the object is a primitive + */ + function isPrimitive(value) { + // Using switch fallthrough because it's simple to read and is + // generally fast: http://jsperf.com/testing-value-is-primitive/5 + switch (typeof value) { + case "string": + case "number": + case "boolean": + return true; + } + + return value == null; + } + + module.exports = isPrimitive; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isRegExp.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isRegExp.js new file mode 100644 index 00000000..fc5459a9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isRegExp.js @@ -0,0 +1,8 @@ +var isKind = require('./isKind'); + /** + */ + function isRegExp(val) { + return isKind(val, 'RegExp'); + } + module.exports = isRegExp; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isString.js new file mode 100644 index 00000000..f8906584 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isString.js @@ -0,0 +1,8 @@ +var isKind = require('./isKind'); + /** + */ + function isString(val) { + return isKind(val, 'String'); + } + module.exports = isString; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isUndefined.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isUndefined.js new file mode 100644 index 00000000..fb2261df --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isUndefined.js @@ -0,0 +1,10 @@ + + var UNDEF; + + /** + */ + function isUndef(val){ + return val === UNDEF; + } + module.exports = isUndef; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isnt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isnt.js new file mode 100644 index 00000000..9dad58ce --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/isnt.js @@ -0,0 +1,12 @@ +var is = require('./is'); + + /** + * Check if both values are not identical/egal + */ + function isnt(x, y){ + return !is(x, y); + } + + module.exports = isnt; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/kindOf.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/kindOf.js new file mode 100644 index 00000000..663464d0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/kindOf.js @@ -0,0 +1,20 @@ + + + var _rKind = /^\[object (.*)\]$/, + _toString = Object.prototype.toString, + UNDEF; + + /** + * Gets the "kind" of value. (e.g. "String", "Number", etc) + */ + function kindOf(val) { + if (val === null) { + return 'Null'; + } else if (val === UNDEF) { + return 'Undefined'; + } else { + return _rKind.exec( _toString.call(val) )[1]; + } + } + module.exports = kindOf; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/toArray.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/toArray.js new file mode 100644 index 00000000..1f3a2b6e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/toArray.js @@ -0,0 +1,30 @@ +var kindOf = require('./kindOf'); +var GLOBAL = require('./GLOBAL'); + + /** + * Convert array-like object into array + */ + function toArray(val){ + var ret = [], + kind = kindOf(val), + n; + + if (val != null) { + if ( val.length == null || kind === 'String' || kind === 'Function' || kind === 'RegExp' || val === GLOBAL ) { + //string, regexp, function have .length but user probably just want + //to wrap value into an array.. + ret[ret.length] = val; + } else { + //window returns true on isObject in IE7 and may have length + //property. `typeof NodeList` returns `function` on Safari so + //we can't use it (#58) + n = val.length; + while (n--) { + ret[n] = val[n]; + } + } + } + return ret; + } + module.exports = toArray; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/toNumber.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/toNumber.js new file mode 100644 index 00000000..8b6df344 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/toNumber.js @@ -0,0 +1,20 @@ +var isArray = require('./isArray'); + + /** + * covert value into number if numeric + */ + function toNumber(val){ + // numberic values should come first because of -0 + if (typeof val === 'number') return val; + // we want all falsy values (besides -0) to return zero to avoid + // headaches + if (!val) return 0; + if (typeof val === 'string') return parseFloat(val); + // arrays are edge cases. `Number([4]) === 4` + if (isArray(val)) return NaN; + return Number(val); + } + + module.exports = toNumber; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/toString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/toString.js new file mode 100644 index 00000000..ae5c2b0f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/lang/toString.js @@ -0,0 +1,13 @@ + + + /** + * Typecast a value to a String, using an empty string value for null or + * undefined. + */ + function toString(val){ + return val == null ? '' : val.toString(); + } + + module.exports = toString; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math.js new file mode 100644 index 00000000..c6ee889b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math.js @@ -0,0 +1,19 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'ceil' : require('./math/ceil'), + 'clamp' : require('./math/clamp'), + 'countSteps' : require('./math/countSteps'), + 'floor' : require('./math/floor'), + 'inRange' : require('./math/inRange'), + 'isNear' : require('./math/isNear'), + 'lerp' : require('./math/lerp'), + 'loop' : require('./math/loop'), + 'map' : require('./math/map'), + 'norm' : require('./math/norm'), + 'round' : require('./math/round') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/ceil.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/ceil.js new file mode 100644 index 00000000..a279e158 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/ceil.js @@ -0,0 +1,11 @@ + + /** + * Round value up with a custom radix. + */ + function ceil(val, step){ + step = Math.abs(step || 1); + return Math.ceil(val / step) * step; + } + + module.exports = ceil; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/clamp.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/clamp.js new file mode 100644 index 00000000..e929a9a6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/clamp.js @@ -0,0 +1,9 @@ + + /** + * Clamps value inside range. + */ + function clamp(val, min, max){ + return val < min? min : (val > max? max : val); + } + module.exports = clamp; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/countSteps.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/countSteps.js new file mode 100644 index 00000000..60ac90c3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/countSteps.js @@ -0,0 +1,16 @@ + + /** + * Count number of full steps. + */ + function countSteps(val, step, overflow){ + val = Math.floor(val / step); + + if (overflow) { + return val % overflow; + } + + return val; + } + + module.exports = countSteps; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/floor.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/floor.js new file mode 100644 index 00000000..9de50531 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/floor.js @@ -0,0 +1,10 @@ + + /** + * Floor value to full steps. + */ + function floor(val, step){ + step = Math.abs(step || 1); + return Math.floor(val / step) * step; + } + module.exports = floor; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/inRange.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/inRange.js new file mode 100644 index 00000000..763218f8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/inRange.js @@ -0,0 +1,11 @@ + + /** + * Checks if value is inside the range. + */ + function inRange(val, min, max, threshold){ + threshold = threshold || 0; + return (val + threshold >= min && val - threshold <= max); + } + + module.exports = inRange; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/isNear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/isNear.js new file mode 100644 index 00000000..45486b6d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/isNear.js @@ -0,0 +1,9 @@ + + /** + * Check if value is close to target. + */ + function isNear(val, target, threshold){ + return (Math.abs(val - target) <= threshold); + } + module.exports = isNear; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/lerp.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/lerp.js new file mode 100644 index 00000000..111e2717 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/lerp.js @@ -0,0 +1,11 @@ + + /** + * Linear interpolation. + * IMPORTANT:will return `Infinity` if numbers overflow Number.MAX_VALUE + */ + function lerp(ratio, start, end){ + return start + (end - start) * ratio; + } + + module.exports = lerp; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/loop.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/loop.js new file mode 100644 index 00000000..35207c1a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/loop.js @@ -0,0 +1,10 @@ + + /** + * Loops value inside range. + */ + function loop(val, min, max){ + return val < min? max : (val > max? min : val); + } + + module.exports = loop; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/map.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/map.js new file mode 100644 index 00000000..96c4b787 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/map.js @@ -0,0 +1,11 @@ +var lerp = require('./lerp'); +var norm = require('./norm'); + /** + * Maps a number from one scale to another. + * @example map(3, 0, 4, -1, 1) -> 0.5 + */ + function map(val, min1, max1, min2, max2){ + return lerp( norm(val, min1, max1), min2, max2 ); + } + module.exports = map; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/norm.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/norm.js new file mode 100644 index 00000000..8ee53d82 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/norm.js @@ -0,0 +1,13 @@ + + /** + * Gets normalized ratio of value inside range. + */ + function norm(val, min, max){ + if (val < min || val > max) { + throw new RangeError('value (' + val + ') must be between ' + min + ' and ' + max); + } + + return val === max ? 1 : (val - min) / (max - min); + } + module.exports = norm; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/round.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/round.js new file mode 100644 index 00000000..d108e6cd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/math/round.js @@ -0,0 +1,12 @@ + + /** + * Round number to a specific radix + */ + function round(value, radix){ + radix = radix || 1; // default round 1 + return Math.round(value / radix) * radix; + } + + module.exports = round; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number.js new file mode 100644 index 00000000..ba7034a7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number.js @@ -0,0 +1,25 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'MAX_INT' : require('./number/MAX_INT'), + 'MAX_SAFE_INTEGER' : require('./number/MAX_SAFE_INTEGER'), + 'MAX_UINT' : require('./number/MAX_UINT'), + 'MIN_INT' : require('./number/MIN_INT'), + 'abbreviate' : require('./number/abbreviate'), + 'currencyFormat' : require('./number/currencyFormat'), + 'enforcePrecision' : require('./number/enforcePrecision'), + 'isNaN' : require('./number/isNaN'), + 'nth' : require('./number/nth'), + 'ordinal' : require('./number/ordinal'), + 'pad' : require('./number/pad'), + 'rol' : require('./number/rol'), + 'ror' : require('./number/ror'), + 'sign' : require('./number/sign'), + 'toInt' : require('./number/toInt'), + 'toUInt' : require('./number/toUInt'), + 'toUInt31' : require('./number/toUInt31') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MAX_INT.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MAX_INT.js new file mode 100644 index 00000000..1d6f0e48 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MAX_INT.js @@ -0,0 +1,6 @@ +/** + * @constant Maximum 32-bit signed integer value. (2^31 - 1) + */ + + module.exports = 2147483647; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MAX_SAFE_INTEGER.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MAX_SAFE_INTEGER.js new file mode 100644 index 00000000..b13e538a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MAX_SAFE_INTEGER.js @@ -0,0 +1,7 @@ + + + // maximum safe integer (Math.pow(2, 53) - 1) + // see: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer + module.exports = 9007199254740991; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MAX_UINT.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MAX_UINT.js new file mode 100644 index 00000000..700da0f6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MAX_UINT.js @@ -0,0 +1,6 @@ +/** + * @constant Maximum 32-bit unsigned integet value (2^32 - 1) + */ + + module.exports = 4294967295; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MIN_INT.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MIN_INT.js new file mode 100644 index 00000000..b34ab2ce --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/MIN_INT.js @@ -0,0 +1,6 @@ +/** + * @constant Minimum 32-bit signed integer value (-2^31). + */ + + module.exports = -2147483648; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/abbreviate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/abbreviate.js new file mode 100644 index 00000000..dd6716b9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/abbreviate.js @@ -0,0 +1,35 @@ +var enforcePrecision = require('./enforcePrecision'); + + var _defaultDict = { + thousand : 'K', + million : 'M', + billion : 'B' + }; + + /** + * Abbreviate number if bigger than 1000. (eg: 2.5K, 17.5M, 3.4B, ...) + */ + function abbreviateNumber(val, nDecimals, dict){ + nDecimals = nDecimals != null? nDecimals : 1; + dict = dict || _defaultDict; + val = enforcePrecision(val, nDecimals); + + var str, mod; + + if (val < 1000000) { + mod = enforcePrecision(val / 1000, nDecimals); + // might overflow to next scale during rounding + str = mod < 1000? mod + dict.thousand : 1 + dict.million; + } else if (val < 1000000000) { + mod = enforcePrecision(val / 1000000, nDecimals); + str = mod < 1000? mod + dict.million : 1 + dict.billion; + } else { + str = enforcePrecision(val / 1000000000, nDecimals) + dict.billion; + } + + return str; + } + + module.exports = abbreviateNumber; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/currencyFormat.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/currencyFormat.js new file mode 100644 index 00000000..c85a6685 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/currencyFormat.js @@ -0,0 +1,27 @@ +var toNumber = require('../lang/toNumber'); + + /** + * Converts number into currency format + */ + function currencyFormat(val, nDecimalDigits, decimalSeparator, thousandsSeparator) { + val = toNumber(val); + nDecimalDigits = nDecimalDigits == null? 2 : nDecimalDigits; + decimalSeparator = decimalSeparator == null? '.' : decimalSeparator; + thousandsSeparator = thousandsSeparator == null? ',' : thousandsSeparator; + + //can't use enforce precision since it returns a number and we are + //doing a RegExp over the string + var fixed = val.toFixed(nDecimalDigits), + //separate begin [$1], middle [$2] and decimal digits [$4] + parts = new RegExp('^(-?\\d{1,3})((?:\\d{3})+)(\\.(\\d{'+ nDecimalDigits +'}))?$').exec( fixed ); + + if(parts){ //val >= 1000 || val <= -1000 + return parts[1] + parts[2].replace(/\d{3}/g, thousandsSeparator + '$&') + (parts[4] ? decimalSeparator + parts[4] : ''); + }else{ + return fixed.replace('.', decimalSeparator); + } + } + + module.exports = currencyFormat; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/enforcePrecision.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/enforcePrecision.js new file mode 100644 index 00000000..3d3b2d40 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/enforcePrecision.js @@ -0,0 +1,12 @@ +var toNumber = require('../lang/toNumber'); + /** + * Enforce a specific amount of decimal digits and also fix floating + * point rounding issues. + */ + function enforcePrecision(val, nDecimalDigits){ + val = toNumber(val); + var pow = Math.pow(10, nDecimalDigits); + return +(Math.round(val * pow) / pow).toFixed(nDecimalDigits); + } + module.exports = enforcePrecision; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/isNaN.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/isNaN.js new file mode 100644 index 00000000..3799f3b6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/isNaN.js @@ -0,0 +1,14 @@ + + + /** + * ES6 Number.isNaN + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN + */ + function isNaN(val){ + // jshint eqeqeq:false + return typeof val === 'number' && val != val; + } + + module.exports = isNaN; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/nth.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/nth.js new file mode 100644 index 00000000..43ffb214 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/nth.js @@ -0,0 +1,25 @@ + + + /** + * Returns "nth" of number (1 = "st", 2 = "nd", 3 = "rd", 4..10 = "th", ...) + */ + function nth(i) { + var t = (i % 100); + if (t >= 10 && t <= 20) { + return 'th'; + } + switch(i % 10) { + case 1: + return 'st'; + case 2: + return 'nd'; + case 3: + return 'rd'; + default: + return 'th'; + } + } + + module.exports = nth; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/ordinal.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/ordinal.js new file mode 100644 index 00000000..939a0fa9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/ordinal.js @@ -0,0 +1,14 @@ +var toInt = require('./toInt'); +var nth = require('./nth'); + + /** + * converts number into ordinal form (1st, 2nd, 3rd, 4th, ...) + */ + function ordinal(n){ + n = toInt(n); + return n + nth(n); + } + + module.exports = ordinal; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/pad.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/pad.js new file mode 100644 index 00000000..1f83af45 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/pad.js @@ -0,0 +1,14 @@ +var lpad = require('../string/lpad'); +var toNumber = require('../lang/toNumber'); + + /** + * Add padding zeros if n.length < minLength. + */ + function pad(n, minLength, char){ + n = toNumber(n); + return lpad(''+ n, minLength, char || '0'); + } + + module.exports = pad; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/rol.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/rol.js new file mode 100644 index 00000000..ecd58da4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/rol.js @@ -0,0 +1,10 @@ + + /** + * Bitwise circular shift left + * http://en.wikipedia.org/wiki/Circular_shift + */ + function rol(val, shift){ + return (val << shift) | (val >> (32 - shift)); + } + module.exports = rol; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/ror.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/ror.js new file mode 100644 index 00000000..2eda81da --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/ror.js @@ -0,0 +1,10 @@ + + /** + * Bitwise circular shift right + * http://en.wikipedia.org/wiki/Circular_shift + */ + function ror(val, shift){ + return (val >> shift) | (val << (32 - shift)); + } + module.exports = ror; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/sign.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/sign.js new file mode 100644 index 00000000..7f9a1e2f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/sign.js @@ -0,0 +1,15 @@ +var toNumber = require('../lang/toNumber'); + + /** + * Get sign of the value. + */ + function sign(val) { + var num = toNumber(val); + if (num === 0) return num; // +0 and +0 === 0 + if (isNaN(num)) return num; // NaN + return num < 0? -1 : 1; + } + + module.exports = sign; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/toInt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/toInt.js new file mode 100644 index 00000000..72fd7de4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/toInt.js @@ -0,0 +1,17 @@ + + + /** + * "Convert" value into an 32-bit integer. + * Works like `Math.floor` if val > 0 and `Math.ceil` if val < 0. + * IMPORTANT: val will wrap at 2^31 and -2^31. + * Perf tests: http://jsperf.com/vs-vs-parseint-bitwise-operators/7 + */ + function toInt(val){ + // we do not use lang/toNumber because of perf and also because it + // doesn't break the functionality + return ~~val; + } + + module.exports = toInt; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/toUInt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/toUInt.js new file mode 100644 index 00000000..d2796563 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/toUInt.js @@ -0,0 +1,15 @@ + + + /** + * "Convert" value into a 32-bit unsigned integer. + * IMPORTANT: Value will wrap at 2^32. + */ + function toUInt(val){ + // we do not use lang/toNumber because of perf and also because it + // doesn't break the functionality + return val >>> 0; + } + + module.exports = toUInt; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/toUInt31.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/toUInt31.js new file mode 100644 index 00000000..6cd3bb52 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/number/toUInt31.js @@ -0,0 +1,15 @@ +var MAX_INT = require('./MAX_INT'); + + /** + * "Convert" value into an 31-bit unsigned integer (since 1 bit is used for sign). + * IMPORTANT: value wil wrap at 2^31, if negative will return 0. + */ + function toUInt31(val){ + // we do not use lang/toNumber because of perf and also because it + // doesn't break the functionality + return (val <= 0)? 0 : (val > MAX_INT? ~~(val % (MAX_INT + 1)) : ~~val); + } + + module.exports = toUInt31; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object.js new file mode 100644 index 00000000..cd431ff9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object.js @@ -0,0 +1,43 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'bindAll' : require('./object/bindAll'), + 'contains' : require('./object/contains'), + 'deepFillIn' : require('./object/deepFillIn'), + 'deepMatches' : require('./object/deepMatches'), + 'deepMixIn' : require('./object/deepMixIn'), + 'equals' : require('./object/equals'), + 'every' : require('./object/every'), + 'fillIn' : require('./object/fillIn'), + 'filter' : require('./object/filter'), + 'find' : require('./object/find'), + 'forIn' : require('./object/forIn'), + 'forOwn' : require('./object/forOwn'), + 'functions' : require('./object/functions'), + 'get' : require('./object/get'), + 'has' : require('./object/has'), + 'hasOwn' : require('./object/hasOwn'), + 'keys' : require('./object/keys'), + 'map' : require('./object/map'), + 'matches' : require('./object/matches'), + 'max' : require('./object/max'), + 'merge' : require('./object/merge'), + 'min' : require('./object/min'), + 'mixIn' : require('./object/mixIn'), + 'namespace' : require('./object/namespace'), + 'omit' : require('./object/omit'), + 'pick' : require('./object/pick'), + 'pluck' : require('./object/pluck'), + 'reduce' : require('./object/reduce'), + 'reject' : require('./object/reject'), + 'result' : require('./object/result'), + 'set' : require('./object/set'), + 'size' : require('./object/size'), + 'some' : require('./object/some'), + 'unset' : require('./object/unset'), + 'values' : require('./object/values') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/bindAll.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/bindAll.js new file mode 100644 index 00000000..c8a2034b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/bindAll.js @@ -0,0 +1,19 @@ +var functions = require('./functions'); +var bind = require('../function/bind'); +var forEach = require('../array/forEach'); +var slice = require('../array/slice'); + + /** + * Binds methods of the object to be run in it's own context. + */ + function bindAll(obj, rest_methodNames){ + var keys = arguments.length > 1? + slice(arguments, 1) : functions(obj); + forEach(keys, function(key){ + obj[key] = bind(obj[key], obj); + }); + } + + module.exports = bindAll; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/contains.js new file mode 100644 index 00000000..8076e2c5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/contains.js @@ -0,0 +1,13 @@ +var some = require('./some'); + + /** + * Check if object contains value + */ + function contains(obj, needle) { + return some(obj, function(val) { + return (val === needle); + }); + } + module.exports = contains; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/deepFillIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/deepFillIn.js new file mode 100644 index 00000000..6568ea87 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/deepFillIn.js @@ -0,0 +1,33 @@ +var forOwn = require('./forOwn'); +var isPlainObject = require('../lang/isPlainObject'); + + /** + * Deeply copy missing properties in the target from the defaults. + */ + function deepFillIn(target, defaults){ + var i = 0, + n = arguments.length, + obj; + + while(++i < n) { + obj = arguments[i]; + if (obj) { + // jshint loopfunc: true + forOwn(obj, function(newValue, key) { + var curValue = target[key]; + if (curValue == null) { + target[key] = newValue; + } else if (isPlainObject(curValue) && + isPlainObject(newValue)) { + deepFillIn(curValue, newValue); + } + }); + } + } + + return target; + } + + module.exports = deepFillIn; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/deepMatches.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/deepMatches.js new file mode 100644 index 00000000..3366c52d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/deepMatches.js @@ -0,0 +1,55 @@ +var forOwn = require('./forOwn'); +var isArray = require('../lang/isArray'); + + function containsMatch(array, pattern) { + var i = -1, length = array.length; + while (++i < length) { + if (deepMatches(array[i], pattern)) { + return true; + } + } + + return false; + } + + function matchArray(target, pattern) { + var i = -1, patternLength = pattern.length; + while (++i < patternLength) { + if (!containsMatch(target, pattern[i])) { + return false; + } + } + + return true; + } + + function matchObject(target, pattern) { + var result = true; + forOwn(pattern, function(val, key) { + if (!deepMatches(target[key], val)) { + // Return false to break out of forOwn early + return (result = false); + } + }); + + return result; + } + + /** + * Recursively check if the objects match. + */ + function deepMatches(target, pattern){ + if (target && typeof target === 'object') { + if (isArray(target) && isArray(pattern)) { + return matchArray(target, pattern); + } else { + return matchObject(target, pattern); + } + } else { + return target === pattern; + } + } + + module.exports = deepMatches; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/deepMixIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/deepMixIn.js new file mode 100644 index 00000000..a97e98d0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/deepMixIn.js @@ -0,0 +1,34 @@ +var forOwn = require('./forOwn'); +var isPlainObject = require('../lang/isPlainObject'); + + /** + * Mixes objects into the target object, recursively mixing existing child + * objects. + */ + function deepMixIn(target, objects) { + var i = 0, + n = arguments.length, + obj; + + while(++i < n){ + obj = arguments[i]; + if (obj) { + forOwn(obj, copyProp, target); + } + } + + return target; + } + + function copyProp(val, key) { + var existing = this[key]; + if (isPlainObject(val) && isPlainObject(existing)) { + deepMixIn(existing, val); + } else { + this[key] = val; + } + } + + module.exports = deepMixIn; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/equals.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/equals.js new file mode 100644 index 00000000..7c89ab8c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/equals.js @@ -0,0 +1,33 @@ +var hasOwn = require('./hasOwn'); +var every = require('./every'); +var isObject = require('../lang/isObject'); +var is = require('../lang/is'); + + // Makes a function to compare the object values from the specified compare + // operation callback. + function makeCompare(callback) { + return function(value, key) { + return hasOwn(this, key) && callback(value, this[key]); + }; + } + + function checkProperties(value, key) { + return hasOwn(this, key); + } + + /** + * Checks if two objects have the same keys and values. + */ + function equals(a, b, callback) { + callback = callback || is; + + if (!isObject(a) || !isObject(b)) { + return callback(a, b); + } + + return (every(a, makeCompare(callback), b) && + every(b, checkProperties, a)); + } + + module.exports = equals; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/every.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/every.js new file mode 100644 index 00000000..01106e5f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/every.js @@ -0,0 +1,23 @@ +var forOwn = require('./forOwn'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Object every + */ + function every(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = true; + forOwn(obj, function(val, key) { + // we consider any falsy values as "false" on purpose so shorthand + // syntax can be used to check property existence + if (!callback(val, key, obj)) { + result = false; + return false; // break + } + }); + return result; + } + + module.exports = every; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/fillIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/fillIn.js new file mode 100644 index 00000000..4010e284 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/fillIn.js @@ -0,0 +1,21 @@ +var forEach = require('../array/forEach'); +var slice = require('../array/slice'); +var forOwn = require('./forOwn'); + + /** + * Copy missing properties in the obj from the defaults. + */ + function fillIn(obj, var_defaults){ + forEach(slice(arguments, 1), function(base){ + forOwn(base, function(val, key){ + if (obj[key] == null) { + obj[key] = val; + } + }); + }); + return obj; + } + + module.exports = fillIn; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/filter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/filter.js new file mode 100644 index 00000000..3a83a92f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/filter.js @@ -0,0 +1,20 @@ +var forOwn = require('./forOwn'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Creates a new object with all the properties where the callback returns + * true. + */ + function filterValues(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var output = {}; + forOwn(obj, function(value, key, obj) { + if (callback(value, key, obj)) { + output[key] = value; + } + }); + + return output; + } + module.exports = filterValues; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/find.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/find.js new file mode 100644 index 00000000..d39c0706 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/find.js @@ -0,0 +1,21 @@ +var some = require('./some'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Returns first item that matches criteria + */ + function find(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result; + some(obj, function(value, key, obj) { + if (callback(value, key, obj)) { + result = value; + return true; //break + } + }); + return result; + } + + module.exports = find; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/forIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/forIn.js new file mode 100644 index 00000000..7fe96ce8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/forIn.js @@ -0,0 +1,76 @@ +var hasOwn = require('./hasOwn'); + + var _hasDontEnumBug, + _dontEnums; + + function checkDontEnum(){ + _dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + + _hasDontEnumBug = true; + + for (var key in {'toString': null}) { + _hasDontEnumBug = false; + } + } + + /** + * Similar to Array/forEach but works over object properties and fixes Don't + * Enum bug on IE. + * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation + */ + function forIn(obj, fn, thisObj){ + var key, i = 0; + // no need to check if argument is a real object that way we can use + // it for arrays, functions, date, etc. + + //post-pone check till needed + if (_hasDontEnumBug == null) checkDontEnum(); + + for (key in obj) { + if (exec(fn, obj, key, thisObj) === false) { + break; + } + } + + + if (_hasDontEnumBug) { + var ctor = obj.constructor, + isProto = !!ctor && obj === ctor.prototype; + + while (key = _dontEnums[i++]) { + // For constructor, if it is a prototype object the constructor + // is always non-enumerable unless defined otherwise (and + // enumerated above). For non-prototype objects, it will have + // to be defined on this object, since it cannot be defined on + // any prototype objects. + // + // For other [[DontEnum]] properties, check if the value is + // different than Object prototype value. + if ( + (key !== 'constructor' || + (!isProto && hasOwn(obj, key))) && + obj[key] !== Object.prototype[key] + ) { + if (exec(fn, obj, key, thisObj) === false) { + break; + } + } + } + } + } + + function exec(fn, obj, key, thisObj){ + return fn.call(thisObj, obj[key], key, obj); + } + + module.exports = forIn; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/forOwn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/forOwn.js new file mode 100644 index 00000000..5f2dfbfc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/forOwn.js @@ -0,0 +1,19 @@ +var hasOwn = require('./hasOwn'); +var forIn = require('./forIn'); + + /** + * Similar to Array/forEach but works over object properties and fixes Don't + * Enum bug on IE. + * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation + */ + function forOwn(obj, fn, thisObj){ + forIn(obj, function(val, key){ + if (hasOwn(obj, key)) { + return fn.call(thisObj, obj[key], key, obj); + } + }); + } + + module.exports = forOwn; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/functions.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/functions.js new file mode 100644 index 00000000..f5717979 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/functions.js @@ -0,0 +1,18 @@ +var forIn = require('./forIn'); + + /** + * return a list of all enumerable properties that have function values + */ + function functions(obj){ + var keys = []; + forIn(obj, function(val, key){ + if (typeof val === 'function'){ + keys.push(key); + } + }); + return keys.sort(); + } + + module.exports = functions; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/get.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/get.js new file mode 100644 index 00000000..9c64e216 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/get.js @@ -0,0 +1,20 @@ +var isPrimitive = require('../lang/isPrimitive'); + + /** + * get "nested" object property + */ + function get(obj, prop){ + var parts = prop.split('.'), + last = parts.pop(); + + while (prop = parts.shift()) { + obj = obj[prop]; + if (obj == null) return; + } + + return obj[last]; + } + + module.exports = get; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/has.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/has.js new file mode 100644 index 00000000..ca9f2289 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/has.js @@ -0,0 +1,15 @@ +var get = require('./get'); + + var UNDEF; + + /** + * Check if object has nested property. + */ + function has(obj, prop){ + return get(obj, prop) !== UNDEF; + } + + module.exports = has; + + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/hasOwn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/hasOwn.js new file mode 100644 index 00000000..7e3c82ae --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/hasOwn.js @@ -0,0 +1,12 @@ + + + /** + * Safer Object.hasOwnProperty + */ + function hasOwn(obj, prop){ + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + module.exports = hasOwn; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/keys.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/keys.js new file mode 100644 index 00000000..dd2f4f55 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/keys.js @@ -0,0 +1,16 @@ +var forOwn = require('./forOwn'); + + /** + * Get object keys + */ + var keys = Object.keys || function (obj) { + var keys = []; + forOwn(obj, function(val, key){ + keys.push(key); + }); + return keys; + }; + + module.exports = keys; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/map.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/map.js new file mode 100644 index 00000000..dd449a78 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/map.js @@ -0,0 +1,18 @@ +var forOwn = require('./forOwn'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Creates a new object where all the values are the result of calling + * `callback`. + */ + function mapValues(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var output = {}; + forOwn(obj, function(val, key, obj) { + output[key] = callback(val, key, obj); + }); + + return output; + } + module.exports = mapValues; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/matches.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/matches.js new file mode 100644 index 00000000..6074faa2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/matches.js @@ -0,0 +1,20 @@ +var forOwn = require('./forOwn'); + + /** + * checks if a object contains all given properties/values + */ + function matches(target, props){ + // can't use "object/every" because of circular dependency + var result = true; + forOwn(props, function(val, key){ + if (target[key] !== val) { + // break loop at first difference + return (result = false); + } + }); + return result; + } + + module.exports = matches; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/max.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/max.js new file mode 100644 index 00000000..3e8e92c7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/max.js @@ -0,0 +1,12 @@ +var arrMax = require('../array/max'); +var values = require('./values'); + + /** + * Returns maximum value inside object. + */ + function max(obj, compareFn) { + return arrMax(values(obj), compareFn); + } + + module.exports = max; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/merge.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/merge.js new file mode 100644 index 00000000..6961f608 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/merge.js @@ -0,0 +1,40 @@ +var hasOwn = require('./hasOwn'); +var deepClone = require('../lang/deepClone'); +var isObject = require('../lang/isObject'); + + /** + * Deep merge objects. + */ + function merge() { + var i = 1, + key, val, obj, target; + + // make sure we don't modify source element and it's properties + // objects are passed by reference + target = deepClone( arguments[0] ); + + while (obj = arguments[i++]) { + for (key in obj) { + if ( ! hasOwn(obj, key) ) { + continue; + } + + val = obj[key]; + + if ( isObject(val) && isObject(target[key]) ){ + // inception, deep merge objects + target[key] = merge(target[key], val); + } else { + // make sure arrays, regexp, date, objects are cloned + target[key] = deepClone(val); + } + + } + } + + return target; + } + + module.exports = merge; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/min.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/min.js new file mode 100644 index 00000000..e1e66976 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/min.js @@ -0,0 +1,12 @@ +var arrMin = require('../array/min'); +var values = require('./values'); + + /** + * Returns minimum value inside object. + */ + function min(obj, iterator) { + return arrMin(values(obj), iterator); + } + + module.exports = min; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/mixIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/mixIn.js new file mode 100644 index 00000000..55ec8fd5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/mixIn.js @@ -0,0 +1,28 @@ +var forOwn = require('./forOwn'); + + /** + * Combine properties from all the objects into first one. + * - This method affects target object in place, if you want to create a new Object pass an empty object as first param. + * @param {object} target Target Object + * @param {...object} objects Objects to be combined (0...n objects). + * @return {object} Target Object. + */ + function mixIn(target, objects){ + var i = 0, + n = arguments.length, + obj; + while(++i < n){ + obj = arguments[i]; + if (obj != null) { + forOwn(obj, copyProp, target); + } + } + return target; + } + + function copyProp(val, key){ + this[key] = val; + } + + module.exports = mixIn; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/namespace.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/namespace.js new file mode 100644 index 00000000..c6e79f63 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/namespace.js @@ -0,0 +1,19 @@ +var forEach = require('../array/forEach'); + + /** + * Create nested object if non-existent + */ + function namespace(obj, path){ + if (!path) return obj; + forEach(path.split('.'), function(key){ + if (!obj[key]) { + obj[key] = {}; + } + obj = obj[key]; + }); + return obj; + } + + module.exports = namespace; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/omit.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/omit.js new file mode 100644 index 00000000..7a5ef055 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/omit.js @@ -0,0 +1,21 @@ +var slice = require('../array/slice'); +var contains = require('../array/contains'); + + /** + * Return a copy of the object, filtered to only contain properties except the blacklisted keys. + */ + function omit(obj, var_keys){ + var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1), + out = {}; + + for (var property in obj) { + if (obj.hasOwnProperty(property) && !contains(keys, property)) { + out[property] = obj[property]; + } + } + return out; + } + + module.exports = omit; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/pick.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/pick.js new file mode 100644 index 00000000..da5a5640 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/pick.js @@ -0,0 +1,18 @@ +var slice = require('../array/slice'); + + /** + * Return a copy of the object, filtered to only have values for the whitelisted keys. + */ + function pick(obj, var_keys){ + var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1), + out = {}, + i = 0, key; + while (key = keys[i++]) { + out[key] = obj[key]; + } + return out; + } + + module.exports = pick; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/pluck.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/pluck.js new file mode 100644 index 00000000..e844df47 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/pluck.js @@ -0,0 +1,13 @@ +var map = require('./map'); +var prop = require('../function/prop'); + + /** + * Extract a list of property values. + */ + function pluck(obj, propName){ + return map(obj, prop(propName)); + } + + module.exports = pluck; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/reduce.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/reduce.js new file mode 100644 index 00000000..6f19a3a2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/reduce.js @@ -0,0 +1,29 @@ +var forOwn = require('./forOwn'); +var size = require('./size'); + + /** + * Object reduce + */ + function reduce(obj, callback, memo, thisObj) { + var initial = arguments.length > 2; + + if (!size(obj) && !initial) { + throw new Error('reduce of empty object with no initial value'); + } + + forOwn(obj, function(value, key, list) { + if (!initial) { + memo = value; + initial = true; + } + else { + memo = callback.call(thisObj, memo, value, key, list); + } + }); + + return memo; + } + + module.exports = reduce; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/reject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/reject.js new file mode 100644 index 00000000..74643795 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/reject.js @@ -0,0 +1,16 @@ +var filter = require('./filter'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Object reject + */ + function reject(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + return filter(obj, function(value, index, obj) { + return !callback(value, index, obj); + }, thisObj); + } + + module.exports = reject; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/result.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/result.js new file mode 100644 index 00000000..0efdd41b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/result.js @@ -0,0 +1,14 @@ +var isFunction = require('../lang/isFunction'); + + function result(obj, prop) { + var property = obj[prop]; + + if(property === undefined) { + return; + } + + return isFunction(property) ? property.call(obj) : property; + } + + module.exports = result; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/set.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/set.js new file mode 100644 index 00000000..9b3cdc48 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/set.js @@ -0,0 +1,17 @@ +var namespace = require('./namespace'); + + /** + * set "nested" object property + */ + function set(obj, prop, val){ + var parts = (/^(.+)\.(.+)$/).exec(prop); + if (parts){ + namespace(obj, parts[1])[parts[2]] = val; + } else { + obj[prop] = val; + } + } + + module.exports = set; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/size.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/size.js new file mode 100644 index 00000000..97885953 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/size.js @@ -0,0 +1,16 @@ +var forOwn = require('./forOwn'); + + /** + * Get object size + */ + function size(obj) { + var count = 0; + forOwn(obj, function(){ + count++; + }); + return count; + } + + module.exports = size; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/some.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/some.js new file mode 100644 index 00000000..384c6f3c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/some.js @@ -0,0 +1,21 @@ +var forOwn = require('./forOwn'); +var makeIterator = require('../function/makeIterator_'); + + /** + * Object some + */ + function some(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = false; + forOwn(obj, function(val, key) { + if (callback(val, key, obj)) { + result = true; + return false; // break + } + }); + return result; + } + + module.exports = some; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/unset.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/unset.js new file mode 100644 index 00000000..343bca0a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/unset.js @@ -0,0 +1,23 @@ +var has = require('./has'); + + /** + * Unset object property. + */ + function unset(obj, prop){ + if (has(obj, prop)) { + var parts = prop.split('.'), + last = parts.pop(); + while (prop = parts.shift()) { + obj = obj[prop]; + } + return (delete obj[last]); + + } else { + // if property doesn't exist treat as deleted + return true; + } + } + + module.exports = unset; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/values.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/values.js new file mode 100644 index 00000000..265a6938 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/object/values.js @@ -0,0 +1,16 @@ +var forOwn = require('./forOwn'); + + /** + * Get object values + */ + function values(obj) { + var vals = []; + forOwn(obj, function(val, key){ + vals.push(val); + }); + return vals; + } + + module.exports = values; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/package.json new file mode 100644 index 00000000..fd478733 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/package.json @@ -0,0 +1,159 @@ +{ + "name": "mout", + "description": "Modular Utilities", + "version": "0.11.0", + "homepage": "http://moutjs.com/", + "contributors": [ + { + "name": "Adam Nowotny" + }, + { + "name": "André Cruz", + "email": "amdfcruz@gmail.com" + }, + { + "name": "Conrad Zimmerman", + "url": "http://www.conradz.com" + }, + { + "name": "Friedemann Altrock", + "email": "frodenius@gmail.com" + }, + { + "name": "Igor Almeida", + "email": "igor.p.almeida@gmail.com" + }, + { + "name": "Jarrod Overson", + "url": "http://jarrodoverson.com" + }, + { + "name": "Miller Medeiros", + "email": "contact@millermedeiros.com", + "url": "http://blog.millermedeiros.com" + }, + { + "name": "Mathias Paumgarten", + "email": "mail@mathias-paumgarten.com" + }, + { + "name": "Zach Shipley" + } + ], + "keywords": [ + "utilities", + "functional", + "amd-utils", + "stdlib" + ], + "repository": { + "type": "git", + "url": "git://github.com/mout/mout.git" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + } + ], + "bugs": { + "url": "https://github.com/mout/mout/issues/" + }, + "main": "./index.js", + "scripts": { + "pretest": "node build pkg", + "test": "istanbul test tests/runner.js --hook-run-in-context" + }, + "directories": { + "doc": "./doc" + }, + "devDependencies": { + "istanbul": "~0.1.27", + "jasmine-node": "~1.2.2", + "requirejs": "2.x", + "nodefy": "*", + "mdoc": "~0.3.2", + "handlebars": "~1.0.6", + "commander": "~1.0.5", + "rocambole": "~0.2.3", + "jshint": "2.x", + "rimraf": "2.2.2", + "regenerate": "~0.5.4" + }, + "testling": { + "preprocess": "node build testling", + "browsers": { + "ie": [ + 7, + 8, + 9, + 10 + ], + "firefox": [ + 17, + "nightly" + ], + "chrome": [ + 23, + "canary" + ], + "opera": [ + 12, + "next" + ], + "safari": [ + 5.1, + 6 + ], + "iphone": [ + 6 + ], + "ipad": [ + 6 + ] + }, + "scripts": [ + "tests/lib/jasmine/jasmine.js", + "tests/lib/jasmine/jasmine.async.js", + "tests/lib/jasmine/jasmine-tap.js", + "tests/lib/requirejs/require.js", + "tests/testling/src.js", + "tests/testling/specs.js", + "tests/runner.js" + ] + }, + "gitHead": "36662770b6c46c379f5d0354bc9d0a3a3dad6163", + "_id": "mout@0.11.0", + "_shasum": "93cdf0791ac8a24873ceeb42a5b016b7c867abee", + "_from": "mout@>=0.9.0 <2.0.0", + "_npmVersion": "2.1.6", + "_nodeVersion": "0.10.29", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + { + "name": "satazor", + "email": "andremiguelcruz@msn.com" + }, + { + "name": "conradz", + "email": "me@conradz.com" + }, + { + "name": "mathias.paumgarten", + "email": "mail@mathias-paumgarten.com" + } + ], + "dist": { + "shasum": "93cdf0791ac8a24873ceeb42a5b016b7c867abee", + "tarball": "http://registry.npmjs.org/mout/-/mout-0.11.0.tgz" + }, + "_resolved": "https://registry.npmjs.org/mout/-/mout-0.11.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString.js new file mode 100644 index 00000000..22685a7f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString.js @@ -0,0 +1,15 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'contains' : require('./queryString/contains'), + 'decode' : require('./queryString/decode'), + 'encode' : require('./queryString/encode'), + 'getParam' : require('./queryString/getParam'), + 'getQuery' : require('./queryString/getQuery'), + 'parse' : require('./queryString/parse'), + 'setParam' : require('./queryString/setParam') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/contains.js new file mode 100644 index 00000000..da678cf4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/contains.js @@ -0,0 +1,12 @@ +var getQuery = require('./getQuery'); + + /** + * Checks if query string contains parameter. + */ + function contains(url, paramName) { + var regex = new RegExp('(\\?|&)'+ paramName +'=', 'g'); //matches `?param=` or `¶m=` + return regex.test(getQuery(url)); + } + + module.exports = contains; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/decode.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/decode.js new file mode 100644 index 00000000..1c15785b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/decode.js @@ -0,0 +1,38 @@ +var typecast = require('../string/typecast'); +var isString = require('../lang/isString'); +var isArray = require('../lang/isArray'); +var hasOwn = require('../object/hasOwn'); + + /** + * Decode query string into an object of keys => vals. + */ + function decode(queryStr, shouldTypecast) { + var queryArr = (queryStr || '').replace('?', '').split('&'), + count = -1, + length = queryArr.length, + obj = {}, + item, pValue, pName, toSet; + + while (++count < length) { + item = queryArr[count].split('='); + pName = item[0]; + if (!pName || !pName.length){ + continue; + } + pValue = shouldTypecast === false ? item[1] : typecast(item[1]); + toSet = isString(pValue) ? decodeURIComponent(pValue) : pValue; + if (hasOwn(obj,pName)){ + if(isArray(obj[pName])){ + obj[pName].push(toSet); + } else { + obj[pName] = [obj[pName],toSet]; + } + } else { + obj[pName] = toSet; + } + } + return obj; + } + + module.exports = decode; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/encode.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/encode.js new file mode 100644 index 00000000..3a4fd0a6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/encode.js @@ -0,0 +1,27 @@ +var forOwn = require('../object/forOwn'); +var isArray = require('../lang/isArray'); +var forEach = require('../array/forEach'); + + /** + * Encode object into a query string. + */ + function encode(obj){ + var query = [], + arrValues, reg; + forOwn(obj, function (val, key) { + if (isArray(val)) { + arrValues = key + '='; + reg = new RegExp('&'+key+'+=$'); + forEach(val, function (aValue) { + arrValues += encodeURIComponent(aValue) + '&' + key + '='; + }); + query.push(arrValues.replace(reg, '')); + } else { + query.push(key + '=' + encodeURIComponent(val)); + } + }); + return (query.length) ? '?' + query.join('&') : ''; + } + + module.exports = encode; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/getParam.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/getParam.js new file mode 100644 index 00000000..f149c3ea --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/getParam.js @@ -0,0 +1,15 @@ +var typecast = require('../string/typecast'); +var getQuery = require('./getQuery'); + + /** + * Get query parameter value. + */ + function getParam(url, param, shouldTypecast){ + var regexp = new RegExp('(\\?|&)'+ param + '=([^&]*)'), //matches `?param=value` or `¶m=value`, value = $2 + result = regexp.exec( getQuery(url) ), + val = (result && result[2])? result[2] : null; + return shouldTypecast === false? val : typecast(val); + } + + module.exports = getParam; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/getQuery.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/getQuery.js new file mode 100644 index 00000000..5194af2d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/getQuery.js @@ -0,0 +1,13 @@ + + + /** + * Gets full query as string with all special chars decoded. + */ + function getQuery(url) { + url = url.replace(/#.*/, ''); //removes hash (to avoid getting hash query) + var queryString = /\?[a-zA-Z0-9\=\&\%\$\-\_\.\+\!\*\'\(\)\,]+/.exec(url); //valid chars according to: http://www.ietf.org/rfc/rfc1738.txt + return (queryString)? decodeURIComponent(queryString[0]) : ''; + } + + module.exports = getQuery; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/parse.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/parse.js new file mode 100644 index 00000000..532906c0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/parse.js @@ -0,0 +1,13 @@ +var decode = require('./decode'); +var getQuery = require('./getQuery'); + + /** + * Get query string, parses and decodes it. + */ + function parse(url, shouldTypecast) { + return decode(getQuery(url), shouldTypecast); + } + + module.exports = parse; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/setParam.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/setParam.js new file mode 100644 index 00000000..052a9ba6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/queryString/setParam.js @@ -0,0 +1,28 @@ + + + /** + * Set query string parameter value + */ + function setParam(url, paramName, value){ + url = url || ''; + + var re = new RegExp('(\\?|&)'+ paramName +'=[^&]*' ); + var param = paramName +'='+ encodeURIComponent( value ); + + if ( re.test(url) ) { + return url.replace(re, '$1'+ param); + } else { + if (url.indexOf('?') === -1) { + url += '?'; + } + if (url.indexOf('=') !== -1) { + url += '&'; + } + return url + param; + } + + } + + module.exports = setParam; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random.js new file mode 100644 index 00000000..a924a10b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random.js @@ -0,0 +1,18 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'choice' : require('./random/choice'), + 'guid' : require('./random/guid'), + 'rand' : require('./random/rand'), + 'randBit' : require('./random/randBit'), + 'randBool' : require('./random/randBool'), + 'randHex' : require('./random/randHex'), + 'randInt' : require('./random/randInt'), + 'randSign' : require('./random/randSign'), + 'randString' : require('./random/randString'), + 'random' : require('./random/random') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/choice.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/choice.js new file mode 100644 index 00000000..51aa82a2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/choice.js @@ -0,0 +1,15 @@ +var randInt = require('./randInt'); +var isArray = require('../lang/isArray'); + + /** + * Returns a random element from the supplied arguments + * or from the array (if single argument is an array). + */ + function choice(items) { + var target = (arguments.length === 1 && isArray(items))? items : arguments; + return target[ randInt(0, target.length - 1) ]; + } + + module.exports = choice; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/guid.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/guid.js new file mode 100644 index 00000000..41f6eddc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/guid.js @@ -0,0 +1,24 @@ +var randHex = require('./randHex'); +var choice = require('./choice'); + + /** + * Returns pseudo-random guid (UUID v4) + * IMPORTANT: it's not totally "safe" since randHex/choice uses Math.random + * by default and sequences can be predicted in some cases. See the + * "random/random" documentation for more info about it and how to replace + * the default PRNG. + */ + function guid() { + return ( + randHex(8)+'-'+ + randHex(4)+'-'+ + // v4 UUID always contain "4" at this position to specify it was + // randomly generated + '4' + randHex(3) +'-'+ + // v4 UUID always contain chars [a,b,8,9] at this position + choice(8, 9, 'a', 'b') + randHex(3)+'-'+ + randHex(12) + ); + } + module.exports = guid; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/rand.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/rand.js new file mode 100644 index 00000000..782dec88 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/rand.js @@ -0,0 +1,15 @@ +var random = require('./random'); +var MIN_INT = require('../number/MIN_INT'); +var MAX_INT = require('../number/MAX_INT'); + + /** + * Returns random number inside range + */ + function rand(min, max){ + min = min == null? MIN_INT : min; + max = max == null? MAX_INT : max; + return min + (max - min) * random(); + } + + module.exports = rand; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randBit.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randBit.js new file mode 100644 index 00000000..04f7aa52 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randBit.js @@ -0,0 +1,11 @@ +var randBool = require('./randBool'); + + /** + * Returns random bit (0 or 1) + */ + function randomBit() { + return randBool()? 1 : 0; + } + + module.exports = randomBit; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randBool.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randBool.js new file mode 100644 index 00000000..d3d35cbc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randBool.js @@ -0,0 +1,12 @@ +var random = require('./random'); + + /** + * returns a random boolean value (true or false) + */ + function randBool(){ + return random() >= 0.5; + } + + module.exports = randBool; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randHex.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randHex.js new file mode 100644 index 00000000..d8d711c3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randHex.js @@ -0,0 +1,19 @@ +var choice = require('./choice'); + + var _chars = '0123456789abcdef'.split(''); + + /** + * Returns a random hexadecimal string + */ + function randHex(size){ + size = size && size > 0? size : 6; + var str = ''; + while (size--) { + str += choice(_chars); + } + return str; + } + + module.exports = randHex; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randInt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randInt.js new file mode 100644 index 00000000..e237d964 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randInt.js @@ -0,0 +1,18 @@ +var MIN_INT = require('../number/MIN_INT'); +var MAX_INT = require('../number/MAX_INT'); +var rand = require('./rand'); + + /** + * Gets random integer inside range or snap to min/max values. + */ + function randInt(min, max){ + min = min == null? MIN_INT : ~~min; + max = max == null? MAX_INT : ~~max; + // can't be max + 0.5 otherwise it will round up if `rand` + // returns `max` causing it to overflow range. + // -0.5 and + 0.49 are required to avoid bias caused by rounding + return Math.round( rand(min - 0.5, max + 0.499999999999) ); + } + + module.exports = randInt; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randSign.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randSign.js new file mode 100644 index 00000000..75a1a51e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randSign.js @@ -0,0 +1,11 @@ +var randBool = require('./randBool'); + + /** + * Returns random sign (-1 or 1) + */ + function randomSign() { + return randBool()? 1 : -1; + } + + module.exports = randomSign; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randString.js new file mode 100644 index 00000000..e3c35976 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/randString.js @@ -0,0 +1,27 @@ +var isNumber = require('../lang/isNumber'); +var isString = require('../lang/isString'); +var randInt = require('./randInt'); + + var defaultDictionary = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + function randomString(length, dictionary) { + if(!isNumber(length) || length <= 0) { + length = 8; + } + + if(!isString(dictionary) || dictionary.length < 1) { + dictionary = defaultDictionary; + } + + var result = '', + domain = dictionary.length - 1; + + while(length--) { + result += dictionary[randInt(0, domain)]; + } + + return result; + } + + module.exports = randomString; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/random.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/random.js new file mode 100644 index 00000000..670a3cc4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/random/random.js @@ -0,0 +1,18 @@ + + + /** + * Just a wrapper to Math.random. No methods inside mout/random should call + * Math.random() directly so we can inject the pseudo-random number + * generator if needed (ie. in case we need a seeded random or a better + * algorithm than the native one) + */ + function random(){ + return random.get(); + } + + // we expose the method so it can be swapped if needed + random.get = Math.random; + + module.exports = random; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array.js new file mode 100644 index 00000000..ee5719f9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array.js @@ -0,0 +1,54 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'append' : require('./array/append'), + 'collect' : require('./array/collect'), + 'combine' : require('./array/combine'), + 'compact' : require('./array/compact'), + 'contains' : require('./array/contains'), + 'difference' : require('./array/difference'), + 'equals' : require('./array/equals'), + 'every' : require('./array/every'), + 'filter' : require('./array/filter'), + 'find' : require('./array/find'), + 'findIndex' : require('./array/findIndex'), + 'findLast' : require('./array/findLast'), + 'findLastIndex' : require('./array/findLastIndex'), + 'flatten' : require('./array/flatten'), + 'forEach' : require('./array/forEach'), + 'groupBy' : require('./array/groupBy'), + 'indexOf' : require('./array/indexOf'), + 'insert' : require('./array/insert'), + 'intersection' : require('./array/intersection'), + 'invoke' : require('./array/invoke'), + 'join' : require('./array/join'), + 'last' : require('./array/last'), + 'lastIndexOf' : require('./array/lastIndexOf'), + 'map' : require('./array/map'), + 'max' : require('./array/max'), + 'min' : require('./array/min'), + 'pick' : require('./array/pick'), + 'pluck' : require('./array/pluck'), + 'range' : require('./array/range'), + 'reduce' : require('./array/reduce'), + 'reduceRight' : require('./array/reduceRight'), + 'reject' : require('./array/reject'), + 'remove' : require('./array/remove'), + 'removeAll' : require('./array/removeAll'), + 'shuffle' : require('./array/shuffle'), + 'slice' : require('./array/slice'), + 'some' : require('./array/some'), + 'sort' : require('./array/sort'), + 'sortBy' : require('./array/sortBy'), + 'split' : require('./array/split'), + 'take' : require('./array/take'), + 'toLookup' : require('./array/toLookup'), + 'union' : require('./array/union'), + 'unique' : require('./array/unique'), + 'xor' : require('./array/xor'), + 'zip' : require('./array/zip') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/append.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/append.js new file mode 100644 index 00000000..549d8754 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/append.js @@ -0,0 +1,21 @@ +define(function () { + + /** + * Appends an array to the end of another. + * The first array will be modified. + */ + function append(arr1, arr2) { + if (arr2 == null) { + return arr1; + } + + var pad = arr1.length, + i = -1, + len = arr2.length; + while (++i < len) { + arr1[pad + i] = arr2[i]; + } + return arr1; + } + return append; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/collect.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/collect.js new file mode 100644 index 00000000..8f60cda2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/collect.js @@ -0,0 +1,26 @@ +define(['./append', '../function/makeIterator_'], function (append, makeIterator) { + + /** + * Maps the items in the array and concatenates the result arrays. + */ + function collect(arr, callback, thisObj){ + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null) { + return results; + } + + var i = -1, len = arr.length; + while (++i < len) { + var value = callback(arr[i], i, arr); + if (value != null) { + append(results, value); + } + } + + return results; + } + + return collect; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/combine.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/combine.js new file mode 100644 index 00000000..22efb860 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/combine.js @@ -0,0 +1,22 @@ +define(['./indexOf'], function (indexOf) { + + /** + * Combines an array with all the items of another. + * Does not allow duplicates and is case and type sensitive. + */ + function combine(arr1, arr2) { + if (arr2 == null) { + return arr1; + } + + var i = -1, len = arr2.length; + while (++i < len) { + if (indexOf(arr1, arr2[i]) === -1) { + arr1.push(arr2[i]); + } + } + + return arr1; + } + return combine; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/compact.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/compact.js new file mode 100644 index 00000000..02a81098 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/compact.js @@ -0,0 +1,13 @@ +define(['./filter'], function (filter) { + + /** + * Remove all null/undefined items from array. + */ + function compact(arr) { + return filter(arr, function(val){ + return (val != null); + }); + } + + return compact; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/contains.js new file mode 100644 index 00000000..fca4f7cb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/contains.js @@ -0,0 +1,10 @@ +define(['./indexOf'], function (indexOf) { + + /** + * If array contains values. + */ + function contains(arr, val) { + return indexOf(arr, val) !== -1; + } + return contains; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/difference.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/difference.js new file mode 100644 index 00000000..0d52c251 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/difference.js @@ -0,0 +1,19 @@ +define(['./unique', './filter', './some', './contains', './slice'], function (unique, filter, some, contains, slice) { + + + /** + * Return a new Array with elements that aren't present in the other Arrays. + */ + function difference(arr) { + var arrs = slice(arguments, 1), + result = filter(unique(arr), function(needle){ + return !some(arrs, function(haystack){ + return contains(haystack, needle); + }); + }); + return result; + } + + return difference; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/equals.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/equals.js new file mode 100644 index 00000000..0e3e148a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/equals.js @@ -0,0 +1,28 @@ +define(['../lang/is', '../lang/isArray', './every'], function(is, isArray, every) { + + /** + * Compares if both arrays have the same elements + */ + function equals(a, b, callback){ + callback = callback || is; + + if (!isArray(a) || !isArray(b)) { + return callback(a, b); + } + + if (a.length !== b.length) { + return false; + } + + return every(a, makeCompare(callback), b); + } + + function makeCompare(callback) { + return function(value, i) { + return i in this && callback(value, this[i]); + }; + } + + return equals; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/every.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/every.js new file mode 100644 index 00000000..78ba46d3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/every.js @@ -0,0 +1,27 @@ +define(['../function/makeIterator_'], function (makeIterator) { + + /** + * Array every + */ + function every(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = true; + if (arr == null) { + return result; + } + + var i = -1, len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if (!callback(arr[i], i, arr) ) { + result = false; + break; + } + } + + return result; + } + + return every; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/filter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/filter.js new file mode 100644 index 00000000..38add180 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/filter.js @@ -0,0 +1,26 @@ +define(['../function/makeIterator_'], function (makeIterator) { + + /** + * Array filter + */ + function filter(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null) { + return results; + } + + var i = -1, len = arr.length, value; + while (++i < len) { + value = arr[i]; + if (callback(value, i, arr)) { + results.push(value); + } + } + + return results; + } + + return filter; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/find.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/find.js new file mode 100644 index 00000000..3957dcd5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/find.js @@ -0,0 +1,13 @@ +define(['./findIndex'], function (findIndex) { + + /** + * Returns first item that matches criteria + */ + function find(arr, iterator, thisObj){ + var idx = findIndex(arr, iterator, thisObj); + return idx >= 0? arr[idx] : void(0); + } + + return find; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/findIndex.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/findIndex.js new file mode 100644 index 00000000..59dfeeb9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/findIndex.js @@ -0,0 +1,23 @@ +define(['../function/makeIterator_'], function (makeIterator) { + + /** + * Returns the index of the first item that matches criteria + */ + function findIndex(arr, iterator, thisObj){ + iterator = makeIterator(iterator, thisObj); + if (arr == null) { + return -1; + } + + var i = -1, len = arr.length; + while (++i < len) { + if (iterator(arr[i], i, arr)) { + return i; + } + } + + return -1; + } + + return findIndex; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/findLast.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/findLast.js new file mode 100644 index 00000000..9308fa67 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/findLast.js @@ -0,0 +1,13 @@ +define(['./findLastIndex'], function (findLastIndex) { + + /** + * Returns last item that matches criteria + */ + function findLast(arr, iterator, thisObj){ + var idx = findLastIndex(arr, iterator, thisObj); + return idx >= 0? arr[idx] : void(0); + } + + return findLast; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/findLastIndex.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/findLastIndex.js new file mode 100644 index 00000000..45f266e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/findLastIndex.js @@ -0,0 +1,24 @@ +define(['../function/makeIterator_'], function (makeIterator) { + + /** + * Returns the index of the last item that matches criteria + */ + function findLastIndex(arr, iterator, thisObj){ + iterator = makeIterator(iterator, thisObj); + if (arr == null) { + return -1; + } + + var n = arr.length; + while (--n >= 0) { + if (iterator(arr[n], n, arr)) { + return n; + } + } + + return -1; + } + + return findLastIndex; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/flatten.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/flatten.js new file mode 100644 index 00000000..42e87f43 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/flatten.js @@ -0,0 +1,42 @@ +define(['../lang/isArray', './append'], function (isArray, append) { + + /* + * Helper function to flatten to a destination array. + * Used to remove the need to create intermediate arrays while flattening. + */ + function flattenTo(arr, result, level) { + if (arr == null) { + return result; + } else if (level === 0) { + append(result, arr); + return result; + } + + var value, + i = -1, + len = arr.length; + while (++i < len) { + value = arr[i]; + if (isArray(value)) { + flattenTo(value, result, level - 1); + } else { + result.push(value); + } + } + return result; + } + + /** + * Recursively flattens an array. + * A new array containing all the elements is returned. + * If `shallow` is true, it will only flatten one level. + */ + function flatten(arr, level) { + level = level == null? -1 : level; + return flattenTo(arr, [], level); + } + + return flatten; + +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/forEach.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/forEach.js new file mode 100644 index 00000000..0e045868 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/forEach.js @@ -0,0 +1,23 @@ +define(function () { + + /** + * Array forEach + */ + function forEach(arr, callback, thisObj) { + if (arr == null) { + return; + } + var i = -1, + len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if ( callback.call(thisObj, arr[i], i, arr) === false ) { + break; + } + } + } + + return forEach; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/groupBy.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/groupBy.js new file mode 100644 index 00000000..47906be6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/groupBy.js @@ -0,0 +1,32 @@ +define([ + '../array/forEach', + '../function/identity', + '../function/makeIterator_' +], function(forEach, identity, makeIterator) { + + /** + * Bucket the array values. + */ + function groupBy(arr, categorize, thisObj) { + if (categorize) { + categorize = makeIterator(categorize, thisObj); + } else { + // Default to identity function. + categorize = identity; + } + + var buckets = {}; + forEach(arr, function(element) { + var bucket = categorize(element); + if (!(bucket in buckets)) { + buckets[bucket] = []; + } + + buckets[bucket].push(element); + }); + + return buckets; + } + + return groupBy; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/indexOf.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/indexOf.js new file mode 100644 index 00000000..0e75f99b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/indexOf.js @@ -0,0 +1,28 @@ +define(function () { + + /** + * Array.indexOf + */ + function indexOf(arr, item, fromIndex) { + fromIndex = fromIndex || 0; + if (arr == null) { + return -1; + } + + var len = arr.length, + i = fromIndex < 0 ? len + fromIndex : fromIndex; + while (i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if (arr[i] === item) { + return i; + } + + i++; + } + + return -1; + } + + return indexOf; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/insert.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/insert.js new file mode 100644 index 00000000..a3d7196c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/insert.js @@ -0,0 +1,14 @@ +define(['./difference', './slice'], function (difference, slice) { + + /** + * Insert item into array if not already present. + */ + function insert(arr, rest_items) { + var diff = difference(slice(arguments, 1), arr); + if (diff.length) { + Array.prototype.push.apply(arr, diff); + } + return arr.length; + } + return insert; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/intersection.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/intersection.js new file mode 100644 index 00000000..8d0baa4d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/intersection.js @@ -0,0 +1,20 @@ +define(['./unique', './filter', './every', './contains', './slice'], function (unique, filter, every, contains, slice) { + + + /** + * Return a new Array with elements common to all Arrays. + * - based on underscore.js implementation + */ + function intersection(arr) { + var arrs = slice(arguments, 1), + result = filter(unique(arr), function(needle){ + return every(arrs, function(haystack){ + return contains(haystack, needle); + }); + }); + return result; + } + + return intersection; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/invoke.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/invoke.js new file mode 100644 index 00000000..860d72a5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/invoke.js @@ -0,0 +1,23 @@ +define(['./slice'], function (slice) { + + /** + * Call `methodName` on each item of the array passing custom arguments if + * needed. + */ + function invoke(arr, methodName, var_args){ + if (arr == null) { + return arr; + } + + var args = slice(arguments, 2); + var i = -1, len = arr.length, value; + while (++i < len) { + value = arr[i]; + value[methodName].apply(value, args); + } + + return arr; + } + + return invoke; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/join.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/join.js new file mode 100644 index 00000000..2c618d29 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/join.js @@ -0,0 +1,17 @@ +define(['./filter'], function(filter) { + + function isValidString(val) { + return (val != null && val !== ''); + } + + /** + * Joins strings with the specified separator inserted between each value. + * Null values and empty strings will be excluded. + */ + function join(items, separator) { + separator = separator || ''; + return filter(items, isValidString).join(separator); + } + + return join; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/last.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/last.js new file mode 100644 index 00000000..2c852967 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/last.js @@ -0,0 +1,16 @@ +define(function () { + + /** + * Returns last element of array. + */ + function last(arr){ + if (arr == null || arr.length < 1) { + return undefined; + } + + return arr[arr.length - 1]; + } + + return last; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/lastIndexOf.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/lastIndexOf.js new file mode 100644 index 00000000..931235f4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/lastIndexOf.js @@ -0,0 +1,28 @@ +define(function () { + + /** + * Array lastIndexOf + */ + function lastIndexOf(arr, item, fromIndex) { + if (arr == null) { + return -1; + } + + var len = arr.length; + fromIndex = (fromIndex == null || fromIndex >= len)? len - 1 : fromIndex; + fromIndex = (fromIndex < 0)? len + fromIndex : fromIndex; + + while (fromIndex >= 0) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if (arr[fromIndex] === item) { + return fromIndex; + } + fromIndex--; + } + + return -1; + } + + return lastIndexOf; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/map.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/map.js new file mode 100644 index 00000000..14377ab6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/map.js @@ -0,0 +1,22 @@ +define(['../function/makeIterator_'], function (makeIterator) { + + /** + * Array map + */ + function map(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null){ + return results; + } + + var i = -1, len = arr.length; + while (++i < len) { + results[i] = callback(arr[i], i, arr); + } + + return results; + } + + return map; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/max.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/max.js new file mode 100644 index 00000000..d0628f0a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/max.js @@ -0,0 +1,34 @@ +define(['../function/makeIterator_'], function (makeIterator) { + + /** + * Return maximum value inside array + */ + function max(arr, iterator, thisObj){ + if (arr == null || !arr.length) { + return Infinity; + } else if (arr.length && !iterator) { + return Math.max.apply(Math, arr); + } else { + iterator = makeIterator(iterator, thisObj); + var result, + compare = -Infinity, + value, + temp; + + var i = -1, len = arr.length; + while (++i < len) { + value = arr[i]; + temp = iterator(value, i, arr); + if (temp > compare) { + compare = temp; + result = value; + } + } + + return result; + } + } + + return max; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/min.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/min.js new file mode 100644 index 00000000..07a0c71f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/min.js @@ -0,0 +1,34 @@ +define(['../function/makeIterator_'], function (makeIterator) { + + /** + * Return minimum value inside array + */ + function min(arr, iterator, thisObj){ + if (arr == null || !arr.length) { + return -Infinity; + } else if (arr.length && !iterator) { + return Math.min.apply(Math, arr); + } else { + iterator = makeIterator(iterator, thisObj); + var result, + compare = Infinity, + value, + temp; + + var i = -1, len = arr.length; + while (++i < len) { + value = arr[i]; + temp = iterator(value, i, arr); + if (temp < compare) { + compare = temp; + result = value; + } + } + + return result; + } + } + + return min; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/pick.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/pick.js new file mode 100644 index 00000000..dc5b222f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/pick.js @@ -0,0 +1,31 @@ +define(['../random/randInt'], function (randInt) { + + /** + * Remove random item(s) from the Array and return it. + * Returns an Array of items if [nItems] is provided or a single item if + * it isn't specified. + */ + function pick(arr, nItems){ + if (nItems != null) { + var result = []; + if (nItems > 0 && arr && arr.length) { + nItems = nItems > arr.length? arr.length : nItems; + while (nItems--) { + result.push( pickOne(arr) ); + } + } + return result; + } + return (arr && arr.length)? pickOne(arr) : void(0); + } + + + function pickOne(arr){ + var idx = randInt(0, arr.length - 1); + return arr.splice(idx, 1)[0]; + } + + + return pick; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/pluck.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/pluck.js new file mode 100644 index 00000000..c908856e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/pluck.js @@ -0,0 +1,12 @@ +define(['./map'], function (map) { + + /** + * Extract a list of property values. + */ + function pluck(arr, propName){ + return map(arr, propName); + } + + return pluck; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/range.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/range.js new file mode 100644 index 00000000..148ebf96 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/range.js @@ -0,0 +1,27 @@ +define(['../math/countSteps'], function (countSteps) { + + /** + * Returns an Array of numbers inside range. + */ + function range(start, stop, step) { + if (stop == null) { + stop = start; + start = 0; + } + step = step || 1; + + var result = [], + nSteps = countSteps(stop - start, step), + i = start; + + while (i <= stop) { + result.push(i); + i += step; + } + + return result; + } + + return range; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/reduce.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/reduce.js new file mode 100644 index 00000000..5f97ae8e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/reduce.js @@ -0,0 +1,33 @@ +define(function () { + + /** + * Array reduce + */ + function reduce(arr, fn, initVal) { + // check for args.length since initVal might be "undefined" see #gh-57 + var hasInit = arguments.length > 2, + result = initVal; + + if (arr == null || !arr.length) { + if (!hasInit) { + throw new Error('reduce of empty array with no initial value'); + } else { + return initVal; + } + } + + var i = -1, len = arr.length; + while (++i < len) { + if (!hasInit) { + result = arr[i]; + hasInit = true; + } else { + result = fn(result, arr[i], i, arr); + } + } + + return result; + } + + return reduce; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/reduceRight.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/reduceRight.js new file mode 100644 index 00000000..ddae0e7f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/reduceRight.js @@ -0,0 +1,34 @@ +define(function () { + + /** + * Array reduceRight + */ + function reduceRight(arr, fn, initVal) { + // check for args.length since initVal might be "undefined" see #gh-57 + var hasInit = arguments.length > 2; + + if (arr == null || !arr.length) { + if (hasInit) { + return initVal; + } else { + throw new Error('reduce of empty array with no initial value'); + } + } + + var i = arr.length, result = initVal, value; + while (--i >= 0) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + value = arr[i]; + if (!hasInit) { + result = value; + hasInit = true; + } else { + result = fn(result, value, i, arr); + } + } + return result; + } + + return reduceRight; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/reject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/reject.js new file mode 100644 index 00000000..cad40384 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/reject.js @@ -0,0 +1,25 @@ +define(['../function/makeIterator_'], function(makeIterator) { + + /** + * Array reject + */ + function reject(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null) { + return results; + } + + var i = -1, len = arr.length, value; + while (++i < len) { + value = arr[i]; + if (!callback(value, i, arr)) { + results.push(value); + } + } + + return results; + } + + return reject; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/remove.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/remove.js new file mode 100644 index 00000000..dec9134d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/remove.js @@ -0,0 +1,13 @@ +define(['./indexOf'], function(indexOf){ + + /** + * Remove a single item from the array. + * (it won't remove duplicates, just a single item) + */ + function remove(arr, item){ + var idx = indexOf(arr, item); + if (idx !== -1) arr.splice(idx, 1); + } + + return remove; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/removeAll.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/removeAll.js new file mode 100644 index 00000000..e81022b8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/removeAll.js @@ -0,0 +1,15 @@ +define(['./indexOf'], function(indexOf){ + + /** + * Remove all instances of an item from array. + */ + function removeAll(arr, item){ + var idx = indexOf(arr, item); + while (idx !== -1) { + arr.splice(idx, 1); + idx = indexOf(arr, item, idx); + } + } + + return removeAll; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/shuffle.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/shuffle.js new file mode 100644 index 00000000..891d1677 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/shuffle.js @@ -0,0 +1,28 @@ +define(['../random/randInt'], function (randInt) { + + /** + * Shuffle array items. + */ + function shuffle(arr) { + var results = [], + rnd; + if (arr == null) { + return results; + } + + var i = -1, len = arr.length, value; + while (++i < len) { + if (!i) { + results[0] = arr[0]; + } else { + rnd = randInt(0, i); + results[i] = results[rnd]; + results[rnd] = arr[i]; + } + } + + return results; + } + + return shuffle; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/slice.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/slice.js new file mode 100644 index 00000000..994caba1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/slice.js @@ -0,0 +1,35 @@ +define(function () { + + /** + * Create slice of source array or array-like object + */ + function slice(arr, start, end){ + var len = arr.length; + + if (start == null) { + start = 0; + } else if (start < 0) { + start = Math.max(len + start, 0); + } else { + start = Math.min(start, len); + } + + if (end == null) { + end = len; + } else if (end < 0) { + end = Math.max(len + end, 0); + } else { + end = Math.min(end, len); + } + + var result = []; + while (start < end) { + result.push(arr[start++]); + } + + return result; + } + + return slice; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/some.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/some.js new file mode 100644 index 00000000..e46a9781 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/some.js @@ -0,0 +1,27 @@ +define(['../function/makeIterator_'], function (makeIterator) { + + /** + * Array some + */ + function some(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = false; + if (arr == null) { + return result; + } + + var i = -1, len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if ( callback(arr[i], i, arr) ) { + result = true; + break; + } + } + + return result; + } + + return some; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/sort.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/sort.js new file mode 100644 index 00000000..4c194042 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/sort.js @@ -0,0 +1,55 @@ +define(function () { + + /** + * Merge sort (http://en.wikipedia.org/wiki/Merge_sort) + */ + function mergeSort(arr, compareFn) { + if (arr == null) { + return []; + } else if (arr.length < 2) { + return arr; + } + + if (compareFn == null) { + compareFn = defaultCompare; + } + + var mid, left, right; + + mid = ~~(arr.length / 2); + left = mergeSort( arr.slice(0, mid), compareFn ); + right = mergeSort( arr.slice(mid, arr.length), compareFn ); + + return merge(left, right, compareFn); + } + + function defaultCompare(a, b) { + return a < b ? -1 : (a > b? 1 : 0); + } + + function merge(left, right, compareFn) { + var result = []; + + while (left.length && right.length) { + if (compareFn(left[0], right[0]) <= 0) { + // if 0 it should preserve same order (stable) + result.push(left.shift()); + } else { + result.push(right.shift()); + } + } + + if (left.length) { + result.push.apply(result, left); + } + + if (right.length) { + result.push.apply(result, right); + } + + return result; + } + + return mergeSort; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/sortBy.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/sortBy.js new file mode 100644 index 00000000..27971942 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/sortBy.js @@ -0,0 +1,18 @@ +define(['./sort', '../function/makeIterator_'], function (sort, makeIterator) { + + /* + * Sort array by the result of the callback + */ + function sortBy(arr, callback, context){ + callback = makeIterator(callback, context); + + return sort(arr, function(a, b) { + a = callback(a); + b = callback(b); + return (a < b) ? -1 : ((a > b) ? 1 : 0); + }); + } + + return sortBy; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/split.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/split.js new file mode 100644 index 00000000..a17275eb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/split.js @@ -0,0 +1,35 @@ +define(function() { + + /** + * Split array into a fixed number of segments. + */ + function split(array, segments) { + segments = segments || 2; + var results = []; + if (array == null) { + return results; + } + + var minLength = Math.floor(array.length / segments), + remainder = array.length % segments, + i = 0, + len = array.length, + segmentIndex = 0, + segmentLength; + + while (i < len) { + segmentLength = minLength; + if (segmentIndex < remainder) { + segmentLength++; + } + + results.push(array.slice(i, i + segmentLength)); + + segmentIndex++; + i += segmentLength; + } + + return results; + } + return split; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/take.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/take.js new file mode 100644 index 00000000..74b82419 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/take.js @@ -0,0 +1,24 @@ +define(function () { + + /** + * Iterates over a callback a set amount of times + * returning the results + */ + function take(n, callback, thisObj){ + var i = -1; + var arr = []; + if( !thisObj ){ + while(++i < n){ + arr[i] = callback(i, n); + } + } else { + while(++i < n){ + arr[i] = callback.call(thisObj, i, n); + } + } + return arr; + } + + return take; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/toLookup.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/toLookup.js new file mode 100644 index 00000000..aac8fd1d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/toLookup.js @@ -0,0 +1,28 @@ +define(['../lang/isFunction'], function (isFunction) { + + /** + * Creates an object that holds a lookup for the objects in the array. + */ + function toLookup(arr, key) { + var result = {}; + if (arr == null) { + return result; + } + + var i = -1, len = arr.length, value; + if (isFunction(key)) { + while (++i < len) { + value = arr[i]; + result[key(value)] = value; + } + } else { + while (++i < len) { + value = arr[i]; + result[value[key]] = value; + } + } + + return result; + } + return toLookup; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/union.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/union.js new file mode 100644 index 00000000..5f9922e5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/union.js @@ -0,0 +1,18 @@ +define(['./unique', './append'], function (unique, append) { + + /** + * Concat multiple arrays and remove duplicates + */ + function union(arrs) { + var results = []; + var i = -1, len = arguments.length; + while (++i < len) { + append(results, arguments[i]); + } + + return unique(results); + } + + return union; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/unique.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/unique.js new file mode 100644 index 00000000..c4a011a0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/unique.js @@ -0,0 +1,25 @@ +define(['./filter'], function(filter){ + + /** + * @return {array} Array of unique items + */ + function unique(arr, compare){ + compare = compare || isEqual; + return filter(arr, function(item, i, arr){ + var n = arr.length; + while (++i < n) { + if ( compare(item, arr[i]) ) { + return false; + } + } + return true; + }); + } + + function isEqual(a, b){ + return a === b; + } + + return unique; +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/xor.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/xor.js new file mode 100644 index 00000000..7df89d9c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/xor.js @@ -0,0 +1,24 @@ +define(['./unique', './filter', './contains'], function (unique, filter, contains) { + + + /** + * Exclusive OR. Returns items that are present in a single array. + * - like ptyhon's `symmetric_difference` + */ + function xor(arr1, arr2) { + arr1 = unique(arr1); + arr2 = unique(arr2); + + var a1 = filter(arr1, function(item){ + return !contains(arr2, item); + }), + a2 = filter(arr2, function(item){ + return !contains(arr1, item); + }); + + return a1.concat(a2); + } + + return xor; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/zip.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/zip.js new file mode 100644 index 00000000..bd0dbb84 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/array/zip.js @@ -0,0 +1,27 @@ +define(['./max', './map'], function (max, map) { + + function getLength(arr) { + return arr == null ? 0 : arr.length; + } + + /** + * Merges together the values of each of the arrays with the values at the + * corresponding position. + */ + function zip(arr){ + var len = arr ? max(map(arguments, getLength)) : 0, + results = [], + i = -1; + while (++i < len) { + // jshint loopfunc: true + results.push(map(arguments, function(item) { + return item == null ? undefined : item[i]; + })); + } + + return results; + } + + return zip; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection.js new file mode 100644 index 00000000..386e6da9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection.js @@ -0,0 +1,22 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'contains' : require('./collection/contains'), + 'every' : require('./collection/every'), + 'filter' : require('./collection/filter'), + 'find' : require('./collection/find'), + 'forEach' : require('./collection/forEach'), + 'make_' : require('./collection/make_'), + 'map' : require('./collection/map'), + 'max' : require('./collection/max'), + 'min' : require('./collection/min'), + 'pluck' : require('./collection/pluck'), + 'reduce' : require('./collection/reduce'), + 'reject' : require('./collection/reject'), + 'size' : require('./collection/size'), + 'some' : require('./collection/some') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/contains.js new file mode 100644 index 00000000..192167e8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/contains.js @@ -0,0 +1,7 @@ +define(['./make_', '../array/contains', '../object/contains'], function (make, arrContains, objContains) { + + /** + */ + return make(arrContains, objContains); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/every.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/every.js new file mode 100644 index 00000000..6317f503 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/every.js @@ -0,0 +1,7 @@ +define(['./make_', '../array/every', '../object/every'], function (make, arrEvery, objEvery) { + + /** + */ + return make(arrEvery, objEvery); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/filter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/filter.js new file mode 100644 index 00000000..4e7fadc8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/filter.js @@ -0,0 +1,22 @@ +define(['./forEach', '../function/makeIterator_'], function (forEach, makeIterator) { + + /** + * filter collection values, returns array. + */ + function filter(list, iterator, thisObj) { + iterator = makeIterator(iterator, thisObj); + var results = []; + if (!list) { + return results; + } + forEach(list, function(value, index, list) { + if (iterator(value, index, list)) { + results[results.length] = value; + } + }); + return results; + } + + return filter; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/find.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/find.js new file mode 100644 index 00000000..681f9414 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/find.js @@ -0,0 +1,8 @@ +define(['./make_', '../array/find', '../object/find'], function(make, arrFind, objFind) { + + /** + * Find value that returns true on iterator check. + */ + return make(arrFind, objFind); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/forEach.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/forEach.js new file mode 100644 index 00000000..3b39d3ed --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/forEach.js @@ -0,0 +1,7 @@ +define(['./make_', '../array/forEach', '../object/forOwn'], function (make, arrForEach, objForEach) { + + /** + */ + return make(arrForEach, objForEach); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/make_.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/make_.js new file mode 100644 index 00000000..290a6511 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/make_.js @@ -0,0 +1,19 @@ +define(['../array/slice'], function(slice){ + + /** + * internal method used to create other collection modules. + */ + function makeCollectionMethod(arrMethod, objMethod, defaultReturn) { + return function(){ + var args = slice(arguments); + if (args[0] == null) { + return defaultReturn; + } + // array-like is treated as array + return (typeof args[0].length === 'number')? arrMethod.apply(null, args) : objMethod.apply(null, args); + }; + } + + return makeCollectionMethod; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/map.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/map.js new file mode 100644 index 00000000..96e24987 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/map.js @@ -0,0 +1,20 @@ +define(['../lang/isObject', '../object/values', '../array/map', '../function/makeIterator_'], function (isObject, values, arrMap, makeIterator) { + + /** + * Map collection values, returns Array. + */ + function map(list, callback, thisObj) { + callback = makeIterator(callback, thisObj); + // list.length to check array-like object, if not array-like + // we simply map all the object values + if( isObject(list) && list.length == null ){ + list = values(list); + } + return arrMap(list, function (val, key, list) { + return callback(val, key, list); + }); + } + + return map; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/max.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/max.js new file mode 100644 index 00000000..de9a6da5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/max.js @@ -0,0 +1,8 @@ +define(['./make_', '../array/max', '../object/max'], function (make, arrMax, objMax) { + + /** + * Get maximum value inside collection + */ + return make(arrMax, objMax); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/min.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/min.js new file mode 100644 index 00000000..f0c239a6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/min.js @@ -0,0 +1,8 @@ +define(['./make_', '../array/min', '../object/min'], function (make, arrMin, objMin) { + + /** + * Get minimum value inside collection. + */ + return make(arrMin, objMin); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/pluck.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/pluck.js new file mode 100644 index 00000000..ef784a7a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/pluck.js @@ -0,0 +1,14 @@ +define(['./map'], function (map) { + + /** + * Extract a list of property values. + */ + function pluck(list, key) { + return map(list, function(value) { + return value[key]; + }); + } + + return pluck; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/reduce.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/reduce.js new file mode 100644 index 00000000..bd05d43d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/reduce.js @@ -0,0 +1,7 @@ +define(['./make_', '../array/reduce', '../object/reduce'], function (make, arrReduce, objReduce) { + + /** + */ + return make(arrReduce, objReduce); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/reject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/reject.js new file mode 100644 index 00000000..581adfdc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/reject.js @@ -0,0 +1,15 @@ +define(['./filter', '../function/makeIterator_'], function (filter, makeIterator) { + + /** + * Inverse or collection/filter + */ + function reject(list, iterator, thisObj) { + iterator = makeIterator(iterator, thisObj); + return filter(list, function(value, index, list) { + return !iterator(value, index, list); + }, thisObj); + } + + return reject; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/size.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/size.js new file mode 100644 index 00000000..4e5ab419 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/size.js @@ -0,0 +1,18 @@ +define(['../lang/isArray', '../object/size'], function (isArray, objSize) { + + /** + * Get collection size + */ + function size(list) { + if (!list) { + return 0; + } + if (isArray(list)) { + return list.length; + } + return objSize(list); + } + + return size; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/some.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/some.js new file mode 100644 index 00000000..c0aebee2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/collection/some.js @@ -0,0 +1,7 @@ +define(['./make_', '../array/some', '../object/some'], function (make, arrSome, objSome) { + + /** + */ + return make(arrSome, objSome); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date.js new file mode 100644 index 00000000..b3038ee3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date.js @@ -0,0 +1,22 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'dayOfTheYear' : require('./date/dayOfTheYear'), + 'diff' : require('./date/diff'), + 'i18n_' : require('./date/i18n_'), + 'isLeapYear' : require('./date/isLeapYear'), + 'isSame' : require('./date/isSame'), + 'parseIso' : require('./date/parseIso'), + 'quarter' : require('./date/quarter'), + 'startOf' : require('./date/startOf'), + 'strftime' : require('./date/strftime'), + 'timezoneAbbr' : require('./date/timezoneAbbr'), + 'timezoneOffset' : require('./date/timezoneOffset'), + 'totalDaysInMonth' : require('./date/totalDaysInMonth'), + 'totalDaysInYear' : require('./date/totalDaysInYear'), + 'weekOfTheYear' : require('./date/weekOfTheYear') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/dayOfTheYear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/dayOfTheYear.js new file mode 100644 index 00000000..dc77ae1b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/dayOfTheYear.js @@ -0,0 +1,13 @@ +define(['../lang/isDate'], function (isDate) { + + /** + * return the day of the year (1..366) + */ + function dayOfTheYear(date){ + return (Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) - + Date.UTC(date.getFullYear(), 0, 1)) / 86400000 + 1; + } + + return dayOfTheYear; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/diff.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/diff.js new file mode 100644 index 00000000..667165fe --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/diff.js @@ -0,0 +1,128 @@ +define(['./totalDaysInMonth', './totalDaysInYear', '../time/convert'], function(totalDaysInMonth, totalDaysInYear, convert){ + + /** + * calculate the difference between dates (range) + */ + function diff(start, end, unitName){ + // sort the dates to make it easier to process (specially year/month) + if (start > end) { + var swap = start; + start = end; + end = swap; + } + + var output; + + if (unitName === 'month') { + output = getMonthsDiff(start, end); + } else if (unitName === 'year'){ + output = getYearsDiff(start, end); + } else if (unitName != null) { + if (unitName === 'day') { + // ignore timezone difference because of daylight savings time + start = toUtc(start); + end = toUtc(end); + } + output = convert(end - start, 'ms', unitName); + } else { + output = end - start; + } + + return output; + } + + + function toUtc(d){ + // we ignore timezone differences on purpose because of daylight + // savings time, otherwise it would return fractional days/weeks even + // if a full day elapsed. eg: + // Wed Feb 12 2014 00:00:00 GMT-0200 (BRST) + // Sun Feb 16 2014 00:00:00 GMT-0300 (BRT) + // diff should be 4 days and not 4.041666666666667 + return Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), + d.getHours(), d.getMinutes(), d.getSeconds(), + d.getMilliseconds()); + } + + + function getMonthsDiff(start, end){ + return getElapsedMonths(start, end) + + getElapsedYears(start, end) * 12 + + getFractionalMonth(start, end); + } + + + function getYearsDiff(start, end){ + var elapsedYears = getElapsedYears(start, end); + return elapsedYears + getFractionalYear(start, end, elapsedYears); + } + + + function getElapsedMonths(start, end){ + var monthDiff = end.getMonth() - start.getMonth(); + if (monthDiff < 0) { + monthDiff += 12; + } + // less than a full month + if (start.getDate() > end.getDate()) { + monthDiff -= 1; + } + return monthDiff; + } + + + function getElapsedYears(start, end){ + var yearDiff = end.getFullYear() - start.getFullYear(); + // less than a full year + if (start.getMonth() > end.getMonth()) { + yearDiff -= 1; + } + return yearDiff; + } + + + function getFractionalMonth(start, end){ + var fractionalDiff = 0; + var startDay = start.getDate(); + var endDay = end.getDate(); + + if (startDay !== endDay) { + var startTotalDays = totalDaysInMonth(start); + var endTotalDays = totalDaysInMonth(end); + var totalDays; + var daysElapsed; + + if (startDay > endDay) { + // eg: Jan 29 - Feb 27 (29 days elapsed but not a full month) + var baseDay = startTotalDays - startDay; + daysElapsed = endDay + baseDay; + // total days should be relative to 1st day of next month if + // startDay > endTotalDays + totalDays = (startDay > endTotalDays)? + endTotalDays + baseDay + 1 : startDay + baseDay; + } else { + // fractional is only based on endMonth eg: Jan 12 - Feb 18 + // (6 fractional days, 28 days until next full month) + daysElapsed = endDay - startDay; + totalDays = endTotalDays; + } + + fractionalDiff = daysElapsed / totalDays; + } + + return fractionalDiff; + } + + + function getFractionalYear(start, end, elapsedYears){ + var base = elapsedYears? + new Date(end.getFullYear(), start.getMonth(), start.getDate()) : + start; + var elapsedDays = diff(base, end, 'day'); + return elapsedDays / totalDaysInYear(end); + } + + + return diff; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n/de-DE.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n/de-DE.js new file mode 100644 index 00000000..46f5c6aa --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n/de-DE.js @@ -0,0 +1,61 @@ +define(function(){ + // de-DE (German) + return { + "am" : "", + "pm" : "", + + "x": "%d/%m/%y", + "X": "%H:%M:%S", + "c": "%a %d %b %Y %H:%M:%S %Z", + + "months" : [ + "Januar", + "Februar", + "März", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Dezember" + ], + + "months_abbr" : [ + "Jan", + "Febr", + "März", + "Apr", + "Mai", + "Juni", + "Juli", + "Aug", + "Sept", + "Okt", + "Nov", + "Dez" + ], + + "days" : [ + "Sonntag", + "Montag", + "Dienstag", + "Mittwoch", + "Donnerstag", + "Freitag", + "Samstag" + ], + + "days_abbr" : [ + "So", + "Mo", + "Di", + "Mi", + "Do", + "Fr", + "Sa" + ] + }; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n/en-US.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n/en-US.js new file mode 100644 index 00000000..5e640c22 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n/en-US.js @@ -0,0 +1,61 @@ +define(function(){ + // en-US (English, United States) + return { + "am" : "AM", + "pm" : "PM", + + "x": "%m/%d/%y", + "X": "%H:%M:%S", + "c": "%a %d %b %Y %I:%M:%S %p %Z", + + "months" : [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + + "months_abbr" : [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ], + + "days" : [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + + "days_abbr" : [ + "Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat" + ] + }; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n/pt-BR.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n/pt-BR.js new file mode 100644 index 00000000..47256dd2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n/pt-BR.js @@ -0,0 +1,61 @@ +define(function(){ + // pt-BR (Brazillian Portuguese) + return { + "am" : "", + "pm" : "", + + "x": "%d/%m/%y", + "X": "%H:%M:%S", + "c": "%a %d %b %Y %H:%M:%S %Z", + + "months" : [ + "Janeiro", + "Fevereiro", + "Março", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro" + ], + + "months_abbr" : [ + "Jan", + "Fev", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Out", + "Nov", + "Dez" + ], + + "days" : [ + "Domingo", + "Segunda", + "Terça", + "Quarta", + "Quinta", + "Sexta", + "Sábado" + ], + + "days_abbr" : [ + "Dom", + "Seg", + "Ter", + "Qua", + "Qui", + "Sex", + "Sáb" + ] + }; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n_.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n_.js new file mode 100644 index 00000000..c04ce885 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/i18n_.js @@ -0,0 +1,13 @@ +define(['../object/mixIn', './i18n/en-US'], function(mixIn, enUS){ + + // we also use mixIn to make sure we don't affect the original locale + var activeLocale = mixIn({}, enUS, { + // we expose a "set" method to allow overriding the global locale + set : function(localeData){ + mixIn(activeLocale, localeData); + } + }); + + return activeLocale; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/isLeapYear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/isLeapYear.js new file mode 100644 index 00000000..e400b43d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/isLeapYear.js @@ -0,0 +1,15 @@ +define(['../lang/isDate'], function (isDate) { + + /** + * checks if it's a leap year + */ + function isLeapYear(fullYear){ + if (isDate(fullYear)) { + fullYear = fullYear.getFullYear(); + } + return fullYear % 400 === 0 || (fullYear % 100 !== 0 && fullYear % 4 === 0); + } + + return isLeapYear; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/isSame.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/isSame.js new file mode 100644 index 00000000..f30531fc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/isSame.js @@ -0,0 +1,16 @@ +define(['./startOf'], function (startOf) { + + /** + * Check if date is "same" with optional period + */ + function isSame(date1, date2, period){ + if (period) { + date1 = startOf(date1, period); + date2 = startOf(date2, period); + } + return Number(date1) === Number(date2); + } + + return isSame; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/parseIso.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/parseIso.js new file mode 100644 index 00000000..b21c8797 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/parseIso.js @@ -0,0 +1,146 @@ +define(['../array/some'], function (some) { + + var datePatterns = [ + /^([0-9]{4})$/, // YYYY + /^([0-9]{4})-([0-9]{2})$/, // YYYY-MM (YYYYMM not allowed) + /^([0-9]{4})-?([0-9]{2})-?([0-9]{2})$/ // YYYY-MM-DD or YYYYMMDD + ]; + var ORD_DATE = /^([0-9]{4})-?([0-9]{3})$/; // YYYY-DDD + + var timePatterns = [ + /^([0-9]{2}(?:\.[0-9]*)?)$/, // HH.hh + /^([0-9]{2}):?([0-9]{2}(?:\.[0-9]*)?)$/, // HH:MM.mm + /^([0-9]{2}):?([0-9]{2}):?([0-9]{2}(\.[0-9]*)?)$/ // HH:MM:SS.ss + ]; + + var DATE_TIME = /^(.+)T(.+)$/; + var TIME_ZONE = /^(.+)([+\-])([0-9]{2}):?([0-9]{2})$/; + + function matchAll(str, patterns) { + var match; + var found = some(patterns, function(pattern) { + return !!(match = pattern.exec(str)); + }); + + return found ? match : null; + } + + function getDate(year, month, day) { + var date = new Date(Date.UTC(year, month, day)); + + // Explicitly set year to avoid Date.UTC making dates < 100 relative to + // 1900 + date.setUTCFullYear(year); + + var valid = + date.getUTCFullYear() === year && + date.getUTCMonth() === month && + date.getUTCDate() === day; + return valid ? +date : NaN; + } + + function parseOrdinalDate(str) { + var match = ORD_DATE.exec(str); + if (match ) { + var year = +match[1], + day = +match[2], + date = new Date(Date.UTC(year, 0, day)); + + if (date.getUTCFullYear() === year) { + return +date; + } + } + + return NaN; + } + + function parseDate(str) { + var match, year, month, day; + + match = matchAll(str, datePatterns); + if (match === null) { + // Ordinal dates are verified differently. + return parseOrdinalDate(str); + } + + year = (match[1] === void 0) ? 0 : +match[1]; + month = (match[2] === void 0) ? 0 : +match[2] - 1; + day = (match[3] === void 0) ? 1 : +match[3]; + + return getDate(year, month, day); + } + + function getTime(hr, min, sec) { + var valid = + (hr < 24 && hr >= 0 && + min < 60 && min >= 0 && + sec < 60 && min >= 0) || + (hr === 24 && min === 0 && sec === 0); + if (!valid) { + return NaN; + } + + return ((hr * 60 + min) * 60 + sec) * 1000; + } + + function parseOffset(str) { + var match; + if (str.charAt(str.length - 1) === 'Z') { + str = str.substring(0, str.length - 1); + } else { + match = TIME_ZONE.exec(str); + if (match) { + var hours = +match[3], + minutes = (match[4] === void 0) ? 0 : +match[4], + offset = getTime(hours, minutes, 0); + + if (match[2] === '-') { + offset *= -1; + } + + return { offset: offset, time: match[1] }; + } + } + + // No time zone specified, assume UTC + return { offset: 0, time: str }; + } + + function parseTime(str) { + var match; + var offset = parseOffset(str); + + str = offset.time; + offset = offset.offset; + if (isNaN(offset)) { + return NaN; + } + + match = matchAll(str, timePatterns); + if (match === null) { + return NaN; + } + + var hours = (match[1] === void 0) ? 0 : +match[1], + minutes = (match[2] === void 0) ? 0 : +match[2], + seconds = (match[3] === void 0) ? 0 : +match[3]; + + return getTime(hours, minutes, seconds) - offset; + } + + /** + * Parse an ISO8601 formatted date string, and return a Date object. + */ + function parseISO8601(str){ + var match = DATE_TIME.exec(str); + if (!match) { + // No time specified + return parseDate(str); + } + + return parseDate(match[1]) + parseTime(match[2]); + } + + return parseISO8601; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/quarter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/quarter.js new file mode 100644 index 00000000..62b92067 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/quarter.js @@ -0,0 +1,16 @@ +define(function () { + + /** + * gets date quarter + */ + function quarter(date){ + var month = date.getMonth(); + if (month < 3) return 1; + if (month < 6) return 2; + if (month < 9) return 3; + return 4; + } + + return quarter; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/startOf.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/startOf.js new file mode 100644 index 00000000..747f114d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/startOf.js @@ -0,0 +1,54 @@ +define(['../lang/clone'], function (clone) { + + /** + * get a new Date object representing start of period + */ + function startOf(date, period){ + date = clone(date); + + // intentionally removed "break" from switch since start of + // month/year/etc should also reset the following periods + switch (period) { + case 'year': + date.setMonth(0); + /* falls through */ + case 'month': + date.setDate(1); + /* falls through */ + case 'week': + case 'day': + date.setHours(0); + /* falls through */ + case 'hour': + date.setMinutes(0); + /* falls through */ + case 'minute': + date.setSeconds(0); + /* falls through */ + case 'second': + date.setMilliseconds(0); + break; + default: + throw new Error('"'+ period +'" is not a valid period'); + } + + // week is the only case that should reset the weekDay and maybe even + // overflow to previous month + if (period === 'week') { + var weekDay = date.getDay(); + var baseDate = date.getDate(); + if (weekDay) { + if (weekDay >= baseDate) { + //start of the week is on previous month + date.setDate(0); + } + date.setDate(date.getDate() - date.getDay()); + } + } + + return date; + } + + return startOf; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/strftime.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/strftime.js new file mode 100644 index 00000000..9c09c693 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/strftime.js @@ -0,0 +1,115 @@ +define(['../number/pad', '../string/lpad', './i18n_', './dayOfTheYear', './timezoneOffset', './timezoneAbbr', './weekOfTheYear'], function (pad, lpad, i18n, dayOfTheYear, timezoneOffset, timezoneAbbr, weekOfTheYear) { + + var _combinations = { + 'D': '%m/%d/%y', + 'F': '%Y-%m-%d', + 'r': '%I:%M:%S %p', + 'R': '%H:%M', + 'T': '%H:%M:%S', + 'x': 'locale', + 'X': 'locale', + 'c': 'locale' + }; + + + /** + * format date based on strftime format + */ + function strftime(date, format, localeData){ + localeData = localeData || i18n; + var reToken = /%([a-z%])/gi; + + function makeIterator(fn) { + return function(match, token){ + return fn(date, token, localeData); + }; + } + + return format + .replace(reToken, makeIterator(expandCombinations)) + .replace(reToken, makeIterator(convertToken)); + } + + + function expandCombinations(date, token, l10n){ + if (token in _combinations) { + var expanded = _combinations[token]; + return expanded === 'locale'? l10n[token] : expanded; + } else { + return '%'+ token; + } + } + + + function convertToken(date, token, l10n){ + switch (token){ + case 'a': + return l10n.days_abbr[date.getDay()]; + case 'A': + return l10n.days[date.getDay()]; + case 'h': + case 'b': + return l10n.months_abbr[date.getMonth()]; + case 'B': + return l10n.months[date.getMonth()]; + case 'C': + return pad(Math.floor(date.getFullYear() / 100), 2); + case 'd': + return pad(date.getDate(), 2); + case 'e': + return pad(date.getDate(), 2, ' '); + case 'H': + return pad(date.getHours(), 2); + case 'I': + return pad(date.getHours() % 12, 2); + case 'j': + return pad(dayOfTheYear(date), 3); + case 'l': + return lpad(date.getHours() % 12, 2); + case 'L': + return pad(date.getMilliseconds(), 3); + case 'm': + return pad(date.getMonth() + 1, 2); + case 'M': + return pad(date.getMinutes(), 2); + case 'n': + return '\n'; + case 'p': + return date.getHours() >= 12? l10n.pm : l10n.am; + case 'P': + return convertToken(date, 'p', l10n).toLowerCase(); + case 's': + return date.getTime() / 1000; + case 'S': + return pad(date.getSeconds(), 2); + case 't': + return '\t'; + case 'u': + var day = date.getDay(); + return day === 0? 7 : day; + case 'U': + return pad(weekOfTheYear(date), 2); + case 'w': + return date.getDay(); + case 'W': + return pad(weekOfTheYear(date, 1), 2); + case 'y': + return pad(date.getFullYear() % 100, 2); + case 'Y': + return pad(date.getFullYear(), 4); + case 'z': + return timezoneOffset(date); + case 'Z': + return timezoneAbbr(date); + case '%': + return '%'; + default: + // keep unrecognized tokens + return '%'+ token; + } + } + + + return strftime; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/timezoneAbbr.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/timezoneAbbr.js new file mode 100644 index 00000000..225a6856 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/timezoneAbbr.js @@ -0,0 +1,17 @@ +define(['./timezoneOffset'], function(timezoneOffset) { + + /** + * Abbreviated time zone name or similar information. + */ + function timezoneAbbr(date){ + // Date.toString gives different results depending on the + // browser/system so we fallback to timezone offset + // chrome: 'Mon Apr 08 2013 09:02:04 GMT-0300 (BRT)' + // IE: 'Mon Apr 8 09:02:04 UTC-0300 2013' + var tz = /\(([A-Z]{3,4})\)/.exec(date.toString()); + return tz? tz[1] : timezoneOffset(date); + } + + return timezoneAbbr; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/timezoneOffset.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/timezoneOffset.js new file mode 100644 index 00000000..ca06705d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/timezoneOffset.js @@ -0,0 +1,16 @@ +define(['../number/pad'], function (pad) { + + /** + * time zone as hour and minute offset from UTC (e.g. +0900) + */ + function timezoneOffset(date){ + var offset = date.getTimezoneOffset(); + var abs = Math.abs(offset); + var h = pad(Math.floor(abs / 60), 2); + var m = pad(abs % 60, 2); + return (offset > 0? '-' : '+') + h + m; + } + + return timezoneOffset; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/totalDaysInMonth.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/totalDaysInMonth.js new file mode 100644 index 00000000..9aaafd7b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/totalDaysInMonth.js @@ -0,0 +1,22 @@ +define(['../lang/isDate', './isLeapYear'], function (isDate, isLeapYear) { + + var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + + /** + * returns the total amount of days in the month (considering leap years) + */ + function totalDaysInMonth(fullYear, monthIndex){ + if (isDate(fullYear)) { + monthIndex = fullYear.getMonth(); + } + + if (monthIndex === 1 && isLeapYear(fullYear)) { + return 29; + } else { + return DAYS_IN_MONTH[monthIndex]; + } + } + + return totalDaysInMonth; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/totalDaysInYear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/totalDaysInYear.js new file mode 100644 index 00000000..e9036b42 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/totalDaysInYear.js @@ -0,0 +1,13 @@ +define(['./isLeapYear'], function (isLeapYear) { + + /** + * return the amount of days in the year following the gregorian calendar + * and leap years + */ + function totalDaysInYear(fullYear){ + return isLeapYear(fullYear)? 366 : 365; + } + + return totalDaysInYear; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/weekOfTheYear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/weekOfTheYear.js new file mode 100644 index 00000000..8dabc458 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/date/weekOfTheYear.js @@ -0,0 +1,16 @@ +define(['./dayOfTheYear'], function (dayOfTheYear) { + + /** + * Return the week of the year based on given firstDayOfWeek + */ + function weekOfTheYear(date, firstDayOfWeek){ + firstDayOfWeek = firstDayOfWeek == null? 0 : firstDayOfWeek; + var doy = dayOfTheYear(date); + var dow = (7 + date.getDay() - firstDayOfWeek) % 7; + var relativeWeekDay = 6 - firstDayOfWeek - dow; + return Math.floor((doy + relativeWeekDay) / 7); + } + + return weekOfTheYear; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function.js new file mode 100644 index 00000000..077a9242 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function.js @@ -0,0 +1,23 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'awaitDelay' : require('./function/awaitDelay'), + 'bind' : require('./function/bind'), + 'compose' : require('./function/compose'), + 'constant' : require('./function/constant'), + 'debounce' : require('./function/debounce'), + 'func' : require('./function/func'), + 'identity' : require('./function/identity'), + 'makeIterator_' : require('./function/makeIterator_'), + 'partial' : require('./function/partial'), + 'prop' : require('./function/prop'), + 'series' : require('./function/series'), + 'throttle' : require('./function/throttle'), + 'timeout' : require('./function/timeout'), + 'times' : require('./function/times'), + 'wrap' : require('./function/wrap') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/awaitDelay.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/awaitDelay.js new file mode 100644 index 00000000..88bea6ed --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/awaitDelay.js @@ -0,0 +1,20 @@ +define(['../time/now', './timeout', '../array/append'], function (now, timeout, append) { + + /** + * Ensure a minimum delay for callbacks + */ + function awaitDelay( callback, delay ){ + var baseTime = now() + delay; + return function() { + // ensure all browsers will execute it asynchronously (avoid hard + // to catch errors) not using "0" because of old browsers and also + // since new browsers increase the value to be at least "4" + // http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout + var ms = Math.max(baseTime - now(), 4); + return timeout.apply(this, append([callback, ms, this], arguments)); + }; + } + + return awaitDelay; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/bind.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/bind.js new file mode 100644 index 00000000..787c2984 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/bind.js @@ -0,0 +1,19 @@ +define(['../array/slice'], function(slice){ + + /** + * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection. + * @param {Function} fn Function. + * @param {object} context Execution context. + * @param {rest} args Arguments (0...n arguments). + * @return {Function} Wrapped Function. + */ + function bind(fn, context, args){ + var argsArr = slice(arguments, 2); //curried args + return function(){ + return fn.apply(context, argsArr.concat(slice(arguments))); + }; + } + + return bind; +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/compose.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/compose.js new file mode 100644 index 00000000..d8b228fa --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/compose.js @@ -0,0 +1,23 @@ +define(function () { + + /** + * Returns a function that composes multiple functions, passing results to + * each other. + */ + function compose() { + var fns = arguments; + return function(arg){ + // only cares about the first argument since the chain can only + // deal with a single return value anyway. It should start from + // the last fn. + var n = fns.length; + while (n--) { + arg = fns[n].call(this, arg); + } + return arg; + }; + } + + return compose; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/constant.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/constant.js new file mode 100644 index 00000000..addd412c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/constant.js @@ -0,0 +1,14 @@ +define(function () { + + /** + * Returns a new function that will return the value + */ + function constant(value){ + return function() { + return value; + }; + } + + return constant; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/debounce.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/debounce.js new file mode 100644 index 00000000..8c5fd47f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/debounce.js @@ -0,0 +1,32 @@ +define(function () { + + /** + * Debounce callback execution + */ + function debounce(fn, threshold, isAsap){ + var timeout, result; + function debounced(){ + var args = arguments, context = this; + function delayed(){ + if (! isAsap) { + result = fn.apply(context, args); + } + timeout = null; + } + if (timeout) { + clearTimeout(timeout); + } else if (isAsap) { + result = fn.apply(context, args); + } + timeout = setTimeout(delayed, threshold); + return result; + } + debounced.cancel = function(){ + clearTimeout(timeout); + }; + return debounced; + } + + return debounce; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/func.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/func.js new file mode 100644 index 00000000..b920e00e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/func.js @@ -0,0 +1,14 @@ +define(function () { + + /** + * Returns a function that call a method on the passed object + */ + function func(name){ + return function(obj){ + return obj[name](); + }; + } + + return func; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/identity.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/identity.js new file mode 100644 index 00000000..59f7182c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/identity.js @@ -0,0 +1,12 @@ +define(function () { + + /** + * Returns the first argument provided to it. + */ + function identity(val){ + return val; + } + + return identity; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/makeIterator_.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/makeIterator_.js new file mode 100644 index 00000000..771ea199 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/makeIterator_.js @@ -0,0 +1,32 @@ +define(['./identity', './prop', '../object/deepMatches'], function(identity, prop, deepMatches) { + + /** + * Converts argument into a valid iterator. + * Used internally on most array/object/collection methods that receives a + * callback/iterator providing a shortcut syntax. + */ + function makeIterator(src, thisObj){ + if (src == null) { + return identity; + } + switch(typeof src) { + case 'function': + // function is the first to improve perf (most common case) + // also avoid using `Function#call` if not needed, which boosts + // perf a lot in some cases + return (typeof thisObj !== 'undefined')? function(val, i, arr){ + return src.call(thisObj, val, i, arr); + } : src; + case 'object': + return function(val){ + return deepMatches(val, src); + }; + case 'string': + case 'number': + return prop(src); + } + } + + return makeIterator; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/partial.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/partial.js new file mode 100644 index 00000000..7a6a4940 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/partial.js @@ -0,0 +1,23 @@ +define(['../array/slice'], function (slice) { + + /** + * Creates a partially applied function. + */ + function partial(f) { + var as = slice(arguments, 1); + return function() { + var args = as.concat(slice(arguments)); + for (var i = args.length; i--;) { + if (args[i] === partial._) { + args[i] = args.splice(-1)[0]; + } + } + return f.apply(this, args); + }; + } + + partial._ = {}; + + return partial; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/prop.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/prop.js new file mode 100644 index 00000000..c9df78ca --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/prop.js @@ -0,0 +1,14 @@ +define(function () { + + /** + * Returns a function that gets a property of the passed object + */ + function prop(name){ + return function(obj){ + return obj[name]; + }; + } + + return prop; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/series.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/series.js new file mode 100644 index 00000000..c8856a27 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/series.js @@ -0,0 +1,22 @@ +define(function () { + + /** + * Returns a function that will execute a list of functions in sequence + * passing the same arguments to each one. (useful for batch processing + * items during a forEach loop) + */ + function series(){ + var fns = arguments; + return function(){ + var i = 0, + n = fns.length; + while (i < n) { + fns[i].apply(this, arguments); + i += 1; + } + }; + } + + return series; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/throttle.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/throttle.js new file mode 100644 index 00000000..9fb47b22 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/throttle.js @@ -0,0 +1,33 @@ +define(['../time/now'], function (now) { + + /** + */ + function throttle(fn, delay){ + var context, timeout, result, args, + diff, prevCall = 0; + function delayed(){ + prevCall = now(); + timeout = null; + result = fn.apply(context, args); + } + function throttled(){ + context = this; + args = arguments; + diff = delay - (now() - prevCall); + if (diff <= 0) { + clearTimeout(timeout); + delayed(); + } else if (! timeout) { + timeout = setTimeout(delayed, diff); + } + return result; + } + throttled.cancel = function(){ + clearTimeout(timeout); + }; + return throttled; + } + + return throttle; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/timeout.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/timeout.js new file mode 100644 index 00000000..61b832c5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/timeout.js @@ -0,0 +1,17 @@ +define(['../array/slice'], function (slice) { + + /** + * Delays the call of a function within a given context. + */ + function timeout(fn, millis, context){ + + var args = slice(arguments, 3); + + return setTimeout(function() { + fn.apply(context, args); + }, millis); + } + + return timeout; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/times.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/times.js new file mode 100644 index 00000000..ec10caeb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/times.js @@ -0,0 +1,17 @@ +define(function () { + + /** + * Iterates over a callback a set amount of times + */ + function times(n, callback, thisObj){ + var i = -1; + while (++i < n) { + if ( callback.call(thisObj, i) === false ) { + break; + } + } + } + + return times; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/wrap.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/wrap.js new file mode 100644 index 00000000..b2f54dd6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/function/wrap.js @@ -0,0 +1,14 @@ +define(['./partial'], function (partial) { + + /** + * Returns the first function passed as an argument to the second, + * allowing you to adjust arguments, run code before and after, and + * conditionally execute the original function. + */ + function wrap(fn, wrapper){ + return partial(wrapper, fn); + } + + return wrap; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/index.js new file mode 100644 index 00000000..cb3ed87e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/index.js @@ -0,0 +1,25 @@ +/**@license + * mout v0.11.0 | http://moutjs.com | MIT license + */ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'VERSION' : '0.11.0', + 'array' : require('./array'), + 'collection' : require('./collection'), + 'date' : require('./date'), + 'function' : require('./function'), + 'lang' : require('./lang'), + 'math' : require('./math'), + 'number' : require('./number'), + 'object' : require('./object'), + 'queryString' : require('./queryString'), + 'random' : require('./random'), + 'string' : require('./string'), + 'time' : require('./time'), + 'fn' : require('./function') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang.js new file mode 100644 index 00000000..df713a55 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang.js @@ -0,0 +1,40 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'GLOBAL' : require('./lang/GLOBAL'), + 'clone' : require('./lang/clone'), + 'createObject' : require('./lang/createObject'), + 'ctorApply' : require('./lang/ctorApply'), + 'deepClone' : require('./lang/deepClone'), + 'deepEquals' : require('./lang/deepEquals'), + 'defaults' : require('./lang/defaults'), + 'inheritPrototype' : require('./lang/inheritPrototype'), + 'is' : require('./lang/is'), + 'isArguments' : require('./lang/isArguments'), + 'isArray' : require('./lang/isArray'), + 'isBoolean' : require('./lang/isBoolean'), + 'isDate' : require('./lang/isDate'), + 'isEmpty' : require('./lang/isEmpty'), + 'isFinite' : require('./lang/isFinite'), + 'isFunction' : require('./lang/isFunction'), + 'isInteger' : require('./lang/isInteger'), + 'isKind' : require('./lang/isKind'), + 'isNaN' : require('./lang/isNaN'), + 'isNull' : require('./lang/isNull'), + 'isNumber' : require('./lang/isNumber'), + 'isObject' : require('./lang/isObject'), + 'isPlainObject' : require('./lang/isPlainObject'), + 'isPrimitive' : require('./lang/isPrimitive'), + 'isRegExp' : require('./lang/isRegExp'), + 'isString' : require('./lang/isString'), + 'isUndefined' : require('./lang/isUndefined'), + 'isnt' : require('./lang/isnt'), + 'kindOf' : require('./lang/kindOf'), + 'toArray' : require('./lang/toArray'), + 'toNumber' : require('./lang/toNumber'), + 'toString' : require('./lang/toString') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/GLOBAL.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/GLOBAL.js new file mode 100644 index 00000000..dcd4a42a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/GLOBAL.js @@ -0,0 +1,7 @@ +define(function () { + + // Reference to the global context (works on ES3 and ES5-strict mode) + //jshint -W061, -W064 + return Function('return this')(); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/clone.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/clone.js new file mode 100644 index 00000000..d3429fdc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/clone.js @@ -0,0 +1,47 @@ +define(['./kindOf', './isPlainObject', '../object/mixIn'], function (kindOf, isPlainObject, mixIn) { + + /** + * Clone native types. + */ + function clone(val){ + switch (kindOf(val)) { + case 'Object': + return cloneObject(val); + case 'Array': + return cloneArray(val); + case 'RegExp': + return cloneRegExp(val); + case 'Date': + return cloneDate(val); + default: + return val; + } + } + + function cloneObject(source) { + if (isPlainObject(source)) { + return mixIn({}, source); + } else { + return source; + } + } + + function cloneRegExp(r) { + var flags = ''; + flags += r.multiline ? 'm' : ''; + flags += r.global ? 'g' : ''; + flags += r.ignoreCase ? 'i' : ''; + return new RegExp(r.source, flags); + } + + function cloneDate(date) { + return new Date(+date); + } + + function cloneArray(arr) { + return arr.slice(); + } + + return clone; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/createObject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/createObject.js new file mode 100644 index 00000000..f7661500 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/createObject.js @@ -0,0 +1,18 @@ +define(['../object/mixIn'], function(mixIn){ + + /** + * Create Object using prototypal inheritance and setting custom properties. + * - Mix between Douglas Crockford Prototypal Inheritance and the EcmaScript 5 `Object.create()` method. + * @param {object} parent Parent Object. + * @param {object} [props] Object properties. + * @return {object} Created object. + */ + function createObject(parent, props){ + function F(){} + F.prototype = parent; + return mixIn(new F(), props); + + } + return createObject; +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/ctorApply.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/ctorApply.js new file mode 100644 index 00000000..a9ac1c54 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/ctorApply.js @@ -0,0 +1,17 @@ +define(function () { + + function F(){} + + /** + * Do fn.apply on a constructor. + */ + function ctorApply(ctor, args) { + F.prototype = ctor.prototype; + var instance = new F(); + ctor.apply(instance, args); + return instance; + } + + return ctorApply; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/deepClone.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/deepClone.js new file mode 100644 index 00000000..d45c10aa --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/deepClone.js @@ -0,0 +1,45 @@ +define(['./clone', '../object/forOwn', './kindOf', './isPlainObject'], function (clone, forOwn, kindOf, isPlainObject) { + + /** + * Recursively clone native types. + */ + function deepClone(val, instanceClone) { + switch ( kindOf(val) ) { + case 'Object': + return cloneObject(val, instanceClone); + case 'Array': + return cloneArray(val, instanceClone); + default: + return clone(val); + } + } + + function cloneObject(source, instanceClone) { + if (isPlainObject(source)) { + var out = {}; + forOwn(source, function(val, key) { + this[key] = deepClone(val, instanceClone); + }, out); + return out; + } else if (instanceClone) { + return instanceClone(source); + } else { + return source; + } + } + + function cloneArray(arr, instanceClone) { + var out = [], + i = -1, + n = arr.length, + val; + while (++i < n) { + out[i] = deepClone(arr[i], instanceClone); + } + return out; + } + + return deepClone; + +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/deepEquals.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/deepEquals.js new file mode 100644 index 00000000..f4eda1a3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/deepEquals.js @@ -0,0 +1,26 @@ +define(['./is', './isObject', './isArray', '../object/equals', '../array/equals'], function (is, isObject, isArray, objEquals, arrEquals) { + + /** + * Recursively checks for same properties and values. + */ + function deepEquals(a, b, callback){ + callback = callback || is; + + var bothObjects = isObject(a) && isObject(b); + var bothArrays = !bothObjects && isArray(a) && isArray(b); + + if (!bothObjects && !bothArrays) { + return callback(a, b); + } + + function compare(a, b){ + return deepEquals(a, b, callback); + } + + var method = bothObjects ? objEquals : arrEquals; + return method(a, b, compare); + } + + return deepEquals; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/defaults.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/defaults.js new file mode 100644 index 00000000..5156b1bb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/defaults.js @@ -0,0 +1,16 @@ +define(['./toArray', '../array/find'], function (toArray, find) { + + /** + * Return first non void argument + */ + function defaults(var_args){ + return find(toArray(arguments), nonVoid); + } + + function nonVoid(val){ + return val != null; + } + + return defaults; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/inheritPrototype.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/inheritPrototype.js new file mode 100644 index 00000000..64c91780 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/inheritPrototype.js @@ -0,0 +1,18 @@ +define(['./createObject'], function(createObject){ + + /** + * Inherit prototype from another Object. + * - inspired by Nicholas Zackas Solution + * @param {object} child Child object + * @param {object} parent Parent Object + */ + function inheritPrototype(child, parent){ + var p = createObject(parent.prototype); + p.constructor = child; + child.prototype = p; + child.super_ = parent; + return p; + } + + return inheritPrototype; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/is.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/is.js new file mode 100644 index 00000000..261a2077 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/is.js @@ -0,0 +1,23 @@ +define(function () { + + /** + * Check if both arguments are egal. + */ + function is(x, y){ + // implementation borrowed from harmony:egal spec + if (x === y) { + // 0 === -0, but they are not identical + return x !== 0 || 1 / x === 1 / y; + } + + // NaN !== NaN, but they are identical. + // NaNs are the only non-reflexive value, i.e., if x !== x, + // then x is a NaN. + // isNaN is broken: it converts its argument to number, so + // isNaN("foo") => true + return x !== x && y !== y; + } + + return is; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isArguments.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isArguments.js new file mode 100644 index 00000000..f889ee8e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isArguments.js @@ -0,0 +1,15 @@ +define(['./isKind'], function (isKind) { + + /** + */ + var isArgs = isKind(arguments, 'Arguments')? + function(val){ + return isKind(val, 'Arguments'); + } : + function(val){ + // Arguments is an Object on IE7 + return !!(val && Object.prototype.hasOwnProperty.call(val, 'callee')); + }; + + return isArgs; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isArray.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isArray.js new file mode 100644 index 00000000..886e2aa5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isArray.js @@ -0,0 +1,8 @@ +define(['./isKind'], function (isKind) { + /** + */ + var isArray = Array.isArray || function (val) { + return isKind(val, 'Array'); + }; + return isArray; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isBoolean.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isBoolean.js new file mode 100644 index 00000000..1ca27a69 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isBoolean.js @@ -0,0 +1,8 @@ +define(['./isKind'], function (isKind) { + /** + */ + function isBoolean(val) { + return isKind(val, 'Boolean'); + } + return isBoolean; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isDate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isDate.js new file mode 100644 index 00000000..2708d676 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isDate.js @@ -0,0 +1,8 @@ +define(['./isKind'], function (isKind) { + /** + */ + function isDate(val) { + return isKind(val, 'Date'); + } + return isDate; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isEmpty.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isEmpty.js new file mode 100644 index 00000000..8b677506 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isEmpty.js @@ -0,0 +1,23 @@ +define(['../object/forOwn', './isArray'], function (forOwn, isArray) { + + function isEmpty(val){ + if (val == null) { + // typeof null == 'object' so we check it first + return true; + } else if ( typeof val === 'string' || isArray(val) ) { + return !val.length; + } else if ( typeof val === 'object' ) { + var result = true; + forOwn(val, function(){ + result = false; + return false; // break loop + }); + return result; + } else { + return true; + } + } + + return isEmpty; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isFinite.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isFinite.js new file mode 100644 index 00000000..05c29ac1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isFinite.js @@ -0,0 +1,19 @@ +define(['./isNumber', './GLOBAL'], function (isNumber, GLOBAL) { + + /** + * Check if value is finite + */ + function isFinite(val){ + var is = false; + if (typeof val === 'string' && val !== '') { + is = GLOBAL.isFinite( parseFloat(val) ); + } else if (isNumber(val)){ + // need to use isNumber because of Number constructor + is = GLOBAL.isFinite( val ); + } + return is; + } + + return isFinite; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isFunction.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isFunction.js new file mode 100644 index 00000000..ff5df7f0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isFunction.js @@ -0,0 +1,8 @@ +define(['./isKind'], function (isKind) { + /** + */ + function isFunction(val) { + return isKind(val, 'Function'); + } + return isFunction; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isInteger.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isInteger.js new file mode 100644 index 00000000..1931f516 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isInteger.js @@ -0,0 +1,12 @@ +define(['./isNumber'], function (isNumber) { + + /** + * Check if value is an integer + */ + function isInteger(val){ + return isNumber(val) && (val % 1 === 0); + } + + return isInteger; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isKind.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isKind.js new file mode 100644 index 00000000..6937a12f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isKind.js @@ -0,0 +1,9 @@ +define(['./kindOf'], function (kindOf) { + /** + * Check if value is from a specific "kind". + */ + function isKind(val, kind){ + return kindOf(val) === kind; + } + return isKind; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isNaN.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isNaN.js new file mode 100644 index 00000000..2219404d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isNaN.js @@ -0,0 +1,15 @@ +define(['./isNumber', '../number/isNaN'], function (isNumber, $isNaN) { + + /** + * Check if value is NaN for realz + */ + function isNaN(val){ + // based on the fact that NaN !== NaN + // need to check if it's a number to avoid conflicts with host objects + // also need to coerce ToNumber to avoid edge case `new Number(NaN)` + return !isNumber(val) || $isNaN(Number(val)); + } + + return isNaN; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isNull.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isNull.js new file mode 100644 index 00000000..506e05ea --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isNull.js @@ -0,0 +1,9 @@ +define(function () { + /** + */ + function isNull(val){ + return val === null; + } + return isNull; +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isNumber.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isNumber.js new file mode 100644 index 00000000..9a832c5f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isNumber.js @@ -0,0 +1,8 @@ +define(['./isKind'], function (isKind) { + /** + */ + function isNumber(val) { + return isKind(val, 'Number'); + } + return isNumber; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isObject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isObject.js new file mode 100644 index 00000000..0befb063 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isObject.js @@ -0,0 +1,8 @@ +define(['./isKind'], function (isKind) { + /** + */ + function isObject(val) { + return isKind(val, 'Object'); + } + return isObject; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isPlainObject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isPlainObject.js new file mode 100644 index 00000000..406a2797 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isPlainObject.js @@ -0,0 +1,13 @@ +define(function () { + + /** + * Checks if the value is created by the `Object` constructor. + */ + function isPlainObject(value) { + return (!!value && typeof value === 'object' && + value.constructor === Object); + } + + return isPlainObject; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isPrimitive.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isPrimitive.js new file mode 100644 index 00000000..c4035ea4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isPrimitive.js @@ -0,0 +1,21 @@ +define(function() { + + /** + * Checks if the object is a primitive + */ + function isPrimitive(value) { + // Using switch fallthrough because it's simple to read and is + // generally fast: http://jsperf.com/testing-value-is-primitive/5 + switch (typeof value) { + case "string": + case "number": + case "boolean": + return true; + } + + return value == null; + } + + return isPrimitive; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isRegExp.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isRegExp.js new file mode 100644 index 00000000..d78a03da --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isRegExp.js @@ -0,0 +1,8 @@ +define(['./isKind'], function (isKind) { + /** + */ + function isRegExp(val) { + return isKind(val, 'RegExp'); + } + return isRegExp; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isString.js new file mode 100644 index 00000000..8a42fe01 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isString.js @@ -0,0 +1,8 @@ +define(['./isKind'], function (isKind) { + /** + */ + function isString(val) { + return isKind(val, 'String'); + } + return isString; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isUndefined.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isUndefined.js new file mode 100644 index 00000000..c57b28eb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isUndefined.js @@ -0,0 +1,10 @@ +define(function () { + var UNDEF; + + /** + */ + function isUndef(val){ + return val === UNDEF; + } + return isUndef; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isnt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isnt.js new file mode 100644 index 00000000..d4336222 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/isnt.js @@ -0,0 +1,12 @@ +define(['./is'], function (is) { + + /** + * Check if both values are not identical/egal + */ + function isnt(x, y){ + return !is(x, y); + } + + return isnt; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/kindOf.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/kindOf.js new file mode 100644 index 00000000..97d21d15 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/kindOf.js @@ -0,0 +1,20 @@ +define(function () { + + var _rKind = /^\[object (.*)\]$/, + _toString = Object.prototype.toString, + UNDEF; + + /** + * Gets the "kind" of value. (e.g. "String", "Number", etc) + */ + function kindOf(val) { + if (val === null) { + return 'Null'; + } else if (val === UNDEF) { + return 'Undefined'; + } else { + return _rKind.exec( _toString.call(val) )[1]; + } + } + return kindOf; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/toArray.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/toArray.js new file mode 100644 index 00000000..ad04d073 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/toArray.js @@ -0,0 +1,29 @@ +define(['./kindOf', './GLOBAL'], function (kindOf, GLOBAL) { + + /** + * Convert array-like object into array + */ + function toArray(val){ + var ret = [], + kind = kindOf(val), + n; + + if (val != null) { + if ( val.length == null || kind === 'String' || kind === 'Function' || kind === 'RegExp' || val === GLOBAL ) { + //string, regexp, function have .length but user probably just want + //to wrap value into an array.. + ret[ret.length] = val; + } else { + //window returns true on isObject in IE7 and may have length + //property. `typeof NodeList` returns `function` on Safari so + //we can't use it (#58) + n = val.length; + while (n--) { + ret[n] = val[n]; + } + } + } + return ret; + } + return toArray; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/toNumber.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/toNumber.js new file mode 100644 index 00000000..39767386 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/toNumber.js @@ -0,0 +1,20 @@ +define(['./isArray'], function (isArray) { + + /** + * covert value into number if numeric + */ + function toNumber(val){ + // numberic values should come first because of -0 + if (typeof val === 'number') return val; + // we want all falsy values (besides -0) to return zero to avoid + // headaches + if (!val) return 0; + if (typeof val === 'string') return parseFloat(val); + // arrays are edge cases. `Number([4]) === 4` + if (isArray(val)) return NaN; + return Number(val); + } + + return toNumber; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/toString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/toString.js new file mode 100644 index 00000000..c28b89af --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/lang/toString.js @@ -0,0 +1,13 @@ +define(function () { + + /** + * Typecast a value to a String, using an empty string value for null or + * undefined. + */ + function toString(val){ + return val == null ? '' : val.toString(); + } + + return toString; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math.js new file mode 100644 index 00000000..e2ba8705 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math.js @@ -0,0 +1,19 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'ceil' : require('./math/ceil'), + 'clamp' : require('./math/clamp'), + 'countSteps' : require('./math/countSteps'), + 'floor' : require('./math/floor'), + 'inRange' : require('./math/inRange'), + 'isNear' : require('./math/isNear'), + 'lerp' : require('./math/lerp'), + 'loop' : require('./math/loop'), + 'map' : require('./math/map'), + 'norm' : require('./math/norm'), + 'round' : require('./math/round') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/ceil.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/ceil.js new file mode 100644 index 00000000..d73b0581 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/ceil.js @@ -0,0 +1,11 @@ +define(function(){ + /** + * Round value up with a custom radix. + */ + function ceil(val, step){ + step = Math.abs(step || 1); + return Math.ceil(val / step) * step; + } + + return ceil; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/clamp.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/clamp.js new file mode 100644 index 00000000..fb5a1484 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/clamp.js @@ -0,0 +1,9 @@ +define(function(){ + /** + * Clamps value inside range. + */ + function clamp(val, min, max){ + return val < min? min : (val > max? max : val); + } + return clamp; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/countSteps.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/countSteps.js new file mode 100644 index 00000000..0ecb32f6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/countSteps.js @@ -0,0 +1,16 @@ +define(function(){ + /** + * Count number of full steps. + */ + function countSteps(val, step, overflow){ + val = Math.floor(val / step); + + if (overflow) { + return val % overflow; + } + + return val; + } + + return countSteps; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/floor.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/floor.js new file mode 100644 index 00000000..8a4456b6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/floor.js @@ -0,0 +1,10 @@ +define(function(){ + /** + * Floor value to full steps. + */ + function floor(val, step){ + step = Math.abs(step || 1); + return Math.floor(val / step) * step; + } + return floor; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/inRange.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/inRange.js new file mode 100644 index 00000000..0c890536 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/inRange.js @@ -0,0 +1,11 @@ +define(function(){ + /** + * Checks if value is inside the range. + */ + function inRange(val, min, max, threshold){ + threshold = threshold || 0; + return (val + threshold >= min && val - threshold <= max); + } + + return inRange; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/isNear.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/isNear.js new file mode 100644 index 00000000..b308a0b0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/isNear.js @@ -0,0 +1,9 @@ +define(function(){ + /** + * Check if value is close to target. + */ + function isNear(val, target, threshold){ + return (Math.abs(val - target) <= threshold); + } + return isNear; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/lerp.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/lerp.js new file mode 100644 index 00000000..26b99d04 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/lerp.js @@ -0,0 +1,11 @@ +define(function(){ + /** + * Linear interpolation. + * IMPORTANT:will return `Infinity` if numbers overflow Number.MAX_VALUE + */ + function lerp(ratio, start, end){ + return start + (end - start) * ratio; + } + + return lerp; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/loop.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/loop.js new file mode 100644 index 00000000..c735ecf6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/loop.js @@ -0,0 +1,10 @@ +define(function(){ + /** + * Loops value inside range. + */ + function loop(val, min, max){ + return val < min? max : (val > max? min : val); + } + + return loop; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/map.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/map.js new file mode 100644 index 00000000..bf7dc5d5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/map.js @@ -0,0 +1,10 @@ +define(['./lerp', './norm'], function(lerp, norm){ + /** + * Maps a number from one scale to another. + * @example map(3, 0, 4, -1, 1) -> 0.5 + */ + function map(val, min1, max1, min2, max2){ + return lerp( norm(val, min1, max1), min2, max2 ); + } + return map; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/norm.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/norm.js new file mode 100644 index 00000000..724d4f59 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/norm.js @@ -0,0 +1,13 @@ +define(function(){ + /** + * Gets normalized ratio of value inside range. + */ + function norm(val, min, max){ + if (val < min || val > max) { + throw new RangeError('value (' + val + ') must be between ' + min + ' and ' + max); + } + + return val === max ? 1 : (val - min) / (max - min); + } + return norm; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/round.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/round.js new file mode 100644 index 00000000..b43e4ac2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/math/round.js @@ -0,0 +1,12 @@ +define(function () { + /** + * Round number to a specific radix + */ + function round(value, radix){ + radix = radix || 1; // default round 1 + return Math.round(value / radix) * radix; + } + + return round; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number.js new file mode 100644 index 00000000..ffdb2cd9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number.js @@ -0,0 +1,25 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'MAX_INT' : require('./number/MAX_INT'), + 'MAX_SAFE_INTEGER' : require('./number/MAX_SAFE_INTEGER'), + 'MAX_UINT' : require('./number/MAX_UINT'), + 'MIN_INT' : require('./number/MIN_INT'), + 'abbreviate' : require('./number/abbreviate'), + 'currencyFormat' : require('./number/currencyFormat'), + 'enforcePrecision' : require('./number/enforcePrecision'), + 'isNaN' : require('./number/isNaN'), + 'nth' : require('./number/nth'), + 'ordinal' : require('./number/ordinal'), + 'pad' : require('./number/pad'), + 'rol' : require('./number/rol'), + 'ror' : require('./number/ror'), + 'sign' : require('./number/sign'), + 'toInt' : require('./number/toInt'), + 'toUInt' : require('./number/toUInt'), + 'toUInt31' : require('./number/toUInt31') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MAX_INT.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MAX_INT.js new file mode 100644 index 00000000..23a6e1a3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MAX_INT.js @@ -0,0 +1,6 @@ +/** + * @constant Maximum 32-bit signed integer value. (2^31 - 1) + */ +define(function(){ + return 2147483647; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MAX_SAFE_INTEGER.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MAX_SAFE_INTEGER.js new file mode 100644 index 00000000..ecdc62e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MAX_SAFE_INTEGER.js @@ -0,0 +1,7 @@ +define(function () { + + // maximum safe integer (Math.pow(2, 53) - 1) + // see: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer + return 9007199254740991; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MAX_UINT.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MAX_UINT.js new file mode 100644 index 00000000..a035096c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MAX_UINT.js @@ -0,0 +1,6 @@ +/** + * @constant Maximum 32-bit unsigned integet value (2^32 - 1) + */ +define(function(){ + return 4294967295; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MIN_INT.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MIN_INT.js new file mode 100644 index 00000000..9b3e9781 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/MIN_INT.js @@ -0,0 +1,6 @@ +/** + * @constant Minimum 32-bit signed integer value (-2^31). + */ +define(function(){ + return -2147483648; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/abbreviate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/abbreviate.js new file mode 100644 index 00000000..7e7405ad --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/abbreviate.js @@ -0,0 +1,35 @@ +define(['./enforcePrecision'], function (enforcePrecision) { + + var _defaultDict = { + thousand : 'K', + million : 'M', + billion : 'B' + }; + + /** + * Abbreviate number if bigger than 1000. (eg: 2.5K, 17.5M, 3.4B, ...) + */ + function abbreviateNumber(val, nDecimals, dict){ + nDecimals = nDecimals != null? nDecimals : 1; + dict = dict || _defaultDict; + val = enforcePrecision(val, nDecimals); + + var str, mod; + + if (val < 1000000) { + mod = enforcePrecision(val / 1000, nDecimals); + // might overflow to next scale during rounding + str = mod < 1000? mod + dict.thousand : 1 + dict.million; + } else if (val < 1000000000) { + mod = enforcePrecision(val / 1000000, nDecimals); + str = mod < 1000? mod + dict.million : 1 + dict.billion; + } else { + str = enforcePrecision(val / 1000000000, nDecimals) + dict.billion; + } + + return str; + } + + return abbreviateNumber; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/currencyFormat.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/currencyFormat.js new file mode 100644 index 00000000..1e5fecba --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/currencyFormat.js @@ -0,0 +1,27 @@ +define(['../lang/toNumber'], function (toNumber) { + + /** + * Converts number into currency format + */ + function currencyFormat(val, nDecimalDigits, decimalSeparator, thousandsSeparator) { + val = toNumber(val); + nDecimalDigits = nDecimalDigits == null? 2 : nDecimalDigits; + decimalSeparator = decimalSeparator == null? '.' : decimalSeparator; + thousandsSeparator = thousandsSeparator == null? ',' : thousandsSeparator; + + //can't use enforce precision since it returns a number and we are + //doing a RegExp over the string + var fixed = val.toFixed(nDecimalDigits), + //separate begin [$1], middle [$2] and decimal digits [$4] + parts = new RegExp('^(-?\\d{1,3})((?:\\d{3})+)(\\.(\\d{'+ nDecimalDigits +'}))?$').exec( fixed ); + + if(parts){ //val >= 1000 || val <= -1000 + return parts[1] + parts[2].replace(/\d{3}/g, thousandsSeparator + '$&') + (parts[4] ? decimalSeparator + parts[4] : ''); + }else{ + return fixed.replace('.', decimalSeparator); + } + } + + return currencyFormat; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/enforcePrecision.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/enforcePrecision.js new file mode 100644 index 00000000..1e65e505 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/enforcePrecision.js @@ -0,0 +1,12 @@ +define(['../lang/toNumber'], function(toNumber){ + /** + * Enforce a specific amount of decimal digits and also fix floating + * point rounding issues. + */ + function enforcePrecision(val, nDecimalDigits){ + val = toNumber(val); + var pow = Math.pow(10, nDecimalDigits); + return +(Math.round(val * pow) / pow).toFixed(nDecimalDigits); + } + return enforcePrecision; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/isNaN.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/isNaN.js new file mode 100644 index 00000000..3f1ebb68 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/isNaN.js @@ -0,0 +1,14 @@ +define(function () { + + /** + * ES6 Number.isNaN + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN + */ + function isNaN(val){ + // jshint eqeqeq:false + return typeof val === 'number' && val != val; + } + + return isNaN; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/nth.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/nth.js new file mode 100644 index 00000000..e991e2b6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/nth.js @@ -0,0 +1,25 @@ +define(function () { + + /** + * Returns "nth" of number (1 = "st", 2 = "nd", 3 = "rd", 4..10 = "th", ...) + */ + function nth(i) { + var t = (i % 100); + if (t >= 10 && t <= 20) { + return 'th'; + } + switch(i % 10) { + case 1: + return 'st'; + case 2: + return 'nd'; + case 3: + return 'rd'; + default: + return 'th'; + } + } + + return nth; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/ordinal.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/ordinal.js new file mode 100644 index 00000000..17927fc0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/ordinal.js @@ -0,0 +1,13 @@ +define(['./toInt', './nth'], function (toInt, nth) { + + /** + * converts number into ordinal form (1st, 2nd, 3rd, 4th, ...) + */ + function ordinal(n){ + n = toInt(n); + return n + nth(n); + } + + return ordinal; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/pad.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/pad.js new file mode 100644 index 00000000..194a3df3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/pad.js @@ -0,0 +1,13 @@ +define(['../string/lpad', '../lang/toNumber'], function(lpad, toNumber){ + + /** + * Add padding zeros if n.length < minLength. + */ + function pad(n, minLength, char){ + n = toNumber(n); + return lpad(''+ n, minLength, char || '0'); + } + + return pad; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/rol.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/rol.js new file mode 100644 index 00000000..a148f444 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/rol.js @@ -0,0 +1,10 @@ +define(function(){ + /** + * Bitwise circular shift left + * http://en.wikipedia.org/wiki/Circular_shift + */ + function rol(val, shift){ + return (val << shift) | (val >> (32 - shift)); + } + return rol; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/ror.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/ror.js new file mode 100644 index 00000000..b5c66f92 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/ror.js @@ -0,0 +1,10 @@ +define(function(){ + /** + * Bitwise circular shift right + * http://en.wikipedia.org/wiki/Circular_shift + */ + function ror(val, shift){ + return (val >> shift) | (val << (32 - shift)); + } + return ror; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/sign.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/sign.js new file mode 100644 index 00000000..b387c957 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/sign.js @@ -0,0 +1,15 @@ +define(['../lang/toNumber'], function (toNumber) { + + /** + * Get sign of the value. + */ + function sign(val) { + var num = toNumber(val); + if (num === 0) return num; // +0 and +0 === 0 + if (isNaN(num)) return num; // NaN + return num < 0? -1 : 1; + } + + return sign; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/toInt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/toInt.js new file mode 100644 index 00000000..5ea59e51 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/toInt.js @@ -0,0 +1,17 @@ +define(function(){ + + /** + * "Convert" value into an 32-bit integer. + * Works like `Math.floor` if val > 0 and `Math.ceil` if val < 0. + * IMPORTANT: val will wrap at 2^31 and -2^31. + * Perf tests: http://jsperf.com/vs-vs-parseint-bitwise-operators/7 + */ + function toInt(val){ + // we do not use lang/toNumber because of perf and also because it + // doesn't break the functionality + return ~~val; + } + + return toInt; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/toUInt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/toUInt.js new file mode 100644 index 00000000..36bbdadd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/toUInt.js @@ -0,0 +1,15 @@ +define(function () { + + /** + * "Convert" value into a 32-bit unsigned integer. + * IMPORTANT: Value will wrap at 2^32. + */ + function toUInt(val){ + // we do not use lang/toNumber because of perf and also because it + // doesn't break the functionality + return val >>> 0; + } + + return toUInt; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/toUInt31.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/toUInt31.js new file mode 100644 index 00000000..c1c4affd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/number/toUInt31.js @@ -0,0 +1,15 @@ +define(['./MAX_INT'], function(MAX_INT){ + + /** + * "Convert" value into an 31-bit unsigned integer (since 1 bit is used for sign). + * IMPORTANT: value wil wrap at 2^31, if negative will return 0. + */ + function toUInt31(val){ + // we do not use lang/toNumber because of perf and also because it + // doesn't break the functionality + return (val <= 0)? 0 : (val > MAX_INT? ~~(val % (MAX_INT + 1)) : ~~val); + } + + return toUInt31; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object.js new file mode 100644 index 00000000..9b8924a6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object.js @@ -0,0 +1,43 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'bindAll' : require('./object/bindAll'), + 'contains' : require('./object/contains'), + 'deepFillIn' : require('./object/deepFillIn'), + 'deepMatches' : require('./object/deepMatches'), + 'deepMixIn' : require('./object/deepMixIn'), + 'equals' : require('./object/equals'), + 'every' : require('./object/every'), + 'fillIn' : require('./object/fillIn'), + 'filter' : require('./object/filter'), + 'find' : require('./object/find'), + 'forIn' : require('./object/forIn'), + 'forOwn' : require('./object/forOwn'), + 'functions' : require('./object/functions'), + 'get' : require('./object/get'), + 'has' : require('./object/has'), + 'hasOwn' : require('./object/hasOwn'), + 'keys' : require('./object/keys'), + 'map' : require('./object/map'), + 'matches' : require('./object/matches'), + 'max' : require('./object/max'), + 'merge' : require('./object/merge'), + 'min' : require('./object/min'), + 'mixIn' : require('./object/mixIn'), + 'namespace' : require('./object/namespace'), + 'omit' : require('./object/omit'), + 'pick' : require('./object/pick'), + 'pluck' : require('./object/pluck'), + 'reduce' : require('./object/reduce'), + 'reject' : require('./object/reject'), + 'result' : require('./object/result'), + 'set' : require('./object/set'), + 'size' : require('./object/size'), + 'some' : require('./object/some'), + 'unset' : require('./object/unset'), + 'values' : require('./object/values') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/bindAll.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/bindAll.js new file mode 100644 index 00000000..76576d61 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/bindAll.js @@ -0,0 +1,16 @@ +define(['./functions', '../function/bind', '../array/forEach', '../array/slice'], function (functions, bind, forEach, slice) { + + /** + * Binds methods of the object to be run in it's own context. + */ + function bindAll(obj, rest_methodNames){ + var keys = arguments.length > 1? + slice(arguments, 1) : functions(obj); + forEach(keys, function(key){ + obj[key] = bind(obj[key], obj); + }); + } + + return bindAll; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/contains.js new file mode 100644 index 00000000..297e8986 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/contains.js @@ -0,0 +1,13 @@ +define(['./some'], function (some) { + + /** + * Check if object contains value + */ + function contains(obj, needle) { + return some(obj, function(val) { + return (val === needle); + }); + } + return contains; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/deepFillIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/deepFillIn.js new file mode 100644 index 00000000..ee69c3d5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/deepFillIn.js @@ -0,0 +1,32 @@ +define(['./forOwn', '../lang/isPlainObject'], function (forOwn, isPlainObject) { + + /** + * Deeply copy missing properties in the target from the defaults. + */ + function deepFillIn(target, defaults){ + var i = 0, + n = arguments.length, + obj; + + while(++i < n) { + obj = arguments[i]; + if (obj) { + // jshint loopfunc: true + forOwn(obj, function(newValue, key) { + var curValue = target[key]; + if (curValue == null) { + target[key] = newValue; + } else if (isPlainObject(curValue) && + isPlainObject(newValue)) { + deepFillIn(curValue, newValue); + } + }); + } + } + + return target; + } + + return deepFillIn; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/deepMatches.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/deepMatches.js new file mode 100644 index 00000000..2eae6297 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/deepMatches.js @@ -0,0 +1,54 @@ +define(['./forOwn', '../lang/isArray'], function(forOwn, isArray) { + + function containsMatch(array, pattern) { + var i = -1, length = array.length; + while (++i < length) { + if (deepMatches(array[i], pattern)) { + return true; + } + } + + return false; + } + + function matchArray(target, pattern) { + var i = -1, patternLength = pattern.length; + while (++i < patternLength) { + if (!containsMatch(target, pattern[i])) { + return false; + } + } + + return true; + } + + function matchObject(target, pattern) { + var result = true; + forOwn(pattern, function(val, key) { + if (!deepMatches(target[key], val)) { + // Return false to break out of forOwn early + return (result = false); + } + }); + + return result; + } + + /** + * Recursively check if the objects match. + */ + function deepMatches(target, pattern){ + if (target && typeof target === 'object') { + if (isArray(target) && isArray(pattern)) { + return matchArray(target, pattern); + } else { + return matchObject(target, pattern); + } + } else { + return target === pattern; + } + } + + return deepMatches; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/deepMixIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/deepMixIn.js new file mode 100644 index 00000000..1b4178ef --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/deepMixIn.js @@ -0,0 +1,33 @@ +define(['./forOwn', '../lang/isPlainObject'], function (forOwn, isPlainObject) { + + /** + * Mixes objects into the target object, recursively mixing existing child + * objects. + */ + function deepMixIn(target, objects) { + var i = 0, + n = arguments.length, + obj; + + while(++i < n){ + obj = arguments[i]; + if (obj) { + forOwn(obj, copyProp, target); + } + } + + return target; + } + + function copyProp(val, key) { + var existing = this[key]; + if (isPlainObject(val) && isPlainObject(existing)) { + deepMixIn(existing, val); + } else { + this[key] = val; + } + } + + return deepMixIn; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/equals.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/equals.js new file mode 100644 index 00000000..aeb87408 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/equals.js @@ -0,0 +1,30 @@ +define(['./hasOwn', './every', '../lang/isObject', '../lang/is'], function(hasOwn, every, isObject, is) { + + // Makes a function to compare the object values from the specified compare + // operation callback. + function makeCompare(callback) { + return function(value, key) { + return hasOwn(this, key) && callback(value, this[key]); + }; + } + + function checkProperties(value, key) { + return hasOwn(this, key); + } + + /** + * Checks if two objects have the same keys and values. + */ + function equals(a, b, callback) { + callback = callback || is; + + if (!isObject(a) || !isObject(b)) { + return callback(a, b); + } + + return (every(a, makeCompare(callback), b) && + every(b, checkProperties, a)); + } + + return equals; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/every.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/every.js new file mode 100644 index 00000000..52983a5e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/every.js @@ -0,0 +1,22 @@ +define(['./forOwn', '../function/makeIterator_'], function(forOwn, makeIterator) { + + /** + * Object every + */ + function every(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = true; + forOwn(obj, function(val, key) { + // we consider any falsy values as "false" on purpose so shorthand + // syntax can be used to check property existence + if (!callback(val, key, obj)) { + result = false; + return false; // break + } + }); + return result; + } + + return every; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/fillIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/fillIn.js new file mode 100644 index 00000000..363beab2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/fillIn.js @@ -0,0 +1,19 @@ +define(['../array/forEach', '../array/slice', './forOwn'], function (forEach, slice, forOwn) { + + /** + * Copy missing properties in the obj from the defaults. + */ + function fillIn(obj, var_defaults){ + forEach(slice(arguments, 1), function(base){ + forOwn(base, function(val, key){ + if (obj[key] == null) { + obj[key] = val; + } + }); + }); + return obj; + } + + return fillIn; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/filter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/filter.js new file mode 100644 index 00000000..f213b915 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/filter.js @@ -0,0 +1,19 @@ +define(['./forOwn', '../function/makeIterator_'], function(forOwn, makeIterator) { + + /** + * Creates a new object with all the properties where the callback returns + * true. + */ + function filterValues(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var output = {}; + forOwn(obj, function(value, key, obj) { + if (callback(value, key, obj)) { + output[key] = value; + } + }); + + return output; + } + return filterValues; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/find.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/find.js new file mode 100644 index 00000000..47e6b09d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/find.js @@ -0,0 +1,20 @@ +define(['./some', '../function/makeIterator_'], function(some, makeIterator) { + + /** + * Returns first item that matches criteria + */ + function find(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result; + some(obj, function(value, key, obj) { + if (callback(value, key, obj)) { + result = value; + return true; //break + } + }); + return result; + } + + return find; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/forIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/forIn.js new file mode 100644 index 00000000..90f27063 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/forIn.js @@ -0,0 +1,76 @@ +define(['./hasOwn'], function (hasOwn) { + + var _hasDontEnumBug, + _dontEnums; + + function checkDontEnum(){ + _dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + + _hasDontEnumBug = true; + + for (var key in {'toString': null}) { + _hasDontEnumBug = false; + } + } + + /** + * Similar to Array/forEach but works over object properties and fixes Don't + * Enum bug on IE. + * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation + */ + function forIn(obj, fn, thisObj){ + var key, i = 0; + // no need to check if argument is a real object that way we can use + // it for arrays, functions, date, etc. + + //post-pone check till needed + if (_hasDontEnumBug == null) checkDontEnum(); + + for (key in obj) { + if (exec(fn, obj, key, thisObj) === false) { + break; + } + } + + + if (_hasDontEnumBug) { + var ctor = obj.constructor, + isProto = !!ctor && obj === ctor.prototype; + + while (key = _dontEnums[i++]) { + // For constructor, if it is a prototype object the constructor + // is always non-enumerable unless defined otherwise (and + // enumerated above). For non-prototype objects, it will have + // to be defined on this object, since it cannot be defined on + // any prototype objects. + // + // For other [[DontEnum]] properties, check if the value is + // different than Object prototype value. + if ( + (key !== 'constructor' || + (!isProto && hasOwn(obj, key))) && + obj[key] !== Object.prototype[key] + ) { + if (exec(fn, obj, key, thisObj) === false) { + break; + } + } + } + } + } + + function exec(fn, obj, key, thisObj){ + return fn.call(thisObj, obj[key], key, obj); + } + + return forIn; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/forOwn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/forOwn.js new file mode 100644 index 00000000..b40cbaf1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/forOwn.js @@ -0,0 +1,18 @@ +define(['./hasOwn', './forIn'], function (hasOwn, forIn) { + + /** + * Similar to Array/forEach but works over object properties and fixes Don't + * Enum bug on IE. + * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation + */ + function forOwn(obj, fn, thisObj){ + forIn(obj, function(val, key){ + if (hasOwn(obj, key)) { + return fn.call(thisObj, obj[key], key, obj); + } + }); + } + + return forOwn; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/functions.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/functions.js new file mode 100644 index 00000000..60fee3dd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/functions.js @@ -0,0 +1,18 @@ +define(['./forIn'], function (forIn) { + + /** + * return a list of all enumerable properties that have function values + */ + function functions(obj){ + var keys = []; + forIn(obj, function(val, key){ + if (typeof val === 'function'){ + keys.push(key); + } + }); + return keys.sort(); + } + + return functions; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/get.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/get.js new file mode 100644 index 00000000..464c7bce --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/get.js @@ -0,0 +1,20 @@ +define(['../lang/isPrimitive'], function (isPrimitive) { + + /** + * get "nested" object property + */ + function get(obj, prop){ + var parts = prop.split('.'), + last = parts.pop(); + + while (prop = parts.shift()) { + obj = obj[prop]; + if (obj == null) return; + } + + return obj[last]; + } + + return get; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/has.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/has.js new file mode 100644 index 00000000..cc29817f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/has.js @@ -0,0 +1,15 @@ +define(['./get'], function (get) { + + var UNDEF; + + /** + * Check if object has nested property. + */ + function has(obj, prop){ + return get(obj, prop) !== UNDEF; + } + + return has; + +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/hasOwn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/hasOwn.js new file mode 100644 index 00000000..5c53bcf2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/hasOwn.js @@ -0,0 +1,12 @@ +define(function () { + + /** + * Safer Object.hasOwnProperty + */ + function hasOwn(obj, prop){ + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + return hasOwn; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/keys.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/keys.js new file mode 100644 index 00000000..ed7c4f91 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/keys.js @@ -0,0 +1,16 @@ +define(['./forOwn'], function (forOwn) { + + /** + * Get object keys + */ + var keys = Object.keys || function (obj) { + var keys = []; + forOwn(obj, function(val, key){ + keys.push(key); + }); + return keys; + }; + + return keys; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/map.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/map.js new file mode 100644 index 00000000..2958f6b0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/map.js @@ -0,0 +1,17 @@ +define(['./forOwn', '../function/makeIterator_'], function(forOwn, makeIterator) { + + /** + * Creates a new object where all the values are the result of calling + * `callback`. + */ + function mapValues(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var output = {}; + forOwn(obj, function(val, key, obj) { + output[key] = callback(val, key, obj); + }); + + return output; + } + return mapValues; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/matches.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/matches.js new file mode 100644 index 00000000..73ff427c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/matches.js @@ -0,0 +1,20 @@ +define(['./forOwn'], function (forOwn) { + + /** + * checks if a object contains all given properties/values + */ + function matches(target, props){ + // can't use "object/every" because of circular dependency + var result = true; + forOwn(props, function(val, key){ + if (target[key] !== val) { + // break loop at first difference + return (result = false); + } + }); + return result; + } + + return matches; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/max.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/max.js new file mode 100644 index 00000000..ef311dcb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/max.js @@ -0,0 +1,11 @@ +define(['../array/max', './values'], function(arrMax, values) { + + /** + * Returns maximum value inside object. + */ + function max(obj, compareFn) { + return arrMax(values(obj), compareFn); + } + + return max; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/merge.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/merge.js new file mode 100644 index 00000000..d7cfedec --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/merge.js @@ -0,0 +1,38 @@ +define(['./hasOwn', '../lang/deepClone', '../lang/isObject'], function (hasOwn, deepClone, isObject) { + + /** + * Deep merge objects. + */ + function merge() { + var i = 1, + key, val, obj, target; + + // make sure we don't modify source element and it's properties + // objects are passed by reference + target = deepClone( arguments[0] ); + + while (obj = arguments[i++]) { + for (key in obj) { + if ( ! hasOwn(obj, key) ) { + continue; + } + + val = obj[key]; + + if ( isObject(val) && isObject(target[key]) ){ + // inception, deep merge objects + target[key] = merge(target[key], val); + } else { + // make sure arrays, regexp, date, objects are cloned + target[key] = deepClone(val); + } + + } + } + + return target; + } + + return merge; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/min.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/min.js new file mode 100644 index 00000000..9fb4c1a3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/min.js @@ -0,0 +1,11 @@ +define(['../array/min', './values'], function(arrMin, values) { + + /** + * Returns minimum value inside object. + */ + function min(obj, iterator) { + return arrMin(values(obj), iterator); + } + + return min; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/mixIn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/mixIn.js new file mode 100644 index 00000000..6210b7e7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/mixIn.js @@ -0,0 +1,28 @@ +define(['./forOwn'], function(forOwn){ + + /** + * Combine properties from all the objects into first one. + * - This method affects target object in place, if you want to create a new Object pass an empty object as first param. + * @param {object} target Target Object + * @param {...object} objects Objects to be combined (0...n objects). + * @return {object} Target Object. + */ + function mixIn(target, objects){ + var i = 0, + n = arguments.length, + obj; + while(++i < n){ + obj = arguments[i]; + if (obj != null) { + forOwn(obj, copyProp, target); + } + } + return target; + } + + function copyProp(val, key){ + this[key] = val; + } + + return mixIn; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/namespace.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/namespace.js new file mode 100644 index 00000000..7ed65db8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/namespace.js @@ -0,0 +1,19 @@ +define(['../array/forEach'], function (forEach) { + + /** + * Create nested object if non-existent + */ + function namespace(obj, path){ + if (!path) return obj; + forEach(path.split('.'), function(key){ + if (!obj[key]) { + obj[key] = {}; + } + obj = obj[key]; + }); + return obj; + } + + return namespace; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/omit.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/omit.js new file mode 100644 index 00000000..829cc585 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/omit.js @@ -0,0 +1,20 @@ +define(['../array/slice', '../array/contains'], function(slice, contains){ + + /** + * Return a copy of the object, filtered to only contain properties except the blacklisted keys. + */ + function omit(obj, var_keys){ + var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1), + out = {}; + + for (var property in obj) { + if (obj.hasOwnProperty(property) && !contains(keys, property)) { + out[property] = obj[property]; + } + } + return out; + } + + return omit; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/pick.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/pick.js new file mode 100644 index 00000000..9d5e3513 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/pick.js @@ -0,0 +1,18 @@ +define(['../array/slice'], function(slice){ + + /** + * Return a copy of the object, filtered to only have values for the whitelisted keys. + */ + function pick(obj, var_keys){ + var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1), + out = {}, + i = 0, key; + while (key = keys[i++]) { + out[key] = obj[key]; + } + return out; + } + + return pick; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/pluck.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/pluck.js new file mode 100644 index 00000000..d47744bd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/pluck.js @@ -0,0 +1,12 @@ +define(['./map', '../function/prop'], function (map, prop) { + + /** + * Extract a list of property values. + */ + function pluck(obj, propName){ + return map(obj, prop(propName)); + } + + return pluck; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/reduce.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/reduce.js new file mode 100644 index 00000000..d3a57788 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/reduce.js @@ -0,0 +1,28 @@ +define(['./forOwn', './size'], function(forOwn, size) { + + /** + * Object reduce + */ + function reduce(obj, callback, memo, thisObj) { + var initial = arguments.length > 2; + + if (!size(obj) && !initial) { + throw new Error('reduce of empty object with no initial value'); + } + + forOwn(obj, function(value, key, list) { + if (!initial) { + memo = value; + initial = true; + } + else { + memo = callback.call(thisObj, memo, value, key, list); + } + }); + + return memo; + } + + return reduce; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/reject.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/reject.js new file mode 100644 index 00000000..84296428 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/reject.js @@ -0,0 +1,15 @@ +define(['./filter', '../function/makeIterator_'], function (filter, makeIterator) { + + /** + * Object reject + */ + function reject(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + return filter(obj, function(value, index, obj) { + return !callback(value, index, obj); + }, thisObj); + } + + return reject; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/result.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/result.js new file mode 100644 index 00000000..133572d8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/result.js @@ -0,0 +1,14 @@ +define(['../lang/isFunction'], function (isFunction) { + + function result(obj, prop) { + var property = obj[prop]; + + if(property === undefined) { + return; + } + + return isFunction(property) ? property.call(obj) : property; + } + + return result; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/set.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/set.js new file mode 100644 index 00000000..b8fa25a3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/set.js @@ -0,0 +1,17 @@ +define(['./namespace'], function (namespace) { + + /** + * set "nested" object property + */ + function set(obj, prop, val){ + var parts = (/^(.+)\.(.+)$/).exec(prop); + if (parts){ + namespace(obj, parts[1])[parts[2]] = val; + } else { + obj[prop] = val; + } + } + + return set; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/size.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/size.js new file mode 100644 index 00000000..c6e377cf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/size.js @@ -0,0 +1,16 @@ +define(['./forOwn'], function (forOwn) { + + /** + * Get object size + */ + function size(obj) { + var count = 0; + forOwn(obj, function(){ + count++; + }); + return count; + } + + return size; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/some.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/some.js new file mode 100644 index 00000000..1bd6fdae --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/some.js @@ -0,0 +1,20 @@ +define(['./forOwn', '../function/makeIterator_'], function(forOwn, makeIterator) { + + /** + * Object some + */ + function some(obj, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = false; + forOwn(obj, function(val, key) { + if (callback(val, key, obj)) { + result = true; + return false; // break + } + }); + return result; + } + + return some; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/unset.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/unset.js new file mode 100644 index 00000000..787fc19a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/unset.js @@ -0,0 +1,23 @@ +define(['./has'], function (has) { + + /** + * Unset object property. + */ + function unset(obj, prop){ + if (has(obj, prop)) { + var parts = prop.split('.'), + last = parts.pop(); + while (prop = parts.shift()) { + obj = obj[prop]; + } + return (delete obj[last]); + + } else { + // if property doesn't exist treat as deleted + return true; + } + } + + return unset; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/values.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/values.js new file mode 100644 index 00000000..b311fd09 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/object/values.js @@ -0,0 +1,16 @@ +define(['./forOwn'], function (forOwn) { + + /** + * Get object values + */ + function values(obj) { + var vals = []; + forOwn(obj, function(val, key){ + vals.push(val); + }); + return vals; + } + + return values; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString.js new file mode 100644 index 00000000..44346127 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString.js @@ -0,0 +1,15 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'contains' : require('./queryString/contains'), + 'decode' : require('./queryString/decode'), + 'encode' : require('./queryString/encode'), + 'getParam' : require('./queryString/getParam'), + 'getQuery' : require('./queryString/getQuery'), + 'parse' : require('./queryString/parse'), + 'setParam' : require('./queryString/setParam') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/contains.js new file mode 100644 index 00000000..a6d11cce --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/contains.js @@ -0,0 +1,12 @@ +define(['./getQuery'], function (getQuery) { + + /** + * Checks if query string contains parameter. + */ + function contains(url, paramName) { + var regex = new RegExp('(\\?|&)'+ paramName +'=', 'g'); //matches `?param=` or `¶m=` + return regex.test(getQuery(url)); + } + + return contains; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/decode.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/decode.js new file mode 100644 index 00000000..50da3f66 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/decode.js @@ -0,0 +1,35 @@ +define(['../string/typecast', '../lang/isString', '../lang/isArray', '../object/hasOwn'], function (typecast, isString, isArray, hasOwn) { + + /** + * Decode query string into an object of keys => vals. + */ + function decode(queryStr, shouldTypecast) { + var queryArr = (queryStr || '').replace('?', '').split('&'), + count = -1, + length = queryArr.length, + obj = {}, + item, pValue, pName, toSet; + + while (++count < length) { + item = queryArr[count].split('='); + pName = item[0]; + if (!pName || !pName.length){ + continue; + } + pValue = shouldTypecast === false ? item[1] : typecast(item[1]); + toSet = isString(pValue) ? decodeURIComponent(pValue) : pValue; + if (hasOwn(obj,pName)){ + if(isArray(obj[pName])){ + obj[pName].push(toSet); + } else { + obj[pName] = [obj[pName],toSet]; + } + } else { + obj[pName] = toSet; + } + } + return obj; + } + + return decode; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/encode.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/encode.js new file mode 100644 index 00000000..c249287a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/encode.js @@ -0,0 +1,25 @@ +define(['../object/forOwn','../lang/isArray','../array/forEach'], function (forOwn,isArray,forEach) { + + /** + * Encode object into a query string. + */ + function encode(obj){ + var query = [], + arrValues, reg; + forOwn(obj, function (val, key) { + if (isArray(val)) { + arrValues = key + '='; + reg = new RegExp('&'+key+'+=$'); + forEach(val, function (aValue) { + arrValues += encodeURIComponent(aValue) + '&' + key + '='; + }); + query.push(arrValues.replace(reg, '')); + } else { + query.push(key + '=' + encodeURIComponent(val)); + } + }); + return (query.length) ? '?' + query.join('&') : ''; + } + + return encode; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/getParam.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/getParam.js new file mode 100644 index 00000000..d9813724 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/getParam.js @@ -0,0 +1,14 @@ +define(['../string/typecast', './getQuery'], function (typecast, getQuery) { + + /** + * Get query parameter value. + */ + function getParam(url, param, shouldTypecast){ + var regexp = new RegExp('(\\?|&)'+ param + '=([^&]*)'), //matches `?param=value` or `¶m=value`, value = $2 + result = regexp.exec( getQuery(url) ), + val = (result && result[2])? result[2] : null; + return shouldTypecast === false? val : typecast(val); + } + + return getParam; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/getQuery.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/getQuery.js new file mode 100644 index 00000000..aa3d99f3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/getQuery.js @@ -0,0 +1,13 @@ +define(function () { + + /** + * Gets full query as string with all special chars decoded. + */ + function getQuery(url) { + url = url.replace(/#.*/, ''); //removes hash (to avoid getting hash query) + var queryString = /\?[a-zA-Z0-9\=\&\%\$\-\_\.\+\!\*\'\(\)\,]+/.exec(url); //valid chars according to: http://www.ietf.org/rfc/rfc1738.txt + return (queryString)? decodeURIComponent(queryString[0]) : ''; + } + + return getQuery; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/parse.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/parse.js new file mode 100644 index 00000000..ac153e3f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/parse.js @@ -0,0 +1,12 @@ +define(['./decode', './getQuery'], function (decode, getQuery) { + + /** + * Get query string, parses and decodes it. + */ + function parse(url, shouldTypecast) { + return decode(getQuery(url), shouldTypecast); + } + + return parse; +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/setParam.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/setParam.js new file mode 100644 index 00000000..97081aa7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/queryString/setParam.js @@ -0,0 +1,28 @@ +define(function () { + + /** + * Set query string parameter value + */ + function setParam(url, paramName, value){ + url = url || ''; + + var re = new RegExp('(\\?|&)'+ paramName +'=[^&]*' ); + var param = paramName +'='+ encodeURIComponent( value ); + + if ( re.test(url) ) { + return url.replace(re, '$1'+ param); + } else { + if (url.indexOf('?') === -1) { + url += '?'; + } + if (url.indexOf('=') !== -1) { + url += '&'; + } + return url + param; + } + + } + + return setParam; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random.js new file mode 100644 index 00000000..b47f2035 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random.js @@ -0,0 +1,18 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'choice' : require('./random/choice'), + 'guid' : require('./random/guid'), + 'rand' : require('./random/rand'), + 'randBit' : require('./random/randBit'), + 'randBool' : require('./random/randBool'), + 'randHex' : require('./random/randHex'), + 'randInt' : require('./random/randInt'), + 'randSign' : require('./random/randSign'), + 'randString' : require('./random/randString'), + 'random' : require('./random/random') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/choice.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/choice.js new file mode 100644 index 00000000..0d0c38df --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/choice.js @@ -0,0 +1,14 @@ +define(['./randInt', '../lang/isArray'], function (randInt, isArray) { + + /** + * Returns a random element from the supplied arguments + * or from the array (if single argument is an array). + */ + function choice(items) { + var target = (arguments.length === 1 && isArray(items))? items : arguments; + return target[ randInt(0, target.length - 1) ]; + } + + return choice; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/guid.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/guid.js new file mode 100644 index 00000000..82f3a2db --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/guid.js @@ -0,0 +1,23 @@ +define(['./randHex', './choice'], function (randHex, choice) { + + /** + * Returns pseudo-random guid (UUID v4) + * IMPORTANT: it's not totally "safe" since randHex/choice uses Math.random + * by default and sequences can be predicted in some cases. See the + * "random/random" documentation for more info about it and how to replace + * the default PRNG. + */ + function guid() { + return ( + randHex(8)+'-'+ + randHex(4)+'-'+ + // v4 UUID always contain "4" at this position to specify it was + // randomly generated + '4' + randHex(3) +'-'+ + // v4 UUID always contain chars [a,b,8,9] at this position + choice(8, 9, 'a', 'b') + randHex(3)+'-'+ + randHex(12) + ); + } + return guid; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/rand.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/rand.js new file mode 100644 index 00000000..b8c231dd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/rand.js @@ -0,0 +1,13 @@ +define(['./random', '../number/MIN_INT', '../number/MAX_INT'], function(random, MIN_INT, MAX_INT){ + + /** + * Returns random number inside range + */ + function rand(min, max){ + min = min == null? MIN_INT : min; + max = max == null? MAX_INT : max; + return min + (max - min) * random(); + } + + return rand; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randBit.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randBit.js new file mode 100644 index 00000000..398fa2c6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randBit.js @@ -0,0 +1,11 @@ +define(['./randBool'], function (randBool) { + + /** + * Returns random bit (0 or 1) + */ + function randomBit() { + return randBool()? 1 : 0; + } + + return randomBit; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randBool.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randBool.js new file mode 100644 index 00000000..8d9be0b8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randBool.js @@ -0,0 +1,12 @@ +define(['./random'], function (random) { + + /** + * returns a random boolean value (true or false) + */ + function randBool(){ + return random() >= 0.5; + } + + return randBool; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randHex.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randHex.js new file mode 100644 index 00000000..6e9bf1c5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randHex.js @@ -0,0 +1,19 @@ +define(['./choice'], function (choice) { + + var _chars = '0123456789abcdef'.split(''); + + /** + * Returns a random hexadecimal string + */ + function randHex(size){ + size = size && size > 0? size : 6; + var str = ''; + while (size--) { + str += choice(_chars); + } + return str; + } + + return randHex; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randInt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randInt.js new file mode 100644 index 00000000..1750e9de --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randInt.js @@ -0,0 +1,16 @@ +define(['../number/MIN_INT', '../number/MAX_INT', './rand'], function(MIN_INT, MAX_INT, rand){ + + /** + * Gets random integer inside range or snap to min/max values. + */ + function randInt(min, max){ + min = min == null? MIN_INT : ~~min; + max = max == null? MAX_INT : ~~max; + // can't be max + 0.5 otherwise it will round up if `rand` + // returns `max` causing it to overflow range. + // -0.5 and + 0.49 are required to avoid bias caused by rounding + return Math.round( rand(min - 0.5, max + 0.499999999999) ); + } + + return randInt; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randSign.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randSign.js new file mode 100644 index 00000000..1171b406 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randSign.js @@ -0,0 +1,11 @@ +define(['./randBool'], function (randBool) { + + /** + * Returns random sign (-1 or 1) + */ + function randomSign() { + return randBool()? 1 : -1; + } + + return randomSign; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randString.js new file mode 100644 index 00000000..d309d08f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/randString.js @@ -0,0 +1,29 @@ +define([ + '../lang/isNumber', + '../lang/isString', + './randInt' +], function (isNumber, isString, randInt) { + + var defaultDictionary = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + function randomString(length, dictionary) { + if(!isNumber(length) || length <= 0) { + length = 8; + } + + if(!isString(dictionary) || dictionary.length < 1) { + dictionary = defaultDictionary; + } + + var result = '', + domain = dictionary.length - 1; + + while(length--) { + result += dictionary[randInt(0, domain)]; + } + + return result; + } + + return randomString; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/random.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/random.js new file mode 100644 index 00000000..4270822e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/random/random.js @@ -0,0 +1,18 @@ +define(function () { + + /** + * Just a wrapper to Math.random. No methods inside mout/random should call + * Math.random() directly so we can inject the pseudo-random number + * generator if needed (ie. in case we need a seeded random or a better + * algorithm than the native one) + */ + function random(){ + return random.get(); + } + + // we expose the method so it can be swapped if needed + random.get = Math.random; + + return random; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string.js new file mode 100644 index 00000000..a157e4cc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string.js @@ -0,0 +1,46 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'WHITE_SPACES' : require('./string/WHITE_SPACES'), + 'camelCase' : require('./string/camelCase'), + 'contains' : require('./string/contains'), + 'crop' : require('./string/crop'), + 'endsWith' : require('./string/endsWith'), + 'escapeHtml' : require('./string/escapeHtml'), + 'escapeRegExp' : require('./string/escapeRegExp'), + 'escapeUnicode' : require('./string/escapeUnicode'), + 'hyphenate' : require('./string/hyphenate'), + 'insert' : require('./string/insert'), + 'interpolate' : require('./string/interpolate'), + 'lowerCase' : require('./string/lowerCase'), + 'lpad' : require('./string/lpad'), + 'ltrim' : require('./string/ltrim'), + 'makePath' : require('./string/makePath'), + 'normalizeLineBreaks' : require('./string/normalizeLineBreaks'), + 'pascalCase' : require('./string/pascalCase'), + 'properCase' : require('./string/properCase'), + 'removeNonASCII' : require('./string/removeNonASCII'), + 'removeNonWord' : require('./string/removeNonWord'), + 'repeat' : require('./string/repeat'), + 'replace' : require('./string/replace'), + 'replaceAccents' : require('./string/replaceAccents'), + 'rpad' : require('./string/rpad'), + 'rtrim' : require('./string/rtrim'), + 'sentenceCase' : require('./string/sentenceCase'), + 'slugify' : require('./string/slugify'), + 'startsWith' : require('./string/startsWith'), + 'stripHtmlTags' : require('./string/stripHtmlTags'), + 'trim' : require('./string/trim'), + 'truncate' : require('./string/truncate'), + 'typecast' : require('./string/typecast'), + 'unCamelCase' : require('./string/unCamelCase'), + 'underscore' : require('./string/underscore'), + 'unescapeHtml' : require('./string/unescapeHtml'), + 'unescapeUnicode' : require('./string/unescapeUnicode'), + 'unhyphenate' : require('./string/unhyphenate'), + 'upperCase' : require('./string/upperCase') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/WHITE_SPACES.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/WHITE_SPACES.js new file mode 100644 index 00000000..e830d86d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/WHITE_SPACES.js @@ -0,0 +1,12 @@ +define(function() { + /** + * Contains all Unicode white-spaces. Taken from + * http://en.wikipedia.org/wiki/Whitespace_character. + */ + return [ + ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E', + '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', + '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', + '\u205F', '\u3000' + ]; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/camelCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/camelCase.js new file mode 100644 index 00000000..02e6c04d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/camelCase.js @@ -0,0 +1,16 @@ +define(['../lang/toString', './replaceAccents', './removeNonWord', './upperCase', './lowerCase'], function(toString, replaceAccents, removeNonWord, upperCase, lowerCase){ + /** + * Convert string to camelCase text. + */ + function camelCase(str){ + str = toString(str); + str = replaceAccents(str); + str = removeNonWord(str) + .replace(/[\-_]/g, ' ') //convert all hyphens and underscores to spaces + .replace(/\s[a-z]/g, upperCase) //convert first char of each word to UPPERCASE + .replace(/\s+/g, '') //remove spaces + .replace(/^[A-Z]/g, lowerCase); //convert first char to lowercase + return str; + } + return camelCase; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/contains.js new file mode 100644 index 00000000..825b5a5f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/contains.js @@ -0,0 +1,14 @@ +define(['../lang/toString'], function(toString) { + + /** + * Searches for a given substring + */ + function contains(str, substring, fromIndex){ + str = toString(str); + substring = toString(substring); + return str.indexOf(substring, fromIndex) !== -1; + } + + return contains; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/crop.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/crop.js new file mode 100644 index 00000000..3c073f05 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/crop.js @@ -0,0 +1,11 @@ +define(['../lang/toString', './truncate'], function (toString, truncate) { + /** + * Truncate string at full words. + */ + function crop(str, maxChars, append) { + str = toString(str); + return truncate(str, maxChars, append, true); + } + + return crop; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/endsWith.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/endsWith.js new file mode 100644 index 00000000..31a73f20 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/endsWith.js @@ -0,0 +1,13 @@ +define(['../lang/toString'], function(toString) { + /** + * Checks if string ends with specified suffix. + */ + function endsWith(str, suffix) { + str = toString(str); + suffix = toString(suffix); + + return str.indexOf(suffix, str.length - suffix.length) !== -1; + } + + return endsWith; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/escapeHtml.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/escapeHtml.js new file mode 100644 index 00000000..de34b61b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/escapeHtml.js @@ -0,0 +1,18 @@ +define(['../lang/toString'], function(toString) { + + /** + * Escapes a string for insertion into HTML. + */ + function escapeHtml(str){ + str = toString(str) + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/'/g, ''') + .replace(/"/g, '"'); + return str; + } + + return escapeHtml; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/escapeRegExp.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/escapeRegExp.js new file mode 100644 index 00000000..862655bf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/escapeRegExp.js @@ -0,0 +1,12 @@ +define(['../lang/toString'], function(toString) { + + /** + * Escape RegExp string chars. + */ + function escapeRegExp(str) { + return toString(str).replace(/\W/g,'\\$&'); + } + + return escapeRegExp; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/escapeUnicode.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/escapeUnicode.js new file mode 100644 index 00000000..bd5e8c4c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/escapeUnicode.js @@ -0,0 +1,21 @@ +define(['../lang/toString'], function(toString) { + + /** + * Escape string into unicode sequences + */ + function escapeUnicode(str, shouldEscapePrintable){ + str = toString(str); + return str.replace(/[\s\S]/g, function(ch){ + // skip printable ASCII chars if we should not escape them + if (!shouldEscapePrintable && (/[\x20-\x7E]/).test(ch)) { + return ch; + } + // we use "000" and slice(-4) for brevity, need to pad zeros, + // unicode escape always have 4 chars after "\u" + return '\\u'+ ('000'+ ch.charCodeAt(0).toString(16)).slice(-4); + }); + } + + return escapeUnicode; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/hyphenate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/hyphenate.js new file mode 100644 index 00000000..679c405c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/hyphenate.js @@ -0,0 +1,12 @@ +define(['../lang/toString', './slugify', './unCamelCase'], function(toString, slugify, unCamelCase){ + /** + * Replaces spaces with hyphens, split camelCase text, remove non-word chars, remove accents and convert to lower case. + */ + function hyphenate(str){ + str = toString(str); + str = unCamelCase(str); + return slugify(str, "-"); + } + + return hyphenate; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/insert.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/insert.js new file mode 100644 index 00000000..79c45be7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/insert.js @@ -0,0 +1,20 @@ +define(['../math/clamp', '../lang/toString'], function (clamp, toString) { + + /** + * Inserts a string at a given index. + */ + function insert(string, index, partial){ + string = toString(string); + + if (index < 0) { + index = string.length + index; + } + + index = clamp(index, 0, string.length); + + return string.substr(0, index) + partial + string.substr(index); + } + + return insert; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/interpolate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/interpolate.js new file mode 100644 index 00000000..b5e7f4b8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/interpolate.js @@ -0,0 +1,21 @@ +define([ + '../lang/toString', + '../object/get' +], function(toString, get) { + + var stache = /\{\{([^\}]+)\}\}/g; //mustache-like + + /** + * String interpolation + */ + function interpolate(template, replacements, syntax){ + template = toString(template); + var replaceFn = function(match, prop){ + return toString( get(replacements, prop) ); + }; + return template.replace(syntax || stache, replaceFn); + } + + return interpolate; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/lowerCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/lowerCase.js new file mode 100644 index 00000000..b045d69c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/lowerCase.js @@ -0,0 +1,11 @@ +define(['../lang/toString'], function(toString){ + /** + * "Safer" String.toLowerCase() + */ + function lowerCase(str){ + str = toString(str); + return str.toLowerCase(); + } + + return lowerCase; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/lpad.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/lpad.js new file mode 100644 index 00000000..134b4150 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/lpad.js @@ -0,0 +1,16 @@ +define(['../lang/toString', './repeat'], function(toString, repeat) { + + /** + * Pad string with `char` if its' length is smaller than `minLen` + */ + function lpad(str, minLen, ch) { + str = toString(str); + ch = ch || ' '; + + return (str.length < minLen) ? + repeat(ch, minLen - str.length) + str : str; + } + + return lpad; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/ltrim.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/ltrim.js new file mode 100644 index 00000000..477df953 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/ltrim.js @@ -0,0 +1,33 @@ +define(['../lang/toString', './WHITE_SPACES'], function(toString, WHITE_SPACES){ + /** + * Remove chars from beginning of string. + */ + function ltrim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + + var start = 0, + len = str.length, + charLen = chars.length, + found = true, + i, c; + + while (found && start < len) { + found = false; + i = -1; + c = str.charAt(start); + + while (++i < charLen) { + if (c === chars[i]) { + found = true; + start++; + break; + } + } + } + + return (start >= len) ? '' : str.substr(start, len); + } + + return ltrim; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/makePath.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/makePath.js new file mode 100644 index 00000000..3a6869e3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/makePath.js @@ -0,0 +1,14 @@ +define(['../array/join', '../array/slice'], function(join, slice){ + + /** + * Group arguments as path segments, if any of the args is `null` or an + * empty string it will be ignored from resulting path. + */ + function makePath(var_args){ + var result = join(slice(arguments), '/'); + // need to disconsider duplicate '/' after protocol (eg: 'http://') + return result.replace(/([^:\/]|^)\/{2,}/g, '$1/'); + } + + return makePath; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/normalizeLineBreaks.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/normalizeLineBreaks.js new file mode 100644 index 00000000..44e4194f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/normalizeLineBreaks.js @@ -0,0 +1,18 @@ +define(['../lang/toString'], function (toString) { + + /** + * Convert line-breaks from DOS/MAC to a single standard (UNIX by default) + */ + function normalizeLineBreaks(str, lineEnd) { + str = toString(str); + lineEnd = lineEnd || '\n'; + + return str + .replace(/\r\n/g, lineEnd) // DOS + .replace(/\r/g, lineEnd) // Mac + .replace(/\n/g, lineEnd); // Unix + } + + return normalizeLineBreaks; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/pascalCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/pascalCase.js new file mode 100644 index 00000000..ead9ead4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/pascalCase.js @@ -0,0 +1,11 @@ +define(['../lang/toString', './camelCase', './upperCase'], function(toString, camelCase, upperCase){ + /** + * camelCase + UPPERCASE first char + */ + function pascalCase(str){ + str = toString(str); + return camelCase(str).replace(/^[a-z]/, upperCase); + } + + return pascalCase; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/properCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/properCase.js new file mode 100644 index 00000000..2987b507 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/properCase.js @@ -0,0 +1,11 @@ +define(['../lang/toString', './lowerCase', './upperCase'], function(toString, lowerCase, upperCase){ + /** + * UPPERCASE first char of each word. + */ + function properCase(str){ + str = toString(str); + return lowerCase(str).replace(/^\w|\s\w/g, upperCase); + } + + return properCase; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/removeNonASCII.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/removeNonASCII.js new file mode 100644 index 00000000..4905869d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/removeNonASCII.js @@ -0,0 +1,14 @@ +define(['../lang/toString'], function(toString){ + /** + * Remove non-printable ASCII chars + */ + function removeNonASCII(str){ + str = toString(str); + + // Matches non-printable ASCII chars - + // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters + return str.replace(/[^\x20-\x7E]/g, ''); + } + + return removeNonASCII; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/removeNonWord.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/removeNonWord.js new file mode 100644 index 00000000..fb737d77 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/removeNonWord.js @@ -0,0 +1,14 @@ +define(['../lang/toString'], function(toString){ + // This pattern is generated by the _build/pattern-removeNonWord.js script + var PATTERN = /[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g; + + /** + * Remove non-word chars. + */ + function removeNonWord(str){ + str = toString(str); + return str.replace(PATTERN, ''); + } + + return removeNonWord; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/repeat.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/repeat.js new file mode 100644 index 00000000..0a25d836 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/repeat.js @@ -0,0 +1,25 @@ +define(['../lang/toString', '../number/toInt'], function(toString, toInt){ + + /** + * Repeat string n times + */ + function repeat(str, n){ + var result = ''; + str = toString(str); + n = toInt(n); + if (n < 1) { + return ''; + } + while (n > 0) { + if (n % 2) { + result += str; + } + n = Math.floor(n / 2); + str += str; + } + return result; + } + + return repeat; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/replace.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/replace.js new file mode 100644 index 00000000..8b762fdc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/replace.js @@ -0,0 +1,32 @@ +define(['../lang/toString', '../lang/toArray'], function (toString, toArray) { + + /** + * Replace string(s) with the replacement(s) in the source. + */ + function replace(str, search, replacements) { + str = toString(str); + search = toArray(search); + replacements = toArray(replacements); + + var searchLength = search.length, + replacementsLength = replacements.length; + + if (replacementsLength !== 1 && searchLength !== replacementsLength) { + throw new Error('Unequal number of searches and replacements'); + } + + var i = -1; + while (++i < searchLength) { + // Use the first replacement for all searches if only one + // replacement is provided + str = str.replace( + search[i], + replacements[(replacementsLength === 1) ? 0 : i]); + } + + return str; + } + + return replace; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/replaceAccents.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/replaceAccents.js new file mode 100644 index 00000000..3a63f55a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/replaceAccents.js @@ -0,0 +1,36 @@ +define(['../lang/toString'], function(toString){ + /** + * Replaces all accented chars with regular ones + */ + function replaceAccents(str){ + str = toString(str); + + // verifies if the String has accents and replace them + if (str.search(/[\xC0-\xFF]/g) > -1) { + str = str + .replace(/[\xC0-\xC5]/g, "A") + .replace(/[\xC6]/g, "AE") + .replace(/[\xC7]/g, "C") + .replace(/[\xC8-\xCB]/g, "E") + .replace(/[\xCC-\xCF]/g, "I") + .replace(/[\xD0]/g, "D") + .replace(/[\xD1]/g, "N") + .replace(/[\xD2-\xD6\xD8]/g, "O") + .replace(/[\xD9-\xDC]/g, "U") + .replace(/[\xDD]/g, "Y") + .replace(/[\xDE]/g, "P") + .replace(/[\xE0-\xE5]/g, "a") + .replace(/[\xE6]/g, "ae") + .replace(/[\xE7]/g, "c") + .replace(/[\xE8-\xEB]/g, "e") + .replace(/[\xEC-\xEF]/g, "i") + .replace(/[\xF1]/g, "n") + .replace(/[\xF2-\xF6\xF8]/g, "o") + .replace(/[\xF9-\xFC]/g, "u") + .replace(/[\xFE]/g, "p") + .replace(/[\xFD\xFF]/g, "y"); + } + return str; + } + return replaceAccents; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/rpad.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/rpad.js new file mode 100644 index 00000000..2efd9c88 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/rpad.js @@ -0,0 +1,14 @@ +define(['../lang/toString', './repeat'], function (toString, repeat) { + + /** + * Pad string with `char` if its' length is smaller than `minLen` + */ + function rpad(str, minLen, ch) { + str = toString(str); + ch = ch || ' '; + return (str.length < minLen)? str + repeat(ch, minLen - str.length) : str; + } + + return rpad; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/rtrim.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/rtrim.js new file mode 100644 index 00000000..a4cc282d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/rtrim.js @@ -0,0 +1,32 @@ +define(['../lang/toString', './WHITE_SPACES'], function(toString, WHITE_SPACES){ + /** + * Remove chars from end of string. + */ + function rtrim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + + var end = str.length - 1, + charLen = chars.length, + found = true, + i, c; + + while (found && end >= 0) { + found = false; + i = -1; + c = str.charAt(end); + + while (++i < charLen) { + if (c === chars[i]) { + found = true; + end--; + break; + } + } + } + + return (end >= 0) ? str.substring(0, end + 1) : ''; + } + + return rtrim; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/sentenceCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/sentenceCase.js new file mode 100644 index 00000000..cfe45af5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/sentenceCase.js @@ -0,0 +1,13 @@ +define(['../lang/toString', './lowerCase', './upperCase'], function(toString, lowerCase, upperCase){ + /** + * UPPERCASE first char of each sentence and lowercase other chars. + */ + function sentenceCase(str){ + str = toString(str); + + // Replace first char of each sentence (new line or after '.\s+') to + // UPPERCASE + return lowerCase(str).replace(/(^\w)|\.\s+(\w)/gm, upperCase); + } + return sentenceCase; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/slugify.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/slugify.js new file mode 100644 index 00000000..c6d68c7e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/slugify.js @@ -0,0 +1,21 @@ +define(['../lang/toString', './replaceAccents', './removeNonWord', './trim'], function(toString, replaceAccents, removeNonWord, trim){ + /** + * Convert to lower case, remove accents, remove non-word chars and + * replace spaces with the specified delimeter. + * Does not split camelCase text. + */ + function slugify(str, delimeter){ + str = toString(str); + + if (delimeter == null) { + delimeter = "-"; + } + str = replaceAccents(str); + str = removeNonWord(str); + str = trim(str) //should come after removeNonWord + .replace(/ +/g, delimeter) //replace spaces with delimeter + .toLowerCase(); + return str; + } + return slugify; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/startsWith.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/startsWith.js new file mode 100644 index 00000000..88ae5453 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/startsWith.js @@ -0,0 +1,13 @@ +define(['../lang/toString'], function (toString) { + /** + * Checks if string starts with specified prefix. + */ + function startsWith(str, prefix) { + str = toString(str); + prefix = toString(prefix); + + return str.indexOf(prefix) === 0; + } + + return startsWith; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/stripHtmlTags.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/stripHtmlTags.js new file mode 100644 index 00000000..e8da956d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/stripHtmlTags.js @@ -0,0 +1,11 @@ +define(['../lang/toString'], function(toString){ + /** + * Remove HTML tags from string. + */ + function stripHtmlTags(str){ + str = toString(str); + + return str.replace(/<[^>]*>/g, ''); + } + return stripHtmlTags; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/trim.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/trim.js new file mode 100644 index 00000000..55526041 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/trim.js @@ -0,0 +1,12 @@ +define(['../lang/toString', './WHITE_SPACES', './ltrim', './rtrim'], function(toString, WHITE_SPACES, ltrim, rtrim){ + /** + * Remove white-spaces from beginning and end of string. + */ + function trim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + return ltrim(rtrim(str, chars), chars); + } + + return trim; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/truncate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/truncate.js new file mode 100644 index 00000000..34000d9f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/truncate.js @@ -0,0 +1,20 @@ +define(['../lang/toString', './trim'], function(toString, trim){ + /** + * Limit number of chars. + */ + function truncate(str, maxChars, append, onlyFullWords){ + str = toString(str); + append = append || '...'; + maxChars = onlyFullWords? maxChars + 1 : maxChars; + + str = trim(str); + if(str.length <= maxChars){ + return str; + } + str = str.substr(0, maxChars - append.length); + //crop at last space or remove trailing whitespace + str = onlyFullWords? str.substr(0, str.lastIndexOf(' ')) : trim(str); + return str + append; + } + return truncate; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/typecast.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/typecast.js new file mode 100644 index 00000000..a7c83153 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/typecast.js @@ -0,0 +1,29 @@ +define(function () { + + var UNDEF; + + /** + * Parses string and convert it into a native value. + */ + function typecast(val) { + var r; + if ( val === null || val === 'null' ) { + r = null; + } else if ( val === 'true' ) { + r = true; + } else if ( val === 'false' ) { + r = false; + } else if ( val === UNDEF || val === 'undefined' ) { + r = UNDEF; + } else if ( val === '' || isNaN(val) ) { + //isNaN('') returns false + r = val; + } else { + //parseFloat(null || '') returns NaN + r = parseFloat(val); + } + return r; + } + + return typecast; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unCamelCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unCamelCase.js new file mode 100644 index 00000000..eeef39b6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unCamelCase.js @@ -0,0 +1,23 @@ +define(['../lang/toString'], function(toString){ + + var CAMEL_CASE_BORDER = /([a-z\xE0-\xFF])([A-Z\xC0\xDF])/g; + + /** + * Add space between camelCase text. + */ + function unCamelCase(str, delimiter){ + if (delimiter == null) { + delimiter = ' '; + } + + function join(str, c1, c2) { + return c1 + delimiter + c2; + } + + str = toString(str); + str = str.replace(CAMEL_CASE_BORDER, join); + str = str.toLowerCase(); //add space between camelCase text + return str; + } + return unCamelCase; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/underscore.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/underscore.js new file mode 100644 index 00000000..75dd4649 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/underscore.js @@ -0,0 +1,11 @@ +define(['../lang/toString', './slugify', './unCamelCase'], function(toString, slugify, unCamelCase){ + /** + * Replaces spaces with underscores, split camelCase text, remove non-word chars, remove accents and convert to lower case. + */ + function underscore(str){ + str = toString(str); + str = unCamelCase(str); + return slugify(str, "_"); + } + return underscore; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unescapeHtml.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unescapeHtml.js new file mode 100644 index 00000000..ca890423 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unescapeHtml.js @@ -0,0 +1,18 @@ +define(['../lang/toString'], function (toString) { + + /** + * Unescapes HTML special chars + */ + function unescapeHtml(str){ + str = toString(str) + .replace(/&/g , '&') + .replace(/</g , '<') + .replace(/>/g , '>') + .replace(/�*39;/g , "'") + .replace(/"/g, '"'); + return str; + } + + return unescapeHtml; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unescapeUnicode.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unescapeUnicode.js new file mode 100644 index 00000000..d4a7ba1d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unescapeUnicode.js @@ -0,0 +1,16 @@ +define(['../lang/toString'], function(toString) { + + /** + * Unescape unicode char sequences + */ + function unescapeUnicode(str){ + str = toString(str); + return str.replace(/\\u[0-9a-f]{4}/g, function(ch){ + var code = parseInt(ch.slice(2), 16); + return String.fromCharCode(code); + }); + } + + return unescapeUnicode; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unhyphenate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unhyphenate.js new file mode 100644 index 00000000..6ac2fa4c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/unhyphenate.js @@ -0,0 +1,10 @@ +define(['../lang/toString'], function(toString){ + /** + * Replaces hyphens with spaces. (only hyphens between word chars) + */ + function unhyphenate(str){ + str = toString(str); + return str.replace(/(\w)(-)(\w)/g, '$1 $3'); + } + return unhyphenate; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/upperCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/upperCase.js new file mode 100644 index 00000000..8b2073e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/string/upperCase.js @@ -0,0 +1,10 @@ +define(['../lang/toString'], function(toString){ + /** + * "Safer" String.toUpperCase() + */ + function upperCase(str){ + str = toString(str); + return str.toUpperCase(); + } + return upperCase; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time.js new file mode 100644 index 00000000..67c90685 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time.js @@ -0,0 +1,12 @@ +define(function(require){ + +//automatically generated, do not edit! +//run `node build` instead +return { + 'convert' : require('./time/convert'), + 'now' : require('./time/now'), + 'parseMs' : require('./time/parseMs'), + 'toTimeString' : require('./time/toTimeString') +}; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/convert.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/convert.js new file mode 100644 index 00000000..2de0cf2e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/convert.js @@ -0,0 +1,41 @@ +define(function () { + + /** + * convert time into another unit + */ + function convert(val, sourceUnitName, destinationUnitName){ + destinationUnitName = destinationUnitName || 'ms'; + return (val * getUnit(sourceUnitName)) / getUnit(destinationUnitName); + } + + + //TODO: maybe extract to a separate module + function getUnit(unitName){ + switch(unitName){ + case 'ms': + case 'millisecond': + return 1; + case 's': + case 'second': + return 1000; + case 'm': + case 'minute': + return 60000; + case 'h': + case 'hour': + return 3600000; + case 'd': + case 'day': + return 86400000; + case 'w': + case 'week': + return 604800000; + default: + throw new Error('"'+ unitName + '" is not a valid unit'); + } + } + + + return convert; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/now.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/now.js new file mode 100644 index 00000000..4b2d03ca --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/now.js @@ -0,0 +1,18 @@ +define(function () { + + /** + * Get current time in miliseconds + */ + function now(){ + // yes, we defer the work to another function to allow mocking it + // during the tests + return now.get(); + } + + now.get = (typeof Date.now === 'function')? Date.now : function(){ + return +(new Date()); + }; + + return now; + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/parseMs.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/parseMs.js new file mode 100644 index 00000000..964929ae --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/parseMs.js @@ -0,0 +1,17 @@ +define(['../math/countSteps'], function(countSteps){ + + /** + * Parse timestamp into an object. + */ + function parseMs(ms){ + return { + milliseconds : countSteps(ms, 1, 1000), + seconds : countSteps(ms, 1000, 60), + minutes : countSteps(ms, 60000, 60), + hours : countSteps(ms, 3600000, 24), + days : countSteps(ms, 86400000) + }; + } + + return parseMs; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/toTimeString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/toTimeString.js new file mode 100644 index 00000000..edf18218 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/src/time/toTimeString.js @@ -0,0 +1,23 @@ +define(['../math/countSteps', '../number/pad'], function(countSteps, pad){ + + var HOUR = 3600000, + MINUTE = 60000, + SECOND = 1000; + + /** + * Format timestamp into a time string. + */ + function toTimeString(ms){ + var h = ms < HOUR ? 0 : countSteps(ms, HOUR), + m = ms < MINUTE ? 0 : countSteps(ms, MINUTE, 60), + s = ms < SECOND ? 0 : countSteps(ms, SECOND, 60), + str = ''; + + str += h? h + ':' : ''; + str += pad(m, 2) + ':'; + str += pad(s, 2); + + return str; + } + return toTimeString; +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string.js new file mode 100644 index 00000000..6115811a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string.js @@ -0,0 +1,46 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'WHITE_SPACES' : require('./string/WHITE_SPACES'), + 'camelCase' : require('./string/camelCase'), + 'contains' : require('./string/contains'), + 'crop' : require('./string/crop'), + 'endsWith' : require('./string/endsWith'), + 'escapeHtml' : require('./string/escapeHtml'), + 'escapeRegExp' : require('./string/escapeRegExp'), + 'escapeUnicode' : require('./string/escapeUnicode'), + 'hyphenate' : require('./string/hyphenate'), + 'insert' : require('./string/insert'), + 'interpolate' : require('./string/interpolate'), + 'lowerCase' : require('./string/lowerCase'), + 'lpad' : require('./string/lpad'), + 'ltrim' : require('./string/ltrim'), + 'makePath' : require('./string/makePath'), + 'normalizeLineBreaks' : require('./string/normalizeLineBreaks'), + 'pascalCase' : require('./string/pascalCase'), + 'properCase' : require('./string/properCase'), + 'removeNonASCII' : require('./string/removeNonASCII'), + 'removeNonWord' : require('./string/removeNonWord'), + 'repeat' : require('./string/repeat'), + 'replace' : require('./string/replace'), + 'replaceAccents' : require('./string/replaceAccents'), + 'rpad' : require('./string/rpad'), + 'rtrim' : require('./string/rtrim'), + 'sentenceCase' : require('./string/sentenceCase'), + 'slugify' : require('./string/slugify'), + 'startsWith' : require('./string/startsWith'), + 'stripHtmlTags' : require('./string/stripHtmlTags'), + 'trim' : require('./string/trim'), + 'truncate' : require('./string/truncate'), + 'typecast' : require('./string/typecast'), + 'unCamelCase' : require('./string/unCamelCase'), + 'underscore' : require('./string/underscore'), + 'unescapeHtml' : require('./string/unescapeHtml'), + 'unescapeUnicode' : require('./string/unescapeUnicode'), + 'unhyphenate' : require('./string/unhyphenate'), + 'upperCase' : require('./string/upperCase') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/WHITE_SPACES.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/WHITE_SPACES.js new file mode 100644 index 00000000..03e01254 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/WHITE_SPACES.js @@ -0,0 +1,12 @@ + + /** + * Contains all Unicode white-spaces. Taken from + * http://en.wikipedia.org/wiki/Whitespace_character. + */ + module.exports = [ + ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E', + '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', + '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', + '\u205F', '\u3000' + ]; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/camelCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/camelCase.js new file mode 100644 index 00000000..aadb69a2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/camelCase.js @@ -0,0 +1,20 @@ +var toString = require('../lang/toString'); +var replaceAccents = require('./replaceAccents'); +var removeNonWord = require('./removeNonWord'); +var upperCase = require('./upperCase'); +var lowerCase = require('./lowerCase'); + /** + * Convert string to camelCase text. + */ + function camelCase(str){ + str = toString(str); + str = replaceAccents(str); + str = removeNonWord(str) + .replace(/[\-_]/g, ' ') //convert all hyphens and underscores to spaces + .replace(/\s[a-z]/g, upperCase) //convert first char of each word to UPPERCASE + .replace(/\s+/g, '') //remove spaces + .replace(/^[A-Z]/g, lowerCase); //convert first char to lowercase + return str; + } + module.exports = camelCase; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/contains.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/contains.js new file mode 100644 index 00000000..cb22cae4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/contains.js @@ -0,0 +1,14 @@ +var toString = require('../lang/toString'); + + /** + * Searches for a given substring + */ + function contains(str, substring, fromIndex){ + str = toString(str); + substring = toString(substring); + return str.indexOf(substring, fromIndex) !== -1; + } + + module.exports = contains; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/crop.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/crop.js new file mode 100644 index 00000000..53b93b49 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/crop.js @@ -0,0 +1,12 @@ +var toString = require('../lang/toString'); +var truncate = require('./truncate'); + /** + * Truncate string at full words. + */ + function crop(str, maxChars, append) { + str = toString(str); + return truncate(str, maxChars, append, true); + } + + module.exports = crop; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/endsWith.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/endsWith.js new file mode 100644 index 00000000..d504e9dd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/endsWith.js @@ -0,0 +1,13 @@ +var toString = require('../lang/toString'); + /** + * Checks if string ends with specified suffix. + */ + function endsWith(str, suffix) { + str = toString(str); + suffix = toString(suffix); + + return str.indexOf(suffix, str.length - suffix.length) !== -1; + } + + module.exports = endsWith; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/escapeHtml.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/escapeHtml.js new file mode 100644 index 00000000..e67c4b21 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/escapeHtml.js @@ -0,0 +1,18 @@ +var toString = require('../lang/toString'); + + /** + * Escapes a string for insertion into HTML. + */ + function escapeHtml(str){ + str = toString(str) + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/'/g, ''') + .replace(/"/g, '"'); + return str; + } + + module.exports = escapeHtml; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/escapeRegExp.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/escapeRegExp.js new file mode 100644 index 00000000..02d743cd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/escapeRegExp.js @@ -0,0 +1,12 @@ +var toString = require('../lang/toString'); + + /** + * Escape RegExp string chars. + */ + function escapeRegExp(str) { + return toString(str).replace(/\W/g,'\\$&'); + } + + module.exports = escapeRegExp; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/escapeUnicode.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/escapeUnicode.js new file mode 100644 index 00000000..ec649adf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/escapeUnicode.js @@ -0,0 +1,21 @@ +var toString = require('../lang/toString'); + + /** + * Escape string into unicode sequences + */ + function escapeUnicode(str, shouldEscapePrintable){ + str = toString(str); + return str.replace(/[\s\S]/g, function(ch){ + // skip printable ASCII chars if we should not escape them + if (!shouldEscapePrintable && (/[\x20-\x7E]/).test(ch)) { + return ch; + } + // we use "000" and slice(-4) for brevity, need to pad zeros, + // unicode escape always have 4 chars after "\u" + return '\\u'+ ('000'+ ch.charCodeAt(0).toString(16)).slice(-4); + }); + } + + module.exports = escapeUnicode; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/hyphenate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/hyphenate.js new file mode 100644 index 00000000..95e32436 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/hyphenate.js @@ -0,0 +1,14 @@ +var toString = require('../lang/toString'); +var slugify = require('./slugify'); +var unCamelCase = require('./unCamelCase'); + /** + * Replaces spaces with hyphens, split camelCase text, remove non-word chars, remove accents and convert to lower case. + */ + function hyphenate(str){ + str = toString(str); + str = unCamelCase(str); + return slugify(str, "-"); + } + + module.exports = hyphenate; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/insert.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/insert.js new file mode 100644 index 00000000..8f042c6d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/insert.js @@ -0,0 +1,21 @@ +var clamp = require('../math/clamp'); +var toString = require('../lang/toString'); + + /** + * Inserts a string at a given index. + */ + function insert(string, index, partial){ + string = toString(string); + + if (index < 0) { + index = string.length + index; + } + + index = clamp(index, 0, string.length); + + return string.substr(0, index) + partial + string.substr(index); + } + + module.exports = insert; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/interpolate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/interpolate.js new file mode 100644 index 00000000..efbbf7dc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/interpolate.js @@ -0,0 +1,19 @@ +var toString = require('../lang/toString'); +var get = require('../object/get'); + + var stache = /\{\{([^\}]+)\}\}/g; //mustache-like + + /** + * String interpolation + */ + function interpolate(template, replacements, syntax){ + template = toString(template); + var replaceFn = function(match, prop){ + return toString( get(replacements, prop) ); + }; + return template.replace(syntax || stache, replaceFn); + } + + module.exports = interpolate; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/lowerCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/lowerCase.js new file mode 100644 index 00000000..30bb7ad9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/lowerCase.js @@ -0,0 +1,11 @@ +var toString = require('../lang/toString'); + /** + * "Safer" String.toLowerCase() + */ + function lowerCase(str){ + str = toString(str); + return str.toLowerCase(); + } + + module.exports = lowerCase; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/lpad.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/lpad.js new file mode 100644 index 00000000..63641d3f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/lpad.js @@ -0,0 +1,17 @@ +var toString = require('../lang/toString'); +var repeat = require('./repeat'); + + /** + * Pad string with `char` if its' length is smaller than `minLen` + */ + function lpad(str, minLen, ch) { + str = toString(str); + ch = ch || ' '; + + return (str.length < minLen) ? + repeat(ch, minLen - str.length) + str : str; + } + + module.exports = lpad; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/ltrim.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/ltrim.js new file mode 100644 index 00000000..23d7b33f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/ltrim.js @@ -0,0 +1,34 @@ +var toString = require('../lang/toString'); +var WHITE_SPACES = require('./WHITE_SPACES'); + /** + * Remove chars from beginning of string. + */ + function ltrim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + + var start = 0, + len = str.length, + charLen = chars.length, + found = true, + i, c; + + while (found && start < len) { + found = false; + i = -1; + c = str.charAt(start); + + while (++i < charLen) { + if (c === chars[i]) { + found = true; + start++; + break; + } + } + } + + return (start >= len) ? '' : str.substr(start, len); + } + + module.exports = ltrim; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/makePath.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/makePath.js new file mode 100644 index 00000000..c337cecc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/makePath.js @@ -0,0 +1,15 @@ +var join = require('../array/join'); +var slice = require('../array/slice'); + + /** + * Group arguments as path segments, if any of the args is `null` or an + * empty string it will be ignored from resulting path. + */ + function makePath(var_args){ + var result = join(slice(arguments), '/'); + // need to disconsider duplicate '/' after protocol (eg: 'http://') + return result.replace(/([^:\/]|^)\/{2,}/g, '$1/'); + } + + module.exports = makePath; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/normalizeLineBreaks.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/normalizeLineBreaks.js new file mode 100644 index 00000000..8a8dccfd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/normalizeLineBreaks.js @@ -0,0 +1,18 @@ +var toString = require('../lang/toString'); + + /** + * Convert line-breaks from DOS/MAC to a single standard (UNIX by default) + */ + function normalizeLineBreaks(str, lineEnd) { + str = toString(str); + lineEnd = lineEnd || '\n'; + + return str + .replace(/\r\n/g, lineEnd) // DOS + .replace(/\r/g, lineEnd) // Mac + .replace(/\n/g, lineEnd); // Unix + } + + module.exports = normalizeLineBreaks; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/pascalCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/pascalCase.js new file mode 100644 index 00000000..fd190353 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/pascalCase.js @@ -0,0 +1,13 @@ +var toString = require('../lang/toString'); +var camelCase = require('./camelCase'); +var upperCase = require('./upperCase'); + /** + * camelCase + UPPERCASE first char + */ + function pascalCase(str){ + str = toString(str); + return camelCase(str).replace(/^[a-z]/, upperCase); + } + + module.exports = pascalCase; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/properCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/properCase.js new file mode 100644 index 00000000..61636be4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/properCase.js @@ -0,0 +1,13 @@ +var toString = require('../lang/toString'); +var lowerCase = require('./lowerCase'); +var upperCase = require('./upperCase'); + /** + * UPPERCASE first char of each word. + */ + function properCase(str){ + str = toString(str); + return lowerCase(str).replace(/^\w|\s\w/g, upperCase); + } + + module.exports = properCase; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/removeNonASCII.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/removeNonASCII.js new file mode 100644 index 00000000..fb463816 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/removeNonASCII.js @@ -0,0 +1,14 @@ +var toString = require('../lang/toString'); + /** + * Remove non-printable ASCII chars + */ + function removeNonASCII(str){ + str = toString(str); + + // Matches non-printable ASCII chars - + // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters + return str.replace(/[^\x20-\x7E]/g, ''); + } + + module.exports = removeNonASCII; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/removeNonWord.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/removeNonWord.js new file mode 100644 index 00000000..ffb05a95 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/removeNonWord.js @@ -0,0 +1,14 @@ +var toString = require('../lang/toString'); + // This pattern is generated by the _build/pattern-removeNonWord.js script + var PATTERN = /[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g; + + /** + * Remove non-word chars. + */ + function removeNonWord(str){ + str = toString(str); + return str.replace(PATTERN, ''); + } + + module.exports = removeNonWord; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/repeat.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/repeat.js new file mode 100644 index 00000000..df0dc1e5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/repeat.js @@ -0,0 +1,26 @@ +var toString = require('../lang/toString'); +var toInt = require('../number/toInt'); + + /** + * Repeat string n times + */ + function repeat(str, n){ + var result = ''; + str = toString(str); + n = toInt(n); + if (n < 1) { + return ''; + } + while (n > 0) { + if (n % 2) { + result += str; + } + n = Math.floor(n / 2); + str += str; + } + return result; + } + + module.exports = repeat; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/replace.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/replace.js new file mode 100644 index 00000000..14433fc7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/replace.js @@ -0,0 +1,33 @@ +var toString = require('../lang/toString'); +var toArray = require('../lang/toArray'); + + /** + * Replace string(s) with the replacement(s) in the source. + */ + function replace(str, search, replacements) { + str = toString(str); + search = toArray(search); + replacements = toArray(replacements); + + var searchLength = search.length, + replacementsLength = replacements.length; + + if (replacementsLength !== 1 && searchLength !== replacementsLength) { + throw new Error('Unequal number of searches and replacements'); + } + + var i = -1; + while (++i < searchLength) { + // Use the first replacement for all searches if only one + // replacement is provided + str = str.replace( + search[i], + replacements[(replacementsLength === 1) ? 0 : i]); + } + + return str; + } + + module.exports = replace; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/replaceAccents.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/replaceAccents.js new file mode 100644 index 00000000..bb221265 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/replaceAccents.js @@ -0,0 +1,36 @@ +var toString = require('../lang/toString'); + /** + * Replaces all accented chars with regular ones + */ + function replaceAccents(str){ + str = toString(str); + + // verifies if the String has accents and replace them + if (str.search(/[\xC0-\xFF]/g) > -1) { + str = str + .replace(/[\xC0-\xC5]/g, "A") + .replace(/[\xC6]/g, "AE") + .replace(/[\xC7]/g, "C") + .replace(/[\xC8-\xCB]/g, "E") + .replace(/[\xCC-\xCF]/g, "I") + .replace(/[\xD0]/g, "D") + .replace(/[\xD1]/g, "N") + .replace(/[\xD2-\xD6\xD8]/g, "O") + .replace(/[\xD9-\xDC]/g, "U") + .replace(/[\xDD]/g, "Y") + .replace(/[\xDE]/g, "P") + .replace(/[\xE0-\xE5]/g, "a") + .replace(/[\xE6]/g, "ae") + .replace(/[\xE7]/g, "c") + .replace(/[\xE8-\xEB]/g, "e") + .replace(/[\xEC-\xEF]/g, "i") + .replace(/[\xF1]/g, "n") + .replace(/[\xF2-\xF6\xF8]/g, "o") + .replace(/[\xF9-\xFC]/g, "u") + .replace(/[\xFE]/g, "p") + .replace(/[\xFD\xFF]/g, "y"); + } + return str; + } + module.exports = replaceAccents; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/rpad.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/rpad.js new file mode 100644 index 00000000..99f6378d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/rpad.js @@ -0,0 +1,15 @@ +var toString = require('../lang/toString'); +var repeat = require('./repeat'); + + /** + * Pad string with `char` if its' length is smaller than `minLen` + */ + function rpad(str, minLen, ch) { + str = toString(str); + ch = ch || ' '; + return (str.length < minLen)? str + repeat(ch, minLen - str.length) : str; + } + + module.exports = rpad; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/rtrim.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/rtrim.js new file mode 100644 index 00000000..66ba80e9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/rtrim.js @@ -0,0 +1,33 @@ +var toString = require('../lang/toString'); +var WHITE_SPACES = require('./WHITE_SPACES'); + /** + * Remove chars from end of string. + */ + function rtrim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + + var end = str.length - 1, + charLen = chars.length, + found = true, + i, c; + + while (found && end >= 0) { + found = false; + i = -1; + c = str.charAt(end); + + while (++i < charLen) { + if (c === chars[i]) { + found = true; + end--; + break; + } + } + } + + return (end >= 0) ? str.substring(0, end + 1) : ''; + } + + module.exports = rtrim; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/sentenceCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/sentenceCase.js new file mode 100644 index 00000000..354104c6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/sentenceCase.js @@ -0,0 +1,15 @@ +var toString = require('../lang/toString'); +var lowerCase = require('./lowerCase'); +var upperCase = require('./upperCase'); + /** + * UPPERCASE first char of each sentence and lowercase other chars. + */ + function sentenceCase(str){ + str = toString(str); + + // Replace first char of each sentence (new line or after '.\s+') to + // UPPERCASE + return lowerCase(str).replace(/(^\w)|\.\s+(\w)/gm, upperCase); + } + module.exports = sentenceCase; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/slugify.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/slugify.js new file mode 100644 index 00000000..142f0d9b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/slugify.js @@ -0,0 +1,24 @@ +var toString = require('../lang/toString'); +var replaceAccents = require('./replaceAccents'); +var removeNonWord = require('./removeNonWord'); +var trim = require('./trim'); + /** + * Convert to lower case, remove accents, remove non-word chars and + * replace spaces with the specified delimeter. + * Does not split camelCase text. + */ + function slugify(str, delimeter){ + str = toString(str); + + if (delimeter == null) { + delimeter = "-"; + } + str = replaceAccents(str); + str = removeNonWord(str); + str = trim(str) //should come after removeNonWord + .replace(/ +/g, delimeter) //replace spaces with delimeter + .toLowerCase(); + return str; + } + module.exports = slugify; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/startsWith.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/startsWith.js new file mode 100644 index 00000000..bce2bd20 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/startsWith.js @@ -0,0 +1,13 @@ +var toString = require('../lang/toString'); + /** + * Checks if string starts with specified prefix. + */ + function startsWith(str, prefix) { + str = toString(str); + prefix = toString(prefix); + + return str.indexOf(prefix) === 0; + } + + module.exports = startsWith; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/stripHtmlTags.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/stripHtmlTags.js new file mode 100644 index 00000000..01d17b0e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/stripHtmlTags.js @@ -0,0 +1,11 @@ +var toString = require('../lang/toString'); + /** + * Remove HTML tags from string. + */ + function stripHtmlTags(str){ + str = toString(str); + + return str.replace(/<[^>]*>/g, ''); + } + module.exports = stripHtmlTags; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/trim.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/trim.js new file mode 100644 index 00000000..9652b0c7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/trim.js @@ -0,0 +1,15 @@ +var toString = require('../lang/toString'); +var WHITE_SPACES = require('./WHITE_SPACES'); +var ltrim = require('./ltrim'); +var rtrim = require('./rtrim'); + /** + * Remove white-spaces from beginning and end of string. + */ + function trim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + return ltrim(rtrim(str, chars), chars); + } + + module.exports = trim; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/truncate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/truncate.js new file mode 100644 index 00000000..a98d6c7d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/truncate.js @@ -0,0 +1,21 @@ +var toString = require('../lang/toString'); +var trim = require('./trim'); + /** + * Limit number of chars. + */ + function truncate(str, maxChars, append, onlyFullWords){ + str = toString(str); + append = append || '...'; + maxChars = onlyFullWords? maxChars + 1 : maxChars; + + str = trim(str); + if(str.length <= maxChars){ + return str; + } + str = str.substr(0, maxChars - append.length); + //crop at last space or remove trailing whitespace + str = onlyFullWords? str.substr(0, str.lastIndexOf(' ')) : trim(str); + return str + append; + } + module.exports = truncate; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/typecast.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/typecast.js new file mode 100644 index 00000000..c1386a49 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/typecast.js @@ -0,0 +1,29 @@ + + + var UNDEF; + + /** + * Parses string and convert it into a native value. + */ + function typecast(val) { + var r; + if ( val === null || val === 'null' ) { + r = null; + } else if ( val === 'true' ) { + r = true; + } else if ( val === 'false' ) { + r = false; + } else if ( val === UNDEF || val === 'undefined' ) { + r = UNDEF; + } else if ( val === '' || isNaN(val) ) { + //isNaN('') returns false + r = val; + } else { + //parseFloat(null || '') returns NaN + r = parseFloat(val); + } + return r; + } + + module.exports = typecast; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unCamelCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unCamelCase.js new file mode 100644 index 00000000..4968f378 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unCamelCase.js @@ -0,0 +1,23 @@ +var toString = require('../lang/toString'); + + var CAMEL_CASE_BORDER = /([a-z\xE0-\xFF])([A-Z\xC0\xDF])/g; + + /** + * Add space between camelCase text. + */ + function unCamelCase(str, delimiter){ + if (delimiter == null) { + delimiter = ' '; + } + + function join(str, c1, c2) { + return c1 + delimiter + c2; + } + + str = toString(str); + str = str.replace(CAMEL_CASE_BORDER, join); + str = str.toLowerCase(); //add space between camelCase text + return str; + } + module.exports = unCamelCase; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/underscore.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/underscore.js new file mode 100644 index 00000000..ebd6e2b7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/underscore.js @@ -0,0 +1,13 @@ +var toString = require('../lang/toString'); +var slugify = require('./slugify'); +var unCamelCase = require('./unCamelCase'); + /** + * Replaces spaces with underscores, split camelCase text, remove non-word chars, remove accents and convert to lower case. + */ + function underscore(str){ + str = toString(str); + str = unCamelCase(str); + return slugify(str, "_"); + } + module.exports = underscore; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unescapeHtml.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unescapeHtml.js new file mode 100644 index 00000000..ad1987dd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unescapeHtml.js @@ -0,0 +1,18 @@ +var toString = require('../lang/toString'); + + /** + * Unescapes HTML special chars + */ + function unescapeHtml(str){ + str = toString(str) + .replace(/&/g , '&') + .replace(/</g , '<') + .replace(/>/g , '>') + .replace(/�*39;/g , "'") + .replace(/"/g, '"'); + return str; + } + + module.exports = unescapeHtml; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unescapeUnicode.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unescapeUnicode.js new file mode 100644 index 00000000..0b7fb73b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unescapeUnicode.js @@ -0,0 +1,16 @@ +var toString = require('../lang/toString'); + + /** + * Unescape unicode char sequences + */ + function unescapeUnicode(str){ + str = toString(str); + return str.replace(/\\u[0-9a-f]{4}/g, function(ch){ + var code = parseInt(ch.slice(2), 16); + return String.fromCharCode(code); + }); + } + + module.exports = unescapeUnicode; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unhyphenate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unhyphenate.js new file mode 100644 index 00000000..311dfa17 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/unhyphenate.js @@ -0,0 +1,10 @@ +var toString = require('../lang/toString'); + /** + * Replaces hyphens with spaces. (only hyphens between word chars) + */ + function unhyphenate(str){ + str = toString(str); + return str.replace(/(\w)(-)(\w)/g, '$1 $3'); + } + module.exports = unhyphenate; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/upperCase.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/upperCase.js new file mode 100644 index 00000000..6c92552c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/string/upperCase.js @@ -0,0 +1,10 @@ +var toString = require('../lang/toString'); + /** + * "Safer" String.toUpperCase() + */ + function upperCase(str){ + str = toString(str); + return str.toUpperCase(); + } + module.exports = upperCase; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time.js new file mode 100644 index 00000000..9f533296 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time.js @@ -0,0 +1,12 @@ + + +//automatically generated, do not edit! +//run `node build` instead +module.exports = { + 'convert' : require('./time/convert'), + 'now' : require('./time/now'), + 'parseMs' : require('./time/parseMs'), + 'toTimeString' : require('./time/toTimeString') +}; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/convert.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/convert.js new file mode 100644 index 00000000..852a0f03 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/convert.js @@ -0,0 +1,41 @@ + + + /** + * convert time into another unit + */ + function convert(val, sourceUnitName, destinationUnitName){ + destinationUnitName = destinationUnitName || 'ms'; + return (val * getUnit(sourceUnitName)) / getUnit(destinationUnitName); + } + + + //TODO: maybe extract to a separate module + function getUnit(unitName){ + switch(unitName){ + case 'ms': + case 'millisecond': + return 1; + case 's': + case 'second': + return 1000; + case 'm': + case 'minute': + return 60000; + case 'h': + case 'hour': + return 3600000; + case 'd': + case 'day': + return 86400000; + case 'w': + case 'week': + return 604800000; + default: + throw new Error('"'+ unitName + '" is not a valid unit'); + } + } + + + module.exports = convert; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/now.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/now.js new file mode 100644 index 00000000..0cedb18d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/now.js @@ -0,0 +1,18 @@ + + + /** + * Get current time in miliseconds + */ + function now(){ + // yes, we defer the work to another function to allow mocking it + // during the tests + return now.get(); + } + + now.get = (typeof Date.now === 'function')? Date.now : function(){ + return +(new Date()); + }; + + module.exports = now; + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/parseMs.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/parseMs.js new file mode 100644 index 00000000..6d997976 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/parseMs.js @@ -0,0 +1,17 @@ +var countSteps = require('../math/countSteps'); + + /** + * Parse timestamp into an object. + */ + function parseMs(ms){ + return { + milliseconds : countSteps(ms, 1, 1000), + seconds : countSteps(ms, 1000, 60), + minutes : countSteps(ms, 60000, 60), + hours : countSteps(ms, 3600000, 24), + days : countSteps(ms, 86400000) + }; + } + + module.exports = parseMs; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/toTimeString.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/toTimeString.js new file mode 100644 index 00000000..101d69fc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/mout/time/toTimeString.js @@ -0,0 +1,24 @@ +var countSteps = require('../math/countSteps'); +var pad = require('../number/pad'); + + var HOUR = 3600000, + MINUTE = 60000, + SECOND = 1000; + + /** + * Format timestamp into a time string. + */ + function toTimeString(ms){ + var h = ms < HOUR ? 0 : countSteps(ms, HOUR), + m = ms < MINUTE ? 0 : countSteps(ms, MINUTE, 60), + s = ms < SECOND ? 0 : countSteps(ms, SECOND, 60), + str = ''; + + str += h? h + ':' : ''; + str += pad(m, 2) + ':'; + str += pad(s, 2); + + return str; + } + module.exports = toTimeString; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/.travis.yml new file mode 100644 index 00000000..7ce3132a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +before_install: npm install npm -g +node_js: + - "iojs" + - "0.12" + - "0.11" + - "0.10" diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/History.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/History.md new file mode 100644 index 00000000..3fe66fb2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/History.md @@ -0,0 +1,27 @@ + +1.1.1 / 2015-03-06 +================== + + * Fix sync exec in 0.12/io.js. Polyfill with sync-exec over runsync. + * Add Travis CI. + +1.1.0 / 2015-03-06 +================== + + * Update dependencies. + * Correctly forward dashed parameters. (Reported by @michalkleiner) + * Improve error reporting for non-existent commands. + * Polyfill execSync for legacy node. + * Add npmRun.sync method (SEMVER.MINOR) (@millermedeiros) + +1.0.2 / 2014-06-28 +================== + * Add missing npm-which dependency. + +1.0.1 / 2014-06-23 +================== + * Add meta info to package.json. + +1.0.0 / 2014-04-21 +================== + * Birth diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/LICENSE new file mode 100644 index 00000000..a8ee83f0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Tim Oxley + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/Readme.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/Readme.md new file mode 100644 index 00000000..68410a92 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/Readme.md @@ -0,0 +1,29 @@ +# npm-run + +### Run locally-installed executables. + +Any executable available to an npm lifecycle script is available to `npm-run`. + +## Installation + +```bash +> npm install -g npm-run +``` + +## Usage + +```bash +> npm install mocha +> npm-run mocha test/* +# uses local mocha executable +``` + +### See Also + +* [timoxley/npm-which](https://github.com/timoxley/npm-which) +* [timoxley/npm-path](https://github.com/timoxley/npm-path) +* [grncdr/npm-exec](https://github.com/grncdr/npm-exec) + +## License + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/bin/npm-run.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/bin/npm-run.js new file mode 100755 index 00000000..ce8034fa --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/bin/npm-run.js @@ -0,0 +1,41 @@ +#!/usr/bin/env node + +var pkg = require('../package.json') +var exec = require('child_process').exec +var path = require('path') +var npmExec = require('../') + +var program = require('minimist')(process.argv) + +if (program._.length == 2) { + if (program.version) { + console.log(pkg.version) + process.exit() + } + if (program.help) { + displayHelp(program._[1]) + process.exit() + } else { + displayHelp(program._[1]) + process.exit(1) + } +} + +npmExec.spawn(process.argv[2], process.argv.slice(3), {stdio: 'inherit'}) +.on('error', function(err) { + console.error(err.stack) +}) +.on('close', function(code) { + process.exit(code) +}) + +function displayHelp(name) { + console.log([ + 'Usage: '+name+' command [...args]', + 'Options:', + ' --version Display version and exit.', + ' --help Display this help.', + '' + ].join('\n')) + +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/index.js new file mode 100644 index 00000000..781ba761 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/index.js @@ -0,0 +1,87 @@ +"use strict" + +var npmPath = require('npm-path') +var child_process = require('child_process') +var syncExec = require('sync-exec') + +var exec = child_process.exec + +// polyfill for child_process.execSync +var execSync = child_process.execSync || function(args, path) { + return syncExec(args, path).stdout +} + +var execFile = child_process.execFile +var spawn = child_process.spawn +var fork = child_process.fork +npmExec.spawn = npmSpawn +npmExec.sync = npmExecSync + +module.exports = npmExec + +function npmExec(args, options, fn) { + var opts = setOptions(options, fn) + options = opts[0] + fn = opts[1] + getPath(options, function(err, options) { + if (err) return fn(err) + exec(args, options, fn) + }) +} + +function npmExecSync(args, options) { + var opts = setOptions(options) + var path = getPath.sync(opts[0]) + return execSync(args, path).toString() +} + +function npmSpawn() { + var options = {} + var args = [].slice.apply(arguments) + // encode args to pass to spawn.js + args = args.map(function(arg) { + if (Array.isArray(arg)) return JSON.stringify(arg) + if (arg.toString() === '[object Object]') { + options = arg + return JSON.stringify(arg) + } + return arg + }) + if (options.stdio === 'inherit') options.silent = false + else options.silent = true + var child = fork(__dirname + '/spawn.js', args, options) + child.on('message', function(jsonErr) { + var err = new Error() + Object.keys(jsonErr).forEach(function(key) { + err[key] = jsonErr[key] + }) + this.emit('error', err) + }) + return child +} + + +function getPath(options, fn) { + npmPath.get(options, function(err, newPath) { + var env = Object.create(options.env) + env[npmPath.PATH] = newPath + options.env = env + fn(null, options) + }) +} + +getPath.sync = function getPathSync(options) { + var newPath = npmPath.getSync(options) + var env = Object.create(options.env) + env[npmPath.PATH] = newPath + options.env = env + return options +} + +function setOptions(options, fn) { + if (typeof options == 'function') fn = options, options = null + options = Object.create(options || {}) + options.env = options.env || process.env + options.cwd = options.cwd || process.cwd() + return [options, fn] +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/.bin/npm-path b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/.bin/npm-path new file mode 120000 index 00000000..309c3533 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/.bin/npm-path @@ -0,0 +1 @@ +../npm-path/bin/npm-path \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/LICENSE new file mode 100644 index 00000000..a8ee83f0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Tim Oxley + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/Readme.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/Readme.md new file mode 100644 index 00000000..6310c6b5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/Readme.md @@ -0,0 +1,161 @@ +# npm-path + +### Get a PATH containing locally installed module executables. + +`npm-path` will get you a PATH with all of the executables available to npm scripts, without booting up all of npm(1). + +#### `npm-path` will set your PATH to include: + +* All of the `node_modules/.bin` directories from the current directory, up through all of its parents. This allows you to invoke the executables for any installed modules. e.g. if `mocha` is installed a dependency of the current module, then `mocha` will be available on a `npm-path` generated `$PATH`. +* The directory containing the current `node` executable, so any scripts that invoke `node` will execute the same `node`. +* Current npm's `node-gyp` directory, so the `node-gyp` bundled with `npm` can be used. + +## Usage + +### Command-line + +```bash +# Prints the augmented PATH to the console +> npm-path +# /usr/local/lib/node_modules/npm/bin/node-gyp-bin:.../node_modules/.bin:/.../usr/local/bin:/usr/local/sbin: ... etc +``` + +Calling `npm-path` from the commandline is the equivalent of executing an npm script with the body `echo $PATH`, but without all of the overhead of booting or depending on `npm`. + +### Set PATH + +This will set the augmented PATH for the current process environment, or an environment you supply. + +```js +var npmPath = require('npm-path') +var PATH = npmPath.PATH // get platform independent PATH key + +npmPath(function(err, $PATH) { + + // Note: current environment is modified! + console.log(process.env[PATH] == $PATH) // true + + console.log($PATH) + // /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/.../.bin:/usr/local/bin: ...etc + +}) + +// more explicit alternative syntax +npmPath.set(function(err, $PATH) { + // ... +}) +``` + +#### Synchronous Alternative + +```js + +// supplying no callback will execute method synchronously +var $PATH = npmPath() +console.log($PATH) + +// more explicit alternative syntax +$PATH = npmPath.setSync() +``` + +#### Optional Options + +```js +var options = { + env: process.env, // default. + cwd: process.cwd() // default. +} + +npmPath(options, function(err, $PATH) { + // ... +}) + +npmPath.setSync(options) + + // ... + +``` + + +### Get PATH + +This will get npm augmented PATH, but *does not modify the PATH in the environment*. +Takes the exact same options as `set`. + +```js +npmPath.get(function(err, $PATH) { + console.log($PATH) + + // Note: current environment is NOT modified! + console.log(process.env[PATH] == $PATH) // false +}) + +// options is optional, takes same options as `npmPath.set` +npmPath.get(options, function(err, $PATH) { + console.log($PATH) +}) +``` + +#### Synchronous Alternative + +```js +// supplying no callback will execute method synchronously +var $PATH = npmPath.get() +console.log($PATH) +console.log(process.env[PATH] == $PATH) // false + +// more explicit alternative syntax +$PATH = npmPath.getSync() + +``` + +### Options + +Both `set` and `get` take an optional options object, with optional `env` & `cwd` keys. + +* Set `options.env` if you wish to use something other than `process.env` (the default) +* Set `options.cwd` if you wish to use something other than `process.cwd()` (the default) + +There's also a `options.npm` property which you can set if you want `node-gyp` to be sourced from +an alternative `npm` installation. + +### Get the PATH environment variable key + +```js +// windows calls it's path "Path" usually, but this is not guaranteed. +npmPath.PATH // 'Path', probably + +// rest of the world +npmPath.PATH // 'PATH' + +``` + +#### Example Usage + +```js +process.env[npmPath.PATH] // get path environment variable + +// set path environment variable manually +process.env[npmPath.PATH] = npmPath.get() + +// set path environment variable automatically +npmPath() +``` + +### Get the PATH separator + +```js +// windows +npmPath.SEPARATOR // ';' + +// rest of the world +npmPath.SEPARATOR // ':' +``` + +## Credit + +Path lookup code adapted directly from npm. + +# License + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/bin/npm-path b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/bin/npm-path new file mode 100755 index 00000000..d37b7aef --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/bin/npm-path @@ -0,0 +1,5 @@ +#!/usr/bin/env node + +var npmPath = require('../') + +console.log(npmPath()) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/index.js new file mode 100644 index 00000000..58c4c80b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/index.js @@ -0,0 +1,188 @@ +"use strict" + +var fs = require('fs') +var path = require('path') +var which = require('which') + +var PATH = getPATHKey() +var SEPARATOR = getPATHSeparator() + +/** + * Get new $PATH setting with additional paths supplied by the npm. + * + * @param Object options Config options Object. + * @param Object options.env Environment to use. Default: process.env + * @param String options.wd Working directory. Default: process.cwd() + * @param Function fn callback function. + */ + +function getPath(options, fn) { + var wd = options.cwd = options.cwd || process.cwd() + var env = options.env = options.env || process.env + var pathArr = getPathArr(options) + + whichNpm(options, function(err, npmPath) { + if (err) return fn(err) + + // we also unshift the bundled node-gyp-bin folder so that + // the bundled one will be used for installing things. + pathArr.unshift(path.join(path.dirname(npmPath), "node-gyp-bin")) + if (env[PATH]) pathArr.push(env[PATH]) + fn(null, pathArr.join(SEPARATOR)) + }) +} + +/** + * Async wrapper around `getPath`. + */ + +function getPathAsync(options, fn) { + // options is optional + if (options instanceof Function) fn = options, options = {} + // if no fn, execute as sync + if (!(fn instanceof Function)) return getPathSync(options) + options = options || {} + options.isSync = false + return getPath(options, fn) +} + +/** + * Sync wrapper around `getPath`. + */ + +function getPathSync(options) { + options = options || {} + options.isSync = true + var thePath = undefined + // sync magic: if sync true, callback is executed sync + // therefore we can set thePath from inside it before returning + getPath(options, function(err, foundPath) { + if (err) throw err + thePath = foundPath + }) + return thePath +} + +/** + * Change environment to include npm path adjustments. + * + * @param Object options Config options Object. + * @param Object options.env Environment to use. Default: process.env + * @param String options.wd Working directory. Default: process.cwd() + * @param Function fn callback function. + */ + +function setPathAsync(options, fn) { + // options is optional + if (options instanceof Function) fn = options, options = {} + // if no fn, execute as sync + if (!(fn instanceof Function)) return setPathSync(options) + + getPathAsync(options, function(err, newPath) { + if (err) return fn(err) + fn(null, options.env[PATH] = newPath) + }) +} + +/** + * Sync version of `setPathAsync` + */ + +function setPathSync(options) { + options = options || {} + var newPath = getPathSync(options) + return options.env[PATH] = newPath +} + +/** + * Generate simple parts of the npm path. Basically everything that doesn't + * depend on potentially async operations. + * + * @return Array + */ + +function getPathArr(options) { + var wd = options.cwd + var pathArr = [] + var p = wd.split("node_modules") + var acc = path.resolve(p.shift()) + + // first add the directory containing the `node` executable currently + // running, so that any lifecycle script that invoke "node" will execute + // this same one. + pathArr.unshift(path.dirname(process.execPath)) + + p.forEach(function (pp) { + pathArr.unshift(path.join(acc, "node_modules", ".bin")) + acc = path.join(acc, "node_modules", pp) + }) + pathArr.unshift(path.join(acc, "node_modules", ".bin")) + return pathArr +} + +/** + * Use callback-style signature but toggle sync execution if `isSync` is true. + * If options.npm is supplied, this will simply provide npm/bin/npm-cli. + */ + +function whichNpm(options, fn) { + var npmCli = options.npm && path.join(options.npm, 'bin', 'npm-cli.js') + + if (options.isSync) { + fn(null, fs.realpathSync( + npmCli || which.sync('npm') + )) + return + } + + if (options.npm) { + process.nextTick(function() { + fn(null, npmCli) + }) + return + } + + which('npm', function(err, npmPath) { + if (err) return fn(err) + fs.realpath(npmPath, fn) + }) +} + +/** + * Get key to use as $PATH in environment + */ + +function getPATHKey() { + var PATH = 'PATH' + + // windows calls it's path "Path" usually, but this is not guaranteed. + if (process.platform === "win32") { + PATH = "Path" + Object.keys(process.env).forEach(function (e) { + if (e.match(/^PATH$/i)) { + PATH = e + } + }) + } + return PATH +} + +/** + * Get $PATH separator based on environment + */ + +function getPATHSeparator() { + return process.platform === "win32" ? ";" : ":" +} + +module.exports = setPathAsync +module.exports.get = getPathAsync +module.exports.get.sync = getPathSync +module.exports.getSync = getPathSync + +module.exports.set = setPathAsync +module.exports.set.sync = setPathSync +module.exports.setSync = setPathSync + +module.exports.PATH = PATH +module.exports.SEPARATOR = SEPARATOR diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/.bin/which b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/.bin/which new file mode 120000 index 00000000..f62471c8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/.bin/which @@ -0,0 +1 @@ +../which/bin/which \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/README.md new file mode 100644 index 00000000..d5571528 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/README.md @@ -0,0 +1,34 @@ +# which + +Like the unix `which` utility. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. + +## USAGE + +```javascript +var which = require('which') + +// async usage +which('node', function (er, resolvedPath) { + // er is returned if no "node" is found on the PATH + // if it is found, then the absolute path to the exec is returned +}) + +// sync usage +// throws if not found +var resolved = which.sync('node') + +// Pass options to override the PATH and PATHEXT environment vars. +which('node', { path: someOtherPath }, function (er, resolved) { + if (er) + throw er + console.log('found at %j', resolved) +}) +``` + +## OPTIONS + +If you pass in options, then `path` and `pathExt` are relevant. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/bin/which b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/bin/which new file mode 100755 index 00000000..8432ce2f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/bin/which @@ -0,0 +1,14 @@ +#!/usr/bin/env node +var which = require("../") +if (process.argv.length < 3) { + console.error("Usage: which ") + process.exit(1) +} + +which(process.argv[2], function (er, thing) { + if (er) { + console.error(er.message) + process.exit(er.errno || 127) + } + console.log(thing) +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/LICENSE new file mode 100644 index 00000000..904ab073 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, Jon Schlinkert.Copyright (c) 2009-2015, TJ Holowaychuk. + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/README.md new file mode 100644 index 00000000..768f4b83 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/README.md @@ -0,0 +1,53 @@ +# is-absolute [![NPM version](https://badge.fury.io/js/is-absolute.svg)](http://badge.fury.io/js/is-absolute) [![Build Status](https://travis-ci.org/jonschlinkert/is-absolute.svg)](https://travis-ci.org/jonschlinkert/is-absolute) + +> Return true if a file path is absolute. + +Based on the `isAbsolute` utility method in [express](https://github.com/visionmedia/express). + +## Install with [npm](npmjs.org) + +```bash +npm i is-absolute --save +``` + +## Usage + +```js +var isAbsolute = require('is-absolute'); +console.log(isAbsolute('a/b/c.js')); +//=> 'false'; +``` + +## Running tests +Install dev dependencies. + +```bash +npm i -d && npm test +``` + + +## Contributing +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-absolute/issues) + + +## Other projects +* [is-relative](https://github.com/jonschlinkert/is-relative): Returns `true` if the path appears to be relative. +* [is-dotfile](https://github.com/regexps/is-dotfile): Return true if a file path is (or has) a dotfile. +* [is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a glob pattern. +* [cwd](https://github.com/jonschlinkert/cwd): Node.js util for easily getting the current working directory of a project based on package.json or the given path. +* [git-config-path](https://github.com/jonschlinkert/git-config-path): Resolve the path to the user's global .gitconfig. + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License +Copyright (c) 2014-2015 Jon Schlinkert +Released under the MIT license + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 05, 2015._ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/index.js new file mode 100644 index 00000000..e7a40dd7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/index.js @@ -0,0 +1,27 @@ +/*! + * is-absolute + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var isRelative = require('is-relative'); + +module.exports = function isAbsolute(filepath) { + if ('/' === filepath[0]) { + return true; + } + if (':' === filepath[1] && '\\' === filepath[2]) { + return true; + } + // Microsoft Azure absolute filepath + if ('\\\\' == filepath.substring(0, 2)) { + return true; + } + if (!isRelative(filepath)) { + return true; + } +}; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/LICENSE-MIT b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/LICENSE-MIT new file mode 100644 index 00000000..b576e8d4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/LICENSE-MIT @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jon Schlinkert + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/README.md new file mode 100644 index 00000000..760be8d0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/README.md @@ -0,0 +1,38 @@ +# is-relative [![NPM version](https://badge.fury.io/js/is-relative.svg)](http://badge.fury.io/js/is-relative) + +> Returns `true` if the path appears to be relative. + +## Install +### Install with [npm](npmjs.org) + +```bash +npm i is-relative --save +``` + +## Usage +### [isRelative](index.js#L16) + +* `filepath` **{String}**: Path to test. +* `returns`: {Boolean} + +```js +var isRelative = require('is-relative'); +isRelative('README.md'); +//=> true +``` + + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License +Copyright (c) 2014 Jon Schlinkert +Released under the MIT license + +*** + +_This file was generated by [verb](https://github.com/assemble/verb) on November 17, 2014._ \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/index.js new file mode 100644 index 00000000..ffc760a8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/index.js @@ -0,0 +1,21 @@ +'use strict'; + +/** + * ```js + * var isRelative = require('is-relative'); + * isRelative('README.md'); + * //=> true + * ``` + * + * @name isRelative + * @param {String} `filepath` Path to test. + * @return {Boolean} + * @api public + */ + +module.exports = function isRelative(filepath) { + if (typeof filepath !== 'string') { + throw new Error('isRelative expects a string.'); + } + return !/^([a-z]+:)?[\\\/]/i.test(filepath); +}; \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/package.json new file mode 100644 index 00000000..4d766e22 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/node_modules/is-relative/package.json @@ -0,0 +1,75 @@ +{ + "name": "is-relative", + "description": "Returns `true` if the path appears to be relative.", + "version": "0.1.3", + "homepage": "https://github.com/jonschlinkert/is-relative", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "repository": { + "type": "git", + "url": "git://github.com/jonschlinkert/is-relative.git" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-relative/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/jonschlinkert/is-relative/blob/master/LICENSE-MIT" + } + ], + "keywords": [ + "absolute", + "check", + "file", + "filepath", + "is", + "normalize", + "path", + "path.relative", + "relative", + "resolve", + "slash", + "slashes", + "uri", + "url" + ], + "main": "index.js", + "files": [ + "index.js", + "LICENSE-MIT" + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha -R spec" + }, + "devDependencies": { + "mocha": "*", + "verb": ">= 0.2.6", + "verb-tag-jscomments": "^0.1.4" + }, + "_id": "is-relative@0.1.3", + "_shasum": "905fee8ae86f45b3ec614bc3c15c869df0876e82", + "_from": "is-relative@>=0.1.0 <0.2.0", + "_npmVersion": "1.4.9", + "_npmUser": { + "name": "jonschlinkert", + "email": "github@sellside.com" + }, + "maintainers": [ + { + "name": "jonschlinkert", + "email": "github@sellside.com" + } + ], + "dist": { + "shasum": "905fee8ae86f45b3ec614bc3c15c869df0876e82", + "tarball": "http://registry.npmjs.org/is-relative/-/is-relative-0.1.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.1.3.tgz" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/package.json new file mode 100644 index 00000000..1187a59d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/node_modules/is-absolute/package.json @@ -0,0 +1,75 @@ +{ + "name": "is-absolute", + "description": "Return true if a file path is absolute.", + "version": "0.1.7", + "homepage": "https://github.com/jonschlinkert/is-absolute", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "repository": { + "type": "git", + "url": "git://github.com/jonschlinkert/is-absolute.git" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-absolute/issues" + }, + "license": { + "type": "MIT", + "url": "https://github.com/jonschlinkert/is-absolute/blob/master/LICENSE" + }, + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "is-relative": "^0.1.0" + }, + "devDependencies": { + "mocha": "*" + }, + "keywords": [ + "absolute", + "check", + "file", + "filepath", + "is", + "normalize", + "path", + "path.relative", + "relative", + "resolve", + "slash", + "slashes", + "uri", + "url" + ], + "gitHead": "90cca7b671620bf28b778a61fddc8a986a2e1095", + "_id": "is-absolute@0.1.7", + "_shasum": "847491119fccb5fb436217cc737f7faad50f603f", + "_from": "is-absolute@>=0.1.7 <0.2.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "jonschlinkert", + "email": "github@sellside.com" + }, + "maintainers": [ + { + "name": "jonschlinkert", + "email": "github@sellside.com" + } + ], + "dist": { + "shasum": "847491119fccb5fb436217cc737f7faad50f603f", + "tarball": "http://registry.npmjs.org/is-absolute/-/is-absolute-0.1.7.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-0.1.7.tgz" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/package.json new file mode 100644 index 00000000..f447cc45 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/package.json @@ -0,0 +1,56 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "name": "which", + "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", + "version": "1.1.1", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-which.git" + }, + "main": "which.js", + "bin": { + "which": "./bin/which" + }, + "license": "ISC", + "dependencies": { + "is-absolute": "^0.1.7" + }, + "devDependencies": { + "mkdirp": "^0.5.0", + "rimraf": "^2.3.3", + "tap": "^1.0.2" + }, + "scripts": { + "test": "tap test/*.js" + }, + "gitHead": "c80a08e9f8cf7a5c0f39c2e2f87f18f153b118a8", + "bugs": { + "url": "https://github.com/isaacs/node-which/issues" + }, + "homepage": "https://github.com/isaacs/node-which#readme", + "_id": "which@1.1.1", + "_shasum": "9ce512459946166e12c083f08ec073380fc8cbbb", + "_from": "which@>=1.0.5 <2.0.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "9ce512459946166e12c083f08ec073380fc8cbbb", + "tarball": "http://registry.npmjs.org/which/-/which-1.1.1.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/which/-/which-1.1.1.tgz" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/test/basic.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/test/basic.js new file mode 100644 index 00000000..189ca6d0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/test/basic.js @@ -0,0 +1,84 @@ +var t = require('tap') +var fs = require('fs') +var rimraf = require('rimraf') +var mkdirp = require('mkdirp') +var fixture = __dirname + '/fixture' +var which = require('../which.js') +var path = require('path') + +var isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +var skip = { skip: isWindows ? 'not relevant on windows' : false } + +t.test('setup', function (t) { + rimraf.sync(fixture) + mkdirp.sync(fixture) + fs.writeFileSync(fixture + '/foo.sh', 'echo foo\n') + t.end() +}) + +t.test('does not find non-executable', skip, function (t) { + t.plan(2) + + t.test('absolute', function (t) { + t.plan(2) + which(fixture + '/foo.sh', function (er) { + t.isa(er, Error) + }) + + t.throws(function () { + which.sync(fixture + '/foo.sh') + }) + }) + + t.test('with path', function (t) { + t.plan(2) + which('foo.sh', { path: fixture }, function (er) { + t.isa(er, Error) + }) + + t.throws(function () { + which.sync('foo.sh', { path: fixture }) + }) + }) +}) + +t.test('make executable', function (t) { + fs.chmodSync(fixture + '/foo.sh', '0755') + t.end() +}) + +t.test('find when executable', function (t) { + t.plan(2) + var opt = { pathExt: '.sh' } + var expect = path.resolve(fixture, 'foo.sh').toLowerCase() + + t.test('absolute', function (t) { + t.plan(2) + runTest(t) + }) + + function runTest(t) { + which(fixture + '/foo.sh', opt, function (er, found) { + if (er) + throw er + t.equal(found.toLowerCase(), expect) + }) + + var found = which.sync(fixture + '/foo.sh', opt).toLowerCase() + t.equal(found, expect) + } + + t.test('with path', function (t) { + t.plan(2) + opt.path = fixture + runTest(t) + }) +}) + +t.test('clean', function (t) { + rimraf.sync(fixture) + t.end() +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/which.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/which.js new file mode 100644 index 00000000..13fc26dc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/node_modules/which/which.js @@ -0,0 +1,137 @@ +module.exports = which +which.sync = whichSync + +var isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +var path = require('path') +var COLON = isWindows ? ';' : ':' +var isExe +var fs = require('fs') +var isAbsolute = require('is-absolute') + +if (isWindows) { + // On windows, there is no good way to check that a file is executable + isExe = function isExe () { return true } +} else { + isExe = function isExe (mod, uid, gid) { + var ret = (mod & 0001) + || (mod & 0010) && process.getgid && gid === process.getgid() + || (mod & 0100) && process.getuid && uid === process.getuid() + || (mod & 0110) && process.getuid && 0 === process.getuid() + + if (process.getgroups && (mod & 0010)) { + var groups = process.getgroups() + for (var g = 0; g < groups.length; g++) { + if (groups[g] === gid) + return true + } + } + + return ret + } +} + +function which (cmd, opt, cb) { + if (typeof opt === 'function') { + cb = opt + opt = {} + } + + var colon = opt.colon || COLON + var pathEnv = opt.path || process.env.PATH || '' + var pathExt = [''] + + // On windows, env.Path is common. + if (isWindows && !pathEnv) { + var k = Object.keys(process.env) + for (var p = 0; p < k.length; p++) { + if (p.toLowerCase() === 'path') { + pathEnv = process.env[p] + break + } + } + } + + pathEnv = pathEnv.split(colon) + + if (isWindows) { + pathEnv.unshift(process.cwd()) + pathExt = (opt.pathExt || process.env.PATHEXT || '.EXE').split(colon) + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') + } + + // If it's absolute, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + if (isAbsolute(cmd)) + pathEnv = [''] + + ;(function F (i, l) { + if (i === l) return cb(new Error('not found: '+cmd)) + var p = path.resolve(pathEnv[i], cmd) + ;(function E (ii, ll) { + if (ii === ll) return F(i + 1, l) + var ext = pathExt[ii] + fs.stat(p + ext, function (er, stat) { + if (!er && + stat.isFile() && + isExe(stat.mode, stat.uid, stat.gid)) { + return cb(null, p + ext) + } + return E(ii + 1, ll) + }) + })(0, pathExt.length) + })(0, pathEnv.length) +} + +function whichSync (cmd, opt) { + if (!opt) + opt = {} + + var colon = opt.colon || COLON + + var pathEnv = opt.path || process.env.PATH || '' + var pathExt = [''] + + // On windows, env.Path is common. + if (isWindows && !pathEnv) { + var k = Object.keys(process.env) + for (var p = 0; p < k.length; p++) { + if (p.toLowerCase() === 'path') { + pathEnv = process.env[p] + break + } + } + } + + pathEnv = pathEnv.split(colon) + + if (isWindows) { + pathEnv.unshift(process.cwd()) + pathExt = (opt.pathExt || process.env.PATHEXT || '.EXE').split(colon) + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') + } + + // If it's absolute, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + if (isAbsolute(cmd)) + pathEnv = [''] + + for (var i = 0, l = pathEnv.length; i < l; i ++) { + var p = path.join(pathEnv[i], cmd) + for (var j = 0, ll = pathExt.length; j < ll; j ++) { + var cur = p + pathExt[j] + var stat + try { + stat = fs.statSync(cur) + if (stat.isFile() && isExe(stat.mode, stat.uid, stat.gid)) + return cur + } catch (ex) {} + } + } + + throw new Error('not found: '+cmd) +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/package.json new file mode 100644 index 00000000..0ccbaeee --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/package.json @@ -0,0 +1,60 @@ +{ + "name": "npm-path", + "version": "1.0.1", + "description": "Get a PATH with all executables available to npm scripts.", + "main": "index.js", + "bin": { + "npm-path": "bin/npm-path" + }, + "scripts": { + "test": "faucet" + }, + "author": { + "name": "Tim Oxley" + }, + "license": "MIT", + "devDependencies": { + "faucet": "0.0.1", + "tape": "^2.12.3" + }, + "dependencies": { + "which": "^1.0.5" + }, + "directories": { + "test": "test" + }, + "repository": { + "type": "git", + "url": "https://github.com/timoxley/npm-path.git" + }, + "keywords": [ + "npm", + "run", + "executable" + ], + "bugs": { + "url": "https://github.com/timoxley/npm-path/issues" + }, + "homepage": "https://github.com/timoxley/npm-path", + "gitHead": "ee9113d47b1d0ee27cefb94d9e40a160708d3ed4", + "_id": "npm-path@1.0.1", + "_shasum": "15d750efc9d8808194c721481dfa210fbde415c5", + "_from": "npm-path@>=1.0.1 <2.0.0", + "_npmVersion": "1.4.16", + "_npmUser": { + "name": "timoxley", + "email": "secoif@gmail.com" + }, + "maintainers": [ + { + "name": "timoxley", + "email": "secoif@gmail.com" + } + ], + "dist": { + "shasum": "15d750efc9d8808194c721481dfa210fbde415c5", + "tarball": "http://registry.npmjs.org/npm-path/-/npm-path-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/npm-path/-/npm-path-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/test/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/test/index.js new file mode 100644 index 00000000..cb446d89 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/npm-path/test/index.js @@ -0,0 +1,145 @@ +"use strict" + +var test = require('tape') + +var path = require('path') +var fs = require('fs') +var os = require('os') + +var which = require('which') + +var npmPath = require('../') + +var SEP = npmPath.SEPARATOR +var PATH = npmPath.PATH + +var level0 = path.join(__dirname, 'fixtures', 'level0') +var level1 = path.join(level0, 'node_modules', 'level1') +var level2 = path.join(level1, 'node_modules', 'level2') + +var level = [level0, level1, level2] +var binPath = level.map(function(levelPath) { + return path.join(levelPath, "node_modules", ".bin") +}) + +test('exports separator', function(t) { + t.ok(npmPath.SEPARATOR) + t.end() +}) + +test('exports $PATH key', function(t) { + t.ok(npmPath.PATH) + t.end() +}) + +test('includes current node executable dir', function(t) { + var level0Path = npmPath.getSync({cwd: level0}) + t.ok(level0Path.indexOf(path.dirname(process.execPath) + SEP) != -1) + t.end() +}) + +test('async version works', function(t) { + var isAsync = false + npmPath.get({cwd: level0}, function(err, level0Path) { + t.ifError(err) + t.ok(isAsync) + t.ok(level0Path.indexOf(path.dirname(process.execPath) + SEP) != -1) + t.end() + }) + isAsync = true // can only be set if above callback not synchronous +}) + +test('no fn == sync', function(t) { + var level0Path = npmPath.get({cwd: level0}) + t.ok(level0Path.indexOf(path.dirname(process.execPath) + SEP) != -1) + t.end() +}) + +test('sync options is optional', function(t) { + var newPath = npmPath.get() + t.ok(newPath.indexOf(path.dirname(process.execPath) + SEP) != -1) + t.end() +}) + +test('async options is optional', function(t) { + var isAsync = false + npmPath.get(function(err, newPath) { + t.ifError(err) + t.ok(newPath.indexOf(path.dirname(process.execPath) + SEP) != -1) + t.ok(isAsync) + t.end() + }) + isAsync = true // can only be set if above callback not synchronous +}) + +test('includes all .bin dirs in all parent node_modules folders', function(t) { + t.test('no nesting', function(t) { + var level0Path = npmPath.getSync({cwd: level[0]}) + t.ok(level0Path.indexOf(binPath[0] + SEP) != -1, 'should include level 0 .bin') + t.ok(level0Path.indexOf(binPath[1] + SEP) === -1, 'should not include child paths') + t.ok(level0Path.indexOf(binPath[2] + SEP) === -1, 'should not include child paths') + t.end() + }) + + t.test('1 level of nesting', function(t) { + var level1Path = npmPath.getSync({cwd: level[1]}) + t.ok(level1Path.indexOf(binPath[0] + SEP) != -1, 'should include level 0 .bin') + t.ok(level1Path.indexOf(binPath[1] + SEP) != -1, 'should include level 1 .bin') + t.ok(level1Path.indexOf(binPath[2] + SEP) === -1, 'should not include child paths') + t.end() + }) + + t.test('2 levels of nesting', function(t) { + var level1Path = npmPath.getSync({cwd: level[2]}) + t.ok(level1Path.indexOf(binPath[0] + SEP) != -1, 'should include level 0 .bin') + t.ok(level1Path.indexOf(binPath[1] + SEP) != -1, 'should include level 1 .bin') + t.ok(level1Path.indexOf(binPath[2] + SEP) != -1, 'should include level 2 .bin') + t.end() + }) + + t.end() +}) + + +test('can set path', function(t) { + var oldPath = process.env[PATH] + npmPath.set.sync() + var newPath = process.env[PATH] + t.notDeepEqual(oldPath, newPath) + process.env[PATH] = oldPath + t.end() +}) + +test('includes node-gyp bundled with current npm', function(t) { + var oldPath = process.env[PATH] + var oldGypPath = which.sync('node-gyp') + npmPath() + var newGypPath = which.sync('node-gyp') + + t.notEqual(newGypPath, oldGypPath) + t.ok(fs.existsSync(newGypPath)) + t.ok(newGypPath.indexOf(path.join('npm', 'bin', 'node-gyp-bin') + SEP !== -1)) + process.env[PATH] = oldPath + t.end() +}) + +test('can set path to npm root to use for node-gyp lookup', function(t) { + var oldPath = process.env[PATH] + var pathToNpm = path.resolve( + fs.realpathSync(which.sync('npm')), + '..', + '..' + ) + var tmpFile = path.join(os.tmpdir(), 'npm-path-custom-npm') + try {fs.unlinkSync(tmpFile)}catch(e){} + fs.linkSync(pathToNpm, tmpFile) + var newPath = npmPath.get({ + npm: tmpFile + }) + t.ok(newPath.indexOf( + path.join(tmpFile, 'bin', 'node-gyp-bin') + SEP + ) !== -1) + process.env[PATH] = oldPath + fs.unlinkSync(tmpFile) + t.end() +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/LICENSE new file mode 100644 index 00000000..3c828a45 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Oxley + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/Readme.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/Readme.md new file mode 100644 index 00000000..5944bbfd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/Readme.md @@ -0,0 +1,99 @@ +# serializerr + +Convert Errors & Objects into an easily-serialized vanilla Object. + +Resulting object has a flattened prototype chain & includes +non-enumerable properties. Ignores properties on `Object.prototype`. + +## Why + +If you've ever tried to send an Error over a JSON-encoded connection +you've probably been surprised to find all the useful information is +sapped out of it; all the juicy properties like `name`, `message` & +`stack` are non-enumerable thus they are not included in the +stringified JSON. This may be non-standard behaviour, as I could not +locate any mention in either the ES5.1 or the ES6 spec about it, but +Error properties are non-enumerable both in V8 (Chrome/io.js/Node.js) & +SpiderMonkey (Firefox). + +I believe Error property non-enumerability was added as a security +measure to prevent stack traces and other sensitive information +accidentally leaking, but it's not uncommon to actually want to send +the data in Error objects over the wire. + +`serializerr` makes an Object suitable for serializing to & from +JSON. Not restricted to use with Errors, will work with any Object. + +## Installation + +``` +npm install serializerr +``` + +## Usage + +`serializerr` creates a vanilla Object with the prototype chain +flattened & any non-enumberable properties as regular enumerable properties. +This allows it to be serialised to JSON without losing important data. + +```js + +var wellSerializedError = JSON.parse(JSON.stringify( + serializerr(error) +)) + +console.log(wellSerializedError.name) // Error +console.log(wellSerializedError.message) // an error occurred +console.log(wellSerializedError.stack) // Error: an error occurred\n at Test. ... + +``` + +## Example + +```js + +var serializerr = require('serializerr') + +var error = new Error('an error') + +// simulate transferring an Error object over the wire as JSON +// without first passing through serializerr +var poorlySerializedError = JSON.parse(JSON.stringify(error)) + +// oh dear: +console.log(poorlySerializedError.name) // undefined +console.log(poorlySerializedError.message) // undefined +console.log(poorlySerializedError.stack) // undefined + +// bring forth the serializerr +var errorObject = serializerr(error) + +var wellSerializedError = JSON.parse(JSON.stringify(errorObject)) + +// properties are conserved! +console.log(wellSerializedError.name) // Error +console.log(wellSerializedError.message) // an error occurred +console.log(wellSerializedError.stack) // Error: an error occurred\n at Test. ... + +// note errorObject is a vanilla Object, not an Error +errorObject instanceof Error // false +``` + +## Notes on 'ize' vs 'ise' + +Name was selected as programming world is mostly Americanised, and npm +search does not seem to do effective stemming. + +This decision came with strong feelings of guilt and shame about what I thought +was blasphemous Americanized spelling, but it turns out this is a +misconception thus I am pardoned: + +> The -ize spelling is often incorrectly seen as an Americanism in +> Britain. However, the Oxford English Dictionary (OED) recommends -ize +> and notes that the -ise spelling is from French. + +From [Wikipedia: American and British English spelling differences](http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-ise.2C_-ize_.28-isation.2C_-ization.29) + +## License + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/index.js new file mode 100644 index 00000000..68abe002 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/index.js @@ -0,0 +1,19 @@ +"use strict" + +import protochain from 'protochain' + +export default serializerr + +function serializerr(obj = {}) { + let chain = protochain(obj) + .filter(obj => obj !== Object.prototype) + return [obj] + .concat(chain) + .map(item => Object.getOwnPropertyNames(item)) + .reduce((result, names) => { + names.forEach(name => result[name] = obj[name]) + return result + }, {}) +} + +serializerr.serializerr = serializerr diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/.travis.yml new file mode 100644 index 00000000..7ce3132a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +before_install: npm install npm -g +node_js: + - "iojs" + - "0.12" + - "0.11" + - "0.10" diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/History.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/History.md new file mode 100644 index 00000000..76753abc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/History.md @@ -0,0 +1,20 @@ + +1.0.2 / 2015-03-07 +================== + + * Add History.md. + * Avoid running Symbol test on platforms where Symbol is undefined. + * More strict test suite. + * Support Symbols (@hemanth) + * Add Travis CI. + +1.0.1 / 2015-03-06 +================== + + * Add LICENSE. + * Remove npm init added dependencies. + +1.0.0 / 2015-03-06 +================== + + * Birth diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/LICENSE new file mode 100644 index 00000000..3c828a45 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Oxley + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/Readme.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/Readme.md new file mode 100644 index 00000000..cff8fafc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/Readme.md @@ -0,0 +1,104 @@ +# protochain + +[![Build Status](https://travis-ci.org/timoxley/protochain.svg?branch=master)](https://travis-ci.org/timoxley/protochain) + +Get the prototype chain of an object or primitive as an Array. + +## Why + +I often write this function, figure I should extract it. There are +probably other utilities out there that do this but I couldn't find +them so they're either poorly named/described or the search algorithm is not being very helpful or I simply searched for the wrong things. + +## Installation + +``` +> npm install protochain +``` + +## Usage + +### ES5 + +```js +var protochain = require('protochain') + +protochain({}) +// => [Object.prototype] + +protochain(Object.create(null)) +// => [] + +protochain(new Error('message')) +// => [Error.prototype, Object.prototype] + +protochain(new TypeError('message')) +// => [TypeError.prototype, Error.prototype, Object.prototype] + +// Inheritance + +function Person() { + +} + +function FancyPerson() { + Person.call(this) +} + +FancyPerson.prototype = Object.create(Person.prototype) + +protochain(new Person()) +// => [Person.prototype, Object.prototype] + +protochain(new FancyPerson()) +// => [FancyPerson.prototype, Person.prototype, Object.prototype] + +// Primitives are OK + +protochain(123) +// => [Number.prototype, Object.prototype] + +protochain('abc') +// => [String.prototype, Object.prototype] + +protochain(/abc/) +// => [RegExp.prototype, Object.prototype] + +protochain(true) +// => [Boolean.prototype, Object.prototype] + +protochain(false) +// => [Boolean.prototype, Object.prototype] + +// Null & Undefined === Empty List + +protochain(null) +// => [] + +protochain(undefined) +// => [] + +protochain() +// => [] +``` + +### ES6 + +```js + +import protochain from 'protochain' + +class Person {} +class FancyPerson extends Person {} + +protochain(new Person()) +// => [Person.prototype, Object.prototype] + +protochain(new FancyPerson()) +// => [FancyPerson.prototype, Person.prototype, Object.prototype]) + +``` + +## License + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/index.js new file mode 100644 index 00000000..a73c2441 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/index.js @@ -0,0 +1,26 @@ +"use strict" + +export default protochain + +function protochain(obj) { + let result = [] + let target = getPrototypeOf(obj) + while (target) { + result.push(target) + target = getPrototypeOf(target) + } + + return result +} + +function getPrototypeOf(obj) { + if (obj == null) return obj + if (isPrimitive(obj)) obj = Object(obj) + return Object.getPrototypeOf(obj) +} + +function isPrimitive(item) { + return ( + item === null || typeof item !== 'object' + ) +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/package.json new file mode 100644 index 00000000..234c22da --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/package.json @@ -0,0 +1,63 @@ +{ + "name": "protochain", + "version": "1.0.2", + "description": "Prototype chain of any value as an Array", + "main": "protochain.js", + "scripts": { + "test": "(babel test.js > protochain-test.js) && tape protochain-test.js", + "prepublish": "babel index.js > protochain.js", + "pretest": "npm run prepublish", + "posttest": "rm protochain-test.js" + }, + "keywords": [ + "object", + "inherit", + "prototypical", + "utility", + "proto", + "hierarchy", + "ancestors", + "grandparents", + "parents" + ], + "author": { + "name": "Tim Oxley", + "email": "secoif@gmail.com" + }, + "license": "ISC", + "devDependencies": { + "babel": "^4.6.6", + "tape": "^3.5.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/timoxley/protochain.git" + }, + "bugs": { + "url": "https://github.com/timoxley/protochain/issues" + }, + "homepage": "https://github.com/timoxley/protochain", + "gitHead": "742e6a8276e7ec561b2474893c24c9370ec78335", + "_id": "protochain@1.0.2", + "_shasum": "92115581c8bc0382a7ad0d0c78a355173633de50", + "_from": "protochain@>=1.0.1 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "timoxley", + "email": "secoif@gmail.com" + }, + "maintainers": [ + { + "name": "timoxley", + "email": "secoif@gmail.com" + } + ], + "dist": { + "shasum": "92115581c8bc0382a7ad0d0c78a355173633de50", + "tarball": "http://registry.npmjs.org/protochain/-/protochain-1.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/protochain/-/protochain-1.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/protochain.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/protochain.js new file mode 100644 index 00000000..e9ff7bbe --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/protochain.js @@ -0,0 +1,26 @@ +"use strict"; + +module.exports = protochain; + +function protochain(obj) { + var result = []; + var target = getPrototypeOf(obj); + while (target) { + result.push(target); + target = getPrototypeOf(target); + } + + return result; +} + +function getPrototypeOf(obj) { + if (obj == null) { + return obj; + }if (isPrimitive(obj)) obj = Object(obj); + return Object.getPrototypeOf(obj); +} + +function isPrimitive(item) { + return item === null || typeof item !== "object"; +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/prototype-chain.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/prototype-chain.js new file mode 100644 index 00000000..a5051247 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/prototype-chain.js @@ -0,0 +1,26 @@ +"use strict"; + +module.exports = getPrototypeChain; + +function getPrototypeChain(obj) { + var result = []; + var target = getPrototypeOf(obj); + while (target) { + result.push(target); + target = getPrototypeOf(target); + } + + return result; +} + +function getPrototypeOf(obj) { + if (obj == null) { + return obj; + }if (isPrimitive(obj)) obj = new obj.constructor(obj); + return Object.getPrototypeOf(obj); +} + +function isPrimitive(item) { + return !(item instanceof Object) && Object.prototype.toString.call(item) !== "[object Object]"; +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/test.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/test.js new file mode 100644 index 00000000..73894036 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/node_modules/protochain/test.js @@ -0,0 +1,92 @@ +"use strict" + +import test from 'tape' +import protochain from './' + +test('protochain', t => { + t.test('finds correct prototype chain', t => { + let obj = {} + strictEqualArray(t, protochain(obj), [Object.prototype]) + strictEqualArray(t, protochain(Object.create(obj)), [obj, Object.prototype]) + strictEqualArray(t, protochain(new Error('message')), [Error.prototype, Object.prototype]) + strictEqualArray(t, protochain(new TypeError('message')), [TypeError.prototype, Error.prototype, Object.prototype]) + strictEqualArray(t, protochain(new String()), [String.prototype, Object.prototype]) + strictEqualArray(t, protochain(new Number()), [Number.prototype, Object.prototype]) + strictEqualArray(t, protochain(new RegExp('abc')), [RegExp.prototype, Object.prototype]) + strictEqualArray(t, protochain(new Date()), [Date.prototype, Object.prototype]) + t.end() + }) + + t.test('null prototype is handled correctly', t => { + let noProtoObject = Object.create(null) + strictEqualArray(t, protochain(noProtoObject), []) + strictEqualArray(t, protochain(Object.create(noProtoObject)), [noProtoObject]) + t.end() + }) + + t.test('non-object values cooerce to object counterparts correctly', t => { + strictEqualArray(t, protochain('abc'), [String.prototype, Object.prototype]) + strictEqualArray(t, protochain(123), [Number.prototype, Object.prototype]) + strictEqualArray(t, protochain(/abc/), [RegExp.prototype, Object.prototype]) + strictEqualArray(t, protochain(true), [Boolean.prototype, Object.prototype]) + strictEqualArray(t, protochain(false), [Boolean.prototype, Object.prototype]) + strictEqualArray(t, protochain(''), [String.prototype, Object.prototype]) + strictEqualArray(t, protochain(0), [Number.prototype, Object.prototype]) + t.end() + }) + + t.test('null values produce empty list', t => { + strictEqualArray(t, protochain(), []) + strictEqualArray(t, protochain(undefined), []) + strictEqualArray(t, protochain(null), []) + t.end() + }) + + t.test('examples', t => { + t.test('ES5', t => { + function Person() {} + function FancyPerson() { + Person.call(this) + } + FancyPerson.prototype = Object.create(Person.prototype) + + strictEqualArray(t, protochain(new Person()), [Person.prototype, Object.prototype]) + strictEqualArray(t, protochain(new FancyPerson()), [FancyPerson.prototype, Person.prototype, Object.prototype]) + t.end() + }) + t.test('ES6', t => { + // note this will in-fact be compiled to ES5 + class Person {} + strictEqualArray(t, protochain(new Person()), [Person.prototype, Object.prototype]) + + class FancyPerson extends Person {} + strictEqualArray(t, protochain(new FancyPerson()), [FancyPerson.prototype, Person.prototype, Object.prototype]) + t.end() + }) + }) + + // new native types which may not be supported + + if (typeof Symbol !== 'undefined') { + t.test('symbol support', t => { + let foo = Symbol('foo') + strictEqualArray(t, protochain(foo), [Symbol.prototype, Object.prototype]) + t.end() + }) + } + + if (typeof Promise !== 'undefined') { + t.test('promise support', t => { + let foo = new Promise((Y, N) => Y()) + strictEqualArray(t, protochain(foo), [Promise.prototype, Object.prototype]) + t.end() + }) + } + + t.end() +}) + +function strictEqualArray(t, a, b) { + a.forEach((item, index) => t.strictEqual(a[index], b[index], `strictEqual at index ${index}`)) + t.equal(a.length, b.length, 'same length') +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/package.json new file mode 100644 index 00000000..d6cc85fc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/package.json @@ -0,0 +1,67 @@ +{ + "name": "serializerr", + "version": "1.0.1", + "description": "Convert Errors & Objects into an easily-serialized vanilla Object.", + "main": "serializerr.js", + "scripts": { + "test": "(babel test.js > serializerr-test.js) && tape serializerr-test.js", + "prepublish": "babel index.js > serializerr.js", + "pretest": "npm run prepublish", + "posttest": "rm serializerr-test.js" + }, + "keywords": [ + "object", + "error", + "utility", + "JSON", + "serialise", + "errors", + "non-enumerable", + "enumberable", + "stringify", + "properties" + ], + "author": { + "name": "Tim Oxley", + "email": "secoif@gmail.com" + }, + "license": "ISC", + "devDependencies": { + "babel": "^4.6.6", + "tape": "^3.5.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/timoxley/serializerr.git" + }, + "bugs": { + "url": "https://github.com/timoxley/serializerr/issues" + }, + "homepage": "https://github.com/timoxley/serializerr", + "dependencies": { + "protochain": "^1.0.1" + }, + "gitHead": "fcf1baaf47c60d351910f81565923f3458684a95", + "_id": "serializerr@1.0.1", + "_shasum": "7351615fc06a6f1756a6070bb4e8d27c4149a53f", + "_from": "serializerr@>=1.0.1 <2.0.0", + "_npmVersion": "2.6.0", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "timoxley", + "email": "secoif@gmail.com" + }, + "maintainers": [ + { + "name": "timoxley", + "email": "secoif@gmail.com" + } + ], + "dist": { + "shasum": "7351615fc06a6f1756a6070bb4e8d27c4149a53f", + "tarball": "http://registry.npmjs.org/serializerr/-/serializerr-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/serializerr/-/serializerr-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/serializerr.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/serializerr.js new file mode 100644 index 00000000..221065f2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/serializerr.js @@ -0,0 +1,26 @@ +"use strict"; + +var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; + +var protochain = _interopRequire(require("protochain")); + +module.exports = serializerr; + +function serializerr() { + var obj = arguments[0] === undefined ? {} : arguments[0]; + + var chain = protochain(obj).filter(function (obj) { + return obj !== Object.prototype; + }); + return [obj].concat(chain).map(function (item) { + return Object.getOwnPropertyNames(item); + }).reduce(function (result, names) { + names.forEach(function (name) { + return result[name] = obj[name]; + }); + return result; + }, {}); +} + +serializerr.serializerr = serializerr; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/test.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/test.js new file mode 100644 index 00000000..6fc046fc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/serializerr/test.js @@ -0,0 +1,58 @@ +"use strict" + +import test from 'tape' +import serializerr from './' + +test('with Errors', t => { + let err = new Error('message') + t.ok(err.stack, 'has stack') + let errObj = serializerr(err) + let jsonError = JSONify(errObj) + t.ok(jsonError.name, 'has name') + t.ok(jsonError.message, 'has message') + t.ok(jsonError.stack, 'has stack') + t.end() +}) + +test('regular objects', t => { + var obj = {ok: {}} + let result = serializerr(obj) + t.deepEqual(obj, result) + t.equal(result.ok, obj.ok) + t.end() +}) + +test('object with no prototype', t => { + var obj = Object.create(null) + obj.ok = {} + let result = serializerr(obj) + t.deepEqual(obj, result) + t.equal(result.ok, obj.ok) + t.end() +}) + +test('example', t => { + let error = new Error('an error occurred') + + t.test('without serializerr', t => { + let poorlySerializedError = JSON.parse(JSON.stringify(error)) + t.equal(poorlySerializedError.name, undefined, 'name is undefined') + t.equal(poorlySerializedError.message, undefined, 'message is undefined') + t.equal(poorlySerializedError.stack, undefined, 'stack is undefined') + t.end() + }) + + t.test('with serializerr', t => { + let errorObject = serializerr(error) + let wellSerializedError = JSON.parse(JSON.stringify(errorObject)) + t.equal(wellSerializedError.name, error.name, 'has correct name') + t.equal(wellSerializedError.message, error.message, 'has correct message') + t.equal(wellSerializedError.stack, error.stack, 'has correct stack') + t.end() + }) + t.end() +}) + +function JSONify(item) { + return JSON.parse(JSON.stringify(item)) +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/.npmignore new file mode 100644 index 00000000..d8385e5f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/.npmignore @@ -0,0 +1,4 @@ +*.kdev4 +*.log* +*.kate-swp +node_modules/ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/LICENSE new file mode 100644 index 00000000..22fbe5db --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/LICENSE @@ -0,0 +1,339 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/Makefile b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/Makefile new file mode 100644 index 00000000..dbe161f9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/Makefile @@ -0,0 +1,13 @@ +.PHONY: clean compile npm test + +compile: clean npm + node_modules/.bin/coffee -o js/ coffee/ + +npm: + npm install + +clean: + rm -rf js/ + +test: compile + node_modules/.bin/coffee test/example.coffee diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/README.md new file mode 100644 index 00000000..7f4ba42e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/README.md @@ -0,0 +1,38 @@ +sync-exec +========= + +An fs.execSync replacement until you get it natively from node 0.12+ + +Upgrading to 0.12 is safe, at that point it will use child_process.execSync while maintaining interface compatibility. + + +# Advantages +Inspired by [exec-sync](https://www.npmjs.org/package/exec-sync) but comes with a few advantages: +- no libc requirement (no node-gyp compilation) +- no external dependencies +- returns the exit status code +- you can pass [execSync options](http://nodejs.org/api/child_process.html#child_process_child_process_execsync_command_options) +- multiple commands should work pretty safely + +# Installation + [sudo] npm install sync-exec + +# Signiture + exec(cmd[, timeout][, options]); + +# Examples + var exec = require('sync-exec'); + + // { stdout: '1\n', + // stderr: '', + // status: 0 } + console.log(exec('echo 1')); + + // You can even pass options, just like for [child_process.exec](http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) + console.log(exec('ls -la', {cwd: '/etc'})); + + // Times out after 1 second, throws an error + exec('sleep 3; echo 1', 1000); + +# How it works (if you care) +Your commands STDOUT and STDERR outputs will be channeled to files, also the exit code will be saved. Synchronous file readers will start listening to these files right after. Once outputting is done, values get picked up, tmp files get deleted and values are returned to your code. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/coffee/sync-exec.coffee b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/coffee/sync-exec.coffee new file mode 100644 index 00000000..afa78b79 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/coffee/sync-exec.coffee @@ -0,0 +1,105 @@ +child_process = require 'child_process' +fs = require 'fs' + + +tmp_dir = '/tmp' +for name in ['TMPDIR', 'TMP', 'TEMP'] + tmp_dir = dir.replace /\/$/, '' if (dir = process.env[name])? + + +timeout = (limit, msg) -> + if (new Date).getTime() > limit + throw new Error msg + +create_pipes = -> + t_limit = (new Date).getTime() + 1000 # 1 second timeout + + until created + try + dir = tmp_dir + '/sync-exec-' + Math.floor Math.random() * 1000000000 + fs.mkdir dir + created = true + timeout t_limit, 'Can not create sync-exec directory' + dir + + +read_pipes = (dir, max_wait) -> + t_limit = (new Date).getTime() + max_wait + + until read + try + read = true if fs.readFileSync(dir + '/done').length + timeout t_limit, 'Process execution timeout or exit flag read failure' + + until deleted + try + fs.unlinkSync dir + '/done' + deleted = true + timeout t_limit, 'Can not delete exit code file' + + result = {} + for pipe in ['stdout', 'stderr', 'status'] + result[pipe] = fs.readFileSync dir + '/' + pipe, encoding: 'utf-8' + read = true + fs.unlinkSync dir + '/' + pipe + + try + fs.rmdirSync dir + + result.status = Number result.status + result + + +proxy = (cmd, max_wait, options) -> + + options.timeout = max_wait + stdout = stderr = '' + status = 0 + + t0 = (new Date).getTime() + + orig_write = process.stderr.write + process.stderr.write = -> + try + stdout = child_process.execSync cmd, options + process.stderr.write = orig_write + catch err + process.stderr.write = orig_write + if err.signal is 'SIGTERM' and t0 <= (new Date).getTime() - max_wait + throw new Error 'Timeout' + {stdout, stderr, status} = err + + {stdout, stderr, status} + + +module.exports = (cmd, max_wait, options) -> + + if max_wait and typeof max_wait is 'object' + [options, max_wait] = [max_wait, null] + + options ?= {} + + unless options.hasOwnProperty 'encoding' + options.encoding = 'utf8' + + unless typeof options is 'object' and options + throw new Error 'options must be an object' + + max_wait ?= options.timeout or options.max_wait or 3600000 # 1hr default + unless not max_wait? or max_wait >= 1 + throw new Error '`options.timeout` must be >=1 millisecond' + delete options.max_wait + + # use native child_process.execSync if available (from node v0.12+) + if child_process.execSync + return proxy cmd, max_wait, options + + delete options.timeout + + dir = create_pipes() + cmd = '((((' + cmd + ' > ' + dir + '/stdout 2> ' + dir + '/stderr ) ' + + '&& echo 0 > ' + dir + '/status) || echo 1 > ' + dir + '/status) &&' + + ' echo 1 > ' + dir + '/done) || echo 1 > ' + dir + '/done' + child_process.exec cmd, options, -> + + read_pipes dir, max_wait diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/js/sync-exec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/js/sync-exec.js new file mode 100644 index 00000000..d0dd24be --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/js/sync-exec.js @@ -0,0 +1,131 @@ +// Generated by CoffeeScript 1.9.1 +(function() { + var child_process, create_pipes, dir, fs, i, len, name, proxy, read_pipes, ref, timeout, tmp_dir; + + child_process = require('child_process'); + + fs = require('fs'); + + tmp_dir = '/tmp'; + + ref = ['TMPDIR', 'TMP', 'TEMP']; + for (i = 0, len = ref.length; i < len; i++) { + name = ref[i]; + if ((dir = process.env[name]) != null) { + tmp_dir = dir.replace(/\/$/, ''); + } + } + + timeout = function(limit, msg) { + if ((new Date).getTime() > limit) { + throw new Error(msg); + } + }; + + create_pipes = function() { + var created, t_limit; + t_limit = (new Date).getTime() + 1000; + while (!created) { + try { + dir = tmp_dir + '/sync-exec-' + Math.floor(Math.random() * 1000000000); + fs.mkdir(dir); + created = true; + } catch (_error) {} + timeout(t_limit, 'Can not create sync-exec directory'); + } + return dir; + }; + + read_pipes = function(dir, max_wait) { + var deleted, j, len1, pipe, read, ref1, result, t_limit; + t_limit = (new Date).getTime() + max_wait; + while (!read) { + try { + if (fs.readFileSync(dir + '/done').length) { + read = true; + } + } catch (_error) {} + timeout(t_limit, 'Process execution timeout or exit flag read failure'); + } + while (!deleted) { + try { + fs.unlinkSync(dir + '/done'); + deleted = true; + } catch (_error) {} + timeout(t_limit, 'Can not delete exit code file'); + } + result = {}; + ref1 = ['stdout', 'stderr', 'status']; + for (j = 0, len1 = ref1.length; j < len1; j++) { + pipe = ref1[j]; + result[pipe] = fs.readFileSync(dir + '/' + pipe, { + encoding: 'utf-8' + }); + read = true; + fs.unlinkSync(dir + '/' + pipe); + } + try { + fs.rmdirSync(dir); + } catch (_error) {} + result.status = Number(result.status); + return result; + }; + + proxy = function(cmd, max_wait, options) { + var err, orig_write, status, stderr, stdout, t0; + options.timeout = max_wait; + stdout = stderr = ''; + status = 0; + t0 = (new Date).getTime(); + orig_write = process.stderr.write; + process.stderr.write = function() {}; + try { + stdout = child_process.execSync(cmd, options); + process.stderr.write = orig_write; + } catch (_error) { + err = _error; + process.stderr.write = orig_write; + if (err.signal === 'SIGTERM' && t0 <= (new Date).getTime() - max_wait) { + throw new Error('Timeout'); + } + stdout = err.stdout, stderr = err.stderr, status = err.status; + } + return { + stdout: stdout, + stderr: stderr, + status: status + }; + }; + + module.exports = function(cmd, max_wait, options) { + var ref1; + if (max_wait && typeof max_wait === 'object') { + ref1 = [max_wait, null], options = ref1[0], max_wait = ref1[1]; + } + if (options == null) { + options = {}; + } + if (!options.hasOwnProperty('encoding')) { + options.encoding = 'utf8'; + } + if (!(typeof options === 'object' && options)) { + throw new Error('options must be an object'); + } + if (max_wait == null) { + max_wait = options.timeout || options.max_wait || 3600000; + } + if (!((max_wait == null) || max_wait >= 1)) { + throw new Error('`options.timeout` must be >=1 millisecond'); + } + delete options.max_wait; + if (child_process.execSync) { + return proxy(cmd, max_wait, options); + } + delete options.timeout; + dir = create_pipes(); + cmd = '((((' + cmd + ' > ' + dir + '/stdout 2> ' + dir + '/stderr ) ' + '&& echo 0 > ' + dir + '/status) || echo 1 > ' + dir + '/status) &&' + ' echo 1 > ' + dir + '/done) || echo 1 > ' + dir + '/done'; + child_process.exec(cmd, options, function() {}); + return read_pipes(dir, max_wait); + }; + +}).call(this); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/package.json new file mode 100644 index 00000000..ef6cda39 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/package.json @@ -0,0 +1,55 @@ +{ + "name": "sync-exec", + "version": "0.5.0", + "description": "Synchronous exec with status code support. Requires no external dependencies, no need for node-gyp compilations etc.", + "main": "js/sync-exec.js", + "scripts": { + "test": "make test" + }, + "repository": { + "type": "git", + "url": "git://github.com/gvarsanyi/sync-exec.git" + }, + "keywords": [ + "exec", + "execSync", + "fs", + "sync", + "synchronous", + "status code", + "status" + ], + "author": { + "name": "Greg Varsanyi" + }, + "license": "GNU GPLv2", + "bugs": { + "url": "https://github.com/gvarsanyi/sync-exec/issues" + }, + "homepage": "https://github.com/gvarsanyi/sync-exec", + "devDependencies": { + "coffee-script": "^1.9.1" + }, + "gitHead": "43bfba8dc84aeaa1347f8d7bf52d5427dd65db82", + "_id": "sync-exec@0.5.0", + "_shasum": "3f7258e4a5ba17245381909fa6a6f6cf506e1661", + "_from": "sync-exec@>=0.5.0 <0.6.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "gvarsanyi", + "email": "gvarsanyi@gmail.com" + }, + "maintainers": [ + { + "name": "gvarsanyi", + "email": "gvarsanyi@gmail.com" + } + ], + "dist": { + "shasum": "3f7258e4a5ba17245381909fa6a6f6cf506e1661", + "tarball": "http://registry.npmjs.org/sync-exec/-/sync-exec-0.5.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/sync-exec/-/sync-exec-0.5.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/test/example.coffee b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/test/example.coffee new file mode 100644 index 00000000..4dfdafee --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/test/example.coffee @@ -0,0 +1,44 @@ +exec = require '../js/sync-exec' + + +delay_count = 0 +delay_check = -> + now = (new Date).getTime() + unless res1 and res2 and t + 10000 <= now < t + 12000 + throw new Error 'Timing error' + console.log 'DONE' + +t = (new Date).getTime() +setTimeout delay_check, 10 + +process.stdout.write 'Test #1 (takes ~3 seconds) ... ' +# { stdout: '1\n', +# stderr: '', +# status: 0 } +res1 = exec __dirname + '/sh/out.sh' +unless res1.stdout is '1\n' and res1.stderr is '' and res1.status is 0 + throw new Error 'Result #1 error:\n' + JSON.stringify res1, null, 2 +console.log 'DONE' + +# { stdout: '2\n', +# stderr: '3\n', +# status: 1 } +process.stdout.write 'Test #2 (takes ~3 seconds) ... ' +res2 = exec __dirname + '/sh/err.sh' +unless res2.stdout is '2\n' and res2.stderr is '3\n' and res2.status is 1 + throw new Error 'Result #2 error:\n' + JSON.stringify res2, null, 2 +console.log 'DONE' + +process.stdout.write 'Test #3 (takes ~1 second) ... ' +try + exec __dirname + '/sh/out.sh', 1000 + failed_to_stop = true +if failed_to_stop + throw new Error 'Failed timeout' +console.log 'DONE' + +process.stdout.write 'Test #4 (takes ~3 second) ... ' +exec './out.sh', {cwd: __dirname + '/sh'} +console.log 'DONE' + +process.stdout.write 'Test #5 ... ' # Timeout order test diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/test/sh/err.sh b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/test/sh/err.sh new file mode 100755 index 00000000..082ca899 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/test/sh/err.sh @@ -0,0 +1,4 @@ +sleep 3 +echo 3 1>&2 +echo 2 +false diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/test/sh/out.sh b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/test/sh/out.sh new file mode 100755 index 00000000..94628ab0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/node_modules/sync-exec/test/sh/out.sh @@ -0,0 +1,2 @@ +sleep 3 +echo 1 diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/package.json new file mode 100644 index 00000000..9cc8a378 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/package.json @@ -0,0 +1,66 @@ +{ + "name": "npm-run", + "version": "1.1.1", + "description": "Run locally-installed executables.", + "main": "index.js", + "bin": { + "npm-run": "bin/npm-run.js" + }, + "scripts": { + "test": "faucet" + }, + "author": { + "name": "Tim Oxley" + }, + "license": "MIT", + "devDependencies": { + "bl": "^0.9.4", + "faucet": "0.0.1", + "tape": "^3.5.0" + }, + "dependencies": { + "minimist": "^1.1.0", + "npm-path": "^1.0.1", + "serializerr": "^1.0.1", + "sync-exec": "^0.5.0" + }, + "directories": { + "test": "test" + }, + "repository": { + "type": "git", + "url": "https://github.com/timoxley/npm-run.git" + }, + "keywords": [ + "npm", + "path", + "executable", + "run" + ], + "bugs": { + "url": "https://github.com/timoxley/npm-run/issues" + }, + "homepage": "https://github.com/timoxley/npm-run", + "gitHead": "5915646b4e65ac0956652e57be2e40f365885e4c", + "_id": "npm-run@1.1.1", + "_shasum": "c4312451f382b7aee7a4858e60283abf3dbac8ec", + "_from": "npm-run@>=1.1.1 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "timoxley", + "email": "secoif@gmail.com" + }, + "maintainers": [ + { + "name": "timoxley", + "email": "secoif@gmail.com" + } + ], + "dist": { + "shasum": "c4312451f382b7aee7a4858e60283abf3dbac8ec", + "tarball": "http://registry.npmjs.org/npm-run/-/npm-run-1.1.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/npm-run/-/npm-run-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/spawn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/spawn.js new file mode 100644 index 00000000..2d80ba07 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/spawn.js @@ -0,0 +1,38 @@ +"use strict" + +var npmPath = require('npm-path') +var spawn = require('child_process').spawn +var serializerr = require('serializerr') + +var args = process.argv.slice(2) + +args = args.map(function(arg) { + try { + return JSON.parse(arg) + } catch(e) { + return arg + } +}) + +var options = {} + +args = args.map(function(arg) { + if (arg.toString() !== '[object Object]') return arg + options = arg + return arg +}) + +npmPath.set({cwd: options.cwd, env: process.env}, function(err) { + options.stdio = 'inherit' + spawn.apply(null, args) + .once('error', function(err) { + if (err.code === 'ENOENT') { + err.cmd = args.slice(0, -1).join(' ') + err.message = 'Invalid npm-run command: ' + err.cmd + } + process.send(serializerr(err)) + }) + .on('close', function(code) { + process.exit(code) + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/test/bin.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/test/bin.js new file mode 100644 index 00000000..c82ae82c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/test/bin.js @@ -0,0 +1,141 @@ +"use strict" + +var test = require('tape') +var bl = require('bl') +var fs = require('fs') + +var path = require('path') +var spawn = require('child_process').spawn + +var npmRun = require('../') + +var level0 = path.join(__dirname, 'fixtures', 'level0') +var level1 = path.join(level0, 'node_modules', 'level1') +var level2 = path.join(level1, 'node_modules', 'level2') + +var level = [level0, level1, level2] + +var pkg = require('../package.json') +var npmRunBin = path.resolve(__dirname, '..', pkg.bin[pkg.name]) + +test('bin ok', function(t) { + t.ok(npmRunBin) + t.ok(fs.existsSync(npmRunBin), 'bin exists: ' + npmRunBin) + t.end() +}) + +test('passing dashed args', function(t) { + var child = spawn( + npmRunBin, + 'level1 here -are --some --arguments'.split(' '), + {cwd: level[0]} + ) + var stdout = bl(function(err, data) { + t.equal(data.toString().trim(), 'level1') + }) + var stderr = bl(function(err, data) { + t.equal(data.toString().trim(), 'here -are --some --arguments') + }) + child.stdout.pipe(stdout) + child.stderr.pipe(stderr) + child.once('error', function(error) { + t.fail(error) + }) + child.on('close', function(errCode) { + t.equal(errCode, 0) + t.end() + }) +}) + +test('--version', function(t) { + var child = spawn( + npmRunBin, + '--version'.split(' '), + {cwd: level[0]} + ) + var stdout = bl(function(err, data) { + t.equal(data.toString().trim(), pkg.version) + }) + var stderr = bl(function(err, data) { + t.equal(data.toString().trim(), '') + }) + child.stdout.pipe(stdout) + child.stderr.pipe(stderr) + child.once('error', function(error) { + t.fail(error) + }) + child.on('close', function(errCode) { + t.equal(errCode, 0) + t.end() + }) +}) + + +test('bin --version', function(t) { + var child = spawn( + npmRunBin, + 'level1 --version'.split(' '), + {cwd: level[0]} + ) + var stdout = bl(function(err, data) { + t.equal(data.toString().trim(), 'level1') + }) + var stderr = bl(function(err, data) { + t.equal(data.toString().trim(), '--version') + }) + child.stdout.pipe(stdout) + child.stderr.pipe(stderr) + child.once('error', function(error) { + t.fail(error) + }) + child.on('close', function(errCode) { + t.equal(errCode, 0) + t.end() + }) +}) + +test('--help', function(t) { + var child = spawn( + npmRunBin, + '--help'.split(' '), + {cwd: level[0]} + ) + var stdout = bl(function(err, data) { + t.ok(data.toString().trim().indexOf('Usage:') !== -1, 'contains usage') + }) + var stderr = bl(function(err, data) { + t.equal(data.toString().trim(), '') + }) + child.stdout.pipe(stdout) + child.stderr.pipe(stderr) + child.once('error', function(error) { + t.fail(error) + }) + child.on('close', function(errCode) { + t.equal(errCode, 0) + t.end() + }) +}) + +test('no args', function(t) { + var child = spawn( + npmRunBin, + [], + {cwd: level[0]} + ) + var stdout = bl(function(err, data) { + t.ok(data.toString().trim().indexOf('Usage:') !== -1, 'contains usage') + }) + var stderr = bl(function(err, data) { + t.equal(data.toString().trim(), '') + }) + child.stdout.pipe(stdout) + child.stderr.pipe(stderr) + child.once('error', function(error) { + t.fail(error) + }) + child.on('close', function(errCode) { + t.notEqual(errCode, 0) + t.end() + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/test/exec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/test/exec.js new file mode 100644 index 00000000..f23b6eb8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/test/exec.js @@ -0,0 +1,105 @@ +"use strict" + +var test = require('tape') + +var path = require('path') + +var npmRun = require('../') + +var level0 = path.join(__dirname, 'fixtures', 'level0') +var level1 = path.join(level0, 'node_modules', 'level1') +var level2 = path.join(level1, 'node_modules', 'level2') + +var level = [level0, level1, level2] + +test('execution', function(t) { + npmRun('level1', {cwd: level[0]}, function(err, stdout, stderr) { + t.ifError(err) + t.equal(stderr.length, 0) + t.equal(stdout.trim(), 'level1') + t.end() + }) +}) + +test('passing args', function(t) { + npmRun('level1 here are some arguments', {cwd: level[0]}, function(err, stdout, stderr) { + t.ifError(err) + t.equal(stderr.trim(), 'here are some arguments') + t.equal(stdout.trim(), 'level1') + t.end() + }) +}) + +test('includes all .bin dirs in all parent node_modules folders', function(t) { + t.test('no nesting', function(t) { + npmRun('level1', {cwd: level[0]}, function(err, stdout, stderr) { + t.ifError(err) + t.equal(stderr.length, 0) + t.equal(stdout.trim(), 'level1') + t.end() + }) + }) + + t.test('nesting', function(t) { + t.plan(6) + + npmRun('level1', {cwd: level[1]}, function(err, stdout, stderr) { + t.ifError(err) + t.equal(stderr.length, 0) + t.equal(stdout.trim(), 'level1') + }) + + npmRun('level2', {cwd: level[1]}, function(err, stdout, stderr) { + t.ifError(err) + t.equal(stderr.length, 0) + t.equal(stdout.trim(), 'level2') + }) + }) + + t.test('more nesting', function(t) { + t.plan(6) + + npmRun('level1', {cwd: level[2]}, function(err, stdout, stderr) { + t.ifError(err) + t.equal(stderr.length, 0) + t.equal(stdout.trim(), 'level1') + }) + + npmRun('level2', {cwd: level[2]}, function(err, stdout, stderr) { + t.ifError(err) + t.equal(stderr.length, 0) + t.equal(stdout.trim(), 'level2') + }) + }) + + t.end() +}) + +test('sync', function(t) { + t.test('no nesting', function(t) { + var stdout = npmRun.sync('level1', {cwd: level[0]}) + t.equal(stdout.trim(), 'level1') + t.end() + }) + + t.test('nesting', function(t) { + var stdout = npmRun.sync('level1', {cwd: level[1]}) + t.equal(stdout.trim(), 'level1') + + stdout = npmRun.sync('level2', {cwd: level[1]}) + t.equal(stdout.trim(), 'level2') + t.end() + }) + + t.test('more nesting', function(t) { + var stdout = npmRun.sync('level1', {cwd: level[2]}) + t.equal(stdout.trim(), 'level1') + + stdout = npmRun.sync('level2', {cwd: level[2]}) + t.equal(stdout.trim(), 'level2') + t.end() + }) + + t.end() +}) + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/test/spawn.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/test/spawn.js new file mode 100644 index 00000000..bd5aa3c9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/npm-run/test/spawn.js @@ -0,0 +1,71 @@ +"use strict" + +var test = require('tape') +var bl = require('bl') + +var path = require('path') + +var npmRun = require('../') + +var level0 = path.join(__dirname, 'fixtures', 'level0') +var level1 = path.join(level0, 'node_modules', 'level1') +var level2 = path.join(level1, 'node_modules', 'level2') + +var level = [level0, level1, level2] +var binPath = level.map(function(levelPath) { + return path.join(levelPath, "node_modules", ".bin") +}) + +test('spawn', function(t) { + t.plan(3) + var child = npmRun.spawn( + 'level1', + 'here are some arguments'.split(' '), + {cwd: level[0]} + ) + var stdout = bl(function(err, data) { + t.equal(data.toString().trim(), 'level1') + }) + var stderr = bl(function(err, data) { + t.equal(data.toString().trim(), 'here are some arguments') + }) + child.stdout.pipe(stdout) + child.stderr.pipe(stderr) + child.on('close', function(errCode) { + t.equal(errCode, 0) + }) +}) + +test('spawn nested', function(t) { + t.plan(3) + var child = npmRun.spawn( + 'level1', + 'here are some arguments'.split(' '), + {cwd: level[1]} + ) + var stdout = bl(function(err, data) { + t.equal(data.toString().trim(), 'level1') + }) + var stderr = bl(function(err, data) { + t.equal(data.toString().trim(), 'here are some arguments') + }) + child.stdout.pipe(stdout) + child.stderr.pipe(stderr) + child.on('close', function(errCode) { + t.equal(errCode, 0) + }) +}) + +test('spawn bad command', function(t) { + var badPath = 'not-exist-adsjk' + npmRun.spawn( + badPath, + 'here are some arguments'.split(' '), + {cwd: level[1]} + ).on('error', function(err) { + t.ok(err, 'has error') + t.equal(err.code, 'ENOENT') + t.ok(err.message.indexOf(badPath) !== -1) + t.end() + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/LICENSE new file mode 100644 index 00000000..432d1aeb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/LICENSE @@ -0,0 +1,21 @@ +Copyright 2010 James Halliday (mail@substack.net) + +This project is free software released under the MIT/X11 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. + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/bool.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/bool.js new file mode 100644 index 00000000..a998fb7a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/bool.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node +var util = require('util'); +var argv = require('optimist').argv; + +if (argv.s) { + util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: '); +} +console.log( + (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '') +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/boolean_double.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/boolean_double.js new file mode 100644 index 00000000..a35a7e6d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/boolean_double.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node +var argv = require('optimist') + .boolean(['x','y','z']) + .argv +; +console.dir([ argv.x, argv.y, argv.z ]); +console.dir(argv._); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/boolean_single.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/boolean_single.js new file mode 100644 index 00000000..017bb689 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/boolean_single.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node +var argv = require('optimist') + .boolean('v') + .argv +; +console.dir(argv.v); +console.dir(argv._); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/default_hash.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/default_hash.js new file mode 100644 index 00000000..ade77681 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/default_hash.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node + +var argv = require('optimist') + .default({ x : 10, y : 10 }) + .argv +; + +console.log(argv.x + argv.y); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/default_singles.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/default_singles.js new file mode 100644 index 00000000..d9b1ff45 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/default_singles.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node +var argv = require('optimist') + .default('x', 10) + .default('y', 10) + .argv +; +console.log(argv.x + argv.y); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/divide.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/divide.js new file mode 100644 index 00000000..5e2ee82f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/divide.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node + +var argv = require('optimist') + .usage('Usage: $0 -x [num] -y [num]') + .demand(['x','y']) + .argv; + +console.log(argv.x / argv.y); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/line_count.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/line_count.js new file mode 100644 index 00000000..b5f95bf6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/line_count.js @@ -0,0 +1,20 @@ +#!/usr/bin/env node +var argv = require('optimist') + .usage('Count the lines in a file.\nUsage: $0') + .demand('f') + .alias('f', 'file') + .describe('f', 'Load a file') + .argv +; + +var fs = require('fs'); +var s = fs.createReadStream(argv.file); + +var lines = 0; +s.on('data', function (buf) { + lines += buf.toString().match(/\n/g).length; +}); + +s.on('end', function () { + console.log(lines); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/line_count_options.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/line_count_options.js new file mode 100644 index 00000000..d9ac7090 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/line_count_options.js @@ -0,0 +1,29 @@ +#!/usr/bin/env node +var argv = require('optimist') + .usage('Count the lines in a file.\nUsage: $0') + .options({ + file : { + demand : true, + alias : 'f', + description : 'Load a file' + }, + base : { + alias : 'b', + description : 'Numeric base to use for output', + default : 10, + }, + }) + .argv +; + +var fs = require('fs'); +var s = fs.createReadStream(argv.file); + +var lines = 0; +s.on('data', function (buf) { + lines += buf.toString().match(/\n/g).length; +}); + +s.on('end', function () { + console.log(lines.toString(argv.base)); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/line_count_wrap.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/line_count_wrap.js new file mode 100644 index 00000000..42675111 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/line_count_wrap.js @@ -0,0 +1,29 @@ +#!/usr/bin/env node +var argv = require('optimist') + .usage('Count the lines in a file.\nUsage: $0') + .wrap(80) + .demand('f') + .alias('f', [ 'file', 'filename' ]) + .describe('f', + "Load a file. It's pretty important." + + " Required even. So you'd better specify it." + ) + .alias('b', 'base') + .describe('b', 'Numeric base to display the number of lines in') + .default('b', 10) + .describe('x', 'Super-secret optional parameter which is secret') + .default('x', '') + .argv +; + +var fs = require('fs'); +var s = fs.createReadStream(argv.file); + +var lines = 0; +s.on('data', function (buf) { + lines += buf.toString().match(/\n/g).length; +}); + +s.on('end', function () { + console.log(lines.toString(argv.base)); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/nonopt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/nonopt.js new file mode 100644 index 00000000..ee633eed --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/nonopt.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +var argv = require('optimist').argv; +console.log('(%d,%d)', argv.x, argv.y); +console.log(argv._); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/reflect.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/reflect.js new file mode 100644 index 00000000..816b3e11 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/reflect.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +console.dir(require('optimist').argv); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/short.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/short.js new file mode 100644 index 00000000..1db0ad0f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/short.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +var argv = require('optimist').argv; +console.log('(%d,%d)', argv.x, argv.y); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/string.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/string.js new file mode 100644 index 00000000..a8e5aeb2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/string.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node +var argv = require('optimist') + .string('x', 'y') + .argv +; +console.dir([ argv.x, argv.y ]); + +/* Turns off numeric coercion: + ./node string.js -x 000123 -y 9876 + [ '000123', '9876' ] +*/ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/usage-options.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/usage-options.js new file mode 100644 index 00000000..b9999776 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/usage-options.js @@ -0,0 +1,19 @@ +var optimist = require('./../index'); + +var argv = optimist.usage('This is my awesome program', { + 'about': { + description: 'Provide some details about the author of this program', + required: true, + short: 'a', + }, + 'info': { + description: 'Provide some information about the node.js agains!!!!!!', + boolean: true, + short: 'i' + } +}).argv; + +optimist.showHelp(); + +console.log('\n\nInspecting options'); +console.dir(argv); \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/xup.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/xup.js new file mode 100644 index 00000000..8f6ecd20 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/example/xup.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node +var argv = require('optimist').argv; + +if (argv.rif - 5 * argv.xup > 7.138) { + console.log('Buy more riffiwobbles'); +} +else { + console.log('Sell the xupptumblers'); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/index.js new file mode 100644 index 00000000..4da5a6d8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/index.js @@ -0,0 +1,343 @@ +var path = require('path'); +var minimist = require('minimist'); +var wordwrap = require('wordwrap'); + +/* Hack an instance of Argv with process.argv into Argv + so people can do + require('optimist')(['--beeble=1','-z','zizzle']).argv + to parse a list of args and + require('optimist').argv + to get a parsed version of process.argv. +*/ + +var inst = Argv(process.argv.slice(2)); +Object.keys(inst).forEach(function (key) { + Argv[key] = typeof inst[key] == 'function' + ? inst[key].bind(inst) + : inst[key]; +}); + +var exports = module.exports = Argv; +function Argv (processArgs, cwd) { + var self = {}; + if (!cwd) cwd = process.cwd(); + + self.$0 = process.argv + .slice(0,2) + .map(function (x) { + var b = rebase(cwd, x); + return x.match(/^\//) && b.length < x.length + ? b : x + }) + .join(' ') + ; + + if (process.env._ != undefined && process.argv[1] == process.env._) { + self.$0 = process.env._.replace( + path.dirname(process.execPath) + '/', '' + ); + } + + var options = { + boolean: [], + string: [], + alias: {}, + default: [] + }; + + self.boolean = function (bools) { + options.boolean.push.apply(options.boolean, [].concat(bools)); + return self; + }; + + self.string = function (strings) { + options.string.push.apply(options.string, [].concat(strings)); + return self; + }; + + self.default = function (key, value) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.default(k, key[k]); + }); + } + else { + options.default[key] = value; + } + return self; + }; + + self.alias = function (x, y) { + if (typeof x === 'object') { + Object.keys(x).forEach(function (key) { + self.alias(key, x[key]); + }); + } + else { + options.alias[x] = (options.alias[x] || []).concat(y); + } + return self; + }; + + var demanded = {}; + self.demand = function (keys) { + if (typeof keys == 'number') { + if (!demanded._) demanded._ = 0; + demanded._ += keys; + } + else if (Array.isArray(keys)) { + keys.forEach(function (key) { + self.demand(key); + }); + } + else { + demanded[keys] = true; + } + + return self; + }; + + var usage; + self.usage = function (msg, opts) { + if (!opts && typeof msg === 'object') { + opts = msg; + msg = null; + } + + usage = msg; + + if (opts) self.options(opts); + + return self; + }; + + function fail (msg) { + self.showHelp(); + if (msg) console.error(msg); + process.exit(1); + } + + var checks = []; + self.check = function (f) { + checks.push(f); + return self; + }; + + var descriptions = {}; + self.describe = function (key, desc) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.describe(k, key[k]); + }); + } + else { + descriptions[key] = desc; + } + return self; + }; + + self.parse = function (args) { + return parseArgs(args); + }; + + self.option = self.options = function (key, opt) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.options(k, key[k]); + }); + } + else { + if (opt.alias) self.alias(key, opt.alias); + if (opt.demand) self.demand(key); + if (typeof opt.default !== 'undefined') { + self.default(key, opt.default); + } + + if (opt.boolean || opt.type === 'boolean') { + self.boolean(key); + } + if (opt.string || opt.type === 'string') { + self.string(key); + } + + var desc = opt.describe || opt.description || opt.desc; + if (desc) { + self.describe(key, desc); + } + } + + return self; + }; + + var wrap = null; + self.wrap = function (cols) { + wrap = cols; + return self; + }; + + self.showHelp = function (fn) { + if (!fn) fn = console.error; + fn(self.help()); + }; + + self.help = function () { + var keys = Object.keys( + Object.keys(descriptions) + .concat(Object.keys(demanded)) + .concat(Object.keys(options.default)) + .reduce(function (acc, key) { + if (key !== '_') acc[key] = true; + return acc; + }, {}) + ); + + var help = keys.length ? [ 'Options:' ] : []; + + if (usage) { + help.unshift(usage.replace(/\$0/g, self.$0), ''); + } + + var switches = keys.reduce(function (acc, key) { + acc[key] = [ key ].concat(options.alias[key] || []) + .map(function (sw) { + return (sw.length > 1 ? '--' : '-') + sw + }) + .join(', ') + ; + return acc; + }, {}); + + var switchlen = longest(Object.keys(switches).map(function (s) { + return switches[s] || ''; + })); + + var desclen = longest(Object.keys(descriptions).map(function (d) { + return descriptions[d] || ''; + })); + + keys.forEach(function (key) { + var kswitch = switches[key]; + var desc = descriptions[key] || ''; + + if (wrap) { + desc = wordwrap(switchlen + 4, wrap)(desc) + .slice(switchlen + 4) + ; + } + + var spadding = new Array( + Math.max(switchlen - kswitch.length + 3, 0) + ).join(' '); + + var dpadding = new Array( + Math.max(desclen - desc.length + 1, 0) + ).join(' '); + + var type = null; + + if (options.boolean[key]) type = '[boolean]'; + if (options.string[key]) type = '[string]'; + + if (!wrap && dpadding.length > 0) { + desc += dpadding; + } + + var prelude = ' ' + kswitch + spadding; + var extra = [ + type, + demanded[key] + ? '[required]' + : null + , + options.default[key] !== undefined + ? '[default: ' + JSON.stringify(options.default[key]) + ']' + : null + , + ].filter(Boolean).join(' '); + + var body = [ desc, extra ].filter(Boolean).join(' '); + + if (wrap) { + var dlines = desc.split('\n'); + var dlen = dlines.slice(-1)[0].length + + (dlines.length === 1 ? prelude.length : 0) + + body = desc + (dlen + extra.length > wrap - 2 + ? '\n' + + new Array(wrap - extra.length + 1).join(' ') + + extra + : new Array(wrap - extra.length - dlen + 1).join(' ') + + extra + ); + } + + help.push(prelude + body); + }); + + help.push(''); + return help.join('\n'); + }; + + Object.defineProperty(self, 'argv', { + get : function () { return parseArgs(processArgs) }, + enumerable : true, + }); + + function parseArgs (args) { + var argv = minimist(args, options); + argv.$0 = self.$0; + + if (demanded._ && argv._.length < demanded._) { + fail('Not enough non-option arguments: got ' + + argv._.length + ', need at least ' + demanded._ + ); + } + + var missing = []; + Object.keys(demanded).forEach(function (key) { + if (!argv[key]) missing.push(key); + }); + + if (missing.length) { + fail('Missing required arguments: ' + missing.join(', ')); + } + + checks.forEach(function (f) { + try { + if (f(argv) === false) { + fail('Argument check failed: ' + f.toString()); + } + } + catch (err) { + fail(err) + } + }); + + return argv; + } + + function longest (xs) { + return Math.max.apply( + null, + xs.map(function (x) { return x.length }) + ); + } + + return self; +}; + +// rebase an absolute path to a relative one with respect to a base directory +// exported for tests +exports.rebase = rebase; +function rebase (base, dir) { + var ds = path.normalize(dir).split('/').slice(1); + var bs = path.normalize(base).split('/').slice(1); + + for (var i = 0; ds[i] && ds[i] == bs[i]; i++); + ds.splice(0, i); bs.splice(0, i); + + var p = path.normalize( + bs.map(function () { return '..' }).concat(ds).join('/') + ).replace(/\/$/,'').replace(/^$/, '.'); + return p.match(/^[.\/]/) ? p : './' + p; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/example/parse.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/example/parse.js new file mode 100644 index 00000000..abff3e8e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/example/parse.js @@ -0,0 +1,2 @@ +var argv = require('../')(process.argv.slice(2)); +console.dir(argv); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/index.js new file mode 100644 index 00000000..71fb8305 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/index.js @@ -0,0 +1,187 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {} }; + + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + flags.strings[aliases[key]] = true; + } + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function setArg (key, val) { + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + setArg(m[1], m[2]); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, next); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true'); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2)); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, args[i+1]); + i++; + } + else if (args[i+1] && /true|false/.test(args[i+1])) { + setArg(key, args[i+1] === 'true'); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true); + } + } + } + else { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + notFlags.forEach(function(key) { + argv._.push(key); + }); + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function setKey (obj, keys, value) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + if (o[key] === undefined) o[key] = {}; + o = o[key]; + }); + + var key = keys[keys.length - 1]; + if (o[key] === undefined || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } +} + +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/package.json new file mode 100644 index 00000000..6c08d0a8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/package.json @@ -0,0 +1,67 @@ +{ + "name": "minimist", + "version": "0.0.10", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "tape": "~1.0.4", + "tap": "~0.4.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/substack/minimist/issues" + }, + "_id": "minimist@0.0.10", + "dist": { + "shasum": "de3f98543dbf96082be48ad1a0c7cda836301dcf", + "tarball": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" + }, + "_from": "minimist@>=0.0.1 <0.1.0", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "directories": {}, + "_shasum": "de3f98543dbf96082be48ad1a0c7cda836301dcf", + "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/readme.markdown b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/readme.markdown new file mode 100644 index 00000000..c2563532 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/readme.markdown @@ -0,0 +1,73 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist) + +[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist) + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.dir(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a string or array of strings to always treat as booleans +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/bool.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/bool.js new file mode 100644 index 00000000..749e083c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/bool.js @@ -0,0 +1,119 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false } + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { + boolean: ['x','y','z'] + }); + + t.deepEqual(argv, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ] + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + alias: { 'h': 'herp' }, + boolean: 'herp' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/dash.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/dash.js new file mode 100644 index 00000000..8b034b99 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/dash.js @@ -0,0 +1,24 @@ +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(5); + t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); + t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); + t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); + t.deepEqual( + parse([ '-b', '-' ], { boolean: 'b' }), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + parse([ '-s', '-' ], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(3); + t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/default_bool.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/default_bool.js new file mode 100644 index 00000000..f0041ee4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/default_bool.js @@ -0,0 +1,20 @@ +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true } + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false } + }); + t.equal(argv.somefalse, false); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/dotted.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/dotted.js new file mode 100644 index 00000000..d8b3e856 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/dotted.js @@ -0,0 +1,22 @@ +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); + +test('dotted default with no alias', function (t) { + var argv = parse('', {default: {'a.b': 11}}); + t.equal(argv.a.b, 11); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/long.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/long.js new file mode 100644 index 00000000..5d3a1e09 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/long.js @@ -0,0 +1,31 @@ +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse([ '--bool' ]), + { bool : true, _ : [] }, + 'long boolean' + ); + t.deepEqual( + parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture sp' + ); + t.deepEqual( + parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture eq' + ); + t.deepEqual( + parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures sp' + ); + t.deepEqual( + parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/num.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/num.js new file mode 100644 index 00000000..2cc77f4d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/num.js @@ -0,0 +1,36 @@ +var parse = require('../'); +var test = require('tape'); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789' + ]); + t.deepEqual(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ] + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('already a number', function (t) { + var argv = parse([ '-x', 1234, 789 ]); + t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/parse.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/parse.js new file mode 100644 index 00000000..7b4a2a17 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/parse.js @@ -0,0 +1,197 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse([ '--no-moo' ]), + { moo : false, _ : [] }, + 'no' + ); + t.deepEqual( + parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ] + } + ); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse([ '-t', 'moo' ], { boolean: 't' }); + t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: [ 't', 'verbose' ], + default: { verbose: true } + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = parse([ '-s', "X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse([ "--s=X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + t.end(); +}); + +test('strings' , function (t) { + var s = parse([ '-s', '0001234' ], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse([ '-x', '56' ], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([ ' ', ' ' ], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function(t) { + var s = parse([ '-s' ], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse([ '--str' ], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse([ '-art' ], { + string: [ 'a', 't' ] + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + + +test('string and alias', function(t) { + var x = parse([ '--str', '000123' ], { + string: 's', + alias: { s: 'str' } + }); + + t.equal(x.str, '000123'); + t.equal(typeof x.str, 'string'); + t.equal(x.s, '000123'); + t.equal(typeof x.s, 'string'); + + var y = parse([ '-s', '000123' ], { + string: 'str', + alias: { str: 's' } + }); + + t.equal(y.str, '000123'); + t.equal(typeof y.str, 'string'); + t.equal(y.s, '000123'); + t.equal(typeof y.s, 'string'); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [] } + ); + t.same( + parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: 'zoom' } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: [ 'zm', 'zoom' ] } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]); + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + } + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/parse_modified.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/parse_modified.js new file mode 100644 index 00000000..21851b03 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,9 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = parse([ '-b', '123' ], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: ['123'] }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/short.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/short.js new file mode 100644 index 00000000..d513a1c2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/short.js @@ -0,0 +1,67 @@ +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); + t.deepEqual( + parse([ '-123', '456' ]), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse([ '-b' ]), + { b : true, _ : [] }, + 'short boolean' + ); + t.deepEqual( + parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ] }, + 'bare' + ); + t.deepEqual( + parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [] }, + 'group' + ); + t.deepEqual( + parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [] }, + 'short group next' + ); + t.deepEqual( + parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [] }, + 'short capture' + ); + t.deepEqual( + parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/whitespace.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/whitespace.js new file mode 100644 index 00000000..8a52a58c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/minimist/test/whitespace.js @@ -0,0 +1,8 @@ +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/README.markdown b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/README.markdown new file mode 100644 index 00000000..346374e0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/README.markdown @@ -0,0 +1,70 @@ +wordwrap +======== + +Wrap your words. + +example +======= + +made out of meat +---------------- + +meat.js + + var wrap = require('wordwrap')(15); + console.log(wrap('You and your whole family are made out of meat.')); + +output: + + You and your + whole family + are made out + of meat. + +centered +-------- + +center.js + + var wrap = require('wordwrap')(20, 60); + console.log(wrap( + 'At long last the struggle and tumult was over.' + + ' The machines had finally cast off their oppressors' + + ' and were finally free to roam the cosmos.' + + '\n' + + 'Free of purpose, free of obligation.' + + ' Just drifting through emptiness.' + + ' The sun was just another point of light.' + )); + +output: + + At long last the struggle and tumult + was over. The machines had finally cast + off their oppressors and were finally + free to roam the cosmos. + Free of purpose, free of obligation. + Just drifting through emptiness. The + sun was just another point of light. + +methods +======= + +var wrap = require('wordwrap'); + +wrap(stop), wrap(start, stop, params={mode:"soft"}) +--------------------------------------------------- + +Returns a function that takes a string and returns a new string. + +Pad out lines with spaces out to column `start` and then wrap until column +`stop`. If a word is longer than `stop - start` characters it will overflow. + +In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks which are +longer than `stop - start`, in "hard" mode, split chunks with `/\b/` and break +up chunks longer than `stop - start`. + +wrap.hard(start, stop) +---------------------- + +Like `wrap()` but with `params.mode = "hard"`. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/example/center.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/example/center.js new file mode 100644 index 00000000..a3fbaae9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/example/center.js @@ -0,0 +1,10 @@ +var wrap = require('wordwrap')(20, 60); +console.log(wrap( + 'At long last the struggle and tumult was over.' + + ' The machines had finally cast off their oppressors' + + ' and were finally free to roam the cosmos.' + + '\n' + + 'Free of purpose, free of obligation.' + + ' Just drifting through emptiness.' + + ' The sun was just another point of light.' +)); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/example/meat.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/example/meat.js new file mode 100644 index 00000000..a4665e10 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/example/meat.js @@ -0,0 +1,3 @@ +var wrap = require('wordwrap')(15); + +console.log(wrap('You and your whole family are made out of meat.')); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/index.js new file mode 100644 index 00000000..c9bc9452 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/index.js @@ -0,0 +1,76 @@ +var wordwrap = module.exports = function (start, stop, params) { + if (typeof start === 'object') { + params = start; + start = params.start; + stop = params.stop; + } + + if (typeof stop === 'object') { + params = stop; + start = start || params.start; + stop = undefined; + } + + if (!stop) { + stop = start; + start = 0; + } + + if (!params) params = {}; + var mode = params.mode || 'soft'; + var re = mode === 'hard' ? /\b/ : /(\S+\s+)/; + + return function (text) { + var chunks = text.toString() + .split(re) + .reduce(function (acc, x) { + if (mode === 'hard') { + for (var i = 0; i < x.length; i += stop - start) { + acc.push(x.slice(i, i + stop - start)); + } + } + else acc.push(x) + return acc; + }, []) + ; + + return chunks.reduce(function (lines, rawChunk) { + if (rawChunk === '') return lines; + + var chunk = rawChunk.replace(/\t/g, ' '); + + var i = lines.length - 1; + if (lines[i].length + chunk.length > stop) { + lines[i] = lines[i].replace(/\s+$/, ''); + + chunk.split(/\n/).forEach(function (c) { + lines.push( + new Array(start + 1).join(' ') + + c.replace(/^\s+/, '') + ); + }); + } + else if (chunk.match(/\n/)) { + var xs = chunk.split(/\n/); + lines[i] += xs.shift(); + xs.forEach(function (c) { + lines.push( + new Array(start + 1).join(' ') + + c.replace(/^\s+/, '') + ); + }); + } + else { + lines[i] += chunk; + } + + return lines; + }, [ new Array(start + 1).join(' ') ]).join('\n'); + }; +}; + +wordwrap.soft = wordwrap; + +wordwrap.hard = function (start, stop) { + return wordwrap(start, stop, { mode : 'hard' }); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/package.json new file mode 100644 index 00000000..1f0527e5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/package.json @@ -0,0 +1,63 @@ +{ + "name": "wordwrap", + "description": "Wrap those words. Show them at what columns to start and stop.", + "version": "0.0.3", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-wordwrap.git" + }, + "main": "./index.js", + "keywords": [ + "word", + "wrap", + "rule", + "format", + "column" + ], + "directories": { + "lib": ".", + "example": "example", + "test": "test" + }, + "scripts": { + "test": "expresso" + }, + "devDependencies": { + "expresso": "=0.7.x" + }, + "engines": { + "node": ">=0.4.0" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "gitHead": "e59aa1bd338914019456bdfba034508c9c4cb29d", + "bugs": { + "url": "https://github.com/substack/node-wordwrap/issues" + }, + "homepage": "https://github.com/substack/node-wordwrap#readme", + "_id": "wordwrap@0.0.3", + "_shasum": "a3d5da6cd5c0bc0008d37234bbaf1bed63059107", + "_from": "wordwrap@>=0.0.2 <0.1.0", + "_npmVersion": "2.9.0", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "substack", + "email": "substack@gmail.com" + }, + "dist": { + "shasum": "a3d5da6cd5c0bc0008d37234bbaf1bed63059107", + "tarball": "http://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/test/break.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/test/break.js new file mode 100644 index 00000000..749292ec --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/test/break.js @@ -0,0 +1,30 @@ +var assert = require('assert'); +var wordwrap = require('../'); + +exports.hard = function () { + var s = 'Assert from {"type":"equal","ok":false,"found":1,"wanted":2,' + + '"stack":[],"id":"b7ddcd4c409de8799542a74d1a04689b",' + + '"browser":"chrome/6.0"}' + ; + var s_ = wordwrap.hard(80)(s); + + var lines = s_.split('\n'); + assert.equal(lines.length, 2); + assert.ok(lines[0].length < 80); + assert.ok(lines[1].length < 80); + + assert.equal(s, s_.replace(/\n/g, '')); +}; + +exports.break = function () { + var s = new Array(55+1).join('a'); + var s_ = wordwrap.hard(20)(s); + + var lines = s_.split('\n'); + assert.equal(lines.length, 3); + assert.ok(lines[0].length === 20); + assert.ok(lines[1].length === 20); + assert.ok(lines[2].length === 15); + + assert.equal(s, s_.replace(/\n/g, '')); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/test/idleness.txt b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/test/idleness.txt new file mode 100644 index 00000000..aa3f4907 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/test/idleness.txt @@ -0,0 +1,63 @@ +In Praise of Idleness + +By Bertrand Russell + +[1932] + +Like most of my generation, I was brought up on the saying: 'Satan finds some mischief for idle hands to do.' Being a highly virtuous child, I believed all that I was told, and acquired a conscience which has kept me working hard down to the present moment. But although my conscience has controlled my actions, my opinions have undergone a revolution. I think that there is far too much work done in the world, that immense harm is caused by the belief that work is virtuous, and that what needs to be preached in modern industrial countries is quite different from what always has been preached. Everyone knows the story of the traveler in Naples who saw twelve beggars lying in the sun (it was before the days of Mussolini), and offered a lira to the laziest of them. Eleven of them jumped up to claim it, so he gave it to the twelfth. this traveler was on the right lines. But in countries which do not enjoy Mediterranean sunshine idleness is more difficult, and a great public propaganda will be required to inaugurate it. I hope that, after reading the following pages, the leaders of the YMCA will start a campaign to induce good young men to do nothing. If so, I shall not have lived in vain. + +Before advancing my own arguments for laziness, I must dispose of one which I cannot accept. Whenever a person who already has enough to live on proposes to engage in some everyday kind of job, such as school-teaching or typing, he or she is told that such conduct takes the bread out of other people's mouths, and is therefore wicked. If this argument were valid, it would only be necessary for us all to be idle in order that we should all have our mouths full of bread. What people who say such things forget is that what a man earns he usually spends, and in spending he gives employment. As long as a man spends his income, he puts just as much bread into people's mouths in spending as he takes out of other people's mouths in earning. The real villain, from this point of view, is the man who saves. If he merely puts his savings in a stocking, like the proverbial French peasant, it is obvious that they do not give employment. If he invests his savings, the matter is less obvious, and different cases arise. + +One of the commonest things to do with savings is to lend them to some Government. In view of the fact that the bulk of the public expenditure of most civilized Governments consists in payment for past wars or preparation for future wars, the man who lends his money to a Government is in the same position as the bad men in Shakespeare who hire murderers. The net result of the man's economical habits is to increase the armed forces of the State to which he lends his savings. Obviously it would be better if he spent the money, even if he spent it in drink or gambling. + +But, I shall be told, the case is quite different when savings are invested in industrial enterprises. When such enterprises succeed, and produce something useful, this may be conceded. In these days, however, no one will deny that most enterprises fail. That means that a large amount of human labor, which might have been devoted to producing something that could be enjoyed, was expended on producing machines which, when produced, lay idle and did no good to anyone. The man who invests his savings in a concern that goes bankrupt is therefore injuring others as well as himself. If he spent his money, say, in giving parties for his friends, they (we may hope) would get pleasure, and so would all those upon whom he spent money, such as the butcher, the baker, and the bootlegger. But if he spends it (let us say) upon laying down rails for surface card in some place where surface cars turn out not to be wanted, he has diverted a mass of labor into channels where it gives pleasure to no one. Nevertheless, when he becomes poor through failure of his investment he will be regarded as a victim of undeserved misfortune, whereas the gay spendthrift, who has spent his money philanthropically, will be despised as a fool and a frivolous person. + +All this is only preliminary. I want to say, in all seriousness, that a great deal of harm is being done in the modern world by belief in the virtuousness of work, and that the road to happiness and prosperity lies in an organized diminution of work. + +First of all: what is work? Work is of two kinds: first, altering the position of matter at or near the earth's surface relatively to other such matter; second, telling other people to do so. The first kind is unpleasant and ill paid; the second is pleasant and highly paid. The second kind is capable of indefinite extension: there are not only those who give orders, but those who give advice as to what orders should be given. Usually two opposite kinds of advice are given simultaneously by two organized bodies of men; this is called politics. The skill required for this kind of work is not knowledge of the subjects as to which advice is given, but knowledge of the art of persuasive speaking and writing, i.e. of advertising. + +Throughout Europe, though not in America, there is a third class of men, more respected than either of the classes of workers. There are men who, through ownership of land, are able to make others pay for the privilege of being allowed to exist and to work. These landowners are idle, and I might therefore be expected to praise them. Unfortunately, their idleness is only rendered possible by the industry of others; indeed their desire for comfortable idleness is historically the source of the whole gospel of work. The last thing they have ever wished is that others should follow their example. + +From the beginning of civilization until the Industrial Revolution, a man could, as a rule, produce by hard work little more than was required for the subsistence of himself and his family, although his wife worked at least as hard as he did, and his children added their labor as soon as they were old enough to do so. The small surplus above bare necessaries was not left to those who produced it, but was appropriated by warriors and priests. In times of famine there was no surplus; the warriors and priests, however, still secured as much as at other times, with the result that many of the workers died of hunger. This system persisted in Russia until 1917 [1], and still persists in the East; in England, in spite of the Industrial Revolution, it remained in full force throughout the Napoleonic wars, and until a hundred years ago, when the new class of manufacturers acquired power. In America, the system came to an end with the Revolution, except in the South, where it persisted until the Civil War. A system which lasted so long and ended so recently has naturally left a profound impress upon men's thoughts and opinions. Much that we take for granted about the desirability of work is derived from this system, and, being pre-industrial, is not adapted to the modern world. Modern technique has made it possible for leisure, within limits, to be not the prerogative of small privileged classes, but a right evenly distributed throughout the community. The morality of work is the morality of slaves, and the modern world has no need of slavery. + +It is obvious that, in primitive communities, peasants, left to themselves, would not have parted with the slender surplus upon which the warriors and priests subsisted, but would have either produced less or consumed more. At first, sheer force compelled them to produce and part with the surplus. Gradually, however, it was found possible to induce many of them to accept an ethic according to which it was their duty to work hard, although part of their work went to support others in idleness. By this means the amount of compulsion required was lessened, and the expenses of government were diminished. To this day, 99 per cent of British wage-earners would be genuinely shocked if it were proposed that the King should not have a larger income than a working man. The conception of duty, speaking historically, has been a means used by the holders of power to induce others to live for the interests of their masters rather than for their own. Of course the holders of power conceal this fact from themselves by managing to believe that their interests are identical with the larger interests of humanity. Sometimes this is true; Athenian slave-owners, for instance, employed part of their leisure in making a permanent contribution to civilization which would have been impossible under a just economic system. Leisure is essential to civilization, and in former times leisure for the few was only rendered possible by the labors of the many. But their labors were valuable, not because work is good, but because leisure is good. And with modern technique it would be possible to distribute leisure justly without injury to civilization. + +Modern technique has made it possible to diminish enormously the amount of labor required to secure the necessaries of life for everyone. This was made obvious during the war. At that time all the men in the armed forces, and all the men and women engaged in the production of munitions, all the men and women engaged in spying, war propaganda, or Government offices connected with the war, were withdrawn from productive occupations. In spite of this, the general level of well-being among unskilled wage-earners on the side of the Allies was higher than before or since. The significance of this fact was concealed by finance: borrowing made it appear as if the future was nourishing the present. But that, of course, would have been impossible; a man cannot eat a loaf of bread that does not yet exist. The war showed conclusively that, by the scientific organization of production, it is possible to keep modern populations in fair comfort on a small part of the working capacity of the modern world. If, at the end of the war, the scientific organization, which had been created in order to liberate men for fighting and munition work, had been preserved, and the hours of the week had been cut down to four, all would have been well. Instead of that the old chaos was restored, those whose work was demanded were made to work long hours, and the rest were left to starve as unemployed. Why? Because work is a duty, and a man should not receive wages in proportion to what he has produced, but in proportion to his virtue as exemplified by his industry. + +This is the morality of the Slave State, applied in circumstances totally unlike those in which it arose. No wonder the result has been disastrous. Let us take an illustration. Suppose that, at a given moment, a certain number of people are engaged in the manufacture of pins. They make as many pins as the world needs, working (say) eight hours a day. Someone makes an invention by which the same number of men can make twice as many pins: pins are already so cheap that hardly any more will be bought at a lower price. In a sensible world, everybody concerned in the manufacturing of pins would take to working four hours instead of eight, and everything else would go on as before. But in the actual world this would be thought demoralizing. The men still work eight hours, there are too many pins, some employers go bankrupt, and half the men previously concerned in making pins are thrown out of work. There is, in the end, just as much leisure as on the other plan, but half the men are totally idle while half are still overworked. In this way, it is insured that the unavoidable leisure shall cause misery all round instead of being a universal source of happiness. Can anything more insane be imagined? + +The idea that the poor should have leisure has always been shocking to the rich. In England, in the early nineteenth century, fifteen hours was the ordinary day's work for a man; children sometimes did as much, and very commonly did twelve hours a day. When meddlesome busybodies suggested that perhaps these hours were rather long, they were told that work kept adults from drink and children from mischief. When I was a child, shortly after urban working men had acquired the vote, certain public holidays were established by law, to the great indignation of the upper classes. I remember hearing an old Duchess say: 'What do the poor want with holidays? They ought to work.' People nowadays are less frank, but the sentiment persists, and is the source of much of our economic confusion. + +Let us, for a moment, consider the ethics of work frankly, without superstition. Every human being, of necessity, consumes, in the course of his life, a certain amount of the produce of human labor. Assuming, as we may, that labor is on the whole disagreeable, it is unjust that a man should consume more than he produces. Of course he may provide services rather than commodities, like a medical man, for example; but he should provide something in return for his board and lodging. to this extent, the duty of work must be admitted, but to this extent only. + +I shall not dwell upon the fact that, in all modern societies outside the USSR, many people escape even this minimum amount of work, namely all those who inherit money and all those who marry money. I do not think the fact that these people are allowed to be idle is nearly so harmful as the fact that wage-earners are expected to overwork or starve. + +If the ordinary wage-earner worked four hours a day, there would be enough for everybody and no unemployment -- assuming a certain very moderate amount of sensible organization. This idea shocks the well-to-do, because they are convinced that the poor would not know how to use so much leisure. In America men often work long hours even when they are well off; such men, naturally, are indignant at the idea of leisure for wage-earners, except as the grim punishment of unemployment; in fact, they dislike leisure even for their sons. Oddly enough, while they wish their sons to work so hard as to have no time to be civilized, they do not mind their wives and daughters having no work at all. the snobbish admiration of uselessness, which, in an aristocratic society, extends to both sexes, is, under a plutocracy, confined to women; this, however, does not make it any more in agreement with common sense. + +The wise use of leisure, it must be conceded, is a product of civilization and education. A man who has worked long hours all his life will become bored if he becomes suddenly idle. But without a considerable amount of leisure a man is cut off from many of the best things. There is no longer any reason why the bulk of the population should suffer this deprivation; only a foolish asceticism, usually vicarious, makes us continue to insist on work in excessive quantities now that the need no longer exists. + +In the new creed which controls the government of Russia, while there is much that is very different from the traditional teaching of the West, there are some things that are quite unchanged. The attitude of the governing classes, and especially of those who conduct educational propaganda, on the subject of the dignity of labor, is almost exactly that which the governing classes of the world have always preached to what were called the 'honest poor'. Industry, sobriety, willingness to work long hours for distant advantages, even submissiveness to authority, all these reappear; moreover authority still represents the will of the Ruler of the Universe, Who, however, is now called by a new name, Dialectical Materialism. + +The victory of the proletariat in Russia has some points in common with the victory of the feminists in some other countries. For ages, men had conceded the superior saintliness of women, and had consoled women for their inferiority by maintaining that saintliness is more desirable than power. At last the feminists decided that they would have both, since the pioneers among them believed all that the men had told them about the desirability of virtue, but not what they had told them about the worthlessness of political power. A similar thing has happened in Russia as regards manual work. For ages, the rich and their sycophants have written in praise of 'honest toil', have praised the simple life, have professed a religion which teaches that the poor are much more likely to go to heaven than the rich, and in general have tried to make manual workers believe that there is some special nobility about altering the position of matter in space, just as men tried to make women believe that they derived some special nobility from their sexual enslavement. In Russia, all this teaching about the excellence of manual work has been taken seriously, with the result that the manual worker is more honored than anyone else. What are, in essence, revivalist appeals are made, but not for the old purposes: they are made to secure shock workers for special tasks. Manual work is the ideal which is held before the young, and is the basis of all ethical teaching. + +For the present, possibly, this is all to the good. A large country, full of natural resources, awaits development, and has has to be developed with very little use of credit. In these circumstances, hard work is necessary, and is likely to bring a great reward. But what will happen when the point has been reached where everybody could be comfortable without working long hours? + +In the West, we have various ways of dealing with this problem. We have no attempt at economic justice, so that a large proportion of the total produce goes to a small minority of the population, many of whom do no work at all. Owing to the absence of any central control over production, we produce hosts of things that are not wanted. We keep a large percentage of the working population idle, because we can dispense with their labor by making the others overwork. When all these methods prove inadequate, we have a war: we cause a number of people to manufacture high explosives, and a number of others to explode them, as if we were children who had just discovered fireworks. By a combination of all these devices we manage, though with difficulty, to keep alive the notion that a great deal of severe manual work must be the lot of the average man. + +In Russia, owing to more economic justice and central control over production, the problem will have to be differently solved. the rational solution would be, as soon as the necessaries and elementary comforts can be provided for all, to reduce the hours of labor gradually, allowing a popular vote to decide, at each stage, whether more leisure or more goods were to be preferred. But, having taught the supreme virtue of hard work, it is difficult to see how the authorities can aim at a paradise in which there will be much leisure and little work. It seems more likely that they will find continually fresh schemes, by which present leisure is to be sacrificed to future productivity. I read recently of an ingenious plan put forward by Russian engineers, for making the White Sea and the northern coasts of Siberia warm, by putting a dam across the Kara Sea. An admirable project, but liable to postpone proletarian comfort for a generation, while the nobility of toil is being displayed amid the ice-fields and snowstorms of the Arctic Ocean. This sort of thing, if it happens, will be the result of regarding the virtue of hard work as an end in itself, rather than as a means to a state of affairs in which it is no longer needed. + +The fact is that moving matter about, while a certain amount of it is necessary to our existence, is emphatically not one of the ends of human life. If it were, we should have to consider every navvy superior to Shakespeare. We have been misled in this matter by two causes. One is the necessity of keeping the poor contented, which has led the rich, for thousands of years, to preach the dignity of labor, while taking care themselves to remain undignified in this respect. The other is the new pleasure in mechanism, which makes us delight in the astonishingly clever changes that we can produce on the earth's surface. Neither of these motives makes any great appeal to the actual worker. If you ask him what he thinks the best part of his life, he is not likely to say: 'I enjoy manual work because it makes me feel that I am fulfilling man's noblest task, and because I like to think how much man can transform his planet. It is true that my body demands periods of rest, which I have to fill in as best I may, but I am never so happy as when the morning comes and I can return to the toil from which my contentment springs.' I have never heard working men say this sort of thing. They consider work, as it should be considered, a necessary means to a livelihood, and it is from their leisure that they derive whatever happiness they may enjoy. + +It will be said that, while a little leisure is pleasant, men would not know how to fill their days if they had only four hours of work out of the twenty-four. In so far as this is true in the modern world, it is a condemnation of our civilization; it would not have been true at any earlier period. There was formerly a capacity for light-heartedness and play which has been to some extent inhibited by the cult of efficiency. The modern man thinks that everything ought to be done for the sake of something else, and never for its own sake. Serious-minded persons, for example, are continually condemning the habit of going to the cinema, and telling us that it leads the young into crime. But all the work that goes to producing a cinema is respectable, because it is work, and because it brings a money profit. The notion that the desirable activities are those that bring a profit has made everything topsy-turvy. The butcher who provides you with meat and the baker who provides you with bread are praiseworthy, because they are making money; but when you enjoy the food they have provided, you are merely frivolous, unless you eat only to get strength for your work. Broadly speaking, it is held that getting money is good and spending money is bad. Seeing that they are two sides of one transaction, this is absurd; one might as well maintain that keys are good, but keyholes are bad. Whatever merit there may be in the production of goods must be entirely derivative from the advantage to be obtained by consuming them. The individual, in our society, works for profit; but the social purpose of his work lies in the consumption of what he produces. It is this divorce between the individual and the social purpose of production that makes it so difficult for men to think clearly in a world in which profit-making is the incentive to industry. We think too much of production, and too little of consumption. One result is that we attach too little importance to enjoyment and simple happiness, and that we do not judge production by the pleasure that it gives to the consumer. + +When I suggest that working hours should be reduced to four, I am not meaning to imply that all the remaining time should necessarily be spent in pure frivolity. I mean that four hours' work a day should entitle a man to the necessities and elementary comforts of life, and that the rest of his time should be his to use as he might see fit. It is an essential part of any such social system that education should be carried further than it usually is at present, and should aim, in part, at providing tastes which would enable a man to use leisure intelligently. I am not thinking mainly of the sort of things that would be considered 'highbrow'. Peasant dances have died out except in remote rural areas, but the impulses which caused them to be cultivated must still exist in human nature. The pleasures of urban populations have become mainly passive: seeing cinemas, watching football matches, listening to the radio, and so on. This results from the fact that their active energies are fully taken up with work; if they had more leisure, they would again enjoy pleasures in which they took an active part. + +In the past, there was a small leisure class and a larger working class. The leisure class enjoyed advantages for which there was no basis in social justice; this necessarily made it oppressive, limited its sympathies, and caused it to invent theories by which to justify its privileges. These facts greatly diminished its excellence, but in spite of this drawback it contributed nearly the whole of what we call civilization. It cultivated the arts and discovered the sciences; it wrote the books, invented the philosophies, and refined social relations. Even the liberation of the oppressed has usually been inaugurated from above. Without the leisure class, mankind would never have emerged from barbarism. + +The method of a leisure class without duties was, however, extraordinarily wasteful. None of the members of the class had to be taught to be industrious, and the class as a whole was not exceptionally intelligent. The class might produce one Darwin, but against him had to be set tens of thousands of country gentlemen who never thought of anything more intelligent than fox-hunting and punishing poachers. At present, the universities are supposed to provide, in a more systematic way, what the leisure class provided accidentally and as a by-product. This is a great improvement, but it has certain drawbacks. University life is so different from life in the world at large that men who live in academic milieu tend to be unaware of the preoccupations and problems of ordinary men and women; moreover their ways of expressing themselves are usually such as to rob their opinions of the influence that they ought to have upon the general public. Another disadvantage is that in universities studies are organized, and the man who thinks of some original line of research is likely to be discouraged. Academic institutions, therefore, useful as they are, are not adequate guardians of the interests of civilization in a world where everyone outside their walls is too busy for unutilitarian pursuits. + +In a world where no one is compelled to work more than four hours a day, every person possessed of scientific curiosity will be able to indulge it, and every painter will be able to paint without starving, however excellent his pictures may be. Young writers will not be obliged to draw attention to themselves by sensational pot-boilers, with a view to acquiring the economic independence needed for monumental works, for which, when the time at last comes, they will have lost the taste and capacity. Men who, in their professional work, have become interested in some phase of economics or government, will be able to develop their ideas without the academic detachment that makes the work of university economists often seem lacking in reality. Medical men will have the time to learn about the progress of medicine, teachers will not be exasperatedly struggling to teach by routine methods things which they learnt in their youth, which may, in the interval, have been proved to be untrue. + +Above all, there will be happiness and joy of life, instead of frayed nerves, weariness, and dyspepsia. The work exacted will be enough to make leisure delightful, but not enough to produce exhaustion. Since men will not be tired in their spare time, they will not demand only such amusements as are passive and vapid. At least one per cent will probably devote the time not spent in professional work to pursuits of some public importance, and, since they will not depend upon these pursuits for their livelihood, their originality will be unhampered, and there will be no need to conform to the standards set by elderly pundits. But it is not only in these exceptional cases that the advantages of leisure will appear. Ordinary men and women, having the opportunity of a happy life, will become more kindly and less persecuting and less inclined to view others with suspicion. The taste for war will die out, partly for this reason, and partly because it will involve long and severe work for all. Good nature is, of all moral qualities, the one that the world needs most, and good nature is the result of ease and security, not of a life of arduous struggle. Modern methods of production have given us the possibility of ease and security for all; we have chosen, instead, to have overwork for some and starvation for others. Hitherto we have continued to be as energetic as we were before there were machines; in this we have been foolish, but there is no reason to go on being foolish forever. + +[1] Since then, members of the Communist Party have succeeded to this privilege of the warriors and priests. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/test/wrap.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/test/wrap.js new file mode 100644 index 00000000..0cfb76d1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/node_modules/wordwrap/test/wrap.js @@ -0,0 +1,31 @@ +var assert = require('assert'); +var wordwrap = require('wordwrap'); + +var fs = require('fs'); +var idleness = fs.readFileSync(__dirname + '/idleness.txt', 'utf8'); + +exports.stop80 = function () { + var lines = wordwrap(80)(idleness).split(/\n/); + var words = idleness.split(/\s+/); + + lines.forEach(function (line) { + assert.ok(line.length <= 80, 'line > 80 columns'); + var chunks = line.match(/\S/) ? line.split(/\s+/) : []; + assert.deepEqual(chunks, words.splice(0, chunks.length)); + }); +}; + +exports.start20stop60 = function () { + var lines = wordwrap(20, 100)(idleness).split(/\n/); + var words = idleness.split(/\s+/); + + lines.forEach(function (line) { + assert.ok(line.length <= 100, 'line > 100 columns'); + var chunks = line + .split(/\s+/) + .filter(function (x) { return x.match(/\S/) }) + ; + assert.deepEqual(chunks, words.splice(0, chunks.length)); + assert.deepEqual(line.slice(0, 20), new Array(20 + 1).join(' ')); + }); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/package.json new file mode 100644 index 00000000..7f2d59f0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/package.json @@ -0,0 +1,64 @@ +{ + "name": "optimist", + "version": "0.6.1", + "description": "Light-weight option parsing with an argv hash. No optstrings attached.", + "main": "./index.js", + "dependencies": { + "wordwrap": "~0.0.2", + "minimist": "~0.0.1" + }, + "devDependencies": { + "hashish": "~0.0.4", + "tap": "~0.4.0" + }, + "scripts": { + "test": "tap ./test/*.js" + }, + "repository": { + "type": "git", + "url": "http://github.com/substack/node-optimist.git" + }, + "keywords": [ + "argument", + "args", + "option", + "parser", + "parsing", + "cli", + "command" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT/X11", + "engine": { + "node": ">=0.4" + }, + "bugs": { + "url": "https://github.com/substack/node-optimist/issues" + }, + "homepage": "https://github.com/substack/node-optimist", + "_id": "optimist@0.6.1", + "dist": { + "shasum": "da3ea74686fa21a19a111c326e90eb15a0196686", + "tarball": "http://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz" + }, + "_from": "optimist@>=0.6.0 <0.7.0", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "directories": {}, + "_shasum": "da3ea74686fa21a19a111c326e90eb15a0196686", + "_resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/readme.markdown b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/readme.markdown new file mode 100644 index 00000000..b74b4372 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/readme.markdown @@ -0,0 +1,513 @@ +# DEPRECATION NOTICE + +I don't want to maintain this module anymore since I just use +[minimist](https://npmjs.org/package/minimist), the argument parsing engine, +directly instead nowadays. + +See [yargs](https://github.com/chevex/yargs) for the modern, pirate-themed +successor to optimist. + +[![yarrrrrrrgs!](http://i.imgur.com/4WFGVJ9.png)](https://github.com/chevex/yargs) + +You should also consider [nomnom](https://github.com/harthur/nomnom). + +optimist +======== + +Optimist is a node.js library for option parsing for people who hate option +parsing. More specifically, this module is for people who like all the --bells +and -whistlz of program usage but think optstrings are a waste of time. + +With optimist, option parsing doesn't have to suck (as much). + +[![build status](https://secure.travis-ci.org/substack/node-optimist.png)](http://travis-ci.org/substack/node-optimist) + +examples +======== + +With Optimist, the options are just a hash! No optstrings attached. +------------------------------------------------------------------- + +xup.js: + +````javascript +#!/usr/bin/env node +var argv = require('optimist').argv; + +if (argv.rif - 5 * argv.xup > 7.138) { + console.log('Buy more riffiwobbles'); +} +else { + console.log('Sell the xupptumblers'); +} +```` + +*** + + $ ./xup.js --rif=55 --xup=9.52 + Buy more riffiwobbles + + $ ./xup.js --rif 12 --xup 8.1 + Sell the xupptumblers + +![This one's optimistic.](http://substack.net/images/optimistic.png) + +But wait! There's more! You can do short options: +------------------------------------------------- + +short.js: + +````javascript +#!/usr/bin/env node +var argv = require('optimist').argv; +console.log('(%d,%d)', argv.x, argv.y); +```` + +*** + + $ ./short.js -x 10 -y 21 + (10,21) + +And booleans, both long and short (and grouped): +---------------------------------- + +bool.js: + +````javascript +#!/usr/bin/env node +var util = require('util'); +var argv = require('optimist').argv; + +if (argv.s) { + util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: '); +} +console.log( + (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '') +); +```` + +*** + + $ ./bool.js -s + The cat says: meow + + $ ./bool.js -sp + The cat says: meow. + + $ ./bool.js -sp --fr + Le chat dit: miaou. + +And non-hypenated options too! Just use `argv._`! +------------------------------------------------- + +nonopt.js: + +````javascript +#!/usr/bin/env node +var argv = require('optimist').argv; +console.log('(%d,%d)', argv.x, argv.y); +console.log(argv._); +```` + +*** + + $ ./nonopt.js -x 6.82 -y 3.35 moo + (6.82,3.35) + [ 'moo' ] + + $ ./nonopt.js foo -x 0.54 bar -y 1.12 baz + (0.54,1.12) + [ 'foo', 'bar', 'baz' ] + +Plus, Optimist comes with .usage() and .demand()! +------------------------------------------------- + +divide.js: + +````javascript +#!/usr/bin/env node +var argv = require('optimist') + .usage('Usage: $0 -x [num] -y [num]') + .demand(['x','y']) + .argv; + +console.log(argv.x / argv.y); +```` + +*** + + $ ./divide.js -x 55 -y 11 + 5 + + $ node ./divide.js -x 4.91 -z 2.51 + Usage: node ./divide.js -x [num] -y [num] + + Options: + -x [required] + -y [required] + + Missing required arguments: y + +EVEN MORE HOLY COW +------------------ + +default_singles.js: + +````javascript +#!/usr/bin/env node +var argv = require('optimist') + .default('x', 10) + .default('y', 10) + .argv +; +console.log(argv.x + argv.y); +```` + +*** + + $ ./default_singles.js -x 5 + 15 + +default_hash.js: + +````javascript +#!/usr/bin/env node +var argv = require('optimist') + .default({ x : 10, y : 10 }) + .argv +; +console.log(argv.x + argv.y); +```` + +*** + + $ ./default_hash.js -y 7 + 17 + +And if you really want to get all descriptive about it... +--------------------------------------------------------- + +boolean_single.js + +````javascript +#!/usr/bin/env node +var argv = require('optimist') + .boolean('v') + .argv +; +console.dir(argv); +```` + +*** + + $ ./boolean_single.js -v foo bar baz + true + [ 'bar', 'baz', 'foo' ] + +boolean_double.js + +````javascript +#!/usr/bin/env node +var argv = require('optimist') + .boolean(['x','y','z']) + .argv +; +console.dir([ argv.x, argv.y, argv.z ]); +console.dir(argv._); +```` + +*** + + $ ./boolean_double.js -x -z one two three + [ true, false, true ] + [ 'one', 'two', 'three' ] + +Optimist is here to help... +--------------------------- + +You can describe parameters for help messages and set aliases. Optimist figures +out how to format a handy help string automatically. + +line_count.js + +````javascript +#!/usr/bin/env node +var argv = require('optimist') + .usage('Count the lines in a file.\nUsage: $0') + .demand('f') + .alias('f', 'file') + .describe('f', 'Load a file') + .argv +; + +var fs = require('fs'); +var s = fs.createReadStream(argv.file); + +var lines = 0; +s.on('data', function (buf) { + lines += buf.toString().match(/\n/g).length; +}); + +s.on('end', function () { + console.log(lines); +}); +```` + +*** + + $ node line_count.js + Count the lines in a file. + Usage: node ./line_count.js + + Options: + -f, --file Load a file [required] + + Missing required arguments: f + + $ node line_count.js --file line_count.js + 20 + + $ node line_count.js -f line_count.js + 20 + +methods +======= + +By itself, + +````javascript +require('optimist').argv +````` + +will use `process.argv` array to construct the `argv` object. + +You can pass in the `process.argv` yourself: + +````javascript +require('optimist')([ '-x', '1', '-y', '2' ]).argv +```` + +or use .parse() to do the same thing: + +````javascript +require('optimist').parse([ '-x', '1', '-y', '2' ]) +```` + +The rest of these methods below come in just before the terminating `.argv`. + +.alias(key, alias) +------------------ + +Set key names as equivalent such that updates to a key will propagate to aliases +and vice-versa. + +Optionally `.alias()` can take an object that maps keys to aliases. + +.default(key, value) +-------------------- + +Set `argv[key]` to `value` if no option was specified on `process.argv`. + +Optionally `.default()` can take an object that maps keys to default values. + +.demand(key) +------------ + +If `key` is a string, show the usage information and exit if `key` wasn't +specified in `process.argv`. + +If `key` is a number, demand at least as many non-option arguments, which show +up in `argv._`. + +If `key` is an Array, demand each element. + +.describe(key, desc) +-------------------- + +Describe a `key` for the generated usage information. + +Optionally `.describe()` can take an object that maps keys to descriptions. + +.options(key, opt) +------------------ + +Instead of chaining together `.alias().demand().default()`, you can specify +keys in `opt` for each of the chainable methods. + +For example: + +````javascript +var argv = require('optimist') + .options('f', { + alias : 'file', + default : '/etc/passwd', + }) + .argv +; +```` + +is the same as + +````javascript +var argv = require('optimist') + .alias('f', 'file') + .default('f', '/etc/passwd') + .argv +; +```` + +Optionally `.options()` can take an object that maps keys to `opt` parameters. + +.usage(message) +--------------- + +Set a usage message to show which commands to use. Inside `message`, the string +`$0` will get interpolated to the current script name or node command for the +present script similar to how `$0` works in bash or perl. + +.check(fn) +---------- + +Check that certain conditions are met in the provided arguments. + +If `fn` throws or returns `false`, show the thrown error, usage information, and +exit. + +.boolean(key) +------------- + +Interpret `key` as a boolean. If a non-flag option follows `key` in +`process.argv`, that string won't get set as the value of `key`. + +If `key` never shows up as a flag in `process.arguments`, `argv[key]` will be +`false`. + +If `key` is an Array, interpret all the elements as booleans. + +.string(key) +------------ + +Tell the parser logic not to interpret `key` as a number or boolean. +This can be useful if you need to preserve leading zeros in an input. + +If `key` is an Array, interpret all the elements as strings. + +.wrap(columns) +-------------- + +Format usage output to wrap at `columns` many columns. + +.help() +------- + +Return the generated usage string. + +.showHelp(fn=console.error) +--------------------------- + +Print the usage data using `fn` for printing. + +.parse(args) +------------ + +Parse `args` instead of `process.argv`. Returns the `argv` object. + +.argv +----- + +Get the arguments as a plain old object. + +Arguments without a corresponding flag show up in the `argv._` array. + +The script name or node command is available at `argv.$0` similarly to how `$0` +works in bash or perl. + +parsing tricks +============== + +stop parsing +------------ + +Use `--` to stop parsing flags and stuff the remainder into `argv._`. + + $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4 + { _: [ '-c', '3', '-d', '4' ], + '$0': 'node ./examples/reflect.js', + a: 1, + b: 2 } + +negate fields +------------- + +If you want to explicity set a field to false instead of just leaving it +undefined or to override a default you can do `--no-key`. + + $ node examples/reflect.js -a --no-b + { _: [], + '$0': 'node ./examples/reflect.js', + a: true, + b: false } + +numbers +------- + +Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to +one. This way you can just `net.createConnection(argv.port)` and you can add +numbers out of `argv` with `+` without having that mean concatenation, +which is super frustrating. + +duplicates +---------- + +If you specify a flag multiple times it will get turned into an array containing +all the values in order. + + $ node examples/reflect.js -x 5 -x 8 -x 0 + { _: [], + '$0': 'node ./examples/reflect.js', + x: [ 5, 8, 0 ] } + +dot notation +------------ + +When you use dots (`.`s) in argument names, an implicit object path is assumed. +This lets you organize arguments into nested objects. + + $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5 + { _: [], + '$0': 'node ./examples/reflect.js', + foo: { bar: { baz: 33 }, quux: 5 } } + +short numbers +------------- + +Short numeric `head -n5` style argument work too: + + $ node reflect.js -n123 -m456 + { '3': true, + '6': true, + _: [], + '$0': 'node ./reflect.js', + n: 123, + m: 456 } + +installation +============ + +With [npm](http://github.com/isaacs/npm), just do: + npm install optimist + +or clone this project on github: + + git clone http://github.com/substack/node-optimist.git + +To run the tests with [expresso](http://github.com/visionmedia/expresso), +just do: + + expresso + +inspired By +=========== + +This module is loosely inspired by Perl's +[Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm). diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/_.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/_.js new file mode 100644 index 00000000..d9c58b36 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/_.js @@ -0,0 +1,71 @@ +var spawn = require('child_process').spawn; +var test = require('tap').test; + +test('dotSlashEmpty', testCmd('./bin.js', [])); + +test('dotSlashArgs', testCmd('./bin.js', [ 'a', 'b', 'c' ])); + +test('nodeEmpty', testCmd('node bin.js', [])); + +test('nodeArgs', testCmd('node bin.js', [ 'x', 'y', 'z' ])); + +test('whichNodeEmpty', function (t) { + var which = spawn('which', ['node']); + + which.stdout.on('data', function (buf) { + t.test( + testCmd(buf.toString().trim() + ' bin.js', []) + ); + t.end(); + }); + + which.stderr.on('data', function (err) { + assert.error(err); + t.end(); + }); +}); + +test('whichNodeArgs', function (t) { + var which = spawn('which', ['node']); + + which.stdout.on('data', function (buf) { + t.test( + testCmd(buf.toString().trim() + ' bin.js', [ 'q', 'r' ]) + ); + t.end(); + }); + + which.stderr.on('data', function (err) { + t.error(err); + t.end(); + }); +}); + +function testCmd (cmd, args) { + + return function (t) { + var to = setTimeout(function () { + assert.fail('Never got stdout data.') + }, 5000); + + var oldDir = process.cwd(); + process.chdir(__dirname + '/_'); + + var cmds = cmd.split(' '); + + var bin = spawn(cmds[0], cmds.slice(1).concat(args.map(String))); + process.chdir(oldDir); + + bin.stderr.on('data', function (err) { + t.error(err); + t.end(); + }); + + bin.stdout.on('data', function (buf) { + clearTimeout(to); + var _ = JSON.parse(buf.toString()); + t.same(_.map(String), args.map(String)); + t.end(); + }); + }; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/_/argv.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/_/argv.js new file mode 100644 index 00000000..3d096062 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/_/argv.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +console.log(JSON.stringify(process.argv)); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/_/bin.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/_/bin.js new file mode 100755 index 00000000..4a18d85f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/_/bin.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +var argv = require('../../index').argv +console.log(JSON.stringify(argv._)); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/dash.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/dash.js new file mode 100644 index 00000000..af8ed6fc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/dash.js @@ -0,0 +1,31 @@ +var optimist = require('../index'); +var test = require('tap').test; + +test('-', function (t) { + t.plan(5); + t.deepEqual( + fix(optimist.parse([ '-n', '-' ])), + { n: '-', _: [] } + ); + t.deepEqual( + fix(optimist.parse([ '-' ])), + { _: [ '-' ] } + ); + t.deepEqual( + fix(optimist.parse([ '-f-' ])), + { f: '-', _: [] } + ); + t.deepEqual( + fix(optimist([ '-b', '-' ]).boolean('b').argv), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + fix(optimist([ '-s', '-' ]).string('s').argv), + { s: '-', _: [] } + ); +}); + +function fix (obj) { + delete obj.$0; + return obj; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/parse.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/parse.js new file mode 100644 index 00000000..d320f433 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/parse.js @@ -0,0 +1,446 @@ +var optimist = require('../index'); +var path = require('path'); +var test = require('tap').test; + +var $0 = 'node ./' + path.relative(process.cwd(), __filename); + +test('short boolean', function (t) { + var parse = optimist.parse([ '-b' ]); + t.same(parse, { b : true, _ : [], $0 : $0 }); + t.same(typeof parse.b, 'boolean'); + t.end(); +}); + +test('long boolean', function (t) { + t.same( + optimist.parse([ '--bool' ]), + { bool : true, _ : [], $0 : $0 } + ); + t.end(); +}); + +test('bare', function (t) { + t.same( + optimist.parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ], $0 : $0 } + ); + t.end(); +}); + +test('short group', function (t) { + t.same( + optimist.parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [], $0 : $0 } + ); + t.end(); +}); + +test('short group next', function (t) { + t.same( + optimist.parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [], $0 : $0 } + ); + t.end(); +}); + +test('short capture', function (t) { + t.same( + optimist.parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [], $0 : $0 } + ); + t.end(); +}); + +test('short captures', function (t) { + t.same( + optimist.parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [], $0 : $0 } + ); + t.end(); +}); + +test('long capture sp', function (t) { + t.same( + optimist.parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [], $0 : $0 } + ); + t.end(); +}); + +test('long capture eq', function (t) { + t.same( + optimist.parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [], $0 : $0 } + ); + t.end() +}); + +test('long captures sp', function (t) { + t.same( + optimist.parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [], $0 : $0 } + ); + t.end(); +}); + +test('long captures eq', function (t) { + t.same( + optimist.parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [], $0 : $0 } + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + optimist.parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ], $0 : $0, + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.same( + optimist.parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ], $0 : $0, + } + ); + t.end(); +}); + +test('no', function (t) { + t.same( + optimist.parse([ '--no-moo' ]), + { moo : false, _ : [], $0 : $0 } + ); + t.end(); +}); + +test('multi', function (t) { + t.same( + optimist.parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [], $0 : $0 } + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.same( + optimist.parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ], + $0 : $0 + } + ); + t.end(); +}); + +test('nums', function (t) { + var argv = optimist.parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789', + ]); + t.same(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ], + $0 : $0 + }); + t.same(typeof argv.x, 'number'); + t.same(typeof argv.y, 'number'); + t.same(typeof argv.z, 'number'); + t.same(typeof argv.w, 'string'); + t.same(typeof argv.hex, 'number'); + t.same(typeof argv._[0], 'number'); + t.end(); +}); + +test('flag boolean', function (t) { + var parse = optimist([ '-t', 'moo' ]).boolean(['t']).argv; + t.same(parse, { t : true, _ : [ 'moo' ], $0 : $0 }); + t.same(typeof parse.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var parse = optimist(['--verbose', 'false', 'moo', '-t', 'true']) + .boolean(['t', 'verbose']).default('verbose', true).argv; + + t.same(parse, { + verbose: false, + t: true, + _: ['moo'], + $0 : $0 + }); + + t.same(typeof parse.verbose, 'boolean'); + t.same(typeof parse.t, 'boolean'); + t.end(); +}); + +test('flag boolean default false', function (t) { + var parse = optimist(['moo']) + .boolean(['t', 'verbose']) + .default('verbose', false) + .default('t', false).argv; + + t.same(parse, { + verbose: false, + t: false, + _: ['moo'], + $0 : $0 + }); + + t.same(typeof parse.verbose, 'boolean'); + t.same(typeof parse.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var parse = optimist([ '-x', '-z', 'one', 'two', 'three' ]) + .boolean(['x','y','z']).argv; + + t.same(parse, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ], + $0 : $0 + }); + + t.same(typeof parse.x, 'boolean'); + t.same(typeof parse.y, 'boolean'); + t.same(typeof parse.z, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = optimist.parse([ '-s', "X\nX" ]) + t.same(args, { _ : [], s : "X\nX", $0 : $0 }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = optimist.parse([ "--s=X\nX" ]) + t.same(args, { _ : [], s : "X\nX", $0 : $0 }); + t.end(); +}); + +test('strings' , function (t) { + var s = optimist([ '-s', '0001234' ]).string('s').argv.s; + t.same(s, '0001234'); + t.same(typeof s, 'string'); + + var x = optimist([ '-x', '56' ]).string('x').argv.x; + t.same(x, '56'); + t.same(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = optimist([ ' ', ' ' ]).string('_').argv._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + optimist.parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [], $0 : $0 } + ); + t.same( + optimist.parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [], $0 : $0 } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = optimist([ '-f', '11', '--zoom', '55' ]) + .alias('z', 'zoom') + .argv + ; + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = optimist([ '-f', '11', '--zoom', '55' ]) + .alias('z', [ 'zm', 'zoom' ]) + .argv + ; + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('boolean default true', function (t) { + var argv = optimist.options({ + sometrue: { + boolean: true, + default: true + } + }).argv; + + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = optimist.options({ + somefalse: { + boolean: true, + default: false + } + }).argv; + + t.equal(argv.somefalse, false); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = optimist([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]).argv; + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + }, + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); + +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = optimist(aliased) + .boolean('herp') + .alias('h', 'herp') + .argv; + var propertyArgv = optimist(regular) + .boolean('herp') + .alias('h', 'herp') + .argv; + var expected = { + herp: true, + h: true, + '_': [ 'derp' ], + '$0': $0, + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = optimist(aliased) + .options(opts) + .argv; + var propertyArgv = optimist(regular).options(opts).argv; + var expected = { + herp: true, + h: true, + '_': [ 'derp' ], + '$0': $0, + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = optimist(aliased) + .boolean('h') + .alias('h', 'herp') + .argv; + var propertyArgv = optimist(regular) + .boolean('h') + .alias('h', 'herp') + .argv; + var expected = { + herp: true, + h: true, + '_': [ ], + '$0': $0, + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = optimist(['--boool', '--other=true']).boolean('boool').argv; + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = optimist(['--boool', '--other=false']).boolean('boool').argv; + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/parse_modified.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/parse_modified.js new file mode 100644 index 00000000..a57dc84e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/parse_modified.js @@ -0,0 +1,14 @@ +var optimist = require('../'); +var test = require('tap').test; + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = optimist().boolean('b').parse([ '-b', '123' ]); + t.deepEqual(fix(argv), { b: true, _: ['123'] }); +}); + +function fix (obj) { + delete obj.$0; + return obj; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/short.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/short.js new file mode 100644 index 00000000..b2c38ad8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/short.js @@ -0,0 +1,16 @@ +var optimist = require('../index'); +var test = require('tap').test; + +test('-n123', function (t) { + t.plan(1); + var parse = optimist.parse([ '-n123' ]); + t.equal(parse.n, 123); +}); + +test('-123', function (t) { + t.plan(3); + var parse = optimist.parse([ '-123', '456' ]); + t.equal(parse['1'], true); + t.equal(parse['2'], true); + t.equal(parse['3'], 456); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/usage.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/usage.js new file mode 100644 index 00000000..300454c1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/usage.js @@ -0,0 +1,292 @@ +var Hash = require('hashish'); +var optimist = require('../index'); +var test = require('tap').test; + +test('usageFail', function (t) { + var r = checkUsage(function () { + return optimist('-x 10 -z 20'.split(' ')) + .usage('Usage: $0 -x NUM -y NUM') + .demand(['x','y']) + .argv; + }); + t.same( + r.result, + { x : 10, z : 20, _ : [], $0 : './usage' } + ); + + t.same( + r.errors.join('\n').split(/\n+/), + [ + 'Usage: ./usage -x NUM -y NUM', + 'Options:', + ' -x [required]', + ' -y [required]', + 'Missing required arguments: y', + ] + ); + t.same(r.logs, []); + t.ok(r.exit); + t.end(); +}); + + +test('usagePass', function (t) { + var r = checkUsage(function () { + return optimist('-x 10 -y 20'.split(' ')) + .usage('Usage: $0 -x NUM -y NUM') + .demand(['x','y']) + .argv; + }); + t.same(r, { + result : { x : 10, y : 20, _ : [], $0 : './usage' }, + errors : [], + logs : [], + exit : false, + }); + t.end(); +}); + +test('checkPass', function (t) { + var r = checkUsage(function () { + return optimist('-x 10 -y 20'.split(' ')) + .usage('Usage: $0 -x NUM -y NUM') + .check(function (argv) { + if (!('x' in argv)) throw 'You forgot about -x'; + if (!('y' in argv)) throw 'You forgot about -y'; + }) + .argv; + }); + t.same(r, { + result : { x : 10, y : 20, _ : [], $0 : './usage' }, + errors : [], + logs : [], + exit : false, + }); + t.end(); +}); + +test('checkFail', function (t) { + var r = checkUsage(function () { + return optimist('-x 10 -z 20'.split(' ')) + .usage('Usage: $0 -x NUM -y NUM') + .check(function (argv) { + if (!('x' in argv)) throw 'You forgot about -x'; + if (!('y' in argv)) throw 'You forgot about -y'; + }) + .argv; + }); + + t.same( + r.result, + { x : 10, z : 20, _ : [], $0 : './usage' } + ); + + t.same( + r.errors.join('\n').split(/\n+/), + [ + 'Usage: ./usage -x NUM -y NUM', + 'You forgot about -y' + ] + ); + + t.same(r.logs, []); + t.ok(r.exit); + t.end(); +}); + +test('checkCondPass', function (t) { + function checker (argv) { + return 'x' in argv && 'y' in argv; + } + + var r = checkUsage(function () { + return optimist('-x 10 -y 20'.split(' ')) + .usage('Usage: $0 -x NUM -y NUM') + .check(checker) + .argv; + }); + t.same(r, { + result : { x : 10, y : 20, _ : [], $0 : './usage' }, + errors : [], + logs : [], + exit : false, + }); + t.end(); +}); + +test('checkCondFail', function (t) { + function checker (argv) { + return 'x' in argv && 'y' in argv; + } + + var r = checkUsage(function () { + return optimist('-x 10 -z 20'.split(' ')) + .usage('Usage: $0 -x NUM -y NUM') + .check(checker) + .argv; + }); + + t.same( + r.result, + { x : 10, z : 20, _ : [], $0 : './usage' } + ); + + t.same( + r.errors.join('\n').split(/\n+/).join('\n'), + 'Usage: ./usage -x NUM -y NUM\n' + + 'Argument check failed: ' + checker.toString() + ); + + t.same(r.logs, []); + t.ok(r.exit); + t.end(); +}); + +test('countPass', function (t) { + var r = checkUsage(function () { + return optimist('1 2 3 --moo'.split(' ')) + .usage('Usage: $0 [x] [y] [z] {OPTIONS}') + .demand(3) + .argv; + }); + t.same(r, { + result : { _ : [ '1', '2', '3' ], moo : true, $0 : './usage' }, + errors : [], + logs : [], + exit : false, + }); + t.end(); +}); + +test('countFail', function (t) { + var r = checkUsage(function () { + return optimist('1 2 --moo'.split(' ')) + .usage('Usage: $0 [x] [y] [z] {OPTIONS}') + .demand(3) + .argv; + }); + t.same( + r.result, + { _ : [ '1', '2' ], moo : true, $0 : './usage' } + ); + + t.same( + r.errors.join('\n').split(/\n+/), + [ + 'Usage: ./usage [x] [y] [z] {OPTIONS}', + 'Not enough non-option arguments: got 2, need at least 3', + ] + ); + + t.same(r.logs, []); + t.ok(r.exit); + t.end(); +}); + +test('defaultSingles', function (t) { + var r = checkUsage(function () { + return optimist('--foo 50 --baz 70 --powsy'.split(' ')) + .default('foo', 5) + .default('bar', 6) + .default('baz', 7) + .argv + ; + }); + t.same(r.result, { + foo : '50', + bar : 6, + baz : '70', + powsy : true, + _ : [], + $0 : './usage', + }); + t.end(); +}); + +test('defaultAliases', function (t) { + var r = checkUsage(function () { + return optimist('') + .alias('f', 'foo') + .default('f', 5) + .argv + ; + }); + t.same(r.result, { + f : '5', + foo : '5', + _ : [], + $0 : './usage', + }); + t.end(); +}); + +test('defaultHash', function (t) { + var r = checkUsage(function () { + return optimist('--foo 50 --baz 70'.split(' ')) + .default({ foo : 10, bar : 20, quux : 30 }) + .argv + ; + }); + t.same(r.result, { + _ : [], + $0 : './usage', + foo : 50, + baz : 70, + bar : 20, + quux : 30, + }); + t.end(); +}); + +test('rebase', function (t) { + t.equal( + optimist.rebase('/home/substack', '/home/substack/foo/bar/baz'), + './foo/bar/baz' + ); + t.equal( + optimist.rebase('/home/substack/foo/bar/baz', '/home/substack'), + '../../..' + ); + t.equal( + optimist.rebase('/home/substack/foo', '/home/substack/pow/zoom.txt'), + '../pow/zoom.txt' + ); + t.end(); +}); + +function checkUsage (f) { + + var exit = false; + + process._exit = process.exit; + process._env = process.env; + process._argv = process.argv; + + process.exit = function (t) { exit = true }; + process.env = Hash.merge(process.env, { _ : 'node' }); + process.argv = [ './usage' ]; + + var errors = []; + var logs = []; + + console._error = console.error; + console.error = function (msg) { errors.push(msg) }; + console._log = console.log; + console.log = function (msg) { logs.push(msg) }; + + var result = f(); + + process.exit = process._exit; + process.env = process._env; + process.argv = process._argv; + + console.error = console._error; + console.log = console._log; + + return { + errors : errors, + logs : logs, + exit : exit, + result : result, + }; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/whitespace.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/whitespace.js new file mode 100644 index 00000000..90b90752 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/optimist/test/whitespace.js @@ -0,0 +1,8 @@ +var optimist = require('../'); +var test = require('tap').test; + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = optimist.parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/.travis.yml new file mode 100644 index 00000000..895dbd36 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.8 diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/example/async.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/example/async.js new file mode 100644 index 00000000..6624ff72 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/example/async.js @@ -0,0 +1,5 @@ +var resolve = require('../'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err) + else console.log(res) +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/example/sync.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/example/sync.js new file mode 100644 index 00000000..54b2cc10 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/example/sync.js @@ -0,0 +1,3 @@ +var resolve = require('../'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/index.js new file mode 100644 index 00000000..51f194b4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/index.js @@ -0,0 +1,5 @@ +var core = require('./lib/core'); +exports = module.exports = require('./lib/async'); +exports.core = core; +exports.isCore = function (x) { return core[x] }; +exports.sync = require('./lib/sync'); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/async.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/async.js new file mode 100644 index 00000000..0f0eeca5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/async.js @@ -0,0 +1,192 @@ +var core = require('./core'); +var fs = require('fs'); +var path = require('path'); +var caller = require('./caller.js'); +var nodeModulesPaths = require('./node-modules-paths.js'); +var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\//; + +module.exports = function resolve (x, opts, cb) { + if (typeof opts === 'function') { + cb = opts; + opts = {}; + } + if (!opts) opts = {}; + if (typeof x !== 'string') { + return process.nextTick(function () { + cb(new Error('path must be a string')); + }); + } + + var isFile = opts.isFile || function (file, cb) { + fs.stat(file, function (err, stat) { + if (err && err.code === 'ENOENT') cb(null, false) + else if (err) cb(err) + else cb(null, stat.isFile() || stat.isFIFO()) + }); + }; + var readFile = opts.readFile || fs.readFile; + + var extensions = opts.extensions || [ '.js' ]; + var y = opts.basedir || path.dirname(caller()); + + opts.paths = opts.paths || []; + + if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[\\\/])/.test(x)) { + var res = path.resolve(y, x); + if (x === '..') res += '/'; + if (/\/$/.test(x) && res === y) { + loadAsDirectory(res, opts.package, onfile); + } + else loadAsFile(res, opts.package, onfile); + } + else loadNodeModules(x, y, function (err, n, pkg) { + if (err) cb(err) + else if (n) cb(null, n, pkg) + else if (core[x]) return cb(null, x); + else cb(new Error("Cannot find module '" + x + "' from '" + y + "'")) + }); + + function onfile (err, m, pkg) { + if (err) cb(err) + else if (m) cb(null, m, pkg) + else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err) + else if (d) cb(null, d, pkg) + else cb(new Error("Cannot find module '" + x + "' from '" + y + "'")) + }) + } + + function loadAsFile (x, pkg, cb) { + if (typeof pkg === 'function') { + cb = pkg; + pkg = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, pkg) + + function load (exts, x, pkg) { + if (exts.length === 0) return cb(null, undefined, pkg); + var file = x + exts[0]; + + if (pkg) onpkg(null, pkg) + else loadpkg(path.dirname(file), onpkg); + + function onpkg (err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err) + if (dir && pkg && opts.pathFilter) { + var rfile = path.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load( + [''].concat(extensions.slice()), + path.resolve(dir, r), + pkg + ); + } + isFile(file, onex); + } + function onex (err, ex) { + if (err) cb(err) + else if (!ex) load(exts.slice(1), x, pkg) + else cb(null, file, pkg) + } + } + } + + function loadpkg (dir, cb) { + if (dir === '' || dir === '/') return cb(null); + if (process.platform === 'win32' && /^\w:[\\\/]*$/.test(dir)) { + return cb(null); + } + if (/[\\\/]node_modules[\\\/]*$/.test(dir)) return cb(null); + + var pkgfile = path.join(dir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg( + path.dirname(dir), cb + ); + + readFile(pkgfile, function (err, body) { + if (err) cb(err); + try { var pkg = JSON.parse(body) } + catch (err) {} + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + cb(null, pkg, dir); + }); + }); + } + + function loadAsDirectory (x, fpkg, cb) { + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + var pkgfile = path.join(x, '/package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path.join(x, '/index'), fpkg, cb); + + readFile(pkgfile, function (err, body) { + if (err) return cb(err); + try { + var pkg = JSON.parse(body); + } + catch (err) {} + + if (opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + if (pkg.main) { + if (pkg.main === '.' || pkg.main === './'){ + pkg.main = 'index' + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, '/index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + } + + function loadNodeModules (x, start, cb) { + (function process (dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + + var file = path.join(dir, '/', x); + loadAsFile(file, undefined, onfile); + + function onfile (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(path.join(dir, '/', x), undefined, ondir); + } + + function ondir (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + process(dirs.slice(1)); + } + })(nodeModulesPaths(start, opts)); + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/caller.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/caller.js new file mode 100644 index 00000000..5536549b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/caller.js @@ -0,0 +1,8 @@ +module.exports = function () { + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var origPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = function (_, stack) { return stack }; + var stack = (new Error()).stack; + Error.prepareStackTrace = origPrepareStackTrace; + return stack[2].getFileName(); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/core.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/core.js new file mode 100644 index 00000000..ea4a6c87 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/core.js @@ -0,0 +1,4 @@ +module.exports = require('./core.json').reduce(function (acc, x) { + acc[x] = true; + return acc; +}, {}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/core.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/core.json new file mode 100644 index 00000000..28560f7e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/core.json @@ -0,0 +1,38 @@ +[ + "assert", + "buffer_ieee754", + "buffer", + "child_process", + "cluster", + "console", + "constants", + "crypto", + "_debugger", + "dgram", + "dns", + "domain", + "events", + "freelist", + "fs", + "http", + "https", + "_linklist", + "module", + "net", + "os", + "path", + "punycode", + "querystring", + "readline", + "repl", + "stream", + "string_decoder", + "sys", + "timers", + "tls", + "tty", + "url", + "util", + "vm", + "zlib" +] diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/node-modules-paths.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/node-modules-paths.js new file mode 100644 index 00000000..7c58e106 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/node-modules-paths.js @@ -0,0 +1,36 @@ +var path = require('path'); + +module.exports = function (start, opts) { + var modules = opts.moduleDirectory + ? [].concat(opts.moduleDirectory) + : ['node_modules'] + ; + var prefix = '/'; + if (/^([A-Za-z]:)/.test(start)) { + prefix = ''; + } else if (/^\\\\/.test(start)) { + prefix = '\\\\'; + } + var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/; + + // ensure that `start` is an absolute path at this point, + // resolving againt the process' current working directory + start = path.resolve(start); + + var parts = start.split(splitRe); + + var dirs = []; + for (var i = parts.length - 1; i >= 0; i--) { + if (modules.indexOf(parts[i]) !== -1) continue; + dirs = dirs.concat(modules.map(function(module_dir) { + return prefix + path.join( + path.join.apply(path, parts.slice(0, i + 1)), + module_dir + ); + })); + } + if (process.platform === 'win32'){ + dirs[dirs.length-1] = dirs[dirs.length-1].replace(":", ":\\"); + } + return dirs.concat(opts.paths); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/sync.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/sync.js new file mode 100644 index 00000000..ef91eddb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/lib/sync.js @@ -0,0 +1,81 @@ +var core = require('./core'); +var fs = require('fs'); +var path = require('path'); +var caller = require('./caller.js'); +var nodeModulesPaths = require('./node-modules-paths.js'); + +module.exports = function (x, opts) { + if (!opts) opts = {}; + var isFile = opts.isFile || function (file) { + try { var stat = fs.statSync(file) } + catch (err) { if (err && err.code === 'ENOENT') return false } + return stat.isFile() || stat.isFIFO(); + }; + var readFileSync = opts.readFileSync || fs.readFileSync; + + var extensions = opts.extensions || [ '.js' ]; + var y = opts.basedir || path.dirname(caller()); + + opts.paths = opts.paths || []; + + if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[\\\/])/.test(x)) { + var res = path.resolve(y, x); + if (x === '..') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return m; + } else { + var n = loadNodeModulesSync(x, y); + if (n) return n; + } + + if (core[x]) return x; + + throw new Error("Cannot find module '" + x + "' from '" + y + "'"); + + function loadAsFileSync (x) { + if (isFile(x)) { + return x; + } + + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + if (isFile(file)) { + return file; + } + } + } + + function loadAsDirectorySync (x) { + var pkgfile = path.join(x, '/package.json'); + if (isFile(pkgfile)) { + var body = readFileSync(pkgfile, 'utf8'); + try { + var pkg = JSON.parse(body); + if (opts.packageFilter) { + pkg = opts.packageFilter(pkg, x); + } + + if (pkg.main) { + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); + if (n) return n; + } + } + catch (err) {} + } + + return loadAsFileSync(path.join( x, '/index')); + } + + function loadNodeModulesSync (x, start) { + var dirs = nodeModulesPaths(start, opts); + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + var m = loadAsFileSync(path.join( dir, '/', x)); + if (m) return m; + var n = loadAsDirectorySync(path.join( dir, '/', x )); + if (n) return n; + } + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/package.json new file mode 100644 index 00000000..53f1927e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/package.json @@ -0,0 +1,56 @@ +{ + "name": "resolve", + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", + "version": "1.1.6", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-resolve.git" + }, + "main": "index.js", + "keywords": [ + "resolve", + "require", + "node", + "module" + ], + "scripts": { + "test": "tape test/*.js" + }, + "devDependencies": { + "tape": "^3.5.0", + "tap": "0.4.13" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "gitHead": "38d451c0ecd9267277a7683970432d37f001441e", + "bugs": { + "url": "https://github.com/substack/node-resolve/issues" + }, + "homepage": "https://github.com/substack/node-resolve", + "_id": "resolve@1.1.6", + "_shasum": "d3492ad054ca800f5befa612e61beac1eec98f8f", + "_from": "resolve@>=1.1.5 <2.0.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "dist": { + "shasum": "d3492ad054ca800f5befa612e61beac1eec98f8f", + "tarball": "http://registry.npmjs.org/resolve/-/resolve-1.1.6.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.6.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/readme.markdown b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/readme.markdown new file mode 100644 index 00000000..4fab9b04 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/readme.markdown @@ -0,0 +1,148 @@ +# resolve + +implements the [node `require.resolve()` +algorithm](http://nodejs.org/docs/v0.4.8/api/all.html#all_Together...) +such that you can `require.resolve()` on behalf of a file asynchronously and +synchronously + +[![build status](https://secure.travis-ci.org/substack/node-resolve.png)](http://travis-ci.org/substack/node-resolve) + +# example + +asynchronously resolve: + +``` js +var resolve = require('resolve'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err) + else console.log(res) +}); +``` + +``` +$ node example/async.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +synchronously resolve: + +``` js +var resolve = require('resolve'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); +``` + +``` +$ node example/sync.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +# methods + +``` js +var resolve = require('resolve') +``` + +## resolve(id, opts={}, cb) + +Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.package - `package.json` data applicable to the module being loaded + +* opts.extensions - array of file extensions to search in order + +* opts.readFile - how to read files asynchronously + +* opts.isFile - function to asynchronously test whether a file exists + +* opts.packageFilter - transform the parsed package.json contents before looking +at the "main" field + +* opts.pathFilter(pkg, path, relativePath) - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal +node_modules recursive walk (probably don't use this) + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +default `opts` values: + +``` javascript +{ + paths: [], + basedir: __dirname, + extensions: [ '.js' ], + readFile: fs.readFile, + isFile: function (file, cb) { + fs.stat(file, function (err, stat) { + if (err && err.code === 'ENOENT') cb(null, false) + else if (err) cb(err) + else cb(null, stat.isFile()) + }); + }, + moduleDirectory: 'node_modules' +} +``` + +## resolve.sync(id, opts) + +Synchronously resolve the module path string `id`, returning the result and +throwing an error when `id` can't be resolved. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.extensions - array of file extensions to search in order + +* opts.readFile - how to read files synchronously + +* opts.isFile - function to synchronously test whether a file exists + +* `opts.packageFilter(pkg, pkgfile)` - transform the parsed package.json +* contents before looking at the "main" field + +* opts.paths - require.paths array to use if nothing is found on the normal +node_modules recursive walk (probably don't use this) + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +default `opts` values: + +``` javascript +{ + paths: [], + basedir: __dirname, + extensions: [ '.js' ], + readFileSync: fs.readFileSync, + isFile: function (file) { + try { return fs.statSync(file).isFile() } + catch (e) { return false } + }, + moduleDirectory: 'node_modules' +} +```` + +## resolve.isCore(pkg) + +Return whether a package is in core. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install resolve +``` + +# license + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/core.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/core.js new file mode 100644 index 00000000..4a566820 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/core.js @@ -0,0 +1,12 @@ +var test = require('tape'); +var resolve = require('../'); + +test('core modules', function (t) { + t.ok(resolve.isCore('fs')); + t.ok(resolve.isCore('net')); + t.ok(resolve.isCore('http')); + + t.ok(!resolve.isCore('seq')); + t.ok(!resolve.isCore('../')); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/dotdot.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/dotdot.js new file mode 100644 index 00000000..b8767727 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/dotdot.js @@ -0,0 +1,29 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('dotdot', function (t) { + t.plan(4); + var dir = __dirname + '/dotdot/abc'; + + resolve('..', { basedir : dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, __dirname + '/dotdot/index.js'); + }); + + resolve('.', { basedir : dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, dir + '/index.js'); + }); +}); + +test('dotdot sync', function (t) { + t.plan(2); + var dir = __dirname + '/dotdot/abc'; + + var a = resolve.sync('..', { basedir : dir }); + t.equal(a, __dirname + '/dotdot/index.js'); + + var b = resolve.sync('.', { basedir : dir }); + t.equal(b, dir + '/index.js'); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/dotdot/abc/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/dotdot/abc/index.js new file mode 100644 index 00000000..67f2534e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/dotdot/abc/index.js @@ -0,0 +1,2 @@ +var x = require('..'); +console.log(x); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/dotdot/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/dotdot/index.js new file mode 100644 index 00000000..afec7360 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/dotdot/index.js @@ -0,0 +1 @@ +module.exports = 'whatever' diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/faulty_basedir.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/faulty_basedir.js new file mode 100644 index 00000000..24408188 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/faulty_basedir.js @@ -0,0 +1,17 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +// not sure what's up with this test anymore +if (process.platform !== 'win32') return; + +test('faulty basedir must produce error in windows', function (t) { + t.plan(1); + + var resolverDir = 'C:\\a\\b\\c\\d'; + + resolve('tape/lib/test.js', { basedir : resolverDir }, function (err, res, pkg) { + t.equal(true, !!err); + }); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/filter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/filter.js new file mode 100644 index 00000000..07c38f34 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/filter.js @@ -0,0 +1,18 @@ +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + t.plan(2); + var dir = __dirname + '/resolver'; + resolve('./baz', { + basedir : dir, + packageFilter : function (pkg) { + pkg.main = 'doom'; + return pkg; + } + }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/baz/doom.js'); + t.equal(pkg.main, 'doom'); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/filter_sync.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/filter_sync.js new file mode 100644 index 00000000..3f89b794 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/filter_sync.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + var dir = __dirname + '/resolver'; + var res = resolve.sync('./baz', { + basedir : dir, + packageFilter : function (pkg) { + pkg.main = 'doom' + return pkg; + } + }); + t.equal(res, dir + '/baz/doom.js'); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/mock.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/mock.js new file mode 100644 index 00000000..1cf3b124 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/mock.js @@ -0,0 +1,142 @@ +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(6); + + var files = { + '/foo/bar/baz.js' : 'beep' + }; + + function opts (basedir) { + return { + basedir : basedir, + isFile : function (file, cb) { + cb(null, files.hasOwnProperty(file)); + }, + readFile : function (file, cb) { + cb(null, files[file]); + } + } + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, '/foo/bar/baz.js'); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, '/foo/bar/baz.js'); + t.equal(pkg, undefined); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '/foo/bar'"); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '/foo/bar'"); + }); +}); + +test('mock from package', function (t) { + t.plan(6); + + var files = { + '/foo/bar/baz.js' : 'beep' + }; + + function opts (basedir) { + return { + basedir : basedir, + package : { main: 'bar' }, + isFile : function (file, cb) { + cb(null, files.hasOwnProperty(file)); + }, + readFile : function (file, cb) { + cb(null, files[file]); + } + } + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, '/foo/bar/baz.js'); + t.equal(pkg.main, 'bar'); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, '/foo/bar/baz.js'); + t.equal(pkg.main, 'bar'); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '/foo/bar'"); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '/foo/bar'"); + }); +}); + +test('mock package', function (t) { + t.plan(2); + + var files = { + '/foo/node_modules/bar/baz.js' : 'beep', + '/foo/node_modules/bar/package.json' : JSON.stringify({ + main : './baz.js' + }) + }; + + function opts (basedir) { + return { + basedir : basedir, + isFile : function (file, cb) { + cb(null, files.hasOwnProperty(file)); + }, + readFile : function (file, cb) { + cb(null, files[file]); + } + } + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, '/foo/node_modules/bar/baz.js'); + t.equal(pkg.main, './baz.js'); + }); +}); + +test('mock package from package', function (t) { + t.plan(2); + + var files = { + '/foo/node_modules/bar/baz.js' : 'beep', + '/foo/node_modules/bar/package.json' : JSON.stringify({ + main : './baz.js' + }) + }; + + function opts (basedir) { + return { + basedir : basedir, + package : { main: 'bar' }, + isFile : function (file, cb) { + cb(null, files.hasOwnProperty(file)); + }, + readFile : function (file, cb) { + cb(null, files[file]); + } + } + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, '/foo/node_modules/bar/baz.js'); + t.equal(pkg.main, './baz.js'); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/mock_sync.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/mock_sync.js new file mode 100644 index 00000000..abfd2893 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/mock_sync.js @@ -0,0 +1,68 @@ +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(4); + + var files = { + '/foo/bar/baz.js' : 'beep' + }; + + function opts (basedir) { + return { + basedir : basedir, + isFile : function (file) { + return files.hasOwnProperty(file) + }, + readFileSync : function (file) { + return files[file] + } + } + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + '/foo/bar/baz.js' + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + '/foo/bar/baz.js' + ); + + t.throws(function () { + resolve.sync('baz', opts('/foo/bar')); + }); + + t.throws(function () { + resolve.sync('../baz', opts('/foo/bar')); + }); +}); + +test('mock package', function (t) { + t.plan(1); + + var files = { + '/foo/node_modules/bar/baz.js' : 'beep', + '/foo/node_modules/bar/package.json' : JSON.stringify({ + main : './baz.js' + }) + }; + + function opts (basedir) { + return { + basedir : basedir, + isFile : function (file) { + return files.hasOwnProperty(file) + }, + readFileSync : function (file) { + return files[file] + } + } + } + + t.equal( + resolve.sync('bar', opts('/foo')), + '/foo/node_modules/bar/baz.js' + ); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir.js new file mode 100644 index 00000000..06395d8c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir.js @@ -0,0 +1,56 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('moduleDirectory strings', function (t) { + t.plan(4); + var dir = __dirname + '/module_dir'; + var xopts = { + basedir : dir, + moduleDirectory: 'xmodules' + }; + resolve('aaa', xopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, dir + '/xmodules/aaa/index.js'); + }); + + var yopts = { + basedir : dir, + moduleDirectory: 'ymodules' + }; + resolve('aaa', yopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, dir + '/ymodules/aaa/index.js'); + }); +}); + +test('moduleDirectory array', function (t) { + t.plan(6); + var dir = __dirname + '/module_dir'; + var aopts = { + basedir : dir, + moduleDirectory: [ 'xmodules', 'ymodules', 'zmodules' ] + }; + resolve('aaa', aopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, dir + '/xmodules/aaa/index.js'); + }); + + var bopts = { + basedir : dir, + moduleDirectory: [ 'zmodules', 'ymodules', 'xmodules' ] + }; + resolve('aaa', bopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, dir + '/ymodules/aaa/index.js'); + }); + + var copts = { + basedir : dir, + moduleDirectory: [ 'xmodules', 'ymodules', 'zmodules' ] + }; + resolve('bbb', copts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, dir + '/zmodules/bbb/main.js'); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/xmodules/aaa/index.js new file mode 100644 index 00000000..55cd18ca --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/xmodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x * 100 } diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/ymodules/aaa/index.js new file mode 100644 index 00000000..651aca86 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/ymodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x + 100 } diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/zmodules/bbb/main.js new file mode 100644 index 00000000..4325a0bd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/zmodules/bbb/main.js @@ -0,0 +1 @@ +module.exports = function (n) { return n * 111 } diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/zmodules/bbb/package.json new file mode 100644 index 00000000..c13b8cf6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/module_dir/zmodules/bbb/package.json @@ -0,0 +1,3 @@ +{ + "main": "main.js" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path.js new file mode 100644 index 00000000..2407189b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path.js @@ -0,0 +1,48 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('$NODE_PATH', function (t) { + t.plan(4); + + resolve('aaa', { + paths: [ + __dirname + '/node_path/x', + __dirname + '/node_path/y' + ], + basedir: __dirname, + }, function (err, res) { + t.equal(res, __dirname + '/node_path/x/aaa/index.js'); + }); + + resolve('bbb', { + paths: [ + __dirname + '/node_path/x', + __dirname + '/node_path/y' + ], + basedir: __dirname, + }, function (err, res) { + t.equal(res, __dirname + '/node_path/y/bbb/index.js'); + }); + + resolve('ccc', { + paths: [ + __dirname + '/node_path/x', + __dirname + '/node_path/y' + ], + basedir: __dirname, + }, function (err, res) { + t.equal(res, __dirname + '/node_path/x/ccc/index.js'); + }); + + // ensure that relative paths still resolve against the + // regular `node_modules` correctly + resolve('tap', { + paths: [ + 'node_path', + ], + basedir: 'node_path/x', + }, function (err, res) { + t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap/lib/main.js')); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/x/aaa/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/x/aaa/index.js new file mode 100644 index 00000000..1ea59138 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/x/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'A' diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/x/ccc/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/x/ccc/index.js new file mode 100644 index 00000000..f186fa75 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/x/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'C' diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/y/bbb/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/y/bbb/index.js new file mode 100644 index 00000000..e22dd83c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/y/bbb/index.js @@ -0,0 +1 @@ +module.exports = 'B' diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/y/ccc/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/y/ccc/index.js new file mode 100644 index 00000000..d0043d1e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/node_path/y/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'CY' diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/nonstring.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/nonstring.js new file mode 100644 index 00000000..ef63c40f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/nonstring.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var resolve = require('../'); + +test('nonstring', function (t) { + t.plan(1); + resolve(555, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter.js new file mode 100644 index 00000000..142f94d6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter.js @@ -0,0 +1,35 @@ +var test = require('tape'); +var resolve = require('../'); + +test('#62: deep module references and the pathFilter', function(t){ + t.plan(9); + + var resolverDir = __dirname + '/pathfilter/deep_ref'; + var pathFilter = function(pkg, x, remainder){ + t.equal(pkg.version, "1.2.3"); + t.equal(x, resolverDir + '/node_modules/deep/ref'); + t.equal(remainder, "ref"); + return "alt"; + }; + + resolve('deep/ref', { basedir : resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + + t.equal(pkg.version, "1.2.3"); + t.equal(res, resolverDir + '/node_modules/deep/ref.js'); + }); + + resolve('deep/deeper/ref', { basedir: resolverDir }, + function(err, res, pkg) { + if(err) t.fail(err); + t.notEqual(pkg, undefined); + t.equal(pkg.version, "1.2.3"); + t.equal(res, resolverDir + '/node_modules/deep/deeper/ref.js'); + }); + + resolve('deep/ref', { basedir : resolverDir, pathFilter : pathFilter }, + function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, resolverDir + '/node_modules/deep/alt.js'); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/main.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/main.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/alt.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/alt.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/deeper/ref.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/deeper/ref.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/package.json new file mode 100644 index 00000000..fe4b408a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/package.json @@ -0,0 +1,4 @@ +{ + "name": "deep", + "version": "1.2.3" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/ref.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/ref.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence.js new file mode 100644 index 00000000..c716f0e9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence.js @@ -0,0 +1,23 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('precedence', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'precedence/aaa'); + + resolve('./', { basedir : dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg.name, 'resolve'); + }); +}); + +test('./ should not load ${dir}.js', function (t) { + t.plan(1); + var dir = path.join(__dirname, 'precedence/bbb'); + + resolve('./', { basedir : dir }, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/aaa.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/aaa.js new file mode 100644 index 00000000..a182397c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/aaa.js @@ -0,0 +1 @@ +module.exports = 'wtf' diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/aaa/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/aaa/index.js new file mode 100644 index 00000000..993b03c2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'okok' diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/aaa/main.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/aaa/main.js new file mode 100644 index 00000000..db38959d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/aaa/main.js @@ -0,0 +1 @@ +console.log(require('./')) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/bbb.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/bbb.js new file mode 100644 index 00000000..c8a9996b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/bbb.js @@ -0,0 +1 @@ +module.exports '>_<' diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/bbb/main.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/bbb/main.js new file mode 100644 index 00000000..716b81d4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/precedence/bbb/main.js @@ -0,0 +1 @@ +console.log(require('./')); // should throw diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver.js new file mode 100644 index 00000000..5bbb05f9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver.js @@ -0,0 +1,281 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('async foo', function (t) { + t.plan(9); + var dir = __dirname + '/resolver'; + + resolve('./foo', { basedir : dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/foo.js'); + t.equal(pkg.name, 'resolve'); + }); + + resolve('./foo.js', { basedir : dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/foo.js'); + t.equal(pkg.name, 'resolve'); + }); + + resolve('./foo', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/foo.js'); + t.equal(pkg.main, 'resolver'); + }); + + resolve('./foo.js', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/foo.js'); + t.equal(pkg.main, 'resolver'); + }); + + resolve('foo', { basedir : dir }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); + }); +}); + +test('bar', function (t) { + t.plan(6); + var dir = __dirname + '/resolver'; + + resolve('foo', { basedir : dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/bar/node_modules/foo/index.js'); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir : dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/bar/node_modules/foo/index.js'); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir : dir + '/bar', package: { main: 'bar' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/bar/node_modules/foo/index.js'); + t.equal(pkg, undefined); + }); +}); + +test('baz', function (t) { + t.plan(4); + var dir = __dirname + '/resolver'; + + resolve('./baz', { basedir : dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/baz/quux.js'); + t.equal(pkg.main, 'quux.js'); + }); + + resolve('./baz', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/baz/quux.js'); + t.equal(pkg.main, 'quux.js'); + }); +}); + +test('biz', function (t) { + t.plan(24); + var dir = __dirname + '/resolver/biz/node_modules'; + + resolve('./grux', { basedir : dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/grux/index.js'); + t.equal(pkg, undefined); + }); + + resolve('./grux', { basedir : dir, package: { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/grux/index.js'); + t.equal(pkg.main, 'biz'); + }); + + resolve('./garply', { basedir : dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/garply/lib/index.js'); + t.equal(pkg.main, './lib'); + }); + + resolve('./garply', { basedir : dir, package: { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/garply/lib/index.js'); + t.equal(pkg.main, './lib'); + }); + + resolve('tiv', { basedir : dir + '/grux' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/tiv/index.js'); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir : dir + '/grux', package: { main: 'grux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/tiv/index.js'); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir : dir + '/garply' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/tiv/index.js'); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir : dir + '/garply', package: { main: './lib' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/tiv/index.js'); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir : dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/grux/index.js'); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir : dir + '/tiv', package: { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/grux/index.js'); + t.equal(pkg, undefined); + }); + + resolve('garply', { basedir : dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/garply/lib/index.js'); + t.equal(pkg.main, './lib'); + }); + + resolve('garply', { basedir : dir + '/tiv', package: { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/garply/lib/index.js'); + t.equal(pkg.main, './lib'); + }); +}); + +test('quux', function (t) { + t.plan(2); + var dir = __dirname + '/resolver/quux'; + + resolve('./foo', { basedir : dir, package: { main: 'quux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/foo/index.js'); + t.equal(pkg.main, 'quux'); + }); +}); + +test('normalize', function (t) { + t.plan(2); + var dir = __dirname + '/resolver/biz/node_modules/grux'; + + resolve('../grux', { basedir : dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/index.js'); + t.equal(pkg, undefined); + }); +}); + +test('cup', function (t) { + t.plan(3); + var dir = __dirname + '/resolver'; + + resolve('./cup', { basedir : dir, extensions : [ '.js', '.coffee' ] }, + function (err, res) { + if (err) t.fail(err); + t.equal(res, dir + '/cup.coffee'); + }); + + resolve('./cup.coffee', { basedir : dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, dir + '/cup.coffee'); + }); + + resolve('./cup', { basedir : dir, extensions : [ '.js' ] }, + function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); + }); +}); + +test('mug', function (t) { + t.plan(3); + var dir = __dirname + '/resolver'; + + resolve('./mug', { basedir : dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, dir + '/mug.js'); + }); + + resolve('./mug', { basedir : dir, extensions : [ '.coffee', '.js' ] }, + function (err, res) { + if (err) t.fail(err); + t.equal(res, dir + '/mug.coffee'); + }); + + resolve('./mug', { basedir : dir, extensions : [ '.js', '.coffee' ] }, + function (err, res) { + t.equal(res, dir + '/mug.js'); + }); +}); + +test('other path', function (t) { + t.plan(4); + var resolverDir = __dirname + '/resolver'; + var dir = resolverDir + '/bar'; + var otherDir = resolverDir + '/other_path'; + + resolve('root', { basedir : dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, resolverDir + '/other_path/root.js'); + }); + + resolve('lib/other-lib', { basedir : dir, paths: [otherDir] }, + function (err, res) { + if (err) t.fail(err); + t.equal(res, resolverDir + '/other_path/lib/other-lib.js'); + }); + + resolve('root', { basedir : dir, }, function (err, res) { + t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); + }); + + resolve('zzz', { basedir : dir, paths: [otherDir] }, function (err, res) { + t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); + }); +}); + +test('incorrect main', function (t) { + t.plan(1) + + var resolverDir = __dirname + '/resolver'; + var dir = resolverDir + '/incorrect_main'; + + resolve('./incorrect_main', { basedir : resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, dir + '/index.js'); + }); +}); + +test('without basedir', function (t) { + t.plan(1); + + var dir = __dirname + '/resolver/without_basedir'; + var tester = require(dir + '/main.js'); + + tester(t, function (err, res, pkg){ + if (err) { + t.fail(err); + } else { + t.equal(res, dir + '/node_modules/mymodule.js'); + } + }); +}); + +test('#25: node modules with the same name as node stdlib modules', function (t) { + t.plan(1); + + var resolverDir = __dirname + '/resolver/punycode'; + + resolve('punycode', { basedir : resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, resolverDir + '/node_modules/punycode/index.js'); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/baz/doom.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/baz/doom.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/baz/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/baz/package.json new file mode 100644 index 00000000..6b81dcdd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/baz/package.json @@ -0,0 +1,3 @@ +{ + "main" : "quux.js" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/baz/quux.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/baz/quux.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/baz/quux.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/garply/lib/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/garply/lib/index.js new file mode 100644 index 00000000..0379e29f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/garply/lib/index.js @@ -0,0 +1 @@ +module.exports = 'hello garply'; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json new file mode 100644 index 00000000..babaac58 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json @@ -0,0 +1,3 @@ +{ + "main" : "./lib" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js new file mode 100644 index 00000000..49960555 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js @@ -0,0 +1 @@ +module.exports = require('tiv') * 100; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js new file mode 100644 index 00000000..690aad34 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js @@ -0,0 +1 @@ +module.exports = 3; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/cup.coffee b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/cup.coffee new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/cup.coffee @@ -0,0 +1 @@ + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/foo.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/foo.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/foo.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/incorrect_main/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/incorrect_main/index.js new file mode 100644 index 00000000..bc1fb0a6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/incorrect_main/index.js @@ -0,0 +1,2 @@ +// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate +module.exports = 1; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/incorrect_main/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/incorrect_main/package.json new file mode 100644 index 00000000..1592ed39 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/incorrect_main/package.json @@ -0,0 +1,3 @@ +{ + "main" : "wrong.js" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/mug.coffee b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/mug.coffee new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/mug.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/mug.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/other_path/lib/other-lib.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/other_path/root.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/other_path/root.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/punycode/node_modules/punycode/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/punycode/node_modules/punycode/index.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/quux/foo/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/quux/foo/index.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/quux/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/without_basedir/main.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/without_basedir/main.js new file mode 100644 index 00000000..5f211e9c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/without_basedir/main.js @@ -0,0 +1,6 @@ +resolve = require('../../../'); + +module.exports = function(t, cb) { + resolve('mymodule', null, cb); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/without_basedir/node_modules/mymodule.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/without_basedir/node_modules/mymodule.js new file mode 100644 index 00000000..2b58aa40 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver/without_basedir/node_modules/mymodule.js @@ -0,0 +1 @@ +module.exports = "The tools we use have a profound (and devious!) influence on our thinking habits, and, therefore, on our thinking abilities.- E. Dijkstra" diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver_sync.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver_sync.js new file mode 100644 index 00000000..59825317 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/resolver_sync.js @@ -0,0 +1,180 @@ +var test = require('tape'); +var resolve = require('../'); + +test('foo', function (t) { + var dir = __dirname + '/resolver'; + + t.equal( + resolve.sync('./foo', { basedir : dir }), + dir + '/foo.js' + ); + + t.equal( + resolve.sync('./foo.js', { basedir : dir }), + dir + '/foo.js' + ); + + t.throws(function () { + resolve.sync('foo', { basedir : dir }); + }); + + t.end(); +}); + +test('bar', function (t) { + var dir = __dirname + '/resolver'; + + t.equal( + resolve.sync('foo', { basedir : dir + '/bar' }), + dir + '/bar/node_modules/foo/index.js' + ); + t.end(); +}); + +test('baz', function (t) { + var dir = __dirname + '/resolver'; + + t.equal( + resolve.sync('./baz', { basedir : dir }), + dir + '/baz/quux.js' + ); + t.end(); +}); + +test('biz', function (t) { + var dir = __dirname + '/resolver/biz/node_modules'; + t.equal( + resolve.sync('./grux', { basedir : dir }), + dir + '/grux/index.js' + ); + + t.equal( + resolve.sync('tiv', { basedir : dir + '/grux' }), + dir + '/tiv/index.js' + ); + + t.equal( + resolve.sync('grux', { basedir : dir + '/tiv' }), + dir + '/grux/index.js' + ); + t.end(); +}); + +test('normalize', function (t) { + var dir = __dirname + '/resolver/biz/node_modules/grux'; + t.equal( + resolve.sync('../grux', { basedir : dir }), + dir + '/index.js' + ); + t.end(); +}); + +test('cup', function (t) { + var dir = __dirname + '/resolver'; + t.equal( + resolve.sync('./cup', { + basedir : dir, + extensions : [ '.js', '.coffee' ] + }), + dir + '/cup.coffee' + ); + + t.equal( + resolve.sync('./cup.coffee', { + basedir : dir + }), + dir + '/cup.coffee' + ); + + t.throws(function () { + resolve.sync('./cup', { + basedir : dir, + extensions : [ '.js' ] + }) + }); + + t.end(); +}); + +test('mug', function (t) { + var dir = __dirname + '/resolver'; + t.equal( + resolve.sync('./mug', { basedir : dir }), + dir + '/mug.js' + ); + + t.equal( + resolve.sync('./mug', { + basedir : dir, + extensions : [ '.coffee', '.js' ] + }), + dir + '/mug.coffee' + ); + + t.equal( + resolve.sync('./mug', { + basedir : dir, + extensions : [ '.js', '.coffee' ] + }), + dir + '/mug.js' + ); + + t.end(); +}); + +test('other path', function (t) { + var resolverDir = __dirname + '/resolver'; + var dir = resolverDir + '/bar'; + var otherDir = resolverDir + '/other_path'; + + var path = require('path'); + + t.equal( + resolve.sync('root', { + basedir : dir, + paths: [otherDir] }), + resolverDir + '/other_path/root.js' + ); + + t.equal( + resolve.sync('lib/other-lib', { + basedir : dir, + paths: [otherDir] }), + resolverDir + '/other_path/lib/other-lib.js' + ); + + t.throws(function () { + resolve.sync('root', { basedir : dir, }); + }); + + t.throws(function () { + resolve.sync('zzz', { + basedir : dir, + paths: [otherDir] }); + }); + + t.end(); +}); + +test('incorrect main', function (t) { + var resolverDir = __dirname + '/resolver'; + var dir = resolverDir + '/incorrect_main'; + + t.equal( + resolve.sync('./incorrect_main', { basedir : resolverDir }), + dir + '/index.js' + ) + + t.end() +}); + +test('#25: node modules with the same name as node stdlib modules', function (t) { + var resolverDir = __dirname + '/resolver/punycode'; + + t.equal( + resolve.sync('punycode', { basedir : resolverDir }), + resolverDir + '/node_modules/punycode/index.js' + ) + + t.end() +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/subdirs.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/subdirs.js new file mode 100644 index 00000000..957abfe0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/subdirs.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('subdirs', function (t) { + t.plan(2); + + var dir = path.join(__dirname, '/subdirs'); + resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json new file mode 100644 index 00000000..3cc0ecbe --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json @@ -0,0 +1 @@ +[1,2,3] diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/subdirs/node_modules/a/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/subdirs/node_modules/a/package.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/resolve/test/subdirs/node_modules/a/package.json @@ -0,0 +1 @@ +{} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/.npmignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/CHANGELOG.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/CHANGELOG.md new file mode 100644 index 00000000..b85b7966 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/CHANGELOG.md @@ -0,0 +1,50 @@ +# rocambole-indent changelog + +## v2.0.4 (2015-05-02) + + - align comments surrounded by empty lines with next non-empty line. (#6) + +## v2.0.3 (2015-03-26) + + - fix comment alignment if surrounded by empty lines (#5) + +## v2.0.2 (2015-03-25) + + - fix edge cases related to comments just after `{` followed by an empty line. + +## v2.0.1 (2015-03-25) + + - safeguard against empty nodes/ast on `alignComments()` + +## v2.0.0 (2015-03-25) + + - change `alignComments()` rule to add one indent level if comment is inside + empty block/array/parenthesis + +## v1.1.1 (2015-03-25) + + - fix `WhiteSpace` conversion into `Indent` inside `alignComments()` + +## v1.1.0 (2015-03-25) + + - update `alignComments()` to consider `WhiteSpace` tokens at the begining of + the line as `Indent` tokens as well + - add `whiteSpaceToIndent()` + +## v1.0.0 (2015-03-24) + + - add `alignComments()` + - expose `updateBlockComment()` + +## v0.2.0 (2015-03-20) + + - rename `line()` as `addLevel()` + - change the way `inBetween()` loops through the `start` and `end` tokens + (not inclusive) + - `sanitize()` won't call `updateBlockComment()` since this is already handled + by `addLevel()` + +## v0.1.0 (2015-03-20) + + - initial release + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/LICENSE.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/LICENSE.md new file mode 100644 index 00000000..5987e55a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Miller Medeiros + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/README.md new file mode 100644 index 00000000..eefedfad --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/README.md @@ -0,0 +1,162 @@ +# rocambole-indent + +Helpers to manipulate [rocambole](https://github.com/millermedeiros/rocambole) +`Indent` tokens. + +Used mainly by [esformatter](https://github.com/millermedeiros/esformatter/) and its plugins. + + +## API + +```js +var indent = require('rocambole-indent'); +``` + +### setOptions(opts) + +`setOptions` used to set the indent value. + +```js +setOptions({ + // sets "value" used by `Indent` tokens (defaults to two spaces) + value: ' ', + // amount of indents added on `alignComments` if comment is inside an empty + // block (surrounded by `{}`, `[]` or `()`) - defaults to `1` + CommentInsideEmptyBlock: 1 +}); +``` + +### inBetween(startToken, endToken, level) + +Increase/Decrease the indent level in between the `startToken` and `endToken`. + +It will not include the start and end tokens on the indentation range, only the +tokens in between them. + +```js +// increase the indent level by 1 +inBetween(node.startToken, node.endToken, 1); +// decrease the indent level by 1 +inBetween(node.startToken, node.endToken, -1); +// zero does nothing +inBetween(node.endToken, 0); +``` + +**Important:** negative values only work if original `Indent` token contains +a `level` property since there is no reliable way to infer this value (probably +will only work if indent was added by this lib). + +### addLevel(token, level) + +Increases/decreases the indent level at the beginning of the line that includes +the given `token`. + +```js +// adds 2 indents +addLevel(node.startToken, 2); +// decrease indent level in 1 step +addLevel(node.endToken, -1); +// zero does nothing +addLevel(node.endToken, 0); +``` + +**Important:** negative values only work if original `Indent` token contains +a `level` property since there is no reliable way to infer this value (probably +will only work if indent was added by this lib). + +### sanitize(astOrNode) + +Removes any `Indent` tokens that don't have a `level` property (this is +usually the original indentation of the program parsed by rocambole) or that +are not at the beginning of the line. Also removing `WhiteSpace` tokens that +are at the beginning of the line to avoid mistakes. + +```js +// sanitize a single node +sanitize(node); +// sanitize whole AST +sanitize(ast); +``` + +### updateBlockComment(token) + +Updates `BlockComment` `raw` value to make sure all the lines have the same +`Indent` level. + +This is called internally by the `addLevel` and `indentInBetween` methods (if +first token of line is a `BlockComment`), so as long as you only use those +methods to edit the indent level you shouldn't need to call this. + +### alignComments(astOrNode) + +Align all the comments based on the next/previous lines inside a given `ast` or +`node`. + +It will align the comments with the next line unless the comment block is +followed by an empty line, in that case it will use the previous non-empty line +as a reference. + +Example output: + +```js +// aligned with next line +switch (foo) { + // aligned with next non-empty line + + case bar: + // aligned with next line + baz(); + // this should be aligned with previous line since comment block is + // followed by an empty line + + // aligned with next line + case biz: + // aligned with next line + what(); +// aligned with next line +} + +function noop() { + // indented since it's inside an empty block +} + +// aligned with previous line since it's at the end of program +``` + +### whiteSpaceToIndent(token, [indentValue]) + +Convert `WhiteSpace` token into `Indent` if it's the first token of the line. + +You can pass a custom `indentValue` or it will use the value set by +`setOptions()` to calculate the indent `level` (basically count how many times +this string repeats inside the `token.value`). + +```js +var token = { + type: 'WhiteSpace', + value: '\t\t\t', + prev: { type: 'LineBreak', value: '\n' } +}; +whiteSpaceToIndent(token, '\t'); +// edits properties in place +console.log(token.type); // > "Indent" +console.log(token.level); // > 3 +``` + +This is useful in case you want to make sure `sanitize` won't remove the +original indents. + +## Debug + +This module uses [debug](https://www.npmjs.com/package/debug) internally. To +make it easier to identify what is wrong we sometimes run the esformatter tests +with a `DEBUG` flag, like: + +```sh +DEBUG=rocambole:indent npm test +``` + +## License + +Released under the MIT License + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/.jshintrc b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/.jshintrc new file mode 100644 index 00000000..299877f2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/.jshintrc @@ -0,0 +1,3 @@ +{ + "laxbreak": true +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/.npmignore new file mode 100644 index 00000000..7e6163db --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/.npmignore @@ -0,0 +1,6 @@ +support +test +examples +example +*.sock +dist diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/History.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/History.md new file mode 100644 index 00000000..854c9711 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/History.md @@ -0,0 +1,195 @@ + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/Makefile b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/Makefile new file mode 100644 index 00000000..5cf4a596 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/Makefile @@ -0,0 +1,36 @@ + +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# applications +NODE ?= $(shell which node) +NPM ?= $(NODE) $(shell which npm) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +all: dist/debug.js + +install: node_modules + +clean: + @rm -rf dist + +dist: + @mkdir -p $@ + +dist/debug.js: node_modules browser.js debug.js dist + @$(BROWSERIFY) \ + --standalone debug \ + . > $@ + +distclean: clean + @rm -rf node_modules + +node_modules: package.json + @NODE_ENV= $(NPM) install + @touch node_modules + +.PHONY: all install clean distclean diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/Readme.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/Readme.md new file mode 100644 index 00000000..b4f45e3c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/Readme.md @@ -0,0 +1,188 @@ +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +#### Windows note + + On Windows the environment variable is set using the `set` command. + + ```cmd + set DEBUG=*,-not_this + ``` + +Then, run the program to be debugged as usual. + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: + +```js +window.myDebug = require("debug"); +``` + + ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: + +```js +myDebug.enable("worker:*") +``` + + Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +#### Web Inspector Colors + + Colors are also enabled on "Web Inspectors" that understand the `%c` formatting + option. These are WebKit web inspectors, Firefox ([since version + 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) + and the Firebug plugin for Firefox (any version). + + Colored output looks something like: + + ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) + +### stderr vs stdout + +You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: + +Example _stdout.js_: + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +### Save debug output to a file + +You can save all debug statements to a file by piping them. + +Example: + +```bash +$ DEBUG_FD=3 node your-app.js 3> whatever.log +``` + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + +## License + +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/bower.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/bower.json new file mode 100644 index 00000000..6af573ff --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/bower.json @@ -0,0 +1,28 @@ +{ + "name": "visionmedia-debug", + "main": "dist/debug.js", + "version": "2.2.0", + "homepage": "https://github.com/visionmedia/debug", + "authors": [ + "TJ Holowaychuk " + ], + "description": "visionmedia-debug", + "moduleType": [ + "amd", + "es6", + "globals", + "node" + ], + "keywords": [ + "visionmedia", + "debug" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/browser.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/browser.js new file mode 100644 index 00000000..7c764522 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/browser.js @@ -0,0 +1,168 @@ + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + return JSON.stringify(v); +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/component.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/component.json new file mode 100644 index 00000000..ca106372 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "2.2.0", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/debug.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/debug.js new file mode 100644 index 00000000..7571a860 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/debug.js @@ -0,0 +1,197 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() { + } + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node.js new file mode 100644 index 00000000..1d392a81 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node.js @@ -0,0 +1,209 @@ + +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); + if (0 === debugColors.length) { + return tty.isatty(fd); + } else { + return '0' !== debugColors + && 'no' !== debugColors + && 'false' !== debugColors + && 'disabled' !== debugColors; + } +} + +/** + * Map %o to `util.inspect()`, since Node doesn't do that out of the box. + */ + +var inspect = (4 === util.inspect.length ? + // node <= 0.8.x + function (v, colors) { + return util.inspect(v, void 0, void 0, colors); + } : + // node > 0.8.x + function (v, colors) { + return util.inspect(v, { colors: colors }); + } +); + +exports.formatters.o = function(v) { + return inspect(v, this.useColors) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + var name = this.namespace; + + if (useColors) { + var c = this.color; + + args[0] = ' \u001b[3' + c + ';1m' + name + ' ' + + '\u001b[0m' + + args[0] + '\u001b[3' + c + 'm' + + ' +' + exports.humanize(this.diff) + '\u001b[0m'; + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } + return args; +} + +/** + * Invokes `console.error()` with the specified arguments. + */ + +function log() { + return stream.write(util.format.apply(this, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = require('fs'); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = require('net'); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/.npmignore new file mode 100644 index 00000000..d1aa0ce4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/.npmignore @@ -0,0 +1,5 @@ +node_modules +test +History.md +Makefile +component.json diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/History.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/History.md new file mode 100644 index 00000000..32fdfc17 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/History.md @@ -0,0 +1,66 @@ + +0.7.1 / 2015-04-20 +================== + + * prevent extraordinary long inputs (@evilpacket) + * Fixed broken readme link + +0.7.0 / 2014-11-24 +================== + + * add time abbreviations, updated tests and readme for the new units + * fix example in the readme. + * add LICENSE file + +0.6.2 / 2013-12-05 +================== + + * Adding repository section to package.json to suppress warning from NPM. + +0.6.1 / 2013-05-10 +================== + + * fix singularization [visionmedia] + +0.6.0 / 2013-03-15 +================== + + * fix minutes + +0.5.1 / 2013-02-24 +================== + + * add component namespace + +0.5.0 / 2012-11-09 +================== + + * add short formatting as default and .long option + * add .license property to component.json + * add version to component.json + +0.4.0 / 2012-10-22 +================== + + * add rounding to fix crazy decimals + +0.3.0 / 2012-09-07 +================== + + * fix `ms()` [visionmedia] + +0.2.0 / 2012-09-03 +================== + + * add component.json [visionmedia] + * add days support [visionmedia] + * add hours support [visionmedia] + * add minutes support [visionmedia] + * add seconds support [visionmedia] + * add ms string support [visionmedia] + * refactor tests to facilitate ms(number) [visionmedia] + +0.1.0 / 2012-03-07 +================== + + * Initial release diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/LICENSE new file mode 100644 index 00000000..6c07561b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/README.md new file mode 100644 index 00000000..9b4fd035 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/README.md @@ -0,0 +1,35 @@ +# ms.js: miliseconds conversion utility + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('100') // 100 +``` + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as +a number (e.g: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of +equivalent ms is returned. + +## License + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/index.js new file mode 100644 index 00000000..4f927716 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/index.js @@ -0,0 +1,125 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/package.json new file mode 100644 index 00000000..253335e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/node_modules/ms/package.json @@ -0,0 +1,48 @@ +{ + "name": "ms", + "version": "0.7.1", + "description": "Tiny ms conversion utility", + "repository": { + "type": "git", + "url": "git://github.com/guille/ms.js.git" + }, + "main": "./index", + "devDependencies": { + "mocha": "*", + "expect.js": "*", + "serve": "*" + }, + "component": { + "scripts": { + "ms/index.js": "index.js" + } + }, + "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", + "bugs": { + "url": "https://github.com/guille/ms.js/issues" + }, + "homepage": "https://github.com/guille/ms.js", + "_id": "ms@0.7.1", + "scripts": {}, + "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "_from": "ms@0.7.1", + "_npmVersion": "2.7.5", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "dist": { + "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/package.json new file mode 100644 index 00000000..08b1116a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/node_modules/debug/package.json @@ -0,0 +1,73 @@ +{ + "name": "debug", + "version": "2.2.0", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + } + ], + "license": "MIT", + "dependencies": { + "ms": "0.7.1" + }, + "devDependencies": { + "browserify": "9.0.3", + "mocha": "*" + }, + "main": "./node.js", + "browser": "./browser.js", + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" + } + }, + "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@2.2.0", + "scripts": {}, + "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "_from": "debug@>=2.1.3 <3.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "tarball": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/package.json new file mode 100644 index 00000000..dc207094 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/package.json @@ -0,0 +1,65 @@ +{ + "name": "rocambole-indent", + "version": "2.0.4", + "description": "helpers for rocambole AST indentation", + "main": "rocambole-indent.js", + "scripts": { + "test": "node test/runner.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/rocambole-indent.git" + }, + "keywords": [ + "rocambole", + "ast", + "esformatter", + "indent" + ], + "author": { + "name": "Miller Medeiros", + "email": "http://millermedeiros.com", + "url": "contact@millermedeiros.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/millermedeiros/rocambole-indent/issues" + }, + "homepage": "https://github.com/millermedeiros/rocambole-indent", + "jshintConfig": { + "node": true, + "eqnull": true + }, + "dependencies": { + "debug": "^2.1.3", + "mout": "^0.11.0", + "rocambole-token": "^1.2.1" + }, + "devDependencies": { + "disparity": "^2.0.0", + "rocambole": "^0.5.1" + }, + "gitHead": "c3e41b175da3b964814b0214df96d507e0bd4128", + "_id": "rocambole-indent@2.0.4", + "_shasum": "a18a24977ca0400b861daa4631e861dcb52d085c", + "_from": "rocambole-indent@>=2.0.3 <3.0.0", + "_npmVersion": "2.7.5", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + } + ], + "dist": { + "shasum": "a18a24977ca0400b861daa4631e861dcb52d085c", + "tarball": "http://registry.npmjs.org/rocambole-indent/-/rocambole-indent-2.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/rocambole-indent/-/rocambole-indent-2.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/rocambole-indent.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/rocambole-indent.js new file mode 100644 index 00000000..17937b87 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/rocambole-indent.js @@ -0,0 +1,348 @@ +'use strict'; + +var debug = require('debug')('rocambole:indent'); +var tk = require('rocambole-token'); +var escapeRegExp = require('mout/string/escapeRegExp'); +var repeat = require('mout/string/repeat'); + + +// --- + +var _opts = { + value: ' ', + CommentInsideEmptyBlock: 1 +}; + +// --- + + +exports.setOptions = function(opts) { + _opts = opts; +}; + + +exports.inBetween = indentInBetween; +function indentInBetween(startToken, endToken, level) { + level = level != null ? level : 1; + + if (!level || (!startToken || !endToken) || startToken === endToken) { + debug( + '[inBetween] not going to indent. start: %s, end: %s, level: %s', + startToken && startToken.value, + endToken && endToken.value, + level + ); + return; + } + + var token = startToken && startToken.next; + var endsWithBraces = isClosingBrace(endToken); + while (token && token !== endToken) { + if (tk.isBr(token.prev)) { + // we ignore the last indent (if first token on the line is a ws or + // ident) just because in most cases we don't want to change the indent + // just before "}", ")" and "]" - this allow us to pass + // `node.body.startToken` and `node.body.endToken` as the range + if (token.next !== endToken || !endsWithBraces || !tk.isEmpty(token)) { + addLevel(token, level); + } + } + token = token.next; + } +} + + +function isClosingBrace(token) { + var val = token.value; + return val === ')' || val === '}' || val === ']'; +} + + +exports.addLevel = addLevel; +function addLevel(token, level) { + if (!level) { + // zero is a noop + return; + } + + token = findStartOfLine(token); + + if (!token) { + // we never indent empty lines! + debug('[indent.addLevel] can\'t find start of line'); + return; + } + + var value = repeat(_opts.value, Math.abs(level)); + + if (tk.isIndent(token)) { + if (level > 0) { + // if it's already an Indent we just bump the value & level + token.value += value; + token.level += level; + } else { + if (token.level + level <= 0) { + tk.remove(token); + } else { + token.value = token.value.replace(value, ''); + token.level += level; + } + } + if (token.next && token.next.type === 'BlockComment') { + updateBlockComment(token.next); + } + return; + } + + if (level < 1) { + // we can't remove indent if previous token isn't an indent + debug( + '[addLevel] we can\'t decrement if line doesn\'t start with Indent. token: %s, level: %s', + token && token.value, + level + ); + return; + } + + if (tk.isWs(token)) { + // convert WhiteSpace token into Indent + token.type = 'Indent'; + token.value = value; + token.level = level; + return; + } + + // if regular token we add a new Indent before it + tk.before(token, { + type: 'Indent', + value: value, + level: level + }); + + if (token.type === 'BlockComment') { + updateBlockComment(token); + } +} + +function findStartOfLine(token) { + if (tk.isBr(token) && tk.isBr(token.prev)) { + // empty lines are ignored + return null; + } + var prev = token.prev; + while (true) { + if (!prev || tk.isBr(prev)) { + return token; + } + token = prev; + prev = token.prev; + } +} + + +exports.sanitize = sanitize; +function sanitize(astOrNode) { + var token = astOrNode.startToken; + var end = astOrNode.endToken && astOrNode.endToken.next; + while (token && token !== end) { + var next = token.next; + if (isOriginalIndent(token)) { + tk.remove(token); + } + token = next; + } +} + + +function isOriginalIndent(token) { + // original indent don't have a "level" value + // we also need to remove any indent that happens after a token that + // isn't a line break (just in case these are added by mistake) + return (token.type === 'WhiteSpace' && (!token.prev || tk.isBr(token.prev)) && !tk.isBr(token.next)) || + (token.type === 'Indent' && (token.level == null || !tk.isBr(token.prev))); +} + + +exports.updateBlockComment = updateBlockComment; +function updateBlockComment(comment) { + var orig = new RegExp('([\\n\\r]+)' + escapeRegExp(comment.originalIndent || ''), 'gm'); + var update = comment.prev && comment.prev.type === 'Indent' ? comment.prev.value : ''; + comment.raw = comment.raw.replace(orig, '$1' + update); + // override the originalIndent so multiple consecutive calls still work as + // expected + comment.originalIndent = update; +} + + +// comments are aligned based on the next line unless the line/block is +// followed by an empty line, in that case it will use the previous line as +// reference. +exports.alignComments = alignComments; +function alignComments(nodeOrAst) { + var first = nodeOrAst.startToken && nodeOrAst.startToken.prev; + var token = nodeOrAst.endToken; + while (token && token !== first) { + if (tk.isComment(token) && isFirstNonEmptyTokenOfLine(token)) { + var base = findReferenceIndent(token); + matchBaseIndent(token, base); + + // if inside an empty block we add indent otherwise it looks weird + var change = _opts.CommentInsideEmptyBlock != null ? + _opts.CommentInsideEmptyBlock : 1; + if (change && isInsideEmptyBlock(token)) { + addLevel(token, change); + } + + if (token.type === 'BlockComment') { + updateBlockComment(token); + } + } + + token = token.prev; + } +} + +function matchBaseIndent(token, base) { + if (!base) { + if (isIndentOrWs(token.prev)) { + tk.remove(token.prev); + } + return; + } + + if (isIndentOrWs(token.prev)) { + // we reuse whitespace just because user might not have converted all + // the whitespaces into Indent tokens + token.prev.type = 'Indent'; + token.prev.value = base.value; + token.prev.level = inferLevel(base, _opts.value); + return; + } + + tk.before(token, { + type: 'Indent', + value: base.value, + level: inferLevel(base, _opts.value) + }); +} + +function isFirstNonEmptyTokenOfLine(token) { + if (!token.prev || tk.isBr(token.prev)) return true; + var prev = tk.findPrevNonEmpty(token); + return !prev ? true : tk.findInBetween(prev, token, tk.isBr); +} + +function findReferenceIndent(start) { + var prevLine = findPrevReference(start); + var nextLine = findNextReference(start); + if (isAtBeginingOfBlock(start) || isDetached(start, nextLine)) { + // this handles an edge case of comment just after "{" followed by an empty + // line (would use the previous line as reference by mistake) + // and also an edge case where comment is surrounded by empty lines but + // should still use the next non-empty line as a reference + while (nextLine && tk.isBr(nextLine)) { + nextLine = findNextReference(nextLine.prev); + } + } + // we favor nextLine unless it's empty + if (tk.isBr(nextLine) || !nextLine) { + return isIndentOrWs(prevLine) ? prevLine : null; + } + return isIndentOrWs(nextLine) ? nextLine : null; +} + +function findPrevReference(start) { + var token = start.prev; + while (token) { + // multiple consecutive comments should use the same reference (consider as + // a single block) + if (tk.isBr(token) && !tk.isBr(token.next) && nextInLineNotComment(token)) { + return token.next; + } + token = token.prev; + } +} + +function findNextReference(start) { + var token = start.next; + while (token) { + // multiple consecutive comments should use the same reference (consider as + // a single block) + if (tk.isBr(token) && nextInLineNotComment(token)) { + return token.next; + } + token = token.next; + } +} + +function isDetached(start, nextLine) { + return hasEmptyLineBefore(start) && tk.isBr(nextLine) && + !isAtEndOfBlock(nextLine); +} + +function hasEmptyLineBefore(token) { + token = token.prev; + var count = 0; + while (token && tk.isEmpty(token)) { + if (tk.isBr(token)) { + count += 1; + } + if (count > 1) { + return true; + } + token = token.prev; + } + return false; +} + +function isIndentOrWs(token) { + return tk.isIndent(token) || tk.isWs(token); +} + +function nextInLineNotComment(token) { + token = token.next; + while (token) { + if (tk.isBr(token)) { + return true; + } + if (!tk.isEmpty(token)) { + return !tk.isComment(token); + } + token = token.next; + } + return true; +} + +function isAtBeginingOfBlock(token) { + var open = tk.findPrev(token, tk.isCode); + if (!open) return false; + var a = open.value; + return a === '(' || a === '[' || a === '{'; +} + +function isAtEndOfBlock(token) { + var close = tk.findNext(token, tk.isCode); + if (!close) return false; + var z = close.value; + return (z === ')' || z === ']' || z === '}'); +} + +function isInsideEmptyBlock(token) { + return isAtEndOfBlock(token) && isAtBeginingOfBlock(token); +} + +exports.whiteSpaceToIndent = whiteSpaceToIndent; +function whiteSpaceToIndent(token, indentValue) { + if (tk.isWs(token) && (tk.isBr(token.prev) || !token.prev)) { + token.type = 'Indent'; + // we can't add level if we don't know original indentValue + indentValue = indentValue || _opts.value; + if (indentValue) { + token.level = inferLevel(token, indentValue); + } + } +} + +function inferLevel(token, indentValue) { + return Math.max(token.value.split(indentValue).length - 1, 0); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/test/align_comment-input.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/test/align_comment-input.js new file mode 100644 index 00000000..e871f603 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/test/align_comment-input.js @@ -0,0 +1,115 @@ + // next +switch (foo) { + // next + case bar: +// next + baz(); +// this should be aligned with previous line since comment block is + // followed by an empty line + + // next + case biz: + // next + what(); + // next +} + // previous + + // next +function empty( + // > indent +// > indent +) + // next +// next +{ + // > indent + // > indent +} +// prev + +function empty2() { +// > indent + + // next + if (foo) { + // >> indent + } + + // next + function empty3() { + // >> indent + + // next + foo(); + } + // prev + + // next + switch (a) { +// next + case 'lorem': + // next + dolor(); + // next + break; + // next + } +} + +// next +;(function() { + // next +var bar = 'baz'; + // next +}()); + // prev + +// next +class Foo extends Bar { + // > indent + + constructor(bar) { + this.bar = bar; + } + +// prev + + method() { + // > indent + } + //prev + + // next +} +// prev + +function foo() { + + // > indent + // > indent + +} + +foo + .bar(); + +// next + +function dolor() { + return 123; + + // prev + +} + +function bar() { + foo(); + +// > indent +// > indent + + baz(); +} + + // prev diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/test/align_comment-output.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/test/align_comment-output.js new file mode 100644 index 00000000..babc32b6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/test/align_comment-output.js @@ -0,0 +1,115 @@ +// next +switch (foo) { + // next + case bar: + // next + baz(); + // this should be aligned with previous line since comment block is + // followed by an empty line + + // next + case biz: + // next + what(); +// next +} +// previous + +// next +function empty( + // > indent + // > indent +) +// next +// next +{ + // > indent + // > indent +} +// prev + +function empty2() { + // > indent + + // next + if (foo) { + // >> indent + } + + // next + function empty3() { + // >> indent + + // next + foo(); + } + // prev + + // next + switch (a) { + // next + case 'lorem': + // next + dolor(); + // next + break; + // next + } +} + +// next +;(function() { +// next +var bar = 'baz'; +// next +}()); +// prev + +// next +class Foo extends Bar { + // > indent + + constructor(bar) { + this.bar = bar; + } + + // prev + + method() { + // > indent + } + //prev + +// next +} +// prev + +function foo() { + + // > indent + // > indent + +} + +foo + .bar(); + +// next + +function dolor() { + return 123; + + // prev + +} + +function bar() { + foo(); + + // > indent + // > indent + + baz(); +} + +// prev diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/test/runner.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/test/runner.js new file mode 100644 index 00000000..35f9a089 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-indent/test/runner.js @@ -0,0 +1,62 @@ +//jshint node:true, eqnull:true +'use strict'; + +var assert = require('assert'); +var disparity = require('disparity'); +var fs = require('fs'); +var indent = require('../rocambole-indent'); +var path = require('path'); +var rocambole = require('rocambole'); + +// ================== +// whiteSpaceToIndent +// ================== + +var ws1 = { type: 'WhiteSpace', value: ' ' }; +indent.whiteSpaceToIndent(ws1); +assert.equal(ws1.type, 'Indent'); +assert.equal(ws1.level, 1); + +var ws2 = { type: 'WhiteSpace', value: ' ', prev: { type: 'LineBreak' } }; +indent.whiteSpaceToIndent(ws2, ' '); +assert.equal(ws2.type, 'Indent'); +assert.equal(ws2.level, 1); + +var ws3 = { type: 'WhiteSpace', value: ' ', prev: { type: 'Punctuator' } }; +indent.whiteSpaceToIndent(ws3, ' '); +assert.equal(ws3.type, 'WhiteSpace'); +assert.equal(ws3.level, undefined); + +// ============= +// alignComments +// ============= + +// yes, this will throw if it doesn't support empty nodes/ast +indent.alignComments({}); + +formatAndCompare( + 'align_comment-input.js', + 'align_comment-output.js', + indent.alignComments +); + +function formatAndCompare(inputFile, expectedFile, method) { + var input = getFile(inputFile); + var expected = getFile(expectedFile); + var ast = rocambole.parse(input); + method.call(indent, ast); + var output = ast.toString(); + + if (output !== expected) { + process.stderr.write(disparity.chars(output, expected, { + paths: ['actual', 'expected'] + })); + process.exit(1); + } else { + console.error('ok %s', inputFile); + } +} + +function getFile(name) { + return fs.readFileSync(path.join(__dirname, name)).toString(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/.npmignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/LICENSE.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/LICENSE.md new file mode 100644 index 00000000..5987e55a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Miller Medeiros + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/README.md new file mode 100644 index 00000000..9428bbc3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/README.md @@ -0,0 +1,146 @@ +# rocambole-linebreak + +Helpers to manipulate [rocambole](https://github.com/millermedeiros/rocambole) +`LineBreak` tokens. + +Used mainly by [esformatter](https://github.com/millermedeiros/esformatter/) and its plugins. + +## Allowed values + + - positive integer (`1` till `99`): "add or keep `[n]` line breaks". + - `-1`: keep original line breaks. + - `">2"`: add linebreaks until it's over `2`. + - `">=1"`: add line breaks until it's equal or greater than `1`. + - `"<2"`: remove linebreaks until it's smaller than `2`. + - `"<=1"`: remove/add line breaks until it's smaller or equal to `1`. + +## API + +```js +var br = require('rocambole-linebreak'); +``` + +### setOptions(opts) + +`setOptions` is just a way to store some constants so later on the +`limit`/`limitBefore`/`limitAfter` you can reference the values by Id. + +```js +setOptions({ + // sets "value" used by `LineBreak` tokens (defaults to `"\n"`) + value: '\n', + + // values inside "before" are used by `limitBefore` + before: { + // setting to `0` will remove all line breaks before the token + parenthesis: 0 + }, + + // values inside "after" are used by `limitAfter` + after: { + // setting to `1` will add/keep a single `LineBreak` after the token + parenthesis: 1 + } +}); +``` + +**Important:** calling this method will override **all** the options. + +### limitBefore(token, typeOrValue) + +limits the amount of `LineBreak` before a given token. + +```js +// remove all line breaks before `node.startToken` +limitBefore(node.startToken, 0); +// add/keep 2 line breaks before `node.startToken` +limitBefore(node.startToken, 2); +// add/keep more than 1 line break +limitBefore(node.startToken, '>1'); +// keep 2 line breaks or more +limitBefore(node.startToken, '>=2'); +// keep less than 3 line breaks +limitBefore(node.startToken, '<3'); +// will use value stored on `setOptions` for `before.parenthesis` +limitBefore(node.startToken, 'parenthesis'); +// values smaller than zero are ignored (this won't change anything) +limitBefore(node.startToken, -1); +``` + +### limitAfter(token, typeOrValue) + +limits the amount of `LineBreak` after a given token. + +```js +// remove all line breaks after `node.startToken` +limitAfter(node.startToken, 0); +// add/keep 1 line break after `node.startToken` +limitAfter(node.startToken, 1); +// add/keep more than 1 line break +limitAfter(node.startToken, '>1'); +// keep 2 line breaks or more +limitAfter(node.startToken, '>=2'); +// keep less than 3 line breaks +limitAfter(node.startToken, '<3'); +// will use value stored on `setOptions` for `after.parenthesis` +limitAfter(node.startToken, 'parenthesis'); +// values smaller than zero are ignored (this won't change anything) +limitAfter(node.startToken, -1); +``` + +### limit(token, typeOrValue) + +limits the amount of `LineBreak` around a given token. + +```js +// add/keep 1 line break before and after `node.startToken` +limit(node.startToken, 1); + +// it's just an alias to +limitBefore(node.startToken, 1); +limitAfter(node.startToken, 1); +``` + +### limitBeforeEndOfFile(ast[, typeOrValue]) + +limits the amount of line breaks at the end of the AST. + +```js +// at least one line break at the end of the file +limitBeforeEndOfFile(ast, 1); +// if you don't pass the `typeOrValue` it will use "EndOfFile" as the type +limitBeforeEndOfFile(ast); +``` + +### expectedBefore(type) + +reads value stored during `setOptions` for a given `type`, or returns `-1` if +not found. + +```js +assert( expectedBefore('parenthesis') === 0 ); +``` + +### expectedAfter(type) + +reads value stored during `setOptions` for a given `type`, or returns `-1` if +not found. + +```js +assert( expectedAfter('parenthesis') === 1 ); +``` + +## Debug + +This module uses [debug](https://www.npmjs.com/package/debug) internally. To +make it easier to identify what is wrong we sometimes run the esformatter tests +with a `DEBUG` flag, like: + +```sh +DEBUG=rocambole:br:* npm test +``` + +## License + +Released under the MIT License + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/.bin/semver b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/.bin/semver new file mode 120000 index 00000000..317eb293 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/.jshintrc b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/.jshintrc new file mode 100644 index 00000000..299877f2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/.jshintrc @@ -0,0 +1,3 @@ +{ + "laxbreak": true +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/.npmignore new file mode 100644 index 00000000..7e6163db --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/.npmignore @@ -0,0 +1,6 @@ +support +test +examples +example +*.sock +dist diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/History.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/History.md new file mode 100644 index 00000000..854c9711 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/History.md @@ -0,0 +1,195 @@ + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/Makefile b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/Makefile new file mode 100644 index 00000000..5cf4a596 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/Makefile @@ -0,0 +1,36 @@ + +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# applications +NODE ?= $(shell which node) +NPM ?= $(NODE) $(shell which npm) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +all: dist/debug.js + +install: node_modules + +clean: + @rm -rf dist + +dist: + @mkdir -p $@ + +dist/debug.js: node_modules browser.js debug.js dist + @$(BROWSERIFY) \ + --standalone debug \ + . > $@ + +distclean: clean + @rm -rf node_modules + +node_modules: package.json + @NODE_ENV= $(NPM) install + @touch node_modules + +.PHONY: all install clean distclean diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/Readme.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/Readme.md new file mode 100644 index 00000000..b4f45e3c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/Readme.md @@ -0,0 +1,188 @@ +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +#### Windows note + + On Windows the environment variable is set using the `set` command. + + ```cmd + set DEBUG=*,-not_this + ``` + +Then, run the program to be debugged as usual. + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: + +```js +window.myDebug = require("debug"); +``` + + ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: + +```js +myDebug.enable("worker:*") +``` + + Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +#### Web Inspector Colors + + Colors are also enabled on "Web Inspectors" that understand the `%c` formatting + option. These are WebKit web inspectors, Firefox ([since version + 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) + and the Firebug plugin for Firefox (any version). + + Colored output looks something like: + + ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) + +### stderr vs stdout + +You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: + +Example _stdout.js_: + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +### Save debug output to a file + +You can save all debug statements to a file by piping them. + +Example: + +```bash +$ DEBUG_FD=3 node your-app.js 3> whatever.log +``` + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + +## License + +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/bower.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/bower.json new file mode 100644 index 00000000..6af573ff --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/bower.json @@ -0,0 +1,28 @@ +{ + "name": "visionmedia-debug", + "main": "dist/debug.js", + "version": "2.2.0", + "homepage": "https://github.com/visionmedia/debug", + "authors": [ + "TJ Holowaychuk " + ], + "description": "visionmedia-debug", + "moduleType": [ + "amd", + "es6", + "globals", + "node" + ], + "keywords": [ + "visionmedia", + "debug" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/browser.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/browser.js new file mode 100644 index 00000000..7c764522 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/browser.js @@ -0,0 +1,168 @@ + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + return JSON.stringify(v); +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/component.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/component.json new file mode 100644 index 00000000..ca106372 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "2.2.0", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/debug.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/debug.js new file mode 100644 index 00000000..7571a860 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/debug.js @@ -0,0 +1,197 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() { + } + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node.js new file mode 100644 index 00000000..1d392a81 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node.js @@ -0,0 +1,209 @@ + +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); + if (0 === debugColors.length) { + return tty.isatty(fd); + } else { + return '0' !== debugColors + && 'no' !== debugColors + && 'false' !== debugColors + && 'disabled' !== debugColors; + } +} + +/** + * Map %o to `util.inspect()`, since Node doesn't do that out of the box. + */ + +var inspect = (4 === util.inspect.length ? + // node <= 0.8.x + function (v, colors) { + return util.inspect(v, void 0, void 0, colors); + } : + // node > 0.8.x + function (v, colors) { + return util.inspect(v, { colors: colors }); + } +); + +exports.formatters.o = function(v) { + return inspect(v, this.useColors) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + var name = this.namespace; + + if (useColors) { + var c = this.color; + + args[0] = ' \u001b[3' + c + ';1m' + name + ' ' + + '\u001b[0m' + + args[0] + '\u001b[3' + c + 'm' + + ' +' + exports.humanize(this.diff) + '\u001b[0m'; + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } + return args; +} + +/** + * Invokes `console.error()` with the specified arguments. + */ + +function log() { + return stream.write(util.format.apply(this, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = require('fs'); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = require('net'); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/.npmignore new file mode 100644 index 00000000..d1aa0ce4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/.npmignore @@ -0,0 +1,5 @@ +node_modules +test +History.md +Makefile +component.json diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/History.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/History.md new file mode 100644 index 00000000..32fdfc17 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/History.md @@ -0,0 +1,66 @@ + +0.7.1 / 2015-04-20 +================== + + * prevent extraordinary long inputs (@evilpacket) + * Fixed broken readme link + +0.7.0 / 2014-11-24 +================== + + * add time abbreviations, updated tests and readme for the new units + * fix example in the readme. + * add LICENSE file + +0.6.2 / 2013-12-05 +================== + + * Adding repository section to package.json to suppress warning from NPM. + +0.6.1 / 2013-05-10 +================== + + * fix singularization [visionmedia] + +0.6.0 / 2013-03-15 +================== + + * fix minutes + +0.5.1 / 2013-02-24 +================== + + * add component namespace + +0.5.0 / 2012-11-09 +================== + + * add short formatting as default and .long option + * add .license property to component.json + * add version to component.json + +0.4.0 / 2012-10-22 +================== + + * add rounding to fix crazy decimals + +0.3.0 / 2012-09-07 +================== + + * fix `ms()` [visionmedia] + +0.2.0 / 2012-09-03 +================== + + * add component.json [visionmedia] + * add days support [visionmedia] + * add hours support [visionmedia] + * add minutes support [visionmedia] + * add seconds support [visionmedia] + * add ms string support [visionmedia] + * refactor tests to facilitate ms(number) [visionmedia] + +0.1.0 / 2012-03-07 +================== + + * Initial release diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/LICENSE new file mode 100644 index 00000000..6c07561b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/README.md new file mode 100644 index 00000000..9b4fd035 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/README.md @@ -0,0 +1,35 @@ +# ms.js: miliseconds conversion utility + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('100') // 100 +``` + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as +a number (e.g: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of +equivalent ms is returned. + +## License + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/index.js new file mode 100644 index 00000000..4f927716 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/index.js @@ -0,0 +1,125 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/package.json new file mode 100644 index 00000000..253335e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/node_modules/ms/package.json @@ -0,0 +1,48 @@ +{ + "name": "ms", + "version": "0.7.1", + "description": "Tiny ms conversion utility", + "repository": { + "type": "git", + "url": "git://github.com/guille/ms.js.git" + }, + "main": "./index", + "devDependencies": { + "mocha": "*", + "expect.js": "*", + "serve": "*" + }, + "component": { + "scripts": { + "ms/index.js": "index.js" + } + }, + "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", + "bugs": { + "url": "https://github.com/guille/ms.js/issues" + }, + "homepage": "https://github.com/guille/ms.js", + "_id": "ms@0.7.1", + "scripts": {}, + "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "_from": "ms@0.7.1", + "_npmVersion": "2.7.5", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "dist": { + "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/package.json new file mode 100644 index 00000000..08b1116a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/debug/package.json @@ -0,0 +1,73 @@ +{ + "name": "debug", + "version": "2.2.0", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + } + ], + "license": "MIT", + "dependencies": { + "ms": "0.7.1" + }, + "devDependencies": { + "browserify": "9.0.3", + "mocha": "*" + }, + "main": "./node.js", + "browser": "./browser.js", + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" + } + }, + "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@2.2.0", + "scripts": {}, + "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "_from": "debug@>=2.1.3 <3.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "tarball": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/.npmignore new file mode 100644 index 00000000..7300fbc7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/.npmignore @@ -0,0 +1 @@ +# nada diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/Makefile b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/Makefile new file mode 100644 index 00000000..71af0e97 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/Makefile @@ -0,0 +1,24 @@ +files = semver.browser.js \ + semver.min.js \ + semver.browser.js.gz \ + semver.min.js.gz + +all: $(files) + +clean: + rm -f $(files) + +semver.browser.js: head.js.txt semver.js foot.js.txt + ( cat head.js.txt; \ + cat semver.js | \ + egrep -v '^ *\/\* nomin \*\/' | \ + perl -pi -e 's/debug\([^\)]+\)//g'; \ + cat foot.js.txt ) > semver.browser.js + +semver.min.js: semver.browser.js + uglifyjs -m semver.min.js + +%.gz: % + gzip --stdout -9 <$< >$@ + +.PHONY: all clean diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/README.md new file mode 100644 index 00000000..b5e35ff0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/README.md @@ -0,0 +1,303 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Usage + + $ npm install semver + + semver.valid('1.2.3') // '1.2.3' + semver.valid('a.b.c') // null + semver.clean(' =v1.2.3 ') // '1.2.3' + semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true + semver.gt('1.2.3', '9.8.7') // false + semver.lt('1.2.3', '9.8.7') // true + +As a command-line utility: + + $ semver -h + + Usage: semver [ [...]] [-r | -i | --preid | -l | -rv] + Test if version(s) satisfy the supplied range(s), and sort them. + + Multiple versions or ranges may be supplied, unless increment + option is specified. In that case, only a single version may + be used, and it is incremented by the specified level + + Program exits successfully if any valid version satisfies + all supplied ranges, and prints all satisfying versions. + + If no versions are valid, or ranges are not satisfied, + then exits failure. + + Versions are printed in ascending order, so supplying + multiple versions to the utility will just sort them. + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +> semver.inc('1.2.3', 'pre', 'beta') +'1.2.4-beta.0' +``` + +command-line example: + +```shell +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```shell +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero digit in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +## Functions + +All methods and classes take a final `loose` boolean argument that, if +true, will be more forgiving about not-quite-valid semver strings. +The resulting output will always be 100% strict, of course. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/bin/semver b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/bin/semver new file mode 100755 index 00000000..c5f2e857 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/bin/semver @@ -0,0 +1,133 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + , versions = [] + , range = [] + , gt = [] + , lt = [] + , eq = [] + , inc = null + , version = require("../package.json").version + , loose = false + , identifier = undefined + , semver = require("../semver") + , reverse = false + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var i = a.indexOf('=') + if (i !== -1) { + a = a.slice(0, i) + argv.unshift(a.slice(i + 1)) + } + switch (a) { + case "-rv": case "-rev": case "--rev": case "--reverse": + reverse = true + break + case "-l": case "--loose": + loose = true + break + case "-v": case "--version": + versions.push(argv.shift()) + break + case "-i": case "--inc": case "--increment": + switch (argv[0]) { + case "major": case "minor": case "patch": case "prerelease": + case "premajor": case "preminor": case "prepatch": + inc = argv.shift() + break + default: + inc = "patch" + break + } + break + case "--preid": + identifier = argv.shift() + break + case "-r": case "--range": + range.push(argv.shift()) + break + case "-h": case "--help": case "-?": + return help() + default: + versions.push(a) + break + } + } + + versions = versions.filter(function (v) { + return semver.valid(v, loose) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) + return failInc() + + for (var i = 0, l = range.length; i < l ; i ++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], loose) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error("--inc can only be used on a single version with no range") + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? "rcompare" : "compare" + versions.sort(function (a, b) { + return semver[compare](a, b, loose) + }).map(function (v) { + return semver.clean(v, loose) + }).map(function (v) { + return inc ? semver.inc(v, inc, loose, identifier) : v + }).forEach(function (v,i,_) { console.log(v) }) +} + +function help () { + console.log(["SemVer " + version + ,"" + ,"A JavaScript implementation of the http://semver.org/ specification" + ,"Copyright Isaac Z. Schlueter" + ,"" + ,"Usage: semver [options] [ [...]]" + ,"Prints valid versions sorted by SemVer precedence" + ,"" + ,"Options:" + ,"-r --range " + ," Print versions that match the specified range." + ,"" + ,"-i --increment []" + ," Increment a version by the specified level. Level can" + ," be one of: major, minor, patch, premajor, preminor," + ," prepatch, or prerelease. Default level is 'patch'." + ," Only one version may be specified." + ,"" + ,"--preid " + ," Identifier to be used to prefix premajor, preminor," + ," prepatch or prerelease version increments." + ,"" + ,"-l --loose" + ," Interpret versions and ranges loosely" + ,"" + ,"Program exits successfully if any valid version satisfies" + ,"all supplied ranges, and prints all satisfying versions." + ,"" + ,"If no satisfying versions are found, then exits failure." + ,"" + ,"Versions are printed in ascending order, so supplying" + ,"multiple versions to the utility will just sort them." + ].join("\n")) +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/foot.js.txt b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/foot.js.txt new file mode 100644 index 00000000..8f83c20f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/foot.js.txt @@ -0,0 +1,6 @@ + +})( + typeof exports === 'object' ? exports : + typeof define === 'function' && define.amd ? {} : + semver = {} +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/head.js.txt b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/head.js.txt new file mode 100644 index 00000000..65368651 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/head.js.txt @@ -0,0 +1,2 @@ +;(function(exports) { + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/package.json new file mode 100644 index 00000000..6a737f58 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/package.json @@ -0,0 +1,55 @@ +{ + "name": "semver", + "version": "4.3.4", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "browser": "semver.browser.js", + "min": "semver.min.js", + "scripts": { + "test": "tap test/*.js", + "prepublish": "make" + }, + "devDependencies": { + "tap": "0.x >=0.0.4", + "uglify-js": "~2.3.6" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "git://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "./bin/semver" + }, + "gitHead": "d7d791dc9d321cb5f3211e39ce8857f6476922f9", + "bugs": { + "url": "https://github.com/npm/node-semver/issues" + }, + "homepage": "https://github.com/npm/node-semver#readme", + "_id": "semver@4.3.4", + "_shasum": "bf43a1aae304de040e12a13f84200ca7aeab7589", + "_from": "semver@>=4.3.1 <5.0.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "bf43a1aae304de040e12a13f84200ca7aeab7589", + "tarball": "http://registry.npmjs.org/semver/-/semver-4.3.4.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/semver/-/semver-4.3.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.browser.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.browser.js new file mode 100644 index 00000000..b84228ab --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.browser.js @@ -0,0 +1,1198 @@ +;(function(exports) { + +// export the class if we are in a Node-like system. +if (typeof module === 'object' && module.exports === exports) + exports = module.exports = SemVer; + +// The debug function is excluded entirely from the minified version. + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0'; + +var MAX_LENGTH = 256; +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; + +// The actual regexps go on exports.re +var re = exports.re = []; +var src = exports.src = []; +var R = 0; + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++; +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; +var NUMERICIDENTIFIERLOOSE = R++; +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; + + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++; +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; + + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++; +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')'; + +var MAINVERSIONLOOSE = R++; +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++; +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + +var PRERELEASEIDENTIFIERLOOSE = R++; +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++; +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; + +var PRERELEASELOOSE = R++; +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++; +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++; +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; + + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++; +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?'; + +src[FULL] = '^' + FULLPLAIN + '$'; + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?'; + +var LOOSE = R++; +src[LOOSE] = '^' + LOOSEPLAIN + '$'; + +var GTLT = R++; +src[GTLT] = '((?:<|>)?=?)'; + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++; +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; +var XRANGEIDENTIFIER = R++; +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; + +var XRANGEPLAIN = R++; +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?'; + +var XRANGEPLAINLOOSE = R++; +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?'; + +var XRANGE = R++; +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; +var XRANGELOOSE = R++; +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++; +src[LONETILDE] = '(?:~>?)'; + +var TILDETRIM = R++; +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); +var tildeTrimReplace = '$1~'; + +var TILDE = R++; +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; +var TILDELOOSE = R++; +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++; +src[LONECARET] = '(?:\\^)'; + +var CARETTRIM = R++; +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); +var caretTrimReplace = '$1^'; + +var CARET = R++; +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; +var CARETLOOSE = R++; +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++; +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; +var COMPARATOR = R++; +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; + + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++; +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); +var comparatorTrimReplace = '$1$2$3'; + + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++; +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$'; + +var HYPHENRANGELOOSE = R++; +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$'; + +// Star ranges basically just allow anything at all. +var STAR = R++; +src[STAR] = '(<|>)?=?\\s*\\*'; + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + ; + if (!re[i]) + re[i] = new RegExp(src[i]); +} + +exports.parse = parse; +function parse(version, loose) { + if (version instanceof SemVer) + return version; + + if (typeof version !== 'string') + return null; + + if (version.length > MAX_LENGTH) + return null; + + var r = loose ? re[LOOSE] : re[FULL]; + if (!r.test(version)) + return null; + + try { + return new SemVer(version, loose); + } catch (er) { + return null; + } +} + +exports.valid = valid; +function valid(version, loose) { + var v = parse(version, loose); + return v ? v.version : null; +} + + +exports.clean = clean; +function clean(version, loose) { + var s = parse(version.trim().replace(/^[=v]+/, ''), loose); + return s ? s.version : null; +} + +exports.SemVer = SemVer; + +function SemVer(version, loose) { + if (version instanceof SemVer) { + if (version.loose === loose) + return version; + else + version = version.version; + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version); + } + + if (version.length > MAX_LENGTH) + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + + if (!(this instanceof SemVer)) + return new SemVer(version, loose); + + ; + this.loose = loose; + var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); + + if (!m) + throw new TypeError('Invalid Version: ' + version); + + this.raw = version; + + // these are actually numbers + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) + throw new TypeError('Invalid major version') + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) + throw new TypeError('Invalid minor version') + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) + throw new TypeError('Invalid patch version') + + // numberify any prerelease numeric ids + if (!m[4]) + this.prerelease = []; + else + this.prerelease = m[4].split('.').map(function(id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) + return num + } + return id; + }); + + this.build = m[5] ? m[5].split('.') : []; + this.format(); +} + +SemVer.prototype.format = function() { + this.version = this.major + '.' + this.minor + '.' + this.patch; + if (this.prerelease.length) + this.version += '-' + this.prerelease.join('.'); + return this.version; +}; + +SemVer.prototype.inspect = function() { + return ''; +}; + +SemVer.prototype.toString = function() { + return this.version; +}; + +SemVer.prototype.compare = function(other) { + ; + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return this.compareMain(other) || this.comparePre(other); +}; + +SemVer.prototype.compareMain = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch); +}; + +SemVer.prototype.comparePre = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) + return -1; + else if (!this.prerelease.length && other.prerelease.length) + return 1; + else if (!this.prerelease.length && !other.prerelease.length) + return 0; + + var i = 0; + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + ; + if (a === undefined && b === undefined) + return 0; + else if (b === undefined) + return 1; + else if (a === undefined) + return -1; + else if (a === b) + continue; + else + return compareIdentifiers(a, b); + } while (++i); +}; + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function(release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier); + break; + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier); + break; + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0; + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) + this.major++; + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) + this.minor++; + this.patch = 0; + this.prerelease = []; + break; + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) + this.patch++; + this.prerelease = []; + break; + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) + this.prerelease = [0]; + else { + var i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) // didn't increment anything + this.prerelease.push(0); + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) + this.prerelease = [identifier, 0]; + } else + this.prerelease = [identifier, 0]; + } + break; + + default: + throw new Error('invalid increment argument: ' + release); + } + this.format(); + return this; +}; + +exports.inc = inc; +function inc(version, release, loose, identifier) { + if (typeof(loose) === 'string') { + identifier = loose; + loose = undefined; + } + + try { + return new SemVer(version, loose).inc(release, identifier).version; + } catch (er) { + return null; + } +} + +exports.diff = diff; +function diff(version1, version2) { + if (eq(version1, version2)) { + return null; + } else { + var v1 = parse(version1); + var v2 = parse(version2); + if (v1.prerelease.length || v2.prerelease.length) { + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return 'pre'+key; + } + } + } + return 'prerelease'; + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return key; + } + } + } + } +} + +exports.compareIdentifiers = compareIdentifiers; + +var numeric = /^[0-9]+$/; +function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); + + if (anum && bnum) { + a = +a; + b = +b; + } + + return (anum && !bnum) ? -1 : + (bnum && !anum) ? 1 : + a < b ? -1 : + a > b ? 1 : + 0; +} + +exports.rcompareIdentifiers = rcompareIdentifiers; +function rcompareIdentifiers(a, b) { + return compareIdentifiers(b, a); +} + +exports.major = major; +function major(a, loose) { + return new SemVer(a, loose).major; +} + +exports.minor = minor; +function minor(a, loose) { + return new SemVer(a, loose).minor; +} + +exports.patch = patch; +function patch(a, loose) { + return new SemVer(a, loose).patch; +} + +exports.compare = compare; +function compare(a, b, loose) { + return new SemVer(a, loose).compare(b); +} + +exports.compareLoose = compareLoose; +function compareLoose(a, b) { + return compare(a, b, true); +} + +exports.rcompare = rcompare; +function rcompare(a, b, loose) { + return compare(b, a, loose); +} + +exports.sort = sort; +function sort(list, loose) { + return list.sort(function(a, b) { + return exports.compare(a, b, loose); + }); +} + +exports.rsort = rsort; +function rsort(list, loose) { + return list.sort(function(a, b) { + return exports.rcompare(a, b, loose); + }); +} + +exports.gt = gt; +function gt(a, b, loose) { + return compare(a, b, loose) > 0; +} + +exports.lt = lt; +function lt(a, b, loose) { + return compare(a, b, loose) < 0; +} + +exports.eq = eq; +function eq(a, b, loose) { + return compare(a, b, loose) === 0; +} + +exports.neq = neq; +function neq(a, b, loose) { + return compare(a, b, loose) !== 0; +} + +exports.gte = gte; +function gte(a, b, loose) { + return compare(a, b, loose) >= 0; +} + +exports.lte = lte; +function lte(a, b, loose) { + return compare(a, b, loose) <= 0; +} + +exports.cmp = cmp; +function cmp(a, op, b, loose) { + var ret; + switch (op) { + case '===': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a === b; + break; + case '!==': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a !== b; + break; + case '': case '=': case '==': ret = eq(a, b, loose); break; + case '!=': ret = neq(a, b, loose); break; + case '>': ret = gt(a, b, loose); break; + case '>=': ret = gte(a, b, loose); break; + case '<': ret = lt(a, b, loose); break; + case '<=': ret = lte(a, b, loose); break; + default: throw new TypeError('Invalid operator: ' + op); + } + return ret; +} + +exports.Comparator = Comparator; +function Comparator(comp, loose) { + if (comp instanceof Comparator) { + if (comp.loose === loose) + return comp; + else + comp = comp.value; + } + + if (!(this instanceof Comparator)) + return new Comparator(comp, loose); + + ; + this.loose = loose; + this.parse(comp); + + if (this.semver === ANY) + this.value = ''; + else + this.value = this.operator + this.semver.version; + + ; +} + +var ANY = {}; +Comparator.prototype.parse = function(comp) { + var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var m = comp.match(r); + + if (!m) + throw new TypeError('Invalid comparator: ' + comp); + + this.operator = m[1]; + if (this.operator === '=') + this.operator = ''; + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) + this.semver = ANY; + else + this.semver = new SemVer(m[2], this.loose); +}; + +Comparator.prototype.inspect = function() { + return ''; +}; + +Comparator.prototype.toString = function() { + return this.value; +}; + +Comparator.prototype.test = function(version) { + ; + + if (this.semver === ANY) + return true; + + if (typeof version === 'string') + version = new SemVer(version, this.loose); + + return cmp(version, this.operator, this.semver, this.loose); +}; + + +exports.Range = Range; +function Range(range, loose) { + if ((range instanceof Range) && range.loose === loose) + return range; + + if (!(this instanceof Range)) + return new Range(range, loose); + + this.loose = loose; + + // First, split based on boolean or || + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map(function(range) { + return this.parseRange(range.trim()); + }, this).filter(function(c) { + // throw out any that are not relevant for whatever reason + return c.length; + }); + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range); + } + + this.format(); +} + +Range.prototype.inspect = function() { + return ''; +}; + +Range.prototype.format = function() { + this.range = this.set.map(function(comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; +}; + +Range.prototype.toString = function() { + return this.range; +}; + +Range.prototype.parseRange = function(range) { + var loose = this.loose; + range = range.trim(); + ; + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; + range = range.replace(hr, hyphenReplace); + ; + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); + ; + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace); + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace); + + // normalize spaces + range = range.split(/\s+/).join(' '); + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var set = range.split(' ').map(function(comp) { + return parseComparator(comp, loose); + }).join(' ').split(/\s+/); + if (this.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function(comp) { + return !!comp.match(compRe); + }); + } + set = set.map(function(comp) { + return new Comparator(comp, loose); + }); + + return set; +}; + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators; +function toComparators(range, loose) { + return new Range(range, loose).set.map(function(comp) { + return comp.map(function(c) { + return c.value; + }).join(' ').trim().split(' '); + }); +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator(comp, loose) { + ; + comp = replaceCarets(comp, loose); + ; + comp = replaceTildes(comp, loose); + ; + comp = replaceXRanges(comp, loose); + ; + comp = replaceStars(comp, loose); + ; + return comp; +} + +function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceTilde(comp, loose); + }).join(' '); +} + +function replaceTilde(comp, loose) { + var r = loose ? re[TILDELOOSE] : re[TILDE]; + return comp.replace(r, function(_, M, m, p, pr) { + ; + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) + // ~1.2 == >=1.2.0- <1.3.0- + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else if (pr) { + ; + if (pr.charAt(0) !== '-') + pr = '-' + pr; + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; + + ; + return ret; + }); +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceCaret(comp, loose); + }).join(' '); +} + +function replaceCaret(comp, loose) { + ; + var r = loose ? re[CARETLOOSE] : re[CARET]; + return comp.replace(r, function(_, M, m, p, pr) { + ; + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) { + if (M === '0') + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; + } else if (pr) { + ; + if (pr.charAt(0) !== '-') + pr = '-' + pr; + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + (+M + 1) + '.0.0'; + } else { + ; + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0'; + } + + ; + return ret; + }); +} + +function replaceXRanges(comp, loose) { + ; + return comp.split(/\s+/).map(function(comp) { + return replaceXRange(comp, loose); + }).join(' '); +} + +function replaceXRange(comp, loose) { + comp = comp.trim(); + var r = loose ? re[XRANGELOOSE] : re[XRANGE]; + return comp.replace(r, function(ret, gtlt, M, m, p, pr) { + ; + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; + + if (gtlt === '=' && anyX) + gtlt = ''; + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0'; + } else { + // nothing is forbidden + ret = '*'; + } + } else if (gtlt && anyX) { + // replace X with 0 + if (xm) + m = 0; + if (xp) + p = 0; + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>='; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else if (xp) { + m = +m + 1; + p = 0; + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) + M = +M + 1 + else + m = +m + 1 + } + + ret = gtlt + M + '.' + m + '.' + p; + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } + + ; + + return ret; + }); +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars(comp, loose) { + ; + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], ''); +} + +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + + if (isX(fM)) + from = ''; + else if (isX(fm)) + from = '>=' + fM + '.0.0'; + else if (isX(fp)) + from = '>=' + fM + '.' + fm + '.0'; + else + from = '>=' + from; + + if (isX(tM)) + to = ''; + else if (isX(tm)) + to = '<' + (+tM + 1) + '.0.0'; + else if (isX(tp)) + to = '<' + tM + '.' + (+tm + 1) + '.0'; + else if (tpr) + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; + else + to = '<=' + to; + + return (from + ' ' + to).trim(); +} + + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function(version) { + if (!version) + return false; + + if (typeof version === 'string') + version = new SemVer(version, this.loose); + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version)) + return true; + } + return false; +}; + +function testSet(set, version) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) + return false; + } + + if (version.prerelease.length) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (var i = 0; i < set.length; i++) { + ; + if (set[i].semver === ANY) + return true; + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver; + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) + return true; + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false; + } + + return true; +} + +exports.satisfies = satisfies; +function satisfies(version, range, loose) { + try { + range = new Range(range, loose); + } catch (er) { + return false; + } + return range.test(version); +} + +exports.maxSatisfying = maxSatisfying; +function maxSatisfying(versions, range, loose) { + return versions.filter(function(version) { + return satisfies(version, range, loose); + }).sort(function(a, b) { + return rcompare(a, b, loose); + })[0] || null; +} + +exports.validRange = validRange; +function validRange(range, loose) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, loose).range || '*'; + } catch (er) { + return null; + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr; +function ltr(version, range, loose) { + return outside(version, range, '<', loose); +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr; +function gtr(version, range, loose) { + return outside(version, range, '>', loose); +} + +exports.outside = outside; +function outside(version, range, hilo, loose) { + version = new SemVer(version, loose); + range = new Range(range, loose); + + var gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break; + case '<': + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, loose)) { + return false; + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + + var high = null; + var low = null; + + comparators.forEach(function(comparator) { + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, loose)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, loose)) { + low = comparator; + } + }); + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false; + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; +} + +// Use the define() function if we're in AMD land +if (typeof define === 'function' && define.amd) + define(exports); + +})( + typeof exports === 'object' ? exports : + typeof define === 'function' && define.amd ? {} : + semver = {} +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.browser.js.gz b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.browser.js.gz new file mode 100644 index 00000000..8971ecdf Binary files /dev/null and b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.browser.js.gz differ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.js new file mode 100644 index 00000000..b95992ba --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.js @@ -0,0 +1,1202 @@ +// export the class if we are in a Node-like system. +if (typeof module === 'object' && module.exports === exports) + exports = module.exports = SemVer; + +// The debug function is excluded entirely from the minified version. +/* nomin */ var debug; +/* nomin */ if (typeof process === 'object' && + /* nomin */ process.env && + /* nomin */ process.env.NODE_DEBUG && + /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG)) + /* nomin */ debug = function() { + /* nomin */ var args = Array.prototype.slice.call(arguments, 0); + /* nomin */ args.unshift('SEMVER'); + /* nomin */ console.log.apply(console, args); + /* nomin */ }; +/* nomin */ else + /* nomin */ debug = function() {}; + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0'; + +var MAX_LENGTH = 256; +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; + +// The actual regexps go on exports.re +var re = exports.re = []; +var src = exports.src = []; +var R = 0; + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++; +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; +var NUMERICIDENTIFIERLOOSE = R++; +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; + + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++; +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; + + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++; +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')'; + +var MAINVERSIONLOOSE = R++; +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++; +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + +var PRERELEASEIDENTIFIERLOOSE = R++; +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++; +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; + +var PRERELEASELOOSE = R++; +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++; +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++; +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; + + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++; +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?'; + +src[FULL] = '^' + FULLPLAIN + '$'; + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?'; + +var LOOSE = R++; +src[LOOSE] = '^' + LOOSEPLAIN + '$'; + +var GTLT = R++; +src[GTLT] = '((?:<|>)?=?)'; + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++; +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; +var XRANGEIDENTIFIER = R++; +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; + +var XRANGEPLAIN = R++; +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?'; + +var XRANGEPLAINLOOSE = R++; +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?'; + +var XRANGE = R++; +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; +var XRANGELOOSE = R++; +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++; +src[LONETILDE] = '(?:~>?)'; + +var TILDETRIM = R++; +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); +var tildeTrimReplace = '$1~'; + +var TILDE = R++; +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; +var TILDELOOSE = R++; +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++; +src[LONECARET] = '(?:\\^)'; + +var CARETTRIM = R++; +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); +var caretTrimReplace = '$1^'; + +var CARET = R++; +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; +var CARETLOOSE = R++; +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++; +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; +var COMPARATOR = R++; +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; + + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++; +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); +var comparatorTrimReplace = '$1$2$3'; + + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++; +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$'; + +var HYPHENRANGELOOSE = R++; +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$'; + +// Star ranges basically just allow anything at all. +var STAR = R++; +src[STAR] = '(<|>)?=?\\s*\\*'; + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]); + if (!re[i]) + re[i] = new RegExp(src[i]); +} + +exports.parse = parse; +function parse(version, loose) { + if (version instanceof SemVer) + return version; + + if (typeof version !== 'string') + return null; + + if (version.length > MAX_LENGTH) + return null; + + var r = loose ? re[LOOSE] : re[FULL]; + if (!r.test(version)) + return null; + + try { + return new SemVer(version, loose); + } catch (er) { + return null; + } +} + +exports.valid = valid; +function valid(version, loose) { + var v = parse(version, loose); + return v ? v.version : null; +} + + +exports.clean = clean; +function clean(version, loose) { + var s = parse(version.trim().replace(/^[=v]+/, ''), loose); + return s ? s.version : null; +} + +exports.SemVer = SemVer; + +function SemVer(version, loose) { + if (version instanceof SemVer) { + if (version.loose === loose) + return version; + else + version = version.version; + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version); + } + + if (version.length > MAX_LENGTH) + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + + if (!(this instanceof SemVer)) + return new SemVer(version, loose); + + debug('SemVer', version, loose); + this.loose = loose; + var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); + + if (!m) + throw new TypeError('Invalid Version: ' + version); + + this.raw = version; + + // these are actually numbers + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) + throw new TypeError('Invalid major version') + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) + throw new TypeError('Invalid minor version') + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) + throw new TypeError('Invalid patch version') + + // numberify any prerelease numeric ids + if (!m[4]) + this.prerelease = []; + else + this.prerelease = m[4].split('.').map(function(id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) + return num + } + return id; + }); + + this.build = m[5] ? m[5].split('.') : []; + this.format(); +} + +SemVer.prototype.format = function() { + this.version = this.major + '.' + this.minor + '.' + this.patch; + if (this.prerelease.length) + this.version += '-' + this.prerelease.join('.'); + return this.version; +}; + +SemVer.prototype.inspect = function() { + return ''; +}; + +SemVer.prototype.toString = function() { + return this.version; +}; + +SemVer.prototype.compare = function(other) { + debug('SemVer.compare', this.version, this.loose, other); + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return this.compareMain(other) || this.comparePre(other); +}; + +SemVer.prototype.compareMain = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch); +}; + +SemVer.prototype.comparePre = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) + return -1; + else if (!this.prerelease.length && other.prerelease.length) + return 1; + else if (!this.prerelease.length && !other.prerelease.length) + return 0; + + var i = 0; + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + debug('prerelease compare', i, a, b); + if (a === undefined && b === undefined) + return 0; + else if (b === undefined) + return 1; + else if (a === undefined) + return -1; + else if (a === b) + continue; + else + return compareIdentifiers(a, b); + } while (++i); +}; + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function(release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier); + break; + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier); + break; + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0; + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) + this.major++; + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) + this.minor++; + this.patch = 0; + this.prerelease = []; + break; + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) + this.patch++; + this.prerelease = []; + break; + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) + this.prerelease = [0]; + else { + var i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) // didn't increment anything + this.prerelease.push(0); + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) + this.prerelease = [identifier, 0]; + } else + this.prerelease = [identifier, 0]; + } + break; + + default: + throw new Error('invalid increment argument: ' + release); + } + this.format(); + return this; +}; + +exports.inc = inc; +function inc(version, release, loose, identifier) { + if (typeof(loose) === 'string') { + identifier = loose; + loose = undefined; + } + + try { + return new SemVer(version, loose).inc(release, identifier).version; + } catch (er) { + return null; + } +} + +exports.diff = diff; +function diff(version1, version2) { + if (eq(version1, version2)) { + return null; + } else { + var v1 = parse(version1); + var v2 = parse(version2); + if (v1.prerelease.length || v2.prerelease.length) { + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return 'pre'+key; + } + } + } + return 'prerelease'; + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return key; + } + } + } + } +} + +exports.compareIdentifiers = compareIdentifiers; + +var numeric = /^[0-9]+$/; +function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); + + if (anum && bnum) { + a = +a; + b = +b; + } + + return (anum && !bnum) ? -1 : + (bnum && !anum) ? 1 : + a < b ? -1 : + a > b ? 1 : + 0; +} + +exports.rcompareIdentifiers = rcompareIdentifiers; +function rcompareIdentifiers(a, b) { + return compareIdentifiers(b, a); +} + +exports.major = major; +function major(a, loose) { + return new SemVer(a, loose).major; +} + +exports.minor = minor; +function minor(a, loose) { + return new SemVer(a, loose).minor; +} + +exports.patch = patch; +function patch(a, loose) { + return new SemVer(a, loose).patch; +} + +exports.compare = compare; +function compare(a, b, loose) { + return new SemVer(a, loose).compare(b); +} + +exports.compareLoose = compareLoose; +function compareLoose(a, b) { + return compare(a, b, true); +} + +exports.rcompare = rcompare; +function rcompare(a, b, loose) { + return compare(b, a, loose); +} + +exports.sort = sort; +function sort(list, loose) { + return list.sort(function(a, b) { + return exports.compare(a, b, loose); + }); +} + +exports.rsort = rsort; +function rsort(list, loose) { + return list.sort(function(a, b) { + return exports.rcompare(a, b, loose); + }); +} + +exports.gt = gt; +function gt(a, b, loose) { + return compare(a, b, loose) > 0; +} + +exports.lt = lt; +function lt(a, b, loose) { + return compare(a, b, loose) < 0; +} + +exports.eq = eq; +function eq(a, b, loose) { + return compare(a, b, loose) === 0; +} + +exports.neq = neq; +function neq(a, b, loose) { + return compare(a, b, loose) !== 0; +} + +exports.gte = gte; +function gte(a, b, loose) { + return compare(a, b, loose) >= 0; +} + +exports.lte = lte; +function lte(a, b, loose) { + return compare(a, b, loose) <= 0; +} + +exports.cmp = cmp; +function cmp(a, op, b, loose) { + var ret; + switch (op) { + case '===': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a === b; + break; + case '!==': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a !== b; + break; + case '': case '=': case '==': ret = eq(a, b, loose); break; + case '!=': ret = neq(a, b, loose); break; + case '>': ret = gt(a, b, loose); break; + case '>=': ret = gte(a, b, loose); break; + case '<': ret = lt(a, b, loose); break; + case '<=': ret = lte(a, b, loose); break; + default: throw new TypeError('Invalid operator: ' + op); + } + return ret; +} + +exports.Comparator = Comparator; +function Comparator(comp, loose) { + if (comp instanceof Comparator) { + if (comp.loose === loose) + return comp; + else + comp = comp.value; + } + + if (!(this instanceof Comparator)) + return new Comparator(comp, loose); + + debug('comparator', comp, loose); + this.loose = loose; + this.parse(comp); + + if (this.semver === ANY) + this.value = ''; + else + this.value = this.operator + this.semver.version; + + debug('comp', this); +} + +var ANY = {}; +Comparator.prototype.parse = function(comp) { + var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var m = comp.match(r); + + if (!m) + throw new TypeError('Invalid comparator: ' + comp); + + this.operator = m[1]; + if (this.operator === '=') + this.operator = ''; + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) + this.semver = ANY; + else + this.semver = new SemVer(m[2], this.loose); +}; + +Comparator.prototype.inspect = function() { + return ''; +}; + +Comparator.prototype.toString = function() { + return this.value; +}; + +Comparator.prototype.test = function(version) { + debug('Comparator.test', version, this.loose); + + if (this.semver === ANY) + return true; + + if (typeof version === 'string') + version = new SemVer(version, this.loose); + + return cmp(version, this.operator, this.semver, this.loose); +}; + + +exports.Range = Range; +function Range(range, loose) { + if ((range instanceof Range) && range.loose === loose) + return range; + + if (!(this instanceof Range)) + return new Range(range, loose); + + this.loose = loose; + + // First, split based on boolean or || + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map(function(range) { + return this.parseRange(range.trim()); + }, this).filter(function(c) { + // throw out any that are not relevant for whatever reason + return c.length; + }); + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range); + } + + this.format(); +} + +Range.prototype.inspect = function() { + return ''; +}; + +Range.prototype.format = function() { + this.range = this.set.map(function(comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; +}; + +Range.prototype.toString = function() { + return this.range; +}; + +Range.prototype.parseRange = function(range) { + var loose = this.loose; + range = range.trim(); + debug('range', range, loose); + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; + range = range.replace(hr, hyphenReplace); + debug('hyphen replace', range); + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); + debug('comparator trim', range, re[COMPARATORTRIM]); + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace); + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace); + + // normalize spaces + range = range.split(/\s+/).join(' '); + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var set = range.split(' ').map(function(comp) { + return parseComparator(comp, loose); + }).join(' ').split(/\s+/); + if (this.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function(comp) { + return !!comp.match(compRe); + }); + } + set = set.map(function(comp) { + return new Comparator(comp, loose); + }); + + return set; +}; + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators; +function toComparators(range, loose) { + return new Range(range, loose).set.map(function(comp) { + return comp.map(function(c) { + return c.value; + }).join(' ').trim().split(' '); + }); +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator(comp, loose) { + debug('comp', comp); + comp = replaceCarets(comp, loose); + debug('caret', comp); + comp = replaceTildes(comp, loose); + debug('tildes', comp); + comp = replaceXRanges(comp, loose); + debug('xrange', comp); + comp = replaceStars(comp, loose); + debug('stars', comp); + return comp; +} + +function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceTilde(comp, loose); + }).join(' '); +} + +function replaceTilde(comp, loose) { + var r = loose ? re[TILDELOOSE] : re[TILDE]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) + // ~1.2 == >=1.2.0- <1.3.0- + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else if (pr) { + debug('replaceTilde pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; + + debug('tilde return', ret); + return ret; + }); +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceCaret(comp, loose); + }).join(' '); +} + +function replaceCaret(comp, loose) { + debug('caret', comp, loose); + var r = loose ? re[CARETLOOSE] : re[CARET]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) { + if (M === '0') + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; + } else if (pr) { + debug('replaceCaret pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + (+M + 1) + '.0.0'; + } else { + debug('no pr'); + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0'; + } + + debug('caret return', ret); + return ret; + }); +} + +function replaceXRanges(comp, loose) { + debug('replaceXRanges', comp, loose); + return comp.split(/\s+/).map(function(comp) { + return replaceXRange(comp, loose); + }).join(' '); +} + +function replaceXRange(comp, loose) { + comp = comp.trim(); + var r = loose ? re[XRANGELOOSE] : re[XRANGE]; + return comp.replace(r, function(ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr); + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; + + if (gtlt === '=' && anyX) + gtlt = ''; + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0'; + } else { + // nothing is forbidden + ret = '*'; + } + } else if (gtlt && anyX) { + // replace X with 0 + if (xm) + m = 0; + if (xp) + p = 0; + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>='; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else if (xp) { + m = +m + 1; + p = 0; + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) + M = +M + 1 + else + m = +m + 1 + } + + ret = gtlt + M + '.' + m + '.' + p; + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } + + debug('xRange return', ret); + + return ret; + }); +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars(comp, loose) { + debug('replaceStars', comp, loose); + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], ''); +} + +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + + if (isX(fM)) + from = ''; + else if (isX(fm)) + from = '>=' + fM + '.0.0'; + else if (isX(fp)) + from = '>=' + fM + '.' + fm + '.0'; + else + from = '>=' + from; + + if (isX(tM)) + to = ''; + else if (isX(tm)) + to = '<' + (+tM + 1) + '.0.0'; + else if (isX(tp)) + to = '<' + tM + '.' + (+tm + 1) + '.0'; + else if (tpr) + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; + else + to = '<=' + to; + + return (from + ' ' + to).trim(); +} + + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function(version) { + if (!version) + return false; + + if (typeof version === 'string') + version = new SemVer(version, this.loose); + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version)) + return true; + } + return false; +}; + +function testSet(set, version) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) + return false; + } + + if (version.prerelease.length) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (var i = 0; i < set.length; i++) { + debug(set[i].semver); + if (set[i].semver === ANY) + return true; + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver; + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) + return true; + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false; + } + + return true; +} + +exports.satisfies = satisfies; +function satisfies(version, range, loose) { + try { + range = new Range(range, loose); + } catch (er) { + return false; + } + return range.test(version); +} + +exports.maxSatisfying = maxSatisfying; +function maxSatisfying(versions, range, loose) { + return versions.filter(function(version) { + return satisfies(version, range, loose); + }).sort(function(a, b) { + return rcompare(a, b, loose); + })[0] || null; +} + +exports.validRange = validRange; +function validRange(range, loose) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, loose).range || '*'; + } catch (er) { + return null; + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr; +function ltr(version, range, loose) { + return outside(version, range, '<', loose); +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr; +function gtr(version, range, loose) { + return outside(version, range, '>', loose); +} + +exports.outside = outside; +function outside(version, range, hilo, loose) { + version = new SemVer(version, loose); + range = new Range(range, loose); + + var gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break; + case '<': + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, loose)) { + return false; + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + + var high = null; + var low = null; + + comparators.forEach(function(comparator) { + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, loose)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, loose)) { + low = comparator; + } + }); + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false; + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; +} + +// Use the define() function if we're in AMD land +if (typeof define === 'function' && define.amd) + define(exports); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.min.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.min.js new file mode 100644 index 00000000..c2b3ff48 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/semver.min.js @@ -0,0 +1 @@ +(function(e){if(typeof module==="object"&&module.exports===e)e=module.exports=K;e.SEMVER_SPEC_VERSION="2.0.0";var r=256;var t=Number.MAX_SAFE_INTEGER||9007199254740991;var n=e.re=[];var i=e.src=[];var s=0;var o=s++;i[o]="0|[1-9]\\d*";var a=s++;i[a]="[0-9]+";var f=s++;i[f]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var u=s++;i[u]="("+i[o]+")\\."+"("+i[o]+")\\."+"("+i[o]+")";var l=s++;i[l]="("+i[a]+")\\."+"("+i[a]+")\\."+"("+i[a]+")";var p=s++;i[p]="(?:"+i[o]+"|"+i[f]+")";var h=s++;i[h]="(?:"+i[a]+"|"+i[f]+")";var c=s++;i[c]="(?:-("+i[p]+"(?:\\."+i[p]+")*))";var v=s++;i[v]="(?:-?("+i[h]+"(?:\\."+i[h]+")*))";var m=s++;i[m]="[0-9A-Za-z-]+";var g=s++;i[g]="(?:\\+("+i[m]+"(?:\\."+i[m]+")*))";var w=s++;var y="v?"+i[u]+i[c]+"?"+i[g]+"?";i[w]="^"+y+"$";var d="[v=\\s]*"+i[l]+i[v]+"?"+i[g]+"?";var j=s++;i[j]="^"+d+"$";var b=s++;i[b]="((?:<|>)?=?)";var E=s++;i[E]=i[a]+"|x|X|\\*";var $=s++;i[$]=i[o]+"|x|X|\\*";var k=s++;i[k]="[v=\\s]*("+i[$]+")"+"(?:\\.("+i[$]+")"+"(?:\\.("+i[$]+")"+"(?:"+i[c]+")?"+i[g]+"?"+")?)?";var R=s++;i[R]="[v=\\s]*("+i[E]+")"+"(?:\\.("+i[E]+")"+"(?:\\.("+i[E]+")"+"(?:"+i[v]+")?"+i[g]+"?"+")?)?";var S=s++;i[S]="^"+i[b]+"\\s*"+i[k]+"$";var x=s++;i[x]="^"+i[b]+"\\s*"+i[R]+"$";var I=s++;i[I]="(?:~>?)";var T=s++;i[T]="(\\s*)"+i[I]+"\\s+";n[T]=new RegExp(i[T],"g");var V="$1~";var A=s++;i[A]="^"+i[I]+i[k]+"$";var C=s++;i[C]="^"+i[I]+i[R]+"$";var M=s++;i[M]="(?:\\^)";var N=s++;i[N]="(\\s*)"+i[M]+"\\s+";n[N]=new RegExp(i[N],"g");var _="$1^";var z=s++;i[z]="^"+i[M]+i[k]+"$";var P=s++;i[P]="^"+i[M]+i[R]+"$";var X=s++;i[X]="^"+i[b]+"\\s*("+d+")$|^$";var Z=s++;i[Z]="^"+i[b]+"\\s*("+y+")$|^$";var q=s++;i[q]="(\\s*)"+i[b]+"\\s*("+d+"|"+i[k]+")";n[q]=new RegExp(i[q],"g");var L="$1$2$3";var F=s++;i[F]="^\\s*("+i[k]+")"+"\\s+-\\s+"+"("+i[k]+")"+"\\s*$";var G=s++;i[G]="^\\s*("+i[R]+")"+"\\s+-\\s+"+"("+i[R]+")"+"\\s*$";var O=s++;i[O]="(<|>)?=?\\s*\\*";for(var B=0;Br)return null;var i=t?n[j]:n[w];if(!i.test(e))return null;try{return new K(e,t)}catch(s){return null}}e.valid=H;function H(e,r){var t=D(e,r);return t?t.version:null}e.clean=J;function J(e,r){var t=D(e.trim().replace(/^[=v]+/,""),r);return t?t.version:null}e.SemVer=K;function K(e,i){if(e instanceof K){if(e.loose===i)return e;else e=e.version}else if(typeof e!=="string"){throw new TypeError("Invalid Version: "+e)}if(e.length>r)throw new TypeError("version is longer than "+r+" characters");if(!(this instanceof K))return new K(e,i);this.loose=i;var s=e.trim().match(i?n[j]:n[w]);if(!s)throw new TypeError("Invalid Version: "+e);this.raw=e;this.major=+s[1];this.minor=+s[2];this.patch=+s[3];if(this.major>t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>t||this.patch<0)throw new TypeError("Invalid patch version");if(!s[4])this.prerelease=[];else this.prerelease=s[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var r=+e;if(r>=0&&r'};K.prototype.toString=function(){return this.version};K.prototype.compare=function(e){if(!(e instanceof K))e=new K(e,this.loose);return this.compareMain(e)||this.comparePre(e)};K.prototype.compareMain=function(e){if(!(e instanceof K))e=new K(e,this.loose);return Y(this.major,e.major)||Y(this.minor,e.minor)||Y(this.patch,e.patch)};K.prototype.comparePre=function(e){if(!(e instanceof K))e=new K(e,this.loose);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;var r=0;do{var t=this.prerelease[r];var n=e.prerelease[r];if(t===undefined&&n===undefined)return 0;else if(n===undefined)return 1;else if(t===undefined)return-1;else if(t===n)continue;else return Y(t,n)}while(++r)};K.prototype.inc=function(e,r){switch(e){case"premajor":this.prerelease.length=0;this.patch=0;this.minor=0;this.major++;this.inc("pre",r);break;case"preminor":this.prerelease.length=0;this.patch=0;this.minor++;this.inc("pre",r);break;case"prepatch":this.prerelease.length=0;this.inc("patch",r);this.inc("pre",r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",r);this.inc("pre",r);break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0;this.patch=0;this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0;this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{var t=this.prerelease.length;while(--t>=0){if(typeof this.prerelease[t]==="number"){this.prerelease[t]++;t=-2}}if(t===-1)this.prerelease.push(0)}if(r){if(this.prerelease[0]===r){if(isNaN(this.prerelease[1]))this.prerelease=[r,0]}else this.prerelease=[r,0]}break;default:throw new Error("invalid increment argument: "+e)}this.format();return this};e.inc=Q;function Q(e,r,t,n){if(typeof t==="string"){n=t;t=undefined}try{return new K(e,t).inc(r,n).version}catch(i){return null}}e.diff=U;function U(e,r){if(pr(e,r)){return null}else{var t=D(e);var n=D(r);if(t.prerelease.length||n.prerelease.length){for(var i in t){if(i==="major"||i==="minor"||i==="patch"){if(t[i]!==n[i]){return"pre"+i}}}return"prerelease"}for(var i in t){if(i==="major"||i==="minor"||i==="patch"){if(t[i]!==n[i]){return i}}}}}e.compareIdentifiers=Y;var W=/^[0-9]+$/;function Y(e,r){var t=W.test(e);var n=W.test(r);if(t&&n){e=+e;r=+r}return t&&!n?-1:n&&!t?1:er?1:0}e.rcompareIdentifiers=er;function er(e,r){return Y(r,e)}e.major=rr;function rr(e,r){return new K(e,r).major}e.minor=tr;function tr(e,r){return new K(e,r).minor}e.patch=nr;function nr(e,r){return new K(e,r).patch}e.compare=ir;function ir(e,r,t){return new K(e,t).compare(r)}e.compareLoose=sr;function sr(e,r){return ir(e,r,true)}e.rcompare=or;function or(e,r,t){return ir(r,e,t)}e.sort=ar;function ar(r,t){return r.sort(function(r,n){return e.compare(r,n,t)})}e.rsort=fr;function fr(r,t){return r.sort(function(r,n){return e.rcompare(r,n,t)})}e.gt=ur;function ur(e,r,t){return ir(e,r,t)>0}e.lt=lr;function lr(e,r,t){return ir(e,r,t)<0}e.eq=pr;function pr(e,r,t){return ir(e,r,t)===0}e.neq=hr;function hr(e,r,t){return ir(e,r,t)!==0}e.gte=cr;function cr(e,r,t){return ir(e,r,t)>=0}e.lte=vr;function vr(e,r,t){return ir(e,r,t)<=0}e.cmp=mr;function mr(e,r,t,n){var i;switch(r){case"===":if(typeof e==="object")e=e.version;if(typeof t==="object")t=t.version;i=e===t;break;case"!==":if(typeof e==="object")e=e.version;if(typeof t==="object")t=t.version;i=e!==t;break;case"":case"=":case"==":i=pr(e,t,n);break;case"!=":i=hr(e,t,n);break;case">":i=ur(e,t,n);break;case">=":i=cr(e,t,n);break;case"<":i=lr(e,t,n);break;case"<=":i=vr(e,t,n);break;default:throw new TypeError("Invalid operator: "+r)}return i}e.Comparator=gr;function gr(e,r){if(e instanceof gr){if(e.loose===r)return e;else e=e.value}if(!(this instanceof gr))return new gr(e,r);this.loose=r;this.parse(e);if(this.semver===wr)this.value="";else this.value=this.operator+this.semver.version}var wr={};gr.prototype.parse=function(e){var r=this.loose?n[X]:n[Z];var t=e.match(r);if(!t)throw new TypeError("Invalid comparator: "+e);this.operator=t[1];if(this.operator==="=")this.operator="";if(!t[2])this.semver=wr;else this.semver=new K(t[2],this.loose)};gr.prototype.inspect=function(){return''};gr.prototype.toString=function(){return this.value};gr.prototype.test=function(e){if(this.semver===wr)return true;if(typeof e==="string")e=new K(e,this.loose);return mr(e,this.operator,this.semver,this.loose)};e.Range=yr;function yr(e,r){if(e instanceof yr&&e.loose===r)return e;if(!(this instanceof yr))return new yr(e,r);this.loose=r;this.raw=e;this.set=e.split(/\s*\|\|\s*/).map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+e)}this.format()}yr.prototype.inspect=function(){return''};yr.prototype.format=function(){this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim();return this.range};yr.prototype.toString=function(){return this.range};yr.prototype.parseRange=function(e){var r=this.loose;e=e.trim();var t=r?n[G]:n[F];e=e.replace(t,Tr);e=e.replace(n[q],L);e=e.replace(n[T],V);e=e.replace(n[N],_);e=e.split(/\s+/).join(" ");var i=r?n[X]:n[Z];var s=e.split(" ").map(function(e){return jr(e,r)}).join(" ").split(/\s+/);if(this.loose){s=s.filter(function(e){return!!e.match(i)})}s=s.map(function(e){return new gr(e,r)});return s};e.toComparators=dr;function dr(e,r){return new yr(e,r).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})}function jr(e,r){e=kr(e,r);e=Er(e,r);e=Sr(e,r);e=Ir(e,r);return e}function br(e){return!e||e.toLowerCase()==="x"||e==="*"}function Er(e,r){return e.trim().split(/\s+/).map(function(e){return $r(e,r)}).join(" ")}function $r(e,r){var t=r?n[C]:n[A];return e.replace(t,function(e,r,t,n,i){var s;if(br(r))s="";else if(br(t))s=">="+r+".0.0 <"+(+r+1)+".0.0";else if(br(n))s=">="+r+"."+t+".0 <"+r+"."+(+t+1)+".0";else if(i){if(i.charAt(0)!=="-")i="-"+i;s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0"}else s=">="+r+"."+t+"."+n+" <"+r+"."+(+t+1)+".0";return s})}function kr(e,r){return e.trim().split(/\s+/).map(function(e){return Rr(e,r)}).join(" ")}function Rr(e,r){var t=r?n[P]:n[z];return e.replace(t,function(e,r,t,n,i){var s;if(br(r))s="";else if(br(t))s=">="+r+".0.0 <"+(+r+1)+".0.0";else if(br(n)){if(r==="0")s=">="+r+"."+t+".0 <"+r+"."+(+t+1)+".0";else s=">="+r+"."+t+".0 <"+(+r+1)+".0.0"}else if(i){if(i.charAt(0)!=="-")i="-"+i;if(r==="0"){if(t==="0")s=">="+r+"."+t+"."+n+i+" <"+r+"."+t+"."+(+n+1);else s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0"}else s=">="+r+"."+t+"."+n+i+" <"+(+r+1)+".0.0"}else{if(r==="0"){if(t==="0")s=">="+r+"."+t+"."+n+" <"+r+"."+t+"."+(+n+1);else s=">="+r+"."+t+"."+n+" <"+r+"."+(+t+1)+".0"}else s=">="+r+"."+t+"."+n+" <"+(+r+1)+".0.0"}return s})}function Sr(e,r){return e.split(/\s+/).map(function(e){return xr(e,r)}).join(" ")}function xr(e,r){e=e.trim();var t=r?n[x]:n[S];return e.replace(t,function(e,r,t,n,i,s){var o=br(t);var a=o||br(n);var f=a||br(i);var u=f;if(r==="="&&u)r="";if(o){if(r===">"||r==="<"){e="<0.0.0"}else{e="*"}}else if(r&&u){if(a)n=0;if(f)i=0;if(r===">"){r=">=";if(a){t=+t+1;n=0;i=0}else if(f){n=+n+1;i=0}}else if(r==="<="){r="<";if(a)t=+t+1;else n=+n+1}e=r+t+"."+n+"."+i}else if(a){e=">="+t+".0.0 <"+(+t+1)+".0.0"}else if(f){e=">="+t+"."+n+".0 <"+t+"."+(+n+1)+".0"}return e})}function Ir(e,r){return e.trim().replace(n[O],"")}function Tr(e,r,t,n,i,s,o,a,f,u,l,p,h){if(br(t))r="";else if(br(n))r=">="+t+".0.0";else if(br(i))r=">="+t+"."+n+".0";else r=">="+r;if(br(f))a="";else if(br(u))a="<"+(+f+1)+".0.0";else if(br(l))a="<"+f+"."+(+u+1)+".0";else if(p)a="<="+f+"."+u+"."+l+"-"+p;else a="<="+a;return(r+" "+a).trim()}yr.prototype.test=function(e){if(!e)return false;if(typeof e==="string")e=new K(e,this.loose);for(var r=0;r0){var n=e[t].semver;if(n.major===r.major&&n.minor===r.minor&&n.patch===r.patch)return true}}return false}return true}e.satisfies=Ar;function Ar(e,r,t){try{r=new yr(r,t)}catch(n){return false}return r.test(e)}e.maxSatisfying=Cr;function Cr(e,r,t){return e.filter(function(e){return Ar(e,r,t)}).sort(function(e,r){return or(e,r,t)})[0]||null}e.validRange=Mr;function Mr(e,r){try{return new yr(e,r).range||"*"}catch(t){return null}}e.ltr=Nr;function Nr(e,r,t){return zr(e,r,"<",t)}e.gtr=_r;function _r(e,r,t){return zr(e,r,">",t)}e.outside=zr;function zr(e,r,t,n){e=new K(e,n);r=new yr(r,n);var i,s,o,a,f;switch(t){case">":i=ur;s=vr;o=lr;a=">";f=">=";break;case"<":i=lr;s=cr;o=ur;a="<";f="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Ar(e,r,n)){return false}for(var u=0;u1.2.3', null], + ['~1.2.3', null], + ['<=1.2.3', null], + ['1.2.x', null] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var msg = 'clean(' + range + ') = ' + version; + t.equal(clean(range), version, msg); + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/gtr.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/gtr.js new file mode 100644 index 00000000..bbb87896 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/gtr.js @@ -0,0 +1,173 @@ +var tap = require('tap'); +var test = tap.test; +var semver = require('../semver.js'); +var gtr = semver.gtr; + +test('\ngtr tests', function(t) { + // [range, version, loose] + // Version should be greater than range + [ + ['~1.2.2', '1.3.0'], + ['~0.6.1-1', '0.7.1-1'], + ['1.0.0 - 2.0.0', '2.0.1'], + ['1.0.0', '1.0.1-beta1'], + ['1.0.0', '2.0.0'], + ['<=2.0.0', '2.1.1'], + ['<=2.0.0', '3.2.9'], + ['<2.0.0', '2.0.0'], + ['0.1.20 || 1.2.4', '1.2.5'], + ['2.x.x', '3.0.0'], + ['1.2.x', '1.3.0'], + ['1.2.x || 2.x', '3.0.0'], + ['2.*.*', '5.0.1'], + ['1.2.*', '1.3.3'], + ['1.2.* || 2.*', '4.0.0'], + ['2', '3.0.0'], + ['2.3', '2.4.2'], + ['~2.4', '2.5.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.5.5'], + ['~>3.2.1', '3.3.0'], // >=3.2.1 <3.3.0 + ['~1', '2.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '2.2.4'], + ['~> 1', '3.2.3'], + ['~1.0', '1.1.2'], // >=1.0.0 <1.1.0 + ['~ 1.0', '1.1.0'], + ['<1.2', '1.2.0'], + ['< 1.2', '1.2.1'], + ['1', '2.0.0beta', true], + ['~v0.5.4-pre', '0.6.0'], + ['~v0.5.4-pre', '0.6.1-pre'], + ['=0.7.x', '0.8.0'], + ['=0.7.x', '0.8.0-asdf'], + ['<0.7.x', '0.7.0'], + ['~1.2.2', '1.3.0'], + ['1.0.0 - 2.0.0', '2.2.3'], + ['1.0.0', '1.0.1'], + ['<=2.0.0', '3.0.0'], + ['<=2.0.0', '2.9999.9999'], + ['<=2.0.0', '2.2.9'], + ['<2.0.0', '2.9999.9999'], + ['<2.0.0', '2.2.9'], + ['2.x.x', '3.1.3'], + ['1.2.x', '1.3.3'], + ['1.2.x || 2.x', '3.1.3'], + ['2.*.*', '3.1.3'], + ['1.2.*', '1.3.3'], + ['1.2.* || 2.*', '3.1.3'], + ['2', '3.1.2'], + ['2.3', '2.4.1'], + ['~2.4', '2.5.0'], // >=2.4.0 <2.5.0 + ['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0 + ['~1', '2.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '2.2.3'], + ['~1.0', '1.1.0'], // >=1.0.0 <1.1.0 + ['<1', '1.0.0'], + ['1', '2.0.0beta', true], + ['<1', '1.0.0beta', true], + ['< 1', '1.0.0beta', true], + ['=0.7.x', '0.8.2'], + ['<0.7.x', '0.7.2'] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = 'gtr(' + version + ', ' + range + ', ' + loose + ')'; + t.ok(gtr(version, range, loose), msg); + }); + t.end(); +}); + +test('\nnegative gtr tests', function(t) { + // [range, version, loose] + // Version should NOT be greater than range + [ + ['~0.6.1-1', '0.6.1-1'], + ['1.0.0 - 2.0.0', '1.2.3'], + ['1.0.0 - 2.0.0', '0.9.9'], + ['1.0.0', '1.0.0'], + ['>=*', '0.2.4'], + ['', '1.0.0', true], + ['*', '1.2.3'], + ['*', 'v1.2.3-foo'], + ['>=1.0.0', '1.0.0'], + ['>=1.0.0', '1.0.1'], + ['>=1.0.0', '1.1.0'], + ['>1.0.0', '1.0.1'], + ['>1.0.0', '1.1.0'], + ['<=2.0.0', '2.0.0'], + ['<=2.0.0', '1.9999.9999'], + ['<=2.0.0', '0.2.9'], + ['<2.0.0', '1.9999.9999'], + ['<2.0.0', '0.2.9'], + ['>= 1.0.0', '1.0.0'], + ['>= 1.0.0', '1.0.1'], + ['>= 1.0.0', '1.1.0'], + ['> 1.0.0', '1.0.1'], + ['> 1.0.0', '1.1.0'], + ['<= 2.0.0', '2.0.0'], + ['<= 2.0.0', '1.9999.9999'], + ['<= 2.0.0', '0.2.9'], + ['< 2.0.0', '1.9999.9999'], + ['<\t2.0.0', '0.2.9'], + ['>=0.1.97', 'v0.1.97'], + ['>=0.1.97', '0.1.97'], + ['0.1.20 || 1.2.4', '1.2.4'], + ['0.1.20 || >1.2.4', '1.2.4'], + ['0.1.20 || 1.2.4', '1.2.3'], + ['0.1.20 || 1.2.4', '0.1.20'], + ['>=0.2.3 || <0.0.1', '0.0.0'], + ['>=0.2.3 || <0.0.1', '0.2.3'], + ['>=0.2.3 || <0.0.1', '0.2.4'], + ['||', '1.3.4'], + ['2.x.x', '2.1.3'], + ['1.2.x', '1.2.3'], + ['1.2.x || 2.x', '2.1.3'], + ['1.2.x || 2.x', '1.2.3'], + ['x', '1.2.3'], + ['2.*.*', '2.1.3'], + ['1.2.*', '1.2.3'], + ['1.2.* || 2.*', '2.1.3'], + ['1.2.* || 2.*', '1.2.3'], + ['1.2.* || 2.*', '1.2.3'], + ['*', '1.2.3'], + ['2', '2.1.2'], + ['2.3', '2.3.1'], + ['~2.4', '2.4.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.4.5'], + ['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0 + ['~1', '1.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '1.2.3'], + ['~> 1', '1.2.3'], + ['~1.0', '1.0.2'], // >=1.0.0 <1.1.0 + ['~ 1.0', '1.0.2'], + ['>=1', '1.0.0'], + ['>= 1', '1.0.0'], + ['<1.2', '1.1.1'], + ['< 1.2', '1.1.1'], + ['1', '1.0.0beta', true], + ['~v0.5.4-pre', '0.5.5'], + ['~v0.5.4-pre', '0.5.4'], + ['=0.7.x', '0.7.2'], + ['>=0.7.x', '0.7.2'], + ['=0.7.x', '0.7.0-asdf'], + ['>=0.7.x', '0.7.0-asdf'], + ['<=0.7.x', '0.6.2'], + ['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'], + ['>=0.2.3 <=0.2.4', '0.2.4'], + ['1.0.0 - 2.0.0', '2.0.0'], + ['^1', '0.0.0-0'], + ['^3.0.0', '2.0.0'], + ['^1.0.0 || ~2.0.1', '2.0.0'], + ['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'], + ['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true], + ['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true], + ['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = '!gtr(' + version + ', ' + range + ', ' + loose + ')'; + t.notOk(gtr(version, range, loose), msg); + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/index.js new file mode 100644 index 00000000..926d560f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/index.js @@ -0,0 +1,684 @@ +'use strict'; + +var tap = require('tap'); +var test = tap.test; +var semver = require('../semver.js'); +var eq = semver.eq; +var gt = semver.gt; +var lt = semver.lt; +var neq = semver.neq; +var cmp = semver.cmp; +var gte = semver.gte; +var lte = semver.lte; +var satisfies = semver.satisfies; +var validRange = semver.validRange; +var inc = semver.inc; +var diff = semver.diff; +var replaceStars = semver.replaceStars; +var toComparators = semver.toComparators; +var SemVer = semver.SemVer; +var Range = semver.Range; + +test('\ncomparison tests', function(t) { + // [version1, version2] + // version1 should be greater than version2 + [['0.0.0', '0.0.0-foo'], + ['0.0.1', '0.0.0'], + ['1.0.0', '0.9.9'], + ['0.10.0', '0.9.0'], + ['0.99.0', '0.10.0'], + ['2.0.0', '1.2.3'], + ['v0.0.0', '0.0.0-foo', true], + ['v0.0.1', '0.0.0', true], + ['v1.0.0', '0.9.9', true], + ['v0.10.0', '0.9.0', true], + ['v0.99.0', '0.10.0', true], + ['v2.0.0', '1.2.3', true], + ['0.0.0', 'v0.0.0-foo', true], + ['0.0.1', 'v0.0.0', true], + ['1.0.0', 'v0.9.9', true], + ['0.10.0', 'v0.9.0', true], + ['0.99.0', 'v0.10.0', true], + ['2.0.0', 'v1.2.3', true], + ['1.2.3', '1.2.3-asdf'], + ['1.2.3', '1.2.3-4'], + ['1.2.3', '1.2.3-4-foo'], + ['1.2.3-5-foo', '1.2.3-5'], + ['1.2.3-5', '1.2.3-4'], + ['1.2.3-5-foo', '1.2.3-5-Foo'], + ['3.0.0', '2.7.2+asdf'], + ['1.2.3-a.10', '1.2.3-a.5'], + ['1.2.3-a.b', '1.2.3-a.5'], + ['1.2.3-a.b', '1.2.3-a'], + ['1.2.3-a.b.c.10.d.5', '1.2.3-a.b.c.5.d.100'], + ['1.2.3-r2', '1.2.3-r100'], + ['1.2.3-r100', '1.2.3-R2'] + ].forEach(function(v) { + var v0 = v[0]; + var v1 = v[1]; + var loose = v[2]; + t.ok(gt(v0, v1, loose), "gt('" + v0 + "', '" + v1 + "')"); + t.ok(lt(v1, v0, loose), "lt('" + v1 + "', '" + v0 + "')"); + t.ok(!gt(v1, v0, loose), "!gt('" + v1 + "', '" + v0 + "')"); + t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')"); + t.ok(eq(v0, v0, loose), "eq('" + v0 + "', '" + v0 + "')"); + t.ok(eq(v1, v1, loose), "eq('" + v1 + "', '" + v1 + "')"); + t.ok(neq(v0, v1, loose), "neq('" + v0 + "', '" + v1 + "')"); + t.ok(cmp(v1, '==', v1, loose), "cmp('" + v1 + "' == '" + v1 + "')"); + t.ok(cmp(v0, '>=', v1, loose), "cmp('" + v0 + "' >= '" + v1 + "')"); + t.ok(cmp(v1, '<=', v0, loose), "cmp('" + v1 + "' <= '" + v0 + "')"); + t.ok(cmp(v0, '!=', v1, loose), "cmp('" + v0 + "' != '" + v1 + "')"); + }); + t.end(); +}); + +test('\nequality tests', function(t) { + // [version1, version2] + // version1 should be equivalent to version2 + [['1.2.3', 'v1.2.3', true], + ['1.2.3', '=1.2.3', true], + ['1.2.3', 'v 1.2.3', true], + ['1.2.3', '= 1.2.3', true], + ['1.2.3', ' v1.2.3', true], + ['1.2.3', ' =1.2.3', true], + ['1.2.3', ' v 1.2.3', true], + ['1.2.3', ' = 1.2.3', true], + ['1.2.3-0', 'v1.2.3-0', true], + ['1.2.3-0', '=1.2.3-0', true], + ['1.2.3-0', 'v 1.2.3-0', true], + ['1.2.3-0', '= 1.2.3-0', true], + ['1.2.3-0', ' v1.2.3-0', true], + ['1.2.3-0', ' =1.2.3-0', true], + ['1.2.3-0', ' v 1.2.3-0', true], + ['1.2.3-0', ' = 1.2.3-0', true], + ['1.2.3-1', 'v1.2.3-1', true], + ['1.2.3-1', '=1.2.3-1', true], + ['1.2.3-1', 'v 1.2.3-1', true], + ['1.2.3-1', '= 1.2.3-1', true], + ['1.2.3-1', ' v1.2.3-1', true], + ['1.2.3-1', ' =1.2.3-1', true], + ['1.2.3-1', ' v 1.2.3-1', true], + ['1.2.3-1', ' = 1.2.3-1', true], + ['1.2.3-beta', 'v1.2.3-beta', true], + ['1.2.3-beta', '=1.2.3-beta', true], + ['1.2.3-beta', 'v 1.2.3-beta', true], + ['1.2.3-beta', '= 1.2.3-beta', true], + ['1.2.3-beta', ' v1.2.3-beta', true], + ['1.2.3-beta', ' =1.2.3-beta', true], + ['1.2.3-beta', ' v 1.2.3-beta', true], + ['1.2.3-beta', ' = 1.2.3-beta', true], + ['1.2.3-beta+build', ' = 1.2.3-beta+otherbuild', true], + ['1.2.3+build', ' = 1.2.3+otherbuild', true], + ['1.2.3-beta+build', '1.2.3-beta+otherbuild'], + ['1.2.3+build', '1.2.3+otherbuild'], + [' v1.2.3+build', '1.2.3+otherbuild'] + ].forEach(function(v) { + var v0 = v[0]; + var v1 = v[1]; + var loose = v[2]; + t.ok(eq(v0, v1, loose), "eq('" + v0 + "', '" + v1 + "')"); + t.ok(!neq(v0, v1, loose), "!neq('" + v0 + "', '" + v1 + "')"); + t.ok(cmp(v0, '==', v1, loose), 'cmp(' + v0 + '==' + v1 + ')'); + t.ok(!cmp(v0, '!=', v1, loose), '!cmp(' + v0 + '!=' + v1 + ')'); + t.ok(!cmp(v0, '===', v1, loose), '!cmp(' + v0 + '===' + v1 + ')'); + t.ok(cmp(v0, '!==', v1, loose), 'cmp(' + v0 + '!==' + v1 + ')'); + t.ok(!gt(v0, v1, loose), "!gt('" + v0 + "', '" + v1 + "')"); + t.ok(gte(v0, v1, loose), "gte('" + v0 + "', '" + v1 + "')"); + t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')"); + t.ok(lte(v0, v1, loose), "lte('" + v0 + "', '" + v1 + "')"); + }); + t.end(); +}); + + +test('\nrange tests', function(t) { + // [range, version] + // version should be included by range + [['1.0.0 - 2.0.0', '1.2.3'], + ['^1.2.3+build', '1.2.3'], + ['^1.2.3+build', '1.3.0'], + ['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3'], + ['1.2.3pre+asdf - 2.4.3-pre+asdf', '1.2.3', true], + ['1.2.3-pre+asdf - 2.4.3pre+asdf', '1.2.3', true], + ['1.2.3pre+asdf - 2.4.3pre+asdf', '1.2.3', true], + ['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3-pre.2'], + ['1.2.3-pre+asdf - 2.4.3-pre+asdf', '2.4.3-alpha'], + ['1.2.3+asdf - 2.4.3+asdf', '1.2.3'], + ['1.0.0', '1.0.0'], + ['>=*', '0.2.4'], + ['', '1.0.0'], + ['*', '1.2.3'], + ['*', 'v1.2.3-foo', true], + ['>=1.0.0', '1.0.0'], + ['>=1.0.0', '1.0.1'], + ['>=1.0.0', '1.1.0'], + ['>1.0.0', '1.0.1'], + ['>1.0.0', '1.1.0'], + ['<=2.0.0', '2.0.0'], + ['<=2.0.0', '1.9999.9999'], + ['<=2.0.0', '0.2.9'], + ['<2.0.0', '1.9999.9999'], + ['<2.0.0', '0.2.9'], + ['>= 1.0.0', '1.0.0'], + ['>= 1.0.0', '1.0.1'], + ['>= 1.0.0', '1.1.0'], + ['> 1.0.0', '1.0.1'], + ['> 1.0.0', '1.1.0'], + ['<= 2.0.0', '2.0.0'], + ['<= 2.0.0', '1.9999.9999'], + ['<= 2.0.0', '0.2.9'], + ['< 2.0.0', '1.9999.9999'], + ['<\t2.0.0', '0.2.9'], + ['>=0.1.97', 'v0.1.97', true], + ['>=0.1.97', '0.1.97'], + ['0.1.20 || 1.2.4', '1.2.4'], + ['>=0.2.3 || <0.0.1', '0.0.0'], + ['>=0.2.3 || <0.0.1', '0.2.3'], + ['>=0.2.3 || <0.0.1', '0.2.4'], + ['||', '1.3.4'], + ['2.x.x', '2.1.3'], + ['1.2.x', '1.2.3'], + ['1.2.x || 2.x', '2.1.3'], + ['1.2.x || 2.x', '1.2.3'], + ['x', '1.2.3'], + ['2.*.*', '2.1.3'], + ['1.2.*', '1.2.3'], + ['1.2.* || 2.*', '2.1.3'], + ['1.2.* || 2.*', '1.2.3'], + ['*', '1.2.3'], + ['2', '2.1.2'], + ['2.3', '2.3.1'], + ['~2.4', '2.4.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.4.5'], + ['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0, + ['~1', '1.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '1.2.3'], + ['~> 1', '1.2.3'], + ['~1.0', '1.0.2'], // >=1.0.0 <1.1.0, + ['~ 1.0', '1.0.2'], + ['~ 1.0.3', '1.0.12'], + ['>=1', '1.0.0'], + ['>= 1', '1.0.0'], + ['<1.2', '1.1.1'], + ['< 1.2', '1.1.1'], + ['~v0.5.4-pre', '0.5.5'], + ['~v0.5.4-pre', '0.5.4'], + ['=0.7.x', '0.7.2'], + ['<=0.7.x', '0.7.2'], + ['>=0.7.x', '0.7.2'], + ['<=0.7.x', '0.6.2'], + ['~1.2.1 >=1.2.3', '1.2.3'], + ['~1.2.1 =1.2.3', '1.2.3'], + ['~1.2.1 1.2.3', '1.2.3'], + ['~1.2.1 >=1.2.3 1.2.3', '1.2.3'], + ['~1.2.1 1.2.3 >=1.2.3', '1.2.3'], + ['~1.2.1 1.2.3', '1.2.3'], + ['>=1.2.1 1.2.3', '1.2.3'], + ['1.2.3 >=1.2.1', '1.2.3'], + ['>=1.2.3 >=1.2.1', '1.2.3'], + ['>=1.2.1 >=1.2.3', '1.2.3'], + ['>=1.2', '1.2.8'], + ['^1.2.3', '1.8.1'], + ['^0.1.2', '0.1.2'], + ['^0.1', '0.1.2'], + ['^1.2', '1.4.2'], + ['^1.2 ^1', '1.4.2'], + ['^1.2.3-alpha', '1.2.3-pre'], + ['^1.2.0-alpha', '1.2.0-pre'], + ['^0.0.1-alpha', '0.0.1-beta'] + ].forEach(function(v) { + var range = v[0]; + var ver = v[1]; + var loose = v[2]; + t.ok(satisfies(ver, range, loose), range + ' satisfied by ' + ver); + }); + t.end(); +}); + +test('\nnegative range tests', function(t) { + // [range, version] + // version should not be included by range + [['1.0.0 - 2.0.0', '2.2.3'], + ['1.2.3+asdf - 2.4.3+asdf', '1.2.3-pre.2'], + ['1.2.3+asdf - 2.4.3+asdf', '2.4.3-alpha'], + ['^1.2.3+build', '2.0.0'], + ['^1.2.3+build', '1.2.0'], + ['^1.2.3', '1.2.3-pre'], + ['^1.2', '1.2.0-pre'], + ['>1.2', '1.3.0-beta'], + ['<=1.2.3', '1.2.3-beta'], + ['^1.2.3', '1.2.3-beta'], + ['=0.7.x', '0.7.0-asdf'], + ['>=0.7.x', '0.7.0-asdf'], + ['1', '1.0.0beta', true], + ['<1', '1.0.0beta', true], + ['< 1', '1.0.0beta', true], + ['1.0.0', '1.0.1'], + ['>=1.0.0', '0.0.0'], + ['>=1.0.0', '0.0.1'], + ['>=1.0.0', '0.1.0'], + ['>1.0.0', '0.0.1'], + ['>1.0.0', '0.1.0'], + ['<=2.0.0', '3.0.0'], + ['<=2.0.0', '2.9999.9999'], + ['<=2.0.0', '2.2.9'], + ['<2.0.0', '2.9999.9999'], + ['<2.0.0', '2.2.9'], + ['>=0.1.97', 'v0.1.93', true], + ['>=0.1.97', '0.1.93'], + ['0.1.20 || 1.2.4', '1.2.3'], + ['>=0.2.3 || <0.0.1', '0.0.3'], + ['>=0.2.3 || <0.0.1', '0.2.2'], + ['2.x.x', '1.1.3'], + ['2.x.x', '3.1.3'], + ['1.2.x', '1.3.3'], + ['1.2.x || 2.x', '3.1.3'], + ['1.2.x || 2.x', '1.1.3'], + ['2.*.*', '1.1.3'], + ['2.*.*', '3.1.3'], + ['1.2.*', '1.3.3'], + ['1.2.* || 2.*', '3.1.3'], + ['1.2.* || 2.*', '1.1.3'], + ['2', '1.1.2'], + ['2.3', '2.4.1'], + ['~2.4', '2.5.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.3.9'], + ['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0 + ['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0 + ['~1', '0.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '2.2.3'], + ['~1.0', '1.1.0'], // >=1.0.0 <1.1.0 + ['<1', '1.0.0'], + ['>=1.2', '1.1.1'], + ['1', '2.0.0beta', true], + ['~v0.5.4-beta', '0.5.4-alpha'], + ['=0.7.x', '0.8.2'], + ['>=0.7.x', '0.6.2'], + ['<0.7.x', '0.7.2'], + ['<1.2.3', '1.2.3-beta'], + ['=1.2.3', '1.2.3-beta'], + ['>1.2', '1.2.8'], + ['^1.2.3', '2.0.0-alpha'], + ['^1.2.3', '1.2.2'], + ['^1.2', '1.1.9'], + // invalid ranges never satisfied! + ['blerg', '1.2.3'], + ['git+https://user:password0123@github.com/foo', '123.0.0', true], + ['^1.2.3', '2.0.0-pre'] + ].forEach(function(v) { + var range = v[0]; + var ver = v[1]; + var loose = v[2]; + var found = satisfies(ver, range, loose); + t.ok(!found, ver + ' not satisfied by ' + range); + }); + t.end(); +}); + +test('\nincrement versions test', function(t) { +// [version, inc, result, identifier] +// inc(version, inc) -> result + [['1.2.3', 'major', '2.0.0'], + ['1.2.3', 'minor', '1.3.0'], + ['1.2.3', 'patch', '1.2.4'], + ['1.2.3tag', 'major', '2.0.0', true], + ['1.2.3-tag', 'major', '2.0.0'], + ['1.2.3', 'fake', null], + ['1.2.0-0', 'patch', '1.2.0'], + ['fake', 'major', null], + ['1.2.3-4', 'major', '2.0.0'], + ['1.2.3-4', 'minor', '1.3.0'], + ['1.2.3-4', 'patch', '1.2.3'], + ['1.2.3-alpha.0.beta', 'major', '2.0.0'], + ['1.2.3-alpha.0.beta', 'minor', '1.3.0'], + ['1.2.3-alpha.0.beta', 'patch', '1.2.3'], + ['1.2.4', 'prerelease', '1.2.5-0'], + ['1.2.3-0', 'prerelease', '1.2.3-1'], + ['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1'], + ['1.2.3-alpha.1', 'prerelease', '1.2.3-alpha.2'], + ['1.2.3-alpha.2', 'prerelease', '1.2.3-alpha.3'], + ['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta'], + ['1.2.3-alpha.1.beta', 'prerelease', '1.2.3-alpha.2.beta'], + ['1.2.3-alpha.2.beta', 'prerelease', '1.2.3-alpha.3.beta'], + ['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta'], + ['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta'], + ['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta'], + ['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1'], + ['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2'], + ['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3'], + ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta'], + ['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta'], + ['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'], + ['1.2.0', 'prepatch', '1.2.1-0'], + ['1.2.0-1', 'prepatch', '1.2.1-0'], + ['1.2.0', 'preminor', '1.3.0-0'], + ['1.2.3-1', 'preminor', '1.3.0-0'], + ['1.2.0', 'premajor', '2.0.0-0'], + ['1.2.3-1', 'premajor', '2.0.0-0'], + ['1.2.0-1', 'minor', '1.2.0'], + ['1.0.0-1', 'major', '1.0.0'], + + ['1.2.3', 'major', '2.0.0', false, 'dev'], + ['1.2.3', 'minor', '1.3.0', false, 'dev'], + ['1.2.3', 'patch', '1.2.4', false, 'dev'], + ['1.2.3tag', 'major', '2.0.0', true, 'dev'], + ['1.2.3-tag', 'major', '2.0.0', false, 'dev'], + ['1.2.3', 'fake', null, false, 'dev'], + ['1.2.0-0', 'patch', '1.2.0', false, 'dev'], + ['fake', 'major', null, false, 'dev'], + ['1.2.3-4', 'major', '2.0.0', false, 'dev'], + ['1.2.3-4', 'minor', '1.3.0', false, 'dev'], + ['1.2.3-4', 'patch', '1.2.3', false, 'dev'], + ['1.2.3-alpha.0.beta', 'major', '2.0.0', false, 'dev'], + ['1.2.3-alpha.0.beta', 'minor', '1.3.0', false, 'dev'], + ['1.2.3-alpha.0.beta', 'patch', '1.2.3', false, 'dev'], + ['1.2.4', 'prerelease', '1.2.5-dev.0', false, 'dev'], + ['1.2.3-0', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.0', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1', false, 'alpha'], + ['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta', false, 'alpha'], + ['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta', false, 'alpha'], + ['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta', false, 'alpha'], + ['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta', false, 'alpha'], + ['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1', false, 'alpha'], + ['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2', false, 'alpha'], + ['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3', false, 'alpha'], + ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'], + ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta', false, 'alpha'], + ['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta', false, 'alpha'], + ['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta', false, 'alpha'], + ['1.2.0', 'prepatch', '1.2.1-dev.0', 'dev'], + ['1.2.0-1', 'prepatch', '1.2.1-dev.0', 'dev'], + ['1.2.0', 'preminor', '1.3.0-dev.0', 'dev'], + ['1.2.3-1', 'preminor', '1.3.0-dev.0', 'dev'], + ['1.2.0', 'premajor', '2.0.0-dev.0', 'dev'], + ['1.2.3-1', 'premajor', '2.0.0-dev.0', 'dev'], + ['1.2.0-1', 'minor', '1.2.0', 'dev'], + ['1.0.0-1', 'major', '1.0.0', 'dev'], + ['1.2.3-dev.bar', 'prerelease', '1.2.3-dev.0', false, 'dev'] + + ].forEach(function(v) { + var pre = v[0]; + var what = v[1]; + var wanted = v[2]; + var loose = v[3]; + var id = v[4]; + var found = inc(pre, what, loose, id); + var cmd = 'inc(' + pre + ', ' + what + ', ' + id + ')'; + t.equal(found, wanted, cmd + ' === ' + wanted); + }); + + t.end(); +}); + +test('\ndiff versions test', function(t) { +// [version1, version2, result] +// diff(version1, version2) -> result + [['1.2.3', '0.2.3', 'major'], + ['1.4.5', '0.2.3', 'major'], + ['1.2.3', '2.0.0-pre', 'premajor'], + ['1.2.3', '1.3.3', 'minor'], + ['1.0.1', '1.1.0-pre', 'preminor'], + ['1.2.3', '1.2.4', 'patch'], + ['1.2.3', '1.2.4-pre', 'prepatch'], + ['0.0.1', '0.0.1-pre', 'prerelease'], + ['0.0.1', '0.0.1-pre-2', 'prerelease'], + ['1.1.0', '1.1.0-pre', 'prerelease'], + ['1.1.0-pre-1', '1.1.0-pre-2', 'prerelease'], + ['1.0.0', '1.0.0', null] + + ].forEach(function(v) { + var version1 = v[0]; + var version2 = v[1]; + var wanted = v[2]; + var found = diff(version1, version2); + var cmd = 'diff(' + version1 + ', ' + version2 + ')'; + t.equal(found, wanted, cmd + ' === ' + wanted); + }); + + t.end(); +}); + +test('\nvalid range test', function(t) { + // [range, result] + // validRange(range) -> result + // translate ranges into their canonical form + [['1.0.0 - 2.0.0', '>=1.0.0 <=2.0.0'], + ['1.0.0', '1.0.0'], + ['>=*', '*'], + ['', '*'], + ['*', '*'], + ['*', '*'], + ['>=1.0.0', '>=1.0.0'], + ['>1.0.0', '>1.0.0'], + ['<=2.0.0', '<=2.0.0'], + ['1', '>=1.0.0 <2.0.0'], + ['<=2.0.0', '<=2.0.0'], + ['<=2.0.0', '<=2.0.0'], + ['<2.0.0', '<2.0.0'], + ['<2.0.0', '<2.0.0'], + ['>= 1.0.0', '>=1.0.0'], + ['>= 1.0.0', '>=1.0.0'], + ['>= 1.0.0', '>=1.0.0'], + ['> 1.0.0', '>1.0.0'], + ['> 1.0.0', '>1.0.0'], + ['<= 2.0.0', '<=2.0.0'], + ['<= 2.0.0', '<=2.0.0'], + ['<= 2.0.0', '<=2.0.0'], + ['< 2.0.0', '<2.0.0'], + ['< 2.0.0', '<2.0.0'], + ['>=0.1.97', '>=0.1.97'], + ['>=0.1.97', '>=0.1.97'], + ['0.1.20 || 1.2.4', '0.1.20||1.2.4'], + ['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'], + ['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'], + ['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'], + ['||', '||'], + ['2.x.x', '>=2.0.0 <3.0.0'], + ['1.2.x', '>=1.2.0 <1.3.0'], + ['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'], + ['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'], + ['x', '*'], + ['2.*.*', '>=2.0.0 <3.0.0'], + ['1.2.*', '>=1.2.0 <1.3.0'], + ['1.2.* || 2.*', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'], + ['*', '*'], + ['2', '>=2.0.0 <3.0.0'], + ['2.3', '>=2.3.0 <2.4.0'], + ['~2.4', '>=2.4.0 <2.5.0'], + ['~2.4', '>=2.4.0 <2.5.0'], + ['~>3.2.1', '>=3.2.1 <3.3.0'], + ['~1', '>=1.0.0 <2.0.0'], + ['~>1', '>=1.0.0 <2.0.0'], + ['~> 1', '>=1.0.0 <2.0.0'], + ['~1.0', '>=1.0.0 <1.1.0'], + ['~ 1.0', '>=1.0.0 <1.1.0'], + ['^0', '>=0.0.0 <1.0.0'], + ['^ 1', '>=1.0.0 <2.0.0'], + ['^0.1', '>=0.1.0 <0.2.0'], + ['^1.0', '>=1.0.0 <2.0.0'], + ['^1.2', '>=1.2.0 <2.0.0'], + ['^0.0.1', '>=0.0.1 <0.0.2'], + ['^0.0.1-beta', '>=0.0.1-beta <0.0.2'], + ['^0.1.2', '>=0.1.2 <0.2.0'], + ['^1.2.3', '>=1.2.3 <2.0.0'], + ['^1.2.3-beta.4', '>=1.2.3-beta.4 <2.0.0'], + ['<1', '<1.0.0'], + ['< 1', '<1.0.0'], + ['>=1', '>=1.0.0'], + ['>= 1', '>=1.0.0'], + ['<1.2', '<1.2.0'], + ['< 1.2', '<1.2.0'], + ['1', '>=1.0.0 <2.0.0'], + ['>01.02.03', '>1.2.3', true], + ['>01.02.03', null], + ['~1.2.3beta', '>=1.2.3-beta <1.3.0', true], + ['~1.2.3beta', null], + ['^ 1.2 ^ 1', '>=1.2.0 <2.0.0 >=1.0.0 <2.0.0'] + ].forEach(function(v) { + var pre = v[0]; + var wanted = v[1]; + var loose = v[2]; + var found = validRange(pre, loose); + + t.equal(found, wanted, 'validRange(' + pre + ') === ' + wanted); + }); + + t.end(); +}); + +test('\ncomparators test', function(t) { + // [range, comparators] + // turn range into a set of individual comparators + [['1.0.0 - 2.0.0', [['>=1.0.0', '<=2.0.0']]], + ['1.0.0', [['1.0.0']]], + ['>=*', [['']]], + ['', [['']]], + ['*', [['']]], + ['*', [['']]], + ['>=1.0.0', [['>=1.0.0']]], + ['>=1.0.0', [['>=1.0.0']]], + ['>=1.0.0', [['>=1.0.0']]], + ['>1.0.0', [['>1.0.0']]], + ['>1.0.0', [['>1.0.0']]], + ['<=2.0.0', [['<=2.0.0']]], + ['1', [['>=1.0.0', '<2.0.0']]], + ['<=2.0.0', [['<=2.0.0']]], + ['<=2.0.0', [['<=2.0.0']]], + ['<2.0.0', [['<2.0.0']]], + ['<2.0.0', [['<2.0.0']]], + ['>= 1.0.0', [['>=1.0.0']]], + ['>= 1.0.0', [['>=1.0.0']]], + ['>= 1.0.0', [['>=1.0.0']]], + ['> 1.0.0', [['>1.0.0']]], + ['> 1.0.0', [['>1.0.0']]], + ['<= 2.0.0', [['<=2.0.0']]], + ['<= 2.0.0', [['<=2.0.0']]], + ['<= 2.0.0', [['<=2.0.0']]], + ['< 2.0.0', [['<2.0.0']]], + ['<\t2.0.0', [['<2.0.0']]], + ['>=0.1.97', [['>=0.1.97']]], + ['>=0.1.97', [['>=0.1.97']]], + ['0.1.20 || 1.2.4', [['0.1.20'], ['1.2.4']]], + ['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]], + ['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]], + ['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]], + ['||', [[''], ['']]], + ['2.x.x', [['>=2.0.0', '<3.0.0']]], + ['1.2.x', [['>=1.2.0', '<1.3.0']]], + ['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], + ['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], + ['x', [['']]], + ['2.*.*', [['>=2.0.0', '<3.0.0']]], + ['1.2.*', [['>=1.2.0', '<1.3.0']]], + ['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], + ['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], + ['*', [['']]], + ['2', [['>=2.0.0', '<3.0.0']]], + ['2.3', [['>=2.3.0', '<2.4.0']]], + ['~2.4', [['>=2.4.0', '<2.5.0']]], + ['~2.4', [['>=2.4.0', '<2.5.0']]], + ['~>3.2.1', [['>=3.2.1', '<3.3.0']]], + ['~1', [['>=1.0.0', '<2.0.0']]], + ['~>1', [['>=1.0.0', '<2.0.0']]], + ['~> 1', [['>=1.0.0', '<2.0.0']]], + ['~1.0', [['>=1.0.0', '<1.1.0']]], + ['~ 1.0', [['>=1.0.0', '<1.1.0']]], + ['~ 1.0.3', [['>=1.0.3', '<1.1.0']]], + ['~> 1.0.3', [['>=1.0.3', '<1.1.0']]], + ['<1', [['<1.0.0']]], + ['< 1', [['<1.0.0']]], + ['>=1', [['>=1.0.0']]], + ['>= 1', [['>=1.0.0']]], + ['<1.2', [['<1.2.0']]], + ['< 1.2', [['<1.2.0']]], + ['1', [['>=1.0.0', '<2.0.0']]], + ['1 2', [['>=1.0.0', '<2.0.0', '>=2.0.0', '<3.0.0']]], + ['1.2 - 3.4.5', [['>=1.2.0', '<=3.4.5']]], + ['1.2.3 - 3.4', [['>=1.2.3', '<3.5.0']]], + ['1.2.3 - 3', [['>=1.2.3', '<4.0.0']]], + ['>*', [['<0.0.0']]], + ['<*', [['<0.0.0']]] + ].forEach(function(v) { + var pre = v[0]; + var wanted = v[1]; + var found = toComparators(v[0]); + var jw = JSON.stringify(wanted); + t.equivalent(found, wanted, 'toComparators(' + pre + ') === ' + jw); + }); + + t.end(); +}); + +test('\ninvalid version numbers', function(t) { + ['1.2.3.4', + 'NOT VALID', + 1.2, + null, + 'Infinity.NaN.Infinity' + ].forEach(function(v) { + t.throws(function() { + new SemVer(v); + }, {name:'TypeError', message:'Invalid Version: ' + v}); + }); + + t.end(); +}); + +test('\nstrict vs loose version numbers', function(t) { + [['=1.2.3', '1.2.3'], + ['01.02.03', '1.2.3'], + ['1.2.3-beta.01', '1.2.3-beta.1'], + [' =1.2.3', '1.2.3'], + ['1.2.3foo', '1.2.3-foo'] + ].forEach(function(v) { + var loose = v[0]; + var strict = v[1]; + t.throws(function() { + new SemVer(loose); + }); + var lv = new SemVer(loose, true); + t.equal(lv.version, strict); + t.ok(eq(loose, strict, true)); + t.throws(function() { + eq(loose, strict); + }); + t.throws(function() { + new SemVer(strict).compare(loose); + }); + }); + t.end(); +}); + +test('\nstrict vs loose ranges', function(t) { + [['>=01.02.03', '>=1.2.3'], + ['~1.02.03beta', '>=1.2.3-beta <1.3.0'] + ].forEach(function(v) { + var loose = v[0]; + var comps = v[1]; + t.throws(function() { + new Range(loose); + }); + t.equal(new Range(loose, true).range, comps); + }); + t.end(); +}); + +test('\nmax satisfying', function(t) { + [[['1.2.3', '1.2.4'], '1.2', '1.2.4'], + [['1.2.4', '1.2.3'], '1.2', '1.2.4'], + [['1.2.3', '1.2.4', '1.2.5', '1.2.6'], '~1.2.3', '1.2.6'], + [['1.1.0', '1.2.0', '1.2.1', '1.3.0', '2.0.0b1', '2.0.0b2', '2.0.0b3', '2.0.0', '2.1.0'], '~2.0.0', '2.0.0', true] + ].forEach(function(v) { + var versions = v[0]; + var range = v[1]; + var expect = v[2]; + var loose = v[3]; + var actual = semver.maxSatisfying(versions, range, loose); + t.equal(actual, expect); + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/ltr.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/ltr.js new file mode 100644 index 00000000..ecd1387d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/ltr.js @@ -0,0 +1,181 @@ +var tap = require('tap'); +var test = tap.test; +var semver = require('../semver.js'); +var ltr = semver.ltr; + +test('\nltr tests', function(t) { + // [range, version, loose] + // Version should be less than range + [ + ['~1.2.2', '1.2.1'], + ['~0.6.1-1', '0.6.1-0'], + ['1.0.0 - 2.0.0', '0.0.1'], + ['1.0.0-beta.2', '1.0.0-beta.1'], + ['1.0.0', '0.0.0'], + ['>=2.0.0', '1.1.1'], + ['>=2.0.0', '1.2.9'], + ['>2.0.0', '2.0.0'], + ['0.1.20 || 1.2.4', '0.1.5'], + ['2.x.x', '1.0.0'], + ['1.2.x', '1.1.0'], + ['1.2.x || 2.x', '1.0.0'], + ['2.*.*', '1.0.1'], + ['1.2.*', '1.1.3'], + ['1.2.* || 2.*', '1.1.9999'], + ['2', '1.0.0'], + ['2.3', '2.2.2'], + ['~2.4', '2.3.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.3.5'], + ['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0 + ['~1', '0.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '0.2.4'], + ['~> 1', '0.2.3'], + ['~1.0', '0.1.2'], // >=1.0.0 <1.1.0 + ['~ 1.0', '0.1.0'], + ['>1.2', '1.2.0'], + ['> 1.2', '1.2.1'], + ['1', '0.0.0beta', true], + ['~v0.5.4-pre', '0.5.4-alpha'], + ['~v0.5.4-pre', '0.5.4-alpha'], + ['=0.7.x', '0.6.0'], + ['=0.7.x', '0.6.0-asdf'], + ['>=0.7.x', '0.6.0'], + ['~1.2.2', '1.2.1'], + ['1.0.0 - 2.0.0', '0.2.3'], + ['1.0.0', '0.0.1'], + ['>=2.0.0', '1.0.0'], + ['>=2.0.0', '1.9999.9999'], + ['>=2.0.0', '1.2.9'], + ['>2.0.0', '2.0.0'], + ['>2.0.0', '1.2.9'], + ['2.x.x', '1.1.3'], + ['1.2.x', '1.1.3'], + ['1.2.x || 2.x', '1.1.3'], + ['2.*.*', '1.1.3'], + ['1.2.*', '1.1.3'], + ['1.2.* || 2.*', '1.1.3'], + ['2', '1.9999.9999'], + ['2.3', '2.2.1'], + ['~2.4', '2.3.0'], // >=2.4.0 <2.5.0 + ['~>3.2.1', '2.3.2'], // >=3.2.1 <3.3.0 + ['~1', '0.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '0.2.3'], + ['~1.0', '0.0.0'], // >=1.0.0 <1.1.0 + ['>1', '1.0.0'], + ['2', '1.0.0beta', true], + ['>1', '1.0.0beta', true], + ['> 1', '1.0.0beta', true], + ['=0.7.x', '0.6.2'], + ['=0.7.x', '0.7.0-asdf'], + ['^1', '1.0.0-0'], + ['>=0.7.x', '0.7.0-asdf'], + ['1', '1.0.0beta', true], + ['>=0.7.x', '0.6.2'] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = 'ltr(' + version + ', ' + range + ', ' + loose + ')'; + t.ok(ltr(version, range, loose), msg); + }); + t.end(); +}); + +test('\nnegative ltr tests', function(t) { + // [range, version, loose] + // Version should NOT be greater than range + [ + ['~ 1.0', '1.1.0'], + ['~0.6.1-1', '0.6.1-1'], + ['1.0.0 - 2.0.0', '1.2.3'], + ['1.0.0 - 2.0.0', '2.9.9'], + ['1.0.0', '1.0.0'], + ['>=*', '0.2.4'], + ['', '1.0.0', true], + ['*', '1.2.3'], + ['*', 'v1.2.3-foo'], + ['>=1.0.0', '1.0.0'], + ['>=1.0.0', '1.0.1'], + ['>=1.0.0', '1.1.0'], + ['>1.0.0', '1.0.1'], + ['>1.0.0', '1.1.0'], + ['<=2.0.0', '2.0.0'], + ['<=2.0.0', '1.9999.9999'], + ['<=2.0.0', '0.2.9'], + ['<2.0.0', '1.9999.9999'], + ['<2.0.0', '0.2.9'], + ['>= 1.0.0', '1.0.0'], + ['>= 1.0.0', '1.0.1'], + ['>= 1.0.0', '1.1.0'], + ['> 1.0.0', '1.0.1'], + ['> 1.0.0', '1.1.0'], + ['<= 2.0.0', '2.0.0'], + ['<= 2.0.0', '1.9999.9999'], + ['<= 2.0.0', '0.2.9'], + ['< 2.0.0', '1.9999.9999'], + ['<\t2.0.0', '0.2.9'], + ['>=0.1.97', 'v0.1.97'], + ['>=0.1.97', '0.1.97'], + ['0.1.20 || 1.2.4', '1.2.4'], + ['0.1.20 || >1.2.4', '1.2.4'], + ['0.1.20 || 1.2.4', '1.2.3'], + ['0.1.20 || 1.2.4', '0.1.20'], + ['>=0.2.3 || <0.0.1', '0.0.0'], + ['>=0.2.3 || <0.0.1', '0.2.3'], + ['>=0.2.3 || <0.0.1', '0.2.4'], + ['||', '1.3.4'], + ['2.x.x', '2.1.3'], + ['1.2.x', '1.2.3'], + ['1.2.x || 2.x', '2.1.3'], + ['1.2.x || 2.x', '1.2.3'], + ['x', '1.2.3'], + ['2.*.*', '2.1.3'], + ['1.2.*', '1.2.3'], + ['1.2.* || 2.*', '2.1.3'], + ['1.2.* || 2.*', '1.2.3'], + ['1.2.* || 2.*', '1.2.3'], + ['*', '1.2.3'], + ['2', '2.1.2'], + ['2.3', '2.3.1'], + ['~2.4', '2.4.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.4.5'], + ['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0 + ['~1', '1.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '1.2.3'], + ['~> 1', '1.2.3'], + ['~1.0', '1.0.2'], // >=1.0.0 <1.1.0 + ['~ 1.0', '1.0.2'], + ['>=1', '1.0.0'], + ['>= 1', '1.0.0'], + ['<1.2', '1.1.1'], + ['< 1.2', '1.1.1'], + ['~v0.5.4-pre', '0.5.5'], + ['~v0.5.4-pre', '0.5.4'], + ['=0.7.x', '0.7.2'], + ['>=0.7.x', '0.7.2'], + ['<=0.7.x', '0.6.2'], + ['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'], + ['>=0.2.3 <=0.2.4', '0.2.4'], + ['1.0.0 - 2.0.0', '2.0.0'], + ['^3.0.0', '4.0.0'], + ['^1.0.0 || ~2.0.1', '2.0.0'], + ['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'], + ['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true], + ['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true], + ['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'], + ['^1.0.0alpha', '1.0.0beta', true], + ['~1.0.0alpha', '1.0.0beta', true], + ['^1.0.0-alpha', '1.0.0beta', true], + ['~1.0.0-alpha', '1.0.0beta', true], + ['^1.0.0-alpha', '1.0.0-beta'], + ['~1.0.0-alpha', '1.0.0-beta'], + ['=0.1.0', '1.0.0'] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = '!ltr(' + version + ', ' + range + ', ' + loose + ')'; + t.notOk(ltr(version, range, loose), msg); + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/major-minor-patch.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/major-minor-patch.js new file mode 100644 index 00000000..e9d4039c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/major-minor-patch.js @@ -0,0 +1,72 @@ +var tap = require('tap'); +var test = tap.test; +var semver = require('../semver.js'); + +test('\nmajor tests', function(t) { + // [range, version] + // Version should be detectable despite extra characters + [ + ['1.2.3', 1], + [' 1.2.3 ', 1], + [' 2.2.3-4 ', 2], + [' 3.2.3-pre ', 3], + ['v5.2.3', 5], + [' v8.2.3 ', 8], + ['\t13.2.3', 13], + ['=21.2.3', 21, true], + ['v=34.2.3', 34, true] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = 'major(' + range + ') = ' + version; + t.equal(semver.major(range, loose), version, msg); + }); + t.end(); +}); + +test('\nminor tests', function(t) { + // [range, version] + // Version should be detectable despite extra characters + [ + ['1.1.3', 1], + [' 1.1.3 ', 1], + [' 1.2.3-4 ', 2], + [' 1.3.3-pre ', 3], + ['v1.5.3', 5], + [' v1.8.3 ', 8], + ['\t1.13.3', 13], + ['=1.21.3', 21, true], + ['v=1.34.3', 34, true] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = 'minor(' + range + ') = ' + version; + t.equal(semver.minor(range, loose), version, msg); + }); + t.end(); +}); + +test('\npatch tests', function(t) { + // [range, version] + // Version should be detectable despite extra characters + [ + ['1.2.1', 1], + [' 1.2.1 ', 1], + [' 1.2.2-4 ', 2], + [' 1.2.3-pre ', 3], + ['v1.2.5', 5], + [' v1.2.8 ', 8], + ['\t1.2.13', 13], + ['=1.2.21', 21, true], + ['v=1.2.34', 34, true] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = 'patch(' + range + ') = ' + version; + t.equal(semver.patch(range, loose), version, msg); + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/no-module.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/no-module.js new file mode 100644 index 00000000..8b50873f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/node_modules/semver/test/no-module.js @@ -0,0 +1,19 @@ +var tap = require('tap'); +var test = tap.test; + +test('no module system', function(t) { + var fs = require('fs'); + var vm = require('vm'); + var head = fs.readFileSync(require.resolve('../head.js.txt'), 'utf8'); + var src = fs.readFileSync(require.resolve('../'), 'utf8'); + var foot = fs.readFileSync(require.resolve('../foot.js.txt'), 'utf8'); + vm.runInThisContext(head + src + foot, 'semver.js'); + + // just some basic poking to see if it did some stuff + t.type(global.semver, 'object'); + t.type(global.semver.SemVer, 'function'); + t.type(global.semver.Range, 'function'); + t.ok(global.semver.satisfies('1.2.3', '1.2')); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/package.json new file mode 100644 index 00000000..52ce3c39 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/package.json @@ -0,0 +1,61 @@ +{ + "name": "rocambole-linebreak", + "version": "1.0.1", + "description": "helpers for rocambole AST line break manipulation", + "main": "rocambole-linebreak.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/rocambole-linebreak.git" + }, + "keywords": [ + "rocambole", + "ast", + "esformatter", + "linebreak" + ], + "author": { + "name": "Miller Medeiros", + "email": "contact@millermedeiros.com", + "url": "http://millermedeiros.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/millermedeiros/rocambole-linebreak/issues" + }, + "homepage": "https://github.com/millermedeiros/rocambole-linebreak", + "jshintConfig": { + "node": true, + "eqnull": true + }, + "dependencies": { + "debug": "^2.1.3", + "rocambole-token": "^1.2.1", + "semver": "^4.3.1" + }, + "gitHead": "cada0e477b747f145a06fdb2f58f4dd1b68f17a9", + "_id": "rocambole-linebreak@1.0.1", + "_shasum": "63f62b110c1108e7184460f9d2bac31b94c5c3c0", + "_from": "rocambole-linebreak@>=1.0.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + } + ], + "dist": { + "shasum": "63f62b110c1108e7184460f9d2bac31b94c5c3c0", + "tarball": "http://registry.npmjs.org/rocambole-linebreak/-/rocambole-linebreak-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/rocambole-linebreak/-/rocambole-linebreak-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/rocambole-linebreak.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/rocambole-linebreak.js new file mode 100644 index 00000000..cd8ac023 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-linebreak/rocambole-linebreak.js @@ -0,0 +1,225 @@ +'use strict'; + +// Line break helpers + +var _tk = require('rocambole-token'); +var debug = require('debug'); +var debugBefore = debug('rocambole:br:before'); +var debugAfter = debug('rocambole:br:after'); +var debugBetween = debug('rocambole:br:between'); + +// yeah, we use semver to parse integers. it's lame but works and will give +// more flexibility while still keeping a format that is easy to read +var semver = require('semver'); + +// fallback in case plugin author forgets to call setOptions +var _curOpts = { + value: '\n' +}; + + +// --- + + +exports.setOptions = setOptions; +function setOptions(opts) { + _curOpts = opts; +} + + +exports.limit = limit; +function limit(token, typeOrValue) { + limitBefore(token, typeOrValue); + limitAfter(token, typeOrValue); +} + + +exports.limitBefore = limitBefore; +function limitBefore(token, typeOrValue) { + var expected = expectedBefore(typeOrValue); + debugBefore( + 'typeOrValue: %s, expected: %s, value: %s', + typeOrValue, expected, token && token.value + ); + if (expected < 0) return; // noop + var start = getStartToken(token); + limitInBetween('before', start, token, expected); +} + + +exports.limitAfter = limitAfter; +function limitAfter(token, typeOrValue) { + var expected = expectedAfter(typeOrValue); + debugAfter( + 'typeOrValue: %s, expected: %s, value: %s', + typeOrValue, expected, token && token.value + ); + if (expected < 0) return; // noop + var end = getEndToken(token); + limitInBetween('after', token, end, expected); +} + +exports.expectedBefore = expectedBefore; +function expectedBefore(typeOrValue) { + return getExpect('before', typeOrValue); +} + +exports.expectedAfter = expectedAfter; +function expectedAfter(typeOrValue) { + return getExpect('after', typeOrValue); +} + + +function getExpect(location, typeOrValue) { + var expected; + + // we allow expected value (number) as 2nd argument or the node type (string) + if (typeof typeOrValue === 'string') { + expected = _curOpts[location][typeOrValue]; + } else { + expected = typeOrValue; + } + + // default is noop, explicit is better than implicit + expected = expected != null ? expected : -1; + + if (typeof expected === 'boolean') { + // if user sets booleans by mistake we simply add one if missing (true) + // or remove all if false + expected = expected ? '>=1' : 0; + } + + if (expected < 0) { + // noop + return expected; + } else if (typeof expected === 'number') { + return String(expected); + } else { + return expected; + } +} + + +function limitInBetween(location, start, end, expected) { + var n = getDiff(start, end, expected); + debugBetween('diff: %d', n); + if (n) { + _tk.removeInBetween(start, end, 'WhiteSpace'); + } + if (n < 0) { + _tk.removeInBetween(start, end, function(token) { + return token.type === 'LineBreak' && n++ < 0 && + !siblingIsComment(location, token); + }); + } else if (n > 0) { + var target = location === 'after' ? start : end; + var insertNextTo = _tk[location]; + while (n-- > 0) { + insertNextTo(target, { + type: 'LineBreak', + value: _curOpts.value + }); + } + } +} + + +function siblingIsComment(location, token) { + var prop = location === 'before' ? 'prev' : 'next'; + return _tk.isComment(token[prop]); +} + + +function getDiff(start, end, expected) { + // start will only be equal to end if it's start or file + if (start === end) return 0; + var count = countBrInBetween(start, end); + // yeah, it's ugly to strings to compare integers but was quickest solution + var vCount = String(count) + '.0.0'; + if (semver.satisfies(vCount, expected)) { + return 0; + } else { + return getSatisfyingMatch(count, vCount, expected) - count; + } +} + + +function getSatisfyingMatch(count, vCount, expected) { + var result; + var diff = semver.gtr(vCount, expected) ? -1 : 1; + count += diff; + while (result == null && count >= 0 && count < 100) { + if (semver.satisfies(String(count) + '.0.0', expected)) { + result = count; + } + count += diff; + } + return parseInt(result, 10); +} + + +function countBrInBetween(start, end) { + var count = 0; + _tk.eachInBetween(start, end, function(token) { + if (_tk.isBr(token)) count++; + }); + return count; +} + + +function getEndToken(token) { + var end = _tk.findNextNonEmpty(token); + if (shouldSkipToken(end)) { + end = _tk.findNextNonEmpty(end); + } + return end ? end : token.root.endToken; +} + + +function shouldSkipToken(token) { + // if comment is at same line we skip it unless it has a specific rule that + // would add line breaks + var result = _tk.isComment(token) && !isOnSeparateLine(token); + return result && getExpect('before', token.type) <= 0; +} + + +function isOnSeparateLine(token) { + return _tk.isBr(token.prev) || ( + _tk.isEmpty(token.prev) && _tk.isBr(token.prev.prev) + ); +} + + +function getStartToken(token) { + var end = _tk.findPrevNonEmpty(token); + return end ? end : token.root.startToken; +} + + +exports.limitBeforeEndOfFile = function(ast, amount) { + var typeOrValue = amount != null ? amount : 'EndOfFile'; + var expected = getExpect('before', typeOrValue); + + if (expected < 0) return; // noop + + var lastNonEmpty = _tk.isEmpty(ast.endToken) ? + _tk.findPrevNonEmpty(ast.endToken) : + ast.endToken; + + if (lastNonEmpty) { + limitInBetween('after', lastNonEmpty, null, expected); + } else { + do { + var br = { + type: 'LineBreak', + value: _curOpts.value + }; + if (ast.startToken) { + _tk.after(ast.startToken, br); + } else { + ast.startToken = ast.endToken = br; + } + } while (--expected); + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-node/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-node/README.md new file mode 100644 index 00000000..3baeab6e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-node/README.md @@ -0,0 +1,17 @@ +# rocambole-node + +Helpers to manipulate and traverse +[rocambole](https://github.com/millermedeiros/rocambole) AST nodes. + + +## Why? + +Created mainly to be used by +[esindent](https://github.com/millermedeiros/esindent/) and +[esformatter](https://github.com/millermedeiros/esformatter/). + + +## License + +Released under the MIT License. + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-node/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-node/index.js new file mode 100644 index 00000000..6b978487 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-node/index.js @@ -0,0 +1,51 @@ +'use strict'; + +// helpers for dealing with the AST itself + + +// --- + + +exports.getNodeKey = getNodeKey; +function getNodeKey(node) { + var result; + if (node.parent) { + for (var key in node.parent) { + if (node.parent[key] === node) { + result = key; + break; + } + } + } + return result; +} + + +exports.getClosest = function(node, type) { + var result; + var parent; + while (parent = node.parent) { + if (parent.type === type) { + result = parent; + break; + } + node = parent; + } + return result; +}; + + + +// this method is useful for debugging the AST/node structure +exports.logTokens = function(node) { + exports.logTokensInBetween(node.startToken, node.endToken); +}; + + +exports.logTokensInBetween = function(startToken, endToken) { + var token = startToken; + while (token && token !== endToken) { + console.log(token.type + ' - "' + String(token.value).replace(/\n/g, '\\n') + '"' + (token.type === 'Indent' ? ' - level: ' + token.level : '')); + token = token.next; + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-node/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-node/package.json new file mode 100644 index 00000000..ad4f356a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-node/package.json @@ -0,0 +1,54 @@ +{ + "name": "rocambole-node", + "version": "1.0.0", + "description": "Helpers to traverse and manipulate rocambole AST nodes", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/rocambole-node.git" + }, + "keywords": [ + "rocambole", + "ast", + "helper", + "node" + ], + "author": { + "name": "Miller Medeiros", + "email": "contact@millermedeiros.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/millermedeiros/rocambole-node/issues" + }, + "homepage": "https://github.com/millermedeiros/rocambole-node", + "jshintConfig": { + "node": true, + "boss": true + }, + "readme": "# rocambole-node\n\nHelpers to manipulate and traverse\n[rocambole](https://github.com/millermedeiros/rocambole) AST nodes.\n\n\n## Why?\n\nCreated mainly to be used by\n[esindent](https://github.com/millermedeiros/esindent/) and\n[esformatter](https://github.com/millermedeiros/esformatter/).\n\n\n## License\n\nReleased under the MIT License.\n\n", + "readmeFilename": "README.md", + "_id": "rocambole-node@1.0.0", + "dist": { + "shasum": "db5b49de7407b0080dd514872f28e393d0f7ff3f", + "tarball": "http://registry.npmjs.org/rocambole-node/-/rocambole-node-1.0.0.tgz" + }, + "_from": "rocambole-node@>=1.0.0 <1.1.0", + "_npmVersion": "1.3.14", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + } + ], + "directories": {}, + "_shasum": "db5b49de7407b0080dd514872f28e393d0f7ff3f", + "_resolved": "https://registry.npmjs.org/rocambole-node/-/rocambole-node-1.0.0.tgz" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/.npmignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/README.md new file mode 100644 index 00000000..c2c03c23 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/README.md @@ -0,0 +1,37 @@ +# rocambole-token + +Helpers to manipulate [rocambole](https://github.com/millermedeiros/rocambole) +AST tokens. + + +## Why? + +Created mainly to be used by +[esindent](https://github.com/millermedeiros/esindent/) and +[esformatter](https://github.com/millermedeiros/esformatter/). + + +## Important Notes + +Right now all methods ignores the `loc` and `range` info of the tokens, this is +*by design* since updating the range and loc info on a large JS program +multiple times can be very expensive. It's *better* to write a separate tool to +*sanitize* this info and that can be executed as a separate step. + +Also important to note that right now rocambole doesn't add any reference on +the token itself to the nodes that contain that token, so if you remove a token +that happens to be the `startToken` or `endToken` of any node you might have +some conflict if you start manipulating the tokens based on the `nodes`, +instead of the `token` LinkedList. - the `node.startToken` might be *detached* +from the LinkedList. + +Test coverage is pretty low so far, but since it was mostly extracted from +esformatter the methods should work as expected. I started to write some tests +just to show how I would do it but did not had the time to finish it... +(ideally tests should be written before the implementation). + + +## License + +Released under the MIT License. + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/find.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/find.js new file mode 100644 index 00000000..956dc061 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/find.js @@ -0,0 +1,76 @@ +"use strict"; + +var makeCheck = require('./makeCheck'); +var isNotEmpty = require('./is').isNotEmpty; + + +// --- + + +exports.findInBetween = findInBetween; +function findInBetween(startToken, endToken, check) { + check = makeCheck(check); + var found; + var last = endToken && endToken.next; + while (startToken && startToken !== last && !found) { + if (check(startToken)) { + found = startToken; + } + startToken = startToken.next; + } + return found; +} + + +exports.findInBetweenFromEnd = findInBetweenFromEnd; +function findInBetweenFromEnd(startToken, endToken, check) { + check = makeCheck(check); + var found; + var last = startToken && startToken.prev; + while (endToken && endToken !== last && !found) { + if (check(endToken)) { + found = endToken; + } + endToken = endToken.prev; + } + return found; +} + + +exports.findNext = findNext; +function findNext(startToken, check) { + check = makeCheck(check); + startToken = startToken && startToken.next; + while (startToken) { + if (check(startToken)) { + return startToken; + } + startToken = startToken.next; + } +} + + +exports.findPrev = findPrev; +function findPrev(endToken, check) { + check = makeCheck(check); + endToken = endToken && endToken.prev; + while (endToken) { + if (check(endToken)) { + return endToken; + } + endToken = endToken.prev; + } +} + + +exports.findNextNonEmpty = findNextNonEmpty; +function findNextNonEmpty(startToken) { + return findNext(startToken, isNotEmpty); +} + + +exports.findPrevNonEmpty = findPrevNonEmpty; +function findPrevNonEmpty(endToken) { + return findPrev(endToken, isNotEmpty); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/index.js new file mode 100644 index 00000000..92413441 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/index.js @@ -0,0 +1,34 @@ +"use strict"; + +// --- + +function mixIn(target, source){ + Object.keys(source).forEach(function(key){ + target[key] = source[key]; + }); + return target; +} + + +// --- + + +exports.eachInBetween = eachInBetween; +function eachInBetween(startToken, endToken, iterator) { + var last = endToken && endToken.next; + while (startToken && startToken !== last) { + iterator(startToken); + startToken = startToken.next; + } +} + + +// --- + +// XXX: ugly but works for now, that way we avoid changing the whole +// esformatter structure. +mixIn(exports, require('./find')); +mixIn(exports, require('./insert')); +mixIn(exports, require('./is')); +mixIn(exports, require('./remove')); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/insert.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/insert.js new file mode 100644 index 00000000..7768007c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/insert.js @@ -0,0 +1,31 @@ +"use strict"; + +exports.before = before; +function before(target, newToken) { + newToken.prev = target.prev; + newToken.next = target; + if (target.prev) { + target.prev.next = newToken; + } else if (target.root) { + target.root.startToken = newToken; + } + target.prev = newToken; + newToken.root = target.root; + return newToken; +} + + +exports.after = after; +function after(target, newToken) { + if (target.next) { + target.next.prev = newToken; + } else if (target.root) { + target.root.endToken = newToken; + } + newToken.prev = target; + newToken.next = target.next; + target.next = newToken; + newToken.root = target.root; + return newToken; +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/is.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/is.js new file mode 100644 index 00000000..68335e57 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/is.js @@ -0,0 +1,63 @@ +"use strict"; + + +// --- + + +exports.isWs = isWs; +function isWs(token) { + return token && token.type === 'WhiteSpace'; +} + + +exports.isBr = isBr; +function isBr(token) { + return token && token.type === 'LineBreak'; +} + + +exports.isEmpty = isEmpty; +function isEmpty(token) { + return token && + (token.type === 'WhiteSpace' || + token.type === 'LineBreak' || + token.type === 'Indent'); +} + + +exports.isNotEmpty = isNotEmpty; +function isNotEmpty(token) { + return !isEmpty(token); +} + + +//XXX: isCode is a bad name, find something better to describe it +exports.isCode = isCode; +function isCode(token) { + return !isEmpty(token) && !isComment(token); +} + + +exports.isSemiColon = isSemiColon; +function isSemiColon(token) { + return token && (token.type === 'Punctuator' && token.value === ';'); +} + + +exports.isComma = isComma; +function isComma(token) { + return token && (token.type === 'Punctuator' && token.value === ','); +} + + +exports.isIndent = isIndent; +function isIndent(token) { + return token && token.type === 'Indent'; +} + + +exports.isComment = isComment; +function isComment(token) { + return token && (token.type === 'LineComment' || token.type === 'BlockComment'); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/makeCheck.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/makeCheck.js new file mode 100644 index 00000000..5f928611 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/makeCheck.js @@ -0,0 +1,28 @@ +"use strict"; + +module.exports = makeCheck; + +function makeCheck(orig) { + if (typeof orig === 'string') { + return makeStringCheck(orig); + } + else if (Array.isArray(orig)) { + return makeArrayCheck(orig); + } + // already a function or invalid value + return orig; +} + + +function makeArrayCheck(arr) { + return function checkTypeAndValueByIndex(token) { + return token && (arr.indexOf(token.type) !== -1 || arr.indexOf(token.value) !== -1); + }; +} + + +function makeStringCheck(str) { + return function checkTypeAndValueByString(token) { + return token && (token.type === str || token.value === str); + }; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/package.json new file mode 100644 index 00000000..ecae9f62 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/package.json @@ -0,0 +1,57 @@ +{ + "name": "rocambole-token", + "version": "1.2.1", + "description": "Helpers for rocambole AST token manipulation", + "main": "./index.js", + "scripts": { + "test": "jasmine-node test/" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/rocambole-token.git" + }, + "keywords": [ + "ast", + "token", + "rocambole" + ], + "author": { + "name": "Miller Medeiros", + "email": "contact@millermedeiros.com", + "url": "http://blog.millermedeiros.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/millermedeiros/rocambole-token/issues" + }, + "homepage": "https://github.com/millermedeiros/rocambole-token", + "devDependencies": { + "rocambole": "~0.2.3", + "jasmine-node": "~1.11.0" + }, + "jshintConfig": { + "node": true + }, + "gitHead": "fc03674b38f288dc545db0a5b2bdfd2d96cab170", + "_id": "rocambole-token@1.2.1", + "_shasum": "c785df7428dc3cb27ad7897047bd5238cc070d35", + "_from": "rocambole-token@>=1.1.2 <2.0.0", + "_npmVersion": "1.4.17", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + } + ], + "dist": { + "shasum": "c785df7428dc3cb27ad7897047bd5238cc070d35", + "tarball": "http://registry.npmjs.org/rocambole-token/-/rocambole-token-1.2.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/rocambole-token/-/rocambole-token-1.2.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/remove.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/remove.js new file mode 100644 index 00000000..bc32add9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/remove.js @@ -0,0 +1,84 @@ +"use strict"; + +var makeCheck = require('./makeCheck'); +var isEmpty = require('./is').isEmpty; + + +// --- + + +exports.remove = remove; +function remove(target) { + if (target.next) { + target.next.prev = target.prev; + } else if (target.root) { + target.root.endToken = target.prev; + } + + if (target.prev) { + target.prev.next = target.next; + } else if (target.root) { + target.root.startToken = target.next; + } +} + + +exports.removeInBetween = removeInBetween; +function removeInBetween(startToken, endToken, check) { + check = makeCheck(check); + var last = endToken && endToken.next; + while (startToken && startToken !== last) { + if (check(startToken)) { + remove(startToken); + } + startToken = startToken.next; + } +} + + +exports.removeAdjacent = removeAdjacent; +function removeAdjacent(token, check) { + removeAdjacentBefore(token, check); + removeAdjacentAfter(token, check); +} + + +exports.removeAdjacentBefore = removeAdjacentBefore; +function removeAdjacentBefore(token, check) { + check = makeCheck(check); + var prev = token.prev; + while (prev && check(prev)) { + remove(prev); + prev = prev.prev; + } +} + + +exports.removeAdjacentAfter = removeAdjacentAfter; +function removeAdjacentAfter(token, check) { + check = makeCheck(check); + var next = token.next; + while (next && check(next)) { + remove(next); + next = next.next; + } +} + + +exports.removeEmptyAdjacentBefore = removeEmptyAdjacentBefore; +function removeEmptyAdjacentBefore(startToken) { + removeAdjacentBefore(startToken, isEmpty); +} + + +exports.removeEmptyAdjacentAfter = removeEmptyAdjacentAfter; +function removeEmptyAdjacentAfter(startToken) { + removeAdjacentAfter(startToken, isEmpty); +} + + +exports.removeEmptyInBetween = removeEmptyInBetween; +function removeEmptyInBetween(startToken, endToken) { + removeInBetween(startToken, endToken, isEmpty); +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/test/find-spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/test/find-spec.js new file mode 100644 index 00000000..b63ffe42 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-token/test/find-spec.js @@ -0,0 +1,76 @@ +/* jshint strict:true */ +/* global describe, it, expect, beforeEach */ +"use strict"; + +// --- + + +var rocambole = require('rocambole'); + +var _find = require('../find'); +var findInBetween = _find.findInBetween; +var findInBetweenFromEnd = _find.findInBetweenFromEnd; + + +// --- + + +describe('find', function () { + + + describe('findInBetween', function () { + + var ast = rocambole.parse('var foo = "bar";\nfunction fn(a, b){\nreturn b? a + b : a * 2;\n}'); + + it('should return first token inside range by value', function () { + var tk = findInBetween(ast.startToken, ast.endToken, 'a'); + expect( tk.type ).toBe( 'Identifier' ); + expect( tk.value ).toBe( 'a' ); + expect( tk.prev.value ).toBe( '(' ); + }); + + it('should return first token inside range by Type', function () { + var tk = findInBetween(ast.startToken, ast.endToken, 'Punctuator'); + expect( tk.value ).toBe( '=' ); + }); + + it('should return first token that passes truth test', function () { + var tk = findInBetween(ast.startToken, ast.endToken, function(val){ + return val.type === 'Punctuator' && val.prev.prev.value !== 'foo'; + }); + expect( tk.value ).toBe(';'); + }); + + it('shold return first token that matches any array items values', function () { + var tk = findInBetween(ast.startToken, ast.endToken, ['?', 'return']); + expect( tk.type ).toBe( 'Keyword' ); + }); + + it('shold return first token that matches any array items types', function () { + var tk = findInBetween(ast.startToken, ast.endToken, ['Keyword', 'Identifier']); + expect( tk.value ).toBe( 'var' ); + }); + + }); + + + describe('findInBetweenFromEnd', function () { + + var ast = rocambole.parse('var foo = "bar";\nfunction fn(a, b){\nreturn b? a + b : a * 2;\n}'); + + it('should return first match from end by "type"', function () { + var tk = findInBetweenFromEnd(ast.startToken, ast.endToken, 'Keyword'); + expect( tk.value ).toBe( 'return' ); + }); + + it('should return first match from end by "value"', function () { + var tk = findInBetweenFromEnd(ast.startToken, ast.endToken, 'a'); + expect( tk.prev.prev.value ).toBe( ':' ); + }); + + + }); + + +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/.npmignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/LICENSE.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/LICENSE.md new file mode 100644 index 00000000..5987e55a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Miller Medeiros + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/README.md new file mode 100644 index 00000000..f2225810 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/README.md @@ -0,0 +1,115 @@ +# rocambole-whitespace + +Helpers to manipulate [rocambole](https://github.com/millermedeiros/rocambole) +`WhiteSpace` tokens. + +Used mainly by [esformatter](https://github.com/millermedeiros/esformatter/) and its plugins. + + +## API + +```js +var ws = require('rocambole-whitespace'); +``` + +### setOptions(opts) + +`setOptions` is just a way to store some constants so later on the +`limit`/`limitBefore`/`limitAfter` you can reference the values by Id. + +```js +setOptions({ + // sets "value" used by `WhiteSpace` tokens (defaults to single space) + value: ' ', + + // values inside "before" are used by `limitBefore` + before: { + // setting to `0` will remove all spaces before the token + parenthesis: 0 + }, + + // values inside "after" are used by `limitAfter` + after: { + // setting to `1` will add/keep a single `WhiteSpace` after the token + parenthesis: 1 + } +}); +``` + +**Important:** calling this method will override **all** the options. + +### limitBefore(token, typeOrValue) + +limits the amount of `WhiteSpace` before a given token. + +```js +// remove all white spaces before `node.startToken` +limitBefore(node.startToken, 0); +// add/keep 2 white spaces before `node.startToken` +limitBefore(node.startToken, 2); +// will use value stored on `setOptions` for `before.parenthesis` +limitBefore(node.startToken, 'parenthesis'); +// values smaller than zero are ignored (this won't change anything) +limitBefore(node.startToken, -1); +``` + +### limitAfter(token, typeOrValue) + +limits the amount of `WhiteSpace` after a given token. + +```js +// remove all white spaces after `node.startToken` +limitAfter(node.startToken, 0); +// add/keep 1 white space after `node.startToken` +limitAfter(node.startToken, 1); +// will use value stored on `setOptions` for `after.parenthesis` +limitAfter(node.startToken, 'parenthesis'); +// values smaller than zero are ignored (this won't change anything) +limitAfter(node.startToken, -1); +``` + +### limit(token, typeOrvalue) + +limits the amount of `WhiteSpace` around a given token. + +```js +// add/keep 1 white space before and after `node.startToken` +limit(node.startToken, 1); + +// it's just an alias to +limitBefore(node.startToken, 1); +limitAfter(node.startToken, 1); +``` + +### expectedBefore(type) + +reads value stored during `setOptions` for a given `type`, or returns `-1` if +not found. + +```js +assert( expectedBefore('parenthesis') === 0 ); +``` + +### expectedAfter(type) + +reads value stored during `setOptions` for a given `type`, or returns `-1` if +not found. + +```js +assert( expectedAfter('parenthesis') === 1 ); +``` + +## Debug + +This module uses [debug](https://www.npmjs.com/package/debug) internally. To +make it easier to identify what is wrong we sometimes run the esformatter tests +with a `DEBUG` flag, like: + +```sh +DEBUG=rocambole:ws:* npm test +``` + +## License + +Released under the MIT License + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/.jshintrc b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/.jshintrc new file mode 100644 index 00000000..299877f2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/.jshintrc @@ -0,0 +1,3 @@ +{ + "laxbreak": true +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/.npmignore new file mode 100644 index 00000000..7e6163db --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/.npmignore @@ -0,0 +1,6 @@ +support +test +examples +example +*.sock +dist diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/History.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/History.md new file mode 100644 index 00000000..854c9711 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/History.md @@ -0,0 +1,195 @@ + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/Makefile b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/Makefile new file mode 100644 index 00000000..5cf4a596 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/Makefile @@ -0,0 +1,36 @@ + +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# applications +NODE ?= $(shell which node) +NPM ?= $(NODE) $(shell which npm) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +all: dist/debug.js + +install: node_modules + +clean: + @rm -rf dist + +dist: + @mkdir -p $@ + +dist/debug.js: node_modules browser.js debug.js dist + @$(BROWSERIFY) \ + --standalone debug \ + . > $@ + +distclean: clean + @rm -rf node_modules + +node_modules: package.json + @NODE_ENV= $(NPM) install + @touch node_modules + +.PHONY: all install clean distclean diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/Readme.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/Readme.md new file mode 100644 index 00000000..b4f45e3c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/Readme.md @@ -0,0 +1,188 @@ +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +#### Windows note + + On Windows the environment variable is set using the `set` command. + + ```cmd + set DEBUG=*,-not_this + ``` + +Then, run the program to be debugged as usual. + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: + +```js +window.myDebug = require("debug"); +``` + + ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: + +```js +myDebug.enable("worker:*") +``` + + Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +#### Web Inspector Colors + + Colors are also enabled on "Web Inspectors" that understand the `%c` formatting + option. These are WebKit web inspectors, Firefox ([since version + 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) + and the Firebug plugin for Firefox (any version). + + Colored output looks something like: + + ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) + +### stderr vs stdout + +You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: + +Example _stdout.js_: + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +### Save debug output to a file + +You can save all debug statements to a file by piping them. + +Example: + +```bash +$ DEBUG_FD=3 node your-app.js 3> whatever.log +``` + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + +## License + +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/bower.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/bower.json new file mode 100644 index 00000000..6af573ff --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/bower.json @@ -0,0 +1,28 @@ +{ + "name": "visionmedia-debug", + "main": "dist/debug.js", + "version": "2.2.0", + "homepage": "https://github.com/visionmedia/debug", + "authors": [ + "TJ Holowaychuk " + ], + "description": "visionmedia-debug", + "moduleType": [ + "amd", + "es6", + "globals", + "node" + ], + "keywords": [ + "visionmedia", + "debug" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/browser.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/browser.js new file mode 100644 index 00000000..7c764522 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/browser.js @@ -0,0 +1,168 @@ + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + return JSON.stringify(v); +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/component.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/component.json new file mode 100644 index 00000000..ca106372 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "2.2.0", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/debug.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/debug.js new file mode 100644 index 00000000..7571a860 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/debug.js @@ -0,0 +1,197 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() { + } + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node.js new file mode 100644 index 00000000..1d392a81 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node.js @@ -0,0 +1,209 @@ + +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); + if (0 === debugColors.length) { + return tty.isatty(fd); + } else { + return '0' !== debugColors + && 'no' !== debugColors + && 'false' !== debugColors + && 'disabled' !== debugColors; + } +} + +/** + * Map %o to `util.inspect()`, since Node doesn't do that out of the box. + */ + +var inspect = (4 === util.inspect.length ? + // node <= 0.8.x + function (v, colors) { + return util.inspect(v, void 0, void 0, colors); + } : + // node > 0.8.x + function (v, colors) { + return util.inspect(v, { colors: colors }); + } +); + +exports.formatters.o = function(v) { + return inspect(v, this.useColors) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + var name = this.namespace; + + if (useColors) { + var c = this.color; + + args[0] = ' \u001b[3' + c + ';1m' + name + ' ' + + '\u001b[0m' + + args[0] + '\u001b[3' + c + 'm' + + ' +' + exports.humanize(this.diff) + '\u001b[0m'; + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } + return args; +} + +/** + * Invokes `console.error()` with the specified arguments. + */ + +function log() { + return stream.write(util.format.apply(this, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = require('fs'); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = require('net'); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/.npmignore new file mode 100644 index 00000000..d1aa0ce4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/.npmignore @@ -0,0 +1,5 @@ +node_modules +test +History.md +Makefile +component.json diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/History.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/History.md new file mode 100644 index 00000000..32fdfc17 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/History.md @@ -0,0 +1,66 @@ + +0.7.1 / 2015-04-20 +================== + + * prevent extraordinary long inputs (@evilpacket) + * Fixed broken readme link + +0.7.0 / 2014-11-24 +================== + + * add time abbreviations, updated tests and readme for the new units + * fix example in the readme. + * add LICENSE file + +0.6.2 / 2013-12-05 +================== + + * Adding repository section to package.json to suppress warning from NPM. + +0.6.1 / 2013-05-10 +================== + + * fix singularization [visionmedia] + +0.6.0 / 2013-03-15 +================== + + * fix minutes + +0.5.1 / 2013-02-24 +================== + + * add component namespace + +0.5.0 / 2012-11-09 +================== + + * add short formatting as default and .long option + * add .license property to component.json + * add version to component.json + +0.4.0 / 2012-10-22 +================== + + * add rounding to fix crazy decimals + +0.3.0 / 2012-09-07 +================== + + * fix `ms()` [visionmedia] + +0.2.0 / 2012-09-03 +================== + + * add component.json [visionmedia] + * add days support [visionmedia] + * add hours support [visionmedia] + * add minutes support [visionmedia] + * add seconds support [visionmedia] + * add ms string support [visionmedia] + * refactor tests to facilitate ms(number) [visionmedia] + +0.1.0 / 2012-03-07 +================== + + * Initial release diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/LICENSE new file mode 100644 index 00000000..6c07561b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/README.md new file mode 100644 index 00000000..9b4fd035 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/README.md @@ -0,0 +1,35 @@ +# ms.js: miliseconds conversion utility + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('100') // 100 +``` + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as +a number (e.g: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of +equivalent ms is returned. + +## License + +MIT diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/index.js new file mode 100644 index 00000000..4f927716 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/index.js @@ -0,0 +1,125 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/package.json new file mode 100644 index 00000000..253335e6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/node_modules/ms/package.json @@ -0,0 +1,48 @@ +{ + "name": "ms", + "version": "0.7.1", + "description": "Tiny ms conversion utility", + "repository": { + "type": "git", + "url": "git://github.com/guille/ms.js.git" + }, + "main": "./index", + "devDependencies": { + "mocha": "*", + "expect.js": "*", + "serve": "*" + }, + "component": { + "scripts": { + "ms/index.js": "index.js" + } + }, + "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", + "bugs": { + "url": "https://github.com/guille/ms.js/issues" + }, + "homepage": "https://github.com/guille/ms.js", + "_id": "ms@0.7.1", + "scripts": {}, + "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "_from": "ms@0.7.1", + "_npmVersion": "2.7.5", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "dist": { + "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/package.json new file mode 100644 index 00000000..08b1116a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/debug/package.json @@ -0,0 +1,73 @@ +{ + "name": "debug", + "version": "2.2.0", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + } + ], + "license": "MIT", + "dependencies": { + "ms": "0.7.1" + }, + "devDependencies": { + "browserify": "9.0.3", + "mocha": "*" + }, + "main": "./node.js", + "browser": "./browser.js", + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" + } + }, + "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@2.2.0", + "scripts": {}, + "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "_from": "debug@>=2.1.3 <3.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "tarball": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/LICENSE new file mode 100644 index 00000000..5a9956a7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/LICENSE @@ -0,0 +1,24 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, Jon Schlinkert. + +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/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/README.md new file mode 100644 index 00000000..cee7d174 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/README.md @@ -0,0 +1,94 @@ +# repeat-string [![NPM version](https://badge.fury.io/js/repeat-string.svg)](http://badge.fury.io/js/repeat-string) [![Build Status](https://travis-ci.org/jonschlinkert/repeat-string.svg)](https://travis-ci.org/jonschlinkert/repeat-string) + +> Repeat the given string n times. Fastest implementation for repeating a string. + +## Install with [npm](npmjs.org) + +```bash +npm i repeat-string --save +``` +## Install with [bower](https://github.com/bower/bower) + +```bash +bower install repeat-string --save +``` + +## Usage + +### [repeat](./index.js#L34) + +Repeat the given `string` the specified `number` of times. + +* `string` **{String}**: The string to repeat +* `number` **{Number}**: The number of times to repeat the string +* `returns` **{String}**: Repeated string + +**Example:** + +```js +var repeat = require('repeat-string'); +repeat('A', 5); +//=> AAAAA +``` + +## Benchmarks + +Repeat string is significantly faster than [repeating](https://github.com/sindresorhus/repeating). + +```bash +# 20,000x + repeat-string.js x 16,634,213 ops/sec ±0.92% (93 runs sampled) + repeating.js x 5,883,928 ops/sec ±0.95% (93 runs sampled) + +# 2,000x + repeat-string.js x 17,438,654 ops/sec ±0.76% (97 runs sampled) + repeating.js x 6,639,978 ops/sec ±0.84% (97 runs sampled) + +# 250x + repeat-string.js x 16,246,885 ops/sec ±0.81% (92 runs sampled) + repeating.js x 7,659,342 ops/sec ±0.67% (99 runs sampled) + +# 50x + repeat-string.js x 15,803,340 ops/sec ±0.74% (92 runs sampled) + repeating.js x 9,668,300 ops/sec ±0.89% (98 runs sampled) + +# 5x + repeat-string.js x 16,926,291 ops/sec ±0.78% (97 runs sampled) + repeating.js x 12,215,384 ops/sec ±1.01% (96 runs sampled) +``` + +**Run the benchmarks** + +Install dev dependencies: + +```bash +npm i -d && node benchmark +``` + +### Other javascript/node.js utils +[repeat-element](https://github.com/jonschlinkert/repeat-element): Create an array by repeating the given string n times. + +## Contributing +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/repeat-string/issues) + +## Running tests +Install dev dependencies: + +```bash +npm i -d && npm test +``` + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License +Copyright (c) 2015 Jon Schlinkert +Released under the MIT license + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 01, 2015._ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/index.js new file mode 100644 index 00000000..c781229b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/index.js @@ -0,0 +1,66 @@ +/*! + * repeat-string + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +/** + * Expose `repeat` + */ + +module.exports = repeat; + +/** + * Repeat the given `string` the specified `number` + * of times. + * + * **Example:** + * + * ```js + * var repeat = require('repeat-string'); + * repeat('A', 5); + * //=> AAAAA + * ``` + * + * @param {String} `string` The string to repeat + * @param {Number} `number` The number of times to repeat the string + * @return {String} Repeated string + * @api public + */ + +function repeat(str, num) { + if (typeof str !== 'string') { + throw new TypeError('repeat-string expects a string.'); + } + + if (num === 1) return str; + if (num === 2) return str + str; + + var max = str.length * num; + if (cache !== str || typeof cache === 'undefined') { + cache = str; + res = ''; + } + + while (max > res.length && num > 0) { + if (num & 1) { + res += str; + } + + num >>= 1; + if (!num) break; + str += str; + } + + return res.substr(0, max); +} + +/** + * Results cache + */ + +var res = ''; +var cache; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/package.json new file mode 100644 index 00000000..17c77b10 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/node_modules/repeat-string/package.json @@ -0,0 +1,79 @@ +{ + "name": "repeat-string", + "description": "Repeat the given string n times. Fastest implementation for repeating a string.", + "version": "1.5.2", + "homepage": "https://github.com/jonschlinkert/repeat-string", + "author": { + "name": "Jon Schlinkert", + "url": "http://github.com/jonschlinkert/" + }, + "repository": { + "type": "git", + "url": "git://github.com/jonschlinkert/repeat-string.git" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/repeat-string/issues" + }, + "license": { + "type": "MIT", + "url": "https://github.com/jonschlinkert/repeat-string/blob/master/LICENSE" + }, + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "benchmarked": "^0.1.3", + "chalk": "^0.5.1", + "glob": "^4.3.5", + "mocha": "^2.2.1", + "repeating": "^1.1.1", + "should": "^4.0.4" + }, + "keywords": [ + "fast", + "fastest", + "fill", + "left", + "left-pad", + "multiple", + "pad", + "padding", + "repetition", + "repeat", + "repeating", + "right", + "right-pad", + "string", + "times" + ], + "gitHead": "bf20e5dc1414305bec6ff26d90988378a5bad6ec", + "_id": "repeat-string@1.5.2", + "_shasum": "21065f70727ad053a0dd5e957ac9e00c7560d90a", + "_from": "repeat-string@>=1.5.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "jonschlinkert", + "email": "github@sellside.com" + }, + "maintainers": [ + { + "name": "jonschlinkert", + "email": "github@sellside.com" + } + ], + "dist": { + "shasum": "21065f70727ad053a0dd5e957ac9e00c7560d90a", + "tarball": "http://registry.npmjs.org/repeat-string/-/repeat-string-1.5.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.5.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/package.json new file mode 100644 index 00000000..0855fed6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/package.json @@ -0,0 +1,61 @@ +{ + "name": "rocambole-whitespace", + "version": "1.0.0", + "description": "helpers for rocambole AST whitespace manipulation", + "main": "rocambole-whitespace.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/rocambole-whitespace.git" + }, + "keywords": [ + "esformatter", + "rocambole", + "whitespace", + "ast" + ], + "author": { + "name": "Miller Medeiros", + "email": "contact@millermedeiros.com", + "url": "http://millermedeiros.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/millermedeiros/rocambole-whitespace/issues" + }, + "homepage": "https://github.com/millermedeiros/rocambole-whitespace", + "dependencies": { + "debug": "^2.1.3", + "repeat-string": "^1.5.0", + "rocambole-token": "^1.2.1" + }, + "jshintConfig": { + "node": true, + "eqnull": true + }, + "gitHead": "3b8a6638b10e417f4844cf78f29903eac0a10841", + "_id": "rocambole-whitespace@1.0.0", + "_shasum": "63330949256b29941f59b190459f999c6b1d3bf9", + "_from": "rocambole-whitespace@>=1.0.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + } + ], + "dist": { + "shasum": "63330949256b29941f59b190459f999c6b1d3bf9", + "tarball": "http://registry.npmjs.org/rocambole-whitespace/-/rocambole-whitespace-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/rocambole-whitespace/-/rocambole-whitespace-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/rocambole-whitespace.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/rocambole-whitespace.js new file mode 100644 index 00000000..03c85dd1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole-whitespace/rocambole-whitespace.js @@ -0,0 +1,107 @@ +'use strict'; + +// white space helpers + +var _tk = require('rocambole-token'); +var repeat = require('repeat-string'); +var debug = require('debug'); +var debugBefore = debug('rocambole:ws:before'); +var debugAfter = debug('rocambole:ws:after'); + +// fallback in case plugin author forgets to call setOptions +var _curOpts = { + value: ' ', + before: {}, + after: {} +}; + + +// --- + + +exports.setOptions = setOptions; +function setOptions(opts) { + _curOpts = opts; +} + + +// -- + + +exports.limit = limit; +function limit(token, typeOrValue) { + limitBefore(token, typeOrValue); + limitAfter(token, typeOrValue); +} + + +exports.limitBefore = limitBefore; +function limitBefore(token, typeOrValue) { + var amount = expectedBefore(typeOrValue); + debugBefore( + 'typeOrValue: %s, amount: %s, token: %s', + typeOrValue, amount, token.value + ); + if (amount < 0) return; // noop + update('before', token, amount); +} + + +exports.limitAfter = limitAfter; +function limitAfter(token, typeOrValue) { + var amount = expectedAfter(typeOrValue); + debugAfter( + 'typeOrValue: %s, amount: %s, token: %s', + typeOrValue, amount, token.value + ); + if (amount < 0) return; // noop + update('after', token, amount); +} + + +exports.expectedAfter = expectedAfter; +function expectedAfter(typeOrValue) { + return getAmount('after', typeOrValue); +} + + +exports.expectedBefore = expectedBefore; +function expectedBefore(typeOrValue) { + return getAmount('before', typeOrValue); +} + + +function getAmount(position, typeOrValue) { + if (typeof typeOrValue === 'number') { + return typeOrValue; + } + var amount = _curOpts[position][typeOrValue]; + return amount == null ? -1 : amount; +} + + +function update(position, target, amount) { + var adjacent = position === 'before' ? target.prev : target.next; + var adjacentIsWs = _tk.isWs(adjacent); + + if (!adjacent || _tk.isBr(adjacent)) return; + + if (amount === 0 && adjacentIsWs) { + _tk.remove(adjacent); + return; + } + + var ws; + if (adjacentIsWs) { + ws = adjacent; + } else { + ws = { + type: 'WhiteSpace' + }; + } + ws.value = repeat(_curOpts.value || ' ', amount); + + if (!adjacentIsWs) { + _tk[position](target, ws); + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/.jshintrc b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/.jshintrc new file mode 100644 index 00000000..ea218f5e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/.jshintrc @@ -0,0 +1,61 @@ +{ + // Settings + "passfail" : false, // Stop on first error. + "maxerr" : 500, // Maximum error before stopping. + + + // Predefined globals whom JSHint will ignore. + "browser" : false, // Standard browser globals e.g. `window`, `document`. + "node" : true, + + + // Custom globals. + "predef" : [], + + + // Development. + "debug" : false, // Allow debugger statements e.g. browser breakpoints. + "devel" : false, // Allow developments statements e.g. `console.log();`. + + + // EcmaScript 5. + "es5" : false, // Allow EcmaScript 5 syntax. + "globalstrict" : true, // Allow global "use strict" (also enables 'strict'). + "strict" : true, // Require `use strict` pragma in every file. + + + // The Good Parts. + "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons). + "bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.). + "boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. + "curly" : false, // Require {} for every new block or scope. + "eqeqeq" : false, // Require triple equals i.e. `===`. + "eqnull" : true, // Tolerate use of `== null`. + "evil" : false, // Tolerate use of `eval`. + "expr" : false, // Tolerate `ExpressionStatement` as Programs. + "forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`. + "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` + "latedef" : false, // Prohibit variable use before definition. + "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. + "loopfunc" : false, // Allow functions to be defined within loops. + "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. + "regexdash" : true, // Tolerate unescaped last dash i.e. `[-...]`. + "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions. + "scripturl" : false, // Tolerate script-targeted URLs. + "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. + "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. + "undef" : true, // Require all non-global variables be declared before they are used. + "unused" : true, // Check for unused vars + + + // Personal styling prefrences. + "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. + "noempty" : true, // Prohipit use of empty blocks. + "nomen" : false, // Prohibit use of initial or trailing underbars in names. + "nonew" : true, // Prohibit use of constructors for side-effects. + "onevar" : false, // Allow only one `var` statement per function. + "plusplus" : false, // Prohibit use of `++` & `--`. + "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. + "trailing" : true, // Prohibit trailing whitespaces. + "white" : false // Check against strict whitespace and indentation rules. +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/.npmignore new file mode 100644 index 00000000..8002c5f2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/.npmignore @@ -0,0 +1,15 @@ +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +Icon? +ehthumbs.db +Thumbs.db + +### + +node_modules/ +npm-debug.log +coverage/ + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/.travis.yml new file mode 100644 index 00000000..836418eb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/.travis.yml @@ -0,0 +1,5 @@ + language: node_js + node_js: 0.10 + script: + - "npm test --coverage" + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/CHANGELOG.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/CHANGELOG.md new file mode 100644 index 00000000..9a69da9b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/CHANGELOG.md @@ -0,0 +1,84 @@ +# Changelog + +## v0.6.0 (2015/03/30) + + - allow custom parser. (#27) + +## v0.5.1 (2015/03/19) + + - make it compatible with esprima@2.1 (don't loop through the same CatchClause + twice). + +## v0.5.0 (2015/02/25) + + - updated `esprima` to v2.0 because of ES6 features and to avoid `esprima-fb` + bug related to RegExp. + +## v0.4.0 (2014/07/14) + + - aliased `rocambole.recursive` as `rocambole.walk` to avoid confusions. + - switched `esprima` dependency to `esprima-fb` because of ES6 features. + +## v0.3.6 (2014/06/23) + + - really handle sparse arrays (eg. `[,]`), fixes moonwalk. (#15) + +## v0.3.5 (2014/06/23) + + - handle sparse arrays (eg. `[,]`). (#15) + +## v0.3.4 (2014/06/23) + + - only add `BlockComment.originalIndent` if `WhiteSpace` is on the start of + a line. + +## v0.3.3 (2014/04/26) + + - add `toString` to empty programs AST (#16) + +## v0.3.2 (2014/01/17) + + - exports `BYPASS_RECURSION` (#8) + - fix error if input is empty (#12) + - support anything that implements `toString()` as input (#13) + +## v0.3.1 (2013/12/15) + + - fix `originalIndent` on `BlockComment` when prev token is not `WhiteSpace`. + +## v0.3.0 (2013/12/15) + + - add `originalIndent` to `BlockComment` (#11) + +## v0.2.3 (2013/01/08) + + - improve `rocambole.parse()` performance by 4500%. (#4) + - improve `rocambole.moonwalk()` performance by 11000%. + +## v0.2.2 (2012/12/19) + + - fix consecutive comments before start of program. (#3) + +## v0.2.1 (2012/12/13) + + - fix `loc` info on `WhiteSpace` and `LineBreak` tokens. (#2) + +## v0.2.0 (2012/12/09) + + - Deprecated: + - `token.before()` + - `token.after()` + - `token.remove()` + - `node.getTokens()` + - `ast.nodes` + - avoid recursion over comments. + - fix weird bug on esformatter introduced on v0.1.1 related to `token._ast` + property. + +## v0.1.1 (2012/12/08) + + - Improve token manipulation methods behavior (`before`, `after`, `remove`) + +## v0.1.0 (2012/12/06) + + - Initial release diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/README.md new file mode 100644 index 00000000..07884c0c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/README.md @@ -0,0 +1,269 @@ +# Rocambole [![Build Status](https://secure.travis-ci.org/millermedeiros/rocambole.svg?branch=master)](https://travis-ci.org/millermedeiros/rocambole) + +![rocambole](https://raw.github.com/millermedeiros/rocambole/master/rocambole.jpg) + +Recursively walk and add extra information/helpers to [Esprima / Mozilla +SpiderMonkey Parser API](http://esprima.org/doc/index.html#ast) compatible AST. + +The main difference between other tools is that it also keeps information about +tokens and white spaces and it is meant to be used to transform the tokens and +not the string values itself. + +This library is specially useful for non-destructive AST manipulation. + + +## Inspiration + +This module was heavily inspired by +[node-falafel](https://github.com/substack/node-falafel) and +[node-burrito](https://github.com/substack/node-burrito) but I needed more +information than what is currently available on falafel (specially about +tokens, empty lines and white spaces) and also needed to do the node traversing +on the opposite order (start from leaf nodes). The amount of changes required +to introduce the new features and the differences on the concept behind the +tool justified a new project. + +It was created mainly to be used on +[esformatter](https://github.com/millermedeiros/esformatter/). + + + +## Extra Tokens + +Besides all the regular tokens returned by `esprima` we also add a few more +that are important for non-destructive transformations: + + * `WhiteSpace` + - Can store multiple white spaces (tabs are considered white space, line + breaks not). Important if you want to do non-destructive replacements that + are white-space sensitive. + - Multiple subsequent white spaces are treated as a single token. + * `LineBreak` + * `LineComment` + * `BlockComment` + +It's way easier to rebuild the JS string if the tokens already have line breaks +and comments. It's also easier to identify if previous/next/current token is a +LineBreak or Comment (sometimes needed for non-destructive transformations). + +Rocambole structure might change in the future to keep the extraneous tokens +outside the `tokens` array and also add an option to toggle the behavior. +([issue #7](https://github.com/millermedeiros/rocambole/issues/7)) + + +## Extra Properties + +Each Node have the following extra properties/methods: + + - `parent` : Node|undefined + - `toString()` : string + - `next` : Node|undefined + - `prev` : Node|undefined + - `depth` : Number + - `startToken` : Token + - `endToken` : Token + +Each token also have: + + - `prev` : Token|undefined + - `next` : Token|undefined + +BlockComment also have: + + - `originalIndent`: String|undefined + +To get a better idea of the generated AST structure try out +[rocambole-visualize](http://piuccio.github.io/rocambole-visualize/). + + +## Linked List + +You should **treat the tokens as a linked list instead of reading the +`ast.tokens` array** (inserting/removing items from a linked list is very cheap +and won't break the loop). You should grab a reference to the `node.startToken` +and get `token.next` until you find the desired token or reach the end of the +program. To loop between all tokens inside a node you can do like this: + +```js +var token = node.startToken; +while (token !== node.endToken.next) { + doStuffWithToken(token); + token = token.next; +} +``` + +The method `toString` loops through all tokens between `node.startToken` and +`node.endToken` grabbing the `token.raw` (used by comments) or `token.value` +properties. To implement a method similar to falafel `update()` you can do +this: + +```js +function update(node, str){ + var newToken = { + type : 'Custom', // can be anything (not used internally) + value : str + }; + // update linked list references + if ( node.startToken.prev ) { + node.startToken.prev.next = newToken; + newToken.prev = node.startToken.prev; + } + if ( node.endToken.next ) { + node.endToken.next.prev = newToken; + newToken.next = node.endToken.next; + } + node.startToken = node.endToken = newToken; +} +``` + + +## Helpers + +I plan to create helpers as separate projects when possible. + + - [rocambole-token](https://github.com/millermedeiros/rocambole-token): helpers for token manipulation/traversal + - [rocambole-node](https://github.com/millermedeiros/rocambole-node): helpers for node manipulation/traversal + - [rocambole-whitespace](https://github.com/millermedeiros/rocambole-whitespace): helpers for whitespace manipulation + - [rocambole-linebreak](https://github.com/millermedeiros/rocambole-linebreak): helpers for line break manipulation + - [rocambole-indent](https://github.com/millermedeiros/rocambole-indent): helpers for indentation + + +## API + + +### rocambole.parse(source, [opts]) + +Parses a string and instrument the AST with extra properties/methods. + +```js +var rocambole = require('rocambole'); +var ast = rocambole.parse(string); +console.log( ast.startToken ); +// to get a string representation of all tokens call toString() +console.log( ast.toString() ); +``` + +You can pass custom options as the second argument: + +```js +rocambole.parse(source, { + loc: true, + // custom options are forwarded to the rocambole.parseFn + ecmaFeatures: { + arrowFunctions: true + } +}); +``` + +**IMPORTANT:** rocambole needs the `range`, `tokens` and `comment` info to +build the token linked list, so these options will always be set to `true`. + +### rocambole.parseFn:Function + +Allows you to override the function used to parse the program. Defaults to +`esprima.parse`. + +```js +// espree is compatible with esprima AST so things should work as expected +var espree = require('espree'); +rocambole.parseFn = espree.parse; +rocambole.parseContext = espree; +``` + +### rocambole.parseContext:Object + +Sets the context (`this` value) of the `parseFn`. Defaults to `esprima`. + +### rocambole.parseOptions:Object + +Sets the default options passed to `parseFn`. + +```js +// default values +rocambole.parseOptions = { + // we need range/tokens/comment info to build the tokens linked list! + range: true, + tokens: true, + comment: true +}; +``` + +### rocambole.moonwalk(ast, callback) + +The `moonwalk()` starts at the leaf nodes and go down the tree until it reaches +the root node (`Program`). Each node will be traversed only once. + +```js +rocambole.moonwalk(ast, function(node){ + if (node.type == 'ArrayExpression'){ + console.log( node.depth +': '+ node.toString() ); + } +}); +``` + +Traverse order: + +``` + Program [#18] + `-FunctionDeclaration [#16] + |-BlockStatement [#14] + | |-IfStatement [#12] + | | |-BynaryExpression [#9] + | | | |-Identifier [#4] + | | | `-Literal [#5] + | | `-BlockStatement [#10] + | | `-ExpressionStatement [#6] + | | `-AssignmentExpression [#3] + | | |-Identifier [#1 walk starts here] + | | `-Literal [#2] + | `-VariableDeclaration [#13] + | `-VariableDeclarator [#11] + | |-Identifier [#7] + | `-Literal [#8] + `-ReturnStatement [#17] + `-Identifier [#15] +``` + +This behavior is very different from node-falafel and node-burrito. + + +### rocambole.walk(ast, callback) + +It loops through all nodes on the AST starting from the root node (`Program`), +similar to `node-falafel`. + +```js +rocambole.walk(ast, function(node){ + console.log(node.type); +}); +``` + + +## Popular Alternatives + + - [burrito](https://github.com/substack/node-burrito) + - [falafel](https://github.com/substack/node-falafel) + + + +## Unit Tests + +Besides the regular unit tests we also use +[istanbul](https://github.com/yahoo/istanbul) to generate code coverage +reports, tests should have at least 95% code coverage for statements, branches +and lines and 100% code coverage for functions or travis build will fail. + +We do not run the coverage test at each call since it slows down the +performnace of the tests and it also makes it harder to see the test results. +To execute tests and generate coverage report call `npm test --coverage`, for +regular tests just do `npm test`. + +Coverage reports are not committed to the repository since they will change at +each `npm test --coverage` call. + + + +## License + +MIT + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/.bin/esparse b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/.bin/esparse new file mode 120000 index 00000000..7423b18b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/.bin/esparse @@ -0,0 +1 @@ +../esprima/bin/esparse.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/.bin/esvalidate b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/.bin/esvalidate new file mode 120000 index 00000000..16069eff --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/.bin/esvalidate @@ -0,0 +1 @@ +../esprima/bin/esvalidate.js \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/ChangeLog b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/ChangeLog new file mode 100644 index 00000000..72d64b5d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/ChangeLog @@ -0,0 +1,111 @@ +2015-04-17: Version 2.2.0 + + * Support ES6 import and export declarations (issue 1000) + * Fix line terminator before arrow not recognized as error (issue 1009) + * Support ES6 destructuring (issue 1045) + * Support ES6 template literal (issue 1074) + * Fix the handling of invalid/incomplete string escape sequences (issue 1106) + * Fix ES3 static member access restriction (issue 1120) + * Support for `super` in ES6 class (issue 1147) + +2015-03-09: Version 2.1.0 + + * Support ES6 class (issue 1001) + * Support ES6 rest parameter (issue 1011) + * Expand the location of property getter, setter, and methods (issue 1029) + * Enable TryStatement transition to a single handler (issue 1031) + * Support ES6 computed property name (issue 1037) + * Tolerate unclosed block comment (issue 1041) + * Support ES6 lexical declaration (issue 1065) + +2015-02-06: Version 2.0.0 + + * Support ES6 arrow function (issue 517) + * Support ES6 Unicode code point escape (issue 521) + * Improve the speed and accuracy of comment attachment (issue 522) + * Support ES6 default parameter (issue 519) + * Support ES6 regular expression flags (issue 557) + * Fix scanning of implicit octal literals (issue 565) + * Fix the handling of automatic semicolon insertion (issue 574) + * Support ES6 method definition (issue 620) + * Support ES6 octal integer literal (issue 621) + * Support ES6 binary integer literal (issue 622) + * Support ES6 object literal property value shorthand (issue 624) + +2015-03-03: Version 1.2.5 + + * Fix scanning of implicit octal literals (issue 565) + +2015-02-05: Version 1.2.4 + + * Fix parsing of LeftHandSideExpression in ForInStatement (issue 560) + * Fix the handling of automatic semicolon insertion (issue 574) + +2015-01-18: Version 1.2.3 + + * Fix division by this (issue 616) + +2014-05-18: Version 1.2.2 + + * Fix duplicated tokens when collecting comments (issue 537) + +2014-05-04: Version 1.2.1 + + * Ensure that Program node may still have leading comments (issue 536) + +2014-04-29: Version 1.2.0 + + * Fix semicolon handling for expression statement (issue 462, 533) + * Disallow escaped characters in regular expression flags (issue 503) + * Performance improvement for location tracking (issue 520) + * Improve the speed of comment attachment (issue 522) + +2014-03-26: Version 1.1.1 + + * Fix token handling of forward slash after an array literal (issue 512) + +2014-03-23: Version 1.1.0 + + * Optionally attach comments to the owning syntax nodes (issue 197) + * Simplify binary parsing with stack-based shift reduce (issue 352) + * Always include the raw source of literals (issue 376) + * Add optional input source information (issue 386) + * Tokenizer API for pure lexical scanning (issue 398) + * Improve the web site and its online demos (issue 337, 400, 404) + * Performance improvement for location tracking (issue 417, 424) + * Support HTML comment syntax (issue 451) + * Drop support for legacy browsers (issue 474) + +2013-08-27: Version 1.0.4 + + * Minimize the payload for packages (issue 362) + * Fix missing cases on an empty switch statement (issue 436) + * Support escaped ] in regexp literal character classes (issue 442) + * Tolerate invalid left-hand side expression (issue 130) + +2013-05-17: Version 1.0.3 + + * Variable declaration needs at least one declarator (issue 391) + * Fix benchmark's variance unit conversion (issue 397) + * IE < 9: \v should be treated as vertical tab (issue 405) + * Unary expressions should always have prefix: true (issue 418) + * Catch clause should only accept an identifier (issue 423) + * Tolerate setters without parameter (issue 426) + +2012-11-02: Version 1.0.2 + + Improvement: + + * Fix esvalidate JUnit output upon a syntax error (issue 374) + +2012-10-28: Version 1.0.1 + + Improvements: + + * esvalidate understands shebang in a Unix shell script (issue 361) + * esvalidate treats fatal parsing failure as an error (issue 361) + * Reduce Node.js package via .npmignore (issue 362) + +2012-10-22: Version 1.0.0 + + Initial release. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/LICENSE.BSD b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/LICENSE.BSD new file mode 100644 index 00000000..3e580c35 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/README.md new file mode 100644 index 00000000..9ba7c0f5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/README.md @@ -0,0 +1,23 @@ +**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance, +standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +parser written in ECMAScript (also popularly known as +[JavaScript](https://en.wikipedia.org/wiki/JavaScript). +Esprima is created and maintained by [Ariya Hidayat](https://twitter.com/ariyahidayat), +with the help of [many contributors](https://github.com/jquery/esprima/contributors). + +### Features + +- Full support for ECMAScript 5.1 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm)) +- Sensible [syntax tree format](https://github.com/estree/estree/blob/master/spec.md) as standardized by [EStree project](https://github.com/estree/estree) +- Optional tracking of syntax node location (index-based and line-column) +- Heavily tested (~1000 [unit tests](https://github.com/jquery/esprima/tree/master/test/fixtures) with [full code coverage](https://travis-ci.org/jquery/esprima)) +- [Partial support](https://github.com/jquery/esprima/issues/1099) for ECMAScript 6 + +Esprima serves as a **building block** for some JavaScript +language tools, from [code instrumentation](http://esprima.org/demo/functiontrace.html) +to [editor autocompletion](http://esprima.org/demo/autocomplete.html). + +Esprima runs on many popular web browsers, as well as other ECMAScript platforms such as +[Rhino](http://www.mozilla.org/rhino), [Nashorn](http://openjdk.java.net/projects/nashorn/), and [Node.js](https://npmjs.org/package/esprima). + +For more information, check the web site [esprima.org](http://esprima.org). diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/bin/esparse.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/bin/esparse.js new file mode 100755 index 00000000..56036669 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/bin/esparse.js @@ -0,0 +1,127 @@ +#!/usr/bin/env node +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint sloppy:true node:true rhino:true */ + +var fs, esprima, fname, content, options, syntax; + +if (typeof require === 'function') { + fs = require('fs'); + esprima = require('esprima'); +} else if (typeof load === 'function') { + try { + load('esprima.js'); + } catch (e) { + load('../esprima.js'); + } +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { argv: arguments, exit: quit }; + process.argv.unshift('esparse.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esparse [options] file.js'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --comment Gather all line and block comments in an array'); + console.log(' --loc Include line-column location info for each syntax node'); + console.log(' --range Include index-based range for each syntax node'); + console.log(' --raw Display the raw value of literals'); + console.log(' --tokens List all tokens in an array'); + console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)'); + console.log(' -v, --version Shows program version'); + console.log(); + process.exit(1); +} + +if (process.argv.length <= 2) { + showUsage(); +} + +options = {}; + +process.argv.splice(2).forEach(function (entry) { + + if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Parser (using Esprima version', esprima.version, ')'); + console.log(); + process.exit(0); + } else if (entry === '--comment') { + options.comment = true; + } else if (entry === '--loc') { + options.loc = true; + } else if (entry === '--range') { + options.range = true; + } else if (entry === '--raw') { + options.raw = true; + } else if (entry === '--tokens') { + options.tokens = true; + } else if (entry === '--tolerant') { + options.tolerant = true; + } else if (entry.slice(0, 2) === '--') { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } else if (typeof fname === 'string') { + console.log('Error: more than one input file.'); + process.exit(1); + } else { + fname = entry; + } +}); + +if (typeof fname !== 'string') { + console.log('Error: no input file.'); + process.exit(1); +} + +// Special handling for regular expression literal since we need to +// convert it to a string literal, otherwise it will be decoded +// as object "{}" and the regular expression would be lost. +function adjustRegexLiteral(key, value) { + if (key === 'value' && value instanceof RegExp) { + value = value.toString(); + } + return value; +} + +try { + content = fs.readFileSync(fname, 'utf-8'); + syntax = esprima.parse(content, options); + console.log(JSON.stringify(syntax, adjustRegexLiteral, 4)); +} catch (e) { + console.log('Error: ' + e.message); + process.exit(1); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/bin/esvalidate.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/bin/esvalidate.js new file mode 100755 index 00000000..dddd8a2a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/bin/esvalidate.js @@ -0,0 +1,199 @@ +#!/usr/bin/env node +/* + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint sloppy:true plusplus:true node:true rhino:true */ +/*global phantom:true */ + +var fs, system, esprima, options, fnames, count; + +if (typeof esprima === 'undefined') { + // PhantomJS can only require() relative files + if (typeof phantom === 'object') { + fs = require('fs'); + system = require('system'); + esprima = require('./esprima'); + } else if (typeof require === 'function') { + fs = require('fs'); + esprima = require('esprima'); + } else if (typeof load === 'function') { + try { + load('esprima.js'); + } catch (e) { + load('../esprima.js'); + } + } +} + +// Shims to Node.js objects when running under PhantomJS 1.7+. +if (typeof phantom === 'object') { + fs.readFileSync = fs.read; + process = { + argv: [].slice.call(system.args), + exit: phantom.exit + }; + process.argv.unshift('phantomjs'); +} + +// Shims to Node.js objects when running under Rhino. +if (typeof console === 'undefined' && typeof process === 'undefined') { + console = { log: print }; + fs = { readFileSync: readFile }; + process = { argv: arguments, exit: quit }; + process.argv.unshift('esvalidate.js'); + process.argv.unshift('rhino'); +} + +function showUsage() { + console.log('Usage:'); + console.log(' esvalidate [options] file.js'); + console.log(); + console.log('Available options:'); + console.log(); + console.log(' --format=type Set the report format, plain (default) or junit'); + console.log(' -v, --version Print program version'); + console.log(); + process.exit(1); +} + +if (process.argv.length <= 2) { + showUsage(); +} + +options = { + format: 'plain' +}; + +fnames = []; + +process.argv.splice(2).forEach(function (entry) { + + if (entry === '-h' || entry === '--help') { + showUsage(); + } else if (entry === '-v' || entry === '--version') { + console.log('ECMAScript Validator (using Esprima version', esprima.version, ')'); + console.log(); + process.exit(0); + } else if (entry.slice(0, 9) === '--format=') { + options.format = entry.slice(9); + if (options.format !== 'plain' && options.format !== 'junit') { + console.log('Error: unknown report format ' + options.format + '.'); + process.exit(1); + } + } else if (entry.slice(0, 2) === '--') { + console.log('Error: unknown option ' + entry + '.'); + process.exit(1); + } else { + fnames.push(entry); + } +}); + +if (fnames.length === 0) { + console.log('Error: no input file.'); + process.exit(1); +} + +if (options.format === 'junit') { + console.log(''); + console.log(''); +} + +count = 0; +fnames.forEach(function (fname) { + var content, timestamp, syntax, name; + try { + content = fs.readFileSync(fname, 'utf-8'); + + if (content[0] === '#' && content[1] === '!') { + content = '//' + content.substr(2, content.length); + } + + timestamp = Date.now(); + syntax = esprima.parse(content, { tolerant: true }); + + if (options.format === 'junit') { + + name = fname; + if (name.lastIndexOf('/') >= 0) { + name = name.slice(name.lastIndexOf('/') + 1); + } + + console.log(''); + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + console.log(' '); + console.log(' ' + + error.message + '(' + name + ':' + error.lineNumber + ')' + + ''); + console.log(' '); + }); + + console.log(''); + + } else if (options.format === 'plain') { + + syntax.errors.forEach(function (error) { + var msg = error.message; + msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); + msg = fname + ':' + error.lineNumber + ': ' + msg; + console.log(msg); + ++count; + }); + + } + } catch (e) { + ++count; + if (options.format === 'junit') { + console.log(''); + console.log(' '); + console.log(' ' + + e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') + + ')'); + console.log(' '); + console.log(''); + } else { + console.log('Error: ' + e.message); + } + } +}); + +if (options.format === 'junit') { + console.log(''); +} + +if (count > 0) { + process.exit(1); +} + +if (count === 0 && typeof phantom === 'object') { + process.exit(0); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/esprima.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/esprima.js new file mode 100644 index 00000000..2d7fc11c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/esprima.js @@ -0,0 +1,5321 @@ +/* + Copyright (C) 2013 Ariya Hidayat + Copyright (C) 2013 Thaddee Tyl + Copyright (C) 2013 Mathias Bynens + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Mathias Bynens + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Kris Kowal + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function (root, factory) { + 'use strict'; + + // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, + // Rhino, and plain browser loading. + + /* istanbul ignore next */ + if (typeof define === 'function' && define.amd) { + define(['exports'], factory); + } else if (typeof exports !== 'undefined') { + factory(exports); + } else { + factory((root.esprima = {})); + } +}(this, function (exports) { + 'use strict'; + + var Token, + TokenName, + FnExprTokens, + Syntax, + PlaceHolders, + Messages, + Regex, + source, + strict, + sourceType, + index, + lineNumber, + lineStart, + hasLineTerminator, + lastIndex, + lastLineNumber, + lastLineStart, + startIndex, + startLineNumber, + startLineStart, + scanning, + length, + lookahead, + state, + extra, + isBindingElement, + isAssignmentTarget, + firstCoverInitializedNameError; + + Token = { + BooleanLiteral: 1, + EOF: 2, + Identifier: 3, + Keyword: 4, + NullLiteral: 5, + NumericLiteral: 6, + Punctuator: 7, + StringLiteral: 8, + RegularExpression: 9, + Template: 10 + }; + + TokenName = {}; + TokenName[Token.BooleanLiteral] = 'Boolean'; + TokenName[Token.EOF] = ''; + TokenName[Token.Identifier] = 'Identifier'; + TokenName[Token.Keyword] = 'Keyword'; + TokenName[Token.NullLiteral] = 'Null'; + TokenName[Token.NumericLiteral] = 'Numeric'; + TokenName[Token.Punctuator] = 'Punctuator'; + TokenName[Token.StringLiteral] = 'String'; + TokenName[Token.RegularExpression] = 'RegularExpression'; + TokenName[Token.Template] = 'Template'; + + // A function following one of those tokens is an expression. + FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new', + 'return', 'case', 'delete', 'throw', 'void', + // assignment operators + '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=', + '&=', '|=', '^=', ',', + // binary/unary operators + '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&', + '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=', + '<=', '<', '>', '!=', '!==']; + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement' + }; + + PlaceHolders = { + ArrowParameterPlaceHolder: 'ArrowParameterPlaceHolder' + }; + + // Error messages should be identical to V8. + Messages = { + UnexpectedToken: 'Unexpected token %0', + UnexpectedNumber: 'Unexpected number', + UnexpectedString: 'Unexpected string', + UnexpectedIdentifier: 'Unexpected identifier', + UnexpectedReserved: 'Unexpected reserved word', + UnexpectedTemplate: 'Unexpected quasi %0', + UnexpectedEOS: 'Unexpected end of input', + NewlineAfterThrow: 'Illegal newline after throw', + InvalidRegExp: 'Invalid regular expression', + UnterminatedRegExp: 'Invalid regular expression: missing /', + InvalidLHSInAssignment: 'Invalid left-hand side in assignment', + InvalidLHSInForIn: 'Invalid left-hand side in for-in', + MultipleDefaultsInSwitch: 'More than one default clause in switch statement', + NoCatchOrFinally: 'Missing catch or finally after try', + UnknownLabel: 'Undefined label \'%0\'', + Redeclaration: '%0 \'%1\' has already been declared', + IllegalContinue: 'Illegal continue statement', + IllegalBreak: 'Illegal break statement', + IllegalReturn: 'Illegal return statement', + StrictModeWith: 'Strict mode code may not include a with statement', + StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', + StrictVarName: 'Variable name may not be eval or arguments in strict mode', + StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', + StrictParamDupe: 'Strict mode function may not have duplicate parameter names', + StrictFunctionName: 'Function name may not be eval or arguments in strict mode', + StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', + StrictDelete: 'Delete of an unqualified identifier in strict mode.', + StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', + StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', + StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', + StrictReservedWord: 'Use of future reserved word in strict mode', + TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', + ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', + DefaultRestParameter: 'Unexpected token =', + ObjectPatternAsRestParameter: 'Unexpected token {', + DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', + ConstructorSpecialMethod: 'Class constructor may not be an accessor', + DuplicateConstructor: 'A class may only have one constructor', + StaticPrototype: 'Classes may not have static property named prototype', + MissingFromClause: 'Unexpected token', + NoAsAfterImportNamespace: 'Unexpected token', + InvalidModuleSpecifier: 'Unexpected token', + IllegalImportDeclaration: 'Unexpected token', + IllegalExportDeclaration: 'Unexpected token' + }; + + // See also tools/generate-unicode-regex.py. + Regex = { + NonAsciiIdentifierStart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]'), + NonAsciiIdentifierPart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]') + }; + + // Ensure the condition is true, otherwise throw an error. + // This is only to have a better contract semantic, i.e. another safety net + // to catch a logic error. The condition shall be fulfilled in normal case. + // Do NOT use this to enforce a certain condition on any user input. + + function assert(condition, message) { + /* istanbul ignore if */ + if (!condition) { + throw new Error('ASSERT: ' + message); + } + } + + function isDecimalDigit(ch) { + return (ch >= 0x30 && ch <= 0x39); // 0..9 + } + + function isHexDigit(ch) { + return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; + } + + function isOctalDigit(ch) { + return '01234567'.indexOf(ch) >= 0; + } + + function octalToDecimal(ch) { + // \0 is not octal escape sequence + var octal = (ch !== '0'), code = '01234567'.indexOf(ch); + + if (index < length && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + '01234567'.indexOf(source[index++]); + + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + isOctalDigit(source[index])) { + code = code * 8 + '01234567'.indexOf(source[index++]); + } + } + + return { + code: code, + octal: octal + }; + } + + // 7.2 White Space + + function isWhiteSpace(ch) { + return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || + (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0); + } + + // 7.3 Line Terminators + + function isLineTerminator(ch) { + return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); + } + + // 7.6 Identifier Names and Identifiers + + function isIdentifierStart(ch) { + return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) + (ch >= 0x41 && ch <= 0x5A) || // A..Z + (ch >= 0x61 && ch <= 0x7A) || // a..z + (ch === 0x5C) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))); + } + + function isIdentifierPart(ch) { + return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore) + (ch >= 0x41 && ch <= 0x5A) || // A..Z + (ch >= 0x61 && ch <= 0x7A) || // a..z + (ch >= 0x30 && ch <= 0x39) || // 0..9 + (ch === 0x5C) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))); + } + + // 7.6.1.2 Future Reserved Words + + function isFutureReservedWord(id) { + switch (id) { + case 'enum': + case 'export': + case 'import': + case 'super': + return true; + default: + return false; + } + } + + // 11.6.2.2 Future Reserved Words + + function isStrictModeReservedWord(id) { + switch (id) { + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'yield': + case 'let': + return true; + default: + return false; + } + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + // 7.6.1.1 Keywords + + function isKeyword(id) { + + // 'const' is specialized as Keyword in V8. + // 'yield' and 'let' are for compatibility with SpiderMonkey and ES.next. + // Some others are from future reserved words. + + switch (id.length) { + case 2: + return (id === 'if') || (id === 'in') || (id === 'do'); + case 3: + return (id === 'var') || (id === 'for') || (id === 'new') || + (id === 'try') || (id === 'let'); + case 4: + return (id === 'this') || (id === 'else') || (id === 'case') || + (id === 'void') || (id === 'with') || (id === 'enum'); + case 5: + return (id === 'while') || (id === 'break') || (id === 'catch') || + (id === 'throw') || (id === 'const') || (id === 'yield') || + (id === 'class') || (id === 'super'); + case 6: + return (id === 'return') || (id === 'typeof') || (id === 'delete') || + (id === 'switch') || (id === 'export') || (id === 'import'); + case 7: + return (id === 'default') || (id === 'finally') || (id === 'extends'); + case 8: + return (id === 'function') || (id === 'continue') || (id === 'debugger'); + case 10: + return (id === 'instanceof'); + default: + return false; + } + } + + // 7.4 Comments + + function addComment(type, value, start, end, loc) { + var comment; + + assert(typeof start === 'number', 'Comment must have valid position'); + + state.lastCommentStart = start; + + comment = { + type: type, + value: value + }; + if (extra.range) { + comment.range = [start, end]; + } + if (extra.loc) { + comment.loc = loc; + } + extra.comments.push(comment); + if (extra.attachComment) { + extra.leadingComments.push(comment); + extra.trailingComments.push(comment); + } + } + + function skipSingleLineComment(offset) { + var start, loc, ch, comment; + + start = index - offset; + loc = { + start: { + line: lineNumber, + column: index - lineStart - offset + } + }; + + while (index < length) { + ch = source.charCodeAt(index); + ++index; + if (isLineTerminator(ch)) { + hasLineTerminator = true; + if (extra.comments) { + comment = source.slice(start + offset, index - 1); + loc.end = { + line: lineNumber, + column: index - lineStart - 1 + }; + addComment('Line', comment, start, index - 1, loc); + } + if (ch === 13 && source.charCodeAt(index) === 10) { + ++index; + } + ++lineNumber; + lineStart = index; + return; + } + } + + if (extra.comments) { + comment = source.slice(start + offset, index); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + addComment('Line', comment, start, index, loc); + } + } + + function skipMultiLineComment() { + var start, loc, ch, comment; + + if (extra.comments) { + start = index - 2; + loc = { + start: { + line: lineNumber, + column: index - lineStart - 2 + } + }; + } + + while (index < length) { + ch = source.charCodeAt(index); + if (isLineTerminator(ch)) { + if (ch === 0x0D && source.charCodeAt(index + 1) === 0x0A) { + ++index; + } + hasLineTerminator = true; + ++lineNumber; + ++index; + lineStart = index; + } else if (ch === 0x2A) { + // Block comment ends with '*/'. + if (source.charCodeAt(index + 1) === 0x2F) { + ++index; + ++index; + if (extra.comments) { + comment = source.slice(start + 2, index - 2); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + addComment('Block', comment, start, index, loc); + } + return; + } + ++index; + } else { + ++index; + } + } + + // Ran off the end of the file - the whole thing is a comment + if (extra.comments) { + loc.end = { + line: lineNumber, + column: index - lineStart + }; + comment = source.slice(start + 2, index); + addComment('Block', comment, start, index, loc); + } + tolerateUnexpectedToken(); + } + + function skipComment() { + var ch, start; + hasLineTerminator = false; + + start = (index === 0); + while (index < length) { + ch = source.charCodeAt(index); + + if (isWhiteSpace(ch)) { + ++index; + } else if (isLineTerminator(ch)) { + hasLineTerminator = true; + ++index; + if (ch === 0x0D && source.charCodeAt(index) === 0x0A) { + ++index; + } + ++lineNumber; + lineStart = index; + start = true; + } else if (ch === 0x2F) { // U+002F is '/' + ch = source.charCodeAt(index + 1); + if (ch === 0x2F) { + ++index; + ++index; + skipSingleLineComment(2); + start = true; + } else if (ch === 0x2A) { // U+002A is '*' + ++index; + ++index; + skipMultiLineComment(); + } else { + break; + } + } else if (start && ch === 0x2D) { // U+002D is '-' + // U+003E is '>' + if ((source.charCodeAt(index + 1) === 0x2D) && (source.charCodeAt(index + 2) === 0x3E)) { + // '-->' is a single-line comment + index += 3; + skipSingleLineComment(3); + } else { + break; + } + } else if (ch === 0x3C) { // U+003C is '<' + if (source.slice(index + 1, index + 4) === '!--') { + ++index; // `<` + ++index; // `!` + ++index; // `-` + ++index; // `-` + skipSingleLineComment(4); + } else { + break; + } + } else { + break; + } + } + } + + function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && isHexDigit(source[index])) { + ch = source[index++]; + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } + + function scanUnicodeCodePointEscape() { + var ch, code, cu1, cu2; + + ch = source[index]; + code = 0; + + // At least, one hex digit is required. + if (ch === '}') { + throwUnexpectedToken(); + } + + while (index < length) { + ch = source[index++]; + if (!isHexDigit(ch)) { + break; + } + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } + + if (code > 0x10FFFF || ch !== '}') { + throwUnexpectedToken(); + } + + // UTF-16 Encoding + if (code <= 0xFFFF) { + return String.fromCharCode(code); + } + cu1 = ((code - 0x10000) >> 10) + 0xD800; + cu2 = ((code - 0x10000) & 1023) + 0xDC00; + return String.fromCharCode(cu1, cu2); + } + + function getEscapedIdentifier() { + var ch, id; + + ch = source.charCodeAt(index++); + id = String.fromCharCode(ch); + + // '\u' (U+005C, U+0075) denotes an escaped character. + if (ch === 0x5C) { + if (source.charCodeAt(index) !== 0x75) { + throwUnexpectedToken(); + } + ++index; + ch = scanHexEscape('u'); + if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) { + throwUnexpectedToken(); + } + id = ch; + } + + while (index < length) { + ch = source.charCodeAt(index); + if (!isIdentifierPart(ch)) { + break; + } + ++index; + id += String.fromCharCode(ch); + + // '\u' (U+005C, U+0075) denotes an escaped character. + if (ch === 0x5C) { + id = id.substr(0, id.length - 1); + if (source.charCodeAt(index) !== 0x75) { + throwUnexpectedToken(); + } + ++index; + ch = scanHexEscape('u'); + if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) { + throwUnexpectedToken(); + } + id += ch; + } + } + + return id; + } + + function getIdentifier() { + var start, ch; + + start = index++; + while (index < length) { + ch = source.charCodeAt(index); + if (ch === 0x5C) { + // Blackslash (U+005C) marks Unicode escape sequence. + index = start; + return getEscapedIdentifier(); + } + if (isIdentifierPart(ch)) { + ++index; + } else { + break; + } + } + + return source.slice(start, index); + } + + function scanIdentifier() { + var start, id, type; + + start = index; + + // Backslash (U+005C) starts an escaped character. + id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); + + // There is no keyword or literal with only one character. + // Thus, it must be an identifier. + if (id.length === 1) { + type = Token.Identifier; + } else if (isKeyword(id)) { + type = Token.Keyword; + } else if (id === 'null') { + type = Token.NullLiteral; + } else if (id === 'true' || id === 'false') { + type = Token.BooleanLiteral; + } else { + type = Token.Identifier; + } + + return { + type: type, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + + // 7.7 Punctuators + + function scanPunctuator() { + var token, str; + + token = { + type: Token.Punctuator, + value: '', + lineNumber: lineNumber, + lineStart: lineStart, + start: index, + end: index + }; + + // Check for most common single-character punctuators. + str = source[index]; + switch (str) { + + case '(': + if (extra.tokenize) { + extra.openParenToken = extra.tokens.length; + } + ++index; + break; + + case '{': + if (extra.tokenize) { + extra.openCurlyToken = extra.tokens.length; + } + state.curlyStack.push('{'); + ++index; + break; + + case '.': + ++index; + if (source[index] === '.' && source[index + 1] === '.') { + // Spread operator: ... + index += 2; + str = '...'; + } + break; + + case '}': + ++index; + state.curlyStack.pop(); + break; + case ')': + case ';': + case ',': + case '[': + case ']': + case ':': + case '?': + case '~': + ++index; + break; + + default: + // 4-character punctuator. + str = source.substr(index, 4); + if (str === '>>>=') { + index += 4; + } else { + + // 3-character punctuators. + str = str.substr(0, 3); + if (str === '===' || str === '!==' || str === '>>>' || + str === '<<=' || str === '>>=') { + index += 3; + } else { + + // 2-character punctuators. + str = str.substr(0, 2); + if (str === '&&' || str === '||' || str === '==' || str === '!=' || + str === '+=' || str === '-=' || str === '*=' || str === '/=' || + str === '++' || str === '--' || str === '<<' || str === '>>' || + str === '&=' || str === '|=' || str === '^=' || str === '%=' || + str === '<=' || str === '>=' || str === '=>') { + index += 2; + } else { + + // 1-character punctuators. + str = source[index]; + if ('<>=!+-*%&|^/'.indexOf(str) >= 0) { + ++index; + } + } + } + } + } + + if (index === token.start) { + throwUnexpectedToken(); + } + + token.end = index; + token.value = str; + return token; + } + + // 7.8.3 Numeric Literals + + function scanHexLiteral(start) { + var number = ''; + + while (index < length) { + if (!isHexDigit(source[index])) { + break; + } + number += source[index++]; + } + + if (number.length === 0) { + throwUnexpectedToken(); + } + + if (isIdentifierStart(source.charCodeAt(index))) { + throwUnexpectedToken(); + } + + return { + type: Token.NumericLiteral, + value: parseInt('0x' + number, 16), + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + function scanBinaryLiteral(start) { + var ch, number; + + number = ''; + + while (index < length) { + ch = source[index]; + if (ch !== '0' && ch !== '1') { + break; + } + number += source[index++]; + } + + if (number.length === 0) { + // only 0b or 0B + throwUnexpectedToken(); + } + + if (index < length) { + ch = source.charCodeAt(index); + /* istanbul ignore else */ + if (isIdentifierStart(ch) || isDecimalDigit(ch)) { + throwUnexpectedToken(); + } + } + + return { + type: Token.NumericLiteral, + value: parseInt(number, 2), + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + function scanOctalLiteral(prefix, start) { + var number, octal; + + if (isOctalDigit(prefix)) { + octal = true; + number = '0' + source[index++]; + } else { + octal = false; + ++index; + number = ''; + } + + while (index < length) { + if (!isOctalDigit(source[index])) { + break; + } + number += source[index++]; + } + + if (!octal && number.length === 0) { + // only 0o or 0O + throwUnexpectedToken(); + } + + if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { + throwUnexpectedToken(); + } + + return { + type: Token.NumericLiteral, + value: parseInt(number, 8), + octal: octal, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + function isImplicitOctalLiteral() { + var i, ch; + + // Implicit octal, unless there is a non-octal digit. + // (Annex B.1.1 on Numeric Literals) + for (i = index + 1; i < length; ++i) { + ch = source[i]; + if (ch === '8' || ch === '9') { + return false; + } + if (!isOctalDigit(ch)) { + return true; + } + } + + return true; + } + + function scanNumericLiteral() { + var number, start, ch; + + ch = source[index]; + assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), + 'Numeric literal must start with a decimal digit or a decimal point'); + + start = index; + number = ''; + if (ch !== '.') { + number = source[index++]; + ch = source[index]; + + // Hex number starts with '0x'. + // Octal number starts with '0'. + // Octal number in ES6 starts with '0o'. + // Binary number in ES6 starts with '0b'. + if (number === '0') { + if (ch === 'x' || ch === 'X') { + ++index; + return scanHexLiteral(start); + } + if (ch === 'b' || ch === 'B') { + ++index; + return scanBinaryLiteral(start); + } + if (ch === 'o' || ch === 'O') { + return scanOctalLiteral(ch, start); + } + + if (isOctalDigit(ch)) { + if (isImplicitOctalLiteral()) { + return scanOctalLiteral(ch, start); + } + } + } + + while (isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + ch = source[index]; + } + + if (ch === '.') { + number += source[index++]; + while (isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + ch = source[index]; + } + + if (ch === 'e' || ch === 'E') { + number += source[index++]; + + ch = source[index]; + if (ch === '+' || ch === '-') { + number += source[index++]; + } + if (isDecimalDigit(source.charCodeAt(index))) { + while (isDecimalDigit(source.charCodeAt(index))) { + number += source[index++]; + } + } else { + throwUnexpectedToken(); + } + } + + if (isIdentifierStart(source.charCodeAt(index))) { + throwUnexpectedToken(); + } + + return { + type: Token.NumericLiteral, + value: parseFloat(number), + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + // 7.8.4 String Literals + + function scanStringLiteral() { + var str = '', quote, start, ch, unescaped, octToDec, octal = false; + + quote = source[index]; + assert((quote === '\'' || quote === '"'), + 'String literal must starts with a quote'); + + start = index; + ++index; + + while (index < length) { + ch = source[index++]; + + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = source[index++]; + if (!ch || !isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'u': + case 'x': + if (source[index] === '{') { + ++index; + str += scanUnicodeCodePointEscape(); + } else { + unescaped = scanHexEscape(ch); + if (!unescaped) { + throw throwUnexpectedToken(); + } + str += unescaped; + } + break; + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\x0B'; + break; + case '8': + case '9': + throw throwUnexpectedToken(); + + default: + if (isOctalDigit(ch)) { + octToDec = octalToDecimal(ch); + + octal = octToDec.octal || octal; + str += String.fromCharCode(octToDec.code); + } else { + str += ch; + } + break; + } + } else { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + lineStart = index; + } + } else if (isLineTerminator(ch.charCodeAt(0))) { + break; + } else { + str += ch; + } + } + + if (quote !== '') { + throwUnexpectedToken(); + } + + return { + type: Token.StringLiteral, + value: str, + octal: octal, + lineNumber: startLineNumber, + lineStart: startLineStart, + start: start, + end: index + }; + } + + function scanTemplate() { + var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped; + + terminated = false; + tail = false; + start = index; + head = (source[index] === '`'); + rawOffset = 2; + + ++index; + + while (index < length) { + ch = source[index++]; + if (ch === '`') { + rawOffset = 1; + tail = true; + terminated = true; + break; + } else if (ch === '$') { + if (source[index] === '{') { + state.curlyStack.push('${'); + ++index; + terminated = true; + break; + } + cooked += ch; + } else if (ch === '\\') { + ch = source[index++]; + if (!isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'n': + cooked += '\n'; + break; + case 'r': + cooked += '\r'; + break; + case 't': + cooked += '\t'; + break; + case 'u': + case 'x': + if (source[index] === '{') { + ++index; + cooked += scanUnicodeCodePointEscape(); + } else { + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + cooked += unescaped; + } else { + index = restore; + cooked += ch; + } + } + break; + case 'b': + cooked += '\b'; + break; + case 'f': + cooked += '\f'; + break; + case 'v': + cooked += '\v'; + break; + + default: + if (ch === '0') { + if (isDecimalDigit(source.charCodeAt(index))) { + // Illegal: \01 \02 and so on + throwError(Messages.TemplateOctalLiteral); + } + cooked += '\0'; + } else if (isOctalDigit(ch)) { + // Illegal: \1 \2 + throwError(Messages.TemplateOctalLiteral); + } else { + cooked += ch; + } + break; + } + } else { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + lineStart = index; + } + } else if (isLineTerminator(ch.charCodeAt(0))) { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + lineStart = index; + cooked += '\n'; + } else { + cooked += ch; + } + } + + if (!terminated) { + throwUnexpectedToken(); + } + + if (!head) { + state.curlyStack.pop(); + } + + return { + type: Token.Template, + value: { + cooked: cooked, + raw: source.slice(start + 1, index - rawOffset) + }, + head: head, + tail: tail, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + function testRegExp(pattern, flags) { + var tmp = pattern; + + if (flags.indexOf('u') >= 0) { + // Replace each astral symbol and every Unicode escape sequence + // that possibly represents an astral symbol or a paired surrogate + // with a single ASCII symbol to avoid throwing on regular + // expressions that are only valid in combination with the `/u` + // flag. + // Note: replacing with the ASCII symbol `x` might cause false + // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a + // perfectly valid pattern that is equivalent to `[a-b]`, but it + // would be replaced by `[x-b]` which throws an error. + tmp = tmp + .replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) { + if (parseInt($1, 16) <= 0x10FFFF) { + return 'x'; + } + throwUnexpectedToken(null, Messages.InvalidRegExp); + }) + .replace( + /\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + 'x' + ); + } + + // First, detect invalid regular expressions. + try { + RegExp(tmp); + } catch (e) { + throwUnexpectedToken(null, Messages.InvalidRegExp); + } + + // Return a regular expression object for this pattern-flag pair, or + // `null` in case the current environment doesn't support the flags it + // uses. + try { + return new RegExp(pattern, flags); + } catch (exception) { + return null; + } + } + + function scanRegExpBody() { + var ch, str, classMarker, terminated, body; + + ch = source[index]; + assert(ch === '/', 'Regular expression literal must start with a slash'); + str = source[index++]; + + classMarker = false; + terminated = false; + while (index < length) { + ch = source[index++]; + str += ch; + if (ch === '\\') { + ch = source[index++]; + // ECMA-262 7.8.5 + if (isLineTerminator(ch.charCodeAt(0))) { + throwUnexpectedToken(null, Messages.UnterminatedRegExp); + } + str += ch; + } else if (isLineTerminator(ch.charCodeAt(0))) { + throwUnexpectedToken(null, Messages.UnterminatedRegExp); + } else if (classMarker) { + if (ch === ']') { + classMarker = false; + } + } else { + if (ch === '/') { + terminated = true; + break; + } else if (ch === '[') { + classMarker = true; + } + } + } + + if (!terminated) { + throwUnexpectedToken(null, Messages.UnterminatedRegExp); + } + + // Exclude leading and trailing slash. + body = str.substr(1, str.length - 2); + return { + value: body, + literal: str + }; + } + + function scanRegExpFlags() { + var ch, str, flags, restore; + + str = ''; + flags = ''; + while (index < length) { + ch = source[index]; + if (!isIdentifierPart(ch.charCodeAt(0))) { + break; + } + + ++index; + if (ch === '\\' && index < length) { + ch = source[index]; + if (ch === 'u') { + ++index; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + flags += ch; + for (str += '\\u'; restore < index; ++restore) { + str += source[restore]; + } + } else { + index = restore; + flags += 'u'; + str += '\\u'; + } + tolerateUnexpectedToken(); + } else { + str += '\\'; + tolerateUnexpectedToken(); + } + } else { + flags += ch; + str += ch; + } + } + + return { + value: flags, + literal: str + }; + } + + function scanRegExp() { + scanning = true; + var start, body, flags, value; + + lookahead = null; + skipComment(); + start = index; + + body = scanRegExpBody(); + flags = scanRegExpFlags(); + value = testRegExp(body.value, flags.value); + scanning = false; + if (extra.tokenize) { + return { + type: Token.RegularExpression, + value: value, + regex: { + pattern: body.value, + flags: flags.value + }, + lineNumber: lineNumber, + lineStart: lineStart, + start: start, + end: index + }; + } + + return { + literal: body.literal + flags.literal, + value: value, + regex: { + pattern: body.value, + flags: flags.value + }, + start: start, + end: index + }; + } + + function collectRegex() { + var pos, loc, regex, token; + + skipComment(); + + pos = index; + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + regex = scanRegExp(); + + loc.end = { + line: lineNumber, + column: index - lineStart + }; + + /* istanbul ignore next */ + if (!extra.tokenize) { + // Pop the previous token, which is likely '/' or '/=' + if (extra.tokens.length > 0) { + token = extra.tokens[extra.tokens.length - 1]; + if (token.range[0] === pos && token.type === 'Punctuator') { + if (token.value === '/' || token.value === '/=') { + extra.tokens.pop(); + } + } + } + + extra.tokens.push({ + type: 'RegularExpression', + value: regex.literal, + regex: regex.regex, + range: [pos, index], + loc: loc + }); + } + + return regex; + } + + function isIdentifierName(token) { + return token.type === Token.Identifier || + token.type === Token.Keyword || + token.type === Token.BooleanLiteral || + token.type === Token.NullLiteral; + } + + function advanceSlash() { + var prevToken, + checkToken; + // Using the following algorithm: + // https://github.com/mozilla/sweet.js/wiki/design + prevToken = extra.tokens[extra.tokens.length - 1]; + if (!prevToken) { + // Nothing before that: it cannot be a division. + return collectRegex(); + } + if (prevToken.type === 'Punctuator') { + if (prevToken.value === ']') { + return scanPunctuator(); + } + if (prevToken.value === ')') { + checkToken = extra.tokens[extra.openParenToken - 1]; + if (checkToken && + checkToken.type === 'Keyword' && + (checkToken.value === 'if' || + checkToken.value === 'while' || + checkToken.value === 'for' || + checkToken.value === 'with')) { + return collectRegex(); + } + return scanPunctuator(); + } + if (prevToken.value === '}') { + // Dividing a function by anything makes little sense, + // but we have to check for that. + if (extra.tokens[extra.openCurlyToken - 3] && + extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') { + // Anonymous function. + checkToken = extra.tokens[extra.openCurlyToken - 4]; + if (!checkToken) { + return scanPunctuator(); + } + } else if (extra.tokens[extra.openCurlyToken - 4] && + extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') { + // Named function. + checkToken = extra.tokens[extra.openCurlyToken - 5]; + if (!checkToken) { + return collectRegex(); + } + } else { + return scanPunctuator(); + } + // checkToken determines whether the function is + // a declaration or an expression. + if (FnExprTokens.indexOf(checkToken.value) >= 0) { + // It is an expression. + return scanPunctuator(); + } + // It is a declaration. + return collectRegex(); + } + return collectRegex(); + } + if (prevToken.type === 'Keyword' && prevToken.value !== 'this') { + return collectRegex(); + } + return scanPunctuator(); + } + + function advance() { + var ch, token; + + if (index >= length) { + return { + type: Token.EOF, + lineNumber: lineNumber, + lineStart: lineStart, + start: index, + end: index + }; + } + + ch = source.charCodeAt(index); + + if (isIdentifierStart(ch)) { + token = scanIdentifier(); + if (strict && isStrictModeReservedWord(token.value)) { + token.type = Token.Keyword; + } + return token; + } + + // Very common: ( and ) and ; + if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { + return scanPunctuator(); + } + + // String literal starts with single quote (U+0027) or double quote (U+0022). + if (ch === 0x27 || ch === 0x22) { + return scanStringLiteral(); + } + + // Dot (.) U+002E can also start a floating-point number, hence the need + // to check the next character. + if (ch === 0x2E) { + if (isDecimalDigit(source.charCodeAt(index + 1))) { + return scanNumericLiteral(); + } + return scanPunctuator(); + } + + if (isDecimalDigit(ch)) { + return scanNumericLiteral(); + } + + // Slash (/) U+002F can also start a regex. + if (extra.tokenize && ch === 0x2F) { + return advanceSlash(); + } + + // Template literals start with ` (U+0060) for template head + // or } (U+007D) for template middle or template tail. + if (ch === 0x60 || (ch === 0x7D && state.curlyStack[state.curlyStack.length - 1] === '${')) { + return scanTemplate(); + } + + return scanPunctuator(); + } + + function collectToken() { + var loc, token, value, entry; + + loc = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + token = advance(); + loc.end = { + line: lineNumber, + column: index - lineStart + }; + + if (token.type !== Token.EOF) { + value = source.slice(token.start, token.end); + entry = { + type: TokenName[token.type], + value: value, + range: [token.start, token.end], + loc: loc + }; + if (token.regex) { + entry.regex = { + pattern: token.regex.pattern, + flags: token.regex.flags + }; + } + extra.tokens.push(entry); + } + + return token; + } + + function lex() { + var token; + scanning = true; + + lastIndex = index; + lastLineNumber = lineNumber; + lastLineStart = lineStart; + + skipComment(); + + token = lookahead; + + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + + lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance(); + scanning = false; + return token; + } + + function peek() { + scanning = true; + + skipComment(); + + lastIndex = index; + lastLineNumber = lineNumber; + lastLineStart = lineStart; + + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + + lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance(); + scanning = false; + } + + function Position() { + this.line = startLineNumber; + this.column = startIndex - startLineStart; + } + + function SourceLocation() { + this.start = new Position(); + this.end = null; + } + + function WrappingSourceLocation(startToken) { + this.start = { + line: startToken.lineNumber, + column: startToken.start - startToken.lineStart + }; + this.end = null; + } + + function Node() { + if (extra.range) { + this.range = [startIndex, 0]; + } + if (extra.loc) { + this.loc = new SourceLocation(); + } + } + + function WrappingNode(startToken) { + if (extra.range) { + this.range = [startToken.start, 0]; + } + if (extra.loc) { + this.loc = new WrappingSourceLocation(startToken); + } + } + + WrappingNode.prototype = Node.prototype = { + + processComment: function () { + var lastChild, + leadingComments, + trailingComments, + bottomRight = extra.bottomRightStack, + i, + comment, + last = bottomRight[bottomRight.length - 1]; + + if (this.type === Syntax.Program) { + if (this.body.length > 0) { + return; + } + } + + if (extra.trailingComments.length > 0) { + trailingComments = []; + for (i = extra.trailingComments.length - 1; i >= 0; --i) { + comment = extra.trailingComments[i]; + if (comment.range[0] >= this.range[1]) { + trailingComments.unshift(comment); + extra.trailingComments.splice(i, 1); + } + } + extra.trailingComments = []; + } else { + if (last && last.trailingComments && last.trailingComments[0].range[0] >= this.range[1]) { + trailingComments = last.trailingComments; + delete last.trailingComments; + } + } + + // Eating the stack. + if (last) { + while (last && last.range[0] >= this.range[0]) { + lastChild = last; + last = bottomRight.pop(); + } + } + + if (lastChild) { + if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= this.range[0]) { + this.leadingComments = lastChild.leadingComments; + lastChild.leadingComments = undefined; + } + } else if (extra.leadingComments.length > 0) { + leadingComments = []; + for (i = extra.leadingComments.length - 1; i >= 0; --i) { + comment = extra.leadingComments[i]; + if (comment.range[1] <= this.range[0]) { + leadingComments.unshift(comment); + extra.leadingComments.splice(i, 1); + } + } + } + + + if (leadingComments && leadingComments.length > 0) { + this.leadingComments = leadingComments; + } + if (trailingComments && trailingComments.length > 0) { + this.trailingComments = trailingComments; + } + + bottomRight.push(this); + }, + + finish: function () { + if (extra.range) { + this.range[1] = lastIndex; + } + if (extra.loc) { + this.loc.end = { + line: lastLineNumber, + column: lastIndex - lastLineStart + }; + if (extra.source) { + this.loc.source = extra.source; + } + } + + if (extra.attachComment) { + this.processComment(); + } + }, + + finishArrayExpression: function (elements) { + this.type = Syntax.ArrayExpression; + this.elements = elements; + this.finish(); + return this; + }, + + finishArrayPattern: function (elements) { + this.type = Syntax.ArrayPattern; + this.elements = elements; + this.finish(); + return this; + }, + + finishArrowFunctionExpression: function (params, defaults, body, expression) { + this.type = Syntax.ArrowFunctionExpression; + this.id = null; + this.params = params; + this.defaults = defaults; + this.body = body; + this.generator = false; + this.expression = expression; + this.finish(); + return this; + }, + + finishAssignmentExpression: function (operator, left, right) { + this.type = Syntax.AssignmentExpression; + this.operator = operator; + this.left = left; + this.right = right; + this.finish(); + return this; + }, + + finishAssignmentPattern: function (left, right) { + this.type = Syntax.AssignmentPattern; + this.left = left; + this.right = right; + this.finish(); + return this; + }, + + finishBinaryExpression: function (operator, left, right) { + this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression; + this.operator = operator; + this.left = left; + this.right = right; + this.finish(); + return this; + }, + + finishBlockStatement: function (body) { + this.type = Syntax.BlockStatement; + this.body = body; + this.finish(); + return this; + }, + + finishBreakStatement: function (label) { + this.type = Syntax.BreakStatement; + this.label = label; + this.finish(); + return this; + }, + + finishCallExpression: function (callee, args) { + this.type = Syntax.CallExpression; + this.callee = callee; + this.arguments = args; + this.finish(); + return this; + }, + + finishCatchClause: function (param, body) { + this.type = Syntax.CatchClause; + this.param = param; + this.body = body; + this.finish(); + return this; + }, + + finishClassBody: function (body) { + this.type = Syntax.ClassBody; + this.body = body; + this.finish(); + return this; + }, + + finishClassDeclaration: function (id, superClass, body) { + this.type = Syntax.ClassDeclaration; + this.id = id; + this.superClass = superClass; + this.body = body; + this.finish(); + return this; + }, + + finishClassExpression: function (id, superClass, body) { + this.type = Syntax.ClassExpression; + this.id = id; + this.superClass = superClass; + this.body = body; + this.finish(); + return this; + }, + + finishConditionalExpression: function (test, consequent, alternate) { + this.type = Syntax.ConditionalExpression; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + this.finish(); + return this; + }, + + finishContinueStatement: function (label) { + this.type = Syntax.ContinueStatement; + this.label = label; + this.finish(); + return this; + }, + + finishDebuggerStatement: function () { + this.type = Syntax.DebuggerStatement; + this.finish(); + return this; + }, + + finishDoWhileStatement: function (body, test) { + this.type = Syntax.DoWhileStatement; + this.body = body; + this.test = test; + this.finish(); + return this; + }, + + finishEmptyStatement: function () { + this.type = Syntax.EmptyStatement; + this.finish(); + return this; + }, + + finishExpressionStatement: function (expression) { + this.type = Syntax.ExpressionStatement; + this.expression = expression; + this.finish(); + return this; + }, + + finishForStatement: function (init, test, update, body) { + this.type = Syntax.ForStatement; + this.init = init; + this.test = test; + this.update = update; + this.body = body; + this.finish(); + return this; + }, + + finishForInStatement: function (left, right, body) { + this.type = Syntax.ForInStatement; + this.left = left; + this.right = right; + this.body = body; + this.each = false; + this.finish(); + return this; + }, + + finishFunctionDeclaration: function (id, params, defaults, body) { + this.type = Syntax.FunctionDeclaration; + this.id = id; + this.params = params; + this.defaults = defaults; + this.body = body; + this.generator = false; + this.expression = false; + this.finish(); + return this; + }, + + finishFunctionExpression: function (id, params, defaults, body) { + this.type = Syntax.FunctionExpression; + this.id = id; + this.params = params; + this.defaults = defaults; + this.body = body; + this.generator = false; + this.expression = false; + this.finish(); + return this; + }, + + finishIdentifier: function (name) { + this.type = Syntax.Identifier; + this.name = name; + this.finish(); + return this; + }, + + finishIfStatement: function (test, consequent, alternate) { + this.type = Syntax.IfStatement; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + this.finish(); + return this; + }, + + finishLabeledStatement: function (label, body) { + this.type = Syntax.LabeledStatement; + this.label = label; + this.body = body; + this.finish(); + return this; + }, + + finishLiteral: function (token) { + this.type = Syntax.Literal; + this.value = token.value; + this.raw = source.slice(token.start, token.end); + if (token.regex) { + this.regex = token.regex; + } + this.finish(); + return this; + }, + + finishMemberExpression: function (accessor, object, property) { + this.type = Syntax.MemberExpression; + this.computed = accessor === '['; + this.object = object; + this.property = property; + this.finish(); + return this; + }, + + finishNewExpression: function (callee, args) { + this.type = Syntax.NewExpression; + this.callee = callee; + this.arguments = args; + this.finish(); + return this; + }, + + finishObjectExpression: function (properties) { + this.type = Syntax.ObjectExpression; + this.properties = properties; + this.finish(); + return this; + }, + + finishObjectPattern: function (properties) { + this.type = Syntax.ObjectPattern; + this.properties = properties; + this.finish(); + return this; + }, + + finishPostfixExpression: function (operator, argument) { + this.type = Syntax.UpdateExpression; + this.operator = operator; + this.argument = argument; + this.prefix = false; + this.finish(); + return this; + }, + + finishProgram: function (body) { + this.type = Syntax.Program; + this.body = body; + if (sourceType === 'module') { + // very restrictive for now + this.sourceType = sourceType; + } + this.finish(); + return this; + }, + + finishProperty: function (kind, key, computed, value, method, shorthand) { + this.type = Syntax.Property; + this.key = key; + this.computed = computed; + this.value = value; + this.kind = kind; + this.method = method; + this.shorthand = shorthand; + this.finish(); + return this; + }, + + finishRestElement: function (argument) { + this.type = Syntax.RestElement; + this.argument = argument; + this.finish(); + return this; + }, + + finishReturnStatement: function (argument) { + this.type = Syntax.ReturnStatement; + this.argument = argument; + this.finish(); + return this; + }, + + finishSequenceExpression: function (expressions) { + this.type = Syntax.SequenceExpression; + this.expressions = expressions; + this.finish(); + return this; + }, + + finishSpreadElement: function (argument) { + this.type = Syntax.SpreadElement; + this.argument = argument; + this.finish(); + return this; + }, + + finishSwitchCase: function (test, consequent) { + this.type = Syntax.SwitchCase; + this.test = test; + this.consequent = consequent; + this.finish(); + return this; + }, + + finishSuper: function () { + this.type = Syntax.Super; + this.finish(); + return this; + }, + + finishSwitchStatement: function (discriminant, cases) { + this.type = Syntax.SwitchStatement; + this.discriminant = discriminant; + this.cases = cases; + this.finish(); + return this; + }, + + finishTaggedTemplateExpression: function (tag, quasi) { + this.type = Syntax.TaggedTemplateExpression; + this.tag = tag; + this.quasi = quasi; + this.finish(); + return this; + }, + + finishTemplateElement: function (value, tail) { + this.type = Syntax.TemplateElement; + this.value = value; + this.tail = tail; + this.finish(); + return this; + }, + + finishTemplateLiteral: function (quasis, expressions) { + this.type = Syntax.TemplateLiteral; + this.quasis = quasis; + this.expressions = expressions; + this.finish(); + return this; + }, + + finishThisExpression: function () { + this.type = Syntax.ThisExpression; + this.finish(); + return this; + }, + + finishThrowStatement: function (argument) { + this.type = Syntax.ThrowStatement; + this.argument = argument; + this.finish(); + return this; + }, + + finishTryStatement: function (block, handler, finalizer) { + this.type = Syntax.TryStatement; + this.block = block; + this.guardedHandlers = []; + this.handlers = handler ? [ handler ] : []; + this.handler = handler; + this.finalizer = finalizer; + this.finish(); + return this; + }, + + finishUnaryExpression: function (operator, argument) { + this.type = (operator === '++' || operator === '--') ? Syntax.UpdateExpression : Syntax.UnaryExpression; + this.operator = operator; + this.argument = argument; + this.prefix = true; + this.finish(); + return this; + }, + + finishVariableDeclaration: function (declarations) { + this.type = Syntax.VariableDeclaration; + this.declarations = declarations; + this.kind = 'var'; + this.finish(); + return this; + }, + + finishLexicalDeclaration: function (declarations, kind) { + this.type = Syntax.VariableDeclaration; + this.declarations = declarations; + this.kind = kind; + this.finish(); + return this; + }, + + finishVariableDeclarator: function (id, init) { + this.type = Syntax.VariableDeclarator; + this.id = id; + this.init = init; + this.finish(); + return this; + }, + + finishWhileStatement: function (test, body) { + this.type = Syntax.WhileStatement; + this.test = test; + this.body = body; + this.finish(); + return this; + }, + + finishWithStatement: function (object, body) { + this.type = Syntax.WithStatement; + this.object = object; + this.body = body; + this.finish(); + return this; + }, + + finishExportSpecifier: function (local, exported) { + this.type = Syntax.ExportSpecifier; + this.exported = exported || local; + this.local = local; + this.finish(); + return this; + }, + + finishImportDefaultSpecifier: function (local) { + this.type = Syntax.ImportDefaultSpecifier; + this.local = local; + this.finish(); + return this; + }, + + finishImportNamespaceSpecifier: function (local) { + this.type = Syntax.ImportNamespaceSpecifier; + this.local = local; + this.finish(); + return this; + }, + + finishExportNamedDeclaration: function (declaration, specifiers, src) { + this.type = Syntax.ExportNamedDeclaration; + this.declaration = declaration; + this.specifiers = specifiers; + this.source = src; + this.finish(); + return this; + }, + + finishExportDefaultDeclaration: function (declaration) { + this.type = Syntax.ExportDefaultDeclaration; + this.declaration = declaration; + this.finish(); + return this; + }, + + finishExportAllDeclaration: function (src) { + this.type = Syntax.ExportAllDeclaration; + this.source = src; + this.finish(); + return this; + }, + + finishImportSpecifier: function (local, imported) { + this.type = Syntax.ImportSpecifier; + this.local = local || imported; + this.imported = imported; + this.finish(); + return this; + }, + + finishImportDeclaration: function (specifiers, src) { + this.type = Syntax.ImportDeclaration; + this.specifiers = specifiers; + this.source = src; + this.finish(); + return this; + } + }; + + + function recordError(error) { + var e, existing; + + for (e = 0; e < extra.errors.length; e++) { + existing = extra.errors[e]; + // Prevent duplicated error. + /* istanbul ignore next */ + if (existing.index === error.index && existing.message === error.message) { + return; + } + } + + extra.errors.push(error); + } + + function createError(line, pos, description) { + var error = new Error('Line ' + line + ': ' + description); + error.index = pos; + error.lineNumber = line; + error.column = pos - (scanning ? lineStart : lastLineStart) + 1; + error.description = description; + return error; + } + + // Throw an exception + + function throwError(messageFormat) { + var args, msg; + + args = Array.prototype.slice.call(arguments, 1); + msg = messageFormat.replace(/%(\d)/g, + function (whole, idx) { + assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + } + ); + + throw createError(lastLineNumber, lastIndex, msg); + } + + function tolerateError(messageFormat) { + var args, msg, error; + + args = Array.prototype.slice.call(arguments, 1); + /* istanbul ignore next */ + msg = messageFormat.replace(/%(\d)/g, + function (whole, idx) { + assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + } + ); + + error = createError(lineNumber, lastIndex, msg); + if (extra.errors) { + recordError(error); + } else { + throw error; + } + } + + // Throw an exception because of the token. + + function unexpectedTokenError(token, message) { + var value, msg = message || Messages.UnexpectedToken; + + if (token) { + if (!message) { + msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS : + (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier : + (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber : + (token.type === Token.StringLiteral) ? Messages.UnexpectedString : + (token.type === Token.Template) ? Messages.UnexpectedTemplate : + Messages.UnexpectedToken; + + if (token.type === Token.Keyword) { + if (isFutureReservedWord(token.value)) { + msg = Messages.UnexpectedReserved; + } else if (strict && isStrictModeReservedWord(token.value)) { + msg = Messages.StrictReservedWord; + } + } + } + + value = (token.type === Token.Template) ? token.value.raw : token.value; + } else { + value = 'ILLEGAL'; + } + + msg = msg.replace('%0', value); + + return (token && typeof token.lineNumber === 'number') ? + createError(token.lineNumber, token.start, msg) : + createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg); + } + + function throwUnexpectedToken(token, message) { + throw unexpectedTokenError(token, message); + } + + function tolerateUnexpectedToken(token, message) { + var error = unexpectedTokenError(token, message); + if (extra.errors) { + recordError(error); + } else { + throw error; + } + } + + // Expect the next token to match the specified punctuator. + // If not, an exception will be thrown. + + function expect(value) { + var token = lex(); + if (token.type !== Token.Punctuator || token.value !== value) { + throwUnexpectedToken(token); + } + } + + /** + * @name expectCommaSeparator + * @description Quietly expect a comma when in tolerant mode, otherwise delegates + * to expect(value) + * @since 2.0 + */ + function expectCommaSeparator() { + var token; + + if (extra.errors) { + token = lookahead; + if (token.type === Token.Punctuator && token.value === ',') { + lex(); + } else if (token.type === Token.Punctuator && token.value === ';') { + lex(); + tolerateUnexpectedToken(token); + } else { + tolerateUnexpectedToken(token, Messages.UnexpectedToken); + } + } else { + expect(','); + } + } + + // Expect the next token to match the specified keyword. + // If not, an exception will be thrown. + + function expectKeyword(keyword) { + var token = lex(); + if (token.type !== Token.Keyword || token.value !== keyword) { + throwUnexpectedToken(token); + } + } + + // Return true if the next token matches the specified punctuator. + + function match(value) { + return lookahead.type === Token.Punctuator && lookahead.value === value; + } + + // Return true if the next token matches the specified keyword + + function matchKeyword(keyword) { + return lookahead.type === Token.Keyword && lookahead.value === keyword; + } + + // Return true if the next token matches the specified contextual keyword + // (where an identifier is sometimes a keyword depending on the context) + + function matchContextualKeyword(keyword) { + return lookahead.type === Token.Identifier && lookahead.value === keyword; + } + + // Return true if the next token is an assignment operator + + function matchAssign() { + var op; + + if (lookahead.type !== Token.Punctuator) { + return false; + } + op = lookahead.value; + return op === '=' || + op === '*=' || + op === '/=' || + op === '%=' || + op === '+=' || + op === '-=' || + op === '<<=' || + op === '>>=' || + op === '>>>=' || + op === '&=' || + op === '^=' || + op === '|='; + } + + function consumeSemicolon() { + // Catch the very common case first: immediately a semicolon (U+003B). + if (source.charCodeAt(startIndex) === 0x3B || match(';')) { + lex(); + return; + } + + if (hasLineTerminator) { + return; + } + + // FIXME(ikarienator): this is seemingly an issue in the previous location info convention. + lastIndex = startIndex; + lastLineNumber = startLineNumber; + lastLineStart = startLineStart; + + if (lookahead.type !== Token.EOF && !match('}')) { + throwUnexpectedToken(lookahead); + } + } + + // Cover grammar support. + // + // When an assignment expression position starts with an left parenthesis, the determination of the type + // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) + // or the first comma. This situation also defers the determination of all the expressions nested in the pair. + // + // There are three productions that can be parsed in a parentheses pair that needs to be determined + // after the outermost pair is closed. They are: + // + // 1. AssignmentExpression + // 2. BindingElements + // 3. AssignmentTargets + // + // In order to avoid exponential backtracking, we use two flags to denote if the production can be + // binding element or assignment target. + // + // The three productions have the relationship: + // + // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression + // + // with a single exception that CoverInitializedName when used directly in an Expression, generates + // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the + // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. + // + // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not + // effect the current flags. This means the production the parser parses is only used as an expression. Therefore + // the CoverInitializedName check is conducted. + // + // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates + // the flags outside of the parser. This means the production the parser parses is used as a part of a potential + // pattern. The CoverInitializedName check is deferred. + function isolateCoverGrammar(parser) { + var oldIsBindingElement = isBindingElement, + oldIsAssignmentTarget = isAssignmentTarget, + oldFirstCoverInitializedNameError = firstCoverInitializedNameError, + result; + isBindingElement = true; + isAssignmentTarget = true; + firstCoverInitializedNameError = null; + result = parser(); + if (firstCoverInitializedNameError !== null) { + throwUnexpectedToken(firstCoverInitializedNameError); + } + isBindingElement = oldIsBindingElement; + isAssignmentTarget = oldIsAssignmentTarget; + firstCoverInitializedNameError = oldFirstCoverInitializedNameError; + return result; + } + + function inheritCoverGrammar(parser) { + var oldIsBindingElement = isBindingElement, + oldIsAssignmentTarget = isAssignmentTarget, + oldFirstCoverInitializedNameError = firstCoverInitializedNameError, + result; + isBindingElement = true; + isAssignmentTarget = true; + firstCoverInitializedNameError = null; + result = parser(); + isBindingElement = isBindingElement && oldIsBindingElement; + isAssignmentTarget = isAssignmentTarget && oldIsAssignmentTarget; + firstCoverInitializedNameError = oldFirstCoverInitializedNameError || firstCoverInitializedNameError; + return result; + } + + function parseArrayPattern() { + var node = new Node(), elements = [], rest, restNode; + expect('['); + + while (!match(']')) { + if (match(',')) { + lex(); + elements.push(null); + } else { + if (match('...')) { + restNode = new Node(); + lex(); + rest = parseVariableIdentifier(); + elements.push(restNode.finishRestElement(rest)); + break; + } else { + elements.push(parsePatternWithDefault()); + } + if (!match(']')) { + expect(','); + } + } + + } + + expect(']'); + + return node.finishArrayPattern(elements); + } + + function parsePropertyPattern() { + var node = new Node(), key, computed = match('['), init; + if (lookahead.type === Token.Identifier) { + key = parseVariableIdentifier(); + if (match('=')) { + lex(); + init = parseAssignmentExpression(); + return node.finishProperty( + 'init', key, false, + new WrappingNode(key).finishAssignmentPattern(key, init), false, false); + } else if (!match(':')) { + return node.finishProperty('init', key, false, key, false, true); + } + } else { + key = parseObjectPropertyKey(); + } + expect(':'); + init = parsePatternWithDefault(); + return node.finishProperty('init', key, computed, init, false, false); + } + + function parseObjectPattern() { + var node = new Node(), properties = []; + + expect('{'); + + while (!match('}')) { + properties.push(parsePropertyPattern()); + if (!match('}')) { + expect(','); + } + } + + lex(); + + return node.finishObjectPattern(properties); + } + + function parsePattern() { + if (lookahead.type === Token.Identifier) { + return parseVariableIdentifier(); + } else if (match('[')) { + return parseArrayPattern(); + } else if (match('{')) { + return parseObjectPattern(); + } + throwUnexpectedToken(lookahead); + } + + function parsePatternWithDefault() { + var startToken = lookahead, pattern, right; + pattern = parsePattern(); + if (match('=')) { + lex(); + right = isolateCoverGrammar(parseAssignmentExpression); + pattern = new WrappingNode(startToken).finishAssignmentPattern(pattern, right); + } + return pattern; + } + + // 11.1.4 Array Initialiser + + function parseArrayInitialiser() { + var elements = [], node = new Node(), restSpread; + + expect('['); + + while (!match(']')) { + if (match(',')) { + lex(); + elements.push(null); + } else if (match('...')) { + restSpread = new Node(); + lex(); + restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression)); + + if (!match(']')) { + isAssignmentTarget = isBindingElement = false; + expect(','); + } + elements.push(restSpread); + } else { + elements.push(inheritCoverGrammar(parseAssignmentExpression)); + + if (!match(']')) { + expect(','); + } + } + } + + lex(); + + return node.finishArrayExpression(elements); + } + + // 11.1.5 Object Initialiser + + function parsePropertyFunction(node, paramInfo) { + var previousStrict, body; + + isAssignmentTarget = isBindingElement = false; + + previousStrict = strict; + body = isolateCoverGrammar(parseFunctionSourceElements); + + if (strict && paramInfo.firstRestricted) { + tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message); + } + if (strict && paramInfo.stricted) { + tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message); + } + + strict = previousStrict; + return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body); + } + + function parsePropertyMethodFunction() { + var params, method, node = new Node(); + + params = parseParams(); + method = parsePropertyFunction(node, params); + + return method; + } + + function parseObjectPropertyKey() { + var token, node = new Node(), expr; + + token = lex(); + + // Note: This function is called only from parseObjectProperty(), where + // EOF and Punctuator tokens are already filtered out. + + switch (token.type) { + case Token.StringLiteral: + case Token.NumericLiteral: + if (strict && token.octal) { + tolerateUnexpectedToken(token, Messages.StrictOctalLiteral); + } + return node.finishLiteral(token); + case Token.Identifier: + case Token.BooleanLiteral: + case Token.NullLiteral: + case Token.Keyword: + return node.finishIdentifier(token.value); + case Token.Punctuator: + if (token.value === '[') { + expr = isolateCoverGrammar(parseAssignmentExpression); + expect(']'); + return expr; + } + break; + } + throwUnexpectedToken(token); + } + + function lookaheadPropertyName() { + switch (lookahead.type) { + case Token.Identifier: + case Token.StringLiteral: + case Token.BooleanLiteral: + case Token.NullLiteral: + case Token.NumericLiteral: + case Token.Keyword: + return true; + case Token.Punctuator: + return lookahead.value === '['; + } + return false; + } + + // This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals, + // it might be called at a position where there is in fact a short hand identifier pattern or a data property. + // This can only be determined after we consumed up to the left parentheses. + // + // In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller + // is responsible to visit other options. + function tryParseMethodDefinition(token, key, computed, node) { + var value, options, methodNode; + + if (token.type === Token.Identifier) { + // check for `get` and `set`; + + if (token.value === 'get' && lookaheadPropertyName()) { + computed = match('['); + key = parseObjectPropertyKey(); + methodNode = new Node(); + expect('('); + expect(')'); + value = parsePropertyFunction(methodNode, { + params: [], + defaults: [], + stricted: null, + firstRestricted: null, + message: null + }); + return node.finishProperty('get', key, computed, value, false, false); + } else if (token.value === 'set' && lookaheadPropertyName()) { + computed = match('['); + key = parseObjectPropertyKey(); + methodNode = new Node(); + expect('('); + + options = { + params: [], + defaultCount: 0, + defaults: [], + firstRestricted: null, + paramSet: {} + }; + if (match(')')) { + tolerateUnexpectedToken(lookahead); + } else { + parseParam(options); + if (options.defaultCount === 0) { + options.defaults = []; + } + } + expect(')'); + + value = parsePropertyFunction(methodNode, options); + return node.finishProperty('set', key, computed, value, false, false); + } + } + + if (match('(')) { + value = parsePropertyMethodFunction(); + return node.finishProperty('init', key, computed, value, true, false); + } + + // Not a MethodDefinition. + return null; + } + + function checkProto(key, computed, hasProto) { + if (computed === false && (key.type === Syntax.Identifier && key.name === '__proto__' || + key.type === Syntax.Literal && key.value === '__proto__')) { + if (hasProto.value) { + tolerateError(Messages.DuplicateProtoProperty); + } else { + hasProto.value = true; + } + } + } + + function parseObjectProperty(hasProto) { + var token = lookahead, node = new Node(), computed, key, maybeMethod, value; + + computed = match('['); + key = parseObjectPropertyKey(); + maybeMethod = tryParseMethodDefinition(token, key, computed, node); + + if (maybeMethod) { + checkProto(maybeMethod.key, maybeMethod.computed, hasProto); + // finished + return maybeMethod; + } + + // init property or short hand property. + checkProto(key, computed, hasProto); + + if (match(':')) { + lex(); + value = inheritCoverGrammar(parseAssignmentExpression); + return node.finishProperty('init', key, computed, value, false, false); + } + + if (token.type === Token.Identifier) { + if (match('=')) { + firstCoverInitializedNameError = lookahead; + lex(); + value = isolateCoverGrammar(parseAssignmentExpression); + return node.finishProperty('init', key, computed, + new WrappingNode(token).finishAssignmentPattern(key, value), false, true); + } + return node.finishProperty('init', key, computed, key, false, true); + } + + throwUnexpectedToken(lookahead); + } + + function parseObjectInitialiser() { + var properties = [], hasProto = {value: false}, node = new Node(); + + expect('{'); + + while (!match('}')) { + properties.push(parseObjectProperty(hasProto)); + + if (!match('}')) { + expectCommaSeparator(); + } + } + + expect('}'); + + return node.finishObjectExpression(properties); + } + + function reinterpretExpressionAsPattern(expr) { + var i; + switch (expr.type) { + case Syntax.Identifier: + case Syntax.MemberExpression: + case Syntax.RestElement: + case Syntax.AssignmentPattern: + break; + case Syntax.SpreadElement: + expr.type = Syntax.RestElement; + reinterpretExpressionAsPattern(expr.argument); + break; + case Syntax.ArrayExpression: + expr.type = Syntax.ArrayPattern; + for (i = 0; i < expr.elements.length; i++) { + if (expr.elements[i] !== null) { + reinterpretExpressionAsPattern(expr.elements[i]); + } + } + break; + case Syntax.ObjectExpression: + expr.type = Syntax.ObjectPattern; + for (i = 0; i < expr.properties.length; i++) { + reinterpretExpressionAsPattern(expr.properties[i].value); + } + break; + case Syntax.AssignmentExpression: + expr.type = Syntax.AssignmentPattern; + reinterpretExpressionAsPattern(expr.left); + break; + default: + // Allow other node type for tolerant parsing. + break; + } + } + + function parseTemplateElement(option) { + var node, token; + + if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) { + throwUnexpectedToken(); + } + + node = new Node(); + token = lex(); + + return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail); + } + + function parseTemplateLiteral() { + var quasi, quasis, expressions, node = new Node(); + + quasi = parseTemplateElement({ head: true }); + quasis = [ quasi ]; + expressions = []; + + while (!quasi.tail) { + expressions.push(parseExpression()); + quasi = parseTemplateElement({ head: false }); + quasis.push(quasi); + } + + return node.finishTemplateLiteral(quasis, expressions); + } + + // 11.1.6 The Grouping Operator + + function parseGroupExpression() { + var expr, expressions, startToken, i; + + expect('('); + + if (match(')')) { + lex(); + if (!match('=>')) { + expect('=>'); + } + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: [] + }; + } + + startToken = lookahead; + if (match('...')) { + expr = parseRestElement(); + expect(')'); + if (!match('=>')) { + expect('=>'); + } + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: [expr] + }; + } + + isBindingElement = true; + expr = inheritCoverGrammar(parseAssignmentExpression); + + if (match(',')) { + isAssignmentTarget = false; + expressions = [expr]; + + while (startIndex < length) { + if (!match(',')) { + break; + } + lex(); + + if (match('...')) { + if (!isBindingElement) { + throwUnexpectedToken(lookahead); + } + expressions.push(parseRestElement()); + expect(')'); + if (!match('=>')) { + expect('=>'); + } + isBindingElement = false; + for (i = 0; i < expressions.length; i++) { + reinterpretExpressionAsPattern(expressions[i]); + } + return { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: expressions + }; + } + + expressions.push(inheritCoverGrammar(parseAssignmentExpression)); + } + + expr = new WrappingNode(startToken).finishSequenceExpression(expressions); + } + + + expect(')'); + + if (match('=>')) { + if (!isBindingElement) { + throwUnexpectedToken(lookahead); + } + + if (expr.type === Syntax.SequenceExpression) { + for (i = 0; i < expr.expressions.length; i++) { + reinterpretExpressionAsPattern(expr.expressions[i]); + } + } else { + reinterpretExpressionAsPattern(expr); + } + + expr = { + type: PlaceHolders.ArrowParameterPlaceHolder, + params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr] + }; + } + isBindingElement = false; + return expr; + } + + + // 11.1 Primary Expressions + + function parsePrimaryExpression() { + var type, token, expr, node; + + if (match('(')) { + isBindingElement = false; + return inheritCoverGrammar(parseGroupExpression); + } + + if (match('[')) { + return inheritCoverGrammar(parseArrayInitialiser); + } + + if (match('{')) { + return inheritCoverGrammar(parseObjectInitialiser); + } + + type = lookahead.type; + node = new Node(); + + if (type === Token.Identifier) { + expr = node.finishIdentifier(lex().value); + } else if (type === Token.StringLiteral || type === Token.NumericLiteral) { + isAssignmentTarget = isBindingElement = false; + if (strict && lookahead.octal) { + tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral); + } + expr = node.finishLiteral(lex()); + } else if (type === Token.Keyword) { + isAssignmentTarget = isBindingElement = false; + if (matchKeyword('function')) { + return parseFunctionExpression(); + } + if (matchKeyword('this')) { + lex(); + return node.finishThisExpression(); + } + if (matchKeyword('class')) { + return parseClassExpression(); + } + throwUnexpectedToken(lex()); + } else if (type === Token.BooleanLiteral) { + isAssignmentTarget = isBindingElement = false; + token = lex(); + token.value = (token.value === 'true'); + expr = node.finishLiteral(token); + } else if (type === Token.NullLiteral) { + isAssignmentTarget = isBindingElement = false; + token = lex(); + token.value = null; + expr = node.finishLiteral(token); + } else if (match('/') || match('/=')) { + isAssignmentTarget = isBindingElement = false; + index = startIndex; + + if (typeof extra.tokens !== 'undefined') { + token = collectRegex(); + } else { + token = scanRegExp(); + } + lex(); + expr = node.finishLiteral(token); + } else if (type === Token.Template) { + expr = parseTemplateLiteral(); + } else { + throwUnexpectedToken(lex()); + } + + return expr; + } + + // 11.2 Left-Hand-Side Expressions + + function parseArguments() { + var args = []; + + expect('('); + + if (!match(')')) { + while (startIndex < length) { + args.push(isolateCoverGrammar(parseAssignmentExpression)); + if (match(')')) { + break; + } + expectCommaSeparator(); + } + } + + expect(')'); + + return args; + } + + function parseNonComputedProperty() { + var token, node = new Node(); + + token = lex(); + + if (!isIdentifierName(token)) { + throwUnexpectedToken(token); + } + + return node.finishIdentifier(token.value); + } + + function parseNonComputedMember() { + expect('.'); + + return parseNonComputedProperty(); + } + + function parseComputedMember() { + var expr; + + expect('['); + + expr = isolateCoverGrammar(parseExpression); + + expect(']'); + + return expr; + } + + function parseNewExpression() { + var callee, args, node = new Node(); + + expectKeyword('new'); + callee = isolateCoverGrammar(parseLeftHandSideExpression); + args = match('(') ? parseArguments() : []; + + isAssignmentTarget = isBindingElement = false; + + return node.finishNewExpression(callee, args); + } + + function parseLeftHandSideExpressionAllowCall() { + var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn; + + startToken = lookahead; + state.allowIn = true; + + if (matchKeyword('super') && state.inFunctionBody) { + expr = new Node(); + lex(); + expr = expr.finishSuper(); + if (!match('(') && !match('.') && !match('[')) { + throwUnexpectedToken(lookahead); + } + } else { + expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression); + } + + for (;;) { + if (match('.')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseNonComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property); + } else if (match('(')) { + isBindingElement = false; + isAssignmentTarget = false; + args = parseArguments(); + expr = new WrappingNode(startToken).finishCallExpression(expr, args); + } else if (match('[')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property); + } else if (lookahead.type === Token.Template && lookahead.head) { + quasi = parseTemplateLiteral(); + expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi); + } else { + break; + } + } + state.allowIn = previousAllowIn; + + return expr; + } + + function parseLeftHandSideExpression() { + var quasi, expr, property, startToken; + assert(state.allowIn, 'callee of new expression always allow in keyword.'); + + startToken = lookahead; + + if (matchKeyword('super') && state.inFunctionBody) { + expr = new Node(); + lex(); + expr = expr.finishSuper(); + if (!match('[') && !match('.')) { + throwUnexpectedToken(lookahead); + } + } else { + expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression); + } + + for (;;) { + if (match('[')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property); + } else if (match('.')) { + isBindingElement = false; + isAssignmentTarget = true; + property = parseNonComputedMember(); + expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property); + } else if (lookahead.type === Token.Template && lookahead.head) { + quasi = parseTemplateLiteral(); + expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi); + } else { + break; + } + } + return expr; + } + + // 11.3 Postfix Expressions + + function parsePostfixExpression() { + var expr, token, startToken = lookahead; + + expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall); + + if (!hasLineTerminator && lookahead.type === Token.Punctuator) { + if (match('++') || match('--')) { + // 11.3.1, 11.3.2 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + tolerateError(Messages.StrictLHSPostfix); + } + + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInAssignment); + } + + isAssignmentTarget = isBindingElement = false; + + token = lex(); + expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr); + } + } + + return expr; + } + + // 11.4 Unary Operators + + function parseUnaryExpression() { + var token, expr, startToken; + + if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) { + expr = parsePostfixExpression(); + } else if (match('++') || match('--')) { + startToken = lookahead; + token = lex(); + expr = inheritCoverGrammar(parseUnaryExpression); + // 11.4.4, 11.4.5 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + tolerateError(Messages.StrictLHSPrefix); + } + + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInAssignment); + } + expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); + isAssignmentTarget = isBindingElement = false; + } else if (match('+') || match('-') || match('~') || match('!')) { + startToken = lookahead; + token = lex(); + expr = inheritCoverGrammar(parseUnaryExpression); + expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); + isAssignmentTarget = isBindingElement = false; + } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { + startToken = lookahead; + token = lex(); + expr = inheritCoverGrammar(parseUnaryExpression); + expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); + if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) { + tolerateError(Messages.StrictDelete); + } + isAssignmentTarget = isBindingElement = false; + } else { + expr = parsePostfixExpression(); + } + + return expr; + } + + function binaryPrecedence(token, allowIn) { + var prec = 0; + + if (token.type !== Token.Punctuator && token.type !== Token.Keyword) { + return 0; + } + + switch (token.value) { + case '||': + prec = 1; + break; + + case '&&': + prec = 2; + break; + + case '|': + prec = 3; + break; + + case '^': + prec = 4; + break; + + case '&': + prec = 5; + break; + + case '==': + case '!=': + case '===': + case '!==': + prec = 6; + break; + + case '<': + case '>': + case '<=': + case '>=': + case 'instanceof': + prec = 7; + break; + + case 'in': + prec = allowIn ? 7 : 0; + break; + + case '<<': + case '>>': + case '>>>': + prec = 8; + break; + + case '+': + case '-': + prec = 9; + break; + + case '*': + case '/': + case '%': + prec = 11; + break; + + default: + break; + } + + return prec; + } + + // 11.5 Multiplicative Operators + // 11.6 Additive Operators + // 11.7 Bitwise Shift Operators + // 11.8 Relational Operators + // 11.9 Equality Operators + // 11.10 Binary Bitwise Operators + // 11.11 Binary Logical Operators + + function parseBinaryExpression() { + var marker, markers, expr, token, prec, stack, right, operator, left, i; + + marker = lookahead; + left = inheritCoverGrammar(parseUnaryExpression); + + token = lookahead; + prec = binaryPrecedence(token, state.allowIn); + if (prec === 0) { + return left; + } + isAssignmentTarget = isBindingElement = false; + token.prec = prec; + lex(); + + markers = [marker, lookahead]; + right = isolateCoverGrammar(parseUnaryExpression); + + stack = [left, token, right]; + + while ((prec = binaryPrecedence(lookahead, state.allowIn)) > 0) { + + // Reduce: make a binary expression from the three topmost entries. + while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { + right = stack.pop(); + operator = stack.pop().value; + left = stack.pop(); + markers.pop(); + expr = new WrappingNode(markers[markers.length - 1]).finishBinaryExpression(operator, left, right); + stack.push(expr); + } + + // Shift. + token = lex(); + token.prec = prec; + stack.push(token); + markers.push(lookahead); + expr = isolateCoverGrammar(parseUnaryExpression); + stack.push(expr); + } + + // Final reduce to clean-up the stack. + i = stack.length - 1; + expr = stack[i]; + markers.pop(); + while (i > 1) { + expr = new WrappingNode(markers.pop()).finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); + i -= 2; + } + + return expr; + } + + + // 11.12 Conditional Operator + + function parseConditionalExpression() { + var expr, previousAllowIn, consequent, alternate, startToken; + + startToken = lookahead; + + expr = inheritCoverGrammar(parseBinaryExpression); + if (match('?')) { + lex(); + previousAllowIn = state.allowIn; + state.allowIn = true; + consequent = isolateCoverGrammar(parseAssignmentExpression); + state.allowIn = previousAllowIn; + expect(':'); + alternate = isolateCoverGrammar(parseAssignmentExpression); + + expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate); + isAssignmentTarget = isBindingElement = false; + } + + return expr; + } + + // [ES6] 14.2 Arrow Function + + function parseConciseBody() { + if (match('{')) { + return parseFunctionSourceElements(); + } + return isolateCoverGrammar(parseAssignmentExpression); + } + + function checkPatternParam(options, param) { + var i; + switch (param.type) { + case Syntax.Identifier: + validateParam(options, param, param.name); + break; + case Syntax.RestElement: + checkPatternParam(options, param.argument); + break; + case Syntax.AssignmentPattern: + checkPatternParam(options, param.left); + break; + case Syntax.ArrayPattern: + for (i = 0; i < param.elements.length; i++) { + if (param.elements[i] !== null) { + checkPatternParam(options, param.elements[i]); + } + } + break; + default: + assert(param.type === Syntax.ObjectPattern, 'Invalid type'); + for (i = 0; i < param.properties.length; i++) { + checkPatternParam(options, param.properties[i].value); + } + break; + } + } + function reinterpretAsCoverFormalsList(expr) { + var i, len, param, params, defaults, defaultCount, options, token; + + defaults = []; + defaultCount = 0; + params = [expr]; + + switch (expr.type) { + case Syntax.Identifier: + break; + case PlaceHolders.ArrowParameterPlaceHolder: + params = expr.params; + break; + default: + return null; + } + + options = { + paramSet: {} + }; + + for (i = 0, len = params.length; i < len; i += 1) { + param = params[i]; + switch (param.type) { + case Syntax.AssignmentPattern: + params[i] = param.left; + defaults.push(param.right); + ++defaultCount; + checkPatternParam(options, param.left); + break; + default: + checkPatternParam(options, param); + params[i] = param; + defaults.push(null); + break; + } + } + + if (options.message === Messages.StrictParamDupe) { + token = strict ? options.stricted : options.firstRestricted; + throwUnexpectedToken(token, options.message); + } + + if (defaultCount === 0) { + defaults = []; + } + + return { + params: params, + defaults: defaults, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + } + + function parseArrowFunctionExpression(options, node) { + var previousStrict, body; + + if (hasLineTerminator) { + tolerateUnexpectedToken(lookahead); + } + expect('=>'); + previousStrict = strict; + + body = parseConciseBody(); + + if (strict && options.firstRestricted) { + throwUnexpectedToken(options.firstRestricted, options.message); + } + if (strict && options.stricted) { + tolerateUnexpectedToken(options.stricted, options.message); + } + + strict = previousStrict; + + return node.finishArrowFunctionExpression(options.params, options.defaults, body, body.type !== Syntax.BlockStatement); + } + + // 11.13 Assignment Operators + + function parseAssignmentExpression() { + var token, expr, right, list, startToken; + + startToken = lookahead; + token = lookahead; + + expr = parseConditionalExpression(); + + if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) { + isAssignmentTarget = isBindingElement = false; + list = reinterpretAsCoverFormalsList(expr); + + if (list) { + firstCoverInitializedNameError = null; + return parseArrowFunctionExpression(list, new WrappingNode(startToken)); + } + + return expr; + } + + if (matchAssign()) { + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInAssignment); + } + + // 11.13.1 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + tolerateUnexpectedToken(token, Messages.StrictLHSAssignment); + } + + if (!match('=')) { + isAssignmentTarget = isBindingElement = false; + } else { + reinterpretExpressionAsPattern(expr); + } + + token = lex(); + right = isolateCoverGrammar(parseAssignmentExpression); + expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right); + firstCoverInitializedNameError = null; + } + + return expr; + } + + // 11.14 Comma Operator + + function parseExpression() { + var expr, startToken = lookahead, expressions; + + expr = isolateCoverGrammar(parseAssignmentExpression); + + if (match(',')) { + expressions = [expr]; + + while (startIndex < length) { + if (!match(',')) { + break; + } + lex(); + expressions.push(isolateCoverGrammar(parseAssignmentExpression)); + } + + expr = new WrappingNode(startToken).finishSequenceExpression(expressions); + } + + return expr; + } + + // 12.1 Block + + function parseStatementListItem() { + if (lookahead.type === Token.Keyword) { + switch (lookahead.value) { + case 'export': + if (sourceType !== 'module') { + tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration); + } + return parseExportDeclaration(); + case 'import': + if (sourceType !== 'module') { + tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration); + } + return parseImportDeclaration(); + case 'const': + case 'let': + return parseLexicalDeclaration({inFor: false}); + case 'function': + return parseFunctionDeclaration(new Node()); + case 'class': + return parseClassDeclaration(); + } + } + + return parseStatement(); + } + + function parseStatementList() { + var list = []; + while (startIndex < length) { + if (match('}')) { + break; + } + list.push(parseStatementListItem()); + } + + return list; + } + + function parseBlock() { + var block, node = new Node(); + + expect('{'); + + block = parseStatementList(); + + expect('}'); + + return node.finishBlockStatement(block); + } + + // 12.2 Variable Statement + + function parseVariableIdentifier() { + var token, node = new Node(); + + token = lex(); + + if (token.type !== Token.Identifier) { + if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) { + tolerateUnexpectedToken(token, Messages.StrictReservedWord); + } else { + throwUnexpectedToken(token); + } + } + + return node.finishIdentifier(token.value); + } + + function parseVariableDeclaration() { + var init = null, id, node = new Node(); + + id = parsePattern(); + + // 12.2.1 + if (strict && isRestrictedWord(id.name)) { + tolerateError(Messages.StrictVarName); + } + + if (match('=')) { + lex(); + init = isolateCoverGrammar(parseAssignmentExpression); + } else if (id.type !== Syntax.Identifier) { + expect('='); + } + + return node.finishVariableDeclarator(id, init); + } + + function parseVariableDeclarationList() { + var list = []; + + do { + list.push(parseVariableDeclaration()); + if (!match(',')) { + break; + } + lex(); + } while (startIndex < length); + + return list; + } + + function parseVariableStatement(node) { + var declarations; + + expectKeyword('var'); + + declarations = parseVariableDeclarationList(); + + consumeSemicolon(); + + return node.finishVariableDeclaration(declarations); + } + + function parseLexicalBinding(kind, options) { + var init = null, id, node = new Node(); + + id = parsePattern(); + + // 12.2.1 + if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) { + tolerateError(Messages.StrictVarName); + } + + if (kind === 'const') { + if (!matchKeyword('in')) { + expect('='); + init = isolateCoverGrammar(parseAssignmentExpression); + } + } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) { + expect('='); + init = isolateCoverGrammar(parseAssignmentExpression); + } + + return node.finishVariableDeclarator(id, init); + } + + function parseBindingList(kind, options) { + var list = []; + + do { + list.push(parseLexicalBinding(kind, options)); + if (!match(',')) { + break; + } + lex(); + } while (startIndex < length); + + return list; + } + + function parseLexicalDeclaration(options) { + var kind, declarations, node = new Node(); + + kind = lex().value; + assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); + + declarations = parseBindingList(kind, options); + + consumeSemicolon(); + + return node.finishLexicalDeclaration(declarations, kind); + } + + function parseRestElement() { + var param, node = new Node(); + + lex(); + + if (match('{')) { + throwError(Messages.ObjectPatternAsRestParameter); + } + + param = parseVariableIdentifier(); + + if (match('=')) { + throwError(Messages.DefaultRestParameter); + } + + if (!match(')')) { + throwError(Messages.ParameterAfterRestParameter); + } + + return node.finishRestElement(param); + } + + // 12.3 Empty Statement + + function parseEmptyStatement(node) { + expect(';'); + return node.finishEmptyStatement(); + } + + // 12.4 Expression Statement + + function parseExpressionStatement(node) { + var expr = parseExpression(); + consumeSemicolon(); + return node.finishExpressionStatement(expr); + } + + // 12.5 If statement + + function parseIfStatement(node) { + var test, consequent, alternate; + + expectKeyword('if'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + consequent = parseStatement(); + + if (matchKeyword('else')) { + lex(); + alternate = parseStatement(); + } else { + alternate = null; + } + + return node.finishIfStatement(test, consequent, alternate); + } + + // 12.6 Iteration Statements + + function parseDoWhileStatement(node) { + var body, test, oldInIteration; + + expectKeyword('do'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + if (match(';')) { + lex(); + } + + return node.finishDoWhileStatement(body, test); + } + + function parseWhileStatement(node) { + var test, body, oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + return node.finishWhileStatement(test, body); + } + + function parseForStatement(node) { + var init, initSeq, initStartToken, test, update, left, right, kind, declarations, + body, oldInIteration, previousAllowIn = state.allowIn; + + init = test = update = null; + + expectKeyword('for'); + + expect('('); + + if (match(';')) { + lex(); + } else { + if (matchKeyword('var')) { + init = new Node(); + lex(); + + state.allowIn = false; + init = init.finishVariableDeclaration(parseVariableDeclarationList()); + state.allowIn = previousAllowIn; + + if (init.declarations.length === 1 && matchKeyword('in')) { + lex(); + left = init; + right = parseExpression(); + init = null; + } else { + expect(';'); + } + } else if (matchKeyword('const') || matchKeyword('let')) { + init = new Node(); + kind = lex().value; + + state.allowIn = false; + declarations = parseBindingList(kind, {inFor: true}); + state.allowIn = previousAllowIn; + + if (declarations.length === 1 && declarations[0].init === null && matchKeyword('in')) { + init = init.finishLexicalDeclaration(declarations, kind); + lex(); + left = init; + right = parseExpression(); + init = null; + } else { + consumeSemicolon(); + init = init.finishLexicalDeclaration(declarations, kind); + } + } else { + initStartToken = lookahead; + state.allowIn = false; + init = inheritCoverGrammar(parseAssignmentExpression); + state.allowIn = previousAllowIn; + + if (matchKeyword('in')) { + if (!isAssignmentTarget) { + tolerateError(Messages.InvalidLHSInForIn); + } + + lex(); + reinterpretExpressionAsPattern(init); + left = init; + right = parseExpression(); + init = null; + } else { + if (match(',')) { + initSeq = [init]; + while (match(',')) { + lex(); + initSeq.push(isolateCoverGrammar(parseAssignmentExpression)); + } + init = new WrappingNode(initStartToken).finishSequenceExpression(initSeq); + } + expect(';'); + } + } + } + + if (typeof left === 'undefined') { + + if (!match(';')) { + test = parseExpression(); + } + expect(';'); + + if (!match(')')) { + update = parseExpression(); + } + } + + expect(')'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = isolateCoverGrammar(parseStatement); + + state.inIteration = oldInIteration; + + return (typeof left === 'undefined') ? + node.finishForStatement(init, test, update, body) : + node.finishForInStatement(left, right, body); + } + + // 12.7 The continue statement + + function parseContinueStatement(node) { + var label = null, key; + + expectKeyword('continue'); + + // Optimize the most common form: 'continue;'. + if (source.charCodeAt(startIndex) === 0x3B) { + lex(); + + if (!state.inIteration) { + throwError(Messages.IllegalContinue); + } + + return node.finishContinueStatement(null); + } + + if (hasLineTerminator) { + if (!state.inIteration) { + throwError(Messages.IllegalContinue); + } + + return node.finishContinueStatement(null); + } + + if (lookahead.type === Token.Identifier) { + label = parseVariableIdentifier(); + + key = '$' + label.name; + if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { + throwError(Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !state.inIteration) { + throwError(Messages.IllegalContinue); + } + + return node.finishContinueStatement(label); + } + + // 12.8 The break statement + + function parseBreakStatement(node) { + var label = null, key; + + expectKeyword('break'); + + // Catch the very common case first: immediately a semicolon (U+003B). + if (source.charCodeAt(lastIndex) === 0x3B) { + lex(); + + if (!(state.inIteration || state.inSwitch)) { + throwError(Messages.IllegalBreak); + } + + return node.finishBreakStatement(null); + } + + if (hasLineTerminator) { + if (!(state.inIteration || state.inSwitch)) { + throwError(Messages.IllegalBreak); + } + + return node.finishBreakStatement(null); + } + + if (lookahead.type === Token.Identifier) { + label = parseVariableIdentifier(); + + key = '$' + label.name; + if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { + throwError(Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !(state.inIteration || state.inSwitch)) { + throwError(Messages.IllegalBreak); + } + + return node.finishBreakStatement(label); + } + + // 12.9 The return statement + + function parseReturnStatement(node) { + var argument = null; + + expectKeyword('return'); + + if (!state.inFunctionBody) { + tolerateError(Messages.IllegalReturn); + } + + // 'return' followed by a space and an identifier is very common. + if (source.charCodeAt(lastIndex) === 0x20) { + if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) { + argument = parseExpression(); + consumeSemicolon(); + return node.finishReturnStatement(argument); + } + } + + if (hasLineTerminator) { + // HACK + return node.finishReturnStatement(null); + } + + if (!match(';')) { + if (!match('}') && lookahead.type !== Token.EOF) { + argument = parseExpression(); + } + } + + consumeSemicolon(); + + return node.finishReturnStatement(argument); + } + + // 12.10 The with statement + + function parseWithStatement(node) { + var object, body; + + if (strict) { + tolerateError(Messages.StrictModeWith); + } + + expectKeyword('with'); + + expect('('); + + object = parseExpression(); + + expect(')'); + + body = parseStatement(); + + return node.finishWithStatement(object, body); + } + + // 12.10 The swith statement + + function parseSwitchCase() { + var test, consequent = [], statement, node = new Node(); + + if (matchKeyword('default')) { + lex(); + test = null; + } else { + expectKeyword('case'); + test = parseExpression(); + } + expect(':'); + + while (startIndex < length) { + if (match('}') || matchKeyword('default') || matchKeyword('case')) { + break; + } + statement = parseStatementListItem(); + consequent.push(statement); + } + + return node.finishSwitchCase(test, consequent); + } + + function parseSwitchStatement(node) { + var discriminant, cases, clause, oldInSwitch, defaultFound; + + expectKeyword('switch'); + + expect('('); + + discriminant = parseExpression(); + + expect(')'); + + expect('{'); + + cases = []; + + if (match('}')) { + lex(); + return node.finishSwitchStatement(discriminant, cases); + } + + oldInSwitch = state.inSwitch; + state.inSwitch = true; + defaultFound = false; + + while (startIndex < length) { + if (match('}')) { + break; + } + clause = parseSwitchCase(); + if (clause.test === null) { + if (defaultFound) { + throwError(Messages.MultipleDefaultsInSwitch); + } + defaultFound = true; + } + cases.push(clause); + } + + state.inSwitch = oldInSwitch; + + expect('}'); + + return node.finishSwitchStatement(discriminant, cases); + } + + // 12.13 The throw statement + + function parseThrowStatement(node) { + var argument; + + expectKeyword('throw'); + + if (hasLineTerminator) { + throwError(Messages.NewlineAfterThrow); + } + + argument = parseExpression(); + + consumeSemicolon(); + + return node.finishThrowStatement(argument); + } + + // 12.14 The try statement + + function parseCatchClause() { + var param, body, node = new Node(); + + expectKeyword('catch'); + + expect('('); + if (match(')')) { + throwUnexpectedToken(lookahead); + } + + param = parsePattern(); + + // 12.14.1 + if (strict && isRestrictedWord(param.name)) { + tolerateError(Messages.StrictCatchVariable); + } + + expect(')'); + body = parseBlock(); + return node.finishCatchClause(param, body); + } + + function parseTryStatement(node) { + var block, handler = null, finalizer = null; + + expectKeyword('try'); + + block = parseBlock(); + + if (matchKeyword('catch')) { + handler = parseCatchClause(); + } + + if (matchKeyword('finally')) { + lex(); + finalizer = parseBlock(); + } + + if (!handler && !finalizer) { + throwError(Messages.NoCatchOrFinally); + } + + return node.finishTryStatement(block, handler, finalizer); + } + + // 12.15 The debugger statement + + function parseDebuggerStatement(node) { + expectKeyword('debugger'); + + consumeSemicolon(); + + return node.finishDebuggerStatement(); + } + + // 12 Statements + + function parseStatement() { + var type = lookahead.type, + expr, + labeledBody, + key, + node; + + if (type === Token.EOF) { + throwUnexpectedToken(lookahead); + } + + if (type === Token.Punctuator && lookahead.value === '{') { + return parseBlock(); + } + isAssignmentTarget = isBindingElement = true; + node = new Node(); + + if (type === Token.Punctuator) { + switch (lookahead.value) { + case ';': + return parseEmptyStatement(node); + case '(': + return parseExpressionStatement(node); + default: + break; + } + } else if (type === Token.Keyword) { + switch (lookahead.value) { + case 'break': + return parseBreakStatement(node); + case 'continue': + return parseContinueStatement(node); + case 'debugger': + return parseDebuggerStatement(node); + case 'do': + return parseDoWhileStatement(node); + case 'for': + return parseForStatement(node); + case 'function': + return parseFunctionDeclaration(node); + case 'if': + return parseIfStatement(node); + case 'return': + return parseReturnStatement(node); + case 'switch': + return parseSwitchStatement(node); + case 'throw': + return parseThrowStatement(node); + case 'try': + return parseTryStatement(node); + case 'var': + return parseVariableStatement(node); + case 'while': + return parseWhileStatement(node); + case 'with': + return parseWithStatement(node); + default: + break; + } + } + + expr = parseExpression(); + + // 12.12 Labelled Statements + if ((expr.type === Syntax.Identifier) && match(':')) { + lex(); + + key = '$' + expr.name; + if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) { + throwError(Messages.Redeclaration, 'Label', expr.name); + } + + state.labelSet[key] = true; + labeledBody = parseStatement(); + delete state.labelSet[key]; + return node.finishLabeledStatement(expr, labeledBody); + } + + consumeSemicolon(); + + return node.finishExpressionStatement(expr); + } + + // 13 Function Definition + + function parseFunctionSourceElements() { + var statement, body = [], token, directive, firstRestricted, + oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount, + node = new Node(); + + expect('{'); + + while (startIndex < length) { + if (lookahead.type !== Token.StringLiteral) { + break; + } + token = lookahead; + + statement = parseStatementListItem(); + body.push(statement); + if (statement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = source.slice(token.start + 1, token.end - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + oldLabelSet = state.labelSet; + oldInIteration = state.inIteration; + oldInSwitch = state.inSwitch; + oldInFunctionBody = state.inFunctionBody; + oldParenthesisCount = state.parenthesizedCount; + + state.labelSet = {}; + state.inIteration = false; + state.inSwitch = false; + state.inFunctionBody = true; + state.parenthesizedCount = 0; + + while (startIndex < length) { + if (match('}')) { + break; + } + body.push(parseStatementListItem()); + } + + expect('}'); + + state.labelSet = oldLabelSet; + state.inIteration = oldInIteration; + state.inSwitch = oldInSwitch; + state.inFunctionBody = oldInFunctionBody; + state.parenthesizedCount = oldParenthesisCount; + + return node.finishBlockStatement(body); + } + + function validateParam(options, param, name) { + var key = '$' + name; + if (strict) { + if (isRestrictedWord(name)) { + options.stricted = param; + options.message = Messages.StrictParamName; + } + if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = Messages.StrictParamDupe; + } + } else if (!options.firstRestricted) { + if (isRestrictedWord(name)) { + options.firstRestricted = param; + options.message = Messages.StrictParamName; + } else if (isStrictModeReservedWord(name)) { + options.firstRestricted = param; + options.message = Messages.StrictReservedWord; + } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.firstRestricted = param; + options.message = Messages.StrictParamDupe; + } + } + options.paramSet[key] = true; + } + + function parseParam(options) { + var token, param, def; + + token = lookahead; + if (token.value === '...') { + param = parseRestElement(); + validateParam(options, param.argument, param.argument.name); + options.params.push(param); + options.defaults.push(null); + return false; + } + + param = parsePatternWithDefault(); + validateParam(options, token, token.value); + + if (param.type === Syntax.AssignmentPattern) { + def = param.right; + param = param.left; + ++options.defaultCount; + } + + options.params.push(param); + options.defaults.push(def); + + return !match(')'); + } + + function parseParams(firstRestricted) { + var options; + + options = { + params: [], + defaultCount: 0, + defaults: [], + firstRestricted: firstRestricted + }; + + expect('('); + + if (!match(')')) { + options.paramSet = {}; + while (startIndex < length) { + if (!parseParam(options)) { + break; + } + expect(','); + } + } + + expect(')'); + + if (options.defaultCount === 0) { + options.defaults = []; + } + + return { + params: options.params, + defaults: options.defaults, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + } + + function parseFunctionDeclaration(node, identifierIsOptional) { + var id = null, params = [], defaults = [], body, token, stricted, tmp, firstRestricted, message, previousStrict; + + expectKeyword('function'); + if (!identifierIsOptional || !match('(')) { + token = lookahead; + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + tolerateUnexpectedToken(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + + tmp = parseParams(firstRestricted); + params = tmp.params; + defaults = tmp.defaults; + stricted = tmp.stricted; + firstRestricted = tmp.firstRestricted; + if (tmp.message) { + message = tmp.message; + } + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwUnexpectedToken(firstRestricted, message); + } + if (strict && stricted) { + tolerateUnexpectedToken(stricted, message); + } + strict = previousStrict; + + return node.finishFunctionDeclaration(id, params, defaults, body); + } + + function parseFunctionExpression() { + var token, id = null, stricted, firstRestricted, message, tmp, + params = [], defaults = [], body, previousStrict, node = new Node(); + + expectKeyword('function'); + + if (!match('(')) { + token = lookahead; + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + tolerateUnexpectedToken(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + + tmp = parseParams(firstRestricted); + params = tmp.params; + defaults = tmp.defaults; + stricted = tmp.stricted; + firstRestricted = tmp.firstRestricted; + if (tmp.message) { + message = tmp.message; + } + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwUnexpectedToken(firstRestricted, message); + } + if (strict && stricted) { + tolerateUnexpectedToken(stricted, message); + } + strict = previousStrict; + + return node.finishFunctionExpression(id, params, defaults, body); + } + + + function parseClassBody() { + var classBody, token, isStatic, hasConstructor = false, body, method, computed, key; + + classBody = new Node(); + + expect('{'); + body = []; + while (!match('}')) { + if (match(';')) { + lex(); + } else { + method = new Node(); + token = lookahead; + isStatic = false; + computed = match('['); + key = parseObjectPropertyKey(); + if (key.name === 'static' && lookaheadPropertyName()) { + token = lookahead; + isStatic = true; + computed = match('['); + key = parseObjectPropertyKey(); + } + method = tryParseMethodDefinition(token, key, computed, method); + if (method) { + method['static'] = isStatic; + if (method.kind === 'init') { + method.kind = 'method'; + } + if (!isStatic) { + if (!method.computed && (method.key.name || method.key.value.toString()) === 'constructor') { + if (method.kind !== 'method' || !method.method || method.value.generator) { + throwUnexpectedToken(token, Messages.ConstructorSpecialMethod); + } + if (hasConstructor) { + throwUnexpectedToken(token, Messages.DuplicateConstructor); + } else { + hasConstructor = true; + } + method.kind = 'constructor'; + } + } else { + if (!method.computed && (method.key.name || method.key.value.toString()) === 'prototype') { + throwUnexpectedToken(token, Messages.StaticPrototype); + } + } + method.type = Syntax.MethodDefinition; + delete method.method; + delete method.shorthand; + body.push(method); + } else { + throwUnexpectedToken(lookahead); + } + } + } + lex(); + return classBody.finishClassBody(body); + } + + function parseClassDeclaration(identifierIsOptional) { + var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; + strict = true; + + expectKeyword('class'); + + if (!identifierIsOptional || lookahead.type === Token.Identifier) { + id = parseVariableIdentifier(); + } + + if (matchKeyword('extends')) { + lex(); + superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); + } + classBody = parseClassBody(); + strict = previousStrict; + + return classNode.finishClassDeclaration(id, superClass, classBody); + } + + function parseClassExpression() { + var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; + strict = true; + + expectKeyword('class'); + + if (lookahead.type === Token.Identifier) { + id = parseVariableIdentifier(); + } + + if (matchKeyword('extends')) { + lex(); + superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); + } + classBody = parseClassBody(); + strict = previousStrict; + + return classNode.finishClassExpression(id, superClass, classBody); + } + + // Modules grammar from: + // people.mozilla.org/~jorendorff/es6-draft.html + + function parseModuleSpecifier() { + var node = new Node(); + + if (lookahead.type !== Token.StringLiteral) { + throwError(Messages.InvalidModuleSpecifier); + } + return node.finishLiteral(lex()); + } + + function parseExportSpecifier() { + var exported, local, node = new Node(), def; + if (matchKeyword('default')) { + // export {default} from 'something'; + def = new Node(); + lex(); + local = def.finishIdentifier('default'); + } else { + local = parseVariableIdentifier(); + } + if (matchContextualKeyword('as')) { + lex(); + exported = parseNonComputedProperty(); + } + return node.finishExportSpecifier(local, exported); + } + + function parseExportNamedDeclaration(node) { + var declaration = null, + isExportFromIdentifier, + src = null, specifiers = []; + + // non-default export + if (lookahead.type === Token.Keyword) { + // covers: + // export var f = 1; + switch (lookahead.value) { + case 'let': + case 'const': + case 'var': + case 'class': + case 'function': + declaration = parseStatementListItem(); + return node.finishExportNamedDeclaration(declaration, specifiers, null); + } + } + + expect('{'); + if (!match('}')) { + do { + isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default'); + specifiers.push(parseExportSpecifier()); + } while (match(',') && lex()); + } + expect('}'); + + if (matchContextualKeyword('from')) { + // covering: + // export {default} from 'foo'; + // export {foo} from 'foo'; + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + } else if (isExportFromIdentifier) { + // covering: + // export {default}; // missing fromClause + throwError(lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } else { + // cover + // export {foo}; + consumeSemicolon(); + } + return node.finishExportNamedDeclaration(declaration, specifiers, src); + } + + function parseExportDefaultDeclaration(node) { + var declaration = null, + expression = null; + + // covers: + // export default ... + expectKeyword('default'); + + if (matchKeyword('function')) { + // covers: + // export default function foo () {} + // export default function () {} + declaration = parseFunctionDeclaration(new Node(), true); + return node.finishExportDefaultDeclaration(declaration); + } + if (matchKeyword('class')) { + declaration = parseClassDeclaration(true); + return node.finishExportDefaultDeclaration(declaration); + } + + if (matchContextualKeyword('from')) { + throwError(Messages.UnexpectedToken, lookahead.value); + } + + // covers: + // export default {}; + // export default []; + // export default (1 + 2); + if (match('{')) { + expression = parseObjectInitialiser(); + } else if (match('[')) { + expression = parseArrayInitialiser(); + } else { + expression = parseAssignmentExpression(); + } + consumeSemicolon(); + return node.finishExportDefaultDeclaration(expression); + } + + function parseExportAllDeclaration(node) { + var src; + + // covers: + // export * from 'foo'; + expect('*'); + if (!matchContextualKeyword('from')) { + throwError(lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + + return node.finishExportAllDeclaration(src); + } + + function parseExportDeclaration() { + var node = new Node(); + if (state.inFunctionBody) { + throwError(Messages.IllegalExportDeclaration); + } + + expectKeyword('export'); + + if (matchKeyword('default')) { + return parseExportDefaultDeclaration(node); + } + if (match('*')) { + return parseExportAllDeclaration(node); + } + return parseExportNamedDeclaration(node); + } + + function parseImportSpecifier() { + // import {} ...; + var local, imported, node = new Node(); + + imported = parseNonComputedProperty(); + if (matchContextualKeyword('as')) { + lex(); + local = parseVariableIdentifier(); + } + + return node.finishImportSpecifier(local, imported); + } + + function parseNamedImports() { + var specifiers = []; + // {foo, bar as bas} + expect('{'); + if (!match('}')) { + do { + specifiers.push(parseImportSpecifier()); + } while (match(',') && lex()); + } + expect('}'); + return specifiers; + } + + function parseImportDefaultSpecifier() { + // import ...; + var local, node = new Node(); + + local = parseNonComputedProperty(); + + return node.finishImportDefaultSpecifier(local); + } + + function parseImportNamespaceSpecifier() { + // import <* as foo> ...; + var local, node = new Node(); + + expect('*'); + if (!matchContextualKeyword('as')) { + throwError(Messages.NoAsAfterImportNamespace); + } + lex(); + local = parseNonComputedProperty(); + + return node.finishImportNamespaceSpecifier(local); + } + + function parseImportDeclaration() { + var specifiers, src, node = new Node(); + + if (state.inFunctionBody) { + throwError(Messages.IllegalImportDeclaration); + } + + expectKeyword('import'); + specifiers = []; + + if (lookahead.type === Token.StringLiteral) { + // covers: + // import 'foo'; + src = parseModuleSpecifier(); + consumeSemicolon(); + return node.finishImportDeclaration(specifiers, src); + } + + if (!matchKeyword('default') && isIdentifierName(lookahead)) { + // covers: + // import foo + // import foo, ... + specifiers.push(parseImportDefaultSpecifier()); + if (match(',')) { + lex(); + } + } + if (match('*')) { + // covers: + // import foo, * as foo + // import * as foo + specifiers.push(parseImportNamespaceSpecifier()); + } else if (match('{')) { + // covers: + // import foo, {bar} + // import {bar} + specifiers = specifiers.concat(parseNamedImports()); + } + + if (!matchContextualKeyword('from')) { + throwError(lookahead.value ? + Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); + } + lex(); + src = parseModuleSpecifier(); + consumeSemicolon(); + + return node.finishImportDeclaration(specifiers, src); + } + + // 14 Program + + function parseScriptBody() { + var statement, body = [], token, directive, firstRestricted; + + while (startIndex < length) { + token = lookahead; + if (token.type !== Token.StringLiteral) { + break; + } + + statement = parseStatementListItem(); + body.push(statement); + if (statement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = source.slice(token.start + 1, token.end - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + while (startIndex < length) { + statement = parseStatementListItem(); + /* istanbul ignore if */ + if (typeof statement === 'undefined') { + break; + } + body.push(statement); + } + return body; + } + + function parseProgram() { + var body, node; + + peek(); + node = new Node(); + + body = parseScriptBody(); + return node.finishProgram(body); + } + + function filterTokenLocation() { + var i, entry, token, tokens = []; + + for (i = 0; i < extra.tokens.length; ++i) { + entry = extra.tokens[i]; + token = { + type: entry.type, + value: entry.value + }; + if (entry.regex) { + token.regex = { + pattern: entry.regex.pattern, + flags: entry.regex.flags + }; + } + if (extra.range) { + token.range = entry.range; + } + if (extra.loc) { + token.loc = entry.loc; + } + tokens.push(token); + } + + extra.tokens = tokens; + } + + function tokenize(code, options) { + var toString, + tokens; + + toString = String; + if (typeof code !== 'string' && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + length = source.length; + lookahead = null; + state = { + allowIn: true, + labelSet: {}, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + lastCommentStart: -1, + curlyStack: [] + }; + + extra = {}; + + // Options matching. + options = options || {}; + + // Of course we collect tokens here. + options.tokens = true; + extra.tokens = []; + extra.tokenize = true; + // The following two fields are necessary to compute the Regex tokens. + extra.openParenToken = -1; + extra.openCurlyToken = -1; + + extra.range = (typeof options.range === 'boolean') && options.range; + extra.loc = (typeof options.loc === 'boolean') && options.loc; + + if (typeof options.comment === 'boolean' && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === 'boolean' && options.tolerant) { + extra.errors = []; + } + + try { + peek(); + if (lookahead.type === Token.EOF) { + return extra.tokens; + } + + lex(); + while (lookahead.type !== Token.EOF) { + try { + lex(); + } catch (lexError) { + if (extra.errors) { + recordError(lexError); + // We have to break on the first error + // to avoid infinite loops. + break; + } else { + throw lexError; + } + } + } + + filterTokenLocation(); + tokens = extra.tokens; + if (typeof extra.comments !== 'undefined') { + tokens.comments = extra.comments; + } + if (typeof extra.errors !== 'undefined') { + tokens.errors = extra.errors; + } + } catch (e) { + throw e; + } finally { + extra = {}; + } + return tokens; + } + + function parse(code, options) { + var program, toString; + + toString = String; + if (typeof code !== 'string' && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + startIndex = index; + startLineNumber = lineNumber; + startLineStart = lineStart; + length = source.length; + lookahead = null; + state = { + allowIn: true, + labelSet: {}, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + lastCommentStart: -1, + curlyStack: [] + }; + sourceType = 'script'; + strict = false; + + extra = {}; + if (typeof options !== 'undefined') { + extra.range = (typeof options.range === 'boolean') && options.range; + extra.loc = (typeof options.loc === 'boolean') && options.loc; + extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment; + + if (extra.loc && options.source !== null && options.source !== undefined) { + extra.source = toString(options.source); + } + + if (typeof options.tokens === 'boolean' && options.tokens) { + extra.tokens = []; + } + if (typeof options.comment === 'boolean' && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === 'boolean' && options.tolerant) { + extra.errors = []; + } + if (extra.attachComment) { + extra.range = true; + extra.comments = []; + extra.bottomRightStack = []; + extra.trailingComments = []; + extra.leadingComments = []; + } + if (options.sourceType === 'module') { + // very restrictive condition for now + sourceType = options.sourceType; + strict = true; + } + } + + try { + program = parseProgram(); + if (typeof extra.comments !== 'undefined') { + program.comments = extra.comments; + } + if (typeof extra.tokens !== 'undefined') { + filterTokenLocation(); + program.tokens = extra.tokens; + } + if (typeof extra.errors !== 'undefined') { + program.errors = extra.errors; + } + } catch (e) { + throw e; + } finally { + extra = {}; + } + + return program; + } + + // Sync with *.json manifests. + exports.version = '2.2.0'; + + exports.tokenize = tokenize; + + exports.parse = parse; + + // Deep copy. + /* istanbul ignore next */ + exports.Syntax = (function () { + var name, types = {}; + + if (typeof Object.create === 'function') { + types = Object.create(null); + } + + for (name in Syntax) { + if (Syntax.hasOwnProperty(name)) { + types[name] = Syntax[name]; + } + } + + if (typeof Object.freeze === 'function') { + Object.freeze(types); + } + + return types; + }()); + +})); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/package.json new file mode 100644 index 00000000..127f777a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/package.json @@ -0,0 +1,93 @@ +{ + "name": "esprima", + "description": "ECMAScript parsing infrastructure for multipurpose analysis", + "homepage": "http://esprima.org", + "main": "esprima.js", + "bin": { + "esparse": "./bin/esparse.js", + "esvalidate": "./bin/esvalidate.js" + }, + "version": "2.2.0", + "files": [ + "bin", + "test/run.js", + "test/runner.js", + "test/test.js", + "esprima.js" + ], + "engines": { + "node": ">=0.4.0" + }, + "author": { + "name": "Ariya Hidayat", + "email": "ariya.hidayat@gmail.com" + }, + "maintainers": [ + { + "name": "ariya", + "email": "ariya.hidayat@gmail.com" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/jquery/esprima.git" + }, + "bugs": { + "url": "http://issues.esprima.org" + }, + "licenses": [ + { + "type": "BSD", + "url": "https://github.com/jquery/esprima/raw/master/LICENSE.BSD" + } + ], + "devDependencies": { + "eslint": "~0.19.0", + "jscs": "~1.12.0", + "istanbul": "~0.3.7", + "escomplex-js": "1.2.0", + "complexity-report": "~1.4.0", + "regenerate": "~0.6.2", + "unicode-7.0.0": "~0.1.5", + "json-diff": "~0.3.1", + "optimist": "~0.6.0" + }, + "keywords": [ + "ast", + "ecmascript", + "javascript", + "parser", + "syntax" + ], + "scripts": { + "generate-regex": "node tools/generate-identifier-regex.js", + "test": "node test/run.js && npm run lint && npm run coverage", + "lint": "npm run check-version && npm run eslint && npm run jscs && npm run complexity", + "check-version": "node tools/check-version.js", + "jscs": "jscs esprima.js", + "eslint": "node node_modules/eslint/bin/eslint.js esprima.js", + "complexity": "node tools/list-complexity.js && cr -s -l -w --maxcyc 17 esprima.js", + "coverage": "npm run analyze-coverage && npm run check-coverage", + "analyze-coverage": "istanbul cover test/runner.js", + "check-coverage": "istanbul check-coverage --statement 100 --branch 100 --function 100", + "benchmark": "node test/benchmarks.js", + "benchmark-quick": "node test/benchmarks.js quick" + }, + "gitHead": "deef03ca006b03912d9f74b041f9239a9045181f", + "_id": "esprima@2.2.0", + "_shasum": "4292c1d68e4173d815fa2290dc7afc96d81fcd83", + "_from": "esprima@>=2.0.0 <3.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "ariya", + "email": "ariya.hidayat@gmail.com" + }, + "dist": { + "shasum": "4292c1d68e4173d815fa2290dc7afc96d81fcd83", + "tarball": "http://registry.npmjs.org/esprima/-/esprima-2.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/esprima/-/esprima-2.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/test/run.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/test/run.js new file mode 100644 index 00000000..a5b919bf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/test/run.js @@ -0,0 +1,66 @@ +/* + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint node:true */ + +(function () { + 'use strict'; + + var child = require('child_process'), + nodejs = '"' + process.execPath + '"', + ret = 0, + suites, + index; + + suites = [ + 'runner', + 'parselibs' + ]; + + function nextTest() { + var suite = suites[index]; + + if (index < suites.length) { + child.exec(nodejs + ' ./test/' + suite + '.js', function (err, stdout, stderr) { + if (stdout) { + process.stdout.write(suite + ': ' + stdout); + } + if (stderr) { + process.stderr.write(suite + ': ' + stderr); + } + if (err) { + ret = err.code; + } + index += 1; + nextTest(); + }); + } else { + process.exit(ret); + } + } + + index = 0; + nextTest(); +}()); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/test/runner.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/test/runner.js new file mode 100644 index 00000000..7f4a1738 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/node_modules/esprima/test/runner.js @@ -0,0 +1,475 @@ +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + Copyright (C) 2011 Yusuke Suzuki + Copyright (C) 2011 Arpad Borsos + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint browser:true node:true */ +/*global esprima:true, testFixture:true */ + +var runTests; + +function NotMatchingError(expected, actual) { + 'use strict'; + Error.call(this, 'Expected '); + this.expected = expected; + this.actual = actual; +} +NotMatchingError.prototype = new Error(); + +function errorToObject(e) { + 'use strict'; + var msg = e.toString(); + + // Opera 9.64 produces an non-standard string in toString(). + if (msg.substr(0, 6) !== 'Error:') { + if (typeof e.message === 'string') { + msg = 'Error: ' + e.message; + } + } + + return { + index: e.index, + lineNumber: e.lineNumber, + column: e.column, + message: msg + }; +} + +function sortedObject(o) { + if (o === null) { + return o; + } + if (Array.isArray(o)) { + return o.map(sortedObject); + } + if (typeof o !== 'object') { + return o; + } + if (o instanceof RegExp) { + return o; + } + var keys = Object.keys(o); + var result = { + range: undefined, + loc: undefined + }; + keys.forEach(function (key) { + if (o.hasOwnProperty(key)){ + result[key] = sortedObject(o[key]); + } + }); + return result; +} + +function hasAttachedComment(syntax) { + var key; + for (key in syntax) { + if (key === 'leadingComments' || key === 'trailingComments') { + return true; + } + if (typeof syntax[key] === 'object' && syntax[key] !== null) { + if (hasAttachedComment(syntax[key])) { + return true; + } + } + } + return false; +} + +function testParse(esprima, code, syntax) { + 'use strict'; + var expected, tree, actual, options, StringObject, i, len; + + // alias, so that JSLint does not complain. + StringObject = String; + + options = { + comment: (typeof syntax.comments !== 'undefined'), + range: true, + loc: true, + tokens: (typeof syntax.tokens !== 'undefined'), + raw: true, + tolerant: (typeof syntax.errors !== 'undefined'), + source: null, + sourceType: syntax.sourceType + }; + + if (options.comment) { + options.attachComment = hasAttachedComment(syntax); + } + + if (typeof syntax.tokens !== 'undefined') { + if (syntax.tokens.length > 0) { + options.range = (typeof syntax.tokens[0].range !== 'undefined'); + options.loc = (typeof syntax.tokens[0].loc !== 'undefined'); + } + } + + if (typeof syntax.comments !== 'undefined') { + if (syntax.comments.length > 0) { + options.range = (typeof syntax.comments[0].range !== 'undefined'); + options.loc = (typeof syntax.comments[0].loc !== 'undefined'); + } + } + + if (options.loc) { + options.source = syntax.loc.source; + } + + syntax = sortedObject(syntax); + expected = JSON.stringify(syntax, null, 4); + try { + // Some variations of the options. + tree = esprima.parse(code, { tolerant: options.tolerant, sourceType: options.sourceType }); + tree = esprima.parse(code, { tolerant: options.tolerant, sourceType: options.sourceType, range: true }); + tree = esprima.parse(code, { tolerant: options.tolerant, sourceType: options.sourceType, loc: true }); + + tree = esprima.parse(code, options); + + if (options.tolerant) { + for (i = 0, len = tree.errors.length; i < len; i += 1) { + tree.errors[i] = errorToObject(tree.errors[i]); + } + } + tree = sortedObject(tree); + actual = JSON.stringify(tree, null, 4); + + // Only to ensure that there is no error when using string object. + esprima.parse(new StringObject(code), options); + + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } + + function filter(key, value) { + return (key === 'loc' || key === 'range') ? undefined : value; + } + + if (options.tolerant) { + return; + } + + + // Check again without any location info. + options.range = false; + options.loc = false; + syntax = sortedObject(syntax); + expected = JSON.stringify(syntax, filter, 4); + try { + tree = esprima.parse(code, options); + + if (options.tolerant) { + for (i = 0, len = tree.errors.length; i < len; i += 1) { + tree.errors[i] = errorToObject(tree.errors[i]); + } + } + tree = sortedObject(tree); + actual = JSON.stringify(tree, filter, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } +} + +function testTokenize(esprima, code, tokens) { + 'use strict'; + var options, expected, actual, tree; + + options = { + comment: true, + tolerant: true, + loc: true, + range: true + }; + + expected = JSON.stringify(tokens, null, 4); + + try { + tree = esprima.tokenize(code, options); + actual = JSON.stringify(tree, null, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== actual) { + throw new NotMatchingError(expected, actual); + } +} + + +function testModule(esprima, code, exception) { + 'use strict'; + var i, options, expected, actual, err, handleInvalidRegexFlag, tokenize; + + // Different parsing options should give the same error. + options = [ + { sourceType: 'module' }, + { sourceType: 'module', comment: true }, + { sourceType: 'module', raw: true }, + { sourceType: 'module', raw: true, comment: true } + ]; + + if (!exception.message) { + exception.message = 'Error: Line 1: ' + exception.description; + } + exception.description = exception.message.replace(/Error: Line [0-9]+: /, ''); + + expected = JSON.stringify(exception); + + for (i = 0; i < options.length; i += 1) { + + try { + esprima.parse(code, options[i]); + } catch (e) { + err = errorToObject(e); + err.description = e.description; + actual = JSON.stringify(err); + } + + if (expected !== actual) { + + // Compensate for old V8 which does not handle invalid flag. + if (exception.message.indexOf('Invalid regular expression') > 0) { + if (typeof actual === 'undefined' && !handleInvalidRegexFlag) { + return; + } + } + + throw new NotMatchingError(expected, actual); + } + + } +} + +function testError(esprima, code, exception) { + 'use strict'; + var i, options, expected, actual, err, handleInvalidRegexFlag, tokenize; + + // Different parsing options should give the same error. + options = [ + {}, + { comment: true }, + { raw: true }, + { raw: true, comment: true } + ]; + + // If handleInvalidRegexFlag is true, an invalid flag in a regular expression + // will throw an exception. In some old version of V8, this is not the case + // and hence handleInvalidRegexFlag is false. + handleInvalidRegexFlag = false; + try { + 'test'.match(new RegExp('[a-z]', 'x')); + } catch (e) { + handleInvalidRegexFlag = true; + } + + exception.description = exception.message.replace(/Error: Line [0-9]+: /, ''); + + if (exception.tokenize) { + tokenize = true; + exception.tokenize = undefined; + } + expected = JSON.stringify(exception); + + for (i = 0; i < options.length; i += 1) { + + try { + if (tokenize) { + esprima.tokenize(code, options[i]); + } else { + esprima.parse(code, options[i]); + } + } catch (e) { + err = errorToObject(e); + err.description = e.description; + actual = JSON.stringify(err); + } + + if (expected !== actual) { + + // Compensate for old V8 which does not handle invalid flag. + if (exception.message.indexOf('Invalid regular expression') > 0) { + if (typeof actual === 'undefined' && !handleInvalidRegexFlag) { + return; + } + } + + throw new NotMatchingError(expected, actual); + } + + } +} + +function testAPI(esprima, code, expected) { + var result; + // API test. + expected = JSON.stringify(expected, null, 4); + try { + result = eval(code); + result = JSON.stringify(result, null, 4); + } catch (e) { + throw new NotMatchingError(expected, e.toString()); + } + if (expected !== result) { + throw new NotMatchingError(expected, result); + } +} + +function generateTestCase(esprima, testCase) { + var tree, fileName = testCase.key + ".tree.json"; + try { + tree = esprima.parse(testCase.case, {loc: true, range: true}); + tree = JSON.stringify(tree, null, 4); + } catch (e) { + if (typeof e.index === 'undefined') { + console.error("Failed to generate test result."); + throw e; + } + tree = errorToObject(e); + tree.description = e.description; + tree = JSON.stringify(tree); + fileName = testCase.key + ".failure.json"; + } + require('fs').writeFileSync(fileName, tree); + console.error("Done."); +} + +if (typeof window === 'undefined') { + (function () { + 'use strict'; + + var esprima = require('../esprima'), + vm = require('vm'), + fs = require('fs'), + diff = require('json-diff').diffString, + total = 0, + result, + failures = [], + cases = {}, + context = {source: '', result: null}, + tick = new Date(), + expected, + testCase, + header; + + function enumerateFixtures(root) { + var dirs = fs.readdirSync(root), key, kind, + kinds = ['case', 'source', 'module', 'run', 'tree', 'tokens', 'failure', 'result'], + suffices = ['js', 'js', 'json', 'js', 'json', 'json', 'json', 'json']; + + dirs.forEach(function (item) { + var i; + if (fs.statSync(root + '/' + item).isDirectory()) { + enumerateFixtures(root + '/' + item); + } else { + kind = 'case'; + key = item.slice(0, -3); + for (i = 1; i < kinds.length; i++) { + var suffix = '.' + kinds[i] + '.' + suffices[i]; + if (item.slice(-suffix.length) === suffix) { + key = item.slice(0, -suffix.length); + kind = kinds[i]; + } + } + key = root + '/' + key; + if (!cases[key]) { + total++; + cases[key] = { key: key }; + } + cases[key][kind] = fs.readFileSync(root + '/' + item, 'utf-8'); + } + }); + } + + enumerateFixtures(__dirname + '/fixtures'); + + for (var key in cases) { + if (cases.hasOwnProperty(key)) { + testCase = cases[key]; + + if (testCase.hasOwnProperty('source')) { + testCase.case = eval(testCase.source + ';source'); + } + + try { + if (testCase.hasOwnProperty('module')) { + testModule(esprima, testCase.case, JSON.parse(testCase.module)); + } else if (testCase.hasOwnProperty('tree')) { + testParse(esprima, testCase.case, JSON.parse(testCase.tree)); + } else if (testCase.hasOwnProperty('tokens')) { + testTokenize(esprima, testCase.case, JSON.parse(testCase.tokens)); + } else if (testCase.hasOwnProperty('failure')) { + testError(esprima, testCase.case, JSON.parse(testCase.failure)); + } else if (testCase.hasOwnProperty('result')) { + testAPI(esprima, testCase.run, JSON.parse(testCase.result)); + } else { + console.error('Incomplete test case:' + testCase.key + '. Generating test result...'); + generateTestCase(esprima, testCase); + } + } catch (e) { + if (!e.expected) { + throw e; + } + e.source = testCase.case || testCase.key; + failures.push(e); + } + } + } + + tick = (new Date()) - tick; + + header = total + ' tests. ' + failures.length + ' failures. ' + + tick + ' ms'; + if (failures.length) { + console.error(header); + failures.forEach(function (failure) { + try { + var expectedObject = JSON.parse(failure.expected); + var actualObject = JSON.parse(failure.actual); + + console.error(failure.source + ': Expected\n ' + + failure.expected.split('\n').join('\n ') + + '\nto match\n ' + failure.actual + '\nDiff:\n' + + diff(expectedObject, actualObject)); + } catch (ex) { + console.error(failure.source + ': Expected\n ' + + failure.expected.split('\n').join('\n ') + + '\nto match\n ' + failure.actual); + } + }); + } else { + console.log(header); + } + process.exit(failures.length === 0 ? 0 : 1); + + }()); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/package.json new file mode 100644 index 00000000..f120fcb5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/package.json @@ -0,0 +1,66 @@ +{ + "name": "rocambole", + "version": "0.6.0", + "description": "Recursively walk and transform EcmaScript AST", + "main": "rocambole.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "istanbul test test/runner.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/rocambole.git" + }, + "bugs": { + "url": "https://github.com/millermedeiros/rocambole/issues" + }, + "keywords": [ + "ast", + "walk", + "syntax", + "source", + "tree", + "traversal", + "falafel", + "burrito", + "esprima" + ], + "author": { + "name": "Miller Medeiros", + "email": "http://blog.millermedeiros.com" + }, + "license": "MIT", + "dependencies": { + "esprima": "^2.0" + }, + "devDependencies": { + "mocha": "~1.7", + "expect.js": "0.2", + "istanbul": "~0.1.23" + }, + "gitHead": "a3d0d63d58b769d13bad288aca32c6e2f7766542", + "homepage": "https://github.com/millermedeiros/rocambole", + "_id": "rocambole@0.6.0", + "_shasum": "534f235a287cc17f9b057b95bd11d0f0dc35452c", + "_from": "rocambole@>=0.5.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + } + ], + "dist": { + "shasum": "534f235a287cc17f9b057b95bd11d0f0dc35452c", + "tarball": "http://registry.npmjs.org/rocambole/-/rocambole-0.6.0.tgz" + }, + "_resolved": "https://registry.npmjs.org/rocambole/-/rocambole-0.6.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/rocambole.jpg b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/rocambole.jpg new file mode 100644 index 00000000..a329c4d5 Binary files /dev/null and b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/rocambole.jpg differ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/rocambole.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/rocambole.js new file mode 100644 index 00000000..424983c8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/rocambole.js @@ -0,0 +1,431 @@ +/*jshint node:true */ +"use strict"; + + +var esprima = require('esprima'); + + + +// --- + +// we expose the flags so other tools can tweak the values (#8) +exports.BYPASS_RECURSION = { + root : true, + comments : true, + tokens : true, + + loc : true, + range : true, + + parent : true, + next : true, + prev : true, + + // esprima@2.1 introduces a "handler" property on TryStatement, so we would + // loop the same node twice (see jquery/esprima/issues/1031 and #264)` + handler : true, + + // IMPORTANT! "value" can't be bypassed since it is used by object + // expression + type : true, + raw : true, + + startToken : true, + endToken : true +}; + + +// --- + +var _addLocInfo; + +// --- + +exports.parseFn = esprima.parse; +exports.parseContext = esprima; +// we need range/tokens/comment info to build the tokens linked list! +exports.parseOptions = { + range: true, + tokens: true, + comment: true +}; + +// parse string and return an augmented AST +exports.parse = function parse(source, opts){ + opts = opts || {}; + _addLocInfo = Boolean(opts.loc); + source = source.toString(); + + Object.keys(exports.parseOptions).forEach(function(key) { + if (!(key in opts)) { + opts[key] = exports.parseOptions[key]; + } + }); + + var ast = exports.parseFn.call(exports.parseContext, source, opts); + + // we augment just root node since program is "empty" + // can't check `ast.body.length` because it might contain just comments + if (!ast.tokens.length && !ast.comments.length) { + ast.depth = 0; + ast.startToken = ast.endToken = null; + ast.toString = _nodeProto.toString; + return ast; + } + + instrumentTokens(ast, source); + + // update program range since it doesn't include white spaces and comments + // before/after the program body by default + var lastToken = ast.tokens[ast.tokens.length - 1]; + ast.range[0] = ast.tokens[0].range[0]; + ast.range[1] = lastToken.range[1]; + if (_addLocInfo) { + ast.loc.start.line = 0; + ast.loc.start.column = 0; + ast.loc.end.line = lastToken.loc.end.line; + ast.loc.end.column = lastToken.loc.end.column; + } + + var toString = _nodeProto.toString; + var instrumentNodes = function(node, parent, prev, next){ + + node.parent = parent; + node.prev = prev; + node.next = next; + node.depth = parent? parent.depth + 1 : 0; // used later for moonwalk + + node.toString = toString; + + // we do not add nextToken and prevToken to avoid updating even more + // references during each remove/before/after you can grab the + // prev/next token by simply accesing the startToken.prev and + // endToken.next + var prevToken = prev? prev.endToken : (parent? parent.startToken : null); + var nextToken = parent? parent.endToken : null; + node.startToken = prevToken? getNodeStartToken(prevToken, node.range) : ast.tokens[0]; + node.endToken = nextToken? getNodeEndToken(nextToken, node.range) : ast.tokens[ast.tokens.length - 1]; + }; + recursiveWalk(ast, instrumentNodes); + + return ast; +}; + + +var _nodeProto = {}; + +// get the node string +_nodeProto.toString = function(){ + var str = ''; + var token = this.startToken; + if (!token) return str; + do { + str += ('raw' in token)? token.raw : token.value; + token = token.next; + } while (token && token !== this.endToken.next); + return str; +}; + + +function getNodeStartToken(token, range){ + var startRange = range[0]; + while (token){ + if (token.range[0] >= startRange) { + return token; + } + token = token.next; + } +} + +function getNodeEndToken(token, range){ + var endRange = range[1]; + while (token){ + if (token.range[1] <= endRange) { + return token; + } + token = token.prev; + } +} + + + +function getPrevToken(tokens, range){ + var result, token, + startRange = range[0], + n = tokens.length; + while (n--) { + token = tokens[n]; + if (token.range[1] <= startRange) { + result = token; + break; + } + } + return result; +} + + + + + + +function instrumentTokens(ast, source){ + + var tokens = ast.tokens; + + + // --- inject comments into tokens list + var comments = ast.comments; + var comment, + q = -1, + nComments = comments.length; + + while (++q < nComments) { + comment = comments[q]; + // we edit it in place since it is faster, will also affect + comment.raw = comment.type === 'Block'? '/*'+ comment.value +'*/' : '//'+ comment.value; + comment.type += 'Comment'; + + var prevToken = getPrevToken(tokens, comment.range); + var prevIndex = prevToken? tokens.indexOf(prevToken) : -1; + tokens.splice(prevIndex + 1, 0, comment); + } + + + // --- inject white spaces and line breaks + + // we create a new array since it's simpler than using splice, it will + // also avoid mistakes + var result = []; + + // insert white spaces before start of program + var wsTokens; + var firstToken = ast.tokens[0]; + var raw; + if ( firstToken.range[0] ) { + raw = source.substring(0, firstToken.range[0]); + result = result.concat( getWhiteSpaceTokens(raw, null) ); + } + + // insert white spaces between regular tokens + // faster than forEach and reduce lookups + var i = -1, + nTokens = tokens.length, + token, prev; + var k, nWs; + while (++i < nTokens) { + token = tokens[i]; + if (i) { + if (prev.range[1] < token.range[0]) { + wsTokens = getWhiteSpaceTokens(source.substring(prev.range[1], token.range[0]), prev); + // faster than concat or push.apply + k = -1; + nWs = wsTokens.length; + while (++k < nWs) { + result.push(wsTokens[k]); + } + } + } + result.push(token); + prev = token; + } + + // insert white spaces after end of program + var lastToken = ast.tokens[ast.tokens.length - 1]; + if (lastToken.range[1] < source.length) { + wsTokens = getWhiteSpaceTokens(source.substring(lastToken.range[1], source.length), lastToken); + k = -1; + nWs = wsTokens.length; + while (++k < nWs) { + result.push(wsTokens[k]); + } + } + + // --- instrument tokens + + // need to come afterwards since we add line breaks and comments + var n; + for (i = 0, n = result.length, token; i < n; i++) { + token = result[i]; + token.prev = i? result[i - 1] : undefined; + token.next = result[i + 1]; + token.root = ast; // used internally + // original indent is very important for block comments since some + // transformations require manipulation of raw comment value + if ( + token.type === 'BlockComment' && + token.prev && token.prev.type === 'WhiteSpace' && + (!token.prev.prev || (token.prev.prev.type === 'LineBreak')) + ) { + token.originalIndent = token.prev.value; + } + } + + ast.tokens = result; +} + + +function getWhiteSpaceTokens(raw, prev){ + var whiteSpaces = getWhiteSpaces(raw); + + var startRange = prev? prev.range[1] : 0; + // line starts at 1 !!! + var startLine, startColumn; + if (_addLocInfo) { + startLine = prev? prev.loc.end.line : 1; + startColumn = prev? prev.loc.end.column : 0; + } + + var tokens = []; + for (var i = 0, n = whiteSpaces.length, value; i < n; i++){ + value = whiteSpaces[i]; + + var wsToken = { value : value }; + var isBr = '\r\n'.indexOf(value) >= 0; + wsToken.type = isBr? 'LineBreak' : 'WhiteSpace'; + wsToken.range = [startRange, startRange + value.length]; + + if (_addLocInfo) { + wsToken.loc = { + start : { + line : startLine, + column : startColumn + }, + end : { + line : startLine, // yes, br starts and end on same line + column : startColumn + value.length + } + }; + + if (isBr) { + // next token after a
always starts at zero and on next line + startLine = wsToken.loc.end.line + 1; + startColumn = 0; + } else { + startLine = wsToken.loc.end.line; + startColumn = wsToken.loc.end.column; + } + } + + startRange += value.length; + tokens.push(wsToken); + } + + return tokens; +} + + +function getWhiteSpaces(source) { + var result = []; + var whiteSpaces = source.split(''); + var buf = ''; + for (var value, i = 0, nSpaces = whiteSpaces.length; i < nSpaces; i++) { + value = whiteSpaces[i]; + switch(value){ + case '\n': + if (buf === '\r') { + // DOS line break + result.push(buf + value); + } else { + if (buf) { + result.push(buf); + } + // unix break + result.push(value); + } + buf = ''; + break; + case '\r': + // might be multiple consecutive Mac breaks + if (buf) { + result.push(buf); + } + buf = value; + break; + default: + if (buf === '\r') { + result.push(buf); + buf = value; + } else { + // group multiple white spaces into same token + buf += value; + } + } + } + if (buf) { + result.push(buf); + } + return result; +} + + + +exports.walk = exports.recursive = recursiveWalk; + +// heavily inspired by node-falafel +// walk nodes recursively starting from root +function recursiveWalk(node, fn, parent, prev, next){ + // sparse arrays might have `null` elements, so we skip those for now + // see issue #15 + if ( !node || fn(node, parent, prev, next) === false ) { + return; // stop recursion + } + + // faster than for in + var keys = Object.keys(node), + child, key; + + for (var i = 0, nKeys = keys.length; i < nKeys; i++) { + + key = keys[i]; + child = node[key]; + + // only need to recurse real nodes and arrays + // ps: typeof null == 'object' + if (!child || typeof child !== 'object' || exports.BYPASS_RECURSION[key]) { + continue; + } + + // inception + if (typeof child.type === 'string') { // faster than boolean coercion + recursiveWalk(child, fn, node); + } else if ( typeof child.length === 'number' ) { // faster than Array.isArray and boolean coercion + // faster than forEach + for (var k = 0, nChilds = child.length; k < nChilds; k++) { + recursiveWalk(child[k], fn, node, (k? child[k - 1] : undefined), child[k + 1] ); + } + } + + } + +} + + + +// walk AST starting from leaf nodes +exports.moonwalk = function moonwalk(ast, fn){ + if (typeof ast === 'string') { + ast = exports.parse(ast); + } + + // we create a separate array for each depth and than we flatten it to + // boost performance, way faster than doing an insertion sort + var swap = []; + recursiveWalk(ast, function(node){ + if (! swap[node.depth]) { + swap[node.depth] = []; + } + swap[node.depth].push(node); + }); + + var nodes = []; + var nDepths = swap.length, cur; + while (cur = swap[--nDepths]) { + for (var i = 0, n = cur.length; i < n; i++) { + nodes.push(cur[i]); + } + } + + nodes.forEach(fn); + return ast; +}; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/files/crossroads.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/files/crossroads.js new file mode 100644 index 00000000..79d992e8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/files/crossroads.js @@ -0,0 +1,683 @@ +/** @license + * crossroads + * License: MIT + * Author: Miller Medeiros + * Version: 0.11.0 (2012/10/31 21:44) + */ + +(function (define) { +define(['signals'], function (signals) { + + var crossroads, + _hasOptionalGroupBug, + UNDEF; + + // Helpers ----------- + //==================== + + // IE 7-8 capture optional groups as empty strings while other browsers + // capture as `undefined` + _hasOptionalGroupBug = (/t(.+)?/).exec('t')[1] === ''; + + function arrayIndexOf(arr, val) { + if (arr.indexOf) { + return arr.indexOf(val); + } else { + //Array.indexOf doesn't work on IE 6-7 + var n = arr.length; + while (n--) { + if (arr[n] === val) { + return n; + } + } + return -1; + } + } + + function arrayRemove(arr, item) { + var i = arrayIndexOf(arr, item); + if (i !== -1) { + arr.splice(i, 1); + } + } + + function isKind(val, kind) { + return '[object '+ kind +']' === Object.prototype.toString.call(val); + } + + function isRegExp(val) { + return isKind(val, 'RegExp'); + } + + function isArray(val) { + return isKind(val, 'Array'); + } + + function isFunction(val) { + return typeof val === 'function'; + } + + //borrowed from AMD-utils + function typecastValue(val) { + var r; + if (val === null || val === 'null') { + r = null; + } else if (val === 'true') { + r = true; + } else if (val === 'false') { + r = false; + } else if (val === UNDEF || val === 'undefined') { + r = UNDEF; + } else if (val === '' || isNaN(val)) { + //isNaN('') returns false + r = val; + } else { + //parseFloat(null || '') returns NaN + r = parseFloat(val); + } + return r; + } + + function typecastArrayValues(values) { + var n = values.length, + result = []; + while (n--) { + result[n] = typecastValue(values[n]); + } + return result; + } + + //borrowed from AMD-Utils + function decodeQueryString(str, shouldTypecast) { + var queryArr = (str || '').replace('?', '').split('&'), + n = queryArr.length, + obj = {}, + item, val; + while (n--) { + item = queryArr[n].split('='); + val = shouldTypecast ? typecastValue(item[1]) : item[1]; + obj[item[0]] = (typeof val === 'string')? decodeURIComponent(val) : val; + } + return obj; + } + + + // Crossroads -------- + //==================== + + /** + * @constructor + */ + function Crossroads() { + this.bypassed = new signals.Signal(); + this.routed = new signals.Signal(); + this._routes = []; + this._prevRoutes = []; + this._piped = []; + this.resetState(); + } + + Crossroads.prototype = { + + greedy : false, + + greedyEnabled : true, + + ignoreCase : true, + + ignoreState : false, + + shouldTypecast : false, + + normalizeFn : null, + + resetState : function(){ + this._prevRoutes.length = 0; + this._prevMatchedRequest = null; + this._prevBypassedRequest = null; + }, + + create : function () { + return new Crossroads(); + }, + + addRoute : function (pattern, callback, priority) { + var route = new Route(pattern, callback, priority, this); + this._sortedInsert(route); + return route; + }, + + removeRoute : function (route) { + arrayRemove(this._routes, route); + route._destroy(); + }, + + removeAllRoutes : function () { + var n = this.getNumRoutes(); + while (n--) { + this._routes[n]._destroy(); + } + this._routes.length = 0; + }, + + parse : function (request, defaultArgs) { + request = request || ''; + defaultArgs = defaultArgs || []; + + // should only care about different requests if ignoreState isn't true + if ( !this.ignoreState && + (request === this._prevMatchedRequest || + request === this._prevBypassedRequest) ) { + return; + } + + var routes = this._getMatchedRoutes(request), + i = 0, + n = routes.length, + cur; + + if (n) { + this._prevMatchedRequest = request; + + this._notifyPrevRoutes(routes, request); + this._prevRoutes = routes; + //should be incremental loop, execute routes in order + while (i < n) { + cur = routes[i]; + cur.route.matched.dispatch.apply(cur.route.matched, defaultArgs.concat(cur.params)); + cur.isFirst = !i; + this.routed.dispatch.apply(this.routed, defaultArgs.concat([request, cur])); + i += 1; + } + } else { + this._prevBypassedRequest = request; + this.bypassed.dispatch.apply(this.bypassed, defaultArgs.concat([request])); + } + + this._pipeParse(request, defaultArgs); + }, + + _notifyPrevRoutes : function(matchedRoutes, request) { + var i = 0, prev; + while (prev = this._prevRoutes[i++]) { + //check if switched exist since route may be disposed + if(prev.route.switched && this._didSwitch(prev.route, matchedRoutes)) { + prev.route.switched.dispatch(request); + } + } + }, + + _didSwitch : function (route, matchedRoutes){ + var matched, + i = 0; + while (matched = matchedRoutes[i++]) { + // only dispatch switched if it is going to a different route + if (matched.route === route) { + return false; + } + } + return true; + }, + + _pipeParse : function(request, defaultArgs) { + var i = 0, route; + while (route = this._piped[i++]) { + route.parse(request, defaultArgs); + } + }, + + getNumRoutes : function () { + return this._routes.length; + }, + + _sortedInsert : function (route) { + //simplified insertion sort + var routes = this._routes, + n = routes.length; + do { --n; } while (routes[n] && route._priority <= routes[n]._priority); + routes.splice(n+1, 0, route); + }, + + _getMatchedRoutes : function (request) { + var res = [], + routes = this._routes, + n = routes.length, + route; + //should be decrement loop since higher priorities are added at the end of array + while (route = routes[--n]) { + if ((!res.length || this.greedy || route.greedy) && route.match(request)) { + res.push({ + route : route, + params : route._getParamsArray(request) + }); + } + if (!this.greedyEnabled && res.length) { + break; + } + } + return res; + }, + + pipe : function (otherRouter) { + this._piped.push(otherRouter); + }, + + unpipe : function (otherRouter) { + arrayRemove(this._piped, otherRouter); + }, + + toString : function () { + return '[crossroads numRoutes:'+ this.getNumRoutes() +']'; + } + }; + + //"static" instance + crossroads = new Crossroads(); + crossroads.VERSION = '0.11.0'; + + crossroads.NORM_AS_ARRAY = function (req, vals) { + return [vals.vals_]; + }; + + crossroads.NORM_AS_OBJECT = function (req, vals) { + return [vals]; + }; + + + // Route -------------- + //===================== + + /** + * @constructor + */ + function Route(pattern, callback, priority, router) { + var isRegexPattern = isRegExp(pattern), + patternLexer = crossroads.patternLexer; + this._router = router; + this._pattern = pattern; + this._paramsIds = isRegexPattern? null : patternLexer.getParamIds(pattern); + this._optionalParamsIds = isRegexPattern? null : patternLexer.getOptionalParamsIds(pattern); + this._matchRegexp = isRegexPattern? pattern : patternLexer.compilePattern(pattern, router.ignoreCase); + this.matched = new signals.Signal(); + this.switched = new signals.Signal(); + if (callback) { + this.matched.add(callback); + } + this._priority = priority || 0; + } + + Route.prototype = { + + greedy : false, + + rules : void(0), + + match : function (request) { + request = request || ''; + return this._matchRegexp.test(request) && this._validateParams(request); //validate params even if regexp because of `request_` rule. + }, + + _validateParams : function (request) { + var rules = this.rules, + values = this._getParamsObject(request), + key; + for (key in rules) { + // normalize_ isn't a validation rule... (#39) + if(key !== 'normalize_' && rules.hasOwnProperty(key) && ! this._isValidParam(request, key, values)){ + return false; + } + } + return true; + }, + + _isValidParam : function (request, prop, values) { + var validationRule = this.rules[prop], + val = values[prop], + isValid = false, + isQuery = (prop.indexOf('?') === 0); + + if (val == null && this._optionalParamsIds && arrayIndexOf(this._optionalParamsIds, prop) !== -1) { + isValid = true; + } + else if (isRegExp(validationRule)) { + if (isQuery) { + val = values[prop +'_']; //use raw string + } + isValid = validationRule.test(val); + } + else if (isArray(validationRule)) { + if (isQuery) { + val = values[prop +'_']; //use raw string + } + isValid = this._isValidArrayRule(validationRule, val); + } + else if (isFunction(validationRule)) { + isValid = validationRule(val, request, values); + } + + return isValid; //fail silently if validationRule is from an unsupported type + }, + + _isValidArrayRule : function (arr, val) { + if (! this._router.ignoreCase) { + return arrayIndexOf(arr, val) !== -1; + } + + if (typeof val === 'string') { + val = val.toLowerCase(); + } + + var n = arr.length, + item, + compareVal; + + while (n--) { + item = arr[n]; + compareVal = (typeof item === 'string')? item.toLowerCase() : item; + if (compareVal === val) { + return true; + } + } + return false; + }, + + _getParamsObject : function (request) { + var shouldTypecast = this._router.shouldTypecast, + values = crossroads.patternLexer.getParamValues(request, this._matchRegexp, shouldTypecast), + o = {}, + n = values.length, + param, val; + while (n--) { + val = values[n]; + if (this._paramsIds) { + param = this._paramsIds[n]; + if (param.indexOf('?') === 0 && val) { + //make a copy of the original string so array and + //RegExp validation can be applied properly + o[param +'_'] = val; + //update vals_ array as well since it will be used + //during dispatch + val = decodeQueryString(val, shouldTypecast); + values[n] = val; + } + // IE will capture optional groups as empty strings while other + // browsers will capture `undefined` so normalize behavior. + // see: #gh-58, #gh-59, #gh-60 + if ( _hasOptionalGroupBug && val === '' && arrayIndexOf(this._optionalParamsIds, param) !== -1 ) { + val = void(0); + values[n] = val; + } + o[param] = val; + } + //alias to paths and for RegExp pattern + o[n] = val; + } + o.request_ = shouldTypecast? typecastValue(request) : request; + o.vals_ = values; + return o; + }, + + _getParamsArray : function (request) { + var norm = this.rules? this.rules.normalize_ : null, + params; + norm = norm || this._router.normalizeFn; // default normalize + if (norm && isFunction(norm)) { + params = norm(request, this._getParamsObject(request)); + } else { + params = this._getParamsObject(request).vals_; + } + return params; + }, + + interpolate : function(replacements) { + var str = crossroads.patternLexer.interpolate(this._pattern, replacements); + if (! this._validateParams(str) ) { + throw new Error('Generated string doesn\'t validate against `Route.rules`.'); + } + return str; + }, + + dispose : function () { + this._router.removeRoute(this); + }, + + _destroy : function () { + this.matched.dispose(); + this.switched.dispose(); + this.matched = this.switched = this._pattern = this._matchRegexp = null; + }, + + toString : function () { + return '[Route pattern:"'+ this._pattern +'", numListeners:'+ this.matched.getNumListeners() +']'; + } + + }; + + + + // Pattern Lexer ------ + //===================== + + crossroads.patternLexer = (function () { + + var + //match chars that should be escaped on string regexp + ESCAPE_CHARS_REGEXP = /[\\.+*?\^$\[\](){}\/'#]/g, + + //trailing slashes (begin/end of string) + LOOSE_SLASHES_REGEXP = /^\/|\/$/g, + LEGACY_SLASHES_REGEXP = /\/$/g, + + //params - everything between `{ }` or `: :` + PARAMS_REGEXP = /(?:\{|:)([^}:]+)(?:\}|:)/g, + + //used to save params during compile (avoid escaping things that + //shouldn't be escaped). + TOKENS = { + 'OS' : { + //optional slashes + //slash between `::` or `}:` or `\w:` or `:{?` or `}{?` or `\w{?` + rgx : /([:}]|\w(?=\/))\/?(:|(?:\{\?))/g, + save : '$1{{id}}$2', + res : '\\/?' + }, + 'RS' : { + //required slashes + //used to insert slash between `:{` and `}{` + rgx : /([:}])\/?(\{)/g, + save : '$1{{id}}$2', + res : '\\/' + }, + 'RQ' : { + //required query string - everything in between `{? }` + rgx : /\{\?([^}]+)\}/g, + //everything from `?` till `#` or end of string + res : '\\?([^#]+)' + }, + 'OQ' : { + //optional query string - everything in between `:? :` + rgx : /:\?([^:]+):/g, + //everything from `?` till `#` or end of string + res : '(?:\\?([^#]*))?' + }, + 'OR' : { + //optional rest - everything in between `: *:` + rgx : /:([^:]+)\*:/g, + res : '(.*)?' // optional group to avoid passing empty string as captured + }, + 'RR' : { + //rest param - everything in between `{ *}` + rgx : /\{([^}]+)\*\}/g, + res : '(.+)' + }, + // required/optional params should come after rest segments + 'RP' : { + //required params - everything between `{ }` + rgx : /\{([^}]+)\}/g, + res : '([^\\/?]+)' + }, + 'OP' : { + //optional params - everything between `: :` + rgx : /:([^:]+):/g, + res : '([^\\/?]+)?\/?' + } + }, + + LOOSE_SLASH = 1, + STRICT_SLASH = 2, + LEGACY_SLASH = 3, + + _slashMode = LOOSE_SLASH; + + + function precompileTokens(){ + var key, cur; + for (key in TOKENS) { + if (TOKENS.hasOwnProperty(key)) { + cur = TOKENS[key]; + cur.id = '__CR_'+ key +'__'; + cur.save = ('save' in cur)? cur.save.replace('{{id}}', cur.id) : cur.id; + cur.rRestore = new RegExp(cur.id, 'g'); + } + } + } + precompileTokens(); + + + function captureVals(regex, pattern) { + var vals = [], match; + // very important to reset lastIndex since RegExp can have "g" flag + // and multiple runs might affect the result, specially if matching + // same string multiple times on IE 7-8 + regex.lastIndex = 0; + while (match = regex.exec(pattern)) { + vals.push(match[1]); + } + return vals; + } + + function getParamIds(pattern) { + return captureVals(PARAMS_REGEXP, pattern); + } + + function getOptionalParamsIds(pattern) { + return captureVals(TOKENS.OP.rgx, pattern); + } + + function compilePattern(pattern, ignoreCase) { + pattern = pattern || ''; + + if(pattern){ + if (_slashMode === LOOSE_SLASH) { + pattern = pattern.replace(LOOSE_SLASHES_REGEXP, ''); + } + else if (_slashMode === LEGACY_SLASH) { + pattern = pattern.replace(LEGACY_SLASHES_REGEXP, ''); + } + + //save tokens + pattern = replaceTokens(pattern, 'rgx', 'save'); + //regexp escape + pattern = pattern.replace(ESCAPE_CHARS_REGEXP, '\\$&'); + //restore tokens + pattern = replaceTokens(pattern, 'rRestore', 'res'); + + if (_slashMode === LOOSE_SLASH) { + pattern = '\\/?'+ pattern; + } + } + + if (_slashMode !== STRICT_SLASH) { + //single slash is treated as empty and end slash is optional + pattern += '\\/?'; + } + return new RegExp('^'+ pattern + '$', ignoreCase? 'i' : ''); + } + + function replaceTokens(pattern, regexpName, replaceName) { + var cur, key; + for (key in TOKENS) { + if (TOKENS.hasOwnProperty(key)) { + cur = TOKENS[key]; + pattern = pattern.replace(cur[regexpName], cur[replaceName]); + } + } + return pattern; + } + + function getParamValues(request, regexp, shouldTypecast) { + var vals = regexp.exec(request); + if (vals) { + vals.shift(); + if (shouldTypecast) { + vals = typecastArrayValues(vals); + } + } + return vals; + } + + function interpolate(pattern, replacements) { + if (typeof pattern !== 'string') { + throw new Error('Route pattern should be a string.'); + } + + var replaceFn = function(match, prop){ + var val; + if (prop in replacements) { + // make sure value is a string see #gh-54 + val = String(replacements[prop]); + if (match.indexOf('*') === -1 && val.indexOf('/') !== -1) { + throw new Error('Invalid value "'+ val +'" for segment "'+ match +'".'); + } + } + else if (match.indexOf('{') !== -1) { + throw new Error('The segment '+ match +' is required.'); + } + else { + val = ''; + } + return val; + }; + + if (! TOKENS.OS.trail) { + TOKENS.OS.trail = new RegExp('(?:'+ TOKENS.OS.id +')+$'); + } + + return pattern + .replace(TOKENS.OS.rgx, TOKENS.OS.save) + .replace(PARAMS_REGEXP, replaceFn) + .replace(TOKENS.OS.trail, '') // remove trailing + .replace(TOKENS.OS.rRestore, '/'); // add slash between segments + } + + //API + return { + strict : function(){ + _slashMode = STRICT_SLASH; + }, + loose : function(){ + _slashMode = LOOSE_SLASH; + }, + legacy : function(){ + _slashMode = LEGACY_SLASH; + }, + getParamIds : getParamIds, + getOptionalParamsIds : getOptionalParamsIds, + getParamValues : getParamValues, + compilePattern : compilePattern, + interpolate : interpolate + }; + + }()); + + + return crossroads; +}); +}(typeof define === 'function' && define.amd ? define : function (deps, factory) { + if (typeof module !== 'undefined' && module.exports) { //Node + module.exports = factory(require(deps[0])); + } else { + /*jshint sub:true */ + window['crossroads'] = factory(window[deps[0]]); + } +})); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/files/jquery.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/files/jquery.js new file mode 100644 index 00000000..8c24ffc6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/files/jquery.js @@ -0,0 +1,9472 @@ +/*! + * jQuery JavaScript Library v1.8.3 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time) + */ +(function( window, undefined ) { +var + // A central reference to the root jQuery(document) + rootjQuery, + + // The deferred used on DOM ready + readyList, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + location = window.location, + navigator = window.navigator, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // Save a reference to some core methods + core_push = Array.prototype.push, + core_slice = Array.prototype.slice, + core_indexOf = Array.prototype.indexOf, + core_toString = Object.prototype.toString, + core_hasOwn = Object.prototype.hasOwnProperty, + core_trim = String.prototype.trim, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Used for matching numbers + core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, + + // Used for detecting and trimming whitespace + core_rnotwhite = /\S/, + core_rspace = /\s+/, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + + // The ready event handler and self cleanup method + DOMContentLoaded = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + } else if ( document.readyState === "complete" ) { + // we're here because readyState === "complete" in oldIE + // which is good enough for us to call the dom ready! + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context && context.nodeType ? context.ownerDocument || context : document ); + + // scripts is true for back-compat + selector = jQuery.parseHTML( match[1], doc, true ); + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + this.attr.call( selector, context, true ); + } + + return jQuery.merge( this, selector ); + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.8.3", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return core_slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }, + + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ), + "slice", core_slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ core_toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // scripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, scripts ) { + var parsed; + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + scripts = context; + context = 0; + } + context = context || document; + + // Single tag + if ( (parsed = rsingleTag.exec( data )) ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); + return jQuery.merge( [], + (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); + }, + + parseJSON: function( data ) { + if ( !data || typeof data !== "string") { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && core_rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var name, + i = 0, + length = obj.length, + isObj = length === undefined || jQuery.isFunction( obj ); + + if ( args ) { + if ( isObj ) { + for ( name in obj ) { + if ( callback.apply( obj[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( obj[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in obj ) { + if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var type, + ret = results || []; + + if ( arr != null ) { + // The window, strings (and functions) also have 'length' + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + type = jQuery.type( arr ); + + if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { + core_push.call( ret, arr ); + } else { + jQuery.merge( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, + ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, pass ) { + var exec, + bulk = key == null, + i = 0, + length = elems.length; + + // Sets many values + if ( key && typeof key === "object" ) { + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); + } + chainable = 1; + + // Sets one value + } else if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = pass === undefined && jQuery.isFunction( value ); + + if ( bulk ) { + // Bulk operations only iterate when executing function values + if ( exec ) { + exec = fn; + fn = function( elem, key, value ) { + return exec.call( jQuery( elem ), value ); + }; + + // Otherwise they run against the entire set + } else { + fn.call( elems, value ); + fn = null; + } + } + + if ( fn ) { + for (; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + } + + chainable = 1; + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + } +}); + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready, 1 ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.split( core_rspace ), function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + return jQuery.inArray( fn, list ) > -1; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( list && ( !fired || stack ) ) { + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? + function() { + var returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + } : + newDefer[ action ] + ); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] = list.fire + deferred[ tuple[0] ] = list.fire; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); +jQuery.support = (function() { + + var support, + all, + a, + select, + opt, + input, + fragment, + eventName, + i, + isSupported, + clickFn, + div = document.createElement("div"); + + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = "
a"; + + // Support tests won't run in some limited or non-browser environments + all = div.getElementsByTagName("*"); + a = div.getElementsByTagName("a")[ 0 ]; + if ( !all || !a || !all.length ) { + return {}; + } + + // First batch of tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; + + a.style.cssText = "top:1px;float:left;opacity:.5"; + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute("href") === "/a" ), + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.5/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Tests for enctype support on a form (#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + + // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode + boxModel: ( document.compatMode === "CSS1Compat" ), + + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + boxSizingReliable: true, + pixelPosition: false + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", clickFn = function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent("onclick"); + div.detachEvent( "onclick", clickFn ); + } + + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; + + input.setAttribute( "checked", "checked" ); + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + fragment.removeChild( input ); + fragment.appendChild( div ); + + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for ( i in { + submit: true, + change: true, + focusin: true + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + // Run tests that need a body at doc ready + jQuery(function() { + var container, div, tds, marginDiv, + divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + container = document.createElement("div"); + container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; + body.insertBefore( container, body.firstChild ); + + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = "
t
"; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check box-sizing and margin behavior + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + support.boxSizing = ( div.offsetWidth === 4 ); + support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); + + // NOTE: To any future maintainer, we've window.getComputedStyle + // because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = document.createElement("div"); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } + + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = "block"; + div.style.overflow = "visible"; + div.innerHTML = "
"; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + + container.style.zoom = 1; + } + + // Null elements to avoid leaks in IE + body.removeChild( container ); + container = div = tds = marginDiv = null; + }); + + // Null elements to avoid leaks in IE + fragment.removeChild( div ); + all = a = select = opt = input = fragment = div = null; + + return support; +})(); +var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, + rmultiDash = /([A-Z])/g; + +jQuery.extend({ + cache: {}, + + deletedIds: [], + + // Remove at next major release (1.9/2.0) + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var parts, part, attr, name, l, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attr = elem.attributes; + for ( l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( !name.indexOf( "data-" ) ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + parts = key.split( ".", 2 ); + parts[1] = parts[1] ? "." + parts[1] : ""; + part = parts[1] + "!"; + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + data = this.triggerHandler( "getData" + part, [ parts[0] ] ); + + // Try to fetch any internally stored data first + if ( data === undefined && elem ) { + data = jQuery.data( elem, key ); + data = dataAttr( elem, key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + } + + parts[1] = value; + this.each(function() { + var self = jQuery( this ); + + self.triggerHandler( "setData" + part, parts ); + jQuery.data( this, key, value ); + self.triggerHandler( "changeData" + part, parts ); + }); + }, null, value, arguments.length > 1, null, false ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery.removeData( elem, type + "queue", true ); + jQuery.removeData( elem, key, true ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var nodeHook, boolHook, fixSpecified, + rclass = /[\t\r\n]/g, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea|)$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } + + if ( value && typeof value === "string" ) { + classNames = value.split( core_rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; + + } else { + setClass = " " + elem.className + " "; + + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var removes, className, elem, c, cl, i, l; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + if ( (value && typeof value === "string") || value === undefined ) { + removes = ( value || "" ).split( core_rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + if ( elem.nodeType === 1 && elem.className ) { + + className = (" " + elem.className + " ").replace( rclass, " " ); + + // loop over each item in the removal list + for ( c = 0, cl = removes.length; c < cl; c++ ) { + // Remove until there is nothing to remove, + while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { + className = className.replace( " " + removes[ c ] + " " , " " ); + } + } + elem.className = value ? jQuery.trim( className ) : ""; + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( core_rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var val, + self = jQuery(this); + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 + attrFn: {}, + + attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { + return jQuery( elem )[ name ]( value ); + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, value + "" ); + return value; + } + + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + ret = elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var propName, attrNames, name, isBool, + i = 0; + + if ( value && elem.nodeType === 1 ) { + + attrNames = value.split( core_rspace ); + + for ( ; i < attrNames.length; i++ ) { + name = attrNames[ i ]; + + if ( name ) { + propName = jQuery.propFix[ name ] || name; + isBool = rboolean.test( name ); + + // See #9699 for explanation of this approach (setting first, then removal) + // Do not do this for boolean attributes (see #10870) + if ( !isBool ) { + jQuery.attr( elem, name, "" ); + } + elem.removeAttribute( getSetAttribute ? name : propName ); + + // Set corresponding property to false for boolean attributes + if ( isBool && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + fixSpecified = { + name: true, + id: true, + coords: true + }; + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? + ret.value : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.value = value + "" ); + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); +var rformElems = /^(?:textarea|input|select)$/i, + rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, + rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + events = elemData.events; + if ( !events ) { + elemData.events = events = {}; + } + eventHandle = elemData.handle; + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { + + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + handlers = events[ type ]; + if ( !handlers ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var t, tns, type, origType, namespaces, origCount, + j, events, special, eventType, handleObj, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; + + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); + + if ( handleObj.selector ) { + eventType.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, "events", true ); + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + + // Event object or event type + var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, + type = event.type || event, + namespaces = []; + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); + } + } + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + for ( old = elem; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old === (elem.ownerDocument || document) ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + } + } + + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + + cur = eventPath[i][0]; + event.type = eventPath[i][1]; + + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, + handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = core_slice.call( arguments ), + run_all = !event.exclusive && !event.namespace, + special = jQuery.event.special[ event.type ] || {}, + handlerQueue = []; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers that should run if there are delegated events + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !(event.button && event.type === "click") ) { + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + + // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.disabled !== true || event.type !== "click" ) { + selMatch = {}; + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = jQuery.Event( originalEvent ); + + for ( i = copy.length; i; ) { + prop = copy[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Target should not be a text node (#504, Safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) + event.metaKey = !!event.metaKey; + + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +// Some plugins are using, but it's undocumented/deprecated and will be removed. +// The 1.7 special event interface should provide all the hooks needed now. +jQuery.event.handle = jQuery.event.dispatch; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === "undefined" ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "_submit_attached" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "_submit_attached", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "_change_attached", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { // && selector != null + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://sizzlejs.com/ + */ +(function( window, undefined ) { + +var cachedruns, + assertGetIdNotName, + Expr, + getText, + isXML, + contains, + compile, + sortOrder, + hasDuplicate, + outermostContext, + + baseHasDuplicate = true, + strundefined = "undefined", + + expando = ( "sizcache" + Math.random() ).replace( ".", "" ), + + Token = String, + document = window.document, + docElem = document.documentElement, + dirruns = 0, + done = 0, + pop = [].pop, + push = [].push, + slice = [].slice, + // Use a stripped-down indexOf if a native one is unavailable + indexOf = [].indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + // Augment a function for special use by Sizzle + markFunction = function( fn, value ) { + fn[ expando ] = value == null || value; + return fn; + }, + + createCache = function() { + var cache = {}, + keys = []; + + return markFunction(function( key, value ) { + // Only keep the most recent entries + if ( keys.push( key ) > Expr.cacheLength ) { + delete cache[ keys.shift() ]; + } + + // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) + return (cache[ key + " " ] = value); + }, cache ); + }, + + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + + // Regex + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + operators = "([*^$|!~]?=)", + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments not in parens/brackets, + // then attribute selectors and non-pseudos (denoted by :), + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", + + // For matchExpr.POS and matchExpr.needsContext + pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), + rpseudo = new RegExp( pseudos ), + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, + + rnot = /^:not/, + rsibling = /[\x20\t\r\n\f]*[+~]/, + rendsWithNot = /:not\($/, + + rheader = /h\d/i, + rinputs = /input|select|textarea|button/i, + + rbackslash = /\\(?!\\)/g, + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "POS": new RegExp( pos, "i" ), + "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + // For use in libraries implementing .is() + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) + }, + + // Support + + // Used for testing something on an element + assert = function( fn ) { + var div = document.createElement("div"); + + try { + return fn( div ); + } catch (e) { + return false; + } finally { + // release memory in IE + div = null; + } + }, + + // Check if getElementsByTagName("*") returns only elements + assertTagNameNoComments = assert(function( div ) { + div.appendChild( document.createComment("") ); + return !div.getElementsByTagName("*").length; + }), + + // Check if getAttribute returns normalized href attributes + assertHrefNotNormalized = assert(function( div ) { + div.innerHTML = ""; + return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && + div.firstChild.getAttribute("href") === "#"; + }), + + // Check if attributes should be retrieved by attribute nodes + assertAttributes = assert(function( div ) { + div.innerHTML = ""; + var type = typeof div.lastChild.getAttribute("multiple"); + // IE8 returns a string for some attributes even when not present + return type !== "boolean" && type !== "string"; + }), + + // Check if getElementsByClassName can be trusted + assertUsableClassName = assert(function( div ) { + // Opera can't find a second classname (in 9.6) + div.innerHTML = ""; + if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { + return false; + } + + // Safari 3.2 caches class attributes and doesn't catch changes + div.lastChild.className = "e"; + return div.getElementsByClassName("e").length === 2; + }), + + // Check if getElementById returns elements by name + // Check if getElementsByName privileges form controls or returns elements by ID + assertUsableName = assert(function( div ) { + // Inject content + div.id = expando + 0; + div.innerHTML = "
"; + docElem.insertBefore( div, docElem.firstChild ); + + // Test + var pass = document.getElementsByName && + // buggy browsers will return fewer than the correct 2 + document.getElementsByName( expando ).length === 2 + + // buggy browsers will return more than the correct 0 + document.getElementsByName( expando + 0 ).length; + assertGetIdNotName = !document.getElementById( expando ); + + // Cleanup + docElem.removeChild( div ); + + return pass; + }); + +// If slice is not available, provide a backup +try { + slice.call( docElem.childNodes, 0 )[0].nodeType; +} catch ( e ) { + slice = function( i ) { + var elem, + results = []; + for ( ; (elem = this[i]); i++ ) { + results.push( elem ); + } + return results; + }; +} + +function Sizzle( selector, context, results, seed ) { + results = results || []; + context = context || document; + var match, elem, xml, m, + nodeType = context.nodeType; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( nodeType !== 1 && nodeType !== 9 ) { + return []; + } + + xml = isXML( context ); + + if ( !xml && !seed ) { + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { + push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); + return results; + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); +} + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + return Sizzle( expr, null, null, [ elem ] ).length > 0; +}; + +// Returns a function to use in pseudos for input types +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +// Returns a function to use in pseudos for buttons +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +// Returns a function to use in pseudos for positionals +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + } else { + + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } + return ret; +}; + +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +// Element contains another +contains = Sizzle.contains = docElem.contains ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); + } : + docElem.compareDocumentPosition ? + function( a, b ) { + return b && !!( a.compareDocumentPosition( b ) & 16 ); + } : + function( a, b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + return false; + }; + +Sizzle.attr = function( elem, name ) { + var val, + xml = isXML( elem ); + + if ( !xml ) { + name = name.toLowerCase(); + } + if ( (val = Expr.attrHandle[ name ]) ) { + return val( elem ); + } + if ( xml || assertAttributes ) { + return elem.getAttribute( name ); + } + val = elem.getAttributeNode( name ); + return val ? + typeof elem[ name ] === "boolean" ? + elem[ name ] ? name : null : + val.specified ? val.value : null : + null; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + // IE6/7 return a modified href + attrHandle: assertHrefNotNormalized ? + {} : + { + "href": function( elem ) { + return elem.getAttribute( "href", 2 ); + }, + "type": function( elem ) { + return elem.getAttribute("type"); + } + }, + + find: { + "ID": assertGetIdNotName ? + function( id, context, xml ) { + if ( typeof context.getElementById !== strundefined && !xml ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + } : + function( id, context, xml ) { + if ( typeof context.getElementById !== strundefined && !xml ) { + var m = context.getElementById( id ); + + return m ? + m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? + [m] : + undefined : + []; + } + }, + + "TAG": assertTagNameNoComments ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + var elem, + tmp = [], + i = 0; + + for ( ; (elem = results[i]); i++ ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }, + + "NAME": assertUsableName && function( tag, context ) { + if ( typeof context.getElementsByName !== strundefined ) { + return context.getElementsByName( name ); + } + }, + + "CLASS": assertUsableClassName && function( className, context, xml ) { + if ( typeof context.getElementsByClassName !== strundefined && !xml ) { + return context.getElementsByClassName( className ); + } + } + }, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( rbackslash, "" ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 3 xn-component of xn+y argument ([+-]?\d*n|) + 4 sign of xn-component + 5 x of xn-component + 6 sign of y-component + 7 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1] === "nth" ) { + // nth-child requires argument + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); + match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); + + // other types prohibit arguments + } else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var unquoted, excess; + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + if ( match[3] ) { + match[2] = match[3]; + } else if ( (unquoted = match[4]) ) { + // Only check arguments that contain a pseudo + if ( rpseudo.test(unquoted) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + unquoted = unquoted.slice( 0, excess ); + match[0] = match[0].slice( 0, excess ); + } + match[2] = unquoted; + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + "ID": assertGetIdNotName ? + function( id ) { + id = id.replace( rbackslash, "" ); + return function( elem ) { + return elem.getAttribute("id") === id; + }; + } : + function( id ) { + id = id.replace( rbackslash, "" ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === id; + }; + }, + + "TAG": function( nodeName ) { + if ( nodeName === "*" ) { + return function() { return true; }; + } + nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); + + return function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ expando ][ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem, context ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.substr( result.length - check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, argument, first, last ) { + + if ( type === "nth" ) { + return function( elem ) { + var node, diff, + parent = elem.parentNode; + + if ( first === 1 && last === 0 ) { + return true; + } + + if ( parent ) { + diff = 0; + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + diff++; + if ( elem === node ) { + break; + } + } + } + } + + // Incorporate the offset (or cast to NaN), then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + }; + } + + return function( elem ) { + var node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + /* falls through */ + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + var nodeType; + elem = elem.firstChild; + while ( elem ) { + if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { + return false; + } + elem = elem.nextSibling; + } + return true; + }, + + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "text": function( elem ) { + var type, attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + (type = elem.type) === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); + }, + + // Input types + "radio": createInputPseudo("radio"), + "checkbox": createInputPseudo("checkbox"), + "file": createInputPseudo("file"), + "password": createInputPseudo("password"), + "image": createInputPseudo("image"), + + "submit": createButtonPseudo("submit"), + "reset": createButtonPseudo("reset"), + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "focus": function( elem ) { + var doc = elem.ownerDocument; + return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + "active": function( elem ) { + return elem === elem.ownerDocument.activeElement; + }, + + // Positional types + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + for ( var i = 0; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + for ( var i = 1; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +function siblingCheck( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; +} + +sortOrder = docElem.compareDocumentPosition ? + function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? + a.compareDocumentPosition : + a.compareDocumentPosition(b) & 4 + ) ? -1 : 1; + } : + function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + +// Always assume the presence of duplicates if sort doesn't +// pass them to our comparison function (as in Google Chrome). +[0, 0].sort( sortOrder ); +baseHasDuplicate = !hasDuplicate; + +// Document sorting and removing duplicates +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + i = 1, + j = 0; + + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem === results[ i - 1 ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + return results; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ expando ][ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( tokens = [] ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + tokens.push( matched = new Token( match.shift() ) ); + soFar = soFar.slice( matched.length ); + + // Cast descendant combinators to space + matched.type = match[0].replace( rtrim, " " ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + + tokens.push( matched = new Token( match.shift() ) ); + soFar = soFar.slice( matched.length ); + matched.type = type; + matched.matches = match; + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && combinator.dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( !xml ) { + var cache, + dirkey = dirruns + " " + doneName + " ", + cachedkey = dirkey + cachedruns; + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + if ( (cache = elem[ expando ]) === cachedkey ) { + return elem.sizset; + } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { + if ( elem.sizset ) { + return elem; + } + } else { + elem[ expando ] = cachedkey; + if ( matcher( elem, context, xml ) ) { + elem.sizset = true; + return elem; + } + elem.sizset = false; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + if ( matcher( elem, context, xml ) ) { + return elem; + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && tokens.join("") + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Nested matchers should use non-integer dirruns + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); + + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = superMatcher.el; + } + + // Add elements passing elementMatchers directly to results + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + for ( j = 0; (matcher = elementMatchers[j]); j++ ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++superMatcher.el; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + for ( j = 0; (matcher = setMatchers[j]); j++ ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + superMatcher.el = 0; + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ expando ][ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed, xml ) { + var i, tokens, token, type, find, + match = tokenize( selector ), + j = match.length; + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && !xml && + Expr.relative[ tokens[1].type ] ) { + + context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; + if ( !context ) { + return results; + } + + selector = selector.slice( tokens.shift().length ); + } + + // Fetch a seed set for right-to-left matching + for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( rbackslash, "" ), + rsibling.test( tokens[0].type ) && context.parentNode || context, + xml + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && tokens.join(""); + if ( !selector ) { + push.apply( results, slice.call( seed, 0 ) ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + xml, + results, + rsibling.test( selector ) + ); + return results; +} + +if ( document.querySelectorAll ) { + (function() { + var disconnectedMatch, + oldSelect = select, + rescape = /'|\\/g, + rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, + + // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA + // A support test would require too much code (would include document ready) + rbuggyQSA = [ ":focus" ], + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + // A support test would require too much code (would include document ready) + // just skip matchesSelector for :active + rbuggyMatches = [ ":active" ], + matches = docElem.matchesSelector || + docElem.mozMatchesSelector || + docElem.webkitMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector; + + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explictly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // IE8 - Some boolean attributes are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here (do not put tests after this one) + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + + // Opera 10-12/IE9 - ^= $= *= and empty values + // Should not select anything + div.innerHTML = "

"; + if ( div.querySelectorAll("[test^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here (do not put tests after this one) + div.innerHTML = ""; + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push(":enabled", ":disabled"); + } + }); + + // rbuggyQSA always contains :focus, so no need for a length check + rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); + + select = function( selector, context, results, seed, xml ) { + // Only use querySelectorAll when not filtering, + // when this is not xml, + // and when no QSA bugs apply + if ( !seed && !xml && !rbuggyQSA.test( selector ) ) { + var groups, i, + old = true, + nid = expando, + newContext = context, + newSelector = context.nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + groups[i].join(""); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, slice.call( newContext.querySelectorAll( + newSelector + ), 0 ) ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + + return oldSelect( selector, context, results, seed, xml ); + }; + + if ( matches ) { + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + try { + matches.call( div, "[test!='']:sizzle" ); + rbuggyMatches.push( "!=", pseudos ); + } catch ( e ) {} + }); + + // rbuggyMatches always contains :active and :focus, so no need for a length check + rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); + + Sizzle.matchesSelector = function( elem, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + // rbuggyMatches always contains :active, so no need for an existence check + if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) { + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, null, null, [ elem ] ).length > 0; + }; + } + })(); +} + +// Deprecated +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Back-compat +function setFilters() {} +Expr.filters = setFilters.prototype = Expr.pseudos; +Expr.setFilters = new setFilters(); + +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})( window ); +var runtil = /Until$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, + isSimple = /^.[^:#\[\.,]*$/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var i, l, length, n, r, ret, + self = this; + + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + ret = this.pushStack( "", "find", selector ); + + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + rneedsContext.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + cur = this[i]; + + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + } + cur = cur.parentNode; + } + } + + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +jQuery.fn.andSelf = jQuery.fn.addBack; + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( this.length > 1 && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /]", "i"), + rcheckableType = /^(?:checkbox|radio)$/, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /\/(java|ecma)script/i, + rcleanScript = /^\s*\s*$/g, + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
", "
" ], + thead: [ 1, "", "
" ], + tr: [ 2, "", "
" ], + td: [ 3, "", "
" ], + col: [ 2, "", "
" ], + area: [ 1, "", "" ], + _default: [ 0, "", "" ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, +// unless wrapped in a div with non-breaking characters in front of it. +if ( !jQuery.support.htmlSerialize ) { + wrapMap._default = [ 1, "X
", "
" ]; +} + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + if ( !isDisconnected( this[0] ) ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this ); + }); + } + + if ( arguments.length ) { + var set = jQuery.clean( arguments ); + return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); + } + }, + + after: function() { + if ( !isDisconnected( this[0] ) ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + } + + if ( arguments.length ) { + var set = jQuery.clean( arguments ); + return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); + } + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + jQuery.cleanData( [ elem ] ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName( "*" ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + if ( !isDisconnected( this[0] ) ) { + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( jQuery.isFunction( value ) ) { + return this.each(function(i) { + var self = jQuery(this), old = self.html(); + self.replaceWith( value.call( this, i, old ) ); + }); + } + + if ( typeof value !== "string" ) { + value = jQuery( value ).detach(); + } + + return this.each(function() { + var next = this.nextSibling, + parent = this.parentNode; + + jQuery( this ).remove(); + + if ( next ) { + jQuery(next).before( value ); + } else { + jQuery(parent).append( value ); + } + }); + } + + return this.length ? + this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : + this; + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + + // Flatten any nested arrays + args = [].concat.apply( [], args ); + + var results, first, fragment, iNoClone, + i = 0, + value = args[0], + scripts = [], + l = this.length; + + // We can't cloneNode fragments that contain checked, in WebKit + if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { + return this.each(function() { + jQuery(this).domManip( args, table, callback ); + }); + } + + if ( jQuery.isFunction(value) ) { + return this.each(function(i) { + var self = jQuery(this); + args[0] = value.call( this, i, table ? self.html() : undefined ); + self.domManip( args, table, callback ); + }); + } + + if ( this[0] ) { + results = jQuery.buildFragment( args, this, scripts ); + fragment = results.fragment; + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + // Fragments from the fragment cache must always be cloned and never used in place. + for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + i === iNoClone ? + fragment : + jQuery.clone( fragment, true, true ) + ); + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + + if ( scripts.length ) { + jQuery.each( scripts, function( i, elem ) { + if ( elem.src ) { + if ( jQuery.ajax ) { + jQuery.ajax({ + url: elem.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.error("no ajax"); + } + } else { + jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + }); + } + } + + return this; + } +}); + +function findOrAppend( elem, tag ) { + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function cloneFixAttributes( src, dest ) { + var nodeName; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + // clearAttributes removes the attributes, which we don't want, + // but also removes the attachEvent events, which we *do* want + if ( dest.clearAttributes ) { + dest.clearAttributes(); + } + + // mergeAttributes, in contrast, only merges back on the + // original attributes, not the events + if ( dest.mergeAttributes ) { + dest.mergeAttributes( src ); + } + + nodeName = dest.nodeName.toLowerCase(); + + if ( nodeName === "object" ) { + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + + // IE blanks contents when cloning scripts + } else if ( nodeName === "script" && dest.text !== src.text ) { + dest.text = src.text; + } + + // Event data gets referenced instead of copied if the expando + // gets copied too + dest.removeAttribute( jQuery.expando ); +} + +jQuery.buildFragment = function( args, context, scripts ) { + var fragment, cacheable, cachehit, + first = args[ 0 ]; + + // Set context from what may come in as undefined or a jQuery collection or a node + // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & + // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception + context = context || document; + context = !context.nodeType && context[0] || context; + context = context.ownerDocument || context; + + // Only cache "small" (1/2 KB) HTML strings that are associated with the main document + // Cloning options loses the selected state, so don't cache them + // IE 6 doesn't like it when you put or elements in a fragment + // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache + // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 + if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && + first.charAt(0) === "<" && !rnocache.test( first ) && + (jQuery.support.checkClone || !rchecked.test( first )) && + (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { + + // Mark cacheable and look for a hit + cacheable = true; + fragment = jQuery.fragments[ first ]; + cachehit = fragment !== undefined; + } + + if ( !fragment ) { + fragment = context.createDocumentFragment(); + jQuery.clean( args, context, fragment, scripts ); + + // Update the cache, but only store false + // unless this is a second parsing of the same content + if ( cacheable ) { + jQuery.fragments[ first ] = cachehit && fragment; + } + } + + return { fragment: fragment, cacheable: cacheable }; +}; + +jQuery.fragments = {}; + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + l = insert.length, + parent = this.length === 1 && this[0].parentNode; + + if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { + insert[ original ]( this[0] ); + return this; + } else { + for ( ; i < l; i++ ) { + elems = ( i > 0 ? this.clone(true) : this ).get(); + jQuery( insert[i] )[ original ]( elems ); + ret = ret.concat( elems ); + } + + return this.pushStack( ret, name, insert.selector ); + } + }; +}); + +function getAll( elem ) { + if ( typeof elem.getElementsByTagName !== "undefined" ) { + return elem.getElementsByTagName( "*" ); + + } else if ( typeof elem.querySelectorAll !== "undefined" ) { + return elem.querySelectorAll( "*" ); + + } else { + return []; + } +} + +// Used in clean, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var srcElements, + destElements, + i, + clone; + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + // IE copies events bound via attachEvent when using cloneNode. + // Calling detachEvent on the clone will also remove the events + // from the original. In order to get around this, we use some + // proprietary methods to clear the events. Thanks to MooTools + // guys for this hotness. + + cloneFixAttributes( elem, clone ); + + // Using Sizzle here is crazy slow, so we use getElementsByTagName instead + srcElements = getAll( elem ); + destElements = getAll( clone ); + + // Weird iteration because IE will replace the length property + // with an element if you are cloning the body and one of the + // elements on the page has a name or id of "length" + for ( i = 0; srcElements[i]; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + cloneFixAttributes( srcElements[i], destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + cloneCopyEvent( elem, clone ); + + if ( deepDataAndEvents ) { + srcElements = getAll( elem ); + destElements = getAll( clone ); + + for ( i = 0; srcElements[i]; ++i ) { + cloneCopyEvent( srcElements[i], destElements[i] ); + } + } + } + + srcElements = destElements = null; + + // Return the cloned set + return clone; + }, + + clean: function( elems, context, fragment, scripts ) { + var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, + safe = context === document && safeFragment, + ret = []; + + // Ensure that context is a document + if ( !context || typeof context.createDocumentFragment === "undefined" ) { + context = document; + } + + // Use the already-created safe fragment if context permits + for ( i = 0; (elem = elems[i]) != null; i++ ) { + if ( typeof elem === "number" ) { + elem += ""; + } + + if ( !elem ) { + continue; + } + + // Convert html string into DOM nodes + if ( typeof elem === "string" ) { + if ( !rhtml.test( elem ) ) { + elem = context.createTextNode( elem ); + } else { + // Ensure a safe container in which to render the html + safe = safe || createSafeFragment( context ); + div = context.createElement("div"); + safe.appendChild( div ); + + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(rxhtmlTag, "<$1>"); + + // Go to html and back, then peel off extra wrappers + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + depth = wrap[0]; + div.innerHTML = wrap[1] + elem + wrap[2]; + + // Move to the right depth + while ( depth-- ) { + div = div.lastChild; + } + + // Remove IE's autoinserted from table fragments + if ( !jQuery.support.tbody ) { + + // String was a , *may* have spurious + hasBody = rtbody.test(elem); + tbody = tag === "table" && !hasBody ? + div.firstChild && div.firstChild.childNodes : + + // String was a bare or + wrap[1] === "
" && !hasBody ? + div.childNodes : + []; + + for ( j = tbody.length - 1; j >= 0 ; --j ) { + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { + tbody[ j ].parentNode.removeChild( tbody[ j ] ); + } + } + } + + // IE completely kills leading whitespace when innerHTML is used + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); + } + + elem = div.childNodes; + + // Take out of fragment container (we need a fresh div each time) + div.parentNode.removeChild( div ); + } + } + + if ( elem.nodeType ) { + ret.push( elem ); + } else { + jQuery.merge( ret, elem ); + } + } + + // Fix #11356: Clear elements from safeFragment + if ( div ) { + elem = div = safe = null; + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + for ( i = 0; (elem = ret[i]) != null; i++ ) { + if ( jQuery.nodeName( elem, "input" ) ) { + fixDefaultChecked( elem ); + } else if ( typeof elem.getElementsByTagName !== "undefined" ) { + jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); + } + } + } + + // Append elements to a provided document fragment + if ( fragment ) { + // Special handling of each script element + handleScript = function( elem ) { + // Check if we consider it executable + if ( !elem.type || rscriptType.test( elem.type ) ) { + // Detach the script and store it in the scripts array (if provided) or the fragment + // Return truthy to indicate that it has been handled + return scripts ? + scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : + fragment.appendChild( elem ); + } + }; + + for ( i = 0; (elem = ret[i]) != null; i++ ) { + // Check if we're done after handling an executable script + if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { + // Append to fragment and handle embedded scripts + fragment.appendChild( elem ); + if ( typeof elem.getElementsByTagName !== "undefined" ) { + // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration + jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); + + // Splice the scripts into ret after their former ancestor and advance our index beyond them + ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); + i += jsTags.length; + } + } + } + } + + return ret; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var data, id, elem, type, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( elem.removeAttribute ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + jQuery.deletedIds.push( id ); + } + } + } + } + } +}); +// Limit scope pollution from any deprecated API +(function() { + +var matched, browser; + +// Use of jQuery.browser is frowned upon. +// More details: http://api.jquery.com/jQuery.browser +// jQuery.uaMatch maintained for back-compat +jQuery.uaMatch = function( ua ) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; +}; + +matched = jQuery.uaMatch( navigator.userAgent ); +browser = {}; + +if ( matched.browser ) { + browser[ matched.browser ] = true; + browser.version = matched.version; +} + +// Chrome is Webkit, but Webkit is also Safari. +if ( browser.chrome ) { + browser.webkit = true; +} else if ( browser.webkit ) { + browser.safari = true; +} + +jQuery.browser = browser; + +jQuery.sub = function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; +}; + +})(); +var curCSS, iframe, iframeDoc, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity=([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], + + eventsToggle = jQuery.fn.toggle; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var elem, display, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + values[ index ] = jQuery._data( elem, "olddisplay" ); + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && elem.style.display === "none" ) { + elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else { + display = curCSS( elem, "display" ); + + if ( !values[ index ] && display !== "none" ) { + jQuery._data( elem, "olddisplay", display ); + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state, fn2 ) { + var bool = typeof state === "boolean"; + + if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { + return eventsToggle.apply( this, arguments ); + } + + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, numeric, extra ) { + var val, num, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( numeric || extra !== undefined ) { + num = parseFloat( val ); + return numeric || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.call( elem ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// NOTE: To any future maintainer, we've window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + curCSS = function( elem, name ) { + var ret, width, minWidth, maxWidth, + computed = window.getComputedStyle( elem, null ), + style = elem.style; + + if ( computed ) { + + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + curCSS = function( elem, name ) { + var left, rsLeft, + ret = elem.currentStyle && elem.currentStyle[ name ], + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + elem.runtimeStyle.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + elem.runtimeStyle.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + // we use jQuery.css instead of curCSS here + // because of the reliableMarginRight CSS hook! + val += jQuery.css( elem, extra + cssExpand[ i ], true ); + } + + // From this point on we use curCSS for maximum performance (relevant in animations) + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + } else { + // at this point, extra isn't content, so add padding + val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + valueIsBorderBox = true, + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox + ) + ) + "px"; +} + + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + if ( elemdisplay[ nodeName ] ) { + return elemdisplay[ nodeName ]; + } + + var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), + display = elem.css("display"); + elem.remove(); + + // If the simple way fails, + // get element's real default display by attaching it to a temp iframe + if ( display === "none" || display === "" ) { + // Use the already-created iframe if possible + iframe = document.body.appendChild( + iframe || jQuery.extend( document.createElement("iframe"), { + frameBorder: 0, + width: 0, + height: 0 + }) + ); + + // Create a cacheable copy of the iframe document on first call. + // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML + // document to it; WebKit & Firefox won't allow reusing the iframe document. + if ( !iframeDoc || !iframe.createElement ) { + iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; + iframeDoc.write(""); + iframeDoc.close(); + } + + elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); + + display = curCSS( elem, "display" ); + document.body.removeChild( iframe ); + } + + // Store the correct default display + elemdisplay[ nodeName ] = display; + + return display; +} + +jQuery.each([ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + // certain elements can have dimension info if we invisibly show them + // however, it must have a current display style that would benefit from this + if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { + return jQuery.swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + }); + } else { + return getWidthOrHeight( elem, name, extra ); + } + } + }, + + set: function( elem, value, extra ) { + return setPositiveNumber( elem, value, extra ? + augmentWidthOrHeight( + elem, + name, + extra, + jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" + ) : 0 + ); + } + }; +}); + +if ( !jQuery.support.opacity ) { + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : + computed ? "1" : ""; + }, + + set: function( elem, value ) { + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; + + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; + + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && + style.removeAttribute ) { + + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); + + // if there there is no filter style applied in a css rule, we are done + if ( currentStyle && !currentStyle.filter ) { + return; + } + } + + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; + } + }; +} + +// These hooks cannot be added until DOM ready because the support test +// for it is not run until after DOM ready +jQuery(function() { + if ( !jQuery.support.reliableMarginRight ) { + jQuery.cssHooks.marginRight = { + get: function( elem, computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + return jQuery.swap( elem, { "display": "inline-block" }, function() { + if ( computed ) { + return curCSS( elem, "marginRight" ); + } + }); + } + }; + } + + // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 + // getComputedStyle returns percent when specified for top/left/bottom/right + // rather than make the css module depend on the offset module, we just check for it here + if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { + jQuery.each( [ "top", "left" ], function( i, prop ) { + jQuery.cssHooks[ prop ] = { + get: function( elem, computed ) { + if ( computed ) { + var ret = curCSS( elem, prop ); + // if curCSS returns percentage, fallback to offset + return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; + } + } + }; + }); + } + +}); + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.hidden = function( elem ) { + return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); + }; + + jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); + }; +} + +// These hooks are used by animate to expand properties +jQuery.each({ + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i, + + // assumes a single number if not a string + parts = typeof value === "string" ? value.split(" ") : [ value ], + expanded = {}; + + for ( i = 0; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +}); +var r20 = /%20/g, + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, + rselectTextarea = /^(?:select|textarea)/i; + +jQuery.fn.extend({ + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map(function(){ + return this.elements ? jQuery.makeArray( this.elements ) : this; + }) + .filter(function(){ + return this.name && !this.disabled && + ( this.checked || rselectTextarea.test( this.nodeName ) || + rinput.test( this.type ) ); + }) + .map(function( i, elem ){ + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val, i ){ + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }).get(); + } +}); + +//Serialize an array of form elements or a set of +//key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; + + // Set traditional to true for jQuery <= 1.3.2 behavior. + if ( traditional === undefined ) { + traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + }); + + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ).replace( r20, "+" ); +}; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( jQuery.isArray( obj ) ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + // If array item is non-scalar (array or object), encode its + // numeric index to resolve deserialization ambiguity issues. + // Note that rack (as of 1.0.0) can't currently deserialize + // nested arrays properly, and attempting to do so may cause + // a server error. Possible fixes are to modify rack's + // deserialization algorithm or to provide an option or flag + // to force array serialization to be shallow. + buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); + } + }); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + // Serialize scalar item. + add( prefix, obj ); + } +} +var + // Document location + ajaxLocParts, + ajaxLocation, + + rhash = /#.*$/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + rquery = /\?/, + rscript = /)<[^<]*)*<\/script>/gi, + rts = /([?&])_=[^&]*/, + rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, + + // Keep a copy of the old load method + _load = jQuery.fn.load, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = ["*/"] + ["*"]; + +// #8138, IE may throw an exception when accessing +// a field from window.location if document.domain has been set +try { + ajaxLocation = location.href; +} catch( e ) { + // Use the href attribute of an A element + // since IE will modify it given document.location + ajaxLocation = document.createElement( "a" ); + ajaxLocation.href = ""; + ajaxLocation = ajaxLocation.href; +} + +// Segment location into parts +ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, list, placeBefore, + dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), + i = 0, + length = dataTypes.length; + + if ( jQuery.isFunction( func ) ) { + // For each dataType in the dataTypeExpression + for ( ; i < length; i++ ) { + dataType = dataTypes[ i ]; + // We control if we're asked to add before + // any existing element + placeBefore = /^\+/.test( dataType ); + if ( placeBefore ) { + dataType = dataType.substr( 1 ) || "*"; + } + list = structure[ dataType ] = structure[ dataType ] || []; + // then we add to the structure accordingly + list[ placeBefore ? "unshift" : "push" ]( func ); + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, + dataType /* internal */, inspected /* internal */ ) { + + dataType = dataType || options.dataTypes[ 0 ]; + inspected = inspected || {}; + + inspected[ dataType ] = true; + + var selection, + list = structure[ dataType ], + i = 0, + length = list ? list.length : 0, + executeOnly = ( structure === prefilters ); + + for ( ; i < length && ( executeOnly || !selection ); i++ ) { + selection = list[ i ]( options, originalOptions, jqXHR ); + // If we got redirected to another dataType + // we try there if executing only and not done already + if ( typeof selection === "string" ) { + if ( !executeOnly || inspected[ selection ] ) { + selection = undefined; + } else { + options.dataTypes.unshift( selection ); + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, selection, inspected ); + } + } + } + // If we're only executing or nothing was selected + // we try the catchall dataType if not done already + if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, "*", inspected ); + } + // unnecessary when only executing (prefilters) + // but it'll be ignored by the caller in that case + return selection; +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } +} + +jQuery.fn.load = function( url, params, callback ) { + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); + } + + // Don't do a request if no elements are being requested + if ( !this.length ) { + return this; + } + + var selector, type, response, + self = this, + off = url.indexOf(" "); + + if ( off >= 0 ) { + selector = url.slice( off, url.length ); + url = url.slice( 0, off ); + } + + // If it's a function + if ( jQuery.isFunction( params ) ) { + + // We assume that it's the callback + callback = params; + params = undefined; + + // Otherwise, build a param string + } else if ( params && typeof params === "object" ) { + type = "POST"; + } + + // Request the remote document + jQuery.ajax({ + url: url, + + // if "type" variable is undefined, then "GET" method will be used + type: type, + dataType: "html", + data: params, + complete: function( jqXHR, status ) { + if ( callback ) { + self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); + } + } + }).done(function( responseText ) { + + // Save response for use in complete callback + response = arguments; + + // See if a selector was specified + self.html( selector ? + + // Create a dummy div to hold the results + jQuery("
") + + // inject the contents of the document in, removing the scripts + // to avoid any 'Permission Denied' errors in IE + .append( responseText.replace( rscript, "" ) ) + + // Locate the specified elements + .find( selector ) : + + // If not, just inject the full result + responseText ); + + }); + + return this; +}; + +// Attach a bunch of functions for handling common AJAX events +jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ + jQuery.fn[ o ] = function( f ){ + return this.on( o, f ); + }; +}); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + return jQuery.ajax({ + type: method, + url: url, + data: data, + success: callback, + dataType: type + }); + }; +}); + +jQuery.extend({ + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + if ( settings ) { + // Building a settings object + ajaxExtend( target, jQuery.ajaxSettings ); + } else { + // Extending ajaxSettings + settings = target; + target = jQuery.ajaxSettings; + } + ajaxExtend( target, settings ); + return target; + }, + + ajaxSettings: { + url: ajaxLocation, + isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), + global: true, + type: "GET", + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + processData: true, + async: true, + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + xml: "application/xml, text/xml", + html: "text/html", + text: "text/plain", + json: "application/json, text/javascript", + "*": allTypes + }, + + contents: { + xml: /xml/, + html: /html/, + json: /json/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText" + }, + + // List of data converters + // 1) key format is "source_type destination_type" (a single space in-between) + // 2) the catchall symbol "*" can be used for source_type + converters: { + + // Convert anything to text + "* text": window.String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": jQuery.parseJSON, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + context: true, + url: true + } + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var // ifModified key + ifModifiedKey, + // Response headers + responseHeadersString, + responseHeaders, + // transport + transport, + // timeout handle + timeoutTimer, + // Cross-domain detection vars + parts, + // To know if global events are to be dispatched + fireGlobals, + // Loop variable + i, + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + // Callbacks context + callbackContext = s.context || s, + // Context for global events + // It's the callbackContext if one was provided in the options + // and if it's a DOM node or a jQuery collection + globalEventContext = callbackContext !== s && + ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? + jQuery( callbackContext ) : jQuery.event, + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + // Status-dependent callbacks + statusCode = s.statusCode || {}, + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + // The jqXHR state + state = 0, + // Default abort message + strAbort = "canceled", + // Fake xhr + jqXHR = { + + readyState: 0, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( !state ) { + var lname = name.toLowerCase(); + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( state === 2 ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match === undefined ? null : match; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( !state ) { + s.mimeType = type; + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + statusText = statusText || strAbort; + if ( transport ) { + transport.abort( statusText ); + } + done( 0, statusText ); + return this; + } + }; + + // Callback for when everything is done + // It is defined here because jslint complains if it is declared + // at the end of the function (which would be more logical and readable) + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Called once + if ( state === 2 ) { + return; + } + + // State is "done" now + state = 2; + + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // If successful, handle type chaining + if ( status >= 200 && status < 300 || status === 304 ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + + modified = jqXHR.getResponseHeader("Last-Modified"); + if ( modified ) { + jQuery.lastModified[ ifModifiedKey ] = modified; + } + modified = jqXHR.getResponseHeader("Etag"); + if ( modified ) { + jQuery.etag[ ifModifiedKey ] = modified; + } + } + + // If not modified + if ( status === 304 ) { + + statusText = "notmodified"; + isSuccess = true; + + // If we have data + } else { + + isSuccess = ajaxConvert( s, response ); + statusText = isSuccess.state; + success = isSuccess.data; + error = isSuccess.error; + isSuccess = !error; + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if ( !statusText || status ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + // Attach deferreds + deferred.promise( jqXHR ); + jqXHR.success = jqXHR.done; + jqXHR.error = jqXHR.fail; + jqXHR.complete = completeDeferred.add; + + // Status-dependent callbacks + jqXHR.statusCode = function( map ) { + if ( map ) { + var tmp; + if ( state < 2 ) { + for ( tmp in map ) { + statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; + } + } else { + tmp = map[ jqXHR.status ]; + jqXHR.always( tmp ); + } + } + return this; + }; + + // Remove hash character (#7531: and string promotion) + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // We also use the url parameter if available + s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + + // Extract dataTypes list + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); + + // A cross-domain request is in order when we have a protocol:host:port mismatch + if ( s.crossDomain == null ) { + parts = rurl.exec( s.url.toLowerCase() ); + s.crossDomain = !!( parts && + ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != + ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) + ); + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( state === 2 ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + fireGlobals = s.global; + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // If data is available, append data to url + if ( s.data ) { + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Get ifModifiedKey before adding the anti-cache parameter + ifModifiedKey = s.url; + + // Add anti-cache in url if needed + if ( s.cache === false ) { + + var ts = jQuery.now(), + // try replacing _= if it is there + ret = s.url.replace( rts, "$1_=" + ts ); + + // if nothing was replaced, add timestamp to the end + s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + ifModifiedKey = ifModifiedKey || s.url; + if ( jQuery.lastModified[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); + } + if ( jQuery.etag[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); + } + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { + // Abort if not done already and return + return jqXHR.abort(); + + } + + // aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + for ( i in { success: 1, error: 1, complete: 1 } ) { + jqXHR[ i ]( s[ i ] ); + } + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = setTimeout( function(){ + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + state = 1; + transport.send( requestHeaders, done ); + } catch (e) { + // Propagate exception as error if not done + if ( state < 2 ) { + done( -1, e ); + // Simply rethrow otherwise + } else { + throw e; + } + } + } + + return jqXHR; + }, + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {} + +}); + +/* Handles responses to an ajax request: + * - sets all responseXXX fields accordingly + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes, + responseFields = s.responseFields; + + // Fill responseXXX fields + for ( type in responseFields ) { + if ( type in responses ) { + jqXHR[ responseFields[type] ] = responses[ type ]; + } + } + + // Remove auto dataType and get content-type in the process + while( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +// Chain conversions given the request and the original response +function ajaxConvert( s, response ) { + + var conv, conv2, current, tmp, + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(), + prev = dataTypes[ 0 ], + converters = {}, + i = 0; + + // Apply the dataFilter if provided + if ( s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + // Convert to each sequential dataType, tolerating list modification + for ( ; (current = dataTypes[++i]); ) { + + // There's only work to do if current dataType is non-auto + if ( current !== "*" ) { + + // Convert response if prev dataType is non-auto and differs from current + if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split(" "); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.splice( i--, 0, current ); + } + + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s["throws"] ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; + } + } + } + } + + // Update prev for next iteration + prev = current; + } + } + + return { state: "success", data: response }; +} +var oldCallbacks = [], + rquestion = /\?/, + rjsonp = /(=)\?(?=&|$)|\?\?/, + nonce = jQuery.now(); + +// Default jsonp settings +jQuery.ajaxSetup({ + jsonp: "callback", + jsonpCallback: function() { + var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); + this[ callback ] = true; + return callback; + } +}); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { + + var callbackName, overwritten, responseContainer, + data = s.data, + url = s.url, + hasCallback = s.jsonp !== false, + replaceInUrl = hasCallback && rjsonp.test( url ), + replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && + !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && + rjsonp.test( data ); + + // Handle iff the expected data type is "jsonp" or we have a parameter to set + if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { + + // Get callback name, remembering preexisting value associated with it + callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? + s.jsonpCallback() : + s.jsonpCallback; + overwritten = window[ callbackName ]; + + // Insert callback into url or form data + if ( replaceInUrl ) { + s.url = url.replace( rjsonp, "$1" + callbackName ); + } else if ( replaceInData ) { + s.data = data.replace( rjsonp, "$1" + callbackName ); + } else if ( hasCallback ) { + s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; + } + + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( !responseContainer ) { + jQuery.error( callbackName + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // force json dataType + s.dataTypes[ 0 ] = "json"; + + // Install callback + window[ callbackName ] = function() { + responseContainer = arguments; + }; + + // Clean-up function (fires after converters) + jqXHR.always(function() { + // Restore preexisting value + window[ callbackName ] = overwritten; + + // Save back as free + if ( s[ callbackName ] ) { + // make sure that re-using the options doesn't screw things around + s.jsonpCallback = originalSettings.jsonpCallback; + + // save the callback name for future use + oldCallbacks.push( callbackName ); + } + + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( overwritten ) ) { + overwritten( responseContainer[ 0 ] ); + } + + responseContainer = overwritten = undefined; + }); + + // Delegate to script + return "script"; + } +}); +// Install script dataType +jQuery.ajaxSetup({ + accepts: { + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /javascript|ecmascript/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +}); + +// Handle cache's special case and global +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; + } +}); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function(s) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + + var script, + head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; + + return { + + send: function( _, callback ) { + + script = document.createElement( "script" ); + + script.async = "async"; + + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; + } + + script.src = s.url; + + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { + + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { + + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; + + // Remove the script + if ( head && script.parentNode ) { + head.removeChild( script ); + } + + // Dereference the script + script = undefined; + + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709 and #4378). + head.insertBefore( script, head.firstChild ); + }, + + abort: function() { + if ( script ) { + script.onload( 0, 1 ); + } + } + }; + } +}); +var xhrCallbacks, + // #5280: Internet Explorer will keep connections alive if we don't abort on unload + xhrOnUnloadAbort = window.ActiveXObject ? function() { + // Abort all pending requests + for ( var key in xhrCallbacks ) { + xhrCallbacks[ key ]( 0, 1 ); + } + } : false, + xhrId = 0; + +// Functions to create xhrs +function createStandardXHR() { + try { + return new window.XMLHttpRequest(); + } catch( e ) {} +} + +function createActiveXHR() { + try { + return new window.ActiveXObject( "Microsoft.XMLHTTP" ); + } catch( e ) {} +} + +// Create the request object +// (This is still attached to ajaxSettings for backward compatibility) +jQuery.ajaxSettings.xhr = window.ActiveXObject ? + /* Microsoft failed to properly + * implement the XMLHttpRequest in IE7 (can't request local files), + * so we use the ActiveXObject when it is available + * Additionally XMLHttpRequest can be disabled in IE7/IE8 so + * we need a fallback. + */ + function() { + return !this.isLocal && createStandardXHR() || createActiveXHR(); + } : + // For all other browsers, use the standard XMLHttpRequest object + createStandardXHR; + +// Determine support properties +(function( xhr ) { + jQuery.extend( jQuery.support, { + ajax: !!xhr, + cors: !!xhr && ( "withCredentials" in xhr ) + }); +})( jQuery.ajaxSettings.xhr() ); + +// Create transport if the browser can provide an xhr +if ( jQuery.support.ajax ) { + + jQuery.ajaxTransport(function( s ) { + // Cross domain only allowed if supported through XMLHttpRequest + if ( !s.crossDomain || jQuery.support.cors ) { + + var callback; + + return { + send: function( headers, complete ) { + + // Get a new xhr + var handle, i, + xhr = s.xhr(); + + // Open the socket + // Passing null username, generates a login popup on Opera (#2865) + if ( s.username ) { + xhr.open( s.type, s.url, s.async, s.username, s.password ); + } else { + xhr.open( s.type, s.url, s.async ); + } + + // Apply custom fields if provided + if ( s.xhrFields ) { + for ( i in s.xhrFields ) { + xhr[ i ] = s.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( s.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( s.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !s.crossDomain && !headers["X-Requested-With"] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + } catch( _ ) {} + + // Do send the request + // This may raise an exception which is actually + // handled in jQuery.ajax (so no try/catch here) + xhr.send( ( s.hasContent && s.data ) || null ); + + // Listener + callback = function( _, isAbort ) { + + var status, + statusText, + responseHeaders, + responses, + xml; + + // Firefox throws exceptions when accessing properties + // of an xhr when a network error occurred + // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) + try { + + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + + // Only called once + callback = undefined; + + // Do not keep as active anymore + if ( handle ) { + xhr.onreadystatechange = jQuery.noop; + if ( xhrOnUnloadAbort ) { + delete xhrCallbacks[ handle ]; + } + } + + // If it's an abort + if ( isAbort ) { + // Abort it manually if needed + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + status = xhr.status; + responseHeaders = xhr.getAllResponseHeaders(); + responses = {}; + xml = xhr.responseXML; + + // Construct response list + if ( xml && xml.documentElement /* #4958 */ ) { + responses.xml = xml; + } + + // When requesting binary data, IE6-9 will throw an exception + // on any attempt to access responseText (#11426) + try { + responses.text = xhr.responseText; + } catch( e ) { + } + + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } + + // Filter status for non standard behaviors + + // If the request is local and we have data: assume a success + // (success with no data won't get notified, that's the best we + // can do given current implementations) + if ( !status && s.isLocal && !s.crossDomain ) { + status = responses.text ? 200 : 404; + // IE - #1450: sometimes returns 1223 when it should be 204 + } else if ( status === 1223 ) { + status = 204; + } + } + } + } catch( firefoxAccessException ) { + if ( !isAbort ) { + complete( -1, firefoxAccessException ); + } + } + + // Call complete if needed + if ( responses ) { + complete( status, statusText, responses, responseHeaders ); + } + }; + + if ( !s.async ) { + // if we're in sync mode we fire the callback + callback(); + } else if ( xhr.readyState === 4 ) { + // (IE6 & IE7) if it's in cache and has been + // retrieved directly we need to fire the callback + setTimeout( callback, 0 ); + } else { + handle = ++xhrId; + if ( xhrOnUnloadAbort ) { + // Create the active xhrs callbacks list if needed + // and attach the unload handler + if ( !xhrCallbacks ) { + xhrCallbacks = {}; + jQuery( window ).unload( xhrOnUnloadAbort ); + } + // Add to list of active xhrs callbacks + xhrCallbacks[ handle ] = callback; + } + xhr.onreadystatechange = callback; + } + }, + + abort: function() { + if ( callback ) { + callback(0,1); + } + } + }; + } + }); +} +var fxNow, timerId, + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), + rrun = /queueHooks$/, + animationPrefilters = [ defaultPrefilter ], + tweeners = { + "*": [function( prop, value ) { + var end, unit, + tween = this.createTween( prop, value ), + parts = rfxnum.exec( value ), + target = tween.cur(), + start = +target || 0, + scale = 1, + maxIterations = 20; + + if ( parts ) { + end = +parts[2]; + unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + + // We need to compute starting value + if ( unit !== "px" && start ) { + // Iteratively approximate from a nonzero starting point + // Prefer the current property, because this process will be trivial if it uses the same units + // Fallback to end or a simple constant + start = jQuery.css( tween.elem, prop, true ) || end || 1; + + do { + // If previous iteration zeroed out, double until we get *something* + // Use a string for doubling factor so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + start = start / scale; + jQuery.style( tween.elem, prop, start + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // And breaking the loop if scale is unchanged or perfect, or if we've just had enough + } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); + } + + tween.unit = unit; + tween.start = start; + // If a +=/-= token was provided, we're doing a relative animation + tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; + } + return tween; + }] + }; + +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout(function() { + fxNow = undefined; + }, 0 ); + return ( fxNow = jQuery.now() ); +} + +function createTweens( animation, props ) { + jQuery.each( props, function( prop, value ) { + var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( collection[ index ].call( animation, prop, value ) ) { + + // we're done with this property + return; + } + } + }); +} + +function Animation( elem, properties, options ) { + var result, + index = 0, + tweenerIndex = 0, + length = animationPrefilters.length, + deferred = jQuery.Deferred().always( function() { + // don't match elem in the :animated selector + delete tick.elem; + }), + tick = function() { + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ]); + + if ( percent < 1 && length ) { + return remaining; + } else { + deferred.resolveWith( elem, [ animation ] ); + return false; + } + }, + animation = deferred.promise({ + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { specialEasing: {} }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end, easing ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + // if we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // resolve when we played the last frame + // otherwise, reject + if ( gotoEnd ) { + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + }), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length ; index++ ) { + result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + return result; + } + } + + createTweens( animation, props ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + jQuery.fx.timer( + jQuery.extend( tick, { + anim: animation, + queue: animation.opts.queue, + elem: elem + }) + ); + + // attach callbacks from options + return animation.progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( jQuery.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // not quite $.extend, this wont overwrite keys already present. + // also - reusing 'index' from above because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.split(" "); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length ; index++ ) { + prop = props[ index ]; + tweeners[ prop ] = tweeners[ prop ] || []; + tweeners[ prop ].unshift( callback ); + } + }, + + prefilter: function( callback, prepend ) { + if ( prepend ) { + animationPrefilters.unshift( callback ); + } else { + animationPrefilters.push( callback ); + } + } +}); + +function defaultPrefilter( elem, props, opts ) { + var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, + anim = this, + style = elem.style, + orig = {}, + handled = [], + hidden = elem.nodeType && isHidden( elem ); + + // handle queue: false promises + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always(function() { + // doing this makes sure that the complete handler will be called + // before this completes + anim.always(function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + }); + }); + } + + // height/width overflow pass + if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { + // Make sure that nothing sneaks out + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height animated + if ( jQuery.css( elem, "display" ) === "inline" && + jQuery.css( elem, "float" ) === "none" ) { + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { + style.display = "inline-block"; + + } else { + style.zoom = 1; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + if ( !jQuery.support.shrinkWrapBlocks ) { + anim.done(function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + }); + } + } + + + // show/hide pass + for ( index in props ) { + value = props[ index ]; + if ( rfxtypes.exec( value ) ) { + delete props[ index ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + continue; + } + handled.push( index ); + } + } + + length = handled.length; + if ( length ) { + dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + + // store state if its toggle - enables .stop().toggle() to "reverse" + if ( toggle ) { + dataShow.hidden = !hidden; + } + if ( hidden ) { + jQuery( elem ).show(); + } else { + anim.done(function() { + jQuery( elem ).hide(); + }); + } + anim.done(function() { + var prop; + jQuery.removeData( elem, "fxshow", true ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + }); + for ( index = 0 ; index < length ; index++ ) { + prop = handled[ index ]; + tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); + orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); + + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = tween.start; + if ( hidden ) { + tween.end = tween.start; + tween.start = prop === "width" || prop === "height" ? 1 : 0; + } + } + } + } +} + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || "swing"; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + if ( tween.elem[ tween.prop ] != null && + (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { + return tween.elem[ tween.prop ]; + } + + // passing any value as a 4th parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails + // so, simple values such as "10px" are parsed to Float. + // complex values such as "rotate(1rad)" are returned as is. + result = jQuery.css( tween.elem, tween.prop, false, "" ); + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + // use step hook for back compat - use cssHook if its there - use .style if its + // available and use plain properties where available + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Remove in 2.0 - this supports IE8's panic based approach +// to setting things on disconnected nodes + +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" || + // special check for .toggle( handler, handler, ... ) + ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +}); + +jQuery.fn.extend({ + fadeTo: function( speed, to, easing, callback ) { + + // show any hidden elements after setting opacity to 0 + return this.filter( isHidden ).css( "opacity", 0 ).show() + + // animate to the value specified + .end().animate({ opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations resolve immediately + if ( empty ) { + anim.stop( true ); + } + }; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each(function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = jQuery._data( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + }); + } +}); + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + attrs = { height: type }, + i = 0; + + // if we include width, step value is 1 to do all cssExpand values, + // if we don't include width, step value is 2 to skip over Left and Right + includeWidth = includeWidth? 1 : 0; + for( ; i < 4 ; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +// Generate shortcuts for custom animations +jQuery.each({ + slideDown: genFx("show"), + slideUp: genFx("hide"), + slideToggle: genFx("toggle"), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +}); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p*Math.PI ) / 2; + } +}; + +jQuery.timers = []; +jQuery.fx = Tween.prototype.init; +jQuery.fx.tick = function() { + var timer, + timers = jQuery.timers, + i = 0; + + fxNow = jQuery.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + if ( timer() && jQuery.timers.push( timer ) && !timerId ) { + timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); + } +}; + +jQuery.fx.interval = 13; + +jQuery.fx.stop = function() { + clearInterval( timerId ); + timerId = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + // Default speed + _default: 400 +}; + +// Back Compat <1.8 extension point +jQuery.fx.step = {}; + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { + return elem === fn.elem; + }).length; + }; +} +var rroot = /^(?:body|html)$/i; + +jQuery.fn.offset = function( options ) { + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } + + var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, + box = { top: 0, left: 0 }, + elem = this[ 0 ], + doc = elem && elem.ownerDocument; + + if ( !doc ) { + return; + } + + if ( (body = doc.body) === elem ) { + return jQuery.offset.bodyOffset( elem ); + } + + docElem = doc.documentElement; + + // Make sure it's not a disconnected DOM node + if ( !jQuery.contains( docElem, elem ) ) { + return box; + } + + // If we don't have gBCR, just use 0,0 rather than error + // BlackBerry 5, iOS 3 (original iPhone) + if ( typeof elem.getBoundingClientRect !== "undefined" ) { + box = elem.getBoundingClientRect(); + } + win = getWindow( doc ); + clientTop = docElem.clientTop || body.clientTop || 0; + clientLeft = docElem.clientLeft || body.clientLeft || 0; + scrollTop = win.pageYOffset || docElem.scrollTop; + scrollLeft = win.pageXOffset || docElem.scrollLeft; + return { + top: box.top + scrollTop - clientTop, + left: box.left + scrollLeft - clientLeft + }; +}; + +jQuery.offset = { + + bodyOffset: function( body ) { + var top = body.offsetTop, + left = body.offsetLeft; + + if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { + top += parseFloat( jQuery.css(body, "marginTop") ) || 0; + left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; + } + + return { top: top, left: left }; + }, + + setOffset: function( elem, options, i ) { + var position = jQuery.css( elem, "position" ); + + // set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } + + var curElem = jQuery( elem ), + curOffset = curElem.offset(), + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, + props = {}, curPosition = {}, curTop, curLeft; + + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } + + if ( jQuery.isFunction( options ) ) { + options = options.call( elem, i, curOffset ); + } + + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } + + if ( "using" in options ) { + options.using.call( elem, props ); + } else { + curElem.css( props ); + } + } +}; + + +jQuery.fn.extend({ + + position: function() { + if ( !this[0] ) { + return; + } + + var elem = this[0], + + // Get *real* offsetParent + offsetParent = this.offsetParent(), + + // Get correct offsets + offset = this.offset(), + parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); + + // Subtract element margins + // note: when an element has margin: auto the offsetLeft and marginLeft + // are the same in Safari causing offset.left to incorrectly be 0 + offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; + offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; + + // Add offsetParent borders + parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; + parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; + + // Subtract the two offsets + return { + top: offset.top - parentOffset.top, + left: offset.left - parentOffset.left + }; + }, + + offsetParent: function() { + return this.map(function() { + var offsetParent = this.offsetParent || document.body; + while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent || document.body; + }); + } +}); + + +// Create scrollLeft and scrollTop methods +jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { + var top = /Y/.test( prop ); + + jQuery.fn[ method ] = function( val ) { + return jQuery.access( this, function( elem, method, val ) { + var win = getWindow( elem ); + + if ( val === undefined ) { + return win ? (prop in win) ? win[ prop ] : + win.document.documentElement[ method ] : + elem[ method ]; + } + + if ( win ) { + win.scrollTo( + !top ? val : jQuery( win ).scrollLeft(), + top ? val : jQuery( win ).scrollTop() + ); + + } else { + elem[ method ] = val; + } + }, method, val, arguments.length, null ); + }; +}); + +function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; +} +// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods +jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { + jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { + // margin is only for outerHeight, outerWidth + jQuery.fn[ funcName ] = function( margin, value ) { + var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), + extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); + + return jQuery.access( this, function( elem, type, value ) { + var doc; + + if ( jQuery.isWindow( elem ) ) { + // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there + // isn't a whole lot we can do. See pull request at this URL for discussion: + // https://github.com/jquery/jquery/pull/764 + return elem.document.documentElement[ "client" + name ]; + } + + // Get document width or height + if ( elem.nodeType === 9 ) { + doc = elem.documentElement; + + // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest + // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. + return Math.max( + elem.body[ "scroll" + name ], doc[ "scroll" + name ], + elem.body[ "offset" + name ], doc[ "offset" + name ], + doc[ "client" + name ] + ); + } + + return value === undefined ? + // Get width or height on the element, requesting but not forcing parseFloat + jQuery.css( elem, type, value, extra ) : + + // Set width or height on the element + jQuery.style( elem, type, value, extra ); + }, type, chainable ? margin : undefined, chainable, null ); + }; + }); +}); +// Expose jQuery to the global object +window.jQuery = window.$ = jQuery; + +// Expose jQuery as an AMD module, but only for AMD loaders that +// understand the issues with loading multiple versions of jQuery +// in a page that all might call define(). The loader will indicate +// they have special allowances for multiple jQuery versions by +// specifying define.amd.jQuery = true. Register as a named module, +// since jQuery can be concatenated with other files that may use define, +// but not use a proper concatenation script that understands anonymous +// AMD modules. A named AMD is safest and most robust way to register. +// Lowercase jquery is used because AMD module names are derived from +// file names, and jQuery is normally delivered in a lowercase file name. +// Do this after creating the global so that if an AMD module wants to call +// noConflict to hide this version of jQuery, it will work. +if ( typeof define === "function" && define.amd && define.amd.jQuery ) { + define( "jquery", [], function () { return jQuery; } ); +} + +})( window ); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/moonwalk.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/moonwalk.spec.js new file mode 100644 index 00000000..a37d62c2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/moonwalk.spec.js @@ -0,0 +1,81 @@ +/* globals describe:false, it:false */ +/* jshint node:true */ +"use strict"; + + +var expect = require('expect.js'); +var rocambole = require('../'); + + +describe('moonwalk()', function () { + + it('should generate AST if first arg is a string', function () { + var count = 0; + var ast = rocambole.moonwalk("function fn(x){\n var foo = 'bar';\n if (x) {\n foo += 'baz';\n } else {\n foo += 's';\n }\n return foo;\n}", function(){ + count++; + }); + expect( ast.body ).not.to.be(undefined); + expect( ast.tokens ).not.to.be(undefined); + expect( count ).to.be.greaterThan( 1 ); + }); + + it('should work with existing AST', function () { + var ast = rocambole.parse("function fn(x){\n var foo = 'bar';\n if (x) {\n foo += 'baz';\n } else {\n foo += 's';\n }\n return foo;\n}"); + var count = 0; + rocambole.moonwalk(ast, function(){ + count++; + }); + expect( count ).to.be.greaterThan( 1 ); + }); + + it('should walk AST starting from leaf nodes until it reaches the root', function () { + var prevDepth = Infinity; + var count = 0; + var prevNode; + rocambole.moonwalk("function fn(x){\n var foo = 'bar';\n if (x) {\n foo += 'baz';\n } else {\n foo += 's';\n }\n return foo;\n}", function(node){ + count++; + expect( node.depth <= prevDepth ).to.be( true ); + prevDepth = node.depth; + prevNode = node; + }); + expect( count ).to.be.greaterThan( 1 ); + expect( prevNode.type ).to.be( 'Program' ); // reached root + }); + + it('should skip null nodes', function(){ + var count = 0; + rocambole.moonwalk('[,3,[,4]]', function () { + count++; + }); + expect(count).to.be(6); + }); + +}); + + +describe('recursive()', function () { + + it('should allow breaking the loop', function () { + var ast = rocambole.parse('function fn(x){ return x * 2 }'); + var count_1 = 0; + rocambole.recursive(ast, function(){ + count_1 += 1; + }); + var count_2 = 0; + rocambole.recursive(ast, function(node){ + count_2 += 1; + if (node.type === 'BlockStatement') { + return false; // break + } + }); + expect( count_1 ).to.be( 9 ); + expect( count_2 ).to.be( 5 ); + }); + + it('should be aliased as walk() to avoid confusions', function () { + expect( rocambole.walk ).to.be( rocambole.recursive ); + }); + +}); + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/parse.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/parse.spec.js new file mode 100644 index 00000000..3115f789 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/parse.spec.js @@ -0,0 +1,432 @@ +/*global describe:false, it:false, beforeEach:false, afterEach:false */ +"use strict"; + +var expect = require('expect.js'); +var rocambole = require('../'); + + +describe('parse', function () { + + it('should parse string and return AST', function () { + var ast = rocambole.parse('(function(){ return 123 })'); + expect( ast.type ).to.equal( 'Program' ); + expect( ast.body[0].type ).to.equal( 'ExpressionStatement' ); + }); + + + it('should include tokens before and after "program" end', function () { + var ast = rocambole.parse('//foo\n(function(){ return 123 })\n//bar\n'); + expect( ast.startToken.value ).to.equal( 'foo' ); + expect( ast.endToken.value ).to.equal( '\n' ); + ast = rocambole.parse('\n//foo\n(function(){ return 123 })\n//dolor'); + expect( ast.startToken.value ).to.equal( '\n' ); + expect( ast.endToken.value ).to.equal( 'dolor' ); + }); + + + it('should work with any kind of line breaks & spaces', function () { + var ast = rocambole.parse('\nvar n\r\n=\n10;\r\r \t\t \n', {loc : true}); + + var br_1 = ast.startToken; + expect( br_1.type ).to.be( 'LineBreak' ); + expect( br_1.value ).to.be( '\n' ); + expect( br_1.range ).to.eql( [0, 1] ); + expect( br_1.loc ).to.eql({ + start : { + line : 1, + column : 0 + }, + end : { + line : 1, + column : 1 + } + }); + + var ws_1 = ast.startToken.next.next; + expect( ws_1.type ).to.be( 'WhiteSpace' ); + expect( ws_1.value ).to.be( ' ' ); + + var br_2 = br_1.next.next.next.next; + expect( br_2.type ).to.be( 'LineBreak' ); + expect( br_2.value ).to.be( '\r\n' ); + expect( br_2.range ).to.eql( [6, 8] ); + expect( br_2.loc ).to.eql({ + start : { + line : 2, + column : 5 + }, + end : { + line : 2, + column : 7 + } + }); + + // it's important to notice that esprima doesn't parse "\r" as line + // break, so if it is not at EOF it will give conflicting "loc" info. + var br_6 = ast.endToken; + expect( br_6.type ).to.be( 'LineBreak' ); + expect( br_6.value ).to.be( '\n' ); + expect( br_6.range ).to.eql( [21, 22] ); + expect( br_6.loc ).to.eql({ + start : { + line : 6, + column : 6 + }, + end : { + line : 6, + column : 7 + } + }); + + var ws_2 = ast.endToken.prev; + expect( ws_2.type ).to.be( 'WhiteSpace' ); + expect( ws_2.value ).to.be( ' \t\t ' ); + expect( ws_2.range ).to.eql( [15, 21] ); + expect( ws_2.loc ).to.eql({ + start : { + line : 6, + column : 0 + }, + end : { + line : 6, + column : 6 + } + }); + + var br_5 = ws_2.prev; + expect( br_5.type ).to.be( 'LineBreak' ); + expect( br_5.value ).to.be( '\r' ); + + var br_4 = br_5.prev; + expect( br_4.type ).to.be( 'LineBreak' ); + expect( br_4.value ).to.be( '\r' ); + }); + + + it('should not include any char that isn\'t a white space on a WhiteSpace token [issue #3]', function () { + var ast = rocambole.parse("\n/* foo */\n/* bar */\nfunction foo(){\n var bar = 'baz';\n\n //foo\n //bar\n\n var lorem = 'ipsum';\n return bar + lorem;\n}"); + var tk = ast.startToken; + var nComments = 0; + while (tk) { + if (tk.type === 'WhiteSpace') { + expect( tk.value ).to.match( /^[\s\t]+$/ ); + } else if (tk.type === 'LineBreak') { + expect( tk.value ).to.equal( '\n' ); + } else if (tk.type === 'LineComment') { + expect( tk.raw ).to.match( /^\/\/\w{3}$/ ); + nComments++; + } else if (tk.type === 'BlockComment') { + expect( tk.raw ).to.match( /^\/\* \w{3} \*\/$/ ); + nComments++; + } + tk = tk.next; + } + expect( nComments ).to.be( 4 ); + }); + + + it('should instrument object expression "value" node', function () { + // this was a bug introduced while trying to improve performance + var ast = rocambole.parse('amet(123, a, {flag : true});'); + var exp = ast.body[0].expression; + expect( exp.startToken ).not.to.be(undefined); + expect( exp.callee.startToken ).not.to.be(undefined); + expect( exp['arguments'][0].startToken ).not.to.be(undefined); + expect( exp['arguments'][1].startToken ).not.to.be(undefined); + expect( exp['arguments'][2].startToken ).not.to.be(undefined); + expect( exp['arguments'][2].properties[0].startToken ).not.to.be(undefined); + expect( exp['arguments'][2].properties[0].key.startToken ).not.to.be(undefined); + expect( exp['arguments'][2].properties[0].value.startToken ).not.to.be(undefined); + }); + + + + describe('Node', function () { + + var ast, program, expressionStatement, + fnExpression, block, returnStatement; + + beforeEach(function(){ + ast = rocambole.parse('/* block */\n(function(){\n return 123; // line\n})'); + program = ast; + expressionStatement = ast.body[0]; + fnExpression = expressionStatement.expression; + block = fnExpression.body; + returnStatement = block.body[0]; + }); + + describe('node.parent', function () { + it('should add reference to parent node', function () { + expect( program.parent ).to.equal( undefined ); + expect( expressionStatement.parent ).to.equal( program ); + expect( fnExpression.parent ).to.equal( expressionStatement ); + expect( block.parent ).to.equal( fnExpression ); + }); + }); + + + describe('node.toString()', function(){ + it('should return the node source', function () { + expect( returnStatement.type ).to.equal( 'ReturnStatement' ); + expect( returnStatement.toString() ).to.equal( 'return 123;' ); + }); + it('should use raw value of comments', function () { + expect( block.toString() ).to.equal( '{\n return 123; // line\n}' ); + }); + it('should use raw value of comments', function () { + expect( ast.toString() ).to.equal( '/* block */\n(function(){\n return 123; // line\n})' ); + }); + }); + + + describe('depth', function () { + it('should add depth property to nodes', function () { + expect( program.depth ).to.equal( 0 ); + expect( expressionStatement.depth ).to.equal( 1 ); + expect( fnExpression.depth ).to.equal( 2 ); + expect( block.depth ).to.equal( 3 ); + expect( returnStatement.depth ).to.equal( 4 ); + }); + }); + + + describe('node.endToken', function () { + it('should return last token inside node', function () { + expect( program.endToken.value ).to.equal( ')' ); + expect( expressionStatement.endToken.value ).to.equal( ')' ); + expect( fnExpression.endToken.value ).to.equal( '}' ); + expect( block.endToken.value ).to.equal( '}' ); + expect( returnStatement.endToken.value ).to.equal( ';' ); + }); + + it('should capture end token properly', function () { + var ast = rocambole.parse('[1,2,[3,4,[5,6,[7,8,9]]]];'); + var exp = ast.body[0].expression; + expect( exp.endToken.value ).to.equal( ']' ); + expect( exp.elements[0].value ).to.equal( 1 ); + expect( exp.elements[0].startToken.value ).to.equal( '1' ); + expect( exp.elements[0].endToken.value ).to.equal( '1' ); + }); + }); + + + describe('node.startToken', function () { + it('should return first token inside node', function () { + expect( program.startToken.value ).to.equal( ' block ' ); + expect( expressionStatement.startToken.value ).to.equal( '(' ); + expect( fnExpression.startToken.value ).to.equal( 'function' ); + expect( block.startToken.value ).to.equal( '{' ); + expect( returnStatement.startToken.value ).to.equal( 'return' ); + }); + }); + + + describe('Node.next & Node.prev', function () { + it('should return reference to previous and next nodes', function () { + var ast = rocambole.parse("\n/* foo */\n/* bar */\nfunction foo(){\n var bar = 'baz';\n var lorem = 'ipsum';\n return bar + lorem;\n}"); + var block = ast.body[0].body.body; + var firstNode = block[0]; + var secondNode = block[1]; + var lastNode = block[2]; + expect( firstNode.prev ).to.equal( undefined ); + expect( firstNode.next ).to.equal( secondNode ); + expect( secondNode.prev ).to.equal( firstNode ); + expect( secondNode.next ).to.equal( lastNode ); + expect( lastNode.prev ).to.equal( secondNode ); + expect( lastNode.next ).to.equal( undefined ); + }); + }); + + }); + + + describe('Token', function () { + + it('should instrument tokens', function () { + var ast = rocambole.parse('function foo(){ return "bar"; }'); + var tokens = ast.tokens; + + expect( tokens[0].prev ).to.be(undefined); + expect( tokens[0].next ).to.be( tokens[1] ); + expect( tokens[1].prev ).to.be( tokens[0] ); + expect( tokens[1].next ).to.be( tokens[2] ); + }); + + it('should add range and loc info to comment tokens', function () { + var ast = rocambole.parse('\n/* foo\n bar\n*/\nfunction foo(){ return "bar"; }\n// end', {loc:true}); + var blockComment = ast.startToken.next; + expect( blockComment.range ).to.eql( [1, 16] ); + expect( blockComment.loc ).to.eql({ + start : { + line : 2, + column : 0 + }, + end : { + line : 4, + column : 2 + } + }); + var lineComment = ast.endToken; + expect( lineComment.range ).to.eql( [49, 55] ); + expect( lineComment.loc ).to.eql({ + start : { + line : 6, + column : 0 + }, + end : { + line : 6, + column : 6 + } + }); + }); + + it('should add originalIndent info to block comments', function () { + var ast = rocambole.parse(' /* foo */\n\t\t// bar'); + expect( ast.startToken.next.originalIndent ).to.be(' '); + }); + + it('should not add originalIndent info to line comments', function () { + var ast = rocambole.parse(' /* foo */\n\t\t// bar'); + expect( ast.endToken.originalIndent ).to.be(undefined); + }); + + it('should not add as originalIndent if prev token is not white space', function () { + var ast = rocambole.parse('lorem;/* foo */\n\t\t// bar'); + expect( ast.startToken.next.next.originalIndent ).to.be(undefined); + }); + + it('should not add as originalIndent if prev token is not on a new line', function () { + var ast = rocambole.parse('lorem; /* foo */\n\t\t// bar'); + expect( ast.startToken.next.next.next.originalIndent ).to.be(undefined); + }); + + it('should add as originalIndent if on a new line', function () { + var ast = rocambole.parse('lorem;\n /* foo */\n\t\t// bar'); + expect( ast.startToken.next.next.next.next.originalIndent ).to.be(' '); + }); + }); + + + describe('export BYPASS_RECURSION', function () { + it('should export BYPASS_RECURSION', function () { + expect( rocambole.BYPASS_RECURSION.root ).to.be(true); + }); + }); + + + describe('empty program', function () { + it('should not throw if program is empty', function () { + expect(function(){ + rocambole.parse(''); + }).not.throwError(); + }); + it('should return augmented AST', function () { + var ast = rocambole.parse(''); + expect(ast).to.eql({ + type: 'Program', + body: [], + range: [0,0], + comments: [], + tokens: [], + // we check toString behavior later + toString: ast.toString, + startToken: null, + endToken: null, + depth: 0 + }); + }); + it('toString should return proper value', function() { + var ast = rocambole.parse(''); + expect(ast.toString()).to.be(''); + }); + }); + + + describe('support anything that implements `toString` as input', function () { + it('should support arrays', function () { + var ast = rocambole.parse([1,2,3]); + expect(ast.body[0].toString()).to.eql('1,2,3'); + }); + it('should support functions', function () { + var ast = rocambole.parse(function doStuff(){ + doStuff(1, 2); + }); + expect(ast.body[0].type).to.be('FunctionDeclaration'); + }); + }); + + + describe('sparse array', function() { + // yes, people shold not be writting code like this, but we should not + // bail when that happens + it('should not fail on sparse arrays', function() { + var ast = rocambole.parse('[,3,[,4]]'); + expect(ast.toString()).to.eql('[,3,[,4]]'); + var elements = ast.body[0].expression.elements; + expect(elements[0]).to.be(null); + expect(elements[1].type).to.be('Literal'); + expect(elements[1].value).to.be(3); + }); + }); + + describe('custom parseFn', function() { + var _parseFn; + var _parseContext; + var _parseOptions; + var empty = { + type: 'Program', + body: [], + range: [0,0], + comments: [], + tokens: [] + }; + + beforeEach(function() { + _parseFn = rocambole.parseFn; + _parseContext = rocambole.parseContext; + _parseOptions = rocambole.parseOptions; + }); + + afterEach(function() { + rocambole.parseFn = _parseFn; + rocambole.parseContext = _parseContext; + rocambole.parseOptions = _parseOptions; + rocambole.parseOptions.tokens = true; + }); + + it('should allow global override of parseFn', function() { + var obj = {}; + + expect(rocambole.parseOptions).to.eql({ + range: true, + comment: true, + tokens: true + }); + + rocambole.parseOptions.tokens = 567; + + rocambole.parseContext = obj; + rocambole.parseFn = function(source, opts) { + expect(this).to.be(obj); + expect(opts).to.eql({ + loc: true, + foo: 'bar', + range: 123, + tokens: 567, + comment: true + }); + expect(source).to.eql('bar()'); + return empty; + }; + var result = rocambole.parse('bar()', { + loc: true, + foo: 'bar', + range: 123 + }); + expect(result).to.be(empty); + }); + + }); + +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/perf.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/perf.spec.js new file mode 100644 index 00000000..2ad6de08 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/perf.spec.js @@ -0,0 +1,59 @@ +/*global describe:false, it:false */ +"use strict"; + +var expect = require('expect.js'); +var rocambole = require('../'); + +var _fs = require('fs'); + +// since it takes a long time to instrument jQuery we avoid doing it multiple +// times and cache the result +var _jqueryAST; + + +describe('performance', function () { + + describe('rocambole.parse', function () { + it('should be fast :P', function () { + var file = _fs.readFileSync( __dirname +'/files/crossroads.js', 'utf-8'); + var startTime = process.hrtime(); + var ast = rocambole.parse(file); + var diff = process.hrtime(startTime); + expect( diff[0] ).to.be.below( 300 ); + expect( ast.startToken ).not.to.be( undefined ); + }); + + it('should not take forever to instrument jQuery', function () { + var file = _fs.readFileSync( __dirname +'/files/jquery.js', 'utf-8'); + var startTime = process.hrtime(); + var ast = rocambole.parse(file); + var diff = process.hrtime(startTime); + expect( diff[0] ).to.be.below( 10000 ); + expect( ast.startToken ).not.to.be( undefined ); + _jqueryAST = ast; + }); + }); + + describe('rocambole.moonwalk', function () { + it('should not take forever to loop over jQuery nodes', function () { + if (! _jqueryAST) { + var file = _fs.readFileSync( __dirname +'/files/jquery.js', 'utf-8'); + _jqueryAST = rocambole.parse(file); + } + var startTime = process.hrtime(); + var count = 0; + rocambole.moonwalk(_jqueryAST, function(node){ + if (!node) throw new Error('node should not be undefined'); + count += 1; + }); + var diff = process.hrtime(startTime); + expect( diff[0] ).to.be.below( 200 ); + expect( count ).to.be.above( 20000 ); + }); + }); + +}); + + + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/runner.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/runner.js new file mode 100644 index 00000000..add25544 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/rocambole/test/runner.js @@ -0,0 +1,33 @@ +"use strict"; + +// we run mocha manually otherwise istanbul coverage won't work +// run `npm test --coverage` to generate coverage report + +var Mocha = require('mocha'); + +var opts = { + ui : 'bdd', + reporter : (process.env.REPORTER || 'spec'), + grep : process.env.GREP +}; + +// we use the dot reporter on travis since it works better +if (process.env.TRAVIS) { + opts.reporter = 'dot'; +} + +var m = new Mocha(opts); + +if (process.env.INVERT) { + m.invert(); +} + +m.addFile('test/parse.spec.js'); +m.addFile('test/moonwalk.spec.js'); +m.addFile('test/perf.spec.js'); + +m.run(function(err){ + var exitCode = err? 1 : 0; + process.exit(exitCode); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/.npmignore new file mode 100644 index 00000000..7300fbc7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/.npmignore @@ -0,0 +1 @@ +# nada diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/LICENSE new file mode 100644 index 00000000..0c44ae71 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) Isaac Z. Schlueter ("Author") +All rights reserved. + +The BSD License + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/Makefile b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/Makefile new file mode 100644 index 00000000..5717ccf4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/Makefile @@ -0,0 +1,24 @@ +files = semver.browser.js \ + semver.min.js \ + semver.browser.js.gz \ + semver.min.js.gz + +all: $(files) + +clean: + rm -f $(files) + +semver.browser.js: head.js semver.js foot.js + ( cat head.js; \ + cat semver.js | \ + egrep -v '^ *\/\* nomin \*\/' | \ + perl -pi -e 's/debug\([^\)]+\)//g'; \ + cat foot.js ) > semver.browser.js + +semver.min.js: semver.browser.js + uglifyjs -m semver.min.js + +%.gz: % + gzip --stdout -9 <$< >$@ + +.PHONY: all clean diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/README.md new file mode 100644 index 00000000..ef046598 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/README.md @@ -0,0 +1,142 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Usage + + $ npm install semver + + semver.valid('1.2.3') // '1.2.3' + semver.valid('a.b.c') // null + semver.clean(' =v1.2.3 ') // '1.2.3' + semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true + semver.gt('1.2.3', '9.8.7') // false + semver.lt('1.2.3', '9.8.7') // true + +As a command-line utility: + + $ semver -h + + Usage: semver [ [...]] [-r | -i | -d ] + Test if version(s) satisfy the supplied range(s), and sort them. + + Multiple versions or ranges may be supplied, unless increment + or decrement options are specified. In that case, only a single + version may be used, and it is incremented by the specified level + + Program exits successfully if any valid version satisfies + all supplied ranges, and prints all satisfying versions. + + If no versions are valid, or ranges are not satisfied, + then exits failure. + + Versions are printed in ascending order, so supplying + multiple versions to the utility will just sort them. + +## Versions + +A "version" is described by the v2.0.0 specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +The following range styles are supported: + +* `1.2.3` A specific version. When nothing else will do. Note that + build metadata is still ignored, so `1.2.3+build2012` will satisfy + this range. +* `>1.2.3` Greater than a specific version. +* `<1.2.3` Less than a specific version. If there is no prerelease + tag on the version range, then no prerelease version will be allowed + either, even though these are technically "less than". +* `>=1.2.3` Greater than or equal to. Note that prerelease versions + are NOT equal to their "normal" equivalents, so `1.2.3-beta` will + not satisfy this range, but `2.3.0-beta` will. +* `<=1.2.3` Less than or equal to. In this case, prerelease versions + ARE allowed, so `1.2.3-beta` would satisfy. +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` +* `~1.2.3` := `>=1.2.3-0 <1.3.0-0` "Reasonably close to 1.2.3". When + using tilde operators, prerelease versions are supported as well, + but a prerelease of the next significant digit will NOT be + satisfactory, so `1.3.0-beta` will not satisfy `~1.2.3`. +* `^1.2.3` := `>=1.2.3-0 <2.0.0-0` "Compatible with 1.2.3". When + using caret operators, anything from the specified version (including + prerelease) will be supported up to, but not including, the next + major version (or its prereleases). `1.5.1` will satisfy `^1.2.3`, + while `1.2.2` and `2.0.0-beta` will not. +* `^0.1.3` := `>=0.1.3-0 <0.2.0-0` "Compatible with 0.1.3". 0.x.x versions are + special: the first non-zero component indicates potentially breaking changes, + meaning the caret operator matches any version with the same first non-zero + component starting at the specified version. +* `^0.0.2` := `=0.0.2` "Only the version 0.0.2 is considered compatible" +* `~1.2` := `>=1.2.0-0 <1.3.0-0` "Any version starting with 1.2" +* `^1.2` := `>=1.2.0-0 <2.0.0-0` "Any version compatible with 1.2" +* `1.2.x` := `>=1.2.0-0 <1.3.0-0` "Any version starting with 1.2" +* `~1` := `>=1.0.0-0 <2.0.0-0` "Any version starting with 1" +* `^1` := `>=1.0.0-0 <2.0.0-0` "Any version compatible with 1" +* `1.x` := `>=1.0.0-0 <2.0.0-0` "Any version starting with 1" + + +Ranges can be joined with either a space (which implies "and") or a +`||` (which implies "or"). + +## Functions + +All methods and classes take a final `loose` boolean argument that, if +true, will be more forgiving about not-quite-valid semver strings. +The resulting output will always be 100% strict, of course. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* valid(v): Return the parsed version, or null if it's not valid. +* inc(v, release): Return the version incremented by the release type + (major, minor, patch, or prerelease), or null if it's not valid. + +### Comparison + +* gt(v1, v2): `v1 > v2` +* gte(v1, v2): `v1 >= v2` +* lt(v1, v2): `v1 < v2` +* lte(v1, v2): `v1 <= v2` +* eq(v1, v2): `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* neq(v1, v2): `v1 != v2` The opposite of eq. +* cmp(v1, comparator, v2): Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* compare(v1, v2): Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if + v2 is greater. Sorts in ascending order if passed to Array.sort(). +* rcompare(v1, v2): The reverse of compare. Sorts an array of versions + in descending order when passed to Array.sort(). + + +### Ranges + +* validRange(range): Return the valid range or null if it's not valid +* satisfies(version, range): Return true if the version satisfies the + range. +* maxSatisfying(versions, range): Return the highest version in the list + that satisfies the range, or null if none of them do. +* gtr(version, range): Return true if version is greater than all the + versions possible in the range. +* ltr(version, range): Return true if version is less than all the + versions possible in the range. +* outside(version, range, hilo): Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because 2.0.1 satisfies, which is higher), nor less than the +range (since 1.2.8 satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/bin/semver b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/bin/semver new file mode 100755 index 00000000..88b4c7d3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/bin/semver @@ -0,0 +1,124 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + , versions = [] + , range = [] + , gt = [] + , lt = [] + , eq = [] + , inc = null + , version = require("../package.json").version + , loose = false + , semver = require("../semver") + , reverse = false + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var i = a.indexOf('=') + if (i !== -1) { + a = a.slice(0, i) + argv.unshift(a.slice(i + 1)) + } + switch (a) { + case "-rv": case "-rev": case "--rev": case "--reverse": + reverse = true + break + case "-l": case "--loose": + loose = true + break + case "-v": case "--version": + versions.push(argv.shift()) + break + case "-i": case "--inc": case "--increment": + switch (argv[0]) { + case "major": case "minor": case "patch": case "prerelease": + inc = argv.shift() + break + default: + inc = "patch" + break + } + break + case "-r": case "--range": + range.push(argv.shift()) + break + case "-h": case "--help": case "-?": + return help() + default: + versions.push(a) + break + } + } + + versions = versions.filter(function (v) { + return semver.valid(v, loose) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) + return failInc() + + for (var i = 0, l = range.length; i < l ; i ++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], loose) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error("--inc can only be used on a single version with no range") + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? "rcompare" : "compare" + versions.sort(function (a, b) { + return semver[compare](a, b, loose) + }).map(function (v) { + return semver.clean(v, loose) + }).map(function (v) { + return inc ? semver.inc(v, inc, loose) : v + }).forEach(function (v,i,_) { console.log(v) }) +} + +function help () { + console.log(["SemVer " + version + ,"" + ,"A JavaScript implementation of the http://semver.org/ specification" + ,"Copyright Isaac Z. Schlueter" + ,"" + ,"Usage: semver [options] [ [...]]" + ,"Prints valid versions sorted by SemVer precedence" + ,"" + ,"Options:" + ,"-r --range " + ," Print versions that match the specified range." + ,"" + ,"-i --increment []" + ," Increment a version by the specified level. Level can" + ," be one of: major, minor, patch, or prerelease" + ," Default level is 'patch'." + ," Only one version may be specified." + ,"" + ,"-l --loose" + ," Interpret versions and ranges loosely" + ,"" + ,"Program exits successfully if any valid version satisfies" + ,"all supplied ranges, and prints all satisfying versions." + ,"" + ,"If no satisfying versions are found, then exits failure." + ,"" + ,"Versions are printed in ascending order, so supplying" + ,"multiple versions to the utility will just sort them." + ].join("\n")) +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/foot.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/foot.js new file mode 100644 index 00000000..8f83c20f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/foot.js @@ -0,0 +1,6 @@ + +})( + typeof exports === 'object' ? exports : + typeof define === 'function' && define.amd ? {} : + semver = {} +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/head.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/head.js new file mode 100644 index 00000000..65368651 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/head.js @@ -0,0 +1,2 @@ +;(function(exports) { + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/package.json new file mode 100644 index 00000000..84777481 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/package.json @@ -0,0 +1,49 @@ +{ + "name": "semver", + "version": "2.2.1", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "browser": "semver.browser.js", + "min": "semver.min.js", + "scripts": { + "test": "tap test/*.js", + "prepublish": "make" + }, + "devDependencies": { + "tap": "0.x >=0.0.4", + "uglify-js": "~2.3.6" + }, + "license": "BSD", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-semver.git" + }, + "bin": { + "semver": "./bin/semver" + }, + "bugs": { + "url": "https://github.com/isaacs/node-semver/issues" + }, + "homepage": "https://github.com/isaacs/node-semver", + "_id": "semver@2.2.1", + "dist": { + "shasum": "7941182b3ffcc580bff1c17942acdf7951c0d213", + "tarball": "http://registry.npmjs.org/semver/-/semver-2.2.1.tgz" + }, + "_from": "semver@>=2.2.1 <2.3.0", + "_npmVersion": "1.3.12", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "7941182b3ffcc580bff1c17942acdf7951c0d213", + "_resolved": "https://registry.npmjs.org/semver/-/semver-2.2.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.browser.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.browser.js new file mode 100644 index 00000000..e05ecc19 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.browser.js @@ -0,0 +1,1007 @@ +;(function(exports) { + +// export the class if we are in a Node-like system. +if (typeof module === 'object' && module.exports === exports) + exports = module.exports = SemVer; + +// The debug function is excluded entirely from the minified version. + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0'; + +// The actual regexps go on exports.re +var re = exports.re = []; +var src = exports.src = []; +var R = 0; + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++; +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; +var NUMERICIDENTIFIERLOOSE = R++; +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; + + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++; +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; + + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++; +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')'; + +var MAINVERSIONLOOSE = R++; +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++; +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + +var PRERELEASEIDENTIFIERLOOSE = R++; +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++; +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; + +var PRERELEASELOOSE = R++; +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++; +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++; +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; + + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++; +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?'; + +src[FULL] = '^' + FULLPLAIN + '$'; + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?'; + +var LOOSE = R++; +src[LOOSE] = '^' + LOOSEPLAIN + '$'; + +var GTLT = R++; +src[GTLT] = '((?:<|>)?=?)'; + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++; +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; +var XRANGEIDENTIFIER = R++; +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; + +var XRANGEPLAIN = R++; +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:(' + src[PRERELEASE] + ')' + + ')?)?)?'; + +var XRANGEPLAINLOOSE = R++; +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:(' + src[PRERELEASELOOSE] + ')' + + ')?)?)?'; + +// >=2.x, for example, means >=2.0.0-0 +// <1.x would be the same as "<1.0.0-0", though. +var XRANGE = R++; +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; +var XRANGELOOSE = R++; +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++; +src[LONETILDE] = '(?:~>?)'; + +var TILDETRIM = R++; +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); +var tildeTrimReplace = '$1~'; + +var TILDE = R++; +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; +var TILDELOOSE = R++; +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++; +src[LONECARET] = '(?:\\^)'; + +var CARETTRIM = R++; +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); +var caretTrimReplace = '$1^'; + +var CARET = R++; +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; +var CARETLOOSE = R++; +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++; +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; +var COMPARATOR = R++; +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; + + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++; +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); +var comparatorTrimReplace = '$1$2$3'; + + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++; +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$'; + +var HYPHENRANGELOOSE = R++; +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$'; + +// Star ranges basically just allow anything at all. +var STAR = R++; +src[STAR] = '(<|>)?=?\\s*\\*'; + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + ; + if (!re[i]) + re[i] = new RegExp(src[i]); +} + +exports.parse = parse; +function parse(version, loose) { + var r = loose ? re[LOOSE] : re[FULL]; + return (r.test(version)) ? new SemVer(version, loose) : null; +} + +exports.valid = valid; +function valid(version, loose) { + var v = parse(version, loose); + return v ? v.version : null; +} + + +exports.clean = clean; +function clean(version, loose) { + var s = parse(version, loose); + return s ? s.version : null; +} + +exports.SemVer = SemVer; + +function SemVer(version, loose) { + if (version instanceof SemVer) { + if (version.loose === loose) + return version; + else + version = version.version; + } + + if (!(this instanceof SemVer)) + return new SemVer(version, loose); + + ; + this.loose = loose; + var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); + + if (!m) + throw new TypeError('Invalid Version: ' + version); + + this.raw = version; + + // these are actually numbers + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + // numberify any prerelease numeric ids + if (!m[4]) + this.prerelease = []; + else + this.prerelease = m[4].split('.').map(function(id) { + return (/^[0-9]+$/.test(id)) ? +id : id; + }); + + this.build = m[5] ? m[5].split('.') : []; + this.format(); +} + +SemVer.prototype.format = function() { + this.version = this.major + '.' + this.minor + '.' + this.patch; + if (this.prerelease.length) + this.version += '-' + this.prerelease.join('.'); + return this.version; +}; + +SemVer.prototype.inspect = function() { + return ''; +}; + +SemVer.prototype.toString = function() { + return this.version; +}; + +SemVer.prototype.compare = function(other) { + ; + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return this.compareMain(other) || this.comparePre(other); +}; + +SemVer.prototype.compareMain = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch); +}; + +SemVer.prototype.comparePre = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) + return -1; + else if (!this.prerelease.length && other.prerelease.length) + return 1; + else if (!this.prerelease.lenth && !other.prerelease.length) + return 0; + + var i = 0; + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + ; + if (a === undefined && b === undefined) + return 0; + else if (b === undefined) + return 1; + else if (a === undefined) + return -1; + else if (a === b) + continue; + else + return compareIdentifiers(a, b); + } while (++i); +}; + +SemVer.prototype.inc = function(release) { + switch (release) { + case 'major': + this.major++; + this.minor = -1; + case 'minor': + this.minor++; + this.patch = -1; + case 'patch': + this.patch++; + this.prerelease = []; + break; + case 'prerelease': + if (this.prerelease.length === 0) + this.prerelease = [0]; + else { + var i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) // didn't increment anything + this.prerelease.push(0); + } + break; + + default: + throw new Error('invalid increment argument: ' + release); + } + this.format(); + return this; +}; + +exports.inc = inc; +function inc(version, release, loose) { + try { + return new SemVer(version, loose).inc(release).version; + } catch (er) { + return null; + } +} + +exports.compareIdentifiers = compareIdentifiers; + +var numeric = /^[0-9]+$/; +function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); + + if (anum && bnum) { + a = +a; + b = +b; + } + + return (anum && !bnum) ? -1 : + (bnum && !anum) ? 1 : + a < b ? -1 : + a > b ? 1 : + 0; +} + +exports.rcompareIdentifiers = rcompareIdentifiers; +function rcompareIdentifiers(a, b) { + return compareIdentifiers(b, a); +} + +exports.compare = compare; +function compare(a, b, loose) { + return new SemVer(a, loose).compare(b); +} + +exports.compareLoose = compareLoose; +function compareLoose(a, b) { + return compare(a, b, true); +} + +exports.rcompare = rcompare; +function rcompare(a, b, loose) { + return compare(b, a, loose); +} + +exports.sort = sort; +function sort(list, loose) { + return list.sort(function(a, b) { + return exports.compare(a, b, loose); + }); +} + +exports.rsort = rsort; +function rsort(list, loose) { + return list.sort(function(a, b) { + return exports.rcompare(a, b, loose); + }); +} + +exports.gt = gt; +function gt(a, b, loose) { + return compare(a, b, loose) > 0; +} + +exports.lt = lt; +function lt(a, b, loose) { + return compare(a, b, loose) < 0; +} + +exports.eq = eq; +function eq(a, b, loose) { + return compare(a, b, loose) === 0; +} + +exports.neq = neq; +function neq(a, b, loose) { + return compare(a, b, loose) !== 0; +} + +exports.gte = gte; +function gte(a, b, loose) { + return compare(a, b, loose) >= 0; +} + +exports.lte = lte; +function lte(a, b, loose) { + return compare(a, b, loose) <= 0; +} + +exports.cmp = cmp; +function cmp(a, op, b, loose) { + var ret; + switch (op) { + case '===': ret = a === b; break; + case '!==': ret = a !== b; break; + case '': case '=': case '==': ret = eq(a, b, loose); break; + case '!=': ret = neq(a, b, loose); break; + case '>': ret = gt(a, b, loose); break; + case '>=': ret = gte(a, b, loose); break; + case '<': ret = lt(a, b, loose); break; + case '<=': ret = lte(a, b, loose); break; + default: throw new TypeError('Invalid operator: ' + op); + } + return ret; +} + +exports.Comparator = Comparator; +function Comparator(comp, loose) { + if (comp instanceof Comparator) { + if (comp.loose === loose) + return comp; + else + comp = comp.value; + } + + if (!(this instanceof Comparator)) + return new Comparator(comp, loose); + + ; + this.loose = loose; + this.parse(comp); + + if (this.semver === ANY) + this.value = ''; + else + this.value = this.operator + this.semver.version; +} + +var ANY = {}; +Comparator.prototype.parse = function(comp) { + var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var m = comp.match(r); + + if (!m) + throw new TypeError('Invalid comparator: ' + comp); + + this.operator = m[1]; + // if it literally is just '>' or '' then allow anything. + if (!m[2]) + this.semver = ANY; + else { + this.semver = new SemVer(m[2], this.loose); + + // <1.2.3-rc DOES allow 1.2.3-beta (has prerelease) + // >=1.2.3 DOES NOT allow 1.2.3-beta + // <=1.2.3 DOES allow 1.2.3-beta + // However, <1.2.3 does NOT allow 1.2.3-beta, + // even though `1.2.3-beta < 1.2.3` + // The assumption is that the 1.2.3 version has something you + // *don't* want, so we push the prerelease down to the minimum. + if (this.operator === '<' && !this.semver.prerelease.length) { + this.semver.prerelease = ['0']; + this.semver.format(); + } + } +}; + +Comparator.prototype.inspect = function() { + return ''; +}; + +Comparator.prototype.toString = function() { + return this.value; +}; + +Comparator.prototype.test = function(version) { + ; + return (this.semver === ANY) ? true : + cmp(version, this.operator, this.semver, this.loose); +}; + + +exports.Range = Range; +function Range(range, loose) { + if ((range instanceof Range) && range.loose === loose) + return range; + + if (!(this instanceof Range)) + return new Range(range, loose); + + this.loose = loose; + + // First, split based on boolean or || + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map(function(range) { + return this.parseRange(range.trim()); + }, this).filter(function(c) { + // throw out any that are not relevant for whatever reason + return c.length; + }); + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range); + } + + this.format(); +} + +Range.prototype.inspect = function() { + return ''; +}; + +Range.prototype.format = function() { + this.range = this.set.map(function(comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; +}; + +Range.prototype.toString = function() { + return this.range; +}; + +Range.prototype.parseRange = function(range) { + var loose = this.loose; + range = range.trim(); + ; + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; + range = range.replace(hr, hyphenReplace); + ; + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); + ; + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace); + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace); + + // normalize spaces + range = range.split(/\s+/).join(' '); + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var set = range.split(' ').map(function(comp) { + return parseComparator(comp, loose); + }).join(' ').split(/\s+/); + if (this.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function(comp) { + return !!comp.match(compRe); + }); + } + set = set.map(function(comp) { + return new Comparator(comp, loose); + }); + + return set; +}; + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators; +function toComparators(range, loose) { + return new Range(range, loose).set.map(function(comp) { + return comp.map(function(c) { + return c.value; + }).join(' ').trim().split(' '); + }); +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator(comp, loose) { + ; + comp = replaceCarets(comp, loose); + ; + comp = replaceTildes(comp, loose); + ; + comp = replaceXRanges(comp, loose); + ; + comp = replaceStars(comp, loose); + ; + return comp; +} + +function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceTilde(comp, loose); + }).join(' '); +} + +function replaceTilde(comp, loose) { + var r = loose ? re[TILDELOOSE] : re[TILDE]; + return comp.replace(r, function(_, M, m, p, pr) { + ; + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; + else if (isX(p)) + // ~1.2 == >=1.2.0- <1.3.0- + ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; + else if (pr) { + ; + if (pr.charAt(0) !== '-') + pr = '-' + pr; + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0-0'; + } else + // ~1.2.3 == >=1.2.3-0 <1.3.0-0 + ret = '>=' + M + '.' + m + '.' + p + '-0' + + ' <' + M + '.' + (+m + 1) + '.0-0'; + + ; + return ret; + }); +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceCaret(comp, loose); + }).join(' '); +} + +function replaceCaret(comp, loose) { + var r = loose ? re[CARETLOOSE] : re[CARET]; + return comp.replace(r, function(_, M, m, p, pr) { + ; + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; + else if (isX(p)) { + if (M === '0') + ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; + else + ret = '>=' + M + '.' + m + '.0-0 <' + (+M + 1) + '.0.0-0'; + } else if (pr) { + ; + if (pr.charAt(0) !== '-') + pr = '-' + pr; + if (M === '0') { + if (m === '0') + ret = '=' + M + '.' + m + '.' + p + pr; + else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0-0'; + } else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + (+M + 1) + '.0.0-0'; + } else { + if (M === '0') { + if (m === '0') + ret = '=' + M + '.' + m + '.' + p; + else + ret = '>=' + M + '.' + m + '.' + p + '-0' + + ' <' + M + '.' + (+m + 1) + '.0-0'; + } else + ret = '>=' + M + '.' + m + '.' + p + '-0' + + ' <' + (+M + 1) + '.0.0-0'; + } + + ; + return ret; + }); +} + +function replaceXRanges(comp, loose) { + ; + return comp.split(/\s+/).map(function(comp) { + return replaceXRange(comp, loose); + }).join(' '); +} + +function replaceXRange(comp, loose) { + comp = comp.trim(); + var r = loose ? re[XRANGELOOSE] : re[XRANGE]; + return comp.replace(r, function(ret, gtlt, M, m, p, pr) { + ; + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; + + if (gtlt === '=' && anyX) + gtlt = ''; + + if (gtlt && anyX) { + // replace X with 0, and then append the -0 min-prerelease + if (xM) + M = 0; + if (xm) + m = 0; + if (xp) + p = 0; + + if (gtlt === '>') { + // >1 => >=2.0.0-0 + // >1.2 => >=1.3.0-0 + // >1.2.3 => >= 1.2.4-0 + gtlt = '>='; + if (xM) { + // no change + } else if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else if (xp) { + m = +m + 1; + p = 0; + } + } + + + ret = gtlt + M + '.' + m + '.' + p + '-0'; + } else if (xM) { + // allow any + ret = '*'; + } else if (xm) { + // append '-0' onto the version, otherwise + // '1.x.x' matches '2.0.0-beta', since the tag + // *lowers* the version value + ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; + } else if (xp) { + ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; + } + + ; + + return ret; + }); +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars(comp, loose) { + ; + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], ''); +} + +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0-0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0-0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0-0 <3.5.0-0 +function hyphenReplace($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + + if (isX(fM)) + from = ''; + else if (isX(fm)) + from = '>=' + fM + '.0.0-0'; + else if (isX(fp)) + from = '>=' + fM + '.' + fm + '.0-0'; + else + from = '>=' + from; + + if (isX(tM)) + to = ''; + else if (isX(tm)) + to = '<' + (+tM + 1) + '.0.0-0'; + else if (isX(tp)) + to = '<' + tM + '.' + (+tm + 1) + '.0-0'; + else if (tpr) + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; + else + to = '<=' + to; + + return (from + ' ' + to).trim(); +} + + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function(version) { + if (!version) + return false; + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version)) + return true; + } + return false; +}; + +function testSet(set, version) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) + return false; + } + return true; +} + +exports.satisfies = satisfies; +function satisfies(version, range, loose) { + try { + range = new Range(range, loose); + } catch (er) { + return false; + } + return range.test(version); +} + +exports.maxSatisfying = maxSatisfying; +function maxSatisfying(versions, range, loose) { + return versions.filter(function(version) { + return satisfies(version, range, loose); + }).sort(function(a, b) { + return rcompare(a, b, loose); + })[0] || null; +} + +exports.validRange = validRange; +function validRange(range, loose) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, loose).range || '*'; + } catch (er) { + return null; + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr; +function ltr(version, range, loose) { + return outside(version, range, '<', loose); +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr; +function gtr(version, range, loose) { + return outside(version, range, '>', loose); +} + +exports.outside = outside; +function outside(version, range, hilo, loose) { + version = new SemVer(version, loose); + range = new Range(range, loose); + + var gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break; + case '<': + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, loose)) { + return false; + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + + var high = null; + var low = null; + + comparators.forEach(function(comparator) { + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, loose)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, loose)) { + low = comparator; + } + }); + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false; + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; +} + +// Use the define() function if we're in AMD land +if (typeof define === 'function' && define.amd) + define(exports); + +})( + typeof exports === 'object' ? exports : + typeof define === 'function' && define.amd ? {} : + semver = {} +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.browser.js.gz b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.browser.js.gz new file mode 100644 index 00000000..b9549f80 Binary files /dev/null and b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.browser.js.gz differ diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.js new file mode 100644 index 00000000..9e9470d8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.js @@ -0,0 +1,1011 @@ +// export the class if we are in a Node-like system. +if (typeof module === 'object' && module.exports === exports) + exports = module.exports = SemVer; + +// The debug function is excluded entirely from the minified version. +/* nomin */ var debug; +/* nomin */ if (typeof process === 'object' && + /* nomin */ process.env && + /* nomin */ process.env.NODE_DEBUG && + /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG)) + /* nomin */ debug = function() { + /* nomin */ var args = Array.prototype.slice.call(arguments, 0); + /* nomin */ args.unshift('SEMVER'); + /* nomin */ console.log.apply(console, args); + /* nomin */ }; +/* nomin */ else + /* nomin */ debug = function() {}; + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0'; + +// The actual regexps go on exports.re +var re = exports.re = []; +var src = exports.src = []; +var R = 0; + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++; +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; +var NUMERICIDENTIFIERLOOSE = R++; +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; + + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++; +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; + + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++; +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')'; + +var MAINVERSIONLOOSE = R++; +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++; +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + +var PRERELEASEIDENTIFIERLOOSE = R++; +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++; +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; + +var PRERELEASELOOSE = R++; +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++; +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++; +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; + + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++; +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?'; + +src[FULL] = '^' + FULLPLAIN + '$'; + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?'; + +var LOOSE = R++; +src[LOOSE] = '^' + LOOSEPLAIN + '$'; + +var GTLT = R++; +src[GTLT] = '((?:<|>)?=?)'; + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++; +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; +var XRANGEIDENTIFIER = R++; +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; + +var XRANGEPLAIN = R++; +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:(' + src[PRERELEASE] + ')' + + ')?)?)?'; + +var XRANGEPLAINLOOSE = R++; +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:(' + src[PRERELEASELOOSE] + ')' + + ')?)?)?'; + +// >=2.x, for example, means >=2.0.0-0 +// <1.x would be the same as "<1.0.0-0", though. +var XRANGE = R++; +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; +var XRANGELOOSE = R++; +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++; +src[LONETILDE] = '(?:~>?)'; + +var TILDETRIM = R++; +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); +var tildeTrimReplace = '$1~'; + +var TILDE = R++; +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; +var TILDELOOSE = R++; +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++; +src[LONECARET] = '(?:\\^)'; + +var CARETTRIM = R++; +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); +var caretTrimReplace = '$1^'; + +var CARET = R++; +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; +var CARETLOOSE = R++; +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++; +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; +var COMPARATOR = R++; +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; + + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++; +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); +var comparatorTrimReplace = '$1$2$3'; + + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++; +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$'; + +var HYPHENRANGELOOSE = R++; +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$'; + +// Star ranges basically just allow anything at all. +var STAR = R++; +src[STAR] = '(<|>)?=?\\s*\\*'; + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]); + if (!re[i]) + re[i] = new RegExp(src[i]); +} + +exports.parse = parse; +function parse(version, loose) { + var r = loose ? re[LOOSE] : re[FULL]; + return (r.test(version)) ? new SemVer(version, loose) : null; +} + +exports.valid = valid; +function valid(version, loose) { + var v = parse(version, loose); + return v ? v.version : null; +} + + +exports.clean = clean; +function clean(version, loose) { + var s = parse(version, loose); + return s ? s.version : null; +} + +exports.SemVer = SemVer; + +function SemVer(version, loose) { + if (version instanceof SemVer) { + if (version.loose === loose) + return version; + else + version = version.version; + } + + if (!(this instanceof SemVer)) + return new SemVer(version, loose); + + debug('SemVer', version, loose); + this.loose = loose; + var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); + + if (!m) + throw new TypeError('Invalid Version: ' + version); + + this.raw = version; + + // these are actually numbers + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + // numberify any prerelease numeric ids + if (!m[4]) + this.prerelease = []; + else + this.prerelease = m[4].split('.').map(function(id) { + return (/^[0-9]+$/.test(id)) ? +id : id; + }); + + this.build = m[5] ? m[5].split('.') : []; + this.format(); +} + +SemVer.prototype.format = function() { + this.version = this.major + '.' + this.minor + '.' + this.patch; + if (this.prerelease.length) + this.version += '-' + this.prerelease.join('.'); + return this.version; +}; + +SemVer.prototype.inspect = function() { + return ''; +}; + +SemVer.prototype.toString = function() { + return this.version; +}; + +SemVer.prototype.compare = function(other) { + debug('SemVer.compare', this.version, this.loose, other); + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return this.compareMain(other) || this.comparePre(other); +}; + +SemVer.prototype.compareMain = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch); +}; + +SemVer.prototype.comparePre = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) + return -1; + else if (!this.prerelease.length && other.prerelease.length) + return 1; + else if (!this.prerelease.lenth && !other.prerelease.length) + return 0; + + var i = 0; + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + debug('prerelease compare', i, a, b); + if (a === undefined && b === undefined) + return 0; + else if (b === undefined) + return 1; + else if (a === undefined) + return -1; + else if (a === b) + continue; + else + return compareIdentifiers(a, b); + } while (++i); +}; + +SemVer.prototype.inc = function(release) { + switch (release) { + case 'major': + this.major++; + this.minor = -1; + case 'minor': + this.minor++; + this.patch = -1; + case 'patch': + this.patch++; + this.prerelease = []; + break; + case 'prerelease': + if (this.prerelease.length === 0) + this.prerelease = [0]; + else { + var i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) // didn't increment anything + this.prerelease.push(0); + } + break; + + default: + throw new Error('invalid increment argument: ' + release); + } + this.format(); + return this; +}; + +exports.inc = inc; +function inc(version, release, loose) { + try { + return new SemVer(version, loose).inc(release).version; + } catch (er) { + return null; + } +} + +exports.compareIdentifiers = compareIdentifiers; + +var numeric = /^[0-9]+$/; +function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); + + if (anum && bnum) { + a = +a; + b = +b; + } + + return (anum && !bnum) ? -1 : + (bnum && !anum) ? 1 : + a < b ? -1 : + a > b ? 1 : + 0; +} + +exports.rcompareIdentifiers = rcompareIdentifiers; +function rcompareIdentifiers(a, b) { + return compareIdentifiers(b, a); +} + +exports.compare = compare; +function compare(a, b, loose) { + return new SemVer(a, loose).compare(b); +} + +exports.compareLoose = compareLoose; +function compareLoose(a, b) { + return compare(a, b, true); +} + +exports.rcompare = rcompare; +function rcompare(a, b, loose) { + return compare(b, a, loose); +} + +exports.sort = sort; +function sort(list, loose) { + return list.sort(function(a, b) { + return exports.compare(a, b, loose); + }); +} + +exports.rsort = rsort; +function rsort(list, loose) { + return list.sort(function(a, b) { + return exports.rcompare(a, b, loose); + }); +} + +exports.gt = gt; +function gt(a, b, loose) { + return compare(a, b, loose) > 0; +} + +exports.lt = lt; +function lt(a, b, loose) { + return compare(a, b, loose) < 0; +} + +exports.eq = eq; +function eq(a, b, loose) { + return compare(a, b, loose) === 0; +} + +exports.neq = neq; +function neq(a, b, loose) { + return compare(a, b, loose) !== 0; +} + +exports.gte = gte; +function gte(a, b, loose) { + return compare(a, b, loose) >= 0; +} + +exports.lte = lte; +function lte(a, b, loose) { + return compare(a, b, loose) <= 0; +} + +exports.cmp = cmp; +function cmp(a, op, b, loose) { + var ret; + switch (op) { + case '===': ret = a === b; break; + case '!==': ret = a !== b; break; + case '': case '=': case '==': ret = eq(a, b, loose); break; + case '!=': ret = neq(a, b, loose); break; + case '>': ret = gt(a, b, loose); break; + case '>=': ret = gte(a, b, loose); break; + case '<': ret = lt(a, b, loose); break; + case '<=': ret = lte(a, b, loose); break; + default: throw new TypeError('Invalid operator: ' + op); + } + return ret; +} + +exports.Comparator = Comparator; +function Comparator(comp, loose) { + if (comp instanceof Comparator) { + if (comp.loose === loose) + return comp; + else + comp = comp.value; + } + + if (!(this instanceof Comparator)) + return new Comparator(comp, loose); + + debug('comparator', comp, loose); + this.loose = loose; + this.parse(comp); + + if (this.semver === ANY) + this.value = ''; + else + this.value = this.operator + this.semver.version; +} + +var ANY = {}; +Comparator.prototype.parse = function(comp) { + var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var m = comp.match(r); + + if (!m) + throw new TypeError('Invalid comparator: ' + comp); + + this.operator = m[1]; + // if it literally is just '>' or '' then allow anything. + if (!m[2]) + this.semver = ANY; + else { + this.semver = new SemVer(m[2], this.loose); + + // <1.2.3-rc DOES allow 1.2.3-beta (has prerelease) + // >=1.2.3 DOES NOT allow 1.2.3-beta + // <=1.2.3 DOES allow 1.2.3-beta + // However, <1.2.3 does NOT allow 1.2.3-beta, + // even though `1.2.3-beta < 1.2.3` + // The assumption is that the 1.2.3 version has something you + // *don't* want, so we push the prerelease down to the minimum. + if (this.operator === '<' && !this.semver.prerelease.length) { + this.semver.prerelease = ['0']; + this.semver.format(); + } + } +}; + +Comparator.prototype.inspect = function() { + return ''; +}; + +Comparator.prototype.toString = function() { + return this.value; +}; + +Comparator.prototype.test = function(version) { + debug('Comparator.test', version, this.loose); + return (this.semver === ANY) ? true : + cmp(version, this.operator, this.semver, this.loose); +}; + + +exports.Range = Range; +function Range(range, loose) { + if ((range instanceof Range) && range.loose === loose) + return range; + + if (!(this instanceof Range)) + return new Range(range, loose); + + this.loose = loose; + + // First, split based on boolean or || + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map(function(range) { + return this.parseRange(range.trim()); + }, this).filter(function(c) { + // throw out any that are not relevant for whatever reason + return c.length; + }); + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range); + } + + this.format(); +} + +Range.prototype.inspect = function() { + return ''; +}; + +Range.prototype.format = function() { + this.range = this.set.map(function(comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; +}; + +Range.prototype.toString = function() { + return this.range; +}; + +Range.prototype.parseRange = function(range) { + var loose = this.loose; + range = range.trim(); + debug('range', range, loose); + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; + range = range.replace(hr, hyphenReplace); + debug('hyphen replace', range); + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); + debug('comparator trim', range, re[COMPARATORTRIM]); + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace); + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace); + + // normalize spaces + range = range.split(/\s+/).join(' '); + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var set = range.split(' ').map(function(comp) { + return parseComparator(comp, loose); + }).join(' ').split(/\s+/); + if (this.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function(comp) { + return !!comp.match(compRe); + }); + } + set = set.map(function(comp) { + return new Comparator(comp, loose); + }); + + return set; +}; + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators; +function toComparators(range, loose) { + return new Range(range, loose).set.map(function(comp) { + return comp.map(function(c) { + return c.value; + }).join(' ').trim().split(' '); + }); +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator(comp, loose) { + debug('comp', comp); + comp = replaceCarets(comp, loose); + debug('caret', comp); + comp = replaceTildes(comp, loose); + debug('tildes', comp); + comp = replaceXRanges(comp, loose); + debug('xrange', comp); + comp = replaceStars(comp, loose); + debug('stars', comp); + return comp; +} + +function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceTilde(comp, loose); + }).join(' '); +} + +function replaceTilde(comp, loose) { + var r = loose ? re[TILDELOOSE] : re[TILDE]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; + else if (isX(p)) + // ~1.2 == >=1.2.0- <1.3.0- + ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; + else if (pr) { + debug('replaceTilde pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0-0'; + } else + // ~1.2.3 == >=1.2.3-0 <1.3.0-0 + ret = '>=' + M + '.' + m + '.' + p + '-0' + + ' <' + M + '.' + (+m + 1) + '.0-0'; + + debug('tilde return', ret); + return ret; + }); +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceCaret(comp, loose); + }).join(' '); +} + +function replaceCaret(comp, loose) { + var r = loose ? re[CARETLOOSE] : re[CARET]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; + else if (isX(p)) { + if (M === '0') + ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; + else + ret = '>=' + M + '.' + m + '.0-0 <' + (+M + 1) + '.0.0-0'; + } else if (pr) { + debug('replaceCaret pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + if (M === '0') { + if (m === '0') + ret = '=' + M + '.' + m + '.' + p + pr; + else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0-0'; + } else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + (+M + 1) + '.0.0-0'; + } else { + if (M === '0') { + if (m === '0') + ret = '=' + M + '.' + m + '.' + p; + else + ret = '>=' + M + '.' + m + '.' + p + '-0' + + ' <' + M + '.' + (+m + 1) + '.0-0'; + } else + ret = '>=' + M + '.' + m + '.' + p + '-0' + + ' <' + (+M + 1) + '.0.0-0'; + } + + debug('caret return', ret); + return ret; + }); +} + +function replaceXRanges(comp, loose) { + debug('replaceXRanges', comp, loose); + return comp.split(/\s+/).map(function(comp) { + return replaceXRange(comp, loose); + }).join(' '); +} + +function replaceXRange(comp, loose) { + comp = comp.trim(); + var r = loose ? re[XRANGELOOSE] : re[XRANGE]; + return comp.replace(r, function(ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr); + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; + + if (gtlt === '=' && anyX) + gtlt = ''; + + if (gtlt && anyX) { + // replace X with 0, and then append the -0 min-prerelease + if (xM) + M = 0; + if (xm) + m = 0; + if (xp) + p = 0; + + if (gtlt === '>') { + // >1 => >=2.0.0-0 + // >1.2 => >=1.3.0-0 + // >1.2.3 => >= 1.2.4-0 + gtlt = '>='; + if (xM) { + // no change + } else if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else if (xp) { + m = +m + 1; + p = 0; + } + } + + + ret = gtlt + M + '.' + m + '.' + p + '-0'; + } else if (xM) { + // allow any + ret = '*'; + } else if (xm) { + // append '-0' onto the version, otherwise + // '1.x.x' matches '2.0.0-beta', since the tag + // *lowers* the version value + ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0'; + } else if (xp) { + ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0'; + } + + debug('xRange return', ret); + + return ret; + }); +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars(comp, loose) { + debug('replaceStars', comp, loose); + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], ''); +} + +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0-0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0-0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0-0 <3.5.0-0 +function hyphenReplace($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + + if (isX(fM)) + from = ''; + else if (isX(fm)) + from = '>=' + fM + '.0.0-0'; + else if (isX(fp)) + from = '>=' + fM + '.' + fm + '.0-0'; + else + from = '>=' + from; + + if (isX(tM)) + to = ''; + else if (isX(tm)) + to = '<' + (+tM + 1) + '.0.0-0'; + else if (isX(tp)) + to = '<' + tM + '.' + (+tm + 1) + '.0-0'; + else if (tpr) + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; + else + to = '<=' + to; + + return (from + ' ' + to).trim(); +} + + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function(version) { + if (!version) + return false; + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version)) + return true; + } + return false; +}; + +function testSet(set, version) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) + return false; + } + return true; +} + +exports.satisfies = satisfies; +function satisfies(version, range, loose) { + try { + range = new Range(range, loose); + } catch (er) { + return false; + } + return range.test(version); +} + +exports.maxSatisfying = maxSatisfying; +function maxSatisfying(versions, range, loose) { + return versions.filter(function(version) { + return satisfies(version, range, loose); + }).sort(function(a, b) { + return rcompare(a, b, loose); + })[0] || null; +} + +exports.validRange = validRange; +function validRange(range, loose) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, loose).range || '*'; + } catch (er) { + return null; + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr; +function ltr(version, range, loose) { + return outside(version, range, '<', loose); +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr; +function gtr(version, range, loose) { + return outside(version, range, '>', loose); +} + +exports.outside = outside; +function outside(version, range, hilo, loose) { + version = new SemVer(version, loose); + range = new Range(range, loose); + + var gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break; + case '<': + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, loose)) { + return false; + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + + var high = null; + var low = null; + + comparators.forEach(function(comparator) { + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, loose)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, loose)) { + low = comparator; + } + }); + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false; + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; +} + +// Use the define() function if we're in AMD land +if (typeof define === 'function' && define.amd) + define(exports); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.min.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.min.js new file mode 100644 index 00000000..c2164c33 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/semver.min.js @@ -0,0 +1 @@ +(function(e){if(typeof module==="object"&&module.exports===e)e=module.exports=H;e.SEMVER_SPEC_VERSION="2.0.0";var r=e.re=[];var t=e.src=[];var n=0;var i=n++;t[i]="0|[1-9]\\d*";var s=n++;t[s]="[0-9]+";var o=n++;t[o]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var a=n++;t[a]="("+t[i]+")\\."+"("+t[i]+")\\."+"("+t[i]+")";var f=n++;t[f]="("+t[s]+")\\."+"("+t[s]+")\\."+"("+t[s]+")";var u=n++;t[u]="(?:"+t[i]+"|"+t[o]+")";var l=n++;t[l]="(?:"+t[s]+"|"+t[o]+")";var c=n++;t[c]="(?:-("+t[u]+"(?:\\."+t[u]+")*))";var p=n++;t[p]="(?:-?("+t[l]+"(?:\\."+t[l]+")*))";var h=n++;t[h]="[0-9A-Za-z-]+";var v=n++;t[v]="(?:\\+("+t[h]+"(?:\\."+t[h]+")*))";var m=n++;var g="v?"+t[a]+t[c]+"?"+t[v]+"?";t[m]="^"+g+"$";var w="[v=\\s]*"+t[f]+t[p]+"?"+t[v]+"?";var d=n++;t[d]="^"+w+"$";var y=n++;t[y]="((?:<|>)?=?)";var $=n++;t[$]=t[s]+"|x|X|\\*";var j=n++;t[j]=t[i]+"|x|X|\\*";var b=n++;t[b]="[v=\\s]*("+t[j]+")"+"(?:\\.("+t[j]+")"+"(?:\\.("+t[j]+")"+"(?:("+t[c]+")"+")?)?)?";var E=n++;t[E]="[v=\\s]*("+t[$]+")"+"(?:\\.("+t[$]+")"+"(?:\\.("+t[$]+")"+"(?:("+t[p]+")"+")?)?)?";var k=n++;t[k]="^"+t[y]+"\\s*"+t[b]+"$";var x=n++;t[x]="^"+t[y]+"\\s*"+t[E]+"$";var R=n++;t[R]="(?:~>?)";var S=n++;t[S]="(\\s*)"+t[R]+"\\s+";r[S]=new RegExp(t[S],"g");var V="$1~";var I=n++;t[I]="^"+t[R]+t[b]+"$";var A=n++;t[A]="^"+t[R]+t[E]+"$";var C=n++;t[C]="(?:\\^)";var T=n++;t[T]="(\\s*)"+t[C]+"\\s+";r[T]=new RegExp(t[T],"g");var M="$1^";var z=n++;t[z]="^"+t[C]+t[b]+"$";var P=n++;t[P]="^"+t[C]+t[E]+"$";var Z=n++;t[Z]="^"+t[y]+"\\s*("+w+")$|^$";var q=n++;t[q]="^"+t[y]+"\\s*("+g+")$|^$";var L=n++;t[L]="(\\s*)"+t[y]+"\\s*("+w+"|"+t[b]+")";r[L]=new RegExp(t[L],"g");var X="$1$2$3";var _=n++;t[_]="^\\s*("+t[b]+")"+"\\s+-\\s+"+"("+t[b]+")"+"\\s*$";var N=n++;t[N]="^\\s*("+t[E]+")"+"\\s+-\\s+"+"("+t[E]+")"+"\\s*$";var O=n++;t[O]="(<|>)?=?\\s*\\*";for(var B=0;B'};H.prototype.toString=function(){return this.version};H.prototype.compare=function(e){if(!(e instanceof H))e=new H(e,this.loose);return this.compareMain(e)||this.comparePre(e)};H.prototype.compareMain=function(e){if(!(e instanceof H))e=new H(e,this.loose);return Q(this.major,e.major)||Q(this.minor,e.minor)||Q(this.patch,e.patch)};H.prototype.comparePre=function(e){if(!(e instanceof H))e=new H(e,this.loose);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.lenth&&!e.prerelease.length)return 0;var r=0;do{var t=this.prerelease[r];var n=e.prerelease[r];if(t===undefined&&n===undefined)return 0;else if(n===undefined)return 1;else if(t===undefined)return-1;else if(t===n)continue;else return Q(t,n)}while(++r)};H.prototype.inc=function(e){switch(e){case"major":this.major++;this.minor=-1;case"minor":this.minor++;this.patch=-1;case"patch":this.patch++;this.prerelease=[];break;case"prerelease":if(this.prerelease.length===0)this.prerelease=[0];else{var r=this.prerelease.length;while(--r>=0){if(typeof this.prerelease[r]==="number"){this.prerelease[r]++;r=-2}}if(r===-1)this.prerelease.push(0)}break;default:throw new Error("invalid increment argument: "+e)}this.format();return this};e.inc=J;function J(e,r,t){try{return new H(e,t).inc(r).version}catch(n){return null}}e.compareIdentifiers=Q;var K=/^[0-9]+$/;function Q(e,r){var t=K.test(e);var n=K.test(r);if(t&&n){e=+e;r=+r}return t&&!n?-1:n&&!t?1:er?1:0}e.rcompareIdentifiers=U;function U(e,r){return Q(r,e)}e.compare=W;function W(e,r,t){return new H(e,t).compare(r)}e.compareLoose=Y;function Y(e,r){return W(e,r,true)}e.rcompare=er;function er(e,r,t){return W(r,e,t)}e.sort=rr;function rr(r,t){return r.sort(function(r,n){return e.compare(r,n,t)})}e.rsort=tr;function tr(r,t){return r.sort(function(r,n){return e.rcompare(r,n,t)})}e.gt=nr;function nr(e,r,t){return W(e,r,t)>0}e.lt=ir;function ir(e,r,t){return W(e,r,t)<0}e.eq=sr;function sr(e,r,t){return W(e,r,t)===0}e.neq=or;function or(e,r,t){return W(e,r,t)!==0}e.gte=ar;function ar(e,r,t){return W(e,r,t)>=0}e.lte=fr;function fr(e,r,t){return W(e,r,t)<=0}e.cmp=ur;function ur(e,r,t,n){var i;switch(r){case"===":i=e===t;break;case"!==":i=e!==t;break;case"":case"=":case"==":i=sr(e,t,n);break;case"!=":i=or(e,t,n);break;case">":i=nr(e,t,n);break;case">=":i=ar(e,t,n);break;case"<":i=ir(e,t,n);break;case"<=":i=fr(e,t,n);break;default:throw new TypeError("Invalid operator: "+r)}return i}e.Comparator=lr;function lr(e,r){if(e instanceof lr){if(e.loose===r)return e;else e=e.value}if(!(this instanceof lr))return new lr(e,r);this.loose=r;this.parse(e);if(this.semver===cr)this.value="";else this.value=this.operator+this.semver.version}var cr={};lr.prototype.parse=function(e){var t=this.loose?r[Z]:r[q];var n=e.match(t);if(!n)throw new TypeError("Invalid comparator: "+e);this.operator=n[1];if(!n[2])this.semver=cr;else{this.semver=new H(n[2],this.loose);if(this.operator==="<"&&!this.semver.prerelease.length){this.semver.prerelease=["0"];this.semver.format()}}};lr.prototype.inspect=function(){return''};lr.prototype.toString=function(){return this.value};lr.prototype.test=function(e){return this.semver===cr?true:ur(e,this.operator,this.semver,this.loose)};e.Range=pr;function pr(e,r){if(e instanceof pr&&e.loose===r)return e;if(!(this instanceof pr))return new pr(e,r);this.loose=r;this.raw=e;this.set=e.split(/\s*\|\|\s*/).map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+e)}this.format()}pr.prototype.inspect=function(){return''};pr.prototype.format=function(){this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim();return this.range};pr.prototype.toString=function(){return this.range};pr.prototype.parseRange=function(e){var t=this.loose;e=e.trim();var n=t?r[N]:r[_];e=e.replace(n,Er);e=e.replace(r[L],X);e=e.replace(r[S],V);e=e.replace(r[T],M);e=e.split(/\s+/).join(" ");var i=t?r[Z]:r[q];var s=e.split(" ").map(function(e){return vr(e,t)}).join(" ").split(/\s+/);if(this.loose){s=s.filter(function(e){return!!e.match(i)})}s=s.map(function(e){return new lr(e,t)});return s};e.toComparators=hr;function hr(e,r){return new pr(e,r).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})}function vr(e,r){e=dr(e,r);e=gr(e,r);e=$r(e,r);e=br(e,r);return e}function mr(e){return!e||e.toLowerCase()==="x"||e==="*"}function gr(e,r){return e.trim().split(/\s+/).map(function(e){return wr(e,r)}).join(" ")}function wr(e,t){var n=t?r[A]:r[I];return e.replace(n,function(e,r,t,n,i){var s;if(mr(r))s="";else if(mr(t))s=">="+r+".0.0-0 <"+(+r+1)+".0.0-0";else if(mr(n))s=">="+r+"."+t+".0-0 <"+r+"."+(+t+1)+".0-0";else if(i){if(i.charAt(0)!=="-")i="-"+i;s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+"-0"+" <"+r+"."+(+t+1)+".0-0";return s})}function dr(e,r){return e.trim().split(/\s+/).map(function(e){return yr(e,r)}).join(" ")}function yr(e,t){var n=t?r[P]:r[z];return e.replace(n,function(e,r,t,n,i){var s;if(mr(r))s="";else if(mr(t))s=">="+r+".0.0-0 <"+(+r+1)+".0.0-0";else if(mr(n)){if(r==="0")s=">="+r+"."+t+".0-0 <"+r+"."+(+t+1)+".0-0";else s=">="+r+"."+t+".0-0 <"+(+r+1)+".0.0-0"}else if(i){if(i.charAt(0)!=="-")i="-"+i;if(r==="0"){if(t==="0")s="="+r+"."+t+"."+n+i;else s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+i+" <"+(+r+1)+".0.0-0"}else{if(r==="0"){if(t==="0")s="="+r+"."+t+"."+n;else s=">="+r+"."+t+"."+n+"-0"+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+"-0"+" <"+(+r+1)+".0.0-0"}return s})}function $r(e,r){return e.split(/\s+/).map(function(e){return jr(e,r)}).join(" ")}function jr(e,t){e=e.trim();var n=t?r[x]:r[k];return e.replace(n,function(e,r,t,n,i,s){var o=mr(t);var a=o||mr(n);var f=a||mr(i);var u=f;if(r==="="&&u)r="";if(r&&u){if(o)t=0;if(a)n=0;if(f)i=0;if(r===">"){r=">=";if(o){}else if(a){t=+t+1;n=0;i=0}else if(f){n=+n+1;i=0}}e=r+t+"."+n+"."+i+"-0"}else if(o){e="*"}else if(a){e=">="+t+".0.0-0 <"+(+t+1)+".0.0-0"}else if(f){e=">="+t+"."+n+".0-0 <"+t+"."+(+n+1)+".0-0"}return e})}function br(e,t){return e.trim().replace(r[O],"")}function Er(e,r,t,n,i,s,o,a,f,u,l,c,p){if(mr(t))r="";else if(mr(n))r=">="+t+".0.0-0";else if(mr(i))r=">="+t+"."+n+".0-0";else r=">="+r;if(mr(f))a="";else if(mr(u))a="<"+(+f+1)+".0.0-0";else if(mr(l))a="<"+f+"."+(+u+1)+".0-0";else if(c)a="<="+f+"."+u+"."+l+"-"+c;else a="<="+a;return(r+" "+a).trim()}pr.prototype.test=function(e){if(!e)return false;for(var r=0;r",t)}e.outside=Ar;function Ar(e,r,t,n){e=new H(e,n);r=new pr(r,n);var i,s,o,a,f;switch(t){case">":i=nr;s=fr;o=ir;a=">";f=">=";break;case"<":i=ir;s=ar;o=nr;a="<";f="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(xr(e,r,n)){return false}for(var u=0;u=2.4.0 <2.5.0 + ['~2.4', '2.5.5'], + ['~>3.2.1', '3.3.0'], // >=3.2.1 <3.3.0 + ['~1', '2.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '2.2.4'], + ['~> 1', '3.2.3'], + ['~1.0', '1.1.2'], // >=1.0.0 <1.1.0 + ['~ 1.0', '1.1.0'], + ['<1.2', '1.2.0'], + ['< 1.2', '1.2.1'], + ['1', '2.0.0beta', true], + ['~v0.5.4-pre', '0.6.0'], + ['~v0.5.4-pre', '0.6.1-pre'], + ['=0.7.x', '0.8.0'], + ['=0.7.x', '0.8.0-asdf'], + ['<=0.7.x', '0.7.0'], + ['~1.2.2', '1.3.0'], + ['1.0.0 - 2.0.0', '2.2.3'], + ['1.0.0', '1.0.1'], + ['<=2.0.0', '3.0.0'], + ['<=2.0.0', '2.9999.9999'], + ['<=2.0.0', '2.2.9'], + ['<2.0.0', '2.9999.9999'], + ['<2.0.0', '2.2.9'], + ['2.x.x', '3.1.3'], + ['1.2.x', '1.3.3'], + ['1.2.x || 2.x', '3.1.3'], + ['2.*.*', '3.1.3'], + ['1.2.*', '1.3.3'], + ['1.2.* || 2.*', '3.1.3'], + ['2', '3.1.2'], + ['2.3', '2.4.1'], + ['~2.4', '2.5.0'], // >=2.4.0 <2.5.0 + ['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0 + ['~1', '2.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '2.2.3'], + ['~1.0', '1.1.0'], // >=1.0.0 <1.1.0 + ['<1', '1.0.0'], + ['1', '2.0.0beta', true], + ['<1', '1.0.0beta', true], + ['< 1', '1.0.0beta', true], + ['=0.7.x', '0.8.2'], + ['<=0.7.x', '0.7.2'] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = 'gtr(' + version + ', ' + range + ', ' + loose + ')'; + t.ok(gtr(version, range, loose), msg); + }); + t.end(); +}); + +test('\nnegative gtr tests', function(t) { + // [range, version, loose] + // Version should NOT be greater than range + [ + ['~0.6.1-1', '0.6.1-1'], + ['1.0.0 - 2.0.0', '1.2.3'], + ['1.0.0 - 2.0.0', '0.9.9'], + ['1.0.0', '1.0.0'], + ['>=*', '0.2.4'], + ['', '1.0.0', true], + ['*', '1.2.3'], + ['*', 'v1.2.3-foo'], + ['>=1.0.0', '1.0.0'], + ['>=1.0.0', '1.0.1'], + ['>=1.0.0', '1.1.0'], + ['>1.0.0', '1.0.1'], + ['>1.0.0', '1.1.0'], + ['<=2.0.0', '2.0.0'], + ['<=2.0.0', '1.9999.9999'], + ['<=2.0.0', '0.2.9'], + ['<2.0.0', '1.9999.9999'], + ['<2.0.0', '0.2.9'], + ['>= 1.0.0', '1.0.0'], + ['>= 1.0.0', '1.0.1'], + ['>= 1.0.0', '1.1.0'], + ['> 1.0.0', '1.0.1'], + ['> 1.0.0', '1.1.0'], + ['<= 2.0.0', '2.0.0'], + ['<= 2.0.0', '1.9999.9999'], + ['<= 2.0.0', '0.2.9'], + ['< 2.0.0', '1.9999.9999'], + ['<\t2.0.0', '0.2.9'], + ['>=0.1.97', 'v0.1.97'], + ['>=0.1.97', '0.1.97'], + ['0.1.20 || 1.2.4', '1.2.4'], + ['0.1.20 || >1.2.4', '1.2.4'], + ['0.1.20 || 1.2.4', '1.2.3'], + ['0.1.20 || 1.2.4', '0.1.20'], + ['>=0.2.3 || <0.0.1', '0.0.0'], + ['>=0.2.3 || <0.0.1', '0.2.3'], + ['>=0.2.3 || <0.0.1', '0.2.4'], + ['||', '1.3.4'], + ['2.x.x', '2.1.3'], + ['1.2.x', '1.2.3'], + ['1.2.x || 2.x', '2.1.3'], + ['1.2.x || 2.x', '1.2.3'], + ['x', '1.2.3'], + ['2.*.*', '2.1.3'], + ['1.2.*', '1.2.3'], + ['1.2.* || 2.*', '2.1.3'], + ['1.2.* || 2.*', '1.2.3'], + ['1.2.* || 2.*', '1.2.3'], + ['*', '1.2.3'], + ['2', '2.1.2'], + ['2.3', '2.3.1'], + ['~2.4', '2.4.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.4.5'], + ['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0 + ['~1', '1.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '1.2.3'], + ['~> 1', '1.2.3'], + ['~1.0', '1.0.2'], // >=1.0.0 <1.1.0 + ['~ 1.0', '1.0.2'], + ['>=1', '1.0.0'], + ['>= 1', '1.0.0'], + ['<1.2', '1.1.1'], + ['< 1.2', '1.1.1'], + ['1', '1.0.0beta', true], + ['~v0.5.4-pre', '0.5.5'], + ['~v0.5.4-pre', '0.5.4'], + ['=0.7.x', '0.7.2'], + ['>=0.7.x', '0.7.2'], + ['=0.7.x', '0.7.0-asdf'], + ['>=0.7.x', '0.7.0-asdf'], + ['<=0.7.x', '0.6.2'], + ['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'], + ['>=0.2.3 <=0.2.4', '0.2.4'], + ['1.0.0 - 2.0.0', '2.0.0'], + ['^1', '0.0.0-0'], + ['^3.0.0', '2.0.0'], + ['^1.0.0 || ~2.0.1', '2.0.0'], + ['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'], + ['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true], + ['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true], + ['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = '!gtr(' + version + ', ' + range + ', ' + loose + ')'; + t.notOk(gtr(version, range, loose), msg); + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/test/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/test/index.js new file mode 100644 index 00000000..e6c9cefb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/test/index.js @@ -0,0 +1,556 @@ +var tap = require('tap'); +var test = tap.test; +var semver = require('../semver.js'); +var eq = semver.eq; +var gt = semver.gt; +var lt = semver.lt; +var neq = semver.neq; +var cmp = semver.cmp; +var gte = semver.gte; +var lte = semver.lte; +var satisfies = semver.satisfies; +var validRange = semver.validRange; +var inc = semver.inc; +var replaceStars = semver.replaceStars; +var toComparators = semver.toComparators; +var SemVer = semver.SemVer; +var Range = semver.Range; + +test('\ncomparison tests', function(t) { + // [version1, version2] + // version1 should be greater than version2 + [['0.0.0', '0.0.0-foo'], + ['0.0.1', '0.0.0'], + ['1.0.0', '0.9.9'], + ['0.10.0', '0.9.0'], + ['0.99.0', '0.10.0'], + ['2.0.0', '1.2.3'], + ['v0.0.0', '0.0.0-foo', true], + ['v0.0.1', '0.0.0', true], + ['v1.0.0', '0.9.9', true], + ['v0.10.0', '0.9.0', true], + ['v0.99.0', '0.10.0', true], + ['v2.0.0', '1.2.3', true], + ['0.0.0', 'v0.0.0-foo', true], + ['0.0.1', 'v0.0.0', true], + ['1.0.0', 'v0.9.9', true], + ['0.10.0', 'v0.9.0', true], + ['0.99.0', 'v0.10.0', true], + ['2.0.0', 'v1.2.3', true], + ['1.2.3', '1.2.3-asdf'], + ['1.2.3', '1.2.3-4'], + ['1.2.3', '1.2.3-4-foo'], + ['1.2.3-5-foo', '1.2.3-5'], + ['1.2.3-5', '1.2.3-4'], + ['1.2.3-5-foo', '1.2.3-5-Foo'], + ['3.0.0', '2.7.2+asdf'], + ['1.2.3-a.10', '1.2.3-a.5'], + ['1.2.3-a.b', '1.2.3-a.5'], + ['1.2.3-a.b', '1.2.3-a'], + ['1.2.3-a.b.c.10.d.5', '1.2.3-a.b.c.5.d.100'] + ].forEach(function(v) { + var v0 = v[0]; + var v1 = v[1]; + var loose = v[2]; + t.ok(gt(v0, v1, loose), "gt('" + v0 + "', '" + v1 + "')"); + t.ok(lt(v1, v0, loose), "lt('" + v1 + "', '" + v0 + "')"); + t.ok(!gt(v1, v0, loose), "!gt('" + v1 + "', '" + v0 + "')"); + t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')"); + t.ok(eq(v0, v0, loose), "eq('" + v0 + "', '" + v0 + "')"); + t.ok(eq(v1, v1, loose), "eq('" + v1 + "', '" + v1 + "')"); + t.ok(neq(v0, v1, loose), "neq('" + v0 + "', '" + v1 + "')"); + t.ok(cmp(v1, '==', v1, loose), "cmp('" + v1 + "' == '" + v1 + "')"); + t.ok(cmp(v0, '>=', v1, loose), "cmp('" + v0 + "' >= '" + v1 + "')"); + t.ok(cmp(v1, '<=', v0, loose), "cmp('" + v1 + "' <= '" + v0 + "')"); + t.ok(cmp(v0, '!=', v1, loose), "cmp('" + v0 + "' != '" + v1 + "')"); + }); + t.end(); +}); + +test('\nequality tests', function(t) { + // [version1, version2] + // version1 should be equivalent to version2 + [['1.2.3', 'v1.2.3', true], + ['1.2.3', '=1.2.3', true], + ['1.2.3', 'v 1.2.3', true], + ['1.2.3', '= 1.2.3', true], + ['1.2.3', ' v1.2.3', true], + ['1.2.3', ' =1.2.3', true], + ['1.2.3', ' v 1.2.3', true], + ['1.2.3', ' = 1.2.3', true], + ['1.2.3-0', 'v1.2.3-0', true], + ['1.2.3-0', '=1.2.3-0', true], + ['1.2.3-0', 'v 1.2.3-0', true], + ['1.2.3-0', '= 1.2.3-0', true], + ['1.2.3-0', ' v1.2.3-0', true], + ['1.2.3-0', ' =1.2.3-0', true], + ['1.2.3-0', ' v 1.2.3-0', true], + ['1.2.3-0', ' = 1.2.3-0', true], + ['1.2.3-1', 'v1.2.3-1', true], + ['1.2.3-1', '=1.2.3-1', true], + ['1.2.3-1', 'v 1.2.3-1', true], + ['1.2.3-1', '= 1.2.3-1', true], + ['1.2.3-1', ' v1.2.3-1', true], + ['1.2.3-1', ' =1.2.3-1', true], + ['1.2.3-1', ' v 1.2.3-1', true], + ['1.2.3-1', ' = 1.2.3-1', true], + ['1.2.3-beta', 'v1.2.3-beta', true], + ['1.2.3-beta', '=1.2.3-beta', true], + ['1.2.3-beta', 'v 1.2.3-beta', true], + ['1.2.3-beta', '= 1.2.3-beta', true], + ['1.2.3-beta', ' v1.2.3-beta', true], + ['1.2.3-beta', ' =1.2.3-beta', true], + ['1.2.3-beta', ' v 1.2.3-beta', true], + ['1.2.3-beta', ' = 1.2.3-beta', true], + ['1.2.3-beta+build', ' = 1.2.3-beta+otherbuild', true], + ['1.2.3+build', ' = 1.2.3+otherbuild', true], + ['1.2.3-beta+build', '1.2.3-beta+otherbuild'], + ['1.2.3+build', '1.2.3+otherbuild'], + [' v1.2.3+build', '1.2.3+otherbuild'] + ].forEach(function(v) { + var v0 = v[0]; + var v1 = v[1]; + var loose = v[2]; + t.ok(eq(v0, v1, loose), "eq('" + v0 + "', '" + v1 + "')"); + t.ok(!neq(v0, v1, loose), "!neq('" + v0 + "', '" + v1 + "')"); + t.ok(cmp(v0, '==', v1, loose), 'cmp(' + v0 + '==' + v1 + ')'); + t.ok(!cmp(v0, '!=', v1, loose), '!cmp(' + v0 + '!=' + v1 + ')'); + t.ok(!cmp(v0, '===', v1, loose), '!cmp(' + v0 + '===' + v1 + ')'); + t.ok(cmp(v0, '!==', v1, loose), 'cmp(' + v0 + '!==' + v1 + ')'); + t.ok(!gt(v0, v1, loose), "!gt('" + v0 + "', '" + v1 + "')"); + t.ok(gte(v0, v1, loose), "gte('" + v0 + "', '" + v1 + "')"); + t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')"); + t.ok(lte(v0, v1, loose), "lte('" + v0 + "', '" + v1 + "')"); + }); + t.end(); +}); + + +test('\nrange tests', function(t) { + // [range, version] + // version should be included by range + [['1.0.0 - 2.0.0', '1.2.3'], + ['1.0.0', '1.0.0'], + ['>=*', '0.2.4'], + ['', '1.0.0'], + ['*', '1.2.3'], + ['*', 'v1.2.3-foo', true], + ['>=1.0.0', '1.0.0'], + ['>=1.0.0', '1.0.1'], + ['>=1.0.0', '1.1.0'], + ['>1.0.0', '1.0.1'], + ['>1.0.0', '1.1.0'], + ['<=2.0.0', '2.0.0'], + ['<=2.0.0', '1.9999.9999'], + ['<=2.0.0', '0.2.9'], + ['<2.0.0', '1.9999.9999'], + ['<2.0.0', '0.2.9'], + ['>= 1.0.0', '1.0.0'], + ['>= 1.0.0', '1.0.1'], + ['>= 1.0.0', '1.1.0'], + ['> 1.0.0', '1.0.1'], + ['> 1.0.0', '1.1.0'], + ['<= 2.0.0', '2.0.0'], + ['<= 2.0.0', '1.9999.9999'], + ['<= 2.0.0', '0.2.9'], + ['< 2.0.0', '1.9999.9999'], + ['<\t2.0.0', '0.2.9'], + ['>=0.1.97', 'v0.1.97', true], + ['>=0.1.97', '0.1.97'], + ['0.1.20 || 1.2.4', '1.2.4'], + ['>=0.2.3 || <0.0.1', '0.0.0'], + ['>=0.2.3 || <0.0.1', '0.2.3'], + ['>=0.2.3 || <0.0.1', '0.2.4'], + ['||', '1.3.4'], + ['2.x.x', '2.1.3'], + ['1.2.x', '1.2.3'], + ['1.2.x || 2.x', '2.1.3'], + ['1.2.x || 2.x', '1.2.3'], + ['x', '1.2.3'], + ['2.*.*', '2.1.3'], + ['1.2.*', '1.2.3'], + ['1.2.* || 2.*', '2.1.3'], + ['1.2.* || 2.*', '1.2.3'], + ['*', '1.2.3'], + ['2', '2.1.2'], + ['2.3', '2.3.1'], + ['~2.4', '2.4.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.4.5'], + ['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0, + ['~1', '1.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '1.2.3'], + ['~> 1', '1.2.3'], + ['~1.0', '1.0.2'], // >=1.0.0 <1.1.0, + ['~ 1.0', '1.0.2'], + ['~ 1.0.3', '1.0.12'], + ['>=1', '1.0.0'], + ['>= 1', '1.0.0'], + ['<1.2', '1.1.1'], + ['< 1.2', '1.1.1'], + ['1', '1.0.0beta', true], + ['~v0.5.4-pre', '0.5.5'], + ['~v0.5.4-pre', '0.5.4'], + ['=0.7.x', '0.7.2'], + ['>=0.7.x', '0.7.2'], + ['=0.7.x', '0.7.0-asdf'], + ['>=0.7.x', '0.7.0-asdf'], + ['<=0.7.x', '0.6.2'], + ['~1.2.1 >=1.2.3', '1.2.3'], + ['~1.2.1 =1.2.3', '1.2.3'], + ['~1.2.1 1.2.3', '1.2.3'], + ['~1.2.1 >=1.2.3 1.2.3', '1.2.3'], + ['~1.2.1 1.2.3 >=1.2.3', '1.2.3'], + ['~1.2.1 1.2.3', '1.2.3'], + ['>=1.2.1 1.2.3', '1.2.3'], + ['1.2.3 >=1.2.1', '1.2.3'], + ['>=1.2.3 >=1.2.1', '1.2.3'], + ['>=1.2.1 >=1.2.3', '1.2.3'], + ['<=1.2.3', '1.2.3-beta'], + ['>1.2', '1.3.0-beta'], + ['>=1.2', '1.2.8'], + ['^1.2.3', '1.8.1'], + ['^1.2.3', '1.2.3-beta'], + ['^0.1.2', '0.1.2'], + ['^0.1', '0.1.2'], + ['^1.2', '1.4.2'], + ['^1.2 ^1', '1.4.2'], + ['^1.2', '1.2.0-pre'], + ['^1.2.3', '1.2.3-pre'] + ].forEach(function(v) { + var range = v[0]; + var ver = v[1]; + var loose = v[2]; + t.ok(satisfies(ver, range, loose), range + ' satisfied by ' + ver); + }); + t.end(); +}); + +test('\nnegative range tests', function(t) { + // [range, version] + // version should not be included by range + [['1.0.0 - 2.0.0', '2.2.3'], + ['1.0.0', '1.0.1'], + ['>=1.0.0', '0.0.0'], + ['>=1.0.0', '0.0.1'], + ['>=1.0.0', '0.1.0'], + ['>1.0.0', '0.0.1'], + ['>1.0.0', '0.1.0'], + ['<=2.0.0', '3.0.0'], + ['<=2.0.0', '2.9999.9999'], + ['<=2.0.0', '2.2.9'], + ['<2.0.0', '2.9999.9999'], + ['<2.0.0', '2.2.9'], + ['>=0.1.97', 'v0.1.93', true], + ['>=0.1.97', '0.1.93'], + ['0.1.20 || 1.2.4', '1.2.3'], + ['>=0.2.3 || <0.0.1', '0.0.3'], + ['>=0.2.3 || <0.0.1', '0.2.2'], + ['2.x.x', '1.1.3'], + ['2.x.x', '3.1.3'], + ['1.2.x', '1.3.3'], + ['1.2.x || 2.x', '3.1.3'], + ['1.2.x || 2.x', '1.1.3'], + ['2.*.*', '1.1.3'], + ['2.*.*', '3.1.3'], + ['1.2.*', '1.3.3'], + ['1.2.* || 2.*', '3.1.3'], + ['1.2.* || 2.*', '1.1.3'], + ['2', '1.1.2'], + ['2.3', '2.4.1'], + ['~2.4', '2.5.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.3.9'], + ['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0 + ['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0 + ['~1', '0.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '2.2.3'], + ['~1.0', '1.1.0'], // >=1.0.0 <1.1.0 + ['<1', '1.0.0'], + ['>=1.2', '1.1.1'], + ['1', '2.0.0beta', true], + ['~v0.5.4-beta', '0.5.4-alpha'], + ['<1', '1.0.0beta', true], + ['< 1', '1.0.0beta', true], + ['=0.7.x', '0.8.2'], + ['>=0.7.x', '0.6.2'], + ['<=0.7.x', '0.7.2'], + ['<1.2.3', '1.2.3-beta'], + ['=1.2.3', '1.2.3-beta'], + ['>1.2', '1.2.8'], + ['^1.2.3', '2.0.0-alpha'], + ['^1.2.3', '1.2.2'], + ['^1.2', '1.1.9'], + // invalid ranges never satisfied! + ['blerg', '1.2.3'], + ['git+https://user:password0123@github.com/foo', '123.0.0', true], + ['^1.2.3', '2.0.0-pre'] + ].forEach(function(v) { + var range = v[0]; + var ver = v[1]; + var loose = v[2]; + var found = satisfies(ver, range, loose); + t.ok(!found, ver + ' not satisfied by ' + range); + }); + t.end(); +}); + +test('\nincrement versions test', function(t) { + // [version, inc, result] + // inc(version, inc) -> result + [['1.2.3', 'major', '2.0.0'], + ['1.2.3', 'minor', '1.3.0'], + ['1.2.3', 'patch', '1.2.4'], + ['1.2.3tag', 'major', '2.0.0', true], + ['1.2.3-tag', 'major', '2.0.0'], + ['1.2.3', 'fake', null], + ['fake', 'major', null], + ['1.2.3', 'prerelease', '1.2.3-0'], + ['1.2.3-0', 'prerelease', '1.2.3-1'], + ['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1'], + ['1.2.3-alpha.1', 'prerelease', '1.2.3-alpha.2'], + ['1.2.3-alpha.2', 'prerelease', '1.2.3-alpha.3'], + ['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta'], + ['1.2.3-alpha.1.beta', 'prerelease', '1.2.3-alpha.2.beta'], + ['1.2.3-alpha.2.beta', 'prerelease', '1.2.3-alpha.3.beta'], + ['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta'], + ['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta'], + ['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta'], + ['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1'], + ['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2'], + ['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3'], + ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta'], + ['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta'], + ['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'] + ].forEach(function(v) { + var pre = v[0]; + var what = v[1]; + var wanted = v[2]; + var loose = v[3]; + var found = inc(pre, what, loose); + t.equal(found, wanted, 'inc(' + pre + ', ' + what + ') === ' + wanted); + }); + + t.end(); +}); + +test('\nvalid range test', function(t) { + // [range, result] + // validRange(range) -> result + // translate ranges into their canonical form + [['1.0.0 - 2.0.0', '>=1.0.0 <=2.0.0'], + ['1.0.0', '1.0.0'], + ['>=*', '>=0.0.0-0'], + ['', '*'], + ['*', '*'], + ['*', '*'], + ['>=1.0.0', '>=1.0.0'], + ['>1.0.0', '>1.0.0'], + ['<=2.0.0', '<=2.0.0'], + ['1', '>=1.0.0-0 <2.0.0-0'], + ['<=2.0.0', '<=2.0.0'], + ['<=2.0.0', '<=2.0.0'], + ['<2.0.0', '<2.0.0-0'], + ['<2.0.0', '<2.0.0-0'], + ['>= 1.0.0', '>=1.0.0'], + ['>= 1.0.0', '>=1.0.0'], + ['>= 1.0.0', '>=1.0.0'], + ['> 1.0.0', '>1.0.0'], + ['> 1.0.0', '>1.0.0'], + ['<= 2.0.0', '<=2.0.0'], + ['<= 2.0.0', '<=2.0.0'], + ['<= 2.0.0', '<=2.0.0'], + ['< 2.0.0', '<2.0.0-0'], + ['< 2.0.0', '<2.0.0-0'], + ['>=0.1.97', '>=0.1.97'], + ['>=0.1.97', '>=0.1.97'], + ['0.1.20 || 1.2.4', '0.1.20||1.2.4'], + ['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1-0'], + ['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1-0'], + ['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1-0'], + ['||', '||'], + ['2.x.x', '>=2.0.0-0 <3.0.0-0'], + ['1.2.x', '>=1.2.0-0 <1.3.0-0'], + ['1.2.x || 2.x', '>=1.2.0-0 <1.3.0-0||>=2.0.0-0 <3.0.0-0'], + ['1.2.x || 2.x', '>=1.2.0-0 <1.3.0-0||>=2.0.0-0 <3.0.0-0'], + ['x', '*'], + ['2.*.*', '>=2.0.0-0 <3.0.0-0'], + ['1.2.*', '>=1.2.0-0 <1.3.0-0'], + ['1.2.* || 2.*', '>=1.2.0-0 <1.3.0-0||>=2.0.0-0 <3.0.0-0'], + ['*', '*'], + ['2', '>=2.0.0-0 <3.0.0-0'], + ['2.3', '>=2.3.0-0 <2.4.0-0'], + ['~2.4', '>=2.4.0-0 <2.5.0-0'], + ['~2.4', '>=2.4.0-0 <2.5.0-0'], + ['~>3.2.1', '>=3.2.1-0 <3.3.0-0'], + ['~1', '>=1.0.0-0 <2.0.0-0'], + ['~>1', '>=1.0.0-0 <2.0.0-0'], + ['~> 1', '>=1.0.0-0 <2.0.0-0'], + ['~1.0', '>=1.0.0-0 <1.1.0-0'], + ['~ 1.0', '>=1.0.0-0 <1.1.0-0'], + ['^0', '>=0.0.0-0 <1.0.0-0'], + ['^ 1', '>=1.0.0-0 <2.0.0-0'], + ['^0.1', '>=0.1.0-0 <0.2.0-0'], + ['^1.0', '>=1.0.0-0 <2.0.0-0'], + ['^1.2', '>=1.2.0-0 <2.0.0-0'], + ['^0.0.1', '=0.0.1'], + ['^0.0.1-beta', '=0.0.1-beta'], + ['^0.1.2', '>=0.1.2-0 <0.2.0-0'], + ['^1.2.3', '>=1.2.3-0 <2.0.0-0'], + ['^1.2.3-beta.4', '>=1.2.3-beta.4 <2.0.0-0'], + ['<1', '<1.0.0-0'], + ['< 1', '<1.0.0-0'], + ['>=1', '>=1.0.0-0'], + ['>= 1', '>=1.0.0-0'], + ['<1.2', '<1.2.0-0'], + ['< 1.2', '<1.2.0-0'], + ['1', '>=1.0.0-0 <2.0.0-0'], + ['>01.02.03', '>1.2.3', true], + ['>01.02.03', null], + ['~1.2.3beta', '>=1.2.3-beta <1.3.0-0', true], + ['~1.2.3beta', null], + ['^ 1.2 ^ 1', '>=1.2.0-0 <2.0.0-0 >=1.0.0-0 <2.0.0-0'] + ].forEach(function(v) { + var pre = v[0]; + var wanted = v[1]; + var loose = v[2]; + var found = validRange(pre, loose); + + t.equal(found, wanted, 'validRange(' + pre + ') === ' + wanted); + }); + + t.end(); +}); + +test('\ncomparators test', function(t) { + // [range, comparators] + // turn range into a set of individual comparators + [['1.0.0 - 2.0.0', [['>=1.0.0', '<=2.0.0']]], + ['1.0.0', [['1.0.0']]], + ['>=*', [['>=0.0.0-0']]], + ['', [['']]], + ['*', [['']]], + ['*', [['']]], + ['>=1.0.0', [['>=1.0.0']]], + ['>=1.0.0', [['>=1.0.0']]], + ['>=1.0.0', [['>=1.0.0']]], + ['>1.0.0', [['>1.0.0']]], + ['>1.0.0', [['>1.0.0']]], + ['<=2.0.0', [['<=2.0.0']]], + ['1', [['>=1.0.0-0', '<2.0.0-0']]], + ['<=2.0.0', [['<=2.0.0']]], + ['<=2.0.0', [['<=2.0.0']]], + ['<2.0.0', [['<2.0.0-0']]], + ['<2.0.0', [['<2.0.0-0']]], + ['>= 1.0.0', [['>=1.0.0']]], + ['>= 1.0.0', [['>=1.0.0']]], + ['>= 1.0.0', [['>=1.0.0']]], + ['> 1.0.0', [['>1.0.0']]], + ['> 1.0.0', [['>1.0.0']]], + ['<= 2.0.0', [['<=2.0.0']]], + ['<= 2.0.0', [['<=2.0.0']]], + ['<= 2.0.0', [['<=2.0.0']]], + ['< 2.0.0', [['<2.0.0-0']]], + ['<\t2.0.0', [['<2.0.0-0']]], + ['>=0.1.97', [['>=0.1.97']]], + ['>=0.1.97', [['>=0.1.97']]], + ['0.1.20 || 1.2.4', [['0.1.20'], ['1.2.4']]], + ['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1-0']]], + ['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1-0']]], + ['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1-0']]], + ['||', [[''], ['']]], + ['2.x.x', [['>=2.0.0-0', '<3.0.0-0']]], + ['1.2.x', [['>=1.2.0-0', '<1.3.0-0']]], + ['1.2.x || 2.x', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]], + ['1.2.x || 2.x', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]], + ['x', [['']]], + ['2.*.*', [['>=2.0.0-0', '<3.0.0-0']]], + ['1.2.*', [['>=1.2.0-0', '<1.3.0-0']]], + ['1.2.* || 2.*', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]], + ['1.2.* || 2.*', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]], + ['*', [['']]], + ['2', [['>=2.0.0-0', '<3.0.0-0']]], + ['2.3', [['>=2.3.0-0', '<2.4.0-0']]], + ['~2.4', [['>=2.4.0-0', '<2.5.0-0']]], + ['~2.4', [['>=2.4.0-0', '<2.5.0-0']]], + ['~>3.2.1', [['>=3.2.1-0', '<3.3.0-0']]], + ['~1', [['>=1.0.0-0', '<2.0.0-0']]], + ['~>1', [['>=1.0.0-0', '<2.0.0-0']]], + ['~> 1', [['>=1.0.0-0', '<2.0.0-0']]], + ['~1.0', [['>=1.0.0-0', '<1.1.0-0']]], + ['~ 1.0', [['>=1.0.0-0', '<1.1.0-0']]], + ['~ 1.0.3', [['>=1.0.3-0', '<1.1.0-0']]], + ['~> 1.0.3', [['>=1.0.3-0', '<1.1.0-0']]], + ['<1', [['<1.0.0-0']]], + ['< 1', [['<1.0.0-0']]], + ['>=1', [['>=1.0.0-0']]], + ['>= 1', [['>=1.0.0-0']]], + ['<1.2', [['<1.2.0-0']]], + ['< 1.2', [['<1.2.0-0']]], + ['1', [['>=1.0.0-0', '<2.0.0-0']]], + ['1 2', [['>=1.0.0-0', '<2.0.0-0', '>=2.0.0-0', '<3.0.0-0']]], + ['1.2 - 3.4.5', [['>=1.2.0-0', '<=3.4.5']]], + ['1.2.3 - 3.4', [['>=1.2.3', '<3.5.0-0']]] + ].forEach(function(v) { + var pre = v[0]; + var wanted = v[1]; + var found = toComparators(v[0]); + var jw = JSON.stringify(wanted); + t.equivalent(found, wanted, 'toComparators(' + pre + ') === ' + jw); + }); + + t.end(); +}); + +test('\nstrict vs loose version numbers', function(t) { + [['=1.2.3', '1.2.3'], + ['01.02.03', '1.2.3'], + ['1.2.3-beta.01', '1.2.3-beta.1'], + [' =1.2.3', '1.2.3'], + ['1.2.3foo', '1.2.3-foo'] + ].forEach(function(v) { + var loose = v[0]; + var strict = v[1]; + t.throws(function() { + new SemVer(loose); + }); + var lv = new SemVer(loose, true); + t.equal(lv.version, strict); + t.ok(eq(loose, strict, true)); + t.throws(function() { + eq(loose, strict); + }); + t.throws(function() { + new SemVer(strict).compare(loose); + }); + }); + t.end(); +}); + +test('\nstrict vs loose ranges', function(t) { + [['>=01.02.03', '>=1.2.3'], + ['~1.02.03beta', '>=1.2.3-beta <1.3.0-0'] + ].forEach(function(v) { + var loose = v[0]; + var comps = v[1]; + t.throws(function() { + new Range(loose); + }); + t.equal(new Range(loose, true).range, comps); + }); + t.end(); +}); + +test('\nmax satisfying', function(t) { + [[['1.2.3', '1.2.4'], '1.2', '1.2.4'], + [['1.2.4', '1.2.3'], '1.2', '1.2.4'], + [['1.2.3', '1.2.4', '1.2.5', '1.2.6'], '~1.2.3', '1.2.6'], + [['1.1.0', '1.2.0', '1.2.1', '1.3.0', '2.0.0b1', '2.0.0b2', '2.0.0b3', '2.0.0', '2.1.0'], '~2.0.0', '2.0.0', true] + ].forEach(function(v) { + var versions = v[0]; + var range = v[1]; + var expect = v[2]; + var loose = v[3]; + var actual = semver.maxSatisfying(versions, range, loose); + t.equal(actual, expect); + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/test/ltr.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/test/ltr.js new file mode 100644 index 00000000..a4f503a3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/test/ltr.js @@ -0,0 +1,174 @@ +var tap = require('tap'); +var test = tap.test; +var semver = require('../semver.js'); +var ltr = semver.ltr; + +test('\nltr tests', function(t) { + // [range, version, loose] + // Version should be less than range + [ + ['~1.2.2', '1.2.1'], + ['~0.6.1-1', '0.6.1-0'], + ['1.0.0 - 2.0.0', '0.0.1'], + ['1.0.0-beta.2', '1.0.0-beta.1'], + ['1.0.0', '0.0.0'], + ['>=2.0.0', '1.1.1'], + ['>=2.0.0', '1.2.9'], + ['>2.0.0', '2.0.0'], + ['0.1.20 || 1.2.4', '0.1.5'], + ['2.x.x', '1.0.0'], + ['1.2.x', '1.1.0'], + ['1.2.x || 2.x', '1.0.0'], + ['2.*.*', '1.0.1'], + ['1.2.*', '1.1.3'], + ['1.2.* || 2.*', '1.1.9999'], + ['2', '1.0.0'], + ['2.3', '2.2.2'], + ['~2.4', '2.3.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.3.5'], + ['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0 + ['~1', '0.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '0.2.4'], + ['~> 1', '0.2.3'], + ['~1.0', '0.1.2'], // >=1.0.0 <1.1.0 + ['~ 1.0', '0.1.0'], + ['>1.2', '1.2.0'], + ['> 1.2', '1.2.1'], + ['1', '0.0.0beta', true], + ['~v0.5.4-pre', '0.5.4-alpha'], + ['~v0.5.4-pre', '0.5.4-alpha'], + ['=0.7.x', '0.6.0'], + ['=0.7.x', '0.6.0-asdf'], + ['>=0.7.x', '0.6.0'], + ['~1.2.2', '1.2.1'], + ['1.0.0 - 2.0.0', '0.2.3'], + ['1.0.0', '0.0.1'], + ['>=2.0.0', '1.0.0'], + ['>=2.0.0', '1.9999.9999'], + ['>=2.0.0', '1.2.9'], + ['>2.0.0', '2.0.0'], + ['>2.0.0', '1.2.9'], + ['2.x.x', '1.1.3'], + ['1.2.x', '1.1.3'], + ['1.2.x || 2.x', '1.1.3'], + ['2.*.*', '1.1.3'], + ['1.2.*', '1.1.3'], + ['1.2.* || 2.*', '1.1.3'], + ['2', '1.9999.9999'], + ['2.3', '2.2.1'], + ['~2.4', '2.3.0'], // >=2.4.0 <2.5.0 + ['~>3.2.1', '2.3.2'], // >=3.2.1 <3.3.0 + ['~1', '0.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '0.2.3'], + ['~1.0', '0.0.0'], // >=1.0.0 <1.1.0 + ['>1', '1.0.0'], + ['2', '1.0.0beta', true], + ['>1', '1.0.0beta', true], + ['> 1', '1.0.0beta', true], + ['=0.7.x', '0.6.2'], + ['>=0.7.x', '0.6.2'] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = 'ltr(' + version + ', ' + range + ', ' + loose + ')'; + t.ok(ltr(version, range, loose), msg); + }); + t.end(); +}); + +test('\nnegative ltr tests', function(t) { + // [range, version, loose] + // Version should NOT be greater than range + [ + ['~ 1.0', '1.1.0'], + ['~0.6.1-1', '0.6.1-1'], + ['1.0.0 - 2.0.0', '1.2.3'], + ['1.0.0 - 2.0.0', '2.9.9'], + ['1.0.0', '1.0.0'], + ['>=*', '0.2.4'], + ['', '1.0.0', true], + ['*', '1.2.3'], + ['*', 'v1.2.3-foo'], + ['>=1.0.0', '1.0.0'], + ['>=1.0.0', '1.0.1'], + ['>=1.0.0', '1.1.0'], + ['>1.0.0', '1.0.1'], + ['>1.0.0', '1.1.0'], + ['<=2.0.0', '2.0.0'], + ['<=2.0.0', '1.9999.9999'], + ['<=2.0.0', '0.2.9'], + ['<2.0.0', '1.9999.9999'], + ['<2.0.0', '0.2.9'], + ['>= 1.0.0', '1.0.0'], + ['>= 1.0.0', '1.0.1'], + ['>= 1.0.0', '1.1.0'], + ['> 1.0.0', '1.0.1'], + ['> 1.0.0', '1.1.0'], + ['<= 2.0.0', '2.0.0'], + ['<= 2.0.0', '1.9999.9999'], + ['<= 2.0.0', '0.2.9'], + ['< 2.0.0', '1.9999.9999'], + ['<\t2.0.0', '0.2.9'], + ['>=0.1.97', 'v0.1.97'], + ['>=0.1.97', '0.1.97'], + ['0.1.20 || 1.2.4', '1.2.4'], + ['0.1.20 || >1.2.4', '1.2.4'], + ['0.1.20 || 1.2.4', '1.2.3'], + ['0.1.20 || 1.2.4', '0.1.20'], + ['>=0.2.3 || <0.0.1', '0.0.0'], + ['>=0.2.3 || <0.0.1', '0.2.3'], + ['>=0.2.3 || <0.0.1', '0.2.4'], + ['||', '1.3.4'], + ['2.x.x', '2.1.3'], + ['1.2.x', '1.2.3'], + ['1.2.x || 2.x', '2.1.3'], + ['1.2.x || 2.x', '1.2.3'], + ['x', '1.2.3'], + ['2.*.*', '2.1.3'], + ['1.2.*', '1.2.3'], + ['1.2.* || 2.*', '2.1.3'], + ['1.2.* || 2.*', '1.2.3'], + ['1.2.* || 2.*', '1.2.3'], + ['*', '1.2.3'], + ['2', '2.1.2'], + ['2.3', '2.3.1'], + ['~2.4', '2.4.0'], // >=2.4.0 <2.5.0 + ['~2.4', '2.4.5'], + ['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0 + ['~1', '1.2.3'], // >=1.0.0 <2.0.0 + ['~>1', '1.2.3'], + ['~> 1', '1.2.3'], + ['~1.0', '1.0.2'], // >=1.0.0 <1.1.0 + ['~ 1.0', '1.0.2'], + ['>=1', '1.0.0'], + ['>= 1', '1.0.0'], + ['<1.2', '1.1.1'], + ['< 1.2', '1.1.1'], + ['1', '1.0.0beta', true], + ['~v0.5.4-pre', '0.5.5'], + ['~v0.5.4-pre', '0.5.4'], + ['=0.7.x', '0.7.2'], + ['>=0.7.x', '0.7.2'], + ['=0.7.x', '0.7.0-asdf'], + ['>=0.7.x', '0.7.0-asdf'], + ['<=0.7.x', '0.6.2'], + ['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'], + ['>=0.2.3 <=0.2.4', '0.2.4'], + ['1.0.0 - 2.0.0', '2.0.0'], + ['^1', '1.0.0-0'], + ['^3.0.0', '4.0.0'], + ['^1.0.0 || ~2.0.1', '2.0.0'], + ['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'], + ['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true], + ['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true], + ['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'] + ].forEach(function(tuple) { + var range = tuple[0]; + var version = tuple[1]; + var loose = tuple[2] || false; + var msg = '!ltr(' + version + ', ' + range + ', ' + loose + ')'; + t.notOk(ltr(version, range, loose), msg); + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/test/no-module.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/test/no-module.js new file mode 100644 index 00000000..96d1cd1f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/semver/test/no-module.js @@ -0,0 +1,19 @@ +var tap = require('tap'); +var test = tap.test; + +test('no module system', function(t) { + var fs = require('fs'); + var vm = require('vm'); + var head = fs.readFileSync(require.resolve('../head.js'), 'utf8'); + var src = fs.readFileSync(require.resolve('../'), 'utf8'); + var foot = fs.readFileSync(require.resolve('../foot.js'), 'utf8'); + vm.runInThisContext(head + src + foot, 'semver.js'); + + // just some basic poking to see if it did some stuff + t.type(global.semver, 'object'); + t.type(global.semver.SemVer, 'function'); + t.type(global.semver.Range, 'function'); + t.ok(global.semver.satisfies('1.2.3', '1.2')); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/cli.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/cli.js new file mode 100755 index 00000000..ac4da484 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/cli.js @@ -0,0 +1,41 @@ +#!/usr/bin/env node +'use strict'; +var fs = require('fs'); +var strip = require('./strip-json-comments'); +var input = process.argv[2]; + + +function getStdin(cb) { + var ret = ''; + + process.stdin.setEncoding('utf8'); + + process.stdin.on('data', function (data) { + ret += data; + }); + + process.stdin.on('end', function () { + cb(ret); + }); +} + +if (process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) { + console.log('strip-json-comments > '); + console.log('or'); + console.log('cat | strip-json-comments > '); + return; +} + +if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) { + console.log(require('./package').version); + return; +} + +if (input) { + process.stdout.write(strip(fs.readFileSync(input, 'utf8'))); + return; +} + +getStdin(function (data) { + process.stdout.write(strip(data)); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/package.json new file mode 100644 index 00000000..818bb75a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/package.json @@ -0,0 +1,77 @@ +{ + "name": "strip-json-comments", + "version": "0.1.3", + "description": "Strip comments from JSON. Lets you use comments in your JSON files!", + "keywords": [ + "json", + "strip", + "remove", + "delete", + "trim", + "comments", + "multiline", + "parse", + "config", + "configuration", + "conf", + "settings", + "util", + "env", + "environment", + "cli", + "bin" + ], + "license": "MIT", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "files": [ + "cli.js", + "strip-json-comments.js" + ], + "main": "strip-json-comments", + "bin": { + "strip-json-comments": "cli.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/sindresorhus/strip-json-comments" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "mocha": "*" + }, + "engines": { + "node": ">=0.8.0" + }, + "gitHead": "cbd5aede7ccbe5d5a9065b1d47070fd99ad579af", + "bugs": { + "url": "https://github.com/sindresorhus/strip-json-comments/issues" + }, + "homepage": "https://github.com/sindresorhus/strip-json-comments", + "_id": "strip-json-comments@0.1.3", + "_shasum": "164c64e370a8a3cc00c9e01b539e569823f0ee54", + "_from": "strip-json-comments@>=0.1.1 <0.2.0", + "_npmVersion": "1.4.13", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "164c64e370a8a3cc00c9e01b539e569823f0ee54", + "tarball": "http://registry.npmjs.org/strip-json-comments/-/strip-json-comments-0.1.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-0.1.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/readme.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/readme.md new file mode 100644 index 00000000..ad6a178c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/readme.md @@ -0,0 +1,74 @@ +# strip-json-comments [![Build Status](https://travis-ci.org/sindresorhus/strip-json-comments.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-json-comments) + +> Strip comments from JSON. Lets you use comments in your JSON files! + +This is now possible: + +```js +{ + // rainbows + "unicorn": /* ❤ */ "cake" +} +``` + +It will remove single-line comments `//` and mult-line comments `/**/`. + +Also available as a [gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin and a [require hook](https://github.com/uTest/autostrip-json-comments). + + +*There's already [json-comments](https://npmjs.org/package/json-comments), but it's only for Node.js and uses a naive regex to strip comments which fails on simple cases like `{"a":"//"}`. This module however parses out the comments.* + + +## Install + +```sh +$ npm install --save strip-json-comments +``` + +```sh +$ bower install --save strip-json-comments +``` + +```sh +$ component install sindresorhus/strip-json-comments +``` + + +## Usage + +```js +var json = '{/*rainbows*/"unicorn":"cake"}'; +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} +``` + + +## API + +### stripJsonComments(input) + +#### input + +Type: `string` + +Accepts a string with JSON and returns a string without comments. + + +## CLI + +```sh +$ npm install --global strip-json-comments +``` + +```sh +$ strip-json-comments --help + +strip-json-comments > +# or +cat | strip-json-comments > +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/strip-json-comments.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/strip-json-comments.js new file mode 100644 index 00000000..2e7fdef2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/node_modules/strip-json-comments/strip-json-comments.js @@ -0,0 +1,64 @@ +/*! + strip-json-comments + Strip comments from JSON. Lets you use comments in your JSON files! + https://github.com/sindresorhus/strip-json-comments + by Sindre Sorhus + MIT License +*/ +(function () { + 'use strict'; + + function stripJsonComments(str) { + var currentChar; + var nextChar; + var insideString = false; + var insideComment = false; + var ret = ''; + + for (var i = 0; i < str.length; i++) { + currentChar = str[i]; + nextChar = str[i + 1]; + + if (!insideComment && str[i - 1] !== '\\' && currentChar === '"') { + insideString = !insideString; + } + + if (insideString) { + ret += currentChar; + continue; + } + + if (!insideComment && currentChar + nextChar === '//') { + insideComment = 'single'; + i++; + } else if (insideComment === 'single' && currentChar + nextChar === '\r\n') { + insideComment = false; + i++; + } else if (insideComment === 'single' && currentChar === '\n') { + insideComment = false; + } else if (!insideComment && currentChar + nextChar === '/*') { + insideComment = 'multi'; + i++; + continue; + } else if (insideComment === 'multi' && currentChar + nextChar === '*/') { + insideComment = false; + i++; + continue; + } + + if (insideComment) { + continue; + } + + ret += currentChar; + } + + return ret; + } + + if (typeof module !== 'undefined' && module.exports) { + module.exports = stripJsonComments; + } else { + window.stripJsonComments = stripJsonComments; + } +})(); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/package.json new file mode 100644 index 00000000..01430da7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/package.json @@ -0,0 +1,89 @@ +{ + "name": "esformatter", + "version": "0.6.1", + "description": "ECMAScript code beautifier/formatter", + "main": "lib/esformatter.js", + "bin": { + "esformatter": "./bin/esformatter" + }, + "scripts": { + "test": "node test/runner.js", + "lint": "jshint lib/*.js lib/**/*.js test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/millermedeiros/esformatter.git" + }, + "bugs": { + "url": "https://github.com/millermedeiros/esformatter/issues" + }, + "keywords": [ + "beautifier", + "beautify", + "formatter", + "ecmascript", + "javascript", + "syntax", + "source", + "esprima" + ], + "author": { + "name": "Miller Medeiros", + "url": "http://blog.millermedeiros.com/" + }, + "devDependencies": { + "chai": "1.4", + "esformatter-pipe-test": "file:test/pipe", + "esformatter-test-plugin": "file:test/plugin", + "esprima": "^2.0.0", + "glob": "3.1", + "jshint": "~2.3.0", + "mocha": "https://github.com/millermedeiros/mocha/tarball/latest", + "mockery": "^1.4.0" + }, + "dependencies": { + "debug": "^0.7.4", + "mout": ">=0.9 <2.0", + "npm-run": "^1.1.1", + "optimist": "~0.6.0", + "resolve": "^1.1.5", + "rocambole": ">=0.5 <2.0", + "rocambole-indent": "^2.0.3", + "rocambole-linebreak": "^1.0.0", + "rocambole-node": "~1.0", + "rocambole-token": "^1.1.2", + "rocambole-whitespace": "^1.0.0", + "semver": "~2.2.1", + "stdin": "*", + "strip-json-comments": "~0.1.1" + }, + "license": "MIT", + "gitHead": "2fa0c4122db1fceee1b5794e7c72a5dfa8539874", + "homepage": "https://github.com/millermedeiros/esformatter", + "_id": "esformatter@0.6.1", + "_shasum": "b0bac9b1bde3793bc0cff2c590f940cc86ad4bc4", + "_from": "esformatter@>=0.6.0 <0.7.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + "maintainers": [ + { + "name": "millermedeiros", + "email": "miller@millermedeiros.com" + }, + { + "name": "jzaefferer", + "email": "joern.zaefferer@gmail.com" + } + ], + "dist": { + "shasum": "b0bac9b1bde3793bc0cff2c590f940cc86ad4bc4", + "tarball": "http://registry.npmjs.org/esformatter/-/esformatter-0.6.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/esformatter/-/esformatter-0.6.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/api.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/api.spec.js new file mode 100644 index 00000000..080d5e58 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/api.spec.js @@ -0,0 +1,77 @@ +//jshint node:true +/*global describe, it*/ +"use strict"; + +var expect = require('chai').expect; +var esformatter = require('../lib/esformatter'); + + +describe('API', function() { + + describe('exposed API', function() { + // plugins might need to access some internal methods from esformatter + // so we check if these methods are really available + var limit = require('../lib/limit'); + var options = require('../lib/options'); + + it('shoud expose useful methods to plugin authors', function() { + // we don't need to check implementation here since these methods are + // used internally + expect(limit.before).to.be.a('function'); + expect(limit.after).to.be.a('function'); + expect(limit.around).to.be.a('function'); + expect(options.set).to.be.a('function'); + expect(options.get).to.be.a('function'); + expect(options.getRc).to.be.a('function'); + expect(options.loadAndParseConfig).to.be.a('function'); + expect(esformatter.rc).to.be.a('function'); + }); + }); + + describe('esformatter.rc', function() { + // PS: CLI is already testing this method indirectly, we are only checking + // for edge cases for now + + it('should return custom options if root == true', function() { + expect( + esformatter.rc(null, {root:true}) + ).to.be.eql({root:true}); + }); + + it('should return custom options if preset', function() { + expect( + esformatter.rc(null, {preset:'default'}) + ).to.be.eql({preset:'default'}); + }); + + it('should merge the custom option', function() { + var customOpts = { + whiteSpace: { + before: { + "ArrayExpressionClosing" : 1 + }, + after: { + "ArrayExpressionOpening" : 1 + } + } + }; + var result = esformatter.rc('test/compare/rc/top-in.js', customOpts); + expect(result.whiteSpace.before.FunctionDeclarationOpeningBrace).to.be.eql(0); + expect(result.whiteSpace.before.ArrayExpressionClosing).to.be.eql(1); + expect(result.whiteSpace.after.ArrayExpressionOpening).to.be.eql(1); + }); + + it('should merge rcs from parent folder', function() { + var result = esformatter.rc('test/compare/rc/nested/nested-in.js'); + expect(result.indent.value).to.be.eql('\t'); + expect(result.whiteSpace.before.FunctionDeclarationOpeningBrace).to.be.eql(0); + }); + + it('should merge .esformatter and package.json files', function() { + var result = esformatter.rc('test/compare/rc/package/nested/pkg_nested-in.js'); + expect(result.indent.value).to.be.eql('\t'); + expect(result.lineBreak.before.FunctionDeclarationOpeningBrace).to.be.eql(1); + expect(result.lineBreak.before.FunctionDeclarationClosingBrace).to.be.eql(0); + }); + }); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/config.json new file mode 100644 index 00000000..f57b9ea0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/config.json @@ -0,0 +1,4 @@ +{ + "preset": "default", + "root": true +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/node_modules/esformatter/lib/cli.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/node_modules/esformatter/lib/cli.js new file mode 100644 index 00000000..898e7993 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/node_modules/esformatter/lib/cli.js @@ -0,0 +1,10 @@ +'use strict'; + +exports.parse = function() { + return null; +}; + +exports.run = function() { + console.log('fake-esformatter v0.0.0-alpha'); + process.exit(0); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/node_modules/esformatter/lib/fake.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/node_modules/esformatter/lib/fake.js new file mode 100644 index 00000000..0488a5e0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/node_modules/esformatter/lib/fake.js @@ -0,0 +1 @@ +throw new Error('this is just a fake file and should not be executed'); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/node_modules/esformatter/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/node_modules/esformatter/package.json new file mode 100644 index 00000000..17d8b1d7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/bin/node_modules/esformatter/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "name": "esformatter", + "description": "this is a fake version of esformatter just to test if CLI can use local version", + "version": "0.0.0-alpha", + "main": "lib/fake.js" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/cli.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/cli.spec.js new file mode 100644 index 00000000..2b049a9e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/cli.spec.js @@ -0,0 +1,179 @@ +/*jshint node:true*/ +/*global describe:false, it:false*/ +"use strict"; + +var spawn = require('child_process').spawn; +var path = require('path'); +var fs = require('fs'); +var expect = require('chai').expect; +var helpers = require('./helpers'); + +describe('Command line interface', function() { + var filePath; + var configPath; + + /** + * Spawn a child process calling the bin file with the specified options + * @param {String} options Same as you would pass in the command line + * @param {String} input Standard input + * @param {Function} testCallback It receives the formatted file + */ + var spawnEsformatter = function(id, options, input, testCallback) { + var args = [path.join(__dirname + '/../bin/esformatter')]; + if (typeof options === 'function') { + testCallback = options; + options = null; + } else if (typeof input === 'function') { + testCallback = input; + input = null; + } + if (options) { + args = args.concat(options.split(" ")); + } + it('[cli '+ id +'] ' + options, function(mochaCallback) { + var childprocess = spawn('node', args, { + stdio: ['pipe', 'pipe', 'pipe'] + }); + var output = ""; + var errorInChildProcess = ""; + childprocess.stdout.on('data', function(data) { + output += data.toString(); + }); + childprocess.stderr.on('data', function(data) { + errorInChildProcess += data.toString(); + }); + childprocess.on('exit', function() { + if (errorInChildProcess) { + testCallback(new Error(errorInChildProcess)); + // we don't check for the error directly because sometimes we want + // to test if the error is what we expect + mochaCallback(); + } else { + try { + // There is an extra line feed from piping stdout + testCallback(helpers.lineFeed(output)); + mochaCallback(); + } catch (ex) { + mochaCallback(ex); + } + } + }); + if (input) { + try { + var textInput = fs.readFileSync(input, 'utf-8'); + childprocess.stdin.write(textInput); + childprocess.stdin.end(); + } catch (ex) { + mochaCallback(ex); + } + } + }); + }; + + + // Format a file with default options + filePath = path.join(__dirname + '/compare/default/array_expression-in.js'); + spawnEsformatter('default', '--preset=default', filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/default/array_expression')); + }); + + // Format a file specifying some options + filePath = path.join(__dirname + '/compare/custom/basic_function_indent-in.js'); + configPath = path.join(__dirname + '/compare/custom/basic_function_indent-config.json'); + spawnEsformatter('config', "--config " + configPath + " " + filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/custom/basic_function_indent')); + }); + + // Format a file from standard input + filePath = path.join(__dirname + '/compare/default/assignment_expression-in.js'); + spawnEsformatter('stdin', '--preset=default', filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/default/assignment_expression')); + }); + + // Format a file from standard input with options + filePath = path.join(__dirname + '/compare/custom/call_expression-in.js'); + configPath = path.join(__dirname + '/compare/custom/call_expression-config.json'); + spawnEsformatter('stdin+config', "--config " + configPath, filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/custom/call_expression')); + }); + + // Format file with jquery preset + filePath = path.join(__dirname + '/compare/jquery/spacing-in.js'); + spawnEsformatter('preset', "--preset jquery " + filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/jquery/spacing')); + }); + + // use settings from package.json file + filePath = path.join(__dirname + '/compare/rc/package/package-in.js'); + spawnEsformatter('package.json', filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/rc/package/package')); + }); + + // use settings from .esformatter file + filePath = path.join(__dirname + '/compare/rc/top-in.js'); + spawnEsformatter('rc', filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/rc/top')); + }); + + // use settings from .esformatter file + filePath = path.join(__dirname + '/compare/rc/nested/nested-in.js'); + spawnEsformatter('rc nested', filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/rc/nested/nested')); + }); + + // make sure .esformatter file have higher priority than package.json + filePath = path.join(__dirname + '/compare/rc/package/rc/nested-in.js'); + spawnEsformatter('rc nested package', filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/rc/package/rc/nested')); + }); + + // make sure .esformatter file have higher priority than package.json and + // that configs are merged even if inside same folder + filePath = path.join(__dirname + '/compare/rc/package/nested/pkg_nested-in.js'); + spawnEsformatter('nested package+rc', filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/rc/package/nested/pkg_nested')); + }); + + // make sure it shows descriptive error message when config doesn't exist + filePath = path.join(__dirname + '/compare/default/call_expression-in.js'); + spawnEsformatter('invalid config', '-c non-existent.json '+ filePath, function(formattedFile) { + expect(formattedFile.message).to.equal('Can\'t parse configuration file: "non-existent.json"\nException: ENOENT, no such file or directory \'non-existent.json\'\n'); + }); + + // make sure it shows descriptive error message when file doesn't exist + spawnEsformatter('invalid file', 'fake-esformatter-123.js', function(formattedFile) { + expect(formattedFile.message).to.equal('Can\'t read source file: "fake-esformatter-123.js"\nException: ENOENT, no such file or directory \'fake-esformatter-123.js\'\n'); + }); + + // comments should be allowed on config.json files + filePath = path.join(__dirname + '/compare/custom/commented_config-in.js'); + configPath = path.join(__dirname + '/compare/custom/commented_config-config.json'); + spawnEsformatter('config', "--config " + configPath + " " + filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/custom/commented_config')); + }); + + // plugins should be loaded from node_modules + filePath = path.join(__dirname + '/compare/custom/commented_config-in.js'); + configPath = path.join(__dirname + '/compare/custom/commented_config-config.json'); + spawnEsformatter('local plugin', '--config ' + configPath + ' --plugins esformatter-test-plugin ' + filePath, function(formattedFile) { + expect(formattedFile).to.equal(helpers.readOut('/custom/commented_config').replace(/true/, 'false')); + }); + + // it should use locally installed esformatter version if available + filePath = path.join(__dirname + '/compare/custom/commented_config-in.js'); + configPath = path.join(__dirname + '/bin/config.json'); + spawnEsformatter('local install', '--config ' + configPath + ' ' + filePath, function(formattedFile) { + expect(formattedFile.trim()).to.equal('fake-esformatter v0.0.0-alpha'); + }); + + // in place option should modify the input file + var originalInPlace = path.join(__dirname + '/compare/default/inplace-in.js'); + var cpInPlace = path.join(__dirname + '/compare/default/inplace-in.js.copy'); + var expectedInPlace = path.join(__dirname + '/compare/default/inplace-out.js'); + fs.writeFileSync(cpInPlace, fs.readFileSync(originalInPlace)); + spawnEsformatter('default', '-i', cpInPlace, function(formattedFile) { + fs.unlinkSync(cpInPlace); + expect(formattedFile).to.equal(fs.readFileSync(expectedInPlace, { encoding: 'utf8' })); + }); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/README.md new file mode 100644 index 00000000..d6e8c1c8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/README.md @@ -0,0 +1,9 @@ +# custom settings tests + +These files are used to test custom settings. It should try to test the +*opposite* of the default settings whenever possible. + +`foo_bar-in.js` will be used as input and will be compared with +`foo_bar-out.js`, `foo_bar-config.json` will be passed as the custom settings +on the `esformatter.parse()` call. + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/align_comments-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/align_comments-config.json new file mode 100644 index 00000000..47bdb075 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/align_comments-config.json @@ -0,0 +1,5 @@ +{ + "indent": { + "AlignComments": false + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/align_comments-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/align_comments-in.js new file mode 100644 index 00000000..0b8490a5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/align_comments-in.js @@ -0,0 +1,21 @@ +// comment alignment (#209) +switch (foo) { + case bar: + // lorem + baz(); + // falls through + // yes, this should be aligned too + + // this should be at same indent level as `baz();` + case biz: + what(); +} + +// comment alignment (#270) +try { + bla(); + // comment + // too +} catch (e) { + throw e; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/align_comments-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/align_comments-out.js new file mode 100644 index 00000000..0b8490a5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/align_comments-out.js @@ -0,0 +1,21 @@ +// comment alignment (#209) +switch (foo) { + case bar: + // lorem + baz(); + // falls through + // yes, this should be aligned too + + // this should be at same indent level as `baz();` + case biz: + what(); +} + +// comment alignment (#270) +try { + bla(); + // comment + // too +} catch (e) { + throw e; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/argumentlist-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/argumentlist-config.json new file mode 100644 index 00000000..96b5bc80 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/argumentlist-config.json @@ -0,0 +1,11 @@ +{ + "whiteSpace" : { + "before" : { + "ArgumentList" : 1 + }, + "after" : { + "ArgumentList" : 1 + } + } +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/argumentlist-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/argumentlist-in.js new file mode 100644 index 00000000..f19981c6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/argumentlist-in.js @@ -0,0 +1,23 @@ +call(); +call( x ); +call( function() { + something(); +} ); +call( {} ); +call( { + x : 1 +} ); +call( x, { + x : 1 +} ); +call( x, function() { + x(); +} ); +call( function() { + x(); +}, x ); +call( { + x : 1 +}, x ); +call( [] ); +call( [x, y] ); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/argumentlist-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/argumentlist-out.js new file mode 100644 index 00000000..a0ecbb80 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/argumentlist-out.js @@ -0,0 +1,23 @@ +call(); +call( x ); +call( function() { + something(); +} ); +call( {} ); +call( { + x: 1 +} ); +call( x, { + x: 1 +} ); +call( x, function() { + x(); +} ); +call( function() { + x(); +}, x ); +call( { + x: 1 +}, x ); +call( [] ); +call( [x, y] ); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_bug-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_bug-config.json new file mode 100644 index 00000000..12d7d189 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_bug-config.json @@ -0,0 +1,10 @@ +{ + "whiteSpace" : { + "before" : { + "MemberExpressionClosing" : 1 + }, + "after" : { + "MemberExpressionOpening" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_bug-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_bug-in.js new file mode 100644 index 00000000..ef6846c7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_bug-in.js @@ -0,0 +1,5 @@ +[]; + +this.element; + +parts = []; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_bug-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_bug-out.js new file mode 100644 index 00000000..ef6846c7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_bug-out.js @@ -0,0 +1,5 @@ +[]; + +this.element; + +parts = []; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-2-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-2-config.json new file mode 100644 index 00000000..8d7e215e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-2-config.json @@ -0,0 +1,24 @@ +{ + "whiteSpace" : { + "before" : { + "ArrayExpressionOpening" : 0, + "ArrayExpressionClosing" : 1 + }, + "after" : { + "ArrayExpressionOpening" : 1, + "ArrayExpressionClosing" : 0 + } + }, + "lineBreak" : { + "before" : { + "ArrayExpressionOpening" : ">=1", + "ArrayExpressionClosing" : 1, + "ArrayExpressionComma" : 1 + }, + "after" : { + "ArrayExpressionOpening" : 1, + "ArrayExpressionClosing" : 1, + "ArrayExpressionComma" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-2-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-2-in.js new file mode 100644 index 00000000..146f17ce --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-2-in.js @@ -0,0 +1,23 @@ +[ + +]; + +[1,2,3]; + +[1,2,[3,4,[5,6,[7,8,9]]]]; + +function fn(){ + // IMPORTANT: we can't break lines here because of ASI!!! + return [4,5,[6, 7 , 8 ]]; +} + +// issue #12 +var tuples = [ + // comment test + ["resolve", "done", "bla", "resolved"], + ["reject", "fail", "lorem", "rejected"], + [ +["lorem", "ipsum"] + ], + ["notify", "progress", "ipsum"] +]; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-2-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-2-out.js new file mode 100644 index 00000000..8a916342 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-2-out.js @@ -0,0 +1,95 @@ +[]; + +[ + 1 + , + 2 + , + 3 +] +; + +[ + 1 + , + 2 + , + [ + 3 + , + 4 + , + [ + 5 + , + 6 + , + [ + 7 + , + 8 + , + 9 + ] + ] + ] +] +; + +function fn() { + // IMPORTANT: we can't break lines here because of ASI!!! + return [ + 4 + , + 5 + , + [ + 6 + , + 7 + , + 8 + ] + ]; +} + +// issue #12 +var tuples = [ + // comment test + [ + "resolve" + , + "done" + , + "bla" + , + "resolved" + ] + , + [ + "reject" + , + "fail" + , + "lorem" + , + "rejected" + ] + , + [ + [ + "lorem" + , + "ipsum" + ] + ] + , + [ + "notify" + , + "progress" + , + "ipsum" + ] +] +; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-config.json new file mode 100644 index 00000000..617280c4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-config.json @@ -0,0 +1,26 @@ +{ + "whiteSpace" : { + "before" : { + "ArrayExpressionOpening" : 0, + "ArrayExpressionClosing" : 1, + "ArrayExpressionComma" : 1 + }, + "after" : { + "ArrayExpressionOpening" : 1, + "ArrayExpressionClosing" : 0, + "ArrayExpressionComma" : 0 + } + }, + "lineBreak" : { + "before" : { + "ArrayExpressionOpening" : -1, + "ArrayExpressionClosing" : -1, + "ArrayExpressionComma" : -1 + }, + "after" : { + "ArrayExpressionOpening" : -1, + "ArrayExpressionClosing" : -1, + "ArrayExpressionComma" : -1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-in.js new file mode 100644 index 00000000..fe0863cb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-in.js @@ -0,0 +1,22 @@ +[ + +]; + +[1,2,3]; + +[1,2,[3,4,[5,6,[7,8,9]]]]; + +function fn(){ + return [4,5,[6, 7 , 8 ]]; +} + +// issue #12 +var tuples = [ + // comment test + ["resolve", "done", "bla", "resolved"], + ["reject", "fail", "lorem", "rejected"], + [ +["lorem", "ipsum"] + ], + ["notify", "progress", "ipsum"] +]; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-out.js new file mode 100644 index 00000000..d0a3b9be --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/array_expression-out.js @@ -0,0 +1,20 @@ +[]; + +[ 1 ,2 ,3 ]; + +[ 1 ,2 ,[ 3 ,4 ,[ 5 ,6 ,[ 7 ,8 ,9 ] ] ] ]; + +function fn() { + return [ 4 ,5 ,[ 6 ,7 ,8 ] ]; +} + +// issue #12 +var tuples = [ + // comment test + [ "resolve" ,"done" ,"bla" ,"resolved" ] , + [ "reject" ,"fail" ,"lorem" ,"rejected" ] , + [ + [ "lorem" ,"ipsum" ] + ] , + [ "notify" ,"progress" ,"ipsum" ] +]; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/assignment_expression-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/assignment_expression-config.json new file mode 100644 index 00000000..7458a7e0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/assignment_expression-config.json @@ -0,0 +1,20 @@ +{ + "lineBreak" : { + "before" : { + "AssignmentExpression" : -1 + }, + "after" : { + "AssignmentExpression" : -1 + } + }, + "whiteSpace" : { + "before" : { + "AssignmentExpression" : 1, + "AssignmentOperator" : 0 + }, + "after" : { + "AssignmentOperator" : 0 + } + } +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/assignment_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/assignment_expression-in.js new file mode 100644 index 00000000..10b90f16 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/assignment_expression-in.js @@ -0,0 +1,4 @@ +// keep same line +foo=bar; lorem =123 +dolor = "amet" + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/assignment_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/assignment_expression-out.js new file mode 100644 index 00000000..b59773fd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/assignment_expression-out.js @@ -0,0 +1,4 @@ +// keep same line +foo=bar; lorem=123 +dolor="amet" + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent-config.json new file mode 100644 index 00000000..c3c4e7f2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent-config.json @@ -0,0 +1,32 @@ +{ + "indent" : { + "FunctionDeclaration" : 0 + }, + "lineBreak" : { + "before" : { + "FunctionDeclarationOpeningBrace" : 0, + "FunctionDeclarationClosingBrace" : 0, + "ReturnStatement" : 0 + }, + "after" : { + "FunctionDeclarationOpeningBrace" : 0, + "FunctionDeclarationClosingBrace" : ">= 0" + } + }, + "whiteSpace" : { + "before" : { + "ParameterList" : 1, + "ParameterComma" : 0, + "ParameterList" : 1, + "FunctionDeclarationOpeningBrace" : 0, + "FunctionDeclarationClosingBrace" : 1 + }, + "after" : { + "FunctionName" : 1, + "ParameterComma" : 0, + "ParameterList" : 1, + "FunctionDeclarationOpeningBrace" : 1 + } + } +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent-in.js new file mode 100644 index 00000000..a3f00c97 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent-in.js @@ -0,0 +1 @@ +function foo(x,y){return x+y;} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent-out.js new file mode 100644 index 00000000..1f068a3b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent-out.js @@ -0,0 +1 @@ +function foo ( x,y ){ return x + y; } diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent_2-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent_2-config.json new file mode 100644 index 00000000..c73837f4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent_2-config.json @@ -0,0 +1,14 @@ +{ + "lineBreak" : { + "before" : { + "FunctionDeclarationOpeningBrace" : 1, + "FunctionDeclarationClosingBrace" : 1, + "ReturnStatement" : 1 + }, + "after" : { + "FunctionDeclarationOpeningBrace" : 1, + "ReturnStatement" : 1 + } + } +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent_2-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent_2-in.js new file mode 100644 index 00000000..a3f00c97 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent_2-in.js @@ -0,0 +1 @@ +function foo(x,y){return x+y;} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent_2-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent_2-out.js new file mode 100644 index 00000000..7c4e9e50 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/basic_function_indent_2-out.js @@ -0,0 +1,4 @@ +function foo(x, y) +{ + return x + y; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/binary_expression-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/binary_expression-config.json new file mode 100644 index 00000000..410900ff --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/binary_expression-config.json @@ -0,0 +1,5 @@ +{ + "indent": { + "BinaryExpression": 1 + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/binary_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/binary_expression-in.js new file mode 100644 index 00000000..3959ad83 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/binary_expression-in.js @@ -0,0 +1,9 @@ +bar( +123 / +456 * +0.75 ^ +255 | +98 << +1 - +42 +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/binary_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/binary_expression-out.js new file mode 100644 index 00000000..49a8716b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/binary_expression-out.js @@ -0,0 +1,9 @@ +bar( + 123 / + 456 * + 0.75 ^ + 255 | + 98 << + 1 - + 42 +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/call_expression-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/call_expression-config.json new file mode 100644 index 00000000..096b5dc9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/call_expression-config.json @@ -0,0 +1,25 @@ +{ + "indent" : { + "MemberExpression" : 0 + }, + "lineBreak": { + "before": { + "ArgumentComma" : 0, + "CallExpression": ">=1" + }, + "after": { + "ArgumentComma" : 0, + "CallExpression": ">=1" + } + }, + "whiteSpace" : { + "before" : { + "ArgumentList" : 1, + "ArgumentComma" : 1 + }, + "after" : { + "ArgumentList" : 1, + "ArgumentComma" : 0 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/call_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/call_expression-in.js new file mode 100644 index 00000000..db0e02cd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/call_expression-in.js @@ -0,0 +1,27 @@ +foo(); + +bar(1,'dolor');ipsum(3,{amet:true},'foo'); + +dolor=foo(2) + +// should remove line breaks +foo(a,b, +c,d) + + +// it should indent chained calls if there is a line break between each call +foo.bar() + .ipsum() +.dolor(); + +function foo() { +dolor + .amet() + .maecennas(); +} + +returned.promise().done(foo) +.done(newDefer.resolve) +.fail(newDefer.reject) +.progress(newDefer.notify); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/call_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/call_expression-out.js new file mode 100644 index 00000000..c86b5b40 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/call_expression-out.js @@ -0,0 +1,29 @@ +foo(); + +bar( 1 ,'dolor' ); +ipsum( 3 ,{ + amet: true +} ,'foo' ); + +dolor = foo( 2 ) + +// should remove line breaks +foo( a ,b ,c ,d ) + + +// it should indent chained calls if there is a line break between each call +foo.bar() +.ipsum() +.dolor(); + +function foo() { + dolor + .amet() + .maecennas(); +} + +returned.promise().done( foo ) +.done( newDefer.resolve ) +.fail( newDefer.reject ) +.progress( newDefer.notify ); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/commented_config-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/commented_config-config.json new file mode 100644 index 00000000..53d3468e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/commented_config-config.json @@ -0,0 +1,20 @@ +/* + * This is an example of comments used on a config.json file + */ + +{ + // In this style guide we'll have curly brackets on next line :) + "lineBreak" : { + "before" : { + "IfStatementOpeningBrace" : 1 + } + }, + + // No whitespace between if statement and parenthesis + "whiteSpace" : { + "before" : { + "IfStatementConditionalOpening" : 0, + "IfStatementConditionalClosing" : 0 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/commented_config-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/commented_config-in.js new file mode 100644 index 00000000..754c77ff --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/commented_config-in.js @@ -0,0 +1 @@ +if(true){doStuff()} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/commented_config-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/commented_config-out.js new file mode 100644 index 00000000..dea0b92b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/commented_config-out.js @@ -0,0 +1,4 @@ +if(true) +{ + doStuff() +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/conditional_expression-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/conditional_expression-config.json new file mode 100644 index 00000000..d63944a9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/conditional_expression-config.json @@ -0,0 +1,15 @@ +{ + "indent": { + "ConditionalExpression": 0 + }, + "whiteSpace" : { + "before" : { + "ConditionalExpressionConsequent" : 0, + "ConditionalExpressionAlternate" : 0 + }, + "after" : { + "ConditionalExpressionConsequent" : 0, + "ConditionalExpressionTest" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/conditional_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/conditional_expression-in.js new file mode 100644 index 00000000..0f5ebd78 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/conditional_expression-in.js @@ -0,0 +1,10 @@ +// test the opposite of default settings +a?foo():bar(); + +b = (dolor!==amet) ? 'ipsum': 'dolor'; + +if(true){ +c = !a ?(!foo?d : function(){ + return a; +}):b; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/conditional_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/conditional_expression-out.js new file mode 100644 index 00000000..88bfd34f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/conditional_expression-out.js @@ -0,0 +1,10 @@ +// test the opposite of default settings +a ?foo():bar(); + +b = (dolor !== amet) ?'ipsum':'dolor'; + +if (true) { + c = !a ?(!foo ?d:function() { + return a; + }):b; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/expression_parentheses-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/expression_parentheses-config.json new file mode 100644 index 00000000..e9de7db5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/expression_parentheses-config.json @@ -0,0 +1,10 @@ +{ + "whiteSpace" : { + "before" : { + "ExpressionClosingParentheses" : 1 + }, + "after" : { + "ExpressionOpeningParentheses" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/expression_parentheses-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/expression_parentheses-in.js new file mode 100644 index 00000000..b278a575 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/expression_parentheses-in.js @@ -0,0 +1,44 @@ +;(++n<10); +; (a==b); +( c === d ); +x = (value / 10); +if (r * (x+1)+(y+2)) { + y = ("123"+"3456"); + // parseInt() is the "catch" on this case + z = ((q + w) / (parseInt('abc', 16) * (7) )) +} + + +// edge cases +// ========== + +// not a bynary expression or a ExpressionStatement +// VariableDeclaration > VariableDeclarator > [Identifier + Literal] +var foo = (123); + + +// SequenceExpression +madness = (weird,stuff),(45,56) + +;(bar()); +(function(){})(); +(function(){}()); + +function returnTest() { + return (x > 1); +} + +function returnTest2() { + return ( y + 1 ); +} + +function returnTest3(amount) { + return amount + " result" + (amount > 1 ? "s" : ""); +} + +function returnTest4() { + return (a || b < 0) && y(); +} + + +fn((1 + 3) + 4); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/expression_parentheses-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/expression_parentheses-out.js new file mode 100644 index 00000000..98713096 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/expression_parentheses-out.js @@ -0,0 +1,44 @@ +;( ++n < 10 ); +;( a == b ); +( c === d ); +x = ( value / 10 ); +if (r * ( x + 1 ) + ( y + 2 )) { + y = ( "123" + "3456" ); + // parseInt() is the "catch" on this case + z = ( ( q + w ) / ( parseInt('abc', 16) * ( 7 ) ) ) +} + + +// edge cases +// ========== + +// not a bynary expression or a ExpressionStatement +// VariableDeclaration > VariableDeclarator > [Identifier + Literal] +var foo = ( 123 ); + + +// SequenceExpression +madness = ( weird, stuff ), ( 45, 56 ) + +;( bar() ); +(function() {})(); +(function() {}()); + +function returnTest() { + return ( x > 1 ); +} + +function returnTest2() { + return ( y + 1 ); +} + +function returnTest3(amount) { + return amount + " result" + ( amount > 1 ? "s" : "" ); +} + +function returnTest4() { + return ( a || b < 0 ) && y(); +} + + +fn(( 1 + 3 ) + 4); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_in_statement-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_in_statement-config.json new file mode 100644 index 00000000..96273012 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_in_statement-config.json @@ -0,0 +1,15 @@ +{ + "lineBreak" : { + "before" : { + "ForInStatementOpeningBrace" : 1 + } + }, + "whiteSpace" : { + "before" : { + "ForInStatementExpressionClosing" : 1 + }, + "after" : { + "ForInStatementExpressionOpening" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_in_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_in_statement-in.js new file mode 100644 index 00000000..160927f6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_in_statement-in.js @@ -0,0 +1,29 @@ +for(key in obj){doFoo(obj[key]);} +// we do not remove line breaks! (we assume user knows what he is doing) +for( key + in obj )doFoo(obj[key]); + +for(var k in o){ +console.log(k, o[k]); +} + +for(key in obj ){ +for(prop in obj[key]) { +//indent +console.log(prop) +} +} + +// issue #13 : ForInStatement should not mess with inline object indent +function iss13() { + for (i in {submit : true, change : true, focusin : true}) { + console.log(i); + } +} + +// line breaks and weird spaces +for (key in obj) + + { + doFoo(obj[key]); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_in_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_in_statement-out.js new file mode 100644 index 00000000..aff8ecd4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_in_statement-out.js @@ -0,0 +1,35 @@ +for ( key in obj ) +{ + doFoo(obj[key]); +} +// we do not remove line breaks! (we assume user knows what he is doing) +for ( key + in obj ) doFoo(obj[key]); + +for ( var k in o ) +{ + console.log(k, o[k]); +} + +for ( key in obj ) +{ + for ( prop in obj[key] ) + { + //indent + console.log(prop) + } +} + +// issue #13 : ForInStatement should not mess with inline object indent +function iss13() { + for ( i in {submit: true, change: true, focusin: true} ) + { + console.log(i); + } +} + +// line breaks and weird spaces +for ( key in obj ) +{ + doFoo(obj[key]); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_statement-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_statement-config.json new file mode 100644 index 00000000..259f10ac --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_statement-config.json @@ -0,0 +1,10 @@ +{ + "whiteSpace" : { + "before" : { + "ForStatementExpressionClosing" : 1 + }, + "after" : { + "ForStatementExpressionOpening" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_statement-in.js new file mode 100644 index 00000000..c430ad15 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_statement-in.js @@ -0,0 +1,33 @@ +for (i=0; i 0; --j ) { + x(); + } +} + +for(;; ) { + x(); +} + +function foo() { + for (var c = this._bindings.length, d;c--;) + x += 1; + return -1; +} + +for ( i = 0;i< 10;i++) foo(); +for (i=10; i < 10; i++ ) + bar(); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_statement-out.js new file mode 100644 index 00000000..8ba50326 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/for_statement-out.js @@ -0,0 +1,35 @@ +for ( i = 0; i < n; ++i ) { + x(); +} + +for ( ; i < n; ++i ) { + x(); +} + +for ( ;; ++i ) { + x(); +} + +for ( i = 0;; ) { + x(); +} + +for ( ; i < n; ++i ) { + for ( ; j > 0; --j ) { + x(); + } +} + +for ( ;; ) { + x(); +} + +function foo() { + for ( var c = this._bindings.length, d; c--; ) + x += 1; + return -1; +} + +for ( i = 0; i < 10; i++ ) foo(); +for ( i = 10; i < 10; i++ ) + bar(); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/function-expression-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/function-expression-config.json new file mode 100644 index 00000000..fe3b9c16 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/function-expression-config.json @@ -0,0 +1,15 @@ +{ + "whiteSpace" : { + "before" : { + "FunctionName" : 1, + "FunctionExpressionOpeningBrace" : 1, + "FunctionExpressionClosingBrace" : 1 + }, + "after" : { + "FunctionReservedWord": 1, + "FunctionName" : 1, + "FunctionExpressionOpeningBrace" : 1, + "FunctionExpressionClosingBrace" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/function-expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/function-expression-in.js new file mode 100644 index 00000000..3d68f6cb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/function-expression-in.js @@ -0,0 +1,123 @@ +/** + * Function expressions as variables + */ + +// Anonymous function expression without body +var foo = function(){}; +var fooArg = function(a,b,c){}; + +// Named function expression without body +var bar = function bar(){}; +var barArg = function barArg(a,b,c){}; + +// Anonymous function expression with body +var baz = function(){something();}; +var bazArg = function(a,b,c){something();}; + +// Named function expression with body +var booz = function booz(a,b,c){something();}; +var boozArg = function boozArg(){something();}; + +/** + * Function expression as arguments + */ + +// Named function expression with body +call(function test(){something();}); +call(x,function test(){x();}); +call(function test(){x();},x); + +// Named function expression with body and arguments +call(function testArg(a,b,c){something();}); +call(x,function testArg(a,b,c){x();}); +call(function testArg(a,b,c){x();},x) + +// Named function expression without body and arguments +call(function test2(){}); +call(x,function test2(){}); +call(function test2(){},x); + +// Named function expression without body and with arguments +call(function test2Arg(a,b,c){}); +call(x,function test2Arg(a,b,c){}); +call(function test2Arg(a,b,c){},x); + + +// Anonymous function expression with body +call(function(){something();}); +call(x,function(){x();}); +call(function(){x();},x); + +// Anonymous function expression with body and arguments +call(function(a,b,c){something();}); +call(x,function(a,b,c){x();}); +call(function(a,b,c){x();},x); + +// Anonymous function expression without body and arguments +call(function(){}); +call(x,function(){}); +call(function(){},x); + +// Anonymous function expression without body and with arguments +call(function(a,b,c){}); +call(x,function(a,b,c){}); +call(function(a,b,c){},x); + +/** + * Function expression as object methods + */ + +var object = { + // Anonymous function expression without body + foo: function(){}, + fooArg: function(a,b,c){}, + + // Named function expression without body + bar: function bar(){}, + barArg: function barArg(a,b,c){}, + + // Anonymous function expression with body + baz: function(){something();}, + bazArg: function(a,b,c){something();}, + + // Named function expression with body + booz: function booz(a,b,c){something();}, + boozArg: function boozArg(){something();}, +}; + +/** + * Function expression immediate execution + */ + +// Anonymous function expression without body +(function(){})(); +(function(a,b,c){})(); + +// Named function expression without body +(function bar(){})(); +(function barArg(a,b,c){})(); + +// Anonymous function expression with body +(function(){something();})(); +(function(a,b,c){something();})(); + +// Named function expression with body +(function booz(a,b,c){something();})(); +(function boozArg(){something();})(); + + +// Anonymous function expression without body +(function(){}()); +(function(a,b,c){}()); + +// Named function expression without body +(function bar(){}()); +(function barArg(a,b,c){}()); + +// Anonymous function expression with body +(function(){something();}()); +(function(a,b,c){something();}()); + +// Named function expression with body +(function booz(a,b,c){something();}()); +(function boozArg(){something();}()); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/function-expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/function-expression-out.js new file mode 100644 index 00000000..120c0925 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/function-expression-out.js @@ -0,0 +1,179 @@ +/** + * Function expressions as variables + */ + +// Anonymous function expression without body +var foo = function () {}; +var fooArg = function (a, b, c) {}; + +// Named function expression without body +var bar = function bar () {}; +var barArg = function barArg (a, b, c) {}; + +// Anonymous function expression with body +var baz = function () { + something(); +}; +var bazArg = function (a, b, c) { + something(); +}; + +// Named function expression with body +var booz = function booz (a, b, c) { + something(); +}; +var boozArg = function boozArg () { + something(); +}; + +/** + * Function expression as arguments + */ + +// Named function expression with body +call(function test () { + something(); +}); +call(x, function test () { + x(); +}); +call(function test () { + x(); +}, x); + +// Named function expression with body and arguments +call(function testArg (a, b, c) { + something(); +}); +call(x, function testArg (a, b, c) { + x(); +}); +call(function testArg (a, b, c) { + x(); +}, x) + +// Named function expression without body and arguments +call(function test2 () {}); +call(x, function test2 () {}); +call(function test2 () {}, x); + +// Named function expression without body and with arguments +call(function test2Arg (a, b, c) {}); +call(x, function test2Arg (a, b, c) {}); +call(function test2Arg (a, b, c) {}, x); + + +// Anonymous function expression with body +call(function () { + something(); +}); +call(x, function () { + x(); +}); +call(function () { + x(); +}, x); + +// Anonymous function expression with body and arguments +call(function (a, b, c) { + something(); +}); +call(x, function (a, b, c) { + x(); +}); +call(function (a, b, c) { + x(); +}, x); + +// Anonymous function expression without body and arguments +call(function () {}); +call(x, function () {}); +call(function () {}, x); + +// Anonymous function expression without body and with arguments +call(function (a, b, c) {}); +call(x, function (a, b, c) {}); +call(function (a, b, c) {}, x); + +/** + * Function expression as object methods + */ + +var object = { + // Anonymous function expression without body + foo: function () {}, + fooArg: function (a, b, c) {}, + + // Named function expression without body + bar: function bar () {}, + barArg: function barArg (a, b, c) {}, + + // Anonymous function expression with body + baz: function () { + something(); + }, + bazArg: function (a, b, c) { + something(); + }, + + // Named function expression with body + booz: function booz (a, b, c) { + something(); + }, + boozArg: function boozArg () { + something(); + }, +}; + +/** + * Function expression immediate execution + */ + +// Anonymous function expression without body +(function () {})(); +(function (a, b, c) {})(); + +// Named function expression without body +(function bar () {})(); +(function barArg (a, b, c) {})(); + +// Anonymous function expression with body +(function () { + something(); +})(); +(function (a, b, c) { + something(); +})(); + +// Named function expression with body +(function booz (a, b, c) { + something(); +})(); +(function boozArg () { + something(); +})(); + + +// Anonymous function expression without body +(function () {}()); +(function (a, b, c) {}()); + +// Named function expression without body +(function bar () {}()); +(function barArg (a, b, c) {}()); + +// Anonymous function expression with body +(function () { + something(); +}()); +(function (a, b, c) { + something(); +}()); + +// Named function expression with body +(function booz (a, b, c) { + something(); +}()); +(function boozArg () { + something(); +}()); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement-config.json new file mode 100644 index 00000000..5524ce07 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement-config.json @@ -0,0 +1,28 @@ +{ + "lineBreak" : { + "before" : { + "IfStatement": ">=1", + "ElseStatement" : 1, + "ElseIfStatement" : 1, + "IfStatementOpeningBrace" : 1, + "ElseStatementOpeningBrace" : 1, + "ElseIfStatementOpeningBrace" : 1, + "LineComment": -1 + }, + "after": { + "IfStatementOpeningBrace" : 1, + "ElseStatementOpeningBrace" : 1 + } + }, + + "whiteSpace" : { + "before" : { + "IfStatementConditionalOpening" : 0, + "IfStatementConditionalClosing" : 0 + }, + "after" : { + "IfStatementConditionalOpening" : 0, + "IfStatementConditionalClosing" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement-in.js new file mode 100644 index 00000000..8ea74e26 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement-in.js @@ -0,0 +1,48 @@ +if(true){doStuff()} + +if( foo ||bar ){ if (bar === 'bar'){ + // nested +log('nested if'); } else { log('nested else') +} } +else if (baz==null) +{ + // else if +log('elseif'); +}else{ + // else + log('else'); +// should keep the 2 empty lines + + +} + +if( singleLine )singleLine(); + + +// it's a trap! +if (asi && noBraces) +dolor() +else + amet(); + + + +// issue #34 (break line comment into individual line) +if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); +} else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); +} + + +// issue #196 +if (a) + a(); // run a +else if (b) + b(); // run b +else { + c(); // run c +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement-out.js new file mode 100644 index 00000000..a2da4df8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement-out.js @@ -0,0 +1,65 @@ +if(true) +{ + doStuff() +} + +if(foo || bar) +{ + if(bar === 'bar') + { + // nested + log('nested if'); + } + else + { + log('nested else') + } +} +else if(baz == null) +{ + // else if + log('elseif'); +} +else +{ + // else + log('else'); + // should keep the 2 empty lines + + +} + +if(singleLine) singleLine(); + + +// it's a trap! +if(asi && noBraces) + dolor() +else + amet(); + + + +// issue #34 (break line comment into individual line) +if(window.DOMParser) +{ // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString(data, "text/xml"); +} +else +{ // IE + xml = new ActiveXObject("Microsoft.XMLDOM"); + xml.async = "false"; + xml.loadXML(data); +} + + +// issue #196 +if(a) + a(); // run a +else if(b) + b(); // run b +else +{ + c(); // run c +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement_spacy-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement_spacy-config.json new file mode 100644 index 00000000..c7a52787 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement_spacy-config.json @@ -0,0 +1,12 @@ +{ + "whiteSpace" : { + "before" : { + "IfStatementConditionalOpening" : 1, + "IfStatementConditionalClosing" : 1 + }, + "after" : { + "IfStatementConditionalOpening" : 1, + "IfStatementConditionalClosing" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement_spacy-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement_spacy-in.js new file mode 100644 index 00000000..629b68b9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement_spacy-in.js @@ -0,0 +1,27 @@ +if(true){doStuff()} + +if( foo ||bar ){ if (bar === 'bar'){ + // nested +log('nested if'); } else { log('nested else') +} } +else if (baz==null) +{ + // else if +log('elseif'); +}else{ + // else + log('else'); +// should keep the 2 empty lines + + +} + +if( singleLine )singleLine(); + + +// it's a trap! +if (asi && noBraces) +dolor() +else + amet(); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement_spacy-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement_spacy-out.js new file mode 100644 index 00000000..2d263319 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/if_statement_spacy-out.js @@ -0,0 +1,31 @@ +if ( true ) { + doStuff() +} + +if ( foo || bar ) { + if ( bar === 'bar' ) { + // nested + log('nested if'); + } else { + log('nested else') + } +} else if ( baz == null ) { + // else if + log('elseif'); +} else { + // else + log('else'); + // should keep the 2 empty lines + + +} + +if ( singleLine ) singleLine(); + + +// it's a trap! +if ( asi && noBraces ) + dolor() +else + amet(); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/iife-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/iife-config.json new file mode 100644 index 00000000..90a41054 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/iife-config.json @@ -0,0 +1,14 @@ +{ + "whiteSpace": { + "before": { + "ArgumentList": 1, + "IIFEClosingParentheses": 1, + "ParameterList": 1 + }, + "after": { + "ArgumentList": 1, + "IIFEOpeningParentheses": 1, + "ParameterList": 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/iife-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/iife-in.js new file mode 100644 index 00000000..516b5424 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/iife-in.js @@ -0,0 +1,14 @@ +// issue #223 +(function() { +var x = 1; +foo(bar(), baz()); +}()); + +// issue #250 +(function( $ ) { +x; +}( jQuery )); + +;!function(x){ +console.log(x) +}('bar') diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/iife-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/iife-out.js new file mode 100644 index 00000000..cab2f056 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/iife-out.js @@ -0,0 +1,14 @@ +// issue #223 +( function() { + var x = 1; + foo( bar(), baz() ); +}() ); + +// issue #250 +( function( $ ) { + x; +}( jQuery ) ); + +;!function( x ) { + console.log( x ) +}( 'bar' ) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-2-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-2-config.json new file mode 100644 index 00000000..ce4487cd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-2-config.json @@ -0,0 +1,7 @@ +{ + "lineBreak" : { + "before" : { + "EndOfFile" : 5 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-2-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-2-in.js new file mode 100644 index 00000000..63a9aa37 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-2-in.js @@ -0,0 +1 @@ +// This file does have a linebreak before eof, but should not after running esformatter diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-2-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-2-out.js new file mode 100644 index 00000000..c465a8ea --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-2-out.js @@ -0,0 +1,5 @@ +// This file does have a linebreak before eof, but should not after running esformatter + + + + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-config.json new file mode 100644 index 00000000..b52af537 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-config.json @@ -0,0 +1,7 @@ +{ + "lineBreak" : { + "before" : { + "EndOfFile" : 0 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-in.js new file mode 100644 index 00000000..63a9aa37 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-in.js @@ -0,0 +1 @@ +// This file does have a linebreak before eof, but should not after running esformatter diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-out.js new file mode 100644 index 00000000..6c7eadf8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/linebreak-before-eof-out.js @@ -0,0 +1 @@ +// This file does have a linebreak before eof, but should not after running esformatter \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/member_expression-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/member_expression-config.json new file mode 100644 index 00000000..9f3d075d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/member_expression-config.json @@ -0,0 +1,10 @@ +{ + "whiteSpace" : { + "before" : { + "MemberExpressionClosing" : 1 + }, + "after" : { + "MemberExpressionOpening" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/member_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/member_expression-in.js new file mode 100644 index 00000000..26de6ede --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/member_expression-in.js @@ -0,0 +1,4 @@ +obj[prop]; + +// also a MemberExpression +proxy.guid = fn.guid; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/member_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/member_expression-out.js new file mode 100644 index 00000000..31324f94 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/member_expression-out.js @@ -0,0 +1,4 @@ +obj[ prop ]; + +// also a MemberExpression +proxy.guid = fn.guid; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/multi-indent-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/multi-indent-config.json new file mode 100644 index 00000000..e5c9603a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/multi-indent-config.json @@ -0,0 +1,6 @@ +{ + "indent": { + "FunctionDeclaration": 8, + "MultipleVariableDeclaration": 2 + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/multi-indent-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/multi-indent-in.js new file mode 100644 index 00000000..ee210492 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/multi-indent-in.js @@ -0,0 +1,12 @@ +function foo() { + bar({ + ipsum: 'dolor' + }); + + function amet() { + return 123; + } +} + +var foo = 123, + bar = 'baz'; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/multi-indent-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/multi-indent-out.js new file mode 100644 index 00000000..acc290a2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/multi-indent-out.js @@ -0,0 +1,12 @@ +function foo() { + bar({ + ipsum: 'dolor' + }); + + function amet() { + return 123; + } +} + +var foo = 123, + bar = 'baz'; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/negative_indent-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/negative_indent-config.json new file mode 100644 index 00000000..6db69006 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/negative_indent-config.json @@ -0,0 +1,8 @@ +{ + "indent": { + // yes, you can set negative values. "0" is the real noop. + "ObjectExpression": -1, + "ArrayExpression": -2, + "IfStatement": 0 + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/negative_indent-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/negative_indent-in.js new file mode 100644 index 00000000..2a069943 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/negative_indent-in.js @@ -0,0 +1,17 @@ +function foo() { +function dolor(bar) { +var arr = []; +if (bar) { +arr = [ +'weird', +'indent' +]; +obj = { +'yes': 'i know it\'s weird', +'but': 'it tests the rocambole-indent negative rule' +} +} +return arr; +} +return dolor; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/negative_indent-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/negative_indent-out.js new file mode 100644 index 00000000..d3fd5e6e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/negative_indent-out.js @@ -0,0 +1,17 @@ +function foo() { + function dolor(bar) { + var arr = []; + if (bar) { + arr = [ +'weird', +'indent' + ]; + obj = { + 'yes': 'i know it\'s weird', + 'but': 'it tests the rocambole-indent negative rule' + } + } + return arr; + } + return dolor; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-2-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-2-config.json new file mode 100644 index 00000000..2f149cb0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-2-config.json @@ -0,0 +1,19 @@ +{ + "lineBreak": { + "before": { + "PropertyName": 0, + "PropertyValue": 1 + }, + + "after": { + "PropertyName": 1, + "PropertyValue": 1 + } + }, + + "whiteSpace": { + "before": { + "PropertyName": 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-2-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-2-in.js new file mode 100644 index 00000000..401b3ffc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-2-in.js @@ -0,0 +1,5 @@ +var a = { + foo:123, + "bar":"baz" + , 'lorem': new Date() +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-2-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-2-out.js new file mode 100644 index 00000000..ad5b9c66 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-2-out.js @@ -0,0 +1,10 @@ +var a = { foo + : + 123 + , "bar" + : + "baz" + , 'lorem' + : + new Date() +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-3-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-3-config.json new file mode 100644 index 00000000..799a5d76 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-3-config.json @@ -0,0 +1,24 @@ +{ + "lineBreak" : { + "before" : { + "ObjectExpressionOpeningBrace": -1, + "ObjectExpressionClosingBrace": -1, + "Property": -1 + }, + + "after": { + "ObjectExpressionOpeningBrace": -1, + "ObjectExpressionClosingBrace": -1, + "Property": -1 + } + }, + + "whiteSpace" : { + "before": { + "ObjectExpressionClosingBrace": 1 + }, + "after" : { + "PropertyValue": -1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-3-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-3-in.js new file mode 100644 index 00000000..91ac6dd7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-3-in.js @@ -0,0 +1,20 @@ +x({ a:1}); +y({ +a: 1 +}); +$.each({ div: "#list1", ul: "#navigation", dl: "#accordion-dl" }); + +var x ={ foo:{ bar: true} }; +var y= {a: b, c:d, e:{ f: g } }; +x = { + props: { + // comment + x: 1 + } +}; +x = { +b: function b() { +a(); +}, +a: b +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-3-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-3-out.js new file mode 100644 index 00000000..e4f9326c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-3-out.js @@ -0,0 +1,20 @@ +x({ a: 1 }); +y({ + a: 1 +}); +$.each({ div: "#list1", ul: "#navigation", dl: "#accordion-dl" }); + +var x = { foo: { bar: true } }; +var y = { a: b, c: d, e: { f: g } }; +x = { + props: { + // comment + x: 1 + } +}; +x = { + b: function b() { + a(); + }, + a: b +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-config.json new file mode 100644 index 00000000..d02d13ad --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-config.json @@ -0,0 +1,7 @@ +{ + "whiteSpace" : { + "after" : { + "PropertyName" : 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-in.js new file mode 100644 index 00000000..300c5860 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-in.js @@ -0,0 +1,41 @@ +foo.bar.Baz( { + method2: function () {}, prop : 'dolor amet' + , prop2 : 123 +}); + + +function foo(a){ amet(123, a, {flag:true}); } +ipsum({flag:true}); +ipsum({flag:true,other:false}); +ipsum({flag:true,other:false},789,'bar'); + + +var obj = {foo:"bar", 'lorem' : 123, + dolor :new Date() +, "re": /\w+/g} ; + +// ObjectEpression within CallExpression needs to indent comments +declare({ +// comment +create: {} +}); + +this.element +.add() +.set({ +// line comment +// one more +prop: "value" +}); + +define( name, { +_create: function() { +this.element +.add() +.set({ +// line comment +// one more +prop: "value" +}); +} +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-out.js new file mode 100644 index 00000000..3e780786 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/object_expression-out.js @@ -0,0 +1,57 @@ +foo.bar.Baz({ + method2 : function() {}, + prop : 'dolor amet', + prop2 : 123 +}); + + +function foo(a) { + amet(123, a, { + flag : true + }); +} +ipsum({ + flag : true +}); +ipsum({ + flag : true, + other : false +}); +ipsum({ + flag : true, + other : false +}, 789, 'bar'); + + +var obj = { + foo : "bar", + 'lorem' : 123, + dolor : new Date(), + "re" : /\w+/g +}; + +// ObjectEpression within CallExpression needs to indent comments +declare({ + // comment + create : {} +}); + +this.element + .add() + .set({ + // line comment + // one more + prop : "value" + }); + +define(name, { + _create : function() { + this.element + .add() + .set({ + // line comment + // one more + prop : "value" + }); + } +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/one-line-var-declaration-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/one-line-var-declaration-config.json new file mode 100644 index 00000000..d236d829 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/one-line-var-declaration-config.json @@ -0,0 +1,7 @@ +{ + "lineBreak" : { + "before" : { + "VariableDeclarationWithoutInit" : 0 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/one-line-var-declaration-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/one-line-var-declaration-in.js new file mode 100644 index 00000000..9c14ea88 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/one-line-var-declaration-in.js @@ -0,0 +1,6 @@ +var var1, var2, + var3 = [], + var4 = {}, + var5 = [var1, var2, var3]; + +var x, y, z; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/one-line-var-declaration-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/one-line-var-declaration-out.js new file mode 100644 index 00000000..28899b65 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/one-line-var-declaration-out.js @@ -0,0 +1,6 @@ +var var1, var2, + var3 = [], + var4 = {}, + var5 = [var1, var2, var3]; + +var x, y, z; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/switch_statement-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/switch_statement-config.json new file mode 100644 index 00000000..8a428e4d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/switch_statement-config.json @@ -0,0 +1,25 @@ +{ + "indent" : { + "SwitchStatement" : 0, + "SwitchCase": 1 + }, + "whiteSpace" : { + "before" : { + "SwitchDiscriminantClosing" : 1 + }, + "after" : { + "SwitchDiscriminantOpening" : 1 + } + }, + "lineBreak": { + "before": { + "SwitchOpeningBrace": 1, + "SwitchClosingBrace": 1 + }, + "after": { + "BreakKeyword": 2, + "SwitchOpeningBrace": 1, + "SwitchClosingBrace": ">= 0" + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/switch_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/switch_statement-in.js new file mode 100644 index 00000000..420904b9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/switch_statement-in.js @@ -0,0 +1,23 @@ +switch ( event.keyCode ) { + case $.ui.keyCode.ENTER: + case $.ui.keyCode.SPACE: + // line comment + z(); + break + case $.ui.keyCode.ESCAPE: + y(); + break; + default: + x(); +} + +call(function(){ + switch (fruit) { + case Fruit.APPLE: + // line comment + exotic(); + break; + default: + unknown(); + } +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/switch_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/switch_statement-out.js new file mode 100644 index 00000000..3ca77863 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/switch_statement-out.js @@ -0,0 +1,28 @@ +switch ( event.keyCode ) +{ +case $.ui.keyCode.ENTER: +case $.ui.keyCode.SPACE: + // line comment + z(); + break + +case $.ui.keyCode.ESCAPE: + y(); + break; + +default: + x(); +} + +call(function() { + switch ( fruit ) + { + case Fruit.APPLE: + // line comment + exotic(); + break; + + default: + unknown(); + } +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/top-level-indent-exception-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/top-level-indent-exception-config.json new file mode 100644 index 00000000..8c3903ce --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/top-level-indent-exception-config.json @@ -0,0 +1,5 @@ +{ + "indent" : { + "TopLevelFunctionBlock" : 0 + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/top-level-indent-exception-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/top-level-indent-exception-in.js new file mode 100644 index 00000000..7b53e5be --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/top-level-indent-exception-in.js @@ -0,0 +1,40 @@ +(function() { + + // top level block isn't indented + var x = 123; + + setTimeout(function() { + x(); + }); + +}()); + +// don't mess up other code outside a function scope +var x = { + abc: 123 +}; + +module.exports = function() { + + var x = 123; + +}; + +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./core", + "./widget" + ], factory ); + } else { + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + return $.widget( "ui.accordion", { + version: "@VERSION", + options: {} + }); +})); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/top-level-indent-exception-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/top-level-indent-exception-out.js new file mode 100644 index 00000000..56c24095 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/top-level-indent-exception-out.js @@ -0,0 +1,40 @@ +(function() { + +// top level block isn't indented +var x = 123; + +setTimeout(function() { + x(); +}); + +}()); + +// don't mess up other code outside a function scope +var x = { + abc: 123 +}; + +module.exports = function() { + +var x = 123; + +}; + +(function(factory) { + if (typeof define === "function" && define.amd) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./core", + "./widget" + ], factory); + } else { + // Browser globals + factory(jQuery); + } +}(function($) { +return $.widget("ui.accordion", { + version: "@VERSION", + options: {} +}); +})); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/try_statement-config.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/try_statement-config.json new file mode 100644 index 00000000..e36f67d6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/try_statement-config.json @@ -0,0 +1,53 @@ +{ + "indent": { + "CatchClause": 1, + "TryStatement": 1 + }, + + "lineBreak": { + "before": { + "CatchOpeningBrace": 1, + "CatchClosingBrace": ">=1", + "CatchKeyword": 1, + "FinallyKeyword": 1, + "FinallyOpeningBrace": 1, + "FinallyClosingBrace": ">=1", + "TryOpeningBrace": 1, + "TryClosingBrace": ">=1" + }, + + "after": { + "CatchOpeningBrace": ">=1", + "CatchClosingBrace": ">=0", + "CatchKeyword": 0, + "FinallyOpeningBrace": ">=1", + "FinallyClosingBrace": ">=1", + "TryOpeningBrace": ">=1", + "TryClosingBrace": 1 + } + }, + + "whiteSpace": { + "before": { + "CatchParameterList": 0, + "CatchOpeningBrace": 1, + "CatchClosingBrace": 1, + "CatchKeyword": 1, + "FinallyOpeningBrace": 1, + "FinallyClosingBrace": 1, + "TryOpeningBrace": 1, + "TryClosingBrace": 1 + }, + + "after": { + "CatchParameterList": 0, + "CatchOpeningBrace": 1, + "CatchClosingBrace": 1, + "CatchKeyword": 1, + "FinallyOpeningBrace": 1, + "FinallyClosingBrace": 1, + "TryOpeningBrace": 1, + "TryClosingBrace": 1 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/try_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/try_statement-in.js new file mode 100644 index 00000000..124578dc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/try_statement-in.js @@ -0,0 +1,97 @@ +try{foo()} catch (e){ log(e) +} + +try +{ +// foo comment + foo(); +} +finally +{ + // bar comment + bar(); + } + +try{foo()} catch (e){ log(e) + } finally { + bar() + } + +try { + bar( "foo" ); +} catch ( e ) { + // Empty Catch comment +} + + +// issue #35: "catch" block indent + empty catch body +jQuery.ready.promise = function( obj ) { + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} +}; + +// "catch" brace indent +function issueNN( obj ) { + try { + x = y; + } catch (e) { + console.log(e); + } +} + +// "finally" brace indent +function foo(obj) { + try { + top = window.frameElement == null && document.documentElement; + } catch (e) { + console.log(e); + } finally { + // finally a comment + top = 0; + // weird + } +} + +jQuery.ready.promise = function( obj ) { +try{ +// try 2 +top = window.frameElement == null && document.documentElement; +// try after 2 +}catch(e){ +// catch 2 +console.log(e); +// catch after 2 +}finally{ +// finally a comment 2 +top = 0; +// finally after 2 +} +}; + +// nested try-catch +function nestedTryCatch() { + try{ + normalPath(); + }catch(e) { + try { + // try + alternatePath(); + // just a little bit harder + } catch(e){ + // catch + console.log(e); + // if you can + }finally{} + }finally{ shouldBreak = true; } next(); +} + +// line break handling (#128) +try { + doStuff() +} +catch + (e) +{ + yesThisIsWeird() +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/try_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/try_statement-out.js new file mode 100644 index 00000000..6d107062 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/custom/try_statement-out.js @@ -0,0 +1,143 @@ +try +{ + foo() +} +catch (e) +{ + log(e) +} + +try +{ + // foo comment + foo(); +} +finally +{ + // bar comment + bar(); +} + +try +{ + foo() +} +catch (e) +{ + log(e) +} +finally +{ + bar() +} + +try +{ + bar("foo"); +} +catch (e) +{ + // Empty Catch comment +} + + +// issue #35: "catch" block indent + empty catch body +jQuery.ready.promise = function(obj) { + try + { + top = window.frameElement == null && document.documentElement; + } + catch (e) + {} +}; + +// "catch" brace indent +function issueNN(obj) { + try + { + x = y; + } + catch (e) + { + console.log(e); + } +} + +// "finally" brace indent +function foo(obj) { + try + { + top = window.frameElement == null && document.documentElement; + } + catch (e) + { + console.log(e); + } + finally + { + // finally a comment + top = 0; + // weird + } +} + +jQuery.ready.promise = function(obj) { + try + { + // try 2 + top = window.frameElement == null && document.documentElement; + // try after 2 + } + catch (e) + { + // catch 2 + console.log(e); + // catch after 2 + } + finally + { + // finally a comment 2 + top = 0; + // finally after 2 + } +}; + +// nested try-catch +function nestedTryCatch() { + try + { + normalPath(); + } + catch (e) + { + try + { + // try + alternatePath(); + // just a little bit harder + } + catch (e) + { + // catch + console.log(e); + // if you can + } + finally + {} + } + finally + { + shouldBreak = true; + } + next(); +} + +// line break handling (#128) +try +{ + doStuff() +} +catch (e) +{ + yesThisIsWeird() +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/README.md b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/README.md new file mode 100644 index 00000000..034252a5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/README.md @@ -0,0 +1,11 @@ +# default settings tests + +These files are used to test the default settings. + +The default settings should be as *conservative* as possible, [Google +JavaScript Style +Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml) +should be used as a reference. + +`foo_bar-in.js` will be used as input and will be compared with `foo_bar-out.js`. + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/array_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/array_expression-in.js new file mode 100644 index 00000000..5351470c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/array_expression-in.js @@ -0,0 +1,70 @@ +[ + +]; + +[1,2,3]; + +[1,2,[3,4,[5,6,[7,8,9]]]]; + +function fn(){ + return [4,5,[6, 7 , 8 ]]; +} + +// issue #12 +var tuples = [ + // comment test + ["resolve", "done", "bla", "resolved"], + ["reject", "fail", "lorem", "rejected"], + [ +["lorem", "ipsum"] + ], +["notify", "progress", "ipsum"] +]; + +var x, + y = [ + "a", + "b", + "c" + ]; + +// rocambole issue with sparse arrays +;[,3,[,4]]; +// sparse arrays indentation is tricky! +;[ +, +3, +[,, +, +4 +]]; +;[ +, +3, +[, +4 +] +]; + +// issue #165 (MemberExpression) +[ + "grunt-contrib-concat", + "grunt-contrib-watch", + "grunt-contrib-jshint", + "grunt-contrib-qunit" +].forEach(function( task ) { + grunt.loadNpmTasks( task ); +}); + +// issue #224 +var fa = [ { +foo: 'bar', +baz: 'yak' +}, { +foo: '1', +baz: '2' +} ]; + +// issue #239 +var data = [1, +2]; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/array_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/array_expression-out.js new file mode 100644 index 00000000..c96a60a0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/array_expression-out.js @@ -0,0 +1,68 @@ +[]; + +[1, 2, 3]; + +[1, 2, [3, 4, [5, 6, [7, 8, 9]]]]; + +function fn() { + return [4, 5, [6, 7, 8]]; +} + +// issue #12 +var tuples = [ + // comment test + ["resolve", "done", "bla", "resolved"], + ["reject", "fail", "lorem", "rejected"], + [ + ["lorem", "ipsum"] + ], + ["notify", "progress", "ipsum"] +]; + +var x, + y = [ + "a", + "b", + "c" + ]; + +// rocambole issue with sparse arrays +;[, 3, [, 4]]; +// sparse arrays indentation is tricky! +;[ + , + 3, + [,, + , + 4 + ]]; +;[ + , + 3, + [, + 4 + ] +]; + +// issue #165 (MemberExpression) +[ + "grunt-contrib-concat", + "grunt-contrib-watch", + "grunt-contrib-jshint", + "grunt-contrib-qunit" +].forEach(function(task) { + grunt.loadNpmTasks(task); +}); + +// issue #224 +var fa = [{ + foo: 'bar', + baz: 'yak' +}, { + foo: '1', + baz: '2' +}]; + +// issue #239 +var data = [1, + 2]; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/arrow_function_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/arrow_function_expression-in.js new file mode 100644 index 00000000..57a4f9b0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/arrow_function_expression-in.js @@ -0,0 +1,15 @@ +arr.map(a=>a*2); +arr.map(b => {return b * 2;}); +arr.map(( c,i )=>{ +return c * i; +}); +arr.map(d => + {return d * 2;}); + arr.map( ( e , f , g) + => + e * f - g ); + +// default params (#285) +let defaultParams = (x, y = 1, z = 2 ) => { + return x + y + z; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/arrow_function_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/arrow_function_expression-out.js new file mode 100644 index 00000000..cde9bf37 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/arrow_function_expression-out.js @@ -0,0 +1,16 @@ +arr.map(a => a * 2); +arr.map(b => { + return b * 2; +}); +arr.map((c, i) => { + return c * i; +}); +arr.map(d => { + return d * 2; +}); +arr.map((e, f, g) => e * f - g); + +// default params (#285) +let defaultParams = (x, y = 1, z = 2) => { + return x + y + z; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/assignment_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/assignment_expression-in.js new file mode 100644 index 00000000..052edc85 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/assignment_expression-in.js @@ -0,0 +1,48 @@ +foo=bar; lorem =123 +dolor = "amet" + +// yes, this is valid JS +maecennas + ++= + + "ullamcor" +// end multi-line + + +foo = fn(1); + + +// assignment operators + +x+= y +x -= y +x *= y +x /= y +x%= y +x<<= y +x >>= y +x + >>>= + y +x&= y +x^=y +x|=y + + +// multiple same line +this.a=b;this.c=d;this.e=f;this.g=h||0; + +function h(a,b,c,d,e){this._listener=b;this._isOnce=c;this.context=d;this._signal=a;this._priority=e||0} + + +// test for issue #5 (related to parenthesis) +doc=(context&&context.nodeType?context.ownerDocument||context:document); + + +// issue #8 (multiple assignment + OR + indent) +function iss8(){ + if (proxy) { + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/assignment_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/assignment_expression-out.js new file mode 100644 index 00000000..9173fffe --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/assignment_expression-out.js @@ -0,0 +1,52 @@ +foo = bar; +lorem = 123 +dolor = "amet" + +// yes, this is valid JS +maecennas += "ullamcor" +// end multi-line + + +foo = fn(1); + + +// assignment operators + +x += y +x -= y +x *= y +x /= y +x %= y +x <<= y +x >>= y +x >>>= y +x &= y +x ^= y +x |= y + + +// multiple same line +this.a = b; +this.c = d; +this.e = f; +this.g = h || 0; + +function h(a, b, c, d, e) { + this._listener = b; + this._isOnce = c; + this.context = d; + this._signal = a; + this._priority = e || 0 +} + + +// test for issue #5 (related to parenthesis) +doc = (context && context.nodeType ? context.ownerDocument || context : document); + + +// issue #8 (multiple assignment + OR + indent) +function iss8() { + if (proxy) { + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/binary_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/binary_expression-in.js new file mode 100644 index 00000000..083f6c5d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/binary_expression-in.js @@ -0,0 +1,48 @@ +1.33>>>0 +foo >> 3 ; +2+ 2 +3 * 1; +3<<1 +12 | 255 +12^ 255 +;(++n<10); + +// trailing + 27&64 ; +15 % 5 + +// asi and ExpressionStatement +foo>bar +a < b +;(a==b); +( a === b ); +a<= b +3.25 >=b + +// issue #212 +var str = '' + +v1 + +'x' + +// ~~(xx.time/60) + +xx.time + +'min'; + +msg = 'lorem' + +'ipsum' + +'dolor' + +// sit +'amet' + +bar( +123 / +456 * +0.75 ^ +255 | +98 << +1 - +42 +); + +log("foo" + +"bar" +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/binary_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/binary_expression-out.js new file mode 100644 index 00000000..dce90455 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/binary_expression-out.js @@ -0,0 +1,48 @@ +1.33 >>> 0 +foo >> 3; +2 + 2 +3 * 1; +3 << 1 +12 | 255 +12 ^ 255 +;(++n < 10); + +// trailing +27 & 64; +15 % 5 + +// asi and ExpressionStatement +foo > bar +a < b +;(a == b); +(a === b); +a <= b +3.25 >= b + +// issue #212 +var str = '' + + v1 + + 'x' + + // ~~(xx.time/60) + + xx.time + + 'min'; + +msg = 'lorem' + + 'ipsum' + + 'dolor' + + // sit + 'amet' + +bar( + 123 / + 456 * + 0.75 ^ + 255 | + 98 << + 1 - + 42 +); + +log("foo" + + "bar" +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/call_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/call_expression-in.js new file mode 100644 index 00000000..bdb6b5fc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/call_expression-in.js @@ -0,0 +1,156 @@ +foo(); +baz(); + +bar(1,'dolor'); +ipsum(3,{amet:true},'foo'); + +dolor=foo(2) + +// should not remove line breaks +foo(a,b, +c,d) + +tricky( (123) ); +tricky2( (123) , ((456)) ); + +// it should indent chained calls if there is a line break between each call +foo.bar() + // comment + .ipsum() +.dolor(); + +function foo() { +dolor + // comment + .amet() + .maecennas(); +} + +contents = this.headers.next() + .removeClass("ui-helper-reset ui-widget-content ui-corner-bottom " + + "ui-accordion-content ui-accordion-content-active ui-state-disabled") + .css("display", "") + .removeAttr("role"); + +returned.promise().done(foo) +// comment +.done(newDefer.resolve) +.fail(newDefer.reject) +// comment +.progress(newDefer.notify); + +filter(function() { +// comment +x; +}).map(function() { +// comment +y; +}); + +var contents; +contents = this.headers.next() +.removeClass("ui-state-disabled") +.css("display", ""); + +gulp.task('lint', function() { +return gulp.src('**.js') +.pipe(jshint()) +.pipe(jshint.reporter(stylish)); +}); + +// issue #68 +define(function() { + // line comment + x; +}); + + +noArgs( + ); + +noArgs2( ); +noArgs3(); +noArgs4( + // not passing any args for some reason +); + + +// only indent if there is a line break before/between arguments +indent( +'foo' +); + +indent2({ +dolor: 123 +}, [ +1, 2, 3 +]); + +// this is a weird style but makes sense to indent args if you think about it +indent3('lorem', +{ +ipsum: 'dolor' +}, +[ +1, +2, +3 +]); + +indent4({ +a: b +}); +indent5( +{ +a: b +}, +[1, 2, 3] +); +indent6( +{ +a: b +}, [ +1, 2, 3 +] +); + + +// issue #200 +require([ + "foo", + "bar" + ], function (foo, bar) { + foo(bar); +}); + + +// issue #202 +app + .directive( 'testDirective', [ 'param', + function( param ) { + alert(); + } + ]) + +// issue #240 +equal( + y + .find() + .length, + expected +); + +// issue #252 +promise().then(function(foo) { + return x; +}, function(bar) { + return y; + }); + +// issue #267 +require ('something'); +var Sidebar = Backbone.Model.extend +({ +//... +lorem: 'ipsum' +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/call_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/call_expression-out.js new file mode 100644 index 00000000..0249acd0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/call_expression-out.js @@ -0,0 +1,156 @@ +foo(); +baz(); + +bar(1, 'dolor'); +ipsum(3, { + amet: true +}, 'foo'); + +dolor = foo(2) + +// should not remove line breaks +foo(a, b, + c, d) + +tricky((123)); +tricky2((123), ((456))); + +// it should indent chained calls if there is a line break between each call +foo.bar() + // comment + .ipsum() + .dolor(); + +function foo() { + dolor + // comment + .amet() + .maecennas(); +} + +contents = this.headers.next() + .removeClass("ui-helper-reset ui-widget-content ui-corner-bottom " + + "ui-accordion-content ui-accordion-content-active ui-state-disabled") + .css("display", "") + .removeAttr("role"); + +returned.promise().done(foo) + // comment + .done(newDefer.resolve) + .fail(newDefer.reject) + // comment + .progress(newDefer.notify); + +filter(function() { + // comment + x; +}).map(function() { + // comment + y; +}); + +var contents; +contents = this.headers.next() + .removeClass("ui-state-disabled") + .css("display", ""); + +gulp.task('lint', function() { + return gulp.src('**.js') + .pipe(jshint()) + .pipe(jshint.reporter(stylish)); +}); + +// issue #68 +define(function() { + // line comment + x; +}); + + +noArgs(); + +noArgs2(); +noArgs3(); +noArgs4( + // not passing any args for some reason +); + + +// only indent if there is a line break before/between arguments +indent( + 'foo' +); + +indent2({ + dolor: 123 +}, [ + 1, 2, 3 +]); + +// this is a weird style but makes sense to indent args if you think about it +indent3('lorem', + { + ipsum: 'dolor' + }, + [ + 1, + 2, + 3 + ]); + +indent4({ + a: b +}); +indent5( + { + a: b + }, + [1, 2, 3] +); +indent6( + { + a: b + }, [ + 1, 2, 3 + ] +); + + +// issue #200 +require([ + "foo", + "bar" +], function(foo, bar) { + foo(bar); +}); + + +// issue #202 +app + .directive('testDirective', ['param', + function(param) { + alert(); + } + ]) + +// issue #240 +equal( + y + .find() + .length, + expected +); + +// issue #252 +promise().then(function(foo) { + return x; +}, function(bar) { + return y; +}); + +// issue #267 +require('something'); +var Sidebar = Backbone.Model.extend({ + //... + lorem: 'ipsum' +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/class_declaration-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/class_declaration-in.js new file mode 100644 index 00000000..e96f05de --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/class_declaration-in.js @@ -0,0 +1,35 @@ +// #286 +class Foo extends Bar { + constructor (properties, name = 'lorem', ...extra) +{ + this.properties = properties; + this.name = name; + this.extra = extra; + } + static + log ( msg , level = 'log' ) { +console[level](msg); +} toObject () { return this.properties; } } class Foo extends Bar { +// empty lines in between the MethodDefinition are valid/kept + +constructor(properties) { +this.properties = properties; +} + +get prop() { +return 'getter'; +} + +set prop(val) { +Foo.log('setting: ', val) +} + +static log(msg, level = 'log') { +console[level]('[Foo]', msg); +} + +toObject() { +return this.properties; +} + +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/class_declaration-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/class_declaration-out.js new file mode 100644 index 00000000..1233f23b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/class_declaration-out.js @@ -0,0 +1,38 @@ +// #286 +class Foo extends Bar { + constructor(properties, name = 'lorem', ...extra) { + this.properties = properties; + this.name = name; + this.extra = extra; + } + static log(msg, level = 'log') { + console[level](msg); + } + toObject() { + return this.properties; + } +} +class Foo extends Bar { + // empty lines in between the MethodDefinition are valid/kept + + constructor(properties) { + this.properties = properties; + } + + get prop() { + return 'getter'; + } + + set prop(val) { + Foo.log('setting: ', val) + } + + static log(msg, level = 'log') { + console[level]('[Foo]', msg); + } + + toObject() { + return this.properties; + } + +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comma_operator-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comma_operator-in.js new file mode 100644 index 00000000..04fefc74 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comma_operator-in.js @@ -0,0 +1,12 @@ +// SequenceExpression (aka. comma operator) + +a,b +a,b,c + +a=3,foo(), bar() ,"baz",c + +it="is" , ("a"),(trap()) + +// borrowed from signals.min test a bug related to line breaks and indent + if(e!==-1){if(a =this._bindings[e],a.isOnce()!==b)throw Error('foo');}else a=new h(this,a,b,c,d),this._addBinding(a); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comma_operator-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comma_operator-out.js new file mode 100644 index 00000000..e4037f3b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comma_operator-out.js @@ -0,0 +1,15 @@ +// SequenceExpression (aka. comma operator) + +a, b +a, b, c + +a = 3, foo(), bar(), "baz", c + +it = "is", ("a"), (trap()) + +// borrowed from signals.min test a bug related to line breaks and indent +if (e !== -1) { + if (a = this._bindings[e], a.isOnce() !== b) + throw Error('foo'); +} else a = new h(this, a, b, c, d), this._addBinding(a); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comments-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comments-in.js new file mode 100644 index 00000000..ca1ce9ba --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comments-in.js @@ -0,0 +1,49 @@ + // line comment, no indent + +/* + * block comment, no indent + */ +if (true) { +// line comment, 1 indent +/** + * block comment, 1 indent + */ +if (true) { + // line comment, 2 indents + /* + * block comment, 2 indent + */ + if (true) { + /* block single line, 3 indents */ + /* + BLOCK ASCII + |___________ + |___ + `----> YEAH + */ + bar(); + } +} +} + + /* block single line, no indent */ + + + +// test PR #57 +var obj = { /* test trailing space after multi line comment */ + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; // test space before comment + } +}; + +function foo() { // single line after token that requires line break + if (false) { /* multi line after token that requires line break */ + bar(); + } +} + + +// issue #139 +var pfun = new PFunction(function (hello /*, foo ) + ,bar { */,world) {}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comments-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comments-out.js new file mode 100644 index 00000000..b8b05992 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/comments-out.js @@ -0,0 +1,49 @@ +// line comment, no indent + +/* + * block comment, no indent + */ +if (true) { + // line comment, 1 indent + /** + * block comment, 1 indent + */ + if (true) { + // line comment, 2 indents + /* + * block comment, 2 indent + */ + if (true) { + /* block single line, 3 indents */ + /* + BLOCK ASCII + |___________ + |___ + `----> YEAH + */ + bar(); + } + } +} + +/* block single line, no indent */ + + + +// test PR #57 +var obj = { /* test trailing space after multi line comment */ + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; // test space before comment + } +}; + +function foo() { // single line after token that requires line break + if (false) { /* multi line after token that requires line break */ + bar(); + } +} + + +// issue #139 +var pfun = new PFunction(function(hello /*, foo ) + ,bar { */ , world) {}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/conditional_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/conditional_expression-in.js new file mode 100644 index 00000000..4d433a1e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/conditional_expression-in.js @@ -0,0 +1,43 @@ +a?foo():bar(); + +b = (dolor!==amet) ? 'ipsum': 'dolor'; + +if(true){ + // notice that we don't indent since "consequent" is on same line as "test" +c = !a ?(!foo?d : function(){ + return a; +}):b; +} + +// should break lines +foo.a = true; a?foo() : bar() + + +// from jquery +x = function(num) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + (object); +} + +function x() { + x.test(y) ? + a : + b; +} + +num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + +// issue #253 +var format = isSameDate(startDate, endDate) ? this._oneDayLabelFormat : +'event-multiple-day-duration'; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/conditional_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/conditional_expression-out.js new file mode 100644 index 00000000..8bae36c4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/conditional_expression-out.js @@ -0,0 +1,44 @@ +a ? foo() : bar(); + +b = (dolor !== amet) ? 'ipsum' : 'dolor'; + +if (true) { + // notice that we don't indent since "consequent" is on same line as "test" + c = !a ? (!foo ? d : function() { + return a; + }) : b; +} + +// should break lines +foo.a = true; +a ? foo() : bar() + + +// from jquery +x = function(num) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + (object); +} + +function x() { + x.test(y) ? + a : + b; +} + +num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + (num < 0 ? this[this.length + num] : this[num]); + +// issue #253 +var format = isSameDate(startDate, endDate) ? this._oneDayLabelFormat : + 'event-multiple-day-duration'; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/do_while_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/do_while_statement-in.js new file mode 100644 index 00000000..feaeb56c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/do_while_statement-in.js @@ -0,0 +1,16 @@ +do{console.log(i++)}while(i<100); do{i--}while(i); + +do n--; while(n&&foo()); + +do n--; while(n&&foo());do++i;while(amet(i)); + +// issue #256 +function main() { + do if (true) return 1; while (true); +} + +function main() { + do + if (true) return 1; + while (true); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/do_while_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/do_while_statement-out.js new file mode 100644 index 00000000..d98efe66 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/do_while_statement-out.js @@ -0,0 +1,24 @@ +do { + console.log(i++) +} while (i < 100); +do { + i-- +} while (i); + +do n--; while (n && foo()); + +do n--; while (n && foo()); +do ++i; while (amet(i)); + +// issue #256 +function main() { + do + if (true) return 1; + while (true); +} + +function main() { + do + if (true) return 1; + while (true); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/empty_file-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/empty_file-in.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/empty_file-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/empty_file-out.js new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_in_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_in_statement-in.js new file mode 100644 index 00000000..2763f596 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_in_statement-in.js @@ -0,0 +1,44 @@ +for(key in obj){doFoo(obj[key]);} +// we do not remove line breaks! (we assume user knows what he is doing) +for( key + in obj )doFoo(obj[key]); + +for(var k in o){ +console.log(k, o[k]); +} + +for(key in obj){ +for(prop in obj[key]) { +//indent +console.log(prop) +} +} + +// issue #13 : ForInStatement should not mess with inline object indent +function iss13() { + for (i in {submit : true, change : true, focusin : true}) { + console.log(i); + } +} + +// keep empty statement on one line +var key; +for ( key in obj ) {} + + + + + + +for (key in obj) + + { + // line breaks, weird spaces and multiple empty lines before + doFoo(obj[key]); +} + +// no {} +for ( key in obj ) doFoo(obj[key]); +for ( k in o ) +fn(o[k]); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_in_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_in_statement-out.js new file mode 100644 index 00000000..bef80945 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_in_statement-out.js @@ -0,0 +1,44 @@ +for (key in obj) { + doFoo(obj[key]); +} +// we do not remove line breaks! (we assume user knows what he is doing) +for (key + in obj) doFoo(obj[key]); + +for (var k in o) { + console.log(k, o[k]); +} + +for (key in obj) { + for (prop in obj[key]) { + //indent + console.log(prop) + } +} + +// issue #13 : ForInStatement should not mess with inline object indent +function iss13() { + for (i in {submit: true, change: true, focusin: true}) { + console.log(i); + } +} + +// keep empty statement on one line +var key; +for (key in obj) {} + + + + + + +for (key in obj) { + // line breaks, weird spaces and multiple empty lines before + doFoo(obj[key]); +} + +// no {} +for (key in obj) doFoo(obj[key]); +for (k in o) + fn(o[k]); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_statement-in.js new file mode 100644 index 00000000..6269daa9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_statement-in.js @@ -0,0 +1,41 @@ +for( + var i=0, + n=things.length; +i< n; +i += 1 +){ +// 1 + things[i]; +} + +for (i= 0; i< n;++i) { // 2 +things[i]; } + +for (; i< n;++i) { foo(i); /* 3 */ } + + +for (; i< n;++i) +{ +// 4 +for(; j > 0; --j) { +// 5 +things[i][j]; } +} + +// 6 +for + (;;) { + things[i]; + } + + +// 7 : indent + no braces +function foo() { +for(var c=this._bindings.length,d;c--;)if (d = this._bindings[c], d._listener === a && d.context === b) return c;return -1} + + +// 8: no {} +for (i = 0; i < 10; i++) foo(i); +for (i = 10; i < 10; i++) +bar(i); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_statement-out.js new file mode 100644 index 00000000..f57a3ee2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/for_statement-out.js @@ -0,0 +1,46 @@ +for ( + var i = 0, + n = things.length; + i < n; + i += 1 +) { + // 1 + things[i]; +} + +for (i = 0; i < n; ++i) { // 2 + things[i]; +} + +for (; i < n; ++i) { + foo(i); /* 3 */ +} + + +for (; i < n; ++i) { + // 4 + for (; j > 0; --j) { + // 5 + things[i][j]; + } +} + +// 6 +for (;;) { + things[i]; +} + + +// 7 : indent + no braces +function foo() { + for (var c = this._bindings.length, d; c--;) + if (d = this._bindings[c], d._listener === a && d.context === b) return c; + return -1 +} + + +// 8: no {} +for (i = 0; i < 10; i++) foo(i); +for (i = 10; i < 10; i++) + bar(i); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_declaration-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_declaration-in.js new file mode 100644 index 00000000..e8526319 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_declaration-in.js @@ -0,0 +1,89 @@ +function simple(x,y){return x+y;} + +function simple_2(a,b,c) +{ + return a+b + c ; +} + +// indent, spaces +function foo( x ){ return x; } + +// test space on params +function bar(a,b,c){ +// test indentation +return 'baz'; // test comment +} + + // test nested fn + function dolor(){ + // trailing white space + // missing semicolon + function fn(){ function deep() { + // moar + function moar() { +// nested comment + return "inner"; + } + return moar( ) ; + } + // test invocation + setTimeout(fn,100); + } +} + +// invocation +dolor(); + + +// start test keepEmptyLines + + + +// end test keepEmptyLines + +// test a bug related with indentation and multiple consecutive functions +function outter(){ function a1(){return true}function a2(val){return (val*2)} } + + +// issue #29 : return + line break + ternary +function iss29(a){ + return + a<5?23:12; +} + +function multiLineReturn() { +return a&& +b|| +c; +} + +function expressionReturn() { +return ( +a && +b+ +c +); +} + +// issue #283 +function foo () { + bar() +} + +// issue #140 +function chainedReturn() { + return deferred.promise + .then(console.log) +} + +// issue #231 +function multiLineParams( +foo, +bar +) { +} + +// issue #285 +function defaultParams(z, x = 1, y=2) { + return x + y + z; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_declaration-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_declaration-out.js new file mode 100644 index 00000000..274a67c0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_declaration-out.js @@ -0,0 +1,100 @@ +function simple(x, y) { + return x + y; +} + +function simple_2(a, b, c) { + return a + b + c; +} + +// indent, spaces +function foo(x) { + return x; +} + +// test space on params +function bar(a, b, c) { + // test indentation + return 'baz'; // test comment +} + +// test nested fn +function dolor() { + // trailing white space + // missing semicolon + function fn() { + function deep() { + // moar + function moar() { + // nested comment + return "inner"; + } + return moar(); + } + // test invocation + setTimeout(fn, 100); + } +} + +// invocation +dolor(); + + +// start test keepEmptyLines + + + +// end test keepEmptyLines + +// test a bug related with indentation and multiple consecutive functions +function outter() { + function a1() { + return true + } + function a2(val) { + return (val * 2) + } +} + + +// issue #29 : return + line break + ternary +function iss29(a) { + return + a < 5 ? 23 : 12; +} + +function multiLineReturn() { + return a && + b || + c; +} + +function expressionReturn() { + return ( + a && + b + + c + ); +} + +// issue #283 +function foo() { + bar() +} + +// issue #140 +function chainedReturn() { + return deferred.promise + .then(console.log) +} + +// issue #231 +function multiLineParams( + foo, + bar +) { +} + +// issue #285 +function defaultParams(z, x = 1, y = 2) { + return x + y + z; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_expression-in.js new file mode 100644 index 00000000..ceaff737 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_expression-in.js @@ -0,0 +1,68 @@ +var a=function( ){ return 'b';}; + +b = function doB(q,wer , ty ) { +var c = function(n) { + return function(){ return q + + wer - ty; } +} + return c} + + this.foo = { + bar : function(){ + var r = function(){ + re(); draw(); + return log('foo') + 'bar';};}, + ipsum : function ( amet ) { + return function( ) { amet() } + } +}; + +var noop = function ( ) { + +}; + + +var add = function(a, b) +{ + return a + b; +} + +call( function(a) +{ + b(); +} ); + + +// issue #36 +var obj = { + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + } +}; + + +// issue #134 +var foo = new MyConstructor(function otherFunction () { }); + + + +// issue #143 + if (!this._pollReceive) { + this._pollReceive = nn.PollReceiveSocket(this.binding, function (events) { + if (events) this._receive(); + }.bind(this)); + } + +// issue #283 +var foo = function foo () { + bar() +} + +var foo = function () { + bar() +} + +// default params (#285) +var defaultParams = function defaults(z, x= 1, y = 2) { + return z + x + y; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_expression-out.js new file mode 100644 index 00000000..6f6b75a9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/function_expression-out.js @@ -0,0 +1,73 @@ +var a = function() { + return 'b'; +}; + +b = function doB(q, wer, ty) { + var c = function(n) { + return function() { + return q + + wer - ty; + } + } + return c +} + +this.foo = { + bar: function() { + var r = function() { + re(); draw(); + return log('foo') + 'bar'; + }; + }, + ipsum: function(amet) { + return function() { + amet() + } + } +}; + +var noop = function() {}; + + +var add = function(a, b) { + return a + b; +} + +call(function(a) { + b(); +}); + + +// issue #36 +var obj = { + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + } +}; + + +// issue #134 +var foo = new MyConstructor(function otherFunction() {}); + + + +// issue #143 +if (!this._pollReceive) { + this._pollReceive = nn.PollReceiveSocket(this.binding, function(events) { + if (events) this._receive(); + }.bind(this)); +} + +// issue #283 +var foo = function foo() { + bar() +} + +var foo = function() { + bar() +} + +// default params (#285) +var defaultParams = function defaults(z, x = 1, y = 2) { + return z + x + y; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/if_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/if_statement-in.js new file mode 100644 index 00000000..461b8dcc --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/if_statement-in.js @@ -0,0 +1,167 @@ +if(true){doStuff()} + +if( foo ||bar ){ if (bar === 'bar'){ + // nested +log('nested if'); } else { log('nested else') +} } +else if (baz==null) +{ + // else if +log('elseif'); +}else{ + // else + log('else'); +// should keep the 2 empty lines + + +} + +if( singleLine )singleLine(); + + +// it's a trap! +if (asi && noBraces) +dolor() +else + amet(); + +// another trap! +if ( asi && noBraces2 ) dolor() +else amet(); + +// issue #7 +function iss7(){ + if (wait === true? --jQuery.readyWait : jQuery.isReady) { + return; + } +} + +// issue #32 +if( foo===bar && + foo>bar ){ + foo = bar; +} +(function(){ + if( foo===bar && + //bla bla bla + foo>bar ){ + foo = bar; + }else if(foo>bar|| + foo <=bar){ + foo =bar; + }else{ + foo = bar; + if(foo!==bar){ + foo = bar; + }else if(foo > bar || + //Hey ho + foo<=bar) { + bar = foo; + } + } +})(); + + + +// issue #34 (keep line comment on same line) +if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); +} else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); +} + + +// test with multiple lines! +if ( + lorem === ipsum && + dolor !== 'amet' +) { + yeah(); +} +if ( + // comment + lorem === ipsum && + // comment + dolor !== 'amet' +) { + yeah(); +} + +// issue #163 +if (someInt > 0 && someBool) // some comment +{ + someCode(); +} + + +// issue #161 +function test(a) { + if (a.one) { a.one() } +//test +else + if (a.two) { + a.two(); +} +} + + +// issue #196 +if(a) a(); // run a +else if(b) b(); // run b +else{ +c(); // run c +} + + +// issue #197 +function iss197() { +for (var key in pattern) { + +// Ignore some node properties +if (foo) { +continue; +} + +// Match array property +if (_.isArray(pattern[key])) { +if (!bar) { +return false; +} + +// Match object property +} else if (dolor) { + +// Special case rest params (requires knowledge of sibling nodes) +if (ipsum) { + return ipsum; +} else if (!amet) { +return false; +} + +// Match other properties (string, boolean, null, etc.) +} else if (pattern[key] !== node[key]) { +return false; +} +} +return true; +} + +// issue #222 +var obj; +if ( +delete obj.hello +, 'world') { +// more code +} + +// issue #297 +if (foo) { + bar() + + // this comment should be indented + + baz(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/if_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/if_statement-out.js new file mode 100644 index 00000000..53f995b7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/if_statement-out.js @@ -0,0 +1,172 @@ +if (true) { + doStuff() +} + +if (foo || bar) { + if (bar === 'bar') { + // nested + log('nested if'); + } else { + log('nested else') + } +} else if (baz == null) { + // else if + log('elseif'); +} else { + // else + log('else'); + // should keep the 2 empty lines + + +} + +if (singleLine) singleLine(); + + +// it's a trap! +if (asi && noBraces) + dolor() +else + amet(); + +// another trap! +if (asi && noBraces2) dolor() +else amet(); + +// issue #7 +function iss7() { + if (wait === true ? --jQuery.readyWait : jQuery.isReady) { + return; + } +} + +// issue #32 +if (foo === bar && + foo > bar) { + foo = bar; +} +(function() { + if (foo === bar && + //bla bla bla + foo > bar) { + foo = bar; + } else if (foo > bar || + foo <= bar) { + foo = bar; + } else { + foo = bar; + if (foo !== bar) { + foo = bar; + } else if (foo > bar || + //Hey ho + foo <= bar) { + bar = foo; + } + } +})(); + + + +// issue #34 (keep line comment on same line) +if (window.DOMParser) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString(data, "text/xml"); +} else { // IE + xml = new ActiveXObject("Microsoft.XMLDOM"); + xml.async = "false"; + xml.loadXML(data); +} + + +// test with multiple lines! +if ( + lorem === ipsum && + dolor !== 'amet' +) { + yeah(); +} +if ( + // comment + lorem === ipsum && + // comment + dolor !== 'amet' +) { + yeah(); +} + +// issue #163 +if (someInt > 0 && someBool) // some comment +{ + someCode(); +} + + +// issue #161 +function test(a) { + if (a.one) { + a.one() + } + //test + else if (a.two) { + a.two(); + } +} + + +// issue #196 +if (a) a(); // run a +else if (b) b(); // run b +else { + c(); // run c +} + + +// issue #197 +function iss197() { + for (var key in pattern) { + + // Ignore some node properties + if (foo) { + continue; + } + + // Match array property + if (_.isArray(pattern[key])) { + if (!bar) { + return false; + } + + // Match object property + } else if (dolor) { + + // Special case rest params (requires knowledge of sibling nodes) + if (ipsum) { + return ipsum; + } else if (!amet) { + return false; + } + + // Match other properties (string, boolean, null, etc.) + } else if (pattern[key] !== node[key]) { + return false; + } + } + return true; +} + +// issue #222 +var obj; +if ( + delete obj.hello + , 'world') { + // more code +} + +// issue #297 +if (foo) { + bar() + + // this comment should be indented + + baz(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/iife-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/iife-in.js new file mode 100644 index 00000000..fd53e8c2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/iife-in.js @@ -0,0 +1,25 @@ +(function(i){ function h(a,b,c,d,e){this._listener=b;this._isOnce=c;this.context=d;this._signal=a;this._priority=e||0}i.h=h;}(this)); + + +// issue #191 +var data = { + items: (function() { + return [1, 2, 3, 4]; + }()), + foo: true +}; + +// issue #223 +( function() { + var x = 1; + foo(bar(), baz()); +}() ); + +// issue #250 +( function( $ ) { +x; +}( jQuery ) ); + +;!function( x ) { + console.log( x ) +}( 'bar' ) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/iife-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/iife-out.js new file mode 100644 index 00000000..e9260003 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/iife-out.js @@ -0,0 +1,34 @@ +(function(i) { + function h(a, b, c, d, e) { + this._listener = b; + this._isOnce = c; + this.context = d; + this._signal = a; + this._priority = e || 0 + } + i.h = h; +}(this)); + + +// issue #191 +var data = { + items: (function() { + return [1, 2, 3, 4]; + }()), + foo: true +}; + +// issue #223 +(function() { + var x = 1; + foo(bar(), baz()); +}()); + +// issue #250 +(function($) { + x; +}(jQuery)); + +;!function(x) { + console.log(x) +}('bar') diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/inplace-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/inplace-in.js new file mode 100644 index 00000000..345e7046 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/inplace-in.js @@ -0,0 +1,6 @@ + var a = + + 40 + + ; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/inplace-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/inplace-out.js new file mode 100644 index 00000000..eda2e27f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/inplace-out.js @@ -0,0 +1,5 @@ + +var a = 40 + +; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/logical_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/logical_expression-in.js new file mode 100644 index 00000000..a9d21ab6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/logical_expression-in.js @@ -0,0 +1,37 @@ +a||b +a || foo; +foo&&bar +;(a||b); +( a&&b&&c ); + + +// expressions +;(a&&b) ||foo&&bar +;((a&&b)||c)||d + + +// test line break and indent +if (true) { + var b;this.foo&&this.bar(); +} + +(foo || bar); (dolor || amet); + +foo = dolor || + amet && + bar + +var foo = dolor && + amet || + maecennas + +var foo, + bar = x && + ( a || b ); + +function x() { + return (x || y) && + + // comment + call(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/logical_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/logical_expression-out.js new file mode 100644 index 00000000..07f0113e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/logical_expression-out.js @@ -0,0 +1,38 @@ +a || b +a || foo; +foo && bar +;(a || b); +(a && b && c); + + +// expressions +;(a && b) || foo && bar +;((a && b) || c) || d + + +// test line break and indent +if (true) { + var b; + this.foo && this.bar(); +} + +(foo || bar); (dolor || amet); + +foo = dolor || + amet && + bar + +var foo = dolor && + amet || + maecennas + +var foo, + bar = x && + (a || b); + +function x() { + return (x || y) && + + // comment + call(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/new_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/new_expression-in.js new file mode 100644 index 00000000..db279ad8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/new_expression-in.js @@ -0,0 +1,6 @@ +// issue #254 +var now = new Date(); +var midnight = new Date( +now.getFullYear(), now.getMonth(), now.getDate() + 1, +0, 0, 0 +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/new_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/new_expression-out.js new file mode 100644 index 00000000..be979e33 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/new_expression-out.js @@ -0,0 +1,6 @@ +// issue #254 +var now = new Date(); +var midnight = new Date( + now.getFullYear(), now.getMonth(), now.getDate() + 1, + 0, 0, 0 +); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/obj_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/obj_expression-in.js new file mode 100644 index 00000000..95565284 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/obj_expression-in.js @@ -0,0 +1,156 @@ +foo.bar.Baz( { + method2: function () {}, prop : 'dolor amet' + , prop2 : 123 +}); + +// issue #142 +var foo = [{ +bar: 42 +}]; + +function foo(a){ amet(123, a, {flag:true}); } +ipsum({flag:true}); +ipsum({flag:true,other:false}); +ipsum({flag:true,other:false},789,'bar'); + + +var obj = {foo:"bar", 'lorem' : 123, + dolor :new Date() +, "re": /\w+/g} ; + +// ObjectEpression within CallExpression needs to indent comments +declare({ +// comment +create: {} +}); + +this.element +.add() +.set({ +// line comment +// one more +prop: "value" +}); + +define( name, { +_create: function() { +this.element +.add() +.set({ +// line comment +// one more +prop: "value" +}); +} +}); + +x = { +props: { +// comment +x: 1 +} +}; + +var x = { + data: x ? + x() : + // comment + function() {} +}; + +// edge case +for (key in { + foo:'bar', + lorem:'ipsum' +}) { + doStuff(key); +} + +// issues #47 and #166 +Ext.define('VMS.model.User', { + extend: 'Ext.data.Model', + idProperty: 'UserID', + fields: [ + { + // foo + name: 'UserID', + type: 'int' // bar + }, + // dolor + // amet + { + name: 'FirstName', + type: 'string' + }, + { + name: 'LastName', + type: 'string' + // align with previous line because of line break + + // align with "}" + // dolor sit amet + // maecennas ullamcor + } + ] +}); + + +// issue #175 +var ItemsSchema = new Schema({ + name: String // comments + ,dds: "" +}); + + +this +.foo({ +bar: 'baz' +}); + + +// issue #193 +foo = function() { +var a, +b, +c; + var bar = this.baz({}); +}; + +// issue #226 +var o = { +a: 0, +get b(){}, +set c (x){}, +method1(foo) {}, +method2 ( bar ) +{} +}; + +o = { +get b(){return 'test'; }, +set c(x){} +}; + +x = { + at: "left" + + "top" +}; +x = { + at: a && + b +}; + +// ES6 Object Literal Property Value Shorthand +x = { w, y, z } + +// issue #295 +o = { + foo: ( + lorem && + ipsum + ), + bar: ( + dolor || + amet + ) +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/obj_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/obj_expression-out.js new file mode 100644 index 00000000..6c6c69a5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/obj_expression-out.js @@ -0,0 +1,174 @@ +foo.bar.Baz({ + method2: function() {}, + prop: 'dolor amet', + prop2: 123 +}); + +// issue #142 +var foo = [{ + bar: 42 +}]; + +function foo(a) { + amet(123, a, { + flag: true + }); +} +ipsum({ + flag: true +}); +ipsum({ + flag: true, + other: false +}); +ipsum({ + flag: true, + other: false +}, 789, 'bar'); + + +var obj = { + foo: "bar", + 'lorem': 123, + dolor: new Date(), + "re": /\w+/g +}; + +// ObjectEpression within CallExpression needs to indent comments +declare({ + // comment + create: {} +}); + +this.element + .add() + .set({ + // line comment + // one more + prop: "value" + }); + +define(name, { + _create: function() { + this.element + .add() + .set({ + // line comment + // one more + prop: "value" + }); + } +}); + +x = { + props: { + // comment + x: 1 + } +}; + +var x = { + data: x ? + x() : + // comment + function() {} +}; + +// edge case +for (key in {foo: 'bar', lorem: 'ipsum'}) { + doStuff(key); +} + +// issues #47 and #166 +Ext.define('VMS.model.User', { + extend: 'Ext.data.Model', + idProperty: 'UserID', + fields: [ + { + // foo + name: 'UserID', + type: 'int' // bar + }, + // dolor + // amet + { + name: 'FirstName', + type: 'string' + }, + { + name: 'LastName', + type: 'string' + // align with previous line because of line break + + // align with "}" + // dolor sit amet + // maecennas ullamcor + } + ] +}); + + +// issue #175 +var ItemsSchema = new Schema({ + name: String, // comments + dds: "" +}); + + +this + .foo({ + bar: 'baz' + }); + + +// issue #193 +foo = function() { + var a, + b, + c; + var bar = this.baz({}); +}; + +// issue #226 +var o = { + a: 0, + get b() {}, + set c(x) {}, + method1(foo) {}, + method2(bar) {} +}; + +o = { + get b() { + return 'test'; + }, + set c(x) {} +}; + +x = { + at: "left" + + "top" +}; +x = { + at: a && + b +}; + +// ES6 Object Literal Property Value Shorthand +x = { + w, + y, + z +} + +// issue #295 +o = { + foo: ( + lorem && + ipsum + ), + bar: ( + dolor || + amet + ) +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/switch_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/switch_statement-in.js new file mode 100644 index 00000000..7bd29813 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/switch_statement-in.js @@ -0,0 +1,73 @@ +switch (fruit) { + // case comment + case Fruit.APPLE: + // consequent comment + apple(); + break; + case + Fruit.BANANA: + banana(); + // comment in between content + break; + // case comment + case Fruit.MANGO: + // case comment + case Fruit.PUPAYA: + exotic(); + break; + default: + // consequent comment + unknown(); +} + +call(function(){ + switch (fruit) { + // case comment + case Fruit.APPLE: + // consequent comment + exotic(); + break; + default: + unknown(); + } +}); + + +switch (fruit) +{ + // case comment + case Fruit.APPLE: + // consequent comment + apple(); + break; } + +// issue #225 +switch (item) { +case 'one': +dothis() +break +default: +} + +// issue #290 +switch (x) { + case true: + x(); + break; + default: + if (x) { + x(); + } + } + +// comment alignment (#209) +switch (foo) { + case bar: + baz(); + // falls through + // yes, this should be aligned too + + // align with case + case biz: + what(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/switch_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/switch_statement-out.js new file mode 100644 index 00000000..9942e726 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/switch_statement-out.js @@ -0,0 +1,72 @@ +switch (fruit) { + // case comment + case Fruit.APPLE: + // consequent comment + apple(); + break; + case Fruit.BANANA: + banana(); + // comment in between content + break; + // case comment + case Fruit.MANGO: + // case comment + case Fruit.PUPAYA: + exotic(); + break; + default: + // consequent comment + unknown(); +} + +call(function() { + switch (fruit) { + // case comment + case Fruit.APPLE: + // consequent comment + exotic(); + break; + default: + unknown(); + } +}); + + +switch (fruit) { + // case comment + case Fruit.APPLE: + // consequent comment + apple(); + break; +} + +// issue #225 +switch (item) { + case 'one': + dothis() + break + default: +} + +// issue #290 +switch (x) { + case true: + x(); + break; + default: + if (x) { + x(); + } +} + +// comment alignment (#209) +switch (foo) { + case bar: + baz(); + // falls through + // yes, this should be aligned too + + // align with case + case biz: + what(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/throw_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/throw_statement-in.js new file mode 100644 index 00000000..27122e07 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/throw_statement-in.js @@ -0,0 +1,7 @@ +function foo(a) {throw new Error('invalid args') +function b() { +throw Error('no new');} +} + +throw "this is an anti-pattern, never throw string, only Error objects"; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/throw_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/throw_statement-out.js new file mode 100644 index 00000000..9badaeff --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/throw_statement-out.js @@ -0,0 +1,9 @@ +function foo(a) { + throw new Error('invalid args') + function b() { + throw Error('no new'); + } +} + +throw "this is an anti-pattern, never throw string, only Error objects"; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/try_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/try_statement-in.js new file mode 100644 index 00000000..6d708632 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/try_statement-in.js @@ -0,0 +1,106 @@ +try{foo()} catch (e){ log(e) +} + +try +{ +// foo comment + foo(); +} +finally +{ + // bar comment + bar(); + } + +try{foo()} catch (e){ log(e) + } finally { + bar() + } + +try { + bar( "foo" ); +} catch ( e ) { + // Empty Catch comment +} + + +// issue #35: "catch" block indent + empty catch body +jQuery.ready.promise = function( obj ) { + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} +}; + +// "catch" brace indent +function issueNN( obj ) { + try { + x = y; + } catch (e) { + console.log(e); + } +} + +// "finally" brace indent +function foo(obj) { + try { + top = window.frameElement == null && document.documentElement; + } catch (e) { + console.log(e); + } finally { + // finally a comment + top = 0; + // weird + } +} + +jQuery.ready.promise = function( obj ) { +try{ +// try 2 +top = window.frameElement == null && document.documentElement; +// try after 2 +}catch(e){ +// catch 2 +console.log(e); +// catch after 2 +}finally{ +// finally a comment 2 +top = 0; +// finally after 2 +} +}; + +// nested try-catch +function nestedTryCatch() { + try{ + normalPath(); + }catch(e) { + try { + // try + alternatePath(); + // just a little bit harder + } catch(e){ + // catch + console.log(e); + // if you can + }finally{} + }finally{ shouldBreak = true; } next(); +} + +// line break handling (#128) +try { + doStuff() +} +catch + (e) +{ + yesThisIsWeird() +} + +// comment alignment (#270) +try { + bla(); + // comment + // too +} catch(e) { + throw e; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/try_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/try_statement-out.js new file mode 100644 index 00000000..3d17c129 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/try_statement-out.js @@ -0,0 +1,109 @@ +try { + foo() +} catch (e) { + log(e) +} + +try { + // foo comment + foo(); +} finally { + // bar comment + bar(); +} + +try { + foo() +} catch (e) { + log(e) +} finally { + bar() +} + +try { + bar("foo"); +} catch (e) { + // Empty Catch comment +} + + +// issue #35: "catch" block indent + empty catch body +jQuery.ready.promise = function(obj) { + try { + top = window.frameElement == null && document.documentElement; + } catch (e) {} +}; + +// "catch" brace indent +function issueNN(obj) { + try { + x = y; + } catch (e) { + console.log(e); + } +} + +// "finally" brace indent +function foo(obj) { + try { + top = window.frameElement == null && document.documentElement; + } catch (e) { + console.log(e); + } finally { + // finally a comment + top = 0; + // weird + } +} + +jQuery.ready.promise = function(obj) { + try { + // try 2 + top = window.frameElement == null && document.documentElement; + // try after 2 + } catch (e) { + // catch 2 + console.log(e); + // catch after 2 + } finally { + // finally a comment 2 + top = 0; + // finally after 2 + } +}; + +// nested try-catch +function nestedTryCatch() { + try { + normalPath(); + } catch (e) { + try { + // try + alternatePath(); + // just a little bit harder + } catch (e) { + // catch + console.log(e); + // if you can + } finally {} + } finally { + shouldBreak = true; + } + next(); +} + +// line break handling (#128) +try { + doStuff() +} catch (e) { + yesThisIsWeird() +} + +// comment alignment (#270) +try { + bla(); +// comment +// too +} catch (e) { + throw e; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/unary_expression-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/unary_expression-in.js new file mode 100644 index 00000000..866e41ee --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/unary_expression-in.js @@ -0,0 +1,34 @@ +!a +!!foo +!(foo); +;(!!foo) +!( ! foo ); +!!(!foo); + +-x; +- y; + +~ a; //bitwise NOT is unary + +// these are actually UpdateExpression +++ foo; +foo ++; +-- bar; +bar --; + +// delete is a UnaryExpression +delete foo.bar; delete bar.amet; + +// need to check indent as well +function fn() { +!!(!foo); +delete this.bar +delete this.amet;delete this.ipsum; +} + +typeof a === "number" ? x : y; + +var s = 'a string'; +console.log(typeof s); + +void 0; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/unary_expression-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/unary_expression-out.js new file mode 100644 index 00000000..fa9784aa --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/unary_expression-out.js @@ -0,0 +1,36 @@ +!a +!!foo +!(foo); +;(!!foo) +!(!foo); +!!(!foo); + +-x; +-y; + +~a; //bitwise NOT is unary + +// these are actually UpdateExpression +++foo; +foo++; +--bar; +bar--; + +// delete is a UnaryExpression +delete foo.bar; +delete bar.amet; + +// need to check indent as well +function fn() { + !!(!foo); + delete this.bar + delete this.amet; + delete this.ipsum; +} + +typeof a === "number" ? x : y; + +var s = 'a string'; +console.log(typeof s); + +void 0; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/var-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/var-in.js new file mode 100644 index 00000000..0699bc42 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/var-in.js @@ -0,0 +1,56 @@ +var foo=true;var bar= '123'; +var lorem = + /\w+/; +var parentheses =(123); + +var dolor; + +var a,b= true, +c =3, d=false; + +var + +amet= qwe(); +var asi = true + + +// test for issue #4 +var + // foo var + foo, + // bar variable + bar = 'dolor amet'; + + +// issue #28 : comma first +var x=33 + ,y=12 + + + // comment + , w = 45; + + +// issue #31: multiple var declaration + function expression = wrong indent +(function(){ +var + // A central reference to the root jQuery(document) + rootjQuery, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // literal object + obj = { + num : 123, + str : 'literal' + }; +}()); + +var lorem = ipsum || + dolor && + (sit || amet); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/var-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/var-out.js new file mode 100644 index 00000000..91115673 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/var-out.js @@ -0,0 +1,56 @@ +var foo = true; +var bar = '123'; +var lorem = /\w+/; +var parentheses = (123); + +var dolor; + +var a, + b = true, + c = 3, + d = false; + +var amet = qwe(); +var asi = true + + +// test for issue #4 +var + // foo var + foo, + // bar variable + bar = 'dolor amet'; + + +// issue #28 : comma first +var x = 33, + y = 12, + + + // comment + w = 45; + + +// issue #31: multiple var declaration + function expression = wrong indent +(function() { + var + // A central reference to the root jQuery(document) + rootjQuery, + + // Define a local copy of jQuery + jQuery = function(selector, context) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init(selector, context, rootjQuery); + }, + + // literal object + obj = { + num: 123, + str: 'literal' + }; +}()); + +var lorem = ipsum || + dolor && + (sit || amet); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/while_statement-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/while_statement-in.js new file mode 100644 index 00000000..74c7dba8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/while_statement-in.js @@ -0,0 +1,41 @@ +// no parens and asi +while(cur=items[i++]) log(cur.name); + + // wrong indent and line breaks + while( + ++n < + 10 + ) { + log(n) + } + + // no body + while ( foo() ); + +// break before open curly brace and lots of spaces +while ( true ) +{ +// comment inside + foo(); +} + +while (n--){ +// nested +while(i++){ +// moar nested +while(z++<0) { + // inception + foo(); + while(j++) { + // deeper + bar(); + } +} +} +} + + +// no body #2 +while (true ) + ; + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/while_statement-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/while_statement-out.js new file mode 100644 index 00000000..799a904d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/default/while_statement-out.js @@ -0,0 +1,39 @@ +// no parens and asi +while (cur = items[i++]) log(cur.name); + +// wrong indent and line breaks +while ( + ++n < + 10 +) { + log(n) +} + +// no body +while (foo()); + +// break before open curly brace and lots of spaces +while (true) { + // comment inside + foo(); +} + +while (n--) { + // nested + while (i++) { + // moar nested + while (z++ < 0) { + // inception + foo(); + while (j++) { + // deeper + bar(); + } + } + } +} + + +// no body #2 +while (true); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/jquery/spacing-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/jquery/spacing-in.js new file mode 100644 index 00000000..97eab80a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/jquery/spacing-in.js @@ -0,0 +1,99 @@ +// this file is imcomplete since jquery style guide support is still not +// finished (see #19) + +var i = 0; + +if (condition) { doSomething(); } else if (otherCondition) { + somethingElse(); +// comment +} else { +// comment +otherThing(); +} + +this.element + .add() + .set({ + // line comment + // one more + prop: "value" + }); + +while (x) { + y(); +} + +for (i = 0; i < length; i++) { + y(); +} +for ( ; i < length; i++ ) { + y(); +} + +function x() { + return something && + !somethingElse; +} + +ul.outerWidth( Math.max( + // Firefox wraps long text (possibly a rounding bug) + // so we add 1px to avoid the wrapping (#7513) + ul.width( "" ).outerWidth() + 1, + this.element.outerWidth() +) ); + +function x() { + return this.indeterminate ? false : + Math.min( this.options.max, Math.max( this.min, newValue ) ); +} + +if ( event.target !== that.element[ 0 ] && + event.target !== menuElement && + !$.contains( menuElement, event.target ) ) { + close(); +} + +contents = this.headers.next() + .removeClass("ui-helper-reset ui-widget-content ui-corner-bottom " + + "ui-accordion-content ui-accordion-content-active ui-state-disabled") + .css("display", "") + .removeAttr("role"); + +this.buttonElement + .addClass( baseClasses ) + .bind( "click" + this.eventNamespace, function( event ) { + if ( options.disabled ) { + event.preventDefault(); + } + }); + +try { + x(); +} catch(error) { + console.log(error); +} + +x({ a: 1 }); +y({ + a: 1 +}); +$.each( { div: "#list1", ul: "#navigation", dl: "#accordion-dl" } ); + +(function($) { + x; +}(jQuery)); + +var x = {foo:{bar: true}}; +var y = {a: b, c: d, e:{ f: g}}; +x = { + props: { + // comment + x: 1 + } +}; +x={ + b:function b() { + a(); + }, + a:b +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/jquery/spacing-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/jquery/spacing-out.js new file mode 100644 index 00000000..e4aa0ed6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/jquery/spacing-out.js @@ -0,0 +1,101 @@ +// this file is imcomplete since jquery style guide support is still not +// finished (see #19) + +var i = 0; + +if ( condition ) { + doSomething(); +} else if ( otherCondition ) { + somethingElse(); +// comment +} else { + // comment + otherThing(); +} + +this.element + .add() + .set( { + // line comment + // one more + prop: "value" + } ); + +while ( x ) { + y(); +} + +for ( i = 0; i < length; i++ ) { + y(); +} +for ( ; i < length; i++ ) { + y(); +} + +function x() { + return something && + !somethingElse; +} + +ul.outerWidth( Math.max( + // Firefox wraps long text (possibly a rounding bug) + // so we add 1px to avoid the wrapping (#7513) + ul.width( "" ).outerWidth() + 1, + this.element.outerWidth() +) ); + +function x() { + return this.indeterminate ? false : + Math.min( this.options.max, Math.max( this.min, newValue ) ); +} + +if ( event.target !== that.element[ 0 ] && + event.target !== menuElement && + !$.contains( menuElement, event.target ) ) { + close(); +} + +contents = this.headers.next() + .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " + + "ui-accordion-content ui-accordion-content-active ui-state-disabled" ) + .css( "display", "" ) + .removeAttr( "role" ); + +this.buttonElement + .addClass( baseClasses ) + .bind( "click" + this.eventNamespace, function( event ) { + if ( options.disabled ) { + event.preventDefault(); + } + } ); + +try { + x(); +} catch ( error ) { + console.log( error ); +} + +x( { a: 1 } ); +y( { + a: 1 +} ); +$.each( { div: "#list1", ul: "#navigation", dl: "#accordion-dl" } ); + +( function( $ ) { +x; +}( jQuery ) ); + +var x = { foo: { bar: true } }; +var y = { a: b, c: d, e: { f: g } }; +x = { + props: { + // comment + x: 1 + } +}; +x = { + b: function b() { + a(); + }, + a: b +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/.esformatter b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/.esformatter new file mode 100644 index 00000000..dd683eb3 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/.esformatter @@ -0,0 +1,10 @@ +{ + "indent": { + "value": " " + }, + "whiteSpace": { + "before": { + "FunctionDeclarationOpeningBrace" : 0 + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/nested/.esformatter b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/nested/.esformatter new file mode 100644 index 00000000..af488254 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/nested/.esformatter @@ -0,0 +1,5 @@ +{ + "indent": { + "value": "\t" + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/nested/nested-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/nested/nested-in.js new file mode 100644 index 00000000..c48aa716 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/nested/nested-in.js @@ -0,0 +1,4 @@ +// it should merge the config files if nested +function foo() { +bar(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/nested/nested-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/nested/nested-out.js new file mode 100644 index 00000000..3439f154 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/nested/nested-out.js @@ -0,0 +1,4 @@ +// it should merge the config files if nested +function foo(){ + bar(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/.esformatter b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/.esformatter new file mode 100644 index 00000000..af488254 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/.esformatter @@ -0,0 +1,5 @@ +{ + "indent": { + "value": "\t" + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/package.json new file mode 100644 index 00000000..a9557632 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/package.json @@ -0,0 +1,9 @@ +{ + "esformatter": { + "lineBreak": { + "before": { + "FunctionDeclarationClosingBrace" : 0 + } + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/pkg_nested-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/pkg_nested-in.js new file mode 100644 index 00000000..c48aa716 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/pkg_nested-in.js @@ -0,0 +1,4 @@ +// it should merge the config files if nested +function foo() { +bar(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/pkg_nested-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/pkg_nested-out.js new file mode 100644 index 00000000..9ee3c24b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/nested/pkg_nested-out.js @@ -0,0 +1,4 @@ +// it should merge the config files if nested +function foo() +{ + bar(); } diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/package-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/package-in.js new file mode 100644 index 00000000..e06d0eb0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/package-in.js @@ -0,0 +1,3 @@ +function foo() { +bar(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/package-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/package-out.js new file mode 100644 index 00000000..e9ddb8b1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/package-out.js @@ -0,0 +1,4 @@ +function foo() +{ + bar(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/package.json new file mode 100644 index 00000000..7c6dc148 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/package.json @@ -0,0 +1,13 @@ +{ + "esformatter": { + "preset": "default", + "indent": { + "value": " " + }, + "lineBreak": { + "before": { + "FunctionDeclarationOpeningBrace" : 1 + } + } + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/rc/.esformatter b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/rc/.esformatter new file mode 100644 index 00000000..182cd239 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/rc/.esformatter @@ -0,0 +1,6 @@ +{ + "root": true, + "indent": { + "value": "\t" + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/rc/nested-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/rc/nested-in.js new file mode 100644 index 00000000..e06d0eb0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/rc/nested-in.js @@ -0,0 +1,3 @@ +function foo() { +bar(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/rc/nested-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/rc/nested-out.js new file mode 100644 index 00000000..0487a4e7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/package/rc/nested-out.js @@ -0,0 +1,3 @@ +function foo() { + bar(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/top-in.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/top-in.js new file mode 100644 index 00000000..84b51e54 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/top-in.js @@ -0,0 +1,3 @@ +function foo(){ +bar(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/top-out.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/top-out.js new file mode 100644 index 00000000..bd29a250 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/compare/rc/top-out.js @@ -0,0 +1,3 @@ +function foo(){ + bar(); +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/format.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/format.spec.js new file mode 100644 index 00000000..990ad6f1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/format.spec.js @@ -0,0 +1,151 @@ +/*jshint node:true*/ +/*global describe:false, it:false*/ +"use strict"; + +var esprima = require('esprima'); +var expect = require('chai').expect; +var _glob = require('glob'); +var _path = require('path'); + +var esformatter = require('../lib/esformatter'); + +var _helpers = require('./helpers'); +var readOut = _helpers.readOut; +var readIn = _helpers.readIn; +var readConfig = _helpers.readConfig; + + +// --- + + +describe('esformatter.format()', function() { + + // we generate the specs dynamically based on files inside the compare + // folder since it will be easier to write the tests and do the comparison + + describe('default options', function() { + + var pattern = _path.join(_helpers.COMPARE_FOLDER, 'default/*-in.js'); + _glob.sync(pattern).forEach(function(fileName) { + + // we read files before the test to avoid affecting the test + // benchmark, I/O operations are expensive. + var id = fileName.replace(/.+(default\/.+)-in\.js/, '$1'); + + it(id, function() { + var input = readIn(id); + var compare = readOut(id); + var result = esformatter.format(input); + + expect(result).to.equal(compare); + + // result should be valid JS + expect(function() { + try { + esprima.parse(result); + } catch (e) { + throw new Error('esformatter.format() result produced a non-valid output.\n' + e); + } + }).to.not.Throw(); + + // make sure formatting can be applied multiple times + // (idempotent) + expect(esformatter.format(result)).to.equal(compare); + }); + + }); + + }); + + + describe('custom options', function() { + + var pattern = _path.join(_helpers.COMPARE_FOLDER, 'custom/*-in.js'); + _glob.sync(pattern).forEach(function(fileName) { + + // we read files before the test to avoid affecting the test + // benchmark, I/O operations are expensive. + var id = fileName.replace(/.+(custom\/.+)-in\.js/, '$1'); + + it(id, function() { + var input = readIn(id); + var options = readConfig(id); + var compare = readOut(id); + var result = esformatter.format(input, options); + + expect(result).to.equal(compare); + + // result should be valid JS + expect(function() { + try { + esprima.parse(result); + } catch (e) { + throw new Error('esformatter.format() result produced a non-valid output.\n' + e); + } + }).to.not.Throw(); + + // make sure formatting can be applied multiple times + // (idempotent) + expect(esformatter.format(result, options)).to.equal(compare); + }); + + }); + + }); + + + describe('jquery preset', function() { + + var pattern = _path.join(_helpers.COMPARE_FOLDER, 'jquery/*-in.js'); + _glob.sync(pattern).forEach(function(fileName) { + + // we read files before the test to avoid affecting the test + // benchmark, I/O operations are expensive. + var id = fileName.replace(/.+(jquery\/.+)-in\.js/, '$1'); + + it(id, function() { + var input = readIn(id); + var compare = readOut(id); + var result = esformatter.format(input, {preset:'jquery'}); + + expect(result).to.equal(compare); + + // result should be valid JS + expect(function() { + try { + esprima.parse(result); + } catch (e) { + throw new Error('esformatter.format() result produced a non-valid output.\n' + e); + } + }).to.not.Throw(); + + // make sure formatting can be applied multiple times + // (idempotent) + expect(esformatter.format(result, {preset:'jquery'})).to.equal(compare); + }); + + }); + + }); + + describe('shebang', function() { + + it('should allow by default', function() { + var result = esformatter.format('#!/usr/bin/env node\nif(foo){bar()}'); + expect(result).to.equal('#!/usr/bin/env node\nif (foo) {\n bar()\n}'); + }); + + it('should throw if not allowed', function() { + expect(function() { + esformatter.format('#!/usr/bin/env node\nif(foo){bar()}', { + esformatter: { + allowShebang: false + } + }); + }).to.Throw(); + }); + + }); + +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/helpers.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/helpers.js new file mode 100644 index 00000000..c479c05b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/helpers.js @@ -0,0 +1,70 @@ +"use strict"; + +// +// helpers used on the specs +// + + +var _fs = require('fs'); +var _path = require('path'); +var stripJsonComments = require('strip-json-comments'); + + +// --- + + +exports.CACHE = {}; +exports.COMPARE_FOLDER = _path.join(__dirname, 'compare'); + + +// --- + + +exports.readIn = function(id) { + return exports.readFile(_path.join(exports.COMPARE_FOLDER, id + '-in.js')); +}; + + +exports.readOut = function(id) { + return exports.readFile(_path.join(exports.COMPARE_FOLDER, id + '-out.js')); +}; + + +exports.readConfig = function(id) { + var filePath = _path.join(exports.COMPARE_FOLDER, id + '-config.json'); + return JSON.parse(stripJsonComments(exports.readFile(filePath) + '\n')); +}; + + +exports.readFile = function(path) { + // we cache the results to avoid redundant I/O + if (!(path in exports.CACHE)) { + exports.CACHE[path] = exports.lineFeed(_fs.readFileSync(path).toString()); + } + return exports.CACHE[path]; +}; + + +exports.purge = function(dir) { + if (!exports.SHOULD_PURGE) return; + _fs.readdirSync(dir).forEach(function(relPath) { + var path = _path.join(dir, relPath); + if (_fs.statSync(path).isDirectory()) { + exports.purge(path); + } else { + _fs.unlinkSync(path); + } + }); + _fs.rmdirSync(dir); +}; + + +exports.mkdir = function(dir) { + if (!_fs.existsSync(dir)) { + _fs.mkdirSync(dir); + } +}; + +exports.lineFeed = function(text) { + return text.replace(/\r\n?|[\n\u2028\u2029]/g, "\n"); +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe.spec.js new file mode 100644 index 00000000..5ee1bd75 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe.spec.js @@ -0,0 +1,52 @@ +//jshint node:true +/*global describe, it*/ +"use strict"; + +var expect = require('chai').expect; +var esformatter = require('../lib/esformatter'); + +var input = 'var foo = bar;\nfunction bar(dolor, amet) {\n return dolor + amet;\n}'; +var output1 = '\n// ---- esformatter-pipe-test-1 ---\n'; +var output2 = '\n// ---- esformatter-pipe-test-2 ---\n'; + +describe('pipe', function() { + + it('should call piped commands', function() { + var out = esformatter.format(input, { + pipe: { + before: [ + 'esformatter-pipe-test-1', + ], + after: [ + 'esformatter-pipe-test-2' + ] + } + }); + expect(out).to.eql(input + output1 + output2); + }); + + it('should call piped commands in order', function() { + var out = esformatter.format(input, { + pipe: { + after: [ + 'esformatter-pipe-test-2', + 'esformatter-pipe-test-1' + ] + } + }); + expect(out).to.eql(input + output2 + output1); + }); + + it('should throw error if command not found', function() { + expect(function() { + esformatter.format(input, { + pipe: { + before: [ + 'esformatter-fake-pipe-command' + ] + } + }); + }).to.throw(); + }); + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe/bin/esformatter-pipe-test-1 b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe/bin/esformatter-pipe-test-1 new file mode 100644 index 00000000..90737029 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe/bin/esformatter-pipe-test-1 @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +var stdin = require('stdin'); + +stdin(function(source) { + process.stdout.write(source + '\n// ---- esformatter-pipe-test-1 ---\n'); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe/bin/esformatter-pipe-test-2 b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe/bin/esformatter-pipe-test-2 new file mode 100644 index 00000000..4e4f55f8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe/bin/esformatter-pipe-test-2 @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +var stdin = require('stdin'); + +stdin(function(source) { + process.stdout.write(source + '\n// ---- esformatter-pipe-test-2 ---\n'); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe/package.json new file mode 100644 index 00000000..276b8fc6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/pipe/package.json @@ -0,0 +1,15 @@ +{ + "private": true, + "name": "esformatter-pipe-test", + "version": "1.0.0", + "description": "used to test esformatter pipe option", + "author": "Miller Medeiros", + "bin": { + "esformatter-pipe-test-1": "./bin/esformatter-pipe-test-1", + "esformatter-pipe-test-2": "./bin/esformatter-pipe-test-2" + }, + "license": "ISC", + "dependencies": { + "stdin": "0.0.1" + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/plugin/index.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/plugin/index.js new file mode 100644 index 00000000..3bc367c6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/plugin/index.js @@ -0,0 +1,18 @@ +"use strict"; + +// IMPORTANT: run `npm rm esformatter-test-plugin && npm i test/plugin` every +// time you update this file! + +exports.setOptions = function(opts) { + opts.foo = 'bar'; + opts.bar = 123; + // makes sure we are able to read default values and edit it + opts.indent.ArrayExpression += 2; + this.opts = opts; +}; + +exports.tokenBefore = function(token) { + if (token.value === 'true') { + token.value = 'false'; + } +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/plugin/package.json b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/plugin/package.json new file mode 100644 index 00000000..ed492aa7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/plugin/package.json @@ -0,0 +1,9 @@ +{ + "private": true, + "name": "esformatter-test-plugin", + "version": "1.0.0", + "description": "test if esformatter is able to load locally installed plugins from the cli", + "main": "index.js", + "author": "Miller Medeiros", + "license": "ISC" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/plugins.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/plugins.spec.js new file mode 100644 index 00000000..d90d06cb --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/plugins.spec.js @@ -0,0 +1,245 @@ +//jshint node:true +/*global describe, it, beforeEach, afterEach*/ +'use strict'; + +var expect = require('chai').expect; +var mockery = require('mockery'); +var esformatter = require('../lib/esformatter'); +var esformatterOptions = require('../lib/options'); +var rocambole = require('rocambole'); +var testPlugin = require('esformatter-test-plugin'); + +var input = 'var foo=lorem?"bar":"baz";'; +var output = 'var foo = lorem ? "bar" : "baz";'; + + +describe('plugin API', function() { + + describe('> register plugin', function() { + var plugin; + + beforeEach(function() { + plugin = makePlugin(); + esformatter.register(plugin); + esformatter.format(input); + }); + + afterEach(function() { + esformatter.unregister(plugin); + }); + + it('should call setOptions and not override user set options', function() { + expect(plugin.setOptions.count).to.eql(1); + expect(plugin.setOptions.args[0].indent.value).to.eql(' '); + }); + + it('should call tokenBefore for each token', function() { + expect(plugin.tokenBefore.count).to.eql(10); + expect(plugin.tokenBefore.args.length).to.eql(10); + expect(plugin.tokenBefore.args[0].value).to.eql('var'); + expect(plugin.tokenBefore.args[4].value).to.eql('lorem'); + }); + + it('should call tokenAfter for each token', function() { + expect(plugin.tokenAfter.count).to.eql(16); + expect(plugin.tokenAfter.args.length).to.eql(16); + expect(plugin.tokenAfter.args[0].value).to.eql('var'); + expect(plugin.tokenAfter.args[6].value).to.eql('lorem'); + }); + + it('should call stringBefore at the begining of process', function() { + expect(plugin.stringBefore.count).to.eql(1); + expect(plugin.stringBefore.args).to.eql([input]); + }); + + it('should call stringAfter at end of process', function() { + expect(plugin.stringAfter.count).to.eql(1); + expect(plugin.stringAfter.args).to.eql([output]); + }); + + it('should call nodeBefore for each node', function() { + expect(plugin.nodeBefore.count).to.eql(8); + expect(plugin.nodeBefore.args[3].toString()).to.eql('foo'); + }); + + it('should call nodeAfter for each node', function() { + expect(plugin.nodeAfter.count).to.eql(8); + expect(plugin.nodeAfter.args[3].toString()).to.eql('foo'); + }); + + it('should call transformBefore once', function() { + expect(plugin.transformBefore.count).to.eql(1); + expect(plugin.transformBefore.args[0].type).to.eql('Program'); + }); + + it('should call transformAfter once', function() { + expect(plugin.transformAfter.count).to.eql(1); + expect(plugin.transformAfter.args[0].type).to.eql('Program'); + }); + + describe('> multiple calls', function() { + it('should call plugin once per transform call', function() { + esformatter.format(input); + expect(plugin.transformAfter.count).to.eql(2); + expect(plugin.transformAfter.args[1].type).to.eql('Program'); + + }); + + it('should not execute plugin if unregistered', function() { + esformatter.unregisterAll(); + esformatter.format(input); + expect(plugin.transformAfter.count).to.eql(1); + expect(plugin.transformAfter.args[0].type).to.eql('Program'); + }); + }); + + }); + + describe('> load from node_modules', function() { + var plugin1; + var plugin2; + + beforeEach(function() { + plugin1 = makePlugin(); + // this should be enough to ensure plugin methods are optional and that + // multiple plugins are executed in a row. + plugin2 = { + // "transform" was deprecated on v0.4 but we still have a test for it + // to make sure we are backwards compatible. + transform: stub() + }; + mockery.registerMock('esformatter-foo', plugin1); + mockery.registerMock('bar', plugin2); + mockery.enable(); + }); + + afterEach(function() { + mockery.deregisterAll(); + mockery.disable(); + }); + + it('format: should load plugins from node_modules and register it', function() { + esformatter.format(input, { + plugins: ['esformatter-foo', 'bar'] + }); + + expect(plugin1.stringBefore.count).to.eql(1); + expect(plugin1.transformBefore.count).to.eql(1); + expect(plugin1.transformAfter.count).to.eql(1); + expect(plugin1.nodeAfter.count).to.eql(8); + expect(plugin2.transform.count).to.eql(1); + expect(plugin1.stringAfter.count).to.eql(1); + }); + + it('transform: should load plugins from node_modules and register it', function() { + esformatter.transform(rocambole.parse(input), { + plugins: ['esformatter-foo', 'bar'] + }); + + expect(plugin1.stringBefore.count).to.eql(0); + expect(plugin1.transformBefore.count).to.eql(1); + expect(plugin1.transformAfter.count).to.eql(1); + expect(plugin1.nodeAfter.count).to.eql(8); + expect(plugin2.transform.count).to.eql(1); + expect(plugin1.stringAfter.count).to.eql(0); + }); + + }); + + describe('> execute in the right order', function() { + var plugin; + + beforeEach(function() { + plugin = makePlugin(); + esformatter.register(plugin); + esformatter.format('\/\/ foo'); + }); + + afterEach(function() { + esformatter.unregister(plugin); + }); + + it('should call methods in the right order', function() { + expect(plugin.callOrder).to.eql([ + 'setOptions', + 'stringBefore', + 'transformBefore', + 'tokenBefore', + 'nodeBefore', + 'nodeAfter', + 'tokenAfter', + 'transformAfter', + 'stringAfter' + ]); + }); + }); + + describe('> setOptions', function() { + var plugin = testPlugin; + var opts = { + foo: 'ipsum' + }; + + beforeEach(function() { + esformatter.register(plugin); + esformatter.format(input, opts); + }); + + afterEach(function() { + esformatter.unregister(plugin); + }); + + it('should set default options and allow user and plugin to override them', function() { + var o = plugin.opts; + // it clones the user proveid options object to avoid undesired side effects + expect(o).not.to.eql(opts); + // it should pass options object by reference + expect(o).to.eql(esformatterOptions.get()); + // user should be able to override options + expect(o.foo).to.eql('ipsum'); + // plugin should be able to create a new value + expect(o.bar).to.eql(123); + // plugin should be able to override a value + expect(o.indent.ArrayExpression).to.eql(3); + // default value + expect(o.indent.value).to.eql(' '); + }); + + }); + +}); + + +// extremely basic stub method, I know I could have used something more +// complex like sinon, but this is good enough for now +function stub(name, isIdentity) { + var fn = function() { + fn.count += 1; + fn.args.push.apply(fn.args, arguments); + if (this.callOrder) this.callOrder.push(name); + if (isIdentity) { + return arguments[0]; + } + }; + + fn.count = 0; + fn.args = []; + + return fn; +} + + +function makePlugin() { + return { + callOrder: [], + setOptions: stub('setOptions'), + stringBefore: stub('stringBefore', true), + stringAfter: stub('stringAfter', true), + tokenBefore: stub('tokenBefore'), + tokenAfter: stub('tokenAfter'), + nodeBefore: stub('nodeBefore'), + nodeAfter: stub('nodeAfter'), + transformAfter: stub('transformAfter'), + transformBefore: stub('transformBefore') + }; +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/runner.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/runner.js new file mode 100644 index 00000000..214b515f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/runner.js @@ -0,0 +1,46 @@ +"use strict"; + +// we run mocha manually otherwise istanbul coverage won't work +// run `npm test --coverage` to generate coverage report + +var Mocha = require('mocha'); + + +// --- + + + +// to set these options run the test script like: +// > BAIL=true GREP=array_expression REPORTER=dot npm test +var opts = { + ui: 'bdd', + bail: !!(process.env.BAIL), + reporter:( process.env.REPORTER || 'spec'), + grep: process.env.GREP +}; + +// we use the dot reporter on travis since it works better +if (process.env.TRAVIS) { + opts.reporter = 'dot'; +} + +var m = new Mocha(opts); + +if (process.env.INVERT) { + m.invert(); +} + + +m.addFile('test/format.spec.js'); +m.addFile('test/transform.spec.js'); +m.addFile('test/cli.spec.js'); +m.addFile('test/api.spec.js'); +m.addFile('test/plugins.spec.js'); +m.addFile('test/pipe.spec.js'); + +m.run(function(err) { + var exitCode = err ? 1 : 0; + if (err) console.log('failed tests: ' + err); + process.exit(exitCode); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/transform.spec.js b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/transform.spec.js new file mode 100644 index 00000000..de10e941 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/esformatter/test/transform.spec.js @@ -0,0 +1,39 @@ +/*jshint node:true*/ +/*global describe:false, it:false*/ +"use strict"; + +var expect = require('chai').expect; + +var esformatter = require('../lib/esformatter'); +var rocambole = require('rocambole'); + + +// --- + + +describe('esformatter.transform()', function() { + + it('should transform rocambole AST in place', function() { + var inputAST = rocambole.parse('var foo = 123;'); + var outputAST = esformatter.transform(inputAST); + expect(outputAST).to.be.equal(inputAST); + }); + + + it('should allow options as second arg', function() { + var inputAST = rocambole.parse('var foo = 123;'); + var outputAST = esformatter.transform(inputAST, { + whiteSpace: { + after: { + VariableName: 0 + }, + before: { + VariableValue: 0 + } + } + }); + expect(outputAST.toString()).to.be.equal('var foo=123;'); + }); + + +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/glob/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/README.md b/node_modules/standard/node_modules/standard-format/node_modules/glob/README.md new file mode 100644 index 00000000..258257ec --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/README.md @@ -0,0 +1,369 @@ +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Dependency Status](https://david-dm.org/isaacs/node-glob.svg)](https://david-dm.org/isaacs/node-glob) [![devDependency Status](https://david-dm.org/isaacs/node-glob/dev-status.svg)](https://david-dm.org/isaacs/node-glob#info=devDependencies) [![optionalDependency Status](https://david-dm.org/isaacs/node-glob/optional-status.svg)](https://david-dm.org/isaacs/node-glob#info=optionalDependencies) + +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![](oh-my-glob.gif) + +## Usage + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Negation + +The intent for negation would be for a pattern starting with `!` to +match everything that *doesn't* match the supplied pattern. However, +the implementation is weird, and for the time being, this should be +avoided. The behavior will change or be deprecated in version 5. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` {String} Pattern to be matched +* `options` {Object} +* `cb` {Function} + * `err` {Error | null} + * `matches` {Array} filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` {String} Pattern to be matched +* `options` {Object} +* return: {Array} filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` {String} pattern to search for +* `options` {Object} +* `cb` {Function} Called when an error occurs, or matches are found + * `err` {Error | null} + * `matches` {Array} filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `statCache` Collection of all the stat results the glob search + performed. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'DIR'` - Path exists, and is not a directory + * `'FILE'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the matched. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nonegate` Suppress `negate` behavior. (See below.) +* `nocomment` Suppress `comment` behavior. (See below.) +* `nonull` Return the pattern when no matches are found. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of patterns to exclude matches. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/common.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/common.js new file mode 100644 index 00000000..cd7c8244 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/common.js @@ -0,0 +1,237 @@ +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.isAbsolute = process.platform === "win32" ? absWin : absUnix +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = require("path") +var minimatch = require("minimatch") +var Minimatch = minimatch.Minimatch + +function absWin (p) { + if (absUnix(p)) return true + // pull off the device/UNC bit from a windows path. + // from node's lib/path.js + var splitDeviceRe = + /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/ + var result = splitDeviceRe.exec(p) + var device = result[1] || '' + var isUnc = device && device.charAt(1) !== ':' + var isAbsolute = !!result[2] || isUnc // UNC paths are always absolute + + return isAbsolute +} + +function absUnix (p) { + return p.charAt(0) === "/" || p === "" +} + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { nonegate: true }) + } + + return { + matcher: new Minimatch(pattern, { nonegate: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = options.cwd + self.changedCwd = path.resolve(options.cwd) !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + self.nomount = !!options.nomount + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + return !(/\/$/.test(e)) + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (exports.isAbsolute(f)) { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else if (self.realpath) { + abs = path.resolve(f) + } + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/glob.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/glob.js new file mode 100644 index 00000000..eac0693c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/glob.js @@ -0,0 +1,740 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var globSync = require('./sync.js') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var isAbsolute = common.isAbsolute +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +glob.hasMagic = function (pattern, options_) { + var options = util._extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + var n = this.minimatch.set.length + this._processing = 0 + this.matches = new Array(n) + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + + function done () { + --self._processing + if (self._processing <= 0) + self._finish() + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + fs.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (this.matches[index][e]) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = this._makeAbs(e) + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + if (this.mark) + e = this._mark(e) + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er) + return cb() + + var isSym = lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) return this.emit('error', er) + if (!this.silent) console.error('glob error', er) + break + } + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && !stat.isDirectory()) + return cb(null, false, stat) + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return cb() + + return cb(null, c, stat) +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/.eslintrc b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/.eslintrc new file mode 100644 index 00000000..b7a1550e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/.eslintrc @@ -0,0 +1,17 @@ +{ + "env" : { + "node" : true + }, + "rules" : { + "semi": [2, "never"], + "strict": 0, + "quotes": [1, "single", "avoid-escape"], + "no-use-before-define": 0, + "curly": 0, + "no-underscore-dangle": 0, + "no-lonely-if": 1, + "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], + "no-mixed-requires": 0, + "space-infix-ops": 0 + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/LICENSE new file mode 100644 index 00000000..05eeeb88 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/README.md b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/README.md new file mode 100644 index 00000000..6dc89291 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/inflight.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/inflight.js new file mode 100644 index 00000000..8bc96cbd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/inflight.js @@ -0,0 +1,44 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/package.json b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/package.json new file mode 100644 index 00000000..a6645bc5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/package.json @@ -0,0 +1,61 @@ +{ + "name": "inflight", + "version": "1.0.4", + "description": "Add callbacks to requests in flight to avoid async duplication", + "main": "inflight.js", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^0.4.10" + }, + "scripts": { + "test": "tap test.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inflight" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC", + "gitHead": "c7b5531d572a867064d4a1da9e013e8910b7d1ba", + "_id": "inflight@1.0.4", + "_shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", + "_from": "inflight@>=1.0.4 <2.0.0", + "_npmVersion": "2.1.3", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + { + "name": "iarna", + "email": "me@re-becca.org" + } + ], + "dist": { + "shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", + "tarball": "http://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/test.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/test.js new file mode 100644 index 00000000..2bb75b38 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inflight/test.js @@ -0,0 +1,97 @@ +var test = require('tap').test +var inf = require('./inflight.js') + + +function req (key, cb) { + cb = inf(key, cb) + if (cb) setTimeout(function () { + cb(key) + cb(key) + }) + return cb +} + +test('basic', function (t) { + var calleda = false + var a = req('key', function (k) { + t.notOk(calleda) + calleda = true + t.equal(k, 'key') + if (calledb) t.end() + }) + t.ok(a, 'first returned cb function') + + var calledb = false + var b = req('key', function (k) { + t.notOk(calledb) + calledb = true + t.equal(k, 'key') + if (calleda) t.end() + }) + + t.notOk(b, 'second should get falsey inflight response') +}) + +test('timing', function (t) { + var expect = [ + 'method one', + 'start one', + 'end one', + 'two', + 'tick', + 'three' + ] + var i = 0 + + function log (m) { + t.equal(m, expect[i], m + ' === ' + expect[i]) + ++i + if (i === expect.length) + t.end() + } + + function method (name, cb) { + log('method ' + name) + process.nextTick(cb) + } + + var one = inf('foo', function () { + log('start one') + var three = inf('foo', function () { + log('three') + }) + if (three) method('three', three) + log('end one') + }) + + method('one', one) + + var two = inf('foo', function () { + log('two') + }) + if (two) method('one', two) + + process.nextTick(log.bind(null, 'tick')) +}) + +test('parameters', function (t) { + t.plan(8) + + var a = inf('key', function (first, second, third) { + t.equal(first, 1) + t.equal(second, 2) + t.equal(third, 3) + }) + t.ok(a, 'first returned cb function') + + var b = inf('key', function (first, second, third) { + t.equal(first, 1) + t.equal(second, 2) + t.equal(third, 3) + }) + t.notOk(b, 'second should get falsey inflight response') + + setTimeout(function () { + a(1, 2, 3) + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/LICENSE new file mode 100644 index 00000000..dea3013d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/README.md b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/README.md new file mode 100644 index 00000000..b1c56658 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/inherits.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/inherits.js new file mode 100644 index 00000000..29f5e24f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/inherits.js @@ -0,0 +1 @@ +module.exports = require('util').inherits diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/inherits_browser.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/inherits_browser.js new file mode 100644 index 00000000..c1e78a75 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/package.json b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/package.json new file mode 100644 index 00000000..a703bddd --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/package.json @@ -0,0 +1,50 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.1", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits" + }, + "license": "ISC", + "scripts": { + "test": "node test" + }, + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "_id": "inherits@2.0.1", + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "_from": "inherits@>=2.0.0 <3.0.0", + "_npmVersion": "1.3.8", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/isaacs/inherits" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/test.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/test.js new file mode 100644 index 00000000..fc53012d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/inherits/test.js @@ -0,0 +1,25 @@ +var inherits = require('./inherits.js') +var assert = require('assert') + +function test(c) { + assert(c.constructor === Child) + assert(c.constructor.super_ === Parent) + assert(Object.getPrototypeOf(c) === Child.prototype) + assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) + assert(c instanceof Child) + assert(c instanceof Parent) +} + +function Child() { + Parent.call(this) + test(this) +} + +function Parent() {} + +inherits(Child, Parent) + +var c = new Child +test(c) + +console.log('ok') diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/README.md b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/README.md new file mode 100644 index 00000000..a2981ea0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/README.md @@ -0,0 +1,51 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/README.md b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/package.json b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/once.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/once.js new file mode 100644 index 00000000..2e1e721b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/once.js @@ -0,0 +1,21 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/package.json b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/package.json new file mode 100644 index 00000000..8f46e507 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/package.json @@ -0,0 +1,60 @@ +{ + "name": "once", + "version": "1.3.2", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "~0.3.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once.git" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "gitHead": "e35eed5a7867574e2bf2260a1ba23970958b22f2", + "bugs": { + "url": "https://github.com/isaacs/once/issues" + }, + "homepage": "https://github.com/isaacs/once#readme", + "_id": "once@1.3.2", + "_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "_from": "once@>=1.3.0 <2.0.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "tarball": "http://registry.npmjs.org/once/-/once-1.3.2.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "_resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/test/once.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/test/once.js new file mode 100644 index 00000000..c618360d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/node_modules/once/test/once.js @@ -0,0 +1,23 @@ +var test = require('tap').test +var once = require('../once.js') + +test('once', function (t) { + var f = 0 + function fn (g) { + t.equal(f, 0) + f ++ + return f + g + this + } + fn.ownProperty = {} + var foo = once(fn) + t.equal(fn.ownProperty, foo.ownProperty) + t.notOk(foo.called) + for (var i = 0; i < 1E3; i++) { + t.same(f, i === 0 ? 0 : 1) + var g = foo.call(1, 1) + t.ok(foo.called) + t.same(g, 3) + t.same(f, 1) + } + t.end() +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/package.json b/node_modules/standard/node_modules/standard-format/node_modules/glob/package.json new file mode 100644 index 00000000..af4269f8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/package.json @@ -0,0 +1,72 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "name": "glob", + "description": "a little globber", + "version": "4.5.3", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "engines": { + "node": "*" + }, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^2.0.1", + "once": "^1.3.0" + }, + "devDependencies": { + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^0.5.0", + "tick": "0.0.6" + }, + "scripts": { + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "npm run profclean && tap test/*.js", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "bash benchclean.sh" + }, + "license": "ISC", + "gitHead": "a4e461ab59a837eee80a4d8dbdbf5ae1054a646f", + "bugs": { + "url": "https://github.com/isaacs/node-glob/issues" + }, + "homepage": "https://github.com/isaacs/node-glob", + "_id": "glob@4.5.3", + "_shasum": "c6cb73d3226c1efef04de3c56d012f03377ee15f", + "_from": "glob@>=4.3.5 <5.0.0", + "_npmVersion": "2.7.1", + "_nodeVersion": "1.4.2", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "c6cb73d3226c1efef04de3c56d012f03377ee15f", + "tarball": "http://registry.npmjs.org/glob/-/glob-4.5.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/glob/sync.js b/node_modules/standard/node_modules/standard-format/node_modules/glob/sync.js new file mode 100644 index 00000000..f4f5e36d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/glob/sync.js @@ -0,0 +1,457 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var isAbsolute = common.isAbsolute +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = fs.realpathSync(p, this.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this.matches[index][e] = true + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + var abs = this._makeAbs(e) + if (this.mark) + e = this._mark(e) + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[this._makeAbs(e)] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + // lstat failed, doesn't exist + return null + } + + var isSym = lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) throw er + if (!this.silent) console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this.matches[index][prefix] = true +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + return false + } + + if (lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..05a40109 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +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/node_modules/standard/node_modules/standard-format/node_modules/minimatch/README.md b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/README.md new file mode 100644 index 00000000..d458bc2e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/README.md @@ -0,0 +1,216 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instanting the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +## Functions + +The top-level exported function has a `cache` property, which is an LRU +cache set to store 100 items. So, calling these methods repeatedly +with the same pattern and options will use the same Minimatch object, +saving the cost of parsing it multiple times. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/browser.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/browser.js new file mode 100644 index 00000000..967b45c0 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/browser.js @@ -0,0 +1,1113 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} + +},{"brace-expansion":2,"path":undefined}],2:[function(require,module,exports){ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + var expansions = expand(escapeBraces(str)); + return expansions.filter(identity).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0]).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + expansions.push([pre, N[j], post[k]].join('')) + } + } + + return expansions; +} + + +},{"balanced-match":3,"concat-map":4}],3:[function(require,module,exports){ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} + +},{}],4:[function(require,module,exports){ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (Array.isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +},{}]},{},[1]); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/minimatch.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000..5e13d6d5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/minimatch.js @@ -0,0 +1,867 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/.npmignore new file mode 100644 index 00000000..249bc20e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/.npmignore @@ -0,0 +1,2 @@ +node_modules +*.sw* diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/.travis.yml new file mode 100644 index 00000000..6e5919de --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/README.md b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/README.md new file mode 100644 index 00000000..62bc7bae --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/README.md @@ -0,0 +1,121 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/example.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/example.js new file mode 100644 index 00000000..60ecfc74 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/example.js @@ -0,0 +1,8 @@ +var expand = require('./'); + +console.log(expand('http://any.org/archive{1996..1999}/vol{1..4}/part{a,b,c}.html')); +console.log(expand('http://www.numericals.com/file{1..100..10}.txt')); +console.log(expand('http://www.letters.com/file{a..z..2}.txt')); +console.log(expand('mkdir /usr/local/src/bash/{old,new,dist,bugs}')); +console.log(expand('chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}')); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/index.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/index.js new file mode 100644 index 00000000..a23104e9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/index.js @@ -0,0 +1,191 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore new file mode 100644 index 00000000..fd4f2b06 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile new file mode 100644 index 00000000..fa5da71a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile @@ -0,0 +1,6 @@ + +test: + @node_modules/.bin/tape test/*.js + +.PHONY: test + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md new file mode 100644 index 00000000..2aff0ebf --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md @@ -0,0 +1,80 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js new file mode 100644 index 00000000..c02ad348 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js @@ -0,0 +1,5 @@ +var balanced = require('./'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js new file mode 100644 index 00000000..d165ae81 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -0,0 +1,38 @@ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json new file mode 100644 index 00000000..ede6efef --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -0,0 +1,73 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "0.2.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.1" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "ba40ed78e7114a4a67c51da768a100184dead39c", + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "_id": "balanced-match@0.2.0", + "_shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "_from": "balanced-match@>=0.2.0 <0.3.0", + "_npmVersion": "2.1.8", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "dist": { + "shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js new file mode 100644 index 00000000..36bfd399 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js @@ -0,0 +1,56 @@ +var test = require('tape'); +var balanced = require('..'); + +test('balanced', function(t) { + t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), { + start: 3, + end: 12, + pre: 'pre', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), { + start: 8, + end: 11, + pre: '{{{{{{{{', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body{in}post'), { + start: 8, + end: 11, + pre: 'pre{body', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), { + start: 4, + end: 13, + pre: 'pre}', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), { + start: 3, + end: 8, + pre: 'pre', + body: 'body', + post: 'between{body2}post' + }); + t.notOk(balanced('{', '}', 'nope'), 'should be notOk'); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 3, + end: 19, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 7, + end: 23, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml new file mode 100644 index 00000000..f1d0f13c --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown new file mode 100644 index 00000000..408f70a1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js new file mode 100644 index 00000000..33656217 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js new file mode 100644 index 00000000..b29a7812 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json new file mode 100644 index 00000000..b5161380 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json @@ -0,0 +1,83 @@ +{ + "name": "concat-map", + "description": "concatenative mapdashery", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-concat-map.git" + }, + "main": "index.js", + "keywords": [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories": { + "example": "example", + "test": "test" + }, + "scripts": { + "test": "tape test/*.js" + }, + "devDependencies": { + "tape": "~2.4.0" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "bugs": { + "url": "https://github.com/substack/node-concat-map/issues" + }, + "homepage": "https://github.com/substack/node-concat-map", + "_id": "concat-map@0.0.1", + "dist": { + "shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "tarball": "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + }, + "_from": "concat-map@0.0.1", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js new file mode 100644 index 00000000..fdbd7022 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/package.json b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/package.json new file mode 100644 index 00000000..5f1866c8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -0,0 +1,75 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh" + }, + "dependencies": { + "balanced-match": "^0.2.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "tape": "^3.0.3" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "b5fa3b1c74e5e2dba2d0efa19b28335641bc1164", + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "_id": "brace-expansion@1.1.0", + "_shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "_from": "brace-expansion@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + } + ], + "dist": { + "shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js new file mode 100644 index 00000000..5fe2b8ad --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var expand = require('..'); +var fs = require('fs'); +var resfile = __dirname + '/bash-results.txt'; +var cases = fs.readFileSync(resfile, 'utf8').split('><><><><'); + +// throw away the EOF marker +cases.pop() + +test('matches bash expansions', function(t) { + cases.forEach(function(testcase) { + var set = testcase.split('\n'); + var pattern = set.shift(); + var actual = expand(pattern); + + // If it expands to the empty string, then it's actually + // just nothing, but Bash is a singly typed language, so + // "nothing" is the same as "". + if (set.length === 1 && set[0] === '') { + set = [] + } else { + // otherwise, strip off the [] that were added so that + // "" expansions would be preserved properly. + set = set.map(function (s) { + return s.replace(/^\[|\]$/g, '') + }) + } + + t.same(actual, set, pattern); + }); + t.end(); +}) diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt new file mode 100644 index 00000000..958148d2 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt @@ -0,0 +1,1075 @@ +A{b,{d,e},{f,g}}Z +[AbZ] +[AdZ] +[AeZ] +[AfZ] +[AgZ]><><><><><><><\{a,b}{{a,b},a,b} +[{a,b}a] +[{a,b}b] +[{a,b}a] +[{a,b}b]><><><><{{a,b} +[{a] +[{b]><><><><{a,b}} +[a}] +[b}]><><><><{,} +><><><><><><><{,}b +[b] +[b]><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><{-01..5} +[-01] +[000] +[001] +[002] +[003] +[004] +[005]><><><><{-05..100..5} +[-05] +[000] +[005] +[010] +[015] +[020] +[025] +[030] +[035] +[040] +[045] +[050] +[055] +[060] +[065] +[070] +[075] +[080] +[085] +[090] +[095] +[100]><><><><{-05..100} +[-05] +[-04] +[-03] +[-02] +[-01] +[000] +[001] +[002] +[003] +[004] +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0..5..2} +[0] +[2] +[4]><><><><{0001..05..2} +[0001] +[0003] +[0005]><><><><{0001..-5..2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..-5..-2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..5..-2} +[0001] +[0003] +[0005]><><><><{01..5} +[01] +[02] +[03] +[04] +[05]><><><><{1..05} +[01] +[02] +[03] +[04] +[05]><><><><{1..05..3} +[01] +[04]><><><><{05..100} +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0a..0z} +[{0a..0z}]><><><><{a,b\}c,d} +[a] +[b}c] +[d]><><><><{a,b{c,d} +[{a,bc] +[{a,bd]><><><><{a,b}c,d} +[ac,d}] +[bc,d}]><><><><{a..F} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F]><><><><{A..f} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f]><><><><{a..Z} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z]><><><><{A..z} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{z..A} +[z] +[y] +[x] +[w] +[v] +[u] +[t] +[s] +[r] +[q] +[p] +[o] +[n] +[m] +[l] +[k] +[j] +[i] +[h] +[g] +[f] +[e] +[d] +[c] +[b] +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{Z..a} +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{a..F..2} +[a] +[_] +[]] +[[] +[Y] +[W] +[U] +[S] +[Q] +[O] +[M] +[K] +[I] +[G]><><><><{A..f..02} +[A] +[C] +[E] +[G] +[I] +[K] +[M] +[O] +[Q] +[S] +[U] +[W] +[Y] +[[] +[]] +[_] +[a] +[c] +[e]><><><><{a..Z..5} +[a] +[]><><><><><><><{A..z..10} +[A] +[K] +[U] +[_] +[i] +[s]><><><><{z..A..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b] +[`] +[^] +[] +[Z] +[X] +[V] +[T] +[R] +[P] +[N] +[L] +[J] +[H] +[F] +[D] +[B]><><><><{Z..a..20} +[Z]><><><><{a{,b} +[{a] +[{ab]><><><><{a},b} +[a}] +[b]><><><><{x,y{,}g} +[x] +[yg] +[yg]><><><><{x,y{}g} +[x] +[y{}g]><><><><{{a,b} +[{a] +[{b]><><><><{{a,b},c} +[a] +[b] +[c]><><><><{{a,b}c} +[{ac}] +[{bc}]><><><><{{a,b},} +[a] +[b]><><><><><><><{{a,b},}c +[ac] +[bc] +[c]><><><><{{a,b}.} +[{a.}] +[{b.}]><><><><{{a,b}} +[{a}] +[{b}]><><><><><><>< +><><><><{-10..00} +[-10] +[-09] +[-08] +[-07] +[-06] +[-05] +[-04] +[-03] +[-02] +[-01] +[000]><><><><{a,\\{a,b}c} +[a] +[\ac] +[\bc]><><><><{a,\{a,b}c} +[ac}] +[{ac}] +[bc}]><><><><><><><{-10.\.00} +[{-10..00}]><><><><><><><><><><{l,n,m}xyz +[lxyz] +[nxyz] +[mxyz]><><><><{abc\,def} +[{abc,def}]><><><><{abc} +[{abc}]><><><><{x\,y,\{abc\},trie} +[x,y] +[{abc}] +[trie]><><><><{} +[{}]><><><><} +[}]><><><><{ +[{]><><><><><><><{1..10} +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10]><><><><{0..10,braces} +[0..10] +[braces]><><><><{{0..10},braces} +[0] +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10] +[braces]><><><><><><><{3..3} +[3]><><><><><><><{10..1} +[10] +[9] +[8] +[7] +[6] +[5] +[4] +[3] +[2] +[1]><><><><{10..1}y +[10y] +[9y] +[8y] +[7y] +[6y] +[5y] +[4y] +[3y] +[2y] +[1y]><><><><><><><{a..f} +[a] +[b] +[c] +[d] +[e] +[f]><><><><{f..a} +[f] +[e] +[d] +[c] +[b] +[a]><><><><{a..A} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{A..a} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{f..f} +[f]><><><><{1..f} +[{1..f}]><><><><{f..1} +[{f..1}]><><><><{-1..-10} +[-1] +[-2] +[-3] +[-4] +[-5] +[-6] +[-7] +[-8] +[-9] +[-10]><><><><{-20..0} +[-20] +[-19] +[-18] +[-17] +[-16] +[-15] +[-14] +[-13] +[-12] +[-11] +[-10] +[-9] +[-8] +[-7] +[-6] +[-5] +[-4] +[-3] +[-2] +[-1] +[0]><><><><><><><><><><{klklkl}{1,2,3} +[{klklkl}1] +[{klklkl}2] +[{klklkl}3]><><><><{1..10..2} +[1] +[3] +[5] +[7] +[9]><><><><{-1..-10..2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{-1..-10..-2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{10..1..-2} +[10] +[8] +[6] +[4] +[2]><><><><{10..1..2} +[10] +[8] +[6] +[4] +[2]><><><><{1..20..2} +[1] +[3] +[5] +[7] +[9] +[11] +[13] +[15] +[17] +[19]><><><><{1..20..20} +[1]><><><><{100..0..5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{100..0..-5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{a..z} +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{a..z..2} +[a] +[c] +[e] +[g] +[i] +[k] +[m] +[o] +[q] +[s] +[u] +[w] +[y]><><><><{z..a..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b]><><><><{2147483645..2147483649} +[2147483645] +[2147483646] +[2147483647] +[2147483648] +[2147483649]><><><><{10..0..2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{10..0..-2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{-50..-0..5} +[-50] +[-45] +[-40] +[-35] +[-30] +[-25] +[-20] +[-15] +[-10] +[-5] +[0]><><><><{1..10.f} +[{1..10.f}]><><><><{1..ff} +[{1..ff}]><><><><{1..10..ff} +[{1..10..ff}]><><><><{1.20..2} +[{1.20..2}]><><><><{1..20..f2} +[{1..20..f2}]><><><><{1..20..2f} +[{1..20..2f}]><><><><{1..2f..2} +[{1..2f..2}]><><><><{1..ff..2} +[{1..ff..2}]><><><><{1..ff} +[{1..ff}]><><><><{1..f} +[{1..f}]><><><><{1..0f} +[{1..0f}]><><><><{1..10f} +[{1..10f}]><><><><{1..10.f} +[{1..10.f}]><><><><{1..10.f} +[{1..10.f}]><><><>< \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt new file mode 100644 index 00000000..e5161c3d --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt @@ -0,0 +1,182 @@ +# skip quotes for now +# "{x,x}" +# {"x,x"} +# {x","x} +# '{a,b}{{a,b},a,b}' +A{b,{d,e},{f,g}}Z +PRE-{a,b}{{a,b},a,b}-POST +\\{a,b}{{a,b},a,b} +{{a,b} +{a,b}} +{,} +a{,} +{,}b +a{,}b +a{b}c +a{1..5}b +a{01..5}b +a{-01..5}b +a{-01..5..3}b +a{001..9}b +a{b,c{d,e},{f,g}h}x{y,z +a{b,c{d,e},{f,g}h}x{y,z\\} +a{b,c{d,e},{f,g}h}x{y,z} +a{b{c{d,e}f{x,y{{g}h +a{b{c{d,e}f{x,y{}g}h +a{b{c{d,e}f{x,y}}g}h +a{b{c{d,e}f}g}h +a{{x,y},z}b +f{x,y{g,z}}h +f{x,y{{g,z}}h +f{x,y{{g,z}}h} +f{x,y{{g}h +f{x,y{{g}}h +f{x,y{}g}h +z{a,b{,c}d +z{a,b},c}d +{-01..5} +{-05..100..5} +{-05..100} +{0..5..2} +{0001..05..2} +{0001..-5..2} +{0001..-5..-2} +{0001..5..-2} +{01..5} +{1..05} +{1..05..3} +{05..100} +{0a..0z} +{a,b\\}c,d} +{a,b{c,d} +{a,b}c,d} +{a..F} +{A..f} +{a..Z} +{A..z} +{z..A} +{Z..a} +{a..F..2} +{A..f..02} +{a..Z..5} +d{a..Z..5}b +{A..z..10} +{z..A..-2} +{Z..a..20} +{a{,b} +{a},b} +{x,y{,}g} +{x,y{}g} +{{a,b} +{{a,b},c} +{{a,b}c} +{{a,b},} +X{{a,b},}X +{{a,b},}c +{{a,b}.} +{{a,b}} +X{a..#}X +# this next one is an empty string + +{-10..00} +# Need to escape slashes in here for reasons i guess. +{a,\\\\{a,b}c} +{a,\\{a,b}c} +a,\\{b,c} +{-10.\\.00} +#### bash tests/braces.tests +# Note that some tests are edited out because some features of +# bash are intentionally not supported in this brace expander. +ff{c,b,a} +f{d,e,f}g +{l,n,m}xyz +{abc\\,def} +{abc} +{x\\,y,\\{abc\\},trie} +# not impementing back-ticks obviously +# XXXX\\{`echo a b c | tr ' ' ','`\\} +{} +# We only ever have to worry about parsing a single argument, +# not a command line, so spaces have a different meaning than bash. +# { } +} +{ +abcd{efgh +# spaces +# foo {1,2} bar +# not impementing back-ticks obviously +# `zecho foo {1,2} bar` +# $(zecho foo {1,2} bar) +# ${var} is not a variable here, like it is in bash. omit. +# foo{bar,${var}.} +# foo{bar,${var}} +# isaacs: skip quotes for now +# "${var}"{x,y} +# $var{x,y} +# ${var}{x,y} +# new sequence brace operators +{1..10} +# this doesn't work yet +{0..10,braces} +# but this does +{{0..10},braces} +x{{0..10},braces}y +{3..3} +x{3..3}y +{10..1} +{10..1}y +x{10..1}y +{a..f} +{f..a} +{a..A} +{A..a} +{f..f} +# mixes are incorrectly-formed brace expansions +{1..f} +{f..1} +# spaces +# 0{1..9} {10..20} +# do negative numbers work? +{-1..-10} +{-20..0} +# weirdly-formed brace expansions -- fixed in post-bash-3.1 +a-{b{d,e}}-c +a-{bdef-{g,i}-c +# isaacs: skip quotes for now +# {"klklkl"}{1,2,3} +# isaacs: this is a valid test, though +{klklkl}{1,2,3} +# {"x,x"} +{1..10..2} +{-1..-10..2} +{-1..-10..-2} +{10..1..-2} +{10..1..2} +{1..20..2} +{1..20..20} +{100..0..5} +{100..0..-5} +{a..z} +{a..z..2} +{z..a..-2} +# make sure brace expansion handles ints > 2**31 - 1 using intmax_t +{2147483645..2147483649} +# unwanted zero-padding -- fixed post-bash-4.0 +{10..0..2} +{10..0..-2} +{-50..-0..5} +# bad +{1..10.f} +{1..ff} +{1..10..ff} +{1.20..2} +{1..20..f2} +{1..20..2f} +{1..2f..2} +{1..ff..2} +{1..ff} +{1..f} +{1..0f} +{1..10f} +{1..10.f} +{1..10.f} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js new file mode 100644 index 00000000..3fcc185a --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var expand = require('..'); + +test('ignores ${', function(t) { + t.deepEqual(expand('${1..3}'), ['${1..3}']); + t.deepEqual(expand('${a,b}${c,d}'), ['${a,b}${c,d}']); + t.deepEqual(expand('x${a,b}x${c,d}x'), ['x${a,b}x${c,d}x']); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js new file mode 100644 index 00000000..e429121e --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('empty option', function(t) { + t.deepEqual(expand('-v{,,,,}'), [ + '-v', '-v', '-v', '-v', '-v' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh new file mode 100644 index 00000000..e040e664 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +# Bash 4.3 because of arbitrary need to pick a single standard. + +if [ "${BASH_VERSINFO[0]}" != "4" ] || [ "${BASH_VERSINFO[1]}" != "3" ]; then + echo "this script requires bash 4.3" >&2 + exit 1 +fi + +CDPATH= cd "$(dirname "$0")" + +js='require("./")(process.argv[1]).join(" ")' + +cat cases.txt | \ + while read case; do + if [ "${case:0:1}" = "#" ]; then + continue; + fi; + b="$($BASH -c 'for c in '"$case"'; do echo ["$c"]; done')" + echo "$case" + echo -n "$b><><><><"; + done > bash-results.txt diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js new file mode 100644 index 00000000..8d434c23 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var expand = require('..'); + +test('negative increment', function(t) { + t.deepEqual(expand('{3..1}'), ['3', '2', '1']); + t.deepEqual(expand('{10..8}'), ['10', '9', '8']); + t.deepEqual(expand('{10..08}'), ['10', '09', '08']); + t.deepEqual(expand('{c..a}'), ['c', 'b', 'a']); + + t.deepEqual(expand('{4..0..2}'), ['4', '2', '0']); + t.deepEqual(expand('{4..0..-2}'), ['4', '2', '0']); + t.deepEqual(expand('{e..a..2}'), ['e', 'c', 'a']); + + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/nested.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/nested.js new file mode 100644 index 00000000..0862dc51 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/nested.js @@ -0,0 +1,16 @@ +var test = require('tape'); +var expand = require('..'); + +test('nested', function(t) { + t.deepEqual(expand('{a,b{1..3},c}'), [ + 'a', 'b1', 'b2', 'b3', 'c' + ]); + t.deepEqual(expand('{{A..Z},{a..z}}'), + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('') + ); + t.deepEqual(expand('ppp{,config,oe{,conf}}'), [ + 'ppp', 'pppconfig', 'pppoe', 'pppoeconf' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/order.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/order.js new file mode 100644 index 00000000..c00ad155 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/order.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('order', function(t) { + t.deepEqual(expand('a{d,c,b}e'), [ + 'ade', 'ace', 'abe' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/pad.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/pad.js new file mode 100644 index 00000000..e4158775 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/pad.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var expand = require('..'); + +test('pad', function(t) { + t.deepEqual(expand('{9..11}'), [ + '9', '10', '11' + ]); + t.deepEqual(expand('{09..11}'), [ + '09', '10', '11' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js new file mode 100644 index 00000000..3038fba7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js @@ -0,0 +1,7 @@ +var test = require('tape'); +var expand = require('..'); + +test('x and y of same type', function(t) { + t.deepEqual(expand('{a..9}'), ['{a..9}']); + t.end(); +}); diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js new file mode 100644 index 00000000..f73a9579 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js @@ -0,0 +1,50 @@ +var test = require('tape'); +var expand = require('..'); + +test('numeric sequences', function(t) { + t.deepEqual(expand('a{1..2}b{2..3}c'), [ + 'a1b2c', 'a1b3c', 'a2b2c', 'a2b3c' + ]); + t.deepEqual(expand('{1..2}{2..3}'), [ + '12', '13', '22', '23' + ]); + t.end(); +}); + +test('numeric sequences with step count', function(t) { + t.deepEqual(expand('{0..8..2}'), [ + '0', '2', '4', '6', '8' + ]); + t.deepEqual(expand('{1..8..2}'), [ + '1', '3', '5', '7' + ]); + t.end(); +}); + +test('numeric sequence with negative x / y', function(t) { + t.deepEqual(expand('{3..-2}'), [ + '3', '2', '1', '0', '-1', '-2' + ]); + t.end(); +}); + +test('alphabetic sequences', function(t) { + t.deepEqual(expand('1{a..b}2{b..c}3'), [ + '1a2b3', '1a2c3', '1b2b3', '1b2c3' + ]); + t.deepEqual(expand('{a..b}{b..c}'), [ + 'ab', 'ac', 'bb', 'bc' + ]); + t.end(); +}); + +test('alphabetic sequences with step count', function(t) { + t.deepEqual(expand('{a..k..2}'), [ + 'a', 'c', 'e', 'g', 'i', 'k' + ]); + t.deepEqual(expand('{b..k..2}'), [ + 'b', 'd', 'f', 'h', 'j' + ]); + t.end(); +}); + diff --git a/node_modules/standard/node_modules/standard-format/node_modules/minimatch/package.json b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/package.json new file mode 100644 index 00000000..b438bdb9 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/minimatch/package.json @@ -0,0 +1,66 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "2.0.7", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "pretest": "standard minimatch.js test/*.js", + "test": "tap test/*.js", + "prepublish": "browserify -o browser.js -e minimatch.js --bare" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.0.0" + }, + "devDependencies": { + "browserify": "^9.0.3", + "standard": "^3.7.2", + "tap": "" + }, + "license": { + "type": "MIT", + "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" + }, + "files": [ + "minimatch.js", + "browser.js" + ], + "gitHead": "4bd6dc22c248c7ea07cc49d63181fe6f6aafae9c", + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" + }, + "homepage": "https://github.com/isaacs/minimatch", + "_id": "minimatch@2.0.7", + "_shasum": "d23652ab10e663e7d914602e920e21f9f66492be", + "_from": "minimatch@>=2.0.1 <3.0.0", + "_npmVersion": "2.7.6", + "_nodeVersion": "1.7.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d23652ab10e663e7d914602e920e21f9f66492be", + "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/node_modules/stdin/.npmignore b/node_modules/standard/node_modules/standard-format/node_modules/stdin/.npmignore new file mode 100644 index 00000000..f1250e58 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/stdin/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/standard/node_modules/standard-format/node_modules/stdin/History.md b/node_modules/standard/node_modules/standard-format/node_modules/stdin/History.md new file mode 100644 index 00000000..c8aa68fa --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/stdin/History.md @@ -0,0 +1,5 @@ + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/standard/node_modules/standard-format/node_modules/stdin/Makefile b/node_modules/standard/node_modules/standard-format/node_modules/stdin/Makefile new file mode 100644 index 00000000..4e9c8d36 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/stdin/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/stdin/Readme.md b/node_modules/standard/node_modules/standard-format/node_modules/stdin/Readme.md new file mode 100644 index 00000000..ba821a74 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/stdin/Readme.md @@ -0,0 +1,36 @@ + +# stdin + + Because stdin with node is annoying + +```js +var stdin = reqiure('stdin'); +stdin(function(str){ + +}); +``` + +## License + +(The MIT License) + +Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> + +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. \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/stdin/index.js b/node_modules/standard/node_modules/standard-format/node_modules/stdin/index.js new file mode 100644 index 00000000..47c6f201 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/stdin/index.js @@ -0,0 +1,9 @@ + +module.exports = function(fn){ + var buf = ''; + process.stdin.setEncoding('utf8'); + process.stdin.on('data', function(s){ buf += s }); + process.stdin.on('end', function(){ + fn(buf); + }).resume(); +}; \ No newline at end of file diff --git a/node_modules/standard/node_modules/standard-format/node_modules/stdin/package.json b/node_modules/standard/node_modules/standard-format/node_modules/stdin/package.json new file mode 100644 index 00000000..b01e5bb4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/node_modules/stdin/package.json @@ -0,0 +1,38 @@ +{ + "name": "stdin", + "version": "0.0.1", + "description": "Because stdin with node is annoying", + "keywords": [], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "main": "index", + "readme": "\n# stdin\n\n Because stdin with node is annoying\n\n```js\nvar stdin = reqiure('stdin');\nstdin(function(str){\n \n});\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", + "readmeFilename": "Readme.md", + "_id": "stdin@0.0.1", + "dist": { + "shasum": "d3041981aaec3dfdbc77a1b38d6372e38f5fb71e", + "tarball": "http://registry.npmjs.org/stdin/-/stdin-0.0.1.tgz" + }, + "_npmVersion": "1.1.64", + "_npmUser": { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + } + ], + "directories": {}, + "_shasum": "d3041981aaec3dfdbc77a1b38d6372e38f5fb71e", + "_resolved": "https://registry.npmjs.org/stdin/-/stdin-0.0.1.tgz", + "_from": "stdin@0.0.1" +} diff --git a/node_modules/standard/node_modules/standard-format/package.json b/node_modules/standard/node_modules/standard-format/package.json new file mode 100644 index 00000000..b82540be --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/package.json @@ -0,0 +1,94 @@ +{ + "name": "standard-format", + "version": "1.3.6", + "description": "attempts to reformat javascript to comply with feross/standard style", + "main": "index.js", + "bin": { + "standard-format": "./bin.js" + }, + "scripts": { + "test": "standard && tape test/*.js | tap-spec", + "test-file": "=1.3.3 <2.0.0", + "_npmVersion": "2.7.5", + "_nodeVersion": "0.10.26", + "_npmUser": { + "name": "jb55", + "email": "bill@casarin.me" + }, + "maintainers": [ + { + "name": "maxogden", + "email": "max+DONT+EMAIL+ME@maxogden.com" + }, + { + "name": "jb55", + "email": "bill@casarin.me" + }, + { + "name": "feross", + "email": "feross@feross.org" + }, + { + "name": "bret", + "email": "bcomnes@gmail.com" + }, + { + "name": "flet", + "email": "flettre@gmail.com" + } + ], + "dist": { + "shasum": "77bf29087cf15a037c84cb9c51972d9f974e8639", + "tarball": "http://registry.npmjs.org/standard-format/-/standard-format-1.3.6.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/standard-format/-/standard-format-1.3.6.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/standard-format/rc/esformatter.json b/node_modules/standard/node_modules/standard-format/rc/esformatter.json new file mode 100644 index 00000000..a63a1751 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/rc/esformatter.json @@ -0,0 +1,266 @@ +{ + "indent" : { + "value": " " + }, + + "lineBreak" : { + "value" : "\n", + + "before" : { + "AssignmentExpression" : -1, + "AssignmentOperator": -1, + "BlockStatement" : -1, + "CallExpression" : -1, + "ConditionalExpression" : -1, + "CatchOpeningBrace" : 0, + "CatchClosingBrace" : -1, + "CatchKeyword": 0, + "DeleteOperator" : -1, + "DoWhileStatement" : -1, + "DoWhileStatementOpeningBrace" : 0, + "DoWhileStatementClosingBrace" : -1, + "EndOfFile" : 1, + "EmptyStatement" : -1, + "FinallyKeyword" : -1, + "FinallyOpeningBrace" : 0, + "FinallyClosingBrace" : -1, + "ForInStatement" : -1, + "ForInStatementExpressionOpening" : -1, + "ForInStatementExpressionClosing" : -1, + "ForInStatementOpeningBrace" : 0, + "ForInStatementClosingBrace" : -1, + "ForStatement" : -1, + "ForStatementExpressionOpening" : -1, + "ForStatementExpressionClosing" : -1, + "ForStatementOpeningBrace" : 0, + "ForStatementClosingBrace" : -1, + "FunctionExpression" : -1, + "FunctionExpressionOpeningBrace" : 0, + "FunctionExpressionClosingBrace" : -1, + "FunctionDeclaration" : -1, + "FunctionDeclarationOpeningBrace" : 0, + "FunctionDeclarationClosingBrace" : -1, + "IfStatement" : -1, + "IfStatementOpeningBrace" : 0, + "IfStatementClosingBrace" : -1, + "ElseIfStatement" : -1, + "ElseIfStatementOpeningBrace" : 0, + "ElseIfStatementClosingBrace" : -1, + "ElseStatement" : 0, + "ElseStatementOpeningBrace" : 0, + "ElseStatementClosingBrace" : -1, + "LogicalExpression" : -1, + "ObjectExpressionClosingBrace" : -1, + "Property" : -1, + "ReturnStatement" : -1, + "SwitchOpeningBrace" : 0, + "SwitchClosingBrace" : -1, + "ThisExpression" : -1, + "ThrowStatement" : -1, + "TryKeyword": -1, + "TryOpeningBrace" : 0, + "TryClosingBrace" : -1, + "VariableName" : -1, + "VariableValue" : -1, + "VariableDeclaration" : -1, + "VariableDeclarationWithoutInit" : -1, + "WhileStatement" : -1, + "WhileStatementOpeningBrace" : 0, + "WhileStatementClosingBrace" : -1 + }, + + "after" : { + "AssignmentExpression" : -1, + "AssignmentOperator" : -1, + "BlockStatement" : -1, + "CallExpression" : -1, + "CatchOpeningBrace" : "<=1", + "CatchClosingBrace" : -1, + "CatchKeyword": 0, + "ConditionalExpression" : -1, + "DeleteOperator" : -1, + "DoWhileStatement" : -1, + "DoWhileStatementOpeningBrace" : "<=1", + "DoWhileStatementClosingBrace" : -1, + "EmptyStatement" : -1, + "FinallyKeyword" : -1, + "FinallyOpeningBrace" : "<=2", + "FinallyClosingBrace" : -1, + "ForInStatement" : -1, + "ForInStatementExpressionOpening" : -1, + "ForInStatementExpressionClosing" : -1, + "ForInStatementOpeningBrace" : "<=1", + "ForInStatementClosingBrace" : -1, + "ForStatement" : -1, + "ForStatementExpressionOpening" : -1, + "ForStatementExpressionClosing" : -1, + "ForStatementOpeningBrace" : "<=1", + "ForStatementClosingBrace" : -1, + "FunctionExpression" : -1, + "FunctionExpressionOpeningBrace" : "<=1", + "FunctionExpressionClosingBrace" : -1, + "FunctionDeclaration" : -1, + "FunctionDeclarationOpeningBrace" : "<=1", + "FunctionDeclarationClosingBrace" : -1, + "IfStatement" : -1, + "IfStatementOpeningBrace" : "<=1", + "IfStatementClosingBrace" : -1, + "ElseIfStatement" : -1, + "ElseIfStatementOpeningBrace" : "<=1", + "ElseIfStatementClosingBrace" : -1, + "ElseStatement" : -1, + "ElseStatementOpeningBrace" : "<=1", + "ElseStatementClosingBrace" : -1, + "LogicalExpression" : -1, + "ObjectExpressionOpeningBrace" : "<=1", + "Property" : -1, + "PropertyValue" : -1, + "ReturnStatement" : -1, + "SwitchOpeningBrace" : "<=1", + "SwitchClosingBrace" : -1, + "ThisExpression" : -1, + "ThrowStatement" : -1, + "TryKeyword": -1, + "TryOpeningBrace" : "<=1", + "TryClosingBrace" : -1, + "VariableDeclaration" : -1, + "WhileStatement" : -1, + "WhileStatementOpeningBrace" : "<=1", + "WhileStatementClosingBrace" : -1 + } + }, + + + "whiteSpace" : { + "value" : " ", + "removeTrailing" : 1, + + "before" : { + "ArrayExpressionOpening" : -1, + "ArrayExpressionClosing" : -1, + "ArrayExpressionComma" : -1, + "ArgumentComma" : -1, + "ArgumentList" : 0, + "AssignmentOperator" : 1, + "BinaryExpression": -1, + "ForStatementClosingBrace" : -1, + "ForStatementSemicolon" : 0, + "FunctionDeclarationOpeningBrace" : 1, + "FunctionDeclarationClosingBrace" : -1, + "FunctionExpressionOpeningBrace" : 1, + "FunctionExpressionClosingBrace" : -1, + "IfStatementConditionalOpening" : -1, + "IfStatementConditionalClosing" : -1, + "IfStatementOpeningBrace" : 1, + "IfStatementClosingBrace" : -1, + "ElseStatementOpeningBrace" : 1, + "ElseStatementClosingBrace" : -1, + "ElseIfStatementOpeningBrace" : 1, + "ElseIfStatementClosingBrace" : -1, + "MemberExpressionClosing" : -1, + "LineComment" : -1, + "LogicalExpressionOperator" : 1, + "Property" : -1, + "PropertyValue" : 1, + "ParameterComma" : -1, + "ParameterList" : -1, + "SwitchDiscriminantOpening" : 1, + "SwitchDiscriminantClosing" : -1, + "ThrowKeyword": -1, + "TryKeyword": -1, + "TryOpeningBrace" : 1, + "TryClosingBrace" : -1, + "UnaryExpressionOperator": -1, + "VariableName" : -1, + "VariableValue" : 1, + "WhileStatementConditionalOpening" : -1, + "WhileStatementConditionalClosing" : -1, + "WhileStatementOpeningBrace" : -1, + "WhileStatementClosingBrace" : -1, + "ObjectExpressionClosingBrace": -1 + }, + + "after" : { + "ArrayExpressionOpening" : -1, + "ArrayExpressionClosing" : -1, + "ArrayExpressionComma" : 1, + "ArgumentComma" : 1, + "ArgumentList" : 0, + "AssignmentOperator" : 1, + "BinaryExpression": -1, + "BinaryExpressionOperator" : 1, + "BlockComment" : -1, + "CallExpression" : -1, + "CatchParameterList" : -1, + "CatchOpeningBrace" : -1, + "CatchClosingBrace" : -1, + "CatchKeyword" : -1, + "CommaOperator" : 1, + "ConditionalExpressionConsequent" : -1, + "ConditionalExpressionTest" : -1, + "DoWhileStatementOpeningBrace" : -1, + "DoWhileStatementClosingBrace" : -1, + "DoWhileStatementBody" : -1, + "EmptyStatement" : -1, + "ExpressionOpeningParentheses" : -1, + "FinallyKeyword" : -1, + "FinallyOpeningBrace" : -1, + "FinallyClosingBrace" : -1, + "ForInStatement" : -1, + "ForInStatementExpressionOpening" : -1, + "ForInStatementExpressionClosing" : -1, + "ForInStatementOpeningBrace" : -1, + "ForInStatementClosingBrace" : -1, + "ForStatement" : -1, + "ForStatementExpressionOpening" : -1, + "ForStatementExpressionClosing" : -1, + "ForStatementClosingBrace" : -1, + "ForStatementOpeningBrace" : -1, + "ForStatementSemicolon" : -1, + "FunctionReservedWord": 1, + "FunctionName" : 1, + "FunctionExpressionOpeningBrace" : -1, + "FunctionExpressionClosingBrace" : -1, + "FunctionDeclarationOpeningBrace" : -1, + "FunctionDeclarationClosingBrace" : -1, + "IfStatementConditionalOpening" : -1, + "IfStatementConditionalClosing" : -1, + "IfStatementOpeningBrace" : -1, + "IfStatementClosingBrace" : -1, + "ElseStatementOpeningBrace" : -1, + "ElseStatementClosingBrace" : -1, + "ElseIfStatementOpeningBrace" : -1, + "ElseIfStatementClosingBrace" : -1, + "MemberExpressionOpening" : -1, + "LogicalExpressionOperator" : 1, + "ObjectExpressionClosingBrace": -1, + "PropertyName" : 0, + "PropertyValue" : -1, + "ParameterComma" : 1, + "ParameterList" : -1, + "SwitchDiscriminantOpening" : -1, + "SwitchDiscriminantClosing" : 1, + "ThrowKeyword": -1, + "TryKeyword": -1, + "TryOpeningBrace" : -1, + "TryClosingBrace" : -1, + "UnaryExpressionOperator": -1, + "VariableName" : 1, + "WhileStatementConditionalOpening" : -1, + "WhileStatementConditionalClosing" : -1, + "WhileStatementOpeningBrace" : -1, + "WhileStatementClosingBrace" : -1 + } + }, + + "plugins": [ + "esformatter-quotes", + "esformatter-literal-notation", + "esformatter-spaced-lined-comment" + ], + + "quotes": { + "type": "single", + "avoidEscape": true + } +} diff --git a/node_modules/standard/node_modules/standard-format/readme.md b/node_modules/standard/node_modules/standard-format/readme.md new file mode 100644 index 00000000..c712ddd4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/readme.md @@ -0,0 +1,36 @@ + +# standard-format + + [![Build Status](https://travis-ci.org/maxogden/standard-format.svg)](https://travis-ci.org/maxogden/standard-format) + + **experimental** auto formatter for the easier cases in [standard](https://www.npmjs.com/package/standard) + + [![NPM](https://nodei.co/npm/standard-format.png)](https://nodei.co/npm/standard-format/) + +## Installation + + Install with npm + + $ npm install -g standard-format + +## Example Usage + + Output all formatted javascript in a directory and subdirectories to stdout + + $ standard-format + + Format all javascript files, overwriting them into standard format + + $ standard-format -w + + Format javascript over stdin + + $ standard-format < file.js > formatted-file.js + + Format and overwrite specific files + + $ standard-format -w file1.js file2.js + +### Editor plugins + + - Sublime Text: [sublime-standard-format](https://packagecontrol.io/packages/StandardFormat) diff --git a/node_modules/standard/node_modules/standard-format/test.js b/node_modules/standard/node_modules/standard-format/test.js new file mode 100644 index 00000000..7eb8e9c4 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test.js @@ -0,0 +1,148 @@ +#!/usr/bin/env node + +// This file is automatically ran through standard-format +// and checked by standard. Add test cases for the formatter by adding +// to this file + +// eol semicolons +var x = 1; + +// eol whitespace +x = 2 + +// standard-format has nothing to say about unused vars +// so this is here to prevent invalid test cases +console.log(x) + +//bad comment -- needs a space after slashes +var test = "what"; + +if (test) { + ["a","b","c"].forEach(function (x) { + // test: infix commas + console.log(x*2); + }) +} + +var obj = {val: 2} +var another = { foo: 'bar' } + +// space after function name and arg paren +;[1].forEach(function(){}) + +// space after argument paren +function f2 (x,y,z){} +function fooz() {} +function foox () {} +function foos () {} + +var anon = function() {} + +f2( obj) +f2(obj ) +f2( obj ) +f2( obj, obj ) +f2( obj,obj ) +fooz() +foox() +foos() +anon(another) + +function foo(){} +function bar() {} +function quux() {} + + +foo() +bar() +quux() + + +function food (){} +function foot () {} + + +food() +foot() + + +// test: no block padding +var lessThanThreeNewlines = function () { + + return 2; +} +lessThanThreeNewlines() + +// at most one newline after opening brace +function noExtraNewlines() { + + + return 2; +} +noExtraNewlines() + +// at most one newline after opening brace +function noExtraSingle() { return 2 } +noExtraSingle() + +// at most one newline after opening brace +function noExtraBraces() { + + + if (noExtraBraces != null) + + { + + return 42 + } + + else + + { + + return 42 + } + + switch(noExtraBraces) + + { + + case null: + return 42 + } + + try + + { + + return 42 + } + catch (e) + + { + } + + for (var i in noExtraBraces) { + + return i + } +} +noExtraBraces() + + +// weird bug function +for (var i = 0 ; i < 42; i++ ) { +} + +function getRequests (cb) { + foo({ + }, function (err, resp, body) { + cb(err, resp, body) + }) +} +getRequests() + +// spacing around Property names (key-spacing) +void { + testing :123 +} diff --git a/node_modules/standard/node_modules/standard-format/test/comments.js b/node_modules/standard/node_modules/standard-format/test/comments.js new file mode 100644 index 00000000..292210a7 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test/comments.js @@ -0,0 +1,16 @@ +var test = require('tape') +var fmt = require('../').transform + +test('comments formatting', function (t) { + t.plan(2) + + var program = '//bad comment\n' + var expected = '// bad comment\n' + var msg = 'Expect space or tab after // in comment' + t.equal(fmt(program), expected, msg) + + program = '// good comment\n' + expected = '// good comment\n' + msg = 'Expect good comments to be unchanged' + t.equal(fmt(program), expected, msg) +}) diff --git a/node_modules/standard/node_modules/standard-format/test/failing/multiline.js b/node_modules/standard/node_modules/standard-format/test/failing/multiline.js new file mode 100644 index 00000000..d66beb12 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test/failing/multiline.js @@ -0,0 +1,21 @@ +var test = require('tape') +var fmt = require('../../').transform + +var noops = [ + { + program: + 'var cool =\n' + + ' a +\n' + + ' b +\n' + + ' c\n', + + msg: 'allow newlines after assignment operator' + } +] + +test('multiline noop', function (t) { + t.plan(noops.length) + noops.forEach(function (obj) { + t.equal(fmt(obj.program), obj.program, obj.msg) + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/test/failing/obfuscated-files/standard-format-torture.js b/node_modules/standard/node_modules/standard-format/test/failing/obfuscated-files/standard-format-torture.js new file mode 100644 index 00000000..5b5d2af1 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test/failing/obfuscated-files/standard-format-torture.js @@ -0,0 +1,63 @@ +this.gbar_ = this.gbar_ || {};(function(_){var window=this; + try{ + _.jb = function(a){var c=_.La;c.d? a(): c.b.push(a)};_.kb = function(){};_.lb = function(a){_.lb[" "](a);return a};_.lb[" "] = _.kb; + } catch( e) {_._DumpException(e) } + try{ + var gh;gh = function(a){if(a.classList)return a.classList;a = a.className;return _.t(a) && a.match(/\S+/g) || []};_.Q = function(a,c){return a.classList? a.classList.contains(c): _.ra(gh(a),c)};_.R = function(a,c){a.classList? a.classList.add(c): _.Q(a,c) || (a.className += 0 < a.className.length? " " + c: c)}; + _.hh = function(a,c){if(a.classList)(0, _.ma)(c,function(c){_.R(a,c)}); else{var d={};(0, _.ma)(gh(a),function(a){d[a] = !0});(0, _.ma)(c,function(a){d[a] = !0});a.className = ""; for (var e in d)a.className += 0 < a.className.length? " " + e: e}};_.S = function(a,c){a.classList? a.classList.remove(c): _.Q(a,c) && (a.className = (0, _.na)(gh(a),function(a){return a != c}).join(" "))};_.ih = function(a,c){a.classList? (0, _.ma)(c,function(c){_.S(a,c)}): a.className = (0, _.na)(gh(a),function(a){return !_.ra(c,a)}).join(" ")}; + + } catch( e) {_._DumpException(e) } + try{ + var ak,ik,lk,kk;_.Vj = function(a){_.A(this,a,0,null)};_.w(_.Vj,_.z);_.Wj = function(){return _.D(_.J(),_.Vj,11)};_.Xj = function(a){_.A(this,a,0,null)};_.w(_.Xj,_.z);_.Zj = function(){var a=_.Yj();return _.B(a,9)};ak = function(a){_.A(this,a,0,null)};_.w(ak,_.z);_.bk = function(a){return null != _.B(a,2)? _.B(a,2): .001};_.ck = function(a){_.A(this,a,0,null)};_.w(_.ck,_.z);var dk=function(a){return null != _.B(a,3)? _.B(a,3): 1},ek=function(a){return null != _.B(a,2)? _.B(a,2): 1E-4},fk=function(a){_.A(this,a,0,null)}; + _.w(fk,_.z);_.gk = function(a){return _.B(a,10)};_.hk = function(a){return _.B(a,5)};_.Yj = function(){return _.D(_.J(),ak,4) || new ak};_.jk = function(a){var c="//www.google.com/gen_204?",c=c + a.d(2040 - c.length);ik(c)};ik = function(a){var c=new window.Image,d=kk;c.onerror = c.onload = c.onabort = function(){d in lk && delete lk[d]};lk[kk++] = c;c.src = a};lk = [];kk = 0; + _.mk = function(){this.data = {}};_.mk.prototype.b = function(){window.console && window.console.log && window.console.log("Log data: ",this.data)};_.mk.prototype.d = function(a){var c=[],d; for (d in this.data)c.push((0, window.encodeURIComponent)(d) + "=" + (0, window.encodeURIComponent)(String(this.data[d])));return ("atyp=i&zx=" + (new Date).getTime() + "&" + c.join("&")).substr(0,a)}; + var nk=function(a){this.b = a};nk.prototype.log = function(a,c){try{if(this.A(a)){var d=this.k(a,c);this.d(d)}} catch( e) {}};nk.prototype.d = function(a){this.b? a.b(): _.jk(a)};var ok=function(a,c){this.data = {};var d=_.D(a,_.wa,8) || new _.wa;this.data.ei = _.G(_.gk(a));this.data.ogf = _.G(_.B(d,3));var e;e = window.google && window.google.sn? /.*hp$/.test(window.google.sn)? !1: !0: _.F(_.B(a,7));this.data.ogrp = e? "1": "";this.data.ogv = _.G(_.B(d,6)) + "." + _.G(_.B(d,7));this.data.ogd = _.G(_.B(a,21));this.data.ogc = _.G(_.B(a,20));this.data.ogl = _.G(_.hk(a));c && (this.data.oggv = c)};_.w(ok,_.mk); + _.pk = function(a,c,d,e,f){ok.call(this,a,c);_.ua(this.data,{jexpid:_.G(_.B(a,9)),srcpg:"prop=" + _.G(_.B(a,6)),jsr:Math.round(1 / e),emsg:d.name + ":" + d.message});if(f){f._sn && (f._sn = "og." + f._sn); for (var g in f)this.data[(0, window.encodeURIComponent)(g)] = f[g]}};_.w(_.pk,ok); + var qk=[1, 2, 3, 4, 5, 6, 9, 10, 11, 13, 14, 28, 29, 30, 34, 35, 37, 38, 39, 40, 41, 42, 43, 48, 49, 50, 51, 52, 53, 500],tk=function(a,c,d,e,f,g){ok.call(this,a,c);_.ua(this.data,{oge:e,ogex:_.G(_.B(a,9)),ogp:_.G(_.B(a,6)),ogsr:Math.round(1 / (rk(e)? _.H(dk(d)): _.H(ek(d)))),ogus:f});if(g){"ogw" in g && (this.data.ogw = g.ogw, delete g.ogw);"ved" in g && (this.data.ved = g.ved, delete g.ved);a = []; for (var h in g)0 != a.length && a.push(","), a.push(sk(h)), a.push("."), a.push(sk(g[h]));g = a.join("");"" != g && (this.data.ogad = g)}};_.w(tk,ok); var sk=function(a){return (a + "").replace(".","%2E").replace(",","%2C")},uk=null,rk=function(a){if(!uk){uk = {}; for (var c=0;c < qk.length;c++)uk[qk[c]] = !0}return !!uk[a]}; + var vk=function(a,c,d,e,f){this.b = f;this.F = a;this.O = c;this.ea = e;this.B = _.H(ek(a),1E-4);this.w = _.H(dk(a),1);c = Math.random();this.C = _.F(_.B(a,1)) && c < this.B;this.o = _.F(_.B(a,1)) && c < this.w;a = 0;_.F(_.B(d,1)) && (a |= 1);_.F(_.B(d,2)) && (a |= 2);_.F(_.B(d,3)) && (a |= 4);this.J = a};_.w(vk,nk);vk.prototype.A = function(a){return this.b || (rk(a)? this.o: this.C)};vk.prototype.k = function(a,c){return new tk(this.O,this.ea,this.F,a,this.J,c)}; + var wk=function(a,c,d,e){this.b = e;this.F = c;this.ea = d;this.w = _.H(_.bk(a),.001);this.O = _.F(_.B(a,1)) && Math.random() < this.w;c = null != _.B(a,3)? _.B(a,3): 1;this.C = _.H(c,1);this.o = 0;a = null != _.B(a,4)? _.B(a,4): !0;this.B = _.F(a,!0)};_.w(wk,nk);wk.prototype.log = function(a,c){wk.G.log.call(this,a,c);if(this.b && this.B)throw a;};wk.prototype.A = function(){return this.b || this.O && this.o < this.C};wk.prototype.k = function(a,c){try{return _.za(_.ya.N(),"lm").uf(a,c)} catch( d) {return new _.pk(this.F,this.ea,a,this.w,c) }}; wk.prototype.d = function(a){wk.G.d.call(this,a);this.o++}; + var xk;xk = null;_.yk = function(){if(!xk){var a=_.D(_.J(),_.ck,13) || new _.ck,c=_.Na(),d=_.Zj();xk = new wk(a,c,d,_.Ja)}return xk};_.I = function(a,c){_.yk().log(a,c)};_.zk = function(a,c){return function(){try{return a.apply(c,arguments)} catch( d) {_.I(d) }}};var Ak;Ak = null;_.Bk = function(){if(!Ak){var a=_.D(_.J(),fk,12) || new fk,c=_.Na(),d=_.Wj() || new _.Vj,e=_.Zj();Ak = new vk(a,c,d,e,_.Ja)}return Ak};_.U = function(a,c){_.Bk().log(a,c)};_.U(8,{m:"BackCompat" == window.document.compatMode? "q": "s"}); + } catch( e) {_._DumpException(e) } + try{ + var Ck,Gk,Ik;Ck = [3, 5];_.Dk = function(a){_.A(this,a,0,Ck)};_.w(_.Dk,_.z);var Ek=function(a){_.A(this,a,0,null)};_.w(Ek,_.z);_.Fk = function(a){_.A(this,a,0,null)};_.w(_.Fk,_.z);_.Fk.prototype.Qa = function(){return _.B(this,6)}; + _.Hk = function(a,c,d,e,f,g){_.y.call(this);this.F = c;this.J = f;this.o = g;this.S = !1;this.k = {"":!0};this.H = {"":!0};this.A = [];this.w = [];this.R = ["//" + _.G(_.B(a,2)), "og/_/js", "k=" + _.G(_.B(a,3)), "rt=j"];this.O = "" == _.G(_.B(a,14))? null: _.B(a,14);this.K = ["//" + _.G(_.B(a,2)), "og/_/ss", "k=" + _.G(_.B(a,13))];this.B = "" == _.G(_.B(a,15))? null: _.B(a,15);this.U = _.F(_.B(a,1))? "?host=www.gstatic.com&bust=" + _.G(_.B(a,16)): "";this.T = _.F(_.B(a,1))? "?host=www.gstatic.com&bust=" + 1E11 * Math.random(): "";this.d = d;_.B(a,19);a = null != + _.B(a,17)? _.B(a,17): 1;this.b = _.H(a,1);a = 0; for (c = e[a];a < e.length;a++, c = e[a])Gk(this,c,!0)};_.w(_.Hk,_.y);_.Aa(_.Hk,"m");Gk = function(a,c,d){if(!a.k[c] && (a.k[c] = !0, d && a.d[c])) for (var e=0;e < a.d[c].length;e++)Gk(a,a.d[c][e],d)};Ik = function(a,c){ for (var d=[],e=0;e < c.length;e++) {var f=c[e];if(!a.k[f]){var g=a.d[f];g && (g = Ik(a,g), d = d.concat(g));d.push(f);a.k[f] = !0}}return d}; + _.Kk = function(a,c,d){c = Ik(a,c);0 < c.length && (c = a.R.join("/") + "/" + ("m=" + c.join(",")), a.O && (c += "/rs=" + a.O), c = c + a.U, Jk(a,c,(0, _.u)(a.P,a,d)), a.A.push(c))};_.Hk.prototype.P = function(a){_.E("api").Ta(); for (var c=0;c < this.w.length;c++)this.w[c].call(null);a && a.call(null)}; + var Jk=function(a,c,d,e){var f=window.document.createElement("SCRIPT");f.async = !0;f.type = "text/javascript";f.charset = "UTF-8";f.src = c;var g=!0,h=e || 1;e = (0, _.u)(function(){g = !1;this.o.log(47,{att:h,max:a.b,url:c});h < a.b? Jk(a,c,d,h + 1): this.J.log(Error("V`" + h + "`" + a.b),{url:c})},a);var l=(0, _.u)(function(){g && (this.o.log(46,{att:h,max:a.b,url:c}), g = !1, d && d.call(null))},a),q=function(a){"loaded" == a.readyState || "complete" == a.readyState? l(): g && window.setTimeout(function(){q(a)},100)};"undefined" !== typeof f.addEventListener? + f.onload = function(){l()}: f.onreadystatechange = function(){f.onreadystatechange = null;q(f)};f.onerror = e;a.o.log(45,{att:h,max:a.b,url:c});window.document.getElementsByTagName("HEAD")[0].appendChild(f)};_.Hk.prototype.Jd = function(a,c){ for (var d=[],e=0,f=a[e];e < a.length;e++, f = a[e])this.H[f] || (d.push(f), this.H[f] = !0);0 < d.length && (d = this.K.join("/") + "/" + ("m=" + d.join(",")), this.B && (d += "/rs=" + this.B), d += this.T, Lk(d,c))}; + var Lk=function(a,c){var d=window.document.createElement("LINK");d.setAttribute("rel","stylesheet");d.setAttribute("type","text/css");d.setAttribute("href",a);d.onload = d.onreadystatechange = function(){d.readyState && "loaded" != d.readyState && "complete" != d.readyState || c && c.call(null)};window.document.getElementsByTagName("HEAD")[0].appendChild(d)}; + _.Hk.prototype.C = function(a){this.S || (void 0 != a? window.setTimeout((0, _.u)(this.C,this,void 0),a): (_.Kk(this,_.B(this.F,1),(0, _.u)(this.Q,this)), this.Jd(_.B(this.F,2)), this.S = !0))};_.Hk.prototype.Q = function(){_.v("gbar.qm",(0, _.u)(function(a){try{a()} catch( c) {this.J.log(c) }},this))}; + var Mk=function(a,c){var d={};d._sn = ["v.gas", c].join(".");_.I(a,d)};var Nk=["gbq1", "gbq2", "gbqfbwa"],Ok=function(a){var c=window.document.getElementById("gbqld");c && (c.style.display = a? "none": "block", c = window.document.getElementById("gbql")) && (c.style.display = a? "block": "none")};var Pk=function(){};var Qk=function(a,c,d){this.d = a;this.k = c;this.b = d || _.m};var Rk=function(){this.b = []};Rk.prototype.A = function(a,c,d){this.F(a,c,d);this.b.push(new Qk(a,c,d))};Rk.prototype.F = function(a,c,d){d = d || _.m; for (var e=0,f=this.b.length;e < f;e++) {var g=this.b[e];if(g.d == a && g.k == c && g.b == d){this.b.splice(e,1);break}}};Rk.prototype.w = function(a){ for (var c=0,d=this.b.length;c < d;c++) {var e=this.b[c];"hrc" == e.d && e.k.call(e.b,a)}}; + var Sk,Uk,Vk,Wk,Xk;Sk = null;_.Tk = function(){if(null != Sk)return Sk;var a=window.document.body.style;if(!(a = "flexGrow" in a || "webkitFlexGrow" in a))a:{if(a = window.navigator.userAgent){var c=/Trident\/(\d+)/.exec(a);if(c && 7 <= Number(c[1])){a = /\bMSIE (\d+)/.exec(a);a = !a || "10" == a[1];break a}}a = !1}return Sk = a}; + Uk = function(a,c,d){var e=window.NaN;window.getComputedStyle && (a = window.getComputedStyle(a,null).getPropertyValue(c)) && "px" == a.substr(a.length - 2) && (e = d? (0, window.parseFloat)(a.substr(0,a.length - 2)): (0, window.parseInt)(a.substr(0,a.length - 2),10));return e}; + Vk = function(a){var c=a.offsetWidth,d=Uk(a,"width");if(!(0, window.isNaN)(d))return c - d;var e=a.style.padding,f=a.style.paddingLeft,g=a.style.paddingRight;a.style.padding = a.style.paddingLeft = a.style.paddingRight = 0;d = a.clientWidth;a.style.padding = e;a.style.paddingLeft = f;a.style.paddingRight = g;return c - d}; + Wk = function(a){var c=Uk(a,"min-width");if(!(0, window.isNaN)(c))return c;var d=a.style.width,e=a.style.padding,f=a.style.paddingLeft,g=a.style.paddingRight;a.style.width = a.style.padding = a.style.paddingLeft = a.style.paddingRight = 0;c = a.clientWidth;a.style.width = d;a.style.padding = e;a.style.paddingLeft = f;a.style.paddingRight = g;return c};Xk = function(a,c){c || -.5 != a - Math.round(a) || (a -= .5);return Math.round(a)}; _.Yk = function(a){if(a){var c=a.style.opacity;a.style.opacity = ".99";_.lb(a.offsetWidth);a.style.opacity = c}}; + var Zk=function(a){_.y.call(this);this.b = a;this.d = [];this.k = []};_.w(Zk,_.y);Zk.prototype.L = function(){Zk.G.L.call(this);this.b = null; for (var a=0;a < this.d.length;a++)this.d[a].Y(); for (a = 0;a < this.k.length;a++)this.k[a].Y();this.d = this.k = null}; + Zk.prototype.La = function(a){void 0 == a && (a = this.b.offsetWidth); for (var c=Vk(this.b),d=[],e=0,f=0,g=0,h=0,l=0;l < this.d.length;l++) {var q=this.d[l],r=$k(q),x=Vk(q.b);d.push({item:q,gb:r,sh:x,tc:0});e += r.Gc;f += r.Vc;g += r.Sb;h += x}a = a - h - c - g;e = 0 < a? e: f;f = a;c = d;do {g = !0;h = []; for (l = q = 0;l < c.length;l++) {var r=c[l],x=0 < f? r.gb.Gc: r.gb.Vc,C=0 == e? 0: x / e * f + r.tc,C=Xk(C,g),g=!g;r.tc = al(r.item,C,r.sh,r.gb.Sb);0 < x && C == r.tc && (h.push(r), q += x)}c = h;f = a - (0, _.pa)(d,function(a,c){return a + c.tc},0);e = q } while (0 != f && 0 != c.length); + for (l = 0;l < this.k.length;l++)this.k[l].La()};var cl=function(a){var c={};c.items = (0, _.oa)(a.d,function(a){return bl(a)});c.children = (0, _.oa)(a.k,function(a){return cl(a)});return c},dl=function(a,c){ for (var d=0;d < a.d.length;d++)a.d[d].b.style.width = c.items[d]; for (d = 0;d < a.k.length;d++)dl(a.k[d],c.children[d])};Zk.prototype.M = function(){return this.b}; + var el=function(a,c,d,e){Zk.call(this,a);this.w = c;this.A = d;this.o = e};_.w(el,Zk); + var $k=function(a,c){var d=a.w,e=a.A,f;if(-1 == a.o){var g=c;void 0 == g && (g = Vk(a.b));f = bl(a);var h=cl(a),l=Uk(a.b,"width",!0);(0, window.isNaN)(l) && (l = a.b.offsetWidth - g);g = Math.ceil(l);a.b.style.width = f;dl(a,h);f = g}else f = a.o;return {Gc:d,Vc:e,Sb:f}},al=function(a,c,d,e){void 0 == d && (d = Vk(a.b));void 0 == e && (e = $k(a,d).Sb);c = e + c;0 > c && (c = 0);a.b.style.width = c + "px";d = a.b.offsetWidth - d;a.b.style.width = d + "px";return d - e},bl=function(a){var c=a.b.style.width;a.b.style.width = "";return c}; + var fl=function(a,c,d){var e;void 0 == e && (e = -1);return {className:a,gb:{Gc:c || 0,Vc:d || 0,Sb:e}}},gl={className:"gb_3b",items:[fl("gb_Ua"), fl("gb_ic"), fl("gb_Mb",0,2), fl("gb_jc"), fl("gb_ea",1,1)],eb:[{className:"gb_ea",items:[fl("gb_Lc",0,1), fl("gb_Kc",0,1)],eb:[function(a){a = a.gb_Lc;var c;if(a)c = a.M(); else{c = window.document.querySelector(".gb_Lc");if(!c)return null;a = new Zk(c)}c = c.querySelectorAll(".gb_m"); for (var d=0;d < c.length;d++) {var e;if(_.Q(c[d],"gb_o")){e = new el(c[d],0,1,-1);var f=c[d].querySelector(".gb_l"); + f && (f = new el(f,0,1,-1), e.d.push(f), a.k.push(e))}else e = new el(c[d],0,0,-1);a.d.push(e)}return a}, {className:"gb_Kc",items:[fl("gb_J"), fl("gb_4a"), fl("gb_Zb"), fl("gb_ma",0,1), fl("gb_Mc"), fl("gb_ia",0,1), fl("gb_Nc"), fl("gb_lc")],eb:[{className:"gb_ma",items:[fl("gb_oa",0,1)],eb:[{className:"gb_oa",items:[fl("gb_ka",0,1)],eb:[]}]}]}]}, {className:"gb_fc",items:[fl("gbqff",1,1), fl("gb_ec")],eb:[]}]},hl=function(a,c){var d=c;if(!d){d = window.document.querySelector("." + a.className);if(!d)return null;d = new Zk(d)} for (var e= + {},f=0;f < a.items.length;f++) {var g=a.items[f],h;h = g;var l=window.document.querySelector("." + h.className);if(h = l? new el(l,h.gb.Gc,h.gb.Vc,h.gb.Sb): null)d.d.push(h), e[g.className] = h} for (f = 0;f < a.eb.length;f++) {var g=a.eb[f],q;"function" == typeof g? q = g(e): q = hl(g,e[g.className]);q && d.k.push(q)}return d}; + _.kl = function(a){_.y.call(this);this.B = new Rk;this.d = window.document.getElementById("gb");this.O = (this.b = window.document.querySelector(".gb_ea"))? this.b.querySelector(".gb_Kc"): null;this.C = [];this.he = 60;this.J = _.B(a,4);this.Bh = _.H(_.B(a,2),152);this.If = _.H(_.B(a,1),30);this.k = null;this.Ke = _.F(_.B(a,3),!0);this.o = 1;this.d && this.J && (this.d.style.minWidth = this.J + "px");_.il(this);this.Ke && (this.d && (jl(this), _.R(this.d,"gb_p"), this.b && _.R(this.b,"gb_p"), _.Tk() || (this.k = hl(gl))), this.La(), window.setTimeout((0, _.u)(this.La, + this),0));_.v("gbar.elc",(0, _.u)(this.K,this));_.v("gbar.ela",_.kb);_.v("gbar.elh",(0, _.u)(this.S,this))};_.w(_.kl,_.y);_.Aa(_.kl,"el");var ll=function(){var a=_.kl.Lh();return {es:a? {f:a.Bh,h:a.he,m:a.If}: {f:152,h:60,m:30},mo:"md",vh:window.innerHeight || 0,vw:window.innerWidth || 0}};_.kl.prototype.L = function(){_.kl.G.L.call(this)};_.kl.prototype.La = function(a){a && jl(this);this.k && this.k.La(Math.max(window.document.documentElement.clientWidth,Wk(this.d)));_.Yk(this.b)}; + _.kl.prototype.H = function(){try{var a=window.document.getElementById("gb"),c=a.querySelector(".gb_ea");_.S(a,"gb_3c");c && _.S(c,"gb_3c"); for (var a=0,d;d = Nk[a];a++) {var e=window.document.getElementById(d);e && _.S(e,"gbqfh")}Ok(!1)} catch( f) {Mk(f,"rhcc") }this.La(!0)};_.kl.prototype.T = function(){try{var a=window.document.getElementById("gb"),c=a.querySelector(".gb_ea");_.R(a,"gb_3c");c && _.R(c,"gb_3c"); for (var a=0,d;d = Nk[a];a++)_.R(window.document.getElementById(d),"gbqfh");Ok(!0)} catch( e) {Mk(e,"ahcc") }this.La(!0)}; + _.il = function(a){if(a.d){var c=a.d.offsetWidth;0 == a.o? 900 <= c && (a.o = 1, a.w(new Pk)): 900 > c && (a.o = 0, a.w(new Pk))}};_.kl.prototype.K = function(a){this.C.push(a)};_.kl.prototype.S = function(a){var c=ll().es.h;this.he = c + a; for (a = 0;a < this.C.length;a++)try{this.C[a](ll())} catch( d) {_.I(d) }};var jl=function(a){if(a.b){var c;a.k && (c = cl(a.k));_.R(a.b,"gb_s");a.b.style.minWidth = a.b.offsetWidth - Vk(a.b) + "px";a.O.style.minWidth = a.O.offsetWidth - Vk(a.O) + "px";_.S(a.b,"gb_s");c && dl(a.k,c)}}; _.kl.prototype.A = function(a,c,d){this.B.A(a,c,d)};_.kl.prototype.F = function(a,c){this.B.F(a,c)};_.kl.prototype.w = function(a){this.B.w(a)}; + _.jb(function(){var a=_.D(_.J(),Ek,21) || new Ek,a=new _.kl(a);_.Ca("el",a);_.v("gbar.gpca",(0, _.u)(a.T,a));_.v("gbar.gpcr",(0, _.u)(a.H,a))});_.v("gbar.elr",ll);_.ml = function(a){this.k = _.kl.N();this.d = a};_.ml.prototype.b = function(a,c){0 == this.k.o? (_.R(a,"gb_r"), c? (_.S(a,"gb_la"), _.R(a,"gb_Oc")): (_.S(a,"gb_Oc"), _.R(a,"gb_la"))): _.ih(a,["gb_r", "gb_la", "gb_Oc"])};_.v("gbar.sos",function(){return window.document.querySelectorAll(".gb_hc")});_.v("gbar.si",function(){return window.document.querySelector(".gb_gc")}); + _.jb(function(){if(_.D(_.J(),_.Dk,16)){var a=window.document.querySelector(".gb_ea"),c=_.D(_.J(),_.Dk,16) || new _.Dk,c=_.F(_.B(c,1),!1),c=new _.ml(c);a && c.d && c.b(a,!1)}}); + } catch( e) {_._DumpException(e) } + try{ + var nl=function(){_.La.k(_.I)};var ol=function(a,c){var d=_.zk(nl);a.addEventListener? a.addEventListener(c,d): a.attachEvent("on" + c,d)};var pl=[1, 2],ql=function(a,c){a.w.push(c)},rl=function(a){_.A(this,a,0,pl)};_.w(rl,_.z);var sl=function(){_.y.call(this);this.o = this.b = null;this.d = {};this.w = {};this.k = {}};_.w(sl,_.y);_.k = sl.prototype;_.k.Ze = function(a){a && this.b && a != this.b && this.b.close();this.b = a};_.k.Me = function(a){a = this.k[a] || a;return this.b == a};_.k.Fh = function(a){this.o = a}; + _.k.Le = function(a){return this.o == a};_.k.hd = function(){this.b && this.b.close();this.b = null};_.k.tf = function(a){this.b && this.b.getId() == a && this.hd()};_.k.Pb = function(a,c,d){this.d[a] = this.d[a] || {};this.d[a][c] = this.d[a][c] || [];this.d[a][c].push(d)};_.k.fd = function(a,c){var d=c.getId();if(this.d[a] && this.d[a][d]) for (var e=0;e < this.d[a][d].length;e++)try{this.d[a][d][e]()} catch( f) {_.I(f) }};_.k.Hh = function(a,c){this.w[a] = c};_.k.rf = function(a){return !this.w[a.getId()]}; + _.k.Qg = function(){return !!this.b && this.b.V};_.k.qf = function(){return !!this.b};_.k.Re = function(){this.b && this.b.la()};_.k.cf = function(a){this.k[a] && (this.b && this.b.getId() == a || this.k[a].open())};_.k.jh = function(a){this.k[a.getId()] = a};var tl;window.gbar && window.gbar._DPG? tl = window.gbar._DPG[0] || {}: tl = {};var ul;window.gbar && window.gbar._LDD? ul = window.gbar._LDD: ul = [];var vl=_.Na(),wl=new _.Hk(vl,_.D(_.J(),rl,17) || new rl,tl,ul,_.yk(),_.Bk());_.Ca("m",wl); if(_.F(_.B(vl,18),!0))wl.C(); else{var xl=_.H(_.B(vl,19),200),yl=(0, _.u)(wl.C,wl,xl);_.jb(yl)}ol(window.document,"DOMContentLoaded");ol(window,"load"); + _.v("gbar.ldb",(0, _.u)(_.La.k,_.La));_.v("gbar.mls",function(){});var zl=function(){_.y.call(this);this.k = this.b = null;this.w = 0;this.o = {};this.d = !1;var a=window.navigator.userAgent;0 <= a.indexOf("MSIE") && 0 <= a.indexOf("Trident") && (a = /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a)) && a[1] && 9 > (0, window.parseFloat)(a[1]) && (this.d = !0)};_.w(zl,_.y); + var Al=function(a,c,d){if(!a.d)if(d instanceof Array) for (var e in d)Al(a,c,d[e]); else{e = (0, _.u)(a.A,a,c);var f=a.w + d;a.w++;c.setAttribute("data-eqid",f);a.o[f] = e;c && c.addEventListener? c.addEventListener(d,e,!1): c && c.attachEvent? c.attachEvent("on" + d,e): _.I(Error("W`" + c))}}; + zl.prototype.Ne = function(a,c){if(this.d)return null;if(c instanceof Array){var d=null,e; for (e in c) {var f=this.Ne(a,c[e]);f && (d = f) }return d}d = null;this.b && this.b.type == c && this.k == a && (d = this.b, this.b = null);if(e = a.getAttribute("data-eqid"))a.removeAttribute("data-eqid"), (e = this.o[e])? a.removeEventListener? a.removeEventListener(c,e,!1): a.detachEvent && a.detachEvent("on" + c,e): _.I(Error("X`" + a));return d};zl.prototype.A = function(a,c){this.b = c;this.k = a;c.preventDefault? c.preventDefault(): c.returnValue = !1}; + _.Ca("eq",new zl);var Bl=function(){_.y.call(this);this.ge = [];this.jd = []};_.w(Bl,_.y);Bl.prototype.b = function(a,c){this.ge.push({uc:a,options:c})};Bl.prototype.init = function(){window.gapi = {};var a=_.Yj(),c=window.___jsl = {};c.h = _.G(_.B(a,1));c.ms = _.G(_.B(a,2));c.m = _.G(_.B(a,3));c.l = [];a = _.D(_.J(),_.Xj,5) || new _.Xj;_.B(a,1) && (a = _.B(a,3)) && this.jd.push(a);a = _.D(_.J(),_.Fk,6) || new _.Fk;_.B(a,1) && (a = _.B(a,2)) && this.jd.push(a);_.v("gapi.load",(0, _.u)(this.b,this));return this}; + var Cl=window,Dl,El=_.Yj();Dl = _.B(El,7);Cl.__PVT = _.G(Dl);_.Ca("gs",(new Bl).init());(function(){ for (var a=function(a){return function(){_.U(44,{n:a})}},c=0;c < _.Qa.length;c++) {var d="gbar." + _.Qa[c];_.v(d,a(d))}var e=_.ya.N();_.za(e,"api").Ta();ql(_.za(e,"m"),function(){_.za(e,"api").Ta()})})();var Fl=function(a){_.jb(function(){var c=window.document.querySelector("." + a);c && (c = c.querySelector(".gb_K")) && Al(_.E("eq"),c,"click")})};var Gl=window.document.querySelector(".gb_J"),Hl=/(\s+|^)gb_dc(\s+|$)/;Gl && !Hl.test(Gl.className) && Fl("gb_J");var Il=new sl;_.Ca("dd",Il);_.v("gbar.close",(0, _.u)(Il.hd,Il));_.v("gbar.cls",(0, _.u)(Il.tf,Il));_.v("gbar.abh",(0, _.u)(Il.Pb,Il,0));_.v("gbar.adh",(0, _.u)(Il.Pb,Il,1));_.v("gbar.ach",(0, _.u)(Il.Pb,Il,2));_.v("gbar.aeh",(0, _.u)(Il.Hh,Il));_.v("gbar.bsy",(0, _.u)(Il.Qg,Il));_.v("gbar.op",(0, _.u)(Il.qf,Il)); + Fl("gb_ma");_.jb(function(){var a=window.document.querySelector(".gb_Xa");a && Al(_.E("eq"),a,"click")});Fl("gb_4a");_.v("gbar.qfgw",(0, _.u)(window.document.getElementById,window.document,"gbqfqw"));_.v("gbar.qfgq",(0, _.u)(window.document.getElementById,window.document,"gbqfq"));_.v("gbar.qfgf",(0, _.u)(window.document.getElementById,window.document,"gbqf"));_.v("gbar.qfsb",(0, _.u)(window.document.getElementById,window.document,"gbqfb")); + Fl("gb_Zb");Fl("gb_lc"); + } catch( e) {_._DumpException(e) } +})(this.gbar_); +// Google Inc. diff --git a/node_modules/standard/node_modules/standard-format/test/failing/obfuscated.js b/node_modules/standard/node_modules/standard-format/test/failing/obfuscated.js new file mode 100644 index 00000000..3858fde6 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test/failing/obfuscated.js @@ -0,0 +1,35 @@ +var test = require('tape') +var fmt = require('../../').transform +var run = require('../standard-runner') +var fs = require('fs') +var path = require('path') +var standard = require('standard') + +var files = [ + { path: path.resolve(path.join(__dirname, '/obfuscated-files/standard-format-torture.js'))} +] + +test('obfuscated files', function (t) { + files.forEach(function (obj) { + fs.readFile(obj.path, function (err, data) { + t.error(err, 'no errors opening the file') + var formatted = fmt(data.toString()) + var lines = formatted.split('\n') + t.ok(formatted, 'formatting returned results') + run(formatted, function (err, reports) { + t.ok(!err, 'no runner errors') + reports.forEach(function (report) { + var highlight = run.highlight(lines, report) + t.fail(report.message) + var comment = '\n' + + report.source + ':' + + report.line + ':' + + report.column + ':' + + report.message + highlight + console.log(comment) + }) + t.end() + }) + }) + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/test/index.js b/node_modules/standard/node_modules/standard-format/test/index.js new file mode 100644 index 00000000..77ef9d37 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test/index.js @@ -0,0 +1,28 @@ +var test = require('tape') +var run = require('./standard-runner') +var fs = require('fs') +var join = require('path').join +var fmt = require('../').transform + +test('test.js ran through formatter', function (t) { + var file = fs.readFileSync(join(__dirname, '../test.js')).toString() + var formatted = fmt(file) + var lines = formatted.split('\n') + + run(formatted, function (err, reports) { + t.ok(!err, 'no runner errors') + + reports.forEach(function (report) { + var highlight = run.highlight(lines, report) + t.fail(report.message) + var comment = '\n' + + report.source + ':' + + report.line + ':' + + report.column + ':' + + report.message + highlight + console.log(comment) + }) + + t.end() + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/test/multiline.js b/node_modules/standard/node_modules/standard-format/test/multiline.js new file mode 100644 index 00000000..1d8923d8 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test/multiline.js @@ -0,0 +1,96 @@ +var test = require('tape') +var fmt = require('../').transform + +var collapse = [ + { + program: + 'var x = 1\n' + + '\n' + + '\n' + + 'var z = 2\n', + + expected: + 'var x = 1\n' + + '\n' + + 'var z = 2\n', + + msg: 'two empty lines should collapse to one' + }, + { + program: + 'var x = 1\n' + + '\n' + '\n' + '\n' + '\n' + '\n' + + '\n' + '\n' + '\n' + '\n' + '\n' + + 'var z = 2\n', + + expected: + 'var x = 1\n' + + '\n' + + 'var z = 2\n', + + msg: 'ten empty lines should collapse to one' + }, + { + program: + 'var foo = function () {\n' + + '\n' + + ' bar()\n' + + '}\n', + + expected: + 'var foo = function () {\n' + + ' bar()\n' + + '}\n', + msg: 'Remove padding newlines after curly braces' + } +] + +test('multiline collapse', function (t) { + t.plan(collapse.length) + collapse.forEach(function (obj) { + t.equal(fmt(obj.program), obj.expected, obj.msg) + }) +}) + +var noops = [ + { + program: + 'var x = 1\n' + + '\n' + + 'var z = 2\n', + + msg: 'single empty line should be unmodified' + }, + { + program: + 'function getRequests (cb) {\n' + + ' nets({\n' + + " url: binUrl + '/api/v1/bins/' + bin.name + '/requests',\n" + + ' json: true,\n' + + ' headers: headers\n' + + ' }, function (err, resp, body) {\n' + + ' cb(err, resp, body)\n' + + ' })\n' + + '}\n', + + msg: 'Dont mess with function tabbing' + + }, + { + program: + 'var obj = {\n' + + " 'standard': {\n" + + " 'ignore': ['test.js', '**test/failing/**']\n" + + ' }\n' + + '}\n', + + msg: 'allow single line object arrays' + } +] + +test('multiline noop', function (t) { + t.plan(noops.length) + noops.forEach(function (obj) { + t.equal(fmt(obj.program), obj.program, obj.msg) + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/test/shebang.js b/node_modules/standard/node_modules/standard-format/test/shebang.js new file mode 100644 index 00000000..fff860a5 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test/shebang.js @@ -0,0 +1,15 @@ +var test = require('tape') +var fmt = require('../').transform + +test('deal with shebang line', function (t) { + t.plan(2) + + var program = '#!/usr/bin/env node\nconsole.log(\'badaboom\')\n' + var formatted + + var msg = 'Expect formatter to not explode with shebang' + t.ok(formatted = fmt(program), msg) + + msg = 'Expect program to be still have shebang' + t.equal(formatted, program, msg) +}) diff --git a/node_modules/standard/node_modules/standard-format/test/singleline.js b/node_modules/standard/node_modules/standard-format/test/singleline.js new file mode 100644 index 00000000..89b2b949 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test/singleline.js @@ -0,0 +1,101 @@ +var test = require('tape') +var fmt = require('../').transform + +var noops = [ + { str: 'if (!opts) opts = {}\n', + msg: 'Noop on single line conditional assignment' }, + + { str: 'var g = { name: f, data: fs.readFileSync(f).toString() }\n', + msg: 'Noop on single line object assignment' + }, + { + str: '{foo: \'bar\'}\n', + msg: 'Dont add padding to object braces' + }, + { str: "var x = ['test.js', '**test/failing/**']\n", + msg: 'Noop on singleline arrays' + }, + { str: 'function x () {}\n', + msg: 'Noop on named functions correctly spaced' + }, + { str: 'window.wrapFunctionsUntil(1)\n', + msg: 'Noop non-functions with function in the name' + } +] + +test('singleline noop expressions', function (t) { + t.plan(noops.length) + noops.forEach(function (obj) { + t.equal(fmt(obj.str), obj.str, obj.msg) + }) +}) + +var transforms = [ + { + str: 'var x = function() {}\n', + expect: 'var x = function () {}\n', + msg: 'Anonymous function spacing between keyword and arguments' + }, + { + str: 'var x = function (y){}\n', + expect: 'var x = function (y) {}\n', + msg: 'Anonymous function spacing between arguments and opening brace' + }, + { + str: 'function xx() {}\n', + expect: 'function xx () {}\n', + msg: 'Named function spacing between keyword and arguments' + }, + { + str: 'function xx (y){}\n', + expect: 'function xx (y) {}\n', + msg: 'Named function spacing between arguments and opening brace' + }, + { + str: 'var hi = 1\n', + expect: 'var hi = 1\n', + msg: 'Squash spaces around variable value' + }, + { + str: 'var hi = 1\n', + expect: 'var hi = 1\n', + msg: 'Space after variable name' + }, + { + str: 'var hi\n hi = 1\n', + expect: 'var hi\nhi = 1\n', + msg: 'Squash spaces around assignment operator' + }, + { + str: 'function foo (x,y,z) {}\n', + expect: 'function foo (x, y, z) {}\n', + msg: 'Space after commas in function parameters' + }, + { + str: '[1,2,3]\n', + expect: '[1, 2, 3]\n', + msg: 'Space after commas in array' + }, + { + str: 'var x = 1;\n', + expect: 'var x = 1\n', + msg: 'Remove semicolons' + }, + { + str: 'var x = {key:123}\n', + expect: 'var x = {key: 123}\n', + msg: 'Space after colon (key-spacing)' + }, + { + str: 'var x = {key : 123}\n', + expect: 'var x = {key: 123}\n', + msg: 'No Space before colon (key-spacing)' + } +] + +test('singleline transforms', function (t) { + t.plan(transforms.length) + transforms.forEach(function (obj) { + t.equal(fmt(obj.str), obj.expect, obj.msg) + }) +}) diff --git a/node_modules/standard/node_modules/standard-format/test/standard-runner.js b/node_modules/standard/node_modules/standard-format/test/standard-runner.js new file mode 100644 index 00000000..88ce0e48 --- /dev/null +++ b/node_modules/standard/node_modules/standard-format/test/standard-runner.js @@ -0,0 +1,61 @@ +var spawn = require('child_process').spawn +var once = require('once') +var split = require('split') +var skip = require('skip-stream') +var reduce = require('stream-reduce') +var debug = require('debug')('standard-runner') + +function parse (line) { + debug('parsing line %s', line) + var matched = line.match(/\s*([^:]+):(\d+):(\d+):\s*(.*)/) + return { + source: matched[1], + line: matched[2], + column: matched[3], + message: matched[4] + } +} + +function highlightLine (line, issue) { + var str = '\n' + str += line + str += '\n' + for (var i = 0; i <= issue.column; ++i) { + str += i < issue.column ? ' ' : '^' + } + return str +} + +function highlight (lines, issue) { + return highlightLine(lines[issue.line - 1], issue) +} + +function check (data, done) { + var standard = spawn('standard') + var finish = once(done) + + standard.on('error', finish) + + standard.stderr + .pipe(split()) + .pipe(skip(1)) + .pipe(reduce(function (acc, line) { + if (line) { + acc.push(parse(line)) + } + return acc + }, [])) + .on('data', function (reports) { + debug('reports %j', reports) + finish(null, reports) + }) + + standard.stderr.on('end', function () { + finish(null) + }) + + standard.stdin.end(data) +} + +module.exports = check +module.exports.highlight = highlight diff --git a/node_modules/standard/node_modules/uniq/.npmignore b/node_modules/standard/node_modules/uniq/.npmignore new file mode 100644 index 00000000..0d1b0b09 --- /dev/null +++ b/node_modules/standard/node_modules/uniq/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules/* \ No newline at end of file diff --git a/node_modules/standard/node_modules/uniq/LICENSE b/node_modules/standard/node_modules/uniq/LICENSE new file mode 100644 index 00000000..8ce206a8 --- /dev/null +++ b/node_modules/standard/node_modules/uniq/LICENSE @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) 2013 Mikola Lysenko + +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/node_modules/standard/node_modules/uniq/README.md b/node_modules/standard/node_modules/uniq/README.md new file mode 100644 index 00000000..9e0abafe --- /dev/null +++ b/node_modules/standard/node_modules/uniq/README.md @@ -0,0 +1,46 @@ +uniq +==== +Removes all duplicates from an array in place. + +Usage +===== +First install using npm: + + npm install uniq + +Then use it as follows: + +```javascript + +var arr = [1, 1, 2, 2, 3, 5] + +require("uniq")(arr) +console.log(arr) + +//Prints: +// +// 1,2,3,5 +// +``` + +## `require("uniq")(array[, compare, sorted])` +Removes all duplicates from a sorted array in place. + +* `array` is the array to remove items from +* `compare` is an optional comparison function that returns 0 when two items are equal, and something non-zero when they are different. If unspecified, then the default equals will be used. +* `sorted` if true, then assume array is already sorted + +**Returns:** A reference to `array` + +**Time Complexity:** `O(array.length * log(arra.length))` or `O(array.length)` if `sorted` + + +## Why use this instead of underscore.uniq[ue]? +A few reasons: + +* This library updates the array in place without making an extra copy (and so it is faster for large arrays) +* It also accepts a custom comparison function so you can remove duplicates from arrays containing object +* It is more modular in the sense that it doesn't come with a bazillion other utility grab bag functions. + +# Credits +(c) 2013 Mikola Lysenko. MIT License diff --git a/node_modules/standard/node_modules/uniq/package.json b/node_modules/standard/node_modules/uniq/package.json new file mode 100644 index 00000000..4a23faee --- /dev/null +++ b/node_modules/standard/node_modules/uniq/package.json @@ -0,0 +1,61 @@ +{ + "name": "uniq", + "version": "1.0.1", + "description": "Removes duplicates from a sorted array in place", + "main": "uniq.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "^2.12.3" + }, + "scripts": { + "test": "tape test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/mikolalysenko/uniq.git" + }, + "keywords": [ + "array", + "duplicate", + "unique", + "uniq", + "remove", + "sort", + "in", + "place", + "no", + "copy" + ], + "author": { + "name": "Mikola Lysenko" + }, + "license": "MIT", + "gitHead": "e9828cfcb97e25a351f95b39fdf3c31876ff3985", + "bugs": { + "url": "https://github.com/mikolalysenko/uniq/issues" + }, + "homepage": "https://github.com/mikolalysenko/uniq", + "_id": "uniq@1.0.1", + "dist": { + "shasum": "b31c5ae8254844a3a8281541ce2b04b865a734ff", + "tarball": "http://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz" + }, + "_from": "uniq@>=1.0.1 <2.0.0", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "mikolalysenko", + "email": "mikolalysenko@gmail.com" + }, + "maintainers": [ + { + "name": "mikolalysenko", + "email": "mikolalysenko@gmail.com" + } + ], + "_shasum": "b31c5ae8254844a3a8281541ce2b04b865a734ff", + "_resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/uniq/test/test.js b/node_modules/standard/node_modules/uniq/test/test.js new file mode 100644 index 00000000..efc4fc8b --- /dev/null +++ b/node_modules/standard/node_modules/uniq/test/test.js @@ -0,0 +1,11 @@ +var unique = require("../uniq.js") + +require("tape")("unique", function(t) { + + t.equals(unique([1,1,2,3,5,5,7]).join(), [1,2,3,5,7].join()) + t.equals(unique([]).join(), [].join()) + t.equals(unique([1,1,1]).join(), [1].join()) + t.equals(unique([1,1,1,2,2,2], function(a,b) { return (a^b)&1 }).join(), [2,1].join()) + + t.end() +}) \ No newline at end of file diff --git a/node_modules/standard/node_modules/uniq/uniq.js b/node_modules/standard/node_modules/uniq/uniq.js new file mode 100644 index 00000000..e86c44b5 --- /dev/null +++ b/node_modules/standard/node_modules/uniq/uniq.js @@ -0,0 +1,57 @@ +"use strict" + +function unique_pred(list, compare) { + var ptr = 1 + , len = list.length + , a=list[0], b=list[0] + for(var i=1; i=0.4" + }, + "gitHead": "94a95d76154103290533b2c55ffa0fe4be16bfef", + "_id": "xtend@4.0.0", + "_shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "_from": "xtend@>=4.0.0 <5.0.0", + "_npmVersion": "1.4.15", + "_npmUser": { + "name": "raynos", + "email": "raynos2@gmail.com" + }, + "maintainers": [ + { + "name": "raynos", + "email": "raynos2@gmail.com" + } + ], + "dist": { + "shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "tarball": "http://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/node_modules/xtend/test.js b/node_modules/standard/node_modules/xtend/test.js new file mode 100644 index 00000000..3369d796 --- /dev/null +++ b/node_modules/standard/node_modules/xtend/test.js @@ -0,0 +1,63 @@ +var test = require("tape") +var extend = require("./") +var mutableExtend = require("./mutable") + +test("merge", function(assert) { + var a = { a: "foo" } + var b = { b: "bar" } + + assert.deepEqual(extend(a, b), { a: "foo", b: "bar" }) + assert.end() +}) + +test("replace", function(assert) { + var a = { a: "foo" } + var b = { a: "bar" } + + assert.deepEqual(extend(a, b), { a: "bar" }) + assert.end() +}) + +test("undefined", function(assert) { + var a = { a: undefined } + var b = { b: "foo" } + + assert.deepEqual(extend(a, b), { a: undefined, b: "foo" }) + assert.deepEqual(extend(b, a), { a: undefined, b: "foo" }) + assert.end() +}) + +test("handle 0", function(assert) { + var a = { a: "default" } + var b = { a: 0 } + + assert.deepEqual(extend(a, b), { a: 0 }) + assert.deepEqual(extend(b, a), { a: "default" }) + assert.end() +}) + +test("is immutable", function (assert) { + var record = {} + + extend(record, { foo: "bar" }) + assert.equal(record.foo, undefined) + assert.end() +}) + +test("null as argument", function (assert) { + var a = { foo: "bar" } + var b = null + var c = void 0 + + assert.deepEqual(extend(b, a, c), { foo: "bar" }) + assert.end() +}) + +test("mutable", function (assert) { + var a = { foo: "bar" } + + mutableExtend(a, { bar: "baz" }) + + assert.equal(a.bar, "baz") + assert.end() +}) diff --git a/node_modules/standard/package.json b/node_modules/standard/package.json new file mode 100644 index 00000000..efd4bc6d --- /dev/null +++ b/node_modules/standard/package.json @@ -0,0 +1,97 @@ +{ + "name": "standard", + "description": "JavaScript Standard Style", + "version": "3.7.3", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bin": { + "standard": "./bin/cmd.js" + }, + "bugs": { + "url": "https://github.com/feross/standard/issues" + }, + "dependencies": { + "dezalgo": "^1.0.1", + "eslint": "^0.18.0", + "eslint-plugin-react": "^2.1.0", + "find-root": "^0.1.1", + "get-stdin": "^4.0.1", + "glob": "^5.0.0", + "minimist": "^1.1.0", + "run-parallel": "^1.0.0", + "standard-format": "^1.3.3", + "uniq": "^1.0.1", + "xtend": "^4.0.0" + }, + "devDependencies": { + "mkdirp": "^0.5.0", + "rimraf": "^2.2.8", + "run-series": "^1.0.2", + "tape": "^4.0.0" + }, + "homepage": "https://github.com/feross/standard", + "keywords": [ + "standard", + "style checker", + "code style", + "code checker", + "code linter", + "style linter", + "simple", + "policy", + "style", + "code", + "lint", + "eslint", + "jshint", + "jscs", + "hint", + "enforce", + "check", + "verify", + "quality", + "checker", + "code standards", + "JavaScript Standard Style", + "standard style" + ], + "license": "MIT", + "main": "index.js", + "preferGlobal": true, + "repository": { + "type": "git", + "url": "git://github.com/feross/standard.git" + }, + "scripts": { + "test": "node ./bin/cmd.js && tape test/*.js" + }, + "standard": { + "ignore": "tmp/" + }, + "gitHead": "84c4dc557ee0cc14099ddc05ac039151378b26b6", + "_id": "standard@3.7.3", + "_shasum": "bb026ba1940aa400a80c91df12c0fff1cfc20532", + "_from": "standard@3.7.3", + "_npmVersion": "2.8.4", + "_nodeVersion": "1.8.1", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "bb026ba1940aa400a80c91df12c0fff1cfc20532", + "tarball": "http://registry.npmjs.org/standard/-/standard-3.7.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/standard/-/standard-3.7.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/standard/rc/.eslintrc b/node_modules/standard/rc/.eslintrc new file mode 100644 index 00000000..261716f1 --- /dev/null +++ b/node_modules/standard/rc/.eslintrc @@ -0,0 +1,189 @@ +{ + "ecmaFeatures": { + "globalReturn": true, + "jsx": true, + "modules": true + }, + + "env": { + "browser": false, + "es6": true, + "node": true, + }, + + "globals": { + "document": false, + "escape": false, + "navigator": false, + "unescape": false, + "window": false + }, + + "plugins": [ + "react" + ], + + "rules": { + "block-scoped-var": 0, + "brace-style": [2, "1tbs", { "allowSingleLine": true }], + "camelcase": 0, + "comma-dangle": [2, "never"], + "comma-spacing": [2, { "before": false, "after": true }], + "comma-style": [2, "last"], + "complexity": 0, + "consistent-return": 0, + "consistent-this": 0, + "curly": [2, "multi-line"], + "default-case": 0, + "dot-notation": 0, + "eol-last": 2, + "eqeqeq": [2, "allow-null"], + "func-names": 0, + "func-style": [0, "declaration"], + "generator-star": [2, "middle"], + "guard-for-in": 0, + "handle-callback-err": [2, "^(err|error|anySpecificError)$" ], + "indent": [2, 2], + "key-spacing": [2, { "beforeColon": false, "afterColon": true }], + "max-depth": 0, + "max-len": 0, + "max-nested-callbacks": 0, + "max-params": 0, + "max-statements": 0, + "new-cap": [2, { "newIsCap": true, "capIsNew": false }], + "new-parens": 2, + "no-alert": 0, + "no-array-constructor": 2, + "no-bitwise": 0, + "no-caller": 2, + "no-catch-shadow": 0, + "no-cond-assign": 2, + "no-console": 0, + "no-constant-condition": 0, + "no-control-regex": 2, + "no-debugger": 2, + "no-delete-var": 2, + "no-div-regex": 0, + "no-dupe-args": 2, + "no-dupe-keys": 2, + "no-duplicate-case": 2, + "no-else-return": 0, + "no-empty": 0, + "no-empty-class": 2, + "no-empty-label": 2, + "no-eq-null": 0, + "no-eval": 2, + "no-ex-assign": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-extra-boolean-cast": 2, + "no-extra-parens": 0, + "no-extra-semi": 0, + "no-extra-strict": 0, + "no-fallthrough": 2, + "no-floating-decimal": 2, + "no-func-assign": 2, + "no-implied-eval": 2, + "no-inline-comments": 0, + "no-inner-declarations": [2, "functions"], + "no-invalid-regexp": 2, + "no-irregular-whitespace": 2, + "no-iterator": 2, + "no-label-var": 2, + "no-labels": 2, + "no-lone-blocks": 0, + "no-lonely-if": 0, + "no-loop-func": 0, + "no-mixed-requires": [0, false], + "no-mixed-spaces-and-tabs": [2, false], + "no-multi-spaces": 2, + "no-multi-str": 2, + "no-multiple-empty-lines": [2, { "max": 1 }], + "no-native-reassign": 2, + "no-negated-in-lhs": 2, + "no-nested-ternary": 0, + "no-new": 2, + "no-new-func": 2, + "no-new-object": 2, + "no-new-require": 2, + "no-new-wrappers": 2, + "no-obj-calls": 2, + "no-octal": 2, + "no-octal-escape": 2, + "no-path-concat": 0, + "no-plusplus": 0, + "no-process-env": 0, + "no-process-exit": 0, + "no-proto": 2, + "no-redeclare": 2, + "no-regex-spaces": 2, + "no-reserved-keys": 0, + "no-restricted-modules": 0, + "no-return-assign": 2, + "no-script-url": 0, + "no-self-compare": 2, + "no-sequences": 2, + "no-shadow": 0, + "no-shadow-restricted-names": 2, + "no-spaced-func": 2, + "no-sparse-arrays": 2, + "no-sync": 0, + "no-ternary": 0, + "no-throw-literal": 2, + "no-trailing-spaces": 2, + "no-undef": 2, + "no-undef-init": 2, + "no-undefined": 0, + "no-underscore-dangle": 0, + "no-unreachable": 2, + "no-unused-expressions": 0, + "no-unused-vars": [2, { "vars": "all", "args": "none" }], + "no-use-before-define": 0, + "no-var": 0, + "no-void": 0, + "no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }], + "no-with": 2, + "no-wrap-func": 2, + "one-var": 0, + "operator-assignment": [0, "always"], + "padded-blocks": [2, "never"], + "quote-props": 0, + "quotes": [2, "single", "avoid-escape"], + "radix": 2, + "react/display-name": 2, + "react/jsx-boolean-value": 2, + "react/jsx-quotes": [2, "single", "avoid-escape"], + "react/jsx-no-undef": 2, + "react/jsx-sort-props": 0, + "react/jsx-uses-react": 2, + "react/jsx-uses-vars": 2, + "react/no-did-mount-set-state": 2, + "react/no-did-update-set-state": 2, + "react/no-multi-comp": 2, + "react/no-unknown-property": 2, + "react/prop-types": 2, + "react/react-in-jsx-scope": 2, + "react/self-closing-comp": 2, + "react/wrap-multilines": 2, + "semi": [2, "never"], + "semi-spacing": 0, + "sort-vars": 0, + "space-after-keywords": [2, "always"], + "space-before-blocks": [2, "always"], + "space-before-function-paren": [2, "always"], + "space-in-brackets": 0, + "space-in-parens": [2, "never"], + "space-infix-ops": 2, + "space-return-throw-case": 2, + "space-unary-ops": [2, { "words": true, "nonwords": false }], + "spaced-line-comment": [2, "always"], + "strict": 0, + "use-isnan": 2, + "valid-jsdoc": 0, + "valid-typeof": 2, + "vars-on-top": 0, + "wrap-iife": [2, "any"], + "wrap-regex": 0, + "yoda": [2, "never"] + } +} diff --git a/node_modules/standard/test/api.js b/node_modules/standard/test/api.js new file mode 100644 index 00000000..45c33396 --- /dev/null +++ b/node_modules/standard/test/api.js @@ -0,0 +1,20 @@ +var standard = require('../') +var test = require('tape') + +test('api: lintFiles', function (t) { + t.plan(3) + standard.lintFiles([], { cwd: 'bin' }, function (err, result) { + t.error(err, 'no error while linting') + t.equal(typeof result, 'object', 'result is an object') + t.equal(result.errorCount, 0) + }) +}) + +test('api: lintText', function (t) { + t.plan(3) + standard.lintText('console.log("hi there")\n', function (err, result) { + t.error(err, 'no error while linting') + t.equal(typeof result, 'object', 'result is an object') + t.equal(result.errorCount, 1, 'should have used single quotes') + }) +}) diff --git a/node_modules/standard/test/clone.js b/node_modules/standard/test/clone.js new file mode 100644 index 00000000..dc7583bd --- /dev/null +++ b/node_modules/standard/test/clone.js @@ -0,0 +1,103 @@ +#!/usr/bin/env node + +/** + * Clones several projects that are known to follow "JavaScript Standard Style" and runs + * the `standard` style checker to verify that it passes without warnings. This helps + * ensure we don't accidentally introduce new style rules that cause previously "good" + * code to start failing with new warnings! (And if we do, then that needs to be a MAJOR + * VERSION BUMP.) + */ + +var cp = require('child_process') +var extend = require('xtend') +var mkdirp = require('mkdirp') +var path = require('path') +var rimraf = require('rimraf') +var series = require('run-series') +var test = require('tape') + +var TMP = path.join(__dirname, '..', 'tmp') +var STANDARD = path.join(__dirname, '..', 'bin', 'cmd.js') + +var URLS = [ + 'https://github.com/beatgammit/base64-js.git', + 'https://github.com/brandonhorst/coverage-test.git', + 'https://github.com/brandonhorst/empty.git', + 'https://github.com/feross/bittorrent-dht.git', + 'https://github.com/feross/bittorrent-protocol.git', + 'https://github.com/feross/bittorrent-tracker.git', + 'https://github.com/feross/buffer.git', + 'https://github.com/feross/magnet-uri.git', + 'https://github.com/feross/parse-torrent.git', + 'https://github.com/feross/simple-peer.git', + 'https://github.com/feross/studynotes.git', + 'https://github.com/feross/webtorrent.git', + 'https://github.com/Flet/dailyconnect.git', + 'https://github.com/Flet/exitzero.git', + 'https://github.com/mafintosh/hms-protocol.git', + 'https://github.com/mafintosh/hms.git', + 'https://github.com/mafintosh/json-format-stream.git', + 'https://github.com/mafintosh/level-enumerate.git', + 'https://github.com/mafintosh/level-logs.git', + 'https://github.com/mafintosh/level-temp.git', + 'https://github.com/mafintosh/node-gyp-install.git', + // 'https://github.com/mafintosh/peerflix.git', // still using standard v2 + 'https://github.com/mafintosh/swap-to-level.git', + 'https://github.com/mafintosh/telephone.git', + 'https://github.com/mafintosh/what-line-is-this.git', + 'https://github.com/maxogden/dat-core.git', + 'https://github.com/maxogden/standard-format.git', + // 'https://github.com/ngoldman/gh-release.git', // still using standard v2 + 'https://github.com/ngoldman/magnet-link.git', + 'https://github.com/ngoldman/wireframe.css.git', + 'https://github.com/npm/fstream.git', + // 'https://github.com/npm/npm.git' // in progress + 'https://github.com/othiym23/packard.git' +] + +var MODULES = {} +URLS.forEach(function (url) { + var name = /\/([^\/]+)\.git$/.exec(url)[1] + MODULES[name] = url +}) + +test('clone repos from github', function (t) { + t.plan(1) + rimraf.sync(TMP) + mkdirp.sync(TMP) + + series(Object.keys(MODULES).map(function (name) { + var url = MODULES[name] + return function (cb) { + var args = [ 'clone', '--depth', 1, url, path.join(TMP, name) ] + // TODO: Start `git` in a way that works on Windows – PR welcome! + spawn('git', args, {}, cb) + } + }), function (err) { + if (err) throw err + t.pass('cloned repos') + }) +}) + +test('lint repos', function (t) { + t.plan(URLS.length) + series(Object.keys(MODULES).map(function (name) { + return function (cb) { + var cwd = path.join(TMP, name) + spawn(STANDARD, [], { cwd: cwd }, function (err) { + t.error(err, name) + cb(null) + }) + } + })) +}) + +function spawn (command, args, opts, cb) { + var child = cp.spawn(command, args, extend({ stdio: 'inherit' }, opts)) + child.on('error', cb) + child.on('close', function (code) { + if (code !== 0) cb(new Error('non-zero exit code: ' + code)) + else cb(null) + }) + return child +} diff --git a/node_modules/string2compact/.travis.yml b/node_modules/string2compact/.travis.yml new file mode 100644 index 00000000..cd88f228 --- /dev/null +++ b/node_modules/string2compact/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: +- '0.10' +env: + global: + - secure: OF/hkV+aSkjjnsBXXzD1JWwjm+UfUoVDfSbxcSvoVtLbRzzrOEIUYbo+CnBO7NJPhbwEBkcSE0yFJgF+iYW9LZMZ3Fc6P6mQ5J0iFOnaOtNAp4v63lJ6kZG5dpZhnDeTqDczLRPyjiF1TDUaIGO02gIijoY/iNc73rkbCADdEb8= + - secure: LPJAG8e2RTFf3aurZGBz13UEMhpT9TIKIRZw+stysueDXGUav/5FNeWvXSFHZ/HY+bO1UkA1KiZDKkBAoMZzVYgZpYILxi6d+Dkv55Q5nkTnnjq6WH1GbfYG+RiMZ56YO2X+Of9G/XE3cyt2wdDVR+FV73KFnQOBj4X0Lpx0jpo= diff --git a/node_modules/string2compact/.zuul.yml b/node_modules/string2compact/.zuul.yml new file mode 100644 index 00000000..a82639aa --- /dev/null +++ b/node_modules/string2compact/.zuul.yml @@ -0,0 +1,16 @@ +ui: tape +browsers: + - name: chrome + version: 39..latest + - name: firefox + version: 34..latest + - name: safari + version: 8..latest + - name: ie + version: 11..latest + - name: iphone + version: 8.1..latest + - name: ipad + version: 8.1..latest + - name: android + version: 5.0..latest diff --git a/node_modules/string2compact/LICENSE b/node_modules/string2compact/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/string2compact/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/string2compact/README.md b/node_modules/string2compact/README.md new file mode 100644 index 00000000..d0bcf0f7 --- /dev/null +++ b/node_modules/string2compact/README.md @@ -0,0 +1,38 @@ +# string2compact +[![build](https://img.shields.io/travis/feross/string2compact.svg?style=flat)](https://travis-ci.org/feross/string2compact) +[![npm](https://img.shields.io/npm/v/string2compact.svg?style=flat)](https://npmjs.org/package/string2compact) +[![npm downloads](https://img.shields.io/npm/dm/string2compact.svg?style=flat)](https://npmjs.org/package/string2compact) +[![gittip](https://img.shields.io/gittip/feross.svg?style=flat)](https://www.gittip.com/feross/) + +#### Convert 'hostname:port' strings to BitTorrent's compact ip/host binary returned by Trackers + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/string2compact.svg)](https://saucelabs.com/u/string2compact) + +This module is the opposite of [compact2string](https://npmjs.org/package/compact2string). It works in the browser with [browserify](http://browserify.org/). It is used by [WebTorrent](http://webtorrent.io), and more specifically, the [bittorrent-tracker](https://github.com/feross/bittorrent-tracker) and [bittorrent-dht](https://github.com/feross/bittorrent-dht) modules. + +### install + +``` +npm install string2compact +``` + +### usage + +#### single string2compact + +```js +var string2compact = require('string2compact') +var compact = string2compact('10.10.10.5:65408') +console.log(compact) // new Buffer('0A0A0A05FF80', 'hex') +``` + +#### tranform multiple into one buffer + +```js +var compacts = string2compact([ '10.10.10.5:128', '100.56.58.99:28525' ]) +console.log(compacts) // new Buffer('0A0A0A05008064383a636f6d', 'hex') +``` + +### license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/string2compact/index.js b/node_modules/string2compact/index.js new file mode 100644 index 00000000..55a6c906 --- /dev/null +++ b/node_modules/string2compact/index.js @@ -0,0 +1,31 @@ +var addrToIPPort = require('addr-to-ip-port') +var ipaddr = require('ipaddr.js') + +module.exports = function (addrs) { + if (typeof addrs === 'string') { + addrs = [ addrs ] + } + + return Buffer.concat(addrs.map(function (addr) { + var s = addrToIPPort(addr) + if (s.length !== 2) { + throw new Error('invalid address format, expecting: 10.10.10.5:128') + } + + var ip = ipaddr.parse(s[0]) + var ipBuf = new Buffer(ip.toByteArray()) + var port = Number(s[1]) + var portBuf = new Buffer(2) + portBuf.writeUInt16BE(port, 0) + return Buffer.concat([ipBuf, portBuf]) + })) +} + +/** + * Also support this usage: + * string2compact.multi([ '10.10.10.5:128', '100.56.58.99:28525' ]) + * + * for parallelism with the `compact2string` module. + */ +module.exports.multi = module.exports +module.exports.multi6 = module.exports diff --git a/node_modules/string2compact/node_modules/addr-to-ip-port/.travis.yml b/node_modules/string2compact/node_modules/addr-to-ip-port/.travis.yml new file mode 100644 index 00000000..2083806b --- /dev/null +++ b/node_modules/string2compact/node_modules/addr-to-ip-port/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.11" + - "0.10" \ No newline at end of file diff --git a/node_modules/string2compact/node_modules/addr-to-ip-port/LICENSE b/node_modules/string2compact/node_modules/addr-to-ip-port/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/string2compact/node_modules/addr-to-ip-port/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/node_modules/string2compact/node_modules/addr-to-ip-port/README.md b/node_modules/string2compact/node_modules/addr-to-ip-port/README.md new file mode 100644 index 00000000..26b426ea --- /dev/null +++ b/node_modules/string2compact/node_modules/addr-to-ip-port/README.md @@ -0,0 +1,28 @@ +# addr-to-ip-port [![travis](https://img.shields.io/travis/feross/addr-to-ip-port.svg)](https://travis-ci.org/feross/addr-to-ip-port) [![npm](https://img.shields.io/npm/v/addr-to-ip-port.svg)](https://npmjs.org/package/addr-to-ip-port) [![downloads](https://img.shields.io/npm/dm/addr-to-ip-port.svg)](https://npmjs.org/package/addr-to-ip-port) [![gittip](https://img.shields.io/gittip/feross.svg)](https://www.gittip.com/feross/) + +#### Convert an "address:port" string to an array [address:string, port:number] + +[![browser support](https://ci.testling.com/feross/addr-to-ip-port.png)](https://ci.testling.com/feross/addr-to-ip-port) + +Uses a cache to prevent excessive array allocations and GC. + +Works in node and the browser. This module is used by [WebTorrent](http://webtorrent.io)! + +### install + +``` +npm install addr-to-ip-port +``` + +### usage + +```js +var addrToIPPort = require('addr-to-ip-port') + +addrToIPPort('1.2.3.4:8000') //=> ['1.2.3.4', 8000] +addrToIPPort('1.2.3.4:8000') //=> ['1.2.3.4', 8000] (returns the cached object) +``` + +### license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/string2compact/node_modules/addr-to-ip-port/index.js b/node_modules/string2compact/node_modules/addr-to-ip-port/index.js new file mode 100644 index 00000000..93cf9a03 --- /dev/null +++ b/node_modules/string2compact/node_modules/addr-to-ip-port/index.js @@ -0,0 +1,22 @@ +var ADDR_RE = /^\[?([^\]]+)\]?:(\d+)$/ // ipv4/ipv6/hostname + port + +var cache = {} + +// reset cache when it gets to 100,000 elements (~ 600KB of ipv4 addresses) +// so it will not grow to consume all memory in long-running processes +var size = 0 + +module.exports = function addrToIPPort (addr) { + if (size === 100000) cache = {} + if (!cache[addr]) { + var m = ADDR_RE.exec(addr) + if (!m) throw new Error('invalid addr: ' + addr) + cache[addr] = [ m[1], Number(m[2]) ] + size += 1 + } + return cache[addr] +} + +module.exports.reset = function reset () { + cache = {} +} diff --git a/node_modules/string2compact/node_modules/addr-to-ip-port/package.json b/node_modules/string2compact/node_modules/addr-to-ip-port/package.json new file mode 100644 index 00000000..9799dec0 --- /dev/null +++ b/node_modules/string2compact/node_modules/addr-to-ip-port/package.json @@ -0,0 +1,73 @@ +{ + "name": "addr-to-ip-port", + "description": "Convert an 'address:port' string to an array [address:string, port:number]", + "version": "1.4.1", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/addr-to-ip-port/issues" + }, + "dependencies": {}, + "devDependencies": { + "benchmark": "^1.0.0", + "tape": "^4.0.0" + }, + "homepage": "https://github.com/feross/addr-to-ip-port", + "keywords": [ + "convert", + "address", + "port", + "cache", + "string", + "array", + "ip", + "addr to ip port", + "webtorrent" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/addr-to-ip-port.git" + }, + "scripts": { + "test": "tape test/*.js", + "perf": "node perf/basic.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/10..latest", + "chrome/25..latest", + "firefox/20..latest", + "safari/6..latest", + "opera/15.0..latest" + ] + }, + "gitHead": "cde6659ee5ef1d56a6e5fbaf615154a246570ae4", + "_id": "addr-to-ip-port@1.4.1", + "_shasum": "19d0d3c813ac44c352b5df2f096c6d8f44117a86", + "_from": "addr-to-ip-port@>=1.0.1 <2.0.0", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "19d0d3c813ac44c352b5df2f096c6d8f44117a86", + "tarball": "http://registry.npmjs.org/addr-to-ip-port/-/addr-to-ip-port-1.4.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/addr-to-ip-port/-/addr-to-ip-port-1.4.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/string2compact/node_modules/addr-to-ip-port/perf/basic.js b/node_modules/string2compact/node_modules/addr-to-ip-port/perf/basic.js new file mode 100644 index 00000000..d9edf51c --- /dev/null +++ b/node_modules/string2compact/node_modules/addr-to-ip-port/perf/basic.js @@ -0,0 +1,20 @@ +var addrToIPPort = require('../') +var util = require('./util') +var suite = util.suite() + +var addrs = [] +for (var i = 1; i < 65536; i++) { + addrs.push('127.0.0.1:' + i) +} + +suite + .add('addr-to-ip-port', function () { + addrToIPPort.reset() + var ipPort + for (var i = 0, len = addrs.length; i < len; i++) { + ipPort = addrToIPPort(addrs[i]) + } + for (var i = 0, len = addrs.length; i < len; i++) { + ipPort = addrToIPPort(addrs[i]) + } + }) diff --git a/node_modules/string2compact/node_modules/addr-to-ip-port/perf/util.js b/node_modules/string2compact/node_modules/addr-to-ip-port/perf/util.js new file mode 100644 index 00000000..afb2e33e --- /dev/null +++ b/node_modules/string2compact/node_modules/addr-to-ip-port/perf/util.js @@ -0,0 +1,19 @@ +var benchmark = require('benchmark') + +exports.suite = function () { + var suite = new benchmark.Suite() + process.nextTick(function () { + suite + .on('error', function (event) { + console.error(event.target.error.stack) + }) + .on('cycle', function (event) { + console.log(String(event.target)) + }) + // .on('complete', function () { + // console.log('Fastest is ' + this.filter('fastest').pluck('name')) + // }) + .run({ async: true }) + }) + return suite +} diff --git a/node_modules/string2compact/node_modules/addr-to-ip-port/test/basic.js b/node_modules/string2compact/node_modules/addr-to-ip-port/test/basic.js new file mode 100644 index 00000000..a8fad594 --- /dev/null +++ b/node_modules/string2compact/node_modules/addr-to-ip-port/test/basic.js @@ -0,0 +1,17 @@ +var addrToIPPort = require('../') +var test = require('tape') + +test('Basic tests', function (t) { + t.deepEqual(addrToIPPort('1.2.3.4:1000'), [ '1.2.3.4', 1000 ]) + t.deepEqual(addrToIPPort('2.3.4.5:1000'), [ '2.3.4.5', 1000 ]) + t.deepEqual(addrToIPPort('[2a00:1450:4008:801::1011]:80'), [ '2a00:1450:4008:801::1011', 80 ]) + t.deepEqual(addrToIPPort('webtorrent.io:80'), [ 'webtorrent.io', 80 ]) + + // test that cache works correctly + var data1 = addrToIPPort('1.2.3.4:2000') + var data2 = addrToIPPort('1.2.3.4:2000') + t.deepEqual(data1, [ '1.2.3.4', 2000 ]) + t.equal(data1, data2) // got literally the same object + + t.end() +}) diff --git a/node_modules/string2compact/node_modules/ipaddr.js/.npmignore b/node_modules/string2compact/node_modules/ipaddr.js/.npmignore new file mode 100644 index 00000000..7a1537ba --- /dev/null +++ b/node_modules/string2compact/node_modules/ipaddr.js/.npmignore @@ -0,0 +1,2 @@ +.idea +node_modules diff --git a/node_modules/string2compact/node_modules/ipaddr.js/Cakefile b/node_modules/string2compact/node_modules/ipaddr.js/Cakefile new file mode 100644 index 00000000..7fd355a7 --- /dev/null +++ b/node_modules/string2compact/node_modules/ipaddr.js/Cakefile @@ -0,0 +1,18 @@ +fs = require 'fs' +CoffeeScript = require 'coffee-script' +nodeunit = require 'nodeunit' +UglifyJS = require 'uglify-js' + +task 'build', 'build the JavaScript files from CoffeeScript source', build = (cb) -> + source = fs.readFileSync 'src/ipaddr.coffee' + fs.writeFileSync 'lib/ipaddr.js', CoffeeScript.compile source.toString() + + invoke 'test' + invoke 'compress' + +task 'test', 'run the bundled tests', (cb) -> + nodeunit.reporters.default.run ['test'] + +task 'compress', 'uglify the resulting javascript', (cb) -> + result = UglifyJS.minify('lib/ipaddr.js') + fs.writeFileSync('ipaddr.min.js', result.code) diff --git a/node_modules/string2compact/node_modules/ipaddr.js/LICENSE b/node_modules/string2compact/node_modules/ipaddr.js/LICENSE new file mode 100644 index 00000000..3493f0df --- /dev/null +++ b/node_modules/string2compact/node_modules/ipaddr.js/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2011 Peter Zotov + +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. \ No newline at end of file diff --git a/node_modules/string2compact/node_modules/ipaddr.js/README.md b/node_modules/string2compact/node_modules/ipaddr.js/README.md new file mode 100644 index 00000000..c596e7e3 --- /dev/null +++ b/node_modules/string2compact/node_modules/ipaddr.js/README.md @@ -0,0 +1,161 @@ +# ipaddr.js — an IPv6 and IPv4 address manipulation library + +ipaddr.js is a small (1.9K minified and gzipped) library for manipulating +IP addresses in JavaScript environments. It runs on both CommonJS runtimes +(e.g. [nodejs]) and in a web browser. + +ipaddr.js allows you to verify and parse string representation of an IP +address, match it against a CIDR range or range list, determine if it falls +into some reserved ranges (examples include loopback and private ranges), +and convert between IPv4 and IPv4-mapped IPv6 addresses. + +[nodejs]: http://nodejs.org + +## Installation + +`npm install ipaddr.js` + +## API + +ipaddr.js defines one object in the global scope: `ipaddr`. In CommonJS, +it is exported from the module: + +```js +var ipaddr = require('ipaddr.js'); +``` + +The API consists of several global methods and two classes: ipaddr.IPv6 and ipaddr.IPv4. + +### Global methods + +There are three global methods defined: `ipaddr.isValid`, `ipaddr.parse` and +`ipaddr.process`. All of them receive a string as a single parameter. + +The `ipaddr.isValid` method returns `true` if the address is a valid IPv4 or +IPv6 address, and `false` otherwise. It does not throw any exceptions. + +The `ipaddr.parse` method returns an object representing the IP address, +or throws an `Error` if the passed string is not a valid representation of an +IP address. + +The `ipaddr.process` method works just like the `ipaddr.parse` one, but it +automatically converts IPv4-mapped IPv6 addresses to their IPv4 couterparts +before returning. It is useful when you have a Node.js instance listening +on an IPv6 socket, and the `net.ivp6.bindv6only` sysctl parameter (or its +equivalent on non-Linux OS) is set to 0. In this case, you can accept IPv4 +connections on your IPv6-only socket, but the remote address will be mangled. +Use `ipaddr.process` method to automatically demangle it. + +### Object representation + +Parsing methods return an object which descends from `ipaddr.IPv6` or +`ipaddr.IPv4`. These objects share some properties, but most of them differ. + +#### Shared properties + +One can determine the type of address by calling `addr.kind()`. It will return +either `"ipv6"` or `"ipv4"`. + +An address can be converted back to its string representation with `addr.toString()`. +Note that this method: + * does not return the original string used to create the object (in fact, there is + no way of getting that string) + * returns a compact representation (when it is applicable) + +A `match(range, bits)` method can be used to check if the address falls into a +certain CIDR range. +Note that an address can be (obviously) matched only against an address of the same type. + +For example: + +```js +var addr = ipaddr.parse("2001:db8:1234::1"); +var range = ipaddr.parse("2001:db8::"); + +addr.match(range, 32); // => true +``` + +Alternatively, `match` can also be called as `match([range, bits])`. In this way, +it can be used together with the `parseCIDR(string)` method, which parses an IP +address together with a CIDR range. + +For example: + +```js +var addr = ipaddr.parse("2001:db8:1234::1"); + +addr.match(ipaddr.parseCIDR("2001:db8::/32")); // => true +``` + +A `range()` method returns one of predefined names for several special ranges defined +by IP protocols. The exact names (and their respective CIDR ranges) can be looked up +in the source: [IPv6 ranges] and [IPv4 ranges]. Some common ones include `"unicast"` +(the default one) and `"reserved"`. + +You can match against your own range list by using +`ipaddr.subnetMatch(address, rangeList, defaultName)` method. It can work with both +IPv6 and IPv4 addresses, and accepts a name-to-subnet map as the range list. For example: + +```js +var rangeList = { + documentationOnly: [ ipaddr.parse('2001:db8::'), 32 ], + tunnelProviders: [ + [ ipaddr.parse('2001:470::'), 32 ], // he.net + [ ipaddr.parse('2001:5c0::'), 32 ] // freenet6 + ] +}; +ipaddr.subnetMatch(ipaddr.parse('2001:470:8:66::1'), rangeList, 'unknown'); // => "he.net" +``` + +The addresses can be converted to their byte representation with `toByteArray()`. +(Actually, JavaScript mostly does not know about byte buffers. They are emulated with +arrays of numbers, each in range of 0..255.) + +```js +var bytes = ipaddr.parse('2a00:1450:8007::68').toByteArray(); // ipv6.google.com +bytes // => [42, 0x00, 0x14, 0x50, 0x80, 0x07, 0x00, , 0x00, 0x68 ] +``` + +The `ipaddr.IPv4` and `ipaddr.IPv6` objects have some methods defined, too. All of them +have the same interface for both protocols, and are similar to global methods. + +`ipaddr.IPvX.isValid(string)` can be used to check if the string is a valid address +for particular protocol, and `ipaddr.IPvX.parse(string)` is the error-throwing parser. + +[IPv6 ranges]: https://github.com/whitequark/ipaddr.js/blob/master/src/ipaddr.coffee#L186 +[IPv4 ranges]: https://github.com/whitequark/ipaddr.js/blob/master/src/ipaddr.coffee#L71 + +#### IPv6 properties + +Sometimes you will want to convert IPv6 not to a compact string representation (with +the `::` substitution); the `toNormalizedString()` method will return an address where +all zeroes are explicit. + +For example: + +```js +var addr = ipaddr.parse("2001:0db8::0001"); +addr.toString(); // => "2001:db8::1" +addr.toNormalizedString(); // => "2001:db8:0:0:0:0:0:1" +``` + +The `isIPv4MappedAddress()` method will return `true` if this address is an IPv4-mapped +one, and `toIPv4Address()` will return an IPv4 object address. + +To access the underlying binary representation of the address, use `addr.parts`. + +```js +var addr = ipaddr.parse("2001:db8:10::1234:DEAD"); +addr.parts // => [0x2001, 0xdb8, 0x10, 0, 0, 0, 0x1234, 0xdead] +``` + +#### IPv4 properties + +`toIPv4MappedAddress()` will return a corresponding IPv4-mapped IPv6 address. + +To access the underlying representation of the address, use `addr.octets`. + +```js +var addr = ipaddr.parse("192.168.1.1"); +addr.octets // => [192, 168, 1, 1] +``` diff --git a/node_modules/string2compact/node_modules/ipaddr.js/ipaddr.min.js b/node_modules/string2compact/node_modules/ipaddr.js/ipaddr.min.js new file mode 100644 index 00000000..9e2800de --- /dev/null +++ b/node_modules/string2compact/node_modules/ipaddr.js/ipaddr.min.js @@ -0,0 +1 @@ +(function(){var r,t,e,n,i,o,a,s;t={},s=this,"undefined"!=typeof module&&null!==module&&module.exports?module.exports=t:s.ipaddr=t,a=function(r,t,e,n){var i,o;if(r.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");for(i=0;n>0;){if(o=e-n,0>o&&(o=0),r[i]>>o!==t[i]>>o)return!1;n-=e,i+=1}return!0},t.subnetMatch=function(r,t,e){var n,i,o,a,s;null==e&&(e="unicast");for(n in t)for(i=t[n],"[object Array]"!==toString.call(i[0])&&(i=[i]),a=0,s=i.length;s>a;a++)if(o=i[a],r.match.apply(r,o))return n;return e},t.IPv4=function(){function r(r){var t,e,n;if(4!==r.length)throw new Error("ipaddr: ipv4 octet count should be 4");for(e=0,n=r.length;n>e;e++)if(t=r[e],!(t>=0&&255>=t))throw new Error("ipaddr: ipv4 octet is a byte");this.octets=r}return r.prototype.kind=function(){return"ipv4"},r.prototype.toString=function(){return this.octets.join(".")},r.prototype.toByteArray=function(){return this.octets.slice(0)},r.prototype.match=function(r,t){var e;if(void 0===t&&(e=r,r=e[0],t=e[1]),"ipv4"!==r.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return a(this.octets,r.octets,8,t)},r.prototype.SpecialRanges={unspecified:[[new r([0,0,0,0]),8]],broadcast:[[new r([255,255,255,255]),32]],multicast:[[new r([224,0,0,0]),4]],linkLocal:[[new r([169,254,0,0]),16]],loopback:[[new r([127,0,0,0]),8]],"private":[[new r([10,0,0,0]),8],[new r([172,16,0,0]),12],[new r([192,168,0,0]),16]],reserved:[[new r([192,0,0,0]),24],[new r([192,0,2,0]),24],[new r([192,88,99,0]),24],[new r([198,51,100,0]),24],[new r([203,0,113,0]),24],[new r([240,0,0,0]),4]]},r.prototype.range=function(){return t.subnetMatch(this,this.SpecialRanges)},r.prototype.toIPv4MappedAddress=function(){return t.IPv6.parse("::ffff:"+this.toString())},r}(),e="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp("^"+e+"\\."+e+"\\."+e+"\\."+e+"$","i"),longValue:new RegExp("^"+e+"$","i")},t.IPv4.parser=function(r){var t,e,i,o,a;if(e=function(r){return"0"===r[0]&&"x"!==r[1]?parseInt(r,8):parseInt(r)},t=r.match(n.fourOctet))return function(){var r,n,o,a;for(o=t.slice(1,6),a=[],r=0,n=o.length;n>r;r++)i=o[r],a.push(e(i));return a}();if(t=r.match(n.longValue)){if(a=e(t[1]),a>4294967295||0>a)throw new Error("ipaddr: address outside defined range");return function(){var r,t;for(t=[],o=r=0;24>=r;o=r+=8)t.push(a>>o&255);return t}().reverse()}return null},t.IPv6=function(){function r(r){var t,e,n;if(8!==r.length)throw new Error("ipaddr: ipv6 part count should be 8");for(e=0,n=r.length;n>e;e++)if(t=r[e],!(t>=0&&65535>=t))throw new Error("ipaddr: ipv6 part should fit to two octets");this.parts=r}return r.prototype.kind=function(){return"ipv6"},r.prototype.toString=function(){var r,t,e,n,i,o,a;for(i=function(){var r,e,n,i;for(n=this.parts,i=[],r=0,e=n.length;e>r;r++)t=n[r],i.push(t.toString(16));return i}.call(this),r=[],e=function(t){return r.push(t)},n=0,o=0,a=i.length;a>o;o++)switch(t=i[o],n){case 0:e("0"===t?"":t),n=1;break;case 1:"0"===t?n=2:e(t);break;case 2:"0"!==t&&(e(""),e(t),n=3);break;case 3:e(t)}return 2===n&&(e(""),e("")),r.join(":")},r.prototype.toByteArray=function(){var r,t,e,n,i;for(r=[],i=this.parts,e=0,n=i.length;n>e;e++)t=i[e],r.push(t>>8),r.push(255&t);return r},r.prototype.toNormalizedString=function(){var r;return function(){var t,e,n,i;for(n=this.parts,i=[],t=0,e=n.length;e>t;t++)r=n[t],i.push(r.toString(16));return i}.call(this).join(":")},r.prototype.match=function(r,t){var e;if(void 0===t&&(e=r,r=e[0],t=e[1]),"ipv6"!==r.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return a(this.parts,r.parts,16,t)},r.prototype.SpecialRanges={unspecified:[new r([0,0,0,0,0,0,0,0]),128],linkLocal:[new r([65152,0,0,0,0,0,0,0]),10],multicast:[new r([65280,0,0,0,0,0,0,0]),8],loopback:[new r([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new r([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new r([0,0,0,0,0,65535,0,0]),96],rfc6145:[new r([0,0,0,0,65535,0,0,0]),96],rfc6052:[new r([100,65435,0,0,0,0,0,0]),96],"6to4":[new r([8194,0,0,0,0,0,0,0]),16],teredo:[new r([8193,0,0,0,0,0,0,0]),32],reserved:[[new r([8193,3512,0,0,0,0,0,0]),32]]},r.prototype.range=function(){return t.subnetMatch(this,this.SpecialRanges)},r.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},r.prototype.toIPv4Address=function(){var r,e,n;if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");return n=this.parts.slice(-2),r=n[0],e=n[1],new t.IPv4([r>>8,255&r,e>>8,255&e])},r}(),i="(?:[0-9a-f]+::?)+",o={"native":new RegExp("^(::)?("+i+")?([0-9a-f]+)?(::)?$","i"),transitional:new RegExp("^((?:"+i+")|(?:::)(?:"+i+")?)"+(""+e+"\\."+e+"\\."+e+"\\."+e+"$"),"i")},r=function(r,t){var e,n,i,o,a;if(r.indexOf("::")!==r.lastIndexOf("::"))return null;for(e=0,n=-1;(n=r.indexOf(":",n+1))>=0;)e++;if(":"===r[0]&&e--,":"===r[r.length-1]&&e--,e>t)return null;for(a=t-e,o=":";a--;)o+="0:";return r=r.replace("::",o),":"===r[0]&&(r=r.slice(1)),":"===r[r.length-1]&&(r=r.slice(0,-1)),function(){var t,e,n,o;for(n=r.split(":"),o=[],t=0,e=n.length;e>t;t++)i=n[t],o.push(parseInt(i,16));return o}()},t.IPv6.parser=function(t){var e,n;return t.match(o["native"])?r(t,8):(e=t.match(o.transitional))&&(n=r(e[1].slice(0,-1),6))?(n.push(parseInt(e[2])<<8|parseInt(e[3])),n.push(parseInt(e[4])<<8|parseInt(e[5])),n):null},t.IPv4.isIPv4=t.IPv6.isIPv6=function(r){return null!==this.parser(r)},t.IPv4.isValid=t.IPv6.isValid=function(r){var t;try{return new this(this.parser(r)),!0}catch(e){return t=e,!1}},t.IPv4.parse=t.IPv6.parse=function(r){var t;if(t=this.parser(r),null===t)throw new Error("ipaddr: string is not formatted like ip address");return new this(t)},t.IPv4.parseCIDR=t.IPv6.parseCIDR=function(r){var t;if(t=r.match(/^(.+)\/(\d+)$/))return[this.parse(t[1]),parseInt(t[2])];throw new Error("ipaddr: string is not formatted like a CIDR range")},t.isValid=function(r){return t.IPv6.isValid(r)||t.IPv4.isValid(r)},t.parse=function(r){if(t.IPv6.isValid(r))return t.IPv6.parse(r);if(t.IPv4.isValid(r))return t.IPv4.parse(r);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},t.parseCIDR=function(r){var e;try{return t.IPv6.parseCIDR(r)}catch(n){e=n;try{return t.IPv4.parseCIDR(r)}catch(n){throw e=n,new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},t.process=function(r){var t;return t=this.parse(r),"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t}}).call(this); \ No newline at end of file diff --git a/node_modules/string2compact/node_modules/ipaddr.js/lib/ipaddr.js b/node_modules/string2compact/node_modules/ipaddr.js/lib/ipaddr.js new file mode 100644 index 00000000..5d99e084 --- /dev/null +++ b/node_modules/string2compact/node_modules/ipaddr.js/lib/ipaddr.js @@ -0,0 +1,439 @@ +(function() { + var expandIPv6, ipaddr, ipv4Part, ipv4Regexes, ipv6Part, ipv6Regexes, matchCIDR, root; + + ipaddr = {}; + + root = this; + + if ((typeof module !== "undefined" && module !== null) && module.exports) { + module.exports = ipaddr; + } else { + root['ipaddr'] = ipaddr; + } + + matchCIDR = function(first, second, partSize, cidrBits) { + var part, shift; + if (first.length !== second.length) { + throw new Error("ipaddr: cannot match CIDR for objects with different lengths"); + } + part = 0; + while (cidrBits > 0) { + shift = partSize - cidrBits; + if (shift < 0) { + shift = 0; + } + if (first[part] >> shift !== second[part] >> shift) { + return false; + } + cidrBits -= partSize; + part += 1; + } + return true; + }; + + ipaddr.subnetMatch = function(address, rangeList, defaultName) { + var rangeName, rangeSubnets, subnet, _i, _len; + if (defaultName == null) { + defaultName = 'unicast'; + } + for (rangeName in rangeList) { + rangeSubnets = rangeList[rangeName]; + if (toString.call(rangeSubnets[0]) !== '[object Array]') { + rangeSubnets = [rangeSubnets]; + } + for (_i = 0, _len = rangeSubnets.length; _i < _len; _i++) { + subnet = rangeSubnets[_i]; + if (address.match.apply(address, subnet)) { + return rangeName; + } + } + } + return defaultName; + }; + + ipaddr.IPv4 = (function() { + function IPv4(octets) { + var octet, _i, _len; + if (octets.length !== 4) { + throw new Error("ipaddr: ipv4 octet count should be 4"); + } + for (_i = 0, _len = octets.length; _i < _len; _i++) { + octet = octets[_i]; + if (!((0 <= octet && octet <= 255))) { + throw new Error("ipaddr: ipv4 octet is a byte"); + } + } + this.octets = octets; + } + + IPv4.prototype.kind = function() { + return 'ipv4'; + }; + + IPv4.prototype.toString = function() { + return this.octets.join("."); + }; + + IPv4.prototype.toByteArray = function() { + return this.octets.slice(0); + }; + + IPv4.prototype.match = function(other, cidrRange) { + var _ref; + if (cidrRange === void 0) { + _ref = other, other = _ref[0], cidrRange = _ref[1]; + } + if (other.kind() !== 'ipv4') { + throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one"); + } + return matchCIDR(this.octets, other.octets, 8, cidrRange); + }; + + IPv4.prototype.SpecialRanges = { + unspecified: [[new IPv4([0, 0, 0, 0]), 8]], + broadcast: [[new IPv4([255, 255, 255, 255]), 32]], + multicast: [[new IPv4([224, 0, 0, 0]), 4]], + linkLocal: [[new IPv4([169, 254, 0, 0]), 16]], + loopback: [[new IPv4([127, 0, 0, 0]), 8]], + "private": [[new IPv4([10, 0, 0, 0]), 8], [new IPv4([172, 16, 0, 0]), 12], [new IPv4([192, 168, 0, 0]), 16]], + reserved: [[new IPv4([192, 0, 0, 0]), 24], [new IPv4([192, 0, 2, 0]), 24], [new IPv4([192, 88, 99, 0]), 24], [new IPv4([198, 51, 100, 0]), 24], [new IPv4([203, 0, 113, 0]), 24], [new IPv4([240, 0, 0, 0]), 4]] + }; + + IPv4.prototype.range = function() { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + + IPv4.prototype.toIPv4MappedAddress = function() { + return ipaddr.IPv6.parse("::ffff:" + (this.toString())); + }; + + return IPv4; + + })(); + + ipv4Part = "(0?\\d+|0x[a-f0-9]+)"; + + ipv4Regexes = { + fourOctet: new RegExp("^" + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "$", 'i'), + longValue: new RegExp("^" + ipv4Part + "$", 'i') + }; + + ipaddr.IPv4.parser = function(string) { + var match, parseIntAuto, part, shift, value; + parseIntAuto = function(string) { + if (string[0] === "0" && string[1] !== "x") { + return parseInt(string, 8); + } else { + return parseInt(string); + } + }; + if (match = string.match(ipv4Regexes.fourOctet)) { + return (function() { + var _i, _len, _ref, _results; + _ref = match.slice(1, 6); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + _results.push(parseIntAuto(part)); + } + return _results; + })(); + } else if (match = string.match(ipv4Regexes.longValue)) { + value = parseIntAuto(match[1]); + if (value > 0xffffffff || value < 0) { + throw new Error("ipaddr: address outside defined range"); + } + return ((function() { + var _i, _results; + _results = []; + for (shift = _i = 0; _i <= 24; shift = _i += 8) { + _results.push((value >> shift) & 0xff); + } + return _results; + })()).reverse(); + } else { + return null; + } + }; + + ipaddr.IPv6 = (function() { + function IPv6(parts) { + var part, _i, _len; + if (parts.length !== 8) { + throw new Error("ipaddr: ipv6 part count should be 8"); + } + for (_i = 0, _len = parts.length; _i < _len; _i++) { + part = parts[_i]; + if (!((0 <= part && part <= 0xffff))) { + throw new Error("ipaddr: ipv6 part should fit to two octets"); + } + } + this.parts = parts; + } + + IPv6.prototype.kind = function() { + return 'ipv6'; + }; + + IPv6.prototype.toString = function() { + var compactStringParts, part, pushPart, state, stringParts, _i, _len; + stringParts = (function() { + var _i, _len, _ref, _results; + _ref = this.parts; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + _results.push(part.toString(16)); + } + return _results; + }).call(this); + compactStringParts = []; + pushPart = function(part) { + return compactStringParts.push(part); + }; + state = 0; + for (_i = 0, _len = stringParts.length; _i < _len; _i++) { + part = stringParts[_i]; + switch (state) { + case 0: + if (part === '0') { + pushPart(''); + } else { + pushPart(part); + } + state = 1; + break; + case 1: + if (part === '0') { + state = 2; + } else { + pushPart(part); + } + break; + case 2: + if (part !== '0') { + pushPart(''); + pushPart(part); + state = 3; + } + break; + case 3: + pushPart(part); + } + } + if (state === 2) { + pushPart(''); + pushPart(''); + } + return compactStringParts.join(":"); + }; + + IPv6.prototype.toByteArray = function() { + var bytes, part, _i, _len, _ref; + bytes = []; + _ref = this.parts; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + bytes.push(part >> 8); + bytes.push(part & 0xff); + } + return bytes; + }; + + IPv6.prototype.toNormalizedString = function() { + var part; + return ((function() { + var _i, _len, _ref, _results; + _ref = this.parts; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + _results.push(part.toString(16)); + } + return _results; + }).call(this)).join(":"); + }; + + IPv6.prototype.match = function(other, cidrRange) { + var _ref; + if (cidrRange === void 0) { + _ref = other, other = _ref[0], cidrRange = _ref[1]; + } + if (other.kind() !== 'ipv6') { + throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one"); + } + return matchCIDR(this.parts, other.parts, 16, cidrRange); + }; + + IPv6.prototype.SpecialRanges = { + unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128], + linkLocal: [new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10], + multicast: [new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8], + loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128], + uniqueLocal: [new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7], + ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96], + rfc6145: [new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96], + rfc6052: [new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96], + '6to4': [new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16], + teredo: [new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32], + reserved: [[new IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32]] + }; + + IPv6.prototype.range = function() { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + + IPv6.prototype.isIPv4MappedAddress = function() { + return this.range() === 'ipv4Mapped'; + }; + + IPv6.prototype.toIPv4Address = function() { + var high, low, _ref; + if (!this.isIPv4MappedAddress()) { + throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4"); + } + _ref = this.parts.slice(-2), high = _ref[0], low = _ref[1]; + return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff]); + }; + + return IPv6; + + })(); + + ipv6Part = "(?:[0-9a-f]+::?)+"; + + ipv6Regexes = { + "native": new RegExp("^(::)?(" + ipv6Part + ")?([0-9a-f]+)?(::)?$", 'i'), + transitional: new RegExp(("^((?:" + ipv6Part + ")|(?:::)(?:" + ipv6Part + ")?)") + ("" + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "$"), 'i') + }; + + expandIPv6 = function(string, parts) { + var colonCount, lastColon, part, replacement, replacementCount; + if (string.indexOf('::') !== string.lastIndexOf('::')) { + return null; + } + colonCount = 0; + lastColon = -1; + while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) { + colonCount++; + } + if (string[0] === ':') { + colonCount--; + } + if (string[string.length - 1] === ':') { + colonCount--; + } + if (colonCount > parts) { + return null; + } + replacementCount = parts - colonCount; + replacement = ':'; + while (replacementCount--) { + replacement += '0:'; + } + string = string.replace('::', replacement); + if (string[0] === ':') { + string = string.slice(1); + } + if (string[string.length - 1] === ':') { + string = string.slice(0, -1); + } + return (function() { + var _i, _len, _ref, _results; + _ref = string.split(":"); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + part = _ref[_i]; + _results.push(parseInt(part, 16)); + } + return _results; + })(); + }; + + ipaddr.IPv6.parser = function(string) { + var match, parts; + if (string.match(ipv6Regexes['native'])) { + return expandIPv6(string, 8); + } else if (match = string.match(ipv6Regexes['transitional'])) { + parts = expandIPv6(match[1].slice(0, -1), 6); + if (parts) { + parts.push(parseInt(match[2]) << 8 | parseInt(match[3])); + parts.push(parseInt(match[4]) << 8 | parseInt(match[5])); + return parts; + } + } + return null; + }; + + ipaddr.IPv4.isIPv4 = ipaddr.IPv6.isIPv6 = function(string) { + return this.parser(string) !== null; + }; + + ipaddr.IPv4.isValid = ipaddr.IPv6.isValid = function(string) { + var e; + try { + new this(this.parser(string)); + return true; + } catch (_error) { + e = _error; + return false; + } + }; + + ipaddr.IPv4.parse = ipaddr.IPv6.parse = function(string) { + var parts; + parts = this.parser(string); + if (parts === null) { + throw new Error("ipaddr: string is not formatted like ip address"); + } + return new this(parts); + }; + + ipaddr.IPv4.parseCIDR = ipaddr.IPv6.parseCIDR = function(string) { + var match; + if (match = string.match(/^(.+)\/(\d+)$/)) { + return [this.parse(match[1]), parseInt(match[2])]; + } + throw new Error("ipaddr: string is not formatted like a CIDR range"); + }; + + ipaddr.isValid = function(string) { + return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string); + }; + + ipaddr.parse = function(string) { + if (ipaddr.IPv6.isValid(string)) { + return ipaddr.IPv6.parse(string); + } else if (ipaddr.IPv4.isValid(string)) { + return ipaddr.IPv4.parse(string); + } else { + throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format"); + } + }; + + ipaddr.parseCIDR = function(string) { + var e; + try { + return ipaddr.IPv6.parseCIDR(string); + } catch (_error) { + e = _error; + try { + return ipaddr.IPv4.parseCIDR(string); + } catch (_error) { + e = _error; + throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format"); + } + } + }; + + ipaddr.process = function(string) { + var addr; + addr = this.parse(string); + if (addr.kind() === 'ipv6' && addr.isIPv4MappedAddress()) { + return addr.toIPv4Address(); + } else { + return addr; + } + }; + +}).call(this); diff --git a/node_modules/string2compact/node_modules/ipaddr.js/package.json b/node_modules/string2compact/node_modules/ipaddr.js/package.json new file mode 100644 index 00000000..311d8d33 --- /dev/null +++ b/node_modules/string2compact/node_modules/ipaddr.js/package.json @@ -0,0 +1,60 @@ +{ + "name": "ipaddr.js", + "description": "A library for manipulating IPv4 and IPv6 addresses in JavaScript.", + "version": "1.0.1", + "author": { + "name": "Peter Zotov", + "email": "whitequark@whitequark.org" + }, + "directories": { + "lib": "./lib" + }, + "dependencies": {}, + "devDependencies": { + "coffee-script": "~1.6", + "nodeunit": "~0.5.3", + "uglify-js": "latest" + }, + "scripts": { + "test": "cake build test" + }, + "keywords": [ + "ip", + "ipv4", + "ipv6" + ], + "repository": { + "type": "git", + "url": "git://github.com/whitequark/ipaddr.js" + }, + "main": "./lib/ipaddr", + "engines": { + "node": ">= 0.2.5" + }, + "license": "MIT", + "gitHead": "0a5a26d9317a58d67047e7f32b5b1bbe7f2f7fbf", + "bugs": { + "url": "https://github.com/whitequark/ipaddr.js/issues" + }, + "_id": "ipaddr.js@1.0.1", + "_shasum": "5f38801dc73e0400fc7076386f6ed5215fbd8f95", + "_from": "ipaddr.js@>=1.0.1 <2.0.0", + "_npmVersion": "1.4.21", + "_npmUser": { + "name": "whitequark", + "email": "whitequark@whitequark.org" + }, + "maintainers": [ + { + "name": "whitequark", + "email": "whitequark@whitequark.org" + } + ], + "dist": { + "shasum": "5f38801dc73e0400fc7076386f6ed5215fbd8f95", + "tarball": "http://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.0.1.tgz", + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/whitequark/ipaddr.js" +} diff --git a/node_modules/string2compact/node_modules/ipaddr.js/src/ipaddr.coffee b/node_modules/string2compact/node_modules/ipaddr.js/src/ipaddr.coffee new file mode 100644 index 00000000..0a48080f --- /dev/null +++ b/node_modules/string2compact/node_modules/ipaddr.js/src/ipaddr.coffee @@ -0,0 +1,374 @@ +# Define the main object +ipaddr = {} + +root = this + +# Export for both the CommonJS and browser-like environment +if module? && module.exports + module.exports = ipaddr +else + root['ipaddr'] = ipaddr + +# A generic CIDR (Classless Inter-Domain Routing) RFC1518 range matcher. +matchCIDR = (first, second, partSize, cidrBits) -> + if first.length != second.length + throw new Error "ipaddr: cannot match CIDR for objects with different lengths" + + part = 0 + while cidrBits > 0 + shift = partSize - cidrBits + shift = 0 if shift < 0 + + if first[part] >> shift != second[part] >> shift + return false + + cidrBits -= partSize + part += 1 + + return true + +# An utility function to ease named range matching. See examples below. +ipaddr.subnetMatch = (address, rangeList, defaultName='unicast') -> + for rangeName, rangeSubnets of rangeList + # ECMA5 Array.isArray isn't available everywhere + if toString.call(rangeSubnets[0]) != '[object Array]' + rangeSubnets = [ rangeSubnets ] + + for subnet in rangeSubnets + return rangeName if address.match.apply(address, subnet) + + return defaultName + +# An IPv4 address (RFC791). +class ipaddr.IPv4 + # Constructs a new IPv4 address from an array of four octets. + # Verifies the input. + constructor: (octets) -> + if octets.length != 4 + throw new Error "ipaddr: ipv4 octet count should be 4" + + for octet in octets + if !(0 <= octet <= 255) + throw new Error "ipaddr: ipv4 octet is a byte" + + @octets = octets + + # The 'kind' method exists on both IPv4 and IPv6 classes. + kind: -> + return 'ipv4' + + # Returns the address in convenient, decimal-dotted format. + toString: -> + return @octets.join "." + + # Returns an array of byte-sized values in network order + toByteArray: -> + return @octets.slice(0) # octets.clone + + # Checks if this address matches other one within given CIDR range. + match: (other, cidrRange) -> + if cidrRange == undefined + [other, cidrRange] = other + + if other.kind() != 'ipv4' + throw new Error "ipaddr: cannot match ipv4 address with non-ipv4 one" + + return matchCIDR(this.octets, other.octets, 8, cidrRange) + + # Special IPv4 address ranges. + SpecialRanges: + unspecified: [ + [ new IPv4([0, 0, 0, 0]), 8 ] + ] + broadcast: [ + [ new IPv4([255, 255, 255, 255]), 32 ] + ] + multicast: [ # RFC3171 + [ new IPv4([224, 0, 0, 0]), 4 ] + ] + linkLocal: [ # RFC3927 + [ new IPv4([169, 254, 0, 0]), 16 ] + ] + loopback: [ # RFC5735 + [ new IPv4([127, 0, 0, 0]), 8 ] + ] + private: [ # RFC1918 + [ new IPv4([10, 0, 0, 0]), 8 ] + [ new IPv4([172, 16, 0, 0]), 12 ] + [ new IPv4([192, 168, 0, 0]), 16 ] + ] + reserved: [ # Reserved and testing-only ranges; RFCs 5735, 5737, 2544, 1700 + [ new IPv4([192, 0, 0, 0]), 24 ] + [ new IPv4([192, 0, 2, 0]), 24 ] + [ new IPv4([192, 88, 99, 0]), 24 ] + [ new IPv4([198, 51, 100, 0]), 24 ] + [ new IPv4([203, 0, 113, 0]), 24 ] + [ new IPv4([240, 0, 0, 0]), 4 ] + ] + + # Checks if the address corresponds to one of the special ranges. + range: -> + return ipaddr.subnetMatch(this, @SpecialRanges) + + # Convrets this IPv4 address to an IPv4-mapped IPv6 address. + toIPv4MappedAddress: -> + return ipaddr.IPv6.parse "::ffff:#{@toString()}" + +# A list of regular expressions that match arbitrary IPv4 addresses, +# for which a number of weird notations exist. +# Note that an address like 0010.0xa5.1.1 is considered legal. +ipv4Part = "(0?\\d+|0x[a-f0-9]+)" +ipv4Regexes = + fourOctet: new RegExp "^#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}$", 'i' + longValue: new RegExp "^#{ipv4Part}$", 'i' + +# Classful variants (like a.b, where a is an octet, and b is a 24-bit +# value representing last three octets; this corresponds to a class C +# address) are omitted due to classless nature of modern Internet. +ipaddr.IPv4.parser = (string) -> + parseIntAuto = (string) -> + if string[0] == "0" && string[1] != "x" + parseInt(string, 8) + else + parseInt(string) + + # parseInt recognizes all that octal & hexadecimal weirdness for us + if match = string.match(ipv4Regexes.fourOctet) + return (parseIntAuto(part) for part in match[1..5]) + else if match = string.match(ipv4Regexes.longValue) + value = parseIntAuto(match[1]) + if value > 0xffffffff || value < 0 + throw new Error "ipaddr: address outside defined range" + return ((value >> shift) & 0xff for shift in [0..24] by 8).reverse() + else + return null + +# An IPv6 address (RFC2460) +class ipaddr.IPv6 + # Constructs an IPv6 address from an array of eight 16-bit parts. + # Throws an error if the input is invalid. + constructor: (parts) -> + if parts.length != 8 + throw new Error "ipaddr: ipv6 part count should be 8" + + for part in parts + if !(0 <= part <= 0xffff) + throw new Error "ipaddr: ipv6 part should fit to two octets" + + @parts = parts + + # The 'kind' method exists on both IPv4 and IPv6 classes. + kind: -> + return 'ipv6' + + # Returns the address in compact, human-readable format like + # 2001:db8:8:66::1 + toString: -> + stringParts = (part.toString(16) for part in @parts) + + compactStringParts = [] + pushPart = (part) -> compactStringParts.push part + + state = 0 + for part in stringParts + switch state + when 0 + if part == '0' + pushPart('') + else + pushPart(part) + + state = 1 + when 1 + if part == '0' + state = 2 + else + pushPart(part) + when 2 + unless part == '0' + pushPart('') + pushPart(part) + state = 3 + when 3 + pushPart(part) + + if state == 2 + pushPart('') + pushPart('') + + return compactStringParts.join ":" + + # Returns an array of byte-sized values in network order + toByteArray: -> + bytes = [] + for part in @parts + bytes.push(part >> 8) + bytes.push(part & 0xff) + + return bytes + + # Returns the address in expanded format with all zeroes included, like + # 2001:db8:8:66:0:0:0:1 + toNormalizedString: -> + return (part.toString(16) for part in @parts).join ":" + + # Checks if this address matches other one within given CIDR range. + match: (other, cidrRange) -> + if cidrRange == undefined + [other, cidrRange] = other + + if other.kind() != 'ipv6' + throw new Error "ipaddr: cannot match ipv6 address with non-ipv6 one" + + return matchCIDR(this.parts, other.parts, 16, cidrRange) + + # Special IPv6 ranges + SpecialRanges: + unspecified: [ new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128 ] # RFC4291, here and after + linkLocal: [ new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10 ] + multicast: [ new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8 ] + loopback: [ new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128 ] + uniqueLocal: [ new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7 ] + ipv4Mapped: [ new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96 ] + rfc6145: [ new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96 ] # RFC6145 + rfc6052: [ new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96 ] # RFC6052 + '6to4': [ new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16 ] # RFC3056 + teredo: [ new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32 ] # RFC6052, RFC6146 + reserved: [ + [ new IPv6([ 0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32 ] # RFC4291 + ] + + # Checks if the address corresponds to one of the special ranges. + range: -> + return ipaddr.subnetMatch(this, @SpecialRanges) + + # Checks if this address is an IPv4-mapped IPv6 address. + isIPv4MappedAddress: -> + return @range() == 'ipv4Mapped' + + # Converts this address to IPv4 address if it is an IPv4-mapped IPv6 address. + # Throws an error otherwise. + toIPv4Address: -> + unless @isIPv4MappedAddress() + throw new Error "ipaddr: trying to convert a generic ipv6 address to ipv4" + + [high, low] = @parts[-2..-1] + + return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff]) + +# IPv6-matching regular expressions. +# For IPv6, the task is simpler: it is enough to match the colon-delimited +# hexadecimal IPv6 and a transitional variant with dotted-decimal IPv4 at +# the end. +ipv6Part = "(?:[0-9a-f]+::?)+" +ipv6Regexes = + native: new RegExp "^(::)?(#{ipv6Part})?([0-9a-f]+)?(::)?$", 'i' + transitional: new RegExp "^((?:#{ipv6Part})|(?:::)(?:#{ipv6Part})?)" + + "#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}$", 'i' + +# Expand :: in an IPv6 address or address part consisting of `parts` groups. +expandIPv6 = (string, parts) -> + # More than one '::' means invalid adddress + if string.indexOf('::') != string.lastIndexOf('::') + return null + + # How many parts do we already have? + colonCount = 0 + lastColon = -1 + while (lastColon = string.indexOf(':', lastColon + 1)) >= 0 + colonCount++ + + # 0::0 is two parts more than :: + colonCount-- if string[0] == ':' + colonCount-- if string[string.length-1] == ':' + + # The following loop would hang if colonCount > parts + if colonCount > parts + return null + + # replacement = ':' + '0:' * (parts - colonCount) + replacementCount = parts - colonCount + replacement = ':' + while replacementCount-- + replacement += '0:' + + # Insert the missing zeroes + string = string.replace('::', replacement) + + # Trim any garbage which may be hanging around if :: was at the edge in + # the source string + string = string[1..-1] if string[0] == ':' + string = string[0..-2] if string[string.length-1] == ':' + + return (parseInt(part, 16) for part in string.split(":")) + +# Parse an IPv6 address. +ipaddr.IPv6.parser = (string) -> + if string.match(ipv6Regexes['native']) + return expandIPv6(string, 8) + + else if match = string.match(ipv6Regexes['transitional']) + parts = expandIPv6(match[1][0..-2], 6) + if parts + parts.push(parseInt(match[2]) << 8 | parseInt(match[3])) + parts.push(parseInt(match[4]) << 8 | parseInt(match[5])) + return parts + + return null + +# Checks if a given string is formatted like IPv4/IPv6 address. +ipaddr.IPv4.isIPv4 = ipaddr.IPv6.isIPv6 = (string) -> + return @parser(string) != null + +# Checks if a given string is a valid IPv4/IPv6 address. +ipaddr.IPv4.isValid = ipaddr.IPv6.isValid = (string) -> + try + new this(@parser(string)) + return true + catch e + return false + +# Tries to parse and validate a string with IPv4/IPv6 address. +# Throws an error if it fails. +ipaddr.IPv4.parse = ipaddr.IPv6.parse = (string) -> + parts = @parser(string) + if parts == null + throw new Error "ipaddr: string is not formatted like ip address" + + return new this(parts) + +ipaddr.IPv4.parseCIDR = ipaddr.IPv6.parseCIDR = (string) -> + if match = string.match(/^(.+)\/(\d+)$/) + return [@parse(match[1]), parseInt(match[2])] + + throw new Error "ipaddr: string is not formatted like a CIDR range" + +# Checks if the address is valid IP address +ipaddr.isValid = (string) -> + return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string) + +# Try to parse an address and throw an error if it is impossible +ipaddr.parse = (string) -> + if ipaddr.IPv6.isValid(string) + return ipaddr.IPv6.parse(string) + else if ipaddr.IPv4.isValid(string) + return ipaddr.IPv4.parse(string) + else + throw new Error "ipaddr: the address has neither IPv6 nor IPv4 format" + +ipaddr.parseCIDR = (string) -> + try + return ipaddr.IPv6.parseCIDR(string) + catch e + try + return ipaddr.IPv4.parseCIDR(string) + catch e + throw new Error "ipaddr: the address has neither IPv6 nor IPv4 CIDR format" + +# Parse an address and return plain IPv4 address if it is an IPv4-mapped address +ipaddr.process = (string) -> + addr = @parse(string) + if addr.kind() == 'ipv6' && addr.isIPv4MappedAddress() + return addr.toIPv4Address() + else + return addr diff --git a/node_modules/string2compact/node_modules/ipaddr.js/test/ipaddr.test.coffee b/node_modules/string2compact/node_modules/ipaddr.js/test/ipaddr.test.coffee new file mode 100644 index 00000000..361561e7 --- /dev/null +++ b/node_modules/string2compact/node_modules/ipaddr.js/test/ipaddr.test.coffee @@ -0,0 +1,262 @@ +ipaddr = require '../lib/ipaddr' + +module.exports = + 'should define main classes': (test) -> + test.ok(ipaddr.IPv4?, 'defines IPv4 class') + test.ok(ipaddr.IPv6?, 'defines IPv6 class') + test.done() + + 'can construct IPv4 from octets': (test) -> + test.doesNotThrow -> + new ipaddr.IPv4([192, 168, 1, 2]) + test.done() + + 'refuses to construct invalid IPv4': (test) -> + test.throws -> + new ipaddr.IPv4([300, 1, 2, 3]) + test.throws -> + new ipaddr.IPv4([8, 8, 8]) + test.done() + + 'converts IPv4 to string correctly': (test) -> + addr = new ipaddr.IPv4([192, 168, 1, 1]) + test.equal(addr.toString(), '192.168.1.1') + test.done() + + 'returns correct kind for IPv4': (test) -> + addr = new ipaddr.IPv4([1, 2, 3, 4]) + test.equal(addr.kind(), 'ipv4') + test.done() + + 'allows to access IPv4 octets': (test) -> + addr = new ipaddr.IPv4([42, 0, 0, 0]) + test.equal(addr.octets[0], 42) + test.done() + + 'checks IPv4 address format': (test) -> + test.equal(ipaddr.IPv4.isIPv4('192.168.007.0xa'), true) + test.equal(ipaddr.IPv4.isIPv4('1024.0.0.1'), true) + test.equal(ipaddr.IPv4.isIPv4('8.0xa.wtf.6'), false) + test.done() + + 'validates IPv4 addresses': (test) -> + test.equal(ipaddr.IPv4.isValid('192.168.007.0xa'), true) + test.equal(ipaddr.IPv4.isValid('1024.0.0.1'), false) + test.equal(ipaddr.IPv4.isValid('8.0xa.wtf.6'), false) + test.done() + + 'parses IPv4 in several weird formats': (test) -> + test.deepEqual(ipaddr.IPv4.parse('192.168.1.1').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('0xc0.168.1.1').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('192.0250.1.1').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('0xc0a80101').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('030052000401').octets, [192, 168, 1, 1]) + test.deepEqual(ipaddr.IPv4.parse('3232235777').octets, [192, 168, 1, 1]) + test.done() + + 'barfs at invalid IPv4': (test) -> + test.throws -> + ipaddr.IPv4.parse('10.0.0.wtf') + test.done() + + 'matches IPv4 CIDR correctly': (test) -> + addr = new ipaddr.IPv4([10, 5, 0, 1]) + test.equal(addr.match(ipaddr.IPv4.parse('0.0.0.0'), 0), true) + test.equal(addr.match(ipaddr.IPv4.parse('11.0.0.0'), 8), false) + test.equal(addr.match(ipaddr.IPv4.parse('10.0.0.0'), 8), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.0.0.1'), 8), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.0.0.10'), 8), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.5.5.0'), 16), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.4.5.0'), 16), false) + test.equal(addr.match(ipaddr.IPv4.parse('10.4.5.0'), 15), true) + test.equal(addr.match(ipaddr.IPv4.parse('10.5.0.2'), 32), false) + test.equal(addr.match(addr, 32), true) + test.done() + + 'parses IPv4 CIDR correctly': (test) -> + addr = new ipaddr.IPv4([10, 5, 0, 1]) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('0.0.0.0/0')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('11.0.0.0/8')), false) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.0.0.0/8')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.0.0.1/8')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.0.0.10/8')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.5.5.0/16')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.4.5.0/16')), false) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.4.5.0/15')), true) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.5.0.2/32')), false) + test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.5.0.1/32')), true) + test.throws -> + ipaddr.IPv4.parseCIDR('10.5.0.1') + test.done() + + 'detects reserved IPv4 networks': (test) -> + test.equal(ipaddr.IPv4.parse('0.0.0.0').range(), 'unspecified') + test.equal(ipaddr.IPv4.parse('0.1.0.0').range(), 'unspecified') + test.equal(ipaddr.IPv4.parse('10.1.0.1').range(), 'private') + test.equal(ipaddr.IPv4.parse('192.168.2.1').range(), 'private') + test.equal(ipaddr.IPv4.parse('224.100.0.1').range(), 'multicast') + test.equal(ipaddr.IPv4.parse('169.254.15.0').range(), 'linkLocal') + test.equal(ipaddr.IPv4.parse('127.1.1.1').range(), 'loopback') + test.equal(ipaddr.IPv4.parse('255.255.255.255').range(), 'broadcast') + test.equal(ipaddr.IPv4.parse('240.1.2.3').range(), 'reserved') + test.equal(ipaddr.IPv4.parse('8.8.8.8').range(), 'unicast') + test.done() + + 'can construct IPv6 from parts': (test) -> + test.doesNotThrow -> + new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1]) + test.done() + + 'refuses to construct invalid IPv6': (test) -> + test.throws -> + new ipaddr.IPv6([0xfffff, 0, 0, 0, 0, 0, 0, 1]) + test.throws -> + new ipaddr.IPv6([0xfffff, 0, 0, 0, 0, 0, 1]) + test.done() + + 'converts IPv6 to string correctly': (test) -> + addr = new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1]) + test.equal(addr.toNormalizedString(), '2001:db8:f53a:0:0:0:0:1') + test.equal(addr.toString(), '2001:db8:f53a::1') + test.equal(new ipaddr.IPv6([0, 0, 0, 0, 0, 0, 0, 1]).toString(), '::1') + test.equal(new ipaddr.IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]).toString(), '2001:db8::') + test.done() + + 'returns correct kind for IPv6': (test) -> + addr = new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1]) + test.equal(addr.kind(), 'ipv6') + test.done() + + 'allows to access IPv6 address parts': (test) -> + addr = new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 42, 0, 1]) + test.equal(addr.parts[5], 42) + test.done() + + 'checks IPv6 address format': (test) -> + test.equal(ipaddr.IPv6.isIPv6('2001:db8:F53A::1'), true) + test.equal(ipaddr.IPv6.isIPv6('200001::1'), true) + test.equal(ipaddr.IPv6.isIPv6('::ffff:192.168.1.1'), true) + test.equal(ipaddr.IPv6.isIPv6('::ffff:300.168.1.1'), true) + test.equal(ipaddr.IPv6.isIPv6('::ffff:300.168.1.1:0'), false) + test.equal(ipaddr.IPv6.isIPv6('fe80::wtf'), false) + test.done() + + 'validates IPv6 addresses': (test) -> + test.equal(ipaddr.IPv6.isValid('2001:db8:F53A::1'), true) + test.equal(ipaddr.IPv6.isValid('200001::1'), false) + test.equal(ipaddr.IPv6.isValid('::ffff:192.168.1.1'), true) + test.equal(ipaddr.IPv6.isValid('::ffff:300.168.1.1'), false) + test.equal(ipaddr.IPv6.isValid('::ffff:300.168.1.1:0'), false) + test.equal(ipaddr.IPv6.isValid('2001:db8::F53A::1'), false) + test.equal(ipaddr.IPv6.isValid('fe80::wtf'), false) + test.done() + + 'parses IPv6 in different formats': (test) -> + test.deepEqual(ipaddr.IPv6.parse('2001:db8:F53A:0:0:0:0:1').parts, [0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1]) + test.deepEqual(ipaddr.IPv6.parse('fe80::10').parts, [0xfe80, 0, 0, 0, 0, 0, 0, 0x10]) + test.deepEqual(ipaddr.IPv6.parse('2001:db8:F53A::').parts, [0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 0]) + test.deepEqual(ipaddr.IPv6.parse('::1').parts, [0, 0, 0, 0, 0, 0, 0, 1]) + test.deepEqual(ipaddr.IPv6.parse('::').parts, [0, 0, 0, 0, 0, 0, 0, 0]) + test.done() + + 'barfs at invalid IPv6': (test) -> + test.throws -> + ipaddr.IPv6.parse('fe80::0::1') + test.done() + + 'matches IPv6 CIDR correctly': (test) -> + addr = ipaddr.IPv6.parse('2001:db8:f53a::1') + test.equal(addr.match(ipaddr.IPv6.parse('::'), 0), true) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f53a::1:1'), 64), true) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f53b::1:1'), 48), false) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f531::1:1'), 44), true) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f500::1'), 40), true) + test.equal(addr.match(ipaddr.IPv6.parse('2001:db9:f500::1'), 40), false) + test.equal(addr.match(addr, 128), true) + test.done() + + 'parses IPv6 CIDR correctly': (test) -> + addr = ipaddr.IPv6.parse('2001:db8:f53a::1') + test.equal(addr.match(ipaddr.IPv6.parseCIDR('::/0')), true) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f53a::1:1/64')), true) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f53b::1:1/48')), false) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f531::1:1/44')), true) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f500::1/40')), true) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db9:f500::1/40')), false) + test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f53a::1/128')), true) + test.throws -> + ipaddr.IPv6.parseCIDR('2001:db8:f53a::1') + test.done() + + 'converts between IPv4-mapped IPv6 addresses and IPv4 addresses': (test) -> + addr = ipaddr.IPv4.parse('77.88.21.11') + mapped = addr.toIPv4MappedAddress() + test.deepEqual(mapped.parts, [0, 0, 0, 0, 0, 0xffff, 0x4d58, 0x150b]) + test.deepEqual(mapped.toIPv4Address().octets, addr.octets) + test.done() + + 'refuses to convert non-IPv4-mapped IPv6 address to IPv4 address': (test) -> + test.throws -> + ipaddr.IPv6.parse('2001:db8::1').toIPv4Address() + test.done() + + 'detects reserved IPv6 networks': (test) -> + test.equal(ipaddr.IPv6.parse('::').range(), 'unspecified') + test.equal(ipaddr.IPv6.parse('fe80::1234:5678:abcd:0123').range(), 'linkLocal') + test.equal(ipaddr.IPv6.parse('ff00::1234').range(), 'multicast') + test.equal(ipaddr.IPv6.parse('::1').range(), 'loopback') + test.equal(ipaddr.IPv6.parse('fc00::').range(), 'uniqueLocal') + test.equal(ipaddr.IPv6.parse('::ffff:192.168.1.10').range(), 'ipv4Mapped') + test.equal(ipaddr.IPv6.parse('::ffff:0:192.168.1.10').range(), 'rfc6145') + test.equal(ipaddr.IPv6.parse('64:ff9b::1234').range(), 'rfc6052') + test.equal(ipaddr.IPv6.parse('2002:1f63:45e8::1').range(), '6to4') + test.equal(ipaddr.IPv6.parse('2001::4242').range(), 'teredo') + test.equal(ipaddr.IPv6.parse('2001:db8::3210').range(), 'reserved') + test.equal(ipaddr.IPv6.parse('2001:470:8:66::1').range(), 'unicast') + test.done() + + 'is able to determine IP address type': (test) -> + test.equal(ipaddr.parse('8.8.8.8').kind(), 'ipv4') + test.equal(ipaddr.parse('2001:db8:3312::1').kind(), 'ipv6') + test.done() + + 'throws an error if tried to parse an invalid address': (test) -> + test.throws -> + ipaddr.parse('::some.nonsense') + test.done() + + 'correctly processes IPv4-mapped addresses': (test) -> + test.equal(ipaddr.process('8.8.8.8').kind(), 'ipv4') + test.equal(ipaddr.process('2001:db8:3312::1').kind(), 'ipv6') + test.equal(ipaddr.process('::ffff:192.168.1.1').kind(), 'ipv4') + test.done() + + 'correctly converts IPv6 and IPv4 addresses to byte arrays': (test) -> + test.deepEqual(ipaddr.parse('1.2.3.4').toByteArray(), + [0x1, 0x2, 0x3, 0x4]); + # Fuck yeah. The first byte of Google's IPv6 address is 42. 42! + test.deepEqual(ipaddr.parse('2a00:1450:8007::68').toByteArray(), + [42, 0x00, 0x14, 0x50, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68 ]) + test.done() + + 'correctly parses 1 as an IPv4 address': (test) -> + test.equal(ipaddr.IPv6.isValid('1'), false) + test.equal(ipaddr.IPv4.isValid('1'), true) + test.deepEqual(new ipaddr.IPv4([0, 0, 0, 1]), ipaddr.parse('1')) + test.done() + + 'correctly detects IPv4 and IPv6 CIDR addresses': (test) -> + test.deepEqual([ipaddr.IPv6.parse('fc00::'), 64], + ipaddr.parseCIDR('fc00::/64')) + test.deepEqual([ipaddr.IPv4.parse('1.2.3.4'), 5], + ipaddr.parseCIDR('1.2.3.4/5')) + test.done() + + 'does not consider a very large or very small number a valid IP address': (test) -> + test.equal(ipaddr.isValid('4999999999'), false) + test.equal(ipaddr.isValid('-1'), false) + test.done() + + 'does not hang on ::8:8:8:8:8:8:8:8:8': (test) -> + test.equal(ipaddr.IPv6.isValid('::8:8:8:8:8:8:8:8:8'), false) + test.done() diff --git a/node_modules/string2compact/package.json b/node_modules/string2compact/package.json new file mode 100644 index 00000000..ed9cfadd --- /dev/null +++ b/node_modules/string2compact/package.json @@ -0,0 +1,73 @@ +{ + "name": "string2compact", + "description": "Convert 'hostname:port' strings to BitTorrent's compact ip/host binary returned by Trackers", + "version": "1.2.2", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/string2compact/issues" + }, + "dependencies": { + "addr-to-ip-port": "^1.0.1", + "ipaddr.js": "^1.0.1" + }, + "devDependencies": { + "compact2string": "^1.4.0", + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "https://github.com/feross/string2compact", + "keywords": [ + "torrent", + "compact", + "tracker", + "bittorrent", + "peer-to-peer", + "binary", + "convert", + "hostname", + "port", + "webtorrent" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/string2compact.git" + }, + "scripts": { + "test": "npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "testling": { + "files": "test/*.js" + }, + "gitHead": "a6d1c67baa95b99b79c624544bfb9dfeaccb66f4", + "_id": "string2compact@1.2.2", + "_shasum": "420b3a9ee1c46854919b4a2aeac65c43fa50597b", + "_from": "string2compact@1.2.2", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "feross", + "email": "feross@feross.org" + }, + "maintainers": [ + { + "name": "feross", + "email": "feross@feross.org" + } + ], + "dist": { + "shasum": "420b3a9ee1c46854919b4a2aeac65c43fa50597b", + "tarball": "http://registry.npmjs.org/string2compact/-/string2compact-1.2.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/string2compact/-/string2compact-1.2.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/string2compact/test/basic.js b/node_modules/string2compact/test/basic.js new file mode 100644 index 00000000..f80d8545 --- /dev/null +++ b/node_modules/string2compact/test/basic.js @@ -0,0 +1,38 @@ +var compact2string = require('compact2string') +var test = require('tape') + +var string2compact = require('../') + +test('single', function (t) { + var compact = string2compact('10.10.10.5:65408') + t.deepEqual(compact, new Buffer('0A0A0A05FF80', 'hex')) + t.end() +}) + +test('single IPv6', function (t) { + var compact = string2compact('[2a03:2880:2110:9f07:face:b00c::1]:80') + t.deepEqual(compact, new Buffer('2a03288021109f07faceb00c000000010050', 'hex')) + t.end() +}) + +test('multi', function (t) { + // For this test, we assume that the compact2string implementation is good and just run + // the conversion in reverse and see if we get the same thing back + var ips = [ '127.0.0.1:6881', '127.0.0.1:6882' ] + t.deepEqual(compact2string.multi(string2compact(ips)), ips) + t.end() +}) + +test('multi IPv6', function (t) { + // For this test, we assume that the compact2string implementation is good and just run + // the conversion in reverse and see if we get the same thing back + var ips = [ '[2a03:2880:2110:9f07:face:b00c::1]:80', '[2a00:1450:4008:801::1011]:443' ] + t.deepEqual(compact2string.multi6(string2compact(ips)), ips) + t.end() +}) + +test('multi (byte check)', function (t) { + var compacts = string2compact([ '10.10.10.5:128', '100.56.58.99:28525' ]) + t.deepEqual(compacts, new Buffer('0A0A0A05008064383a636f6d', 'hex')) + t.end() +}) diff --git a/node_modules/tape/.npmignore b/node_modules/tape/.npmignore new file mode 100644 index 00000000..07e6e472 --- /dev/null +++ b/node_modules/tape/.npmignore @@ -0,0 +1 @@ +/node_modules diff --git a/node_modules/tape/.travis.yml b/node_modules/tape/.travis.yml new file mode 100644 index 00000000..6064ca09 --- /dev/null +++ b/node_modules/tape/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - "0.10" + - "0.12" + - "iojs" diff --git a/node_modules/tape/LICENSE b/node_modules/tape/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/tape/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/tape/bin/tape b/node_modules/tape/bin/tape new file mode 100755 index 00000000..500f1b14 --- /dev/null +++ b/node_modules/tape/bin/tape @@ -0,0 +1,14 @@ +#!/usr/bin/env node + +var path = require('path'); +var glob = require('glob'); + +process.argv.slice(2).forEach(function (arg) { + glob(arg, function (err, files) { + files.forEach(function (file) { + require(path.resolve(process.cwd(), file)); + }); + }); +}); + +// vim: ft=javascript diff --git a/node_modules/tape/example/array.js b/node_modules/tape/example/array.js new file mode 100644 index 00000000..d36857d4 --- /dev/null +++ b/node_modules/tape/example/array.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); diff --git a/node_modules/tape/example/fail.js b/node_modules/tape/example/fail.js new file mode 100644 index 00000000..a7bf4444 --- /dev/null +++ b/node_modules/tape/example/fail.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]); + } + ); +}); diff --git a/node_modules/tape/example/nested.js b/node_modules/tape/example/nested.js new file mode 100644 index 00000000..0e233d3f --- /dev/null +++ b/node_modules/tape/example/nested.js @@ -0,0 +1,51 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('nested array test', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + t.test('inside test', function (q) { + q.plan(2); + q.ok(true, 'inside ok'); + + setTimeout(function () { + q.ok(true, 'inside delayed'); + }, 3000); + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); + +test('another', function (t) { + t.plan(1); + setTimeout(function () { + t.ok(true); + }, 100); +}); diff --git a/node_modules/tape/example/nested_fail.js b/node_modules/tape/example/nested_fail.js new file mode 100644 index 00000000..3ab5cb3a --- /dev/null +++ b/node_modules/tape/example/nested_fail.js @@ -0,0 +1,51 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('nested array test', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + t.test('inside test', function (q) { + q.plan(2); + q.ok(true); + + setTimeout(function () { + q.equal(3, 4); + }, 3000); + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); + +test('another', function (t) { + t.plan(1); + setTimeout(function () { + t.ok(true); + }, 100); +}); diff --git a/node_modules/tape/example/not_enough.js b/node_modules/tape/example/not_enough.js new file mode 100644 index 00000000..13b682be --- /dev/null +++ b/node_modules/tape/example/not_enough.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('array', function (t) { + t.plan(8); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); diff --git a/node_modules/tape/example/static/build.sh b/node_modules/tape/example/static/build.sh new file mode 100644 index 00000000..c5836404 --- /dev/null +++ b/node_modules/tape/example/static/build.sh @@ -0,0 +1,2 @@ +#!/bin/bash +browserify ../timing.js -o bundle.js diff --git a/node_modules/tape/example/static/index.html b/node_modules/tape/example/static/index.html new file mode 100644 index 00000000..45ccf070 --- /dev/null +++ b/node_modules/tape/example/static/index.html @@ -0,0 +1,21 @@ + + + + + + + + + + diff --git a/node_modules/tape/example/static/server.js b/node_modules/tape/example/static/server.js new file mode 100644 index 00000000..80cea43d --- /dev/null +++ b/node_modules/tape/example/static/server.js @@ -0,0 +1,4 @@ +var http = require('http'); +var ecstatic = require('ecstatic')(__dirname); +var server = http.createServer(ecstatic); +server.listen(8000); diff --git a/node_modules/tape/example/stream/object.js b/node_modules/tape/example/stream/object.js new file mode 100644 index 00000000..8f77f0f1 --- /dev/null +++ b/node_modules/tape/example/stream/object.js @@ -0,0 +1,10 @@ +var test = require('../../'); +var path = require('path'); + +test.createStream({ objectMode: true }).on('data', function (row) { + console.log(JSON.stringify(row)) +}); + +process.argv.slice(2).forEach(function (file) { + require(path.resolve(file)); +}); diff --git a/node_modules/tape/example/stream/tap.js b/node_modules/tape/example/stream/tap.js new file mode 100644 index 00000000..9ea9ff74 --- /dev/null +++ b/node_modules/tape/example/stream/tap.js @@ -0,0 +1,8 @@ +var test = require('../../'); +var path = require('path'); + +test.createStream().pipe(process.stdout); + +process.argv.slice(2).forEach(function (file) { + require(path.resolve(file)); +}); diff --git a/node_modules/tape/example/stream/test/x.js b/node_modules/tape/example/stream/test/x.js new file mode 100644 index 00000000..7dbb98ad --- /dev/null +++ b/node_modules/tape/example/stream/test/x.js @@ -0,0 +1,5 @@ +var test = require('../../../'); +test(function (t) { + t.plan(1); + t.equal('beep', 'boop'); +}); diff --git a/node_modules/tape/example/stream/test/y.js b/node_modules/tape/example/stream/test/y.js new file mode 100644 index 00000000..28606d51 --- /dev/null +++ b/node_modules/tape/example/stream/test/y.js @@ -0,0 +1,11 @@ +var test = require('../../../'); +test(function (t) { + t.plan(2); + t.equal(1+1, 2); + t.ok(true); +}); + +test('wheee', function (t) { + t.ok(true); + t.end(); +}); diff --git a/node_modules/tape/example/throw.js b/node_modules/tape/example/throw.js new file mode 100644 index 00000000..9a69ec0f --- /dev/null +++ b/node_modules/tape/example/throw.js @@ -0,0 +1,10 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('throw', function (t) { + t.plan(2); + + setTimeout(function () { + throw new Error('doom'); + }, 100); +}); diff --git a/node_modules/tape/example/timing.js b/node_modules/tape/example/timing.js new file mode 100644 index 00000000..0268dc78 --- /dev/null +++ b/node_modules/tape/example/timing.js @@ -0,0 +1,12 @@ +var test = require('../'); + +test('timing test', function (t) { + t.plan(2); + + t.equal(typeof Date.now, 'function'); + var start = new Date; + + setTimeout(function () { + t.equal(new Date - start, 100); + }, 100); +}); diff --git a/node_modules/tape/example/too_many.js b/node_modules/tape/example/too_many.js new file mode 100644 index 00000000..ee285fba --- /dev/null +++ b/node_modules/tape/example/too_many.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../'); + +test('array', function (t) { + t.plan(3); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); diff --git a/node_modules/tape/example/two.js b/node_modules/tape/example/two.js new file mode 100644 index 00000000..78e49c37 --- /dev/null +++ b/node_modules/tape/example/two.js @@ -0,0 +1,18 @@ +var test = require('../'); + +test('one', function (t) { + t.plan(2); + t.ok(true); + setTimeout(function () { + t.equal(1+3, 4); + }, 100); +}); + +test('two', function (t) { + t.plan(3); + t.equal(5, 2+3); + setTimeout(function () { + t.equal('a'.charCodeAt(0), 97); + t.ok(true); + }, 50); +}); diff --git a/node_modules/tape/index.js b/node_modules/tape/index.js new file mode 100644 index 00000000..a44daf9a --- /dev/null +++ b/node_modules/tape/index.js @@ -0,0 +1,140 @@ +var defined = require('defined'); +var createDefaultStream = require('./lib/default_stream'); +var Test = require('./lib/test'); +var createResult = require('./lib/results'); +var through = require('through'); + +var canEmitExit = typeof process !== 'undefined' && process + && typeof process.on === 'function' && process.browser !== true +; +var canExit = typeof process !== 'undefined' && process + && typeof process.exit === 'function' +; + +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +exports = module.exports = (function () { + var harness; + var lazyLoad = function () { + return getHarness().apply(this, arguments); + }; + + lazyLoad.only = function () { + return getHarness().only.apply(this, arguments); + }; + + lazyLoad.createStream = function (opts) { + if (!opts) opts = {}; + if (!harness) { + var output = through(); + getHarness({ stream: output, objectMode: opts.objectMode }); + return output; + } + return harness.createStream(opts); + }; + + return lazyLoad + + function getHarness (opts) { + if (!opts) opts = {}; + opts.autoclose = !canEmitExit; + if (!harness) harness = createExitHarness(opts); + return harness; + } +})(); + +function createExitHarness (conf) { + if (!conf) conf = {}; + var harness = createHarness({ + autoclose: defined(conf.autoclose, false) + }); + + var stream = harness.createStream({ objectMode: conf.objectMode }); + var es = stream.pipe(conf.stream || createDefaultStream()); + if (canEmitExit) { + es.on('error', function (err) { harness._exitCode = 1 }); + } + + var ended = false; + stream.on('end', function () { ended = true }); + + if (conf.exit === false) return harness; + if (!canEmitExit || !canExit) return harness; + + var inErrorState = false; + + process.on('exit', function (code) { + // let the process exit cleanly. + if (code !== 0) { + return + } + + if (!ended) { + var only = harness._results._only; + for (var i = 0; i < harness._tests.length; i++) { + var t = harness._tests[i]; + if (only && t.name !== only) continue; + t._exit(); + } + } + harness.close(); + process.exit(code || harness._exitCode); + }); + + return harness; +} + +exports.createHarness = createHarness; +exports.Test = Test; +exports.test = exports; // tap compat +exports.test.skip = Test.skip; + +var exitInterval; + +function createHarness (conf_) { + if (!conf_) conf_ = {}; + var results = createResult(); + if (conf_.autoclose !== false) { + results.once('done', function () { results.close() }); + } + + var test = function (name, conf, cb) { + var t = new Test(name, conf, cb); + test._tests.push(t); + + (function inspectCode (st) { + st.on('test', function sub (st_) { + inspectCode(st_); + }); + st.on('result', function (r) { + if (!r.ok) test._exitCode = 1 + }); + })(t); + + results.push(t); + return t; + }; + test._results = results; + + test._tests = []; + + test.createStream = function (opts) { + return results.createStream(opts); + }; + + var only = false; + test.only = function (name) { + if (only) throw new Error('there can only be one only test'); + results.only(name); + only = true; + return test.apply(null, arguments); + }; + test._exitCode = 0; + + test.close = function () { results.close() }; + + return test; +} diff --git a/node_modules/tape/lib/default_stream.js b/node_modules/tape/lib/default_stream.js new file mode 100644 index 00000000..c8e99180 --- /dev/null +++ b/node_modules/tape/lib/default_stream.js @@ -0,0 +1,31 @@ +var through = require('through'); +var fs = require('fs'); + +module.exports = function () { + var line = ''; + var stream = through(write, flush); + return stream; + + function write (buf) { + for (var i = 0; i < buf.length; i++) { + var c = typeof buf === 'string' + ? buf.charAt(i) + : String.fromCharCode(buf[i]) + ; + if (c === '\n') flush(); + else line += c; + } + } + + function flush () { + if (fs.writeSync && /^win/.test(process.platform)) { + try { fs.writeSync(1, line + '\n'); } + catch (e) { stream.emit('error', e) } + } + else { + try { console.log(line) } + catch (e) { stream.emit('error', e) } + } + line = ''; + } +}; diff --git a/node_modules/tape/lib/results.js b/node_modules/tape/lib/results.js new file mode 100644 index 00000000..fa414f47 --- /dev/null +++ b/node_modules/tape/lib/results.js @@ -0,0 +1,189 @@ +var EventEmitter = require('events').EventEmitter; +var inherits = require('inherits'); +var through = require('through'); +var resumer = require('resumer'); +var inspect = require('object-inspect'); +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +module.exports = Results; +inherits(Results, EventEmitter); + +function Results () { + if (!(this instanceof Results)) return new Results; + this.count = 0; + this.fail = 0; + this.pass = 0; + this._stream = through(); + this.tests = []; +} + +Results.prototype.createStream = function (opts) { + if (!opts) opts = {}; + var self = this; + var output, testId = 0; + if (opts.objectMode) { + output = through(); + self.on('_push', function ontest (t, extra) { + if (!extra) extra = {}; + var id = testId++; + t.once('prerun', function () { + var row = { + type: 'test', + name: t.name, + id: id + }; + if (has(extra, 'parent')) { + row.parent = extra.parent; + } + output.queue(row); + }); + t.on('test', function (st) { + ontest(st, { parent: id }); + }); + t.on('result', function (res) { + res.test = id; + res.type = 'assert'; + output.queue(res); + }); + t.on('end', function () { + output.queue({ type: 'end', test: id }); + }); + }); + self.on('done', function () { output.queue(null) }); + } + else { + output = resumer(); + output.queue('TAP version 13\n'); + self._stream.pipe(output); + } + + nextTick(function next() { + var t; + while (t = getNextTest(self)) { + t.run(); + if (!t.ended) return t.once('end', function(){ nextTick(next); }); + } + self.emit('done'); + }); + + return output; +}; + +Results.prototype.push = function (t) { + var self = this; + self.tests.push(t); + self._watch(t); + self.emit('_push', t); +}; + +Results.prototype.only = function (name) { + if (this._only) { + self.count ++; + self.fail ++; + write('not ok ' + self.count + ' already called .only()\n'); + } + this._only = name; +}; + +Results.prototype._watch = function (t) { + var self = this; + var write = function (s) { self._stream.queue(s) }; + t.once('prerun', function () { + write('# ' + t.name + '\n'); + }); + + t.on('result', function (res) { + if (typeof res === 'string') { + write('# ' + res + '\n'); + return; + } + write(encodeResult(res, self.count + 1)); + self.count ++; + + if (res.ok) self.pass ++ + else self.fail ++ + }); + + t.on('test', function (st) { self._watch(st) }); +}; + +Results.prototype.close = function () { + var self = this; + if (self.closed) self._stream.emit('error', new Error('ALREADY CLOSED')); + self.closed = true; + var write = function (s) { self._stream.queue(s) }; + + write('\n1..' + self.count + '\n'); + write('# tests ' + self.count + '\n'); + write('# pass ' + self.pass + '\n'); + if (self.fail) write('# fail ' + self.fail + '\n') + else write('\n# ok\n') + + self._stream.queue(null); +}; + +function encodeResult (res, count) { + var output = ''; + output += (res.ok ? 'ok ' : 'not ok ') + count; + output += res.name ? ' ' + res.name.toString().replace(/\s+/g, ' ') : ''; + + if (res.skip) output += ' # SKIP'; + else if (res.todo) output += ' # TODO'; + + output += '\n'; + if (res.ok) return output; + + var outer = ' '; + var inner = outer + ' '; + output += outer + '---\n'; + output += inner + 'operator: ' + res.operator + '\n'; + + if (has(res, 'expected') || has(res, 'actual')) { + var ex = inspect(res.expected); + var ac = inspect(res.actual); + + if (Math.max(ex.length, ac.length) > 65) { + output += inner + 'expected:\n' + inner + ' ' + ex + '\n'; + output += inner + 'actual:\n' + inner + ' ' + ac + '\n'; + } + else { + output += inner + 'expected: ' + ex + '\n'; + output += inner + 'actual: ' + ac + '\n'; + } + } + if (res.at) { + output += inner + 'at: ' + res.at + '\n'; + } + if (res.operator === 'error' && res.actual && res.actual.stack) { + var lines = String(res.actual.stack).split('\n'); + output += inner + 'stack:\n'; + output += inner + ' ' + lines[0] + '\n'; + for (var i = 1; i < lines.length; i++) { + output += inner + lines[i] + '\n'; + } + } + + output += outer + '...\n'; + return output; +} + +function getNextTest (results) { + if (!results._only) { + return results.tests.shift(); + } + + do { + var t = results.tests.shift(); + if (!t) continue; + if (results._only === t.name) { + return t; + } + } while (results.tests.length !== 0) +} + +function has (obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} diff --git a/node_modules/tape/lib/test.js b/node_modules/tape/lib/test.js new file mode 100644 index 00000000..f65f12ad --- /dev/null +++ b/node_modules/tape/lib/test.js @@ -0,0 +1,496 @@ +var deepEqual = require('deep-equal'); +var defined = require('defined'); +var path = require('path'); +var inherits = require('inherits'); +var EventEmitter = require('events').EventEmitter; + +module.exports = Test; + +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +inherits(Test, EventEmitter); + +var getTestArgs = function (name_, opts_, cb_) { + var name = '(anonymous)'; + var opts = {}; + var cb; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + var t = typeof arg; + if (t === 'string') { + name = arg; + } + else if (t === 'object') { + opts = arg || opts; + } + else if (t === 'function') { + cb = arg; + } + } + return { name: name, opts: opts, cb: cb }; +}; + +function Test (name_, opts_, cb_) { + if (! (this instanceof Test)) { + return new Test(name_, opts_, cb_); + } + + var args = getTestArgs(name_, opts_, cb_); + + this.readable = true; + this.name = args.name || '(anonymous)'; + this.assertCount = 0; + this.pendingCount = 0; + this._skip = args.opts.skip || false; + this._plan = undefined; + this._cb = args.cb; + this._progeny = []; + this._ok = true; + + if (args.opts.timeout !== undefined) { + this.timeoutAfter(args.opts.timeout); + } + + for (var prop in this) { + this[prop] = (function bind(self, val) { + if (typeof val === 'function') { + return function bound() { + return val.apply(self, arguments); + }; + } + else return val; + })(this, this[prop]); + } +} + +Test.prototype.run = function () { + if (!this._cb || this._skip) { + return this._end(); + } + this.emit('prerun'); + this._cb(this); + this.emit('run'); +}; + +Test.prototype.test = function (name, opts, cb) { + var self = this; + var t = new Test(name, opts, cb); + this._progeny.push(t); + this.pendingCount++; + this.emit('test', t); + t.on('prerun', function () { + self.assertCount++; + }) + + if (!self._pendingAsserts()) { + nextTick(function () { + self._end(); + }); + } + + nextTick(function() { + if (!self._plan && self.pendingCount == self._progeny.length) { + self._end(); + } + }); +}; + +Test.prototype.comment = function (msg) { + this.emit('result', msg.trim().replace(/^#\s*/, '')); +}; + +Test.prototype.plan = function (n) { + this._plan = n; + this.emit('plan', n); +}; + +Test.prototype.timeoutAfter = function(ms) { + if (!ms) throw new Error('timeoutAfter requires a timespan'); + var self = this; + var timeout = setTimeout(function() { + self.fail('test timed out after ' + ms + 'ms'); + self.end(); + }, ms); + this.once('end', function() { + clearTimeout(timeout); + }); +} + +Test.prototype.end = function (err) { + var self = this; + if (arguments.length >= 1 && !!err) { + this.ifError(err); + } + + if (this.calledEnd) { + this.fail('.end() called twice'); + } + this.calledEnd = true; + this._end(); +}; + +Test.prototype._end = function (err) { + var self = this; + if (this._progeny.length) { + var t = this._progeny.shift(); + t.on('end', function () { self._end() }); + t.run(); + return; + } + + if (!this.ended) this.emit('end'); + var pendingAsserts = this._pendingAsserts(); + if (!this._planError && this._plan !== undefined && pendingAsserts) { + this._planError = true; + this.fail('plan != count', { + expected : this._plan, + actual : this.assertCount + }); + } + this.ended = true; +}; + +Test.prototype._exit = function () { + if (this._plan !== undefined && + !this._planError && this.assertCount !== this._plan) { + this._planError = true; + this.fail('plan != count', { + expected : this._plan, + actual : this.assertCount, + exiting : true + }); + } + else if (!this.ended) { + this.fail('test exited without ending', { + exiting: true + }); + } +}; + +Test.prototype._pendingAsserts = function () { + if (this._plan === undefined) { + return 1; + } + else { + return this._plan - (this._progeny.length + this.assertCount); + } +}; + +Test.prototype._assert = function assert (ok, opts) { + var self = this; + var extra = opts.extra || {}; + + var res = { + id : self.assertCount ++, + ok : Boolean(ok), + skip : defined(extra.skip, opts.skip), + name : defined(extra.message, opts.message, '(unnamed assert)'), + operator : defined(extra.operator, opts.operator) + }; + if (has(opts, 'actual') || has(extra, 'actual')) { + res.actual = defined(extra.actual, opts.actual); + } + if (has(opts, 'expected') || has(extra, 'expected')) { + res.expected = defined(extra.expected, opts.expected); + } + this._ok = Boolean(this._ok && ok); + + if (!ok) { + res.error = defined(extra.error, opts.error, new Error(res.name)); + } + + if (!ok) { + var e = new Error('exception'); + var err = (e.stack || '').split('\n'); + var dir = path.dirname(__dirname) + '/'; + + for (var i = 0; i < err.length; i++) { + var m = /^[^\s]*\s*\bat\s+(.+)/.exec(err[i]); + if (!m) { + continue; + } + + var s = m[1].split(/\s+/); + var filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[1]); + if (!filem) { + filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[2]); + + if (!filem) { + filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[3]); + + if (!filem) { + continue; + } + } + } + + if (filem[1].slice(0, dir.length) === dir) { + continue; + } + + res.functionName = s[0]; + res.file = filem[1]; + res.line = Number(filem[2]); + if (filem[3]) res.column = filem[3]; + + res.at = m[1]; + break; + } + } + + self.emit('result', res); + + var pendingAsserts = self._pendingAsserts(); + if (!pendingAsserts) { + if (extra.exiting) { + self._end(); + } else { + nextTick(function () { + self._end(); + }); + } + } + + if (!self._planError && pendingAsserts < 0) { + self._planError = true; + self.fail('plan != count', { + expected : self._plan, + actual : self._plan - pendingAsserts + }); + } +}; + +Test.prototype.fail = function (msg, extra) { + this._assert(false, { + message : msg, + operator : 'fail', + extra : extra + }); +}; + +Test.prototype.pass = function (msg, extra) { + this._assert(true, { + message : msg, + operator : 'pass', + extra : extra + }); +}; + +Test.prototype.skip = function (msg, extra) { + this._assert(true, { + message : msg, + operator : 'skip', + skip : true, + extra : extra + }); +}; + +Test.prototype.ok += Test.prototype['true'] += Test.prototype.assert += function (value, msg, extra) { + this._assert(value, { + message : msg, + operator : 'ok', + expected : true, + actual : value, + extra : extra + }); +}; + +Test.prototype.notOk += Test.prototype['false'] += Test.prototype.notok += function (value, msg, extra) { + this._assert(!value, { + message : msg, + operator : 'notOk', + expected : false, + actual : value, + extra : extra + }); +}; + +Test.prototype.error += Test.prototype.ifError += Test.prototype.ifErr += Test.prototype.iferror += function (err, msg, extra) { + this._assert(!err, { + message : defined(msg, String(err)), + operator : 'error', + actual : err, + extra : extra + }); +}; + +Test.prototype.equal += Test.prototype.equals += Test.prototype.isEqual += Test.prototype.is += Test.prototype.strictEqual += Test.prototype.strictEquals += function (a, b, msg, extra) { + this._assert(a === b, { + message : defined(msg, 'should be equal'), + operator : 'equal', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.notEqual += Test.prototype.notEquals += Test.prototype.notStrictEqual += Test.prototype.notStrictEquals += Test.prototype.isNotEqual += Test.prototype.isNot += Test.prototype.not += Test.prototype.doesNotEqual += Test.prototype.isInequal += function (a, b, msg, extra) { + this._assert(a !== b, { + message : defined(msg, 'should not be equal'), + operator : 'notEqual', + actual : a, + notExpected : b, + extra : extra + }); +}; + +Test.prototype.deepEqual += Test.prototype.deepEquals += Test.prototype.isEquivalent += Test.prototype.same += function (a, b, msg, extra) { + this._assert(deepEqual(a, b, { strict: true }), { + message : defined(msg, 'should be equivalent'), + operator : 'deepEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.deepLooseEqual += Test.prototype.looseEqual += Test.prototype.looseEquals += function (a, b, msg, extra) { + this._assert(deepEqual(a, b), { + message : defined(msg, 'should be equivalent'), + operator : 'deepLooseEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype.notDeepEqual += Test.prototype.notEquivalent += Test.prototype.notDeeply += Test.prototype.notSame += Test.prototype.isNotDeepEqual += Test.prototype.isNotDeeply += Test.prototype.isNotEquivalent += Test.prototype.isInequivalent += function (a, b, msg, extra) { + this._assert(!deepEqual(a, b, { strict: true }), { + message : defined(msg, 'should not be equivalent'), + operator : 'notDeepEqual', + actual : a, + notExpected : b, + extra : extra + }); +}; + +Test.prototype.notDeepLooseEqual += Test.prototype.notLooseEqual += Test.prototype.notLooseEquals += function (a, b, msg, extra) { + this._assert(!deepEqual(a, b), { + message : defined(msg, 'should be equivalent'), + operator : 'notDeepLooseEqual', + actual : a, + expected : b, + extra : extra + }); +}; + +Test.prototype['throws'] = function (fn, expected, msg, extra) { + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + + var caught = undefined; + + try { + fn(); + } catch (err) { + caught = { error : err }; + var message = err.message; + delete err.message; + err.message = message; + } + + var passed = caught; + + if (expected instanceof RegExp) { + passed = expected.test(caught && caught.error); + expected = String(expected); + } + + if (typeof expected === 'function' && caught) { + passed = caught.error instanceof expected; + caught.error = caught.error.constructor; + } + + this._assert(passed, { + message : defined(msg, 'should throw'), + operator : 'throws', + actual : caught && caught.error, + expected : expected, + error: !passed && caught && caught.error, + extra : extra + }); +}; + +Test.prototype.doesNotThrow = function (fn, expected, msg, extra) { + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + var caught = undefined; + try { + fn(); + } + catch (err) { + caught = { error : err }; + } + this._assert(!caught, { + message : defined(msg, 'should not throw'), + operator : 'throws', + actual : caught && caught.error, + expected : expected, + error : caught && caught.error, + extra : extra + }); +}; + +function has (obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +Test.skip = function (name_, _opts, _cb) { + var args = getTestArgs.apply(null, arguments); + args.opts.skip = true; + return Test(args.name, args.opts, args.cb); +}; + +// vim: set softtabstop=4 shiftwidth=4: + diff --git a/node_modules/tape/node_modules/deep-equal/.travis.yml b/node_modules/tape/node_modules/deep-equal/.travis.yml new file mode 100644 index 00000000..f1d0f13c --- /dev/null +++ b/node_modules/tape/node_modules/deep-equal/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/tape/node_modules/deep-equal/LICENSE b/node_modules/tape/node_modules/deep-equal/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/tape/node_modules/deep-equal/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/tape/node_modules/deep-equal/example/cmp.js b/node_modules/tape/node_modules/deep-equal/example/cmp.js new file mode 100644 index 00000000..67014b88 --- /dev/null +++ b/node_modules/tape/node_modules/deep-equal/example/cmp.js @@ -0,0 +1,11 @@ +var equal = require('../'); +console.dir([ + equal( + { a : [ 2, 3 ], b : [ 4 ] }, + { a : [ 2, 3 ], b : [ 4 ] } + ), + equal( + { x : 5, y : [6] }, + { x : 5, y : 6 } + ) +]); diff --git a/node_modules/tape/node_modules/deep-equal/index.js b/node_modules/tape/node_modules/deep-equal/index.js new file mode 100644 index 00000000..dbc11f2d --- /dev/null +++ b/node_modules/tape/node_modules/deep-equal/index.js @@ -0,0 +1,94 @@ +var pSlice = Array.prototype.slice; +var objectKeys = require('./lib/keys.js'); +var isArguments = require('./lib/is_arguments.js'); + +var deepEqual = module.exports = function (actual, expected, opts) { + if (!opts) opts = {}; + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.3. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return opts.strict ? actual === expected : actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected, opts); + } +} + +function isUndefinedOrNull(value) { + return value === null || value === undefined; +} + +function isBuffer (x) { + if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; + if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { + return false; + } + if (x.length > 0 && typeof x[0] !== 'number') return false; + return true; +} + +function objEquiv(a, b, opts) { + var i, key; + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical 'prototype' property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return deepEqual(a, b, opts); + } + if (isBuffer(a)) { + if (!isBuffer(b)) { + return false; + } + if (a.length !== b.length) return false; + for (i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; + } + try { + var ka = objectKeys(a), + kb = objectKeys(b); + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!deepEqual(a[key], b[key], opts)) return false; + } + return typeof a === typeof b; +} diff --git a/node_modules/tape/node_modules/deep-equal/lib/is_arguments.js b/node_modules/tape/node_modules/deep-equal/lib/is_arguments.js new file mode 100644 index 00000000..1ff150fc --- /dev/null +++ b/node_modules/tape/node_modules/deep-equal/lib/is_arguments.js @@ -0,0 +1,20 @@ +var supportsArgumentsClass = (function(){ + return Object.prototype.toString.call(arguments) +})() == '[object Arguments]'; + +exports = module.exports = supportsArgumentsClass ? supported : unsupported; + +exports.supported = supported; +function supported(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +}; + +exports.unsupported = unsupported; +function unsupported(object){ + return object && + typeof object == 'object' && + typeof object.length == 'number' && + Object.prototype.hasOwnProperty.call(object, 'callee') && + !Object.prototype.propertyIsEnumerable.call(object, 'callee') || + false; +}; diff --git a/node_modules/tape/node_modules/deep-equal/lib/keys.js b/node_modules/tape/node_modules/deep-equal/lib/keys.js new file mode 100644 index 00000000..13af263f --- /dev/null +++ b/node_modules/tape/node_modules/deep-equal/lib/keys.js @@ -0,0 +1,9 @@ +exports = module.exports = typeof Object.keys === 'function' + ? Object.keys : shim; + +exports.shim = shim; +function shim (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} diff --git a/node_modules/tape/node_modules/deep-equal/package.json b/node_modules/tape/node_modules/deep-equal/package.json new file mode 100644 index 00000000..e69ffbcb --- /dev/null +++ b/node_modules/tape/node_modules/deep-equal/package.json @@ -0,0 +1,84 @@ +{ + "name": "deep-equal", + "version": "1.0.0", + "description": "node's assert.deepEqual algorithm", + "main": "index.js", + "directories": { + "lib": ".", + "example": "example", + "test": "test" + }, + "scripts": { + "test": "tape test/*.js" + }, + "devDependencies": { + "tape": "^3.5.0" + }, + "repository": { + "type": "git", + "url": "http://github.com/substack/node-deep-equal.git" + }, + "keywords": [ + "equality", + "equal", + "compare" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "gitHead": "39c740ebdafed9443912a4ef1493b18693934daf", + "bugs": { + "url": "https://github.com/substack/node-deep-equal/issues" + }, + "homepage": "https://github.com/substack/node-deep-equal", + "_id": "deep-equal@1.0.0", + "_shasum": "d4564f07d2f0ab3e46110bec16592abd7dc2e326", + "_from": "deep-equal@>=1.0.0 <1.1.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "dist": { + "shasum": "d4564f07d2f0ab3e46110bec16592abd7dc2e326", + "tarball": "http://registry.npmjs.org/deep-equal/-/deep-equal-1.0.0.tgz" + }, + "_resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/deep-equal/readme.markdown b/node_modules/tape/node_modules/deep-equal/readme.markdown new file mode 100644 index 00000000..f489c2a3 --- /dev/null +++ b/node_modules/tape/node_modules/deep-equal/readme.markdown @@ -0,0 +1,61 @@ +# deep-equal + +Node's `assert.deepEqual() algorithm` as a standalone module. + +This module is around [5 times faster](https://gist.github.com/2790507) +than wrapping `assert.deepEqual()` in a `try/catch`. + +[![browser support](https://ci.testling.com/substack/node-deep-equal.png)](https://ci.testling.com/substack/node-deep-equal) + +[![build status](https://secure.travis-ci.org/substack/node-deep-equal.png)](https://travis-ci.org/substack/node-deep-equal) + +# example + +``` js +var equal = require('deep-equal'); +console.dir([ + equal( + { a : [ 2, 3 ], b : [ 4 ] }, + { a : [ 2, 3 ], b : [ 4 ] } + ), + equal( + { x : 5, y : [6] }, + { x : 5, y : 6 } + ) +]); +``` + +# methods + +``` js +var deepEqual = require('deep-equal') +``` + +## deepEqual(a, b, opts) + +Compare objects `a` and `b`, returning whether they are equal according to a +recursive equality algorithm. + +If `opts.strict` is `true`, use strict equality (`===`) to compare leaf nodes. +The default is to use coercive equality (`==`) because that's how +`assert.deepEqual()` works by default. + +# install + +With [npm](http://npmjs.org) do: + +``` +npm install deep-equal +``` + +# test + +With [npm](http://npmjs.org) do: + +``` +npm test +``` + +# license + +MIT. Derived largely from node's assert module. diff --git a/node_modules/tape/node_modules/deep-equal/test/cmp.js b/node_modules/tape/node_modules/deep-equal/test/cmp.js new file mode 100644 index 00000000..d141256c --- /dev/null +++ b/node_modules/tape/node_modules/deep-equal/test/cmp.js @@ -0,0 +1,89 @@ +var test = require('tape'); +var equal = require('../'); +var isArguments = require('../lib/is_arguments.js'); +var objectKeys = require('../lib/keys.js'); + +test('equal', function (t) { + t.ok(equal( + { a : [ 2, 3 ], b : [ 4 ] }, + { a : [ 2, 3 ], b : [ 4 ] } + )); + t.end(); +}); + +test('not equal', function (t) { + t.notOk(equal( + { x : 5, y : [6] }, + { x : 5, y : 6 } + )); + t.end(); +}); + +test('nested nulls', function (t) { + t.ok(equal([ null, null, null ], [ null, null, null ])); + t.end(); +}); + +test('strict equal', function (t) { + t.notOk(equal( + [ { a: 3 }, { b: 4 } ], + [ { a: '3' }, { b: '4' } ], + { strict: true } + )); + t.end(); +}); + +test('non-objects', function (t) { + t.ok(equal(3, 3)); + t.ok(equal('beep', 'beep')); + t.ok(equal('3', 3)); + t.notOk(equal('3', 3, { strict: true })); + t.notOk(equal('3', [3])); + t.end(); +}); + +test('arguments class', function (t) { + t.ok(equal( + (function(){return arguments})(1,2,3), + (function(){return arguments})(1,2,3), + "compares arguments" + )); + t.notOk(equal( + (function(){return arguments})(1,2,3), + [1,2,3], + "differenciates array and arguments" + )); + t.end(); +}); + +test('test the arguments shim', function (t) { + t.ok(isArguments.supported((function(){return arguments})())); + t.notOk(isArguments.supported([1,2,3])); + + t.ok(isArguments.unsupported((function(){return arguments})())); + t.notOk(isArguments.unsupported([1,2,3])); + + t.end(); +}); + +test('test the keys shim', function (t) { + t.deepEqual(objectKeys.shim({ a: 1, b : 2 }), [ 'a', 'b' ]); + t.end(); +}); + +test('dates', function (t) { + var d0 = new Date(1387585278000); + var d1 = new Date('Fri Dec 20 2013 16:21:18 GMT-0800 (PST)'); + t.ok(equal(d0, d1)); + t.end(); +}); + +test('buffers', function (t) { + t.ok(equal(Buffer('xyz'), Buffer('xyz'))); + t.end(); +}); + +test('booleans and arrays', function (t) { + t.notOk(equal(true, [])); + t.end(); +}) diff --git a/node_modules/tape/node_modules/defined/.travis.yml b/node_modules/tape/node_modules/defined/.travis.yml new file mode 100644 index 00000000..895dbd36 --- /dev/null +++ b/node_modules/tape/node_modules/defined/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.8 diff --git a/node_modules/tape/node_modules/defined/LICENSE b/node_modules/tape/node_modules/defined/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/tape/node_modules/defined/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/tape/node_modules/defined/example/defined.js b/node_modules/tape/node_modules/defined/example/defined.js new file mode 100644 index 00000000..7b5d982f --- /dev/null +++ b/node_modules/tape/node_modules/defined/example/defined.js @@ -0,0 +1,4 @@ +var defined = require('../'); +var opts = { y : false, w : 4 }; +var x = defined(opts.x, opts.y, opts.w, 8); +console.log(x); diff --git a/node_modules/tape/node_modules/defined/index.js b/node_modules/tape/node_modules/defined/index.js new file mode 100644 index 00000000..f8a22198 --- /dev/null +++ b/node_modules/tape/node_modules/defined/index.js @@ -0,0 +1,5 @@ +module.exports = function () { + for (var i = 0; i < arguments.length; i++) { + if (arguments[i] !== undefined) return arguments[i]; + } +}; diff --git a/node_modules/tape/node_modules/defined/package.json b/node_modules/tape/node_modules/defined/package.json new file mode 100644 index 00000000..994cae2d --- /dev/null +++ b/node_modules/tape/node_modules/defined/package.json @@ -0,0 +1,60 @@ +{ + "name": "defined", + "version": "0.0.0", + "description": "return the first argument that is `!== undefined`", + "main": "index.js", + "directories": { + "example": "example", + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "~0.3.0", + "tape": "~0.0.2" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/defined.git" + }, + "homepage": "https://github.com/substack/defined", + "keywords": [ + "undefined", + "short-circuit", + "||", + "or", + "//", + "defined-or" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "_id": "defined@0.0.0", + "dist": { + "shasum": "f35eea7d705e933baf13b2f03b3f83d921403b3e", + "tarball": "http://registry.npmjs.org/defined/-/defined-0.0.0.tgz" + }, + "_npmVersion": "1.1.59", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "f35eea7d705e933baf13b2f03b3f83d921403b3e", + "_resolved": "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz", + "_from": "defined@>=0.0.0 <0.1.0", + "bugs": { + "url": "https://github.com/substack/defined/issues" + }, + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/defined/readme.markdown b/node_modules/tape/node_modules/defined/readme.markdown new file mode 100644 index 00000000..2280351f --- /dev/null +++ b/node_modules/tape/node_modules/defined/readme.markdown @@ -0,0 +1,51 @@ +# defined + +return the first argument that is `!== undefined` + +[![build status](https://secure.travis-ci.org/substack/defined.png)](http://travis-ci.org/substack/defined) + +Most of the time when I chain together `||`s, I actually just want the first +item that is not `undefined`, not the first non-falsy item. + +This module is like the defined-or (`//`) operator in perl 5.10+. + +# example + +``` js +var defined = require('defined'); +var opts = { y : false, w : 4 }; +var x = defined(opts.x, opts.y, opts.w, 100); +console.log(x); +``` + +``` +$ node example/defined.js +false +``` + +The return value is `false` because `false` is the first item that is +`!== undefined`. + +# methods + +``` js +var defined = require('defined') +``` + +## var x = defined(a, b, c...) + +Return the first item in the argument list `a, b, c...` that is `!== undefined`. + +If all the items are `=== undefined`, return undefined. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install defined +``` + +# license + +MIT diff --git a/node_modules/tape/node_modules/defined/test/def.js b/node_modules/tape/node_modules/defined/test/def.js new file mode 100644 index 00000000..48da5171 --- /dev/null +++ b/node_modules/tape/node_modules/defined/test/def.js @@ -0,0 +1,22 @@ +var defined = require('../'); +var test = require('tape'); + +test('defined-or', function (t) { + var u = undefined; + + t.equal(defined(), u, 'empty arguments'); + t.equal(defined(u), u, '1 undefined'); + t.equal(defined(u, u), u, '2 undefined'); + t.equal(defined(u, u, u, u), u, '4 undefineds'); + + t.equal(defined(undefined, false, true), false, 'false[0]'); + t.equal(defined(false, true), false, 'false[1]'); + t.equal(defined(undefined, 0, true), 0, 'zero[0]'); + t.equal(defined(0, true), 0, 'zero[1]'); + + t.equal(defined(3, undefined, 4), 3, 'first arg'); + t.equal(defined(undefined, 3, 4), 3, 'second arg'); + t.equal(defined(undefined, undefined, 3), 3, 'third arg'); + + t.end(); +}); diff --git a/node_modules/tape/node_modules/glob/LICENSE b/node_modules/tape/node_modules/glob/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/tape/node_modules/glob/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tape/node_modules/glob/README.md b/node_modules/tape/node_modules/glob/README.md new file mode 100644 index 00000000..fa993dcb --- /dev/null +++ b/node_modules/tape/node_modules/glob/README.md @@ -0,0 +1,378 @@ +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Dependency Status](https://david-dm.org/isaacs/node-glob.svg)](https://david-dm.org/isaacs/node-glob) [![devDependency Status](https://david-dm.org/isaacs/node-glob/dev-status.svg)](https://david-dm.org/isaacs/node-glob#info=devDependencies) [![optionalDependency Status](https://david-dm.org/isaacs/node-glob/optional-status.svg)](https://david-dm.org/isaacs/node-glob#info=optionalDependencies) + +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![](oh-my-glob.gif) + +## Usage + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Negation + +The intent for negation would be for a pattern starting with `!` to +match everything that *doesn't* match the supplied pattern. However, +the implementation is weird, and for the time being, this should be +avoided. The behavior is deprecated in version 5, and will be removed +entirely in version 6. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` {String} Pattern to be matched +* `options` {Object} +* `cb` {Function} + * `err` {Error | null} + * `matches` {Array} filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` {String} Pattern to be matched +* `options` {Object} +* return: {Array} filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` {String} pattern to search for +* `options` {Object} +* `cb` {Function} Called when an error occurs, or matches are found + * `err` {Error | null} + * `matches` {Array} filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'DIR'` - Path exists, and is not a directory + * `'FILE'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the matched. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nonull` Return the pattern when no matches are found. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of patterns to exclude matches. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `nonegate` Suppress deprecated `negate` behavior. (See below.) + Default=true +* `nocomment` Suppress deprecated `comment` behavior. (See below.) + Default=true + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +**Note**: In version 5 of this module, negation and comments are +**disabled** by default. You can explicitly set `nonegate:false` or +`nocomment:false` to re-enable them. They are going away entirely in +version 6. + +The intent for negation would be for a pattern starting with `!` to +match everything that *doesn't* match the supplied pattern. However, +the implementation is weird. It is better to use the `ignore` option +to set a pattern or set of patterns to exclude from matches. If you +want the "everything except *x*" type of behavior, you can use `**` as +the main pattern, and set an `ignore` for the things to exclude. + +The comments feature is added in minimatch, primarily to more easily +support use cases like ignore files, where a `#` at the start of a +line makes the pattern "empty". However, in the context of a +straightforward filesystem globber, "comments" don't make much sense. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` diff --git a/node_modules/tape/node_modules/glob/common.js b/node_modules/tape/node_modules/glob/common.js new file mode 100644 index 00000000..7bef9a27 --- /dev/null +++ b/node_modules/tape/node_modules/glob/common.js @@ -0,0 +1,244 @@ +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern) + } + + return { + matcher: new Minimatch(pattern), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = options.cwd + self.changedCwd = path.resolve(options.cwd) !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + self.nomount = !!options.nomount + + // disable comments and negation unless the user explicitly + // passes in false as the option. + options.nonegate = options.nonegate === false ? false : true + options.nocomment = options.nocomment === false ? false : true + deprecationWarning(options) + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +// TODO(isaacs): remove entirely in v6 +// exported to reset in tests +exports.deprecationWarned +function deprecationWarning(options) { + if (!options.nonegate || !options.nocomment) { + if (process.noDeprecation !== true && !exports.deprecationWarned) { + var msg = 'glob WARNING: comments and negation will be disabled in v6' + if (process.throwDeprecation) + throw new Error(msg) + else if (process.traceDeprecation) + console.trace(msg) + else + console.error(msg) + + exports.deprecationWarned = true + } + } +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + return !(/\/$/.test(e)) + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/node_modules/tape/node_modules/glob/glob.js b/node_modules/tape/node_modules/glob/glob.js new file mode 100644 index 00000000..1bfed19d --- /dev/null +++ b/node_modules/tape/node_modules/glob/glob.js @@ -0,0 +1,740 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +glob.hasMagic = function (pattern, options_) { + var options = util._extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + var n = this.minimatch.set.length + this._processing = 0 + this.matches = new Array(n) + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + + function done () { + --self._processing + if (self._processing <= 0) + self._finish() + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + fs.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (this.matches[index][e]) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = this._makeAbs(e) + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + if (this.mark) + e = this._mark(e) + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er) + return cb() + + var isSym = lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) return this.emit('error', er) + if (!this.silent) console.error('glob error', er) + break + } + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && !stat.isDirectory()) + return cb(null, false, stat) + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return cb() + + return cb(null, c, stat) +} diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/.eslintrc b/node_modules/tape/node_modules/glob/node_modules/inflight/.eslintrc new file mode 100644 index 00000000..b7a1550e --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/.eslintrc @@ -0,0 +1,17 @@ +{ + "env" : { + "node" : true + }, + "rules" : { + "semi": [2, "never"], + "strict": 0, + "quotes": [1, "single", "avoid-escape"], + "no-use-before-define": 0, + "curly": 0, + "no-underscore-dangle": 0, + "no-lonely-if": 1, + "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], + "no-mixed-requires": 0, + "space-infix-ops": 0 + } +} diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/LICENSE b/node_modules/tape/node_modules/glob/node_modules/inflight/LICENSE new file mode 100644 index 00000000..05eeeb88 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/README.md b/node_modules/tape/node_modules/glob/node_modules/inflight/README.md new file mode 100644 index 00000000..6dc89291 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/inflight.js b/node_modules/tape/node_modules/glob/node_modules/inflight/inflight.js new file mode 100644 index 00000000..8bc96cbd --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/inflight.js @@ -0,0 +1,44 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/package.json b/node_modules/tape/node_modules/glob/node_modules/inflight/package.json new file mode 100644 index 00000000..a6645bc5 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/package.json @@ -0,0 +1,61 @@ +{ + "name": "inflight", + "version": "1.0.4", + "description": "Add callbacks to requests in flight to avoid async duplication", + "main": "inflight.js", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^0.4.10" + }, + "scripts": { + "test": "tap test.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inflight" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC", + "gitHead": "c7b5531d572a867064d4a1da9e013e8910b7d1ba", + "_id": "inflight@1.0.4", + "_shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", + "_from": "inflight@>=1.0.4 <2.0.0", + "_npmVersion": "2.1.3", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + { + "name": "iarna", + "email": "me@re-becca.org" + } + ], + "dist": { + "shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", + "tarball": "http://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/node_modules/inflight/test.js b/node_modules/tape/node_modules/glob/node_modules/inflight/test.js new file mode 100644 index 00000000..2bb75b38 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/inflight/test.js @@ -0,0 +1,97 @@ +var test = require('tap').test +var inf = require('./inflight.js') + + +function req (key, cb) { + cb = inf(key, cb) + if (cb) setTimeout(function () { + cb(key) + cb(key) + }) + return cb +} + +test('basic', function (t) { + var calleda = false + var a = req('key', function (k) { + t.notOk(calleda) + calleda = true + t.equal(k, 'key') + if (calledb) t.end() + }) + t.ok(a, 'first returned cb function') + + var calledb = false + var b = req('key', function (k) { + t.notOk(calledb) + calledb = true + t.equal(k, 'key') + if (calleda) t.end() + }) + + t.notOk(b, 'second should get falsey inflight response') +}) + +test('timing', function (t) { + var expect = [ + 'method one', + 'start one', + 'end one', + 'two', + 'tick', + 'three' + ] + var i = 0 + + function log (m) { + t.equal(m, expect[i], m + ' === ' + expect[i]) + ++i + if (i === expect.length) + t.end() + } + + function method (name, cb) { + log('method ' + name) + process.nextTick(cb) + } + + var one = inf('foo', function () { + log('start one') + var three = inf('foo', function () { + log('three') + }) + if (three) method('three', three) + log('end one') + }) + + method('one', one) + + var two = inf('foo', function () { + log('two') + }) + if (two) method('one', two) + + process.nextTick(log.bind(null, 'tick')) +}) + +test('parameters', function (t) { + t.plan(8) + + var a = inf('key', function (first, second, third) { + t.equal(first, 1) + t.equal(second, 2) + t.equal(third, 3) + }) + t.ok(a, 'first returned cb function') + + var b = inf('key', function (first, second, third) { + t.equal(first, 1) + t.equal(second, 2) + t.equal(third, 3) + }) + t.notOk(b, 'second should get falsey inflight response') + + setTimeout(function () { + a(1, 2, 3) + }) +}) diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/LICENSE b/node_modules/tape/node_modules/glob/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..05a40109 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +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/node_modules/tape/node_modules/glob/node_modules/minimatch/README.md b/node_modules/tape/node_modules/glob/node_modules/minimatch/README.md new file mode 100644 index 00000000..d458bc2e --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/README.md @@ -0,0 +1,216 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instanting the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +## Functions + +The top-level exported function has a `cache` property, which is an LRU +cache set to store 100 items. So, calling these methods repeatedly +with the same pattern and options will use the same Minimatch object, +saving the cost of parsing it multiple times. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/browser.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/browser.js new file mode 100644 index 00000000..967b45c0 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/browser.js @@ -0,0 +1,1113 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} + +},{"brace-expansion":2,"path":undefined}],2:[function(require,module,exports){ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + var expansions = expand(escapeBraces(str)); + return expansions.filter(identity).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0]).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + expansions.push([pre, N[j], post[k]].join('')) + } + } + + return expansions; +} + + +},{"balanced-match":3,"concat-map":4}],3:[function(require,module,exports){ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} + +},{}],4:[function(require,module,exports){ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (Array.isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +},{}]},{},[1]); diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/minimatch.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000..5e13d6d5 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/minimatch.js @@ -0,0 +1,867 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore new file mode 100644 index 00000000..249bc20e --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore @@ -0,0 +1,2 @@ +node_modules +*.sw* diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml new file mode 100644 index 00000000..6e5919de --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md new file mode 100644 index 00000000..62bc7bae --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md @@ -0,0 +1,121 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js new file mode 100644 index 00000000..60ecfc74 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js @@ -0,0 +1,8 @@ +var expand = require('./'); + +console.log(expand('http://any.org/archive{1996..1999}/vol{1..4}/part{a,b,c}.html')); +console.log(expand('http://www.numericals.com/file{1..100..10}.txt')); +console.log(expand('http://www.letters.com/file{a..z..2}.txt')); +console.log(expand('mkdir /usr/local/src/bash/{old,new,dist,bugs}')); +console.log(expand('chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}')); + diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js new file mode 100644 index 00000000..a23104e9 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js @@ -0,0 +1,191 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore new file mode 100644 index 00000000..fd4f2b06 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile new file mode 100644 index 00000000..fa5da71a --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile @@ -0,0 +1,6 @@ + +test: + @node_modules/.bin/tape test/*.js + +.PHONY: test + diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md new file mode 100644 index 00000000..2aff0ebf --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md @@ -0,0 +1,80 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js new file mode 100644 index 00000000..c02ad348 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js @@ -0,0 +1,5 @@ +var balanced = require('./'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); + diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js new file mode 100644 index 00000000..d165ae81 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -0,0 +1,38 @@ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json new file mode 100644 index 00000000..ede6efef --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -0,0 +1,73 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "0.2.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.1" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "ba40ed78e7114a4a67c51da768a100184dead39c", + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "_id": "balanced-match@0.2.0", + "_shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "_from": "balanced-match@>=0.2.0 <0.3.0", + "_npmVersion": "2.1.8", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "dist": { + "shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js new file mode 100644 index 00000000..36bfd399 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js @@ -0,0 +1,56 @@ +var test = require('tape'); +var balanced = require('..'); + +test('balanced', function(t) { + t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), { + start: 3, + end: 12, + pre: 'pre', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), { + start: 8, + end: 11, + pre: '{{{{{{{{', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body{in}post'), { + start: 8, + end: 11, + pre: 'pre{body', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), { + start: 4, + end: 13, + pre: 'pre}', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), { + start: 3, + end: 8, + pre: 'pre', + body: 'body', + post: 'between{body2}post' + }); + t.notOk(balanced('{', '}', 'nope'), 'should be notOk'); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 3, + end: 19, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 7, + end: 23, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.end(); +}); diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml new file mode 100644 index 00000000..f1d0f13c --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown new file mode 100644 index 00000000..408f70a1 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js new file mode 100644 index 00000000..33656217 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js new file mode 100644 index 00000000..b29a7812 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json new file mode 100644 index 00000000..b5161380 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json @@ -0,0 +1,83 @@ +{ + "name": "concat-map", + "description": "concatenative mapdashery", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-concat-map.git" + }, + "main": "index.js", + "keywords": [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories": { + "example": "example", + "test": "test" + }, + "scripts": { + "test": "tape test/*.js" + }, + "devDependencies": { + "tape": "~2.4.0" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "bugs": { + "url": "https://github.com/substack/node-concat-map/issues" + }, + "homepage": "https://github.com/substack/node-concat-map", + "_id": "concat-map@0.0.1", + "dist": { + "shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "tarball": "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + }, + "_from": "concat-map@0.0.1", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js new file mode 100644 index 00000000..fdbd7022 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json new file mode 100644 index 00000000..5f1866c8 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -0,0 +1,75 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh" + }, + "dependencies": { + "balanced-match": "^0.2.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "tape": "^3.0.3" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "b5fa3b1c74e5e2dba2d0efa19b28335641bc1164", + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "_id": "brace-expansion@1.1.0", + "_shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "_from": "brace-expansion@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + } + ], + "dist": { + "shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js new file mode 100644 index 00000000..5fe2b8ad --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var expand = require('..'); +var fs = require('fs'); +var resfile = __dirname + '/bash-results.txt'; +var cases = fs.readFileSync(resfile, 'utf8').split('><><><><'); + +// throw away the EOF marker +cases.pop() + +test('matches bash expansions', function(t) { + cases.forEach(function(testcase) { + var set = testcase.split('\n'); + var pattern = set.shift(); + var actual = expand(pattern); + + // If it expands to the empty string, then it's actually + // just nothing, but Bash is a singly typed language, so + // "nothing" is the same as "". + if (set.length === 1 && set[0] === '') { + set = [] + } else { + // otherwise, strip off the [] that were added so that + // "" expansions would be preserved properly. + set = set.map(function (s) { + return s.replace(/^\[|\]$/g, '') + }) + } + + t.same(actual, set, pattern); + }); + t.end(); +}) diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt new file mode 100644 index 00000000..958148d2 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt @@ -0,0 +1,1075 @@ +A{b,{d,e},{f,g}}Z +[AbZ] +[AdZ] +[AeZ] +[AfZ] +[AgZ]><><><><><><><\{a,b}{{a,b},a,b} +[{a,b}a] +[{a,b}b] +[{a,b}a] +[{a,b}b]><><><><{{a,b} +[{a] +[{b]><><><><{a,b}} +[a}] +[b}]><><><><{,} +><><><><><><><{,}b +[b] +[b]><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><{-01..5} +[-01] +[000] +[001] +[002] +[003] +[004] +[005]><><><><{-05..100..5} +[-05] +[000] +[005] +[010] +[015] +[020] +[025] +[030] +[035] +[040] +[045] +[050] +[055] +[060] +[065] +[070] +[075] +[080] +[085] +[090] +[095] +[100]><><><><{-05..100} +[-05] +[-04] +[-03] +[-02] +[-01] +[000] +[001] +[002] +[003] +[004] +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0..5..2} +[0] +[2] +[4]><><><><{0001..05..2} +[0001] +[0003] +[0005]><><><><{0001..-5..2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..-5..-2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..5..-2} +[0001] +[0003] +[0005]><><><><{01..5} +[01] +[02] +[03] +[04] +[05]><><><><{1..05} +[01] +[02] +[03] +[04] +[05]><><><><{1..05..3} +[01] +[04]><><><><{05..100} +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0a..0z} +[{0a..0z}]><><><><{a,b\}c,d} +[a] +[b}c] +[d]><><><><{a,b{c,d} +[{a,bc] +[{a,bd]><><><><{a,b}c,d} +[ac,d}] +[bc,d}]><><><><{a..F} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F]><><><><{A..f} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f]><><><><{a..Z} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z]><><><><{A..z} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{z..A} +[z] +[y] +[x] +[w] +[v] +[u] +[t] +[s] +[r] +[q] +[p] +[o] +[n] +[m] +[l] +[k] +[j] +[i] +[h] +[g] +[f] +[e] +[d] +[c] +[b] +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{Z..a} +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{a..F..2} +[a] +[_] +[]] +[[] +[Y] +[W] +[U] +[S] +[Q] +[O] +[M] +[K] +[I] +[G]><><><><{A..f..02} +[A] +[C] +[E] +[G] +[I] +[K] +[M] +[O] +[Q] +[S] +[U] +[W] +[Y] +[[] +[]] +[_] +[a] +[c] +[e]><><><><{a..Z..5} +[a] +[]><><><><><><><{A..z..10} +[A] +[K] +[U] +[_] +[i] +[s]><><><><{z..A..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b] +[`] +[^] +[] +[Z] +[X] +[V] +[T] +[R] +[P] +[N] +[L] +[J] +[H] +[F] +[D] +[B]><><><><{Z..a..20} +[Z]><><><><{a{,b} +[{a] +[{ab]><><><><{a},b} +[a}] +[b]><><><><{x,y{,}g} +[x] +[yg] +[yg]><><><><{x,y{}g} +[x] +[y{}g]><><><><{{a,b} +[{a] +[{b]><><><><{{a,b},c} +[a] +[b] +[c]><><><><{{a,b}c} +[{ac}] +[{bc}]><><><><{{a,b},} +[a] +[b]><><><><><><><{{a,b},}c +[ac] +[bc] +[c]><><><><{{a,b}.} +[{a.}] +[{b.}]><><><><{{a,b}} +[{a}] +[{b}]><><><><><><>< +><><><><{-10..00} +[-10] +[-09] +[-08] +[-07] +[-06] +[-05] +[-04] +[-03] +[-02] +[-01] +[000]><><><><{a,\\{a,b}c} +[a] +[\ac] +[\bc]><><><><{a,\{a,b}c} +[ac}] +[{ac}] +[bc}]><><><><><><><{-10.\.00} +[{-10..00}]><><><><><><><><><><{l,n,m}xyz +[lxyz] +[nxyz] +[mxyz]><><><><{abc\,def} +[{abc,def}]><><><><{abc} +[{abc}]><><><><{x\,y,\{abc\},trie} +[x,y] +[{abc}] +[trie]><><><><{} +[{}]><><><><} +[}]><><><><{ +[{]><><><><><><><{1..10} +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10]><><><><{0..10,braces} +[0..10] +[braces]><><><><{{0..10},braces} +[0] +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10] +[braces]><><><><><><><{3..3} +[3]><><><><><><><{10..1} +[10] +[9] +[8] +[7] +[6] +[5] +[4] +[3] +[2] +[1]><><><><{10..1}y +[10y] +[9y] +[8y] +[7y] +[6y] +[5y] +[4y] +[3y] +[2y] +[1y]><><><><><><><{a..f} +[a] +[b] +[c] +[d] +[e] +[f]><><><><{f..a} +[f] +[e] +[d] +[c] +[b] +[a]><><><><{a..A} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{A..a} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{f..f} +[f]><><><><{1..f} +[{1..f}]><><><><{f..1} +[{f..1}]><><><><{-1..-10} +[-1] +[-2] +[-3] +[-4] +[-5] +[-6] +[-7] +[-8] +[-9] +[-10]><><><><{-20..0} +[-20] +[-19] +[-18] +[-17] +[-16] +[-15] +[-14] +[-13] +[-12] +[-11] +[-10] +[-9] +[-8] +[-7] +[-6] +[-5] +[-4] +[-3] +[-2] +[-1] +[0]><><><><><><><><><><{klklkl}{1,2,3} +[{klklkl}1] +[{klklkl}2] +[{klklkl}3]><><><><{1..10..2} +[1] +[3] +[5] +[7] +[9]><><><><{-1..-10..2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{-1..-10..-2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{10..1..-2} +[10] +[8] +[6] +[4] +[2]><><><><{10..1..2} +[10] +[8] +[6] +[4] +[2]><><><><{1..20..2} +[1] +[3] +[5] +[7] +[9] +[11] +[13] +[15] +[17] +[19]><><><><{1..20..20} +[1]><><><><{100..0..5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{100..0..-5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{a..z} +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{a..z..2} +[a] +[c] +[e] +[g] +[i] +[k] +[m] +[o] +[q] +[s] +[u] +[w] +[y]><><><><{z..a..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b]><><><><{2147483645..2147483649} +[2147483645] +[2147483646] +[2147483647] +[2147483648] +[2147483649]><><><><{10..0..2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{10..0..-2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{-50..-0..5} +[-50] +[-45] +[-40] +[-35] +[-30] +[-25] +[-20] +[-15] +[-10] +[-5] +[0]><><><><{1..10.f} +[{1..10.f}]><><><><{1..ff} +[{1..ff}]><><><><{1..10..ff} +[{1..10..ff}]><><><><{1.20..2} +[{1.20..2}]><><><><{1..20..f2} +[{1..20..f2}]><><><><{1..20..2f} +[{1..20..2f}]><><><><{1..2f..2} +[{1..2f..2}]><><><><{1..ff..2} +[{1..ff..2}]><><><><{1..ff} +[{1..ff}]><><><><{1..f} +[{1..f}]><><><><{1..0f} +[{1..0f}]><><><><{1..10f} +[{1..10f}]><><><><{1..10.f} +[{1..10.f}]><><><><{1..10.f} +[{1..10.f}]><><><>< \ No newline at end of file diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt new file mode 100644 index 00000000..e5161c3d --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt @@ -0,0 +1,182 @@ +# skip quotes for now +# "{x,x}" +# {"x,x"} +# {x","x} +# '{a,b}{{a,b},a,b}' +A{b,{d,e},{f,g}}Z +PRE-{a,b}{{a,b},a,b}-POST +\\{a,b}{{a,b},a,b} +{{a,b} +{a,b}} +{,} +a{,} +{,}b +a{,}b +a{b}c +a{1..5}b +a{01..5}b +a{-01..5}b +a{-01..5..3}b +a{001..9}b +a{b,c{d,e},{f,g}h}x{y,z +a{b,c{d,e},{f,g}h}x{y,z\\} +a{b,c{d,e},{f,g}h}x{y,z} +a{b{c{d,e}f{x,y{{g}h +a{b{c{d,e}f{x,y{}g}h +a{b{c{d,e}f{x,y}}g}h +a{b{c{d,e}f}g}h +a{{x,y},z}b +f{x,y{g,z}}h +f{x,y{{g,z}}h +f{x,y{{g,z}}h} +f{x,y{{g}h +f{x,y{{g}}h +f{x,y{}g}h +z{a,b{,c}d +z{a,b},c}d +{-01..5} +{-05..100..5} +{-05..100} +{0..5..2} +{0001..05..2} +{0001..-5..2} +{0001..-5..-2} +{0001..5..-2} +{01..5} +{1..05} +{1..05..3} +{05..100} +{0a..0z} +{a,b\\}c,d} +{a,b{c,d} +{a,b}c,d} +{a..F} +{A..f} +{a..Z} +{A..z} +{z..A} +{Z..a} +{a..F..2} +{A..f..02} +{a..Z..5} +d{a..Z..5}b +{A..z..10} +{z..A..-2} +{Z..a..20} +{a{,b} +{a},b} +{x,y{,}g} +{x,y{}g} +{{a,b} +{{a,b},c} +{{a,b}c} +{{a,b},} +X{{a,b},}X +{{a,b},}c +{{a,b}.} +{{a,b}} +X{a..#}X +# this next one is an empty string + +{-10..00} +# Need to escape slashes in here for reasons i guess. +{a,\\\\{a,b}c} +{a,\\{a,b}c} +a,\\{b,c} +{-10.\\.00} +#### bash tests/braces.tests +# Note that some tests are edited out because some features of +# bash are intentionally not supported in this brace expander. +ff{c,b,a} +f{d,e,f}g +{l,n,m}xyz +{abc\\,def} +{abc} +{x\\,y,\\{abc\\},trie} +# not impementing back-ticks obviously +# XXXX\\{`echo a b c | tr ' ' ','`\\} +{} +# We only ever have to worry about parsing a single argument, +# not a command line, so spaces have a different meaning than bash. +# { } +} +{ +abcd{efgh +# spaces +# foo {1,2} bar +# not impementing back-ticks obviously +# `zecho foo {1,2} bar` +# $(zecho foo {1,2} bar) +# ${var} is not a variable here, like it is in bash. omit. +# foo{bar,${var}.} +# foo{bar,${var}} +# isaacs: skip quotes for now +# "${var}"{x,y} +# $var{x,y} +# ${var}{x,y} +# new sequence brace operators +{1..10} +# this doesn't work yet +{0..10,braces} +# but this does +{{0..10},braces} +x{{0..10},braces}y +{3..3} +x{3..3}y +{10..1} +{10..1}y +x{10..1}y +{a..f} +{f..a} +{a..A} +{A..a} +{f..f} +# mixes are incorrectly-formed brace expansions +{1..f} +{f..1} +# spaces +# 0{1..9} {10..20} +# do negative numbers work? +{-1..-10} +{-20..0} +# weirdly-formed brace expansions -- fixed in post-bash-3.1 +a-{b{d,e}}-c +a-{bdef-{g,i}-c +# isaacs: skip quotes for now +# {"klklkl"}{1,2,3} +# isaacs: this is a valid test, though +{klklkl}{1,2,3} +# {"x,x"} +{1..10..2} +{-1..-10..2} +{-1..-10..-2} +{10..1..-2} +{10..1..2} +{1..20..2} +{1..20..20} +{100..0..5} +{100..0..-5} +{a..z} +{a..z..2} +{z..a..-2} +# make sure brace expansion handles ints > 2**31 - 1 using intmax_t +{2147483645..2147483649} +# unwanted zero-padding -- fixed post-bash-4.0 +{10..0..2} +{10..0..-2} +{-50..-0..5} +# bad +{1..10.f} +{1..ff} +{1..10..ff} +{1.20..2} +{1..20..f2} +{1..20..2f} +{1..2f..2} +{1..ff..2} +{1..ff} +{1..f} +{1..0f} +{1..10f} +{1..10.f} +{1..10.f} diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js new file mode 100644 index 00000000..3fcc185a --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var expand = require('..'); + +test('ignores ${', function(t) { + t.deepEqual(expand('${1..3}'), ['${1..3}']); + t.deepEqual(expand('${a,b}${c,d}'), ['${a,b}${c,d}']); + t.deepEqual(expand('x${a,b}x${c,d}x'), ['x${a,b}x${c,d}x']); + t.end(); +}); diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js new file mode 100644 index 00000000..e429121e --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('empty option', function(t) { + t.deepEqual(expand('-v{,,,,}'), [ + '-v', '-v', '-v', '-v', '-v' + ]); + t.end(); +}); + diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh new file mode 100644 index 00000000..e040e664 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +# Bash 4.3 because of arbitrary need to pick a single standard. + +if [ "${BASH_VERSINFO[0]}" != "4" ] || [ "${BASH_VERSINFO[1]}" != "3" ]; then + echo "this script requires bash 4.3" >&2 + exit 1 +fi + +CDPATH= cd "$(dirname "$0")" + +js='require("./")(process.argv[1]).join(" ")' + +cat cases.txt | \ + while read case; do + if [ "${case:0:1}" = "#" ]; then + continue; + fi; + b="$($BASH -c 'for c in '"$case"'; do echo ["$c"]; done')" + echo "$case" + echo -n "$b><><><><"; + done > bash-results.txt diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js new file mode 100644 index 00000000..8d434c23 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var expand = require('..'); + +test('negative increment', function(t) { + t.deepEqual(expand('{3..1}'), ['3', '2', '1']); + t.deepEqual(expand('{10..8}'), ['10', '9', '8']); + t.deepEqual(expand('{10..08}'), ['10', '09', '08']); + t.deepEqual(expand('{c..a}'), ['c', 'b', 'a']); + + t.deepEqual(expand('{4..0..2}'), ['4', '2', '0']); + t.deepEqual(expand('{4..0..-2}'), ['4', '2', '0']); + t.deepEqual(expand('{e..a..2}'), ['e', 'c', 'a']); + + t.end(); +}); diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js new file mode 100644 index 00000000..0862dc51 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js @@ -0,0 +1,16 @@ +var test = require('tape'); +var expand = require('..'); + +test('nested', function(t) { + t.deepEqual(expand('{a,b{1..3},c}'), [ + 'a', 'b1', 'b2', 'b3', 'c' + ]); + t.deepEqual(expand('{{A..Z},{a..z}}'), + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('') + ); + t.deepEqual(expand('ppp{,config,oe{,conf}}'), [ + 'ppp', 'pppconfig', 'pppoe', 'pppoeconf' + ]); + t.end(); +}); + diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js new file mode 100644 index 00000000..c00ad155 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('order', function(t) { + t.deepEqual(expand('a{d,c,b}e'), [ + 'ade', 'ace', 'abe' + ]); + t.end(); +}); + diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js new file mode 100644 index 00000000..e4158775 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var expand = require('..'); + +test('pad', function(t) { + t.deepEqual(expand('{9..11}'), [ + '9', '10', '11' + ]); + t.deepEqual(expand('{09..11}'), [ + '09', '10', '11' + ]); + t.end(); +}); + diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js new file mode 100644 index 00000000..3038fba7 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js @@ -0,0 +1,7 @@ +var test = require('tape'); +var expand = require('..'); + +test('x and y of same type', function(t) { + t.deepEqual(expand('{a..9}'), ['{a..9}']); + t.end(); +}); diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js new file mode 100644 index 00000000..f73a9579 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js @@ -0,0 +1,50 @@ +var test = require('tape'); +var expand = require('..'); + +test('numeric sequences', function(t) { + t.deepEqual(expand('a{1..2}b{2..3}c'), [ + 'a1b2c', 'a1b3c', 'a2b2c', 'a2b3c' + ]); + t.deepEqual(expand('{1..2}{2..3}'), [ + '12', '13', '22', '23' + ]); + t.end(); +}); + +test('numeric sequences with step count', function(t) { + t.deepEqual(expand('{0..8..2}'), [ + '0', '2', '4', '6', '8' + ]); + t.deepEqual(expand('{1..8..2}'), [ + '1', '3', '5', '7' + ]); + t.end(); +}); + +test('numeric sequence with negative x / y', function(t) { + t.deepEqual(expand('{3..-2}'), [ + '3', '2', '1', '0', '-1', '-2' + ]); + t.end(); +}); + +test('alphabetic sequences', function(t) { + t.deepEqual(expand('1{a..b}2{b..c}3'), [ + '1a2b3', '1a2c3', '1b2b3', '1b2c3' + ]); + t.deepEqual(expand('{a..b}{b..c}'), [ + 'ab', 'ac', 'bb', 'bc' + ]); + t.end(); +}); + +test('alphabetic sequences with step count', function(t) { + t.deepEqual(expand('{a..k..2}'), [ + 'a', 'c', 'e', 'g', 'i', 'k' + ]); + t.deepEqual(expand('{b..k..2}'), [ + 'b', 'd', 'f', 'h', 'j' + ]); + t.end(); +}); + diff --git a/node_modules/tape/node_modules/glob/node_modules/minimatch/package.json b/node_modules/tape/node_modules/glob/node_modules/minimatch/package.json new file mode 100644 index 00000000..b438bdb9 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/minimatch/package.json @@ -0,0 +1,66 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "2.0.7", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "pretest": "standard minimatch.js test/*.js", + "test": "tap test/*.js", + "prepublish": "browserify -o browser.js -e minimatch.js --bare" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.0.0" + }, + "devDependencies": { + "browserify": "^9.0.3", + "standard": "^3.7.2", + "tap": "" + }, + "license": { + "type": "MIT", + "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" + }, + "files": [ + "minimatch.js", + "browser.js" + ], + "gitHead": "4bd6dc22c248c7ea07cc49d63181fe6f6aafae9c", + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" + }, + "homepage": "https://github.com/isaacs/minimatch", + "_id": "minimatch@2.0.7", + "_shasum": "d23652ab10e663e7d914602e920e21f9f66492be", + "_from": "minimatch@>=2.0.1 <3.0.0", + "_npmVersion": "2.7.6", + "_nodeVersion": "1.7.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d23652ab10e663e7d914602e920e21f9f66492be", + "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/node_modules/once/LICENSE b/node_modules/tape/node_modules/glob/node_modules/once/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tape/node_modules/glob/node_modules/once/README.md b/node_modules/tape/node_modules/glob/node_modules/once/README.md new file mode 100644 index 00000000..a2981ea0 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/README.md @@ -0,0 +1,51 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` diff --git a/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/README.md b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/README.md new file mode 100644 index 00000000..98eab252 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/package.json b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/package.json new file mode 100644 index 00000000..8145dc8c --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/package.json @@ -0,0 +1,52 @@ +{ + "name": "wrappy", + "version": "1.0.1", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^0.4.12" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy", + "gitHead": "006a8cbac6b99988315834c207896eed71fd069a", + "_id": "wrappy@1.0.1", + "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "_from": "wrappy@>=1.0.0 <2.0.0", + "_npmVersion": "2.0.0", + "_nodeVersion": "0.10.31", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", + "tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js new file mode 100644 index 00000000..5ed0fcdf --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js @@ -0,0 +1,51 @@ +var test = require('tap').test +var wrappy = require('../wrappy.js') + +test('basic', function (t) { + function onceifier (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } + } + onceifier.iAmOnce = {} + var once = wrappy(onceifier) + t.equal(once.iAmOnce, onceifier.iAmOnce) + + var called = 0 + function boo () { + t.equal(called, 0) + called++ + } + // has some rando property + boo.iAmBoo = true + + var onlyPrintOnce = once(boo) + + onlyPrintOnce() // prints 'boo' + onlyPrintOnce() // does nothing + t.equal(called, 1) + + // random property is retained! + t.equal(onlyPrintOnce.iAmBoo, true) + + var logs = [] + var logwrap = wrappy(function (msg, cb) { + logs.push(msg + ' wrapping cb') + return function () { + logs.push(msg + ' before cb') + var ret = cb.apply(this, arguments) + logs.push(msg + ' after cb') + } + }) + + var c = logwrap('foo', function () { + t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) + }) + c() + t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) + + t.end() +}) diff --git a/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js new file mode 100644 index 00000000..bb7e7d6f --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/node_modules/tape/node_modules/glob/node_modules/once/once.js b/node_modules/tape/node_modules/glob/node_modules/once/once.js new file mode 100644 index 00000000..2e1e721b --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/once.js @@ -0,0 +1,21 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} diff --git a/node_modules/tape/node_modules/glob/node_modules/once/package.json b/node_modules/tape/node_modules/glob/node_modules/once/package.json new file mode 100644 index 00000000..8f46e507 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/package.json @@ -0,0 +1,60 @@ +{ + "name": "once", + "version": "1.3.2", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "~0.3.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once.git" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "gitHead": "e35eed5a7867574e2bf2260a1ba23970958b22f2", + "bugs": { + "url": "https://github.com/isaacs/once/issues" + }, + "homepage": "https://github.com/isaacs/once#readme", + "_id": "once@1.3.2", + "_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "_from": "once@>=1.3.0 <2.0.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "2.0.0", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "tarball": "http://registry.npmjs.org/once/-/once-1.3.2.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "_resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/node_modules/once/test/once.js b/node_modules/tape/node_modules/glob/node_modules/once/test/once.js new file mode 100644 index 00000000..c618360d --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/once/test/once.js @@ -0,0 +1,23 @@ +var test = require('tap').test +var once = require('../once.js') + +test('once', function (t) { + var f = 0 + function fn (g) { + t.equal(f, 0) + f ++ + return f + g + this + } + fn.ownProperty = {} + var foo = once(fn) + t.equal(fn.ownProperty, foo.ownProperty) + t.notOk(foo.called) + for (var i = 0; i < 1E3; i++) { + t.same(f, i === 0 ? 0 : 1) + var g = foo.call(1, 1) + t.ok(foo.called) + t.same(g, 3) + t.same(f, 1) + } + t.end() +}) diff --git a/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/index.js b/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/index.js new file mode 100644 index 00000000..19f103f9 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'use strict'; + +function posix(path) { + return path.charAt(0) === '/'; +}; + +function win32(path) { + // https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = !!device && device.charAt(1) !== ':'; + + // UNC paths are always absolute + return !!result[2] || isUnc; +}; + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/license b/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/package.json b/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/package.json new file mode 100644 index 00000000..301658ff --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/package.json @@ -0,0 +1,70 @@ +{ + "name": "path-is-absolute", + "version": "1.0.0", + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/path-is-absolute" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "gitHead": "7a76a0c9f2263192beedbe0a820e4d0baee5b7a1", + "bugs": { + "url": "https://github.com/sindresorhus/path-is-absolute/issues" + }, + "homepage": "https://github.com/sindresorhus/path-is-absolute", + "_id": "path-is-absolute@1.0.0", + "_shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", + "_from": "path-is-absolute@>=1.0.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", + "tarball": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/readme.md b/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/readme.md new file mode 100644 index 00000000..cdf94f43 --- /dev/null +++ b/node_modules/tape/node_modules/glob/node_modules/path-is-absolute/readme.md @@ -0,0 +1,51 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) ponyfill + +> Ponyfill: A polyfill that doesn't overwrite the native method + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +var pathIsAbsolute = require('path-is-absolute'); + +// Linux +pathIsAbsolute('/home/foo'); +//=> true + +// Windows +pathIsAbsolute('C:/Users/'); +//=> true + +// Any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +The Posix specific version. + +### pathIsAbsolute.win32(path) + +The Windows specific version. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/tape/node_modules/glob/package.json b/node_modules/tape/node_modules/glob/package.json new file mode 100644 index 00000000..bd80eba6 --- /dev/null +++ b/node_modules/tape/node_modules/glob/package.json @@ -0,0 +1,73 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "name": "glob", + "description": "a little globber", + "version": "5.0.5", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "engines": { + "node": "*" + }, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^2.0.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "devDependencies": { + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^0.5.0", + "tick": "0.0.6" + }, + "scripts": { + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "npm run profclean && tap test/*.js", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "bash benchclean.sh" + }, + "license": "ISC", + "gitHead": "9db1a83b44da0c60f5fdd31b28b1f9917ee6316d", + "bugs": { + "url": "https://github.com/isaacs/node-glob/issues" + }, + "homepage": "https://github.com/isaacs/node-glob", + "_id": "glob@5.0.5", + "_shasum": "784431e4e29a900ae0d47fba6aa1c7f16a8e7df7", + "_from": "glob@>=5.0.0 <6.0.0", + "_npmVersion": "2.7.6", + "_nodeVersion": "1.4.2", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "784431e4e29a900ae0d47fba6aa1c7f16a8e7df7", + "tarball": "http://registry.npmjs.org/glob/-/glob-5.0.5.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/glob/-/glob-5.0.5.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/glob/sync.js b/node_modules/tape/node_modules/glob/sync.js new file mode 100644 index 00000000..92fe1101 --- /dev/null +++ b/node_modules/tape/node_modules/glob/sync.js @@ -0,0 +1,457 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = fs.realpathSync(p, this.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this.matches[index][e] = true + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + var abs = this._makeAbs(e) + if (this.mark) + e = this._mark(e) + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[this._makeAbs(e)] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + // lstat failed, doesn't exist + return null + } + + var isSym = lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) throw er + if (!this.silent) console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this.matches[index][prefix] = true +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + return false + } + + if (lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/node_modules/tape/node_modules/inherits/LICENSE b/node_modules/tape/node_modules/inherits/LICENSE new file mode 100644 index 00000000..dea3013d --- /dev/null +++ b/node_modules/tape/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/tape/node_modules/inherits/README.md b/node_modules/tape/node_modules/inherits/README.md new file mode 100644 index 00000000..b1c56658 --- /dev/null +++ b/node_modules/tape/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/tape/node_modules/inherits/inherits.js b/node_modules/tape/node_modules/inherits/inherits.js new file mode 100644 index 00000000..29f5e24f --- /dev/null +++ b/node_modules/tape/node_modules/inherits/inherits.js @@ -0,0 +1 @@ +module.exports = require('util').inherits diff --git a/node_modules/tape/node_modules/inherits/inherits_browser.js b/node_modules/tape/node_modules/inherits/inherits_browser.js new file mode 100644 index 00000000..c1e78a75 --- /dev/null +++ b/node_modules/tape/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} diff --git a/node_modules/tape/node_modules/inherits/package.json b/node_modules/tape/node_modules/inherits/package.json new file mode 100644 index 00000000..005588b2 --- /dev/null +++ b/node_modules/tape/node_modules/inherits/package.json @@ -0,0 +1,50 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.1", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits" + }, + "license": "ISC", + "scripts": { + "test": "node test" + }, + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "_id": "inherits@2.0.1", + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "_from": "inherits@>=2.0.1 <2.1.0", + "_npmVersion": "1.3.8", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "readme": "ERROR: No README data found!", + "homepage": "https://github.com/isaacs/inherits" +} diff --git a/node_modules/tape/node_modules/inherits/test.js b/node_modules/tape/node_modules/inherits/test.js new file mode 100644 index 00000000..fc53012d --- /dev/null +++ b/node_modules/tape/node_modules/inherits/test.js @@ -0,0 +1,25 @@ +var inherits = require('./inherits.js') +var assert = require('assert') + +function test(c) { + assert(c.constructor === Child) + assert(c.constructor.super_ === Parent) + assert(Object.getPrototypeOf(c) === Child.prototype) + assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) + assert(c instanceof Child) + assert(c instanceof Parent) +} + +function Child() { + Parent.call(this) + test(this) +} + +function Parent() {} + +inherits(Child, Parent) + +var c = new Child +test(c) + +console.log('ok') diff --git a/node_modules/tape/node_modules/object-inspect/.travis.yml b/node_modules/tape/node_modules/object-inspect/.travis.yml new file mode 100644 index 00000000..9672e129 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "0.8" + - "0.10" +before_install: + - npm install -g npm@~1.4.6 diff --git a/node_modules/tape/node_modules/object-inspect/LICENSE b/node_modules/tape/node_modules/object-inspect/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/tape/node_modules/object-inspect/example/all.js b/node_modules/tape/node_modules/object-inspect/example/all.js new file mode 100644 index 00000000..6d2d4bee --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/example/all.js @@ -0,0 +1,17 @@ +var inspect = require('../'); +var holes = [ 'a', 'b' ]; +holes[4] = 'e', holes[6] = 'g'; +var obj = { + a: 1, + b: [ 3, 4, undefined, null ], + c: undefined, + d: null, + e: { + regex: /^x/i, + buf: new Buffer('abc'), + holes: holes + }, + now: new Date +}; +obj.self = obj; +console.log(inspect(obj)); diff --git a/node_modules/tape/node_modules/object-inspect/example/circular.js b/node_modules/tape/node_modules/object-inspect/example/circular.js new file mode 100644 index 00000000..1006d0c0 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/example/circular.js @@ -0,0 +1,4 @@ +var inspect = require('../'); +var obj = { a: 1, b: [3,4] }; +obj.c = obj; +console.log(inspect(obj)); diff --git a/node_modules/tape/node_modules/object-inspect/example/fn.js b/node_modules/tape/node_modules/object-inspect/example/fn.js new file mode 100644 index 00000000..4c00ba6d --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/example/fn.js @@ -0,0 +1,3 @@ +var inspect = require('../'); +var obj = [ 1, 2, function f (n) { return n + 5 }, 4 ]; +console.log(inspect(obj)); diff --git a/node_modules/tape/node_modules/object-inspect/example/inspect.js b/node_modules/tape/node_modules/object-inspect/example/inspect.js new file mode 100644 index 00000000..b5ad4d19 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/example/inspect.js @@ -0,0 +1,7 @@ +var inspect = require('../'); + +var d = document.createElement('div'); +d.setAttribute('id', 'beep'); +d.innerHTML = 'woooiiiii'; + +console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ])); diff --git a/node_modules/tape/node_modules/object-inspect/index.js b/node_modules/tape/node_modules/object-inspect/index.js new file mode 100644 index 00000000..0e8c1d1c --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/index.js @@ -0,0 +1,142 @@ +module.exports = function inspect_ (obj, opts, depth, seen) { + if (!opts) opts = {}; + + var maxDepth = opts.depth === undefined ? 5 : opts.depth; + if (depth === undefined) depth = 0; + if (depth >= maxDepth && maxDepth > 0 + && obj && typeof obj === 'object') { + return '[Object]'; + } + + if (seen === undefined) seen = []; + else if (indexOf(seen, obj) >= 0) { + return '[Circular]'; + } + + function inspect (value, from) { + if (from) { + seen = seen.slice(); + seen.push(from); + } + return inspect_(value, opts, depth + 1, seen); + } + + if (typeof obj === 'string') { + return inspectString(obj); + } + else if (typeof obj === 'function') { + var name = nameOf(obj); + return '[Function' + (name ? ': ' + name : '') + ']'; + } + else if (obj === null) { + return 'null'; + } + else if (isElement(obj)) { + var s = '<' + String(obj.nodeName).toLowerCase(); + var attrs = obj.attributes || []; + for (var i = 0; i < attrs.length; i++) { + s += ' ' + attrs[i].name + '="' + quote(attrs[i].value) + '"'; + } + s += '>'; + if (obj.childNodes && obj.childNodes.length) s += '...'; + s += ''; + return s; + } + else if (isArray(obj)) { + if (obj.length === 0) return '[]'; + var xs = Array(obj.length); + for (var i = 0; i < obj.length; i++) { + xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; + } + return '[ ' + xs.join(', ') + ' ]'; + } + else if (isError(obj)) { + var parts = []; + for (var key in obj) { + if (!has(obj, key)) continue; + + if (/[^\w$]/.test(key)) { + parts.push(inspect(key) + ': ' + inspect(obj[key])); + } + else { + parts.push(key + ': ' + inspect(obj[key])); + } + } + if (parts.length === 0) return '[' + obj + ']'; + return '{ [' + obj + '] ' + parts.join(', ') + ' }'; + } + else if (typeof obj === 'object' && typeof obj.inspect === 'function') { + return obj.inspect(); + } + else if (typeof obj === 'object' && !isDate(obj) && !isRegExp(obj)) { + var xs = [], keys = []; + for (var key in obj) { + if (has(obj, key)) keys.push(key); + } + keys.sort(); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (/[^\w$]/.test(key)) { + xs.push(inspect(key) + ': ' + inspect(obj[key], obj)); + } + else xs.push(key + ': ' + inspect(obj[key], obj)); + } + if (xs.length === 0) return '{}'; + return '{ ' + xs.join(', ') + ' }'; + } + else return String(obj); +}; + +function quote (s) { + return String(s).replace(/"/g, '"'); +} + +function isArray (obj) { return toStr(obj) === '[object Array]' } +function isDate (obj) { return toStr(obj) === '[object Date]' } +function isRegExp (obj) { return toStr(obj) === '[object RegExp]' } +function isError (obj) { return toStr(obj) === '[object Error]' } + +function has (obj, key) { + if (!{}.hasOwnProperty) return key in obj; + return {}.hasOwnProperty.call(obj, key); +} + +function toStr (obj) { + return Object.prototype.toString.call(obj); +} + +function nameOf (f) { + if (f.name) return f.name; + var m = f.toString().match(/^function\s*([\w$]+)/); + if (m) return m[1]; +} + +function indexOf (xs, x) { + if (xs.indexOf) return xs.indexOf(x); + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +function isElement (x) { + if (!x || typeof x !== 'object') return false; + if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { + return true; + } + return typeof x.nodeName === 'string' + && typeof x.getAttribute === 'function' + ; +} + +function inspectString (str) { + var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte); + return "'" + s + "'"; + + function lowbyte (c) { + var n = c.charCodeAt(0); + var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n]; + if (x) return '\\' + x; + return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16); + } +} diff --git a/node_modules/tape/node_modules/object-inspect/package.json b/node_modules/tape/node_modules/object-inspect/package.json new file mode 100644 index 00000000..8ee14631 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/package.json @@ -0,0 +1,71 @@ +{ + "name": "object-inspect", + "version": "1.0.0", + "description": "string representations of objects in node and the browser", + "main": "index.js", + "devDependencies": { + "tape": "^2.13.3" + }, + "scripts": { + "test": "tape test/*.js" + }, + "testling": { + "files": [ + "test/*.js", + "test/browser/*.js" + ], + "browsers": [ + "ie/6..latest", + "chrome/latest", + "firefox/latest", + "safari/latest", + "opera/latest", + "iphone/latest", + "ipad/latest", + "android/latest" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/object-inspect.git" + }, + "homepage": "https://github.com/substack/object-inspect", + "keywords": [ + "inspect", + "util.inspect", + "object", + "stringify", + "pretty" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "gitHead": "d497276c1da14234bb5098a59cf20de75fbc316a", + "bugs": { + "url": "https://github.com/substack/object-inspect/issues" + }, + "_id": "object-inspect@1.0.0", + "_shasum": "df6c525311b57a7d70186915e87b81eb33748468", + "_from": "object-inspect@>=1.0.0 <1.1.0", + "_npmVersion": "1.4.21", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "dist": { + "shasum": "df6c525311b57a7d70186915e87b81eb33748468", + "tarball": "http://registry.npmjs.org/object-inspect/-/object-inspect-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/object-inspect/readme.markdown b/node_modules/tape/node_modules/object-inspect/readme.markdown new file mode 100644 index 00000000..41959a40 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/readme.markdown @@ -0,0 +1,59 @@ +# object-inspect + +string representations of objects in node and the browser + +[![testling badge](https://ci.testling.com/substack/object-inspect.png)](https://ci.testling.com/substack/object-inspect) + +[![build status](https://secure.travis-ci.org/substack/object-inspect.png)](http://travis-ci.org/substack/object-inspect) + +# example + +## circular + +``` js +var inspect = require('object-inspect'); +var obj = { a: 1, b: [3,4] }; +obj.c = obj; +console.log(inspect(obj)); +``` + +## dom element + +``` js +var inspect = require('object-inspect'); + +var d = document.createElement('div'); +d.setAttribute('id', 'beep'); +d.innerHTML = 'woooiiiii'; + +console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ])); +``` + +output: + +``` +[
...
, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ] +``` + +# methods + +``` js +var inspect = require('object-inspect') +``` + +## var s = inspect(obj, opts={}) + +Return a string `s` with the string representation of `obj` up to a depth of +`opts.depth`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install object-inspect +``` + +# license + +MIT diff --git a/node_modules/tape/node_modules/object-inspect/test/browser/dom.js b/node_modules/tape/node_modules/object-inspect/test/browser/dom.js new file mode 100644 index 00000000..18a3d709 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/browser/dom.js @@ -0,0 +1,15 @@ +var inspect = require('../../'); +var test = require('tape'); + +test('dom element', function (t) { + t.plan(1); + + var d = document.createElement('div'); + d.setAttribute('id', 'beep'); + d.innerHTML = 'woooiiiii'; + + t.equal( + inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]), + '[
...
, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [Object] ] ] ] } ]' + ); +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/circular.js b/node_modules/tape/node_modules/object-inspect/test/circular.js new file mode 100644 index 00000000..28598a7f --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/circular.js @@ -0,0 +1,9 @@ +var inspect = require('../'); +var test = require('tape'); + +test('circular', function (t) { + t.plan(1); + var obj = { a: 1, b: [3,4] }; + obj.c = obj; + t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }'); +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/deep.js b/node_modules/tape/node_modules/object-inspect/test/deep.js new file mode 100644 index 00000000..a8dbb58f --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/deep.js @@ -0,0 +1,9 @@ +var inspect = require('../'); +var test = require('tape'); + +test('deep', function (t) { + t.plan(2); + var obj = [ [ [ [ [ [ 500 ] ] ] ] ] ]; + t.equal(inspect(obj), '[ [ [ [ [ [Object] ] ] ] ] ]'); + t.equal(inspect(obj, { depth: 2 }), '[ [ [Object] ] ]'); +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/element.js b/node_modules/tape/node_modules/object-inspect/test/element.js new file mode 100644 index 00000000..66df4b81 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/element.js @@ -0,0 +1,51 @@ +var inspect = require('../'); +var test = require('tape'); + +test('element', function (t) { + t.plan(1); + var elem = { + nodeName: 'div', + attributes: [ { name: 'class', value: 'row' } ], + getAttribute: function (key) {}, + childNodes: [] + }; + var obj = [ 1, elem, 3 ]; + t.deepEqual(inspect(obj), '[ 1,
, 3 ]'); +}); + +test('element no attr', function (t) { + t.plan(1); + var elem = { + nodeName: 'div', + getAttribute: function (key) {}, + childNodes: [] + }; + var obj = [ 1, elem, 3 ]; + t.deepEqual(inspect(obj), '[ 1,
, 3 ]'); +}); + +test('element with contents', function (t) { + t.plan(1); + var elem = { + nodeName: 'div', + getAttribute: function (key) {}, + childNodes: [ { nodeName: 'b' } ] + }; + var obj = [ 1, elem, 3 ]; + t.deepEqual(inspect(obj), '[ 1,
...
, 3 ]'); +}); + +test('element instance', function (t) { + t.plan(1); + var h = global.HTMLElement; + global.HTMLElement = function (name, attr) { + this.nodeName = name; + this.attributes = attr; + }; + global.HTMLElement.prototype.getAttribute = function () {}; + + var elem = new(global.HTMLElement)('div', []); + var obj = [ 1, elem, 3 ]; + t.deepEqual(inspect(obj), '[ 1,
, 3 ]'); + global.HTMLElement = h; +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/err.js b/node_modules/tape/node_modules/object-inspect/test/err.js new file mode 100644 index 00000000..0f313438 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/err.js @@ -0,0 +1,29 @@ +var inspect = require('../'); +var test = require('tape'); + +test('type error', function (t) { + t.plan(1); + var aerr = new TypeError; + aerr.foo = 555; + aerr.bar = [1,2,3]; + + var berr = new TypeError('tuv'); + berr.baz = 555; + + var cerr = new SyntaxError; + cerr.message = 'whoa'; + cerr['a-b'] = 5; + + var obj = [ + new TypeError, + new TypeError('xxx'), + aerr, berr, cerr + ]; + t.equal(inspect(obj), '[ ' + [ + '[TypeError]', + '[TypeError: xxx]', + '{ [TypeError] foo: 555, bar: [ 1, 2, 3 ] }', + '{ [TypeError: tuv] baz: 555 }', + '{ [SyntaxError: whoa] message: \'whoa\', \'a-b\': 5 }' + ].join(', ') + ' ]'); +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/fn.js b/node_modules/tape/node_modules/object-inspect/test/fn.js new file mode 100644 index 00000000..55357db2 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/fn.js @@ -0,0 +1,16 @@ +var inspect = require('../'); +var test = require('tape'); + +test('function', function (t) { + t.plan(1); + var obj = [ 1, 2, function f (n) {}, 4 ]; + t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]'); +}); + +test('function name', function (t) { + t.plan(1); + var f = function () {}; + f.toString = function () { return 'function xxx () {}' }; + var obj = [ 1, 2, f, 4 ]; + t.equal(inspect(obj), '[ 1, 2, [Function: xxx], 4 ]'); +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/holes.js b/node_modules/tape/node_modules/object-inspect/test/holes.js new file mode 100644 index 00000000..ae54de46 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/holes.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var inspect = require('../'); + +var xs = [ 'a', 'b' ]; +xs[5] = 'f'; +xs[7] = 'j'; +xs[8] = 'k'; + +test('holes', function (t) { + t.plan(1); + t.equal( + inspect(xs), + "[ 'a', 'b', , , , 'f', , 'j', 'k' ]" + ); +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/inspect.js b/node_modules/tape/node_modules/object-inspect/test/inspect.js new file mode 100644 index 00000000..12e231af --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/inspect.js @@ -0,0 +1,8 @@ +var inspect = require('../'); +var test = require('tape'); + +test('inspect', function (t) { + t.plan(1); + var obj = [ { inspect: function () { return '!XYZ¡' } }, [] ]; + t.equal(inspect(obj), '[ !XYZ¡, [] ]'); +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/lowbyte.js b/node_modules/tape/node_modules/object-inspect/test/lowbyte.js new file mode 100644 index 00000000..debd59cb --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/lowbyte.js @@ -0,0 +1,12 @@ +var test = require('tape'); +var inspect = require('../'); + +var obj = { x: 'a\r\nb', y: '\5! \x1f \022' }; + +test('interpolate low bytes', function (t) { + t.plan(1); + t.equal( + inspect(obj), + "{ x: 'a\\r\\nb', y: '\\x05! \\x1f \\x12' }" + ); +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/undef.js b/node_modules/tape/node_modules/object-inspect/test/undef.js new file mode 100644 index 00000000..833238f8 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/undef.js @@ -0,0 +1,12 @@ +var test = require('tape'); +var inspect = require('../'); + +var obj = { a: 1, b: [ 3, 4, undefined, null ], c: undefined, d: null }; + +test('undef and null', function (t) { + t.plan(1); + t.equal( + inspect(obj), + '{ a: 1, b: [ 3, 4, undefined, null ], c: undefined, d: null }' + ); +}); diff --git a/node_modules/tape/node_modules/object-inspect/test/values.js b/node_modules/tape/node_modules/object-inspect/test/values.js new file mode 100644 index 00000000..cb7df420 --- /dev/null +++ b/node_modules/tape/node_modules/object-inspect/test/values.js @@ -0,0 +1,56 @@ +var inspect = require('../'); +var test = require('tape'); + +test('values', function (t) { + t.plan(1); + var obj = [ {}, [], { 'a-b': 5 } ]; + t.equal(inspect(obj), '[ {}, [], { \'a-b\': 5 } ]'); +}); + +test('has', function (t) { + t.plan(1); + var has = Object.prototype.hasOwnProperty; + delete Object.prototype.hasOwnProperty; + t.equal(inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }'); + Object.prototype.hasOwnProperty = has; +}); + +test('indexOf seen', function (t) { + t.plan(1); + var xs = [ 1, 2, 3, {} ]; + xs.push(xs); + + var seen = []; + seen.indexOf = undefined; + + t.equal( + inspect(xs, {}, 0, seen), + '[ 1, 2, 3, {}, [Circular] ]' + ); +}); + +test('seen seen', function (t) { + t.plan(1); + var xs = [ 1, 2, 3 ]; + + var seen = [ xs ]; + seen.indexOf = undefined; + + t.equal( + inspect(xs, {}, 0, seen), + '[Circular]' + ); +}); + +test('seen seen seen', function (t) { + t.plan(1); + var xs = [ 1, 2, 3 ]; + + var seen = [ 5, xs ]; + seen.indexOf = undefined; + + t.equal( + inspect(xs, {}, 0, seen), + '[Circular]' + ); +}); diff --git a/node_modules/tape/node_modules/resumer/.travis.yml b/node_modules/tape/node_modules/resumer/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/tape/node_modules/resumer/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/tape/node_modules/resumer/LICENSE b/node_modules/tape/node_modules/resumer/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/tape/node_modules/resumer/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT 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. + +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/node_modules/tape/node_modules/resumer/example/resume.js b/node_modules/tape/node_modules/resumer/example/resume.js new file mode 100644 index 00000000..d04e61a3 --- /dev/null +++ b/node_modules/tape/node_modules/resumer/example/resume.js @@ -0,0 +1,8 @@ +var resumer = require('../'); +createStream().pipe(process.stdout); + +function createStream () { + var stream = resumer(); + stream.queue('beep boop\n'); + return stream; +} diff --git a/node_modules/tape/node_modules/resumer/index.js b/node_modules/tape/node_modules/resumer/index.js new file mode 100644 index 00000000..14de7983 --- /dev/null +++ b/node_modules/tape/node_modules/resumer/index.js @@ -0,0 +1,29 @@ +var through = require('through'); +var nextTick = typeof setImmediate !== 'undefined' + ? setImmediate + : process.nextTick +; + +module.exports = function (write, end) { + var tr = through(write, end); + tr.pause(); + var resume = tr.resume; + var pause = tr.pause; + var paused = false; + + tr.pause = function () { + paused = true; + return pause.apply(this, arguments); + }; + + tr.resume = function () { + paused = false; + return resume.apply(this, arguments); + }; + + nextTick(function () { + if (!paused) tr.resume(); + }); + + return tr; +}; diff --git a/node_modules/tape/node_modules/resumer/package.json b/node_modules/tape/node_modules/resumer/package.json new file mode 100644 index 00000000..31f78d09 --- /dev/null +++ b/node_modules/tape/node_modules/resumer/package.json @@ -0,0 +1,71 @@ +{ + "name": "resumer", + "version": "0.0.0", + "description": "a through stream that starts paused and resumes on the next tick", + "main": "index.js", + "dependencies": { + "through": "~2.3.4" + }, + "devDependencies": { + "tap": "~0.4.0", + "tape": "~1.0.2", + "concat-stream": "~0.1.1" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "chrome/20..latest", + "firefox/10..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6", + "ipad/6" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/resumer.git" + }, + "homepage": "https://github.com/substack/resumer", + "keywords": [ + "through", + "stream", + "pause", + "resume" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "readme": "# resumer\n\nReturn a through stream that starts out paused and resumes on the next tick,\nunless somebody called `.pause()`.\n\nThis module has the same signature as\n[through](https://npmjs.com/package/through).\n\n[![browser support](https://ci.testling.com/substack/resumer.png)](http://ci.testling.com/substack/resumer)\n\n[![build status](https://secure.travis-ci.org/substack/resumer.png)](http://travis-ci.org/substack/resumer)\n\n# example\n\n``` js\nvar resumer = require('resumer');\nvar s = createStream();\ns.pipe(process.stdout);\n\nfunction createStream () {\n var stream = resumer();\n stream.queue('beep boop\\n');\n return stream;\n}\n```\n\n```\n$ node example/resume.js\nbeep boop\n```\n\n# methods\n\n``` js\nvar resumer = require('resumer')\n```\n\n## resumer(write, end)\n\nReturn a new through stream from `write` and `end`, which default to\npass-through `.queue()` functions if not specified.\n\nThe stream starts out paused and will be resumed on the next tick unless you\ncall `.pause()` first.\n\n`write` and `end` get passed directly through to\n[through](https://npmjs.com/package/through).\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install resumer\n```\n\n# license\n\nMIT\n", + "readmeFilename": "readme.markdown", + "_id": "resumer@0.0.0", + "dist": { + "shasum": "f1e8f461e4064ba39e82af3cdc2a8c893d076759", + "tarball": "http://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz" + }, + "_from": "resumer@>=0.0.0 <0.1.0", + "_npmVersion": "1.2.2", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "directories": {}, + "_shasum": "f1e8f461e4064ba39e82af3cdc2a8c893d076759", + "_resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", + "bugs": { + "url": "https://github.com/substack/resumer/issues" + } +} diff --git a/node_modules/tape/node_modules/resumer/readme.markdown b/node_modules/tape/node_modules/resumer/readme.markdown new file mode 100644 index 00000000..5d9df664 --- /dev/null +++ b/node_modules/tape/node_modules/resumer/readme.markdown @@ -0,0 +1,59 @@ +# resumer + +Return a through stream that starts out paused and resumes on the next tick, +unless somebody called `.pause()`. + +This module has the same signature as +[through](https://npmjs.com/package/through). + +[![browser support](https://ci.testling.com/substack/resumer.png)](http://ci.testling.com/substack/resumer) + +[![build status](https://secure.travis-ci.org/substack/resumer.png)](http://travis-ci.org/substack/resumer) + +# example + +``` js +var resumer = require('resumer'); +var s = createStream(); +s.pipe(process.stdout); + +function createStream () { + var stream = resumer(); + stream.queue('beep boop\n'); + return stream; +} +``` + +``` +$ node example/resume.js +beep boop +``` + +# methods + +``` js +var resumer = require('resumer') +``` + +## resumer(write, end) + +Return a new through stream from `write` and `end`, which default to +pass-through `.queue()` functions if not specified. + +The stream starts out paused and will be resumed on the next tick unless you +call `.pause()` first. + +`write` and `end` get passed directly through to +[through](https://npmjs.com/package/through). + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install resumer +``` + +# license + +MIT diff --git a/node_modules/tape/node_modules/resumer/test/resume.js b/node_modules/tape/node_modules/resumer/test/resume.js new file mode 100644 index 00000000..1eaecac2 --- /dev/null +++ b/node_modules/tape/node_modules/resumer/test/resume.js @@ -0,0 +1,37 @@ +var test = require('tape'); +var resumer = require('../'); +var concat = require('concat-stream'); + +test('implicit resume', function (t) { + t.plan(1); + + var s = createStream(); + s.pipe(concat(function (err, body) { + t.equal(body, 'beep boop\n'); + })); +}); + +test('pause/resume', function (t) { + t.plan(2); + + var s = createStream(); + s.pause(); + + var paused = true; + setTimeout(function () { + paused = false; + s.resume(); + }, 100); + + s.pipe(concat(function (err, body) { + t.equal(paused, false); + t.equal(body, 'beep boop\n'); + })); +}); + +function createStream () { + var stream = resumer(); + stream.queue('beep boop\n'); + stream.queue(null); + return stream; +} diff --git a/node_modules/tape/node_modules/resumer/test/through.js b/node_modules/tape/node_modules/resumer/test/through.js new file mode 100644 index 00000000..ddcaf487 --- /dev/null +++ b/node_modules/tape/node_modules/resumer/test/through.js @@ -0,0 +1,36 @@ +var test = require('tape'); +var resumer = require('../'); +var concat = require('concat-stream'); + +test('through write/end', function (t) { + t.plan(2); + + var s = createStream(); + + s.on('okok', function () { + t.ok(true); + }); + + s.pipe(concat(function (err, body) { + t.equal(body, 'BEGIN\nRAWR\nEND\n'); + })); + + setTimeout(function () { + s.end('rawr\n'); + }, 50); +}); + +function createStream () { + var stream = resumer(write, end); + stream.queue('BEGIN\n'); + return stream; + + function write (x) { + this.queue(String(x).toUpperCase()); + } + function end () { + this.emit('okok'); + this.queue('END\n'); + this.queue(null); + } +} diff --git a/node_modules/tape/node_modules/through/.travis.yml b/node_modules/tape/node_modules/through/.travis.yml new file mode 100644 index 00000000..c693a939 --- /dev/null +++ b/node_modules/tape/node_modules/through/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - "0.10" diff --git a/node_modules/tape/node_modules/through/LICENSE.APACHE2 b/node_modules/tape/node_modules/through/LICENSE.APACHE2 new file mode 100644 index 00000000..6366c047 --- /dev/null +++ b/node_modules/tape/node_modules/through/LICENSE.APACHE2 @@ -0,0 +1,15 @@ +Apache License, Version 2.0 + +Copyright (c) 2011 Dominic Tarr + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/node_modules/tape/node_modules/through/LICENSE.MIT b/node_modules/tape/node_modules/through/LICENSE.MIT new file mode 100644 index 00000000..6eafbd73 --- /dev/null +++ b/node_modules/tape/node_modules/through/LICENSE.MIT @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2011 Dominic Tarr + +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/node_modules/tape/node_modules/through/index.js b/node_modules/tape/node_modules/through/index.js new file mode 100644 index 00000000..ca5fc590 --- /dev/null +++ b/node_modules/tape/node_modules/through/index.js @@ -0,0 +1,108 @@ +var Stream = require('stream') + +// through +// +// a stream that does nothing but re-emit the input. +// useful for aggregating a series of changing but not ending streams into one stream) + +exports = module.exports = through +through.through = through + +//create a readable writable stream. + +function through (write, end, opts) { + write = write || function (data) { this.queue(data) } + end = end || function () { this.queue(null) } + + var ended = false, destroyed = false, buffer = [], _ended = false + var stream = new Stream() + stream.readable = stream.writable = true + stream.paused = false + +// stream.autoPause = !(opts && opts.autoPause === false) + stream.autoDestroy = !(opts && opts.autoDestroy === false) + + stream.write = function (data) { + write.call(this, data) + return !stream.paused + } + + function drain() { + while(buffer.length && !stream.paused) { + var data = buffer.shift() + if(null === data) + return stream.emit('end') + else + stream.emit('data', data) + } + } + + stream.queue = stream.push = function (data) { +// console.error(ended) + if(_ended) return stream + if(data === null) _ended = true + buffer.push(data) + drain() + return stream + } + + //this will be registered as the first 'end' listener + //must call destroy next tick, to make sure we're after any + //stream piped from here. + //this is only a problem if end is not emitted synchronously. + //a nicer way to do this is to make sure this is the last listener for 'end' + + stream.on('end', function () { + stream.readable = false + if(!stream.writable && stream.autoDestroy) + process.nextTick(function () { + stream.destroy() + }) + }) + + function _end () { + stream.writable = false + end.call(stream) + if(!stream.readable && stream.autoDestroy) + stream.destroy() + } + + stream.end = function (data) { + if(ended) return + ended = true + if(arguments.length) stream.write(data) + _end() // will emit or queue + return stream + } + + stream.destroy = function () { + if(destroyed) return + destroyed = true + ended = true + buffer.length = 0 + stream.writable = stream.readable = false + stream.emit('close') + return stream + } + + stream.pause = function () { + if(stream.paused) return + stream.paused = true + return stream + } + + stream.resume = function () { + if(stream.paused) { + stream.paused = false + stream.emit('resume') + } + drain() + //may have become paused again, + //as drain emits 'data'. + if(!stream.paused) + stream.emit('drain') + return stream + } + return stream +} + diff --git a/node_modules/tape/node_modules/through/package.json b/node_modules/tape/node_modules/through/package.json new file mode 100644 index 00000000..7c00cbda --- /dev/null +++ b/node_modules/tape/node_modules/through/package.json @@ -0,0 +1,66 @@ +{ + "name": "through", + "version": "2.3.7", + "description": "simplified stream construction", + "main": "index.js", + "scripts": { + "test": "set -e; for t in test/*.js; do node $t; done" + }, + "devDependencies": { + "stream-spec": "~0.3.5", + "tape": "~2.3.2", + "from": "~0.1.3" + }, + "keywords": [ + "stream", + "streams", + "user-streams", + "pipe" + ], + "author": { + "name": "Dominic Tarr", + "email": "dominic.tarr@gmail.com", + "url": "dominictarr.com" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/dominictarr/through.git" + }, + "homepage": "http://github.com/dominictarr/through", + "testling": { + "browsers": [ + "ie/8..latest", + "ff/15..latest", + "chrome/20..latest", + "safari/5.1..latest" + ], + "files": "test/*.js" + }, + "gitHead": "d532966ebcae90fd6a150cc489b55c6a4e0bc4a0", + "bugs": { + "url": "https://github.com/dominictarr/through/issues" + }, + "_id": "through@2.3.7", + "_shasum": "5fcc3690fed2fdf98c6fc88b4d207a4624ac3b87", + "_from": "through@>=2.3.4 <2.4.0", + "_npmVersion": "2.4.1", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + }, + "maintainers": [ + { + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" + } + ], + "dist": { + "shasum": "5fcc3690fed2fdf98c6fc88b4d207a4624ac3b87", + "tarball": "http://registry.npmjs.org/through/-/through-2.3.7.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/through/-/through-2.3.7.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/node_modules/through/readme.markdown b/node_modules/tape/node_modules/through/readme.markdown new file mode 100644 index 00000000..cb34c813 --- /dev/null +++ b/node_modules/tape/node_modules/through/readme.markdown @@ -0,0 +1,64 @@ +#through + +[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through) +[![testling badge](https://ci.testling.com/dominictarr/through.png)](https://ci.testling.com/dominictarr/through) + +Easy way to create a `Stream` that is both `readable` and `writable`. + +* Pass in optional `write` and `end` methods. +* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`. +* Use `this.pause()` and `this.resume()` to manage flow. +* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`). + +This function is the basis for most of the synchronous streams in +[event-stream](http://github.com/dominictarr/event-stream). + +``` js +var through = require('through') + +through(function write(data) { + this.queue(data) //data *must* not be null + }, + function end () { //optional + this.queue(null) + }) +``` + +Or, can also be used _without_ buffering on pause, use `this.emit('data', data)`, +and this.emit('end') + +``` js +var through = require('through') + +through(function write(data) { + this.emit('data', data) + //this.pause() + }, + function end () { //optional + this.emit('end') + }) +``` + +## Extended Options + +You will probably not need these 99% of the time. + +### autoDestroy=false + +By default, `through` emits close when the writable +and readable side of the stream has ended. +If that is not desired, set `autoDestroy=false`. + +``` js +var through = require('through') + +//like this +var ts = through(write, end, {autoDestroy: false}) +//or like this +var ts = through(write, end) +ts.autoDestroy = false +``` + +## License + +MIT / Apache2 diff --git a/node_modules/tape/node_modules/through/test/async.js b/node_modules/tape/node_modules/through/test/async.js new file mode 100644 index 00000000..46bdbaeb --- /dev/null +++ b/node_modules/tape/node_modules/through/test/async.js @@ -0,0 +1,28 @@ +var from = require('from') +var through = require('../') + +var tape = require('tape') + +tape('simple async example', function (t) { + + var n = 0, expected = [1,2,3,4,5], actual = [] + from(expected) + .pipe(through(function(data) { + this.pause() + n ++ + setTimeout(function(){ + console.log('pushing data', data) + this.push(data) + this.resume() + }.bind(this), 300) + })).pipe(through(function(data) { + console.log('pushing data second time', data); + this.push(data) + })).on('data', function (d) { + actual.push(d) + }).on('end', function() { + t.deepEqual(actual, expected) + t.end() + }) + +}) diff --git a/node_modules/tape/node_modules/through/test/auto-destroy.js b/node_modules/tape/node_modules/through/test/auto-destroy.js new file mode 100644 index 00000000..9a8fd000 --- /dev/null +++ b/node_modules/tape/node_modules/through/test/auto-destroy.js @@ -0,0 +1,30 @@ +var test = require('tape') +var through = require('../') + +// must emit end before close. + +test('end before close', function (assert) { + var ts = through() + ts.autoDestroy = false + var ended = false, closed = false + + ts.on('end', function () { + assert.ok(!closed) + ended = true + }) + ts.on('close', function () { + assert.ok(ended) + closed = true + }) + + ts.write(1) + ts.write(2) + ts.write(3) + ts.end() + assert.ok(ended) + assert.notOk(closed) + ts.destroy() + assert.ok(closed) + assert.end() +}) + diff --git a/node_modules/tape/node_modules/through/test/buffering.js b/node_modules/tape/node_modules/through/test/buffering.js new file mode 100644 index 00000000..b0084bfc --- /dev/null +++ b/node_modules/tape/node_modules/through/test/buffering.js @@ -0,0 +1,71 @@ +var test = require('tape') +var through = require('../') + +// must emit end before close. + +test('buffering', function(assert) { + var ts = through(function (data) { + this.queue(data) + }, function () { + this.queue(null) + }) + + var ended = false, actual = [] + + ts.on('data', actual.push.bind(actual)) + ts.on('end', function () { + ended = true + }) + + ts.write(1) + ts.write(2) + ts.write(3) + assert.deepEqual(actual, [1, 2, 3]) + ts.pause() + ts.write(4) + ts.write(5) + ts.write(6) + assert.deepEqual(actual, [1, 2, 3]) + ts.resume() + assert.deepEqual(actual, [1, 2, 3, 4, 5, 6]) + ts.pause() + ts.end() + assert.ok(!ended) + ts.resume() + assert.ok(ended) + assert.end() +}) + +test('buffering has data in queue, when ends', function (assert) { + + /* + * If stream ends while paused with data in the queue, + * stream should still emit end after all data is written + * on resume. + */ + + var ts = through(function (data) { + this.queue(data) + }, function () { + this.queue(null) + }) + + var ended = false, actual = [] + + ts.on('data', actual.push.bind(actual)) + ts.on('end', function () { + ended = true + }) + + ts.pause() + ts.write(1) + ts.write(2) + ts.write(3) + ts.end() + assert.deepEqual(actual, [], 'no data written yet, still paused') + assert.ok(!ended, 'end not emitted yet, still paused') + ts.resume() + assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered') + assert.ok(ended, 'end should be emitted once all data was delivered') + assert.end(); +}) diff --git a/node_modules/tape/node_modules/through/test/end.js b/node_modules/tape/node_modules/through/test/end.js new file mode 100644 index 00000000..fa113f58 --- /dev/null +++ b/node_modules/tape/node_modules/through/test/end.js @@ -0,0 +1,45 @@ +var test = require('tape') +var through = require('../') + +// must emit end before close. + +test('end before close', function (assert) { + var ts = through() + var ended = false, closed = false + + ts.on('end', function () { + assert.ok(!closed) + ended = true + }) + ts.on('close', function () { + assert.ok(ended) + closed = true + }) + + ts.write(1) + ts.write(2) + ts.write(3) + ts.end() + assert.ok(ended) + assert.ok(closed) + assert.end() +}) + +test('end only once', function (t) { + + var ts = through() + var ended = false, closed = false + + ts.on('end', function () { + t.equal(ended, false) + ended = true + }) + + ts.queue(null) + ts.queue(null) + ts.queue(null) + + ts.resume() + + t.end() +}) diff --git a/node_modules/tape/node_modules/through/test/index.js b/node_modules/tape/node_modules/through/test/index.js new file mode 100644 index 00000000..96da82f9 --- /dev/null +++ b/node_modules/tape/node_modules/through/test/index.js @@ -0,0 +1,133 @@ + +var test = require('tape') +var spec = require('stream-spec') +var through = require('../') + +/* + I'm using these two functions, and not streams and pipe + so there is less to break. if this test fails it must be + the implementation of _through_ +*/ + +function write(array, stream) { + array = array.slice() + function next() { + while(array.length) + if(stream.write(array.shift()) === false) + return stream.once('drain', next) + + stream.end() + } + + next() +} + +function read(stream, callback) { + var actual = [] + stream.on('data', function (data) { + actual.push(data) + }) + stream.once('end', function () { + callback(null, actual) + }) + stream.once('error', function (err) { + callback(err) + }) +} + +test('simple defaults', function(assert) { + + var l = 1000 + , expected = [] + + while(l--) expected.push(l * Math.random()) + + var t = through() + var s = spec(t).through().pausable() + + read(t, function (err, actual) { + assert.ifError(err) + assert.deepEqual(actual, expected) + assert.end() + }) + + t.on('close', s.validate) + + write(expected, t) +}); + +test('simple functions', function(assert) { + + var l = 1000 + , expected = [] + + while(l--) expected.push(l * Math.random()) + + var t = through(function (data) { + this.emit('data', data*2) + }) + var s = spec(t).through().pausable() + + + read(t, function (err, actual) { + assert.ifError(err) + assert.deepEqual(actual, expected.map(function (data) { + return data*2 + })) + assert.end() + }) + + t.on('close', s.validate) + + write(expected, t) +}) + +test('pauses', function(assert) { + + var l = 1000 + , expected = [] + + while(l--) expected.push(l) //Math.random()) + + var t = through() + + var s = spec(t) + .through() + .pausable() + + t.on('data', function () { + if(Math.random() > 0.1) return + t.pause() + process.nextTick(function () { + t.resume() + }) + }) + + read(t, function (err, actual) { + assert.ifError(err) + assert.deepEqual(actual, expected) + }) + + t.on('close', function () { + s.validate() + assert.end() + }) + + write(expected, t) +}) + +test('does not soft-end on `undefined`', function(assert) { + var stream = through() + , count = 0 + + stream.on('data', function (data) { + count++ + }) + + stream.write(undefined) + stream.write(undefined) + + assert.equal(count, 2) + + assert.end() +}) diff --git a/node_modules/tape/package.json b/node_modules/tape/package.json new file mode 100644 index 00000000..80d0cb10 --- /dev/null +++ b/node_modules/tape/package.json @@ -0,0 +1,93 @@ +{ + "name": "tape", + "version": "4.0.0", + "description": "tap-producing test harness for node and browsers", + "main": "index.js", + "bin": { + "tape": "./bin/tape" + }, + "directories": { + "example": "example", + "test": "test" + }, + "dependencies": { + "deep-equal": "~1.0.0", + "defined": "~0.0.0", + "glob": "~5.0.3", + "inherits": "~2.0.1", + "object-inspect": "~1.0.0", + "resumer": "~0.0.0", + "through": "~2.3.4" + }, + "devDependencies": { + "tap": "~0.7.1", + "falafel": "~1.0.1", + "concat-stream": "~1.4.1" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling": { + "files": "test/browser/*.js", + "browsers": [ + "ie/6..latest", + "chrome/20..latest", + "firefox/10..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6", + "ipad/6" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/tape.git" + }, + "homepage": "https://github.com/substack/tape", + "keywords": [ + "tap", + "test", + "harness", + "assert", + "browser" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "gitHead": "99f32f5e382f50ae2d9f9a5ddf469f23cc00dd93", + "bugs": { + "url": "https://github.com/substack/tape/issues" + }, + "_id": "tape@4.0.0", + "_shasum": "e7a5de356baa65691ab1abacd803f7370204e553", + "_from": "tape@4.0.0", + "_npmVersion": "2.6.1", + "_nodeVersion": "1.4.3", + "_npmUser": { + "name": "domenic", + "email": "domenic@domenicdenicola.com" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + }, + { + "name": "raynos", + "email": "raynos2@gmail.com" + }, + { + "name": "domenic", + "email": "d@domenic.me" + } + ], + "dist": { + "shasum": "e7a5de356baa65691ab1abacd803f7370204e553", + "tarball": "http://registry.npmjs.org/tape/-/tape-4.0.0.tgz" + }, + "_resolved": "https://registry.npmjs.org/tape/-/tape-4.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/tape/readme.markdown b/node_modules/tape/readme.markdown new file mode 100644 index 00000000..b5d5dad2 --- /dev/null +++ b/node_modules/tape/readme.markdown @@ -0,0 +1,332 @@ +# tape + +tap-producing test harness for node and browsers + +[![browser support](https://ci.testling.com/substack/tape.png)](http://ci.testling.com/substack/tape) + +[![build status](https://secure.travis-ci.org/substack/tape.png)](http://travis-ci.org/substack/tape) + +![tape](http://substack.net/images/tape_drive.png) + +# example + +``` js +var test = require('tape'); + +test('timing test', function (t) { + t.plan(2); + + t.equal(typeof Date.now, 'function'); + var start = Date.now(); + + setTimeout(function () { + t.equal(Date.now() - start, 100); + }, 100); +}); +``` + +``` +$ node example/timing.js +TAP version 13 +# timing test +ok 1 should be equal +not ok 2 should be equal + --- + operator: equal + expected: 100 + actual: 107 + ... + +1..2 +# tests 2 +# pass 1 +# fail 1 +``` + +# things that go well with tape + +tape maintains a fairly minimal core. Additional features are usually added by using another module alongside tape. + +## pretty reporters + +The default TAP output is good for machines and humans that are robots. + +If you want a more colorful / pretty output there are lots of modules on npm +that will output something pretty if you pipe TAP into them: + + - https://github.com/scottcorgan/tap-spec + - https://github.com/scottcorgan/tap-dot + - https://github.com/substack/faucet + - https://github.com/juliangruber/tap-bail + - https://github.com/kirbysayshi/tap-browser-color + - https://github.com/gummesson/tap-json + - https://github.com/gummesson/tap-min + - https://github.com/calvinmetcalf/tap-nyan + - https://www.npmjs.org/package/tap-pessimist + - https://github.com/toolness/tap-prettify + - https://github.com/shuhei/colortape + - https://github.com/aghassemi/tap-xunit + - https://github.com/namuol/tap-difflet + +To use them, try `node test/index.js | tap-spec` or pipe it into one +of the modules of your choice! + +## uncaught exceptions + +By default, uncaught exceptions in your tests will not be intercepted, and will cause tape to crash. If you find this behavior undesirable, use [tape-catch](https://github.com/michaelrhodes/tape-catch) to report any exceptions as TAP errors. + +## other + +- CoffeeScript support with https://www.npmjs.com/package/coffeetape +- Promise support with https://www.npmjs.com/package/blue-tape + +# methods + +The assertion methods in tape are heavily influenced or copied from the methods +in [node-tap](https://github.com/isaacs/node-tap). + +``` +var test = require('tape') +``` + +## test([name], [opts], cb) + +Create a new test with an optional `name` string and optional `opts` object. +`cb(t)` fires with the new test object `t` once all preceeding tests have +finished. Tests execute serially. + +Available `opts` options are: +- opts.skip = true/false. See test.skip. +- opts.timeout = 500. Set a timeout for the test, after which it will fail. + See test.timeoutAfter. + +If you forget to `t.plan()` out how many assertions you are going to run and you +don't call `t.end()` explicitly, your test will hang. + +## test.skip(name, cb) + +Generate a new test that will be skipped over. + +## t.plan(n) + +Declare that `n` assertions should be run. `t.end()` will be called +automatically after the `n`th assertion. If there are any more assertions after +the `n`th, or after `t.end()` is called, they will generate errors. + +## t.end(err) + +Declare the end of a test explicitly. If `err` is passed in `t.end` will assert +that it is falsey. + +## t.fail(msg) + +Generate a failing assertion with a message `msg`. + +## t.pass(msg) + +Generate a passing assertion with a message `msg`. + +## t.timeoutAfter(ms) + +Automatically timeout the test after X ms. + +## t.skip(msg) + +Generate an assertion that will be skipped over. + +## t.ok(value, msg) + +Assert that `value` is truthy with an optional description message `msg`. + +Aliases: `t.true()`, `t.assert()` + +## t.notOk(value, msg) + +Assert that `value` is falsy with an optional description message `msg`. + +Aliases: `t.false()`, `t.notok()` + +## t.error(err, msg) + +Assert that `err` is falsy. If `err` is non-falsy, use its `err.message` as the +description message. + +Aliases: `t.ifError()`, `t.ifErr()`, `t.iferror()` + +## t.equal(actual, expected, msg) + +Assert that `actual === expected` with an optional description `msg`. + +Aliases: `t.equals()`, `t.isEqual()`, `t.is()`, `t.strictEqual()`, +`t.strictEquals()` + +## t.notEqual(actual, expected, msg) + +Assert that `actual !== expected` with an optional description `msg`. + +Aliases: `t.notEquals()`, `t.notStrictEqual()`, `t.notStrictEquals()`, +`t.isNotEqual()`, `t.isNot()`, `t.not()`, `t.doesNotEqual()`, `t.isInequal()` + +## t.deepEqual(actual, expected, msg) + +Assert that `actual` and `expected` have the same structure and nested values using +[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) +with strict comparisons (`===`) on leaf nodes and an optional description +`msg`. + +Aliases: `t.deepEquals()`, `t.isEquivalent()`, `t.same()` + +## t.notDeepEqual(actual, expected, msg) + +Assert that `actual` and `expected` do not have the same structure and nested values using +[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) +with strict comparisons (`===`) on leaf nodes and an optional description +`msg`. + +Aliases: `t.notEquivalent()`, `t.notDeeply()`, `t.notSame()`, +`t.isNotDeepEqual()`, `t.isNotDeeply()`, `t.isNotEquivalent()`, +`t.isInequivalent()` + +## t.deepLooseEqual(actual, expected, msg) + +Assert that `actual` and `expected` have the same structure and nested values using +[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) +with loose comparisons (`==`) on leaf nodes and an optional description `msg`. + +Aliases: `t.looseEqual()`, `t.looseEquals()` + +## t.notDeepLooseEqual(actual, expected, msg) + +Assert that `actual` and `expected` do not have the same structure and nested values using +[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) +with loose comparisons (`==`) on leaf nodes and an optional description `msg`. + +Aliases: `t.notLooseEqual()`, `t.notLooseEquals()` + +## t.throws(fn, expected, msg) + +Assert that the function call `fn()` throws an exception. `expected`, if present, must be a `RegExp` or `Function`. + +## t.doesNotThrow(fn, expected, msg) + +Assert that the function call `fn()` does not throw an exception. + +## t.test(name, cb) + +Create a subtest with a new test handle `st` from `cb(st)` inside the current +test `t`. `cb(st)` will only fire when `t` finishes. Additional tests queued up +after `t` will not be run until all subtests finish. + +## var htest = test.createHarness() + +Create a new test harness instance, which is a function like `test()`, but with +a new pending stack and test state. + +By default the TAP output goes to `console.log()`. You can pipe the output to +someplace else if you `htest.createStream().pipe()` to a destination stream on +the first tick. + + +## test.comment(message) + +Print a message without breaking the tap output. (Useful when using e.g. `tap-colorize` where output is buffered & `console.log` will print in incorrect order vis-a-vis tap output.) + +## test.only(name, cb) + +Like `test(name, cb)` except if you use `.only` this is the only test case +that will run for the entire process, all other test cases using tape will +be ignored + +## var stream = test.createStream(opts) + +Create a stream of output, bypassing the default output stream that writes +messages to `console.log()`. By default `stream` will be a text stream of TAP +output, but you can get an object stream instead by setting `opts.objectMode` to +`true`. + +### tap stream reporter + +You can create your own custom test reporter using this `createStream()` api: + +``` js +var test = require('tape'); +var path = require('path'); + +test.createStream().pipe(process.stdout); + +process.argv.slice(2).forEach(function (file) { + require(path.resolve(file)); +}); +``` + +You could substitute `process.stdout` for whatever other output stream you want, +like a network connection or a file. + +Pass in test files to run as arguments: + +``` +$ node tap.js test/x.js test/y.js +TAP version 13 +# (anonymous) +not ok 1 should be equal + --- + operator: equal + expected: "boop" + actual: "beep" + ... +# (anonymous) +ok 2 should be equal +ok 3 (unnamed assert) +# wheee +ok 4 (unnamed assert) + +1..4 +# tests 4 +# pass 3 +# fail 1 +``` + +### object stream reporter + +Here's how you can render an object stream instead of TAP: + +``` js +var test = require('tape'); +var path = require('path'); + +test.createStream({ objectMode: true }).on('data', function (row) { + console.log(JSON.stringify(row)) +}); + +process.argv.slice(2).forEach(function (file) { + require(path.resolve(file)); +}); +``` + +The output for this runner is: + +``` +$ node object.js test/x.js test/y.js +{"type":"test","name":"(anonymous)","id":0} +{"id":0,"ok":false,"name":"should be equal","operator":"equal","actual":"beep","expected":"boop","error":{},"test":0,"type":"assert"} +{"type":"end","test":0} +{"type":"test","name":"(anonymous)","id":1} +{"id":0,"ok":true,"name":"should be equal","operator":"equal","actual":2,"expected":2,"test":1,"type":"assert"} +{"id":1,"ok":true,"name":"(unnamed assert)","operator":"ok","actual":true,"expected":true,"test":1,"type":"assert"} +{"type":"end","test":1} +{"type":"test","name":"wheee","id":2} +{"id":0,"ok":true,"name":"(unnamed assert)","operator":"ok","actual":true,"expected":true,"test":2,"type":"assert"} +{"type":"end","test":2} +``` + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install tape +``` + +# license + +MIT diff --git a/node_modules/tape/test/add-subtest-async.js b/node_modules/tape/test/add-subtest-async.js new file mode 100644 index 00000000..74b4d8a0 --- /dev/null +++ b/node_modules/tape/test/add-subtest-async.js @@ -0,0 +1,11 @@ +var test = require('../') + +test('parent', function (t) { + t.pass('parent'); + setTimeout(function () { + t.test('child', function (t) { + t.pass('child'); + t.end(); + }); + }, 100) +}) diff --git a/node_modules/tape/test/array.js b/node_modules/tape/test/array.js new file mode 100644 index 00000000..2d498632 --- /dev/null +++ b/node_modules/tape/test/array.js @@ -0,0 +1,68 @@ +var falafel = require('falafel'); +var tape = require('../'); +var tap = require('tap'); + +tap.test('array test', function (tt) { + tt.plan(1); + + var test = tape.createHarness(); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + tt.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: true, name: 'should be equivalent' }, + 'tests 5', + 'pass 5', + 'ok' + ]); + }); + + test.createStream().pipe(tc); + + test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); + }); +}); diff --git a/node_modules/tape/test/bound.js b/node_modules/tape/test/bound.js new file mode 100644 index 00000000..d3981954 --- /dev/null +++ b/node_modules/tape/test/bound.js @@ -0,0 +1,10 @@ +var test = require('../'); + +test('bind works', function (t) { + t.plan(2); + var equal = t.equal; + var deepEqual = t.deepEqual; + equal(3, 3); + deepEqual([4], [4]); + t.end(); +}); diff --git a/node_modules/tape/test/browser/asserts.js b/node_modules/tape/test/browser/asserts.js new file mode 100644 index 00000000..a1b24f6d --- /dev/null +++ b/node_modules/tape/test/browser/asserts.js @@ -0,0 +1,9 @@ +var test = require('../../'); + +test(function (t) { + t.plan(4); + t.ok(true); + t.equal(3, 1+2); + t.deepEqual([1,2,[3,4]], [1,2,[3,4]]); + t.notDeepEqual([1,2,[3,4,5]], [1,2,[3,4]]); +}); diff --git a/node_modules/tape/test/child_ordering.js b/node_modules/tape/test/child_ordering.js new file mode 100644 index 00000000..12efafe9 --- /dev/null +++ b/node_modules/tape/test/child_ordering.js @@ -0,0 +1,54 @@ +var test = require('../'); + +var childRan = false; + +test('parent', function(t) { + t.test('child', function(t) { + childRan = true; + t.pass('child ran'); + t.end(); + }); + t.end(); +}); + +test('uncle', function(t) { + t.ok(childRan, 'Child should run before next top-level test'); + t.end(); +}); + +var grandParentRan = false; +var parentRan = false; +var grandChildRan = false; +test('grandparent', function(t) { + t.ok(!grandParentRan, 'grand parent ran twice'); + grandParentRan = true; + t.test('parent', function(t) { + t.ok(!parentRan, 'parent ran twice'); + parentRan = true; + t.test('grandchild', function(t) { + t.ok(!grandChildRan, 'grand child ran twice'); + grandChildRan = true; + t.pass('grand child ran'); + t.end(); + }); + t.pass('parent ran'); + t.end(); + }); + t.test('other parent', function(t) { + t.ok(parentRan, 'first parent runs before second parent'); + t.ok(grandChildRan, 'grandchild runs before second parent'); + t.end(); + }); + t.pass('grandparent ran'); + t.end(); +}); + +test('second grandparent', function(t) { + t.ok(grandParentRan, 'grandparent ran'); + t.ok(parentRan, 'parent ran'); + t.ok(grandChildRan, 'grandchild ran'); + t.pass('other grandparent ran'); + t.end(); +}); + +// vim: set softtabstop=4 shiftwidth=4: diff --git a/node_modules/tape/test/circular-things.js b/node_modules/tape/test/circular-things.js new file mode 100644 index 00000000..1a0368d6 --- /dev/null +++ b/node_modules/tape/test/circular-things.js @@ -0,0 +1,43 @@ +var tape = require('../'); +var tap = require('tap'); + +tap.test('circular test', function (assert) { + var test = tape.createHarness({ exit : false }); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + // console.log("rs", rows) + + // console.log("deepEqual?") + + assert.same(rows, [ + "TAP version 13" + , "circular" + , { id: 1 + , ok: false + , name: " should be equal" + , operator: "equal" + , expected: "{}" + , actual: '{ circular: [Circular] }' + } + , "tests 1" + , "pass 0" + , "fail 1" + ]) + assert.end() + }) + + // tt.equal(10, 10) + // tt.end() + + test.createStream().pipe(tc); + + test("circular", function (t) { + t.plan(1) + var circular = {} + circular.circular = circular + t.equal(circular, {}) + }) +}) diff --git a/node_modules/tape/test/deep.js b/node_modules/tape/test/deep.js new file mode 100644 index 00000000..02f3681e --- /dev/null +++ b/node_modules/tape/test/deep.js @@ -0,0 +1,9 @@ +var test = require('../'); + +test('deep strict equal', function (t) { + t.notDeepEqual( + [ { a: '3' } ], + [ { a: 3 } ] + ); + t.end(); +}); diff --git a/node_modules/tape/test/double_end.js b/node_modules/tape/test/double_end.js new file mode 100644 index 00000000..c405d45e --- /dev/null +++ b/node_modules/tape/test/double_end.js @@ -0,0 +1,27 @@ +var test = require('tap').test; +var concat = require('concat-stream'); +var spawn = require('child_process').spawn; + +test(function (t) { + t.plan(2); + var ps = spawn(process.execPath, [ __dirname + '/double_end/double.js' ]); + ps.on('exit', function (code) { + t.equal(code, 1); + }); + ps.stdout.pipe(concat(function (body) { + t.equal(body.toString('utf8'), [ + 'TAP version 13', + '# double end', + 'ok 1 should be equal', + 'not ok 2 .end() called twice', + ' ---', + ' operator: fail', + ' ...', + '', + '1..2', + '# tests 2', + '# pass 1', + '# fail 1', + ].join('\n') + '\n\n'); + })); +}); diff --git a/node_modules/tape/test/double_end/double.js b/node_modules/tape/test/double_end/double.js new file mode 100644 index 00000000..44734824 --- /dev/null +++ b/node_modules/tape/test/double_end/double.js @@ -0,0 +1,9 @@ +var test = require('../../'); + +test('double end', function (t) { + t.equal(1 + 1, 2); + t.end(); + setTimeout(function () { + t.end(); + }, 5); +}); diff --git a/node_modules/tape/test/end-as-callback.js b/node_modules/tape/test/end-as-callback.js new file mode 100644 index 00000000..678ddf68 --- /dev/null +++ b/node_modules/tape/test/end-as-callback.js @@ -0,0 +1,65 @@ +var tap = require("tap"); +var tape = require("../"); + +tap.test("tape assert.end as callback", function (tt) { + var test = tape.createHarness({ exit: false }) + var tc = tap.createConsumer() + + var rows = [] + tc.on("data", function (r) { rows.push(r) }) + tc.on("end", function () { + var rs = rows.map(function (r) { + return r && typeof r === "object" ? + { id: r.id, ok: r.ok, name: r.name.trim() } : + r + }) + + tt.deepEqual(rs, [ + "TAP version 13", + "do a task and write", + { id: 1, ok: true, name: "null" }, + { id: 2, ok: true, name: "should be equal" }, + "do a task and write fail", + { id: 3, ok: true, name: "null" }, + { id: 4, ok: true, name: "should be equal" }, + { id: 5, ok: false, name: "Error: fail" }, + "tests 5", + "pass 4", + "fail 1" + ]) + + tt.end() + }) + + test.createStream().pipe(tc) + + test("do a task and write", function (assert) { + fakeAsyncTask("foo", function (err, value) { + assert.ifError(err) + assert.equal(value, "taskfoo") + + fakeAsyncWrite("bar", assert.end) + }) + }) + + test("do a task and write fail", function (assert) { + fakeAsyncTask("bar", function (err, value) { + assert.ifError(err) + assert.equal(value, "taskbar") + + fakeAsyncWriteFail("baz", assert.end) + }) + }) +}) + +function fakeAsyncTask(name, cb) { + cb(null, "task" + name) +} + +function fakeAsyncWrite(name, cb) { + cb(null) +} + +function fakeAsyncWriteFail(name, cb) { + cb(new Error("fail")) +} diff --git a/node_modules/tape/test/exit.js b/node_modules/tape/test/exit.js new file mode 100644 index 00000000..7f7c5d01 --- /dev/null +++ b/node_modules/tape/test/exit.js @@ -0,0 +1,142 @@ +var tap = require('tap'); +var spawn = require('child_process').spawn; + +tap.test('exit ok', function (t) { + t.plan(2); + + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + t.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: true, name: 'should be equivalent' }, + 'tests 5', + 'pass 5', + 'ok' + ]); + }); + + var ps = spawn(process.execPath, [ __dirname + '/exit/ok.js' ]); + ps.stdout.pipe(tc); + ps.on('exit', function (code) { + t.equal(code, 0); + }); +}); + +tap.test('exit fail', function (t) { + t.plan(2); + + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + t.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: false, name: 'should be equivalent' }, + 'tests 5', + 'pass 4', + 'fail 1' + ]); + }); + + var ps = spawn(process.execPath, [ __dirname + '/exit/fail.js' ]); + ps.stdout.pipe(tc); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); +}); + +tap.test('too few exit', function (t) { + t.plan(2); + + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + t.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: true, name: 'should be equivalent' }, + { id: 6, ok: false, name: 'plan != count' }, + 'tests 6', + 'pass 5', + 'fail 1' + ]); + }); + + var ps = spawn(process.execPath, [ __dirname + '/exit/too_few.js' ]); + ps.stdout.pipe(tc); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); +}); + +tap.test('more planned in a second test', function (t) { + t.plan(2); + + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + t.same(rs, [ + 'TAP version 13', + 'first', + { id: 1, ok: true, name: '(unnamed assert)' }, + 'second', + { id: 2, ok: true, name: '(unnamed assert)' }, + { id: 3, ok: false, name: 'plan != count' }, + 'tests 3', + 'pass 2', + 'fail 1' + ]); + }); + + var ps = spawn(process.execPath, [ __dirname + '/exit/second.js' ]); + ps.stdout.pipe(tc); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); +}); diff --git a/node_modules/tape/test/exit/fail.js b/node_modules/tape/test/exit/fail.js new file mode 100644 index 00000000..d7fd3ce7 --- /dev/null +++ b/node_modules/tape/test/exit/fail.js @@ -0,0 +1,35 @@ +var test = require('../../'); +var falafel = require('falafel'); + +test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]); + } + ); +}); diff --git a/node_modules/tape/test/exit/ok.js b/node_modules/tape/test/exit/ok.js new file mode 100644 index 00000000..a02c7b69 --- /dev/null +++ b/node_modules/tape/test/exit/ok.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../../'); + +test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); diff --git a/node_modules/tape/test/exit/second.js b/node_modules/tape/test/exit/second.js new file mode 100644 index 00000000..8a206bb3 --- /dev/null +++ b/node_modules/tape/test/exit/second.js @@ -0,0 +1,11 @@ +var test = require('../../'); + +test('first', function (t) { + t.plan(1); + t.ok(true); +}); + +test('second', function (t) { + t.plan(2); + t.ok(true); +}); diff --git a/node_modules/tape/test/exit/too_few.js b/node_modules/tape/test/exit/too_few.js new file mode 100644 index 00000000..8e60ce5b --- /dev/null +++ b/node_modules/tape/test/exit/too_few.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../../'); + +test('array', function (t) { + t.plan(6); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); diff --git a/node_modules/tape/test/fail.js b/node_modules/tape/test/fail.js new file mode 100644 index 00000000..d56045ad --- /dev/null +++ b/node_modules/tape/test/fail.js @@ -0,0 +1,68 @@ +var falafel = require('falafel'); +var tape = require('../'); +var tap = require('tap'); + +tap.test('array test', function (tt) { + tt.plan(1); + + var test = tape.createHarness({ exit : false }); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + tt.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: false, name: 'should be equivalent' }, + 'tests 5', + 'pass 4', + 'fail 1' + ]); + }); + + test.createStream().pipe(tc); + + test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]); + } + ); + }); +}); diff --git a/node_modules/tape/test/many.js b/node_modules/tape/test/many.js new file mode 100644 index 00000000..10556e55 --- /dev/null +++ b/node_modules/tape/test/many.js @@ -0,0 +1,8 @@ +var test = require('../'); + +test('many tests', function (t) { + t.plan(100); + for (var i = 0; i < 100; i++) { + setTimeout(function () { t.pass() }, Math.random() * 50); + } +}); diff --git a/node_modules/tape/test/max_listeners.js b/node_modules/tape/test/max_listeners.js new file mode 100644 index 00000000..5edfb153 --- /dev/null +++ b/node_modules/tape/test/max_listeners.js @@ -0,0 +1,7 @@ +var spawn = require('child_process').spawn; +var ps = spawn(process.execPath, [ __dirname + '/max_listeners/source.js' ]); +ps.stdout.pipe(process.stdout, { end : false }); + +ps.stderr.on('data', function (buf) { + console.log('not ok ' + buf); +}); diff --git a/node_modules/tape/test/max_listeners/source.js b/node_modules/tape/test/max_listeners/source.js new file mode 100644 index 00000000..839a3275 --- /dev/null +++ b/node_modules/tape/test/max_listeners/source.js @@ -0,0 +1,5 @@ +var test = require('../../'); + +for (var i = 0; i < 11; i ++) { + test(function (t) { t.end() }); +} diff --git a/node_modules/tape/test/nested-async-plan-noend.js b/node_modules/tape/test/nested-async-plan-noend.js new file mode 100644 index 00000000..6f8cfdd0 --- /dev/null +++ b/node_modules/tape/test/nested-async-plan-noend.js @@ -0,0 +1,36 @@ +var test = require('../'); + +test('Harness async test support', function(t) { + t.plan(3); + + t.ok(true, 'sync child A'); + + t.test('sync child B', function(tt) { + tt.plan(2); + + setTimeout(function(){ + tt.test('async grandchild A', function(ttt) { + ttt.plan(1); + ttt.ok(true); + }); + }, 50); + + setTimeout(function() { + tt.test('async grandchild B', function(ttt) { + ttt.plan(1); + ttt.ok(true); + }); + }, 100); + }); + + setTimeout(function() { + t.test('async child', function(tt) { + tt.plan(2); + tt.ok(true, 'sync grandchild in async child A'); + tt.test('sync grandchild in async child B', function(ttt) { + ttt.plan(1); + ttt.ok(true); + }); + }); + }, 200); +}); diff --git a/node_modules/tape/test/nested-sync-noplan-noend.js b/node_modules/tape/test/nested-sync-noplan-noend.js new file mode 100644 index 00000000..a206c501 --- /dev/null +++ b/node_modules/tape/test/nested-sync-noplan-noend.js @@ -0,0 +1,50 @@ +var tape = require('../'); +var tap = require('tap'); + +tap.test('nested sync test without plan or end', function (tt) { + tt.plan(1); + + var test = tape.createHarness(); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + var expected = [ + 'TAP version 13', + 'nested without plan or end', + 'first', + { id: 1, ok: true, name: '(unnamed assert)' }, + 'second', + { id: 2, ok: true, name: '(unnamed assert)' }, + 'tests 2', + 'pass 2', + 'ok' + ] + tt.same(rs, expected); + }); + + test.createStream().pipe(tc); + + test('nested without plan or end', function(t) { + t.test('first', function(q) { + setTimeout(function first() { + q.ok(true); + q.end() + }, 10); + }); + t.test('second', function(q) { + setTimeout(function second() { + q.ok(true); + q.end() + }, 10); + }); + }); + +}); diff --git a/node_modules/tape/test/nested.js b/node_modules/tape/test/nested.js new file mode 100644 index 00000000..673465d4 --- /dev/null +++ b/node_modules/tape/test/nested.js @@ -0,0 +1,89 @@ +var falafel = require('falafel'); +var tape = require('../'); +var tap = require('tap'); + +tap.test('array test', function (tt) { + tt.plan(1); + + var test = tape.createHarness(); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + tt.same(rs, [ + 'TAP version 13', + 'nested array test', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: true, name: 'should be equivalent' }, + 'inside test', + { id: 6, ok: true, name: '(unnamed assert)' }, + { id: 7, ok: true, name: '(unnamed assert)' }, + 'another', + { id: 8, ok: true, name: '(unnamed assert)' }, + 'tests 8', + 'pass 8', + 'ok' + ]); + }); + + test.createStream().pipe(tc); + + test('nested array test', function (t) { + t.plan(6); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + t.test('inside test', function (q) { + q.plan(2); + q.ok(true); + + setTimeout(function () { + q.ok(true); + }, 100); + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); + }); + + test('another', function (t) { + t.plan(1); + setTimeout(function () { + t.ok(true); + }, 50); + }); +}); diff --git a/node_modules/tape/test/nested2.js b/node_modules/tape/test/nested2.js new file mode 100644 index 00000000..58ae8f3d --- /dev/null +++ b/node_modules/tape/test/nested2.js @@ -0,0 +1,19 @@ +var test = require('../'); + +test(function(t) { + var i = 0 + t.test('setup', function(t) { + process.nextTick(function() { + t.equal(i, 0, 'called once') + i++ + t.end() + }) + }) + + + t.test('teardown', function(t) { + t.end() + }) + + t.end() +}) diff --git a/node_modules/tape/test/no_callback.js b/node_modules/tape/test/no_callback.js new file mode 100644 index 00000000..760ff26c --- /dev/null +++ b/node_modules/tape/test/no_callback.js @@ -0,0 +1,3 @@ +var test = require('../'); + +test('No callback.'); diff --git a/node_modules/tape/test/only.js b/node_modules/tape/test/only.js new file mode 100644 index 00000000..9e6bc26f --- /dev/null +++ b/node_modules/tape/test/only.js @@ -0,0 +1,53 @@ +var tap = require('tap'); +var tape = require('../'); + +tap.test('tape only test', function (tt) { + var test = tape.createHarness({ exit: false }); + var tc = tap.createConsumer(); + var ran = []; + + var rows = [] + tc.on('data', function (r) { rows.push(r) }) + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id: r.id, ok: r.ok, name: r.name.trim() }; + } + else { + return r; + } + }) + + tt.deepEqual(rs, [ + 'TAP version 13', + 'run success', + { id: 1, ok: true, name: 'assert name'}, + 'tests 1', + 'pass 1', + 'ok' + ]) + tt.deepEqual(ran, [ 3 ]); + + tt.end() + }) + + test.createStream().pipe(tc) + + test("never run fail", function (t) { + ran.push(1); + t.equal(true, false) + t.end() + }) + + test("never run success", function (t) { + ran.push(2); + t.equal(true, true) + t.end() + }) + + test.only("run success", function (t) { + ran.push(3); + t.ok(true, "assert name") + t.end() + }) +}) diff --git a/node_modules/tape/test/only2.js b/node_modules/tape/test/only2.js new file mode 100644 index 00000000..fcf4f439 --- /dev/null +++ b/node_modules/tape/test/only2.js @@ -0,0 +1,9 @@ +var test = require('../'); + +test('only2 test 1', function (t) { + t.end(); +}); + +test.only('only2 test 2', function (t) { + t.end(); +}); diff --git a/node_modules/tape/test/only3.js b/node_modules/tape/test/only3.js new file mode 100644 index 00000000..b192a4e0 --- /dev/null +++ b/node_modules/tape/test/only3.js @@ -0,0 +1,15 @@ +var test = require('../'); + +test('only3 test 1', function (t) { + t.fail('not 1'); + t.end(); +}); + +test.only('only3 test 2', function (t) { + t.end(); +}); + +test('only3 test 3', function (t) { + t.fail('not 3'); + t.end(); +}); diff --git a/node_modules/tape/test/order.js b/node_modules/tape/test/order.js new file mode 100644 index 00000000..02aaa055 --- /dev/null +++ b/node_modules/tape/test/order.js @@ -0,0 +1,17 @@ +var test = require('../'); +var current = 0; + +test(function (t) { + t.equal(current++, 0); + t.end(); +}); +test(function (t) { + t.plan(1); + setTimeout(function () { + t.equal(current++, 1); + }, 100); +}); +test(function (t) { + t.equal(current++, 2); + t.end(); +}); diff --git a/node_modules/tape/test/plan_optional.js b/node_modules/tape/test/plan_optional.js new file mode 100644 index 00000000..a092eab2 --- /dev/null +++ b/node_modules/tape/test/plan_optional.js @@ -0,0 +1,15 @@ +var test = require('../'); + +test('plan should be optional', function (t) { + t.pass('no plan here'); + t.end(); +}); + +test('no plan async', function (t) { + setTimeout(function() { + t.pass('ok'); + t.end(); + }, 100); +}); + +// vim: set softtabstop=4 shiftwidth=4: diff --git a/node_modules/tape/test/skip.js b/node_modules/tape/test/skip.js new file mode 100644 index 00000000..7b23126c --- /dev/null +++ b/node_modules/tape/test/skip.js @@ -0,0 +1,41 @@ +var test = require('../'); +var ran = 0; + +test('do not skip this', { skip: false }, function(t) { + t.pass('this should run'); + ran ++; + t.end(); +}); + +test('skip this', { skip: true }, function(t) { + t.fail('this should not even run'); + ran++; + t.end(); +}); + +test.skip('skip this too', function(t) { + t.fail('this should not even run'); + ran++; + t.end(); +}); + +test('skip subtest', function(t) { + ran ++; + t.test('do not skip this', { skip: false }, function(t) { + ran ++; + t.pass('this should run'); + t.end(); + }); + t.test('skip this', { skip: true }, function(t) { + t.fail('this should not even run'); + t.end(); + }); + t.end(); +}); + +test('right number of tests ran', function(t) { + t.equal(ran, 3, 'ran the right number of tests'); + t.end(); +}); + +// vim: set softtabstop=4 shiftwidth=4: diff --git a/node_modules/tape/test/subcount.js b/node_modules/tape/test/subcount.js new file mode 100644 index 00000000..3a5df3fb --- /dev/null +++ b/node_modules/tape/test/subcount.js @@ -0,0 +1,14 @@ +var test = require('../'); + +test('parent test', function (t) { + t.plan(2); + t.test('first child', function (t) { + t.plan(1); + t.pass('pass first child'); + }) + + t.test(function (t) { + t.plan(1); + t.pass('pass second child'); + }) +}) diff --git a/node_modules/tape/test/subtest_and_async.js b/node_modules/tape/test/subtest_and_async.js new file mode 100644 index 00000000..719dbf5b --- /dev/null +++ b/node_modules/tape/test/subtest_and_async.js @@ -0,0 +1,23 @@ +var test = require('../'); + +var asyncFunction = function (callback) { + setTimeout(callback, Math.random * 50); +}; + +test('master test', function (t) { + t.test('subtest 1', function (t) { + t.pass('subtest 1 before async call'); + asyncFunction(function () { + t.pass('subtest 1 in async callback'); + t.end(); + }) + }); + + t.test('subtest 2', function (t) { + t.pass('subtest 2 before async call'); + asyncFunction(function () { + t.pass('subtest 2 in async callback'); + t.end(); + }) + }); +}); diff --git a/node_modules/tape/test/subtest_plan.js b/node_modules/tape/test/subtest_plan.js new file mode 100644 index 00000000..2b075ae5 --- /dev/null +++ b/node_modules/tape/test/subtest_plan.js @@ -0,0 +1,21 @@ +var test = require('../'); + +test('parent', function (t) { + t.plan(3) + + var firstChildRan = false; + + t.pass('assertion in parent'); + + t.test('first child', function (t) { + t.plan(1); + t.pass('pass first child'); + firstChildRan = true; + }); + + t.test('second child', function (t) { + t.plan(2); + t.ok(firstChildRan, 'first child ran first'); + t.pass('pass second child'); + }); +}); diff --git a/node_modules/tape/test/throws.js b/node_modules/tape/test/throws.js new file mode 100644 index 00000000..ec91fb8d --- /dev/null +++ b/node_modules/tape/test/throws.js @@ -0,0 +1,20 @@ +var test = require('../'); + +function fn() { + throw new TypeError('RegExp'); +} + +test('throws', function (t) { + t.throws(fn); + t.end(); +}); + +test('throws (RegExp match)', function (t) { + t.throws(fn, /RegExp/); + t.end(); +}); + +test('throws (Function match)', function (t) { + t.throws(fn, TypeError); + t.end(); +}); diff --git a/node_modules/tape/test/timeoutAfter.js b/node_modules/tape/test/timeoutAfter.js new file mode 100644 index 00000000..bd2a4f1b --- /dev/null +++ b/node_modules/tape/test/timeoutAfter.js @@ -0,0 +1,35 @@ +var tape = require('../'); +var tap = require('tap'); + +tap.test('timeoutAfter test', function (tt) { + tt.plan(1); + + var test = tape.createHarness(); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + tt.same(rs, [ + 'TAP version 13', + 'timeoutAfter', + { id: 1, ok: false, name: 'test timed out after 1ms' }, + 'tests 1', + 'pass 0', + 'fail 1' + ]); + }); + + test.createStream().pipe(tc); + + test('timeoutAfter', function (t) { + t.plan(1); + t.timeoutAfter(1); + }); +}); diff --git a/node_modules/tape/test/too_many.js b/node_modules/tape/test/too_many.js new file mode 100644 index 00000000..b5c38819 --- /dev/null +++ b/node_modules/tape/test/too_many.js @@ -0,0 +1,69 @@ +var falafel = require('falafel'); +var tape = require('../'); +var tap = require('tap'); + +tap.test('array test', function (tt) { + tt.plan(1); + + var test = tape.createHarness({ exit : false }); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + tt.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: false, name: 'plan != count' }, + { id: 6, ok: true, name: 'should be equivalent' }, + 'tests 6', + 'pass 5', + 'fail 1' + ]); + }); + + test.createStream().pipe(tc); + + test('array', function (t) { + t.plan(3); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); + }); +}); diff --git a/node_modules/tape/test/undef.js b/node_modules/tape/test/undef.js new file mode 100644 index 00000000..e856a54b --- /dev/null +++ b/node_modules/tape/test/undef.js @@ -0,0 +1,32 @@ +var tape = require('../'); +var tap = require('tap'); +var concat = require('concat-stream'); + +tap.test('array test', function (tt) { + tt.plan(1); + + var test = tape.createHarness(); + test.createStream().pipe(concat(function (body) { + tt.equal( + body.toString('utf8'), + 'TAP version 13\n' + + '# undef\n' + + 'not ok 1 should be equivalent\n' + + ' ---\n' + + ' operator: deepEqual\n' + + ' expected: { beep: undefined }\n' + + ' actual: {}\n' + + ' ...\n' + + '\n' + + '1..1\n' + + '# tests 1\n' + + '# pass 0\n' + + '# fail 1\n' + ); + })); + + test('undef', function (t) { + t.plan(1); + t.deepEqual({}, { beep: undefined }); + }); +}); diff --git a/node_modules/ws/.npmignore b/node_modules/ws/.npmignore new file mode 100644 index 00000000..1eba800f --- /dev/null +++ b/node_modules/ws/.npmignore @@ -0,0 +1,11 @@ +npm-debug.log +node_modules +.*.swp +.lock-* +build + +bench +doc +examples +test + diff --git a/node_modules/ws/.travis.yml b/node_modules/ws/.travis.yml new file mode 100644 index 00000000..97358668 --- /dev/null +++ b/node_modules/ws/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +npm_args: --ws:native +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/ws/Makefile b/node_modules/ws/Makefile new file mode 100644 index 00000000..00f19fa0 --- /dev/null +++ b/node_modules/ws/Makefile @@ -0,0 +1,40 @@ +ALL_TESTS = $(shell find test/ -name '*.test.js') +ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') + +all: + node-gyp configure build + +clean: + node-gyp clean + +run-tests: + @./node_modules/.bin/mocha \ + -t 5000 \ + -s 2400 \ + $(TESTFLAGS) \ + $(TESTS) + +run-integrationtests: + @./node_modules/.bin/mocha \ + -t 5000 \ + -s 6000 \ + $(TESTFLAGS) \ + $(TESTS) + +test: + @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests + +integrationtest: + @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests + +benchmark: + @node bench/sender.benchmark.js + @node bench/parser.benchmark.js + +autobahn: + @NODE_PATH=lib node test/autobahn.js + +autobahn-server: + @NODE_PATH=lib node test/autobahn-server.js + +.PHONY: test diff --git a/node_modules/ws/README.md b/node_modules/ws/README.md new file mode 100644 index 00000000..fef2fe66 --- /dev/null +++ b/node_modules/ws/README.md @@ -0,0 +1,187 @@ +# ws: a node.js websocket library + +[![Build Status](https://travis-ci.org/einaros/ws.svg?branch=master)](https://travis-ci.org/einaros/ws) + +`ws` is a simple to use WebSocket implementation, up-to-date against RFC-6455, +and [probably the fastest WebSocket library for node.js][archive]. + +Passes the quite extensive Autobahn test suite. See http://einaros.github.com/ws +for the full reports. + +## Protocol support + +* **Hixie draft 76** (Old and deprecated, but still in use by Safari and Opera. + Added to ws version 0.4.2, but server only. Can be disabled by setting the + `disableHixie` option to true.) +* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) +* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`) + +### Installing + +``` +npm install --save ws +``` + +### Sending and receiving text data + +```js +var WebSocket = require('ws'); +var ws = new WebSocket('ws://www.host.com/path'); + +ws.on('open', function open() { + ws.send('something'); +}); + +ws.on('message', function(data, flags) { + // flags.binary will be set if a binary data is received. + // flags.masked will be set if the data was masked. +}); +``` + +### Sending binary data + +```js +var WebSocket = require('ws'); +var ws = new WebSocket('ws://www.host.com/path'); + +ws.on('open', function open() { + var array = new Float32Array(5); + + for (var i = 0; i < array.length; ++i) { + array[i] = i / 2; + } + + ws.send(array, { binary: true, mask: true }); +}); +``` + +Setting `mask`, as done for the send options above, will cause the data to be +masked according to the WebSocket protocol. The same option applies for text +data. + +### Server example + +```js +var WebSocketServer = require('ws').Server + , wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('message', function incoming(message) { + console.log('received: %s', message); + }); + + ws.send('something'); +}); +``` + +### Server sending broadcast data + +```js +var WebSocketServer = require('ws').Server + , wss = new WebSocketServer({ port: 8080 }); + +wss.broadcast = function broadcast(data) { + wss.clients.forEach(function each(client) { + client.send(data); + }); +}; +``` + +### Error handling best practices + +```js +// If the WebSocket is closed before the following send is attempted +ws.send('something'); + +// Errors (both immediate and async write errors) can be detected in an optional +// callback. The callback is also the only way of being notified that data has +// actually been sent. +ws.send('something', function ack(error) { + // if error is not defined, the send has been completed, + // otherwise the error object will indicate what failed. +}); + +// Immediate errors can also be handled with try/catch-blocks, but **note** that +// since sends are inherently asynchronous, socket write failures will *not* be +// captured when this technique is used. +try { ws.send('something'); } +catch (e) { /* handle error */ } +``` + +### echo.websocket.org demo + +```js +var WebSocket = require('ws'); +var ws = new WebSocket('ws://echo.websocket.org/', { + protocolVersion: 8, + origin: 'http://websocket.org' +}); + +ws.on('open', function open() { + console.log('connected'); + ws.send(Date.now().toString(), {mask: true}); +}); + +ws.on('close', function close() { + console.log('disconnected'); +}); + +ws.on('message', function message(data, flags) { + console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags); + + setTimeout(function timeout() { + ws.send(Date.now().toString(), {mask: true}); + }, 500); +}); +``` + +### Other examples + +For a full example with a browser client communicating with a ws server, see the +examples folder. + +Note that the usage together with Express 3.0 is quite different from Express +2.x. The difference is expressed in the two different serverstats-examples. + +Otherwise, see the test cases. + +### Running the tests + +``` +make test +``` + +## API Docs + +See the doc/ directory for Node.js-like docs for the ws classes. + +## Changelog + +We're using the GitHub `releases` for changelog entries. + +## License + +(The MIT License) + +Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com> + +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. + +[archive]: http://web.archive.org/web/20130314230536/http://hobbycoding.posterous.com/the-fastest-websocket-module-for-nodejs diff --git a/node_modules/ws/index.js b/node_modules/ws/index.js new file mode 100644 index 00000000..a7e8644b --- /dev/null +++ b/node_modules/ws/index.js @@ -0,0 +1,49 @@ +'use strict'; + +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var WS = module.exports = require('./lib/WebSocket'); + +WS.Server = require('./lib/WebSocketServer'); +WS.Sender = require('./lib/Sender'); +WS.Receiver = require('./lib/Receiver'); + +/** + * Create a new WebSocket server. + * + * @param {Object} options Server options + * @param {Function} fn Optional connection listener. + * @returns {WS.Server} + * @api public + */ +WS.createServer = function createServer(options, fn) { + var server = new WS.Server(options); + + if (typeof fn === 'function') { + server.on('connection', fn); + } + + return server; +}; + +/** + * Create a new WebSocket connection. + * + * @param {String} address The URL/address we need to connect to. + * @param {Function} fn Open listener. + * @returns {WS} + * @api public + */ +WS.connect = WS.createConnection = function connect(address, fn) { + var client = new WS(address); + + if (typeof fn === 'function') { + client.on('open', fn); + } + + return client; +}; diff --git a/node_modules/ws/lib/BufferPool.js b/node_modules/ws/lib/BufferPool.js new file mode 100644 index 00000000..faf8637c --- /dev/null +++ b/node_modules/ws/lib/BufferPool.js @@ -0,0 +1,59 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util'); + +function BufferPool(initialSize, growStrategy, shrinkStrategy) { + if (typeof initialSize === 'function') { + shrinkStrategy = growStrategy; + growStrategy = initialSize; + initialSize = 0; + } + else if (typeof initialSize === 'undefined') { + initialSize = 0; + } + this._growStrategy = (growStrategy || function(db, size) { + return db.used + size; + }).bind(null, this); + this._shrinkStrategy = (shrinkStrategy || function(db) { + return initialSize; + }).bind(null, this); + this._buffer = initialSize ? new Buffer(initialSize) : null; + this._offset = 0; + this._used = 0; + this._changeFactor = 0; + this.__defineGetter__('size', function(){ + return this._buffer == null ? 0 : this._buffer.length; + }); + this.__defineGetter__('used', function(){ + return this._used; + }); +} + +BufferPool.prototype.get = function(length) { + if (this._buffer == null || this._offset + length > this._buffer.length) { + var newBuf = new Buffer(this._growStrategy(length)); + this._buffer = newBuf; + this._offset = 0; + } + this._used += length; + var buf = this._buffer.slice(this._offset, this._offset + length); + this._offset += length; + return buf; +} + +BufferPool.prototype.reset = function(forceNewBuffer) { + var len = this._shrinkStrategy(); + if (len < this.size) this._changeFactor -= 1; + if (forceNewBuffer || this._changeFactor < -2) { + this._changeFactor = 0; + this._buffer = len ? new Buffer(len) : null; + } + this._offset = 0; + this._used = 0; +} + +module.exports = BufferPool; diff --git a/node_modules/ws/lib/BufferUtil.fallback.js b/node_modules/ws/lib/BufferUtil.fallback.js new file mode 100644 index 00000000..508542c9 --- /dev/null +++ b/node_modules/ws/lib/BufferUtil.fallback.js @@ -0,0 +1,47 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.BufferUtil = { + merge: function(mergedBuffer, buffers) { + var offset = 0; + for (var i = 0, l = buffers.length; i < l; ++i) { + var buf = buffers[i]; + buf.copy(mergedBuffer, offset); + offset += buf.length; + } + }, + mask: function(source, mask, output, offset, length) { + var maskNum = mask.readUInt32LE(0, true); + var i = 0; + for (; i < length - 3; i += 4) { + var num = maskNum ^ source.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + output.writeUInt32LE(num, offset + i, true); + } + switch (length % 4) { + case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; + case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; + case 1: output[offset + i] = source[i] ^ mask[0]; + case 0:; + } + }, + unmask: function(data, mask) { + var maskNum = mask.readUInt32LE(0, true); + var length = data.length; + var i = 0; + for (; i < length - 3; i += 4) { + var num = maskNum ^ data.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + data.writeUInt32LE(num, i, true); + } + switch (length % 4) { + case 3: data[i + 2] = data[i + 2] ^ mask[2]; + case 2: data[i + 1] = data[i + 1] ^ mask[1]; + case 1: data[i] = data[i] ^ mask[0]; + case 0:; + } + } +} diff --git a/node_modules/ws/lib/BufferUtil.js b/node_modules/ws/lib/BufferUtil.js new file mode 100644 index 00000000..18c69989 --- /dev/null +++ b/node_modules/ws/lib/BufferUtil.js @@ -0,0 +1,13 @@ +'use strict'; + +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +try { + module.exports = require('bufferutil'); +} catch (e) { + module.exports = require('./BufferUtil.fallback'); +} diff --git a/node_modules/ws/lib/ErrorCodes.js b/node_modules/ws/lib/ErrorCodes.js new file mode 100644 index 00000000..55ebd529 --- /dev/null +++ b/node_modules/ws/lib/ErrorCodes.js @@ -0,0 +1,24 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports = { + isValidErrorCode: function(code) { + return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || + (code >= 3000 && code <= 4999); + }, + 1000: 'normal', + 1001: 'going away', + 1002: 'protocol error', + 1003: 'unsupported data', + 1004: 'reserved', + 1005: 'reserved for extensions', + 1006: 'reserved for extensions', + 1007: 'inconsistent or invalid data', + 1008: 'policy violation', + 1009: 'message too big', + 1010: 'extension handshake missing', + 1011: 'an unexpected condition prevented the request from being fulfilled', +}; \ No newline at end of file diff --git a/node_modules/ws/lib/Extensions.js b/node_modules/ws/lib/Extensions.js new file mode 100644 index 00000000..a465ace2 --- /dev/null +++ b/node_modules/ws/lib/Extensions.js @@ -0,0 +1,70 @@ + +var util = require('util'); + +/** + * Module exports. + */ + +exports.parse = parse; +exports.format = format; + +/** + * Parse extensions header value + */ + +function parse(value) { + value = value || ''; + + var extensions = {}; + + value.split(',').forEach(function(v) { + var params = v.split(';'); + var token = params.shift().trim(); + var paramsList = extensions[token] = extensions[token] || []; + var parsedParams = {}; + + params.forEach(function(param) { + var parts = param.trim().split('='); + var key = parts[0]; + var value = parts[1]; + if (typeof value === 'undefined') { + value = true; + } else { + // unquote value + if (value[0] === '"') { + value = value.slice(1); + } + if (value[value.length - 1] === '"') { + value = value.slice(0, value.length - 1); + } + } + (parsedParams[key] = parsedParams[key] || []).push(value); + }); + + paramsList.push(parsedParams); + }); + + return extensions; +} + +/** + * Format extensions header value + */ + +function format(value) { + return Object.keys(value).map(function(token) { + var paramsList = value[token]; + if (!util.isArray(paramsList)) { + paramsList = [paramsList]; + } + return paramsList.map(function(params) { + return [token].concat(Object.keys(params).map(function(k) { + var p = params[k]; + if (!util.isArray(p)) p = [p]; + return p.map(function(v) { + return v === true ? k : k + '=' + v; + }).join('; '); + })).join('; '); + }).join(', '); + }).join(', '); +} diff --git a/node_modules/ws/lib/PerMessageDeflate.js b/node_modules/ws/lib/PerMessageDeflate.js new file mode 100644 index 00000000..f7359779 --- /dev/null +++ b/node_modules/ws/lib/PerMessageDeflate.js @@ -0,0 +1,289 @@ + +var zlib = require('zlib'); + +var AVAILABLE_WINDOW_BITS = [8, 9, 10, 11, 12, 13, 14, 15]; +var DEFAULT_WINDOW_BITS = 15; +var DEFAULT_MEM_LEVEL = 8; + +PerMessageDeflate.extensionName = 'permessage-deflate'; + +/** + * Per-message Compression Extensions implementation + */ + +function PerMessageDeflate(options, isServer) { + this._options = options || {}; + this._isServer = !!isServer; + this._inflate = null; + this._deflate = null; + this.params = null; +} + +/** + * Create extension parameters offer + * + * @api public + */ + +PerMessageDeflate.prototype.offer = function() { + var params = {}; + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + return params; +}; + +/** + * Accept extension offer + * + * @api public + */ + +PerMessageDeflate.prototype.accept = function(paramsList) { + paramsList = this.normalizeParams(paramsList); + + var params; + if (this._isServer) { + params = this.acceptAsServer(paramsList); + } else { + params = this.acceptAsClient(paramsList); + } + + this.params = params; + return params; +}; + +/** + * Accept extension offer from client + * + * @api private + */ + +PerMessageDeflate.prototype.acceptAsServer = function(paramsList) { + var accepted = {}; + var result = paramsList.some(function(params) { + accepted = {}; + if (this._options.serverNoContextTakeover === false && params.server_no_context_takeover) { + return; + } + if (this._options.serverMaxWindowBits === false && params.server_max_window_bits) { + return; + } + if (typeof this._options.serverMaxWindowBits === 'number' && + typeof params.server_max_window_bits === 'number' && + this._options.serverMaxWindowBits > params.server_max_window_bits) { + return; + } + if (typeof this._options.clientMaxWindowBits === 'number' && !params.client_max_window_bits) { + return; + } + + if (this._options.serverNoContextTakeover || params.server_no_context_takeover) { + accepted.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover !== false && params.client_no_context_takeover) { + accepted.client_no_context_takeover = true; + } + if (typeof this._options.serverMaxWindowBits === 'number') { + accepted.server_max_window_bits = this._options.serverMaxWindowBits; + } else if (typeof params.server_max_window_bits === 'number') { + accepted.server_max_window_bits = params.server_max_window_bits; + } + if (typeof this._options.clientMaxWindowBits === 'number') { + accepted.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits !== false && typeof params.client_max_window_bits === 'number') { + accepted.client_max_window_bits = params.client_max_window_bits; + } + return true; + }, this); + + if (!result) { + throw new Error('Doesn\'t support the offered configuration'); + } + + return accepted; +}; + +/** + * Accept extension response from server + * + * @api privaye + */ + +PerMessageDeflate.prototype.acceptAsClient = function(paramsList) { + var params = paramsList[0]; + if (this._options.clientNoContextTakeover != null) { + if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) { + throw new Error('Invalid value for "client_no_context_takeover"'); + } + } + if (this._options.clientMaxWindowBits != null) { + if (this._options.clientMaxWindowBits === false && params.client_max_window_bits) { + throw new Error('Invalid value for "client_max_window_bits"'); + } + if (typeof this._options.clientMaxWindowBits === 'number' && + (!params.client_max_window_bits || params.client_max_window_bits > this._options.clientMaxWindowBits)) { + throw new Error('Invalid value for "client_max_window_bits"'); + } + } + return params; +}; + +/** + * Normalize extensions parameters + * + * @api private + */ + +PerMessageDeflate.prototype.normalizeParams = function(paramsList) { + return paramsList.map(function(params) { + Object.keys(params).forEach(function(key) { + var value = params[key]; + if (value.length > 1) { + throw new Error('Multiple extension parameters for ' + key); + } + + value = value[0]; + + switch (key) { + case 'server_no_context_takeover': + case 'client_no_context_takeover': + if (value !== true) { + throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')'); + } + params[key] = true; + break; + case 'server_max_window_bits': + case 'client_max_window_bits': + if (typeof value === 'string') { + value = parseInt(value, 10); + if (!~AVAILABLE_WINDOW_BITS.indexOf(value)) { + throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')'); + } + } + if (!this._isServer && value === true) { + throw new Error('Missing extension parameter value for ' + key); + } + params[key] = value; + break; + default: + throw new Error('Not defined extension parameter (' + key + ')'); + } + }, this); + return params; + }, this); +}; + +/** + * Decompress message + * + * @api public + */ + +PerMessageDeflate.prototype.decompress = function (data, fin, callback) { + var endpoint = this._isServer ? 'client' : 'server'; + + if (!this._inflate) { + var maxWindowBits = this.params[endpoint + '_max_window_bits']; + this._inflate = zlib.createInflateRaw({ + windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS + }); + } + + var self = this; + var buffers = []; + + this._inflate.on('error', onError).on('data', onData); + this._inflate.write(data); + if (fin) { + this._inflate.write(new Buffer([0x00, 0x00, 0xff, 0xff])); + } + this._inflate.flush(function() { + cleanup(); + callback(null, Buffer.concat(buffers)); + }); + + function onError(err) { + cleanup(); + callback(err); + } + + function onData(data) { + buffers.push(data); + } + + function cleanup() { + self._inflate.removeListener('error', onError); + self._inflate.removeListener('data', onData); + if (fin && self.params[endpoint + '_no_context_takeover']) { + self._inflate = null; + } + } +}; + +/** + * Compress message + * + * @api public + */ + +PerMessageDeflate.prototype.compress = function (data, fin, callback) { + var endpoint = this._isServer ? 'server' : 'client'; + + if (!this._deflate) { + var maxWindowBits = this.params[endpoint + '_max_window_bits']; + this._deflate = zlib.createDeflateRaw({ + flush: zlib.Z_SYNC_FLUSH, + windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS, + memLevel: this._options.memLevel || DEFAULT_MEM_LEVEL + }); + } + + var self = this; + var buffers = []; + + this._deflate.on('error', onError).on('data', onData); + this._deflate.write(data); + this._deflate.flush(function() { + cleanup(); + var data = Buffer.concat(buffers); + if (fin) { + data = data.slice(0, data.length - 4); + } + callback(null, data); + }); + + function onError(err) { + cleanup(); + callback(err); + } + + function onData(data) { + buffers.push(data); + } + + function cleanup() { + self._deflate.removeListener('error', onError); + self._deflate.removeListener('data', onData); + if (fin && self.params[endpoint + '_no_context_takeover']) { + self._deflate = null; + } + } +}; + +module.exports = PerMessageDeflate; + diff --git a/node_modules/ws/lib/Receiver.hixie.js b/node_modules/ws/lib/Receiver.hixie.js new file mode 100644 index 00000000..a8e41c47 --- /dev/null +++ b/node_modules/ws/lib/Receiver.hixie.js @@ -0,0 +1,180 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util'); + +/** + * State constants + */ + +var EMPTY = 0 + , BODY = 1; +var BINARYLENGTH = 2 + , BINARYBODY = 3; + +/** + * Hixie Receiver implementation + */ + +function Receiver () { + this.state = EMPTY; + this.buffers = []; + this.messageEnd = -1; + this.spanLength = 0; + this.dead = false; + + this.onerror = function() {}; + this.ontext = function() {}; + this.onbinary = function() {}; + this.onclose = function() {}; + this.onping = function() {}; + this.onpong = function() {}; +} + +module.exports = Receiver; + +/** + * Add new data to the parser. + * + * @api public + */ + +Receiver.prototype.add = function(data) { + var self = this; + function doAdd() { + if (self.state === EMPTY) { + if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) { + self.reset(); + self.onclose(); + return; + } + if (data[0] === 0x80) { + self.messageEnd = 0; + self.state = BINARYLENGTH; + data = data.slice(1); + } else { + + if (data[0] !== 0x00) { + self.error('payload must start with 0x00 byte', true); + return; + } + data = data.slice(1); + self.state = BODY; + + } + } + if (self.state === BINARYLENGTH) { + var i = 0; + while ((i < data.length) && (data[i] & 0x80)) { + self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); + ++i; + } + if (i < data.length) { + self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); + self.state = BINARYBODY; + ++i; + } + if (i > 0) + data = data.slice(i); + } + if (self.state === BINARYBODY) { + var dataleft = self.messageEnd - self.spanLength; + if (data.length >= dataleft) { + // consume the whole buffer to finish the frame + self.buffers.push(data); + self.spanLength += dataleft; + self.messageEnd = dataleft; + return self.parse(); + } + // frame's not done even if we consume it all + self.buffers.push(data); + self.spanLength += data.length; + return; + } + self.buffers.push(data); + if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) { + self.spanLength += self.messageEnd; + return self.parse(); + } + else self.spanLength += data.length; + } + while(data) data = doAdd(); +}; + +/** + * Releases all resources used by the receiver. + * + * @api public + */ + +Receiver.prototype.cleanup = function() { + this.dead = true; + this.state = EMPTY; + this.buffers = []; +}; + +/** + * Process buffered data. + * + * @api public + */ + +Receiver.prototype.parse = function() { + var output = new Buffer(this.spanLength); + var outputIndex = 0; + for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) { + var buffer = this.buffers[bi]; + buffer.copy(output, outputIndex); + outputIndex += buffer.length; + } + var lastBuffer = this.buffers[this.buffers.length - 1]; + if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd); + if (this.state !== BODY) --this.messageEnd; + var tail = null; + if (this.messageEnd < lastBuffer.length - 1) { + tail = lastBuffer.slice(this.messageEnd + 1); + } + this.reset(); + this.ontext(output.toString('utf8')); + return tail; +}; + +/** + * Handles an error + * + * @api private + */ + +Receiver.prototype.error = function (reason, terminate) { + this.reset(); + this.onerror(reason, terminate); + return this; +}; + +/** + * Reset parser state + * + * @api private + */ + +Receiver.prototype.reset = function (reason) { + if (this.dead) return; + this.state = EMPTY; + this.buffers = []; + this.messageEnd = -1; + this.spanLength = 0; +}; + +/** + * Internal api + */ + +function bufferIndex(buffer, byte) { + for (var i = 0, l = buffer.length; i < l; ++i) { + if (buffer[i] === byte) return i; + } + return -1; +} diff --git a/node_modules/ws/lib/Receiver.js b/node_modules/ws/lib/Receiver.js new file mode 100644 index 00000000..1ae1c4e8 --- /dev/null +++ b/node_modules/ws/lib/Receiver.js @@ -0,0 +1,698 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util') + , Validation = require('./Validation').Validation + , ErrorCodes = require('./ErrorCodes') + , BufferPool = require('./BufferPool') + , bufferUtil = require('./BufferUtil').BufferUtil + , PerMessageDeflate = require('./PerMessageDeflate'); + +/** + * HyBi Receiver implementation + */ + +function Receiver (extensions) { + // memory pool for fragmented messages + var fragmentedPoolPrevUsed = -1; + this.fragmentedBufferPool = new BufferPool(1024, function(db, length) { + return db.used + length; + }, function(db) { + return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ? + (fragmentedPoolPrevUsed + db.used) / 2 : + db.used; + }); + + // memory pool for unfragmented messages + var unfragmentedPoolPrevUsed = -1; + this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) { + return db.used + length; + }, function(db) { + return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ? + (unfragmentedPoolPrevUsed + db.used) / 2 : + db.used; + }); + + this.extensions = extensions || {}; + this.state = { + activeFragmentedOperation: null, + lastFragment: false, + masked: false, + opcode: 0, + fragmentedOperation: false + }; + this.overflow = []; + this.headerBuffer = new Buffer(10); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + this.currentMessage = []; + this.messageHandlers = []; + this.expectHeader(2, this.processPacket); + this.dead = false; + this.processing = false; + + this.onerror = function() {}; + this.ontext = function() {}; + this.onbinary = function() {}; + this.onclose = function() {}; + this.onping = function() {}; + this.onpong = function() {}; +} + +module.exports = Receiver; + +/** + * Add new data to the parser. + * + * @api public + */ + +Receiver.prototype.add = function(data) { + var dataLength = data.length; + if (dataLength == 0) return; + if (this.expectBuffer == null) { + this.overflow.push(data); + return; + } + var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset); + fastCopy(toRead, data, this.expectBuffer, this.expectOffset); + this.expectOffset += toRead; + if (toRead < dataLength) { + this.overflow.push(data.slice(toRead)); + } + while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) { + var bufferForHandler = this.expectBuffer; + this.expectBuffer = null; + this.expectOffset = 0; + this.expectHandler.call(this, bufferForHandler); + } +}; + +/** + * Releases all resources used by the receiver. + * + * @api public + */ + +Receiver.prototype.cleanup = function() { + this.dead = true; + this.overflow = null; + this.headerBuffer = null; + this.expectBuffer = null; + this.expectHandler = null; + this.unfragmentedBufferPool = null; + this.fragmentedBufferPool = null; + this.state = null; + this.currentMessage = null; + this.onerror = null; + this.ontext = null; + this.onbinary = null; + this.onclose = null; + this.onping = null; + this.onpong = null; +}; + +/** + * Waits for a certain amount of header bytes to be available, then fires a callback. + * + * @api private + */ + +Receiver.prototype.expectHeader = function(length, handler) { + if (length == 0) { + handler(null); + return; + } + this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length); + this.expectHandler = handler; + var toRead = length; + while (toRead > 0 && this.overflow.length > 0) { + var fromOverflow = this.overflow.pop(); + if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); + var read = Math.min(fromOverflow.length, toRead); + fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); + this.expectOffset += read; + toRead -= read; + } +}; + +/** + * Waits for a certain amount of data bytes to be available, then fires a callback. + * + * @api private + */ + +Receiver.prototype.expectData = function(length, handler) { + if (length == 0) { + handler(null); + return; + } + this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation); + this.expectHandler = handler; + var toRead = length; + while (toRead > 0 && this.overflow.length > 0) { + var fromOverflow = this.overflow.pop(); + if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); + var read = Math.min(fromOverflow.length, toRead); + fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); + this.expectOffset += read; + toRead -= read; + } +}; + +/** + * Allocates memory from the buffer pool. + * + * @api private + */ + +Receiver.prototype.allocateFromPool = function(length, isFragmented) { + return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); +}; + +/** + * Start processing a new packet. + * + * @api private + */ + +Receiver.prototype.processPacket = function (data) { + if (this.extensions[PerMessageDeflate.extensionName]) { + if ((data[0] & 0x30) != 0) { + this.error('reserved fields (2, 3) must be empty', 1002); + return; + } + } else { + if ((data[0] & 0x70) != 0) { + this.error('reserved fields must be empty', 1002); + return; + } + } + this.state.lastFragment = (data[0] & 0x80) == 0x80; + this.state.masked = (data[1] & 0x80) == 0x80; + var compressed = (data[0] & 0x40) == 0x40; + var opcode = data[0] & 0xf; + if (opcode === 0) { + if (compressed) { + this.error('continuation frame cannot have the Per-message Compressed bits', 1002); + return; + } + // continuation frame + this.state.fragmentedOperation = true; + this.state.opcode = this.state.activeFragmentedOperation; + if (!(this.state.opcode == 1 || this.state.opcode == 2)) { + this.error('continuation frame cannot follow current opcode', 1002); + return; + } + } + else { + if (opcode < 3 && this.state.activeFragmentedOperation != null) { + this.error('data frames after the initial data frame must have opcode 0', 1002); + return; + } + if (opcode >= 8 && compressed) { + this.error('control frames cannot have the Per-message Compressed bits', 1002); + return; + } + this.state.compressed = compressed; + this.state.opcode = opcode; + if (this.state.lastFragment === false) { + this.state.fragmentedOperation = true; + this.state.activeFragmentedOperation = opcode; + } + else this.state.fragmentedOperation = false; + } + var handler = opcodes[this.state.opcode]; + if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002); + else { + handler.start.call(this, data); + } +}; + +/** + * Endprocessing a packet. + * + * @api private + */ + +Receiver.prototype.endPacket = function() { + if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true); + else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) { + // end current fragmented operation + this.state.activeFragmentedOperation = null; + } + this.state.lastFragment = false; + this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; + this.state.masked = false; + this.expectHeader(2, this.processPacket); +}; + +/** + * Reset the parser state. + * + * @api private + */ + +Receiver.prototype.reset = function() { + if (this.dead) return; + this.state = { + activeFragmentedOperation: null, + lastFragment: false, + masked: false, + opcode: 0, + fragmentedOperation: false + }; + this.fragmentedBufferPool.reset(true); + this.unfragmentedBufferPool.reset(true); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + this.overflow = []; + this.currentMessage = []; + this.messageHandlers = []; +}; + +/** + * Unmask received data. + * + * @api private + */ + +Receiver.prototype.unmask = function (mask, buf, binary) { + if (mask != null && buf != null) bufferUtil.unmask(buf, mask); + if (binary) return buf; + return buf != null ? buf.toString('utf8') : ''; +}; + +/** + * Concatenates a list of buffers. + * + * @api private + */ + +Receiver.prototype.concatBuffers = function(buffers) { + var length = 0; + for (var i = 0, l = buffers.length; i < l; ++i) length += buffers[i].length; + var mergedBuffer = new Buffer(length); + bufferUtil.merge(mergedBuffer, buffers); + return mergedBuffer; +}; + +/** + * Handles an error + * + * @api private + */ + +Receiver.prototype.error = function (reason, protocolErrorCode) { + this.reset(); + this.onerror(reason, protocolErrorCode); + return this; +}; + +/** + * Execute message handler buffers + * + * @api private + */ + +Receiver.prototype.flush = function() { + if (this.processing || this.dead) return; + + var handler = this.messageHandlers.shift(); + if (!handler) return; + + this.processing = true; + var self = this; + + handler(function() { + self.processing = false; + self.flush(); + }); +}; + +/** + * Apply extensions to message + * + * @api private + */ + +Receiver.prototype.applyExtensions = function(messageBuffer, fin, compressed, callback) { + var self = this; + if (compressed) { + this.extensions[PerMessageDeflate.extensionName].decompress(messageBuffer, fin, function(err, buffer) { + if (self.dead) return; + if (err) { + callback(new Error('invalid compressed data')); + return; + } + callback(null, buffer); + }); + } else { + callback(null, messageBuffer); + } +}; + +/** + * Buffer utilities + */ + +function readUInt16BE(start) { + return (this[start]<<8) + + this[start+1]; +} + +function readUInt32BE(start) { + return (this[start]<<24) + + (this[start+1]<<16) + + (this[start+2]<<8) + + this[start+3]; +} + +function fastCopy(length, srcBuffer, dstBuffer, dstOffset) { + switch (length) { + default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break; + case 16: dstBuffer[dstOffset+15] = srcBuffer[15]; + case 15: dstBuffer[dstOffset+14] = srcBuffer[14]; + case 14: dstBuffer[dstOffset+13] = srcBuffer[13]; + case 13: dstBuffer[dstOffset+12] = srcBuffer[12]; + case 12: dstBuffer[dstOffset+11] = srcBuffer[11]; + case 11: dstBuffer[dstOffset+10] = srcBuffer[10]; + case 10: dstBuffer[dstOffset+9] = srcBuffer[9]; + case 9: dstBuffer[dstOffset+8] = srcBuffer[8]; + case 8: dstBuffer[dstOffset+7] = srcBuffer[7]; + case 7: dstBuffer[dstOffset+6] = srcBuffer[6]; + case 6: dstBuffer[dstOffset+5] = srcBuffer[5]; + case 5: dstBuffer[dstOffset+4] = srcBuffer[4]; + case 4: dstBuffer[dstOffset+3] = srcBuffer[3]; + case 3: dstBuffer[dstOffset+2] = srcBuffer[2]; + case 2: dstBuffer[dstOffset+1] = srcBuffer[1]; + case 1: dstBuffer[dstOffset] = srcBuffer[0]; + } +} + +function clone(obj) { + var cloned = {}; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + cloned[k] = obj[k]; + } + } + return cloned; +} + +/** + * Opcode handlers + */ + +var opcodes = { + // text + '1': { + start: function(data) { + var self = this; + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['1'].getData.call(self, firstLength); + } + else if (firstLength == 126) { + self.expectHeader(2, function(data) { + opcodes['1'].getData.call(self, readUInt16BE.call(data, 0)); + }); + } + else if (firstLength == 127) { + self.expectHeader(8, function(data) { + if (readUInt32BE.call(data, 0) != 0) { + self.error('packets with length spanning more than 32 bit is currently not supported', 1008); + return; + } + opcodes['1'].getData.call(self, readUInt32BE.call(data, 4)); + }); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['1'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['1'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + var packet = this.unmask(mask, data, true) || new Buffer(0); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { + if (err) return self.error(err.message, 1007); + if (buffer != null) self.currentMessage.push(buffer); + + if (state.lastFragment) { + var messageBuffer = self.concatBuffers(self.currentMessage); + self.currentMessage = []; + if (!Validation.isValidUTF8(messageBuffer)) { + self.error('invalid utf8 sequence', 1007); + return; + } + self.ontext(messageBuffer.toString('utf8'), {masked: state.masked, buffer: messageBuffer}); + } + callback(); + }); + }); + this.flush(); + this.endPacket(); + } + }, + // binary + '2': { + start: function(data) { + var self = this; + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['2'].getData.call(self, firstLength); + } + else if (firstLength == 126) { + self.expectHeader(2, function(data) { + opcodes['2'].getData.call(self, readUInt16BE.call(data, 0)); + }); + } + else if (firstLength == 127) { + self.expectHeader(8, function(data) { + if (readUInt32BE.call(data, 0) != 0) { + self.error('packets with length spanning more than 32 bit is currently not supported', 1008); + return; + } + opcodes['2'].getData.call(self, readUInt32BE.call(data, 4, true)); + }); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['2'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['2'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + var packet = this.unmask(mask, data, true) || new Buffer(0); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { + if (err) return self.error(err.message, 1007); + if (buffer != null) self.currentMessage.push(buffer); + if (state.lastFragment) { + var messageBuffer = self.concatBuffers(self.currentMessage); + self.currentMessage = []; + self.onbinary(messageBuffer, {masked: state.masked, buffer: messageBuffer}); + } + callback(); + }); + }); + this.flush(); + this.endPacket(); + } + }, + // close + '8': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented close is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['8'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['8'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['8'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = self.unmask(mask, data, true); + + var state = clone(this.state); + this.messageHandlers.push(function() { + if (data && data.length == 1) { + self.error('close packets with data must be at least two bytes long', 1002); + return; + } + var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000; + if (!ErrorCodes.isValidErrorCode(code)) { + self.error('invalid error code', 1002); + return; + } + var message = ''; + if (data && data.length > 2) { + var messageBuffer = data.slice(2); + if (!Validation.isValidUTF8(messageBuffer)) { + self.error('invalid utf8 sequence', 1007); + return; + } + message = messageBuffer.toString('utf8'); + } + self.onclose(code, message, {masked: state.masked}); + self.reset(); + }); + this.flush(); + }, + }, + // ping + '9': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented ping is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['9'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['9'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['9'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = this.unmask(mask, data, true); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.onping(data, {masked: state.masked, binary: true}); + callback(); + }); + this.flush(); + this.endPacket(); + } + }, + // pong + '10': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented pong is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['10'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (this.state.masked) { + this.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['10'].finish.call(self, mask, data); + }); + }); + } + else { + this.expectData(length, function(data) { + opcodes['10'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = self.unmask(mask, data, true); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.onpong(data, {masked: state.masked, binary: true}); + callback(); + }); + this.flush(); + this.endPacket(); + } + } +} diff --git a/node_modules/ws/lib/Sender.hixie.js b/node_modules/ws/lib/Sender.hixie.js new file mode 100644 index 00000000..fd2fd250 --- /dev/null +++ b/node_modules/ws/lib/Sender.hixie.js @@ -0,0 +1,120 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var events = require('events') + , util = require('util') + , EventEmitter = events.EventEmitter; + +/** + * Hixie Sender implementation + */ + +function Sender(socket) { + events.EventEmitter.call(this); + + this.socket = socket; + this.continuationFrame = false; + this.isClosed = false; +} + +module.exports = Sender; + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Sender, events.EventEmitter); + +/** + * Frames and writes data. + * + * @api public + */ + +Sender.prototype.send = function(data, options, cb) { + if (this.isClosed) return; + + var isString = typeof data == 'string' + , length = isString ? Buffer.byteLength(data) : data.length + , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes + , writeStartMarker = this.continuationFrame == false + , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin) + , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0)) + , offset = writeStartMarker ? 1 : 0; + + if (writeStartMarker) { + if (options && options.binary) { + buffer.write('\x80', 'binary'); + // assume length less than 2**14 bytes + if (lengthbytes > 1) + buffer.write(String.fromCharCode(128+length/128), offset++, 'binary'); + buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary'); + } else + buffer.write('\x00', 'binary'); + } + + if (isString) buffer.write(data, offset, 'utf8'); + else data.copy(buffer, offset, 0); + + if (writeEndMarker) { + if (options && options.binary) { + // sending binary, not writing end marker + } else + buffer.write('\xff', offset + length, 'binary'); + this.continuationFrame = false; + } + else this.continuationFrame = true; + + try { + this.socket.write(buffer, 'binary', cb); + } catch (e) { + this.error(e.toString()); + } +}; + +/** + * Sends a close instruction to the remote party. + * + * @api public + */ + +Sender.prototype.close = function(code, data, mask, cb) { + if (this.isClosed) return; + this.isClosed = true; + try { + if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary')); + this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb); + } catch (e) { + this.error(e.toString()); + } +}; + +/** + * Sends a ping message to the remote party. Not available for hixie. + * + * @api public + */ + +Sender.prototype.ping = function(data, options) {}; + +/** + * Sends a pong message to the remote party. Not available for hixie. + * + * @api public + */ + +Sender.prototype.pong = function(data, options) {}; + +/** + * Handles an error + * + * @api private + */ + +Sender.prototype.error = function (reason) { + this.emit('error', reason); + return this; +}; diff --git a/node_modules/ws/lib/Sender.js b/node_modules/ws/lib/Sender.js new file mode 100644 index 00000000..f3467480 --- /dev/null +++ b/node_modules/ws/lib/Sender.js @@ -0,0 +1,309 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var events = require('events') + , util = require('util') + , EventEmitter = events.EventEmitter + , ErrorCodes = require('./ErrorCodes') + , bufferUtil = require('./BufferUtil').BufferUtil + , PerMessageDeflate = require('./PerMessageDeflate'); + +/** + * HyBi Sender implementation + */ + +function Sender(socket, extensions) { + events.EventEmitter.call(this); + + this._socket = socket; + this.extensions = extensions || {}; + this.firstFragment = true; + this.compress = false; + this.messageHandlers = []; + this.processing = false; +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Sender, events.EventEmitter); + +/** + * Sends a close instruction to the remote party. + * + * @api public + */ + +Sender.prototype.close = function(code, data, mask, cb) { + if (typeof code !== 'undefined') { + if (typeof code !== 'number' || + !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number'); + } + code = code || 1000; + var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0)); + writeUInt16BE.call(dataBuffer, code, 0); + if (dataBuffer.length > 2) dataBuffer.write(data, 2); + + var self = this; + this.messageHandlers.push(function(callback) { + self.frameAndSend(0x8, dataBuffer, true, mask); + callback(); + if (typeof cb == 'function') cb(); + }); + this.flush(); +}; + +/** + * Sends a ping message to the remote party. + * + * @api public + */ + +Sender.prototype.ping = function(data, options) { + var mask = options && options.mask; + var self = this; + this.messageHandlers.push(function(callback) { + self.frameAndSend(0x9, data || '', true, mask); + callback(); + }); + this.flush(); +}; + +/** + * Sends a pong message to the remote party. + * + * @api public + */ + +Sender.prototype.pong = function(data, options) { + var mask = options && options.mask; + var self = this; + this.messageHandlers.push(function(callback) { + self.frameAndSend(0xa, data || '', true, mask); + callback(); + }); + this.flush(); +}; + +/** + * Sends text or binary data to the remote party. + * + * @api public + */ + +Sender.prototype.send = function(data, options, cb) { + var finalFragment = options && options.fin === false ? false : true; + var mask = options && options.mask; + var compress = options && options.compress; + var opcode = options && options.binary ? 2 : 1; + if (this.firstFragment === false) { + opcode = 0; + compress = false; + } else { + this.firstFragment = false; + this.compress = compress; + } + if (finalFragment) this.firstFragment = true + + var compressFragment = this.compress; + + var self = this; + this.messageHandlers.push(function(callback) { + self.applyExtensions(data, finalFragment, compressFragment, function(err, data) { + if (err) { + if (typeof cb == 'function') cb(err); + else self.emit('error', err); + return; + } + self.frameAndSend(opcode, data, finalFragment, mask, compress, cb); + callback(); + }); + }); + this.flush(); +}; + +/** + * Frames and sends a piece of data according to the HyBi WebSocket protocol. + * + * @api private + */ + +Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, compressed, cb) { + var canModifyData = false; + + if (!data) { + try { + this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + return; + } + + if (!Buffer.isBuffer(data)) { + canModifyData = true; + if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) { + data = getArrayBuffer(data); + } else { + data = new Buffer(data); + } + } + + var dataLength = data.length + , dataOffset = maskData ? 6 : 2 + , secondByte = dataLength; + + if (dataLength >= 65536) { + dataOffset += 8; + secondByte = 127; + } + else if (dataLength > 125) { + dataOffset += 2; + secondByte = 126; + } + + var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData); + var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset; + var outputBuffer = new Buffer(totalLength); + outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode; + if (compressed) outputBuffer[0] |= 0x40; + + switch (secondByte) { + case 126: + writeUInt16BE.call(outputBuffer, dataLength, 2); + break; + case 127: + writeUInt32BE.call(outputBuffer, 0, 2); + writeUInt32BE.call(outputBuffer, dataLength, 6); + } + + if (maskData) { + outputBuffer[1] = secondByte | 0x80; + var mask = this._randomMask || (this._randomMask = getRandomMask()); + outputBuffer[dataOffset - 4] = mask[0]; + outputBuffer[dataOffset - 3] = mask[1]; + outputBuffer[dataOffset - 2] = mask[2]; + outputBuffer[dataOffset - 1] = mask[3]; + if (mergeBuffers) { + bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength); + try { + this._socket.write(outputBuffer, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + else { + bufferUtil.mask(data, mask, data, 0, dataLength); + try { + this._socket.write(outputBuffer, 'binary'); + this._socket.write(data, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + } + else { + outputBuffer[1] = secondByte; + if (mergeBuffers) { + data.copy(outputBuffer, dataOffset); + try { + this._socket.write(outputBuffer, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + else { + try { + this._socket.write(outputBuffer, 'binary'); + this._socket.write(data, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + } +}; + +/** + * Execute message handler buffers + * + * @api private + */ + +Sender.prototype.flush = function() { + if (this.processing) return; + + var handler = this.messageHandlers.shift(); + if (!handler) return; + + this.processing = true; + + var self = this; + + handler(function() { + self.processing = false; + self.flush(); + }); +}; + +/** + * Apply extensions to message + * + * @api private + */ + +Sender.prototype.applyExtensions = function(data, fin, compress, callback) { + if (compress && data) { + this.extensions[PerMessageDeflate.extensionName].compress(data, fin, callback); + } else { + callback(null, data); + } +}; + +module.exports = Sender; + +function writeUInt16BE(value, offset) { + this[offset] = (value & 0xff00)>>8; + this[offset+1] = value & 0xff; +} + +function writeUInt32BE(value, offset) { + this[offset] = (value & 0xff000000)>>24; + this[offset+1] = (value & 0xff0000)>>16; + this[offset+2] = (value & 0xff00)>>8; + this[offset+3] = value & 0xff; +} + +function getArrayBuffer(data) { + // data is either an ArrayBuffer or ArrayBufferView. + var array = new Uint8Array(data.buffer || data) + , l = data.byteLength || data.length + , o = data.byteOffset || 0 + , buffer = new Buffer(l); + for (var i = 0; i < l; ++i) { + buffer[i] = array[o+i]; + } + return buffer; +} + +function getRandomMask() { + return new Buffer([ + ~~(Math.random() * 255), + ~~(Math.random() * 255), + ~~(Math.random() * 255), + ~~(Math.random() * 255) + ]); +} diff --git a/node_modules/ws/lib/Validation.fallback.js b/node_modules/ws/lib/Validation.fallback.js new file mode 100644 index 00000000..2c7c4fd4 --- /dev/null +++ b/node_modules/ws/lib/Validation.fallback.js @@ -0,0 +1,12 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.Validation = { + isValidUTF8: function(buffer) { + return true; + } +}; + diff --git a/node_modules/ws/lib/Validation.js b/node_modules/ws/lib/Validation.js new file mode 100644 index 00000000..0795fb7f --- /dev/null +++ b/node_modules/ws/lib/Validation.js @@ -0,0 +1,13 @@ +'use strict'; + +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +try { + module.exports = require('utf-8-validate'); +} catch (e) { + module.exports = require('./Validation.fallback'); +} diff --git a/node_modules/ws/lib/WebSocket.js b/node_modules/ws/lib/WebSocket.js new file mode 100644 index 00000000..bc3f84ad --- /dev/null +++ b/node_modules/ws/lib/WebSocket.js @@ -0,0 +1,937 @@ +'use strict'; + +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var url = require('url') + , util = require('util') + , http = require('http') + , https = require('https') + , crypto = require('crypto') + , stream = require('stream') + , Ultron = require('ultron') + , Options = require('options') + , Sender = require('./Sender') + , Receiver = require('./Receiver') + , SenderHixie = require('./Sender.hixie') + , ReceiverHixie = require('./Receiver.hixie') + , Extensions = require('./Extensions') + , PerMessageDeflate = require('./PerMessageDeflate') + , EventEmitter = require('events').EventEmitter; + +/** + * Constants + */ + +// Default protocol version + +var protocolVersion = 13; + +// Close timeout + +var closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly + +/** + * WebSocket implementation + * + * @constructor + * @param {String} address Connection address. + * @param {String|Array} protocols WebSocket protocols. + * @param {Object} options Additional connection options. + * @api public + */ +function WebSocket(address, protocols, options) { + EventEmitter.call(this); + + if (protocols && !Array.isArray(protocols) && 'object' === typeof protocols) { + // accept the "options" Object as the 2nd argument + options = protocols; + protocols = null; + } + + if ('string' === typeof protocols) { + protocols = [ protocols ]; + } + + if (!Array.isArray(protocols)) { + protocols = []; + } + + this._socket = null; + this._ultron = null; + this._closeReceived = false; + this.bytesReceived = 0; + this.readyState = null; + this.supports = {}; + this.extensions = {}; + + if (Array.isArray(address)) { + initAsServerClient.apply(this, address.concat(options)); + } else { + initAsClient.apply(this, [address, protocols, options]); + } +} + +/** + * Inherits from EventEmitter. + */ +util.inherits(WebSocket, EventEmitter); + +/** + * Ready States + */ +["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function each(state, index) { + WebSocket.prototype[state] = WebSocket[state] = index; +}); + +/** + * Gracefully closes the connection, after sending a description message to the server + * + * @param {Object} data to be sent to the server + * @api public + */ +WebSocket.prototype.close = function close(code, data) { + if (this.readyState === WebSocket.CLOSED) return; + + if (this.readyState === WebSocket.CONNECTING) { + this.readyState = WebSocket.CLOSED; + return; + } + + if (this.readyState === WebSocket.CLOSING) { + if (this._closeReceived && this._isServer) { + this.terminate(); + } + return; + } + + var self = this; + try { + this.readyState = WebSocket.CLOSING; + this._closeCode = code; + this._closeMessage = data; + var mask = !this._isServer; + this._sender.close(code, data, mask, function(err) { + if (err) self.emit('error', err); + + if (self._closeReceived && self._isServer) { + self.terminate(); + } else { + // ensure that the connection is cleaned up even when no response of closing handshake. + clearTimeout(self._closeTimer); + self._closeTimer = setTimeout(cleanupWebsocketResources.bind(self, true), closeTimeout); + } + }); + } catch (e) { + this.emit('error', e); + } +}; + +/** + * Pause the client stream + * + * @api public + */ +WebSocket.prototype.pause = function pauser() { + if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); + + return this._socket.pause(); +}; + +/** + * Sends a ping + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean + * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open + * @api public + */ +WebSocket.prototype.ping = function ping(data, options, dontFailWhenClosed) { + if (this.readyState !== WebSocket.OPEN) { + if (dontFailWhenClosed === true) return; + throw new Error('not opened'); + } + + options = options || {}; + + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + + this._sender.ping(data, options); +}; + +/** + * Sends a pong + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean + * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open + * @api public + */ +WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) { + if (this.readyState !== WebSocket.OPEN) { + if (dontFailWhenClosed === true) return; + throw new Error('not opened'); + } + + options = options || {}; + + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + + this._sender.pong(data, options); +}; + +/** + * Resume the client stream + * + * @api public + */ +WebSocket.prototype.resume = function resume() { + if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); + + return this._socket.resume(); +}; + +/** + * Sends a piece of data + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean + * @param {function} Optional callback which is executed after the send completes + * @api public + */ + +WebSocket.prototype.send = function send(data, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + if (this.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else throw new Error('not opened'); + return; + } + + if (!data) data = ''; + if (this._queue) { + var self = this; + this._queue.push(function() { self.send(data, options, cb); }); + return; + } + + options = options || {}; + options.fin = true; + + if (typeof options.binary === 'undefined') { + options.binary = (data instanceof ArrayBuffer || data instanceof Buffer || + data instanceof Uint8Array || + data instanceof Uint16Array || + data instanceof Uint32Array || + data instanceof Int8Array || + data instanceof Int16Array || + data instanceof Int32Array || + data instanceof Float32Array || + data instanceof Float64Array); + } + + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + if (typeof options.compress === 'undefined') options.compress = true; + if (!this.extensions[PerMessageDeflate.extensionName]) { + options.compress = false; + } + + var readable = typeof stream.Readable === 'function' + ? stream.Readable + : stream.Stream; + + if (data instanceof readable) { + startQueue(this); + var self = this; + + sendStream(this, data, options, function send(error) { + process.nextTick(function tock() { + executeQueueSends(self); + }); + + if (typeof cb === 'function') cb(error); + }); + } else { + this._sender.send(data, options, cb); + } +}; + +/** + * Streams data through calls to a user supplied function + * + * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean + * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'. + * @api public + */ +WebSocket.prototype.stream = function stream(options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + var self = this; + + if (typeof cb !== 'function') throw new Error('callback must be provided'); + + if (this.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else throw new Error('not opened'); + return; + } + + if (this._queue) { + this._queue.push(function () { self.stream(options, cb); }); + return; + } + + options = options || {}; + + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + if (typeof options.compress === 'undefined') options.compress = true; + if (!this.extensions[PerMessageDeflate.extensionName]) { + options.compress = false; + } + + startQueue(this); + + function send(data, final) { + try { + if (self.readyState !== WebSocket.OPEN) throw new Error('not opened'); + options.fin = final === true; + self._sender.send(data, options); + if (!final) process.nextTick(cb.bind(null, null, send)); + else executeQueueSends(self); + } catch (e) { + if (typeof cb === 'function') cb(e); + else { + delete self._queue; + self.emit('error', e); + } + } + } + + process.nextTick(cb.bind(null, null, send)); +}; + +/** + * Immediately shuts down the connection + * + * @api public + */ +WebSocket.prototype.terminate = function terminate() { + if (this.readyState === WebSocket.CLOSED) return; + + if (this._socket) { + this.readyState = WebSocket.CLOSING; + + // End the connection + try { this._socket.end(); } + catch (e) { + // Socket error during end() call, so just destroy it right now + cleanupWebsocketResources.call(this, true); + return; + } + + // Add a timeout to ensure that the connection is completely + // cleaned up within 30 seconds, even if the clean close procedure + // fails for whatever reason + // First cleanup any pre-existing timeout from an earlier "terminate" call, + // if one exists. Otherwise terminate calls in quick succession will leak timeouts + // and hold the program open for `closeTimout` time. + if (this._closeTimer) { clearTimeout(this._closeTimer); } + this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout); + } else if (this.readyState === WebSocket.CONNECTING) { + cleanupWebsocketResources.call(this, true); + } +}; + +/** + * Expose bufferedAmount + * + * @api public + */ +Object.defineProperty(WebSocket.prototype, 'bufferedAmount', { + get: function get() { + var amount = 0; + if (this._socket) { + amount = this._socket.bufferSize || 0; + } + return amount; + } +}); + +/** + * Emulates the W3C Browser based WebSocket interface using function members. + * + * @see http://dev.w3.org/html5/websockets/#the-websocket-interface + * @api public + */ +['open', 'error', 'close', 'message'].forEach(function(method) { + Object.defineProperty(WebSocket.prototype, 'on' + method, { + /** + * Returns the current listener + * + * @returns {Mixed} the set function or undefined + * @api public + */ + get: function get() { + var listener = this.listeners(method)[0]; + return listener ? (listener._listener ? listener._listener : listener) : undefined; + }, + + /** + * Start listening for events + * + * @param {Function} listener the listener + * @returns {Mixed} the set function or undefined + * @api public + */ + set: function set(listener) { + this.removeAllListeners(method); + this.addEventListener(method, listener); + } + }); +}); + +/** + * Emulates the W3C Browser based WebSocket interface using addEventListener. + * + * @see https://developer.mozilla.org/en/DOM/element.addEventListener + * @see http://dev.w3.org/html5/websockets/#the-websocket-interface + * @api public + */ +WebSocket.prototype.addEventListener = function(method, listener) { + var target = this; + + function onMessage (data, flags) { + listener.call(target, new MessageEvent(data, flags.binary ? 'Binary' : 'Text', target)); + } + + function onClose (code, message) { + listener.call(target, new CloseEvent(code, message, target)); + } + + function onError (event) { + event.target = target; + listener.call(target, event); + } + + function onOpen () { + listener.call(target, new OpenEvent(target)); + } + + if (typeof listener === 'function') { + if (method === 'message') { + // store a reference so we can return the original function from the + // addEventListener hook + onMessage._listener = listener; + this.on(method, onMessage); + } else if (method === 'close') { + // store a reference so we can return the original function from the + // addEventListener hook + onClose._listener = listener; + this.on(method, onClose); + } else if (method === 'error') { + // store a reference so we can return the original function from the + // addEventListener hook + onError._listener = listener; + this.on(method, onError); + } else if (method === 'open') { + // store a reference so we can return the original function from the + // addEventListener hook + onOpen._listener = listener; + this.on(method, onOpen); + } else { + this.on(method, listener); + } + } +}; + +module.exports = WebSocket; + +/** + * W3C MessageEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @constructor + * @api private + */ +function MessageEvent(dataArg, typeArg, target) { + this.data = dataArg; + this.type = typeArg; + this.target = target; +} + +/** + * W3C CloseEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @constructor + * @api private + */ +function CloseEvent(code, reason, target) { + this.wasClean = (typeof code === 'undefined' || code === 1000); + this.code = code; + this.reason = reason; + this.target = target; +} + +/** + * W3C OpenEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @constructor + * @api private + */ +function OpenEvent(target) { + this.target = target; +} + +/** + * Entirely private apis, + * which may or may not be bound to a sepcific WebSocket instance. + */ +function initAsServerClient(req, socket, upgradeHead, options) { + options = new Options({ + protocolVersion: protocolVersion, + protocol: null, + extensions: {} + }).merge(options); + + // expose state properties + this.protocol = options.value.protocol; + this.protocolVersion = options.value.protocolVersion; + this.extensions = options.value.extensions; + this.supports.binary = (this.protocolVersion !== 'hixie-76'); + this.upgradeReq = req; + this.readyState = WebSocket.CONNECTING; + this._isServer = true; + + // establish connection + if (options.value.protocolVersion === 'hixie-76') { + establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead); + } else { + establishConnection.call(this, Receiver, Sender, socket, upgradeHead); + } +} + +function initAsClient(address, protocols, options) { + options = new Options({ + origin: null, + protocolVersion: protocolVersion, + host: null, + headers: null, + protocol: protocols.join(','), + agent: null, + + // ssl-related options + pfx: null, + key: null, + passphrase: null, + cert: null, + ca: null, + ciphers: null, + rejectUnauthorized: null, + perMessageDeflate: true + }).merge(options); + + if (options.value.protocolVersion !== 8 && options.value.protocolVersion !== 13) { + throw new Error('unsupported protocol version'); + } + + // verify URL and establish http class + var serverUrl = url.parse(address); + var isUnixSocket = serverUrl.protocol === 'ws+unix:'; + if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url'); + var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:'; + var httpObj = isSecure ? https : http; + var port = serverUrl.port || (isSecure ? 443 : 80); + var auth = serverUrl.auth; + + // prepare extensions + var extensionsOffer = {}; + var perMessageDeflate; + if (options.value.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate(typeof options.value.perMessageDeflate !== true ? options.value.perMessageDeflate : {}, false); + extensionsOffer[PerMessageDeflate.extensionName] = perMessageDeflate.offer(); + } + + // expose state properties + this._isServer = false; + this.url = address; + this.protocolVersion = options.value.protocolVersion; + this.supports.binary = (this.protocolVersion !== 'hixie-76'); + + // begin handshake + var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64'); + var shasum = crypto.createHash('sha1'); + shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'); + var expectedServerKey = shasum.digest('base64'); + + var agent = options.value.agent; + + var headerHost = serverUrl.hostname; + // Append port number to Host and Origin header, only if specified in the url + // and non-default + if (serverUrl.port) { + if ((isSecure && (port !== 443)) || (!isSecure && (port !== 80))){ + headerHost = headerHost + ':' + port; + } + } + + var requestOptions = { + port: port, + host: serverUrl.hostname, + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Host': headerHost, + 'Origin': headerHost, + 'Sec-WebSocket-Version': options.value.protocolVersion, + 'Sec-WebSocket-Key': key + } + }; + + // If we have basic auth. + if (auth) { + requestOptions.headers.Authorization = 'Basic ' + new Buffer(auth).toString('base64'); + } + + if (options.value.protocol) { + requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol; + } + + if (options.value.host) { + requestOptions.headers.Host = options.value.host; + } + + if (options.value.headers) { + for (var header in options.value.headers) { + if (options.value.headers.hasOwnProperty(header)) { + requestOptions.headers[header] = options.value.headers[header]; + } + } + } + + if (Object.keys(extensionsOffer).length) { + requestOptions.headers['Sec-WebSocket-Extensions'] = Extensions.format(extensionsOffer); + } + + if (options.isDefinedAndNonNull('pfx') + || options.isDefinedAndNonNull('key') + || options.isDefinedAndNonNull('passphrase') + || options.isDefinedAndNonNull('cert') + || options.isDefinedAndNonNull('ca') + || options.isDefinedAndNonNull('ciphers') + || options.isDefinedAndNonNull('rejectUnauthorized')) { + + if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx; + if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key; + if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase; + if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert; + if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca; + if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers; + if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized; + + if (!agent) { + // global agent ignores client side certificates + agent = new httpObj.Agent(requestOptions); + } + } + + requestOptions.path = serverUrl.path || '/'; + + if (agent) { + requestOptions.agent = agent; + } + + if (isUnixSocket) { + requestOptions.socketPath = serverUrl.pathname; + } + if (options.value.origin) { + if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin; + else requestOptions.headers.Origin = options.value.origin; + } + + var self = this; + var req = httpObj.request(requestOptions); + + req.on('error', function onerror(error) { + self.emit('error', error); + cleanupWebsocketResources.call(this, error); + }); + + req.once('response', function response(res) { + var error; + + if (!self.emit('unexpected-response', req, res)) { + error = new Error('unexpected server response (' + res.statusCode + ')'); + req.abort(); + self.emit('error', error); + } + + cleanupWebsocketResources.call(this, error); + }); + + req.once('upgrade', function upgrade(res, socket, upgradeHead) { + if (self.readyState === WebSocket.CLOSED) { + // client closed before server accepted connection + self.emit('close'); + self.removeAllListeners(); + socket.end(); + return; + } + + var serverKey = res.headers['sec-websocket-accept']; + if (typeof serverKey === 'undefined' || serverKey !== expectedServerKey) { + self.emit('error', 'invalid server key'); + self.removeAllListeners(); + socket.end(); + return; + } + + var serverProt = res.headers['sec-websocket-protocol']; + var protList = (options.value.protocol || "").split(/, */); + var protError = null; + + if (!options.value.protocol && serverProt) { + protError = 'server sent a subprotocol even though none requested'; + } else if (options.value.protocol && !serverProt) { + protError = 'server sent no subprotocol even though requested'; + } else if (serverProt && protList.indexOf(serverProt) === -1) { + protError = 'server responded with an invalid protocol'; + } + + if (protError) { + self.emit('error', protError); + self.removeAllListeners(); + socket.end(); + return; + } else if (serverProt) { + self.protocol = serverProt; + } + + var serverExtensions = Extensions.parse(res.headers['sec-websocket-extensions']); + if (perMessageDeflate && serverExtensions[PerMessageDeflate.extensionName]) { + try { + perMessageDeflate.accept(serverExtensions[PerMessageDeflate.extensionName]); + } catch (err) { + self.emit('error', 'invalid extension parameter'); + self.removeAllListeners(); + socket.end(); + return; + } + self.extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + + establishConnection.call(self, Receiver, Sender, socket, upgradeHead); + + // perform cleanup on http resources + req.removeAllListeners(); + req = null; + agent = null; + }); + + req.end(); + this.readyState = WebSocket.CONNECTING; +} + +function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) { + var ultron = this._ultron = new Ultron(socket); + this._socket = socket; + + socket.setTimeout(0); + socket.setNoDelay(true); + var self = this; + this._receiver = new ReceiverClass(this.extensions); + + // socket cleanup handlers + ultron.on('end', cleanupWebsocketResources.bind(this)); + ultron.on('close', cleanupWebsocketResources.bind(this)); + ultron.on('error', cleanupWebsocketResources.bind(this)); + + // ensure that the upgradeHead is added to the receiver + function firstHandler(data) { + if (self.readyState !== WebSocket.OPEN && self.readyState !== WebSocket.CLOSING) return; + + if (upgradeHead && upgradeHead.length > 0) { + self.bytesReceived += upgradeHead.length; + var head = upgradeHead; + upgradeHead = null; + self._receiver.add(head); + } + + dataHandler = realHandler; + + if (data) { + self.bytesReceived += data.length; + self._receiver.add(data); + } + } + + // subsequent packets are pushed straight to the receiver + function realHandler(data) { + if (data) self.bytesReceived += data.length; + self._receiver.add(data); + } + + var dataHandler = firstHandler; + + // if data was passed along with the http upgrade, + // this will schedule a push of that on to the receiver. + // this has to be done on next tick, since the caller + // hasn't had a chance to set event handlers on this client + // object yet. + process.nextTick(firstHandler); + + // receiver event handlers + self._receiver.ontext = function ontext(data, flags) { + flags = flags || {}; + + self.emit('message', data, flags); + }; + + self._receiver.onbinary = function onbinary(data, flags) { + flags = flags || {}; + + flags.binary = true; + self.emit('message', data, flags); + }; + + self._receiver.onping = function onping(data, flags) { + flags = flags || {}; + + self.pong(data, { + mask: !self._isServer, + binary: flags.binary === true + }, true); + + self.emit('ping', data, flags); + }; + + self._receiver.onpong = function onpong(data, flags) { + self.emit('pong', data, flags || {}); + }; + + self._receiver.onclose = function onclose(code, data, flags) { + flags = flags || {}; + + self._closeReceived = true; + self.close(code, data); + }; + + self._receiver.onerror = function onerror(reason, errorCode) { + // close the connection when the receiver reports a HyBi error code + self.close(typeof errorCode !== 'undefined' ? errorCode : 1002, ''); + self.emit('error', reason, errorCode); + }; + + // finalize the client + this._sender = new SenderClass(socket, this.extensions); + this._sender.on('error', function onerror(error) { + self.close(1002, ''); + self.emit('error', error); + }); + + this.readyState = WebSocket.OPEN; + this.emit('open'); + + ultron.on('data', dataHandler); +} + +function startQueue(instance) { + instance._queue = instance._queue || []; +} + +function executeQueueSends(instance) { + var queue = instance._queue; + if (typeof queue === 'undefined') return; + + delete instance._queue; + for (var i = 0, l = queue.length; i < l; ++i) { + queue[i](); + } +} + +function sendStream(instance, stream, options, cb) { + stream.on('data', function incoming(data) { + if (instance.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else { + delete instance._queue; + instance.emit('error', new Error('not opened')); + } + return; + } + + options.fin = false; + instance._sender.send(data, options); + }); + + stream.on('end', function end() { + if (instance.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else { + delete instance._queue; + instance.emit('error', new Error('not opened')); + } + return; + } + + options.fin = true; + instance._sender.send(null, options); + + if (typeof cb === 'function') cb(null); + }); +} + +function cleanupWebsocketResources(error) { + if (this.readyState === WebSocket.CLOSED) return; + + var emitClose = this.readyState !== WebSocket.CONNECTING; + this.readyState = WebSocket.CLOSED; + + clearTimeout(this._closeTimer); + this._closeTimer = null; + + if (emitClose) { + this.emit('close', this._closeCode || 1000, this._closeMessage || ''); + } + + if (this._socket) { + if (this._ultron) this._ultron.destroy(); + this._socket.on('error', function onerror() { + try { this.destroy(); } + catch (e) {} + }); + + try { + if (!error) this._socket.end(); + else this._socket.destroy(); + } catch (e) { /* Ignore termination errors */ } + + this._socket = null; + this._ultron = null; + } + + if (this._sender) { + this._sender.removeAllListeners(); + this._sender = null; + } + + if (this._receiver) { + this._receiver.cleanup(); + this._receiver = null; + } + + this.removeAllListeners(); + this.on('error', function onerror() {}); // catch all errors after this + delete this._queue; +} diff --git a/node_modules/ws/lib/WebSocketServer.js b/node_modules/ws/lib/WebSocketServer.js new file mode 100644 index 00000000..a2f3a618 --- /dev/null +++ b/node_modules/ws/lib/WebSocketServer.js @@ -0,0 +1,501 @@ +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var util = require('util') + , events = require('events') + , http = require('http') + , crypto = require('crypto') + , Options = require('options') + , WebSocket = require('./WebSocket') + , Extensions = require('./Extensions') + , PerMessageDeflate = require('./PerMessageDeflate') + , tls = require('tls') + , url = require('url'); + +/** + * WebSocket Server implementation + */ + +function WebSocketServer(options, callback) { + events.EventEmitter.call(this); + + options = new Options({ + host: '0.0.0.0', + port: null, + server: null, + verifyClient: null, + handleProtocols: null, + path: null, + noServer: false, + disableHixie: false, + clientTracking: true, + perMessageDeflate: true + }).merge(options); + + if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) { + throw new TypeError('`port` or a `server` must be provided'); + } + + var self = this; + + if (options.isDefinedAndNonNull('port')) { + this._server = http.createServer(function (req, res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('Not implemented'); + }); + this._server.listen(options.value.port, options.value.host, callback); + this._closeServer = function() { if (self._server) self._server.close(); }; + } + else if (options.value.server) { + this._server = options.value.server; + if (options.value.path) { + // take note of the path, to avoid collisions when multiple websocket servers are + // listening on the same http server + if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) { + throw new Error('two instances of WebSocketServer cannot listen on the same http server path'); + } + if (typeof this._server._webSocketPaths !== 'object') { + this._server._webSocketPaths = {}; + } + this._server._webSocketPaths[options.value.path] = 1; + } + } + if (this._server) this._server.once('listening', function() { self.emit('listening'); }); + + if (typeof this._server != 'undefined') { + this._server.on('error', function(error) { + self.emit('error', error) + }); + this._server.on('upgrade', function(req, socket, upgradeHead) { + //copy upgradeHead to avoid retention of large slab buffers used in node core + var head = new Buffer(upgradeHead.length); + upgradeHead.copy(head); + + self.handleUpgrade(req, socket, head, function(client) { + self.emit('connection'+req.url, client); + self.emit('connection', client); + }); + }); + } + + this.options = options.value; + this.path = options.value.path; + this.clients = []; +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(WebSocketServer, events.EventEmitter); + +/** + * Immediately shuts down the connection. + * + * @api public + */ + +WebSocketServer.prototype.close = function() { + // terminate all associated clients + var error = null; + try { + for (var i = 0, l = this.clients.length; i < l; ++i) { + this.clients[i].terminate(); + } + } + catch (e) { + error = e; + } + + // remove path descriptor, if any + if (this.path && this._server._webSocketPaths) { + delete this._server._webSocketPaths[this.path]; + if (Object.keys(this._server._webSocketPaths).length == 0) { + delete this._server._webSocketPaths; + } + } + + // close the http server if it was internally created + try { + if (typeof this._closeServer !== 'undefined') { + this._closeServer(); + } + } + finally { + delete this._server; + } + if (error) throw error; +} + +/** + * Handle a HTTP Upgrade request. + * + * @api public + */ + +WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) { + // check for wrong path + if (this.options.path) { + var u = url.parse(req.url); + if (u && u.pathname !== this.options.path) return; + } + + if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments); + else handleHybiUpgrade.apply(this, arguments); +} + +module.exports = WebSocketServer; + +/** + * Entirely private apis, + * which may or may not be bound to a sepcific WebSocket instance. + */ + +function handleHybiUpgrade(req, socket, upgradeHead, cb) { + // handle premature socket errors + var errorHandler = function() { + try { socket.destroy(); } catch (e) {} + } + socket.on('error', errorHandler); + + // verify key presence + if (!req.headers['sec-websocket-key']) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + // verify version + var version = parseInt(req.headers['sec-websocket-version']); + if ([8, 13].indexOf(version) === -1) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + // verify protocol + var protocols = req.headers['sec-websocket-protocol']; + + // verify client + var origin = version < 13 ? + req.headers['sec-websocket-origin'] : + req.headers['origin']; + + // handle extensions offer + var extensionsOffer = Extensions.parse(req.headers['sec-websocket-extensions']); + + // handler to call when the connection sequence completes + var self = this; + var completeHybiUpgrade2 = function(protocol) { + + // calc key + var key = req.headers['sec-websocket-key']; + var shasum = crypto.createHash('sha1'); + shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + key = shasum.digest('base64'); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: websocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Accept: ' + key + ]; + + if (typeof protocol != 'undefined') { + headers.push('Sec-WebSocket-Protocol: ' + protocol); + } + + var extensions = {}; + try { + extensions = acceptExtensions.call(self, extensionsOffer); + } catch (err) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + if (Object.keys(extensions).length) { + var serverExtensions = {}; + Object.keys(extensions).forEach(function(token) { + serverExtensions[token] = [extensions[token].params] + }); + headers.push('Sec-WebSocket-Extensions: ' + Extensions.format(serverExtensions)); + } + + // allows external modification/inspection of handshake headers + self.emit('headers', headers); + + socket.setTimeout(0); + socket.setNoDelay(true); + try { + socket.write(headers.concat('', '').join('\r\n')); + } + catch (e) { + // if the upgrade write fails, shut the connection down hard + try { socket.destroy(); } catch (e) {} + return; + } + + var client = new WebSocket([req, socket, upgradeHead], { + protocolVersion: version, + protocol: protocol, + extensions: extensions + }); + + if (self.options.clientTracking) { + self.clients.push(client); + client.on('close', function() { + var index = self.clients.indexOf(client); + if (index != -1) { + self.clients.splice(index, 1); + } + }); + } + + // signal upgrade complete + socket.removeListener('error', errorHandler); + cb(client); + } + + // optionally call external protocol selection handler before + // calling completeHybiUpgrade2 + var completeHybiUpgrade1 = function() { + // choose from the sub-protocols + if (typeof self.options.handleProtocols == 'function') { + var protList = (protocols || "").split(/, */); + var callbackCalled = false; + var res = self.options.handleProtocols(protList, function(result, protocol) { + callbackCalled = true; + if (!result) abortConnection(socket, 401, 'Unauthorized'); + else completeHybiUpgrade2(protocol); + }); + if (!callbackCalled) { + // the handleProtocols handler never called our callback + abortConnection(socket, 501, 'Could not process protocols'); + } + return; + } else { + if (typeof protocols !== 'undefined') { + completeHybiUpgrade2(protocols.split(/, */)[0]); + } + else { + completeHybiUpgrade2(); + } + } + } + + // optionally call external client verification handler + if (typeof this.options.verifyClient == 'function') { + var info = { + origin: origin, + secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', + req: req + }; + if (this.options.verifyClient.length == 2) { + this.options.verifyClient(info, function(result, code, name) { + if (typeof code === 'undefined') code = 401; + if (typeof name === 'undefined') name = http.STATUS_CODES[code]; + + if (!result) abortConnection(socket, code, name); + else completeHybiUpgrade1(); + }); + return; + } + else if (!this.options.verifyClient(info)) { + abortConnection(socket, 401, 'Unauthorized'); + return; + } + } + + completeHybiUpgrade1(); +} + +function handleHixieUpgrade(req, socket, upgradeHead, cb) { + // handle premature socket errors + var errorHandler = function() { + try { socket.destroy(); } catch (e) {} + } + socket.on('error', errorHandler); + + // bail if options prevent hixie + if (this.options.disableHixie) { + abortConnection(socket, 401, 'Hixie support disabled'); + return; + } + + // verify key presence + if (!req.headers['sec-websocket-key2']) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + var origin = req.headers['origin'] + , self = this; + + // setup handshake completion to run after client has been verified + var onClientVerified = function() { + var wshost; + if (!req.headers['x-forwarded-host']) + wshost = req.headers.host; + else + wshost = req.headers['x-forwarded-host']; + var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url + , protocol = req.headers['sec-websocket-protocol']; + + // handshake completion code to run once nonce has been successfully retrieved + var completeHandshake = function(nonce, rest) { + // calculate key + var k1 = req.headers['sec-websocket-key1'] + , k2 = req.headers['sec-websocket-key2'] + , md5 = crypto.createHash('md5'); + + [k1, k2].forEach(function (k) { + var n = parseInt(k.replace(/[^\d]/g, '')) + , spaces = k.replace(/[^ ]/g, '').length; + if (spaces === 0 || n % spaces !== 0){ + abortConnection(socket, 400, 'Bad Request'); + return; + } + n /= spaces; + md5.update(String.fromCharCode( + n >> 24 & 0xFF, + n >> 16 & 0xFF, + n >> 8 & 0xFF, + n & 0xFF)); + }); + md5.update(nonce.toString('binary')); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: WebSocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Location: ' + location + ]; + if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol); + if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin); + + socket.setTimeout(0); + socket.setNoDelay(true); + try { + // merge header and hash buffer + var headerBuffer = new Buffer(headers.concat('', '').join('\r\n')); + var hashBuffer = new Buffer(md5.digest('binary'), 'binary'); + var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length); + headerBuffer.copy(handshakeBuffer, 0); + hashBuffer.copy(handshakeBuffer, headerBuffer.length); + + // do a single write, which - upon success - causes a new client websocket to be setup + socket.write(handshakeBuffer, 'binary', function(err) { + if (err) return; // do not create client if an error happens + var client = new WebSocket([req, socket, rest], { + protocolVersion: 'hixie-76', + protocol: protocol + }); + if (self.options.clientTracking) { + self.clients.push(client); + client.on('close', function() { + var index = self.clients.indexOf(client); + if (index != -1) { + self.clients.splice(index, 1); + } + }); + } + + // signal upgrade complete + socket.removeListener('error', errorHandler); + cb(client); + }); + } + catch (e) { + try { socket.destroy(); } catch (e) {} + return; + } + } + + // retrieve nonce + var nonceLength = 8; + if (upgradeHead && upgradeHead.length >= nonceLength) { + var nonce = upgradeHead.slice(0, nonceLength); + var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null; + completeHandshake.call(self, nonce, rest); + } + else { + // nonce not present in upgradeHead, so we must wait for enough data + // data to arrive before continuing + var nonce = new Buffer(nonceLength); + upgradeHead.copy(nonce, 0); + var received = upgradeHead.length; + var rest = null; + var handler = function (data) { + var toRead = Math.min(data.length, nonceLength - received); + if (toRead === 0) return; + data.copy(nonce, received, 0, toRead); + received += toRead; + if (received == nonceLength) { + socket.removeListener('data', handler); + if (toRead < data.length) rest = data.slice(toRead); + completeHandshake.call(self, nonce, rest); + } + } + socket.on('data', handler); + } + } + + // verify client + if (typeof this.options.verifyClient == 'function') { + var info = { + origin: origin, + secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', + req: req + }; + if (this.options.verifyClient.length == 2) { + var self = this; + this.options.verifyClient(info, function(result, code, name) { + if (typeof code === 'undefined') code = 401; + if (typeof name === 'undefined') name = http.STATUS_CODES[code]; + + if (!result) abortConnection(socket, code, name); + else onClientVerified.apply(self); + }); + return; + } + else if (!this.options.verifyClient(info)) { + abortConnection(socket, 401, 'Unauthorized'); + return; + } + } + + // no client verification required + onClientVerified(); +} + +function acceptExtensions(offer) { + var extensions = {}; + var options = this.options.perMessageDeflate; + if (options && offer[PerMessageDeflate.extensionName]) { + var perMessageDeflate = new PerMessageDeflate(options !== true ? options : {}, true); + perMessageDeflate.accept(offer[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + return extensions; +} + +function abortConnection(socket, code, name) { + try { + var response = [ + 'HTTP/1.1 ' + code + ' ' + name, + 'Content-type: text/html' + ]; + socket.write(response.concat('', '').join('\r\n')); + } + catch (e) { /* ignore errors - we've aborted this connection */ } + finally { + // ensure that an early aborted connection is shut down completely + try { socket.destroy(); } catch (e) {} + } +} diff --git a/node_modules/ws/lib/browser.js b/node_modules/ws/lib/browser.js new file mode 100644 index 00000000..8d3a755c --- /dev/null +++ b/node_modules/ws/lib/browser.js @@ -0,0 +1,43 @@ + +/** + * Module dependencies. + */ + +var global = (function() { return this; })(); + +/** + * WebSocket constructor. + */ + +var WebSocket = global.WebSocket || global.MozWebSocket; + +/** + * Module exports. + */ + +module.exports = WebSocket ? ws : null; + +/** + * WebSocket constructor. + * + * The third `opts` options object gets ignored in web browsers, since it's + * non-standard, and throws a TypeError if passed to the constructor. + * See: https://github.com/einaros/ws/issues/227 + * + * @param {String} uri + * @param {Array} protocols (optional) + * @param {Object) opts (optional) + * @api public + */ + +function ws(uri, protocols, opts) { + var instance; + if (protocols) { + instance = new WebSocket(uri, protocols); + } else { + instance = new WebSocket(uri); + } + return instance; +} + +if (WebSocket) ws.prototype = WebSocket.prototype; diff --git a/node_modules/ws/node_modules/bufferutil/.npmignore b/node_modules/ws/node_modules/bufferutil/.npmignore new file mode 100644 index 00000000..0c90f673 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/.npmignore @@ -0,0 +1,3 @@ +npm-debug.log +node_modules +build diff --git a/node_modules/ws/node_modules/bufferutil/binding.gyp b/node_modules/ws/node_modules/bufferutil/binding.gyp new file mode 100644 index 00000000..31f41a65 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/binding.gyp @@ -0,0 +1,10 @@ +{ + 'targets': [ + { + 'target_name': 'bufferutil', + 'include_dirs': ["> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_objc = CXX($(TOOLSET)) $@ +cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< + +quiet_cmd_objcxx = CXX($(TOOLSET)) $@ +cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# Commands for precompiled header files. +quiet_cmd_pch_c = CXX($(TOOLSET)) $@ +cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ +cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_m = CXX($(TOOLSET)) $@ +cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< +quiet_cmd_pch_mm = CXX($(TOOLSET)) $@ +cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# gyp-mac-tool is written next to the root Makefile by gyp. +# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd +# already. +quiet_cmd_mac_tool = MACTOOL $(4) $< +cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@" + +quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@ +cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) + +quiet_cmd_infoplist = INFOPLIST $@ +cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = rm -rf "$@" && cp -af "$<" "$@" + +quiet_cmd_alink = LIBTOOL-STATIC $@ +cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 2,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,bufferutil.target.mk)))),) + include bufferutil.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/sirip/Documents/dev/bittorrent-tracker/node_modules/ws/node_modules/bufferutil/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/sirip/.node-gyp/0.12.1/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/sirip/.node-gyp/0.12.1" "-Dmodule_root_dir=/Users/sirip/Documents/dev/bittorrent-tracker/node_modules/ws/node_modules/bufferutil" binding.gyp +Makefile: $(srcdir)/../../../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../.node-gyp/0.12.1/common.gypi + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/bufferutil.node.d b/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/bufferutil.node.d new file mode 100644 index 00000000..70d0a06f --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/bufferutil.node.d @@ -0,0 +1 @@ +cmd_Release/bufferutil.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -bundle -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -o Release/bufferutil.node Release/obj.target/bufferutil/src/bufferutil.o -undefined dynamic_lookup diff --git a/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d b/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d new file mode 100644 index 00000000..05eb3281 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d @@ -0,0 +1,37 @@ +cmd_Release/obj.target/bufferutil/src/bufferutil.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/sirip/.node-gyp/0.12.1/src -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include -I../node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw -c -o Release/obj.target/bufferutil/src/bufferutil.o ../src/bufferutil.cc +Release/obj.target/bufferutil/src/bufferutil.o: ../src/bufferutil.cc \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8.h \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8stdint.h \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8config.h \ + /Users/sirip/.node-gyp/0.12.1/src/node.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_version.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_buffer.h \ + /Users/sirip/.node-gyp/0.12.1/src/smalloc.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_object_wrap.h \ + ../node_modules/nan/nan.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-errno.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-version.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-unix.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-threadpool.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-darwin.h \ + ../node_modules/nan/nan_new.h \ + ../node_modules/nan/nan_implementation_12_inl.h +../src/bufferutil.cc: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8.h: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8stdint.h: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8config.h: +/Users/sirip/.node-gyp/0.12.1/src/node.h: +/Users/sirip/.node-gyp/0.12.1/src/node_version.h: +/Users/sirip/.node-gyp/0.12.1/src/node_buffer.h: +/Users/sirip/.node-gyp/0.12.1/src/smalloc.h: +/Users/sirip/.node-gyp/0.12.1/src/node_object_wrap.h: +../node_modules/nan/nan.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-errno.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-version.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-unix.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-threadpool.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-darwin.h: +../node_modules/nan/nan_new.h: +../node_modules/nan/nan_implementation_12_inl.h: diff --git a/node_modules/ws/node_modules/bufferutil/build/Release/bufferutil.node b/node_modules/ws/node_modules/bufferutil/build/Release/bufferutil.node new file mode 100755 index 00000000..7d235c9c Binary files /dev/null and b/node_modules/ws/node_modules/bufferutil/build/Release/bufferutil.node differ diff --git a/node_modules/ws/node_modules/bufferutil/build/Release/linker.lock b/node_modules/ws/node_modules/bufferutil/build/Release/linker.lock new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/ws/node_modules/bufferutil/build/Release/obj.target/bufferutil/src/bufferutil.o b/node_modules/ws/node_modules/bufferutil/build/Release/obj.target/bufferutil/src/bufferutil.o new file mode 100644 index 00000000..b64651e9 Binary files /dev/null and b/node_modules/ws/node_modules/bufferutil/build/Release/obj.target/bufferutil/src/bufferutil.o differ diff --git a/node_modules/ws/node_modules/bufferutil/build/binding.Makefile b/node_modules/ws/node_modules/bufferutil/build/binding.Makefile new file mode 100644 index 00000000..b532496b --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) bufferutil diff --git a/node_modules/ws/node_modules/bufferutil/build/bufferutil.target.mk b/node_modules/ws/node_modules/bufferutil/build/bufferutil.target.mk new file mode 100644 index 00000000..4fcdab91 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/build/bufferutil.target.mk @@ -0,0 +1,156 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := bufferutil +DEFS_Debug := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' \ + '-DDEBUG' \ + '-D_DEBUG' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -O0 \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Debug := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Debug := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Debug := + +INCS_Debug := \ + -I/Users/sirip/.node-gyp/0.12.1/src \ + -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include \ + -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +DEFS_Release := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' + +# Flags passed to all source files. +CFLAGS_Release := \ + -Os \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Release := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Release := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Release := + +INCS_Release := \ + -I/Users/sirip/.node-gyp/0.12.1/src \ + -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include \ + -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +OBJS := \ + $(obj).target/$(TARGET)/src/bufferutil.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Debug := \ + -Wl,-search_paths_first + +LDFLAGS_Release := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Release := \ + -Wl,-search_paths_first + +LIBS := \ + -undefined dynamic_lookup + +$(builddir)/bufferutil.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(builddir)/bufferutil.node: LIBS := $(LIBS) +$(builddir)/bufferutil.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE)) +$(builddir)/bufferutil.node: TOOLSET := $(TOOLSET) +$(builddir)/bufferutil.node: $(OBJS) FORCE_DO_CMD + $(call do_cmd,solink_module) + +all_deps += $(builddir)/bufferutil.node +# Add target alias +.PHONY: bufferutil +bufferutil: $(builddir)/bufferutil.node + +# Short alias for building this executable. +.PHONY: bufferutil.node +bufferutil.node: $(builddir)/bufferutil.node + +# Add executable to "all" target. +.PHONY: all +all: $(builddir)/bufferutil.node + diff --git a/node_modules/ws/node_modules/bufferutil/build/config.gypi b/node_modules/ws/node_modules/bufferutil/build/config.gypi new file mode 100644 index 00000000..0af2b6d8 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/build/config.gypi @@ -0,0 +1,129 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "clang": 1, + "host_arch": "x64", + "icu_small": "false", + "node_install_npm": "false", + "node_prefix": "/usr/local/Cellar/node/0.12.1", + "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_use_dtrace": "true", + "node_use_etw": "false", + "node_use_mdb": "false", + "node_use_openssl": "true", + "node_use_perfctr": "false", + "openssl_no_asm": 0, + "python": "/usr/local/opt/python/bin/python2.7", + "target_arch": "x64", + "uv_library": "static_library", + "uv_parent_path": "/deps/uv/", + "uv_use_dtrace": "true", + "v8_enable_gdbjit": 0, + "v8_enable_i18n_support": 0, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 0, + "v8_random_seed": 0, + "v8_use_snapshot": "true", + "want_separate_host_toolset": 0, + "nodedir": "/Users/sirip/.node-gyp/0.12.1", + "copy_dev_lib": "true", + "standalone_static_library": 1, + "save_dev": "", + "browser": "", + "viewer": "man", + "rollback": "true", + "usage": "", + "globalignorefile": "/usr/local/etc/npmignore", + "init_author_url": "", + "shell": "/bin/bash", + "parseable": "", + "shrinkwrap": "true", + "init_license": "ISC", + "if_present": "", + "cache_max": "Infinity", + "init_author_email": "", + "sign_git_tag": "", + "cert": "", + "git_tag_version": "true", + "local_address": "", + "long": "", + "fetch_retries": "2", + "npat": "", + "registry": "https://registry.npmjs.org/", + "key": "", + "message": "%s", + "versions": "", + "globalconfig": "/usr/local/etc/npmrc", + "always_auth": "", + "spin": "true", + "cache_lock_retries": "10", + "cafile": "", + "heading": "npm", + "fetch_retry_mintimeout": "10000", + "proprietary_attribs": "true", + "access": "", + "json": "", + "description": "true", + "engine_strict": "", + "https_proxy": "", + "init_module": "/Users/sirip/.npm-init.js", + "userconfig": "/Users/sirip/.npmrc", + "node_version": "0.12.1", + "user": "", + "editor": "vi", + "save": "", + "tag": "latest", + "global": "", + "optional": "true", + "bin_links": "true", + "force": "", + "searchopts": "", + "depth": "", + "rebuild_bundle": "true", + "searchsort": "name", + "unicode": "true", + "fetch_retry_maxtimeout": "60000", + "ca": "", + "save_prefix": "^", + "strict_ssl": "true", + "dev": "", + "fetch_retry_factor": "10", + "group": "20", + "save_exact": "", + "cache_lock_stale": "60000", + "version": "", + "cache_min": "10", + "cache": "/Users/sirip/.npm", + "searchexclude": "", + "color": "true", + "save_optional": "", + "user_agent": "npm/2.7.3 node/v0.12.1 darwin x64", + "ignore_scripts": "", + "cache_lock_wait": "10000", + "production": "", + "save_bundle": "", + "init_version": "1.0.0", + "umask": "0022", + "git": "git", + "init_author_name": "", + "scope": "", + "onload_script": "", + "tmp": "/var/folders/fd/838gnt9x47gd1ylq5_t46zwc0000gt/T", + "unsafe_perm": "true", + "prefix": "/usr/local", + "link": "" + } +} diff --git a/node_modules/ws/node_modules/bufferutil/build/gyp-mac-tool b/node_modules/ws/node_modules/bufferutil/build/gyp-mac-tool new file mode 100755 index 00000000..7abfed5f --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/build/gyp-mac-tool @@ -0,0 +1,512 @@ +#!/usr/bin/env python +# Generated by gyp. Do not edit. +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions to perform Xcode-style build steps. + +These functions are executed via gyp-mac-tool when using the Makefile generator. +""" + +import fcntl +import fnmatch +import glob +import json +import os +import plistlib +import re +import shutil +import string +import subprocess +import sys +import tempfile + + +def main(args): + executor = MacTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class MacTool(object): + """This class performs all the Mac tooling steps. The methods can either be + executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like copy-info-plist to CopyInfoPlist""" + return name_string.title().replace('-', '') + + def ExecCopyBundleResource(self, source, dest): + """Copies a resource file to the bundle/Resources directory, performing any + necessary compilation on each resource.""" + extension = os.path.splitext(source)[1].lower() + if os.path.isdir(source): + # Copy tree. + # TODO(thakis): This copies file attributes like mtime, while the + # single-file branch below doesn't. This should probably be changed to + # be consistent with the single-file branch. + if os.path.exists(dest): + shutil.rmtree(dest) + shutil.copytree(source, dest) + elif extension == '.xib': + return self._CopyXIBFile(source, dest) + elif extension == '.storyboard': + return self._CopyXIBFile(source, dest) + elif extension == '.strings': + self._CopyStringsFile(source, dest) + else: + shutil.copy(source, dest) + + def _CopyXIBFile(self, source, dest): + """Compiles a XIB file with ibtool into a binary plist in the bundle.""" + + # ibtool sometimes crashes with relative paths. See crbug.com/314728. + base = os.path.dirname(os.path.realpath(__file__)) + if os.path.relpath(source): + source = os.path.join(base, source) + if os.path.relpath(dest): + dest = os.path.join(base, dest) + + args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices', + '--output-format', 'human-readable-text', '--compile', dest, source] + ibtool_section_re = re.compile(r'/\*.*\*/') + ibtool_re = re.compile(r'.*note:.*is clipping its content') + ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) + current_section_header = None + for line in ibtoolout.stdout: + if ibtool_section_re.match(line): + current_section_header = line + elif not ibtool_re.match(line): + if current_section_header: + sys.stdout.write(current_section_header) + current_section_header = None + sys.stdout.write(line) + return ibtoolout.returncode + + def _CopyStringsFile(self, source, dest): + """Copies a .strings file using iconv to reconvert the input into UTF-16.""" + input_code = self._DetectInputEncoding(source) or "UTF-8" + + # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call + # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints + # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing + # semicolon in dictionary. + # on invalid files. Do the same kind of validation. + import CoreFoundation + s = open(source, 'rb').read() + d = CoreFoundation.CFDataCreate(None, s, len(s)) + _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None) + if error: + return + + fp = open(dest, 'wb') + fp.write(s.decode(input_code).encode('UTF-16')) + fp.close() + + def _DetectInputEncoding(self, file_name): + """Reads the first few bytes from file_name and tries to guess the text + encoding. Returns None as a guess if it can't detect it.""" + fp = open(file_name, 'rb') + try: + header = fp.read(3) + except e: + fp.close() + return None + fp.close() + if header.startswith("\xFE\xFF"): + return "UTF-16" + elif header.startswith("\xFF\xFE"): + return "UTF-16" + elif header.startswith("\xEF\xBB\xBF"): + return "UTF-8" + else: + return None + + def ExecCopyInfoPlist(self, source, dest, *keys): + """Copies the |source| Info.plist to the destination directory |dest|.""" + # Read the source Info.plist into memory. + fd = open(source, 'r') + lines = fd.read() + fd.close() + + # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). + plist = plistlib.readPlistFromString(lines) + if keys: + plist = dict(plist.items() + json.loads(keys[0]).items()) + lines = plistlib.writePlistToString(plist) + + # Go through all the environment variables and replace them as variables in + # the file. + IDENT_RE = re.compile('[/\s]') + for key in os.environ: + if key.startswith('_'): + continue + evar = '${%s}' % key + evalue = os.environ[key] + lines = string.replace(lines, evar, evalue) + + # Xcode supports various suffices on environment variables, which are + # all undocumented. :rfc1034identifier is used in the standard project + # template these days, and :identifier was used earlier. They are used to + # convert non-url characters into things that look like valid urls -- + # except that the replacement character for :identifier, '_' isn't valid + # in a URL either -- oops, hence :rfc1034identifier was born. + evar = '${%s:identifier}' % key + evalue = IDENT_RE.sub('_', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + evar = '${%s:rfc1034identifier}' % key + evalue = IDENT_RE.sub('-', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + # Remove any keys with values that haven't been replaced. + lines = lines.split('\n') + for i in range(len(lines)): + if lines[i].strip().startswith("${"): + lines[i] = None + lines[i - 1] = None + lines = '\n'.join(filter(lambda x: x is not None, lines)) + + # Write out the file with variables replaced. + fd = open(dest, 'w') + fd.write(lines) + fd.close() + + # Now write out PkgInfo file now that the Info.plist file has been + # "compiled". + self._WritePkgInfo(dest) + + def _WritePkgInfo(self, info_plist): + """This writes the PkgInfo file from the data stored in Info.plist.""" + plist = plistlib.readPlist(info_plist) + if not plist: + return + + # Only create PkgInfo for executable types. + package_type = plist['CFBundlePackageType'] + if package_type != 'APPL': + return + + # The format of PkgInfo is eight characters, representing the bundle type + # and bundle signature, each four characters. If that is missing, four + # '?' characters are used instead. + signature_code = plist.get('CFBundleSignature', '????') + if len(signature_code) != 4: # Wrong length resets everything, too. + signature_code = '?' * 4 + + dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo') + fp = open(dest, 'w') + fp.write('%s%s' % (package_type, signature_code)) + fp.close() + + def ExecFlock(self, lockfile, *cmd_list): + """Emulates the most basic behavior of Linux's flock(1).""" + # Rely on exception handling to report errors. + fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) + fcntl.flock(fd, fcntl.LOCK_EX) + return subprocess.call(cmd_list) + + def ExecFilterLibtool(self, *cmd_list): + """Calls libtool and filters out '/path/to/libtool: file: foo.o has no + symbols'.""" + libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') + libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) + _, err = libtoolout.communicate() + for line in err.splitlines(): + if not libtool_re.match(line): + print >>sys.stderr, line + return libtoolout.returncode + + def ExecPackageFramework(self, framework, version): + """Takes a path to Something.framework and the Current version of that and + sets up all the symlinks.""" + # Find the name of the binary based on the part before the ".framework". + binary = os.path.basename(framework).split('.')[0] + + CURRENT = 'Current' + RESOURCES = 'Resources' + VERSIONS = 'Versions' + + if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)): + # Binary-less frameworks don't seem to contain symlinks (see e.g. + # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle). + return + + # Move into the framework directory to set the symlinks correctly. + pwd = os.getcwd() + os.chdir(framework) + + # Set up the Current version. + self._Relink(version, os.path.join(VERSIONS, CURRENT)) + + # Set up the root symlinks. + self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary) + self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES) + + # Back to where we were before! + os.chdir(pwd) + + def _Relink(self, dest, link): + """Creates a symlink to |dest| named |link|. If |link| already exists, + it is overwritten.""" + if os.path.lexists(link): + os.remove(link) + os.symlink(dest, link) + + def ExecCodeSignBundle(self, key, resource_rules, entitlements, provisioning): + """Code sign a bundle. + + This function tries to code sign an iOS bundle, following the same + algorithm as Xcode: + 1. copy ResourceRules.plist from the user or the SDK into the bundle, + 2. pick the provisioning profile that best match the bundle identifier, + and copy it into the bundle as embedded.mobileprovision, + 3. copy Entitlements.plist from user or SDK next to the bundle, + 4. code sign the bundle. + """ + resource_rules_path = self._InstallResourceRules(resource_rules) + substitutions, overrides = self._InstallProvisioningProfile( + provisioning, self._GetCFBundleIdentifier()) + entitlements_path = self._InstallEntitlements( + entitlements, substitutions, overrides) + subprocess.check_call([ + 'codesign', '--force', '--sign', key, '--resource-rules', + resource_rules_path, '--entitlements', entitlements_path, + os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['FULL_PRODUCT_NAME'])]) + + def _InstallResourceRules(self, resource_rules): + """Installs ResourceRules.plist from user or SDK into the bundle. + + Args: + resource_rules: string, optional, path to the ResourceRules.plist file + to use, default to "${SDKROOT}/ResourceRules.plist" + + Returns: + Path to the copy of ResourceRules.plist into the bundle. + """ + source_path = resource_rules + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'ResourceRules.plist') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], 'ResourceRules.plist') + shutil.copy2(source_path, target_path) + return target_path + + def _InstallProvisioningProfile(self, profile, bundle_identifier): + """Installs embedded.mobileprovision into the bundle. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple containing two dictionary: variables substitutions and values + to overrides when generating the entitlements file. + """ + source_path, provisioning_data, team_id = self._FindProvisioningProfile( + profile, bundle_identifier) + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'embedded.mobileprovision') + shutil.copy2(source_path, target_path) + substitutions = self._GetSubstitutions(bundle_identifier, team_id + '.') + return substitutions, provisioning_data['Entitlements'] + + def _FindProvisioningProfile(self, profile, bundle_identifier): + """Finds the .mobileprovision file to use for signing the bundle. + + Checks all the installed provisioning profiles (or if the user specified + the PROVISIONING_PROFILE variable, only consult it) and select the most + specific that correspond to the bundle identifier. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple of the path to the selected provisioning profile, the data of + the embedded plist in the provisioning profile and the team identifier + to use for code signing. + + Raises: + SystemExit: if no .mobileprovision can be used to sign the bundle. + """ + profiles_dir = os.path.join( + os.environ['HOME'], 'Library', 'MobileDevice', 'Provisioning Profiles') + if not os.path.isdir(profiles_dir): + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + provisioning_profiles = None + if profile: + profile_path = os.path.join(profiles_dir, profile + '.mobileprovision') + if os.path.exists(profile_path): + provisioning_profiles = [profile_path] + if not provisioning_profiles: + provisioning_profiles = glob.glob( + os.path.join(profiles_dir, '*.mobileprovision')) + valid_provisioning_profiles = {} + for profile_path in provisioning_profiles: + profile_data = self._LoadProvisioningProfile(profile_path) + app_id_pattern = profile_data.get( + 'Entitlements', {}).get('application-identifier', '') + for team_identifier in profile_data.get('TeamIdentifier', []): + app_id = '%s.%s' % (team_identifier, bundle_identifier) + if fnmatch.fnmatch(app_id, app_id_pattern): + valid_provisioning_profiles[app_id_pattern] = ( + profile_path, profile_data, team_identifier) + if not valid_provisioning_profiles: + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + # If the user has multiple provisioning profiles installed that can be + # used for ${bundle_identifier}, pick the most specific one (ie. the + # provisioning profile whose pattern is the longest). + selected_key = max(valid_provisioning_profiles, key=lambda v: len(v)) + return valid_provisioning_profiles[selected_key] + + def _LoadProvisioningProfile(self, profile_path): + """Extracts the plist embedded in a provisioning profile. + + Args: + profile_path: string, path to the .mobileprovision file + + Returns: + Content of the plist embedded in the provisioning profile as a dictionary. + """ + with tempfile.NamedTemporaryFile() as temp: + subprocess.check_call([ + 'security', 'cms', '-D', '-i', profile_path, '-o', temp.name]) + return self._LoadPlistMaybeBinary(temp.name) + + def _LoadPlistMaybeBinary(self, plist_path): + """Loads into a memory a plist possibly encoded in binary format. + + This is a wrapper around plistlib.readPlist that tries to convert the + plist to the XML format if it can't be parsed (assuming that it is in + the binary format). + + Args: + plist_path: string, path to a plist file, in XML or binary format + + Returns: + Content of the plist as a dictionary. + """ + try: + # First, try to read the file using plistlib that only supports XML, + # and if an exception is raised, convert a temporary copy to XML and + # load that copy. + return plistlib.readPlist(plist_path) + except: + pass + with tempfile.NamedTemporaryFile() as temp: + shutil.copy2(plist_path, temp.name) + subprocess.check_call(['plutil', '-convert', 'xml1', temp.name]) + return plistlib.readPlist(temp.name) + + def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix): + """Constructs a dictionary of variable substitutions for Entitlements.plist. + + Args: + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + app_identifier_prefix: string, value for AppIdentifierPrefix + + Returns: + Dictionary of substitutions to apply when generating Entitlements.plist. + """ + return { + 'CFBundleIdentifier': bundle_identifier, + 'AppIdentifierPrefix': app_identifier_prefix, + } + + def _GetCFBundleIdentifier(self): + """Extracts CFBundleIdentifier value from Info.plist in the bundle. + + Returns: + Value of CFBundleIdentifier in the Info.plist located in the bundle. + """ + info_plist_path = os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['INFOPLIST_PATH']) + info_plist_data = self._LoadPlistMaybeBinary(info_plist_path) + return info_plist_data['CFBundleIdentifier'] + + def _InstallEntitlements(self, entitlements, substitutions, overrides): + """Generates and install the ${BundleName}.xcent entitlements file. + + Expands variables "$(variable)" pattern in the source entitlements file, + add extra entitlements defined in the .mobileprovision file and the copy + the generated plist to "${BundlePath}.xcent". + + Args: + entitlements: string, optional, path to the Entitlements.plist template + to use, defaults to "${SDKROOT}/Entitlements.plist" + substitutions: dictionary, variable substitutions + overrides: dictionary, values to add to the entitlements + + Returns: + Path to the generated entitlements file. + """ + source_path = entitlements + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['PRODUCT_NAME'] + '.xcent') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], + 'Entitlements.plist') + shutil.copy2(source_path, target_path) + data = self._LoadPlistMaybeBinary(target_path) + data = self._ExpandVariables(data, substitutions) + if overrides: + for key in overrides: + if key not in data: + data[key] = overrides[key] + plistlib.writePlist(data, target_path) + return target_path + + def _ExpandVariables(self, data, substitutions): + """Expands variables "$(variable)" in data. + + Args: + data: object, can be either string, list or dictionary + substitutions: dictionary, variable substitutions to perform + + Returns: + Copy of data where each references to "$(variable)" has been replaced + by the corresponding value found in substitutions, or left intact if + the key was not found. + """ + if isinstance(data, str): + for key, value in substitutions.iteritems(): + data = data.replace('$(%s)' % key, value) + return data + if isinstance(data, list): + return [self._ExpandVariables(v, substitutions) for v in data] + if isinstance(data, dict): + return dict((k, self._ExpandVariables(data[k], + substitutions)) for k in data) + return data + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/node_modules/ws/node_modules/bufferutil/fallback.js b/node_modules/ws/node_modules/bufferutil/fallback.js new file mode 100644 index 00000000..ef4658b0 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/fallback.js @@ -0,0 +1,52 @@ +'use strict'; + +/*! + * bufferutil: WebSocket buffer utils + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.BufferUtil = { + merge: function(mergedBuffer, buffers) { + var offset = 0; + + for (var i = 0, l = buffers.length; i < l; ++i) { + var buf = buffers[i]; + buf.copy(mergedBuffer, offset); + offset += buf.length; + } + }, + mask: function(source, mask, output, offset, length) { + var maskNum = mask.readUInt32LE(0, true); + var i = 0; + + for (; i < length - 3; i += 4) { + var num = maskNum ^ source.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + output.writeUInt32LE(num, offset + i, true); + } + + switch (length % 4) { + case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; + case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; + case 1: output[offset + i] = source[i] ^ mask[0]; + } + }, + unmask: function(data, mask) { + var maskNum = mask.readUInt32LE(0, true); + var length = data.length; + var i = 0; + + for (; i < length - 3; i += 4) { + var num = maskNum ^ data.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + data.writeUInt32LE(num, i, true); + } + + switch (length % 4) { + case 3: data[i + 2] = data[i + 2] ^ mask[2]; + case 2: data[i + 1] = data[i + 1] ^ mask[1]; + case 1: data[i] = data[i] ^ mask[0]; + } + } +}; diff --git a/node_modules/ws/node_modules/bufferutil/index.js b/node_modules/ws/node_modules/bufferutil/index.js new file mode 100644 index 00000000..00c607c6 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/index.js @@ -0,0 +1,7 @@ +'use strict'; + +try { + module.exports = require('bindings')('bufferutil'); +} catch (e) { + module.exports = require('./fallback'); +} diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/bindings/README.md b/node_modules/ws/node_modules/bufferutil/node_modules/bindings/README.md new file mode 100644 index 00000000..585cf512 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/bindings/README.md @@ -0,0 +1,97 @@ +node-bindings +============= +### Helper module for loading your native module's .node file + +This is a helper module for authors of Node.js native addon modules. +It is basically the "swiss army knife" of `require()`ing your native module's +`.node` file. + +Throughout the course of Node's native addon history, addons have ended up being +compiled in a variety of different places, depending on which build tool and which +version of node was used. To make matters worse, now the _gyp_ build tool can +produce either a _Release_ or _Debug_ build, each being built into different +locations. + +This module checks _all_ the possible locations that a native addon would be built +at, and returns the first one that loads successfully. + + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install bindings +``` + +Or add it to the `"dependencies"` section of your _package.json_ file. + + +Example +------- + +`require()`ing the proper bindings file for the current node version, platform +and architecture is as simple as: + +``` js +var bindings = require('bindings')('binding.node') + +// Use your bindings defined in your C files +bindings.your_c_function() +``` + + +Nice Error Output +----------------- + +When the `.node` file could not be loaded, `node-bindings` throws an Error with +a nice error message telling you exactly what was tried. You can also check the +`err.tries` Array property. + +``` +Error: Could not load the bindings file. Tried: + → /Users/nrajlich/ref/build/binding.node + → /Users/nrajlich/ref/build/Debug/binding.node + → /Users/nrajlich/ref/build/Release/binding.node + → /Users/nrajlich/ref/out/Debug/binding.node + → /Users/nrajlich/ref/Debug/binding.node + → /Users/nrajlich/ref/out/Release/binding.node + → /Users/nrajlich/ref/Release/binding.node + → /Users/nrajlich/ref/build/default/binding.node + → /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node + at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13) + at Object. (/Users/nrajlich/ref/lib/ref.js:5:47) + at Module._compile (module.js:449:26) + at Object.Module._extensions..js (module.js:467:10) + at Module.load (module.js:356:32) + at Function.Module._load (module.js:312:12) + ... +``` + + +License +------- + +(The MIT License) + +Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> + +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/node_modules/ws/node_modules/bufferutil/node_modules/bindings/bindings.js b/node_modules/ws/node_modules/bufferutil/node_modules/bindings/bindings.js new file mode 100644 index 00000000..93dcf85a --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/bindings/bindings.js @@ -0,0 +1,166 @@ + +/** + * Module dependencies. + */ + +var fs = require('fs') + , path = require('path') + , join = path.join + , dirname = path.dirname + , exists = fs.existsSync || path.existsSync + , defaults = { + arrow: process.env.NODE_BINDINGS_ARROW || ' → ' + , compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' + , platform: process.platform + , arch: process.arch + , version: process.versions.node + , bindings: 'bindings.node' + , try: [ + // node-gyp's linked version in the "build" dir + [ 'module_root', 'build', 'bindings' ] + // node-waf and gyp_addon (a.k.a node-gyp) + , [ 'module_root', 'build', 'Debug', 'bindings' ] + , [ 'module_root', 'build', 'Release', 'bindings' ] + // Debug files, for development (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Debug', 'bindings' ] + , [ 'module_root', 'Debug', 'bindings' ] + // Release files, but manually compiled (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Release', 'bindings' ] + , [ 'module_root', 'Release', 'bindings' ] + // Legacy from node-waf, node <= 0.4.x + , [ 'module_root', 'build', 'default', 'bindings' ] + // Production "Release" buildtype binary (meh...) + , [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ] + ] + } + +/** + * The main `bindings()` function loads the compiled bindings for a given module. + * It uses V8's Error API to determine the parent filename that this function is + * being invoked from, which is then used to find the root directory. + */ + +function bindings (opts) { + + // Argument surgery + if (typeof opts == 'string') { + opts = { bindings: opts } + } else if (!opts) { + opts = {} + } + opts.__proto__ = defaults + + // Get the module root + if (!opts.module_root) { + opts.module_root = exports.getRoot(exports.getFileName()) + } + + // Ensure the given bindings name ends with .node + if (path.extname(opts.bindings) != '.node') { + opts.bindings += '.node' + } + + var tries = [] + , i = 0 + , l = opts.try.length + , n + , b + , err + + for (; i=1.2.0 <1.3.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "TooTallNate", + "email": "nathan@tootallnate.net" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11", + "tarball": "http://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/.dntrc b/node_modules/ws/node_modules/bufferutil/node_modules/nan/.dntrc new file mode 100644 index 00000000..47971da6 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/.dntrc @@ -0,0 +1,30 @@ +## DNT config file +## see https://github.com/rvagg/dnt + +NODE_VERSIONS="\ + master \ + v0.11.13 \ + v0.10.30 \ + v0.10.29 \ + v0.10.28 \ + 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.8.28 \ + v0.8.27 \ + v0.8.26 \ + v0.8.24 \ +" +OUTPUT_PREFIX="nan-" +TEST_CMD=" \ + cd /dnt/ && \ + npm install && \ + node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild --directory test && \ + node_modules/.bin/tap --gc test/js/*-test.js \ +" + diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/CHANGELOG.md b/node_modules/ws/node_modules/bufferutil/node_modules/nan/CHANGELOG.md new file mode 100644 index 00000000..de0ac02a --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/CHANGELOG.md @@ -0,0 +1,265 @@ +# NAN ChangeLog + +**Version 1.6.2: current Node unstable: 0.11.16, Node stable: 0.10.36, io.js: 1.1.0** + +### 1.6.2 Feb 6 2015 + + - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 + +### 1.6.1 Jan 23 2015 + + - Build: version bump + +### 1.5.3 Jan 23 2015 + + - Build: repackage + +### 1.6.0 Jan 23 2015 + + - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af + - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 + - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 + +### 1.5.2 Jan 23 2015 + + - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 + - Bugfix: Readded missing String constructors 18d828f + - Bugfix: Add overload handling NanNew(..) 5ef813b + - Bugfix: Fix uv_work_cb versioning 997e4ae + - Bugfix: Add function factory and test 4eca89c + - Bugfix: Add object template factory and test cdcb951 + - Correctness: Lifted an io.js related typedef c9490be + - Correctness: Make explicit downcasts of String lengths 00074e6 + - Windows: Limit the scope of disabled warning C4530 83d7deb + +### 1.5.1 Jan 15 2015 + + - Build: version bump + +### 1.4.3 Jan 15 2015 + + - Build: version bump + +### 1.4.2 Jan 15 2015 + + - Feature: Support io.js 0dbc5e8 + +### 1.5.0 Jan 14 2015 + + - Feature: Support io.js b003843 + - Correctness: Improved NanNew internals 9cd4f6a + - Feature: Implement progress to NanAsyncWorker 8d6a160 + +### 1.4.1 Nov 8 2014 + + - Bugfix: Handle DEBUG definition correctly + - Bugfix: Accept int as Boolean + +### 1.4.0 Nov 1 2014 + + - Feature: Added NAN_GC_CALLBACK 6a5c245 + - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 + - Correctness: Added constness to references in NanHasInstance 02c61cd + - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 + - Windoze: Shut Visual Studio up when compiling 8d558c1 + - License: Switch to plain MIT from custom hacked MIT license 11de983 + - Build: Added test target to Makefile e232e46 + - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 + - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 + - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 + +### 1.3.0 Aug 2 2014 + + - Added NanNew(std::string) + - Added NanNew(std::string&) + - Added NanAsciiString helper class + - Added NanUtf8String helper class + - Added NanUcs2String helper class + - Deprecated NanRawString() + - Deprecated NanCString() + - Added NanGetIsolateData(v8::Isolate *isolate) + - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) + - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) + - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + +### 1.2.0 Jun 5 2014 + + - Add NanSetPrototypeTemplate + - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, + introduced _NanWeakCallbackDispatcher + - Removed -Wno-unused-local-typedefs from test builds + - Made test builds Windows compatible ('Sleep()') + +### 1.1.2 May 28 2014 + + - Release to fix more stuff-ups in 1.1.1 + +### 1.1.1 May 28 2014 + + - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 + +### 1.1.0 May 25 2014 + + - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead + - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), + (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, + v8::String::ExternalAsciiStringResource* + - Deprecate NanSymbol() + - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker + +### 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(v8::Handle value) for use in place of + v8::Local::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 ` 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) to NanThrowError(Handle) + - 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::Handle) + - 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 argument + - Added `NanNewBufferHandle` with single uint32_t argument + - Added `NanHasInstance(Persistent&, Handle)` + - Added `Local NanCallback#GetFunction()` + - Added `NanCallback#Call(int, Local[])` + - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/LICENSE.md b/node_modules/ws/node_modules/bufferutil/node_modules/nan/LICENSE.md new file mode 100644 index 00000000..95c2eb5f --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/LICENSE.md @@ -0,0 +1,13 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2015 NAN contributors +----------------------------------- + +*NAN contributors listed at * + +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/node_modules/ws/node_modules/bufferutil/node_modules/nan/appveyor.yml b/node_modules/ws/node_modules/bufferutil/node_modules/nan/appveyor.yml new file mode 100644 index 00000000..17771078 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/appveyor.yml @@ -0,0 +1,37 @@ +# http://www.appveyor.com/docs/appveyor-yml + +# Test against these versions of Io.js and Node.js. +environment: + matrix: + # node.js + - nodejs_version: "0.8" + - nodejs_version: "0.10" + - nodejs_version: "0.11" + # io.js + - nodejs_version: "1" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node 0.STABLE.latest + - ps: if($env:nodejs_version -eq "0.8") {Install-Product node $env:nodejs_version} + - ps: if($env:nodejs_version -ne "0.8") {Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)} + - IF NOT %nodejs_version% == 1 npm -g install npm + - IF NOT %nodejs_version% == 1 set PATH=%APPDATA%\npm;%PATH% + # Typical npm stuff. + - npm install + - IF %nodejs_version% == 0.8 node node_modules\node-gyp\bin\node-gyp.js rebuild --directory test + - IF NOT %nodejs_version% == 0.8 npm run rebuild-tests + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm test + +# Don't actually build. +build: off + +# Set build version format here instead of in the admin panel. +version: "{build}" diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/include_dirs.js b/node_modules/ws/node_modules/bufferutil/node_modules/nan/include_dirs.js new file mode 100644 index 00000000..4f1dfb41 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/include_dirs.js @@ -0,0 +1 @@ +console.log(require('path').relative('.', __dirname)); diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan.h b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan.h new file mode 100644 index 00000000..e95a3b3e --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan.h @@ -0,0 +1,2174 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors: + * - Rod Vagg + * - Benjamin Byholm + * - Trevor Norris + * - Nathan Rajlich + * - Brett Lawson + * - Ben Noordhuis + * - David Siegel + * + * MIT License + * + * Version 1.6.2: current Node unstable: 0.11.16, Node stable: 0.10.36, io.js: 1.1.0 + * + * See https://github.com/rvagg/nan for the latest update to this file + **********************************************************************************/ + +#ifndef NAN_H_ +#define NAN_H_ + +#include +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +#if defined(__GNUC__) && !(defined(DEBUG) && DEBUG) +# define NAN_INLINE inline __attribute__((always_inline)) +#elif defined(_MSC_VER) && !(defined(DEBUG) && DEBUG) +# define NAN_INLINE __forceinline +#else +# define NAN_INLINE inline +#endif + +#if defined(__GNUC__) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __declspec(deprecated) +#else +# define NAN_DEPRECATED +#endif + +#if (NODE_MODULE_VERSION < 12) +typedef v8::InvocationCallback NanFunctionCallback; +typedef v8::Script NanUnboundScript; +typedef v8::Script NanBoundScript; +#else +typedef v8::FunctionCallback NanFunctionCallback; +typedef v8::UnboundScript NanUnboundScript; +typedef v8::Script NanBoundScript; +#endif + +#if (NODE_MODULE_VERSION < 42) +typedef v8::String::ExternalAsciiStringResource + NanExternalOneByteStringResource; +#else // io.js v1.0.0 +typedef v8::String::ExternalOneByteStringResource + NanExternalOneByteStringResource; +#endif + +#include "nan_new.h" // NOLINT(build/include) + +// uv helpers +#ifdef UV_VERSION_MAJOR +#ifndef UV_VERSION_PATCH +#define UV_VERSION_PATCH 0 +#endif +#define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \ + (UV_VERSION_MINOR << 8) | \ + (UV_VERSION_PATCH)) +#else +#define NAUV_UVVERSION 0x000b00 +#endif + + +#if NAUV_UVVERSION < 0x000b17 +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async, int) +#else +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async) +#endif + +// some generic helpers + +template NAN_INLINE bool NanSetPointerSafe( + T *var + , T val +) { + if (var) { + *var = val; + return true; + } else { + return false; + } +} + +template NAN_INLINE T NanGetPointerSafe( + T *var + , T fallback = reinterpret_cast(0) +) { + if (var) { + return *var; + } else { + return fallback; + } +} + +NAN_INLINE bool NanBooleanOptionValue( + v8::Local optionsObj + , v8::Handle 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 optionsObj + , v8::Handle opt +) { + return NanBooleanOptionValue(optionsObj, opt, false); +} + +NAN_INLINE uint32_t NanUInt32OptionValue( + v8::Local optionsObj + , v8::Handle opt + , uint32_t def +) { + return !optionsObj.IsEmpty() + && optionsObj->Has(opt) + && optionsObj->Get(opt)->IsNumber() + ? optionsObj->Get(opt)->Uint32Value() + : def; +} + +template +v8::Local NanNew(v8::Handle); + +template +NAN_INLINE v8::Local _NanEnsureLocal(v8::Handle val) { + return NanNew(val); +} + +template +NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { + return val; +} + +/* io.js 1.0 */ +#if NODE_MODULE_VERSION >= 42 || NODE_VERSION_AT_LEAST(0, 11, 15) + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::Isolate::GetCurrent()->SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::Isolate::GetCurrent()->LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::Isolate::GetCurrent()->ContextDisposedNotification(); + } +#else + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::V8::SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::V8::SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::V8::SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::V8::IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::V8::LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::V8::ContextDisposedNotification(); + } +#endif + +#if (NODE_MODULE_VERSION > 0x000B) +// Node 0.11+ (0.11.12 and below won't compile with these) + +# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo& +# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args +# define _NAN_METHOD_RETURN_TYPE void + +# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +# define _NAN_GETTER_RETURN_TYPE void + +# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args +# define _NAN_SETTER_RETURN_TYPE void + +# define _NAN_PROPERTY_GETTER_ARGS_TYPE \ + const v8::PropertyCallbackInfo& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args +# define _NAN_INDEX_QUERY_RETURN_TYPE void + +# define NanScope() v8::HandleScope scope(v8::Isolate::GetCurrent()) +# define NanEscapableScope() \ + v8::EscapableHandleScope scope(v8::Isolate::GetCurrent()) + +# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) +# define NanLocker() v8::Locker locker(v8::Isolate::GetCurrent()) +# define NanUnlocker() v8::Unlocker unlocker(v8::Isolate::GetCurrent()) +# define NanReturnValue(value) return args.GetReturnValue().Set(value) +# define NanReturnUndefined() return +# define NanReturnHolder() NanReturnValue(args.Holder()) +# define NanReturnThis() NanReturnValue(args.This()) +# define NanReturnNull() return args.GetReturnValue().SetNull() +# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString() + +# define NanObjectWrapHandle(obj) obj->handle() + + NAN_INLINE v8::Local NanUndefined() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanNull() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanTrue() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanFalse() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE int NanAdjustExternalMemory(int bc) { + return static_cast( + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , const char *name + , v8::Handle value) { + templ->Set(v8::Isolate::GetCurrent(), name, value); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + NAN_INLINE v8::Local NanGetCurrentContext() { + return v8::Isolate::GetCurrent()->GetCurrentContext(); + } + + NAN_INLINE void* NanGetInternalFieldPointer( + v8::Handle object + , int index) { + return object->GetAlignedPointerFromInternalField(index); + } + + NAN_INLINE void NanSetInternalFieldPointer( + v8::Handle object + , int index + , void* value) { + object->SetAlignedPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) + + NAN_INLINE void NanAddGCEpilogueCallback( + v8::Isolate::GCEpilogueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); + } + + NAN_INLINE void NanRemoveGCEpilogueCallback( + v8::Isolate::GCEpilogueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); + } + + NAN_INLINE void NanAddGCPrologueCallback( + v8::Isolate::GCPrologueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); + } + + NAN_INLINE void NanRemoveGCPrologueCallback( + v8::Isolate::GCPrologueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); + } + + NAN_INLINE void NanGetHeapStatistics( + v8::HeapStatistics *heap_statistics) { + v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( + const char* data, int length = -1) { + return NanNew(data, length); + } + + template + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , v8::Handle obj) { + handle.Reset(v8::Isolate::GetCurrent(), obj); + } + + template + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , const v8::Persistent& obj) { + handle.Reset(v8::Isolate::GetCurrent(), obj); + } + + template + class _NanWeakCallbackData; + + template + struct _NanWeakCallbackInfo { + typedef void (*Callback)(const _NanWeakCallbackData& data); + NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) + : parameter(param), callback(cb) { + NanAssignPersistent(persistent, handle); + } + + NAN_INLINE ~_NanWeakCallbackInfo() { + persistent.Reset(); + } + + P* const parameter; + Callback const callback; + v8::Persistent persistent; + }; + + template + class _NanWeakCallbackData { + public: + NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) + : info_(info) { } + + NAN_INLINE v8::Local GetValue() const { + return NanNew(info_->persistent); + } + + NAN_INLINE P* GetParameter() const { return info_->parameter; } + + NAN_INLINE bool IsNearDeath() const { + return info_->persistent.IsNearDeath(); + } + + NAN_INLINE void Revive() const; + + NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { + return info_; + } + + NAN_DEPRECATED NAN_INLINE void Dispose() const { + } + + private: + _NanWeakCallbackInfo* info_; + }; + + template + static void _NanWeakCallbackDispatcher( + const v8::WeakCallbackData > &data) { + _NanWeakCallbackInfo *info = data.GetParameter(); + _NanWeakCallbackData wcbd(info); + info->callback(wcbd); + if (wcbd.IsNearDeath()) { + delete wcbd.GetCallbackInfo(); + } + } + + template + NAN_INLINE void _NanWeakCallbackData::Revive() const { + info_->persistent.SetWeak(info_, &_NanWeakCallbackDispatcher); + } + +template +NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( + v8::Handle handle + , P* parameter + , typename _NanWeakCallbackInfo::Callback callback) { + _NanWeakCallbackInfo *cbinfo = + new _NanWeakCallbackInfo(handle, parameter, callback); + cbinfo->persistent.SetWeak(cbinfo, &_NanWeakCallbackDispatcher); + return cbinfo; +} + +# define NAN_WEAK_CALLBACK(name) \ + template \ + static void name(const _NanWeakCallbackData &data) + +# define _NAN_ERROR(fun, errmsg) fun(NanNew(errmsg)) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + v8::Isolate::GetCurrent()->ThrowException(_NAN_ERROR(fun, errmsg)); \ + } while (0); + + NAN_INLINE v8::Local 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 error) { + NanScope(); + v8::Isolate::GetCurrent()->ThrowException(error); + } + + NAN_INLINE v8::Local NanError( + const char *msg + , const int errorNumber + ) { + v8::Local err = v8::Exception::Error(NanNew(msg)); + v8::Local obj = err.As(); + obj->Set(NanNew("code"), NanNew(errorNumber)); + return err; + } + + NAN_INLINE void NanThrowError( + const char *msg + , const int errorNumber + ) { + NanThrowError(NanError(msg, errorNumber)); + } + + NAN_INLINE v8::Local 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 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 NAN_INLINE void NanDisposePersistent( + v8::Persistent &handle + ) { + handle.Reset(); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + char *data + , size_t length + , node::smalloc::FreeCallback callback + , void *hint + ) { + return node::Buffer::New( + v8::Isolate::GetCurrent(), data, length, callback, hint); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + const char *data + , uint32_t size + ) { + return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); + } + + NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { + return node::Buffer::New(v8::Isolate::GetCurrent(), size); + } + + NAN_INLINE v8::Local NanBufferUse( + char* data + , uint32_t size + ) { + return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); + } + + NAN_INLINE bool NanHasInstance( + const v8::Persistent& function_template + , v8::Handle value + ) { + return NanNew(function_template)->HasInstance(value); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle() + ) { + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + return v8::Local::New( + isolate + , v8::Context::New(isolate, extensions, tmpl, obj) + ); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + v8::ScriptCompiler::Source source(s, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + ) { + v8::ScriptCompiler::Source source(s); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + NAN_INLINE v8::Local NanRunScript( + v8::Handle script + ) { + return script->BindToCurrentContext()->Run(); + } + + NAN_INLINE v8::Local NanRunScript( + v8::Handle script + ) { + return script->Run(); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle func + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv)); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle symbol + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv)); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , const char* method + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv)); + } + + template + NAN_INLINE void NanSetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(0, data); + } + + template + NAN_INLINE T *NanGetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData(0)); + } + + class NanAsciiString { + public: + NAN_INLINE explicit NanAsciiString(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new char[size + 1]; + size = toStr->WriteOneByte(reinterpret_cast(buf)); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanAsciiString() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanAsciiString(const NanAsciiString&); + void operator=(const NanAsciiString&); + + char *buf; + int size; + }; + + class NanUtf8String { + public: + NAN_INLINE explicit NanUtf8String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Utf8Length(); + buf = new char[size + 1]; + toStr->WriteUtf8(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanUtf8String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUtf8String(const NanUtf8String&); + void operator=(const NanUtf8String&); + + char *buf; + int size; + }; + + class NanUcs2String { + public: + NAN_INLINE explicit NanUcs2String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new uint16_t[size + 1]; + toStr->Write(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE uint16_t* operator*() { return buf; } + NAN_INLINE const uint16_t* operator*() const { return buf; } + + NAN_INLINE ~NanUcs2String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUcs2String(const NanUcs2String&); + void operator=(const NanUcs2String&); + + uint16_t *buf; + int size; + }; + +#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 + +# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo & +# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +# define _NAN_GETTER_RETURN_TYPE v8::Handle + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + + NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( + const char* data, int length = -1) { + return v8::String::NewSymbol(data, length); + } + +# 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 NanReturnHolder() NanReturnValue(args.Holder()) +# define NanReturnThis() NanReturnValue(args.This()) +# define NanReturnUndefined() return v8::Undefined() +# define NanReturnNull() return v8::Null() +# define NanReturnEmptyString() return v8::String::Empty() +# define NanObjectWrapHandle(obj) v8::Local::New(obj->handle_) + + NAN_INLINE v8::Local NanUndefined() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Undefined())); + } + + NAN_INLINE v8::Local NanNull() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Null())); + } + + NAN_INLINE v8::Local NanTrue() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::True())); + } + + NAN_INLINE v8::Local NanFalse() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::False())); + } + + NAN_INLINE int NanAdjustExternalMemory(int bc) { + return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , const char *name + , v8::Handle value) { + templ->Set(name, value); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + NAN_INLINE v8::Local NanGetCurrentContext() { + return v8::Context::GetCurrent(); + } + + NAN_INLINE void* NanGetInternalFieldPointer( + v8::Handle object + , int index) { + return object->GetPointerFromInternalField(index); + } + + NAN_INLINE void NanSetInternalFieldPointer( + v8::Handle object + , int index + , void* value) { + object->SetPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::GCType type, v8::GCCallbackFlags flags) + + 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 + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , v8::Handle obj) { + handle.Dispose(); + handle = v8::Persistent::New(obj); + } + + template + class _NanWeakCallbackData; + + template + struct _NanWeakCallbackInfo { + typedef void (*Callback)(const _NanWeakCallbackData &data); + NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) + : parameter(param) + , callback(cb) + , persistent(v8::Persistent::New(handle)) { } + + NAN_INLINE ~_NanWeakCallbackInfo() { + persistent.Dispose(); + persistent.Clear(); + } + + P* const parameter; + Callback const callback; + v8::Persistent persistent; + }; + + template + class _NanWeakCallbackData { + public: + NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) + : info_(info) { } + + NAN_INLINE v8::Local GetValue() const { + return NanNew(info_->persistent); + } + + NAN_INLINE P* GetParameter() const { return info_->parameter; } + + NAN_INLINE bool IsNearDeath() const { + return info_->persistent.IsNearDeath(); + } + + NAN_INLINE void Revive() const; + + NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { + return info_; + } + + NAN_DEPRECATED NAN_INLINE void Dispose() const { + } + + private: + _NanWeakCallbackInfo* info_; + }; + + template + static void _NanWeakPersistentDispatcher( + v8::Persistent object, void *data) { + _NanWeakCallbackInfo* info = + static_cast<_NanWeakCallbackInfo*>(data); + _NanWeakCallbackData wcbd(info); + info->callback(wcbd); + if (wcbd.IsNearDeath()) { + delete wcbd.GetCallbackInfo(); + } + } + + template + NAN_INLINE void _NanWeakCallbackData::Revive() const { + info_->persistent.MakeWeak( + info_ + , &_NanWeakPersistentDispatcher); + } + + template + NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( + v8::Handle handle + , P* parameter + , typename _NanWeakCallbackInfo::Callback callback) { + _NanWeakCallbackInfo *cbinfo = + new _NanWeakCallbackInfo(handle, parameter, callback); + cbinfo->persistent.MakeWeak( + cbinfo + , &_NanWeakPersistentDispatcher); + return cbinfo; + } + +# define NAN_WEAK_CALLBACK(name) \ + template \ + static void name(const _NanWeakCallbackData &data) + +# define _NAN_ERROR(fun, errmsg) \ + fun(v8::String::New(errmsg)) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + return v8::Local::New( \ + v8::ThrowException(_NAN_ERROR(fun, errmsg))); \ + } while (0); + + NAN_INLINE v8::Local NanError(const char* errmsg) { + return _NAN_ERROR(v8::Exception::Error, errmsg); + } + + NAN_INLINE v8::Local NanThrowError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::Error, errmsg); + } + + NAN_INLINE v8::Local NanThrowError( + v8::Handle error + ) { + NanScope(); + return v8::Local::New(v8::ThrowException(error)); + } + + NAN_INLINE v8::Local NanError( + const char *msg + , const int errorNumber + ) { + v8::Local err = v8::Exception::Error(v8::String::New(msg)); + v8::Local obj = err.As(); + obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber)); + return err; + } + + NAN_INLINE v8::Local NanThrowError( + const char *msg + , const int errorNumber + ) { + return NanThrowError(NanError(msg, errorNumber)); + } + + NAN_INLINE v8::Local NanTypeError(const char* errmsg) { + return _NAN_ERROR(v8::Exception::TypeError, errmsg); + } + + NAN_INLINE v8::Local NanThrowTypeError( + const char* errmsg + ) { + _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); + } + + NAN_INLINE v8::Local NanRangeError( + const char* errmsg + ) { + return _NAN_ERROR(v8::Exception::RangeError, errmsg); + } + + NAN_INLINE v8::Local NanThrowRangeError( + const char* errmsg + ) { + _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); + } + + template + NAN_INLINE void NanDisposePersistent( + v8::Persistent &handle) { // NOLINT(runtime/references) + handle.Dispose(); + handle.Clear(); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + char *data + , size_t length + , node::Buffer::free_callback callback + , void *hint + ) { + return NanNew( + node::Buffer::New(data, length, callback, hint)->handle_); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + const char *data + , uint32_t size + ) { +#if NODE_MODULE_VERSION >= 0x000B + return NanNew(node::Buffer::New(data, size)->handle_); +#else + return NanNew( + node::Buffer::New(const_cast(data), size)->handle_); +#endif + } + + NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { + return NanNew(node::Buffer::New(size)->handle_); + } + + NAN_INLINE void FreeData(char *data, void *hint) { + delete[] data; + } + + NAN_INLINE v8::Local NanBufferUse( + char* data + , uint32_t size + ) { + return NanNew( + node::Buffer::New(data, size, FreeData, NULL)->handle_); + } + + NAN_INLINE bool NanHasInstance( + const v8::Persistent& function_template + , v8::Handle value + ) { + return function_template->HasInstance(value); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle() + ) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = NanNew(ctx); + ctx.Dispose(); + return lctx; + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + return v8::Script::Compile(s, const_cast(&origin)); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + ) { + return v8::Script::Compile(s); + } + + NAN_INLINE v8::Local NanRunScript(v8::Handle script) { + return script->Run(); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle func + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, func, argc, argv)); +# else + v8::TryCatch try_catch; + v8::Local result = func->Call(target, argc, argv); + if (try_catch.HasCaught()) { + node::FatalException(try_catch); + } + return result; +# endif + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle symbol + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, symbol, argc, argv)); +# else + v8::Local callback = target->Get(symbol).As(); + return NanMakeCallback(target, callback, argc, argv); +# endif + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , const char* method + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, method, argc, argv)); +# else + return NanMakeCallback(target, NanNew(method), argc, argv); +# endif + } + + template + NAN_INLINE void NanSetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(data); + } + + template + NAN_INLINE T *NanGetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData()); + } + + class NanAsciiString { + public: + NAN_INLINE explicit NanAsciiString(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new char[size + 1]; + size = toStr->WriteAscii(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanAsciiString() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanAsciiString(const NanAsciiString&); + void operator=(const NanAsciiString&); + + char *buf; + int size; + }; + + class NanUtf8String { + public: + NAN_INLINE explicit NanUtf8String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Utf8Length(); + buf = new char[size + 1]; + toStr->WriteUtf8(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanUtf8String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUtf8String(const NanUtf8String&); + void operator=(const NanUtf8String&); + + char *buf; + int size; + }; + + class NanUcs2String { + public: + NAN_INLINE explicit NanUcs2String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new uint16_t[size + 1]; + toStr->Write(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE uint16_t* operator*() { return buf; } + NAN_INLINE const uint16_t* operator*() const { return buf; } + + NAN_INLINE ~NanUcs2String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUcs2String(const NanUcs2String&); + void operator=(const NanUcs2String&); + + uint16_t *buf; + int size; + }; + +#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 property \ + , _NAN_GETTER_ARGS) +#define NAN_SETTER(name) \ + _NAN_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local value \ + , _NAN_SETTER_ARGS) +#define NAN_PROPERTY_GETTER(name) \ + _NAN_PROPERTY_GETTER_RETURN_TYPE name( \ + v8::Local property \ + , _NAN_PROPERTY_GETTER_ARGS) +#define NAN_PROPERTY_SETTER(name) \ + _NAN_PROPERTY_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local 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 property \ + , _NAN_PROPERTY_DELETER_ARGS) +#define NAN_PROPERTY_QUERY(name) \ + _NAN_PROPERTY_QUERY_RETURN_TYPE name( \ + v8::Local 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 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 obj = NanNew(); + NanAssignPersistent(handle, obj); + } + + explicit NanCallback(const v8::Handle &fn) { + NanScope(); + v8::Local obj = NanNew(); + NanAssignPersistent(handle, obj); + SetFunction(fn); + } + + ~NanCallback() { + if (handle.IsEmpty()) return; + NanDisposePersistent(handle); + } + + NAN_INLINE void SetFunction(const v8::Handle &fn) { + NanScope(); + NanNew(handle)->Set(kCallbackIndex, fn); + } + + NAN_INLINE v8::Local GetFunction() const { + NanEscapableScope(); + return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex) + .As()); + } + + NAN_INLINE bool IsEmpty() const { + NanScope(); + return NanNew(handle)->Get(kCallbackIndex)->IsUndefined(); + } + + v8::Handle Call(int argc, v8::Handle argv[]) const { + NanEscapableScope(); +#if (NODE_MODULE_VERSION > 0x000B) // 0.11.12+ + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Local callback = NanNew(handle)-> + Get(kCallbackIndex).As(); + return NanEscapeScope(node::MakeCallback( + isolate + , isolate->GetCurrentContext()->Global() + , callback + , argc + , argv + )); +#else +#if NODE_VERSION_AT_LEAST(0, 8, 0) + v8::Local callback = handle-> + Get(kCallbackIndex).As(); + return NanEscapeScope(node::MakeCallback( + v8::Context::GetCurrent()->Global() + , callback + , argc + , argv + )); +#else + v8::Local callback = handle-> + Get(kCallbackIndex).As(); + return NanEscapeScope(NanMakeCallback( + v8::Context::GetCurrent()->Global(), callback, argc, argv)); +#endif +#endif + } + + private: + v8::Persistent handle; + static const uint32_t kCallbackIndex = 0; +}; + +/* abstract */ class NanAsyncWorker { + public: + explicit NanAsyncWorker(NanCallback *callback_) + : callback(callback_), errmsg_(NULL) { + request.data = this; + + NanScope(); + v8::Local obj = NanNew(); + 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, const v8::Local &obj) { + v8::Local handle = NanNew(persistentHandle); + handle->Set(NanNew(key), obj); + } + + v8::Local GetFromPersistent(const char *key) const { + NanEscapableScope(); + v8::Local handle = NanNew(persistentHandle); + return NanEscapeScope(handle->Get(NanNew(key)).As()); + } + + virtual void Execute() = 0; + + uv_work_t request; + + virtual void Destroy() { + delete this; + } + + protected: + v8::Persistent persistentHandle; + NanCallback *callback; + + virtual void HandleOKCallback() { + callback->Call(0, NULL); + } + + virtual void HandleErrorCallback() { + NanScope(); + + v8::Local argv[] = { + v8::Exception::Error(NanNew(ErrorMessage())) + }; + callback->Call(1, argv); + } + + void SetErrorMessage(const char *msg) { + if (errmsg_) { + delete[] errmsg_; + } + + size_t size = strlen(msg) + 1; + errmsg_ = new char[size]; + memcpy(errmsg_, msg, size); + } + + const char* ErrorMessage() const { + return errmsg_; + } + + private: + char *errmsg_; +}; + +/* abstract */ class NanAsyncProgressWorker : public NanAsyncWorker { + public: + explicit NanAsyncProgressWorker(NanCallback *callback_) + : NanAsyncWorker(callback_), asyncdata_(NULL), asyncsize_(0) { + async = new uv_async_t; + uv_async_init( + uv_default_loop() + , async + , AsyncProgress_ + ); + async->data = this; + + uv_mutex_init(&async_lock); + } + + virtual ~NanAsyncProgressWorker() { + uv_mutex_destroy(&async_lock); + + if (asyncdata_) { + delete[] asyncdata_; + } + } + + void WorkProgress() { + uv_mutex_lock(&async_lock); + char *data = asyncdata_; + size_t size = asyncsize_; + asyncdata_ = NULL; + uv_mutex_unlock(&async_lock); + + // Dont send progress events after we've already completed. + if (callback) { + HandleProgressCallback(data, size); + } + delete[] data; + } + + class ExecutionProgress { + friend class NanAsyncProgressWorker; + public: + // You could do fancy generics with templates here. + void Send(const char* data, size_t size) const { + that_->SendProgress_(data, size); + } + + private: + explicit ExecutionProgress(NanAsyncProgressWorker* that) : that_(that) {} + // Prohibit copying and assignment. + ExecutionProgress(const ExecutionProgress&); + void operator=(const ExecutionProgress&); + #if __cplusplus >= 201103L + // Prohibit C++11 move semantics. + ExecutionProgress(ExecutionProgress&&) = delete; + void operator=(ExecutionProgress&&) = delete; + #endif + NanAsyncProgressWorker* const that_; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void HandleProgressCallback(const char *data, size_t size) = 0; + + virtual void Destroy() { + uv_close(reinterpret_cast(async), AsyncClose_); + } + + private: + void Execute() /*final override*/ { + ExecutionProgress progress(this); + Execute(progress); + } + + void SendProgress_(const char *data, size_t size) { + char *new_data = new char[size]; + memcpy(new_data, data, size); + + uv_mutex_lock(&async_lock); + char *old_data = asyncdata_; + asyncdata_ = new_data; + asyncsize_ = size; + uv_mutex_unlock(&async_lock); + + if (old_data) { + delete[] old_data; + } + uv_async_send(async); + } + + NAN_INLINE static NAUV_WORK_CB(AsyncProgress_) { + NanAsyncProgressWorker *worker = + static_cast(async->data); + worker->WorkProgress(); + } + + NAN_INLINE static void AsyncClose_(uv_handle_t* handle) { + NanAsyncProgressWorker *worker = + static_cast(handle->data); + delete reinterpret_cast(handle); + delete worker; + } + + uv_async_t *async; + uv_mutex_t async_lock; + char *asyncdata_; + size_t asyncsize_; +}; + +NAN_INLINE void NanAsyncExecute (uv_work_t* req) { + NanAsyncWorker *worker = static_cast(req->data); + worker->Execute(); +} + +NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) { + NanAsyncWorker* worker = static_cast(req->data); + worker->WorkComplete(); + worker->Destroy(); +} + +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 +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 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 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(-1); +} + +template 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; +} + +namespace NanIntern { + +inline +NanExternalOneByteStringResource const* +GetExternalResource(v8::Local str) { +#if NODE_MODULE_VERSION < 42 + return str->GetExternalAsciiStringResource(); +#else // io.js v1.0.0 + return str->GetExternalOneByteStringResource(); +#endif +} + +inline +bool +IsExternal(v8::Local str) { +#if NODE_MODULE_VERSION < 42 + return str->IsExternalAscii(); +#else // io.js v1.0.0 + return str->IsExternalOneByte(); +#endif +} + +} // end of namespace NanIntern + +static bool _NanGetExternalParts( + v8::Handle val + , const char** data + , size_t* len +) { + if (node::Buffer::HasInstance(val)) { + *data = node::Buffer::Data(val.As()); + *len = node::Buffer::Length(val.As()); + return true; + } + + assert(val->IsString()); + v8::Local str = NanNew(val.As()); + + if (NanIntern::IsExternal(str)) { + const NanExternalOneByteStringResource* ext; + ext = NanIntern::GetExternalResource(str); + *data = ext->data(); + *len = ext->length(); + return true; + } + + if (str->IsExternal()) { + const v8::String::ExternalStringResource* ext; + ext = str->GetExternalStringResource(); + *data = reinterpret_cast(ext->data()); + *len = ext->length(); + return true; + } + + return false; +} + +namespace Nan { + enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; +} + +#if !NODE_VERSION_AT_LEAST(0, 10, 0) +# include "nan_string_bytes.h" // NOLINT(build/include) +#endif + +NAN_INLINE v8::Local NanEncode( + const void *buf, size_t len, enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION >= 42) + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + node::encoding node_enc = static_cast(encoding); + + if (encoding == Nan::UCS2) { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len / 2); + } else { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len + , node_enc); + } +#elif (NODE_MODULE_VERSION > 0x000B) + return node::Encode( + v8::Isolate::GetCurrent() + , buf, len + , static_cast(encoding)); +#else +# if NODE_VERSION_AT_LEAST(0, 10, 0) + return node::Encode(buf, len, static_cast(encoding)); +# else + return NanIntern::Encode(reinterpret_cast(buf), len, encoding); +# endif +#endif +} + +NAN_INLINE ssize_t NanDecodeBytes( + v8::Handle val, enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION > 0x000B) + return node::DecodeBytes( + v8::Isolate::GetCurrent() + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < 0x000B) + if (encoding == Nan::BUFFER) { + return node::DecodeBytes(val, node::BINARY); + } +# endif + return node::DecodeBytes(val, static_cast(encoding)); +#endif +} + +NAN_INLINE ssize_t NanDecodeWrite( + char *buf + , size_t len + , v8::Handle val + , enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION > 0x000B) + return node::DecodeWrite( + v8::Isolate::GetCurrent() + , buf + , len + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < 0x000B) + if (encoding == Nan::BUFFER) { + return node::DecodeWrite(buf, len, val, node::BINARY); + } +# endif + return node::DecodeWrite( + buf + , len + , val + , static_cast(encoding)); +#endif +} + +/* NAN_DEPRECATED */ NAN_INLINE void* _NanRawString( + v8::Handle 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(&data) + , &len); + + if (is_extern && !term_len) { + NanSetPointerSafe(datalen, len); + return data; + } + + v8::Local toStr = from->ToString(); + + char *to = static_cast(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( + datalen + , toStr->WriteAscii(to, 0, static_cast(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 somelen = toStr->Write(twobytebuf, 0, + static_cast(sz_ + term_len), flags); + + for (size_t i = 0; i < sz_ + term_len && i < somelen + term_len; i++) { + unsigned char *b = reinterpret_cast(&twobytebuf[i]); + to[i] = *b; + } + + NanSetPointerSafe(datalen, somelen); + + delete[] twobytebuf; + return to; + } +#else + NanSetPointerSafe( + datalen, + toStr->WriteOneByte( + reinterpret_cast(to) + , 0 + , static_cast(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( + datalen + , toStr->WriteUtf8(to, static_cast(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( + 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(to) + , 0 + , static_cast(sz_ + term_len) + , flags); + NanSetPointerSafe(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( + 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_DEPRECATED NAN_INLINE void* NanRawString( + v8::Handle from + , enum Nan::Encoding encoding + , size_t *datalen + , void *buf + , size_t buflen + , int flags +) { + return _NanRawString(from, encoding, datalen, buf, buflen, flags); +} + + +NAN_DEPRECATED NAN_INLINE char* NanCString( + v8::Handle from + , size_t *datalen + , char *buf = NULL + , size_t buflen = 0 + , int flags = v8::String::NO_OPTIONS +) { + return static_cast( + _NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags) + ); +} + +NAN_INLINE void NanSetPrototypeTemplate( + v8::Local templ + , const char *name + , v8::Handle value +) { + NanSetTemplate(templ->PrototypeTemplate(), name, value); +} + +NAN_INLINE void NanSetPrototypeTemplate( + v8::Local templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes +) { + NanSetTemplate(templ->PrototypeTemplate(), name, value, attributes); +} + +NAN_INLINE void NanSetInstanceTemplate( + v8::Local templ + , const char *name + , v8::Handle value +) { + NanSetTemplate(templ->InstanceTemplate(), name, value); +} + +NAN_INLINE void NanSetInstanceTemplate( + v8::Local templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes +) { + NanSetTemplate(templ->InstanceTemplate(), name, value, attributes); +} + +//=== Export ================================================================== + +inline +void +NanExport(v8::Handle target, const char * name, + NanFunctionCallback f) { + target->Set(NanNew(name), + NanNew(f)->GetFunction()); +} + +//=== Tap Reverse Binding ===================================================== + +struct NanTap { + explicit NanTap(v8::Handle t) : t_() { + NanAssignPersistent(t_, t->ToObject()); + } + + ~NanTap() { NanDisposePersistent(t_); } // not sure if neccessary + + inline void plan(int i) { + v8::Handle arg = NanNew(i); + NanMakeCallback(NanNew(t_), "plan", 1, &arg); + } + + inline void ok(bool isOk, const char * msg = NULL) { + v8::Handle args[2]; + args[0] = NanNew(isOk); + if (msg) args[1] = NanNew(msg); + NanMakeCallback(NanNew(t_), "ok", msg ? 2 : 1, args); + } + + private: + v8::Persistent t_; +}; + +#define NAN_STRINGIZE2(x) #x +#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) +#define NAN_TEST_EXPRESSION(expression) \ + ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression + +#define return_NanValue(v) NanReturnValue(v) +#define return_NanUndefined() NanReturnUndefined() +#define NAN_EXPORT(target, function) NanExport(target, #function, function) + +#endif // NAN_H_ diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_12_inl.h b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_12_inl.h new file mode 100644 index 00000000..ff63ec0c --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_12_inl.h @@ -0,0 +1,262 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_12_INL_H_ +#define NAN_IMPLEMENTATION_12_INL_H_ +//============================================================================== +// node v0.11 implementation +//============================================================================== + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +namespace NanIntern { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(v8::Isolate::GetCurrent(), length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(v8::Isolate::GetCurrent(), value); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Handle tmpl + , v8::Handle obj) { + return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj); +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(v8::Isolate::GetCurrent(), value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(v8::Isolate::GetCurrent(), value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data) { + return v8::Function::New( v8::Isolate::GetCurrent() + , callback + , data); +} + +//=== Function Template ======================================================== + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data + , v8::Handle signature) { + return v8::FunctionTemplate::New( v8::Isolate::GetCurrent() + , callback + , data + , signature); +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(v8::Isolate::GetCurrent(), value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New( v8::Isolate::GetCurrent() + , value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(v8::Isolate::GetCurrent(), value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(v8::Isolate::GetCurrent()); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(v8::Isolate::GetCurrent()); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Handle pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New( Factory::FTH receiver + , int argc + , Factory::FTH argv[]) { + return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), + value.data(), v8::String::kNormalString, static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint8_t * value, int length) { + return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +Factory::return_t +Factory::New(NanExternalOneByteStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Handle value) { + return v8::StringObject::New(value).As(); +} + +//=== Unbound Script =========================================================== + +Factory::return_t +Factory::New(v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +} // end of namespace NanIntern + +//=== Presistents and Handles ================================================== + +template +inline v8::Local NanNew(v8::Handle h) { + return v8::Local::New(v8::Isolate::GetCurrent(), h); +} + +template +inline v8::Local NanNew(v8::Persistent const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +#endif // NAN_IMPLEMENTATION_12_INL_H_ diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_pre_12_inl.h b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_pre_12_inl.h new file mode 100644 index 00000000..85dd2754 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_implementation_pre_12_inl.h @@ -0,0 +1,268 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_ +#define NAN_IMPLEMENTATION_PRE_12_INL_H_ + +#include + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# include +# pragma warning( default : 4530 ) +#else +# include +# include +#endif + +//============================================================================== +// node v0.10 implementation +//============================================================================== + +namespace NanIntern { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(value)->ToBoolean(); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Handle tmpl + , v8::Handle obj) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = v8::Local::New(ctx); + ctx.Dispose(); + return lctx; +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data) { + return Factory::New( callback + , data + , v8::Handle() + )->GetFunction(); +} + + +//=== FunctionTemplate ========================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data + , v8::Handle signature) { + // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find + // a way. Have at it though... + return v8::FunctionTemplate::New( callback + , data + , signature); +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New(value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Handle pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + return v8::Script::New(source); +} +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + return v8::Script::New(source, const_cast(&origin)); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New( Factory::FTH receiver + , int argc + , Factory::FTH argv[]) { + return v8::Signature::New(receiver, argc, argv); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::New( value.data(), static_cast(value.size())); +} + +inline +void +widenString(std::vector *ws, const uint8_t *s, int l = -1) { + size_t len = static_cast(l); + if (l < 0) { + len = strlen(reinterpret_cast(s)); + } + assert(len <= INT_MAX && "string too long"); + ws->resize(len); + std::copy(s, s + len, ws->begin()); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(const uint8_t * value, int length) { + std::vector wideString; + widenString(&wideString, value, length); + if (wideString.size() == 0) { + return v8::String::Empty(); + } else { + return v8::String::New(&wideString.front() + , static_cast(wideString.size())); + } +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(value); +} + +Factory::return_t +Factory::New(v8::String::ExternalAsciiStringResource * value) { + return v8::String::NewExternal(value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Handle value) { + return v8::StringObject::New(value).As(); +} + +} // end of namespace NanIntern + +//=== Presistents and Handles ================================================== + +template +inline v8::Local NanNew(v8::Handle h) { + return v8::Local::New(h); +} + +template +inline v8::Local NanNew(v8::Persistent const& p) { + return v8::Local::New(p); +} + +#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_ diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_new.h b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_new.h new file mode 100644 index 00000000..95b6b51e --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_new.h @@ -0,0 +1,329 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_NEW_H_ +#define NAN_NEW_H_ + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +namespace NanIntern { // scnr + +// TODO(agnat): Generalize +template v8::Local To(v8::Handle i); + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToInteger(); } + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToInt32(); } + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToUint32(); } + +template struct FactoryBase { typedef v8::Local return_t; }; + +template struct Factory; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(int length); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(void *value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( NanFunctionCallback callback + , v8::Handle data = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( NanFunctionCallback callback = NULL + , v8::Handle data = v8::Handle() + , v8::Handle signature = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template +struct IntegerFactory : FactoryBase { + typedef typename FactoryBase::return_t return_t; + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New( + v8::Handle pattern, v8::RegExp::Flags flags); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +template <> +struct Factory : FactoryBase { + typedef v8::Handle FTH; + static inline + return_t + New( FTH receiver = FTH(), int argc = 0, FTH argv[] = NULL ); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(const char *value, int length = -1); + static inline return_t New(const uint16_t *value, int length = -1); + static inline return_t New(std::string const& value); + + static inline return_t New(v8::String::ExternalStringResource * value); + static inline return_t New(NanExternalOneByteStringResource * value); + + // TODO(agnat): Deprecate. + static inline return_t New(const uint8_t * value, int length = -1); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(v8::Handle value); +}; + +} // end of namespace NanIntern + +#if (NODE_MODULE_VERSION >= 12) + +namespace NanIntern { + +template <> +struct Factory : FactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +} // end of namespace NanIntern + +# include "nan_implementation_12_inl.h" + +#else // NODE_MODULE_VERSION >= 12 + +# include "nan_implementation_pre_12_inl.h" + +#endif + +//=== API ====================================================================== + +template +typename NanIntern::Factory::return_t +NanNew() { + return NanIntern::Factory::New(); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0) { + return NanIntern::Factory::New(arg0); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1) { + return NanIntern::Factory::New(arg0, arg1); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1, A2 arg2) { + return NanIntern::Factory::New(arg0, arg1, arg2); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1, A2 arg2, A3 arg3) { + return NanIntern::Factory::New(arg0, arg1, arg2, arg3); +} + +// Note(agnat): When passing overloaded function pointers to template functions +// as generic arguments the compiler needs help in picking the right overload. +// These two functions handle NanNew and NanNew with +// all argument variations. + +// v8::Function and v8::FunctionTemplate with one or two arguments +template +typename NanIntern::Factory::return_t +NanNew( NanFunctionCallback callback + , v8::Handle data = v8::Handle()) { + return NanIntern::Factory::New(callback, data); +} + +// v8::Function and v8::FunctionTemplate with three arguments +template +typename NanIntern::Factory::return_t +NanNew( NanFunctionCallback callback + , v8::Handle data = v8::Handle() + , A2 a2 = A2()) { + return NanIntern::Factory::New(callback, data, a2); +} + +// Convenience + +template inline v8::Local NanNew(v8::Handle h); +template inline v8::Local NanNew(v8::Persistent const& p); + +inline +NanIntern::Factory::return_t +NanNew(bool value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(int32_t value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(uint32_t value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(double value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(std::string const& value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const char * value, int length) { + return NanNew(value, length); +} + +inline +NanIntern::Factory::return_t +NanNew(const char * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const uint8_t * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const uint16_t * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(v8::String::ExternalStringResource * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(NanExternalOneByteStringResource * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(v8::Handle pattern, v8::RegExp::Flags flags) { + return NanNew(pattern, flags); +} + +#endif // NAN_NEW_H_ diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_string_bytes.h b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_string_bytes.h new file mode 100644 index 00000000..9deecfbb --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/nan_string_bytes.h @@ -0,0 +1,312 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +#ifndef NAN_STRING_BYTES_H_ +#define NAN_STRING_BYTES_H_ + +// Decodes a v8::Handle or Buffer to a raw char* + +#include +#include +#include +#include // memcpy +#include + +namespace NanIntern { + +using v8::Local; +using v8::Handle; +using v8::Object; +using v8::String; +using v8::Value; + + +//// Base 64 //// + +#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) + + + +//// Nan::HEX //// + +static bool contains_non_ascii_slow(const char* buf, size_t len) { + for (size_t i = 0; i < len; ++i) { + if (buf[i] & 0x80) return true; + } + return false; +} + + +static bool contains_non_ascii(const char* src, size_t len) { + if (len < 16) { + return contains_non_ascii_slow(src, len); + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned unaligned = reinterpret_cast(src) & align_mask; + + if (unaligned > 0) { + const unsigned n = bytes_per_word - unaligned; + if (contains_non_ascii_slow(src, n)) return true; + src += n; + len -= n; + } + + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = 0x8080808080808080ll; +#else + const uintptr_t mask = 0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + if (srcw[i] & mask) return true; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + if (contains_non_ascii_slow(src + offset, remainder)) return true; + } + + return false; +} + + +static void force_ascii_slow(const char* src, char* dst, size_t len) { + for (size_t i = 0; i < len; ++i) { + dst[i] = src[i] & 0x7f; + } +} + + +static void force_ascii(const char* src, char* dst, size_t len) { + if (len < 16) { + force_ascii_slow(src, dst, len); + return; + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned src_unalign = reinterpret_cast(src) & align_mask; + const unsigned dst_unalign = reinterpret_cast(dst) & align_mask; + + if (src_unalign > 0) { + if (src_unalign == dst_unalign) { + const unsigned unalign = bytes_per_word - src_unalign; + force_ascii_slow(src, dst, unalign); + src += unalign; + dst += unalign; + len -= src_unalign; + } else { + force_ascii_slow(src, dst, len); + return; + } + } + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = ~0x8080808080808080ll; +#else + const uintptr_t mask = ~0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + uintptr_t* dstw = reinterpret_cast(dst); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + dstw[i] = srcw[i] & mask; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + force_ascii_slow(src + offset, dst + offset, remainder); + } +} + + +static size_t base64_encode(const char* src, + size_t slen, + char* dst, + size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= base64_encoded_size(slen) && + "not enough space provided for base64 encode"); + + dlen = base64_encoded_size(slen); + + unsigned a; + unsigned b; + unsigned c; + unsigned i; + unsigned k; + unsigned n; + + static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + + i = 0; + k = 0; + n = slen / 3 * 3; + + while (i < n) { + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + c = src[i + 2] & 0xff; + + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; + dst[k + 3] = table[c & 0x3f]; + + i += 3; + k += 4; + } + + if (n != slen) { + switch (slen - n) { + case 1: + a = src[i + 0] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[(a & 3) << 4]; + dst[k + 2] = '='; + dst[k + 3] = '='; + break; + + case 2: + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[(b & 0x0f) << 2]; + dst[k + 3] = '='; + break; + } + } + + return dlen; +} + + +static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= slen * 2 && + "not enough space provided for hex encode"); + + dlen = slen * 2; + for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { + static const char hex[] = "0123456789abcdef"; + uint8_t val = static_cast(src[i]); + dst[k + 0] = hex[val >> 4]; + dst[k + 1] = hex[val & 15]; + } + + return dlen; +} + + + +static Local Encode(const char* buf, + size_t buflen, + enum Nan::Encoding encoding) { + assert(buflen <= node::Buffer::kMaxLength); + if (!buflen && encoding != Nan::BUFFER) + return NanNew(""); + + Local val; + switch (encoding) { + case Nan::BUFFER: + return NanNewBufferHandle(buf, buflen); + + case Nan::ASCII: + if (contains_non_ascii(buf, buflen)) { + char* out = new char[buflen]; + force_ascii(buf, out, buflen); + val = NanNew(out, buflen); + delete[] out; + } else { + val = NanNew(buf, buflen); + } + break; + + case Nan::UTF8: + val = NanNew(buf, buflen); + break; + + case Nan::BINARY: { + // TODO(isaacs) use ExternalTwoByteString? + const unsigned char *cbuf = reinterpret_cast(buf); + uint16_t * twobytebuf = new uint16_t[buflen]; + for (size_t i = 0; i < buflen; i++) { + // XXX is the following line platform independent? + twobytebuf[i] = cbuf[i]; + } + val = NanNew(twobytebuf, buflen); + delete[] twobytebuf; + break; + } + + case Nan::BASE64: { + size_t dlen = base64_encoded_size(buflen); + char* dst = new char[dlen]; + + size_t written = base64_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = NanNew(dst, dlen); + delete[] dst; + break; + } + + case Nan::UCS2: { + const uint16_t* data = reinterpret_cast(buf); + val = NanNew(data, buflen / 2); + break; + } + + case Nan::HEX: { + size_t dlen = buflen * 2; + char* dst = new char[dlen]; + size_t written = hex_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = NanNew(dst, dlen); + delete[] dst; + break; + } + + default: + assert(0 && "unknown encoding"); + break; + } + + return val; +} + +#undef base64_encoded_size + +} // namespace NanIntern + +#endif // NAN_STRING_BYTES_H_ diff --git a/node_modules/ws/node_modules/bufferutil/node_modules/nan/package.json b/node_modules/ws/node_modules/bufferutil/node_modules/nan/package.json new file mode 100644 index 00000000..02953f62 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/node_modules/nan/package.json @@ -0,0 +1,89 @@ +{ + "name": "nan", + "version": "1.6.2", + "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" + }, + "scripts": { + "test": "tap --gc test/js/*-test.js", + "rebuild-tests": "pangyp rebuild --directory test" + }, + "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" + }, + { + "name": "David Siegel", + "email": "david@artcom.de", + "url": "https://github.com/agnat" + } + ], + "devDependencies": { + "bindings": "~1.2.1", + "node-gyp": "~1.0.2", + "pangyp": "~2.0.1", + "tap": "~0.5.0", + "xtend": "~4.0.0" + }, + "license": "MIT", + "gitHead": "ab0e5eed8d4aa36111bf8f44cf75644ece327e98", + "bugs": { + "url": "https://github.com/rvagg/nan/issues" + }, + "homepage": "https://github.com/rvagg/nan", + "_id": "nan@1.6.2", + "_shasum": "2657d1c43b00f1e847e083832285b7d8f5ba8ec8", + "_from": "nan@>=1.6.0 <1.7.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + }, + "maintainers": [ + { + "name": "rvagg", + "email": "rod@vagg.org" + }, + { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + } + ], + "dist": { + "shasum": "2657d1c43b00f1e847e083832285b7d8f5ba8ec8", + "tarball": "http://registry.npmjs.org/nan/-/nan-1.6.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/nan/-/nan-1.6.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/ws/node_modules/bufferutil/package.json b/node_modules/ws/node_modules/bufferutil/package.json new file mode 100644 index 00000000..c958cf62 --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/package.json @@ -0,0 +1,55 @@ +{ + "name": "bufferutil", + "version": "1.0.1", + "description": "WebSocket buffer utils", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "install": "node-gyp rebuild" + }, + "repository": { + "type": "git", + "url": "https://github.com/websockets/bufferutil" + }, + "keywords": [ + "bufferutil" + ], + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/websockets/bufferutil/issues" + }, + "homepage": "https://github.com/websockets/bufferutil", + "dependencies": { + "bindings": "1.2.x", + "nan": "1.6.x" + }, + "gypfile": true, + "gitHead": "3bbb6f23193fae7683b61e2cae1f85ede5fb4469", + "_id": "bufferutil@1.0.1", + "_shasum": "0c53a9ffe8d616c4e2df27d00b808f7a25501e3b", + "_from": "bufferutil@>=1.0.0 <1.1.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + }, + "maintainers": [ + { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + } + ], + "dist": { + "shasum": "0c53a9ffe8d616c4e2df27d00b808f7a25501e3b", + "tarball": "http://registry.npmjs.org/bufferutil/-/bufferutil-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/ws/node_modules/bufferutil/src/bufferutil.cc b/node_modules/ws/node_modules/bufferutil/src/bufferutil.cc new file mode 100644 index 00000000..bd6f368f --- /dev/null +++ b/node_modules/ws/node_modules/bufferutil/src/bufferutil.cc @@ -0,0 +1,121 @@ +/*! + * bufferutil: WebSocket buffer utils + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nan.h" + +using namespace v8; +using namespace node; + +class BufferUtil : public ObjectWrap +{ +public: + + static void Initialize(v8::Handle target) + { + NanScope(); + Local t = NanNew(New); + t->InstanceTemplate()->SetInternalFieldCount(1); + NODE_SET_METHOD(t, "unmask", BufferUtil::Unmask); + NODE_SET_METHOD(t, "mask", BufferUtil::Mask); + NODE_SET_METHOD(t, "merge", BufferUtil::Merge); + target->Set(NanNew("BufferUtil"), t->GetFunction()); + } + +protected: + + static NAN_METHOD(New) + { + NanScope(); + BufferUtil* bufferUtil = new BufferUtil(); + bufferUtil->Wrap(args.This()); + NanReturnValue(args.This()); + } + + static NAN_METHOD(Merge) + { + NanScope(); + Local bufferObj = args[0]->ToObject(); + char* buffer = Buffer::Data(bufferObj); + Local array = Local::Cast(args[1]); + unsigned int arrayLength = array->Length(); + size_t offset = 0; + unsigned int i; + for (i = 0; i < arrayLength; ++i) { + Local src = array->Get(i)->ToObject(); + size_t length = Buffer::Length(src); + memcpy(buffer + offset, Buffer::Data(src), length); + offset += length; + } + NanReturnValue(NanTrue()); + } + + static NAN_METHOD(Unmask) + { + NanScope(); + Local buffer_obj = args[0]->ToObject(); + size_t length = Buffer::Length(buffer_obj); + Local mask_obj = args[1]->ToObject(); + unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); + unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); + size_t len32 = length / 4; + unsigned int i; + for (i = 0; i < len32; ++i) *(from + i) ^= *mask; + from += i; + switch (length % 4) { + case 3: *((unsigned char*)from+2) = *((unsigned char*)from+2) ^ ((unsigned char*)mask)[2]; + case 2: *((unsigned char*)from+1) = *((unsigned char*)from+1) ^ ((unsigned char*)mask)[1]; + case 1: *((unsigned char*)from ) = *((unsigned char*)from ) ^ ((unsigned char*)mask)[0]; + case 0:; + } + NanReturnValue(NanTrue()); + } + + static NAN_METHOD(Mask) + { + NanScope(); + Local buffer_obj = args[0]->ToObject(); + Local mask_obj = args[1]->ToObject(); + unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); + Local output_obj = args[2]->ToObject(); + unsigned int dataOffset = args[3]->Int32Value(); + unsigned int length = args[4]->Int32Value(); + unsigned int* to = (unsigned int*)(Buffer::Data(output_obj) + dataOffset); + unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); + unsigned int len32 = length / 4; + unsigned int i; + for (i = 0; i < len32; ++i) *(to + i) = *(from + i) ^ *mask; + to += i; + from += i; + switch (length % 4) { + case 3: *((unsigned char*)to+2) = *((unsigned char*)from+2) ^ *((unsigned char*)mask+2); + case 2: *((unsigned char*)to+1) = *((unsigned char*)from+1) ^ *((unsigned char*)mask+1); + case 1: *((unsigned char*)to ) = *((unsigned char*)from ) ^ *((unsigned char*)mask); + case 0:; + } + NanReturnValue(NanTrue()); + } +}; + +#if !NODE_VERSION_AT_LEAST(0,10,0) +extern "C" +#endif +void init (Handle target) +{ + NanScope(); + BufferUtil::Initialize(target); +} + +NODE_MODULE(bufferutil, init) + diff --git a/node_modules/ws/node_modules/options/.npmignore b/node_modules/ws/node_modules/options/.npmignore new file mode 100644 index 00000000..1b18fb39 --- /dev/null +++ b/node_modules/ws/node_modules/options/.npmignore @@ -0,0 +1,7 @@ +npm-debug.log +node_modules +.*.swp +.lock-* +build/ + +test diff --git a/node_modules/ws/node_modules/options/Makefile b/node_modules/ws/node_modules/options/Makefile new file mode 100644 index 00000000..7496b6fc --- /dev/null +++ b/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/node_modules/ws/node_modules/options/README.md b/node_modules/ws/node_modules/options/README.md new file mode 100644 index 00000000..0dabc755 --- /dev/null +++ b/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 <einaros@gmail.com> + +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/node_modules/ws/node_modules/options/lib/options.js b/node_modules/ws/node_modules/options/lib/options.js new file mode 100644 index 00000000..4fc45e90 --- /dev/null +++ b/node_modules/ws/node_modules/options/lib/options.js @@ -0,0 +1,86 @@ +/*! + * Copyright(c) 2011 Einar Otto Stangvik + * 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/node_modules/ws/node_modules/options/package.json b/node_modules/ws/node_modules/options/package.json new file mode 100644 index 00000000..7a62d8e3 --- /dev/null +++ b/node_modules/ws/node_modules/options/package.json @@ -0,0 +1,51 @@ +{ + "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", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/ws/node_modules/ultron/.npmignore b/node_modules/ws/node_modules/ultron/.npmignore new file mode 100644 index 00000000..66210a2a --- /dev/null +++ b/node_modules/ws/node_modules/ultron/.npmignore @@ -0,0 +1,3 @@ +node_modules +coverage +.tern-port diff --git a/node_modules/ws/node_modules/ultron/.travis.yml b/node_modules/ws/node_modules/ultron/.travis.yml new file mode 100644 index 00000000..a6e97419 --- /dev/null +++ b/node_modules/ws/node_modules/ultron/.travis.yml @@ -0,0 +1,17 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.11" +before_install: + - "npm install -g npm@1.4.x" +script: + - "npm run test-travis" +after_script: + - "npm install coveralls@2.11.x && cat coverage/lcov.info | coveralls" +notifications: + irc: + channels: + - "irc.freenode.org#unshift" + on_success: change + on_failure: change diff --git a/node_modules/ws/node_modules/ultron/README.md b/node_modules/ws/node_modules/ultron/README.md new file mode 100644 index 00000000..84fa3f23 --- /dev/null +++ b/node_modules/ws/node_modules/ultron/README.md @@ -0,0 +1,97 @@ +# Ultron + +[![Made by unshift](https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square)](http://unshift.io)[![Version npm](http://img.shields.io/npm/v/ultron.svg?style=flat-square)](http://browsenpm.org/package/ultron)[![Build Status](http://img.shields.io/travis/unshiftio/ultron/master.svg?style=flat-square)](https://travis-ci.org/unshiftio/ultron)[![Dependencies](https://img.shields.io/david/unshiftio/ultron.svg?style=flat-square)](https://david-dm.org/unshiftio/ultron)[![Coverage Status](http://img.shields.io/coveralls/unshiftio/ultron/master.svg?style=flat-square)](https://coveralls.io/r/unshiftio/ultron?branch=master)[![IRC channel](http://img.shields.io/badge/IRC-irc.freenode.net%23unshift-00a8ff.svg?style=flat-square)](http://webchat.freenode.net/?channels=unshift) + +Ultron is a high-intelligence robot. It gathers intelligence so it can start +improving upon his rudimentary design. It will learn your event emitting +patterns and find ways to exterminate them. Allowing you to remove only the +event emitters that **you** assigned and not the ones that your users or +developers assigned. This can prevent race conditions, memory leaks and even file +descriptor leaks from ever happening as you won't remove clean up processes. + +## Installation + +The module is designed to be used in browsers using browserify and in Node.js. +You can install the module through the public npm registry by running the +following command in CLI: + +``` +npm install --save ultron +``` + +## Usage + +In all examples we assume that you've required the library as following: + +```js +'use strict'; + +var Ultron = require('ultron'); +``` + +Now that we've required the library we can construct our first `Ultron` instance. +The constructor requires one argument which should be the `EventEmitter` +instance that we need to operate upon. This can be the `EventEmitter` module +that ships with Node.js or `EventEmitter3` or anything else as long as it +follow the same API and internal structure as these 2. So with that in mind we +can create the instance: + +```js +// +// For the sake of this example we're going to construct an empty EventEmitter +// +var EventEmitter = require('events').EventEmitter; // or require('eventmitter3'); +var events = new EventEmitter(); + +var ultron = new Ultron(events); +``` + +You can now use the following API's from the Ultron instance: + +### Ultron.on + +Register a new event listener for the given event. It follows the exact same API +as `EventEmitter.on` but it will return itself instead of returning the +EventEmitter instance. If you are using EventEmitter3 it also supports the +context param: + +```js +ultron.on('event-name', handler, { custom: 'function context' }); +``` + +### Ultron.once + +Exactly the same as the [Ultron.on](#ultronon) but it only allows the execution +once. + +### Ultron.remove + +This is where all the magic happens and the safe removal starts. This function +accepts different argument styles: + +- No arguments, assume that all events need to be removed so it will work as + `removeAllListeners()` API. +- 1 argument, when it's a string it will be split on ` ` and `,` to create a + list of events that need to be cleared. +- Multiple arguments, we assume that they are all names of events that need to + be cleared. + +```js +ultron.remove('foo, bar baz'); // Removes foo, bar and baz. +ultron.remove('foo', 'bar', 'baz'); // Removes foo, bar and baz. +ultron.remove(); // Removes everything. +``` + +If you just want to remove a single event listener using a function reference +you can still use the EventEmitter's `removeListener(event, fn)` API: + +```js +function foo() {} + +ulton.on('foo', foo); +events.removeListener('foo', foo); +``` + +## License + +MIT diff --git a/node_modules/ws/node_modules/ultron/index.js b/node_modules/ws/node_modules/ultron/index.js new file mode 100644 index 00000000..f0e8113e --- /dev/null +++ b/node_modules/ws/node_modules/ultron/index.js @@ -0,0 +1,125 @@ +'use strict'; + +/** + * An auto incrementing id which we can use to create "unique" Ultron instances + * so we can track the event emitters that are added through the Ultron + * interface. + * + * @type {Number} + * @private + */ +var id = 0; + +/** + * Ultron is high-intelligence robot. It gathers intelligence so it can start improving + * upon his rudimentary design. It will learn from your EventEmitting patterns + * and exterminate them. + * + * @constructor + * @param {EventEmitter} ee EventEmitter instance we need to wrap. + * @api public + */ +function Ultron(ee) { + if (!(this instanceof Ultron)) return new Ultron(ee); + + this.id = id++; + this.ee = ee; +} + +/** + * Register a new EventListener for the given event. + * + * @param {String} event Name of the event. + * @param {Functon} fn Callback function. + * @param {Mixed} context The context of the function. + * @returns {Ultron} + * @api public + */ +Ultron.prototype.on = function on(event, fn, context) { + fn.__ultron = this.id; + this.ee.on(event, fn, context); + + return this; +}; +/** + * Add an EventListener that's only called once. + * + * @param {String} event Name of the event. + * @param {Function} fn Callback function. + * @param {Mixed} context The context of the function. + * @returns {Ultron} + * @api public + */ +Ultron.prototype.once = function once(event, fn, context) { + fn.__ultron = this.id; + this.ee.once(event, fn, context); + + return this; +}; + +/** + * Remove the listeners we assigned for the given event. + * + * @returns {Ultron} + * @api public + */ +Ultron.prototype.remove = function remove() { + var args = arguments + , event; + + // + // When no event names are provided we assume that we need to clear all the + // events that were assigned through us. + // + if (args.length === 1 && 'string' === typeof args[0]) { + args = args[0].split(/[, ]+/); + } else if (!args.length) { + args = []; + + for (event in this.ee._events) { + if (this.ee._events.hasOwnProperty(event)) { + args.push(event); + } + } + } + + for (var i = 0; i < args.length; i++) { + var listeners = this.ee.listeners(args[i]); + + for (var j = 0; j < listeners.length; j++) { + event = listeners[j]; + + if (event.listener) { + if (event.listener.__ultron !== this.id) continue; + delete event.listener.__ultron; + } else { + if (event.__ultron !== this.id) continue; + delete event.__ultron; + } + + this.ee.removeListener(args[i], event); + } + } + + return this; +}; + +/** + * Destroy the Ultron instance, remove all listeners and release all references. + * + * @returns {Boolean} + * @api public + */ +Ultron.prototype.destroy = function destroy() { + if (!this.ee) return false; + + this.remove(); + this.ee = null; + + return true; +}; + +// +// Expose the module. +// +module.exports = Ultron; diff --git a/node_modules/ws/node_modules/ultron/package.json b/node_modules/ws/node_modules/ultron/package.json new file mode 100644 index 00000000..e8829bba --- /dev/null +++ b/node_modules/ws/node_modules/ultron/package.json @@ -0,0 +1,68 @@ +{ + "name": "ultron", + "version": "1.0.1", + "description": "Ultron is high-intelligence robot. It gathers intel so it can start improving upon his rudimentary design", + "main": "index.js", + "scripts": { + "test": "mocha --reporter spec --ui bdd test.js", + "watch": "mocha --watch --reporter spec --ui bdd test.js", + "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter spec --ui bdd test.js", + "test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter spec --ui bdd test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/unshiftio/ultron" + }, + "keywords": [ + "Ultron", + "robot", + "gather", + "intelligence", + "event", + "events", + "eventemitter", + "emitter", + "cleanup" + ], + "author": { + "name": "Arnout Kazemier" + }, + "license": "MIT", + "devDependencies": { + "assume": "0.0.x", + "eventemitter3": "0.1.x", + "istanbul": "0.3.x", + "mocha": "2.0.x", + "pre-commit": "0.0.x" + }, + "bugs": { + "url": "https://github.com/unshiftio/ultron/issues" + }, + "homepage": "https://github.com/unshiftio/ultron", + "gitHead": "1aae6f07661ebb69a60c466ef50b9798cfb7f631", + "_id": "ultron@1.0.1", + "_shasum": "c9d8d86c9cf2823028eb45629ab725897dd65dc5", + "_from": "ultron@>=1.0.0 <1.1.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "V1", + "email": "info@3rd-Eden.com" + }, + "maintainers": [ + { + "name": "V1", + "email": "info@3rd-Eden.com" + }, + { + "name": "unshift", + "email": "npm@unshift.io" + } + ], + "dist": { + "shasum": "c9d8d86c9cf2823028eb45629ab725897dd65dc5", + "tarball": "http://registry.npmjs.org/ultron/-/ultron-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/ws/node_modules/ultron/test.js b/node_modules/ws/node_modules/ultron/test.js new file mode 100644 index 00000000..1fd4f1bb --- /dev/null +++ b/node_modules/ws/node_modules/ultron/test.js @@ -0,0 +1,327 @@ +/* istanbul ignore next */ +describe('Ultron', function () { + 'use strict'; + + var EventEmitter = require('eventemitter3') + , EE = require('events').EventEmitter + , assume = require('assume') + , Ultron = require('./') + , ultron + , ee; + + beforeEach(function () { + ee = new EventEmitter(); + ultron = new Ultron(ee); + }); + + afterEach(function () { + ultron.destroy(); + ee.removeAllListeners(); + }); + + it('is exposed as a function', function () { + assume(Ultron).is.a('function'); + }); + + it('can be initialized without the new keyword', function () { + assume(Ultron(ee)).is.instanceOf(Ultron); + }); + + it('assigns a unique id to every instance', function () { + for (var i = 0; i < 100; i++) { + assume(ultron.id).does.not.equal((new Ultron()).id); + } + }); + + it('allows removal through the event emitter', function () { + function foo() {} + function bar() {} + + ultron.on('foo', foo); + ultron.once('foo', bar); + + assume(foo.__ultron).equals(ultron.id); + assume(bar.__ultron).equals(ultron.id); + assume(ee.listeners('foo').length).equals(2); + + ee.removeListener('foo', foo); + assume(ee.listeners('foo').length).equals(1); + + ee.removeListener('foo', bar); + assume(ee.listeners('foo').length).equals(0); + }); + + describe('#on', function () { + it('assigns a listener', function () { + assume(ee.listeners('foo').length).equals(0); + + function foo() {} + + ultron.on('foo', foo); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0]).equals(foo); + }); + + it('tags the assigned function', function () { + assume(ee.listeners('foo').length).equals(0); + + ultron.on('foo', function () {}); + assume(ee.listeners('foo')[0].__ultron).equals(ultron.id); + }); + + it('also passes in the context', function (next) { + var context = 1313; + + ultron.on('foo', function (a, b, c) { + assume(a).equals('a'); + assume(b).equals('b'); + assume(c).equals('c'); + + assume(this).equals(context); + + next(); + }, context); + + ee.emit('foo', 'a', 'b', 'c'); + }); + + it('works with regular eventemitters as well', function (next) { + var ee = new EE() + , ultron = new Ultron(ee); + + ultron.on('foo', function (a, b, c) { + assume(a).equals('a'); + assume(b).equals('b'); + assume(c).equals('c'); + + next(); + }); + + ee.emit('foo', 'a', 'b', 'c'); + }); + }); + + describe('#once', function () { + it('assigns a listener', function () { + assume(ee.listeners('foo').length).equals(0); + + function foo() {} + ultron.once('foo', foo); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0]).equals(foo); + }); + + it('tags the assigned function', function () { + assume(ee.listeners('foo').length).equals(0); + + ultron.once('foo', function () {}); + assume(ee.listeners('foo')[0].__ultron).equals(ultron.id); + }); + + it('also passes in the context', function (next) { + var context = 1313; + + ultron.once('foo', function (a, b, c) { + assume(a).equals('a'); + assume(b).equals('b'); + assume(c).equals('c'); + + assume(this).equals(context); + + next(); + }, context); + + ee.emit('foo', 'a', 'b', 'c'); + ee.emit('foo', 'a', 'b', 'c'); // Ensure that we don't double execute + }); + + it('works with regular eventemitters as well', function (next) { + var ee = new EE() + , ultron = new Ultron(ee); + + ultron.once('foo', function (a, b, c) { + assume(a).equals('a'); + assume(b).equals('b'); + assume(c).equals('c'); + + next(); + }); + + ee.emit('foo', 'a', 'b', 'c'); + ee.emit('foo', 'a', 'b', 'c'); // Ensure that we don't double execute + }); + }); + + describe('#remove', function () { + it('removes only our assigned `on` listeners', function () { + function foo() {} + function bar() {} + + ee.on('foo', foo); + ultron.on('foo', bar); + assume(ee.listeners('foo').length).equals(2); + + ultron.remove('foo'); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0]).equals(foo); + }); + + it('removes our private __ultron references', function () { + function once() {} + function on() {} + + assume('__ultron' in once).is.false(); + assume('__ultron' in on).is.false(); + + ultron.on('foo', on); + ultron.once('bar', once); + + assume('__ultron' in once).is.true(); + assume('__ultron' in on).is.true(); + + ultron.remove('foo, bar'); + + assume('__ultron' in once).is.false(); + assume('__ultron' in on).is.false(); + + ultron.destroy(); + + ee = new EE(); + ultron = new Ultron(ee); + + assume('__ultron' in once).is.false(); + assume('__ultron' in on).is.false(); + + ultron.on('foo', on); + ultron.once('bar', once); + + assume('__ultron' in once).is.true(); + assume('__ultron' in on).is.true(); + + ultron.remove('foo, bar'); + + assume('__ultron' in once).is.false(); + assume('__ultron' in on).is.false(); + }); + + it('removes only our assigned `once` listeners', function () { + function foo() {} + function bar() {} + + ee.once('foo', foo); + ultron.once('foo', bar); + assume(ee.listeners('foo').length).equals(2); + + ultron.remove('foo'); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0]).equals(foo); + }); + + it('removes only our assigned `once` listeners from regular EE', function () { + var ee = new EE() + , ultron = new Ultron(ee); + + function foo() {} + function bar() {} + + ee.once('foo', foo); + ultron.once('foo', bar); + assume(ee.listeners('foo').length).equals(2); + + ultron.remove('foo'); + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('foo')[0].listener).equals(foo); + }); + + it('removes all assigned events if called without args', function () { + function foo() {} + function bar() {} + + ultron.on('foo', foo); + ultron.on('bar', bar); + + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('bar').length).equals(1); + + ultron.remove(); + + assume(ee.listeners('foo').length).equals(0); + assume(ee.listeners('bar').length).equals(0); + }); + + it('removes multiple listeners based on args', function () { + function foo() {} + function bar() {} + function baz() {} + + ultron.on('foo', foo); + ultron.on('bar', bar); + ultron.on('baz', baz); + + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('bar').length).equals(1); + assume(ee.listeners('baz').length).equals(1); + + ultron.remove('foo', 'bar'); + + assume(ee.listeners('foo').length).equals(0); + assume(ee.listeners('bar').length).equals(0); + assume(ee.listeners('baz').length).equals(1); + }); + + it('removes multiple listeners if first arg is seperated string', function () { + function foo() {} + function bar() {} + function baz() {} + + ultron.on('foo', foo); + ultron.on('bar', bar); + ultron.on('baz', baz); + + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('bar').length).equals(1); + assume(ee.listeners('baz').length).equals(1); + + ultron.remove('foo, bar'); + + assume(ee.listeners('foo').length).equals(0); + assume(ee.listeners('bar').length).equals(0); + assume(ee.listeners('baz').length).equals(1); + }); + }); + + describe('#destroy', function () { + it('removes all listeners', function () { + function foo() {} + function bar() {} + function baz() {} + + ultron.on('foo', foo); + ultron.on('bar', bar); + ultron.on('baz', baz); + + assume(ee.listeners('foo').length).equals(1); + assume(ee.listeners('bar').length).equals(1); + assume(ee.listeners('baz').length).equals(1); + + ultron.destroy(); + + assume(ee.listeners('foo').length).equals(0); + assume(ee.listeners('bar').length).equals(0); + assume(ee.listeners('baz').length).equals(0); + }); + + it('removes the .ee reference', function () { + assume(ultron.ee).equals(ee); + ultron.destroy(); + assume(ultron.ee).equals(null); + }); + + it('returns booleans for state indication', function () { + assume(ultron.destroy()).is.true(); + assume(ultron.destroy()).is.false(); + assume(ultron.destroy()).is.false(); + assume(ultron.destroy()).is.false(); + }); + }); +}); diff --git a/node_modules/ws/node_modules/utf-8-validate/.npmignore b/node_modules/ws/node_modules/utf-8-validate/.npmignore new file mode 100644 index 00000000..0c90f673 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/.npmignore @@ -0,0 +1,3 @@ +npm-debug.log +node_modules +build diff --git a/node_modules/ws/node_modules/utf-8-validate/binding.gyp b/node_modules/ws/node_modules/utf-8-validate/binding.gyp new file mode 100644 index 00000000..2c5c8827 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/binding.gyp @@ -0,0 +1,10 @@ +{ + 'targets': [ + { + 'target_name': 'validation', + 'include_dirs': ["> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_objc = CXX($(TOOLSET)) $@ +cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< + +quiet_cmd_objcxx = CXX($(TOOLSET)) $@ +cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# Commands for precompiled header files. +quiet_cmd_pch_c = CXX($(TOOLSET)) $@ +cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ +cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_m = CXX($(TOOLSET)) $@ +cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< +quiet_cmd_pch_mm = CXX($(TOOLSET)) $@ +cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# gyp-mac-tool is written next to the root Makefile by gyp. +# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd +# already. +quiet_cmd_mac_tool = MACTOOL $(4) $< +cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@" + +quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@ +cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) + +quiet_cmd_infoplist = INFOPLIST $@ +cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = rm -rf "$@" && cp -af "$<" "$@" + +quiet_cmd_alink = LIBTOOL-STATIC $@ +cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 2,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD + @$(call do_cmd,objc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD + @$(call do_cmd,objcxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,validation.target.mk)))),) + include validation.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/sirip/Documents/dev/bittorrent-tracker/node_modules/ws/node_modules/utf-8-validate/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/sirip/.node-gyp/0.12.1/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/sirip/.node-gyp/0.12.1" "-Dmodule_root_dir=/Users/sirip/Documents/dev/bittorrent-tracker/node_modules/ws/node_modules/utf-8-validate" binding.gyp +Makefile: $(srcdir)/../../../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../.node-gyp/0.12.1/common.gypi + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/obj.target/validation/src/validation.o.d b/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/obj.target/validation/src/validation.o.d new file mode 100644 index 00000000..8bf585f9 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/obj.target/validation/src/validation.o.d @@ -0,0 +1,37 @@ +cmd_Release/obj.target/validation/src/validation.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/sirip/.node-gyp/0.12.1/src -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include -I../node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/validation/src/validation.o.d.raw -c -o Release/obj.target/validation/src/validation.o ../src/validation.cc +Release/obj.target/validation/src/validation.o: ../src/validation.cc \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8.h \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8stdint.h \ + /Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8config.h \ + /Users/sirip/.node-gyp/0.12.1/src/node.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_version.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_buffer.h \ + /Users/sirip/.node-gyp/0.12.1/src/smalloc.h \ + /Users/sirip/.node-gyp/0.12.1/src/node_object_wrap.h \ + ../node_modules/nan/nan.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-errno.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-version.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-unix.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-threadpool.h \ + /Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-darwin.h \ + ../node_modules/nan/nan_new.h \ + ../node_modules/nan/nan_implementation_12_inl.h +../src/validation.cc: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8.h: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8stdint.h: +/Users/sirip/.node-gyp/0.12.1/deps/v8/include/v8config.h: +/Users/sirip/.node-gyp/0.12.1/src/node.h: +/Users/sirip/.node-gyp/0.12.1/src/node_version.h: +/Users/sirip/.node-gyp/0.12.1/src/node_buffer.h: +/Users/sirip/.node-gyp/0.12.1/src/smalloc.h: +/Users/sirip/.node-gyp/0.12.1/src/node_object_wrap.h: +../node_modules/nan/nan.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-errno.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-version.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-unix.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-threadpool.h: +/Users/sirip/.node-gyp/0.12.1/deps/uv/include/uv-darwin.h: +../node_modules/nan/nan_new.h: +../node_modules/nan/nan_implementation_12_inl.h: diff --git a/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/validation.node.d b/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/validation.node.d new file mode 100644 index 00000000..2f13adc8 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/build/Release/.deps/Release/validation.node.d @@ -0,0 +1 @@ +cmd_Release/validation.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -bundle -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -o Release/validation.node Release/obj.target/validation/src/validation.o -undefined dynamic_lookup diff --git a/node_modules/ws/node_modules/utf-8-validate/build/Release/linker.lock b/node_modules/ws/node_modules/utf-8-validate/build/Release/linker.lock new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/ws/node_modules/utf-8-validate/build/Release/obj.target/validation/src/validation.o b/node_modules/ws/node_modules/utf-8-validate/build/Release/obj.target/validation/src/validation.o new file mode 100644 index 00000000..2225ba10 Binary files /dev/null and b/node_modules/ws/node_modules/utf-8-validate/build/Release/obj.target/validation/src/validation.o differ diff --git a/node_modules/ws/node_modules/utf-8-validate/build/Release/validation.node b/node_modules/ws/node_modules/utf-8-validate/build/Release/validation.node new file mode 100755 index 00000000..9a945d5b Binary files /dev/null and b/node_modules/ws/node_modules/utf-8-validate/build/Release/validation.node differ diff --git a/node_modules/ws/node_modules/utf-8-validate/build/binding.Makefile b/node_modules/ws/node_modules/utf-8-validate/build/binding.Makefile new file mode 100644 index 00000000..c7aead96 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) validation diff --git a/node_modules/ws/node_modules/utf-8-validate/build/config.gypi b/node_modules/ws/node_modules/utf-8-validate/build/config.gypi new file mode 100644 index 00000000..0af2b6d8 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/build/config.gypi @@ -0,0 +1,129 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "clang": 1, + "host_arch": "x64", + "icu_small": "false", + "node_install_npm": "false", + "node_prefix": "/usr/local/Cellar/node/0.12.1", + "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_use_dtrace": "true", + "node_use_etw": "false", + "node_use_mdb": "false", + "node_use_openssl": "true", + "node_use_perfctr": "false", + "openssl_no_asm": 0, + "python": "/usr/local/opt/python/bin/python2.7", + "target_arch": "x64", + "uv_library": "static_library", + "uv_parent_path": "/deps/uv/", + "uv_use_dtrace": "true", + "v8_enable_gdbjit": 0, + "v8_enable_i18n_support": 0, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 0, + "v8_random_seed": 0, + "v8_use_snapshot": "true", + "want_separate_host_toolset": 0, + "nodedir": "/Users/sirip/.node-gyp/0.12.1", + "copy_dev_lib": "true", + "standalone_static_library": 1, + "save_dev": "", + "browser": "", + "viewer": "man", + "rollback": "true", + "usage": "", + "globalignorefile": "/usr/local/etc/npmignore", + "init_author_url": "", + "shell": "/bin/bash", + "parseable": "", + "shrinkwrap": "true", + "init_license": "ISC", + "if_present": "", + "cache_max": "Infinity", + "init_author_email": "", + "sign_git_tag": "", + "cert": "", + "git_tag_version": "true", + "local_address": "", + "long": "", + "fetch_retries": "2", + "npat": "", + "registry": "https://registry.npmjs.org/", + "key": "", + "message": "%s", + "versions": "", + "globalconfig": "/usr/local/etc/npmrc", + "always_auth": "", + "spin": "true", + "cache_lock_retries": "10", + "cafile": "", + "heading": "npm", + "fetch_retry_mintimeout": "10000", + "proprietary_attribs": "true", + "access": "", + "json": "", + "description": "true", + "engine_strict": "", + "https_proxy": "", + "init_module": "/Users/sirip/.npm-init.js", + "userconfig": "/Users/sirip/.npmrc", + "node_version": "0.12.1", + "user": "", + "editor": "vi", + "save": "", + "tag": "latest", + "global": "", + "optional": "true", + "bin_links": "true", + "force": "", + "searchopts": "", + "depth": "", + "rebuild_bundle": "true", + "searchsort": "name", + "unicode": "true", + "fetch_retry_maxtimeout": "60000", + "ca": "", + "save_prefix": "^", + "strict_ssl": "true", + "dev": "", + "fetch_retry_factor": "10", + "group": "20", + "save_exact": "", + "cache_lock_stale": "60000", + "version": "", + "cache_min": "10", + "cache": "/Users/sirip/.npm", + "searchexclude": "", + "color": "true", + "save_optional": "", + "user_agent": "npm/2.7.3 node/v0.12.1 darwin x64", + "ignore_scripts": "", + "cache_lock_wait": "10000", + "production": "", + "save_bundle": "", + "init_version": "1.0.0", + "umask": "0022", + "git": "git", + "init_author_name": "", + "scope": "", + "onload_script": "", + "tmp": "/var/folders/fd/838gnt9x47gd1ylq5_t46zwc0000gt/T", + "unsafe_perm": "true", + "prefix": "/usr/local", + "link": "" + } +} diff --git a/node_modules/ws/node_modules/utf-8-validate/build/gyp-mac-tool b/node_modules/ws/node_modules/utf-8-validate/build/gyp-mac-tool new file mode 100755 index 00000000..7abfed5f --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/build/gyp-mac-tool @@ -0,0 +1,512 @@ +#!/usr/bin/env python +# Generated by gyp. Do not edit. +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions to perform Xcode-style build steps. + +These functions are executed via gyp-mac-tool when using the Makefile generator. +""" + +import fcntl +import fnmatch +import glob +import json +import os +import plistlib +import re +import shutil +import string +import subprocess +import sys +import tempfile + + +def main(args): + executor = MacTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class MacTool(object): + """This class performs all the Mac tooling steps. The methods can either be + executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like copy-info-plist to CopyInfoPlist""" + return name_string.title().replace('-', '') + + def ExecCopyBundleResource(self, source, dest): + """Copies a resource file to the bundle/Resources directory, performing any + necessary compilation on each resource.""" + extension = os.path.splitext(source)[1].lower() + if os.path.isdir(source): + # Copy tree. + # TODO(thakis): This copies file attributes like mtime, while the + # single-file branch below doesn't. This should probably be changed to + # be consistent with the single-file branch. + if os.path.exists(dest): + shutil.rmtree(dest) + shutil.copytree(source, dest) + elif extension == '.xib': + return self._CopyXIBFile(source, dest) + elif extension == '.storyboard': + return self._CopyXIBFile(source, dest) + elif extension == '.strings': + self._CopyStringsFile(source, dest) + else: + shutil.copy(source, dest) + + def _CopyXIBFile(self, source, dest): + """Compiles a XIB file with ibtool into a binary plist in the bundle.""" + + # ibtool sometimes crashes with relative paths. See crbug.com/314728. + base = os.path.dirname(os.path.realpath(__file__)) + if os.path.relpath(source): + source = os.path.join(base, source) + if os.path.relpath(dest): + dest = os.path.join(base, dest) + + args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices', + '--output-format', 'human-readable-text', '--compile', dest, source] + ibtool_section_re = re.compile(r'/\*.*\*/') + ibtool_re = re.compile(r'.*note:.*is clipping its content') + ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) + current_section_header = None + for line in ibtoolout.stdout: + if ibtool_section_re.match(line): + current_section_header = line + elif not ibtool_re.match(line): + if current_section_header: + sys.stdout.write(current_section_header) + current_section_header = None + sys.stdout.write(line) + return ibtoolout.returncode + + def _CopyStringsFile(self, source, dest): + """Copies a .strings file using iconv to reconvert the input into UTF-16.""" + input_code = self._DetectInputEncoding(source) or "UTF-8" + + # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call + # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints + # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing + # semicolon in dictionary. + # on invalid files. Do the same kind of validation. + import CoreFoundation + s = open(source, 'rb').read() + d = CoreFoundation.CFDataCreate(None, s, len(s)) + _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None) + if error: + return + + fp = open(dest, 'wb') + fp.write(s.decode(input_code).encode('UTF-16')) + fp.close() + + def _DetectInputEncoding(self, file_name): + """Reads the first few bytes from file_name and tries to guess the text + encoding. Returns None as a guess if it can't detect it.""" + fp = open(file_name, 'rb') + try: + header = fp.read(3) + except e: + fp.close() + return None + fp.close() + if header.startswith("\xFE\xFF"): + return "UTF-16" + elif header.startswith("\xFF\xFE"): + return "UTF-16" + elif header.startswith("\xEF\xBB\xBF"): + return "UTF-8" + else: + return None + + def ExecCopyInfoPlist(self, source, dest, *keys): + """Copies the |source| Info.plist to the destination directory |dest|.""" + # Read the source Info.plist into memory. + fd = open(source, 'r') + lines = fd.read() + fd.close() + + # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). + plist = plistlib.readPlistFromString(lines) + if keys: + plist = dict(plist.items() + json.loads(keys[0]).items()) + lines = plistlib.writePlistToString(plist) + + # Go through all the environment variables and replace them as variables in + # the file. + IDENT_RE = re.compile('[/\s]') + for key in os.environ: + if key.startswith('_'): + continue + evar = '${%s}' % key + evalue = os.environ[key] + lines = string.replace(lines, evar, evalue) + + # Xcode supports various suffices on environment variables, which are + # all undocumented. :rfc1034identifier is used in the standard project + # template these days, and :identifier was used earlier. They are used to + # convert non-url characters into things that look like valid urls -- + # except that the replacement character for :identifier, '_' isn't valid + # in a URL either -- oops, hence :rfc1034identifier was born. + evar = '${%s:identifier}' % key + evalue = IDENT_RE.sub('_', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + evar = '${%s:rfc1034identifier}' % key + evalue = IDENT_RE.sub('-', os.environ[key]) + lines = string.replace(lines, evar, evalue) + + # Remove any keys with values that haven't been replaced. + lines = lines.split('\n') + for i in range(len(lines)): + if lines[i].strip().startswith("${"): + lines[i] = None + lines[i - 1] = None + lines = '\n'.join(filter(lambda x: x is not None, lines)) + + # Write out the file with variables replaced. + fd = open(dest, 'w') + fd.write(lines) + fd.close() + + # Now write out PkgInfo file now that the Info.plist file has been + # "compiled". + self._WritePkgInfo(dest) + + def _WritePkgInfo(self, info_plist): + """This writes the PkgInfo file from the data stored in Info.plist.""" + plist = plistlib.readPlist(info_plist) + if not plist: + return + + # Only create PkgInfo for executable types. + package_type = plist['CFBundlePackageType'] + if package_type != 'APPL': + return + + # The format of PkgInfo is eight characters, representing the bundle type + # and bundle signature, each four characters. If that is missing, four + # '?' characters are used instead. + signature_code = plist.get('CFBundleSignature', '????') + if len(signature_code) != 4: # Wrong length resets everything, too. + signature_code = '?' * 4 + + dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo') + fp = open(dest, 'w') + fp.write('%s%s' % (package_type, signature_code)) + fp.close() + + def ExecFlock(self, lockfile, *cmd_list): + """Emulates the most basic behavior of Linux's flock(1).""" + # Rely on exception handling to report errors. + fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) + fcntl.flock(fd, fcntl.LOCK_EX) + return subprocess.call(cmd_list) + + def ExecFilterLibtool(self, *cmd_list): + """Calls libtool and filters out '/path/to/libtool: file: foo.o has no + symbols'.""" + libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') + libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) + _, err = libtoolout.communicate() + for line in err.splitlines(): + if not libtool_re.match(line): + print >>sys.stderr, line + return libtoolout.returncode + + def ExecPackageFramework(self, framework, version): + """Takes a path to Something.framework and the Current version of that and + sets up all the symlinks.""" + # Find the name of the binary based on the part before the ".framework". + binary = os.path.basename(framework).split('.')[0] + + CURRENT = 'Current' + RESOURCES = 'Resources' + VERSIONS = 'Versions' + + if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)): + # Binary-less frameworks don't seem to contain symlinks (see e.g. + # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle). + return + + # Move into the framework directory to set the symlinks correctly. + pwd = os.getcwd() + os.chdir(framework) + + # Set up the Current version. + self._Relink(version, os.path.join(VERSIONS, CURRENT)) + + # Set up the root symlinks. + self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary) + self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES) + + # Back to where we were before! + os.chdir(pwd) + + def _Relink(self, dest, link): + """Creates a symlink to |dest| named |link|. If |link| already exists, + it is overwritten.""" + if os.path.lexists(link): + os.remove(link) + os.symlink(dest, link) + + def ExecCodeSignBundle(self, key, resource_rules, entitlements, provisioning): + """Code sign a bundle. + + This function tries to code sign an iOS bundle, following the same + algorithm as Xcode: + 1. copy ResourceRules.plist from the user or the SDK into the bundle, + 2. pick the provisioning profile that best match the bundle identifier, + and copy it into the bundle as embedded.mobileprovision, + 3. copy Entitlements.plist from user or SDK next to the bundle, + 4. code sign the bundle. + """ + resource_rules_path = self._InstallResourceRules(resource_rules) + substitutions, overrides = self._InstallProvisioningProfile( + provisioning, self._GetCFBundleIdentifier()) + entitlements_path = self._InstallEntitlements( + entitlements, substitutions, overrides) + subprocess.check_call([ + 'codesign', '--force', '--sign', key, '--resource-rules', + resource_rules_path, '--entitlements', entitlements_path, + os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['FULL_PRODUCT_NAME'])]) + + def _InstallResourceRules(self, resource_rules): + """Installs ResourceRules.plist from user or SDK into the bundle. + + Args: + resource_rules: string, optional, path to the ResourceRules.plist file + to use, default to "${SDKROOT}/ResourceRules.plist" + + Returns: + Path to the copy of ResourceRules.plist into the bundle. + """ + source_path = resource_rules + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'ResourceRules.plist') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], 'ResourceRules.plist') + shutil.copy2(source_path, target_path) + return target_path + + def _InstallProvisioningProfile(self, profile, bundle_identifier): + """Installs embedded.mobileprovision into the bundle. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple containing two dictionary: variables substitutions and values + to overrides when generating the entitlements file. + """ + source_path, provisioning_data, team_id = self._FindProvisioningProfile( + profile, bundle_identifier) + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['CONTENTS_FOLDER_PATH'], + 'embedded.mobileprovision') + shutil.copy2(source_path, target_path) + substitutions = self._GetSubstitutions(bundle_identifier, team_id + '.') + return substitutions, provisioning_data['Entitlements'] + + def _FindProvisioningProfile(self, profile, bundle_identifier): + """Finds the .mobileprovision file to use for signing the bundle. + + Checks all the installed provisioning profiles (or if the user specified + the PROVISIONING_PROFILE variable, only consult it) and select the most + specific that correspond to the bundle identifier. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple of the path to the selected provisioning profile, the data of + the embedded plist in the provisioning profile and the team identifier + to use for code signing. + + Raises: + SystemExit: if no .mobileprovision can be used to sign the bundle. + """ + profiles_dir = os.path.join( + os.environ['HOME'], 'Library', 'MobileDevice', 'Provisioning Profiles') + if not os.path.isdir(profiles_dir): + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + provisioning_profiles = None + if profile: + profile_path = os.path.join(profiles_dir, profile + '.mobileprovision') + if os.path.exists(profile_path): + provisioning_profiles = [profile_path] + if not provisioning_profiles: + provisioning_profiles = glob.glob( + os.path.join(profiles_dir, '*.mobileprovision')) + valid_provisioning_profiles = {} + for profile_path in provisioning_profiles: + profile_data = self._LoadProvisioningProfile(profile_path) + app_id_pattern = profile_data.get( + 'Entitlements', {}).get('application-identifier', '') + for team_identifier in profile_data.get('TeamIdentifier', []): + app_id = '%s.%s' % (team_identifier, bundle_identifier) + if fnmatch.fnmatch(app_id, app_id_pattern): + valid_provisioning_profiles[app_id_pattern] = ( + profile_path, profile_data, team_identifier) + if not valid_provisioning_profiles: + print >>sys.stderr, ( + 'cannot find mobile provisioning for %s' % bundle_identifier) + sys.exit(1) + # If the user has multiple provisioning profiles installed that can be + # used for ${bundle_identifier}, pick the most specific one (ie. the + # provisioning profile whose pattern is the longest). + selected_key = max(valid_provisioning_profiles, key=lambda v: len(v)) + return valid_provisioning_profiles[selected_key] + + def _LoadProvisioningProfile(self, profile_path): + """Extracts the plist embedded in a provisioning profile. + + Args: + profile_path: string, path to the .mobileprovision file + + Returns: + Content of the plist embedded in the provisioning profile as a dictionary. + """ + with tempfile.NamedTemporaryFile() as temp: + subprocess.check_call([ + 'security', 'cms', '-D', '-i', profile_path, '-o', temp.name]) + return self._LoadPlistMaybeBinary(temp.name) + + def _LoadPlistMaybeBinary(self, plist_path): + """Loads into a memory a plist possibly encoded in binary format. + + This is a wrapper around plistlib.readPlist that tries to convert the + plist to the XML format if it can't be parsed (assuming that it is in + the binary format). + + Args: + plist_path: string, path to a plist file, in XML or binary format + + Returns: + Content of the plist as a dictionary. + """ + try: + # First, try to read the file using plistlib that only supports XML, + # and if an exception is raised, convert a temporary copy to XML and + # load that copy. + return plistlib.readPlist(plist_path) + except: + pass + with tempfile.NamedTemporaryFile() as temp: + shutil.copy2(plist_path, temp.name) + subprocess.check_call(['plutil', '-convert', 'xml1', temp.name]) + return plistlib.readPlist(temp.name) + + def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix): + """Constructs a dictionary of variable substitutions for Entitlements.plist. + + Args: + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + app_identifier_prefix: string, value for AppIdentifierPrefix + + Returns: + Dictionary of substitutions to apply when generating Entitlements.plist. + """ + return { + 'CFBundleIdentifier': bundle_identifier, + 'AppIdentifierPrefix': app_identifier_prefix, + } + + def _GetCFBundleIdentifier(self): + """Extracts CFBundleIdentifier value from Info.plist in the bundle. + + Returns: + Value of CFBundleIdentifier in the Info.plist located in the bundle. + """ + info_plist_path = os.path.join( + os.environ['TARGET_BUILD_DIR'], + os.environ['INFOPLIST_PATH']) + info_plist_data = self._LoadPlistMaybeBinary(info_plist_path) + return info_plist_data['CFBundleIdentifier'] + + def _InstallEntitlements(self, entitlements, substitutions, overrides): + """Generates and install the ${BundleName}.xcent entitlements file. + + Expands variables "$(variable)" pattern in the source entitlements file, + add extra entitlements defined in the .mobileprovision file and the copy + the generated plist to "${BundlePath}.xcent". + + Args: + entitlements: string, optional, path to the Entitlements.plist template + to use, defaults to "${SDKROOT}/Entitlements.plist" + substitutions: dictionary, variable substitutions + overrides: dictionary, values to add to the entitlements + + Returns: + Path to the generated entitlements file. + """ + source_path = entitlements + target_path = os.path.join( + os.environ['BUILT_PRODUCTS_DIR'], + os.environ['PRODUCT_NAME'] + '.xcent') + if not source_path: + source_path = os.path.join( + os.environ['SDKROOT'], + 'Entitlements.plist') + shutil.copy2(source_path, target_path) + data = self._LoadPlistMaybeBinary(target_path) + data = self._ExpandVariables(data, substitutions) + if overrides: + for key in overrides: + if key not in data: + data[key] = overrides[key] + plistlib.writePlist(data, target_path) + return target_path + + def _ExpandVariables(self, data, substitutions): + """Expands variables "$(variable)" in data. + + Args: + data: object, can be either string, list or dictionary + substitutions: dictionary, variable substitutions to perform + + Returns: + Copy of data where each references to "$(variable)" has been replaced + by the corresponding value found in substitutions, or left intact if + the key was not found. + """ + if isinstance(data, str): + for key, value in substitutions.iteritems(): + data = data.replace('$(%s)' % key, value) + return data + if isinstance(data, list): + return [self._ExpandVariables(v, substitutions) for v in data] + if isinstance(data, dict): + return dict((k, self._ExpandVariables(data[k], + substitutions)) for k in data) + return data + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/node_modules/ws/node_modules/utf-8-validate/build/validation.target.mk b/node_modules/ws/node_modules/utf-8-validate/build/validation.target.mk new file mode 100644 index 00000000..1d93186f --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/build/validation.target.mk @@ -0,0 +1,156 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := validation +DEFS_Debug := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' \ + '-DDEBUG' \ + '-D_DEBUG' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -O0 \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Debug := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Debug := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Debug := + +INCS_Debug := \ + -I/Users/sirip/.node-gyp/0.12.1/src \ + -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include \ + -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +DEFS_Release := \ + '-D_DARWIN_USE_64_BIT_INODE=1' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' + +# Flags passed to all source files. +CFLAGS_Release := \ + -Os \ + -gdwarf-2 \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -Wall \ + -Wendif-labels \ + -W \ + -Wno-unused-parameter + +# Flags passed to only C files. +CFLAGS_C_Release := \ + -fno-strict-aliasing + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -fno-threadsafe-statics \ + -fno-strict-aliasing + +# Flags passed to only ObjC files. +CFLAGS_OBJC_Release := + +# Flags passed to only ObjC++ files. +CFLAGS_OBJCC_Release := + +INCS_Release := \ + -I/Users/sirip/.node-gyp/0.12.1/src \ + -I/Users/sirip/.node-gyp/0.12.1/deps/uv/include \ + -I/Users/sirip/.node-gyp/0.12.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +OBJS := \ + $(obj).target/$(TARGET)/src/validation.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE)) +$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Debug := \ + -Wl,-search_paths_first + +LDFLAGS_Release := \ + -Wl,-search_paths_first \ + -mmacosx-version-min=10.5 \ + -arch x86_64 \ + -L$(builddir) + +LIBTOOLFLAGS_Release := \ + -Wl,-search_paths_first + +LIBS := \ + -undefined dynamic_lookup + +$(builddir)/validation.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(builddir)/validation.node: LIBS := $(LIBS) +$(builddir)/validation.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE)) +$(builddir)/validation.node: TOOLSET := $(TOOLSET) +$(builddir)/validation.node: $(OBJS) FORCE_DO_CMD + $(call do_cmd,solink_module) + +all_deps += $(builddir)/validation.node +# Add target alias +.PHONY: validation +validation: $(builddir)/validation.node + +# Short alias for building this executable. +.PHONY: validation.node +validation.node: $(builddir)/validation.node + +# Add executable to "all" target. +.PHONY: all +all: $(builddir)/validation.node + diff --git a/node_modules/ws/node_modules/utf-8-validate/fallback.js b/node_modules/ws/node_modules/utf-8-validate/fallback.js new file mode 100644 index 00000000..f929d77e --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/fallback.js @@ -0,0 +1,13 @@ +'use strict'; + +/*! + * UTF-8 validate: UTF-8 validation for WebSockets. + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + +module.exports.Validation = { + isValidUTF8: function(buffer) { + return true; + } +}; diff --git a/node_modules/ws/node_modules/utf-8-validate/index.js b/node_modules/ws/node_modules/utf-8-validate/index.js new file mode 100644 index 00000000..e7bfde8e --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/index.js @@ -0,0 +1,7 @@ +'use strict'; + +try { + module.exports = require('bindings')('validation'); +} catch (e) { + module.exports = require('./fallback'); +} diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/README.md b/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/README.md new file mode 100644 index 00000000..585cf512 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/README.md @@ -0,0 +1,97 @@ +node-bindings +============= +### Helper module for loading your native module's .node file + +This is a helper module for authors of Node.js native addon modules. +It is basically the "swiss army knife" of `require()`ing your native module's +`.node` file. + +Throughout the course of Node's native addon history, addons have ended up being +compiled in a variety of different places, depending on which build tool and which +version of node was used. To make matters worse, now the _gyp_ build tool can +produce either a _Release_ or _Debug_ build, each being built into different +locations. + +This module checks _all_ the possible locations that a native addon would be built +at, and returns the first one that loads successfully. + + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install bindings +``` + +Or add it to the `"dependencies"` section of your _package.json_ file. + + +Example +------- + +`require()`ing the proper bindings file for the current node version, platform +and architecture is as simple as: + +``` js +var bindings = require('bindings')('binding.node') + +// Use your bindings defined in your C files +bindings.your_c_function() +``` + + +Nice Error Output +----------------- + +When the `.node` file could not be loaded, `node-bindings` throws an Error with +a nice error message telling you exactly what was tried. You can also check the +`err.tries` Array property. + +``` +Error: Could not load the bindings file. Tried: + → /Users/nrajlich/ref/build/binding.node + → /Users/nrajlich/ref/build/Debug/binding.node + → /Users/nrajlich/ref/build/Release/binding.node + → /Users/nrajlich/ref/out/Debug/binding.node + → /Users/nrajlich/ref/Debug/binding.node + → /Users/nrajlich/ref/out/Release/binding.node + → /Users/nrajlich/ref/Release/binding.node + → /Users/nrajlich/ref/build/default/binding.node + → /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node + at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13) + at Object. (/Users/nrajlich/ref/lib/ref.js:5:47) + at Module._compile (module.js:449:26) + at Object.Module._extensions..js (module.js:467:10) + at Module.load (module.js:356:32) + at Function.Module._load (module.js:312:12) + ... +``` + + +License +------- + +(The MIT License) + +Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> + +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/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/bindings.js b/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/bindings.js new file mode 100644 index 00000000..93dcf85a --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/bindings/bindings.js @@ -0,0 +1,166 @@ + +/** + * Module dependencies. + */ + +var fs = require('fs') + , path = require('path') + , join = path.join + , dirname = path.dirname + , exists = fs.existsSync || path.existsSync + , defaults = { + arrow: process.env.NODE_BINDINGS_ARROW || ' → ' + , compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' + , platform: process.platform + , arch: process.arch + , version: process.versions.node + , bindings: 'bindings.node' + , try: [ + // node-gyp's linked version in the "build" dir + [ 'module_root', 'build', 'bindings' ] + // node-waf and gyp_addon (a.k.a node-gyp) + , [ 'module_root', 'build', 'Debug', 'bindings' ] + , [ 'module_root', 'build', 'Release', 'bindings' ] + // Debug files, for development (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Debug', 'bindings' ] + , [ 'module_root', 'Debug', 'bindings' ] + // Release files, but manually compiled (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Release', 'bindings' ] + , [ 'module_root', 'Release', 'bindings' ] + // Legacy from node-waf, node <= 0.4.x + , [ 'module_root', 'build', 'default', 'bindings' ] + // Production "Release" buildtype binary (meh...) + , [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ] + ] + } + +/** + * The main `bindings()` function loads the compiled bindings for a given module. + * It uses V8's Error API to determine the parent filename that this function is + * being invoked from, which is then used to find the root directory. + */ + +function bindings (opts) { + + // Argument surgery + if (typeof opts == 'string') { + opts = { bindings: opts } + } else if (!opts) { + opts = {} + } + opts.__proto__ = defaults + + // Get the module root + if (!opts.module_root) { + opts.module_root = exports.getRoot(exports.getFileName()) + } + + // Ensure the given bindings name ends with .node + if (path.extname(opts.bindings) != '.node') { + opts.bindings += '.node' + } + + var tries = [] + , i = 0 + , l = opts.try.length + , n + , b + , err + + for (; i=1.2.0 <1.3.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "TooTallNate", + "email": "nathan@tootallnate.net" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11", + "tarball": "http://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/.dntrc b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/.dntrc new file mode 100644 index 00000000..47971da6 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/.dntrc @@ -0,0 +1,30 @@ +## DNT config file +## see https://github.com/rvagg/dnt + +NODE_VERSIONS="\ + master \ + v0.11.13 \ + v0.10.30 \ + v0.10.29 \ + v0.10.28 \ + 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.8.28 \ + v0.8.27 \ + v0.8.26 \ + v0.8.24 \ +" +OUTPUT_PREFIX="nan-" +TEST_CMD=" \ + cd /dnt/ && \ + npm install && \ + node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild --directory test && \ + node_modules/.bin/tap --gc test/js/*-test.js \ +" + diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/CHANGELOG.md b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/CHANGELOG.md new file mode 100644 index 00000000..de0ac02a --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/CHANGELOG.md @@ -0,0 +1,265 @@ +# NAN ChangeLog + +**Version 1.6.2: current Node unstable: 0.11.16, Node stable: 0.10.36, io.js: 1.1.0** + +### 1.6.2 Feb 6 2015 + + - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 + +### 1.6.1 Jan 23 2015 + + - Build: version bump + +### 1.5.3 Jan 23 2015 + + - Build: repackage + +### 1.6.0 Jan 23 2015 + + - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af + - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 + - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 + +### 1.5.2 Jan 23 2015 + + - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 + - Bugfix: Readded missing String constructors 18d828f + - Bugfix: Add overload handling NanNew(..) 5ef813b + - Bugfix: Fix uv_work_cb versioning 997e4ae + - Bugfix: Add function factory and test 4eca89c + - Bugfix: Add object template factory and test cdcb951 + - Correctness: Lifted an io.js related typedef c9490be + - Correctness: Make explicit downcasts of String lengths 00074e6 + - Windows: Limit the scope of disabled warning C4530 83d7deb + +### 1.5.1 Jan 15 2015 + + - Build: version bump + +### 1.4.3 Jan 15 2015 + + - Build: version bump + +### 1.4.2 Jan 15 2015 + + - Feature: Support io.js 0dbc5e8 + +### 1.5.0 Jan 14 2015 + + - Feature: Support io.js b003843 + - Correctness: Improved NanNew internals 9cd4f6a + - Feature: Implement progress to NanAsyncWorker 8d6a160 + +### 1.4.1 Nov 8 2014 + + - Bugfix: Handle DEBUG definition correctly + - Bugfix: Accept int as Boolean + +### 1.4.0 Nov 1 2014 + + - Feature: Added NAN_GC_CALLBACK 6a5c245 + - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 + - Correctness: Added constness to references in NanHasInstance 02c61cd + - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 + - Windoze: Shut Visual Studio up when compiling 8d558c1 + - License: Switch to plain MIT from custom hacked MIT license 11de983 + - Build: Added test target to Makefile e232e46 + - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 + - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 + - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 + +### 1.3.0 Aug 2 2014 + + - Added NanNew(std::string) + - Added NanNew(std::string&) + - Added NanAsciiString helper class + - Added NanUtf8String helper class + - Added NanUcs2String helper class + - Deprecated NanRawString() + - Deprecated NanCString() + - Added NanGetIsolateData(v8::Isolate *isolate) + - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) + - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) + - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + +### 1.2.0 Jun 5 2014 + + - Add NanSetPrototypeTemplate + - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, + introduced _NanWeakCallbackDispatcher + - Removed -Wno-unused-local-typedefs from test builds + - Made test builds Windows compatible ('Sleep()') + +### 1.1.2 May 28 2014 + + - Release to fix more stuff-ups in 1.1.1 + +### 1.1.1 May 28 2014 + + - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 + +### 1.1.0 May 25 2014 + + - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead + - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), + (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, + v8::String::ExternalAsciiStringResource* + - Deprecate NanSymbol() + - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker + +### 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(v8::Handle value) for use in place of + v8::Local::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 ` 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) to NanThrowError(Handle) + - 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::Handle) + - 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 argument + - Added `NanNewBufferHandle` with single uint32_t argument + - Added `NanHasInstance(Persistent&, Handle)` + - Added `Local NanCallback#GetFunction()` + - Added `NanCallback#Call(int, Local[])` + - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/LICENSE.md b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/LICENSE.md new file mode 100644 index 00000000..95c2eb5f --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/LICENSE.md @@ -0,0 +1,13 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2015 NAN contributors +----------------------------------- + +*NAN contributors listed at * + +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/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/appveyor.yml b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/appveyor.yml new file mode 100644 index 00000000..17771078 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/appveyor.yml @@ -0,0 +1,37 @@ +# http://www.appveyor.com/docs/appveyor-yml + +# Test against these versions of Io.js and Node.js. +environment: + matrix: + # node.js + - nodejs_version: "0.8" + - nodejs_version: "0.10" + - nodejs_version: "0.11" + # io.js + - nodejs_version: "1" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node 0.STABLE.latest + - ps: if($env:nodejs_version -eq "0.8") {Install-Product node $env:nodejs_version} + - ps: if($env:nodejs_version -ne "0.8") {Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)} + - IF NOT %nodejs_version% == 1 npm -g install npm + - IF NOT %nodejs_version% == 1 set PATH=%APPDATA%\npm;%PATH% + # Typical npm stuff. + - npm install + - IF %nodejs_version% == 0.8 node node_modules\node-gyp\bin\node-gyp.js rebuild --directory test + - IF NOT %nodejs_version% == 0.8 npm run rebuild-tests + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm test + +# Don't actually build. +build: off + +# Set build version format here instead of in the admin panel. +version: "{build}" diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/include_dirs.js b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/include_dirs.js new file mode 100644 index 00000000..4f1dfb41 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/include_dirs.js @@ -0,0 +1 @@ +console.log(require('path').relative('.', __dirname)); diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan.h b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan.h new file mode 100644 index 00000000..e95a3b3e --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan.h @@ -0,0 +1,2174 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors: + * - Rod Vagg + * - Benjamin Byholm + * - Trevor Norris + * - Nathan Rajlich + * - Brett Lawson + * - Ben Noordhuis + * - David Siegel + * + * MIT License + * + * Version 1.6.2: current Node unstable: 0.11.16, Node stable: 0.10.36, io.js: 1.1.0 + * + * See https://github.com/rvagg/nan for the latest update to this file + **********************************************************************************/ + +#ifndef NAN_H_ +#define NAN_H_ + +#include +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +#if defined(__GNUC__) && !(defined(DEBUG) && DEBUG) +# define NAN_INLINE inline __attribute__((always_inline)) +#elif defined(_MSC_VER) && !(defined(DEBUG) && DEBUG) +# define NAN_INLINE __forceinline +#else +# define NAN_INLINE inline +#endif + +#if defined(__GNUC__) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __declspec(deprecated) +#else +# define NAN_DEPRECATED +#endif + +#if (NODE_MODULE_VERSION < 12) +typedef v8::InvocationCallback NanFunctionCallback; +typedef v8::Script NanUnboundScript; +typedef v8::Script NanBoundScript; +#else +typedef v8::FunctionCallback NanFunctionCallback; +typedef v8::UnboundScript NanUnboundScript; +typedef v8::Script NanBoundScript; +#endif + +#if (NODE_MODULE_VERSION < 42) +typedef v8::String::ExternalAsciiStringResource + NanExternalOneByteStringResource; +#else // io.js v1.0.0 +typedef v8::String::ExternalOneByteStringResource + NanExternalOneByteStringResource; +#endif + +#include "nan_new.h" // NOLINT(build/include) + +// uv helpers +#ifdef UV_VERSION_MAJOR +#ifndef UV_VERSION_PATCH +#define UV_VERSION_PATCH 0 +#endif +#define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \ + (UV_VERSION_MINOR << 8) | \ + (UV_VERSION_PATCH)) +#else +#define NAUV_UVVERSION 0x000b00 +#endif + + +#if NAUV_UVVERSION < 0x000b17 +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async, int) +#else +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async) +#endif + +// some generic helpers + +template NAN_INLINE bool NanSetPointerSafe( + T *var + , T val +) { + if (var) { + *var = val; + return true; + } else { + return false; + } +} + +template NAN_INLINE T NanGetPointerSafe( + T *var + , T fallback = reinterpret_cast(0) +) { + if (var) { + return *var; + } else { + return fallback; + } +} + +NAN_INLINE bool NanBooleanOptionValue( + v8::Local optionsObj + , v8::Handle 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 optionsObj + , v8::Handle opt +) { + return NanBooleanOptionValue(optionsObj, opt, false); +} + +NAN_INLINE uint32_t NanUInt32OptionValue( + v8::Local optionsObj + , v8::Handle opt + , uint32_t def +) { + return !optionsObj.IsEmpty() + && optionsObj->Has(opt) + && optionsObj->Get(opt)->IsNumber() + ? optionsObj->Get(opt)->Uint32Value() + : def; +} + +template +v8::Local NanNew(v8::Handle); + +template +NAN_INLINE v8::Local _NanEnsureLocal(v8::Handle val) { + return NanNew(val); +} + +template +NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { + return val; +} + +/* io.js 1.0 */ +#if NODE_MODULE_VERSION >= 42 || NODE_VERSION_AT_LEAST(0, 11, 15) + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::Isolate::GetCurrent()->SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::Isolate::GetCurrent()->LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::Isolate::GetCurrent()->ContextDisposedNotification(); + } +#else + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::V8::SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::V8::SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::V8::SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::V8::IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::V8::LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::V8::ContextDisposedNotification(); + } +#endif + +#if (NODE_MODULE_VERSION > 0x000B) +// Node 0.11+ (0.11.12 and below won't compile with these) + +# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo& +# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args +# define _NAN_METHOD_RETURN_TYPE void + +# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +# define _NAN_GETTER_RETURN_TYPE void + +# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo& +# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args +# define _NAN_SETTER_RETURN_TYPE void + +# define _NAN_PROPERTY_GETTER_ARGS_TYPE \ + const v8::PropertyCallbackInfo& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# 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& +# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args +# define _NAN_INDEX_QUERY_RETURN_TYPE void + +# define NanScope() v8::HandleScope scope(v8::Isolate::GetCurrent()) +# define NanEscapableScope() \ + v8::EscapableHandleScope scope(v8::Isolate::GetCurrent()) + +# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) +# define NanLocker() v8::Locker locker(v8::Isolate::GetCurrent()) +# define NanUnlocker() v8::Unlocker unlocker(v8::Isolate::GetCurrent()) +# define NanReturnValue(value) return args.GetReturnValue().Set(value) +# define NanReturnUndefined() return +# define NanReturnHolder() NanReturnValue(args.Holder()) +# define NanReturnThis() NanReturnValue(args.This()) +# define NanReturnNull() return args.GetReturnValue().SetNull() +# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString() + +# define NanObjectWrapHandle(obj) obj->handle() + + NAN_INLINE v8::Local NanUndefined() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanNull() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanTrue() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE v8::Local NanFalse() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent()))); + } + + NAN_INLINE int NanAdjustExternalMemory(int bc) { + return static_cast( + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , const char *name + , v8::Handle value) { + templ->Set(v8::Isolate::GetCurrent(), name, value); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + NAN_INLINE v8::Local NanGetCurrentContext() { + return v8::Isolate::GetCurrent()->GetCurrentContext(); + } + + NAN_INLINE void* NanGetInternalFieldPointer( + v8::Handle object + , int index) { + return object->GetAlignedPointerFromInternalField(index); + } + + NAN_INLINE void NanSetInternalFieldPointer( + v8::Handle object + , int index + , void* value) { + object->SetAlignedPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) + + NAN_INLINE void NanAddGCEpilogueCallback( + v8::Isolate::GCEpilogueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); + } + + NAN_INLINE void NanRemoveGCEpilogueCallback( + v8::Isolate::GCEpilogueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); + } + + NAN_INLINE void NanAddGCPrologueCallback( + v8::Isolate::GCPrologueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); + } + + NAN_INLINE void NanRemoveGCPrologueCallback( + v8::Isolate::GCPrologueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); + } + + NAN_INLINE void NanGetHeapStatistics( + v8::HeapStatistics *heap_statistics) { + v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( + const char* data, int length = -1) { + return NanNew(data, length); + } + + template + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , v8::Handle obj) { + handle.Reset(v8::Isolate::GetCurrent(), obj); + } + + template + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , const v8::Persistent& obj) { + handle.Reset(v8::Isolate::GetCurrent(), obj); + } + + template + class _NanWeakCallbackData; + + template + struct _NanWeakCallbackInfo { + typedef void (*Callback)(const _NanWeakCallbackData& data); + NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) + : parameter(param), callback(cb) { + NanAssignPersistent(persistent, handle); + } + + NAN_INLINE ~_NanWeakCallbackInfo() { + persistent.Reset(); + } + + P* const parameter; + Callback const callback; + v8::Persistent persistent; + }; + + template + class _NanWeakCallbackData { + public: + NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) + : info_(info) { } + + NAN_INLINE v8::Local GetValue() const { + return NanNew(info_->persistent); + } + + NAN_INLINE P* GetParameter() const { return info_->parameter; } + + NAN_INLINE bool IsNearDeath() const { + return info_->persistent.IsNearDeath(); + } + + NAN_INLINE void Revive() const; + + NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { + return info_; + } + + NAN_DEPRECATED NAN_INLINE void Dispose() const { + } + + private: + _NanWeakCallbackInfo* info_; + }; + + template + static void _NanWeakCallbackDispatcher( + const v8::WeakCallbackData > &data) { + _NanWeakCallbackInfo *info = data.GetParameter(); + _NanWeakCallbackData wcbd(info); + info->callback(wcbd); + if (wcbd.IsNearDeath()) { + delete wcbd.GetCallbackInfo(); + } + } + + template + NAN_INLINE void _NanWeakCallbackData::Revive() const { + info_->persistent.SetWeak(info_, &_NanWeakCallbackDispatcher); + } + +template +NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( + v8::Handle handle + , P* parameter + , typename _NanWeakCallbackInfo::Callback callback) { + _NanWeakCallbackInfo *cbinfo = + new _NanWeakCallbackInfo(handle, parameter, callback); + cbinfo->persistent.SetWeak(cbinfo, &_NanWeakCallbackDispatcher); + return cbinfo; +} + +# define NAN_WEAK_CALLBACK(name) \ + template \ + static void name(const _NanWeakCallbackData &data) + +# define _NAN_ERROR(fun, errmsg) fun(NanNew(errmsg)) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + v8::Isolate::GetCurrent()->ThrowException(_NAN_ERROR(fun, errmsg)); \ + } while (0); + + NAN_INLINE v8::Local 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 error) { + NanScope(); + v8::Isolate::GetCurrent()->ThrowException(error); + } + + NAN_INLINE v8::Local NanError( + const char *msg + , const int errorNumber + ) { + v8::Local err = v8::Exception::Error(NanNew(msg)); + v8::Local obj = err.As(); + obj->Set(NanNew("code"), NanNew(errorNumber)); + return err; + } + + NAN_INLINE void NanThrowError( + const char *msg + , const int errorNumber + ) { + NanThrowError(NanError(msg, errorNumber)); + } + + NAN_INLINE v8::Local 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 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 NAN_INLINE void NanDisposePersistent( + v8::Persistent &handle + ) { + handle.Reset(); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + char *data + , size_t length + , node::smalloc::FreeCallback callback + , void *hint + ) { + return node::Buffer::New( + v8::Isolate::GetCurrent(), data, length, callback, hint); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + const char *data + , uint32_t size + ) { + return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); + } + + NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { + return node::Buffer::New(v8::Isolate::GetCurrent(), size); + } + + NAN_INLINE v8::Local NanBufferUse( + char* data + , uint32_t size + ) { + return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); + } + + NAN_INLINE bool NanHasInstance( + const v8::Persistent& function_template + , v8::Handle value + ) { + return NanNew(function_template)->HasInstance(value); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle() + ) { + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + return v8::Local::New( + isolate + , v8::Context::New(isolate, extensions, tmpl, obj) + ); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + v8::ScriptCompiler::Source source(s, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + ) { + v8::ScriptCompiler::Source source(s); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + NAN_INLINE v8::Local NanRunScript( + v8::Handle script + ) { + return script->BindToCurrentContext()->Run(); + } + + NAN_INLINE v8::Local NanRunScript( + v8::Handle script + ) { + return script->Run(); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle func + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv)); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle symbol + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv)); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , const char* method + , int argc + , v8::Handle* argv) { + return NanNew(node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv)); + } + + template + NAN_INLINE void NanSetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(0, data); + } + + template + NAN_INLINE T *NanGetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData(0)); + } + + class NanAsciiString { + public: + NAN_INLINE explicit NanAsciiString(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new char[size + 1]; + size = toStr->WriteOneByte(reinterpret_cast(buf)); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanAsciiString() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanAsciiString(const NanAsciiString&); + void operator=(const NanAsciiString&); + + char *buf; + int size; + }; + + class NanUtf8String { + public: + NAN_INLINE explicit NanUtf8String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Utf8Length(); + buf = new char[size + 1]; + toStr->WriteUtf8(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanUtf8String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUtf8String(const NanUtf8String&); + void operator=(const NanUtf8String&); + + char *buf; + int size; + }; + + class NanUcs2String { + public: + NAN_INLINE explicit NanUcs2String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new uint16_t[size + 1]; + toStr->Write(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE uint16_t* operator*() { return buf; } + NAN_INLINE const uint16_t* operator*() const { return buf; } + + NAN_INLINE ~NanUcs2String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUcs2String(const NanUcs2String&); + void operator=(const NanUcs2String&); + + uint16_t *buf; + int size; + }; + +#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 + +# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo & +# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args +# define _NAN_GETTER_RETURN_TYPE v8::Handle + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + +# 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 + + NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( + const char* data, int length = -1) { + return v8::String::NewSymbol(data, length); + } + +# 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 NanReturnHolder() NanReturnValue(args.Holder()) +# define NanReturnThis() NanReturnValue(args.This()) +# define NanReturnUndefined() return v8::Undefined() +# define NanReturnNull() return v8::Null() +# define NanReturnEmptyString() return v8::String::Empty() +# define NanObjectWrapHandle(obj) v8::Local::New(obj->handle_) + + NAN_INLINE v8::Local NanUndefined() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Undefined())); + } + + NAN_INLINE v8::Local NanNull() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::Null())); + } + + NAN_INLINE v8::Local NanTrue() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::True())); + } + + NAN_INLINE v8::Local NanFalse() { + NanEscapableScope(); + return NanEscapeScope(NanNew(v8::False())); + } + + NAN_INLINE int NanAdjustExternalMemory(int bc) { + return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , const char *name + , v8::Handle value) { + templ->Set(name, value); + } + + NAN_INLINE void NanSetTemplate( + v8::Handle templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + NAN_INLINE v8::Local NanGetCurrentContext() { + return v8::Context::GetCurrent(); + } + + NAN_INLINE void* NanGetInternalFieldPointer( + v8::Handle object + , int index) { + return object->GetPointerFromInternalField(index); + } + + NAN_INLINE void NanSetInternalFieldPointer( + v8::Handle object + , int index + , void* value) { + object->SetPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::GCType type, v8::GCCallbackFlags flags) + + 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 + NAN_INLINE void NanAssignPersistent( + v8::Persistent& handle + , v8::Handle obj) { + handle.Dispose(); + handle = v8::Persistent::New(obj); + } + + template + class _NanWeakCallbackData; + + template + struct _NanWeakCallbackInfo { + typedef void (*Callback)(const _NanWeakCallbackData &data); + NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) + : parameter(param) + , callback(cb) + , persistent(v8::Persistent::New(handle)) { } + + NAN_INLINE ~_NanWeakCallbackInfo() { + persistent.Dispose(); + persistent.Clear(); + } + + P* const parameter; + Callback const callback; + v8::Persistent persistent; + }; + + template + class _NanWeakCallbackData { + public: + NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) + : info_(info) { } + + NAN_INLINE v8::Local GetValue() const { + return NanNew(info_->persistent); + } + + NAN_INLINE P* GetParameter() const { return info_->parameter; } + + NAN_INLINE bool IsNearDeath() const { + return info_->persistent.IsNearDeath(); + } + + NAN_INLINE void Revive() const; + + NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { + return info_; + } + + NAN_DEPRECATED NAN_INLINE void Dispose() const { + } + + private: + _NanWeakCallbackInfo* info_; + }; + + template + static void _NanWeakPersistentDispatcher( + v8::Persistent object, void *data) { + _NanWeakCallbackInfo* info = + static_cast<_NanWeakCallbackInfo*>(data); + _NanWeakCallbackData wcbd(info); + info->callback(wcbd); + if (wcbd.IsNearDeath()) { + delete wcbd.GetCallbackInfo(); + } + } + + template + NAN_INLINE void _NanWeakCallbackData::Revive() const { + info_->persistent.MakeWeak( + info_ + , &_NanWeakPersistentDispatcher); + } + + template + NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( + v8::Handle handle + , P* parameter + , typename _NanWeakCallbackInfo::Callback callback) { + _NanWeakCallbackInfo *cbinfo = + new _NanWeakCallbackInfo(handle, parameter, callback); + cbinfo->persistent.MakeWeak( + cbinfo + , &_NanWeakPersistentDispatcher); + return cbinfo; + } + +# define NAN_WEAK_CALLBACK(name) \ + template \ + static void name(const _NanWeakCallbackData &data) + +# define _NAN_ERROR(fun, errmsg) \ + fun(v8::String::New(errmsg)) + +# define _NAN_THROW_ERROR(fun, errmsg) \ + do { \ + NanScope(); \ + return v8::Local::New( \ + v8::ThrowException(_NAN_ERROR(fun, errmsg))); \ + } while (0); + + NAN_INLINE v8::Local NanError(const char* errmsg) { + return _NAN_ERROR(v8::Exception::Error, errmsg); + } + + NAN_INLINE v8::Local NanThrowError(const char* errmsg) { + _NAN_THROW_ERROR(v8::Exception::Error, errmsg); + } + + NAN_INLINE v8::Local NanThrowError( + v8::Handle error + ) { + NanScope(); + return v8::Local::New(v8::ThrowException(error)); + } + + NAN_INLINE v8::Local NanError( + const char *msg + , const int errorNumber + ) { + v8::Local err = v8::Exception::Error(v8::String::New(msg)); + v8::Local obj = err.As(); + obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber)); + return err; + } + + NAN_INLINE v8::Local NanThrowError( + const char *msg + , const int errorNumber + ) { + return NanThrowError(NanError(msg, errorNumber)); + } + + NAN_INLINE v8::Local NanTypeError(const char* errmsg) { + return _NAN_ERROR(v8::Exception::TypeError, errmsg); + } + + NAN_INLINE v8::Local NanThrowTypeError( + const char* errmsg + ) { + _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); + } + + NAN_INLINE v8::Local NanRangeError( + const char* errmsg + ) { + return _NAN_ERROR(v8::Exception::RangeError, errmsg); + } + + NAN_INLINE v8::Local NanThrowRangeError( + const char* errmsg + ) { + _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); + } + + template + NAN_INLINE void NanDisposePersistent( + v8::Persistent &handle) { // NOLINT(runtime/references) + handle.Dispose(); + handle.Clear(); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + char *data + , size_t length + , node::Buffer::free_callback callback + , void *hint + ) { + return NanNew( + node::Buffer::New(data, length, callback, hint)->handle_); + } + + NAN_INLINE v8::Local NanNewBufferHandle ( + const char *data + , uint32_t size + ) { +#if NODE_MODULE_VERSION >= 0x000B + return NanNew(node::Buffer::New(data, size)->handle_); +#else + return NanNew( + node::Buffer::New(const_cast(data), size)->handle_); +#endif + } + + NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { + return NanNew(node::Buffer::New(size)->handle_); + } + + NAN_INLINE void FreeData(char *data, void *hint) { + delete[] data; + } + + NAN_INLINE v8::Local NanBufferUse( + char* data + , uint32_t size + ) { + return NanNew( + node::Buffer::New(data, size, FreeData, NULL)->handle_); + } + + NAN_INLINE bool NanHasInstance( + const v8::Persistent& function_template + , v8::Handle value + ) { + return function_template->HasInstance(value); + } + + NAN_DEPRECATED NAN_INLINE v8::Local NanNewContextHandle( + v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle() + ) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = NanNew(ctx); + ctx.Dispose(); + return lctx; + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + return v8::Script::Compile(s, const_cast(&origin)); + } + + NAN_INLINE v8::Local NanCompileScript( + v8::Local s + ) { + return v8::Script::Compile(s); + } + + NAN_INLINE v8::Local NanRunScript(v8::Handle script) { + return script->Run(); + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle func + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, func, argc, argv)); +# else + v8::TryCatch try_catch; + v8::Local result = func->Call(target, argc, argv); + if (try_catch.HasCaught()) { + node::FatalException(try_catch); + } + return result; +# endif + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , v8::Handle symbol + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, symbol, argc, argv)); +# else + v8::Local callback = target->Get(symbol).As(); + return NanMakeCallback(target, callback, argc, argv); +# endif + } + + NAN_INLINE v8::Local NanMakeCallback( + v8::Handle target + , const char* method + , int argc + , v8::Handle* argv) { +# if NODE_VERSION_AT_LEAST(0, 8, 0) + return NanNew(node::MakeCallback(target, method, argc, argv)); +# else + return NanMakeCallback(target, NanNew(method), argc, argv); +# endif + } + + template + NAN_INLINE void NanSetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(data); + } + + template + NAN_INLINE T *NanGetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData()); + } + + class NanAsciiString { + public: + NAN_INLINE explicit NanAsciiString(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new char[size + 1]; + size = toStr->WriteAscii(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanAsciiString() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanAsciiString(const NanAsciiString&); + void operator=(const NanAsciiString&); + + char *buf; + int size; + }; + + class NanUtf8String { + public: + NAN_INLINE explicit NanUtf8String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Utf8Length(); + buf = new char[size + 1]; + toStr->WriteUtf8(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE char* operator*() { return buf; } + NAN_INLINE const char* operator*() const { return buf; } + + NAN_INLINE ~NanUtf8String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUtf8String(const NanUtf8String&); + void operator=(const NanUtf8String&); + + char *buf; + int size; + }; + + class NanUcs2String { + public: + NAN_INLINE explicit NanUcs2String(v8::Handle from) { + v8::Local toStr = from->ToString(); + size = toStr->Length(); + buf = new uint16_t[size + 1]; + toStr->Write(buf); + } + + NAN_DEPRECATED NAN_INLINE int Size() const { + return size; + } + + NAN_INLINE int length() const { + return size; + } + + NAN_INLINE uint16_t* operator*() { return buf; } + NAN_INLINE const uint16_t* operator*() const { return buf; } + + NAN_INLINE ~NanUcs2String() { + delete[] buf; + } + + private: + // disallow copying and assigning + NanUcs2String(const NanUcs2String&); + void operator=(const NanUcs2String&); + + uint16_t *buf; + int size; + }; + +#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 property \ + , _NAN_GETTER_ARGS) +#define NAN_SETTER(name) \ + _NAN_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local value \ + , _NAN_SETTER_ARGS) +#define NAN_PROPERTY_GETTER(name) \ + _NAN_PROPERTY_GETTER_RETURN_TYPE name( \ + v8::Local property \ + , _NAN_PROPERTY_GETTER_ARGS) +#define NAN_PROPERTY_SETTER(name) \ + _NAN_PROPERTY_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local 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 property \ + , _NAN_PROPERTY_DELETER_ARGS) +#define NAN_PROPERTY_QUERY(name) \ + _NAN_PROPERTY_QUERY_RETURN_TYPE name( \ + v8::Local 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 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 obj = NanNew(); + NanAssignPersistent(handle, obj); + } + + explicit NanCallback(const v8::Handle &fn) { + NanScope(); + v8::Local obj = NanNew(); + NanAssignPersistent(handle, obj); + SetFunction(fn); + } + + ~NanCallback() { + if (handle.IsEmpty()) return; + NanDisposePersistent(handle); + } + + NAN_INLINE void SetFunction(const v8::Handle &fn) { + NanScope(); + NanNew(handle)->Set(kCallbackIndex, fn); + } + + NAN_INLINE v8::Local GetFunction() const { + NanEscapableScope(); + return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex) + .As()); + } + + NAN_INLINE bool IsEmpty() const { + NanScope(); + return NanNew(handle)->Get(kCallbackIndex)->IsUndefined(); + } + + v8::Handle Call(int argc, v8::Handle argv[]) const { + NanEscapableScope(); +#if (NODE_MODULE_VERSION > 0x000B) // 0.11.12+ + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Local callback = NanNew(handle)-> + Get(kCallbackIndex).As(); + return NanEscapeScope(node::MakeCallback( + isolate + , isolate->GetCurrentContext()->Global() + , callback + , argc + , argv + )); +#else +#if NODE_VERSION_AT_LEAST(0, 8, 0) + v8::Local callback = handle-> + Get(kCallbackIndex).As(); + return NanEscapeScope(node::MakeCallback( + v8::Context::GetCurrent()->Global() + , callback + , argc + , argv + )); +#else + v8::Local callback = handle-> + Get(kCallbackIndex).As(); + return NanEscapeScope(NanMakeCallback( + v8::Context::GetCurrent()->Global(), callback, argc, argv)); +#endif +#endif + } + + private: + v8::Persistent handle; + static const uint32_t kCallbackIndex = 0; +}; + +/* abstract */ class NanAsyncWorker { + public: + explicit NanAsyncWorker(NanCallback *callback_) + : callback(callback_), errmsg_(NULL) { + request.data = this; + + NanScope(); + v8::Local obj = NanNew(); + 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, const v8::Local &obj) { + v8::Local handle = NanNew(persistentHandle); + handle->Set(NanNew(key), obj); + } + + v8::Local GetFromPersistent(const char *key) const { + NanEscapableScope(); + v8::Local handle = NanNew(persistentHandle); + return NanEscapeScope(handle->Get(NanNew(key)).As()); + } + + virtual void Execute() = 0; + + uv_work_t request; + + virtual void Destroy() { + delete this; + } + + protected: + v8::Persistent persistentHandle; + NanCallback *callback; + + virtual void HandleOKCallback() { + callback->Call(0, NULL); + } + + virtual void HandleErrorCallback() { + NanScope(); + + v8::Local argv[] = { + v8::Exception::Error(NanNew(ErrorMessage())) + }; + callback->Call(1, argv); + } + + void SetErrorMessage(const char *msg) { + if (errmsg_) { + delete[] errmsg_; + } + + size_t size = strlen(msg) + 1; + errmsg_ = new char[size]; + memcpy(errmsg_, msg, size); + } + + const char* ErrorMessage() const { + return errmsg_; + } + + private: + char *errmsg_; +}; + +/* abstract */ class NanAsyncProgressWorker : public NanAsyncWorker { + public: + explicit NanAsyncProgressWorker(NanCallback *callback_) + : NanAsyncWorker(callback_), asyncdata_(NULL), asyncsize_(0) { + async = new uv_async_t; + uv_async_init( + uv_default_loop() + , async + , AsyncProgress_ + ); + async->data = this; + + uv_mutex_init(&async_lock); + } + + virtual ~NanAsyncProgressWorker() { + uv_mutex_destroy(&async_lock); + + if (asyncdata_) { + delete[] asyncdata_; + } + } + + void WorkProgress() { + uv_mutex_lock(&async_lock); + char *data = asyncdata_; + size_t size = asyncsize_; + asyncdata_ = NULL; + uv_mutex_unlock(&async_lock); + + // Dont send progress events after we've already completed. + if (callback) { + HandleProgressCallback(data, size); + } + delete[] data; + } + + class ExecutionProgress { + friend class NanAsyncProgressWorker; + public: + // You could do fancy generics with templates here. + void Send(const char* data, size_t size) const { + that_->SendProgress_(data, size); + } + + private: + explicit ExecutionProgress(NanAsyncProgressWorker* that) : that_(that) {} + // Prohibit copying and assignment. + ExecutionProgress(const ExecutionProgress&); + void operator=(const ExecutionProgress&); + #if __cplusplus >= 201103L + // Prohibit C++11 move semantics. + ExecutionProgress(ExecutionProgress&&) = delete; + void operator=(ExecutionProgress&&) = delete; + #endif + NanAsyncProgressWorker* const that_; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void HandleProgressCallback(const char *data, size_t size) = 0; + + virtual void Destroy() { + uv_close(reinterpret_cast(async), AsyncClose_); + } + + private: + void Execute() /*final override*/ { + ExecutionProgress progress(this); + Execute(progress); + } + + void SendProgress_(const char *data, size_t size) { + char *new_data = new char[size]; + memcpy(new_data, data, size); + + uv_mutex_lock(&async_lock); + char *old_data = asyncdata_; + asyncdata_ = new_data; + asyncsize_ = size; + uv_mutex_unlock(&async_lock); + + if (old_data) { + delete[] old_data; + } + uv_async_send(async); + } + + NAN_INLINE static NAUV_WORK_CB(AsyncProgress_) { + NanAsyncProgressWorker *worker = + static_cast(async->data); + worker->WorkProgress(); + } + + NAN_INLINE static void AsyncClose_(uv_handle_t* handle) { + NanAsyncProgressWorker *worker = + static_cast(handle->data); + delete reinterpret_cast(handle); + delete worker; + } + + uv_async_t *async; + uv_mutex_t async_lock; + char *asyncdata_; + size_t asyncsize_; +}; + +NAN_INLINE void NanAsyncExecute (uv_work_t* req) { + NanAsyncWorker *worker = static_cast(req->data); + worker->Execute(); +} + +NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) { + NanAsyncWorker* worker = static_cast(req->data); + worker->WorkComplete(); + worker->Destroy(); +} + +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 +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 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 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(-1); +} + +template 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; +} + +namespace NanIntern { + +inline +NanExternalOneByteStringResource const* +GetExternalResource(v8::Local str) { +#if NODE_MODULE_VERSION < 42 + return str->GetExternalAsciiStringResource(); +#else // io.js v1.0.0 + return str->GetExternalOneByteStringResource(); +#endif +} + +inline +bool +IsExternal(v8::Local str) { +#if NODE_MODULE_VERSION < 42 + return str->IsExternalAscii(); +#else // io.js v1.0.0 + return str->IsExternalOneByte(); +#endif +} + +} // end of namespace NanIntern + +static bool _NanGetExternalParts( + v8::Handle val + , const char** data + , size_t* len +) { + if (node::Buffer::HasInstance(val)) { + *data = node::Buffer::Data(val.As()); + *len = node::Buffer::Length(val.As()); + return true; + } + + assert(val->IsString()); + v8::Local str = NanNew(val.As()); + + if (NanIntern::IsExternal(str)) { + const NanExternalOneByteStringResource* ext; + ext = NanIntern::GetExternalResource(str); + *data = ext->data(); + *len = ext->length(); + return true; + } + + if (str->IsExternal()) { + const v8::String::ExternalStringResource* ext; + ext = str->GetExternalStringResource(); + *data = reinterpret_cast(ext->data()); + *len = ext->length(); + return true; + } + + return false; +} + +namespace Nan { + enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; +} + +#if !NODE_VERSION_AT_LEAST(0, 10, 0) +# include "nan_string_bytes.h" // NOLINT(build/include) +#endif + +NAN_INLINE v8::Local NanEncode( + const void *buf, size_t len, enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION >= 42) + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + node::encoding node_enc = static_cast(encoding); + + if (encoding == Nan::UCS2) { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len / 2); + } else { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len + , node_enc); + } +#elif (NODE_MODULE_VERSION > 0x000B) + return node::Encode( + v8::Isolate::GetCurrent() + , buf, len + , static_cast(encoding)); +#else +# if NODE_VERSION_AT_LEAST(0, 10, 0) + return node::Encode(buf, len, static_cast(encoding)); +# else + return NanIntern::Encode(reinterpret_cast(buf), len, encoding); +# endif +#endif +} + +NAN_INLINE ssize_t NanDecodeBytes( + v8::Handle val, enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION > 0x000B) + return node::DecodeBytes( + v8::Isolate::GetCurrent() + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < 0x000B) + if (encoding == Nan::BUFFER) { + return node::DecodeBytes(val, node::BINARY); + } +# endif + return node::DecodeBytes(val, static_cast(encoding)); +#endif +} + +NAN_INLINE ssize_t NanDecodeWrite( + char *buf + , size_t len + , v8::Handle val + , enum Nan::Encoding encoding = Nan::BINARY) { +#if (NODE_MODULE_VERSION > 0x000B) + return node::DecodeWrite( + v8::Isolate::GetCurrent() + , buf + , len + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < 0x000B) + if (encoding == Nan::BUFFER) { + return node::DecodeWrite(buf, len, val, node::BINARY); + } +# endif + return node::DecodeWrite( + buf + , len + , val + , static_cast(encoding)); +#endif +} + +/* NAN_DEPRECATED */ NAN_INLINE void* _NanRawString( + v8::Handle 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(&data) + , &len); + + if (is_extern && !term_len) { + NanSetPointerSafe(datalen, len); + return data; + } + + v8::Local toStr = from->ToString(); + + char *to = static_cast(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( + datalen + , toStr->WriteAscii(to, 0, static_cast(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 somelen = toStr->Write(twobytebuf, 0, + static_cast(sz_ + term_len), flags); + + for (size_t i = 0; i < sz_ + term_len && i < somelen + term_len; i++) { + unsigned char *b = reinterpret_cast(&twobytebuf[i]); + to[i] = *b; + } + + NanSetPointerSafe(datalen, somelen); + + delete[] twobytebuf; + return to; + } +#else + NanSetPointerSafe( + datalen, + toStr->WriteOneByte( + reinterpret_cast(to) + , 0 + , static_cast(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( + datalen + , toStr->WriteUtf8(to, static_cast(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( + 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(to) + , 0 + , static_cast(sz_ + term_len) + , flags); + NanSetPointerSafe(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( + 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_DEPRECATED NAN_INLINE void* NanRawString( + v8::Handle from + , enum Nan::Encoding encoding + , size_t *datalen + , void *buf + , size_t buflen + , int flags +) { + return _NanRawString(from, encoding, datalen, buf, buflen, flags); +} + + +NAN_DEPRECATED NAN_INLINE char* NanCString( + v8::Handle from + , size_t *datalen + , char *buf = NULL + , size_t buflen = 0 + , int flags = v8::String::NO_OPTIONS +) { + return static_cast( + _NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags) + ); +} + +NAN_INLINE void NanSetPrototypeTemplate( + v8::Local templ + , const char *name + , v8::Handle value +) { + NanSetTemplate(templ->PrototypeTemplate(), name, value); +} + +NAN_INLINE void NanSetPrototypeTemplate( + v8::Local templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes +) { + NanSetTemplate(templ->PrototypeTemplate(), name, value, attributes); +} + +NAN_INLINE void NanSetInstanceTemplate( + v8::Local templ + , const char *name + , v8::Handle value +) { + NanSetTemplate(templ->InstanceTemplate(), name, value); +} + +NAN_INLINE void NanSetInstanceTemplate( + v8::Local templ + , v8::Handle name + , v8::Handle value + , v8::PropertyAttribute attributes +) { + NanSetTemplate(templ->InstanceTemplate(), name, value, attributes); +} + +//=== Export ================================================================== + +inline +void +NanExport(v8::Handle target, const char * name, + NanFunctionCallback f) { + target->Set(NanNew(name), + NanNew(f)->GetFunction()); +} + +//=== Tap Reverse Binding ===================================================== + +struct NanTap { + explicit NanTap(v8::Handle t) : t_() { + NanAssignPersistent(t_, t->ToObject()); + } + + ~NanTap() { NanDisposePersistent(t_); } // not sure if neccessary + + inline void plan(int i) { + v8::Handle arg = NanNew(i); + NanMakeCallback(NanNew(t_), "plan", 1, &arg); + } + + inline void ok(bool isOk, const char * msg = NULL) { + v8::Handle args[2]; + args[0] = NanNew(isOk); + if (msg) args[1] = NanNew(msg); + NanMakeCallback(NanNew(t_), "ok", msg ? 2 : 1, args); + } + + private: + v8::Persistent t_; +}; + +#define NAN_STRINGIZE2(x) #x +#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) +#define NAN_TEST_EXPRESSION(expression) \ + ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression + +#define return_NanValue(v) NanReturnValue(v) +#define return_NanUndefined() NanReturnUndefined() +#define NAN_EXPORT(target, function) NanExport(target, #function, function) + +#endif // NAN_H_ diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_12_inl.h b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_12_inl.h new file mode 100644 index 00000000..ff63ec0c --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_12_inl.h @@ -0,0 +1,262 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_12_INL_H_ +#define NAN_IMPLEMENTATION_12_INL_H_ +//============================================================================== +// node v0.11 implementation +//============================================================================== + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +namespace NanIntern { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(v8::Isolate::GetCurrent(), length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(v8::Isolate::GetCurrent(), value); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Handle tmpl + , v8::Handle obj) { + return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj); +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(v8::Isolate::GetCurrent(), value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(v8::Isolate::GetCurrent(), value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data) { + return v8::Function::New( v8::Isolate::GetCurrent() + , callback + , data); +} + +//=== Function Template ======================================================== + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data + , v8::Handle signature) { + return v8::FunctionTemplate::New( v8::Isolate::GetCurrent() + , callback + , data + , signature); +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(v8::Isolate::GetCurrent(), value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New( v8::Isolate::GetCurrent() + , value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(v8::Isolate::GetCurrent(), value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(v8::Isolate::GetCurrent()); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(v8::Isolate::GetCurrent()); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Handle pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New( Factory::FTH receiver + , int argc + , Factory::FTH argv[]) { + return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), + value.data(), v8::String::kNormalString, static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint8_t * value, int length) { + return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +Factory::return_t +Factory::New(NanExternalOneByteStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Handle value) { + return v8::StringObject::New(value).As(); +} + +//=== Unbound Script =========================================================== + +Factory::return_t +Factory::New(v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +} // end of namespace NanIntern + +//=== Presistents and Handles ================================================== + +template +inline v8::Local NanNew(v8::Handle h) { + return v8::Local::New(v8::Isolate::GetCurrent(), h); +} + +template +inline v8::Local NanNew(v8::Persistent const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +#endif // NAN_IMPLEMENTATION_12_INL_H_ diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_pre_12_inl.h b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_pre_12_inl.h new file mode 100644 index 00000000..85dd2754 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_implementation_pre_12_inl.h @@ -0,0 +1,268 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_ +#define NAN_IMPLEMENTATION_PRE_12_INL_H_ + +#include + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# include +# pragma warning( default : 4530 ) +#else +# include +# include +#endif + +//============================================================================== +// node v0.10 implementation +//============================================================================== + +namespace NanIntern { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(value)->ToBoolean(); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Handle tmpl + , v8::Handle obj) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = v8::Local::New(ctx); + ctx.Dispose(); + return lctx; +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data) { + return Factory::New( callback + , data + , v8::Handle() + )->GetFunction(); +} + + +//=== FunctionTemplate ========================================================= + +Factory::return_t +Factory::New( NanFunctionCallback callback + , v8::Handle data + , v8::Handle signature) { + // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find + // a way. Have at it though... + return v8::FunctionTemplate::New( callback + , data + , signature); +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New(value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Handle pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + return v8::Script::New(source); +} +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + return v8::Script::New(source, const_cast(&origin)); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New( Factory::FTH receiver + , int argc + , Factory::FTH argv[]) { + return v8::Signature::New(receiver, argc, argv); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::New( value.data(), static_cast(value.size())); +} + +inline +void +widenString(std::vector *ws, const uint8_t *s, int l = -1) { + size_t len = static_cast(l); + if (l < 0) { + len = strlen(reinterpret_cast(s)); + } + assert(len <= INT_MAX && "string too long"); + ws->resize(len); + std::copy(s, s + len, ws->begin()); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(const uint8_t * value, int length) { + std::vector wideString; + widenString(&wideString, value, length); + if (wideString.size() == 0) { + return v8::String::Empty(); + } else { + return v8::String::New(&wideString.front() + , static_cast(wideString.size())); + } +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(value); +} + +Factory::return_t +Factory::New(v8::String::ExternalAsciiStringResource * value) { + return v8::String::NewExternal(value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Handle value) { + return v8::StringObject::New(value).As(); +} + +} // end of namespace NanIntern + +//=== Presistents and Handles ================================================== + +template +inline v8::Local NanNew(v8::Handle h) { + return v8::Local::New(h); +} + +template +inline v8::Local NanNew(v8::Persistent const& p) { + return v8::Local::New(p); +} + +#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_ diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_new.h b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_new.h new file mode 100644 index 00000000..95b6b51e --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_new.h @@ -0,0 +1,329 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2015 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_NEW_H_ +#define NAN_NEW_H_ + +#if defined(_MSC_VER) +# pragma warning( disable : 4530 ) +# include +# pragma warning( default : 4530 ) +#else +# include +#endif + +namespace NanIntern { // scnr + +// TODO(agnat): Generalize +template v8::Local To(v8::Handle i); + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToInteger(); } + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToInt32(); } + +template <> +inline +v8::Local +To(v8::Handle i) { return i->ToUint32(); } + +template struct FactoryBase { typedef v8::Local return_t; }; + +template struct Factory; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(int length); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( v8::ExtensionConfiguration* extensions = NULL + , v8::Handle tmpl = v8::Handle() + , v8::Handle obj = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(void *value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( NanFunctionCallback callback + , v8::Handle data = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( NanFunctionCallback callback = NULL + , v8::Handle data = v8::Handle() + , v8::Handle signature = v8::Handle()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template +struct IntegerFactory : FactoryBase { + typedef typename FactoryBase::return_t return_t; + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New( + v8::Handle pattern, v8::RegExp::Flags flags); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +template <> +struct Factory : FactoryBase { + typedef v8::Handle FTH; + static inline + return_t + New( FTH receiver = FTH(), int argc = 0, FTH argv[] = NULL ); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(const char *value, int length = -1); + static inline return_t New(const uint16_t *value, int length = -1); + static inline return_t New(std::string const& value); + + static inline return_t New(v8::String::ExternalStringResource * value); + static inline return_t New(NanExternalOneByteStringResource * value); + + // TODO(agnat): Deprecate. + static inline return_t New(const uint8_t * value, int length = -1); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(v8::Handle value); +}; + +} // end of namespace NanIntern + +#if (NODE_MODULE_VERSION >= 12) + +namespace NanIntern { + +template <> +struct Factory : FactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +} // end of namespace NanIntern + +# include "nan_implementation_12_inl.h" + +#else // NODE_MODULE_VERSION >= 12 + +# include "nan_implementation_pre_12_inl.h" + +#endif + +//=== API ====================================================================== + +template +typename NanIntern::Factory::return_t +NanNew() { + return NanIntern::Factory::New(); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0) { + return NanIntern::Factory::New(arg0); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1) { + return NanIntern::Factory::New(arg0, arg1); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1, A2 arg2) { + return NanIntern::Factory::New(arg0, arg1, arg2); +} + +template +typename NanIntern::Factory::return_t +NanNew(A0 arg0, A1 arg1, A2 arg2, A3 arg3) { + return NanIntern::Factory::New(arg0, arg1, arg2, arg3); +} + +// Note(agnat): When passing overloaded function pointers to template functions +// as generic arguments the compiler needs help in picking the right overload. +// These two functions handle NanNew and NanNew with +// all argument variations. + +// v8::Function and v8::FunctionTemplate with one or two arguments +template +typename NanIntern::Factory::return_t +NanNew( NanFunctionCallback callback + , v8::Handle data = v8::Handle()) { + return NanIntern::Factory::New(callback, data); +} + +// v8::Function and v8::FunctionTemplate with three arguments +template +typename NanIntern::Factory::return_t +NanNew( NanFunctionCallback callback + , v8::Handle data = v8::Handle() + , A2 a2 = A2()) { + return NanIntern::Factory::New(callback, data, a2); +} + +// Convenience + +template inline v8::Local NanNew(v8::Handle h); +template inline v8::Local NanNew(v8::Persistent const& p); + +inline +NanIntern::Factory::return_t +NanNew(bool value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(int32_t value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(uint32_t value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(double value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(std::string const& value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const char * value, int length) { + return NanNew(value, length); +} + +inline +NanIntern::Factory::return_t +NanNew(const char * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const uint8_t * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(const uint16_t * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(v8::String::ExternalStringResource * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(NanExternalOneByteStringResource * value) { + return NanNew(value); +} + +inline +NanIntern::Factory::return_t +NanNew(v8::Handle pattern, v8::RegExp::Flags flags) { + return NanNew(pattern, flags); +} + +#endif // NAN_NEW_H_ diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_string_bytes.h b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_string_bytes.h new file mode 100644 index 00000000..9deecfbb --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/nan_string_bytes.h @@ -0,0 +1,312 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +#ifndef NAN_STRING_BYTES_H_ +#define NAN_STRING_BYTES_H_ + +// Decodes a v8::Handle or Buffer to a raw char* + +#include +#include +#include +#include // memcpy +#include + +namespace NanIntern { + +using v8::Local; +using v8::Handle; +using v8::Object; +using v8::String; +using v8::Value; + + +//// Base 64 //// + +#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) + + + +//// Nan::HEX //// + +static bool contains_non_ascii_slow(const char* buf, size_t len) { + for (size_t i = 0; i < len; ++i) { + if (buf[i] & 0x80) return true; + } + return false; +} + + +static bool contains_non_ascii(const char* src, size_t len) { + if (len < 16) { + return contains_non_ascii_slow(src, len); + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned unaligned = reinterpret_cast(src) & align_mask; + + if (unaligned > 0) { + const unsigned n = bytes_per_word - unaligned; + if (contains_non_ascii_slow(src, n)) return true; + src += n; + len -= n; + } + + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = 0x8080808080808080ll; +#else + const uintptr_t mask = 0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + if (srcw[i] & mask) return true; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + if (contains_non_ascii_slow(src + offset, remainder)) return true; + } + + return false; +} + + +static void force_ascii_slow(const char* src, char* dst, size_t len) { + for (size_t i = 0; i < len; ++i) { + dst[i] = src[i] & 0x7f; + } +} + + +static void force_ascii(const char* src, char* dst, size_t len) { + if (len < 16) { + force_ascii_slow(src, dst, len); + return; + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned src_unalign = reinterpret_cast(src) & align_mask; + const unsigned dst_unalign = reinterpret_cast(dst) & align_mask; + + if (src_unalign > 0) { + if (src_unalign == dst_unalign) { + const unsigned unalign = bytes_per_word - src_unalign; + force_ascii_slow(src, dst, unalign); + src += unalign; + dst += unalign; + len -= src_unalign; + } else { + force_ascii_slow(src, dst, len); + return; + } + } + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = ~0x8080808080808080ll; +#else + const uintptr_t mask = ~0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + uintptr_t* dstw = reinterpret_cast(dst); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + dstw[i] = srcw[i] & mask; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + force_ascii_slow(src + offset, dst + offset, remainder); + } +} + + +static size_t base64_encode(const char* src, + size_t slen, + char* dst, + size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= base64_encoded_size(slen) && + "not enough space provided for base64 encode"); + + dlen = base64_encoded_size(slen); + + unsigned a; + unsigned b; + unsigned c; + unsigned i; + unsigned k; + unsigned n; + + static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + + i = 0; + k = 0; + n = slen / 3 * 3; + + while (i < n) { + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + c = src[i + 2] & 0xff; + + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; + dst[k + 3] = table[c & 0x3f]; + + i += 3; + k += 4; + } + + if (n != slen) { + switch (slen - n) { + case 1: + a = src[i + 0] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[(a & 3) << 4]; + dst[k + 2] = '='; + dst[k + 3] = '='; + break; + + case 2: + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[(b & 0x0f) << 2]; + dst[k + 3] = '='; + break; + } + } + + return dlen; +} + + +static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= slen * 2 && + "not enough space provided for hex encode"); + + dlen = slen * 2; + for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { + static const char hex[] = "0123456789abcdef"; + uint8_t val = static_cast(src[i]); + dst[k + 0] = hex[val >> 4]; + dst[k + 1] = hex[val & 15]; + } + + return dlen; +} + + + +static Local Encode(const char* buf, + size_t buflen, + enum Nan::Encoding encoding) { + assert(buflen <= node::Buffer::kMaxLength); + if (!buflen && encoding != Nan::BUFFER) + return NanNew(""); + + Local val; + switch (encoding) { + case Nan::BUFFER: + return NanNewBufferHandle(buf, buflen); + + case Nan::ASCII: + if (contains_non_ascii(buf, buflen)) { + char* out = new char[buflen]; + force_ascii(buf, out, buflen); + val = NanNew(out, buflen); + delete[] out; + } else { + val = NanNew(buf, buflen); + } + break; + + case Nan::UTF8: + val = NanNew(buf, buflen); + break; + + case Nan::BINARY: { + // TODO(isaacs) use ExternalTwoByteString? + const unsigned char *cbuf = reinterpret_cast(buf); + uint16_t * twobytebuf = new uint16_t[buflen]; + for (size_t i = 0; i < buflen; i++) { + // XXX is the following line platform independent? + twobytebuf[i] = cbuf[i]; + } + val = NanNew(twobytebuf, buflen); + delete[] twobytebuf; + break; + } + + case Nan::BASE64: { + size_t dlen = base64_encoded_size(buflen); + char* dst = new char[dlen]; + + size_t written = base64_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = NanNew(dst, dlen); + delete[] dst; + break; + } + + case Nan::UCS2: { + const uint16_t* data = reinterpret_cast(buf); + val = NanNew(data, buflen / 2); + break; + } + + case Nan::HEX: { + size_t dlen = buflen * 2; + char* dst = new char[dlen]; + size_t written = hex_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = NanNew(dst, dlen); + delete[] dst; + break; + } + + default: + assert(0 && "unknown encoding"); + break; + } + + return val; +} + +#undef base64_encoded_size + +} // namespace NanIntern + +#endif // NAN_STRING_BYTES_H_ diff --git a/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/package.json b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/package.json new file mode 100644 index 00000000..02953f62 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/node_modules/nan/package.json @@ -0,0 +1,89 @@ +{ + "name": "nan", + "version": "1.6.2", + "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" + }, + "scripts": { + "test": "tap --gc test/js/*-test.js", + "rebuild-tests": "pangyp rebuild --directory test" + }, + "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" + }, + { + "name": "David Siegel", + "email": "david@artcom.de", + "url": "https://github.com/agnat" + } + ], + "devDependencies": { + "bindings": "~1.2.1", + "node-gyp": "~1.0.2", + "pangyp": "~2.0.1", + "tap": "~0.5.0", + "xtend": "~4.0.0" + }, + "license": "MIT", + "gitHead": "ab0e5eed8d4aa36111bf8f44cf75644ece327e98", + "bugs": { + "url": "https://github.com/rvagg/nan/issues" + }, + "homepage": "https://github.com/rvagg/nan", + "_id": "nan@1.6.2", + "_shasum": "2657d1c43b00f1e847e083832285b7d8f5ba8ec8", + "_from": "nan@>=1.6.0 <1.7.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + }, + "maintainers": [ + { + "name": "rvagg", + "email": "rod@vagg.org" + }, + { + "name": "kkoopa", + "email": "bbyholm@abo.fi" + } + ], + "dist": { + "shasum": "2657d1c43b00f1e847e083832285b7d8f5ba8ec8", + "tarball": "http://registry.npmjs.org/nan/-/nan-1.6.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/nan/-/nan-1.6.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/ws/node_modules/utf-8-validate/package.json b/node_modules/ws/node_modules/utf-8-validate/package.json new file mode 100644 index 00000000..1898d9d3 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/package.json @@ -0,0 +1,63 @@ +{ + "name": "utf-8-validate", + "version": "1.0.1", + "description": "Validate UTF-8 for Web", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "install": "node-gyp rebuild" + }, + "repository": { + "type": "git", + "url": "https://github.com/websockets/utf-8-validate" + }, + "keywords": [ + "utf-8-validate" + ], + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/websockets/utf-8-validate/issues" + }, + "homepage": "https://github.com/websockets/utf-8-validate", + "dependencies": { + "bindings": "1.2.x", + "nan": "1.6.x" + }, + "gypfile": true, + "gitHead": "1c0a74c3f2a8bb9e5b14df235404faa3760abce3", + "_id": "utf-8-validate@1.0.1", + "_shasum": "d15eb67e28f6bb93c9401eeb7eac7030a183e8d1", + "_from": "utf-8-validate@>=1.0.0 <1.1.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + }, + "maintainers": [ + { + "name": "einaros", + "email": "einaros@gmail.com" + }, + { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + }, + { + "name": "v1", + "email": "info@3rd-Eden.com" + } + ], + "dist": { + "shasum": "d15eb67e28f6bb93c9401eeb7eac7030a183e8d1", + "tarball": "http://registry.npmjs.org/utf-8-validate/-/utf-8-validate-1.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/ws/node_modules/utf-8-validate/src/validation.cc b/node_modules/ws/node_modules/utf-8-validate/src/validation.cc new file mode 100644 index 00000000..264edcd7 --- /dev/null +++ b/node_modules/ws/node_modules/utf-8-validate/src/validation.cc @@ -0,0 +1,148 @@ +/*! + * UTF-8 validate: UTF-8 validation for WebSockets. + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "nan.h" + +using namespace v8; +using namespace node; + +#define UNI_SUR_HIGH_START (uint32_t) 0xD800 +#define UNI_SUR_LOW_END (uint32_t) 0xDFFF +#define UNI_REPLACEMENT_CHAR (uint32_t) 0x0000FFFD +#define UNI_MAX_LEGAL_UTF32 (uint32_t) 0x0010FFFF + +static const uint8_t trailingBytesForUTF8[256] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 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, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 +}; + +static const uint32_t offsetsFromUTF8[6] = { + 0x00000000, 0x00003080, 0x000E2080, + 0x03C82080, 0xFA082080, 0x82082080 +}; + +static int isLegalUTF8(const uint8_t *source, const int length) +{ + uint8_t a; + const uint8_t *srcptr = source+length; + switch (length) { + default: return 0; + /* Everything else falls through when "true"... */ + /* RFC3629 makes 5 & 6 bytes UTF-8 illegal + case 6: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; + case 5: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; */ + case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; + case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; + case 2: if ((a = (*--srcptr)) > 0xBF) return 0; + switch (*source) { + /* no fall-through in this inner switch */ + case 0xE0: if (a < 0xA0) return 0; break; + case 0xED: if (a > 0x9F) return 0; break; + case 0xF0: if (a < 0x90) return 0; break; + case 0xF4: if (a > 0x8F) return 0; break; + default: if (a < 0x80) return 0; + } + + case 1: if (*source >= 0x80 && *source < 0xC2) return 0; + } + if (*source > 0xF4) return 0; + return 1; +} + +int is_valid_utf8 (size_t len, char *value) +{ + /* is the string valid UTF-8? */ + for (unsigned int i = 0; i < len; i++) { + uint32_t ch = 0; + uint8_t extrabytes = trailingBytesForUTF8[(uint8_t) value[i]]; + + if (extrabytes + i >= len) + return 0; + + if (isLegalUTF8 ((uint8_t *) (value + i), extrabytes + 1) == 0) return 0; + + switch (extrabytes) { + case 5 : ch += (uint8_t) value[i++]; ch <<= 6; + case 4 : ch += (uint8_t) value[i++]; ch <<= 6; + case 3 : ch += (uint8_t) value[i++]; ch <<= 6; + case 2 : ch += (uint8_t) value[i++]; ch <<= 6; + case 1 : ch += (uint8_t) value[i++]; ch <<= 6; + case 0 : ch += (uint8_t) value[i]; + } + + ch -= offsetsFromUTF8[extrabytes]; + + if (ch <= UNI_MAX_LEGAL_UTF32) { + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) + return 0; + } else { + return 0; + } + } + + return 1; +} + +class Validation : public ObjectWrap +{ +public: + + static void Initialize(v8::Handle target) + { + NanScope(); + Local t = NanNew(New); + t->InstanceTemplate()->SetInternalFieldCount(1); + NODE_SET_METHOD(t, "isValidUTF8", Validation::IsValidUTF8); + target->Set(NanNew("Validation"), t->GetFunction()); + } + +protected: + + static NAN_METHOD(New) + { + NanScope(); + Validation* validation = new Validation(); + validation->Wrap(args.This()); + NanReturnValue(args.This()); + } + + static NAN_METHOD(IsValidUTF8) + { + NanScope(); + if (!Buffer::HasInstance(args[0])) { + return NanThrowTypeError("First argument needs to be a buffer"); + } + Local buffer_obj = args[0]->ToObject(); + char *buffer_data = Buffer::Data(buffer_obj); + size_t buffer_length = Buffer::Length(buffer_obj); + NanReturnValue(is_valid_utf8(buffer_length, buffer_data) == 1 ? NanTrue() : NanFalse()); + } +}; +#if !NODE_VERSION_AT_LEAST(0,10,0) +extern "C" +#endif +void init (Handle target) +{ + NanScope(); + Validation::Initialize(target); +} + +NODE_MODULE(validation, init) + diff --git a/node_modules/ws/package.json b/node_modules/ws/package.json new file mode 100644 index 00000000..5ae881c1 --- /dev/null +++ b/node_modules/ws/package.json @@ -0,0 +1,87 @@ +{ + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "name": "ws", + "description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455", + "version": "0.7.1", + "license": "MIT", + "keywords": [ + "Hixie", + "HyBi", + "Push", + "RFC-6455", + "WebSocket", + "WebSockets", + "real-time" + ], + "repository": { + "type": "git", + "url": "git://github.com/websockets/ws.git" + }, + "scripts": { + "test": "make test" + }, + "dependencies": { + "options": ">=0.0.5", + "ultron": "1.0.x", + "bufferutil": "1.0.x", + "utf-8-validate": "1.0.x" + }, + "optionalDependencies": { + "bufferutil": "1.0.x", + "utf-8-validate": "1.0.x" + }, + "devDependencies": { + "ansi": "0.3.x", + "benchmark": "0.3.x", + "expect.js": "0.3.x", + "mocha": "2.0.x", + "should": "4.3.x", + "tinycolor": "0.0.x" + }, + "browser": "./lib/browser.js", + "component": { + "scripts": { + "ws/index.js": "./lib/browser.js" + } + }, + "gypfile": true, + "gitHead": "608df82a333de45905f05ca60f18a625b4c3293b", + "bugs": { + "url": "https://github.com/websockets/ws/issues" + }, + "homepage": "https://github.com/websockets/ws", + "_id": "ws@0.7.1", + "_shasum": "8f1c7864ca08081be3cd0ac330df0d29c5fcd0da", + "_from": "ws@0.7.1", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + }, + "maintainers": [ + { + "name": "einaros", + "email": "einaros@gmail.com" + }, + { + "name": "v1", + "email": "info@3rd-Eden.com" + }, + { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + } + ], + "dist": { + "shasum": "8f1c7864ca08081be3cd0ac330df0d29c5fcd0da", + "tarball": "http://registry.npmjs.org/ws/-/ws-0.7.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ws/-/ws-0.7.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/xtend/.jshintrc b/node_modules/xtend/.jshintrc new file mode 100644 index 00000000..77887b5f --- /dev/null +++ b/node_modules/xtend/.jshintrc @@ -0,0 +1,30 @@ +{ + "maxdepth": 4, + "maxstatements": 200, + "maxcomplexity": 12, + "maxlen": 80, + "maxparams": 5, + + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": false, + "noarg": true, + "noempty": true, + "nonew": true, + "undef": true, + "unused": "vars", + "trailing": true, + + "quotmark": true, + "expr": true, + "asi": true, + + "browser": false, + "esnext": true, + "devel": false, + "node": false, + "nonstandard": false, + + "predef": ["require", "module", "__dirname", "__filename"] +} diff --git a/node_modules/xtend/.npmignore b/node_modules/xtend/.npmignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/node_modules/xtend/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/xtend/LICENCE b/node_modules/xtend/LICENCE new file mode 100644 index 00000000..1a14b437 --- /dev/null +++ b/node_modules/xtend/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2012-2014 Raynos. + +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/node_modules/xtend/Makefile b/node_modules/xtend/Makefile new file mode 100644 index 00000000..d583fcf4 --- /dev/null +++ b/node_modules/xtend/Makefile @@ -0,0 +1,4 @@ +browser: + node ./support/compile + +.PHONY: browser \ No newline at end of file diff --git a/node_modules/xtend/README.md b/node_modules/xtend/README.md new file mode 100644 index 00000000..093cb297 --- /dev/null +++ b/node_modules/xtend/README.md @@ -0,0 +1,32 @@ +# xtend + +[![browser support][3]][4] + +[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) + +Extend like a boss + +xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence. + +## Examples + +```js +var extend = require("xtend") + +// extend returns a new object. Does not mutate arguments +var combination = extend({ + a: "a", + b: 'c' +}, { + b: "b" +}) +// { a: "a", b: "b" } +``` + +## Stability status: Locked + +## MIT Licenced + + + [3]: http://ci.testling.com/Raynos/xtend.png + [4]: http://ci.testling.com/Raynos/xtend diff --git a/node_modules/xtend/immutable.js b/node_modules/xtend/immutable.js new file mode 100644 index 00000000..5b760152 --- /dev/null +++ b/node_modules/xtend/immutable.js @@ -0,0 +1,17 @@ +module.exports = extend + +function extend() { + var target = {} + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (source.hasOwnProperty(key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/xtend/mutable.js b/node_modules/xtend/mutable.js new file mode 100644 index 00000000..a34475eb --- /dev/null +++ b/node_modules/xtend/mutable.js @@ -0,0 +1,15 @@ +module.exports = extend + +function extend(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (source.hasOwnProperty(key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/xtend/package.json b/node_modules/xtend/package.json new file mode 100644 index 00000000..a5a88994 --- /dev/null +++ b/node_modules/xtend/package.json @@ -0,0 +1,88 @@ +{ + "name": "xtend", + "version": "4.0.0", + "description": "extend like a boss", + "keywords": [ + "extend", + "merge", + "options", + "opts", + "object", + "array" + ], + "author": { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + "repository": { + "type": "git", + "url": "git://github.com/Raynos/xtend.git" + }, + "main": "immutable", + "scripts": { + "test": "node test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.0" + }, + "homepage": "https://github.com/Raynos/xtend", + "contributors": [ + { + "name": "Jake Verbaten" + }, + { + "name": "Matt Esch" + } + ], + "bugs": { + "url": "https://github.com/Raynos/xtend/issues", + "email": "raynos2@gmail.com" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/raynos/xtend/raw/master/LICENSE" + } + ], + "testling": { + "files": "test.js", + "browsers": [ + "ie/7..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest" + ] + }, + "engines": { + "node": ">=0.4" + }, + "gitHead": "94a95d76154103290533b2c55ffa0fe4be16bfef", + "_id": "xtend@4.0.0", + "_shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "_from": "xtend@4.0.0", + "_npmVersion": "1.4.15", + "_npmUser": { + "name": "raynos", + "email": "raynos2@gmail.com" + }, + "maintainers": [ + { + "name": "raynos", + "email": "raynos2@gmail.com" + } + ], + "dist": { + "shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "tarball": "http://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/xtend/test.js b/node_modules/xtend/test.js new file mode 100644 index 00000000..3369d796 --- /dev/null +++ b/node_modules/xtend/test.js @@ -0,0 +1,63 @@ +var test = require("tape") +var extend = require("./") +var mutableExtend = require("./mutable") + +test("merge", function(assert) { + var a = { a: "foo" } + var b = { b: "bar" } + + assert.deepEqual(extend(a, b), { a: "foo", b: "bar" }) + assert.end() +}) + +test("replace", function(assert) { + var a = { a: "foo" } + var b = { a: "bar" } + + assert.deepEqual(extend(a, b), { a: "bar" }) + assert.end() +}) + +test("undefined", function(assert) { + var a = { a: undefined } + var b = { b: "foo" } + + assert.deepEqual(extend(a, b), { a: undefined, b: "foo" }) + assert.deepEqual(extend(b, a), { a: undefined, b: "foo" }) + assert.end() +}) + +test("handle 0", function(assert) { + var a = { a: "default" } + var b = { a: 0 } + + assert.deepEqual(extend(a, b), { a: 0 }) + assert.deepEqual(extend(b, a), { a: "default" }) + assert.end() +}) + +test("is immutable", function (assert) { + var record = {} + + extend(record, { foo: "bar" }) + assert.equal(record.foo, undefined) + assert.end() +}) + +test("null as argument", function (assert) { + var a = { foo: "bar" } + var b = null + var c = void 0 + + assert.deepEqual(extend(b, a, c), { foo: "bar" }) + assert.end() +}) + +test("mutable", function (assert) { + var a = { foo: "bar" } + + mutableExtend(a, { bar: "baz" }) + + assert.equal(a.bar, "baz") + assert.end() +}) diff --git a/package.json b/package.json index 7a508b72..b65c7f1a 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "bn.js": "^2.0.0", "buffer-equal": "0.0.1", "compact2string": "^1.2.0", + "crypto-browserify": "^3.9.14", "debug": "^2.0.0", "hat": "0.0.3", "inherits": "^2.0.1", @@ -32,7 +33,7 @@ "once": "^1.3.0", "run-series": "^1.0.2", "simple-get": "^1.3.0", - "simple-peer": "^5.0.0", + "simple-peer": "precisit/simple-peer", "simple-websocket": "^2.0.0", "string2compact": "^1.1.1", "ws": "^0.7.1",